@vincentt-xr/sdk 2.0.0-alpha.0 → 2.0.0-alpha.1

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 (106) hide show
  1. package/GROUNDING.md +232 -14
  2. package/dist/{DebuggerUI-CEfdddkZ.cjs → DebuggerUI-CatYc-RG.cjs} +1 -1
  3. package/dist/{DebuggerUI-Dgop6Q6o.js → DebuggerUI-gLMKiVwJ.js} +1 -1
  4. package/dist/MediaSourceSwitcher-C-xYg0nQ.js +317 -0
  5. package/dist/MediaSourceSwitcher-Cq3g4IKw.cjs +31 -0
  6. package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +6 -1
  7. package/dist/components/FaceMesh/material/defaults.d.ts +4 -0
  8. package/dist/components/FaceMesh/material/types.d.ts +2 -0
  9. package/dist/components/FaceRetouch/Background.d.ts +6 -1
  10. package/dist/components/FaceRetouch/defaults.d.ts +13 -0
  11. package/dist/components/FaceRetouch/index.d.ts +3 -1
  12. package/dist/components/FaceRetouch/landmarkMask.d.ts +4 -1
  13. package/dist/components/FaceRetouch/useFaceRetouchMask.d.ts +2 -1
  14. package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +15 -0
  15. package/dist/components/FaceWarp3D/defaults.d.ts +37 -0
  16. package/dist/components/FaceWarp3D/index.d.ts +3 -0
  17. package/dist/components/FaceWarp3D/warp.d.ts +13 -0
  18. package/dist/components/HandJoints2D/index.d.ts +6 -0
  19. package/dist/components/HandTracker/index.d.ts +2 -2
  20. package/dist/components/HandTracking2D/HandVisual.d.ts +12 -0
  21. package/dist/components/HandTracking2D/index.d.ts +5 -0
  22. package/dist/components/HandTracking2DController/index.d.ts +5 -0
  23. package/dist/components/HandTracking3D/index.d.ts +6 -0
  24. package/dist/components/ScreenImage/index.d.ts +87 -0
  25. package/dist/components/ScreenText/index.d.ts +20 -0
  26. package/dist/components/TextLabel/index.d.ts +99 -0
  27. package/dist/components/XRScene/index.d.ts +14 -3
  28. package/dist/components/XRViewport/index.d.ts +17 -0
  29. package/dist/components/index.d.ts +7 -0
  30. package/dist/debug-ui/default-setting/index.d.ts +37 -0
  31. package/dist/debug-ui/default-setting.cjs +21 -0
  32. package/dist/debug-ui/default-setting.js +777 -0
  33. package/dist/debug-ui/face-warp-3d/index.d.ts +6 -0
  34. package/dist/debug-ui/hand-joints-2d/index.d.ts +6 -0
  35. package/dist/debug-ui/hand-tracking-2d/index.d.ts +6 -0
  36. package/dist/debug-ui/hand-tracking-2d-controller/index.d.ts +6 -0
  37. package/dist/debug-ui/hand-tracking-3d/index.d.ts +6 -0
  38. package/dist/debug-ui/index.d.ts +23 -0
  39. package/dist/debug-ui/layer-panel/index.d.ts +17 -0
  40. package/dist/debug-ui/media-source/MediaSourceSwitcher.d.ts +10 -0
  41. package/dist/debug-ui/media-source/index.d.ts +4 -0
  42. package/dist/debug-ui/media-source/media-preset.d.ts +9 -0
  43. package/dist/debug-ui/media-source.cjs +1 -0
  44. package/dist/debug-ui/media-source.js +7 -0
  45. package/dist/debug-ui/screen-image-settings/index.d.ts +7 -0
  46. package/dist/debug-ui/screen-text-settings/index.d.ts +122 -0
  47. package/dist/debug-ui/settings-panel/index.d.ts +38 -0
  48. package/dist/debug-ui/shared/MaterialSection.d.ts +13 -0
  49. package/dist/debug-ui/shared/ScreenTransformSection.d.ts +29 -0
  50. package/dist/debug-ui.cjs +20 -0
  51. package/dist/debug-ui.js +6063 -0
  52. package/dist/defaults-BLpcN3pG.cjs +1 -0
  53. package/dist/defaults-LtY4M7dg.js +55 -0
  54. package/dist/entries/core.d.ts +5 -1
  55. package/dist/entries/face-effects.d.ts +2 -0
  56. package/dist/entries/low-level.d.ts +3 -0
  57. package/dist/face-effects.cjs +113 -23
  58. package/dist/face-effects.js +1566 -1399
  59. package/dist/handJoints2d.d.ts +49 -0
  60. package/dist/handTracking2d.d.ts +33 -0
  61. package/dist/handTracking2dController.d.ts +65 -0
  62. package/dist/handTracking3d.d.ts +52 -0
  63. package/dist/{index-BD-JWMjE.js → index-BGNbrc4C.js} +113 -137
  64. package/dist/index-BXyObVHF.cjs +1 -0
  65. package/dist/index-CY3bUAcW.js +12 -0
  66. package/dist/index-C_Duh13c.cjs +1 -0
  67. package/dist/index-D8fpPQkC.cjs +1 -0
  68. package/dist/index-DxshgBu0.cjs +1 -0
  69. package/dist/index-O-2crZ3M.js +1102 -0
  70. package/dist/{index-CYMj26Ej.js → index-safCs_af.js} +426 -416
  71. package/dist/{internal-DH5d1Xnq.cjs → internal-BjyhBP8i.cjs} +1 -1
  72. package/dist/{internal-KOKJDxCG.js → internal-Cae1ps15.js} +3 -3
  73. package/dist/internal.cjs +1 -1
  74. package/dist/internal.js +2 -2
  75. package/dist/layerStack.d.ts +29 -0
  76. package/dist/low-level.cjs +1 -1
  77. package/dist/low-level.js +74 -890
  78. package/dist/main.cjs +73 -1
  79. package/dist/main.js +1656 -407
  80. package/dist/models/Hand/HandTracking.d.ts +2 -0
  81. package/dist/screen2d/index.d.ts +4 -0
  82. package/dist/screen2d/material-runtime.d.ts +32 -0
  83. package/dist/screen2d/texture.d.ts +10 -0
  84. package/dist/screen2d/transform.d.ts +25 -0
  85. package/dist/screen2d/types.d.ts +90 -0
  86. package/dist/screenImagePresets.d.ts +13 -0
  87. package/dist/screenImageSettings-6NRg4cx9.js +39 -0
  88. package/dist/screenImageSettings-y_B4_767.cjs +1 -0
  89. package/dist/screenImageSettings.d.ts +50 -0
  90. package/dist/screenTextPresets.d.ts +6 -0
  91. package/dist/screenTextSettings.d.ts +131 -0
  92. package/dist/{selectors-Bub0o3qy.cjs → selectors-BLl2JUWW.cjs} +1 -1
  93. package/dist/{selectors-BHO6TnoC.js → selectors-CXd_x-6t.js} +6 -6
  94. package/dist/tracking.cjs +1 -1
  95. package/dist/tracking.js +193 -168
  96. package/dist/types/hand-tracking.d.ts +8 -0
  97. package/dist/types/nodes.d.ts +2 -0
  98. package/dist/useXRModel-3DcUa28n.cjs +1 -0
  99. package/dist/useXRModel-BMJE1hrk.js +28 -0
  100. package/dist/x-Co8jPhP0.js +127 -0
  101. package/dist/x-KC8E4Gaj.cjs +41 -0
  102. package/package.json +19 -1
  103. package/dist/index-B5J4gzn2.cjs +0 -1
  104. package/dist/index-BVBVg96G.cjs +0 -1
  105. package/dist/index-DtwHElmG.js +0 -157
  106. package/dist/index-PtFmD6B8.cjs +0 -1
