@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
@@ -1,18 +1,18 @@
1
1
  var Ae = Object.defineProperty;
2
- var be = (i, s, e) => s in i ? Ae(i, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[s] = e;
3
- var h = (i, s, e) => be(i, typeof s != "symbol" ? s + "" : s, e);
4
- import { jsx as ne } from "react/jsx-runtime";
5
- import { useRef as oe, useMemo as $, useEffect as Ee, useContext as ce, useCallback as ae, createElement as Ie, createContext as he } from "react";
2
+ var be = (n, s, e) => s in n ? Ae(n, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[s] = e;
3
+ var h = (n, s, e) => be(n, typeof s != "symbol" ? s + "" : s, e);
4
+ import { jsx as ae } from "react/jsx-runtime";
5
+ import { useRef as oe, useMemo as $, useEffect as Ee, useContext as ce, useCallback as ie, createElement as Ie, createContext as he } from "react";
6
6
  import { FilesetResolver as V, PoseLandmarker as De, FaceLandmarker as _e, GestureRecognizer as Pe, HandLandmarker as Oe, ImageSegmenter as Ue, DrawingUtils as ze } from "@mediapipe/tasks-vision";
7
7
  import * as E from "three";
8
8
  import { RGBAFormat as de, LinearFilter as q, CanvasTexture as ue, SRGBColorSpace as Le } from "three";
9
- var F = /* @__PURE__ */ ((i) => (i.WEBCAM = "webcam", i.STREAM = "stream", i.CANVAS = "canvas", i))(F || {}), z = /* @__PURE__ */ ((i) => (i.HAND_TRACKER = "vincentt.xr.hand-tracker", i.GESTURE_TRACKER = "vincentt.xr.gesture-tracker", i.FACE_TRACKER = "vincentt.xr.face-tracker", i.BODY_TRACKER = "vincentt.xr.body-tracker", i.BACKGROUND_SEGMENTATION = "vincentt.xr.background-segmentation", i))(z || {});
9
+ var F = /* @__PURE__ */ ((n) => (n.WEBCAM = "webcam", n.STREAM = "stream", n.CANVAS = "canvas", n))(F || {}), z = /* @__PURE__ */ ((n) => (n.HAND_TRACKER = "vincentt.xr.hand-tracker", n.GESTURE_TRACKER = "vincentt.xr.gesture-tracker", n.FACE_TRACKER = "vincentt.xr.face-tracker", n.BODY_TRACKER = "vincentt.xr.body-tracker", n.BACKGROUND_SEGMENTATION = "vincentt.xr.background-segmentation", n))(z || {});
10
10
  class b extends Error {
11
11
  constructor(s) {
12
12
  super(s), this.name = "VincenttXRError";
13
13
  }
14
14
  }
15
- const Be = (i, s) => s, I = {
15
+ const Be = (n, s) => s, I = {
16
16
  apiBaseUrl: Be(void 0, "https://api.vincentt.studio"),
17
17
  // Pinned to the CDN, NOT build-env-driven: a stale VITE_ASSET_STORAGE_ENDPOINT
18
18
  // baked a now-deleted CloudFront domain into every published bundle, breaking
@@ -41,11 +41,11 @@ class Ve {
41
41
  e && console.error(t, ...s);
42
42
  }
43
43
  }
44
- const O = (i) => i * 2 - 1, j = new E.Vector3(), Y = new E.Vector3(), H = ({ x: i, y: s, z: e }, t, a) => {
45
- j.set((i - 0.5) * 2, (0.5 - s) * 2, -e), j.unproject(t), Y.copy(j).sub(t.position).normalize();
44
+ const O = (n) => n * 2 - 1, j = new E.Vector3(), Y = new E.Vector3(), H = ({ x: n, y: s, z: e }, t, i) => {
45
+ j.set((n - 0.5) * 2, (0.5 - s) * 2, -e), j.unproject(t), Y.copy(j).sub(t.position).normalize();
46
46
  const r = -t.position.z / Y.z;
47
- return a.copy(t.position).addScaledVector(Y, r), a;
48
- }, It = (i, s) => H(i, s, new E.Vector3()), Ke = (i, s, e = 0.2) => e * s + (1 - e) * i;
47
+ return i.copy(t.position).addScaledVector(Y, r), i;
48
+ }, _t = (n, s) => H(n, s, new E.Vector3()), Ke = (n, s, e = 0.2) => e * s + (1 - e) * n;
49
49
  class Z {
50
50
  constructor(s) {
51
51
  h(this, "canvas");
@@ -57,9 +57,9 @@ class Z {
57
57
  * 2D context can't be obtained). The returned canvas is reused across calls.
58
58
  */
59
59
  draw(s) {
60
- const e = s.width, t = s.height, a = Math.min(1, this.maxDimension / Math.max(e, t));
61
- if (a >= 1) return s;
62
- const r = Math.max(1, Math.round(e * a)), o = Math.max(1, Math.round(t * a));
60
+ const e = s.width, t = s.height, i = Math.min(1, this.maxDimension / Math.max(e, t));
61
+ if (i >= 1) return s;
62
+ const r = Math.max(1, Math.round(e * i)), o = Math.max(1, Math.round(t * i));
63
63
  (!this.canvas || this.canvas.width !== r || this.canvas.height !== o) && (this.canvas = new OffscreenCanvas(r, o));
64
64
  const u = this.canvas.getContext("2d");
65
65
  return u ? (u.setTransform(1, 0, 0, 1, 0, 0), u.clearRect(0, 0, r, o), u.drawImage(s, 0, 0, r, o), this.canvas) : s;
@@ -78,47 +78,47 @@ const Ne = {
78
78
  "/assets/sdk/face/v1/canonical_face_model.obj": "sha384-xP8YM/72TXKvbMptXB9a8JUlUf3MZQ8uLurExrsZc05v6/P5RrsaNGMUYS/BZx8A",
79
79
  "/opencv/facial_expression_recognition/resolve/main/facial_expression_recognition_mobilefacenet_2022july_int8.onnx": "sha384-g8mtFubiIc/yhqi591RsxD76AJLw2CfYgKhKbVkIiFlwBmIyG7ZAIVyGPXafrDGB"
80
80
  };
81
- async function He(i) {
82
- const s = await fetch(i);
81
+ async function He(n) {
82
+ const s = await fetch(n);
83
83
  if (!s.ok)
84
- throw new Error(`fetchAndVerify: ${s.status} ${i}`);
85
- const e = await s.arrayBuffer(), t = Ge(i);
84
+ throw new Error(`fetchAndVerify: ${s.status} ${n}`);
85
+ const e = await s.arrayBuffer(), t = Ge(n);
86
86
  if (!t) {
87
- if (qe(i))
88
- throw new Error(`[xr-sdk integrity] no SRI hash for SDK asset ${i}`);
89
- return console.warn(`[xr-sdk integrity] no SRI hash for ${i} — passing through`), e;
87
+ if (qe(n))
88
+ throw new Error(`[xr-sdk integrity] no SRI hash for SDK asset ${n}`);
89
+ return console.warn(`[xr-sdk integrity] no SRI hash for ${n} — passing through`), e;
90
90
  }
91
- const a = await We(e);
92
- if (a !== t)
91
+ const i = await We(e);
92
+ if (i !== t)
93
93
  throw new Error(
94
- `[xr-sdk integrity] SRI mismatch for ${i}: expected ${t}, got ${a}`
94
+ `[xr-sdk integrity] SRI mismatch for ${n}: expected ${t}, got ${i}`
95
95
  );
96
96
  return e;
97
97
  }
98
- function qe(i) {
98
+ function qe(n) {
99
99
  try {
100
- return new URL(i).origin === new URL(I.assetStorageEndpoint).origin;
100
+ return new URL(n).origin === new URL(I.assetStorageEndpoint).origin;
101
101
  } catch {
102
102
  return !1;
103
103
  }
104
104
  }
105
- async function K(i) {
106
- const s = await He(i);
105
+ async function K(n) {
106
+ const s = await He(n);
107
107
  return new Uint8Array(s);
108
108
  }
109
- function Ge(i) {
109
+ function Ge(n) {
110
110
  try {
111
- const s = new URL(i);
111
+ const s = new URL(n);
112
112
  return Ne[s.pathname];
113
113
  } catch {
114
114
  return;
115
115
  }
116
116
  }
117
- async function We(i) {
118
- const s = await crypto.subtle.digest("SHA-384", i), e = new Uint8Array(s);
117
+ async function We(n) {
118
+ const s = await crypto.subtle.digest("SHA-384", n), e = new Uint8Array(s);
119
119
  let t = "";
120
- for (let a = 0; a < e.byteLength; a++)
121
- t += String.fromCharCode(e[a]);
120
+ for (let i = 0; i < e.byteLength; i++)
121
+ t += String.fromCharCode(e[i]);
122
122
  return `sha384-${btoa(t)}`;
123
123
  }
124
124
  class N {
@@ -196,9 +196,9 @@ class je extends N {
196
196
  async getBodyData() {
197
197
  if (!this.landmarker || !this.sourceCanvas)
198
198
  return;
199
- const e = this.downscaler.draw(this.sourceCanvas), t = performance.now(), a = this.landmarker.detectForVideo(e, t), r = performance.now();
199
+ const e = this.downscaler.draw(this.sourceCanvas), t = performance.now(), i = this.landmarker.detectForVideo(e, t), r = performance.now();
200
200
  this.processingTime = r - t;
201
- const o = a.landmarks, u = [];
201
+ const o = i.landmarks, u = [];
202
202
  if (o)
203
203
  return o.forEach((m, d) => {
204
204
  u[d] || (u[d] = []), m.forEach((S) => {
@@ -238,12 +238,12 @@ class je extends N {
238
238
  async initialize(e) {
239
239
  const t = await V.forVisionTasks(
240
240
  new URL("/assets/xr/wasm", I.assetStorageEndpoint).toString()
241
- ), a = await K(
241
+ ), i = await K(
242
242
  new URL("/assets/xr/models/body_tracking.task", I.assetStorageEndpoint).toString()
243
243
  );
244
244
  this.landmarker = await De.createFromOptions(t, {
245
245
  baseOptions: {
246
- modelAssetBuffer: a,
246
+ modelAssetBuffer: i,
247
247
  delegate: "GPU"
248
248
  },
249
249
  runningMode: "VIDEO",
@@ -265,7 +265,7 @@ class je extends N {
265
265
  };
266
266
  }
267
267
  }
268
- const Ye = 0.11, Qe = 4e-3, $e = (i, s) => s.set(i.x, -i.y, i.z);
268
+ const Ye = 0.11, Qe = 4e-3, $e = (n, s) => s.set(n.x, -n.y, n.z);
269
269
  class Ze extends N {
270
270
  constructor() {
271
271
  super();
@@ -303,7 +303,7 @@ class Ze extends N {
303
303
  return t ? (this.landmarkScratch.x = 1 - e.x, this.landmarkScratch.y = e.y, this.landmarkScratch.z = e.z, this.landmarkScratch.visibility = e.visibility, this.landmarkScratch) : e;
304
304
  }
305
305
  extractAndUpdateFaceData(e) {
306
- var a;
306
+ var i;
307
307
  if (!e.faceLandmarks.length) {
308
308
  this.faces = [];
309
309
  return;
@@ -321,7 +321,7 @@ class Ze extends N {
321
321
  for (let r = 0; r < t; r += 1) {
322
322
  if (!this.cameras[r])
323
323
  continue;
324
- const o = this.faces[r], u = (a = this.getSource) == null ? void 0 : a.call(this), m = !(u === "webcam" || !u), d = e.faceLandmarks[r], S = e.facialTransformationMatrixes[r];
324
+ const o = this.faces[r], u = (i = this.getSource) == null ? void 0 : i.call(this), m = !(u === "webcam" || !u), d = e.faceLandmarks[r], S = e.facialTransformationMatrixes[r];
325
325
  this.rotMatrixScratch.fromArray(S.data), this.rotQuatScratch.setFromRotationMatrix(this.rotMatrixScratch), this.rotQuatScratch.set(
326
326
  -this.rotQuatScratch.x,
327
327
  this.rotQuatScratch.y,
@@ -340,11 +340,11 @@ class Ze extends N {
340
340
  this.cameras[r],
341
341
  this.rightCheekScratch[r]
342
342
  );
343
- const M = this.leftCheekScratch[r].distanceTo(this.rightCheekScratch[r]) * Ye, x = Math.abs(E.MathUtils.radToDeg(this.rotEulerScratch.y)), g = M + x * Qe, f = o.transform.scale.x, w = Ke(
343
+ const M = this.leftCheekScratch[r].distanceTo(this.rightCheekScratch[r]) * Ye, x = Math.abs(E.MathUtils.radToDeg(this.rotEulerScratch.y)), l = M + x * Qe, f = o.transform.scale.x, v = Ke(
344
344
  isNaN(f) ? 0 : f,
345
- g
345
+ l
346
346
  );
347
- o.transform.scale.set(w, w, w);
347
+ o.transform.scale.set(v, v, v);
348
348
  const p = o.gestures, k = e.faceBlendshapes[r].categories;
349
349
  for (const C of k)
350
350
  p[C.categoryName] = C.score;
@@ -357,7 +357,7 @@ class Ze extends N {
357
357
  this.rafId = requestAnimationFrame(this.processFaceTracking.bind(this));
358
358
  return;
359
359
  }
360
- const e = Je(this.numFaces), t = this.sourceCanvas.width, a = this.sourceCanvas.height, r = Math.min(1, e / Math.max(t, a)), o = Math.max(1, Math.round(t * r)), u = Math.max(1, Math.round(a * r));
360
+ const e = Je(this.numFaces), t = this.sourceCanvas.width, i = this.sourceCanvas.height, r = Math.min(1, e / Math.max(t, i)), o = Math.max(1, Math.round(t * r)), u = Math.max(1, Math.round(i * r));
361
361
  (!this.analysisCanvas || this.analysisCanvas.width !== o || this.analysisCanvas.height !== u) && (this.analysisCanvas = new OffscreenCanvas(o, u));
362
362
  const m = this.analysisCanvas.getContext("2d");
363
363
  if (!m) {
@@ -388,11 +388,11 @@ class Ze extends N {
388
388
  return this.detectionResults;
389
389
  }
390
390
  getRawFaceTrackingData(e = 0) {
391
- var t, a, r, o;
391
+ var t, i, r, o;
392
392
  if (this.detectionResults)
393
393
  return {
394
394
  landmarks: (t = this.detectionResults.faceLandmarks) == null ? void 0 : t[e],
395
- blendshapes: (r = (a = this.detectionResults.faceBlendshapes) == null ? void 0 : a[e]) == null ? void 0 : r.categories,
395
+ blendshapes: (r = (i = this.detectionResults.faceBlendshapes) == null ? void 0 : i[e]) == null ? void 0 : r.categories,
396
396
  transformationMatrix: (o = this.detectionResults.facialTransformationMatrixes) == null ? void 0 : o[e]
397
397
  };
398
398
  }
@@ -400,11 +400,11 @@ class Ze extends N {
400
400
  this.numFaces = (e == null ? void 0 : e.numFaces) || 1;
401
401
  const t = await V.forVisionTasks(
402
402
  new URL("/assets/xr/wasm", I.assetStorageEndpoint).toString()
403
- ), a = await K(
403
+ ), i = await K(
404
404
  new URL("/assets/xr/models/face_tracking.task", I.assetStorageEndpoint).toString()
405
405
  ), r = await _e.createFromOptions(t, {
406
406
  baseOptions: {
407
- modelAssetBuffer: a,
407
+ modelAssetBuffer: i,
408
408
  delegate: "GPU"
409
409
  },
410
410
  // Keep detection permissive for calibration workflows with dark webcam input.
@@ -422,8 +422,8 @@ class Ze extends N {
422
422
  }
423
423
  this.landmarker = r;
424
424
  }
425
- async run({ sourceCanvas: e, getSource: t, targetFps: a }) {
426
- this.sourceCanvas = e, this.getSource = t, this.setTargetFps(a), this.analysisCanvas = void 0, this.rafId === null && this.processFaceTracking();
425
+ async run({ sourceCanvas: e, getSource: t, targetFps: i }) {
426
+ this.sourceCanvas = e, this.getSource = t, this.setTargetFps(i), this.analysisCanvas = void 0, this.rafId === null && this.processFaceTracking();
427
427
  }
428
428
  getModelNode() {
429
429
  const e = this;
@@ -434,8 +434,8 @@ class Ze extends N {
434
434
  getDetectionResults: this.getDetectionResults.bind(this),
435
435
  getFace: this.getFace.bind(this),
436
436
  getRawFaceTrackingData: this.getRawFaceTrackingData.bind(this),
437
- setCamera: (a, r = 0) => {
438
- this.cameras[r] = a;
437
+ setCamera: (i, r = 0) => {
438
+ this.cameras[r] = i;
439
439
  }
440
440
  };
441
441
  }
@@ -446,8 +446,8 @@ class Ze extends N {
446
446
  };
447
447
  }
448
448
  }
449
- const Je = (i) => i > 1 ? 1024 : 512;
450
- var D = /* @__PURE__ */ ((i) => (i.ClosedFist = "closed_fist", i.OpenPalm = "open_palm", i.PointingUp = "pointing_up", i.ThumbDown = "thumb_down", i.ThumbUp = "thumb_up", i.Victory = "victory", i.ILoveYou = "i_love_you", i.None = "none", i))(D || {});
449
+ const Je = (n) => n > 1 ? 1024 : 512;
450
+ var D = /* @__PURE__ */ ((n) => (n.ClosedFist = "closed_fist", n.OpenPalm = "open_palm", n.PointingUp = "pointing_up", n.ThumbDown = "thumb_down", n.ThumbUp = "thumb_up", n.Victory = "victory", n.ILoveYou = "i_love_you", n.None = "none", n))(D || {});
451
451
  const et = 512, tt = {
452
452
  Closed_Fist: D.ClosedFist,
453
453
  Open_Palm: D.OpenPalm,
@@ -458,7 +458,7 @@ const et = 512, tt = {
458
458
  ILoveYou: D.ILoveYou,
459
459
  None: D.None
460
460
  }, st = 15;
461
- class it extends N {
461
+ class nt extends N {
462
462
  constructor() {
463
463
  super();
464
464
  h(this, "landmarker", null);
@@ -471,11 +471,11 @@ class it extends N {
471
471
  async getGestureData() {
472
472
  if (!this.landmarker || !this.sourceCanvas)
473
473
  return;
474
- const e = this.downscaler.draw(this.sourceCanvas), t = performance.now(), a = this.landmarker.recognizeForVideo(e, t), r = performance.now();
474
+ const e = this.downscaler.draw(this.sourceCanvas), t = performance.now(), i = this.landmarker.recognizeForVideo(e, t), r = performance.now();
475
475
  this.processingTime = r - t;
476
- const o = a.landmarks[0], u = [];
476
+ const o = i.landmarks[0], u = [];
477
477
  if (o) {
478
- const m = a.gestures[0][0].categoryName;
478
+ const m = i.gestures[0][0].categoryName;
479
479
  return o.forEach((d) => {
480
480
  u.push({
481
481
  x: O(d.x),
@@ -516,7 +516,7 @@ class it extends N {
516
516
  new URL("/assets/xr/wasm", I.assetStorageEndpoint).toString()
517
517
  ), t = await K(
518
518
  new URL("/assets/xr/models/gesture_tracking.task", I.assetStorageEndpoint).toString()
519
- ), a = await Pe.createFromOptions(e, {
519
+ ), i = await Pe.createFromOptions(e, {
520
520
  baseOptions: {
521
521
  modelAssetBuffer: t,
522
522
  delegate: "GPU"
@@ -524,7 +524,7 @@ class it extends N {
524
524
  runningMode: "VIDEO",
525
525
  numHands: 1
526
526
  });
527
- this.landmarker = a;
527
+ this.landmarker = i;
528
528
  }
529
529
  async run({ sourceCanvas: e, targetFps: t }) {
530
530
  this.sourceCanvas = e, this.setTargetFps(t ?? st), this.rafId === null && await this.processGestureTracking();
@@ -547,8 +547,8 @@ class it extends N {
547
547
  };
548
548
  }
549
549
  }
550
- const nt = 512;
551
- class at extends N {
550
+ const at = 512;
551
+ class it extends N {
552
552
  constructor() {
553
553
  super();
554
554
  h(this, "landmarker", null);
@@ -558,24 +558,24 @@ class at extends N {
558
558
  h(this, "gesture");
559
559
  h(this, "handedness");
560
560
  h(this, "sourceCanvas");
561
- h(this, "downscaler", new Z(nt));
561
+ h(this, "downscaler", new Z(at));
562
562
  }
563
563
  async getHandData() {
564
564
  if (!this.landmarker || !this.sourceCanvas)
565
565
  return;
566
- const e = this.downscaler.draw(this.sourceCanvas), t = performance.now(), a = this.landmarker.detectForVideo(e, t), r = performance.now();
566
+ const e = this.downscaler.draw(this.sourceCanvas), t = performance.now(), i = this.landmarker.detectForVideo(e, t), r = performance.now();
567
567
  this.processingTime = r - t;
568
- const o = [], u = a.handedness ?? a.handednesses ?? [];
569
- if (a.landmarks.forEach((d, S) => {
570
- var f, w, p;
568
+ const o = [], u = i.handedness ?? i.handednesses ?? [];
569
+ if (i.landmarks.forEach((d, S) => {
570
+ var f, v, p;
571
571
  if (!d || d.length === 0)
572
572
  return;
573
573
  const R = d.map((k) => ({
574
574
  x: O(k.x),
575
575
  y: O(1 - k.y),
576
576
  z: -k.z
577
- })), M = (p = (w = (f = u[S]) == null ? void 0 : f[0]) == null ? void 0 : w.categoryName) == null ? void 0 : p.toLowerCase(), x = M === "left" || M === "right" ? M : void 0, g = d[0].z < 0 ? "closed_fist" : "open_palm";
578
- o.push({ coordinates: R, gesture: g, handedness: x });
577
+ })), M = (p = (v = (f = u[S]) == null ? void 0 : f[0]) == null ? void 0 : v.categoryName) == null ? void 0 : p.toLowerCase(), x = M === "left" || M === "right" ? M : void 0, l = d[0].z < 0 ? "closed_fist" : "open_palm";
578
+ o.push({ coordinates: R, gesture: l, handedness: x });
579
579
  }), !o.length)
580
580
  return {
581
581
  hands: void 0,
@@ -618,7 +618,7 @@ class at extends N {
618
618
  new URL("/assets/xr/wasm", I.assetStorageEndpoint).toString()
619
619
  ), t = await K(
620
620
  new URL("/assets/xr/models/hand_tracking.task", I.assetStorageEndpoint).toString()
621
- ), a = await Oe.createFromOptions(e, {
621
+ ), i = await Oe.createFromOptions(e, {
622
622
  baseOptions: {
623
623
  modelAssetBuffer: t,
624
624
  delegate: "GPU"
@@ -626,7 +626,7 @@ class at extends N {
626
626
  runningMode: "VIDEO",
627
627
  numHands: 2
628
628
  });
629
- this.landmarker = a;
629
+ this.landmarker = i;
630
630
  }
631
631
  async run({ sourceCanvas: e, targetFps: t }) {
632
632
  this.sourceCanvas = e, this.setTargetFps(t), this.rafId === null && await this.processHandTracking();
@@ -733,8 +733,8 @@ class ht extends N {
733
733
  return e.videoWidth > 0 ? { width: e.videoWidth, height: e.videoHeight } : void 0;
734
734
  if (e instanceof HTMLImageElement)
735
735
  return e.naturalWidth > 0 ? { width: e.naturalWidth, height: e.naturalHeight } : void 0;
736
- const t = e.width, a = e.height;
737
- return typeof t == "number" && t > 0 && typeof a == "number" && a > 0 ? { width: t, height: a } : void 0;
736
+ const t = e.width, i = e.height;
737
+ return typeof t == "number" && t > 0 && typeof i == "number" && i > 0 ? { width: t, height: i } : void 0;
738
738
  }
739
739
  /**
740
740
  * Size the process canvas to the override input's aspect ratio, bounded by
@@ -747,8 +747,8 @@ class ht extends N {
747
747
  const e = this.readIntrinsicSize(this.inputSource);
748
748
  if (!e) return;
749
749
  this.inputSourceSize = e;
750
- const t = Math.min(1, ot / Math.max(e.width, e.height)), a = Math.max(1, Math.round(e.width * t)), r = Math.max(1, Math.round(e.height * t));
751
- this.processCanvas.width === a && this.processCanvas.height === r || (this.processCanvas.width = a, this.processCanvas.height = r, this.glCanvas && (this.glCanvas.width = a, this.glCanvas.height = r), this.maskImageData = void 0);
750
+ const t = Math.min(1, ot / Math.max(e.width, e.height)), i = Math.max(1, Math.round(e.width * t)), r = Math.max(1, Math.round(e.height * t));
751
+ this.processCanvas.width === i && this.processCanvas.height === r || (this.processCanvas.width = i, this.processCanvas.height = r, this.glCanvas && (this.glCanvas.width = i, this.glCanvas.height = r), this.maskImageData = void 0);
752
752
  }
753
753
  async processSegmentation() {
754
754
  if (this.disposed || !this.isProcessing || !this.maskCanvas || !this.processCanvas)
@@ -766,14 +766,14 @@ class ht extends N {
766
766
  }
767
767
  const t = performance.now();
768
768
  this.ensureProcessCanvasForInput();
769
- const a = this.processCanvas.getContext("2d");
770
- if (a) {
769
+ const i = this.processCanvas.getContext("2d");
770
+ if (i) {
771
771
  const u = this.processCanvas.width, m = this.processCanvas.height;
772
- if (a.clearRect(0, 0, u, m), this.inputSource && this.inputSourceSize) {
772
+ if (i.clearRect(0, 0, u, m), this.inputSource && this.inputSourceSize) {
773
773
  const { width: d, height: S } = this.inputSourceSize, R = Math.min(u / d, m / S), M = d * R, x = S * R;
774
- a.drawImage(this.inputSource, (u - M) / 2, (m - x) / 2, M, x);
774
+ i.drawImage(this.inputSource, (u - M) / 2, (m - x) / 2, M, x);
775
775
  } else
776
- a.drawImage(e, 0, 0, u, m);
776
+ i.drawImage(e, 0, 0, u, m);
777
777
  }
778
778
  const o = this.segmenter.segmentForVideo(
779
779
  this.processCanvas,
@@ -811,9 +811,9 @@ class ht extends N {
811
811
  * background→opaque convention (green carries the signal for the alphaMap).
812
812
  */
813
813
  readMaskToImageData(e) {
814
- const t = e.getAsUint8Array(), { width: a, height: r } = e;
815
- if (!t || a <= 0 || r <= 0) return null;
816
- (!this.maskImageData || this.maskImageData.width !== a || this.maskImageData.height !== r) && (this.maskImageData = new ImageData(a, r));
814
+ const t = e.getAsUint8Array(), { width: i, height: r } = e;
815
+ if (!t || i <= 0 || r <= 0) return null;
816
+ (!this.maskImageData || this.maskImageData.width !== i || this.maskImageData.height !== r) && (this.maskImageData = new ImageData(i, r));
817
817
  const o = this.maskImageData.data;
818
818
  for (let u = 0; u < t.length; u += 1) {
819
819
  const m = t[u] === 255 ? 0 : 255;
@@ -828,10 +828,10 @@ class ht extends N {
828
828
  */
829
829
  blitImageDataToMask(e) {
830
830
  if (!this.maskCanvas || !this.filterCanvas) return;
831
- const t = this.maskCanvas.getContext("2d"), a = this.filterCanvas.getContext("2d");
832
- if (!t || !a) return;
831
+ const t = this.maskCanvas.getContext("2d"), i = this.filterCanvas.getContext("2d");
832
+ if (!t || !i) return;
833
833
  const r = this.getStagingCanvas(e.width, e.height), o = r.getContext("2d");
834
- o && (o.putImageData(e, 0, 0), a.filter = "blur(0.5px)", a.clearRect(0, 0, this.filterCanvas.width, this.filterCanvas.height), a.drawImage(r, 0, 0, this.filterCanvas.width, this.filterCanvas.height), t.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height), t.drawImage(this.filterCanvas, 0, 0, this.maskCanvas.width, this.maskCanvas.height));
834
+ o && (o.putImageData(e, 0, 0), i.filter = "blur(0.5px)", i.clearRect(0, 0, this.filterCanvas.width, this.filterCanvas.height), i.drawImage(r, 0, 0, this.filterCanvas.width, this.filterCanvas.height), t.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height), t.drawImage(this.filterCanvas, 0, 0, this.maskCanvas.width, this.maskCanvas.height));
835
835
  }
836
836
  getStagingCanvas(e, t) {
837
837
  return this.stagingCanvas || (this.stagingCanvas = document.createElement("canvas")), this.stagingCanvas.width !== e && (this.stagingCanvas.width = e), this.stagingCanvas.height !== t && (this.stagingCanvas.height = t), this.stagingCanvas;
@@ -860,7 +860,7 @@ class ht extends N {
860
860
  this.quality = (e == null ? void 0 : e.quality) ?? "low";
861
861
  const t = await V.forVisionTasks(
862
862
  new URL("/assets/xr/wasm", I.assetStorageEndpoint).toString()
863
- ), a = await K(
863
+ ), i = await K(
864
864
  new URL("/assets/xr/models/segmentation.tflite", I.assetStorageEndpoint).toString()
865
865
  );
866
866
  this.glCanvas = new OffscreenCanvas(1, 1);
@@ -869,7 +869,7 @@ class ht extends N {
869
869
  });
870
870
  this.segmenter = await Ue.createFromOptions(t, {
871
871
  baseOptions: {
872
- modelAssetBuffer: a,
872
+ modelAssetBuffer: i,
873
873
  delegate: "GPU"
874
874
  },
875
875
  ...r ? { canvas: this.glCanvas } : {},
@@ -881,7 +881,7 @@ class ht extends N {
881
881
  async run({
882
882
  sourceCanvas: e,
883
883
  renderWidth: t,
884
- renderHeight: a,
884
+ renderHeight: i,
885
885
  targetFps: r
886
886
  }) {
887
887
  var u;
@@ -889,7 +889,7 @@ class ht extends N {
889
889
  return;
890
890
  this.setTargetFps(r ?? rt), this.isProcessing = !1, this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
891
891
  const o = this.getQualityScaleFactor();
892
- this.sourceCanvas = e, this.processCanvas = document.createElement("canvas"), this.processCanvas.width = e.width * o, this.processCanvas.height = e.height * o, this.glCanvas && (this.glCanvas.width = this.processCanvas.width, this.glCanvas.height = this.processCanvas.height), this.maskImageData = void 0, this.maskCanvas = document.createElement("canvas"), this.maskCanvas.width = t, this.maskCanvas.height = a, this.filterCanvas = document.createElement("canvas"), this.filterCanvas.width = t, this.filterCanvas.height = a, (u = this.segmentationMaskTexture) == null || u.dispose(), this.segmentationMaskTexture = new ue(this.maskCanvas), this.isMaskSetup = !1, this.rawCache = null, this.isProcessing = !0, this.lastInferenceMs = 0, this.rafId = requestAnimationFrame(this.processSegmentation.bind(this));
892
+ this.sourceCanvas = e, this.processCanvas = document.createElement("canvas"), this.processCanvas.width = e.width * o, this.processCanvas.height = e.height * o, this.glCanvas && (this.glCanvas.width = this.processCanvas.width, this.glCanvas.height = this.processCanvas.height), this.maskImageData = void 0, this.maskCanvas = document.createElement("canvas"), this.maskCanvas.width = t, this.maskCanvas.height = i, this.filterCanvas = document.createElement("canvas"), this.filterCanvas.width = t, this.filterCanvas.height = i, (u = this.segmentationMaskTexture) == null || u.dispose(), this.segmentationMaskTexture = new ue(this.maskCanvas), this.isMaskSetup = !1, this.rawCache = null, this.isProcessing = !0, this.lastInferenceMs = 0, this.rafId = requestAnimationFrame(this.processSegmentation.bind(this));
893
893
  }
894
894
  /**
895
895
  * Lazily read the single-channel mask back to a Uint8Array. Only invoked when
@@ -926,116 +926,139 @@ class ht extends N {
926
926
  }
927
927
  const re = {
928
928
  [z.BACKGROUND_SEGMENTATION]: ht,
929
- [z.HAND_TRACKER]: at,
930
- [z.GESTURE_TRACKER]: it,
929
+ [z.HAND_TRACKER]: it,
930
+ [z.GESTURE_TRACKER]: nt,
931
931
  [z.FACE_TRACKER]: Ze,
932
932
  [z.BODY_TRACKER]: je
933
- }, dt = async (i) => {
933
+ }, dt = async (n) => {
934
934
  const s = document.createElement("video");
935
- s.srcObject = i, s.muted = !0, s.playsInline = !0, s.autoplay = !0, await new Promise((t) => {
935
+ s.srcObject = n, s.muted = !0, s.playsInline = !0, s.autoplay = !0, await new Promise((t) => {
936
936
  s.onloadedmetadata = () => {
937
937
  s.play(), t();
938
938
  };
939
939
  });
940
940
  const e = s;
941
941
  return await new Promise((t) => {
942
- const a = setTimeout(t, 150), r = () => {
943
- clearTimeout(a), t();
942
+ const i = setTimeout(t, 150), r = () => {
943
+ clearTimeout(i), t();
944
944
  };
945
945
  typeof e.requestVideoFrameCallback == "function" ? e.requestVideoFrameCallback(r) : requestAnimationFrame(() => requestAnimationFrame(() => r()));
946
946
  }), s;
947
- }, ut = (i) => {
948
- const s = new ue(i);
947
+ }, ut = (n) => {
948
+ const s = new ue(n);
949
949
  return s.colorSpace = Le, s.format = de, s.minFilter = q, s.magFilter = q, s.generateMipmaps = !1, s.needsUpdate = !0, s;
950
- }, lt = (i, s) => {
951
- const e = i.videoWidth, t = i.videoHeight;
950
+ }, lt = (n, s) => {
951
+ const e = n.videoWidth, t = n.videoHeight;
952
952
  e > 0 && t > 0 && (s.width !== e && (s.width = e), s.height !== t && (s.height = t));
953
- const a = s.getContext("2d", {
953
+ const i = s.getContext("2d", {
954
954
  colorSpace: "srgb"
955
955
  });
956
- a.save(), a.scale(-1, 1), a.drawImage(i, -s.width, 0, s.width, s.height), a.restore();
957
- }, gt = (i, s, e = 1) => {
956
+ i.save(), i.scale(-1, 1), i.drawImage(n, -s.width, 0, s.width, s.height), i.restore();
957
+ }, gt = (n, s, e = 1) => {
958
958
  const t = s.getContext("2d", {
959
959
  colorSpace: "srgb"
960
- }), a = s.width / s.height, r = i.width / i.height;
960
+ }), i = s.width / s.height, r = n.width / n.height;
961
961
  let o, u;
962
- r > a ? (u = s.height, o = i.width * (s.height / i.height)) : (o = s.width, u = i.height * (s.width / i.width));
962
+ r > i ? (u = s.height, o = n.width * (s.height / n.height)) : (o = s.width, u = n.height * (s.width / n.width));
963
963
  const m = Number.isFinite(e) && e > 0 ? e : 1;
964
964
  o *= m, u *= m;
965
965
  const d = (s.width - o) / 2, S = (s.height - u) / 2;
966
966
  t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, s.width, s.height), t.drawImage(
967
- i,
967
+ n,
968
968
  0,
969
969
  0,
970
- i.width,
971
- i.height,
970
+ n.width,
971
+ n.height,
972
972
  d,
973
973
  S,
974
974
  o,
975
975
  u
976
976
  );
977
- }, mt = (i, s, e) => {
977
+ }, mt = (n) => {
978
+ switch (n instanceof DOMException ? n.name : "") {
979
+ case "NotAllowedError":
980
+ case "PermissionDeniedError":
981
+ return "permission-denied";
982
+ case "NotReadableError":
983
+ case "TrackStartError":
984
+ return "camera-in-use";
985
+ case "NotFoundError":
986
+ case "DevicesNotFoundError":
987
+ return "no-camera";
988
+ case "NotSupportedError":
989
+ case "SecurityError":
990
+ return "unsupported";
991
+ default:
992
+ return n instanceof TypeError ? "unsupported" : "unknown";
993
+ }
994
+ }, ft = {
995
+ "permission-denied": "Camera access was blocked. Allow camera permissions in your browser, then refresh.",
996
+ "camera-in-use": "Camera is already in use by another app or browser tab. Close it and refresh.",
997
+ "no-camera": "No camera was found on this device.",
998
+ unsupported: "Unable to access camera. Allow camera permissions in your browser, then refresh.",
999
+ unknown: "Unable to access camera. Allow camera permissions in your browser, then refresh."
1000
+ }, pt = (n, s, e) => {
978
1001
  const t = /* @__PURE__ */ new Map();
979
- let a = !1;
980
- const r = (g, f) => {
981
- var w;
1002
+ let i = !1;
1003
+ const r = (l, f) => {
1004
+ var v;
982
1005
  try {
983
- (w = f.dispose) == null || w.call(f);
1006
+ (v = f.dispose) == null || v.call(f);
984
1007
  } catch (p) {
985
- console.warn(`[xr-sdk registry] dispose threw for ${g}`, p);
1008
+ console.warn(`[xr-sdk registry] dispose threw for ${l}`, p);
986
1009
  }
987
1010
  };
988
- return { acquire: async (g, f, w) => {
989
- let p = t.get(g);
1011
+ return { acquire: async (l, f, v) => {
1012
+ let p = t.get(l);
990
1013
  if (p)
991
1014
  return p.refs.add(f), p.activeRefs.add(f), p.initPromise;
992
- const k = s[g];
1015
+ const k = s[l];
993
1016
  if (!k)
994
- throw new Error(`Invalid model: ${g}`);
1017
+ throw new Error(`Invalid model: ${l}`);
995
1018
  const C = new k(), L = /* @__PURE__ */ new Set([f]), U = /* @__PURE__ */ new Set([f]), _ = (async () => {
996
- await C.initialize(w);
997
- const B = t.get(g);
1019
+ await C.initialize(v);
1020
+ const B = t.get(l);
998
1021
  if (!B || B.model !== C || B.refs.size === 0)
999
- return r(g, C), C;
1000
- e && await e(g, C);
1001
- const T = t.get(g);
1002
- return T && T.refs.size > 0 && i.setPipeline((P) => P.set(g, C)), C;
1022
+ return r(l, C), C;
1023
+ e && await e(l, C);
1024
+ const T = t.get(l);
1025
+ return T && T.refs.size > 0 && n.setPipeline((P) => P.set(l, C)), C;
1003
1026
  })();
1004
- return p = { model: C, refs: L, activeRefs: U, initPromise: _, options: w }, t.set(g, p), _.catch(() => {
1005
- t.get(g) === p && (t.delete(g), i.setPipeline((T) => T.delete(g))), r(g, C);
1027
+ return p = { model: C, refs: L, activeRefs: U, initPromise: _, options: v }, t.set(l, p), _.catch(() => {
1028
+ t.get(l) === p && (t.delete(l), n.setPipeline((T) => T.delete(l))), r(l, C);
1006
1029
  }), _;
1007
- }, release: (g, f) => {
1008
- const w = t.get(g);
1009
- w && (w.refs.delete(f), w.activeRefs.delete(f) && w.refs.size > 0 && w.activeRefs.size === 0 && w.model.pause(), !(w.refs.size > 0) && (t.delete(g), r(g, w.model), i.setPipeline((p) => p.delete(g))));
1010
- }, setActive: (g, f, w) => {
1011
- const p = t.get(g);
1030
+ }, release: (l, f) => {
1031
+ const v = t.get(l);
1032
+ v && (v.refs.delete(f), v.activeRefs.delete(f) && v.refs.size > 0 && v.activeRefs.size === 0 && v.model.pause(), !(v.refs.size > 0) && (t.delete(l), r(l, v.model), n.setPipeline((p) => p.delete(l))));
1033
+ }, setActive: (l, f, v) => {
1034
+ const p = t.get(l);
1012
1035
  if (!p || !p.refs.has(f)) return;
1013
1036
  const k = p.activeRefs.size > 0;
1014
- w ? p.activeRefs.add(f) : p.activeRefs.delete(f);
1037
+ v ? p.activeRefs.add(f) : p.activeRefs.delete(f);
1015
1038
  const C = p.activeRefs.size > 0;
1016
- k !== C && (C && !a ? p.model.resume() : p.model.pause());
1039
+ k !== C && (C && !i ? p.model.resume() : p.model.pause());
1017
1040
  }, suspendAll: () => {
1018
- a = !0;
1019
- for (const g of t.values())
1020
- g.model.pause();
1041
+ i = !0;
1042
+ for (const l of t.values())
1043
+ l.model.pause();
1021
1044
  }, resumeActive: () => {
1022
- a = !1;
1023
- for (const g of t.values())
1024
- g.activeRefs.size > 0 && g.model.resume();
1025
- }, get: (g) => {
1045
+ i = !1;
1046
+ for (const l of t.values())
1047
+ l.activeRefs.size > 0 && l.model.resume();
1048
+ }, get: (l) => {
1026
1049
  var f;
1027
- return (f = t.get(g)) == null ? void 0 : f.model;
1028
- }, getOptions: (g) => {
1050
+ return (f = t.get(l)) == null ? void 0 : f.model;
1051
+ }, getOptions: (l) => {
1029
1052
  var f;
1030
- return (f = t.get(g)) == null ? void 0 : f.options;
1053
+ return (f = t.get(l)) == null ? void 0 : f.options;
1031
1054
  }, releaseAll: () => {
1032
- for (const g of Array.from(t.keys())) {
1033
- const f = t.get(g);
1034
- f && (f.refs.clear(), t.delete(g), r(g, f.model));
1055
+ for (const l of Array.from(t.keys())) {
1056
+ const f = t.get(l);
1057
+ f && (f.refs.clear(), t.delete(l), r(l, f.model));
1035
1058
  }
1036
- i.setPipeline((g) => g.clear());
1059
+ n.setPipeline((l) => l.clear());
1037
1060
  } };
1038
- }, ft = {
1061
+ }, wt = {
1039
1062
  lifecycle: "idle",
1040
1063
  ready: !1,
1041
1064
  error: void 0,
@@ -1045,73 +1068,73 @@ const re = {
1045
1068
  source: void 0,
1046
1069
  sourceKind: void 0,
1047
1070
  pipeline: /* @__PURE__ */ new Map()
1048
- }, pt = () => {
1049
- let i = { ...ft, pipeline: /* @__PURE__ */ new Map() };
1071
+ }, vt = () => {
1072
+ let n = { ...wt, pipeline: /* @__PURE__ */ new Map() };
1050
1073
  const s = /* @__PURE__ */ new Set(), e = () => {
1051
1074
  s.forEach((t) => t());
1052
1075
  };
1053
1076
  return {
1054
- getSnapshot: () => i,
1077
+ getSnapshot: () => n,
1055
1078
  set: (t) => {
1056
- let a = !1;
1079
+ let i = !1;
1057
1080
  for (const r of Object.keys(t))
1058
- if (t[r] !== i[r]) {
1059
- a = !0;
1081
+ if (t[r] !== n[r]) {
1082
+ i = !0;
1060
1083
  break;
1061
1084
  }
1062
- a && (i = { ...i, ...t }, e());
1085
+ i && (n = { ...n, ...t }, e());
1063
1086
  },
1064
1087
  setPipeline: (t) => {
1065
- const a = new Map(i.pipeline);
1066
- return t(a), i = { ...i, pipeline: a }, e(), a;
1088
+ const i = new Map(n.pipeline);
1089
+ return t(i), n = { ...n, pipeline: i }, e(), i;
1067
1090
  },
1068
1091
  subscribe: (t) => (s.add(t), () => {
1069
1092
  s.delete(t);
1070
1093
  })
1071
1094
  };
1072
- }, vt = ({
1073
- renderHeight: i,
1095
+ }, Ct = ({
1096
+ renderHeight: n,
1074
1097
  renderWidth: s,
1075
1098
  videoHeight: e,
1076
1099
  videoWidth: t
1077
1100
  }) => ({
1078
- height: i || e,
1101
+ height: n || e,
1079
1102
  width: s || t
1080
- }), wt = (i) => {
1081
- const s = new Ve({ verbose: !0 }), e = pt();
1082
- let t = i;
1083
- const a = (n) => {
1084
- var l;
1085
- const c = (l = T.getOptions(n)) == null ? void 0 : l.targetFps;
1103
+ }), St = (n) => {
1104
+ const s = new Ve({ verbose: !0 }), e = vt();
1105
+ let t = n;
1106
+ const i = (a) => {
1107
+ var g;
1108
+ const c = (g = T.getOptions(a)) == null ? void 0 : g.targetFps;
1086
1109
  return typeof c == "number" ? c : t == null ? void 0 : t.targetFps;
1087
1110
  };
1088
- let r, o, u, m, d, S, R, M, x, g, f, w = !1, p = !1, k = 0;
1089
- const C = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), U = (n) => {
1111
+ let r, o, u, m, d, S, R, M, x, l, f, v = !1, p = !1, k = 0;
1112
+ const C = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), U = (a) => {
1090
1113
  const c = e.getSnapshot().cameraTexture;
1091
1114
  c && c.dispose();
1092
- const l = ut(n);
1093
- return e.set({ cameraTexture: l }), l;
1094
- }, _ = async (n, c) => {
1095
- if (C.has(n) || e.getSnapshot().lifecycle !== "running" || !d) return;
1096
- C.add(n);
1097
- const l = k;
1115
+ const g = ut(a);
1116
+ return e.set({ cameraTexture: g }), g;
1117
+ }, _ = async (a, c) => {
1118
+ if (C.has(a) || e.getSnapshot().lifecycle !== "running" || !d) return;
1119
+ C.add(a);
1120
+ const g = k;
1098
1121
  try {
1099
1122
  await c.run({
1100
1123
  sourceCanvas: d,
1101
1124
  renderWidth: e.getSnapshot().renderWidth,
1102
1125
  renderHeight: e.getSnapshot().renderHeight,
1103
1126
  getSource: () => e.getSnapshot().sourceKind,
1104
- targetFps: a(n)
1105
- }), p && (await new Promise((v) => requestAnimationFrame(() => v())), await new Promise((v) => requestAnimationFrame(() => v())), p && k === l && T.suspendAll());
1106
- } catch (v) {
1107
- throw C.delete(n), v;
1127
+ targetFps: i(a)
1128
+ }), p && (await new Promise((w) => requestAnimationFrame(() => w())), await new Promise((w) => requestAnimationFrame(() => w())), p && k === g && T.suspendAll());
1129
+ } catch (w) {
1130
+ throw C.delete(a), w;
1108
1131
  }
1109
- }, T = mt(e, re, (n, c) => _(n, c));
1132
+ }, T = pt(e, re, (a, c) => _(a, c));
1110
1133
  e.subscribe(() => {
1111
1134
  if (e.getSnapshot().lifecycle !== "running") return;
1112
- const n = e.getSnapshot().pipeline;
1113
- for (const [c, l] of n.entries())
1114
- C.has(c) || _(c, l);
1135
+ const a = e.getSnapshot().pipeline;
1136
+ for (const [c, g] of a.entries())
1137
+ C.has(c) || _(c, g);
1115
1138
  });
1116
1139
  const P = () => {
1117
1140
  if (f !== void 0 && (cancelAnimationFrame(f), f = void 0), o) {
@@ -1127,37 +1150,37 @@ const re = {
1127
1150
  }
1128
1151
  if (u) {
1129
1152
  try {
1130
- u.getTracks().forEach((n) => n.stop());
1153
+ u.getTracks().forEach((a) => a.stop());
1131
1154
  } catch {
1132
1155
  }
1133
1156
  u = void 0;
1134
1157
  }
1135
1158
  }, G = () => {
1136
- if (w || !o || !m || !d) return;
1137
- const n = window.__xr_debugger_metrics;
1138
- if (n != null && n.trackCameraFrame && n.trackCameraFrame(), (e.getSnapshot().sourceKind ?? "webcam") === "webcam")
1159
+ if (v || !o || !m || !d) return;
1160
+ const a = window.__xr_debugger_metrics;
1161
+ if (a != null && a.trackCameraFrame && a.trackCameraFrame(), (e.getSnapshot().sourceKind ?? "webcam") === "webcam")
1139
1162
  lt(o, m);
1140
1163
  else {
1141
- const v = m.getContext("2d");
1142
- if (!v) return;
1164
+ const w = m.getContext("2d");
1165
+ if (!w) return;
1143
1166
  const y = o.videoWidth, A = o.videoHeight;
1144
- m.width !== y && (m.width = y), m.height !== A && (m.height = A), v.setTransform(1, 0, 0, 1, 0, 0), v.clearRect(0, 0, y, A), v.drawImage(o, 0, 0, y, A);
1167
+ m.width !== y && (m.width = y), m.height !== A && (m.height = A), w.setTransform(1, 0, 0, 1, 0, 0), w.clearRect(0, 0, y, A), w.drawImage(o, 0, 0, y, A);
1145
1168
  }
1146
1169
  gt(m, d, (t == null ? void 0 : t.cameraZoom) ?? 1.2);
1147
- const l = e.getSnapshot().cameraTexture;
1148
- l && (l.needsUpdate = !0);
1170
+ const g = e.getSnapshot().cameraTexture;
1171
+ g && (g.needsUpdate = !0);
1149
1172
  }, J = () => {
1150
1173
  if (!o || !m || !d) return;
1151
1174
  if (p) {
1152
1175
  G();
1153
1176
  return;
1154
1177
  }
1155
- const n = () => {
1156
- f = requestAnimationFrame(n), G();
1178
+ const a = () => {
1179
+ f = requestAnimationFrame(a), G();
1157
1180
  };
1158
- f = requestAnimationFrame(n);
1159
- }, pe = async (n) => {
1160
- if (n.source === F.WEBCAM)
1181
+ f = requestAnimationFrame(a);
1182
+ }, pe = async (a) => {
1183
+ if (a.source === F.WEBCAM)
1161
1184
  try {
1162
1185
  const c = t != null && t.camRes && t.camRes > 0 ? t.camRes : 960;
1163
1186
  return await navigator.mediaDevices.getUserMedia({
@@ -1168,39 +1191,39 @@ const re = {
1168
1191
  }
1169
1192
  });
1170
1193
  } catch (c) {
1171
- const l = c instanceof DOMException ? c.name : "", v = l === "NotReadableError" || l === "TrackStartError" ? "Camera is already in use by another app or browser tab. Close it and refresh." : l === "NotFoundError" || l === "DevicesNotFoundError" ? "No camera was found on this device." : l === "NotAllowedError" || l === "PermissionDeniedError" ? "Camera access was blocked. Allow camera permissions in your browser, then refresh." : "Unable to access camera. Allow camera permissions in your browser, then refresh.";
1172
- throw e.set({ error: { error: "PermissionError", message: v } }), new b(c instanceof Error ? c.message : "getUserMedia failed");
1194
+ const g = mt(c), w = ft[g];
1195
+ throw e.set({ error: { error: "PermissionError", message: w, reason: g } }), new b(c instanceof Error ? c.message : "getUserMedia failed");
1173
1196
  }
1174
- return n.stream;
1175
- }, W = async (n) => {
1176
- const c = await pe(n);
1197
+ return a.stream;
1198
+ }, W = async (a) => {
1199
+ const c = await pe(a);
1177
1200
  u = c;
1178
- const l = await dt(c);
1179
- o = l, m = new OffscreenCanvas(l.videoWidth, l.videoHeight);
1180
- const { renderWidth: v, renderHeight: y } = e.getSnapshot(), A = vt({
1181
- renderWidth: v,
1201
+ const g = await dt(c);
1202
+ o = g, m = new OffscreenCanvas(g.videoWidth, g.videoHeight);
1203
+ const { renderWidth: w, renderHeight: y } = e.getSnapshot(), A = Ct({
1204
+ renderWidth: w,
1182
1205
  renderHeight: y,
1183
- videoWidth: l.videoWidth,
1184
- videoHeight: l.videoHeight
1206
+ videoWidth: g.videoWidth,
1207
+ videoHeight: g.videoHeight
1185
1208
  });
1186
1209
  d ? (d.width !== A.width || d.height !== A.height) && (d.width = A.width, d.height = A.height, U(d)) : (d = new OffscreenCanvas(A.width, A.height), U(d));
1187
- const ie = n.source === F.STREAM ? n.static === !0 : !1;
1188
- p = ie, r = n.source === F.WEBCAM ? { source: F.WEBCAM, sourceKind: "webcam" } : {
1210
+ const ne = a.source === F.STREAM ? a.static === !0 : !1;
1211
+ p = ne, r = a.source === F.WEBCAM ? { source: F.WEBCAM, sourceKind: "webcam" } : {
1189
1212
  source: F.STREAM,
1190
- stream: n.stream,
1191
- static: ie,
1192
- sourceKind: n.sourceKind ?? "webcam"
1213
+ stream: a.stream,
1214
+ static: ne,
1215
+ sourceKind: a.sourceKind ?? "webcam"
1193
1216
  }, e.set({
1194
- source: n.source,
1217
+ source: a.source,
1195
1218
  sourceKind: r.sourceKind,
1196
1219
  error: void 0
1197
1220
  });
1198
- }, X = async (n) => {
1199
- const c = n.sourceKind ?? "webcam";
1200
- d = n.canvas;
1201
- const l = U(d);
1221
+ }, X = async (a) => {
1222
+ const c = a.sourceKind ?? "webcam";
1223
+ d = a.canvas;
1224
+ const g = U(d);
1202
1225
  e.set({
1203
- cameraTexture: l,
1226
+ cameraTexture: g,
1204
1227
  source: F.CANVAS,
1205
1228
  sourceKind: c,
1206
1229
  renderWidth: d.width,
@@ -1208,110 +1231,110 @@ const re = {
1208
1231
  error: void 0
1209
1232
  }), r = {
1210
1233
  source: F.CANVAS,
1211
- canvas: n.canvas,
1234
+ canvas: a.canvas,
1212
1235
  sourceKind: c
1213
1236
  };
1214
- }, ve = (n, c) => !c || n.source !== c.source ? !1 : n.source === F.STREAM && c.source === F.STREAM ? n.stream === c.stream && (n.sourceKind ?? "webcam") === c.sourceKind : !0, we = async () => {
1237
+ }, we = (a, c) => !c || a.source !== c.source ? !1 : a.source === F.STREAM && c.source === F.STREAM ? a.stream === c.stream && (a.sourceKind ?? "webcam") === c.sourceKind : !0, ve = async () => {
1215
1238
  if (!d) return;
1216
- const n = k, c = e.getSnapshot().pipeline;
1217
- for (const [, l] of c.entries())
1218
- l.resume();
1219
- await new Promise((l) => requestAnimationFrame(() => l())), await new Promise((l) => requestAnimationFrame(() => l())), p && k === n && T.suspendAll();
1220
- }, Ce = (n, c) => !c || c.source !== F.CANVAS ? !1 : n.canvas === c.canvas && (n.sourceKind ?? "webcam") === c.sourceKind, Se = async (n) => {
1221
- const c = n.source;
1239
+ const a = k, c = e.getSnapshot().pipeline;
1240
+ for (const [, g] of c.entries())
1241
+ g.resume();
1242
+ await new Promise((g) => requestAnimationFrame(() => g())), await new Promise((g) => requestAnimationFrame(() => g())), p && k === a && T.suspendAll();
1243
+ }, Ce = (a, c) => !c || c.source !== F.CANVAS ? !1 : a.canvas === c.canvas && (a.sourceKind ?? "webcam") === c.sourceKind, Se = async (a) => {
1244
+ const c = a.source;
1222
1245
  if (c !== F.WEBCAM && c !== F.STREAM)
1223
1246
  throw new b(`Invalid media source: ${String(c)}`);
1224
- if (ve(n, r)) {
1247
+ if (we(a, r)) {
1225
1248
  s.log("Media source unchanged, skipping rebind.");
1226
1249
  return;
1227
1250
  }
1228
1251
  k += 1;
1229
- const { lifecycle: l } = e.getSnapshot();
1230
- if (l === "idle" || l === "stopped") {
1231
- await W(n), e.set({ lifecycle: "media-bound" }), s.log("Media source set to:", n.source);
1252
+ const { lifecycle: g } = e.getSnapshot();
1253
+ if (g === "idle" || g === "stopped") {
1254
+ await W(a), e.set({ lifecycle: "media-bound" }), s.log("Media source set to:", a.source);
1232
1255
  return;
1233
1256
  }
1234
- if (l === "media-bound") {
1235
- P(), await W(n), s.log("Media source rebound to:", n.source);
1257
+ if (g === "media-bound") {
1258
+ P(), await W(a), s.log("Media source rebound to:", a.source);
1236
1259
  return;
1237
1260
  }
1238
- w = !0, await new Promise((v) => requestAnimationFrame(() => v())), P(), await W(n), w = !1, J(), p ? await we() : T.resumeActive(), s.log("Media source swapped to:", n.source);
1239
- }, ke = async (n) => {
1240
- if (Ce(n, r)) {
1261
+ v = !0, await new Promise((w) => requestAnimationFrame(() => w())), P(), await W(a), v = !1, J(), p ? await ve() : T.resumeActive(), s.log("Media source swapped to:", a.source);
1262
+ }, ke = async (a) => {
1263
+ if (Ce(a, r)) {
1241
1264
  s.log("Frame source unchanged, skipping rebind.");
1242
1265
  return;
1243
1266
  }
1244
1267
  k += 1;
1245
1268
  const { lifecycle: c } = e.getSnapshot();
1246
1269
  if (c === "idle" || c === "stopped") {
1247
- await X(n), e.set({ lifecycle: "media-bound" }), s.log("Frame source set to canvas.");
1270
+ await X(a), e.set({ lifecycle: "media-bound" }), s.log("Frame source set to canvas.");
1248
1271
  return;
1249
1272
  }
1250
1273
  if (c === "media-bound") {
1251
- P(), await X(n), s.log("Frame source rebound to canvas.");
1274
+ P(), await X(a), s.log("Frame source rebound to canvas.");
1252
1275
  return;
1253
1276
  }
1254
- w = !0, await new Promise((l) => requestAnimationFrame(() => l())), P(), await X(n), w = !1, s.log("Frame source swapped to canvas.");
1277
+ v = !0, await new Promise((g) => requestAnimationFrame(() => g())), P(), await X(a), v = !1, s.log("Frame source swapped to canvas.");
1255
1278
  }, ye = async () => {
1256
- const { lifecycle: n } = e.getSnapshot();
1257
- if (n === "running") return;
1258
- if (n === "idle")
1279
+ const { lifecycle: a } = e.getSnapshot();
1280
+ if (a === "running") return;
1281
+ if (a === "idle")
1259
1282
  throw new b("session.start() called before setMediaSource — call setMediaSource first");
1260
1283
  if (!d)
1261
1284
  throw new b("session.start(): media source not bound");
1262
1285
  const c = (r == null ? void 0 : r.source) === F.CANVAS;
1263
1286
  if (!c && (!o || !m))
1264
- throw n === "stopped" ? new b(
1287
+ throw a === "stopped" ? new b(
1265
1288
  "session.start() called from stopped state without a media source — call setMediaSource first"
1266
1289
  ) : new b("session.start(): media source not bound");
1267
- c || J(), T.resumeActive(), e.set({ lifecycle: "running" }), await new Promise((v) => requestAnimationFrame(() => v()));
1268
- const l = e.getSnapshot().pipeline;
1269
- for (const [v, y] of l.entries())
1270
- await _(v, y);
1290
+ c || J(), T.resumeActive(), e.set({ lifecycle: "running" }), await new Promise((w) => requestAnimationFrame(() => w()));
1291
+ const g = e.getSnapshot().pipeline;
1292
+ for (const [w, y] of g.entries())
1293
+ await _(w, y);
1271
1294
  e.set({ ready: !0 }), s.log("XR session started.");
1272
1295
  }, ee = async () => {
1273
- const { lifecycle: n } = e.getSnapshot();
1274
- n === "stopped" || n === "idle" || (P(), T.suspendAll(), e.set({ lifecycle: "stopped", ready: !1 }), s.log("XR session stopped."));
1296
+ const { lifecycle: a } = e.getSnapshot();
1297
+ a === "stopped" || a === "idle" || (P(), T.suspendAll(), e.set({ lifecycle: "stopped", ready: !1 }), s.log("XR session stopped."));
1275
1298
  }, Me = async () => {
1276
1299
  await ee(), T.releaseAll(), L.clear();
1277
- const n = e.getSnapshot().cameraTexture;
1278
- n && n.dispose(), C.clear(), r = void 0, k += 1, d = void 0, m = void 0, p = !1, e.set({
1300
+ const a = e.getSnapshot().cameraTexture;
1301
+ a && a.dispose(), C.clear(), r = void 0, k += 1, d = void 0, m = void 0, p = !1, e.set({
1279
1302
  lifecycle: "idle",
1280
1303
  cameraTexture: void 0,
1281
1304
  source: void 0
1282
1305
  }), s.log("XR session reset.");
1283
- }, Re = async (n) => {
1284
- const c = "legacy:registerXRPipeline", l = [];
1306
+ }, Re = async (a) => {
1307
+ const c = "legacy:registerXRPipeline", g = [];
1285
1308
  await Promise.all(
1286
- n.map(async (v) => {
1287
- const { model: y } = v;
1309
+ a.map(async (w) => {
1310
+ const { model: y } = w;
1288
1311
  if (!re[y])
1289
1312
  throw new b(`Invalid model: ${y}`);
1290
- L.has(y) || l.push(y);
1291
- const A = "options" in v ? v.options : void 0;
1313
+ L.has(y) || g.push(y);
1314
+ const A = "options" in w ? w.options : void 0;
1292
1315
  await T.acquire(y, c, A);
1293
1316
  })
1294
- ), l.length > 0 && (l.forEach((v) => L.add(v)), s.log("XR pipeline registered."));
1295
- }, Te = (n) => {
1296
- const c = T.get(n);
1317
+ ), g.length > 0 && (g.forEach((w) => L.add(w)), s.log("XR pipeline registered."));
1318
+ }, Te = (a) => {
1319
+ const c = T.get(a);
1297
1320
  if (!c)
1298
- throw new b(`Model ${n} is not registered in the pipeline`);
1321
+ throw new b(`Model ${a} is not registered in the pipeline`);
1299
1322
  return c.getModelNode();
1300
- }, te = async (n, c) => {
1301
- n <= 0 || c <= 0 || (e.set({ renderWidth: n, renderHeight: c }), d && (d.width !== n || d.height !== c) && (d.width = n, d.height = c, U(d), p && G()), s.log(`Source canvas set. Render size: ${n}x${c}`));
1302
- }, xe = async (n) => {
1323
+ }, te = async (a, c) => {
1324
+ a <= 0 || c <= 0 || (e.set({ renderWidth: a, renderHeight: c }), d && (d.width !== a || d.height !== c) && (d.width = a, d.height = c, U(d), p && G()), s.log(`Source canvas set. Render size: ${a}x${c}`));
1325
+ }, xe = async (a) => {
1303
1326
  var y;
1304
- S = n;
1305
- const c = (y = n.getBoundingClientRect) == null ? void 0 : y.call(n), l = c && c.width > 0 ? Math.round(c.width) : n.clientWidth, v = c && c.height > 0 ? Math.round(c.height) : n.clientHeight;
1306
- await te(l, v);
1307
- }, Fe = (n) => {
1308
- R = n.renderer, M = n.scene, x = n.camera, g = n.renderFrame;
1327
+ S = a;
1328
+ const c = (y = a.getBoundingClientRect) == null ? void 0 : y.call(a), g = c && c.width > 0 ? Math.round(c.width) : a.clientWidth, w = c && c.height > 0 ? Math.round(c.height) : a.clientHeight;
1329
+ await te(g, w);
1330
+ }, Fe = (a) => {
1331
+ R = a.renderer, M = a.scene, x = a.camera, l = a.renderFrame;
1309
1332
  }, se = () => {
1310
1333
  if (!R || !M || !x)
1311
1334
  throw new b(
1312
1335
  "XR frame render requested before the R3F state was bound — make sure <XRScene> is mounted"
1313
1336
  );
1314
- g ? g() : R.render(M, x);
1337
+ l ? l() : R.render(M, x);
1315
1338
  };
1316
1339
  return {
1317
1340
  store: e,
@@ -1340,59 +1363,59 @@ const re = {
1340
1363
  _setR3FState: Fe,
1341
1364
  _renderFrame: se,
1342
1365
  _getVideoElement: () => o,
1343
- _setPerf: (n) => {
1344
- if (t = n, e.getSnapshot().lifecycle !== "running" || !d) return;
1366
+ _setPerf: (a) => {
1367
+ if (t = a, e.getSnapshot().lifecycle !== "running" || !d) return;
1345
1368
  const c = e.getSnapshot().pipeline;
1346
- for (const [l, v] of c.entries())
1347
- v.run({
1369
+ for (const [g, w] of c.entries())
1370
+ w.run({
1348
1371
  sourceCanvas: d,
1349
1372
  renderWidth: e.getSnapshot().renderWidth,
1350
1373
  renderHeight: e.getSnapshot().renderHeight,
1351
1374
  getSource: () => e.getSnapshot().sourceKind,
1352
- targetFps: a(l)
1375
+ targetFps: i(g)
1353
1376
  });
1354
1377
  }
1355
1378
  };
1356
- }, Ct = (i) => {
1357
- const s = oe(i), e = $(() => wt(s.current), []), t = JSON.stringify(i ?? {});
1379
+ }, kt = (n) => {
1380
+ const s = oe(n), e = $(() => St(s.current), []), t = JSON.stringify(n ?? {});
1358
1381
  return Ee(() => {
1359
- e._setPerf(i);
1382
+ e._setPerf(n);
1360
1383
  }, [e, t]), e;
1361
- }, Q = /* @__PURE__ */ new Map(), St = () => ({
1362
- register: (i, s) => {
1363
- s ? Q.set(i, s) : Q.delete(i);
1384
+ }, Q = /* @__PURE__ */ new Map(), yt = () => ({
1385
+ register: (n, s) => {
1386
+ s ? Q.set(n, s) : Q.delete(n);
1364
1387
  },
1365
- resolve: (i) => i ? Q.get(i) ?? null : null
1366
- }), le = St(), ge = he(null), kt = ({ children: i }) => {
1367
- const s = oe(/* @__PURE__ */ new Map()), e = ae((r, o) => {
1388
+ resolve: (n) => n ? Q.get(n) ?? null : null
1389
+ }), le = yt(), ge = he(null), Mt = ({ children: n }) => {
1390
+ const s = oe(/* @__PURE__ */ new Map()), e = ie((r, o) => {
1368
1391
  o ? s.current.set(r, o) : s.current.delete(r);
1369
- }, []), t = ae(
1392
+ }, []), t = ie(
1370
1393
  (r) => r ? s.current.get(r) ?? null : null,
1371
1394
  []
1372
- ), a = $(() => ({ register: e, resolve: t }), [e, t]);
1373
- return Ie(ge.Provider, { value: a }, i);
1374
- }, me = () => ce(ge) ?? le, Dt = () => me().register, _t = () => me().resolve;
1395
+ ), i = $(() => ({ register: e, resolve: t }), [e, t]);
1396
+ return Ie(ge.Provider, { value: i }, n);
1397
+ }, me = () => ce(ge) ?? le, Pt = () => me().register, Ot = () => me().resolve;
1375
1398
  le.register;
1376
- const fe = he(void 0), Pt = () => {
1377
- const i = ce(fe);
1378
- if (!i)
1399
+ const fe = he(void 0), Ut = () => {
1400
+ const n = ce(fe);
1401
+ if (!n)
1379
1402
  throw new b(
1380
1403
  "XR context can only be used inside XRProvider, did you forget to wrap your app in <XRProvider>?"
1381
1404
  );
1382
- return i;
1383
- }, Ot = ({ children: i, perf: s }) => {
1384
- const e = Ct(s), t = $(() => ({ session: e }), [e]);
1385
- return /* @__PURE__ */ ne(fe.Provider, { value: t, children: /* @__PURE__ */ ne(kt, { children: i }) });
1405
+ return n;
1406
+ }, zt = ({ children: n, perf: s }) => {
1407
+ const e = kt(s), t = $(() => ({ session: e }), [e]);
1408
+ return /* @__PURE__ */ ae(fe.Provider, { value: t, children: /* @__PURE__ */ ae(Mt, { children: n }) });
1386
1409
  };
1387
1410
  export {
1388
1411
  z as X,
1389
1412
  H as a,
1390
- It as b,
1413
+ _t as b,
1391
1414
  F as c,
1392
- Ot as d,
1393
- _t as e,
1415
+ zt as d,
1416
+ Ot as e,
1394
1417
  He as f,
1395
- Dt as g,
1418
+ Pt as g,
1396
1419
  I as l,
1397
- Pt as u
1420
+ Ut as u
1398
1421
  };