@vincentt-xr/sdk 2.0.0-alpha.0 → 2.0.0-alpha.10
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 +8193 -111
- package/README.md +86 -52
- package/dist/CanonicalHeadFrame-D_0OzdB9.cjs +1 -0
- package/dist/CanonicalHeadFrame-DdUqF6Fv.js +1506 -0
- package/dist/DebuggerUI-CVuV-VJ5.cjs +1 -0
- package/dist/DebuggerUI-D-rcPa54.js +275 -0
- package/dist/FaceRetouch-C1AxBNex.js +1071 -0
- package/dist/FaceRetouch-D7kryDE6.cjs +134 -0
- package/dist/FaceSurface-CHAMEeG1.cjs +1 -0
- package/dist/FaceSurface-DmP9AEeC.js +27 -0
- package/dist/SkeletonUtils-C2r90MtN.js +21 -0
- package/dist/SkeletonUtils-CddIup1F.cjs +1 -0
- package/dist/TextLabel-XE0rQSDn.cjs +2 -0
- package/dist/TextLabel-c9BCucOI.js +961 -0
- package/dist/assets/cache.d.ts +99 -0
- package/dist/assets/estimate.d.ts +11 -0
- package/dist/assets/gltfLoader.d.ts +16 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/loaders.d.ts +43 -0
- package/dist/assets/react.d.ts +33 -0
- package/dist/assets/sdkModels.d.ts +22 -0
- package/dist/audio/AudioEngine.d.ts +3 -1
- package/dist/audio/AudioPlayer.d.ts +29 -0
- package/dist/audio/AudioPlayerLogic.d.ts +4 -0
- package/dist/audio/index.d.ts +2 -0
- package/dist/body/__fixtures__/syntheticRig.d.ts +21 -0
- package/dist/body/bodyFlipGuard.d.ts +39 -0
- package/dist/body/bodyIdentity.d.ts +72 -0
- package/dist/body/bodyMask.d.ts +79 -0
- package/dist/body/bodyMaskMaterial.d.ts +15 -0
- package/dist/body/bodyPose.d.ts +58 -0
- package/dist/body/bodyRigFit.d.ts +148 -0
- package/dist/body/bodyRigSolver.d.ts +114 -0
- package/dist/body/bodySubject.d.ts +46 -0
- package/dist/body-pose/index.d.ts +521 -0
- package/dist/body-trigger/__fixtures__/syntheticBody.d.ts +83 -0
- package/dist/body-trigger/frame.d.ts +88 -0
- package/dist/body-trigger/index.d.ts +6 -0
- package/dist/body-trigger/moves.d.ts +235 -0
- package/dist/body-trigger/trigger.d.ts +75 -0
- package/dist/bodyMaskMaterial-CBWub5t_.cjs +68 -0
- package/dist/bodyMaskMaterial-Cs2awskk.js +207 -0
- package/dist/cache-2x3CUJuY.js +212 -0
- package/dist/cache-DL1Dbz6k.cjs +1 -0
- package/dist/calibration/calibration.d.ts +75 -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/canonicalFace-BHwyCx1c.js +9 -0
- package/dist/canonicalFace-C83I225R.cjs +1 -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/Axes/index.d.ts +6 -0
- package/dist/components/BodyInstruction/BodyPoseHint.d.ts +63 -0
- package/dist/components/BodyInstruction/index.d.ts +76 -0
- package/dist/components/BodyInstruction/useBodyPose.d.ts +30 -0
- package/dist/components/BodyRig/BodyAttachment.d.ts +28 -0
- package/dist/components/BodyRig/BodyOccluder.d.ts +27 -0
- package/dist/components/BodyRig/bodyDepth.d.ts +57 -0
- package/dist/components/BodyRig/index.d.ts +129 -0
- package/dist/components/BodyRig/useBodyDepthTexture.d.ts +40 -0
- package/dist/components/BodyTracker/index.d.ts +26 -1
- package/dist/components/BodyTrigger/index.d.ts +56 -0
- package/dist/components/Debugger/DebuggerProvider.d.ts +14 -1
- package/dist/components/Debugger/DebuggerUI.d.ts +3 -1
- package/dist/components/FaceAtlas/FaceAtlasLayer.d.ts +114 -0
- package/dist/components/FaceAtlas/MadeUpCamera.d.ts +80 -0
- package/dist/components/FaceAtlas/constants.d.ts +8 -0
- package/dist/components/FaceAtlas/index.d.ts +7 -0
- package/dist/components/FaceAtlas/useFaceAtlasSurface.d.ts +84 -0
- package/dist/components/FaceAtlas/useFaceSkin.d.ts +84 -0
- package/dist/components/FaceCharacter/ExternalFaceMesh.d.ts +109 -0
- package/dist/components/FaceCharacter/FaceExpressionController.d.ts +53 -0
- package/dist/components/FaceCharacter/FaceMorph.d.ts +71 -0
- package/dist/components/FaceCharacter/FacePiercing.d.ts +65 -0
- package/dist/components/FaceCharacter/FaceReprojection.d.ts +85 -0
- package/dist/components/FaceCharacter/FaceRig.d.ts +38 -0
- package/dist/components/FaceCharacter/FaceSurface.d.ts +49 -0
- package/dist/components/FaceCharacter/FaceSurfaceOccluder.d.ts +39 -0
- package/dist/components/FaceCharacter/PinToFaceMesh.d.ts +68 -0
- package/dist/components/FaceCharacter/index.d.ts +18 -0
- package/dist/components/FaceCharacter/useFaceReprojector.d.ts +10 -0
- package/dist/components/FaceInset/FaceInset.d.ts +68 -0
- package/dist/components/FaceInset/frame.d.ts +94 -0
- package/dist/components/FaceInset/index.d.ts +6 -0
- package/dist/components/FaceInset/material.d.ts +40 -0
- package/dist/components/FaceInset/useFaceInsetTexture.d.ts +37 -0
- package/dist/components/FaceInstruction/FaceExpressionHint.d.ts +43 -0
- package/dist/components/FaceInstruction/index.d.ts +56 -0
- package/dist/components/FaceInstruction/useFaceExpression.d.ts +20 -0
- package/dist/components/FaceLiquify/FaceLiquify.d.ts +49 -0
- package/dist/components/FaceLiquify/debug.d.ts +37 -0
- package/dist/components/FaceLiquify/frame.d.ts +55 -0
- package/dist/components/FaceLiquify/index.d.ts +10 -0
- package/dist/components/FaceLiquify/material.d.ts +39 -0
- package/dist/components/FaceLiquify/pass.d.ts +49 -0
- package/dist/components/FaceLiquify/presence.d.ts +25 -0
- package/dist/components/FaceLiquify/presets.d.ts +82 -0
- package/dist/components/FaceLiquify/selfTest.d.ts +66 -0
- package/dist/components/FaceLiquify/target.d.ts +85 -0
- package/dist/components/FaceLiquify/warp.d.ts +72 -0
- package/dist/components/FaceMesh/FaceMeshRenderer.d.ts +25 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +70 -1
- package/dist/components/FaceMesh/canonical/FaceMeshMaterial.d.ts +25 -0
- package/dist/components/FaceMesh/canonical/assets.d.ts +3 -0
- package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +30 -0
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +24 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +2 -0
- package/dist/components/FaceMesh/deform.d.ts +3 -0
- package/dist/components/FaceMesh/index.d.ts +6 -1
- package/dist/components/FaceMesh/material/defaults.d.ts +74 -0
- package/dist/components/FaceMesh/material/index.d.ts +1 -0
- package/dist/components/FaceMesh/material/options.d.ts +5 -1
- package/dist/components/FaceMesh/material/support.d.ts +7 -2
- package/dist/components/FaceMesh/material/textures.d.ts +4 -0
- package/dist/components/FaceMesh/material/types.d.ts +4 -2
- package/dist/components/FaceRetouch/Background.d.ts +11 -5
- package/dist/components/FaceRetouch/FaceRetouch.d.ts +52 -0
- package/dist/components/FaceRetouch/index.d.ts +2 -6
- package/dist/components/FaceRetouch/landmarkMask.d.ts +4 -6
- package/dist/components/FaceRetouch/renderState.d.ts +19 -0
- package/dist/components/FaceRetouch/useFaceRetouchMask.d.ts +4 -7
- package/dist/components/FaceSwap/FaceMirror.d.ts +46 -0
- package/dist/components/FaceSwap/FaceSwap.d.ts +58 -0
- package/dist/components/FaceSwap/FaceTextureLayer.d.ts +72 -0
- package/dist/components/FaceSwap/faceSwapPlan.d.ts +91 -0
- package/dist/components/FaceSwap/index.d.ts +13 -0
- package/dist/components/FaceSwap/settings.d.ts +300 -0
- package/dist/components/FaceSwap/useFaceTexture.d.ts +35 -0
- package/dist/components/FaceSwap/useLiveFace.d.ts +38 -0
- package/dist/components/FaceSwap/useLiveFaceTexture.d.ts +31 -0
- package/dist/components/FaceTracker/index.d.ts +5 -3
- package/dist/components/FaceWarp3D/FaceWarp3D.d.ts +50 -0
- package/dist/components/FaceWarp3D/index.d.ts +2 -0
- package/dist/components/Faceless/Faceless.d.ts +51 -0
- package/dist/components/Faceless/index.d.ts +2 -0
- package/dist/components/GestureListener/index.d.ts +11 -0
- package/dist/components/HairLock/HairLock.d.ts +39 -0
- package/dist/components/HairLock/index.d.ts +2 -0
- package/dist/components/HairLock/lockGeometry.d.ts +15 -0
- package/dist/components/HandCutout/index.d.ts +35 -0
- package/dist/components/HandEffect/index.d.ts +36 -0
- package/dist/components/HandInstruction/HandGestureHint.d.ts +70 -0
- package/dist/components/HandInstruction/index.d.ts +74 -0
- package/dist/components/HandInstruction/useHandGesture.d.ts +22 -0
- package/dist/components/HandJoints2D/index.d.ts +6 -0
- package/dist/components/HandRig/ForearmOccluder.d.ts +29 -0
- package/dist/components/HandRig/HandAttachment.d.ts +34 -0
- package/dist/components/HandRig/HandNails.d.ts +61 -0
- package/dist/components/HandRig/HandOccluder.d.ts +45 -0
- package/dist/components/HandRig/HandTattoo.d.ts +61 -0
- package/dist/components/HandRig/WristAttachment.d.ts +34 -0
- package/dist/components/HandRig/index.d.ts +127 -0
- package/dist/components/HandRig/useArmMask.d.ts +29 -0
- package/dist/components/HandRig/wristSolve.d.ts +96 -0
- package/dist/components/HandTouch/HandTouch.d.ts +62 -0
- package/dist/components/HandTouch/Touchable.d.ts +36 -0
- package/dist/components/HandTouch/index.d.ts +2 -0
- package/dist/components/HandTracker/index.d.ts +12 -2
- package/dist/components/HandTracking2D/HandVisual.d.ts +12 -0
- package/dist/components/HandTracking2D/index.d.ts +5 -0
- package/dist/components/HandTracking2DController/index.d.ts +5 -0
- package/dist/components/HandTracking3D/index.d.ts +6 -0
- package/dist/components/HeadBinding/index.d.ts +14 -0
- package/dist/components/HeadOccluder/CanonicalHeadFrame.d.ts +22 -0
- package/dist/components/HeadOccluder/Earrings.d.ts +55 -0
- package/dist/components/HeadOccluder/HeadAttachment.d.ts +38 -0
- package/dist/components/HeadOccluder/NeckOccluder.d.ts +67 -0
- package/dist/components/HeadOccluder/earringPlacement.d.ts +31 -0
- package/dist/components/HeadOccluder/headAttachmentPoints.d.ts +69 -0
- package/dist/components/HeadOccluder/index.d.ts +57 -3
- package/dist/components/HeadOccluder/useCanonicalHeadFit.d.ts +36 -0
- package/dist/components/HeadOccluder/useLandmarkPoseFit.d.ts +80 -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/Instruction/HintStage.d.ts +29 -0
- package/dist/components/Instruction/InstructionCue.d.ts +126 -0
- package/dist/components/Instruction/gestureHold.d.ts +20 -0
- package/dist/components/Instruction/ghost.d.ts +129 -0
- package/dist/components/Instruction/hintBlend.d.ts +19 -0
- package/dist/components/Instruction/hintLook.d.ts +81 -0
- package/dist/components/Instruction/hintLoop.d.ts +36 -0
- package/dist/components/Instruction/index.d.ts +41 -0
- package/dist/components/Instruction/useGhostModel.d.ts +33 -0
- package/dist/components/Instruction/useInstructionHold.d.ts +72 -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/LightObject/index.d.ts +20 -0
- package/dist/components/LipEffect/LipEffect.d.ts +28 -0
- package/dist/components/LipEffect/LipEffectMaterial.d.ts +98 -0
- package/dist/components/LipEffect/LipEffects.d.ts +12 -0
- package/dist/components/LipEffect/defaults.d.ts +51 -0
- package/dist/components/LipEffect/index.d.ts +12 -0
- package/dist/components/LipEffect/lipShading.d.ts +73 -0
- package/dist/components/LipEffect/settings.d.ts +375 -0
- package/dist/components/LipEffect/shader.d.ts +39 -0
- package/dist/components/LipEffect/types.d.ts +141 -0
- package/dist/components/LipEffect/useLipDesignTextures.d.ts +17 -0
- package/dist/components/LipEffect/uvGuide.d.ts +74 -0
- package/dist/components/LookAt/index.d.ts +23 -0
- package/dist/components/Makeup/Blush.d.ts +18 -0
- package/dist/components/Makeup/Brows.d.ts +20 -0
- package/dist/components/Makeup/Contour.d.ts +17 -0
- package/dist/components/Makeup/Eyeliner.d.ts +20 -0
- package/dist/components/Makeup/Eyeshadow.d.ts +20 -0
- package/dist/components/Makeup/Highlighter.d.ts +18 -0
- package/dist/components/Makeup/MakeupDesign.d.ts +37 -0
- package/dist/components/Makeup/MakeupRegion.d.ts +132 -0
- package/dist/components/Makeup/constants.d.ts +44 -0
- package/dist/components/Makeup/design.d.ts +106 -0
- package/dist/components/Makeup/designSamples.d.ts +42 -0
- package/dist/components/Makeup/eyes.d.ts +114 -0
- package/dist/components/Makeup/fields.d.ts +10 -0
- package/dist/components/Makeup/geometry.d.ts +106 -0
- package/dist/components/Makeup/index.d.ts +26 -0
- package/dist/components/Makeup/looks.d.ts +28 -0
- package/dist/components/Makeup/material.d.ts +239 -0
- package/dist/components/Makeup/settings.d.ts +54 -0
- package/dist/components/Makeup/shades.d.ts +143 -0
- package/dist/components/Makeup/shapes.d.ts +27 -0
- package/dist/components/Makeup/skinTone.d.ts +135 -0
- package/dist/components/Makeup/types.d.ts +110 -0
- package/dist/components/Makeup/useMakeupSkinTone.d.ts +40 -0
- package/dist/components/MeshRenderer/index.d.ts +59 -0
- package/dist/components/Necklace/Necklace.d.ts +44 -0
- package/dist/components/Necklace/index.d.ts +1 -0
- package/dist/components/ParticleEmitter/ParticleEmitter.d.ts +69 -0
- package/dist/components/ParticleEmitter/index.d.ts +1 -0
- package/dist/components/PersonCutout/index.d.ts +46 -0
- package/dist/components/PersonCutout/personCutout.d.ts +16 -0
- package/dist/components/PersonCutout/personMask.d.ts +19 -0
- package/dist/components/PersonCutout/useBodyMaskTexture.d.ts +35 -0
- package/dist/components/PerspectiveCamera/index.d.ts +2 -8
- package/dist/components/PinToMesh/index.d.ts +47 -0
- package/dist/components/RenderGroupLayer/index.d.ts +6 -0
- package/dist/components/SceneObjectRenderer/index.d.ts +23 -0
- package/dist/components/Screen2D/ScreenTransformFrame.d.ts +11 -0
- package/dist/components/Screen2D/ScreenTransformHelpers.d.ts +19 -0
- package/dist/components/Screen2D/ScreenTransformInteraction.d.ts +18 -0
- package/dist/components/Screen2D/index.d.ts +5 -0
- package/dist/components/ScreenGlass/defaults.d.ts +3 -0
- package/dist/components/ScreenGlass/index.d.ts +5 -0
- package/dist/components/ScreenGlass/shaders.d.ts +2 -0
- package/dist/components/ScreenGlass/types.d.ts +10 -0
- package/dist/components/ScreenGradient/defaults.d.ts +5 -0
- package/dist/components/ScreenGradient/index.d.ts +5 -0
- package/dist/components/ScreenGradient/shaders.d.ts +2 -0
- package/dist/components/ScreenGradient/types.d.ts +19 -0
- package/dist/components/ScreenImage/ScreenImage.d.ts +4 -0
- package/dist/components/ScreenImage/components/DynamicTextureSync.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageFrame.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageTransformFrame.d.ts +9 -0
- package/dist/components/ScreenImage/fit.d.ts +52 -0
- package/dist/components/ScreenImage/index.d.ts +10 -0
- package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +9 -0
- package/dist/components/ScreenImage/materials/ScreenImageMaskMaterial.d.ts +11 -0
- package/dist/components/ScreenImage/materials/ScreenImageMatcap.d.ts +3 -0
- package/dist/components/ScreenImage/source.d.ts +25 -0
- package/dist/components/ScreenImage/types.d.ts +64 -0
- package/dist/components/ScreenImage/utils/ScreenImageConstants.d.ts +9 -0
- package/dist/components/ScreenImage/utils/ScreenImageHelpers.d.ts +4 -0
- package/dist/components/ScreenShape/geometry.d.ts +5 -0
- package/dist/components/ScreenShape/index.d.ts +5 -0
- package/dist/components/ScreenShape/types.d.ts +54 -0
- package/dist/components/ScreenSpaceUI/ScreenTransformGuide.d.ts +15 -0
- package/dist/components/ScreenSpaceUI/ScreenTransformOverlayGuide.d.ts +9 -0
- package/dist/components/ScreenSpaceUI/index.d.ts +3 -0
- package/dist/components/ScreenText/components/ScreenTextBody.d.ts +2 -0
- package/dist/components/ScreenText/components/ScreenTextTransformFrame.d.ts +9 -0
- package/dist/components/ScreenText/constants.d.ts +5 -0
- package/dist/components/ScreenText/index.d.ts +6 -0
- package/dist/components/ScreenText/types.d.ts +31 -0
- package/dist/components/ScreenText/utils/ScreenTextHelpers.d.ts +14 -0
- package/dist/components/ScreenText/utils/ScreenTextMappings.d.ts +17 -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/SequentialRenderPasses/index.d.ts +6 -0
- package/dist/components/ShoulderOccluder/index.d.ts +46 -0
- package/dist/components/ShoulderOccluder/useCanonicalTorsoFit.d.ts +27 -0
- package/dist/components/SpringSwing/SpringSwing.d.ts +22 -0
- package/dist/components/SpringSwing/index.d.ts +1 -0
- package/dist/components/TextLabel/TextLabel.d.ts +5 -0
- package/dist/components/TextLabel/alignment.d.ts +4 -0
- package/dist/components/TextLabel/bend.d.ts +9 -0
- package/dist/components/TextLabel/canvas/buildTextLabelTexture.d.ts +4 -0
- package/dist/components/TextLabel/canvas/canvasTypography.d.ts +13 -0
- package/dist/components/TextLabel/canvas/drawBackground.d.ts +21 -0
- package/dist/components/TextLabel/canvas/drawEffects.d.ts +34 -0
- package/dist/components/TextLabel/canvas/drawText.d.ts +19 -0
- package/dist/components/TextLabel/components/TextLabelMesh.d.ts +13 -0
- package/dist/components/TextLabel/constants.d.ts +2 -0
- package/dist/components/TextLabel/hooks/useTextLabelTexture.d.ts +7 -0
- package/dist/components/TextLabel/index.d.ts +2 -62
- package/dist/components/TextLabel/layout/measurement.d.ts +8 -0
- package/dist/components/TextLabel/layout/resolveTextLayout.d.ts +25 -0
- package/dist/components/TextLabel/layout/wrapText.d.ts +6 -0
- package/dist/components/TextLabel/types.d.ts +337 -0
- package/dist/components/TrackingAnchor/index.d.ts +18 -2
- package/dist/components/Transform3D/index.d.ts +30 -0
- package/dist/components/XRMediaSurface/index.d.ts +8 -7
- package/dist/components/XRProvider/index.d.ts +16 -2
- package/dist/components/XRScene/index.d.ts +14 -3
- package/dist/components/XRScene/renderOutputTarget.d.ts +12 -0
- package/dist/components/XRViewport/XRViewport.d.ts +11 -0
- package/dist/components/XRViewport/components/HiddenMedia.d.ts +7 -0
- package/dist/components/XRViewport/components/MediaAssetPicker.d.ts +8 -0
- package/dist/components/XRViewport/components/MediaControlStack.d.ts +13 -0
- package/dist/components/XRViewport/components/XRViewportLayers.d.ts +30 -0
- package/dist/components/XRViewport/constants.d.ts +24 -0
- package/dist/components/XRViewport/contexts.d.ts +6 -0
- package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +13 -0
- package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +16 -0
- package/dist/components/XRViewport/hooks/useViewportMediaTexture.d.ts +10 -0
- package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +41 -0
- package/dist/components/XRViewport/hooks/useViewportRenderState.d.ts +47 -0
- package/dist/components/XRViewport/index.d.ts +3 -101
- package/dist/components/XRViewport/layout.d.ts +16 -0
- package/dist/components/XRViewport/slots.d.ts +16 -0
- package/dist/components/XRViewport/types.d.ts +89 -0
- package/dist/components/XRViewport/useViewportSize.d.ts +3 -0
- package/dist/components/index.d.ts +31 -0
- package/dist/components/occluder/skinnedOccluder.d.ts +39 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/constants/index.d.ts +4 -1
- package/dist/context-DTxSQvp4.js +13 -0
- package/dist/context-hA0Rb2Xa.cjs +1 -0
- package/dist/contexts-DQc7zyqT.cjs +1 -0
- package/dist/contexts-Y_FhdnIv.js +667 -0
- package/dist/coordinates/feed.d.ts +52 -0
- package/dist/coordinates/index.d.ts +7 -0
- package/dist/coordinates/side.d.ts +40 -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/component-editor/index.d.ts +19 -0
- package/dist/debug-ui/default-setting/index.d.ts +37 -0
- package/dist/debug-ui/default-setting.cjs +21 -0
- package/dist/debug-ui/default-setting.js +777 -0
- package/dist/debug-ui/face-mesh-renderer-settings/index.d.ts +8 -0
- package/dist/debug-ui/face-retouch/index.d.ts +11 -0
- package/dist/debug-ui/face-swap-settings/index.d.ts +22 -0
- package/dist/debug-ui/gesture-settings/index.d.ts +14 -0
- package/dist/debug-ui/hand-joints-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d-controller/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-3d/index.d.ts +6 -0
- package/dist/debug-ui/hierarchy-panel/index.d.ts +30 -0
- package/dist/debug-ui/holistic-tracker-settings/index.d.ts +16 -0
- package/dist/debug-ui/index.d.ts +61 -0
- package/dist/debug-ui/iris-effect-settings/index.d.ts +12 -0
- package/dist/debug-ui/layer-panel/index.d.ts +18 -0
- package/dist/debug-ui/lip-effect-settings/index.d.ts +15 -0
- package/dist/debug-ui/media-source/MediaSourceSwitcher.d.ts +10 -0
- package/dist/debug-ui/media-source/index.d.ts +6 -0
- package/dist/debug-ui/media-source/media-preset.d.ts +21 -0
- package/dist/debug-ui/media-source/session.d.ts +40 -0
- package/dist/debug-ui/media-source.cjs +1 -0
- package/dist/debug-ui/media-source.js +11 -0
- package/dist/debug-ui/mesh-renderer-settings/index.d.ts +6 -0
- package/dist/debug-ui/object-inspector-panel/index.d.ts +26 -0
- package/dist/debug-ui/pin-to-mesh-settings/index.d.ts +10 -0
- package/dist/debug-ui/product-hotspots/index.d.ts +25 -0
- package/dist/debug-ui/scene-editor/context.d.ts +38 -0
- package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +11 -0
- package/dist/debug-ui/scene-editor/index.d.ts +11 -0
- package/dist/debug-ui/scene-editor/inspector-panel.d.ts +9 -0
- package/dist/debug-ui/scene-editor/store-utils.d.ts +2 -0
- package/dist/debug-ui/scene-editor/viewport-toolbar.d.ts +4 -0
- package/dist/debug-ui/scene-editor/viewport.d.ts +21 -0
- package/dist/debug-ui/screen-glass-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-gradient-settings/GradientStopsEditor.d.ts +5 -0
- package/dist/debug-ui/screen-gradient-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-gradient-settings/styles.d.ts +3 -0
- package/dist/debug-ui/screen-image-settings/index.d.ts +11 -0
- package/dist/debug-ui/screen-shape-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-text-settings/NumberField.d.ts +9 -0
- package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +3 -0
- package/dist/debug-ui/screen-text-settings/controls/NestedSection.d.ts +7 -0
- package/dist/debug-ui/screen-text-settings/controls/Section.d.ts +8 -0
- package/dist/debug-ui/screen-text-settings/controls/icons.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/index.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/BackgroundSection.d.ts +8 -0
- package/dist/debug-ui/screen-text-settings/sections/ContentSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/EffectsSection.d.ts +25 -0
- package/dist/debug-ui/screen-text-settings/sections/StyleSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/TransformSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundFillControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundSizeControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundStrokeControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/types.d.ts +7 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/BendEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/EffectChrome.d.ts +21 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/GlowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/InnerShadowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/OutlineEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/ShadowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/types.d.ts +14 -0
- package/dist/debug-ui/screen-text-settings/settings.d.ts +90 -0
- package/dist/debug-ui/screen-text-settings/styles.d.ts +26 -0
- package/dist/debug-ui/screen-text-settings/transform.d.ts +6 -0
- package/dist/debug-ui/screen-text-settings/types.d.ts +11 -0
- package/dist/debug-ui/segmentation-overlay-settings/index.d.ts +12 -0
- package/dist/debug-ui/settings-panel/index.d.ts +43 -0
- package/dist/debug-ui/shared/MaterialSection.d.ts +13 -0
- package/dist/debug-ui/shared/ScreenTransformSection.d.ts +32 -0
- package/dist/debug-ui/shared/debugWindow.d.ts +51 -0
- package/dist/debug-ui/transform-3d-settings/index.d.ts +11 -0
- package/dist/debug-ui/xr-diagnostics/index.d.ts +26 -0
- package/dist/debug-ui.cjs +10 -0
- package/dist/debug-ui.js +9051 -0
- package/dist/detector-K8aej4MB.js +59 -0
- package/dist/detector-ijypGtse.cjs +1 -0
- package/dist/drawNormalizedCrop-C4KFaRne.cjs +1 -0
- package/dist/drawNormalizedCrop-DG3gtJxf.js +135 -0
- package/dist/entries/all.d.ts +4 -1
- package/dist/entries/core.d.ts +76 -6
- package/dist/entries/face-effects.d.ts +130 -10
- package/dist/entries/instructions.d.ts +48 -0
- package/dist/entries/internal.d.ts +5 -2
- package/dist/entries/low-level.d.ts +104 -6
- package/dist/entries/particles.d.ts +15 -0
- package/dist/entries/product.d.ts +11 -0
- package/dist/entries/scene-object.d.ts +10 -0
- package/dist/entries/tracking.d.ts +110 -2
- package/dist/face-action/index.d.ts +34 -0
- package/dist/face-atlas/attributes.d.ts +30 -0
- package/dist/face-atlas/eyes.d.ts +272 -0
- package/dist/face-atlas/faceAtlas.generated.d.ts +46 -0
- package/dist/face-atlas/glsl/atlasVertex.d.ts +46 -0
- package/dist/face-atlas/glsl/common.d.ts +55 -0
- package/dist/face-atlas/glsl/design.d.ts +49 -0
- package/dist/face-atlas/glsl/eyes.d.ts +73 -0
- package/dist/face-atlas/glsl/finish.d.ts +24 -0
- package/dist/face-atlas/glsl/format.d.ts +4 -0
- package/dist/face-atlas/glsl/index.d.ts +59 -0
- package/dist/face-atlas/glsl/shading.d.ts +15 -0
- package/dist/face-atlas/glsl/shapes.d.ts +66 -0
- package/dist/face-atlas/glsl/sparkle.d.ts +19 -0
- package/dist/face-atlas/glsl/uniforms.d.ts +106 -0
- package/dist/face-atlas/guide.d.ts +51 -0
- package/dist/face-atlas/index.d.ts +25 -0
- package/dist/face-atlas/lead.d.ts +117 -0
- package/dist/face-atlas/madeUpCamera.d.ts +125 -0
- package/dist/face-atlas/masks.d.ts +53 -0
- package/dist/face-atlas/obj.d.ts +69 -0
- package/dist/face-atlas/polylines.d.ts +63 -0
- package/dist/face-atlas/probe/FaceSkinProbe.d.ts +208 -0
- package/dist/face-atlas/probe/__fixtures__/emulate.d.ts +9 -0
- package/dist/face-atlas/probe/__fixtures__/face.d.ts +24 -0
- package/dist/face-atlas/probe/constants.d.ts +137 -0
- package/dist/face-atlas/probe/glsl.d.ts +43 -0
- package/dist/face-atlas/probe/lightFit.d.ts +108 -0
- package/dist/face-atlas/probe/schedule.d.ts +44 -0
- package/dist/face-atlas/probe/selfTest.d.ts +87 -0
- package/dist/face-atlas/probe/stats.d.ts +143 -0
- package/dist/face-atlas/probe/targets.d.ts +70 -0
- package/dist/face-atlas/probe/unwrap.d.ts +76 -0
- package/dist/face-atlas/quality.d.ts +28 -0
- package/dist/face-atlas/regions.d.ts +31 -0
- package/dist/face-atlas/registry.d.ts +252 -0
- package/dist/face-atlas/renderState.d.ts +86 -0
- package/dist/face-atlas/selfOcclusion.d.ts +62 -0
- package/dist/face-atlas/shading.d.ts +406 -0
- package/dist/face-atlas/shapes.d.ts +86 -0
- package/dist/face-atlas/sides.d.ts +41 -0
- package/dist/face-atlas/skinMask.d.ts +35 -0
- package/dist/face-atlas/surface.d.ts +155 -0
- package/dist/face-atlas/topology.d.ts +44 -0
- package/dist/face-attribute-expression/index.d.ts +10 -0
- package/dist/face-character/__fixtures__/faceImageDetections.d.ts +25 -0
- package/dist/face-character/__fixtures__/faceNode.d.ts +22 -0
- package/dist/face-character/bindFaceModel.d.ts +106 -0
- package/dist/face-character/canonicalFace.d.ts +17 -0
- package/dist/face-character/canonicalFaceGeometry.d.ts +11 -0
- package/dist/face-character/canonicalFacePositions.d.ts +7 -0
- package/dist/face-character/driveFaceModel.d.ts +57 -0
- package/dist/face-character/expressionOutputs.d.ts +45 -0
- package/dist/face-character/faceExpressions.d.ts +104 -0
- package/dist/face-character/faceImageLandmarker.d.ts +93 -0
- package/dist/face-character/faceMeshBinding.d.ts +62 -0
- package/dist/face-character/faceMorph.d.ts +77 -0
- package/dist/face-character/faceMorphs.d.ts +46 -0
- package/dist/face-character/facePhoto.d.ts +138 -0
- package/dist/face-character/facePiercings.d.ts +116 -0
- package/dist/face-character/facePin.d.ts +131 -0
- package/dist/face-character/faceReprojection.d.ts +273 -0
- package/dist/face-character/faceReprojector.d.ts +171 -0
- package/dist/face-character/faceRig.d.ts +176 -0
- package/dist/face-character/faceSwapPresence.d.ts +85 -0
- package/dist/face-character/faceTexture.d.ts +169 -0
- package/dist/face-character/faceTextureBaker.d.ts +86 -0
- package/dist/face-character/faceTextureGuide.d.ts +106 -0
- package/dist/face-character/faceTextureStats.d.ts +298 -0
- package/dist/face-character/faceTransfer.d.ts +396 -0
- package/dist/face-character/faceTransferGeometry.d.ts +109 -0
- package/dist/face-character/faceTransferSelfTest.d.ts +94 -0
- package/dist/face-character/faceWarp3D.d.ts +101 -0
- package/dist/face-character/faceless.d.ts +79 -0
- package/dist/face-character/featureWarp.d.ts +28 -0
- package/dist/face-character/liveFaceRegistry.d.ts +370 -0
- package/dist/face-character/liveValue.d.ts +12 -0
- package/dist/face-character/memo.d.ts +15 -0
- package/dist/face-effects.cjs +2267 -195
- package/dist/face-effects.js +14191 -3346
- package/dist/face-expression/index.d.ts +182 -0
- package/dist/face-info/blendshapes.d.ts +3 -0
- package/dist/face-info/derive.d.ts +8 -0
- package/dist/face-info/drawFaceCrop.d.ts +10 -0
- package/dist/face-info/getFaceInfo.d.ts +8 -0
- package/dist/face-info/index.d.ts +8 -0
- package/dist/face-info/landmarks.d.ts +35 -0
- package/dist/face-info/types.d.ts +69 -0
- package/dist/gestures/definitions.d.ts +98 -0
- package/dist/gestures/detector.d.ts +87 -0
- package/dist/gestures/index.d.ts +8 -0
- package/dist/gestures/measures.d.ts +114 -0
- package/dist/gestures/settings.d.ts +49 -0
- package/dist/getFaceInfo-BafgGT27.js +62 -0
- package/dist/getFaceInfo-BzlwHMjX.cjs +1 -0
- package/dist/hand/armFit.d.ts +46 -0
- package/dist/hand/armMask.d.ts +190 -0
- package/dist/hand/forearm.d.ts +114 -0
- package/dist/hand/handCutout.d.ts +23 -0
- package/dist/hand/handCutoutRegistry.d.ts +7 -0
- package/dist/hand/handEffect.d.ts +38 -0
- package/dist/hand/handGestures.d.ts +524 -0
- package/dist/hand/handJoints2d.d.ts +49 -0
- package/dist/hand/handNail.d.ts +73 -0
- package/dist/hand/handPose.d.ts +98 -0
- package/dist/hand/handRigSolver.d.ts +159 -0
- package/dist/hand/handTattoo.d.ts +81 -0
- package/dist/hand/handTouch.d.ts +240 -0
- package/dist/hand/handTracking2d.d.ts +33 -0
- package/dist/hand/handTracking2dController.d.ts +65 -0
- package/dist/hand/handTracking3d.d.ts +52 -0
- package/dist/hand/nailImageMask.d.ts +40 -0
- package/dist/hand/nailMaskFingers.d.ts +23 -0
- package/dist/hand/nailTipRefine.d.ts +37 -0
- package/dist/hand/wrist.d.ts +44 -0
- package/dist/hand/wristFilter.d.ts +44 -0
- package/dist/hooks/faceResults.d.ts +1 -1
- package/dist/hooks/selectors.d.ts +77 -4
- package/dist/hooks/useBodies.d.ts +39 -0
- package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
- package/dist/hooks/useFaceAction.d.ts +3 -0
- package/dist/hooks/useFaceAttributeExpression.d.ts +16 -0
- package/dist/hooks/useFaceDetection.d.ts +18 -0
- package/dist/hooks/useFaceInfo.d.ts +19 -0
- package/dist/hooks/useFaceInfos.d.ts +15 -0
- package/dist/hooks/useFaceModelAcquisition.d.ts +38 -0
- package/dist/hooks/useFaceResultReader.d.ts +10 -0
- package/dist/hooks/useFrameCapture.d.ts +18 -0
- package/dist/hooks/useGesture.d.ts +39 -0
- package/dist/hooks/useIrisTracking.d.ts +45 -0
- package/dist/hooks/useMediaRecorder.d.ts +14 -2
- package/dist/hooks/useOwnedTexture.d.ts +6 -0
- package/dist/hooks/useTrackerContext.d.ts +14 -2
- package/dist/hooks/useXRDiagnostics.d.ts +81 -0
- package/dist/hooks/useXRModel.d.ts +12 -0
- package/dist/hooks/useXRSession/facade.d.ts +47 -2
- package/dist/hooks/useXRSession/index.d.ts +2 -2
- package/dist/hooks/useXRSession/reason.d.ts +21 -0
- package/dist/hooks/useXRSession/registry.d.ts +23 -0
- package/dist/hooks/useXRSession/store.d.ts +64 -7
- package/dist/index-BZoBxyLn.js +1103 -0
- package/dist/index-By_LCo2V.cjs +1 -0
- package/dist/index-C-Mryx_u.cjs +21 -0
- package/dist/index-CKRN-xJp.js +3740 -0
- package/dist/index-CUldCMRl.js +188 -0
- package/dist/index-Cyk_VIZE.js +1432 -0
- package/dist/index-D-4w34GO.cjs +1 -0
- package/dist/index-DiIoHK_4.js +442 -0
- package/dist/index-Dv3WnY9n.cjs +46 -0
- package/dist/index-ItufYyHH.cjs +1 -0
- package/dist/index-S3gqudT6.cjs +1 -0
- package/dist/index-Sho4F4it.cjs +1 -0
- package/dist/index-iIQ9jBDb.js +240 -0
- package/dist/index-vr2ichWQ.js +190 -0
- package/dist/instructions.cjs +30 -0
- package/dist/instructions.js +1528 -0
- package/dist/internal-Bb9ZXbpr.cjs +1 -0
- package/dist/{internal-KOKJDxCG.js → internal-Gt1wn6Z3.js} +152 -127
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +16 -9
- package/dist/iris/compute.d.ts +27 -0
- package/dist/iris/index.d.ts +4 -0
- package/dist/iris/lead.d.ts +19 -0
- package/dist/iris/types.d.ts +89 -0
- package/dist/landmarkMask-CvN-L5NT.cjs +1 -0
- package/dist/landmarkMask-DHivVjJm.js +225 -0
- package/dist/landmarks-BEjJXcnE.cjs +1 -0
- package/dist/landmarks-DtCAFV_m.js +76 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +1494 -629
- package/dist/main.cjs +1 -1
- package/dist/main.js +1306 -475
- package/dist/material/MaterialFill.d.ts +20 -0
- package/dist/material/MeshMaterial.d.ts +14 -0
- package/dist/material/index.d.ts +2 -0
- package/dist/models/Base/index.d.ts +49 -0
- package/dist/models/Body/index.d.ts +30 -1
- package/dist/models/Face/constants.d.ts +8 -0
- package/dist/models/Face/index.d.ts +5 -12
- package/dist/models/Face/rotation.d.ts +18 -0
- package/dist/models/Hand/GestureTracking.d.ts +1 -1
- package/dist/models/Hand/HandTracking.d.ts +19 -1
- package/dist/models/Holistic/index.d.ts +49 -0
- package/dist/models/Holistic/result.d.ts +68 -0
- package/dist/models/Segmentation/index.d.ts +6 -3
- 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/models/nodeSource.d.ts +9 -0
- package/dist/particles/emission.d.ts +24 -0
- package/dist/particles/eyes.d.ts +24 -0
- package/dist/particles/glsl.d.ts +14 -0
- package/dist/particles/index.d.ts +10 -0
- package/dist/particles/motion.d.ts +42 -0
- package/dist/particles/presets.d.ts +12 -0
- package/dist/particles/ring.d.ts +58 -0
- package/dist/particles/selfTest.d.ts +53 -0
- package/dist/particles/settings.d.ts +127 -0
- package/dist/particles/shapes.d.ts +29 -0
- package/dist/particles/spawner.d.ts +71 -0
- package/dist/particles/system.d.ts +66 -0
- package/dist/particles.cjs +122 -0
- package/dist/particles.js +999 -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-CEZQgz2s.cjs +62 -0
- package/dist/providers-CRuaD8bi.js +424 -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/render/layerStack.d.ts +29 -0
- package/dist/render/renderGroups.d.ts +47 -0
- package/dist/render/renderPasses.d.ts +26 -0
- package/dist/render/sceneBeforeRender.d.ts +12 -0
- package/dist/renderGroups-BADrepA1.cjs +1 -0
- package/dist/renderGroups-CNB99dZ2.js +152 -0
- package/dist/renderPasses-DgxUKn9b.cjs +158 -0
- package/dist/renderPasses-DuapJA6V.js +1290 -0
- package/dist/renderState-CJNmj5jz.js +39 -0
- package/dist/renderState-apSfg4eR.cjs +1 -0
- package/dist/scene-object/index.d.ts +146 -0
- package/dist/scene-object/runtimeRegistry.d.ts +14 -0
- package/dist/scene-object.cjs +1 -0
- package/dist/scene-object.js +40 -0
- package/dist/screen-image/screenImagePresets.d.ts +13 -0
- package/dist/screen-image/screenImageSettings.d.ts +57 -0
- package/dist/screen-text/screenTextPresets.d.ts +6 -0
- package/dist/screen-text/screenTextSettings.d.ts +147 -0
- package/dist/screen2d/coordinates.d.ts +107 -0
- package/dist/screen2d/index.d.ts +7 -0
- package/dist/screen2d/material-runtime.d.ts +32 -0
- package/dist/screen2d/screenTransform.d.ts +60 -0
- package/dist/screen2d/smoothing.d.ts +5 -0
- package/dist/screen2d/texture.d.ts +10 -0
- package/dist/screen2d/transform.d.ts +25 -0
- package/dist/screen2d/types.d.ts +90 -0
- package/dist/segmentation-BOZJdWFC.js +1911 -0
- package/dist/segmentation-J8GoNBvP.cjs +1 -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 +52 -0
- package/dist/selectors-BvJepq6H.js +196 -0
- package/dist/selectors-QB2qsaxy.cjs +1 -0
- package/dist/services/MetricsCollector/index.d.ts +7 -1
- package/dist/services/MetricsCollector/utils.d.ts +1 -1
- package/dist/session-BVX859as.cjs +31 -0
- package/dist/session-Cz8aie4K.js +493 -0
- package/dist/settings-BJ7FMBsO.js +111 -0
- package/dist/settings-C63FMBlF.cjs +1 -0
- package/dist/similarityFit-BFqHND2e.cjs +1 -0
- package/dist/similarityFit-Bbz-R8AY.js +91 -0
- package/dist/spring/index.d.ts +2 -0
- package/dist/spring/spring.d.ts +69 -0
- package/dist/spring/swing.d.ts +54 -0
- package/dist/subjects/index.d.ts +2 -0
- package/dist/subjects/select.d.ts +70 -0
- package/dist/subjects/types.d.ts +59 -0
- package/dist/texture/animatedTexture.d.ts +63 -0
- package/dist/texture/animationMath.d.ts +8 -0
- package/dist/texture/gifReader.d.ts +17 -0
- package/dist/texture/gifTextureSource.d.ts +16 -0
- package/dist/texture/sourceResolver.d.ts +30 -0
- package/dist/textures-BVwo9Z7z.js +38 -0
- package/dist/textures-DAfc61zz.cjs +1 -0
- package/dist/tracking/coordinates.d.ts +5 -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 +10 -1
- package/dist/tracking.js +1531 -294
- package/dist/trigger-D9L4GPmQ.js +3726 -0
- package/dist/trigger-DZ9vU7jo.cjs +147 -0
- package/dist/types/common.d.ts +11 -1
- package/dist/types/compositor.d.ts +21 -0
- package/dist/types/face.d.ts +21 -14
- package/dist/types/gesture-tracking.d.ts +2 -2
- package/dist/types/hand-tracking.d.ts +19 -2
- package/dist/types/holistic.d.ts +121 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/model.d.ts +22 -2
- package/dist/types/nodes.d.ts +83 -6
- package/dist/types/segmentation.d.ts +26 -0
- package/dist/types/session.d.ts +50 -4
- package/dist/types/tracking.d.ts +8 -2
- package/dist/types/util-types.d.ts +1 -1
- package/dist/useBodies-BYzJpQ4L.js +75 -0
- package/dist/useBodies-Cxpmx6Bb.cjs +1 -0
- package/dist/useFaceInfo-BzEUj2OI.js +75 -0
- package/dist/useFaceInfo-DlLRAVNw.cjs +1 -0
- package/dist/useFaceResultReader-Cc4Qrutf.js +61 -0
- package/dist/useFaceResultReader-D3jOQNKz.cjs +1 -0
- package/dist/useInstructionHold-DOu-RpCM.js +53 -0
- package/dist/useInstructionHold-DwJY1Alr.cjs +1 -0
- package/dist/useIrisTracking-Bz4uLDa7.js +6190 -0
- package/dist/useIrisTracking-DRGWgoNy.cjs +35 -0
- package/dist/useLandmarkPoseFit-Bg-h9BPb.cjs +1 -0
- package/dist/useLandmarkPoseFit-Bmb3h6Mw.js +87 -0
- package/dist/useXRCapabilities-B1KLckqw.js +30 -0
- package/dist/useXRCapabilities-CZlPUBjF.cjs +1 -0
- package/dist/utils/canonicalRigidLandmarks.d.ts +8 -0
- package/dist/utils/drawNormalizedCrop.d.ts +22 -0
- package/dist/utils/fns.d.ts +6 -3
- package/dist/utils/headOccluderFit.d.ts +42 -0
- package/dist/utils/integrity.d.ts +25 -26
- package/dist/utils/landmarkBounds.d.ts +1 -1
- package/dist/utils/logger.d.ts +2 -2
- package/dist/utils/resolveNumFaces.d.ts +13 -0
- package/dist/utils/shoulderOccluderFit.d.ts +38 -0
- package/dist/utils/similarityFit.d.ts +23 -0
- package/dist/utils/updateThrottle.d.ts +2 -0
- package/dist/utils/useStableUniforms.d.ts +18 -0
- package/dist/utils/visionWasm.d.ts +18 -0
- package/dist/uv-BMFt19bg.cjs +1 -0
- package/dist/{index-BD-JWMjE.js → uv-DJU_XfmN.js} +15 -180
- package/dist/x-Co8jPhP0.js +127 -0
- package/dist/x-KC8E4Gaj.cjs +41 -0
- package/docs/MIGRATION_GUIDE.md +589 -0
- package/docs/SDK_DOCUMENTATION.md +1157 -0
- package/docs/api/adaptive-quality.mdx +104 -0
- package/docs/api/asset-lifecycle.mdx +78 -0
- package/docs/api/audio.mdx +36 -0
- package/docs/api/behavior-components.mdx +164 -0
- package/docs/api/body-instructions.mdx +287 -0
- package/docs/api/body-rig.mdx +384 -0
- package/docs/api/body-triggers.mdx +235 -0
- package/docs/api/camera-permission.mdx +142 -0
- package/docs/api/capture-recording.mdx +111 -0
- package/docs/api/coordinate-spaces.mdx +168 -0
- package/docs/api/cross-camera.mdx +89 -0
- package/docs/api/debug-ui-scene-editor.mdx +270 -0
- package/docs/api/diagnostics-calibration.mdx +97 -0
- package/docs/api/external-face-mesh.mdx +231 -0
- package/docs/api/face-actions.mdx +108 -0
- package/docs/api/face-attribute-expression.mdx +87 -0
- package/docs/api/face-binding-anchors.mdx +55 -0
- package/docs/api/face-character.mdx +157 -0
- package/docs/api/face-effects.mdx +28 -0
- package/docs/api/face-expression-controller.mdx +153 -0
- package/docs/api/face-info.mdx +118 -0
- package/docs/api/face-inset.mdx +204 -0
- package/docs/api/face-instructions.mdx +183 -0
- package/docs/api/face-liquify.mdx +196 -0
- package/docs/api/face-mesh.mdx +130 -0
- package/docs/api/face-morph.mdx +117 -0
- package/docs/api/face-painting.mdx +40 -0
- package/docs/api/face-reprojection.mdx +154 -0
- package/docs/api/face-retouching.mdx +81 -0
- package/docs/api/face-swap.mdx +350 -0
- package/docs/api/face-warp-3d.mdx +166 -0
- package/docs/api/faceless.mdx +143 -0
- package/docs/api/gestures.mdx +210 -0
- package/docs/api/hair.mdx +97 -0
- package/docs/api/hand-instructions.mdx +222 -0
- package/docs/api/hand-rig.mdx +661 -0
- package/docs/api/hand-touch.mdx +162 -0
- package/docs/api/head-occluder.mdx +563 -0
- package/docs/api/holistic-tracker.mdx +164 -0
- package/docs/api/instructions.mdx +323 -0
- package/docs/api/iris-tracking.mdx +247 -0
- package/docs/api/made-up-camera.mdx +131 -0
- package/docs/api/makeup-skin-tone.mdx +135 -0
- package/docs/api/makeup.mdx +353 -0
- package/docs/api/material-render-state.mdx +132 -0
- package/docs/api/multi-subject.mdx +185 -0
- package/docs/api/particles.mdx +183 -0
- package/docs/api/person-cutout.mdx +171 -0
- package/docs/api/pin-to-face-mesh.mdx +274 -0
- package/docs/api/product-ar.mdx +114 -0
- package/docs/api/product-details.mdx +78 -0
- package/docs/api/runtime-3d.mdx +316 -0
- package/docs/api/scene-object-store.mdx +213 -0
- package/docs/api/screen-image.mdx +67 -0
- package/docs/api/screen-shape.mdx +64 -0
- package/docs/api/screen-space-coordinates.mdx +75 -0
- package/docs/api/screen-text.mdx +39 -0
- package/docs/api/segmentation-overlay.mdx +301 -0
- package/docs/api/session-lifecycle.mdx +136 -0
- package/docs/api/texture-sources.mdx +74 -0
- package/docs/api/trackers.mdx +65 -0
- package/docs/api/tracking-config.mdx +108 -0
- package/docs/docs.json +121 -0
- package/docs/examples/lip-shaders.mdx +273 -0
- package/docs/examples/scene-object-recipes.mdx +194 -0
- package/docs/guides/face-atlas-template.svg +1 -0
- package/docs/guides/face-atlas-textures.mdx +186 -0
- package/docs/guides/face-texture-template.svg +1 -0
- package/docs/guides/harness-debug-ui.mdx +139 -0
- package/docs/guides/lip-effect-textures.mdx +368 -0
- package/docs/guides/lip-uv-template.png +0 -0
- package/docs/guides/lip-uv-template.svg +1 -0
- package/docs/guides/makeup-design-textures.mdx +109 -0
- package/docs/inspector/hierarchy-panel.mdx +51 -0
- package/docs/inspector/object-inspector-panel.mdx +51 -0
- package/docs/introduction.mdx +120 -0
- package/docs/scene-objects/overview.mdx +127 -0
- package/docs/scene-objects/render-groups.mdx +77 -0
- package/docs/scene-objects/runtime-rendering.mdx +75 -0
- package/docs/texture-api-consumer.md +84 -0
- package/package.json +86 -8
- package/settings.json +1998 -0
- package/dist/DebuggerUI-CEfdddkZ.cjs +0 -1
- package/dist/DebuggerUI-Dgop6Q6o.js +0 -269
- package/dist/components/FaceRetouch/retouchRegions.d.ts +0 -23
- package/dist/components/FaceRetouch/useFaceRetouchRegions.d.ts +0 -12
- package/dist/index-B5J4gzn2.cjs +0 -1
- package/dist/index-BVBVg96G.cjs +0 -1
- package/dist/index-CYMj26Ej.js +0 -1331
- package/dist/index-DtwHElmG.js +0 -157
- package/dist/index-PtFmD6B8.cjs +0 -1
- package/dist/internal-DH5d1Xnq.cjs +0 -1
- package/dist/modules/XRClient/index.d.ts +0 -9
- package/dist/modules/index.d.ts +0 -1
- package/dist/selectors-BHO6TnoC.js +0 -59
- package/dist/selectors-Bub0o3qy.cjs +0 -1
- package/dist/services/ApiService.d.ts +0 -12
- package/dist/types/client.d.ts +0 -3
- package/dist/useFaceResults-cpsSmKKc.js +0 -81
- package/dist/useFaceResults-hVUJYSEY.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=require("react/jsx-runtime"),_=require("@react-three/fiber"),n=require("react"),X=require("three"),g=require("./index-Sho4F4it.cjs"),j=require("./uv-BMFt19bg.cjs"),N=require("./landmarks-BEjJXcnE.cjs");function W(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,c.get?c:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const M=W(X),U=({materialProps:e,settings:t})=>t.type==="basic"?E.jsx("meshBasicMaterial",{...e}):E.jsx("meshStandardMaterial",{...e,roughness:t.roughness,metalness:t.metalness}),P=1e-6,Z=e=>{const{x:t,y:r,z:c}=e.scale;return Math.abs(t-r)<=P&&Math.abs(t-c)<=P?t:1},B=(e,t,r,c)=>{if(!r.enabled)return e;const a=Z(r);return c.x=t.x+(e.x-t.x)*a+r.position.x,c.y=t.y+(e.y-t.y)*a-r.position.y,c.z=t.z+(e.z-t.z)*a+r.position.z,c},K=(e,t,r)=>g.unprojectToZZeroInto(e,t,r),I=(e,t,r)=>{const c=(e.x-.5)*2,a=(.5-e.y)*2,m=M.MathUtils.clamp(e.z*2,-1,1);return r.set(c,a,m).unproject(t)},Y=(e,t,r,c,a,m)=>{const T=Math.min(t,e.length);for(let h=0;h<T;h++){a(e[h],c,m);const o=h*3;r[o]=m.x,r[o+1]=m.y,r[o+2]=m.z}return T},H=468,G=H*3,Q={type:"standard",color:"#ffffff",opacity:1,wireframe:!1,roughness:1,metalness:0},w=({material:e,faceIndex:t=0,numFaces:r,visible:c=!0,children:a})=>{const{ready:m,node:T}=N.useXRModel(g.XRModel.FACE_TRACKER,r===void 0?void 0:{numFaces:r}),{camera:h}=_.useThree(),o=n.useRef(null),F=n.useRef(null),v=n.useRef(null),p=n.useRef(null),C=n.useRef(null),y=n.useRef(new M.Vector3),l=n.useMemo(()=>{const f=new Uint16Array(j.FACE_MESH_INDICES),d=new M.BufferAttribute(f,1),u=new M.Float32BufferAttribute(j.FACE_MESH_UV,2),A=new M.Float32BufferAttribute(new Float32Array(G),3);A.setUsage(M.DynamicDrawUsage);const s=A.array;return{indexAttr:d,uvAttr:u,positionAttr:A,positions:s}},[]);n.useEffect(()=>{p.current=l.indexAttr,C.current=l.uvAttr,v.current=l.positionAttr,F.current=l.positions;const f=o.current;if(f){const d=f.geometry;d.setAttribute("position",l.positionAttr),d.setAttribute("uv",l.uvAttr),d.setIndex(l.indexAttr)}return()=>{p.current=null,C.current=null,v.current=null,F.current=null}},[l]),_.useFrame(()=>{var R;if(!m||!T||!o.current)return;const{detectionResults:f}=T,d=(R=f==null?void 0:f.faceLandmarks)==null?void 0:R[t],u=o.current.geometry,A=F.current,s=v.current;if(!d||d.length===0||!A||!s){u.drawRange.count!==0&&u.setDrawRange(0,0);return}u.getAttribute("position")!==s&&(u.setAttribute("position",s),u.setAttribute("uv",C.current),u.setIndex(p.current)),u.drawRange.count===0&&u.setDrawRange(0,1/0),Y(d,H,A,h,K,y.current),s.needsUpdate=!0,u.computeVertexNormals()});const k=a!=null&&a!==!1;return E.jsxs("mesh",{material:e,ref:o,visible:c,children:[E.jsx("bufferGeometry",{}),!e&&!k&&E.jsx(U,{settings:Q,materialProps:{attach:"material",transparent:!0,depthWrite:!1,side:M.DoubleSide,needsUpdate:!0}}),!e&&k?a:null]})};w.displayName="FaceMesh";const D=n.createContext(null),$=()=>n.useContext(D),L=new M.Euler,J=({faceIndex:e=0,numFaces:t,scaleWithFace:r=!1,followFaceRoll:c=!0,targetFps:a,active:m=!0,children:T})=>{const h=n.useRef(null),o=n.useRef(null),F=n.useMemo(()=>{if(!(t===void 0&&a===void 0))return{...t===void 0?{}:{numFaces:t},...a===void 0?{}:{targetFps:a}}},[t,a]),{ready:v,node:p}=N.useXRModel(g.XRModel.FACE_TRACKER,F,m),{camera:C}=_.useThree(),y=n.useRef(C);y.current=C;const l=n.useRef(null),k=n.useRef({x:0,y:0,z:0,visibility:0});_.useFrame(()=>{if(!v||!p||!o.current)return;l.current=p;const s=h.current;y.current&&((s==null?void 0:s.node)!==p||s.faceIndex!==e||s.camera!==y.current)&&(p.setCamera(y.current,e),h.current={node:p,faceIndex:e,camera:y.current});const R=p.getFace(e);if(!R){o.current.visible=!1;return}o.current.visible=!0;const{position:i,quaternion:x,scale:b}=R.transform;o.current.position.set(i.x,i.y,i.z),o.current.quaternion.copy(x),c||(L.setFromQuaternion(x,"XYZ"),L.z=0,o.current.quaternion.setFromEuler(L)),r?o.current.scale.set(b.x,b.y,b.z):o.current.scale.set(1,1,1)});const f=n.useCallback((s,R)=>{var z,O,q;const i=l.current,x=(O=(z=i==null?void 0:i.detectionResults)==null?void 0:z.faceLandmarks)==null?void 0:O[e];if(!x||x.length===0)return null;const b=N.resolveFaceAnchorPoint(s,x,R,k.current,((q=i==null?void 0:i.getFace(e))==null?void 0:q.mirrored)!==!1);return b?{position:g.feedToWorld(b,y.current)}:null},[e]),d=n.useMemo(()=>({type:"face",resolveLandmark:f,faceIndex:e}),[f,e]);let u;const A=[];return n.Children.forEach(T,s=>{var R,i;n.isValidElement(s)&&(((R=s.type)==null?void 0:R.displayName)==="FaceTracker.Mesh"||((i=s.type)==null?void 0:i.displayName)==="FaceMesh")?u=n.cloneElement(s,{faceIndex:e,numFaces:t}):A.push(s)}),E.jsxs(D.Provider,{value:d,children:[E.jsx("group",{ref:o,renderOrder:j.RENDER_LAYERS.TRACKED,children:A}),u]})},V=e=>E.jsx(w,{...e});V.displayName="FaceTracker.Mesh";const S=J;S.Mesh=V;const ee=S;exports.FaceMesh=w;exports.FaceTracker=S;exports.HeadTracker=ee;exports.MeshMaterial=U;exports.TrackerContext=D;exports.projectLandmarkWithDepth=I;exports.transformFaceMeshLandmark=B;exports.useTrackerContext=$;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var pn=Object.defineProperty;var yn=(e,s,t)=>s in e?pn(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var u=(e,s,t)=>yn(e,typeof s!="symbol"?s+"":s,t);const ze=require("react/jsx-runtime"),P=require("react"),V=require("@mediapipe/tasks-vision"),X=require("three");function wn(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return s.default=e,Object.freeze(s)}const q=wn(X),W={assetStorageEndpoint:"https://cdn.vincentt.studio",sdkAssetsBaseUrl:"https://cdn.vincentt.studio/assets/sdk/face/v1",debugMediaBaseUrl:"https://cdn.vincentt.studio/assets/sdk/debug-ui/v1",loggerPrefix:"[vincentt-xr]:",sessionCheckInterval:3e4};var F=(e=>(e.WEBCAM="webcam",e.STREAM="stream",e.CANVAS="canvas",e))(F||{}),I=(e=>(e.HAND_TRACKER="vincentt.xr.hand-tracker",e.GESTURE_TRACKER="vincentt.xr.gesture-tracker",e.FACE_TRACKER="vincentt.xr.face-tracker",e.BODY_TRACKER="vincentt.xr.body-tracker",e.HOLISTIC_TRACKER="vincentt.xr.holistic-tracker",e.BACKGROUND_SEGMENTATION="vincentt.xr.background-segmentation",e.SEMANTIC_SEGMENTATION="vincentt.xr.semantic-segmentation",e))(I||{});const We=e=>Array.from({length:e},()=>({x:0,y:0,z:0}));class zt{constructor(s){u(this,"slots",[]);this.options=s}setOptions(s){this.options=s}update(s,t){const{holdMs:n,predictMs:i,maxVelocityGapMs:r=250}=this.options,o=[],a=Math.max(s.length,this.slots.length);for(let d=0;d<a;d+=1){const l=s[d],h=this.slots[d]??null;if(l&&l.length>0){const M=h&&h.points.length===l.length?h:null,S=M??{points:We(l.length),velocity:We(l.length),lastSeen:t,output:We(l.length)},T=(t-S.lastSeen)/1e3,b=M!==null&&T>0&&T*1e3<=r;for(let R=0;R<l.length;R+=1){const y=l[R],g=S.points[R],p=S.velocity[R],v=y.z??0;b?(p.x=.5*p.x+.5*((y.x-g.x)/T),p.y=.5*p.y+.5*((y.y-g.y)/T),p.z=.5*p.z+.5*((v-g.z)/T)):(p.x=0,p.y=0,p.z=0),g.x=y.x,g.y=y.y,g.z=v}S.lastSeen=t,this.slots[d]=S,o.push(l);continue}if(!h)continue;const m=t-h.lastSeen;if(m>n){this.slots[d]=null;continue}const w=Math.max(0,Math.min(m,i))/1e3;for(let M=0;M<h.points.length;M+=1)h.output[M].x=h.points[M].x+h.velocity[M].x*w,h.output[M].y=h.points[M].y+h.velocity[M].y*w,h.output[M].z=h.points[M].z+h.velocity[M].z*w;o.push(h.output)}for(;this.slots.length>0&&this.slots[this.slots.length-1]===null;)this.slots.pop();return o}reset(){this.slots=[]}}const ne=(e,s={x:0,y:0,z:0})=>(s.x=e.x*2-1,s.y=1-e.y*2,s.z=-e.z,s),Wt=(e,s={x:0,y:0,z:0})=>(s.x=(e.x+1)/2,s.y=(1-e.y)/2,s.z=-e.z,s),et="https://storage.googleapis.com/mediapipe-models/holistic_landmarker/holistic_landmarker/float16/latest/holistic_landmarker.task",qt=250,Vt=0,Xt=768,Re=e=>({hands:(e==null?void 0:e.hands)??"both",analysisMaxDimension:(e==null?void 0:e.analysisMaxDimension)??Xt,holdMs:(e==null?void 0:e.holdMs)??qt,predictMs:(e==null?void 0:e.predictMs)??Vt}),vn=()=>({version:0,timestampMs:0,face:null,leftHand:null,rightHand:null,pose:null}),It=[0,4,5,6,1,2,3,8,7,10,9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25,28,27,30,29,32,31],_t=(e,s)=>{if(e.length!==It.length)return e;s.length=e.length;for(let t=0;t<e.length;t+=1)s[t]=e[It[t]];return s};class Ce{constructor(s,t){u(this,"memory");u(this,"holdMs");u(this,"lastLiveMs",-1/0);u(this,"lastConfidence",0);this.holdMs=s,this.memory=new zt({holdMs:s,predictMs:t})}setOptions(s,t){this.holdMs=s,this.memory.setOptions({holdMs:s,predictMs:t})}reset(){this.memory.reset(),this.lastLiveMs=-1/0,this.lastConfidence=0}bridge(s,t,n){const i=s!==void 0&&s.length>0,r=this.memory.update(i?[s]:[],n)[0];if(!r)return;if(i)return this.lastLiveMs=n,this.lastConfidence=t,{points:r,held:!1,confidence:t};const o=n-this.lastLiveMs,a=this.holdMs>0?Math.max(0,1-o/this.holdMs):0;return{points:r,held:!0,confidence:this.lastConfidence*a}}}const he=(e,s,t)=>{for(e.length>s&&(e.length=s);e.length<s;)e.push(t());return e},qe=(e,s)=>{e.x=s.x,e.y=s.y,e.z=s.z},Sn=e=>{if(e.length===0)return 0;let s=0;for(let t=0;t<e.length;t+=1)s+=e[t].visibility??0;return s/e.length};class xn{constructor(s){u(this,"options",Re());u(this,"faceMemory",new Ce(this.options.holdMs,this.options.predictMs));u(this,"leftHandMemory",new Ce(this.options.holdMs,this.options.predictMs));u(this,"rightHandMemory",new Ce(this.options.holdMs,this.options.predictMs));u(this,"poseMemory",new Ce(this.options.holdMs,this.options.predictMs));u(this,"face",{landmarks:[],blendshapes:{},confidence:0,held:!1});u(this,"leftHand",{handedness:"left",landmarks:[],worldLandmarks:[],confidence:0,held:!1});u(this,"rightHand",{handedness:"right",landmarks:[],worldLandmarks:[],confidence:0,held:!1});u(this,"poseScratch",[]);u(this,"poseWorldScratch",[]);u(this,"pose",{landmarks:[],worldLandmarks:[],visibility:[],confidence:0,held:!1});this.setOptions(s)}getOptions(){return this.options}setOptions(s){this.options=Re({...this.options,...s});const{holdMs:t,predictMs:n}=this.options;for(const i of this.memories())i.setOptions(t,n)}reset(){for(const s of this.memories())s.reset()}memories(){return[this.faceMemory,this.leftHandMemory,this.rightHandMemory,this.poseMemory]}update(s,t,n,i=!1){var l,h,m,w;n.face=this.updateFace(s,t);const r={landmarks:(l=s==null?void 0:s.leftHandLandmarks)==null?void 0:l[0],world:(h=s==null?void 0:s.leftHandWorldLandmarks)==null?void 0:h[0]},o={landmarks:(m=s==null?void 0:s.rightHandLandmarks)==null?void 0:m[0],world:(w=s==null?void 0:s.rightHandWorldLandmarks)==null?void 0:w[0]},a=i?o:r,d=i?r:o;return n.leftHand=this.updateHand("left",a.landmarks,a.world,t),n.rightHand=this.updateHand("right",d.landmarks,d.world,t),n.pose=this.updatePose(s,t,i),n.timestampMs=t,n.version+=1,n}updateFace(s,t){var a,d,l,h;const n=(a=s==null?void 0:s.faceLandmarks)==null?void 0:a[0],i=this.faceMemory.bridge(n,1,t);if(!i)return null;const{face:r}=this,o=!i.held&&n;he(r.landmarks,i.points.length,()=>({x:0,y:0,z:0,visibility:0}));for(let m=0;m<i.points.length;m+=1){const w=r.landmarks[m];qe(w,i.points[m]),w.visibility=o?((d=n[m])==null?void 0:d.visibility)??0:0}if(o){const m=(h=(l=s==null?void 0:s.faceBlendshapes)==null?void 0:l[0])==null?void 0:h.categories;if(m)for(const w of m)r.blendshapes[w.categoryName]=w.score}return r.confidence=i.confidence,r.held=i.held,r}updateHand(s,t,n,i){const r=s==="left"?this.leftHandMemory:this.rightHandMemory,{hands:o}=this.options;if(o==="none"||o!=="both"&&o!==s)return r.reset(),null;const a=r.bridge(t,1,i);if(!a)return null;const d=s==="left"?this.leftHand:this.rightHand;he(d.landmarks,a.points.length,()=>({x:0,y:0,z:0}));for(let l=0;l<a.points.length;l+=1)ne(a.points[l],d.landmarks[l]);if(!a.held&&n){he(d.worldLandmarks,n.length,()=>({x:0,y:0,z:0}));for(let l=0;l<n.length;l+=1)qe(d.worldLandmarks[l],n[l])}return d.confidence=a.confidence,d.held=a.held,d}updatePose(s,t,n){var m,w,M;const i=(m=s==null?void 0:s.poseLandmarks)==null?void 0:m[0],r=i&&n?_t(i,this.poseScratch):i,o=this.poseMemory.bridge(r,r?Sn(r):0,t);if(!o)return null;const{pose:a}=this,d=!o.held&&r;he(a.landmarks,o.points.length,()=>({x:0,y:0,z:0})),he(a.visibility,o.points.length,()=>0);for(let S=0;S<o.points.length;S+=1)ne(o.points[S],a.landmarks[S]),d&&(a.visibility[S]=((w=r[S])==null?void 0:w.visibility)??0);const l=(M=s==null?void 0:s.poseWorldLandmarks)==null?void 0:M[0],h=l&&n?_t(l,this.poseWorldScratch):l;if(d&&h){he(a.worldLandmarks,h.length,()=>({x:0,y:0,z:0}));for(let S=0;S<h.length;S+=1)qe(a.worldLandmarks[S],h[S])}return a.confidence=o.confidence,a.held=o.held,a}}const tt={"camera-permission-denied":"Camera access was blocked. Allow camera permissions in your browser, then refresh.","camera-in-use":"Camera is already in use by another app or browser tab. Close it and refresh.","no-camera":"No camera was found on this device.","camera-insecure-context":"Camera access needs HTTPS (or localhost). Open the page over HTTPS.","camera-unsupported":"This browser cannot open the camera.","camera-lost":"The camera stopped sending frames (disconnected, revoked, or taken by another app).","webgl-unavailable":"WebGL is unavailable, so nothing can render or track.","offscreen-canvas-unavailable":"OffscreenCanvas is unavailable; the tracker feed cannot be built.","wasm-unavailable":"WebAssembly is unavailable; the tracking engine cannot load.","model-unreachable":"The tracker model could not be downloaded.","model-integrity":"The tracker model failed its integrity check.","model-init-failed":"The tracker failed to initialize on this device.","placement-unsupported":"This device cannot place 3D objects in the room (no WebXR, Scene Viewer or Quick Look).",unknown:"Tracking is unavailable for an unknown reason."},Mn={"camera-permission-denied":!0,"camera-in-use":!0,"no-camera":!1,"camera-insecure-context":!1,"camera-unsupported":!1,"camera-lost":!0,"webgl-unavailable":!1,"offscreen-canvas-unavailable":!1,"wasm-unavailable":!1,"model-unreachable":!0,"model-integrity":!1,"model-init-failed":!1,"placement-unsupported":!1,unknown:!0},D=(e,s=tt[e])=>({code:e,message:s,recoverable:Mn[e]}),Kt={[I.FACE_TRACKER]:"/assets/xr/models/face_tracking.task",[I.HAND_TRACKER]:"/assets/xr/models/hand_tracking.task",[I.GESTURE_TRACKER]:"/assets/xr/models/gesture_tracking.task",[I.BODY_TRACKER]:"/assets/xr/models/body_tracking.task",[I.BACKGROUND_SEGMENTATION]:"/assets/xr/models/segmentation.tflite",[I.SEMANTIC_SEGMENTATION]:"/assets/xr/models/selfie_multiclass_256x256.tflite",[I.HOLISTIC_TRACKER]:et},st=e=>{const s=Kt[e];return s?/^https?:/.test(s)?s:new URL(s,W.assetStorageEndpoint).toString():null},Tn=Object.values(I),Cn=()=>{var t,n,i;const e=typeof window<"u",s=typeof document<"u";return{navigator:typeof navigator<"u"?navigator:void 0,isSecureContext:e?window.isSecureContext:void 0,createCanvas:s?()=>document.createElement("canvas"):void 0,offscreenCanvas:typeof OffscreenCanvas<"u",wasm:typeof WebAssembly<"u",fetch:typeof fetch<"u"?fetch.bind(globalThis):void 0,now:()=>typeof performance<"u"?performance.now():Date.now(),xrSessionSupported:typeof navigator<"u"&&((t=navigator.xr)!=null&&t.isSessionSupported)?r=>navigator.xr.isSessionSupported(r).catch(()=>!1):void 0,relSupportsAr:s?((i=(n=document.createElement("a").relList)==null?void 0:n.supports)==null?void 0:i.call(n,"ar"))===!0:void 0,userAgent:typeof navigator<"u"?navigator.userAgent:void 0}},kn=e=>!!e&&/Android/.test(e)&&/(Chrome|SamsungBrowser)\//.test(e)&&!/Firefox|OPR\//.test(e),bn=async e=>{let s=!1;if(e.xrSessionSupported)try{s=await e.xrSessionSupported("immersive-ar")}catch{s=!1}const t=kn(e.userAgent),n=e.relSupportsAr===!0,i=s||t||n;return{webxr:s,sceneViewer:t,quickLook:n,any:i,reason:i?null:D("placement-unsupported")}},Gt=e=>{switch(e){case"granted":return"supported";case"denied":return"permission-denied";case"prompt":return"permission-prompt";default:return"unknown"}},En=async(e,s)=>{var a,d,l;const t=e.isSecureContext??!0,n=(a=e.navigator)==null?void 0:a.mediaDevices;if(!t)return{status:"unsupported",reason:D("camera-insecure-context"),deviceCount:null,secureContext:t};if(!n||typeof n.getUserMedia!="function")return{status:"unsupported",reason:D("camera-unsupported"),deviceCount:null,secureContext:t};let i="unknown";if(s&&((l=(d=e.navigator)==null?void 0:d.permissions)!=null&&l.query))try{const h=await e.navigator.permissions.query({name:"camera"});i=Gt(h.state)}catch{i="unknown"}let r=null,o=!1;if(typeof n.enumerateDevices=="function")try{const h=await n.enumerateDevices();r=h.filter(m=>m.kind==="videoinput").length,o=h.some(m=>!!m.label)}catch{r=null}return i==="permission-denied"?{status:i,reason:D("camera-permission-denied"),deviceCount:r,secureContext:t}:r===0&&(i==="supported"||o)?{status:"unsupported",reason:D("no-camera"),deviceCount:r,secureContext:t}:{status:i,reason:null,deviceCount:r,secureContext:t}},Rn=e=>{var t;const s=(t=e.createCanvas)==null?void 0:t.call(e);if(!s)return 0;try{if(s.getContext("webgl2"))return 2;if(s.getContext("webgl")||s.getContext("experimental-webgl"))return 1}catch{return 0}return 0},An=e=>{var o;const s=Rn(e),t=e.offscreenCanvas??!1,n=e.wasm??!1,i=!!((o=e.navigator)!=null&&o.gpu);let r=null;return s===0?r=D("webgl-unavailable"):t?n||(r=D("wasm-unavailable")):r=D("offscreen-canvas-unavailable"),{status:r?"unsupported":"supported",reason:r,webglVersion:s,webgpu:i,offscreenCanvas:t,wasm:n}},In=async(e,s,t)=>{var o,a;const n=st(e);if(!n||!s.fetch)return{model:e,status:"unknown",reason:null,url:n,bytes:null};const i=typeof AbortController<"u"?new AbortController:void 0,r=setTimeout(()=>i==null?void 0:i.abort(),t);try{const d=await s.fetch(n,{method:"HEAD",signal:i==null?void 0:i.signal});if(!d.ok)return{model:e,status:"unsupported",reason:D("model-unreachable",`${tt["model-unreachable"]} (${d.status})`),url:n,bytes:null};const l=Number(((a=(o=d.headers)==null?void 0:o.get)==null?void 0:a.call(o,"content-length"))??NaN);return{model:e,status:"supported",reason:null,url:n,bytes:Number.isFinite(l)&&l>0?l:null}}catch{return{model:e,status:"unsupported",reason:D("model-unreachable"),url:n,bytes:null}}finally{clearTimeout(r)}},_n=async(e={},s=Cn())=>{const t=e.timeoutMs??4e3,n=new Set(e.models??[]),[i,r,o]=await Promise.all([En(s,e.queryPermission??!0),Promise.all(Tn.map(async l=>n.has(l)?In(l,s,t):{model:l,status:"unknown",reason:null,url:st(l),bytes:null})),bn(s)]),a=An(s),d=Object.fromEntries(r.map(l=>[l.model,l]));return{camera:i,rendering:a,placement:o,models:d,canRunTracking:a.status==="supported"&&i.status!=="unsupported",checkedAt:s.now?s.now():Date.now()}},nt=e=>{switch(e){case"permission-denied":return D("camera-permission-denied");case"camera-in-use":return D("camera-in-use");case"no-camera":return D("no-camera");case"camera-lost":return D("camera-lost");case"unsupported":return D("camera-unsupported");default:return D("unknown")}},Fn=(e,s)=>{const{camera:t,rendering:n}=e,i=e.models[s],r=t.status==="permission-prompt"||t.status==="unknown";return n.reason?{supported:!1,reason:n.reason,needsPermission:r}:t.reason?{supported:!1,reason:t.reason,needsPermission:r}:i!=null&&i.reason?{supported:!1,reason:i.reason,needsPermission:r}:{supported:!0,reason:null,needsPermission:r}},Pn=e=>{const s=e instanceof Error?e.message:String(e??""),t=s.toLowerCase();return t.includes("integrity")||t.includes("sha-384")||t.includes("sha384")?D("model-integrity",s):t.includes("failed to fetch")||t.includes("networkerror")||t.includes("load failed")||/\b(404|403|5\d\d)\b/.test(t)||t.includes("fetch")?D("model-unreachable",s):t.includes("webgl")||t.includes("gpu")?D("webgl-unavailable",s):s?D("model-init-failed",s):D("unknown")},it=e=>{switch(e instanceof DOMException?e.name:""){case"NotAllowedError":case"PermissionDeniedError":return"permission-denied";case"NotReadableError":case"TrackStartError":return"camera-in-use";case"NotFoundError":case"DevicesNotFoundError":return"no-camera";case"NotSupportedError":case"SecurityError":case"OverconstrainedError":return"unsupported";default:return e instanceof TypeError?"unsupported":"unknown"}},Ft={"permission-denied":"Camera access was blocked. Allow camera permissions in your browser, then refresh.","camera-in-use":"Camera is already in use by another app or browser tab. Close it and refresh.","no-camera":"No camera was found on this device.","camera-lost":"The camera stopped sending frames. Reconnect it or re-allow access, then start again.",unsupported:"Unable to access camera. Allow camera permissions in your browser, then refresh.",unknown:"Unable to access camera. Allow camera permissions in your browser, then refresh."},_e=()=>({mediaDevices:typeof navigator<"u"?navigator.mediaDevices:void 0,permissions:typeof navigator<"u"?navigator.permissions:void 0,isSecureContext:typeof window<"u"?window.isSecureContext:void 0}),rt=async(e=_e())=>{var s;if(!((s=e.permissions)!=null&&s.query))return{state:"unknown",prompt:!1};try{const t=await e.permissions.query({name:"camera"});return t.state==="granted"?{state:"granted",prompt:!1}:t.state==="denied"?{state:"blocked",prompt:!1}:{state:"unknown",prompt:t.state==="prompt"}}catch{return{state:"unknown",prompt:!1}}},at=(e,s)=>e==="permission-denied"?{state:s==="blocked"?"blocked":"denied",reason:D("camera-permission-denied")}:{state:"unavailable",reason:nt(e)},Dn=async(e={},s=_e())=>{var n;if(s.isSecureContext===!1)return{state:"unavailable",reason:D("camera-insecure-context"),stream:null};const t=(n=s.mediaDevices)==null?void 0:n.getUserMedia;if(typeof t!="function")return{state:"unavailable",reason:D("camera-unsupported"),stream:null};try{const i=await t.call(s.mediaDevices,e.constraints??{video:{facingMode:"user"}});return e.keepStream?{state:"granted",reason:null,stream:i}:(i.getTracks().forEach(r=>r.stop()),{state:"granted",reason:null,stream:null})}catch(i){const r=it(i),o=await rt(s);return{...at(r,o.state),stream:null}}},Ln=async(e,s=_e())=>{var t,n;if(!((t=s.permissions)!=null&&t.query))return()=>{};try{const i=await s.permissions.query({name:"camera"}),r=()=>{i.state==="granted"?e({state:"granted",prompt:!1}):i.state==="denied"?e({state:"blocked",prompt:!1}):e({state:"unknown",prompt:i.state==="prompt"})};return(n=i.addEventListener)==null||n.call(i,"change",r),()=>{var o;return(o=i.removeEventListener)==null?void 0:o.call(i,"change",r)}}catch{return()=>{}}},On=e=>e==="unknown"||e==="denied"||e==="granted",Nn={unknown:"This experience uses your camera. Nothing is recorded or uploaded.",requesting:"Waiting for you to allow the camera…",granted:"Camera access granted.",denied:"Camera access was not allowed. You can try again.",blocked:"Camera access is blocked for this site. Allow it in your browser's site settings, then reload.",unavailable:"The camera is unavailable on this device right now."},Yt=(e,s,t="cover",n=1)=>{if(e.width<=0||e.height<=0||s.width<=0||s.height<=0)return null;const i=Number.isFinite(n)&&n>0?n:1,r=s.width/e.width,o=s.height/e.height,a=t==="contain"?o<=r:o>=r,d=(a?o:r)*i,l=a?e.width*o*i:s.width*i,h=a?s.height*i:e.height*r*i;return{scale:d,drawWidth:l,drawHeight:h,offsetX:(s.width-l)/2,offsetY:(s.height-h)/2}},ge=e=>e==="webcam"||e===void 0,jt=({source:e,feed:s,zoom:t=1,mirrored:n=!1})=>{const i=Yt(e,s,"cover",t);return i?{...i,source:e,feed:s,zoom:Number.isFinite(t)&&t>0?t:1,mirrored:n}:null},Un=(e,s,t={x:0,y:0})=>{const n=s.mirrored?s.source.width-e.x:e.x;return t.x=(s.offsetX+n*s.scale)/s.feed.width,t.y=(s.offsetY+e.y*s.scale)/s.feed.height,t},Qt=(e,s,t={x:0,y:0})=>{const n=(e.x*s.feed.width-s.offsetX)/s.scale;return t.x=s.mirrored?s.source.width-n:n,t.y=(e.y*s.feed.height-s.offsetY)/s.scale,t},Bn=(e,s)=>{const t=Qt(e,s);return t.x>=0&&t.x<=s.source.width&&t.y>=0&&t.y<=s.source.height},Hn=(e,s={x:0,y:0})=>(s.x=1-e.x,s.y=e.y,e.z!==void 0&&(s.z=e.z),s),zn=(e,s,t,n={x:0,y:0})=>{switch(t){case 90:return n.x=s.height-e.y,n.y=e.x,n;case 180:return n.x=s.width-e.x,n.y=s.height-e.y,n;case 270:return n.x=e.y,n.y=s.width-e.x,n;default:return n.x=e.x,n.y=e.y,n}},Wn=(e,s)=>s===90||s===270?{width:e.height,height:e.width}:{width:e.width,height:e.height};class U extends Error{constructor(s){super(s),this.name="VincenttXRError"}}class qn{constructor(s){u(this,"options");const t={verbose:!1,prefix:W.loggerPrefix};this.options={...t,...s}}log(...s){const{verbose:t,prefix:n}=this.options;t&&console.info(n,...s)}error(...s){const{verbose:t,prefix:n}=this.options;t&&console.error(n,...s)}}const ot=["nose","leftEyeInner","leftEye","leftEyeOuter","rightEyeInner","rightEye","rightEyeOuter","leftEar","rightEar","mouthLeft","mouthRight","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftPinky","rightPinky","leftIndex","rightIndex","leftThumb","rightThumb","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle","leftHeel","rightHeel","leftFootIndex","rightFootIndex"],me=Object.fromEntries(ot.map((e,s)=>[e,s])),Vn=e=>e==="mouthLeft"?"mouthRight":e==="mouthRight"?"mouthLeft":e.startsWith("left")?`right${e.slice(4)}`:e.startsWith("right")?`left${e.slice(5)}`:e,Jt=Object.freeze(ot.map(e=>me[Vn(e)])),Zt=(e,s={x:0,y:0,z:0})=>(s.x=e.x*100,s.y=-e.y*100,s.z=-e.z*100,s),$t=(e,s,t)=>{if(!s)return{...e,timestampMs:t};const n=i=>i.map((r,o)=>i[Jt[o]??o]??i[o]);return{world:n(e.world),image:n(e.image),visibility:n(e.visibility),timestampMs:t}},es=Object.freeze({holdMs:250,maxJump:1,duplicate:.1,confirm:3,confirmMs:100}),Xn=1,Kn=1.2,Gn=200,Ve=[me.leftShoulder,me.rightShoulder,me.leftHip,me.rightHip],Yn=(e,s)=>{const t=Ve.map(w=>e.image[w]);if(t.some(w=>!w))return null;const n=w=>({x:w.x*s,y:w.y}),[i,r,o,a]=t.map(n),d={x:(i.x+r.x)/2,y:(i.y+r.y)/2},l={x:(o.x+a.x)/2,y:(o.y+a.y)/2},h=Math.max(Math.hypot(d.x-l.x,d.y-l.y),Math.hypot(i.x-r.x,i.y-r.y));if(!(h>1e-6))return null;const m=Ve.reduce((w,M)=>w+(e.visibility[M]??0),0)/Ve.length;return{pose:e,center:{x:(d.x+l.x)/2,y:(d.y+l.y)/2},size:h,visibility:m}};class ts{constructor(s={}){u(this,"settings");u(this,"tracks",[]);u(this,"nextId",1);this.settings={...es,...s}}update(s,t,n=1){const{holdMs:i,maxJump:r,duplicate:o,confirm:a,confirmMs:d}=this.settings,l=this.dedupe(s.map(g=>Yn(g,n)).filter(g=>!!g),o),h=l.map(g=>this.tracks.map(p=>{const v=Math.min(Math.max(t-p.lastSeenMs,0),Gn),A=p.center.x+p.velocity.x*v,E=p.center.y+p.velocity.y*v,B=Math.max(p.size,g.size),Y=Math.hypot(g.center.x-A,g.center.y-E)/B;return Y>r?1/0:Y+Xn*Math.abs(Math.log(g.size/p.size))}));let m=l.map(()=>-1),w=1/0;const M=[],S=new Set,T=(g,p)=>{if(!(p>=w)){if(g===l.length){m=[...M],w=p;return}for(let v=0;v<this.tracks.length;v+=1){const A=h[g][v];S.has(v)||A===1/0||(S.add(v),M[g]=v,T(g+1,p+A),S.delete(v))}M[g]=-1,T(g+1,p+Kn)}};T(0,0);const b=new Set,y=!this.tracks.some(g=>g.id!==null)?l.reduce((g,p,v)=>m[v]<0&&(!g||p.visibility>g.visibility)?p:g,null):null;l.forEach((g,p)=>{const v=m[p]>=0?this.tracks[m[p]]:null;if(!v){const E={id:null,hits:1,firstSeenMs:t,pose:g.pose,center:g.center,size:g.size,velocity:{x:0,y:0},lastSeenMs:t};(g===y||a<=1&&d<=0)&&this.confirm(E),this.tracks.push(E),b.add(E);return}v.hits+=1,v.id===null&&v.hits>=a&&t-v.firstSeenMs>=d&&this.confirm(v);const A=t-v.lastSeenMs;A>0&&(v.velocity={x:(v.velocity.x+(g.center.x-v.center.x)/A)/2,y:(v.velocity.y+(g.center.y-v.center.y)/A)/2}),v.pose=g.pose,v.center=g.center,v.size=g.size,v.lastSeenMs=t,b.add(v)}),this.tracks=this.tracks.filter(g=>b.has(g)||g.id!==null&&t-g.lastSeenMs<=i);for(const g of this.tracks)b.has(g)||(g.hits=0);return this.tracks.filter(g=>g.id!==null).map(g=>({id:g.id,pose:g.pose,held:!b.has(g)})).sort((g,p)=>g.id-p.id)}confirm(s){s.id=this.nextId,this.nextId+=1}reset(){this.tracks=[]}dedupe(s,t){const n=[],i=[...s].sort((r,o)=>o.visibility-r.visibility);for(const r of i)n.some(a=>Math.hypot(a.center.x-r.center.x,a.center.y-r.center.y)/Math.max(a.size,r.size)<t&&Math.abs(Math.log(a.size/r.size))<.1)||n.push(r);return s.filter(r=>n.includes(r))}}const Je=(e,s)=>{let t=1;for(const n of e)Number.isFinite(n)&&(t=Math.max(t,Math.round(n)));return Math.min(t,s)},K={width:720,height:1280},Z=32,ss=.5,ve={enabled:!0,position:{x:0,y:0},size:{width:680,height:1230},pivot:[.5,.5],rotation:0,scale2D:{x:1,y:1},referencePixelsPerUnit:Z,renderOrder:999,overlay:!0,visible:!0,showTransformGuides:!1},jn=Math.PI/180,Pt=(e,s)=>s<=0?e:Math.round(e/s)*s,Qn=({transform:e,parentSize:s,root:t=K,snapIncrement:n=ss})=>{const r=Math.min(s.width/t.width,s.height/t.height)*(Z/e.referencePixelsPerUnit),o=e.size.width*e.scale2D.x*r,a=e.size.height*e.scale2D.y*r,d=Pt(e.position.x,n)*r,l=Pt(e.position.y,n)*r,h=(e.pivot[0]-.5)*o,m=(e.pivot[1]-.5)*a;return{center:[d-h,l-m,0],size:[o,a,1],rotation:[0,0,e.rotation*jn],pivotOffset:[h/Math.max(o,1e-6),m/Math.max(a,1e-6),0],aspect:o>0&&a>0?Math.abs(o/a):1}},Jn=e=>({...ve,...e,position:{...ve.position,...e==null?void 0:e.position},size:{...ve.size,...e==null?void 0:e.size},scale2D:{...ve.scale2D,...e==null?void 0:e.scale2D}}),z=(e,s)=>{if(!Number.isFinite(e)||e<=0)throw new RangeError(`${s} must be positive`);return e},Zn=(e,s)=>{const t=z(s.width,"root.width"),n=z(s.height,"root.height");return!Number.isFinite(e.width)||!Number.isFinite(e.height)||e.width<=0||e.height<=0?0:Math.min(e.width/t,e.height/n)},ct=(e,s,t,n)=>s.width<=0||s.height<=0?Object.assign(n,{x:0,y:0}):(z(t.width,"root.width"),z(t.height,"root.height"),n.x=(e.x/s.width-.5)*t.width,n.y=(.5-e.y/s.height)*t.height,n),lt=(e,s,t,n)=>s.width<=0||s.height<=0?Object.assign(n,{x:0,y:0}):(z(t.width,"root.width"),z(t.height,"root.height"),n.x=(e.x/t.width+.5)*s.width,n.y=(.5-e.y/t.height)*s.height,n),ns=({parentSize:e,referencePixelsPerUnit:s=Z,root:t=K})=>Zn(e,t)*(Z/z(s,"referencePixelsPerUnit")),$n=(e,s)=>e*ns(s),ei=(e,s)=>{const t=ns(s);return t===0?0:e/t},ti=({point:e,parentSize:s,referencePixelsPerUnit:t=Z,root:n=K,target:i={x:0,y:0}})=>{if(s.width<=0||s.height<=0)return Object.assign(i,{x:0,y:0});const r=Z/z(t,"referencePixelsPerUnit");return i.x=e.x*(s.width/z(n.width,"root.width"))*r,i.y=e.y*(s.height/z(n.height,"root.height"))*r,i},si=({point:e,parentSize:s,referencePixelsPerUnit:t=Z,root:n=K,target:i={x:0,y:0}})=>{if(s.width<=0||s.height<=0)return Object.assign(i,{x:0,y:0});const r=Z/z(t,"referencePixelsPerUnit");return i.x=e.x/(s.width/z(n.width,"root.width")*r),i.y=e.y/(s.height/z(n.height,"root.height")*r),i},ni=({point:e,rect:s,root:t=K,target:n={x:0,y:0}})=>ct({x:e.x-s.left,y:e.y-s.top},s,t,n),ii=({point:e,rect:s,root:t=K,target:n={x:0,y:0}})=>(lt(e,s,t,n),n.x+=s.left,n.y+=s.top,n),dt=({point:e,root:s=K,target:t={x:0,y:0},viewportSize:n})=>ct({x:e.x*n.width,y:e.y*n.height},n,s,t),is=({point:e,root:s=K,target:t={x:0,y:0},viewportSize:n})=>n.width<=0||n.height<=0?Object.assign(t,{x:0,y:0}):(lt(e,n,s,t),t.x/=n.width,t.y/=n.height,t),ri=({point:e,root:s=K,target:t={x:0,y:0},viewportSize:n})=>dt({point:{x:(e.x+1)/2,y:(1-e.y)/2},viewportSize:n,root:s,target:t}),ai=({layout:e,mirrored:s=!1,point:t,root:n=K,target:i={x:0,y:0}})=>{if(e.scale<=0)return Object.assign(i,{x:0,y:0});const r=e.offsetX+t.x*e.scale;return ct({x:s?e.destination.width-r:r,y:e.offsetY+t.y*e.scale},e.destination,n,i)},oi=({layout:e,mirrored:s=!1,point:t,root:n=K,target:i={x:0,y:0}})=>{if(e.scale<=0)return Object.assign(i,{x:0,y:0});lt(t,e.destination,n,i);const r=s?e.destination.width-i.x:i.x;return i.x=(r-e.offsetX)/e.scale,i.y=(i.y-e.offsetY)/e.scale,i},ke=new X.Vector3,Dt=new X.Vector2,Lt=new X.Raycaster,ci=({camera:e,point:s,root:t=K,target:n={x:0,y:0,depth:0},viewportSize:i})=>(z(t.width,"root.width"),z(t.height,"root.height"),ke.set(s.x,s.y,s.z).project(e),n.x=ke.x*t.width/2,n.y=ke.y*t.height/2,n.depth=ke.z,n),li=({camera:e,point:s,root:t=K,target:n=new X.Ray,viewportSize:i})=>(z(t.width,"root.width"),z(t.height,"root.height"),Dt.set(s.x*2/t.width,s.y*2/t.height),Lt.setFromCamera(Dt,e),n.copy(Lt.ray)),di=(e,s)=>ne({x:e.x,y:e.y,z:e.z??0},s),rs=(e,s={x:0,y:0})=>{const t=Wt(e);return s.x=t.x,s.y=t.y,s.z=t.z,s},hi=(e,s,t={x:0,y:0})=>(t.x=e.x*s.width,t.y=e.y*s.height,t),ui=(e,s,t={x:0,y:0})=>s.width<=0||s.height<=0?Object.assign(t,{x:0,y:0}):(t.x=e.x/s.width,t.y=e.y/s.height,t),mi=(e,s,t={})=>dt({point:e,viewportSize:s,root:t.root,target:t.target}),fi=(e,s,t={})=>{const n=t.target??{x:0,y:0};return is({point:e,viewportSize:s,root:t.root,target:n}),n},as={selection:"index",index:0},Ze=Object.freeze({face:{max:10,default:1,option:"numFaces"},hand:{max:2,default:2,option:null},gesture:{max:1,default:1,option:null},body:{max:2,default:1,option:"numBodies"},holistic:{max:1,default:1,option:null}}),os={center:null},fe=(e,s)=>Math.hypot(e.x-s.x,e.y-s.y),be=e=>({center:{...e.center},...e.label===void 0?{}:{label:e.label},...e.id===void 0?{}:{id:e.id}}),Ot=(e,s,t)=>{if(!e.length)return null;switch(s){case"largest":return e.reduce((n,i)=>i.size>n.size?i:n);case"nearest-center":return e.reduce((n,i)=>fe(i.center,{x:.5,y:.5})<fe(n.center,{x:.5,y:.5})?i:n);case"leftmost":return e.reduce((n,i)=>i.center.x<n.center.x?i:n);case"rightmost":return e.reduce((n,i)=>i.center.x>n.center.x?i:n);default:return e.find(n=>n.index===t)??null}},gi=(e,s=as,t=os)=>{const n=s.index??0;if(s.selection!=="sticky"){const a=Ot(e,s.selection,n);return{index:(a==null?void 0:a.index)??null,reason:a?s.selection:"none",memory:a?be(a):t}}const i=t.id===void 0?void 0:e.find(a=>a.id===t.id);if(i)return{index:i.index,reason:"sticky",memory:be(i)};const r=s.stickyRadius??.2;if(t.center){const a=t.center,d=e.filter(m=>fe(m.center,a)<=r).sort((m,w)=>fe(m.center,a)-fe(w.center,a)),h=(t.label?d.find(m=>m.label===t.label):void 0)??d[0];if(h)return{index:h.index,reason:"sticky",memory:be(h)}}const o=Ot(e,s.fallback??"largest",n);return{index:(o==null?void 0:o.index)??null,reason:o?"sticky-fallback":"none",memory:o?be(o):t}},pi=e=>e.map((s,t)=>{let n=1/0,i=-1/0,r=1/0,o=-1/0;for(const d of s)d.x<n&&(n=d.x),d.x>i&&(i=d.x),d.y<r&&(r=d.y),d.y>o&&(o=d.y);const a=s.length>0&&Number.isFinite(n);return{index:t,center:a?{x:(n+i)/2,y:(r+o)/2}:{x:.5,y:.5},size:a?i-n:0}}),cs=e=>e.map((s,t)=>{const n=(s.coordinates??[]).map(l=>rs(l));let i=1/0,r=-1/0,o=1/0,a=-1/0;for(const l of n)l.x<i&&(i=l.x),l.x>r&&(r=l.x),l.y<o&&(o=l.y),l.y>a&&(a=l.y);const d=n.length>0;return{index:t,center:d?{x:(i+r)/2,y:(o+a)/2}:{x:.5,y:.5},size:d?Math.max(r-i,a-o):0,...s.label?{label:s.label}:{}}}),yi=e=>cs(e.map(s=>({coordinates:s.pose.image}))).map((s,t)=>({...s,id:e[t].id})),wi=(e,s,t=.35)=>{const n=[];for(const o of e)for(const a of s){const d=fe(o.center,a.center);d<=t&&n.push({primaryIndex:o.index,secondaryIndex:a.index,distance:d})}n.sort((o,a)=>o.distance-a.distance);const i=new Set,r=new Set;return n.filter(o=>i.has(o.primaryIndex)||r.has(o.secondaryIndex)?!1:(i.add(o.primaryIndex),r.add(o.secondaryIndex),!0))},Nt=new q.Vector3,Xe=new q.Vector3,ls=(e,s,t,n,i)=>{Nt.set(e,s,0).unproject(t),Xe.copy(Nt).sub(t.position).normalize();const r=(n-t.position.z)/Xe.z;return i.copy(t.position).addScaledVector(Xe,r)},ds=(e,s,t=new q.Vector3,n=0)=>ls((e.x-.5)*2,(.5-e.y)*2,s,n,t),vi=(e,s,t=new q.Vector3,n=0)=>ls(e.x,e.y,s,n,t),ee=new q.Vector3,Si=(e,s,t={x:0,y:0,z:0})=>(ee.set(e.x,e.y,e.z).project(s),t.x=ee.x/2+.5,t.y=.5-ee.y/2,t.z=ee.z,t),xi=(e,s,t={x:0,y:0,z:0})=>(ee.set(e.x,e.y,e.z).project(s),t.x=ee.x,t.y=ee.y,t.z=ee.z,t),Ee=(e,s,t)=>ds(e,s,t,0),Mi=(e,s,t=.2)=>t*s+(1-t)*e;class Se{constructor(s){u(this,"canvas");u(this,"scale",1);this.maxDimension=s}setScale(s){this.scale=Math.min(1,Math.max(.25,Number.isFinite(s)&&s>0?s:1))}draw(s){const t=s.width,n=s.height,i=Math.min(1,this.maxDimension*this.scale/Math.max(t,n));if(i>=1)return s;const r=Math.max(1,Math.round(t*i)),o=Math.max(1,Math.round(n*i));(!this.canvas||this.canvas.width!==r||this.canvas.height!==o)&&(this.canvas=new OffscreenCanvas(r,o));const a=this.canvas.getContext("2d");return a?(a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r,o),a.drawImage(s,0,0,r,o),this.canvas):s}dispose(){this.canvas=void 0}}const Ti={"/assets/xr/models/face_tracking.task":"sha384-tYQh+yJE8llY+zO4RviZmWaSKs5W9tsB0ix5rjQVpF5/CLTqmwtP7bYtkUi2w65P","/assets/xr/models/hand_tracking.task":"sha384-uWvruVKd887ov8k43S+DBHCsi7UXXS+CKvvdM1PX00rjPzx/B0QrAPfJ1U9yKcze","/assets/xr/models/gesture_tracking.task":"sha384-2zuseP9JKKWAYlWQGKA2N+ooabB8V/yIxu23Mv8mtY7SowcySB+xKiOmqBhVvlUC","/assets/xr/models/body_tracking.task":"sha384-3Wk9dvRYo36b3Nc9xVjKamb4wCKt9FwiPjcHKfrvyJL/jXoGs+uRLnii6yjWLKul","/assets/xr/models/segmentation.tflite":"sha384-A2bQ8+iZyQM3KIGVBUf0FyetqxuynyKpjsjCE8uzoJEnj1ghCu6ge2daiRffAiS5","/assets/xr/3d-models/head-occluder-v2.glb":"sha384-+0G60Q6EBVE6hpITxGzQgofAeKexPltpsfPq5T5et9GGBjRhFP5HOdsKAhe73OaI","/assets/xr/3d-models/head-occluder-v3.glb":"sha384-bmKKYb7k1qsGqkOSUBwv3oqI9eOche97/OvRxXDxrqZAgqpy+4PJ5HU9O94lrjFO","/assets/xr/3d-models/shoulder-occluder-v1.glb":"sha384-iXxOvC+IoXfgpf8S/JSsV6lLzzLs6vtmaslJy7R0iLtl5Yb17U+/ATfGdhpmamae","/assets/xr/3d-models/hand-v1.glb":"sha384-noiRM38+PSoOZVgKaRLPf1001gHN38vMDPkSX2mL/Wgtj9o7TP/L05rHs6ubsGIK","/assets/xr/3d-models/glove-v1.glb":"sha384-dZkRdB4URmKS2RBaDb4A7E95pLt4KKLlkxKsqA6L5N8elSbfiyyBoi7S9GcSVbDJ","/assets/xr/3d-models/ybot-v1.glb":"sha384-pJY/JqDrnL8qPVtTC52G1GVsbBwBkEN5Z2TX3mm921l/iLsFTJDHbEMWcLd+icZ9","/assets/xr/models/hair_segmenter.tflite":"sha384-1Eu/EdJcYV/7talPYVVbxPZBLg7UIxqsKisUNh/pEsyvAuUcE49HuqijSXWSHXHK","/mediapipe-models/image_segmenter/hair_segmenter/float32/latest/hair_segmenter.tflite":"sha384-1Eu/EdJcYV/7talPYVVbxPZBLg7UIxqsKisUNh/pEsyvAuUcE49HuqijSXWSHXHK","/assets/xr/models/selfie_multiclass_256x256.tflite":"sha384-LPLPyzBZ6TTE8146rnDx8CZ5LykB8memkmeO8FNVbGlNthvlUltn3W3KeJmtq9bL","/mediapipe-models/image_segmenter/selfie_multiclass_256x256/float32/latest/selfie_multiclass_256x256.tflite":"sha384-LPLPyzBZ6TTE8146rnDx8CZ5LykB8memkmeO8FNVbGlNthvlUltn3W3KeJmtq9bL","/assets/xr/models/nail_segmenter_v1.tflite":"sha384-sxkDgbQcK1Q/bxxzAHGvmSG00wm11UlrlH9dS242lo9QGBqBCEr4zj6sZE3mND43","/assets/xr/models/holistic_landmarker.task":"sha384-6Y2fQ5yP5QtlvJIasfv0fHEyoMqRYYpLtEpsyeXjYDOuFCEXfKIZPZSXq8TLXmsg","/mediapipe-models/holistic_landmarker/holistic_landmarker/float16/latest/holistic_landmarker.task":"sha384-6Y2fQ5yP5QtlvJIasfv0fHEyoMqRYYpLtEpsyeXjYDOuFCEXfKIZPZSXq8TLXmsg","/assets/sdk/face/v1/canonical_face_model.obj":"sha384-xP8YM/72TXKvbMptXB9a8JUlUf3MZQ8uLurExrsZc05v6/P5RrsaNGMUYS/BZx8A","/opencv/facial_expression_recognition/resolve/main/facial_expression_recognition_mobilefacenet_2022july_int8.onnx":"sha384-g8mtFubiIc/yhqi591RsxD76AJLw2CfYgKhKbVkIiFlwBmIyG7ZAIVyGPXafrDGB"};async function hs(e,s){const t=await fetch(e,s!=null&&s.signal?{signal:s.signal}:void 0);if(!t.ok)throw new Error(`fetchAndVerify: ${t.status} ${e}`);const n=await t.arrayBuffer(),i=Ci(e);if(!i){if(us(e))throw new Error(`[xr-sdk integrity] no SRI hash for SDK asset ${e}`);return console.warn(`[xr-sdk integrity] no SRI hash for ${e} — passing through`),n}const r=await ki(n);if(r!==i)throw new Error(`[xr-sdk integrity] SRI mismatch for ${e}: expected ${i}, got ${r}`);return n}function us(e){try{return new URL(e).origin===new URL(W.assetStorageEndpoint).origin}catch{return!1}}async function ie(e){const s=await hs(e);return new Uint8Array(s)}const ue=new Map;function ms(e){let s=ue.get(e);if(!s){const i={bytes:ie(e),holders:0};i.bytes.catch(()=>{ue.get(e)===i&&ue.delete(e)}),ue.set(e,i),s=i}const t=s;t.holders+=1;let n=!1;return{bytes:t.bytes,release:()=>{n||(n=!0,t.holders-=1,t.holders<=0&&ue.get(e)===t&&ue.delete(e))}}}function Ci(e){try{const s=new URL(e);return Ti[s.pathname]}catch{return}}async function ki(e){const s=await crypto.subtle.digest("SHA-384",e),t=new Uint8Array(s);let n="";for(let i=0;i<t.byteLength;i++)n+=String.fromCharCode(t[i]);return`sha384-${btoa(n)}`}const Ke=new Map;function se(e){const s=e.wasmBinaryPath;let t=Ke.get(s);return t||(t=bi(s).catch(()=>{Ke.delete(s)}),Ke.set(s,t)),t}async function bi(e){const s=await fetch(e,{credentials:"same-origin"});if(!s.ok||!s.body)throw new Error(`warmVisionWasm: ${s.status} ${e}`);const t=s.body.getReader();for(;;){const{done:n}=await t.read();if(n)return}}class re{constructor(){u(this,"disposed",!1);u(this,"paused",!1);u(this,"rafId",null);u(this,"statInferenceMs",null);u(this,"statInferences",0);u(this,"statWindowStart",0);u(this,"statWindowCount",0);u(this,"statFps",0);u(this,"statSkipped",0);u(this,"statDetections",null);u(this,"statConfidence",null);u(this,"statStatus","ready");u(this,"statError",null);u(this,"targetFrameIntervalMs",0);u(this,"lastInferenceMs",0);u(this,"analysisScale",1)}recordInference(s,t=performance.now()){const n=t-s;this.statInferenceMs=n,this.statInferences+=1,this.statWindowCount+=1,this.statWindowStart===0&&(this.statWindowStart=t);const i=t-this.statWindowStart;return i>=1e3&&(this.statFps=this.statWindowCount*1e3/i,this.statWindowStart=t,this.statWindowCount=0),n}recordDetections(s,t=null){this.statDetections=s,this.statConfidence=t}recordInferenceError(s){this.statStatus=s?"error":"ready",this.statError=s}getDiagnostics(){const s=this.statWindowStart>0&&performance.now()-this.statWindowStart>1500;return{inferenceMs:this.statInferenceMs,inferenceFps:s?0:this.statFps,inferences:this.statInferences,skippedFrames:this.statSkipped,detections:this.statDetections,confidence:this.statConfidence,status:this.statStatus,error:this.statError,paused:this.paused,disposed:this.disposed}}setAnalysisScale(s){this.analysisScale=s!==void 0&&Number.isFinite(s)&&s>0?Math.min(1,Math.max(.25,s)):1}setTargetFps(s){this.targetFrameIntervalMs=s&&s>0?1e3/s:0}shouldRunInference(){if(this.targetFrameIntervalMs<=0)return!0;const s=performance.now();return s-this.lastInferenceMs<this.targetFrameIntervalMs?(this.statSkipped+=1,!1):(this.lastInferenceMs=s,!0)}async initialize(s){}async run(s){}getModelNode(){return{}}async getPerformanceData(){return{name:this.constructor.name,processingTime:null}}pause(){this.paused=!0,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}resume(){this.paused=!1}dispose(){this.disposed=!0,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}}const Ei=768,Ge=e=>e>1?"IMAGE":"VIDEO";class Ri extends re{constructor(){super();u(this,"landmarker",null);u(this,"processingTime",null);u(this,"coordinates");u(this,"visibility");u(this,"poses",[]);u(this,"bodies",[]);u(this,"identity",new ts);u(this,"numPoses",1);u(this,"bodyRequests",new Map);u(this,"reconfiguring",!1);u(this,"getSource");u(this,"sourceCanvas");u(this,"downscaler",new Se(Ei))}async getBodyData(){var w;if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now(),i=Ge(this.numPoses)==="IMAGE"?this.landmarker.detect(t):this.landmarker.detectForVideo(t,n),r=performance.now();this.processingTime=r-n,this.recordInference(n,r);const o=i.landmarks,a=o==null?void 0:o[0];this.recordDetections((o==null?void 0:o.length)??0,a&&a.length?a.reduce((M,S)=>M+(S.visibility??0),0)/a.length:null);const d=[],l=[],h=[],m=ge((w=this.getSource)==null?void 0:w.call(this));if(o)return o.forEach((M,S)=>{var b;d[S]||(d[S]=[],l[S]=[]),M.forEach(R=>{d[S].push(ne(R)),l[S].push(R.visibility??1)});const T=(((b=i.worldLandmarks)==null?void 0:b[S])??[]).map(R=>Zt(R));T.length===M.length&&(h[S]=$t({world:T,image:d[S],visibility:l[S]},m,n))}),{coordinatesList:d,visibilityList:l,poses:h}}async processBodyTracking(){var t;if(!(this.disposed||this.paused||!this.landmarker)){if(!this.reconfiguring&&this.shouldRunInference()){const n=await this.getBodyData();if(n){this.coordinates=n.coordinatesList,this.visibility=n.visibilityList,this.poses=n.poses;const i=this.sourceCanvas,r=i&&i.height>0?i.width/i.height:1;this.bodies=this.identity.update(n.poses.filter(Boolean),((t=n.poses.find(Boolean))==null?void 0:t.timestampMs)??performance.now(),r)}}this.disposed||this.paused||(this.rafId=requestAnimationFrame(this.processBodyTracking.bind(this)))}}resume(){this.paused&&(super.resume(),this.processBodyTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.downscaler.dispose(),this.coordinates=void 0,this.visibility=void 0,this.poses=[],this.bodies=[],this.identity.reset(),this.bodyRequests.clear(),this.getSource=void 0}getLandmarks2D(t=0){if(this.coordinates)return this.coordinates[t]}getVisibility(t=0){var n;return(n=this.visibility)==null?void 0:n[t]}getBodyPose(t=0){return this.poses[t]??null}getBodyPoseById(t){var n;return((n=this.bodies.find(i=>i.id===t))==null?void 0:n.pose)??null}requestBodies(t,n){return this.bodyRequests.set(t,n),this.applyNumBodies(),()=>{this.bodyRequests.delete(t)&&this.applyNumBodies()}}async applyNumBodies(){const t=Je(this.bodyRequests.values(),Ze.body.max);if(!(t===this.numPoses||this.disposed||this.reconfiguring||!this.landmarker)){this.reconfiguring=!0;try{await this.landmarker.setOptions({numPoses:t,runningMode:Ge(t)}),this.numPoses=t}catch(n){console.warn("[BodyTrackingModel] numPoses change failed",n);return}finally{this.reconfiguring=!1}this.applyNumBodies()}}async initialize(t){const n=await V.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",W.assetStorageEndpoint).toString()),[i]=await Promise.all([ie(new URL("/assets/xr/models/body_tracking.task",W.assetStorageEndpoint).toString()),se(n)]);t!=null&&t.numPoses&&this.bodyRequests.set("options",t.numPoses);const r=Je(this.bodyRequests.values(),Ze.body.max);this.landmarker=await V.PoseLandmarker.createFromOptions(n,{baseOptions:{modelAssetBuffer:i,delegate:"GPU"},runningMode:Ge(r),numPoses:r}),this.numPoses=r,this.applyNumBodies()}async run({sourceCanvas:t,getSource:n,targetFps:i,analysisScale:r}){this.getSource=n,this.setAnalysisScale(r),this.downscaler.setScale(this.analysisScale),this.sourceCanvas=t,this.setTargetFps(i),this.rafId===null&&await this.processBodyTracking()}getModelNode(){const t=this;return{getLandmarks2D:this.getLandmarks2D.bind(this),getVisibility:this.getVisibility.bind(this),getBodyPose:this.getBodyPose.bind(this),getBodies:()=>this.bodies,getBodyPoseById:this.getBodyPoseById.bind(this),requestBodies:this.requestBodies.bind(this),get numBodies(){return t.numPoses}}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const fs=Symbol("xr.modelNodeSource"),Ai=e=>e[fs]??e,Ii=.11,_i=.004,gs="/assets/xr/models/face_tracking.task",ps="/assets/xr/wasm",Fi=(e,s,t=!0)=>t?s.set(e.x,-e.y,e.z):s.set(e.x,e.y,-e.z),Pi=(e,s)=>s.setFromRotationMatrix(e).normalize();class Di extends re{constructor(){super();u(this,"landmarker",null);u(this,"modelBytes",null);u(this,"processingTime",null);u(this,"sourceCanvas");u(this,"analysisCanvas");u(this,"getSource");u(this,"detectionResults");u(this,"numFaces",1);u(this,"cameras",[]);u(this,"faces",[]);u(this,"leftCheekScratch",[]);u(this,"rightCheekScratch",[]);u(this,"rotMatrixScratch",new q.Matrix4);u(this,"rotQuatScratch",new q.Quaternion);u(this,"rotEulerScratch",new q.Euler)}extractAndUpdateFaceData(t){var r;if(!t.faceLandmarks.length){this.faces=[];return}const n=t.faceLandmarks.length;this.faces.length>n&&(this.faces.length=n,this.leftCheekScratch.length=n,this.rightCheekScratch.length=n);const i=ge((r=this.getSource)==null?void 0:r.call(this));for(;this.faces.length<n;)this.faces.push({transform:{position:new q.Vector3,rotation:new q.Vector3,quaternion:new q.Quaternion,scale:new q.Vector3},gestures:{},mirrored:i}),this.leftCheekScratch.push(new q.Vector3),this.rightCheekScratch.push(new q.Vector3);for(let o=0;o<n;o+=1)this.faces[o].mirrored=i;for(let o=0;o<n;o+=1){if(!this.cameras[o])continue;const a=this.faces[o],d=t.faceLandmarks[o],l=t.facialTransformationMatrixes[o];this.rotMatrixScratch.fromArray(l.data),Pi(this.rotMatrixScratch,a.transform.quaternion),this.rotQuatScratch.copy(a.transform.quaternion),this.rotQuatScratch.set(-this.rotQuatScratch.x,this.rotQuatScratch.y,this.rotQuatScratch.z,this.rotQuatScratch.w),this.rotEulerScratch.setFromQuaternion(this.rotQuatScratch,"XYZ"),Fi(this.rotEulerScratch,a.transform.rotation,i),Ee(d[4],this.cameras[o],a.transform.position),Ee(d[50],this.cameras[o],this.leftCheekScratch[o]),Ee(d[280],this.cameras[o],this.rightCheekScratch[o]);const m=this.leftCheekScratch[o].distanceTo(this.rightCheekScratch[o])*Ii,w=Math.abs(q.MathUtils.radToDeg(this.rotEulerScratch.y)),M=m+w*_i,S=a.transform.scale.x,T=Mi(isNaN(S)?0:S,M);a.transform.scale.set(T,T,T);const b=a.gestures,R=t.faceBlendshapes[o].categories;for(const y of R)b[y.categoryName]=y.score}}async processFaceTracking(){if(this.disposed||this.paused||!this.landmarker||!this.sourceCanvas)return null;if(!this.shouldRunInference()){this.rafId=requestAnimationFrame(this.processFaceTracking.bind(this));return}const t=Li(this.numFaces)*this.analysisScale,n=this.sourceCanvas.width,i=this.sourceCanvas.height,r=Math.min(1,t/Math.max(n,i)),o=Math.max(1,Math.round(n*r)),a=Math.max(1,Math.round(i*r));(!this.analysisCanvas||this.analysisCanvas.width!==o||this.analysisCanvas.height!==a)&&(this.analysisCanvas=new OffscreenCanvas(o,a));const d=this.analysisCanvas.getContext("2d");if(!d){this.rafId=requestAnimationFrame(this.processFaceTracking.bind(this));return}d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,o,a),d.drawImage(this.sourceCanvas,0,0,o,a);const l=performance.now(),h=this.landmarker.detectForVideo(this.analysisCanvas,l),m=performance.now();this.processingTime=m-l,this.recordInference(l,m),this.recordDetections(h.faceLandmarks.length,null),this.detectionResults=h,this.extractAndUpdateFaceData(h),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.processFaceTracking.bind(this)))}resume(){this.paused&&(super.resume(),this.processFaceTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.releaseModelBytes(),this.sourceCanvas=void 0,this.getSource=void 0,this.analysisCanvas=void 0,this.detectionResults=void 0,this.processingTime=null,this.cameras=[],this.faces=[],this.leftCheekScratch=[],this.rightCheekScratch=[]}getFace(t=0){return this.faces[t]}getDetectionResults(){return this.detectionResults}getRawFaceTrackingData(t=0){var n,i,r,o;if(this.detectionResults)return{landmarks:(n=this.detectionResults.faceLandmarks)==null?void 0:n[t],blendshapes:(r=(i=this.detectionResults.faceBlendshapes)==null?void 0:i[t])==null?void 0:r.categories,transformationMatrix:(o=this.detectionResults.facialTransformationMatrixes)==null?void 0:o[t]}}async initialize(t){var o;this.numFaces=(t==null?void 0:t.numFaces)||1;const n=await V.FilesetResolver.forVisionTasks(new URL(ps,W.assetStorageEndpoint).toString());(o=this.modelBytes)==null||o.release();const i=ms(new URL(gs,W.assetStorageEndpoint).toString());this.modelBytes=i;let r;try{const[a]=await Promise.all([i.bytes,se(n)]);r=await V.FaceLandmarker.createFromOptions(n,{baseOptions:{modelAssetBuffer:a,delegate:"GPU"},minFaceDetectionConfidence:.3,minFacePresenceConfidence:.3,minTrackingConfidence:.3,outputFaceBlendshapes:!0,outputFacialTransformationMatrixes:!0,runningMode:"VIDEO",numFaces:this.numFaces})}catch(a){throw this.releaseModelBytes(i),a}if(this.disposed){r.close(),this.releaseModelBytes(i);return}this.landmarker=r}releaseModelBytes(t=this.modelBytes){t==null||t.release(),this.modelBytes===t&&(this.modelBytes=null)}async run({sourceCanvas:t,getSource:n,targetFps:i,analysisScale:r}){this.sourceCanvas=t,this.getSource=n,this.setTargetFps(i),this.setAnalysisScale(r),this.analysisCanvas=void 0,this.rafId===null&&this.processFaceTracking()}getModelNode(){const t=this,n={get detectionResults(){return t.detectionResults},get numFaces(){return t.numFaces},getDetectionResults:this.getDetectionResults.bind(this),getFace:this.getFace.bind(this),getRawFaceTrackingData:this.getRawFaceTrackingData.bind(this),setCamera:(i,r=0)=>{this.cameras[r]=i}};return Object.defineProperty(n,fs,{value:t}),n}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const Li=e=>e>1?1024:512;var J=(e=>(e.ClosedFist="closed_fist",e.OpenPalm="open_palm",e.PointingUp="pointing_up",e.ThumbDown="thumb_down",e.ThumbUp="thumb_up",e.Victory="victory",e.ILoveYou="i_love_you",e.None="none",e))(J||{});const Oi=512,Ni={Closed_Fist:J.ClosedFist,Open_Palm:J.OpenPalm,Pointing_Up:J.PointingUp,Thumb_Down:J.ThumbDown,Thumb_Up:J.ThumbUp,Victory:J.Victory,ILoveYou:J.ILoveYou,None:J.None},Ui=15;class Bi extends re{constructor(){super();u(this,"landmarker",null);u(this,"processingTime",null);u(this,"coordinates");u(this,"gesture");u(this,"sourceCanvas");u(this,"downscaler",new Se(Oi))}async getGestureData(){var d,l;if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now(),i=this.landmarker.recognizeForVideo(t,n),r=performance.now();this.processingTime=r-n,this.recordInference(n,r),this.recordDetections(i.landmarks.length,((l=(d=i.gestures[0])==null?void 0:d[0])==null?void 0:l.score)??null);const o=i.landmarks[0],a=[];if(o){const h=i.gestures[0][0].categoryName;return o.forEach(m=>{a.push(ne(m))}),{coordinates:a,gesture:Ni[h]}}return{coordinates:void 0,gesture:void 0}}async processGestureTracking(){if(!this.disposed){if(this.shouldRunInference()){const t=await this.getGestureData();t&&(this.coordinates=t.coordinates,this.gesture=t.gesture)}this.disposed||this.paused||(this.rafId=requestAnimationFrame(this.processGestureTracking.bind(this)))}}resume(){this.paused&&(super.resume(),this.processGestureTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.downscaler.dispose(),this.coordinates=void 0,this.gesture=void 0}async initialize(){const t=await V.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",W.assetStorageEndpoint).toString()),[n]=await Promise.all([ie(new URL("/assets/xr/models/gesture_tracking.task",W.assetStorageEndpoint).toString()),se(t)]),i=await V.GestureRecognizer.createFromOptions(t,{baseOptions:{modelAssetBuffer:n,delegate:"GPU"},runningMode:"VIDEO",numHands:1});this.landmarker=i}async run({sourceCanvas:t,targetFps:n,analysisScale:i}){this.setAnalysisScale(i),this.downscaler.setScale(this.analysisScale),this.sourceCanvas=t,this.setTargetFps(n??Ui),this.rafId===null&&await this.processGestureTracking()}getModelNode(){const t=this;return{get coordinates(){return t.coordinates},get gesture(){return t.gesture}}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}class Hi extends re{constructor(){super();u(this,"landmarker",null);u(this,"status","loading");u(this,"error",null);u(this,"processingTime",null);u(this,"sourceCanvas");u(this,"getSource");u(this,"downscaler",new Se(Re().analysisMaxDimension));u(this,"raw");u(this,"delegatePolicy","auto");u(this,"delegate","GPU");u(this,"vision",null);u(this,"modelBuffer",null);u(this,"graphOptions",{});u(this,"rebuilding",!1);u(this,"fallbackAttempted",!1);u(this,"result",vn());u(this,"builder",new xn);u(this,"node");this.node={getResult:()=>this.result,getRawResult:()=>this.raw,getStatus:()=>this.status,getError:()=>this.error,getDelegate:()=>this.delegate,setOptions:t=>this.setRuntimeOptions(t)}}setRuntimeOptions(t){const n=this.builder.getOptions().analysisMaxDimension;this.builder.setOptions(t);const i=this.builder.getOptions().analysisMaxDimension;i!==n&&(this.downscaler.dispose(),this.downscaler=new Se(i),this.downscaler.setScale(this.analysisScale))}async initialize(t){this.status="loading",this.error=null,this.setRuntimeOptions(t??{});try{const n=await V.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",W.assetStorageEndpoint).toString()),[i]=await Promise.all([ie((t==null?void 0:t.modelUrl)??et),se(n)]);this.vision=n,this.modelBuffer=i,this.graphOptions={runningMode:"VIDEO",outputFaceBlendshapes:(t==null?void 0:t.outputFaceBlendshapes)??!0,minFaceDetectionConfidence:t==null?void 0:t.minFaceDetectionConfidence,minFacePresenceConfidence:t==null?void 0:t.minFacePresenceConfidence,minPoseDetectionConfidence:t==null?void 0:t.minPoseDetectionConfidence,minPosePresenceConfidence:t==null?void 0:t.minPosePresenceConfidence,minHandLandmarksConfidence:t==null?void 0:t.minHandLandmarksConfidence},this.delegatePolicy=(t==null?void 0:t.delegate)??"auto",this.delegate=this.delegatePolicy==="CPU"?"CPU":"GPU";const r=await this.createLandmarker(this.delegate);if(this.disposed){r.close();return}this.landmarker=r,this.status="ready"}catch(n){throw this.status="error",this.error=n instanceof Error?n:new Error(String(n)),this.error}}createLandmarker(t){if(!this.vision||!this.modelBuffer)throw new Error("HolisticTrackingModel: initialize() has not loaded the model");return V.HolisticLandmarker.createFromOptions(this.vision,{baseOptions:{modelAssetBuffer:this.modelBuffer,delegate:t},...this.graphOptions})}async fallbackToCpu(t){this.fallbackAttempted=!0,this.rebuilding=!0,this.status="loading",console.warn("[xr-sdk holistic] GPU inference failed; rebuilding the graph on the CPU delegate.",t.message);const n=this.landmarker;try{const i=await this.createLandmarker("CPU");if(this.disposed){i.close();return}this.landmarker=i,this.delegate="CPU",this.status="ready",this.error=null;try{n==null||n.close()}catch{}this.rebuilding=!1,this.detectOnce()}catch(i){this.rebuilding=!1,this.status="error",this.error=i instanceof Error?i:new Error(String(i))}}detectOnce(){this.disposed||!this.landmarker||!this.sourceCanvas||(this.detect(),this.builder.update(this.raw,performance.now(),this.result,this.isMirrored()))}detect(){var i,r,o,a,d;if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now();try{this.raw=this.landmarker.detectForVideo(t,n),this.status==="error"&&(this.status="ready",this.error=null),this.recordInferenceError(null);const l=this.raw,h=((i=l.faceLandmarks)!=null&&i.length?1:0)+((r=l.leftHandLandmarks)!=null&&r.length?1:0)+((o=l.rightHandLandmarks)!=null&&o.length?1:0)+((a=l.poseLandmarks)!=null&&a.length?1:0),m=(d=l.poseLandmarks)==null?void 0:d[0];this.recordDetections(h,m&&m.length?m.reduce((w,M)=>w+(M.visibility??0),0)/m.length:null)}catch(l){const h=l instanceof Error?l:new Error(String(l));this.delegatePolicy==="auto"&&this.delegate==="GPU"&&!this.fallbackAttempted?this.fallbackToCpu(h):(this.status="error",this.error=h,this.recordInferenceError(h))}this.processingTime=performance.now()-n,this.recordInference(n)}isMirrored(){var t;return ge((t=this.getSource)==null?void 0:t.call(this))}async run({sourceCanvas:t,getSource:n,targetFps:i,analysisScale:r}){this.sourceCanvas=t,this.getSource=n,this.setTargetFps(i),this.setAnalysisScale(r),this.downscaler.setScale(this.analysisScale),this.rafId===null&&await this.process()}async process(){this.disposed||this.paused||!this.landmarker||(!this.rebuilding&&this.shouldRunInference()&&this.detect(),this.builder.update(this.raw,performance.now(),this.result,this.isMirrored()),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.process.bind(this))))}resume(){this.paused&&(super.resume(),this.process())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.getSource=void 0,this.downscaler.dispose(),this.vision=null,this.modelBuffer=null,this.raw=void 0,this.builder.reset(),this.result.face=null,this.result.leftHand=null,this.result.rightHand=null,this.result.pose=null}getModelNode(){return this.node}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const ys=e=>e==="left"?"right":"left",ws=(e,s)=>s?ys(e):e,zi=/left|right|Left|Right/,Wi={left:"right",right:"left",Left:"Right",Right:"Left"},vs=e=>e.replace(zi,s=>Wi[s]),qi=(e,s)=>s?vs(e):e,Vi=e=>e?-1:1,Ss=["wrist","thumbCmc","thumbMcp","thumbIp","thumbTip","indexMcp","indexPip","indexDip","indexTip","middleMcp","middlePip","middleDip","middleTip","ringMcp","ringPip","ringDip","ringTip","pinkyMcp","pinkyPip","pinkyDip","pinkyTip"],Xi=Object.fromEntries(Ss.map((e,s)=>[e,s])),xs=200,ye=(e,s)=>Math.hypot(e.x-s.x,e.y-s.y),we=e=>e==="left"?"right":"left",Ye=(e,s,t)=>({handedness:s,score:e.score,world:e.world,image:e.image,timestampMs:t,held:!1}),Ms=(e,s,t,{holdMs:n=xs,confidentScore:i=.8,continuityMs:r=500}={})=>{const o=l=>!!l&&t-l.timestampMs<=r&&l.image.length>0,a={left:null,right:null},d=e.filter(l=>l.image.length>0).slice(0,2);if(d.length===2){const[l,h]=d,m=l.handedness!==void 0&&h.handedness!==void 0&&l.handedness!==h.handedness,w=l.score>=i&&h.score>=i;let M;if(m&&w)M=l.handedness;else if(o(s.left)&&o(s.right)){const S=ye(l.image[0],s.left.image[0])+ye(h.image[0],s.right.image[0]),T=ye(l.image[0],s.right.image[0])+ye(h.image[0],s.left.image[0]);M=S<=T?"left":"right"}else if(m)M=l.handedness;else{const S=l.score>=h.score?l:h,T=S.handedness??"right";M=S===l?T:we(T)}a[M]=Ye(l,M,t),a[we(M)]=Ye(h,we(M),t)}else if(d.length===1){const[l]=d;let h=l.handedness??"right";if(l.score<i||l.handedness===void 0){const m=S=>o(S)?ye(l.image[0],S.image[0]):1/0,w=m(s[h]);m(s[we(h)])<w&&(h=we(h))}a[h]=Ye(l,h,t)}for(const l of["left","right"]){const h=s[l];a[l]||!h||t-h.timestampMs<=n&&(a[l]={...h,held:!0})}return a},Ts=(e,s)=>{const t=e==null?void 0:e.toLowerCase();if(!(t!=="left"&&t!=="right"))return ws(t,s)},Cs=(e,s={x:0,y:0,z:0})=>(s.x=e.x*100,s.y=-e.y*100,s.z=-e.z*100,s),Ki=512,Gi=Object.freeze({minHandDetectionConfidence:.5,minHandPresenceConfidence:.65,minTrackingConfidence:.5});class Yi extends re{constructor(){super();u(this,"landmarker",null);u(this,"processingTime",null);u(this,"hands");u(this,"coordinates");u(this,"gesture");u(this,"handedness");u(this,"poses",{left:null,right:null});u(this,"sourceCanvas");u(this,"getSource");u(this,"downscaler",new Se(Ki))}async getHandData(){var m,w,M;if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now(),i=this.landmarker.detectForVideo(t,n),r=performance.now();this.processingTime=r-n,this.recordInference(n,r);const o=[],a=[],d=i.handedness??i.handednesses??[];this.recordDetections(i.landmarks.length,((w=(m=d[0])==null?void 0:m[0])==null?void 0:w.score)??null);const l=ge((M=this.getSource)==null?void 0:M.call(this));if(i.landmarks.forEach((S,T)=>{var A,E;if(!S||S.length===0)return;const b=S.map(B=>ne(B)),R=(((A=i.worldLandmarks)==null?void 0:A[T])??[]).map(B=>Cs(B)),y=(E=d[T])==null?void 0:E[0],g=Ts(y==null?void 0:y.categoryName,l),p=(y==null?void 0:y.score)??0,v=S[0].z<0?"closed_fist":"open_palm";o.push({coordinates:b,worldCoordinates:R,gesture:v,handedness:g,handednessScore:p}),a.push({handedness:g,score:p,world:R,image:b})}),this.poses=Ms(a,this.poses,n),!o.length)return{hands:void 0,coordinates:void 0,gesture:void 0,handedness:void 0};const h=o[0];return{hands:o,coordinates:h.coordinates,gesture:h.gesture,handedness:h.handedness}}async processHandTracking(){if(!this.disposed){if(this.shouldRunInference()){const t=await this.getHandData();t&&(this.hands=t.hands,this.coordinates=t.coordinates,this.gesture=t.gesture,this.handedness=t.handedness)}this.disposed||this.paused||(this.rafId=requestAnimationFrame(this.processHandTracking.bind(this)))}}resume(){this.paused&&(super.resume(),this.processHandTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.getSource=void 0,this.hands=void 0,this.poses={left:null,right:null},this.downscaler.dispose(),this.coordinates=void 0,this.gesture=void 0,this.handedness=void 0}async initialize(){const t=await V.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",W.assetStorageEndpoint).toString()),[n]=await Promise.all([ie(new URL("/assets/xr/models/hand_tracking.task",W.assetStorageEndpoint).toString()),se(t)]),i=await V.HandLandmarker.createFromOptions(t,{baseOptions:{modelAssetBuffer:n,delegate:"GPU"},runningMode:"VIDEO",numHands:2,...Gi});this.landmarker=i}async run({sourceCanvas:t,getSource:n,targetFps:i,analysisScale:r}){this.getSource=n,this.setAnalysisScale(r),this.downscaler.setScale(this.analysisScale),this.sourceCanvas=t,this.setTargetFps(i),this.rafId===null&&await this.processHandTracking()}getModelNode(){const t=this;return{get hands(){return t.hands},get coordinates(){return t.coordinates},get gesture(){return t.gesture},get handedness(){return t.handedness},get poses(){return t.poses},getHandPose:n=>t.poses[n]}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const ji=24,Qi=720,Ji=[[255,255,255,255],[0,0,0,0]];class Zi extends re{constructor(){super();u(this,"segmenter",null);u(this,"processingTime",null);u(this,"sourceCanvas");u(this,"processCanvas");u(this,"filterCanvas");u(this,"inputSource");u(this,"inputSourceSize");u(this,"glCanvas");u(this,"drawingUtils");u(this,"useGpuMaskPath",!1);u(this,"maskImageData");u(this,"maskCanvas",null);u(this,"segmentationMaskTexture");u(this,"isMaskSetup",!1);u(this,"isProcessing",!1);u(this,"latestMask",null);u(this,"rawCache",null);u(this,"latestMaskTimeMs",0);u(this,"quality","medium");u(this,"stagingCanvas")}getQualityScaleFactor(){switch(this.quality){case"low":return .5;case"medium":return .75;case"high":return 1;default:return .5}}setInputSource(t){this.inputSource=t,this.inputSourceSize=t?this.readIntrinsicSize(t):void 0}readIntrinsicSize(t){if(t instanceof HTMLVideoElement)return t.videoWidth>0?{width:t.videoWidth,height:t.videoHeight}:void 0;if(t instanceof HTMLImageElement)return t.naturalWidth>0?{width:t.naturalWidth,height:t.naturalHeight}:void 0;const n=t.width,i=t.height;return typeof n=="number"&&n>0&&typeof i=="number"&&i>0?{width:n,height:i}:void 0}ensureProcessCanvasForInput(){if(!this.processCanvas||!this.inputSource)return;const t=this.readIntrinsicSize(this.inputSource);if(!t)return;this.inputSourceSize=t;const n=Math.min(1,Qi/Math.max(t.width,t.height)),i=Math.max(1,Math.round(t.width*n)),r=Math.max(1,Math.round(t.height*n));this.processCanvas.width===i&&this.processCanvas.height===r||(this.processCanvas.width=i,this.processCanvas.height=r,this.glCanvas&&(this.glCanvas.width=i,this.glCanvas.height=r),this.maskImageData=void 0)}async processSegmentation(){if(this.disposed||!this.isProcessing||!this.maskCanvas||!this.processCanvas)return;if(!this.shouldRunInference()){if(this.disposed||this.paused)return;this.rafId=requestAnimationFrame(this.processSegmentation.bind(this));return}const t=this.inputSource??this.sourceCanvas;if(!this.segmenter||!t){if(this.disposed||this.paused)return;this.rafId=requestAnimationFrame(this.processSegmentation.bind(this));return}const n=performance.now();this.ensureProcessCanvasForInput();const i=this.processCanvas.getContext("2d");if(i){const d=this.processCanvas.width,l=this.processCanvas.height;if(i.clearRect(0,0,d,l),this.inputSource&&this.inputSourceSize){const{width:h,height:m}=this.inputSourceSize,w=Math.min(d/h,l/m),M=h*w,S=m*w;i.drawImage(this.inputSource,(d-M)/2,(l-S)/2,M,S)}else i.drawImage(t,0,0,d,l)}const r=performance.now(),a=this.segmenter.segmentForVideo(this.processCanvas,r).categoryMask;if(!a){if(this.disposed||this.paused)return;this.rafId=requestAnimationFrame(this.processSegmentation.bind(this));return}if(this.rawCache=null,this.latestMaskTimeMs=r,this.latestMask&&(this.latestMask.close(),this.latestMask=null),this.useGpuMaskPath&&this.drawingUtils&&this.glCanvas)this.drawingUtils.drawCategoryMask(a,Ji),this.latestMask=a.clone(),a.close(),this.blitGlToMask();else{this.latestMask=a.clone();const d=this.readMaskToImageData(a);a.close(),d&&this.blitImageDataToMask(d)}this.segmentationMaskTexture&&(this.isMaskSetup||(this.segmentationMaskTexture.format=X.RGBAFormat,this.segmentationMaskTexture.minFilter=X.LinearFilter,this.segmentationMaskTexture.magFilter=X.LinearFilter,this.segmentationMaskTexture.generateMipmaps=!1,this.isMaskSetup=!0),this.segmentationMaskTexture.needsUpdate=!0),this.processingTime=performance.now()-n,this.recordInference(n),this.recordDetections(1,null),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.processSegmentation.bind(this)))}blitGlToMask(){if(!this.maskCanvas||!this.filterCanvas||!this.glCanvas)return;const t=this.maskCanvas.getContext("2d"),n=this.filterCanvas.getContext("2d");!t||!n||(n.filter="blur(0.5px)",n.clearRect(0,0,this.filterCanvas.width,this.filterCanvas.height),n.drawImage(this.glCanvas,0,0,this.filterCanvas.width,this.filterCanvas.height),t.clearRect(0,0,this.maskCanvas.width,this.maskCanvas.height),t.drawImage(this.filterCanvas,0,0,this.maskCanvas.width,this.maskCanvas.height))}readMaskToImageData(t){const n=t.getAsUint8Array(),{width:i,height:r}=t;if(!n||i<=0||r<=0)return null;(!this.maskImageData||this.maskImageData.width!==i||this.maskImageData.height!==r)&&(this.maskImageData=new ImageData(i,r));const o=this.maskImageData.data;for(let a=0;a<n.length;a+=1){const d=n[a]===255?0:255;o[a*4]=255,o[a*4+1]=d,o[a*4+2]=255,o[a*4+3]=d}return this.maskImageData}blitImageDataToMask(t){if(!this.maskCanvas||!this.filterCanvas)return;const n=this.maskCanvas.getContext("2d"),i=this.filterCanvas.getContext("2d");if(!n||!i)return;const r=this.getStagingCanvas(t.width,t.height),o=r.getContext("2d");o&&(o.putImageData(t,0,0),i.filter="blur(0.5px)",i.clearRect(0,0,this.filterCanvas.width,this.filterCanvas.height),i.drawImage(r,0,0,this.filterCanvas.width,this.filterCanvas.height),n.clearRect(0,0,this.maskCanvas.width,this.maskCanvas.height),n.drawImage(this.filterCanvas,0,0,this.maskCanvas.width,this.maskCanvas.height))}getStagingCanvas(t,n){return this.stagingCanvas||(this.stagingCanvas=document.createElement("canvas")),this.stagingCanvas.width!==t&&(this.stagingCanvas.width=t),this.stagingCanvas.height!==n&&(this.stagingCanvas.height=n),this.stagingCanvas}resume(){this.paused&&(super.resume(),this.processSegmentation())}dispose(){if(super.dispose(),this.isProcessing=!1,this.latestMask){try{this.latestMask.close()}catch{}this.latestMask=null}if(this.rawCache=null,this.segmenter){try{this.segmenter.close()}catch{}this.segmenter=null}this.drawingUtils=void 0,this.glCanvas=void 0,this.maskImageData=void 0,this.segmentationMaskTexture&&(this.segmentationMaskTexture.dispose(),this.segmentationMaskTexture=void 0),this.sourceCanvas=void 0,this.inputSource=void 0,this.inputSourceSize=void 0,this.processCanvas=void 0,this.filterCanvas=void 0,this.stagingCanvas=void 0,this.maskCanvas=null}async initialize(t){this.quality=(t==null?void 0:t.quality)??"low";const n=await V.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",W.assetStorageEndpoint).toString()),[i]=await Promise.all([ie(new URL("/assets/xr/models/segmentation.tflite",W.assetStorageEndpoint).toString()),se(n)]);this.glCanvas=new OffscreenCanvas(1,1);const r=this.glCanvas.getContext("webgl2",{preserveDrawingBuffer:!0});this.segmenter=await V.ImageSegmenter.createFromOptions(n,{baseOptions:{modelAssetBuffer:i,delegate:"GPU"},...r?{canvas:this.glCanvas}:{},outputCategoryMask:!0,outputConfidenceMasks:!1,runningMode:"VIDEO"}),r?(this.drawingUtils=new V.DrawingUtils(r),this.useGpuMaskPath=!0):this.useGpuMaskPath=!1}async run({sourceCanvas:t,renderWidth:n,renderHeight:i,targetFps:r}){var a;if(!t)return;this.setTargetFps(r??ji),this.isProcessing=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null);const o=this.getQualityScaleFactor();this.sourceCanvas=t,this.processCanvas=document.createElement("canvas"),this.processCanvas.width=t.width*o,this.processCanvas.height=t.height*o,this.glCanvas&&(this.glCanvas.width=this.processCanvas.width,this.glCanvas.height=this.processCanvas.height),this.maskImageData=void 0,this.maskCanvas=document.createElement("canvas"),this.maskCanvas.width=n,this.maskCanvas.height=i,this.filterCanvas=document.createElement("canvas"),this.filterCanvas.width=n,this.filterCanvas.height=i,(a=this.segmentationMaskTexture)==null||a.dispose(),this.segmentationMaskTexture=new X.CanvasTexture(this.maskCanvas),this.isMaskSetup=!1,this.rawCache=null,this.isProcessing=!0,this.lastInferenceMs=0,this.rafId=requestAnimationFrame(this.processSegmentation.bind(this))}getRawSegmentationData(){if(this.rawCache)return this.rawCache;if(!this.latestMask)return null;const t=this.latestMask.getAsUint8Array();return this.rawCache={maskData:t,width:this.latestMask.width,height:this.latestMask.height,timestampMs:this.latestMaskTimeMs},this.rawCache}getModelNode(){const t=this;return{get backgroundSegmentationMask(){return t.segmentationMaskTexture},getMaskCanvas:()=>t.maskCanvas,getRawSegmentationData:()=>t.getRawSegmentationData(),getMaskTimestampMs:()=>t.latestMaskTimeMs,setInputSource:n=>t.setInputSource(n??void 0)}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const ks=(e,s,t,n="feed")=>({width:Math.max(1,Math.round(e)),height:Math.max(1,Math.round(s)),indices:new Uint8Array(Math.max(1,Math.round(e))*Math.max(1,Math.round(s))),labels:t,space:n,version:0}),$i=e=>{e.indices.fill(0)},er=(e,s)=>e.labels.indexOf(s),bs=(e,s,t)=>{const{width:n,height:i,indices:r}=e,o=s.length;if(o<3)return;let a=1/0,d=-1/0;for(let w=0;w<o;w+=1){const M=s[w].y*i;M<a&&(a=M),M>d&&(d=M)}const l=Math.max(0,Math.floor(a)),h=Math.min(i-1,Math.ceil(d)),m=[];for(let w=l;w<=h;w+=1){const M=w+.5;m.length=0;for(let T=0;T<o;T+=1){const b=s[T],R=s[(T+1)%o],y=b.y*i,g=R.y*i;if(M<y==M<g)continue;const p=(M-y)/(g-y);m.push((b.x+p*(R.x-b.x))*n)}m.sort((T,b)=>T-b);const S=w*n;for(let T=0;T+1<m.length;T+=2){const b=Math.max(0,Math.round(m[T])),R=Math.min(n,Math.round(m[T+1]));for(let y=b;y<R;y+=1)r[S+y]=t}}},tr=(e,s,t,n,i=[])=>{i.length=0;for(let r=0;r<t.length;r+=1){const o=s[t[r]];if(!o)return;i.push(o)}bs(e,i,n)},je=e=>e,$e={hair:{labels:["bg","hair"],assetPath:"/assets/xr/models/hair_segmenter.tflite",defaultUrl:"https://storage.googleapis.com/mediapipe-models/image_segmenter/hair_segmenter/float32/latest/hair_segmenter.tflite",decode:je},multiclass:{labels:["bg","hair","body_skin","face_skin","clothes","others"],assetPath:"/assets/xr/models/selfie_multiclass_256x256.tflite",defaultUrl:"https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_multiclass_256x256/float32/latest/selfie_multiclass_256x256.tflite",decode:je},nails:{labels:["bg","nail"],assetPath:"/assets/xr/models/nail_segmenter_v1.tflite",defaultUrl:"https://cdn.vincentt.studio/assets/xr/models/nail_segmenter_v1.tflite",decode:je}},sr=(e,s,t)=>{const n=t.length===e.length?t:new Uint8Array(e.length);for(let i=0;i<e.length;i+=1)n[i]=s(e[i]);return n},nr=15,ir={low:.5,medium:.75,high:1};class rr extends re{constructor(){super();u(this,"segmenter",null);u(this,"preset","hair");u(this,"quality","medium");u(this,"status","loading");u(this,"error",null);u(this,"processingTime",null);u(this,"sourceCanvas");u(this,"processCanvas");u(this,"isProcessing",!1);u(this,"mask",ks(1,1,["bg"]));u(this,"node");this.node={getMask:()=>this.mask,getStatus:()=>this.status,getError:()=>this.error}}async initialize(t){this.preset=(t==null?void 0:t.preset)??"hair",this.quality=(t==null?void 0:t.quality)??"medium";const n=$e[this.preset];this.mask.labels=n.labels,this.status="loading",this.error=null;try{const i=await V.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",W.assetStorageEndpoint).toString()),r=(t==null?void 0:t.modelUrl)??n.defaultUrl,[o]=await Promise.all([ie(r),se(i)]);this.segmenter=await V.ImageSegmenter.createFromOptions(i,{baseOptions:{modelAssetBuffer:o,delegate:"GPU"},outputCategoryMask:!0,outputConfidenceMasks:!1,runningMode:"VIDEO"}),this.status="ready"}catch(i){throw this.status="error",this.error=i instanceof Error?i:new Error(String(i)),this.error}}async run({sourceCanvas:t,targetFps:n}){t&&(this.setTargetFps(n??nr),this.isProcessing=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.sourceCanvas=t,this.processCanvas=document.createElement("canvas"),this.isProcessing=!0,this.lastInferenceMs=0,this.rafId=requestAnimationFrame(this.process.bind(this)))}process(){if(this.disposed||this.paused||!this.isProcessing)return;const{segmenter:t,sourceCanvas:n,processCanvas:i}=this;if(!t||!n||!i||!this.shouldRunInference()){this.rafId=requestAnimationFrame(this.process.bind(this));return}const r=performance.now(),o=ir[this.quality],a=Math.max(1,Math.round(n.width*o)),d=Math.max(1,Math.round(n.height*o));(i.width!==a||i.height!==d)&&(i.width=a,i.height=d);const l=i.getContext("2d");l&&l.drawImage(n,0,0,a,d);try{const m=t.segmentForVideo(i,performance.now()).categoryMask;if(m){const w=m.getAsUint8Array();(this.mask.width!==m.width||this.mask.height!==m.height)&&(this.mask.width=m.width,this.mask.height=m.height),this.mask.indices=sr(w,$e[this.preset].decode,this.mask.indices),this.mask.version+=1,this.mask.timestampMs=r,m.close()}this.status==="error"&&(this.status="ready",this.error=null),this.recordInferenceError(null),this.recordDetections(m?1:0,null)}catch(h){this.status="error",this.error=h instanceof Error?h:new Error(String(h)),this.recordInferenceError(this.error)}this.processingTime=performance.now()-r,this.recordInference(r),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.process.bind(this)))}resume(){this.paused&&(super.resume(),this.isProcessing&&(this.rafId=requestAnimationFrame(this.process.bind(this))))}getModelNode(){return this.node}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}dispose(){var t;super.dispose(),this.isProcessing=!1;try{(t=this.segmenter)==null||t.close()}catch{}this.segmenter=null,this.sourceCanvas=void 0,this.processCanvas=void 0}}const Ut={[I.BACKGROUND_SEGMENTATION]:Zi,[I.SEMANTIC_SEGMENTATION]:rr,[I.HAND_TRACKER]:Yi,[I.GESTURE_TRACKER]:Bi,[I.FACE_TRACKER]:Di,[I.BODY_TRACKER]:Ri,[I.HOLISTIC_TRACKER]:Hi},ar=async e=>{const s=document.createElement("video");s.srcObject=e,s.muted=!0,s.playsInline=!0,s.autoplay=!0,await new Promise(n=>{s.onloadedmetadata=()=>{s.play(),n()}});const t=s;return await new Promise(n=>{const i=setTimeout(n,150),r=()=>{clearTimeout(i),n()};typeof t.requestVideoFrameCallback=="function"?t.requestVideoFrameCallback(r):requestAnimationFrame(()=>requestAnimationFrame(()=>r()))}),s},or=e=>{const s=new X.CanvasTexture(e);return s.colorSpace=X.SRGBColorSpace,s.format=X.RGBAFormat,s.minFilter=X.LinearFilter,s.magFilter=X.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s},cr=(e,s)=>{const t=e.videoWidth,n=e.videoHeight;t>0&&n>0&&(s.width!==t&&(s.width=t),s.height!==n&&(s.height=n));const i=s.getContext("2d",{colorSpace:"srgb"});i.save(),i.scale(-1,1),i.drawImage(e,-s.width,0,s.width,s.height),i.restore()},lr=(e,s,t=1)=>{const n=s.getContext("2d",{colorSpace:"srgb"}),i=jt({source:{width:e.width,height:e.height},feed:{width:s.width,height:s.height},zoom:t});i&&(n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,s.width,s.height),n.drawImage(e,0,0,e.width,e.height,i.offsetX,i.offsetY,i.drawWidth,i.drawHeight))},dr=(e,s,t)=>{const n=new Map,i=new WeakSet;let r=!1;const o=(y,g)=>{const p=e.getSnapshot().modelErrors;if(g===null&&!p.has(y))return;const v=new Map(p);g===null?v.delete(y):v.set(y,{model:y,error:g,at:performance.now()}),e.set({modelErrors:v})},a=(y,g)=>{var p;try{(p=g.dispose)==null||p.call(g)}catch(v){console.warn(`[xr-sdk registry] dispose threw for ${y}`,v)}};return{acquire:async(y,g,p)=>{let v=n.get(y);if(v)return v.refs.add(g),v.activeRefs.add(g),v.initPromise;const A=s[y];if(!A)throw new Error(`Invalid model: ${y}`);const E=new A,B=new Set([g]),Y=new Set([g]);o(y,null);const O=(async()=>{await E.initialize(p);const _=n.get(y);if(!_||_.model!==E||_.refs.size===0)return a(y,E),E;t&&await t(y,E);const j=n.get(y);return j&&j.refs.size>0&&(i.add(E),e.setPipeline(Q=>Q.set(y,E))),E})();return v={model:E,refs:B,activeRefs:Y,initPromise:O,options:p},n.set(y,v),O.catch(_=>{n.get(y)===v&&(n.delete(y),e.setPipeline(Q=>Q.delete(y)),o(y,_ instanceof Error?_:new Error(String(_)))),a(y,E)}),O},release:(y,g)=>{const p=n.get(y);p&&(p.refs.delete(g),p.activeRefs.delete(g)&&p.refs.size>0&&p.activeRefs.size===0&&p.model.pause(),!(p.refs.size>0)&&(n.delete(y),a(y,p.model),e.setPipeline(v=>v.delete(y))))},setActive:(y,g,p)=>{const v=n.get(y);if(!v||!v.refs.has(g))return;const A=v.activeRefs.size>0;p?v.activeRefs.add(g):v.activeRefs.delete(g);const E=v.activeRefs.size>0;A!==E&&(E&&!r?v.model.resume():v.model.pause())},suspendAll:()=>{r=!0;for(const y of n.values())y.model.pause()},resumeActive:()=>{r=!1;for(const y of n.values())y.activeRefs.size>0&&y.model.resume()},get:y=>{var g;return(g=n.get(y))==null?void 0:g.model},getOptions:y=>{var g;return(g=n.get(y))==null?void 0:g.options},releaseAll:()=>{for(const y of Array.from(n.keys())){const g=n.get(y);g&&(g.refs.clear(),n.delete(y),a(y,g.model))}e.setPipeline(y=>y.clear())},getState:y=>{const g=n.get(y);return g?i.has(g.model)?"ready":"initializing":e.getSnapshot().modelErrors.has(y)?"error":"idle"},getOwners:y=>{const g=n.get(y);return{refs:g?Array.from(g.refs):[],active:g?Array.from(g.activeRefs):[]}}}},hr={lifecycle:"idle",ready:!1,error:void 0,cameraTexture:void 0,renderWidth:0,renderHeight:0,source:void 0,sourceKind:void 0,cameraFacing:null,cameraDeviceId:null,orientation:{type:"portrait",angle:0},quality:null,qualityConfig:null,sourceWidth:0,sourceHeight:0,cameraZoom:1.2,pipeline:new Map,modelErrors:new Map,cameraPermission:"unknown",cameraPermissionReason:null,feedFrames:0},ur=()=>{let e={...hr,pipeline:new Map,modelErrors:new Map};const s=new Set,t=()=>{s.forEach(n=>n())};return{getSnapshot:()=>e,set:n=>{let i=!1;for(const r of Object.keys(n))if(n[r]!==e[r]){i=!0;break}i&&(e={...e,...n},t())},setPipeline:n=>{const i=new Map(e.pipeline);return n(i),e={...e,pipeline:i},t(),i},subscribe:n=>(s.add(n),()=>{s.delete(n)})}},Bt=(e,s)=>s??e==="user",mr=({renderHeight:e,renderWidth:s,videoHeight:t,videoWidth:n})=>({height:e||t,width:s||n}),fr=(e,s)=>{const t=new qn({verbose:!0}),n=ur();n.set({cameraZoom:(e==null?void 0:e.cameraZoom)??1.2});let i=s,r=e;const o=c=>{var x;const f=(x=G.getOptions(c))==null?void 0:x.targetFps;return typeof f=="number"?f:r==null?void 0:r.targetFps};let a,d,l,h,m,w,M,S,T,b,R,y,g=!1,p=!1,v=!1,A=0,E,B,Y,O=!1,_=0,j=new WeakSet;const Q=new Set,Me=c=>{const f=n.getSnapshot().cameraTexture;f&&f.dispose();const x=or(c);return n.set({cameraTexture:x}),x},Fe=async(c,f)=>{if(j.has(f)||n.getSnapshot().lifecycle!=="running"||!m)return;j.add(f);const x=_;try{await f.run({sourceCanvas:m,renderWidth:n.getSnapshot().renderWidth,renderHeight:n.getSnapshot().renderHeight,getSource:()=>n.getSnapshot().sourceKind,targetFps:o(c),analysisScale:r==null?void 0:r.analysisScale}),O&&(await new Promise(C=>requestAnimationFrame(()=>C())),await new Promise(C=>requestAnimationFrame(()=>C())),O&&_===x&&G.suspendAll())}catch(C){throw j.delete(f),C}},G=dr(n,Ut,(c,f)=>Fe(c,f));n.subscribe(()=>{if(n.getSnapshot().lifecycle!=="running")return;const c=n.getSnapshot().pipeline;for(const[f,x]of c.entries())j.has(x)||Fe(f,x)});const gt=()=>{y!==void 0&&(cancelAnimationFrame(y),y=void 0)},ae=()=>{if(gt(),E==null||E(),E=void 0,d){try{d.pause()}catch{}try{d.srcObject=null}catch{}d=void 0}if(l){try{l.getTracks().forEach(c=>c.stop())}catch{}l=void 0}},Pe=()=>{if(g||!d||!h||!m)return;const c=typeof window<"u"?window.__xr_debugger_metrics:void 0;if(c!=null&&c.trackCameraFrame&&c.trackCameraFrame(),ge(n.getSnapshot().sourceKind))cr(d,h);else{const k=h.getContext("2d");if(!k)return;const L=d.videoWidth,N=d.videoHeight;h.width!==L&&(h.width=L),h.height!==N&&(h.height=N),k.setTransform(1,0,0,1,0,0),k.clearRect(0,0,L,N),k.drawImage(d,0,0,L,N)}lr(h,m,(r==null?void 0:r.cameraZoom)??1.2);const x=n.getSnapshot();(x.sourceWidth!==d.videoWidth||x.sourceHeight!==d.videoHeight)&&n.set({sourceWidth:d.videoWidth,sourceHeight:d.videoHeight}),A+=1,A%10===0&&n.set({feedFrames:A});const C=n.getSnapshot().cameraTexture;C&&(C.needsUpdate=!0)},De=()=>{if(!d||!h||!m)return;if(O){Pe();return}const c=()=>{y=requestAnimationFrame(c),Pe()};y=requestAnimationFrame(c)},zs=async(c,f)=>{if(c.source===F.WEBCAM)try{const x=r!=null&&r.camRes&&r.camRes>0?r.camRes:960;n.set({cameraPermission:"requesting",cameraPermissionReason:null});const C=c.deviceId?{deviceId:{exact:c.deviceId}}:{facingMode:{ideal:c.facingMode??"user"}},k={frameRate:{min:24,ideal:30,max:60},width:{ideal:x},...C};let L;try{L=await navigator.mediaDevices.getUserMedia({video:k})}catch(N){if(!(N instanceof DOMException&&N.name==="OverconstrainedError"))throw N;L=await navigator.mediaDevices.getUserMedia({video:{frameRate:{ideal:30},width:{ideal:x},...C}})}return f===_&&n.set({cameraPermission:"granted",cameraPermissionReason:null}),L}catch(x){const C=it(x),k=Ft[C],L=await rt(),N=at(C,L.state);throw f===_&&n.set({error:{error:"PermissionError",message:k,reason:C},cameraPermission:N.state,cameraPermissionReason:N.reason}),new U(x instanceof Error?x.message:"getUserMedia failed")}return c.stream},pt=c=>{const{lifecycle:f}=n.getSnapshot();f==="idle"||f==="stopped"||g||(ae(),G.suspendAll(),_+=1,a=void 0,n.set({lifecycle:"stopped",ready:!1,error:{error:"PermissionError",message:Ft[c],reason:c},cameraPermission:c==="permission-denied"?"blocked":"unavailable",cameraPermissionReason:nt(c)}),t.log("XR session stopped: camera lost.",c))},Ws=c=>{var C;E==null||E();const f=((C=c.getVideoTracks)==null?void 0:C.call(c))??[],x=()=>{l===c&&pt("camera-lost")};f.forEach(k=>{var L;return(L=k.addEventListener)==null?void 0:L.call(k,"ended",x)}),E=()=>{f.forEach(k=>{var L;return(L=k.removeEventListener)==null?void 0:L.call(k,"ended",x)})}},qs=async()=>{if(B||typeof navigator>"u")return;const c=navigator.permissions;if(c!=null&&c.query)try{const f=await c.query({name:"camera"});if(p)return;B=f,Y=()=>{f.state==="denied"&&(a==null?void 0:a.source)===F.WEBCAM&&pt("permission-denied")},f.addEventListener("change",Y)}catch{}},Vs=()=>{var c;B&&Y&&((c=B.removeEventListener)==null||c.call(B,"change",Y)),B=void 0,Y=void 0},Le=async c=>{var Et,Te,Rt;const f=_,x=await zs(c,f);if(f!==_)throw x.getTracks().forEach(de=>de.stop()),new U("Media source superseded by a newer bind");l=x,Ws(x);const C=await ar(x);if(f!==_||p)throw x.getTracks().forEach(de=>de.stop()),new U("Media source superseded by a newer bind");d=C,h=new OffscreenCanvas(C.videoWidth,C.videoHeight);const{renderWidth:k,renderHeight:L}=n.getSnapshot(),N=mr({renderWidth:k,renderHeight:L,videoWidth:C.videoWidth,videoHeight:C.videoHeight});m?(m.width!==N.width||m.height!==N.height)&&(m.width=N.width,m.height=N.height,Me(m)):(m=new OffscreenCanvas(N.width,N.height),Me(m));const bt=c.source===F.STREAM?c.static===!0:!1;O=bt;const le=(Rt=(Te=(Et=x.getVideoTracks)==null?void 0:Et.call(x)[0])==null?void 0:Te.getSettings)==null?void 0:Rt.call(Te),He=le==null?void 0:le.facingMode,gn=He==="user"||He==="environment"?He:null;if(c.source===F.WEBCAM){const de=gn??c.facingMode??"user",At=Bt(de,c.mirrored);a={source:F.WEBCAM,sourceKind:At?"webcam":"rear-camera",facingMode:de,deviceId:c.deviceId,mirrored:At}}else a={source:F.STREAM,stream:c.stream,static:bt,sourceKind:c.sourceKind??"webcam"};n.set({source:c.source,sourceKind:a.sourceKind,cameraFacing:a.source===F.WEBCAM?a.facingMode:null,cameraDeviceId:a.source===F.WEBCAM?(le==null?void 0:le.deviceId)??a.deviceId??null:null,sourceWidth:C.videoWidth,sourceHeight:C.videoHeight,error:void 0}),c.source===F.WEBCAM&&qs()},Oe=async c=>{const f=c.sourceKind??"webcam";m=c.canvas;const x=Me(m);n.set({cameraTexture:x,source:F.CANVAS,sourceKind:f,cameraFacing:null,cameraDeviceId:null,renderWidth:m.width,renderHeight:m.height,error:void 0}),a={source:F.CANVAS,canvas:c.canvas,sourceKind:f}},Xs=(c,f)=>{if(!f||c.source!==f.source)return!1;if(c.source===F.STREAM&&f.source===F.STREAM)return c.stream===f.stream&&(c.sourceKind??"webcam")===f.sourceKind;if(c.source===F.WEBCAM&&f.source===F.WEBCAM){const x=c.facingMode??"user";return x===f.facingMode&&c.deviceId===f.deviceId&&Bt(x,c.mirrored)===f.mirrored}return!1},yt=async()=>{if(!m)return;const c=_,f=n.getSnapshot().pipeline;for(const[,x]of f.entries())x.resume();await new Promise(x=>requestAnimationFrame(()=>x())),await new Promise(x=>requestAnimationFrame(()=>x())),O&&_===c&&G.suspendAll()},Ks=(c,f)=>!f||f.source!==F.CANVAS?!1:c.canvas===f.canvas&&(c.sourceKind??"webcam")===f.sourceKind,Ne=async c=>{const f=c.source;if(f!==F.WEBCAM&&f!==F.STREAM)throw new U(`Invalid media source: ${String(f)}`);if(p)throw new U("session.setMediaSource() called after the provider unmounted");if(Xs(c,a)){t.log("Media source unchanged, skipping rebind.");return}_+=1;const{lifecycle:x}=n.getSnapshot();if(x==="idle"||x==="stopped"){await Le(c),n.set({lifecycle:"media-bound"}),t.log("Media source set to:",c.source);return}if(x==="media-bound"){ae(),await Le(c),t.log("Media source rebound to:",c.source);return}const C=x==="paused";g=!0,await new Promise(k=>requestAnimationFrame(()=>k())),ae();try{await Le(c)}finally{g=!1}if(C){d==null||d.pause(),t.log("Media source swapped (paused) to:",c.source);return}De(),O?await yt():G.resumeActive(),t.log("Media source swapped to:",c.source)},Gs=async c=>{if(p)throw new U("session.setFrameSource() called after the provider unmounted");if(Ks(c,a)){t.log("Frame source unchanged, skipping rebind.");return}_+=1;const{lifecycle:f}=n.getSnapshot();if(f==="idle"||f==="stopped"){await Oe(c),n.set({lifecycle:"media-bound"}),t.log("Frame source set to canvas.");return}if(f==="media-bound"){ae(),await Oe(c),t.log("Frame source rebound to canvas.");return}g=!0,await new Promise(x=>requestAnimationFrame(()=>x())),ae();try{await Oe(c)}finally{g=!1}t.log("Frame source swapped to canvas.")},wt=async()=>{if(p)throw new U("session.start() called after the provider unmounted");const{lifecycle:c}=n.getSnapshot();if(c==="running")return;if(c==="paused"){await Ue();return}if(c==="idle")throw new U("session.start() called before setMediaSource — call setMediaSource first");if(!m)throw new U("session.start(): media source not bound");const f=(a==null?void 0:a.source)===F.CANVAS;if(!f&&(!d||!h))throw c==="stopped"?new U("session.start() called from stopped state without a media source — call setMediaSource first"):new U("session.start(): media source not bound");f||De(),G.resumeActive(),n.set({lifecycle:"running"}),await new Promise(C=>requestAnimationFrame(()=>C()));const x=n.getSnapshot().pipeline;for(const[C,k]of x.entries())await Fe(C,k);n.set({ready:!0}),t.log("XR session started.")},vt=()=>{if(n.getSnapshot().lifecycle==="running"){gt(),G.suspendAll();try{d==null||d.pause()}catch{}n.set({lifecycle:"paused"}),t.log("XR session paused.")}},Ue=async()=>{if(p)throw new U("session.resume() called after the provider unmounted");n.getSnapshot().lifecycle==="paused"&&(v=!1,d&&d.play().catch(()=>{}),(a==null?void 0:a.source)!==F.CANVAS&&De(),n.set({lifecycle:"running"}),O?await yt():G.resumeActive(),t.log("XR session resumed."))},Ys=async(c={})=>{await Ne({source:F.WEBCAM,...c});const{lifecycle:f}=n.getSnapshot();return(f==="media-bound"||f==="stopped")&&await wt(),n.getSnapshot().cameraFacing??c.facingMode??"user"},St=async()=>{const{lifecycle:c}=n.getSnapshot();c==="stopped"||c==="idle"||(v=!1,ae(),G.suspendAll(),a=void 0,n.set({lifecycle:"stopped",ready:!1}),t.log("XR session stopped."))},xt=async()=>{await St(),G.releaseAll(),Q.clear();const c=n.getSnapshot().cameraTexture;c&&c.dispose(),j=new WeakSet,a=void 0,_+=1,m=void 0,h=void 0,M=void 0,O=!1,Vs(),n.set({lifecycle:"idle",cameraTexture:void 0,source:void 0,sourceKind:void 0,cameraFacing:null,cameraDeviceId:null,error:void 0,modelErrors:new Map,cameraPermission:"unknown",cameraPermissionReason:null}),t.log("XR session reset.")},js=async()=>{p||(p=!0,ce==null||ce(),ce=void 0,oe==null||oe(),oe=void 0,await xt(),t.log("XR session disposed."))},Qs=()=>{p&&(p=!1,kt(),Ct(),t.log("XR session re-armed."))},Js=()=>p,Zs=async c=>{const f="legacy:registerXRPipeline",x=[];await Promise.all(c.map(async C=>{const{model:k}=C;if(!Ut[k])throw new U(`Invalid model: ${k}`);Q.has(k)||x.push(k);const L="options"in C?C.options:void 0;await G.acquire(k,f,L)})),x.length>0&&(x.forEach(C=>Q.add(C)),t.log("XR pipeline registered."))},$s=c=>{const f=G.get(c);if(!f)throw new U(`Model ${c} is not registered in the pipeline`);return f.getModelNode()},Mt=async(c,f)=>{c<=0||f<=0||(n.set({renderWidth:c,renderHeight:f}),m&&(m.width!==c||m.height!==f)&&(m.width=c,m.height=f,Me(m),O&&Pe()),t.log(`Source canvas set. Render size: ${c}x${f}`))},en=async c=>{var k;w=c;const f=(k=c.getBoundingClientRect)==null?void 0:k.call(c),x=f&&f.width>0?Math.round(f.width):c.clientWidth,C=f&&f.height>0?Math.round(f.height):c.clientHeight;await Mt(x,C)},tn=c=>{M=c},Be=()=>w&&S&&T&&b?w:M,sn=c=>{S=c.renderer,T=c.scene,b=c.camera,R=c.renderFrame},Tt=()=>{if(!S||!T||!b)throw new U("XR frame render requested before the R3F state was bound — make sure <XRScene> is mounted");R?R():S.render(T,b)},nn=()=>{const c=w;if(c&&Be()===c)return Tt(),c.toDataURL("image/png");const f=Be();if(f)return f.toDataURL("image/png");throw new U("session.captureFrame() called before an XRScene or XRMediaSurface capture target was bound")},rn=(c=30)=>{const f=Be();if(!(f!=null&&f.captureStream))throw new U("session.captureStream() called before an XRScene or XRMediaSurface capture target was bound");return f.captureStream(c)},an=()=>d,on=()=>m??null,cn=c=>{if(r=c,n.set({cameraZoom:(c==null?void 0:c.cameraZoom)??1.2}),n.getSnapshot().lifecycle!=="running"||!m)return;const f=n.getSnapshot().pipeline;for(const[x,C]of f.entries())C.run({sourceCanvas:m,renderWidth:n.getSnapshot().renderWidth,renderHeight:n.getSnapshot().renderHeight,getSource:()=>n.getSnapshot().sourceKind,targetFps:o(x),analysisScale:r==null?void 0:r.analysisScale})},ln=()=>r,dn=async()=>{if(!a||a.source!==F.WEBCAM)return;const{facingMode:c,deviceId:f,mirrored:x}=a;a=void 0,await Ne({source:F.WEBCAM,facingMode:c,deviceId:f,mirrored:x})},hn=c=>{n.set({quality:c})},un=c=>{n.set({qualityConfig:c})},mn=c=>{i=c},fn=()=>{var k;if(typeof window>"u")return{type:"portrait",angle:0};const c=(k=window.screen)==null?void 0:k.orientation,f=(c==null?void 0:c.angle)??0,x=f===90||f===180||f===270?f:0;return{type:c!=null&&c.type?c.type.startsWith("landscape")?"landscape":"portrait":window.innerWidth>window.innerHeight?"landscape":"portrait",angle:x}},pe=()=>{const c=fn(),f=n.getSnapshot().orientation,x=f.type!==c.type||f.angle!==c.angle?{orientation:c}:{};d&&d.videoWidth>0&&(x.sourceWidth=d.videoWidth,x.sourceHeight=d.videoHeight),Object.keys(x).length&&n.set(x)};let oe;const Ct=()=>{var f,x,C;if(oe||typeof window>"u")return;const c=(f=window.screen)==null?void 0:f.orientation;(x=c==null?void 0:c.addEventListener)==null||x.call(c,"change",pe),(C=window.addEventListener)==null||C.call(window,"resize",pe),oe=()=>{var k,L;(k=c==null?void 0:c.removeEventListener)==null||k.call(c,"change",pe),(L=window.removeEventListener)==null||L.call(window,"resize",pe)},pe()};let ce;const kt=()=>{if(ce||typeof document>"u"||typeof document.addEventListener!="function")return;const c=()=>{if(!p){if(document.hidden){i!=null&&i.pauseWhenHidden&&n.getSnapshot().lifecycle==="running"&&(vt(),v=!0);return}if(v&&n.getSnapshot().lifecycle==="paused"){Ue();return}n.getSnapshot().lifecycle==="running"&&(d!=null&&d.paused)&&d.play().catch(()=>{})}};document.addEventListener("visibilitychange",c),ce=()=>document.removeEventListener("visibilitychange",c)};return kt(),Ct(),{store:n,registry:G,setMediaSource:Ne,start:wt,stop:St,reset:xt,pause:vt,resume:Ue,switchCamera:Ys,dispose:js,rearm:Qs,isDisposed:Js,setFrameSource:Gs,registerXRPipeline:Zs,getModelNode:$s,captureFrame:nn,captureStream:rn,getInputFrame:on,_setRenderTarget:en,_setCaptureTarget:tn,_setRenderSize:Mt,_setR3FState:sn,_renderFrame:Tt,_getVideoElement:an,_setPerf:cn,_setLifecycle:mn,_rebindMedia:dn,_setQuality:hn,_setQualityConfig:un,_getPerf:ln}},gr=(e,s)=>{const t=P.useRef(e),n=P.useRef(s),i=P.useMemo(()=>fr(t.current,n.current),[]),r=JSON.stringify(s??{});P.useEffect(()=>{i._setLifecycle(s)},[i,r]),P.useEffect(()=>(i.rearm(),()=>void i.dispose()),[i]);const o=JSON.stringify(e??{});return P.useEffect(()=>{i._setPerf(e)},[i,o]),i},Qe=new Map,pr=()=>({register:(e,s)=>{s?Qe.set(e,s):Qe.delete(e)},resolve:e=>e?Qe.get(e)??null:null}),Es=pr(),Rs=P.createContext(null),yr=({children:e})=>{const s=P.useRef(new Map),t=P.useCallback((r,o)=>{o?s.current.set(r,o):s.current.delete(r)},[]),n=P.useCallback(r=>r?s.current.get(r)??null:null,[]),i=P.useMemo(()=>({register:t,resolve:n}),[t,n]);return P.createElement(Rs.Provider,{value:i},e)},As=()=>P.useContext(Rs)??Es,wr=()=>As().register,vr=()=>As().resolve;Es.register;const Is={[I.FACE_TRACKER]:"face",[I.HAND_TRACKER]:"hand",[I.GESTURE_TRACKER]:"gesture",[I.BODY_TRACKER]:"body",[I.HOLISTIC_TRACKER]:"holistic",[I.BACKGROUND_SEGMENTATION]:"segmentation",[I.SEMANTIC_SEGMENTATION]:"semantic-seg"},Ht=Object.values(I),Sr=(e,s)=>{var n;const t=(n=e.registry.getOptions(s))==null?void 0:n.targetFps;return typeof t=="number"?t:null},Ae=(e,s,t,n=performance.now())=>{const i=e.store.getSnapshot(),r=t?n-t.sampledAt:0,o=t&&r>0?Math.max(0,(i.feedFrames-t.feedFrames)*1e3/r):0,a=i.lifecycle==="running",d=s.map(h=>{var b;const m=e.registry.getState(h),w=e.store.getSnapshot().pipeline.get(h),M=((b=i.modelErrors.get(h))==null?void 0:b.error)??null,S=(w==null?void 0:w.getDiagnostics())??{inferenceMs:null,inferenceFps:0,inferences:0,skippedFrames:0,detections:null,confidence:null,status:M?"error":"ready",error:M,paused:!1,disposed:!1};let T;return m==="error"||S.status==="error"?T="error":m==="idle"?T="unavailable":m==="initializing"?T="loading":S.paused||!a?T="paused":T="ready",{...S,error:S.error??M,model:h,label:Is[h]??h,state:T,targetFps:Sr(e,h),owners:e.registry.getOwners(h)}}),l=i.quality;return{quality:l?{tier:l.decision.tier.name,index:l.index,locked:l.locked,reason:l.decision.reason}:null,session:{lifecycle:i.lifecycle,ready:i.ready,error:i.error,source:i.source,sourceKind:i.sourceKind,sourceWidth:i.sourceWidth,sourceHeight:i.sourceHeight,renderWidth:i.renderWidth,renderHeight:i.renderHeight,feedFps:o,feedFrames:i.feedFrames},models:d,inferenceMsTotal:d.reduce((h,m)=>h+(m.state==="ready"?m.inferenceMs??0:0),0),sampledAt:n}},xr=(e={})=>{const{intervalMs:s=250,enabled:t=!0}=e,{session:n}=ft(),i=(e.models??Ht).join("|"),r=P.useMemo(()=>e.models&&e.models.length?e.models:Ht,[i]),o=P.useRef(null),[a,d]=P.useState(()=>Ae(n,r,null));return P.useEffect(()=>{if(!t)return;const l=()=>{const m=Ae(n,r,o.current);o.current={feedFrames:m.session.feedFrames,sampledAt:m.sampledAt},d(m)};l();const h=window.setInterval(l,Math.max(50,s));return()=>window.clearInterval(h)},[n,r,s,t]),a},_s=[{name:"high",targetFps:30,renderScale:1,analysisScale:1,camRes:960},{name:"medium",targetFps:24,renderScale:.8,analysisScale:.85,camRes:720},{name:"low",targetFps:15,renderScale:.6,analysisScale:.7,camRes:640}],$={maxFrameMs:1e3/24,maxInferenceMs:24,maxMemoryMb:null,sampleMs:1e3,downgradeAfter:2,upgradeAfter:6,upgradeHeadroom:.75,cooldownMs:4e3},ht={frameMs:null,fps:null,inferenceMs:null,feedFps:null,memoryMb:null,deviceMemoryGb:null,hardwareConcurrency:null,thermal:"unknown"},xe=(e,s,t)=>Math.min(t,Math.max(s,e)),H=(e,s)=>typeof e=="number"&&Number.isFinite(e)?e:s,Fs=(e,s)=>({name:typeof e.name=="string"&&e.name?e.name:`tier-${s}`,...H(e.targetFps,NaN)>0?{targetFps:H(e.targetFps,0)}:{},...H(e.renderScale,NaN)>0?{renderScale:xe(H(e.renderScale,1),.25,1)}:{},...H(e.analysisScale,NaN)>0?{analysisScale:xe(H(e.analysisScale,1),.25,1)}:{},...H(e.camRes,NaN)>0?{camRes:Math.round(H(e.camRes,0))}:{},...e.rebindCamera?{rebindCamera:!0}:{}}),Ps=(e={})=>({maxFrameMs:Math.max(1,H(e.maxFrameMs,$.maxFrameMs)),maxInferenceMs:Math.max(0,H(e.maxInferenceMs,$.maxInferenceMs)),maxMemoryMb:e.maxMemoryMb===null||e.maxMemoryMb===void 0?null:Math.max(1,H(e.maxMemoryMb,0))||null,sampleMs:Math.max(100,H(e.sampleMs,$.sampleMs)),downgradeAfter:Math.max(1,Math.round(H(e.downgradeAfter,$.downgradeAfter))),upgradeAfter:Math.max(1,Math.round(H(e.upgradeAfter,$.upgradeAfter))),upgradeHeadroom:xe(H(e.upgradeHeadroom,$.upgradeHeadroom),.1,1),cooldownMs:Math.max(0,H(e.cooldownMs,$.cooldownMs))}),te=(e,s,t)=>{if(typeof s=="number"&&Number.isInteger(s)&&s>=0&&s<e.length)return s;if(typeof s=="string"){const n=e.findIndex(i=>i.name===s);if(n>=0)return n}return t},Ds=(e={})=>{const s=e.tiers&&e.tiers.length?e.tiers.map((i,r)=>Fs(i,r)):_s,t=te(s,e.maxTier,0),n=Math.max(t,te(s,e.minTier,s.length-1));return{tiers:s,budget:Ps(e.budget),...e.initialTier!==void 0?{initialTier:e.initialTier}:{},minTier:n,maxTier:t,adaptive:e.adaptive!==!1,historySize:Math.max(1,Math.round(H(e.historySize,20)))}},Ls=(e,s)=>{const t=te(e.tiers,e.maxTier,0),n=te(e.tiers,e.minTier,e.tiers.length-1);if(e.initialTier!==void 0)return xe(te(e.tiers,e.initialTier,t),t,n);const i=s.deviceMemoryGb!==null&&s.deviceMemoryGb<=4||s.hardwareConcurrency!==null&&s.hardwareConcurrency<=4;return xe(i?t+1:t,t,n)},ut=(e,s=ht,t=0)=>{const n=Ls(e,s),i={index:n,tier:e.tiers[n],reason:"init",at:t};return{index:n,locked:!1,badStreak:0,goodStreak:0,lastChangeAt:t,decision:i,history:[i],signals:s}},Ie=(e,s,t,n,i,r=e.signals)=>{const o={index:t,tier:s.tiers[t],reason:n,at:i};return{...e,index:t,badStreak:0,goodStreak:0,lastChangeAt:i,decision:o,history:[o,...e.history].slice(0,s.historySize),signals:r}},Os=(e,s)=>e.thermal==="critical"?"thermal":s.maxMemoryMb!==null&&e.memoryMb!==null&&e.memoryMb>s.maxMemoryMb?"memory":e.inferenceMs!==null&&e.inferenceMs>s.maxInferenceMs?"inference":e.frameMs!==null&&e.frameMs>s.maxFrameMs?"frame-time":null,Ns=(e,s,t,n)=>{const{budget:i}=t,r=te(t.tiers,t.maxTier,0),o=te(t.tiers,t.minTier,t.tiers.length-1);if(e.locked||!t.adaptive)return{...e,signals:s};const a=Os(s,i),d=a===null&&s.frameMs!==null&&s.frameMs<=i.maxFrameMs*i.upgradeHeadroom&&(s.inferenceMs===null||s.inferenceMs<=i.maxInferenceMs*i.upgradeHeadroom),l=a?e.badStreak+1:0,h=d?e.goodStreak+1:0,m=n-e.lastChangeAt>=i.cooldownMs;if(a&&l>=i.downgradeAfter&&m){if(e.index<o)return Ie(e,t,e.index+1,a,n,s);const w=a==="frame-time"?"suspected":s.thermal;return{...e,badStreak:l,goodStreak:h,signals:{...s,thermal:w}}}return d&&h>=i.upgradeAfter&&m&&e.index>r?Ie(e,t,e.index-1,"recovered",n,s):{...e,badStreak:l,goodStreak:h,signals:s}},Mr=(e,s,t,n)=>{const i=te(s.tiers,t,e.index);return i===e.index?e:Ie(e,s,i,"manual",n)},Tr=(e,s,t,n)=>t===e.locked?e:{...Ie(e,s,e.index,t?"locked":"manual",n),locked:t},Us=(e,s)=>e.decision.tier===s?null:e.decision.tier,Cr=(e,s,t)=>{const n=ut(e,s,t);return{...n,decision:{...n.decision,reason:"reset"},history:[{...n.decision,reason:"reset"}]}},kr=Object.values(I),Bs=()=>{if(typeof navigator>"u")return{deviceMemoryGb:null,hardwareConcurrency:null};const e=navigator;return{deviceMemoryGb:typeof e.deviceMemory=="number"?e.deviceMemory:null,hardwareConcurrency:typeof e.hardwareConcurrency=="number"?e.hardwareConcurrency:null}},br=()=>{const e=performance.memory;return e?e.usedJSHeapSize/1048576:null},Hs=({config:e,thermal:s,onDecision:t})=>{const{session:n}=ft(),i=JSON.stringify(e??{}),r=P.useMemo(()=>Ds(e),[i]),o=P.useRef(s??"unknown");o.current=s??"unknown";const a=P.useRef(t);return a.current=t,P.useEffect(()=>{const d=Bs();let l=ut(r,{...ht,...d},performance.now());const h=n.store.getSnapshot().quality;h&&h.index<r.tiers.length&&(l={...h,decision:{...h.decision,tier:r.tiers[h.index]}}),n._setQualityConfig(r),n._setQuality(l);let m=n._getPerf(),w=null;const M=async(p,v)=>{const A={...m,...p.targetFps!==void 0?{targetFps:p.targetFps}:{},...p.analysisScale!==void 0?{analysisScale:p.analysisScale}:{},...p.camRes!==void 0&&p.rebindCamera?{camRes:p.camRes}:{}};n._setPerf(A),p.rebindCamera&&p.camRes!==void 0&&p.camRes!==(v==null?void 0:v.camRes)&&await n._rebindMedia().catch(()=>{})};w=l.decision.tier,M(l.decision.tier,null);let S=0,T=performance.now(),b=0;const R=()=>{S+=1,b=requestAnimationFrame(R)};b=requestAnimationFrame(R);let y=null;const g=window.setInterval(()=>{var j;if(typeof document<"u"&&document.hidden){S=0,T=performance.now();return}const p=performance.now(),v=p-T,A=Ae(n,kr,y,p);y={feedFrames:A.session.feedFrames,sampledAt:p};const E=n.store.getSnapshot().lifecycle==="running",B={frameMs:S>0&&v>0&&E?v/S:null,fps:S>0&&v>0?S*1e3/v:null,inferenceMs:E?A.inferenceMsTotal:null,feedFps:A.session.feedFps,memoryMb:br(),...d,thermal:o.current};S=0,T=p;const Y=n.store.getSnapshot().quality??l,O=Ns(Y,B,r,p);l=O,n._setQuality(O);const _=Us(O,w);if(_){const Q=w;w=_,M(_,Q),(j=a.current)==null||j.call(a,O)}},r.budget.sampleMs);return()=>{cancelAnimationFrame(b),window.clearInterval(g);const p=(w==null?void 0:w.rebindCamera)&&w.camRes!==void 0;n._setPerf(m),p&&(m==null?void 0:m.camRes)!==(w==null?void 0:w.camRes)&&n._rebindMedia().catch(()=>{}),m=void 0,n._setQualityConfig(null)}},[n,r]),null},mt=P.createContext(void 0),ft=()=>{const e=P.useContext(mt);if(!e)throw new U("XR context can only be used inside XRProvider, did you forget to wrap your app in <XRProvider>?");return e},Er=()=>P.useContext(mt)??null,Rr=({children:e,perf:s,lifecycle:t,quality:n})=>{const i=gr(s,t),r=P.useMemo(()=>({session:i}),[i]);return ze.jsxs(mt.Provider,{value:r,children:[n!==!1&&ze.jsx(Hs,{config:n||void 0}),ze.jsx(yr,{children:e})]})};exports.BODY_IDENTITY_DEFAULTS=es;exports.BODY_JOINT_INDEX=me;exports.BODY_JOINT_NAMES=ot;exports.BODY_JOINT_OTHER_SIDE=Jt;exports.BodyIdentity=ts;exports.CAMERA_PERMISSION_MESSAGES=Nn;exports.DEFAULT_HOLISTIC_ANALYSIS_MAX_DIMENSION=Xt;exports.DEFAULT_HOLISTIC_HOLD_MS=qt;exports.DEFAULT_HOLISTIC_MODEL_URL=et;exports.DEFAULT_HOLISTIC_PREDICT_MS=Vt;exports.DEFAULT_PERFORMANCE_BUDGET=$;exports.DEFAULT_PIXEL_SNAP_INCREMENT=ss;exports.DEFAULT_QUALITY_TIERS=_s;exports.DEFAULT_REFERENCE_PIXELS_PER_UNIT=Z;exports.DEFAULT_SCREEN_TRANSFORM_2D=ve;exports.DEFAULT_SCREEN_TRANSFORM_ROOT=K;exports.DEFAULT_SUBJECT_POLICY=as;exports.EMPTY_QUALITY_SIGNALS=ht;exports.EMPTY_SUBJECT_MEMORY=os;exports.FACE_TRACKING_MODEL_PATH=gs;exports.FaceTrackMemory=zt;exports.HAND_JOINT_INDEX=Xi;exports.HAND_JOINT_NAMES=Ss;exports.HAND_POSE_DEFAULT_HOLD_MS=xs;exports.SEMANTIC_SEGMENTATION_PRESET_SPECS=$e;exports.VISION_WASM_PATH=ps;exports.XRMediaSource=F;exports.XRModel=I;exports.XRProvider=Rr;exports.XRQualityController=Hs;exports.XR_FALLBACK_MESSAGES=tt;exports.XR_MAX_SUBJECTS=Ze;exports.XR_MODEL_ASSET_URLS=Kt;exports.XR_MODEL_LABELS=Is;exports.acquireVerifiedBytes=ms;exports.anatomicalBodyPose=$t;exports.anatomicalHandedness=Ts;exports.assignHandPoses=Ms;exports.associateSubjects=wi;exports.bodyCandidates=yi;exports.bodyWorldLandmarkToJoint=Zt;exports.canPromptForCamera=On;exports.classifyCameraFailure=at;exports.clearSemanticMask=$i;exports.clientToScreenPixels=ni;exports.computeFeedCrop=jt;exports.computeFitLayout=Yt;exports.createFallbackReason=D;exports.createQualityState=ut;exports.createSemanticMask=ks;exports.defaultCameraEnvironment=_e;exports.detectXRCapabilities=_n;exports.faceCandidates=pi;exports.feedSidedName=qi;exports.feedToScreenPixels=mi;exports.feedToSource=Qt;exports.feedToTracker=di;exports.feedToViewport=hi;exports.feedToWorld=ds;exports.fetchAndVerify=hs;exports.fillLandmarkPolygon=tr;exports.fillPolygon=bs;exports.handWorldLandmarkToJoint=Cs;exports.isFeedPointInSource=Bn;exports.isMirroredSourceKind=ge;exports.isSdkOwnedUrl=us;exports.jointCandidates=cs;exports.judgeSample=Os;exports.libConfig=W;exports.lockQuality=Tr;exports.mapDomExceptionToReason=it;exports.mapModelErrorToReason=Pn;exports.mediaToScreenPixels=ai;exports.mergeScreenTransform2D=Jn;exports.mirrorFeedX=Hn;exports.modelNodeSource=Ai;exports.normalizedToScreenPixels=dt;exports.normalizedTrackerPointToTrackerPoint=ne;exports.orientSourcePoint=zn;exports.orientedSize=Wn;exports.otherSide=ys;exports.permissionStateToStatus=Gt;exports.personLeftSign=Vi;exports.personSide=ws;exports.queryCameraPermission=rt;exports.readDeviceSignals=Bs;exports.requestCameraAccess=Dn;exports.resetQuality=Cr;exports.resolveHolisticRuntimeOptions=Re;exports.resolveInitialTierIndex=Ls;exports.resolveModelAssetUrl=st;exports.resolveNumBodies=Je;exports.resolvePerformanceBudget=Ps;exports.resolveQualityConfig=Ds;exports.resolveQualityTier=Fs;exports.resolveScreenTransform2D=Qn;exports.resolveTrackerSupport=Fn;exports.sampleXRDiagnostics=Ae;exports.screenPixelsToClient=ii;exports.screenPixelsToFeed=fi;exports.screenPixelsToMedia=oi;exports.screenPixelsToNormalized=is;exports.screenPixelsToScreenSpace=ti;exports.screenPixelsToUnits=$n;exports.screenPointToRay=li;exports.screenSpaceToScreenPixels=si;exports.screenUnitsToPixels=ei;exports.selectSubject=gi;exports.semanticMaskLabelIndex=er;exports.sessionReasonToFallback=nt;exports.setQualityTier=Mr;exports.sourceToFeed=Un;exports.stepQualityController=Ns;exports.subscribeCameraPermission=Ln;exports.swapSidedName=vs;exports.tierToApply=Us;exports.trackerPointToNormalizedTrackerPoint=Wt;exports.trackerPointToScreenPixels=ri;exports.trackerToFeed=rs;exports.trackerToWorld=vi;exports.unprojectToZZeroInto=Ee;exports.useOptionalXRContext=Er;exports.useRegisterRuntimeObject=wr;exports.useResolveRuntimeObject=vr;exports.useXRContext=ft;exports.useXRDiagnostics=xr;exports.viewportToFeed=ui;exports.warmVisionWasm=se;exports.worldToFeed=Si;exports.worldToScreenPixels=ci;exports.worldToTracker=xi;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { jsx as F } from "react/jsx-runtime";
|
|
2
|
+
import { useFrame as H } from "@react-three/fiber";
|
|
3
|
+
import { useRef as T, useEffect as M } from "react";
|
|
4
|
+
import * as b from "three";
|
|
5
|
+
import { R as S } from "./uv-DJU_XfmN.js";
|
|
6
|
+
import { u as D } from "./index-vr2ichWQ.js";
|
|
7
|
+
const x = (e, c) => e < c ? e * 65536 + c : c * 65536 + e, A = (e, c) => [
|
|
8
|
+
e[c * 3],
|
|
9
|
+
e[c * 3 + 1],
|
|
10
|
+
e[c * 3 + 2]
|
|
11
|
+
], N = (e, c, d) => {
|
|
12
|
+
const l = Math.floor(e.length / 3), a = /* @__PURE__ */ new Map(), r = new Set(d), n = (f) => {
|
|
13
|
+
const [p, g, R] = A(e, f);
|
|
14
|
+
return [x(p, g), x(g, R), x(R, p)];
|
|
15
|
+
}, u = (f) => A(e, f).every((p) => r.has(p)), o = (f) => f.map((p, g) => x(p, f[(g + 1) % f.length])), i = o(d), t = /* @__PURE__ */ new Set([...o(c), ...i]);
|
|
16
|
+
for (let f = 0; f < l; f += 1)
|
|
17
|
+
n(f).forEach((p) => {
|
|
18
|
+
const g = a.get(p);
|
|
19
|
+
g ? g.push(f) : a.set(p, [f]);
|
|
20
|
+
});
|
|
21
|
+
let s = -1;
|
|
22
|
+
for (const f of i) {
|
|
23
|
+
const p = (a.get(f) ?? []).find((g) => !u(g));
|
|
24
|
+
if (p !== void 0) {
|
|
25
|
+
s = p;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (s < 0) return [];
|
|
30
|
+
const h = /* @__PURE__ */ new Set([s]), y = [s], E = /* @__PURE__ */ new Map();
|
|
31
|
+
for (; y.length > 0; ) {
|
|
32
|
+
const f = y.pop();
|
|
33
|
+
n(f).forEach((p) => {
|
|
34
|
+
E.set(p, (E.get(p) ?? 0) + 1), !t.has(p) && (a.get(p) ?? []).forEach((g) => {
|
|
35
|
+
h.has(g) || (h.add(g), y.push(g));
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const w = [...E].filter(([, f]) => f === 1).map(([f]) => f);
|
|
40
|
+
return w.length === t.size && w.every((f) => t.has(f)) ? [...h].sort((f, p) => f - p) : [];
|
|
41
|
+
}, K = (e, c, d, l) => {
|
|
42
|
+
const a = new Float32Array(c).fill(1), r = /* @__PURE__ */ new Map(), n = (t, s) => {
|
|
43
|
+
r.has(t) || r.set(t, /* @__PURE__ */ new Set()), r.get(t).add(s);
|
|
44
|
+
};
|
|
45
|
+
for (let t = 0; t + 2 < e.length; t += 3) {
|
|
46
|
+
const s = e[t], h = e[t + 1], y = e[t + 2];
|
|
47
|
+
n(s, h), n(h, s), n(h, y), n(y, h), n(y, s), n(s, y);
|
|
48
|
+
}
|
|
49
|
+
const u = (t) => {
|
|
50
|
+
const s = /* @__PURE__ */ new Map(), h = t.filter((y) => r.has(y));
|
|
51
|
+
h.forEach((y) => s.set(y, 0));
|
|
52
|
+
for (let y = 0; y < h.length; y += 1) {
|
|
53
|
+
const E = h[y], w = s.get(E) + 1;
|
|
54
|
+
r.get(E).forEach((m) => {
|
|
55
|
+
s.has(m) || (s.set(m, w), h.push(m));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return s;
|
|
59
|
+
}, o = u(d), i = u(l);
|
|
60
|
+
return r.forEach((t, s) => {
|
|
61
|
+
const h = o.get(s) ?? 0, y = i.get(s) ?? 0;
|
|
62
|
+
a[s] = h + y === 0 ? 1 : h / (h + y);
|
|
63
|
+
}), a;
|
|
64
|
+
}, P = (e, c, d) => {
|
|
65
|
+
const l = Array.from({ length: c }, () => /* @__PURE__ */ new Set());
|
|
66
|
+
for (let n = 0; n + 2 < e.length; n += 3) {
|
|
67
|
+
const [u, o, i] = A(e, n / 3);
|
|
68
|
+
l[u].add(o).add(i), l[o].add(u).add(i), l[i].add(u).add(o);
|
|
69
|
+
}
|
|
70
|
+
const a = new Float32Array(c).fill(1 / 0), r = [...d];
|
|
71
|
+
d.forEach((n) => {
|
|
72
|
+
a[n] = 0;
|
|
73
|
+
});
|
|
74
|
+
for (let n = 0; n < r.length; n += 1) {
|
|
75
|
+
const u = r[n];
|
|
76
|
+
l[u].forEach((o) => {
|
|
77
|
+
a[o] === 1 / 0 && (a[o] = a[u] + 1, r.push(o));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return a;
|
|
81
|
+
}, G = (e, c, d, l) => {
|
|
82
|
+
const a = Array.from({ length: d }, () => /* @__PURE__ */ new Set());
|
|
83
|
+
for (let o = 0; o + 2 < c.length; o += 3) {
|
|
84
|
+
const [i, t, s] = A(c, o / 3);
|
|
85
|
+
a[i].add(t).add(s), a[t].add(i).add(s), a[s].add(i).add(t);
|
|
86
|
+
}
|
|
87
|
+
const r = (o, i) => Math.hypot(
|
|
88
|
+
e[o * 3] - e[i * 3],
|
|
89
|
+
e[o * 3 + 1] - e[i * 3 + 1],
|
|
90
|
+
e[o * 3 + 2] - e[i * 3 + 2]
|
|
91
|
+
), n = new Float64Array(d).fill(1 / 0), u = new Uint8Array(d);
|
|
92
|
+
l.forEach((o) => {
|
|
93
|
+
n[o] = 0;
|
|
94
|
+
});
|
|
95
|
+
for (let o = 0; o < d; o += 1) {
|
|
96
|
+
let i = -1;
|
|
97
|
+
for (let t = 0; t < d; t += 1)
|
|
98
|
+
!u[t] && (i < 0 || n[t] < n[i]) && (i = t);
|
|
99
|
+
if (i < 0 || n[i] === 1 / 0) break;
|
|
100
|
+
u[i] = 1, a[i].forEach((t) => {
|
|
101
|
+
const s = n[i] + r(i, t);
|
|
102
|
+
s < n[t] && (n[t] = s);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return Float32Array.from(n);
|
|
106
|
+
}, $ = (e, c, d) => {
|
|
107
|
+
const l = new Float32Array(d * 3);
|
|
108
|
+
for (let a = 0; a + 2 < c.length; a += 3) {
|
|
109
|
+
const [r, n, u] = A(c, a / 3), o = e[n * 3] - e[r * 3], i = e[n * 3 + 1] - e[r * 3 + 1], t = e[n * 3 + 2] - e[r * 3 + 2], s = e[u * 3] - e[r * 3], h = e[u * 3 + 1] - e[r * 3 + 1], y = e[u * 3 + 2] - e[r * 3 + 2], E = i * y - t * h, w = t * s - o * y, m = o * h - i * s;
|
|
110
|
+
[r, n, u].forEach((f) => {
|
|
111
|
+
l[f * 3] += E, l[f * 3 + 1] += w, l[f * 3 + 2] += m;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
for (let a = 0; a < d; a += 1) {
|
|
115
|
+
const r = Math.hypot(
|
|
116
|
+
l[a * 3],
|
|
117
|
+
l[a * 3 + 1],
|
|
118
|
+
l[a * 3 + 2]
|
|
119
|
+
);
|
|
120
|
+
r > 0 && (l[a * 3] /= r, l[a * 3 + 1] /= r, l[a * 3 + 2] /= r);
|
|
121
|
+
}
|
|
122
|
+
return l;
|
|
123
|
+
}, C = (e, c) => {
|
|
124
|
+
const d = new Uint16Array(e.length * 3);
|
|
125
|
+
for (let l = 0; l < e.length; l += 1) {
|
|
126
|
+
const a = e[l];
|
|
127
|
+
d[l * 3] = c[a * 3], d[l * 3 + 1] = c[a * 3 + 1], d[l * 3 + 2] = c[a * 3 + 2];
|
|
128
|
+
}
|
|
129
|
+
return d;
|
|
130
|
+
}, L = [
|
|
131
|
+
"face.center",
|
|
132
|
+
"face.forehead",
|
|
133
|
+
"face.noseTip",
|
|
134
|
+
"face.chin",
|
|
135
|
+
"face.leftEyeOuter",
|
|
136
|
+
"face.rightEyeOuter",
|
|
137
|
+
"face.leftCheek",
|
|
138
|
+
"face.rightCheek",
|
|
139
|
+
"face.mouthCenter",
|
|
140
|
+
"face.leftEye",
|
|
141
|
+
"face.rightEye",
|
|
142
|
+
"face.leftEarlobe",
|
|
143
|
+
"face.rightEarlobe",
|
|
144
|
+
"face.custom"
|
|
145
|
+
], U = [
|
|
146
|
+
"hand.wrist",
|
|
147
|
+
"hand.thumbTip",
|
|
148
|
+
"hand.indexTip",
|
|
149
|
+
"hand.middleTip",
|
|
150
|
+
"hand.ringTip",
|
|
151
|
+
"hand.pinkyTip",
|
|
152
|
+
"hand.indexBase",
|
|
153
|
+
"hand.middleBase",
|
|
154
|
+
"hand.ringBase",
|
|
155
|
+
"hand.pinkyBase"
|
|
156
|
+
], j = [
|
|
157
|
+
"body.head",
|
|
158
|
+
"body.neck",
|
|
159
|
+
"body.leftShoulder",
|
|
160
|
+
"body.rightShoulder",
|
|
161
|
+
"body.leftElbow",
|
|
162
|
+
"body.rightElbow",
|
|
163
|
+
"body.leftWrist",
|
|
164
|
+
"body.rightWrist",
|
|
165
|
+
"body.leftHip",
|
|
166
|
+
"body.rightHip",
|
|
167
|
+
"body.leftKnee",
|
|
168
|
+
"body.rightKnee",
|
|
169
|
+
"body.leftAnkle",
|
|
170
|
+
"body.rightAnkle"
|
|
171
|
+
], B = (e) => e.startsWith("face.") ? "face" : e.startsWith("hand.") ? "hand" : e.startsWith("body.") ? "body" : null, Y = {
|
|
172
|
+
target: "face.center",
|
|
173
|
+
customAnchorPoint: { x: 0, y: 0, z: 0 },
|
|
174
|
+
offset: { x: 0, y: 0, z: 0 },
|
|
175
|
+
smoothing: 0,
|
|
176
|
+
followFaceRoll: !1
|
|
177
|
+
}, k = (e, c, d) => c + d * (e - c), z = (e, c) => 1 / (1 + 1 / (2 * Math.PI * e) / c), O = (e, c, d, l, a, r) => {
|
|
178
|
+
if (!e.initialized || d <= 0)
|
|
179
|
+
return e.pos.copy(c), e.prevRaw.copy(c), e.dxHat.set(0, 0, 0), e.initialized = !0, e;
|
|
180
|
+
const n = z(r, d), u = ["x", "y", "z"];
|
|
181
|
+
for (const o of u) {
|
|
182
|
+
const i = (c[o] - e.prevRaw[o]) / d, t = k(i, e.dxHat[o], n);
|
|
183
|
+
e.dxHat[o] = t;
|
|
184
|
+
const s = l + a * Math.abs(t), h = z(s, d);
|
|
185
|
+
e.pos[o] = k(c[o], e.pos[o], h), e.prevRaw[o] = c[o];
|
|
186
|
+
}
|
|
187
|
+
return e;
|
|
188
|
+
}, _ = (e, c, d, l) => O(e, c, d, l * 0.1, 0.5, 1), J = ({
|
|
189
|
+
target: e,
|
|
190
|
+
customAnchorPoint: c,
|
|
191
|
+
offset: d,
|
|
192
|
+
smoothing: l = 0,
|
|
193
|
+
children: a
|
|
194
|
+
}) => {
|
|
195
|
+
const r = D(), n = T(null), u = T(!1), o = T(new b.Vector3()), i = T({
|
|
196
|
+
pos: new b.Vector3(),
|
|
197
|
+
prevRaw: new b.Vector3(),
|
|
198
|
+
dxHat: new b.Vector3(),
|
|
199
|
+
initialized: !1
|
|
200
|
+
}), t = B(e), s = r !== null && t !== null && r.type !== t, h = r === null, y = h || s || t === null;
|
|
201
|
+
return M(() => {
|
|
202
|
+
h ? console.warn(
|
|
203
|
+
`[TrackingAnchor] target "${e}" requires a FaceTracker / HandTracker / BodyTracker ancestor; rendering null.`
|
|
204
|
+
) : s ? console.warn(
|
|
205
|
+
`[TrackingAnchor] target "${e}" namespace does not match parent tracker type "${r == null ? void 0 : r.type}"; rendering null.`
|
|
206
|
+
) : t === null && console.warn(
|
|
207
|
+
`[TrackingAnchor] target "${e}" is not a recognized face/hand/body landmark; rendering null.`
|
|
208
|
+
);
|
|
209
|
+
}, [e, t, h, s, r == null ? void 0 : r.type]), H((E, w) => {
|
|
210
|
+
if (y || !n.current || !r) return;
|
|
211
|
+
const m = r.resolveLandmark(e, c);
|
|
212
|
+
if (!m) {
|
|
213
|
+
n.current.visible = !1, u.current = !1, i.current.initialized = !1;
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
n.current.visible = !0;
|
|
217
|
+
const f = o.current.copy(m.position), p = n.current.parent;
|
|
218
|
+
if (p) {
|
|
219
|
+
p.updateMatrixWorld();
|
|
220
|
+
const g = new b.Matrix4().copy(p.matrixWorld).invert();
|
|
221
|
+
f.applyMatrix4(g);
|
|
222
|
+
}
|
|
223
|
+
d && (f.x += d[0], f.y += d[1], f.z += d[2]), l > 0 ? (_(i.current, f, u.current ? w : 0, l), n.current.position.copy(i.current.pos)) : n.current.position.copy(f), u.current = !0, m.quaternion && n.current.quaternion.copy(m.quaternion);
|
|
224
|
+
}), y ? null : /* @__PURE__ */ F("group", { ref: n, renderOrder: S.TRACKED, children: a });
|
|
225
|
+
};
|
|
226
|
+
export {
|
|
227
|
+
j as B,
|
|
228
|
+
Y as D,
|
|
229
|
+
L as F,
|
|
230
|
+
U as H,
|
|
231
|
+
J as T,
|
|
232
|
+
K as a,
|
|
233
|
+
P as b,
|
|
234
|
+
N as c,
|
|
235
|
+
G as d,
|
|
236
|
+
$ as e,
|
|
237
|
+
B as g,
|
|
238
|
+
_ as s,
|
|
239
|
+
C as t
|
|
240
|
+
};
|