@volter/game-editor 0.5.65

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 (653) hide show
  1. package/BUNDLED_NOTICES +11228 -0
  2. package/LICENSE +686 -0
  3. package/LICENSE-BLENDER +1409 -0
  4. package/LICENSE-MCP +21 -0
  5. package/NOTICE +21 -0
  6. package/catalog/entries/audio.json +14 -0
  7. package/catalog/entries/bake.json +36 -0
  8. package/catalog/entries/blender.json +17 -0
  9. package/catalog/entries/react-root.json +24 -0
  10. package/catalog/entries/reflections.json +29 -0
  11. package/catalog/entries/static-batch.json +25 -0
  12. package/catalog/project-source/LICENSE +37 -0
  13. package/catalog/project-source/src/contributions/bake.kind.ts +40 -0
  14. package/catalog/project-source/src/contributions/builder-document.tsx +65 -0
  15. package/catalog/project-source/src/contributions/builder-state.ts +27 -0
  16. package/catalog/project-source/src/contributions/builder-ui.tsx +61 -0
  17. package/catalog/project-source/src/contributions/module-source.ts +502 -0
  18. package/catalog/project-source/src/contributions/pages.finder.ts +61 -0
  19. package/catalog/project-source/src/lib/audio/sfx.ts +255 -0
  20. package/catalog/project-source/src/lib/bake/asset-seed.ts +128 -0
  21. package/catalog/project-source/src/lib/bake/bake-schema.ts +65 -0
  22. package/catalog/project-source/src/lib/bake/clip-layering.ts +203 -0
  23. package/catalog/project-source/src/lib/bake/gltf-bake.ts +657 -0
  24. package/catalog/project-source/src/lib/bake/mesh-slice.ts +157 -0
  25. package/catalog/project-source/src/lib/bake/node-image.ts +463 -0
  26. package/catalog/project-source/src/lib/bake/object3d-bake.ts +121 -0
  27. package/catalog/project-source/src/lib/bake/object3d-lifecycle.ts +15 -0
  28. package/catalog/project-source/src/lib/bake/object3d-source.ts +8 -0
  29. package/catalog/project-source/src/lib/bake/params.ts +75 -0
  30. package/catalog/project-source/src/lib/bake/rest-relative-animation.ts +217 -0
  31. package/catalog/project-source/src/lib/bake/use-model.ts +95 -0
  32. package/catalog/project-source/src/lib/react-root/index.ts +20 -0
  33. package/catalog/project-source/src/lib/react-root/react-root-adapter.tsx +57 -0
  34. package/catalog/project-source/src/lib/reflections/ReflectionProbe.tsx +201 -0
  35. package/catalog/project-source/src/lib/reflections/index.ts +19 -0
  36. package/catalog/project-source/src/lib/reflections/probe-controller.ts +75 -0
  37. package/catalog/project-source/src/lib/reflections/reflection-probe-registry.ts +402 -0
  38. package/catalog/project-source/src/lib/reflections/volume-reflection-material.ts +416 -0
  39. package/catalog/project-source/src/lib/static-batch/Frozen.tsx +91 -0
  40. package/catalog/project-source/src/lib/static-batch/freeze.ts +579 -0
  41. package/catalog/project-source/src/lib/static-batch/index.ts +44 -0
  42. package/catalog/project-source/src/lib/static-batch/mutation-watch.ts +149 -0
  43. package/catalog/project-source/src/lib/static-batch/shadow-cache.ts +171 -0
  44. package/catalog/project-source/src/tools/bake-module.tool.ts +139 -0
  45. package/catalog/project-source/src/tools/bake-preview.tool.ts +475 -0
  46. package/dist/.vite/manifest.json +8304 -0
  47. package/dist/assets/AssetBudgetPanel-J9--TZPU.js +23 -0
  48. package/dist/assets/AudioViewer-CR7333fe.js +1 -0
  49. package/dist/assets/BVHLoader-6bQIXhMX.js +1 -0
  50. package/dist/assets/BufferGeometryUtils-Nz37EVXf.js +1 -0
  51. package/dist/assets/CCDIKSolver-CD7vLpsK.js +1 -0
  52. package/dist/assets/CSS3DRenderer-CL7ABLVK.js +1 -0
  53. package/dist/assets/CanvasSceneViewport-Bpi6gVTC.js +1 -0
  54. package/dist/assets/ColladaLoader-aVOPIsCh.js +3 -0
  55. package/dist/assets/ColorInput-DQBNrW-K.js +1 -0
  56. package/dist/assets/ConvexGeometry-CAzXlPVG.js +1 -0
  57. package/dist/assets/ConvexHull-BINCESFp.js +1 -0
  58. package/dist/assets/CopyShader-BzTUYzf6.js +24 -0
  59. package/dist/assets/DecalGeometry-160KRdfg.js +1 -0
  60. package/dist/assets/EXRLoader-Cdans_oJ.js +1 -0
  61. package/dist/assets/EffectComposer-DQxfsXBZ.js +1 -0
  62. package/dist/assets/EntityModelDocument-Ccvw66N9.js +1 -0
  63. package/dist/assets/EnvironmentAssetDocument-Dg-Qq6O6.js +1 -0
  64. package/dist/assets/FBXLoader-B4MoUtAn.js +1 -0
  65. package/dist/assets/Fbo-Dz-Soul3.js +1 -0
  66. package/dist/assets/FontLoader-CvGoVI5a.js +2 -0
  67. package/dist/assets/GLTFExporter-HgrCle4L.js +1 -0
  68. package/dist/assets/GameplaySessionTimeline-B52W3FVZ.js +1 -0
  69. package/dist/assets/Gltf-UHVWKz65.js +2 -0
  70. package/dist/assets/HDRLoader-THU88oVD.js +5 -0
  71. package/dist/assets/ImageViewer-Tn7s_MnW.js +1 -0
  72. package/dist/assets/InspectorCanvasPreview-CEr_Kxna.js +1 -0
  73. package/dist/assets/InspectorObjectPreview-CVejvLRg.js +1 -0
  74. package/dist/assets/JsonAssetDocument-C7VGcLhu.js +3 -0
  75. package/dist/assets/LineSegments2-CsOpKSiM.js +370 -0
  76. package/dist/assets/MTLLoader-_Xzd4_0p.js +2 -0
  77. package/dist/assets/MarchingCubes-Bsp4wrzd.js +1 -0
  78. package/dist/assets/MeshBVH-BiDHDcu-.js +1 -0
  79. package/dist/assets/ModelAssetDocument-F5GACirk.js +1 -0
  80. package/dist/assets/NonThreeAuthoringBootstrap-C3woOMxX.js +1 -0
  81. package/dist/assets/OBJLoader-BhIC6Hwo.js +5 -0
  82. package/dist/assets/Object3DDocumentViewport-DB7T0NTl.js +2 -0
  83. package/dist/assets/Object3DPreview-DL8oi7Xs.js +2 -0
  84. package/dist/assets/OnlineAssetDetail-C6z9RvYK.js +2 -0
  85. package/dist/assets/OrbitControls-CM3bPray.js +1 -0
  86. package/dist/assets/OrbitControls-DLpayAaK.js +1 -0
  87. package/dist/assets/OrthographicCamera-bQozawrh.js +1 -0
  88. package/dist/assets/PLYLoader-DYQqs5Ik.js +2 -0
  89. package/dist/assets/PerspectiveCamera-CQ2lh01o.js +1 -0
  90. package/dist/assets/PlayBar-BR-Vg3Jb.js +2 -0
  91. package/dist/assets/RGBELoader-BgBcQv8j.js +1 -0
  92. package/dist/assets/RectAreaLightUniformsLib-CMMoWfll.js +1 -0
  93. package/dist/assets/RenderPass-DPrn-Uky.js +1 -0
  94. package/dist/assets/ResolutionPicker-C67vs1F3.js +1 -0
  95. package/dist/assets/RootSelectionOverlay-BZPlxmXU.js +1 -0
  96. package/dist/assets/RoundedBox-BDGBg6QZ.js +1 -0
  97. package/dist/assets/RoundedBoxGeometry-CyUuYPfW.js +1 -0
  98. package/dist/assets/STLLoader-Dyv3lsxY.js +1 -0
  99. package/dist/assets/SelectionBox-D_75KrNW.js +1 -0
  100. package/dist/assets/ShaderPass-QYRpPuFJ.js +1 -0
  101. package/dist/assets/ShadowEditor-DkImwu1Y.js +1 -0
  102. package/dist/assets/SimplifyModifier-C8ayvRzd.js +1 -0
  103. package/dist/assets/SkeletonUtils-Cps8GOC6.js +1 -0
  104. package/dist/assets/Sky-CQKCgYDs.js +154 -0
  105. package/dist/assets/SourceAssetViewer-2SWQoUut.js +12 -0
  106. package/dist/assets/StageHost-BN-IoTef.js +2 -0
  107. package/dist/assets/StoryPreviewMount-DjyxRCXu.js +1 -0
  108. package/dist/assets/TDSLoader-D_T8XJ81.js +1 -0
  109. package/dist/assets/TextGeometry-DOWAEUV0.js +1 -0
  110. package/dist/assets/ThreeBoardDocument-CVncZyIq.js +2 -0
  111. package/dist/assets/ThreeIsolationSceneContent-C8C8whSF.js +1 -0
  112. package/dist/assets/ToolObject3DPreview-BRoDWe4Q.js +1 -0
  113. package/dist/assets/TrackballControls-DfznuQTh.js +1 -0
  114. package/dist/assets/TransientHint-BB1fwrvK.js +1 -0
  115. package/dist/assets/UnrealBloomPass-CR-cS_K5.js +83 -0
  116. package/dist/assets/VideoViewer-C6kocgIU.js +1 -0
  117. package/dist/assets/_commonjsHelpers-D6-XlEtG.js +1 -0
  118. package/dist/assets/active-ingest-CT6jSGhr.js +3 -0
  119. package/dist/assets/adapter-surface-Y37Nzcyw.js +1 -0
  120. package/dist/assets/after-paint-CB4bz1-e.js +1 -0
  121. package/dist/assets/agx-base-srgb-BjWZJgrZ.lut +0 -0
  122. package/dist/assets/agx-look-medium-high-contrast-D5F_ob1L.lut +0 -0
  123. package/dist/assets/agx-look-punchy-dxsnycNs.lut +0 -0
  124. package/dist/assets/animation-clock-CnjZqfJp.js +1 -0
  125. package/dist/assets/asset-budget-asset.menu-Di3KiQCd.js +1 -0
  126. package/dist/assets/asset-budget.action-DCzzcuTh.js +1 -0
  127. package/dist/assets/asset-budget.document-BWU8wnVW.js +1 -0
  128. package/dist/assets/asset-budget.menu-BGZpT_31.js +1 -0
  129. package/dist/assets/asset-editor-persistence-BBaONOJt.js +1 -0
  130. package/dist/assets/asset-loaders-BOy5Ss8k.js +2 -0
  131. package/dist/assets/asset-parse-error-BHMwBRU3.js +3 -0
  132. package/dist/assets/assets-BuSoGjBX.js +1 -0
  133. package/dist/assets/audio-meter-CyiToeUW.js +1 -0
  134. package/dist/assets/audio-unlock.service-CfUgUQVy.js +1 -0
  135. package/dist/assets/audio.utility-C6K6jem8.js +1 -0
  136. package/dist/assets/authoring-CgcOFhGS.js +1 -0
  137. package/dist/assets/autoplay.service-BZBGNSvt.js +1 -0
  138. package/dist/assets/axe-LkjAB6Lv.js +30 -0
  139. package/dist/assets/babylon-authoring-adapter-CL02gWDn.js +1 -0
  140. package/dist/assets/binding-Bmxqznjk.js +1 -0
  141. package/dist/assets/binding-identity-DcTpbvyg.js +1 -0
  142. package/dist/assets/binding-resolver-Dsh-6Vor.js +2 -0
  143. package/dist/assets/blender-emscripten-engine-9ZIRYNhe.js +2 -0
  144. package/dist/assets/blender-node-editor.document-iIDkB9sI.js +1 -0
  145. package/dist/assets/blender-properties-tab-C5CyPydi.js +3 -0
  146. package/dist/assets/blender-runtime-host-BpBwGv7r.js +4 -0
  147. package/dist/assets/blender-runtime-skin-DyQ9B6CR.js +7140 -0
  148. package/dist/assets/blender-runtime.document-lIYhhPtv.js +8 -0
  149. package/dist/assets/blender-timeline.document-77fx96N7.js +1 -0
  150. package/dist/assets/blender-uv-editor.document-fsT7B4gV.js +1 -0
  151. package/dist/assets/blender-version.status-o6dBm3n6.js +1 -0
  152. package/dist/assets/blender-wali-engine-wTOcrOMC.js +2 -0
  153. package/dist/assets/blender.command-BtJeWk-A.js +1 -0
  154. package/dist/assets/blender.keymap-GAQgeklK.js +1 -0
  155. package/dist/assets/blender.status-ujwGU6dU.js +1 -0
  156. package/dist/assets/blender.style-Dcem5f_T.js +1 -0
  157. package/dist/assets/board-guides-DziKSTss.js +1 -0
  158. package/dist/assets/body-marks-h_xDxiDE.js +1 -0
  159. package/dist/assets/bridge.command-o5gDNEwa.js +3 -0
  160. package/dist/assets/browserAll-DeWblVez.js +1 -0
  161. package/dist/assets/build-profiles.document-kW8iw8Xj.js +2 -0
  162. package/dist/assets/build-progress.status-BNRLytg2.js +1 -0
  163. package/dist/assets/build-session-C_sg3CEn.js +9 -0
  164. package/dist/assets/build.action-lYjTLb7K.js +1 -0
  165. package/dist/assets/build.command-DIGgUPU_.js +1 -0
  166. package/dist/assets/build.header-CKajx5U3.js +1 -0
  167. package/dist/assets/build.menu-BdU0QXny.js +1 -0
  168. package/dist/assets/build.service-CbBAyeu3.js +1 -0
  169. package/dist/assets/bus-mixer-CGfWDP3C.js +1 -0
  170. package/dist/assets/camera-KEsKvOL7.js +1 -0
  171. package/dist/assets/camera-runtime.inspector-B7unX4g1.js +1 -0
  172. package/dist/assets/canvas-entry-runtime-SfBxaR9M.js +2 -0
  173. package/dist/assets/capability-coverage-Czas4C18.js +7 -0
  174. package/dist/assets/chrome-trace-YZHMz60-.js +1 -0
  175. package/dist/assets/client-DNXj_opT.js +25 -0
  176. package/dist/assets/clip-planes-CnAI6DZn.js +1 -0
  177. package/dist/assets/collaboration-presence-DLoZ7EA3.js +1 -0
  178. package/dist/assets/collider-Bw0mXlsW.js +1 -0
  179. package/dist/assets/collider-dimensions-9xoFADXN.js +1 -0
  180. package/dist/assets/collision-system-DpNUJRJ3.js +1 -0
  181. package/dist/assets/command-results-CUQD49AB.js +1 -0
  182. package/dist/assets/component-board-registry-DrIa2csL.js +1 -0
  183. package/dist/assets/component-board.service-DCwcUssB.js +2 -0
  184. package/dist/assets/component-board.service-DidCyM4O.js +2 -0
  185. package/dist/assets/component-verbs.command-7xzfjGMZ.js +1 -0
  186. package/dist/assets/component-verbs.service-Bv9jId3q.js +1 -0
  187. package/dist/assets/config-CEZk921y.js +6 -0
  188. package/dist/assets/configurations-DTBMdaTL.js +1 -0
  189. package/dist/assets/connection.status-BifnQdOs.js +1 -0
  190. package/dist/assets/console-bridge-CHcb-xk5.js +1 -0
  191. package/dist/assets/constraint-De8f1Uiq.js +1 -0
  192. package/dist/assets/constraints.inspector-B9U9Yj-u.js +1 -0
  193. package/dist/assets/countdown-timer-CUm74dom.js +1 -0
  194. package/dist/assets/coverage.service-VTX5Mcsx.js +3 -0
  195. package/dist/assets/crash-null-boundary-v3a0uEgw.js +1 -0
  196. package/dist/assets/create-runtime-CVCc1BDx.js +1 -0
  197. package/dist/assets/curve-7Q79VgU4.js +1 -0
  198. package/dist/assets/data-asset-4hjS642k.js +5 -0
  199. package/dist/assets/data-check-core-CQEjuFyt.js +1 -0
  200. package/dist/assets/data-ref-CQI28C0D.js +1 -0
  201. package/dist/assets/debug-bridge-CCohG-d-.js +1 -0
  202. package/dist/assets/debug-registry-Dgvitx8M.js +1 -0
  203. package/dist/assets/defaults-DKiBJCPN.js +1 -0
  204. package/dist/assets/deferred-commands-CEMmvL47.js +1 -0
  205. package/dist/assets/deferred-ingest-play-DCJi_Pgu.js +2 -0
  206. package/dist/assets/design-time-layers-wYgOTgni.js +1 -0
  207. package/dist/assets/design-time-mount-registry-DUpXCg1U.js +1 -0
  208. package/dist/assets/design-time-mount.service-BzY21e1F.js +2 -0
  209. package/dist/assets/design-time-react-mount-DM9WLrF2.js +1 -0
  210. package/dist/assets/dev-build-gDYrq68M.js +1 -0
  211. package/dist/assets/directional-shadow-fit-BVkOKAv2.js +1 -0
  212. package/dist/assets/document-preview-three-Kbg2GCLm.js +1 -0
  213. package/dist/assets/dom-authoring-adapter-CY8C7f4T.js +1 -0
  214. package/dist/assets/draco3d-BBUTcNkz.js +1 -0
  215. package/dist/assets/draco_decoder-DsQ12WqX.wasm +0 -0
  216. package/dist/assets/draco_encoder-2Tcju8Ns.wasm +0 -0
  217. package/dist/assets/edit-mode-audio.service-Bzetwd5B.js +1 -0
  218. package/dist/assets/edit-mode-authoring-B47TfLqu.js +1 -0
  219. package/dist/assets/edit-mode-networking.service-YCX6RRb_.js +1 -0
  220. package/dist/assets/editor-api-BoJIcyZG.js +1 -0
  221. package/dist/assets/editor-port-C_FeBdeV.js +1 -0
  222. package/dist/assets/editor-presentation-activity-C7SNSmTd.js +1 -0
  223. package/dist/assets/entry-adjudication-Cq8Yeb74.js +1 -0
  224. package/dist/assets/environment-capture-7himRh2L.js +1 -0
  225. package/dist/assets/esbuild-BHljloGq.wasm +0 -0
  226. package/dist/assets/events-156d8d12.esm-ErOhDXXB.js +36 -0
  227. package/dist/assets/extend-B-eOccUm.js +36 -0
  228. package/dist/assets/extends-CF3RwP-h.js +1 -0
  229. package/dist/assets/eyedropper-session-bjPXnfeX.js +1 -0
  230. package/dist/assets/fflate.module-DPuTF8aG.js +6 -0
  231. package/dist/assets/filmic-srgb-Ct35FIH6.lut +0 -0
  232. package/dist/assets/first-party-audio-system-DxnGJOER.js +1 -0
  233. package/dist/assets/first-party-navigation-system-CL5Bquub.js +1 -0
  234. package/dist/assets/fork-menu-BoVyw2Wu.js +1 -0
  235. package/dist/assets/frame-debugger-store-D1Mf_5up.js +1 -0
  236. package/dist/assets/frame-delta-D2nsw_Ht.js +1 -0
  237. package/dist/assets/frame-pacing-D5acoOzO.js +1 -0
  238. package/dist/assets/frame-selector-cache-cCeUbcjG.js +1 -0
  239. package/dist/assets/game-DHOZVb-7.js +1 -0
  240. package/dist/assets/game-contract-seams-a5YXejOu.js +1 -0
  241. package/dist/assets/game-css-scope-transform-Eng4wS8E.js +33 -0
  242. package/dist/assets/game-document.service-DbRfx2V0.js +1 -0
  243. package/dist/assets/game-eval.command-D-7Dxbj_.js +2 -0
  244. package/dist/assets/game-input-seams-CIQdetRw.js +1 -0
  245. package/dist/assets/game-loop-CZvXlY00.js +1 -0
  246. package/dist/assets/game-module-access-B2mFxv-i.js +1 -0
  247. package/dist/assets/game.layout-CBASrvQu.js +1 -0
  248. package/dist/assets/gameplay-export-BoKXm51x.js +1 -0
  249. package/dist/assets/gameplay-replay-e5umMlXv.js +1 -0
  250. package/dist/assets/gameplay-rng-trap-CTNhm-UW.js +3 -0
  251. package/dist/assets/gameplay.command-DxcVYX6F.js +1 -0
  252. package/dist/assets/generation-DhwCUHPf.css +1 -0
  253. package/dist/assets/generation-jobs-BQrXbGp_.js +1 -0
  254. package/dist/assets/generation.service-CDIgObuw.js +1 -0
  255. package/dist/assets/generations-DzUogZsM.js +1 -0
  256. package/dist/assets/generations.status-CgOUBCum.js +1 -0
  257. package/dist/assets/hierarchy-marks-BLPfSIym.js +1 -0
  258. package/dist/assets/host-pointer-DbGSCjE9.js +1 -0
  259. package/dist/assets/hosted-asset-materialization-CiIvWkGU.js +2 -0
  260. package/dist/assets/ibl-override-material-BlmCxFKq.js +6 -0
  261. package/dist/assets/index-96FBF1Oj.js +1 -0
  262. package/dist/assets/index-BAWkB0dv.js +1 -0
  263. package/dist/assets/index-BDnS2b6S.js +1 -0
  264. package/dist/assets/index-BHp07vN0.js +2 -0
  265. package/dist/assets/index-BMxv2MNV.js +1 -0
  266. package/dist/assets/index-BP6wv2A0.js +5 -0
  267. package/dist/assets/index-BcCBqgM_.js +952 -0
  268. package/dist/assets/index-Bge9JUr6.js +1 -0
  269. package/dist/assets/index-BjTCPEQ7.js +134 -0
  270. package/dist/assets/index-BncK9THk.js +1 -0
  271. package/dist/assets/index-CJbYy-CF.js +3 -0
  272. package/dist/assets/index-CVCb_ImQ.js +1 -0
  273. package/dist/assets/index-CZd9o7Lu.js +1 -0
  274. package/dist/assets/index-CanA16PU.js +2 -0
  275. package/dist/assets/index-CinJrH5C.js +9 -0
  276. package/dist/assets/index-CtzuWnCS.js +1 -0
  277. package/dist/assets/index-D2fNXpHa.css +1 -0
  278. package/dist/assets/index-DUpHH6JR.js +3120 -0
  279. package/dist/assets/index-DUqP1RMl.js +1 -0
  280. package/dist/assets/index-D_NuPfjr.js +9 -0
  281. package/dist/assets/index-Da9JhEvW.js +25 -0
  282. package/dist/assets/index-DgapqSPi.js +7 -0
  283. package/dist/assets/index-FUuS4qwW.js +562 -0
  284. package/dist/assets/index-GIL7oGEO.js +4894 -0
  285. package/dist/assets/index-IEjydI9d.js +1 -0
  286. package/dist/assets/index-OrYXPk3Z.js +487 -0
  287. package/dist/assets/index-V1R-e5Bd.js +1 -0
  288. package/dist/assets/index-bQE2NA0D.js +1 -0
  289. package/dist/assets/index-gHZae-lw.js +13 -0
  290. package/dist/assets/index-mjWQmGhM.js +1 -0
  291. package/dist/assets/index-nmcBqr7Y.js +1 -0
  292. package/dist/assets/inference-diagnostics-Dhmtfbq_.js +1 -0
  293. package/dist/assets/ingest-BbYMC2vQ.js +1 -0
  294. package/dist/assets/ingest-boot-viewport-D5rI_Kk_.js +1 -0
  295. package/dist/assets/ingest-siblings-Bop2kqVl.js +1 -0
  296. package/dist/assets/ingest-source-persistence-C_6Hiyra.js +1 -0
  297. package/dist/assets/ingest.service-BTDnQfM1.js +1 -0
  298. package/dist/assets/input-manager-DH_hGW6d.js +1 -0
  299. package/dist/assets/input-router-BNQvtIqw.js +1 -0
  300. package/dist/assets/inspect-BZfi3mmo.js +1 -0
  301. package/dist/assets/inspection-CObLhnrs.js +1 -0
  302. package/dist/assets/instance-fork-actions-D3sRzS3K.js +1 -0
  303. package/dist/assets/instances.command-D6UkZNO8.js +1 -0
  304. package/dist/assets/instruments-CKR02Y8I.js +1 -0
  305. package/dist/assets/json-history-resource-BbxllWfV.js +1 -0
  306. package/dist/assets/jsx-runtime-DPjLkJKQ.js +9 -0
  307. package/dist/assets/light-D-_wsKTq.js +1 -0
  308. package/dist/assets/light-camera-factory-CWbbe9gI.js +1 -0
  309. package/dist/assets/lil-gui.module.min-BF55BEwA.js +10 -0
  310. package/dist/assets/live-behaviors-Bxq49Maz.js +1 -0
  311. package/dist/assets/live-gesture-lock-DJbrjOqf.js +1 -0
  312. package/dist/assets/loader-CaF_I7Yt.js +1 -0
  313. package/dist/assets/logger-Dqis-7W1.js +1 -0
  314. package/dist/assets/loop-gate-report-N52EWFGD.js +1 -0
  315. package/dist/assets/matcap-texture-CVfalpWT.js +1 -0
  316. package/dist/assets/material-CpAdjDxn.js +1 -0
  317. package/dist/assets/material-factory-Bz6h__6g.js +1 -0
  318. package/dist/assets/mesh-B3WPtNKO.js +1 -0
  319. package/dist/assets/mesh-shadow-CZnXrw_l.js +1 -0
  320. package/dist/assets/mikktspace.module-DO88SLib.js +1 -0
  321. package/dist/assets/model-asset-sections-CFvvihfx.css +1 -0
  322. package/dist/assets/model-asset-sections.service-CHhFS3ZX.js +1 -0
  323. package/dist/assets/model.layout-BJUEQYUI.js +1 -0
  324. package/dist/assets/models.finder-G2jQgIRu.js +1 -0
  325. package/dist/assets/module-mode-DVBLT9d-.js +2 -0
  326. package/dist/assets/mount-canvas-ingest-root-DDuAWf_C.js +2 -0
  327. package/dist/assets/mount-dom-ingest-root-D_EiBgpn.js +2 -0
  328. package/dist/assets/mount-game-6t9cKNo4.js +1 -0
  329. package/dist/assets/mount-ingest-root-glv2SSWf.js +2 -0
  330. package/dist/assets/mount-manifest-CGVxhmAw.js +1 -0
  331. package/dist/assets/mount-readiness-Ds0HvvLH.js +4 -0
  332. package/dist/assets/mount-three-ingest-root-hrUt9VVU.js +1 -0
  333. package/dist/assets/mounted-authoring-Dmg5xmhP.js +1 -0
  334. package/dist/assets/mounted-story-viewport-source-DjP6RA9U.js +1 -0
  335. package/dist/assets/native-debug-module-CWicoSGD.js +1 -0
  336. package/dist/assets/native-entry-surface-BE8LJNdu.js +1 -0
  337. package/dist/assets/navigation-CIiCx-SM.js +1 -0
  338. package/dist/assets/navmesh-workflow-store-Cmnm57TB.js +1 -0
  339. package/dist/assets/navmesh.menu-CAKiH8PW.js +1 -0
  340. package/dist/assets/navmesh.service-jgDWlgj1.js +1 -0
  341. package/dist/assets/network.utility-CEu5nHf7.js +1 -0
  342. package/dist/assets/object-marks-DwvIEBOK.js +1 -0
  343. package/dist/assets/object3d-authoring-subject-CH5sI2oP.js +1 -0
  344. package/dist/assets/output-DK8waum9.js +195 -0
  345. package/dist/assets/particles-Y626p22p.js +1 -0
  346. package/dist/assets/particles-factory-DnLOHXT8.js +1 -0
  347. package/dist/assets/pasteboard-materialize-BqSS4QzV.js +20 -0
  348. package/dist/assets/pasteboard.action-DU3UHtJG.js +2 -0
  349. package/dist/assets/performance-profiler-D_Jey87L.js +1 -0
  350. package/dist/assets/physics-registry-B2Jkp8e6.js +1 -0
  351. package/dist/assets/physics-registry-CUB9cT9p.js +1 -0
  352. package/dist/assets/pixi-authoring-adapter-CjibysC3.js +1 -0
  353. package/dist/assets/pixi-live-write-target-DuWydlWb.js +1 -0
  354. package/dist/assets/pixi-primitive-DlWbUPN9.js +1 -0
  355. package/dist/assets/pixi-react-root-factory-DYsznYRQ.js +1 -0
  356. package/dist/assets/pixi-story-model-DNkfnWUV.js +1 -0
  357. package/dist/assets/pixi-transform-channels-VjdohT11.js +1 -0
  358. package/dist/assets/play-mode-BFU2PCkG.js +22 -0
  359. package/dist/assets/play.command-BpqqLqkq.js +2 -0
  360. package/dist/assets/playtest-BXIL1JEF.js +1 -0
  361. package/dist/assets/pose-guard-6Osb2cFu.js +1 -0
  362. package/dist/assets/presentation-BPP5pXeQ.js +1 -0
  363. package/dist/assets/product-DFhyARJj.js +1 -0
  364. package/dist/assets/profiler.action-CaXJDp3t.js +1 -0
  365. package/dist/assets/profiler.menu-BIMF6Bi4.js +1 -0
  366. package/dist/assets/profiler.utility-BExw9wBO.js +1 -0
  367. package/dist/assets/project-authoring-session-Bnt6icLr.js +2 -0
  368. package/dist/assets/project-provenance-BoP3nrle.js +1 -0
  369. package/dist/assets/prompt-labels-DSMdM2_B.js +1 -0
  370. package/dist/assets/properties-bone-constraints.inspector-ByT6p7S-.js +1 -0
  371. package/dist/assets/properties-bone.inspector-z4qJwKO5.js +1 -0
  372. package/dist/assets/properties-collection.inspector-D0_3ijWU.js +1 -0
  373. package/dist/assets/properties-constraints.inspector-CESzjuls.js +1 -0
  374. package/dist/assets/properties-data.inspector-hG8Wgyzb.js +1 -0
  375. package/dist/assets/properties-material.inspector-CzY0JCQ6.js +1 -0
  376. package/dist/assets/properties-modifiers.inspector-3dDhwf7g.js +1 -0
  377. package/dist/assets/properties-object.inspector-CiarfxkT.js +1 -0
  378. package/dist/assets/properties-output.inspector-DKJxmKSD.js +1 -0
  379. package/dist/assets/properties-particles.inspector-CCEdYWGm.js +1 -0
  380. package/dist/assets/properties-physics.inspector-B2c0KUyA.js +1 -0
  381. package/dist/assets/properties-render.inspector-Bcm0HLRW.js +1 -0
  382. package/dist/assets/properties-scene.inspector-PIM_eTb_.js +1 -0
  383. package/dist/assets/properties-texture.inspector-CgFlnyr8.js +1 -0
  384. package/dist/assets/properties-view-layer.inspector-DGjF_Aqo.js +1 -0
  385. package/dist/assets/properties-world.inspector-CrMvaRvB.js +1 -0
  386. package/dist/assets/r3f-design-session-D-4yyDO9.js +2 -0
  387. package/dist/assets/r3f-physics-binding-BBo8oma9.js +1 -0
  388. package/dist/assets/r3f-root-factory-z9llD1OU.js +1 -0
  389. package/dist/assets/r3f-source-authoring-adapter-w6Bc60K-.js +13 -0
  390. package/dist/assets/rapier-physics-adapter-CaZqWLu0.js +1 -0
  391. package/dist/assets/rapier-physics-bridge-CMoeVo3Y.js +1 -0
  392. package/dist/assets/react-18-By2b4xR9.js +1 -0
  393. package/dist/assets/react-inspector.service-B_neRnSK.js +1 -0
  394. package/dist/assets/react-root-CEz5NTck.js +1 -0
  395. package/dist/assets/react-story-board-BDDwiE2H.js +1 -0
  396. package/dist/assets/react-three-fiber.esm-CycrbDlA.js +1 -0
  397. package/dist/assets/react-three-rapier.esm-CEfKpvxT.js +1 -0
  398. package/dist/assets/react-world-authoring-adapter-DmrwM3py.js +1 -0
  399. package/dist/assets/realm-services-CobQsq_X.js +1 -0
  400. package/dist/assets/rebind-controller-Dtq19Vb3.js +1 -0
  401. package/dist/assets/recast-navigation.wasm-compat-Dsoa_MD-.js +1 -0
  402. package/dist/assets/reflection-probe-Don-M3Fj.js +1 -0
  403. package/dist/assets/reflection-probe-capture.inspector-CmFUoJCx.js +1 -0
  404. package/dist/assets/register-render-vitals-BiZk29b2.js +1 -0
  405. package/dist/assets/registry-02YZjMNp.js +1 -0
  406. package/dist/assets/relative-path-guard-GiM7Lsz8.js +1 -0
  407. package/dist/assets/render-audio-control-vMRlePWb.js +1 -0
  408. package/dist/assets/render-batch-system-0vq7p0VC.js +1 -0
  409. package/dist/assets/render-census-BrQX_CXv.js +1 -0
  410. package/dist/assets/render-control-Df3yTiyr.js +1 -0
  411. package/dist/assets/render-env-D2IV2x5k.js +1 -0
  412. package/dist/assets/render-features-CPQ_e568.js +1 -0
  413. package/dist/assets/render-seed-DF4JHy7P.js +1 -0
  414. package/dist/assets/render-settings-Bw4W9SYF.js +1 -0
  415. package/dist/assets/render-vitals-BZ5HtvMi.js +1 -0
  416. package/dist/assets/renderer-config-BqG4O8i9.js +1 -0
  417. package/dist/assets/resolve-three-SZE_WWUM.js +702 -0
  418. package/dist/assets/root-seam-contract-Z0VWX3Bk.js +1 -0
  419. package/dist/assets/rrweb-Cd2ifIRP.js +142 -0
  420. package/dist/assets/run-ticks-settled-C4ksViyA.js +1 -0
  421. package/dist/assets/runtime-inspection-l2iFQSsg.js +1 -0
  422. package/dist/assets/scene-capture-BQKzU0NT.js +1 -0
  423. package/dist/assets/scene-capture-CGYF-Viw.js +1 -0
  424. package/dist/assets/scene-document.service-qkDjUrlP.js +2 -0
  425. package/dist/assets/scene-framing-Cat0GtyJ.js +1 -0
  426. package/dist/assets/scene-index-B6BZOHMk.js +1 -0
  427. package/dist/assets/scene-query-C7_N-TpI.js +1 -0
  428. package/dist/assets/schema-kl9-2B_J.js +1 -0
  429. package/dist/assets/sculpt.layout-zJF55yCR.js +1 -0
  430. package/dist/assets/seeded-random-i3mtgBKZ.js +1 -0
  431. package/dist/assets/session-CZ5JPg-z.js +4877 -0
  432. package/dist/assets/setup-audio-S8GQF91f.js +1 -0
  433. package/dist/assets/setup-particles-GCXlnkj_.js +1 -0
  434. package/dist/assets/setup-physics-BeZ7-LKD.js +1 -0
  435. package/dist/assets/setup-renderer-DVXaSGin.js +1587 -0
  436. package/dist/assets/shading.layout-DULYZV6M.js +1 -0
  437. package/dist/assets/sim-clock-CLflx7kg.js +1 -0
  438. package/dist/assets/sky-precompute-worker-ChN7J87v.js +1 -0
  439. package/dist/assets/soft-particle-depth-DGvfQDi1.js +1 -0
  440. package/dist/assets/source-object3d-authoring-adapter-B-L6Ha6f.js +1 -0
  441. package/dist/assets/source-persistence-backend-C-aR-B_Y.js +1 -0
  442. package/dist/assets/spark-renderer-lifecycle-ynWESJcv.js +1 -0
  443. package/dist/assets/spark.module-4pXQoz5d.js +12120 -0
  444. package/dist/assets/stage-invalidation-DBg3C3Ta.js +1 -0
  445. package/dist/assets/stage-keyboard-n-5kKH-m.js +1 -0
  446. package/dist/assets/stage-overlay-set-B9zp2sLB.js +1 -0
  447. package/dist/assets/stage-presence-markers-DiGI6A45.js +1 -0
  448. package/dist/assets/standard-viewport-dressing-CzjAe_0A.js +7 -0
  449. package/dist/assets/state-bridge-DLP1jLRW.js +1 -0
  450. package/dist/assets/state-watch.action-BOvQR2qt.js +1 -0
  451. package/dist/assets/state-watch.menu-CNLvDeeY.js +1 -0
  452. package/dist/assets/state-watch.utility-Bg1tTTQU.js +1 -0
  453. package/dist/assets/static-batch-advisor-B13QEH7d.js +1 -0
  454. package/dist/assets/stats.module-BL02l9NC.js +1 -0
  455. package/dist/assets/story-arg-descriptors-Ek86ExX7.js +1 -0
  456. package/dist/assets/story-capture-_gC8dXV-.js +1 -0
  457. package/dist/assets/story-documents--TDLaPeL.js +3 -0
  458. package/dist/assets/story-documents.service-BiS_YbNQ.js +1 -0
  459. package/dist/assets/story-documents.service-CxOPYJ2j.js +1 -0
  460. package/dist/assets/story-media-presence-BHzk2IV5.js +1 -0
  461. package/dist/assets/story-mount-turn-DFRTj5hi.js +1 -0
  462. package/dist/assets/story-pixi-preview-BUrOJZXS.js +1 -0
  463. package/dist/assets/story-presentation-j2AVN-mK.js +1 -0
  464. package/dist/assets/story-three-preview-BHEDZzcl.js +2 -0
  465. package/dist/assets/structural-ids-Dc-7rEwi.js +1 -0
  466. package/dist/assets/structural-signature-0w-i_ats.js +1 -0
  467. package/dist/assets/surface-content-Dg9Kkazf.js +1 -0
  468. package/dist/assets/surface-state-DaxyruCj.js +3 -0
  469. package/dist/assets/system-adapters-rIC8FSGP.js +1 -0
  470. package/dist/assets/system-runner-DkOjxEBt.js +1 -0
  471. package/dist/assets/system-slot-E2mEdiih.js +1 -0
  472. package/dist/assets/team-playtest.service-DqOinFVA.js +1 -0
  473. package/dist/assets/texture.layout-DASpHVht.js +1 -0
  474. package/dist/assets/three-CDSueJyJ.js +1 -0
  475. package/dist/assets/three-authoring-adapter-CmSQ3Vui.js +1 -0
  476. package/dist/assets/three-authoring.service-iuHLwtf1.js +2 -0
  477. package/dist/assets/three-ingest-runtime-QzDYk6tU.js +1 -0
  478. package/dist/assets/three-projection-core-BmKMZ-nf.js +1 -0
  479. package/dist/assets/three-viewport-presentation-QBQpSdMh.js +1 -0
  480. package/dist/assets/three.module-D396a9Mn.js +3840 -0
  481. package/dist/assets/three.quarks.esm-B1C61jGo.js +1039 -0
  482. package/dist/assets/tools-B_NJsk05.js +1 -0
  483. package/dist/assets/transform-writer-BhBBTx33.js +1 -0
  484. package/dist/assets/transport.header-B-6HQlU2.js +1 -0
  485. package/dist/assets/trigger-volume-BNK2XzPL.js +1 -0
  486. package/dist/assets/tuples-CIQ4Bn1U.js +1 -0
  487. package/dist/assets/tween.module-DciWpAG6.js +1 -0
  488. package/dist/assets/ui-board-document-Bwtt--xp.js +2 -0
  489. package/dist/assets/unexported-game-trap-Dm1JYKHy.js +2 -0
  490. package/dist/assets/unmanaged-root-detector-B8CpbkSN.js +2 -0
  491. package/dist/assets/upstream-pin-BdgRH6ID.js +1 -0
  492. package/dist/assets/use-data-Dzq-MytE.js +1 -0
  493. package/dist/assets/use-live-actor-state-DErbWQWF.js +1 -0
  494. package/dist/assets/use-selection-DbR73-xd.js +1 -0
  495. package/dist/assets/user-data-BB2Of6Ht.js +1 -0
  496. package/dist/assets/utility-view-state-BHypxA33.js +1 -0
  497. package/dist/assets/uv-editing.layout-BEKHxmHw.js +1 -0
  498. package/dist/assets/vgai-shared-fontawesome-CU65D4Ij.js +1 -0
  499. package/dist/assets/vgai-shared-jsx-dev-runtime-DFDKL7fx.js +1 -0
  500. package/dist/assets/vgai-shared-jsx-runtime-DIqBpTut.js +1 -0
  501. package/dist/assets/vgai-shared-react-BT7rMc2H.js +1 -0
  502. package/dist/assets/vgai-shared-react-dom-DFajMqMT.js +1 -0
  503. package/dist/assets/vgai-shared-react-dom-client-S0ozfl6_.js +1 -0
  504. package/dist/assets/vgai-shared-three-Bc5PvpLM.js +1 -0
  505. package/dist/assets/viewport-pick-context-DkawXbEi.js +1 -0
  506. package/dist/assets/viewport-root-presentation-CWsE56K6.js +1 -0
  507. package/dist/assets/viewport-shading-BuA88e_A.js +1 -0
  508. package/dist/assets/viewport-shading-boundary-B_-_gABg.js +82 -0
  509. package/dist/assets/viewport-surface-status-B3om4Kcf.js +1 -0
  510. package/dist/assets/vision_bundle-DX0dWqEa.js +15 -0
  511. package/dist/assets/voxel-surface-DtcsSWRL.js +1 -0
  512. package/dist/assets/wav-encode-D31zWF6O.js +1 -0
  513. package/dist/assets/webgl-frame-capture-FlF9zQmW.js +1 -0
  514. package/dist/assets/webgl-gpu-timer-D3YX7RaD.js +1 -0
  515. package/dist/assets/webworkerAll-CM2o_dnz.js +1 -0
  516. package/dist/assets/worker-UrMcrc5_.js +2 -0
  517. package/dist/assets/world-documents-147tiFZe.js +1 -0
  518. package/dist/assets/world-root-stage-binding-vwTrtBz6.js +1 -0
  519. package/dist/assets/world-state-BWG-IcOd.js +1 -0
  520. package/dist/assets/writer-B-KovzkA.js +5 -0
  521. package/dist/assets/xstate-animation-binding-Brd0NST6.js +1 -0
  522. package/dist/assets/xstate-animation-meta-Q3u9zh_m.js +1 -0
  523. package/dist/assets/xstate-behavior.action-B8UluFBK.js +1 -0
  524. package/dist/assets/xstate-behavior.document-CKAsE45I.js +1 -0
  525. package/dist/assets/xstate-behavior.inspector-vJJyuifc.js +1 -0
  526. package/dist/assets/xstate-behavior.menu-BXbPICIh.js +1 -0
  527. package/dist/assets/xstate-inspection-BsZv8LS9.js +1 -0
  528. package/dist/vgai-shared-react.json +10 -0
  529. package/dist/vgai-shared-three.json +3 -0
  530. package/dist-node/cli.js +9320 -0
  531. package/dist-node/create.js +3239 -0
  532. package/package.json +91 -0
  533. package/presets.mjs +2 -0
  534. package/src/contributions.d.ts +4 -0
  535. package/src/index.ts +38 -0
  536. package/starter/cube.blend +0 -0
  537. package/starter/cube.py +81 -0
  538. package/template/.agents/references/project-manual.md +341 -0
  539. package/template/.agents/skills/editor/SKILL.md +53 -0
  540. package/template/.agents/skills/editor/agents/openai.yaml +4 -0
  541. package/template/.agents/skills/editor/references/editor-control.md +363 -0
  542. package/template/.agents/skills/vgai-3d-models/SKILL.md +64 -0
  543. package/template/.agents/skills/vgai-ingest-existing-game/SKILL.md +112 -0
  544. package/template/.agents/skills/vgai-threejs-authoring/SKILL.md +347 -0
  545. package/template/.agents/skills/vgai-threejs-authoring/agents/openai.yaml +4 -0
  546. package/template/.agents/skills/vgai-threejs-authoring/references/helper-catalog.md +65 -0
  547. package/template/.claude/skills/editor/SKILL.md +53 -0
  548. package/template/.claude/skills/editor/agents/openai.yaml +4 -0
  549. package/template/.claude/skills/editor/references/editor-control.md +363 -0
  550. package/template/.claude/skills/vgai-3d-models/SKILL.md +64 -0
  551. package/template/.claude/skills/vgai-ingest-existing-game/SKILL.md +112 -0
  552. package/template/.claude/skills/vgai-threejs-authoring/SKILL.md +347 -0
  553. package/template/.claude/skills/vgai-threejs-authoring/agents/openai.yaml +4 -0
  554. package/template/.claude/skills/vgai-threejs-authoring/references/helper-catalog.md +65 -0
  555. package/template/.github/copilot-instructions.md +6 -0
  556. package/template/.github/skills/editor/SKILL.md +53 -0
  557. package/template/.github/skills/editor/agents/openai.yaml +4 -0
  558. package/template/.github/skills/editor/references/editor-control.md +363 -0
  559. package/template/.github/skills/vgai-3d-models/SKILL.md +64 -0
  560. package/template/.github/skills/vgai-ingest-existing-game/SKILL.md +112 -0
  561. package/template/.github/skills/vgai-threejs-authoring/SKILL.md +347 -0
  562. package/template/.github/skills/vgai-threejs-authoring/agents/openai.yaml +4 -0
  563. package/template/.github/skills/vgai-threejs-authoring/references/helper-catalog.md +65 -0
  564. package/template/.mcp.json +12 -0
  565. package/template/.vgai/assets.json +1 -0
  566. package/template/.vgai/provenance.json +4 -0
  567. package/template/.volter/tracker/validation/.preset.base.mts +178 -0
  568. package/template/.volter/tracker/validation/preset.mts +186 -0
  569. package/template/.volter/tracker/visualizer/.extension.base.tsx +14 -0
  570. package/template/.volter/tracker/visualizer/extension.tsx +14 -0
  571. package/template/.volter/tracker-config.json +17 -0
  572. package/template/AGENTS.md +176 -0
  573. package/template/CLAUDE.md +1 -0
  574. package/template/DEVLOG.md +20 -0
  575. package/template/IDIOMS.md +118 -0
  576. package/template/LICENSE +30 -0
  577. package/template/README.md +83 -0
  578. package/template/ROADMAP.md +20 -0
  579. package/template/asset-manifest.json +3 -0
  580. package/template/check-idioms.ts +1533 -0
  581. package/template/index.html +18 -0
  582. package/template/manifest-entry-modules-plugin.ts +53 -0
  583. package/template/package.json +62 -0
  584. package/template/public/jsm/libs/basis/basis_transcoder.js +19 -0
  585. package/template/public/jsm/libs/basis/basis_transcoder.wasm +0 -0
  586. package/template/public/jsm/libs/draco/gltf/draco_decoder.js +33 -0
  587. package/template/public/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
  588. package/template/public/jsm/libs/draco/gltf/draco_encoder.js +33 -0
  589. package/template/public/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
  590. package/template/public/shaders/daylight-sky.frag.glsl +15 -0
  591. package/template/public/shaders/daylight-sky.vert.glsl +7 -0
  592. package/template/scripts/patch-drei-stats-gl.mjs +35 -0
  593. package/template/server/colyseus-setup.ts +111 -0
  594. package/template/server/loopback.ts +76 -0
  595. package/template/server/main.ts +78 -0
  596. package/template/server/rooms/arena-room.ts +488 -0
  597. package/template/server/rooms/game-room.ts +274 -0
  598. package/template/server/rooms.ts +15 -0
  599. package/template/server/tsconfig.json +19 -0
  600. package/template/src/bot/QaTester.tsx +35 -0
  601. package/template/src/bot/behaviors.ts +203 -0
  602. package/template/src/bot/bot-station.ts +192 -0
  603. package/template/src/bot/tester-run.ts +238 -0
  604. package/template/src/bot/tester-station.ts +193 -0
  605. package/template/src/components/environment/DaylightSky.tsx +54 -0
  606. package/template/src/components/environment/Ground.tsx +129 -0
  607. package/template/src/components/environment/SceneAtmosphere.tsx +14 -0
  608. package/template/src/components/environment/SoftGroundShadow.tsx +62 -0
  609. package/template/src/components/environment/SunShadowFit.tsx +141 -0
  610. package/template/src/contributions/README.md +98 -0
  611. package/template/src/contributions/analytics.analytics.tsx +26 -0
  612. package/template/src/contributions/data.document.tsx +35 -0
  613. package/template/src/contributions/pages.finder.ts +61 -0
  614. package/template/src/contributions/tester.inspector.tsx +64 -0
  615. package/template/src/contributions/use-game-modules.ts +80 -0
  616. package/template/src/data/README.md +17 -0
  617. package/template/src/input.ts +97 -0
  618. package/template/src/lib/audio/capability.json +4 -0
  619. package/template/src/lib/audio/sfx.ts +255 -0
  620. package/template/src/lib/react-root/capability.json +4 -0
  621. package/template/src/lib/react-root/index.ts +20 -0
  622. package/template/src/lib/react-root/react-root-adapter.tsx +57 -0
  623. package/template/src/lib/reflections/ReflectionProbe.tsx +201 -0
  624. package/template/src/lib/reflections/capability.json +4 -0
  625. package/template/src/lib/reflections/index.ts +19 -0
  626. package/template/src/lib/reflections/probe-controller.ts +75 -0
  627. package/template/src/lib/reflections/reflection-probe-registry.ts +402 -0
  628. package/template/src/lib/reflections/volume-reflection-material.ts +416 -0
  629. package/template/src/lib/static-batch/Frozen.tsx +91 -0
  630. package/template/src/lib/static-batch/capability.json +4 -0
  631. package/template/src/lib/static-batch/freeze.ts +579 -0
  632. package/template/src/lib/static-batch/index.ts +44 -0
  633. package/template/src/lib/static-batch/mutation-watch.ts +149 -0
  634. package/template/src/lib/static-batch/shadow-cache.ts +171 -0
  635. package/template/src/main.ts +63 -0
  636. package/template/src/manifest-entry-modules.d.ts +3 -0
  637. package/template/src/prefabs/HeroBox.stories.tsx +23 -0
  638. package/template/src/prefabs/HeroBox.tsx +35 -0
  639. package/template/src/scenes/MainScene.tsx +77 -0
  640. package/template/src/world.tsx +87 -0
  641. package/template/tsconfig.json +35 -0
  642. package/template/tsconfig.node.json +32 -0
  643. package/template/tsconfig.tools.json +22 -0
  644. package/template/validate-asset-content.ts +27 -0
  645. package/template/validate-assets.ts +60 -0
  646. package/template/validate-manifest.ts +55 -0
  647. package/template/vgai.adapter.ts +76 -0
  648. package/template/vgai.project.json +24 -0
  649. package/template/vite.config.ts +247 -0
  650. package/template-dotfiles/gitignore +63 -0
  651. package/workbench/src/media/game-cover.css +83 -0
  652. package/workbench/src/product.contribution.ts +188 -0
  653. package/workbench/src/vgaiGameSkew.ts +276 -0
