@vincentt-xr/sdk 2.0.0-alpha.8 → 2.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/GROUNDING.md +4643 -170
  2. package/README.md +1 -0
  3. package/dist/CanonicalHeadFrame-BHcWyaiK.js +1506 -0
  4. package/dist/CanonicalHeadFrame-D-_T1OMU.cjs +1 -0
  5. package/dist/DebuggerUI-7ngnJsBe.js +275 -0
  6. package/dist/DebuggerUI-CoglgKdO.cjs +1 -0
  7. package/dist/FaceRetouch-CLoTfrcs.js +1071 -0
  8. package/dist/FaceRetouch-J1lC1WbS.cjs +134 -0
  9. package/dist/FaceSurface-CHAMEeG1.cjs +1 -0
  10. package/dist/FaceSurface-DmP9AEeC.js +27 -0
  11. package/dist/SegmentationOverlay-D_FWkcyP.cjs +35 -0
  12. package/dist/SegmentationOverlay-vn5x_knv.js +6237 -0
  13. package/dist/SkeletonUtils-C2r90MtN.js +21 -0
  14. package/dist/SkeletonUtils-CddIup1F.cjs +1 -0
  15. package/dist/TextLabel-XE0rQSDn.cjs +2 -0
  16. package/dist/TextLabel-c9BCucOI.js +961 -0
  17. package/dist/assets/gltfLoader.d.ts +16 -0
  18. package/dist/assets/loaders.d.ts +16 -1
  19. package/dist/body-pose/index.d.ts +521 -0
  20. package/dist/body-trigger/__fixtures__/syntheticBody.d.ts +83 -0
  21. package/dist/body-trigger/frame.d.ts +88 -0
  22. package/dist/body-trigger/index.d.ts +6 -0
  23. package/dist/body-trigger/moves.d.ts +235 -0
  24. package/dist/body-trigger/trigger.d.ts +75 -0
  25. package/dist/calibration/calibration.d.ts +11 -6
  26. package/dist/canonicalFace-BHwyCx1c.js +9 -0
  27. package/dist/canonicalFace-C83I225R.cjs +1 -0
  28. package/dist/components/BodyInstruction/BodyPoseHint.d.ts +63 -0
  29. package/dist/components/BodyInstruction/index.d.ts +69 -0
  30. package/dist/components/BodyInstruction/useBodyPose.d.ts +23 -0
  31. package/dist/components/BodyTracker/index.d.ts +10 -2
  32. package/dist/components/BodyTrigger/index.d.ts +49 -0
  33. package/dist/components/Debugger/DebuggerProvider.d.ts +14 -1
  34. package/dist/components/Debugger/DebuggerUI.d.ts +3 -1
  35. package/dist/components/FaceAtlas/FaceAtlasLayer.d.ts +114 -0
  36. package/dist/components/FaceAtlas/MadeUpCamera.d.ts +80 -0
  37. package/dist/components/FaceAtlas/constants.d.ts +8 -0
  38. package/dist/components/FaceAtlas/index.d.ts +7 -0
  39. package/dist/components/FaceAtlas/useFaceAtlasSurface.d.ts +84 -0
  40. package/dist/components/FaceAtlas/useFaceSkin.d.ts +84 -0
  41. package/dist/components/FaceCharacter/ExternalFaceMesh.d.ts +109 -0
  42. package/dist/components/FaceCharacter/FaceExpressionController.d.ts +53 -0
  43. package/dist/components/FaceCharacter/FaceMorph.d.ts +71 -0
  44. package/dist/components/FaceCharacter/FacePiercing.d.ts +65 -0
  45. package/dist/components/FaceCharacter/FaceReprojection.d.ts +85 -0
  46. package/dist/components/FaceCharacter/FaceRig.d.ts +38 -0
  47. package/dist/components/FaceCharacter/FaceSurface.d.ts +49 -0
  48. package/dist/components/FaceCharacter/FaceSurfaceOccluder.d.ts +39 -0
  49. package/dist/components/FaceCharacter/PinToFaceMesh.d.ts +68 -0
  50. package/dist/components/FaceCharacter/index.d.ts +18 -0
  51. package/dist/components/FaceCharacter/useFaceReprojector.d.ts +10 -0
  52. package/dist/components/FaceInset/FaceInset.d.ts +68 -0
  53. package/dist/components/FaceInset/frame.d.ts +94 -0
  54. package/dist/components/FaceInset/index.d.ts +6 -0
  55. package/dist/components/FaceInset/material.d.ts +40 -0
  56. package/dist/components/FaceInset/useFaceInsetTexture.d.ts +37 -0
  57. package/dist/components/FaceInstruction/FaceExpressionHint.d.ts +43 -0
  58. package/dist/components/FaceInstruction/index.d.ts +56 -0
  59. package/dist/components/FaceInstruction/useFaceExpression.d.ts +20 -0
  60. package/dist/components/FaceLiquify/FaceLiquify.d.ts +49 -0
  61. package/dist/components/FaceLiquify/debug.d.ts +37 -0
  62. package/dist/components/FaceLiquify/frame.d.ts +55 -0
  63. package/dist/components/FaceLiquify/index.d.ts +10 -0
  64. package/dist/components/FaceLiquify/material.d.ts +39 -0
  65. package/dist/components/FaceLiquify/pass.d.ts +49 -0
  66. package/dist/components/FaceLiquify/presence.d.ts +25 -0
  67. package/dist/components/FaceLiquify/presets.d.ts +82 -0
  68. package/dist/components/FaceLiquify/selfTest.d.ts +66 -0
  69. package/dist/components/FaceLiquify/target.d.ts +85 -0
  70. package/dist/components/FaceLiquify/warp.d.ts +72 -0
  71. package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +5 -3
  72. package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +21 -0
  73. package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +9 -0
  74. package/dist/components/FaceMesh/index.d.ts +1 -1
  75. package/dist/components/FaceRetouch/Background.d.ts +3 -1
  76. package/dist/components/FaceRetouch/FaceRetouch.d.ts +5 -0
  77. package/dist/components/FaceRetouch/renderState.d.ts +19 -0
  78. package/dist/components/FaceSwap/FaceMirror.d.ts +46 -0
  79. package/dist/components/FaceSwap/FaceSwap.d.ts +58 -0
  80. package/dist/components/FaceSwap/FaceTextureLayer.d.ts +72 -0
  81. package/dist/components/FaceSwap/faceSwapPlan.d.ts +91 -0
  82. package/dist/components/FaceSwap/index.d.ts +13 -0
  83. package/dist/components/FaceSwap/settings.d.ts +300 -0
  84. package/dist/components/FaceSwap/useFaceTexture.d.ts +35 -0
  85. package/dist/components/FaceSwap/useLiveFace.d.ts +38 -0
  86. package/dist/components/FaceSwap/useLiveFaceTexture.d.ts +31 -0
  87. package/dist/components/FaceWarp3D/FaceWarp3D.d.ts +50 -0
  88. package/dist/components/FaceWarp3D/index.d.ts +2 -3
  89. package/dist/components/Faceless/Faceless.d.ts +51 -0
  90. package/dist/components/Faceless/index.d.ts +2 -0
  91. package/dist/components/HairLock/HairLock.d.ts +39 -0
  92. package/dist/components/HairLock/index.d.ts +2 -0
  93. package/dist/components/HairLock/lockGeometry.d.ts +15 -0
  94. package/dist/components/HandCutout/index.d.ts +35 -0
  95. package/dist/components/HandInstruction/HandGestureHint.d.ts +70 -0
  96. package/dist/components/HandInstruction/index.d.ts +74 -0
  97. package/dist/components/HandInstruction/useHandGesture.d.ts +22 -0
  98. package/dist/components/HandRig/ForearmOccluder.d.ts +29 -0
  99. package/dist/components/HandRig/HandAttachment.d.ts +34 -0
  100. package/dist/components/HandRig/HandOccluder.d.ts +55 -0
  101. package/dist/components/HandRig/HandTattoo.d.ts +61 -0
  102. package/dist/components/HandRig/WristAttachment.d.ts +34 -0
  103. package/dist/components/HandRig/index.d.ts +101 -0
  104. package/dist/components/HandRig/useArmMask.d.ts +29 -0
  105. package/dist/components/HandRig/wristSolve.d.ts +69 -0
  106. package/dist/components/HandTouch/HandTouch.d.ts +62 -0
  107. package/dist/components/HandTouch/Touchable.d.ts +36 -0
  108. package/dist/components/HandTouch/index.d.ts +2 -0
  109. package/dist/components/HeadBinding/index.d.ts +14 -0
  110. package/dist/components/HeadOccluder/CanonicalHeadFrame.d.ts +22 -0
  111. package/dist/components/HeadOccluder/Earrings.d.ts +55 -0
  112. package/dist/components/HeadOccluder/HeadAttachment.d.ts +38 -0
  113. package/dist/components/HeadOccluder/NeckOccluder.d.ts +64 -0
  114. package/dist/components/HeadOccluder/earringPlacement.d.ts +31 -0
  115. package/dist/components/HeadOccluder/headAttachmentPoints.d.ts +69 -0
  116. package/dist/components/HeadOccluder/index.d.ts +57 -3
  117. package/dist/components/HeadOccluder/useCanonicalHeadFit.d.ts +36 -0
  118. package/dist/components/HeadOccluder/useLandmarkPoseFit.d.ts +80 -0
  119. package/dist/components/Instruction/HintStage.d.ts +29 -0
  120. package/dist/components/Instruction/InstructionCue.d.ts +126 -0
  121. package/dist/components/Instruction/gestureHold.d.ts +20 -0
  122. package/dist/components/Instruction/ghost.d.ts +129 -0
  123. package/dist/components/Instruction/hintBlend.d.ts +19 -0
  124. package/dist/components/Instruction/hintLook.d.ts +81 -0
  125. package/dist/components/Instruction/hintLoop.d.ts +36 -0
  126. package/dist/components/Instruction/index.d.ts +41 -0
  127. package/dist/components/Instruction/useGhostModel.d.ts +33 -0
  128. package/dist/components/Instruction/useInstructionHold.d.ts +72 -0
  129. package/dist/components/LipEffect/LipEffect.d.ts +22 -2
  130. package/dist/components/LipEffect/LipEffectMaterial.d.ts +62 -10
  131. package/dist/components/LipEffect/LipEffects.d.ts +5 -2
  132. package/dist/components/LipEffect/defaults.d.ts +21 -2
  133. package/dist/components/LipEffect/index.d.ts +1 -1
  134. package/dist/components/LipEffect/lipShading.d.ts +73 -0
  135. package/dist/components/LipEffect/settings.d.ts +117 -13
  136. package/dist/components/LipEffect/shader.d.ts +39 -0
  137. package/dist/components/LipEffect/types.d.ts +82 -10
  138. package/dist/components/LipEffect/useLipDesignTextures.d.ts +6 -0
  139. package/dist/components/LipEffect/uvGuide.d.ts +31 -16
  140. package/dist/components/Makeup/Blush.d.ts +18 -0
  141. package/dist/components/Makeup/Brows.d.ts +20 -0
  142. package/dist/components/Makeup/Contour.d.ts +17 -0
  143. package/dist/components/Makeup/Eyeliner.d.ts +20 -0
  144. package/dist/components/Makeup/Eyeshadow.d.ts +20 -0
  145. package/dist/components/Makeup/Highlighter.d.ts +18 -0
  146. package/dist/components/Makeup/MakeupDesign.d.ts +37 -0
  147. package/dist/components/Makeup/MakeupRegion.d.ts +132 -0
  148. package/dist/components/Makeup/constants.d.ts +44 -0
  149. package/dist/components/Makeup/design.d.ts +106 -0
  150. package/dist/components/Makeup/designSamples.d.ts +42 -0
  151. package/dist/components/Makeup/eyes.d.ts +114 -0
  152. package/dist/components/Makeup/fields.d.ts +10 -0
  153. package/dist/components/Makeup/geometry.d.ts +106 -0
  154. package/dist/components/Makeup/index.d.ts +26 -0
  155. package/dist/components/Makeup/looks.d.ts +28 -0
  156. package/dist/components/Makeup/material.d.ts +239 -0
  157. package/dist/components/Makeup/settings.d.ts +54 -0
  158. package/dist/components/Makeup/shades.d.ts +143 -0
  159. package/dist/components/Makeup/shapes.d.ts +27 -0
  160. package/dist/components/Makeup/skinTone.d.ts +135 -0
  161. package/dist/components/Makeup/types.d.ts +110 -0
  162. package/dist/components/Makeup/useMakeupSkinTone.d.ts +40 -0
  163. package/dist/components/Necklace/Necklace.d.ts +44 -0
  164. package/dist/components/Necklace/index.d.ts +1 -0
  165. package/dist/components/ParticleEmitter/ParticleEmitter.d.ts +69 -0
  166. package/dist/components/ParticleEmitter/index.d.ts +1 -0
  167. package/dist/components/ShoulderOccluder/index.d.ts +43 -0
  168. package/dist/components/ShoulderOccluder/useCanonicalTorsoFit.d.ts +24 -0
  169. package/dist/components/SpringSwing/SpringSwing.d.ts +22 -0
  170. package/dist/components/SpringSwing/index.d.ts +1 -0
  171. package/dist/components/XRScene/renderOutputTarget.d.ts +12 -0
  172. package/dist/components/index.d.ts +8 -0
  173. package/dist/config/index.d.ts +0 -1
  174. package/dist/context-DTxSQvp4.js +13 -0
  175. package/dist/context-hA0Rb2Xa.cjs +1 -0
  176. package/dist/contexts-BH7PdKFS.cjs +1 -0
  177. package/dist/contexts-jak8-tND.js +667 -0
  178. package/dist/coordinates/index.d.ts +2 -0
  179. package/dist/coordinates/side.d.ts +40 -0
  180. package/dist/debug-ui/default-setting.cjs +2 -2
  181. package/dist/debug-ui/face-swap-settings/index.d.ts +22 -0
  182. package/dist/debug-ui/hierarchy-panel/index.d.ts +3 -2
  183. package/dist/debug-ui/index.d.ts +4 -3
  184. package/dist/debug-ui/media-source/index.d.ts +1 -1
  185. package/dist/debug-ui/media-source/session.d.ts +30 -2
  186. package/dist/debug-ui/media-source.cjs +1 -1
  187. package/dist/debug-ui/media-source.js +1 -1
  188. package/dist/debug-ui/object-inspector-panel/index.d.ts +3 -2
  189. package/dist/debug-ui/product-hotspots/index.d.ts +3 -2
  190. package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +3 -1
  191. package/dist/debug-ui/scene-editor/inspector-panel.d.ts +3 -1
  192. package/dist/debug-ui/screen-image-settings/index.d.ts +3 -1
  193. package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +1 -1
  194. package/dist/debug-ui/screen-text-settings/types.d.ts +2 -0
  195. package/dist/debug-ui/settings-panel/index.d.ts +6 -1
  196. package/dist/debug-ui/shared/debugWindow.d.ts +51 -0
  197. package/dist/debug-ui/xr-diagnostics/index.d.ts +3 -2
  198. package/dist/debug-ui.cjs +3 -3
  199. package/dist/debug-ui.js +2250 -2472
  200. package/dist/entries/all.d.ts +3 -1
  201. package/dist/entries/core.d.ts +3 -2
  202. package/dist/entries/face-effects.d.ts +114 -8
  203. package/dist/entries/instructions.d.ts +48 -0
  204. package/dist/entries/internal.d.ts +2 -1
  205. package/dist/entries/low-level.d.ts +28 -1
  206. package/dist/entries/particles.d.ts +11 -0
  207. package/dist/entries/tracking.d.ts +37 -2
  208. package/dist/face-atlas/attributes.d.ts +30 -0
  209. package/dist/face-atlas/eyes.d.ts +272 -0
  210. package/dist/face-atlas/faceAtlas.generated.d.ts +46 -0
  211. package/dist/face-atlas/glsl/atlasVertex.d.ts +46 -0
  212. package/dist/face-atlas/glsl/common.d.ts +55 -0
  213. package/dist/face-atlas/glsl/design.d.ts +49 -0
  214. package/dist/face-atlas/glsl/eyes.d.ts +73 -0
  215. package/dist/face-atlas/glsl/finish.d.ts +24 -0
  216. package/dist/face-atlas/glsl/format.d.ts +4 -0
  217. package/dist/face-atlas/glsl/index.d.ts +59 -0
  218. package/dist/face-atlas/glsl/shading.d.ts +15 -0
  219. package/dist/face-atlas/glsl/shapes.d.ts +66 -0
  220. package/dist/face-atlas/glsl/sparkle.d.ts +19 -0
  221. package/dist/face-atlas/glsl/uniforms.d.ts +106 -0
  222. package/dist/face-atlas/guide.d.ts +51 -0
  223. package/dist/face-atlas/index.d.ts +25 -0
  224. package/dist/face-atlas/lead.d.ts +117 -0
  225. package/dist/face-atlas/madeUpCamera.d.ts +125 -0
  226. package/dist/face-atlas/masks.d.ts +53 -0
  227. package/dist/face-atlas/obj.d.ts +69 -0
  228. package/dist/face-atlas/polylines.d.ts +63 -0
  229. package/dist/face-atlas/probe/FaceSkinProbe.d.ts +208 -0
  230. package/dist/face-atlas/probe/__fixtures__/emulate.d.ts +9 -0
  231. package/dist/face-atlas/probe/__fixtures__/face.d.ts +24 -0
  232. package/dist/face-atlas/probe/constants.d.ts +137 -0
  233. package/dist/face-atlas/probe/glsl.d.ts +43 -0
  234. package/dist/face-atlas/probe/lightFit.d.ts +108 -0
  235. package/dist/face-atlas/probe/schedule.d.ts +44 -0
  236. package/dist/face-atlas/probe/selfTest.d.ts +87 -0
  237. package/dist/face-atlas/probe/stats.d.ts +143 -0
  238. package/dist/face-atlas/probe/targets.d.ts +70 -0
  239. package/dist/face-atlas/probe/unwrap.d.ts +76 -0
  240. package/dist/face-atlas/quality.d.ts +28 -0
  241. package/dist/face-atlas/regions.d.ts +31 -0
  242. package/dist/face-atlas/registry.d.ts +252 -0
  243. package/dist/face-atlas/renderState.d.ts +86 -0
  244. package/dist/face-atlas/selfOcclusion.d.ts +62 -0
  245. package/dist/face-atlas/shading.d.ts +406 -0
  246. package/dist/face-atlas/shapes.d.ts +86 -0
  247. package/dist/face-atlas/sides.d.ts +41 -0
  248. package/dist/face-atlas/skinMask.d.ts +35 -0
  249. package/dist/face-atlas/surface.d.ts +155 -0
  250. package/dist/face-atlas/topology.d.ts +44 -0
  251. package/dist/face-character/__fixtures__/faceImageDetections.d.ts +25 -0
  252. package/dist/face-character/__fixtures__/faceNode.d.ts +22 -0
  253. package/dist/face-character/bindFaceModel.d.ts +106 -0
  254. package/dist/face-character/canonicalFace.d.ts +17 -0
  255. package/dist/face-character/canonicalFaceGeometry.d.ts +11 -0
  256. package/dist/face-character/canonicalFacePositions.d.ts +7 -0
  257. package/dist/face-character/driveFaceModel.d.ts +57 -0
  258. package/dist/face-character/expressionOutputs.d.ts +45 -0
  259. package/dist/face-character/faceExpressions.d.ts +104 -0
  260. package/dist/face-character/faceImageLandmarker.d.ts +93 -0
  261. package/dist/face-character/faceMeshBinding.d.ts +62 -0
  262. package/dist/face-character/faceMorph.d.ts +77 -0
  263. package/dist/face-character/faceMorphs.d.ts +46 -0
  264. package/dist/face-character/facePhoto.d.ts +138 -0
  265. package/dist/face-character/facePiercings.d.ts +116 -0
  266. package/dist/face-character/facePin.d.ts +131 -0
  267. package/dist/face-character/faceReprojection.d.ts +273 -0
  268. package/dist/face-character/faceReprojector.d.ts +171 -0
  269. package/dist/face-character/faceRig.d.ts +176 -0
  270. package/dist/face-character/faceSwapPresence.d.ts +85 -0
  271. package/dist/face-character/faceTexture.d.ts +169 -0
  272. package/dist/face-character/faceTextureBaker.d.ts +86 -0
  273. package/dist/face-character/faceTextureGuide.d.ts +106 -0
  274. package/dist/face-character/faceTextureStats.d.ts +298 -0
  275. package/dist/face-character/faceTransfer.d.ts +396 -0
  276. package/dist/face-character/faceTransferGeometry.d.ts +109 -0
  277. package/dist/face-character/faceTransferSelfTest.d.ts +94 -0
  278. package/dist/face-character/faceWarp3D.d.ts +101 -0
  279. package/dist/face-character/faceless.d.ts +79 -0
  280. package/dist/face-character/featureWarp.d.ts +28 -0
  281. package/dist/face-character/liveFaceRegistry.d.ts +370 -0
  282. package/dist/face-character/liveValue.d.ts +12 -0
  283. package/dist/face-character/memo.d.ts +15 -0
  284. package/dist/face-effects.cjs +2252 -83
  285. package/dist/face-effects.js +14234 -1231
  286. package/dist/face-expression/index.d.ts +182 -0
  287. package/dist/face-info/landmarks.d.ts +17 -3
  288. package/dist/face-info/types.d.ts +20 -3
  289. package/dist/gestures/definitions.d.ts +15 -2
  290. package/dist/gestures/index.d.ts +1 -1
  291. package/dist/gestures/measures.d.ts +21 -8
  292. package/dist/getFaceInfo-B1otSDMX.cjs +1 -0
  293. package/dist/getFaceInfo-Cu4xDWiL.js +62 -0
  294. package/dist/hand/armFit.d.ts +46 -0
  295. package/dist/hand/armMask.d.ts +178 -0
  296. package/dist/hand/handCutout.d.ts +23 -0
  297. package/dist/hand/handCutoutRegistry.d.ts +7 -0
  298. package/dist/hand/handGestures.d.ts +524 -0
  299. package/dist/hand/handPose.d.ts +98 -0
  300. package/dist/hand/handRigSolver.d.ts +159 -0
  301. package/dist/hand/handTattoo.d.ts +81 -0
  302. package/dist/hand/handTouch.d.ts +240 -0
  303. package/dist/hand/wrist.d.ts +44 -0
  304. package/dist/hand/wristFilter.d.ts +44 -0
  305. package/dist/hooks/selectors.d.ts +8 -0
  306. package/dist/hooks/useFaceModelAcquisition.d.ts +38 -0
  307. package/dist/hooks/useTrackerContext.d.ts +6 -0
  308. package/dist/index-B1_TzJaI.js +1104 -0
  309. package/dist/index-BavF06C6.js +190 -0
  310. package/dist/index-BfFmpddl.cjs +21 -0
  311. package/dist/index-BuBzneeW.cjs +46 -0
  312. package/dist/index-CGsQWodV.cjs +1 -0
  313. package/dist/index-CIe7eCMH.js +3200 -0
  314. package/dist/index-CfSF8LXa.cjs +1 -0
  315. package/dist/index-D5GTzOzD.cjs +1 -0
  316. package/dist/index-DBhQzvVa.js +314 -0
  317. package/dist/index-DE17y0ZI.cjs +1 -0
  318. package/dist/index-JII7huPk.js +442 -0
  319. package/dist/index-tpCr9CLj.cjs +1 -0
  320. package/dist/{renderPasses-NnKZVfBy.js → index-w1S7fI2B.js} +219 -247
  321. package/dist/index-zGaqrz_K.js +188 -0
  322. package/dist/instructions.cjs +30 -0
  323. package/dist/instructions.js +1507 -0
  324. package/dist/{internal-vsfNQycj.js → internal-B90P-clC.js} +138 -118
  325. package/dist/internal-Cjinca64.cjs +1 -0
  326. package/dist/internal.cjs +1 -1
  327. package/dist/internal.js +15 -10
  328. package/dist/iris/compute.d.ts +7 -5
  329. package/dist/iris/types.d.ts +6 -4
  330. package/dist/{landmarkMask-CbTFzBYG.js → landmarkMask-BFDyBnKM.js} +6 -6
  331. package/dist/landmarks-BlUqf5MZ.cjs +1 -0
  332. package/dist/landmarks-bftdwq6Z.js +76 -0
  333. package/dist/loaders-BGAUACsd.js +363 -0
  334. package/dist/loaders-BJ1_QCHt.cjs +1 -0
  335. package/dist/low-level.cjs +1 -1
  336. package/dist/low-level.js +666 -602
  337. package/dist/main.cjs +1 -1
  338. package/dist/main.js +866 -1182
  339. package/dist/models/Body/index.d.ts +2 -0
  340. package/dist/models/Face/constants.d.ts +8 -0
  341. package/dist/models/Face/index.d.ts +3 -11
  342. package/dist/models/Face/rotation.d.ts +18 -3
  343. package/dist/models/Hand/HandTracking.d.ts +17 -1
  344. package/dist/models/Segmentation/index.d.ts +2 -0
  345. package/dist/models/nodeSource.d.ts +9 -0
  346. package/dist/particles/emission.d.ts +24 -0
  347. package/dist/particles/eyes.d.ts +24 -0
  348. package/dist/particles/glsl.d.ts +14 -0
  349. package/dist/particles/index.d.ts +10 -0
  350. package/dist/particles/motion.d.ts +42 -0
  351. package/dist/particles/presets.d.ts +12 -0
  352. package/dist/particles/ring.d.ts +58 -0
  353. package/dist/particles/selfTest.d.ts +53 -0
  354. package/dist/particles/settings.d.ts +127 -0
  355. package/dist/particles/shapes.d.ts +29 -0
  356. package/dist/particles/spawner.d.ts +60 -0
  357. package/dist/particles/system.d.ts +64 -0
  358. package/dist/particles.cjs +122 -0
  359. package/dist/particles.js +774 -0
  360. package/dist/product.cjs +1 -1
  361. package/dist/product.js +29 -29
  362. package/dist/{providers-C0Dlhh9Z.js → providers-C8rE26Uf.js} +127 -126
  363. package/dist/providers-DHsrhDI2.cjs +62 -0
  364. package/dist/render/renderPasses.d.ts +8 -0
  365. package/dist/render/sceneBeforeRender.d.ts +12 -0
  366. package/dist/{renderGroups-CN1cGFUo.js → renderGroups-B38pUaX2.js} +1 -1
  367. package/dist/{renderGroups-O4KmaMl9.cjs → renderGroups-Cb_4Ar1Q.cjs} +1 -1
  368. package/dist/renderPasses-B6l8IpJv.js +1290 -0
  369. package/dist/renderPasses-dqmkft4P.cjs +158 -0
  370. package/dist/renderState-CJNmj5jz.js +39 -0
  371. package/dist/renderState-apSfg4eR.cjs +1 -0
  372. package/dist/scene-object.cjs +1 -1
  373. package/dist/scene-object.js +2 -2
  374. package/dist/segmentation-Cb3ouK6Z.js +1758 -0
  375. package/dist/segmentation-D9pYO6aR.cjs +1 -0
  376. package/dist/segmentation2d/types.d.ts +6 -0
  377. package/dist/select-Ck5LGz-J.cjs +1 -0
  378. package/dist/select-pYRo_win.js +233 -0
  379. package/dist/selectors-C4X71aoD.cjs +1 -0
  380. package/dist/selectors-DmNaKIwE.js +196 -0
  381. package/dist/session-BrH8G7iJ.cjs +31 -0
  382. package/dist/session-DgA_z6O1.js +418 -0
  383. package/dist/{settings-aQk845NJ.js → settings-BJ7FMBsO.js} +53 -15
  384. package/dist/settings-C63FMBlF.cjs +1 -0
  385. package/dist/similarityFit-BFqHND2e.cjs +1 -0
  386. package/dist/similarityFit-Bbz-R8AY.js +91 -0
  387. package/dist/spring/index.d.ts +2 -0
  388. package/dist/spring/spring.d.ts +69 -0
  389. package/dist/spring/swing.d.ts +54 -0
  390. package/dist/tracking.cjs +10 -1
  391. package/dist/tracking.js +1002 -855
  392. package/dist/trigger-D0Pm9noT.cjs +49 -0
  393. package/dist/trigger-IQeys0oS.js +2128 -0
  394. package/dist/types/face.d.ts +20 -1
  395. package/dist/types/hand-tracking.d.ts +9 -0
  396. package/dist/types/nodes.d.ts +20 -1
  397. package/dist/types/segmentation.d.ts +5 -0
  398. package/dist/updateThrottle-BseecYag.js +4 -0
  399. package/dist/updateThrottle-Of5Y4SVa.cjs +1 -0
  400. package/dist/useFaceInfo-BHDNCvsJ.cjs +1 -0
  401. package/dist/useFaceInfo-J4x7LsqL.js +76 -0
  402. package/dist/useFaceResultReader-BvEo5REG.js +61 -0
  403. package/dist/useFaceResultReader-DuaL1KJG.cjs +1 -0
  404. package/dist/useInstructionHold-DOu-RpCM.js +53 -0
  405. package/dist/useInstructionHold-DwJY1Alr.cjs +1 -0
  406. package/dist/useLandmarkPoseFit-Bg-h9BPb.cjs +1 -0
  407. package/dist/useLandmarkPoseFit-Bmb3h6Mw.js +87 -0
  408. package/dist/{useXRCapabilities-B1R2ghy-.cjs → useXRCapabilities-Cr3RzuAW.cjs} +1 -1
  409. package/dist/{useXRCapabilities-C68v__wB.js → useXRCapabilities-Cxmlmpbd.js} +1 -1
  410. package/dist/utils/canonicalRigidLandmarks.d.ts +8 -0
  411. package/dist/utils/headOccluderFit.d.ts +42 -0
  412. package/dist/utils/integrity.d.ts +17 -0
  413. package/dist/utils/resolveNumFaces.d.ts +13 -0
  414. package/dist/utils/shoulderOccluderFit.d.ts +38 -0
  415. package/dist/utils/similarityFit.d.ts +23 -0
  416. package/dist/uv-BMFt19bg.cjs +1 -0
  417. package/dist/{index-CsUdQ-pn.js → uv-DJU_XfmN.js} +15 -249
  418. package/docs/SDK_DOCUMENTATION.md +1 -2
  419. package/docs/api/adaptive-quality.mdx +1 -1
  420. package/docs/api/body-instructions.mdx +285 -0
  421. package/docs/api/body-triggers.mdx +234 -0
  422. package/docs/api/camera-permission.mdx +1 -1
  423. package/docs/api/coordinate-spaces.mdx +7 -4
  424. package/docs/api/cross-camera.mdx +3 -2
  425. package/docs/api/debug-ui-scene-editor.mdx +23 -2
  426. package/docs/api/external-face-mesh.mdx +231 -0
  427. package/docs/api/face-actions.mdx +20 -16
  428. package/docs/api/face-attribute-expression.mdx +1 -1
  429. package/docs/api/face-binding-anchors.mdx +4 -2
  430. package/docs/api/face-character.mdx +157 -0
  431. package/docs/api/face-effects.mdx +3 -0
  432. package/docs/api/face-expression-controller.mdx +153 -0
  433. package/docs/api/face-info.mdx +17 -11
  434. package/docs/api/face-inset.mdx +204 -0
  435. package/docs/api/face-instructions.mdx +183 -0
  436. package/docs/api/face-liquify.mdx +196 -0
  437. package/docs/api/face-mesh.mdx +4 -7
  438. package/docs/api/face-morph.mdx +117 -0
  439. package/docs/api/face-painting.mdx +7 -0
  440. package/docs/api/face-reprojection.mdx +154 -0
  441. package/docs/api/face-retouching.mdx +18 -10
  442. package/docs/api/face-swap.mdx +350 -0
  443. package/docs/api/face-warp-3d.mdx +166 -0
  444. package/docs/api/faceless.mdx +143 -0
  445. package/docs/api/gestures.mdx +68 -32
  446. package/docs/api/hair.mdx +97 -0
  447. package/docs/api/hand-instructions.mdx +222 -0
  448. package/docs/api/hand-rig.mdx +535 -0
  449. package/docs/api/hand-touch.mdx +162 -0
  450. package/docs/api/head-occluder.mdx +563 -0
  451. package/docs/api/holistic-tracker.mdx +6 -1
  452. package/docs/api/instructions.mdx +323 -0
  453. package/docs/api/iris-tracking.mdx +24 -19
  454. package/docs/api/made-up-camera.mdx +131 -0
  455. package/docs/api/makeup-skin-tone.mdx +135 -0
  456. package/docs/api/makeup.mdx +353 -0
  457. package/docs/api/multi-subject.mdx +4 -1
  458. package/docs/api/particles.mdx +155 -0
  459. package/docs/api/person-cutout.mdx +1 -1
  460. package/docs/api/pin-to-face-mesh.mdx +274 -0
  461. package/docs/api/product-ar.mdx +5 -2
  462. package/docs/api/segmentation-overlay.mdx +1 -1
  463. package/docs/docs.json +29 -1
  464. package/docs/examples/lip-shaders.mdx +82 -33
  465. package/docs/guides/face-atlas-template.svg +1 -0
  466. package/docs/guides/face-atlas-textures.mdx +186 -0
  467. package/docs/guides/face-texture-template.svg +1 -0
  468. package/docs/guides/harness-debug-ui.mdx +4 -4
  469. package/docs/guides/lip-effect-textures.mdx +178 -102
  470. package/docs/guides/lip-uv-template.png +0 -0
  471. package/docs/guides/lip-uv-template.svg +1 -1
  472. package/docs/guides/makeup-design-textures.mdx +109 -0
  473. package/docs/introduction.mdx +1 -2
  474. package/package.json +11 -1
  475. package/dist/DebuggerUI-C-ldiozL.js +0 -269
  476. package/dist/DebuggerUI-CWX5EtQv.cjs +0 -1
  477. package/dist/FaceMeshRenderer-BEEXZwS6.cjs +0 -158
  478. package/dist/FaceMeshRenderer-UuH5sTXG.js +0 -1322
  479. package/dist/FaceRetouch-C7h7x9kd.js +0 -683
  480. package/dist/FaceRetouch-DqftT26Y.cjs +0 -134
  481. package/dist/GLTFLoader-C5q63sKO.js +0 -1633
  482. package/dist/GLTFLoader-Cb_CRwmG.cjs +0 -1
  483. package/dist/SegmentationOverlay-DQuW3dsc.js +0 -133
  484. package/dist/SegmentationOverlay-aWVod8Kl.cjs +0 -1
  485. package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +0 -15
  486. package/dist/components/FaceWarp3D/defaults.d.ts +0 -37
  487. package/dist/components/FaceWarp3D/warp.d.ts +0 -13
  488. package/dist/contexts-CO0sd4JQ.cjs +0 -1
  489. package/dist/contexts-FzlnnMYD.js +0 -669
  490. package/dist/debug-ui/face-warp-3d/index.d.ts +0 -6
  491. package/dist/getFaceInfo-BkZfaQs-.js +0 -118
  492. package/dist/getFaceInfo-ahPxQFGu.cjs +0 -1
  493. package/dist/index--RgGzZ6X.cjs +0 -47
  494. package/dist/index-CHVbH0hz.js +0 -214
  495. package/dist/index-CeVkgsag.cjs +0 -1
  496. package/dist/index-CnGox6Xr.js +0 -3054
  497. package/dist/index-DKBAh6hV.cjs +0 -1
  498. package/dist/index-DsZwTfG0.cjs +0 -1
  499. package/dist/index-Dw6tj2Mi.js +0 -144
  500. package/dist/index-OCPjOaeP.cjs +0 -1
  501. package/dist/index-s9pF4zkG.js +0 -2053
  502. package/dist/internal-BYza1h8_.cjs +0 -1
  503. package/dist/measures-9dQPdw96.js +0 -154
  504. package/dist/measures-KfJzpvod.cjs +0 -1
  505. package/dist/providers-YNwkmNeK.cjs +0 -62
  506. package/dist/renderPasses-Cg-zqmEz.cjs +0 -21
  507. package/dist/screenTransform-BenfCtZt.js +0 -44
  508. package/dist/screenTransform-BiXdpVf0.cjs +0 -1
  509. package/dist/segmentation-9PhSvc-R.cjs +0 -1
  510. package/dist/segmentation-CeOTKemr.js +0 -5
  511. package/dist/selectors-C5G1PMYL.js +0 -195
  512. package/dist/selectors-Du_PsVnW.cjs +0 -1
  513. package/dist/session-BBr0yN8h.cjs +0 -31
  514. package/dist/session-Cy0m7l7-.js +0 -363
  515. package/dist/settings-DRR7-snV.cjs +0 -1
  516. package/dist/useFaceInfo-Blf7FCu3.js +0 -303
  517. package/dist/useFaceInfo-C5mO8NQY.cjs +0 -1
