@vincentt-xr/sdk 2.0.0-alpha.6 → 2.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GROUNDING.md +81 -3
- package/dist/{DebuggerUI-DYT_dk1E.cjs → DebuggerUI-B6bP6P9r.cjs} +1 -1
- package/dist/{DebuggerUI-C_rbLdkh.js → DebuggerUI-BjOMr8q_.js} +1 -1
- package/dist/{FaceMeshRenderer-D1WsrTLA.cjs → FaceMeshRenderer-C5l6VLdO.cjs} +6 -6
- package/dist/{FaceMeshRenderer-DSCd1H55.js → FaceMeshRenderer-wjAHrJzP.js} +102 -96
- package/dist/{FaceRetouch-DsE0Dbw-.cjs → FaceRetouch-BkJzoA79.cjs} +1 -1
- package/dist/{FaceRetouch-CMJbGThL.js → FaceRetouch-DwbKQJAN.js} +4 -4
- package/dist/components/FaceMesh/FaceMeshRenderer.d.ts +11 -3
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +10 -4
- package/dist/components/FaceMesh/index.d.ts +2 -2
- package/dist/components/SceneObjectRenderer/index.d.ts +9 -2
- package/dist/components/XRMediaSurface/index.d.ts +2 -1
- package/dist/{contexts-DvQI4PqI.js → contexts-ByhzppYl.js} +3 -3
- package/dist/{contexts-h-9TRH0r.cjs → contexts-Dr62It_K.cjs} +1 -1
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui.cjs +1 -1
- package/dist/debug-ui.js +10 -10
- package/dist/entries/core.d.ts +3 -2
- package/dist/entries/face-effects.d.ts +2 -2
- package/dist/entries/tracking.d.ts +2 -0
- package/dist/face-effects.cjs +1 -1
- package/dist/face-effects.js +25 -24
- package/dist/{getFaceInfo-B43Cwq4n.js → getFaceInfo-C4QpCQIY.js} +1 -1
- package/dist/{getFaceInfo-DEzcL_Ub.cjs → getFaceInfo-fA1bFBub.cjs} +1 -1
- package/dist/hooks/useXRSession/facade.d.ts +2 -0
- package/dist/{index-I4eF5TKT.js → index-9dlAQAhy.js} +405 -400
- package/dist/{index-CY7Z8cHV.cjs → index-BjmTe9eM.cjs} +1 -1
- package/dist/{index-D67hHm44.cjs → index-BpEf2BBb.cjs} +1 -1
- package/dist/{index-B-s4YbWu.js → index-ByoNj0QP.js} +1 -1
- package/dist/{index-CxMEeCRP.cjs → index-CyUUurQT.cjs} +1 -1
- package/dist/index-DCiMbxC3.cjs +1 -0
- package/dist/{index-G_5h_FJQ.js → index-DXT3WccE.js} +808 -787
- package/dist/index-DpI-qo5X.cjs +17 -0
- package/dist/{index-DYfY9ljy.js → index-DyVF4vEW.js} +1 -1
- package/dist/{index-uE3sKczj.js → index-VJ0SJwmG.js} +1 -1
- package/dist/{internal-MvKrz0Nt.cjs → internal-Cq-TEQ5Y.cjs} +1 -1
- package/dist/{internal-ldPYiUF0.js → internal-Dmk1cTXq.js} +3 -3
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +1 -1
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +344 -330
- package/dist/main.cjs +1 -1
- package/dist/main.js +94 -91
- package/dist/{renderGroups-BJsx32q5.cjs → renderGroups-80H3DpTl.cjs} +1 -1
- package/dist/{renderGroups-CFt1yYLB.js → renderGroups-KZk6eRiY.js} +1 -1
- package/dist/{renderPasses-D-Krl6D0.cjs → renderPasses-BOoBSr8z.cjs} +1 -1
- package/dist/{renderPasses-C72MbZ-a.js → renderPasses-BcquyVtu.js} +4 -4
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/screen2d/coordinates.d.ts +20 -0
- package/dist/{selectors-ByKNTXeA.js → selectors-B8H97CKA.js} +1 -1
- package/dist/{selectors-CAwmL9VW.cjs → selectors-CZLKT2Iv.cjs} +1 -1
- package/dist/{session-CANvoLD6.cjs → session-CpkiK5YA.cjs} +1 -1
- package/dist/{session-Dhi0OqZo.js → session-DLFN_VII.js} +1 -1
- package/dist/tracking/coordinates.d.ts +5 -0
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +69 -66
- package/dist/types/common.d.ts +11 -1
- package/dist/types/gesture-tracking.d.ts +2 -2
- package/dist/types/hand-tracking.d.ts +3 -3
- package/dist/types/nodes.d.ts +2 -2
- package/dist/types/session.d.ts +7 -1
- package/dist/{useFaceInfo-BSZq7AO1.cjs → useFaceInfo-BJ8-_MOs.cjs} +1 -1
- package/dist/{useFaceInfo-FVQBBNdY.js → useFaceInfo-Dk426LTu.js} +3 -3
- package/dist/{useFaceResults-D62STzT1.js → useFaceResults-CtetsO9M.js} +1 -1
- package/dist/{useFaceResults-C3oZkn2Z.cjs → useFaceResults-wBJF3zyp.cjs} +1 -1
- package/docs/SDK_DOCUMENTATION.md +3 -0
- package/docs/api/capture-recording.mdx +9 -1
- package/docs/api/face-mesh.mdx +33 -0
- package/docs/api/runtime-3d.mdx +5 -0
- package/docs/api/screen-image.mdx +3 -1
- package/docs/api/screen-space-coordinates.mdx +31 -0
- package/docs/api/trackers.mdx +13 -0
- package/package.json +4 -1
- package/dist/index-C0-fg1Hk.cjs +0 -1
- package/dist/index-DPPpU5By.cjs +0 -17
package/dist/low-level.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { u as le } from "./index-
|
|
3
|
-
import { H as
|
|
4
|
-
import { c as
|
|
5
|
-
import { u as mt, b as ft, e as pt, a as gt, d as bt } from "./selectors-
|
|
6
|
-
import { useEffect as
|
|
7
|
-
import { c as fe } from "./getFaceInfo-
|
|
8
|
-
import { d as xt, e as vt } from "./getFaceInfo-
|
|
9
|
-
import { jsx as g, jsxs as k, Fragment as
|
|
1
|
+
import { u as O, X as ee } from "./index-9dlAQAhy.js";
|
|
2
|
+
import { u as le } from "./index-ByoNj0QP.js";
|
|
3
|
+
import { H as ct, a as ut } from "./index-ByoNj0QP.js";
|
|
4
|
+
import { c as de } from "./selectors-B8H97CKA.js";
|
|
5
|
+
import { u as mt, b as ft, e as pt, a as gt, d as bt } from "./selectors-B8H97CKA.js";
|
|
6
|
+
import { useEffect as z, useState as C, useRef as X, useCallback as ce, useLayoutEffect as ue, useMemo as $, Children as he, isValidElement as me } from "react";
|
|
7
|
+
import { c as fe } from "./getFaceInfo-C4QpCQIY.js";
|
|
8
|
+
import { d as xt, e as vt } from "./getFaceInfo-C4QpCQIY.js";
|
|
9
|
+
import { jsx as g, jsxs as k, Fragment as _ } from "react/jsx-runtime";
|
|
10
10
|
import { PerspectiveCamera as pe } from "@react-three/drei";
|
|
11
|
-
import { S as
|
|
12
|
-
import { u as
|
|
13
|
-
import { h as
|
|
14
|
-
import { X as ge, a as be, b as we } from "./contexts-
|
|
15
|
-
import { B as zt, M as Xt, h as kt, i as At, T as Lt, c as Vt, j as Dt, k as Bt, g as
|
|
11
|
+
import { S as yt, g as Ct, c as Rt, d as It, u as Et } from "./index-VJ0SJwmG.js";
|
|
12
|
+
import { u as te } from "./useFaceResults-CtetsO9M.js";
|
|
13
|
+
import { h as Mt } from "./hasFullUnitUVBounds-BGvcFsQM.js";
|
|
14
|
+
import { X as ge, a as be, b as we } from "./contexts-ByhzppYl.js";
|
|
15
|
+
import { B as zt, M as Xt, h as kt, i as At, T as Lt, c as Vt, j as Dt, k as Bt, g as _t, e as Wt, f as Ht, r as Pt, t as $t, d as qt, u as Ut } from "./contexts-ByhzppYl.js";
|
|
16
16
|
import * as L from "three";
|
|
17
17
|
const B = ({
|
|
18
18
|
children: e,
|
|
@@ -39,74 +39,79 @@ const B = ({
|
|
|
39
39
|
layout: t,
|
|
40
40
|
media: n,
|
|
41
41
|
mirrored: r,
|
|
42
|
-
filter:
|
|
42
|
+
filter: i
|
|
43
43
|
}) => {
|
|
44
|
-
const
|
|
45
|
-
e.width !==
|
|
44
|
+
const o = Math.round(t.destination.width), a = Math.round(t.destination.height);
|
|
45
|
+
e.width !== o && (e.width = o), e.height !== a && (e.height = a);
|
|
46
46
|
const s = e.getContext("2d");
|
|
47
|
-
s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0,
|
|
48
|
-
},
|
|
47
|
+
s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, o, a), r && (s.translate(o, 0), s.scale(-1, 1)), i && (s.filter = i), s.drawImage(n, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), i && (s.filter = "none"), s.setTransform(1, 0, 0, 1, 0, 0));
|
|
48
|
+
}, re = ({
|
|
49
49
|
canvasRef: e,
|
|
50
50
|
enabled: t = !0,
|
|
51
51
|
fps: n = 30,
|
|
52
52
|
imageRef: r,
|
|
53
|
-
layout:
|
|
54
|
-
mirrored:
|
|
53
|
+
layout: i,
|
|
54
|
+
mirrored: o,
|
|
55
55
|
sourceKind: a,
|
|
56
56
|
videoRef: s
|
|
57
57
|
}) => {
|
|
58
|
-
|
|
58
|
+
z(() => {
|
|
59
59
|
if (!t) {
|
|
60
60
|
const b = e.current, f = b == null ? void 0 : b.getContext("2d");
|
|
61
61
|
b && f && f.clearRect(0, 0, b.width, b.height);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
let l = 0,
|
|
65
|
-
const
|
|
66
|
-
if (l = requestAnimationFrame(h),
|
|
67
|
-
|
|
64
|
+
let l = 0, d = 0;
|
|
65
|
+
const c = n > 0 ? 1e3 / n : 0, h = (b) => {
|
|
66
|
+
if (l = requestAnimationFrame(h), c > 0 && b - d < c) return;
|
|
67
|
+
d = b;
|
|
68
68
|
const f = e.current;
|
|
69
|
-
if (!f || !
|
|
69
|
+
if (!f || !i) return;
|
|
70
70
|
if (a === "image") {
|
|
71
71
|
const p = r.current;
|
|
72
72
|
if (!p || !p.complete || p.naturalWidth <= 0 || p.naturalHeight <= 0)
|
|
73
73
|
return;
|
|
74
74
|
q({
|
|
75
75
|
canvas: f,
|
|
76
|
-
layout:
|
|
76
|
+
layout: i,
|
|
77
77
|
media: p,
|
|
78
|
-
mirrored:
|
|
78
|
+
mirrored: o
|
|
79
79
|
});
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
const w = s.current;
|
|
83
83
|
!w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 || q({
|
|
84
84
|
canvas: f,
|
|
85
|
-
layout:
|
|
85
|
+
layout: i,
|
|
86
86
|
media: w,
|
|
87
|
-
mirrored:
|
|
87
|
+
mirrored: o
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
90
|
return l = requestAnimationFrame(h), () => {
|
|
91
91
|
cancelAnimationFrame(l);
|
|
92
92
|
};
|
|
93
|
-
}, [e, t, n, r,
|
|
93
|
+
}, [e, t, n, r, i, o, a, s]);
|
|
94
94
|
}, xe = ({
|
|
95
95
|
canvasRef: e,
|
|
96
96
|
imageRef: t,
|
|
97
97
|
layer: n,
|
|
98
98
|
layout: r,
|
|
99
|
-
mirrored:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
mirrored: i,
|
|
100
|
+
onCaptureTarget: o,
|
|
101
|
+
sourceKind: a,
|
|
102
|
+
videoRef: s
|
|
103
|
+
}) => (re({
|
|
103
104
|
canvasRef: e,
|
|
104
105
|
imageRef: t,
|
|
105
106
|
layout: r,
|
|
106
|
-
mirrored:
|
|
107
|
-
sourceKind:
|
|
108
|
-
videoRef:
|
|
109
|
-
}),
|
|
107
|
+
mirrored: i,
|
|
108
|
+
sourceKind: a,
|
|
109
|
+
videoRef: s
|
|
110
|
+
}), z(() => {
|
|
111
|
+
const l = e.current;
|
|
112
|
+
if (l)
|
|
113
|
+
return o == null || o(l), () => o == null ? void 0 : o(void 0);
|
|
114
|
+
}, [e, o]), /* @__PURE__ */ g(B, { config: n, children: /* @__PURE__ */ g(
|
|
110
115
|
"canvas",
|
|
111
116
|
{
|
|
112
117
|
ref: e,
|
|
@@ -124,26 +129,26 @@ const B = ({
|
|
|
124
129
|
controlInsetTop: t,
|
|
125
130
|
debugVisible: n,
|
|
126
131
|
fps: r = 15,
|
|
127
|
-
imageRef:
|
|
128
|
-
layer:
|
|
132
|
+
imageRef: i,
|
|
133
|
+
layer: o,
|
|
129
134
|
layout: a,
|
|
130
135
|
mirrored: s,
|
|
131
136
|
sourceKind: l,
|
|
132
|
-
videoRef:
|
|
133
|
-
viewportSize:
|
|
137
|
+
videoRef: d,
|
|
138
|
+
viewportSize: c
|
|
134
139
|
}) => {
|
|
135
|
-
|
|
140
|
+
re({
|
|
136
141
|
canvasRef: e,
|
|
137
142
|
enabled: n,
|
|
138
143
|
fps: r,
|
|
139
|
-
imageRef:
|
|
144
|
+
imageRef: i,
|
|
140
145
|
layout: a,
|
|
141
146
|
mirrored: s,
|
|
142
147
|
sourceKind: l,
|
|
143
|
-
videoRef:
|
|
148
|
+
videoRef: d
|
|
144
149
|
});
|
|
145
|
-
const h = Math.min(220, Math.max(120,
|
|
146
|
-
return /* @__PURE__ */ g(B, { config:
|
|
150
|
+
const h = Math.min(220, Math.max(120, c.width * 0.22)), b = c.width > 0 && c.height > 0 ? c.width / c.height : 1, f = Math.min(c.height - 24, Math.max(t ?? 16, 16));
|
|
151
|
+
return /* @__PURE__ */ g(B, { config: o, children: /* @__PURE__ */ g(
|
|
147
152
|
"canvas",
|
|
148
153
|
{
|
|
149
154
|
ref: e,
|
|
@@ -169,17 +174,17 @@ const B = ({
|
|
|
169
174
|
facingMode: "user",
|
|
170
175
|
frameRate: { ideal: 30, max: 60 }
|
|
171
176
|
}
|
|
172
|
-
},
|
|
177
|
+
}, Se = {
|
|
173
178
|
name: "viewport-live",
|
|
174
179
|
clearColor: "#000000",
|
|
175
180
|
pointerEvents: "none",
|
|
176
181
|
zIndex: 0
|
|
177
|
-
},
|
|
182
|
+
}, ye = {
|
|
178
183
|
name: "viewport-ui",
|
|
179
184
|
clearColor: "transparent",
|
|
180
185
|
pointerEvents: "auto",
|
|
181
186
|
zIndex: 5
|
|
182
|
-
},
|
|
187
|
+
}, Ce = {
|
|
183
188
|
name: "viewport-scene",
|
|
184
189
|
clearColor: "transparent",
|
|
185
190
|
pointerEvents: "auto",
|
|
@@ -192,7 +197,7 @@ const B = ({
|
|
|
192
197
|
imageRef: e,
|
|
193
198
|
selectedSource: t,
|
|
194
199
|
videoRef: n
|
|
195
|
-
}) => /* @__PURE__ */ k(
|
|
200
|
+
}) => /* @__PURE__ */ k(_, { children: [
|
|
196
201
|
/* @__PURE__ */ g(
|
|
197
202
|
"video",
|
|
198
203
|
{
|
|
@@ -225,7 +230,7 @@ const B = ({
|
|
|
225
230
|
label: t,
|
|
226
231
|
onChange: n,
|
|
227
232
|
options: r,
|
|
228
|
-
value:
|
|
233
|
+
value: i
|
|
229
234
|
}) => /* @__PURE__ */ g(
|
|
230
235
|
"div",
|
|
231
236
|
{
|
|
@@ -258,8 +263,8 @@ const B = ({
|
|
|
258
263
|
/* @__PURE__ */ g(
|
|
259
264
|
"select",
|
|
260
265
|
{
|
|
261
|
-
value:
|
|
262
|
-
onChange: (
|
|
266
|
+
value: i,
|
|
267
|
+
onChange: (o) => n(o.target.value),
|
|
263
268
|
style: {
|
|
264
269
|
minWidth: 180,
|
|
265
270
|
maxWidth: "calc(100vw - 52px)",
|
|
@@ -270,7 +275,7 @@ const B = ({
|
|
|
270
275
|
color: "#e5eefb",
|
|
271
276
|
padding: "0 10px"
|
|
272
277
|
},
|
|
273
|
-
children: r.map((
|
|
278
|
+
children: r.map((o) => /* @__PURE__ */ g("option", { value: o.id, style: { color: "#111827" }, children: o.label }, o.id))
|
|
274
279
|
}
|
|
275
280
|
)
|
|
276
281
|
]
|
|
@@ -282,15 +287,15 @@ const B = ({
|
|
|
282
287
|
imageOptions: t,
|
|
283
288
|
selectedImageId: n,
|
|
284
289
|
selectedSource: r,
|
|
285
|
-
selectedVideoId:
|
|
286
|
-
setSelectedImageId:
|
|
290
|
+
selectedVideoId: i,
|
|
291
|
+
setSelectedImageId: o,
|
|
287
292
|
setSelectedSource: a,
|
|
288
293
|
setSelectedVideoId: s,
|
|
289
294
|
showMediaControls: l,
|
|
290
|
-
videoOptions:
|
|
295
|
+
videoOptions: d
|
|
291
296
|
}) => {
|
|
292
|
-
const [
|
|
293
|
-
return l ?
|
|
297
|
+
const [c, h] = C(!1), b = ["webcam", "image", "video"].filter((f) => f === "image" ? t.length > 0 : f === "video" ? d.length > 0 : !0);
|
|
298
|
+
return l ? c ? /* @__PURE__ */ g(
|
|
294
299
|
"button",
|
|
295
300
|
{
|
|
296
301
|
type: "button",
|
|
@@ -315,7 +320,7 @@ const B = ({
|
|
|
315
320
|
},
|
|
316
321
|
children: "≡"
|
|
317
322
|
}
|
|
318
|
-
) : /* @__PURE__ */ k(
|
|
323
|
+
) : /* @__PURE__ */ k(_, { children: [
|
|
319
324
|
/* @__PURE__ */ k(
|
|
320
325
|
"div",
|
|
321
326
|
{
|
|
@@ -412,16 +417,16 @@ const B = ({
|
|
|
412
417
|
label: "Image Asset",
|
|
413
418
|
options: t,
|
|
414
419
|
value: n,
|
|
415
|
-
onChange:
|
|
420
|
+
onChange: o
|
|
416
421
|
}
|
|
417
422
|
),
|
|
418
|
-
r === "video" &&
|
|
423
|
+
r === "video" && d.length > 0 && /* @__PURE__ */ g(
|
|
419
424
|
Y,
|
|
420
425
|
{
|
|
421
426
|
dock: e,
|
|
422
427
|
label: "Video Asset",
|
|
423
|
-
options:
|
|
424
|
-
value:
|
|
428
|
+
options: d,
|
|
429
|
+
value: i,
|
|
425
430
|
onChange: s
|
|
426
431
|
}
|
|
427
432
|
)
|
|
@@ -431,122 +436,126 @@ const B = ({
|
|
|
431
436
|
displayCanvasRef: t,
|
|
432
437
|
imageOptions: n,
|
|
433
438
|
imageRef: r,
|
|
434
|
-
layout:
|
|
435
|
-
managesOwnMedia:
|
|
439
|
+
layout: i,
|
|
440
|
+
managesOwnMedia: o,
|
|
436
441
|
mediaDock: a,
|
|
437
442
|
mode: s,
|
|
438
443
|
overlayContent: l,
|
|
439
|
-
renderOutputs:
|
|
440
|
-
sceneContent:
|
|
444
|
+
renderOutputs: d,
|
|
445
|
+
sceneContent: c,
|
|
441
446
|
selectedImageId: h,
|
|
442
447
|
selectedSource: b,
|
|
443
448
|
selectedVideoId: f,
|
|
444
449
|
setSceneRenderOutputs: w,
|
|
445
450
|
setSelectedImageId: p,
|
|
446
451
|
setSelectedSource: m,
|
|
447
|
-
setSelectedVideoId:
|
|
448
|
-
showMediaControls:
|
|
452
|
+
setSelectedVideoId: S,
|
|
453
|
+
showMediaControls: M,
|
|
449
454
|
style: R,
|
|
450
455
|
videoOptions: v,
|
|
451
|
-
videoRef:
|
|
456
|
+
videoRef: E,
|
|
452
457
|
viewportSize: x,
|
|
453
458
|
mirrored: u
|
|
454
|
-
}) =>
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
imageRef: r,
|
|
472
|
-
videoRef: I,
|
|
473
|
-
layer: ye,
|
|
474
|
-
layout: o,
|
|
475
|
-
mirrored: u,
|
|
476
|
-
sourceKind: b === "image" ? "image" : "video"
|
|
477
|
-
}
|
|
478
|
-
),
|
|
479
|
-
(s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(B, { config: Se, children: /* @__PURE__ */ g(
|
|
480
|
-
ge,
|
|
481
|
-
{
|
|
482
|
-
onRenderOutputs: w,
|
|
483
|
-
renderOutputs: {
|
|
484
|
-
sceneColor: c.sceneColor || c.finalColor,
|
|
485
|
-
sceneDepth: c.sceneDepth
|
|
486
|
-
},
|
|
487
|
-
renderTargetSize: x,
|
|
488
|
-
style: { width: "100%", height: "100%" },
|
|
489
|
-
children: d
|
|
490
|
-
}
|
|
491
|
-
) }),
|
|
492
|
-
/* @__PURE__ */ k(B, { config: Ce, children: [
|
|
493
|
-
i && /* @__PURE__ */ g(
|
|
494
|
-
Ie,
|
|
459
|
+
}) => {
|
|
460
|
+
const { session: I } = O();
|
|
461
|
+
return /* @__PURE__ */ k(
|
|
462
|
+
"div",
|
|
463
|
+
{
|
|
464
|
+
ref: e,
|
|
465
|
+
style: {
|
|
466
|
+
position: "fixed",
|
|
467
|
+
inset: 0,
|
|
468
|
+
overflow: "hidden",
|
|
469
|
+
background: "#000",
|
|
470
|
+
...R
|
|
471
|
+
},
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ g(Re, { imageRef: r, selectedSource: b, videoRef: E }),
|
|
474
|
+
s === "dom" && o && /* @__PURE__ */ g(
|
|
475
|
+
xe,
|
|
495
476
|
{
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
showMediaControls: F,
|
|
505
|
-
videoOptions: v
|
|
477
|
+
canvasRef: t,
|
|
478
|
+
imageRef: r,
|
|
479
|
+
videoRef: E,
|
|
480
|
+
layer: Se,
|
|
481
|
+
layout: i,
|
|
482
|
+
mirrored: u,
|
|
483
|
+
onCaptureTarget: I._setCaptureTarget,
|
|
484
|
+
sourceKind: b === "image" ? "image" : "video"
|
|
506
485
|
}
|
|
507
486
|
),
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
487
|
+
(s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(B, { config: Ce, children: /* @__PURE__ */ g(
|
|
488
|
+
ge,
|
|
489
|
+
{
|
|
490
|
+
onRenderOutputs: w,
|
|
491
|
+
renderOutputs: {
|
|
492
|
+
sceneColor: d.sceneColor || d.finalColor,
|
|
493
|
+
sceneDepth: d.sceneDepth
|
|
494
|
+
},
|
|
495
|
+
renderTargetSize: x,
|
|
496
|
+
style: { width: "100%", height: "100%" },
|
|
497
|
+
children: c
|
|
498
|
+
}
|
|
499
|
+
) }),
|
|
500
|
+
/* @__PURE__ */ k(B, { config: ye, children: [
|
|
501
|
+
o && /* @__PURE__ */ g(
|
|
502
|
+
Ie,
|
|
503
|
+
{
|
|
504
|
+
dock: a,
|
|
505
|
+
imageOptions: n,
|
|
506
|
+
selectedImageId: h,
|
|
507
|
+
selectedSource: b,
|
|
508
|
+
selectedVideoId: f,
|
|
509
|
+
setSelectedImageId: p,
|
|
510
|
+
setSelectedSource: m,
|
|
511
|
+
setSelectedVideoId: S,
|
|
512
|
+
showMediaControls: M,
|
|
513
|
+
videoOptions: v
|
|
514
|
+
}
|
|
515
|
+
),
|
|
516
|
+
l
|
|
517
|
+
] })
|
|
518
|
+
]
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}, Fe = 5, Me = 1, Te = (e, t) => t, ze = "brightness(2.2) contrast(1.5) saturate(1.25)", Xe = ({
|
|
513
522
|
enabled: e,
|
|
514
523
|
displayMirrored: t,
|
|
515
524
|
imageRef: n,
|
|
516
525
|
layout: r,
|
|
517
|
-
mode:
|
|
518
|
-
numFaces:
|
|
526
|
+
mode: i,
|
|
527
|
+
numFaces: o,
|
|
519
528
|
selectedSource: a,
|
|
520
529
|
sourceStream: s,
|
|
521
530
|
videoRef: l
|
|
522
531
|
}) => {
|
|
523
|
-
const { session:
|
|
532
|
+
const { session: d } = O(), c = X(null), h = X(!1), b = X(document.createElement("canvas")), {
|
|
524
533
|
ready: f,
|
|
525
534
|
node: w,
|
|
526
535
|
error: p
|
|
527
|
-
} = le(
|
|
528
|
-
numFaces:
|
|
529
|
-
}), [m,
|
|
536
|
+
} = le(ee.FACE_TRACKER, {
|
|
537
|
+
numFaces: o ?? (i === "head-binding" ? Me : Fe)
|
|
538
|
+
}), [m, S] = C("idle"), [M, R] = C(null), v = e && f && !!w, E = te({
|
|
530
539
|
node: v ? w : null,
|
|
531
540
|
enabled: v,
|
|
532
541
|
selectedSource: a,
|
|
533
|
-
onFrame:
|
|
534
|
-
R(null),
|
|
542
|
+
onFrame: ce(() => {
|
|
543
|
+
R(null), S("ready");
|
|
535
544
|
}, [])
|
|
536
545
|
});
|
|
537
|
-
return
|
|
546
|
+
return z(() => {
|
|
538
547
|
if (!e || !r) return;
|
|
539
548
|
const x = () => {
|
|
540
|
-
const
|
|
541
|
-
if (
|
|
542
|
-
if (
|
|
543
|
-
if (!
|
|
544
|
-
} else if (
|
|
549
|
+
const y = a === "image" ? n.current : l.current;
|
|
550
|
+
if (y) {
|
|
551
|
+
if (y instanceof HTMLImageElement) {
|
|
552
|
+
if (!y.complete || y.naturalWidth <= 0 || y.naturalHeight <= 0) return;
|
|
553
|
+
} else if (y.readyState < 2 || y.videoWidth <= 0 || y.videoHeight <= 0)
|
|
545
554
|
return;
|
|
546
555
|
q({
|
|
547
556
|
canvas: b.current,
|
|
548
557
|
layout: r,
|
|
549
|
-
media:
|
|
558
|
+
media: y,
|
|
550
559
|
mirrored: t,
|
|
551
560
|
filter: a === "webcam" ? ze : void 0
|
|
552
561
|
});
|
|
@@ -557,75 +566,80 @@ const B = ({
|
|
|
557
566
|
return;
|
|
558
567
|
}
|
|
559
568
|
let u = 0;
|
|
560
|
-
const
|
|
561
|
-
u = requestAnimationFrame(
|
|
569
|
+
const I = () => {
|
|
570
|
+
u = requestAnimationFrame(I), x();
|
|
562
571
|
};
|
|
563
|
-
return u = requestAnimationFrame(
|
|
564
|
-
}, [t, e, n, r, a, l]),
|
|
572
|
+
return u = requestAnimationFrame(I), () => cancelAnimationFrame(u);
|
|
573
|
+
}, [t, e, n, r, a, l]), z(() => {
|
|
565
574
|
var V;
|
|
566
575
|
if (!e) {
|
|
567
|
-
|
|
576
|
+
S("idle"), R(null), h.current = !1, c.current = null;
|
|
568
577
|
return;
|
|
569
578
|
}
|
|
570
579
|
if (!r) {
|
|
571
|
-
|
|
580
|
+
S("initializing");
|
|
572
581
|
return;
|
|
573
582
|
}
|
|
574
|
-
const x = (s == null ? void 0 : s.id) ?? (((V = l.current) == null ? void 0 : V.srcObject) instanceof MediaStream ? l.current.srcObject.id : "none"),
|
|
575
|
-
|
|
576
|
-
let
|
|
583
|
+
const x = (s == null ? void 0 : s.id) ?? (((V = l.current) == null ? void 0 : V.srcObject) instanceof MediaStream ? l.current.srcObject.id : "none"), I = a === "webcam" ? `webcam:${x}` : a;
|
|
584
|
+
c.current !== I && (h.current = !1, c.current = I);
|
|
585
|
+
let y = !1;
|
|
577
586
|
return (async () => {
|
|
578
587
|
try {
|
|
579
|
-
|
|
588
|
+
S("initializing");
|
|
589
|
+
const T = !h.current;
|
|
590
|
+
if (T && await d.setFrameSource({
|
|
580
591
|
canvas: b.current,
|
|
581
592
|
sourceKind: a
|
|
582
|
-
}), await
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
593
|
+
}), await d._setRenderSize(
|
|
594
|
+
Math.round(r.destination.width),
|
|
595
|
+
Math.round(r.destination.height)
|
|
596
|
+
), T && (await d.start(), h.current = !0), y) return;
|
|
597
|
+
R(null), S("initializing");
|
|
598
|
+
} catch (T) {
|
|
599
|
+
if (y) return;
|
|
600
|
+
S("error"), R(T instanceof Error ? T.message : "Failed to initialize SDK face tracking");
|
|
587
601
|
}
|
|
588
602
|
})(), () => {
|
|
589
|
-
|
|
603
|
+
y = !0;
|
|
590
604
|
};
|
|
591
|
-
}, [e, r, a,
|
|
592
|
-
!v && e && !p &&
|
|
593
|
-
}, [v, e, p]),
|
|
594
|
-
p && (
|
|
595
|
-
}, [p]),
|
|
596
|
-
h.current = !1,
|
|
597
|
-
}, [
|
|
605
|
+
}, [e, r, a, d, s, l]), z(() => {
|
|
606
|
+
!v && e && !p && S("initializing");
|
|
607
|
+
}, [v, e, p]), z(() => {
|
|
608
|
+
p && (S("error"), R(p.message));
|
|
609
|
+
}, [p]), z(() => () => {
|
|
610
|
+
h.current = !1, d.stop();
|
|
611
|
+
}, [d]), {
|
|
598
612
|
activeDelegate: "GPU",
|
|
599
|
-
faces:
|
|
613
|
+
faces: E,
|
|
600
614
|
status: m,
|
|
601
|
-
error:
|
|
615
|
+
error: M
|
|
602
616
|
};
|
|
603
617
|
}, ke = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, Ae = ({
|
|
604
618
|
imageOptions: e,
|
|
605
619
|
initialImageId: t,
|
|
606
620
|
initialSource: n,
|
|
607
621
|
initialVideoId: r,
|
|
608
|
-
source:
|
|
609
|
-
videoOptions:
|
|
622
|
+
source: i,
|
|
623
|
+
videoOptions: o
|
|
610
624
|
}) => {
|
|
611
|
-
var l,
|
|
612
|
-
const a = (
|
|
625
|
+
var l, d, c, h;
|
|
626
|
+
const a = (i == null ? void 0 : i.kind) ?? n ?? "webcam";
|
|
613
627
|
return {
|
|
614
|
-
selectedSource: a === "image" && e.length === 0 || a === "video" &&
|
|
615
|
-
selectedImageId: (
|
|
616
|
-
selectedVideoId: (
|
|
628
|
+
selectedSource: a === "image" && e.length === 0 || a === "video" && o.length === 0 ? "webcam" : a,
|
|
629
|
+
selectedImageId: (i == null ? void 0 : i.kind) === "image" ? i.assetId ?? ((l = e[0]) == null ? void 0 : l.id) ?? "" : t ?? ((d = e[0]) == null ? void 0 : d.id) ?? "",
|
|
630
|
+
selectedVideoId: (i == null ? void 0 : i.kind) === "video" ? i.assetId ?? ((c = o[0]) == null ? void 0 : c.id) ?? "" : r ?? ((h = o[0]) == null ? void 0 : h.id) ?? ""
|
|
617
631
|
};
|
|
618
632
|
}, Le = (e, t, n) => {
|
|
619
633
|
if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
|
|
620
634
|
return null;
|
|
621
|
-
const r = n === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height),
|
|
635
|
+
const r = n === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), i = e.width * r, o = e.height * r;
|
|
622
636
|
return {
|
|
623
637
|
source: e,
|
|
624
638
|
destination: t,
|
|
625
|
-
drawWidth:
|
|
626
|
-
drawHeight:
|
|
627
|
-
offsetX: (t.width -
|
|
628
|
-
offsetY: (t.height -
|
|
639
|
+
drawWidth: i,
|
|
640
|
+
drawHeight: o,
|
|
641
|
+
offsetX: (t.width - i) * 0.5,
|
|
642
|
+
offsetY: (t.height - o) * 0.5,
|
|
629
643
|
scale: r
|
|
630
644
|
};
|
|
631
645
|
}, Ve = (e) => {
|
|
@@ -636,82 +650,82 @@ const B = ({
|
|
|
636
650
|
height: t.height || e.clientHeight
|
|
637
651
|
};
|
|
638
652
|
}, De = (e) => {
|
|
639
|
-
const [t, n] =
|
|
653
|
+
const [t, n] = C({ width: 0, height: 0 });
|
|
640
654
|
return ue(() => {
|
|
641
655
|
const r = e.current;
|
|
642
656
|
if (!r) return;
|
|
643
|
-
let
|
|
644
|
-
const
|
|
645
|
-
const
|
|
657
|
+
let i = 0;
|
|
658
|
+
const o = () => {
|
|
659
|
+
const d = Ve(r);
|
|
646
660
|
n(
|
|
647
|
-
(
|
|
661
|
+
(c) => c.width === d.width && c.height === d.height ? c : d
|
|
648
662
|
);
|
|
649
663
|
}, a = () => {
|
|
650
|
-
|
|
664
|
+
o(), i && cancelAnimationFrame(i), i = requestAnimationFrame(o);
|
|
651
665
|
};
|
|
652
666
|
a();
|
|
653
667
|
const s = new ResizeObserver(a);
|
|
654
668
|
s.observe(r);
|
|
655
669
|
const l = window.visualViewport;
|
|
656
670
|
return window.addEventListener("resize", a), window.addEventListener("orientationchange", a), l == null || l.addEventListener("resize", a), l == null || l.addEventListener("scroll", a), () => {
|
|
657
|
-
|
|
671
|
+
i && cancelAnimationFrame(i), s.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("orientationchange", a), l == null || l.removeEventListener("resize", a), l == null || l.removeEventListener("scroll", a);
|
|
658
672
|
};
|
|
659
673
|
}, [e]), t;
|
|
660
674
|
}, Be = ({
|
|
661
675
|
enabled: e,
|
|
662
676
|
selectedSource: t
|
|
663
677
|
}) => {
|
|
664
|
-
const n =
|
|
678
|
+
const n = de(ee.FACE_TRACKER);
|
|
665
679
|
return {
|
|
666
|
-
faces:
|
|
680
|
+
faces: te({ node: n, enabled: e, selectedSource: t }),
|
|
667
681
|
trackerStatus: n ? "ready" : "idle"
|
|
668
682
|
};
|
|
669
683
|
}, J = (e) => {
|
|
670
684
|
e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
|
|
671
685
|
}, Q = (e) => {
|
|
672
686
|
e && e.removeAttribute("src");
|
|
673
|
-
},
|
|
687
|
+
}, _e = ({
|
|
674
688
|
enabled: e,
|
|
675
689
|
imageAsset: t,
|
|
676
690
|
selectedSource: n,
|
|
677
691
|
videoAsset: r
|
|
678
692
|
}) => {
|
|
679
|
-
const
|
|
680
|
-
return
|
|
693
|
+
const i = X(null), o = X(null), [a, s] = C(null), [l, d] = C({ width: 0, height: 0 }), [c, h] = C("idle"), [b, f] = C(null);
|
|
694
|
+
return z(() => {
|
|
681
695
|
if (!e) {
|
|
682
|
-
J(
|
|
696
|
+
J(i.current), Q(o.current), s(null), d({ width: 0, height: 0 }), h("idle"), f(null);
|
|
683
697
|
return;
|
|
684
698
|
}
|
|
685
699
|
let w = !1, p = null;
|
|
686
700
|
const m = (x, u) => {
|
|
687
|
-
w || (
|
|
688
|
-
},
|
|
689
|
-
J(
|
|
690
|
-
},
|
|
701
|
+
w || (d({ width: x, height: u }), h("ready"), f(null));
|
|
702
|
+
}, S = () => {
|
|
703
|
+
J(i.current), Q(o.current), p == null || p.getTracks().forEach((x) => x.stop()), p = null, s(null);
|
|
704
|
+
}, M = async () => {
|
|
691
705
|
h("requesting");
|
|
692
706
|
const x = await navigator.mediaDevices.getUserMedia(ve);
|
|
693
707
|
if (w) {
|
|
694
|
-
x.getTracks().forEach((
|
|
708
|
+
x.getTracks().forEach((I) => I.stop());
|
|
695
709
|
return;
|
|
696
710
|
}
|
|
697
711
|
p = x, s(x);
|
|
698
|
-
const u =
|
|
712
|
+
const u = i.current;
|
|
699
713
|
u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(), m(u.videoWidth, u.videoHeight));
|
|
700
714
|
}, R = async (x) => {
|
|
701
715
|
h("requesting"), s(null);
|
|
702
|
-
const u =
|
|
716
|
+
const u = i.current;
|
|
703
717
|
u && (u.src = x, u.muted = !0, u.loop = !0, u.playsInline = !0, u.autoplay = !0, u.crossOrigin = "anonymous", await u.play(), m(u.videoWidth, u.videoHeight));
|
|
704
718
|
}, v = async (x) => {
|
|
705
719
|
h("requesting"), s(null);
|
|
706
|
-
const u =
|
|
707
|
-
u && (await new Promise((
|
|
708
|
-
u.onload = () =>
|
|
720
|
+
const u = o.current;
|
|
721
|
+
u && (await new Promise((I, y) => {
|
|
722
|
+
u.onload = () => I(), u.onerror = () => y(new Error("Unable to load image")), u.src = x;
|
|
709
723
|
}), m(u.naturalWidth, u.naturalHeight));
|
|
710
724
|
};
|
|
711
|
-
return
|
|
725
|
+
return S(), (async () => {
|
|
712
726
|
try {
|
|
713
727
|
if (n === "webcam") {
|
|
714
|
-
await
|
|
728
|
+
await M();
|
|
715
729
|
return;
|
|
716
730
|
}
|
|
717
731
|
if (n === "video") {
|
|
@@ -726,84 +740,84 @@ const B = ({
|
|
|
726
740
|
h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${n}`);
|
|
727
741
|
}
|
|
728
742
|
})(), () => {
|
|
729
|
-
w = !0,
|
|
743
|
+
w = !0, S();
|
|
730
744
|
};
|
|
731
745
|
}, [e, t, n, r]), {
|
|
732
|
-
videoRef:
|
|
733
|
-
imageRef:
|
|
746
|
+
videoRef: i,
|
|
747
|
+
imageRef: o,
|
|
734
748
|
stream: a,
|
|
735
749
|
mediaSize: l,
|
|
736
|
-
status:
|
|
750
|
+
status: c,
|
|
737
751
|
error: b
|
|
738
752
|
};
|
|
739
|
-
},
|
|
753
|
+
}, We = ({
|
|
740
754
|
enabled: e,
|
|
741
755
|
imageRef: t,
|
|
742
756
|
selectedSource: n,
|
|
743
757
|
status: r,
|
|
744
|
-
videoRef:
|
|
758
|
+
videoRef: i
|
|
745
759
|
}) => {
|
|
746
|
-
const [
|
|
747
|
-
return
|
|
760
|
+
const [o, a] = C(null);
|
|
761
|
+
return z(() => {
|
|
748
762
|
if (!e || r !== "ready") {
|
|
749
|
-
a((
|
|
763
|
+
a((d) => (d == null || d.dispose(), null));
|
|
750
764
|
return;
|
|
751
765
|
}
|
|
752
|
-
const s = n === "image" ? t.current :
|
|
766
|
+
const s = n === "image" ? t.current : i.current;
|
|
753
767
|
if (!s) return;
|
|
754
768
|
const l = n === "image" ? new L.Texture(s) : new L.VideoTexture(s);
|
|
755
|
-
return l.colorSpace = L.SRGBColorSpace, l.minFilter = L.LinearFilter, l.magFilter = L.LinearFilter, l.generateMipmaps = !1, l.needsUpdate = !0, a((
|
|
769
|
+
return l.colorSpace = L.SRGBColorSpace, l.minFilter = L.LinearFilter, l.magFilter = L.LinearFilter, l.generateMipmaps = !1, l.needsUpdate = !0, a((d) => (d == null || d.dispose(), l)), () => {
|
|
756
770
|
l.dispose();
|
|
757
771
|
};
|
|
758
|
-
}, [e, t, n, r,
|
|
772
|
+
}, [e, t, n, r, i]), o;
|
|
759
773
|
}, He = ({
|
|
760
774
|
externalTracker: e,
|
|
761
775
|
imageOptions: t,
|
|
762
776
|
layout: n,
|
|
763
777
|
managesOwnMedia: r,
|
|
764
|
-
mediaError:
|
|
765
|
-
mediaFitMode:
|
|
778
|
+
mediaError: i,
|
|
779
|
+
mediaFitMode: o,
|
|
766
780
|
mediaSize: a,
|
|
767
781
|
mediaStatus: s,
|
|
768
782
|
mirrored: l,
|
|
769
|
-
selectedImage:
|
|
770
|
-
selectedImageId:
|
|
783
|
+
selectedImage: d,
|
|
784
|
+
selectedImageId: c,
|
|
771
785
|
selectedSource: h,
|
|
772
786
|
selectedVideo: b,
|
|
773
787
|
selectedVideoId: f,
|
|
774
788
|
setMirrored: w,
|
|
775
789
|
setSelectedImageId: p,
|
|
776
790
|
setSelectedSource: m,
|
|
777
|
-
setSelectedVideoId:
|
|
778
|
-
setShowMediaControls:
|
|
791
|
+
setSelectedVideoId: S,
|
|
792
|
+
setShowMediaControls: M,
|
|
779
793
|
showMediaControls: R,
|
|
780
794
|
tracker: v,
|
|
781
|
-
videoOptions:
|
|
795
|
+
videoOptions: E,
|
|
782
796
|
viewportSize: x
|
|
783
797
|
}) => {
|
|
784
|
-
const u = h === "image" ? `${A.image.label}: ${(
|
|
798
|
+
const u = h === "image" ? `${A.image.label}: ${(d == null ? void 0 : d.label) ?? ""}` : h === "video" ? `${A.video.label}: ${(b == null ? void 0 : b.label) ?? ""}` : A.webcam.label;
|
|
785
799
|
return {
|
|
786
800
|
activeDelegate: r ? v.activeDelegate : null,
|
|
787
801
|
faces: r ? v.faces : e.faces,
|
|
788
802
|
imageOptions: t,
|
|
789
803
|
layout: n,
|
|
790
|
-
mediaError:
|
|
791
|
-
mediaFitMode:
|
|
804
|
+
mediaError: i,
|
|
805
|
+
mediaFitMode: o,
|
|
792
806
|
mediaLabel: u,
|
|
793
807
|
mediaStatus: s,
|
|
794
808
|
mirrored: l,
|
|
795
|
-
selectedImageId:
|
|
809
|
+
selectedImageId: c,
|
|
796
810
|
selectedSource: h,
|
|
797
811
|
selectedVideoId: f,
|
|
798
812
|
setMirrored: w,
|
|
799
813
|
setSelectedImageId: p,
|
|
800
814
|
setSelectedSource: m,
|
|
801
|
-
setSelectedVideoId:
|
|
802
|
-
setShowMediaControls:
|
|
815
|
+
setSelectedVideoId: S,
|
|
816
|
+
setShowMediaControls: M,
|
|
803
817
|
showMediaControls: R,
|
|
804
818
|
trackerError: r ? v.error : null,
|
|
805
819
|
trackerStatus: r ? v.status : e.trackerStatus,
|
|
806
|
-
videoOptions:
|
|
820
|
+
videoOptions: E,
|
|
807
821
|
viewportSize: x,
|
|
808
822
|
mediaSize: a
|
|
809
823
|
};
|
|
@@ -835,85 +849,85 @@ const B = ({
|
|
|
835
849
|
imageOptions: t,
|
|
836
850
|
initialImageId: n,
|
|
837
851
|
initialMirrored: r,
|
|
838
|
-
initialSource:
|
|
839
|
-
initialVideoId:
|
|
852
|
+
initialSource: i,
|
|
853
|
+
initialVideoId: o,
|
|
840
854
|
mediaStrategy: a,
|
|
841
855
|
previewMode: s,
|
|
842
856
|
renderOutputs: l,
|
|
843
|
-
showMediaControlsByDefault:
|
|
844
|
-
source:
|
|
857
|
+
showMediaControlsByDefault: d,
|
|
858
|
+
source: c,
|
|
845
859
|
videoOptions: h
|
|
846
860
|
}) => {
|
|
847
861
|
const b = X(null), f = X(null), w = De(b), p = $(
|
|
848
862
|
() => Ae({
|
|
849
863
|
imageOptions: t,
|
|
850
864
|
initialImageId: n,
|
|
851
|
-
initialSource:
|
|
852
|
-
initialVideoId:
|
|
853
|
-
source:
|
|
865
|
+
initialSource: i,
|
|
866
|
+
initialVideoId: o,
|
|
867
|
+
source: c,
|
|
854
868
|
videoOptions: h
|
|
855
869
|
}),
|
|
856
|
-
[t, n,
|
|
857
|
-
), [m,
|
|
870
|
+
[t, n, i, o, c, h]
|
|
871
|
+
), [m, S] = C(r), [M, R] = C(d), [v, E] = C(
|
|
858
872
|
p.selectedSource
|
|
859
|
-
), [x, u] =
|
|
873
|
+
), [x, u] = C(p.selectedImageId), [I, y] = C(p.selectedVideoId), [j, V] = C({
|
|
860
874
|
sceneColorTexture: null,
|
|
861
875
|
sceneDepthTexture: null
|
|
862
|
-
}),
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}, [p,
|
|
866
|
-
const K = t.find((P) => P.id === x) ?? t[0], G = h.find((P) => P.id ===
|
|
867
|
-
enabled:
|
|
876
|
+
}), T = a === "internal";
|
|
877
|
+
z(() => {
|
|
878
|
+
c && (E(p.selectedSource), u(p.selectedImageId), y(p.selectedVideoId));
|
|
879
|
+
}, [p, c]);
|
|
880
|
+
const K = t.find((P) => P.id === x) ?? t[0], G = h.find((P) => P.id === I) ?? h[0], F = _e({
|
|
881
|
+
enabled: T,
|
|
868
882
|
imageAsset: K,
|
|
869
883
|
selectedSource: v,
|
|
870
884
|
videoAsset: G
|
|
871
|
-
}),
|
|
872
|
-
() => Le(
|
|
873
|
-
[
|
|
874
|
-
),
|
|
885
|
+
}), W = ke(e, v), D = $(
|
|
886
|
+
() => Le(F.mediaSize, w, W),
|
|
887
|
+
[F.mediaSize, W, w]
|
|
888
|
+
), ne = We({
|
|
875
889
|
enabled: !!(l.mediaColor || l.finalColor),
|
|
876
|
-
imageRef:
|
|
890
|
+
imageRef: F.imageRef,
|
|
877
891
|
selectedSource: v,
|
|
878
|
-
status:
|
|
879
|
-
videoRef:
|
|
880
|
-
}), H =
|
|
892
|
+
status: F.status,
|
|
893
|
+
videoRef: F.videoRef
|
|
894
|
+
}), H = Te(v, m), oe = Xe({
|
|
881
895
|
displayMirrored: H,
|
|
882
|
-
enabled:
|
|
883
|
-
imageRef:
|
|
896
|
+
enabled: T && F.status === "ready" && D !== null,
|
|
897
|
+
imageRef: F.imageRef,
|
|
884
898
|
layout: D,
|
|
885
899
|
selectedSource: v,
|
|
886
|
-
sourceStream:
|
|
887
|
-
videoRef:
|
|
888
|
-
}),
|
|
889
|
-
enabled: !
|
|
900
|
+
sourceStream: F.stream,
|
|
901
|
+
videoRef: F.videoRef
|
|
902
|
+
}), ie = Be({
|
|
903
|
+
enabled: !T,
|
|
890
904
|
selectedSource: v
|
|
891
|
-
}),
|
|
892
|
-
externalTracker:
|
|
905
|
+
}), ae = He({
|
|
906
|
+
externalTracker: ie,
|
|
893
907
|
imageOptions: t,
|
|
894
908
|
layout: D,
|
|
895
|
-
managesOwnMedia:
|
|
896
|
-
mediaError:
|
|
897
|
-
mediaFitMode:
|
|
898
|
-
mediaSize:
|
|
899
|
-
mediaStatus:
|
|
909
|
+
managesOwnMedia: T,
|
|
910
|
+
mediaError: F.error,
|
|
911
|
+
mediaFitMode: W,
|
|
912
|
+
mediaSize: F.mediaSize,
|
|
913
|
+
mediaStatus: F.status,
|
|
900
914
|
mirrored: H,
|
|
901
915
|
selectedImage: K,
|
|
902
916
|
selectedImageId: x,
|
|
903
917
|
selectedSource: v,
|
|
904
918
|
selectedVideo: G,
|
|
905
|
-
selectedVideoId:
|
|
906
|
-
setMirrored:
|
|
919
|
+
selectedVideoId: I,
|
|
920
|
+
setMirrored: S,
|
|
907
921
|
setSelectedImageId: u,
|
|
908
|
-
setSelectedSource:
|
|
909
|
-
setSelectedVideoId:
|
|
922
|
+
setSelectedSource: E,
|
|
923
|
+
setSelectedVideoId: y,
|
|
910
924
|
setShowMediaControls: R,
|
|
911
|
-
showMediaControls:
|
|
912
|
-
tracker:
|
|
925
|
+
showMediaControls: M,
|
|
926
|
+
tracker: oe,
|
|
913
927
|
videoOptions: h,
|
|
914
928
|
viewportSize: w
|
|
915
|
-
}),
|
|
916
|
-
mediaTexture:
|
|
929
|
+
}), se = Pe({
|
|
930
|
+
mediaTexture: ne,
|
|
917
931
|
previewMode: s,
|
|
918
932
|
renderOutputs: l,
|
|
919
933
|
sceneRenderOutputs: j
|
|
@@ -923,23 +937,23 @@ const B = ({
|
|
|
923
937
|
displayCanvasRef: f,
|
|
924
938
|
displayMirrored: H,
|
|
925
939
|
layout: D,
|
|
926
|
-
managesOwnMedia:
|
|
927
|
-
media:
|
|
928
|
-
renderOutputState:
|
|
929
|
-
renderState:
|
|
940
|
+
managesOwnMedia: T,
|
|
941
|
+
media: F,
|
|
942
|
+
renderOutputState: se,
|
|
943
|
+
renderState: ae,
|
|
930
944
|
selectedImageId: x,
|
|
931
945
|
selectedSource: v,
|
|
932
|
-
selectedVideoId:
|
|
946
|
+
selectedVideoId: I,
|
|
933
947
|
setSceneRenderOutputs: V,
|
|
934
948
|
setSelectedImageId: u,
|
|
935
|
-
setSelectedSource:
|
|
936
|
-
setSelectedVideoId:
|
|
937
|
-
showMediaControls:
|
|
949
|
+
setSelectedSource: E,
|
|
950
|
+
setSelectedVideoId: y,
|
|
951
|
+
showMediaControls: M,
|
|
938
952
|
viewportSize: w
|
|
939
953
|
};
|
|
940
|
-
}, U = ({ children: e }) => /* @__PURE__ */ g(
|
|
954
|
+
}, U = ({ children: e }) => /* @__PURE__ */ g(_, { children: e });
|
|
941
955
|
U.displayName = "XRViewport.Scene";
|
|
942
|
-
const N = ({ children: e }) => /* @__PURE__ */ g(
|
|
956
|
+
const N = ({ children: e }) => /* @__PURE__ */ g(_, { children: e });
|
|
943
957
|
N.displayName = "XRViewport.Overlay";
|
|
944
958
|
const qe = (e, t) => {
|
|
945
959
|
if (e === "dom")
|
|
@@ -948,24 +962,24 @@ const qe = (e, t) => {
|
|
|
948
962
|
overlayContent: t
|
|
949
963
|
};
|
|
950
964
|
let n = null, r = null;
|
|
951
|
-
const
|
|
952
|
-
return he.forEach(t, (
|
|
965
|
+
const i = [];
|
|
966
|
+
return he.forEach(t, (o) => {
|
|
953
967
|
var s;
|
|
954
|
-
if (!me(
|
|
955
|
-
|
|
968
|
+
if (!me(o)) {
|
|
969
|
+
o != null && i.push(o);
|
|
956
970
|
return;
|
|
957
971
|
}
|
|
958
|
-
const a = (s =
|
|
972
|
+
const a = (s = o.type) == null ? void 0 : s.displayName;
|
|
959
973
|
if (a === U.displayName) {
|
|
960
|
-
n =
|
|
974
|
+
n = o.props.children;
|
|
961
975
|
return;
|
|
962
976
|
}
|
|
963
977
|
if (a === N.displayName) {
|
|
964
|
-
r =
|
|
978
|
+
r = o.props.children;
|
|
965
979
|
return;
|
|
966
980
|
}
|
|
967
|
-
|
|
968
|
-
}), !r &&
|
|
981
|
+
i.push(o);
|
|
982
|
+
}), !r && i.length > 0 && (r = i), {
|
|
969
983
|
sceneContent: n,
|
|
970
984
|
overlayContent: r
|
|
971
985
|
};
|
|
@@ -978,13 +992,13 @@ const rt = Ue(({
|
|
|
978
992
|
fitMode: t = "auto",
|
|
979
993
|
imageOptions: n = [],
|
|
980
994
|
initialImageId: r,
|
|
981
|
-
initialMirrored:
|
|
982
|
-
initialSource:
|
|
995
|
+
initialMirrored: i = !0,
|
|
996
|
+
initialSource: o = "webcam",
|
|
983
997
|
initialVideoId: a,
|
|
984
998
|
mediaStrategy: s = "internal",
|
|
985
999
|
mediaDock: l = "bottom-left",
|
|
986
|
-
mode:
|
|
987
|
-
previewMode:
|
|
1000
|
+
mode: d = "dom",
|
|
1001
|
+
previewMode: c = "finalColor",
|
|
988
1002
|
renderOutputs: h = {},
|
|
989
1003
|
showMediaControlsByDefault: b = !0,
|
|
990
1004
|
source: f,
|
|
@@ -995,19 +1009,19 @@ const rt = Ue(({
|
|
|
995
1009
|
fitMode: t,
|
|
996
1010
|
imageOptions: n,
|
|
997
1011
|
initialImageId: r,
|
|
998
|
-
initialMirrored:
|
|
999
|
-
initialSource:
|
|
1012
|
+
initialMirrored: i,
|
|
1013
|
+
initialSource: o,
|
|
1000
1014
|
initialVideoId: a,
|
|
1001
1015
|
mediaStrategy: s,
|
|
1002
|
-
previewMode:
|
|
1016
|
+
previewMode: c,
|
|
1003
1017
|
renderOutputs: h,
|
|
1004
1018
|
showMediaControlsByDefault: b,
|
|
1005
1019
|
source: f,
|
|
1006
1020
|
videoOptions: p
|
|
1007
|
-
}),
|
|
1008
|
-
|
|
1021
|
+
}), S = typeof e == "function" ? e(m.renderState) : e, { sceneContent: M, overlayContent: R } = qe(d, S), v = Z(
|
|
1022
|
+
M,
|
|
1009
1023
|
m.renderState
|
|
1010
|
-
),
|
|
1024
|
+
), E = Z(
|
|
1011
1025
|
R,
|
|
1012
1026
|
m.renderState
|
|
1013
1027
|
);
|
|
@@ -1022,8 +1036,8 @@ const rt = Ue(({
|
|
|
1022
1036
|
managesOwnMedia: m.managesOwnMedia,
|
|
1023
1037
|
mediaDock: l,
|
|
1024
1038
|
mirrored: m.displayMirrored,
|
|
1025
|
-
mode:
|
|
1026
|
-
overlayContent:
|
|
1039
|
+
mode: d,
|
|
1040
|
+
overlayContent: E,
|
|
1027
1041
|
renderOutputs: h,
|
|
1028
1042
|
sceneContent: v,
|
|
1029
1043
|
selectedImageId: m.selectedImageId,
|
|
@@ -1056,7 +1070,7 @@ const rt = Ue(({
|
|
|
1056
1070
|
label: t = "face bounding box",
|
|
1057
1071
|
color: n = "#22c55e",
|
|
1058
1072
|
style: r,
|
|
1059
|
-
labelStyle:
|
|
1073
|
+
labelStyle: i
|
|
1060
1074
|
}) => /* @__PURE__ */ g(
|
|
1061
1075
|
"div",
|
|
1062
1076
|
{
|
|
@@ -1072,29 +1086,29 @@ const rt = Ue(({
|
|
|
1072
1086
|
zIndex: 20,
|
|
1073
1087
|
...r
|
|
1074
1088
|
},
|
|
1075
|
-
children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ne, ...
|
|
1089
|
+
children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ne, ...i }, children: t })
|
|
1076
1090
|
}
|
|
1077
1091
|
), ot = (e) => {
|
|
1078
|
-
const [t, n] =
|
|
1079
|
-
return
|
|
1092
|
+
const [t, n] = C(null);
|
|
1093
|
+
return z(() => {
|
|
1080
1094
|
let r = 0;
|
|
1081
|
-
const
|
|
1082
|
-
var l,
|
|
1083
|
-
r = requestAnimationFrame(
|
|
1084
|
-
const
|
|
1085
|
-
if (!
|
|
1095
|
+
const i = () => {
|
|
1096
|
+
var l, d;
|
|
1097
|
+
r = requestAnimationFrame(i);
|
|
1098
|
+
const o = (d = (l = e == null ? void 0 : e.detectionResults) == null ? void 0 : l.faceLandmarks) == null ? void 0 : d[0];
|
|
1099
|
+
if (!o || o.length === 0) {
|
|
1086
1100
|
n(null);
|
|
1087
1101
|
return;
|
|
1088
1102
|
}
|
|
1089
|
-
const a = fe(
|
|
1103
|
+
const a = fe(o), s = {
|
|
1090
1104
|
left: a.minX,
|
|
1091
1105
|
top: a.minY,
|
|
1092
1106
|
width: a.width,
|
|
1093
1107
|
height: a.height
|
|
1094
1108
|
};
|
|
1095
|
-
n((
|
|
1109
|
+
n((c) => c && c.left === s.left && c.top === s.top && c.width === s.width && c.height === s.height ? c : s);
|
|
1096
1110
|
};
|
|
1097
|
-
return
|
|
1111
|
+
return i(), () => {
|
|
1098
1112
|
cancelAnimationFrame(r);
|
|
1099
1113
|
};
|
|
1100
1114
|
}, [e]), t;
|
|
@@ -1131,12 +1145,12 @@ const rt = Ue(({
|
|
|
1131
1145
|
export {
|
|
1132
1146
|
zt as BasicAnimatedTextureController,
|
|
1133
1147
|
nt as BoundingBoxOverlay,
|
|
1134
|
-
|
|
1148
|
+
ct as HeadTracker,
|
|
1135
1149
|
Xt as MAX_GIF_BYTES,
|
|
1136
1150
|
kt as MAX_GIF_FRAMES,
|
|
1137
1151
|
At as MAX_GIF_PIXELS,
|
|
1138
1152
|
at as PerspectiveCamera,
|
|
1139
|
-
|
|
1153
|
+
yt as ScreenRectAspectContext,
|
|
1140
1154
|
st as TEXTURE_FITS,
|
|
1141
1155
|
Lt as TextureSourceLoadError,
|
|
1142
1156
|
it as XRCompositor,
|
|
@@ -1150,14 +1164,14 @@ export {
|
|
|
1150
1164
|
Dt as createTextureSourceResolver,
|
|
1151
1165
|
Bt as disposeResolvedTextureSource,
|
|
1152
1166
|
vt as getFaceInfo,
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1167
|
+
_t as getPlaybackFrame,
|
|
1168
|
+
Wt as getSequenceFrame,
|
|
1169
|
+
Ct as getThreeBlending,
|
|
1156
1170
|
Rt as getThreeDepthFunction,
|
|
1157
1171
|
It as getThreeSide,
|
|
1158
1172
|
Ht as gifTextureSourceProvider,
|
|
1159
|
-
|
|
1160
|
-
|
|
1173
|
+
Mt as hasFullUnitUVBounds,
|
|
1174
|
+
Te as resolveCalibrationFaceDisplayMirrored,
|
|
1161
1175
|
Pt as resolveTextureSource,
|
|
1162
1176
|
$t as throwIfAborted,
|
|
1163
1177
|
Xe as useCalibrationFaceTracker,
|
|
@@ -1165,10 +1179,10 @@ export {
|
|
|
1165
1179
|
Et as useScreenSpace,
|
|
1166
1180
|
ut as useTrackerContext,
|
|
1167
1181
|
mt as useXRCameraTexture,
|
|
1168
|
-
|
|
1182
|
+
O as useXRContext,
|
|
1169
1183
|
ft as useXRError,
|
|
1170
1184
|
le as useXRModel,
|
|
1171
|
-
|
|
1185
|
+
de as useXRModelNode,
|
|
1172
1186
|
pt as useXRPipelineSnapshot,
|
|
1173
1187
|
gt as useXRReady,
|
|
1174
1188
|
bt as useXRRenderSize,
|