@@ -0,0 +1,15 @@
1
+ var te=typeof self<"u"?self:{};function hn(t,e){t:{for(var n=["CLOSURE_FLAGS"],r=te,s=0;s<n.length;s++)if((r=r[n[s]])==null){n=null;break t}n=r}return(t=n&&n[t])!=null?t:e}function Yt(){throw Error("Invalid UTF8")}function Ss(t,e){return e=String.fromCharCode.apply(null,e),t==null?e:t+e}let qe,qn;const Fa=typeof TextDecoder<"u";let Ma;const Pa=typeof TextEncoder<"u";function Ii(t){if(Pa)t=(Ma||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let s=0;s<t.length;s++){var e=t.charCodeAt(s);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&s<t.length){const i=t.charCodeAt(++s);if(i>=56320&&i<=57343){e=1024*(e-55296)+i-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}s--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}var De,Ni=hn(610401301,!1),xa=hn(653718497,hn(1,!0)),Ri=hn(660014094,!1);const Ls=te.navigator;function hr(t){return!!Ni&&!!De&&De.brands.some((({brand:e})=>e&&e.indexOf(t)!=-1))}function ut(t){var e;return(e=te.navigator)&&(e=e.userAgent)||(e=""),e.indexOf(t)!=-1}function Bt(){return!!Ni&&!!De&&De.brands.length>0}function Jn(){return Bt()?hr("Chromium"):(ut("Chrome")||ut("CriOS"))&&!(!Bt()&&ut("Edge"))||ut("Silk")}function Mr(t){return Mr[" "](t),t}De=Ls&&Ls.userAgentData||null,Mr[" "]=function(){};var Oa=!Bt()&&(ut("Trident")||ut("MSIE"));!ut("Android")||Jn(),Jn(),ut("Safari")&&(Jn()||!Bt()&&ut("Coast")||!Bt()&&ut("Opera")||!Bt()&&ut("Edge")||(Bt()?hr("Microsoft Edge"):ut("Edg/"))||Bt()&&hr("Opera"));var Ci={},xe=null;function Ia(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):"=.".indexOf(t[e-1])!=-1&&(n="=.".indexOf(t[e-2])!=-1?n-2:n-1);var r=new Uint8Array(n),s=0;return(function(i,o){function h(Ye){for(;a<i.length;){var Ct=i.charAt(a++),Le=xe[Ct];if(Le!=null)return Le;if(!/^[\s\xa0]*$/.test(Ct))throw Error("Unknown base64 encoding at char: "+Ct)}return Ye}Di();for(var a=0;;){var c=h(-1),g=h(0),m=h(64),X=h(64);if(X===64&&c===-1)break;o(c<<2|g>>4),m!=64&&(o(g<<4&240|m>>2),X!=64&&o(m<<6&192|X))}})(t,(function(i){r[s++]=i})),s!==n?r.subarray(0,s):r}function Di(){if(!xe){xe={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;n<5;n++){var r=t.concat(e[n].split(""));Ci[n]=r;for(var s=0;s<r.length;s++){var i=r[s];xe[i]===void 0&&(xe[i]=s)}}}}var Bi=typeof Uint8Array<"u",Ui=!Oa&&typeof btoa=="function";function Fs(t){if(!Ui){var e;e===void 0&&(e=0),Di(),e=Ci[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let a=0,c=0;for(;a<t.length-2;a+=3){var s=t[a],i=t[a+1],o=t[a+2],h=e[s>>2];s=e[(3&s)<<4|i>>4],i=e[(15&i)<<2|o>>6],o=e[63&o],n[c++]=h+s+i+o}switch(h=0,o=r,t.length-a){case 2:o=e[(15&(h=t[a+1]))<<2]||r;case 1:t=t[a],n[c]=e[t>>2]+e[(3&t)<<4|h>>4]+o+r}return n.join("")}for(e="",n=0,r=t.length-10240;n<r;)e+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));return e+=String.fromCharCode.apply(null,n?t.subarray(n):t),btoa(e)}const Ms=/[-_.]/g,Na={"-":"+",_:"/",".":"="};function Ra(t){return Na[t]||""}function Gi(t){if(!Ui)return Ia(t);Ms.test(t)&&(t=t.replace(Ms,Ra)),t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function Ve(t){return Bi&&t!=null&&t instanceof Uint8Array}var ue={};let Ca;function ji(t){if(t!==ue)throw Error("illegal external caller")}function ee(){return Ca||=new Ot(null,ue)}function Pr(t){ji(ue);var e=t.ba;return(e=e==null||Ve(e)?e:typeof e=="string"?Gi(e):null)==null?e:t.ba=e}var Ot=class{constructor(t,e){if(ji(e),this.ba=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}ua(){return new Uint8Array(Pr(this)||0)}};function Vi(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}let Da;function ne(){const t=Error();Vi(t,"incident"),(function(e){te.setTimeout((()=>{throw e}),0)})(t)}function cr(t){return Vi(t=Error(t),"warning"),t}function xr(){return typeof BigInt=="function"}function rt(t){return Array.prototype.slice.call(t)}var ve=typeof Symbol=="function"&&typeof Symbol()=="symbol";function bn(t){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():t}var He=bn(),Ps=bn("0di"),Zn=bn("2ex"),Fe=bn("1oa"),An=ve?(t,e)=>{t[He]|=e}:(t,e)=>{t.G!==void 0?t.G|=e:Object.defineProperties(t,{G:{value:e,configurable:!0,writable:!0,enumerable:!1}})},cn=ve?(t,e)=>{t[He]&=~e}:(t,e)=>{t.G!==void 0&&(t.G&=~e)},B=ve?t=>0|t[He]:t=>0|t.G,b=ve?t=>t[He]:t=>t.G,I=ve?(t,e)=>{t[He]=e}:(t,e)=>{t.G!==void 0?t.G=e:Object.defineProperties(t,{G:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function we(t){return An(t,34),t}function Ba(t,e){I(e,-14591&(0|t))}function ur(t,e){I(e,-14557&(34|t))}var Or,We={},Hi={};function xs(t){return!(!t||typeof t!="object"||t.La!==Hi)}function En(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)&&t.constructor===Object}function Ir(t,e,n){if(t!=null){if(typeof t=="string")t=t?new Ot(t,ue):ee();else if(t.constructor!==Ot)if(Ve(t))t=t.length?new Ot(n?t:new Uint8Array(t),ue):ee();else{if(!e)throw Error();t=void 0}}return t}function un(t){return!(!Array.isArray(t)||t.length)&&!!(1&B(t))}const Os=[];function Rt(t){if(2&t)throw Error()}I(Os,55),Or=Object.freeze(Os);class ln{constructor(e,n,r){this.l=0,this.g=e,this.h=n,this.m=r}next(){if(this.l<this.g.length){const e=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,e):e}}return{done:!0,value:void 0}}[Symbol.iterator](){return new ln(this.g,this.h,this.m)}}let Gt;function Wi(t,e){(e=Gt?e[Gt]:void 0)&&(t[Gt]=rt(e))}var Ua=Object.freeze({}),Ga=Object.freeze({});function kn(t){return t.Sa=!0,t}var ja=kn((t=>typeof t=="number")),Is=kn((t=>typeof t=="string")),Va=kn((t=>typeof t=="boolean")),Tn=typeof te.BigInt=="function"&&typeof te.BigInt(0)=="bigint",lr=kn((t=>Tn?t>=Wa&&t<=Ka:t[0]==="-"?Ns(t,Ha):Ns(t,za)));const Ha=Number.MIN_SAFE_INTEGER.toString(),Wa=Tn?BigInt(Number.MIN_SAFE_INTEGER):void 0,za=Number.MAX_SAFE_INTEGER.toString(),Ka=Tn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Ns(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],s=e[n];if(r>s)return!1;if(r<s)return!0}}const Xa=typeof Uint8Array.prototype.slice=="function";let zi,k=0,R=0;function Rs(t){const e=t>>>0;k=e,R=(t-e)/4294967296>>>0}function le(t){if(t<0){Rs(-t);const[e,n]=Dr(k,R);k=e>>>0,R=n>>>0}else Rs(t)}function Nr(t){const e=zi||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),R=0,k=e.getUint32(0,!0)}function Rr(t,e){return 4294967296*e+(t>>>0)}function Cr(t,e){const n=2147483648&e;return n&&(e=~e>>>0,(t=1+~t>>>0)==0&&(e=e+1>>>0)),t=Rr(t,e),n?-t:t}function fn(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else xr()?n=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+Cs(n)+Cs(t));return n}function Cs(t){return t=String(t),"0000000".slice(t.length)+t}function Sn(t){if(t.length<16)le(Number(t));else if(xr())t=BigInt(t),k=Number(t&BigInt(4294967295))>>>0,R=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+(t[0]==="-");R=k=0;const n=t.length;for(let r=e,s=(n-e)%6+e;s<=n;r=s,s+=6){const i=Number(t.slice(r,s));R*=1e6,k=1e6*k+i,k>=4294967296&&(R+=Math.trunc(k/4294967296),R>>>=0,k>>>=0)}if(e){const[r,s]=Dr(k,R);k=r,R=s}}}function Dr(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Kt(t){return t==null||typeof t=="number"?t:t==="NaN"||t==="Infinity"||t==="-Infinity"?Number(t):void 0}function Ki(t){return t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0}const Ya=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Ln(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return e==="string"&&Ya.test(t)}function be(t){if(t==null)return t;if(typeof t=="string"){if(!t)return;t=+t}return typeof t=="number"&&Number.isFinite(t)?0|t:void 0}function $a(t){if(t==null)return t;if(typeof t=="string"){if(!t)return;t=+t}return typeof t=="number"&&Number.isFinite(t)?t>>>0:void 0}function Ds(t){return t[0]!=="-"&&(t.length<20||t.length===20&&Number(t.substring(0,6))<184467)}function Br(t){return t=Math.trunc(t),Number.isSafeInteger(t)||(le(t),t=Cr(k,R)),t}function Ur(t){var e=Math.trunc(Number(t));if(Number.isSafeInteger(e))return String(e);if((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),!(t[0]==="-"?t.length<20||t.length===20&&Number(t.substring(0,7))>-922337:t.length<19||t.length===19&&Number(t.substring(0,6))<922337))if(Sn(t),t=k,2147483648&(e=R))if(xr())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Dr(t,e);t="-"+fn(n,r)}else t=fn(t,e);return t}function dn(t){return t==null?t:typeof t=="bigint"?(lr(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=lr(t)?Number(t):String(t)),t):Ln(t)?typeof t=="number"?Br(t):Ur(t):void 0}function qa(t){if(t==null)return t;var e=typeof t;if(e==="bigint")return String(BigInt.asUintN(64,t));if(Ln(t)){if(e==="string")return e=Math.trunc(Number(t)),Number.isSafeInteger(e)&&e>=0?t=String(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),Ds(t)||(Sn(t),t=fn(k,R))),t;if(e==="number")return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:(function(n){if(n<0){le(n);const r=fn(k,R);return n=Number(r),Number.isSafeInteger(n)?n:r}return Ds(String(n))?n:(le(n),Rr(k,R))})(t)}}function Xi(t){if(typeof t!="string")throw Error();return t}function Ae(t){if(t!=null&&typeof t!="string")throw Error();return t}function jt(t){return t==null||typeof t=="string"?t:void 0}function Gr(t,e,n,r){if(t!=null&&typeof t=="object"&&t.Y===We)return t;if(!Array.isArray(t))return n?2&r?(t=e[Ps])?e=t:(we((t=new e).u),e=e[Ps]=t):e=new e:e=void 0,e;let s=n=B(t);return s===0&&(s|=32&r),s|=2&r,s!==n&&I(t,s),new e(t)}function Ja(t,e,n){if(e)t:{if(!Ln(e=t))throw cr("int64");switch(typeof e){case"string":e=Ur(e);break t;case"bigint":if(t=e=BigInt.asIntN(64,e),Is(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(ja(t)&&!Number.isSafeInteger(t))throw Error(String(t));e=Tn?BigInt(e):Va(e)?e?"1":"0":Is(e)?e.trim()||"0":String(e);break t;default:e=Br(e)}}else e=dn(t);return typeof(n=(t=e)==null?n?0:void 0:t)=="string"&&(e=+n,Number.isSafeInteger(e))?e:n}function Yi(t){if(Me===void 0&&(Me=typeof Proxy=="function"?Ji(Proxy):null),!Me||!qi())return t;let e=fe?.get(t);return e||(Math.random()>.01?t:((function(n){if(Qn===void 0){const r=new Me([],{});Qn=Array.prototype.concat.call([],r).length===1}Qn&&typeof Symbol=="function"&&Symbol.isConcatSpreadable&&(n[Symbol.isConcatSpreadable]=!0)})(t),e=new Me(t,{set:(n,r,s)=>(ne(),n[r]=s,!0)}),(function(n,r){(fe||=new Jt).set(n,r),($i||=new Jt).set(r,n)})(t,e),e))}let fe,$i,Me,Jt,Qn,Be,pn,Za,Qa;function qi(){return Jt===void 0&&(Jt=typeof WeakMap=="function"?Ji(WeakMap):null),Jt}function Ji(t){try{return t.toString().indexOf("[native code]")!==-1?t:null}catch{return null}}function jr(t,e,n){if(xa&&qi()){if(Be?.get(e)?.get(t)){if(n)return}else if(Math.random()>.01)return;var r=t.length;n={length:r};for(var s=0;s<Math.min(r,10);s++){if(r<=10)var i=s;else{i=r/10;const o=Math.floor(s*i);i=o+Math.floor(Math.random()*(Math.floor((s+1)*i)-o))}n[i]=t[i]}Zi(t,n)?((s=(r=Be||=new Jt).get(e))||(s=new Jt,r.set(e,s)),s.set(t,n)):(ne(),Ue(t,e))}}function gn(t,e){const n=Be?.get(e)?.get(t);n&&!Zi(t,n)&&(ne(),Ue(t,e))}function Zi(t,e){if(t.length!==e.length)return!1;for(const s in e){var n,r=Number(s);if((n=Number.isInteger(r))&&(n=t[r],r=e[r],n=!(Number.isNaN(n)?Number.isNaN(r):n===r)),n)return!1}return!0}function Fn(t){if(t&&Be?.has(t)){var e=t.u;if(e)for(let n=0;n<e.length;n++){const r=e[n];if(n===e.length-1&&En(r))for(const s in r){const i=r[s];Array.isArray(i)&&gn(i,t)}else Array.isArray(r)&&gn(r,t)}}}function Ue(t,e){Be?.get(e)?.delete(t)}function Zt(t,e){return t=Qi(t,e[0],e[1]),An(t,16384),t}function Qi(t,e,n){if(t==null&&(t=pn),pn=void 0,t==null){var r=96;n?(t=[n],r|=512):t=[],e&&(r=-33521665&r|(1023&e)<<15)}else{if(!Array.isArray(t))throw Error("narr");if(2048&(r=B(t)))throw Error("farr");if(64&r)return t;if(r|=64,n&&(r|=512,n!==t[0]))throw Error("mid");t:{const s=(n=t).length;if(s){const i=s-1;if(En(n[i])){if((e=i-(+!!(512&(r|=256))-1))>=1024)throw Error("pvtlmt");r=-33521665&r|(1023&e)<<15;break t}}if(e){if((e=Math.max(e,s-(+!!(512&r)-1)))>1024)throw Error("spvt");r=-33521665&r|(1023&e)<<15}}}return I(t,r),t}const t2={};let e2=(function(){try{return Mr(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class tr{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,n){return this.g.set(e,n),this.size=this.g.size,this}delete(e){return e=this.g.delete(e),this.size=this.g.size,e}clear(){this.g.clear(),this.size=this.g.size}has(e){return this.g.has(e)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(e,n){return this.g.forEach(e,n)}[Symbol.iterator](){return this.entries()}}const n2=e2?(Object.setPrototypeOf(tr.prototype,Map.prototype),Object.defineProperties(tr.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),tr):class extends Map{constructor(){super()}};function Bs(t){return t}function er(t){if(2&t.M)throw Error("Cannot mutate an immutable Map")}var ft=class extends n2{constructor(t,e,n=Bs,r=Bs){super();let s=B(t);s|=64,I(t,s),this.M=s,this.U=e,this.T=n,this.aa=this.U?r2:r;for(let i=0;i<t.length;i++){const o=t[i],h=n(o[0],!1,!0);let a=o[1];e?a===void 0&&(a=null):a=r(o[1],!1,!0,void 0,void 0,s),super.set(h,a)}}pa(t=Us){if(this.size!==0)return this.Z(t)}Z(t=Us){const e=[],n=super.entries();for(var r;!(r=n.next()).done;)(r=r.value)[0]=t(r[0]),r[1]=t(r[1]),e.push(r);return e}clear(){er(this),super.clear()}delete(t){return er(this),super.delete(this.T(t,!0,!1))}entries(){var t=this.oa();return new ln(t,s2,this)}keys(){return this.Ka()}values(){var t=this.oa();return new ln(t,ft.prototype.get,this)}forEach(t,e){super.forEach(((n,r)=>{t.call(e,this.get(r),r,this)}))}set(t,e){return er(this),(t=this.T(t,!0,!1))==null?this:e==null?(super.delete(t),this):super.set(t,this.aa(e,!0,!0,this.U,!1,this.M))}Qa(t){const e=this.T(t[0],!1,!0);t=t[1],t=this.U?t===void 0?null:t:this.aa(t,!1,!0,void 0,!1,this.M),super.set(e,t)}has(t){return super.has(this.T(t,!1,!1))}get(t){t=this.T(t,!1,!1);const e=super.get(t);if(e!==void 0){var n=this.U;return n?((n=this.aa(e,!1,!0,n,this.va,this.M))!==e&&super.set(t,n),n):e}}oa(){return Array.from(super.keys())}Ka(){return super.keys()}[Symbol.iterator](){return this.entries()}};function r2(t,e,n,r,s,i){return t=Gr(t,r,n,i),s&&(t=Pn(t)),t}function Us(t){return t}function s2(t){return[t,this.get(t)]}let i2;function Gs(){return i2||=new ft(we([]),void 0,void 0,void 0,t2)}function Vr(t,e,n,r,s){if(t!=null){if(Array.isArray(t))t=un(t)?void 0:s&&2&B(t)?t:Mn(t,e,n,r!==void 0,s);else if(En(t)){const i={};for(let o in t)i[o]=Vr(t[o],e,n,r,s);t=i}else t=e(t,r);return t}}function Mn(t,e,n,r,s){const i=r||n?B(t):0;r=r?!!(32&i):void 0;const o=rt(t);for(let h=0;h<o.length;h++)o[h]=Vr(o[h],e,n,r,s);return n&&(Wi(o,t),n(i,o)),o}function o2(t){return Vr(t,Hr,void 0,void 0,!1)}function Hr(t){return t.Y===We?t.toJSON():t instanceof ft?t.pa(o2):(function(e){switch(typeof e){case"number":return isFinite(e)?e:String(e);case"bigint":return lr(e)?Number(e):String(e);case"boolean":return e?1:0;case"object":if(e)if(Array.isArray(e)){if(un(e))return}else{if(Ve(e))return Fs(e);if(e instanceof Ot){const n=e.ba;return n==null?"":typeof n=="string"?n:e.ba=Fs(n)}if(e instanceof ft)return e.pa()}}return e})(t)}function fr(t,e,n=ur){if(t!=null){if(Bi&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=B(t);return 2&r?t:(e&&=r===0||!!(32&r)&&!(64&r||!(16&r)),e?(I(t,-12293&(34|r)),t):Mn(t,fr,4&r?ur:n,!0,!0))}return t.Y===We?(n=t.u,t=2&(r=b(n))?t:Wr(t,n,r,!0)):t instanceof ft&&!(2&t.M)&&(n=we(t.Z(fr)),t=new ft(n,t.U,t.T,t.aa)),t}}function Wr(t,e,n,r){return Fn(t),t=t.constructor,pn=e=to(e,n,r),e=new t(e),pn=void 0,e}function to(t,e,n){const r=n||2&e?ur:Ba,s=!!(32&e);return t=(function(i,o,h){const a=rt(i);var c=a.length;const g=256&o?a[c-1]:void 0;for(c+=g?-1:0,o=512&o?1:0;o<c;o++)a[o]=h(a[o]);if(g){o=a[o]={};for(const m in g)o[m]=h(g[m])}return Wi(a,i),a})(t,e,(i=>fr(i,s,r))),An(t,32|(n?2:0)),t}function Pn(t){const e=t.u,n=b(e);return 2&n?Wr(t,e,n,!1):t}function eo(t,e,n,r){return!(4&e)||n!=null}function Vt(t,e){return Lt(t=t.u,b(t),e)}function js(t,e,n,r){if(!((e=r+(+!!(512&e)-1))<0||e>=t.length||e>=n))return t[e]}function Lt(t,e,n,r){if(n===-1)return null;const s=e>>15&1023||536870912;if(!(n>=s)){var i=t.length;return r&&256&e&&(r=t[i-1][n])!=null?(js(t,e,s,n)&&Zn!=null&&((e=(t=Da??={})[Zn]||0)>=4||(t[Zn]=e+1,ne())),r):js(t,e,s,n)}return 256&e?t[t.length-1][n]:void 0}function T(t,e,n){const r=t.u;let s=b(r);return Rt(s),P(r,s,e,n),t}function P(t,e,n,r){const s=e>>15&1023||536870912;if(n>=s){let i,o=e;if(256&e)i=t[t.length-1];else{if(r==null)return o;i=t[s+(+!!(512&e)-1)]={},o|=256}return i[n]=r,n<s&&(t[n+(+!!(512&e)-1)]=void 0),o!==e&&I(t,o),o}return t[n+(+!!(512&e)-1)]=r,256&e&&n in(t=t[t.length-1])&&delete t[n],e}function Ee(t,e,n,r,s){var i=2&e;s=Lt(t,e,n,s),Array.isArray(s)||(s=Or);const o=!(2&r);r=!(1&r);const h=!!(32&e);let a=B(s);return a!==0||!h||i||o?1&a||(a|=1,I(s,a)):(a|=33,I(s,a)),i?(t=!1,2&a||(we(s),t=!!(4&a)),(r||t)&&Object.freeze(s)):(i=!!(2&a)||!!(2048&a),r&&i?(s=rt(s),i=1,h&&!o&&(i|=32),I(s,i),P(t,e,n,s)):o&&32&a&&!i&&cn(s,32)),s}function en(t,e){t=t.u;let n=b(t);const r=Lt(t,n,e),s=Kt(r);return s!=null&&s!==r&&P(t,n,e,s),s}function no(t){t=t.u;let e=b(t);const n=Lt(t,e,1),r=Ir(n,!0,!!(34&e));return r!=null&&r!==n&&P(t,e,1,r),r}function $t(){return Ua===void 0?2:5}function qt(t,e,n,r,s,i){const o=t.u;let h=b(o);r=2&h?1:r,i=!!i,s=ro(o,h,e,s);var a=B(s),c=s;if(gn(c,t),r!==2&&r!==1||Ue(c,t),eo(t,a,void 0)){4&a&&(s=rt(s),a=re(a,h),h=P(o,h,e,s));let m=c=0;for(;c<s.length;c++){const X=n(s[c]);X!=null&&(s[m++]=X)}m<c&&(s.length=m),a=-4097&(20|(a=so(a,h))),I(s,a&=-8193),2&a&&Object.freeze(s)}let g;return r===1||r===4&&32&a?Pt(a)||(t=a,(a|=2)!==t&&I(s,a),Object.freeze(s)):(n=r===5&&(!!(32&a)||Pt(a)||!!fe?.get(s)),(r===2||n)&&Pt(a)&&(s=rt(s),a=de(a=re(a,h),h,i),I(s,a),h=P(o,h,e,s)),Pt(a)||(e=a,(a=de(a,h,i))!==e&&I(s,a)),n?(g=Yi(s),jr(s,t,!0)):r!==2||i||fe?.delete(s)),g||s}function ro(t,e,n,r){return t=Lt(t,e,n,r),Array.isArray(t)?t:Or}function so(t,e){return t===0&&(t=re(t,e)),1|t}function Pt(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function io(t){t=rt(t);for(let e=0;e<t.length;e++){const n=t[e]=rt(t[e]);Array.isArray(n[1])&&(n[1]=we(n[1]))}return t}function dr(t,e,n,r){t=t.u;let s=b(t);Rt(s),P(t,s,e,(r==="0"?Number(n)===0:n===r)?void 0:n)}function nr(t,e){var n=Go;return Kr(zr(t=t.u),t,b(t),n)===e?e:-1}function zr(t){if(ve)return t[Fe]??(t[Fe]=new Map);if(Fe in t)return t[Fe];const e=new Map;return Object.defineProperty(t,Fe,{value:e}),e}function oo(t,e,n,r){const s=zr(t),i=Kr(s,t,e,n);return i!==r&&(i&&(e=P(t,e,i)),s.set(n,r)),e}function Kr(t,e,n,r){let s=t.get(r);if(s!=null)return s;s=0;for(let i=0;i<r.length;i++){const o=r[i];Lt(e,n,o)!=null&&(s!==0&&(n=P(e,n,s)),s=o)}return t.set(r,s),s}function Xr(t,e,n,r){let s,i=b(t);if((r=Lt(t,i,n,r))!=null&&r.Y===We)return(e=Pn(r))!==r&&P(t,i,n,e),e.u;if(Array.isArray(r)){const o=B(r);s=2&o?to(r,o,!1):r,s=Zt(s,e)}else s=Zt(void 0,e);return s!==r&&P(t,i,n,s),s}function ao(t,e,n,r){t=t.u;let s=b(t);return(e=Gr(r=Lt(t,s,n,r),e,!1,s))!==r&&e!=null&&P(t,s,n,e),e}function v(t,e,n,r=!1){if((e=ao(t,e,n,r))==null)return e;if(t=t.u,!(2&(r=b(t)))){const s=Pn(e);s!==e&&P(t,r,n,e=s)}return e}function ho(t,e,n,r,s,i,o){const h=t.u;var a=!!(2&e);s=a?1:s,i=!!i,o&&=!a,a=ro(h,e,r);var c=B(a),g=a;if(gn(g,t),s!==2&&s!==1||Ue(g,t),!(g=!!(4&c))){var m=a,X=e;const Ct=!!(2&(c=so(c,e)));Ct&&(X|=2);let Le=!Ct,ks=!0,$e=0,Yn=0;for(;$e<m.length;$e++){const $n=Gr(m[$e],n,!1,X);if($n instanceof n){if(!Ct){const Ts=!!(2&B($n.u));Le&&=!Ts,ks&&=Ts}m[Yn++]=$n}}Yn<$e&&(m.length=Yn),c|=4,c=ks?16|c:-17&c,I(m,c=Le?8|c:-9&c),Ct&&Object.freeze(m)}if(o&&!(8&c||!a.length&&(s===1||s===4&&32&c))){for(Pt(c)?(a=rt(a),c=re(c,e),e=P(h,e,r,a)):Ue(a,t),n=a,o=c,m=0;m<n.length;m++)(c=n[m])!==(X=Pn(c))&&(n[m]=X);o|=8,o=n.length?-17&o:16|o,I(n,o),c=o}let Ye;return s===1||s===4&&32&c?Pt(c)||(t=c,(c|=!a.length||16&c&&(!g||32&c)?2:2048)!==t&&I(a,c),Object.freeze(a)):(g=s===5&&(!!(32&c)||Pt(c)||!!fe?.get(a)),(s===2||g)&&Pt(c)&&(a=rt(a),c=de(c=re(c,e),e,i),I(a,c),e=P(h,e,r,a)),Pt(c)||(r=c,(c=de(c,e,i))!==r&&I(a,c)),g?(Ye=Yi(a),jr(a,t,!0)):s!==2||i||fe?.delete(a)),Ye||a}function Nt(t,e,n){const r=b(t.u);return ho(t,r,e,n,$t(),!1,!(2&r))}function p(t,e,n,r){return r==null&&(r=void 0),T(t,n,r)}function Ie(t,e,n,r){r==null&&(r=void 0);t:{t=t.u;let s=b(t);if(Rt(s),r==null){const i=zr(t);if(Kr(i,t,s,n)!==e)break t;i.set(n,0)}else s=oo(t,s,n,e);P(t,s,e,r)}}function re(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function de(t,e,n){return 32&e&&n||(t&=-33),t}function mn(t,e,n,r){const s=b(t.u);Rt(s),t=ho(t,s,n,e,2,!0),n=r??new n,t.push(n),2&B(n.u)?cn(t,8):cn(t,16)}function mt(t,e){return t??e}function lt(t,e){return be(Vt(t,e))}function D(t,e){return mt(en(t,e),0)}function Tt(t,e){return mt(jt(Vt(t,e)),"")}function Ge(t,e,n){if(n!=null&&typeof n!="boolean")throw t=typeof n,Error(`Expected boolean but got ${t!="object"?t:n?Array.isArray(n)?"array":t:"null"}: ${n}`);T(t,e,n)}function St(t,e,n){if(n!=null){if(typeof n!="number"||!Number.isFinite(n))throw cr("int32");n|=0}T(t,e,n)}function f(t,e,n){if(n!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);T(t,e,n)}function yn(t,e,n){{const h=t.u;let a=b(h);if(Rt(a),n==null)P(h,a,e);else{n=$i?.get(n)||n;var r,s=B(n),i=s,o=!!(2&s)||Object.isFrozen(n);if((r=!o)&&(r=Ga===void 0||!1),eo(t,s)){s=21,o&&(n=rt(n),i=0,s=de(s=re(s,a),a,!0));for(let c=0;c<n.length;c++)n[c]=Xi(n[c])}r?(n=rt(n),i=0,s=de(s=re(s,a),a,!0)):o||jr(n,t),s!==i&&I(n,s),P(h,a,e,n)}}}function xn(t,e,n){Rt(b(t.u)),qt(t,e,jt,2,void 0,!0).push(Xi(n))}function co(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function Yr(){return Error("Failed to read varint, encoding is invalid.")}function uo(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function $r(t){if(typeof t=="string")return{buffer:Gi(t),O:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),O:!1};if(t.constructor===Uint8Array)return{buffer:t,O:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),O:!1};if(t.constructor===Ot)return{buffer:Pr(t)||new Uint8Array(0),O:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function qr(t,e){let n,r=0,s=0,i=0;const o=t.h;let h=t.g;do n=o[h++],r|=(127&n)<<i,i+=7;while(i<32&&128&n);for(i>32&&(s|=(127&n)>>4),i=3;i<32&&128&n;i+=7)n=o[h++],s|=(127&n)<<i;if(Qt(t,h),n<128)return e(r>>>0,s>>>0);throw Yr()}function Jr(t){let e=0,n=t.g;const r=n+10,s=t.h;for(;n<r;){const i=s[n++];if(e|=i,(128&i)==0)return Qt(t,n),!!(127&e)}throw Yr()}function Ht(t){const e=t.h;let n=t.g,r=e[n++],s=127&r;if(128&r&&(r=e[n++],s|=(127&r)<<7,128&r&&(r=e[n++],s|=(127&r)<<14,128&r&&(r=e[n++],s|=(127&r)<<21,128&r&&(r=e[n++],s|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw Yr();return Qt(t,n),s}function Wt(t){return Ht(t)>>>0}function pr(t){var e=t.h;const n=t.g,r=e[n],s=e[n+1],i=e[n+2];return e=e[n+3],Qt(t,t.g+4),(r<<0|s<<8|i<<16|e<<24)>>>0}function gr(t){var e=pr(t);t=2*(e>>31)+1;const n=e>>>23&255;return e&=8388607,n==255?e?NaN:t*(1/0):n==0?1401298464324817e-60*t*e:t*Math.pow(2,n-150)*(e+8388608)}function a2(t){return Ht(t)}function rr(t,e,{ea:n=!1}={}){t.ea=n,e&&(e=$r(e),t.h=e.buffer,t.m=e.O,t.j=0,t.l=t.h.length,t.g=t.j)}function Qt(t,e){if(t.g=e,e>t.l)throw uo(t.l,e)}function lo(t,e){if(e<0)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.l)throw uo(e,t.l-n);return t.g=r,n}function fo(t,e){if(e==0)return ee();var n=lo(t,e);return t.ea&&t.m?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?new Uint8Array(0):Xa?t.slice(n,e):new Uint8Array(t.subarray(n,e))),n.length==0?ee():new Ot(n,ue)}ft.prototype.toJSON=void 0,ft.prototype.La=Hi;var Vs=[];function po(t){var e=t.g;if(e.g==e.l)return!1;t.l=t.g.g;var n=Wt(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5))throw co(n,t.l);if(e<1)throw Error(`Invalid field number: ${e} (at position ${t.l})`);return t.m=e,t.h=n,!0}function nn(t){switch(t.h){case 0:t.h!=0?nn(t):Jr(t.g);break;case 1:Qt(t=t.g,t.g+8);break;case 2:if(t.h!=2)nn(t);else{var e=Wt(t.g);Qt(t=t.g,t.g+e)}break;case 5:Qt(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!po(t))throw Error("Unmatched start-group tag: stream EOF");if(t.h==4){if(t.m!=e)throw Error("Unmatched end-group tag");break}nn(t)}break;default:throw co(t.h,t.l)}}function ze(t,e,n){const r=t.g.l,s=Wt(t.g),i=t.g.g+s;let o=i-r;if(o<=0&&(t.g.l=i,n(e,t,void 0,void 0,void 0),o=i-t.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${s} bytes, instead read ${s-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return t.g.g=i,t.g.l=r,e}function Zr(t){var e=Wt(t.g),n=lo(t=t.g,e);if(t=t.h,Fa){var r,s=t;(r=qn)||(r=qn=new TextDecoder("utf-8",{fatal:!0})),e=n+e,s=n===0&&e===s.length?s:s.subarray(n,e);try{var i=r.decode(s)}catch(h){if(qe===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),qe=!0}catch{qe=!1}}throw!qe&&(qn=void 0),h}}else{e=(i=n)+e,n=[];let h,a=null;for(;i<e;){var o=t[i++];o<128?n.push(o):o<224?i>=e?Yt():(h=t[i++],o<194||(192&h)!=128?(i--,Yt()):n.push((31&o)<<6|63&h)):o<240?i>=e-1?Yt():(h=t[i++],(192&h)!=128||o===224&&h<160||o===237&&h>=160||(192&(r=t[i++]))!=128?(i--,Yt()):n.push((15&o)<<12|(63&h)<<6|63&r)):o<=244?i>=e-2?Yt():(h=t[i++],(192&h)!=128||h-144+(o<<28)>>30!=0||(192&(r=t[i++]))!=128||(192&(s=t[i++]))!=128?(i--,Yt()):(o=(7&o)<<18|(63&h)<<12|(63&r)<<6|63&s,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):Yt(),n.length>=8192&&(a=Ss(a,n),n.length=0)}i=Ss(a,n)}return i}function go(t){const e=Wt(t.g);return fo(t.g,e)}function On(t,e,n){var r=Wt(t.g);for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var Je=[];let _n;function _t(t,e,n){e.g?e.m(t,e.g,e.h,n,!0):e.m(t,e.h,n,!0)}var l=class{constructor(t,e){this.u=Qi(t,e)}toJSON(){return mo(this)}l(){var t=Y2;return t.g?t.l(this,t.g,t.h,!0):t.l(this,t.h,t.defaultValue,!0)}clone(){const t=this.u;return Wr(this,t,b(t),!1)}O(){return!!(2&B(this.u))}};function mo(t){Fn(t),t=_n?t.u:Mn(t.u,Hr,void 0,void 0,!1);{var e=!_n;let c=t.length;if(c){var n=t[c-1],r=En(n);r?c--:n=void 0;var s=t;if(r){t:{var i,o=n,h=!1;if(o)for(let g in o)isNaN(+g)?(i??={})[g]=o[g]:(r=o[g],Array.isArray(r)&&(un(r)||xs(r)&&r.size===0)&&(r=null),r==null&&(h=!0),r!=null&&((i??={})[g]=r));if(h||(i=o),i)for(let g in i){h=i;break t}h=null}o=h==null?n!=null:h!==n}for(;c>0&&((i=s[c-1])==null||un(i)||xs(i)&&i.size===0);c--)var a=!0;(s!==t||o||a)&&(e?(a||o||h)&&(s.length=c):s=Array.prototype.slice.call(s,0,c),h&&s.push(h)),a=s}else a=t}return a}function Hs(t){return t?/^\d+$/.test(t)?(Sn(t),new mr(k,R)):null:h2||=new mr(0,0)}l.prototype.Y=We,l.prototype.toString=function(){try{return _n=!0,mo(this).toString()}finally{_n=!1}};var mr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let h2;function Ws(t){return t?/^-?\d+$/.test(t)?(Sn(t),new yr(k,R)):null:c2||=new yr(0,0)}var yr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let c2;function he(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function Ke(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function In(t,e){if(e>=0)Ke(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function je(t,e){t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function pe(t,e){e.length!==0&&(t.l.push(e),t.h+=e.length)}function dt(t,e,n){Ke(t.g,8*e+n)}function Qr(t,e){return dt(t,e,2),e=t.g.end(),pe(t,e),e.push(t.h),e}function ts(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function Nn(t,e,n){dt(t,e,2),Ke(t.g,n.length),pe(t,t.g.end()),pe(t,n)}function _r(t,e,n,r){n!=null&&(e=Qr(t,e),r(n,t),ts(t,e))}class ke{constructor(e,n,r){this.g=e,this.h=n,this.qa=r}}function yo(t){return Array.isArray(t)?t[0]instanceof ke?t:[v2,t]:[t,void 0]}function Te(t,e){if(Array.isArray(e)){var n=B(e);if(4&n)return e;for(var r=0,s=0;r<e.length;r++){const i=t(e[r]);i!=null&&(e[s++]=i)}return s<r&&(e.length=s),I(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}const zs=Symbol();function es(t){let e=t[zs];if(!e){const n=ns(t),r=n.h;e=r?(s,i)=>r(s,i,n):(s,i)=>{for(;po(i)&&i.h!=4;){var o=i.m;let c=n[o];const g=!c;let m=!1;if(!c){var h=n.X;if(h){var a=h[o];a&&(m=h.P?.[o],(!Ri||m)&&(h=u2(a))&&(c=n[o]=h))}}c&&c(i,s,o)||(o=(h=i).l,nn(h),h.ja?h=void 0:(a=h.g.g-o,h.g.g=o,h=fo(h.g,a)),o=s,h&&(Gt||=Symbol(),(a=o[Gt])?a.push(h):o[Gt]=[h])),g&&c&&!m&&vr++<5&&ne()}},t[zs]=e}return e}function u2(t){const e=(t=yo(t))[0].g;if(t=t[1]){const n=es(t),r=ns(t).g;return(s,i,o)=>e(s,i,o,r,n)}return e}function l2(t,e,n){t[e]=n}function _o(t,e,n,r){var s=l2;e.g=(function(m){switch(typeof m){case"boolean":return Za||=[0,void 0,!0];case"number":return m>0?void 0:m===0?Qa||=[0,void 0]:[-m,void 0];case"string":return[0,m];case"object":return m}})(t[0]);let i=0;var o=t[++i];o&&o.constructor===Object&&(e.X=o,typeof(o=t[++i])=="function"&&(e.h=o,e.l=t[++i],o=t[++i]));const h={};for(;Array.isArray(o)&&typeof o[0]=="number"&&o[0]>0;){for(var a=0;a<o.length;a++)h[o[a]]=o;o=t[++i]}for(a=1;o!==void 0;){let m;typeof o=="number"&&(a+=o,o=t[++i]);var c=void 0;if(o instanceof ke?m=o:(m=w2,i--),m.qa){o=t[++i],c=t;var g=i;typeof o=="function"&&(o=o(),c[g]=o),c=o}for(g=a+1,typeof(o=t[++i])=="number"&&o<0&&(g-=o,o=t[++i]);a<g;a++){const X=h[a];s(e,a,c?r(m,c,X):n(m,X))}}return e}const Ks=Symbol();function vo(t){let e=t[Ks];if(!e){const n=Rn(t);e=(r,s)=>wo(r,s,n),t[Ks]=e}return e}const Xs=Symbol();function f2(t){return t.h}function d2(t,e){let n,r;const s=t.h;return(i,o,h)=>s(i,o,h,r||=Rn(e).g,n||=vo(e))}function Rn(t){let e=t[Xs];return e||(e=_o(t,t[Xs]={},f2,d2))}const Ys=Symbol();function p2(t,e){const n=t.g;return e?(r,s,i)=>n(r,s,i,e):n}function g2(t,e,n){const r=t.g;let s,i;return(o,h,a)=>r(o,h,a,i||=ns(e).g,s||=es(e),n)}function ns(t){let e=t[Ys];return e||(e=_o(t,t[Ys]={},p2,g2))}function $s(t,e){var n=t[e];if(n)return n;if(n=t.X){var r=n[e];if(r){var s=(r=yo(r))[0].h;if(r=r[1],n=n.P?.[e],!Ri||n){if(r){const i=vo(r),o=Rn(r).g;n=(n=t.l)?n(o,i):(h,a,c)=>s(h,a,c,o,i)}else n=s;return t[e]=n}}}}function wo(t,e,n){for(var r=b(t),s=+!!(512&r)-1,i=t.length,o=512&r?1:0,h=i+(256&r?-1:0);o<h;o++){const a=t[o];if(a==null)continue;const c=o-s,g=$s(n,c);if(!g)continue;const m=n.X;m?.[c]&&!m?.P?.[c]&&vr++<5&&ne(),g(e,a,c)}if(256&r){r=t[i-1];for(let a in r)s=+a,!Number.isNaN(s)&&(i=r[a])!=null&&(h=$s(n,s))&&((o=n.X)?.[s]&&!o?.P?.[s]&&vr++<5&&ne(),h(e,i,s))}if(t=Gt?t[Gt]:void 0)for(pe(e,e.g.end()),n=0;n<t.length;n++)pe(e,Pr(t[n])||new Uint8Array(0))}function q(t,e){return new ke(t,e,!1)}function Se(t,e){return new ke(t,e,!1)}function Cn(t,e){return new ke(t,e,!0)}function J(t,e,n){P(t,b(t),e,n)}var m2=Cn((function(t,e,n,r,s){return t.h===2&&(t=ze(t,Zt([void 0,void 0],r),s),Rt(r=b(e)),(s=Lt(e,r,n))instanceof ft?(2&s.M)!=0?((s=s.Z()).push(t),P(e,r,n,s)):s.Qa(t):Array.isArray(s)?(2&B(s)&&P(e,r,n,s=io(s)),s.push(t)):P(e,r,n,[t]),!0)}),(function(t,e,n,r,s){if(e instanceof ft)e.forEach(((i,o)=>{_r(t,n,Zt([o,i],r),s)}));else if(Array.isArray(e))for(let i=0;i<e.length;i++){const o=e[i];Array.isArray(o)&&_r(t,n,Zt(o,r),s)}}));let vr=0;function bo(t,e,n){if(e=(function(r){if(r==null)return r;const s=typeof r;if(s==="bigint")return String(BigInt.asIntN(64,r));if(Ln(r)){if(s==="string")return Ur(r);if(s==="number")return Br(r)}})(e),e!=null&&(typeof e=="string"&&Ws(e),e!=null))switch(dt(t,n,0),typeof e){case"number":t=t.g,le(e),he(t,k,R);break;case"bigint":n=BigInt.asUintN(64,e),n=new yr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),he(t.g,n.h,n.g);break;default:n=Ws(e),he(t.g,n.h,n.g)}}function Ao(t,e,n){(e=be(e))!=null&&e!=null&&(dt(t,n,0),In(t.g,e))}function Eo(t,e,n){(e=Ki(e))!=null&&(dt(t,n,0),t.g.g.push(e?1:0))}function ko(t,e,n){(e=jt(e))!=null&&Nn(t,n,Ii(e))}function Dn(t,e,n,r,s){e instanceof l?(Fn(e),e=e.u):e=Array.isArray(e)?Zt(e,r):void 0,_r(t,n,e,s)}function To(t,e,n){(e=e==null||typeof e=="string"||Ve(e)||e instanceof Ot?e:void 0)!=null&&Nn(t,n,$r(e).buffer)}function So(t,e,n){return(t.h===5||t.h===2)&&(e=Ee(e,b(e),n,2,!1),t.h==2?On(t,gr,e):e.push(gr(t.g)),!0)}var G,Mt=q((function(t,e,n){if(t.h!==1)return!1;var r=t.g;t=pr(r);const s=pr(r);r=2*(s>>31)+1;const i=s>>>20&2047;return t=4294967296*(1048575&s)+t,J(e,n,i==2047?t?NaN:r*(1/0):i==0?5e-324*r*t:r*Math.pow(2,i-1075)*(t+4503599627370496)),!0}),(function(t,e,n){(e=Kt(e))!=null&&(dt(t,n,1),t=t.g,(n=zi||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),k=n.getUint32(0,!0),R=n.getUint32(4,!0),je(t,k),je(t,R))})),V=q((function(t,e,n){return t.h===5&&(J(e,n,gr(t.g)),!0)}),(function(t,e,n){(e=Kt(e))!=null&&(dt(t,n,5),t=t.g,Nr(e),je(t,k))})),y2=Se(So,(function(t,e,n){if((e=Te(Kt,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(dt(r,s,5),r=r.g,Nr(i),je(r,k))}})),rs=Se(So,(function(t,e,n){if((e=Te(Kt,e))!=null&&e.length){dt(t,n,2),Ke(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Nr(e[r]),je(n,k)}})),zt=q((function(t,e,n){return t.h===0&&(J(e,n,qr(t.g,Cr)),!0)}),bo),sr=q((function(t,e,n){return t.h===0&&(J(e,n,(t=qr(t.g,Cr))===0?void 0:t),!0)}),bo),_2=q((function(t,e,n){return t.h===0&&(J(e,n,qr(t.g,Rr)),!0)}),(function(t,e,n){if((e=qa(e))!=null&&(typeof e=="string"&&Hs(e),e!=null))switch(dt(t,n,0),typeof e){case"number":t=t.g,le(e),he(t,k,R);break;case"bigint":n=BigInt.asUintN(64,e),n=new mr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),he(t.g,n.h,n.g);break;default:n=Hs(e),he(t.g,n.h,n.g)}})),C=q((function(t,e,n){return t.h===0&&(J(e,n,Ht(t.g)),!0)}),Ao),Bn=Se((function(t,e,n){return(t.h===0||t.h===2)&&(e=Ee(e,b(e),n,2,!1),t.h==2?On(t,Ht,e):e.push(Ht(t.g)),!0)}),(function(t,e,n){if((e=Te(be,e))!=null&&e.length){n=Qr(t,n);for(let r=0;r<e.length;r++)In(t.g,e[r]);ts(t,n)}})),ae=q((function(t,e,n){return t.h===0&&(J(e,n,(t=Ht(t.g))===0?void 0:t),!0)}),Ao),O=q((function(t,e,n){return t.h===0&&(J(e,n,Jr(t.g)),!0)}),Eo),Ne=q((function(t,e,n){return t.h===0&&(J(e,n,(t=Jr(t.g))===!1?void 0:t),!0)}),Eo),z=Se((function(t,e,n){if(t.h!==2)return!1;t=Zr(t);const r=b(e);return Rt(r),Ee(e,r,n,2).push(t),!0}),(function(t,e,n){if((e=Te(jt,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&Nn(r,s,Ii(i))}})),Ut=q((function(t,e,n){return t.h===2&&(J(e,n,(t=Zr(t))===""?void 0:t),!0)}),ko),A=q((function(t,e,n){return t.h===2&&(J(e,n,Zr(t)),!0)}),ko),v2=Cn((function(t,e,n,r,s){return t.h===2&&(ze(t,Xr(e,r,n,!0),s),!0)}),Dn),w2=Cn((function(t,e,n,r,s){return t.h===2&&(ze(t,Xr(e,r,n),s),!0)}),Dn);G=new ke((function(t,e,n,r,s){if(t.h!==2)return!1;r=Zt(void 0,r);let i=b(e);Rt(i);let o=Ee(e,i,n,3);return i=b(e),4&B(o)&&(o=rt(o),I(o,-2079&(1|B(o))),P(e,i,n,o)),o.push(r),ze(t,r,s),!0}),(function(t,e,n,r,s){if(Array.isArray(e))for(let i=0;i<e.length;i++)Dn(t,e[i],n,r,s)}),!0);var E=Cn((function(t,e,n,r,s,i){return t.h===2&&(oo(e,b(e),i,n),ze(t,e=Xr(e,r,n),s),!0)}),Dn),Lo=q((function(t,e,n){return t.h===2&&(J(e,n,go(t)),!0)}),To),b2=Se((function(t,e,n){return(t.h===0||t.h===2)&&(e=Ee(e,b(e),n,2,!1),t.h==2?On(t,Wt,e):e.push(Wt(t.g)),!0)}),(function(t,e,n){if((e=Te($a,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(dt(r,s,0),Ke(r.g,i))}})),yt=q((function(t,e,n){return t.h===0&&(J(e,n,Ht(t.g)),!0)}),(function(t,e,n){(e=be(e))!=null&&(e=parseInt(e,10),dt(t,n,0),In(t.g,e))}));class A2{constructor(e,n){this.h=e,this.g=n,this.l=v,this.m=p,this.defaultValue=void 0}}function vt(t,e){return new A2(t,e)}function Xt(t,e){return(n,r)=>{if(Je.length){const i=Je.pop();i.o(r),rr(i.g,n,r),n=i}else n=new class{constructor(i,o){if(Vs.length){const h=Vs.pop();rr(h,i,o),i=h}else i=new class{constructor(h,a){this.h=null,this.m=!1,this.g=this.l=this.j=0,rr(this,h,a)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ea=!1}}(i,o);this.g=i,this.l=this.g.g,this.h=this.m=-1,this.o(o)}o({ja:i=!1}={}){this.ja=i}}(n,r);try{const i=new t,o=i.u;es(e)(o,n);var s=i}finally{n.g.clear(),n.m=-1,n.h=-1,Je.length<100&&Je.push(n)}return s}}function Un(t){return function(){Fn(this);const e=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const o=this.g;return this.g=[],o}}}};wo(this.u,e,Rn(t)),pe(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,s=r.length;let i=0;for(let o=0;o<s;o++){const h=r[o];n.set(h,i),i+=h.length}return e.l=[n],n}}var qs=class extends l{constructor(t){super(t)}},Js=[0,Ut,q((function(t,e,n){return t.h===2&&(J(e,n,(t=go(t))===ee()?void 0:t),!0)}),(function(t,e,n){if(e!=null){if(e instanceof l){const r=e.Ta;return void(r&&(e=r(e),e!=null&&Nn(t,n,$r(e).buffer)))}if(Array.isArray(e))return}To(t,e,n)}))],Fo=[0,C,yt,O,-1,Bn,yt,-1],E2=class extends l{constructor(){super()}},Mo=[0,O,A,O,yt,-1,Se((function(t,e,n){return(t.h===0||t.h===2)&&(e=Ee(e,b(e),n,2,!1),t.h==2?On(t,a2,e):e.push(Ht(t.g)),!0)}),(function(t,e,n){if((e=Te(be,e))!=null&&e.length){n=Qr(t,n);for(let r=0;r<e.length;r++)In(t.g,e[r]);ts(t,n)}})),A,-1,[0,O,-1],yt,O,-1],Po=[0,A,-2],Zs=class extends l{constructor(){super()}},xo=[0],Oo=[0,C,O,1,O,-3],k2=[0,A,O,-1,C,[0,[1,2,3,4,5,6,7],E,xo,E,Mo,E,Po,E,Oo,E,Fo,E,[0,A,-2],E,[0,A,yt]],[0,A],O,[0,[1,3],[2,4],E,[0,Bn],-1,E,[0,z],-1,G,[0,A,-1]],A],st=class extends l{constructor(t){super(t,2)}},L={},j=L.P={};L[336783863]=k2,j[336783863]=1;var Qs=[0,sr,-1,Ne,-3,sr,Bn,Ut,ae,sr,-1,Ne,ae,Ne,-2,Ut];function it(t,e){dr(t,2,Ae(e),"")}function S(t,e){xn(t,3,e)}function _(t,e){xn(t,4,e)}var K=class extends l{constructor(t){super(t,500)}o(t){return p(this,0,7,t)}},Re=[-1,{P:{}}],ti=[0,A,1,Re],ei=[0,A,z,Re];function ot(t,e){mn(t,1,K,e)}function F(t,e){xn(t,10,e)}function w(t,e){xn(t,15,e)}var Z=class extends l{constructor(t){super(t,500)}o(t){return p(this,0,1001,t)}},Io=[-500,G,[-500,Ut,-1,z,-3,[-2,L,O],G,Js,ae,-1,ti,ei,G,[0,Ut,Ne],Ut,Qs,ae,z,987,z],4,G,[-500,A,-1,[-1,{P:{}}],998,A],G,[-500,A,z,-1,[-2,{P:{}},O],997,z,-1],ae,G,[-500,A,z,Re,998,z],z,ae,ti,ei,G,[0,Ut,-1,Re],z,-2,Qs,Ut,-1,Ne,979,Re,G,Js];Z.prototype.g=Un(Io);var T2=Xt(Z,Io),S2=class extends l{constructor(t){super(t)}},No=class extends l{constructor(t){super(t)}g(){return Nt(this,S2,1)}},Ro=[0,G,[0,C,V,A,-1]],Gn=Xt(No,Ro),L2=class extends l{constructor(t){super(t)}},F2=class extends l{constructor(t){super(t)}},ir=class extends l{constructor(t){super(t)}h(){return v(this,L2,2)}g(){return Nt(this,F2,5)}},Co=Xt(class extends l{constructor(t){super(t)}},[0,z,Bn,rs,[0,yt,[0,C,-3],[0,V,-3],[0,C,-1,[0,G,[0,C,-2]]],G,[0,V,-1,A,V]],A,-1,zt,G,[0,C,V],z,zt]),Do=class extends l{constructor(t){super(t)}},ce=Xt(class extends l{constructor(t){super(t)}},[0,G,[0,V,-4]]),Bo=class extends l{constructor(t){super(t)}},Xe=Xt(class extends l{constructor(t){super(t)}},[0,G,[0,V,-4]]),M2=class extends l{constructor(t){super(t)}},P2=[0,C,-1,rs,yt],Uo=class extends l{constructor(){super()}};Uo.prototype.g=Un([0,V,-4,zt]);var x2=class extends l{constructor(t){super(t)}},O2=Xt(class extends l{constructor(t){super(t)}},[0,G,[0,1,C,A,Ro],zt]),ni=class extends l{constructor(t){super(t)}},I2=class extends l{constructor(t){super(t)}ra(){const t=no(this);return t??ee()}},N2=class extends l{constructor(t){super(t)}},Go=[1,2],R2=Xt(class extends l{constructor(t){super(t)}},[0,G,[0,Go,E,[0,rs],E,[0,Lo],C,A],zt]),ss=class extends l{constructor(t){super(t)}},jo=[0,A,C,V,z,-1],ri=class extends l{constructor(t){super(t)}},C2=[0,O,-1],si=class extends l{constructor(t){super(t)}},rn=[1,2,3,4,5],vn=class extends l{constructor(t){super(t)}g(){return no(this)!=null}h(){return jt(Vt(this,2))!=null}},x=class extends l{constructor(t){super(t)}g(){return Ki(Vt(this,2))??!1}},Vo=[0,Lo,A,[0,C,zt,-1],[0,_2,zt]],U=[0,Vo,O,[0,rn,E,Oo,E,Mo,E,Fo,E,xo,E,Po],yt],jn=class extends l{constructor(t){super(t)}},is=[0,U,V,-1,C],D2=vt(502141897,jn);L[502141897]=is,j[502141897]=1;var Ho=[0,Vo];L[512499200]=Ho;var Wo=[0,Ho];L[515723506]=Wo;var B2=Xt(class extends l{constructor(t){super(t)}},[0,[0,yt,-1,y2,b2],P2]),zo=[0,U];L[508981768]=zo;var Ko=class extends l{constructor(t){super(t)}},Xo=class extends l{constructor(t){super(t)}},os=[0,U,V,zo,O],Yo=[0,U,is,os,V,Wo];L[508968149]=os;var U2=vt(508968150,Xo);L[508968150]=Yo,j[508968150]=1,j[508968149]=1;var $o=class extends l{constructor(t){super(t)}},G2=vt(513916220,$o);L[513916220]=[0,U,Yo,C],j[513916220]=1;var se=class extends l{constructor(t){super(t)}h(){return v(this,ss,2)}g(){T(this,2)}},qo=[0,U,jo];L[478825465]=qo,j[478825465]=1;var Jo=[0,U];L[478825422]=Jo;var j2=class extends l{constructor(t){super(t)}},Zo=class extends l{constructor(t){super(t)}},as=class extends l{constructor(t){super(t)}},hs=class extends l{constructor(t){super(t)}},Qo=class extends l{constructor(t){super(t)}},ta=[0,U,Jo,qo,-1],ea=[0,U,V,C],cs=[0,U,V],na=[0,U,ea,cs,V],V2=[0,U,na,ta];L[463370452]=ta,L[464864288]=ea,L[474472470]=cs;var H2=vt(462713202,hs);L[462713202]=na;var W2=vt(479097054,Qo);L[479097054]=V2,j[479097054]=1,j[463370452]=1,j[464864288]=1,j[462713202]=1,j[474472470]=1;var z2=class extends l{constructor(t){super(t)}},ra=class extends l{constructor(t){super(t)}},sa=class extends l{constructor(t){super(t)}},ia=class extends l{constructor(){super()}},wr=[0,U,V,-1,C],br=[0,U,V,O];ia.prototype.g=Un([0,U,cs,[0,U],is,os,wr,br]),L[514774813]=wr,L[518928384]=br;var oa=class extends l{constructor(t){super(t)}},K2=vt(456383383,oa);L[456383383]=[0,U,jo],j[456383383]=1;var aa=class extends l{constructor(t){super(t)}},X2=vt(476348187,aa);L[476348187]=[0,U,C2],j[476348187]=1;var ha=class extends l{constructor(t){super(t)}},ii=class extends l{constructor(t){super(t)}},ca=[0,yt,-1],Y2=vt(458105876,class extends l{constructor(t){super(t)}g(){var t=this.u;const e=b(t),n=2&e;return t=(function(r,s,i){var o=ii;const h=2&s;let a=!1;if(i==null){if(h)return Gs();i=[]}else if(i.constructor===ft){if((2&i.M)==0||h)return i;i=i.Z()}else Array.isArray(i)?a=!!(2&B(i)):i=[];if(h){if(!i.length)return Gs();a||(a=!0,we(i))}else a&&(a=!1,i=io(i));return a||(64&B(i)?cn(i,32):32&s&&An(i,32)),P(r,s,2,o=new ft(i,o,Ja,void 0)),o})(t,e,Lt(t,e,2)),!n&&ii&&(t.va=!0),t}});L[458105876]=[0,ca,m2,[!0,zt,[0,A,-1,z]]],j[458105876]=1;var us=class extends l{constructor(t){super(t)}},ua=vt(458105758,us);L[458105758]=[0,U,A,ca],j[458105758]=1;var la=class extends l{constructor(t){super(t)}},$2=vt(443442058,la);L[443442058]=[0,U,A,C,V,z,-1],j[443442058]=1,j[514774813]=1;var fa=class extends l{constructor(t){super(t)}},q2=vt(516587230,fa);function Ar(t,e){return e=e?e.clone():new ss,t.displayNamesLocale!==void 0?T(e,1,Ae(t.displayNamesLocale)):t.displayNamesLocale===void 0&&T(e,1),t.maxResults!==void 0?St(e,2,t.maxResults):"maxResults"in t&&T(e,2),t.scoreThreshold!==void 0?f(e,3,t.scoreThreshold):"scoreThreshold"in t&&T(e,3),t.categoryAllowlist!==void 0?yn(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&T(e,4),t.categoryDenylist!==void 0?yn(e,5,t.categoryDenylist):"categoryDenylist"in t&&T(e,5),e}function ls(t,e=-1,n=""){return{categories:t.map((r=>({index:mt(lt(r,1),0)??-1,score:D(r,2)??0,categoryName:Tt(r,3)??"",displayName:Tt(r,4)??""}))),headIndex:e,headName:n}}function da(t){var e=qt(t,3,Kt,$t()),n=qt(t,2,be,$t()),r=qt(t,1,jt,$t()),s=qt(t,9,jt,$t());const i={categories:[],keypoints:[]};for(let o=0;o<e.length;o++)i.categories.push({score:e[o],index:n[o]??-1,categoryName:r[o]??"",displayName:s[o]??""});if((e=v(t,ir,4)?.h())&&(i.boundingBox={originX:lt(e,1)??0,originY:lt(e,2)??0,width:lt(e,3)??0,height:lt(e,4)??0,angle:0}),v(t,ir,4)?.g().length)for(const o of v(t,ir,4).g())i.keypoints.push({x:en(o,1)??0,y:en(o,2)??0,score:en(o,4)??0,label:jt(Vt(o,3))??""});return i}function Vn(t){const e=[];for(const n of Nt(t,Bo,1))e.push({x:D(n,1)??0,y:D(n,2)??0,z:D(n,3)??0,visibility:D(n,4)??0});return e}function Ce(t){const e=[];for(const n of Nt(t,Do,1))e.push({x:D(n,1)??0,y:D(n,2)??0,z:D(n,3)??0,visibility:D(n,4)??0});return e}function oi(t){return Array.from(t,(e=>e>127?e-256:e))}function ai(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,s=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i],r+=t[i]*t[i],s+=e[i]*e[i];if(r<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*s)}let Ze;L[516587230]=[0,U,wr,br,V],j[516587230]=1,j[518928384]=1;const J2=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function pa(){if(Ze===void 0)try{await WebAssembly.instantiate(J2),Ze=!0}catch{Ze=!1}return Ze}async function Pe(t,e=""){const n=await pa()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var ie=class{};function ga(){var t=navigator;return typeof OffscreenCanvas<"u"&&(!(function(e=navigator){return(e=e.userAgent).includes("Safari")&&!e.includes("Chrome")})(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function hi(t){if(typeof importScripts!="function"){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise(((n,r)=>{e.addEventListener("load",(()=>{n()}),!1),e.addEventListener("error",(s=>{r(s)}),!1),document.body.appendChild(e)}))}importScripts(t.toString())}function ma(t){return t.videoWidth!==void 0?[t.videoWidth,t.videoHeight]:t.naturalWidth!==void 0?[t.naturalWidth,t.naturalHeight]:t.displayWidth!==void 0?[t.displayWidth,t.displayHeight]:[t.width,t.height]}function d(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function ci(t,e,n){if(!t.i.canvas)throw Error("No OpenGL canvas configured.");if(n?t.i._bindTextureToStream(n):t.i._bindTextureToCanvas(),!(n=t.i.canvas.getContext("webgl2")||t.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);const[r,s]=ma(e);return!t.l||r===t.i.canvas.width&&s===t.i.canvas.height||(t.i.canvas.width=r,t.i.canvas.height=s),[r,s]}function ui(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let s=0;s<e.length;s++)r[s]=t.i.stringToNewUTF8(e[s]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const s of r)t.i._free(s);t.i._free(e)}function bt(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function Dt(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(s,i,o)=>{i?(n(r,o),r=[]):r.push(s)}}ie.forVisionTasks=function(t){return Pe("vision",t)},ie.forTextTasks=function(t){return Pe("text",t)},ie.forGenAiExperimentalTasks=function(t){return Pe("genai_experimental",t)},ie.forGenAiTasks=function(t){return Pe("genai",t)},ie.forAudioTasks=function(t){return Pe("audio",t)},ie.isSimdSupported=function(){return pa()};async function Z2(t,e,n,r){return t=await(async(s,i,o,h,a)=>{if(i&&await hi(i),!self.ModuleFactory||o&&(await hi(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&a&&((i=self.Module).locateFile=a.locateFile,a.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=a.mainScriptUrlOrBlob)),a=await self.ModuleFactory(self.Module||a),self.ModuleFactory=self.Module=void 0,new s(a,h)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:s=>s.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&s.endsWith(".data")?n.assetBinaryPath.toString():s}),await t.o(r),t}function or(t,e){const n=v(t.baseOptions,vn,1)||new vn;typeof e=="string"?(T(n,2,Ae(e)),T(n,1)):e instanceof Uint8Array&&(T(n,1,Ir(e,!1,!1)),T(n,2)),p(t.baseOptions,0,1,n)}function li(t){try{const e=t.H.length;if(e===1)throw Error(t.H[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.H.map((n=>n.message)).join(", "))}finally{t.H=[]}}function u(t,e){t.B=Math.max(t.B,e)}function Hn(t,e){t.A=new K,it(t.A,"PassThroughCalculator"),S(t.A,"free_memory"),_(t.A,"free_memory_unused_out"),F(e,"free_memory"),ot(e,t.A)}function ge(t,e){S(t.A,e),_(t.A,e+"_unused_out")}function Wn(t){t.g.addBoolToStream(!0,"free_memory",t.B)}var sn=class{constructor(t){this.g=t,this.H=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){if(e){const n=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(v(this.baseOptions,vn,1)?.g()||v(this.baseOptions,vn,1)?.h()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(r,s){let i=v(r.baseOptions,si,3);if(!i){var o=i=new si,h=new Zs;Ie(o,4,rn,h)}"delegate"in s&&(s.delegate==="GPU"?(s=i,o=new E2,Ie(s,2,rn,o)):(s=i,o=new Zs,Ie(s,4,rn,o))),p(r.baseOptions,0,3,i)})(this,n),n.modelAssetPath)return fetch(n.modelAssetPath.toString()).then((r=>{if(r.ok)return r.arrayBuffer();throw Error(`Failed to fetch model: ${n.modelAssetPath} (${r.status})`)})).then((r=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(r),!0,!1,!1),or(this,"/model.dat"),this.m(),this.J()}));if(n.modelAssetBuffer instanceof Uint8Array)or(this,n.modelAssetBuffer);else if(n.modelAssetBuffer)return(async function(r){const s=[];for(var i=0;;){const{done:o,value:h}=await r.read();if(o)break;s.push(h),i+=h.length}if(s.length===0)return new Uint8Array(0);if(s.length===1)return s[0];r=new Uint8Array(i),i=0;for(const o of s)r.set(o,i),i+=o.length;return r})(n.modelAssetBuffer).then((r=>{or(this,r),this.m(),this.J()}))}return this.m(),this.J(),Promise.resolve()}J(){}ga(){let t;if(this.g.ga((e=>{t=T2(e)})),!t)throw Error("Failed to retrieve CalculatorGraphConfig");return t}setGraph(t,e){this.g.attachErrorListener(((n,r)=>{this.H.push(Error(r))})),this.g.Oa(),this.g.setGraph(t,e),this.A=void 0,li(this)}finishProcessing(){this.g.finishProcessing(),li(this)}close(){this.A=void 0,this.g.closeGraph()}};function It(t,e){if(!t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}sn.prototype.close=sn.prototype.close,(function(t,e){t=t.split(".");var n,r=te;for((t[0]in r)||r.execScript===void 0||r.execScript("var "+t[0]);t.length&&(n=t.shift());)t.length||e===void 0?r=r[n]&&r[n]!==Object.prototype[n]?r[n]:r[n]={}:r[n]=e})("TaskRunner",sn);class Q2{constructor(e,n,r,s){this.g=e,this.h=n,this.m=r,this.l=s}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function fi(t,e,n){const r=t.g;if(n=It(r.createShader(n),"Failed to create WebGL shader"),r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(t.h,n),n}function di(t,e){const n=t.g,r=It(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(r);const s=It(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,s),n.enableVertexAttribArray(t.R),n.vertexAttribPointer(t.R,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const i=It(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t.J),n.vertexAttribPointer(t.J,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new Q2(n,r,s,i)}function fs(t,e){if(t.g){if(e!==t.g)throw Error("Cannot change GL context once initialized")}else t.g=e}function ds(t,e,n,r){return fs(t,e),t.h||(t.m(),t.C()),n?(t.s||(t.s=di(t,!0)),n=t.s):(t.v||(t.v=di(t,!1)),n=t.v),e.useProgram(t.h),n.bind(),t.l(),t=r(),n.g.bindVertexArray(null),t}function zn(t,e,n){return fs(t,e),t=It(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n??e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,n??e.LINEAR),e.bindTexture(e.TEXTURE_2D,null),t}function Kn(t,e,n){fs(t,e),t.A||(t.A=It(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,t.A),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}function ps(t){t.g?.bindFramebuffer(t.g.FRAMEBUFFER,null)}var gs=class{H(){return`
2
+ precision mediump float;
3
+ varying vec2 vTex;
4
+ uniform sampler2D inputTexture;
5
+ void main() {
6
+ gl_FragColor = texture2D(inputTexture, vTex);
7
+ }
8
+ `}m(){const t=this.g;if(this.h=It(t.createProgram(),"Failed to create WebGL program"),this.da=fi(this,`
9
+ attribute vec2 aVertex;
10
+ attribute vec2 aTex;
11
+ varying vec2 vTex;
12
+ void main(void) {
13
+ gl_Position = vec4(aVertex, 0.0, 1.0);
14
+ vTex = aTex;
15
+ }`,t.VERTEX_SHADER),this.ca=fi(this,this.H(),t.FRAGMENT_SHADER),t.linkProgram(this.h),!t.getProgramParameter(this.h,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(this.h)}`);this.R=t.getAttribLocation(this.h,"aVertex"),this.J=t.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const t=this.g;t.deleteProgram(this.h),t.deleteShader(this.da),t.deleteShader(this.ca)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function xt(t,e){switch(e){case 0:return t.g.find((n=>n instanceof Uint8Array));case 1:return t.g.find((n=>n instanceof Float32Array));case 2:return t.g.find((n=>typeof WebGLTexture<"u"&&n instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function Er(t){var e=xt(t,1);if(!e){if(e=xt(t,0))e=new Float32Array(e).map((r=>r/255));else{e=new Float32Array(t.width*t.height);const r=me(t);var n=ms(t);if(Kn(n,r,ya(t)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in self.document){n=new Float32Array(t.width*t.height*4),r.readPixels(0,0,t.width,t.height,r.RGBA,r.FLOAT,n);for(let s=0,i=0;s<e.length;++s,i+=4)e[s]=n[i]}else r.readPixels(0,0,t.width,t.height,r.RED,r.FLOAT,e)}t.g.push(e)}return e}function ya(t){let e=xt(t,2);if(!e){const n=me(t);e=va(t);const r=Er(t),s=_a(t);n.texImage2D(n.TEXTURE_2D,0,s,t.width,t.height,0,n.RED,n.FLOAT,r),kr(t)}return e}function me(t){if(!t.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return t.h||(t.h=It(t.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),t.h}function _a(t){if(t=me(t),!Qe)if(t.getExtension("EXT_color_buffer_float")&&t.getExtension("OES_texture_float_linear")&&t.getExtension("EXT_float_blend"))Qe=t.R32F;else{if(!t.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Qe=t.R16F}return Qe}function ms(t){return t.l||(t.l=new gs),t.l}function va(t){const e=me(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=xt(t,2);return n||(n=zn(ms(t),e,t.m?e.LINEAR:e.NEAREST),t.g.push(n),t.j=!0),e.bindTexture(e.TEXTURE_2D,n),n}function kr(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}var Qe,H=class{constructor(t,e,n,r,s,i,o){this.g=t,this.m=e,this.j=n,this.canvas=r,this.l=s,this.width=i,this.height=o,this.j&&--pi===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Ja(){return!!xt(this,0)}ma(){return!!xt(this,1)}S(){return!!xt(this,2)}la(){return(e=xt(t=this,0))||(e=Er(t),e=new Uint8Array(e.map((n=>255*n))),t.g.push(e)),e;var t,e}ka(){return Er(this)}N(){return ya(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof Uint8Array)n=new Uint8Array(e);else if(e instanceof Float32Array)n=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const r=me(this),s=ms(this);r.activeTexture(r.TEXTURE1),n=zn(s,r,this.m?r.LINEAR:r.NEAREST),r.bindTexture(r.TEXTURE_2D,n);const i=_a(this);r.texImage2D(r.TEXTURE_2D,0,i,this.width,this.height,0,r.RED,r.FLOAT,null),r.bindTexture(r.TEXTURE_2D,null),Kn(s,r,n),ds(s,r,!1,(()=>{va(this),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),kr(this)})),ps(s),kr(this)}}t.push(n)}return new H(t,this.m,this.S(),this.canvas,this.l,this.width,this.height)}close(){this.j&&me(this).deleteTexture(xt(this,2)),pi=-1}};H.prototype.close=H.prototype.close,H.prototype.clone=H.prototype.clone,H.prototype.getAsWebGLTexture=H.prototype.N,H.prototype.getAsFloat32Array=H.prototype.ka,H.prototype.getAsUint8Array=H.prototype.la,H.prototype.hasWebGLTexture=H.prototype.S,H.prototype.hasFloat32Array=H.prototype.ma,H.prototype.hasUint8Array=H.prototype.Ja;var pi=250;function kt(t,e){switch(e){case 0:return t.g.find((n=>n instanceof ImageData));case 1:return t.g.find((n=>typeof ImageBitmap<"u"&&n instanceof ImageBitmap));case 2:return t.g.find((n=>typeof WebGLTexture<"u"&&n instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function wa(t){var e=kt(t,0);if(!e){e=ye(t);const n=Xn(t),r=new Uint8Array(t.width*t.height*4);Kn(n,e,on(t)),e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,r),ps(n),e=new ImageData(new Uint8ClampedArray(r.buffer),t.width,t.height),t.g.push(e)}return e}function on(t){let e=kt(t,2);if(!e){const n=ye(t);e=an(t);const r=kt(t,1)||wa(t);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),Oe(t)}return e}function ye(t){if(!t.canvas)throw Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return t.h||(t.h=It(t.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),t.h}function Xn(t){return t.l||(t.l=new gs),t.l}function an(t){const e=ye(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=kt(t,2);return n||(n=zn(Xn(t),e),t.g.push(n),t.m=!0),e.bindTexture(e.TEXTURE_2D,n),n}function Oe(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}function gi(t){const e=ye(t);return ds(Xn(t),e,!0,(()=>(function(n,r){const s=n.canvas;if(s.width===n.width&&s.height===n.height)return r();const i=s.width,o=s.height;return s.width=n.width,s.height=n.height,n=r(),s.width=i,s.height=o,n})(t,(()=>{if(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),!(t.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return t.canvas.transferToImageBitmap()}))))}var W=class{constructor(t,e,n,r,s,i,o){this.g=t,this.j=e,this.m=n,this.canvas=r,this.l=s,this.width=i,this.height=o,(this.j||this.m)&&--mi===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ia(){return!!kt(this,0)}na(){return!!kt(this,1)}S(){return!!kt(this,2)}Ga(){return wa(this)}Fa(){var t=kt(this,1);return t||(on(this),an(this),t=gi(this),Oe(this),this.g.push(t),this.j=!0),t}N(){return on(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof ImageData)n=new ImageData(e.data,this.width,this.height);else if(e instanceof WebGLTexture){const r=ye(this),s=Xn(this);r.activeTexture(r.TEXTURE1),n=zn(s,r),r.bindTexture(r.TEXTURE_2D,n),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.width,this.height,0,r.RGBA,r.UNSIGNED_BYTE,null),r.bindTexture(r.TEXTURE_2D,null),Kn(s,r,n),ds(s,r,!1,(()=>{an(this),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),Oe(this)})),ps(s),Oe(this)}else{if(!(e instanceof ImageBitmap))throw Error(`Type is not supported: ${e}`);on(this),an(this),n=gi(this),Oe(this)}t.push(n)}return new W(t,this.na(),this.S(),this.canvas,this.l,this.width,this.height)}close(){this.j&&kt(this,1).close(),this.m&&ye(this).deleteTexture(kt(this,2)),mi=-1}};W.prototype.close=W.prototype.close,W.prototype.clone=W.prototype.clone,W.prototype.getAsWebGLTexture=W.prototype.N,W.prototype.getAsImageBitmap=W.prototype.Fa,W.prototype.getAsImageData=W.prototype.Ga,W.prototype.hasWebGLTexture=W.prototype.S,W.prototype.hasImageBitmap=W.prototype.na,W.prototype.hasImageData=W.prototype.Ia;var mi=250;function wt(...t){return t.map((([e,n])=>({start:e,end:n})))}const t1=(function(t){return class extends t{Oa(){this.i._registerModelResourcesGraphService()}}})((yi=class{constructor(t,e){this.l=!0,this.i=t,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",e!==void 0?this.i.canvas=e:ga()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph(new TextEncoder().encode(t),!1)}setGraph(t,e){const n=t.length,r=this.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),d(this,r||"input_audio",(i=>{d(this,s=s||"audio_header",(o=>{this.i._configureAudio(i,o,t,e,n)}))}))}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}ga(t){bt(this,"__graph_config__",(e=>{t(e)})),d(this,"__graph_config__",(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,s){const i=4*t.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(t,this.g/4),d(this,r,(o=>{this.i._addAudioToInputStream(this.g,e,n,o,s)}))}addGpuBufferToStream(t,e,n){d(this,e,(r=>{const[s,i]=ci(this,t,r);this.i._addBoundTextureToStream(r,s,i,n)}))}addBoolToStream(t,e,n){d(this,e,(r=>{this.i._addBoolToInputStream(t,r,n)}))}addDoubleToStream(t,e,n){d(this,e,(r=>{this.i._addDoubleToInputStream(t,r,n)}))}addFloatToStream(t,e,n){d(this,e,(r=>{this.i._addFloatToInputStream(t,r,n)}))}addIntToStream(t,e,n){d(this,e,(r=>{this.i._addIntToInputStream(t,r,n)}))}addUintToStream(t,e,n){d(this,e,(r=>{this.i._addUintToInputStream(t,r,n)}))}addStringToStream(t,e,n){d(this,e,(r=>{d(this,t,(s=>{this.i._addStringToInputStream(s,r,n)}))}))}addStringRecordToStream(t,e,n){d(this,e,(r=>{ui(this,Object.keys(t),(s=>{ui(this,Object.values(t),(i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(t).length,r,n)}))}))}))}addProtoToStream(t,e,n,r){d(this,n,(s=>{d(this,e,(i=>{const o=this.i._malloc(t.length);this.i.HEAPU8.set(t,o),this.i._addProtoToInputStream(o,t.length,i,s,r),this.i._free(o)}))}))}addEmptyPacketToStream(t,e){d(this,t,(n=>{this.i._addEmptyPacketToInputStream(n,e)}))}addBoolVectorToStream(t,e,n){d(this,e,(r=>{const s=this.i._allocateBoolVector(t.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of t)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,r,n)}))}addDoubleVectorToStream(t,e,n){d(this,e,(r=>{const s=this.i._allocateDoubleVector(t.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of t)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,r,n)}))}addFloatVectorToStream(t,e,n){d(this,e,(r=>{const s=this.i._allocateFloatVector(t.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of t)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,r,n)}))}addIntVectorToStream(t,e,n){d(this,e,(r=>{const s=this.i._allocateIntVector(t.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of t)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,r,n)}))}addUintVectorToStream(t,e,n){d(this,e,(r=>{const s=this.i._allocateUintVector(t.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of t)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,r,n)}))}addStringVectorToStream(t,e,n){d(this,e,(r=>{const s=this.i._allocateStringVector(t.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of t)d(this,i,(o=>{this.i._addStringVectorEntry(s,o)}));this.i._addStringVectorToInputStream(s,r,n)}))}addBoolToInputSidePacket(t,e){d(this,e,(n=>{this.i._addBoolToInputSidePacket(t,n)}))}addDoubleToInputSidePacket(t,e){d(this,e,(n=>{this.i._addDoubleToInputSidePacket(t,n)}))}addFloatToInputSidePacket(t,e){d(this,e,(n=>{this.i._addFloatToInputSidePacket(t,n)}))}addIntToInputSidePacket(t,e){d(this,e,(n=>{this.i._addIntToInputSidePacket(t,n)}))}addUintToInputSidePacket(t,e){d(this,e,(n=>{this.i._addUintToInputSidePacket(t,n)}))}addStringToInputSidePacket(t,e){d(this,e,(n=>{d(this,t,(r=>{this.i._addStringToInputSidePacket(r,n)}))}))}addProtoToInputSidePacket(t,e,n){d(this,n,(r=>{d(this,e,(s=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputSidePacket(i,t.length,s,r),this.i._free(i)}))}))}addBoolVectorToInputSidePacket(t,e){d(this,e,(n=>{const r=this.i._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const s of t)this.i._addBoolVectorEntry(r,s);this.i._addBoolVectorToInputSidePacket(r,n)}))}addDoubleVectorToInputSidePacket(t,e){d(this,e,(n=>{const r=this.i._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const s of t)this.i._addDoubleVectorEntry(r,s);this.i._addDoubleVectorToInputSidePacket(r,n)}))}addFloatVectorToInputSidePacket(t,e){d(this,e,(n=>{const r=this.i._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const s of t)this.i._addFloatVectorEntry(r,s);this.i._addFloatVectorToInputSidePacket(r,n)}))}addIntVectorToInputSidePacket(t,e){d(this,e,(n=>{const r=this.i._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const s of t)this.i._addIntVectorEntry(r,s);this.i._addIntVectorToInputSidePacket(r,n)}))}addUintVectorToInputSidePacket(t,e){d(this,e,(n=>{const r=this.i._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of t)this.i._addUintVectorEntry(r,s);this.i._addUintVectorToInputSidePacket(r,n)}))}addStringVectorToInputSidePacket(t,e){d(this,e,(n=>{const r=this.i._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const s of t)d(this,s,(i=>{this.i._addStringVectorEntry(r,i)}));this.i._addStringVectorToInputSidePacket(r,n)}))}attachBoolListener(t,e){bt(this,t,e),d(this,t,(n=>{this.i._attachBoolListener(n)}))}attachBoolVectorListener(t,e){Dt(this,t,e),d(this,t,(n=>{this.i._attachBoolVectorListener(n)}))}attachIntListener(t,e){bt(this,t,e),d(this,t,(n=>{this.i._attachIntListener(n)}))}attachIntVectorListener(t,e){Dt(this,t,e),d(this,t,(n=>{this.i._attachIntVectorListener(n)}))}attachUintListener(t,e){bt(this,t,e),d(this,t,(n=>{this.i._attachUintListener(n)}))}attachUintVectorListener(t,e){Dt(this,t,e),d(this,t,(n=>{this.i._attachUintVectorListener(n)}))}attachDoubleListener(t,e){bt(this,t,e),d(this,t,(n=>{this.i._attachDoubleListener(n)}))}attachDoubleVectorListener(t,e){Dt(this,t,e),d(this,t,(n=>{this.i._attachDoubleVectorListener(n)}))}attachFloatListener(t,e){bt(this,t,e),d(this,t,(n=>{this.i._attachFloatListener(n)}))}attachFloatVectorListener(t,e){Dt(this,t,e),d(this,t,(n=>{this.i._attachFloatVectorListener(n)}))}attachStringListener(t,e){bt(this,t,e),d(this,t,(n=>{this.i._attachStringListener(n)}))}attachStringVectorListener(t,e){Dt(this,t,e),d(this,t,(n=>{this.i._attachStringVectorListener(n)}))}attachProtoListener(t,e,n){bt(this,t,e),d(this,t,(r=>{this.i._attachProtoListener(r,n||!1)}))}attachProtoVectorListener(t,e,n){Dt(this,t,e),d(this,t,(r=>{this.i._attachProtoVectorListener(r,n||!1)}))}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),bt(this,t,((r,s)=>{r=new Float32Array(r.buffer,r.byteOffset,r.length/4),e(r,s)})),d(this,t,(r=>{this.i._attachAudioListener(r,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends yi{get ia(){return this.i}ta(t,e,n){d(this,e,(r=>{const[s,i]=ci(this,t,r);this.ia._addBoundTextureAsImageToStream(r,s,i,n)}))}W(t,e){bt(this,t,e),d(this,t,(n=>{this.ia._attachImageListener(n)}))}fa(t,e){Dt(this,t,e),d(this,t,(n=>{this.ia._attachImageVectorListener(n)}))}}));var yi,pt=class extends t1{};async function y(t,e,n){return(async function(r,s,i,o){return Z2(r,s,i,o)})(t,n.canvas??(ga()?void 0:document.createElement("canvas")),e,n)}function ba(t,e,n,r){if(t.V){const i=new Uo;if(n?.regionOfInterest){if(!t.sa)throw Error("This task doesn't support region-of-interest.");var s=n.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");f(i,1,(s.left+s.right)/2),f(i,2,(s.top+s.bottom)/2),f(i,4,s.right-s.left),f(i,3,s.bottom-s.top)}else f(i,1,.5),f(i,2,.5),f(i,4,1),f(i,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(f(i,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){const[o,h]=ma(e);n=D(i,3)*h/o,s=D(i,4)*o/h,f(i,4,n),f(i,3,s)}}t.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",t.V,r)}t.g.ta(e,t.da,r??performance.now()),t.finishProcessing()}function gt(t,e,n){if(t.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");ba(t,e,n,t.B+1)}function Ft(t,e,n,r){if(!t.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");ba(t,e,n,r)}function _e(t,e,n,r){var s=e.data;const i=e.width,o=i*(e=e.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return t=new H([s],n,!1,t.g.i.canvas,t.R,i,e),r?t.clone():t}var $=class extends sn{constructor(t,e,n,r){super(t),this.g=t,this.da=e,this.V=n,this.sa=r,this.R=new gs}l(t,e=!0){if("runningMode"in t&&Ge(this.baseOptions,2,!!t.runningMode&&t.runningMode!=="IMAGE"),t.canvas!==void 0&&this.g.i.canvas!==t.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(t,e)}close(){this.R.close(),super.close()}};$.prototype.close=$.prototype.close;var at=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect_in",!1),this.j={detections:[]},p(t=this.h=new jn,0,1,e=new x),f(this.h,2,.5),f(this.h,3,.3)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return"minDetectionConfidence"in t&&f(this.h,2,t.minDetectionConfidence??.5),"minSuppressionThreshold"in t&&f(this.h,3,t.minSuppressionThreshold??.3),this.l(t)}D(t,e){return this.j={detections:[]},gt(this,t,e),this.j}F(t,e,n){return this.j={detections:[]},Ft(this,t,n,e),this.j}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect_in"),w(t,"detections");const e=new st;_t(e,D2,this.h);const n=new K;it(n,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect_in"),_(n,"DETECTIONS:detections"),n.o(e),ot(t,n),this.g.attachProtoVectorListener("detections",((r,s)=>{for(const i of r)r=Co(i),this.j.detections.push(da(r));u(this,s)})),this.g.attachEmptyPacketListener("detections",(r=>{u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};at.prototype.detectForVideo=at.prototype.F,at.prototype.detect=at.prototype.D,at.prototype.setOptions=at.prototype.o,at.createFromModelPath=async function(t,e){return y(at,t,{baseOptions:{modelAssetPath:e}})},at.createFromModelBuffer=function(t,e){return y(at,t,{baseOptions:{modelAssetBuffer:e}})},at.createFromOptions=function(t,e){return y(at,t,e)};var ys=wt([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),_s=wt([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),vs=wt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Aa=wt([474,475],[475,476],[476,477],[477,474]),ws=wt([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),bs=wt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Ea=wt([469,470],[470,471],[471,472],[472,469]),As=wt([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),ka=[...ys,..._s,...vs,...ws,...bs,...As],Ta=wt([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function _i(t){t.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var N=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,p(t=this.h=new Xo,0,1,e=new x),this.v=new Ko,p(this.h,0,3,this.v),this.s=new jn,p(this.h,0,2,this.s),St(this.s,4,1),f(this.s,2,.5),f(this.v,2,.5),f(this.h,4,.5)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return"numFaces"in t&&St(this.s,4,t.numFaces??1),"minFaceDetectionConfidence"in t&&f(this.s,2,t.minFaceDetectionConfidence??.5),"minTrackingConfidence"in t&&f(this.h,4,t.minTrackingConfidence??.5),"minFacePresenceConfidence"in t&&f(this.v,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in t&&(this.outputFacialTransformationMatrixes=!!t.outputFacialTransformationMatrixes),this.l(t)}D(t,e){return _i(this),gt(this,t,e),this.j}F(t,e,n){return _i(this),Ft(this,t,n,e),this.j}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect"),w(t,"face_landmarks");const e=new st;_t(e,U2,this.h);const n=new K;it(n,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect"),_(n,"NORM_LANDMARKS:face_landmarks"),n.o(e),ot(t,n),this.g.attachProtoVectorListener("face_landmarks",((r,s)=>{for(const i of r)r=Xe(i),this.j.faceLandmarks.push(Vn(r));u(this,s)})),this.g.attachEmptyPacketListener("face_landmarks",(r=>{u(this,r)})),this.outputFaceBlendshapes&&(w(t,"blendshapes"),_(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((r,s)=>{if(this.outputFaceBlendshapes)for(const i of r)r=Gn(i),this.j.faceBlendshapes.push(ls(r.g()??[]));u(this,s)})),this.g.attachEmptyPacketListener("blendshapes",(r=>{u(this,r)}))),this.outputFacialTransformationMatrixes&&(w(t,"face_geometry"),_(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((r,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of r)(r=v(B2(i),M2,2))&&this.j.facialTransformationMatrixes.push({rows:mt(lt(r,1),0)??0,columns:mt(lt(r,2),0)??0,data:qt(r,3,Kt,$t()).slice()??[]});u(this,s)})),this.g.attachEmptyPacketListener("face_geometry",(r=>{u(this,r)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};N.prototype.detectForVideo=N.prototype.F,N.prototype.detect=N.prototype.D,N.prototype.setOptions=N.prototype.o,N.createFromModelPath=function(t,e){return y(N,t,{baseOptions:{modelAssetPath:e}})},N.createFromModelBuffer=function(t,e){return y(N,t,{baseOptions:{modelAssetBuffer:e}})},N.createFromOptions=function(t,e){return y(N,t,e)},N.FACE_LANDMARKS_LIPS=ys,N.FACE_LANDMARKS_LEFT_EYE=_s,N.FACE_LANDMARKS_LEFT_EYEBROW=vs,N.FACE_LANDMARKS_LEFT_IRIS=Aa,N.FACE_LANDMARKS_RIGHT_EYE=ws,N.FACE_LANDMARKS_RIGHT_EYEBROW=bs,N.FACE_LANDMARKS_RIGHT_IRIS=Ea,N.FACE_LANDMARKS_FACE_OVAL=As,N.FACE_LANDMARKS_CONTOURS=ka,N.FACE_LANDMARKS_TESSELATION=Ta;var At=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect",!0),p(t=this.j=new $o,0,1,e=new x)}get baseOptions(){return v(this.j,x,1)}set baseOptions(t){p(this.j,0,1,t)}o(t){return super.l(t)}Ra(t,e,n){const r=typeof e!="function"?e:{};if(this.h=typeof e=="function"?e:n,gt(this,t,r??{}),!this.h)return this.s}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect"),w(t,"stylized_image");const e=new st;_t(e,G2,this.j);const n=new K;it(n,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect"),_(n,"STYLIZED_IMAGE:stylized_image"),n.o(e),ot(t,n),this.g.W("stylized_image",((r,s)=>{var i=!this.h,o=r.data,h=r.width;const a=h*(r=r.height);if(o instanceof Uint8Array)if(o.length===3*a){const c=new Uint8ClampedArray(4*a);for(let g=0;g<a;++g)c[4*g]=o[3*g],c[4*g+1]=o[3*g+1],c[4*g+2]=o[3*g+2],c[4*g+3]=255;o=new ImageData(c,h,r)}else{if(o.length!==4*a)throw Error("Unsupported channel count: "+o.length/a);o=new ImageData(new Uint8ClampedArray(o.buffer,o.byteOffset,o.length),h,r)}else if(!(o instanceof WebGLTexture))throw Error(`Unsupported format: ${o.constructor.name}`);h=new W([o],!1,!1,this.g.i.canvas,this.R,h,r),this.s=i=i?h.clone():h,this.h&&this.h(i),u(this,s)})),this.g.attachEmptyPacketListener("stylized_image",(r=>{this.s=null,this.h&&this.h(null),u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};At.prototype.stylize=At.prototype.Ra,At.prototype.setOptions=At.prototype.o,At.createFromModelPath=function(t,e){return y(At,t,{baseOptions:{modelAssetPath:e}})},At.createFromModelBuffer=function(t,e){return y(At,t,{baseOptions:{modelAssetBuffer:e}})},At.createFromOptions=function(t,e){return y(At,t,e)};var Es=wt([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function vi(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function wi(t){return t.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:t.gestures,landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handedness:t.handedness,handednesses:t.handedness}}function bi(t,e=!0){const n=[];for(const s of t){var r=Gn(s);t=[];for(const i of r.g())r=e&&lt(i,1)!=null?mt(lt(i,1),0):-1,t.push({score:D(i,2)??0,index:r,categoryName:Tt(i,3)??"",displayName:Tt(i,4)??""});n.push(t)}return n}var Q=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],p(t=this.j=new Qo,0,1,e=new x),this.s=new hs,p(this.j,0,2,this.s),this.C=new as,p(this.s,0,3,this.C),this.v=new Zo,p(this.s,0,2,this.v),this.h=new j2,p(this.j,0,3,this.h),f(this.v,2,.5),f(this.s,4,.5),f(this.C,2,.5)}get baseOptions(){return v(this.j,x,1)}set baseOptions(t){p(this.j,0,1,t)}o(t){if(St(this.v,3,t.numHands??1),"minHandDetectionConfidence"in t&&f(this.v,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&f(this.s,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&f(this.C,2,t.minHandPresenceConfidence??.5),t.cannedGesturesClassifierOptions){var e=new se,n=e,r=Ar(t.cannedGesturesClassifierOptions,v(this.h,se,3)?.h());p(n,0,2,r),p(this.h,0,3,e)}else t.cannedGesturesClassifierOptions===void 0&&v(this.h,se,3)?.g();return t.customGesturesClassifierOptions?(p(n=e=new se,0,2,r=Ar(t.customGesturesClassifierOptions,v(this.h,se,4)?.h())),p(this.h,0,4,e)):t.customGesturesClassifierOptions===void 0&&v(this.h,se,4)?.g(),this.l(t)}Ma(t,e){return vi(this),gt(this,t,e),wi(this)}Na(t,e,n){return vi(this),Ft(this,t,n,e),wi(this)}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect"),w(t,"hand_gestures"),w(t,"hand_landmarks"),w(t,"world_hand_landmarks"),w(t,"handedness");const e=new st;_t(e,W2,this.j);const n=new K;it(n,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect"),_(n,"HAND_GESTURES:hand_gestures"),_(n,"LANDMARKS:hand_landmarks"),_(n,"WORLD_LANDMARKS:world_hand_landmarks"),_(n,"HANDEDNESS:handedness"),n.o(e),ot(t,n),this.g.attachProtoVectorListener("hand_landmarks",((r,s)=>{for(const i of r){r=Xe(i);const o=[];for(const h of Nt(r,Bo,1))o.push({x:D(h,1)??0,y:D(h,2)??0,z:D(h,3)??0,visibility:D(h,4)??0});this.landmarks.push(o)}u(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(r=>{u(this,r)})),this.g.attachProtoVectorListener("world_hand_landmarks",((r,s)=>{for(const i of r){r=ce(i);const o=[];for(const h of Nt(r,Do,1))o.push({x:D(h,1)??0,y:D(h,2)??0,z:D(h,3)??0,visibility:D(h,4)??0});this.worldLandmarks.push(o)}u(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(r=>{u(this,r)})),this.g.attachProtoVectorListener("hand_gestures",((r,s)=>{this.gestures.push(...bi(r,!1)),u(this,s)})),this.g.attachEmptyPacketListener("hand_gestures",(r=>{u(this,r)})),this.g.attachProtoVectorListener("handedness",((r,s)=>{this.handedness.push(...bi(r)),u(this,s)})),this.g.attachEmptyPacketListener("handedness",(r=>{u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function Ai(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}Q.prototype.recognizeForVideo=Q.prototype.Na,Q.prototype.recognize=Q.prototype.Ma,Q.prototype.setOptions=Q.prototype.o,Q.createFromModelPath=function(t,e){return y(Q,t,{baseOptions:{modelAssetPath:e}})},Q.createFromModelBuffer=function(t,e){return y(Q,t,{baseOptions:{modelAssetBuffer:e}})},Q.createFromOptions=function(t,e){return y(Q,t,e)},Q.HAND_CONNECTIONS=Es;var tt=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],p(t=this.h=new hs,0,1,e=new x),this.s=new as,p(this.h,0,3,this.s),this.j=new Zo,p(this.h,0,2,this.j),St(this.j,3,1),f(this.j,2,.5),f(this.s,2,.5),f(this.h,4,.5)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return"numHands"in t&&St(this.j,3,t.numHands??1),"minHandDetectionConfidence"in t&&f(this.j,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&f(this.h,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&f(this.s,2,t.minHandPresenceConfidence??.5),this.l(t)}D(t,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],gt(this,t,e),Ai(this)}F(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ft(this,t,n,e),Ai(this)}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect"),w(t,"hand_landmarks"),w(t,"world_hand_landmarks"),w(t,"handedness");const e=new st;_t(e,H2,this.h);const n=new K;it(n,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect"),_(n,"LANDMARKS:hand_landmarks"),_(n,"WORLD_LANDMARKS:world_hand_landmarks"),_(n,"HANDEDNESS:handedness"),n.o(e),ot(t,n),this.g.attachProtoVectorListener("hand_landmarks",((r,s)=>{for(const i of r)r=Xe(i),this.landmarks.push(Vn(r));u(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(r=>{u(this,r)})),this.g.attachProtoVectorListener("world_hand_landmarks",((r,s)=>{for(const i of r)r=ce(i),this.worldLandmarks.push(Ce(r));u(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(r=>{u(this,r)})),this.g.attachProtoVectorListener("handedness",((r,s)=>{var i=this.handedness,o=i.push;const h=[];for(const a of r){r=Gn(a);const c=[];for(const g of r.g())c.push({score:D(g,2)??0,index:mt(lt(g,1),0)??-1,categoryName:Tt(g,3)??"",displayName:Tt(g,4)??""});h.push(c)}o.call(i,...h),u(this,s)})),this.g.attachEmptyPacketListener("handedness",(r=>{u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};tt.prototype.detectForVideo=tt.prototype.F,tt.prototype.detect=tt.prototype.D,tt.prototype.setOptions=tt.prototype.o,tt.createFromModelPath=function(t,e){return y(tt,t,{baseOptions:{modelAssetPath:e}})},tt.createFromModelBuffer=function(t,e){return y(tt,t,{baseOptions:{modelAssetBuffer:e}})},tt.createFromOptions=function(t,e){return y(tt,t,e)},tt.HAND_CONNECTIONS=Es;var Sa=wt([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function Ei(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function ki(t){try{if(!t.C)return t.h;t.C(t.h)}finally{Wn(t)}}function tn(t,e){t=Xe(t),e.push(Vn(t))}var M=class extends ${constructor(t,e){super(new pt(t,e),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,p(t=this.j=new ia,0,1,e=new x),this.K=new as,p(this.j,0,2,this.K),this.ca=new z2,p(this.j,0,3,this.ca),this.s=new jn,p(this.j,0,4,this.s),this.I=new Ko,p(this.j,0,5,this.I),this.v=new ra,p(this.j,0,6,this.v),this.L=new sa,p(this.j,0,7,this.L),f(this.s,2,.5),f(this.s,3,.3),f(this.I,2,.5),f(this.v,2,.5),f(this.v,3,.3),f(this.L,2,.5),f(this.K,2,.5)}get baseOptions(){return v(this.j,x,1)}set baseOptions(t){p(this.j,0,1,t)}o(t){return"minFaceDetectionConfidence"in t&&f(this.s,2,t.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in t&&f(this.s,3,t.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in t&&f(this.I,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"minPoseDetectionConfidence"in t&&f(this.v,2,t.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in t&&f(this.v,3,t.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in t&&f(this.L,2,t.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in t&&(this.outputPoseSegmentationMasks=!!t.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in t&&f(this.K,2,t.minHandLandmarksConfidence??.5),this.l(t)}D(t,e,n){const r=typeof e!="function"?e:{};return this.C=typeof e=="function"?e:n,Ei(this),gt(this,t,r),ki(this)}F(t,e,n,r){const s=typeof n!="function"?n:{};return this.C=typeof n=="function"?n:r,Ei(this),Ft(this,t,s,e),ki(this)}m(){var t=new Z;F(t,"input_frames_image"),w(t,"pose_landmarks"),w(t,"pose_world_landmarks"),w(t,"face_landmarks"),w(t,"left_hand_landmarks"),w(t,"left_hand_world_landmarks"),w(t,"right_hand_landmarks"),w(t,"right_hand_world_landmarks");const e=new st,n=new qs;dr(n,1,Ae("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(s,i){if(i!=null)if(Array.isArray(i))T(s,2,Mn(i,Hr,void 0,void 0,!1));else{if(!(typeof i=="string"||i instanceof Ot||Ve(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");dr(s,2,Ir(i,!1,!1),ee())}})(n,this.j.g());const r=new K;it(r,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),mn(r,8,qs,n),S(r,"IMAGE:input_frames_image"),_(r,"POSE_LANDMARKS:pose_landmarks"),_(r,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),_(r,"FACE_LANDMARKS:face_landmarks"),_(r,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),_(r,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),_(r,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),_(r,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),r.o(e),ot(t,r),Hn(this,t),this.g.attachProtoListener("pose_landmarks",((s,i)=>{tn(s,this.h.poseLandmarks),u(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(s=>{u(this,s)})),this.g.attachProtoListener("pose_world_landmarks",((s,i)=>{var o=this.h.poseWorldLandmarks;s=ce(s),o.push(Ce(s)),u(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(s=>{u(this,s)})),this.outputPoseSegmentationMasks&&(_(r,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),ge(this,"pose_segmentation_mask"),this.g.W("pose_segmentation_mask",((s,i)=>{this.h.poseSegmentationMasks=[_e(this,s,!0,!this.C)],u(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(s=>{this.h.poseSegmentationMasks=[],u(this,s)}))),this.g.attachProtoListener("face_landmarks",((s,i)=>{tn(s,this.h.faceLandmarks),u(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(s=>{u(this,s)})),this.outputFaceBlendshapes&&(w(t,"extra_blendshapes"),_(r,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=Gn(s),o.push(ls(s.g()??[]))),u(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(s=>{u(this,s)}))),this.g.attachProtoListener("left_hand_landmarks",((s,i)=>{tn(s,this.h.leftHandLandmarks),u(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(s=>{u(this,s)})),this.g.attachProtoListener("left_hand_world_landmarks",((s,i)=>{var o=this.h.leftHandWorldLandmarks;s=ce(s),o.push(Ce(s)),u(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(s=>{u(this,s)})),this.g.attachProtoListener("right_hand_landmarks",((s,i)=>{tn(s,this.h.rightHandLandmarks),u(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(s=>{u(this,s)})),this.g.attachProtoListener("right_hand_world_landmarks",((s,i)=>{var o=this.h.rightHandWorldLandmarks;s=ce(s),o.push(Ce(s)),u(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(s=>{u(this,s)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};M.prototype.detectForVideo=M.prototype.F,M.prototype.detect=M.prototype.D,M.prototype.setOptions=M.prototype.o,M.createFromModelPath=function(t,e){return y(M,t,{baseOptions:{modelAssetPath:e}})},M.createFromModelBuffer=function(t,e){return y(M,t,{baseOptions:{modelAssetBuffer:e}})},M.createFromOptions=function(t,e){return y(M,t,e)},M.HAND_CONNECTIONS=Es,M.POSE_CONNECTIONS=Sa,M.FACE_LANDMARKS_LIPS=ys,M.FACE_LANDMARKS_LEFT_EYE=_s,M.FACE_LANDMARKS_LEFT_EYEBROW=vs,M.FACE_LANDMARKS_LEFT_IRIS=Aa,M.FACE_LANDMARKS_RIGHT_EYE=ws,M.FACE_LANDMARKS_RIGHT_EYEBROW=bs,M.FACE_LANDMARKS_RIGHT_IRIS=Ea,M.FACE_LANDMARKS_FACE_OVAL=As,M.FACE_LANDMARKS_CONTOURS=ka,M.FACE_LANDMARKS_TESSELATION=Ta;var ht=class extends ${constructor(t,e){super(new pt(t,e),"input_image","norm_rect",!0),this.j={classifications:[]},p(t=this.h=new oa,0,1,e=new x)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return p(this.h,0,2,Ar(t,v(this.h,ss,2))),this.l(t)}wa(t,e){return this.j={classifications:[]},gt(this,t,e),this.j}xa(t,e,n){return this.j={classifications:[]},Ft(this,t,n,e),this.j}m(){var t=new Z;F(t,"input_image"),F(t,"norm_rect"),w(t,"classifications");const e=new st;_t(e,K2,this.h);const n=new K;it(n,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),S(n,"IMAGE:input_image"),S(n,"NORM_RECT:norm_rect"),_(n,"CLASSIFICATIONS:classifications"),n.o(e),ot(t,n),this.g.attachProtoListener("classifications",((r,s)=>{this.j=(function(i){const o={classifications:Nt(i,x2,1).map((h=>ls(v(h,No,4)?.g()??[],mt(lt(h,2),0),Tt(h,3))))};return dn(Vt(i,2))!=null&&(o.timestampMs=mt(dn(Vt(i,2)),0)),o})(O2(r)),u(this,s)})),this.g.attachEmptyPacketListener("classifications",(r=>{u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ht.prototype.classifyForVideo=ht.prototype.xa,ht.prototype.classify=ht.prototype.wa,ht.prototype.setOptions=ht.prototype.o,ht.createFromModelPath=function(t,e){return y(ht,t,{baseOptions:{modelAssetPath:e}})},ht.createFromModelBuffer=function(t,e){return y(ht,t,{baseOptions:{modelAssetBuffer:e}})},ht.createFromOptions=function(t,e){return y(ht,t,e)};var et=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect",!0),this.h=new aa,this.embeddings={embeddings:[]},p(t=this.h,0,1,e=new x)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){var e=this.h,n=v(this.h,ri,2);return n=n?n.clone():new ri,t.l2Normalize!==void 0?Ge(n,1,t.l2Normalize):"l2Normalize"in t&&T(n,1),t.quantize!==void 0?Ge(n,2,t.quantize):"quantize"in t&&T(n,2),p(e,0,2,n),this.l(t)}Da(t,e){return gt(this,t,e),this.embeddings}Ea(t,e,n){return Ft(this,t,n,e),this.embeddings}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect"),w(t,"embeddings_out");const e=new st;_t(e,X2,this.h);const n=new K;it(n,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect"),_(n,"EMBEDDINGS:embeddings_out"),n.o(e),ot(t,n),this.g.attachProtoListener("embeddings_out",((r,s)=>{r=R2(r),this.embeddings=(function(i){return{embeddings:Nt(i,N2,1).map((o=>{const h={headIndex:mt(lt(o,3),0)??-1,headName:Tt(o,4)??""};if(ao(o,ni,nr(o,1))!==void 0)o=qt(o=v(o,ni,nr(o,1)),1,Kt,$t()),h.floatEmbedding=o.slice();else{const a=new Uint8Array(0);h.quantizedEmbedding=v(o,I2,nr(o,2))?.ra()?.ua()??a}return h})),timestampMs:mt(dn(Vt(i,2)),0)}})(r),u(this,s)})),this.g.attachEmptyPacketListener("embeddings_out",(r=>{u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};et.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=ai(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=ai(oi(t.quantizedEmbedding),oi(e.quantizedEmbedding))}return t},et.prototype.embedForVideo=et.prototype.Ea,et.prototype.embed=et.prototype.Da,et.prototype.setOptions=et.prototype.o,et.createFromModelPath=function(t,e){return y(et,t,{baseOptions:{modelAssetPath:e}})},et.createFromModelBuffer=function(t,e){return y(et,t,{baseOptions:{modelAssetBuffer:e}})},et.createFromOptions=function(t,e){return y(et,t,e)};var Tr=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};function Ti(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function Si(t){try{const e=new Tr(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{Wn(t)}}Tr.prototype.close=Tr.prototype.close;var Y=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new us,this.v=new ha,p(this.h,0,3,this.v),p(t=this.h,0,1,e=new x)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?T(this.h,2,Ae(t.displayNamesLocale)):"displayNamesLocale"in t&&T(this.h,2),"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}J(){(function(t){const e=Nt(t.ga(),K,1).filter((n=>Tt(n,1).includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(t.s=[],e.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");e.length===1&&(v(e[0],st,7)?.l()?.g()??new Map).forEach(((n,r)=>{t.s[Number(r)]=Tt(n,1)}))})(this)}ha(t,e,n){const r=typeof e!="function"?e:{};return this.j=typeof e=="function"?e:n,Ti(this),gt(this,t,r),Si(this)}Pa(t,e,n,r){const s=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:r,Ti(this),Ft(this,t,s,e),Si(this)}Ha(){return this.s}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect");const e=new st;_t(e,ua,this.h);const n=new K;it(n,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect"),n.o(e),ot(t,n),Hn(this,t),this.outputConfidenceMasks&&(w(t,"confidence_masks"),_(n,"CONFIDENCE_MASKS:confidence_masks"),ge(this,"confidence_masks"),this.g.fa("confidence_masks",((r,s)=>{this.confidenceMasks=r.map((i=>_e(this,i,!0,!this.j))),u(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(r=>{this.confidenceMasks=[],u(this,r)}))),this.outputCategoryMask&&(w(t,"category_mask"),_(n,"CATEGORY_MASK:category_mask"),ge(this,"category_mask"),this.g.W("category_mask",((r,s)=>{this.categoryMask=_e(this,r,!1,!this.j),u(this,s)})),this.g.attachEmptyPacketListener("category_mask",(r=>{this.categoryMask=void 0,u(this,r)}))),w(t,"quality_scores"),_(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((r,s)=>{this.qualityScores=r,u(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(r=>{this.categoryMask=void 0,u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Y.prototype.getLabels=Y.prototype.Ha,Y.prototype.segmentForVideo=Y.prototype.Pa,Y.prototype.segment=Y.prototype.ha,Y.prototype.setOptions=Y.prototype.o,Y.createFromModelPath=function(t,e){return y(Y,t,{baseOptions:{modelAssetPath:e}})},Y.createFromModelBuffer=function(t,e){return y(Y,t,{baseOptions:{modelAssetBuffer:e}})},Y.createFromOptions=function(t,e){return y(Y,t,e)};var Sr=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};Sr.prototype.close=Sr.prototype.close;var e1=class extends l{constructor(t){super(t)}},oe=[0,C,-2],wn=[0,Mt,-3,O,Mt,-1],Li=[0,wn],Fi=[0,wn,C,-1],ar=class extends l{constructor(t){super(t)}},Mi=[0,Mt,-1,O],n1=class extends l{constructor(){super()}},Pi=class extends l{constructor(t){super(t)}},Lr=[1,2,3,4,5,6,7,8,9,10,14,15],La=class extends l{constructor(){super()}};La.prototype.g=Un([0,G,[0,Lr,E,wn,E,[0,wn,oe],E,Li,E,[0,Li,oe],E,Mi,E,[0,Mt,-3,O,yt],E,[0,Mt,-3,O],E,[0,A,Mt,-2,O,C,O,-1,2,Mt,oe],E,Fi,E,[0,Fi,oe],Mt,oe,A,E,[0,Mt,-3,O,oe,-1],E,[0,G,Mi]],A,[0,A,C,-1,O]]);var Et=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new us,this.s=new ha,p(this.h,0,3,this.s),p(t=this.h,0,1,e=new x)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}ha(t,e,n,r){const s=typeof n!="function"?n:{};this.j=typeof n=="function"?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.B+1,r=new La;const i=new Pi;var o=new e1;if(St(o,1,255),p(i,0,12,o),e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var h=new ar;Ge(h,3,!0),f(h,1,e.keypoint.x),f(h,2,e.keypoint.y),Ie(i,5,Lr,h)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");for(h of(o=new n1,e.scribble))Ge(e=new ar,3,!0),f(e,1,h.x),f(e,2,h.y),mn(o,1,ar,e);Ie(i,15,Lr,o)}mn(r,1,Pi,i),this.g.addProtoToStream(r.g(),"drishti.RenderData","roi_in",n),gt(this,t,s);t:{try{const c=new Sr(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var a=c;break t}this.j(c)}finally{Wn(this)}a=void 0}return a}m(){var t=new Z;F(t,"image_in"),F(t,"roi_in"),F(t,"norm_rect_in");const e=new st;_t(e,ua,this.h);const n=new K;it(n,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),S(n,"IMAGE:image_in"),S(n,"ROI:roi_in"),S(n,"NORM_RECT:norm_rect_in"),n.o(e),ot(t,n),Hn(this,t),this.outputConfidenceMasks&&(w(t,"confidence_masks"),_(n,"CONFIDENCE_MASKS:confidence_masks"),ge(this,"confidence_masks"),this.g.fa("confidence_masks",((r,s)=>{this.confidenceMasks=r.map((i=>_e(this,i,!0,!this.j))),u(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(r=>{this.confidenceMasks=[],u(this,r)}))),this.outputCategoryMask&&(w(t,"category_mask"),_(n,"CATEGORY_MASK:category_mask"),ge(this,"category_mask"),this.g.W("category_mask",((r,s)=>{this.categoryMask=_e(this,r,!1,!this.j),u(this,s)})),this.g.attachEmptyPacketListener("category_mask",(r=>{this.categoryMask=void 0,u(this,r)}))),w(t,"quality_scores"),_(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((r,s)=>{this.qualityScores=r,u(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(r=>{this.categoryMask=void 0,u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Et.prototype.segment=Et.prototype.ha,Et.prototype.setOptions=Et.prototype.o,Et.createFromModelPath=function(t,e){return y(Et,t,{baseOptions:{modelAssetPath:e}})},Et.createFromModelBuffer=function(t,e){return y(Et,t,{baseOptions:{modelAssetBuffer:e}})},Et.createFromOptions=function(t,e){return y(Et,t,e)};var ct=class extends ${constructor(t,e){super(new pt(t,e),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},p(t=this.h=new la,0,1,e=new x)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?T(this.h,2,Ae(t.displayNamesLocale)):"displayNamesLocale"in t&&T(this.h,2),t.maxResults!==void 0?St(this.h,3,t.maxResults):"maxResults"in t&&T(this.h,3),t.scoreThreshold!==void 0?f(this.h,4,t.scoreThreshold):"scoreThreshold"in t&&T(this.h,4),t.categoryAllowlist!==void 0?yn(this.h,5,t.categoryAllowlist):"categoryAllowlist"in t&&T(this.h,5),t.categoryDenylist!==void 0?yn(this.h,6,t.categoryDenylist):"categoryDenylist"in t&&T(this.h,6),this.l(t)}D(t,e){return this.j={detections:[]},gt(this,t,e),this.j}F(t,e,n){return this.j={detections:[]},Ft(this,t,n,e),this.j}m(){var t=new Z;F(t,"input_frame_gpu"),F(t,"norm_rect"),w(t,"detections");const e=new st;_t(e,$2,this.h);const n=new K;it(n,"mediapipe.tasks.vision.ObjectDetectorGraph"),S(n,"IMAGE:input_frame_gpu"),S(n,"NORM_RECT:norm_rect"),_(n,"DETECTIONS:detections"),n.o(e),ot(t,n),this.g.attachProtoVectorListener("detections",((r,s)=>{for(const i of r)r=Co(i),this.j.detections.push(da(r));u(this,s)})),this.g.attachEmptyPacketListener("detections",(r=>{u(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ct.prototype.detectForVideo=ct.prototype.F,ct.prototype.detect=ct.prototype.D,ct.prototype.setOptions=ct.prototype.o,ct.createFromModelPath=async function(t,e){return y(ct,t,{baseOptions:{modelAssetPath:e}})},ct.createFromModelBuffer=function(t,e){return y(ct,t,{baseOptions:{modelAssetBuffer:e}})},ct.createFromOptions=function(t,e){return y(ct,t,e)};var Fr=class{constructor(t,e,n){this.landmarks=t,this.worldLandmarks=e,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((t=>{t.close()}))}};function xi(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function Oi(t){try{const e=new Fr(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.s)return e;t.s(e)}finally{Wn(t)}}Fr.prototype.close=Fr.prototype.close;var nt=class extends ${constructor(t,e){super(new pt(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,p(t=this.h=new fa,0,1,e=new x),this.v=new sa,p(this.h,0,3,this.v),this.j=new ra,p(this.h,0,2,this.j),St(this.j,4,1),f(this.j,2,.5),f(this.v,2,.5),f(this.h,4,.5)}get baseOptions(){return v(this.h,x,1)}set baseOptions(t){p(this.h,0,1,t)}o(t){return"numPoses"in t&&St(this.j,4,t.numPoses??1),"minPoseDetectionConfidence"in t&&f(this.j,2,t.minPoseDetectionConfidence??.5),"minTrackingConfidence"in t&&f(this.h,4,t.minTrackingConfidence??.5),"minPosePresenceConfidence"in t&&f(this.v,2,t.minPosePresenceConfidence??.5),"outputSegmentationMasks"in t&&(this.outputSegmentationMasks=t.outputSegmentationMasks??!1),this.l(t)}D(t,e,n){const r=typeof e!="function"?e:{};return this.s=typeof e=="function"?e:n,xi(this),gt(this,t,r),Oi(this)}F(t,e,n,r){const s=typeof n!="function"?n:{};return this.s=typeof n=="function"?n:r,xi(this),Ft(this,t,s,e),Oi(this)}m(){var t=new Z;F(t,"image_in"),F(t,"norm_rect"),w(t,"normalized_landmarks"),w(t,"world_landmarks"),w(t,"segmentation_masks");const e=new st;_t(e,q2,this.h);const n=new K;it(n,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),S(n,"IMAGE:image_in"),S(n,"NORM_RECT:norm_rect"),_(n,"NORM_LANDMARKS:normalized_landmarks"),_(n,"WORLD_LANDMARKS:world_landmarks"),n.o(e),ot(t,n),Hn(this,t),this.g.attachProtoVectorListener("normalized_landmarks",((r,s)=>{this.landmarks=[];for(const i of r)r=Xe(i),this.landmarks.push(Vn(r));u(this,s)})),this.g.attachEmptyPacketListener("normalized_landmarks",(r=>{this.landmarks=[],u(this,r)})),this.g.attachProtoVectorListener("world_landmarks",((r,s)=>{this.worldLandmarks=[];for(const i of r)r=ce(i),this.worldLandmarks.push(Ce(r));u(this,s)})),this.g.attachEmptyPacketListener("world_landmarks",(r=>{this.worldLandmarks=[],u(this,r)})),this.outputSegmentationMasks&&(_(n,"SEGMENTATION_MASK:segmentation_masks"),ge(this,"segmentation_masks"),this.g.fa("segmentation_masks",((r,s)=>{this.segmentationMasks=r.map((i=>_e(this,i,!0,!this.s))),u(this,s)})),this.g.attachEmptyPacketListener("segmentation_masks",(r=>{this.segmentationMasks=[],u(this,r)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};nt.prototype.detectForVideo=nt.prototype.F,nt.prototype.detect=nt.prototype.D,nt.prototype.setOptions=nt.prototype.o,nt.createFromModelPath=function(t,e){return y(nt,t,{baseOptions:{modelAssetPath:e}})},nt.createFromModelBuffer=function(t,e){return y(nt,t,{baseOptions:{modelAssetBuffer:e}})},nt.createFromOptions=function(t,e){return y(nt,t,e)},nt.POSE_CONNECTIONS=Sa;export{at as FaceDetector,N as FaceLandmarker,At as FaceStylizer,ie as FilesetResolver,Q as GestureRecognizer,tt as HandLandmarker,M as HolisticLandmarker,ht as ImageClassifier,et as ImageEmbedder,Y as ImageSegmenter,Tr as ImageSegmenterResult,Et as InteractiveSegmenter,Sr as InteractiveSegmenterResult,W as MPImage,H as MPMask,ct as ObjectDetector,nt as PoseLandmarker,$ as VisionTaskRunner};
@@ -0,0 +1 @@
1
+ import{C,aB as F,aC as z}from"./three.module-D396a9Mn.js";class w extends Error{constructor(o){super(o),this.name="VoxelSurfaceError"}}const b=[{normal:[1,0,0],corners:[[1,0,1],[1,0,0],[1,1,0],[1,1,1]]},{normal:[-1,0,0],corners:[[0,0,0],[0,0,1],[0,1,1],[0,1,0]]},{normal:[0,1,0],corners:[[0,1,1],[1,1,1],[1,1,0],[0,1,0]]},{normal:[0,-1,0],corners:[[0,0,0],[1,0,0],[1,0,1],[0,0,1]]},{normal:[0,0,1],corners:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{normal:[0,0,-1],corners:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function Y(e,o){if(e.length%2!==0)throw new w(`a run list is [count, type] pairs, so its length must be even; got ${e.length}`);let n=0,t=0;for(let s=0;s<e.length;s+=2){const l=e[s];if(!Number.isInteger(l)||l<=0)throw new w(`run ${s/2} has a count of ${l}; counts are positive`);t+=l,n=Math.max(n,e[s+1])}if(t!==o)throw new w(`the runs cover ${t} cells; the volume holds ${o}`);const c=n>65535?new Uint32Array(o):new Uint16Array(o);let d=0;for(let s=0;s<e.length;s+=2){const l=e[s];c.fill(e[s+1],d,d+l),d+=l}return c}function E(e){const[o,n,t]=e.size;if(o<=0||n<=0||t<=0)throw new w(`a volume needs a positive size on every axis; got ${e.size}`);const c=o*n*t;if(e.cells.length!==c)throw new w(`a ${o}×${n}×${t} volume holds ${c} cells; got ${e.cells.length}`);return[o,n,t]}function U(e,o,n,t){if(e===void 0)return;const c=e.get(o);if(c===void 0)throw new w(`no colour for type ${o}, which cell ${n} holds — every solid type in the volume needs a row, so a forgotten one fails here rather than drawing white`);return t.setHex(c)}function M(e,o,n,t,c,d){const[s,l,f]=o;let g=0;for(const m of b){const[x,y,$]=m.normal;if(c(s+x,l+y,f+$))continue;const h=e.positions.length/3;for(const[u,v,A]of m.corners)e.positions.push(...d(s+u,l+v,f+A)),e.normals.push(x,y,$),t!==void 0&&e.colors.push(t.r,t.g,t.b);e.indices.push(h,h+1,h+2,h,h+2,h+3),e.quadsByType.set(n,(e.quadsByType.get(n)??0)+1),g+=1}return g}function Z(e,o={}){const[n,t,c]=E(e),d=o.emptyType??0,s=o.closedBoundary!==!0,l=e.cellSize??1,[f,g,m]=e.origin??[0,0,0],x=e.cells,y=(r,i,a)=>x[(i*c+a)*n+r],$=(r,i,a)=>r<0||i<0||a<0||r>=n||i>=t||a>=c?!s:y(r,i,a)!==d,h=(r,i,a)=>[f+r*l,g+i*l,m+a*l],u={positions:[],normals:[],colors:[],indices:[],quadsByType:new Map},v=new C;let A=0,S=0;for(let r=0;r<t;r+=1)for(let i=0;i<c;i+=1)for(let a=0;a<n;a+=1){const B=y(a,r,i);if(B===d)continue;A+=1;const T=U(o.colors,B,`(${a}, ${r}, ${i})`,v);S+=M(u,[a,r,i],B,T,$,h)}const p=new F;p.setAttribute("position",new z(new Float32Array(u.positions),3)),p.setAttribute("normal",new z(new Float32Array(u.normals),3)),o.colors!==void 0&&p.setAttribute("color",new z(new Float32Array(u.colors),3));const V=u.positions.length/3,q=V>65535?new Uint32Array(u.indices):new Uint16Array(u.indices);return p.setIndex(new z(q,1)),p.computeBoundingSphere(),p.computeBoundingBox(),{geometry:p,quads:S,vertices:V,triangles:S*2,solidCells:A,quadsByType:new Map([...u.quadsByType].sort(([r],[i])=>r-i))}}export{w as VoxelSurfaceError,Z as buildVoxelSurface,Y as expandVoxelRuns};
@@ -0,0 +1 @@
1
+ function S(s,a,t){return Math.min(t,Math.max(a,s))}function u(s,a,t){for(let e=0;e<t.length;e++)s.setUint8(a+e,t.charCodeAt(e))}function w(s){const{channelData:a,sampleRate:t}=s,e=a.length;if(e===0)throw new Error("[wav-encode] channelData must contain at least one channel");if(!Number.isFinite(t)||t<=0)throw new Error(`[wav-encode] sampleRate must be a finite number > 0, got ${t}`);const o=a[0]?.length??0;for(let r=0;r<e;r++){const i=a[r]?.length??-1;if(i!==o)throw new Error(`[wav-encode] channel ${r} has length ${i}, expected ${o} (all channels must match)`)}const c=e*2,l=t*c,h=o*c,f=new ArrayBuffer(44+h),n=new DataView(f);u(n,0,"RIFF"),n.setUint32(4,36+h,!0),u(n,8,"WAVE"),u(n,12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,e,!0),n.setUint32(24,t,!0),n.setUint32(28,l,!0),n.setUint16(32,c,!0),n.setUint16(34,16,!0),u(n,36,"data"),n.setUint32(40,h,!0);let m=44;for(let r=0;r<o;r++)for(let i=0;i<e;i++){const E=S(a[i]?.[r]??0,-1,1),A=Math.round(E<0?E*32768:E*32767);n.setInt16(m,A,!0),m+=2}return new Uint8Array(f)}function _(s){let a=0,t=0,e=0;for(const o of s)for(let c=0;c<o.length;c++){const l=o[c]??0;a+=l*l,t=Math.max(t,Math.abs(l)),e++}return{rms:e>0?Math.sqrt(a/e):0,peak:t}}export{w as encodeWav16,_ as pcmStats};
@@ -0,0 +1 @@
1
+ import{ah as k,c3 as W,c4 as Y,ag as j,c5 as z,aG as K,R as J,aO as V,N as X,c6 as Z,Y as q,c7 as Q,K as ee,Z as te,ai as re,c8 as ne,aS as ae,c9 as se,ca as oe,a7 as ie}from"./three.module-D396a9Mn.js";function ue(e,r){if(e||!r||typeof r!="object")return null;const o=r;return typeof o.getExtension!="function"||typeof o.drawArrays!="function"||typeof o.drawElements!="function"?null:r}function ce(e){const r=e;return!!(r.isMesh||r.isSkinnedMesh||r.isPoints||r.isLine||r.isSprite)}function le(e){const r=e,o=r.geometry,c=r.material,s=Array.isArray(c)?c[0]:c,u=e.userData?.entityId;return{object:{name:e.name||e.type,type:e.type,...u!==void 0?{entityId:String(u)}:{}},geometry:{type:o?.type??"unknown",name:o?.name??"",attributes:o?Object.keys(o.attributes):[],indexed:!!o?.index},material:{type:s?.type??"unknown",name:s?.name??""}}}function de(e){const{capture:r,scene:o,memory:c}=e,s=e.timeoutMs??5e3,u=e.setTimeoutFn??((a,f)=>setTimeout(a,f)),l=e.clearTimeoutFn??(a=>clearTimeout(a));let y=null;function F(){const a=[];return o&&o.traverse(f=>{if(!ce(f))return;const R=f.onBeforeRender;f.onBeforeRender=function(...T){r.annotateNextDraw(le(f)),R.apply(this,T)},a.push(()=>{f.onBeforeRender=R})}),a}function E(){const a=y;if(a&&!a.settled){a.settled=!0,l(a.timer);for(const f of a.restores)f();return y=null,a}return null}return{adapter:{captureFrame(){return y?Promise.reject(new Error("RenderDebugAdapter: a frame capture is already pending")):new Promise((a,f)=>{const R=F();r.arm();const b={resolve:a,reject:f,restores:R,timer:null,settled:!1};y=b,b.timer=u(()=>{E()&&f(new Error(`RenderDebugAdapter: no frame rendered within ${s}ms — the world may be paused or stopped`))},s)})},...c?{memorySnapshot:()=>c()}:{}},beforeRender(){r.beginPass()},afterRender(){const a=r.endPass();a&&y&&E()?.resolve(a)},dispose(){const a=E();a&&a.reject(new Error("RenderDebugAdapter: disposed before a frame was captured"))}}}const _e=Object.freeze(Object.defineProperty({__proto__:null,createRenderDebugAdapter:de,frameCaptureContextFor:ue},Symbol.toStringTag,{value:"Module"})),S=10,fe={[Q]:1,[q]:1,[Z]:1,[X]:2,[V]:2,[J]:4,[K]:4,[z]:1,[j]:2},me={[ie]:1,[oe]:1,[se]:2,[ae]:2,[ne]:4,[re]:4,[te]:4,[ee]:2},pe={[Y]:2,[W]:2,[k]:4};function ye(e,r){const o=pe[r];if(o!==void 0)return o;const c=fe[e],s=me[r];return c===void 0||s===void 0?null:c*s}function D(e){const r=new Set;let o=0;const c=s=>{s&&!r.has(s)&&(r.add(s),o+=s.byteLength)};for(const s of Object.values(e.attributes)){const u=s.data?.array;c(u??s.array)}return c(e.index?.array),o}function L(e){const r=e;if(r.isCompressedTexture&&Array.isArray(r.mipmaps)){let y=0;for(const F of r.mipmaps){const E=F.data;E?.byteLength&&(y+=E.byteLength)}return y}const o=e.image,c=o?.width,s=o?.height;if(!c||!s)return null;const u=ye(e.format,e.type);if(u===null)return null;const l=c*s*u;return e.generateMipmaps?Math.round(l*1.333):l}function M(e){return e.name||e.image?.src||`texture:${e.uuid}`}function Ee(e){return e.name||`${e.type}:${e.uuid}`}function Re(e){const r=e.image;return!r?.width||!r?.height?"no image dimensions available":`unsupported format/type (format 0x${e.format.toString(16)}, type 0x${e.type.toString(16)})`}function Te(e){const r=new Map,o=new Map,c=s=>{for(const u of Object.values(s))if(u&&u.isTexture){const l=u;o.set(l.uuid,l)}};e.traverse(s=>{const u=s.geometry;u?.isBufferGeometry&&r.set(u.uuid,u);const l=s.material;Array.isArray(l)?l.forEach(c):l&&c(l)});for(const s of[e])for(const u of[s.background,s.environment])if(u&&u.isTexture){const l=u;o.set(l.uuid,l)}return{geometries:r,textures:o}}function Fe(e,r){const{geometries:o,textures:c}=Te(e),s=[];let u=0;for(const p of o.values()){const a=D(p);u+=a,s.push({name:Ee(p),bytes:a})}const l=[],y=[];let F=0;for(const p of c.values()){const a=L(p);if(a===null){y.push({name:M(p),reason:Re(p)});continue}F+=a,l.push({name:M(p),bytes:a})}const E=(p,a)=>a.bytes-p.bytes;return{counts:{geometries:r.memory.geometries,textures:r.memory.textures,programs:r.programs?r.programs.length:null},estimatedTextureBytes:F,estimatedGeometryBytes:u,topTextures:l.sort(E).slice(0,S),topGeometries:s.sort(E).slice(0,S),unestimated:y}}const Pe=Object.freeze(Object.defineProperty({__proto__:null,collectRenderMemory:Fe,estimateGeometryBytes:D,estimateTextureBytes:L},Symbol.toStringTag,{value:"Module"})),be=5e3;function he(e){return new Map([[e.POINTS,"POINTS"],[e.LINES,"LINES"],[e.LINE_LOOP,"LINE_LOOP"],[e.LINE_STRIP,"LINE_STRIP"],[e.TRIANGLES,"TRIANGLES"],[e.TRIANGLE_STRIP,"TRIANGLE_STRIP"],[e.TRIANGLE_FAN,"TRIANGLE_FAN"]])}function Ae(e,r={}){const o=r.now??(()=>Date.now()),c=r.maxDrawCalls??be,s=he(e),u=new Map,l=new Map;let y=0,F=0,E=0,p=null,a=null,f=[0,0,0,0],R=!1,b=!1,T=[],w=0,N=[],A=null;const B=new Map,I=new Set;function O(t){return s.get(t)??`0x${t.toString(16)}`}function U(t){if(!t)return null;let n=u.get(t);return n===void 0&&(n=`program#${y++}`,u.set(t,n)),n}function v(){try{if(e.getFramebufferAttachmentParameter(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)===e.RENDERBUFFER){const n=e.getFramebufferAttachmentParameter(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);if(!n)return{width:null,height:null};const i=e.getParameter(e.RENDERBUFFER_BINDING);e.bindRenderbuffer(e.RENDERBUFFER,n);const d=e.getRenderbufferParameter(e.RENDERBUFFER,e.RENDERBUFFER_WIDTH),m=e.getRenderbufferParameter(e.RENDERBUFFER,e.RENDERBUFFER_HEIGHT);return e.bindRenderbuffer(e.RENDERBUFFER,i),{width:d,height:m}}}catch{}return{width:null,height:null}}function C(){if(!a)return{kind:"canvas"};let t=l.get(a);t===void 0&&(t=`framebuffer#${F++}`,l.set(a,t));const{width:n,height:i}=v();return{kind:"framebuffer",width:n,height:i,label:t}}function x(){return e.getParameter(e.CULL_FACE)?e.getParameter(e.CULL_FACE_MODE)===e.FRONT?"front":"back":"none"}function _(t,n,i,d){if(T.length>=c){w++,A=null;return}const m=A;A=null,T.push({index:T.length,entryPoint:t,mode:O(n),count:i,instanceCount:d,programLabel:U(p),target:C(),viewport:[...f],state:{blend:!!e.getParameter(e.BLEND),depthTest:!!e.getParameter(e.DEPTH_TEST),depthWrite:!!e.getParameter(e.DEPTH_WRITEMASK),cull:x(),scissor:!!e.getParameter(e.SCISSOR_TEST)},annotation:m??null})}const P=e;function h(t,n){const i=P[t];B.set(t,i),Object.hasOwn(e,t)&&I.add(t),P[t]=n(i.bind(e))}function G(){for(const[t,n]of B)I.has(t)?P[t]=n:delete P[t];B.clear(),I.clear()}function H(){try{const t=e.getParameter(e.VIEWPORT);t&&t.length>=4&&(f=[t[0],t[1],t[2],t[3]]),a=e.getParameter(e.FRAMEBUFFER_BINDING),p=e.getParameter(e.CURRENT_PROGRAM)}catch{}h("useProgram",t=>n=>(p=n??null,t(n))),h("bindFramebuffer",t=>(n,i)=>((n===e.FRAMEBUFFER||n===e.DRAW_FRAMEBUFFER)&&(a=i??null),t(n,i))),h("viewport",t=>(n,i,d,m)=>(f=[n,i,d,m],t(n,i,d,m))),h("drawArrays",t=>(n,i,d)=>(_("drawArrays",n,d,null),t(n,i,d))),h("drawElements",t=>(n,i,d,m)=>(_("drawElements",n,i,null),t(n,i,d,m))),h("drawArraysInstanced",t=>(n,i,d,m)=>(_("drawArraysInstanced",n,d,m),t(n,i,d,m))),h("drawElementsInstanced",t=>(n,i,d,m,g)=>(_("drawElementsInstanced",n,i,g),t(n,i,d,m,g))),h("drawRangeElements",t=>(n,i,d,m,g,$)=>(_("drawRangeElements",n,m,null),t(n,i,d,m,g,$)))}return{arm(){R=!0},get armed(){return R},beginPass(){!R||b||(b=!0,T=[],w=0,N=[],A=null,H())},endPass(){if(!b)return R=!1,null;try{w>0&&N.push(`Draw list capped at ${c}; ${w} later draw(s) were not recorded.`);const t=T.reduce((n,i)=>n+(i.annotation===null?1:0),0);return{id:++E,capturedAt:o(),drawCalls:T.slice(),totals:{drawCalls:T.length,unattributed:t,truncated:w},notes:N.slice()}}finally{G(),b=!1,R=!1,A=null}},annotateNextDraw(t){A=t}}}const ge=Object.freeze(Object.defineProperty({__proto__:null,createWebGLFrameCapture:Ae},Symbol.toStringTag,{value:"Module"}));export{de as a,Fe as b,Ae as c,Pe as d,ue as f,_e as r,ge as w};
@@ -0,0 +1 @@
1
+ function E(o){const e=o,u=e.getExtension("EXT_disjoint_timer_query_webgl2"),l=u!==null&&typeof e.createQuery=="function",n=[];let r=null,i=null;return{begin(){!l||r||(r=e.createQuery(),r&&e.beginQuery(u.TIME_ELAPSED_EXT,r))},end(){!l||!r||(e.endQuery(u.TIME_ELAPSED_EXT),n.push(r),r=null)},poll(){if(!l)return null;if(e.getParameter(u.GPU_DISJOINT_EXT)){for(const t of n.splice(0))e.deleteQuery(t);return null}for(;n.length>0;){const t=n[0];if(!e.getQueryParameter(t,e.QUERY_RESULT_AVAILABLE))break;n.shift(),i=e.getQueryParameter(t,e.QUERY_RESULT)/1e6,e.deleteQuery(t)}return i},dispose(){r&&(e.endQuery(u.TIME_ELAPSED_EXT),e.deleteQuery(r),r=null);for(const t of n.splice(0))e.deleteQuery(t)}}}export{E as createWebGLGpuTimer};
@@ -0,0 +1 @@
1
+ import{gy as t,th as i,ti as r,tj as m}from"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";t.add(i,r);t.add(m);
@@ -0,0 +1,2 @@
1
+ const d="/work/.vgai-session",ae=`${d}/session.py`,se=[`${d}/in`,`${d}/reply`],I="/__editor/blender-wasm";function D(e){return new URL(`${I}/${e}`,import.meta.url).href}async function M(){const e=await fetch(D("status"));return e.ok?await e.json():{available:!1,skew:null,dir:null,sizes:{},encoded:{},missing:[`${I}/status answered ${e.status}`]}}async function J(e){const t=await M();if(!t.available)throw new Error(`The headless Blender WebAssembly build is not served by this editor: ${t.missing.join("; ")}`);if(t.skew==="wali"){const{startWaliBlenderEngine:n}=await import("./blender-wali-engine-wTOcrOMC.js");return n(e,t)}const{startEmscriptenBlenderEngine:r}=await import("./blender-emscripten-engine-9ZIRYNhe.js");return r(e,t)}function U(e){return e<200?1:e<5e3?5:25}const C=e=>new Promise(t=>setTimeout(t,e)),B=new TextDecoder;function ie(e,t,r){let n=0,a=0;const o=new Set;async function s(u){for(const l of o)u.has(`${l}.done`)||(await e.unlink(`${d}/reply/${l}.json`),await e.unlink(`${d}/reply/${l}.done`),o.delete(l))}async function i(){let u;try{u=await e.readdir(`${d}/ask`)}catch{return}const l=new Set(u.filter(h=>h.endsWith(".done")));await s(l);for(const h of l){const w=h.slice(0,-5);if(Number(w)<=a)continue;a=Number(w);const m=JSON.parse(B.decode(await e.readFile(`${d}/ask/${w}.json`)));let S;try{S=await t.ask(m)}catch(v){S={error:v instanceof Error?v.message:String(v)}}await e.writeFile(`${d}/reply/${w}.json`,JSON.stringify(S??null)),await e.writeFile(`${d}/reply/${w}.done`,"1"),o.add(w)}}async function c(u){const l=String(++n);await e.writeFile(`${d}/in/${l}.json`,JSON.stringify(u)),await e.writeFile(`${d}/in/${l}.done`,"1");const h=performance.now();for(;;){if(await i(),await e.stat(`${d}/out/${l}.done`)){const m=JSON.parse(B.decode(await e.readFile(`${d}/out/${l}.json`)));if(await e.unlink(`${d}/in/${l}.json`),await e.unlink(`${d}/in/${l}.done`),m.error)throw new Error(m.error);return m.result}const w=r?.();if(w)throw new Error(`Blender is gone, so this call will never be answered: ${w}. The session keeps its directory and its cached banner, so every later call would wait on the same missing answer; start a new program with \`blender-start {fresh: true}\` (\`VGAI_BLENDER_FRESH_SESSION=1\` for the battery harness).`);await C(U(performance.now()-h))}}return{request:c}}const N=e=>typeof e=="object"&&e!==null&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.dtype=="string"&&typeof e.count=="number"&&typeof e.stride=="number",W={f32:e=>new Float32Array(e.buffer,e.byteOffset,e.byteLength>>2),f64:e=>new Float64Array(e.buffer,e.byteOffset,e.byteLength>>3),u32:e=>new Uint32Array(e.buffer,e.byteOffset,e.byteLength>>2),i32:e=>new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),u16:e=>new Uint16Array(e.buffer,e.byteOffset,e.byteLength>>1),i16:e=>new Int16Array(e.buffer,e.byteOffset,e.byteLength>>1),u8:e=>e,i8:e=>new Int8Array(e.buffer,e.byteOffset,e.byteLength)};function z(e,t,r){const n=W[r.dtype];if(!n)throw new Error(`Blender frame column ${t}: unknown dtype ${r.dtype}`);const{offset:a,length:o}=r;if(a<0||o<0||a+o>e.byteLength)throw new Error(`Blender frame column ${t}: bytes ${a}..${a+o} lie outside the ${e.byteLength}-byte export arena`);const s=e.subarray(a,a+o).slice(),i=n(s),c=r.count*r.stride;if(i.length!==c)throw new Error(`Blender frame column ${t}: ${i.length} values, ${c} declared (${r.count} x ${r.stride})`);return i}function H(e,t){const r=(n,a)=>{if(N(n)){const o=z(e,a,n);return a==="co"?Float64Array.from(o):o}if(Array.isArray(n))return n.map(o=>r(o,a));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=r(i,s);return o}return n};return r(t,"")}async function V(e,t){const r=async(n,a)=>{if(N(n)){const{offset:o,length:s,dtype:i}=n;if(o<0||s<0||o+s>e.byteLength)throw new Error(`Blender frame column ${a}: bytes ${o}..${o+s} lie outside the ${e.byteLength}-byte export arena`);const c=e.subarray(o,o+s).slice(),u=await crypto.subtle.digest("SHA-256",c),l=[...new Uint8Array(u)].map(h=>h.toString(16).padStart(2,"0")).join("");return{dtype:i,length:s,sha256:l}}if(Array.isArray(n))return Promise.all(n.map(o=>r(o,a)));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=await r(i,s);return o}return n};return r(t,"")}const b=e=>self.postMessage(e),O=(e,t)=>b({op:"log",level:e,text:t});let p=null,E=null,G=0;const j=new Map;function K(e,t,r){const n=++G,a=[],o=e;for(const s of[o?.meshes??{},o?.images??{}])for(const i of Object.values(s))for(const c of Object.values(i))ArrayBuffer.isView(c)&&c.buffer instanceof ArrayBuffer&&!a.includes(c.buffer)&&a.push(c.buffer);return new Promise((s,i)=>{j.set(n,{resolve:s,reject:i}),self.postMessage({op:"present",id:n,frame:e,description:t,...r?{capture:r}:{}},a)})}let f=null,$=null,P=!1,A=Promise.resolve();function Q(e){const t=A.then(e);return A=t.catch(()=>{}),t}function _(e){P=e,b({op:"document-dirty",dirty:e})}async function F(){if(!f||$===null)return;const e=$;let t;try{t=await f.request({op:"save-document"})}catch(n){throw new Error(`The Blender document ${e} could not be saved: ${g(n)}`)}if(!t?.saved||typeof t.path!="string")throw new Error(`Blender did not save the document ${e}`);let r;try{r=await f.files.readFile(t.path)}catch(n){throw new Error(`The Blender document ${e} could not be read back out of the engine: ${g(n)}`)}y.delete(t.path);try{const n=await fetch(`/__editor/blender-document?path=${encodeURIComponent(e)}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:new Blob([r])});if(!n.ok){const a=await n.text().catch(()=>"");throw new Error(`HTTP ${n.status} ${a}`)}}catch(n){throw new Error(`The Blender document ${e} was not written to the project: ${g(n)}`)}_(!1),O("log",`@@VGAI-DOCUMENT ${JSON.stringify({path:e,bytes:r.length})}`)}async function X(e,t){const r={engine:null},n=await J({project:e,log:O,ask:async({frame:o,capture:s,saveDue:i})=>{if(!r.engine)throw new Error("The Blender session presented before it started");i&&$!==null&&_(!0);const c=await r.engine.readArena(),u=await V(c,o),l=await K(H(c,o),u,s);return{...typeof l.capture=="object"&&l.capture!==null?l.capture:{},..."held"in l?{held:l.held}:{}}}});r.engine=n,f=n,t&&await L(n.files,e);const a=await n.request({op:"start",project:e,...t?{document:t}:{}});return t&&($=t),p={start:async()=>a,execute:async o=>{const s=await n.request({op:"execute",code:o});return s.error?`Error executing code: ${s.error}`:`Code executed successfully: ${s.result}`},sceneInfo:async()=>JSON.stringify(await n.request({op:"scene-info"}),null,2),objectInfo:async o=>JSON.stringify(await n.request({op:"object-info",name:o}),null,2),screenshotView:async o=>(await n.request({op:"present",capture:{size:o}}),JSON.stringify({view:{size:o}}))},{...a,engine:"blender-wasm",skew:n.skew,bootMs:Math.round(n.bootMs),releasedPayloadMB:n.releasedPayloadBytes===null?null:Math.round(n.releasedPayloadBytes/1048576)}}async function Y(){try{const e=await fetch("/__editor/blender-wasm/status");return e.ok?await e.json():{available:!1,missing:[`status answered ${e.status}`]}}catch(e){return{available:!1,missing:[String(e)]}}}async function Z(e,t){if(p)throw new Error("The Blender session is already started");if(!e.startsWith("/"))throw new Error("The Blender session needs the project's absolute path");if(t!==void 0&&!q(t))throw new Error(`The Blender document must be a project-relative .blend path with no traversal (models/model.blend); got ${JSON.stringify(t)}`);const r=await Y();if(!r.available)throw new Error(`Headless Blender is not served by this editor, so there is no modeling engine: ${r.missing.join("; ")}. The engine is Blender compiled to WebAssembly (packages/blender-engine/wasm, or the directory VGAI_BLENDER_WASM_DIR names); nothing stands in for it.`);return E=e,X(e,t)}function q(e){return!e.endsWith(".blend")||e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}const T=new Set;function k(e){T.has(e)||(T.add(e),O("error",e))}async function ee(e){const t=s=>(k(`The project's files are not readable from Python: ${s}`),null);let r;try{r=await fetch("/__editor/blender-project-index")}catch(s){return t(String(s))}if(!r.ok)return t(`/__editor/blender-project-index answered ${r.status}`);let n;try{if(n=await r.json(),typeof n?.root!="string"||!Array.isArray(n.files))return t("invalid project index")}catch(s){return t(String(s))}const{root:a,files:o}=n;return a!==e&&k(`The editor serving this tab has ${a} open, not ${e}; its files are mounted at ${e}, which is where Python is looking.`),o}const y=new Map;async function te(e,t){const r=await e.stat(t);return r?`${r.size}:${r.mtimeMs}`:""}async function L(e,t){const r=await ee(t);if(!r)return;const n=new Set(r.map(a=>`${t}/${a.path}`));for(const a of[...y.keys()])if(!n.has(a)){try{await e.unlink(a)}catch{}y.delete(a)}for(const a of r){const o=`${t}/${a.path}`,s=`${a.size}:${a.mtime}`;if(y.get(o)?.host===s||!y.has(o)&&await e.stat(o)!==null)continue;const i=await fetch(`/__editor/blender-project-file?path=${encodeURIComponent(a.path)}`);if(!i.ok){k(`${a.path}: HTTP ${i.status}`);continue}const c=o.slice(0,o.lastIndexOf("/"));c&&await e.mkdirTree(c),await e.writeFile(o,new Uint8Array(await i.arrayBuffer())),y.set(o,{host:s,engine:await te(e,o)})}}async function ne(e,t){const r=[],n=async a=>{let o;try{o=await e.readdir(a)}catch{return}for(const s of o){if(s==="."||s==="..")continue;const i=`${a.replace(/\/$/,"")}/${s}`,c=await e.stat(i);if(c){if((c.mode&61440)===16384){await n(i);continue}y.get(i)?.engine!==`${c.size}:${c.mtimeMs}`&&r.push({path:i,size:c.size,mtime:c.mtimeMs})}}};return await n(t),r}async function R(e){switch(e.op){case"start":return Z(e.project,e.document);case"present-result":{const n=j.get(e.id);j.delete(e.id),n&&(e.error?n.reject(new Error(e.error)):n.resolve({...e.capture===void 0?{}:{capture:e.capture},..."held"in e?{held:e.held}:{}}));return}}if(!p||!E||!f)throw new Error("The Blender session has not started");const t=f.files,r=f.request.bind(f);switch(e.op){case"flush-document":return await F(),{saved:!0};case"history-begin":case"history-end":return r({op:e.op});case"history-step":return r({op:"history-step",token:e.token,direction:e.direction});case"execute":await L(t,E);{const n=await r({op:"execute",code:e.code,history:e.history??!0,label:e.label??"Blender Python"});return n.error?`Error executing code: ${n.error}`:`Code executed successfully: ${n.result}`}case"present":return r({op:"present"});case"scene-info":return p.sceneInfo();case"object-info":return p.objectInfo(e.name);case"rna":return r({op:"rna",path:e.path,...e.names===void 0?{}:{names:e.names}});case"rna-context":return r({op:"rna-context",...e.object===void 0?{}:{object:e.object},...e.collection===void 0?{}:{collection:e.collection}});case"rna-set":return r({op:"rna-set",history:e.history!==!1,path:e.path,property:e.property,value:e.value,...e.index===void 0?{}:{index:e.index}});case"outliner":return r({op:"outliner",...e.selected===void 0?{}:{selected:[...e.selected]}});case"node-tree":return r({op:"node-tree",...e.path===void 0?{}:{path:e.path},...e.material===void 0?{}:{material:e.material}});case"uv-layout":return r({op:"uv-layout",...e.object===void 0?{}:{object:e.object},...e.uvLayer===void 0?{}:{uvLayer:e.uvLayer}});case"rig":return r({op:"rig",...e.object===void 0?{}:{object:e.object}});case"action-clip":return r({op:"action-clip",...e.object===void 0?{}:{object:e.object},...e.bake===void 0?{}:{bake:e.bake}});case"outliner-set":return r({op:"outliner-set",path:e.path,column:e.column,value:e.value});case"screenshot-view":return JSON.parse(await p.screenshotView(e.maxSize));case"read-file":return t.readFile(e.path);case"write-file":{const n=e.path.slice(0,e.path.lastIndexOf("/"));n&&await t.mkdirTree(n),await t.writeFile(e.path,e.bytes),y.delete(e.path);return}case"list-files":return ne(t,e.path)}throw new Error(`Unknown Blender worker request ${e.op}`)}function g(e){if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e=="object"&&e!==null){const t=e;if(typeof t.message=="string")return typeof t.name=="string"?`${t.name}: ${t.message}`:t.message;try{return JSON.stringify(e)??Object.prototype.toString.call(e)}catch{return Object.prototype.toString.call(e)}}return String(e)}function re(){if(!f)return;const e=f.memoryBytes();e!==null&&b({op:"memory",bytes:e})}self.onmessage=e=>{const t=e.data;if(t.op==="present-result"){R(t);return}Q(()=>oe(t))};async function oe(e){try{const t=await R(e);P&&await F(),await x(),b({id:e.id,result:t})}catch(t){let r=g(t);try{await x()}catch(n){r+=`
2
+ Unable to deliver Blender history: ${g(n)}`}b({id:e.id,error:r})}re()}async function x(){if(!f||!p)return;const e=await f.request({op:"history-events"});e.length&&b({op:"history",entries:e})}export{I as A,se as P,d as S,ae as a,D as b,ie as o,C as s};
@@ -0,0 +1 @@
1
+ import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{bt as N,bA as G,ei as T,aY as et,gk as I,bz as ot,f6 as nt,a4 as O,f8 as D,a5 as M,fb as st,fc as at,fa as rt,em as it,gl as lt,eR as ct,d8 as j,gm as F,gn as dt,d7 as z,e2 as ut,d9 as V,e1 as U,di as pt,aU as ht,go as mt,aS as ft,gp as bt,gq as xt,gr as gt,gs as vt,gt as wt,gu as yt,f3 as St,gv as kt,aG as Rt,gw as H,gx as Ct,fm as Et}from"./index-GIL7oGEO.js";import{r as p}from"./index-nmcBqr7Y.js";import{d as It,m as jt}from"./design-time-layers-wYgOTgni.js";import{I as zt}from"./edit-mode-authoring-B47TfLqu.js";import{i as At,a as Dt,C as L,b as Mt,c as Bt}from"./CanvasSceneViewport-Bpi6gVTC.js";import{a as Tt,g as $t,e as Ft,f as Vt,h as _t,s as Z,i as Pt,t as Nt,R as P,j as Gt}from"./react-story-board-BDDwiE2H.js";import{s as Wt,c as Ot,a as Ut,b as Ht}from"./component-board-registry-DrIa2csL.js";import{e as Lt,S as Zt}from"./surface-state-DaxyruCj.js";import"./index-CtzuWnCS.js";import{c as Yt,d as Xt,r as Y,e as X,f as qt,m as q,b as Kt,a as Jt,s as Qt}from"./board-guides-DziKSTss.js";import{R as te}from"./RootSelectionOverlay-BZPlxmXU.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-D396a9Mn.js";import"./design-time-mount-registry-DUpXCg1U.js";import"./TransientHint-BB1fwrvK.js";import"./eyedropper-session-bjPXnfeX.js";import"./viewport-pick-context-DkawXbEi.js";import"./inspect-BZfi3mmo.js";import"./inference-diagnostics-Dhmtfbq_.js";const y=16,_="rgba(255, 82, 82, 0.9)",K="rgba(18, 22, 26, 0.92)",A="rgba(255, 255, 255, 0.28)";function ee(o){return[10,25,50,100,250,500,1e3,2500,5e3].find(i=>i*o>=60)??1e4}function J(o){return Math.abs(o)>=1e3?`${o/1e3}k`:String(o)}function oe({docId:o,containerRef:c}){const i=p.useSyncExternalStore(N,G),f=p.useSyncExternalStore(Yt,()=>Xt(o)),[n,d]=p.useState(null),b=p.useRef(null);p.useEffect(()=>{const e=c.current;if(!e)return;const a=e.getBoundingClientRect();return Y(o,{originX:a.left,originY:a.top,panX:i.x,panY:i.y,zoom:i.zoom}),()=>Y(o,null)},[o,c,i.x,i.y,i.zoom]);const m=(e,a)=>Math.round((e-(a==="x"?i.x:i.y))/i.zoom),h=(e,a)=>(a==="x"?i.x:i.y)+e*i.zoom,x=e=>{const a=c.current?.getBoundingClientRect();return a?{x:e.clientX-a.left,y:e.clientY-a.top}:{x:0,y:0}},k=e=>a=>{a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId);const t=x(a);d({kind:"place",axis:e,id:null,at:e==="x"?t.x:t.y})},w=e=>a=>{a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId);const t=x(a);d({kind:"move",axis:e.axis,id:e.id,at:e.axis==="x"?t.x:t.y})},R=e=>{if(!n)return;const a=x(e),t=n.axis==="x"?a.x:a.y;d({...n,at:t}),n.kind==="move"&&n.id&&q(o,n.id,m(t,n.axis))},C=e=>{if(!n)return;const a=x(e),t=n.axis==="x"?a.x:a.y,l=t<=y;n.kind==="place"?l||qt(o,n.axis,m(t,n.axis)):n.id&&(l?X(o,n.id):q(o,n.id,m(t,n.axis))),d(null)},r=e=>{const a=c.current,t=a?e==="x"?a.clientWidth:a.clientHeight:0,l=ee(i.zoom),g=Math.ceil(m(y,e)/l)*l,S=m(t,e),v=[];for(let E=g;E<=S&&v.length<200;E+=l)v.push(E);return v},u={position:"absolute",background:K,zIndex:61,userSelect:"none",touchAction:"none",overflow:"hidden"};return s.jsxs("div",{ref:b,"data-testid":"board-rulers",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:60},onPointerMove:R,onPointerUp:C,children:[f.map(e=>{const a=h(e.value,e.axis),t=e.axis==="x";return s.jsx("div",{"data-testid":`board-guide-${e.axis}-${e.value}`,title:`${e.axis} = ${e.value} — drag to move, drop on the ruler or double-click to remove`,onPointerDown:w(e),onPointerMove:R,onPointerUp:C,onDoubleClick:()=>X(o,e.id),style:{position:"absolute",pointerEvents:"auto",cursor:t?"col-resize":"row-resize",zIndex:60,...t?{left:a-2,top:0,bottom:0,width:5}:{top:a-2,left:0,right:0,height:5}},children:s.jsx("div",{style:{position:"absolute",background:_,...t?{left:2,top:0,bottom:0,width:1}:{top:2,left:0,right:0,height:1}}})},e.id)}),n&&s.jsx("div",{style:{position:"absolute",background:_,zIndex:62,...n.axis==="x"?{left:n.at,top:0,bottom:0,width:1}:{top:n.at,left:0,right:0,height:1}},children:s.jsx("span",{style:{position:"absolute",...n.axis==="x"?{top:y+4,left:4}:{left:y+4,top:4},fontSize:9,fontFamily:"ui-monospace, monospace",color:_,background:K,padding:"1px 3px",borderRadius:3,whiteSpace:"nowrap"},children:m(n.at,n.axis)})}),s.jsx("div",{"data-testid":"board-ruler-top",onPointerDown:k("y"),style:{...u,top:0,left:y,right:0,height:y,cursor:"row-resize",pointerEvents:"auto"},children:r("x").map(e=>s.jsx("span",{style:{position:"absolute",left:h(e,"x"),bottom:0,borderLeft:`1px solid ${A}`,height:5},children:s.jsx("span",{style:{position:"absolute",left:2,bottom:3,fontSize:8,color:A,fontFamily:"ui-monospace, monospace"},children:J(e)})},e))}),s.jsx("div",{"data-testid":"board-ruler-left",onPointerDown:k("x"),style:{...u,top:y,left:0,bottom:0,width:y,cursor:"col-resize",pointerEvents:"auto"},children:r("y").map(e=>s.jsx("span",{style:{position:"absolute",top:h(e,"y"),right:0,borderTop:`1px solid ${A}`,width:5},children:s.jsx("span",{style:{position:"absolute",top:1,right:3,fontSize:8,color:A,fontFamily:"ui-monospace, monospace",writingMode:"vertical-rl"},children:J(e)})},e))}),s.jsx(ne,{}),s.jsx("div",{style:{...u,top:0,left:0,width:y,height:y,borderRight:`1px solid ${T.border}`,borderBottom:`1px solid ${T.border}`}})]})}function ne(){const o=p.useSyncExternalStore(Kt,Jt);return o?s.jsxs("button",{type:"button","data-testid":"board-breakpoint-pill",title:"Style edits are scoped to this breakpoint — click to return to Base",onClick:()=>Qt(null),style:{position:"absolute",top:y+8,right:12,zIndex:62,pointerEvents:"auto",background:"rgba(18, 22, 26, 0.92)",color:T.accent,border:`1px solid ${T.accent}`,borderRadius:999,fontSize:10,padding:"3px 10px",cursor:"pointer"},children:["@ ",o," · editing this breakpoint — click to clear"]}):null}const Q={fill:null,desktop:{width:1440,height:900},tablet:{width:768,height:1024},mobile:{width:390,height:844}};function se({boardViewport:o,containerRef:c,selectViewport:i,viewportValue:f}){return s.jsxs(s.Fragment,{children:[s.jsxs(it,{"aria-label":"Responsive viewport",title:o?.locked?"Viewport is locked by this story’s globals.viewport":"Responsive viewport",value:f,disabled:o?.locked===!0,onChange:n=>i(n.target.value),className:"vgai-react-viewport-select",children:[s.jsx("option",{value:"fill",children:"Responsive"}),o?o.choices.map(n=>s.jsxs("option",{value:n.id,children:[n.label," · ",n.width,"×",n.height]},n.id)):s.jsxs(s.Fragment,{children:[s.jsx("option",{value:"desktop",children:"Desktop · 1440×900"}),s.jsx("option",{value:"tablet",children:"Tablet · 768×1024"}),s.jsx("option",{value:"mobile",children:"Mobile · 390×844"})]})]}),o&&s.jsx(D,{"aria-label":"Rotate viewport",title:o.locked?"Viewport is locked by this story’s globals.viewport":"Rotate viewport",size:"comfortable",disabled:o.locked,onClick:()=>Nt(c.current),children:s.jsx(M,{icon:lt,size:"md"})})]})}function ae({containerRef:o,context:c,boardOnly:i=!1}){const f=et();p.useSyncExternalStore(f.subscribe,f.getSnapshot);const n=p.useSyncExternalStore(N,G),d=p.useSyncExternalStore(Tt,$t),b=p.useSyncExternalStore(Ft,()=>Vt(o.current),()=>null),m=p.useCallback(r=>{const u=o.current;if(!u)return;const e=Math.min(4,Math.max(.1,r)),a=u.clientWidth/2,t=u.clientHeight/2,l=(a-n.x)/n.zoom,g=(t-n.y)/n.zoom;I(a-l*e,t-g*e,e)},[o,n]),h=p.useCallback(()=>{const r=o.current,u=[...f.selectedEntityIds].at(-1);if(!r||!u)return;const e=c?.adapter.rects?.rect(u);if(!e||e.width<=0||e.height<=0)return;const a=Math.max(1,r.clientWidth-96),t=Math.max(1,r.clientHeight-96),l=Math.min(4,Math.max(.1,Math.min(a/e.width,t/e.height)));I(r.clientWidth/2-(e.x+e.width/2)*l,r.clientHeight/2-(e.y+e.height/2)*l,l)},[o,c,f]),x=p.useCallback(r=>{const u=o.current;if(b){_t(u,r==="fill"?null:r);return}const e=Q[r];if(!u||e===null){Z(null,null),I(0,0,1);return}Z(e.width,e.height);const a=Math.min(1,Math.max(.1,Math.min((u.clientWidth-96)/e.width,(u.clientHeight-96)/e.height)));I((u.clientWidth-e.width*a)/2,(u.clientHeight-e.height*a)/2,a)},[b,o]),k=p.useCallback(()=>{const r=o.current;r&&Pt(r)},[o]),w=b!==null,R=c?.kind==="dom"&&!!c.adapter.rects;if(i?!w:!R)return null;const C=b?b.selectedViewportId??"fill":Object.entries(Q).find(([,r])=>r===null?d.width===null:r.width===d.width&&r.height===d.height)?.[0]??"fill";return s.jsxs(s.Fragment,{children:[!w&&d.width!==null&&d.height!==null&&s.jsx("div",{"data-testid":"react-canvas-device-frame",style:{position:"absolute",left:0,top:0,zIndex:0,width:d.width,height:d.height,transform:ot(n),transformOrigin:"0 0",pointerEvents:"none",background:"#fff",boxShadow:"0 0 0 1px #ffffff40, 0 8px 30px #0009"}}),s.jsxs(nt,{label:i?"2D component board view":"React canvas view","data-testid":i?"canvas-board-zoom-controls":"react-canvas-zoom-controls","data-vgai-canvas-navigation-ignore":"true",className:"vgai-react-canvas-controls",children:[!i&&s.jsx(se,{boardViewport:b,containerRef:o,selectViewport:x,viewportValue:C}),w&&s.jsx(O,{variant:"ghost","aria-label":"Fit story board",title:"Fit all stories",size:"comfortable",onClick:k,children:"Fit board"}),s.jsx(D,{"aria-label":"Zoom out",title:"Zoom out",size:"comfortable",onClick:()=>m(n.zoom/1.2),children:s.jsx(M,{icon:st,size:"md"})}),s.jsxs(O,{variant:"ghost","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",size:"comfortable",onClick:()=>m(1),children:[Math.round(n.zoom*100),"%"]}),s.jsx(D,{"aria-label":"Zoom in",title:"Zoom in",size:"comfortable",onClick:()=>m(n.zoom*1.2),children:s.jsx(M,{icon:at,size:"md"})}),!i&&s.jsx(D,{"aria-label":"Zoom to selection",title:"Zoom to selection",size:"comfortable",onClick:h,children:s.jsx(M,{icon:rt,size:"md"})})]})]})}const re="Scene";function ie({active:o,composite:c,descriptor:i,documentId:f,store:n}){const d=p.useRef(null),b=p.useRef(null),[m]=p.useState(bt),h=i.kind==="canvas",x=h?m:St;p.useSyncExternalStore(n.subscribe,n.getSnapshot);const k=p.useSyncExternalStore(xt,gt),w=p.useSyncExternalStore(vt,wt),[R,C]=p.useState(null),r=c.childAdapters().find(v=>v.worldId===i.worldId)?.adapter??R??void 0,u=h&&r?.provenance?.label==="babylon",e=r?.hierarchy.roots()??[],a=new Set(r?.rects?.emptyContainers?.().map(v=>v.id)??[]),t=e.some(v=>!a.has(v.id)),l=Lt({surface:h?"Scene":i.kind==="dom"?"UI":"World",rootIds:[i.worldId],playSuspended:n.playState!=="stopped"&&(!r||r.provenance?.source==="boundary"),phase:!r||r.provenance?.source==="boundary"?"loading":"ready",content:!r||r.provenance?.source==="boundary"?"unknown":t?"present":"empty",readiness:k,failures:w});p.useEffect(()=>{if(r)return yt(f,()=>({adapter:r,nodeId:[...n.selectedEntityIds].find(v=>r.hierarchy.node(v))??null}))},[c,r,f,n]),p.useEffect(()=>{const v=d.current;if(v&&!u)return h?At(v,x):Dt(v,x)},[x,u,h]),p.useEffect(()=>{if(!o)return;if(!!!b.current&&d.current){b.current=jt(d.current,c,n,[i],(ce,tt)=>C(tt),h?{canvasSceneView:m}:void 0,f);return}let E=0,$=0;const W=()=>{if(E+=1,E<2){$=requestAnimationFrame(W);return}Et(f)};return $=requestAnimationFrame(W),()=>cancelAnimationFrame($)},[o,m,c,i,f,h,n]),p.useEffect(()=>()=>{b.current?.(),b.current=null},[]);const g=kt(Rt(n),n.selectedEntityIds),S=g?.worldId===i.worldId?g:r?.rects?{worldId:i.worldId,kind:"dom",adapter:r}:null;return s.jsxs("div",{ref:d,"data-testid":`world-document:${i.worldId}`,"data-vgai-backdrop-color":o?u?"#111827":h?L:P:void 0,"data-vgai-backdrop-policy":o?"dark-frost":void 0,onPointerDown:()=>Ct("viewport"),style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"auto",backgroundColor:u?"#111827":h?L:P,touchAction:"none"},children:[u?null:h?s.jsx(Mt,{view:m}):s.jsx(le,{}),s.jsx(te,{...r?{adapter:r}:{},...h&&!u?{view:m,transformModeAware:!0}:{}},`selection:${H(r)}`),s.jsx(Zt,{explanation:l,testId:`world-surface-status:${i.worldId}`,style:{zIndex:20}}),u?null:h?s.jsx(Bt,{active:o,...r?{adapter:r}:{},containerRef:d,view:m},`controls:${H(r)}`):s.jsxs(s.Fragment,{children:[s.jsx(oe,{docId:i.worldId,containerRef:d}),s.jsx(ae,{containerRef:d,context:S})]})]})}function le(){const o=p.useSyncExternalStore(N,G),c=Math.max(8,24*o.zoom),i=Math.max(.7,Math.min(1.4,o.zoom));return s.jsx("div",{"data-testid":"react-design-canvas-backdrop","aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:P,backgroundImage:`radial-gradient(circle, ${Gt} ${i}px, transparent ${i}px)`,backgroundPosition:`${o.x}px ${o.y}px`,backgroundSize:`${c}px ${c}px`}})}let B=null;function Te(){return B}function $e(o,c){B={store:o,composite:c};const i=ht(),f=c.childAdapters().some(t=>t.role==="world"&&t.kind==="three"),n=c.childAdapters().some(t=>t.kind===zt);!f&&!n&&ct(j,{discardDirty:!0});const d=new Set,b=[];let m=!1;for(const t of c.childAdapters())t.role==="world"&&t.kind==="three"&&b.push(F(t.worldId,j));const h=It(c),x=h.find(t=>t.kind==="canvas");x&&b.push(F(x.worldId,z));const k=new Set([...c.childAdapters().filter(t=>t.role==="world"&&t.kind==="three"),...x?[x]:[]].map(t=>t.worldId)),w=new Map;function R(){for(const t of h){if(k.has(t.worldId)||w.has(t.worldId))continue;const l=Ut(t.kind);if(!l)continue;const g=F(t.worldId,l.documentId),S=mt(t.worldId,()=>l.presence()==="absent"?`Root "${t.worldId}" has no document of its own: its design surface is the project's ${l.title} board (${l.documentId}). ${l.absentReason()}`:null);w.set(t.worldId,()=>{S(),g()})}}b.push(dt(t=>{const l=ft();if(l.some(S=>S.descriptor.id===t))return null;const g=Ht(t);return g?g.presence()==="absent"?g.absentReason():null:`No workspace document is named "${t}". Open in this session: ${l.map(S=>S.descriptor.id).join(", ")||"(none)"}. A component board is present only when the package that owns its medium says this project has one, so a board id can be absent for this project and present for another.`}));function C(t){const l=g=>s.jsx(ie,{...g,composite:c,descriptor:t,store:o});pt({id:z,title:re,kind:"world",workspaceRole:"authored-subject",provenance:{rootId:t.worldId,...t.path?{sourcePath:t.path}:{}},Content:l,presentation:()=>({kind:"world",id:t.worldId}),onActivate:()=>o.setActiveViewportTab("edit")},{category:"scene",default:!f,rootId:t.worldId})}function r(t){d.add(t.documentId);const l=()=>{d.delete(t.documentId)};try{Promise.resolve(t.install({store:o,composite:c})).catch(l)}catch{l()}}function u(){if(!m){R();for(const t of Ot()){const l=t.presence();if(l===null)continue;const g=d.has(t.documentId);l==="present"!==g&&(l==="present"?r(t):(U(t.documentId),d.delete(t.documentId)))}}}x&&(C(x),d.add(z)),u();const e=Wt(u),a=x?z:[...d][0];return!f&&a!==void 0&&(i===null||i===j||i===ut)?V(a):i?V(i):f&&V(j),()=>{m=!0,B?.store===o&&(B=null),e();for(const t of b)t();for(const t of w.values())t();w.clear();for(const t of d)U(t)}}export{ie as RootDocumentContent,Te as activeRootDocumentHost,$e as installRootDocuments};
@@ -0,0 +1 @@
1
+ import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{k1 as Ge,k2 as ve,k3 as H,fP as Ee,a5 as M,jB as He,a9 as Z,f7 as B,f8 as _,k4 as Be,k5 as _e,k6 as Ue,hL as Qe,a4 as G,k7 as Te,k8 as we,k9 as Ke,fe as qe,hK as Xe,ka as Ye,gK as Je,kb as Ze,kc as et,V as k,B as tt,cl as rt,kd as Se,cB as at,ke as nt,kf as st,kg as it,kh as ot,ki as ct,kj as lt,aG as C,kk as J,kl as dt,cX as ut,km as mt,dd as pt,cu as ft,cz as gt,kn as ye,ko as Ce,kp as xe,kq as ht,ao as bt,kr as vt,ks as je,fm as wt,kt as St,ku as yt,jC as Ct,jD as xt,jE as jt,jF as Pt,fS as kt,fT as Et,jM as Tt,jN as At,gq as Vt,gr as Rt,gs as Mt,gt as Ot,aN as Ft}from"./index-GIL7oGEO.js";import{R as zt}from"./RootSelectionOverlay-BZPlxmXU.js";import{e as Lt,S as It}from"./surface-state-DaxyruCj.js";import{b as Nt,s as Wt,t as Dt,V as $t}from"./three-viewport-presentation-QBQpSdMh.js";import{r as f}from"./index-nmcBqr7Y.js";import{t as Gt}from"./surface-content-Dg9Kkazf.js";import"./index-CtzuWnCS.js";import{createPerformanceProfiler as Ht}from"./performance-profiler-D_Jey87L.js";import{createWebGLGpuTimer as Bt}from"./webgl-gpu-timer-D3YX7RaD.js";import{a as _t}from"./renderer-config-BqG4O8i9.js";import{getUserData as Ae}from"./user-data-BB2Of6Ht.js";import{detectKtx2Support as Ut}from"./loader-CaF_I7Yt.js";import{resolveRenderSettings as Qt}from"./render-settings-Bw4W9SYF.js";import{createSoftParticleDepthPass as Kt}from"./soft-particle-depth-DGvfQDi1.js";import{ViewportShadingRenderer as qt}from"./viewport-shading-BuA88e_A.js";import{applyRendererSettings as Xt,applySceneRenderPipeline as Yt}from"./setup-renderer-DVXaSGin.js";import{EffectComposer as Jt,BlendFunction as Zt,KernelSize as er,OutlineEffect as tr,EffectPass as rr}from"./index-BcCBqgM_.js";import{w as ar,C as nr,V as $,W as sr,cb as ir,Q as Pe,T as or}from"./three.module-D396a9Mn.js";import{d as cr}from"./design-time-mount-registry-DUpXCg1U.js";import{a as lr}from"./project-authoring-session-Bnt6icLr.js";import{i as dr}from"./editor-presentation-activity-C7SNSmTd.js";import{E as ur,c as mr,a as pr,b as fr,i as gr}from"./viewport-shading-boundary-B_-_gABg.js";import{p as hr}from"./viewport-root-presentation-CWsE56K6.js";import{d as br}from"./asset-editor-persistence-BBaONOJt.js";import{bindStagePresenceMarkers as vr}from"./stage-presence-markers-DiGI6A45.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./eyedropper-session-bjPXnfeX.js";import"./react-story-board-BDDwiE2H.js";import"./viewport-pick-context-DkawXbEi.js";import"./inspect-BZfi3mmo.js";import"./inference-diagnostics-Dhmtfbq_.js";import"./object-marks-DwvIEBOK.js";import"./render-features-CPQ_e568.js";import"./matcap-texture-CVfalpWT.js";import"./defaults-DKiBJCPN.js";import"./edit-mode-authoring-B47TfLqu.js";import"./stage-invalidation-DBg3C3Ta.js";import"./clip-planes-CnAI6DZn.js";import"./three-CDSueJyJ.js";import"./OrbitControls-CM3bPray.js";import"./LineSegments2-CsOpKSiM.js";import"./three.quarks.esm-B1C61jGo.js";import"./live-gesture-lock-DJbrjOqf.js";import"./scene-framing-Cat0GtyJ.js";import"./mounted-authoring-Dmg5xmhP.js";import"./collaboration-presence-DLoZ7EA3.js";function wr({previewRef:r}){const{preview:e,previewPinned:i}=H(),[n,c]=f.useState(!1),o=f.useRef(null);if(f.useEffect(()=>{if(!n)return;const u=P=>{o.current?.contains(P.target)||c(!1)};return document.addEventListener("pointerdown",u),()=>document.removeEventListener("pointerdown",u)},[n]),!e)return null;const m=e.camera.isPerspectiveCamera&&Number.isFinite(e.camera.aspect)?e.camera.aspect:16/9;return s.jsxs("div",{className:"vgai-camera-preview","data-testid":"camera-preview",children:[s.jsxs(Ee,{className:"vgai-camera-preview-header",gap:4,align:"center",children:[s.jsx(M,{icon:He,size:"sm"}),s.jsx(Z,{variant:"label",truncate:!0,className:"vgai-camera-preview-title",title:`${e.name} · ${e.lens}`,children:e.name}),s.jsx(B,{text:i?"Unpin camera preview":"Pin camera preview",children:s.jsx(_,{"aria-label":i?"Unpin camera preview":"Pin camera preview","aria-pressed":i,size:"compact",onClick:Be,children:s.jsx(M,{icon:_e,size:"sm"})})}),s.jsxs("div",{ref:o,className:"vgai-camera-preview-menu-anchor",children:[s.jsx(B,{text:"Camera actions",children:s.jsx(_,{"aria-label":"Camera actions","aria-expanded":n,size:"compact",onClick:()=>c(u=>!u),children:s.jsx(M,{icon:Ue,size:"sm"})})}),n?s.jsxs(Qe,{className:"vgai-camera-preview-menu",children:[s.jsx(G,{variant:"ghost",size:"compact",disabled:!e.canAuthorPose,title:e.poseRefusal,onClick:()=>{c(!1),Te(e)},children:"Pilot Camera"}),s.jsx(G,{variant:"ghost",size:"compact",onClick:()=>{c(!1),we(e)},children:"View Through Camera"}),s.jsx(G,{variant:"ghost",size:"compact",disabled:!e.canAuthorPose,title:e.poseRefusal,onClick:()=>{c(!1),Ke(e)},children:"Align Camera to Current View"})]}):null]})]}),s.jsx("div",{ref:r,className:"vgai-camera-preview-image",style:{aspectRatio:String(Math.max(.5,Math.min(3,m)))},role:"img","aria-label":`Live view through ${e.name}`,onDoubleClick:()=>we(e)})]})}function Sr(){return s.jsxs("div",{className:"vgai-camera-guides","aria-hidden":"true",children:[s.jsx("div",{className:"vgai-camera-guide vgai-camera-guide-v1"}),s.jsx("div",{className:"vgai-camera-guide vgai-camera-guide-v2"}),s.jsx("div",{className:"vgai-camera-guide vgai-camera-guide-h1"}),s.jsx("div",{className:"vgai-camera-guide vgai-camera-guide-h2"}),s.jsx("div",{className:"vgai-camera-safe-frame"}),s.jsx("div",{className:"vgai-camera-center-mark"})]})}function yr(){const{view:r,guidesVisible:e}=H();if(!r)return null;const i=r.mode==="pilot";return s.jsxs(s.Fragment,{children:[e?s.jsx(Sr,{}):null,s.jsx(qe,{variant:"overlay",border:!0,className:"vgai-camera-view-banner vgai-chrome-island vgai-glass-island","data-testid":"camera-view-banner",children:s.jsxs(Ee,{gap:6,align:"center",children:[s.jsx(Xe,{children:i?"PILOTING":"CAMERA VIEW"}),s.jsx(Z,{variant:"label",children:r.subject.name}),s.jsx(Z,{variant:"caption",tone:"muted",children:"Exact camera view"}),s.jsx(B,{text:e?"Hide composition guides":"Show composition guides",children:s.jsx(_,{"aria-label":e?"Hide composition guides":"Show composition guides","aria-pressed":e,size:"compact",onClick:Ye,children:s.jsx(M,{icon:Je,size:"sm"})})}),i?null:s.jsx(G,{size:"compact",variant:"primary",disabled:!r.subject.canAuthorPose,title:r.subject.poseRefusal,onClick:()=>Te(r.subject),children:"Pilot"}),s.jsx(B,{text:"Exit camera view",children:s.jsx(_,{"aria-label":"Exit camera view",size:"compact",onClick:Ze,children:s.jsx(M,{icon:et,size:"sm"})})})]})})]})}function Cr({previewRef:r}){return f.useSyncExternalStore(Ge,ve,ve),s.jsxs(s.Fragment,{children:[s.jsx(wr,{previewRef:r}),s.jsx(yr,{})]})}const xr=2e4,jr=250,Pr=5e3;class kr{#e=0;#t=0;#r=0;#a;constructor(e){this.#a=e}get pending(){return this.#e>0||this.#t>0}begin(e,i){this.#e=e+xr,this.#t=i?e+Pr:0,this.#r=0,this.tick(e)}tick(e){if(!(!this.pending||e<this.#r)){if(this.#r=e+jr,this.#t>0&&this.#a.seedFromGameCamera()){this.cancel();return}this.#e>0&&this.#a.frameContent()&&(this.#e=0),e>=this.#e&&(this.#e=0),e>=this.#t&&(this.#t=0)}}cancel(){this.#e=0,this.#t=0}}const ke=new WeakMap;function Er(r,e){if(!r)return e(),!0;if(ke.has(r))return!1;try{return e(),!0}catch(i){const n=i instanceof Error?i.message:String(i);return ke.set(r,n),k.warn(`The Scene view cannot draw this world with the editor's own renderer, and has stopped trying: ${n}. This world was built by a copy of three the editor did not make (a vendored bundle pins its own revision), and the editor draws it with ITS three — across a wide enough revision gap the two disagree about the renderer/material contract. The game itself is unaffected and still drawing: its own canvas is what the Game tab and ${tt("screenshot")} show, and hierarchy, selection and inspection all still read the live world. It closes when the game resolves \`three\` to the host's instance — a bare, un-rewritten \`import 'three'\` in its own source.`,"ingest"),!1}}function Tr(){const r=rt();r.addEventListener("server-log",i=>{try{Se(JSON.parse(i.data))}catch{}});let e=!1;return(async()=>{try{const i=await at();if(e)return;for(const n of i)Se(n)}catch{}})(),()=>{e=!0,r.close()}}const Ve="viewportPose";function Ar(){const r=nt(Ve);return r&&Array.isArray(r.position)&&r.position.length===3&&r.position.every(Number.isFinite)&&Array.isArray(r.target)&&r.target.length===3&&r.target.every(Number.isFinite)?r:null}function Vr(r,e){st(Ve,{position:[r.position.x,r.position.y,r.position.z],target:[e.x,e.y,e.z]})}function Rr(r,e,i){const n=document.createElement("canvas");n.setAttribute("aria-label",`${i} authoring viewport`),n.setAttribute("data-testid","editor-canvas"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1,n.style.width="100%",n.style.height="100%",n.style.display="block",n.style.pointerEvents="auto",r.appendChild(n);const c=Math.max(1,e.clientWidth),o=Math.max(1,e.clientHeight),m=Math.min(window.devicePixelRatio||1,2);n.width=Math.ceil(c*m),n.height=Math.ceil(o*m);const u=pt(new sr({canvas:n,antialias:!!Qt(void 0).antialias,powerPreference:"high-performance"}));return Xt(u,void 0,m),u.setSize(c,o),u.shadowMap.type=ir,u.info.autoReset=!1,Ut(u),{canvas:n,renderer:u,lease:null}}async function Mr(r){const e=ft(r.source,r.id);if(e)return e;let i=r.url,n=r.format??"gltf",c=r.includes;if(!i){const u=(await gt(r.source,r.id))[0];if(!u)return k.error(`No downloadable files for ${r.name}.`,"asset"),null;i=u.url,n=u.format,c=u.includes}const o={source:r.source,id:r.id,name:r.name,url:i,format:n};c&&(o.includes=c);const m=await br(o);return m.ok&&m.path?`/${m.path}`:(k.error(`Could not download ${r.name}.`,"asset"),null)}function Or(r){if(r.isCamera)return r;const e=Ae(r,"_camera");return e?.isCamera?e:null}function Fr(r){const e=r;if(e.isPerspectiveCamera)return`${e.fov.toFixed(0)}° perspective`;const i=r;return i.isOrthographicCamera?`Orthographic · ${i.zoom.toFixed(2)}×`:r.type}function zr(r,e){const i=r.transforms;if(!i)return{canAuthorPose:!1,poseRefusal:"This camera has no transform authoring path."};const n=i.editability?.(e,"position")??{writable:!0},c=i.editability?.(e,"rotation")??{writable:!0};return n.writable&&c.writable?{canAuthorPose:!0}:{canAuthorPose:!1,poseRefusal:n.reason??c.reason??"This camera pose is read-only."}}function Lr(r,e,i){const n=e.get(i)??null;if(!n)return null;const c=Or(n);return c?{id:i,name:n.name||c.name||"Camera",camera:c,lens:Fr(c),...zr(r,i)}:null}function Ir(r){const e=new Map;for(const[i,n]of r.objectMap){const c=Ae(n,"tags");Array.isArray(c)&&c.length>0&&e.set(i,c)}return e}function Nr(r){const{store:e,documentId:i,container:n,canvas:c,renderer:o,stats:m}=r,u=new Jt(o),P=Kt(),O=new qt,g=Ht(),F=Bt(o.getContext()),Re=t=>{g.enabled&&F.begin();try{t()}finally{F.end()}},Me=()=>g.enabled?F.poll():null,Oe=it({id:i,label:"Scene viewport",kind:"scene",profiler:g}),S=new ar;S.background=new nr(ot(c).background??11184810),e.bindScene(S,o);const a=new ur(c,S,e,n,{renderer:o,onlineAssetResolver:Mr,onProjectionChange:Nt});e.bindScene(S,o,a.batchedRenderer,a.camera),e.setOrbitTarget(a.orbitControls.target);const U=new $,z=new $,ee=new $,te=()=>{const t=a.renderCamera;t.getWorldPosition(U),a.cameraViewMode==="pilot"?z.copy(a.orbitControls.target):a.cameraViewMode?(t.getWorldDirection(ee),z.copy(U).add(ee.multiplyScalar(10))):z.copy(a.orbitControls.target);const l=t.fov;return{position:U,target:z,fov:typeof l=="number"?l:0}},E=vr({scene:S,store:e,documentId:i,container:n,canvas:c,viewport:a,readVisibleCameraPose:te});let re="",Q=null,h=null,x=null,L=null;const ae=()=>{h&&fr(h,je(o.domElement))},Fe=ct(o.domElement,ae),ne=()=>{if(!h)return;const t=C(e),l=[...e.selectedEntityIds].filter(d=>t.hierarchy.node(d)!==null).map(d=>J(t,e.objectMap,d)).filter(d=>d!==null);pr(h,l);const p=h.selection.size>0;x&&(x.enabled=p,x.renderToScreen=p),L&&(L.renderToScreen=!p)};function T(){vt(e),Q?.(),Q=null,h?.selection.clear(),h=null,x=null,L=null,Yt(u,o,e.scene??S,a.renderCamera,void 0,{basePixelRatio:Math.min(window.devicePixelRatio||1,2),objectMap:e.objectMap,entityTags:Ir(e)}),h=mr({BlendFunction:Zt,KernelSize:er,OutlineEffect:tr},e.scene??S,a.renderCamera,je(o.domElement)),ae(),L=u.passes.at(-1)??null,x=new rr(a.renderCamera,h),x.enabled=!1,u.addPass(x),ne();const t=e.adoptedImageConfig;t&&(Q=_t(or,o,t))}const se=()=>{a.setProjection(Dt().projection),e.setViewportCamera(a.freeCamera),T()},ze=Wt(se);se();const K=t=>Lr(C(e),e.objectMap,t);let b=null;const A=()=>{b&&(xe(C(e),b),b=null)},ie=()=>{const t=H().view;t?.mode!=="pilot"||!t.subject.canAuthorPose||(b=t.subject.id,ye(C(e),b))},oe=()=>{if(!b||a.cameraViewMode!=="pilot")return;const t=K(b),l=C(e),p=l.transforms;if(!t||!p)return;let d;try{d=p.get(b)}catch(v){k.error(v instanceof Error?v.message:String(v),"camera-authoring"),A();return}Ce(l,b,{position:t.camera.position.toArray(),rotation:t.camera.quaternion.toArray(),scale:d.scale}),e.notifyIngestEdit()};a.orbitControls.addEventListener("start",ie),a.orbitControls.addEventListener("change",oe),a.orbitControls.addEventListener("end",A);const Le=lt({active:()=>e.playState==="stopped"&&e.activeViewportTab==="edit",selected:()=>{const t=e.selectedEntityId;return t?K(t):null},resolve:K,showView:(t,l)=>{A(),a.setCameraView(t.camera,l),T(),E.reportCamera()},leaveView:()=>{A(),a.clearCameraView(),T(),E.reportCamera()},alignToViewport:t=>{const l=C(e),p=l.transforms;if(!p||!t.canAuthorPose)return;const d=e.objectMap.get(t.id)??null;if(!d)return;const v=a.camera.getWorldPosition(new $),y=a.camera.getWorldQuaternion(new Pe),w=v.clone(),V=y.clone();if(d.parent){d.parent.updateWorldMatrix(!0,!1),d.parent.worldToLocal(w);const R=d.parent.getWorldQuaternion(new Pe);V.premultiply(R.invert())}let be;try{be=p.get(t.id)}catch(R){k.error(R instanceof Error?R.message:String(R),"camera-authoring");return}ye(l,t.id),Ce(l,t.id,{position:w.toArray(),rotation:V.toArray(),scale:be.scale}),e.notifyIngestEdit(),xe(l,t.id)},subscribe:e.subscribe});let ce=null;const le=()=>{const t=ht(e);t!==ce&&(ce=t,c.style.opacity=t?"1":"0",n.style.backgroundColor=t?"":bt.surface.raised,n.style.backgroundImage=t?"":"linear-gradient(45deg, #444649 25%, transparent 25%, transparent 75%, #444649 75%), linear-gradient(45deg, #444649 25%, transparent 25%, transparent 75%, #444649 75%)",n.style.backgroundPosition=t?"":"0 0, 8px 8px",n.style.backgroundSize=t?"":"16px 16px")};le();let de=e.composerVersion;const Ie=e.subscribe(()=>{le();const t=e.scene;t&&t!==a.currentScene&&a.setScene(t),a.objectMap=e.objectMap,a.syncFromStore(),e.composerVersion!==de?(de=e.composerVersion,T()):ne()});let I=null;const q=new kr({seedFromGameCamera:()=>{const t=I?.()??null;return!!t&&a.seedFromGameCamera(t)},frameContent:()=>a.focusOnScene()}),ue=()=>{q.cancel(),I=null};a.orbitControls.addEventListener("start",ue);const me=()=>Vr(a.camera,a.orbitControls.target);a.orbitControls.addEventListener("end",me);const Ne=e.onViewportAction(t=>{switch(t.type){case"focus-entity":{const l=J(C(e),e.objectMap,t.id);l&&a.focusOn(l);break}case"focus-scene":{{const l=Ar();if(l){a.camera.position.set(...l.position),a.orbitControls.target.set(...l.target),a.orbitControls.update();break}}I=t.gameCamera??null,q.begin(performance.now(),I!==null);break}case"focus-selection":{const l=C(e),p=[...e.selectedEntityIds].map(d=>J(l,e.objectMap,d)).filter(d=>d!==null);a.focusOnMultiple(p);break}case"snap-selection-to-floor":a.snapSelectionToFloor();break;case"set-view-preset":a.setViewPreset(t.preset);break;case"set-camera-pose":a.setPose(t.position,t.target,t.fov);break}});Tr();const pe=new ResizeObserver(()=>{const t=Math.max(1,n.clientWidth),l=Math.max(1,n.clientHeight);o.setSize(t,l),u.setSize(t,l),a.resize(t,l)});pe.observe(n);let N=performance.now(),W=!0,j=!1,fe=!1;function ge(t){return Er(a.currentScene,()=>{P.render(o,a.currentScene,a.renderCamera),a.renderWithInfrastructure(()=>{yt(a.currentScene,()=>O.render(a.currentScene,e.shadingMode,()=>u.render(t),gr)),a.renderViewCube(o),a.renderCameraPreview(o,H().preview?.camera??null,r.cameraPreview())})})}const We=dt(c,async()=>{if(j||!dr()||!n.checkVisibility({visibilityProperty:!0,checkVisibilityCSS:!0})||!ge(0))return null;const t=document.createElement("canvas");return t.width=c.width,t.height=c.height,t.getContext("2d").drawImage(c,0,0),t}),X=()=>St(e)===e;function De(t,l){if(j)return;if(l&&(N=t),!n.checkVisibility({visibilityProperty:!0,checkVisibilityCSS:!0})){N=t,W=!0;return}g.beginFrame();const p=t-N,d=p/1e3;X()&&(m.frameTime=p,m.fps=1e3/p),N=t,E.syncMarkers(d),q.tick(t),g.beginPhase(),a.update(d),r.runFrame(d),a.batchedRenderer.update(d),g.endPhase("editor"),g.beginPhase(),o.info.reset(),Re(()=>{ge(d)}),g.reportRender({gpuMs:Me(),drawCalls:o.info.render.calls,triangles:o.info.render.triangles,geometries:o.info.memory.geometries,textures:o.info.memory.textures}),g.endPhase("render"),X()&&(m.drawCalls=o.info.render.calls,m.triangles=o.info.render.triangles),W&&fe&&(W=!1,wt(i)),g.endFrame();const v=te(),y=v.position,w=v.target;X()&&(m.cameraPosition.x=y.x,m.cameraPosition.y=y.y,m.cameraPosition.z=y.z,m.cameraTarget.x=w.x,m.cameraTarget.y=w.y,m.cameraTarget.z=w.z);const V=`${y.x},${y.y},${y.z},${w.x},${w.y},${w.z},${v.fov}`;V!==re&&(re=V,E.reportCamera())}a.objectMap=e.objectMap,a.syncFromStore(),T();let Y,D;async function $e(t){if(j)return;r.onMountStatus("mounting"),D?.(),D=void 0,Y=t,r.onRootIds(t.childAdapters().filter(d=>d.role==="world"&&d.kind==="three").map(d=>d.worldId));const l=cr("three");if(j||Y!==t)return;const p=l?await l.mountWorldRootSession({store:e,composite:t,renderer:o}):()=>{};if(j||Y!==t){p();return}D=p,j||r.onMountStatus("ready")}const he=lr(e,$e);return he.ready.then(()=>ut(mt(e))).catch(t=>{k.error(`Editor boot failed: ${t instanceof Error?t.message:String(t)}`,"scene"),r.onMountStatus("ready")}).finally(()=>{fe=!0,W=!0}),{scene:S,viewport:a,frame:De,present:t=>hr(e,t),setHelper:(t,l)=>a.setHelper(t,l),dispose:()=>{j=!0,Oe(),We(),pe.disconnect(),Ie(),Ne(),Le(),a.orbitControls.removeEventListener("start",ie),a.orbitControls.removeEventListener("change",oe),a.orbitControls.removeEventListener("end",A),a.orbitControls.removeEventListener("start",ue),a.orbitControls.removeEventListener("end",me),he.dispose(),D?.(),E.dispose(),O.dispose(),F.dispose(),ze(),Fe(),h?.selection.clear(),P.dispose(),u.dispose()}}}function Wr({store:r,rootIds:e,mountStatus:i}){f.useSyncExternalStore(r.subscribe,r.getSnapshot);const n=f.useSyncExternalStore(Vt,Rt),c=f.useSyncExternalStore(Mt,Ot),o=r.scene?.background,m=o!==null&&!(o?.isColor===!0&&o.getHex()===11184810),u=f.useMemo(()=>!!(r.scene&&Gt(r.scene,{includeBackground:!1,ignoredLayer:Ft})),[r.scene,r.contentVersion]),P=!!(r.scene&&(m||u)),O=Lt({surface:"Scene",rootIds:e,phase:i==="mounting"?"loading":"ready",content:P?"present":i==="mounting"?"unknown":"empty",readiness:n,failures:c});return s.jsx(It,{explanation:O,testId:"scene-viewport-status"})}function Dr({store:r,documentId:e,cameraPreviewRef:i,mountStatus:n,rootIds:c}){f.useSyncExternalStore(r.subscribe,r.getShellSnapshot??r.getSnapshot),f.useSyncExternalStore(Ct,xt),f.useSyncExternalStore(jt,Pt),f.useSyncExternalStore(kt,Et);const o=Tt(r,e,"document"),m=At(o);return s.jsxs(s.Fragment,{children:[o.surface!==null?s.jsx(zt,{}):null,o.surface==="three"?s.jsx(Cr,{previewRef:i}):null,!m&&o.surface!=="three"&&n==="mounting"?s.jsx($t,{}):null,s.jsx(Wr,{store:r,rootIds:c,mountStatus:n})]})}const Na={mountWorldRootSurface:Rr,installWorldRootStage:Nr,Overlays:Dr};export{Na as worldRootStageBinding};
@@ -0,0 +1 @@
1
+ import{a as g}from"./jsx-runtime-DPjLkJKQ.js";import{r as n}from"./index-nmcBqr7Y.js";import{g as a}from"./debug-registry-Dgvitx8M.js";import{createFrameSelectorCache as m}from"./frame-selector-cache-cCeUbcjG.js";import{shallow as T}from"./frame-selector-cache-cCeUbcjG.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-GIL7oGEO.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";const c=n.createContext(null);function G({game:e,children:t}){return g.jsx(c.Provider,{value:e,children:t})}function f(){const e=n.useContext(c);if(!e)throw new Error("useGame: no Game in context — wrap this component in <WorldProvider game={ctx.game!}>.");return e}function P(){return n.useContext(c)}function j(e,t=Object.is){const r=f(),o=n.useRef(null);return o.current===null&&(o.current=m(t)),n.useSyncExternalStore(s=>r.state.subscribe(s),()=>o.current.get(r.state.frameVersion,()=>e(r)))}function b(e,t){const r=e.world(t);if(!r)throw new Error(`useRootObservation: no world registered with id "${t}" — check game.roots for the ids actually registered.`);const o=r.mounted.observe;if(!o)throw new Error(`useRootObservation: world "${t}" (kind: ${r.kind}, adapter: "${r.adapter.id}") has no state bridge — its mount has no \`observe\` (RootStateObserver). This world cannot be observed from React.`);return o}function k(e,t,r=Object.is){const o=f(),s=b(o,e),u=n.useRef(null);u.current===null&&(u.current=m(r));const i=n.useRef(0);return n.useSyncExternalStore(l=>s.subscribe(()=>{i.current++,l()}),()=>u.current.get(i.current,()=>t(s.snapshot())))}function D(e,t,r){const o=n.useContext(c),s=n.useRef(t);s.current=t;const u=r?.tier;n.useEffect(()=>{const i=o&&a(o);if(i)return i.registerReactProvider(e,()=>s.current(),{tier:u})},[o,e])}function $(e,t,r){const o=n.useContext(c),s=n.useRef(r);s.current=r,n.useEffect(()=>{const u=o&&a(o);if(u)return u.registerReactCommand(e,t,(...i)=>s.current(...i))},[o,e])}function W(){const e=n.useContext(c);return n.useCallback((t,r)=>{e&&a(e)?.emitReact(t,r)},[e])}export{G as WorldProvider,b as requireRootObserver,T as shallow,$ as useDebugCommand,W as useDebugEmit,D as useDebugProvider,f as useGame,P as useOptionalGame,k as useRootObservation,j as useWorldState};
@@ -0,0 +1,5 @@
1
+ import{bT as g,dG as A,bU as b}from"./index-GIL7oGEO.js";function G(t){const s=(e,r,n,a)=>g({resolve:()=>n?{reaches:"writer",anchorKind:"source-structure",destination:a,write:e}:b(t.noWriterReason),record:()=>{},report:l=>t.report(`"${r}" stays live-only — ${l}.`)}),i=(e,r)=>g({resolve:()=>b(e),record:()=>{},report:n=>{t.report(n),r&&A(r)}});return{pipedStruct:s,structRefusal:i,structOp:(e,r,n,a,l)=>e?s(async()=>{const o=await t.backend().writeStruct(e,n,a);return o.changed?(await t.onChanged(),!0):(t.report(`struct "${n}" refused/no-op for oid "${e}": ${o.error??"no change"}`),!1)},n,t.backend()?.writeStruct!==void 0,l):i(`"${n}" refused: "${r}" has no source stamp.`),structMany:(e,r,n,a)=>s(async()=>{const u=await t.backend().writeStructMany(e,r,n);return u.changed?(await t.onChanged(),!0):(t.report(`batch "${r}" refused/no-op: ${u.error??"no change"}`),!1)},`${r} (batch)`,t.backend()?.writeStructMany!==void 0,a)}}function q(t,s){const i=v(t).split("/").filter(Boolean).slice(0,-1),e=v(s).replace(/\.[cm]?[jt]sx?$/,"").split("/").filter(Boolean);let r=0;for(;r<i.length&&r<e.length&&i[r]===e[r];)r+=1;const a=[...new Array(i.length-r).fill(".."),...e.slice(r)].join("/");return a.startsWith(".")?a:`./${a}`}function v(t){return t.replace(/\\/g,"/").replace(/^\.\//,"")}function h(t,s){let i=0,e=null;for(let r=s;r<t.length;r++){const n=t[r];if(e){n===e&&t[r-1]!=="\\"&&(e=null);continue}if(n==="/"&&t[r+1]==="/"){const a=t.indexOf(`
2
+ `,r);if(a<0)return-1;r=a;continue}if(n==="/"&&t[r+1]==="*"){const a=t.indexOf("*/",r+2);if(a<0)return-1;r=a+1;continue}if(n==='"'||n==="'"||n==="`")e=n;else if(n==="{")i++;else if(n==="}")i--;else if(n===">"&&i===0)return r}return-1}function D(t,s){return`"${t}" is a design-token reference (${s}) in this source, so replacing it with a literal is guarded — the binding would be lost and no widget can compose a var() back.`}function T(t,s){let i=0,e=s;for(;e<t.length;){const r=t[e];if(r==="/"&&t[e+1]==="/"){const n=t.indexOf(`
3
+ `,e);e=n<0?t.length:n+1;continue}if(r==="/"&&t[e+1]==="*"){const n=t.indexOf("*/",e+2);e=n<0?t.length:n+2;continue}if(r==='"'||r==="'"||r==="`"){for(e++;e<t.length&&!(t[e]===r&&t[e-1]!=="\\");)e++;e++;continue}if(r==="{"){i++,e++;continue}if(r==="}"){if(i--,e++,i===0)return e;continue}if(r==="<"&&L(t,e)){const n=m(t,e);if(n>e){e=n;continue}}e++}return-1}function L(t,s){const i=t[s+1];if(i===void 0||!(i===">"||/[A-Za-z]/.test(i)))return!1;let e=s-1;for(;e>=0&&/\s/.test(t[e]??"");)e--;return!/[A-Za-z0-9_$)\]]/.test(t[e]??"")}function j(t,s){const i=t[s+1];return i!==void 0&&(i==="/"||i===">"||i==="!"||/[A-Za-z]/.test(i))}function m(t,s){const i=h(t,s);if(i<0)return-1;if(t[i-1]==="/")return i+1;const r=t.slice(s+1,i).match(/^([A-Za-z0-9_.]+)/)?.[1];if(!r)return-1;let n=1,a=i+1;for(;a<t.length&&n>0;){const l=t[a];if(l==="{"){const o=T(t,a);a=o<0?t.length:o;continue}if(l!=="<"||!j(t,a)){a++;continue}if(t.startsWith(`</${r}`,a)){n--;const o=t.indexOf(">",a);if(a=o<0?t.length:o+1,n===0)return a;continue}if(t.startsWith(`<${r}`,a)&&/[\s/>]/.test(t[a+1+r.length]??"")){const o=h(t,a);if(o<0){n++,a+=1+r.length;continue}t[o-1]!=="/"&&n++,a=o+1;continue}const u=h(t,a);a=u<0?a+1:u+1}return a}const I={display:{flex:"flex",block:"block",grid:"grid",inline:"inline","inline-block":"inline-block","inline-flex":"inline-flex",none:"hidden"},flexDirection:{row:"flex-row",column:"flex-col","row-reverse":"flex-row-reverse","column-reverse":"flex-col-reverse"},flexWrap:{wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"},justifyContent:{"flex-start":"justify-start","flex-end":"justify-end",center:"justify-center","space-between":"justify-between","space-around":"justify-around","space-evenly":"justify-evenly"},alignItems:{"flex-start":"items-start","flex-end":"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"},textAlign:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"},position:{relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky",static:"static"},overflow:{visible:"overflow-visible",hidden:"overflow-hidden",scroll:"overflow-scroll",auto:"overflow-auto"},borderStyle:{none:"border-none",solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",double:"border-double"},textTransform:{uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize",none:"normal-case"},whiteSpace:{normal:"whitespace-normal",nowrap:"whitespace-nowrap",pre:"whitespace-pre","pre-wrap":"whitespace-pre-wrap"},fontStyle:{italic:"italic",normal:"not-italic"},mixBlendMode:{normal:"mix-blend-normal",multiply:"mix-blend-multiply",screen:"mix-blend-screen",overlay:"mix-blend-overlay"}};(()=>{const t={};for(const[s,i]of Object.entries(I))for(const e of Object.values(i))t[e]=s;return t})();function O(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function H(t,s){const i=O(s);let e=null;for(const r of t)i in r.properties&&(e=r);return e?{rule:e,prevValue:e.properties[i]??""}:null}function Q(t,s){let i=null;for(const e of t){const r=e.selectorText.trim();s.some(n=>r===`.${n}`)&&(i=e)}return i}function $(t,s){let i=s+1,e=1,r=null;for(;i<t.length&&e>0;){const n=t[i];r?n===r&&t[i-1]!=="\\"&&(r=null):n==="'"||n==='"'||n==="`"?r=n:n==="{"?e++:n==="}"&&e--,i++}return i}function P(t,s,i){let e=s+1;const r=e;for(;e<t.length&&t[e]!==i;)t[e]==="\\"&&e++,e++;return[r,e,e+1]}const E=String.raw`[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?`,x=new RegExp(`^${E}$`);function p(t){const s=t.trim();if(!s.startsWith("[")||!s.endsWith("]"))return!1;const i=s.slice(1,-1).trim();if(i==="")return!0;const e=i.split(",").map(r=>r.trim());return e.length>1&&e[e.length-1]===""&&e.pop(),e.every(r=>x.test(r))}const M=new RegExp(`^(?:${E}|true|false|'[^']*'|"[^"]*")$`);function S(t,s,i){const e=[],r=a=>{for(;a<=i&&/\s/.test(t[a]??"");)a++;return a};let n=s+1;for(;n<=i&&!/[\s>/]/.test(t[n]??">");)n++;for(;n<=i&&(n=r(n),!(n>i||t[n]===">"||t[n]==="/"&&t[n+1]===">"));){if(t[n]==="{"){n=$(t,n);continue}const a=n;for(;n<=i&&/[\w-]/.test(t[n]??"");)n++;const l=t.slice(a,n);if(!l){n++;continue}const u=n;if(n=r(n),t[n]!=="="){e.push(N(l,a,u));continue}n=r(n+1);const o=W(t,n);if(!o){n++;continue}e.push(_(t,l,o,a)),n=o.next}return e}function N(t,s,i){return{name:t,valueStart:-1,valueEnd:-1,rawValue:"true",isExpression:!1,isLiteral:!0,attrStart:s,attrEnd:i}}function W(t,s){const i=t[s];if(i==='"'||i==="'"){const[e,r,n]=P(t,s,i);return{valueStart:e,valueEnd:r,isExpression:!1,next:n}}if(i==="{"){const e=$(t,s)-1;return{valueStart:s+1,valueEnd:e,isExpression:!0,next:e+1}}return null}function _(t,s,i,e){const r=t.slice(i.valueStart,i.valueEnd).trim(),n=!i.isExpression||M.test(r)||p(r);return{name:s,valueStart:i.valueStart,valueEnd:i.valueEnd,rawValue:r,isExpression:i.isExpression,isLiteral:n,attrStart:e,attrEnd:i.next}}const C=new Set(["key","ref","data-oid","style","className","children"]),z=t=>C.has(t)||/^on[A-Z]/.test(t);function U(t,s,i=!1){if(!t.isExpression)return s;const e=t.rawValue;if(x.test(e)){if(p(s))return i?s.trim():null;const r=Number(s);return Number.isNaN(r)?`'${s}'`:String(r)}return e==="true"||e==="false"?s==="true"||s==="false"?s:`'${s}'`:p(e)?p(s)?s.trim():null:/^"[^"]*"$/.test(e)?`"${s.replace(/"/g,'\\"')}"`:`'${s.replace(/'/g,"\\'")}'`}function w(t,s){return p(s)||x.test(s)||s==="true"||s==="false"?`${t}={${s.trim()}}`:`${t}="${s.replace(/"/g,"&quot;")}"`}function B(t,s,i){const e=i.at(-1);if(!e)return null;let r=e.attrStart;for(;r>s&&t[r-1]!==`
4
+ `;)r--;if(r<=s)return null;const n=t.slice(r,e.attrStart);return/\S/.test(n)?null:{at:e.attrEnd,indent:n}}function y(t,s,i,e,r){if(t[s]!=="<")return{code:t,changed:!1,dynamic:!1};const n=h(t,s);if(n<0)return{code:t,changed:!1,dynamic:!1};if(z(i))return{code:t,changed:!1,dynamic:!1};const a=S(t,s,n),l=a.find(c=>c.name===i);if(!l){if(!r?.addIfMissing)return{code:t,changed:!1,dynamic:!1};const c=B(t,s,a);if(c)return{code:t.slice(0,c.at)+`
5
+ ${c.indent}${w(i,e)}`+t.slice(c.at),changed:!0,dynamic:!1};const d=t[n-1]==="/",f=d?n-1:n,k=/\s/.test(t[f-1]??"")?"":" ",R=d?" ":"";return{code:t.slice(0,f)+`${k}${w(i,e)}${R}`+t.slice(f),changed:!0,dynamic:!1}}if(!l.isLiteral)return{code:t,changed:!1,dynamic:!0};if(l.valueStart<0)return e==="true"?{code:t,changed:!1,dynamic:!1}:e!=="false"?{code:t,changed:!1,dynamic:!1}:{code:`${t.slice(0,l.attrStart)}${i}={false}${t.slice(l.attrEnd)}`,changed:!0,dynamic:!1};const u=U(l,e,r?.allowShapeUpgrade===!0);if(u===null)return{code:t,changed:!1,dynamic:!1};const o=t.slice(0,l.valueStart)+u+t.slice(l.valueEnd);return{code:o,changed:o!==t,dynamic:!1}}function Z(t,s,[i,e,r]){const n=f=>String(Number(f.toFixed(3))),a=h(t,s),l=a<0?void 0:S(t,s,a).find(f=>f.name==="position");if(!l)return y(t,s,"position",`[${n(i)}, ${n(e)}, ${n(r)}]`,{addIfMissing:!0}).code;if(!l.isLiteral||!p(l.rawValue))return t;const u=l.rawValue.replace(/^\s*\[|\]\s*$/g,"").split(",").map(f=>Number(f.trim()));if(u.length!==3||!u.every(f=>Number.isFinite(f)))return t;const[o,c,d]=u;return y(t,s,"position",`[${n(o+i)}, ${n(c+e)}, ${n(d+r)}]`).code}function X(t,s){let i=t,e=0;for(;e<i.length;){const r=i.indexOf("<",e);if(r<0||m(i,r)<0)break;i=Z(i,r,s);const n=m(i,r);if(n<=r)break;e=n+1}return i}export{S as a,m as b,G as c,h as f,p as i,Q as n,X as o,H as p,q as r,D as t};
@@ -0,0 +1 @@
1
+ import{setUserData as ee,getUserData as te,deleteUserData as ne}from"./user-data-BB2Of6Ht.js";import{attachAnimationRuntimeInspection as ie}from"./runtime-inspection-l2iFQSsg.js";import{collectMachineAnimationMeta as oe,clipNamesOf as P,isBlendTreeAnimationMeta as O,asBlendTreeDef as ae}from"./xstate-animation-meta-Q3u9zh_m.js";import{O as se,bn as re,bo as ce,bp as le,d as fe,bq as de,br as he,bs as me}from"./three.module-D396a9Mn.js";import"./object-marks-DwvIEBOK.js";import"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";class M extends Error{constructor(i,c){super(i),this.stateId=c,this.name="AnimationBindingError"}}function ue(n){const i=n.logic;if(i?.root)return i;const c=n.getSnapshot();if(c?.machine?.root)return c.machine;throw new M("[bindXStateAnimation] the actor exposes no state machine — only a state-machine actor carries the `meta.animation` this binder reads")}let _=0;const k=new Set;function Ne(n){return k.add(n),()=>k.delete(n)}function Xe(){return _}function q(){_++;for(const n of k)n()}const I=n=>n.layer??"base",E=n=>n.weight??1,R=n=>n.blendMode??"override";function U(n){try{return de.parseTrackName(n.name).nodeName??""}catch{const i=n.name.indexOf(".");return i<0?n.name:n.name.slice(0,i)}}function V(n,i,c){const o=new Set,f=[];for(const l of i){let m=!1;n.traverse(u=>{u.name===l&&(m=!0,u.traverse(d=>{d.name&&o.add(d.name)}))}),c.has(l)&&(m=!0,o.add(l)),m||f.push(l)}return{names:o,missing:f}}function pe(n,i,c,o){const f=new Set(n.tracks.map(U)),l=i.include?V(c,i.include,f):void 0,m=i.exclude?V(c,i.exclude,f):void 0,u=[...l?.missing??[],...m?.missing??[]];if(u.length)throw new M(`[bindXStateAnimation] state "${o}" boneMask names unknown bones/objects: ${u.join(", ")}`,o);const d=n.tracks.filter(p=>{const w=U(p);return(!l||l.names.has(w))&&!m?.names.has(w)});if(d.length===0)throw new M(`[bindXStateAnimation] state "${o}" boneMask removes every track from clip "${n.name}"`,o);return new fe(n.name,n.duration,d.map(p=>p.clone()))}function ge(n){return n.reduce((i,c)=>c.weight>i.weight?c:i,n[0])}function Le(n,i,c,o={}){const f=i.getRoot(),l=o.root??(f instanceof se?f:void 0);if(!l)throw new M("[bindXStateAnimation] a THREE.Object3D `root` option is required when the mixer uses AnimationObjectGroup");const m=o.owner??l,u=ue(n).root,d=oe(u),p=new Map(d.map(t=>[t.stateId,t.meta]));for(const t of d)for(const e of P(t.meta))if(!c.has(e))throw new M(`[bindXStateAnimation] state "${t.stateId}" references clip "${e}", which is not present in the supplied clips map. Known clips: ${[...c.keys()].join(", ")||"(none)"}`,t.stateId);const w=new Map;function S(t,e,s){return I(e)!=="base"||!!e.boneMask||R(e)==="additive"?`${t}\0${s}`:s}for(const{stateId:t,meta:e}of d)for(const s of P(e)){const a=S(t,e,s);if(w.has(a))continue;const r=c.get(s);let h=e.boneMask?pe(r,e.boneMask,l,t):r;(h!==r||a!==s)&&(h===r&&(h=r.clone()),h.name=`${r.name}@${I(e)}:${t}`),R(e)==="additive"?(re.makeClipAdditive(h),h.blendMode=ce):h.blendMode=le,w.set(a,h)}const g=new Map;function F(t,e,s,a){let r=g.get(t);if(!r){const h=w.get(t);if(!h)throw new M(`[bindXStateAnimation] prepared clip "${t}" not found`);const v=i.clipAction(h);v.setEffectiveWeight(0),v.play(),r={action:v,clip:h},g.set(t,r)}return r.action.setLoop(e?he:me,1/0),r.action.clampWhenFinished=!e,r.action.timeScale=s,r.action.weight=a,r.action}function N(t){const e=o.selectParameters?o.selectParameters(t):t;return new Map(Object.entries(e??{}))}function X(t,e,s){return(O(e)?we(ae(e.blendTree),N(s)):[{clip:e.clip,weight:1}]).map(({clip:r,weight:h})=>({clip:r,weight:h,actionKey:S(t,e,r)}))}const b=new Map;let K=!1,L=()=>{};function j(t,e,s){for(const a of t){if(a.actionKey===e)continue;const r=g.get(a.actionKey)?.action;r&&(s>0?r.fadeOut(s):r.setEffectiveWeight(0))}}function x(t,e){if(!O(t.meta))return;t.natural=X(t.stateId,t.meta,e);const s=E(t.meta);for(const a of t.natural)g.get(a.actionKey)?.action.setEffectiveWeight(a.weight*s)}function G(t,e,s){const a=I(e),r=b.get(a)??null,h=X(t,e,s),v=ge(h),J=O(e)?!0:e.loop,Q=O(e)?1:e.speed,W=E(e);for(const y of h)F(y.actionKey,J,Q,W);const $=g.get(v.actionKey).action;$.reset().setEffectiveWeight(W);for(const y of h)y.actionKey!==v.actionKey&&g.get(y.actionKey).action.reset().setEffectiveWeight(0);const A=e.crossfade?.duration??0,Z=e.crossfade?.warp??!1;if(!r)A>0&&$.fadeIn(A);else{j(r.natural,r.dominantActionKey,A);const y=g.get(r.dominantActionKey)?.action;y&&A>0?y.crossFadeTo($,A,Z):(y?.setEffectiveWeight(0),$.setEffectiveWeight(W))}const C={layer:a,stateId:t,meta:e,natural:h,dominantActionKey:v.actionKey,crossfadeRemaining:A};b.set(a,C),O(e)&&A<=0&&x(C,s)}function Y(t){return Object.keys(t.getMeta()).filter(e=>p.has(e))}function T(t){const e=new Map;for(const s of Y(t)){const a=p.get(s),r=I(a),h=e.get(r);if(h)throw new M(`[bindXStateAnimation] animated states "${h}" and "${s}" are both active on layer "${r}". Give parallel regions distinct meta.animation.layer names.`,s);e.set(r,s)}for(const[s,a]of b)e.has(s)||(j(a.natural,void 0,0),b.delete(s));for(const[s,a]of e)b.get(s)?.stateId!==a&&G(a,p.get(a),t.context)}const H=n.getSnapshot();T(H);const z=n.subscribe(t=>{K||T(t)});function B(t){if(K)return;const e=t,s=n.getSnapshot().context;for(const a of b.values())a.crossfadeRemaining>0?(a.crossfadeRemaining=Math.max(0,a.crossfadeRemaining-e),a.crossfadeRemaining<=0&&x(a,s)):x(a,s);i.update(e)}const D={tick:B,actor:n,getParameters:()=>N(n.getSnapshot().context),getActiveLayers:()=>[...b.values()].map(t=>({layer:t.layer,stateId:t.stateId,clips:t.natural.map(e=>e.clip),clipWeights:t.natural.map(e=>({clip:e.clip,weight:g.get(e.actionKey)?.action.getEffectiveWeight()??0})),weight:E(t.meta),blendMode:R(t.meta),...t.meta.boneMask?{boneMask:t.meta.boneMask}:{}})),dispose(){if(!K){K=!0,L(),o.systems?.remove("animation",B),z.unsubscribe();for(const{action:t,clip:e}of g.values())t.stop(),i.uncacheAction(e,t.getRoot());g.clear(),b.clear(),te(m,"_xstateAnimation")===D&&(ne(m,"_xstateAnimation"),q())}}};return L=ie(m,{mixer:i,clips:c}),ee(m,"_xstateAnimation",D),q(),o.systems?.add("animation",B),D}function we(n,i){switch(n.type){case"1D":return be(n,i);case"2D":return ye(n,i);case"direct":return ve(n);default:return n.children.map(c=>({clip:c.clip,weight:1/n.children.length}))}}function be(n,i){const c=Number(i.get(n.parameter)??0),o=[...n.children].sort((l,m)=>l.threshold-m.threshold),f=o.map(l=>({clip:l.clip,weight:0}));if(o.length===0)return f;if(o.length===1||c<=o[0].threshold)return f[0].weight=1,f;if(c>=o[o.length-1].threshold)return f[f.length-1].weight=1,f;for(let l=0;l<o.length-1;l++){const m=o[l],u=o[l+1];if(c>=m.threshold&&c<=u.threshold){const d=u.threshold-m.threshold,p=d>0?(c-m.threshold)/d:0;return f[l].weight=1-p,f[l+1].weight=p,f}}return f}function ye(n,i){const c=Number(i.get(n.parameter)??0),o=Number(i.get(n.parameterY??"")??0),f=n.children,l=f.map(d=>({clip:d.clip,weight:0}));let m=0;const u=[];for(const d of f){const p=c-d.threshold,w=o-(d.thresholdY??0),S=Math.sqrt(p*p+w*w),g=S<.001?1e3:1/S;u.push(g),m+=g}if(m>0)for(let d=0;d<l.length;d++)l[d].weight=u[d]/m;return l}function ve(n){const i=n.children.map(o=>({clip:o.clip,weight:o.weight??0})),c=i.reduce((o,f)=>o+f.weight,0);if(c>0)for(const o of i)o.weight/=c;return i}export{M as AnimationBindingError,Le as bindXStateAnimation,we as evaluateBlendTree,Xe as getXStateAnimationBindingsVersion,ue as machineOfXStateActor,Ne as subscribeXStateAnimationBindings};