@@ -0,0 +1,1507 @@
1
+ import { jsxs as Vt, jsx as x } from "react/jsx-runtime";
2
+ import { T as Ee, S as Rt } from "./TextLabel-c9BCucOI.js";
3
+ import { useFrame as Z, useThree as De } from "@react-three/fiber";
4
+ import { useState as Ct, useRef as E, useEffect as j, useMemo as R, useCallback as jt } from "react";
5
+ import * as i from "three";
6
+ import { u as Pe } from "./context-DTxSQvp4.js";
7
+ import { s as st, u as qt } from "./useInstructionHold-DOu-RpCM.js";
8
+ import { G as Oo, b as ko, c as Ro, d as vo, a as Ho } from "./useInstructionHold-DOu-RpCM.js";
9
+ import { a as M, H as Ce, X as Kt } from "./index-CIe7eCMH.js";
10
+ import { H as Ot, b as Ae, s as Be, r as vt, B as Le, a as ze, m as Ue } from "./index-JII7huPk.js";
11
+ import { c as Io, d as No, e as Eo, f as Do, g as Po, h as Co, i as Ao, j as Bo, k as Lo } from "./index-JII7huPk.js";
12
+ import { e as Yt, g as We } from "./selectors-DmNaKIwE.js";
13
+ import { c as Ve } from "./SkeletonUtils-C2r90MtN.js";
14
+ import { u as $t } from "./landmarks-bftdwq6Z.js";
15
+ import { a as Fe, b as Ge } from "./getFaceInfo-Cu4xDWiL.js";
16
+ const je = () => {
17
+ const n = document.createElement("canvas");
18
+ n.width = n.height = 128;
19
+ const e = n.getContext("2d"), o = e.createRadialGradient(
20
+ 128 * 0.38,
21
+ 128 * 0.32,
22
+ 128 * 0.05,
23
+ 128 / 2,
24
+ 128 / 2,
25
+ 128 * 0.55
26
+ );
27
+ o.addColorStop(0, "#ffffff"), o.addColorStop(0.5, "#eef2f7"), o.addColorStop(0.85, "#c9d3df"), o.addColorStop(1, "#9aa8b8"), e.fillStyle = o, e.fillRect(0, 0, 128, 128);
28
+ const s = new i.CanvasTexture(n);
29
+ return s.colorSpace = i.SRGBColorSpace, s;
30
+ }, Ft = 96, qe = (t, n = {}) => {
31
+ const e = {
32
+ uHighlight: { value: new Float32Array(Ft) },
33
+ uHighlightGain: { value: 0 },
34
+ uCore: { value: n.core ?? 0.5 },
35
+ uRim: { value: n.rim ?? 0.95 },
36
+ uWhiten: { value: n.whiten ?? 0.6 },
37
+ uHighlightOpacity: { value: n.highlightOpacity ?? 0.9 },
38
+ uHighlightWhiten: { value: n.highlightWhiten ?? 0.55 }
39
+ }, o = new i.MeshMatcapMaterial({
40
+ matcap: t,
41
+ color: n.color ?? "#ffffff",
42
+ transparent: !0,
43
+ depthWrite: !1,
44
+ vertexColors: n.vertexColors ?? !0
45
+ });
46
+ return o.userData.ghost = e, o.onBeforeCompile = (s) => {
47
+ Object.assign(s.uniforms, e), s.vertexShader = s.vertexShader.replace(
48
+ "#include <common>",
49
+ `#include <common>
50
+ uniform float uHighlight[ ${Ft} ];
51
+ varying float vHighlight;`
52
+ ).replace(
53
+ "#include <skinning_vertex>",
54
+ `#include <skinning_vertex>
55
+ vHighlight = 0.0;
56
+ #ifdef USE_SKINNING
57
+ vHighlight = uHighlight[ int( skinIndex.x ) ] * skinWeight.x
58
+ + uHighlight[ int( skinIndex.y ) ] * skinWeight.y
59
+ + uHighlight[ int( skinIndex.z ) ] * skinWeight.z
60
+ + uHighlight[ int( skinIndex.w ) ] * skinWeight.w;
61
+ #endif`
62
+ ), s.fragmentShader = s.fragmentShader.replace(
63
+ "#include <common>",
64
+ `#include <common>
65
+ uniform float uHighlightGain;
66
+ uniform float uCore;
67
+ uniform float uRim;
68
+ uniform float uWhiten;
69
+ uniform float uHighlightOpacity;
70
+ uniform float uHighlightWhiten;
71
+ varying float vHighlight;`
72
+ ).replace(
73
+ "#include <opaque_fragment>",
74
+ `float ghostRim = 1.0 - abs( dot( normal, normalize( vViewPosition ) ) );
75
+ ghostRim = pow( ghostRim, 1.6 );
76
+ float lit = clamp( vHighlight, 0.0, 1.0 ) * uHighlightGain;
77
+ outgoingLight = mix( outgoingLight, vec3( 1.0 ), max( ghostRim * uWhiten, lit * uHighlightWhiten ) );
78
+ float ghostAlpha = mix( uCore, uRim, ghostRim );
79
+ diffuseColor.a *= mix( ghostAlpha, max( ghostAlpha, uHighlightOpacity ), lit );
80
+ #include <opaque_fragment>`
81
+ );
82
+ }, o.customProgramCacheKey = () => "instruction-hint-ghost", o;
83
+ }, Ke = ({
84
+ width: t,
85
+ color: n = "#0f172a",
86
+ opacity: e = 0.3,
87
+ vertexColors: o = !0
88
+ }) => {
89
+ const s = {
90
+ uHaloWidth: { value: t },
91
+ uHaloColor: { value: new i.Color(n) },
92
+ uHaloOpacity: { value: e }
93
+ }, r = new i.MeshMatcapMaterial({
94
+ transparent: !0,
95
+ depthWrite: !1,
96
+ side: i.BackSide,
97
+ vertexColors: o
98
+ });
99
+ return r.userData.halo = s, r.onBeforeCompile = (a) => {
100
+ Object.assign(a.uniforms, s), a.vertexShader = a.vertexShader.replace("#include <common>", `#include <common>
101
+ uniform float uHaloWidth;`).replace(
102
+ "#include <skinning_vertex>",
103
+ `#include <skinning_vertex>
104
+ transformed += normalize( objectNormal ) * uHaloWidth;`
105
+ ), a.fragmentShader = a.fragmentShader.replace(
106
+ "#include <common>",
107
+ `#include <common>
108
+ uniform vec3 uHaloColor;
109
+ uniform float uHaloOpacity;`
110
+ ).replace(
111
+ "#include <opaque_fragment>",
112
+ `float haloFacing = abs( dot( normal, normalize( vViewPosition ) ) );
113
+ outgoingLight = uHaloColor;
114
+ diffuseColor.a *= uHaloOpacity * smoothstep( 0.0, 0.7, haloFacing );
115
+ #include <opaque_fragment>`
116
+ );
117
+ }, r.customProgramCacheKey = () => `instruction-hint-halo-${o}`, r;
118
+ }, Ye = () => new i.MeshBasicMaterial({ colorWrite: !1, depthWrite: !0, transparent: !0 }), kt = "instructionHintTwin", $e = (t) => {
119
+ const n = [];
120
+ return t.traverse((e) => {
121
+ e.frustumCulled = !1, e instanceof i.Mesh && !e.userData[kt] && n.push(e);
122
+ }), n.map((e) => ({
123
+ mesh: e,
124
+ twins: ["prepass", "halo"].map((o) => {
125
+ var r;
126
+ const s = e.clone();
127
+ return s.userData[kt] = o, s.frustumCulled = !1, (r = e.parent) == null || r.add(s), s;
128
+ })
129
+ }));
130
+ }, Qe = (t, {
131
+ main: n,
132
+ prepass: e,
133
+ halo: o,
134
+ showHalo: s,
135
+ renderOrder: r = 0
136
+ }) => {
137
+ t.traverse((a) => {
138
+ if (!(a instanceof i.Mesh)) return;
139
+ const c = a.userData[kt];
140
+ c === "prepass" ? (a.material = e, a.renderOrder = r - 0.5) : c === "halo" ? (a.material = o, a.renderOrder = r - 0.25, a.visible = s) : (a.material = n(a), a.renderOrder = r);
141
+ });
142
+ }, Xe = [-1, -0.5, 0, 0.5, 1], Qt = (t, n, e) => {
143
+ let o = 1e-6, s = 1e-6;
144
+ const r = new i.Vector3();
145
+ for (const a of Xe) {
146
+ const c = new i.Matrix4().makeRotationY(e * a);
147
+ for (const m of t)
148
+ r.copy(m).sub(n).applyMatrix4(c), o = Math.max(o, Math.abs(r.x)), s = Math.max(s, Math.abs(r.y));
149
+ }
150
+ return 2 * Math.max(o, s);
151
+ }, it = (t) => t * t * (3 - 2 * t), Je = (t = "#ffffff", n = 0.75) => {
152
+ const o = document.createElement("canvas");
153
+ o.width = o.height = 128;
154
+ const s = o.getContext("2d"), r = new i.Color(t), a = `${Math.round(r.r * 255)},${Math.round(r.g * 255)},${Math.round(r.b * 255)}`, c = s.createRadialGradient(128 / 2, 128 / 2, 0, 128 / 2, 128 / 2, 128 / 2);
155
+ c.addColorStop(0, `rgba(${a},1)`), c.addColorStop(0.5, `rgba(${a},0.75)`), c.addColorStop(0.68, `rgba(${a},0.32)`), c.addColorStop(0.84, `rgba(${a},0.1)`), c.addColorStop(1, `rgba(${a},0)`), s.fillStyle = c, s.fillRect(0, 0, 128, 128);
156
+ const m = new i.CanvasTexture(o);
157
+ m.colorSpace = i.SRGBColorSpace;
158
+ const h = new i.MeshBasicMaterial({
159
+ map: m,
160
+ transparent: !0,
161
+ opacity: n,
162
+ depthWrite: !1,
163
+ depthTest: !1,
164
+ // A mirrored hint (negative scale) would otherwise turn the disc's back to the camera.
165
+ side: i.DoubleSide
166
+ });
167
+ return h.userData.glowTexture = m, h;
168
+ }, Ze = (t) => {
169
+ var n;
170
+ (n = t.userData.glowTexture) == null || n.dispose(), t.dispose();
171
+ }, tn = (t) => {
172
+ let n = !0;
173
+ return t.traverse((e) => {
174
+ e instanceof i.Mesh && !e.geometry.getAttribute("color") && (n = !1);
175
+ }), n;
176
+ }, me = /* @__PURE__ */ new WeakMap(), de = (t) => {
177
+ const n = me.get(t);
178
+ if (n) return n;
179
+ const e = /* @__PURE__ */ new Map();
180
+ for (const o of t.tracks) {
181
+ const { nodeName: s, propertyName: r } = i.PropertyBinding.parseTrackName(o.name);
182
+ if (r !== "quaternion") continue;
183
+ const [a, c, m, h] = o.values;
184
+ e.set(s, new i.Quaternion(a, c, m, h).normalize());
185
+ }
186
+ return me.set(t, e), e;
187
+ }, fe = /* @__PURE__ */ new WeakMap(), pe = (t) => {
188
+ const n = fe.get(t);
189
+ if (n) return n;
190
+ const e = /* @__PURE__ */ new Map();
191
+ for (const o of t.tracks) {
192
+ const { nodeName: s, propertyName: r } = i.PropertyBinding.parseTrackName(o.name);
193
+ if (r !== "position") continue;
194
+ const [a, c, m] = o.values;
195
+ e.set(s, new i.Vector3(a, c, m));
196
+ }
197
+ return fe.set(t, e), e;
198
+ }, Ht = 2e3, en = { sm: 0.1, md: 0.14, lg: 0.19 }, At = 160, nn = 0.66, on = {
199
+ color: "#ffffff",
200
+ fontWeight: "bold",
201
+ textAlign: "center",
202
+ bgColor: "transparent",
203
+ padding: 4,
204
+ resolution: At,
205
+ fontSize: At * nn,
206
+ resizeToFit: !0,
207
+ minFontSize: At * 0.3,
208
+ shadowEnabled: !0,
209
+ shadowColor: "#000000",
210
+ shadowBlur: 10,
211
+ shadowOffsetY: 2,
212
+ shadowOpacity: 0.55
213
+ }, Bt = (t, n) => {
214
+ t.traverse((e) => {
215
+ var s;
216
+ if (!(e instanceof i.Mesh)) return;
217
+ const o = Array.isArray(e.material) ? e.material : [e.material];
218
+ for (const r of o)
219
+ (s = r.userData).baseOpacity ?? (s.baseOpacity = r.opacity), r.opacity = r.userData.baseOpacity * n;
220
+ });
221
+ }, _t = ({
222
+ text: t,
223
+ doneText: n,
224
+ nudgeText: e = null,
225
+ nudgeAfterMs: o = 3e3,
226
+ size: s = "md",
227
+ placement: r = "center",
228
+ offset: a = [0, 0],
229
+ color: c,
230
+ textStyle: m,
231
+ nudgeTextStyle: h,
232
+ renderText: f,
233
+ motion: u = {},
234
+ layout: b = {},
235
+ hideOnComplete: w = !0,
236
+ onStatusChange: p,
237
+ detector: y,
238
+ symbol: l,
239
+ symbolAspect: g = 1
240
+ }) => {
241
+ const { width: d, height: T } = Pe(), S = y.status, {
242
+ fadeIn: B = 0.35,
243
+ fadeOut: _ = 0.5,
244
+ rise: q = 0.15,
245
+ bob: Q = 0.02,
246
+ pop: v = 0.1,
247
+ popSeconds: I = 0.3,
248
+ nudgePulse: K = 0.06,
249
+ ring: O = {}
250
+ } = u, L = O ? O.seconds ?? 0.6 : 0, D = O ? O.from ?? 0.45 : 0, N = O ? O.to ?? 0.95 : 0, U = O ? O.opacity ?? 0.7 : 0, C = typeof s == "number" ? s : en[s], V = Math.min(T * C, d * 0.42), F = Math.min(V * g, T * 0.62), nt = V * (b.textHeight ?? 0.3), at = V * (b.nudgeHeight ?? 0.2), ct = Math.min(d * 0.9, V * (b.textWidth ?? 6)), lt = T * (b.edgeMargin ?? 0.06), tt = F + V * (b.gap ?? 0.1) + nt, ut = (r === "top" ? T / 2 - lt - tt / 2 : r === "bottom" ? -T / 2 + lt + tt / 2 + (e !== null ? at : 0) : 0) + a[1] * T / 2, wt = tt / 2 - F / 2, ht = -tt / 2 + nt / 2, mt = ht - nt / 2 - at / 2, [It, ne] = Ct("waiting"), [z, P] = Ct(!1), X = E("waiting"), dt = E(performance.now()), A = E(p);
251
+ A.current = p;
252
+ const $ = E(y.isInView);
253
+ $.current = y.isInView;
254
+ const ft = E(!1);
255
+ j(() => {
256
+ var W;
257
+ ft.current || (ft.current = !0, (W = A.current) == null || W.call(A, X.current));
258
+ }, []);
259
+ const ot = E(null), et = E(null), pt = E(null), Nt = E(null), Mt = E(null), Et = R(() => new i.RingGeometry(0.94, 1, 72), []), oe = O ? O.color ?? "#ffffff" : "#ffffff", Tt = R(
260
+ () => new i.MeshBasicMaterial({
261
+ color: oe,
262
+ transparent: !0,
263
+ opacity: 0,
264
+ depthTest: !1,
265
+ depthWrite: !1
266
+ }),
267
+ [oe]
268
+ );
269
+ j(() => () => Et.dispose(), [Et]), j(() => () => Tt.dispose(), [Tt]);
270
+ const G = R(() => ({ age: 0, doneAge: 0, nudge: 0 }), []), [re, Ie] = Ct(!1);
271
+ if (Z((W, Dt) => {
272
+ var he;
273
+ const ae = performance.now(), ce = $.current();
274
+ ce && (dt.current = ae);
275
+ const J = S === "done" ? "done" : S === "holding" ? "holding" : ce ? "detected" : "waiting";
276
+ J !== X.current && (X.current = J, ne(J), ft.current = !0, (he = A.current) == null || he.call(A, J));
277
+ const Pt = e !== null && J === "waiting" && ae - dt.current > o;
278
+ Pt !== z && P(Pt), G.age += Dt, G.nudge = i.MathUtils.damp(G.nudge, Pt ? 1 : 0, 6, Dt);
279
+ const le = B > 0 ? it(Math.min(G.age / B, 1)) : 1;
280
+ let xt = le, ue = 1;
281
+ if (J === "done" && (G.doneAge += Dt, I > 0 && (ue = 1 + v * Math.sin(Math.min(G.doneAge / I, 1) * Math.PI)), w && (xt *= _ > 0 ? 1 - it(Math.min(G.doneAge / _, 1)) : 0, G.doneAge >= _ && !re && Ie(!0))), ot.current && (ot.current.position.y = ut - (1 - le) * F * q, ot.current.scale.setScalar(ue)), et.current) {
282
+ const rt = G.age;
283
+ et.current.position.y = wt + Math.sin(rt * 2.2) * F * Q, et.current.scale.setScalar(
284
+ 1 + G.nudge * K * (0.5 + 0.5 * Math.sin(rt * 4))
285
+ ), Bt(et.current, xt);
286
+ }
287
+ if (Mt.current) {
288
+ const rt = J === "done" && L > 0 ? Math.min(G.doneAge / L, 1) : 1;
289
+ Mt.current.visible = J === "done" && rt < 1, Mt.current.scale.setScalar(F * (D + (N - D) * it(rt))), Tt.opacity = U * (1 - rt);
290
+ }
291
+ pt.current && Bt(pt.current, xt), Nt.current && Bt(Nt.current, xt * G.nudge * 0.85);
292
+ }), re) return null;
293
+ const gt = Ht, ie = {
294
+ ...on,
295
+ ...c !== void 0 ? { color: c } : {},
296
+ ...m
297
+ }, Ne = { ...ie, fontWeight: "normal", ...h }, se = (W) => f ? f(W) : /* @__PURE__ */ x(
298
+ Ee,
299
+ {
300
+ text: W.text,
301
+ ...W.style,
302
+ aspect: W.width / W.height,
303
+ scale: [W.width, W.height, 1],
304
+ renderOrder: W.renderOrder
305
+ }
306
+ );
307
+ return /* @__PURE__ */ Vt("group", { ref: ot, position: [a[0] * d / 2, ut, 0], children: [
308
+ /* @__PURE__ */ Vt("mesh", { renderOrder: gt, scale: [1e-4, 1e-4, 1], onBeforeRender: (W) => W.clearDepth(), children: [
309
+ /* @__PURE__ */ x("planeGeometry", { args: [1, 1] }),
310
+ /* @__PURE__ */ x("meshBasicMaterial", { colorWrite: !1, depthWrite: !1, transparent: !0 })
311
+ ] }),
312
+ /* @__PURE__ */ x("group", { ref: et, position: [0, wt, F * 0.5], children: l(F, gt + 1) }),
313
+ O && /* @__PURE__ */ x(
314
+ "mesh",
315
+ {
316
+ ref: Mt,
317
+ geometry: Et,
318
+ material: Tt,
319
+ position: [0, wt, 0],
320
+ renderOrder: gt + 3,
321
+ visible: !1
322
+ }
323
+ ),
324
+ /* @__PURE__ */ x("group", { ref: pt, position: [0, ht, 0], children: se({
325
+ text: It === "done" && n !== void 0 ? n : t,
326
+ role: "text",
327
+ width: ct,
328
+ height: nt,
329
+ renderOrder: gt + 2,
330
+ style: ie
331
+ }) }),
332
+ e !== null && /* @__PURE__ */ x("group", { ref: Nt, position: [0, mt, 0], visible: z || G.nudge > 0.01, children: se({
333
+ text: e,
334
+ role: "nudge",
335
+ width: ct,
336
+ height: at,
337
+ renderOrder: gt + 2,
338
+ style: Ne
339
+ }) })
340
+ ] });
341
+ }, uo = ({ active: t = !0, ...n }) => t ? /* @__PURE__ */ x(Rt, { children: /* @__PURE__ */ x(_t, { ...n }) }) : null, bt = ["thumb", "index", "middle", "ring", "pinky"], rn = (t) => new i.Vector3(t.x, t.y, t.z), yt = (t, n, e) => {
342
+ const o = n.clone().sub(t), s = e.clone().sub(n);
343
+ return o.lengthSq() < 1e-12 || s.lengthSq() < 1e-12 ? 0 : o.angleTo(s);
344
+ }, ge = Object.freeze({
345
+ /** A finger is extended when its PIP + DIP bends stay under this (radians, ~55°). */
346
+ fingerStraight: i.MathUtils.degToRad(55),
347
+ /** … and its MCP bend stays under this (~70°, a finger folded at the knuckle is not up). */
348
+ fingerKnuckle: i.MathUtils.degToRad(70),
349
+ /** The thumb is extended when its MCP + IP bends stay under this (~60°) … */
350
+ thumbStraight: i.MathUtils.degToRad(60),
351
+ /** … and its tip is at least this many palm widths from the index MCP (tucked thumbs sit closer). */
352
+ thumbReach: 0.75,
353
+ /** |cos| of the thumb's angle to screen-up for "up" / "down" (~45°). */
354
+ thumbVertical: Math.cos(i.MathUtils.degToRad(45)),
355
+ /** Thumb and index tips touch within this many palm lengths (~1.75 cm). */
356
+ touch: 0.2,
357
+ /** Full curl, radians summed over a finger's three bends (normalises `curl`). */
358
+ fullCurl: i.MathUtils.degToRad(255)
359
+ }), ke = (t, { limits: n } = {}) => {
360
+ if (t.length < 21) throw new Error("analyzeHandShape needs 21 joints");
361
+ const e = t.map(rn), o = n ? { ...ge, ...n } : ge, s = e[M.middleMcp].distanceTo(e[M.wrist]), r = e[M.indexMcp].distanceTo(e[M.pinkyMcp]), a = {}, c = {};
362
+ for (const u of ["index", "middle", "ring", "pinky"]) {
363
+ const b = e[M[`${u}Mcp`]], w = e[M[`${u}Pip`]], p = e[M[`${u}Dip`]], y = e[M[`${u}Tip`]], l = yt(e[M.wrist], b, w), g = yt(b, w, p) + yt(w, p, y);
364
+ c[u] = i.MathUtils.clamp((l + g) / o.fullCurl, 0, 1), a[u] = g < o.fingerStraight && l < o.fingerKnuckle && y.distanceTo(e[M.wrist]) > w.distanceTo(e[M.wrist]);
365
+ }
366
+ const m = yt(e[M.thumbCmc], e[M.thumbMcp], e[M.thumbIp]) + yt(e[M.thumbMcp], e[M.thumbIp], e[M.thumbTip]);
367
+ c.thumb = i.MathUtils.clamp(m / i.MathUtils.degToRad(150), 0, 1), a.thumb = m < o.thumbStraight && e[M.thumbTip].distanceTo(e[M.indexMcp]) > o.thumbReach * r && e[M.thumbTip].distanceTo(e[M.pinkyMcp]) > e[M.thumbIp].distanceTo(e[M.pinkyMcp]);
368
+ const h = e[M.thumbTip].clone().sub(e[M.thumbMcp]).normalize(), f = a.thumb ? h.y >= o.thumbVertical ? "up" : h.y <= -o.thumbVertical ? "down" : "side" : "side";
369
+ return {
370
+ extended: a,
371
+ curl: c,
372
+ count: bt.filter((u) => a[u]).length,
373
+ thumbDirection: f,
374
+ thumbIndexTouch: e[M.thumbTip].distanceTo(e[M.indexTip]) < o.touch * s
375
+ };
376
+ }, ho = (t) => {
377
+ if (!t.rule && !t.match)
378
+ throw new Error("defineHandGesture needs a rule or a match function");
379
+ return t;
380
+ }, Lt = { index: !1, middle: !1, ring: !1, pinky: !1 }, Y = (t = {}) => ({
381
+ thumb: 1,
382
+ index: 1,
383
+ middle: 1,
384
+ ring: 1,
385
+ pinky: 1,
386
+ ...t
387
+ }), Re = {
388
+ palm: {
389
+ label: "Show your palm",
390
+ rule: { count: 5 },
391
+ hint: { clip: "palm", spread: 0.8, thumbTuck: 0 }
392
+ },
393
+ fist: {
394
+ label: "Make a fist",
395
+ rule: { digits: { thumb: !1, ...Lt } },
396
+ // Thumb across the front of the index / middle middle segments.
397
+ hint: {
398
+ clip: "fist",
399
+ curl: Y(),
400
+ thumbTuck: 1,
401
+ thumbTo: { joint: "indexPip", offset: [-0.15, -0.1, 0.13] }
402
+ }
403
+ },
404
+ peace: {
405
+ label: "Show a peace sign",
406
+ rule: { digits: { index: !0, middle: !0, ring: !1, pinky: !1 } },
407
+ hint: {
408
+ clip: "peace",
409
+ curl: Y({ index: 0, middle: 0 }),
410
+ spread: 1,
411
+ thumbTuck: 1,
412
+ thumbTo: { joint: "ringPip", offset: [0, -0.08, 0.12] }
413
+ }
414
+ },
415
+ thumbUp: {
416
+ label: "Give a thumbs up",
417
+ rule: { digits: { thumb: !0, ...Lt }, thumbDirection: "up" },
418
+ hint: { clip: "thumbUp", curl: Y({ thumb: 0 }), thumbTuck: 0, aimThumb: "up" }
419
+ },
420
+ thumbDown: {
421
+ label: "Give a thumbs down",
422
+ rule: { digits: { thumb: !0, ...Lt }, thumbDirection: "down" },
423
+ hint: { clip: "thumbUp", curl: Y({ thumb: 0 }), thumbTuck: 0, aimThumb: "down" }
424
+ },
425
+ point: {
426
+ label: "Point your index finger",
427
+ rule: { digits: { index: !0, middle: !1, ring: !1, pinky: !1 } },
428
+ // The thumb holds the curled middle and ring fingers down.
429
+ hint: {
430
+ clip: "one",
431
+ curl: Y({ index: 0 }),
432
+ thumbTuck: 0.6,
433
+ thumbTo: { joint: "middlePip", offset: [0.1, -0.1, 0.1] }
434
+ }
435
+ },
436
+ one: {
437
+ label: "Show 1 finger",
438
+ rule: { count: 1 },
439
+ // Counting: the thumb must be folded away, or it counts as a second digit.
440
+ hint: {
441
+ clip: "one",
442
+ curl: Y({ index: 0 }),
443
+ thumbTuck: 1,
444
+ thumbTo: { joint: "middlePip", offset: [0, -0.08, 0.12] }
445
+ }
446
+ },
447
+ two: {
448
+ label: "Show 2 fingers",
449
+ rule: { count: 2 },
450
+ hint: {
451
+ clip: "peace",
452
+ curl: Y({ index: 0, middle: 0 }),
453
+ spread: 0.6,
454
+ thumbTuck: 1,
455
+ thumbTo: { joint: "ringPip", offset: [0, -0.08, 0.12] }
456
+ }
457
+ },
458
+ three: {
459
+ label: "Show 3 fingers",
460
+ rule: { count: 3 },
461
+ hint: {
462
+ clip: "three",
463
+ curl: Y({ index: 0, middle: 0, ring: 0 }),
464
+ spread: 0.6,
465
+ thumbTuck: 1,
466
+ thumbTo: { joint: "pinkyPip", offset: [0, -0.08, 0.12] }
467
+ }
468
+ },
469
+ four: {
470
+ label: "Show 4 fingers",
471
+ rule: { count: 4 },
472
+ hint: {
473
+ clip: "four",
474
+ curl: { thumb: 1 },
475
+ spread: 0.6,
476
+ thumbTuck: 1,
477
+ thumbTo: { joint: "ringMcp", offset: [0, -0.2, 0.1] }
478
+ }
479
+ },
480
+ five: {
481
+ label: "Show 5 fingers",
482
+ rule: { count: 5 },
483
+ hint: { clip: "palm", spread: 0.8, thumbTuck: 0 }
484
+ },
485
+ rock: {
486
+ label: "Rock on",
487
+ rule: { digits: { index: !0, middle: !1, ring: !1, pinky: !0 } },
488
+ hint: {
489
+ clip: "rock",
490
+ yaw: 180,
491
+ curl: Y({ index: 0, pinky: 0 }),
492
+ spread: 0.8,
493
+ thumbTuck: 1,
494
+ thumbTo: { joint: "middlePip", offset: [-0.05, -0.08, 0.12] }
495
+ }
496
+ },
497
+ loveYou: {
498
+ label: "Sign I love you",
499
+ rule: { digits: { thumb: !0, index: !0, middle: !1, ring: !1, pinky: !0 } },
500
+ hint: {
501
+ clip: "loveYou",
502
+ curl: Y({ thumb: 0, index: 0, pinky: 0 }),
503
+ spread: 0.8,
504
+ thumbTuck: 0
505
+ }
506
+ },
507
+ callMe: {
508
+ label: "Call me",
509
+ rule: { digits: { thumb: !0, index: !1, middle: !1, ring: !1, pinky: !0 } },
510
+ // Held sideways like a phone at the ear: thumb up, pinky down.
511
+ hint: {
512
+ clip: "callMe",
513
+ roll: 103,
514
+ curl: Y({ thumb: 0, pinky: 0 }),
515
+ spread: 0.8,
516
+ thumbTuck: 0
517
+ }
518
+ },
519
+ ok: {
520
+ label: "Make an OK sign",
521
+ rule: { thumbIndexTouch: !0, digits: { middle: !0, ring: !0, pinky: !0 } },
522
+ // Seen from the thumb side so the ring reads. Procedural fallback tuned on
523
+ // hand-v1 (grid search) so the thumb and index tips meet, 0.16 cm apart.
524
+ hint: {
525
+ clip: "ok",
526
+ yaw: 124,
527
+ curl: { thumb: 0.3, index: 0.5 },
528
+ spread: 0.6,
529
+ thumbTuck: 0.4
530
+ }
531
+ }
532
+ }, sn = Object.keys(Re), Xt = (t) => typeof t == "string" ? Re[t] : typeof t == "object" && "hint" in t ? t : void 0, ye = (t, n) => {
533
+ var e;
534
+ if (n.count !== void 0 && t.count !== n.count || n.thumbDirection && t.thumbDirection !== n.thumbDirection || n.thumbIndexTouch !== void 0 && t.thumbIndexTouch !== n.thumbIndexTouch)
535
+ return !1;
536
+ for (const o of bt) {
537
+ const s = (e = n.digits) == null ? void 0 : e[o];
538
+ if (s !== void 0 && t.extended[o] !== s) return !1;
539
+ }
540
+ return !0;
541
+ }, ve = (t, n, e) => {
542
+ if (typeof n == "function") return n(t, e);
543
+ const o = Xt(n);
544
+ return o ? o.rule && !ye(t, o.rule) ? !1 : o.match ? o.match(t, e) : !!o.rule : ye(t, n);
545
+ }, mo = (t) => sn.filter((n) => ve(t, n)), be = {
546
+ finger: [85, 100, 70].map(i.MathUtils.degToRad),
547
+ thumb: [10, 45, 35].map(i.MathUtils.degToRad)
548
+ }, an = { index: 12, middle: 3, ring: -8, pinky: -16 }, cn = i.MathUtils.degToRad(70), ln = 0.65, un = { 1: [1, 0.35], 2: [0.6, 1] }, hn = Object.fromEntries(
549
+ Ot.map(({ name: t }) => [
550
+ t,
551
+ t.endsWith("Cmc") || t.endsWith("Mcp") && !t.startsWith("thumb") ? 0 : t === "thumbMcp" || t.endsWith("Pip") ? 1 : 2
552
+ ])
553
+ ), we = (t) => bt.find((n) => t.startsWith(n)) ?? "index", H = {
554
+ thumbAxis: new i.Vector3(),
555
+ thumbSide: new i.Vector3(),
556
+ cross: new i.Vector3(),
557
+ delta: new i.Quaternion(),
558
+ restInv: new i.Quaternion(),
559
+ q: new i.Quaternion(),
560
+ D: new i.Quaternion(),
561
+ axis: new i.Vector3(),
562
+ dir: new i.Vector3(),
563
+ /** Root-space rotation of each joint as it is posed (parents before children). */
564
+ live: Object.fromEntries(
565
+ ["wrist", ...Ot.map((t) => t.name)].map((t) => [t, new i.Quaternion()])
566
+ )
567
+ }, zt = (t, n) => i.MathUtils.clamp(typeof t == "number" ? t : t(n), 0, 1.1), mn = (t, n) => {
568
+ if (!(!t || !n)) {
569
+ for (const e of t) if (e.name === n) return e;
570
+ }
571
+ }, Me = /* @__PURE__ */ new WeakMap(), dn = (t) => {
572
+ const n = Me.get(t);
573
+ if (n) return n;
574
+ const e = {};
575
+ for (const o of t.tracks) {
576
+ const { nodeName: s, propertyName: r } = i.PropertyBinding.parseTrackName(o.name);
577
+ if (r !== "quaternion" || !(s in M)) continue;
578
+ const [a, c, m, h] = o.values;
579
+ e[s] = new i.Quaternion(a, c, m, h).normalize();
580
+ }
581
+ return Me.set(t, e), e;
582
+ }, Ut = (t, n, e = 1, o) => {
583
+ var f;
584
+ const s = mn(o, n.clip);
585
+ if (s) {
586
+ const u = dn(s);
587
+ for (const { name: b } of Ot) {
588
+ const w = t.bones[b], p = t.restLocal[b];
589
+ !w || !p || w.quaternion.copy(p).slerp(u[b] ?? p, zt(e, we(b)));
590
+ }
591
+ return;
592
+ }
593
+ const r = t.restPalmNormal, a = t.restPositions, c = H.thumbSide.subVectors(a[M.indexMcp], a[M.pinkyMcp]).normalize(), m = H.live;
594
+ m.wrist.copy(t.restQuaternions.wrist);
595
+ for (const { name: u, parent: b, child: w } of Ot) {
596
+ const p = we(u), y = zt(e, p), l = hn[u] ?? 0, g = (((f = n.curl) == null ? void 0 : f[p]) ?? 0) * y, d = (p === "thumb" ? be.thumb : be.finger)[l] * g;
597
+ H.restInv.copy(t.restQuaternions[b]).invert(), H.delta.copy(m[b]).multiply(H.restInv), H.dir.subVectors(a[M[w]], a[M[u]]).normalize(), H.axis.crossVectors(H.dir, r).normalize();
598
+ const T = Math.sign(H.cross.crossVectors(r, H.dir).dot(c)), S = H.D.identity();
599
+ if (p === "thumb") {
600
+ const _ = -T || -1, [q, Q] = un[l] ?? [0, 1];
601
+ H.q.setFromAxisAngle(
602
+ H.thumbAxis.copy(r).multiplyScalar(_ * q).addScaledVector(H.axis, Q).normalize(),
603
+ d
604
+ ), S.copy(H.q);
605
+ } else
606
+ S.setFromAxisAngle(H.axis, d);
607
+ if (l === 0 && p !== "thumb") {
608
+ const _ = i.MathUtils.degToRad(an[p]) * (n.spread ?? 0) * y;
609
+ S.premultiply(H.q.setFromAxisAngle(r, _ * (T || 1)));
610
+ }
611
+ if (p === "thumb" && l === 0) {
612
+ const _ = cn * (n.thumbTuck ?? 0) * y;
613
+ S.premultiply(H.q.setFromAxisAngle(r, -_ * (T || 1))), S.premultiply(H.q.setFromAxisAngle(H.axis, _ * ln));
614
+ }
615
+ m[u].copy(H.delta).multiply(S).multiply(t.restQuaternions[u]);
616
+ const B = t.bones[u];
617
+ B && B.quaternion.copy(H.q.copy(m[b]).invert().multiply(m[u]));
618
+ }
619
+ const h = Math.min(zt(e, "thumb"), 1);
620
+ n.thumbTo && h > 0 && yn(t, n.thumbTo, h);
621
+ }, fn = {
622
+ thumbCmc: i.MathUtils.degToRad(75),
623
+ thumbMcp: i.MathUtils.degToRad(65),
624
+ thumbIp: i.MathUtils.degToRad(85)
625
+ }, pn = ["thumbIp", "thumbMcp", "thumbCmc"], k = {
626
+ inv: new i.Matrix4(),
627
+ head: new i.Vector3(),
628
+ eff: new i.Vector3(),
629
+ target: new i.Vector3(),
630
+ start: new i.Vector3(),
631
+ a: new i.Vector3(),
632
+ b: new i.Vector3(),
633
+ q: new i.Quaternion(),
634
+ pq: new i.Quaternion(),
635
+ pqInv: new i.Quaternion(),
636
+ rq: new i.Quaternion(),
637
+ limited: new i.Quaternion(),
638
+ up: new i.Vector3(),
639
+ side: new i.Vector3()
640
+ }, gn = [0, 0, 0], St = (t, n) => t.getWorldPosition(n).applyMatrix4(k.inv), yn = (t, n, e) => {
641
+ const o = t.root, s = t.restPositions, r = s[M.middleMcp].distanceTo(s[M.wrist]), a = k.up.subVectors(s[M.middleMcp], s[M.wrist]).normalize(), c = k.side.subVectors(s[M.indexMcp], s[M.pinkyMcp]);
642
+ c.addScaledVector(a, -c.dot(a)).normalize();
643
+ const [m, h, f] = n.offset ?? gn, u = t.bones.thumbTip ?? t.bones.thumbIp, b = t.bones[n.joint];
644
+ if (!b) return;
645
+ o.updateMatrixWorld(!0), k.inv.copy(o.matrixWorld).invert(), St(b, k.target).addScaledVector(c, m * r).addScaledVector(a, h * r).addScaledVector(t.restPalmNormal, f * r), St(u, k.start), k.target.lerp(k.start, 1 - e);
646
+ const w = o.getWorldQuaternion(k.rq).invert();
647
+ for (let p = 0; p < 10; p += 1)
648
+ for (const y of pn) {
649
+ const l = t.bones[y];
650
+ if (!(l != null && l.parent) || (o.updateMatrixWorld(!0), St(l, k.head), St(u, k.eff), k.a.subVectors(k.eff, k.head), k.b.subVectors(k.target, k.head), k.a.lengthSq() < 1e-10 || k.b.lengthSq() < 1e-10)) continue;
651
+ k.q.setFromUnitVectors(k.a.normalize(), k.b.normalize()), l.parent.getWorldQuaternion(k.pq).premultiply(w), l.quaternion.premultiply(k.pqInv.copy(k.pq).invert().multiply(k.q).multiply(k.pq));
652
+ const g = t.restLocal[y], d = fn[y] ?? Math.PI, T = l.quaternion.angleTo(g);
653
+ T > d && l.quaternion.copy(k.limited.copy(g).slerp(l.quaternion, d / T));
654
+ }
655
+ }, bn = 2 * Math.acos(2 / 3) / Math.PI, Jt = (t, { seconds: n = 2.4, hold: e = bn, from: o = 0, easing: s = it } = {}) => {
656
+ if (n <= 0) return { phase: 0.5, drive: 1, closing: !1, amount: 1 };
657
+ const r = t % n / n, a = 1 / Math.max(Math.cos(Math.PI * i.MathUtils.clamp(e, 0, 0.95) / 2), 1e-3), c = i.MathUtils.clamp(Math.sin(r * Math.PI) * a, 0, 1);
658
+ return { phase: r, drive: c, closing: r < 0.5, amount: o + (1 - o) * s(c) };
659
+ }, wn = (t, n, e) => e > 0 ? Math.sin(t / e * Math.PI * 2) * i.MathUtils.degToRad(n) : 0, Zt = ({
660
+ height: t,
661
+ span: n,
662
+ mirrored: e = !1,
663
+ orbit: o = 0,
664
+ orbitSeconds: s = 6,
665
+ glow: r = null,
666
+ glowSize: a = 1.75,
667
+ renderOrder: c = 0,
668
+ children: m
669
+ }) => {
670
+ const h = E(null);
671
+ Z(({ clock: u }) => {
672
+ h.current && (h.current.rotation.y = wn(u.elapsedTime, o, s));
673
+ });
674
+ const f = t / n;
675
+ return /* @__PURE__ */ Vt("group", { scale: [f * (e ? -1 : 1), f, f], children: [
676
+ r && // Behind the hint, not orbiting: drawn first in the band (before the depth pre-pass).
677
+ /* @__PURE__ */ x(
678
+ "mesh",
679
+ {
680
+ material: r,
681
+ position: [0, 0, -n * 0.6],
682
+ scale: n * a,
683
+ renderOrder: c - 0.75,
684
+ children: /* @__PURE__ */ x("planeGeometry", { args: [1, 1] })
685
+ }
686
+ ),
687
+ /* @__PURE__ */ x("group", { ref: h, children: m })
688
+ ] });
689
+ }, Mn = { width: 0.3, color: "#0f172a", opacity: 0.3 }, Tn = { color: "#ffffff", size: 1.75, idle: 0.5, full: 0.85 }, xn = { opacity: 0.9, whiten: 0.55, idle: 0.25 }, Wt = (t, n, e) => e === !1 || n === !1 && e === void 0 ? !1 : { ...t, ...n || {}, ...e || {} }, Sn = (t, n = {}) => {
690
+ var o;
691
+ const e = {};
692
+ for (const [s, r] of Object.entries({ ...t.parts, ...n.parts }))
693
+ r && (e[s] = { ...((o = t.parts) == null ? void 0 : o[s]) ?? {}, ...r });
694
+ return {
695
+ ghost: { ...t.ghost, ...n.ghost },
696
+ parts: e,
697
+ halo: Wt(Mn, t.halo, n.halo),
698
+ glow: Wt(Tn, t.glow, n.glow),
699
+ highlight: Wt(xn, t.highlight, n.highlight),
700
+ matcap: n.matcap ?? t.matcap,
701
+ material: n.material ?? t.material
702
+ };
703
+ }, Te = (t) => JSON.stringify(
704
+ t ?? {},
705
+ (n, e) => n === "matcap" || n === "material" ? void 0 : e
706
+ ), te = (t, n, { base: e = {}, renderOrder: o } = {}) => {
707
+ const s = Te(n) + Te(e), r = R(
708
+ () => Sn(e, n),
709
+ [s, n == null ? void 0 : n.matcap, n == null ? void 0 : n.material, e.matcap, e.material]
710
+ // eslint-disable-line react-hooks/exhaustive-deps
711
+ ), { object: a, meshes: c } = R(() => {
712
+ const l = Ve(t);
713
+ return { object: l, meshes: $e(l) };
714
+ }, [t]), m = R(() => tn(a), [a]), h = R(() => r.matcap ? null : je(), [r.matcap]);
715
+ j(() => () => h == null ? void 0 : h.dispose(), [h]);
716
+ const f = r.matcap ?? h, u = R(() => {
717
+ const l = /* @__PURE__ */ new Map();
718
+ if (r.material) return l;
719
+ const { highlight: g } = r;
720
+ for (const { mesh: d } of c) {
721
+ const T = d.material.name;
722
+ l.has(T) || l.set(
723
+ T,
724
+ qe(f, {
725
+ vertexColors: m,
726
+ ...g ? { highlightOpacity: g.opacity, highlightWhiten: g.whiten } : {},
727
+ ...r.ghost,
728
+ ...r.parts[T] ?? {}
729
+ })
730
+ );
731
+ }
732
+ return l;
733
+ }, [c, f, m, r]);
734
+ j(() => () => u.forEach((l) => l.dispose()), [u]);
735
+ const b = R(
736
+ () => new Map(
737
+ c.map(({ mesh: l }) => [
738
+ l,
739
+ r.material ?? u.get(l.material.name)
740
+ ])
741
+ ),
742
+ [c, u, r.material]
743
+ ), w = R(() => Ye(), []);
744
+ j(() => () => w.dispose(), [w]);
745
+ const p = R(() => {
746
+ var d;
747
+ a.updateMatrixWorld(!0);
748
+ const l = ((d = c[0]) == null ? void 0 : d.mesh.getWorldScale(new i.Vector3()).x) || 1, g = r.halo || { width: 0, color: "#000000", opacity: 0 };
749
+ return Ke({ ...g, width: g.width / l, vertexColors: m });
750
+ }, [a, c, m, r.halo]);
751
+ j(() => () => p.dispose(), [p]);
752
+ const y = R(
753
+ () => r.glow ? Je(r.glow.color, r.glow.idle) : null,
754
+ [r.glow]
755
+ );
756
+ return j(
757
+ () => () => {
758
+ y && Ze(y);
759
+ },
760
+ [y]
761
+ ), j(() => {
762
+ Qe(a, {
763
+ main: (l) => b.get(l) ?? r.material ?? u.values().next().value,
764
+ prepass: w,
765
+ halo: p,
766
+ showHalo: r.halo !== !1,
767
+ renderOrder: o
768
+ });
769
+ }, [a, b, u, w, p, r, o]), R(() => {
770
+ const l = () => [...u.values()].map((g) => g.userData.ghost).filter((g) => !!g);
771
+ return {
772
+ object: a,
773
+ meshes: c,
774
+ materials: u,
775
+ glowMaterial: y,
776
+ look: r,
777
+ setHighlight: (g) => {
778
+ var d, T;
779
+ for (const S of l()) S.uHighlight.value.fill(0);
780
+ if (r.highlight)
781
+ for (const { mesh: S } of c) {
782
+ if (!(S instanceof i.SkinnedMesh)) continue;
783
+ const B = (T = (d = b.get(S)) == null ? void 0 : d.userData.ghost) == null ? void 0 : T.uHighlight;
784
+ B && S.skeleton.bones.forEach((_, q) => {
785
+ q < Ft && (B.value[q] = Math.max(B.value[q], g(_)));
786
+ });
787
+ }
788
+ },
789
+ setStrength: (g) => {
790
+ if (r.highlight) {
791
+ const { idle: d } = r.highlight;
792
+ for (const T of l()) T.uHighlightGain.value = d + (1 - d) * g;
793
+ }
794
+ if (y && r.glow) {
795
+ const d = r.glow.idle + (r.glow.full - r.glow.idle) * g;
796
+ y.userData.baseOpacity = d, y.opacity = d;
797
+ }
798
+ }
799
+ };
800
+ }, [a, c, u, b, y, r]);
801
+ }, On = {
802
+ halo: { width: 0.35 },
803
+ glow: { size: 1.75 }
804
+ }, xe = { seconds: 2.2, from: 0.35, stagger: 0.21 }, kn = {
805
+ thumb: ["thumbMcp", "thumbIp", "thumbTip"],
806
+ index: ["indexMcp", "indexPip", "indexDip", "indexTip"],
807
+ middle: ["middleMcp", "middlePip", "middleDip", "middleTip"],
808
+ ring: ["ringMcp", "ringPip", "ringDip", "ringTip"],
809
+ pinky: ["pinkyMcp", "pinkyPip", "pinkyDip", "pinkyTip"]
810
+ }, Rn = (t, n) => {
811
+ const e = t == null ? void 0 : t.rule;
812
+ if (e != null && e.thumbIndexTouch) return ["thumb", "index"];
813
+ if (e != null && e.thumbDirection) return ["thumb"];
814
+ const o = bt.filter((s) => n[s]);
815
+ return o.length > 0 && o.length < bt.length ? o : [];
816
+ }, vn = (t) => {
817
+ const e = t - 1;
818
+ return 1 + (0.9 + 1) * e * e * e + 0.9 * e * e;
819
+ }, Se = {
820
+ pinky: 0,
821
+ ring: 1 / 3,
822
+ middle: 2 / 3,
823
+ thumb: 0.81,
824
+ index: 1
825
+ }, Hn = ({
826
+ gesture: t,
827
+ model: n,
828
+ poses: e,
829
+ modelHand: o = "right",
830
+ showHand: s = "right",
831
+ height: r = 1,
832
+ loop: a,
833
+ look: c,
834
+ highlight: m,
835
+ orbit: h = 35,
836
+ orbitSeconds: f = 6,
837
+ renderOrder: u
838
+ }) => {
839
+ const b = typeof t == "string" || "label" in t ? Xt(t) : void 0, w = JSON.stringify(b ? b.hint : t), p = R(
840
+ () => b ? b.hint : t,
841
+ [w]
842
+ // eslint-disable-line react-hooks/exhaustive-deps
843
+ ), y = JSON.stringify((b == null ? void 0 : b.rule) ?? null), l = te(n, c, { base: On, renderOrder: u }), g = l.object, d = R(() => Ae(g, o), [g, o]), T = (a == null ? void 0 : a.from) ?? xe.from, S = R(() => {
844
+ const O = (z) => d.restPositions[z], L = O(M.middleMcp).clone().sub(O(M.wrist)).normalize(), D = d.restPalmNormal.clone(), N = new i.Vector3().crossVectors(L, D).normalize(), U = new i.Vector3().crossVectors(D, N), C = new i.Matrix4().makeBasis(N, U, D).invert();
845
+ p.yaw && C.premultiply(new i.Matrix4().makeRotationY(-i.MathUtils.degToRad(p.yaw))), p.roll && C.premultiply(new i.Matrix4().makeRotationZ(i.MathUtils.degToRad(p.roll)));
846
+ const V = (z) => {
847
+ Ut(d, p, z, e), g.updateMatrixWorld(!0);
848
+ const P = g.matrixWorld.clone().invert(), X = Object.values(d.bones).filter((A) => !!A).map(
849
+ (A) => A.getWorldPosition(new i.Vector3()).applyMatrix4(P).applyMatrix4(C)
850
+ ), dt = [];
851
+ return g.traverse((A) => {
852
+ if (!(A instanceof i.SkinnedMesh) || A.userData[kt]) return;
853
+ A.skeleton.update(), A.computeBoundingBox();
854
+ const $ = A.boundingBox, ft = P.clone().multiply(A.matrixWorld);
855
+ for (const ot of [$.min.x, $.max.x])
856
+ for (const et of [$.min.y, $.max.y])
857
+ for (const pt of [$.min.z, $.max.z])
858
+ dt.push(new i.Vector3(ot, et, pt).applyMatrix4(ft).applyMatrix4(C));
859
+ }), [...X, ...dt];
860
+ }, F = V(1), nt = g.matrixWorld.clone().invert(), at = ke(
861
+ Ce.map((z) => {
862
+ var X;
863
+ const P = (X = d.bones[z]) == null ? void 0 : X.getWorldPosition(new i.Vector3()).applyMatrix4(nt);
864
+ return { x: (P == null ? void 0 : P.x) ?? 0, y: (P == null ? void 0 : P.y) ?? 0, z: (P == null ? void 0 : P.z) ?? 0 };
865
+ })
866
+ ), ct = (z) => F[Object.keys(d.bones).filter((P) => d.bones[P]).indexOf(z)];
867
+ let lt = 0;
868
+ if (p.aimThumb) {
869
+ const z = ct("thumbCmc"), P = ct(d.bones.thumbTip ? "thumbTip" : "thumbIp");
870
+ lt = (p.aimThumb === "up" ? Math.PI / 2 : -Math.PI / 2) - Math.atan2(P.y - z.y, P.x - z.x);
871
+ }
872
+ const tt = new i.Matrix4().makeRotationZ(lt), ut = [...V(T), ...V(0.7), ...F].map((z) => z.applyMatrix4(tt));
873
+ Ut(d, p, 0, e);
874
+ const ht = new i.Box3().setFromPoints(ut).getCenter(new i.Vector3()), mt = ht.clone().applyMatrix4(tt.clone().invert()), It = Qt(ut, ht, i.MathUtils.degToRad(h)) * 1.06;
875
+ return { matrix: new i.Matrix4().makeTranslation(-mt.x, -mt.y, -mt.z).multiply(C), span: It, extended: at.extended };
876
+ }, [d, g, p, e, h, T]), B = m === !1 ? "off" : (m ?? []).join();
877
+ j(() => {
878
+ const O = y === "null" ? void 0 : JSON.parse(y), L = m === !1 ? [] : m ?? p.highlight ?? Rn(O ? { rule: O } : void 0, S.extended), D = new Set(L.flatMap((N) => kn[N]));
879
+ l.setHighlight((N) => D.has(N.name) ? 1 : 0);
880
+ }, [l, p, y, B, S]);
881
+ const _ = E(null), q = R(() => ({ a: new i.Vector3(), b: new i.Vector3() }), []), Q = JSON.stringify(a ?? {}), v = R(
882
+ () => ({ ...xe, ...a }),
883
+ [Q, a == null ? void 0 : a.easing]
884
+ // eslint-disable-line react-hooks/exhaustive-deps
885
+ ), I = R(() => {
886
+ const O = { drive: 0, closing: !0 };
887
+ return { state: O, amount: (D) => {
888
+ const N = i.MathUtils.clamp(v.stagger ?? 0, 0, 0.9), U = O.closing ? Se[D] : 1 - Se[D], C = i.MathUtils.clamp((O.drive - U * N) / (1 - N), 0, 1), V = v.easing ? v.easing(C) : O.closing ? vn(C) : it(C), F = v.from ?? 0;
889
+ return F + (1 - F) * V;
890
+ } };
891
+ }, [v]);
892
+ Z(({ clock: O }) => {
893
+ const { drive: L, closing: D } = Jt(O.elapsedTime, v);
894
+ I.state.drive = L, I.state.closing = D, Ut(d, p, I.amount, e), l.setStrength(it(L));
895
+ const N = _.current;
896
+ if (N && (N.rotation.z = 0, p.aimThumb)) {
897
+ N.updateMatrixWorld(!0);
898
+ const U = d.bones.thumbCmc.getWorldPosition(q.a), C = (d.bones.thumbTip ?? d.bones.thumbIp).getWorldPosition(q.b);
899
+ N.worldToLocal(U), N.worldToLocal(C);
900
+ const V = Math.atan2(C.y - U.y, C.x - U.x);
901
+ N.rotation.z = (p.aimThumb === "up" ? Math.PI / 2 : -Math.PI / 2) - V;
902
+ }
903
+ });
904
+ const K = l.look.glow;
905
+ return /* @__PURE__ */ x(
906
+ Zt,
907
+ {
908
+ height: r,
909
+ span: S.span,
910
+ mirrored: s !== o,
911
+ orbit: h,
912
+ orbitSeconds: f,
913
+ glow: l.glowMaterial,
914
+ glowSize: K ? K.size : void 0,
915
+ renderOrder: u,
916
+ children: /* @__PURE__ */ x("group", { ref: _, children: /* @__PURE__ */ x("group", { matrixAutoUpdate: !1, matrix: S.matrix, children: /* @__PURE__ */ x("primitive", { object: g }) }) })
917
+ }
918
+ );
919
+ }, _n = (t, { hand: n = "any", limits: e, active: o = !0, ...s } = {}) => {
920
+ const { node: r } = $t(Kt.HAND_TRACKER, void 0, o), a = st(t), c = qt(a, s), m = E({}), h = E(t);
921
+ h.current = t;
922
+ const f = JSON.stringify(e ?? null), u = R(() => ({ limits: e }), [f]), b = E(n);
923
+ b.current = n;
924
+ const w = jt(() => {
925
+ const p = m.current, y = b.current;
926
+ return y === "any" ? !!(p.left || p.right) : !!p[y];
927
+ }, []);
928
+ return Z(() => {
929
+ var y;
930
+ if (!o) return;
931
+ let p = !1;
932
+ for (const l of ["left", "right"]) {
933
+ const g = (y = r == null ? void 0 : r.poses) == null ? void 0 : y[l];
934
+ if (!g || g.held || g.world.length < 21) {
935
+ delete m.current[l];
936
+ continue;
937
+ }
938
+ const d = ke(g.world, u);
939
+ m.current[l] = d, (n === "any" || n === l) && ve(d, h.current, l) && (p = !0);
940
+ }
941
+ c.step(p);
942
+ }), {
943
+ status: c.status,
944
+ holdRef: c.holdRef,
945
+ matchedRef: c.matchedRef,
946
+ isInView: w,
947
+ reset: c.reset,
948
+ shapesRef: m
949
+ };
950
+ }, fo = Ht, In = "Show your hand to the camera", Nn = ({
951
+ gesture: t,
952
+ model: n,
953
+ poses: e,
954
+ modelHand: o = "right",
955
+ hand: s = "any",
956
+ holdMs: r,
957
+ graceMs: a,
958
+ limits: c,
959
+ orbit: m,
960
+ look: h,
961
+ loop: f,
962
+ highlight: u,
963
+ onComplete: b,
964
+ nudgeText: w = In,
965
+ ...p
966
+ }) => {
967
+ const y = Yt(), l = _n(t, { hand: s, holdMs: r, graceMs: a, limits: c, onComplete: b }), g = Be(s === "any" ? "right" : s, y);
968
+ return /* @__PURE__ */ x(
969
+ _t,
970
+ {
971
+ ...p,
972
+ nudgeText: w,
973
+ detector: l,
974
+ symbol: (d, T) => /* @__PURE__ */ x(
975
+ Hn,
976
+ {
977
+ gesture: t,
978
+ model: n,
979
+ poses: e,
980
+ modelHand: o,
981
+ showHand: g,
982
+ height: d,
983
+ loop: f,
984
+ look: h,
985
+ highlight: u,
986
+ orbit: m,
987
+ renderOrder: T
988
+ }
989
+ )
990
+ }
991
+ );
992
+ }, po = ({ active: t = !0, text: n, ...e }) => t ? /* @__PURE__ */ x(Rt, { children: /* @__PURE__ */ x(
993
+ Nn,
994
+ {
995
+ ...e,
996
+ text: n ?? Xt(e.gesture).label
997
+ },
998
+ st(e.gesture)
999
+ ) }) : null, go = (t) => {
1000
+ if (!t.rule && !t.match)
1001
+ throw new Error("defineFaceExpression needs a rule or a match function");
1002
+ return t;
1003
+ }, He = {
1004
+ smile: {
1005
+ label: "Give a big smile",
1006
+ rule: { atLeast: { mouthSmileLeft: 0.45, mouthSmileRight: 0.45 } },
1007
+ hint: { target: "smile" }
1008
+ },
1009
+ wink: {
1010
+ label: "Wink at the camera",
1011
+ rule: {
1012
+ anyOf: [
1013
+ { atLeast: { eyeBlinkLeft: 0.55 }, atMost: { eyeBlinkRight: 0.3 } },
1014
+ { atLeast: { eyeBlinkRight: 0.55 }, atMost: { eyeBlinkLeft: 0.3 } }
1015
+ ]
1016
+ },
1017
+ hint: { target: "wink" }
1018
+ },
1019
+ surprised: {
1020
+ label: "Look surprised",
1021
+ rule: { atLeast: { jawOpen: 0.35, browInnerUp: 0.4 } },
1022
+ hint: { target: "surprised" }
1023
+ },
1024
+ kiss: {
1025
+ label: "Blow a kiss",
1026
+ rule: { atLeast: { mouthPucker: 0.5 }, atMost: { jawOpen: 0.3 } },
1027
+ hint: { target: "kiss" }
1028
+ },
1029
+ puffCheeks: {
1030
+ label: "Puff your cheeks",
1031
+ rule: { atLeast: { cheekPuff: 0.3 } },
1032
+ hint: { target: "puffCheeks" }
1033
+ },
1034
+ // Shares the brows-down signal with `scrunch`, so a scrunch also completes a
1035
+ // frown prompt — deliberate (both read as a cross face); `scrunch` alone
1036
+ // needs the nose sneer or the squint on top.
1037
+ frown: {
1038
+ label: "Frown",
1039
+ rule: { atLeast: { browDownLeft: 0.4, browDownRight: 0.4 } },
1040
+ hint: { target: "frown" }
1041
+ },
1042
+ scrunch: {
1043
+ label: "Scrunch your face",
1044
+ rule: {
1045
+ anyOf: [
1046
+ { atLeast: { noseSneerLeft: 0.3, noseSneerRight: 0.3 } },
1047
+ {
1048
+ atLeast: {
1049
+ eyeSquintLeft: 0.45,
1050
+ eyeSquintRight: 0.45,
1051
+ browDownLeft: 0.3,
1052
+ browDownRight: 0.3
1053
+ }
1054
+ }
1055
+ ]
1056
+ },
1057
+ hint: { target: "scrunch" }
1058
+ }
1059
+ }, En = Object.keys(He), Gt = (t, n) => {
1060
+ for (const [e, o] of Object.entries(n.atLeast ?? {}))
1061
+ if ((t[e] ?? 0) < (o ?? 0)) return !1;
1062
+ for (const [e, o] of Object.entries(n.atMost ?? {}))
1063
+ if ((t[e] ?? 0) > (o ?? 1)) return !1;
1064
+ return !(n.anyOf && n.anyOf.length > 0 && !n.anyOf.some((e) => Gt(t, e)));
1065
+ }, ee = (t) => typeof t == "string" ? He[t] : typeof t == "object" && "hint" in t ? t : void 0, _e = (t, n, e) => {
1066
+ if (typeof n == "function") return n(t, e);
1067
+ const o = ee(n);
1068
+ return o ? o.rule && !Gt(t, o.rule) ? !1 : o.match ? o.match(t, e) : !!o.rule : Gt(t, n);
1069
+ }, yo = (t) => En.filter((n) => _e(t, n)), Dn = (t, n, e) => {
1070
+ const o = n ? de(n) : /* @__PURE__ */ new Map(), s = e ? de(e) : /* @__PURE__ */ new Map(), r = [];
1071
+ for (const h of /* @__PURE__ */ new Set([...o.keys(), ...s.keys()])) {
1072
+ const f = t.getObjectByName(h);
1073
+ if (!f) continue;
1074
+ const u = f.quaternion.clone();
1075
+ r.push({ node: f, from: o.get(h) ?? u, to: s.get(h) ?? u });
1076
+ }
1077
+ const a = n ? pe(n) : /* @__PURE__ */ new Map(), c = e ? pe(e) : /* @__PURE__ */ new Map(), m = [];
1078
+ for (const h of /* @__PURE__ */ new Set([...a.keys(), ...c.keys()])) {
1079
+ const f = t.getObjectByName(h);
1080
+ if (!f) continue;
1081
+ const u = f.position.clone();
1082
+ m.push({ node: f, from: a.get(h) ?? u, to: c.get(h) ?? u });
1083
+ }
1084
+ return {
1085
+ apply: (h) => {
1086
+ for (const f of r) f.node.quaternion.copy(f.from).slerp(f.to, h);
1087
+ for (const f of m) f.node.position.lerpVectors(f.from, f.to, h);
1088
+ }
1089
+ };
1090
+ }, Pn = (t, n) => {
1091
+ const e = t.filter((o) => o.morphTargetInfluences && o.morphTargetDictionary).map((o) => ({
1092
+ influences: o.morphTargetInfluences,
1093
+ weights: Object.entries(n).map(([s, r]) => [o.morphTargetDictionary[s] ?? -1, r]).filter(([s]) => s >= 0)
1094
+ }));
1095
+ return {
1096
+ apply: (o) => {
1097
+ for (const { influences: s, weights: r } of e) {
1098
+ s.fill(0);
1099
+ for (const [a, c] of r) s[a] = c * o;
1100
+ }
1101
+ }
1102
+ };
1103
+ }, Cn = {
1104
+ parts: {
1105
+ eye_white: { core: 0.62 },
1106
+ iris: { color: "#2a2732", core: 0.9, rim: 0.95, whiten: 0.12 },
1107
+ sparkle: { core: 0.95, rim: 0.95 },
1108
+ lash: { color: "#3b302c", core: 0.88, rim: 0.92, whiten: 0.12 },
1109
+ brow: { color: "#4a3a33", core: 0.85, rim: 0.92, whiten: 0.15 },
1110
+ lip: { color: "#c47878", core: 0.8, rim: 0.9, whiten: 0.2 },
1111
+ mouth_inside: { color: "#2b1517", core: 0.9, rim: 0.92, whiten: 0.08 },
1112
+ tongue: { color: "#e88a8a", core: 0.85, rim: 0.9, whiten: 0.15 }
1113
+ },
1114
+ halo: { width: 0.3 },
1115
+ glow: { size: 1.75 }
1116
+ }, An = { seconds: 2.4 }, Bn = ({
1117
+ expression: t,
1118
+ model: n,
1119
+ height: e = 1,
1120
+ loop: o,
1121
+ look: s,
1122
+ orbit: r = 30,
1123
+ orbitSeconds: a = 6,
1124
+ renderOrder: c
1125
+ }) => {
1126
+ const m = typeof t == "string" || "label" in t ? ee(t).hint : t, h = JSON.stringify("targets" in m ? m.targets : { [m.target]: 1 }), f = te(n, s, { base: Cn, renderOrder: c }), u = f.object, b = R(
1127
+ () => Pn(
1128
+ f.meshes.flatMap(({ mesh: g, twins: d }) => [g, ...d]),
1129
+ JSON.parse(h)
1130
+ ),
1131
+ [f.meshes, h]
1132
+ ), w = R(() => {
1133
+ u.updateMatrixWorld(!0);
1134
+ const g = [];
1135
+ for (const { mesh: S } of f.meshes) {
1136
+ const B = S.geometry.getAttribute("position");
1137
+ for (let _ = 0; _ < B.count; _ += 3)
1138
+ g.push(
1139
+ new i.Vector3().fromBufferAttribute(B, _).applyMatrix4(S.matrixWorld)
1140
+ );
1141
+ }
1142
+ const d = new i.Box3().setFromPoints(g).getCenter(new i.Vector3()), T = Qt(g, d, i.MathUtils.degToRad(r)) * 1.08;
1143
+ return { offset: d.clone().negate(), span: T };
1144
+ }, [u, f.meshes, r]), p = JSON.stringify(o ?? {}), y = R(
1145
+ () => ({ ...An, ...o }),
1146
+ [p, o == null ? void 0 : o.easing]
1147
+ // eslint-disable-line react-hooks/exhaustive-deps
1148
+ );
1149
+ Z(({ clock: g }) => {
1150
+ const { amount: d } = Jt(g.elapsedTime, y);
1151
+ b.apply(d), f.setStrength(d);
1152
+ });
1153
+ const l = f.look.glow;
1154
+ return /* @__PURE__ */ x(
1155
+ Zt,
1156
+ {
1157
+ height: e,
1158
+ span: w.span,
1159
+ orbit: r,
1160
+ orbitSeconds: a,
1161
+ glow: f.glowMaterial,
1162
+ glowSize: l ? l.size : void 0,
1163
+ renderOrder: c,
1164
+ children: /* @__PURE__ */ x("group", { position: w.offset, children: /* @__PURE__ */ x("primitive", { object: u }) })
1165
+ }
1166
+ );
1167
+ }, Ln = (t, { faceIndex: n = 0, active: e = !0, ...o } = {}) => {
1168
+ const s = R(() => ({ numFaces: n + 1 }), [n]), { node: r, ready: a } = $t(
1169
+ Kt.FACE_TRACKER,
1170
+ s,
1171
+ e
1172
+ ), { camera: c } = De();
1173
+ j(() => {
1174
+ r == null || r.setCamera(c, n);
1175
+ }, [c, n, r]);
1176
+ const m = qt(st(t), o), h = E(null), f = E(Fe()), u = E(t);
1177
+ u.current = t;
1178
+ const b = jt(() => h.current !== null, []);
1179
+ return Z(() => {
1180
+ if (!e) return;
1181
+ const w = a && r ? Ge(r, n, f.current) : null;
1182
+ h.current = w, m.step(!!w && _e(w.blendshapes, u.current, w));
1183
+ }), {
1184
+ status: m.status,
1185
+ holdRef: m.holdRef,
1186
+ matchedRef: m.matchedRef,
1187
+ isInView: b,
1188
+ reset: m.reset,
1189
+ faceRef: h
1190
+ };
1191
+ }, bo = Ht, zn = "Show your face to the camera", Un = ({
1192
+ expression: t,
1193
+ model: n,
1194
+ faceIndex: e,
1195
+ holdMs: o,
1196
+ graceMs: s,
1197
+ orbit: r,
1198
+ look: a,
1199
+ loop: c,
1200
+ onComplete: m,
1201
+ nudgeText: h = zn,
1202
+ ...f
1203
+ }) => {
1204
+ const u = Ln(t, { faceIndex: e, holdMs: o, graceMs: s, onComplete: m });
1205
+ return /* @__PURE__ */ x(
1206
+ _t,
1207
+ {
1208
+ ...f,
1209
+ nudgeText: h,
1210
+ detector: u,
1211
+ symbol: (b, w) => /* @__PURE__ */ x(
1212
+ Bn,
1213
+ {
1214
+ expression: t,
1215
+ model: n,
1216
+ height: b,
1217
+ orbit: r,
1218
+ look: a,
1219
+ loop: c,
1220
+ renderOrder: w
1221
+ }
1222
+ )
1223
+ }
1224
+ );
1225
+ }, wo = ({ active: t = !0, text: n, ...e }) => t ? /* @__PURE__ */ x(Rt, { children: /* @__PURE__ */ x(
1226
+ Un,
1227
+ {
1228
+ ...e,
1229
+ text: n ?? ee(e.expression).label
1230
+ },
1231
+ st(e.expression)
1232
+ ) }) : null, Wn = {
1233
+ parts: { joints: { color: "#7c8aa0", core: 0.7, rim: 0.9, whiten: 0.35 } },
1234
+ halo: { width: 1.2 },
1235
+ glow: { size: 1.3 }
1236
+ }, Oe = /* @__PURE__ */ new Set(), Vn = { seconds: 2.6 }, Fn = (t) => {
1237
+ for (const [n, e] of [
1238
+ ["left", "Left"],
1239
+ ["right", "Right"]
1240
+ ])
1241
+ if (t === `${e}Arm` || t === `${e}ForeArm` || t.startsWith(`${e}Hand`)) return n;
1242
+ return null;
1243
+ }, Gn = (t) => {
1244
+ for (const [n, e] of [
1245
+ ["left", "Left"],
1246
+ ["right", "Right"]
1247
+ ])
1248
+ if (t === `${e}UpLeg` || t === `${e}Leg` || t === `${e}Foot` || t.startsWith(`${e}Toe`))
1249
+ return n;
1250
+ return null;
1251
+ }, jn = ({
1252
+ pose: t,
1253
+ model: n,
1254
+ poses: e,
1255
+ idleClip: o = "idle",
1256
+ height: s = 1,
1257
+ mirrored: r = !1,
1258
+ loop: a,
1259
+ look: c,
1260
+ highlight: m = !0,
1261
+ boneSide: h = Fn,
1262
+ legBoneSide: f = Gn,
1263
+ orbit: u = 25,
1264
+ orbitSeconds: b = 7,
1265
+ renderOrder: w
1266
+ }) => {
1267
+ const p = typeof t == "string" || "label" in t ? vt(t).hint : t, y = p.clip, l = (p.arms ?? []).join(), g = (p.legs ?? []).join(), d = te(n, c, { base: Wn, renderOrder: w }), T = d.object, S = R(
1268
+ () => Dn(
1269
+ T,
1270
+ e.find((v) => v.name === o),
1271
+ e.find((v) => v.name === y)
1272
+ ),
1273
+ [T, e, o, y]
1274
+ );
1275
+ j(() => {
1276
+ const v = e.map((I) => I.name);
1277
+ for (const [I, K] of [
1278
+ [o, "rest"],
1279
+ [y, "pose"]
1280
+ ])
1281
+ v.includes(I) || Oe.has(I) || (Oe.add(I), console.warn(
1282
+ `[BodyPoseHint] the model has no "${I}" clip (the ${K === "rest" ? "rest pose the hint loops from" : "pose to show"}); the figure uses its bind pose there instead. Clips found: ${v.join(", ") || "none"}.`
1283
+ ));
1284
+ }, [e, o, y]), j(() => {
1285
+ const v = l ? l.split(",") : [], I = g ? g.split(",") : [];
1286
+ d.setHighlight((K) => {
1287
+ if (!m) return 0;
1288
+ const O = h(K.name);
1289
+ if (O && v.includes(O)) return 1;
1290
+ const L = f(K.name);
1291
+ return L && I.includes(L) ? 1 : 0;
1292
+ });
1293
+ }, [d, l, g, m, h, f]);
1294
+ const B = R(() => {
1295
+ const v = [], I = new i.Matrix4();
1296
+ for (const L of [0, 0.6, 1]) {
1297
+ S.apply(L), T.updateMatrixWorld(!0), I.copy(T.matrixWorld).invert();
1298
+ for (const { mesh: D } of d.meshes) {
1299
+ if (!(D instanceof i.SkinnedMesh)) continue;
1300
+ D.skeleton.update();
1301
+ const N = D.geometry.getAttribute("position");
1302
+ for (let U = 0; U < N.count; U += 12) {
1303
+ const C = new i.Vector3().fromBufferAttribute(N, U);
1304
+ D.applyBoneTransform(U, C), v.push(C.applyMatrix4(D.matrixWorld).applyMatrix4(I));
1305
+ }
1306
+ }
1307
+ }
1308
+ S.apply(0);
1309
+ const K = new i.Box3().setFromPoints(v).getCenter(new i.Vector3()), O = Qt(v, K, i.MathUtils.degToRad(u)) * 1.06;
1310
+ return { offset: K.clone().negate(), span: O };
1311
+ }, [T, d.meshes, S, u]), _ = JSON.stringify(a ?? {}), q = R(
1312
+ () => ({ ...Vn, ...a }),
1313
+ [_, a == null ? void 0 : a.easing]
1314
+ // eslint-disable-line react-hooks/exhaustive-deps
1315
+ );
1316
+ Z(({ clock: v }) => {
1317
+ const { amount: I } = Jt(v.elapsedTime, q);
1318
+ S.apply(I), d.setStrength(I);
1319
+ });
1320
+ const Q = d.look.glow;
1321
+ return /* @__PURE__ */ x(
1322
+ Zt,
1323
+ {
1324
+ height: s,
1325
+ span: B.span,
1326
+ mirrored: r,
1327
+ orbit: u,
1328
+ orbitSeconds: b,
1329
+ glow: d.glowMaterial,
1330
+ glowSize: Q ? Q.size : void 0,
1331
+ renderOrder: w,
1332
+ children: /* @__PURE__ */ x("group", { position: B.offset, children: /* @__PURE__ */ x("primitive", { object: T }) })
1333
+ }
1334
+ );
1335
+ }, qn = (t, { bodyIndex: n = 0, limits: e, active: o = !0, ...s } = {}) => {
1336
+ const { node: r, ready: a } = $t(
1337
+ Kt.BODY_TRACKER,
1338
+ void 0,
1339
+ o
1340
+ ), c = Yt(), m = We(), h = qt(st(t), s), f = E(null), u = E(t);
1341
+ u.current = t;
1342
+ const b = JSON.stringify(e ?? null), w = R(() => e, [b]), p = jt(() => {
1343
+ var l;
1344
+ const y = f.current;
1345
+ return y != null && y.upperBodyVisible ? ((l = vt(u.current)) == null ? void 0 : l.view) !== "full" || y.lowerBodyVisible : !1;
1346
+ }, []);
1347
+ return Z(() => {
1348
+ var g;
1349
+ if (!o) return;
1350
+ const y = a && r ? r.getLandmarks2D(n) : void 0, l = y && y.length >= Le ? ze(y, {
1351
+ mirrored: c,
1352
+ visibility: (g = r == null ? void 0 : r.getVisibility) == null ? void 0 : g.call(r, n),
1353
+ limits: w,
1354
+ aspect: m
1355
+ }) : null;
1356
+ f.current = l, h.step(!!l && l.upperBodyVisible && Ue(l, u.current));
1357
+ }), {
1358
+ status: h.status,
1359
+ holdRef: h.holdRef,
1360
+ matchedRef: h.matchedRef,
1361
+ isInView: p,
1362
+ reset: h.reset,
1363
+ shapeRef: f
1364
+ };
1365
+ }, Mo = Ht, Kn = (t) => {
1366
+ var n;
1367
+ return ((n = vt(t)) == null ? void 0 : n.view) === "full";
1368
+ }, Yn = 2.1, $n = "Step back so your upper body is in view", Qn = "Step back so your whole body is in view", Xn = ({
1369
+ pose: t,
1370
+ model: n,
1371
+ poses: e,
1372
+ idleClip: o,
1373
+ bodyIndex: s,
1374
+ holdMs: r,
1375
+ graceMs: a,
1376
+ limits: c,
1377
+ symbolAspect: m = Yn,
1378
+ orbit: h,
1379
+ look: f,
1380
+ loop: u,
1381
+ boneSide: b,
1382
+ legBoneSide: w,
1383
+ onComplete: p,
1384
+ nudgeText: y,
1385
+ ...l
1386
+ }) => {
1387
+ const g = Yt(), d = qn(t, { bodyIndex: s, holdMs: r, graceMs: a, limits: c, onComplete: p });
1388
+ return /* @__PURE__ */ x(
1389
+ _t,
1390
+ {
1391
+ ...l,
1392
+ nudgeText: y !== void 0 ? y : Kn(t) ? Qn : $n,
1393
+ detector: d,
1394
+ symbolAspect: m,
1395
+ symbol: (T, S) => /* @__PURE__ */ x(
1396
+ jn,
1397
+ {
1398
+ pose: t,
1399
+ model: n,
1400
+ poses: e,
1401
+ idleClip: o,
1402
+ height: T,
1403
+ mirrored: g,
1404
+ orbit: h,
1405
+ look: f,
1406
+ loop: u,
1407
+ boneSide: b,
1408
+ legBoneSide: w,
1409
+ renderOrder: S
1410
+ }
1411
+ )
1412
+ }
1413
+ );
1414
+ }, To = ({ active: t = !0, text: n, ...e }) => t ? /* @__PURE__ */ x(Rt, { children: /* @__PURE__ */ x(
1415
+ Xn,
1416
+ {
1417
+ ...e,
1418
+ text: n ?? vt(e.pose).label
1419
+ },
1420
+ st(e.pose)
1421
+ ) }) : null;
1422
+ export {
1423
+ Wn as BODY_HINT_LOOK,
1424
+ Vn as BODY_HINT_LOOP,
1425
+ Qn as BODY_INSTRUCTION_FULL_NUDGE_TEXT,
1426
+ $n as BODY_INSTRUCTION_NUDGE_TEXT,
1427
+ Mo as BODY_INSTRUCTION_RENDER_ORDER,
1428
+ Le as BODY_LANDMARK_COUNT,
1429
+ Io as BODY_LOWER_JOINTS,
1430
+ No as BODY_POSES,
1431
+ Eo as BODY_POSE_JOINTS,
1432
+ Do as BODY_POSE_NAMES,
1433
+ Po as BODY_SHAPE_LIMITS,
1434
+ Yn as BODY_SYMBOL_ASPECT,
1435
+ Co as BODY_UPPER_JOINTS,
1436
+ To as BodyInstruction,
1437
+ jn as BodyPoseHint,
1438
+ He as FACE_EXPRESSIONS,
1439
+ En as FACE_EXPRESSION_NAMES,
1440
+ Cn as FACE_HINT_LOOK,
1441
+ An as FACE_HINT_LOOP,
1442
+ zn as FACE_INSTRUCTION_NUDGE_TEXT,
1443
+ bo as FACE_INSTRUCTION_RENDER_ORDER,
1444
+ Bn as FaceExpressionHint,
1445
+ wo as FaceInstruction,
1446
+ Oo as GESTURE_HOLD_DEFAULT_MS,
1447
+ ko as GESTURE_HOLD_GRACE_MS,
1448
+ Ft as GHOST_MAX_BONES,
1449
+ bt as HAND_DIGITS,
1450
+ Re as HAND_GESTURES,
1451
+ sn as HAND_GESTURE_NAMES,
1452
+ On as HAND_HINT_LOOK,
1453
+ xe as HAND_HINT_LOOP,
1454
+ In as HAND_INSTRUCTION_NUDGE_TEXT,
1455
+ fo as HAND_INSTRUCTION_RENDER_ORDER,
1456
+ ge as HAND_SHAPE_LIMITS,
1457
+ bn as HINT_LOOP_HOLD,
1458
+ Hn as HandGestureHint,
1459
+ po as HandInstruction,
1460
+ Zt as HintStage,
1461
+ Ht as INSTRUCTION_RENDER_ORDER,
1462
+ on as INSTRUCTION_TEXT_STYLE,
1463
+ uo as Instruction,
1464
+ $e as addHintTwins,
1465
+ ze as analyzeBodyShape,
1466
+ ke as analyzeHandShape,
1467
+ Ut as applyHandHintPose,
1468
+ Qe as assignHintMaterials,
1469
+ Dn as createClipBlend,
1470
+ Ye as createDepthPrepassMaterial,
1471
+ Ro as createGestureHoldState,
1472
+ qe as createGhostMaterial,
1473
+ Je as createGlowMaterial,
1474
+ Ke as createHaloMaterial,
1475
+ je as createHintMatcap,
1476
+ Pn as createMorphBlend,
1477
+ Ao as defineBodyPose,
1478
+ go as defineFaceExpression,
1479
+ ho as defineHandGesture,
1480
+ Ze as disposeGlowMaterial,
1481
+ it as ease,
1482
+ tn as hasVertexColors,
1483
+ Ue as matchBodyPose,
1484
+ _e as matchFaceExpression,
1485
+ ve as matchHandGesture,
1486
+ Bo as matchingBodyPoses,
1487
+ yo as matchingFaceExpressions,
1488
+ mo as matchingHandGestures,
1489
+ Sn as mergeHintLook,
1490
+ Fn as mixamoBoneSide,
1491
+ Gn as mixamoLegBoneSide,
1492
+ Qt as orbitSpan,
1493
+ de as readClipQuaternions,
1494
+ dn as readHandClipPose,
1495
+ vt as resolveBodyPose,
1496
+ ee as resolveFaceExpression,
1497
+ Xt as resolveHandGesture,
1498
+ Jt as sampleHintLoop,
1499
+ wn as sampleHintOrbit,
1500
+ Lo as squareLandmarks,
1501
+ vo as stepGestureHold,
1502
+ qn as useBodyPose,
1503
+ Ln as useFaceExpression,
1504
+ te as useGhostModel,
1505
+ _n as useHandGesture,
1506
+ Ho as useInstructionHold
1507
+ };