@ssafy-mhk/e-ver 1.0.4 → 1.0.6

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
@@ -1,49 +1,13 @@
1
- import { create as e } from "zustand";
2
- import { Suspense as t, createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
3
- import * as l from "three";
4
- import { Skeleton as u } from "three";
5
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
6
- import { Canvas as m, useFrame as h, useThree as g } from "@react-three/fiber";
7
- import { Environment as _, OrbitControls as v, OrthographicCamera as y, Stats as b, useGLTF as x } from "@react-three/drei";
8
- import { DrawingUtils as S, FilesetResolver as C, PoseLandmarker as w } from "@mediapipe/tasks-vision";
9
- import { clone as T } from "three/examples/jsm/utils/SkeletonUtils.js";
10
- import { VRMLoaderPlugin as E, VRMUtils as D } from "@pixiv/three-vrm";
11
- //#region src/store/useEverStore.ts
12
- var O = e((e) => ({
13
- isWebcamActive: !1,
14
- activeGarmentUrl: null,
15
- landmarks: null,
16
- worldLandmarks: null,
17
- fitResult: null,
18
- setWebcamActive: (t) => e({ isWebcamActive: t }),
19
- setActiveGarmentUrl: (t) => e({ activeGarmentUrl: t }),
20
- setLandmarks: (t, n) => e({
21
- landmarks: t,
22
- worldLandmarks: n
23
- }),
24
- setFitResult: (t) => e({ fitResult: t })
25
- })), k = n(void 0);
26
- function A() {
27
- let e = i(k);
28
- if (!e) throw Error("useEver must be used within an EverProvider");
29
- return e;
30
- }
31
- //#endregion
32
- //#region src/components/EverProvider.tsx
33
- var j = ({ children: e }) => {
34
- let t = s(null), [n, i] = c(null), a = {
35
- videoRef: t,
36
- avatarBones: n,
37
- setAvatarBones: r((e) => {
38
- i(e);
39
- }, []),
40
- isProviderReady: !0
41
- };
42
- return /* @__PURE__ */ f(k.Provider, {
43
- value: a,
44
- children: e
45
- });
46
- }, M = ({ children: e, showEnvironment: n = !0, useDefaultLights: r = !0, enableOrbitControls: i = !0 }) => /* @__PURE__ */ f(j, { children: /* @__PURE__ */ f(m, {
1
+ import { Suspense as e, useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
2
+ import { Canvas as o, useFrame as s, useThree as c } from "@react-three/fiber";
3
+ import { Environment as l, OrbitControls as u, OrthographicCamera as d, Stats as f, useGLTF as p } from "@react-three/drei";
4
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ import { DrawingUtils as _, FilesetResolver as v, PoseLandmarker as y } from "@mediapipe/tasks-vision";
6
+ import * as b from "three";
7
+ import { clone as x } from "three/examples/jsm/utils/SkeletonUtils.js";
8
+ import { VRMLoaderPlugin as S, VRMUtils as C } from "@pixiv/three-vrm";
9
+ //#region src/components/EverCanvas.tsx
10
+ var w = ({ children: t, showEnvironment: n = !0, useDefaultLights: r = !0, enableOrbitControls: i = !0 }) => /* @__PURE__ */ h(o, {
47
11
  camera: {
48
12
  position: [
49
13
  0,
@@ -64,12 +28,12 @@ var j = ({ children: e }) => {
64
28
  antialias: !0,
65
29
  preserveDrawingBuffer: !0
66
30
  },
67
- children: /* @__PURE__ */ p(t, {
31
+ children: /* @__PURE__ */ g(e, {
68
32
  fallback: null,
69
33
  children: [
70
- r ? /* @__PURE__ */ p(d, { children: [
71
- /* @__PURE__ */ f("ambientLight", { intensity: .7 }),
72
- /* @__PURE__ */ f("directionalLight", {
34
+ r ? /* @__PURE__ */ g(m, { children: [
35
+ /* @__PURE__ */ h("ambientLight", { intensity: .7 }),
36
+ /* @__PURE__ */ h("directionalLight", {
73
37
  position: [
74
38
  2,
75
39
  5,
@@ -78,7 +42,7 @@ var j = ({ children: e }) => {
78
42
  intensity: 1.5,
79
43
  castShadow: !0
80
44
  }),
81
- /* @__PURE__ */ f("directionalLight", {
45
+ /* @__PURE__ */ h("directionalLight", {
82
46
  position: [
83
47
  -2,
84
48
  5,
@@ -87,9 +51,9 @@ var j = ({ children: e }) => {
87
51
  intensity: .5
88
52
  })
89
53
  ] }) : null,
90
- n && /* @__PURE__ */ f(_, { preset: "city" }),
91
- e,
92
- i ? /* @__PURE__ */ f(v, {
54
+ n && /* @__PURE__ */ h(l, { preset: "city" }),
55
+ t,
56
+ i ? /* @__PURE__ */ h(u, {
93
57
  enablePan: !1,
94
58
  minPolarAngle: Math.PI / 4,
95
59
  maxPolarAngle: Math.PI / 1.5,
@@ -98,7 +62,7 @@ var j = ({ children: e }) => {
98
62
  }) : null
99
63
  ]
100
64
  })
101
- }) }), N = {
65
+ }), T = {
102
66
  refShoulderWidthCm: 44,
103
67
  refHeightCm: 170,
104
68
  refArmLengthCm: 58,
@@ -114,37 +78,37 @@ var j = ({ children: e }) => {
114
78
  armEaseCm: 2,
115
79
  fitEaseScale: 1.03
116
80
  };
117
- function P(e, t, n) {
81
+ function E(e, t, n) {
118
82
  return !e || t <= 0 ? 1 : (e + n) / t;
119
83
  }
120
- function ee(e, t, n) {
84
+ function D(e, t, n) {
121
85
  return Math.max(t, Math.min(n, e));
122
86
  }
123
- function te(e, t = N) {
124
- let n = P(e.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm), r = P(e.chestCircumferenceCm, t.refChestCircumferenceCm, t.chestEaseCm), i = P(e.waistCircumferenceCm, t.refWaistCircumferenceCm, t.waistEaseCm), a = P(e.hipWidthCm, t.refHipWidthCm, t.hipEaseCm), o = P(e.torsoLengthCm, t.refTorsoLengthCm, t.torsoEaseCm), s = t.refHeightCm > 0 ? e.heightCm / t.refHeightCm : 1, c = P(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);
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);
125
89
  return {
126
- scaleX: ee(l, .82, 1.85),
127
- scaleY: ee(d, .85, 1.55),
128
- scaleZ: ee(u, .84, 1.9),
129
- sleeveScale: ee(c, .8, 1.55),
130
- fitEaseScale: ee(t.fitEaseScale, 1, 1.2)
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)
131
95
  };
132
96
  }
133
97
  //#endregion
134
98
  //#region src/fitting/bodyFirstFitting.ts
135
- var ne = .82, re = 2.1, ie = .85, ae = 1.8, F = .84, oe = 2.1, I = .8, L = 1.7, se = 1, ce = 1.25, le = {
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 = {
136
100
  scaleX: 1,
137
101
  scaleY: 1,
138
102
  scaleZ: 1,
139
103
  sleeveScale: 1,
140
104
  fitEaseScale: 1.02
141
- }, ue = {
105
+ }, te = {
142
106
  scaleX: 1,
143
107
  scaleY: 1,
144
108
  scaleZ: 1,
145
109
  sleeveScale: 1,
146
110
  fitEaseScale: 1
147
- }, de = {
111
+ }, ne = {
148
112
  slim: {
149
113
  x: .95,
150
114
  y: .95,
@@ -163,7 +127,7 @@ var ne = .82, re = 2.1, ie = .85, ae = 1.8, F = .84, oe = 2.1, I = .8, L = 1.7,
163
127
  z: 1.02,
164
128
  ease: 1.03
165
129
  }
166
- }, fe = {
130
+ }, re = {
167
131
  narrow: {
168
132
  width: .97,
169
133
  shoulder: .97
@@ -176,7 +140,7 @@ var ne = .82, re = 2.1, ie = .85, ae = 1.8, F = .84, oe = 2.1, I = .8, L = 1.7,
176
140
  width: 1.03,
177
141
  shoulder: 1.04
178
142
  }
179
- }, pe = {
143
+ }, z = {
180
144
  tapered: {
181
145
  depth: .98,
182
146
  vertical: .995,
@@ -193,114 +157,114 @@ var ne = .82, re = 2.1, ie = .85, ae = 1.8, F = .84, oe = 2.1, I = .8, L = 1.7,
193
157
  hip: 1.03
194
158
  }
195
159
  };
196
- function R(e, t, n) {
160
+ function B(e, t, n) {
197
161
  return Math.max(t, Math.min(n, e));
198
162
  }
199
- function z(e, t, n, r) {
200
- return !e || !t || t <= 0 ? 1 : R(e / t, n, r);
163
+ function V(e, t, n, r) {
164
+ return !e || !t || t <= 0 ? 1 : B(e / t, n, r);
201
165
  }
202
- function me(e, t, n, r, i) {
203
- return !e || t <= 0 ? 1 : R((e + n) / t, r, i);
166
+ function H(e, t, n, r, i) {
167
+ return !e || t <= 0 ? 1 : B((e + n) / t, r, i);
204
168
  }
205
- function he(e) {
206
- return fe[e?.taxonomy.upperBodySilhouette ?? "balanced"] ?? fe.balanced;
169
+ function ie(e) {
170
+ return re[e?.taxonomy.upperBodySilhouette ?? "balanced"] ?? re.balanced;
207
171
  }
208
- function ge(e) {
209
- return pe[e?.taxonomy.torsoOrPelvisProfile ?? "balanced"] ?? pe.balanced;
172
+ function ae(e) {
173
+ return z[e?.taxonomy.torsoOrPelvisProfile ?? "balanced"] ?? z.balanced;
210
174
  }
211
- function _e(e) {
175
+ function oe(e) {
212
176
  if (!e) return !1;
213
177
  let { metrics: t } = e;
214
178
  return !!(t.heightCm || t.chestCm || t.waistCm || t.shoulderWidthCm || t.armLengthCm || t.torsoLengthCm || t.neckToHipCm);
215
179
  }
216
- function ve(e, t) {
217
- let { metrics: n } = e, r = he(e), i = ge(e), a = Math.max(me(n.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm * .55, .88, 1.3), me(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .35, .9, 1.34), me(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .3, .9, 1.3)) * r.width, o = Math.max(z(n.heightCm, t.refHeightCm, .9, 1.18), me(n.torsoLengthCm ?? n.neckToHipCm, t.refTorsoLengthCm, t.torsoEaseCm * .2, .9, 1.16)) * i.vertical, s = Math.max(me(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .15, .9, 1.34), me(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .1, .9, 1.28)) * i.depth;
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;
218
182
  return {
219
- scaleX: R(a, ne, re),
220
- scaleY: R(o, ie, ae),
221
- scaleZ: R(s, F, oe),
222
- sleeveScale: R(z(n.armLengthCm, t.refArmLengthCm, .9, 1.16), I, L),
223
- fitEaseScale: R(t.fitEaseScale * (r.width * .5 + i.depth * .5), se, ce)
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)
224
188
  };
225
189
  }
226
- function ye(e, t) {
227
- let { metrics: n } = t, r = he(t), i = ge(t), a = z(e.shoulderWidthCm, n.shoulderWidthCm, .9, 1.14) * r.shoulder, o = z(e.chestCircumferenceCm, n.chestCm, .9, 1.15), s = z(e.waistCircumferenceCm, n.waistCm, .9, 1.15);
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);
228
192
  return {
229
- torsoScale: z(e.torsoLengthCm, n.torsoLengthCm ?? n.neckToHipCm, .9, 1.14),
193
+ torsoScale: V(e.torsoLengthCm, n.torsoLengthCm ?? n.neckToHipCm, .9, 1.14),
230
194
  chestScale: o,
231
195
  waistScale: s,
232
- hipScale: R(s * .6 + i.hip * .4, .92, 1.14),
233
- shoulderAdjust: R(a - 1, -.12, .12),
196
+ hipScale: B(s * .6 + i.hip * .4, .92, 1.14),
197
+ shoulderAdjust: B(a - 1, -.12, .12),
234
198
  postureAdjust: "neutral"
235
199
  };
236
200
  }
237
- function be(e, t, n) {
238
- let r = ge(t), i = R(1 + n.shoulderAdjust, .92, 1.14) * .3 + n.chestScale * .45 + n.waistScale * .25, a = n.chestScale * .45 + n.waistScale * .25 + n.hipScale * .3, o = z(e.armLengthCm, t.metrics.armLengthCm, .9, 1.16), s = Math.max(n.chestScale, n.waistScale, n.hipScale);
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);
239
203
  return {
240
- scaleX: R(i, .92, 1.16),
241
- scaleY: R(n.torsoScale * r.vertical, .92, 1.14),
242
- scaleZ: R(a * r.depth, .92, 1.18),
243
- sleeveScale: R(o, I, L),
244
- fitEaseScale: R(1 + (s - 1) * .22, .99, 1.08)
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)
245
209
  };
246
210
  }
247
- function xe(e, t) {
211
+ function ue(e, t) {
248
212
  if (!t || !Number.isFinite(t) || t <= 0) return e;
249
- let n = R(t, .88, 1.2), r = 1 + (n - 1) * .35;
213
+ let n = B(t, .88, 1.2), r = 1 + (n - 1) * .35;
250
214
  return {
251
- scaleX: R(e.scaleX * n, ne, re),
252
- scaleY: R(e.scaleY * r, ie, ae),
253
- scaleZ: R(e.scaleZ * n, F, oe),
254
- sleeveScale: R(e.sleeveScale * r, I, L),
255
- fitEaseScale: R(e.fitEaseScale * n, se, ce)
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)
256
220
  };
257
221
  }
258
- function Se(e, t) {
259
- let n = de[t];
222
+ function de(e, t) {
223
+ let n = ne[t];
260
224
  return {
261
- scaleX: R(e.scaleX * n.x, ne, re),
262
- scaleY: R(e.scaleY * n.y, ie, ae),
263
- scaleZ: R(e.scaleZ * n.z, F, oe),
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),
264
228
  sleeveScale: e.sleeveScale,
265
- fitEaseScale: R(e.fitEaseScale * n.ease, se, ce)
229
+ fitEaseScale: B(e.fitEaseScale * n.ease, L, R)
266
230
  };
267
231
  }
268
- function Ce(e, t) {
232
+ function fe(e, t) {
269
233
  return {
270
- scaleX: R(e.scaleX * t.scaleX, ne, re),
271
- scaleY: R(e.scaleY * t.scaleY, ie, ae),
272
- scaleZ: R(e.scaleZ * t.scaleZ, F, oe),
273
- sleeveScale: R(e.sleeveScale * t.sleeveScale, I, L),
274
- fitEaseScale: R(e.fitEaseScale * t.fitEaseScale, se, ce)
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)
275
239
  };
276
240
  }
277
- function we({ measurements: e, measurementScale: t, presetSelection: n, fitType: r = "regular", garmentScaleHint: i = null, spec: a = N }) {
278
- let o = _e(n), s = o && n ? ve(n, a) : t ?? le, c = o && n && e ? ye(e, n) : null;
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;
279
243
  return {
280
- scale: Se(xe(Ce(s, e && n && c ? be(e, n, c) : ue), i), r),
244
+ scale: de(ue(fe(s, e && n && c ? le(e, n, c) : te), i), r),
281
245
  morph: c
282
246
  };
283
247
  }
284
248
  //#endregion
285
249
  //#region src/api/EverClient.ts
286
- var Te = "http://localhost:8000/api/v1";
287
- function Ee(e) {
250
+ var me = "http://localhost:8000/api/v1";
251
+ function he(e) {
288
252
  return e.replace(/\/+$/, "");
289
253
  }
290
- function De(e) {
254
+ function ge(e) {
291
255
  try {
292
256
  return new URL(e).origin;
293
257
  } catch {
294
258
  return "";
295
259
  }
296
260
  }
297
- var Oe = class {
261
+ var _e = class {
298
262
  baseUrl;
299
263
  apiOrigin;
300
264
  apiKey;
301
265
  constructor(e) {
302
- let t = typeof e == "string" ? { baseUrl: e } : e ?? {}, n = Ee(t.baseUrl ?? "http://localhost:8000/api/v1");
303
- this.baseUrl = n, this.apiOrigin = De(n), this.apiKey = t.apiKey;
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;
304
268
  }
305
269
  resolveAssetUrl(e) {
306
270
  return e ? e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith("/") ? this.apiOrigin ? `${this.apiOrigin}${e}` : e : this.apiOrigin ? `${this.apiOrigin}/${e}` : `/${e}` : null;
@@ -427,32 +391,32 @@ var Oe = class {
427
391
  return `Request failed with status ${e.status}`;
428
392
  }
429
393
  }
430
- }, ke = "M", Ae = "male-m-balanced-balanced", je = "female-m-balanced-balanced", Me = "rigged_avatar";
431
- function Ne(e, t) {
394
+ }, ve = "M", ye = "male-m-balanced-balanced", be = "female-m-balanced-balanced", xe = "rigged_avatar";
395
+ function Se(e, t) {
432
396
  if (!t) return "";
433
397
  if (/^https?:\/\//.test(t)) return t;
434
398
  let n = t.startsWith("/") ? t : `/${t}`;
435
399
  return n.startsWith("/assets/") || n.startsWith("/static/") ? n : e.resolveAssetUrl(n) ?? n;
436
400
  }
437
- function Pe(e) {
401
+ function Ce(e) {
438
402
  return e === "female" ? "female" : "male";
439
403
  }
440
- function Fe(e, t = {}) {
404
+ function we(e, t = {}) {
441
405
  let n = t.renderMode ?? "rigged_avatar", r = t.legacyPresetId ?? "rigged_avatar", i = `/assets/body-presets/${r}.glb`;
442
406
  return e === r || n !== "preset-native" ? i : `/assets/body-presets/archive/${e}.glb`;
443
407
  }
444
- function Ie(e) {
445
- return e === "female" ? je : Ae;
408
+ function Te(e) {
409
+ return e === "female" ? be : ye;
446
410
  }
447
- function Le(e, t) {
411
+ function Ee(e, t) {
448
412
  return {
449
413
  id: e.id,
450
414
  presetId: e.preset_id,
451
- baseGender: Pe(e.base_gender),
415
+ baseGender: Ce(e.base_gender),
452
416
  sizeBand: e.size_band,
453
417
  upperBodySilhouette: e.upper_body_silhouette,
454
418
  torsoOrPelvisProfile: e.torso_or_pelvis_profile,
455
- modelUrl: Ne(t, e.model_url),
419
+ modelUrl: Se(t, e.model_url),
456
420
  heightCm: e.height_cm ?? null,
457
421
  chestCm: e.chest_cm ?? null,
458
422
  waistCm: e.waist_cm ?? null,
@@ -464,26 +428,26 @@ function Le(e, t) {
464
428
  neckToHipCm: e.neck_to_hip_cm ?? null
465
429
  };
466
430
  }
467
- function Re(e, t = {}) {
431
+ function De(e, t = {}) {
468
432
  return {
469
433
  ...e,
470
- modelUrl: e.modelUrl || Fe(e.presetId, t)
434
+ modelUrl: e.modelUrl || we(e.presetId, t)
471
435
  };
472
436
  }
473
- function ze(e, t = {}) {
474
- return e.length === 0 ? null : Re(e.find((e) => e.sizeBand === ke) || e[Math.floor(e.length / 2)], t);
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);
475
439
  }
476
- function Be(e, t = {}) {
477
- let n = Ie(e);
440
+ function ke(e, t = {}) {
441
+ let n = Te(e);
478
442
  return {
479
443
  id: null,
480
444
  presetId: n,
481
- label: `${e === "female" ? "여성" : "남성"} 기본 ${ke}`,
482
- modelUrl: Fe(n, t),
445
+ label: `${e === "female" ? "여성" : "남성"} 기본 ${ve}`,
446
+ modelUrl: we(n, t),
483
447
  gender: e,
484
448
  source: "fallback",
485
449
  taxonomy: {
486
- sizeBand: ke,
450
+ sizeBand: ve,
487
451
  upperBodySilhouette: "balanced",
488
452
  torsoOrPelvisProfile: "balanced"
489
453
  },
@@ -500,8 +464,8 @@ function Be(e, t = {}) {
500
464
  }
501
465
  };
502
466
  }
503
- function Ve(e, t, n = {}) {
504
- let r = Re(e, n);
467
+ function Ae(e, t, n = {}) {
468
+ let r = De(e, n);
505
469
  return {
506
470
  id: r.id,
507
471
  presetId: r.presetId,
@@ -527,83 +491,82 @@ function Ve(e, t, n = {}) {
527
491
  }
528
492
  };
529
493
  }
530
- function He(e, t) {
494
+ function je(e, t) {
531
495
  let n = { gender: t };
532
496
  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;
533
497
  }
534
498
  //#endregion
535
499
  //#region src/hooks/useBodyPresetSelection.ts
536
- var Ue = new Oe();
537
- function We(e, t) {
500
+ var Me = new _e();
501
+ function Ne(e, t) {
538
502
  return {
539
- selection: Be(e, t),
503
+ selection: ke(e, t),
540
504
  loading: !0,
541
505
  error: null
542
506
  };
543
507
  }
544
- function Ge(e, t = {}) {
545
- let n = Pe(t.gender), r = t.renderMode, i = t.legacyPresetId, o = {
546
- gender: n,
547
- renderMode: r,
548
- legacyPresetId: i
549
- }, [s, l] = c(() => We(n, o));
550
- return a(() => {
508
+ function Pe(e, t = {}) {
509
+ let i = Ce(t.gender), o = t.renderMode, s = t.legacyPresetId, c = r(() => ({
510
+ gender: i,
511
+ renderMode: o,
512
+ legacyPresetId: s
513
+ }), [
514
+ i,
515
+ s,
516
+ o
517
+ ]), [l, u] = a(() => Ne(i, c));
518
+ return n(() => {
551
519
  let t = new AbortController();
552
- async function r() {
553
- l((e) => ({
520
+ async function n() {
521
+ u((e) => ({
554
522
  ...e,
555
523
  loading: !0,
556
524
  error: null
557
525
  }));
558
526
  try {
559
527
  if (e) {
560
- let r = Ve(Le(await Ue.matchBodyPreset(He(e, n)), Ue), "match", o);
528
+ let n = Ae(Ee(await Me.matchBodyPreset(je(e, c.gender)), Me), "match", c);
561
529
  if (t.signal.aborted) return;
562
- l({
563
- selection: r,
530
+ u({
531
+ selection: n,
564
532
  loading: !1,
565
533
  error: null
566
534
  });
567
535
  return;
568
536
  }
569
- let r = (await Ue.listBodyPresets(n)).map((e) => Le(e, Ue));
537
+ let n = (await Me.listBodyPresets(c.gender)).map((e) => Ee(e, Me));
570
538
  if (t.signal.aborted) return;
571
- let i = ze(r, o);
572
- if (i) {
573
- l({
574
- selection: Ve(i, "default", o),
539
+ let r = Oe(n, c);
540
+ if (r) {
541
+ u({
542
+ selection: Ae(r, "default", c),
575
543
  loading: !1,
576
544
  error: null
577
545
  });
578
546
  return;
579
547
  }
580
- l({
581
- selection: Be(n, o),
548
+ u({
549
+ selection: ke(c.gender, c),
582
550
  loading: !1,
583
551
  error: "바디 프리셋 응답이 비어 있어 기본 프리셋으로 대체했습니다."
584
552
  });
585
553
  } catch (e) {
586
554
  if (t.signal.aborted) return;
587
- l({
588
- selection: Be(n, o),
555
+ u({
556
+ selection: ke(c.gender, c),
589
557
  loading: !1,
590
558
  error: e instanceof Error ? e.message : "바디 프리셋을 불러오지 못해 기본 프리셋으로 대체했습니다."
591
559
  });
592
560
  }
593
561
  }
594
- return r(), () => {
562
+ return n(), () => {
595
563
  t.abort();
596
564
  };
597
- }, [
598
- n,
599
- i,
600
- e,
601
- r
602
- ]), s;
565
+ }, [e, c]), l;
603
566
  }
604
567
  //#endregion
605
568
  //#region src/types/pose.ts
606
- var B = {
569
+ var U = {
607
570
  NOSE: 0,
608
571
  LEFT_EYE_INNER: 1,
609
572
  LEFT_EYE: 2,
@@ -637,25 +600,25 @@ var B = {
637
600
  RIGHT_HEEL: 30,
638
601
  LEFT_FOOT_INDEX: 31,
639
602
  RIGHT_FOOT_INDEX: 32
640
- }, Ke = {
603
+ }, Fe = {
641
604
  positionAlpha: .7,
642
605
  rotationAlpha: .6,
643
606
  visibilityThreshold: .5
644
- }, qe = .5;
645
- function Je(e) {
646
- return e ? (e.visibility ?? 1) >= qe : !1;
607
+ }, Ie = .5;
608
+ function Le(e) {
609
+ return e ? (e.visibility ?? 1) >= Ie : !1;
647
610
  }
648
- function Ye(e, t) {
649
- let n = e[B.NOSE], r = e[B.LEFT_EYE], i = e[B.LEFT_ANKLE], a = e[B.RIGHT_ANKLE];
650
- if (!Je(n) || !Je(r) || !Je(i) || !Je(a)) return 0;
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;
651
614
  let o = n.y - (r.y - n.y) * 2, s = (Math.max(i.y, a.y) - o) * t;
652
615
  return Number.isFinite(s) && s > 0 ? s : 0;
653
616
  }
654
- function Xe(e, t, n = 720) {
655
- let r = Ye(e, n);
617
+ function ze(e, t, n = 720) {
618
+ let r = Re(e, n);
656
619
  return r <= 0 || t <= 0 ? 0 : t / r;
657
620
  }
658
- function Ze(e) {
621
+ function Be(e) {
659
622
  let t = [
660
623
  [15, .8],
661
624
  [18.5, .84],
@@ -672,39 +635,39 @@ function Ze(e) {
672
635
  }
673
636
  return .88;
674
637
  }
675
- function V(e, t, n, r) {
676
- if (!Je(e) || !Je(t)) return null;
638
+ function W(e, t, n, r) {
639
+ if (!Le(e) || !Le(t)) return null;
677
640
  let i = (e.x - t.x) * n, a = (e.y - t.y) * r, o = Math.hypot(i, a);
678
641
  return Number.isFinite(o) && o > 0 ? o : null;
679
642
  }
680
- function Qe(e) {
643
+ function Ve(e) {
681
644
  return Math.round(e * 10) / 10;
682
645
  }
683
- function H(e) {
684
- return e === null || !Number.isFinite(e) || e <= 0 ? null : Qe(e);
646
+ function G(e) {
647
+ return e === null || !Number.isFinite(e) || e <= 0 ? null : Ve(e);
685
648
  }
686
- function $e(e) {
649
+ function He(e) {
687
650
  let t = e.filter((e) => e !== null);
688
651
  return t.length === 0 ? null : t.reduce((e, t) => e + t, 0) / t.length;
689
652
  }
690
- function et(e, t) {
653
+ function Ue(e, t) {
691
654
  return e && t !== null && t > 0 ? "silhouette_bmi" : "keypoint";
692
655
  }
693
- function tt(e, t, n) {
656
+ function We(e, t, n) {
694
657
  return n && t > 0 && e / t >= .85 ? "standard" : "estimate";
695
658
  }
696
- function nt(e, t, n, r) {
659
+ function Ge(e, t, n, r) {
697
660
  if (t <= 0 || e <= 0) return 0;
698
661
  let i = e / t * .8, a = n ? .15 : 0, o = r !== null && r > 0 ? .05 : 0;
699
- return Math.min(.99, Qe((i + a + o) * 10) / 10);
662
+ return Math.min(.99, Ve((i + a + o) * 10) / 10);
700
663
  }
701
- function rt(e, t) {
664
+ function Ke(e, t) {
702
665
  if (e <= 0 || t <= 0) return 0;
703
666
  let n = (e - t) ** 2 / (e + t) ** 2;
704
667
  return Math.PI * (e + t) * (1 + 3 * n / (10 + Math.sqrt(4 - 3 * n)));
705
668
  }
706
- function it(e, t, n = null, r = null, i = 1280, a = 720) {
707
- let o = Xe(e, t, a), s = et(r, n);
669
+ function qe(e, t, n = null, r = null, i = 1280, a = 720) {
670
+ let o = ze(e, t, a), s = Ue(r, n);
708
671
  if (o <= 0) return {
709
672
  heightCm: t,
710
673
  shoulderWidthCm: null,
@@ -719,14 +682,14 @@ function it(e, t, n = null, r = null, i = 1280, a = 720) {
719
682
  measurementMethod: s,
720
683
  measuredAt: null
721
684
  };
722
- 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 = $e([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($e([m === null ? null : m * o, h === null ? null : h * o])), E = H($e([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;
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;
723
686
  if (r) {
724
687
  let e = r.shoulderWidthPx * o;
725
- if (O = H(rt(Math.max(r.chestWidthPx * o / 2, 0), Math.max(e * .28 / 2, 0))), k = H(rt(Math.max(r.waistWidthPx * o / 2, 0), Math.max(r.hipWidthPx * o * .26 / 2, 0))), n !== null && n > 0) {
726
- let e = Ze(n / (t / 100) ** 2);
727
- O = H(O === null ? null : O / e), k = H(k === null ? null : k / e);
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);
728
691
  }
729
- } else O = H(O), k = H(k);
692
+ } else O = G(O), k = G(k);
730
693
  let A = [
731
694
  C,
732
695
  O,
@@ -737,7 +700,7 @@ function it(e, t, n = null, r = null, i = 1280, a = 720) {
737
700
  D
738
701
  ].filter((e) => e !== null).length;
739
702
  return {
740
- heightCm: Qe(t),
703
+ heightCm: Ve(t),
741
704
  shoulderWidthCm: C,
742
705
  chestCircumferenceCm: O,
743
706
  waistCircumferenceCm: k,
@@ -745,15 +708,15 @@ function it(e, t, n = null, r = null, i = 1280, a = 720) {
745
708
  armLengthCm: T,
746
709
  legLengthCm: E,
747
710
  torsoLengthCm: D,
748
- accuracyGrade: tt(A, 7, r),
749
- confidenceScore: nt(A, 7, r, n),
711
+ accuracyGrade: We(A, 7, r),
712
+ confidenceScore: Ge(A, 7, r, n),
750
713
  measurementMethod: s,
751
714
  measuredAt: null
752
715
  };
753
716
  }
754
717
  //#endregion
755
718
  //#region src/measurement/sizeRecommender.ts
756
- var at = {
719
+ var Je = {
757
720
  S: {
758
721
  shoulder: [40, 42],
759
722
  chest: [86, 92],
@@ -780,7 +743,7 @@ var at = {
780
743
  waist: [96, 104]
781
744
  }
782
745
  };
783
- function ot(e) {
746
+ function Ye(e) {
784
747
  let t = [
785
748
  "S",
786
749
  "M",
@@ -789,7 +752,7 @@ function ot(e) {
789
752
  "2XL"
790
753
  ], n = "M", r = -Infinity, i = !1;
791
754
  for (let a of t) {
792
- let t = at[a], o = 0, s = 0;
755
+ let t = Je[a], o = 0, s = 0;
793
756
  if (e.shoulderWidthCm !== null) {
794
757
  let n = (t.shoulder[0] + t.shoulder[1]) / 2;
795
758
  o -= Math.abs(e.shoulderWidthCm - n), s += 1, i = !0;
@@ -805,7 +768,7 @@ function ot(e) {
805
768
  s > 0 && (o /= s), o > r && (r = o, n = a);
806
769
  }
807
770
  if (!i) return null;
808
- let a = at[n], o = "true-to-size";
771
+ let a = Je[n], o = "true-to-size";
809
772
  if (e.chestCircumferenceCm !== null) {
810
773
  let t = (a.chest[0] + a.chest[1]) / 2;
811
774
  e.chestCircumferenceCm > t + 3 ? o = "slim" : e.chestCircumferenceCm < t - 3 && (o = "relaxed");
@@ -818,7 +781,7 @@ function ot(e) {
818
781
  }
819
782
  //#endregion
820
783
  //#region src/types/measurement.ts
821
- var st = {
784
+ var Xe = {
822
785
  referenceHeightCm: 170,
823
786
  weightKg: null,
824
787
  stableFrameCount: 15,
@@ -826,10 +789,10 @@ var st = {
826
789
  };
827
790
  //#endregion
828
791
  //#region src/hooks/useMeasurement.ts
829
- function ct(e) {
792
+ function Ze(e) {
830
793
  return e.map((e) => ({ ...e }));
831
794
  }
832
- function lt(e, t) {
795
+ function Qe(e, t) {
833
796
  let n = 0;
834
797
  for (let r = 0; r < 33; r += 1) {
835
798
  let i = e[r], a = t[r];
@@ -837,40 +800,40 @@ function lt(e, t) {
837
800
  }
838
801
  return n / 33;
839
802
  }
840
- function ut() {
841
- let [e, t] = c(st), [n, i] = c(null), [a, o] = c(null), [l, u] = c(null), [d, f] = c(!1), p = s(0), m = s(null), h = r(() => {
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(() => {
842
805
  p.current = 0, m.current = null;
843
- }, []), g = r(() => {
844
- i(null), o(null), u(null);
845
- }, []), _ = r(() => {
806
+ }, []), g = t(() => {
807
+ o(null), c(null), u(null);
808
+ }, []), _ = t(() => {
846
809
  h(), g(), f(!0);
847
810
  }, [g, h]);
848
811
  return {
849
- measure: r((t, n = {}) => {
812
+ measure: t((t, n = {}) => {
850
813
  if (!d || t.length < 33) return;
851
- let r = ct(t);
814
+ let r = Ze(t);
852
815
  if (!m.current) {
853
816
  m.current = r, p.current = 1;
854
817
  return;
855
818
  }
856
- if (p.current = lt(m.current, r) < e.motionThreshold ? p.current + 1 : 1, m.current = r, p.current < e.stableFrameCount) return;
857
- let a = it(t, e.referenceHeightCm, e.weightKg, n.silhouetteWidths ?? null, n.imageWidth ?? 1280, n.imageHeight ?? 720), s = (/* @__PURE__ */ new Date()).toISOString(), c = ot(a), l = te(a);
858
- i({
859
- ...a,
860
- measuredAt: s
861
- }), o(c), u(l), f(!1), h();
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);
821
+ o({
822
+ ...i,
823
+ measuredAt: a
824
+ }), c(s), u(l), f(!1), h();
862
825
  }, [
863
826
  e,
864
827
  d,
865
828
  h
866
829
  ]),
867
830
  startMeasurement: _,
868
- measurements: n,
869
- sizeRecommendation: a,
831
+ measurements: r,
832
+ sizeRecommendation: s,
870
833
  garmentScale: l,
871
834
  isMeasuring: d,
872
- updateConfig: r((e) => {
873
- t((t) => ({
835
+ updateConfig: t((e) => {
836
+ n((t) => ({
874
837
  ...t,
875
838
  ...e
876
839
  })), h(), g(), f(!1);
@@ -880,7 +843,7 @@ function ut() {
880
843
  }
881
844
  //#endregion
882
845
  //#region src/compositing/videoCover.ts
883
- function dt(e, t, n, r) {
846
+ function et(e, t, n, r) {
884
847
  if (e <= 0 || t <= 0 || n <= 0 || r <= 0) return {
885
848
  x: 0,
886
849
  y: 0,
@@ -905,7 +868,7 @@ function dt(e, t, n, r) {
905
868
  height: o
906
869
  };
907
870
  }
908
- function ft(e, t, n, r) {
871
+ function tt(e, t, n, r) {
909
872
  if (e <= 0 || t <= 0 || n <= 0 || r <= 0) return {
910
873
  xMin: 0,
911
874
  xMax: 1,
@@ -932,8 +895,8 @@ function ft(e, t, n, r) {
932
895
  }
933
896
  //#endregion
934
897
  //#region src/measurement/silhouetteExtractor.ts
935
- var pt = 5, mt = .5;
936
- function ht(e, t, n, r, i = pt, a = mt) {
898
+ var nt = 5, rt = .5;
899
+ function it(e, t, n, r, i = nt, a = rt) {
937
900
  if (t <= 0 || n <= 0 || e.length !== t * n) return null;
938
901
  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;
939
902
  for (let n = c; n <= l; n += 1) {
@@ -945,11 +908,11 @@ function ht(e, t, n, r, i = pt, a = mt) {
945
908
  let p = u / f;
946
909
  return d / f - p;
947
910
  }
948
- function gt(e, t, n, r) {
911
+ function at(e, t, n, r) {
949
912
  if (r.length < 33) return null;
950
- 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];
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];
951
914
  if (!i || !a || !o || !s) return null;
952
- 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 = ht(e, t, n, u), h = ht(e, t, n, f), g = ht(e, t, n, d), _ = ht(e, t, n, p);
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);
953
916
  return m === null || h === null || g === null || _ === null ? null : {
954
917
  shoulderWidthPx: m,
955
918
  chestWidthPx: h,
@@ -959,61 +922,61 @@ function gt(e, t, n, r) {
959
922
  }
960
923
  //#endregion
961
924
  //#region src/pose/interpolation.ts
962
- function U(e, t, n) {
925
+ function K(e, t, n) {
963
926
  return e + (t - e) * n;
964
927
  }
965
- function _t(e, t, n) {
928
+ function ot(e, t, n) {
966
929
  return t ? !e || e.length !== t.length ? t : e.map((e, r) => {
967
930
  let i = t[r];
968
931
  return {
969
- x: U(e.x, i.x, n),
970
- y: U(e.y, i.y, n),
971
- z: U(e.z ?? 0, i.z ?? 0, n),
972
- visibility: U(e.visibility ?? 0, i.visibility ?? 0, n)
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)
973
936
  };
974
937
  }) : null;
975
938
  }
976
- function W(e, t, n) {
939
+ function q(e, t, n) {
977
940
  return {
978
- x: U(e.x, t.x, n),
979
- y: U(e.y, t.y, n),
980
- z: U(e.z, t.z, n)
941
+ x: K(e.x, t.x, n),
942
+ y: K(e.y, t.y, n),
943
+ z: K(e.z, t.z, n)
981
944
  };
982
945
  }
983
- function vt(e, t, n) {
984
- return !e || !t ? t ?? e : W(e, t, n);
946
+ function st(e, t, n) {
947
+ return !e || !t ? t ?? e : q(e, t, n);
985
948
  }
986
- function yt(e, t, n) {
949
+ function ct(e, t, n) {
987
950
  return t ? e ? {
988
951
  hips: {
989
952
  position: {
990
- x: U(e.hips.position.x, t.hips.position.x, n),
991
- y: U(e.hips.position.y, t.hips.position.y, n),
992
- z: U(e.hips.position.z, t.hips.position.z, n)
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)
993
956
  },
994
- rotation: W(e.hips.rotation, t.hips.rotation, n)
957
+ rotation: q(e.hips.rotation, t.hips.rotation, n)
995
958
  },
996
- spine: W(e.spine, t.spine, n),
997
- chest: W(e.chest, t.chest, n),
998
- leftUpperArm: W(e.leftUpperArm, t.leftUpperArm, n),
999
- leftLowerArm: W(e.leftLowerArm, t.leftLowerArm, n),
1000
- rightUpperArm: W(e.rightUpperArm, t.rightUpperArm, n),
1001
- rightLowerArm: W(e.rightLowerArm, t.rightLowerArm, n),
1002
- leftUpperLeg: vt(e.leftUpperLeg, t.leftUpperLeg, n),
1003
- leftLowerLeg: vt(e.leftLowerLeg, t.leftLowerLeg, n),
1004
- rightUpperLeg: vt(e.rightUpperLeg, t.rightUpperLeg, n),
1005
- rightLowerLeg: vt(e.rightLowerLeg, t.rightLowerLeg, n)
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)
1006
969
  } : t : null;
1007
970
  }
1008
- function bt(e, t, n) {
971
+ function lt(e, t, n) {
1009
972
  return t ? e ? {
1010
- shoulderWidthPx: U(e.shoulderWidthPx, t.shoulderWidthPx, n),
1011
- chestWidthPx: U(e.chestWidthPx, t.chestWidthPx, n),
1012
- waistWidthPx: U(e.waistWidthPx, t.waistWidthPx, n),
1013
- hipWidthPx: U(e.hipWidthPx, t.hipWidthPx, n)
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)
1014
977
  } : t : null;
1015
978
  }
1016
- function xt() {
979
+ function ut() {
1017
980
  return {
1018
981
  landmarks: null,
1019
982
  worldLandmarks: null,
@@ -1023,25 +986,25 @@ function xt() {
1023
986
  silhouetteWidths: null
1024
987
  };
1025
988
  }
1026
- function St(e, t, n) {
989
+ function dt(e, t, n) {
1027
990
  return !e || !e.isTracking || !t.isTracking || !t.landmarks ? t : {
1028
- landmarks: _t(e.landmarks, t.landmarks, n),
1029
- worldLandmarks: _t(e.worldLandmarks, t.worldLandmarks, n),
1030
- poseRig: yt(e.poseRig, t.poseRig, n),
1031
- confidence: U(e.confidence, t.confidence, n),
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),
1032
995
  isTracking: t.isTracking,
1033
- silhouetteWidths: bt(e.silhouetteWidths, t.silhouetteWidths, n)
996
+ silhouetteWidths: lt(e.silhouetteWidths, t.silhouetteWidths, n)
1034
997
  };
1035
998
  }
1036
999
  //#endregion
1037
1000
  //#region src/pose/landmarkerFactory.ts
1038
- var Ct = "0.10.32", wt = `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${Ct}/wasm`, Tt = 2, Et = 3, Dt = .5, Ot = {
1001
+ var ft = "0.10.32", pt = `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${ft}/wasm`, mt = 2, ht = 3, gt = .5, _t = {
1039
1002
  lite: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task",
1040
1003
  full: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_full/float16/latest/pose_landmarker_full.task",
1041
1004
  heavy: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_heavy/float16/latest/pose_landmarker_heavy.task"
1042
1005
  };
1043
- async function kt(e, t, n, r, i = 3) {
1044
- let a = await C.forVisionTasks(wt), o = {
1006
+ async function vt(e, t, n, r, i = 3) {
1007
+ let a = await v.forVisionTasks(pt), o = {
1045
1008
  baseOptions: { modelAssetPath: e },
1046
1009
  runningMode: "VIDEO",
1047
1010
  numPoses: i,
@@ -1051,7 +1014,7 @@ async function kt(e, t, n, r, i = 3) {
1051
1014
  minTrackingConfidence: n
1052
1015
  };
1053
1016
  try {
1054
- return await w.createFromOptions(a, {
1017
+ return await y.createFromOptions(a, {
1055
1018
  ...o,
1056
1019
  baseOptions: {
1057
1020
  ...o.baseOptions,
@@ -1059,7 +1022,7 @@ async function kt(e, t, n, r, i = 3) {
1059
1022
  }
1060
1023
  });
1061
1024
  } catch {
1062
- return w.createFromOptions(a, {
1025
+ return y.createFromOptions(a, {
1063
1026
  ...o,
1064
1027
  baseOptions: {
1065
1028
  ...o.baseOptions,
@@ -1070,193 +1033,193 @@ async function kt(e, t, n, r, i = 3) {
1070
1033
  }
1071
1034
  //#endregion
1072
1035
  //#region src/pose/landmarkPoseSolver.ts
1073
- var At = new l.Vector3(), jt = new l.Vector3(), Mt = new l.Vector3(), Nt = new l.Quaternion(), Pt = new l.Vector3(), Ft = new l.Vector3(), It = new l.Vector3(0, -1, 0), Lt = new l.Vector3(1, 0, 0), Rt = new l.Vector3(-1, 0, 0), zt = new l.Vector3(0, 1, 0), Bt = [B.LEFT_SHOULDER, B.RIGHT_SHOULDER], Vt = [B.LEFT_HIP, B.RIGHT_HIP], Ht = [B.LEFT_EAR, B.RIGHT_EAR], Ut = [B.LEFT_INDEX, B.LEFT_PINKY], Wt = [B.RIGHT_INDEX, B.RIGHT_PINKY], Gt = {
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 = {
1074
1037
  Hips: {
1075
- from: Vt,
1076
- to: Bt,
1077
- restDir: zt,
1038
+ from: At,
1039
+ to: kt,
1040
+ restDir: Ot,
1078
1041
  influence: .35
1079
1042
  },
1080
1043
  Spine: {
1081
- from: Vt,
1082
- to: Bt,
1083
- restDir: zt,
1044
+ from: At,
1045
+ to: kt,
1046
+ restDir: Ot,
1084
1047
  influence: .55
1085
1048
  },
1086
1049
  Chest: {
1087
- from: Bt,
1088
- to: Ht,
1089
- restDir: zt,
1050
+ from: kt,
1051
+ to: jt,
1052
+ restDir: Ot,
1090
1053
  influence: .7
1091
1054
  },
1092
1055
  LeftShoulder: {
1093
- from: Bt,
1094
- to: B.LEFT_SHOULDER,
1095
- restDir: Lt,
1056
+ from: kt,
1057
+ to: U.LEFT_SHOULDER,
1058
+ restDir: Et,
1096
1059
  influence: .45
1097
1060
  },
1098
1061
  LeftUpperArm: {
1099
- from: B.LEFT_SHOULDER,
1100
- to: B.LEFT_ELBOW,
1101
- restDir: Lt
1062
+ from: U.LEFT_SHOULDER,
1063
+ to: U.LEFT_ELBOW,
1064
+ restDir: Et
1102
1065
  },
1103
1066
  LeftLowerArm: {
1104
- from: B.LEFT_ELBOW,
1105
- to: B.LEFT_WRIST,
1106
- restDir: Lt
1067
+ from: U.LEFT_ELBOW,
1068
+ to: U.LEFT_WRIST,
1069
+ restDir: Et
1107
1070
  },
1108
1071
  LeftHand: {
1109
- from: B.LEFT_WRIST,
1110
- to: Ut,
1111
- restDir: Lt,
1072
+ from: U.LEFT_WRIST,
1073
+ to: Mt,
1074
+ restDir: Et,
1112
1075
  influence: .65
1113
1076
  },
1114
1077
  RightShoulder: {
1115
- from: Bt,
1116
- to: B.RIGHT_SHOULDER,
1117
- restDir: Rt,
1078
+ from: kt,
1079
+ to: U.RIGHT_SHOULDER,
1080
+ restDir: Dt,
1118
1081
  influence: .45
1119
1082
  },
1120
1083
  RightUpperArm: {
1121
- from: B.RIGHT_SHOULDER,
1122
- to: B.RIGHT_ELBOW,
1123
- restDir: Rt
1084
+ from: U.RIGHT_SHOULDER,
1085
+ to: U.RIGHT_ELBOW,
1086
+ restDir: Dt
1124
1087
  },
1125
1088
  RightLowerArm: {
1126
- from: B.RIGHT_ELBOW,
1127
- to: B.RIGHT_WRIST,
1128
- restDir: Rt
1089
+ from: U.RIGHT_ELBOW,
1090
+ to: U.RIGHT_WRIST,
1091
+ restDir: Dt
1129
1092
  },
1130
1093
  RightHand: {
1131
- from: B.RIGHT_WRIST,
1132
- to: Wt,
1133
- restDir: Rt,
1094
+ from: U.RIGHT_WRIST,
1095
+ to: Nt,
1096
+ restDir: Dt,
1134
1097
  influence: .65
1135
1098
  },
1136
1099
  LeftUpperLeg: {
1137
- from: B.LEFT_HIP,
1138
- to: B.LEFT_KNEE,
1139
- restDir: It
1100
+ from: U.LEFT_HIP,
1101
+ to: U.LEFT_KNEE,
1102
+ restDir: Tt
1140
1103
  },
1141
1104
  LeftLowerLeg: {
1142
- from: B.LEFT_KNEE,
1143
- to: B.LEFT_ANKLE,
1144
- restDir: It
1105
+ from: U.LEFT_KNEE,
1106
+ to: U.LEFT_ANKLE,
1107
+ restDir: Tt
1145
1108
  },
1146
1109
  LeftFoot: {
1147
- from: B.LEFT_ANKLE,
1148
- to: B.LEFT_FOOT_INDEX,
1149
- restDir: new l.Vector3(0, 0, 1)
1110
+ from: U.LEFT_ANKLE,
1111
+ to: U.LEFT_FOOT_INDEX,
1112
+ restDir: new b.Vector3(0, 0, 1)
1150
1113
  },
1151
1114
  RightUpperLeg: {
1152
- from: B.RIGHT_HIP,
1153
- to: B.RIGHT_KNEE,
1154
- restDir: It
1115
+ from: U.RIGHT_HIP,
1116
+ to: U.RIGHT_KNEE,
1117
+ restDir: Tt
1155
1118
  },
1156
1119
  RightLowerLeg: {
1157
- from: B.RIGHT_KNEE,
1158
- to: B.RIGHT_ANKLE,
1159
- restDir: It
1120
+ from: U.RIGHT_KNEE,
1121
+ to: U.RIGHT_ANKLE,
1122
+ restDir: Tt
1160
1123
  },
1161
1124
  RightFoot: {
1162
- from: B.RIGHT_ANKLE,
1163
- to: B.RIGHT_FOOT_INDEX,
1164
- restDir: new l.Vector3(0, 0, 1)
1125
+ from: U.RIGHT_ANKLE,
1126
+ to: U.RIGHT_FOOT_INDEX,
1127
+ restDir: new b.Vector3(0, 0, 1)
1165
1128
  }
1166
1129
  };
1167
- function Kt(e, t, n) {
1130
+ function Ft(e, t, n) {
1168
1131
  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);
1169
1132
  }
1170
- function qt(e, t, n, r) {
1133
+ function It(e, t, n, r) {
1171
1134
  if (typeof e == "number") {
1172
1135
  let i = t[e];
1173
- return !i || (i.visibility ?? 0) < .4 ? !1 : (Kt(i, n, r), !0);
1136
+ return !i || (i.visibility ?? 0) < .4 ? !1 : (Ft(i, n, r), !0);
1174
1137
  }
1175
1138
  let i = t[e[0]], a = t[e[1]];
1176
- return !i || !a || (i.visibility ?? 0) < .4 || (a.visibility ?? 0) < .4 ? !1 : (Kt(i, Pt, r), Kt(a, Ft, r), n.copy(Pt).add(Ft).multiplyScalar(.5), !0);
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);
1177
1140
  }
1178
- function Jt(e, t, n, r, i = "normalized") {
1179
- if (!qt(e, n, At, i) || !qt(t, n, jt, i)) return !1;
1180
- r.subVectors(jt, At);
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);
1181
1144
  let a = r.length();
1182
1145
  return a < .001 ? !1 : (r.divideScalar(a), !0);
1183
1146
  }
1184
- function Yt(e, t, n, r = "normalized") {
1185
- let i = Gt[e];
1186
- return i ? Jt(i.from, i.to, t, n, r) : !1;
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;
1187
1150
  }
1188
- function Xt(e) {
1189
- return Gt[e]?.influence;
1151
+ function zt(e) {
1152
+ return Pt[e]?.influence;
1190
1153
  }
1191
- function Zt(e, t, n, r = "normalized") {
1192
- let i = Gt[e];
1193
- return !i || !Yt(e, t, Mt, r) ? !1 : (n.setFromUnitVectors(i.restDir, Mt), i.influence !== void 0 && n.slerp(Nt.identity(), 1 - i.influence), !0);
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);
1194
1157
  }
1195
- function Qt(e) {
1196
- return e in Gt;
1158
+ function Vt(e) {
1159
+ return e in Pt;
1197
1160
  }
1198
1161
  //#endregion
1199
1162
  //#region src/pose/poseSolver.ts
1200
- var $t = new l.Quaternion(), en = new l.Euler();
1201
- function tn() {
1163
+ var Ht = new b.Quaternion(), Ut = new b.Euler();
1164
+ function Wt() {
1202
1165
  return {
1203
1166
  x: 0,
1204
1167
  y: 0,
1205
1168
  z: 0
1206
1169
  };
1207
1170
  }
1208
- function nn(e) {
1209
- return en.setFromQuaternion(e, "XYZ"), {
1210
- x: en.x,
1211
- y: en.y,
1212
- z: en.z
1171
+ function Gt(e) {
1172
+ return Ut.setFromQuaternion(e, "XYZ"), {
1173
+ x: Ut.x,
1174
+ y: Ut.y,
1175
+ z: Ut.z
1213
1176
  };
1214
1177
  }
1215
- function G(e, t, n) {
1216
- return Zt(e, t, $t, n) ? nn($t) : tn();
1178
+ function Kt(e, t, n) {
1179
+ return Bt(e, t, Ht, n) ? Gt(Ht) : Wt();
1217
1180
  }
1218
- function rn(e, t, n) {
1219
- if (Zt(e, t, $t, n)) return nn($t);
1181
+ function qt(e, t, n) {
1182
+ if (Bt(e, t, Ht, n)) return Gt(Ht);
1220
1183
  }
1221
- function an(e) {
1222
- let t = e[B.LEFT_HIP], n = e[B.RIGHT_HIP];
1184
+ function Jt(e) {
1185
+ let t = e[U.LEFT_HIP], n = e[U.RIGHT_HIP];
1223
1186
  return {
1224
1187
  x: ((t?.x ?? 0) + (n?.x ?? 0)) * .5,
1225
1188
  y: ((t?.y ?? 0) + (n?.y ?? 0)) * .5,
1226
1189
  z: ((t?.z ?? 0) + (n?.z ?? 0)) * .5
1227
1190
  };
1228
1191
  }
1229
- function on(e, t) {
1192
+ function Yt(e, t) {
1230
1193
  if (e.length < 33) return null;
1231
1194
  let n = t && t.length >= 33 ? t : e, r = t && t.length >= 33 ? "world" : "normalized";
1232
1195
  return {
1233
1196
  hips: {
1234
- position: an(e),
1235
- rotation: G("Hips", n, r)
1197
+ position: Jt(e),
1198
+ rotation: Kt("Hips", n, r)
1236
1199
  },
1237
- spine: G("Spine", n, r),
1238
- chest: G("Chest", n, r),
1239
- leftUpperArm: G("LeftUpperArm", n, r),
1240
- leftLowerArm: G("LeftLowerArm", n, r),
1241
- rightUpperArm: G("RightUpperArm", n, r),
1242
- rightLowerArm: G("RightLowerArm", n, r),
1243
- leftUpperLeg: rn("LeftUpperLeg", n, r),
1244
- leftLowerLeg: rn("LeftLowerLeg", n, r),
1245
- rightUpperLeg: rn("RightUpperLeg", n, r),
1246
- rightLowerLeg: rn("RightLowerLeg", n, r)
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)
1247
1210
  };
1248
1211
  }
1249
1212
  //#endregion
1250
1213
  //#region src/pose/segmentation.ts
1251
- function sn(e) {
1214
+ function Xt(e) {
1252
1215
  if (!e || typeof e != "object") return null;
1253
1216
  let t = e;
1254
1217
  return typeof t.width != "number" || typeof t.height != "number" || typeof t.getAsFloat32Array != "function" ? null : t;
1255
1218
  }
1256
- function cn(e) {
1219
+ function Zt(e) {
1257
1220
  if (e) for (let t of e) t && typeof t == "object" && "close" in t && typeof t.close == "function" && t.close();
1258
1221
  }
1259
- function ln(e, t, n) {
1222
+ function Qt(e, t, n) {
1260
1223
  let r = t / n;
1261
1224
  return {
1262
1225
  shoulderWidthPx: e.shoulderWidthPx * r,
@@ -1267,47 +1230,47 @@ function ln(e, t, n) {
1267
1230
  }
1268
1231
  //#endregion
1269
1232
  //#region src/types/tracking.ts
1270
- var un = "pose-0";
1233
+ var $t = "pose-0";
1271
1234
  //#endregion
1272
1235
  //#region src/pose/smoothing.ts
1273
- function dn(e) {
1236
+ function en(e) {
1274
1237
  return typeof e == "number" ? e : 0;
1275
1238
  }
1276
- function fn(e) {
1239
+ function tn(e) {
1277
1240
  return {
1278
1241
  x: e.x,
1279
1242
  y: e.y,
1280
1243
  z: e.z,
1281
- visibility: dn(e.visibility)
1244
+ visibility: en(e.visibility)
1282
1245
  };
1283
1246
  }
1284
- function pn(e) {
1285
- return e.map(fn);
1247
+ function nn(e) {
1248
+ return e.map(tn);
1286
1249
  }
1287
- function mn(e) {
1288
- return fn(e);
1250
+ function rn(e) {
1251
+ return tn(e);
1289
1252
  }
1290
- function hn(e) {
1253
+ function an(e) {
1291
1254
  let t = Math.PI * 2, n = (e + Math.PI) % t;
1292
1255
  return n < 0 && (n += t), n - Math.PI;
1293
1256
  }
1294
- function gn(e, t, n) {
1295
- return hn(e + hn(t - e) * n);
1257
+ function on(e, t, n) {
1258
+ return an(e + an(t - e) * n);
1296
1259
  }
1297
- var _n = class {
1260
+ var sn = class {
1298
1261
  prev = null;
1299
1262
  config;
1300
- constructor(e = Ke) {
1263
+ constructor(e = Fe) {
1301
1264
  this.config = e;
1302
1265
  }
1303
1266
  smooth(e) {
1304
1267
  if (e.length === 0) return this.prev = null, [];
1305
- let t = pn(e);
1306
- if (!this.prev || this.prev.length !== t.length) return this.prev = t.map(mn), t.map(mn);
1268
+ let t = nn(e);
1269
+ if (!this.prev || this.prev.length !== t.length) return this.prev = t.map(rn), t.map(rn);
1307
1270
  let n = this.config.positionAlpha, r = t.map((e, t) => {
1308
1271
  let r = this.prev[t];
1309
1272
  return (e.visibility ?? 0) < this.config.visibilityThreshold ? {
1310
- ...mn(r),
1273
+ ...rn(r),
1311
1274
  visibility: e.visibility
1312
1275
  } : {
1313
1276
  x: r.x + n * (e.x - r.x),
@@ -1316,23 +1279,23 @@ var _n = class {
1316
1279
  visibility: e.visibility
1317
1280
  };
1318
1281
  });
1319
- return this.prev = r.map(mn), r;
1282
+ return this.prev = r.map(rn), r;
1320
1283
  }
1321
1284
  reset() {
1322
1285
  this.prev = null;
1323
1286
  }
1324
1287
  };
1325
- function K(e, t, n) {
1288
+ function J(e, t, n) {
1326
1289
  return {
1327
- x: gn(e.x, t.x, n),
1328
- y: gn(e.y, t.y, n),
1329
- z: gn(e.z, t.z, n)
1290
+ x: on(e.x, t.x, n),
1291
+ y: on(e.y, t.y, n),
1292
+ z: on(e.z, t.z, n)
1330
1293
  };
1331
1294
  }
1332
- function vn(e, t, n) {
1333
- return t ? e ? K(e, t, n) : t : e;
1295
+ function cn(e, t, n) {
1296
+ return t ? e ? J(e, t, n) : t : e;
1334
1297
  }
1335
- function yn(e, t, n = Ke.rotationAlpha) {
1298
+ function ln(e, t, n = Fe.rotationAlpha) {
1336
1299
  return e ? {
1337
1300
  hips: {
1338
1301
  position: {
@@ -1340,29 +1303,29 @@ function yn(e, t, n = Ke.rotationAlpha) {
1340
1303
  y: e.hips.position.y + n * (t.hips.position.y - e.hips.position.y),
1341
1304
  z: e.hips.position.z + n * (t.hips.position.z - e.hips.position.z)
1342
1305
  },
1343
- rotation: K(e.hips.rotation, t.hips.rotation, n)
1306
+ rotation: J(e.hips.rotation, t.hips.rotation, n)
1344
1307
  },
1345
- spine: K(e.spine, t.spine, n),
1346
- chest: K(e.chest, t.chest, n),
1347
- leftUpperArm: K(e.leftUpperArm, t.leftUpperArm, n),
1348
- leftLowerArm: K(e.leftLowerArm, t.leftLowerArm, n),
1349
- rightUpperArm: K(e.rightUpperArm, t.rightUpperArm, n),
1350
- rightLowerArm: K(e.rightLowerArm, t.rightLowerArm, n),
1351
- leftUpperLeg: vn(e.leftUpperLeg, t.leftUpperLeg, n),
1352
- leftLowerLeg: vn(e.leftLowerLeg, t.leftLowerLeg, n),
1353
- rightUpperLeg: vn(e.rightUpperLeg, t.rightUpperLeg, n),
1354
- rightLowerLeg: vn(e.rightLowerLeg, t.rightLowerLeg, n)
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)
1355
1318
  } : t;
1356
1319
  }
1357
1320
  //#endregion
1358
1321
  //#region src/tracking/personLock.ts
1359
- var bn = .12, xn = .35, Sn = .05, Cn = [
1322
+ var un = .12, dn = .35, fn = .05, pn = [
1360
1323
  11,
1361
1324
  12,
1362
1325
  23,
1363
1326
  24
1364
- ], wn = 2, Tn = .3;
1365
- function En(e) {
1327
+ ], mn = 2, hn = .3;
1328
+ function gn(e) {
1366
1329
  if (!e) return null;
1367
1330
  let t = Math.max(0, Math.min(1, e.x)), n = Math.max(0, Math.min(1, e.y));
1368
1331
  return {
@@ -1372,41 +1335,41 @@ function En(e) {
1372
1335
  h: Math.max(.01, Math.min(1 - n, e.h))
1373
1336
  };
1374
1337
  }
1375
- function Dn(e) {
1338
+ function _n(e) {
1376
1339
  if (!Array.isArray(e) || e.length === 0) return null;
1377
1340
  let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity, a = 0;
1378
1341
  return e.forEach((e) => {
1379
- !e || typeof e.x != "number" || typeof e.y != "number" || (e.visibility ?? 0) < xn || (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);
1380
- }), a < 4 || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) ? null : En({
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({
1381
1344
  x: t,
1382
1345
  y: n,
1383
1346
  w: Math.max(.01, r - t),
1384
1347
  h: Math.max(.01, i - n)
1385
1348
  });
1386
1349
  }
1387
- function On(e, t = bn) {
1350
+ function vn(e, t = un) {
1388
1351
  if (!e) return null;
1389
1352
  let n = e.w * t, r = e.h * t;
1390
- return En({
1353
+ return gn({
1391
1354
  x: e.x - n / 2,
1392
1355
  y: e.y - r / 2,
1393
1356
  w: e.w + n,
1394
1357
  h: e.h + r
1395
1358
  });
1396
1359
  }
1397
- function kn(e, t) {
1360
+ function yn(e, t) {
1398
1361
  if (!e || !t) return 0;
1399
1362
  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);
1400
1363
  if (o <= 0) return 0;
1401
1364
  let s = e.w * e.h + t.w * t.h - o;
1402
1365
  return s <= 0 ? 0 : o / s;
1403
1366
  }
1404
- function An(e) {
1367
+ function bn(e) {
1405
1368
  return e.length === 0 ? 0 : e.reduce((e, t) => e + (t.visibility ?? 0), 0) / e.length;
1406
1369
  }
1407
- function jn(e, t = []) {
1370
+ function xn(e, t = []) {
1408
1371
  return e.flatMap((e, n) => {
1409
- let r = Dn(e), i = On(r);
1372
+ let r = _n(e), i = vn(r);
1410
1373
  return !r || !i ? [] : [{
1411
1374
  poseIndex: n,
1412
1375
  personId: `pose-${n}`,
@@ -1414,43 +1377,43 @@ function jn(e, t = []) {
1414
1377
  worldLandmarks: t[n] ?? null,
1415
1378
  bounds: r,
1416
1379
  expandedBounds: i,
1417
- meanVisibility: An(e),
1380
+ meanVisibility: bn(e),
1418
1381
  area: i.w * i.h
1419
1382
  }];
1420
1383
  });
1421
1384
  }
1422
- function Mn(e, t) {
1423
- let n = kn(e.expandedBounds, t.expandedBounds);
1385
+ function Sn(e, t) {
1386
+ let n = yn(e.expandedBounds, t.expandedBounds);
1424
1387
  return {
1425
1388
  iou: n,
1426
1389
  score: n * .75 + e.area * .25
1427
1390
  };
1428
1391
  }
1429
- function Nn(e, { previousCandidate: t, allowRelock: n = !1, minIouToKeep: r = Sn }) {
1392
+ function Cn(e, { previousCandidate: t, allowRelock: n = !1, minIouToKeep: r = fn }) {
1430
1393
  if (e.length === 0) return null;
1431
1394
  let i = [...e].sort((e, t) => t.area * t.meanVisibility - e.area * e.meanVisibility);
1432
1395
  if (!t) return i[0];
1433
1396
  let a = null, o = -Infinity, s = 0;
1434
1397
  return e.forEach((e) => {
1435
- let { iou: n, score: r } = Mn(e, t);
1398
+ let { iou: n, score: r } = Sn(e, t);
1436
1399
  r > o && (a = e, o = r, s = n);
1437
1400
  }), a && s >= r ? a : n ? i[0] : null;
1438
1401
  }
1439
- function Pn(e, t) {
1402
+ function wn(e, t) {
1440
1403
  if (!t) return !0;
1441
1404
  let n = 0, r = 0, i = 0;
1442
- for (let t of Cn) {
1405
+ for (let t of pn) {
1443
1406
  let a = e.landmarks[t];
1444
- a && (a.visibility ?? 0) > Tn && (n += a.x, r += a.y, i += 1);
1407
+ a && (a.visibility ?? 0) > hn && (n += a.x, r += a.y, i += 1);
1445
1408
  }
1446
- if (i < wn) return !0;
1409
+ if (i < mn) return !0;
1447
1410
  let a = n / i, o = r / i;
1448
1411
  return a >= t.xMin && a <= t.xMax && o >= t.yMin && o <= t.yMax;
1449
1412
  }
1450
- function Fn(e, t) {
1451
- return t ? e.filter((e) => Pn(e, t)) : e;
1413
+ function Tn(e, t) {
1414
+ return t ? e.filter((e) => wn(e, t)) : e;
1452
1415
  }
1453
- function In(e) {
1416
+ function En(e) {
1454
1417
  return e ? {
1455
1418
  poseIndex: e.poseIndex,
1456
1419
  personId: e.personId,
@@ -1460,18 +1423,18 @@ function In(e) {
1460
1423
  }
1461
1424
  //#endregion
1462
1425
  //#region src/tracking/trackingState.ts
1463
- var Ln = .55, Rn = 640, zn = 360;
1464
- function Bn(e = null) {
1426
+ var Dn = .55, On = 640, kn = 360;
1427
+ function An(e = null) {
1465
1428
  return {
1466
1429
  level: "idle",
1467
1430
  reasons: ["no_person_detected"],
1468
1431
  updatedAt: e
1469
1432
  };
1470
1433
  }
1471
- function Vn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, meanVisibility: r = null, frameWidth: i = 0, frameHeight: a = 0, updatedAt: o = Date.now() }) {
1472
- if (e < 1) return Bn(o);
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);
1473
1436
  let s = [];
1474
- return e > 1 && s.push("multi_person_detected"), i > 0 && a > 0 && (i < Rn || a < zn) && s.push("resolution_too_low"), r !== null && r < Ln && s.push("low_visibility"), (!n || !t) && s.push("pose_not_locked"), s.length === 0 ? {
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 ? {
1475
1438
  level: "good",
1476
1439
  reasons: [],
1477
1440
  updatedAt: o
@@ -1481,19 +1444,19 @@ function Vn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, m
1481
1444
  updatedAt: o
1482
1445
  };
1483
1446
  }
1484
- function Hn() {
1447
+ function Mn() {
1485
1448
  return {
1486
1449
  detectedPersonCount: 0,
1487
1450
  lockedPersonId: null,
1488
- trackingQuality: Bn()
1451
+ trackingQuality: An()
1489
1452
  };
1490
1453
  }
1491
- function Un({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisibility: r, frameWidth: i, frameHeight: a, updatedAt: o }) {
1454
+ function Nn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisibility: r, frameWidth: i, frameHeight: a, updatedAt: o }) {
1492
1455
  let s = n ?? (t && e > 0 ? "pose-0" : null);
1493
1456
  return {
1494
1457
  detectedPersonCount: e,
1495
1458
  lockedPersonId: s,
1496
- trackingQuality: Vn({
1459
+ trackingQuality: jn({
1497
1460
  detectedPersonCount: e,
1498
1461
  isTracking: t,
1499
1462
  lockedPersonId: s,
@@ -1506,17 +1469,17 @@ function Un({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisi
1506
1469
  }
1507
1470
  //#endregion
1508
1471
  //#region src/tracking/trackingStability.ts
1509
- var Wn = 180;
1510
- function Gn(e, t, n = 180) {
1472
+ var Pn = 180;
1473
+ function Fn(e, t, n = 180) {
1511
1474
  return e === null ? !1 : t - e <= n;
1512
1475
  }
1513
- function Kn(e) {
1476
+ function In(e) {
1514
1477
  return !e || !e.isTracking || !e.landmarks || !e.poseRig ? null : {
1515
1478
  ...e,
1516
1479
  isTracking: !0
1517
1480
  };
1518
1481
  }
1519
- function qn(e, t, n = un) {
1482
+ function Ln(e, t, n = $t) {
1520
1483
  return {
1521
1484
  detectedPersonCount: e,
1522
1485
  lockedPersonId: n,
@@ -1529,7 +1492,7 @@ function qn(e, t, n = un) {
1529
1492
  }
1530
1493
  //#endregion
1531
1494
  //#region src/hooks/usePoseTracker.ts
1532
- function Jn() {
1495
+ function Rn() {
1533
1496
  return {
1534
1497
  landmarks: null,
1535
1498
  worldLandmarks: null,
@@ -1539,49 +1502,49 @@ function Jn() {
1539
1502
  isTracking: !1
1540
1503
  };
1541
1504
  }
1542
- var Yn = (e, t = {}) => {
1543
- let { enabled: n = !0, modelComplexity: i = "lite", numPoses: o = 3, minDetectionConfidence: l = .5, minTrackingConfidence: u = .5, outputSegmentationMasks: d = !1, viewportWidth: f = 0, viewportHeight: p = 0 } = t, m = s(null), h = s(new _n(Ke)), g = s(null), _ = s(null), v = s(null), y = s(-1), b = s({
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({
1544
1507
  width: 0,
1545
1508
  height: 0
1546
- }), x = s(0), C = s(null), T = s(null), E = s(null), D = s(null), O = s(null), k = s(Hn()), A = s({
1509
+ }), C = i(0), w = i(null), T = i(null), E = i(null), D = i(null), O = i(null), k = i(Mn()), A = i({
1547
1510
  frames: 0,
1548
1511
  lastMeasuredAt: 0
1549
- }), j = s(null), M = s({
1512
+ }), j = i(null), M = i({
1550
1513
  width: 0,
1551
1514
  height: 0
1552
- }), [N, P] = c(!1), [ee, te] = c(Jn), [ne, re] = c(null), [ie, ae] = c({
1515
+ }), [N, P] = a(!1), [F, I] = a(Rn), [L, R] = a(null), [ee, te] = a({
1553
1516
  width: 0,
1554
1517
  height: 0
1555
- }), [F, oe] = c(Hn()), I = r((e, t = k.current) => {
1556
- _.current = e.landmarks, k.current = t, te((t) => ({
1518
+ }), [ne, re] = a(Mn()), z = t((e, t = k.current) => {
1519
+ v.current = e.landmarks, k.current = t, I((t) => ({
1557
1520
  ...t,
1558
1521
  landmarks: e.landmarks,
1559
1522
  worldLandmarks: e.worldLandmarks,
1560
1523
  poseRig: e.poseRig,
1561
1524
  confidence: e.confidence,
1562
1525
  isTracking: e.isTracking
1563
- })), re(e.silhouetteWidths), oe(t);
1564
- }, []), L = r(() => {
1565
- h.current.reset(), g.current = null, _.current = null, y.current = -1, b.current = {
1526
+ })), R(e.silhouetteWidths), re(t);
1527
+ }, []), B = t(() => {
1528
+ h.current.reset(), g.current = null, v.current = null, x.current = -1, S.current = {
1566
1529
  width: 0,
1567
1530
  height: 0
1568
- }, x.current = 0, C.current = null, T.current = null, E.current = null, D.current = null, O.current = null, k.current = Hn(), A.current = {
1531
+ }, C.current = 0, w.current = null, T.current = null, E.current = null, D.current = null, O.current = null, k.current = Mn(), A.current = {
1569
1532
  frames: 0,
1570
1533
  lastMeasuredAt: 0
1571
- }, te(Jn()), re(null), ae({
1534
+ }, I(Rn()), R(null), te({
1572
1535
  width: 0,
1573
1536
  height: 0
1574
- }), oe(Hn());
1537
+ }), re(Mn());
1575
1538
  }, []);
1576
- a(() => {
1577
- if (!n) {
1578
- P(!1), L();
1539
+ n(() => {
1540
+ if (!o) {
1541
+ P(!1), B();
1579
1542
  return;
1580
1543
  }
1581
1544
  let e = !1;
1582
1545
  async function t() {
1583
1546
  try {
1584
- let t = await kt(Ot[i], l, u, d, o);
1547
+ let t = await vt(_t[s], l, u, d, c);
1585
1548
  if (e) {
1586
1549
  t.close();
1587
1550
  return;
@@ -1592,60 +1555,60 @@ var Yn = (e, t = {}) => {
1592
1555
  }
1593
1556
  }
1594
1557
  return t(), () => {
1595
- e = !0, P(!1), v.current !== null && (cancelAnimationFrame(v.current), v.current = null), m.current?.close(), m.current = null, L();
1558
+ e = !0, P(!1), b.current !== null && (cancelAnimationFrame(b.current), b.current = null), m.current?.close(), m.current = null, B();
1596
1559
  };
1597
1560
  }, [
1598
- n,
1561
+ o,
1599
1562
  l,
1600
1563
  u,
1601
- i,
1602
- o,
1564
+ s,
1565
+ c,
1603
1566
  d,
1604
- L
1567
+ B
1605
1568
  ]), M.current = {
1606
1569
  width: f,
1607
1570
  height: p
1608
- }, a(() => {
1609
- if (!n || !N) return;
1571
+ }, n(() => {
1572
+ if (!o || !N) return;
1610
1573
  let t = () => {
1611
1574
  let n = e.current, r = m.current;
1612
1575
  if (!n || !r || n.readyState < HTMLMediaElement.HAVE_CURRENT_DATA) {
1613
- v.current = requestAnimationFrame(t);
1576
+ b.current = requestAnimationFrame(t);
1614
1577
  return;
1615
1578
  }
1616
- if (n.currentTime === y.current) {
1617
- v.current = requestAnimationFrame(t);
1579
+ if (n.currentTime === x.current) {
1580
+ b.current = requestAnimationFrame(t);
1618
1581
  return;
1619
1582
  }
1620
- y.current = n.currentTime;
1583
+ x.current = n.currentTime;
1621
1584
  let i = n.videoWidth || n.clientWidth || 1280, a = n.videoHeight || n.clientHeight || 720;
1622
- (i !== b.current.width || a !== b.current.height) && (b.current = {
1585
+ (i !== S.current.width || a !== S.current.height) && (S.current = {
1623
1586
  width: i,
1624
1587
  height: a
1625
- }, ae({
1588
+ }, te({
1626
1589
  width: i,
1627
1590
  height: a
1628
1591
  }));
1629
1592
  let o = M.current;
1630
- j.current = o.width > 0 && o.height > 0 ? ft(o.width, o.height, i, a) : null;
1593
+ j.current = o.width > 0 && o.height > 0 ? tt(o.width, o.height, i, a) : null;
1631
1594
  let s = performance.now();
1632
1595
  try {
1633
- let e = C.current === null || x.current === 0;
1634
- if (x.current = (x.current + 1) % 2, e) {
1596
+ let e = w.current === null || C.current === 0;
1597
+ if (C.current = (C.current + 1) % 2, e) {
1635
1598
  let e = r.detectForVideo(n, s);
1636
1599
  try {
1637
- let t = Fn(jn(e.landmarks, e.worldLandmarks), j.current), n = t.length, r = !Gn(D.current, s), o = Nn(t, {
1600
+ let t = Tn(xn(e.landmarks, e.worldLandmarks), j.current), n = t.length, r = !Fn(D.current, s), o = Cn(t, {
1638
1601
  previousCandidate: O.current,
1639
1602
  allowRelock: r
1640
- }), c = o?.landmarks ?? null, l = o?.worldLandmarks ?? null, f = o || O.current ? un : null, p = xt(), m = Un({
1603
+ }), c = o?.landmarks ?? null, l = o?.worldLandmarks ?? null, f = o || O.current ? $t : null, p = ut(), m = Nn({
1641
1604
  detectedPersonCount: n,
1642
1605
  isTracking: !1,
1643
1606
  lockedPersonId: f,
1644
1607
  frameWidth: i,
1645
1608
  frameHeight: a,
1646
1609
  updatedAt: s
1647
- }), _ = Gn(D.current, s) ? Kn(E.current) : null;
1648
- if (!c) _ ? (p = _, m = qn(n, s, f)) : (h.current.reset(), g.current = null, E.current = null, D.current = null, O.current = null, m = Un({
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({
1649
1612
  detectedPersonCount: n,
1650
1613
  isTracking: !1,
1651
1614
  lockedPersonId: null,
@@ -1655,12 +1618,12 @@ var Yn = (e, t = {}) => {
1655
1618
  }));
1656
1619
  else {
1657
1620
  r && o && (h.current.reset(), g.current = null);
1658
- let t = h.current.smooth(pn(c)), v = l ? pn(l) : null, y = on(t, v), b = t.reduce((e, t) => e + (t.visibility ?? 0), 0) / t.length, x = b >= u ? y ? yn(g.current, y, Ke.rotationAlpha) : g.current : null, S = x !== null, C = null;
1659
- if (O.current = o ? In(o) : O.current, d) {
1660
- let n = sn(o ? e.segmentationMasks?.[o.poseIndex] : void 0);
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);
1661
1624
  if (n) {
1662
- let e = gt(new Float32Array(n.getAsFloat32Array()), n.width, n.height, t);
1663
- e && (C = ln(e, i, n.width));
1625
+ let e = at(new Float32Array(n.getAsFloat32Array()), n.width, n.height, t);
1626
+ e && (C = Qt(e, i, n.width));
1664
1627
  }
1665
1628
  }
1666
1629
  S && x ? (g.current = x, p = {
@@ -1670,92 +1633,92 @@ var Yn = (e, t = {}) => {
1670
1633
  confidence: b,
1671
1634
  isTracking: S,
1672
1635
  silhouetteWidths: C
1673
- }, E.current = p, D.current = s, m = Un({
1636
+ }, E.current = p, D.current = s, m = Nn({
1674
1637
  detectedPersonCount: n,
1675
1638
  isTracking: S,
1676
- lockedPersonId: un,
1639
+ lockedPersonId: $t,
1677
1640
  meanVisibility: o?.meanVisibility ?? b,
1678
1641
  frameWidth: i,
1679
1642
  frameHeight: a,
1680
1643
  updatedAt: s
1681
- })) : _ ? (p = _, m = qn(n, s, f)) : (g.current = null, E.current = null, D.current = null, p = {
1644
+ })) : _ ? (p = _, m = Ln(n, s, f)) : (g.current = null, E.current = null, D.current = null, p = {
1682
1645
  landmarks: t,
1683
1646
  worldLandmarks: v,
1684
1647
  poseRig: null,
1685
1648
  confidence: b,
1686
1649
  isTracking: !1,
1687
1650
  silhouetteWidths: C
1688
- }, m = Un({
1651
+ }, m = Nn({
1689
1652
  detectedPersonCount: n,
1690
1653
  isTracking: !1,
1691
- lockedPersonId: o ? un : null,
1654
+ lockedPersonId: o ? $t : null,
1692
1655
  meanVisibility: o?.meanVisibility ?? b,
1693
1656
  frameWidth: i,
1694
1657
  frameHeight: a,
1695
1658
  updatedAt: s
1696
1659
  }));
1697
1660
  }
1698
- let v = C.current;
1699
- C.current = p, k.current = m;
1700
- let y = St(v, p, Dt);
1701
- T.current = y, I(y, m);
1661
+ let v = w.current;
1662
+ w.current = p, k.current = m;
1663
+ let y = dt(v, p, gt);
1664
+ T.current = y, z(y, m);
1702
1665
  } finally {
1703
- cn(e.segmentationMasks);
1666
+ Zt(e.segmentationMasks);
1704
1667
  }
1705
- } else T.current && I(T.current, k.current);
1668
+ } else T.current && z(T.current, k.current);
1706
1669
  } catch {}
1707
1670
  let c = A.current;
1708
1671
  if (c.frames += 1, c.lastMeasuredAt === 0 && (c.lastMeasuredAt = s), s - c.lastMeasuredAt >= 1e3) {
1709
1672
  let e = c.frames;
1710
- c.frames = 0, c.lastMeasuredAt = s, te((t) => ({
1673
+ c.frames = 0, c.lastMeasuredAt = s, I((t) => ({
1711
1674
  ...t,
1712
1675
  fps: e
1713
1676
  }));
1714
1677
  }
1715
- v.current = requestAnimationFrame(t);
1678
+ b.current = requestAnimationFrame(t);
1716
1679
  };
1717
- return v.current = requestAnimationFrame(t), () => {
1718
- v.current !== null && (cancelAnimationFrame(v.current), v.current = null);
1680
+ return b.current = requestAnimationFrame(t), () => {
1681
+ b.current !== null && (cancelAnimationFrame(b.current), b.current = null);
1719
1682
  };
1720
1683
  }, [
1721
- n,
1684
+ o,
1722
1685
  N,
1723
1686
  u,
1724
1687
  d,
1725
- I,
1688
+ z,
1726
1689
  e
1727
1690
  ]);
1728
- let se = r((t) => {
1691
+ let V = t((t) => {
1729
1692
  let n = e.current, r = t.getContext("2d");
1730
1693
  if (!n || !r) return;
1731
1694
  t.width = n.videoWidth || t.clientWidth || 1280, t.height = n.videoHeight || t.clientHeight || 720, r.clearRect(0, 0, t.width, t.height);
1732
- let i = _.current;
1695
+ let i = v.current;
1733
1696
  if (!i) return;
1734
- let a = pn(i), o = new S(r);
1697
+ let a = nn(i), o = new _(r);
1735
1698
  o.drawLandmarks(a, {
1736
1699
  radius: 3,
1737
1700
  color: "#00FF88",
1738
1701
  fillColor: "#00FF88"
1739
- }), o.drawConnectors(a, w.POSE_CONNECTIONS, {
1702
+ }), o.drawConnectors(a, y.POSE_CONNECTIONS, {
1740
1703
  color: "#00C8FF",
1741
1704
  lineWidth: 2
1742
1705
  });
1743
1706
  }, [e]);
1744
1707
  return {
1745
- ...ee,
1708
+ ...F,
1746
1709
  isTrackerReady: N,
1747
- drawLandmarks: se,
1748
- silhouetteWidths: ne,
1749
- poseFrameWidth: ie.width,
1750
- poseFrameHeight: ie.height,
1751
- detectedPersonCount: F.detectedPersonCount,
1752
- lockedPersonId: F.lockedPersonId,
1753
- trackingQuality: F.trackingQuality
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
1754
1717
  };
1755
1718
  };
1756
1719
  //#endregion
1757
1720
  //#region src/hooks/useWebcam.ts
1758
- function Xn(e) {
1721
+ function Bn(e) {
1759
1722
  if (!(e instanceof DOMException)) return "Failed to start the camera.";
1760
1723
  switch (e.name) {
1761
1724
  case "NotAllowedError": return "Camera permission was denied.";
@@ -1765,94 +1728,101 @@ function Xn(e) {
1765
1728
  default: return "Failed to start the camera.";
1766
1729
  }
1767
1730
  }
1768
- function Zn(e = {}) {
1769
- let { width: t = 1280, height: n = 720, facingMode: i = "user", enabled: o = !0, mockMode: l = !1, videoRef: u, onReadyChange: d, onErrorChange: f } = e, p = s(null), m = u ?? p, h = s(null), g = s(!1), _ = s(0), [v, y] = c(!1), [b, x] = c(null), S = r((e) => {
1770
- y(e), d?.(e);
1771
- }, [d]), C = r((e) => {
1772
- x(e), f?.(e);
1773
- }, [f]), w = r(() => {
1774
- h.current &&= (h.current.getTracks().forEach((e) => e.stop()), null), m.current && (m.current.pause(), m.current.srcObject = null), S(!1);
1775
- }, [S, m]), T = r(() => {
1776
- _.current += 1, w();
1777
- }, [w]), E = r(() => {
1778
- if (m.current) return m.current;
1731
+ function Vn(e = {}) {
1732
+ 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
+ get current() {
1734
+ return m.current;
1735
+ },
1736
+ set current(e) {
1737
+ m.current = e, d && (d.current = e);
1738
+ }
1739
+ }), [d]), g = i(null), _ = i(!1), v = i(0), [y, b] = a(!1), [x, S] = a(null), C = t((e) => {
1740
+ b(e), f?.(e);
1741
+ }, [f]), w = t((e) => {
1742
+ S(e), p?.(e);
1743
+ }, [p]), T = t(() => {
1744
+ g.current &&= (g.current.getTracks().forEach((e) => e.stop()), null), h.current && (h.current.pause(), h.current.srcObject = null), C(!1);
1745
+ }, [C, h]), E = t(() => {
1746
+ v.current += 1, T();
1747
+ }, [T]), D = t(() => {
1748
+ if (h.current) return h.current;
1779
1749
  let e = document.createElement("video");
1780
- return e.playsInline = !0, e.autoplay = !0, e.muted = !0, e.setAttribute("playsinline", "true"), m.current = e, e;
1781
- }, [m]), D = r(async () => {
1782
- let e = _.current + 1;
1783
- if (_.current = e, w(), C(null), l) {
1784
- E(), S(!0);
1750
+ return e.playsInline = !0, e.autoplay = !0, e.muted = !0, e.setAttribute("playsinline", "true"), h.current = e, e;
1751
+ }, [h]), O = t(async () => {
1752
+ let e = v.current + 1;
1753
+ if (v.current = e, T(), w(null), u) {
1754
+ D(), C(!0);
1785
1755
  return;
1786
1756
  }
1787
1757
  if (!navigator.mediaDevices?.getUserMedia) {
1788
- C("This browser does not support camera access.");
1758
+ w("This browser does not support camera access.");
1789
1759
  return;
1790
1760
  }
1791
1761
  try {
1792
- let r = E(), a = await navigator.mediaDevices.getUserMedia({
1762
+ let t = D(), n = await navigator.mediaDevices.getUserMedia({
1793
1763
  video: {
1794
- width: t,
1795
- height: n,
1796
- facingMode: i
1764
+ width: o,
1765
+ height: s,
1766
+ facingMode: c
1797
1767
  },
1798
1768
  audio: !1
1799
1769
  });
1800
- if (!g.current || _.current !== e) {
1801
- a.getTracks().forEach((e) => e.stop());
1770
+ if (!_.current || v.current !== e) {
1771
+ n.getTracks().forEach((e) => e.stop());
1802
1772
  return;
1803
1773
  }
1804
- if (h.current = a, r.srcObject = a, await r.play(), !g.current || _.current !== e) {
1805
- a.getTracks().forEach((e) => e.stop());
1774
+ if (g.current = n, t.srcObject = n, await t.play(), !_.current || v.current !== e) {
1775
+ n.getTracks().forEach((e) => e.stop());
1806
1776
  return;
1807
1777
  }
1808
- S(!0);
1778
+ C(!0);
1809
1779
  } catch (t) {
1810
- if (_.current !== e) return;
1811
- w(), C(Xn(t));
1780
+ if (v.current !== e) return;
1781
+ T(), w(Bn(t));
1812
1782
  }
1813
1783
  }, [
1814
- E,
1815
- i,
1816
- n,
1817
- l,
1818
- C,
1819
- S,
1784
+ D,
1785
+ c,
1786
+ s,
1787
+ u,
1820
1788
  w,
1821
- t
1789
+ C,
1790
+ T,
1791
+ o
1822
1792
  ]);
1823
- return a(() => (g.current = !0, () => {
1824
- g.current = !1, T();
1825
- }), [T]), a(() => {
1826
- if (g.current) {
1827
- if (!o) {
1828
- T();
1793
+ return n(() => (_.current = !0, () => {
1794
+ _.current = !1, E();
1795
+ }), [E]), n(() => {
1796
+ if (_.current) {
1797
+ if (!l) {
1798
+ E();
1829
1799
  return;
1830
1800
  }
1831
- D();
1801
+ O();
1832
1802
  }
1833
1803
  }, [
1834
- o,
1835
- D,
1836
- T
1804
+ l,
1805
+ O,
1806
+ E
1837
1807
  ]), {
1838
- videoRef: m,
1839
- isReady: v,
1840
- error: b,
1841
- start: D,
1842
- stop: T
1808
+ videoRef: h,
1809
+ isReady: y,
1810
+ error: x,
1811
+ start: O,
1812
+ stop: E
1843
1813
  };
1844
1814
  }
1845
1815
  //#endregion
1846
1816
  //#region src/hooks/useEverFitting.ts
1847
- function Qn(e = {}) {
1848
- let { width: t = 1280, height: n = 720, facingMode: r = "user", enabled: i = !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 = Zn({
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({
1849
1819
  width: t,
1850
- height: n,
1851
- facingMode: r,
1852
- enabled: i,
1820
+ height: i,
1821
+ facingMode: a,
1822
+ enabled: o,
1853
1823
  mockMode: s
1854
- }), S = Yn(x.videoRef, {
1855
- enabled: i,
1824
+ }), S = zn(x.videoRef, {
1825
+ enabled: o,
1856
1826
  modelComplexity: c,
1857
1827
  numPoses: l,
1858
1828
  minDetectionConfidence: u,
@@ -1860,7 +1830,7 @@ function Qn(e = {}) {
1860
1830
  outputSegmentationMasks: f,
1861
1831
  viewportWidth: p,
1862
1832
  viewportHeight: m
1863
- }), { config: C, measurements: w, sizeRecommendation: T, garmentScale: E, isMeasuring: D, measure: O, startMeasurement: k, updateConfig: A } = ut(), j = i && x.isReady && S.isTracking, M = Ge(w, v), N = o(() => we({
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({
1864
1834
  measurements: w,
1865
1835
  measurementScale: E,
1866
1836
  presetSelection: M.selection,
@@ -1873,9 +1843,9 @@ function Qn(e = {}) {
1873
1843
  b,
1874
1844
  w
1875
1845
  ]);
1876
- return a(() => {
1846
+ return n(() => {
1877
1847
  _ && A(_);
1878
- }, [_, A]), a(() => {
1848
+ }, [_, A]), n(() => {
1879
1849
  !h || !g || !j || w || D || k();
1880
1850
  }, [
1881
1851
  g,
@@ -1884,14 +1854,14 @@ function Qn(e = {}) {
1884
1854
  w,
1885
1855
  D,
1886
1856
  k
1887
- ]), a(() => {
1857
+ ]), n(() => {
1888
1858
  !h || !D || !S.landmarks || O(S.landmarks, {
1889
1859
  silhouetteWidths: S.silhouetteWidths,
1890
1860
  imageWidth: S.poseFrameWidth || t,
1891
- imageHeight: S.poseFrameHeight || n
1861
+ imageHeight: S.poseFrameHeight || i
1892
1862
  });
1893
1863
  }, [
1894
- n,
1864
+ i,
1895
1865
  h,
1896
1866
  D,
1897
1867
  O,
@@ -1900,7 +1870,7 @@ function Qn(e = {}) {
1900
1870
  S.poseFrameWidth,
1901
1871
  S.silhouetteWidths,
1902
1872
  t
1903
- ]), {
1873
+ ]), r(() => ({
1904
1874
  videoRef: x.videoRef,
1905
1875
  webcamReady: x.isReady,
1906
1876
  webcamError: x.error,
@@ -1933,12 +1903,45 @@ function Qn(e = {}) {
1933
1903
  bodyPresetSelection: M.selection,
1934
1904
  bodyPresetLoading: M.loading,
1935
1905
  bodyPresetError: M.error
1936
- };
1906
+ }), [
1907
+ N.morph,
1908
+ N.scale,
1909
+ M.error,
1910
+ M.loading,
1911
+ M.selection,
1912
+ j,
1913
+ C,
1914
+ E,
1915
+ D,
1916
+ w,
1917
+ T,
1918
+ k,
1919
+ S.confidence,
1920
+ S.detectedPersonCount,
1921
+ S.drawLandmarks,
1922
+ S.fps,
1923
+ S.isTrackerReady,
1924
+ S.isTracking,
1925
+ S.landmarks,
1926
+ S.lockedPersonId,
1927
+ S.poseFrameHeight,
1928
+ S.poseFrameWidth,
1929
+ S.poseRig,
1930
+ S.silhouetteWidths,
1931
+ S.trackingQuality,
1932
+ S.worldLandmarks,
1933
+ A,
1934
+ x.error,
1935
+ x.isReady,
1936
+ x.start,
1937
+ x.stop,
1938
+ x.videoRef
1939
+ ]);
1937
1940
  }
1938
1941
  //#endregion
1939
1942
  //#region src/garment/garmentFitProfile.ts
1940
- function $n(e) {
1941
- let t = new l.Vector3(), n = new l.Quaternion(), r = new l.Quaternion();
1943
+ function Un(e) {
1944
+ let t = new b.Vector3(), n = new b.Quaternion(), r = new b.Quaternion();
1942
1945
  return e.updateWorldMatrix(!0, !1), e.getWorldPosition(t), e.getWorldQuaternion(n), e.parent ? e.parent.getWorldQuaternion(r) : r.identity(), {
1943
1946
  bone: e,
1944
1947
  restQuaternion: e.quaternion.clone(),
@@ -1948,12 +1951,12 @@ function $n(e) {
1948
1951
  restParentWorldQuaternion: r
1949
1952
  };
1950
1953
  }
1951
- function er(e) {
1952
- let t = new l.Box3(), n = { current: !1 }, r = new l.Vector3(), i = new l.Box3();
1954
+ function Wn(e) {
1955
+ let t = new b.Box3(), n = { current: !1 }, r = new b.Vector3(), i = new b.Box3();
1953
1956
  return e.updateMatrixWorld(!0), e.traverse((e) => {
1954
- if (!(e instanceof l.Mesh) || e.name.startsWith("Collision") || !e.visible) return;
1957
+ if (!(e instanceof b.Mesh) || e.name.startsWith("Collision") || !e.visible) return;
1955
1958
  let a = e.geometry.getAttribute("skinIndex") && e.geometry.getAttribute("skinWeight");
1956
- if (e instanceof l.SkinnedMesh && a) {
1959
+ if (e instanceof b.SkinnedMesh && a) {
1957
1960
  if (e.computeBoundingBox(), !e.boundingBox) return;
1958
1961
  i.copy(e.boundingBox);
1959
1962
  } else {
@@ -2011,81 +2014,81 @@ function er(e) {
2011
2014
  });
2012
2015
  }), n.current || t.makeEmpty(), t;
2013
2016
  }
2014
- function tr(e) {
2017
+ function Gn(e) {
2015
2018
  if (!e || e.length === 0) return null;
2016
- let t = new l.Vector3(), n = new l.Vector3();
2019
+ let t = new b.Vector3(), n = new b.Vector3();
2017
2020
  return e.forEach(({ bone: e }) => {
2018
2021
  e.getWorldPosition(n), t.add(n);
2019
2022
  }), t.multiplyScalar(1 / e.length);
2020
2023
  }
2021
- function nr(e, t) {
2024
+ function Kn(e, t) {
2022
2025
  for (let n = 0; n < t.length; n += 1) {
2023
- let r = tr(e.get(t[n]));
2026
+ let r = Gn(e.get(t[n]));
2024
2027
  if (r) return r;
2025
2028
  }
2026
2029
  return null;
2027
2030
  }
2028
- function rr(e, t, n = 1) {
2031
+ function qn(e, t, n = 1) {
2029
2032
  e.updateMatrixWorld(!0);
2030
- let r = er(e), i = r.getCenter(new l.Vector3()), a = r.getSize(new l.Vector3()), o = new l.Vector3(i.x, r.min.y + a.y * .74, i.z), s = new l.Vector3(i.x, r.min.y + a.y * .42, i.z), c = nr(t, ["LeftUpperArm", "LeftShoulder"]), u = nr(t, ["RightUpperArm", "RightShoulder"]), d = nr(t, ["Hips"]), f = nr(t, ["LeftUpperLeg"]), p = nr(t, ["RightUpperLeg"]), m = c ?? o.clone().setX(i.x + a.x * .18), h = u ?? o.clone().setX(i.x - a.x * .18), g = d ?? s, _ = m.clone().add(h).multiplyScalar(.5), v = f && p ? f.clone().add(p).multiplyScalar(.5) : g.clone(), y = !!(c && u), b = y && !!(d || f && p), x = m.distanceTo(h), S = _.distanceTo(v), C = y ? Math.max(x, 1e-4) : Math.max(x, a.x * .3, n), w = b ? Math.max(S, 1e-4) : Math.max(S, a.y * .28, 1e-4), T = b ? _.clone().add(v).multiplyScalar(.5) : i.clone(), E = r.clone();
2031
- if (b) {
2032
- let e = Math.min(_.y, v.y), t = Math.max(_.y, v.y);
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();
2034
+ if (y) {
2035
+ let e = Math.min(g.y, _.y), t = Math.max(g.y, _.y);
2033
2036
  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);
2034
2037
  }
2035
- let D = E.getCenter(new l.Vector3()), O = E.getSize(new l.Vector3());
2038
+ let D = E.getCenter(new b.Vector3()), O = E.getSize(new b.Vector3());
2036
2039
  return {
2037
2040
  anchor: T,
2038
- shoulderCenter: _,
2039
- hipCenter: v,
2041
+ shoulderCenter: g,
2042
+ hipCenter: _,
2040
2043
  referenceWidth: C,
2041
2044
  referenceTorsoHeight: w,
2042
2045
  trackingHeight: Math.max(a.y, w, 1e-4),
2043
2046
  boundsCenter: D,
2044
2047
  boundsSize: O,
2045
- hasBoneAnchors: b
2048
+ hasBoneAnchors: y
2046
2049
  };
2047
2050
  }
2048
- function ir(e) {
2051
+ function Jn(e) {
2049
2052
  for (let t of e.values()) t.forEach(({ bone: e, restQuaternion: t, restScale: n }) => {
2050
2053
  e.quaternion.copy(t), e.scale.copy(n);
2051
2054
  });
2052
2055
  }
2053
2056
  //#endregion
2054
2057
  //#region src/avatar/avatarLoader.ts
2055
- var ar = "__nativeVRMPrepared";
2056
- function or(e) {
2058
+ var Yn = "__nativeVRMPrepared";
2059
+ function Xn(e) {
2057
2060
  try {
2058
2061
  return new URL(e, "https://avatar.local").pathname;
2059
2062
  } catch {
2060
2063
  return e;
2061
2064
  }
2062
2065
  }
2063
- function sr(e) {
2064
- return or(e).toLowerCase().endsWith(".vrm");
2066
+ function Zn(e) {
2067
+ return Xn(e).toLowerCase().endsWith(".vrm");
2065
2068
  }
2066
- function cr(e) {
2067
- return sr(e) ? "vrm" : "gltf";
2069
+ function Qn(e) {
2070
+ return Zn(e) ? "vrm" : "gltf";
2068
2071
  }
2069
- function lr(e, t) {
2070
- sr(t) && e.register((e) => new E(e));
2072
+ function $n(e, t) {
2073
+ Zn(t) && e.register((e) => new S(e));
2071
2074
  }
2072
- function ur(e) {
2073
- if (sr(e)) return (t) => {
2074
- lr(t, e);
2075
+ function er(e) {
2076
+ if (Zn(e)) return (t) => {
2077
+ $n(t, e);
2075
2078
  };
2076
2079
  }
2077
- function dr(e) {
2080
+ function tr(e) {
2078
2081
  e.traverse((e) => {
2079
2082
  e.frustumCulled = !1;
2080
2083
  });
2081
2084
  }
2082
- function fr(e) {
2085
+ function nr(e) {
2083
2086
  let t = e.scene.userData;
2084
- t[ar] || (D.rotateVRM0(e), t[ar] = !0), dr(e.scene);
2087
+ t[Yn] || (C.rotateVRM0(e), t[Yn] = !0), tr(e.scene);
2085
2088
  }
2086
2089
  //#endregion
2087
2090
  //#region src/avatar/humanoidBindings.ts
2088
- var pr = {
2091
+ var rr = {
2089
2092
  Hips: ["hips"],
2090
2093
  Spine: ["spine"],
2091
2094
  Chest: ["chest", "upperChest"],
@@ -2106,13 +2109,13 @@ var pr = {
2106
2109
  RightLowerLeg: ["rightLowerLeg"],
2107
2110
  RightFoot: ["rightFoot"]
2108
2111
  };
2109
- function mr(e) {
2112
+ function ir(e) {
2110
2113
  let t = /* @__PURE__ */ new Map();
2111
- return Object.entries(pr).forEach(([n, r]) => {
2114
+ return Object.entries(rr).forEach(([n, r]) => {
2112
2115
  for (let i = 0; i < r.length; i += 1) {
2113
2116
  let a = e.getNormalizedBoneNode(r[i]);
2114
2117
  if (a) {
2115
- t.set(n, [$n(a)]);
2118
+ t.set(n, [Un(a)]);
2116
2119
  break;
2117
2120
  }
2118
2121
  }
@@ -2120,7 +2123,7 @@ function mr(e) {
2120
2123
  }
2121
2124
  //#endregion
2122
2125
  //#region src/avatar/VRMCompat.ts
2123
- var hr = {
2126
+ var ar = {
2124
2127
  root: "hips",
2125
2128
  c_spine0: "spine",
2126
2129
  c_spine1: "spine",
@@ -2142,7 +2145,7 @@ var hr = {
2142
2145
  r_upleg: "rightUpperLeg",
2143
2146
  r_lowleg: "rightLowerLeg",
2144
2147
  r_foot: "rightFoot"
2145
- }, gr = {
2148
+ }, or = {
2146
2149
  bone_0: "hips",
2147
2150
  bone_1: "spine",
2148
2151
  bone_2: "chest",
@@ -2163,7 +2166,7 @@ var hr = {
2163
2166
  bone_48: "rightUpperLeg",
2164
2167
  bone_49: "rightLowerLeg",
2165
2168
  bone_50: "rightFoot"
2166
- }, _r = {
2169
+ }, sr = {
2167
2170
  Root: "hips",
2168
2171
  Hips: "hips",
2169
2172
  Spine: "spine",
@@ -2185,7 +2188,7 @@ var hr = {
2185
2188
  RightLowerLeg: "rightLowerLeg",
2186
2189
  RightFoot: "rightFoot"
2187
2190
  };
2188
- function vr(e, t) {
2191
+ function cr(e, t) {
2189
2192
  if (t?.humanoid) return {
2190
2193
  getNormalizedBoneNode: (e) => t.humanoid.getNormalizedBoneNode(e) ?? null,
2191
2194
  update: (e) => t.update(e),
@@ -2193,12 +2196,12 @@ function vr(e, t) {
2193
2196
  };
2194
2197
  let n = /* @__PURE__ */ new Map();
2195
2198
  return e.traverse((e) => {
2196
- if (!(e instanceof l.Bone)) return;
2197
- let t = e.name, r = hr[t];
2199
+ if (!(e instanceof b.Bone)) return;
2200
+ let t = e.name, r = ar[t];
2198
2201
  r && !n.has(r) && n.set(r, e);
2199
- let i = _r[t];
2202
+ let i = sr[t];
2200
2203
  i && !n.has(i) && n.set(i, e);
2201
- let a = gr[t];
2204
+ let a = or[t];
2202
2205
  a && !n.has(a) && n.set(a, e);
2203
2206
  }), {
2204
2207
  getNormalizedBoneNode: (e) => n.get(e) ?? null,
@@ -2208,10 +2211,10 @@ function vr(e, t) {
2208
2211
  }
2209
2212
  //#endregion
2210
2213
  //#region src/hooks/useAvatarVariant.ts
2211
- function yr(e) {
2212
- let t = T(e);
2213
- return dr(t), t.traverse((e) => {
2214
- if (e instanceof l.Mesh) {
2214
+ function lr(e) {
2215
+ let t = x(e);
2216
+ return tr(t), t.traverse((e) => {
2217
+ if (e instanceof b.Mesh) {
2215
2218
  if (Array.isArray(e.material)) {
2216
2219
  e.material = e.material.map((e) => e.clone());
2217
2220
  return;
@@ -2220,32 +2223,32 @@ function yr(e) {
2220
2223
  }
2221
2224
  }), t;
2222
2225
  }
2223
- function br({ url: e }) {
2224
- let t = x(e, "/draco/", !0, o(() => ur(e), [e])), n = t.userData?.vrm ?? null, r = o(() => n ? (fr(n), n.scene) : yr(t.scene), [t.scene, n]), i = o(() => vr(r, n), [r, n]);
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]);
2225
2228
  return {
2226
- scene: r,
2227
- humanoid: i,
2228
- bones: o(() => mr(i), [i])
2229
+ scene: i,
2230
+ humanoid: a,
2231
+ bones: r(() => ir(a), [a])
2229
2232
  };
2230
2233
  }
2231
2234
  //#endregion
2232
2235
  //#region src/pose/boneMapping.ts
2233
- var q = Math.PI / 180, xr = {
2234
- min: -70 * q,
2235
- max: 70 * q
2236
- }, Sr = {
2237
- min: -45 * q,
2238
- max: 45 * q
2239
- }, Cr = {
2240
- min: -150 * q,
2241
- max: 150 * q
2242
- }, wr = {
2243
- min: -90 * q,
2244
- max: 90 * q
2245
- }, Tr = {
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 = {
2246
2249
  min: 0,
2247
- max: 150 * q
2248
- }, Er = {
2250
+ max: 150 * Y
2251
+ }, gr = {
2249
2252
  Hips: {
2250
2253
  rigKey: "hips",
2251
2254
  rotationScale: {
@@ -2276,22 +2279,22 @@ var q = Math.PI / 180, xr = {
2276
2279
  rigKey: "leftUpperArm",
2277
2280
  rotationScale: .45,
2278
2281
  rotationLimits: {
2279
- x: xr,
2280
- z: Sr
2282
+ x: dr,
2283
+ z: fr
2281
2284
  }
2282
2285
  },
2283
2286
  LeftUpperArm: {
2284
2287
  rigKey: "leftUpperArm",
2285
2288
  rotationScale: 1,
2286
2289
  rotationLimits: {
2287
- x: Cr,
2288
- z: wr
2290
+ x: pr,
2291
+ z: mr
2289
2292
  }
2290
2293
  },
2291
2294
  LeftLowerArm: {
2292
2295
  rigKey: "leftLowerArm",
2293
2296
  rotationScale: 1,
2294
- rotationLimits: { x: Tr }
2297
+ rotationLimits: { x: hr }
2295
2298
  },
2296
2299
  LeftHand: {
2297
2300
  rigKey: "leftLowerArm",
@@ -2301,22 +2304,22 @@ var q = Math.PI / 180, xr = {
2301
2304
  rigKey: "rightUpperArm",
2302
2305
  rotationScale: .45,
2303
2306
  rotationLimits: {
2304
- x: xr,
2305
- z: Sr
2307
+ x: dr,
2308
+ z: fr
2306
2309
  }
2307
2310
  },
2308
2311
  RightUpperArm: {
2309
2312
  rigKey: "rightUpperArm",
2310
2313
  rotationScale: 1,
2311
2314
  rotationLimits: {
2312
- x: Cr,
2313
- z: wr
2315
+ x: pr,
2316
+ z: mr
2314
2317
  }
2315
2318
  },
2316
2319
  RightLowerArm: {
2317
2320
  rigKey: "rightLowerArm",
2318
2321
  rotationScale: 1,
2319
- rotationLimits: { x: Tr }
2322
+ rotationLimits: { x: hr }
2320
2323
  },
2321
2324
  RightHand: {
2322
2325
  rigKey: "rightLowerArm",
@@ -2340,7 +2343,7 @@ var q = Math.PI / 180, xr = {
2340
2343
  rotationScale: .9
2341
2344
  },
2342
2345
  RightFoot: { rigKey: null }
2343
- }, Dr = {
2346
+ }, _r = {
2344
2347
  Root: "Hips",
2345
2348
  root: "Hips",
2346
2349
  c_spine0: "Spine",
@@ -2383,22 +2386,22 @@ var q = Math.PI / 180, xr = {
2383
2386
  mixamorig_RightLeg: "RightLowerLeg",
2384
2387
  mixamorig_RightFoot: "RightFoot"
2385
2388
  };
2386
- function Or(e) {
2387
- return Er[e] ? e : Dr[e] ?? e;
2389
+ function vr(e) {
2390
+ return gr[e] ? e : _r[e] ?? e;
2388
2391
  }
2389
- function kr(e, t) {
2390
- let n = Er[Or(e)];
2392
+ function yr(e, t) {
2393
+ let n = gr[vr(e)];
2391
2394
  if (!n || !n.rigKey) return null;
2392
2395
  let r = t[n.rigKey];
2393
2396
  if (!r) return null;
2394
- let i = Ar(n.rigKey === "hips" && "rotation" in r ? r.rotation : r, n.rotationScale);
2397
+ let i = br(n.rigKey === "hips" && "rotation" in r ? r.rotation : r, n.rotationScale);
2395
2398
  return {
2396
- x: jr(i.x, n.rotationLimits?.x),
2397
- y: jr(i.y, n.rotationLimits?.y),
2398
- z: jr(i.z, n.rotationLimits?.z)
2399
+ x: xr(i.x, n.rotationLimits?.x),
2400
+ y: xr(i.y, n.rotationLimits?.y),
2401
+ z: xr(i.z, n.rotationLimits?.z)
2399
2402
  };
2400
2403
  }
2401
- function Ar(e, t = 1) {
2404
+ function br(e, t = 1) {
2402
2405
  return typeof t == "number" ? {
2403
2406
  x: e.x * t,
2404
2407
  y: e.y * t,
@@ -2409,12 +2412,12 @@ function Ar(e, t = 1) {
2409
2412
  z: e.z * (t.z ?? 1)
2410
2413
  };
2411
2414
  }
2412
- function jr(e, t) {
2415
+ function xr(e, t) {
2413
2416
  return t ? Math.min(t.max, Math.max(t.min, e)) : e;
2414
2417
  }
2415
2418
  //#endregion
2416
2419
  //#region src/garment/poseApplication.ts
2417
- var Mr = 12, Nr = new l.Quaternion(), J = new l.Quaternion(), Pr = new l.Quaternion(), Fr = new l.Vector3(), Ir = new l.Vector3(), Lr = new l.Vector3(), Rr = new l.Vector3(), zr = new l.Vector3(), Br = new l.Vector3(), Vr = new l.Vector3(), Hr = new l.Vector3(), Ur = new l.Vector3(), Wr = new l.Quaternion(), Gr = new l.Quaternion(), Kr = new l.Quaternion(), qr = new l.Quaternion(), Jr = {
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 = {
2418
2421
  Hips: [
2419
2422
  "Spine",
2420
2423
  "Chest",
@@ -2433,7 +2436,7 @@ var Mr = 12, Nr = new l.Quaternion(), J = new l.Quaternion(), Pr = new l.Quatern
2433
2436
  LeftLowerLeg: ["LeftFoot"],
2434
2437
  RightUpperLeg: ["RightLowerLeg"],
2435
2438
  RightLowerLeg: ["RightFoot"]
2436
- }, Yr = {
2439
+ }, zr = {
2437
2440
  Hips: [
2438
2441
  ["LeftUpperLeg", "RightUpperLeg"],
2439
2442
  ["LeftShoulder", "RightShoulder"],
@@ -2449,104 +2452,104 @@ var Mr = 12, Nr = new l.Quaternion(), J = new l.Quaternion(), Pr = new l.Quatern
2449
2452
  ["LeftUpperArm", "RightUpperArm"],
2450
2453
  ["LeftUpperLeg", "RightUpperLeg"]
2451
2454
  ]
2452
- }, Xr = {
2453
- Hips: [B.RIGHT_HIP, B.LEFT_HIP],
2454
- Spine: [B.RIGHT_SHOULDER, B.LEFT_SHOULDER],
2455
- Chest: [B.RIGHT_SHOULDER, B.LEFT_SHOULDER]
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]
2456
2459
  };
2457
- function Zr(e) {
2460
+ function Vr(e) {
2458
2461
  return e.startsWith("Left") ? `Right${e.slice(4)}` : e.startsWith("Right") ? `Left${e.slice(5)}` : e;
2459
2462
  }
2460
- function Qr(e, t, n, r) {
2461
- let i = Jr[e];
2463
+ function Hr(e, t, n, r) {
2464
+ let i = Rr[e];
2462
2465
  if (!i) return !1;
2463
2466
  for (let e = 0; e < i.length; e += 1) {
2464
2467
  let a = n.get(i[e])?.[0];
2465
- 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(Wr.copy(t.restParentWorldQuaternion).invert()).normalize(), !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;
2466
2469
  }
2467
2470
  return !1;
2468
2471
  }
2469
- function $r(e) {
2470
- return e in Yr;
2472
+ function Ur(e) {
2473
+ return e in zr;
2471
2474
  }
2472
- function ei(e, t, n, r) {
2473
- let i = Yr[e];
2475
+ function Wr(e, t, n, r) {
2476
+ let i = zr[e];
2474
2477
  if (!i || !t.restParentWorldQuaternion) return !1;
2475
2478
  for (let e = 0; e < i.length; e += 1) {
2476
2479
  let [a, o] = i[e], s = n.get(a)?.[0], c = n.get(o)?.[0];
2477
- if (!(!s?.restWorldPosition || !c?.restWorldPosition) && (r.copy(c.restWorldPosition).sub(s.restWorldPosition).applyQuaternion(Wr.copy(t.restParentWorldQuaternion).invert()), !(r.lengthSq() < 1e-6))) return r.normalize(), !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;
2478
2481
  }
2479
2482
  return !1;
2480
2483
  }
2481
- function ti(e, t, n, r, i) {
2482
- let a = Xr[e];
2483
- return !a || !Jt(a[0], a[1], t, i, n) ? !1 : (i.applyQuaternion(Kr.copy(r).invert()).normalize(), i.lengthSq() >= 1e-6);
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);
2484
2487
  }
2485
- function ni(e, t, n, r, i, a, o, s) {
2486
- if (!ei(e, t, n, Rr) || !ti(e, r, i, a, zr) || (Br.copy(Rr).applyQuaternion(J), Vr.copy(Br).projectOnPlane(Lr).normalize(), Hr.copy(zr).projectOnPlane(Lr).normalize(), Vr.lengthSq() < 1e-6 || Hr.lengthSq() < 1e-6)) return s.copy(J), !1;
2487
- Ur.crossVectors(Vr, Hr);
2488
- let c = Math.atan2(Lr.dot(Ur), Vr.dot(Hr));
2489
- return qr.setFromAxisAngle(Lr, c), s.copy(qr).multiply(J), o !== void 0 && s.slerp(Pr, 1 - o), !0;
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;
2490
2493
  }
2491
- function ri() {
2492
- let e = s(new l.Timer()), t = s(/* @__PURE__ */ new Map());
2493
- return o(() => ({
2494
+ function qr() {
2495
+ let e = i(new b.Timer()), t = i(/* @__PURE__ */ new Map());
2496
+ return r(() => ({
2494
2497
  clockRef: e,
2495
2498
  prevRotationsRef: t
2496
2499
  }), []);
2497
2500
  }
2498
- function ii(e, t, n, r = {}) {
2501
+ function Jr(e, t, n, r = {}) {
2499
2502
  if (t.size === 0) return;
2500
2503
  let { coordinateSpace: i = "normalized", excludeBones: a } = r;
2501
2504
  n.clockRef.current.update();
2502
- let o = n.clockRef.current.getDelta(), s = Math.min(1, o * Mr);
2505
+ let o = n.clockRef.current.getDelta(), s = Math.min(1, o * Sr);
2503
2506
  for (let [n, r] of t) {
2504
- let o = Or(n);
2507
+ let o = vr(n);
2505
2508
  if (a?.has(o)) continue;
2506
- let c = Zr(o);
2509
+ let c = Vr(o);
2507
2510
  if (o !== n && t.has(o)) continue;
2508
- let l = Qt(c);
2511
+ let l = Vt(c);
2509
2512
  if (!l) continue;
2510
- let u = l && Yt(c, e, Fr, i);
2513
+ let u = l && Rt(c, e, Tr, i);
2511
2514
  if (!u) continue;
2512
- let d = !1, f = Xt(c);
2515
+ let d = !1, f = zt(c);
2513
2516
  for (let n of r) {
2514
2517
  let { bone: r, restQuaternion: a } = n;
2515
- if (u && Qr(o, n, t, Ir)) r.parent ? (r.parent.updateWorldMatrix(!0, !1), r.parent.getWorldQuaternion(Gr)) : (r.updateWorldMatrix(!0, !1), Gr.identity()), Lr.copy(Fr).applyQuaternion(Kr.copy(Gr).invert()).normalize(), J.setFromUnitVectors(Ir, Lr), $r(o) && ni(o, n, t, e, i, Gr, f, J) || f !== void 0 && J.slerp(Pr, 1 - f), Nr.copy(J).multiply(a);
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);
2516
2519
  else {
2517
- if (d ||= Zt(c, e, J, i), !d) continue;
2518
- Nr.copy(a).multiply(J);
2520
+ if (d ||= Bt(c, e, X, i), !d) continue;
2521
+ Cr.copy(a).multiply(X);
2519
2522
  }
2520
- r.quaternion.slerp(Nr, s), r.updateWorldMatrix(!1, !0);
2523
+ r.quaternion.slerp(Cr, s), r.updateWorldMatrix(!1, !0);
2521
2524
  }
2522
2525
  }
2523
2526
  }
2524
- function ai(e, t) {
2525
- ir(e), t.prevRotationsRef.current.clear();
2527
+ function Yr(e, t) {
2528
+ Jn(e), t.prevRotationsRef.current.clear();
2526
2529
  }
2527
- function oi(e, t, n, r) {
2528
- let i = Math.min(1, n * Mr);
2530
+ function Xr(e, t, n, r) {
2531
+ let i = Math.min(1, n * Sr);
2529
2532
  for (let [n, a] of e) {
2530
- let e = Or(n);
2533
+ let e = vr(n);
2531
2534
  if (!(r && !r.has(e))) for (let { bone: e, restQuaternion: n } of a) e.quaternion.slerp(n, t * i);
2532
2535
  }
2533
2536
  }
2534
2537
  //#endregion
2535
2538
  //#region src/pose/yawDirectionStabilizer.ts
2536
- var si = 50 * Math.PI / 180, ci = 30 * Math.PI / 180, li = 3;
2537
- function ui(e) {
2538
- return Math.abs(e) < si ? "unknown" : e >= 0 ? "positive" : "negative";
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";
2539
2542
  }
2540
- function di(e) {
2543
+ function ti(e) {
2541
2544
  return e === "positive" ? 1 : e === "negative" ? -1 : 0;
2542
2545
  }
2543
- var fi = class {
2546
+ var ni = class {
2544
2547
  _committedYawDirection = "unknown";
2545
2548
  _pendingYawDirection = "unknown";
2546
2549
  _pendingCount = 0;
2547
2550
  update(e, t) {
2548
- let n = Math.abs(t), r = ui(t);
2549
- return e === "back" || n < ci ? (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 >= li ? (this._committedYawDirection = this._pendingYawDirection, this._clearPending(), this._buildState(r, this._committedYawDirection, n * di(this._committedYawDirection))) : this._buildState(r, r, t)) : this._buildState(r, this._committedYawDirection, n * di(this._committedYawDirection));
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));
2550
2553
  }
2551
2554
  reset() {
2552
2555
  this._committedYawDirection = "unknown", this._clearPending();
@@ -2564,41 +2567,41 @@ var fi = class {
2564
2567
  _clearPending() {
2565
2568
  this._pendingYawDirection = "unknown", this._pendingCount = 0;
2566
2569
  }
2567
- }, pi = 80 * Math.PI / 180, mi = 100 * Math.PI / 180, hi = 25 * Math.PI / 180, gi = 8, _i = 5, vi = 5, yi = 5, bi = .5, xi = .3, Si = .2, Ci = 5, wi = 8;
2568
- function Ti(e) {
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) {
2569
2572
  return e?.visibility ?? 0;
2570
2573
  }
2571
- function Ei(e) {
2574
+ function gi(e) {
2572
2575
  if (!e || e.length < 33) return {
2573
2576
  shoulderOrder: !1,
2574
2577
  noseVisible: !1,
2575
2578
  earSymmetry: !1
2576
2579
  };
2577
- 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 = Ti(r) > bi, c = Ti(i), l = Ti(a);
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);
2578
2581
  return {
2579
2582
  shoulderOrder: o,
2580
2583
  noseVisible: s,
2581
- earSymmetry: Math.abs(c - l) < xi && Math.max(c, l) > Si
2584
+ earSymmetry: Math.abs(c - l) < di && Math.max(c, l) > fi
2582
2585
  };
2583
2586
  }
2584
- function Di(e) {
2587
+ function _i(e) {
2585
2588
  let t = 0;
2586
2589
  return e.shoulderOrder && (t += 1), e.noseVisible && (t += 1), e.earSymmetry && (t += 1), t >= 2;
2587
2590
  }
2588
- function Oi(e) {
2589
- return e < pi ? "front" : e < mi ? "side" : "back";
2591
+ function vi(e) {
2592
+ return e < ri ? "front" : e < ii ? "side" : "back";
2590
2593
  }
2591
- var ki = class {
2594
+ var yi = class {
2592
2595
  _zone = "front";
2593
2596
  _consecutiveCount = 0;
2594
2597
  _lastRawZone = "front";
2595
2598
  _2dFrontCount = 0;
2596
2599
  _2dBackCount = 0;
2597
2600
  _2dIsFront = !0;
2598
- _yawDirectionStabilizer = new fi();
2601
+ _yawDirectionStabilizer = new ni();
2599
2602
  update(e, t, n) {
2600
- let r = t ?? 0, i = n ?? 0, a = Math.abs(i) > hi, o;
2601
- t === void 0 ? o = this._resolve2dFallback(e) : (o = Oi(Math.abs(t)), o === "front" && this._zone !== "front" && (Di(Ei(e)) || (o = "back"))), this._applyHysteresis(o);
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);
2602
2605
  let s = t === void 0 ? null : this._yawDirectionStabilizer.update(this._zone, r);
2603
2606
  return t === void 0 && this._yawDirectionStabilizer.reset(), {
2604
2607
  zone: this._zone,
@@ -2616,7 +2619,7 @@ var ki = class {
2616
2619
  this._zone = "front", this._consecutiveCount = 0, this._lastRawZone = "front", this._2dFrontCount = 0, this._2dBackCount = 0, this._2dIsFront = !0, this._yawDirectionStabilizer.reset();
2617
2620
  }
2618
2621
  _resolve2dFallback(e) {
2619
- return Di(Ei(e)) ? (this._2dFrontCount += 1, this._2dBackCount = 0) : (this._2dBackCount += 1, this._2dFrontCount = 0), this._2dIsFront ? this._2dBackCount >= Ci && (this._2dIsFront = !1) : this._2dFrontCount >= wi && (this._2dIsFront = !0), this._2dIsFront ? "front" : "back";
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";
2620
2623
  }
2621
2624
  _applyHysteresis(e) {
2622
2625
  e === this._lastRawZone ? this._consecutiveCount += 1 : (this._lastRawZone = e, this._consecutiveCount = 1);
@@ -2624,18 +2627,18 @@ var ki = class {
2624
2627
  t !== null && this._consecutiveCount >= t && (this._zone = e);
2625
2628
  }
2626
2629
  _getTransitionThreshold(e, t) {
2627
- return e === t ? null : e === "front" && t === "side" || e === "front" && t === "back" ? gi : e === "side" && t === "back" ? _i : e === "back" && t === "side" ? vi : e === "side" && t === "front" ? yi : e === "back" && t === "front" ? vi : gi;
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;
2628
2631
  }
2629
- }, Ai = Math.PI / 2;
2630
- function ji(e) {
2631
- return e >= 0 ? Ai : -Ai;
2632
+ }, bi = Math.PI / 2;
2633
+ function xi(e) {
2634
+ return e >= 0 ? bi : -bi;
2632
2635
  }
2633
- var Mi = class {
2636
+ var Si = class {
2634
2637
  _isFrozen = !1;
2635
2638
  _frozenYaw = null;
2636
- update(e, t, n) {
2637
- let r = Math.abs(t);
2638
- return this._isFrozen ? e !== "back" && r < Ai && this.reset() : e !== "front" && r >= Ai && (this._isFrozen = !0, this._frozenYaw = ji(t)), {
2639
+ update(e, t) {
2640
+ 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)), {
2639
2642
  isFrozen: this._isFrozen,
2640
2643
  frozenYaw: this._frozenYaw
2641
2644
  };
@@ -2646,88 +2649,109 @@ var Mi = class {
2646
2649
  };
2647
2650
  //#endregion
2648
2651
  //#region src/pose/coordinateTransform.ts
2649
- function Ni(e, t) {
2652
+ function Ci(e, t) {
2650
2653
  return typeof e == "boolean" ? {
2651
2654
  mirrorX: e,
2652
2655
  sourceWidth: 0,
2653
2656
  sourceHeight: 0,
2654
- target: t ?? new l.Vector3()
2657
+ target: t ?? new b.Vector3()
2655
2658
  } : {
2656
2659
  mirrorX: e.mirrorX ?? !1,
2657
2660
  sourceWidth: e.sourceWidth ?? 0,
2658
2661
  sourceHeight: e.sourceHeight ?? 0,
2659
- target: e.target ?? t ?? new l.Vector3()
2662
+ target: e.target ?? t ?? new b.Vector3()
2660
2663
  };
2661
2664
  }
2662
- function Y(e, t, n, r = !1, i) {
2663
- let a = Ni(r, i), o = dt(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;
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;
2664
2667
  return a.target.set(u, d, f);
2665
2668
  }
2669
+ function wi(e, t, n, r, i = !1, a) {
2670
+ return Z({
2671
+ x: (e.x + t.x) / 2,
2672
+ y: (e.y + t.y) / 2,
2673
+ z: ((e.z ?? 0) + (t.z ?? 0)) / 2,
2674
+ visibility: Math.min(e.visibility ?? 0, t.visibility ?? 0)
2675
+ }, n, r, i, a);
2676
+ }
2677
+ function Ti(e, t, n, r) {
2678
+ let i = (e.x - t.x) * n, a = (e.y - t.y) * r;
2679
+ return Math.sqrt(i * i + a * a);
2680
+ }
2666
2681
  //#endregion
2667
2682
  //#region src/garment/fitMotion.ts
2668
- var Pi = .45, Fi = .72, Ii = 1.02, Li = 1.1, Ri = 1e-4, zi = Ri * Ri, Bi = .35, Vi = .6, Hi = new l.Vector3(), Ui = new l.Vector3(), X = new l.Vector3(), Z = new l.Vector3(), Wi = new l.Vector3(), Gi = new l.Vector3(), Ki = new l.Matrix4();
2669
- function qi(e, t, n) {
2670
- let r = Math.min(Math.abs(n), Li), i = 1 / Math.max(Math.cos(r), Pi) * e, a = t * Fi;
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;
2671
2686
  return Math.max(i, a, e);
2672
2687
  }
2673
- function Ji({ projectedShoulderWidth: e, projectedTorsoHeight: t, bodyYaw: n, worldLandmarks: r }) {
2674
- let i = qi(e, t, n), a = Xi(t, r);
2688
+ function Vi({ projectedShoulderWidth: e, projectedTorsoHeight: t, bodyYaw: n, worldLandmarks: r }) {
2689
+ let i = Bi(e, t, n), a = Gi(t, r);
2675
2690
  if (!a) return i;
2676
- let o = $i((Math.abs(n) - Bi) / Vi, 0, 1);
2691
+ let o = Ji((Math.abs(n) - Ni) / Pi, 0, 1);
2677
2692
  return i + (Math.max(i, a) - i) * o;
2678
2693
  }
2679
- function Yi({ leftShoulder: e, rightShoulder: t, leftHip: n, rightHip: r }, i = new l.Quaternion()) {
2680
- return Hi.copy(e).add(t).multiplyScalar(.5), Ui.copy(n).add(r).multiplyScalar(.5), X.copy(t).sub(e), X.lengthSq() <= zi || (X.normalize(), Z.copy(Hi).sub(Ui), Wi.copy(X).multiplyScalar(Z.dot(X)), Z.sub(Wi), Z.lengthSq() <= zi) || (Z.normalize(), Gi.crossVectors(X, Z), Gi.lengthSq() <= zi) ? null : (Gi.normalize(), Z.crossVectors(Gi, X).normalize(), Ki.makeBasis(X, Z, Gi), i.setFromRotationMatrix(Ki));
2694
+ function Hi(e) {
2695
+ return e ? Ji(e.hips.rotation.y * .85 + e.chest.y * .15, -ki, ki) : 0;
2696
+ }
2697
+ function Ui(e, t, n) {
2698
+ 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;
2700
+ let o = -(i.y - r.y);
2701
+ return Ji(Math.atan2(o, a) * Ji(1 - Math.abs(n) / ki, 0, 1), -Ai, Ai);
2702
+ }
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));
2681
2705
  }
2682
- function Xi(e, t) {
2683
- if (!t || t.length <= B.RIGHT_HIP || e <= Ri) return null;
2684
- let n = t[B.LEFT_SHOULDER], r = t[B.RIGHT_SHOULDER], i = t[B.LEFT_HIP], a = t[B.RIGHT_HIP];
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];
2685
2709
  if (!n || !r || !i || !a) return null;
2686
- let o = Qi(n, r), s = Qi(Zi(n, r), Zi(i, a));
2687
- return o <= Ri || s <= Ri ? null : e * $i(o / s, Fi, Ii);
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);
2688
2712
  }
2689
- function Zi(e, t) {
2713
+ function Ki(e, t) {
2690
2714
  return {
2691
2715
  x: (e.x + t.x) * .5,
2692
2716
  y: (e.y + t.y) * .5,
2693
2717
  z: ((e.z ?? 0) + (t.z ?? 0)) * .5
2694
2718
  };
2695
2719
  }
2696
- function Qi(e, t) {
2720
+ function qi(e, t) {
2697
2721
  let n = e.x - t.x, r = e.y - t.y, i = (e.z ?? 0) - (t.z ?? 0);
2698
2722
  return Math.sqrt(n * n + r * r + i * i);
2699
2723
  }
2700
- function $i(e, t, n) {
2724
+ function Ji(e, t, n) {
2701
2725
  return Math.max(t, Math.min(n, e));
2702
2726
  }
2703
2727
  //#endregion
2704
2728
  //#region src/garment/trackedModelTransform.ts
2705
- var Q = 1e-4, ea = .15, ta = 8, na = 1e-4, ra = 1.45, ia = .35, aa = 10, oa = .18, sa = .55, ca = 6, la = .3, ua = .08, da = .05, fa = 1.35, pa = .7, ma = new l.Quaternion(), $ = new l.Vector3(), ha = [
2706
- [B.LEFT_EAR, B.RIGHT_EAR],
2707
- B.NOSE,
2708
- [B.LEFT_SHOULDER, B.RIGHT_SHOULDER]
2709
- ], ga = [
2710
- [B.LEFT_ANKLE, B.RIGHT_ANKLE],
2711
- [B.LEFT_HEEL, B.RIGHT_HEEL],
2712
- [B.LEFT_FOOT_INDEX, B.RIGHT_FOOT_INDEX]
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]
2713
2737
  ];
2714
- function _a(e, t, n) {
2738
+ function ma(e, t, n) {
2715
2739
  return Math.max(t, Math.min(n, e));
2716
2740
  }
2717
- function va() {
2741
+ function ha() {
2718
2742
  return {
2719
- leftShoulder: new l.Vector3(),
2720
- rightShoulder: new l.Vector3(),
2721
- leftHip: new l.Vector3(),
2722
- rightHip: new l.Vector3(),
2723
- shoulderCenter: new l.Vector3(),
2724
- hipCenter: new l.Vector3(),
2725
- bodyTop: new l.Vector3(),
2726
- bodyBottom: new l.Vector3(),
2727
- anchor: new l.Vector3(),
2728
- scaledAnchor: new l.Vector3(),
2729
- position: new l.Vector3(),
2730
- scale: new l.Vector3(1, 1, 1),
2743
+ leftShoulder: new b.Vector3(),
2744
+ rightShoulder: new b.Vector3(),
2745
+ leftHip: new b.Vector3(),
2746
+ rightHip: new b.Vector3(),
2747
+ shoulderCenter: new b.Vector3(),
2748
+ hipCenter: new b.Vector3(),
2749
+ bodyTop: new b.Vector3(),
2750
+ bodyBottom: new b.Vector3(),
2751
+ anchor: new b.Vector3(),
2752
+ scaledAnchor: new b.Vector3(),
2753
+ position: new b.Vector3(),
2754
+ scale: new b.Vector3(1, 1, 1),
2731
2755
  stabilizedBodyHeightScale: null,
2732
2756
  missingBodyHeightFrames: 0,
2733
2757
  smoothedGlobalScale: 1,
@@ -2736,85 +2760,88 @@ function va() {
2736
2760
  previousDepthProxy: 0,
2737
2761
  scaleVelocity: 0,
2738
2762
  smoothedXDeviation: 1,
2739
- smoothedAnchor: new l.Vector3(),
2763
+ smoothedAnchor: new b.Vector3(),
2740
2764
  hasSmoothedAnchor: !1
2741
2765
  };
2742
2766
  }
2743
- function ya(e, t, n, r, i, a = {}) {
2767
+ function ga(e, t, n, r, i, a = {}) {
2744
2768
  if (t.length < 33) return !1;
2745
- Y(t[B.LEFT_SHOULDER], n, r, {
2769
+ Z(t[U.LEFT_SHOULDER], n, r, {
2746
2770
  mirrorX: !0,
2747
2771
  sourceWidth: a.sourceWidth,
2748
2772
  sourceHeight: a.sourceHeight,
2749
2773
  target: i.leftShoulder
2750
- }), Y(t[B.RIGHT_SHOULDER], n, r, {
2774
+ }), Z(t[U.RIGHT_SHOULDER], n, r, {
2751
2775
  mirrorX: !0,
2752
2776
  sourceWidth: a.sourceWidth,
2753
2777
  sourceHeight: a.sourceHeight,
2754
2778
  target: i.rightShoulder
2755
- }), Y(t[B.LEFT_HIP], n, r, {
2779
+ }), Z(t[U.LEFT_HIP], n, r, {
2756
2780
  mirrorX: !0,
2757
2781
  sourceWidth: a.sourceWidth,
2758
2782
  sourceHeight: a.sourceHeight,
2759
2783
  target: i.leftHip
2760
- }), Y(t[B.RIGHT_HIP], n, r, {
2784
+ }), Z(t[U.RIGHT_HIP], n, r, {
2761
2785
  mirrorX: !0,
2762
2786
  sourceWidth: a.sourceWidth,
2763
2787
  sourceHeight: a.sourceHeight,
2764
2788
  target: i.rightHip
2765
2789
  }), i.shoulderCenter.copy(i.leftShoulder).add(i.rightShoulder).multiplyScalar(.5), i.hipCenter.copy(i.leftHip).add(i.rightHip).multiplyScalar(.5);
2766
- let o = Yi({
2790
+ let o = Wi({
2767
2791
  leftShoulder: i.rightShoulder,
2768
2792
  rightShoulder: i.leftShoulder,
2769
2793
  leftHip: i.rightHip,
2770
2794
  rightHip: i.leftHip
2771
- }, ma), s = o ? ba(o) : 0, c = Ca(a.bodyYaw, s);
2795
+ }, ua), s = o ? va(o) : 0, c = xa(a.bodyYaw, s);
2772
2796
  i.effectiveYaw = c;
2773
- let u = Ta(i.leftShoulder, i.rightShoulder), d = Ta(i.shoulderCenter, i.hipCenter), f = Ji({
2774
- projectedShoulderWidth: u,
2775
- projectedTorsoHeight: d,
2797
+ let l = Ca(i.leftShoulder, i.rightShoulder), u = Ca(i.shoulderCenter, i.hipCenter), d = Vi({
2798
+ projectedShoulderWidth: l,
2799
+ projectedTorsoHeight: u,
2776
2800
  bodyYaw: c,
2777
2801
  worldLandmarks: a.worldLandmarks
2778
- }), p = d / Math.max(e.referenceTorsoHeight, Q), m = wa(t, n, r, d, i, a), h = xa(m === null ? null : m / Math.max(e.trackingHeight, Q), i), g = h !== null && p > Q ? _a(h, p * pa, p * fa) : h, _ = Sa(_a(g === null ? p : p * .55 + g * .45, ea, ta) * (a.scaleMultiplier ?? 1), i, d), v = .1, y = e.referenceWidth / Math.max(e.referenceTorsoHeight, Q), b = d > Q ? f / d : y, x = _a(y > Q ? b / y : 1, 1 - v, 1 + v);
2779
- return i.smoothedXDeviation = l.MathUtils.lerp(i.smoothedXDeviation, x, .35), i.scale.set(_ * i.smoothedXDeviation * (a.scaleX ?? 1), _ * (a.scaleY ?? 1), _ * (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 * _, e.anchor.y * _, e.anchor.z * _), i.position.copy(i.smoothedAnchor).sub(i.scaledAnchor), i.position.z += a.depthOffset ?? 0, !0;
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;
2780
2804
  }
2781
- function ba(e) {
2782
- return $.set(0, 0, 1).applyQuaternion(e), $.y = 0, $.lengthSq() <= na ? 0 : ($.normalize(), Math.atan2($.x, $.z));
2805
+ function _a(e, t) {
2806
+ e.position.copy(t.position), e.scale.copy(t.scale);
2783
2807
  }
2784
- function xa(e, t) {
2785
- return e === null ? t.stabilizedBodyHeightScale === null ? (t.missingBodyHeightFrames = 0, null) : (t.missingBodyHeightFrames += 1, t.missingBodyHeightFrames > aa ? (t.stabilizedBodyHeightScale = null, null) : t.stabilizedBodyHeightScale) : (t.missingBodyHeightFrames = 0, t.stabilizedBodyHeightScale = t.stabilizedBodyHeightScale === null ? e : l.MathUtils.lerp(t.stabilizedBodyHeightScale, e, ia), t.stabilizedBodyHeightScale);
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));
2810
+ }
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);
2786
2813
  }
2787
- function Sa(e, t, n) {
2814
+ function ba(e, t, n) {
2788
2815
  if (!t.hasSmoothedGlobalScale) return t.smoothedGlobalScale = e, t.previousDepthProxy = n, t.scaleVelocity = 0, t.hasSmoothedGlobalScale = !0, e;
2789
2816
  let r = t.previousDepthProxy, i = 1;
2790
- r > da && n > da && (i = _a(n / r, 1 - ua, 1 + ua)), t.previousDepthProxy = n;
2817
+ r > sa && n > sa && (i = ma(n / r, 1 - oa, 1 + oa)), t.previousDepthProxy = n;
2791
2818
  let a = t.smoothedGlobalScale * i, o = a > 0 ? Math.abs(e - a) / a : 0;
2792
- t.scaleVelocity = l.MathUtils.lerp(t.scaleVelocity, o, la);
2793
- let s = _a(oa + t.scaleVelocity * ca, oa, sa);
2794
- return t.smoothedGlobalScale = l.MathUtils.lerp(a, e, s), t.smoothedGlobalScale;
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;
2795
2822
  }
2796
- function Ca(e, t) {
2823
+ function xa(e, t) {
2797
2824
  let n = e ?? 0;
2798
2825
  return Math.abs(n) >= Math.abs(t) ? n : t;
2799
2826
  }
2800
- function wa(e, t, n, r, i, a) {
2801
- let o = Ea(ha, e, t, n, i.bodyTop, a), s = Ea(ga, e, t, n, i.bodyBottom, a);
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);
2802
2829
  if (!o || !s) return null;
2803
- let c = Ta(i.bodyTop, i.bodyBottom);
2804
- return c <= r * ra ? null : c;
2830
+ let c = Ca(i.bodyTop, i.bodyBottom);
2831
+ return c <= r * $i ? null : c;
2805
2832
  }
2806
- function Ta(e, t) {
2833
+ function Ca(e, t) {
2807
2834
  let n = e.x - t.x, r = e.y - t.y;
2808
2835
  return Math.sqrt(n * n + r * r);
2809
2836
  }
2810
- function Ea(e, t, n, r, i, a) {
2811
- for (let o = 0; o < e.length; o += 1) if (Da(e[o], t, n, r, i, a)) return !0;
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;
2812
2839
  return !1;
2813
2840
  }
2814
- function Da(e, t, n, r, i, a) {
2841
+ function Ta(e, t, n, r, i, a) {
2815
2842
  if (typeof e == "number") {
2816
2843
  let o = t[e];
2817
- return !o || (o.visibility ?? 0) < .4 ? !1 : (Y(o, n, r, {
2844
+ return !o || (o.visibility ?? 0) < .4 ? !1 : (Z(o, n, r, {
2818
2845
  mirrorX: !0,
2819
2846
  sourceWidth: a.sourceWidth,
2820
2847
  sourceHeight: a.sourceHeight,
@@ -2823,13 +2850,13 @@ function Da(e, t, n, r, i, a) {
2823
2850
  }
2824
2851
  let o = t[e[0]], s = t[e[1]];
2825
2852
  if (!o || !s || (o.visibility ?? 0) < .4 || (s.visibility ?? 0) < .4) return !1;
2826
- Y(o, n, r, {
2853
+ Z(o, n, r, {
2827
2854
  mirrorX: !0,
2828
2855
  sourceWidth: a.sourceWidth,
2829
2856
  sourceHeight: a.sourceHeight,
2830
2857
  target: i
2831
2858
  });
2832
- let c = Y(s, n, r, {
2859
+ let c = Z(s, n, r, {
2833
2860
  mirrorX: !0,
2834
2861
  sourceWidth: a.sourceWidth,
2835
2862
  sourceHeight: a.sourceHeight
@@ -2838,89 +2865,89 @@ function Da(e, t, n, r, i, a) {
2838
2865
  }
2839
2866
  //#endregion
2840
2867
  //#region src/garment/trackedGarmentMotion.ts
2841
- var Oa = new l.Vector3(0, 1, 0), ka = new Set(["LeftHand", "RightHand"]), Aa = new Set([
2868
+ var Ea = new b.Vector3(0, 1, 0), Da = new Set(["LeftHand", "RightHand"]), Oa = new Set([
2842
2869
  "Hips",
2843
2870
  "Spine",
2844
2871
  "Chest"
2845
- ]), ja = 20, Ma = .436, Na = .175, Pa = 1.396, Fa = .349, Ia = .35;
2846
- function La(e, t, n) {
2872
+ ]), ka = 20, Aa = .436, ja = .175, Ma = 1.396, Na = .349, Pa = .35;
2873
+ function Fa(e, t, n) {
2847
2874
  return Math.max(t, Math.min(n, e));
2848
2875
  }
2849
- function Ra(e) {
2876
+ function Ia(e) {
2850
2877
  let t = e;
2851
2878
  for (; t <= -Math.PI;) t += Math.PI * 2;
2852
2879
  for (; t > Math.PI;) t -= Math.PI * 2;
2853
2880
  return t;
2854
2881
  }
2855
- function za(e, t, n) {
2856
- let r = Ra(t - e);
2857
- return Ra(Math.abs(r) <= n ? t : e + Math.sign(r) * n);
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);
2858
2885
  }
2859
- function Ba() {
2886
+ function Ra() {
2860
2887
  return {
2861
- transformScratch: va(),
2862
- facingDetector: new ki(),
2863
- yawFreezeController: new Mi(),
2888
+ transformScratch: ha(),
2889
+ facingDetector: new yi(),
2890
+ yawFreezeController: new Si(),
2864
2891
  displayYaw: null,
2865
2892
  lastFacingState: null,
2866
2893
  hasInitialPosition: !1
2867
2894
  };
2868
2895
  }
2869
- function Va(e) {
2870
- e.transformScratch = va(), e.facingDetector.reset(), e.yawFreezeController.reset(), e.displayYaw = null, e.lastFacingState = null, e.hasInitialPosition = !1;
2896
+ function za(e) {
2897
+ e.transformScratch = ha(), e.facingDetector.reset(), e.yawFreezeController.reset(), e.displayYaw = null, e.lastFacingState = null, e.hasInitialPosition = !1;
2871
2898
  }
2872
- function Ha({ 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 }) {
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 }) {
2873
2900
  if (!a || a.length < 33) return null;
2874
2901
  let f = i.transformScratch;
2875
- ya(e, a, s, c, f, {
2902
+ ga(e, a, s, c, f, {
2876
2903
  sourceWidth: l,
2877
2904
  sourceHeight: u,
2878
2905
  worldLandmarks: o
2879
2906
  });
2880
- let p = f.shoulderCenter.y - f.hipCenter.y, m = f.shoulderCenter.distanceTo(f.hipCenter), h = Math.acos(La(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 : za(i.displayYaw, y, ja * d), x = i.yawFreezeController.update(v.zone, y, b), S = x.isFrozen, C = S ? x.frozenYaw ?? b : b;
2881
- return i.displayYaw = C, i.lastFacingState = v, v.zone !== "back" && (S || (t.scale.copy(f.scale), i.hasInitialPosition ? t.position.lerp(f.position, Ia) : (t.position.copy(f.position), i.hasInitialPosition = !0)), t.quaternion.setFromAxisAngle(Oa, C)), v.zone === "front" && !S ? (ii(a, n, r, {
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, {
2882
2909
  coordinateSpace: "normalized",
2883
- excludeBones: ka
2884
- }), v.pitchClamped && oi(n, La((Math.abs(h) - Ma) / Na, 0, 1), d, Aa)) : v.zone === "side" && !S && (ii(a, n, r, {
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, {
2885
2912
  coordinateSpace: "normalized",
2886
- excludeBones: ka
2887
- }), oi(n, La((Math.abs(y) - Pa) / Fa, 0, 1), d)), v;
2913
+ excludeBones: Da
2914
+ }), Xr(n, Fa((Math.abs(y) - Ma) / Na, 0, 1), d)), v;
2888
2915
  }
2889
2916
  //#endregion
2890
2917
  //#region src/components/TrackedGarmentPoseDriver.tsx
2891
- function Ua({ garmentRootRef: e, boneBindingMap: t, fitProfile: n, landmarks: r, worldLandmarks: i, poseFrameWidth: o, poseFrameHeight: c }) {
2892
- let { viewport: l } = g(), u = ri(), d = s(Ba());
2893
- return a(() => {
2894
- let n = e.current, r = d.current;
2895
- return n && (n.position.set(0, 0, 0), n.scale.set(1, 1, 1), n.quaternion.identity()), ai(t, u), Va(r), () => {
2896
- ai(t, u), Va(r);
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());
2920
+ return n(() => {
2921
+ 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);
2897
2924
  };
2898
2925
  }, [
2899
2926
  t,
2900
- n,
2927
+ r,
2901
2928
  e,
2902
- u
2903
- ]), h((a, s) => {
2904
- let f = e.current;
2905
- !f || !n || Ha({
2906
- fitProfile: n,
2907
- garmentRoot: f,
2929
+ f
2930
+ ]), s((n, i) => {
2931
+ let s = e.current;
2932
+ !s || !r || Ba({
2933
+ fitProfile: r,
2934
+ garmentRoot: s,
2908
2935
  boneBindingMap: t,
2909
- poseRefs: u,
2910
- motionState: d.current,
2911
- landmarks: r,
2912
- worldLandmarks: i,
2913
- viewportWidth: l.width,
2914
- viewportHeight: l.height,
2915
- poseFrameWidth: o,
2916
- poseFrameHeight: c,
2917
- delta: s
2936
+ poseRefs: f,
2937
+ motionState: p.current,
2938
+ landmarks: a,
2939
+ worldLandmarks: o,
2940
+ viewportWidth: d.width,
2941
+ viewportHeight: d.height,
2942
+ poseFrameWidth: l,
2943
+ poseFrameHeight: u,
2944
+ delta: i
2918
2945
  });
2919
2946
  }), null;
2920
2947
  }
2921
2948
  //#endregion
2922
2949
  //#region src/components/EverTrackedGarment.tsx
2923
- function Wa(e) {
2950
+ function Ha(e) {
2924
2951
  return e ? e.map((e) => ({
2925
2952
  x: e.x,
2926
2953
  y: e.y,
@@ -2928,85 +2955,85 @@ function Wa(e) {
2928
2955
  visibility: typeof e.visibility == "number" ? e.visibility : 0
2929
2956
  })) : null;
2930
2957
  }
2931
- function Ga({ url: e, landmarks: t, worldLandmarks: n, poseFrameWidth: r, poseFrameHeight: i, debugMaterials: c = !1, onLoadStateChange: u }) {
2932
- let d = s(null), { scene: m, bones: h } = br({ url: e }), g = o(() => Wa(t), [t]), _ = o(() => Wa(n), [n]), v = o(() => (m.updateMatrixWorld(!0), rr(m, h, 1)), [h, m]);
2933
- return a(() => {
2934
- m.traverse((e) => {
2935
- if (e instanceof l.Mesh) {
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]);
2960
+ return n(() => {
2961
+ d.traverse((e) => {
2962
+ if (e instanceof b.Mesh) {
2936
2963
  if (e.name.startsWith("Collision")) {
2937
2964
  e.visible = !1;
2938
2965
  return;
2939
2966
  }
2940
2967
  e.visible = !0, (Array.isArray(e.material) ? e.material : [e.material]).forEach((e) => {
2941
- "opacity" in e && (c ? (e.transparent = !0, e.opacity = .34, e.depthWrite = !1, e.side = l.DoubleSide) : (e.transparent = !1, e.opacity = 1, e.depthWrite = !0, e.side = l.FrontSide), e.needsUpdate = !0);
2968
+ "opacity" in e && (c ? (e.transparent = !0, e.opacity = .34, e.depthWrite = !1, e.side = b.DoubleSide) : (e.transparent = !1, e.opacity = 1, e.depthWrite = !0, e.side = b.FrontSide), e.needsUpdate = !0);
2942
2969
  });
2943
2970
  }
2944
2971
  });
2945
- }, [m, c]), a(() => (u?.({
2972
+ }, [d, c]), n(() => (l?.({
2946
2973
  loaded: !0,
2947
2974
  error: null
2948
2975
  }), () => {
2949
- u?.({
2976
+ l?.({
2950
2977
  loaded: !1,
2951
2978
  error: null
2952
2979
  });
2953
- }), [u, e]), /* @__PURE__ */ p("group", {
2954
- ref: d,
2955
- children: [/* @__PURE__ */ f("primitive", { object: m }), /* @__PURE__ */ f(Ua, {
2956
- garmentRootRef: d,
2957
- boneBindingMap: h,
2958
- fitProfile: v,
2959
- landmarks: g,
2960
- worldLandmarks: _,
2961
- poseFrameWidth: r,
2962
- poseFrameHeight: i
2980
+ }), [l, e]), /* @__PURE__ */ g("group", {
2981
+ ref: u,
2982
+ children: [/* @__PURE__ */ h("primitive", { object: d }), /* @__PURE__ */ h(Va, {
2983
+ garmentRootRef: u,
2984
+ boneBindingMap: f,
2985
+ fitProfile: _,
2986
+ landmarks: p,
2987
+ worldLandmarks: m,
2988
+ poseFrameWidth: o,
2989
+ poseFrameHeight: s
2963
2990
  })]
2964
2991
  });
2965
2992
  }
2966
2993
  //#endregion
2967
2994
  //#region src/components/WebcamPlaneBackground.tsx
2968
- var Ka = 1;
2969
- function qa(e) {
2970
- let t = new l.VideoTexture(e);
2971
- return t.minFilter = l.NearestFilter, t.magFilter = l.NearestFilter, t.generateMipmaps = !1, t.colorSpace = l.SRGBColorSpace, t.needsUpdate = !0, t;
2995
+ var Wa = 1;
2996
+ function Ga(e) {
2997
+ let t = new b.VideoTexture(e);
2998
+ return t.minFilter = b.NearestFilter, t.magFilter = b.NearestFilter, t.generateMipmaps = !1, t.colorSpace = b.SRGBColorSpace, t.needsUpdate = !0, t;
2972
2999
  }
2973
- function Ja(e, t, n) {
3000
+ function Ka(e, t, n) {
2974
3001
  if (!n || n.width === 0 || n.height === 0) return [e, t];
2975
3002
  let r = e / t, i = n.width / n.height;
2976
3003
  return r > i ? [e, e / i] : [t * i, t];
2977
3004
  }
2978
- function Ya({ videoRef: e, webcamReady: t }) {
2979
- let { viewport: n } = g(), [r, i] = c(null), [l, u] = c(null), d = s(null), m = s(null), _ = s(0);
2980
- a(() => {
2981
- let n = e.current;
3005
+ function qa({ videoElement: e, webcamReady: t }) {
3006
+ let { viewport: o } = c(), [l, u] = a(null), [d, f] = a(null), p = i(null), m = i(null), _ = i(0);
3007
+ n(() => {
3008
+ let n = e;
2982
3009
  if (!t || !n) {
2983
3010
  m.current !== null && (clearTimeout(m.current), m.current = null), _.current = 0;
2984
3011
  return;
2985
3012
  }
2986
- let r = !1, a = () => {
2987
- if (r || d.current) return;
3013
+ let r = !1, i = () => {
3014
+ if (r || p.current) return;
2988
3015
  if (n.videoWidth === 0 || n.videoHeight === 0) {
2989
- m.current = setTimeout(a, 100);
3016
+ m.current = setTimeout(i, 100);
2990
3017
  return;
2991
3018
  }
2992
- let e = qa(n);
2993
- d.current = e, _.current = 0, u({
3019
+ let e = Ga(n);
3020
+ p.current = e, _.current = 0, f({
2994
3021
  width: n.videoWidth,
2995
3022
  height: n.videoHeight
2996
- }), i(e);
3023
+ }), u(e);
2997
3024
  };
2998
- return n.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && n.videoWidth > 0 && n.videoHeight > 0 ? a() : (n.addEventListener("loadeddata", a), n.addEventListener("loadedmetadata", a), n.addEventListener("playing", a), m.current = setTimeout(a, 200)), () => {
2999
- r = !0, m.current !== null && (clearTimeout(m.current), m.current = null), n.removeEventListener("loadeddata", a), n.removeEventListener("loadedmetadata", a), n.removeEventListener("playing", a), d.current &&= (d.current.dispose(), null), _.current = 0, i(null), u(null);
3025
+ return n.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && n.videoWidth > 0 && n.videoHeight > 0 ? i() : (n.addEventListener("loadeddata", i), n.addEventListener("loadedmetadata", i), n.addEventListener("playing", i), m.current = setTimeout(i, 200)), () => {
3026
+ 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);
3000
3027
  };
3001
- }, [e, t]), h(() => {
3002
- !d.current || !d.current.image || (_.current = (_.current + 1) % Ka, _.current === 0 && (d.current.needsUpdate = !0));
3028
+ }, [e, t]), s(() => {
3029
+ !p.current || !p.current.image || (_.current = (_.current + 1) % Wa, _.current === 0 && (p.current.needsUpdate = !0));
3003
3030
  });
3004
- let [v, y] = o(() => Ja(n.width, n.height, l), [
3005
- l,
3006
- n.height,
3007
- n.width
3031
+ let [v, y] = r(() => Ka(o.width, o.height, d), [
3032
+ d,
3033
+ o.height,
3034
+ o.width
3008
3035
  ]);
3009
- return !t || !r ? null : /* @__PURE__ */ p("mesh", {
3036
+ return !t || !l ? null : /* @__PURE__ */ g("mesh", {
3010
3037
  position: [
3011
3038
  0,
3012
3039
  0,
@@ -3018,8 +3045,8 @@ function Ya({ videoRef: e, webcamReady: t }) {
3018
3045
  1,
3019
3046
  1
3020
3047
  ],
3021
- children: [/* @__PURE__ */ f("planeGeometry", { args: [v, y] }), /* @__PURE__ */ f("meshBasicMaterial", {
3022
- map: r,
3048
+ children: [/* @__PURE__ */ h("planeGeometry", { args: [v, y] }), /* @__PURE__ */ h("meshBasicMaterial", {
3049
+ map: l,
3023
3050
  depthTest: !1,
3024
3051
  depthWrite: !1,
3025
3052
  toneMapped: !1
@@ -3028,58 +3055,126 @@ function Ya({ videoRef: e, webcamReady: t }) {
3028
3055
  }
3029
3056
  //#endregion
3030
3057
  //#region src/components/EverFittingScene.tsx
3031
- function Xa({ onReady: e }) {
3032
- return a(() => (e?.(!0), () => {
3058
+ function Ja({ onReady: e }) {
3059
+ return n(() => (e?.(!0), () => {
3033
3060
  e?.(!1);
3034
3061
  }), [e]), null;
3035
3062
  }
3036
- function Za() {
3037
- return /* @__PURE__ */ f("color", {
3063
+ function Ya() {
3064
+ return /* @__PURE__ */ h("color", {
3038
3065
  attach: "background",
3039
3066
  args: ["#000000"]
3040
3067
  });
3041
3068
  }
3042
- function Qa({ garmentUrl: e, enabled: t = !0, width: n = 1280, height: r = 720, facingMode: i = "user", mockMode: o = !1, viewportWidth: s = 0, viewportHeight: c = 0, measurementEnabled: l = !0, autoStartMeasurement: u = !1, measurementConfig: d, fitType: m = "regular", garmentScaleHint: h = null, bodyPresetOptions: g, className: _, style: v, debugMaterials: x = !1, showEnvironment: S = !1, showStats: C = !1, showWebcamBackground: w = !0, onCanvasReadyChange: T, onRuntimeStateChange: E, onGarmentLoadStateChange: D }) {
3043
- let O = Qn({
3044
- enabled: t,
3045
- width: n,
3046
- height: r,
3047
- facingMode: i,
3048
- mockMode: o,
3049
- viewportWidth: s,
3050
- viewportHeight: c,
3051
- measurementEnabled: l,
3052
- autoStartMeasurement: u,
3053
- measurementConfig: d,
3054
- bodyPresetOptions: g,
3055
- fitType: m,
3056
- garmentScaleHint: h
3057
- });
3058
- return a(() => {
3059
- E?.(O);
3060
- }, [O, E]), /* @__PURE__ */ p("div", {
3061
- className: _,
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({
3071
+ enabled: i,
3072
+ width: o,
3073
+ height: s,
3074
+ facingMode: c,
3075
+ 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
3119
+ }), [
3120
+ M,
3121
+ N,
3122
+ P,
3123
+ F,
3124
+ I,
3125
+ L,
3126
+ R,
3127
+ ee,
3128
+ te,
3129
+ ne,
3130
+ re,
3131
+ z,
3132
+ B,
3133
+ V,
3134
+ H,
3135
+ ie,
3136
+ ae,
3137
+ oe,
3138
+ se,
3139
+ ce,
3140
+ le,
3141
+ ue,
3142
+ de,
3143
+ fe,
3144
+ pe,
3145
+ me,
3146
+ he,
3147
+ ge,
3148
+ _e,
3149
+ ve,
3150
+ ye,
3151
+ be
3152
+ ]);
3153
+ return n(() => {
3154
+ A?.(we);
3155
+ }, [A, we]), /* @__PURE__ */ g("div", {
3156
+ className: S,
3062
3157
  style: {
3063
3158
  position: "relative",
3064
3159
  width: "100%",
3065
3160
  height: "100%",
3066
3161
  overflow: "hidden",
3067
- ...v
3162
+ ...C
3068
3163
  },
3069
- children: [/* @__PURE__ */ f("video", {
3070
- ref: O.videoRef,
3164
+ children: [/* @__PURE__ */ h("video", {
3165
+ ref: Ce,
3071
3166
  autoPlay: !0,
3072
3167
  playsInline: !0,
3073
3168
  muted: !0,
3074
3169
  style: { display: "none" }
3075
- }), /* @__PURE__ */ p(M, {
3076
- showEnvironment: S,
3170
+ }), /* @__PURE__ */ g(w, {
3171
+ showEnvironment: E,
3077
3172
  useDefaultLights: !1,
3078
3173
  enableOrbitControls: !1,
3079
3174
  children: [
3080
- /* @__PURE__ */ f(Xa, { onReady: T }),
3081
- /* @__PURE__ */ f(Za, {}),
3082
- /* @__PURE__ */ f(y, {
3175
+ /* @__PURE__ */ h(Ja, { onReady: k }),
3176
+ /* @__PURE__ */ h(Ya, {}),
3177
+ /* @__PURE__ */ h(d, {
3083
3178
  makeDefault: !0,
3084
3179
  position: [
3085
3180
  0,
@@ -3090,8 +3185,8 @@ function Qa({ garmentUrl: e, enabled: t = !0, width: n = 1280, height: r = 720,
3090
3185
  near: .1,
3091
3186
  far: 1e3
3092
3187
  }),
3093
- /* @__PURE__ */ f("ambientLight", { intensity: .95 }),
3094
- /* @__PURE__ */ f("directionalLight", {
3188
+ /* @__PURE__ */ h("ambientLight", { intensity: .95 }),
3189
+ /* @__PURE__ */ h("directionalLight", {
3095
3190
  position: [
3096
3191
  4,
3097
3192
  6,
@@ -3099,7 +3194,7 @@ function Qa({ garmentUrl: e, enabled: t = !0, width: n = 1280, height: r = 720,
3099
3194
  ],
3100
3195
  intensity: 1.15
3101
3196
  }),
3102
- /* @__PURE__ */ f("directionalLight", {
3197
+ /* @__PURE__ */ h("directionalLight", {
3103
3198
  position: [
3104
3199
  -5,
3105
3200
  4,
@@ -3107,217 +3202,92 @@ function Qa({ garmentUrl: e, enabled: t = !0, width: n = 1280, height: r = 720,
3107
3202
  ],
3108
3203
  intensity: .45
3109
3204
  }),
3110
- /* @__PURE__ */ f("hemisphereLight", { args: [
3205
+ /* @__PURE__ */ h("hemisphereLight", { args: [
3111
3206
  "#ffffff",
3112
3207
  "#7d8aa6",
3113
3208
  .35
3114
3209
  ] }),
3115
- w ? /* @__PURE__ */ f(Ya, {
3116
- videoRef: O.videoRef,
3117
- webcamReady: O.webcamReady
3210
+ O ? /* @__PURE__ */ h(qa, {
3211
+ videoElement: xe,
3212
+ webcamReady: N
3118
3213
  }) : null,
3119
- t && e ? /* @__PURE__ */ f(Ga, {
3214
+ i && e ? /* @__PURE__ */ h(Ua, {
3120
3215
  url: e,
3121
- landmarks: O.landmarks,
3122
- worldLandmarks: O.worldLandmarks,
3123
- poseFrameWidth: O.poseFrameWidth,
3124
- poseFrameHeight: O.poseFrameHeight,
3125
- debugMaterials: x,
3126
- onLoadStateChange: D
3216
+ landmarks: R,
3217
+ worldLandmarks: ee,
3218
+ poseFrameWidth: H,
3219
+ poseFrameHeight: ie,
3220
+ debugMaterials: T,
3221
+ onLoadStateChange: j
3127
3222
  }) : null,
3128
- C ? /* @__PURE__ */ f(b, {}) : null
3223
+ D ? /* @__PURE__ */ h(f, {}) : null
3129
3224
  ]
3130
3225
  })]
3131
3226
  });
3132
3227
  }
3133
3228
  //#endregion
3134
- //#region src/components/CameraView.tsx
3135
- var $a = ({ className: e, style: t, width: n = 1280, height: r = 720, facingMode: i = "user", enabled: o = !0, mockMode: s = !1 }) => {
3136
- let { videoRef: c } = A(), { isWebcamActive: l, setWebcamActive: u } = O(), { isReady: d } = Zn({
3137
- width: n,
3138
- height: r,
3139
- facingMode: i,
3140
- enabled: o,
3141
- mockMode: s,
3142
- videoRef: c,
3143
- onReadyChange: u
3144
- });
3145
- return a(() => {
3146
- !o && l && u(!1);
3147
- }, [
3148
- o,
3149
- l,
3150
- u
3151
- ]), /* @__PURE__ */ f("div", {
3152
- className: `camera-view-container ${e || ""}`,
3153
- style: {
3154
- position: "absolute",
3155
- inset: 0,
3156
- zIndex: 0,
3157
- ...t
3158
- },
3159
- children: /* @__PURE__ */ f("video", {
3160
- ref: c,
3161
- autoPlay: !0,
3162
- playsInline: !0,
3163
- muted: !0,
3164
- className: "w-full h-full object-cover",
3165
- style: { display: o && (d || l) ? "block" : "none" }
3166
- })
3167
- });
3168
- }, eo = ({ url: e, onBonesReady: t }) => e ? /* @__PURE__ */ f(no, {
3169
- url: e,
3170
- onBonesReady: t
3171
- }) : null;
3172
- function to(e) {
3173
- return "isBone" in e && e.isBone === !0;
3174
- }
3175
- var no = ({ url: e, onBonesReady: t }) => {
3176
- let { scene: n } = x(e), r = s(null), { setAvatarBones: i } = A();
3177
- return a(() => {
3178
- if (!n) return;
3179
- let e = {};
3180
- return n.traverse((t) => {
3181
- to(t) && (e[t.name] = t);
3182
- }), i(e), t && t(e), () => i(null);
3183
- }, [
3184
- n,
3185
- t,
3186
- i
3187
- ]), /* @__PURE__ */ f("group", {
3188
- ref: r,
3189
- dispose: null,
3190
- children: /* @__PURE__ */ f("primitive", { object: n })
3191
- });
3192
- }, ro = ({ url: e, targetAvatarBones: t }) => e ? /* @__PURE__ */ f(ao, {
3193
- url: e,
3194
- targetAvatarBones: t
3195
- }) : null;
3196
- function io(e) {
3197
- return "isSkinnedMesh" in e && e.isSkinnedMesh === !0;
3198
- }
3199
- var ao = ({ url: e, targetAvatarBones: t }) => {
3200
- let { scene: n } = x(e), r = s(null), { avatarBones: i } = A(), o = t || i;
3201
- return a(() => {
3202
- !n || !o || n.traverse((e) => {
3203
- if (io(e)) {
3204
- let t = e, n = [];
3205
- t.skeleton.bones.forEach((e) => {
3206
- o[e.name] ? n.push(o[e.name]) : n.push(e);
3207
- }), t.bind(new u(n), t.bindMatrix);
3208
- }
3209
- });
3210
- }, [n, o]), /* @__PURE__ */ f("group", {
3211
- ref: r,
3212
- dispose: null,
3213
- children: /* @__PURE__ */ f("primitive", { object: n })
3214
- });
3215
- }, oo = () => ({ mapPoseToBones: r((e, t) => {
3216
- if (!e || e.length === 0 || !t) return;
3217
- for (let n of [
3218
- "Hips",
3219
- "Spine",
3220
- "Chest",
3221
- "LeftUpperArm",
3222
- "LeftLowerArm",
3223
- "RightUpperArm",
3224
- "RightLowerArm",
3225
- "LeftUpperLeg",
3226
- "LeftLowerLeg",
3227
- "RightUpperLeg",
3228
- "RightLowerLeg"
3229
- ]) {
3230
- let r = t[n];
3231
- r && Zt(n, e, r.quaternion) && r.quaternion.normalize();
3232
- }
3233
- let n = e[B.LEFT_HIP], r = e[B.RIGHT_HIP], i = t.Hips;
3234
- i && n && r && i.position.set((n.x + r.x) * .5, -((n.y + r.y) * .5) + 1, ((n.z ?? 0) + (r.z ?? 0)) * .5);
3235
- }, []) }), so = (e) => {
3236
- let [t, n] = c(null), { landmarks: r, setFitResult: i } = O();
3237
- return a(() => {
3238
- let t = e?.referenceHeightCm ?? 170, a = e?.weightKg ?? null, o = e?.measurementIntervalMs ?? 1e3, s = setInterval(() => {
3239
- if (!r || r.length < 33) return;
3240
- let e = it(r, t, a), o = ot(e);
3241
- if (te(e), n({
3242
- shoulder: e.shoulderWidthCm,
3243
- chest: e.chestCircumferenceCm,
3244
- waist: e.waistCircumferenceCm
3245
- }), !o) {
3246
- i(null);
3247
- return;
3248
- }
3249
- i({
3250
- type: o.fitDescription === "slim" ? "slim" : o.fitDescription === "relaxed" ? "oversize" : "regular",
3251
- suitability: Math.round(o.confidence * 100)
3252
- });
3253
- }, o);
3254
- return () => clearInterval(s);
3255
- }, [
3256
- r,
3257
- i,
3258
- e
3259
- ]), { dimensions: t };
3260
- }, co = { gender: "female" };
3261
- function lo(e, t) {
3229
+ //#region src/hooks/useEverGeneration.ts
3230
+ var Za = { gender: "female" };
3231
+ function Qa(e, t) {
3262
3232
  return e instanceof Error && e.message ? e.message : t;
3263
3233
  }
3264
- function uo(e) {
3265
- let t = o(() => new Oe(e), [e]), [n, i] = c("idle"), [a, s] = c(null), [l, u] = c(null);
3234
+ function $a(e) {
3235
+ let n = r(() => new _e(e), [e]), [i, o] = a("idle"), [s, c] = a(null), [l, u] = a(null);
3266
3236
  return {
3267
- status: n,
3268
- resultUrl: a,
3237
+ status: i,
3238
+ resultUrl: s,
3269
3239
  error: l,
3270
- generateAvatar: r(async (e = co) => {
3271
- i("processing"), u(null);
3240
+ generateAvatar: t(async (e = Za) => {
3241
+ o("processing"), u(null);
3272
3242
  try {
3273
- let n = e instanceof Blob ? co : e, r = await t.matchBodyPreset(n);
3243
+ let t = e instanceof Blob ? Za : e, r = await n.matchBodyPreset(t);
3274
3244
  if (!r.model_url) throw Error("Matched body preset does not have a 3D model URL.");
3275
- return s(r.model_url), i("ready"), r.model_url;
3245
+ return c(r.model_url), o("ready"), r.model_url;
3276
3246
  } catch (e) {
3277
- throw u(lo(e, "Failed to load avatar model")), i("error"), e;
3247
+ throw u(Qa(e, "Failed to load avatar model")), o("error"), e;
3278
3248
  }
3279
- }, [t]),
3280
- createGarment: r(async (e, n, r, a) => {
3281
- i("uploading"), u(null);
3249
+ }, [n]),
3250
+ createGarment: t(async (e, t, r, i) => {
3251
+ o("uploading"), u(null);
3282
3252
  try {
3283
- let o = await t.createGarment(e);
3284
- await t.uploadGarmentImage(o.id, n, "front"), r && await t.uploadGarmentImage(o.id, r, "back"), i("processing"), await t.generateGarment3D(o.id, {
3285
- include_measurements: !!a,
3253
+ let a = await n.createGarment(e);
3254
+ await n.uploadGarmentImage(a.id, t, "front"), r && await n.uploadGarmentImage(a.id, r, "back"), o("processing"), await n.generateGarment3D(a.id, {
3255
+ include_measurements: !!i,
3286
3256
  target_fit_types: ["regular"]
3287
3257
  });
3288
- let c = await t.waitForGarmentModel(o.id), l = t.pickGarmentModelUrl(c);
3258
+ let s = await n.waitForGarmentModel(a.id), l = n.pickGarmentModelUrl(s);
3289
3259
  if (!l) throw Error("Backend did not return a garment 3D model URL.");
3290
- return s(l), i("ready"), l;
3260
+ return c(l), o("ready"), l;
3291
3261
  } catch (e) {
3292
- throw u(lo(e, "Failed to generate garment")), i("error"), e;
3262
+ throw u(Qa(e, "Failed to generate garment")), o("error"), e;
3293
3263
  }
3294
- }, [t]),
3264
+ }, [n]),
3295
3265
  reset: () => {
3296
- i("idle"), s(null), u(null);
3266
+ o("idle"), c(null), u(null);
3297
3267
  }
3298
3268
  };
3299
3269
  }
3300
3270
  //#endregion
3301
3271
  //#region src/garment/constants.ts
3302
- var fo = {
3303
- Hips: [B.LEFT_HIP, B.RIGHT_HIP],
3272
+ var eo = {
3273
+ Hips: [U.LEFT_HIP, U.RIGHT_HIP],
3304
3274
  Spine: [
3305
- B.LEFT_SHOULDER,
3306
- B.RIGHT_SHOULDER,
3307
- B.LEFT_HIP,
3308
- B.RIGHT_HIP
3275
+ U.LEFT_SHOULDER,
3276
+ U.RIGHT_SHOULDER,
3277
+ U.LEFT_HIP,
3278
+ U.RIGHT_HIP
3309
3279
  ],
3310
- Chest: [B.LEFT_SHOULDER, B.RIGHT_SHOULDER],
3311
- LeftShoulder: [B.LEFT_SHOULDER, B.LEFT_ELBOW],
3312
- LeftUpperArm: [B.LEFT_SHOULDER, B.LEFT_ELBOW],
3313
- LeftLowerArm: [B.LEFT_ELBOW, B.LEFT_WRIST],
3314
- RightShoulder: [B.RIGHT_SHOULDER, B.RIGHT_ELBOW],
3315
- RightUpperArm: [B.RIGHT_SHOULDER, B.RIGHT_ELBOW],
3316
- RightLowerArm: [B.RIGHT_ELBOW, B.RIGHT_WRIST],
3317
- LeftUpperLeg: [B.LEFT_HIP, B.LEFT_KNEE],
3318
- LeftLowerLeg: [B.LEFT_KNEE, B.LEFT_ANKLE],
3319
- RightUpperLeg: [B.RIGHT_HIP, B.RIGHT_KNEE],
3320
- RightLowerLeg: [B.RIGHT_KNEE, B.RIGHT_ANKLE]
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]
3321
3291
  };
3322
3292
  //#endregion
3323
- export { eo as AvatarModel, Er as BONE_MAPPING, fo as BONE_VISIBILITY_MAP, $a as CameraView, Te as DEFAULT_EVER_API_BASE_URL, je as DEFAULT_FEMALE_BODY_PRESET_ID, N as DEFAULT_GARMENT_SPEC, un as DEFAULT_LOCKED_PERSON_ID, Ae as DEFAULT_MALE_BODY_PRESET_ID, st as DEFAULT_MEASUREMENT_CONFIG, Et as DEFAULT_NUM_POSES, Ke as DEFAULT_SMOOTHING, M as EverCanvas, Oe as EverClient, k as EverContext, Qa as EverFittingScene, j as EverProvider, Ga as EverTrackedGarment, ki as FacingDetector, ro as GarmentModel, Dt as INTERPOLATION_ALPHA, B as LANDMARK, Me as LEGACY_RIGGED_BODY_PRESET_ID, _n as LandmarkSmoother, Ct as MEDIAPIPE_TASKS_VISION_VERSION, Ot as MODEL_ASSET_PATHS, Tt as POSE_DETECTION_INTERVAL, Wn as TRACKING_SNAPSHOT_HOLD_MS, Ua as TrackedGarmentPoseDriver, wt as WASM_FILES_URL, Ya as WebcamPlaneBackground, fi as YawDirectionStabilizer, Mi as YawFreezeController, ii as applyLandmarkPoseToGarment, oi as blendBonesToRest, Fe as buildBodyPresetAssetUrl, He as buildBodyPresetMatchRequest, kn as calcRectIoU, $n as captureBoneBinding, En as clampNormalizedRect, cn as closeSegmentationMasks, Ze as computeBmiCorrectionFactor, we as computeBodyFirstFitting, Yt as computeBoneDirectionFromLandmarks, Zt as computeBoneRotationFromLandmarks, dt as computeCoverRect, qi as computeFacingAwareShoulderWidth, rr as computeGarmentFitProfile, Yi as computeGarmentRootQuaternion, te as computeGarmentScale, Dn as computeLandmarkBoundsNormalized, Jt as computeLandmarkSegmentDirection, Xe as computeScale, Ji as computeStableShoulderWidth, ft as computeVisibleNormalizedRegion, lr as configureAvatarLoader, ur as createAvatarLoaderExtension, Be as createFallbackBodyPresetSelection, Kn as createHeldTrackingSnapshot, mr as createHumanoidBoneBindings, Bn as createIdleTrackingQuality, xt as createInitialPoseSnapshot, Hn as createInitialTrackingRuntimeState, jn as createPoseCandidates, kt as createPoseLandmarker, Ba as createTrackedGarmentMotionState, va as createTrackedModelTransformScratch, qn as createTrackingLostRuntimeState, Vn as createTrackingQuality, Un as createTrackingRuntimeState, vr as createVRMCompat, ye as deriveBodyMorphResult, Re as ensureBodyPresetModelUrl, On as expandNormalizedRect, Ei as extractFacingSignals, gt as extractSilhouetteWidths, Fn as filterCandidatesByVisibleRegion, cr as getAvatarAssetKind, Xt as getBoneLandmarkInfluence, kr as getBoneRotation, Ie as getDefaultBodyPresetId, sn as getSegmentationMaskData, Qt as hasLandmarkMapping, _t as interpolateLandmarks, yt as interpolatePoseRig, St as interpolatePoseSnapshot, bt as interpolateSilhouetteWidths, Pn as isCandidateInVisibleRegion, Di as isRawFrontFacing, sr as isVRMAssetUrl, Y as landmarkToThreePosition, K as lerpRotation, U as lerpValue, it as measureBody, Pe as normalizeBodyPresetGender, Or as normalizeBoneName, fn as normalizeLandmark, pn as normalizeLandmarks, ze as pickDefaultBodyPreset, dr as prepareAvatarScene, fr as prepareNativeVRM, ot as recommendSize, ir as resetBoneRotations, ai as resetPoseState, Va as resetTrackedGarmentMotionState, ln as scaleSilhouetteWidths, Nn as selectLockedPoseCandidate, Gn as shouldHoldTrackingSnapshot, yn as smoothPoseRig, on as solvePose, Ve as toBodyPresetSelection, Le as toBodyPresetSummary, In as toLockedPoseCandidate, Ha as updateTrackedGarmentMotion, ya as updateTrackedModelTransform, br as useAvatarVariant, so as useBodyMeasurer, Ge as useBodyPresetSelection, A as useEver, Qn as useEverFitting, uo as useEverGeneration, O as useEverStore, ut as useMeasurement, ri as usePoseApplicationRefs, oo as usePoseMapper, Yn as usePoseTracker, Zn as useWebcam };
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 };