@volter/game-editor 0.5.67 → 0.5.68

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 (357) hide show
  1. package/BUNDLED_NOTICES +20 -20
  2. package/catalog/entries/blender.json +1 -1
  3. package/catalog/entries/music.json +3 -3
  4. package/catalog/project-source/src/lib/music/music-player.ts +18 -12
  5. package/dist/.vite/manifest.json +2307 -2166
  6. package/dist/assets/{AssetBudgetPanel-x_FNJbfZ.js → AssetBudgetPanel-P2PeL_X5.js} +9 -9
  7. package/dist/assets/{AudioViewer-BDPqHDfU.js → AudioViewer-xFb5Wv7A.js} +1 -1
  8. package/dist/assets/CanvasBoardDocument-BFJdTVGp.js +1 -0
  9. package/dist/assets/CanvasSceneViewport-vqBlOz8P.js +1 -0
  10. package/dist/assets/{ColorInput-QUPS1pEB.js → ColorInput-CX1UZjYO.js} +1 -1
  11. package/dist/assets/{EntityModelDocument-CzUHsH9E.js → EntityModelDocument-Du8wIbyK.js} +1 -1
  12. package/dist/assets/{EnvironmentAssetDocument-ByEB7_4A.js → EnvironmentAssetDocument-_SttfMY_.js} +1 -1
  13. package/dist/assets/{GameplaySessionTimeline-dhG-oiqd.js → GameplaySessionTimeline-CWudWnfd.js} +1 -1
  14. package/dist/assets/{ImageViewer-tlVvkdM4.js → ImageViewer-shZzMd91.js} +1 -1
  15. package/dist/assets/InspectorObjectPreview-BMOvJaOw.js +1 -0
  16. package/dist/assets/{JsonAssetDocument-CPmcWFPW.js → JsonAssetDocument-D_HXneWE.js} +1 -1
  17. package/dist/assets/{LiveModuleDocument-DL8QHSlk.js → LiveModuleDocument-BWjOzO_6.js} +1 -1
  18. package/dist/assets/{LutAssetDocument-BImiug2M.js → LutAssetDocument-DIc6nsht.js} +1 -1
  19. package/dist/assets/ModelAssetDocument-_CqTsX_A.js +1 -0
  20. package/dist/assets/{NonThreeAuthoringBootstrap-B40qmGGS.js → NonThreeAuthoringBootstrap-C-V23E1e.js} +1 -1
  21. package/dist/assets/Object3DDocumentToolbar-BfPH9jz5.js +1 -0
  22. package/dist/assets/Object3DDocumentViewport-BaXWtATg.js +2 -0
  23. package/dist/assets/{Object3DPreview-ClYDoH2L.js → Object3DPreview-BPHEr3vI.js} +1 -1
  24. package/dist/assets/OnlineAssetDetail-BxibUH6K.js +1 -0
  25. package/dist/assets/PlayBar-DRANyO01.js +1 -0
  26. package/dist/assets/{QuarksAssetDocument-B-VOj-n4.js → QuarksAssetDocument-4Dne3EHx.js} +1 -1
  27. package/dist/assets/ReactCanvasControls-K98jOX9b.js +1 -0
  28. package/dist/assets/RootSelectionOverlay-BQC12Gdd.js +1 -0
  29. package/dist/assets/{ShaderAssetDocument-Kn8IvRGV.js → ShaderAssetDocument-W3ZjLCkt.js} +4 -4
  30. package/dist/assets/ShadowEditor-DP1LWynl.js +1 -0
  31. package/dist/assets/{SourceAssetViewer-CLQ95VSD.js → SourceAssetViewer-BGUeDAEv.js} +1 -1
  32. package/dist/assets/StageHost-V_0opXFt.js +2 -0
  33. package/dist/assets/{StoryPreviewMount-D2lg37et.js → StoryPreviewMount-Di8uMovM.js} +1 -1
  34. package/dist/assets/{ThreeBoardDocument-BAgHrbtu.js → ThreeBoardDocument-tgcaZDqQ.js} +2 -2
  35. package/dist/assets/{ThreeIsolationSceneContent-DbYIylZQ.js → ThreeIsolationSceneContent-BAKurKW5.js} +1 -1
  36. package/dist/assets/{ToolObject3DPreview-WEi6C9uU.js → ToolObject3DPreview-CffvGJ1h.js} +1 -1
  37. package/dist/assets/Toolbar-uLgsrB2z.js +1 -0
  38. package/dist/assets/{TransientHint-BpDLhRLd.js → TransientHint-CgmkrmKF.js} +1 -1
  39. package/dist/assets/{VideoViewer-DMV8lf4P.js → VideoViewer-ClUJ6_uy.js} +1 -1
  40. package/dist/assets/ViewportShadingMenu-Bdkc6jcd.js +1 -0
  41. package/dist/assets/{active-ingest-DA426a81.js → active-ingest-CnAeQcuQ.js} +3 -3
  42. package/dist/assets/{animation-clock-Bm80XdqP.js → animation-clock-fLmY_3--.js} +1 -1
  43. package/dist/assets/{animation-mixers.service-DK64IuYq.js → animation-mixers.service-DiecMX_A.js} +1 -1
  44. package/dist/assets/{animation-timeline.utility-D-g0zrOl.js → animation-timeline.utility-C71vPJgs.js} +1 -1
  45. package/dist/assets/{asset-budget-asset.menu-CEgP0Kiw.js → asset-budget-asset.menu-BDRDWrvx.js} +1 -1
  46. package/dist/assets/{asset-budget.action-D4R1c3wi.js → asset-budget.action-tQmNGQHC.js} +1 -1
  47. package/dist/assets/{asset-budget.document-Syzjn1U1.js → asset-budget.document-BthgX37Z.js} +1 -1
  48. package/dist/assets/{asset-budget.menu-BbRiqXeM.js → asset-budget.menu-DfyWVH6p.js} +1 -1
  49. package/dist/assets/{asset-editor-persistence-BGWIqZdk.js → asset-editor-persistence-BQgjOCrm.js} +1 -1
  50. package/dist/assets/{asset-loaders-C0KQI5eY.js → asset-loaders-5PIUVvmH.js} +1 -1
  51. package/dist/assets/{asset-preview-B1tDziF1.js → asset-preview-Cv7tfD98.js} +1 -1
  52. package/dist/assets/{audio-unlock.service-ucMfCVBw.js → audio-unlock.service-BvHvZjzx.js} +1 -1
  53. package/dist/assets/{audio.utility-BmE9WMUg.js → audio.utility-D9Vk_WYS.js} +1 -1
  54. package/dist/assets/autoplay.service-CFJoLPLw.js +1 -0
  55. package/dist/assets/{babylon-authoring-adapter-C8mFMXSr.js → babylon-authoring-adapter-Cg5ALSpr.js} +1 -1
  56. package/dist/assets/binding-resolver-C_9MBSMa.js +2 -0
  57. package/dist/assets/{blender-node-editor.document-C1YmwWls.js → blender-node-editor.document-B92MO51u.js} +1 -1
  58. package/dist/assets/{blender-properties-tab-B8lyjgj3.js → blender-properties-tab-CDVyDAbf.js} +1 -1
  59. package/dist/assets/{blender-runtime-host-CyQlImSR.js → blender-runtime-host-CuniE0sy.js} +1 -1
  60. package/dist/assets/{blender-runtime-skin-BK7ShZ6z.js → blender-runtime-skin-B_tOz5j5.js} +1 -1
  61. package/dist/assets/{blender-runtime.document-B0nVQs0P.js → blender-runtime.document-DxUwLiEW.js} +1 -1
  62. package/dist/assets/{blender-timeline.document-CMcdE2CK.js → blender-timeline.document-BdEEoQbK.js} +1 -1
  63. package/dist/assets/{blender-uv-editor.document-CjqNo4sZ.js → blender-uv-editor.document-EMSUlRh4.js} +1 -1
  64. package/dist/assets/{blender-version.status-OsFoc9SA.js → blender-version.status-DtfwUahB.js} +1 -1
  65. package/dist/assets/{blender.command-C6NmRBo5.js → blender.command-BkBML2SY.js} +1 -1
  66. package/dist/assets/blender.keymap-BmOBRY7p.js +1 -0
  67. package/dist/assets/{board-guides-BEKPgD9M.js → board-guides-_3R1t_-2.js} +1 -1
  68. package/dist/assets/bridge.command-VnplZ81v.js +3 -0
  69. package/dist/assets/{browserAll-lF_dLQVz.js → browserAll-BCmkqg8n.js} +1 -1
  70. package/dist/assets/build-player.document-DV7YcJQt.js +1 -0
  71. package/dist/assets/build-profiles.document-CZxDuhzz.js +2 -0
  72. package/dist/assets/{build-progress.status-Bo1ZgJcb.js → build-progress.status-Dk5u3C67.js} +1 -1
  73. package/dist/assets/build-session-BGe0eGrQ.js +9 -0
  74. package/dist/assets/{build.action-DRX2IcYt.js → build.action-Bdj4ZEL_.js} +1 -1
  75. package/dist/assets/{build.command-BGvLaLG0.js → build.command-DAWiYvPa.js} +1 -1
  76. package/dist/assets/build.header--xqH6uTP.js +1 -0
  77. package/dist/assets/{build.menu-UenrjPWS.js → build.menu-BiRNC_xc.js} +1 -1
  78. package/dist/assets/{build.service-BIUoTY6l.js → build.service-Dw9K6VSF.js} +1 -1
  79. package/dist/assets/{camera-DrvaM47S.js → camera-C-qXzXFf.js} +1 -1
  80. package/dist/assets/{camera-runtime.inspector-CjJALNO8.js → camera-runtime.inspector-BDrwWRlU.js} +1 -1
  81. package/dist/assets/canvas-design-mount-DLn49Zle.js +6 -0
  82. package/dist/assets/canvas-entry-runtime-DVeh71nC.js +2 -0
  83. package/dist/assets/{canvas-preview-frames-C0QTagA3.js → canvas-preview-frames-B5xFRjhQ.js} +1 -1
  84. package/dist/assets/{canvas-story-capture.service-Dgjr-rT1.js → canvas-story-capture.service-DQ_leYyi.js} +2 -2
  85. package/dist/assets/{capability-coverage-DZ-onC5j.js → capability-coverage-DQgg6UJe.js} +3 -3
  86. package/dist/assets/{collaboration-presence-BVIQuN1l.js → collaboration-presence-BOS1t8wI.js} +1 -1
  87. package/dist/assets/{collider-C7SbIYKY.js → collider-Bf4Uk6LW.js} +1 -1
  88. package/dist/assets/{component-board.service-CWFaGMCO.js → component-board.service-CpVXGhz5.js} +2 -2
  89. package/dist/assets/{component-board.service-BEsFAw4_.js → component-board.service-DFSSCaCf.js} +2 -2
  90. package/dist/assets/{component-board.service-q_TM9BCw.js → component-board.service-DgujG90T.js} +2 -2
  91. package/dist/assets/{component-contracts.service-CPbfXE1h.js → component-contracts.service-Bc_2Xxh_.js} +1 -1
  92. package/dist/assets/{component-instance-root-B0C5oNEm.js → component-instance-root-df4ofoOR.js} +1 -1
  93. package/dist/assets/{component-verbs.command-oNtGgzQL.js → component-verbs.command-DGzZAV_Z.js} +1 -1
  94. package/dist/assets/component-verbs.service-D1rVRogp.js +1 -0
  95. package/dist/assets/{config-_wCzzlM_.js → config-D-EAAhqP.js} +4 -4
  96. package/dist/assets/{configurations-BXU4GGbV.js → configurations-_HZOWZPy.js} +1 -1
  97. package/dist/assets/{connection.status-Yvt0bX0r.js → connection.status-CCX-mgmr.js} +1 -1
  98. package/dist/assets/{constraints.inspector-4r8jWq5a.js → constraints.inspector-CwEEREsf.js} +1 -1
  99. package/dist/assets/{content-bounds-BeuIXKYu.js → content-bounds-DKBD7nsv.js} +1 -1
  100. package/dist/assets/{contract-system-adapters-Bic_7sev.js → contract-system-adapters-h6OUBRYA.js} +1 -1
  101. package/dist/assets/{coverage.service-DcpEoBuf.js → coverage.service-CV7b5Sqn.js} +2 -2
  102. package/dist/assets/create-runtime-Bg2uYMfh.js +3 -0
  103. package/dist/assets/{curve-DVd18iAX.js → curve-BKuiAPpj.js} +1 -1
  104. package/dist/assets/{data-asset-DfQ2Pjse.js → data-asset-7Nfmx-28.js} +1 -1
  105. package/dist/assets/{data-ref-CWnkj-HX.js → data-ref-DyFQqqX6.js} +1 -1
  106. package/dist/assets/debug-bridge-CESAxmlz.js +1 -0
  107. package/dist/assets/{debug-registry-P0_YQGWd.js → debug-registry-l7k5Hjc8.js} +1 -1
  108. package/dist/assets/{deferred-ingest-play-BdR4qGk6.js → deferred-ingest-play-Bej67_y9.js} +2 -2
  109. package/dist/assets/{design-time-canvas-mount-DPQeHSN2.js → design-time-canvas-mount-CFW9ZWuk.js} +2 -2
  110. package/dist/assets/{design-time-layers-ChswRUJt.js → design-time-layers-CQgnmqc8.js} +1 -1
  111. package/dist/assets/{design-time-mount.service-Ks-5Wkcs.js → design-time-mount.service-DJeAPUB_.js} +2 -2
  112. package/dist/assets/{design-time-mount.service-Ca-DZGFV.js → design-time-mount.service-_R1UDCw3.js} +2 -2
  113. package/dist/assets/{design-time-react-mount-C85KfXOd.js → design-time-react-mount-CFvIk_rV.js} +1 -1
  114. package/dist/assets/{document-preview-three-DThkjI1S.js → document-preview-three-5cbuuJMH.js} +1 -1
  115. package/dist/assets/{dom-authoring-adapter-BrLU8IJ_.js → dom-authoring-adapter-CoESNvrM.js} +1 -1
  116. package/dist/assets/{draco3d-B2cwv46o.js → draco3d-Sk9K4AUT.js} +1 -1
  117. package/dist/assets/{edit-mode-audio.service-D4ITNbsm.js → edit-mode-audio.service-CH6J-8N7.js} +1 -1
  118. package/dist/assets/{edit-mode-authoring-DeCxPcHM.js → edit-mode-authoring-DBjaBTxM.js} +1 -1
  119. package/dist/assets/{edit-mode-networking.service-BNv-FTRh.js → edit-mode-networking.service-C4o2pGHX.js} +1 -1
  120. package/dist/assets/editor-api-D2azVray.js +1 -0
  121. package/dist/assets/{editor-layers-BDJnAAzj.js → editor-layers-B4oYfpj8.js} +1 -1
  122. package/dist/assets/{editor-shell-store-ChLcVeNB.js → editor-shell-store-Bh1S7M54.js} +1 -1
  123. package/dist/assets/{entity-object-JmYMfLsx.js → entity-object-B_5Gc0Ky.js} +1 -1
  124. package/dist/assets/{extend-Cc-nEa_A.js → extend-DcEyE5jI.js} +1 -1
  125. package/dist/assets/fork-menu-CKjNh3MO.js +1 -0
  126. package/dist/assets/{frame-debugger-store-DaCbAYSW.js → frame-debugger-store-D5YViF_8.js} +1 -1
  127. package/dist/assets/{game-contract-seams-BnPFGLll.js → game-contract-seams-C0AVYwvO.js} +1 -1
  128. package/dist/assets/{game-css-scope-transform-D_p7cVgW.js → game-css-scope-transform-8GOvVu1s.js} +1 -1
  129. package/dist/assets/game-document.service-FdG_gFPU.js +1 -0
  130. package/dist/assets/game-eval.command-4wa9vqWE.js +2 -0
  131. package/dist/assets/{game-module-access-o3iXZpCA.js → game-module-access-DulnT3NH.js} +1 -1
  132. package/dist/assets/game-network-Bo_nlDR5.js +22 -0
  133. package/dist/assets/{gameplay-export-BzYzLZPi.js → gameplay-export-K5AcStVC.js} +1 -1
  134. package/dist/assets/{gameplay-replay-BwdxV4oF.js → gameplay-replay-CnWnlogY.js} +1 -1
  135. package/dist/assets/gameplay.command-DoWqBWhH.js +1 -0
  136. package/dist/assets/{generation-jobs-BZhOMrp-.js → generation-jobs-CiabIfR0.js} +1 -1
  137. package/dist/assets/generation.service-D2yeZaJu.js +1 -0
  138. package/dist/assets/{generations-DVDht_31.js → generations-DU9rCeQR.js} +1 -1
  139. package/dist/assets/{generations.status-BvzgHlyk.js → generations.status-3CrPw_n5.js} +1 -1
  140. package/dist/assets/{hierarchy-marks-Cc_3lxw6.js → hierarchy-marks-C25dY2fR.js} +1 -1
  141. package/dist/assets/{hosted-asset-materialization-BpbnhJac.js → hosted-asset-materialization-DYdcFlDf.js} +1 -1
  142. package/dist/assets/{index-0Lm0Nf1M.css → index-B5WjeCHm.css} +1 -1
  143. package/dist/assets/{index-C1c3eOmm.js → index-BcH5GC3b.js} +1 -1
  144. package/dist/assets/{index-cNc-iFbq.js → index-BsYc2Oyj.js} +1 -1
  145. package/dist/assets/{index-SS9EugVg.js → index-C20Flc1s.js} +2 -2
  146. package/dist/assets/{index-Ck3JFh48.js → index-C4AUQbmq.js} +1 -1
  147. package/dist/assets/{index-DUZeuA7g.js → index-CC1puVjo.js} +1 -1
  148. package/dist/assets/{index-BRJMIUK0.js → index-CaG87ZF-.js} +321 -321
  149. package/dist/assets/index-CwCDkEl1.js +1 -0
  150. package/dist/assets/{index-C3Pw-9So.js → index-Kb9_s5aP.js} +1 -1
  151. package/dist/assets/{index-BeK4RPgj.js → index-n3QdTv-T.js} +1 -1
  152. package/dist/assets/{inference-diagnostics-xecGdohW.js → inference-diagnostics-MGcIHEX6.js} +1 -1
  153. package/dist/assets/{ingest-boot-viewport-DAt8WFSy.js → ingest-boot-viewport-D2okO6JI.js} +1 -1
  154. package/dist/assets/ingest-siblings-CkxW__go.js +1 -0
  155. package/dist/assets/{ingest-source-persistence-Dmdo-UBp.js → ingest-source-persistence-6peGfPAS.js} +1 -1
  156. package/dist/assets/{ingest.service-vbCucMz7.js → ingest.service-Cc73WMIW.js} +1 -1
  157. package/dist/assets/{inspect-Dr4qvDpJ.js → inspect-C8RP8G5F.js} +1 -1
  158. package/dist/assets/instances.command-CxKGnrNl.js +1 -0
  159. package/dist/assets/{json-history-resource-DwS10tqD.js → json-history-resource-CTXRV4GD.js} +1 -1
  160. package/dist/assets/layered-pick-B_-BRrRD.js +1 -0
  161. package/dist/assets/{light-DcFqVCmv.js → light-CskDQ8gF.js} +1 -1
  162. package/dist/assets/{live-project-verbs-C3LzprCe.js → live-project-verbs-BOAQN3ME.js} +1 -1
  163. package/dist/assets/{machine.document-BzZxubYQ.js → machine.document-BxOoCOo9.js} +1 -1
  164. package/dist/assets/{machines.finder-BR02bfVG.js → machines.finder-CqEceWzS.js} +1 -1
  165. package/dist/assets/{material-B_V78pTt.js → material-BwFzKPi0.js} +1 -1
  166. package/dist/assets/{material-factory-COz7qZhC.js → material-factory-qB9pzcQf.js} +1 -1
  167. package/dist/assets/{mesh-DcmO-mWI.js → mesh-5--4qA-C.js} +1 -1
  168. package/dist/assets/model-asset-sections.service-TZ2SaBmH.js +1 -0
  169. package/dist/assets/{model-inspection-CXHxrafK.js → model-inspection-MrJY0U_-.js} +1 -1
  170. package/dist/assets/{model-thumbnail-BEKPWg4l.js → model-thumbnail-uk-2sblh.js} +1 -1
  171. package/dist/assets/{models.finder-c1I0tp2M.js → models.finder-rk8dhgO8.js} +1 -1
  172. package/dist/assets/module-mode-B79jV5tQ.js +2 -0
  173. package/dist/assets/mount-canvas-ingest-root-BhaYNuhY.js +2 -0
  174. package/dist/assets/mount-dom-ingest-root-BQb1u0LX.js +2 -0
  175. package/dist/assets/mount-ingest-root-BC3-1Cw1.js +2 -0
  176. package/dist/assets/mount-manifest-QJOB11Kv.js +1 -0
  177. package/dist/assets/{mount-three-ingest-root-DVbACDUy.js → mount-three-ingest-root-DIDBfvIH.js} +1 -1
  178. package/dist/assets/{mounted-authoring-Clftxx0x.js → mounted-authoring-B7RL_V28.js} +1 -1
  179. package/dist/assets/{mounted-story-viewport-source-B4-eAYGI.js → mounted-story-viewport-source-CnYhX3vW.js} +1 -1
  180. package/dist/assets/{native-debug-module-2_HVupdg.js → native-debug-module-B-rWJfWE.js} +1 -1
  181. package/dist/assets/{navigation-CH3-zr1n.js → navigation-BVu-aVmF.js} +1 -1
  182. package/dist/assets/{navmesh.menu-Dfi-Pk-8.js → navmesh.menu-C3M63eR4.js} +1 -1
  183. package/dist/assets/{navmesh.service-Cz7QFY-M.js → navmesh.service-B0H1fUfn.js} +1 -1
  184. package/dist/assets/network-observer.service-CiR4Q9Q0.js +1 -0
  185. package/dist/assets/network.utility-CNG3eJ0E.js +1 -0
  186. package/dist/assets/{object3d-document-session-registry-DJDEDM0p.js → object3d-document-session-registry-OjqzJ86S.js} +2 -2
  187. package/dist/assets/{oid-transform-D5Kxt6ij.js → oid-transform-Bzc2ZJSH.js} +1 -1
  188. package/dist/assets/{particles-vRp0Lf3o.js → particles-Be7AvO4c.js} +1 -1
  189. package/dist/assets/pixi-authoring-adapter-B42K4md-.js +1 -0
  190. package/dist/assets/{pixi-live-write-target-BjDsBQbp.js → pixi-live-write-target-D56tQEe_.js} +1 -1
  191. package/dist/assets/play.command-CIGRq8ow.js +2 -0
  192. package/dist/assets/presentation-DGBuGP6i.js +1 -0
  193. package/dist/assets/{product-CxmUIxmr.js → product-BN31wSnB.js} +1 -1
  194. package/dist/assets/{profiler.action-Dzy9DuAc.js → profiler.action-D57Kj9ym.js} +1 -1
  195. package/dist/assets/{profiler.menu-jLDO3U6N.js → profiler.menu-Dh9Q5DDx.js} +1 -1
  196. package/dist/assets/{profiler.utility-Do2Bw7MY.js → profiler.utility-DLNySW3w.js} +1 -1
  197. package/dist/assets/{project-authoring-session-C3eusefK.js → project-authoring-session-LCJAwGrD.js} +2 -2
  198. package/dist/assets/{properties-bone-constraints.inspector-B_PbSMV7.js → properties-bone-constraints.inspector-CaIDq5nN.js} +1 -1
  199. package/dist/assets/{properties-bone.inspector-CMDEQuBd.js → properties-bone.inspector-D2fcQGMF.js} +1 -1
  200. package/dist/assets/{properties-collection.inspector-D7Ay8yRj.js → properties-collection.inspector-CF5AtTAd.js} +1 -1
  201. package/dist/assets/{properties-constraints.inspector-DS1fZgXK.js → properties-constraints.inspector-Bj2itDrS.js} +1 -1
  202. package/dist/assets/{properties-data.inspector-k2pGN2Mp.js → properties-data.inspector-BfRqk0Xo.js} +1 -1
  203. package/dist/assets/{properties-material.inspector-Bb3yAGUx.js → properties-material.inspector-Bf8H0mvu.js} +1 -1
  204. package/dist/assets/{properties-modifiers.inspector-BcJfe-Wy.js → properties-modifiers.inspector-BKShc1TH.js} +1 -1
  205. package/dist/assets/{properties-object.inspector-CUSfXJuq.js → properties-object.inspector-YBh8ABnN.js} +1 -1
  206. package/dist/assets/{properties-output.inspector-BTVW2kn1.js → properties-output.inspector-CVkzfs-l.js} +1 -1
  207. package/dist/assets/{properties-particles.inspector-Cw0fxx3B.js → properties-particles.inspector-ChDpAq-2.js} +1 -1
  208. package/dist/assets/{properties-physics.inspector-C-0bD2bu.js → properties-physics.inspector-BLEM7aMj.js} +1 -1
  209. package/dist/assets/{properties-render.inspector-C8D5UpjX.js → properties-render.inspector-vU4D9xLL.js} +1 -1
  210. package/dist/assets/{properties-scene.inspector-HjK6QHGg.js → properties-scene.inspector-C-DoN-kL.js} +1 -1
  211. package/dist/assets/{properties-texture.inspector-CckZgUaI.js → properties-texture.inspector-DySxy1oU.js} +1 -1
  212. package/dist/assets/{properties-view-layer.inspector-C1ajtVSk.js → properties-view-layer.inspector-DEKxMahJ.js} +1 -1
  213. package/dist/assets/{properties-world.inspector-BiT_EdT-.js → properties-world.inspector-m5qL_TQV.js} +1 -1
  214. package/dist/assets/r3f-design-session-C0DPEChS.js +2 -0
  215. package/dist/assets/{r3f-physics-binding-DzrbpqjM.js → r3f-physics-binding-Bgzzd4ol.js} +1 -1
  216. package/dist/assets/{r3f-source-authoring-adapter-DbbeRcvt.js → r3f-source-authoring-adapter-C8oMjdTL.js} +2 -2
  217. package/dist/assets/{react-canvas-navigation-Cp3cOHJa.js → react-canvas-navigation-Jowa_lJq.js} +1 -1
  218. package/dist/assets/react-inspector.service-TfTdj_Qk.js +1 -0
  219. package/dist/assets/{react-story-board-GaXqr03H.js → react-story-board-Bx7qYytV.js} +1 -1
  220. package/dist/assets/{react-three-rapier.esm-U8J7g6tH.js → react-three-rapier.esm-BR2ttgLS.js} +1 -1
  221. package/dist/assets/{react-world-authoring-adapter-DOjv2pYm.js → react-world-authoring-adapter-C1jPW_cN.js} +1 -1
  222. package/dist/assets/{realm-services-CnY105XU.js → realm-services-DefTrXnY.js} +1 -1
  223. package/dist/assets/{reflection-probe-capture.inspector-DqSW9p1v.js → reflection-probe-capture.inspector-C-6zrzZb.js} +1 -1
  224. package/dist/assets/{registry-CaCdF63N.js → registry-Z28XSZHF.js} +1 -1
  225. package/dist/assets/{relative-import-specifier-BFKIWEWs.js → relative-import-specifier-DQzkawgj.js} +1 -1
  226. package/dist/assets/{render-env-BkKZ4uMA.js → render-env-BZ7LsGfk.js} +1 -1
  227. package/dist/assets/{render-features-rxbawsRb.js → render-features-C7QwmhCo.js} +1 -1
  228. package/dist/assets/{render-settings-DS5leCed.js → render-settings-BBvkacR3.js} +1 -1
  229. package/dist/assets/{resolve-three-CVnMRHxw.js → resolve-three-C7zDbK29.js} +9 -9
  230. package/dist/assets/{root-seam-contract-CxLZaRio.js → root-seam-contract-rGNbiX6q.js} +1 -1
  231. package/dist/assets/run-selection-BUeubtHj.js +2 -0
  232. package/dist/assets/{scene-capture-0a-bTjT8.js → scene-capture-BTWgUzhI.js} +1 -1
  233. package/dist/assets/{scene-document.service-CeDwVA7t.js → scene-document.service-DJJp-la1.js} +2 -2
  234. package/dist/assets/{scene-framing-BQt72ZCw.js → scene-framing-PVMqGU8h.js} +1 -1
  235. package/dist/assets/{seeded-random-BgCwIAAU.js → seeded-random-38To73fI.js} +1 -1
  236. package/dist/assets/{setup-renderer-Cwkl1Ar6.js → setup-renderer-OOw1SykJ.js} +1 -1
  237. package/dist/assets/{source-object3d-authoring-adapter-DF679Ncb.js → source-object3d-authoring-adapter-RmutT5Dt.js} +1 -1
  238. package/dist/assets/{source-persistence-backend-CwLYVPXj.js → source-persistence-backend-HviqjKZ2.js} +1 -1
  239. package/dist/assets/{stage-keyboard-B8BEW592.js → stage-keyboard-DDi7S27C.js} +1 -1
  240. package/dist/assets/stage-overlay-set-olkNSZmq.js +1 -0
  241. package/dist/assets/{stage-presence-markers-DIP7YMcO.js → stage-presence-markers-cznMN_qq.js} +1 -1
  242. package/dist/assets/stage-transform-tools-BDUZqRIR.js +1 -0
  243. package/dist/assets/{standard-viewport-dressing-BCA51Tum.js → standard-viewport-dressing-BZyuxyVl.js} +1 -1
  244. package/dist/assets/{state-watch.action-DnR5Zjr-.js → state-watch.action-DEdb1mNa.js} +1 -1
  245. package/dist/assets/{state-watch.menu-wYLCLsAw.js → state-watch.menu-jWbUM3kw.js} +1 -1
  246. package/dist/assets/{state-watch.utility-CFG1Tu1m.js → state-watch.utility-DDmn3G25.js} +1 -1
  247. package/dist/assets/{story-capture-BmnwHGDV.js → story-capture-Dj1xkeKH.js} +1 -1
  248. package/dist/assets/{story-documents-BTo90DiA.js → story-documents-8ehMyYHo.js} +2 -2
  249. package/dist/assets/{story-documents.service-yagl1wGp.js → story-documents.service-BzQCuNBu.js} +1 -1
  250. package/dist/assets/{story-documents.service-B6v7Z-WE.js → story-documents.service-iNP-ORNr.js} +1 -1
  251. package/dist/assets/{story-media-presence-BqRMu572.js → story-media-presence-zTPlU9HR.js} +1 -1
  252. package/dist/assets/{story-pixi-preview-Da6afqLg.js → story-pixi-preview-B7THvSl7.js} +1 -1
  253. package/dist/assets/{story-presentation-DMSYRWaz.js → story-presentation-BLXYPadR.js} +1 -1
  254. package/dist/assets/{story-three-preview-R1JvrggS.js → story-three-preview-B1nNiPwP.js} +2 -2
  255. package/dist/assets/{studio-environment-DRxxq_QX.js → studio-environment-yaKaHPxH.js} +1 -1
  256. package/dist/assets/{surface-state-1lTOi8FD.js → surface-state-D9j6qNu8.js} +1 -1
  257. package/dist/assets/{syntactic-prop-specs-eiQXwMIc.js → syntactic-prop-specs-BTnsMOvH.js} +1 -1
  258. package/dist/assets/team-playtest.service-Ds9tkO4q.js +1 -0
  259. package/dist/assets/{three-authoring-adapter-htbnVej2.js → three-authoring-adapter-BrkGH4cd.js} +1 -1
  260. package/dist/assets/three-authoring.service-DoamZDMx.js +2 -0
  261. package/dist/assets/{three-ingest-runtime-B7rtg3QE.js → three-ingest-runtime-CXKjNysA.js} +1 -1
  262. package/dist/assets/{three-integration-BdN5Nhsg.js → three-integration-CuAnYaTW.js} +2 -2
  263. package/dist/assets/three-integration.service-Db-VabIm.js +1 -0
  264. package/dist/assets/{three-TCuY32m_.js → three-oYrcK5SQ.js} +1 -1
  265. package/dist/assets/{three-projection-core-CG01r5Ta.js → three-projection-core-jBJVt6O0.js} +1 -1
  266. package/dist/assets/{three-state-DwFE3ay2.js → three-state-wXRU3rLr.js} +1 -1
  267. package/dist/assets/{three-story-capture.service-CvpV3v5a.js → three-story-capture.service-DMJRcqjr.js} +2 -2
  268. package/dist/assets/{three-story-model-C2r2BuiA.js → three-story-model-DgiAP-oQ.js} +1 -1
  269. package/dist/assets/{three-viewport-presentation-B0z_cECu.js → three-viewport-presentation-CgO3eWJ-.js} +1 -1
  270. package/dist/assets/transform-mode-request-BnKpgRUW.js +1 -0
  271. package/dist/assets/transport-strip-a9yLoPsI.js +1 -0
  272. package/dist/assets/transport.header-CpfoppXc.js +1 -0
  273. package/dist/assets/{tuples-DfWSY2tr.js → tuples-CKsHOV9T.js} +1 -1
  274. package/dist/assets/ui-board-document-DtTR_mBr.js +2 -0
  275. package/dist/assets/{user-data-Bpj7diUS.js → user-data-CqOoAowZ.js} +1 -1
  276. package/dist/assets/{utility-view-state-CAfbFbKQ.js → utility-view-state-Db97zwDz.js} +1 -1
  277. package/dist/assets/{viewport-door-Bj_ZIP85.js → viewport-door-DVkMQazS.js} +1 -1
  278. package/dist/assets/{viewport-root-presentation-vgxsTyj4.js → viewport-root-presentation-B35t51xX.js} +1 -1
  279. package/dist/assets/{viewport-surface-status-cwCiBGa7.js → viewport-surface-status-D5kZtFW5.js} +1 -1
  280. package/dist/assets/{webworkerAll-Cm3gTjWi.js → webworkerAll-CfKEb4Ao.js} +1 -1
  281. package/dist/assets/{workspace-arrangement-BdAlBwvd.js → workspace-arrangement-DIMM7ska.js} +1 -1
  282. package/dist/assets/world-documents-C4t3iOD-.js +1 -0
  283. package/dist/assets/world-root-stage-binding-ydl3JN1a.js +1 -0
  284. package/dist/assets/{xstate-animation-binding-BGLxcZT_.js → xstate-animation-binding-aQEmNSpm.js} +1 -1
  285. package/dist/assets/{xstate-animation-meta-D_T441Ru.js → xstate-animation-meta-CnMX1Sc1.js} +1 -1
  286. package/dist-node/cli.js +29 -24
  287. package/dist-node/create.js +14 -9
  288. package/package.json +18 -16
  289. package/template/.agents/skills/vgai-music/SKILL.md +28 -4
  290. package/template/package.json +13 -11
  291. package/template/src/input.ts +1 -1
  292. package/template/src/main.ts +74 -3
  293. package/dist/assets/CanvasBoardDocument-mxL0oJ3N.js +0 -1
  294. package/dist/assets/CanvasSceneViewport-C_mapCwC.js +0 -1
  295. package/dist/assets/InspectorObjectPreview-W-y079DS.js +0 -1
  296. package/dist/assets/ModelAssetDocument-De1HKuxG.js +0 -1
  297. package/dist/assets/Object3DDocumentToolbar-Cks81kCS.js +0 -1
  298. package/dist/assets/Object3DDocumentViewport-DCwiSY3O.js +0 -2
  299. package/dist/assets/OnlineAssetDetail-CNuwSQRQ.js +0 -1
  300. package/dist/assets/PlayBar-bT8Xdrap.js +0 -1
  301. package/dist/assets/ReactCanvasControls-CnJrPj-B.js +0 -1
  302. package/dist/assets/RootSelectionOverlay-CpaGluQu.js +0 -1
  303. package/dist/assets/ShadowEditor-CVtMlALn.js +0 -1
  304. package/dist/assets/StageHost-B89HKcvd.js +0 -2
  305. package/dist/assets/Toolbar-DkTHnQto.js +0 -1
  306. package/dist/assets/ViewportShadingMenu-CXPi6fl8.js +0 -1
  307. package/dist/assets/adapter-runtime-bindings-4cmsRvRh.js +0 -2
  308. package/dist/assets/autoplay.service-CjPnv3QW.js +0 -1
  309. package/dist/assets/binding-resolver-dE0GnZT5.js +0 -2
  310. package/dist/assets/blender.keymap-_rF_vRX8.js +0 -1
  311. package/dist/assets/bridge.command-BF00Iefm.js +0 -3
  312. package/dist/assets/build-profiles.document-CqNrDdh9.js +0 -2
  313. package/dist/assets/build-session-GZcSAfPN.js +0 -9
  314. package/dist/assets/build.header-Bt1kwHWl.js +0 -1
  315. package/dist/assets/canvas-design-mount-BbLW_Nci.js +0 -6
  316. package/dist/assets/canvas-entry-runtime-UNYuSfG0.js +0 -2
  317. package/dist/assets/component-verbs.service-CnA11bJq.js +0 -1
  318. package/dist/assets/create-runtime-DBfUy0SO.js +0 -3
  319. package/dist/assets/debug-bridge-D3_-EgRE.js +0 -1
  320. package/dist/assets/editor-api-BFTIRlWa.js +0 -1
  321. package/dist/assets/entry-adjudication-Dc18TIqT.js +0 -1
  322. package/dist/assets/fork-menu-DpKqRhF5.js +0 -1
  323. package/dist/assets/game-document.service-Chmt4065.js +0 -1
  324. package/dist/assets/game-eval.command-DRSvOJ_1.js +0 -2
  325. package/dist/assets/game-network-Ct2FQYmu.js +0 -1
  326. package/dist/assets/gameplay.command-Boqv1hnc.js +0 -1
  327. package/dist/assets/generation.service-o9aXlsx4.js +0 -1
  328. package/dist/assets/index-BHoAKyAC.js +0 -1
  329. package/dist/assets/ingest-siblings-BtiEXLnh.js +0 -1
  330. package/dist/assets/instances.command-BwayrqNm.js +0 -1
  331. package/dist/assets/layered-pick-kiQf53t5.js +0 -1
  332. package/dist/assets/model-asset-sections.service-CqSclZGY.js +0 -1
  333. package/dist/assets/module-mode-BH2R93XP.js +0 -2
  334. package/dist/assets/mount-canvas-ingest-root-D1z9i5B3.js +0 -2
  335. package/dist/assets/mount-dom-ingest-root-BAmmNxlm.js +0 -2
  336. package/dist/assets/mount-ingest-root-DYR0TMIt.js +0 -2
  337. package/dist/assets/mount-manifest-DdkFYdVA.js +0 -1
  338. package/dist/assets/network-observer.service-Ce83TdsU.js +0 -1
  339. package/dist/assets/network.utility-DFDul2Xb.js +0 -1
  340. package/dist/assets/pixi-authoring-adapter-BChknIdC.js +0 -1
  341. package/dist/assets/play-mode-DICV4cKP.js +0 -22
  342. package/dist/assets/play.command-NHyi5rzF.js +0 -2
  343. package/dist/assets/presentation-BeNFBfKg.js +0 -1
  344. package/dist/assets/r3f-design-session-B5GsZI5M.js +0 -2
  345. package/dist/assets/react-inspector.service-Bm0OnanU.js +0 -1
  346. package/dist/assets/run-selection-DzEkGesJ.js +0 -2
  347. package/dist/assets/stage-overlay-set-BGE03mqb.js +0 -1
  348. package/dist/assets/stage-transform-tools-BQB7EY4l.js +0 -1
  349. package/dist/assets/team-playtest.service-hLfjgScx.js +0 -1
  350. package/dist/assets/three-authoring.service-BIQAtVdX.js +0 -2
  351. package/dist/assets/three-integration.service-CS8Nvbd2.js +0 -1
  352. package/dist/assets/transform-mode-request-DzD9aUNA.js +0 -1
  353. package/dist/assets/transport-strip-CUjNltnb.js +0 -1
  354. package/dist/assets/transport.header-Bb4FpQ8J.js +0 -1
  355. package/dist/assets/ui-board-document-CCiiXjX9.js +0 -2
  356. package/dist/assets/world-documents-DBybpBq8.js +0 -1
  357. package/dist/assets/world-root-stage-binding-ZVYIgr74.js +0 -1