@@ -0,0 +1,1102 @@
1
+ import { jsx as m, jsxs as k, Fragment as j } from "react/jsx-runtime";
2
+ import { createContext as K, useContext as G, useMemo as W, useEffect as T, useRef as M, useState as E, useCallback as Ie, useLayoutEffect as Me, Children as De, isValidElement as Ae } from "react";
3
+ import { R as de, u as ue, X as he } from "./index-safCs_af.js";
4
+ import * as I from "three";
5
+ import { u as fe } from "./useFaceResults-cpsSmKKc.js";
6
+ import { u as ke } from "./useXRModel-BMJE1hrk.js";
7
+ import { u as Le, a as Xe, d as _e } from "./selectors-CXd_x-6t.js";
8
+ import { Canvas as ze, useThree as We, useFrame as Ne } from "@react-three/fiber";
9
+ const Ve = K(null), Be = () => {
10
+ const e = G(Ve);
11
+ if (!e)
12
+ throw new Error("useScreenSpace must be used within ScreenSpaceUI");
13
+ return e;
14
+ }, me = K(null), St = () => G(me) ?? 1, He = (e, t, o, l, n) => {
15
+ const i = e / 2, s = t / 2, r = o.left * i + l.left, c = o.right * i - l.right, d = o.bottom * s + l.bottom, u = o.top * s - l.top, a = c - r, g = u - d, h = (r + c) / 2, p = (d + u) / 2, w = n[0] * a / 2, F = n[1] * g / 2;
16
+ return { centerX: h, centerY: p, width: a, height: g, pivotX: w, pivotY: F };
17
+ }, Ue = { left: 0, right: 0, top: 0, bottom: 0 }, qe = { left: 0, right: 0, top: 0, bottom: 0 }, $e = [0, 0], Rt = ({
18
+ anchors: e,
19
+ offsets: t,
20
+ pivot: o = $e,
21
+ children: l
22
+ }) => {
23
+ const { width: n, height: i } = Be(), s = W(
24
+ () => ({
25
+ anchors: { ...Ue, ...e ?? {} },
26
+ offsets: { ...qe, ...t ?? {} }
27
+ }),
28
+ [e, t]
29
+ ), r = W(
30
+ () => He(n, i, s.anchors, s.offsets, o),
31
+ [n, i, s, o]
32
+ );
33
+ T(() => {
34
+ const a = s.anchors;
35
+ a.left > a.right && console.warn(
36
+ `[ScreenTransform] inverted X axis: anchors.left (${a.left}) > anchors.right (${a.right})`
37
+ ), a.bottom > a.top && console.warn(
38
+ `[ScreenTransform] inverted Y axis: anchors.bottom (${a.bottom}) > anchors.top (${a.top})`
39
+ ), r.width <= 0 && console.warn(
40
+ `[ScreenTransform] zero or negative width (${r.width.toFixed(3)}) — anchors + offsets collapse the X extent`
41
+ ), r.height <= 0 && console.warn(
42
+ `[ScreenTransform] zero or negative height (${r.height.toFixed(3)}) — anchors + offsets collapse the Y extent`
43
+ );
44
+ }, [s, r.width, r.height]);
45
+ const c = o[0] !== 0 || o[1] !== 0, d = c ? [1, 1, 1] : [r.width, r.height, 1], u = !c && r.width > 0 && r.height > 0 ? r.width / r.height : null;
46
+ return /* @__PURE__ */ m(
47
+ "group",
48
+ {
49
+ position: [r.centerX - r.pivotX, r.centerY - r.pivotY, 0],
50
+ scale: d,
51
+ renderOrder: de.SCREEN_UI,
52
+ children: /* @__PURE__ */ m(me.Provider, { value: u, children: l })
53
+ }
54
+ );
55
+ }, ee = ({
56
+ canvas: e,
57
+ layout: t,
58
+ media: o,
59
+ mirrored: l,
60
+ filter: n
61
+ }) => {
62
+ const i = Math.round(t.destination.width), s = Math.round(t.destination.height);
63
+ e.width !== i && (e.width = i), e.height !== s && (e.height = s);
64
+ const r = e.getContext("2d");
65
+ r && (r.setTransform(1, 0, 0, 1, 0, 0), r.clearRect(0, 0, i, s), l && (r.translate(i, 0), r.scale(-1, 1)), n && (r.filter = n), r.drawImage(o, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), n && (r.filter = "none"), r.setTransform(1, 0, 0, 1, 0, 0));
66
+ }, Ye = 5, je = 1, Ke = (e, t) => t, Ge = "brightness(2.2) contrast(1.5) saturate(1.25)", Pe = ({
67
+ enabled: e,
68
+ displayMirrored: t,
69
+ imageRef: o,
70
+ layout: l,
71
+ mode: n,
72
+ numFaces: i,
73
+ selectedSource: s,
74
+ sourceStream: r,
75
+ videoRef: c
76
+ }) => {
77
+ const { session: d } = ue(), u = M(null), a = M(!1), g = M(document.createElement("canvas")), {
78
+ ready: h,
79
+ node: p,
80
+ error: w
81
+ } = ke(he.FACE_TRACKER, {
82
+ numFaces: i ?? (n === "head-binding" ? je : Ye)
83
+ }), [F, C] = E("idle"), [S, y] = E(null), D = e && h && !!p, L = fe({
84
+ node: D ? p : null,
85
+ enabled: D,
86
+ selectedSource: s,
87
+ onFrame: Ie(() => {
88
+ y(null), C("ready");
89
+ }, [])
90
+ });
91
+ return T(() => {
92
+ if (!e || !l) return;
93
+ const b = () => {
94
+ const v = s === "image" ? o.current : c.current;
95
+ if (v) {
96
+ if (v instanceof HTMLImageElement) {
97
+ if (!v.complete || v.naturalWidth <= 0 || v.naturalHeight <= 0) return;
98
+ } else if (v.readyState < 2 || v.videoWidth <= 0 || v.videoHeight <= 0)
99
+ return;
100
+ ee({
101
+ canvas: g.current,
102
+ layout: l,
103
+ media: v,
104
+ mirrored: t,
105
+ filter: s === "webcam" ? Ge : void 0
106
+ });
107
+ }
108
+ };
109
+ if (s === "image") {
110
+ b();
111
+ return;
112
+ }
113
+ let f = 0;
114
+ const x = () => {
115
+ f = requestAnimationFrame(x), b();
116
+ };
117
+ return f = requestAnimationFrame(x), () => cancelAnimationFrame(f);
118
+ }, [t, e, o, l, s, c]), T(() => {
119
+ var _;
120
+ if (!e) {
121
+ C("idle"), y(null), a.current = !1, u.current = null;
122
+ return;
123
+ }
124
+ if (!l) {
125
+ C("initializing");
126
+ return;
127
+ }
128
+ const b = (r == null ? void 0 : r.id) ?? (((_ = c.current) == null ? void 0 : _.srcObject) instanceof MediaStream ? c.current.srcObject.id : "none"), x = s === "webcam" ? `webcam:${b}` : s;
129
+ u.current !== x && (a.current = !1, u.current = x);
130
+ let v = !1;
131
+ return (async () => {
132
+ try {
133
+ if (C("initializing"), a.current || (await d.setFrameSource({
134
+ canvas: g.current,
135
+ sourceKind: s
136
+ }), await d.start(), a.current = !0), v) return;
137
+ y(null), C("initializing");
138
+ } catch (z) {
139
+ if (v) return;
140
+ C("error"), y(z instanceof Error ? z.message : "Failed to initialize SDK face tracking");
141
+ }
142
+ })(), () => {
143
+ v = !0;
144
+ };
145
+ }, [e, l, s, d, r, c]), T(() => {
146
+ !D && e && !w && C("initializing");
147
+ }, [D, e, w]), T(() => {
148
+ w && (C("error"), y(w.message));
149
+ }, [w]), T(() => () => {
150
+ a.current = !1, d.stop();
151
+ }, [d]), {
152
+ activeDelegate: "GPU",
153
+ faces: L,
154
+ status: F,
155
+ error: S
156
+ };
157
+ }, Y = ({
158
+ children: e,
159
+ config: t,
160
+ style: o
161
+ }) => /* @__PURE__ */ m(
162
+ "div",
163
+ {
164
+ "data-render-target": t.name,
165
+ style: {
166
+ position: "absolute",
167
+ inset: 0,
168
+ overflow: "hidden",
169
+ background: t.clearColor,
170
+ pointerEvents: t.pointerEvents ?? "none",
171
+ zIndex: t.zIndex,
172
+ opacity: t.hidden ? 0 : 1,
173
+ ...o
174
+ },
175
+ children: e
176
+ }
177
+ ), ge = ({
178
+ canvasRef: e,
179
+ enabled: t = !0,
180
+ fps: o = 30,
181
+ imageRef: l,
182
+ layout: n,
183
+ mirrored: i,
184
+ sourceKind: s,
185
+ videoRef: r
186
+ }) => {
187
+ T(() => {
188
+ if (!t) {
189
+ const g = e.current, h = g == null ? void 0 : g.getContext("2d");
190
+ g && h && h.clearRect(0, 0, g.width, g.height);
191
+ return;
192
+ }
193
+ let c = 0, d = 0;
194
+ const u = o > 0 ? 1e3 / o : 0, a = (g) => {
195
+ if (c = requestAnimationFrame(a), u > 0 && g - d < u) return;
196
+ d = g;
197
+ const h = e.current;
198
+ if (!h || !n) return;
199
+ if (s === "image") {
200
+ const w = l.current;
201
+ if (!w || !w.complete || w.naturalWidth <= 0 || w.naturalHeight <= 0)
202
+ return;
203
+ ee({
204
+ canvas: h,
205
+ layout: n,
206
+ media: w,
207
+ mirrored: i
208
+ });
209
+ return;
210
+ }
211
+ const p = r.current;
212
+ !p || p.readyState < 2 || p.videoWidth <= 0 || p.videoHeight <= 0 || ee({
213
+ canvas: h,
214
+ layout: n,
215
+ media: p,
216
+ mirrored: i
217
+ });
218
+ };
219
+ return c = requestAnimationFrame(a), () => {
220
+ cancelAnimationFrame(c);
221
+ };
222
+ }, [e, t, o, l, n, i, s, r]);
223
+ }, Je = ({
224
+ canvasRef: e,
225
+ imageRef: t,
226
+ layer: o,
227
+ layout: l,
228
+ mirrored: n,
229
+ sourceKind: i,
230
+ videoRef: s
231
+ }) => (ge({
232
+ canvasRef: e,
233
+ imageRef: t,
234
+ layout: l,
235
+ mirrored: n,
236
+ sourceKind: i,
237
+ videoRef: s
238
+ }), /* @__PURE__ */ m(Y, { config: o, children: /* @__PURE__ */ m(
239
+ "canvas",
240
+ {
241
+ ref: e,
242
+ style: {
243
+ position: "absolute",
244
+ inset: 0,
245
+ width: "100%",
246
+ height: "100%",
247
+ display: "block",
248
+ background: "#000"
249
+ }
250
+ }
251
+ ) })), Et = ({
252
+ canvasRef: e,
253
+ controlInsetTop: t,
254
+ debugVisible: o,
255
+ fps: l = 15,
256
+ imageRef: n,
257
+ layer: i,
258
+ layout: s,
259
+ mirrored: r,
260
+ sourceKind: c,
261
+ videoRef: d,
262
+ viewportSize: u
263
+ }) => {
264
+ ge({
265
+ canvasRef: e,
266
+ enabled: o,
267
+ fps: l,
268
+ imageRef: n,
269
+ layout: s,
270
+ mirrored: r,
271
+ sourceKind: c,
272
+ videoRef: d
273
+ });
274
+ const a = Math.min(220, Math.max(120, u.width * 0.22)), g = u.width > 0 && u.height > 0 ? u.width / u.height : 1, h = Math.min(u.height - 24, Math.max(t ?? 16, 16));
275
+ return /* @__PURE__ */ m(Y, { config: i, children: /* @__PURE__ */ m(
276
+ "canvas",
277
+ {
278
+ ref: e,
279
+ style: {
280
+ position: "absolute",
281
+ left: 16,
282
+ top: h,
283
+ width: o ? a : 1,
284
+ height: o ? "auto" : 1,
285
+ aspectRatio: `${g}`,
286
+ opacity: o ? 0.85 : 0,
287
+ borderRadius: 10,
288
+ border: o ? "1px solid rgba(255,255,255,0.16)" : "none",
289
+ pointerEvents: "none",
290
+ objectFit: "contain",
291
+ background: "#000"
292
+ }
293
+ }
294
+ ) });
295
+ }, pe = {
296
+ display: "flex",
297
+ alignItems: "center",
298
+ justifyContent: "center",
299
+ height: "100%",
300
+ background: "#363636",
301
+ color: "white",
302
+ fontFamily: "monospace"
303
+ }, Qe = () => /* @__PURE__ */ m("div", { style: pe, children: "Loading..." }), Ze = (e) => /* @__PURE__ */ m("div", { style: pe, children: e.error }), oe = {
304
+ position: "absolute",
305
+ top: 0,
306
+ left: 0,
307
+ width: "100%",
308
+ height: "100%",
309
+ zIndex: 10
310
+ }, ie = {
311
+ sceneColorTexture: null,
312
+ sceneDepthTexture: null
313
+ }, Oe = ({
314
+ onRenderOutputs: e,
315
+ renderOutputs: t,
316
+ size: o
317
+ }) => {
318
+ const { camera: l, gl: n, scene: i, size: s } = We(), r = Math.max(1, Math.round((o == null ? void 0 : o.width) ?? s.width)), c = Math.max(1, Math.round((o == null ? void 0 : o.height) ?? s.height)), d = !!(t.sceneColor || t.sceneDepth), u = W(() => {
319
+ if (!d) return null;
320
+ const a = new I.WebGLRenderTarget(r, c, {
321
+ colorSpace: I.SRGBColorSpace,
322
+ depthBuffer: !0,
323
+ stencilBuffer: !1
324
+ });
325
+ return t.sceneDepth && (a.depthTexture = new I.DepthTexture(r, c), a.depthTexture.format = I.DepthFormat, a.depthTexture.type = I.UnsignedShortType), a;
326
+ }, [d, c, t.sceneDepth, r]);
327
+ return T(() => {
328
+ if (!u) {
329
+ e == null || e(ie);
330
+ return;
331
+ }
332
+ return e == null || e({
333
+ sceneColorTexture: t.sceneColor ? u.texture : null,
334
+ sceneDepthTexture: t.sceneDepth && u.depthTexture ? u.depthTexture : null
335
+ }), () => {
336
+ var a;
337
+ u.dispose(), (a = u.depthTexture) == null || a.dispose(), e == null || e(ie);
338
+ };
339
+ }, [e, t.sceneColor, t.sceneDepth, u]), Ne(() => {
340
+ if (!u) return;
341
+ const a = [];
342
+ t.excludeScreenUI !== !1 && i.traverse((p) => {
343
+ p.visible && p.renderOrder >= de.SCREEN_UI && (a.push(p), p.visible = !1);
344
+ });
345
+ const g = n.getRenderTarget(), h = n.xr.enabled;
346
+ n.xr.enabled = !1, n.setRenderTarget(u), n.clear(), n.render(i, l), n.setRenderTarget(g), n.xr.enabled = h, a.forEach((p) => {
347
+ p.visible = !0;
348
+ });
349
+ }, -100), null;
350
+ }, et = ({
351
+ style: e,
352
+ canvasProps: t,
353
+ children: o,
354
+ loadingComponent: l,
355
+ loadingTransitionDuration: n,
356
+ errorComponent: i,
357
+ renderTargetSize: s,
358
+ renderOutputs: r = {},
359
+ onRenderOutputs: c
360
+ }) => {
361
+ const d = M(null), u = M(null), a = M(null), g = M(!1), { session: h } = ue(), p = Le(), w = Xe(), [F, C] = E(!0);
362
+ return T(() => {
363
+ if (s) {
364
+ h._setRenderSize(
365
+ Math.round(s.width),
366
+ Math.round(s.height)
367
+ );
368
+ return;
369
+ }
370
+ const S = (b, f) => {
371
+ b <= 0 || f <= 0 || h._setRenderSize(Math.round(b), Math.round(f));
372
+ }, y = () => {
373
+ !u.current || g.current || (g.current = !0, h._setRenderTarget(u.current));
374
+ }, D = (b, f) => {
375
+ a.current !== null && cancelAnimationFrame(a.current), a.current = requestAnimationFrame(() => {
376
+ a.current = null, S(b, f);
377
+ });
378
+ }, L = new ResizeObserver((b) => {
379
+ const f = b[0];
380
+ if (!f) return;
381
+ const { width: x, height: v } = f.contentRect;
382
+ y(), D(x, v);
383
+ });
384
+ return d.current && L.observe(d.current), y(), () => {
385
+ L.disconnect(), a.current !== null && (cancelAnimationFrame(a.current), a.current = null), g.current = !1;
386
+ };
387
+ }, [s, h]), T(() => {
388
+ p && (n ? setTimeout(() => {
389
+ C(!1);
390
+ }, n) : C(!1));
391
+ }, [p, n]), /* @__PURE__ */ k(
392
+ "div",
393
+ {
394
+ id: "vincentt-xr-container",
395
+ ref: d,
396
+ style: {
397
+ width: "100%",
398
+ height: "100%",
399
+ ...e,
400
+ position: "relative"
401
+ },
402
+ children: [
403
+ F && /* @__PURE__ */ m("div", { style: oe, children: l || /* @__PURE__ */ m(Qe, {}) }),
404
+ w && /* @__PURE__ */ m("div", { style: oe, children: i || /* @__PURE__ */ m(Ze, { error: w.message }) }),
405
+ /* @__PURE__ */ k(
406
+ ze,
407
+ {
408
+ id: "vincentt-xr-canvas",
409
+ ref: u,
410
+ dpr: [1, 3],
411
+ gl: {
412
+ alpha: !0,
413
+ // Keep the framebuffer transient by default so resize/layout changes
414
+ // do not leave an old frame hanging around. Apps that need capture
415
+ // can opt back in via `canvasProps.gl`.
416
+ preserveDrawingBuffer: !1,
417
+ antialias: !0,
418
+ premultipliedAlpha: !1,
419
+ // Disable alpha premultiplication
420
+ toneMapping: I.NoToneMapping
421
+ // Disable tone mapping for accurate video colors
422
+ },
423
+ ...t,
424
+ onCreated: (S) => {
425
+ s ? h._setRenderSize(
426
+ Math.round(s.width),
427
+ Math.round(s.height)
428
+ ) : h._setRenderTarget(u.current), h._setR3FState({
429
+ renderer: S.gl,
430
+ scene: S.scene,
431
+ camera: S.camera
432
+ }), S.gl.outputColorSpace = I.SRGBColorSpace, t != null && t.onCreated && t.onCreated(S);
433
+ },
434
+ children: [
435
+ /* @__PURE__ */ m(
436
+ Oe,
437
+ {
438
+ onRenderOutputs: c,
439
+ renderOutputs: r,
440
+ size: s
441
+ }
442
+ ),
443
+ o
444
+ ]
445
+ }
446
+ )
447
+ ]
448
+ }
449
+ );
450
+ }, be = K(null), we = K(null), tt = {
451
+ audio: !1,
452
+ video: {
453
+ facingMode: "user",
454
+ frameRate: { ideal: 30, max: 60 }
455
+ }
456
+ }, rt = {
457
+ name: "viewport-live",
458
+ clearColor: "#000000",
459
+ pointerEvents: "none",
460
+ zIndex: 0
461
+ }, nt = {
462
+ name: "viewport-ui",
463
+ clearColor: "transparent",
464
+ pointerEvents: "auto",
465
+ zIndex: 5
466
+ }, ot = {
467
+ name: "viewport-scene",
468
+ clearColor: "transparent",
469
+ pointerEvents: "auto",
470
+ zIndex: 1
471
+ }, N = {
472
+ webcam: { icon: "◉", label: "Webcam" },
473
+ image: { icon: "▣", label: "Images" },
474
+ video: { icon: "▶", label: "Videos" }
475
+ }, te = ({ children: e }) => /* @__PURE__ */ m(j, { children: e });
476
+ te.displayName = "XRViewport.Scene";
477
+ const re = ({ children: e }) => /* @__PURE__ */ m(j, { children: e });
478
+ re.displayName = "XRViewport.Overlay";
479
+ const it = (e) => {
480
+ if (!e)
481
+ return { width: 0, height: 0 };
482
+ const t = e.getBoundingClientRect();
483
+ return {
484
+ width: t.width || e.clientWidth,
485
+ height: t.height || e.clientHeight
486
+ };
487
+ }, at = (e) => {
488
+ const [t, o] = E({ width: 0, height: 0 });
489
+ return Me(() => {
490
+ const l = e.current;
491
+ if (!l) return;
492
+ let n = 0;
493
+ const i = () => {
494
+ const d = it(l);
495
+ o(
496
+ (u) => u.width === d.width && u.height === d.height ? u : d
497
+ );
498
+ };
499
+ i(), n = requestAnimationFrame(i);
500
+ const s = new ResizeObserver(() => {
501
+ i(), n && cancelAnimationFrame(n), n = requestAnimationFrame(i);
502
+ });
503
+ s.observe(l);
504
+ const r = window.visualViewport, c = () => {
505
+ i(), n && cancelAnimationFrame(n), n = requestAnimationFrame(i);
506
+ };
507
+ return window.addEventListener("resize", c), window.addEventListener("orientationchange", c), r == null || r.addEventListener("resize", c), r == null || r.addEventListener("scroll", c), () => {
508
+ n && cancelAnimationFrame(n), s.disconnect(), window.removeEventListener("resize", c), window.removeEventListener("orientationchange", c), r == null || r.removeEventListener("resize", c), r == null || r.removeEventListener("scroll", c);
509
+ };
510
+ }, [e]), t;
511
+ }, ae = (e) => {
512
+ e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
513
+ }, se = (e) => {
514
+ e && e.removeAttribute("src");
515
+ }, st = ({
516
+ enabled: e,
517
+ imageAsset: t,
518
+ selectedSource: o,
519
+ videoAsset: l
520
+ }) => {
521
+ const n = M(null), i = M(null), [s, r] = E(null), [c, d] = E({ width: 0, height: 0 }), [u, a] = E("idle"), [g, h] = E(null);
522
+ return T(() => {
523
+ if (!e) {
524
+ ae(n.current), se(i.current), r(null), d({ width: 0, height: 0 }), a("idle"), h(null);
525
+ return;
526
+ }
527
+ let p = !1, w = null;
528
+ const F = (b, f) => {
529
+ p || (d({ width: b, height: f }), a("ready"), h(null));
530
+ }, C = () => {
531
+ ae(n.current), se(i.current), w == null || w.getTracks().forEach((b) => b.stop()), w = null, r(null);
532
+ }, S = async () => {
533
+ a("requesting");
534
+ const b = await navigator.mediaDevices.getUserMedia(tt);
535
+ if (p) {
536
+ b.getTracks().forEach((x) => x.stop());
537
+ return;
538
+ }
539
+ w = b, r(b);
540
+ const f = n.current;
541
+ f && (f.srcObject = b, f.muted = !0, f.playsInline = !0, f.autoplay = !0, await f.play(), F(f.videoWidth, f.videoHeight));
542
+ }, y = async (b) => {
543
+ a("requesting"), r(null);
544
+ const f = n.current;
545
+ f && (f.src = b, f.muted = !0, f.loop = !0, f.playsInline = !0, f.autoplay = !0, f.crossOrigin = "anonymous", await f.play(), F(f.videoWidth, f.videoHeight));
546
+ }, D = async (b) => {
547
+ a("requesting"), r(null);
548
+ const f = i.current;
549
+ f && (await new Promise((x, v) => {
550
+ f.onload = () => x(), f.onerror = () => v(new Error("Unable to load image")), f.src = b;
551
+ }), F(f.naturalWidth, f.naturalHeight));
552
+ };
553
+ return C(), (async () => {
554
+ try {
555
+ if (o === "webcam") {
556
+ await S();
557
+ return;
558
+ }
559
+ if (o === "video") {
560
+ if (!(l != null && l.src))
561
+ throw new Error("Missing video source");
562
+ await y(l.src);
563
+ return;
564
+ }
565
+ if (!(t != null && t.src))
566
+ throw new Error("Missing image source");
567
+ await D(t.src);
568
+ } catch (b) {
569
+ if (p) return;
570
+ a("error"), h(b instanceof Error ? b.message : `Unable to initialize ${o}`);
571
+ }
572
+ })(), () => {
573
+ p = !0, C();
574
+ };
575
+ }, [e, t, o, l]), {
576
+ videoRef: n,
577
+ imageRef: i,
578
+ stream: s,
579
+ mediaSize: c,
580
+ status: u,
581
+ error: g
582
+ };
583
+ }, lt = ({
584
+ enabled: e,
585
+ imageRef: t,
586
+ selectedSource: o,
587
+ status: l,
588
+ videoRef: n
589
+ }) => {
590
+ const [i, s] = E(null);
591
+ return T(() => {
592
+ if (!e || l !== "ready") {
593
+ s((d) => (d == null || d.dispose(), null));
594
+ return;
595
+ }
596
+ const r = o === "image" ? t.current : n.current;
597
+ if (!r) return;
598
+ const c = o === "image" ? new I.Texture(r) : new I.VideoTexture(r);
599
+ return c.colorSpace = I.SRGBColorSpace, c.minFilter = I.LinearFilter, c.magFilter = I.LinearFilter, c.generateMipmaps = !1, c.needsUpdate = !0, s((d) => (d == null || d.dispose(), c)), () => {
600
+ c.dispose();
601
+ };
602
+ }, [e, t, o, l, n]), i;
603
+ }, ct = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, dt = ({
604
+ imageOptions: e,
605
+ initialImageId: t,
606
+ initialSource: o,
607
+ initialVideoId: l,
608
+ source: n,
609
+ videoOptions: i
610
+ }) => {
611
+ var u, a, g, h;
612
+ const s = (n == null ? void 0 : n.kind) ?? o ?? "webcam", r = s === "image" && e.length === 0 || s === "video" && i.length === 0 ? "webcam" : s, c = (n == null ? void 0 : n.kind) === "image" ? n.assetId ?? ((u = e[0]) == null ? void 0 : u.id) ?? "" : t ?? ((a = e[0]) == null ? void 0 : a.id) ?? "", d = (n == null ? void 0 : n.kind) === "video" ? n.assetId ?? ((g = i[0]) == null ? void 0 : g.id) ?? "" : l ?? ((h = i[0]) == null ? void 0 : h.id) ?? "";
613
+ return {
614
+ selectedSource: r,
615
+ selectedImageId: c,
616
+ selectedVideoId: d
617
+ };
618
+ }, ut = (e, t, o) => {
619
+ if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
620
+ return null;
621
+ const l = o === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), n = e.width * l, i = e.height * l, s = (t.width - n) * 0.5, r = (t.height - i) * 0.5;
622
+ return {
623
+ source: e,
624
+ destination: t,
625
+ drawWidth: n,
626
+ drawHeight: i,
627
+ offsetX: s,
628
+ offsetY: r,
629
+ scale: l
630
+ };
631
+ }, ht = (e, t) => {
632
+ if (e === "dom")
633
+ return {
634
+ sceneContent: null,
635
+ overlayContent: t
636
+ };
637
+ let o = null, l = null;
638
+ const n = [];
639
+ return De.forEach(t, (i) => {
640
+ var r;
641
+ if (!Ae(i)) {
642
+ i != null && n.push(i);
643
+ return;
644
+ }
645
+ const s = (r = i.type) == null ? void 0 : r.displayName;
646
+ if (s === te.displayName) {
647
+ o = i.props.children;
648
+ return;
649
+ }
650
+ if (s === re.displayName) {
651
+ l = i.props.children;
652
+ return;
653
+ }
654
+ n.push(i);
655
+ }), !l && n.length > 0 && (l = n), {
656
+ sceneContent: o,
657
+ overlayContent: l
658
+ };
659
+ }, le = (e, t) => typeof e == "function" ? e(t) : e, Tt = () => G(be), Ft = () => G(we), ft = ({
660
+ imageRef: e,
661
+ selectedSource: t,
662
+ videoRef: o
663
+ }) => /* @__PURE__ */ k(j, { children: [
664
+ /* @__PURE__ */ m(
665
+ "video",
666
+ {
667
+ ref: o,
668
+ style: {
669
+ position: "absolute",
670
+ width: 1,
671
+ height: 1,
672
+ opacity: t === "image" ? 0 : 1e-3,
673
+ pointerEvents: "none"
674
+ }
675
+ }
676
+ ),
677
+ /* @__PURE__ */ m(
678
+ "img",
679
+ {
680
+ ref: e,
681
+ alt: "",
682
+ style: {
683
+ position: "absolute",
684
+ width: 1,
685
+ height: 1,
686
+ opacity: t === "image" ? 1e-3 : 0,
687
+ pointerEvents: "none"
688
+ }
689
+ }
690
+ )
691
+ ] }), ce = ({
692
+ dock: e,
693
+ label: t,
694
+ onChange: o,
695
+ options: l,
696
+ value: n
697
+ }) => /* @__PURE__ */ m(
698
+ "div",
699
+ {
700
+ style: {
701
+ position: "absolute",
702
+ top: e === "top-left" ? 74 : void 0,
703
+ bottom: e === "bottom-left" ? 74 : void 0,
704
+ left: 16,
705
+ zIndex: 5,
706
+ maxWidth: "calc(100vw - 32px)",
707
+ padding: 10,
708
+ borderRadius: 14,
709
+ background: "rgba(15, 23, 42, 0.72)",
710
+ border: "1px solid rgba(255,255,255,0.12)",
711
+ boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
712
+ backdropFilter: "blur(10px)"
713
+ },
714
+ children: /* @__PURE__ */ k(
715
+ "label",
716
+ {
717
+ style: {
718
+ display: "grid",
719
+ gap: 6,
720
+ color: "#e5eefb",
721
+ fontSize: 12,
722
+ fontWeight: 700
723
+ },
724
+ children: [
725
+ /* @__PURE__ */ m("span", { children: t }),
726
+ /* @__PURE__ */ m(
727
+ "select",
728
+ {
729
+ value: n,
730
+ onChange: (i) => o(i.target.value),
731
+ style: {
732
+ minWidth: 180,
733
+ maxWidth: "calc(100vw - 52px)",
734
+ height: 36,
735
+ borderRadius: 10,
736
+ border: "1px solid rgba(255,255,255,0.12)",
737
+ background: "rgba(255,255,255,0.06)",
738
+ color: "#e5eefb",
739
+ padding: "0 10px"
740
+ },
741
+ children: l.map((i) => /* @__PURE__ */ m("option", { value: i.id, style: { color: "#111827" }, children: i.label }, i.id))
742
+ }
743
+ )
744
+ ]
745
+ }
746
+ )
747
+ }
748
+ ), mt = ({
749
+ dock: e,
750
+ imageOptions: t,
751
+ selectedImageId: o,
752
+ selectedSource: l,
753
+ selectedVideoId: n,
754
+ setSelectedImageId: i,
755
+ setSelectedSource: s,
756
+ setSelectedVideoId: r,
757
+ showMediaControls: c,
758
+ videoOptions: d
759
+ }) => {
760
+ const [u, a] = E(!1), g = ["webcam", "image", "video"].filter((h) => h === "image" ? t.length > 0 : h === "video" ? d.length > 0 : !0);
761
+ return c ? u ? /* @__PURE__ */ m(
762
+ "button",
763
+ {
764
+ type: "button",
765
+ onClick: () => a(!1),
766
+ "aria-label": "Open media controls",
767
+ title: "Open media controls",
768
+ style: {
769
+ position: "absolute",
770
+ top: e === "top-left" ? 16 : void 0,
771
+ bottom: e === "bottom-left" ? 16 : void 0,
772
+ left: 16,
773
+ zIndex: 5,
774
+ width: 40,
775
+ height: 40,
776
+ border: "1px solid rgba(255,255,255,0.12)",
777
+ borderRadius: 999,
778
+ background: "rgba(15, 23, 42, 0.72)",
779
+ color: "#e5eefb",
780
+ boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
781
+ backdropFilter: "blur(10px)",
782
+ cursor: "pointer"
783
+ },
784
+ children: "≡"
785
+ }
786
+ ) : /* @__PURE__ */ k(j, { children: [
787
+ /* @__PURE__ */ k(
788
+ "div",
789
+ {
790
+ style: {
791
+ position: "absolute",
792
+ top: e === "top-left" ? 16 : void 0,
793
+ bottom: e === "bottom-left" ? 16 : void 0,
794
+ left: 16,
795
+ zIndex: 5,
796
+ display: "inline-flex",
797
+ alignItems: "center",
798
+ gap: 8,
799
+ maxWidth: "calc(100vw - 32px)"
800
+ },
801
+ children: [
802
+ /* @__PURE__ */ m(
803
+ "div",
804
+ {
805
+ style: {
806
+ display: "inline-flex",
807
+ alignItems: "center",
808
+ gap: 8,
809
+ padding: 8,
810
+ borderRadius: 999,
811
+ background: "rgba(15, 23, 42, 0.72)",
812
+ border: "1px solid rgba(255,255,255,0.12)",
813
+ boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
814
+ backdropFilter: "blur(10px)",
815
+ overflowX: "auto"
816
+ },
817
+ children: g.map((h) => {
818
+ const p = h === l;
819
+ return /* @__PURE__ */ k(
820
+ "button",
821
+ {
822
+ type: "button",
823
+ onClick: () => s(h),
824
+ "aria-pressed": p,
825
+ title: N[h].label,
826
+ style: {
827
+ border: "none",
828
+ borderRadius: 999,
829
+ minWidth: 42,
830
+ height: 42,
831
+ padding: "0 12px",
832
+ display: "inline-flex",
833
+ alignItems: "center",
834
+ justifyContent: "center",
835
+ gap: 8,
836
+ background: p ? "rgba(56, 189, 248, 0.18)" : "rgba(255,255,255,0.04)",
837
+ color: p ? "#e0f2fe" : "rgba(229,238,251,0.82)",
838
+ cursor: "pointer",
839
+ flex: "0 0 auto"
840
+ },
841
+ children: [
842
+ /* @__PURE__ */ m("span", { style: { fontSize: 14, lineHeight: 1 }, children: N[h].icon }),
843
+ /* @__PURE__ */ m("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: N[h].label })
844
+ ]
845
+ },
846
+ h
847
+ );
848
+ })
849
+ }
850
+ ),
851
+ /* @__PURE__ */ m(
852
+ "button",
853
+ {
854
+ type: "button",
855
+ onClick: () => a(!0),
856
+ "aria-label": "Close media controls",
857
+ title: "Close media controls",
858
+ style: {
859
+ width: 40,
860
+ height: 40,
861
+ border: "1px solid rgba(255,255,255,0.12)",
862
+ borderRadius: 999,
863
+ background: "rgba(15, 23, 42, 0.72)",
864
+ color: "#e5eefb",
865
+ boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
866
+ backdropFilter: "blur(10px)",
867
+ cursor: "pointer",
868
+ flex: "0 0 auto"
869
+ },
870
+ children: "×"
871
+ }
872
+ )
873
+ ]
874
+ }
875
+ ),
876
+ l === "image" && t.length > 0 && /* @__PURE__ */ m(
877
+ ce,
878
+ {
879
+ dock: e,
880
+ label: "Image Asset",
881
+ options: t,
882
+ value: o,
883
+ onChange: i
884
+ }
885
+ ),
886
+ l === "video" && d.length > 0 && /* @__PURE__ */ m(
887
+ ce,
888
+ {
889
+ dock: e,
890
+ label: "Video Asset",
891
+ options: d,
892
+ value: n,
893
+ onChange: r
894
+ }
895
+ )
896
+ ] }) : null;
897
+ }, gt = ({
898
+ enabled: e,
899
+ selectedSource: t
900
+ }) => {
901
+ const o = _e(he.FACE_TRACKER);
902
+ return {
903
+ faces: fe({ node: o, enabled: e, selectedSource: t }),
904
+ trackerStatus: o ? "ready" : "idle"
905
+ };
906
+ }, xe = ({
907
+ children: e,
908
+ fitMode: t = "auto",
909
+ imageOptions: o = [],
910
+ initialImageId: l,
911
+ initialMirrored: n = !0,
912
+ initialSource: i = "webcam",
913
+ initialVideoId: s,
914
+ mediaStrategy: r = "internal",
915
+ mediaDock: c = "bottom-left",
916
+ mode: d = "dom",
917
+ previewMode: u = "finalColor",
918
+ renderOutputs: a = {},
919
+ showMediaControlsByDefault: g = !0,
920
+ source: h,
921
+ style: p,
922
+ videoOptions: w = []
923
+ }) => {
924
+ const F = M(null), C = M(null), S = at(F), y = W(
925
+ () => dt({
926
+ imageOptions: o,
927
+ initialImageId: l,
928
+ initialSource: i,
929
+ initialVideoId: s,
930
+ source: h,
931
+ videoOptions: w
932
+ }),
933
+ [o, l, i, s, h, w]
934
+ ), [D, L] = E(n), [b, f] = E(g), [x, v] = E(
935
+ y.selectedSource
936
+ ), [V, _] = E(y.selectedImageId), [z, P] = E(y.selectedVideoId), [X, ve] = E({
937
+ sceneColorTexture: null,
938
+ sceneDepthTexture: null
939
+ }), A = r === "internal";
940
+ T(() => {
941
+ h && (v(y.selectedSource), _(y.selectedImageId), P(y.selectedVideoId));
942
+ }, [y, h]);
943
+ const B = o.find((O) => O.id === V) ?? o[0], H = w.find((O) => O.id === z) ?? w[0], R = st({
944
+ enabled: A,
945
+ imageAsset: B,
946
+ selectedSource: x,
947
+ videoAsset: H
948
+ }), J = ct(t, x), U = W(
949
+ () => ut(R.mediaSize, S, J),
950
+ [R.mediaSize, J, S]
951
+ ), Q = lt({
952
+ enabled: !!(a.mediaColor || a.finalColor),
953
+ imageRef: R.imageRef,
954
+ selectedSource: x,
955
+ status: R.status,
956
+ videoRef: R.videoRef
957
+ }), Z = Ke(x, D), q = Pe({
958
+ displayMirrored: Z,
959
+ enabled: A && R.status === "ready" && U !== null,
960
+ imageRef: R.imageRef,
961
+ layout: U,
962
+ selectedSource: x,
963
+ sourceStream: R.stream,
964
+ videoRef: R.videoRef
965
+ }), ne = gt({
966
+ enabled: !A,
967
+ selectedSource: x
968
+ }), ye = x === "image" ? `${N.image.label}: ${(B == null ? void 0 : B.label) ?? ""}` : x === "video" ? `${N.video.label}: ${(H == null ? void 0 : H.label) ?? ""}` : N.webcam.label, $ = {
969
+ activeDelegate: A ? q.activeDelegate : null,
970
+ faces: A ? q.faces : ne.faces,
971
+ imageOptions: o,
972
+ layout: U,
973
+ mediaError: R.error,
974
+ mediaFitMode: J,
975
+ mediaLabel: ye,
976
+ mediaStatus: R.status,
977
+ mirrored: Z,
978
+ selectedImageId: V,
979
+ selectedSource: x,
980
+ selectedVideoId: z,
981
+ setMirrored: L,
982
+ setSelectedImageId: _,
983
+ setSelectedSource: v,
984
+ setSelectedVideoId: P,
985
+ setShowMediaControls: f,
986
+ showMediaControls: b,
987
+ trackerError: A ? q.error : null,
988
+ trackerStatus: A ? q.status : ne.trackerStatus,
989
+ videoOptions: w,
990
+ viewportSize: S,
991
+ mediaSize: R.mediaSize
992
+ }, Ce = W(
993
+ () => ({
994
+ requested: a,
995
+ previewMode: u,
996
+ mediaColorTexture: Q,
997
+ sceneColorTexture: X.sceneColorTexture,
998
+ finalColorTexture: a.finalColor ? X.sceneColorTexture : null,
999
+ sceneDepthTexture: X.sceneDepthTexture,
1000
+ estimatedDepthTexture: null,
1001
+ available: {
1002
+ mediaColor: Q !== null,
1003
+ sceneColor: X.sceneColorTexture !== null,
1004
+ finalColor: !!(a.finalColor && X.sceneColorTexture),
1005
+ sceneDepth: X.sceneDepthTexture !== null,
1006
+ estimatedDepth: !1
1007
+ }
1008
+ }),
1009
+ [Q, u, a, X]
1010
+ ), Se = typeof e == "function" ? e($) : e, { sceneContent: Re, overlayContent: Ee } = ht(d, Se), Te = le(
1011
+ Re,
1012
+ $
1013
+ ), Fe = le(
1014
+ Ee,
1015
+ $
1016
+ );
1017
+ return /* @__PURE__ */ m(be.Provider, { value: $, children: /* @__PURE__ */ m(we.Provider, { value: Ce, children: /* @__PURE__ */ k(
1018
+ "div",
1019
+ {
1020
+ ref: F,
1021
+ style: {
1022
+ position: "fixed",
1023
+ inset: 0,
1024
+ overflow: "hidden",
1025
+ background: "#000",
1026
+ ...p
1027
+ },
1028
+ children: [
1029
+ /* @__PURE__ */ m(
1030
+ ft,
1031
+ {
1032
+ imageRef: R.imageRef,
1033
+ selectedSource: x,
1034
+ videoRef: R.videoRef
1035
+ }
1036
+ ),
1037
+ d === "dom" && A && /* @__PURE__ */ m(
1038
+ Je,
1039
+ {
1040
+ canvasRef: C,
1041
+ imageRef: R.imageRef,
1042
+ videoRef: R.videoRef,
1043
+ layer: rt,
1044
+ layout: U,
1045
+ mirrored: Z,
1046
+ sourceKind: x === "image" ? "image" : "video"
1047
+ }
1048
+ ),
1049
+ (d === "r3f" || d === "hybrid") && /* @__PURE__ */ m(Y, { config: ot, children: /* @__PURE__ */ m(
1050
+ et,
1051
+ {
1052
+ onRenderOutputs: ve,
1053
+ renderOutputs: {
1054
+ sceneColor: a.sceneColor || a.finalColor,
1055
+ sceneDepth: a.sceneDepth
1056
+ },
1057
+ renderTargetSize: S,
1058
+ style: { width: "100%", height: "100%" },
1059
+ children: Te
1060
+ }
1061
+ ) }),
1062
+ /* @__PURE__ */ k(Y, { config: nt, children: [
1063
+ A && /* @__PURE__ */ m(
1064
+ mt,
1065
+ {
1066
+ dock: c,
1067
+ imageOptions: o,
1068
+ selectedImageId: V,
1069
+ selectedSource: x,
1070
+ selectedVideoId: z,
1071
+ setSelectedImageId: _,
1072
+ setSelectedSource: v,
1073
+ setSelectedVideoId: P,
1074
+ showMediaControls: b,
1075
+ videoOptions: w
1076
+ }
1077
+ ),
1078
+ Fe
1079
+ ] })
1080
+ ]
1081
+ }
1082
+ ) }) });
1083
+ };
1084
+ xe.Scene = te;
1085
+ xe.Overlay = re;
1086
+ export {
1087
+ me as S,
1088
+ Y as X,
1089
+ Je as a,
1090
+ xe as b,
1091
+ He as c,
1092
+ Et as d,
1093
+ Tt as e,
1094
+ Ft as f,
1095
+ Pe as g,
1096
+ Ve as h,
1097
+ St as i,
1098
+ Rt as j,
1099
+ et as k,
1100
+ Ke as r,
1101
+ Be as u
1102
+ };