@vincentt-xr/sdk 2.0.0-alpha.7 → 2.0.0-alpha.8
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 +1109 -13
- package/dist/{DebuggerUI-BjOMr8q_.js → DebuggerUI-C-ldiozL.js} +1 -1
- package/dist/{DebuggerUI-B6bP6P9r.cjs → DebuggerUI-CWX5EtQv.cjs} +1 -1
- package/dist/FaceMeshRenderer-BEEXZwS6.cjs +158 -0
- package/dist/FaceMeshRenderer-UuH5sTXG.js +1322 -0
- package/dist/FaceRetouch-C7h7x9kd.js +683 -0
- package/dist/FaceRetouch-DqftT26Y.cjs +134 -0
- package/dist/GLTFLoader-C5q63sKO.js +1633 -0
- package/dist/GLTFLoader-Cb_CRwmG.cjs +1 -0
- package/dist/SegmentationOverlay-DQuW3dsc.js +133 -0
- package/dist/SegmentationOverlay-aWVod8Kl.cjs +1 -0
- package/dist/assets/cache.d.ts +99 -0
- package/dist/assets/estimate.d.ts +11 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/loaders.d.ts +28 -0
- package/dist/assets/react.d.ts +33 -0
- package/dist/calibration/calibration.d.ts +70 -0
- package/dist/calibration/index.d.ts +6 -0
- package/dist/calibration/storage.d.ts +13 -0
- package/dist/calibration/types.d.ts +53 -0
- package/dist/calibration/useXRCalibration.d.ts +46 -0
- package/dist/camera/CameraPermissionGate.d.ts +26 -0
- package/dist/camera/devices.d.ts +26 -0
- package/dist/camera/index.d.ts +8 -0
- package/dist/camera/permission.d.ts +86 -0
- package/dist/camera/useCameraPermission.d.ts +35 -0
- package/dist/capabilities/detect.d.ts +45 -0
- package/dist/capabilities/index.d.ts +5 -0
- package/dist/capabilities/types.d.ts +120 -0
- package/dist/capabilities/useXRCapabilities.d.ts +18 -0
- package/dist/compat/environment.d.ts +5 -0
- package/dist/compat/index.d.ts +4 -0
- package/dist/compat/run.d.ts +18 -0
- package/dist/compat/scenarios.d.ts +10 -0
- package/dist/compat/types.d.ts +101 -0
- package/dist/components/BodyTracker/index.d.ts +9 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +33 -3
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +12 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +1 -1
- package/dist/components/FaceMesh/index.d.ts +1 -1
- package/dist/components/GestureListener/index.d.ts +11 -0
- package/dist/components/HandTracker/index.d.ts +10 -0
- package/dist/components/HolisticTracker/index.d.ts +69 -0
- package/dist/components/HolisticTracker/settings.d.ts +58 -0
- package/dist/components/HolisticTracker/signals.d.ts +49 -0
- package/dist/components/IrisEffect/IrisMaterial.d.ts +73 -0
- package/dist/components/IrisEffect/index.d.ts +51 -0
- package/dist/components/IrisEffect/settings.d.ts +117 -0
- package/dist/components/LipEffect/LipEffect.d.ts +7 -1
- package/dist/components/LipEffect/LipEffectMaterial.d.ts +43 -7
- package/dist/components/LipEffect/LipEffects.d.ts +9 -0
- package/dist/components/LipEffect/defaults.d.ts +27 -4
- package/dist/components/LipEffect/index.d.ts +11 -3
- package/dist/components/LipEffect/settings.d.ts +271 -0
- package/dist/components/LipEffect/types.d.ts +56 -9
- package/dist/components/LipEffect/useLipDesignTextures.d.ts +11 -0
- package/dist/components/LipEffect/uvGuide.d.ts +59 -0
- package/dist/components/PersonCutout/index.d.ts +50 -0
- package/dist/components/PersonCutout/personCutout.d.ts +16 -0
- package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +1 -1
- package/dist/components/ScreenImage/index.d.ts +3 -1
- package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +1 -1
- package/dist/components/ScreenImage/materials/ScreenImageMaskMaterial.d.ts +11 -0
- package/dist/components/ScreenImage/source.d.ts +6 -0
- package/dist/components/ScreenImage/types.d.ts +18 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlay.d.ts +37 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlayMaterial.d.ts +31 -0
- package/dist/components/SegmentationOverlay/index.d.ts +9 -0
- package/dist/components/SegmentationOverlay/maskTexture.d.ts +23 -0
- package/dist/components/SegmentationOverlay/providers.d.ts +72 -0
- package/dist/components/SegmentationOverlay/settings.d.ts +65 -0
- package/dist/components/XRProvider/index.d.ts +16 -2
- package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/constants/index.d.ts +4 -1
- package/dist/contexts-CO0sd4JQ.cjs +1 -0
- package/dist/{contexts-ByhzppYl.js → contexts-FzlnnMYD.js} +252 -246
- package/dist/coordinates/feed.d.ts +52 -0
- package/dist/coordinates/index.d.ts +5 -0
- package/dist/coordinates/spaces.d.ts +49 -0
- package/dist/coordinates/viewport.d.ts +22 -0
- package/dist/coordinates/world.d.ts +15 -0
- package/dist/debug-ui/gesture-settings/index.d.ts +14 -0
- package/dist/debug-ui/holistic-tracker-settings/index.d.ts +16 -0
- package/dist/debug-ui/index.d.ts +14 -0
- package/dist/debug-ui/iris-effect-settings/index.d.ts +12 -0
- package/dist/debug-ui/lip-effect-settings/index.d.ts +15 -0
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui/product-hotspots/index.d.ts +24 -0
- package/dist/debug-ui/segmentation-overlay-settings/index.d.ts +12 -0
- package/dist/debug-ui/xr-diagnostics/index.d.ts +25 -0
- package/dist/debug-ui.cjs +3 -3
- package/dist/debug-ui.js +2057 -1687
- package/dist/detector-K8aej4MB.js +59 -0
- package/dist/detector-ijypGtse.cjs +1 -0
- package/dist/entries/core.d.ts +18 -1
- package/dist/entries/face-effects.d.ts +11 -3
- package/dist/entries/low-level.d.ts +22 -3
- package/dist/entries/product.d.ts +11 -0
- package/dist/entries/tracking.d.ts +24 -1
- package/dist/face-effects.cjs +155 -1
- package/dist/face-effects.js +1134 -2197
- package/dist/gestures/definitions.d.ts +85 -0
- package/dist/gestures/detector.d.ts +87 -0
- package/dist/gestures/index.d.ts +8 -0
- package/dist/gestures/measures.d.ts +101 -0
- package/dist/gestures/settings.d.ts +49 -0
- package/dist/{getFaceInfo-C4QpCQIY.js → getFaceInfo-BkZfaQs-.js} +5 -5
- package/dist/{getFaceInfo-fA1bFBub.cjs → getFaceInfo-ahPxQFGu.cjs} +1 -1
- package/dist/hooks/selectors.d.ts +68 -1
- package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
- package/dist/hooks/useFaceInfo.d.ts +13 -1
- package/dist/hooks/useFaceInfos.d.ts +1 -1
- package/dist/hooks/useGesture.d.ts +32 -0
- package/dist/hooks/useIrisTracking.d.ts +45 -0
- package/dist/hooks/useXRDiagnostics.d.ts +81 -0
- package/dist/hooks/useXRModel.d.ts +7 -0
- package/dist/hooks/useXRSession/facade.d.ts +42 -2
- package/dist/hooks/useXRSession/index.d.ts +2 -2
- package/dist/hooks/useXRSession/reason.d.ts +3 -1
- package/dist/hooks/useXRSession/registry.d.ts +14 -0
- package/dist/hooks/useXRSession/store.d.ts +52 -3
- package/dist/index--RgGzZ6X.cjs +47 -0
- package/dist/{index-VJ0SJwmG.js → index-CHVbH0hz.js} +4 -4
- package/dist/index-CeVkgsag.cjs +1 -0
- package/dist/index-CnGox6Xr.js +3054 -0
- package/dist/{index-ByoNj0QP.js → index-CsUdQ-pn.js} +113 -111
- package/dist/{index-BjmTe9eM.cjs → index-DKBAh6hV.cjs} +1 -1
- package/dist/index-DsZwTfG0.cjs +1 -0
- package/dist/index-Dw6tj2Mi.js +144 -0
- package/dist/index-OCPjOaeP.cjs +1 -0
- package/dist/{index-DXT3WccE.js → index-s9pF4zkG.js} +1065 -1101
- package/dist/internal-BYza1h8_.cjs +1 -0
- package/dist/{internal-Dmk1cTXq.js → internal-vsfNQycj.js} +15 -16
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/iris/compute.d.ts +25 -0
- package/dist/iris/index.d.ts +4 -0
- package/dist/iris/lead.d.ts +19 -0
- package/dist/iris/types.d.ts +87 -0
- package/dist/landmarkMask-CbTFzBYG.js +224 -0
- package/dist/landmarkMask-u7es2k4X.cjs +1 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +1085 -634
- package/dist/main.cjs +1 -1
- package/dist/main.js +1519 -465
- package/dist/measures-9dQPdw96.js +154 -0
- package/dist/measures-KfJzpvod.cjs +1 -0
- package/dist/models/Base/index.d.ts +49 -0
- package/dist/models/Body/index.d.ts +1 -1
- package/dist/models/Face/index.d.ts +1 -1
- package/dist/models/Hand/GestureTracking.d.ts +1 -1
- package/dist/models/Hand/HandTracking.d.ts +1 -1
- package/dist/models/Holistic/index.d.ts +49 -0
- package/dist/models/Holistic/result.d.ts +68 -0
- package/dist/models/SemanticSegmentation/index.d.ts +31 -0
- package/dist/models/SemanticSegmentation/presets.d.ts +28 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/product/ProductDimensions.d.ts +16 -0
- package/dist/product/ProductHotspot.d.ts +16 -0
- package/dist/product/ProductViewer.d.ts +9 -0
- package/dist/product/details.d.ts +53 -0
- package/dist/product/index.d.ts +14 -0
- package/dist/product/loadModelViewer.d.ts +4 -0
- package/dist/product/types.d.ts +71 -0
- package/dist/product/useProductAr.d.ts +37 -0
- package/dist/product/useProductDetails.d.ts +60 -0
- package/dist/product.cjs +1 -0
- package/dist/product.js +414 -0
- package/dist/providers-C0Dlhh9Z.js +365 -0
- package/dist/providers-YNwkmNeK.cjs +62 -0
- package/dist/quality/XRQualityController.d.ts +25 -0
- package/dist/quality/controller.d.ts +33 -0
- package/dist/quality/index.d.ts +6 -0
- package/dist/quality/types.d.ts +100 -0
- package/dist/quality/useXRQuality.d.ts +28 -0
- package/dist/{renderGroups-KZk6eRiY.js → renderGroups-CN1cGFUo.js} +1 -1
- package/dist/{renderGroups-80H3DpTl.cjs → renderGroups-O4KmaMl9.cjs} +1 -1
- package/dist/renderPasses-Cg-zqmEz.cjs +21 -0
- package/dist/renderPasses-NnKZVfBy.js +1460 -0
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/screenTransform-BenfCtZt.js +44 -0
- package/dist/screenTransform-BiXdpVf0.cjs +1 -0
- package/dist/segmentation-9PhSvc-R.cjs +1 -0
- package/dist/segmentation-CeOTKemr.js +5 -0
- package/dist/segmentation2d/faceMemory.d.ts +28 -0
- package/dist/segmentation2d/faceRegions.d.ts +24 -0
- package/dist/segmentation2d/index.d.ts +9 -0
- package/dist/segmentation2d/maskUv.d.ts +23 -0
- package/dist/segmentation2d/rasterize.d.ts +14 -0
- package/dist/segmentation2d/types.d.ts +46 -0
- package/dist/selectors-C5G1PMYL.js +195 -0
- package/dist/selectors-Du_PsVnW.cjs +1 -0
- package/dist/{session-CpkiK5YA.cjs → session-BBr0yN8h.cjs} +7 -7
- package/dist/{session-DLFN_VII.js → session-Cy0m7l7-.js} +76 -76
- package/dist/settings-DRR7-snV.cjs +1 -0
- package/dist/settings-aQk845NJ.js +73 -0
- package/dist/subjects/index.d.ts +2 -0
- package/dist/subjects/select.d.ts +62 -0
- package/dist/subjects/types.d.ts +55 -0
- package/dist/tracking-config/apply.d.ts +57 -0
- package/dist/tracking-config/index.d.ts +7 -0
- package/dist/tracking-config/resolve.d.ts +25 -0
- package/dist/tracking-config/storage.d.ts +8 -0
- package/dist/tracking-config/types.d.ts +106 -0
- package/dist/tracking-config/useXRTrackingConfig.d.ts +38 -0
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +1056 -383
- package/dist/types/compositor.d.ts +21 -0
- package/dist/types/holistic.d.ts +121 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model.d.ts +22 -2
- package/dist/types/nodes.d.ts +27 -2
- package/dist/types/segmentation.d.ts +19 -0
- package/dist/types/session.d.ts +41 -3
- package/dist/useFaceInfo-Blf7FCu3.js +303 -0
- package/dist/useFaceInfo-C5mO8NQY.cjs +1 -0
- package/dist/useXRCapabilities-B1R2ghy-.cjs +1 -0
- package/dist/useXRCapabilities-C68v__wB.js +30 -0
- package/dist/utils/fns.d.ts +6 -3
- package/dist/utils/integrity.d.ts +4 -1
- package/dist/utils/updateThrottle.d.ts +2 -0
- package/dist/utils/useStableUniforms.d.ts +18 -0
- package/docs/api/adaptive-quality.mdx +104 -0
- package/docs/api/asset-lifecycle.mdx +78 -0
- package/docs/api/camera-permission.mdx +142 -0
- package/docs/api/coordinate-spaces.mdx +165 -0
- package/docs/api/cross-camera.mdx +88 -0
- package/docs/api/diagnostics-calibration.mdx +97 -0
- package/docs/api/face-effects.mdx +6 -0
- package/docs/api/face-mesh.mdx +4 -2
- package/docs/api/gestures.mdx +173 -0
- package/docs/api/holistic-tracker.mdx +159 -0
- package/docs/api/iris-tracking.mdx +242 -0
- package/docs/api/multi-subject.mdx +95 -0
- package/docs/api/person-cutout.mdx +136 -0
- package/docs/api/product-ar.mdx +111 -0
- package/docs/api/product-details.mdx +78 -0
- package/docs/api/screen-space-coordinates.mdx +4 -1
- package/docs/api/segmentation-overlay.mdx +301 -0
- package/docs/api/session-lifecycle.mdx +136 -0
- package/docs/api/trackers.mdx +5 -0
- package/docs/api/tracking-config.mdx +108 -0
- package/docs/docs.json +23 -1
- package/docs/examples/lip-shaders.mdx +224 -0
- package/docs/guides/lip-effect-textures.mdx +292 -0
- package/docs/guides/lip-uv-template.png +0 -0
- package/docs/guides/lip-uv-template.svg +1 -0
- package/package.json +13 -1
- package/dist/FaceMeshRenderer-C5l6VLdO.cjs +0 -155
- package/dist/FaceMeshRenderer-wjAHrJzP.js +0 -1270
- package/dist/FaceRetouch-BkJzoA79.cjs +0 -134
- package/dist/FaceRetouch-DwbKQJAN.js +0 -551
- package/dist/contexts-Dr62It_K.cjs +0 -1
- package/dist/index-9dlAQAhy.js +0 -1462
- package/dist/index-BpEf2BBb.cjs +0 -1
- package/dist/index-CyUUurQT.cjs +0 -1
- package/dist/index-DCiMbxC3.cjs +0 -1
- package/dist/index-DpI-qo5X.cjs +0 -17
- package/dist/index-DyVF4vEW.js +0 -111
- package/dist/internal-Cq-TEQ5Y.cjs +0 -1
- package/dist/renderLayers-lDtL0_43.cjs +0 -1
- package/dist/renderLayers-zrK2pv5O.js +0 -13
- package/dist/renderPasses-BOoBSr8z.cjs +0 -21
- package/dist/renderPasses-BcquyVtu.js +0 -1500
- package/dist/selectors-B8H97CKA.js +0 -59
- package/dist/selectors-CZLKT2Iv.cjs +0 -1
- package/dist/useFaceInfo-BJ8-_MOs.cjs +0 -1
- package/dist/useFaceInfo-Dk426LTu.js +0 -62
- package/dist/useFaceResults-CtetsO9M.js +0 -19
- package/dist/useFaceResults-wBJF3zyp.cjs +0 -1
package/dist/scene-object.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./renderPasses-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./renderPasses-Cg-zqmEz.cjs"),t=require("./renderGroups-O4KmaMl9.cjs");exports.addComponentToObject=e.addComponentToObject;exports.componentDefaults=e.componentDefaults;exports.createDefaultComponent=e.createDefaultComponent;exports.createDefaultFaceMeshRendererSettings=e.createDefaultFaceMeshRendererSettings;exports.createDefaultMaterialSettings=e.createDefaultMaterialSettings;exports.createDefaultMeshRendererSettings=e.createDefaultMeshRendererSettings;exports.createDefaultScreenImageSettings=e.createDefaultScreenImageSettings;exports.createDefaultScreenShapeSettings=e.createDefaultScreenShapeSettings;exports.createDefaultScreenTextSettings=e.createDefaultScreenTextSettings;exports.createDefaultScreenTransformSettings=e.createDefaultScreenTransformSettings;exports.createDefaultTextureSettings=e.createDefaultTextureSettings;exports.createDefaultTransformSettings=e.createDefaultTransformSettings;exports.createOrderedComponentsSelector=e.createOrderedComponentsSelector;exports.createSceneComponentId=e.createSceneComponentId;exports.createSceneId=e.createSceneId;exports.createSceneObject=e.createSceneObject;exports.createSceneObjectId=e.createSceneObjectId;exports.deleteSceneObject=e.deleteSceneObject;exports.getOrderedComponents=e.getOrderedComponents;exports.getSceneObjectChildren=e.getSceneObjectChildren;exports.moveComponent=e.moveComponent;exports.removeComponent=e.removeComponent;exports.replaceSceneComponent=e.replaceSceneComponent;exports.replaceSceneObject=e.replaceSceneObject;exports.setSceneObjectParent=e.setSceneObjectParent;exports.setSceneObjectParentPreserveWorldTransform=e.setSceneObjectParentPreserveWorldTransform;exports.setSceneObjectVisible=e.setSceneObjectVisible;exports.DEFAULT_RENDER_GROUP_IDS=t.DEFAULT_RENDER_GROUP_IDS;exports.RENDER_GROUP_POLICIES=t.RENDER_GROUP_POLICIES;exports.createRenderPlan=t.createRenderPlan;exports.getDefaultRenderGroupId=t.getDefaultRenderGroupId;exports.migrateToRenderGroups=t.migrateToRenderGroups;exports.moveObjectToGroup=t.moveObjectToGroup;exports.reorderObjectWithinGroup=t.reorderObjectWithinGroup;exports.reorderRenderGroup=t.reorderRenderGroup;exports.validateGroupCompatibility=t.validateGroupCompatibility;
|
package/dist/scene-object.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a, c as r, b as s, d as n, e as c, f as o, g as S, i as l, h as d, j as m, k as p, l as i, q as u, m as f, n as D, o as g, p as O, r as b, s as R, t as j, u as C, v as T, w as G, x as I, y as v, z as P, A as h } from "./renderPasses-
|
|
2
|
-
import { D as x, R as _, c as M, g as U, m as y, a as A, r as F, b as L, v as N } from "./renderGroups-
|
|
1
|
+
import { a, c as r, b as s, d as n, e as c, f as o, g as S, i as l, h as d, j as m, k as p, l as i, q as u, m as f, n as D, o as g, p as O, r as b, s as R, t as j, u as C, v as T, w as G, x as I, y as v, z as P, A as h } from "./renderPasses-NnKZVfBy.js";
|
|
2
|
+
import { D as x, R as _, c as M, g as U, m as y, a as A, r as F, b as L, v as N } from "./renderGroups-CN1cGFUo.js";
|
|
3
3
|
export {
|
|
4
4
|
x as DEFAULT_RENDER_GROUP_IDS,
|
|
5
5
|
_ as RENDER_GROUP_POLICIES,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const R = {
|
|
2
|
+
width: 720,
|
|
3
|
+
height: 1280
|
|
4
|
+
}, _ = 32, d = 0.5, o = {
|
|
5
|
+
enabled: !0,
|
|
6
|
+
position: { x: 0, y: 0 },
|
|
7
|
+
size: { width: 680, height: 1230 },
|
|
8
|
+
pivot: [0.5, 0.5],
|
|
9
|
+
rotation: 0,
|
|
10
|
+
scale2D: { x: 1, y: 1 },
|
|
11
|
+
referencePixelsPerUnit: _,
|
|
12
|
+
renderOrder: 999,
|
|
13
|
+
overlay: !0,
|
|
14
|
+
visible: !0,
|
|
15
|
+
showTransformGuides: !1
|
|
16
|
+
}, x = Math.PI / 180, l = (e, i) => i <= 0 ? e : Math.round(e / i) * i, a = ({
|
|
17
|
+
transform: e,
|
|
18
|
+
parentSize: i,
|
|
19
|
+
root: h = R,
|
|
20
|
+
snapIncrement: E = d
|
|
21
|
+
}) => {
|
|
22
|
+
const s = Math.min(i.width / h.width, i.height / h.height) * (_ / e.referencePixelsPerUnit), t = e.size.width * e.scale2D.x * s, c = e.size.height * e.scale2D.y * s, T = l(e.position.x, E) * s, p = l(e.position.y, E) * s, n = (e.pivot[0] - 0.5) * t, D = (e.pivot[1] - 0.5) * c;
|
|
23
|
+
return {
|
|
24
|
+
center: [T - n, p - D, 0],
|
|
25
|
+
size: [t, c, 1],
|
|
26
|
+
rotation: [0, 0, e.rotation * x],
|
|
27
|
+
pivotOffset: [n / Math.max(t, 1e-6), D / Math.max(c, 1e-6), 0],
|
|
28
|
+
aspect: t > 0 && c > 0 ? Math.abs(t / c) : 1
|
|
29
|
+
};
|
|
30
|
+
}, M = (e) => ({
|
|
31
|
+
...o,
|
|
32
|
+
...e,
|
|
33
|
+
position: { ...o.position, ...e == null ? void 0 : e.position },
|
|
34
|
+
size: { ...o.size, ...e == null ? void 0 : e.size },
|
|
35
|
+
scale2D: { ...o.scale2D, ...e == null ? void 0 : e.scale2D }
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
R as D,
|
|
39
|
+
_ as a,
|
|
40
|
+
o as b,
|
|
41
|
+
d as c,
|
|
42
|
+
M as m,
|
|
43
|
+
a as r
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n={width:720,height:1280},s=32,N=.5,c={enabled:!0,position:{x:0,y:0},size:{width:680,height:1230},pivot:[.5,.5],rotation:0,scale2D:{x:1,y:1},referencePixelsPerUnit:s,renderOrder:999,overlay:!0,visible:!0,showTransformGuides:!1},A=Math.PI/180,D=(e,i)=>i<=0?e:Math.round(e/i)*i,F=({transform:e,parentSize:i,root:_=n,snapIncrement:h=N})=>{const o=Math.min(i.width/_.width,i.height/_.height)*(s/e.referencePixelsPerUnit),t=e.size.width*e.scale2D.x*o,E=e.size.height*e.scale2D.y*o,S=D(e.position.x,h)*o,l=D(e.position.y,h)*o,T=(e.pivot[0]-.5)*t,R=(e.pivot[1]-.5)*E;return{center:[S-T,l-R,0],size:[t,E,1],rotation:[0,0,e.rotation*A],pivotOffset:[T/Math.max(t,1e-6),R/Math.max(E,1e-6),0],aspect:t>0&&E>0?Math.abs(t/E):1}},U=e=>({...c,...e,position:{...c.position,...e==null?void 0:e.position},size:{...c.size,...e==null?void 0:e.size},scale2D:{...c.scale2D,...e==null?void 0:e.scale2D}});exports.DEFAULT_PIXEL_SNAP_INCREMENT=N;exports.DEFAULT_REFERENCE_PIXELS_PER_UNIT=s;exports.DEFAULT_SCREEN_TRANSFORM_2D=c;exports.DEFAULT_SCREEN_TRANSFORM_ROOT=n;exports.mergeScreenTransform2D=U;exports.resolveScreenTransform2D=F;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=["portrait"],T=["hair","multiclass"];exports.SEGMENTATION_TYPES=E;exports.SEMANTIC_SEGMENTATION_PRESETS=T;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TrackPoint } from './types';
|
|
2
|
+
export type FaceTrackMemoryOptions = {
|
|
3
|
+
/** Keep a lost face for this long (ms) before dropping it. */
|
|
4
|
+
holdMs: number;
|
|
5
|
+
/** While held, move the face along its last velocity for up to this long (ms). */
|
|
6
|
+
predictMs: number;
|
|
7
|
+
/**
|
|
8
|
+
* Velocity is only estimated from two detections closer than this (ms);
|
|
9
|
+
* after a longer gap the face is treated as stationary. Default 250.
|
|
10
|
+
*/
|
|
11
|
+
maxVelocityGapMs?: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Bridges tracker dropouts for landmark sets. Each face slot remembers its
|
|
15
|
+
* last landmarks and a smoothed velocity. While a face is missing it is
|
|
16
|
+
* replayed for `holdMs`, extrapolated along the velocity for the first
|
|
17
|
+
* `predictMs`, then held still. Arrays are reused; treat results as
|
|
18
|
+
* read-only and valid until the next `update`.
|
|
19
|
+
*/
|
|
20
|
+
export declare class FaceTrackMemory {
|
|
21
|
+
private options;
|
|
22
|
+
private slots;
|
|
23
|
+
constructor(options: FaceTrackMemoryOptions);
|
|
24
|
+
setOptions(options: FaceTrackMemoryOptions): void;
|
|
25
|
+
/** Landmark sets to draw this frame: live faces, plus held/predicted ones. */
|
|
26
|
+
update<P extends TrackPoint>(faces: ReadonlyArray<ReadonlyArray<P>>, nowMs: number): ReadonlyArray<ReadonlyArray<P | Required<TrackPoint>>>;
|
|
27
|
+
reset(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MaskPoint, SemanticMask } from './types';
|
|
2
|
+
/** Regions the landmark rasterizer can produce from MediaPipe's 468 points. */
|
|
3
|
+
export declare const FACE_REGION_LABELS: readonly ["bg", "face_skin", "brows", "eyes", "lips", "mouth"];
|
|
4
|
+
export type FaceRegionLabel = (typeof FACE_REGION_LABELS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Landmark polygons per region, drawn in this order so features overwrite
|
|
7
|
+
* the skin they sit on and the mouth interior overwrites the lips.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FACE_REGION_POLYGONS: ReadonlyArray<{
|
|
10
|
+
label: Exclude<FaceRegionLabel, "bg">;
|
|
11
|
+
polygons: ReadonlyArray<readonly number[]>;
|
|
12
|
+
}>;
|
|
13
|
+
export type RasterizeFaceRegionsOptions = {
|
|
14
|
+
/** Only draw these regions; the rest stay `bg`. Default: all. */
|
|
15
|
+
regions?: readonly FaceRegionLabel[];
|
|
16
|
+
/** Reset the mask first. Default true; pass false to stack several faces. */
|
|
17
|
+
clear?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Rasterize one face's landmark regions into a mask whose labels are
|
|
21
|
+
* `FACE_REGION_LABELS`. Landmarks are normalized feed coordinates (y down),
|
|
22
|
+
* exactly as the face tracker publishes them, so the result is in feed space.
|
|
23
|
+
*/
|
|
24
|
+
export declare const rasterizeFaceRegions: (mask: SemanticMask, landmarks: ReadonlyArray<MaskPoint>, { regions, clear }?: RasterizeFaceRegionsOptions, scratch?: MaskPoint[]) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { SEMANTIC_MASK_LABELS } from './types';
|
|
2
|
+
export type { MaskPoint, SemanticMask, SemanticMaskLabel, SemanticMaskSpace, TrackPoint, } from './types';
|
|
3
|
+
export { clearSemanticMask, createSemanticMask, fillLandmarkPolygon, fillPolygon, semanticMaskLabelIndex, } from './rasterize';
|
|
4
|
+
export { FACE_REGION_LABELS, FACE_REGION_POLYGONS, rasterizeFaceRegions } from './faceRegions';
|
|
5
|
+
export type { FaceRegionLabel, RasterizeFaceRegionsOptions } from './faceRegions';
|
|
6
|
+
export { computeMaskUvTransform } from './maskUv';
|
|
7
|
+
export { FaceTrackMemory } from './faceMemory';
|
|
8
|
+
export type { FaceTrackMemoryOptions } from './faceMemory';
|
|
9
|
+
export type { MaskUvTransformInput } from './maskUv';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SemanticMaskSpace } from './types';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
export type MaskUvTransformInput = {
|
|
4
|
+
space?: SemanticMaskSpace;
|
|
5
|
+
/** Flip the mask horizontally (the feed is mirrored relative to the mask's source). */
|
|
6
|
+
mirrored?: boolean;
|
|
7
|
+
/** Mask pixel size; with `space: "source"` this is also the source aspect ratio. */
|
|
8
|
+
maskWidth: number;
|
|
9
|
+
maskHeight: number;
|
|
10
|
+
/** Feed (camera texture) pixel size, used to cover-fit a source-space mask. */
|
|
11
|
+
feedWidth: number;
|
|
12
|
+
feedHeight: number;
|
|
13
|
+
/** The session's framing zoom (`perf.cameraZoom`) for source-space masks. Default 1. */
|
|
14
|
+
zoom?: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The matrix that maps feed UV (the full-screen quad's `uv`, v up) to mask UV
|
|
18
|
+
* (`DataTexture` space, row 0 at v = 0). Feed-space masks only need the row
|
|
19
|
+
* flip and the optional mirror; source-space masks are additionally
|
|
20
|
+
* cover-fitted with the same `computeFitLayout` the session uses to build
|
|
21
|
+
* the feed, undoing the centred crop (and zoom) it applied to the media.
|
|
22
|
+
*/
|
|
23
|
+
export declare const computeMaskUvTransform: ({ space, mirrored, maskWidth, maskHeight, feedWidth, feedHeight, zoom, }: MaskUvTransformInput, target?: THREE.Matrix3) => THREE.Matrix3;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MaskPoint, SemanticMask, SemanticMaskSpace } from './types';
|
|
2
|
+
export declare const createSemanticMask: (width: number, height: number, labels: readonly string[], space?: SemanticMaskSpace) => SemanticMask;
|
|
3
|
+
/** Reset every pixel to class 0 (`bg`). Does not bump `version`. */
|
|
4
|
+
export declare const clearSemanticMask: (mask: SemanticMask) => void;
|
|
5
|
+
/** Class index for a label, or -1 when the mask does not carry it. */
|
|
6
|
+
export declare const semanticMaskLabelIndex: (mask: Pick<SemanticMask, "labels">, label: string) => number;
|
|
7
|
+
/**
|
|
8
|
+
* Fill a polygon given in normalized mask coordinates (0..1, y down) with a
|
|
9
|
+
* class index, even-odd scanline rule. Pixels are filled when their centre
|
|
10
|
+
* lies inside, so a polygon's edges land within half a pixel.
|
|
11
|
+
*/
|
|
12
|
+
export declare const fillPolygon: (mask: SemanticMask, points: MaskPoint[], classIndex: number) => void;
|
|
13
|
+
/** Fill the polygon formed by the given landmark indices (normalized x/y, y down). */
|
|
14
|
+
export declare const fillLandmarkPolygon: (mask: SemanticMask, landmarks: ReadonlyArray<MaskPoint>, landmarkIndices: readonly number[], classIndex: number, scratch?: MaskPoint[]) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A semantic segmentation mask: one class index per pixel plus the label
|
|
3
|
+
* each index stands for. Row 0 is the top row.
|
|
4
|
+
*
|
|
5
|
+
* `space` says which pixels the mask describes:
|
|
6
|
+
* - `"feed"` (default): the session camera texture — what the trackers see,
|
|
7
|
+
* already cover-cropped to the viewport and mirrored for webcams. Landmark
|
|
8
|
+
* and SDK segmentation masks are in this space.
|
|
9
|
+
* - `"source"`: the raw media frame (a `<video>` / `<img>` at native size).
|
|
10
|
+
* The overlay cover-fits it to the feed; set `mirrored` on the overlay
|
|
11
|
+
* when the feed is mirrored relative to the source (webcam selfie view).
|
|
12
|
+
*/
|
|
13
|
+
export type SemanticMask = {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
/** Row-major class indices, `width * height` entries. */
|
|
17
|
+
indices: Uint8Array;
|
|
18
|
+
/** `labels[index]` names class `index`; index 0 is conventionally `bg`. */
|
|
19
|
+
labels: readonly string[];
|
|
20
|
+
space?: SemanticMaskSpace;
|
|
21
|
+
/**
|
|
22
|
+
* Bumped by producers on every change so consumers can re-upload lazily.
|
|
23
|
+
* `0` means "no data yet"; overlays draw nothing until the first bump.
|
|
24
|
+
*/
|
|
25
|
+
version: number;
|
|
26
|
+
};
|
|
27
|
+
export type SemanticMaskSpace = "feed" | "source";
|
|
28
|
+
/**
|
|
29
|
+
* Labels the SDK's own providers can produce: face regions from landmarks,
|
|
30
|
+
* person / background from portrait segmentation, and hair from the hair
|
|
31
|
+
* segmenter. A mask may carry any other
|
|
32
|
+
* label an external model emits (for example `beard` or `ears` from a
|
|
33
|
+
* face-parsing model); nothing in the SDK produces those today.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SEMANTIC_MASK_LABELS: readonly ["bg", "brows", "eyes", "face_skin", "hair", "lips", "mouth", "person"];
|
|
36
|
+
export type SemanticMaskLabel = (typeof SEMANTIC_MASK_LABELS)[number];
|
|
37
|
+
export type MaskPoint = {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
};
|
|
41
|
+
/** A landmark with optional depth; `FaceTrackMemory` carries `z` through when present. */
|
|
42
|
+
export type TrackPoint = {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
z?: number;
|
|
46
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { useSyncExternalStore as t, useMemo as i } from "react";
|
|
2
|
+
import { u as p, m as d, s as h, i as g, c as S } from "./index-CnGox6Xr.js";
|
|
3
|
+
const C = {
|
|
4
|
+
/** Camera background and segmentation mask. `depthTest` disabled. */
|
|
5
|
+
BACKGROUND: -1e3,
|
|
6
|
+
/** Free world-space content. `depthTest` enabled. */
|
|
7
|
+
WORLD: 0,
|
|
8
|
+
/** Descendants of `FaceTracker` / `HandTracker` / `BodyTracker`. `depthTest` enabled. */
|
|
9
|
+
TRACKED: 100,
|
|
10
|
+
/** Descendants of `ScreenSpaceUI`. `depthTest` disabled. */
|
|
11
|
+
SCREEN_UI: 1e3
|
|
12
|
+
}, n = () => p().session.store, s = (e) => (o) => e.subscribe(o), k = () => {
|
|
13
|
+
const e = n();
|
|
14
|
+
return t(
|
|
15
|
+
s(e),
|
|
16
|
+
() => e.getSnapshot().ready,
|
|
17
|
+
() => !1
|
|
18
|
+
);
|
|
19
|
+
}, R = () => {
|
|
20
|
+
const e = n();
|
|
21
|
+
return t(
|
|
22
|
+
s(e),
|
|
23
|
+
() => e.getSnapshot().error,
|
|
24
|
+
() => {
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}, m = () => {
|
|
28
|
+
const e = n();
|
|
29
|
+
return t(
|
|
30
|
+
s(e),
|
|
31
|
+
() => e.getSnapshot().lifecycle,
|
|
32
|
+
() => "idle"
|
|
33
|
+
);
|
|
34
|
+
}, M = () => {
|
|
35
|
+
const e = n();
|
|
36
|
+
return t(
|
|
37
|
+
s(e),
|
|
38
|
+
() => e.getSnapshot().modelErrors,
|
|
39
|
+
() => f
|
|
40
|
+
);
|
|
41
|
+
}, f = /* @__PURE__ */ new Map(), T = () => {
|
|
42
|
+
const e = n(), o = t(
|
|
43
|
+
s(e),
|
|
44
|
+
() => e.getSnapshot().sourceKind,
|
|
45
|
+
() => {
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
return g(o);
|
|
49
|
+
}, D = () => {
|
|
50
|
+
const e = n();
|
|
51
|
+
return t(
|
|
52
|
+
s(e),
|
|
53
|
+
() => e.getSnapshot().orientation,
|
|
54
|
+
() => E
|
|
55
|
+
);
|
|
56
|
+
}, E = { type: "portrait", angle: 0 }, v = () => {
|
|
57
|
+
const e = n();
|
|
58
|
+
return t(
|
|
59
|
+
s(e),
|
|
60
|
+
() => e.getSnapshot().cameraDeviceId,
|
|
61
|
+
() => null
|
|
62
|
+
);
|
|
63
|
+
}, O = () => {
|
|
64
|
+
const e = n();
|
|
65
|
+
return t(
|
|
66
|
+
s(e),
|
|
67
|
+
() => e.getSnapshot().qualityConfig,
|
|
68
|
+
() => null
|
|
69
|
+
);
|
|
70
|
+
}, A = () => {
|
|
71
|
+
const e = n();
|
|
72
|
+
return t(
|
|
73
|
+
s(e),
|
|
74
|
+
() => e.getSnapshot().quality,
|
|
75
|
+
() => null
|
|
76
|
+
);
|
|
77
|
+
}, F = () => {
|
|
78
|
+
const e = n();
|
|
79
|
+
return t(
|
|
80
|
+
s(e),
|
|
81
|
+
() => e.getSnapshot().cameraFacing,
|
|
82
|
+
() => null
|
|
83
|
+
);
|
|
84
|
+
}, K = () => {
|
|
85
|
+
const e = n(), o = t(
|
|
86
|
+
s(e),
|
|
87
|
+
() => e.getSnapshot().cameraPermission,
|
|
88
|
+
() => "unknown"
|
|
89
|
+
), r = t(
|
|
90
|
+
s(e),
|
|
91
|
+
() => e.getSnapshot().cameraPermissionReason,
|
|
92
|
+
() => null
|
|
93
|
+
);
|
|
94
|
+
return i(() => ({ state: o, reason: r }), [o, r]);
|
|
95
|
+
}, W = (e) => {
|
|
96
|
+
const o = n(), { session: r } = p(), a = R(), u = t(
|
|
97
|
+
s(o),
|
|
98
|
+
() => o.getSnapshot().pipeline.get(e) ?? null,
|
|
99
|
+
() => null
|
|
100
|
+
), c = t(
|
|
101
|
+
s(o),
|
|
102
|
+
() => o.getSnapshot().modelErrors.get(e) ?? null,
|
|
103
|
+
() => null
|
|
104
|
+
), l = m();
|
|
105
|
+
return i(() => c ? { status: "error", fallback: d(c.error) } : a ? { status: "blocked", fallback: h(a.reason) } : u ? { status: "ready", fallback: null } : { status: r.registry.getState(e) === "initializing" ? "loading" : "unavailable", fallback: null }, [c, a, u, r, e, l]);
|
|
106
|
+
}, w = () => {
|
|
107
|
+
const e = n();
|
|
108
|
+
return t(
|
|
109
|
+
s(e),
|
|
110
|
+
() => e.getSnapshot().cameraTexture,
|
|
111
|
+
() => {
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}, x = () => {
|
|
115
|
+
const e = n(), o = t(
|
|
116
|
+
s(e),
|
|
117
|
+
() => e.getSnapshot().renderWidth,
|
|
118
|
+
() => 0
|
|
119
|
+
), r = t(
|
|
120
|
+
s(e),
|
|
121
|
+
() => e.getSnapshot().renderHeight,
|
|
122
|
+
() => 0
|
|
123
|
+
);
|
|
124
|
+
return i(() => ({ width: o, height: r }), [o, r]);
|
|
125
|
+
}, H = () => {
|
|
126
|
+
const e = n(), o = t(
|
|
127
|
+
s(e),
|
|
128
|
+
() => e.getSnapshot().sourceWidth,
|
|
129
|
+
() => 0
|
|
130
|
+
), r = t(
|
|
131
|
+
s(e),
|
|
132
|
+
() => e.getSnapshot().sourceHeight,
|
|
133
|
+
() => 0
|
|
134
|
+
), a = t(
|
|
135
|
+
s(e),
|
|
136
|
+
() => e.getSnapshot().renderWidth,
|
|
137
|
+
() => 0
|
|
138
|
+
), u = t(
|
|
139
|
+
s(e),
|
|
140
|
+
() => e.getSnapshot().renderHeight,
|
|
141
|
+
() => 0
|
|
142
|
+
), c = t(
|
|
143
|
+
s(e),
|
|
144
|
+
() => e.getSnapshot().cameraZoom,
|
|
145
|
+
() => 1.2
|
|
146
|
+
), l = t(
|
|
147
|
+
s(e),
|
|
148
|
+
() => e.getSnapshot().sourceKind,
|
|
149
|
+
() => {
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
return i(
|
|
153
|
+
() => S({
|
|
154
|
+
source: { width: o, height: r },
|
|
155
|
+
feed: { width: a, height: u },
|
|
156
|
+
zoom: c,
|
|
157
|
+
mirrored: g(l)
|
|
158
|
+
}),
|
|
159
|
+
[o, r, a, u, c, l]
|
|
160
|
+
);
|
|
161
|
+
}, I = (e) => {
|
|
162
|
+
const o = n(), r = t(
|
|
163
|
+
s(o),
|
|
164
|
+
() => o.getSnapshot().pipeline.get(e) ?? null,
|
|
165
|
+
() => null
|
|
166
|
+
);
|
|
167
|
+
return i(() => r ? r.getModelNode() : null, [r]);
|
|
168
|
+
}, L = () => {
|
|
169
|
+
const e = n(), o = t(
|
|
170
|
+
s(e),
|
|
171
|
+
() => e.getSnapshot().pipeline,
|
|
172
|
+
() => e.getSnapshot().pipeline
|
|
173
|
+
);
|
|
174
|
+
return i(() => Array.from(o.keys()), [o]);
|
|
175
|
+
};
|
|
176
|
+
export {
|
|
177
|
+
C as R,
|
|
178
|
+
I as a,
|
|
179
|
+
k as b,
|
|
180
|
+
R as c,
|
|
181
|
+
A as d,
|
|
182
|
+
O as e,
|
|
183
|
+
m as f,
|
|
184
|
+
M as g,
|
|
185
|
+
W as h,
|
|
186
|
+
K as i,
|
|
187
|
+
F as j,
|
|
188
|
+
v as k,
|
|
189
|
+
T as l,
|
|
190
|
+
D as m,
|
|
191
|
+
x as n,
|
|
192
|
+
H as o,
|
|
193
|
+
L as p,
|
|
194
|
+
w as u
|
|
195
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react"),a=require("./index-CeVkgsag.cjs"),d={BACKGROUND:-1e3,WORLD:0,TRACKED:100,SCREEN_UI:1e3},n=()=>a.useXRContext().session.store,r=e=>s=>e.subscribe(s),g=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().ready,()=>!1)},S=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().error,()=>{})},R=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().lifecycle,()=>"idle")},p=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().modelErrors,()=>h)},h=new Map,E=()=>{const e=n(),s=t.useSyncExternalStore(r(e),()=>e.getSnapshot().sourceKind,()=>{});return a.isMirroredSourceKind(s)},y=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().orientation,()=>X)},X={type:"portrait",angle:0},m=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().cameraDeviceId,()=>null)},x=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().qualityConfig,()=>null)},C=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().quality,()=>null)},M=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().cameraFacing,()=>null)},f=()=>{const e=n(),s=t.useSyncExternalStore(r(e),()=>e.getSnapshot().cameraPermission,()=>"unknown"),o=t.useSyncExternalStore(r(e),()=>e.getSnapshot().cameraPermissionReason,()=>null);return t.useMemo(()=>({state:s,reason:o}),[s,o])},T=e=>{const s=n(),{session:o}=a.useXRContext(),u=S(),i=t.useSyncExternalStore(r(s),()=>s.getSnapshot().pipeline.get(e)??null,()=>null),c=t.useSyncExternalStore(r(s),()=>s.getSnapshot().modelErrors.get(e)??null,()=>null),l=R();return t.useMemo(()=>c?{status:"error",fallback:a.mapModelErrorToReason(c.error)}:u?{status:"blocked",fallback:a.sessionReasonToFallback(u.reason)}:i?{status:"ready",fallback:null}:{status:o.registry.getState(e)==="initializing"?"loading":"unavailable",fallback:null},[c,u,i,o,e,l])},b=()=>{const e=n();return t.useSyncExternalStore(r(e),()=>e.getSnapshot().cameraTexture,()=>{})},k=()=>{const e=n(),s=t.useSyncExternalStore(r(e),()=>e.getSnapshot().renderWidth,()=>0),o=t.useSyncExternalStore(r(e),()=>e.getSnapshot().renderHeight,()=>0);return t.useMemo(()=>({width:s,height:o}),[s,o])},D=()=>{const e=n(),s=t.useSyncExternalStore(r(e),()=>e.getSnapshot().sourceWidth,()=>0),o=t.useSyncExternalStore(r(e),()=>e.getSnapshot().sourceHeight,()=>0),u=t.useSyncExternalStore(r(e),()=>e.getSnapshot().renderWidth,()=>0),i=t.useSyncExternalStore(r(e),()=>e.getSnapshot().renderHeight,()=>0),c=t.useSyncExternalStore(r(e),()=>e.getSnapshot().cameraZoom,()=>1.2),l=t.useSyncExternalStore(r(e),()=>e.getSnapshot().sourceKind,()=>{});return t.useMemo(()=>a.computeFeedCrop({source:{width:s,height:o},feed:{width:u,height:i},zoom:c,mirrored:a.isMirroredSourceKind(l)}),[s,o,u,i,c,l])},v=e=>{const s=n(),o=t.useSyncExternalStore(r(s),()=>s.getSnapshot().pipeline.get(e)??null,()=>null);return t.useMemo(()=>o?o.getModelNode():null,[o])},F=()=>{const e=n(),s=t.useSyncExternalStore(r(e),()=>e.getSnapshot().pipeline,()=>e.getSnapshot().pipeline);return t.useMemo(()=>Array.from(s.keys()),[s])};exports.RENDER_LAYERS=d;exports.useXRCameraDeviceId=m;exports.useXRCameraFacing=M;exports.useXRCameraTexture=b;exports.useXRError=S;exports.useXRFeedCrop=D;exports.useXRLifecycle=R;exports.useXRMirrored=E;exports.useXRModelErrors=p;exports.useXRModelNode=v;exports.useXROrientation=y;exports.useXRPipelineSnapshot=F;exports.useXRQualityConfig=x;exports.useXRQualityState=C;exports.useXRReady=g;exports.useXRRenderSize=k;exports.useXRSessionCameraPermission=f;exports.useXRTrackerStatus=T;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";const p=require("./index-
|
|
1
|
+
"use strict";const p=require("./index-CeVkgsag.cjs"),n=require("react/jsx-runtime"),L=require("react-dom"),c=require("react"),d=require("./x-KC8E4Gaj.cjs"),v=(t,e)=>new URL(`/assets/sdk/debug-ui/v1/${t}/${e}`,p.libConfig.assetStorageEndpoint).href,j=t=>t.replace(/\.[^.]+$/,"").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase()),$=["person_fullbody.mp4","person_looking.mp4","person_shaking_head.mp4","person_thumbUp.mp4","two_people_smiling.mp4"],z=["person_fist_sign.jpg","person_fullbody.jpg","person_peace_sign.jpg","person_portrait.jpg","person_side_portrait.jpg","three_people_smiling.jpg","two_people_smiling.jpg"],W=(t,e)=>({id:`sdk-video-${e+1}`,kind:"video",label:j(t),url:v("videos",t)}),F=(t,e)=>({id:`sdk-image-${e+1}`,kind:"image",label:j(t),url:v("images",t)}),M=$.map(W),_=z.map(F),V=[...M,{id:"webcam",kind:"webcam",label:"Webcam"},..._];/**
|
|
2
2
|
* @license lucide-react v1.17.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const X=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],
|
|
6
|
+
*/const X=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],N=d.createLucideIcon("camera",X);/**
|
|
7
7
|
* @license lucide-react v1.17.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const P=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],T=d.createLucideIcon("chevron-down",P);/**
|
|
12
12
|
* @license lucide-react v1.17.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const U=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],q=d.createLucideIcon("grip-vertical",U);/**
|
|
17
17
|
* @license lucide-react v1.17.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const D=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],K=d.createLucideIcon("image",D);/**
|
|
22
22
|
* @license lucide-react v1.17.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const A=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],O=d.createLucideIcon("menu",A);/**
|
|
27
27
|
* @license lucide-react v1.17.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const B=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],H=d.createLucideIcon("video",B),G=t=>t==="webcam"?"📷 ":t==="image"?"🖼 ":"▶ ",Y={position:"fixed",zIndex:2e4,pointerEvents:"none"},I={pointerEvents:"auto",border:"1px solid rgba(255, 255, 255, 0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 12px 32px rgba(0, 0, 0, 0.28)",backdropFilter:"blur(20px) saturate(1.15)",WebkitBackdropFilter:"blur(20px) saturate(1.15)",color:"#f8fafc",display:"flex"},J={...I,width:34,height:34,borderRadius:17,alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"transform 150ms ease"},Q={...I,flexDirection:"column",borderRadius:12,overflow:"hidden",padding:4,gap:4},Z={display:"flex",alignItems:"center",gap:3},ee={width:1,height:12,background:"rgba(255, 255, 255, 0.12)",margin:"0 3px"},te={display:"flex",width:16,height:24,alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148, 163, 184, 0.8)",flex:"0 0 auto"},k=(t=!1)=>({display:"flex",width:24,height:24,alignItems:"center",justifyContent:"center",borderRadius:8,border:`1px solid ${t?"rgba(255, 255, 255, 0.12)":"transparent"}`,background:t?"rgba(255, 255, 255, 0.08)":"transparent",color:t?"#f8fafc":"rgba(226, 232, 240, 0.72)",cursor:"pointer",flex:"0 0 auto",transition:"background 120ms ease, color 120ms ease"}),re={position:"relative",display:"flex",alignItems:"center"},ne={width:"100%",minWidth:140,height:24,borderRadius:8,border:"1px solid rgba(255, 255, 255, 0.10)",background:"rgba(15, 23, 42, 0.65)",color:"#f8fafc",fontSize:11,outline:"none",paddingLeft:7,paddingRight:20,appearance:"none",cursor:"pointer"},ie={pointerEvents:"none",position:"absolute",right:5,top:0,bottom:0,display:"flex",alignItems:"center",color:"rgba(148, 163, 184, 0.9)"},se={height:24,display:"flex",alignItems:"center",padding:"0 8px",borderRadius:8,border:"1px solid rgba(255, 255, 255, 0.08)",background:"rgba(255, 255, 255, 0.04)",color:"rgba(226, 232, 240, 0.72)",fontSize:11},S={width:14,height:14},oe=({value:t,onChange:e,sources:i,style:l})=>{const[h,u]=c.useState(!1),[a,f]=c.useState({x:16,y:16}),[s,m]=c.useState(t.kind),g=c.useRef(null),x=c.useMemo(()=>({webcam:i.filter(r=>r.kind==="webcam"),image:i.filter(r=>r.kind==="image"),video:i.filter(r=>r.kind==="video")}),[i]),b=x[s];c.useEffect(()=>{m(t.kind)},[t.kind]);const E=r=>{m(r);const o=x[r][0];o&&e(o)};c.useEffect(()=>{const r=y=>{g.current&&f({x:Math.max(8,y.clientX-g.current.x),y:Math.max(8,y.clientY-g.current.y)})},o=()=>{g.current=null,document.body.classList.remove("select-none")};return window.addEventListener("pointermove",r),window.addEventListener("pointerup",o),()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",o)}},[]);const w=r=>{const o=r.currentTarget.getBoundingClientRect();g.current={x:r.clientX-o.left,y:r.clientY-o.top},document.body.classList.add("select-none"),r.currentTarget.setPointerCapture(r.pointerId)},C=()=>{if(b.length===0){const r=s==="webcam"?"No camera source":s==="image"?"No image preview":"No video preview";return n.jsx("div",{style:se,children:r})}return n.jsxs("div",{style:re,children:[n.jsx("select",{value:t.id,onChange:r=>{const o=i.find(y=>y.id===r.target.value);o&&e(o)},style:ne,children:b.map(r=>n.jsxs("option",{value:r.id,children:[G(s),r.label]},r.id))}),n.jsx("div",{style:ie,children:n.jsx("span",{style:{width:10,height:10},children:n.jsx(T,{size:10,strokeWidth:1.8})})})]})};return typeof document>"u"?null:L.createPortal(n.jsx("div",{style:{...Y,left:a.x,top:a.y,...l},children:h?n.jsxs("div",{style:Q,children:[n.jsxs("div",{style:Z,children:[n.jsx("div",{onPointerDown:w,style:te,title:"Drag to move",children:n.jsx(q,{size:11,strokeWidth:2})}),n.jsx("button",{type:"button",onClick:()=>u(!1),style:k(!1),title:"Close Menu",children:n.jsx("span",{style:S,children:n.jsx(d.X,{size:14,strokeWidth:1.8})})}),n.jsx("div",{style:ee}),["webcam","image","video"].map(r=>n.jsx("button",{type:"button",onClick:()=>E(r),style:k(s===r),title:r.charAt(0).toUpperCase()+r.slice(1),children:n.jsx("span",{style:S,children:r==="webcam"?n.jsx(N,{size:14,strokeWidth:1.8}):r==="image"?n.jsx(K,{size:14,strokeWidth:1.8}):n.jsx(H,{size:14,strokeWidth:1.8})})},r))]}),C()]}):n.jsx("div",{style:J,onClick:()=>u(!0),onPointerDown:w,title:"Open Media Menu",children:n.jsx("span",{style:{width:16,height:16},children:n.jsx(O,{size:14,strokeWidth:1.8})})})}),document.body)},ce=async t=>{const e=new Image;e.crossOrigin="anonymous",e.src=t,await e.decode();const i=document.createElement("canvas");i.width=e.naturalWidth,i.height=e.naturalHeight;const l=i.getContext("2d");if(!l)throw new Error("Unable to create image media canvas");return l.drawImage(e,0,0,i.width,i.height),i.captureStream(30)},ae=async t=>{const e=document.createElement("video");return e.src=t,e.loop=!0,e.muted=!0,e.playsInline=!0,e.crossOrigin="anonymous",await e.play(),e.captureStream()},R=(t,e)=>{const{session:i}=p.useXRContext(),l=JSON.stringify((e==null?void 0:e.pipeline)??null),h=c.useRef(e==null?void 0:e.pipeline);h.current=e==null?void 0:e.pipeline,c.useEffect(()=>{let u=!1,a=null;return(async()=>{try{if(t.kind==="webcam")await i.setMediaSource({source:p.XRMediaSource.WEBCAM});else{if(!t.url)throw new Error(`Missing media URL for ${t.id}`);const s=t.kind==="image"?await ce(t.url):await ae(t.url);if(a=s,u){s.getTracks().forEach(m=>m.stop());return}await i.setMediaSource({source:p.XRMediaSource.STREAM,stream:s,sourceKind:t.kind})}await i.registerXRPipeline(h.current??[{model:p.XRModel.FACE_TRACKER,options:{numFaces:(e==null?void 0:e.numFaces)??1}}]),await i.start()}catch(s){console.error("[MediaSourceSession] Error initializing XR session:",s)}})(),()=>{u=!0,a==null||a.getTracks().forEach(s=>s.stop())}},[t,e==null?void 0:e.numFaces,l,i])},de=R;exports.MediaSourceSwitcher=oe;exports.defaultMediaSources=V;exports.sdkImageMediaSources=_;exports.sdkVideoMediaSources=M;exports.useFaceTrackingMediaSourceSession=de;exports.useMediaSourceSession=R;
|