@@ -0,0 +1,22 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CC1puVjo.js","assets/extends-CF3RwP-h.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/client-DNXj_opT.js","assets/index-CinJrH5C.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-bQE2NA0D.js","assets/Gltf-GjdUJfpn.js","assets/BufferGeometryUtils-FJZNEiJN.js","assets/OrthographicCamera-QGDXU8-_.js","assets/Fbo-BwAOPGSM.js","assets/PerspectiveCamera-CzyDwUe8.js","assets/OrbitControls-DqeA2OK1.js","assets/index-CaG87ZF-.js","assets/index-CtzuWnCS.js","assets/index-FUuS4qwW.js","assets/index-B5WjeCHm.css","assets/RoundedBox-DrJK5JOI.js","assets/babylon-authoring-adapter-Cg5ALSpr.js","assets/json-history-resource-CTXRV4GD.js","assets/source-persistence-backend-HviqjKZ2.js","assets/ingest-source-persistence-6peGfPAS.js","assets/pixi-authoring-adapter-B42K4md-.js","assets/index-C20Flc1s.js","assets/component-instance-root-df4ofoOR.js","assets/user-data-CqOoAowZ.js","assets/workspace-arrangement-DIMM7ska.js","assets/pixi-transform-channels-P4rvmusc.js","assets/pixi-live-write-target-D56tQEe_.js","assets/canvas-entry-runtime-DVeh71nC.js","assets/debug-registry-l7k5Hjc8.js","assets/mount-ingest-root-BC3-1Cw1.js","assets/active-ingest-CnAeQcuQ.js","assets/game-contract-seams-C0AVYwvO.js","assets/capability-coverage-DQgg6UJe.js","assets/contract-system-adapters-h6OUBRYA.js","assets/three-state-wXRU3rLr.js","assets/editor-shell-store-Bh1S7M54.js","assets/output-pass-HurwNl0G.js","assets/Pass-D1MRT672.js","assets/editor-layers-B4oYfpj8.js","assets/entity-object-B_5Gc0Ky.js","assets/three-contract-Dkt6PmWY.js","assets/module-mode-B79jV5tQ.js","assets/binding-resolver-C_9MBSMa.js","assets/native-debug-module-B-rWJfWE.js","assets/native-entry-surface-BE8LJNdu.js","assets/adapter-surface-Y37Nzcyw.js","assets/structural-signature-Dc7skRiy.js","assets/webgl-frame-capture-DdJkM2mi.js","assets/realm-services-DefTrXnY.js","assets/three-ingest-runtime-CXKjNysA.js","assets/EffectComposer-BEAt0PtQ.js","assets/CopyShader-BzTUYzf6.js","assets/ShaderPass-DTnDQXm0.js","assets/CSS3DRenderer-BsAqfavI.js","assets/relative-path-guard-GiM7Lsz8.js","assets/react-root-BHA-cdrW.js","assets/mount-manifest-QJOB11Kv.js","assets/create-runtime-Bg2uYMfh.js","assets/binding-Bmxqznjk.js","assets/root-stacking-BEd9ZvxC.js","assets/assets-BcrMQHRv.js","assets/loader-BTUKnX5Q.js","assets/KTX2Loader-CaqVE6nY.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/setup-renderer-OOw1SykJ.js","assets/index-DHhMOs_s.js","assets/defaults-DKiBJCPN.js","assets/render-settings-BBvkacR3.js","assets/render-features-C7QwmhCo.js","assets/seeded-random-38To73fI.js","assets/loop-gate-report-N52EWFGD.js","assets/system-slot-E2mEdiih.js","assets/user-data-dHvLdpwM.js","assets/object-marks-DwvIEBOK.js","assets/performance-profiler-OwnXQX0M.js","assets/debug-bridge-CESAxmlz.js","assets/index-OZVqp6xS.js","assets/index-Da9JhEvW.js","assets/game-audio-CaGKzia4.js","assets/rapier-physics-adapter-CaZqWLu0.js","assets/live-project-verbs-BOAQN3ME.js","assets/edit-mode-authoring-DBjaBTxM.js","assets/editor-presentation-activity-C7SNSmTd.js","assets/pixi-story-model-DNkfnWUV.js","assets/surface-content-Dg9Kkazf.js","assets/viewport-root-presentation-B35t51xX.js","assets/mounted-authoring-B7RL_V28.js","assets/three-oYrcK5SQ.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/three-authoring-adapter-BrkGH4cd.js","assets/three-projection-core-jBJVt6O0.js","assets/body-marks-RKb_LTwL.js","assets/structural-ids-Br2zjINh.js","assets/object3d-authoring-subject-BDrxd1GA.js","assets/r3f-physics-binding-Bgzzd4ol.js","assets/deferred-ingest-play-Bej67_y9.js","assets/rrweb-Cd2ifIRP.js","assets/react-world-authoring-adapter-C1jPW_cN.js","assets/board-guides-_3R1t_-2.js","assets/relative-import-specifier-DQzkawgj.js","assets/story-arg-descriptors-Ek86ExX7.js","assets/inspect-C8RP8G5F.js","assets/inference-diagnostics-MGcIHEX6.js","assets/writer-tw6EcuVO.js","assets/viewport-door-DVkMQazS.js"])))=>i.map(i=>d[i]);
2
+ import{u as An,p as Ar,S as Ir}from"./index-OZVqp6xS.js";import{decode as Q,encode as xr}from"./index-Da9JhEvW.js";import{O as At,Y as In,X as Rr,_ as $,e0 as xn,bz as Cr,p as Rn,L as Or,h2 as kr,m5 as Dr,m6 as Nr,m3 as Fr,m7 as jr,m8 as Br,bG as $r,bH as Gr,V as Cn,m9 as On,bA as zr,bB as Ur,bD as kn,ma as Wr,U as Vr,mb as qr,bC as Hr,M,q as P,ja as Dn,mc as Kr,md as Yr,me as Jr,mf as X,ai as Xr,l7 as Nn,ag as Qr,bt as Me,jw as Zr,mg as es,as as Fn,mh as ts,av as Xe,x as jn,a9 as Ae,kn as Kt,mi as Bn,mj as $n,mk as Gn,kE as zn,hb as Un,kt as ns,ml as rs,mm as ss,mn as os,mo as is,mp as as,gU as ls,gn as cs,az as us,bs as Wn,mq as ds,mr as Vn,l$ as fs,g3 as ps,bl as gs,bm as hs,e2 as ms,gP as ys,ms as ws,gw as vs,fs as bs}from"./index-CaG87ZF-.js";import{i as Ls,b as Es}from"./native-debug-module-B-rWJfWE.js";import{T as Ie,c as Ss,g as _s}from"./seeded-random-38To73fI.js";import{g as Qe,D as K}from"./debug-registry-l7k5Hjc8.js";import{o as Ms}from"./game-audio-CaGKzia4.js";import{createRapierBodyEditing as Ts}from"./rapier-physics-adapter-CaZqWLu0.js";import{_ as Ps}from"./events-156d8d12.esm-CYeuVCYr.js";import{fo as We,dp as gt}from"./three.core-3arARmh6.js";import{b as qn,p as Hn}from"./live-project-verbs-BOAQN3ME.js";import{B as Yt}from"./edit-mode-authoring-DBjaBTxM.js";import{p as Kn,c as As}from"./json-history-resource-CTXRV4GD.js";import{b as Yn}from"./binding-resolver-C_9MBSMa.js";import{i as Is,s as xs}from"./editor-presentation-activity-C7SNSmTd.js";import{E as Jn,$ as Rs,a0 as Cs,G as Xn,B as ht,l as Ve,a1 as Os,g as ks}from"./active-ingest-CnAeQcuQ.js";import{m as Ds}from"./pixi-story-model-DNkfnWUV.js";import{t as Ns,d as Fs}from"./surface-content-Dg9Kkazf.js";import{p as js,l as Bs}from"./viewport-root-presentation-B35t51xX.js";import{assertNever as $s}from"./adapter-surface-Y37Nzcyw.js";import{r as Gs,o as zs,s as Us}from"./three-authoring-adapter-BrkGH4cd.js";import{t as It}from"./three-contract-Dkt6PmWY.js";import{mountDeferredIngestForPlay as Ws,exitDeferredIngestPlay as Vs}from"./deferred-ingest-play-Bej67_y9.js";import{r as se}from"./rrweb-Cd2ifIRP.js";import{R as qs,w as Hs}from"./react-world-authoring-adapter-C1jPW_cN.js";import{o as Ks}from"./three-state-wXRU3rLr.js";import{p as Ys}from"./viewport-door-DVkMQazS.js";async function Js(t){try{const e=await fetch(`${At}/log-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start",...t?{name:t}:{}})});return(await Rr(e,"Could not start a play log session")).file}catch{return null}}async function Xs(){try{const t=await fetch(`${At}/log-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"end"})});In(t,"Could not end the play log session")}catch{}}async function Qn(t){if(t.length===0)return!0;try{const e=await fetch(`${At}/log-entries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:t})});return In(e,"Could not flush play log entries"),!0}catch{return!1}}async function Qs(t){if(t.length===0)return;const{useGLTF:e,useTexture:n}=await $(async()=>{const{useGLTF:r,useTexture:s}=await import("./index-CC1puVjo.js");return{useGLTF:r,useTexture:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));for(const r of t)e.clear(r),n.clear(r)}const Zs=60;function eo(t){if(t.length===0)return{ms:null,fps:null,worstMs:null,samples:[]};let e=0,n=0;for(const s of t)e+=s,s>n&&(n=s);const r=e/t.length;return{ms:xe(r,2),fps:r>0?xe(1e3/r,1):null,worstMs:xe(n,2),samples:t.map(s=>xe(s,2))}}function xe(t,e){const n=10**e;return Math.round(t*n)/n}const to="No physics adapter on this game implements setDebugDrawEnabled, so nothing can draw its colliders. A first-party three root with Rapier physics registers one; a game with no physics has no colliders to draw.",Re=xn([]);function no(t){const e=[];let n=Jt();const r=t.onRenderStep(()=>{const a=Jt();e.push(a-n),n=a,e.length>Zs&&e.shift()});let s=!1;const o=()=>{const a=Rn(t.systemAdapters.physics);return a?.setDebugDrawEnabled?a:null};return{instruments:[{id:"timescale",label:"Time scale",hint:"Sim speed multiplier. 1 is real time, 0 freezes the simulation while the game keeps drawing.",unit:"x",control:{kind:"scale",action:"set",min:Ie.min,max:Ie.max,step:.05},actions:[{id:"set",label:"Set",hint:`Set the sim speed multiplier (${Ie.min}–${Ie.max}).`,args:xn([Cr()]),run:a=>(t.loop.timeScale=Ss(a[0]),t.loop.timeScale)}],read:()=>t.loop.timeScale},{id:"paused",label:"Paused",hint:"Freeze the simulation. The game keeps drawing, so you can look at a frozen frame.",control:{kind:"toggle",action:"toggle"},actions:[{id:"toggle",label:"Toggle",hint:"Pause or resume the simulation.",args:Re,run:()=>(t.play.paused?t.play.resume():t.play.pause(),t.play.paused)},{id:"step",label:"Step",hint:"Advance exactly one fixed substep. Pauses first if the game is running.",args:Re,run:()=>(t.play.paused||t.play.pause(),t.play.step(),t.play.paused)}],read:()=>t.play.paused},{id:"colliders",label:"Colliders drawn",hint:"Draw the physics colliders over the world, through the game's own physics adapter.",control:{kind:"toggle",action:"toggle"},actions:[{id:"toggle",label:"Toggle",hint:"Turn collider wireframes on or off.",args:Re,run:()=>{const a=o();if(!a)throw new Error(to);return s=!s,a.setDebugDrawEnabled?.(s),s}}],read:()=>o()===null?null:s},{id:"frame-time",label:"Frame time",hint:"Wall-clock milliseconds per display frame, newest last. The window is where a hitch shows; the mean hides it.",unit:"ms",control:{kind:"plot"},actions:[{id:"clear",label:"Clear",hint:"Forget the sampled window and start measuring again.",args:Re,run:()=>(e.length=0,null)}],read:()=>eo(e)}],dispose(){r(),e.length=0}}}function Jt(){return typeof performance>"u"?Date.now():performance.now()}const ro="instruments",so="__instruments__";function oo(t){const e={name:`instrument.${t.id}`,id:t.id,label:t.label,hint:t.hint,...t.unit===void 0?{}:{unit:t.unit},control:t.control,actions:t.actions.map(n=>({name:`instrument.${t.id}.${n.id}`,id:n.id,label:n.label,hint:n.hint}))};try{return{...e,value:t.read()}}catch(n){return{...e,value:null,error:n instanceof Error?n.message:String(n)}}}function io(t){const e=Qe(t);if(!e)throw new Error("Cannot publish dev instruments: mounted Game has no debug registry.");const n=no(t),r=e.forRoot(so);for(const s of n.instruments){r.registerStateProvider(`instrument.${s.id}`,()=>s.read(),{tier:"assisted"});for(const o of s.actions)r.registerCommand(`instrument.${s.id}.${o.id}`,{description:`${s.label}: ${o.label} — ${o.hint}`,locus:"client",args:o.args},(...i)=>o.run(i))}return r.registerStateProvider(ro,()=>n.instruments.map(oo),{tier:"assisted"}),()=>n.dispose()}function ao(t){if(!t||typeof t!="object")return!1;const e=t;return e.rigidBodyStates instanceof Map&&e.colliderStates instanceof Map&&e.world!==void 0&&e.rapier!==void 0}let Ce=null,lo=null;function co(){return Ce||(lo??=(async()=>{if(!await Or()){Ce=Ps;return}const t=await import(kr);if(!(t.r3fRoots instanceof Map))throw new Error("The packaged runtime's synthetic R3F module did not export `r3fRoots` — see R3F_DOORWAY in vite-plugin-module-doorways.ts.");Ce=t.r3fRoots})(),null)}function ie(t){const e=co();if(!e)return null;for(const n of e.values()){if(n.store.getState().scene!==t)continue;const r=n.fiber.current,s=r?[r]:[];for(;s.length>0;){const o=s.pop(),i=o.memoizedProps?.value;if(ao(i))return i;o.sibling&&s.push(o.sibling),o.child&&s.push(o.child)}}return null}function Na(t,e=6e4){const n=performance.now();return new Promise(r=>{const s=()=>{if(ie(t))return r(!0);if(performance.now()-n>e)return r(!1);setTimeout(s,250)};s()})}function Xt(t,e){let n;for(const r of t)if(r.object.traverse(s=>{!n&&s.userData.entityId===e&&(n=s)}),n)return n}function Qt(t,e){const n=new Map;for(const r of e)n.set(r.object,r.rigidBody);for(let r=t;r;r=r.parent){const s=n.get(r);if(s)return s}}const U=t=>[t.x,t.y,t.z],me=t=>[t.x,t.y,t.z,t.w];function Zt(t,e){const{ShapeType:n}=t.rapier;switch(e.shapeType()){case n.Cuboid:return{type:"cuboid",halfExtents:U(e.halfExtents())};case n.Ball:return{type:"ball",radius:e.radius()};case n.Capsule:return{type:"capsule",halfHeight:e.halfHeight(),radius:e.radius()};default:return{type:"unsupported",kind:n[e.shapeType()]??`shapeType ${e.shapeType()}`}}}function uo(t,e){const{JointType:n}=t.rapier;switch(e){case n.Revolute:return"revolute";case n.Fixed:return"fixed";case n.Prismatic:return"prismatic";case n.Rope:return"rope";case n.Spring:return"spring";case n.Spherical:return"spherical";default:return"generic"}}function en(t,e){return U(new We(e.x,e.y,e.z).applyQuaternion(new gt(...me(t.rotation()))).add(new We(...U(t.translation()))))}function fo(t,e){const n=e.body1(),r=e.body2(),s=e.anchor1(),o=e.anchor2(),i=uo(t,e.type()),a=i==="revolute"||i==="prismatic",l=a?e.frameX1():null,p=l?new We(1,0,0).applyQuaternion(new gt(l.x,l.y,l.z,l.w)):null,u=e;return{id:String(e.handle),type:i,body1:String(n.handle),body2:String(r.handle),anchor1:U(s),anchor2:U(o),worldAnchor1:en(n,s),worldAnchor2:en(r,o),body1Position:U(n.translation()),body2Position:U(r.translation()),body1Rotation:me(n.rotation()),body2Rotation:me(r.rotation()),...p?{axis:U(p),worldAxis:U(p.clone().applyQuaternion(new gt(...me(n.rotation()))))}:{},...a&&u.limitsEnabled()?{limits:{min:u.limitsMin(),max:u.limitsMax()}}:{},contactsEnabled:e.contactsEnabled()}}function po(t){const e=r=>{const s=ie(t);if(!s)return{kind:"unresolved"};const o=[...s.rigidBodyStates.values()],i=Xt(o,r);if(!i)return{kind:"unresolved"};const a=Qt(i,o);return a?{kind:"body",body:a}:{kind:"no-body"}},n=r=>{const s=ie(t);if(!s)return null;const o=[...s.rigidBodyStates.values()],i=Xt(o,r),a=i?Qt(i,o):void 0;return a?{context:s,body:a}:null};return{...Ts(e),colliders(r){const s=n(r);if(!s)return[];const o=[];for(const i of s.context.colliderStates.values()){if(i.collider.parent()?.handle!==s.body.handle)continue;i.object.updateWorldMatrix(!0,!1);const a=i.object.getWorldScale(new We);o.push({id:String(i.collider.handle),shape:Zt(s.context,i.collider),position:U(i.collider.translation()),rotation:me(i.collider.rotation()),scale:[Math.abs(a.x),Math.abs(a.y),Math.abs(a.z)],sensor:i.collider.isSensor()})}return o.sort((i,a)=>Number(i.id)-Number(a.id))},previewCollider(r,s){const o=ie(t),i=o?[...o.colliderStates.values()].find(a=>String(a.collider.handle)===r)?.collider:void 0;if(!(!o||!i||Zt(o,i).type!==s.type))switch(s.type){case"cuboid":i.setHalfExtents({x:s.halfExtents[0],y:s.halfExtents[1],z:s.halfExtents[2]});break;case"ball":i.setRadius(s.radius);break;case"capsule":i.setHalfHeight(s.halfHeight),i.setRadius(s.radius);break}},joints(r){const s=n(r);if(!s)return[];const o=[],i=s.context.world.impulseJoints;return i.forEachJointHandleAttachedToRigidBody(s.body.handle,a=>{const l=i.get(a);l&&o.push(fo(s.context,l))}),o.sort((a,l)=>Number(a.id)-Number(l.id))},previewJointAnchor(r,s,o){const i=ie(t)?.world.impulseJoints.get(Number(r));if(!i)return;const a={x:o[0],y:o[1],z:o[2]};s===0?i.setAnchor1(a):i.setAnchor2(a)}}}const go="__adapter__",tn=new WeakSet;function nn(t,e){const n=[];for(const r of t.roots){const s=r.binding?.observation[e];s&&n.push(s)}return n}function ho(t,e){return e.some(n=>n.slots.audio||n.absent.some(r=>r.slot==="audio"))?e:t.roots.map(n=>{const r=e.find(s=>s.rootId===n.id);return{rootId:n.id,slots:{...r?.slots,audio:Ms},absent:r?.absent??[]}})}const mo=["@colyseus/sdk","colyseus.js"];function yo(t,e){const n=e.some(u=>u.slots.networking||u.absent.some(f=>f.slot==="networking"));qn();const r=Hn(),s=r===null||r.some(u=>mo.includes(u)),o=t.roots[0];if(n||!s||!o)return e;const i=e.findIndex(u=>u.rootId===o.id),a=i>=0?e[i]:void 0,l={rootId:o.id,slots:{...a?.slots,networking:la},absent:a?.absent??[]},p=[...e];return i>=0?p[i]=l:p.push(l),p}const wo=["@react-three/rapier","@dimforge/rapier3d-compat"];function vo(t,e){qn();const n=Hn(),r=n===null||n.some(o=>wo.includes(o)),s=[...e];for(const o of t.roots){if(o.mounted.kind!=="three"||o.mounted.systems?.physics)continue;const i=s.findIndex(f=>f.rootId===o.id),a=i>=0?s[i]:void 0;if(a&&(a.slots.physics||a.absent.some(f=>f.slot==="physics")))continue;const l=o.mounted.scene;if(!r&&!ie(l))continue;const p=po(l),u={rootId:o.id,slots:{...a?.slots,physics:p},absent:a?.absent??[]};i>=0?s[i]=u:s.push(u)}return s}function bo(t,e,n){const r=e.forRoot(go);for(const s of n){if(s.kind==="state"){r.registerStateProvider(s.id,()=>{if(!s.answer)throw new K("OBSERVATION_UNANSWERED",`Observation "${s.id}" (state) is declared by this game's adapter with no answer.`);return s.answer(t)},{tier:"assisted"});continue}r.registerCommand(s.id,{...s.description?{description:s.description}:{},locus:s.locus??"client"},(...o)=>{if(!s.answer)throw new K("OBSERVATION_UNANSWERED",`Observation "${s.id}" (command) is declared by this game's adapter with no answer.`);return s.answer(t,...o)})}}function ot(t,e){const n=t.actions(e);if(!Array.isArray(n))throw new Error("vgai.adapter.ts input.actions must return an array.");const r=new Map;for(const s of n){if(typeof s?.name!="string"||s.name.length===0||!Nr.includes(s.valueType))throw new Error("vgai.adapter.ts input.actions returned an invalid action; each action needs a non-empty `name` and a supported `valueType`.");if(r.has(s.name))throw new Error(`vgai.adapter.ts input.actions returned duplicate action "${s.name}".`);r.set(s.name,s.valueType)}return r}function Lo(t,e){return t==="digital"?typeof e=="boolean":t==="scalar"?typeof e=="number"&&Number.isFinite(e):typeof e=="object"&&e!==null&&typeof e.x=="number"&&Number.isFinite(e.x)&&typeof e.y=="number"&&Number.isFinite(e.y)}function Eo(t,e,n){if(!t.world(n.root))throw new Error(`vgai.adapter.ts input.root names "${n.root}", which is not a mounted manifest root.`);const r=[],s=[];let o=!1;const i=(f,d)=>{const c=ot(n,t).get(f);if(!c)throw new K("INPUT_ACTION_NOT_FOUND",`Adapter input has no action named "${f}".`,{registered:[...ot(n,t).keys()]});if(!Lo(c,d))throw new K("INPUT_ACTION_VALUE_TYPE",`Adapter input action "${f}" expects ${c}, not ${typeof d}.`,{action:f,expected:c});return c},a=(f,d,c)=>{i(f,d),n.set(t,f,d),o&&s.push({tick:c,action:f,value:d})},l=()=>{const f=e.getGameTick(),d=r.filter(c=>c.tick===f);if(d.length!==0){for(let c=r.length-1;c>=0;c--)r[c].tick===f&&r.splice(c,1);for(const c of d)a(c.action,c.value,f)}};t.systems.add("input",l,{name:"adapter.input"});const p=f=>{throw new K("ADAPTER_INPUT_SOURCE_UNSUPPORTED",`${f} addresses an engine test source, but this game declares an app-owned action store. Drive it by action name instead.`)},u={setVirtualAction(f,d){return a(f,d,e.getGameTick()),{delivered:!0}},tapVirtualAction(f){const d=e.getGameTick();return a(f,!0,d),r.push({tick:d+1,action:f,value:!1}),{delivered:!0}},clearVirtualActions(){r.length=0,n.clear(t)},scheduleActionAtTick(f,d,c){const h=e.getGameTick();if(!Number.isInteger(f)||f<h)throw new K("TICK_ALREADY_PASSED",`Cannot schedule adapter input for tick ${f}; current tick is ${h}.`,{tick:f,currentTick:h});i(d,c),r.push({tick:f,action:d,value:c})},startInputRecording(){s.length=0,o=!0},stopInputRecording(){o=!1},isInputRecording(){return o},injectAxis(){p("injectAxis")},injectVector2(){p("injectVector2")},injectPointerDelta(){p("injectPointerDelta")},injectPointerPosition(){p("injectPointerPosition")}};e.setInputActionsSource(n.root,()=>[...ot(n,t)].map(([f,d])=>({name:f,valueType:d}))),e.setInputTraceSource(n.root,()=>({version:1,seed:null,fixedDt:t.loop.fixedDt,ticks:[...s]})),e.setVirtualInputTarget(n.root,u)}function Zn(t){if(tn.has(t))return;Ls(t,nn(t,"entryDebug")),Es(t,yo(t,vo(t,ho(t,nn(t,"entrySystems"))))),io(t);const e=Qe(t);if(!e)throw new Error("Cannot install adapter runtime bindings: mounted Game has no debug registry.");t.roots.some(s=>s.mounted.systems?.debug!==void 0&&s.mounted.systems.debug!==e.adapter)||bo(t,e,Fr());const r=Dr();r&&Eo(t,e,r),tn.add(t)}let m=(function(t){return t.info="info",t.warn="warn",t.error="error",t.debug="debug",t.trace="trace",t.fatal="fatal",t})({});const ue={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},er=Symbol.for("loglayer.lazy"),xt="[LazyEvalError]";function le(t){return t!=null&&typeof t=="object"&&er in t}function rn(t){let e=0;for(const n of Object.keys(t))le(t[n])&&e++;return e}function it(t){let e=!1;for(const s of Object.keys(t))if(le(t[s])){e=!0;break}if(!e)return{resolved:t,errors:null};const n={};let r=null;for(const s of Object.keys(t)){const o=t[s];if(le(o))try{n[s]=o[er]()}catch(i){n[s]=xt,r||(r=[]),r.push({key:s,error:i})}else n[s]=o}return{resolved:n,errors:r}}function So(t){for(const e of Object.keys(t))if(t[e]instanceof Promise)return!0;return!1}function sn(t){let e=null;const n={};for(const r of Object.keys(t))t[r]instanceof Promise?(n[r]=xt,e||(e=[]),e.push(r)):n[r]=t[r];return e?{resolved:n,asyncKeys:e}:{resolved:t,asyncKeys:null}}async function _o(t){const e=Object.keys(t),n=await Promise.allSettled(e.map(o=>Promise.resolve(t[o]))),r={};let s=null;for(let o=0;o<e.length;o++){const i=n[o];i.status==="fulfilled"?r[e[o]]=i.value:(r[e[o]]=xt,s||(s=[]),s.push({key:e[o],error:i.reason}))}return{resolved:r,errors:s}}function B(t){const e=t[0];if(Array.isArray(e)&&typeof e.raw<"u"){const n=e,r=t.slice(1);let s="";for(let o=0;o<n.length;o++)s+=n[o],o<r.length&&(s+=String(r[o]));return[s]}return t}let C=(function(t){return t.transformLogLevel="transformLogLevel",t.onBeforeDataOut="onBeforeDataOut",t.shouldSendToLogger="shouldSendToLogger",t.onMetadataCalled="onMetadataCalled",t.onBeforeMessageOut="onBeforeMessageOut",t.onContextCalled="onContextCalled",t})({});var Mo=class tr{context={};hasContext=!1;setContext(e){if(!e){this.context={},this.hasContext=!1;return}this.context=e,this.hasContext=!0}appendContext(e){this.context={...this.context,...e},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(e){if(e===void 0){this.context={},this.hasContext=!1;return}const n=Array.isArray(e)?e:[e];for(const r of n)delete this.context[r];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:e,childContextManager:n}){if(e.hasContextData()){const r=e.getContext();n.setContext({...r})}}clone(){const e=new tr;return e.setContext({...this.context}),e.hasContext=this.hasContext,e}},To=class mt{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(e){const n=ue[e];for(const r of Object.values(m)){const s=r,o=ue[r];this.logLevelEnabledStatus[s]=o>=n}}enableIndividualLevel(e){const n=e;n in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[n]=!0)}disableIndividualLevel(e){const n=e;n in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[n]=!1)}isLevelEnabled(e){const n=e;return this.logLevelEnabledStatus[n]}enableLogging(){for(const e of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[e]=!0}disableLogging(){for(const e of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[e]=!1}onChildLoggerCreated({parentLogLevelManager:e,childLogLevelManager:n}){const r=e.logLevelEnabledStatus;n instanceof mt&&(n.logLevelEnabledStatus={...r})}clone(){const e=new mt;return e.logLevelEnabledStatus={...this.logLevelEnabledStatus},e}},Po=class{id;enabled;level;consoleDebug;constructor(t){this.id=t.id??Date.now().toString()+Math.random().toString(),this.enabled=t.enabled??!0,this.consoleDebug=t.consoleDebug??!1,this.level=t.level??"trace"}_sendToLogger(t){if(!this.enabled||ue[t.logLevel]<ue[this.level])return;const e=this.shipToLogger(t);if(this.consoleDebug)switch(t.logLevel){case m.info:console.info(...e);break;case m.warn:console.warn(...e);break;case m.error:console.error(...e);break;case m.trace:console.debug(...e);break;case m.debug:console.debug(...e);break;case m.fatal:console.debug(...e);break;default:console.log(...e)}}getLoggerInstance(){throw new Error("This transport does not have a logger instance")}},Ao={};const Io=[C.onBeforeDataOut,C.onMetadataCalled,C.onBeforeMessageOut,C.transformLogLevel,C.shouldSendToLogger,C.onContextCalled];var on=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(t){this.idToPlugin={},this.mapPlugins(t),this.indexPlugins()}mapPlugins(t){for(const e of t){if(e.id||(e.id=Date.now().toString()+Math.random().toString()),this.idToPlugin[e.id])throw new Error(`[LogLayer] Plugin with id ${e.id} already exists.`);e.registeredAt=Date.now(),this.idToPlugin[e.id]=e}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];const t=Object.values(this.idToPlugin).sort((e,n)=>e.registeredAt-n.registeredAt);for(const e of t){if(e.disabled)return;for(const n of Io)e[n]&&e.id&&this[n].push(e.id)}}hasPlugins(t){return this[t].length>0}countPlugins(t){return t?this[t].length:Object.keys(this.idToPlugin).length}addPlugins(t){this.mapPlugins(t),this.indexPlugins()}enablePlugin(t){const e=this.idToPlugin[t];e&&(e.disabled=!1),this.indexPlugins()}disablePlugin(t){const e=this.idToPlugin[t];e&&(e.disabled=!0),this.indexPlugins()}removePlugin(t){delete this.idToPlugin[t],this.indexPlugins()}runTransformLogLevel(t,e){let n=null;for(const r of this.transformLogLevel){const s=this.idToPlugin[r];if(s.transformLogLevel){const o=s.transformLogLevel({data:t.data,logLevel:t.logLevel,messages:t.messages,error:t.error,metadata:t.metadata,context:t.context,groups:t.groups,schema:t.schema,prefix:t.prefix},e);o!=null&&o!==!1&&(n=o)}}return n!=null&&n!==!1?n:t.logLevel}runOnBeforeDataOut(t,e){const n={...t},r=n.data;for(const s of this.onBeforeDataOut){const o=this.idToPlugin[s];if(o.onBeforeDataOut){const i=o.onBeforeDataOut({data:n.data,logLevel:n.logLevel,error:n.error,metadata:n.metadata,context:n.context,groups:n.groups,schema:n.schema,prefix:n.prefix},e);i&&(n.data||(n.data={}),i!==r&&Object.assign(n.data,i))}}return n.data}runShouldSendToLogger(t,e){return!this.shouldSendToLogger.some(n=>!this.idToPlugin[n].shouldSendToLogger?.(t,e))}runOnMetadataCalled(t,e){let n={...t};for(const r of this.onMetadataCalled){const s=this.idToPlugin[r].onMetadataCalled?.(n,e);if(s)n=s;else return null}return n}runOnBeforeMessageOut(t,e){let n=[...t.messages];for(const r of this.onBeforeMessageOut){const s=this.idToPlugin[r].onBeforeMessageOut?.({messages:n,logLevel:t.logLevel,groups:t.groups,schema:t.schema,prefix:t.prefix},e);s&&(n=s)}return n}runOnContextCalled(t,e){let n={...t};for(const r of this.onContextCalled){const s=this.idToPlugin[r].onContextCalled?.(n,e);if(s)n=s;else return null}return n}},xo=class nr{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_isLoggingLazyError=!1;_lazyContextCount=0;_assignedGroups=null;_groupsConfig=null;_activeGroups=null;_ungroupedBehavior="all";_config;constructor(e){this._config={...e,enabled:e.enabled??!0},this.contextManager=new Mo,this.logLevelManager=new To,this._config.enabled||this.disableLogging();const n=[...e.plugins||[],...ye.pluginsToInit];this.pluginManager=new on(n),this._config.errorFieldName||(this._config.errorFieldName="err"),this._config.copyMsgOnOnlyError||(this._config.copyMsgOnOnlyError=!1),this._initializeTransports(this._config.transport),this._groupsConfig=e.groups?{...e.groups}:null,this._ungroupedBehavior=e.ungroupedBehavior??"all",this._activeGroups=e.activeGroups?new Set(e.activeGroups):null,this._parseEnvGroups(),ye.logLayerHandlers.length>0&&ye.logLayerHandlers.forEach(r=>{r.onConstruct&&r.onConstruct(this,e)})}withContextManager(e){return this.contextManager&&typeof this.contextManager[Symbol.dispose]=="function"&&this.contextManager[Symbol.dispose](),this.contextManager=e,this._lazyContextCount=e.hasContextData()?rn(e.getContext()):0,this}getContextManager(){return this.contextManager}withLogLevelManager(e){return this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]=="function"&&this.logLevelManager[Symbol.dispose](),this.logLevelManager=e,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(e){if(this.idToTransport)for(const n in this.idToTransport)this.idToTransport[n]&&typeof this.idToTransport[n][Symbol.dispose]=="function"&&this.idToTransport[n][Symbol.dispose]();this.hasMultipleTransports=Array.isArray(e)&&e.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(e)?e[0]:e,Array.isArray(e)?this.idToTransport=e.reduce((n,r)=>(n[r.id]=r,n),{}):this.idToTransport={[e.id]:e}}withPrefix(e){const n=this.child();return n._config.prefix=e,n}withGroup(e){const n=this.child(),r=Array.isArray(e)?e:[e];if(n._assignedGroups){const s=new Set([...n._assignedGroups,...r]);n._assignedGroups=Array.from(s)}else n._assignedGroups=[...r];return n}addGroup(e,n){return this._groupsConfig||(this._groupsConfig={}),this._groupsConfig[e]={...n},this}removeGroup(e){return this._groupsConfig&&(delete this._groupsConfig[e],Object.keys(this._groupsConfig).length===0&&(this._groupsConfig=null)),this}enableGroup(e){return this._groupsConfig?.[e]&&(this._groupsConfig[e]={...this._groupsConfig[e],enabled:!0}),this}disableGroup(e){return this._groupsConfig?.[e]&&(this._groupsConfig[e]={...this._groupsConfig[e],enabled:!1}),this}setGroupLevel(e,n){return this._groupsConfig?.[e]&&(this._groupsConfig[e]={...this._groupsConfig[e],level:n}),this}setActiveGroups(e){return this._activeGroups=e?new Set(e):null,this}getGroups(){return this._groupsConfig?{...this._groupsConfig}:{}}withContext(e){let n=e;if(!e)return this._config.consoleDebug&&console.debug("[LogLayer] withContext was called with no context; dropping."),this;if(this.pluginManager.hasPlugins(C.onContextCalled)&&(n=this.pluginManager.runOnContextCalled(e,this),!n))return this._config.consoleDebug&&console.debug("[LogLayer] Context was dropped due to plugin returning falsy value."),this;const r=this.contextManager.getContext();for(const s of Object.keys(n)){const o=s in r&&le(r[s]),i=le(n[s]);!o&&i?this._lazyContextCount++:o&&!i&&this._lazyContextCount--}return this.contextManager.appendContext(n),this}clearContext(e){if(e!==void 0&&this._lazyContextCount>0){const n=this.contextManager.getContext(),r=Array.isArray(e)?e:[e];for(const s of r)s in n&&le(n[s])&&this._lazyContextCount--}else e===void 0&&(this._lazyContextCount=0);return this.contextManager.clearContext(e),this}getContext(e){const n=this.contextManager.getContext();if(e?.raw||this._lazyContextCount===0)return n;const{resolved:r,errors:s}=it(n);s&&this._logLazyEvalErrors(s,"context");const{resolved:o,asyncKeys:i}=sn(r);return i&&this._logAsyncLazyContextErrors(i),o}addPlugins(e){this.pluginManager.addPlugins(e)}enablePlugin(e){this.pluginManager.enablePlugin(e)}disablePlugin(e){this.pluginManager.disablePlugin(e)}removePlugin(e){this.pluginManager.removePlugin(e)}withMetadata(e){return new an(this).withMetadata(e)}withError(e){return new an(this).withError(e)}child(){const e=new nr({...this._config,transport:Array.isArray(this._config.transport)?[...this._config.transport]:this._config.transport}).withPluginManager(this.pluginManager).withContextManager(this.contextManager.clone()).withLogLevelManager(this.logLevelManager.clone());return this.contextManager.onChildLoggerCreated({parentContextManager:this.contextManager,childContextManager:e.contextManager,parentLogger:this,childLogger:e}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:e.logLevelManager,parentLogger:this,childLogger:e}),e._lazyContextCount=e.contextManager.hasContextData()?rn(e.contextManager.getContext()):0,e._groupsConfig=this._groupsConfig,e._activeGroups=this._activeGroups,e._ungroupedBehavior=this._ungroupedBehavior,e._assignedGroups=this._assignedGroups?[...this._assignedGroups]:null,e}withFreshTransports(e){return this._config.transport=e,this._initializeTransports(e),this}addTransport(e){const n=Array.isArray(e)?e:[e],r=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],s=new Set(n.map(i=>i.id));for(const i of n){const a=this.idToTransport[i.id];a&&typeof a[Symbol.dispose]=="function"&&a[Symbol.dispose]()}const o=[...r.filter(i=>!s.has(i.id)),...n];this._config.transport=o;for(const i of n)this.idToTransport[i.id]=i;return this.hasMultipleTransports=o.length>1,this.singleTransport=this.hasMultipleTransports?null:o[0],this}removeTransport(e){const n=this.idToTransport[e];if(!n)return!1;typeof n[Symbol.dispose]=="function"&&n[Symbol.dispose](),delete this.idToTransport[e];const r=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter(s=>s.id!==e);return this._config.transport=r.length===1?r[0]:r,this.hasMultipleTransports=r.length>1,this.singleTransport=this.hasMultipleTransports?null:r[0]||null,!0}withFreshPlugins(e){return this._config.plugins=e,this.pluginManager=new on(e),this}withPluginManager(e){return this.pluginManager=e,this}errorOnly(e,n){const r=n?.logLevel||m.error;if(!this.isLevelEnabled(r))return;const{copyMsgOnOnlyError:s}=this._config,o={logLevel:r,err:e};(s&&n?.copyMsg!==!1||n?.copyMsg===!0)&&e?.message&&(o.params=[e.message]),this._formatLog(o)}metadataOnly(e,n=m.info){if(!this.isLevelEnabled(n))return;const{muteMetadata:r,consoleDebug:s}=this._config;if(r)return;if(!e){s&&console.debug("[LogLayer] metadataOnly was called with no metadata; dropping.");return}let o=e;if(this.pluginManager.hasPlugins(C.onMetadataCalled)&&(o=this.pluginManager.runOnMetadataCalled(e,this),!o)){s&&console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return}const i={logLevel:n,metadata:o};return this._formatLog(i)}info(...e){if(!this.isLevelEnabled(m.info))return;const n=B(e);this._formatMessage(n),this._formatLog({logLevel:m.info,params:n})}warn(...e){if(!this.isLevelEnabled(m.warn))return;const n=B(e);this._formatMessage(n),this._formatLog({logLevel:m.warn,params:n})}error(...e){if(!this.isLevelEnabled(m.error))return;const n=B(e);this._formatMessage(n),this._formatLog({logLevel:m.error,params:n})}debug(...e){if(!this.isLevelEnabled(m.debug))return;const n=B(e);this._formatMessage(n),this._formatLog({logLevel:m.debug,params:n})}trace(...e){if(!this.isLevelEnabled(m.trace))return;const n=B(e);this._formatMessage(n),this._formatLog({logLevel:m.trace,params:n})}fatal(...e){if(!this.isLevelEnabled(m.fatal))return;const n=B(e);this._formatMessage(n),this._formatLog({logLevel:m.fatal,params:n})}raw(e){if(!this.isLevelEnabled(e.logLevel))return;const n={logLevel:e.logLevel,params:e.messages,metadata:e.metadata,rootData:e.rootData,err:e.error,context:e.context};return this._formatMessage(e.messages),this._formatLog(n)}disableLogging(){return this.logLevelManager.disableLogging(),this}enableLogging(){return this.logLevelManager.enableLogging(),this}muteContext(){return this._config.muteContext=!0,this}unMuteContext(){return this._config.muteContext=!1,this}muteMetadata(){return this._config.muteMetadata=!0,this}unMuteMetadata(){return this._config.muteMetadata=!1,this}enableIndividualLevel(e){return this.logLevelManager.enableIndividualLevel(e),this}disableIndividualLevel(e){return this.logLevelManager.disableIndividualLevel(e),this}setLevel(e){return this.logLevelManager.setLevel(e),this}isLevelEnabled(e){return this.logLevelManager.isLevelEnabled(e)}formatContext(e){const{contextFieldName:n,muteContext:r}=this._config;return e&&Object.keys(e).length>0&&!r?n?{[n]:{...e}}:{...e}:{}}formatMetadata(e=null){const{metadataFieldName:n,muteMetadata:r}=this._config;return e&&!r?n?{[n]:{...e}}:{...e}:{}}getLoggerInstance(e){const n=this.idToTransport[e];if(n)return n.getLoggerInstance()}_parseEnvGroups(){const e=typeof process<"u"?Ao?.LOGLAYER_GROUPS:void 0;if(!e)return;const n=e.split(",").map(s=>s.trim()).filter(Boolean),r=[];for(const s of n){const o=s.indexOf(":");if(o>0){const i=s.slice(0,o),a=s.slice(o+1);r.push(i),this._groupsConfig?.[i]&&(this._groupsConfig[i]={...this._groupsConfig[i],level:a})}else r.push(s)}this._activeGroups=new Set(r)}_mergeGroups(e){if(this._assignedGroups&&e){const n=new Set([...this._assignedGroups,...e]);return Array.from(n)}return e||this._assignedGroups}_applyUngroupedRules(e){return this._ungroupedBehavior==="all"?!0:this._ungroupedBehavior==="none"?!1:this._ungroupedBehavior.includes(e)}_shouldTransportReceiveLog(e,n,r){if(!this._groupsConfig)return!0;const s=this._mergeGroups(r);if(!s||s.length===0)return this._applyUngroupedRules(e);let o=!1;for(const i of s){const a=this._groupsConfig[i];if(a&&(o=!0,a.enabled!==!1&&!(this._activeGroups&&!this._activeGroups.has(i)))){if(a.level){const l=ue[a.level];if(ue[n]<l)continue}if(a.transports.includes(e))return!0}}return o?!1:this._applyUngroupedRules(e)}_formatMessage(e=[]){const{prefix:n}=this._config;n&&typeof e[0]=="string"&&(e[0]=`${n} ${e[0]}`)}_formatLog({logLevel:e,params:n=[],metadata:r=null,rootData:s=null,err:o,context:i=null,groups:a=null}){const l=i!==null?i:this.contextManager.getContext();let p;if(this._lazyContextCount>0||i!==null){const f=it(l);f.errors&&this._logLazyEvalErrors(f.errors,"context");const{resolved:d,asyncKeys:c}=sn(f.resolved);c&&this._logAsyncLazyContextErrors(c),p=d}else p=l;let u=null;if(r){const f=it(r);r=f.resolved,u=f.errors}if(u&&this._logLazyEvalErrors(u,"metadata"),r&&So(r))return this._resolveAsyncAndProcess(e,n,p,r,s,o,i,a);this._processLog(e,n,p,r,s,o,i,a)}async _resolveAsyncAndProcess(e,n,r,s,o,i,a,l){let p=null;if(s){const u=await _o(s);p=u.resolved,u.errors&&this._logLazyEvalErrors(u.errors,"metadata")}this._processLog(e,n,r,p,o,i,a,l)}_logLazyEvalErrors(e,n){if(this._isLoggingLazyError){for(const r of e)console.error(`[LogLayer] Lazy evaluation error in ${n} key "${r.key}":`,r.error);return}this._isLoggingLazyError=!0;try{for(const r of e){const s=r.error instanceof Error?r.error.message:String(r.error);this._processLog(m.error,[`[LogLayer] Lazy evaluation failed for ${n} key "${r.key}": ${s}`],{},null,null,r.error instanceof Error?r.error:void 0,{})}}finally{this._isLoggingLazyError=!1}}_logAsyncLazyContextErrors(e){if(this._isLoggingLazyError){for(const n of e)console.error(`[LogLayer] Async lazy values are not supported in context (key "${n}"). Use async lazy only in metadata.`);return}this._isLoggingLazyError=!0;try{for(const n of e)this._processLog(m.error,[`[LogLayer] Async lazy values are not supported in context (key "${n}"). Use async lazy only in metadata.`],{},null,null,void 0,{})}finally{this._isLoggingLazyError=!1}}_processLog(e,n,r,s,o,i,a,l=null){const{errorSerializer:p,errorFieldInMetadata:u,muteContext:f,contextFieldName:d,metadataFieldName:c,errorFieldName:h,prefix:E}=this._config,v={contextFieldName:d??void 0,metadataFieldName:c??void 0,errorFieldName:h??"err"},S=this._mergeGroups(l)??void 0;let y=!!s||(f?!1:a!==null?Object.keys(a).length>0:this.contextManager.hasContextData()),w={};if(y)if(d&&d===c){const _=this.formatContext(r)[d],T=this.formatMetadata(s)[c];w={[d]:{..._,...T}}}else w={...this.formatContext(r),...this.formatMetadata(s)};if(i){const _=p?p(i):i;u&&s&&c?w?.[c]?w[c][h]=_:w={...w,[c]:{[h]:_}}:u&&!s&&c?w={...w,[c]:{[h]:_}}:w={...w,[h]:_},y=!0}o&&Object.keys(o).length>0&&(w={...w,...o},y=!0),this.pluginManager.hasPlugins(C.onBeforeDataOut)&&(w=this.pluginManager.runOnBeforeDataOut({data:y?w:void 0,logLevel:e,error:i,metadata:s,context:r,groups:S,schema:v,prefix:E},this),w&&!y&&(y=!0)),this.pluginManager.hasPlugins(C.onBeforeMessageOut)&&(n=this.pluginManager.runOnBeforeMessageOut({messages:[...n],logLevel:e,groups:S,schema:v,prefix:E},this)),this.pluginManager.hasPlugins(C.transformLogLevel)&&(e=this.pluginManager.runTransformLogLevel({data:y?w:void 0,logLevel:e,messages:[...n],error:i,metadata:s,context:r,groups:S,schema:v,prefix:E},this));const k={data:y?w:void 0,error:i,metadata:s,context:r,groups:S,schema:v,prefix:E};if(this.hasMultipleTransports){const _=this._config.transport.filter(T=>!(!T.enabled||!this._shouldTransportReceiveLog(T.id,e,S))).map(async T=>{const D=e;if(!(this.pluginManager.hasPlugins(C.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...n],logLevel:D,transportId:T.id,...k},this)))return T._sendToLogger({logLevel:D,messages:[...n],hasData:y,...k})});Promise.all(_).catch(T=>{this._config.consoleDebug&&console.error("[LogLayer] Error executing transports:",T)})}else{if(!this.singleTransport?.enabled||!this._shouldTransportReceiveLog(this.singleTransport.id,e,S)||this.pluginManager.hasPlugins(C.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...n],logLevel:e,transportId:this.singleTransport.id,...k},this))return;this.singleTransport._sendToLogger({logLevel:e,messages:[...n],hasData:y,...k})}}};const ye={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var an=class{err;metadata;structuredLogger;hasMetadata;pluginManager;_groups=null;constructor(t){this.err=null,this.metadata={},this.structuredLogger=t,this.hasMetadata=!1,this.pluginManager=t.pluginManager,ye.logBuilderHandlers.length>0&&ye.logBuilderHandlers.forEach(e=>{e.onConstruct&&e.onConstruct(this,t)})}withMetadata(t){const{pluginManager:e,structuredLogger:{_config:{consoleDebug:n}}}=this;if(!t)return n&&console.debug("[LogLayer] withMetadata was called with no metadata; dropping."),this;let r=t;return e.hasPlugins(C.onMetadataCalled)&&(r=e.runOnMetadataCalled(t,this.structuredLogger),!r)?(n&&console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value."),this):(this.metadata={...this.metadata,...r},this.hasMetadata=!0,this)}withError(t){return this.err=t,this}withGroup(t){const e=Array.isArray(t)?t:[t];if(this._groups){const n=new Set([...this._groups,...e]);this._groups=Array.from(n)}else this._groups=[...e];return this}info(...t){if(!this.structuredLogger.isLevelEnabled(m.info))return;const e=B(t);return this.structuredLogger._formatMessage(e),this.formatLog(m.info,e)}warn(...t){if(!this.structuredLogger.isLevelEnabled(m.warn))return;const e=B(t);return this.structuredLogger._formatMessage(e),this.formatLog(m.warn,e)}error(...t){if(!this.structuredLogger.isLevelEnabled(m.error))return;const e=B(t);return this.structuredLogger._formatMessage(e),this.formatLog(m.error,e)}debug(...t){if(!this.structuredLogger.isLevelEnabled(m.debug))return;const e=B(t);return this.structuredLogger._formatMessage(e),this.formatLog(m.debug,e)}trace(...t){if(!this.structuredLogger.isLevelEnabled(m.trace))return;const e=B(t);return this.structuredLogger._formatMessage(e),this.formatLog(m.trace,e)}fatal(...t){if(!this.structuredLogger.isLevelEnabled(m.fatal))return;const e=B(t);return this.structuredLogger._formatMessage(e),this.formatLog(m.fatal,e)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(t,e){const{muteMetadata:n}=this.structuredLogger._config,r=n?!1:this.hasMetadata;return this.structuredLogger._formatLog({logLevel:t,params:e,metadata:r?this.metadata:null,err:this.err,groups:this._groups})}},Ro=class extends Po{shipToLoggerFn;constructor(t){super(t),this.shipToLoggerFn=t.shipToLogger}shipToLogger(t){return this.shipToLoggerFn(t)}};let yt=!1;const Co={trace:"log",debug:"log",info:"log",warn:"warn",error:"error",fatal:"error"},Rt=new xo({transport:new Ro({shipToLogger:({logLevel:t,messages:e,data:n,hasData:r})=>{const s=Co[t]??"log";let o,i;if(r&&n){const{_sub:a,...l}=n;o=a?String(a):void 0,Object.keys(l).length>0&&(i=l)}return yt=!0,i?console[s](...e,i):console[s](...e),yt=!1,typeof window<"u"&&window.postMessage({type:"engine-log",level:t,message:e.join(" "),subsystem:o,metadata:i,timestamp:Date.now()},"*"),e}}),prefix:"[engine]"});Rt.setLevel(m.info);typeof window<"u"&&(window.setEngineLogLevel=t=>{Rt.setLevel(t)});if(typeof window<"u"){const t=new URLSearchParams(window.location.search).get("engineLogLevel");t&&Rt.setLevel(t)}const Oo=4,ko=1e4;async function Do(t,e,n,r){const s=t.getRunTicksTarget();if(s===null)throw new K("RUN_TICKS_UNAVAILABLE","runTicksWhenSettled: no run-ticks target is wired — no Game has mounted yet");const o=ko,i=Oo,a=n?.render??"last";for(let l=0;l<e;l++){if(!t.worldSettled()){const f=Date.now()+o;for(;!t.worldSettled();){if(Date.now()>f)throw new K("WORLD_UNSETTLED_TIMEOUT",`runTicksWhenSettled: a world-settled probe still answers false after ${o}ms — a scene remount (or a broken probe) is stuck, and driving ticks into it would race it`);await new Promise(d=>setTimeout(d,i))}}const p=l===e-1,u=a==="all"?"all":a==="none"?"none":p?"last":"none";s.runTicks(1,{render:u})}}const No="fit",rr=[{id:No,label:"Fit panel",kind:"fit",width:null,height:null,dpr:null,safeArea:null},{id:"iphone-portrait",label:"iPhone 14 — 390×844 @3x",kind:"phone",width:390,height:844,dpr:3,safeArea:{top:47,right:0,bottom:34,left:0}},{id:"iphone-landscape",label:"iPhone 14 landscape — 844×390 @3x",kind:"phone",width:844,height:390,dpr:3,safeArea:{top:0,right:47,bottom:21,left:47}},{id:"android-portrait",label:"Android — 412×915 @2.6x",kind:"phone",width:412,height:915,dpr:2.6,safeArea:{top:24,right:0,bottom:24,left:0}},{id:"ipad-portrait",label:"iPad — 820×1180 @2x",kind:"tablet",width:820,height:1180,dpr:2,safeArea:{top:24,right:0,bottom:20,left:0}},{id:"desktop-1080p",label:"Desktop — 1920×1080 @1x",kind:"desktop",width:1920,height:1080,dpr:1,safeArea:null}],Ct=rr[0];function sr(t){return rr.find(e=>e.id===t)??Ct}let O=Ct,te=null,or=0;const wt=new Set;function Ot(){or++;for(const t of wt)t()}function Fa(t){return wt.add(t),()=>{wt.delete(t)}}const ja=()=>or;function Ba(){return O}function ir(){return te??(O.kind==="phone"||O.kind==="tablet")}function $a(t){const e=sr(t);e!==O&&(O=e,te=null,ar(),Ot())}function Ga(t){t!==te&&(te=t,ar(),Ot())}function Fo(){return O.dpr}function za(){return Math.min(typeof window<"u"&&window.devicePixelRatio||1,2)}function ar(){jr({devicePreview:{preset:O.id,touch:te}})}function Ua(){const t=Br().devicePreview;return t?.preset?(O=sr(t.preset),te=typeof t.touch=="boolean"?t.touch:null):(O=Ct,te=null),Ot(),O}const ln=["pointerdown","pointermove","pointerup","pointercancel"],cn=new WeakSet;let vt=null,at=null;function un(t){if(!ir()||cn.has(t)||!(t instanceof PointerEvent)||t.pointerType!=="mouse")return;const e=t.target;if(!e)return;t.stopImmediatePropagation();const n=new PointerEvent(t.type,{bubbles:!0,cancelable:t.cancelable,composed:!0,view:t.view,detail:t.detail,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,pointerId:t.pointerId,pointerType:"touch",isPrimary:!0,pressure:t.type==="pointerup"||t.type==="pointercancel"?0:Math.max(t.pressure,.5),width:20,height:20});cn.add(n),e.dispatchEvent(n),n.defaultPrevented&&t.preventDefault()}function jo(t){if(t!==vt&&(at?.(),at=null,vt=t,!!t)){for(const e of ln)t.addEventListener(e,un,{capture:!0});at=()=>{for(const e of ln)t.removeEventListener(e,un,{capture:!0})}}}function Wa(t){vt===t&&jo(null)}function Bo(){return{presetId:O.id,presetLabel:O.label,dpr:O.dpr,safeArea:O.safeArea,touchActive:ir()}}typeof window<"u"&&(window.__vgaiDevicePreview=Bo);const $o=15e3;function Go(t,e,n){const r=n?` (open ${n})`:"";return`Play start stalled at "${t}" for ${Math.round(e/1e3)}s and the editor tab is HIDDEN — a backgrounded tab has its network requests deprioritized by the browser, so this step is queued rather than broken. Bring the editor tab to the foreground${r} and run play again; the engine loop itself is hidden-safe, only the boot's fetches are starved.`}function zo(t,e,n){const r=n.stallMs??$o,s=n.setTimer??((i,a)=>setTimeout(i,a)),o=n.clearTimer??(i=>clearTimeout(i));return new Promise((i,a)=>{let l=!1;const p=s(()=>{l||n.isHidden()&&(l=!0,a(new Error(Go(t,r,n.editorUrl))))},r);e.then(u=>{l||(l=!0,o(p),i(u))},u=>{l||(l=!0,o(p),a(u instanceof Error?u:new Error(String(u))))})})}function Uo(t,e,n=Date.now()){const r=t.filter(s=>s.seq>e).sort((s,o)=>s.seq-o.seq);return{entries:r.map(s=>({t:n,level:"info",source:"game-event",msg:s.event,tick:s.tick,simT:s.simT,meta:{seq:s.seq,...s.detail!==void 0?{detail:s.detail}:{}}})),lastSeq:r.at(-1)?.seq??e}}const Ne="data-vgai-replay-block",pe="data-vgai-replay-video",dn="https://replay-assets.invalid/",Wo=1e3,Vo=256*1024,qo=/data:image\/(?:png|jpeg|webp|gif|svg\+xml);base64,[a-zA-Z0-9+/=]+/g;function lt(t){const e=t.getBoundingClientRect();return{left:e.left,top:e.top,width:e.width,height:e.height}}function Ho(t){switch(t.toLowerCase()){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return null}}function Ko(t){const e=/^data:([^;,]+);base64,([\s\S]+)$/i.exec(t);if(!e)throw new Error("image data URL is not base64 encoded");const n=atob(e[2]),r=new Uint8Array(n.length);for(let s=0;s<n.length;s+=1)r[s]=n.charCodeAt(s);return new Blob([r],{type:e[1].toLowerCase()})}function Yo(t){const e=[];for(let n=t;n&&n!==document.body;n=n.parentElement){const r=n.parentElement;if(!r)break;for(const s of Array.from(r.children))s!==n&&!["STYLE","LINK","SCRIPT"].includes(s.tagName)&&!s.hasAttribute(Ne)&&(s.setAttribute(Ne,""),e.push(s))}return()=>{for(const n of e)n.removeAttribute(Ne)}}function Jo(t,e,n){if(n.format!=="canvas-dom"||n.replayPath===null)throw new Error("gameplay DOM recording requires a canvas-dom sink");const r=Yo(t),s=e.getAttribute(pe);e.setAttribute(pe,"");const o=()=>{r(),s===null?e.removeAttribute(pe):e.setAttribute(pe,s)},i=[],a=new Map,l=[];let p=0,u=0,f=0,d=0,c=0,h=null,E=Date.now(),v=null,S=Promise.resolve(),y=!1;const w=(b,z)=>{S=S.then(async()=>{if(!v)try{await z()}catch(re){const H=re instanceof Error?re.message:String(re);v=new Error(`${b}: ${H}`)}})},k=b=>{const z=a.get(b);if(z)return`${dn}${z}`;const re=/^data:([^;,]+)/i.exec(b)?.[1]??"",H=Ho(re);if(!H)return b;const Pe=`${String(c).padStart(6,"0")}.${H}`;return c+=1,a.set(b,Pe),w(`replay asset ${Pe}`,async()=>{const Ht=Ko(b);f+=Ht.size,await $r(n,Pe,Ht)}),`${dn}${Pe}`},_=b=>b.includes("data:image/")?b.replace(qo,k):b,T=()=>{if(i.length===0)return;const b=new Blob([`[${i.join(",")}]`],{type:"application/json"});i.length=0,p=0;const z=d;d+=1,w(`DOM event batch ${z}`,()=>Gr(n,z,b))};let D;try{D=se({emit(b){h??=b.timestamp;const z=JSON.stringify(b,(re,H)=>typeof H=="string"?_(H):H);i.push(z),p+=z.length,u+=1,p>=Vo&&T()},blockSelector:`[${Ne}], [${pe}]`,recordCanvas:!0,inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,sampling:{mousemove:!1,mouseInteraction:!1,scroll:100,canvas:15},errorHandler(b){return l.push(b instanceof Error?b.message:String(b)),!0}})}catch(b){throw o(),b}if(!D)throw o(),new Error("rrweb could not start the DOM recording");const N=t.ownerDocument.defaultView??window,L={width:N.innerWidth,height:N.innerHeight,dpr:N.devicePixelRatio},I=lt(t),fe=lt(e),st=se.mirror.getId(t),Tr=se.mirror.getId(e),Vt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{se.addCustomEvent("vgai-canvas-layout",{rect:lt(e),drawingWidth:e.width,drawingHeight:e.height,dpr:N.devicePixelRatio})});Vt?.observe(e),se.addCustomEvent("vgai-canvas-layout",{rect:fe,drawingWidth:e.width,drawingHeight:e.height,dpr:N.devicePixelRatio});const Pr=N.setInterval(T,Wo),qt=()=>{N.clearInterval(Pr),Vt?.disconnect(),o()};return{markVideoStarted(b){E=b},async stop(b){if(y)throw new Error("gameplay DOM recording is already stopped");if(y=!0,se.addCustomEvent("vgai-recording-stop",{}),D(),qt(),T(),await S,v)throw v;return{version:1,recorder:"rrweb@2.1.6",events:"events.json",assets:"assets/",video:b,videoStartEpochMs:E,firstEventEpochMs:h,viewport:L,surface:I,surfaceNodeId:st,canvas:{...fe,nodeId:Tr,drawingWidth:e.width,drawingHeight:e.height},eventCount:u,assetCount:a.size,assetBytes:f,rrwebErrors:l}},async abort(){y||(y=!0,D(),qt(),i.length=0,await S)}}}function Xo(){let t=null,e=!1,n=null;const r=`
3
+ let canvas;
4
+ onmessage = async ({data}) => {
5
+ const {bitmap, width, height, type, quality} = data;
6
+ try {
7
+ if (!canvas) canvas = new OffscreenCanvas(width, height);
8
+ if (canvas.width !== width) canvas.width = width;
9
+ if (canvas.height !== height) canvas.height = height;
10
+ const context = canvas.getContext('2d');
11
+ if (!context) throw new Error('No worker canvas context');
12
+ context.globalCompositeOperation = 'copy';
13
+ context.drawImage(bitmap, 0, 0, width, height);
14
+ bitmap.close();
15
+ const blob = await canvas.convertToBlob({type, quality});
16
+ postMessage({blob});
17
+ } catch (error) {
18
+ bitmap.close();
19
+ postMessage({error: error instanceof Error ? error.message : String(error)});
20
+ }
21
+ };
22
+ `;function s(o){const i=n;n=null,t?.terminate(),t=null,i?.reject(o)}return{encode(o,i,a,l,p){return e?Promise.reject(new Error("Recording preview encoder stopped")):n?Promise.reject(new Error("Recording preview already in flight")):new Promise((u,f)=>{const d={resolve:u,reject:f};n=d;try{if(!t){const c=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{t=new Worker(c)}finally{URL.revokeObjectURL(c)}t.onmessage=({data:h})=>{if(h.error||!h.blob){s(new Error(h.error??"No recording preview image"));return}const E=n;n=null,E?.resolve(h.blob)},t.onerror=h=>{h.preventDefault(),s(new Error(h.message||"Recording preview worker failed"))},t.onmessageerror=()=>s(new Error("Recording preview worker message failed"))}createImageBitmap(o).then(c=>{if(e||n!==d||!t){c.close();return}try{t.postMessage({bitmap:c,width:i,height:a,type:l,quality:p},[c])}catch(h){c.close(),s(h instanceof Error?h:new Error(String(h)))}},c=>{n===d&&s(c instanceof Error?c:new Error(String(c)))})}catch(c){s(c instanceof Error?c:new Error(String(c)))}})},dispose(){e=!0,s(new Error("Recording preview encoder stopped"))}}}let q=null;const fn=1,pn=60,Qo=30,Ze=2,Zo=1e3/Ze,et=12e4,ei=et/1e3*Ze,ti=256,ni="image/webp",ri=.72;function si(t,e){const n="'use strict';var t=null;onmessage=function(e){clearInterval(t);t=null;if(e.data&&e.data.ms>0){t=setInterval(function(){postMessage(0)},e.data.ms)}};";try{const r=URL.createObjectURL(new Blob([n],{type:"text/javascript"})),s=new Worker(r);URL.revokeObjectURL(r);let o=null;return s.addEventListener("error",i=>{i.preventDefault(),o===null&&(o=window.setInterval(e,t))}),s.addEventListener("message",()=>e()),s.postMessage({ms:t}),{stop(){s.postMessage({ms:0}),s.terminate(),o!==null&&window.clearInterval(o)}}}catch{const r=window.setInterval(e,t);return{stop(){window.clearInterval(r)}}}}function oi(t){const e=t??Qo;if(!Number.isFinite(e)||!Number.isInteger(e)||e<fn||e>pn)throw new Error(`gameplay recording fps must be an integer from ${fn} to ${pn}`);return e}function ii(t){const n=(t?["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm"]:["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"]).find(r=>MediaRecorder.isTypeSupported(r));if(!n)throw new Error("this browser exposes MediaRecorder but no WebM video codec");return n}function kt(){qr(q?.previewSnapshot??null)}function ct(t,e){t.previewSnapshot={startedAt:t.started.startedAt,width:t.started.width,height:t.started.height,liveEdgeMs:e,sampleFps:Ze,retentionMs:et,frames:[...t.previewFrames],previewError:t.previewError},q===t&&kt()}function ai(t){for(const e of t.previewFrames)URL.revokeObjectURL(e.src);t.previewFrames.length=0}function lr(t,e){if(t.stopping||t.previewEncoding||t.previewError||e<t.nextPreviewAt)return;t.nextPreviewAt=e+Zo;const n=Math.min(1,ti/Math.max(1,t.output.width)),r=Math.max(1,Math.round(t.output.width*n)),s=Math.max(1,Math.round(t.output.height*n));t.previewEncoding=!0;const o=new Date().toISOString(),i=t.nextPreviewSequence;t.nextPreviewSequence+=1;const a=t.previewEncoder.encode(t.output,r,s,ni,ri).then(l=>{if(t.stopping)return;if(!l){t.previewError="The browser could not encode recording previews.",ct(t,e);return}const p={sequence:i,mediaTimeMs:Math.max(0,Math.round(e)),capturedAt:o,src:URL.createObjectURL(l),width:r,height:s};for(t.previewFrames.push(p);t.previewFrames.length>ei||(t.previewFrames[0]?.mediaTimeMs??p.mediaTimeMs)<p.mediaTimeMs-et;){const u=t.previewFrames.shift();u&&URL.revokeObjectURL(u.src)}ct(t,p.mediaTimeMs)}).catch(l=>{t.stopping||(t.previewError=l instanceof Error?l.message:"The browser could not encode recording previews.",ct(t,e))}).finally(()=>{t.previewEncoding=!1});t.previewTask=a}function li(){if(q)throw new Error("a gameplay recording is already active; stop it before starting one");if(typeof MediaRecorder>"u")throw new Error("this browser does not support MediaRecorder gameplay capture")}function ci(t){t.stopping||t.drawing||performance.now()<t.nextFrameAt||(typeof document<"u"&&document.hidden&&(t.hidden=!0),t.drawing=!0,t.frameTask=(async()=>{const e=performance.now();try{if(t.options.refreshFrame?.(),t.started.format==="composite-webm"){const n=t.staging,r=t.overlayCache;if(!n||!r)throw new Error("gameplay recording: composite buffers unavailable");await Cn(t.container,n,{canvasFrame:t.options.canvasFrame,snapshots:t.snapshots,overlayCache:r});const{output:s}=t,o=s.getContext("2d");if(!o)throw new Error("gameplay recording: output context unavailable");s.width!==n.width&&(s.width=n.width),s.height!==n.height&&(s.height=n.height),o.globalCompositeOperation="copy",o.drawImage(n,0,0),o.globalCompositeOperation="source-over",lr(t,performance.now()-t.startedWallMs)}t.frames+=1}catch{t.frameErrors+=1}finally{t.drawing=!1;const n=performance.now()-e;t.nextFrameAt=e+Math.max(t.intervalMs/2,2*n)}})())}async function cr(t,e={}){li();const n=oi(e.fps),r=e.format??"composite-webm",s=t.ownerDocument.createElement("canvas"),o=e.audio??null;let i=null,a=null,l=null;const p=Vr(),u=Wr();try{const f=await Cn(t,s,{canvasFrame:e.canvasFrame,snapshots:p,overlayCache:u});if(f.canvases===0&&f.domOverlays===0)throw new Error("gameplay recording: no game layers are mounted");const d=Array.from(t.querySelectorAll("canvas")).filter(On);if(r==="canvas-dom"&&d.length!==1)throw new Error(`canvas-dom recording requires exactly one root canvas; this game has ${d.length}`);const c=r==="canvas-dom"?d[0]:s;if(typeof c.captureStream!="function")throw new Error("this browser cannot capture a canvas as a media stream");if(i=c.captureStream(n),o)for(const w of o.stream.getAudioTracks())i.addTrack(w);const h=ii(i.getAudioTracks().length>0),E=new MediaRecorder(i,{mimeType:h}),v=new Date().toISOString();a=await zr({startedAt:v,mimeType:h,name:e.name??null,format:r}),r==="canvas-dom"&&(l=Jo(t,c,a),u.dispose());const S={format:r,startedAt:v,mimeType:h,width:c.width,height:c.height,fps:n,audio:i.getAudioTracks().length>0,layers:f,path:a.path,replayPath:a.replayPath,rotates:a.rotates,logFile:a.logFile},y={started:S,recorder:E,output:c,staging:r==="composite-webm"?t.ownerDocument.createElement("canvas"):null,stream:i,audio:o,sink:a,startedWallMs:performance.now(),intervalMs:1e3/n,container:t,options:{canvasFrame:e.canvasFrame,refreshFrame:e.refreshFrame},clock:null,frameTask:null,drawing:!1,nextFrameAt:0,snapshots:p,overlayCache:r==="composite-webm"?u:null,domRecording:l,previewEncoder:Xo(),previewFrames:[],previewSnapshot:{startedAt:v,width:c.width,height:c.height,liveEdgeMs:0,sampleFps:Ze,retentionMs:et,frames:[],previewError:null},previewTask:null,previewEncoding:!1,previewError:null,nextPreviewAt:0,nextPreviewSequence:0,frames:1,frameErrors:0,hidden:typeof document<"u"&&document.hidden,recorderError:null,uploadError:null,uploads:Promise.resolve(),nextSequence:0,stopping:!1};return E.addEventListener("dataavailable",w=>{if(w.data.size===0||y.uploadError)return;const k=y.nextSequence;y.nextSequence+=1,y.uploads=y.uploads.then(async()=>{if(!y.uploadError)try{await Ur(y.sink,k,w.data)}catch(_){y.uploadError=_ instanceof Error?_:new Error(String(_))}})}),E.addEventListener("error",w=>{y.recorderError=w.error??new Error("gameplay recording failed")}),E.addEventListener("start",()=>{y.domRecording?.markVideoStarted(Date.now())}),E.start(1e3),q=y,kt(),r==="composite-webm"&&lr(y,0),y.clock=si(y.intervalMs,()=>ci(y)),S}catch(f){await l?.abort(),u.dispose(),a&&await kn(a);for(const d of i?.getTracks()??[])d.stop();throw o?.dispose(),f}}async function ur(t){const e=q;if(!e)throw new Error("no gameplay recording is active");e.stopping=!0,e.clock?.stop(),e.clock=null,await e.frameTask,e.previewEncoder.dispose(),await e.previewTask;let n=!1;try{if(e.recorder.state!=="inactive"){const l=new Promise(p=>{e.recorder.addEventListener("stop",()=>p(),{once:!0})});e.recorder.stop(),await l}if(e.recorderError)throw e.recorderError;if(await e.uploads,e.uploadError)throw e.uploadError;const r=Math.max(0,Math.round(performance.now()-e.startedWallMs)),s=Math.round(r/1e3*e.started.fps),o={...e.started,durationMs:r,droppedFrames:Math.max(0,s-e.frames),frameErrors:e.frameErrors,effectiveFps:r>0?Math.round(e.frames/(r/1e3)*10)/10:0,hidden:e.hidden},i=e.sink.path.split(/[\\/]/).at(-1)??"video.webm",a=await e.domRecording?.stop(i);return await Hr(e.sink,t??null,void 0,a?{...a,capture:{durationMs:o.durationMs,droppedFrames:o.droppedFrames,frameErrors:o.frameErrors,effectiveFps:o.effectiveFps,hidden:o.hidden,fps:o.fps,width:o.width,height:o.height,mimeType:o.mimeType,audio:o.audio}}:null),n=!0,o}finally{n||(await e.domRecording?.abort(),await kn(e.sink)),q=null,kt(),ai(e),e.overlayCache?.dispose();for(const r of e.stream.getTracks())r.stop();e.audio?.dispose()}}function Dt(){return q!==null}function ui(){return q?.started??null}function dr(t,e){return Math.max(0,Math.floor(e-t))}function di(){const t=q;return t===null?null:{startedAt:t.started.startedAt,elapsedMs:dr(t.startedWallMs,performance.now())}}const Va=Object.freeze(Object.defineProperty({__proto__:null,activeGameplayRecording:ui,activeGameplayRecordingTimeline:di,gameplayRecordingActive:Dt,recordingTimelineElapsedMs:dr,startGameplayRecording:cr,stopGameplayRecording:ur},Symbol.toStringTag,{value:"Module"})),Nt=12e4,fi=5e3,gn=["keydown","keyup","pointerdown","pointermove","wheel","touchstart","touchmove"];let x=null,Fe=null,hn=0,pi=null,fr=null;function gi(t){fr=t}function hi(){return!x||!Dt()?null:{path:x.started.path,format:x.started.format,replayPath:x.started.replayPath,startedAt:x.started.startedAt,rotates:x.started.rotates,logFile:x.started.logFile,idleAutoStopMs:Nt}}function pr(){x&&(x.lastActivityMs=Date.now())}function mi(){if(typeof window>"u")return()=>{};const t=()=>pr();for(const e of gn)window.addEventListener(e,t,{capture:!0,passive:!0});return()=>{for(const e of gn)window.removeEventListener(e,t,{capture:!0})}}async function qa(t,e={}){if(x&&await Ft("restart"),await Fe,!t)return M.warn("Play started, but gameplay recording did not: no game surface is mounted to record.","play-recording"),null;try{return x={started:await cr(t,{format:Array.from(t.querySelectorAll("canvas")).filter(On).length===1?"canvas-dom":"composite-webm",...e.name?{name:e.name}:{},...e.audio?{audio:e.audio}:{},...e.refreshFrame?{refreshFrame:e.refreshFrame}:{},...e.canvasFrame?{canvasFrame:e.canvasFrame}:{}}),lastActivityMs:Date.now(),poll:null,releaseInput:mi(),ending:!1},x.poll=window.setInterval(()=>{const r=x;!r||r.ending||Date.now()-r.lastActivityMs<Nt||wi()},fi),hi()}catch(n){return M.warn(`Play started, but gameplay recording did not: ${n instanceof Error?n.message:String(n)}`,"play-recording"),null}}async function Ft(t){const e=x;if(!e||e.ending)return Fe;if(e.ending=!0,e.poll!==null&&window.clearInterval(e.poll),e.releaseInput?.(),x=null,!Dt())return null;const n=++hn,r=(async()=>{try{const s=await ur(t);return pi=s,s}catch(s){return M.warn(`Gameplay recording could not be finalized: ${s instanceof Error?s.message:String(s)}`,"play-recording"),null}finally{hn===n&&(Fe=null)}})();return Fe=r,r}function yi(t){const e=Math.round(t.durationMs/100)/10;return`${t.path} — ${e}s at ${t.effectiveFps} fps${t.hidden?" (tab hidden; that is the cadence actually captured, not the requested one)":""}`}async function wi(){const t=Math.round(Nt/1e3),e=await Ft("idle-autostop");M.log(e===null?`Play auto-stopped after ${t}s with no session command and no player input.`:`Play auto-stopped after ${t}s with no session command and no player input. Recording finalized: ${yi(e)}`,"play-recording"),fr?.()}P().session.onCommandDispatched(()=>pr());const vi={source:"live",label:"live",detail:"Running DOM adopted from the playing game. Edits apply to this session only and are discarded when play stops."},mn="structure is owned by the running React tree — play edits are live-DOM only and are discarded on stop; stop play to change structure in source";function ut(t,e){const n=[];for(const r of Hs(t).nodes.values())r.oid===e&&n.push(r.el);return n}function yn(t){return t.style?t.style:null}function bi(t){return{writeStyle:async(e,n,r)=>{const s=ut(t,e);if(s.length===0)return{changed:!1,error:`no live element carries oid "${e}"`};for(const o of s){const i=yn(o);i&&(i[n]=r)}return{changed:!0,route:"live-dom"}},removeStyle:async(e,n)=>{const r=ut(t,e);if(r.length===0)return{changed:!1,error:`no live element carries oid "${e}"`};let s=!1;for(const o of r){const i=yn(o),a=i?.[n];i&&a!==void 0&&a!==null&&a!==""&&(delete i[n],s=!0)}return{changed:s,route:"live-dom"}},writeText:async(e,n)=>{const r=ut(t,e).filter(o=>o.children.length===0);if(r.length===0)return{changed:!1,error:`no live leaf element carries oid "${e}"`};const s=r[0]?.textContent??null;for(const o of r)o.textContent=n;return{changed:!0,prevText:s}},writeProp:async(e,n)=>({changed:!1,error:`prop "${n}" is owned by the running React element (its value lives at the parent call site, not in the DOM) — play edits are live-DOM only and are discarded on stop; stop play to change it in source`}),writeStruct:async()=>({changed:!1,error:mn}),writeStructMany:async()=>({changed:!1,error:mn})}}function Li(t,e){return new qs(t,e.shell,{writeBackend:bi(t),provenance:vi})}function gr(){return{id:"",journalSession:"",name:"",container:null,session:null,presentation:null,unregisterPerformanceSource:null,unsubscribeSystemAdapters:null,determinismDeclared:!1,resizeObserver:null,rootResources:[]}}const g=gr(),G=[];let we=[],Y=null;const bt=new Set;function jt(){return Y&&(Y===g.id||G.some(t=>t.id===Y))?Y:g.id}function Ha(){return g.id}function Ka(t){return bt.add(t),()=>bt.delete(t)}function Bt(){for(const t of bt)t()}function Ya(t){Nn(t),jt()!==t&&(Y=t,Bt())}function Lt(t){if(!A)return!1;const{store:e}=A;return e.shell.playState==="playing"&&e.shell.activeViewportTab==="play"&&jt()===t&&fs()}let A=null;const je=new Set;function Ei(){return A?Promise.resolve():new Promise((t,e)=>{const n=()=>{clearTimeout(r),je.delete(n),t()},r=setTimeout(()=>{je.delete(n),e(new Error("Play mode failed to start: the editor shell did not bind within 15 seconds."))},15e3);je.add(n)})}const Et=new Set,qe=new Set;let He=null;function hr(){return He}function Ja(t){return qe.add(t),()=>qe.delete(t)}function Si(t){He=t;for(const e of qe)e();P().live.notifyChanged()}const dt=new Set;function _i(){if(dt.size>0){const t=[...dt].map(e=>({severity:"warn",message:e}));dt.clear(),as("console-resolved",{conditions:t,by:"play-mode"})}if(He!==null){He=null;for(const t of qe)t();P().live.notifyChanged()}}function tt(){wr();for(const t of Et)t()}function Xa(t){return Et.add(t),()=>Et.delete(t)}let R=0,$t=null,Ke=null;Cs();let Be;function Oe(t){const e={...t.capabilities,persist:!1},n=As(),r=()=>gs({resolve:()=>hs("play edits are session-local by architecture",ms),record:()=>{}}),s=t.transforms,o=s&&{...s,get:l=>s.get(l),beginEdit:l=>s.beginEdit(l),apply:(l,p)=>s.apply(l,p),endEdit:l=>(s.endEdit(l),r()),...s.remove?{remove:()=>r()}:{}},i=t.inspector,a=i&&{...i,properties:l=>i.properties(l),get:(l,p)=>i.get(l,p),set:(l,p,u)=>(i.set(l,p,u),r()),...i.remove?{remove:()=>r()}:{}};return new Proxy(t,{get(l,p){if(p==="capabilities")return e;if(p==="persistence")return n;if(p==="transforms"&&o)return o;if(p==="inspector"&&a)return a;const u=Reflect.get(l,p,l);return typeof u=="function"?u.bind(l):u}})}function Mi(){Be!==void 0&&(Wn(Be),Be=void 0)}async function Ti(t,e,n,r,s){Be=vs();const o=[],i=[],a=()=>{for(const u of i)"dispose"in u&&typeof u.dispose=="function"&&u.dispose()};for(const u of e){const f=n?ls(n,u.id):void 0,d=f?{zOrder:f.zOrder,pausable:f.pausable,...f.entry?{content:`Entry · ${f.entry}`}:{}}:{};if(f?.adapter.identity==="ingest-react"){o.push({worldId:u.id,kind:u.kind,adapter:new Yt(t.shell,{id:u.id,kind:u.kind,adapter:f.adapter.identity,entryOrScenePath:f.entry,zOrder:f.zOrder,pausable:f.pausable}),...d});continue}const c=u.mounted;if(c.kind==="three"){const h=It(c).scene,E=u.id===r&&h===t.scene,v=E?await Gs():void 0;if(!s()){a();return}const S=E?zs(t,h,Bs(u.id),ft(u.id),{explicitSourceCommit:!0,sourceAnchor:v}):Us(t,h,{frameControl:"host",journal:ft(u.id)});i.push(S),o.push({worldId:u.id,kind:u.kind,adapter:Oe(S),...d})}else if(c.kind==="canvas"){if(c.substrate.name==="babylon"){const{BabylonAuthoringAdapter:I}=await $(async()=>{const{BabylonAuthoringAdapter:st}=await import("./babylon-authoring-adapter-Cg5ALSpr.js");return{BabylonAuthoringAdapter:st}},__vite__mapDeps([23,18,2,3,4,10,19,6,20,5,21,24,25,26]));if(!s()){a();return}const fe=new I(c.substrate.root,t,{canvas:c.canvas,api:c.substrate.api,provenance:{source:"live",label:"live",detail:"Native Babylon.js play scene; ordinary Play edits are ephemeral."}});i.push(fe),o.push({worldId:u.id,kind:u.kind,adapter:Oe(fe),...d});continue}if(c.substrate.name!=="pixi"){const I=new Yt(t.shell,{id:u.id,kind:u.kind,adapter:c.substrate.name,entryOrScenePath:f?.entry,zOrder:f?.zOrder??0,pausable:f?.pausable??!0},`No authoring adapter is registered for canvas substrate "${c.substrate.name}".`);i.push(I),o.push({worldId:u.id,kind:u.kind,adapter:I,...d});continue}const h=c.substrate.root,[E,v,S,y,w]=await Promise.all([$(()=>import("./physics-registry-B2Jkp8e6.js"),[]),$(()=>import("./system-adapters-rIC8FSGP.js"),[]),$(()=>import("./pixi-authoring-adapter-B42K4md-.js").then(I=>I.p),__vite__mapDeps([27,28,18,2,3,4,10,19,6,20,5,21,25,26,29,30,31,24,32])),$(()=>import("./pixi-live-write-target-D56tQEe_.js"),__vite__mapDeps([33,18,2,3,4,10,19,6,20,5,21,24,25,26,32])),$(()=>import("./canvas-entry-runtime-DVeh71nC.js"),__vite__mapDeps([34,18,2,3,4,10,19,6,20,5,21,35]))]);if(!s()){a();return}const{createPhysics2DRegistry:k}=E,{createPhysicsAdapter2D:_}=v,{PixiAuthoringAdapter:T}=S,{createLiveCanvasWriteTarget:D}=y,N=_(u.physics2d??k()),L=new T(h,t,{pixi:await w.resolveCanvasPixiForEditor(),target:D({physics:N}),journal:ft(u.id),surface:Ii});i.push(L),o.push({worldId:u.id,kind:u.kind,adapter:Oe(L),...d})}else if(c.kind==="dom"){const h=Li(c.container,t);i.push(h),o.push({worldId:u.id,kind:u.kind,adapter:Oe(h),...d})}else $s(c,"installPlayRootAuthoring")}if(!s()){a();return}g.rootResources=i;const l=cs(Xe()?.config),p=new us(o,void 0,l);Wn(p),t.shell.notifyIngestEdit()}function ft(t){return Kn(g.id,t)}function Pi(t){for(const e of g.rootResources)"dispose"in e&&typeof e.dispose=="function"&&e.dispose();g.rootResources=[],g.journalSession&&(t.shell.projectHistory?.expireSession(g.journalSession),g.journalSession="")}function Ai(t){return!(t.defaultPrevented||ws(t.target))}let ve=null,be=null,Le=null,Ee=null,Se=null,J=Promise.resolve(),$e=null,Z=[],Ge=0;function mr(){const t=g.session?.game;if(!t)return{};const e=t.roots,n=g.presentation?.worldId??(e.length===1?e[0]?.id:void 0),r=t.loop.timeScale;return{...n!==void 0?{world:n}:{},...typeof r=="number"?{simSpeed:r}:{}}}function St(){const t=g.session?.game?.systemAdapters?.debug;if(t)try{const e=Uo(t.events(Ge),Ge);Ge=e.lastSeq;const n=mr();for(const r of e.entries)Z.push({...r,...n})}catch{}}Zr(t=>{Qs(t),g.session&&Si("Project assets changed — restart play to load the revised models or textures.")});function Ii(){return P().workspace.liveDocument.container()}function xi(){const t=()=>{const e=P().workspace.liveDocument.container();if(!e)return;const n=typeof document<"u"?document.activeElement:null;n instanceof HTMLElement&&n!==e&&n.tagName==="BUTTON"&&n.blur(),e.hasAttribute("tabindex")||(e.tabIndex=-1);try{e.focus({preventScroll:!0})}catch{}ps("viewport")};t(),setTimeout(t,150),setTimeout(t,600)}Ks(t=>Ri(t));function Ri(t){A={store:t,gameContainer:null},gi(ae);for(const e of je)e()}function ze(){return g.session!==null}function ke(){const t=g.session?.game;if(!t)return null;const e=Qe(t),n=e?.getRunTicksTarget()??null;return{getInputTarget:r=>e?.getVirtualInputTarget(r)??null,loop:t.loop,runTicks:n?n.runTicks.bind(n):null,runTicksSettled:e&&n?(r,s)=>Do(e,r,s):null,random:_s(t),determinismDeclared:g.determinismDeclared}}function Qa(){const t=g.session?.game.defaultRoot.mounted;return t?.kind==="three"?It(t).scene:null}function Za(){const t=g.session?.game?.roots;return t?t.map(e=>{const n=e.mounted;let r=!1;if(n.kind==="three")r=Ns(It(n).scene);else if(n.kind==="canvas")try{r=n.substrate.name==="pixi"?Ds(n.substrate.root):n.substrate.name==="babylon"?(n.substrate.root.scenes??[]).some(s=>(s.rootNodes?.length??0)>0):!1}catch{r=!1}else r=Fs(n.container);return{rootId:e.id,kind:n.kind,hasRenderableContent:r}}):[]}function Ci(){return g.session?Dn(P().workspace.liveDocument.container()).canvas:null}function Oi(t){return!t||t===g.id?P().workspace.liveDocument.container():G.find(e=>e.id===t)?.container??null}function el(t){if(!t||t===g.id)return Ci();const e=G.find(n=>n.id===t);return e?.session?Dn(e.container).canvas:null}function yr(){return $t}function ki(){return Ke}function ne(){return[g,...G].filter(t=>t.session)}const De=new Set;function wr(){const t=new Set(ne().map(e=>e.session.game.loop));for(const e of De)t.has(e)||De.delete(e);for(const e of t)Is()?De.delete(e)&&e.start():e.liveness!=="stopped"&&(De.add(e),e.stop())}xs(wr);function wn(){const t=ne(),e=ys();return t.find(n=>n.id===e)??t[0]??null}let Ye=null;function Di(){Ye?.(),Ye=ds(()=>({projectName:Xe()?.config.name??null,instanceName:ne().length>1?wn()?.name??null:null})),Vn(()=>{const t=wn();return t?.session?{game:t.session.game,instanceId:t.id,recording:bs}:null})}function Ni(){Ye?.(),Ye=null,Vn(null)}function tl(t,e,n){for(const r of ne())r.session?.resize(t,e,n)}let vn=Promise.resolve(),nt=null,Gt=null;function nl(){return nt}function Fi(){const t=globalThis.crypto?.randomUUID?.()??`private-${Date.now()}`;return{mode:"private",id:t,roomKey:`private:${t}`,revision:null,participantId:Xr}}function bn(t,e=Fi(),n,r){const s=r??null,o=vn.then(()=>(Yr(),Bi(t,e,n??null,s).finally(()=>{Jr()})));return vn=o.then(()=>{},()=>{}),o}async function ji(t){const{autoLaunchIngest:e}=await $(async()=>{const{autoLaunchIngest:s}=await import("./mount-ingest-root-BC3-1Cw1.js").then(o=>o.m);return{autoLaunchIngest:s}},__vite__mapDeps([36,18,2,3,4,10,19,6,20,5,21,37,38,39,26,40,41,42,43,7,8,44,45,31,30,46,47]));await e(t);const n=ks();if(n)return n.play(),!0;const{isModuleModeActive:r}=await $(async()=>{const{isModuleModeActive:s}=await import("./module-mode-B79jV5tQ.js");return{isModuleModeActive:s}},__vite__mapDeps([48,18,2,3,4,10,19,6,20,5,21,39,38,49,50,51,35,40,52,53,8,54,9,7,11,55,34,56,57,58,59,44,60,61,62]));return r()}function pt(t,e){return X(t),zo(t,e,{isHidden:()=>typeof document<"u"&&document.hidden,editorUrl:typeof window<"u"?window.location.href:void 0})}async function Bi(t,e,n,r){if(!A){const d=R;if(X("waiting for the editor to bind Play"),await Ei(),R!==d)throw new Error("Play start cancelled while waiting for the editor to bind.")}if(!A)throw new Error("Play mode failed to start: the editor shell is not bound.");if(X("waiting for the project bootstrap to settle"),await es(),g.session&&ae(),Gt=r,await ji(A.store)||await Ws(A.store))return;const s=++R;nt=e,$t=Date.now(),Ke=null;const{store:o}=A;Hi();const i=J.then(()=>Js(n));if(J=i,await pt("starting the play log session",i),s!==R||(Z=[],Ge=0,M.setSink(d=>{let c;try{const h=g.session?.game?.systemAdapters.debug?.state("time");typeof h?.tick=="number"&&typeof h.simSeconds=="number"&&(c={tick:h.tick,simT:h.simSeconds})}catch{}Z.push({t:d.timestamp,level:d.level,msg:d.message,...d.source?{source:d.source}:{},...d.subsystem?{sub:d.subsystem}:{},...d.metadata?{meta:d.metadata}:{},...c??{},...mr()})}),$e=setInterval(()=>{if(St(),Z.length>0){const d=Z.splice(0);J=J.then(()=>Qn(d))}},200),ve=d=>{d.key==="Escape"&&Ai(d)&&ae()},window.addEventListener("keydown",ve),X("opening the Game document"),await P().workspace.liveDocument.acquire(),s!==R))return;const a=P().workspace.liveDocument.container();if(!a){const d="Play mode failed to start: the game container is not mounted in the workspace.";throw M.error(d,"play-mode"),ae(),new Error(d)}const l=a.clientWidth,p=a.clientHeight;a.style.contain||(a.style.cssText+=Xn),Fn(a),ht(a),P().viewport.transition.begin(),o.shell.setPlayState("playing"),xi(),M.log("Play mode started","play-mode"),P().viewport.transition.onSettled(()=>{s===R&&o.shell.playState==="playing"&&ts()});let u=null,f=null;try{const d=Xe();if(!d)throw new Error("No project open — open or create a project first");const c=await pt("fetching the project manifest",jn());we=Ae(c).map(L=>L.id);for(const L of we)Kt({rootId:L,mechanism:"host-mount",source:"declared",state:"waiting"});let h;Bn();const{entries:E,mountId:v}=await pt("resolving the project's root entries",Yn(c,d.rootPath,{selectionOverride:r??void 0}));if(M.log(`Resolved manifest composition (${Ae(c).length} world${Ae(c).length===1?"":"s"}): `+Ae(c).map(L=>`${L.id} (${L.surface})`).join(", "),"play-mode"),s!==R)return;const S=a.clientWidth||l,y=a.clientHeight||p;ht(a,v),u=v,X("mounting the runtime roots");const{mountManifestRoots:w}=await $(async()=>{const{mountManifestRoots:L}=await import("./mount-manifest-QJOB11Kv.js");return{mountManifestRoots:L}},__vite__mapDeps([63,52,18,2,3,4,10,19,6,20,5,21,64,65,66,67,68,69,7,8,70,71,72,73,74,75,76,77,35,78,79,80,81,82,83,84,85,50,51,40,38,86,87,9,11,88,39,89,24,49,53,54,55,34,56,57,58,59,44,60,61,62,90,37,26,91,92,93,94,46,30,31,47,95,45,29,96,97,25,98,99,100,101,102,103,104,105,106,107,108,109,110,111,41,42,43,112]));if(h=await w({manifest:c,container:a,entries:E,width:S,height:y,seed:t,playtest:e}),f=h,s!==R){h.stop(),Te(h,v,"Cancelled instance");return}for(const L of $n(d.rootPath))M.error(Gn(L),"play-mode");for(const L of we)Kt({rootId:L,mechanism:"host-mount",source:"declared",state:"ready"});if(Zn(h.game),g.session=h,g.id=v,g.journalSession=Kn(v,"").session,g.name=vr(0),g.unregisterPerformanceSource?.(),g.unregisterPerformanceSource=zn({id:"workspace:game",label:"Game runtime",kind:"game",instanceId:v,profiler:h.game.profiler}),_i(),g.determinismDeclared=c.determinism?.seededRandom===!0,c.configurations.some(L=>L.kind==="process")&&Qe(h.game)?.setRoomDeclared(!0),tt(),o.shell.setPlayEditRegime("ephemeral"),g.presentation=Ys(h.game.roots)??js(o,h.game.roots),X("installing play authoring for each root"),await Ti(o,h.game.roots,c,g.presentation?.worldId??null,()=>s===R),s!==R)return;X("binding the editor to the running game");const k=h.game.systemAdapters;Me(k,v),Nn(v),Di(),g.unsubscribeSystemAdapters?.(),g.unsubscribeSystemAdapters=h.game.subscribeSystemAdapters?.(()=>{Un(h.game.systemAdapters,v)})??null,Ve(()=>Lt(v),v),Ve(()=>Lt(jt()));const _=Rn(k.physics);o.setEcsSyncTransform((L,I)=>{!_||_.ownerOf(L)==="unresolved"||_.commit(L,{position:I.position.toArray(),rotation:I.quaternion.toArray(),scale:I.scale.toArray()})});const T=Fo(),D=a.clientWidth,N=a.clientHeight;D>0&&N>0&&(D!==l||N!==p||T!==null)&&h.resize(D,N,T??void 0),P().viewport.transition.ready(()=>{const L=g.session?.game;if(!L)return null;for(const I of L.roots)if(I.mounted.kind==="three")return I.mounted.camera;return null})}catch(d){const c=`Play mode failed to start: ${d}`;if(M.error(c,"play-mode"),u!==null&&g.id!==u)if(f){try{f.stop()}catch(h){M.error(`Error stopping the failed play session: ${h}`,"play-mode")}Te(f,u,"Failed instance")}else rt(u,"Failed instance");throw s===R&&ae(),new Error(c)}}async function rl(t,e){if(!A)throw new Error("Cannot mount an additional instance: play mode is not bound.");if(!g.session)throw new Error("Cannot mount an additional instance: no primary play session is running.");const n=R,r=Xe();if(!r)throw new Error("Cannot mount an additional instance: no project is open.");const s=await jn();Bn();const{entries:o,mountId:i}=await Yn(s,r.rootPath,{selectionOverride:Gt??void 0});t.style.contain||(t.style.cssText+=Xn),Fn(t),ht(t,i);const{mountManifestRoots:a}=await $(async()=>{const{mountManifestRoots:d}=await import("./mount-manifest-QJOB11Kv.js");return{mountManifestRoots:d}},__vite__mapDeps([63,52,18,2,3,4,10,19,6,20,5,21,64,65,66,67,68,69,7,8,70,71,72,73,74,75,76,77,35,78,79,80,81,82,83,84,85,50,51,40,38,86,87,9,11,88,39,89,24,49,53,54,55,34,56,57,58,59,44,60,61,62,90,37,26,91,92,93,94,46,30,31,47,95,45,29,96,97,25,98,99,100,101,102,103,104,105,106,107,108,109,110,111,41,42,43,112])),l=await a({manifest:s,container:t,entries:o,width:t.clientWidth,height:t.clientHeight,playtest:nt});for(const d of $n(r.rootPath))M.error(Gn(d),"play-mode");if(n!==R||!g.session){try{l.stop()}catch{}return Te(l,i,e?.trim()||"Cancelled instance"),i}Zn(l.game);const p=gr();p.id=i,p.name=e?.trim()||vr(G.length+1),p.container=t,p.session=l,p.unregisterPerformanceSource=zn({id:`workspace:game:${i}`,label:`Game runtime (instance ${i})`,kind:"game",instanceId:i,profiler:l.game.profiler});const u=l.game.systemAdapters;Me(u,i),p.unsubscribeSystemAdapters=l.game.subscribeSystemAdapters?.(()=>{Un(l.game.systemAdapters,i)})??null,Ve(()=>Lt(i),i),G.push(p);const f=g.session.game.systemAdapters;return Me(f,g.id),tt(),i}function $i(){return G.map(t=>t.id)}function sl(){const t=[];g.id&&t.push({id:g.id,name:g.name});for(const e of G)e.id&&t.push({id:e.id,name:e.name});return t}function Gi(t){return g.id===t?g.name:G.find(e=>e.id===t)?.name}function rt(t,e){t&&(Jn(t),Rs(t,e))}function Te(t,e,n){t.stopComplete.then(()=>rt(e,n))}function zi(t){const e=G.findIndex(s=>s.id===t);if(e<0)return;const[n]=G.splice(e,1);if(!n)return;n.unsubscribeSystemAdapters?.(),n.unsubscribeSystemAdapters=null;const r=n.session;try{r?.stop()}catch(s){M.error(`Error stopping additional instance ${n.id}: ${s}`,"play-mode")}n.unregisterPerformanceSource?.(),Me(null,n.id),r?Te(r,n.id,n.name):rt(n.id,n.name),n.container=null,n.session=null,Y===t&&(Y=null,Bt()),tt()}function Ui(){for(const t of $i())zi(t)}let ce=[];const _t=new Set;function zt(t){if(t===0){const e=Qr()?.getPlayerIdentity?.()?.name?.trim();if(e)return e}return`Instance ${t+1}`}function ol(){return ce.length===0?0:ce.length-1}function vr(t){return ce[t]??zt(t)}function il(t){return _t.add(t),()=>_t.delete(t)}function Wi(){for(const t of _t)t()}function Vi(t){const e=Math.max(0,Math.floor(t));qi(e===0?[]:Array.from({length:e+1},(n,r)=>zt(r)))}function qi(t){const e=t.length<=1?[]:t.map((n,r)=>n?.trim()?n.trim():zt(r));e.length===ce.length&&e.every((n,r)=>n===ce[r])||(ce=e,Wi())}function ae(){if(R++,Kr(),!A||(Ft("teardown"),Ni(),Gt=null,Vs(A.store)))return;nt=null,Y=null,Bt();const{store:t}=A;St(),Vi(0),Ui(),P().viewport.transition.end(),t.setEcsSyncTransform(null);const e=g.id,n=g.name||"Game instance";g.id="",g.unsubscribeSystemAdapters?.(),g.unsubscribeSystemAdapters=null,Me(null,e),g.presentation?.dispose(),g.presentation=null,Pi(t),Mi(),t.shell.setPlayEditRegime(null);const r=g.session;if(r)try{r.stop()}catch(s){M.error(`Error stopping play session: ${s}`,"play-mode")}finally{g.unregisterPerformanceSource?.(),g.unregisterPerformanceSource=null,g.session=null,g.determinismDeclared=!1,tt()}r?Te(r,e,n):rt(e,n);for(const s of we)ns(s);if(we=[],Ve(()=>!0),Jn(),g.resizeObserver?.disconnect(),g.resizeObserver=null,ve&&(window.removeEventListener("keydown",ve),ve=null),M.log("Play mode stopped","play-mode"),rs(),$e&&(clearInterval($e),$e=null),St(),M.setSink(null),Z.length>0){const s=Z.splice(0);J=J.then(()=>Qn(s))}J=J.then(()=>Xs()),Ki(),t.shell.setPlayState("stopped"),P().workspace.liveDocument.release(),$t!==null&&Ke===null&&(Ke=Date.now())}function al(){if(!(!g.session||!A)){for(const t of ne())t.session?.pause();A.store.shell.setPlayState("paused"),M.log("Play mode paused","play-mode")}}function ll(){if(!(!g.session||!A)){for(const t of ne())t.session?.resume();A.store.shell.setPlayState("playing"),M.log("Play mode resumed","play-mode")}}function cl(){if(g.session)for(const t of ne())t.session?.step()}function Hi(){ss(),be=console.log,Le=console.info,Ee=console.warn,Se=console.error;const t=(e,n)=>{if(yt)return;const r=Os();M.logStructured(e,is(n),"game",void 0,r?{instanceId:r,instanceName:Gi(r)??`Instance ${r}`}:void 0)};console.log=(...e)=>{be?.apply(console,e),t("info",e)},console.info=(...e)=>{Le?.apply(console,e),t("info",e)},console.warn=(...e)=>{Ee?.apply(console,e),t("warn",e)},console.error=(...e)=>{Se?.apply(console,e),t("error",e)}}function Ki(){os(),be&&(console.log=be),Le&&(console.info=Le),Ee&&(console.warn=Ee),Se&&(console.error=Se),be=null,Le=null,Ee=null,Se=null}P().live.register({id:"play",priority:0,mounted:ze,playing:ze,stop:ae,instanceContainer:t=>Oi(t),startedAt:yr,endedAt:ki,restartRequired:hr,restart:()=>void bn(),remount:async t=>{try{return await bn(void 0,void 0,void 0,t),ze()?{ok:!0}:{ok:!1,error:"Play did not start: the remount was superseded before it finished booting."}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}});P().session.reportFacet(()=>({timeScale:ke()?.loop.timeScale??null,loopLiveness:ke()?.loop.liveness??null,restartRequired:hr(),seed:ke()?.random?.seed??null,deterministic:ke()?.determinismDeclared??!1}));const br=10,Yi=11,Lr=12,Ut=13,Ji=14,Xi=15,Er=17,Wt=18,Ln=2e3,W=[],Mt=new WeakMap,En=new WeakMap,_e=new WeakMap;let Tt={latencyMs:0,jitterMs:0,packetLoss:0};function Sn(t,e,n){const{latencyMs:r,jitterMs:s}=Tt,o=performance.now(),i=e==="in"?t.dueIn:t.dueOut;if(r<=0&&s<=0&&i<=o){n();return}const a=Math.max(i,o+r+Math.random()*s);e==="in"?t.dueIn=a:t.dueOut=a,setTimeout(n,a-o)}const Ue=new Map,ge=[];let _n=0;const Pt=new Set;let ee={start:0,msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0},he={msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0};function V(){for(const t of Pt)t()}function Sr(t){const e=t-ee.start;e<1e3||(he=e<2e3?{...ee}:{msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0},ee={start:t,msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0})}let de=!1;const Qi="networkProfilerAutostart";let Mn;function Zi(t){const e=new Map,n=(r,s)=>{if(!r||typeof r!="object"||e.has(r))return;e.set(r,s);const o=r.constructor?.[Symbol.metadata];if(o){for(const i of Object.keys(o)){const a=/^\d+$/.test(i)?o[i]?.name:void 0;a&&n(r[a],[...s,a])}return}r.forEach?.((i,a)=>n(i,[...s,String(a)]))};return n(t,[]),e}function ea(t,e,n){if(!de||e.length===0)return;const r=Zi(t.serializer?.getState()),s=new Map;for(const o of e){const i=[...r.get(o.ref)??[],String(o.dynamicIndex??o.field)],a=i.slice(0,i.length>1?2:1).join(".");s.set(a,(s.get(a)??0)+1)}for(const[o,i]of s){let a=t.entities.get(o);a||(a={path:o,syncs:0,changes:0,patchBytesMin:n,patchBytesMax:n},t.entities.set(o,a)),a.syncs+=1,a.changes+=i,a.patchBytesMin=Math.min(a.patchBytesMin,n),a.patchBytesMax=Math.max(a.patchBytesMax,n)}}function F(t,e,n,r,s){if(!de)return;const o=Date.now();Sr(o),e==="in"?(ee.msgsIn+=1,ee.bytesIn+=r):(ee.msgsOut+=1,ee.bytesOut+=r);let i=t.types.get(n);i||(i={type:n,countIn:0,countOut:0,bytesIn:0,bytesOut:0},t.types.set(n,i)),e==="in"?(i.countIn+=1,i.bytesIn+=r):(i.countOut+=1,i.bytesOut+=r),s!==void 0&&(i.last=s),_n+=1,ge.push({seq:_n,time:performance.now(),direction:e,type:n,size:r}),ge.length>Ln&&ge.splice(0,ge.length-Ln)}function Je(t,e){const n=t;return Q.stringCheck(n,e)?Q.string(n,e):String(Q.number(n,e))}function ta(t,e){const n=e[0],r={offset:1},s=e;try{if(n===br)Q.utf8Read(s,r,e[r.offset++]),Q.utf8Read(s,r,e[r.offset++])==="schema"&&!t.serializer&&(t.serializer=new Ir,e.byteLength>r.offset&&t.serializer.handshake(e,r)),t.state="connected",t.joinedAt??=Date.now(),F(t,"in","join",e.byteLength);else if(n===Yi){const o=Q.number(s,r),i=Q.string(s,r);t.error=`${o}: ${i}`,t.state="error",F(t,"in","error",e.byteLength)}else if(n===Lr)F(t,"in","leave",e.byteLength);else if(n===Ji)t.serializer?.setState(e,r),t.stateBytes=e.byteLength,F(t,"in","state",e.byteLength);else if(n===Xi){const o=t.serializer?.decoder;let i=[];o&&(o.triggerChanges=a=>i=a),t.serializer?.patch(e,r),ea(t,i,e.byteLength),de&&(t.patches+=1,t.patchBytes+=e.byteLength),F(t,"in","patch",e.byteLength)}else if(n===Ut){const o=Je(e,r),i=e.byteLength>r.offset?An(e,{start:r.offset}):void 0;F(t,"in",o,e.byteLength,i)}else if(n===Er)F(t,"in",Je(e,r),e.byteLength);else if(n===Wt){t.pingSentAt!==null&&(t.rttMs=Math.round(performance.now()-t.pingSentAt)),t.pingSentAt=null;const o=_e.get(t);_e.delete(t),o&&t.rttMs!==null&&o(t.rttMs),F(t,"in","ping",e.byteLength)}}catch(o){t.error||(t.error=`the editor could not read a frame (code ${n}): ${String(o)}`)}V()}function na(t,e){const n=e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null;if(!n||n.byteLength===0)return;const r=n[0],s={offset:1};try{if(r===Ut){const o=Je(n,s),i=n.byteLength>s.offset?An(n,{start:s.offset}):void 0;F(t,"out",o,n.byteLength,i)}else r===Er?F(t,"out",Je(n,s),n.byteLength):r===Wt?(t.pingSentAt=performance.now(),F(t,"out","ping",n.byteLength)):r===br?F(t,"out","join",n.byteLength):r===Lr&&F(t,"out","leave",n.byteLength)}catch{}V()}function ra(t){let e;try{e=new URL(t,location.href)}catch{return null}const n=e.searchParams.get("sessionId"),r=e.pathname.split("/").filter(Boolean);if(!n||r.length<2)return null;const s=r[r.length-1];return{processId:r[r.length-2],roomId:s,sessionId:n,endpoint:`${e.protocol}//${e.host}`}}function sa(t,e){const n=ra(e);if(!n)return;const r={...n,state:"connecting",joinedAt:null,closedAt:null,closeCode:null,error:null,serializer:null,pingSentAt:null,rttMs:null,stateBytes:0,patches:0,entities:new Map,patchBytes:0,types:new Map,socket:t,dueIn:0,dueOut:0,receive:null},s=ze()?yr():null,o=!W.some(a=>a.state==="connected"||a.state==="connecting");(s!==Mn||s===null&&o)&&(Mn=s,de=P().projectLocalState.read(Qi)??!1),W.push(r),Mt.set(t,r),t.addEventListener("message",a=>{Sn(r,"in",()=>{a.data instanceof ArrayBuffer&&ta(r,new Uint8Array(a.data)),r.receive?.(a)})}),t.addEventListener("close",a=>{r.state="disconnected",r.closedAt=Date.now(),r.closeCode=a.code,V()}),t.addEventListener("error",()=>{r.state="error",r.error??="the socket reported an error",V()});const i=t.send.bind(t);t.send=a=>{na(r,a),Sn(r,"out",()=>{t.readyState===t.OPEN&&i(a)})},V()}function oa(t,e){const n=typeof t=="string"?t:t instanceof URL?t.href:t.url;/\/matchmake\//.test(n)&&e.clone().json().then(r=>{const s=r.room??r;typeof s.roomId=="string"&&typeof s.name=="string"&&(Ue.set(s.roomId,s.name),V())}).catch(()=>{})}function ul(){const t=window;if(t.__vgaiNetworkObserver)return;t.__vgaiNetworkObserver=!0;const e=window.WebSocket;if(typeof e=="function"){const r=class extends e{constructor(s,o){super(s,o),sa(this,String(s))}set onmessage(s){const o=Mt.get(this);if(!o){super.onmessage=s;return}En.set(this,s),o.receive=s?i=>s.call(this,i):null}get onmessage(){return Mt.has(this)?En.get(this)??null:super.onmessage}};window.WebSocket=r}const n=window.fetch;typeof n=="function"&&(window.fetch=async(r,s)=>{const o=await n(r,s);return oa(r,o),o})}function _r(t){if(typeof t=="string")return t;if(typeof t=="function")return"schema";if(t&&typeof t=="object"){const[e,n]=Object.entries(t)[0]??[];if(e)return`${e}<${_r(n)}>`}return"unknown"}function ia(t,e){let n=t,r=null,s=null;for(const o of e){if(n==null)return null;const i=n.constructor?.[Symbol.metadata];if(i&&typeof i[o]=="number")s=i[i[o]]?.type??null,r=s&&typeof s=="object"?Object.values(s)[0]:null,n=n[o];else{s=r,r=null;const a=n;n=a.get?a.get(String(o)):a.at?a.at(Number(o)):void 0}}return s===null?null:_r(s)}function Mr(t){return`${t.endpoint.replace(/^ws/,"http")}/monitor/api`}async function Tn(t){const e=await fetch(t).catch(()=>null);return!e||!e.ok?null:await e.json().catch(()=>null)}async function oe(t,e,n,r){const s=j();if(!s)throw new Error("No room is observed.");const o=new URLSearchParams({roomId:r??s.roomId,method:t,args:JSON.stringify(e)}),i=await fetch(`${Mr(s)}/room/call?${o}`);if(i.status===404)throw new Error(`The room server serves no Monitor view, so ${n} has nowhere to go (its \`server\` configuration sets VGAI_ROOM_MONITOR=1).`);if(!i.ok)throw new Error(`The room server refused ${n} (${i.status}).`)}function j(){for(let t=W.length-1;t>=0;t-=1)if(W[t].state!=="disconnected")return W[t];return W[W.length-1]??null}function aa(t){const e=t?.serializer?.getState();return e?.toJSON?e.toJSON():e}function Pn(){return Sr(Date.now()),{msgsInPerSec:he.msgsIn,msgsOutPerSec:he.msgsOut,bytesInPerSec:he.bytesIn,bytesOutPerSec:he.bytesOut}}const la={peers(){return W.filter(t=>t.state==="connected").map(t=>({id:t.sessionId,label:`${Ue.get(t.roomId)??t.roomId} (this client)`}))},networkId:()=>null,authority:()=>"server",editable:()=>!1,getConnectionState(){return j()?.state??"disconnected"},getRoomInfo(){const t=j();return t?{roomId:t.roomId,sessionId:t.sessionId,roomName:Ue.get(t.roomId)??""}:null},getReplicationStats(){const e=j()?.serializer?.decoder?.root?.refs,n=Pn();return{entities:e?.size??0,msgsInPerSec:n.msgsInPerSec,msgsOutPerSec:n.msgsOutPerSec}},subscribe(t){return Pt.add(t),()=>{Pt.delete(t)}},getStateSnapshot:()=>aa(j()),messageEvents(t=0){return ge.filter(e=>e.seq>t)},getRates:Pn,sendMessage(t,e){const n=j();if(!n||n.state!=="connected")throw new Error("No room is connected to send into.");const r=new Uint8Array(6+t.length*3);r[0]=Ut;const s={offset:1};xr.string(r,t,s);const o=e===void 0?new Uint8Array(0):new Uint8Array(Ar(e)),i=new Uint8Array(s.offset+o.byteLength);i.set(r.subarray(0,s.offset)),i.set(o,s.offset),n.socket.send(i)},getConditioning:()=>({...Tt}),setConditioning(t){Tt={latencyMs:Math.max(0,t.latencyMs),jitterMs:Math.max(0,t.jitterMs),packetLoss:0},V()},getConditioningLimits:()=>({packetLoss:"A WebSocket is reliable and ordered: a lost packet is resent, so loss is not simulated here."}),ping(){const t=j();return!t||t.state!=="connected"?Promise.reject(new Error("No room is connected to ping.")):new Promise((e,n)=>{_e.set(t,e),setTimeout(()=>{_e.get(t)===e&&(_e.delete(t),n(new Error("The server did not answer the ping within 5 s.")))},5e3),t.socket.send(new Uint8Array([Wt]))})},async inspectServer(t){const e=j();if(!e)return null;const n=Mr(e),r=await Tn(`${n}/`);if(!r)return null;const s=t??e.roomId,o=await Tn(`${n}/room?roomId=${encodeURIComponent(s)}`),i=a=>{const l=Number(a);return Number.isFinite(l)?l:null};return{rooms:(r.rooms??[]).map(a=>({roomId:a.roomId,name:a.name,clients:a.clients,maxClients:i(a.maxClients),locked:a.locked===!0,elapsedMs:a.elapsedTime??0})),connections:r.connections??0,cpuPercent:typeof r.cpu=="number"&&Number.isFinite(r.cpu)?r.cpu:null,memory:r.memory?.usedMemMb!==void 0&&r.memory.totalMemMb!==void 0?{usedMb:r.memory.usedMemMb,totalMb:r.memory.totalMemMb}:null,room:o?{roomId:s,clients:(o.clients??[]).map(a=>({sessionId:a.sessionId,elapsedMs:a.elapsedTime})),stateBytes:o.stateSize??0,...o.state!==void 0?{state:o.state}:{}}:null}},disconnectClient:(t,e)=>oe("_forceClientDisconnect",[t],"the disconnect",e),editServerState:(t,e,n)=>oe("_editStateProperty",[t,e],"the state edit",n),deleteServerState:(t,e)=>oe("_deleteStateProperty",[t],"the state delete",e),sendToClient:(t,e,n,r)=>oe("_sendMessageToClient",[t,e,n],"the send",r),broadcast:(t,e,n)=>oe("broadcast",[t,e],"the broadcast",n),disposeRoom:t=>oe("disconnect",[],"the dispose",t),clearTraffic(){for(const t of W)t.types.clear(),t.entities.clear(),t.patches=0,t.patchBytes=0;V()},stateFieldType(t){return ia(j()?.serializer?.getState(),t)},getTrafficByType(){const t=j();return t?[...t.types.values()].map(({type:e,countIn:n,countOut:r,bytesIn:s,bytesOut:o})=>({type:e,countIn:n,countOut:r,bytesIn:s,bytesOut:o})):[]},getTrafficByEntity(){const t=j();return t?[...t.entities.values()].map(({path:e,syncs:n,changes:r,patchBytesMin:s,patchBytesMax:o})=>({path:e,syncs:n,changes:r,patchBytesMin:s,patchBytesMax:o})).sort((e,n)=>n.syncs-e.syncs):[]},isRecording:()=>de,setRecording(t){de=t,V()},getServerConfig(){const t=j();if(!t)return null;const e=Ue.get(t.roomId);return e?{endpoint:t.endpoint,roomName:e}:{endpoint:t.endpoint}}};export{rl as $,Oi as A,el as B,hi as C,cr as D,di as E,Na as F,vo as G,Qs as H,Qa as I,rr as J,ir as K,Ga as L,Ba as M,Qi as N,$a as O,Fa as P,ja as Q,Ka as R,Ua as S,jo as T,Wa as U,tl as V,Ya as W,Ha as X,vr as Y,Za as Z,Xa as _,ze as a,zi as a0,za as a1,No as a2,Va as a3,sl as b,qi as c,ur as d,bn as e,cl as f,ke as g,Ft as h,ul as i,ae as j,qa as k,ll as l,nl as m,pr as n,Xs as o,al as p,Qn as q,Do as r,Vi as s,Js as t,Ii as u,jt as v,il as w,ol as x,Ja as y,hr as z};
@@ -1 +1 @@
1
- import{V as A,U as x}from"./index-BRJMIUK0.js";import{c as y,B as C,O as I,W as O,C as S,Q as g,d as V,e as k}from"./output-DK8waum9.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";function F(a){let r=0,e=0,t=0;for(const n of a)for(let s=0;s<n.length;s++){const i=n[s]??0;r+=i*i,e=Math.max(e,Math.abs(i)),t++}return{rms:t>0?Math.sqrt(r/t):0,peak:e}}const u="opus",R=128e3;function z(a){const r=a.fps??30;if(!Number.isInteger(r)||r<1||r>60||60%r!==0)throw new Error("Video export FPS must be a positive divisor of 60.");if(!Number.isSafeInteger(a.frames)||a.frames<1)throw new Error("Video export frames must be a positive safe integer.");if(a.frames/r>300)throw new Error("Video export is limited to five minutes per file.");return r}async function L(a){if(!await y("vp9",{width:a.clientWidth,height:a.clientHeight}))throw new Error("This browser cannot encode VP9 video at the game resolution.")}async function G(a,r,e){const{buffer:t}=await a.render(a.startSeconds,a.startSeconds+r),n=t.length/t.sampleRate;if(Math.abs(n-r)>1/e)throw new Error(`Offline audio render returned ${n.toFixed(4)}s for a ${r.toFixed(4)}s export window (tolerance one frame, ${(1/e).toFixed(4)}s).`);if(!await k(u,{numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate}))throw new Error(`This browser cannot encode ${u} at ${t.sampleRate} Hz, ${t.numberOfChannels} channel(s).`);const s=[];for(let o=0;o<t.numberOfChannels;o++)s.push(t.getChannelData(o));const i=F(s);return{buffer:t,track:{codec:u,sampleRate:t.sampleRate,channels:t.numberOfChannels,durationSeconds:n,rms:i.rms,peak:i.peak}}}async function N(a,r,e){const t=z(r),n=performance.now(),s=a.ownerDocument.createElement("canvas");if(s.width=a.clientWidth,s.height=a.clientHeight,s.width<1||s.height<1)throw new Error("Game surface has no exportable size.");const i=s.width,o=s.height,v=r.frames/t,m=e.audio?await G(e.audio,v,t):null;e.signal?.throwIfAborted(),e.assertActive();let c=null;const h=new C,f=new I({target:h,format:new O}),l=new S(s,{codec:"vp9",quality:new g({bitrate:3e6})});f.addVideoTrack(l,{frameRate:t}),m&&(c=new V({codec:u,quality:new g({bitrate:R})}),f.addAudioTrack(c));const E=x();let w=null;const p=()=>{w??=f.cancel()};e.signal?.addEventListener("abort",p,{once:!0});try{e.signal?.throwIfAborted(),await f.start(),c&&m&&(await c.add(m.buffer),c.close(),e.signal?.throwIfAborted());for(let d=0;d<r.frames;d++){if(e.signal?.throwIfAborted(),e.assertActive(),!a.isConnected)throw new Error("Game surface was removed during video export.");if(a.clientWidth!==i||a.clientHeight!==o)throw new Error("Game surface resized during video export.");if(d>0)for(let b=0;b<60/t;b++)e.step();if(await A(a,s,{size:{width:i,height:o},snapshots:E,canvasFrame:e.canvasFrame}),e.signal?.throwIfAborted(),e.assertActive(),a.clientWidth!==i||a.clientHeight!==o)throw new Error("Game surface resized during video export.");await l.add(d/t,1/t,{keyFrame:d%(t*2)===0})}if(e.assertActive(),e.signal?.throwIfAborted(),await f.finalize(),e.signal?.throwIfAborted(),e.assertActive(),!h.buffer)throw new Error("Video encoder produced no output.");return{blob:new Blob([h.buffer],{type:"video/webm"}),frames:r.frames,fps:t,durationMs:r.frames*1e3/t,wallMs:performance.now()-n,width:i,height:o,audio:m?.track??!1}}catch(d){throw w?await w:f.state!=="finalized"&&await f.cancel(),d}finally{e.signal?.removeEventListener("abort",p)}}export{L as assertGameplayVideoSupport,N as exportGameplayVideo,z as validateGameplayExport};
1
+ import{V as A,U as x}from"./index-CaG87ZF-.js";import{c as y,B as C,O as I,W as O,C as S,Q as g,d as V,e as k}from"./output-DK8waum9.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";function F(a){let r=0,e=0,t=0;for(const n of a)for(let s=0;s<n.length;s++){const i=n[s]??0;r+=i*i,e=Math.max(e,Math.abs(i)),t++}return{rms:t>0?Math.sqrt(r/t):0,peak:e}}const u="opus",R=128e3;function z(a){const r=a.fps??30;if(!Number.isInteger(r)||r<1||r>60||60%r!==0)throw new Error("Video export FPS must be a positive divisor of 60.");if(!Number.isSafeInteger(a.frames)||a.frames<1)throw new Error("Video export frames must be a positive safe integer.");if(a.frames/r>300)throw new Error("Video export is limited to five minutes per file.");return r}async function L(a){if(!await y("vp9",{width:a.clientWidth,height:a.clientHeight}))throw new Error("This browser cannot encode VP9 video at the game resolution.")}async function G(a,r,e){const{buffer:t}=await a.render(a.startSeconds,a.startSeconds+r),n=t.length/t.sampleRate;if(Math.abs(n-r)>1/e)throw new Error(`Offline audio render returned ${n.toFixed(4)}s for a ${r.toFixed(4)}s export window (tolerance one frame, ${(1/e).toFixed(4)}s).`);if(!await k(u,{numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate}))throw new Error(`This browser cannot encode ${u} at ${t.sampleRate} Hz, ${t.numberOfChannels} channel(s).`);const s=[];for(let o=0;o<t.numberOfChannels;o++)s.push(t.getChannelData(o));const i=F(s);return{buffer:t,track:{codec:u,sampleRate:t.sampleRate,channels:t.numberOfChannels,durationSeconds:n,rms:i.rms,peak:i.peak}}}async function N(a,r,e){const t=z(r),n=performance.now(),s=a.ownerDocument.createElement("canvas");if(s.width=a.clientWidth,s.height=a.clientHeight,s.width<1||s.height<1)throw new Error("Game surface has no exportable size.");const i=s.width,o=s.height,v=r.frames/t,m=e.audio?await G(e.audio,v,t):null;e.signal?.throwIfAborted(),e.assertActive();let c=null;const h=new C,f=new I({target:h,format:new O}),l=new S(s,{codec:"vp9",quality:new g({bitrate:3e6})});f.addVideoTrack(l,{frameRate:t}),m&&(c=new V({codec:u,quality:new g({bitrate:R})}),f.addAudioTrack(c));const E=x();let w=null;const p=()=>{w??=f.cancel()};e.signal?.addEventListener("abort",p,{once:!0});try{e.signal?.throwIfAborted(),await f.start(),c&&m&&(await c.add(m.buffer),c.close(),e.signal?.throwIfAborted());for(let d=0;d<r.frames;d++){if(e.signal?.throwIfAborted(),e.assertActive(),!a.isConnected)throw new Error("Game surface was removed during video export.");if(a.clientWidth!==i||a.clientHeight!==o)throw new Error("Game surface resized during video export.");if(d>0)for(let b=0;b<60/t;b++)e.step();if(await A(a,s,{size:{width:i,height:o},snapshots:E,canvasFrame:e.canvasFrame}),e.signal?.throwIfAborted(),e.assertActive(),a.clientWidth!==i||a.clientHeight!==o)throw new Error("Game surface resized during video export.");await l.add(d/t,1/t,{keyFrame:d%(t*2)===0})}if(e.assertActive(),e.signal?.throwIfAborted(),await f.finalize(),e.signal?.throwIfAborted(),e.assertActive(),!h.buffer)throw new Error("Video encoder produced no output.");return{blob:new Blob([h.buffer],{type:"video/webm"}),frames:r.frames,fps:t,durationMs:r.frames*1e3/t,wallMs:performance.now()-n,width:i,height:o,audio:m?.track??!1}}catch(d){throw w?await w:f.state!=="finalized"&&await f.cancel(),d}finally{e.signal?.removeEventListener("abort",p)}}export{L as assertGameplayVideoSupport,N as exportGameplayVideo,z as validateGameplayExport};
@@ -1 +1 @@
1
- import{R as N,E as P}from"./rrweb-Cd2ifIRP.js";import{O as C,Q as L,U as O,V as U}from"./index-BRJMIUK0.js";import{B as F,O as B,W as D,C as I,Q as A,I as W,a as $,U as H,A as V,b as q}from"./output-DK8waum9.js";function x(e,r){const o=new URLSearchParams({replay:e,file:r});return`${C}/recording/replay-file?${o}`}async function T(e,r){const o=await fetch(x(e,r));if(!o.ok)throw new Error(`could not load replay ${r}: HTTP ${o.status}`);return o.text()}function z(e){return new Promise((r,o)=>{const s=new FileReader;s.onload=()=>r(String(s.result)),s.onerror=()=>o(s.error??new Error("could not read replay asset")),s.readAsDataURL(e)})}async function j(e){let r=await T(e,"events.json");const o=new Set(r.match(/https:\/\/replay-assets\.invalid\/\d{6}\.(?:png|jpg|webp|gif|svg)/g)??[]),s=await Promise.all([...o].map(async a=>{const i=a.split("/").at(-1),n=await fetch(x(e,`assets/${i}`));if(!n.ok)throw new Error(`could not load replay asset ${i}`);return[a,await z(await n.blob())]}));for(const[a,i]of s)r=r.replaceAll(a,i);const t=JSON.parse(r);if(!Array.isArray(t)||t.length===0)throw new Error("replay contains no DOM events");return t}function G(e,r,o){return Math.max(0,e.videoStartEpochMs+o-r[0].timestamp)}function Q(e,r,o){const s=e.videoStartEpochMs+o;let t={rect:e.canvas,drawingWidth:e.canvas.drawingWidth,drawingHeight:e.canvas.drawingHeight};for(const a of r){if(a.timestamp>s)break;a.type===P.Custom&&a.data.tag==="vgai-canvas-layout"&&a.data.payload&&typeof a.data.payload=="object"&&"rect"in a.data.payload&&"drawingWidth"in a.data.payload&&"drawingHeight"in a.data.payload&&(t=a.data.payload)}return t}async function _(e,r){await new Promise((o,s)=>{const t=()=>{clearTimeout(n),e.removeEventListener("loadeddata",a),e.removeEventListener("error",i)},a=()=>{t(),o()},i=()=>{t(),s(new Error("replay video failed to load"))},n=setTimeout(()=>{t(),s(new Error("replay video load timed out"))},15e3);e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?a():(e.addEventListener("loadeddata",a,{once:!0}),e.addEventListener("error",i,{once:!0}))}),!(Math.abs(e.currentTime-r)<.001)&&await new Promise((o,s)=>{const t=()=>{clearTimeout(n),e.removeEventListener("seeked",a),e.removeEventListener("error",i)},a=()=>{t(),o()},i=()=>{t(),s(new Error("replay video seek failed"))},n=setTimeout(()=>{t(),s(new Error("replay video seek timed out"))},15e3);e.addEventListener("seeked",a,{once:!0}),e.addEventListener("error",i,{once:!0}),e.currentTime=r})}async function J(e){e.fonts.size>0&&e.fonts.status!=="loaded"&&await Promise.race([e.fonts.ready.then(()=>{}),new Promise(r=>setTimeout(r,3e3))]),await Promise.all(Array.from(e.images,r=>r.decode().catch(()=>{})))}async function S(e,r){const[o,s]=await Promise.all([T(e,"manifest.json"),j(e)]),t=JSON.parse(o);if(t.status!=="complete"||t.format!=="canvas-dom"||t.version!==1||!t.capture||typeof t.capture.durationMs!="number")throw new Error("replay manifest is incomplete or unsupported");const a=document.createElement("div");a.setAttribute("data-vgai-replay-block",""),Object.assign(a.style,{position:"fixed",left:"-100000px",top:"0",width:`${t.viewport.width}px`,height:`${t.viewport.height}px`,overflow:"hidden",pointerEvents:"none"});const i=document.createElement("div");a.append(i),document.body.append(a);const n=document.createElement("video");n.muted=!0,n.preload="auto",n.playsInline=!0,n.src=x(e,"video"),a.append(n);let w;try{w=new N(s,{root:i,showWarning:!1,showDebug:!1,mouseTail:!1,UNSAFE_replayCanvas:!0,insertStyleRules:["[data-vgai-replay-video] { visibility: hidden !important; }"]});const f=w;return await r({manifest:t,async render(u){const h=Math.max(0,Math.min(u,t.capture.durationMs));await _(n,h/1e3),f.pause(G(t,s,h)),await J(f.iframe.contentDocument);const y=f.getMirror().getNode(t.canvas.nodeId),p=f.getMirror().getNode(t.surfaceNodeId);if(!y||y.tagName!=="CANVAS")throw new Error("replay canvas placeholder is unavailable");if(!p||typeof p.getBoundingClientRect!="function")throw new Error("replay game surface is unavailable");const c=y,g=p;c.setAttribute("data-vgai-root-surface","true");const E=Q(t,s,h);c.width=E.drawingWidth,c.height=E.drawingHeight;const d=c.getContext("2d");if(!d)throw new Error("replay canvas has no 2D context");return d.drawImage(n,0,0,c.width,c.height),c.style.setProperty("visibility","visible","important"),g}})}finally{n.pause(),w?.destroy(),n.removeAttribute("src"),n.load(),a.remove()}}async function Z(e,r){return S(e,async({manifest:o,render:s})=>{const t=Math.max(0,Math.min(r,o.capture.durationMs)),a=await s(t),i=await L(a),n=a.getBoundingClientRect();return{...i,replayPath:e,positionMs:t,width:Math.max(1,Math.round(n.width)),height:Math.max(1,Math.round(n.height))}})}async function ee(e){const r=e.fps??30;if(!Number.isInteger(r)||r<1||r>60)throw new Error("replay export fps must be an integer from 1 to 60");return S(e.replayPath,async({manifest:o,render:s})=>{const t=e.startMs??0,a=e.endMs??o.capture.durationMs;if(!Number.isFinite(t)||!Number.isFinite(a)||t<0||a<=t||a>o.capture.durationMs||a-t>3e5)throw new Error("replay export requires a valid recorded interval of at most five minutes");const i=t/1e3,n=a/1e3,w=Math.ceil((n-i)*r),f=await s(t),u=document.createElement("canvas"),h=f.getBoundingClientRect();u.width=Math.max(1,Math.round(h.width)),u.height=Math.max(1,Math.round(h.height));const y={width:u.width,height:u.height},p=new F,c=new B({target:p,format:new D}),g=new I(u,{codec:"vp9",quality:new A({bitrate:3e6})});c.addVideoTrack(g,{frameRate:r});const E=new W({source:new H(x(e.replayPath,"video")),formats:[$]});try{const d=await E.getPrimaryAudioTrack();if(o.capture.audio&&!d)throw new Error("recorded audio track is missing");const M=d?new V({codec:"opus",quality:new A({bitrate:128e3})}):null;M&&c.addAudioTrack(M),await c.start();const R=async()=>{if(!(!M||!d)){for await(const l of new q(d).samples(i,n))try{const m=Math.max(0,Math.ceil((i-l.timestamp)*l.sampleRate)),v=Math.min(l.numberOfFrames,Math.ceil((n-l.timestamp)*l.sampleRate));if(v<=m)continue;const b=l.trim(m,v);try{b.setTimestamp(Math.max(0,b.timestamp-i)),await M.add(b)}finally{b.close()}}finally{l.close()}M.close()}},k=async()=>{const l=O();for(let m=0;m<w;m++){const v=m/r;await U(await s(t+v*1e3),u,{size:y,snapshots:l}),await g.add(v,Math.min(1/r,n-i-v),{keyFrame:m%(r*2)===0})}g.close()};if(await Promise.all([R(),k()]),await c.finalize(),!p.buffer)throw new Error("replay encoder produced no output");return{blob:new Blob([p.buffer],{type:"video/webm"}),frames:w,fps:r,durationMs:a-t,...y,audio:d!==null}}catch(d){throw c.state!=="finalized"&&await c.cancel(),d}finally{E.dispose()}})}export{Z as c,ee as e};
1
+ import{R as N,E as P}from"./rrweb-Cd2ifIRP.js";import{O as C,Q as L,U as O,V as U}from"./index-CaG87ZF-.js";import{B as F,O as B,W as D,C as I,Q as A,I as W,a as $,U as H,A as V,b as q}from"./output-DK8waum9.js";function x(e,r){const o=new URLSearchParams({replay:e,file:r});return`${C}/recording/replay-file?${o}`}async function T(e,r){const o=await fetch(x(e,r));if(!o.ok)throw new Error(`could not load replay ${r}: HTTP ${o.status}`);return o.text()}function z(e){return new Promise((r,o)=>{const s=new FileReader;s.onload=()=>r(String(s.result)),s.onerror=()=>o(s.error??new Error("could not read replay asset")),s.readAsDataURL(e)})}async function j(e){let r=await T(e,"events.json");const o=new Set(r.match(/https:\/\/replay-assets\.invalid\/\d{6}\.(?:png|jpg|webp|gif|svg)/g)??[]),s=await Promise.all([...o].map(async a=>{const i=a.split("/").at(-1),n=await fetch(x(e,`assets/${i}`));if(!n.ok)throw new Error(`could not load replay asset ${i}`);return[a,await z(await n.blob())]}));for(const[a,i]of s)r=r.replaceAll(a,i);const t=JSON.parse(r);if(!Array.isArray(t)||t.length===0)throw new Error("replay contains no DOM events");return t}function G(e,r,o){return Math.max(0,e.videoStartEpochMs+o-r[0].timestamp)}function Q(e,r,o){const s=e.videoStartEpochMs+o;let t={rect:e.canvas,drawingWidth:e.canvas.drawingWidth,drawingHeight:e.canvas.drawingHeight};for(const a of r){if(a.timestamp>s)break;a.type===P.Custom&&a.data.tag==="vgai-canvas-layout"&&a.data.payload&&typeof a.data.payload=="object"&&"rect"in a.data.payload&&"drawingWidth"in a.data.payload&&"drawingHeight"in a.data.payload&&(t=a.data.payload)}return t}async function _(e,r){await new Promise((o,s)=>{const t=()=>{clearTimeout(n),e.removeEventListener("loadeddata",a),e.removeEventListener("error",i)},a=()=>{t(),o()},i=()=>{t(),s(new Error("replay video failed to load"))},n=setTimeout(()=>{t(),s(new Error("replay video load timed out"))},15e3);e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?a():(e.addEventListener("loadeddata",a,{once:!0}),e.addEventListener("error",i,{once:!0}))}),!(Math.abs(e.currentTime-r)<.001)&&await new Promise((o,s)=>{const t=()=>{clearTimeout(n),e.removeEventListener("seeked",a),e.removeEventListener("error",i)},a=()=>{t(),o()},i=()=>{t(),s(new Error("replay video seek failed"))},n=setTimeout(()=>{t(),s(new Error("replay video seek timed out"))},15e3);e.addEventListener("seeked",a,{once:!0}),e.addEventListener("error",i,{once:!0}),e.currentTime=r})}async function J(e){e.fonts.size>0&&e.fonts.status!=="loaded"&&await Promise.race([e.fonts.ready.then(()=>{}),new Promise(r=>setTimeout(r,3e3))]),await Promise.all(Array.from(e.images,r=>r.decode().catch(()=>{})))}async function S(e,r){const[o,s]=await Promise.all([T(e,"manifest.json"),j(e)]),t=JSON.parse(o);if(t.status!=="complete"||t.format!=="canvas-dom"||t.version!==1||!t.capture||typeof t.capture.durationMs!="number")throw new Error("replay manifest is incomplete or unsupported");const a=document.createElement("div");a.setAttribute("data-vgai-replay-block",""),Object.assign(a.style,{position:"fixed",left:"-100000px",top:"0",width:`${t.viewport.width}px`,height:`${t.viewport.height}px`,overflow:"hidden",pointerEvents:"none"});const i=document.createElement("div");a.append(i),document.body.append(a);const n=document.createElement("video");n.muted=!0,n.preload="auto",n.playsInline=!0,n.src=x(e,"video"),a.append(n);let w;try{w=new N(s,{root:i,showWarning:!1,showDebug:!1,mouseTail:!1,UNSAFE_replayCanvas:!0,insertStyleRules:["[data-vgai-replay-video] { visibility: hidden !important; }"]});const f=w;return await r({manifest:t,async render(u){const h=Math.max(0,Math.min(u,t.capture.durationMs));await _(n,h/1e3),f.pause(G(t,s,h)),await J(f.iframe.contentDocument);const y=f.getMirror().getNode(t.canvas.nodeId),p=f.getMirror().getNode(t.surfaceNodeId);if(!y||y.tagName!=="CANVAS")throw new Error("replay canvas placeholder is unavailable");if(!p||typeof p.getBoundingClientRect!="function")throw new Error("replay game surface is unavailable");const c=y,g=p;c.setAttribute("data-vgai-root-surface","true");const E=Q(t,s,h);c.width=E.drawingWidth,c.height=E.drawingHeight;const d=c.getContext("2d");if(!d)throw new Error("replay canvas has no 2D context");return d.drawImage(n,0,0,c.width,c.height),c.style.setProperty("visibility","visible","important"),g}})}finally{n.pause(),w?.destroy(),n.removeAttribute("src"),n.load(),a.remove()}}async function Z(e,r){return S(e,async({manifest:o,render:s})=>{const t=Math.max(0,Math.min(r,o.capture.durationMs)),a=await s(t),i=await L(a),n=a.getBoundingClientRect();return{...i,replayPath:e,positionMs:t,width:Math.max(1,Math.round(n.width)),height:Math.max(1,Math.round(n.height))}})}async function ee(e){const r=e.fps??30;if(!Number.isInteger(r)||r<1||r>60)throw new Error("replay export fps must be an integer from 1 to 60");return S(e.replayPath,async({manifest:o,render:s})=>{const t=e.startMs??0,a=e.endMs??o.capture.durationMs;if(!Number.isFinite(t)||!Number.isFinite(a)||t<0||a<=t||a>o.capture.durationMs||a-t>3e5)throw new Error("replay export requires a valid recorded interval of at most five minutes");const i=t/1e3,n=a/1e3,w=Math.ceil((n-i)*r),f=await s(t),u=document.createElement("canvas"),h=f.getBoundingClientRect();u.width=Math.max(1,Math.round(h.width)),u.height=Math.max(1,Math.round(h.height));const y={width:u.width,height:u.height},p=new F,c=new B({target:p,format:new D}),g=new I(u,{codec:"vp9",quality:new A({bitrate:3e6})});c.addVideoTrack(g,{frameRate:r});const E=new W({source:new H(x(e.replayPath,"video")),formats:[$]});try{const d=await E.getPrimaryAudioTrack();if(o.capture.audio&&!d)throw new Error("recorded audio track is missing");const M=d?new V({codec:"opus",quality:new A({bitrate:128e3})}):null;M&&c.addAudioTrack(M),await c.start();const R=async()=>{if(!(!M||!d)){for await(const l of new q(d).samples(i,n))try{const m=Math.max(0,Math.ceil((i-l.timestamp)*l.sampleRate)),v=Math.min(l.numberOfFrames,Math.ceil((n-l.timestamp)*l.sampleRate));if(v<=m)continue;const b=l.trim(m,v);try{b.setTimestamp(Math.max(0,b.timestamp-i)),await M.add(b)}finally{b.close()}}finally{l.close()}M.close()}},k=async()=>{const l=O();for(let m=0;m<w;m++){const v=m/r;await U(await s(t+v*1e3),u,{size:y,snapshots:l}),await g.add(v,Math.min(1/r,n-i-v),{keyFrame:m%(r*2)===0})}g.close()};if(await Promise.all([R(),k()]),await c.finalize(),!p.buffer)throw new Error("replay encoder produced no output");return{blob:new Blob([p.buffer],{type:"video/webm"}),frames:w,fps:r,durationMs:a-t,...y,audio:d!==null}}catch(d){throw c.state!=="finalized"&&await c.cancel(),d}finally{E.dispose()}})}export{Z as c,ee as e};
@@ -0,0 +1 @@
1
+ import{a4 as a}from"./index-CaG87ZF-.js";import{s as n,n as s}from"./command-results-CUQD49AB.js";import{g as m,a as p}from"./game-network-Bo_nlDR5.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"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./native-debug-module-B-rWJfWE.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-l7k5Hjc8.js";import"./contract-system-adapters-h6OUBRYA.js";import"./game-contract-seams-C0AVYwvO.js";import"./seeded-random-38To73fI.js";import"./game-audio-CaGKzia4.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./index-bQE2NA0D.js";import"./live-project-verbs-BOAQN3ME.js";import"./capability-coverage-DQgg6UJe.js";import"./edit-mode-authoring-DBjaBTxM.js";import"./json-history-resource-CTXRV4GD.js";import"./binding-resolver-C_9MBSMa.js";import"./adapter-surface-Y37Nzcyw.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-DefTrXnY.js";import"./canvas-entry-runtime-DVeh71nC.js";import"./three-ingest-runtime-CXKjNysA.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./active-ingest-CnAeQcuQ.js";import"./ingest-source-persistence-6peGfPAS.js";import"./pixi-story-model-DNkfnWUV.js";import"./surface-content-Dg9Kkazf.js";import"./viewport-root-presentation-B35t51xX.js";import"./mounted-authoring-B7RL_V28.js";import"./entity-object-B_5Gc0Ky.js";import"./user-data-CqOoAowZ.js";import"./workspace-arrangement-DIMM7ska.js";import"./three-contract-Dkt6PmWY.js";import"./three-oYrcK5SQ.js";import"./editor-layers-B4oYfpj8.js";import"./component-instance-root-df4ofoOR.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-BrkGH4cd.js";import"./source-persistence-backend-HviqjKZ2.js";import"./three-projection-core-jBJVt6O0.js";import"./body-marks-RKb_LTwL.js";import"./user-data-dHvLdpwM.js";import"./object-marks-DwvIEBOK.js";import"./structural-ids-Br2zjINh.js";import"./object3d-authoring-subject-BDrxd1GA.js";import"./r3f-physics-binding-Bgzzd4ol.js";import"./deferred-ingest-play-Bej67_y9.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-C1jPW_cN.js";import"./board-guides-_3R1t_-2.js";import"./relative-import-specifier-DQzkawgj.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-C8RP8G5F.js";import"./inference-diagnostics-MGcIHEX6.js";import"./writer-tw6EcuVO.js";import"./three-state-wXRU3rLr.js";import"./editor-shell-store-Bh1S7M54.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-DVkMQazS.js";const Ge="workspace.command",Le={"list-gameplay-state":{derivedRefresh:"if-content-changed",handle:()=>{const e=a().debug;return e?{ok:!0,data:{providers:e.providers()}}:p()?{ok:!0,data:{providers:[]}}:s()}},"inspect-gameplay-state":{derivedRefresh:"if-content-changed",handle:e=>{const t=a().debug;if(!t)return p()?{ok:!0,data:{state:null}}:s();const r=e.keys;try{const o={};if(r&&r.length>0)for(const i of r)o[i]=t.state(i);else Object.assign(o,t.stateAll());return{ok:!0,data:{state:o}}}catch(o){return n(o)}}},"list-debug-commands":{derivedRefresh:"if-content-changed",handle:()=>{const e=a().debug;return e?{ok:!0,data:{commands:e.commands()}}:p()?{ok:!0,data:{commands:[]}}:s()}},"invoke-debug-command":{derivedRefresh:"always",handle:async e=>{const t=a().debug;if(!t)return p()?{ok:!1,error:`debug: no command registered under "${e.name}" — this game exposes no debug adapter`,data:{code:"DEBUG_COMMAND_NOT_REGISTERED",registered:[]}}:s();try{return{ok:!0,data:{result:await t.invoke(e.name,e.args??[])}}}catch(r){return n(r)}}},"inject-input":{derivedRefresh:"none",handle:e=>{const t=m();if(!t)return{ok:!1,error:"not in play mode — start play before injecting input"};let r;try{r=t.getInputTarget(e.worldId)}catch(o){return n(o)}if(!r)return{ok:!1,error:"this play session has no input door: no root entry exports `debug.input`"};try{if(e.kind==="action"){const i=e.atTick;return typeof i=="number"?(r.scheduleActionAtTick(i,e.action,e.value),{ok:!0,data:{scheduled:!0,tick:i}}):{ok:!0,data:r.setVirtualAction(e.action,e.value)}}const o=e.sourceId;switch(e.kind){case"axis":r.injectAxis(o,e.value);break;case"vector2":r.injectVector2(o,e.value);break;case"pointerDelta":r.injectPointerDelta(o,e.value);break;case"pointerPosition":r.injectPointerPosition(o,e.value);break;default:return{ok:!1,error:`unknown injection kind "${e.kind}"`}}return{ok:!0,data:{delivered:!0}}}catch(o){return n(o)}}},"set-time-scale":{derivedRefresh:"none",handle:e=>{const t=m();return t?(t.loop.timeScale=e.timeScale,{ok:!0,data:{timeScale:t.loop.timeScale}}):{ok:!1,error:"not in play mode — start play before setting time-scale"}}},"set-seed":{derivedRefresh:"none",handle:e=>{const t=m();return t?t.determinismDeclared?t.random?(t.random.reseed(e.seed),{ok:!0,data:{seed:t.random.seed}}):{ok:!1,error:"this play session has no first-party ctx.random to reseed"}:{ok:!1,error:"this project's manifest does not declare determinism.seededRandom — play.seed.set has no documented contract to reseed against (D15)",data:{code:"DETERMINISM_NOT_DECLARED"}}:{ok:!1,error:"not in play mode — start play before setting the seed"}}},"run-ticks":{derivedRefresh:"none",handle:async e=>{const t=m();if(!t)return{ok:!1,error:"not in play mode — start play before running ticks"};if(!t.runTicks)return{ok:!1,error:"this play session has no first-party Game to run ticks on",data:{code:"RUN_TICKS_UNAVAILABLE"}};try{const r=e.n,o=e.render;return t.runTicksSettled?await t.runTicksSettled(r,o?{render:o}:void 0):t.runTicks(r,o?{render:o}:void 0),{ok:!0}}catch(r){return n(r)}}}};export{Le as commands,Ge as point};
@@ -1 +1 @@
1
- import{X as l,Y as a,a4 as c}from"./index-BRJMIUK0.js";const g={version:1,jobs:[]};let u=g,i=null,s=0,o=!1;const r=new Set;function w(e,n=null){u=e,i=n,s++;for(const d of r)d()}function J(){return u}function v(){return i}function E(){return s}function y(e){return r.add(e),()=>r.delete(e)}function p(e){return e.status==="queued"||e.status==="running"}function h(e){return!p(e)&&(!e.readAt||Date.parse(e.readAt)<Date.parse(e.updatedAt))}function b(e){return e.filter(h).length}async function t(){try{const e=await fetch("/__editor/generations");w(await l(e,"Generation activity request failed"))}catch(e){i=e instanceof Error?e.message:String(e),s++;for(const n of r)n()}}async function G(){if(!o){o=!0;try{const e=await fetch("/__editor/generations/reconcile",{method:"POST"});a(e,"Generation reconciliation failed"),await t()}finally{o=!1}}}async function _(e){const n=await c(e.poll.tool,e.poll.input);if(!n.ok)throw new Error(n.error.message);if(n.generationWarning)throw new Error(n.generationWarning);return await t(),await f(e.id),n.data}async function S(e){if(!e.accept)throw new Error("This completed generation has no project asset to add.");const n=await c(e.accept.tool,e.accept.input,{confirm:!0});if(!n.ok)throw new Error(n.error.message);if(n.generationWarning)throw new Error(n.generationWarning);await t(),await f(e.id)}async function f(e){const n=await fetch(`/__editor/generations/${encodeURIComponent(e)}/read`,{method:"POST"});a(n,"Mark generation read failed"),await t()}async function T(e){const n=await fetch(`/__editor/generations/${encodeURIComponent(e)}`,{method:"DELETE"});a(n,"Forget generation job failed"),await t()}function A(){t();const e=window.setInterval(()=>void t(),2e3);return()=>{window.clearInterval(e)}}export{b as a,p as b,S as c,v as d,h as e,T as f,J as g,A as h,_ as i,E as j,f as m,G as p,t as r,y as s};
1
+ import{X as l,Y as a,a5 as c}from"./index-CaG87ZF-.js";const g={version:1,jobs:[]};let u=g,i=null,s=0,o=!1;const r=new Set;function w(e,n=null){u=e,i=n,s++;for(const d of r)d()}function J(){return u}function v(){return i}function E(){return s}function y(e){return r.add(e),()=>r.delete(e)}function p(e){return e.status==="queued"||e.status==="running"}function h(e){return!p(e)&&(!e.readAt||Date.parse(e.readAt)<Date.parse(e.updatedAt))}function b(e){return e.filter(h).length}async function t(){try{const e=await fetch("/__editor/generations");w(await l(e,"Generation activity request failed"))}catch(e){i=e instanceof Error?e.message:String(e),s++;for(const n of r)n()}}async function G(){if(!o){o=!0;try{const e=await fetch("/__editor/generations/reconcile",{method:"POST"});a(e,"Generation reconciliation failed"),await t()}finally{o=!1}}}async function _(e){const n=await c(e.poll.tool,e.poll.input);if(!n.ok)throw new Error(n.error.message);if(n.generationWarning)throw new Error(n.generationWarning);return await t(),await f(e.id),n.data}async function S(e){if(!e.accept)throw new Error("This completed generation has no project asset to add.");const n=await c(e.accept.tool,e.accept.input,{confirm:!0});if(!n.ok)throw new Error(n.error.message);if(n.generationWarning)throw new Error(n.generationWarning);await t(),await f(e.id)}async function f(e){const n=await fetch(`/__editor/generations/${encodeURIComponent(e)}/read`,{method:"POST"});a(n,"Mark generation read failed"),await t()}async function T(e){const n=await fetch(`/__editor/generations/${encodeURIComponent(e)}`,{method:"DELETE"});a(n,"Forget generation job failed"),await t()}function A(){t();const e=window.setInterval(()=>void t(),2e3);return()=>{window.clearInterval(e)}}export{b as a,p as b,S as c,v as d,h as e,T as f,J as g,A as h,_ as i,E as j,f as m,G as p,t as r,y as s};
@@ -0,0 +1 @@
1
+ import{je as V,jf as Y,f8 as O,dp as D,g_ as E,jg as Q,jh as b,aL as X,$ as p,h0 as H,fk as Z,ji as ee,jj as te,jk as w,jl as ne,jm as ae,jn as re,jo as ie,jp as oe,jq as se,cN as le,aJ as h,hU as ce,ew as P,hF as R,dU as B,M as de,a0 as _,gb as ue,jr as ge,js as me,jt as pe,gX as ve,ju as fe,b5 as he,jv as xe,f2 as je,a6 as ye,f4 as Ne}from"./index-CaG87ZF-.js";import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r as u}from"./index-nmcBqr7Y.js";import{m as Ce}from"./model-thumbnail-uk-2sblh.js";import"./index-CtzuWnCS.js";import{s as T,g as x,c as M,f as U,i as Ee,b as J,p as Se,r as z,d as ke,e as Te,m as $e,h as Ae,j as be,a as we}from"./generation-jobs-CiabIfR0.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./renderer-ownership-BovSEcLv.js";import"./studio-environment-yaKaHPxH.js";import"./user-data-CqOoAowZ.js";import"./workspace-arrangement-DIMM7ska.js";import"./KTX2Loader-CaqVE6nY.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./environment-Dg-YaLsA.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";function j(e){switch(e.status){case"queued":return"queued";case"running":return"running";case"failed":return"failed";case"cancelled":return"cancelled";default:return e.acceptedAt?"ready":e.accept?e.pollError?"save-failed":"saving":"no-asset"}}function F(e){const n=j(e);return n!=="queued"&&n!=="running"&&n!=="saving"}function L(e,n){return e.status==="succeeded"&&!!e.accept&&!e.acceptedAt&&!!(e.pollError??n)}const $={queued:"Queued",running:"Running",saving:"Saving","save-failed":"Couldn't save",ready:"In project","no-asset":"No file",failed:"Failed",cancelled:"Cancelled"},Re=new Map([...["png","jpg","jpeg","webp","gif","avif","svg","bmp"].map(e=>[e,"image"]),...["mp4","webm","ogv","mov","m4v"].map(e=>[e,"video"]),...["mp3","wav","ogg","oga","m4a","flac","aac"].map(e=>[e,"audio"]),...["glb","gltf","fbx","obj","stl","ply","dae","3ds","usdz","spz"].map(e=>[e,"model"])]);function Ge(e){const n=e.slice(e.lastIndexOf("/")+1).toLowerCase(),a=n.lastIndexOf(".");return a>0?n.slice(a+1):""}function q(e){return(e.outputPaths??[]).map(n=>{const a=V.find(r=>n.startsWith(`${r}/`)),i=a?Y(a,n.slice(a.length+1)):null;return{path:n,name:n.slice(n.lastIndexOf("/")+1),kind:Re.get(Ge(n))??"file",url:i}})}function G(e,n){const a=e.trim();return a.length<=n?a:`${a.slice(0,n-1).trimEnd()}…`}function C(e){const n=De(e);if(n)return n;const a=q(e);if(a.length===0)return G(e.label,64);const i=a[0],r=Oe(i.path);return a.length>1?r?`${r} · ${a.length} files`:`${a.length} files`:Ie.test(i.name)?r?`${r}/${i.name}`:G(e.label,64):i.name}const Ie=/^(image|video|audio|model|panorama|output)(-\d+)?\./;function Oe(e){const n=e.split("/").slice(-2,-1)[0];return n?/^[0-9a-f]{8,}$/i.test(n)||/^[0-9a-f-]{16,}$/i.test(n)?null:n:null}function De(e){const n=e.accept?.input;if(!n||typeof n!="object")return null;const a=n.outputName;return typeof a=="string"&&a.trim().length>0?a.trim():null}function Pe(e){for(const n of[e.accept?.input,e.poll.input]){const a=W(n,0);if(a)return a}return null}function W(e,n){if(n>3||typeof e!="object"||e===null)return null;const a=e,i=a.prompt;if(typeof i=="string"&&i.trim().length>0)return i.trim();for(const r of Object.values(a)){const l=W(r,n+1);if(l)return l}return null}function I(e){return e.operation}function Be(e){return e.mode==="managed"?"VGAI subscription":e.mode==="direct"?"Your provider key":"Mock"}function _e(e){return e.route==="mock"?"Free · mock":e.route==="managed"?e.settledCredits!==void 0?`${e.settledCredits} credits`:e.estimatedCredits!==void 0?`Up to ${e.estimatedCredits} credits`:"Credit estimate unavailable":e.settledAmount!==void 0?`$${e.settledAmount.toFixed(3)}`:e.estimatedAmount!==void 0?`Up to $${e.estimatedAmount.toFixed(3)}`:"USD estimate unavailable"}function Me(e){return e.route==="mock"?!0:e.route==="managed"?e.settledCredits!==void 0:e.settledAmount!==void 0}function Ue(e){const n=Math.floor((Date.now()-Date.parse(e))/6e4);if(!Number.isFinite(n)||n<1)return"just now";if(n<60)return`${n}m ago`;const a=Math.floor(n/60);if(a<24)return`${a}h ago`;const i=Math.floor(a/24);return i<7?`${i}d ago`:`${Math.floor(i/7)}w ago`}const S="generation:",Je="generation:create";function ze(e){return e.route==="mock"?"Free mock":e.route==="managed"?e.settledCredits!==void 0?`${e.settledCredits} credits settled`:e.estimatedCredits!==void 0?`Up to ${e.estimatedCredits} credits`:"VGAI subscription · estimate unavailable":e.settledAmount!==void 0?`$${e.settledAmount.toFixed(3)} settled`:e.estimatedAmount!==void 0?`Up to $${e.estimatedAmount.toFixed(3)}`:"BYOK · estimate unavailable"}function K(e){return O({id:`${S}${e.id}`,title:e.label,kind:"generation",workspaceRole:"authored-subject",provenance:{origin:`${e.provider}:${e.externalId}`},Content:qe,closeable:!0,presentation:()=>({kind:"generation",id:e.id})})}function k(){return O({id:Je,title:"Create Asset",kind:"generation",workspaceRole:"workspace-task",provenance:{origin:"registered generation tools"},Content:Fe,closeable:!0,presentation:()=>({kind:"generation",id:"create"})})}function Fe(){u.useSyncExternalStore(D,E),u.useSyncExternalStore(Q,b,b);const e=ee(),[n,a]=u.useState(""),i=n.trim().toLowerCase(),r=E().filter(s=>s.point==="workspace.document"&&s.tool?.generation?.role==="submit").filter(s=>i?[s.title,s.tool?.generation?.provider,s.tool?.summary,s.tool?.description].filter(Boolean).some(c=>String(c).toLowerCase().includes(i)):!0),l=new Map;for(const s of r){const c=s.tool?.generation?.provider??"other";l.set(c,[...l.get(c)??[],s])}return t.jsxs("div",{className:"vgai-tool-page","data-testid":"generation-create-catalog",children:[t.jsxs("header",{className:"vgai-tool-header",children:[t.jsx("div",{className:"vgai-tool-eyebrow",children:"Installed provider extensions"}),t.jsx("h2",{className:"vgai-tool-title",children:"Create an asset"}),t.jsxs("p",{className:"vgai-tool-description",children:["Choose a native provider operation. Mock, managed, and BYOK execution remain explicit in the operation you open. Current default: ",e.preferredRoute,"."]})]}),t.jsx(X,{type:"search","aria-label":"Search generation tools",placeholder:"Search operations or providers…",value:n,onChange:s=>a(s.target.value)}),[...l.entries()].map(([s,c])=>t.jsxs("section",{className:"vgai-tool-card",children:[t.jsx("h3",{className:"vgai-tool-section-title",children:s}),t.jsx("div",{className:"vgai-generation-create-grid",children:c.map(g=>t.jsxs(p,{variant:"ghost",className:"vgai-generation-create-card",onClick:()=>H(g.id),children:[t.jsx("strong",{children:g.title}),t.jsx("span",{children:g.tool?.summary})]},g.id))})]},s)),r.length===0&&t.jsx("div",{className:"vgai-generation-document-empty",children:"No installed generation operation matches this search."})]})}function Le({job:e,result:n,documentId:a,active:i}){u.useSyncExternalStore(D,E),u.useSyncExternalStore(te,w,w);const r=ne(e.poll.tool,e,n);if(!r)return t.jsx("pre",{className:"vgai-generation-native-result",children:JSON.stringify(n,null,2)});const l=r.Component;return t.jsx(ae,{file:r.file,children:t.jsx(l,{tool:r.tool,contributionId:r.id,client:se(),surfaces:re,account:oe(),play:ie(),documentId:a,active:i,job:e,result:n})})}function qe({documentId:e,active:n}){const{jobs:a}=u.useSyncExternalStore(T,x,x),i=e.startsWith(S)?e.slice(S.length):e,r=a.find(d=>d.id===i),[l,s]=u.useState(),[c,g]=u.useState(!1),[o,m]=u.useState(null),[v,f]=u.useState(!1),y=async d=>{g(!0),m(null);try{s(await Ee(d))}catch(N){m(N instanceof Error?N.message:String(N))}finally{g(!1)}};if(u.useEffect(()=>{r&&y(r)},[r?.id,r?.status]),!r)return t.jsx("div",{className:"vgai-generation-document-empty",children:"This generation is no longer in project activity."});const A=o??(j(r)==="save-failed"?`Could not save into the project: ${r.pollError}`:null);return t.jsxs("div",{className:"vgai-generation-document","data-status":r.status,children:[t.jsxs("header",{className:"vgai-generation-document-header",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"vgai-tool-eyebrow",children:[r.provider," · ",r.operation]}),t.jsx("h2",{className:"vgai-tool-title",children:r.label}),t.jsxs("div",{className:"vgai-generation-job-meta",children:[$[j(r)]," · ",ze(r.billing)]})]}),t.jsxs("div",{className:"vgai-tool-actions",children:[t.jsx(p,{size:"compact",variant:"ghost",disabled:c,onClick:()=>void y(r),children:c?"Refreshing…":"Refresh"}),L(r,o)&&t.jsx(p,{size:"compact",variant:"primary",disabled:v,onClick:()=>{f(!0),m(null),M(r).catch(d=>m(d instanceof Error?d.message:String(d))).finally(()=>f(!1))},children:v?"Saving…":"Retry save"})]})]}),r.message&&t.jsx("div",{className:"vgai-tool-status",children:r.message}),A&&t.jsx("div",{className:"vgai-tool-status","data-tone":"error",role:"alert",children:A}),t.jsx("section",{className:"vgai-generation-result","aria-label":"Generation result",children:l===void 0?t.jsx("div",{className:"vgai-generation-document-empty",children:c?"Loading provider result…":"No provider result is available yet."}):t.jsx(Le,{job:r,result:l,documentId:e,active:n})}),r.outputPaths&&r.outputPaths.length>0&&t.jsxs("section",{className:"vgai-generation-output-paths",children:[t.jsx("strong",{children:"Project assets"}),r.outputPaths.map(d=>t.jsx("code",{children:d},d))]}),F(r)&&t.jsx("div",{className:"vgai-generation-document-footer",children:t.jsx(p,{size:"compact",variant:"ghost",disabled:v,onClick:()=>{f(!0),U(r.id).then(()=>Z(e)).catch(d=>m(d instanceof Error?d.message:String(d))).finally(()=>f(!1))},children:"Remove from activity"})})]})}function We({output:e,onOpen:n}){const a=e.url;if(a&&e.kind==="image"){const i=t.jsx("img",{className:"vgai-generation-output-media",src:a,alt:e.name,loading:"lazy"});return n?t.jsx(p,{variant:"ghost",className:"vgai-generation-output-open",onClick:n,"aria-label":`Open ${e.name}`,children:i}):i}return a&&e.kind==="video"?t.jsx("video",{className:"vgai-generation-output-media",src:a,controls:!0,preload:"metadata",playsInline:!0,title:e.name}):a&&e.kind==="audio"?t.jsxs("div",{className:"vgai-generation-output-audio",children:[t.jsx(ge,{url:a,name:e.name}),t.jsx("audio",{src:a,controls:!0,preload:"metadata",title:e.name})]}):e.url&&e.kind==="model"&&Ce(e.url)?t.jsx(me,{url:e.url}):t.jsxs("div",{className:"vgai-generation-output-file",children:[t.jsx(_,{icon:e.kind==="model"?pe:ve}),t.jsx(h,{variant:"caption",tone:"muted",children:e.name}),n&&t.jsx(p,{size:"compact",variant:"ghost",onClick:n,children:"Open file"})]})}const Ke={queued:"loading",running:"loading",saving:"loading","save-failed":"error",ready:"success","no-asset":"neutral",failed:"error",cancelled:"neutral"},Ve={queued:e=>e.queuePosition===void 0?"Waiting for the provider to start.":`Position ${e.queuePosition} in the provider queue.`,running:e=>e.message??"The provider is working on it.",saving:()=>"Downloading the finished output into this project.","save-failed":e=>e.pollError??"The finished output could not be saved.",ready:()=>"Saved into this project.","no-asset":()=>"The operation finished without a file this project can hold.",failed:e=>e.message??"The provider reported a failure.",cancelled:()=>"This generation was cancelled."};function Ye({job:e,state:n}){const a=n==="queued"||n==="running"||n==="saving",i=n==="failed"||n==="save-failed";return t.jsxs("div",{className:"vgai-generation-state-media","data-state":n,children:[t.jsx(P,{compact:!0,tone:Ke[n],...i?{icon:t.jsx(_,{icon:ue})}:{},title:$[n],description:Ve[n](e)}),a&&t.jsx("progress",{className:"vgai-generation-progress","aria-label":`${e.label} progress`,...n==="running"&&e.progress!==void 0?{value:e.progress,max:1}:{}})]})}function Qe({job:e,busy:n,error:a,run:i}){return t.jsxs("div",{className:"vgai-generation-card-actions",children:[L(e,a)&&t.jsx(p,{size:"compact",variant:"primary",disabled:n,onClick:()=>i(()=>M(e)),children:n?"Saving…":"Retry save"}),t.jsx(p,{size:"compact",variant:"ghost",onClick:()=>K(e),children:"Details"}),F(e)&&t.jsx(p,{size:"compact",variant:"ghost",disabled:n,onClick:()=>i(()=>U(e.id)),children:"Remove"})]})}function Xe({job:e,busy:n,error:a,run:i}){const r=j(e),l=q(e),s=Pe(e),c=Te(e),g=o=>{if(!o.url)return;const m=fe(he(o.name));if(m)return()=>xe(o.url,m)};return t.jsxs("article",{className:"vgai-generation-card","data-state":r,"aria-busy":J(e),"aria-label":C(e),onClickCapture:()=>{c&&$e(e.id).catch(o=>{de.warn(`Could not mark generation as seen: ${o instanceof Error?o.message:String(o)}`,"generations")})},children:[t.jsx("div",{className:"vgai-generation-card-media","data-outputs":Math.min(l.length,4),children:l.length===0?t.jsx(Ye,{job:e,state:r}):l.map(o=>t.jsx("div",{className:"vgai-generation-output",title:o.path,children:t.jsx(We,{output:o,onOpen:g(o)})},o.path))}),t.jsxs("div",{className:"vgai-generation-card-body",children:[t.jsxs("div",{className:"vgai-generation-card-heading",children:[t.jsx(h,{variant:"label",truncate:!0,title:C(e),children:C(e)}),t.jsxs(R,{className:"vgai-generation-chip","data-state":r,children:[$[r],r==="running"&&e.progress!==void 0?` · ${Math.round(e.progress*100)}%`:""]}),c&&t.jsx(R,{className:"vgai-generation-chip","data-state":"new",children:"New"})]}),t.jsxs(h,{variant:"caption",tone:"muted",truncate:!0,title:I(e),children:[e.provider," · ",I(e)]}),t.jsxs(h,{variant:"caption",tone:"dim",children:[_e(e.billing),Me(e.billing)?"":" (est.)"," · ",Be(e)," ·"," ",Ue(e.updatedAt)]}),s&&t.jsx("p",{className:"vgai-generation-card-prompt",title:s,children:s}),(a??e.pollError)&&t.jsx(B,{tone:a||r==="save-failed"?"error":"warning",className:"vgai-generation-card-alert",children:a??(r==="save-failed"?`Could not save into the project: ${e.pollError}`:`Polling will retry: ${e.pollError}`)}),t.jsx(Qe,{job:e,busy:n,error:a,run:i})]})]})}function He(){const{jobs:e}=u.useSyncExternalStore(T,x,x),[n,a]=u.useState(null),[i,r]=u.useState({}),l=e.filter(J).length,s=e.filter(o=>j(o)==="saving").length,c=async(o,m)=>{a(o),r(v=>{const f={...v};return delete f[o],f});try{await m()}catch(v){const f=v instanceof Error?v.message:String(v);r(y=>({...y,[o]:f}))}finally{a(null)}},g=ke();return t.jsxs("div",{className:"vgai-generation-gallery",children:[t.jsxs(le,{label:"Generations",compact:!0,className:"vgai-generation-gallery-bar",children:[t.jsx(h,{variant:"label",children:"Generations"}),t.jsxs(h,{variant:"caption",tone:"muted",children:[e.length," ",e.length===1?"generation":"generations",l>0?` · ${l} running`:"",s>0?` · ${s} saving`:""]}),t.jsx(ce,{}),t.jsx(p,{size:"compact",variant:"ghost",onClick:()=>void Se().then(z),children:"Refresh"}),t.jsx(p,{size:"compact",variant:"primary",onClick:()=>k(),children:"New asset"})]}),g&&t.jsx(B,{tone:"error",className:"vgai-generation-gallery-alert",children:g}),e.length===0?t.jsx(P,{className:"vgai-generation-gallery-empty",title:"No generated assets yet",description:"Preview generated images, video, audio and models here. Create an asset to get started.",action:t.jsx(p,{size:"compact",variant:"primary",onClick:()=>k(),children:"New asset"})}):t.jsx("section",{className:"vgai-generation-grid","aria-label":"Generated assets",children:e.map(o=>t.jsx(Xe,{job:o,busy:n===o.id,error:i[o.id]??null,run:m=>void c(o.id,m)},o.id))})]})}const kt="workspace.service",Ze="generation";function et(){const e=we(x().jobs);return e>0?{count:e,severity:"info"}:null}function Tt(){const e=[Ae(),je({...ye.generations,order:15,Content:He,badge:et,subscribeBadge:T,badgeSnapshot:be,visibleByDefault:!1,closeable:!0}),Ne({id:Ze,owner:"@volter/editor-game/generation",open:(n,a)=>{if(a.id==="create")return k();const i=x().jobs.find(r=>r.id===a.id);return i?K(i):null},settle:z})];return()=>{for(const n of e)n()}}export{kt as point,Tt as start};
@@ -1 +1 @@
1
- import{e4 as p,r as o,v as n,by as e,t as l,u as t,bw as m,e8 as c}from"./index-BRJMIUK0.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";const u=m(["queued","running","succeeded","failed","cancelled"]),g=p("route",[o({route:n("mock")}).strict(),o({route:n("managed"),estimatedCredits:e().nonnegative().optional(),settledCredits:e().nonnegative().optional()}).strict(),o({route:n("byok"),currency:n("USD"),estimatedAmount:e().nonnegative().optional(),settledAmount:e().nonnegative().optional()}).strict()]),r=o({tool:t().min(1),input:c()}).strict(),v=o({id:t().min(1),provider:t().min(1),externalId:t().min(1),label:t().min(1),operation:t().min(1),mode:m(["mock","direct","managed"]),status:u,createdAt:t().datetime(),updatedAt:t().datetime(),progress:e().min(0).max(1).optional(),providerStatus:t().optional(),queuePosition:e().int().nonnegative().optional(),message:t().optional(),lastPolledAt:t().datetime().optional(),lastProviderChangeAt:t().datetime().optional(),pollError:t().optional(),pollErrorAt:t().datetime().optional(),pollFailureCount:e().int().nonnegative().optional(),nextPollAt:t().datetime().optional(),billing:g,poll:r,cancel:r.optional(),accept:r.optional(),acceptedAt:t().datetime().optional(),readAt:t().datetime().optional(),provenanceOperationId:t().optional(),outputPaths:l(t()).optional()}).strict(),x=o({version:n(1),jobs:l(v)}).strict();function y(d,s){if(d!=="managed")return{};const{estimatedCredits:i,settledCredits:a}=s;return i===void 0&&a===void 0?{}:{billing:{route:"managed",...i===void 0?{}:{estimatedCredits:i},...a===void 0?{}:{settledCredits:a}}}}export{g as GenerationBillingSchema,v as GenerationJobSchema,u as GenerationJobStatusSchema,x as GenerationJobsDocumentSchema,y as managedBilling};
1
+ import{dX as p,r as o,v as n,bz as e,t as l,u as t,bx as d,d$ as c}from"./index-CaG87ZF-.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";const u=d(["queued","running","succeeded","failed","cancelled"]),g=p("route",[o({route:n("mock")}).strict(),o({route:n("managed"),estimatedCredits:e().nonnegative().optional(),settledCredits:e().nonnegative().optional()}).strict(),o({route:n("byok"),currency:n("USD"),estimatedAmount:e().nonnegative().optional(),settledAmount:e().nonnegative().optional()}).strict()]),r=o({tool:t().min(1),input:c()}).strict(),v=o({id:t().min(1),provider:t().min(1),externalId:t().min(1),label:t().min(1),operation:t().min(1),mode:d(["mock","direct","managed"]),status:u,createdAt:t().datetime(),updatedAt:t().datetime(),progress:e().min(0).max(1).optional(),providerStatus:t().optional(),queuePosition:e().int().nonnegative().optional(),message:t().optional(),lastPolledAt:t().datetime().optional(),lastProviderChangeAt:t().datetime().optional(),pollError:t().optional(),pollErrorAt:t().datetime().optional(),pollFailureCount:e().int().nonnegative().optional(),nextPollAt:t().datetime().optional(),billing:g,poll:r,cancel:r.optional(),accept:r.optional(),acceptedAt:t().datetime().optional(),readAt:t().datetime().optional(),provenanceOperationId:t().optional(),outputPaths:l(t()).optional()}).strict(),k=o({version:n(1),jobs:l(v)}).strict();function y(m,s){if(m!=="managed")return{};const{estimatedCredits:i,settledCredits:a}=s;return i===void 0&&a===void 0?{}:{billing:{route:"managed",...i===void 0?{}:{estimatedCredits:i},...a===void 0?{}:{settledCredits:a}}}}export{g as GenerationBillingSchema,v as GenerationJobSchema,u as GenerationJobStatusSchema,k as GenerationJobsDocumentSchema,y as managedBilling};
@@ -1 +1 @@
1
- import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{Z as r,q as a,a5 as i}from"./index-BRJMIUK0.js";import{r as u}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{s as c,g as e,a as p,b as m}from"./generation-jobs-BZhOMrp-.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const I="workspace.status",$="Generations",C="left",T=24;function U(){const{jobs:s}=u.useSyncExternalStore(c,e,e),n=p(s),t=s.filter(m).length;return o.jsxs(r,{type:"button",variant:"ghost",size:"compact",className:"vgai-status-action","data-testid":"status-generations","aria-label":`Generations, ${n} unseen, ${t} running`,title:`${n} unseen generation results, ${t} running — open Generations`,onClick:()=>a().workspace.showUtility(i.generations.id),children:["Generations · ",n,t>0?` · ${t} running`:""]})}export{C as align,U as default,T as order,I as point,$ as title};
1
+ import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{$ as r,q as a,a6 as i}from"./index-CaG87ZF-.js";import{r as u}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{s as c,g as e,a as p,b as m}from"./generation-jobs-CiabIfR0.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const h="workspace.status",I="Generations",C="left",T=24;function U(){const{jobs:s}=u.useSyncExternalStore(c,e,e),n=p(s),t=s.filter(m).length;return o.jsxs(r,{type:"button",variant:"ghost",size:"compact",className:"vgai-status-action","data-testid":"status-generations","aria-label":`Generations, ${n} unseen, ${t} running`,title:`${n} unseen generation results, ${t} running — open Generations`,onClick:()=>a().workspace.showUtility(i.generations.id),children:["Generations · ",n,t>0?` · ${t} running`:""]})}export{C as align,U as default,T as order,h as point,I as title};
@@ -1 +1 @@
1
- import{g as o}from"./workspace-arrangement-BdAlBwvd.js";function r(t){const n=o(t,"vgaiComponentRoot");return typeof n=="string"&&n?n:void 0}function i(t){return o(t,"vgaiBuiltInternal")===!0}export{r as c,i};
1
+ import{g as o}from"./workspace-arrangement-DIMM7ska.js";function r(t){const n=o(t,"vgaiComponentRoot");return typeof n=="string"&&n?n:void 0}function i(t){return o(t,"vgaiBuiltInternal")===!0}export{r as c,i};
@@ -1,2 +1,2 @@
1
- import{kt as k,u as l,r as y,ku as P,t as b,b0 as T}from"./index-BRJMIUK0.js";import{i as x}from"./relative-path-guard-GiM7Lsz8.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";const d=".vgai/assets.json",E=y({key:l().min(1),license:l().min(1).optional(),sourceHash:l().regex(/^sha256-[a-f0-9]{64}$/,'sourceHash must be "sha256-<64 hex>"').optional(),materializedAt:l().datetime()}).strict(),O=k(l().min(1),E);function z(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error(`Not a sha256 digest, refusing to record it as a sourceHash: ${e}`);return`sha256-${e}`}function m(e){const t=e.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"");if(!t)throw new Error("An asset ledger path cannot be empty.");if(!x(t))throw new Error(`An asset ledger path cannot escape the project: ${e}`);return t}function _(e){return O.parse(e)}function D(e){if(e==null||e.trim()==="")return{};let t;try{t=JSON.parse(e)}catch(s){throw new Error(`${d} is not valid JSON: ${String(s)}`)}return _(t)}function I(e,t,s){const r=m(t),n=E.parse(s),a={...e,[r]:n},i={};for(const u of Object.keys(a).sort())i[u]=a[u];return i}function M(e){const t={};for(const s of Object.keys(e).sort())t[s]=e[s];return`${JSON.stringify(t,null,2)}
1
+ import{ku as k,u as l,r as y,kv as P,t as b,b1 as T}from"./index-CaG87ZF-.js";import{i as x}from"./relative-path-guard-GiM7Lsz8.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";const d=".vgai/assets.json",E=y({key:l().min(1),license:l().min(1).optional(),sourceHash:l().regex(/^sha256-[a-f0-9]{64}$/,'sourceHash must be "sha256-<64 hex>"').optional(),materializedAt:l().datetime()}).strict(),O=k(l().min(1),E);function z(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error(`Not a sha256 digest, refusing to record it as a sourceHash: ${e}`);return`sha256-${e}`}function m(e){const t=e.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"");if(!t)throw new Error("An asset ledger path cannot be empty.");if(!x(t))throw new Error(`An asset ledger path cannot escape the project: ${e}`);return t}function _(e){return O.parse(e)}function D(e){if(e==null||e.trim()==="")return{};let t;try{t=JSON.parse(e)}catch(s){throw new Error(`${d} is not valid JSON: ${String(s)}`)}return _(t)}function I(e,t,s){const r=m(t),n=E.parse(s),a={...e,[r]:n},i={};for(const u of Object.keys(a).sort())i[u]=a[u];return i}function M(e){const t={};for(const s of Object.keys(e).sort())t[s]=e[s];return`${JSON.stringify(t,null,2)}
2
2
  `}function U(e,t,s){const r=globalThis.navigator?.locks;return r?r.request(`vgai:${e}:${P(t)}`,s):s()}const H=1e4,N=15;function j(){return globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`}async function R(e,t,s={}){const r=s.staleAfterMs??H,n=s.retryDelayMs??N,a=s.now??Date.now,i=s.sleep??(o=>new Promise(c=>setTimeout(c,o))),u=s.token??j;for(;;){const o=JSON.stringify({at:a(),owner:s.owner??"unknown",token:u()});if(await e.createIfAbsent(o))try{return await t()}finally{await e.removeIfHeldBy(o)}const c=await e.read();if(c!==null){if(a()-B(c)>r){await e.removeIfHeldBy(c);continue}await i(n)}}}function B(e){try{const t=JSON.parse(e);return typeof t.at=="number"?t.at:0}catch{return 0}}function J(){const e=new Map;return(t,s)=>{const n=(e.get(t)??Promise.resolve()).then(s,s),a=n.then(()=>{},()=>{});return e.set(t,a),a.then(()=>{e.get(t)===a&&e.delete(t)}),n}}async function S(e){return await e.exists(d)?D(await e.read(d)):{}}async function F(e,t){await e.write(d,M(t))}const f=`${d}.lock`,C=J(),A=new WeakMap;let $=0;function K(e){const t=A.get(e);if(t!==void 0)return t;$+=1;const s=`${e.id}#${$}`;return A.set(e,s),s}async function W(e,t){const s={key:t.key,...t.license?{license:t.license}:{},...t.sourceSha256?{sourceHash:z(t.sourceSha256)}:{},materializedAt:t.materializedAt??new Date().toISOString()};await C(K(e),()=>R({createIfAbsent:r=>e.writeIfAbsent(f,r),read:async()=>await e.exists(f)?e.read(f):null,removeIfHeldBy:r=>U(e.id,f,async()=>{await e.exists(f)&&await e.read(f)===r&&await e.remove(f)})},async()=>{const r=await S(e);await F(e,I(r,m(t.destPath),s))},{owner:e.id}))}const G=y({key:l().regex(/^[^:]+:.+$/,'An asset key must be "source:id"'),dest:l().min(1),sha256:l().regex(/^[a-f0-9]{64}$/,"A pack entry must pin the sha256 of its bytes as 64 lowercase hex digits")}).strict(),Y=y({packs:k(l().min(1),b(G))}).strict();function q(e){return Y.parse(e)}function V(e){const t=[],s=new Map;for(const[r,n]of Object.entries(e.packs))for(const a of n){const i=s.get(a.dest);if(i!==void 0)throw new Error(`Two packs declare the same destination "${a.dest}": "${i}" and "${r}".`);s.set(a.dest,r),t.push({...a,pack:r})}return t}const w="asset-manifest.json",v="https://vgai-asset-library.aaron-0ed.workers.dev";function L(e){return(e.baseUrl??v).replace(/\/+$/,"")}function Q(e){return e.signal?{signal:e.signal}:{}}async function X(e,t={}){const s=L(t),r=await fetch(`${s}/v1/assets/${encodeURIComponent(e)}`,Q(t));if(!r.ok)return null;const n=await r.json();return!n||typeof n!="object"||!Array.isArray(n.files)?null:n}function Z(e,t,s,r){return`${L(e?{baseUrl:e}:{})}/v1/assets/${encodeURIComponent(t)}/files/${s}`}async function he(e,t={}){const s=await ee(e),r={declared:s.length,materialized:[],alreadyPresent:[],failed:[]};if(s.length===0)return r;const n=await S(e);for(const a of s){if(t.signal?.aborted)break;if(n[m(a.dest)]&&await e.exists(a.dest)){r.alreadyPresent.push(a),t.onProgress?.(a,"already-present");continue}try{await te(e,a,t),r.materialized.push(a),t.onProgress?.(a,"materialized")}catch(i){r.failed.push({entry:a,reason:i instanceof Error?i.message:String(i)}),t.onProgress?.(a,"failed")}}return r}async function ee(e){if(!await e.exists(w))return[];const t=await e.read(w);let s;try{s=JSON.parse(t)}catch(r){throw new Error(`${w} is not valid JSON: ${r instanceof Error?r.message:String(r)}`)}return V(q(s))}async function te(e,t,s){const r=await se(t,s);await e.write(t.dest,r.bytes),await W(e,{destPath:t.dest,key:t.key,license:r.license,sourceSha256:t.sha256})}async function se(e,t={}){const s=e.key.indexOf(":");if(s<0)throw new Error(`Malformed asset key "${e.key}" (expected "source:id").`);const r=e.key.slice(0,s),n=e.key.slice(s+1);if(r!=="local")throw new Error(`Asset key "${e.key}": only the "local" (cloud-hosted) source can be materialized from the cloud worker.`);const a=t.baseUrl??v,i=t.signal?{baseUrl:a,signal:t.signal}:{baseUrl:a},u=await X(n,i);if(!u)throw new Error(`"${e.key}" is not hosted by the cloud asset library.`);const o=u.files[0];if(!o)throw new Error(`"${e.key}" has no files in the cloud library.`);if(o.dependencies.length>0)throw new Error(`"${e.key}" has ${o.dependencies.length} dependency file(s) — a pack entry names exactly one destination file.`);if(o.main.sha256!==e.sha256)throw new Error(`"${e.key}" → ${e.dest}: the cloud library reports sha256:${o.main.sha256} but ${w} pins sha256:${e.sha256}. Nothing was fetched or written; the pin is only re-cut by a reviewed change to the declaration.`);const c=Z(a,n,0),h=await fetch(c,t.signal?{signal:t.signal}:{});if(!h.ok)throw new Error(`${c} returned ${h.status} ${h.statusText}.`);const g=new Uint8Array(await h.arrayBuffer()),p=await T(g);if(p!==e.sha256)throw new Error(`"${e.key}" → ${e.dest}: ${c} delivered sha256:${p} but the declaration pins sha256:${e.sha256}. Nothing was written.`);return{bytes:g,license:u.license}}export{w as ASSET_MANIFEST_PATH,se as fetchVerifiedPackEntry,he as materializeDeclaredAssetPacks};