@vincentt-xr/sdk 2.0.0-alpha.2 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/GROUNDING.md +67 -9
  2. package/dist/{DebuggerUI-Cq28c18s.js → DebuggerUI-DhKTXTY2.js} +1 -1
  3. package/dist/{DebuggerUI-B45_Gb9d.cjs → DebuggerUI-bnGHSSOb.cjs} +1 -1
  4. package/dist/{FaceMeshRenderer-6t8OsQhK.js → FaceMeshRenderer-B2i2NW71.js} +3 -3
  5. package/dist/{FaceMeshRenderer-lQLhYIW-.cjs → FaceMeshRenderer-BSOq1OnG.cjs} +1 -1
  6. package/dist/{FaceRetouch-CDrL0pXg.js → FaceRetouch-Bg-OBU4n.js} +30 -30
  7. package/dist/{FaceRetouch-DtNl8-4e.cjs → FaceRetouch-TZeBGIqW.cjs} +1 -1
  8. package/dist/components/MeshRenderer/index.d.ts +1 -0
  9. package/dist/components/ScreenImage/source.d.ts +3 -0
  10. package/dist/contexts-B2_NsTnk.js +660 -0
  11. package/dist/contexts-BgWfyxre.cjs +1 -0
  12. package/dist/debug-ui/media-source.cjs +1 -1
  13. package/dist/debug-ui/media-source.js +1 -1
  14. package/dist/debug-ui.cjs +3 -3
  15. package/dist/debug-ui.js +1246 -1205
  16. package/dist/entries/low-level.d.ts +5 -0
  17. package/dist/face-effects.cjs +1 -1
  18. package/dist/face-effects.js +4 -4
  19. package/dist/{getFaceInfo-hUKMLFcr.js → getFaceInfo-4DhcPZDJ.js} +1 -1
  20. package/dist/{getFaceInfo-CyPAKh3h.cjs → getFaceInfo-QOQ_dc-W.cjs} +1 -1
  21. package/dist/hooks/selectors.d.ts +2 -4
  22. package/dist/hooks/useXRModel.d.ts +5 -0
  23. package/dist/hooks/useXRSession/reason.d.ts +19 -0
  24. package/dist/hooks/useXRSession/store.d.ts +12 -4
  25. package/dist/index-72Wb15Ca.js +214 -0
  26. package/dist/{index-JygePOwo.js → index-BMeBJ0dV.js} +322 -299
  27. package/dist/index-C9yQVzAh.cjs +1 -0
  28. package/dist/index-CNGzE49z.cjs +17 -0
  29. package/dist/{index-Di70KWuY.js → index-Cj3fGDtZ.js} +844 -825
  30. package/dist/{index-BgQAX8rs.js → index-D1kj6uc-.js} +123 -120
  31. package/dist/{index-D4bLzBr6.cjs → index-Da7uycur.cjs} +1 -1
  32. package/dist/{index-DSpzjuqd.cjs → index-WPPnlFO1.cjs} +1 -1
  33. package/dist/index-ZaDEzDtR.cjs +1 -0
  34. package/dist/{index-UC0Ux38E.js → index-g250Tqme.js} +1 -1
  35. package/dist/{internal-DuMPpcbp.js → internal-34pb7djs.js} +3 -3
  36. package/dist/{internal-i2JkM85N.cjs → internal-Dtvo4WYo.cjs} +1 -1
  37. package/dist/internal.cjs +1 -1
  38. package/dist/internal.js +1 -1
  39. package/dist/low-level.cjs +1 -1
  40. package/dist/low-level.js +399 -490
  41. package/dist/main.cjs +1 -1
  42. package/dist/main.js +28 -28
  43. package/dist/{renderGroups-C9QJrAXu.js → renderGroups-CPWUX6z9.js} +1 -1
  44. package/dist/{renderGroups-Dvm1J4lW.cjs → renderGroups-jSUOY1Oq.cjs} +1 -1
  45. package/dist/{renderPasses-CjgG_6kQ.js → renderPasses-CLlYRdMk.js} +5 -5
  46. package/dist/{renderPasses-CT5iBwtg.cjs → renderPasses-KUJUSevp.cjs} +2 -2
  47. package/dist/scene-object.cjs +1 -1
  48. package/dist/scene-object.js +2 -2
  49. package/dist/{selectors-Dw3C-gSk.js → selectors-DLxL8Q66.js} +4 -4
  50. package/dist/{selectors-2QvO5RYY.cjs → selectors-S8g25ke9.cjs} +1 -1
  51. package/dist/{session-C1StwN0f.js → session-CbtvwiaD.js} +1 -1
  52. package/dist/{session-BChR4TgK.cjs → session-DP8AF7Rg.cjs} +1 -1
  53. package/dist/texture/animatedTexture.d.ts +2 -0
  54. package/dist/texture/gifReader.d.ts +17 -0
  55. package/dist/texture/gifTextureSource.d.ts +16 -0
  56. package/dist/tracking.cjs +1 -1
  57. package/dist/tracking.js +9 -9
  58. package/dist/{useFaceInfo-C-WfMlYp.cjs → useFaceInfo-BvZeUBsL.cjs} +1 -1
  59. package/dist/{useFaceInfo-CwsHZedC.js → useFaceInfo-C06EyScd.js} +3 -3
  60. package/dist/{useFaceResults-CkFc1egZ.js → useFaceResults-C1Ppc8rS.js} +1 -1
  61. package/dist/{useFaceResults-VcFdOUFV.cjs → useFaceResults-CCNiH7VZ.cjs} +1 -1
  62. package/docs/api/screen-image.mdx +27 -3
  63. package/docs/api/texture-sources.mdx +25 -6
  64. package/docs/texture-api-consumer.md +26 -0
  65. package/package.json +4 -3
  66. package/dist/contexts-BKvTIayr.cjs +0 -1
  67. package/dist/contexts-Bk5zz_VR.js +0 -214
  68. package/dist/index-82aENaRq.cjs +0 -1
  69. package/dist/index-CEc1CAmB.cjs +0 -1
  70. package/dist/index-CTHeBQOs.js +0 -178
  71. package/dist/index-DzEzkBIH.cjs +0 -17
package/dist/low-level.js CHANGED
@@ -1,26 +1,23 @@
1
- var ce = Object.defineProperty;
2
- var de = (e, t, r) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var X = (e, t, r) => de(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { u as ue, X as te } from "./index-JygePOwo.js";
5
- import { u as he } from "./index-BgQAX8rs.js";
6
- import { H as Ct, a as St } from "./index-BgQAX8rs.js";
7
- import { c as pe } from "./selectors-Dw3C-gSk.js";
8
- import { b as Et, a as It, e as Mt, u as Tt, d as Ft } from "./selectors-Dw3C-gSk.js";
9
- import { useEffect as F, useState as S, useRef as L, useCallback as fe, useLayoutEffect as me, useMemo as q, Children as ge, isValidElement as be } from "react";
10
- import { c as we } from "./getFaceInfo-hUKMLFcr.js";
11
- import { d as Lt, e as zt } from "./getFaceInfo-hUKMLFcr.js";
12
- import { jsx as g, jsxs as z, Fragment as P } from "react/jsx-runtime";
13
- import { PerspectiveCamera as xe } from "@react-three/drei";
14
- import { S as Dt, g as Vt, c as At, d as Bt, u as Wt } from "./index-CTHeBQOs.js";
15
- import { u as re } from "./useFaceResults-CkFc1egZ.js";
16
- import { h as Ht } from "./hasFullUnitUVBounds-BGvcFsQM.js";
17
- import { X as ve, a as ye, b as Ce } from "./contexts-Bk5zz_VR.js";
18
- import { c as $t, d as qt, u as Nt } from "./contexts-Bk5zz_VR.js";
19
- import * as V from "three";
20
- const W = ({
1
+ import { u as se, X as O } from "./index-BMeBJ0dV.js";
2
+ import { u as le } from "./index-D1kj6uc-.js";
3
+ import { H as dt, a as ut } from "./index-D1kj6uc-.js";
4
+ import { c as ce } from "./selectors-DLxL8Q66.js";
5
+ import { u as mt, b as ft, e as pt, a as gt, d as bt } from "./selectors-DLxL8Q66.js";
6
+ import { useEffect as M, useState as S, useRef as X, useCallback as de, useLayoutEffect as ue, useMemo as $, Children as he, isValidElement as me } from "react";
7
+ import { c as fe } from "./getFaceInfo-4DhcPZDJ.js";
8
+ import { d as xt, e as vt } from "./getFaceInfo-4DhcPZDJ.js";
9
+ import { jsx as g, jsxs as k, Fragment as W } from "react/jsx-runtime";
10
+ import { PerspectiveCamera as pe } from "@react-three/drei";
11
+ import { S as Ct, g as St, c as Rt, d as It, u as Et } from "./index-72Wb15Ca.js";
12
+ import { u as ee } from "./useFaceResults-C1Ppc8rS.js";
13
+ import { h as Ft } from "./hasFullUnitUVBounds-BGvcFsQM.js";
14
+ import { X as ge, a as be, b as we } from "./contexts-B2_NsTnk.js";
15
+ import { B as zt, M as Xt, h as kt, i as At, T as Lt, c as Vt, j as Dt, k as Bt, g as Wt, e as _t, f as Ht, r as Pt, t as $t, d as qt, u as Ut } from "./contexts-B2_NsTnk.js";
16
+ import * as L from "three";
17
+ const B = ({
21
18
  children: e,
22
19
  config: t,
23
- style: r
20
+ style: n
24
21
  }) => /* @__PURE__ */ g(
25
22
  "div",
26
23
  {
@@ -33,57 +30,57 @@ const W = ({
33
30
  pointerEvents: t.pointerEvents ?? "none",
34
31
  zIndex: t.zIndex,
35
32
  opacity: t.hidden ? 0 : 1,
36
- ...r
33
+ ...n
37
34
  },
38
35
  children: e
39
36
  }
40
- ), N = ({
37
+ ), q = ({
41
38
  canvas: e,
42
39
  layout: t,
43
- media: r,
44
- mirrored: n,
40
+ media: n,
41
+ mirrored: r,
45
42
  filter: o
46
43
  }) => {
47
44
  const i = Math.round(t.destination.width), a = Math.round(t.destination.height);
48
45
  e.width !== i && (e.width = i), e.height !== a && (e.height = a);
49
46
  const s = e.getContext("2d");
50
- s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, i, a), n && (s.translate(i, 0), s.scale(-1, 1)), o && (s.filter = o), s.drawImage(r, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), o && (s.filter = "none"), s.setTransform(1, 0, 0, 1, 0, 0));
51
- }, ne = ({
47
+ s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, i, a), r && (s.translate(i, 0), s.scale(-1, 1)), o && (s.filter = o), s.drawImage(n, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), o && (s.filter = "none"), s.setTransform(1, 0, 0, 1, 0, 0));
48
+ }, te = ({
52
49
  canvasRef: e,
53
50
  enabled: t = !0,
54
- fps: r = 30,
55
- imageRef: n,
51
+ fps: n = 30,
52
+ imageRef: r,
56
53
  layout: o,
57
54
  mirrored: i,
58
55
  sourceKind: a,
59
56
  videoRef: s
60
57
  }) => {
61
- F(() => {
58
+ M(() => {
62
59
  if (!t) {
63
60
  const b = e.current, f = b == null ? void 0 : b.getContext("2d");
64
61
  b && f && f.clearRect(0, 0, b.width, b.height);
65
62
  return;
66
63
  }
67
64
  let l = 0, c = 0;
68
- const d = r > 0 ? 1e3 / r : 0, h = (b) => {
65
+ const d = n > 0 ? 1e3 / n : 0, h = (b) => {
69
66
  if (l = requestAnimationFrame(h), d > 0 && b - c < d) return;
70
67
  c = b;
71
68
  const f = e.current;
72
69
  if (!f || !o) return;
73
70
  if (a === "image") {
74
- const m = n.current;
75
- if (!m || !m.complete || m.naturalWidth <= 0 || m.naturalHeight <= 0)
71
+ const p = r.current;
72
+ if (!p || !p.complete || p.naturalWidth <= 0 || p.naturalHeight <= 0)
76
73
  return;
77
- N({
74
+ q({
78
75
  canvas: f,
79
76
  layout: o,
80
- media: m,
77
+ media: p,
81
78
  mirrored: i
82
79
  });
83
80
  return;
84
81
  }
85
82
  const w = s.current;
86
- !w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 || N({
83
+ !w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 || q({
87
84
  canvas: f,
88
85
  layout: o,
89
86
  media: w,
@@ -93,23 +90,23 @@ const W = ({
93
90
  return l = requestAnimationFrame(h), () => {
94
91
  cancelAnimationFrame(l);
95
92
  };
96
- }, [e, t, r, n, o, i, a, s]);
97
- }, Se = ({
93
+ }, [e, t, n, r, o, i, a, s]);
94
+ }, xe = ({
98
95
  canvasRef: e,
99
96
  imageRef: t,
100
- layer: r,
101
- layout: n,
97
+ layer: n,
98
+ layout: r,
102
99
  mirrored: o,
103
100
  sourceKind: i,
104
101
  videoRef: a
105
- }) => (ne({
102
+ }) => (te({
106
103
  canvasRef: e,
107
104
  imageRef: t,
108
- layout: n,
105
+ layout: r,
109
106
  mirrored: o,
110
107
  sourceKind: i,
111
108
  videoRef: a
112
- }), /* @__PURE__ */ g(W, { config: r, children: /* @__PURE__ */ g(
109
+ }), /* @__PURE__ */ g(B, { config: n, children: /* @__PURE__ */ g(
113
110
  "canvas",
114
111
  {
115
112
  ref: e,
@@ -122,11 +119,11 @@ const W = ({
122
119
  background: "#000"
123
120
  }
124
121
  }
125
- ) })), lt = ({
122
+ ) })), tt = ({
126
123
  canvasRef: e,
127
124
  controlInsetTop: t,
128
- debugVisible: r,
129
- fps: n = 15,
125
+ debugVisible: n,
126
+ fps: r = 15,
130
127
  imageRef: o,
131
128
  layer: i,
132
129
  layout: a,
@@ -135,10 +132,10 @@ const W = ({
135
132
  videoRef: c,
136
133
  viewportSize: d
137
134
  }) => {
138
- ne({
135
+ te({
139
136
  canvasRef: e,
140
- enabled: r,
141
- fps: n,
137
+ enabled: n,
138
+ fps: r,
142
139
  imageRef: o,
143
140
  layout: a,
144
141
  mirrored: s,
@@ -146,7 +143,7 @@ const W = ({
146
143
  videoRef: c
147
144
  });
148
145
  const h = Math.min(220, Math.max(120, d.width * 0.22)), b = d.width > 0 && d.height > 0 ? d.width / d.height : 1, f = Math.min(d.height - 24, Math.max(t ?? 16, 16));
149
- return /* @__PURE__ */ g(W, { config: i, children: /* @__PURE__ */ g(
146
+ return /* @__PURE__ */ g(B, { config: i, children: /* @__PURE__ */ g(
150
147
  "canvas",
151
148
  {
152
149
  ref: e,
@@ -154,52 +151,52 @@ const W = ({
154
151
  position: "absolute",
155
152
  left: 16,
156
153
  top: f,
157
- width: r ? h : 1,
158
- height: r ? "auto" : 1,
154
+ width: n ? h : 1,
155
+ height: n ? "auto" : 1,
159
156
  aspectRatio: `${b}`,
160
- opacity: r ? 0.85 : 0,
157
+ opacity: n ? 0.85 : 0,
161
158
  borderRadius: 10,
162
- border: r ? "1px solid rgba(255,255,255,0.16)" : "none",
159
+ border: n ? "1px solid rgba(255,255,255,0.16)" : "none",
163
160
  pointerEvents: "none",
164
161
  objectFit: "contain",
165
162
  background: "#000"
166
163
  }
167
164
  }
168
165
  ) });
169
- }, Re = {
166
+ }, ve = {
170
167
  audio: !1,
171
168
  video: {
172
169
  facingMode: "user",
173
170
  frameRate: { ideal: 30, max: 60 }
174
171
  }
175
- }, Ee = {
172
+ }, ye = {
176
173
  name: "viewport-live",
177
174
  clearColor: "#000000",
178
175
  pointerEvents: "none",
179
176
  zIndex: 0
180
- }, Ie = {
177
+ }, Ce = {
181
178
  name: "viewport-ui",
182
179
  clearColor: "transparent",
183
180
  pointerEvents: "auto",
184
181
  zIndex: 5
185
- }, Me = {
182
+ }, Se = {
186
183
  name: "viewport-scene",
187
184
  clearColor: "transparent",
188
185
  pointerEvents: "auto",
189
186
  zIndex: 1
190
- }, D = {
187
+ }, A = {
191
188
  webcam: { icon: "◉", label: "Webcam" },
192
189
  image: { icon: "▣", label: "Images" },
193
190
  video: { icon: "▶", label: "Videos" }
194
- }, Te = ({
191
+ }, Re = ({
195
192
  imageRef: e,
196
193
  selectedSource: t,
197
- videoRef: r
198
- }) => /* @__PURE__ */ z(P, { children: [
194
+ videoRef: n
195
+ }) => /* @__PURE__ */ k(W, { children: [
199
196
  /* @__PURE__ */ g(
200
197
  "video",
201
198
  {
202
- ref: r,
199
+ ref: n,
203
200
  style: {
204
201
  position: "absolute",
205
202
  width: 1,
@@ -223,11 +220,11 @@ const W = ({
223
220
  }
224
221
  }
225
222
  )
226
- ] }), J = ({
223
+ ] }), Y = ({
227
224
  dock: e,
228
225
  label: t,
229
- onChange: r,
230
- options: n,
226
+ onChange: n,
227
+ options: r,
231
228
  value: o
232
229
  }) => /* @__PURE__ */ g(
233
230
  "div",
@@ -246,7 +243,7 @@ const W = ({
246
243
  boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
247
244
  backdropFilter: "blur(10px)"
248
245
  },
249
- children: /* @__PURE__ */ z(
246
+ children: /* @__PURE__ */ k(
250
247
  "label",
251
248
  {
252
249
  style: {
@@ -262,7 +259,7 @@ const W = ({
262
259
  "select",
263
260
  {
264
261
  value: o,
265
- onChange: (i) => r(i.target.value),
262
+ onChange: (i) => n(i.target.value),
266
263
  style: {
267
264
  minWidth: 180,
268
265
  maxWidth: "calc(100vw - 52px)",
@@ -273,18 +270,18 @@ const W = ({
273
270
  color: "#e5eefb",
274
271
  padding: "0 10px"
275
272
  },
276
- children: n.map((i) => /* @__PURE__ */ g("option", { value: i.id, style: { color: "#111827" }, children: i.label }, i.id))
273
+ children: r.map((i) => /* @__PURE__ */ g("option", { value: i.id, style: { color: "#111827" }, children: i.label }, i.id))
277
274
  }
278
275
  )
279
276
  ]
280
277
  }
281
278
  )
282
279
  }
283
- ), Fe = ({
280
+ ), Ie = ({
284
281
  dock: e,
285
282
  imageOptions: t,
286
- selectedImageId: r,
287
- selectedSource: n,
283
+ selectedImageId: n,
284
+ selectedSource: r,
288
285
  selectedVideoId: o,
289
286
  setSelectedImageId: i,
290
287
  setSelectedSource: a,
@@ -318,8 +315,8 @@ const W = ({
318
315
  },
319
316
  children: "≡"
320
317
  }
321
- ) : /* @__PURE__ */ z(P, { children: [
322
- /* @__PURE__ */ z(
318
+ ) : /* @__PURE__ */ k(W, { children: [
319
+ /* @__PURE__ */ k(
323
320
  "div",
324
321
  {
325
322
  style: {
@@ -350,14 +347,14 @@ const W = ({
350
347
  overflowX: "auto"
351
348
  },
352
349
  children: b.map((f) => {
353
- const w = f === n;
354
- return /* @__PURE__ */ z(
350
+ const w = f === r;
351
+ return /* @__PURE__ */ k(
355
352
  "button",
356
353
  {
357
354
  type: "button",
358
355
  onClick: () => a(f),
359
356
  "aria-pressed": w,
360
- title: D[f].label,
357
+ title: A[f].label,
361
358
  style: {
362
359
  border: "none",
363
360
  borderRadius: 999,
@@ -374,8 +371,8 @@ const W = ({
374
371
  flex: "0 0 auto"
375
372
  },
376
373
  children: [
377
- /* @__PURE__ */ g("span", { style: { fontSize: 14, lineHeight: 1 }, children: D[f].icon }),
378
- /* @__PURE__ */ g("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: D[f].label })
374
+ /* @__PURE__ */ g("span", { style: { fontSize: 14, lineHeight: 1 }, children: A[f].icon }),
375
+ /* @__PURE__ */ g("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: A[f].label })
379
376
  ]
380
377
  },
381
378
  f
@@ -408,18 +405,18 @@ const W = ({
408
405
  ]
409
406
  }
410
407
  ),
411
- n === "image" && t.length > 0 && /* @__PURE__ */ g(
412
- J,
408
+ r === "image" && t.length > 0 && /* @__PURE__ */ g(
409
+ Y,
413
410
  {
414
411
  dock: e,
415
412
  label: "Image Asset",
416
413
  options: t,
417
- value: r,
414
+ value: n,
418
415
  onChange: i
419
416
  }
420
417
  ),
421
- n === "video" && c.length > 0 && /* @__PURE__ */ g(
422
- J,
418
+ r === "video" && c.length > 0 && /* @__PURE__ */ g(
419
+ Y,
423
420
  {
424
421
  dock: e,
425
422
  label: "Video Asset",
@@ -429,11 +426,11 @@ const W = ({
429
426
  }
430
427
  )
431
428
  ] }) : null;
432
- }, ke = ({
429
+ }, Ee = ({
433
430
  containerRef: e,
434
431
  displayCanvasRef: t,
435
- imageOptions: r,
436
- imageRef: n,
432
+ imageOptions: n,
433
+ imageRef: r,
437
434
  layout: o,
438
435
  managesOwnMedia: i,
439
436
  mediaDock: a,
@@ -445,16 +442,16 @@ const W = ({
445
442
  selectedSource: b,
446
443
  selectedVideoId: f,
447
444
  setSceneRenderOutputs: w,
448
- setSelectedImageId: m,
449
- setSelectedSource: p,
445
+ setSelectedImageId: p,
446
+ setSelectedSource: m,
450
447
  setSelectedVideoId: y,
451
- showMediaControls: T,
448
+ showMediaControls: F,
452
449
  style: R,
453
450
  videoOptions: v,
454
- videoRef: E,
451
+ videoRef: I,
455
452
  viewportSize: x,
456
453
  mirrored: u
457
- }) => /* @__PURE__ */ z(
454
+ }) => /* @__PURE__ */ k(
458
455
  "div",
459
456
  {
460
457
  ref: e,
@@ -466,21 +463,21 @@ const W = ({
466
463
  ...R
467
464
  },
468
465
  children: [
469
- /* @__PURE__ */ g(Te, { imageRef: n, selectedSource: b, videoRef: E }),
466
+ /* @__PURE__ */ g(Re, { imageRef: r, selectedSource: b, videoRef: I }),
470
467
  s === "dom" && i && /* @__PURE__ */ g(
471
- Se,
468
+ xe,
472
469
  {
473
470
  canvasRef: t,
474
- imageRef: n,
475
- videoRef: E,
476
- layer: Ee,
471
+ imageRef: r,
472
+ videoRef: I,
473
+ layer: ye,
477
474
  layout: o,
478
475
  mirrored: u,
479
476
  sourceKind: b === "image" ? "image" : "video"
480
477
  }
481
478
  ),
482
- (s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(W, { config: Me, children: /* @__PURE__ */ g(
483
- ve,
479
+ (s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(B, { config: Se, children: /* @__PURE__ */ g(
480
+ ge,
484
481
  {
485
482
  onRenderOutputs: w,
486
483
  renderOutputs: {
@@ -492,19 +489,19 @@ const W = ({
492
489
  children: d
493
490
  }
494
491
  ) }),
495
- /* @__PURE__ */ z(W, { config: Ie, children: [
492
+ /* @__PURE__ */ k(B, { config: Ce, children: [
496
493
  i && /* @__PURE__ */ g(
497
- Fe,
494
+ Ie,
498
495
  {
499
496
  dock: a,
500
- imageOptions: r,
497
+ imageOptions: n,
501
498
  selectedImageId: h,
502
499
  selectedSource: b,
503
500
  selectedVideoId: f,
504
- setSelectedImageId: m,
505
- setSelectedSource: p,
501
+ setSelectedImageId: p,
502
+ setSelectedSource: m,
506
503
  setSelectedVideoId: y,
507
- showMediaControls: T,
504
+ showMediaControls: F,
508
505
  videoOptions: v
509
506
  }
510
507
  ),
@@ -512,46 +509,46 @@ const W = ({
512
509
  ] })
513
510
  ]
514
511
  }
515
- ), Le = 5, ze = 1, Xe = (e, t) => t, De = "brightness(2.2) contrast(1.5) saturate(1.25)", Ve = ({
512
+ ), Te = 5, Fe = 1, Me = (e, t) => t, ze = "brightness(2.2) contrast(1.5) saturate(1.25)", Xe = ({
516
513
  enabled: e,
517
514
  displayMirrored: t,
518
- imageRef: r,
519
- layout: n,
515
+ imageRef: n,
516
+ layout: r,
520
517
  mode: o,
521
518
  numFaces: i,
522
519
  selectedSource: a,
523
520
  sourceStream: s,
524
521
  videoRef: l
525
522
  }) => {
526
- const { session: c } = ue(), d = L(null), h = L(!1), b = L(document.createElement("canvas")), {
523
+ const { session: c } = se(), d = X(null), h = X(!1), b = X(document.createElement("canvas")), {
527
524
  ready: f,
528
525
  node: w,
529
- error: m
530
- } = he(te.FACE_TRACKER, {
531
- numFaces: i ?? (o === "head-binding" ? ze : Le)
532
- }), [p, y] = S("idle"), [T, R] = S(null), v = e && f && !!w, E = re({
526
+ error: p
527
+ } = le(O.FACE_TRACKER, {
528
+ numFaces: i ?? (o === "head-binding" ? Fe : Te)
529
+ }), [m, y] = S("idle"), [F, R] = S(null), v = e && f && !!w, I = ee({
533
530
  node: v ? w : null,
534
531
  enabled: v,
535
532
  selectedSource: a,
536
- onFrame: fe(() => {
533
+ onFrame: de(() => {
537
534
  R(null), y("ready");
538
535
  }, [])
539
536
  });
540
- return F(() => {
541
- if (!e || !n) return;
537
+ return M(() => {
538
+ if (!e || !r) return;
542
539
  const x = () => {
543
- const C = a === "image" ? r.current : l.current;
540
+ const C = a === "image" ? n.current : l.current;
544
541
  if (C) {
545
542
  if (C instanceof HTMLImageElement) {
546
543
  if (!C.complete || C.naturalWidth <= 0 || C.naturalHeight <= 0) return;
547
544
  } else if (C.readyState < 2 || C.videoWidth <= 0 || C.videoHeight <= 0)
548
545
  return;
549
- N({
546
+ q({
550
547
  canvas: b.current,
551
- layout: n,
548
+ layout: r,
552
549
  media: C,
553
550
  mirrored: t,
554
- filter: a === "webcam" ? De : void 0
551
+ filter: a === "webcam" ? ze : void 0
555
552
  });
556
553
  }
557
554
  };
@@ -560,22 +557,22 @@ const W = ({
560
557
  return;
561
558
  }
562
559
  let u = 0;
563
- const I = () => {
564
- u = requestAnimationFrame(I), x();
560
+ const E = () => {
561
+ u = requestAnimationFrame(E), x();
565
562
  };
566
- return u = requestAnimationFrame(I), () => cancelAnimationFrame(u);
567
- }, [t, e, r, n, a, l]), F(() => {
568
- var A;
563
+ return u = requestAnimationFrame(E), () => cancelAnimationFrame(u);
564
+ }, [t, e, n, r, a, l]), M(() => {
565
+ var V;
569
566
  if (!e) {
570
567
  y("idle"), R(null), h.current = !1, d.current = null;
571
568
  return;
572
569
  }
573
- if (!n) {
570
+ if (!r) {
574
571
  y("initializing");
575
572
  return;
576
573
  }
577
- const x = (s == null ? void 0 : s.id) ?? (((A = l.current) == null ? void 0 : A.srcObject) instanceof MediaStream ? l.current.srcObject.id : "none"), I = a === "webcam" ? `webcam:${x}` : a;
578
- d.current !== I && (h.current = !1, d.current = I);
574
+ const x = (s == null ? void 0 : s.id) ?? (((V = l.current) == null ? void 0 : V.srcObject) instanceof MediaStream ? l.current.srcObject.id : "none"), E = a === "webcam" ? `webcam:${x}` : a;
575
+ d.current !== E && (h.current = !1, d.current = E);
579
576
  let C = !1;
580
577
  return (async () => {
581
578
  try {
@@ -584,44 +581,44 @@ const W = ({
584
581
  sourceKind: a
585
582
  }), await c.start(), h.current = !0), C) return;
586
583
  R(null), y("initializing");
587
- } catch (k) {
584
+ } catch (z) {
588
585
  if (C) return;
589
- y("error"), R(k instanceof Error ? k.message : "Failed to initialize SDK face tracking");
586
+ y("error"), R(z instanceof Error ? z.message : "Failed to initialize SDK face tracking");
590
587
  }
591
588
  })(), () => {
592
589
  C = !0;
593
590
  };
594
- }, [e, n, a, c, s, l]), F(() => {
595
- !v && e && !m && y("initializing");
596
- }, [v, e, m]), F(() => {
597
- m && (y("error"), R(m.message));
598
- }, [m]), F(() => () => {
591
+ }, [e, r, a, c, s, l]), M(() => {
592
+ !v && e && !p && y("initializing");
593
+ }, [v, e, p]), M(() => {
594
+ p && (y("error"), R(p.message));
595
+ }, [p]), M(() => () => {
599
596
  h.current = !1, c.stop();
600
597
  }, [c]), {
601
598
  activeDelegate: "GPU",
602
- faces: E,
603
- status: p,
604
- error: T
599
+ faces: I,
600
+ status: m,
601
+ error: F
605
602
  };
606
- }, Ae = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, Be = ({
603
+ }, ke = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, Ae = ({
607
604
  imageOptions: e,
608
605
  initialImageId: t,
609
- initialSource: r,
610
- initialVideoId: n,
606
+ initialSource: n,
607
+ initialVideoId: r,
611
608
  source: o,
612
609
  videoOptions: i
613
610
  }) => {
614
611
  var l, c, d, h;
615
- const a = (o == null ? void 0 : o.kind) ?? r ?? "webcam";
612
+ const a = (o == null ? void 0 : o.kind) ?? n ?? "webcam";
616
613
  return {
617
614
  selectedSource: a === "image" && e.length === 0 || a === "video" && i.length === 0 ? "webcam" : a,
618
615
  selectedImageId: (o == null ? void 0 : o.kind) === "image" ? o.assetId ?? ((l = e[0]) == null ? void 0 : l.id) ?? "" : t ?? ((c = e[0]) == null ? void 0 : c.id) ?? "",
619
- selectedVideoId: (o == null ? void 0 : o.kind) === "video" ? o.assetId ?? ((d = i[0]) == null ? void 0 : d.id) ?? "" : n ?? ((h = i[0]) == null ? void 0 : h.id) ?? ""
616
+ selectedVideoId: (o == null ? void 0 : o.kind) === "video" ? o.assetId ?? ((d = i[0]) == null ? void 0 : d.id) ?? "" : r ?? ((h = i[0]) == null ? void 0 : h.id) ?? ""
620
617
  };
621
- }, We = (e, t, r) => {
618
+ }, Le = (e, t, n) => {
622
619
  if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
623
620
  return null;
624
- const n = r === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), o = e.width * n, i = e.height * n;
621
+ const r = n === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), o = e.width * r, i = e.height * r;
625
622
  return {
626
623
  source: e,
627
624
  destination: t,
@@ -629,24 +626,24 @@ const W = ({
629
626
  drawHeight: i,
630
627
  offsetX: (t.width - o) * 0.5,
631
628
  offsetY: (t.height - i) * 0.5,
632
- scale: n
629
+ scale: r
633
630
  };
634
- }, Pe = (e) => {
631
+ }, Ve = (e) => {
635
632
  if (!e) return { width: 0, height: 0 };
636
633
  const t = e.getBoundingClientRect();
637
634
  return {
638
635
  width: t.width || e.clientWidth,
639
636
  height: t.height || e.clientHeight
640
637
  };
641
- }, He = (e) => {
642
- const [t, r] = S({ width: 0, height: 0 });
643
- return me(() => {
644
- const n = e.current;
645
- if (!n) return;
638
+ }, De = (e) => {
639
+ const [t, n] = S({ width: 0, height: 0 });
640
+ return ue(() => {
641
+ const r = e.current;
642
+ if (!r) return;
646
643
  let o = 0;
647
644
  const i = () => {
648
- const c = Pe(n);
649
- r(
645
+ const c = Ve(r);
646
+ n(
650
647
  (d) => d.width === c.width && d.height === c.height ? d : c
651
648
  );
652
649
  }, a = () => {
@@ -654,84 +651,84 @@ const W = ({
654
651
  };
655
652
  a();
656
653
  const s = new ResizeObserver(a);
657
- s.observe(n);
654
+ s.observe(r);
658
655
  const l = window.visualViewport;
659
656
  return window.addEventListener("resize", a), window.addEventListener("orientationchange", a), l == null || l.addEventListener("resize", a), l == null || l.addEventListener("scroll", a), () => {
660
657
  o && cancelAnimationFrame(o), s.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("orientationchange", a), l == null || l.removeEventListener("resize", a), l == null || l.removeEventListener("scroll", a);
661
658
  };
662
659
  }, [e]), t;
663
- }, _e = ({
660
+ }, Be = ({
664
661
  enabled: e,
665
662
  selectedSource: t
666
663
  }) => {
667
- const r = pe(te.FACE_TRACKER);
664
+ const n = ce(O.FACE_TRACKER);
668
665
  return {
669
- faces: re({ node: r, enabled: e, selectedSource: t }),
670
- trackerStatus: r ? "ready" : "idle"
666
+ faces: ee({ node: n, enabled: e, selectedSource: t }),
667
+ trackerStatus: n ? "ready" : "idle"
671
668
  };
672
- }, O = (e) => {
669
+ }, J = (e) => {
673
670
  e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
674
671
  }, Q = (e) => {
675
672
  e && e.removeAttribute("src");
676
- }, $e = ({
673
+ }, We = ({
677
674
  enabled: e,
678
675
  imageAsset: t,
679
- selectedSource: r,
680
- videoAsset: n
676
+ selectedSource: n,
677
+ videoAsset: r
681
678
  }) => {
682
- const o = L(null), i = L(null), [a, s] = S(null), [l, c] = S({ width: 0, height: 0 }), [d, h] = S("idle"), [b, f] = S(null);
683
- return F(() => {
679
+ const o = X(null), i = X(null), [a, s] = S(null), [l, c] = S({ width: 0, height: 0 }), [d, h] = S("idle"), [b, f] = S(null);
680
+ return M(() => {
684
681
  if (!e) {
685
- O(o.current), Q(i.current), s(null), c({ width: 0, height: 0 }), h("idle"), f(null);
682
+ J(o.current), Q(i.current), s(null), c({ width: 0, height: 0 }), h("idle"), f(null);
686
683
  return;
687
684
  }
688
- let w = !1, m = null;
689
- const p = (x, u) => {
685
+ let w = !1, p = null;
686
+ const m = (x, u) => {
690
687
  w || (c({ width: x, height: u }), h("ready"), f(null));
691
688
  }, y = () => {
692
- O(o.current), Q(i.current), m == null || m.getTracks().forEach((x) => x.stop()), m = null, s(null);
693
- }, T = async () => {
689
+ J(o.current), Q(i.current), p == null || p.getTracks().forEach((x) => x.stop()), p = null, s(null);
690
+ }, F = async () => {
694
691
  h("requesting");
695
- const x = await navigator.mediaDevices.getUserMedia(Re);
692
+ const x = await navigator.mediaDevices.getUserMedia(ve);
696
693
  if (w) {
697
- x.getTracks().forEach((I) => I.stop());
694
+ x.getTracks().forEach((E) => E.stop());
698
695
  return;
699
696
  }
700
- m = x, s(x);
697
+ p = x, s(x);
701
698
  const u = o.current;
702
- u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(), p(u.videoWidth, u.videoHeight));
699
+ u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(), m(u.videoWidth, u.videoHeight));
703
700
  }, R = async (x) => {
704
701
  h("requesting"), s(null);
705
702
  const u = o.current;
706
- u && (u.src = x, u.muted = !0, u.loop = !0, u.playsInline = !0, u.autoplay = !0, u.crossOrigin = "anonymous", await u.play(), p(u.videoWidth, u.videoHeight));
703
+ u && (u.src = x, u.muted = !0, u.loop = !0, u.playsInline = !0, u.autoplay = !0, u.crossOrigin = "anonymous", await u.play(), m(u.videoWidth, u.videoHeight));
707
704
  }, v = async (x) => {
708
705
  h("requesting"), s(null);
709
706
  const u = i.current;
710
- u && (await new Promise((I, C) => {
711
- u.onload = () => I(), u.onerror = () => C(new Error("Unable to load image")), u.src = x;
712
- }), p(u.naturalWidth, u.naturalHeight));
707
+ u && (await new Promise((E, C) => {
708
+ u.onload = () => E(), u.onerror = () => C(new Error("Unable to load image")), u.src = x;
709
+ }), m(u.naturalWidth, u.naturalHeight));
713
710
  };
714
711
  return y(), (async () => {
715
712
  try {
716
- if (r === "webcam") {
717
- await T();
713
+ if (n === "webcam") {
714
+ await F();
718
715
  return;
719
716
  }
720
- if (r === "video") {
721
- if (!(n != null && n.src)) throw new Error("Missing video source");
722
- await R(n.src);
717
+ if (n === "video") {
718
+ if (!(r != null && r.src)) throw new Error("Missing video source");
719
+ await R(r.src);
723
720
  return;
724
721
  }
725
722
  if (!(t != null && t.src)) throw new Error("Missing image source");
726
723
  await v(t.src);
727
724
  } catch (x) {
728
725
  if (w) return;
729
- h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${r}`);
726
+ h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${n}`);
730
727
  }
731
728
  })(), () => {
732
729
  w = !0, y();
733
730
  };
734
- }, [e, t, r, n]), {
731
+ }, [e, t, n, r]), {
735
732
  videoRef: o,
736
733
  imageRef: i,
737
734
  stream: a,
@@ -739,31 +736,31 @@ const W = ({
739
736
  status: d,
740
737
  error: b
741
738
  };
742
- }, qe = ({
739
+ }, _e = ({
743
740
  enabled: e,
744
741
  imageRef: t,
745
- selectedSource: r,
746
- status: n,
742
+ selectedSource: n,
743
+ status: r,
747
744
  videoRef: o
748
745
  }) => {
749
746
  const [i, a] = S(null);
750
- return F(() => {
751
- if (!e || n !== "ready") {
747
+ return M(() => {
748
+ if (!e || r !== "ready") {
752
749
  a((c) => (c == null || c.dispose(), null));
753
750
  return;
754
751
  }
755
- const s = r === "image" ? t.current : o.current;
752
+ const s = n === "image" ? t.current : o.current;
756
753
  if (!s) return;
757
- const l = r === "image" ? new V.Texture(s) : new V.VideoTexture(s);
758
- return l.colorSpace = V.SRGBColorSpace, l.minFilter = V.LinearFilter, l.magFilter = V.LinearFilter, l.generateMipmaps = !1, l.needsUpdate = !0, a((c) => (c == null || c.dispose(), l)), () => {
754
+ const l = n === "image" ? new L.Texture(s) : new L.VideoTexture(s);
755
+ return l.colorSpace = L.SRGBColorSpace, l.minFilter = L.LinearFilter, l.magFilter = L.LinearFilter, l.generateMipmaps = !1, l.needsUpdate = !0, a((c) => (c == null || c.dispose(), l)), () => {
759
756
  l.dispose();
760
757
  };
761
- }, [e, t, r, n, o]), i;
762
- }, Ne = ({
758
+ }, [e, t, n, r, o]), i;
759
+ }, He = ({
763
760
  externalTracker: e,
764
761
  imageOptions: t,
765
- layout: r,
766
- managesOwnMedia: n,
762
+ layout: n,
763
+ managesOwnMedia: r,
767
764
  mediaError: o,
768
765
  mediaFitMode: i,
769
766
  mediaSize: a,
@@ -775,21 +772,21 @@ const W = ({
775
772
  selectedVideo: b,
776
773
  selectedVideoId: f,
777
774
  setMirrored: w,
778
- setSelectedImageId: m,
779
- setSelectedSource: p,
775
+ setSelectedImageId: p,
776
+ setSelectedSource: m,
780
777
  setSelectedVideoId: y,
781
- setShowMediaControls: T,
778
+ setShowMediaControls: F,
782
779
  showMediaControls: R,
783
780
  tracker: v,
784
- videoOptions: E,
781
+ videoOptions: I,
785
782
  viewportSize: x
786
783
  }) => {
787
- const u = h === "image" ? `${D.image.label}: ${(c == null ? void 0 : c.label) ?? ""}` : h === "video" ? `${D.video.label}: ${(b == null ? void 0 : b.label) ?? ""}` : D.webcam.label;
784
+ const u = h === "image" ? `${A.image.label}: ${(c == null ? void 0 : c.label) ?? ""}` : h === "video" ? `${A.video.label}: ${(b == null ? void 0 : b.label) ?? ""}` : A.webcam.label;
788
785
  return {
789
- activeDelegate: n ? v.activeDelegate : null,
790
- faces: n ? v.faces : e.faces,
786
+ activeDelegate: r ? v.activeDelegate : null,
787
+ faces: r ? v.faces : e.faces,
791
788
  imageOptions: t,
792
- layout: r,
789
+ layout: n,
793
790
  mediaError: o,
794
791
  mediaFitMode: i,
795
792
  mediaLabel: u,
@@ -799,45 +796,45 @@ const W = ({
799
796
  selectedSource: h,
800
797
  selectedVideoId: f,
801
798
  setMirrored: w,
802
- setSelectedImageId: m,
803
- setSelectedSource: p,
799
+ setSelectedImageId: p,
800
+ setSelectedSource: m,
804
801
  setSelectedVideoId: y,
805
- setShowMediaControls: T,
802
+ setShowMediaControls: F,
806
803
  showMediaControls: R,
807
- trackerError: n ? v.error : null,
808
- trackerStatus: n ? v.status : e.trackerStatus,
809
- videoOptions: E,
804
+ trackerError: r ? v.error : null,
805
+ trackerStatus: r ? v.status : e.trackerStatus,
806
+ videoOptions: I,
810
807
  viewportSize: x,
811
808
  mediaSize: a
812
809
  };
813
- }, Ue = ({
810
+ }, Pe = ({
814
811
  mediaTexture: e,
815
812
  previewMode: t,
816
- renderOutputs: r,
817
- sceneRenderOutputs: n
818
- }) => q(
813
+ renderOutputs: n,
814
+ sceneRenderOutputs: r
815
+ }) => $(
819
816
  () => ({
820
- requested: r,
817
+ requested: n,
821
818
  previewMode: t,
822
819
  mediaColorTexture: e,
823
- sceneColorTexture: n.sceneColorTexture,
824
- finalColorTexture: r.finalColor ? n.sceneColorTexture : null,
825
- sceneDepthTexture: n.sceneDepthTexture,
820
+ sceneColorTexture: r.sceneColorTexture,
821
+ finalColorTexture: n.finalColor ? r.sceneColorTexture : null,
822
+ sceneDepthTexture: r.sceneDepthTexture,
826
823
  estimatedDepthTexture: null,
827
824
  available: {
828
825
  mediaColor: e !== null,
829
- sceneColor: n.sceneColorTexture !== null,
830
- finalColor: !!(r.finalColor && n.sceneColorTexture),
831
- sceneDepth: n.sceneDepthTexture !== null,
826
+ sceneColor: r.sceneColorTexture !== null,
827
+ finalColor: !!(n.finalColor && r.sceneColorTexture),
828
+ sceneDepth: r.sceneDepthTexture !== null,
832
829
  estimatedDepth: !1
833
830
  }
834
831
  }),
835
- [e, t, r, n]
836
- ), je = ({
832
+ [e, t, n, r]
833
+ ), $e = ({
837
834
  fitMode: e,
838
835
  imageOptions: t,
839
- initialImageId: r,
840
- initialMirrored: n,
836
+ initialImageId: n,
837
+ initialMirrored: r,
841
838
  initialSource: o,
842
839
  initialVideoId: i,
843
840
  mediaStrategy: a,
@@ -847,140 +844,140 @@ const W = ({
847
844
  source: d,
848
845
  videoOptions: h
849
846
  }) => {
850
- const b = L(null), f = L(null), w = He(b), m = q(
851
- () => Be({
847
+ const b = X(null), f = X(null), w = De(b), p = $(
848
+ () => Ae({
852
849
  imageOptions: t,
853
- initialImageId: r,
850
+ initialImageId: n,
854
851
  initialSource: o,
855
852
  initialVideoId: i,
856
853
  source: d,
857
854
  videoOptions: h
858
855
  }),
859
- [t, r, o, i, d, h]
860
- ), [p, y] = S(n), [T, R] = S(c), [v, E] = S(
861
- m.selectedSource
862
- ), [x, u] = S(m.selectedImageId), [I, C] = S(m.selectedVideoId), [K, A] = S({
856
+ [t, n, o, i, d, h]
857
+ ), [m, y] = S(r), [F, R] = S(c), [v, I] = S(
858
+ p.selectedSource
859
+ ), [x, u] = S(p.selectedImageId), [E, C] = S(p.selectedVideoId), [j, V] = S({
863
860
  sceneColorTexture: null,
864
861
  sceneDepthTexture: null
865
- }), k = a === "internal";
866
- F(() => {
867
- d && (E(m.selectedSource), u(m.selectedImageId), C(m.selectedVideoId));
868
- }, [m, d]);
869
- const G = t.find(($) => $.id === x) ?? t[0], Y = h.find(($) => $.id === I) ?? h[0], M = $e({
870
- enabled: k,
871
- imageAsset: G,
862
+ }), z = a === "internal";
863
+ M(() => {
864
+ d && (I(p.selectedSource), u(p.selectedImageId), C(p.selectedVideoId));
865
+ }, [p, d]);
866
+ const K = t.find((P) => P.id === x) ?? t[0], G = h.find((P) => P.id === E) ?? h[0], T = We({
867
+ enabled: z,
868
+ imageAsset: K,
872
869
  selectedSource: v,
873
- videoAsset: Y
874
- }), H = Ae(e, v), B = q(
875
- () => We(M.mediaSize, w, H),
876
- [M.mediaSize, H, w]
877
- ), oe = qe({
870
+ videoAsset: G
871
+ }), _ = ke(e, v), D = $(
872
+ () => Le(T.mediaSize, w, _),
873
+ [T.mediaSize, _, w]
874
+ ), re = _e({
878
875
  enabled: !!(l.mediaColor || l.finalColor),
879
- imageRef: M.imageRef,
876
+ imageRef: T.imageRef,
880
877
  selectedSource: v,
881
- status: M.status,
882
- videoRef: M.videoRef
883
- }), _ = Xe(v, p), ie = Ve({
884
- displayMirrored: _,
885
- enabled: k && M.status === "ready" && B !== null,
886
- imageRef: M.imageRef,
887
- layout: B,
878
+ status: T.status,
879
+ videoRef: T.videoRef
880
+ }), H = Me(v, m), ne = Xe({
881
+ displayMirrored: H,
882
+ enabled: z && T.status === "ready" && D !== null,
883
+ imageRef: T.imageRef,
884
+ layout: D,
888
885
  selectedSource: v,
889
- sourceStream: M.stream,
890
- videoRef: M.videoRef
891
- }), ae = _e({
892
- enabled: !k,
886
+ sourceStream: T.stream,
887
+ videoRef: T.videoRef
888
+ }), oe = Be({
889
+ enabled: !z,
893
890
  selectedSource: v
894
- }), se = Ne({
895
- externalTracker: ae,
891
+ }), ie = He({
892
+ externalTracker: oe,
896
893
  imageOptions: t,
897
- layout: B,
898
- managesOwnMedia: k,
899
- mediaError: M.error,
900
- mediaFitMode: H,
901
- mediaSize: M.mediaSize,
902
- mediaStatus: M.status,
903
- mirrored: _,
904
- selectedImage: G,
894
+ layout: D,
895
+ managesOwnMedia: z,
896
+ mediaError: T.error,
897
+ mediaFitMode: _,
898
+ mediaSize: T.mediaSize,
899
+ mediaStatus: T.status,
900
+ mirrored: H,
901
+ selectedImage: K,
905
902
  selectedImageId: x,
906
903
  selectedSource: v,
907
- selectedVideo: Y,
908
- selectedVideoId: I,
904
+ selectedVideo: G,
905
+ selectedVideoId: E,
909
906
  setMirrored: y,
910
907
  setSelectedImageId: u,
911
- setSelectedSource: E,
908
+ setSelectedSource: I,
912
909
  setSelectedVideoId: C,
913
910
  setShowMediaControls: R,
914
- showMediaControls: T,
915
- tracker: ie,
911
+ showMediaControls: F,
912
+ tracker: ne,
916
913
  videoOptions: h,
917
914
  viewportSize: w
918
- }), le = Ue({
919
- mediaTexture: oe,
915
+ }), ae = Pe({
916
+ mediaTexture: re,
920
917
  previewMode: s,
921
918
  renderOutputs: l,
922
- sceneRenderOutputs: K
919
+ sceneRenderOutputs: j
923
920
  });
924
921
  return {
925
922
  containerRef: b,
926
923
  displayCanvasRef: f,
927
- displayMirrored: _,
928
- layout: B,
929
- managesOwnMedia: k,
930
- media: M,
931
- renderOutputState: le,
932
- renderState: se,
924
+ displayMirrored: H,
925
+ layout: D,
926
+ managesOwnMedia: z,
927
+ media: T,
928
+ renderOutputState: ae,
929
+ renderState: ie,
933
930
  selectedImageId: x,
934
931
  selectedSource: v,
935
- selectedVideoId: I,
936
- setSceneRenderOutputs: A,
932
+ selectedVideoId: E,
933
+ setSceneRenderOutputs: V,
937
934
  setSelectedImageId: u,
938
- setSelectedSource: E,
935
+ setSelectedSource: I,
939
936
  setSelectedVideoId: C,
940
- showMediaControls: T,
937
+ showMediaControls: F,
941
938
  viewportSize: w
942
939
  };
943
- }, U = ({ children: e }) => /* @__PURE__ */ g(P, { children: e });
940
+ }, U = ({ children: e }) => /* @__PURE__ */ g(W, { children: e });
944
941
  U.displayName = "XRViewport.Scene";
945
- const j = ({ children: e }) => /* @__PURE__ */ g(P, { children: e });
946
- j.displayName = "XRViewport.Overlay";
947
- const Ke = (e, t) => {
942
+ const N = ({ children: e }) => /* @__PURE__ */ g(W, { children: e });
943
+ N.displayName = "XRViewport.Overlay";
944
+ const qe = (e, t) => {
948
945
  if (e === "dom")
949
946
  return {
950
947
  sceneContent: null,
951
948
  overlayContent: t
952
949
  };
953
- let r = null, n = null;
950
+ let n = null, r = null;
954
951
  const o = [];
955
- return ge.forEach(t, (i) => {
952
+ return he.forEach(t, (i) => {
956
953
  var s;
957
- if (!be(i)) {
954
+ if (!me(i)) {
958
955
  i != null && o.push(i);
959
956
  return;
960
957
  }
961
958
  const a = (s = i.type) == null ? void 0 : s.displayName;
962
959
  if (a === U.displayName) {
963
- r = i.props.children;
960
+ n = i.props.children;
964
961
  return;
965
962
  }
966
- if (a === j.displayName) {
967
- n = i.props.children;
963
+ if (a === N.displayName) {
964
+ r = i.props.children;
968
965
  return;
969
966
  }
970
967
  o.push(i);
971
- }), !n && o.length > 0 && (n = o), {
972
- sceneContent: r,
973
- overlayContent: n
968
+ }), !r && o.length > 0 && (r = o), {
969
+ sceneContent: n,
970
+ overlayContent: r
974
971
  };
975
972
  }, Z = (e, t) => typeof e == "function" ? e(t) : e;
976
- function Ge(e) {
977
- return e.Scene = U, e.Overlay = j, e;
973
+ function Ue(e) {
974
+ return e.Scene = U, e.Overlay = N, e;
978
975
  }
979
- const ct = Ge(({
976
+ const rt = Ue(({
980
977
  children: e,
981
978
  fitMode: t = "auto",
982
- imageOptions: r = [],
983
- initialImageId: n,
979
+ imageOptions: n = [],
980
+ initialImageId: r,
984
981
  initialMirrored: o = !0,
985
982
  initialSource: i = "webcam",
986
983
  initialVideoId: a,
@@ -992,12 +989,12 @@ const ct = Ge(({
992
989
  showMediaControlsByDefault: b = !0,
993
990
  source: f,
994
991
  style: w,
995
- videoOptions: m = []
992
+ videoOptions: p = []
996
993
  }) => {
997
- const p = je({
994
+ const m = $e({
998
995
  fitMode: t,
999
- imageOptions: r,
1000
- initialImageId: n,
996
+ imageOptions: n,
997
+ initialImageId: r,
1001
998
  initialMirrored: o,
1002
999
  initialSource: i,
1003
1000
  initialVideoId: a,
@@ -1006,44 +1003,44 @@ const ct = Ge(({
1006
1003
  renderOutputs: h,
1007
1004
  showMediaControlsByDefault: b,
1008
1005
  source: f,
1009
- videoOptions: m
1010
- }), y = typeof e == "function" ? e(p.renderState) : e, { sceneContent: T, overlayContent: R } = Ke(c, y), v = Z(
1011
- T,
1012
- p.renderState
1013
- ), E = Z(
1006
+ videoOptions: p
1007
+ }), y = typeof e == "function" ? e(m.renderState) : e, { sceneContent: F, overlayContent: R } = qe(c, y), v = Z(
1008
+ F,
1009
+ m.renderState
1010
+ ), I = Z(
1014
1011
  R,
1015
- p.renderState
1012
+ m.renderState
1016
1013
  );
1017
- return /* @__PURE__ */ g(ye.Provider, { value: p.renderState, children: /* @__PURE__ */ g(Ce.Provider, { value: p.renderOutputState, children: /* @__PURE__ */ g(
1018
- ke,
1014
+ return /* @__PURE__ */ g(be.Provider, { value: m.renderState, children: /* @__PURE__ */ g(we.Provider, { value: m.renderOutputState, children: /* @__PURE__ */ g(
1015
+ Ee,
1019
1016
  {
1020
- containerRef: p.containerRef,
1021
- displayCanvasRef: p.displayCanvasRef,
1022
- imageOptions: r,
1023
- imageRef: p.media.imageRef,
1024
- layout: p.layout,
1025
- managesOwnMedia: p.managesOwnMedia,
1017
+ containerRef: m.containerRef,
1018
+ displayCanvasRef: m.displayCanvasRef,
1019
+ imageOptions: n,
1020
+ imageRef: m.media.imageRef,
1021
+ layout: m.layout,
1022
+ managesOwnMedia: m.managesOwnMedia,
1026
1023
  mediaDock: l,
1027
- mirrored: p.displayMirrored,
1024
+ mirrored: m.displayMirrored,
1028
1025
  mode: c,
1029
- overlayContent: E,
1026
+ overlayContent: I,
1030
1027
  renderOutputs: h,
1031
1028
  sceneContent: v,
1032
- selectedImageId: p.selectedImageId,
1033
- selectedSource: p.selectedSource,
1034
- selectedVideoId: p.selectedVideoId,
1035
- setSceneRenderOutputs: p.setSceneRenderOutputs,
1036
- setSelectedImageId: p.setSelectedImageId,
1037
- setSelectedSource: p.setSelectedSource,
1038
- setSelectedVideoId: p.setSelectedVideoId,
1039
- showMediaControls: p.showMediaControls,
1029
+ selectedImageId: m.selectedImageId,
1030
+ selectedSource: m.selectedSource,
1031
+ selectedVideoId: m.selectedVideoId,
1032
+ setSceneRenderOutputs: m.setSceneRenderOutputs,
1033
+ setSelectedImageId: m.setSelectedImageId,
1034
+ setSelectedSource: m.setSelectedSource,
1035
+ setSelectedVideoId: m.setSelectedVideoId,
1036
+ showMediaControls: m.showMediaControls,
1040
1037
  style: w,
1041
- videoOptions: m,
1042
- videoRef: p.media.videoRef,
1043
- viewportSize: p.viewportSize
1038
+ videoOptions: p,
1039
+ videoRef: m.media.videoRef,
1040
+ viewportSize: m.viewportSize
1044
1041
  }
1045
1042
  ) }) });
1046
- }), Ye = {
1043
+ }), Ne = {
1047
1044
  position: "absolute",
1048
1045
  top: -28,
1049
1046
  left: 0,
@@ -1054,11 +1051,11 @@ const ct = Ge(({
1054
1051
  fontWeight: 700,
1055
1052
  padding: "4px 8px",
1056
1053
  whiteSpace: "nowrap"
1057
- }, dt = ({
1054
+ }, nt = ({
1058
1055
  boundingBox: e,
1059
1056
  label: t = "face bounding box",
1060
- color: r = "#22c55e",
1061
- style: n,
1057
+ color: n = "#22c55e",
1058
+ style: r,
1062
1059
  labelStyle: o
1063
1060
  }) => /* @__PURE__ */ g(
1064
1061
  "div",
@@ -1069,42 +1066,42 @@ const ct = Ge(({
1069
1066
  top: `${e.top * 100}%`,
1070
1067
  width: `${e.width * 100}%`,
1071
1068
  height: `${e.height * 100}%`,
1072
- border: `3px solid ${r}`,
1069
+ border: `3px solid ${n}`,
1073
1070
  boxSizing: "border-box",
1074
1071
  pointerEvents: "none",
1075
1072
  zIndex: 20,
1076
- ...n
1073
+ ...r
1077
1074
  },
1078
- children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ye, ...o }, children: t })
1075
+ children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ne, ...o }, children: t })
1079
1076
  }
1080
- ), ut = (e) => {
1081
- const [t, r] = S(null);
1082
- return F(() => {
1083
- let n = 0;
1077
+ ), ot = (e) => {
1078
+ const [t, n] = S(null);
1079
+ return M(() => {
1080
+ let r = 0;
1084
1081
  const o = () => {
1085
1082
  var l, c;
1086
- n = requestAnimationFrame(o);
1083
+ r = requestAnimationFrame(o);
1087
1084
  const i = (c = (l = e == null ? void 0 : e.detectionResults) == null ? void 0 : l.faceLandmarks) == null ? void 0 : c[0];
1088
1085
  if (!i || i.length === 0) {
1089
- r(null);
1086
+ n(null);
1090
1087
  return;
1091
1088
  }
1092
- const a = we(i), s = {
1089
+ const a = fe(i), s = {
1093
1090
  left: a.minX,
1094
1091
  top: a.minY,
1095
1092
  width: a.width,
1096
1093
  height: a.height
1097
1094
  };
1098
- r((d) => d && d.left === s.left && d.top === s.top && d.width === s.width && d.height === s.height ? d : s);
1095
+ n((d) => d && d.left === s.left && d.top === s.top && d.width === s.width && d.height === s.height ? d : s);
1099
1096
  };
1100
1097
  return o(), () => {
1101
- cancelAnimationFrame(n);
1098
+ cancelAnimationFrame(r);
1102
1099
  };
1103
1100
  }, [e]), t;
1104
- }, ht = ({
1101
+ }, it = ({
1105
1102
  background: e = "#000",
1106
1103
  children: t,
1107
- style: r
1104
+ style: n
1108
1105
  }) => /* @__PURE__ */ g(
1109
1106
  "div",
1110
1107
  {
@@ -1113,156 +1110,68 @@ const ct = Ge(({
1113
1110
  inset: 0,
1114
1111
  overflow: "hidden",
1115
1112
  background: e,
1116
- ...r
1113
+ ...n
1117
1114
  },
1118
1115
  children: t
1119
1116
  }
1120
- ), pt = (e) => {
1121
- const { makeDefault: t = !0, ...r } = e;
1117
+ ), at = (e) => {
1118
+ const { makeDefault: t = !0, ...n } = e;
1122
1119
  return /* @__PURE__ */ g(
1123
- xe,
1120
+ pe,
1124
1121
  {
1125
1122
  position: [0, 0, 40],
1126
1123
  fov: 30,
1127
1124
  near: 0.1,
1128
1125
  far: 1e3,
1129
1126
  makeDefault: t,
1130
- ...r
1127
+ ...n
1131
1128
  }
1132
1129
  );
1133
- }, ft = ["fill", "contain"], mt = (e, t, r, n, o) => {
1134
- const i = Math.max(1, Math.floor(t)), a = Math.max(0, Math.floor(e)), s = r === "ping-pong" && i > 1 ? i * 2 - 2 : i, l = Math.floor(a / s), c = o > 0 ? l >= o : !n && a >= s, d = c ? s - 1 : a % s;
1135
- return { frame: r === "reverse" ? i - 1 - d % i : r === "random" ? d * 7919 % i : r === "ping-pong" && d >= i ? s - d : d, ended: c, loop: l };
1136
- }, gt = (e, t, r) => {
1137
- const n = Math.max(1, Math.floor(r));
1138
- return Math.floor(Math.max(0, e) * Math.max(0, t)) % n;
1139
- };
1140
- class bt {
1141
- constructor(t, r) {
1142
- X(this, "capabilities");
1143
- X(this, "snapshot");
1144
- X(this, "listeners", /* @__PURE__ */ new Set());
1145
- X(this, "eventListeners", /* @__PURE__ */ new Map());
1146
- this.capabilities = t, this.snapshot = {
1147
- state: "idle",
1148
- frame: 0,
1149
- time: 0,
1150
- playMode: "forward",
1151
- loop: !0,
1152
- loopCount: 0,
1153
- ...r
1154
- };
1155
- }
1156
- play() {
1157
- const t = this.snapshot.state === "paused";
1158
- this.update({ state: "playing" }), this.emit(t ? "Resume" : "PlayBegin");
1159
- }
1160
- pause() {
1161
- this.update({ state: "paused" }), this.emit("Pause");
1162
- }
1163
- restart() {
1164
- this.update({ state: "playing", frame: 0, time: 0 }), this.emit("PlayBegin");
1165
- }
1166
- setPlayMode(t) {
1167
- this.update({ playMode: t });
1168
- }
1169
- setLoop(t, r = 0) {
1170
- this.update({ loop: t, loopCount: r });
1171
- }
1172
- seek(t) {
1173
- this.capabilities.canSeek && this.update({ frame: Math.max(0, Math.floor(t)), time: Math.max(0, t) });
1174
- }
1175
- subscribe(t) {
1176
- return this.listeners.add(t), () => this.listeners.delete(t);
1177
- }
1178
- on(t, r) {
1179
- const n = this.eventListeners.get(t) ?? /* @__PURE__ */ new Set();
1180
- return n.add(r), this.eventListeners.set(t, n), () => this.off(t, r);
1181
- }
1182
- off(t, r) {
1183
- var n;
1184
- (n = this.eventListeners.get(t)) == null || n.delete(r);
1185
- }
1186
- getSnapshot() {
1187
- return this.snapshot;
1188
- }
1189
- dispose() {
1190
- this.listeners.clear(), this.eventListeners.clear(), this.snapshot = { ...this.snapshot, state: "idle" };
1191
- }
1192
- emit(t) {
1193
- var r;
1194
- (r = this.eventListeners.get(t)) == null || r.forEach((n) => n({ type: t, snapshot: this.snapshot }));
1195
- }
1196
- update(t) {
1197
- this.snapshot = { ...this.snapshot, ...t }, this.listeners.forEach((r) => r(this.snapshot));
1198
- }
1199
- }
1200
- function wt(e) {
1201
- return async (t, r) => {
1202
- const n = e.find((o) => o.canResolve(t));
1203
- if (!n) throw new Je("No texture provider matched source", t);
1204
- return Oe(n.resolve.bind(n), t, r);
1205
- };
1206
- }
1207
- class Je extends Error {
1208
- constructor(r, n) {
1209
- super(r);
1210
- X(this, "source");
1211
- this.name = "TextureSourceLoadError", this.source = n;
1212
- }
1213
- }
1214
- function ee(e) {
1215
- if (e.aborted)
1216
- throw new DOMException("Texture source load aborted", "AbortError");
1217
- }
1218
- async function Oe(e, t, r) {
1219
- ee(r);
1220
- const n = await e(t, r);
1221
- return r.aborted && (n.dispose(), ee(r)), n;
1222
- }
1223
- function xt(e) {
1224
- e == null || e.dispose();
1225
- }
1130
+ }, st = ["fill", "contain"];
1226
1131
  export {
1227
- bt as BasicAnimatedTextureController,
1228
- dt as BoundingBoxOverlay,
1229
- Ct as HeadTracker,
1230
- pt as PerspectiveCamera,
1231
- Dt as ScreenRectAspectContext,
1232
- ft as TEXTURE_FITS,
1233
- Je as TextureSourceLoadError,
1234
- ht as XRCompositor,
1235
- W as XRLayer,
1236
- Se as XRMediaSurface,
1237
- lt as XRTrackingOverlay,
1238
- ct as XRViewport,
1239
- we as computeLandmarkBounds,
1240
- $t as computeScreenTransform,
1241
- Lt as createFaceInfoTarget,
1242
- wt as createTextureSourceResolver,
1243
- xt as disposeResolvedTextureSource,
1244
- zt as getFaceInfo,
1245
- mt as getPlaybackFrame,
1246
- gt as getSequenceFrame,
1247
- Vt as getThreeBlending,
1248
- At as getThreeDepthFunction,
1249
- Bt as getThreeSide,
1250
- Ht as hasFullUnitUVBounds,
1251
- Xe as resolveCalibrationFaceDisplayMirrored,
1252
- Oe as resolveTextureSource,
1253
- ee as throwIfAborted,
1254
- Ve as useCalibrationFaceTracker,
1255
- ut as useFaceBoundingBox,
1256
- Wt as useScreenSpace,
1257
- St as useTrackerContext,
1258
- Et as useXRCameraTexture,
1259
- ue as useXRContext,
1260
- It as useXRError,
1261
- he as useXRModel,
1262
- pe as useXRModelNode,
1263
- Mt as useXRPipelineSnapshot,
1264
- Tt as useXRReady,
1265
- Ft as useXRRenderSize,
1132
+ zt as BasicAnimatedTextureController,
1133
+ nt as BoundingBoxOverlay,
1134
+ dt as HeadTracker,
1135
+ Xt as MAX_GIF_BYTES,
1136
+ kt as MAX_GIF_FRAMES,
1137
+ At as MAX_GIF_PIXELS,
1138
+ at as PerspectiveCamera,
1139
+ Ct as ScreenRectAspectContext,
1140
+ st as TEXTURE_FITS,
1141
+ Lt as TextureSourceLoadError,
1142
+ it as XRCompositor,
1143
+ B as XRLayer,
1144
+ xe as XRMediaSurface,
1145
+ tt as XRTrackingOverlay,
1146
+ rt as XRViewport,
1147
+ fe as computeLandmarkBounds,
1148
+ Vt as computeScreenTransform,
1149
+ xt as createFaceInfoTarget,
1150
+ Dt as createTextureSourceResolver,
1151
+ Bt as disposeResolvedTextureSource,
1152
+ vt as getFaceInfo,
1153
+ Wt as getPlaybackFrame,
1154
+ _t as getSequenceFrame,
1155
+ St as getThreeBlending,
1156
+ Rt as getThreeDepthFunction,
1157
+ It as getThreeSide,
1158
+ Ht as gifTextureSourceProvider,
1159
+ Ft as hasFullUnitUVBounds,
1160
+ Me as resolveCalibrationFaceDisplayMirrored,
1161
+ Pt as resolveTextureSource,
1162
+ $t as throwIfAborted,
1163
+ Xe as useCalibrationFaceTracker,
1164
+ ot as useFaceBoundingBox,
1165
+ Et as useScreenSpace,
1166
+ ut as useTrackerContext,
1167
+ mt as useXRCameraTexture,
1168
+ se as useXRContext,
1169
+ ft as useXRError,
1170
+ le as useXRModel,
1171
+ ce as useXRModelNode,
1172
+ pt as useXRPipelineSnapshot,
1173
+ gt as useXRReady,
1174
+ bt as useXRRenderSize,
1266
1175
  qt as useXRViewportRenderOutputs,
1267
- Nt as useXRViewportState
1176
+ Ut as useXRViewportState
1268
1177
  };