@volter/game-editor 0.5.87 → 0.5.89

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 (299) hide show
  1. package/BUNDLED_NOTICES +22 -22
  2. package/catalog/entries/blender.json +2 -2
  3. package/catalog/entries/music.json +2 -2
  4. package/dist/.vite/manifest.json +2111 -2111
  5. package/dist/assets/{AssetBudgetPanel-D0x2TPPy.js → AssetBudgetPanel-DzURBeos.js} +3 -3
  6. package/dist/assets/{AudioViewer-7fv2_fIl.js → AudioViewer-Bjv_IoEK.js} +1 -1
  7. package/dist/assets/{CanvasBoardDocument-BUQYVz1c.js → CanvasBoardDocument-BGQ7YLW7.js} +1 -1
  8. package/dist/assets/{CanvasSceneViewport-TaZbM0Uh.js → CanvasSceneViewport-zDjY0paV.js} +1 -1
  9. package/dist/assets/{ColorInput-28XnXD8Q.js → ColorInput-CuQY7Ukq.js} +1 -1
  10. package/dist/assets/{EntityModelDocument-BQrvx0KQ.js → EntityModelDocument-Ci2gTM0_.js} +1 -1
  11. package/dist/assets/{EnvironmentAssetDocument-C5PRXs6G.js → EnvironmentAssetDocument-sGeD9CmA.js} +1 -1
  12. package/dist/assets/{GameplaySessionTimeline-Dm7lYtRi.js → GameplaySessionTimeline-BOP2Rzca.js} +1 -1
  13. package/dist/assets/{ImageViewer-CxnMTLaT.js → ImageViewer-BcGUTWQl.js} +1 -1
  14. package/dist/assets/InspectorObjectPreview-DmfoiHtC.js +1 -0
  15. package/dist/assets/{JsonAssetDocument-CcbpdU55.js → JsonAssetDocument-Xr6gjvcn.js} +1 -1
  16. package/dist/assets/{LiveModuleDocument-0Y2ulK7n.js → LiveModuleDocument-9cuyXCj5.js} +1 -1
  17. package/dist/assets/{LutAssetDocument-CRDeRQAX.js → LutAssetDocument-Bsha8T14.js} +1 -1
  18. package/dist/assets/{ModelAssetDocument-ncfazuj_.js → ModelAssetDocument-7R43ez0l.js} +1 -1
  19. package/dist/assets/{NonThreeAuthoringBootstrap-CDUdubAw.js → NonThreeAuthoringBootstrap-wLP33ygR.js} +1 -1
  20. package/dist/assets/{Object3DDocumentToolbar-C1YPcedp.js → Object3DDocumentToolbar-CIq-prtb.js} +1 -1
  21. package/dist/assets/Object3DDocumentViewport-5UbfDYx0.js +2 -0
  22. package/dist/assets/{Object3DPreview-XQ6au59A.js → Object3DPreview-4vfSYgvf.js} +1 -1
  23. package/dist/assets/{OnlineAssetDetail-Dq7qIQlJ.js → OnlineAssetDetail-BPVmIMPQ.js} +1 -1
  24. package/dist/assets/{PlayBar-Bv5GHcPD.js → PlayBar-BvBQdixl.js} +1 -1
  25. package/dist/assets/{QuarksAssetDocument-DYm3hBv_.js → QuarksAssetDocument-NerGNPg0.js} +1 -1
  26. package/dist/assets/{ReactCanvasControls-Dp4Mrlcc.js → ReactCanvasControls-SptIZCBm.js} +1 -1
  27. package/dist/assets/{RootSelectionOverlay-cQHen-VZ.js → RootSelectionOverlay-D7sUM12Z.js} +1 -1
  28. package/dist/assets/{ShaderAssetDocument-C7kkzHkA.js → ShaderAssetDocument-DEt0lzyh.js} +1 -1
  29. package/dist/assets/{ShadowEditor-PJ_mLUFF.js → ShadowEditor-CuWsWRr6.js} +1 -1
  30. package/dist/assets/{SourceAssetViewer-DgOFkYF8.js → SourceAssetViewer-MYdqpyCb.js} +1 -1
  31. package/dist/assets/StageHost-CiSH61U_.js +2 -0
  32. package/dist/assets/{StoryPreviewMount-BgEpExfI.js → StoryPreviewMount-CfSy0VwU.js} +1 -1
  33. package/dist/assets/{ThreeBoardDocument-BuRk6Y48.js → ThreeBoardDocument-CtUpkbIn.js} +2 -2
  34. package/dist/assets/{ThreeIsolationSceneContent-DFuMyzKv.js → ThreeIsolationSceneContent-BYYWnbjH.js} +1 -1
  35. package/dist/assets/{ToolObject3DPreview-Cp8p3a28.js → ToolObject3DPreview-OBfMBUDF.js} +1 -1
  36. package/dist/assets/{Toolbar-vKOFpei3.js → Toolbar-CxS4bdaI.js} +1 -1
  37. package/dist/assets/{TransientHint-C5KuaIRn.js → TransientHint-D61eMqKf.js} +1 -1
  38. package/dist/assets/{VideoViewer-DUUQ1ea_.js → VideoViewer-CipXVi35.js} +1 -1
  39. package/dist/assets/{ViewportShadingMenu-T8V04Ys6.js → ViewportShadingMenu-DTn7jMyb.js} +1 -1
  40. package/dist/assets/{active-ingest-pGqBlJ3x.js → active-ingest-LYjpgY9a.js} +2 -2
  41. package/dist/assets/{animation-clock-BTHwjILC.js → animation-clock-BcjKnlWY.js} +1 -1
  42. package/dist/assets/{animation-mixers.service-DeVSjWCQ.js → animation-mixers.service-DlJoI9HX.js} +1 -1
  43. package/dist/assets/{animation-timeline.utility-BDxeS3S6.js → animation-timeline.utility-BU8dSrf_.js} +1 -1
  44. package/dist/assets/{asset-budget-asset.menu-DeXFc_i4.js → asset-budget-asset.menu-B8IP-Hc9.js} +1 -1
  45. package/dist/assets/{asset-budget.action-ahMeLSui.js → asset-budget.action-C4kmlL33.js} +1 -1
  46. package/dist/assets/{asset-budget.document-KWIkUTsV.js → asset-budget.document-C9UTBsOF.js} +1 -1
  47. package/dist/assets/{asset-budget.menu-Cqqi1SeP.js → asset-budget.menu-B-iPbxew.js} +1 -1
  48. package/dist/assets/{asset-editor-persistence-DXkf1Ont.js → asset-editor-persistence-BRnb4jvT.js} +1 -1
  49. package/dist/assets/{asset-loaders-CbVPGx4H.js → asset-loaders-C3GABpnY.js} +1 -1
  50. package/dist/assets/{asset-preview-CzxD7k3P.js → asset-preview-C_0EqGmT.js} +1 -1
  51. package/dist/assets/{audio-unlock.service-GcroL0E_.js → audio-unlock.service-BptKOQO1.js} +1 -1
  52. package/dist/assets/{audio.utility-C4N50YHj.js → audio.utility-DCWEdoWy.js} +1 -1
  53. package/dist/assets/autoplay.service-D_fRasDc.js +1 -0
  54. package/dist/assets/{babylon-authoring-adapter-BOmSvh08.js → babylon-authoring-adapter-CACBsDlN.js} +1 -1
  55. package/dist/assets/{binding-resolver-DJANjeUb.js → binding-resolver-BU_WvMpR.js} +2 -2
  56. package/dist/assets/{blender-emscripten-engine-3RrRUwov.js → blender-emscripten-engine-CbHHZuUu.js} +1 -1
  57. package/dist/assets/{blender-node-editor.document-YYmUWtFG.js → blender-node-editor.document-QB62WBX4.js} +1 -1
  58. package/dist/assets/{blender-properties-tab-D80eJbBQ.js → blender-properties-tab-BD_ERulO.js} +1 -1
  59. package/dist/assets/{blender-runtime-host-Bn0epPY3.js → blender-runtime-host-DpyeRB-e.js} +2 -2
  60. package/dist/assets/{blender-runtime-skin-Cn0ASAMa.js → blender-runtime-skin-B-KaOx39.js} +2 -2
  61. package/dist/assets/blender-runtime.document-CTLsZn-9.js +12 -0
  62. package/dist/assets/{blender-screenshot.menu-G1T9yHAS.js → blender-screenshot.menu-DcgjDXya.js} +1 -1
  63. package/dist/assets/{blender-timeline.document-CAGoSZu5.js → blender-timeline.document-C7-UEVr2.js} +1 -1
  64. package/dist/assets/{blender-uv-editor.document-DYPUZcpl.js → blender-uv-editor.document-lclK5qPX.js} +1 -1
  65. package/dist/assets/{blender-version.status-DsVsMeQK.js → blender-version.status-DZv7eV2U.js} +1 -1
  66. package/dist/assets/{blender-wali-engine-DGwF1KiV.js → blender-wali-engine-uH9q2l3f.js} +1 -1
  67. package/dist/assets/{blender.command-CcERMUCW.js → blender.command-BjHEelMQ.js} +1 -1
  68. package/dist/assets/{board-guides-00sD4eH-.js → board-guides-BA6WCb96.js} +1 -1
  69. package/dist/assets/{bridge.command-CMoJfehR.js → bridge.command-CUhxGpj2.js} +3 -3
  70. package/dist/assets/{browserAll-11QAfzPK.js → browserAll-EMydKylk.js} +1 -1
  71. package/dist/assets/{build-player.document-DsUvuNEg.js → build-player.document-DF_n7mCc.js} +1 -1
  72. package/dist/assets/{build-profiles.document-Dplz6cEh.js → build-profiles.document-BGmStXtV.js} +1 -1
  73. package/dist/assets/{build-progress.status-DcyAYfmg.js → build-progress.status-BNYV8dLT.js} +1 -1
  74. package/dist/assets/{build-session-B1kjCtLl.js → build-session-Dfo6ygXA.js} +1 -1
  75. package/dist/assets/{build.action-DkF5EN9B.js → build.action-DyzZR4nY.js} +1 -1
  76. package/dist/assets/{build.command-BPqTTSKN.js → build.command-D1dxLByR.js} +1 -1
  77. package/dist/assets/{build.header-f8Tr7zEY.js → build.header-Dd4Vfzk5.js} +1 -1
  78. package/dist/assets/{build.menu-DLaEv9N7.js → build.menu-haq0aE0s.js} +1 -1
  79. package/dist/assets/{build.service-Dy6AryUr.js → build.service-C0PLYrGi.js} +1 -1
  80. package/dist/assets/{camera-8sZjiQAG.js → camera-BQnvv5fW.js} +1 -1
  81. package/dist/assets/{camera-runtime.inspector-DZZS6sNs.js → camera-runtime.inspector-DY8V2BIf.js} +1 -1
  82. package/dist/assets/{canvas-design-mount-BVYzxXv8.js → canvas-design-mount-BHkK0LpO.js} +3 -3
  83. package/dist/assets/{canvas-entry-runtime-DjWxb-E0.js → canvas-entry-runtime-0dJpA53a.js} +2 -2
  84. package/dist/assets/{canvas-preview-frames-BrQTpJQz.js → canvas-preview-frames-BFWsz9nA.js} +1 -1
  85. package/dist/assets/{canvas-story-capture.service-BAkinpiS.js → canvas-story-capture.service-DkK9YEBa.js} +2 -2
  86. package/dist/assets/{capability-coverage-B6O--La7.js → capability-coverage-LbU4Sxnt.js} +1 -1
  87. package/dist/assets/{collaboration-presence-cP5Ts934.js → collaboration-presence-B_rzt_Ua.js} +1 -1
  88. package/dist/assets/{collider-54zqlTON.js → collider-ByI7A54k.js} +1 -1
  89. package/dist/assets/{component-board.service-DDeBE2OE.js → component-board.service-BpDTVVAI.js} +2 -2
  90. package/dist/assets/{component-board.service-DhZt21fj.js → component-board.service-C0oYmE9t.js} +2 -2
  91. package/dist/assets/{component-board.service-D0VCR7cX.js → component-board.service-DtE1d9v1.js} +2 -2
  92. package/dist/assets/{component-contracts.service-Dc6K48l4.js → component-contracts.service-FqaewMKQ.js} +1 -1
  93. package/dist/assets/{component-instance-root-DdBt03jn.js → component-instance-root-BNr-40yw.js} +1 -1
  94. package/dist/assets/{component-verbs.command-DLa5nz3l.js → component-verbs.command-DGDMOsdk.js} +1 -1
  95. package/dist/assets/{component-verbs.service-B84g803c.js → component-verbs.service-C1NY4Sth.js} +1 -1
  96. package/dist/assets/{config-zfLGOjWb.js → config-BNYp1dbK.js} +2 -2
  97. package/dist/assets/{configurations-CGDwLMu_.js → configurations-WH5EPk8d.js} +1 -1
  98. package/dist/assets/{connection.status-BFzCWtq1.js → connection.status-hDer8RHe.js} +1 -1
  99. package/dist/assets/{constraints.inspector-CXekv0Vm.js → constraints.inspector-DCDUNzXi.js} +1 -1
  100. package/dist/assets/{content-bounds-CI1FWjZr.js → content-bounds-DMLXg0Ob.js} +1 -1
  101. package/dist/assets/{contract-system-adapters-jyRyHuQ8.js → contract-system-adapters-CsMtQANL.js} +1 -1
  102. package/dist/assets/{coverage.service-D4yN5TY8.js → coverage.service-DkOf3jFn.js} +1 -1
  103. package/dist/assets/{create-runtime-BjLMBQRi.js → create-runtime-A9IjDY9I.js} +1 -1
  104. package/dist/assets/{curve-DSNbckBp.js → curve-DOpfSq5v.js} +1 -1
  105. package/dist/assets/{data-asset-BKaaE_1L.js → data-asset-CNGL3WNY.js} +1 -1
  106. package/dist/assets/{data-ref-DncjB-QD.js → data-ref-CZlj4K6p.js} +1 -1
  107. package/dist/assets/{debug-bridge-BPhia8r7.js → debug-bridge-C2ydYYkR.js} +1 -1
  108. package/dist/assets/{debug-registry-C9Ke9_60.js → debug-registry-SleqbaS2.js} +1 -1
  109. package/dist/assets/{deferred-ingest-play-PPRnQWUC.js → deferred-ingest-play-BSFkfZKQ.js} +2 -2
  110. package/dist/assets/{design-time-canvas-mount-74odEa7g.js → design-time-canvas-mount-D65uuYQ7.js} +2 -2
  111. package/dist/assets/{design-time-layers-Ct04Hsts.js → design-time-layers-q1BaQsMZ.js} +1 -1
  112. package/dist/assets/{design-time-mount.service-BTAbxIOm.js → design-time-mount.service-BZXwHkG9.js} +2 -2
  113. package/dist/assets/{design-time-mount.service-Dvf8zkqu.js → design-time-mount.service-D6XPrjMo.js} +2 -2
  114. package/dist/assets/{design-time-react-mount-ZZj-ooUP.js → design-time-react-mount-C7V61i4j.js} +1 -1
  115. package/dist/assets/{document-preview-three-qv-LfRMg.js → document-preview-three-C7Lqobxp.js} +1 -1
  116. package/dist/assets/{dom-authoring-adapter-CuDSWSNb.js → dom-authoring-adapter-COdzQqK7.js} +1 -1
  117. package/dist/assets/{draco3d-B6aUXg6s.js → draco3d-iz9iYVwt.js} +1 -1
  118. package/dist/assets/{edit-mode-audio.service-BKoUB-tG.js → edit-mode-audio.service-BQwXzUX5.js} +1 -1
  119. package/dist/assets/{edit-mode-authoring-D81aayTm.js → edit-mode-authoring-yRPEq3c6.js} +1 -1
  120. package/dist/assets/{edit-mode-networking.service-DFB5C5ba.js → edit-mode-networking.service-VQu-oNGR.js} +1 -1
  121. package/dist/assets/{editor-api-DSvaYurK.js → editor-api-DkYQ4Mf7.js} +1 -1
  122. package/dist/assets/{editor-layers-CBGpXUff.js → editor-layers-psmpPtJ8.js} +1 -1
  123. package/dist/assets/{editor-shell-store-qkVBJ5hp.js → editor-shell-store-CLsRck8r.js} +1 -1
  124. package/dist/assets/{entity-object-DkwEzWRw.js → entity-object-CI5Ws16u.js} +1 -1
  125. package/dist/assets/{extend-CLTmKGid.js → extend-CVyU45KC.js} +1 -1
  126. package/dist/assets/{fork-menu-zClJ54w5.js → fork-menu-fgKUSFoA.js} +1 -1
  127. package/dist/assets/{frame-debugger-store-BBnS81lf.js → frame-debugger-store-C4h48Lk1.js} +1 -1
  128. package/dist/assets/{game-contract-seams-CQ6ox7EM.js → game-contract-seams-CtyMWXL3.js} +1 -1
  129. package/dist/assets/{game-css-scope-transform-CN_8Qjng.js → game-css-scope-transform-BRD7WElK.js} +1 -1
  130. package/dist/assets/{game-document.service-BMfUUdBk.js → game-document.service-5xW7XyMV.js} +1 -1
  131. package/dist/assets/{game-eval.command-DjPaPh0W.js → game-eval.command-BsdLCKBs.js} +1 -1
  132. package/dist/assets/{game-module-access-Dqt4Iyj9.js → game-module-access-DzeZ8taf.js} +1 -1
  133. package/dist/assets/{game-network-rU8CiVS9.js → game-network-BadWSUYT.js} +3 -3
  134. package/dist/assets/{gameplay-export-CvuSZBqw.js → gameplay-export-CzpOG_fP.js} +1 -1
  135. package/dist/assets/{gameplay-replay-DN_8e-mL.js → gameplay-replay-CiA4AIid.js} +1 -1
  136. package/dist/assets/{gameplay.command-feHlbPUd.js → gameplay.command-D34pNEIv.js} +1 -1
  137. package/dist/assets/{generation-jobs-ktwK3BpH.js → generation-jobs-DXPVDHPe.js} +1 -1
  138. package/dist/assets/{generation.service-CCk8hp9U.js → generation.service-D-v4Kboa.js} +1 -1
  139. package/dist/assets/{generations-CLxU3M32.js → generations-D4MdQolQ.js} +1 -1
  140. package/dist/assets/{generations.status-DNuE1Jbz.js → generations.status-CnpAZzCw.js} +1 -1
  141. package/dist/assets/{hierarchy-marks-jS62BeX5.js → hierarchy-marks-BUeQ6to3.js} +1 -1
  142. package/dist/assets/{hosted-asset-materialization-s3VISszg.js → hosted-asset-materialization-e4G0wAK4.js} +1 -1
  143. package/dist/assets/{index-SFPYv_SM.js → index-6ys6rxaj.js} +1 -1
  144. package/dist/assets/{index-CvsX-Yba.js → index-BUSnq0Z6.js} +1 -1
  145. package/dist/assets/{index-BmMDCu1J.js → index-BV1zcaKy.js} +1 -1
  146. package/dist/assets/{index-BkJMq17U.js → index-C5D8xjRu.js} +1 -1
  147. package/dist/assets/{index-BrB0Nhz0.js → index-C6GLGVwl.js} +1 -1
  148. package/dist/assets/{index-C-AbcRfU.js → index-D34RCuxS.js} +1 -1
  149. package/dist/assets/{index-DMLiFNqS.js → index-DAZrOXB3.js} +1 -1
  150. package/dist/assets/{index-D9mY4HWY.js → index-DBIFLhzt.js} +8 -8
  151. package/dist/assets/{index-D6w_9PlP.js → index-DouvpS6-.js} +2 -2
  152. package/dist/assets/{inference-diagnostics-A5B9gTUw.js → inference-diagnostics-CDR3DmKF.js} +1 -1
  153. package/dist/assets/{ingest-boot-viewport-BLsKtCr1.js → ingest-boot-viewport-BTBeKgzE.js} +1 -1
  154. package/dist/assets/{ingest-siblings-BzP3xOiB.js → ingest-siblings-Cj7VEwcy.js} +1 -1
  155. package/dist/assets/{ingest-source-persistence-BThzUuxZ.js → ingest-source-persistence-Bfhu6YfK.js} +1 -1
  156. package/dist/assets/{ingest.service-BWOTrTci.js → ingest.service-BU4np-aB.js} +1 -1
  157. package/dist/assets/{inspect-Dq9Josls.js → inspect-Ddg78nmj.js} +1 -1
  158. package/dist/assets/instances.command-eYwh5Dyr.js +1 -0
  159. package/dist/assets/{json-history-resource-9PueHFpl.js → json-history-resource-DFBTBtzt.js} +1 -1
  160. package/dist/assets/{layered-pick-0Okyt-XO.js → layered-pick-C0UzN9rC.js} +1 -1
  161. package/dist/assets/{light-BwkhC5IX.js → light-DglaQiPf.js} +1 -1
  162. package/dist/assets/{live-project-verbs-SDUR-zvs.js → live-project-verbs-CJ_zDSoA.js} +1 -1
  163. package/dist/assets/{machine.document-B5CwoKNt.js → machine.document-DKgl-HxK.js} +1 -1
  164. package/dist/assets/{machines.finder-BvxeCFhA.js → machines.finder-rzKrqf0P.js} +1 -1
  165. package/dist/assets/{material-CSVfeUuo.js → material-BtLdoiM1.js} +1 -1
  166. package/dist/assets/{material-factory-QE9DFL5K.js → material-factory-DVTrr57P.js} +1 -1
  167. package/dist/assets/{mesh-Bo_sjmdD.js → mesh-Dg-hqV4U.js} +1 -1
  168. package/dist/assets/{model-asset-sections.service-930QHt1S.js → model-asset-sections.service-Dz77qWhH.js} +1 -1
  169. package/dist/assets/{model-inspection-DPzXOOlc.js → model-inspection-BajTg63P.js} +1 -1
  170. package/dist/assets/{model-thumbnail-h7btiG_9.js → model-thumbnail-DQHRVOqE.js} +1 -1
  171. package/dist/assets/{models.finder-MCvsYYwL.js → models.finder-Jhy7YA-r.js} +1 -1
  172. package/dist/assets/{module-mode-BgMcHcSF.js → module-mode-B4YjyMYv.js} +2 -2
  173. package/dist/assets/{mount-canvas-ingest-root-CBRh2FuY.js → mount-canvas-ingest-root-XkqClzbU.js} +2 -2
  174. package/dist/assets/{mount-dom-ingest-root-Cjd8PL36.js → mount-dom-ingest-root-witYuq5g.js} +2 -2
  175. package/dist/assets/{mount-ingest-root-CZsGJYhm.js → mount-ingest-root-DeA7CLzy.js} +2 -2
  176. package/dist/assets/{mount-manifest-ExL3lRP3.js → mount-manifest-ivMktbkB.js} +1 -1
  177. package/dist/assets/{mount-three-ingest-root-Cd03g4Dp.js → mount-three-ingest-root-BmDUnQow.js} +1 -1
  178. package/dist/assets/{mounted-authoring-0w9-bjZS.js → mounted-authoring-zPVxiKxa.js} +1 -1
  179. package/dist/assets/{mounted-story-viewport-source-dan_Vkgv.js → mounted-story-viewport-source-ByPTlo40.js} +1 -1
  180. package/dist/assets/{native-debug-module-DmU0unhp.js → native-debug-module-DEIj-ml1.js} +1 -1
  181. package/dist/assets/{navigation-Bc9nb-uQ.js → navigation-Yf3zwolr.js} +1 -1
  182. package/dist/assets/{navmesh.menu-D1QrM_-o.js → navmesh.menu-CaH6tdbH.js} +1 -1
  183. package/dist/assets/{navmesh.service-CLOjMejZ.js → navmesh.service-qPZ8sHuM.js} +1 -1
  184. package/dist/assets/network-observer.service-BGd1BMED.js +1 -0
  185. package/dist/assets/{network.utility-zwrDmtd_.js → network.utility-DCa1vV7t.js} +1 -1
  186. package/dist/assets/{object3d-document-session-registry-PR4Yulm3.js → object3d-document-session-registry-DYr6Iepm.js} +2 -2
  187. package/dist/assets/{oid-transform-C2fzvPah.js → oid-transform-DP9nPVMY.js} +1 -1
  188. package/dist/assets/{particles-CHbu-G1Q.js → particles-HwlzQnli.js} +1 -1
  189. package/dist/assets/{pixi-authoring-adapter-9s9JpXqj.js → pixi-authoring-adapter-CQVwY0mw.js} +1 -1
  190. package/dist/assets/{pixi-live-write-target-PTG8VADy.js → pixi-live-write-target-B0CUAzvW.js} +1 -1
  191. package/dist/assets/{play.command-BR_Yo82K.js → play.command-CSYsCbbE.js} +2 -2
  192. package/dist/assets/{presentation-2yyoHrBo.js → presentation-1SZXKXRj.js} +1 -1
  193. package/dist/assets/{product-Uo-d2MPf.js → product-CF4E_r6C.js} +1 -1
  194. package/dist/assets/{profiler.action-CvDYE5cW.js → profiler.action-BIvAZOpX.js} +1 -1
  195. package/dist/assets/{profiler.menu-B66yUdVF.js → profiler.menu-B-IVHBPz.js} +1 -1
  196. package/dist/assets/{profiler.utility-5fF94exR.js → profiler.utility-CKeHA3jm.js} +1 -1
  197. package/dist/assets/{project-authoring-session-DvpmSYet.js → project-authoring-session-d1SmjQh8.js} +2 -2
  198. package/dist/assets/{properties-bone-constraints.inspector-DBRuBJ33.js → properties-bone-constraints.inspector-C1nbUxby.js} +1 -1
  199. package/dist/assets/{properties-bone.inspector-CfK2l-bJ.js → properties-bone.inspector-B4CVy1PL.js} +1 -1
  200. package/dist/assets/{properties-collection.inspector-LFWBWYfs.js → properties-collection.inspector-BAb5XRrg.js} +1 -1
  201. package/dist/assets/{properties-constraints.inspector-DPokGobY.js → properties-constraints.inspector-CTi1QOaJ.js} +1 -1
  202. package/dist/assets/{properties-data.inspector-CNBOZiDY.js → properties-data.inspector-Bu4Um-vv.js} +1 -1
  203. package/dist/assets/{properties-material.inspector-kPZWt_rK.js → properties-material.inspector-CakxEoQj.js} +1 -1
  204. package/dist/assets/{properties-modifiers.inspector-DKRESmSW.js → properties-modifiers.inspector-ClQMHVFK.js} +1 -1
  205. package/dist/assets/{properties-object.inspector-ax0-g3BA.js → properties-object.inspector-C1Ab-w33.js} +1 -1
  206. package/dist/assets/{properties-output.inspector-DOEOcZsy.js → properties-output.inspector-Dcu8lb8C.js} +1 -1
  207. package/dist/assets/{properties-particles.inspector-CQI00oYh.js → properties-particles.inspector-Dfs-ZBpE.js} +1 -1
  208. package/dist/assets/{properties-physics.inspector-DA6-7mMn.js → properties-physics.inspector-Ce4mMWzM.js} +1 -1
  209. package/dist/assets/{properties-render.inspector-Bv3snYNC.js → properties-render.inspector-DWri-DTC.js} +1 -1
  210. package/dist/assets/{properties-scene.inspector-B1ksacVC.js → properties-scene.inspector-BSNjU00G.js} +1 -1
  211. package/dist/assets/{properties-texture.inspector-BLxK7oXf.js → properties-texture.inspector-DnH7CwRl.js} +1 -1
  212. package/dist/assets/{properties-view-layer.inspector-DY9u7Fpy.js → properties-view-layer.inspector-B19cZc6X.js} +1 -1
  213. package/dist/assets/{properties-world.inspector-tmQPQ_g6.js → properties-world.inspector-BSt8WRSj.js} +1 -1
  214. package/dist/assets/{r3f-design-session-BV6GpTxq.js → r3f-design-session-DqKrI14b.js} +2 -2
  215. package/dist/assets/{r3f-physics-binding-iNCeJZwd.js → r3f-physics-binding-CoSwbmVM.js} +1 -1
  216. package/dist/assets/{r3f-source-authoring-adapter-Bzera0C7.js → r3f-source-authoring-adapter-BG3vhahx.js} +1 -1
  217. package/dist/assets/{react-canvas-navigation-UK_BMgIh.js → react-canvas-navigation-DoPpWrKL.js} +1 -1
  218. package/dist/assets/{react-inspector.service-4wPq1GWF.js → react-inspector.service-CrqYw3Jb.js} +1 -1
  219. package/dist/assets/{react-story-board-C4NAg1lF.js → react-story-board-DOAfFP3M.js} +1 -1
  220. package/dist/assets/{react-three-rapier.esm-fDJrAP5J.js → react-three-rapier.esm-BAEEeUsU.js} +1 -1
  221. package/dist/assets/{react-world-authoring-adapter-DPCvrFSd.js → react-world-authoring-adapter-DArpj4xo.js} +1 -1
  222. package/dist/assets/{realm-services-Ca4lSqMJ.js → realm-services-qj234a0C.js} +1 -1
  223. package/dist/assets/{reflection-probe-capture.inspector-7miikRuQ.js → reflection-probe-capture.inspector-DQTWUver.js} +1 -1
  224. package/dist/assets/{registry-FkWo9b5Y.js → registry-CHxUhnK7.js} +1 -1
  225. package/dist/assets/{relative-import-specifier-IIDPACUn.js → relative-import-specifier-CCwfBo2s.js} +1 -1
  226. package/dist/assets/{render-env-D0PPvYFc.js → render-env-B5TZmt31.js} +1 -1
  227. package/dist/assets/{render-features-ep0qUnew.js → render-features-B8bt5hFs.js} +1 -1
  228. package/dist/assets/{render-settings-BTkn8WQP.js → render-settings-D7S62Nwc.js} +1 -1
  229. package/dist/assets/{resolve-three-CuV3phZY.js → resolve-three-CXRmbpha.js} +3 -3
  230. package/dist/assets/{root-seam-contract-Bnxtdl5s.js → root-seam-contract-Rc5I2-cn.js} +1 -1
  231. package/dist/assets/{run-selection-deRqeYOX.js → run-selection-v_KGXaMz.js} +1 -1
  232. package/dist/assets/{scene-capture-aB8WVI9e.js → scene-capture-D4xR-bOK.js} +1 -1
  233. package/dist/assets/{scene-document.service-C1ZS_ibm.js → scene-document.service-B4alF5qm.js} +2 -2
  234. package/dist/assets/{scene-framing-BAZ4vw1j.js → scene-framing-DFvmwkrW.js} +1 -1
  235. package/dist/assets/{seeded-random-CwE1f6qb.js → seeded-random-z3KAs46E.js} +1 -1
  236. package/dist/assets/{session-kSIjcXJT.js → session-kTroQqmY.js} +19 -0
  237. package/dist/assets/{setup-renderer-DPkC1cFW.js → setup-renderer-BZFzQu0R.js} +1 -1
  238. package/dist/assets/{source-object3d-authoring-adapter-a_OLVl70.js → source-object3d-authoring-adapter-CzJdhhwn.js} +1 -1
  239. package/dist/assets/{source-persistence-backend-C5Gwhj0u.js → source-persistence-backend-CNNtYr-8.js} +1 -1
  240. package/dist/assets/{stage-keyboard-Dx7_k-Wa.js → stage-keyboard-7_1scYGH.js} +1 -1
  241. package/dist/assets/{stage-overlay-set-CvBJVuHr.js → stage-overlay-set-BdCP3eMw.js} +1 -1
  242. package/dist/assets/{stage-presence-markers-DOcpLmDw.js → stage-presence-markers-DT5j8fjP.js} +1 -1
  243. package/dist/assets/{stage-transform-tools-Cl_ltUkU.js → stage-transform-tools-i3ajje5q.js} +1 -1
  244. package/dist/assets/{standard-viewport-dressing-Dk79QHkl.js → standard-viewport-dressing-BfmTiIR4.js} +1 -1
  245. package/dist/assets/{state-watch.action-DnUgK57Q.js → state-watch.action-B2f1FDbM.js} +1 -1
  246. package/dist/assets/{state-watch.menu-D6yJ2ajq.js → state-watch.menu-BlXPZu9x.js} +1 -1
  247. package/dist/assets/{state-watch.utility-Bd1_ckSi.js → state-watch.utility-v0OIiOK5.js} +1 -1
  248. package/dist/assets/{story-capture-CdblyPkl.js → story-capture-DAZ6UX6l.js} +1 -1
  249. package/dist/assets/{story-documents-Cl5_DGOO.js → story-documents-skwdip6D.js} +1 -1
  250. package/dist/assets/{story-documents.service-5S-t2VA6.js → story-documents.service-14jxNb7v.js} +1 -1
  251. package/dist/assets/{story-documents.service-BG3kxdaA.js → story-documents.service-DsiGg2Wu.js} +1 -1
  252. package/dist/assets/{story-media-presence-C0ANS1oT.js → story-media-presence-Cjm_WU4H.js} +1 -1
  253. package/dist/assets/{story-pixi-preview-CMwV6H-J.js → story-pixi-preview-BfrC6Uip.js} +1 -1
  254. package/dist/assets/{story-presentation-C0eOpS5C.js → story-presentation-D2yF9kbW.js} +1 -1
  255. package/dist/assets/{story-three-preview-DI_zKDDq.js → story-three-preview-E2uJuH0p.js} +2 -2
  256. package/dist/assets/{studio-environment-tkipngTI.js → studio-environment-Kj8vdH82.js} +1 -1
  257. package/dist/assets/{surface-state-D2pDEwDu.js → surface-state-P-IhoubG.js} +1 -1
  258. package/dist/assets/{syntactic-prop-specs-FgPDDm9j.js → syntactic-prop-specs-DWKYi4Ib.js} +1 -1
  259. package/dist/assets/{team-playtest.service-LdRKOcl_.js → team-playtest.service-Da2I3-HT.js} +1 -1
  260. package/dist/assets/{three-DHXw9ma-.js → three-43Ky3-7O.js} +1 -1
  261. package/dist/assets/{three-authoring-adapter-O2lbHGpC.js → three-authoring-adapter-ChAme627.js} +1 -1
  262. package/dist/assets/three-authoring.service-CkS5Twej.js +2 -0
  263. package/dist/assets/{three-ingest-runtime-ByNriHPr.js → three-ingest-runtime-CsWe59E_.js} +1 -1
  264. package/dist/assets/{three-integration-DKfjgbTQ.js → three-integration-BG2YybqE.js} +2 -2
  265. package/dist/assets/three-integration.service-BxtSDKHH.js +1 -0
  266. package/dist/assets/{three-projection-core-BdssKHsg.js → three-projection-core-BKmXcOPL.js} +1 -1
  267. package/dist/assets/{three-state-DMGhb3kR.js → three-state-DnYP1ZtA.js} +1 -1
  268. package/dist/assets/{three-story-capture.service-0Ol3grw1.js → three-story-capture.service-DBEJS-XE.js} +2 -2
  269. package/dist/assets/{three-story-model-2DccXqHD.js → three-story-model-mOvJH3cm.js} +1 -1
  270. package/dist/assets/{three-viewport-presentation-CAUvCLK_.js → three-viewport-presentation-BHtVY2rJ.js} +1 -1
  271. package/dist/assets/{transform-mode-request-C__lyOsr.js → transform-mode-request-BuKv4Vre.js} +1 -1
  272. package/dist/assets/{transport-strip-CAIpxT3_.js → transport-strip-BmlKGYbk.js} +1 -1
  273. package/dist/assets/transport.header-B9Zj0jSD.js +1 -0
  274. package/dist/assets/{tuples-DkfP4uzY.js → tuples-BpJkRF4Y.js} +1 -1
  275. package/dist/assets/{ui-board-document-UJvS4sh4.js → ui-board-document-BVE1yfZS.js} +2 -2
  276. package/dist/assets/{user-data-CCbOet5N.js → user-data-FwfU1u6l.js} +1 -1
  277. package/dist/assets/{utility-view-state-BgaKdtXK.js → utility-view-state-C4KOJ6su.js} +1 -1
  278. package/dist/assets/{viewport-door-BAsTiZlJ.js → viewport-door-CQdsFqWV.js} +1 -1
  279. package/dist/assets/{viewport-root-presentation-Ck-Whc0J.js → viewport-root-presentation-CnkX7rnP.js} +1 -1
  280. package/dist/assets/{viewport-surface-status-BFEHA5hI.js → viewport-surface-status-_DF-oTje.js} +1 -1
  281. package/dist/assets/{webworkerAll-8G6Qnb-k.js → webworkerAll-CVRDBA6B.js} +1 -1
  282. package/dist/assets/{worker-BRY0I3XJ.js → worker-DLnISz0i.js} +1 -1
  283. package/dist/assets/{workspace-arrangement-BvdkrAj4.js → workspace-arrangement-B2HQOv9w.js} +1 -1
  284. package/dist/assets/{world-documents-Eb1WwqL0.js → world-documents-Bk_76qpi.js} +1 -1
  285. package/dist/assets/{world-root-stage-binding-BpN6rSfy.js → world-root-stage-binding-BBvT6Ll0.js} +1 -1
  286. package/dist/assets/{xstate-animation-binding-DChnwHzU.js → xstate-animation-binding-BU0uAeKC.js} +1 -1
  287. package/dist/assets/{xstate-animation-meta-CCAibHR5.js → xstate-animation-meta-DybNY6kD.js} +1 -1
  288. package/dist-node/cli.js +16 -16
  289. package/package.json +16 -16
  290. package/dist/assets/InspectorObjectPreview-DiEEGsLN.js +0 -1
  291. package/dist/assets/Object3DDocumentViewport-BADKGKhs.js +0 -2
  292. package/dist/assets/StageHost-BoFys0SE.js +0 -2
  293. package/dist/assets/autoplay.service-Da27q2rr.js +0 -1
  294. package/dist/assets/blender-runtime.document-CgNjacD9.js +0 -12
  295. package/dist/assets/instances.command-Bd6DWVvV.js +0 -1
  296. package/dist/assets/network-observer.service-UzN4E98-.js +0 -1
  297. package/dist/assets/three-authoring.service-C0w1UwZr.js +0 -2
  298. package/dist/assets/three-integration.service-B9y90uQa.js +0 -1
  299. package/dist/assets/transport.header-DakqnjMc.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/blender-node-editor.document-YYmUWtFG.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/blender-runtime-host-Bn0epPY3.js","assets/preview-renderer-BrYNFV1p.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/renderer-ownership-BovSEcLv.js","assets/output-pass-HurwNl0G.js","assets/Pass-D1MRT672.js","assets/clip-planes-CnAI6DZn.js","assets/content-bounds-CI1FWjZr.js","assets/hierarchy-marks-jS62BeX5.js","assets/workspace-arrangement-BvdkrAj4.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/blender-timeline.document-CAGoSZu5.js","assets/blender-runtime-skin-Cn0ASAMa.js","assets/LineSegments2-DN9pUfWA.js","assets/blender-uv-editor.document-DYPUZcpl.js","assets/blender-runtime.document-CgNjacD9.js","assets/three-contract-Dkt6PmWY.js","assets/viewport-door-BAsTiZlJ.js","assets/object3d-document-session-registry-PR4Yulm3.js","assets/blender-screenshot.menu-G1T9yHAS.js","assets/blender-version.status-DsVsMeQK.js","assets/blender.command-CcERMUCW.js","assets/blender.status-BMETIbb2.js","assets/model.layout-BpZE1W9V.js","assets/regions-DWeEBnE2.js","assets/models.finder-MCvsYYwL.js","assets/properties-bone-constraints.inspector-DBRuBJ33.js","assets/blender-properties-tab-D80eJbBQ.js","assets/properties-constraints.inspector-DPokGobY.js","assets/properties-bone.inspector-CfK2l-bJ.js","assets/properties-collection.inspector-LFWBWYfs.js","assets/properties-data.inspector-CNBOZiDY.js","assets/properties-material.inspector-kPZWt_rK.js","assets/properties-modifiers.inspector-DKRESmSW.js","assets/properties-object.inspector-ax0-g3BA.js","assets/properties-output.inspector-DOEOcZsy.js","assets/properties-particles.inspector-CQI00oYh.js","assets/properties-physics.inspector-DA6-7mMn.js","assets/properties-render.inspector-Bv3snYNC.js","assets/properties-scene.inspector-B1ksacVC.js","assets/properties-texture.inspector-BLxK7oXf.js","assets/properties-view-layer.inspector-DY9u7Fpy.js","assets/properties-world.inspector-tmQPQ_g6.js","assets/sculpt.layout-D-K5cLw6.js","assets/shading.layout-CZZHKBer.js","assets/uv-editing.layout-A8RA-cbM.js","assets/asset-budget-asset.menu-DeXFc_i4.js","assets/AssetBudgetPanel-D0x2TPPy.js","assets/asset-loaders-CbVPGx4H.js","assets/SkeletonUtils-YH9iLOY_.js","assets/asset-parse-error-BHMwBRU3.js","assets/user-data-CODoGZqA.js","assets/object-marks-BnvSuCTt.js","assets/loader-BTUKnX5Q.js","assets/KTX2Loader-CaqVE6nY.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/asset-budget.action-ahMeLSui.js","assets/asset-budget.document-KWIkUTsV.js","assets/asset-budget.menu-Cqqi1SeP.js","assets/audio-unlock.service-GcroL0E_.js","assets/pose-guard-CLabLSzf.js","assets/game-audio-BeCyd0Ha.js","assets/network-observer.service-UzN4E98-.js","assets/game-network-rU8CiVS9.js","assets/index-OZVqp6xS.js","assets/index-Da9JhEvW.js","assets/native-debug-module-DmU0unhp.js","assets/native-entry-surface-BE8LJNdu.js","assets/debug-registry-C9Ke9_60.js","assets/contract-system-adapters-jyRyHuQ8.js","assets/game-contract-seams-CQ6ox7EM.js","assets/seeded-random-CwE1f6qb.js","assets/rapier-physics-adapter-CaZqWLu0.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/live-project-verbs-SDUR-zvs.js","assets/capability-coverage-B6O--La7.js","assets/edit-mode-authoring-D81aayTm.js","assets/json-history-resource-9PueHFpl.js","assets/binding-resolver-DJANjeUb.js","assets/adapter-surface-Y37Nzcyw.js","assets/structural-signature-Dc7skRiy.js","assets/webgl-frame-capture-DdJkM2mi.js","assets/realm-services-Ca4lSqMJ.js","assets/canvas-entry-runtime-DjWxb-E0.js","assets/three-ingest-runtime-ByNriHPr.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/editor-presentation-activity-CqJH4G9t.js","assets/active-ingest-pGqBlJ3x.js","assets/ingest-source-persistence-BThzUuxZ.js","assets/pixi-story-model-DNkfnWUV.js","assets/surface-content-Dg9Kkazf.js","assets/viewport-root-presentation-Ck-Whc0J.js","assets/mounted-authoring-0w9-bjZS.js","assets/entity-object-DkwEzWRw.js","assets/user-data-CCbOet5N.js","assets/three-DHXw9ma-.js","assets/editor-layers-CBGpXUff.js","assets/component-instance-root-DdBt03jn.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/three-authoring-adapter-O2lbHGpC.js","assets/source-persistence-backend-C5Gwhj0u.js","assets/three-projection-core-BdssKHsg.js","assets/body-marks-C1LxJtQb.js","assets/structural-ids-BOo2BRoY.js","assets/object3d-authoring-subject-XccsO0xG.js","assets/r3f-physics-binding-iNCeJZwd.js","assets/deferred-ingest-play-PPRnQWUC.js","assets/rrweb-Cd2ifIRP.js","assets/react-world-authoring-adapter-DPCvrFSd.js","assets/board-guides-00sD4eH-.js","assets/relative-import-specifier-IIDPACUn.js","assets/story-arg-descriptors-Ek86ExX7.js","assets/inspect-Dq9Josls.js","assets/inference-diagnostics-A5B9gTUw.js","assets/writer-tw6EcuVO.js","assets/three-state-DMGhb3kR.js","assets/editor-shell-store-qkVBJ5hp.js","assets/game-surface-defaults-D8S4cRxi.js","assets/audio.utility-C4N50YHj.js","assets/audio-meter-Cddyq1vI.js","assets/autoplay.service-Da27q2rr.js","assets/bridge.command-CMoJfehR.js","assets/gameplay-replay-DN_8e-mL.js","assets/output-DK8waum9.js","assets/command-results-CUQD49AB.js","assets/debug-bridge-BPhia8r7.js","assets/build-profiles.document-Dplz6cEh.js","assets/build-session-B1kjCtLl.js","assets/configurations-CGDwLMu_.js","assets/build-player.document-DsUvuNEg.js","assets/build-progress.status-DcyAYfmg.js","assets/build.action-DkF5EN9B.js","assets/build.command-BPqTTSKN.js","assets/build.header-f8Tr7zEY.js","assets/build.menu-DLaEv9N7.js","assets/build.service-Dy6AryUr.js","assets/connection.status-BFzCWtq1.js","assets/coverage.service-D4yN5TY8.js","assets/edit-mode-audio.service-BKoUB-tG.js","assets/edit-mode-networking.service-DFB5C5ba.js","assets/game-document.service-BMfUUdBk.js","assets/frame-debugger-store-BBnS81lf.js","assets/utility-view-state-BgaKdtXK.js","assets/PlayBar-Bv5GHcPD.js","assets/run-selection-deRqeYOX.js","assets/presentation-2yyoHrBo.js","assets/surface-state-D2pDEwDu.js","assets/game-eval.command-DjPaPh0W.js","assets/game-module-access-Dqt4Iyj9.js","assets/gameplay.command-feHlbPUd.js","assets/generation.service-CCk8hp9U.js","assets/model-thumbnail-h7btiG_9.js","assets/studio-environment-tkipngTI.js","assets/generation-jobs-ktwK3BpH.js","assets/generation-CdOATubd.css","assets/generations.status-DNuE1Jbz.js","assets/ingest.service-BWOTrTci.js","assets/registry-FkWo9b5Y.js","assets/mount-ingest-root-CZsGJYhm.js","assets/instances.command-Bd6DWVvV.js","assets/navmesh.menu-D1QrM_-o.js","assets/navmesh-workflow-store-Cmnm57TB.js","assets/navmesh.service-CLOjMejZ.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/network.utility-zwrDmtd_.js","assets/play.command-BR_Yo82K.js","assets/profiler.action-CvDYE5cW.js","assets/profiler.menu-B66yUdVF.js","assets/profiler.utility-5fF94exR.js","assets/scene-document.service-C1ZS_ibm.js","assets/Object3DDocumentViewport-BADKGKhs.js","assets/viewport-surface-status-BFEHA5hI.js","assets/after-paint-CB4bz1-e.js","assets/state-watch.action-DnUgK57Q.js","assets/state-watch.menu-D6yJ2ajq.js","assets/state-watch.utility-Bd1_ckSi.js","assets/team-playtest.service-LdRKOcl_.js","assets/collaboration-presence-cP5Ts934.js","assets/transport.header-DakqnjMc.js","assets/component-board.service-DhZt21fj.js","assets/component-board-registry-DrIa2csL.js","assets/story-media-presence-C0ANS1oT.js","assets/design-time-mount.service-Dvf8zkqu.js","assets/design-time-mount-registry-DUpXCg1U.js","assets/component-board.service-DDeBE2OE.js","assets/design-time-mount.service-BTAbxIOm.js","assets/react-inspector.service-4wPq1GWF.js","assets/ShadowEditor-PJ_mLUFF.js","assets/eyedropper-session-bjPXnfeX.js","assets/dom-authoring-adapter-CuDSWSNb.js","assets/story-documents.service-BG3kxdaA.js","assets/story-documents-Cl5_DGOO.js","assets/StoryPreviewMount-BgEpExfI.js","assets/camera-runtime.inspector-DZZS6sNs.js","assets/component-board.service-D0VCR7cX.js","assets/component-verbs.command-DLa5nz3l.js","assets/instance-fork-actions-D3sRzS3K.js","assets/fork-menu-zClJ54w5.js","assets/component-verbs.service-B84g803c.js","assets/constraints.inspector-CXekv0Vm.js","assets/constraint-Bp1l8hY-.js","assets/model-asset-sections.service-930QHt1S.js","assets/model-inspection-DPzXOOlc.js","assets/source-object3d-authoring-adapter-a_OLVl70.js","assets/project-provenance-BGnJXJwa.js","assets/model-asset-sections-D1uxOu2v.css","assets/reflection-probe-capture.inspector-7miikRuQ.js","assets/reflection-probe-sIto9mh0.js","assets/story-documents.service-5S-t2VA6.js","assets/standard-viewport-dressing-Dk79QHkl.js","assets/mounted-story-viewport-source-dan_Vkgv.js","assets/story-three-preview-DI_zKDDq.js","assets/asset-preview-CzxD7k3P.js","assets/bitmap-label-Ct4k6ehY.js","assets/crash-null-boundary-v3a0uEgw.js","assets/story-mount-turn-DFRTj5hi.js","assets/three-story-model-2DccXqHD.js","assets/r3f-source-authoring-adapter-Bzera0C7.js","assets/live-gesture-lock-DJbrjOqf.js","assets/oid-transform-C2fzvPah.js","assets/three-authoring.service-C0w1UwZr.js","assets/three-story-capture.service-0Ol3grw1.js","assets/canvas-story-capture.service-BAkinpiS.js","assets/component-contracts.service-Dc6K48l4.js","assets/three-integration.service-B9y90uQa.js","assets/three-integration-DKfjgbTQ.js","assets/layered-pick-0Okyt-XO.js","assets/root-stacking-BEd9ZvxC.js","assets/animation-mixers.service-DeVSjWCQ.js","assets/live-mixers-B-bwLZ7c.js","assets/animation-timeline.utility-BDxeS3S6.js","assets/transport-strip-CAIpxT3_.js","assets/machines.finder-BvxeCFhA.js","assets/machine.document-B5CwoKNt.js","assets/GameplaySessionTimeline-Dm7lYtRi.js","assets/react-18-By2b4xR9.js","assets/AudioViewer-7fv2_fIl.js","assets/ImageViewer-CxnMTLaT.js","assets/VideoViewer-DUUQ1ea_.js","assets/JsonAssetDocument-CcbpdU55.js","assets/OnlineAssetDetail-Dq7qIQlJ.js","assets/asset-editor-persistence-DXkf1Ont.js","assets/SourceAssetViewer-DgOFkYF8.js","assets/InspectorCanvasPreview-BrFjhoiD.js","assets/hosted-asset-materialization-s3VISszg.js","assets/NonThreeAuthoringBootstrap-CDUdubAw.js","assets/project-authoring-session-DvpmSYet.js","assets/story-capture-CdblyPkl.js","assets/react-story-board-C4NAg1lF.js","assets/story-presentation-C0eOpS5C.js"])))=>i.map(i=>d[i]);
2
- import{r as Ye,a as _C}from"./index-nmcBqr7Y.js";import{a as q}from"./jsx-runtime-DPjLkJKQ.js";import{r as r2}from"./index-CtzuWnCS.js";import{F as n0r}from"./index-FUuS4qwW.js";import{a as rLe}from"./client-DNXj_opT.js";import{g as nLe,a as i0r,c as Emt}from"./_commonjsHelpers-D6-XlEtG.js";function o0r(t,n){for(var s=0;s<n.length;s++){const c=n[s];if(typeof c!="string"&&!Array.isArray(c)){for(const d in c)if(d!=="default"&&!(d in t)){const m=Object.getOwnPropertyDescriptor(c,d);m&&Object.defineProperty(t,d,m.get?m:{enumerable:!0,get:()=>c[d]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const s0r="modulepreload",a0r=function(t){return"/"+t},kmt={},lo=function(n,s,c){let d=Promise.resolve();if(s&&s.length>0){let g=function(A){return Promise.all(A.map(F=>Promise.resolve(F).then(D=>({status:"fulfilled",value:D}),D=>({status:"rejected",reason:D}))))};document.getElementsByTagName("link");const S=document.querySelector("meta[property=csp-nonce]"),k=S?.nonce||S?.getAttribute("nonce");d=g(s.map(A=>{if(A=a0r(A),A in kmt)return;kmt[A]=!0;const F=A.endsWith(".css"),D=F?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${A}"]${D}`))return;const J=document.createElement("link");if(J.rel=F?"stylesheet":s0r,F||(J.as="script"),J.crossOrigin="",J.href=A,k&&J.setAttribute("nonce",k),document.head.appendChild(J),F)return new Promise(($,G)=>{J.addEventListener("load",$),J.addEventListener("error",()=>G(new Error(`Unable to preload CSS for ${A}`)))})}))}function m(g){const S=new Event("vite:preloadError",{cancelable:!0});if(S.payload=g,window.dispatchEvent(S),!S.defaultPrevented)throw g}return d.then(g=>{for(const S of g||[])S.status==="rejected"&&m(S.reason);return n().catch(m)})},c0r=[{entryPath:"@volter/editor-blender/contributions/blender-node-editor.document.tsx",load:()=>lo(()=>import("./blender-node-editor.document-YYmUWtFG.js"),__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,23]))},{entryPath:"@volter/editor-blender/contributions/blender-timeline.document.tsx",load:()=>lo(()=>import("./blender-timeline.document-CAGoSZu5.js"),__vite__mapDeps([24,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-uv-editor.document.tsx",load:()=>lo(()=>import("./blender-uv-editor.document-DYPUZcpl.js"),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-runtime.document.tsx",load:()=>lo(()=>import("./blender-runtime.document-CgNjacD9.js"),__vite__mapDeps([28,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,29,30,31,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-screenshot.menu.ts",load:()=>lo(()=>import("./blender-screenshot.menu-G1T9yHAS.js"),__vite__mapDeps([32,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-version.status.tsx",load:()=>lo(()=>import("./blender-version.status-DsVsMeQK.js"),__vite__mapDeps([33,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.command.ts",load:()=>lo(()=>import("./blender.command-CcERMUCW.js"),__vite__mapDeps([34,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.environment.ts",load:()=>lo(()=>import("./blender.environment-CG-pC7sk.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.keymap.ts",load:()=>lo(()=>import("./blender.keymap-BmOBRY7p.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.status.tsx",load:()=>lo(()=>import("./blender.status-BMETIbb2.js"),__vite__mapDeps([35,1,2]))},{entryPath:"@volter/editor-blender/contributions/blender.style.ts",load:()=>lo(()=>import("./blender.style-DaIh9SiA.js"),[])},{entryPath:"@volter/editor-blender/contributions/model.layout.ts",load:()=>lo(()=>import("./model.layout-BpZE1W9V.js"),__vite__mapDeps([36,37]))},{entryPath:"@volter/editor-blender/contributions/models.finder.ts",load:()=>lo(()=>import("./models.finder-MCvsYYwL.js"),__vite__mapDeps([38,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone-constraints.inspector.tsx",load:()=>lo(()=>import("./properties-bone-constraints.inspector-DBRuBJ33.js"),__vite__mapDeps([39,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,41,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone.inspector.tsx",load:()=>lo(()=>import("./properties-bone.inspector-CfK2l-bJ.js"),__vite__mapDeps([42,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-collection.inspector.tsx",load:()=>lo(()=>import("./properties-collection.inspector-LFWBWYfs.js"),__vite__mapDeps([43,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-constraints.inspector.tsx",load:()=>lo(()=>import("./properties-constraints.inspector-DPokGobY.js"),__vite__mapDeps([41,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-data.inspector.tsx",load:()=>lo(()=>import("./properties-data.inspector-CNBOZiDY.js"),__vite__mapDeps([44,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-material.inspector.tsx",load:()=>lo(()=>import("./properties-material.inspector-kPZWt_rK.js"),__vite__mapDeps([45,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-modifiers.inspector.tsx",load:()=>lo(()=>import("./properties-modifiers.inspector-DKRESmSW.js"),__vite__mapDeps([46,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-object.inspector.tsx",load:()=>lo(()=>import("./properties-object.inspector-ax0-g3BA.js"),__vite__mapDeps([47,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-output.inspector.tsx",load:()=>lo(()=>import("./properties-output.inspector-DOEOcZsy.js"),__vite__mapDeps([48,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-particles.inspector.tsx",load:()=>lo(()=>import("./properties-particles.inspector-CQI00oYh.js"),__vite__mapDeps([49,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-physics.inspector.tsx",load:()=>lo(()=>import("./properties-physics.inspector-DA6-7mMn.js"),__vite__mapDeps([50,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-render.inspector.tsx",load:()=>lo(()=>import("./properties-render.inspector-Bv3snYNC.js"),__vite__mapDeps([51,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-scene.inspector.tsx",load:()=>lo(()=>import("./properties-scene.inspector-B1ksacVC.js"),__vite__mapDeps([52,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-texture.inspector.tsx",load:()=>lo(()=>import("./properties-texture.inspector-BLxK7oXf.js"),__vite__mapDeps([53,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-view-layer.inspector.tsx",load:()=>lo(()=>import("./properties-view-layer.inspector-DY9u7Fpy.js"),__vite__mapDeps([54,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-world.inspector.tsx",load:()=>lo(()=>import("./properties-world.inspector-tmQPQ_g6.js"),__vite__mapDeps([55,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/sculpt.layout.ts",load:()=>lo(()=>import("./sculpt.layout-D-K5cLw6.js"),__vite__mapDeps([56,37]))},{entryPath:"@volter/editor-blender/contributions/shading.layout.ts",load:()=>lo(()=>import("./shading.layout-CZZHKBer.js"),__vite__mapDeps([57,37]))},{entryPath:"@volter/editor-blender/contributions/uv-editing.layout.ts",load:()=>lo(()=>import("./uv-editing.layout-A8RA-cbM.js"),__vite__mapDeps([58,37]))},{entryPath:"@volter/editor-blender/contributions/texture.layout.ts",load:()=>lo(()=>import("./texture.layout-DASpHVht.js"),[])}],l0r=[{entryPath:"@volter/editor-game/contributions/asset-budget-asset.menu.ts",load:()=>lo(()=>import("./asset-budget-asset.menu-DeXFc_i4.js"),__vite__mapDeps([59,60,1,2,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.action.ts",load:()=>lo(()=>import("./asset-budget.action-ahMeLSui.js"),__vite__mapDeps([70,60,1,2,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.document.tsx",load:()=>lo(()=>import("./asset-budget.document-KWIkUTsV.js"),__vite__mapDeps([71,1,2,60,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.menu.ts",load:()=>lo(()=>import("./asset-budget.menu-Cqqi1SeP.js"),__vite__mapDeps([72,60,1,2,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/audio-unlock.service.ts",load:()=>lo(()=>import("./audio-unlock.service-GcroL0E_.js"),__vite__mapDeps([73,74,8,75,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network-observer.service.ts",load:()=>lo(()=>import("./network-observer.service-UzN4E98-.js"),__vite__mapDeps([76,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/audio.utility.tsx",load:()=>lo(()=>import("./audio.utility-C4N50YHj.js"),__vite__mapDeps([138,1,2,3,4,20,21,139,22,23]))},{entryPath:"@volter/editor-game/contributions/autoplay.service.ts",load:()=>lo(()=>import("./autoplay.service-Da27q2rr.js"),__vite__mapDeps([140,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/bridge.command.ts",load:()=>lo(()=>import("./bridge.command-CMoJfehR.js"),__vite__mapDeps([141,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137,142,143,144,145]))},{entryPath:"@volter/editor-game/contributions/build-profiles.document.tsx",load:()=>lo(()=>import("./build-profiles.document-Dplz6cEh.js"),__vite__mapDeps([146,1,2,3,4,20,21,147,148,22,23]))},{entryPath:"@volter/editor-game/contributions/build-player.document.tsx",load:()=>lo(()=>import("./build-player.document-DsUvuNEg.js"),__vite__mapDeps([149,1,2,3,4,147,148,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build-progress.status.tsx",load:()=>lo(()=>import("./build-progress.status-DcyAYfmg.js"),__vite__mapDeps([150,1,2,3,4,147,148,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.action.ts",load:()=>lo(()=>import("./build.action-DkF5EN9B.js"),__vite__mapDeps([151,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.command.ts",load:()=>lo(()=>import("./build.command-BPqTTSKN.js"),__vite__mapDeps([152,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.header.tsx",load:()=>lo(()=>import("./build.header-f8Tr7zEY.js"),__vite__mapDeps([153,1,2,3,4,20,21,147,148,22,23]))},{entryPath:"@volter/editor-game/contributions/build.menu.ts",load:()=>lo(()=>import("./build.menu-DLaEv9N7.js"),__vite__mapDeps([154,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.service.ts",load:()=>lo(()=>import("./build.service-Dy6AryUr.js"),__vite__mapDeps([155,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/connection.status.tsx",load:()=>lo(()=>import("./connection.status-BFzCWtq1.js"),__vite__mapDeps([156,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/coverage.service.ts",load:()=>lo(()=>import("./coverage.service-D4yN5TY8.js"),__vite__mapDeps([157,90,84,3,2,4,1,20,21,22,23,89]))},{entryPath:"@volter/editor-game/contributions/edit-mode-audio.service.ts",load:()=>lo(()=>import("./edit-mode-audio.service-BKoUB-tG.js"),__vite__mapDeps([158,74,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/edit-mode-networking.service.ts",load:()=>lo(()=>import("./edit-mode-networking.service-DFB5C5ba.js"),__vite__mapDeps([159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/game-document.service.ts",load:()=>lo(()=>import("./game-document.service-BMfUUdBk.js"),__vite__mapDeps([160,1,2,3,4,20,21,161,139,162,163,148,164,77,78,79,80,81,82,83,84,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137,165,166]))},{entryPath:"@volter/editor-game/contributions/game-eval.command.ts",load:()=>lo(()=>import("./game-eval.command-DjPaPh0W.js"),__vite__mapDeps([167,168,3,2,4,1,20,21,22,23,144,107,84,90,108,83,77,78,79,80,81,82,85,75,86,87,7,8,88,89,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/game.layout.ts",load:()=>lo(()=>import("./game.layout-CBASrvQu.js"),[])},{entryPath:"@volter/editor-game/contributions/gameplay.command.ts",load:()=>lo(()=>import("./gameplay.command-feHlbPUd.js"),__vite__mapDeps([169,144,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/generation.service.ts",load:()=>lo(()=>import("./generation.service-CCk8hp9U.js"),__vite__mapDeps([170,1,2,3,4,171,13,172,114,19,67,7,8,68,69,9,10,11,12,20,21,173,22,23,174]))},{entryPath:"@volter/editor-game/contributions/generations.status.tsx",load:()=>lo(()=>import("./generations.status-DNuE1Jbz.js"),__vite__mapDeps([175,1,2,3,4,20,21,173,22,23]))},{entryPath:"@volter/editor-game/contributions/godot.style.ts",load:()=>lo(()=>import("./godot.style-NCC0Pm-A.js"),[])},{entryPath:"@volter/editor-game/contributions/godot.view.ts",load:()=>lo(()=>import("./godot.view-DinHwC_o.js"),[])},{entryPath:"@volter/editor-game/contributions/ingest.service.ts",load:()=>lo(()=>import("./ingest.service-BWOTrTci.js"),__vite__mapDeps([176,177,178,107,84,3,2,4,1,20,21,22,23,90,108,83,135,136,14,7,8,15,116,19,114,113,29]))},{entryPath:"@volter/editor-game/contributions/instances.command.ts",load:()=>lo(()=>import("./instances.command-Bd6DWVvV.js"),__vite__mapDeps([179,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/navmesh.menu.ts",load:()=>lo(()=>import("./navmesh.menu-D1QrM_-o.js"),__vite__mapDeps([180,181,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/navmesh.service.ts",load:()=>lo(()=>import("./navmesh.service-CLOjMejZ.js"),__vite__mapDeps([182,64,65,181,29,183,30,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network.utility.tsx",load:()=>lo(()=>import("./network.utility-zwrDmtd_.js"),__vite__mapDeps([184,1,2,77,78,79,80,81,82,83,84,3,4,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/play.command.ts",load:()=>lo(()=>import("./play.command-BR_Yo82K.js"),__vite__mapDeps([185,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137,144,164,148]))},{entryPath:"@volter/editor-game/contributions/profiler.action.ts",load:()=>lo(()=>import("./profiler.action-CvDYE5cW.js"),__vite__mapDeps([186,162,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.menu.ts",load:()=>lo(()=>import("./profiler.menu-B66yUdVF.js"),__vite__mapDeps([187,162,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.utility.tsx",load:()=>lo(()=>import("./profiler.utility-5fF94exR.js"),__vite__mapDeps([188,1,2,162,3,4,20,21,161,22,23]))},{entryPath:"@volter/editor-game/contributions/scene-document.service.ts",load:()=>lo(()=>import("./scene-document.service-C1ZS_ibm.js"),__vite__mapDeps([189,1,2,190,3,4,191,20,21,192,135,136,14,7,8,15,116,19,22,23,114,113,29]))},{entryPath:"@volter/editor-game/contributions/state-watch.action.ts",load:()=>lo(()=>import("./state-watch.action-DnUgK57Q.js"),__vite__mapDeps([193,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.menu.ts",load:()=>lo(()=>import("./state-watch.menu-D6yJ2ajq.js"),__vite__mapDeps([194,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.utility.tsx",load:()=>lo(()=>import("./state-watch.utility-Bd1_ckSi.js"),__vite__mapDeps([195,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/team-playtest.service.ts",load:()=>lo(()=>import("./team-playtest.service-LdRKOcl_.js"),__vite__mapDeps([196,197,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/transport.header.tsx",load:()=>lo(()=>import("./transport.header-DakqnjMc.js"),__vite__mapDeps([198,1,2,3,4,163,148,164,77,78,79,80,81,82,83,84,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/unity.style.ts",load:()=>lo(()=>import("./unity.style-BUZD1vdX.js"),[])},{entryPath:"@volter/editor-game/contributions/unity.view.ts",load:()=>lo(()=>import("./unity.view--n1Xt50A.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.style.ts",load:()=>lo(()=>import("./unreal.style-Cqf-hEzT.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.view.ts",load:()=>lo(()=>import("./unreal.view-CKSsDgA8.js"),[])},{entryPath:"@volter/editor-game/contributions/canvas/component-board.service.ts",load:()=>lo(()=>import("./component-board.service-DhZt21fj.js"),__vite__mapDeps([199,200,201,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas/design-time-mount.service.ts",load:()=>lo(()=>import("./design-time-mount.service-Dvf8zkqu.js"),__vite__mapDeps([202,203,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/component-board.service.ts",load:()=>lo(()=>import("./component-board.service-DDeBE2OE.js").then(t=>t.c),__vite__mapDeps([204,200,201]))},{entryPath:"@volter/editor-game/contributions/react/design-time-mount.service.ts",load:()=>lo(()=>import("./design-time-mount.service-BTAbxIOm.js"),__vite__mapDeps([205,203,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/react-inspector.service.ts",load:()=>lo(()=>import("./react-inspector.service-4wPq1GWF.js"),__vite__mapDeps([206,1,2,3,4,20,21,207,129,208,132,133,209,92,128,130,131,134,22,23]))},{entryPath:"@volter/editor-game/contributions/react/story-documents.service.ts",load:()=>lo(()=>import("./story-documents.service-BG3kxdaA.js"),__vite__mapDeps([210,211,1,2,3,4,20,21,165,166,212,110,22,23]))},{entryPath:"@volter/editor-game/contributions/three/camera-runtime.inspector.tsx",load:()=>lo(()=>import("./camera-runtime.inspector-DZZS6sNs.js"),__vite__mapDeps([213,1,2,29,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-board.service.ts",load:()=>lo(()=>import("./component-board.service-D0VCR7cX.js"),__vite__mapDeps([214,200,201,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.command.ts",load:()=>lo(()=>import("./component-verbs.command-DLa5nz3l.js"),__vite__mapDeps([215,216,217,136,14,7,8,15,116,19,3,2,4,1,20,21,22,23,114,113,29,135]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.service.ts",load:()=>lo(()=>import("./component-verbs.service-B84g803c.js"),__vite__mapDeps([218,217,216,136,14,7,8,15,116,19,3,2,4,1,20,21,22,23,114,113,29]))},{entryPath:"@volter/editor-game/contributions/three/constraints.inspector.tsx",load:()=>lo(()=>import("./constraints.inspector-CXekv0Vm.js"),__vite__mapDeps([219,1,2,29,117,114,19,220,64,65,3,4,20,21,135,136,14,7,8,15,116,22,23,113]))},{entryPath:"@volter/editor-game/contributions/three/model-asset-sections.service.ts",load:()=>lo(()=>import("./model-asset-sections.service-930QHt1S.js"),__vite__mapDeps([221,1,2,29,222,114,19,8,223,116,3,4,20,21,22,23,115,117,113,118,121,224,124,64,65,225]))},{entryPath:"@volter/editor-game/contributions/three/reflection-probe-capture.inspector.tsx",load:()=>lo(()=>import("./reflection-probe-capture.inspector-7miikRuQ.js"),__vite__mapDeps([226,1,2,29,227,64,65,3,4,20,21,135,136,14,7,8,15,116,19,22,23,114,113]))},{entryPath:"@volter/editor-game/contributions/three/story-documents.service.ts",load:()=>lo(()=>import("./story-documents.service-5S-t2VA6.js"),__vite__mapDeps([228,1,2,190,3,4,191,20,21,166,229,17,18,19,8,116,22,23,9,7,10,11,12,114,230,231,232,13,172,67,68,69,233,234,87,88,235,131,236,211,165,212,110,237,117,238,130,121,115,113,29,118,133,216,239,134,125,124,64,65]))},{entryPath:"@volter/editor-game/contributions/three/three-authoring.service.ts",load:()=>lo(()=>import("./three-authoring.service-C0w1UwZr.js"),__vite__mapDeps([240,203,91,92,119,117,114,19,120,108,121,116,3,2,4,1,20,21,22,23,115,113,29,118,8,122,64,65,123,124,86,125,136,14,7,15]))},{entryPath:"@volter/editor-game/contributions/three-story-capture.service.ts",load:()=>lo(()=>import("./three-story-capture.service-0Ol3grw1.js"),__vite__mapDeps([241,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas-story-capture.service.ts",load:()=>lo(()=>import("./canvas-story-capture.service-BAkinpiS.js"),__vite__mapDeps([242,3,2,4,1,20,21,22,23]))}],u0r=[{entryPath:"@volter/editor-react/contributions/component-contracts.service.ts",load:()=>lo(()=>import("./component-contracts.service-Dc6K48l4.js"),__vite__mapDeps([243,239,134,125,3,2,4,1,20,21,22,23]))}],f0r=[{entryPath:"@volter/editor-threejs/contributions/three-integration.service.ts",load:()=>lo(()=>import("./three-integration.service-B9y90uQa.js"),__vite__mapDeps([244,245,183,13,7,8,6,9,10,11,12,246,247,114,19,1,2,3,4,171,172,67,68,69,31,135,136,14,15,116,20,21,22,23,113,29,18,117,30,17,232,233]))},{entryPath:"@volter/editor-threejs/contributions/animation-mixers.service.ts",load:()=>lo(()=>import("./animation-mixers.service-DeVSjWCQ.js"),__vite__mapDeps([248,249,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-threejs/contributions/animation-timeline.utility.tsx",load:()=>lo(()=>import("./animation-timeline.utility-BDxeS3S6.js"),__vite__mapDeps([250,1,2,251,3,4,20,21,22,23]))}],d0r=[{entryPath:"@volter/editor-xstate/contributions/machines.finder.ts",load:()=>lo(()=>import("./machines.finder-BvxeCFhA.js"),__vite__mapDeps([252,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-xstate/contributions/machine.document.tsx",load:()=>lo(()=>import("./machine.document-B5CwoKNt.js"),__vite__mapDeps([253,1,2,3,4,20,21,22,23]))}];let HY=null;const $Oe=new Set;function lee(){return HY}function p0r(t){if(HY!==null&&HY.id!==t.id)throw new Error(`Two products in one page: "${HY.id}" is already composed and "${t.id}" asked to be. A product is the running program; one page runs one.`);HY=t;for(const n of $Oe)n()}function DTt(t){return $Oe.add(t),()=>$Oe.delete(t)}/*!
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/blender-node-editor.document-QB62WBX4.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/blender-runtime-host-DpyeRB-e.js","assets/preview-renderer-BrYNFV1p.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/renderer-ownership-BovSEcLv.js","assets/output-pass-HurwNl0G.js","assets/Pass-D1MRT672.js","assets/clip-planes-CnAI6DZn.js","assets/content-bounds-DMLXg0Ob.js","assets/hierarchy-marks-BUeQ6to3.js","assets/workspace-arrangement-B2HQOv9w.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/blender-timeline.document-C7-UEVr2.js","assets/blender-runtime-skin-B-KaOx39.js","assets/LineSegments2-DN9pUfWA.js","assets/blender-uv-editor.document-lclK5qPX.js","assets/blender-runtime.document-CTLsZn-9.js","assets/three-contract-Dkt6PmWY.js","assets/viewport-door-CQdsFqWV.js","assets/object3d-document-session-registry-DYr6Iepm.js","assets/blender-screenshot.menu-DcgjDXya.js","assets/blender-version.status-DZv7eV2U.js","assets/blender.command-BjHEelMQ.js","assets/blender.status-BMETIbb2.js","assets/model.layout-BpZE1W9V.js","assets/regions-DWeEBnE2.js","assets/models.finder-Jhy7YA-r.js","assets/properties-bone-constraints.inspector-C1nbUxby.js","assets/blender-properties-tab-BD_ERulO.js","assets/properties-constraints.inspector-CTi1QOaJ.js","assets/properties-bone.inspector-B4CVy1PL.js","assets/properties-collection.inspector-BAb5XRrg.js","assets/properties-data.inspector-Bu4Um-vv.js","assets/properties-material.inspector-CakxEoQj.js","assets/properties-modifiers.inspector-ClQMHVFK.js","assets/properties-object.inspector-C1Ab-w33.js","assets/properties-output.inspector-Dcu8lb8C.js","assets/properties-particles.inspector-Dfs-ZBpE.js","assets/properties-physics.inspector-Ce4mMWzM.js","assets/properties-render.inspector-DWri-DTC.js","assets/properties-scene.inspector-BSNjU00G.js","assets/properties-texture.inspector-DnH7CwRl.js","assets/properties-view-layer.inspector-B19cZc6X.js","assets/properties-world.inspector-BSt8WRSj.js","assets/sculpt.layout-D-K5cLw6.js","assets/shading.layout-CZZHKBer.js","assets/uv-editing.layout-A8RA-cbM.js","assets/asset-budget-asset.menu-B8IP-Hc9.js","assets/AssetBudgetPanel-DzURBeos.js","assets/asset-loaders-C3GABpnY.js","assets/SkeletonUtils-YH9iLOY_.js","assets/asset-parse-error-BHMwBRU3.js","assets/user-data-CODoGZqA.js","assets/object-marks-BnvSuCTt.js","assets/loader-BTUKnX5Q.js","assets/KTX2Loader-CaqVE6nY.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/asset-budget.action-C4kmlL33.js","assets/asset-budget.document-C9UTBsOF.js","assets/asset-budget.menu-B-iPbxew.js","assets/audio-unlock.service-BptKOQO1.js","assets/pose-guard-CLabLSzf.js","assets/game-audio-BeCyd0Ha.js","assets/network-observer.service-BGd1BMED.js","assets/game-network-BadWSUYT.js","assets/index-OZVqp6xS.js","assets/index-Da9JhEvW.js","assets/native-debug-module-DEIj-ml1.js","assets/native-entry-surface-BE8LJNdu.js","assets/debug-registry-SleqbaS2.js","assets/contract-system-adapters-CsMtQANL.js","assets/game-contract-seams-CtyMWXL3.js","assets/seeded-random-z3KAs46E.js","assets/rapier-physics-adapter-CaZqWLu0.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/live-project-verbs-CJ_zDSoA.js","assets/capability-coverage-LbU4Sxnt.js","assets/edit-mode-authoring-yRPEq3c6.js","assets/json-history-resource-DFBTBtzt.js","assets/binding-resolver-BU_WvMpR.js","assets/adapter-surface-Y37Nzcyw.js","assets/structural-signature-Dc7skRiy.js","assets/webgl-frame-capture-DdJkM2mi.js","assets/realm-services-qj234a0C.js","assets/canvas-entry-runtime-0dJpA53a.js","assets/three-ingest-runtime-CsWe59E_.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/editor-presentation-activity-CqJH4G9t.js","assets/active-ingest-LYjpgY9a.js","assets/ingest-source-persistence-Bfhu6YfK.js","assets/pixi-story-model-DNkfnWUV.js","assets/surface-content-Dg9Kkazf.js","assets/viewport-root-presentation-CnkX7rnP.js","assets/mounted-authoring-zPVxiKxa.js","assets/entity-object-CI5Ws16u.js","assets/user-data-FwfU1u6l.js","assets/three-43Ky3-7O.js","assets/editor-layers-psmpPtJ8.js","assets/component-instance-root-BNr-40yw.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/three-authoring-adapter-ChAme627.js","assets/source-persistence-backend-CNNtYr-8.js","assets/three-projection-core-BKmXcOPL.js","assets/body-marks-C1LxJtQb.js","assets/structural-ids-BOo2BRoY.js","assets/object3d-authoring-subject-XccsO0xG.js","assets/r3f-physics-binding-CoSwbmVM.js","assets/deferred-ingest-play-BSFkfZKQ.js","assets/rrweb-Cd2ifIRP.js","assets/react-world-authoring-adapter-DArpj4xo.js","assets/board-guides-BA6WCb96.js","assets/relative-import-specifier-CCwfBo2s.js","assets/story-arg-descriptors-Ek86ExX7.js","assets/inspect-Ddg78nmj.js","assets/inference-diagnostics-CDR3DmKF.js","assets/writer-tw6EcuVO.js","assets/three-state-DnYP1ZtA.js","assets/editor-shell-store-CLsRck8r.js","assets/game-surface-defaults-D8S4cRxi.js","assets/audio.utility-DCWEdoWy.js","assets/audio-meter-Cddyq1vI.js","assets/autoplay.service-D_fRasDc.js","assets/bridge.command-CUhxGpj2.js","assets/gameplay-replay-CiA4AIid.js","assets/output-DK8waum9.js","assets/command-results-CUQD49AB.js","assets/debug-bridge-C2ydYYkR.js","assets/build-profiles.document-BGmStXtV.js","assets/build-session-Dfo6ygXA.js","assets/configurations-WH5EPk8d.js","assets/build-player.document-DF_n7mCc.js","assets/build-progress.status-BNYV8dLT.js","assets/build.action-DyzZR4nY.js","assets/build.command-D1dxLByR.js","assets/build.header-Dd4Vfzk5.js","assets/build.menu-haq0aE0s.js","assets/build.service-C0PLYrGi.js","assets/connection.status-hDer8RHe.js","assets/coverage.service-DkOf3jFn.js","assets/edit-mode-audio.service-BQwXzUX5.js","assets/edit-mode-networking.service-VQu-oNGR.js","assets/game-document.service-5xW7XyMV.js","assets/frame-debugger-store-C4h48Lk1.js","assets/utility-view-state-C4KOJ6su.js","assets/PlayBar-BvBQdixl.js","assets/run-selection-v_KGXaMz.js","assets/presentation-1SZXKXRj.js","assets/surface-state-P-IhoubG.js","assets/game-eval.command-BsdLCKBs.js","assets/game-module-access-DzeZ8taf.js","assets/gameplay.command-D34pNEIv.js","assets/generation.service-D-v4Kboa.js","assets/model-thumbnail-DQHRVOqE.js","assets/studio-environment-Kj8vdH82.js","assets/generation-jobs-DXPVDHPe.js","assets/generation-CdOATubd.css","assets/generations.status-CnpAZzCw.js","assets/ingest.service-BU4np-aB.js","assets/registry-CHxUhnK7.js","assets/mount-ingest-root-DeA7CLzy.js","assets/instances.command-eYwh5Dyr.js","assets/navmesh.menu-CaH6tdbH.js","assets/navmesh-workflow-store-Cmnm57TB.js","assets/navmesh.service-qPZ8sHuM.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/network.utility-DCa1vV7t.js","assets/play.command-CSYsCbbE.js","assets/profiler.action-BIvAZOpX.js","assets/profiler.menu-B-IVHBPz.js","assets/profiler.utility-CKeHA3jm.js","assets/scene-document.service-B4alF5qm.js","assets/Object3DDocumentViewport-5UbfDYx0.js","assets/viewport-surface-status-_DF-oTje.js","assets/after-paint-CB4bz1-e.js","assets/state-watch.action-B2f1FDbM.js","assets/state-watch.menu-BlXPZu9x.js","assets/state-watch.utility-v0OIiOK5.js","assets/team-playtest.service-Da2I3-HT.js","assets/collaboration-presence-B_rzt_Ua.js","assets/transport.header-B9Zj0jSD.js","assets/component-board.service-C0oYmE9t.js","assets/component-board-registry-DrIa2csL.js","assets/story-media-presence-Cjm_WU4H.js","assets/design-time-mount.service-D6XPrjMo.js","assets/design-time-mount-registry-DUpXCg1U.js","assets/component-board.service-BpDTVVAI.js","assets/design-time-mount.service-BZXwHkG9.js","assets/react-inspector.service-CrqYw3Jb.js","assets/ShadowEditor-CuWsWRr6.js","assets/eyedropper-session-bjPXnfeX.js","assets/dom-authoring-adapter-COdzQqK7.js","assets/story-documents.service-DsiGg2Wu.js","assets/story-documents-skwdip6D.js","assets/StoryPreviewMount-CfSy0VwU.js","assets/camera-runtime.inspector-DY8V2BIf.js","assets/component-board.service-DtE1d9v1.js","assets/component-verbs.command-DGDMOsdk.js","assets/instance-fork-actions-D3sRzS3K.js","assets/fork-menu-fgKUSFoA.js","assets/component-verbs.service-C1NY4Sth.js","assets/constraints.inspector-DCDUNzXi.js","assets/constraint-Bp1l8hY-.js","assets/model-asset-sections.service-Dz77qWhH.js","assets/model-inspection-BajTg63P.js","assets/source-object3d-authoring-adapter-CzJdhhwn.js","assets/project-provenance-BGnJXJwa.js","assets/model-asset-sections-D1uxOu2v.css","assets/reflection-probe-capture.inspector-DQTWUver.js","assets/reflection-probe-sIto9mh0.js","assets/story-documents.service-14jxNb7v.js","assets/standard-viewport-dressing-BfmTiIR4.js","assets/mounted-story-viewport-source-ByPTlo40.js","assets/story-three-preview-E2uJuH0p.js","assets/asset-preview-C_0EqGmT.js","assets/bitmap-label-Ct4k6ehY.js","assets/crash-null-boundary-v3a0uEgw.js","assets/story-mount-turn-DFRTj5hi.js","assets/three-story-model-mOvJH3cm.js","assets/r3f-source-authoring-adapter-BG3vhahx.js","assets/live-gesture-lock-DJbrjOqf.js","assets/oid-transform-DP9nPVMY.js","assets/three-authoring.service-CkS5Twej.js","assets/three-story-capture.service-DBEJS-XE.js","assets/canvas-story-capture.service-DkK9YEBa.js","assets/component-contracts.service-FqaewMKQ.js","assets/three-integration.service-BxtSDKHH.js","assets/three-integration-BG2YybqE.js","assets/layered-pick-C0UzN9rC.js","assets/root-stacking-BEd9ZvxC.js","assets/animation-mixers.service-DlJoI9HX.js","assets/live-mixers-B-bwLZ7c.js","assets/animation-timeline.utility-BU8dSrf_.js","assets/transport-strip-BmlKGYbk.js","assets/machines.finder-rzKrqf0P.js","assets/machine.document-DKgl-HxK.js","assets/GameplaySessionTimeline-BOP2Rzca.js","assets/react-18-By2b4xR9.js","assets/AudioViewer-Bjv_IoEK.js","assets/ImageViewer-BcGUTWQl.js","assets/VideoViewer-CipXVi35.js","assets/JsonAssetDocument-Xr6gjvcn.js","assets/OnlineAssetDetail-BPVmIMPQ.js","assets/asset-editor-persistence-BRnb4jvT.js","assets/SourceAssetViewer-MYdqpyCb.js","assets/InspectorCanvasPreview-BrFjhoiD.js","assets/hosted-asset-materialization-e4G0wAK4.js","assets/NonThreeAuthoringBootstrap-wLP33ygR.js","assets/project-authoring-session-d1SmjQh8.js","assets/story-capture-DAZ6UX6l.js","assets/react-story-board-DOAfFP3M.js","assets/story-presentation-D2yF9kbW.js"])))=>i.map(i=>d[i]);
2
+ import{r as Ye,a as _C}from"./index-nmcBqr7Y.js";import{a as q}from"./jsx-runtime-DPjLkJKQ.js";import{r as r2}from"./index-CtzuWnCS.js";import{F as n0r}from"./index-FUuS4qwW.js";import{a as rLe}from"./client-DNXj_opT.js";import{g as nLe,a as i0r,c as Emt}from"./_commonjsHelpers-D6-XlEtG.js";function o0r(t,n){for(var s=0;s<n.length;s++){const c=n[s];if(typeof c!="string"&&!Array.isArray(c)){for(const d in c)if(d!=="default"&&!(d in t)){const m=Object.getOwnPropertyDescriptor(c,d);m&&Object.defineProperty(t,d,m.get?m:{enumerable:!0,get:()=>c[d]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const s0r="modulepreload",a0r=function(t){return"/"+t},kmt={},lo=function(n,s,c){let d=Promise.resolve();if(s&&s.length>0){let g=function(A){return Promise.all(A.map(F=>Promise.resolve(F).then(D=>({status:"fulfilled",value:D}),D=>({status:"rejected",reason:D}))))};document.getElementsByTagName("link");const S=document.querySelector("meta[property=csp-nonce]"),k=S?.nonce||S?.getAttribute("nonce");d=g(s.map(A=>{if(A=a0r(A),A in kmt)return;kmt[A]=!0;const F=A.endsWith(".css"),D=F?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${A}"]${D}`))return;const J=document.createElement("link");if(J.rel=F?"stylesheet":s0r,F||(J.as="script"),J.crossOrigin="",J.href=A,k&&J.setAttribute("nonce",k),document.head.appendChild(J),F)return new Promise(($,G)=>{J.addEventListener("load",$),J.addEventListener("error",()=>G(new Error(`Unable to preload CSS for ${A}`)))})}))}function m(g){const S=new Event("vite:preloadError",{cancelable:!0});if(S.payload=g,window.dispatchEvent(S),!S.defaultPrevented)throw g}return d.then(g=>{for(const S of g||[])S.status==="rejected"&&m(S.reason);return n().catch(m)})},c0r=[{entryPath:"@volter/editor-blender/contributions/blender-node-editor.document.tsx",load:()=>lo(()=>import("./blender-node-editor.document-QB62WBX4.js"),__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,23]))},{entryPath:"@volter/editor-blender/contributions/blender-timeline.document.tsx",load:()=>lo(()=>import("./blender-timeline.document-C7-UEVr2.js"),__vite__mapDeps([24,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-uv-editor.document.tsx",load:()=>lo(()=>import("./blender-uv-editor.document-lclK5qPX.js"),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-runtime.document.tsx",load:()=>lo(()=>import("./blender-runtime.document-CTLsZn-9.js"),__vite__mapDeps([28,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,29,30,31,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-screenshot.menu.ts",load:()=>lo(()=>import("./blender-screenshot.menu-DcgjDXya.js"),__vite__mapDeps([32,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-version.status.tsx",load:()=>lo(()=>import("./blender-version.status-DZv7eV2U.js"),__vite__mapDeps([33,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.command.ts",load:()=>lo(()=>import("./blender.command-BjHEelMQ.js"),__vite__mapDeps([34,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.environment.ts",load:()=>lo(()=>import("./blender.environment-CG-pC7sk.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.keymap.ts",load:()=>lo(()=>import("./blender.keymap-BmOBRY7p.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.status.tsx",load:()=>lo(()=>import("./blender.status-BMETIbb2.js"),__vite__mapDeps([35,1,2]))},{entryPath:"@volter/editor-blender/contributions/blender.style.ts",load:()=>lo(()=>import("./blender.style-DaIh9SiA.js"),[])},{entryPath:"@volter/editor-blender/contributions/model.layout.ts",load:()=>lo(()=>import("./model.layout-BpZE1W9V.js"),__vite__mapDeps([36,37]))},{entryPath:"@volter/editor-blender/contributions/models.finder.ts",load:()=>lo(()=>import("./models.finder-Jhy7YA-r.js"),__vite__mapDeps([38,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone-constraints.inspector.tsx",load:()=>lo(()=>import("./properties-bone-constraints.inspector-C1nbUxby.js"),__vite__mapDeps([39,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,41,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone.inspector.tsx",load:()=>lo(()=>import("./properties-bone.inspector-B4CVy1PL.js"),__vite__mapDeps([42,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-collection.inspector.tsx",load:()=>lo(()=>import("./properties-collection.inspector-BAb5XRrg.js"),__vite__mapDeps([43,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-constraints.inspector.tsx",load:()=>lo(()=>import("./properties-constraints.inspector-CTi1QOaJ.js"),__vite__mapDeps([41,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-data.inspector.tsx",load:()=>lo(()=>import("./properties-data.inspector-Bu4Um-vv.js"),__vite__mapDeps([44,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-material.inspector.tsx",load:()=>lo(()=>import("./properties-material.inspector-CakxEoQj.js"),__vite__mapDeps([45,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-modifiers.inspector.tsx",load:()=>lo(()=>import("./properties-modifiers.inspector-ClQMHVFK.js"),__vite__mapDeps([46,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-object.inspector.tsx",load:()=>lo(()=>import("./properties-object.inspector-C1Ab-w33.js"),__vite__mapDeps([47,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-output.inspector.tsx",load:()=>lo(()=>import("./properties-output.inspector-Dcu8lb8C.js"),__vite__mapDeps([48,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-particles.inspector.tsx",load:()=>lo(()=>import("./properties-particles.inspector-Dfs-ZBpE.js"),__vite__mapDeps([49,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-physics.inspector.tsx",load:()=>lo(()=>import("./properties-physics.inspector-Ce4mMWzM.js"),__vite__mapDeps([50,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-render.inspector.tsx",load:()=>lo(()=>import("./properties-render.inspector-DWri-DTC.js"),__vite__mapDeps([51,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-scene.inspector.tsx",load:()=>lo(()=>import("./properties-scene.inspector-BSNjU00G.js"),__vite__mapDeps([52,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-texture.inspector.tsx",load:()=>lo(()=>import("./properties-texture.inspector-DnH7CwRl.js"),__vite__mapDeps([53,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-view-layer.inspector.tsx",load:()=>lo(()=>import("./properties-view-layer.inspector-B19cZc6X.js"),__vite__mapDeps([54,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-world.inspector.tsx",load:()=>lo(()=>import("./properties-world.inspector-BSt8WRSj.js"),__vite__mapDeps([55,40,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/sculpt.layout.ts",load:()=>lo(()=>import("./sculpt.layout-D-K5cLw6.js"),__vite__mapDeps([56,37]))},{entryPath:"@volter/editor-blender/contributions/shading.layout.ts",load:()=>lo(()=>import("./shading.layout-CZZHKBer.js"),__vite__mapDeps([57,37]))},{entryPath:"@volter/editor-blender/contributions/uv-editing.layout.ts",load:()=>lo(()=>import("./uv-editing.layout-A8RA-cbM.js"),__vite__mapDeps([58,37]))},{entryPath:"@volter/editor-blender/contributions/texture.layout.ts",load:()=>lo(()=>import("./texture.layout-DASpHVht.js"),[])}],l0r=[{entryPath:"@volter/editor-game/contributions/asset-budget-asset.menu.ts",load:()=>lo(()=>import("./asset-budget-asset.menu-B8IP-Hc9.js"),__vite__mapDeps([59,60,1,2,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.action.ts",load:()=>lo(()=>import("./asset-budget.action-C4kmlL33.js"),__vite__mapDeps([70,60,1,2,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.document.tsx",load:()=>lo(()=>import("./asset-budget.document-C9UTBsOF.js"),__vite__mapDeps([71,1,2,60,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.menu.ts",load:()=>lo(()=>import("./asset-budget.menu-B-iPbxew.js"),__vite__mapDeps([72,60,1,2,3,4,20,21,61,62,7,8,63,64,65,66,67,68,69,22,23]))},{entryPath:"@volter/editor-game/contributions/audio-unlock.service.ts",load:()=>lo(()=>import("./audio-unlock.service-BptKOQO1.js"),__vite__mapDeps([73,74,8,75,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network-observer.service.ts",load:()=>lo(()=>import("./network-observer.service-BGd1BMED.js"),__vite__mapDeps([76,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/audio.utility.tsx",load:()=>lo(()=>import("./audio.utility-DCWEdoWy.js"),__vite__mapDeps([138,1,2,3,4,20,21,139,22,23]))},{entryPath:"@volter/editor-game/contributions/autoplay.service.ts",load:()=>lo(()=>import("./autoplay.service-D_fRasDc.js"),__vite__mapDeps([140,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/bridge.command.ts",load:()=>lo(()=>import("./bridge.command-CUhxGpj2.js"),__vite__mapDeps([141,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137,142,143,144,145]))},{entryPath:"@volter/editor-game/contributions/build-profiles.document.tsx",load:()=>lo(()=>import("./build-profiles.document-BGmStXtV.js"),__vite__mapDeps([146,1,2,3,4,20,21,147,148,22,23]))},{entryPath:"@volter/editor-game/contributions/build-player.document.tsx",load:()=>lo(()=>import("./build-player.document-DF_n7mCc.js"),__vite__mapDeps([149,1,2,3,4,147,148,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build-progress.status.tsx",load:()=>lo(()=>import("./build-progress.status-BNYV8dLT.js"),__vite__mapDeps([150,1,2,3,4,147,148,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.action.ts",load:()=>lo(()=>import("./build.action-DyzZR4nY.js"),__vite__mapDeps([151,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.command.ts",load:()=>lo(()=>import("./build.command-D1dxLByR.js"),__vite__mapDeps([152,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.header.tsx",load:()=>lo(()=>import("./build.header-Dd4Vfzk5.js"),__vite__mapDeps([153,1,2,3,4,20,21,147,148,22,23]))},{entryPath:"@volter/editor-game/contributions/build.menu.ts",load:()=>lo(()=>import("./build.menu-haq0aE0s.js"),__vite__mapDeps([154,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.service.ts",load:()=>lo(()=>import("./build.service-C0PLYrGi.js"),__vite__mapDeps([155,147,148,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/connection.status.tsx",load:()=>lo(()=>import("./connection.status-hDer8RHe.js"),__vite__mapDeps([156,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/coverage.service.ts",load:()=>lo(()=>import("./coverage.service-DkOf3jFn.js"),__vite__mapDeps([157,90,84,3,2,4,1,20,21,22,23,89]))},{entryPath:"@volter/editor-game/contributions/edit-mode-audio.service.ts",load:()=>lo(()=>import("./edit-mode-audio.service-BQwXzUX5.js"),__vite__mapDeps([158,74,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/edit-mode-networking.service.ts",load:()=>lo(()=>import("./edit-mode-networking.service-VQu-oNGR.js"),__vite__mapDeps([159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/game-document.service.ts",load:()=>lo(()=>import("./game-document.service-5xW7XyMV.js"),__vite__mapDeps([160,1,2,3,4,20,21,161,139,162,163,148,164,77,78,79,80,81,82,83,84,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137,165,166]))},{entryPath:"@volter/editor-game/contributions/game-eval.command.ts",load:()=>lo(()=>import("./game-eval.command-BsdLCKBs.js"),__vite__mapDeps([167,168,3,2,4,1,20,21,22,23,144,107,84,90,108,83,77,78,79,80,81,82,85,75,86,87,7,8,88,89,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/game.layout.ts",load:()=>lo(()=>import("./game.layout-CBASrvQu.js"),[])},{entryPath:"@volter/editor-game/contributions/gameplay.command.ts",load:()=>lo(()=>import("./gameplay.command-D34pNEIv.js"),__vite__mapDeps([169,144,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/generation.service.ts",load:()=>lo(()=>import("./generation.service-D-v4Kboa.js"),__vite__mapDeps([170,1,2,3,4,171,13,172,114,19,67,7,8,68,69,9,10,11,12,20,21,173,22,23,174]))},{entryPath:"@volter/editor-game/contributions/generations.status.tsx",load:()=>lo(()=>import("./generations.status-CnpAZzCw.js"),__vite__mapDeps([175,1,2,3,4,20,21,173,22,23]))},{entryPath:"@volter/editor-game/contributions/godot.style.ts",load:()=>lo(()=>import("./godot.style-NCC0Pm-A.js"),[])},{entryPath:"@volter/editor-game/contributions/godot.view.ts",load:()=>lo(()=>import("./godot.view-DinHwC_o.js"),[])},{entryPath:"@volter/editor-game/contributions/ingest.service.ts",load:()=>lo(()=>import("./ingest.service-BU4np-aB.js"),__vite__mapDeps([176,177,178,107,84,3,2,4,1,20,21,22,23,90,108,83,135,136,14,7,8,15,116,19,114,113,29]))},{entryPath:"@volter/editor-game/contributions/instances.command.ts",load:()=>lo(()=>import("./instances.command-eYwh5Dyr.js"),__vite__mapDeps([179,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/navmesh.menu.ts",load:()=>lo(()=>import("./navmesh.menu-CaH6tdbH.js"),__vite__mapDeps([180,181,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/navmesh.service.ts",load:()=>lo(()=>import("./navmesh.service-qPZ8sHuM.js"),__vite__mapDeps([182,64,65,181,29,183,30,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network.utility.tsx",load:()=>lo(()=>import("./network.utility-DCa1vV7t.js"),__vite__mapDeps([184,1,2,77,78,79,80,81,82,83,84,3,4,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/play.command.ts",load:()=>lo(()=>import("./play.command-CSYsCbbE.js"),__vite__mapDeps([185,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137,144,164,148]))},{entryPath:"@volter/editor-game/contributions/profiler.action.ts",load:()=>lo(()=>import("./profiler.action-BIvAZOpX.js"),__vite__mapDeps([186,162,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.menu.ts",load:()=>lo(()=>import("./profiler.menu-B-IVHBPz.js"),__vite__mapDeps([187,162,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.utility.tsx",load:()=>lo(()=>import("./profiler.utility-CKeHA3jm.js"),__vite__mapDeps([188,1,2,162,3,4,20,21,161,22,23]))},{entryPath:"@volter/editor-game/contributions/scene-document.service.ts",load:()=>lo(()=>import("./scene-document.service-B4alF5qm.js"),__vite__mapDeps([189,1,2,190,3,4,191,20,21,192,135,136,14,7,8,15,116,19,22,23,114,113,29]))},{entryPath:"@volter/editor-game/contributions/state-watch.action.ts",load:()=>lo(()=>import("./state-watch.action-B2f1FDbM.js"),__vite__mapDeps([193,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.menu.ts",load:()=>lo(()=>import("./state-watch.menu-BlXPZu9x.js"),__vite__mapDeps([194,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.utility.tsx",load:()=>lo(()=>import("./state-watch.utility-v0OIiOK5.js"),__vite__mapDeps([195,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/team-playtest.service.ts",load:()=>lo(()=>import("./team-playtest.service-Da2I3-HT.js"),__vite__mapDeps([196,197,77,78,79,2,80,81,82,83,84,3,4,1,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/transport.header.tsx",load:()=>lo(()=>import("./transport.header-B9Zj0jSD.js"),__vite__mapDeps([198,1,2,3,4,163,148,164,77,78,79,80,81,82,83,84,20,21,22,23,85,75,86,87,7,8,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,15,103,104,105,106,107,108,109,110,111,112,113,114,19,29,115,116,117,118,119,120,121,122,64,65,123,124,125,126,127,128,129,130,131,132,133,134,135,136,14,30,137]))},{entryPath:"@volter/editor-game/contributions/unity.style.ts",load:()=>lo(()=>import("./unity.style-BUZD1vdX.js"),[])},{entryPath:"@volter/editor-game/contributions/unity.view.ts",load:()=>lo(()=>import("./unity.view--n1Xt50A.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.style.ts",load:()=>lo(()=>import("./unreal.style-Cqf-hEzT.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.view.ts",load:()=>lo(()=>import("./unreal.view-CKSsDgA8.js"),[])},{entryPath:"@volter/editor-game/contributions/canvas/component-board.service.ts",load:()=>lo(()=>import("./component-board.service-C0oYmE9t.js"),__vite__mapDeps([199,200,201,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas/design-time-mount.service.ts",load:()=>lo(()=>import("./design-time-mount.service-D6XPrjMo.js"),__vite__mapDeps([202,203,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/component-board.service.ts",load:()=>lo(()=>import("./component-board.service-BpDTVVAI.js").then(t=>t.c),__vite__mapDeps([204,200,201]))},{entryPath:"@volter/editor-game/contributions/react/design-time-mount.service.ts",load:()=>lo(()=>import("./design-time-mount.service-BZXwHkG9.js"),__vite__mapDeps([205,203,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/react-inspector.service.ts",load:()=>lo(()=>import("./react-inspector.service-CrqYw3Jb.js"),__vite__mapDeps([206,1,2,3,4,20,21,207,129,208,132,133,209,92,128,130,131,134,22,23]))},{entryPath:"@volter/editor-game/contributions/react/story-documents.service.ts",load:()=>lo(()=>import("./story-documents.service-DsiGg2Wu.js"),__vite__mapDeps([210,211,1,2,3,4,20,21,165,166,212,110,22,23]))},{entryPath:"@volter/editor-game/contributions/three/camera-runtime.inspector.tsx",load:()=>lo(()=>import("./camera-runtime.inspector-DY8V2BIf.js"),__vite__mapDeps([213,1,2,29,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-board.service.ts",load:()=>lo(()=>import("./component-board.service-DtE1d9v1.js"),__vite__mapDeps([214,200,201,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.command.ts",load:()=>lo(()=>import("./component-verbs.command-DGDMOsdk.js"),__vite__mapDeps([215,216,217,136,14,7,8,15,116,19,3,2,4,1,20,21,22,23,114,113,29,135]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.service.ts",load:()=>lo(()=>import("./component-verbs.service-C1NY4Sth.js"),__vite__mapDeps([218,217,216,136,14,7,8,15,116,19,3,2,4,1,20,21,22,23,114,113,29]))},{entryPath:"@volter/editor-game/contributions/three/constraints.inspector.tsx",load:()=>lo(()=>import("./constraints.inspector-DCDUNzXi.js"),__vite__mapDeps([219,1,2,29,117,114,19,220,64,65,3,4,20,21,135,136,14,7,8,15,116,22,23,113]))},{entryPath:"@volter/editor-game/contributions/three/model-asset-sections.service.ts",load:()=>lo(()=>import("./model-asset-sections.service-Dz77qWhH.js"),__vite__mapDeps([221,1,2,29,222,114,19,8,223,116,3,4,20,21,22,23,115,117,113,118,121,224,124,64,65,225]))},{entryPath:"@volter/editor-game/contributions/three/reflection-probe-capture.inspector.tsx",load:()=>lo(()=>import("./reflection-probe-capture.inspector-DQTWUver.js"),__vite__mapDeps([226,1,2,29,227,64,65,3,4,20,21,135,136,14,7,8,15,116,19,22,23,114,113]))},{entryPath:"@volter/editor-game/contributions/three/story-documents.service.ts",load:()=>lo(()=>import("./story-documents.service-14jxNb7v.js"),__vite__mapDeps([228,1,2,190,3,4,191,20,21,166,229,17,18,19,8,116,22,23,9,7,10,11,12,114,230,231,232,13,172,67,68,69,233,234,87,88,235,131,236,211,165,212,110,237,117,238,130,121,115,113,29,118,133,216,239,134,125,124,64,65]))},{entryPath:"@volter/editor-game/contributions/three/three-authoring.service.ts",load:()=>lo(()=>import("./three-authoring.service-CkS5Twej.js"),__vite__mapDeps([240,203,91,92,119,117,114,19,120,108,121,116,3,2,4,1,20,21,22,23,115,113,29,118,8,122,64,65,123,124,86,125,136,14,7,15]))},{entryPath:"@volter/editor-game/contributions/three-story-capture.service.ts",load:()=>lo(()=>import("./three-story-capture.service-DBEJS-XE.js"),__vite__mapDeps([241,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas-story-capture.service.ts",load:()=>lo(()=>import("./canvas-story-capture.service-DkK9YEBa.js"),__vite__mapDeps([242,3,2,4,1,20,21,22,23]))}],u0r=[{entryPath:"@volter/editor-react/contributions/component-contracts.service.ts",load:()=>lo(()=>import("./component-contracts.service-FqaewMKQ.js"),__vite__mapDeps([243,239,134,125,3,2,4,1,20,21,22,23]))}],f0r=[{entryPath:"@volter/editor-threejs/contributions/three-integration.service.ts",load:()=>lo(()=>import("./three-integration.service-BxtSDKHH.js"),__vite__mapDeps([244,245,183,13,7,8,6,9,10,11,12,246,247,114,19,1,2,3,4,171,172,67,68,69,31,135,136,14,15,116,20,21,22,23,113,29,18,117,30,17,232,233]))},{entryPath:"@volter/editor-threejs/contributions/animation-mixers.service.ts",load:()=>lo(()=>import("./animation-mixers.service-DlJoI9HX.js"),__vite__mapDeps([248,249,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-threejs/contributions/animation-timeline.utility.tsx",load:()=>lo(()=>import("./animation-timeline.utility-BU8dSrf_.js"),__vite__mapDeps([250,1,2,251,3,4,20,21,22,23]))}],d0r=[{entryPath:"@volter/editor-xstate/contributions/machines.finder.ts",load:()=>lo(()=>import("./machines.finder-rzKrqf0P.js"),__vite__mapDeps([252,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-xstate/contributions/machine.document.tsx",load:()=>lo(()=>import("./machine.document-DKgl-HxK.js"),__vite__mapDeps([253,1,2,3,4,20,21,22,23]))}];let HY=null;const $Oe=new Set;function lee(){return HY}function p0r(t){if(HY!==null&&HY.id!==t.id)throw new Error(`Two products in one page: "${HY.id}" is already composed and "${t.id}" asked to be. A product is the running program; one page runs one.`);HY=t;for(const n of $Oe)n()}function DTt(t){return $Oe.add(t),()=>$Oe.delete(t)}/*!
3
3
  * Font Awesome Free 7.2.0 by @fontawesome - https://fontawesome.com
4
4
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
5
5
  * Copyright 2026 Fonticons, Inc.
@@ -42,7 +42,7 @@ import{r as Ye,a as _C}from"./index-nmcBqr7Y.js";import{a as q}from"./jsx-runtim
42
42
 
43
43
  `)}$.write("payload.value = newResult;"),$.write("return payload;");const Ce=$.compile();return(De,Pe)=>Ce(J,De,Pe)};let m;const g=ZB,S=!ZOe.jitless,A=S&&bCt.value,F=n.catchall;let D;t._zod.parse=(J,$)=>{D??(D=c.value);const G=J.value;return g(G)?S&&A&&$?.async===!1&&$.jitless!==!0?(m||(m=d(n.shape)),J=m(J,$),F?OEt([],G,J,$,D,t):J):s(J,$):(J.issues.push({expected:"object",code:"invalid_type",input:G,inst:t}),J)}});function Hmt(t,n,s,c){for(const m of t)if(m.issues.length===0)return n.value=m.value,n;const d=t.filter(m=>!MO(m));return d.length===1?(n.value=d[0].value,d[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:s,errors:t.map(m=>m.issues.map(g=>Nw(g,c,$S())))}),n)}const SLe=ui("$ZodUnion",(t,n)=>{vu.init(t,n),Gu(t._zod,"optin",()=>n.options.some(d=>d._zod.optin==="optional")?"optional":void 0),Gu(t._zod,"optout",()=>n.options.some(d=>d._zod.optout==="optional")?"optional":void 0),Gu(t._zod,"values",()=>{if(n.options.every(d=>d._zod.values))return new Set(n.options.flatMap(d=>Array.from(d._zod.values)))}),Gu(t._zod,"pattern",()=>{if(n.options.every(d=>d._zod.pattern)){const d=n.options.map(m=>m._zod.pattern);return new RegExp(`^(${d.map(m=>dye(m.source)).join("|")})$`)}});const s=n.options.length===1,c=n.options[0]._zod.run;t._zod.parse=(d,m)=>{if(s)return c(d,m);let g=!1;const S=[];for(const k of n.options){const A=k._zod.run({value:d.value,issues:[]},m);if(A instanceof Promise)S.push(A),g=!0;else{if(A.issues.length===0)return A;S.push(A)}}return g?Promise.all(S).then(k=>Hmt(k,d,t,m)):Hmt(S,d,t,m)}});function Gmt(t,n,s,c){const d=t.filter(m=>m.issues.length===0);return d.length===1?(n.value=d[0].value,n):(d.length===0?n.issues.push({code:"invalid_union",input:n.value,inst:s,errors:t.map(m=>m.issues.map(g=>Nw(g,c,$S())))}):n.issues.push({code:"invalid_union",input:n.value,inst:s,errors:[],inclusive:!1}),n)}const e2r=ui("$ZodXor",(t,n)=>{SLe.init(t,n),n.inclusive=!1;const s=n.options.length===1,c=n.options[0]._zod.run;t._zod.parse=(d,m)=>{if(s)return c(d,m);let g=!1;const S=[];for(const k of n.options){const A=k._zod.run({value:d.value,issues:[]},m);A instanceof Promise?(S.push(A),g=!0):S.push(A)}return g?Promise.all(S).then(k=>Gmt(k,d,t,m)):Gmt(S,d,t,m)}}),t2r=ui("$ZodDiscriminatedUnion",(t,n)=>{n.inclusive=!1,SLe.init(t,n);const s=t._zod.parse;Gu(t._zod,"propValues",()=>{const d={};for(const m of n.options){const g=m._zod.propValues;if(!g||Object.keys(g).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(m)}"`);for(const[S,k]of Object.entries(g)){d[S]||(d[S]=new Set);for(const A of k)d[S].add(A)}}return d});const c=dee(()=>{const d=n.options,m=new Map;for(const g of d){const S=g._zod.propValues?.[n.discriminator];if(!S||S.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(g)}"`);for(const k of S){if(m.has(k))throw new Error(`Duplicate discriminator value "${String(k)}"`);m.set(k,g)}}return m});t._zod.parse=(d,m)=>{const g=d.value;if(!ZB(g))return d.issues.push({code:"invalid_type",expected:"object",input:g,inst:t}),d;const S=c.value.get(g?.[n.discriminator]);return S?S._zod.run(d,m):n.unionFallback?s(d,m):(d.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,input:g,path:[n.discriminator],inst:t}),d)}}),r2r=ui("$ZodIntersection",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value,m=n.left._zod.run({value:d,issues:[]},c),g=n.right._zod.run({value:d,issues:[]},c);return m instanceof Promise||g instanceof Promise?Promise.all([m,g]).then(([k,A])=>Kmt(s,k,A)):Kmt(s,m,g)}});function eRe(t,n){if(t===n)return{valid:!0,data:t};if(t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if(cR(t)&&cR(n)){const s=Object.keys(n),c=Object.keys(t).filter(m=>s.indexOf(m)!==-1),d={...t,...n};for(const m of c){const g=eRe(t[m],n[m]);if(!g.valid)return{valid:!1,mergeErrorPath:[m,...g.mergeErrorPath]};d[m]=g.data}return{valid:!0,data:d}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let c=0;c<t.length;c++){const d=t[c],m=n[c],g=eRe(d,m);if(!g.valid)return{valid:!1,mergeErrorPath:[c,...g.mergeErrorPath]};s.push(g.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function Kmt(t,n,s){const c=new Map;let d;for(const S of n.issues)if(S.code==="unrecognized_keys"){d??(d=S);for(const k of S.keys)c.has(k)||c.set(k,{}),c.get(k).l=!0}else t.issues.push(S);for(const S of s.issues)if(S.code==="unrecognized_keys")for(const k of S.keys)c.has(k)||c.set(k,{}),c.get(k).r=!0;else t.issues.push(S);const m=[...c].filter(([,S])=>S.l&&S.r).map(([S])=>S);if(m.length&&d&&t.issues.push({...d,keys:m}),MO(t))return t;const g=eRe(n.value,s.value);if(!g.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(g.mergeErrorPath)}`);return t.value=g.data,t}const REt=ui("$ZodTuple",(t,n)=>{vu.init(t,n);const s=n.items;t._zod.parse=(c,d)=>{const m=c.value;if(!Array.isArray(m))return c.issues.push({input:m,inst:t,expected:"tuple",code:"invalid_type"}),c;c.value=[];const g=[],S=[...s].reverse().findIndex(F=>F._zod.optin!=="optional"),k=S===-1?0:s.length-S;if(!n.rest){const F=m.length>s.length,D=m.length<k-1;if(F||D)return c.issues.push({...F?{code:"too_big",maximum:s.length,inclusive:!0}:{code:"too_small",minimum:s.length},input:m,inst:t,origin:"array"}),c}let A=-1;for(const F of s){if(A++,A>=m.length&&A>=k)continue;const D=F._zod.run({value:m[A],issues:[]},d);D instanceof Promise?g.push(D.then(J=>vpe(J,c,A))):vpe(D,c,A)}if(n.rest){const F=m.slice(s.length);for(const D of F){A++;const J=n.rest._zod.run({value:D,issues:[]},d);J instanceof Promise?g.push(J.then($=>vpe($,c,A))):vpe(J,c,A)}}return g.length?Promise.all(g).then(()=>c):c}});function vpe(t,n,s){t.issues.length&&n.issues.push(...mC(s,t.issues)),n.value[s]=t.value}const n2r=ui("$ZodRecord",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;if(!cR(d))return s.issues.push({expected:"record",code:"invalid_type",input:d,inst:t}),s;const m=[],g=n.keyType._zod.values;if(g){s.value={};const S=new Set;for(const A of g)if(typeof A=="string"||typeof A=="number"||typeof A=="symbol"){S.add(typeof A=="number"?A.toString():A);const F=n.valueType._zod.run({value:d[A],issues:[]},c);F instanceof Promise?m.push(F.then(D=>{D.issues.length&&s.issues.push(...mC(A,D.issues)),s.value[A]=D.value})):(F.issues.length&&s.issues.push(...mC(A,F.issues)),s.value[A]=F.value)}let k;for(const A in d)S.has(A)||(k=k??[],k.push(A));k&&k.length>0&&s.issues.push({code:"unrecognized_keys",input:d,inst:t,keys:k})}else{s.value={};for(const S of Reflect.ownKeys(d)){if(S==="__proto__")continue;let k=n.keyType._zod.run({value:S,issues:[]},c);if(k instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof S=="string"&&bLe.test(S)&&k.issues.length){const D=n.keyType._zod.run({value:Number(S),issues:[]},c);if(D instanceof Promise)throw new Error("Async schemas not supported in object keys currently");D.issues.length===0&&(k=D)}if(k.issues.length){n.mode==="loose"?s.value[S]=d[S]:s.issues.push({code:"invalid_key",origin:"record",issues:k.issues.map(D=>Nw(D,c,$S())),input:S,path:[S],inst:t});continue}const F=n.valueType._zod.run({value:d[S],issues:[]},c);F instanceof Promise?m.push(F.then(D=>{D.issues.length&&s.issues.push(...mC(S,D.issues)),s.value[k.value]=D.value})):(F.issues.length&&s.issues.push(...mC(S,F.issues)),s.value[k.value]=F.value)}}return m.length?Promise.all(m).then(()=>s):s}}),i2r=ui("$ZodMap",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;if(!(d instanceof Map))return s.issues.push({expected:"map",code:"invalid_type",input:d,inst:t}),s;const m=[];s.value=new Map;for(const[g,S]of d){const k=n.keyType._zod.run({value:g,issues:[]},c),A=n.valueType._zod.run({value:S,issues:[]},c);k instanceof Promise||A instanceof Promise?m.push(Promise.all([k,A]).then(([F,D])=>{Xmt(F,D,s,g,d,t,c)})):Xmt(k,A,s,g,d,t,c)}return m.length?Promise.all(m).then(()=>s):s}});function Xmt(t,n,s,c,d,m,g){t.issues.length&&(Bme.has(typeof c)?s.issues.push(...mC(c,t.issues)):s.issues.push({code:"invalid_key",origin:"map",input:d,inst:m,issues:t.issues.map(S=>Nw(S,g,$S()))})),n.issues.length&&(Bme.has(typeof c)?s.issues.push(...mC(c,n.issues)):s.issues.push({origin:"map",code:"invalid_element",input:d,inst:m,key:c,issues:n.issues.map(S=>Nw(S,g,$S()))})),s.value.set(t.value,n.value)}const o2r=ui("$ZodSet",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;if(!(d instanceof Set))return s.issues.push({input:d,inst:t,expected:"set",code:"invalid_type"}),s;const m=[];s.value=new Set;for(const g of d){const S=n.valueType._zod.run({value:g,issues:[]},c);S instanceof Promise?m.push(S.then(k=>Ymt(k,s))):Ymt(S,s)}return m.length?Promise.all(m).then(()=>s):s}});function Ymt(t,n){t.issues.length&&n.issues.push(...t.issues),n.value.add(t.value)}const s2r=ui("$ZodEnum",(t,n)=>{vu.init(t,n);const s=gLe(n.entries),c=new Set(s);t._zod.values=c,t._zod.pattern=new RegExp(`^(${s.filter(d=>Bme.has(typeof d)).map(d=>typeof d=="string"?xD(d):d.toString()).join("|")})$`),t._zod.parse=(d,m)=>{const g=d.value;return c.has(g)||d.issues.push({code:"invalid_value",values:s,input:g,inst:t}),d}}),a2r=ui("$ZodLiteral",(t,n)=>{if(vu.init(t,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const s=new Set(n.values);t._zod.values=s,t._zod.pattern=new RegExp(`^(${n.values.map(c=>typeof c=="string"?xD(c):c?xD(c.toString()):String(c)).join("|")})$`),t._zod.parse=(c,d)=>{const m=c.value;return s.has(m)||c.issues.push({code:"invalid_value",values:n.values,input:m,inst:t}),c}}),c2r=ui("$ZodFile",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;return d instanceof File||s.issues.push({expected:"file",code:"invalid_type",input:d,inst:t}),s}}),l2r=ui("$ZodTransform",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new hLe(t.constructor.name);const d=n.transform(s.value,s);if(c.async)return(d instanceof Promise?d:Promise.resolve(d)).then(g=>(s.value=g,s));if(d instanceof Promise)throw new yB;return s.value=d,s}});function Zmt(t,n){return t.issues.length&&n===void 0?{issues:[],value:void 0}:t}const FEt=ui("$ZodOptional",(t,n)=>{vu.init(t,n),t._zod.optin="optional",t._zod.optout="optional",Gu(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),Gu(t._zod,"pattern",()=>{const s=n.innerType._zod.pattern;return s?new RegExp(`^(${dye(s.source)})?$`):void 0}),t._zod.parse=(s,c)=>{if(n.innerType._zod.optin==="optional"){const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>Zmt(m,s.value)):Zmt(d,s.value)}return s.value===void 0?s:n.innerType._zod.run(s,c)}}),u2r=ui("$ZodExactOptional",(t,n)=>{FEt.init(t,n),Gu(t._zod,"values",()=>n.innerType._zod.values),Gu(t._zod,"pattern",()=>n.innerType._zod.pattern),t._zod.parse=(s,c)=>n.innerType._zod.run(s,c)}),f2r=ui("$ZodNullable",(t,n)=>{vu.init(t,n),Gu(t._zod,"optin",()=>n.innerType._zod.optin),Gu(t._zod,"optout",()=>n.innerType._zod.optout),Gu(t._zod,"pattern",()=>{const s=n.innerType._zod.pattern;return s?new RegExp(`^(${dye(s.source)}|null)$`):void 0}),Gu(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),t._zod.parse=(s,c)=>s.value===null?s:n.innerType._zod.run(s,c)}),d2r=ui("$ZodDefault",(t,n)=>{vu.init(t,n),t._zod.optin="optional",Gu(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(s,c)=>{if(c.direction==="backward")return n.innerType._zod.run(s,c);if(s.value===void 0)return s.value=n.defaultValue,s;const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>Qmt(m,n)):Qmt(d,n)}});function Qmt(t,n){return t.value===void 0&&(t.value=n.defaultValue),t}const p2r=ui("$ZodPrefault",(t,n)=>{vu.init(t,n),t._zod.optin="optional",Gu(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(s,c)=>(c.direction==="backward"||s.value===void 0&&(s.value=n.defaultValue),n.innerType._zod.run(s,c))}),_2r=ui("$ZodNonOptional",(t,n)=>{vu.init(t,n),Gu(t._zod,"values",()=>{const s=n.innerType._zod.values;return s?new Set([...s].filter(c=>c!==void 0)):void 0}),t._zod.parse=(s,c)=>{const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>eht(m,t)):eht(d,t)}});function eht(t,n){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:n}),t}const m2r=ui("$ZodSuccess",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new hLe("ZodSuccess");const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>(s.value=m.issues.length===0,s)):(s.value=d.issues.length===0,s)}}),h2r=ui("$ZodCatch",(t,n)=>{vu.init(t,n),Gu(t._zod,"optin",()=>n.innerType._zod.optin),Gu(t._zod,"optout",()=>n.innerType._zod.optout),Gu(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(s,c)=>{if(c.direction==="backward")return n.innerType._zod.run(s,c);const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>(s.value=m.value,m.issues.length&&(s.value=n.catchValue({...s,error:{issues:m.issues.map(g=>Nw(g,c,$S()))},input:s.value}),s.issues=[]),s)):(s.value=d.value,d.issues.length&&(s.value=n.catchValue({...s,error:{issues:d.issues.map(m=>Nw(m,c,$S()))},input:s.value}),s.issues=[]),s)}}),g2r=ui("$ZodNaN",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>((typeof s.value!="number"||!Number.isNaN(s.value))&&s.issues.push({input:s.value,inst:t,expected:"nan",code:"invalid_type"}),s)}),y2r=ui("$ZodPipe",(t,n)=>{vu.init(t,n),Gu(t._zod,"values",()=>n.in._zod.values),Gu(t._zod,"optin",()=>n.in._zod.optin),Gu(t._zod,"optout",()=>n.out._zod.optout),Gu(t._zod,"propValues",()=>n.in._zod.propValues),t._zod.parse=(s,c)=>{if(c.direction==="backward"){const m=n.out._zod.run(s,c);return m instanceof Promise?m.then(g=>bpe(g,n.in,c)):bpe(m,n.in,c)}const d=n.in._zod.run(s,c);return d instanceof Promise?d.then(m=>bpe(m,n.out,c)):bpe(d,n.out,c)}});function bpe(t,n,s){return t.issues.length?(t.aborted=!0,t):n._zod.run({value:t.value,issues:t.issues},s)}const MEt=ui("$ZodCodec",(t,n)=>{vu.init(t,n),Gu(t._zod,"values",()=>n.in._zod.values),Gu(t._zod,"optin",()=>n.in._zod.optin),Gu(t._zod,"optout",()=>n.out._zod.optout),Gu(t._zod,"propValues",()=>n.in._zod.propValues),t._zod.parse=(s,c)=>{if((c.direction||"forward")==="forward"){const m=n.in._zod.run(s,c);return m instanceof Promise?m.then(g=>Spe(g,n,c)):Spe(m,n,c)}else{const m=n.out._zod.run(s,c);return m instanceof Promise?m.then(g=>Spe(g,n,c)):Spe(m,n,c)}}});function Spe(t,n,s){if(t.issues.length)return t.aborted=!0,t;if((s.direction||"forward")==="forward"){const d=n.transform(t.value,t);return d instanceof Promise?d.then(m=>xpe(t,m,n.out,s)):xpe(t,d,n.out,s)}else{const d=n.reverseTransform(t.value,t);return d instanceof Promise?d.then(m=>xpe(t,m,n.in,s)):xpe(t,d,n.in,s)}}function xpe(t,n,s,c){return t.issues.length?(t.aborted=!0,t):s._zod.run({value:n,issues:t.issues},c)}const v2r=ui("$ZodReadonly",(t,n)=>{vu.init(t,n),Gu(t._zod,"propValues",()=>n.innerType._zod.propValues),Gu(t._zod,"values",()=>n.innerType._zod.values),Gu(t._zod,"optin",()=>n.innerType?._zod?.optin),Gu(t._zod,"optout",()=>n.innerType?._zod?.optout),t._zod.parse=(s,c)=>{if(c.direction==="backward")return n.innerType._zod.run(s,c);const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(tht):tht(d)}});function tht(t){return t.value=Object.freeze(t.value),t}const b2r=ui("$ZodTemplateLiteral",(t,n)=>{vu.init(t,n);const s=[];for(const c of n.parts)if(typeof c=="object"&&c!==null){if(!c._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...c._zod.traits].shift()}`);const d=c._zod.pattern instanceof RegExp?c._zod.pattern.source:c._zod.pattern;if(!d)throw new Error(`Invalid template literal part: ${c._zod.traits}`);const m=d.startsWith("^")?1:0,g=d.endsWith("$")?d.length-1:d.length;s.push(d.slice(m,g))}else if(c===null||SCt.has(typeof c))s.push(xD(`${c}`));else throw new Error(`Invalid template literal part: ${c}`);t._zod.pattern=new RegExp(`^${s.join("")}$`),t._zod.parse=(c,d)=>typeof c.value!="string"?(c.issues.push({input:c.value,inst:t,expected:"string",code:"invalid_type"}),c):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(c.value)||c.issues.push({input:c.value,inst:t,code:"invalid_format",format:n.format??"template_literal",pattern:t._zod.pattern.source}),c)}),S2r=ui("$ZodFunction",(t,n)=>(vu.init(t,n),t._def=n,t._zod.def=n,t.implement=s=>{if(typeof s!="function")throw new Error("implement() must be called with a function");return function(...c){const d=t._def.input?Vmt(t._def.input,c):c,m=Reflect.apply(s,this,d);return t._def.output?Vmt(t._def.output,m):m}},t.implementAsync=s=>{if(typeof s!="function")throw new Error("implementAsync() must be called with a function");return async function(...c){const d=t._def.input?await Umt(t._def.input,c):c,m=await Reflect.apply(s,this,d);return t._def.output?await Umt(t._def.output,m):m}},t._zod.parse=(s,c)=>typeof s.value!="function"?(s.issues.push({code:"invalid_type",expected:"function",input:s.value,inst:t}),s):(t._def.output&&t._def.output._zod.def.type==="promise"?s.value=t.implementAsync(s.value):s.value=t.implement(s.value),s),t.input=(...s)=>{const c=t.constructor;return Array.isArray(s[0])?new c({type:"function",input:new REt({type:"tuple",items:s[0],rest:s[1]}),output:t._def.output}):new c({type:"function",input:s[0],output:t._def.output})},t.output=s=>{const c=t.constructor;return new c({type:"function",input:t._def.input,output:s})},t)),x2r=ui("$ZodPromise",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>Promise.resolve(s.value).then(d=>n.innerType._zod.run({value:d,issues:[]},c))}),w2r=ui("$ZodLazy",(t,n)=>{vu.init(t,n),Gu(t._zod,"innerType",()=>n.getter()),Gu(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Gu(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Gu(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Gu(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(s,c)=>t._zod.innerType._zod.run(s,c)}),T2r=ui("$ZodCustom",(t,n)=>{eh.init(t,n),vu.init(t,n),t._zod.parse=(s,c)=>s,t._zod.check=s=>{const c=s.value,d=n.fn(c);if(d instanceof Promise)return d.then(m=>rht(m,s,c,t));rht(d,s,c,t)}});function rht(t,n,s,c){if(!t){const d={code:"custom",input:s,inst:c,path:[...c._zod.def.path??[]],continue:!c._zod.def.abort};c._zod.def.params&&(d.params=c._zod.def.params),n.issues.push(QB(d))}}var nht;const Qhn=Symbol("ZodOutput"),egn=Symbol("ZodInput");class C2r{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...s){const c=s[0];return this._map.set(n,c),c&&typeof c=="object"&&"id"in c&&this._idmap.set(c.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const s=this._map.get(n);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(n),this}get(n){const s=n._zod.parent;if(s){const c={...this.get(s)??{}};delete c.id;const d={...c,...this._map.get(n)};return Object.keys(d).length?d:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function E2r(){return new C2r}(nht=globalThis).__zod_globalRegistry??(nht.__zod_globalRegistry=E2r());const sD=globalThis.__zod_globalRegistry;function k2r(t,n){return new t({type:"string",...Jo(n)})}function tgn(t,n){return new t({type:"string",coerce:!0,...Jo(n)})}function jEt(t,n){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Jo(n)})}function tRe(t,n){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Jo(n)})}function LEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Jo(n)})}function BEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Jo(n)})}function $Et(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Jo(n)})}function qEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Jo(n)})}function xLe(t,n){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Jo(n)})}function zEt(t,n){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Jo(n)})}function VEt(t,n){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Jo(n)})}function UEt(t,n){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Jo(n)})}function JEt(t,n){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Jo(n)})}function WEt(t,n){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Jo(n)})}function HEt(t,n){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Jo(n)})}function GEt(t,n){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Jo(n)})}function KEt(t,n){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Jo(n)})}function XEt(t,n){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Jo(n)})}function A2r(t,n){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...Jo(n)})}function YEt(t,n){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Jo(n)})}function ZEt(t,n){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Jo(n)})}function QEt(t,n){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Jo(n)})}function ekt(t,n){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Jo(n)})}function tkt(t,n){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Jo(n)})}function rkt(t,n){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Jo(n)})}const rgn={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function D2r(t,n){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Jo(n)})}function P2r(t,n){return new t({type:"string",format:"date",check:"string_format",...Jo(n)})}function I2r(t,n){return new t({type:"string",format:"time",check:"string_format",precision:null,...Jo(n)})}function N2r(t,n){return new t({type:"string",format:"duration",check:"string_format",...Jo(n)})}function O2r(t,n){return new t({type:"number",checks:[],...Jo(n)})}function ngn(t,n){return new t({type:"number",coerce:!0,checks:[],...Jo(n)})}function R2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Jo(n)})}function F2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...Jo(n)})}function M2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...Jo(n)})}function j2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...Jo(n)})}function L2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...Jo(n)})}function B2r(t,n){return new t({type:"boolean",...Jo(n)})}function ign(t,n){return new t({type:"boolean",coerce:!0,...Jo(n)})}function $2r(t,n){return new t({type:"bigint",...Jo(n)})}function ogn(t,n){return new t({type:"bigint",coerce:!0,...Jo(n)})}function q2r(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Jo(n)})}function z2r(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Jo(n)})}function V2r(t,n){return new t({type:"symbol",...Jo(n)})}function U2r(t,n){return new t({type:"undefined",...Jo(n)})}function J2r(t,n){return new t({type:"null",...Jo(n)})}function W2r(t){return new t({type:"any"})}function H2r(t){return new t({type:"unknown"})}function G2r(t,n){return new t({type:"never",...Jo(n)})}function K2r(t,n){return new t({type:"void",...Jo(n)})}function X2r(t,n){return new t({type:"date",...Jo(n)})}function sgn(t,n){return new t({type:"date",coerce:!0,...Jo(n)})}function Y2r(t,n){return new t({type:"nan",...Jo(n)})}function ZZ(t,n){return new EEt({check:"less_than",...Jo(n),value:t,inclusive:!1})}function XI(t,n){return new EEt({check:"less_than",...Jo(n),value:t,inclusive:!0})}function QZ(t,n){return new kEt({check:"greater_than",...Jo(n),value:t,inclusive:!1})}function qk(t,n){return new kEt({check:"greater_than",...Jo(n),value:t,inclusive:!0})}function agn(t){return QZ(0,t)}function cgn(t){return ZZ(0,t)}function lgn(t){return XI(0,t)}function ugn(t){return qk(0,t)}function rRe(t,n){return new G1r({check:"multiple_of",...Jo(n),value:t})}function wLe(t,n){return new Y1r({check:"max_size",...Jo(n),maximum:t})}function eQ(t,n){return new Z1r({check:"min_size",...Jo(n),minimum:t})}function nkt(t,n){return new Q1r({check:"size_equals",...Jo(n),size:t})}function ikt(t,n){return new ebr({check:"max_length",...Jo(n),maximum:t})}function qme(t,n){return new tbr({check:"min_length",...Jo(n),minimum:t})}function okt(t,n){return new rbr({check:"length_equals",...Jo(n),length:t})}function Z2r(t,n){return new nbr({check:"string_format",format:"regex",...Jo(n),pattern:t})}function Q2r(t){return new ibr({check:"string_format",format:"lowercase",...Jo(t)})}function eSr(t){return new obr({check:"string_format",format:"uppercase",...Jo(t)})}function tSr(t,n){return new sbr({check:"string_format",format:"includes",...Jo(n),includes:t})}function rSr(t,n){return new abr({check:"string_format",format:"starts_with",...Jo(n),prefix:t})}function nSr(t,n){return new cbr({check:"string_format",format:"ends_with",...Jo(n),suffix:t})}function fgn(t,n,s){return new lbr({check:"property",property:t,schema:n,...Jo(s)})}function iSr(t,n){return new ubr({check:"mime_type",mime:t,...Jo(n)})}function M$(t){return new fbr({check:"overwrite",tx:t})}function oSr(t){return M$(n=>n.normalize(t))}function sSr(){return M$(t=>t.trim())}function aSr(){return M$(t=>t.toLowerCase())}function cSr(){return M$(t=>t.toUpperCase())}function lSr(){return M$(t=>vCt(t))}function uSr(t,n,s){return new t({type:"array",element:n,...Jo(s)})}function dgn(t,n,s){return new t({type:"union",options:n,...Jo(s)})}function pgn(t,n,s){return new t({type:"union",options:n,inclusive:!1,...Jo(s)})}function _gn(t,n,s,c){return new t({type:"union",options:s,discriminator:n,...Jo(c)})}function mgn(t,n,s){return new t({type:"intersection",left:n,right:s})}function hgn(t,n,s,c){const d=s instanceof vu,m=d?c:s,g=d?s:null;return new t({type:"tuple",items:n,rest:g,...Jo(m)})}function ggn(t,n,s,c){return new t({type:"record",keyType:n,valueType:s,...Jo(c)})}function ygn(t,n,s,c){return new t({type:"map",keyType:n,valueType:s,...Jo(c)})}function vgn(t,n,s){return new t({type:"set",valueType:n,...Jo(s)})}function bgn(t,n,s){const c=Array.isArray(n)?Object.fromEntries(n.map(d=>[d,d])):n;return new t({type:"enum",entries:c,...Jo(s)})}function Sgn(t,n,s){return new t({type:"enum",entries:n,...Jo(s)})}function xgn(t,n,s){return new t({type:"literal",values:Array.isArray(n)?n:[n],...Jo(s)})}function fSr(t,n){return new t({type:"file",...Jo(n)})}function wgn(t,n){return new t({type:"transform",transform:n})}function Tgn(t,n){return new t({type:"optional",innerType:n})}function Cgn(t,n){return new t({type:"nullable",innerType:n})}function Egn(t,n,s){return new t({type:"default",innerType:n,get defaultValue(){return typeof s=="function"?s():pye(s)}})}function kgn(t,n,s){return new t({type:"nonoptional",innerType:n,...Jo(s)})}function Agn(t,n){return new t({type:"success",innerType:n})}function Dgn(t,n,s){return new t({type:"catch",innerType:n,catchValue:typeof s=="function"?s:()=>s})}function Pgn(t,n,s){return new t({type:"pipe",in:n,out:s})}function Ign(t,n){return new t({type:"readonly",innerType:n})}function Ngn(t,n,s){return new t({type:"template_literal",parts:n,...Jo(s)})}function Ogn(t,n){return new t({type:"lazy",getter:n})}function Rgn(t,n){return new t({type:"promise",innerType:n})}function dSr(t,n,s){const c=Jo(s);return c.abort??(c.abort=!0),new t({type:"custom",check:"custom",fn:n,...c})}function pSr(t,n,s){return new t({type:"custom",check:"custom",fn:n,...Jo(s)})}function _Sr(t){const n=mSr(s=>(s.addIssue=c=>{if(typeof c=="string")s.issues.push(QB(c,s.value,n._zod.def));else{const d=c;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=s.value),d.inst??(d.inst=n),d.continue??(d.continue=!n._zod.def.abort),s.issues.push(QB(d))}},t(s.value,s)));return n}function mSr(t,n){const s=new eh({check:"custom",...Jo(n)});return s._zod.check=t,s}function hSr(t){const n=new eh({check:"describe"});return n._zod.onattach=[s=>{const c=sD.get(s)??{};sD.add(s,{...c,description:t})}],n._zod.check=()=>{},n}function gSr(t){const n=new eh({check:"meta"});return n._zod.onattach=[s=>{const c=sD.get(s)??{};sD.add(s,{...c,...t})}],n._zod.check=()=>{},n}function ySr(t,n){const s=Jo(n);let c=s.truthy??["true","1","yes","on","y","enabled"],d=s.falsy??["false","0","no","off","n","disabled"];s.case!=="sensitive"&&(c=c.map($=>typeof $=="string"?$.toLowerCase():$),d=d.map($=>typeof $=="string"?$.toLowerCase():$));const m=new Set(c),g=new Set(d),S=t.Codec??MEt,k=t.Boolean??PEt,A=t.String??Sye,F=new A({type:"string",error:s.error}),D=new k({type:"boolean",error:s.error}),J=new S({type:"pipe",in:F,out:D,transform:(($,G)=>{let se=$;return s.case!=="sensitive"&&(se=se.toLowerCase()),m.has(se)?!0:g.has(se)?!1:(G.issues.push({code:"invalid_value",expected:"stringbool",values:[...m,...g],input:G.value,inst:J,continue:!1}),{})}),reverseTransform:(($,G)=>$===!0?c[0]||"true":d[0]||"false"),error:s.error});return J}function xye(t,n,s,c={}){const d=Jo(c),m={...Jo(c),check:"string_format",type:"string",format:n,fn:typeof s=="function"?s:S=>s.test(S),...d};return s instanceof RegExp&&(m.pattern=s),new t(m)}function zme(t){let n=t?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??sD,target:n,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function F_(t,n,s={path:[],schemaPath:[]}){var c;const d=t._zod.def,m=n.seen.get(t);if(m)return m.count++,s.schemaPath.includes(t)&&(m.cycle=s.path),m.schema;const g={schema:{},count:1,cycle:void 0,path:s.path};n.seen.set(t,g);const S=t._zod.toJSONSchema?.();if(S)g.schema=S;else{const F={...s,schemaPath:[...s.schemaPath,t],path:s.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(n,g.schema,F);else{const J=g.schema,$=n.processors[d.type];if(!$)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${d.type}`);$(t,n,J,F)}const D=t._zod.parent;D&&(g.ref||(g.ref=D),F_(D,n,F),n.seen.get(D).isParent=!0)}const k=n.metadataRegistry.get(t);return k&&Object.assign(g.schema,k),n.io==="input"&&W1(t)&&(delete g.schema.examples,delete g.schema.default),n.io==="input"&&g.schema._prefault&&((c=g.schema).default??(c.default=g.schema._prefault)),delete g.schema._prefault,n.seen.get(t).schema}function Vme(t,n){const s=t.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=new Map;for(const g of t.seen.entries()){const S=t.metadataRegistry.get(g[0])?.id;if(S){const k=c.get(S);if(k&&k!==g[0])throw new Error(`Duplicate schema id "${S}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);c.set(S,g[0])}}const d=g=>{const S=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const D=t.external.registry.get(g[0])?.id,J=t.external.uri??(G=>G);if(D)return{ref:J(D)};const $=g[1].defId??g[1].schema.id??`schema${t.counter++}`;return g[1].defId=$,{defId:$,ref:`${J("__shared")}#/${S}/${$}`}}if(g[1]===s)return{ref:"#"};const A=`#/${S}/`,F=g[1].schema.id??`__schema${t.counter++}`;return{defId:F,ref:A+F}},m=g=>{if(g[1].schema.$ref)return;const S=g[1],{ref:k,defId:A}=d(g);S.def={...S.schema},A&&(S.defId=A);const F=S.schema;for(const D in F)delete F[D];F.$ref=k};if(t.cycles==="throw")for(const g of t.seen.entries()){const S=g[1];if(S.cycle)throw new Error(`Cycle detected: #/${S.cycle?.join("/")}/<root>
44
44
 
45
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const g of t.seen.entries()){const S=g[1];if(n===g[0]){m(g);continue}if(t.external){const A=t.external.registry.get(g[0])?.id;if(n!==g[0]&&A){m(g);continue}}if(t.metadataRegistry.get(g[0])?.id){m(g);continue}if(S.cycle){m(g);continue}if(S.count>1&&t.reused==="ref"){m(g);continue}}}function Ume(t,n){const s=t.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=g=>{const S=t.seen.get(g);if(S.ref===null)return;const k=S.def??S.schema,A={...k},F=S.ref;if(S.ref=null,F){c(F);const J=t.seen.get(F),$=J.schema;if($.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push($)):Object.assign(k,$),Object.assign(k,A),g._zod.parent===F)for(const se in k)se==="$ref"||se==="allOf"||se in A||delete k[se];if($.$ref&&J.def)for(const se in k)se==="$ref"||se==="allOf"||se in J.def&&JSON.stringify(k[se])===JSON.stringify(J.def[se])&&delete k[se]}const D=g._zod.parent;if(D&&D!==F){c(D);const J=t.seen.get(D);if(J?.schema.$ref&&(k.$ref=J.schema.$ref,J.def))for(const $ in k)$==="$ref"||$==="allOf"||$ in J.def&&JSON.stringify(k[$])===JSON.stringify(J.def[$])&&delete k[$]}t.override({zodSchema:g,jsonSchema:k,path:S.path??[]})};for(const g of[...t.seen.entries()].reverse())c(g[0]);const d={};if(t.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?d.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?d.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const g=t.external.registry.get(n)?.id;if(!g)throw new Error("Schema is missing an `id` property");d.$id=t.external.uri(g)}Object.assign(d,s.def??s.schema);const m=t.external?.defs??{};for(const g of t.seen.entries()){const S=g[1];S.def&&S.defId&&(m[S.defId]=S.def)}t.external||Object.keys(m).length>0&&(t.target==="draft-2020-12"?d.$defs=m:d.definitions=m);try{const g=JSON.parse(JSON.stringify(d));return Object.defineProperty(g,"~standard",{value:{...n["~standard"],jsonSchema:{input:Jme(n,"input",t.processors),output:Jme(n,"output",t.processors)}},enumerable:!1,writable:!1}),g}catch{throw new Error("Error converting schema to JSON.")}}function W1(t,n){const s=n??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);const c=t._zod.def;if(c.type==="transform")return!0;if(c.type==="array")return W1(c.element,s);if(c.type==="set")return W1(c.valueType,s);if(c.type==="lazy")return W1(c.getter(),s);if(c.type==="promise"||c.type==="optional"||c.type==="nonoptional"||c.type==="nullable"||c.type==="readonly"||c.type==="default"||c.type==="prefault")return W1(c.innerType,s);if(c.type==="intersection")return W1(c.left,s)||W1(c.right,s);if(c.type==="record"||c.type==="map")return W1(c.keyType,s)||W1(c.valueType,s);if(c.type==="pipe")return W1(c.in,s)||W1(c.out,s);if(c.type==="object"){for(const d in c.shape)if(W1(c.shape[d],s))return!0;return!1}if(c.type==="union"){for(const d of c.options)if(W1(d,s))return!0;return!1}if(c.type==="tuple"){for(const d of c.items)if(W1(d,s))return!0;return!!(c.rest&&W1(c.rest,s))}return!1}const vSr=(t,n={})=>s=>{const c=zme({...s,processors:n});return F_(t,c),Vme(c,t),Ume(c,t)},Jme=(t,n,s={})=>c=>{const{libraryOptions:d,target:m}=c??{},g=zme({...d??{},target:m,io:n,processors:s});return F_(t,g),Vme(g,t),Ume(g,t)},bSr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},skt=(t,n,s,c)=>{const d=s;d.type="string";const{minimum:m,maximum:g,format:S,patterns:k,contentEncoding:A}=t._zod.bag;if(typeof m=="number"&&(d.minLength=m),typeof g=="number"&&(d.maxLength=g),S&&(d.format=bSr[S]??S,d.format===""&&delete d.format,S==="time"&&delete d.format),A&&(d.contentEncoding=A),k&&k.size>0){const F=[...k];F.length===1?d.pattern=F[0].source:F.length>1&&(d.allOf=[...F.map(D=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:D.source}))])}},akt=(t,n,s,c)=>{const d=s,{minimum:m,maximum:g,format:S,multipleOf:k,exclusiveMaximum:A,exclusiveMinimum:F}=t._zod.bag;typeof S=="string"&&S.includes("int")?d.type="integer":d.type="number",typeof F=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.minimum=F,d.exclusiveMinimum=!0):d.exclusiveMinimum=F),typeof m=="number"&&(d.minimum=m,typeof F=="number"&&n.target!=="draft-04"&&(F>=m?delete d.minimum:delete d.exclusiveMinimum)),typeof A=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.maximum=A,d.exclusiveMaximum=!0):d.exclusiveMaximum=A),typeof g=="number"&&(d.maximum=g,typeof A=="number"&&n.target!=="draft-04"&&(A<=g?delete d.maximum:delete d.exclusiveMaximum)),typeof k=="number"&&(d.multipleOf=k)},ckt=(t,n,s,c)=>{s.type="boolean"},lkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},ukt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},fkt=(t,n,s,c)=>{n.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},dkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},pkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},_kt=(t,n,s,c)=>{s.not={}},mkt=(t,n,s,c)=>{},hkt=(t,n,s,c)=>{},gkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ykt=(t,n,s,c)=>{const d=t._zod.def,m=gLe(d.entries);m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),s.enum=m},vkt=(t,n,s,c)=>{const d=t._zod.def,m=[];for(const g of d.values)if(g===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){const g=m[0];s.type=g===null?"null":typeof g,n.target==="draft-04"||n.target==="openapi-3.0"?s.enum=[g]:s.const=g}else m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),m.every(g=>typeof g=="boolean")&&(s.type="boolean"),m.every(g=>g===null)&&(s.type="null"),s.enum=m},bkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Skt=(t,n,s,c)=>{const d=s,m=t._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=m.source},xkt=(t,n,s,c)=>{const d=s,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:S,mime:k}=t._zod.bag;g!==void 0&&(m.minLength=g),S!==void 0&&(m.maxLength=S),k?k.length===1?(m.contentMediaType=k[0],Object.assign(d,m)):(Object.assign(d,m),d.anyOf=k.map(A=>({contentMediaType:A}))):Object.assign(d,m)},wkt=(t,n,s,c)=>{s.type="boolean"},Tkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ckt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Ekt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},kkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Akt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Dkt=(t,n,s,c)=>{const d=s,m=t._zod.def,{minimum:g,maximum:S}=t._zod.bag;typeof g=="number"&&(d.minItems=g),typeof S=="number"&&(d.maxItems=S),d.type="array",d.items=F_(m.element,n,{...c,path:[...c.path,"items"]})},Pkt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object",d.properties={};const g=m.shape;for(const A in g)d.properties[A]=F_(g[A],n,{...c,path:[...c.path,"properties",A]});const S=new Set(Object.keys(g)),k=new Set([...S].filter(A=>{const F=m.shape[A]._zod;return n.io==="input"?F.optin===void 0:F.optout===void 0}));k.size>0&&(d.required=Array.from(k)),m.catchall?._zod.def.type==="never"?d.additionalProperties=!1:m.catchall?m.catchall&&(d.additionalProperties=F_(m.catchall,n,{...c,path:[...c.path,"additionalProperties"]})):n.io==="output"&&(d.additionalProperties=!1)},TLe=(t,n,s,c)=>{const d=t._zod.def,m=d.inclusive===!1,g=d.options.map((S,k)=>F_(S,n,{...c,path:[...c.path,m?"oneOf":"anyOf",k]}));m?s.oneOf=g:s.anyOf=g},Ikt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.left,n,{...c,path:[...c.path,"allOf",0]}),g=F_(d.right,n,{...c,path:[...c.path,"allOf",1]}),S=A=>"allOf"in A&&Object.keys(A).length===1,k=[...S(m)?m.allOf:[m],...S(g)?g.allOf:[g]];s.allOf=k},Nkt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="array";const g=n.target==="draft-2020-12"?"prefixItems":"items",S=n.target==="draft-2020-12"||n.target==="openapi-3.0"?"items":"additionalItems",k=m.items.map((J,$)=>F_(J,n,{...c,path:[...c.path,g,$]})),A=m.rest?F_(m.rest,n,{...c,path:[...c.path,S,...n.target==="openapi-3.0"?[m.items.length]:[]]}):null;n.target==="draft-2020-12"?(d.prefixItems=k,A&&(d.items=A)):n.target==="openapi-3.0"?(d.items={anyOf:k},A&&d.items.anyOf.push(A),d.minItems=k.length,A||(d.maxItems=k.length)):(d.items=k,A&&(d.additionalItems=A));const{minimum:F,maximum:D}=t._zod.bag;typeof F=="number"&&(d.minItems=F),typeof D=="number"&&(d.maxItems=D)},Okt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object";const g=m.keyType,k=g._zod.bag?.patterns;if(m.mode==="loose"&&k&&k.size>0){const F=F_(m.valueType,n,{...c,path:[...c.path,"patternProperties","*"]});d.patternProperties={};for(const D of k)d.patternProperties[D.source]=F}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(d.propertyNames=F_(m.keyType,n,{...c,path:[...c.path,"propertyNames"]})),d.additionalProperties=F_(m.valueType,n,{...c,path:[...c.path,"additionalProperties"]});const A=g._zod.values;if(A){const F=[...A].filter(D=>typeof D=="string"||typeof D=="number");F.length>0&&(d.required=F)}},Rkt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.innerType,n,c),g=n.seen.get(t);n.target==="openapi-3.0"?(g.ref=d.innerType,s.nullable=!0):s.anyOf=[m,{type:"null"}]},Fkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},Mkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.default=JSON.parse(JSON.stringify(d.defaultValue))},jkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,n.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(d.defaultValue)))},Lkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType;let g;try{g=d.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=g},Bkt=(t,n,s,c)=>{const d=t._zod.def,m=n.io==="input"?d.in._zod.def.type==="transform"?d.out:d.in:d.out;F_(m,n,c);const g=n.seen.get(t);g.ref=m},$kt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.readOnly=!0},qkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},CLe=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},zkt=(t,n,s,c)=>{const d=t._zod.innerType;F_(d,n,c);const m=n.seen.get(t);m.ref=d},iht={string:skt,number:akt,boolean:ckt,bigint:lkt,symbol:ukt,null:fkt,undefined:dkt,void:pkt,never:_kt,any:mkt,unknown:hkt,date:gkt,enum:ykt,literal:vkt,nan:bkt,template_literal:Skt,file:xkt,success:wkt,custom:Tkt,function:Ckt,transform:Ekt,map:kkt,set:Akt,array:Dkt,object:Pkt,union:TLe,intersection:Ikt,tuple:Nkt,record:Okt,nullable:Rkt,nonoptional:Fkt,default:Mkt,prefault:jkt,catch:Lkt,pipe:Bkt,readonly:$kt,promise:qkt,optional:CLe,lazy:zkt};function SSr(t,n){if("_idmap"in t){const c=t,d=zme({...n,processors:iht}),m={};for(const k of c._idmap.entries()){const[A,F]=k;F_(F,d)}const g={},S={registry:c,uri:n?.uri,defs:m};d.external=S;for(const k of c._idmap.entries()){const[A,F]=k;Vme(d,F),g[A]=Ume(d,F)}if(Object.keys(m).length>0){const k=d.target==="draft-2020-12"?"$defs":"definitions";g.__shared={[k]:m}}return{schemas:g}}const s=zme({...n,processors:iht});return F_(t,s),Vme(s,t),Ume(s,t)}const Vkt=ui("ZodISODateTime",(t,n)=>{Cbr.init(t,n),j_.init(t,n)});function Ukt(t){return D2r(Vkt,t)}const Jkt=ui("ZodISODate",(t,n)=>{Ebr.init(t,n),j_.init(t,n)});function Wkt(t){return P2r(Jkt,t)}const Hkt=ui("ZodISOTime",(t,n)=>{kbr.init(t,n),j_.init(t,n)});function Gkt(t){return I2r(Hkt,t)}const Kkt=ui("ZodISODuration",(t,n)=>{Abr.init(t,n),j_.init(t,n)});function Xkt(t){return N2r(Kkt,t)}const Fgn=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:Jkt,ZodISODateTime:Vkt,ZodISODuration:Kkt,ZodISOTime:Hkt,date:Wkt,datetime:Ukt,duration:Xkt,time:Gkt},Symbol.toStringTag,{value:"Module"})),Ykt=(t,n)=>{MCt.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:s=>v1r(t,s)},flatten:{value:s=>y1r(t,s)},addIssue:{value:s=>{t.issues.push(s),t.message=JSON.stringify(t.issues,Lme,2)}},addIssues:{value:s=>{t.issues.push(...s),t.message=JSON.stringify(t.issues,Lme,2)}},isEmpty:{get(){return t.issues.length===0}}})},Mgn=ui("ZodError",Ykt),Fw=ui("ZodError",Ykt,{Parent:Error}),xSr=hye(Fw),wSr=gye(Fw),TSr=yye(Fw),CSr=vye(Fw),ESr=jCt(Fw),kSr=LCt(Fw),ASr=BCt(Fw),DSr=$Ct(Fw),PSr=qCt(Fw),ISr=zCt(Fw),NSr=VCt(Fw),OSr=UCt(Fw),Lu=ui("ZodType",(t,n)=>(vu.init(t,n),Object.assign(t["~standard"],{jsonSchema:{input:Jme(t,"input"),output:Jme(t,"output")}}),t.toJSONSchema=vSr(t,{}),t.def=n,t.type=n.type,Object.defineProperty(t,"_def",{value:n}),t.check=(...s)=>t.clone(oA(n,{checks:[...n.checks??[],...s.map(c=>typeof c=="function"?{_zod:{check:c,def:{check:"custom"},onattach:[]}}:c)]}),{parent:!0}),t.with=t.check,t.clone=(s,c)=>sA(t,s,c),t.brand=()=>t,t.register=((s,c)=>(s.add(t,c),t)),t.parse=(s,c)=>xSr(t,s,c,{callee:t.parse}),t.safeParse=(s,c)=>TSr(t,s,c),t.parseAsync=async(s,c)=>wSr(t,s,c,{callee:t.parseAsync}),t.safeParseAsync=async(s,c)=>CSr(t,s,c),t.spa=t.safeParseAsync,t.encode=(s,c)=>ESr(t,s,c),t.decode=(s,c)=>kSr(t,s,c),t.encodeAsync=async(s,c)=>ASr(t,s,c),t.decodeAsync=async(s,c)=>DSr(t,s,c),t.safeEncode=(s,c)=>PSr(t,s,c),t.safeDecode=(s,c)=>ISr(t,s,c),t.safeEncodeAsync=async(s,c)=>NSr(t,s,c),t.safeDecodeAsync=async(s,c)=>OSr(t,s,c),t.refine=(s,c)=>t.check(LAt(s,c)),t.superRefine=s=>t.check(BAt(s)),t.overwrite=s=>t.check(M$(s)),t.optional=()=>Gme(t),t.exactOptional=()=>bAt(t),t.nullable=()=>Kme(t),t.nullish=()=>Gme(Kme(t)),t.nonoptional=s=>EAt(t,s),t.array=()=>Gd(t),t.or=s=>AR([t,s]),t.and=s=>KLe(t,s),t.transform=s=>Xme(t,XLe(s)),t.default=s=>wAt(t,s),t.prefault=s=>CAt(t,s),t.catch=s=>DAt(t,s),t.pipe=s=>Xme(t,s),t.readonly=()=>NAt(t),t.describe=s=>{const c=t.clone();return sD.add(c,{description:s}),c},Object.defineProperty(t,"description",{get(){return sD.get(t)?.description},configurable:!0}),t.meta=(...s)=>{if(s.length===0)return sD.get(t);const c=t.clone();return sD.add(c,s[0]),c},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=s=>s(t),t)),ELe=ui("_ZodString",(t,n)=>{Sye.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>skt(t,c,d);const s=t._zod.bag;t.format=s.format??null,t.minLength=s.minimum??null,t.maxLength=s.maximum??null,t.regex=(...c)=>t.check(Z2r(...c)),t.includes=(...c)=>t.check(tSr(...c)),t.startsWith=(...c)=>t.check(rSr(...c)),t.endsWith=(...c)=>t.check(nSr(...c)),t.min=(...c)=>t.check(qme(...c)),t.max=(...c)=>t.check(ikt(...c)),t.length=(...c)=>t.check(okt(...c)),t.nonempty=(...c)=>t.check(qme(1,...c)),t.lowercase=c=>t.check(Q2r(c)),t.uppercase=c=>t.check(eSr(c)),t.trim=()=>t.check(sSr()),t.normalize=(...c)=>t.check(oSr(...c)),t.toLowerCase=()=>t.check(aSr()),t.toUpperCase=()=>t.check(cSr()),t.slugify=()=>t.check(lSr())}),kLe=ui("ZodString",(t,n)=>{Sye.init(t,n),ELe.init(t,n),t.email=s=>t.check(jEt(ALe,s)),t.url=s=>t.check(xLe(wye,s)),t.jwt=s=>t.check(rkt(VLe,s)),t.emoji=s=>t.check(zEt(DLe,s)),t.guid=s=>t.check(tRe(Wme,s)),t.uuid=s=>t.check(LEt(aD,s)),t.uuidv4=s=>t.check(BEt(aD,s)),t.uuidv6=s=>t.check($Et(aD,s)),t.uuidv7=s=>t.check(qEt(aD,s)),t.nanoid=s=>t.check(VEt(PLe,s)),t.guid=s=>t.check(tRe(Wme,s)),t.cuid=s=>t.check(UEt(ILe,s)),t.cuid2=s=>t.check(JEt(NLe,s)),t.ulid=s=>t.check(WEt(OLe,s)),t.base64=s=>t.check(QEt($Le,s)),t.base64url=s=>t.check(ekt(qLe,s)),t.xid=s=>t.check(HEt(RLe,s)),t.ksuid=s=>t.check(GEt(FLe,s)),t.ipv4=s=>t.check(KEt(MLe,s)),t.ipv6=s=>t.check(XEt(jLe,s)),t.cidrv4=s=>t.check(YEt(LLe,s)),t.cidrv6=s=>t.check(ZEt(BLe,s)),t.e164=s=>t.check(tkt(zLe,s)),t.datetime=s=>t.check(Ukt(s)),t.date=s=>t.check(Wkt(s)),t.time=s=>t.check(Gkt(s)),t.duration=s=>t.check(Xkt(s))});function bo(t){return k2r(kLe,t)}const j_=ui("ZodStringFormat",(t,n)=>{M_.init(t,n),ELe.init(t,n)}),ALe=ui("ZodEmail",(t,n)=>{hbr.init(t,n),j_.init(t,n)});function RSr(t){return jEt(ALe,t)}const Wme=ui("ZodGUID",(t,n)=>{_br.init(t,n),j_.init(t,n)});function FSr(t){return tRe(Wme,t)}const aD=ui("ZodUUID",(t,n)=>{mbr.init(t,n),j_.init(t,n)});function MSr(t){return LEt(aD,t)}function jSr(t){return BEt(aD,t)}function LSr(t){return $Et(aD,t)}function BSr(t){return qEt(aD,t)}const wye=ui("ZodURL",(t,n)=>{gbr.init(t,n),j_.init(t,n)});function $Sr(t){return xLe(wye,t)}function qSr(t){return xLe(wye,{protocol:/^https?$/,hostname:lEt,...Jo(t)})}const DLe=ui("ZodEmoji",(t,n)=>{ybr.init(t,n),j_.init(t,n)});function zSr(t){return zEt(DLe,t)}const PLe=ui("ZodNanoID",(t,n)=>{vbr.init(t,n),j_.init(t,n)});function VSr(t){return VEt(PLe,t)}const ILe=ui("ZodCUID",(t,n)=>{bbr.init(t,n),j_.init(t,n)});function USr(t){return UEt(ILe,t)}const NLe=ui("ZodCUID2",(t,n)=>{Sbr.init(t,n),j_.init(t,n)});function JSr(t){return JEt(NLe,t)}const OLe=ui("ZodULID",(t,n)=>{xbr.init(t,n),j_.init(t,n)});function WSr(t){return WEt(OLe,t)}const RLe=ui("ZodXID",(t,n)=>{wbr.init(t,n),j_.init(t,n)});function HSr(t){return HEt(RLe,t)}const FLe=ui("ZodKSUID",(t,n)=>{Tbr.init(t,n),j_.init(t,n)});function GSr(t){return GEt(FLe,t)}const MLe=ui("ZodIPv4",(t,n)=>{Dbr.init(t,n),j_.init(t,n)});function KSr(t){return KEt(MLe,t)}const Zkt=ui("ZodMAC",(t,n)=>{Ibr.init(t,n),j_.init(t,n)});function XSr(t){return A2r(Zkt,t)}const jLe=ui("ZodIPv6",(t,n)=>{Pbr.init(t,n),j_.init(t,n)});function YSr(t){return XEt(jLe,t)}const LLe=ui("ZodCIDRv4",(t,n)=>{Nbr.init(t,n),j_.init(t,n)});function ZSr(t){return YEt(LLe,t)}const BLe=ui("ZodCIDRv6",(t,n)=>{Obr.init(t,n),j_.init(t,n)});function QSr(t){return ZEt(BLe,t)}const $Le=ui("ZodBase64",(t,n)=>{Rbr.init(t,n),j_.init(t,n)});function exr(t){return QEt($Le,t)}const qLe=ui("ZodBase64URL",(t,n)=>{Mbr.init(t,n),j_.init(t,n)});function txr(t){return ekt(qLe,t)}const zLe=ui("ZodE164",(t,n)=>{jbr.init(t,n),j_.init(t,n)});function rxr(t){return tkt(zLe,t)}const VLe=ui("ZodJWT",(t,n)=>{Bbr.init(t,n),j_.init(t,n)});function nxr(t){return rkt(VLe,t)}const mee=ui("ZodCustomStringFormat",(t,n)=>{$br.init(t,n),j_.init(t,n)});function ixr(t,n,s={}){return xye(mee,t,n,s)}function oxr(t){return xye(mee,"hostname",cEt,t)}function sxr(t){return xye(mee,"hex",TEt,t)}function axr(t,n){const s=n?.enc??"hex",c=`${t}_${s}`,d=H1r[c];if(!d)throw new Error(`Unrecognized hash format: ${c}`);return xye(mee,c,d,n)}const ULe=ui("ZodNumber",(t,n)=>{DEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>akt(t,c,d),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.int=c=>t.check(nRe(c)),t.safe=c=>t.check(nRe(c)),t.positive=c=>t.check(QZ(0,c)),t.nonnegative=c=>t.check(qk(0,c)),t.negative=c=>t.check(ZZ(0,c)),t.nonpositive=c=>t.check(XI(0,c)),t.multipleOf=(c,d)=>t.check(rRe(c,d)),t.step=(c,d)=>t.check(rRe(c,d)),t.finite=()=>t;const s=t._zod.bag;t.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),t.isFinite=!0,t.format=s.format??null});function fu(t){return O2r(ULe,t)}const j$=ui("ZodNumberFormat",(t,n)=>{qbr.init(t,n),ULe.init(t,n)});function nRe(t){return R2r(j$,t)}function cxr(t){return F2r(j$,t)}function lxr(t){return M2r(j$,t)}function uxr(t){return j2r(j$,t)}function fxr(t){return L2r(j$,t)}const JLe=ui("ZodBoolean",(t,n)=>{PEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ckt(t,s,c)});function _y(t){return B2r(JLe,t)}const WLe=ui("ZodBigInt",(t,n)=>{IEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>lkt(t,c),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.positive=c=>t.check(QZ(BigInt(0),c)),t.negative=c=>t.check(ZZ(BigInt(0),c)),t.nonpositive=c=>t.check(XI(BigInt(0),c)),t.nonnegative=c=>t.check(qk(BigInt(0),c)),t.multipleOf=(c,d)=>t.check(rRe(c,d));const s=t._zod.bag;t.minValue=s.minimum??null,t.maxValue=s.maximum??null,t.format=s.format??null});function dxr(t){return $2r(WLe,t)}const HLe=ui("ZodBigIntFormat",(t,n)=>{zbr.init(t,n),WLe.init(t,n)});function pxr(t){return q2r(HLe,t)}function _xr(t){return z2r(HLe,t)}const Qkt=ui("ZodSymbol",(t,n)=>{Vbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ukt(t,s)});function mxr(t){return V2r(Qkt,t)}const eAt=ui("ZodUndefined",(t,n)=>{Ubr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>dkt(t,s)});function hxr(t){return U2r(eAt,t)}const tAt=ui("ZodNull",(t,n)=>{Jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>fkt(t,s,c)});function rAt(t){return J2r(tAt,t)}const nAt=ui("ZodAny",(t,n)=>{Wbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>mkt()});function gxr(){return W2r(nAt)}const iAt=ui("ZodUnknown",(t,n)=>{Hbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>hkt()});function t$(){return H2r(iAt)}const oAt=ui("ZodNever",(t,n)=>{Gbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>_kt(t,s,c)});function GLe(t){return G2r(oAt,t)}const sAt=ui("ZodVoid",(t,n)=>{Kbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>pkt(t,s)});function yxr(t){return K2r(sAt,t)}const aAt=ui("ZodDate",(t,n)=>{Xbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>gkt(t,c),t.min=(c,d)=>t.check(qk(c,d)),t.max=(c,d)=>t.check(XI(c,d));const s=t._zod.bag;t.minDate=s.minimum?new Date(s.minimum):null,t.maxDate=s.maximum?new Date(s.maximum):null});function vxr(t){return X2r(aAt,t)}const cAt=ui("ZodArray",(t,n)=>{Ybr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Dkt(t,s,c,d),t.element=n.element,t.min=(s,c)=>t.check(qme(s,c)),t.nonempty=s=>t.check(qme(1,s)),t.max=(s,c)=>t.check(ikt(s,c)),t.length=(s,c)=>t.check(okt(s,c)),t.unwrap=()=>t.element});function Gd(t,n){return uSr(cAt,t,n)}function bxr(t){const n=t._zod.def.shape;return ed(Object.keys(n))}const Tye=ui("ZodObject",(t,n)=>{Qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Pkt(t,s,c,d),Gu(t,"shape",()=>n.shape),t.keyof=()=>ed(Object.keys(t._zod.def.shape)),t.catchall=s=>t.clone({...t._zod.def,catchall:s}),t.passthrough=()=>t.clone({...t._zod.def,catchall:t$()}),t.loose=()=>t.clone({...t._zod.def,catchall:t$()}),t.strict=()=>t.clone({...t._zod.def,catchall:GLe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=s=>ACt(t,s),t.safeExtend=s=>DCt(t,s),t.merge=s=>PCt(t,s),t.pick=s=>ECt(t,s),t.omit=s=>kCt(t,s),t.partial=(...s)=>ICt(YLe,t,s[0]),t.required=(...s)=>NCt(ZLe,t,s[0])});function Pa(t,n){const s={type:"object",shape:t??{},...Jo(n)};return new Tye(s)}function Sxr(t,n){return new Tye({type:"object",shape:t,catchall:GLe(),...Jo(n)})}function xxr(t,n){return new Tye({type:"object",shape:t,catchall:t$(),...Jo(n)})}const Cye=ui("ZodUnion",(t,n)=>{SLe.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>TLe(t,s,c,d),t.options=n.options});function AR(t,n){return new Cye({type:"union",options:t,...Jo(n)})}const lAt=ui("ZodXor",(t,n)=>{Cye.init(t,n),e2r.init(t,n),t._zod.processJSONSchema=(s,c,d)=>TLe(t,s,c,d),t.options=n.options});function wxr(t,n){return new lAt({type:"union",options:t,inclusive:!1,...Jo(n)})}const uAt=ui("ZodDiscriminatedUnion",(t,n)=>{Cye.init(t,n),t2r.init(t,n)});function fAt(t,n,s){return new uAt({type:"union",options:n,discriminator:t,...Jo(s)})}const dAt=ui("ZodIntersection",(t,n)=>{r2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ikt(t,s,c,d)});function KLe(t,n){return new dAt({type:"intersection",left:t,right:n})}const pAt=ui("ZodTuple",(t,n)=>{REt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Nkt(t,s,c,d),t.rest=s=>t.clone({...t._zod.def,rest:s})});function Hme(t,n,s){const c=n instanceof vu,d=c?s:n,m=c?n:null;return new pAt({type:"tuple",items:t,rest:m,...Jo(d)})}const Eye=ui("ZodRecord",(t,n)=>{n2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Okt(t,s,c,d),t.keyType=n.keyType,t.valueType=n.valueType});function wD(t,n,s){return new Eye({type:"record",keyType:t,valueType:n,...Jo(s)})}function Txr(t,n,s){const c=sA(t);return c._zod.values=void 0,new Eye({type:"record",keyType:c,valueType:n,...Jo(s)})}function Cxr(t,n,s){return new Eye({type:"record",keyType:t,valueType:n,mode:"loose",...Jo(s)})}const _At=ui("ZodMap",(t,n)=>{i2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>kkt(t,s),t.keyType=n.keyType,t.valueType=n.valueType,t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(wLe(...s)),t.size=(...s)=>t.check(nkt(...s))});function Exr(t,n,s){return new _At({type:"map",keyType:t,valueType:n,...Jo(s)})}const mAt=ui("ZodSet",(t,n)=>{o2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Akt(t,s),t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(wLe(...s)),t.size=(...s)=>t.check(nkt(...s))});function kxr(t,n){return new mAt({type:"set",valueType:t,...Jo(n)})}const tQ=ui("ZodEnum",(t,n)=>{s2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>ykt(t,c,d),t.enum=n.entries,t.options=Object.values(n.entries);const s=new Set(Object.keys(n.entries));t.extract=(c,d)=>{const m={};for(const g of c)if(s.has(g))m[g]=n.entries[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})},t.exclude=(c,d)=>{const m={...n.entries};for(const g of c)if(s.has(g))delete m[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})}});function ed(t,n){const s=Array.isArray(t)?Object.fromEntries(t.map(c=>[c,c])):t;return new tQ({type:"enum",entries:s,...Jo(n)})}function Axr(t,n){return new tQ({type:"enum",entries:t,...Jo(n)})}const hAt=ui("ZodLiteral",(t,n)=>{a2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vkt(t,s,c),t.values=new Set(n.values),Object.defineProperty(t,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Dg(t,n){return new hAt({type:"literal",values:Array.isArray(t)?t:[t],...Jo(n)})}const gAt=ui("ZodFile",(t,n)=>{c2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>xkt(t,s,c),t.min=(s,c)=>t.check(eQ(s,c)),t.max=(s,c)=>t.check(wLe(s,c)),t.mime=(s,c)=>t.check(iSr(Array.isArray(s)?s:[s],c))});function Dxr(t){return fSr(gAt,t)}const yAt=ui("ZodTransform",(t,n)=>{l2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ekt(t,s),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new hLe(t.constructor.name);s.addIssue=m=>{if(typeof m=="string")s.issues.push(QB(m,s.value,n));else{const g=m;g.fatal&&(g.continue=!1),g.code??(g.code="custom"),g.input??(g.input=s.value),g.inst??(g.inst=t),s.issues.push(QB(g))}};const d=n.transform(s.value,s);return d instanceof Promise?d.then(m=>(s.value=m,s)):(s.value=d,s)}});function XLe(t){return new yAt({type:"transform",transform:t})}const YLe=ui("ZodOptional",(t,n)=>{FEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>CLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Gme(t){return new YLe({type:"optional",innerType:t})}const vAt=ui("ZodExactOptional",(t,n)=>{u2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>CLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function bAt(t){return new vAt({type:"optional",innerType:t})}const SAt=ui("ZodNullable",(t,n)=>{f2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Rkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Kme(t){return new SAt({type:"nullable",innerType:t})}function Pxr(t){return Gme(Kme(t))}const xAt=ui("ZodDefault",(t,n)=>{d2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Mkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function wAt(t,n){return new xAt({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():pye(n)}})}const TAt=ui("ZodPrefault",(t,n)=>{p2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>jkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function CAt(t,n){return new TAt({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():pye(n)}})}const ZLe=ui("ZodNonOptional",(t,n)=>{_2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Fkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function EAt(t,n){return new ZLe({type:"nonoptional",innerType:t,...Jo(n)})}const kAt=ui("ZodSuccess",(t,n)=>{m2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>wkt(t,s,c),t.unwrap=()=>t._zod.def.innerType});function Ixr(t){return new kAt({type:"success",innerType:t})}const AAt=ui("ZodCatch",(t,n)=>{h2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Lkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function DAt(t,n){return new AAt({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const PAt=ui("ZodNaN",(t,n)=>{g2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bkt(t,s)});function Nxr(t){return Y2r(PAt,t)}const QLe=ui("ZodPipe",(t,n)=>{y2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Bkt(t,s,c,d),t.in=n.in,t.out=n.out});function Xme(t,n){return new QLe({type:"pipe",in:t,out:n})}const eBe=ui("ZodCodec",(t,n)=>{QLe.init(t,n),MEt.init(t,n)});function Oxr(t,n,s){return new eBe({type:"pipe",in:t,out:n,transform:s.decode,reverseTransform:s.encode})}const IAt=ui("ZodReadonly",(t,n)=>{v2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>$kt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function NAt(t){return new IAt({type:"readonly",innerType:t})}const OAt=ui("ZodTemplateLiteral",(t,n)=>{b2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Skt(t,s,c)});function Rxr(t,n){return new OAt({type:"template_literal",parts:t,...Jo(n)})}const RAt=ui("ZodLazy",(t,n)=>{w2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>zkt(t,s,c,d),t.unwrap=()=>t._zod.def.getter()});function FAt(t){return new RAt({type:"lazy",getter:t})}const MAt=ui("ZodPromise",(t,n)=>{x2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>qkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Fxr(t){return new MAt({type:"promise",innerType:t})}const jAt=ui("ZodFunction",(t,n)=>{S2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ckt(t,s)});function oht(t){return new jAt({type:"function",input:Array.isArray(t?.input)?Hme(t?.input):t?.input??Gd(t$()),output:t?.output??t$()})}const kye=ui("ZodCustom",(t,n)=>{T2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Tkt(t,s)});function Mxr(t){const n=new eh({check:"custom"});return n._zod.check=t,n}function YI(t,n){return dSr(kye,t??(()=>!0),n)}function LAt(t,n={}){return pSr(kye,t,n)}function BAt(t){return _Sr(t)}const jxr=hSr,Lxr=gSr;function Bxr(t,n={}){const s=new kye({type:"custom",check:"custom",fn:c=>c instanceof t,abort:!0,...Jo(n)});return s._zod.bag.Class=t,s._zod.check=c=>{c.value instanceof t||c.issues.push({code:"invalid_type",expected:t.name,input:c.value,inst:s,path:[...s._zod.def.path??[]]})},s}const $xr=(...t)=>ySr({Codec:eBe,Boolean:JLe,String:kLe},...t);function qxr(t){const n=FAt(()=>AR([bo(t),fu(),_y(),rAt(),Gd(n),wD(bo(),n)]));return n}function $At(t,n){return Xme(XLe(t),n)}const jgn=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:nAt,ZodArray:cAt,ZodBase64:$Le,ZodBase64URL:qLe,ZodBigInt:WLe,ZodBigIntFormat:HLe,ZodBoolean:JLe,ZodCIDRv4:LLe,ZodCIDRv6:BLe,ZodCUID:ILe,ZodCUID2:NLe,ZodCatch:AAt,ZodCodec:eBe,ZodCustom:kye,ZodCustomStringFormat:mee,ZodDate:aAt,ZodDefault:xAt,ZodDiscriminatedUnion:uAt,ZodE164:zLe,ZodEmail:ALe,ZodEmoji:DLe,ZodEnum:tQ,ZodExactOptional:vAt,ZodFile:gAt,ZodFunction:jAt,ZodGUID:Wme,ZodIPv4:MLe,ZodIPv6:jLe,ZodIntersection:dAt,ZodJWT:VLe,ZodKSUID:FLe,ZodLazy:RAt,ZodLiteral:hAt,ZodMAC:Zkt,ZodMap:_At,ZodNaN:PAt,ZodNanoID:PLe,ZodNever:oAt,ZodNonOptional:ZLe,ZodNull:tAt,ZodNullable:SAt,ZodNumber:ULe,ZodNumberFormat:j$,ZodObject:Tye,ZodOptional:YLe,ZodPipe:QLe,ZodPrefault:TAt,ZodPromise:MAt,ZodReadonly:IAt,ZodRecord:Eye,ZodSet:mAt,ZodString:kLe,ZodStringFormat:j_,ZodSuccess:kAt,ZodSymbol:Qkt,ZodTemplateLiteral:OAt,ZodTransform:yAt,ZodTuple:pAt,ZodType:Lu,ZodULID:OLe,ZodURL:wye,ZodUUID:aD,ZodUndefined:eAt,ZodUnion:Cye,ZodUnknown:iAt,ZodVoid:sAt,ZodXID:RLe,ZodXor:lAt,_ZodString:ELe,_default:wAt,_function:oht,any:gxr,array:Gd,base64:exr,base64url:txr,bigint:dxr,boolean:_y,catch:DAt,check:Mxr,cidrv4:ZSr,cidrv6:QSr,codec:Oxr,cuid:USr,cuid2:JSr,custom:YI,date:vxr,describe:jxr,discriminatedUnion:fAt,e164:rxr,email:RSr,emoji:zSr,enum:ed,exactOptional:bAt,file:Dxr,float32:cxr,float64:lxr,function:oht,guid:FSr,hash:axr,hex:sxr,hostname:oxr,httpUrl:qSr,instanceof:Bxr,int:nRe,int32:uxr,int64:pxr,intersection:KLe,ipv4:KSr,ipv6:YSr,json:qxr,jwt:nxr,keyof:bxr,ksuid:GSr,lazy:FAt,literal:Dg,looseObject:xxr,looseRecord:Cxr,mac:XSr,map:Exr,meta:Lxr,nan:Nxr,nanoid:VSr,nativeEnum:Axr,never:GLe,nonoptional:EAt,null:rAt,nullable:Kme,nullish:Pxr,number:fu,object:Pa,optional:Gme,partialRecord:Txr,pipe:Xme,prefault:CAt,preprocess:$At,promise:Fxr,readonly:NAt,record:wD,refine:LAt,set:kxr,strictObject:Sxr,string:bo,stringFormat:ixr,stringbool:$xr,success:Ixr,superRefine:BAt,symbol:mxr,templateLiteral:Rxr,transform:XLe,tuple:Hme,uint32:fxr,uint64:_xr,ulid:WSr,undefined:hxr,union:AR,unknown:t$,url:$Sr,uuid:MSr,uuidv4:jSr,uuidv6:LSr,uuidv7:BSr,void:yxr,xid:HSr,xor:wxr},Symbol.toStringTag,{value:"Module"})),sht={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Lgn(t){$S({customError:t})}function Bgn(){return $S().customError}var aht;aht||(aht={});const cht=ed(["mock","live"]),zxr=Pa({id:bo().min(1),name:bo().min(1),status:ed(["free","trialing","active","past_due","cancelling"]),interval:ed(["month","year"]).optional(),renewsAt:bo().datetime().optional(),endsAt:bo().datetime().optional()}),Vxr=Pa({included:fu().nonnegative(),purchased:fu().nonnegative(),used:fu().nonnegative(),reserved:fu().nonnegative(),remaining:fu().nonnegative(),resetsAt:bo().datetime().optional(),purchasedExpiresAt:bo().datetime().optional()}),Uxr=Pa({overageEnabled:_y(),monthlyLimitCredits:fu().nonnegative(),alertThresholds:Gd(fu().min(1).max(100)).max(8),autoReload:Pa({enabled:_y(),whenRemainingBelow:fu().nonnegative(),reloadTo:fu().positive(),monthlyLimitCredits:fu().nonnegative()}).optional()}),Jxr=Pa({id:bo().min(1),kind:ed(["threshold","auto_reload_succeeded","auto_reload_failed"]),message:bo().min(1),createdAt:bo().datetime(),readAt:bo().datetime().optional()}),Wxr=Pa({id:bo().min(1),email:bo().email(),name:bo().min(1).optional()}),Hxr=Pa({name:bo().min(1),verified:_y(),enrollmentMode:ed(["manual_invitation","automatic_invitation","automatic_suggestion","enterprise_sso"])}),Gxr=Pa({id:bo().min(1),name:bo().min(1),slug:bo().min(1).optional(),role:bo().min(1),domains:Gd(Hxr).max(50)}),Kxr=Pa({id:bo().min(1),occurredAt:bo().datetime(),kind:ed(["inference","generation","workspace","storage","relay","deployment"]),provider:bo().min(1),operation:bo().optional(),credits:fu().nonnegative(),state:ed(["reserved","settled","released"]),externalId:bo().optional()});ed(["free","creator","max","ultra"]);const Xxr=Pa({plans:Pa({free:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),creator:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),max:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),ultra:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()})}),creditPacks:wD(bo().min(1),Pa({name:bo().min(1),credits:fu().int().positive(),expiresInDays:fu().int().positive().optional()}))}),Yxr=fAt("authenticated",[Pa({authenticated:Dg(!1),backend:cht}),Pa({authenticated:Dg(!0),backend:cht,user:Wxr,organizations:Gd(Gxr).max(100).optional(),plan:zxr,credits:Vxr,spendPolicy:Uxr,alerts:Gd(Jxr).max(100).optional(),entitlements:Pa({generation:_y(),dailyJobs:fu().int().positive().optional()})})]),Zxr=ed(["auto","mock","managed","byok"]),qAt=ed(["fal","tripo","worldlabs","openrouter"]),Qxr=Pa({enabled:_y(),provider:Dg("openrouter"),model:bo().trim().min(1).max(256)}),ewr=ed(["environment","system","session","none"]),twr=Pa({provider:qAt,label:bo().min(1),environmentVariable:bo().min(1),configured:_y(),source:ewr,editable:_y(),persistence:ed(["system","session"]),maskedKey:bo().min(1).optional(),problem:bo().min(1).optional()}),rwr=Pa({provider:qAt,ok:Dg(!0),testedAt:bo().datetime()});function nwr(t){return{routes:{mock:!0,managed:t.routes.managed,byok:t.routes.byok,byokProviders:[...t.routes.byokProviders]},preferredRoute:t.preferredRoute}}const Aye=KLe(Yxr,Pa({accountEnvironment:ed(["test-mock","development-twin","production"]),routes:Pa({mock:Dg(!0),managed:_y(),byok:_y(),byokProviders:Gd(bo().min(1))}),preferredRoute:Zxr,providerCredentials:Gd(twr),codingInference:Qxr}));function iwr(t,n){return`${t}: this origin answered with its page fallback (${n||"no content-type"}) rather than JSON, so no editor server handled the request.`}function of(t,n){const s=t.headers.get("content-type")??"";if(!s.includes("application/json"))throw new Error(iwr(n,s))}function CN(t,n){if(!t.ok)throw new Error(`${n} (${t.status}).`);of(t,n)}async function L_(t,n){return CN(t,n),await t.json()}const lht="volter.collaboration.participant.v1",owr="volter.collaboration.remote-share.v1",iRe=globalThis.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__;function swr(){if(iRe?.participantId)return iRe.participantId;const t=globalThis.crypto?.randomUUID?.()??`participant-${Date.now()}`;try{const n=globalThis.localStorage?.getItem(lht);if(n)return n;globalThis.localStorage?.setItem(lht,t)}catch{}return t}const zAt=swr(),L$=(()=>{try{return globalThis.localStorage?.getItem(owr)==="1"}catch{return!1}})(),awr=iRe?.displayName||"Local editor",cwr=Symbol.for("volter.collaboration.revision"),oRe=globalThis[cwr]??={value:0};function VAt(t){Number.isInteger(t)&&t>=oRe.value&&(oRe.value=t)}function Dw(){return{participantId:zAt,expectedRevision:oRe.value}}const lwr={authenticated:!1,backend:"mock",accountEnvironment:"test-mock",routes:{mock:!0,managed:!1,byok:!1,byokProviders:[]},preferredRoute:"auto",providerCredentials:[],codingInference:{enabled:!1,provider:"openrouter",model:"z-ai/glm-5.2"}};let r$=lwr,UAt=0,sRe=null;const aRe=new Set;function lR(t,n=null){if(!(sRe===n&&JSON.stringify(r$)===JSON.stringify(t))){r$=t,sRe=n,UAt++;for(const s of aRe)s()}}async function JAt(t,n){of(t,n);const s=await t.json();if(!t.ok)throw new Error(typeof s.error=="string"?String(s.error):`Account request failed (${t.status}).`);return Aye.parse(s)}async function NC(t,n,s){const c=await fetch(t,{method:n,...s===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}}),d=await JAt(c,`${n} ${t} failed`);return lR(d),d}function tBe(){return r$}function rBe(){return nwr(r$)}function cN(){return UAt}function wpe(){return sRe}function Dye(t){return aRe.add(t),()=>aRe.delete(t)}async function uht(){try{const t=await JAt(await fetch("/__editor/account"),"Account read failed");return lR(t),t}catch(t){throw lR(r$,t instanceof Error?t.message:String(t)),t}}const uwr=t=>NC("/__editor/account/mock-session","POST",{email:t}),fwr=t=>NC("/__editor/account/twin-session","POST",{email:t}),dwr=()=>NC("/__editor/account/session","DELETE"),pwr=t=>NC("/__editor/account/spend-policy","PUT",t),_wr=()=>NC("/__editor/account/alerts/read","POST"),mwr=t=>NC("/__editor/account/execution-route","PUT",{route:t}),hwr=t=>NC("/__editor/account/coding-inference","PUT",t);async function gwr(t){const n=await fetch("/__editor/account/coding-inference/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});of(n,"Coding quote failed");const s=await n.json();if(!n.ok||typeof s.model!="string"||typeof s.promptTokens!="number"||typeof s.outputTokens!="number"||typeof s.providerAmountUsd!="number"||typeof s.estimatedCredits!="number")throw new Error(typeof s.error=="string"?s.error:"Coding quote failed.");return s}const ywr=(t,n)=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"PUT",{key:n}),vwr=t=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"DELETE");async function bwr(t){const n=await fetch(`/__editor/account/provider-credentials/${encodeURIComponent(t)}/test`,{method:"POST"});of(n,"Credential test failed");const s=await n.json();if(!n.ok)throw new Error(typeof s.error=="string"?s.error:`Credential test failed (${n.status}).`);return rwr.parse(s)}const fht=t=>NC("/__editor/account/plan","PUT",{action:t});async function WAt(t,n){const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID()},body:JSON.stringify(n)});of(s,"Checkout failed");const c=await s.json();if(!s.ok||!c.account)throw new Error(typeof c.error=="string"?c.error:"Checkout failed.");return lR(Aye.parse(c.account)),{...typeof c.checkoutUrl=="string"?{checkoutUrl:c.checkoutUrl}:{},mock:c.mock===!0}}const Swr=t=>WAt("/__editor/account/checkout",{plan:t}),xwr=t=>WAt("/__editor/account/credits",{packId:t});async function wwr(){const t=await fetch("/__editor/account/usage");of(t,"Usage failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Usage failed.");return Kxr.array().parse(n.entries??[])}async function Twr(){const t=await fetch("/__editor/account/catalog");of(t,"Catalog failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Catalog failed.");return Xxr.parse(n)}async function Cwr(){const t=await fetch("/__editor/account/billing-portal",{method:"POST"});of(t,"Billing portal failed");const n=await t.json();if(!t.ok||typeof n.url!="string")throw new Error(typeof n.error=="string"?n.error:"Billing portal failed.");return{url:n.url,mock:n.mock===!0}}async function Ewr(){const t=await fetch("/__editor/account/authorization-methods");of(t,"Sign-in methods are unavailable");const n=await t.json();if(!t.ok||n.browser!==!0||typeof n.device!="boolean")throw new Error(typeof n.error=="string"?n.error:"Sign-in methods are unavailable.");return{browser:!0,device:n.device}}async function kwr(){const t=await fetch("/__editor/account/browser-authorization",{method:"POST"});of(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function Awr(t){const n=await fetch(`/__editor/account/browser-authorization/${encodeURIComponent(t)}`);of(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(Aye.parse(s.account)),!0}async function Dwr(){const t=await fetch("/__editor/account/device-authorization",{method:"POST"});of(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function Pwr(t){const n=await fetch(`/__editor/account/device-authorization/${encodeURIComponent(t)}`);of(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(Aye.parse(s.account)),!0}function Iwr(){if(L$)return()=>{};const t=new URLSearchParams(window.location.search).get("checkout_id");t?NC("/__editor/account/checkout/confirm","POST",{checkoutId:t}).then(()=>{const s=new URL(window.location.href);s.searchParams.delete("checkout"),s.searchParams.delete("checkout_id"),window.history.replaceState(null,"",`${s.pathname}${s.search}${s.hash}`)}).catch(s=>lR(r$,s instanceof Error?s.message:String(s))):uht().catch(()=>{});const n=window.setInterval(()=>void uht().catch(()=>{}),3e4);return()=>window.clearInterval(n)}function HAt(t){return t?KAt(t)?null:t:null}function Nwr(t,n){try{return t.ownerOf(n)}catch{return"unresolved"}}function GAt(t){return t&&KAt(t)?t:null}function KAt(t){return t.keyedBy==="display"}const $gn=Object.freeze(Object.defineProperty({__proto__:null,displayKeyedPhysics:GAt,nodeKeyedPhysics:HAt,physicsOwnerOf:Nwr},Symbol.toStringTag,{value:"Module"})),Owr={"source-prop":!0,"source-structure":!0,"construction-literal":!0,"physics-binding":!0,"data-record":!0,"live-only":!0},nBe=Object.keys(Owr);function Rwr(){const t={};for(const n of nBe)t[n]=0;return t}const Fwr={provenance:!0,selection:!0,transforms:!0,inspector:!0,assetSubject:!0,related:!0,instances:!0,structure:!0,persistence:!0,pickable:!0,rects:!0,boxEdit:!0,text:!0,colorSample:!0,stories:!0,truth:!0,spatialHandles:!0,assetDrop:!0,subscribe:!0},iBe=Object.keys(Fwr);function Mwr(t){const n={};for(const s of iBe)n[s]=t[s]!==void 0;return n}const qgn=Object.freeze(Object.defineProperty({__proto__:null,AUTHORING_PROVIDER_KEYS:iBe,WRITE_ANCHOR_KINDS:nBe,emptyWriteAnchorKindCounts:Rwr,measureAuthoringProviders:Mwr},Symbol.toStringTag,{value:"Module"})),jwr=["claim","shape","operation","effect","round-trip"],Yme={claim:0,shape:1,operation:2,effect:3,"round-trip":4};function XAt(t,n){return Yme[t]>=Yme[n]}function rQ(t){const{seam:n,subject:s,epoch:c,required:d}=t;if(t.notApplicable!==void 0)return{seam:n,subject:s,epoch:c,required:d,state:"not-applicable",receipt:null,detail:t.notApplicable};let m=null;for(const g of t.receipts)g.seam!==n||g.subject!==s||g.epoch!==c||(!m||Yme[g.stage]>=Yme[m.stage])&&(m=g);return m?m.outcome==="fail"?{seam:n,subject:s,epoch:c,required:d,state:"failed",receipt:m,detail:m.detail}:m.outcome==="absent"?{seam:n,subject:s,epoch:c,required:d,state:"absent",receipt:m,detail:m.detail}:XAt(m.stage,d)?{seam:n,subject:s,epoch:c,required:d,state:"verified",receipt:m,detail:m.detail}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:m,detail:`${m.detail}; this proves ${m.stage}, but this seam requires ${d}`}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:null,detail:`no current-epoch evidence has reached the required ${d} stage`}}class YAt{#e=[];record(n){if(!n.seam||!n.subject||!n.epoch||!n.detail.trim())throw new Error("seam evidence requires non-empty seam, subject, epoch, and detail");this.#e.push(n)}receipts(n){return this.#e.filter(s=>(n?.subject===void 0||s.subject===n.subject)&&(n?.epoch===void 0||s.epoch===n.epoch))}verdict(n){return rQ({...n,receipts:this.#e})}clearSubject(n){for(let s=this.#e.length-1;s>=0;s-=1)this.#e[s]?.subject===n&&this.#e.splice(s,1)}clear(){this.#e.length=0}}function Ip(){return t=>t}function Lwr(t){if(t.value===void 0)return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:t.optional?"absent":"fail",source:"shape-check",detail:t.optional?`${t.seam} is not exposed by this subject`:`${t.seam} is required by the contract but is absent`};const n=typeof t.value,s=t.kind==="function"?n==="function":n!=="function";return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:s?"pass":"fail",source:"shape-check",detail:s?`${t.seam} has the contract's ${t.kind} shape`:`${t.seam} is ${n}; the contract requires a ${t.kind}`}}function vB(t){const n=[],s=t.value!==null&&(typeof t.value=="object"||typeof t.value=="function")?t.value:null,c=Object.entries(t.shape);for(const[d,m]of c){const g=`${t.prefix}.${d}`,S=s?.[d];n.push(Lwr({seam:g,subject:t.subject,epoch:t.epoch,value:S,optional:m.optional,kind:m.kind}))}return n}function Zme(t){const n=rQ(t);if(n.state==="absent"||n.state==="failed"||!t.shape)return n;for(const[s,c]of Object.entries(t.shape)){const d=rQ({seam:`${t.seam}.${s}`,subject:t.subject,epoch:t.epoch,required:c.required,receipts:t.receipts});if(!(c.optional&&d.state==="absent")){if(d.state==="failed"||d.state==="absent")return{...n,state:"failed",receipt:d.receipt,detail:`${t.seam} is malformed: ${d.detail}`};if(d.state!=="verified")return{...n,state:"unverified",detail:`${t.seam} has the required shape, but ${d.seam} is unverified: ${d.detail}`}}}return n}const zgn=Object.freeze(Object.defineProperty({__proto__:null,SEAM_PROOF_STAGES:jwr,SeamEvidenceLedger:YAt,defineSeamShape:Ip,gradeSeamCarrier:Zme,gradeSeamEvidence:rQ,inspectSeamShape:vB,seamStageAtLeast:XAt},Symbol.toStringTag,{value:"Module"})),XY=Ip()({capabilities:{optional:!1,kind:"value",required:"shape"},provenance:{optional:!0,kind:"value",required:"shape"},hierarchy:{optional:!1,kind:"value",required:"operation"},selection:{optional:!0,kind:"value",required:"effect"},transforms:{optional:!0,kind:"value",required:"effect"},inspector:{optional:!0,kind:"value",required:"effect"},assetSubject:{optional:!0,kind:"value",required:"operation"},related:{optional:!0,kind:"value",required:"operation"},instances:{optional:!0,kind:"value",required:"effect"},structure:{optional:!0,kind:"value",required:"round-trip"},persistence:{optional:!0,kind:"value",required:"round-trip"},pickable:{optional:!0,kind:"value",required:"operation"},rects:{optional:!0,kind:"value",required:"operation"},boxEdit:{optional:!0,kind:"value",required:"effect"},text:{optional:!0,kind:"value",required:"effect"},colorSample:{optional:!0,kind:"value",required:"operation"},stories:{optional:!0,kind:"value",required:"effect"},truth:{optional:!0,kind:"value",required:"operation"},spatialHandles:{optional:!0,kind:"value",required:"effect"},assetDrop:{optional:!0,kind:"value",required:"round-trip"},subscribe:{optional:!0,kind:"function",required:"effect"}}),cRe=Ip()({roots:{optional:!1,kind:"function",required:"operation"},node:{optional:!1,kind:"function",required:"operation"},crossSurfaceStructureSignature:{optional:!0,kind:"function",required:"operation"},object3D:{optional:!0,kind:"function",required:"operation"},idForObject3D:{optional:!0,kind:"function",required:"operation"}}),ZAt=Ip()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},resolve:{optional:!0,kind:"function",required:"operation"}}),QAt=Ip()({dimensions:{optional:!0,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},editability:{optional:!0,kind:"function",required:"operation"},beginEdit:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},endEdit:{optional:!1,kind:"function",required:"effect"},remove:{optional:!0,kind:"function",required:"round-trip"},sourceCommit:{optional:!0,kind:"value",required:"round-trip"}}),e3t=Ip()({properties:{optional:!1,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},preview:{optional:!0,kind:"function",required:"effect"},editability:{optional:!0,kind:"function",required:"operation"},remove:{optional:!0,kind:"function",required:"round-trip"}}),t3t=Ip()({get:{optional:!1,kind:"function",required:"operation"},entries:{optional:!0,kind:"function",required:"operation"}}),r3t=Ip()({links:{optional:!1,kind:"function",required:"operation"}}),n3t=Ip()({describe:{optional:!1,kind:"function",required:"operation"},openComponent:{optional:!0,kind:"function",required:"effect"},revert:{optional:!1,kind:"function",required:"round-trip"},applyToComponent:{optional:!1,kind:"function",required:"round-trip"}}),i3t=Ip()({create:{optional:!1,kind:"function",required:"round-trip"},remove:{optional:!1,kind:"function",required:"round-trip"},duplicate:{optional:!1,kind:"function",required:"round-trip"},duplicateMany:{optional:!0,kind:"function",required:"round-trip"},reparent:{optional:!1,kind:"function",required:"round-trip"},reorder:{optional:!0,kind:"function",required:"round-trip"},creatableKinds:{optional:!0,kind:"function",required:"operation"},wrap:{optional:!0,kind:"function",required:"round-trip"},unwrap:{optional:!0,kind:"function",required:"round-trip"},group:{optional:!0,kind:"function",required:"round-trip"},ungroup:{optional:!0,kind:"function",required:"round-trip"},canUngroup:{optional:!0,kind:"function",required:"operation"},removeMany:{optional:!0,kind:"function",required:"round-trip"},copy:{optional:!0,kind:"function",required:"effect"},canCopy:{optional:!0,kind:"function",required:"operation"},cut:{optional:!0,kind:"function",required:"round-trip"},paste:{optional:!0,kind:"function",required:"round-trip"},canPaste:{optional:!0,kind:"function",required:"operation"}}),o3t=Ip()({isDirty:{optional:!1,kind:"function",required:"operation"},lastError:{optional:!0,kind:"function",required:"operation"},save:{optional:!1,kind:"function",required:"round-trip"},destination:{optional:!1,kind:"value",required:"shape"},applyExternal:{optional:!0,kind:"function",required:"effect"}}),s3t=Ip()({pick:{optional:!1,kind:"function",required:"operation"},candidates:{optional:!0,kind:"function",required:"operation"}}),a3t=Ip()({storiesFor:{optional:!1,kind:"function",required:"operation"},active:{optional:!1,kind:"function",required:"operation"},apply:{optional:!1,kind:"function",required:"effect"},isolate:{optional:!0,kind:"function",required:"effect"},title:{optional:!0,kind:"value",required:"shape"},unavailable:{optional:!0,kind:"function",required:"operation"}}),c3t=Ip()({accepts:{optional:!1,kind:"function",required:"operation"},drop:{optional:!1,kind:"function",required:"round-trip"}}),l3t=Ip()({rect:{optional:!1,kind:"function",required:"operation"},contextRects:{optional:!0,kind:"function",required:"operation"},emptyContainers:{optional:!0,kind:"function",required:"operation"},frame:{optional:!0,kind:"function",required:"operation"}}),u3t=Ip()({begin:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},end:{optional:!1,kind:"function",required:"effect"},gizmoOrigin:{optional:!0,kind:"function",required:"operation"},referencePoint:{optional:!0,kind:"function",required:"operation"}}),f3t=Ip()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"}}),d3t=Ip()({backgroundChainAt:{optional:!1,kind:"function",required:"operation"}}),p3t=Ip()({resolve:{optional:!1,kind:"function",required:"operation"}}),_3t=Ip()({layers:{optional:!1,kind:"function",required:"operation"},preview:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"round-trip"}}),lRe={selection:ZAt,transforms:QAt,inspector:e3t,assetSubject:t3t,related:r3t,instances:n3t,structure:i3t,persistence:o3t,pickable:s3t,rects:l3t,boxEdit:u3t,text:f3t,colorSample:d3t,stories:a3t,truth:p3t,spatialHandles:_3t,assetDrop:c3t},Vgn=Object.freeze(Object.defineProperty({__proto__:null,ASSET_DROP_PROVIDER_SHAPE:c3t,ASSET_SUBJECT_PROVIDER_SHAPE:t3t,AUTHORING_ADAPTER_SHAPE:XY,AUTHORING_PROVIDER_SHAPES:lRe,BOX_EDIT_PROVIDER_SHAPE:u3t,COLOR_SAMPLE_PROVIDER_SHAPE:d3t,COMPONENT_INSTANCES_PROVIDER_SHAPE:n3t,HIERARCHY_PROVIDER_SHAPE:cRe,INSPECTOR_PROVIDER_SHAPE:e3t,PERSISTENCE_PROVIDER_SHAPE:o3t,PICK_PROVIDER_SHAPE:s3t,RECT_PROVIDER_SHAPE:l3t,RELATED_SUBJECTS_PROVIDER_SHAPE:r3t,SELECTION_PROVIDER_SHAPE:ZAt,SPATIAL_HANDLES_PROVIDER_SHAPE:_3t,STORIES_PROVIDER_SHAPE:a3t,STRUCTURE_PROVIDER_SHAPE:i3t,TEXT_PROVIDER_SHAPE:f3t,TRANSFORM_PROVIDER_SHAPE:QAt,TRUTH_PROVIDER_SHAPE:p3t},Symbol.toStringTag,{value:"Module"})),uRe=Ip()({physics:{optional:!0,kind:"value",required:"effect"},networking:{optional:!0,kind:"value",required:"operation"},navigation:{optional:!0,kind:"value",required:"operation"},audio:{optional:!0,kind:"value",required:"effect"},camera:{optional:!0,kind:"value",required:"effect"},debug:{optional:!0,kind:"value",required:"operation"},renderDebug:{optional:!0,kind:"value",required:"effect"}}),m3t=Ip()({keyedBy:{optional:!0,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"},debugDraw:{optional:!0,kind:"function",required:"operation"},setDebugDrawEnabled:{optional:!0,kind:"function",required:"effect"},contactPoints:{optional:!0,kind:"function",required:"operation"},colliders:{optional:!0,kind:"function",required:"operation"},previewCollider:{optional:!0,kind:"function",required:"effect"},joints:{optional:!0,kind:"function",required:"operation"},previewJointAnchor:{optional:!0,kind:"function",required:"effect"}}),h3t=Ip()({keyedBy:{optional:!1,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"}}),g3t=Ip()({peers:{optional:!1,kind:"function",required:"operation"},networkId:{optional:!1,kind:"function",required:"operation"},authority:{optional:!1,kind:"function",required:"operation"},editable:{optional:!1,kind:"function",required:"operation"},getConnectionState:{optional:!0,kind:"function",required:"operation"},getRoomInfo:{optional:!0,kind:"function",required:"operation"},getReplicationStats:{optional:!0,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"},getStateSnapshot:{optional:!0,kind:"function",required:"operation"},messageEvents:{optional:!0,kind:"function",required:"operation"},getRates:{optional:!0,kind:"function",required:"operation"},getConditioning:{optional:!0,kind:"function",required:"operation"},setConditioning:{optional:!0,kind:"function",required:"effect"},getServerConfig:{optional:!0,kind:"function",required:"operation"},getPlayerIdentity:{optional:!0,kind:"function",required:"operation"},setPlayerIdentity:{optional:!0,kind:"function",required:"effect"},getTrafficByType:{optional:!0,kind:"function",required:"operation"},sendMessage:{optional:!0,kind:"function",required:"effect"},getConditioningLimits:{optional:!0,kind:"function",required:"operation"},ping:{optional:!0,kind:"function",required:"effect"},inspectServer:{optional:!0,kind:"function",required:"operation"},disconnectClient:{optional:!0,kind:"function",required:"effect"},editServerState:{optional:!0,kind:"function",required:"effect"},deleteServerState:{optional:!0,kind:"function",required:"effect"},sendToClient:{optional:!0,kind:"function",required:"effect"},broadcast:{optional:!0,kind:"function",required:"effect"},disposeRoom:{optional:!0,kind:"function",required:"effect"},stateFieldType:{optional:!0,kind:"function",required:"operation"},clearTraffic:{optional:!0,kind:"function",required:"effect"},getTrafficByEntity:{optional:!0,kind:"function",required:"operation"},isRecording:{optional:!0,kind:"function",required:"operation"},setRecording:{optional:!0,kind:"function",required:"effect"}}),y3t=Ip()({hasNavMesh:{optional:!1,kind:"function",required:"operation"},findPath:{optional:!1,kind:"function",required:"effect"},debugMesh:{optional:!1,kind:"function",required:"operation"},bake:{optional:!0,kind:"function",required:"effect"},exportData:{optional:!0,kind:"function",required:"operation"},clear:{optional:!0,kind:"function",required:"effect"},crowdAgents:{optional:!0,kind:"function",required:"operation"}}),v3t=Ip()({resume:{optional:!0,kind:"function",required:"effect"},setMuted:{optional:!1,kind:"function",required:"effect"},isMuted:{optional:!1,kind:"function",required:"operation"},graphSnapshot:{optional:!0,kind:"function",required:"operation"},transportState:{optional:!0,kind:"function",required:"operation"},acquireMeters:{optional:!0,kind:"function",required:"effect"},acquireRecordingStream:{optional:!0,kind:"function",required:"effect"},renderOffline:{optional:!0,kind:"function",required:"operation"},audioEvents:{optional:!0,kind:"function",required:"operation"}}),b3t=Ip()({snapshot:{optional:!1,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"}}),S3t=Ip()({providers:{optional:!1,kind:"function",required:"operation"},state:{optional:!1,kind:"function",required:"operation"},stateAll:{optional:!1,kind:"function",required:"operation"},commands:{optional:!1,kind:"function",required:"operation"},invoke:{optional:!1,kind:"function",required:"effect"},events:{optional:!1,kind:"function",required:"operation"}}),x3t=Ip()({captureFrame:{optional:!1,kind:"function",required:"effect"},memorySnapshot:{optional:!0,kind:"function",required:"operation"}}),w3t={networking:g3t,navigation:y3t,audio:v3t,camera:b3t,debug:S3t,renderDebug:x3t},Ugn=Object.freeze(Object.defineProperty({__proto__:null,AUDIO_ADAPTER_SHAPE:v3t,CAMERA_ADAPTER_SHAPE:b3t,DEBUG_ADAPTER_SHAPE:S3t,NAVIGATION_ADAPTER_SHAPE:y3t,NETWORKING_ADAPTER_SHAPE:g3t,PHYSICS_2D_ADAPTER_SHAPE:h3t,PHYSICS_ADAPTER_SHAPE:m3t,RENDER_DEBUG_ADAPTER_SHAPE:x3t,SYSTEM_ADAPTERS_SHAPE:uRe,SYSTEM_PROVIDER_SHAPES:w3t},Symbol.toStringTag,{value:"Module"})),oBe=new YAt;function Bwr(t){oBe.record(t)}const dht=new WeakMap;let $wr=1;function T3t(t){const n=dht.get(t);if(n)return n;const s=`system-${$wr++}`;return dht.set(t,s),s}function qwr(t){const n=t.epoch??T3t(t.adapter),s=`system.${t.slot}`,c={[t.slot]:t.adapter},d=t.slot==="physics"?GAt(t.adapter)?h3t:m3t:w3t[t.slot],m=[...vB({prefix:"system",value:c,shape:uRe,subject:t.subject,epoch:n}).filter(g=>g.seam===s),...vB({prefix:s,value:t.adapter,shape:d,subject:t.subject,epoch:n}),...oBe.receipts({subject:t.subject,epoch:n}),...t.receipts??[]];return Zme({seam:s,subject:t.subject,epoch:n,required:uRe[t.slot].required,receipts:m,shape:d})}let qS={},nQ=null,sBe=null;const Qme=new Set,ehe=new Set,fRe=new Set;let aBe=0;function dRe(){for(const t of fRe)t()}function the(t){if(t!==Iye())for(const n of Qme)n()}function rhe(t,n){const s=Oye();if(!(t===Nye()&&n.length===s.length&&n.every((c,d)=>c===s[d]))){aBe++;for(const c of ehe)c()}}const LS=new Map;let S_e=null,C3t=0;const pRe=new Set,cBe="";function E3t(t,n){const s=["physics","networking","navigation","audio","camera","debug","renderDebug"];for(const c of s){const d=t[c];if(!d)continue;const m=qwr({slot:c,adapter:d,subject:n||"game"});if(m.state==="failed")throw new Error(`system adapter refused: ${m.detail}`)}}function ZI(){return S_e!==null&&LS.has(S_e)?S_e:LS.keys().next().value??null}function nhe(){C3t++;for(const t of pRe)t()}function zwr(t){const n=ZI();if(S_e=t,n!==ZI()){nhe(),aBe++;for(const s of Qme)s();for(const s of ehe)s()}}function Jgn(){return ZI()}function Vwr(t){return pRe.add(t),()=>pRe.delete(t)}function Wgn(){return C3t}function Pye(){const t=ZI();return(t===null?void 0:LS.get(t))??qS}function Uwr(t,n=cBe){const s=ZI(),c=Iye(),d=Nye(),m=Oye();if(t){E3t(t,n),LS.set(n,t),qS=t,the(c),rhe(d,m),dRe(),s!==ZI()&&nhe();return}LS.delete(n),qS=LS.values().next().value??{},the(c),rhe(d,m),dRe(),s!==ZI()&&nhe()}function Jwr(){for(const t of[...LS.keys()])Uwr(null,t);zwr(null)}function Hgn(t,n=cBe){const s=Iye(),c=Nye(),d=Oye(),m=LS.get(n);E3t(t,n),LS.set(n,t),qS===m&&(qS=t),the(s),rhe(c,d),dRe(),ZI()===n&&nhe()}function Ggn(){return qS}function Wwr(t){return fRe.add(t),()=>fRe.delete(t)}function Hwr(){return[...LS.keys()]}function pht(t){const n=t.filter(d=>d!==cBe),s=t.length>n.length,c=n.map(d=>`"${d}"`);return s&&c.push("the unnamed default (address it with no id at all)"),c.join(", ")}class _ht extends Error{instances;constructor(n,s){super(n),this.name="InstanceResolutionError",this.instances=s}}function Gwr(t){const n=Hwr();if(t!==void 0){const s=LS.get(t);if(s)return s;throw new _ht(n.length===0?`no instance "${t}" — no game is mounted`:`no instance "${t}" — live: ${pht(n)}`,n)}if(n.length===1)return LS.get(n[0]);if(n.length===0)return qS;throw new _ht(`${n.length} instances are live (${pht(n)}) — name one in your program (\`game.instance(id)\`, or \`await game.instances()\` for handles); refusing to guess`,n)}function Kgn(){return HAt(qS.physics)}function Kwr(){return qS.camera??null}function Iye(){return qS.networking??sBe??null}function Xwr(){return Pye().networking??sBe??null}function Ywr(t){return Qme.add(t),()=>Qme.delete(t)}function Xgn(t){const n=Iye();sBe=t,the(n)}function Ygn(){return qS.debug??null}function Zgn(t){const n=Nye(),s=Oye();nQ=t,rhe(n,s)}function Nye(){return qS.audio??nQ}function Zwr(){return Pye().audio??nQ}function Qwr(t){return ehe.add(t),()=>ehe.delete(t)}function eTr(){return aBe}function Oye(){const t=new Set;for(const n of LS.values())n.audio&&t.add(n.audio);return t.size===0&&nQ&&t.add(nQ),[...t]}function tTr(){return qS.renderDebug??null}function Qgn(){return Pye().renderDebug??null}let k3t=null;const _Re=new Set;function eyn(t){k3t=t;for(const n of _Re)n()}function Rye(){return k3t?.()??null}function Fye(t){_Re.add(t);const n=Vwr(t);return()=>{_Re.delete(t),n()}}function lN(){const t=Rye();return t?`play:${t.instanceId}`:"stopped"}function Mye(t,n){let s=!1,c=[];const d=()=>{s=!1;const g=c;c=[];for(let S=g.length-1;S>=0;S--)g[S]()};return{ensure(g){if(!s){s=!0;try{g(S=>c.push(S))}catch(S){throw d(),S}}},reset:d}}let xO=[],rTr=0,A3t=0;const mRe=new Set;function mht(){A3t++;for(const t of mRe)t()}function D3t(t){return mRe.add(t),()=>{mRe.delete(t)}}function hht(){return A3t}function Z4(t){if(xO.some(s=>s.contribution.id===t.id))throw new Error(`registerWorkspaceStatus: id "${t.id}" is already registered — status ids key status-bar slots, so they must be unique; unregister the previous contribution first.`);const n={contribution:t,seq:rTr++};return xO=[...xO,n],mht(),()=>{xO.includes(n)&&(xO=xO.filter(s=>s!==n),mht())}}function hRe(t){const n=s=>[...xO].filter(c=>(c.contribution.align??"left")===s).sort((c,d)=>(c.contribution.order??0)-(d.contribution.order??0)||c.seq-d.seq).map(c=>c.contribution);return t?n(t):[...n("left"),...n("right")]}let x_e=null,P3t=0;const gRe=new Set;function ght(){P3t++;for(const t of gRe)t()}function I3t(t){return gRe.add(t),()=>gRe.delete(t)}function yRe(){return P3t}function lBe(){return x_e}function nTr(t){const n=Symbol(t.documentId);return x_e={...t,token:n},ght(),()=>{x_e?.token===n&&(x_e=null,ght())}}function iTr(){Ye.useSyncExternalStore(I3t,yRe);const t=lBe();return t?.status?q.jsx("span",{className:"volter-status-copy","data-testid":"status-asset-editor","data-status-tone":"muted",children:t.status}):null}const oTr=Mye();function sTr(){oTr.ensure(t=>{t(Z4({id:"asset-editor-status",name:"Asset editor",align:"left",order:40,Content:iTr}))})}sTr();let bB=null,N3t=0;const vRe=new Set;function yht(){N3t+=1;for(const t of vRe)t()}function aTr(t){return vRe.add(t),()=>{vRe.delete(t)}}function vht(){return N3t}function cTr(t,n){const s=Symbol(t);return bB={documentId:t,readSubject:n,token:s},yht(),()=>{bB?.token===s&&(bB=null,yht())}}function bRe(){return bB===null?null:{documentId:bB.documentId,subject:bB.readSubject()}}const uN=new Map,SRe=new Map;function O3t(){typeof window>"u"||window.parent===window||uN.size===0||window.parent.postMessage({type:"volter:viewport-ready",documents:[...uN.keys()]},"*")}typeof window<"u"&&window.parent!==window&&window.addEventListener("message",t=>{t.source===window.parent&&t.data?.type==="volter:request-viewport-ready"&&O3t()});let Nc=null,uBe=null;function fBe(){if(typeof window>"u")return!1;const t=window.__VOLTER_VIEWPORT_TIMINGS__;if(t===!0||t==="1")return!0;try{return new URLSearchParams(window.location.search).get("volterTimings")==="1"}catch{return!1}}function R3t(t,n,s){return{documentId:t,visibilityState:typeof document>"u"?"unavailable":document.visibilityState,startedAtMs:n,reactActiveAtMs:null,boardBuildStartedAtMs:null,boardReadyAtMs:null,constructStartedAtMs:null,viewportReadyAtMs:null,rafResumeAtMs:null,firstRenderStartedAtMs:null,workspaceSyncMs:0,revealScheduleMs:0,componentIndexMs:0,componentIndexBusyMs:0,componentIndexWaitMs:0,candidateCollectMs:0,storyMountTotalMs:0,boundsMs:0,layoutMs:0,assembleMs:0,webglContextMs:0,rendererMs:0,adapterSetupMs:0,iblBakeMs:0,dressingMs:0,editorViewportMs:0,framingMs:0,resizeBindMs:0,viewportBindMs:0,firstRenderMs:0,candidateCount:0,exhibitCount:0,skippedCount:0,modulesAlreadyLoaded:s.modulesAlreadyLoaded===!0,stories:[]}}function lTr(t){let n=0,s=0;for(const c of t)n+=Math.max(0,c.runtimeMs)+Math.max(0,c.fiberMs),s+=Math.max(0,c.loadMs)+Math.max(0,c.settleMs);return{busyMs:n,waitMs:s}}function uTr(t,n){const s=t.reactActiveAtMs===null?0:Math.max(0,t.reactActiveAtMs-t.startedAtMs),c=t.reactActiveAtMs??t.startedAtMs,d=t.boardBuildStartedAtMs,m=d===null?0:Math.max(0,d-c),g=t.boardReadyAtMs===null||t.constructStartedAtMs===null?0:Math.max(0,t.constructStartedAtMs-t.boardReadyAtMs),S=t.viewportReadyAtMs??t.rafResumeAtMs,k=t.firstRenderStartedAtMs??n,A=S===null?0:Math.max(0,k-S),F=S===null?Math.max(0,n-t.startedAtMs):Math.max(0,n-S),D=lTr(t.stories),J=t.boardBuildStartedAtMs===null?"switch-back":"first-open",G=fTr({workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,componentIndexBusyMs:t.componentIndexBusyMs,componentIndexWaitMs:t.componentIndexWaitMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs}).reduce((pe,ue)=>pe+ue.ms,0),se=Math.max(0,n-t.startedAtMs);return{visibilityState:t.visibilityState,startedAtMs:t.startedAtMs,reactActiveAtMs:t.reactActiveAtMs,boardBuildStartedAtMs:t.boardBuildStartedAtMs,boardReadyAtMs:t.boardReadyAtMs,constructStartedAtMs:t.constructStartedAtMs,viewportReadyAtMs:t.viewportReadyAtMs,rafResumeAtMs:t.rafResumeAtMs,firstRenderStartedAtMs:t.firstRenderStartedAtMs,firstFrameAtMs:n,activationKind:J,workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs,firstPaintMs:F,unattributedMs:Math.max(0,se-G),accountedMs:G,candidateCount:t.candidateCount,exhibitCount:t.exhibitCount,skippedCount:t.skippedCount,modulesAlreadyLoaded:t.modulesAlreadyLoaded,stories:t.stories,storyDiscovery:uBe}}function Yb(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:s,waitMs:0,kind:"cpu"}}function Tpe(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:0,waitMs:s,kind:"idle"}}function bht(t,n,s,c){const d=Math.max(0,n);let m=Math.max(0,s),g=Math.max(0,c);if(m+g>d){const S=d/(m+g);m*=S,g*=S}else m+g<d&&(g+=d-m-g);return{name:t,ms:d,busyMs:m,waitMs:g,kind:"mixed"}}function fTr(t){return[Tpe("workspace-sync",t.workspaceSyncMs),Tpe("reveal-schedule",t.revealScheduleMs),bht("component-index",t.componentIndexMs,t.componentIndexBusyMs,t.componentIndexWaitMs>0||t.componentIndexMs===0?t.componentIndexWaitMs:t.componentIndexMs),Yb("candidate-collect",t.candidateCollectMs),bht("story-mounts",t.storyMountTotalMs,t.storyMountBusyMs,t.storyMountWaitMs),Yb("bounds",t.boundsMs),Yb("layout",t.layoutMs),Yb("assemble",t.assembleMs),Tpe("react-commit (board→viewport)",t.reactCommitMs),Yb("webgl-context",t.webglContextMs),Yb("renderer",t.rendererMs),Yb("adapter-setup",t.adapterSetupMs),Yb("ibl-bake (three PMREM)",t.iblBakeMs),Yb("dressing",t.dressingMs),Yb("editor-viewport",t.editorViewportMs),Yb("framing",t.framingMs),Yb("resize-bind",t.resizeBindMs),Yb("viewport-bind",t.viewportBindMs),Tpe("raf-wait",t.rafWaitMs),Yb("first-render",t.firstRenderMs)]}function tyn(t,n=Date.now()){const s=(SRe.get(t)??0)+1;SRe.set(t,s);const c={documentId:t,activation:s,firstFrameAtMs:n},d=Nc;if(d&&d.documentId===t){const m={...c,breakdown:uTr(d,n)};return Nc=null,uN.set(t,m),xht(),Sht(),m}return uN.set(t,c),xht(),Sht(),c}let xRe=new Set;const wRe=new Set;function Sht(){O3t();for(const t of wRe)t()}function dTr(t){return wRe.add(t),()=>wRe.delete(t)}function xht(){uN.size!==0&&F3t()}function F3t(){const t=xRe;xRe=new Set;for(const n of t)n()}let wht=!1;function pTr(){wht||typeof document>"u"||(wht=!0,document.addEventListener("visibilitychange",()=>{document.hidden&&F3t()}))}function jye(){return uN.size>0||typeof document<"u"&&document.hidden?Promise.resolve():(pTr(),new Promise(t=>xRe.add(t)))}function _Tr(){return[...uN.values()]}function mTr(t){fBe()&&(Nc=R3t(t,Date.now(),{}))}function ryn(t,n={}){if(!fBe())return;const s=Date.now();if(Nc&&Nc.documentId===t){Nc.boardBuildStartedAtMs===null&&(Nc.boardBuildStartedAtMs=s),n.modulesAlreadyLoaded===!0&&(Nc.modulesAlreadyLoaded=!0);return}Nc=R3t(t,s,n),Nc.boardBuildStartedAtMs=s}function nyn(t){Nc&&(t&&Nc.documentId!==t||(Nc=null))}function iyn(t,n,s){if(!Nc)return;const c=Math.max(0,n);switch(t){case"component-index":Nc.componentIndexMs=c,Nc.componentIndexBusyMs=Math.max(0,s?.busyMs??0),Nc.componentIndexWaitMs=Math.max(0,s?.waitMs??c);break;case"candidate-collect":Nc.candidateCollectMs=c;break;case"story-mounts":Nc.storyMountTotalMs=c;break;case"bounds":Nc.boundsMs=c;break;case"layout":Nc.layoutMs=c;break;case"assemble":Nc.assembleMs=c;break;case"webgl-context":Nc.webglContextMs=c;break;case"renderer":Nc.rendererMs=c;break;case"adapter-setup":Nc.adapterSetupMs=c;break;case"ibl-bake":Nc.iblBakeMs=c;break;case"dressing":Nc.dressingMs=c;break;case"editor-viewport":Nc.editorViewportMs=c;break;case"framing":Nc.framingMs=c;break;case"resize-bind":Nc.resizeBindMs=c;break;case"viewport-bind":Nc.viewportBindMs=c;break;case"first-render":Nc.firstRenderMs=c;break}}function oyn(t){!Nc||Nc.documentId!==t||Nc.reactActiveAtMs===null&&(Nc.reactActiveAtMs=Date.now())}function syn(t){!Nc||Nc.documentId!==t||Nc.rafResumeAtMs===null&&(Nc.rafResumeAtMs=Date.now())}function ayn(t){!Nc||Nc.documentId!==t||Nc.firstRenderStartedAtMs===null&&(Nc.firstRenderStartedAtMs=Date.now())}function cyn(t){Nc&&(t.candidateCount!==void 0&&(Nc.candidateCount=t.candidateCount),t.exhibitCount!==void 0&&(Nc.exhibitCount=t.exhibitCount),t.skippedCount!==void 0&&(Nc.skippedCount=t.skippedCount))}function lyn(){Nc&&(Nc.boardReadyAtMs=Date.now())}function uyn(){Nc&&(Nc.constructStartedAtMs=Date.now())}function fyn(){Nc&&(Nc.viewportReadyAtMs=Date.now())}function dyn(t){Nc&&Nc.stories.push(t)}function pyn(){return Nc?.documentId??null}function hTr(t){fBe()&&(uBe=t)}function gTr(){uN.clear(),SRe.clear(),Nc=null,uBe=null}const yTr=["scene","game","world","story","asset","behavior","generation","content-browser","project-tool","tool-contribution","document"];let hp=[],zk=null,i2=null,iQ=null,uR=null;function Tht(t){queueMicrotask(()=>{uR===t&&hp.some(n=>n.descriptor.id===t)&&(uR=null,X0(t))})}let M3t=0;const TRe=new Set,A5e=new Set,dBe=new Map,XO=new Map;function wC(){M3t++;for(const t of TRe)t()}function o2(t){return TRe.add(t),()=>{TRe.delete(t)}}function K1(){return M3t}function l0(){return hp}function Pp(){return i2}function CRe(){return iQ}function vTr(t,n){X0(t)&&iQ!==n&&(iQ=n,wC())}function TC(){return hp.find(t=>t.descriptor.id===i2)??null}function oQ(t){if(t===i2)return;t&&mTr(t);const n=hp.find(c=>c.descriptor.id===i2);i2=t,iQ=null,n?.descriptor.onDeactivate?.(n.descriptor.id);const s=hp.find(c=>c.descriptor.id===t);s?.descriptor.onActivate?.(s.descriptor.id)}function bTr(t,n,s,c){if(n){!s&&c&&zk===t&&(zk=null);return}s&&(zk&&EN(zk),zk=t)}function ND(t,n={}){const s=uR===t.id,c=s||n.activate!==!1,d=hp.find(g=>g.descriptor.id===t.id);if(bTr(t.id,!!d,n.preview===!0,c),!d)return hp=[...hp,{descriptor:t,dirty:!1,title:t.title}],!t.area&&(c||i2===null)&&oQ(t.id),s&&Tht(t.id),wC(),t.id;let m=!1;return(d.descriptor.Toolbar!==t.Toolbar||d.descriptor.Shelf!==t.Shelf||d.descriptor.Content!==t.Content)&&(hp=hp.map(g=>{if(g!==d)return g;const{Toolbar:S,Shelf:k,...A}=g.descriptor;return{...g,descriptor:{...A,Content:t.Content,...t.Toolbar?{Toolbar:t.Toolbar}:{},...t.Shelf?{Shelf:t.Shelf}:{}}}}),m=!0),c&&i2!==t.id&&(oQ(t.id),m=!0),m&&wC(),s&&Tht(t.id),t.id}function X0(t){return hp.some(n=>n.descriptor.id===t)?(i2!==t&&(oQ(t),wC()),!0):!1}function j3t(){uR=null}function STr(t){if(X0(t)){uR=null;return}uR=t}function EN(t,n={}){if(A5e.has(t))return!1;const s=hp.findIndex(d=>d.descriptor.id===t);if(s<0)return!1;const c=hp[s];if(c.dirty&&!n.discardDirty)return!1;A5e.add(t);try{if(i2===t){const m=s>0?hp[s-1]:hp[s+1]??null;oQ(m?m.descriptor.id:null)}return hp=hp.filter(m=>m.descriptor.id!==t),zk===t&&(zk=null),dBe.delete(t),XO.delete(t),c.descriptor.onDispose?.(t),wC(),!0}finally{A5e.delete(t)}}function L3t(){if(hp.length===0&&i2===null)return;const t=hp;oQ(null),hp=[],iQ=null,zk=null,dBe.clear(),XO.clear(),uR=null;for(const n of t)n.descriptor.onDispose?.(n.descriptor.id);wC()}function xTr(t,n){return hp.some(s=>s.descriptor.id===t)?(XO.set(t,n),wC(),()=>{XO.get(t)===n&&(XO.delete(t),wC())}):()=>{}}function _yn(t){XO.has(t)&&wC()}async function wTr(t){if(!hp.some(s=>s.descriptor.id===t))return null;const n=dBe.get(t);if(!n)return null;try{return await n()}catch{return!1}}function TTr(){return i2?wTr(i2):Promise.resolve(null)}function myn(t,n){n&&zk===t&&(zk=null);const s=hp.findIndex(d=>d.descriptor.id===t);s<0||hp[s].dirty===n||(hp=hp.map(d=>d.descriptor.id===t?{...d,dirty:n}:d),wC())}function B3t(t,n){const s=hp.find(c=>c.descriptor.id===t);!s||s.title===n||(hp=hp.map(c=>c.descriptor.id===t?{...c,title:n}:c),wC())}function pBe(t){const n=hp.find(c=>c.descriptor.id===t),s=XO.get(t)??n?.descriptor.selection;if(!s)return null;try{return s()}catch{return null}}function Lye(){return i2?pBe(i2):null}const CTr={adapter:null,nodeId:null};function ETr(t){return JSON.stringify({id:t.id,title:t.title,hint:t.hint,kindLabel:t.kindLabel,note:t.note,sections:t.sections.map(n=>({id:n.id,title:n.title,order:n.order,description:n.description,defaultOpen:n.defaultOpen,testId:n.testId,keepMounted:n.keepMounted,railGroup:n.railGroup,bodyKind:n.body.kind})),quickActions:t.quickActions?.map(n=>({id:n.id,title:n.title,label:n.label,placement:n.placement,pressed:n.pressed,disabled:n.disabled}))})}function _Be({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,selection:g}){Ye.useEffect(()=>{if(n)return nTr({documentId:t,title:c,type:s,...m?{status:m}:{}})},[n,t,m,c,s]);const S=Ye.useRef(g);S.current=g,Ye.useEffect(()=>{if(n)return xTr(t,()=>S.current?.()??CTr)},[n,t]);const k={id:t,title:c,kindLabel:s,...m?{note:{text:m,testId:"asset-editor-status"}}:{},sections:d??[]},A=Ye.useRef(k);A.current=k;const F=ETr(k);return Ye.useEffect(()=>{if(n)return cTr(t,()=>A.current)},[n,t,F]),null}function kTr({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,fill:g=!1,selection:S,children:k}){return q.jsxs("section",{className:"volter-asset-editor","data-testid":`asset-editor:${s}`,"aria-label":`${c} Asset Editor`,children:[q.jsx(_Be,{documentId:t,active:n,type:s,title:c,sections:d,status:m,selection:S}),q.jsx("main",{className:`volter-asset-editor__viewport${g?" volter-asset-editor__viewport--fill":""}`,children:k})]})}const ATr=Object.freeze(Object.defineProperty({__proto__:null,AssetEditorShell:kTr,AssetEditorSubject:_Be},Symbol.toStringTag,{value:"Module"})),w_e=new Map,ERe=new Set;function Cht(){for(const t of ERe)t()}function hyn(t){const n=Object.entries(t);for(const[s,c]of n)w_e.set(s,c);return Cht(),()=>{for(const[s,c]of n)w_e.get(s)===c&&w_e.delete(s);Cht()}}function DTr(t){return w_e.get(t)??null}function PTr(t){return ERe.add(t),()=>{ERe.delete(t)}}function ITr(t){return q.jsx(_Be,{...t})}const Eht=new Map;function NTr(t){const n=Eht.get(t);if(n)return n;function s(c){const d=Ye.useCallback(()=>DTr(t),[]),m=Ye.useSyncExternalStore(PTr,d,d);return m?q.jsx(m,{...c}):q.jsxs("div",{style:{minHeight:240},children:["Loading ",t,"…"]})}return s.displayName=`ContributionSurface(${t})`,Eht.set(t,s),s}const mBe=new Proxy(Object.freeze({AssetDocument:ITr}),{get(t,n,s){return typeof n!="string"||Reflect.has(t,n)||!/^[A-Z]/.test(n)?Reflect.get(t,n,s):NTr(n)}}),kht=Object.freeze({id:"classic",shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.6)",medium:"0 4px 12px rgba(0,0,0,0.5)",large:"0 8px 32px rgba(0,0,0,0.6)"}}),Ym=Object.freeze({id:"glass",color:{surface:{shell:"#12161f",panel:"rgba(255,255,255,0.06)",chrome:"rgba(255,255,255,0.10)",raised:"rgba(255,255,255,0.16)",inset:"rgba(10,14,22,0.38)",overlay:"rgba(255,255,255,0.08)"},boundary:{default:"rgba(255,255,255,0.22)",strong:"rgba(255,255,255,0.38)"},neutralOverlay:{hover:"color-mix(in srgb, currentColor 10%, transparent)",active:"color-mix(in srgb, currentColor 16%, transparent)"},scrim:"rgba(8,12,20,0.35)"},shape:{small:"4px",medium:"8px",large:"14px",full:"9999px"},elevation:{small:"0 4px 14px -6px rgba(0,0,0,0.45)",medium:"0 8px 24px -10px rgba(0,0,0,0.5)",large:"0 20px 46px -16px rgba(0,0,0,0.55), 0 4px 14px -6px rgba(0,0,0,0.35)"},treatment:{backdropBlurPx:1,backdropSaturation:1.15,edgeSpecular:.7,specularAngleDeg:120,refractionBezelPx:56,refractionThickness:1.25,textShadowOpacity:.72,contentFrostBlurPx:24,ambientLiftOpacity:.07,adaptiveContent:!0,brightTextShadowOpacity:0,brightFrostBg:"rgba(255,255,255,0.3)"},reducedTransparency:{surface:{shell:"#12161f",panel:"#33373e",chrome:"#3d4047",raised:"#4b4e55",inset:"#23272f",overlay:"#383b43"},scrim:"rgba(8,12,20,0.5)"}}),OTr=["classic","glass"],RTr=Object.freeze([{id:"classic",title:"Classic",description:"Opaque editor surfaces with conventional bars and panels."},{id:"glass",title:"Glass",description:"Adaptive clear material with refraction, frost, and floating chrome."}]),SB=new Map;let ihe=null;const ohe=new Set;function FTr(){return ihe??=[...RTr,...[...SB.values()].map(({id:t,title:n,description:s})=>({id:t,title:n,description:s}))],ihe}function MTr(t){return ohe.add(t),()=>ohe.delete(t)}function jTr(t){if(Bye(t.id))throw new Error(`registerContributedMaterial: material "${t.id}" is already registered.`);SB.set(t.id,t),ihe=null;for(const n of ohe)n();return()=>{if(SB.get(t.id)===t){SB.delete(t.id),ihe=null;for(const n of ohe)n()}}}function Bye(t){return typeof t=="string"&&(OTr.includes(t)||SB.has(t))}function LTr(t,n,s=!1){if(n!=="glass"){const d=SB.get(n);return{id:d?`${t.id}--${d.id}`:t.id,color:t.color,typography:t.typography,shape:d?.shape??kht.shape,elevation:d?.elevation??kht.elevation,...d?.density?{density:d.density}:{},...d?.stage?{stage:d.stage}:{},appearance:{material:"classic",transparency:"standard"}}}return{id:`${t.id}--${s?"glass-reduced":"glass"}`,color:{surface:s?Ym.reducedTransparency.surface:Ym.color.surface,boundary:Ym.color.boundary,content:t.color.content,accent:t.color.accent,semantic:t.color.semantic,neutralOverlay:Ym.color.neutralOverlay,scrim:s?Ym.reducedTransparency.scrim:Ym.color.scrim},typography:t.typography,shape:Ym.shape,elevation:Ym.elevation,appearance:{material:"glass",transparency:s?"reduced":"standard"},...s?{}:{treatment:Ym.treatment}}}const BTr={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},$Tr={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly"};function Cpe(t){return t===0?"0px":t===void 0?void 0:`var(--volter-space-${t})`}function $3t({gap:t,align:n,justify:s,padding:c,paddingX:d,paddingY:m,style:g}){return{gap:Cpe(t),alignItems:n?BTr[n]:void 0,justifyContent:s?$Tr[s]:void 0,padding:Cpe(c),paddingInline:Cpe(d),paddingBlock:Cpe(m),...g}}function hee(t,n){return n?`${t} ${n}`:t}function q3t({className:t,...n}){return q.jsx("div",{...n,className:hee("volter-stack",t),style:$3t(n)})}function bZ({className:t,...n}){return q.jsx("div",{...n,className:hee("volter-inline",t),style:$3t(n)})}function gyn({className:t,...n}){return q.jsx("span",{...n,"aria-hidden":"true",className:hee("volter-spacer",t)})}function qTr({orientation:t="horizontal",className:n,...s}){return q.jsx("div",{...s,"aria-hidden":"true","data-orientation":t,className:hee("volter-divider",n)})}function zTr({children:t,className:n,...s}){return q.jsx(bZ,{...s,className:hee("volter-actions",n),gap:2,align:"center",children:t})}function z3t(t,n){return n?`${t} ${n}`:t}const _p=Ye.forwardRef(function({as:n="span",variant:s="body",tone:c="primary",truncate:d=!1,selectable:m=!1,className:g,...S},k){const A=n;return q.jsx(A,{...S,ref:k,"data-variant":s,"data-tone":c,"data-truncate":d||void 0,"data-selectable":m||void 0,className:z3t("volter-text",g)})});function yyn({className:t,...n}){return q.jsx("kbd",{...n,className:z3t("volter-keycap",t)})}function B$(t,n){return n?`${t} ${n}`:t}function kRe({labelledBy:t,onDismiss:n,size:s="default",variant:c="default",className:d,...m}){const[g]=Ye.useState(()=>typeof document>"u"?null:document.querySelector(".volter-editor-theme")),S=Ye.useId(),k=q.jsx("div",{"data-volter-portal-content":g?S:void 0,className:"volter-dialog-scrim","data-variant":c,onPointerDown:A=>{A.target===A.currentTarget&&n?.()},children:q.jsx("div",{...m,role:"dialog","aria-modal":"true","aria-labelledby":t,"data-size":s,"data-variant":c,className:B$("volter-dialog",d)})});return g?q.jsxs(q.Fragment,{children:[q.jsx("span",{"data-volter-portal":S,style:{display:"none"}}),r2.createPortal(k,g)]}):k}function ARe({titleId:t,title:n,description:s}){return q.jsxs(q3t,{className:"volter-dialog-header",gap:2,children:[q.jsx(_p,{id:t,as:"h2",variant:"heading",children:n}),s&&q.jsx(_p,{as:"p",tone:"muted",children:s})]})}function V3t({className:t,...n}){return q.jsx(q3t,{...n,className:B$("volter-dialog-body",t)})}function DRe({children:t,className:n,...s}){return q.jsx(zTr,{...s,className:B$("volter-dialog-footer",n),children:t})}function vyn({className:t,...n}){return q.jsx("label",{...n,className:B$("volter-dialog-field",t)})}function byn({children:t}){return q.jsx(_p,{variant:"label",tone:"muted",children:t})}function Syn({className:t,...n}){return q.jsx(bZ,{...n,className:B$("volter-joined-field",t)})}function xyn({className:t,...n}){return q.jsx("span",{...n,className:B$("volter-joined-field-suffix",t)})}function hBe(t,n){return n?`${t} ${n}`:t}function VTr({className:t,...n}){return q.jsx("div",{...n,className:hBe("volter-field-group",t)})}function T_e({label:t,htmlFor:n,hint:s,compact:c=!1,className:d,children:m,...g}){return q.jsxs("div",{...g,"data-compact":c||void 0,className:hBe("volter-field-row",d),children:[q.jsx("label",{htmlFor:n,className:"volter-field-label",children:t}),q.jsx("div",{className:"volter-field-control",children:m}),s&&q.jsx("div",{className:"volter-field-hint",children:s})]})}function wyn({className:t,...n}){return q.jsx("label",{...n,className:hBe("volter-field-label",t)})}const Tyn=Ye.forwardRef(function({selected:n=!1,accent:s="bar",className:c,type:d="button",...m},g){return q.jsx("button",{...m,ref:g,type:d,"data-selected":n||void 0,"data-accent":s,className:c?`volter-list-button ${c}`:"volter-list-button"})});function UTr({tone:t="neutral",icon:n,title:s,description:c,action:d,compact:m=!1,className:g,...S}){const k=t==="error"?"alert":t==="loading"||t==="success"?"status":void 0;return q.jsxs("div",{...S,role:S.role??k,"data-tone":t,"data-compact":m||void 0,className:g?`volter-state-surface ${g}`:"volter-state-surface",children:[n&&q.jsx("div",{className:"volter-state-surface-icon",children:n}),q.jsx("strong",{className:"volter-state-surface-title",children:s}),c&&q.jsx("div",{className:"volter-state-surface-description",children:c}),d&&q.jsx("div",{className:"volter-state-surface-action",children:d})]})}function $$(t,n){return n?`${t} ${n}`:t}function JTr({variant:t="panel",border:n=!1,scroll:s=!1,className:c,...d}){return q.jsx("div",{...d,"data-variant":t,"data-border":n||void 0,"data-scroll":s||void 0,className:$$("volter-surface",c)})}function Cyn({tone:t="info",icon:n,actions:s,className:c,children:d,...m}){return q.jsxs("div",{...m,role:t==="error"?"alert":"status","data-tone":t,className:$$("volter-banner",c),children:[n&&q.jsx("span",{className:"volter-banner-icon",children:n}),q.jsx("div",{className:"volter-banner-content",children:d}),s&&q.jsx("div",{className:"volter-banner-actions",children:s})]})}const Eyn=Ye.forwardRef(function({className:n,...s},c){return q.jsx("div",{ref:c,...s,className:$$("volter-popover",n)})});function kyn({shape:t="label",className:n,...s}){return q.jsx("span",{...s,"data-shape":t,className:$$("volter-badge",n)})}function Aht({position:t="inside",className:n,...s}){return q.jsx("div",{...s,"aria-hidden":"true","data-position":t,className:$$("volter-drop-indicator",n)})}function Ayn({orientation:t,label:n,valueNow:s,valueMin:c=0,valueMax:d=100,className:m,...g}){return q.jsx("div",{...g,role:"separator","aria-label":n,"aria-orientation":t,"aria-valuenow":s,"aria-valuemin":s===void 0?void 0:c,"aria-valuemax":s===void 0?void 0:d,"data-orientation":t,className:$$("volter-resize-handle",m)})}function U3t(t,n){return n?`${t} ${n}`:t}const Dyn=Ye.forwardRef(function({className:n,onKeyDown:s,...c},d){return q.jsx("div",{...c,ref:d,role:"tablist",className:U3t("volter-tabs",n),onKeyDown:m=>{if(s?.(m),m.defaultPrevented||!["ArrowLeft","ArrowRight","Home","End"].includes(m.key))return;const g=Array.from(m.currentTarget.querySelectorAll('[role="tab"]:not(:disabled)'));if(g.length===0)return;m.preventDefault();const S=g.indexOf(document.activeElement);(m.key==="Home"?g[0]:m.key==="End"?g.at(-1):m.key==="ArrowRight"?g[(S+1+g.length)%g.length]:g[(S-1+g.length)%g.length])?.focus()}})}),Pyn=Ye.forwardRef(function({selected:n=!1,dirty:s=!1,badge:c,className:d,type:m="button",tabIndex:g,children:S,...k},A){return q.jsxs("button",{...k,ref:A,type:m,role:"tab",tabIndex:g??(n?0:-1),"aria-selected":n,"data-selected":n||void 0,className:U3t("volter-tab",d),children:[s&&q.jsxs(q.Fragment,{children:[q.jsx("span",{className:"volter-tab-dirty",title:"Unsaved","aria-hidden":"true"}),q.jsx("span",{className:"volter-sr-only",children:"Unsaved"})]}),q.jsx("span",{className:"volter-tab-label",children:S}),c!==void 0&&q.jsx("span",{className:"volter-tab-badge",children:c})]})});function gee(t,n){return n?`${t} ${n}`:t}const n$=Ye.forwardRef(function({label:n,compact:s=!1,selectionMode:c="independent",className:d,...m},g){return q.jsx("div",{...m,ref:g,role:"toolbar","aria-label":n,"data-compact":s||void 0,"data-selection-mode":c,className:gee("volter-toolbar",d)})});function Dht({className:t,...n}){return q.jsx("div",{...n,role:"group",className:gee("volter-toolbar-group",t)})}function Pht(t){return q.jsx("span",{...t,"aria-hidden":"true",className:gee("volter-toolbar-divider",t.className)})}function Iyn({className:t,onPointerDownCapture:n,...s}){return q.jsx(n$,{...s,compact:!0,className:gee("volter-floating-toolbar volter-glass-island",t),onPointerDownCapture:c=>{n?.(c),c.stopPropagation()}})}function Nyn({className:t,...n}){return q.jsx("div",{...n,role:"group",className:gee("volter-split-button",t)})}function J3t(t,n){return n?`${t} ${n}`:t}const Oyn=Ye.forwardRef(function({label:n,className:s,...c},d){return q.jsx("div",{...c,ref:d,role:"tree","aria-label":n,className:J3t("volter-tree",s)})}),Ryn=Ye.forwardRef(function({level:n=1,selected:s=!1,expanded:c,muted:d=!1,dragging:m=!1,leading:g,actions:S,className:k,children:A,style:F,...D},J){return q.jsxs("div",{...D,ref:J,role:"treeitem",tabIndex:D.tabIndex??-1,"aria-level":n,"aria-selected":s,...c===void 0?{}:{"aria-expanded":c},"data-selected":s||void 0,"data-muted":d||void 0,"data-dragging":m||void 0,className:J3t("volter-tree-row",k),style:{paddingLeft:6+Math.max(0,n-1)*14,...F},children:[g&&q.jsx("span",{className:"volter-tree-row-leading",children:g}),q.jsx("span",{className:"volter-tree-row-label",children:A}),S&&q.jsx("span",{className:"volter-tree-row-actions",children:S})]})});function W3t(t,n=8){const s=window.innerWidth,c=window.innerHeight,d=Math.max(n,s-t.width-n),m=Math.max(n,c-t.height-n);return{left:Math.min(Math.max(t.left,n),d),top:Math.min(Math.max(t.top,n),m)}}function $ye(t,n){return n?`${t} ${n}`:t}function PRe(t){return Array.from(t.querySelectorAll('[role="menuitem"]:not(:disabled), [role="menuitemradio"]:not(:disabled), [role="menuitemcheckbox"]:not(:disabled)'))}function WTr(t){PRe(t)[0]?.focus()}function Iht(t,n){if(!t)return!1;let s=n;for(;s;){if(t.contains(s))return!0;const d=((s instanceof Element?s:s.parentElement)?.closest("[data-volter-portal-content]")??null)?.getAttribute("data-volter-portal-content");if(!d)return!1;s=document.querySelector(`[data-volter-portal="${CSS.escape(d)}"]`)}return!1}const fN=Ye.forwardRef(function({className:n,role:s="menu",autoFocusFirst:c=!1,dismissBoundaryRef:d,onDismiss:m,onKeyDown:g,...S},k){const A=Ye.useRef(null);return Ye.useImperativeHandle(k,()=>A.current),Ye.useEffect(()=>{c&&PRe(A.current)[0]?.focus()},[c]),Ye.useEffect(()=>{if(!m)return;const F=D=>{const J=D.target;!Iht(A.current,J)&&!Iht(d?.current??null,J)&&m("outside")};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,m]),q.jsx("div",{...S,ref:A,role:s,className:$ye("volter-menu",n),onKeyDown:F=>{if(g?.(F),F.defaultPrevented)return;if(F.key==="Escape"){F.preventDefault(),m?.("escape");return}if(!["ArrowDown","ArrowUp","Home","End"].includes(F.key))return;F.preventDefault();const D=PRe(F.currentTarget);if(D.length===0)return;const J=D.indexOf(document.activeElement);F.key==="Home"?D[0]?.focus():F.key==="End"?D.at(-1)?.focus():F.key==="ArrowDown"?D[(J+1+D.length)%D.length]?.focus():D[(J-1+D.length)%D.length]?.focus()}})}),Jc=Ye.forwardRef(function({className:n,type:s="button",role:c="menuitem",onClick:d,onSelect:m,...g},S){return q.jsx("button",{...g,ref:S,type:s,role:c,className:$ye("volter-menu-item",n),onClick:k=>{d?.(k),k.defaultPrevented||m?.()}})});function t2(t){return q.jsx("hr",{...t,className:$ye("volter-menu-separator",t.className)})}const gBe=Ye.forwardRef(function({className:n,type:s="button",...c},d){return q.jsx("button",{...c,ref:d,type:s,"aria-haspopup":c["aria-haspopup"]??"menu",className:$ye("volter-menu-trigger",n)})});function she({children:t}){const n=Ye.useRef(null),[s,c]=Ye.useState(null),d=Ye.useId();return Ye.useLayoutEffect(()=>{c(n.current?.closest(".volter-editor-theme")??null)},[]),q.jsxs(q.Fragment,{children:[q.jsx("span",{ref:n,"data-volter-portal":d,style:{display:"none"}}),s?r2.createPortal(q.jsx("div",{"data-volter-portal-content":d,style:{display:"contents"},children:t}),s):null]})}function yBe({anchorRef:t,align:n="end",side:s="bottom",autoFocusFirst:c=!0,gap:d=4,clamp:m=!1,onDismiss:g,style:S,children:k,...A}){const[F,D]=Ye.useState(null),[J,$]=Ye.useState(null),G=Ye.useRef(null),se=Ye.useRef(!0),pe=Ye.useRef(!1),ue=Ye.useCallback(()=>{const De=t.current;if(!De||!F)return;const Pe=De.getBoundingClientRect(),be=F.getBoundingClientRect(),we=s==="right"||s==="left"?{left:s==="right"?Pe.right+d:Pe.left-d-be.width,top:Pe.top}:{left:n==="end"?Pe.right-be.width:Pe.left,top:s==="top"?Pe.top-d-be.height:Pe.bottom+d},qe=m?W3t({...we,width:be.width,height:be.height}):we,bt=G.current;bt?.left===qe.left&&bt.top===qe.top||(G.current=qe,$(qe))},[n,t,m,d,F,s]);Ye.useLayoutEffect(()=>{const De=t.current;if(!De||!F)return;ue();let Pe=0;const be=()=>{ue(),Pe=requestAnimationFrame(be)};Pe=requestAnimationFrame(be),window.addEventListener("resize",ue),document.addEventListener("scroll",ue,!0);const X=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return X?.observe(De),X?.observe(F),()=>{const we=se.current&&F.contains(document.activeElement);window.removeEventListener("resize",ue),document.removeEventListener("scroll",ue,!0),cancelAnimationFrame(Pe),X?.disconnect(),we&&queueMicrotask(()=>t.current?.focus())}},[t,F,ue]),Ye.useLayoutEffect(()=>{!c||pe.current||!F||!J||(pe.current=!0,WTr(F))},[c,F,J]);const Ce=De=>{se.current=De!=="outside",g(),De==="escape"&&t.current?.focus()};return q.jsx(she,{children:q.jsx(fN,{...A,ref:D,dismissBoundaryRef:t,onDismiss:Ce,style:{...S,position:"fixed",left:J?.left??0,top:J?.top??0,visibility:J?S?.visibility:"hidden"},children:k})})}function Fyn({label:t,children:n,gap:s=0,...c}){const[d,m]=Ye.useState(!1),g=Ye.useRef(null),S=Ye.useId(),k=F=>F instanceof Element&&(g.current?.contains(F)===!0||F.closest(`[data-volter-submenu="${S}"]`)!==null),A=F=>{k(F.relatedTarget)||m(!1)};return q.jsxs(q.Fragment,{children:[q.jsxs(Jc,{...c,ref:g,"aria-haspopup":"menu","aria-expanded":d,onPointerEnter:()=>m(!0),onPointerLeave:A,onClick:F=>{F.preventDefault(),m(!0)},onKeyDown:F=>{(F.key==="ArrowRight"||F.key==="Enter"||F.key===" ")&&(F.preventDefault(),m(!0)),F.key==="ArrowLeft"&&m(!1)},children:[q.jsx("span",{style:{flex:1},children:t}),q.jsx("span",{"aria-hidden":"true",style:{paddingInlineStart:"var(--volter-space-4)"},children:"▸"})]}),d&&q.jsx(yBe,{anchorRef:g,"data-volter-submenu":S,side:"right",gap:s,clamp:!0,autoFocusFirst:!1,onDismiss:()=>m(!1),onPointerLeave:A,children:n})]})}const Ms=Ye.forwardRef(function({variant:n="secondary",size:s="default",shape:c="default",className:d,type:m="button",...g},S){return q.jsx("button",{...g,ref:S,type:m,className:d?`volter-btn ${d}`:"volter-btn","data-variant":n,"data-size":s,"data-shape":c})}),dm=Ye.forwardRef(function({variant:n="ghost",visibleLabel:s,children:c,...d},m){return q.jsxs(Ms,{...d,ref:m,variant:n,"data-icon":"true","data-label-placement":s===void 0?void 0:"below",children:[c,s!==void 0&&q.jsx("span",{className:"volter-icon-button-label",children:s})]})}),PI={base:0,overlayLow:50,sticky:100,dropdown:1e3,toast:9999,modal:1e4},IG={0:"#1a1a1a",1:"#242424",2:"#2c2c2c",3:"#333333",inset:"#1e1e1e"},Nht={1:"#333333",2:"#444444"},xB={1:"#c5c8ce",2:"#9aa0a6",3:"#90959c"},HTr="#579EFF",GTr="rgba(87,158,255,0.15)",D5e={1:"#f2f6fb",2:"#d3d9e0",3:"#aab0b7"},vBe="#d8dee9",bBe="rgba(216,222,233,0.18)",H3t="#FF6B6B",G3t="#e0a030",K3t="#4caf50",X3t="rgba(76,175,80,0.15)",Y3t="rgba(255,107,107,0.15)",Z3t="rgba(224,160,48,0.12)",Q3t="rgba(255,107,107,0.06)",e4t="rgba(0,0,0,0.5)",t4t="#ff79c6",r4t="rgba(255,121,198,0.08)",n4t="#22b8d6",qye='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',zye='ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace',P5e={sm:"0 2px 8px rgba(0,0,0,0.6)",md:"0 4px 12px rgba(0,0,0,0.5)",lg:"0 8px 32px rgba(0,0,0,0.6)"},SBe={0:"var(--volter-surface-shell)",1:"var(--volter-surface-panel)",2:"var(--volter-surface-chrome)",3:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)"},ahe={1:"var(--volter-boundary-default)",2:"var(--volter-boundary-strong)"},Zf={1:"var(--volter-content-primary)",2:"var(--volter-content-muted)",3:"var(--volter-content-dim)"},Myn="var(--volter-accent)",jyn="var(--volter-accent-muted)",Lyn={background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},C_e="var(--volter-danger)",Byn="var(--volter-warn)",$yn="var(--volter-success)",qyn="var(--volter-success-muted)",zyn="var(--volter-danger-muted)",Vyn="var(--volter-warn-muted)",Uyn="var(--volter-danger-faint)",Jyn="var(--volter-scrim)",Wyn="var(--volter-dynamic)",Hyn="var(--volter-dynamic-muted)",R_={1:2,2:4,3:6,4:8,5:10,6:12,8:16,10:20,12:24},i4t={commandBar:36,panelHeader:30,localToolbar:28,treeRow:24,treeIndent:14,statusBar:36,toolSize:34,toolWidth:38,toolGap:7,areaSeam:1,areaEmboss:0},xBe=["solid","clay","unlit","wireframe","matcap","normals","overdraw","preview","rendered"];function Zb(t){return t===void 0?"":`${t}`}function Qp(t){return{control:{...KTr,...t.density?.control},font:{...YTr,...t.density?.font},icon:{...XTr,...t.density?.icon},chrome:{...i4t,...t.density?.chrome}}}const KTr={compact:20,default:24,comfortable:28},I5e={resting:1,active:2},XTr={xs:9,sm:10,md:12,lg:13,xl:14,"2xl":16},YTr={xs:9,sm:10,base:11,md:12,lg:13,xl:14,"2xl":16,heading:24},E_e={regular:400,semibold:600,bold:700},Epe={tight:1,snug:1.2,normal:1.4,relaxed:1.5},NG={duration:{fast:140,base:180,slow:300},easing:{standard:"cubic-bezier(0.32, 0.72, 0.28, 1)",out:"ease-out"}},Gyn="var(--volter-font-sans)",Kyn="var(--volter-font-mono)",qI={small:"3px",medium:"6px",large:"8px",full:"9999px"},sQ={sm:"var(--volter-radius-sm)",md:"var(--volter-radius-md)",lg:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},Xyn={sm:"var(--volter-shadow-sm)",md:"var(--volter-shadow-md)",lg:"var(--volter-shadow-lg)"},YY={xs:"var(--volter-font-xs)",sm:"var(--volter-font-sm)",base:"var(--volter-font-base)",md:"var(--volter-font-md)",lg:"var(--volter-font-lg)",xl:"var(--volter-font-xl)","2xl":"var(--volter-font-2xl)",heading:"var(--volter-font-heading)"},G0={1:"var(--volter-space-1)",2:"var(--volter-space-2)",3:"var(--volter-space-3)",4:"var(--volter-space-4)",5:"var(--volter-space-5)",6:"var(--volter-space-6)",8:"var(--volter-space-8)",10:"var(--volter-space-10)",12:"var(--volter-space-12)"},Oht={tight:"var(--volter-leading-tight)",snug:"var(--volter-leading-snug)",normal:"var(--volter-leading-normal)",relaxed:"var(--volter-leading-relaxed)"},Yyn={duration:{fast:"var(--volter-duration-fast)",base:"var(--volter-duration-base)",slow:"var(--volter-duration-slow)"},easing:{standard:"var(--volter-ease-standard)",out:"var(--volter-ease-out)"}},Zyn="var(--volter-focus-ring)",ZTr=["outliner","properties"],Vye=Object.keys({object:!0,modifier:!0,material:!0,tool:!0,operator:!0,data:!0,scene:!0,collection:!0,select:!0}),i$={id:"graphite-dark",color:{surface:{shell:IG[0],panel:IG[1],chrome:IG[2],raised:IG[3],inset:IG.inset,overlay:"rgba(36,36,36,0.94)"},boundary:{default:Nht[1],strong:Nht[2]},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:HTr,muted:GTr},semantic:{danger:H3t,dangerMuted:Y3t,dangerFaint:Q3t,warning:G3t,warningMuted:Z3t,success:K3t,successMuted:X3t,dynamic:t4t,dynamicMuted:r4t,instance:n4t},neutralOverlay:{hover:"rgba(255,255,255,0.08)",active:"rgba(255,255,255,0.14)"},scrim:e4t},typography:{sans:qye,mono:zye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:P5e.sm,medium:P5e.md,large:P5e.lg}},QTr={...i$,id:"graphite-neutral",color:{...i$.color,content:{primary:D5e[1],muted:D5e[2],dim:D5e[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:vBe,muted:bBe}}},eCr={id:"midnight-high-contrast",color:{surface:{shell:"#0b0f14",panel:"#111821",chrome:"#17212c",raised:"#223040",inset:"#080c11",overlay:"rgba(17,24,33,0.96)"},boundary:{default:"#34465a",strong:"#71869d"},content:{primary:"#f2f5f8",muted:"#bdc8d5",dim:"#8493a5",onAccent:"#071019",onBright:{primary:"#071019",muted:"rgba(7,16,25,0.82)",dim:"rgba(7,16,25,0.72)"}},accent:{default:"#65d1ff",muted:"rgba(101,209,255,0.18)"},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.18)",dangerFaint:"rgba(255,123,134,0.08)",warning:"#f3c969",warningMuted:"rgba(243,201,105,0.16)",success:"#62d394",successMuted:"rgba(98,211,148,0.18)",dynamic:"#e889ff",dynamicMuted:"rgba(232,137,255,0.12)",instance:"#a49bff"},neutralOverlay:{hover:"rgba(255,255,255,0.10)",active:"rgba(255,255,255,0.18)"},scrim:"rgba(0,0,0,0.68)"},typography:{sans:qye,mono:zye},shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.72)",medium:"0 6px 18px rgba(0,0,0,0.68)",large:"0 12px 40px rgba(0,0,0,0.76)"}},IRe={id:"glass-dark",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:"rgba(26,26,26,0.88)",panel:"rgba(36,36,36,0.62)",chrome:"rgba(44,44,44,0.68)",raised:"rgba(51,51,51,0.74)",inset:"rgba(30,30,30,0.7)",overlay:"rgba(36,36,36,0.55)"},boundary:{default:"rgba(255,255,255,0.14)",strong:"rgba(255,255,255,0.24)"},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:vBe,muted:bBe},semantic:{danger:H3t,dangerMuted:Y3t,dangerFaint:Q3t,warning:G3t,warningMuted:Z3t,success:K3t,successMuted:X3t,dynamic:t4t,dynamicMuted:r4t,instance:n4t},neutralOverlay:{hover:"color-mix(in srgb, currentColor 9%, transparent)",active:"color-mix(in srgb, currentColor 14%, transparent)"},scrim:"rgba(0,0,0,0.35)"},typography:{sans:qye,mono:zye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:"0 4px 16px rgba(0,0,0,0.55)",medium:"0 8px 28px rgba(0,0,0,0.5)",large:"0 16px 48px rgba(0,0,0,0.55)"},treatment:{backdropBlurPx:14,backdropSaturation:1.3,backdropBrightness:.5,edgeSpecular:.6,specularAngleDeg:120,thickness:.5}},tCr=(()=>{const{treatment:t,...n}=IRe;return{...n,id:"glass-dark-lite",appearance:{material:"glass",transparency:"reduced"},color:{...IRe.color,surface:{shell:"#1a1a1a",panel:"#222222",chrome:"#292929",raised:"#303030",inset:"#1d1d1d",overlay:"#202020"},scrim:e4t}}})(),NRe={id:"liquid-glass",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:Ym.color.surface.shell,panel:Ym.color.surface.panel,chrome:Ym.color.surface.chrome,raised:Ym.color.surface.raised,inset:Ym.color.surface.inset,overlay:Ym.color.surface.overlay},boundary:Ym.color.boundary,content:{primary:"#f2f6fb",muted:"rgba(242,246,251,0.85)",dim:"rgba(242,246,251,0.68)",onAccent:"#0b1526",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:vBe,muted:bBe},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.22)",dangerFaint:"rgba(255,123,134,0.10)",warning:"#ffd35f",warningMuted:"rgba(255,211,95,0.18)",success:"#58e078",successMuted:"rgba(88,224,120,0.20)",dynamic:"#ff8fd8",dynamicMuted:"rgba(255,143,216,0.14)",instance:"#3ad2ea"},neutralOverlay:Ym.color.neutralOverlay,scrim:Ym.color.scrim},typography:{sans:qye,mono:zye},shape:Ym.shape,elevation:Ym.elevation,treatment:Ym.treatment},rCr=(()=>{const{treatment:t,...n}=NRe;return{...n,id:"liquid-glass-lite",appearance:{material:"glass",transparency:"reduced"},color:{...NRe.color,surface:Ym.reducedTransparency.surface,scrim:Ym.reducedTransparency.scrim}}})(),o4t={"graphite-dark":i$,"graphite-neutral":QTr,"midnight-high-contrast":eCr,"glass-dark":IRe,"glass-dark-lite":tCr,"liquid-glass":NRe,"liquid-glass-lite":rCr};function nCr(t){return typeof t=="string"&&Object.hasOwn(o4t,t)}const Go={surface:{shell:"var(--volter-surface-shell)",panel:"var(--volter-surface-panel)",chrome:"var(--volter-surface-chrome)",raised:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)",overlay:"var(--volter-surface-overlay)"},boundary:{default:"var(--volter-boundary-default)",strong:"var(--volter-boundary-strong)"},content:{primary:"var(--volter-content-primary)",muted:"var(--volter-content-muted)",dim:"var(--volter-content-dim)",onAccent:"var(--volter-content-on-accent)",active:"var(--volter-content-active)",selected:"var(--volter-content-selected)"},accent:{default:"var(--volter-accent)",muted:"var(--volter-accent-muted)"},selection:{background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},semantic:{danger:"var(--volter-danger)",dangerMuted:"var(--volter-danger-muted)",dangerFaint:"var(--volter-danger-faint)",warning:"var(--volter-warn)",warningMuted:"var(--volter-warn-muted)",success:"var(--volter-success)",successMuted:"var(--volter-success-muted)",dynamic:"var(--volter-dynamic)",dynamicMuted:"var(--volter-dynamic-muted)",instance:"var(--volter-instance)"},neutralOverlay:{hover:"var(--volter-neutral-hover)",active:"var(--volter-neutral-active)"},scrim:"var(--volter-scrim)",typography:{sans:"var(--volter-font-sans)",mono:"var(--volter-font-mono)"},shape:{small:"var(--volter-radius-sm)",medium:"var(--volter-radius-md)",large:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},elevation:{small:"var(--volter-shadow-sm)",medium:"var(--volter-shadow-md)",large:"var(--volter-shadow-lg)"},focusRing:"var(--volter-focus-ring)"};function iCr(t){const n=`<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1L5 5L9 1' stroke='${t}' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(n)}")`}function oCr(t){if(!t)return"none";const n=[];return t.backdropBlurPx&&n.push(`blur(${t.backdropBlurPx}px)`),t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&n.push(`saturate(${t.backdropSaturation})`),t.backdropBrightness!==void 0&&t.backdropBrightness!==1&&n.push(`brightness(${t.backdropBrightness})`),n.length>0?n.join(" "):"none"}function Rht(t,n){return n?"transparent":`linear-gradient(var(${t}), var(${t})), linear-gradient(var(--volter-surface-shell), var(--volter-surface-shell))`}function Fht(t){const n=t?.contentFrostBlurPx??0;if(n<=0)return"none";const s=[`blur(${n}px)`];return t?.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function ORe(t){return(t?.contentFrostBlurPx??0)>0?"rgba(255,255,255,0.10)":"transparent"}function sCr(t){return t?"color-mix(in srgb, currentColor 7%, transparent)":"var(--volter-widget-field)"}function aCr(t){return t?"color-mix(in srgb, currentColor 26%, transparent)":"var(--volter-boundary-default)"}function cCr(t,n){const d=[n==="none"?"":n,t?"inset 0 1px 0 color-mix(in srgb, currentColor 14%, transparent), 0 5px 14px -12px color-mix(in srgb, currentColor 55%, transparent)":""].filter(Boolean);return d.length===0?"none":d.join(", ")}const lCr=.6,uCr=.5;function che(t,n){return`rgba(255,255,255,${Math.min(1,Number((t*n/lCr).toFixed(3)))})`}function s4t(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>che(d,n);return`linear-gradient(${s}deg, ${c(.95)} 0%, ${c(.38)} 16%, ${c(.16)} 40%, ${c(.14)} 60%, ${c(.45)} 84%, ${c(.85)} 100%)`}function fCr(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>che(d,n);return`linear-gradient(${s}deg, ${c(.16)} 0%, ${c(.05)} 24%, transparent 40%)`}function dCr(t){const n=t?.edgeSpecular??0,s=t?.thickness??0,c=[];if(n>0&&(c.push(`inset 0 1px 1px ${che(.28,n)}`),c.push(`inset 0 -1px 1px ${che(.1,n)}`)),s>0){const d=m=>`${Number((m*s/uCr).toFixed(1))}px`;c.push(`inset 0 ${d(12)} ${d(24)} ${d(-14)} rgba(255,255,255,0.35)`),c.push(`inset 0 ${d(-14)} ${d(28)} ${d(-18)} rgba(0,0,0,0.55)`),c.push(`0 ${d(18)} ${d(40)} ${d(-18)} rgba(0,0,0,0.55)`)}else c.push("var(--volter-shadow-lg)");return c.join(", ")}function q$(t){return t.appearance?t.appearance.material==="glass":t.treatment!==void 0}function pCr(t){return q$(t)?"var(--volter-surface-panel)":"color-mix(in srgb, var(--volter-surface-panel) 90%, transparent)"}function _Cr(t){return q$(t)?t.treatment?"var(--volter-surface-backdrop-filter)":"none":"blur(8px)"}function mCr(t){return t?"17px":"var(--volter-radius-md)"}function hCr(t){return t?"var(--volter-boundary-default)":"var(--volter-boundary-strong)"}function gCr(t){return t?"var(--volter-shadow-lg)":"var(--volter-shadow-sm)"}function yCr(t,n){const s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t.color.accent.default);if(!s)return null;const[c,d,m]=[s[1],s[2],s[3]].map(g=>Number.parseInt(g,16));return`rgba(${c},${d},${m},${n})`}function Uye(t){return q$(t)}function vCr(t){return Uye(t)?"var(--volter-neutral-active)":"var(--volter-accent-muted)"}function a4t(t){const n=t.trim().toLowerCase();if(n.startsWith("#"))return n.length===5?n.endsWith("f"):n.length===9?n.endsWith("ff"):!0;const s=/^rgba?\(([^)]*)\)$/.exec(n)??/^hsla?\(([^)]*)\)$/.exec(n);if(s){const c=(s[1]??"").split(/[,/]/)[3];return c===void 0||Number.parseFloat(c)>=1}return n!=="transparent"&&!n.includes("transparent")}function c4t(t){if(!a4t(t))return!1;const n=t.trim().toLowerCase();let s=null;const c=/^#([0-9a-f]{3}|[0-9a-f]{6})(?:f|ff)?$/.exec(n);if(c){const S=c[1].length===3?[...c[1]].map(k=>k+k).join(""):c[1];s=[0,2,4].map(k=>Number.parseInt(S.slice(k,k+2),16))}else{const S=/^rgba?\(([^)]*)\)$/.exec(n);S&&(s=(S[1]??"").split(/[,\s/]+/).filter(Boolean).slice(0,3).map(k=>k.endsWith("%")?Number.parseFloat(k)*2.55:Number.parseFloat(k)))}if(!s||s.some(S=>!Number.isFinite(S)))return!1;const[d,m,g]=s;return(.2126*d+.7152*m+.0722*g)/255>.5}function bCr(t){return Uye(t)?"var(--volter-content-primary)":a4t(t.color.accent.muted)?"var(--volter-content-on-accent)":"var(--volter-content-primary)"}function SCr(t){return Uye(t)?"color-mix(in srgb, currentColor 30%, transparent)":c4t(t.color.surface.panel)?`rgb(from ${t.color.accent.muted} r g b / 1)`:"var(--volter-accent)"}function xCr(t){return Uye(t)?"color-mix(in srgb, currentColor 76%, transparent)":"var(--volter-accent)"}function wCr(t){return t?"var(--volter-radius-full)":"var(--volter-radius-sm)"}function TCr(t){return!q$(t)||!t.treatment?"var(--volter-accent)":yCr(t,.82)??"var(--volter-accent)"}function CCr(t){const n=t?.edgeSpecular??0;return n<=0?"none":s4t({...t,edgeSpecular:n*.4})}function ECr(t){const n=t?.ambientLiftOpacity??0;if(n<=0)return"none";const s=Number(n.toFixed(3)),c=Number((n*.35).toFixed(3));return`linear-gradient(165deg, rgba(255,255,255,${s}) 0%, rgba(255,255,255,${c}) 55%, rgba(255,255,255,0) 100%)`}function l4t(t){return t<=0?"none":`0 1px 2px rgba(0,0,0,${Number(t.toFixed(3))})`}function u4t(t){return l4t(t?.textShadowOpacity??0)}function kCr(t){return t.treatment?.adaptiveContent?{primary:t.color.content.onBright.primary,muted:t.color.content.onBright.muted,dim:t.color.content.onBright.dim,textShadow:l4t(t.treatment.brightTextShadowOpacity??0),frostBg:t.treatment.brightFrostBg??ORe(t.treatment)}:{primary:t.color.content.primary,muted:t.color.content.muted,dim:t.color.content.dim,textShadow:u4t(t.treatment),frostBg:ORe(t.treatment)}}function ACr(t){return t.treatment?t.treatment.adaptiveContent?"rgba(255,255,255,0.9)":PCr(t.color.surface.chrome,.9):t.color.surface.chrome}function DCr(t){return t.color.surface.panel}function PCr(t,n){const s=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9.]+)\s*\)$/.exec(t);if(!s)return t;const c=Math.max(Number(s[4]),n);return`rgba(${s[1]},${s[2]},${s[3]},${c})`}function Mht(t){if(!t)return"none";const s=[`blur(${Math.max(16,t.contentFrostBlurPx??0)}px)`];return t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function ICr(t){return t.color.boundary.area??t.color.boundary.default}function NCr(t,n){return`color-mix(in srgb, ${t} 98.4%, ${n})`}function OG(t){return`color-mix(in srgb, var(--volter-area-emboss-mix), ${t})`}function OCr(t){const n=Qp(t).chrome.areaEmboss;return n>0?`#ffffff ${n}%`:"transparent 100%"}function RCr(t){const n=kCr(t),s=q$(t),c=t.color.widget?.regular??t.color.surface.raised,d=t.color.widget?.menu??t.color.surface.raised,m=t.color.widget?.field??t.color.surface.inset,g=t.color.widget?.emboss?`0 1px 0 ${t.color.widget.emboss}`:"none",S=A=>`color-mix(in srgb, ${A} 87.8%, ${t.color.content.primary})`,k=`color-mix(in srgb, ${t.color.surface.panel} 86.5%, ${t.color.surface.raised})`;return{"--volter-surface-shell":t.color.surface.shell,"--volter-surface-panel":t.color.surface.panel,"--volter-surface-chrome":t.color.surface.chrome,"--volter-surface-raised":t.color.surface.raised,"--volter-surface-inset":t.color.surface.inset,"--volter-surface-overlay":t.color.surface.overlay,"--volter-surface-backdrop-filter":oCr(t.treatment),"--volter-surface-sticky":Rht("--volter-surface-chrome",s),"--volter-surface-sticky-panel":Rht("--volter-surface-panel",s),"--volter-surface-sticky-backdrop-filter":"none","--volter-surface-body-frost-filter":Fht(t.treatment),"--volter-content-frost-filter":Fht(t.treatment),"--volter-content-frost-bg":ORe(t.treatment),"--volter-input-surface":sCr(s),"--volter-input-border":aCr(s),"--volter-input-shadow":cCr(s,g),"--volter-structural-divider":s?"transparent":t.color.boundary.default,"--volter-card-specular-ring":s4t(t.treatment),"--volter-card-specular-sheen":fCr(t.treatment),"--volter-card-specular-shadow":dCr(t.treatment),"--volter-card-refraction-thickness":String(t.treatment?.refractionThickness??0),"--volter-card-refraction-bezel":String(t.treatment?.refractionBezelPx??28),"--volter-card-refraction-angle":String(t.treatment?.specularAngleDeg??120),"--volter-ambient-lift":ECr(t.treatment),"--volter-island-surface":pCr(t),"--volter-island-backdrop-filter":_Cr(t),"--volter-island-radius":mCr(s),"--volter-island-border-color":hCr(s),"--volter-island-shadow":gCr(s),"--volter-island-specular-ring":CCr(t.treatment),"--volter-selection-bg":vCr(t),"--volter-content-on-selection":bCr(t),"--volter-selection-border":SCr(t),"--volter-selection-indicator":xCr(t),"--volter-island-control-radius":wCr(s),"--volter-island-primary-bg":TCr(t),"--volter-content-text-shadow":u4t(t.treatment),"--volter-content-primary-on-bright":n.primary,"--volter-content-muted-on-bright":n.muted,"--volter-content-dim-on-bright":n.dim,"--volter-content-text-shadow-on-bright":n.textShadow,"--volter-content-frost-bg-on-bright":n.frostBg,"--volter-content-adaptive":t.treatment?.adaptiveContent?"1":"0","--volter-glass-regular-bg":ACr(t),"--volter-glass-regular-backdrop-filter":Mht(t.treatment),"--volter-glass-regular-panel-bg":DCr(t),"--volter-glass-regular-panel-backdrop-filter":Mht(t.treatment),"--volter-glass-dark-frost-panel-bg":"rgba(5,8,13,0.74)","--volter-glass-dark-frost-content-bg":"rgba(5,8,13,0.84)","--volter-scrim-backdrop-filter":t.treatment?"blur(8px)":"none","--volter-boundary-default":t.color.boundary.default,"--volter-boundary-strong":t.color.boundary.strong,"--volter-boundary-area":ICr(t),"--volter-tree-indent-guide":t.color.boundary.indent??"transparent","--volter-boundary-divider":t.color.boundary.divider??t.color.boundary.default,"--volter-area-emboss-mix":OCr(t),"--volter-area-emboss":OG(t.color.surface.panel),"--volter-area-emboss-stage":OG(OG(t.color.viewport?.background??t.color.surface.panel)),"--volter-area-emboss-stage-header":OG(OG(k)),"--volter-content-primary":t.color.content.primary,"--volter-content-muted":t.color.content.muted,"--volter-content-dim":t.color.content.dim,"--volter-content-on-accent":t.color.content.onAccent,"--volter-content-menu":t.color.content.menu??t.color.content.primary,"--volter-content-status":t.color.content.status??t.color.content.dim,"--volter-content-placeholder":t.color.content.placeholder??t.color.content.dim,"--volter-content-active":t.color.content.active??"","--volter-content-selected":t.color.content.selected??t.color.content.active??"","--volter-accent":t.color.accent.default,"--volter-accent-muted":t.color.accent.muted,"--volter-danger":t.color.semantic.danger,"--volter-danger-muted":t.color.semantic.dangerMuted,"--volter-danger-faint":t.color.semantic.dangerFaint,"--volter-warn":t.color.semantic.warning,"--volter-warn-muted":t.color.semantic.warningMuted,"--volter-success":t.color.semantic.success,"--volter-success-muted":t.color.semantic.successMuted,"--volter-dynamic":t.color.semantic.dynamic,"--volter-dynamic-muted":t.color.semantic.dynamicMuted,"--volter-instance":t.color.semantic.instance,"--volter-neutral-hover":t.color.neutralOverlay.hover,"--volter-neutral-active":t.color.neutralOverlay.active,"--volter-scrim":t.color.scrim,"--volter-surface-section":`color-mix(in srgb, ${t.color.surface.panel} 64.9%, ${t.color.surface.raised})`,"--volter-surface-section-edge":`color-mix(in srgb, ${t.color.surface.panel} 29.7%, ${t.color.surface.raised})`,"--volter-surface-header":k,"--volter-surface-row-alt":NCr(t.color.surface.panel,t.color.content.primary),...c4t(t.color.surface.panel)?{"--volter-tree-row-selected-bg":t.color.accent.muted,"--volter-tree-row-active-bg":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-row-active-border":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-datablock-fill":"color-mix(in srgb, var(--volter-category-data, currentColor) 14%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 14%, transparent)"}:{"--volter-tree-row-selected-bg":`color-mix(in srgb, ${t.color.accent.default} 42%, #000)`,"--volter-tree-row-active-bg":`color-mix(in srgb, ${t.color.accent.default} 70%, #000)`,"--volter-tree-row-active-border":"rgb(from var(--volter-tree-row-active-bg) calc(r + 40) calc(g + 40) calc(b + 40))","--volter-tree-datablock-fill":"color-mix(in srgb, color-mix(in srgb, var(--volter-category-data, currentColor) 60%, black) 26%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 24%, transparent)"},"--volter-tree-active-name-underline":t.color.content.active?"none":"underline","--volter-viewport-background":t.color.viewport?.background??"","--volter-viewport-grid":t.color.viewport?.grid??"","--volter-viewport-axis-x":t.color.viewport?.axisX??"","--volter-viewport-axis-y":t.color.viewport?.axisY??"","--volter-viewport-axis-z":t.color.viewport?.axisZ??"","--volter-viewport-wire":t.color.viewport?.wire??"","--volter-viewport-wire-opacity":Zb(t.stage?.wireOpacity),"--volter-viewport-axis-line-width":Zb(t.stage?.axisLineWidth),"--volter-viewport-selection":t.color.viewport?.selection??"","--volter-viewport-active":t.color.viewport?.active??"","--volter-gizmo-x":t.color.gizmo?.x??"","--volter-gizmo-y":t.color.gizmo?.y??"","--volter-gizmo-z":t.color.gizmo?.z??"","--volter-gizmo-navigation-x":t.color.gizmo?.navigationX??"","--volter-gizmo-navigation-y":t.color.gizmo?.navigationY??"","--volter-gizmo-navigation-z":t.color.gizmo?.navigationZ??"","--volter-gizmo-hover":t.color.gizmo?.hover??"","--volter-gizmo-drag":t.color.gizmo?.drag??"","--volter-viewport-gizmo-opacity":Zb(t.stage?.gizmoOpacity),"--volter-viewport-gizmo-arrow-length":Zb(t.stage?.gizmoArrowLength),"--volter-viewport-gizmo-arrow-head":Zb(t.stage?.gizmoArrowHead),"--volter-viewport-gizmo-ring-width":Zb(t.stage?.gizmoRingWidth),"--volter-viewport-navigation-gizmo":t.stage?.navigationGizmo??"","--volter-viewport-navigation-corner":t.stage?.navigationCorner??"","--volter-viewport-navigation-size":Zb(t.stage?.navigationSize),"--volter-viewport-gizmo-highlight-saturation":Zb(t.stage?.gizmoHighlightSaturation),"--volter-viewport-gizmo-highlight-value":Zb(t.stage?.gizmoHighlightValue),"--volter-viewport-gizmo-size":t.stage?.gizmoSize===void 0?"":`${t.stage.gizmoSize}`,"--volter-viewport-grid-line-width":Zb(t.stage?.gridLineWidth),"--volter-viewport-grid-major-width":Zb(t.stage?.gridMajorWidth),"--volter-viewport-grid-major-contrast":Zb(t.stage?.gridMajorContrast),"--volter-viewport-selection-box":t.stage?.selectionBox??"","--volter-viewport-selection-box-frame":t.stage?.selectionBoxFrame??"","--volter-viewport-outline-style":t.stage?.outlineStyle??"","--volter-viewport-outline-width":Zb(t.stage?.outlineWidth),"--volter-viewport-outline-hidden":t.stage?.outlineHidden===void 0?"":`${t.stage.outlineHidden}`,"--volter-viewport-selection-box-width":Zb(t.stage?.selectionBoxWidth),"--volter-viewport-chrome-bar":t.stage?.chrome?.bar??"","--volter-viewport-chrome-view-name":t.stage?.chrome?.viewName??"","--volter-viewport-chrome-tools":t.stage?.chrome?.tools??"","--volter-viewport-chrome-display":t.stage?.chrome?.display??"","--volter-viewport-chrome-transform-controls":t.stage?.chrome?.transformControls??"",...Object.fromEntries(xBe.map(A=>[`--volter-viewport-word-${A}`,t.stage?.words?.shading?.[A]??""])),"--volter-viewport-word-helpers":t.stage?.words?.helpers??"","--volter-widget-regular":c,"--volter-widget-regular-hover":S(c),"--volter-widget-menu":d,"--volter-widget-menu-hover":S(d),"--volter-widget-field":m,"--volter-widget-emboss-shadow":g,...Object.fromEntries(Vye.map(A=>[`--volter-category-${A}`,t.color.category?.[A]??"currentColor"])),"--volter-region-outliner":t.color.region?.outliner??t.color.surface.panel,"--volter-region-outliner-header":t.color.region?.outliner??t.color.surface.chrome,"--volter-region-properties":t.color.region?.properties??t.color.surface.panel,"--volter-region-properties-header":t.color.region?.properties??t.color.surface.chrome,"--volter-font-sans":t.typography.sans,"--volter-font-mono":t.typography.mono,"--volter-radius-sm":t.shape.small,"--volter-radius-md":t.shape.medium,"--volter-radius-lg":t.shape.large,"--volter-radius-full":t.shape.full,"--volter-shadow-sm":t.elevation.small,"--volter-shadow-md":t.elevation.medium,"--volter-shadow-lg":t.elevation.large,"--volter-focus-ring":`${I5e.active}px solid ${t.color.accent.default}`,"--volter-select-chevron":iCr(t.color.content.muted),"--volter-space-1":`${R_[1]}px`,"--volter-space-2":`${R_[2]}px`,"--volter-space-3":`${R_[3]}px`,"--volter-space-4":`${R_[4]}px`,"--volter-space-5":`${R_[5]}px`,"--volter-space-6":`${R_[6]}px`,"--volter-space-8":`${R_[8]}px`,"--volter-space-10":`${R_[10]}px`,"--volter-space-12":`${R_[12]}px`,"--volter-command-bar-height":`${Qp(t).chrome.commandBar}px`,"--volter-panel-header-height":`${Qp(t).chrome.panelHeader}px`,"--volter-local-toolbar-height":`${Qp(t).chrome.localToolbar}px`,"--volter-tree-row-height":`${Qp(t).chrome.treeRow}px`,"--volter-tree-indent":`${Qp(t).chrome.treeIndent}px`,"--volter-status-bar-height":`${Qp(t).chrome.statusBar}px`,"--volter-tool-size":`${Qp(t).chrome.toolSize}px`,"--volter-tool-width":`${Qp(t).chrome.toolWidth}px`,"--volter-tool-gap":`${Qp(t).chrome.toolGap}px`,"--volter-area-seam-width":`${Qp(t).chrome.areaSeam}px`,"--volter-control-compact-height":`${Qp(t).control.compact}px`,"--volter-control-default-height":`${Qp(t).control.default}px`,"--volter-control-comfortable-height":`${Qp(t).control.comfortable}px`,"--volter-stroke-resting":`${I5e.resting}px`,"--volter-stroke-active":`${I5e.active}px`,"--volter-font-xs":`${Qp(t).font.xs}px`,"--volter-font-sm":`${Qp(t).font.sm}px`,"--volter-font-base":`${Qp(t).font.base}px`,"--volter-font-md":`${Qp(t).font.md}px`,"--volter-font-lg":`${Qp(t).font.lg}px`,"--volter-font-xl":`${Qp(t).font.xl}px`,"--volter-font-2xl":`${Qp(t).font["2xl"]}px`,"--volter-icon-xs":`${Qp(t).icon.xs}px`,"--volter-icon-sm":`${Qp(t).icon.sm}px`,"--volter-icon-md":`${Qp(t).icon.md}px`,"--volter-icon-lg":`${Qp(t).icon.lg}px`,"--volter-icon-xl":`${Qp(t).icon.xl}px`,"--volter-icon-2xl":`${Qp(t).icon["2xl"]}px`,"--volter-font-heading":`${Qp(t).font.heading}px`,"--volter-font-weight-regular":String(E_e.regular),"--volter-font-weight-semibold":String(E_e.semibold),"--volter-font-weight-bold":String(E_e.bold),"--volter-leading-tight":String(Epe.tight),"--volter-leading-snug":String(Epe.snug),"--volter-leading-normal":String(Epe.normal),"--volter-leading-relaxed":String(Epe.relaxed),"--volter-duration-fast":`${NG.duration.fast}ms`,"--volter-duration-base":`${NG.duration.base}ms`,"--volter-duration-slow":`${NG.duration.slow}ms`,"--volter-ease-standard":NG.easing.standard,"--volter-ease-out":NG.easing.out,"--volter-z-base":String(PI.base),"--volter-z-overlay-low":String(PI.overlayLow),"--volter-z-sticky":String(PI.sticky),"--volter-z-dropdown":String(PI.dropdown),"--volter-z-toast":String(PI.toast),"--volter-z-modal":String(PI.modal)}}const RRe="volter-editor-theme";function FCr(t,n=i$){t.classList.add(RRe),t.dataset.volterTheme=n.id,t.dataset.volterChrome=q$(n)?"islands":"bars";for(const[s,c]of Object.entries(RCr(n)))t.style.setProperty(s,c)}const Qyn={bg:Go.semantic.dangerFaint,border:Go.semantic.danger,fg:Go.semantic.danger},e0n={bg:Go.semantic.warningMuted,border:Go.semantic.warning,fg:Go.semantic.warning},f4t=Ye.createContext(null);function MCr(){return Ye.useContext(f4t)}function DR(t,n){return n?`${t} ${n}`:t}const Zm=Ye.forwardRef(function({className:n,type:s="text",...c},d){return q.jsx("input",{...c,ref:d,type:s,className:DR("volter-input",n)})}),Iw=Ye.forwardRef(function({className:n,...s},c){return q.jsx("select",{...s,ref:c,className:DR("volter-select",n)})}),wBe=Ye.forwardRef(function({className:n,...s},c){return q.jsx("textarea",{...s,ref:c,className:DR("volter-input volter-textarea",n)})}),TD=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"checkbox",className:DR("volter-checkbox",n)})}),d4t=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"color",className:DR("volter-color-swatch",n)})}),t0n=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"file",className:DR("volter-file-input",n)})}),r0n=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"range",className:DR("volter-range",n)})}),hC="default",jCr={id:hC,title:"Editor"},wB=new Map;let lhe=null,aQ=hC;const FRe=new Set;function MRe(){for(const t of FRe)t()}function n0n(){return lhe??=[jCr,...[...wB.values()].map(({id:t,title:n})=>({id:t,title:n}))],lhe}function yee(t){return typeof t=="string"&&(t===hC||wB.has(t))}function LCr(t){if(yee(t.id))throw new Error(`registerContributedIconSet: icon set "${t.id}" is already registered.`);return wB.set(t.id,t),lhe=null,MRe(),()=>{wB.get(t.id)===t&&(wB.delete(t.id),lhe=null,MRe())}}function uhe(){return aQ}function fhe(t){const n=yee(t)?t:hC;n!==aQ&&(aQ=n,MRe())}function TBe(t){return FRe.add(t),()=>FRe.delete(t)}function p4t(t){return aQ===hC?null:wB.get(aQ)?.glyphs[t]??null}const jht={xs:"var(--volter-icon-xs)",sm:"var(--volter-icon-sm)",md:"var(--volter-icon-md)",lg:"var(--volter-icon-lg)",xl:"var(--volter-icon-xl)","2xl":"var(--volter-icon-2xl)"},Lht={current:void 0,primary:Go.content.primary,muted:Go.content.muted,dim:Go.content.dim,accent:Go.accent.default,danger:Go.semantic.danger};function dc({icon:t,size:n="sm",tone:s="current",label:c,className:d,style:m,spin:g=!1,...S}){Ye.useSyncExternalStore(TBe,uhe,uhe);const k=p4t(t.iconName);if(k){const A=s!=="current",F=k.tone?`var(--volter-category-${k.tone}, currentColor)`:void 0,D=A?Lht[s]:k.tonedPath?void 0:F,J=A?"currentColor":F??"currentColor";return q.jsxs("svg",{...S,viewBox:k.viewBox??"0 0 16 16","data-volter-tone":A?void 0:k.tone,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{width:"1.25em",height:"1em",overflow:"visible",verticalAlign:"-0.125em",fontSize:jht[n],color:D,...m},children:[q.jsx("path",{d:k.path,fill:"currentColor"}),k.tonedPath?q.jsx("path",{d:k.tonedPath,fill:J}):null]})}return q.jsx(n0r,{...S,icon:t,fixedWidth:!0,spin:g,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{fontSize:jht[n],color:Lht[s],...m}})}function _4t({direction:t,size:n="xs",tone:s="current",style:c}){return q.jsx(dc,{icon:t==="right"?MTt:XTt,size:n,tone:s,...c?{style:c}:{}})}function i0n({direction:t,size:n="xs",tone:s="current"}){return q.jsx(dc,{icon:t==="right"?ITt:uLe,size:n,tone:s})}function fy(t,n){return{...n,iconName:t}}const Kk={action:{add:QTt,close:cLe,delete:OTt,search:NTt,refresh:tvr,undo:VOe,redo:Dmt,build:X0r,export:evr,select:Pmt},transport:{play:F0r,pause:Z0r,restart:Dmt,stop:RTt,step:j0r},content:{project:qOe,folder:uee,file:zTt,source:fLe,scene:pLe,entity:aR,component:GB,camera:cye,light:oLe,image:iB,audio:lLe,data:FTt,code:sLe,stateMachine:LTt},status:{success:aLe,info:R$,warning:fee,error:qTt,visible:iLe,hidden:dLe,locked:Fme,unlocked:zOe},viewport:{zoomIn:S0r,zoomOut:v0r,pan:I0r,frame:g0r,projection:fy("viewport-projection",E5e),projectionOrthographic:fy("viewport-orthographic",E5e),camera:fy("viewport-camera",Amt),cameraView:fy("viewport-camera-view",Amt),cameraLocked:fy("viewport-camera-locked",Fme),cameraUnlocked:fy("viewport-camera-unlocked",zOe)},modeling:{extrude:fy("mesh-extrude",BTt),inset:fy("mesh-inset",K0r),bevel:fy("mesh-bevel",rvr),loopCut:fy("mesh-loop-cut",x0r),knife:fy("mesh-knife",J0r),smooth:fy("mesh-smooth",y0r),shrinkFatten:fy("mesh-shrink-fatten",VTt),subdivide:fy("mesh-subdivide",M0r)},tool:{extension:GB,select:fy("tool-select-box",Pmt),move:JTt,rotate:PTt,scale:fy("tool-scale",T0r),transform:fy("tool-transform",N0r),snap:R0r,frame:ZTt,grid:E5e,profiler:KTt},panel:{outliner:fy("outliner",tCt),properties:fy("properties",WTt),"folder-open":qOe,"cubes-stacked":UTt,users:w0r,list:vZ,"rotate-left":VOe}};function SZ({value:t,onChange:n,onChangeEnd:s,step:c=.1,precision:d=3,disabled:m=!1,label:g,labelColor:S,style:k,testId:A,title:F}){const[D,J]=Ye.useState(!1),[$,G]=Ye.useState(""),se=Ye.useRef({startX:0,startVal:0,dragging:!1,gesture:!1,lastVal:0}),pe=Ye.useRef(null),ue=MCr();Ye.useEffect(()=>{if(!D)return;const we=pe.current;we&&(we.focus(),we.select())},[D]);const Ce=t===null,De=t??0,Pe=Ce?"—":Number.isFinite(De)?De.toFixed(d):0 .toFixed(d),be=we=>{if(m)return;se.current={startX:we.clientX,startVal:De,dragging:!1,gesture:!1,lastVal:De};const qe=Pt=>{const Wt=Pt.clientX-se.current.startX;if(Math.abs(Wt)>3&&(se.current.dragging=!0),se.current.dragging){se.current.gesture||(se.current.gesture=!0,ue?.begin());const zt=se.current.startVal+Wt*c,ft=Math.round(zt/c)*c;se.current.lastVal=ft,n(ft)}},bt=()=>{window.removeEventListener("pointermove",qe),window.removeEventListener("pointerup",bt),se.current.gesture&&ue?.end(),se.current.dragging?s?.(se.current.lastVal):(J(!0),G(Ce?"":Pe))};window.addEventListener("pointermove",qe),window.addEventListener("pointerup",bt)},X=()=>{J(!1);const we=Number.parseFloat($);Number.isFinite(we)&&(n(we),s?.(we))};return q.jsxs("div",{className:"volter-number-input","data-testid":A,title:F,style:k,children:[g&&q.jsx("span",{className:"volter-number-input-label",style:S?{color:S}:void 0,children:g}),D?q.jsx(Zm,{ref:pe,value:$,onChange:we=>G(we.target.value),onBlur:X,onKeyDown:we=>{we.key==="Enter"&&X(),we.key==="Escape"&&J(!1)},placeholder:Ce?"—":void 0,className:"volter-number-input-editor"}):q.jsx("div",{onPointerDown:be,className:"volter-number-input-scrub","data-mixed":Ce||void 0,"data-disabled":m||void 0,children:Pe})]})}const BCr={minHeight:"var(--volter-panel-header-height)",padding:`0 ${R_[4]}px`,color:Go.content.muted,fontSize:"var(--volter-font-base)",fontWeight:E_e.semibold,textTransform:"uppercase",display:"flex",alignItems:"center",gap:R_[2],userSelect:"none"},$Cr={...BCr,background:"var(--volter-surface-sticky)",borderBottom:"1px solid var(--volter-structural-divider)",flexShrink:0};function Jye({name:t,actions:n,onHeaderClick:s,hideHeader:c=!1,style:d,children:m,...g}){return q.jsxs("div",{...g,style:{display:"flex",flexDirection:"column",pointerEvents:"auto",...d},children:[!c&&q.jsxs("div",{role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?S=>{S.key==="Enter"&&s()}:void 0,style:{...$Cr,cursor:s?"pointer":void 0,pointerEvents:"auto"},children:[q.jsx("span",{style:{flexShrink:0},children:t}),n&&q.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:R_[3]},children:n})]}),m]})}function qCr({label:t,icon:n,description:s,actions:c,collapsible:d=!0,defaultOpen:m=!0,children:g}){const[S,k]=Ye.useState(m),A=q.jsxs("span",{className:"volter-section-title",children:[q.jsx("span",{children:t}),s?q.jsx("small",{children:s}):null]});return q.jsxs("section",{className:"volter-section",children:[q.jsxs("div",{className:"volter-section-header",children:[d?q.jsxs("button",{type:"button",className:"volter-section-trigger","aria-expanded":S,onClick:()=>k(!S),children:[q.jsx(_4t,{direction:S?"down":"right",style:{fontSize:"var(--volter-section-disclosure-size, var(--volter-icon-xs))"}}),n&&q.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}):q.jsxs("div",{className:"volter-section-trigger","data-volter-static":!0,children:[n&&q.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}),c?q.jsx("div",{className:"volter-section-actions",children:c}):null]}),(S||!d)&&q.jsx("div",{className:"volter-section-body",children:g})]})}const zI=8,VI=6;function zCr(t){return t==="top"?"bottom":t==="bottom"?"top":t==="left"?"right":"left"}function VCr(t,n,s){return t==="top"?n.top-s.height-VI>=zI:t==="bottom"?n.bottom+s.height+VI<=window.innerHeight-zI:t==="left"?n.left-s.width-VI>=zI:n.right+s.width+VI<=window.innerWidth-zI}function UCr(t,n,s){let c=n.left+(n.width-s.width)/2,d=n.top+(n.height-s.height)/2;return t==="top"?d=n.top-s.height-VI:t==="bottom"?d=n.bottom+VI:t==="left"?c=n.left-s.width-VI:c=n.right+VI,{left:Math.max(zI,Math.min(c,window.innerWidth-s.width-zI)),top:Math.max(zI,Math.min(d,window.innerHeight-s.height-zI)),ready:!0}}function mO({text:t,hotkey:n,children:s,position:c="bottom",delay:d=400}){const m=Ye.useId(),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef(null),A=Ye.useRef(!1),F=Ye.useRef(!1),[D,J]=Ye.useState(!1),[$,G]=Ye.useState(null),[se,pe]=Ye.useState({left:0,top:0,ready:!1});Ye.useLayoutEffect(()=>{G(g.current?.closest(".volter-editor-theme")??null)},[]),Ye.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const ue=()=>{k.current&&clearTimeout(k.current),k.current=null,J(!1)},Ce=()=>{!A.current&&!F.current&&ue()},De=be=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{pe(X=>({...X,ready:!1})),J(!0)},be)};Ye.useLayoutEffect(()=>{if(!D)return;const be=()=>{const X=g.current?.getBoundingClientRect(),we=S.current?.getBoundingClientRect();if(!X||!we)return;const qe=VCr(c,X,we)?c:zCr(c);pe(UCr(qe,X,we))};return be(),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[n,c,t,D]);let Pe=s;if(Ye.isValidElement(s)){const be=[s.props["aria-describedby"],D?m:null].filter(Boolean).join(" ");Pe=Ye.cloneElement(s,be?{"aria-describedby":be}:{})}return q.jsxs("span",{ref:g,className:"volter-tooltip-anchor",onMouseEnter:()=>{A.current=!0,De(d)},onMouseLeave:()=>{A.current=!1,Ce()},onFocusCapture:()=>{F.current=!0,De(0)},onBlurCapture:be=>{be.currentTarget.contains(be.relatedTarget)||(F.current=!1,Ce())},children:[Pe,D&&$&&r2.createPortal(q.jsxs("div",{ref:S,id:m,role:"tooltip",className:"volter-tooltip",style:{left:se.left,top:se.top,visibility:se.ready?"visible":"hidden"},children:[q.jsx("span",{children:t}),n&&q.jsx("kbd",{children:n})]}),$)]})}function JCr({value:t,onChange:n,onAxisChange:s,step:c=.1,disabled:d=!1,testIdPrefix:m}){const g=k=>m?`${m}-${k}`:void 0,S=k=>A=>{if(s)s(k,A);else{const F=[t[0]??0,t[1]??0,t[2]??0];F[k]=A,n(F)}};return q.jsxs("div",{style:{display:"flex",gap:4},children:[q.jsx(SZ,{label:"X",labelColor:"#E06178",value:t[0],onChange:S(0),step:c,disabled:d,style:{flex:1},testId:g("x")}),q.jsx(SZ,{label:"Y",labelColor:"#C2ED66",value:t[1],onChange:S(1),step:c,disabled:d,style:{flex:1},testId:g("y")}),q.jsx(SZ,{label:"Z",labelColor:"#6BABF5",value:t[2],onChange:S(2),step:c,disabled:d,style:{flex:1},testId:g("z")})]})}const N5e={bg:Go.surface.panel,surface:Go.surface.chrome,surfaceHover:Go.surface.raised,border:Go.boundary.default,text:Go.content.primary,textMuted:Go.content.muted,onAccent:Go.content.onAccent,accent:Go.accent.default,neutralHover:Go.neutralOverlay.hover,radiusSmall:Go.shape.small,radiusMedium:Go.shape.medium,inputBg:Go.surface.inset,dynamic:Go.semantic.dynamic,dynamicBg:Go.semantic.dynamicMuted},o0n=Go.typography.sans,s0n=Go.typography.mono;function a0n(t,n){t.onChange(n)}function c0n(t,n){(t.onChangeEnd??t.onChange)(n)}const l0n={display:"flex",alignItems:"center",gap:4},u0n={fontSize:"var(--volter-font-sm)",color:Go.content.muted,marginBottom:2},WCr={fontSize:"var(--volter-font-base)",fontWeight:600,color:Go.content.muted,textTransform:"uppercase",letterSpacing:.4},HCr=72;function f0n({label:t,active:n,disabled:s,onClick:c,testId:d}){return q.jsx(Ms,{variant:n?"primary":"secondary",size:"compact","aria-pressed":n,disabled:s,"data-testid":d,onClick:()=>{s||c()},style:{flex:1},children:t})}function d0n(t){const n=t.match(/^(-?\d+\.?\d*)\s*(px|em|rem|%|vh|vw|deg|s|ms)?$/);if(n)return{num:Number.parseFloat(n[1]??"0"),unit:n[2]||""};const s=Number.parseFloat(t);return{num:Number.isNaN(s)?0:s,unit:""}}const O5e=22,Bht={width:O5e,height:O5e,flex:`0 0 ${O5e}px`,borderRadius:N5e.radiusSmall,border:`1px solid ${N5e.border}`,background:N5e.inputBg,objectFit:"cover",backgroundImage:"linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%),linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px"};function GCr({value:t,onChange:n,options:s,previewUrlFor:c,disabled:d,note:m,testId:g}){const S=t&&!s.includes(t)?[t,...s]:s;return q.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[t?q.jsx("img",{src:c(t),alt:"",style:Bht,"data-testid":`${g}-thumb`}):q.jsx("span",{style:Bht,"aria-hidden":"true"}),q.jsxs(Iw,{"data-testid":g,disabled:d,value:t,title:t||"No texture assigned",onChange:k=>n(k.target.value),style:{flex:1,minWidth:0},children:[q.jsx("option",{value:"",children:"—"}),S.map(k=>q.jsx("option",{value:k,children:k},k))]}),q.jsx(dm,{"data-testid":`${g}-clear`,"aria-label":"Clear this texture slot",title:"Clear this texture slot",disabled:d||!t,onClick:()=>n(""),children:q.jsx(dc,{icon:cLe})})]}),m&&q.jsx("span",{"data-testid":`${g}-note`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.muted},children:m})]})}function jRe({value:t,onCommit:n,onKeyDown:s,onFocus:c,...d}){const[m,g]=Ye.useState(null),S=Ye.useRef(!1),k=()=>{!S.current&&m!==null&&m!==t&&n(m),S.current=!1,g(null)};return q.jsx(Zm,{...d,value:m??t,onFocus:A=>{g(t),c?.(A)},onChange:A=>g(A.target.value),onBlur:k,onKeyDown:A=>{A.key==="Enter"&&A.target.blur(),A.key==="Escape"&&(S.current=!0,A.target.blur()),s?.(A)}})}const k_e=new Map,LRe=new Set;let m4t=0;function $ht(){m4t+=1;for(const t of LRe)t()}function p0n(t,n){return k_e.set(t,n),$ht(),()=>{k_e.get(t)===n&&(k_e.delete(t),$ht())}}function CBe(t){return LRe.add(t),()=>LRe.delete(t)}function o$(){return m4t}function s2(t){return t?k_e.get(t)??null:null}const QL=new Map;function _0n(t){QL.set(t,(QL.get(t)??0)+1);let n=!1;return()=>{if(n)return;n=!0;const s=(QL.get(t)??0)-1;s>0?QL.set(t,s):QL.delete(t)}}function KCr(t){return(QL.get(t)??0)>0}const PR=1e4;async function CC(t,n=4e3){if(t())return!0;const s=performance.now();return new Promise(c=>{const d=()=>{t()?c(!0):performance.now()-s>=n?c(!1):setTimeout(d,25)};setTimeout(d,0)})}const xZ=new Map,TB=new Set,dhe=new Set,A_e=new Set;let h4t=0;function g4t(){h4t+=1;for(const t of[...TB])t()}function XCr(t,n){return xZ.set(t,n),g4t(),()=>{xZ.get(t)===n&&xZ.delete(t)}}function YCr(t){xZ.has(t)&&g4t()}function ZCr(t){return TB.add(t),()=>{TB.delete(t)}}function qht(){return h4t}function cQ(t){return xZ.get(t)}function y4t(t,n=1e4){const s=cQ(t);return s!==void 0?Promise.resolve(s):new Promise(c=>{const d=()=>{const g=cQ(t);g!==void 0&&(clearTimeout(m),TB.delete(d),c(g))},m=setTimeout(()=>{TB.delete(d),c(void 0)},n);TB.add(d)})}function v4t(t){dhe.add(t);for(const n of[...A_e])n();return()=>{dhe.delete(t)}}function b4t(t,n=1e4){return dhe.has(t)?Promise.resolve(!0):new Promise(s=>{const c=()=>{dhe.has(t)&&(clearTimeout(d),A_e.delete(c),s(!0))},d=setTimeout(()=>{A_e.delete(c),s(!1)},n);A_e.add(c)})}async function EBe(t){if(KCr(t)&&!await CC(()=>s2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}let BRe=null;const ZY=new Map;let YO=[];function QCr(t){if(BRe=t,!t)return;const n=YO;YO=[];for(const s of n)S4t(t,s)}function S4t(t,n){ZY.get(n.id)?.();const s=t.show(n),c=()=>{ZY.get(n.id)===c&&(ZY.delete(n.id),s(),n.onDismiss?.())};return ZY.set(n.id,c),c}let eEr=0;function s$(t){const n=t.id??`notification-${++eEr}`,s={...t,id:n};return BRe?S4t(BRe,s):(YO=[...YO.filter(c=>c.id!==n),s],()=>kBe(n))}function kBe(t){const n=ZY.get(t);if(n){n();return}const s=YO.find(c=>c.id===t);s&&(YO=YO.filter(c=>c.id!==t),s.onDismiss?.())}let Xk={sessions:[],selectedSessionId:null,selectedSession:null,cursorMs:0,liveEdgeMs:0,loading:!0,error:null},phe=!0,kpe=null,D_e=null,RG=null,P_e=!1;const QY=new Set;function tEr(t,n,s){const c=t[0]??null;return c!==null&&n.length>0&&!n.some(m=>m.id===c.id)?{sessionId:c.id,latestAppeared:!0}:s&&t.some(m=>m.id===s)?{sessionId:s,latestAppeared:!1}:{sessionId:c?.id??null,latestAppeared:!1}}function _he(t){Xk=t;for(const n of QY)n()}async function rEr(){const t=await fetch("/__editor/gameplay-sessions");return(await L_(t,"Could not load Gameplay Sessions")).sessions}async function nEr(t){return L_(await fetch(`/__editor/gameplay-sessions/${encodeURIComponent(t)}`),"Could not load the selected Gameplay Session").then(n=>n.session)}async function iEr(){try{const t={sessions:await rEr()},n=tEr(t.sessions,Xk.sessions,D_e),s=n.sessionId;n.latestAppeared&&(phe=!0),D_e=s;const c=s?await nEr(s):null;if(D_e!==s){P_e=!0;return}const d=t.sessions.map(S=>S.id===c?.id?c:S),m=c?.durationMs??0,g=phe?m:Math.min(Xk.cursorMs,m);_he({sessions:d,selectedSessionId:s,selectedSession:c,cursorMs:g,liveEdgeMs:m,loading:!1,error:null})}catch(t){_he({...Xk,loading:!1,error:t instanceof Error?t.message:String(t)})}}function lQ(){return RG?(P_e=!0,RG):(RG=iEr().finally(()=>{RG=null,P_e&&(P_e=!1,lQ())}),RG)}function oEr(t){return QY.add(t),QY.size===1&&(lQ(),kpe=window.setInterval(()=>void lQ(),1e3)),()=>{QY.delete(t),QY.size===0&&kpe!==null&&(window.clearInterval(kpe),kpe=null)}}function sEr(t){const n=Xk.sessions.find(s=>s.id===t);n&&(D_e=n.id,phe=!0,_he({...Xk,selectedSessionId:n.id,selectedSession:n,cursorMs:n.durationMs,liveEdgeMs:n.durationMs}),lQ())}function aEr(t){const n=Math.max(0,Math.min(t,Xk.liveEdgeMs));phe=Xk.liveEdgeMs-n<250,_he({...Xk,cursorMs:n})}const x4t={getSnapshot:()=>Xk,subscribe:oEr,select:sEr,seek:aEr,refresh:lQ};let w4t=null;const $Re=new Set,m0n={getSnapshot:()=>w4t,subscribe(t){return $Re.add(t),()=>$Re.delete(t)}};function h0n(t){w4t=t;for(const n of $Re)try{n()}catch{}}let ZO={phase:null,at:0,run:0},dN=ZO;const qRe=new Map;let T4t=null;function cEr(t){T4t=t,C4t(ZO)}function C4t(t){ZO=t;try{T4t?.(t)}catch{}}function uQ(){const t=[...qRe.values()].at(-1),n=t?{...t,run:dN.run}:dN;n.phase===ZO.phase&&n.at===ZO.at&&n.run===ZO.run||C4t(n)}function g0n(t=Date.now()){return dN={phase:null,at:t,run:dN.run+1},uQ(),ZO.run}function y0n(t,n=Date.now()){dN={phase:t,at:n,run:dN.run},uQ()}function v0n(t=Date.now()){dN={phase:null,at:t,run:dN.run},uQ()}function ABe(t,n=Date.now()){const s=Symbol();return qRe.set(s,{phase:t.slice(0,160),at:n}),uQ(),()=>{qRe.delete(s)&&uQ()}}const lEr=Ye.lazy(()=>lo(()=>import("./GameplaySessionTimeline-Dm7lYtRi.js"),__vite__mapDeps([254,1,2,3,4,20,21,142,127,143,22,23])).then(t=>({default:t.GameplaySessionTimeline})));class DBe extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){console.error(`[tools] ${this.props.file} crashed while rendering:`,n,s.componentStack)}render(){return this.state.error?q.jsxs("div",{style:{padding:R_[6],fontSize:"var(--volter-font-md)",color:Go.semantic.danger,maxWidth:640},children:[q.jsxs("div",{style:{fontWeight:600,marginBottom:R_[2]},children:["Tool crashed: ",q.jsx("code",{children:this.props.file})]}),q.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)}),q.jsx("div",{style:{color:Go.content.muted,marginTop:R_[3]},children:"The editor is fine — fix the tool file and save; it reloads in place."})]}):this.props.children}}function uEr({contribution:t,Component:n,documentId:s,active:c,document:d,accountRevision:m,playKey:g}){const S=Ye.useRef(null),[k,A]=Ye.useState(null),F=Ye.useRef(null),D=Ye.useRef(null),J=Ye.useRef(t.file);J.current=t.file;const $=Ye.useRef(s);return $.current=s,Ye.useEffect(()=>{const G=S.current;if(!G)return;let se=!1;A(null);const pe=(De,Pe)=>{if(se)return;const be=De instanceof Error?De:new Error(String(De));console.error(`[tools] ${J.current} crashed while rendering:`,be,Pe?.componentStack),A(be),$.current&&v4t($.current)},ue=G.appendChild(document.createElement("div"));ue.style.display="contents";const Ce=rLe.createRoot(ue,{onUncaughtError:pe});return F.current=Ce,()=>{se=!0,F.current=null,D.current?.(),D.current=null,queueMicrotask(()=>{Ce.unmount(),ue.remove()})}},[]),Ye.useEffect(()=>{const G=F.current;if(!G)return;A(null);const se={contributionId:t.id,client:e0e(),surfaces:mBe,account:rBe(),work:Ce=>{D.current?.(),D.current=Ce===null?null:ABe(`building ${Ce.replace(/^building /,"")}`)},notify:Ce=>s$({...Ce,id:`contribution:${t.id}:${Ce.title}`,...Ce.tone==="warning"?{fades:!0}:{}}),...t.point==="workspace.analytics"?{gameplaySessions:x4t}:{play:Rye()},...s?{documentId:s,publishContext:Ce=>XCr(s,Ce)}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}},pe=n??t.Component,ue=Ye.createElement(pe,{...se,...t.tool?{tool:t.tool}:{}});G.render(s?Ye.createElement(fEr,{documentId:s},ue):ue)},[m,c,t,n,s,d,g]),q.jsxs(q.Fragment,{children:[k?q.jsxs("div",{style:{padding:R_[6],color:Go.semantic.danger},children:["Tool crashed: ",q.jsx("code",{children:t.file}),q.jsx("div",{style:{whiteSpace:"pre-wrap",marginTop:R_[2]},children:String(k)})]}):null,q.jsx("div",{ref:S,style:{minHeight:0,width:"100%"}})]})}function fEr({documentId:t,children:n}){return Ye.useEffect(()=>v4t(t),[t]),q.jsx(q.Fragment,{children:n})}function IR({contribution:t,Component:n,documentId:s,active:c,document:d}){const m=Ye.useSyncExternalStore(Dye,cN,cN),g=Ye.useSyncExternalStore(Fye,lN,lN),S=t.point==="workspace.analytics"?"gameplay-sessions":g;return q.jsxs("div",{"data-testid":`tool-panel-${t.id}`,style:{flex:1,minHeight:0,overflow:t.point==="workspace.analytics"?"visible":"auto",color:Go.content.primary,display:"flex",flexDirection:"column"},children:[t.point==="workspace.analytics"?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(lEr,{})}):null,q.jsx(DBe,{file:t.file,children:q.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:q.jsx(uEr,{contribution:t,...n?{Component:n}:{},accountRevision:m,playKey:S,...s?{documentId:s}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}})})})]})}function dEr({id:t,title:n,file:s,tool:c,Component:d,adapter:m,nodeId:g}){Ye.useSyncExternalStore(Dye,cN,cN),Ye.useSyncExternalStore(Fye,lN,lN);const S=g?m.hierarchy.node(g):null;return q.jsx("div",{className:"volter-inspector-tool-section","data-testid":`inspector-tool-${t}`,children:q.jsx(DBe,{file:s,children:q.jsx(Xvr,{adapter:m,nodeId:g,children:q.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:e0e(),surfaces:mBe,account:rBe(),play:Rye(),node:S,nodeId:g,adapter:m})})})})}const pEr=Symbol("volter.inspection.mixed");function zRe(t){return t===pEr}function PBe(t){return t.readonlyReason??"This field is read-only."}function IBe(t){return"column"}function NBe(t,n){return t.quickActions.filter(s=>s.placement===n)}const VRe="preview",zht="transform",R5e="properties",E4t="stories",b0n="story-args",S0n="Story Args";function Vht(t){return`group:${t}`}const k4t=100,_Er=1e3,fQ=2e3,A4t=3e3,mEr=4e3,hEr=5e3,gEr={nullSubjectId:null};function D4t(t){return"sections"in t}const I_e=[];let P4t=0;const URe=new Set;function Uht(){P4t++;for(const t of URe)t()}function yEr(t){return URe.add(t),()=>{URe.delete(t)}}function Jht(){return P4t}function I4t(t){return I_e.push(t),Uht(),()=>{const n=I_e.indexOf(t);n>=0&&(I_e.splice(n,1),Uht())}}function Wht(t,n,s=gEr){return I_e.filter(c=>c.match(t,n,s))}function N4t(t){if(typeof t!="object"||t===null)return!1;const n=t.name;return n==="Canceled"||n==="CancellationError"||n==="AbortError"}const vEr=1e3;class bEr{_entries=[];_listeners=new Set;_nextId=0;_version=0;_notifyScheduled=!1;_sink=null;setSink(n){this._sink=n}counts={info:0,warn:0,error:0};log(n,s){this._push("info",n,s)}warn(n,s){this._push("warn",n,s)}error(n,s){this._push("error",n,s)}logStructured(n,s,c,d,m){this._push(n,s,c,d,m)}clear(){this._entries=[],this.counts={info:0,warn:0,error:0},this._notify()}getEntries(){return this._entries}subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;_push(n,s,c,d,m){const g=this._entries[this._entries.length-1];if(g&&g.level===n&&g.message===s&&g.source===c&&g.metadata?.instanceId===m?.instanceId){g.count++,g.timestamp=Date.now(),this._sink?.(g),this._notify();return}const S={id:this._nextId++,timestamp:Date.now(),level:n,message:s,count:1};if(c&&(S.source=c),d&&(S.subsystem=d),m&&(S.metadata=m),this._entries.push(S),this.counts[n]++,this._sink?.(S),this._entries.length>vEr){const k=this._entries.shift();this.counts[k.level]=Math.max(0,this.counts[k.level]-1)}this._notify()}_notify(){this._version++,!this._notifyScheduled&&(this._notifyScheduled=!0,queueMicrotask(()=>{this._notifyScheduled=!1;for(const n of this._listeners)n()}))}}const Qs=new bEr;typeof window<"u"&&(window.__volterEditorConsole=Qs);const Hht=1e3,Ght=4e3;function CB(t){try{const n=t;return typeof t=="object"&&n!==null&&typeof n.stack=="string"&&n.stack!==""&&typeof n.message=="string"?n.stack.includes(n.message)?n.stack:`${String(t)}
45
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const g of t.seen.entries()){const S=g[1];if(n===g[0]){m(g);continue}if(t.external){const A=t.external.registry.get(g[0])?.id;if(n!==g[0]&&A){m(g);continue}}if(t.metadataRegistry.get(g[0])?.id){m(g);continue}if(S.cycle){m(g);continue}if(S.count>1&&t.reused==="ref"){m(g);continue}}}function Ume(t,n){const s=t.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=g=>{const S=t.seen.get(g);if(S.ref===null)return;const k=S.def??S.schema,A={...k},F=S.ref;if(S.ref=null,F){c(F);const J=t.seen.get(F),$=J.schema;if($.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push($)):Object.assign(k,$),Object.assign(k,A),g._zod.parent===F)for(const se in k)se==="$ref"||se==="allOf"||se in A||delete k[se];if($.$ref&&J.def)for(const se in k)se==="$ref"||se==="allOf"||se in J.def&&JSON.stringify(k[se])===JSON.stringify(J.def[se])&&delete k[se]}const D=g._zod.parent;if(D&&D!==F){c(D);const J=t.seen.get(D);if(J?.schema.$ref&&(k.$ref=J.schema.$ref,J.def))for(const $ in k)$==="$ref"||$==="allOf"||$ in J.def&&JSON.stringify(k[$])===JSON.stringify(J.def[$])&&delete k[$]}t.override({zodSchema:g,jsonSchema:k,path:S.path??[]})};for(const g of[...t.seen.entries()].reverse())c(g[0]);const d={};if(t.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?d.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?d.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const g=t.external.registry.get(n)?.id;if(!g)throw new Error("Schema is missing an `id` property");d.$id=t.external.uri(g)}Object.assign(d,s.def??s.schema);const m=t.external?.defs??{};for(const g of t.seen.entries()){const S=g[1];S.def&&S.defId&&(m[S.defId]=S.def)}t.external||Object.keys(m).length>0&&(t.target==="draft-2020-12"?d.$defs=m:d.definitions=m);try{const g=JSON.parse(JSON.stringify(d));return Object.defineProperty(g,"~standard",{value:{...n["~standard"],jsonSchema:{input:Jme(n,"input",t.processors),output:Jme(n,"output",t.processors)}},enumerable:!1,writable:!1}),g}catch{throw new Error("Error converting schema to JSON.")}}function W1(t,n){const s=n??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);const c=t._zod.def;if(c.type==="transform")return!0;if(c.type==="array")return W1(c.element,s);if(c.type==="set")return W1(c.valueType,s);if(c.type==="lazy")return W1(c.getter(),s);if(c.type==="promise"||c.type==="optional"||c.type==="nonoptional"||c.type==="nullable"||c.type==="readonly"||c.type==="default"||c.type==="prefault")return W1(c.innerType,s);if(c.type==="intersection")return W1(c.left,s)||W1(c.right,s);if(c.type==="record"||c.type==="map")return W1(c.keyType,s)||W1(c.valueType,s);if(c.type==="pipe")return W1(c.in,s)||W1(c.out,s);if(c.type==="object"){for(const d in c.shape)if(W1(c.shape[d],s))return!0;return!1}if(c.type==="union"){for(const d of c.options)if(W1(d,s))return!0;return!1}if(c.type==="tuple"){for(const d of c.items)if(W1(d,s))return!0;return!!(c.rest&&W1(c.rest,s))}return!1}const vSr=(t,n={})=>s=>{const c=zme({...s,processors:n});return F_(t,c),Vme(c,t),Ume(c,t)},Jme=(t,n,s={})=>c=>{const{libraryOptions:d,target:m}=c??{},g=zme({...d??{},target:m,io:n,processors:s});return F_(t,g),Vme(g,t),Ume(g,t)},bSr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},skt=(t,n,s,c)=>{const d=s;d.type="string";const{minimum:m,maximum:g,format:S,patterns:k,contentEncoding:A}=t._zod.bag;if(typeof m=="number"&&(d.minLength=m),typeof g=="number"&&(d.maxLength=g),S&&(d.format=bSr[S]??S,d.format===""&&delete d.format,S==="time"&&delete d.format),A&&(d.contentEncoding=A),k&&k.size>0){const F=[...k];F.length===1?d.pattern=F[0].source:F.length>1&&(d.allOf=[...F.map(D=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:D.source}))])}},akt=(t,n,s,c)=>{const d=s,{minimum:m,maximum:g,format:S,multipleOf:k,exclusiveMaximum:A,exclusiveMinimum:F}=t._zod.bag;typeof S=="string"&&S.includes("int")?d.type="integer":d.type="number",typeof F=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.minimum=F,d.exclusiveMinimum=!0):d.exclusiveMinimum=F),typeof m=="number"&&(d.minimum=m,typeof F=="number"&&n.target!=="draft-04"&&(F>=m?delete d.minimum:delete d.exclusiveMinimum)),typeof A=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.maximum=A,d.exclusiveMaximum=!0):d.exclusiveMaximum=A),typeof g=="number"&&(d.maximum=g,typeof A=="number"&&n.target!=="draft-04"&&(A<=g?delete d.maximum:delete d.exclusiveMaximum)),typeof k=="number"&&(d.multipleOf=k)},ckt=(t,n,s,c)=>{s.type="boolean"},lkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},ukt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},fkt=(t,n,s,c)=>{n.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},dkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},pkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},_kt=(t,n,s,c)=>{s.not={}},mkt=(t,n,s,c)=>{},hkt=(t,n,s,c)=>{},gkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ykt=(t,n,s,c)=>{const d=t._zod.def,m=gLe(d.entries);m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),s.enum=m},vkt=(t,n,s,c)=>{const d=t._zod.def,m=[];for(const g of d.values)if(g===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){const g=m[0];s.type=g===null?"null":typeof g,n.target==="draft-04"||n.target==="openapi-3.0"?s.enum=[g]:s.const=g}else m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),m.every(g=>typeof g=="boolean")&&(s.type="boolean"),m.every(g=>g===null)&&(s.type="null"),s.enum=m},bkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Skt=(t,n,s,c)=>{const d=s,m=t._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=m.source},xkt=(t,n,s,c)=>{const d=s,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:S,mime:k}=t._zod.bag;g!==void 0&&(m.minLength=g),S!==void 0&&(m.maxLength=S),k?k.length===1?(m.contentMediaType=k[0],Object.assign(d,m)):(Object.assign(d,m),d.anyOf=k.map(A=>({contentMediaType:A}))):Object.assign(d,m)},wkt=(t,n,s,c)=>{s.type="boolean"},Tkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ckt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Ekt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},kkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Akt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Dkt=(t,n,s,c)=>{const d=s,m=t._zod.def,{minimum:g,maximum:S}=t._zod.bag;typeof g=="number"&&(d.minItems=g),typeof S=="number"&&(d.maxItems=S),d.type="array",d.items=F_(m.element,n,{...c,path:[...c.path,"items"]})},Pkt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object",d.properties={};const g=m.shape;for(const A in g)d.properties[A]=F_(g[A],n,{...c,path:[...c.path,"properties",A]});const S=new Set(Object.keys(g)),k=new Set([...S].filter(A=>{const F=m.shape[A]._zod;return n.io==="input"?F.optin===void 0:F.optout===void 0}));k.size>0&&(d.required=Array.from(k)),m.catchall?._zod.def.type==="never"?d.additionalProperties=!1:m.catchall?m.catchall&&(d.additionalProperties=F_(m.catchall,n,{...c,path:[...c.path,"additionalProperties"]})):n.io==="output"&&(d.additionalProperties=!1)},TLe=(t,n,s,c)=>{const d=t._zod.def,m=d.inclusive===!1,g=d.options.map((S,k)=>F_(S,n,{...c,path:[...c.path,m?"oneOf":"anyOf",k]}));m?s.oneOf=g:s.anyOf=g},Ikt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.left,n,{...c,path:[...c.path,"allOf",0]}),g=F_(d.right,n,{...c,path:[...c.path,"allOf",1]}),S=A=>"allOf"in A&&Object.keys(A).length===1,k=[...S(m)?m.allOf:[m],...S(g)?g.allOf:[g]];s.allOf=k},Nkt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="array";const g=n.target==="draft-2020-12"?"prefixItems":"items",S=n.target==="draft-2020-12"||n.target==="openapi-3.0"?"items":"additionalItems",k=m.items.map((J,$)=>F_(J,n,{...c,path:[...c.path,g,$]})),A=m.rest?F_(m.rest,n,{...c,path:[...c.path,S,...n.target==="openapi-3.0"?[m.items.length]:[]]}):null;n.target==="draft-2020-12"?(d.prefixItems=k,A&&(d.items=A)):n.target==="openapi-3.0"?(d.items={anyOf:k},A&&d.items.anyOf.push(A),d.minItems=k.length,A||(d.maxItems=k.length)):(d.items=k,A&&(d.additionalItems=A));const{minimum:F,maximum:D}=t._zod.bag;typeof F=="number"&&(d.minItems=F),typeof D=="number"&&(d.maxItems=D)},Okt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object";const g=m.keyType,k=g._zod.bag?.patterns;if(m.mode==="loose"&&k&&k.size>0){const F=F_(m.valueType,n,{...c,path:[...c.path,"patternProperties","*"]});d.patternProperties={};for(const D of k)d.patternProperties[D.source]=F}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(d.propertyNames=F_(m.keyType,n,{...c,path:[...c.path,"propertyNames"]})),d.additionalProperties=F_(m.valueType,n,{...c,path:[...c.path,"additionalProperties"]});const A=g._zod.values;if(A){const F=[...A].filter(D=>typeof D=="string"||typeof D=="number");F.length>0&&(d.required=F)}},Rkt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.innerType,n,c),g=n.seen.get(t);n.target==="openapi-3.0"?(g.ref=d.innerType,s.nullable=!0):s.anyOf=[m,{type:"null"}]},Fkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},Mkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.default=JSON.parse(JSON.stringify(d.defaultValue))},jkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,n.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(d.defaultValue)))},Lkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType;let g;try{g=d.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=g},Bkt=(t,n,s,c)=>{const d=t._zod.def,m=n.io==="input"?d.in._zod.def.type==="transform"?d.out:d.in:d.out;F_(m,n,c);const g=n.seen.get(t);g.ref=m},$kt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.readOnly=!0},qkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},CLe=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},zkt=(t,n,s,c)=>{const d=t._zod.innerType;F_(d,n,c);const m=n.seen.get(t);m.ref=d},iht={string:skt,number:akt,boolean:ckt,bigint:lkt,symbol:ukt,null:fkt,undefined:dkt,void:pkt,never:_kt,any:mkt,unknown:hkt,date:gkt,enum:ykt,literal:vkt,nan:bkt,template_literal:Skt,file:xkt,success:wkt,custom:Tkt,function:Ckt,transform:Ekt,map:kkt,set:Akt,array:Dkt,object:Pkt,union:TLe,intersection:Ikt,tuple:Nkt,record:Okt,nullable:Rkt,nonoptional:Fkt,default:Mkt,prefault:jkt,catch:Lkt,pipe:Bkt,readonly:$kt,promise:qkt,optional:CLe,lazy:zkt};function SSr(t,n){if("_idmap"in t){const c=t,d=zme({...n,processors:iht}),m={};for(const k of c._idmap.entries()){const[A,F]=k;F_(F,d)}const g={},S={registry:c,uri:n?.uri,defs:m};d.external=S;for(const k of c._idmap.entries()){const[A,F]=k;Vme(d,F),g[A]=Ume(d,F)}if(Object.keys(m).length>0){const k=d.target==="draft-2020-12"?"$defs":"definitions";g.__shared={[k]:m}}return{schemas:g}}const s=zme({...n,processors:iht});return F_(t,s),Vme(s,t),Ume(s,t)}const Vkt=ui("ZodISODateTime",(t,n)=>{Cbr.init(t,n),j_.init(t,n)});function Ukt(t){return D2r(Vkt,t)}const Jkt=ui("ZodISODate",(t,n)=>{Ebr.init(t,n),j_.init(t,n)});function Wkt(t){return P2r(Jkt,t)}const Hkt=ui("ZodISOTime",(t,n)=>{kbr.init(t,n),j_.init(t,n)});function Gkt(t){return I2r(Hkt,t)}const Kkt=ui("ZodISODuration",(t,n)=>{Abr.init(t,n),j_.init(t,n)});function Xkt(t){return N2r(Kkt,t)}const Fgn=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:Jkt,ZodISODateTime:Vkt,ZodISODuration:Kkt,ZodISOTime:Hkt,date:Wkt,datetime:Ukt,duration:Xkt,time:Gkt},Symbol.toStringTag,{value:"Module"})),Ykt=(t,n)=>{MCt.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:s=>v1r(t,s)},flatten:{value:s=>y1r(t,s)},addIssue:{value:s=>{t.issues.push(s),t.message=JSON.stringify(t.issues,Lme,2)}},addIssues:{value:s=>{t.issues.push(...s),t.message=JSON.stringify(t.issues,Lme,2)}},isEmpty:{get(){return t.issues.length===0}}})},Mgn=ui("ZodError",Ykt),Fw=ui("ZodError",Ykt,{Parent:Error}),xSr=hye(Fw),wSr=gye(Fw),TSr=yye(Fw),CSr=vye(Fw),ESr=jCt(Fw),kSr=LCt(Fw),ASr=BCt(Fw),DSr=$Ct(Fw),PSr=qCt(Fw),ISr=zCt(Fw),NSr=VCt(Fw),OSr=UCt(Fw),Lu=ui("ZodType",(t,n)=>(vu.init(t,n),Object.assign(t["~standard"],{jsonSchema:{input:Jme(t,"input"),output:Jme(t,"output")}}),t.toJSONSchema=vSr(t,{}),t.def=n,t.type=n.type,Object.defineProperty(t,"_def",{value:n}),t.check=(...s)=>t.clone(oA(n,{checks:[...n.checks??[],...s.map(c=>typeof c=="function"?{_zod:{check:c,def:{check:"custom"},onattach:[]}}:c)]}),{parent:!0}),t.with=t.check,t.clone=(s,c)=>sA(t,s,c),t.brand=()=>t,t.register=((s,c)=>(s.add(t,c),t)),t.parse=(s,c)=>xSr(t,s,c,{callee:t.parse}),t.safeParse=(s,c)=>TSr(t,s,c),t.parseAsync=async(s,c)=>wSr(t,s,c,{callee:t.parseAsync}),t.safeParseAsync=async(s,c)=>CSr(t,s,c),t.spa=t.safeParseAsync,t.encode=(s,c)=>ESr(t,s,c),t.decode=(s,c)=>kSr(t,s,c),t.encodeAsync=async(s,c)=>ASr(t,s,c),t.decodeAsync=async(s,c)=>DSr(t,s,c),t.safeEncode=(s,c)=>PSr(t,s,c),t.safeDecode=(s,c)=>ISr(t,s,c),t.safeEncodeAsync=async(s,c)=>NSr(t,s,c),t.safeDecodeAsync=async(s,c)=>OSr(t,s,c),t.refine=(s,c)=>t.check(LAt(s,c)),t.superRefine=s=>t.check(BAt(s)),t.overwrite=s=>t.check(M$(s)),t.optional=()=>Gme(t),t.exactOptional=()=>bAt(t),t.nullable=()=>Kme(t),t.nullish=()=>Gme(Kme(t)),t.nonoptional=s=>EAt(t,s),t.array=()=>Gd(t),t.or=s=>AR([t,s]),t.and=s=>KLe(t,s),t.transform=s=>Xme(t,XLe(s)),t.default=s=>wAt(t,s),t.prefault=s=>CAt(t,s),t.catch=s=>DAt(t,s),t.pipe=s=>Xme(t,s),t.readonly=()=>NAt(t),t.describe=s=>{const c=t.clone();return sD.add(c,{description:s}),c},Object.defineProperty(t,"description",{get(){return sD.get(t)?.description},configurable:!0}),t.meta=(...s)=>{if(s.length===0)return sD.get(t);const c=t.clone();return sD.add(c,s[0]),c},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=s=>s(t),t)),ELe=ui("_ZodString",(t,n)=>{Sye.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>skt(t,c,d);const s=t._zod.bag;t.format=s.format??null,t.minLength=s.minimum??null,t.maxLength=s.maximum??null,t.regex=(...c)=>t.check(Z2r(...c)),t.includes=(...c)=>t.check(tSr(...c)),t.startsWith=(...c)=>t.check(rSr(...c)),t.endsWith=(...c)=>t.check(nSr(...c)),t.min=(...c)=>t.check(qme(...c)),t.max=(...c)=>t.check(ikt(...c)),t.length=(...c)=>t.check(okt(...c)),t.nonempty=(...c)=>t.check(qme(1,...c)),t.lowercase=c=>t.check(Q2r(c)),t.uppercase=c=>t.check(eSr(c)),t.trim=()=>t.check(sSr()),t.normalize=(...c)=>t.check(oSr(...c)),t.toLowerCase=()=>t.check(aSr()),t.toUpperCase=()=>t.check(cSr()),t.slugify=()=>t.check(lSr())}),kLe=ui("ZodString",(t,n)=>{Sye.init(t,n),ELe.init(t,n),t.email=s=>t.check(jEt(ALe,s)),t.url=s=>t.check(xLe(wye,s)),t.jwt=s=>t.check(rkt(VLe,s)),t.emoji=s=>t.check(zEt(DLe,s)),t.guid=s=>t.check(tRe(Wme,s)),t.uuid=s=>t.check(LEt(aD,s)),t.uuidv4=s=>t.check(BEt(aD,s)),t.uuidv6=s=>t.check($Et(aD,s)),t.uuidv7=s=>t.check(qEt(aD,s)),t.nanoid=s=>t.check(VEt(PLe,s)),t.guid=s=>t.check(tRe(Wme,s)),t.cuid=s=>t.check(UEt(ILe,s)),t.cuid2=s=>t.check(JEt(NLe,s)),t.ulid=s=>t.check(WEt(OLe,s)),t.base64=s=>t.check(QEt($Le,s)),t.base64url=s=>t.check(ekt(qLe,s)),t.xid=s=>t.check(HEt(RLe,s)),t.ksuid=s=>t.check(GEt(FLe,s)),t.ipv4=s=>t.check(KEt(MLe,s)),t.ipv6=s=>t.check(XEt(jLe,s)),t.cidrv4=s=>t.check(YEt(LLe,s)),t.cidrv6=s=>t.check(ZEt(BLe,s)),t.e164=s=>t.check(tkt(zLe,s)),t.datetime=s=>t.check(Ukt(s)),t.date=s=>t.check(Wkt(s)),t.time=s=>t.check(Gkt(s)),t.duration=s=>t.check(Xkt(s))});function bo(t){return k2r(kLe,t)}const j_=ui("ZodStringFormat",(t,n)=>{M_.init(t,n),ELe.init(t,n)}),ALe=ui("ZodEmail",(t,n)=>{hbr.init(t,n),j_.init(t,n)});function RSr(t){return jEt(ALe,t)}const Wme=ui("ZodGUID",(t,n)=>{_br.init(t,n),j_.init(t,n)});function FSr(t){return tRe(Wme,t)}const aD=ui("ZodUUID",(t,n)=>{mbr.init(t,n),j_.init(t,n)});function MSr(t){return LEt(aD,t)}function jSr(t){return BEt(aD,t)}function LSr(t){return $Et(aD,t)}function BSr(t){return qEt(aD,t)}const wye=ui("ZodURL",(t,n)=>{gbr.init(t,n),j_.init(t,n)});function $Sr(t){return xLe(wye,t)}function qSr(t){return xLe(wye,{protocol:/^https?$/,hostname:lEt,...Jo(t)})}const DLe=ui("ZodEmoji",(t,n)=>{ybr.init(t,n),j_.init(t,n)});function zSr(t){return zEt(DLe,t)}const PLe=ui("ZodNanoID",(t,n)=>{vbr.init(t,n),j_.init(t,n)});function VSr(t){return VEt(PLe,t)}const ILe=ui("ZodCUID",(t,n)=>{bbr.init(t,n),j_.init(t,n)});function USr(t){return UEt(ILe,t)}const NLe=ui("ZodCUID2",(t,n)=>{Sbr.init(t,n),j_.init(t,n)});function JSr(t){return JEt(NLe,t)}const OLe=ui("ZodULID",(t,n)=>{xbr.init(t,n),j_.init(t,n)});function WSr(t){return WEt(OLe,t)}const RLe=ui("ZodXID",(t,n)=>{wbr.init(t,n),j_.init(t,n)});function HSr(t){return HEt(RLe,t)}const FLe=ui("ZodKSUID",(t,n)=>{Tbr.init(t,n),j_.init(t,n)});function GSr(t){return GEt(FLe,t)}const MLe=ui("ZodIPv4",(t,n)=>{Dbr.init(t,n),j_.init(t,n)});function KSr(t){return KEt(MLe,t)}const Zkt=ui("ZodMAC",(t,n)=>{Ibr.init(t,n),j_.init(t,n)});function XSr(t){return A2r(Zkt,t)}const jLe=ui("ZodIPv6",(t,n)=>{Pbr.init(t,n),j_.init(t,n)});function YSr(t){return XEt(jLe,t)}const LLe=ui("ZodCIDRv4",(t,n)=>{Nbr.init(t,n),j_.init(t,n)});function ZSr(t){return YEt(LLe,t)}const BLe=ui("ZodCIDRv6",(t,n)=>{Obr.init(t,n),j_.init(t,n)});function QSr(t){return ZEt(BLe,t)}const $Le=ui("ZodBase64",(t,n)=>{Rbr.init(t,n),j_.init(t,n)});function exr(t){return QEt($Le,t)}const qLe=ui("ZodBase64URL",(t,n)=>{Mbr.init(t,n),j_.init(t,n)});function txr(t){return ekt(qLe,t)}const zLe=ui("ZodE164",(t,n)=>{jbr.init(t,n),j_.init(t,n)});function rxr(t){return tkt(zLe,t)}const VLe=ui("ZodJWT",(t,n)=>{Bbr.init(t,n),j_.init(t,n)});function nxr(t){return rkt(VLe,t)}const mee=ui("ZodCustomStringFormat",(t,n)=>{$br.init(t,n),j_.init(t,n)});function ixr(t,n,s={}){return xye(mee,t,n,s)}function oxr(t){return xye(mee,"hostname",cEt,t)}function sxr(t){return xye(mee,"hex",TEt,t)}function axr(t,n){const s=n?.enc??"hex",c=`${t}_${s}`,d=H1r[c];if(!d)throw new Error(`Unrecognized hash format: ${c}`);return xye(mee,c,d,n)}const ULe=ui("ZodNumber",(t,n)=>{DEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>akt(t,c,d),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.int=c=>t.check(nRe(c)),t.safe=c=>t.check(nRe(c)),t.positive=c=>t.check(QZ(0,c)),t.nonnegative=c=>t.check(qk(0,c)),t.negative=c=>t.check(ZZ(0,c)),t.nonpositive=c=>t.check(XI(0,c)),t.multipleOf=(c,d)=>t.check(rRe(c,d)),t.step=(c,d)=>t.check(rRe(c,d)),t.finite=()=>t;const s=t._zod.bag;t.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),t.isFinite=!0,t.format=s.format??null});function fu(t){return O2r(ULe,t)}const j$=ui("ZodNumberFormat",(t,n)=>{qbr.init(t,n),ULe.init(t,n)});function nRe(t){return R2r(j$,t)}function cxr(t){return F2r(j$,t)}function lxr(t){return M2r(j$,t)}function uxr(t){return j2r(j$,t)}function fxr(t){return L2r(j$,t)}const JLe=ui("ZodBoolean",(t,n)=>{PEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ckt(t,s,c)});function _y(t){return B2r(JLe,t)}const WLe=ui("ZodBigInt",(t,n)=>{IEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>lkt(t,c),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.positive=c=>t.check(QZ(BigInt(0),c)),t.negative=c=>t.check(ZZ(BigInt(0),c)),t.nonpositive=c=>t.check(XI(BigInt(0),c)),t.nonnegative=c=>t.check(qk(BigInt(0),c)),t.multipleOf=(c,d)=>t.check(rRe(c,d));const s=t._zod.bag;t.minValue=s.minimum??null,t.maxValue=s.maximum??null,t.format=s.format??null});function dxr(t){return $2r(WLe,t)}const HLe=ui("ZodBigIntFormat",(t,n)=>{zbr.init(t,n),WLe.init(t,n)});function pxr(t){return q2r(HLe,t)}function _xr(t){return z2r(HLe,t)}const Qkt=ui("ZodSymbol",(t,n)=>{Vbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ukt(t,s)});function mxr(t){return V2r(Qkt,t)}const eAt=ui("ZodUndefined",(t,n)=>{Ubr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>dkt(t,s)});function hxr(t){return U2r(eAt,t)}const tAt=ui("ZodNull",(t,n)=>{Jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>fkt(t,s,c)});function rAt(t){return J2r(tAt,t)}const nAt=ui("ZodAny",(t,n)=>{Wbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>mkt()});function gxr(){return W2r(nAt)}const iAt=ui("ZodUnknown",(t,n)=>{Hbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>hkt()});function t$(){return H2r(iAt)}const oAt=ui("ZodNever",(t,n)=>{Gbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>_kt(t,s,c)});function GLe(t){return G2r(oAt,t)}const sAt=ui("ZodVoid",(t,n)=>{Kbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>pkt(t,s)});function yxr(t){return K2r(sAt,t)}const aAt=ui("ZodDate",(t,n)=>{Xbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>gkt(t,c),t.min=(c,d)=>t.check(qk(c,d)),t.max=(c,d)=>t.check(XI(c,d));const s=t._zod.bag;t.minDate=s.minimum?new Date(s.minimum):null,t.maxDate=s.maximum?new Date(s.maximum):null});function vxr(t){return X2r(aAt,t)}const cAt=ui("ZodArray",(t,n)=>{Ybr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Dkt(t,s,c,d),t.element=n.element,t.min=(s,c)=>t.check(qme(s,c)),t.nonempty=s=>t.check(qme(1,s)),t.max=(s,c)=>t.check(ikt(s,c)),t.length=(s,c)=>t.check(okt(s,c)),t.unwrap=()=>t.element});function Gd(t,n){return uSr(cAt,t,n)}function bxr(t){const n=t._zod.def.shape;return ed(Object.keys(n))}const Tye=ui("ZodObject",(t,n)=>{Qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Pkt(t,s,c,d),Gu(t,"shape",()=>n.shape),t.keyof=()=>ed(Object.keys(t._zod.def.shape)),t.catchall=s=>t.clone({...t._zod.def,catchall:s}),t.passthrough=()=>t.clone({...t._zod.def,catchall:t$()}),t.loose=()=>t.clone({...t._zod.def,catchall:t$()}),t.strict=()=>t.clone({...t._zod.def,catchall:GLe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=s=>ACt(t,s),t.safeExtend=s=>DCt(t,s),t.merge=s=>PCt(t,s),t.pick=s=>ECt(t,s),t.omit=s=>kCt(t,s),t.partial=(...s)=>ICt(YLe,t,s[0]),t.required=(...s)=>NCt(ZLe,t,s[0])});function Pa(t,n){const s={type:"object",shape:t??{},...Jo(n)};return new Tye(s)}function Sxr(t,n){return new Tye({type:"object",shape:t,catchall:GLe(),...Jo(n)})}function xxr(t,n){return new Tye({type:"object",shape:t,catchall:t$(),...Jo(n)})}const Cye=ui("ZodUnion",(t,n)=>{SLe.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>TLe(t,s,c,d),t.options=n.options});function AR(t,n){return new Cye({type:"union",options:t,...Jo(n)})}const lAt=ui("ZodXor",(t,n)=>{Cye.init(t,n),e2r.init(t,n),t._zod.processJSONSchema=(s,c,d)=>TLe(t,s,c,d),t.options=n.options});function wxr(t,n){return new lAt({type:"union",options:t,inclusive:!1,...Jo(n)})}const uAt=ui("ZodDiscriminatedUnion",(t,n)=>{Cye.init(t,n),t2r.init(t,n)});function fAt(t,n,s){return new uAt({type:"union",options:n,discriminator:t,...Jo(s)})}const dAt=ui("ZodIntersection",(t,n)=>{r2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ikt(t,s,c,d)});function KLe(t,n){return new dAt({type:"intersection",left:t,right:n})}const pAt=ui("ZodTuple",(t,n)=>{REt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Nkt(t,s,c,d),t.rest=s=>t.clone({...t._zod.def,rest:s})});function Hme(t,n,s){const c=n instanceof vu,d=c?s:n,m=c?n:null;return new pAt({type:"tuple",items:t,rest:m,...Jo(d)})}const Eye=ui("ZodRecord",(t,n)=>{n2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Okt(t,s,c,d),t.keyType=n.keyType,t.valueType=n.valueType});function wD(t,n,s){return new Eye({type:"record",keyType:t,valueType:n,...Jo(s)})}function Txr(t,n,s){const c=sA(t);return c._zod.values=void 0,new Eye({type:"record",keyType:c,valueType:n,...Jo(s)})}function Cxr(t,n,s){return new Eye({type:"record",keyType:t,valueType:n,mode:"loose",...Jo(s)})}const _At=ui("ZodMap",(t,n)=>{i2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>kkt(t,s),t.keyType=n.keyType,t.valueType=n.valueType,t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(wLe(...s)),t.size=(...s)=>t.check(nkt(...s))});function Exr(t,n,s){return new _At({type:"map",keyType:t,valueType:n,...Jo(s)})}const mAt=ui("ZodSet",(t,n)=>{o2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Akt(t,s),t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(wLe(...s)),t.size=(...s)=>t.check(nkt(...s))});function kxr(t,n){return new mAt({type:"set",valueType:t,...Jo(n)})}const tQ=ui("ZodEnum",(t,n)=>{s2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>ykt(t,c,d),t.enum=n.entries,t.options=Object.values(n.entries);const s=new Set(Object.keys(n.entries));t.extract=(c,d)=>{const m={};for(const g of c)if(s.has(g))m[g]=n.entries[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})},t.exclude=(c,d)=>{const m={...n.entries};for(const g of c)if(s.has(g))delete m[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})}});function ed(t,n){const s=Array.isArray(t)?Object.fromEntries(t.map(c=>[c,c])):t;return new tQ({type:"enum",entries:s,...Jo(n)})}function Axr(t,n){return new tQ({type:"enum",entries:t,...Jo(n)})}const hAt=ui("ZodLiteral",(t,n)=>{a2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vkt(t,s,c),t.values=new Set(n.values),Object.defineProperty(t,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Dg(t,n){return new hAt({type:"literal",values:Array.isArray(t)?t:[t],...Jo(n)})}const gAt=ui("ZodFile",(t,n)=>{c2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>xkt(t,s,c),t.min=(s,c)=>t.check(eQ(s,c)),t.max=(s,c)=>t.check(wLe(s,c)),t.mime=(s,c)=>t.check(iSr(Array.isArray(s)?s:[s],c))});function Dxr(t){return fSr(gAt,t)}const yAt=ui("ZodTransform",(t,n)=>{l2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ekt(t,s),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new hLe(t.constructor.name);s.addIssue=m=>{if(typeof m=="string")s.issues.push(QB(m,s.value,n));else{const g=m;g.fatal&&(g.continue=!1),g.code??(g.code="custom"),g.input??(g.input=s.value),g.inst??(g.inst=t),s.issues.push(QB(g))}};const d=n.transform(s.value,s);return d instanceof Promise?d.then(m=>(s.value=m,s)):(s.value=d,s)}});function XLe(t){return new yAt({type:"transform",transform:t})}const YLe=ui("ZodOptional",(t,n)=>{FEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>CLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Gme(t){return new YLe({type:"optional",innerType:t})}const vAt=ui("ZodExactOptional",(t,n)=>{u2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>CLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function bAt(t){return new vAt({type:"optional",innerType:t})}const SAt=ui("ZodNullable",(t,n)=>{f2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Rkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Kme(t){return new SAt({type:"nullable",innerType:t})}function Pxr(t){return Gme(Kme(t))}const xAt=ui("ZodDefault",(t,n)=>{d2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Mkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function wAt(t,n){return new xAt({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():pye(n)}})}const TAt=ui("ZodPrefault",(t,n)=>{p2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>jkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function CAt(t,n){return new TAt({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():pye(n)}})}const ZLe=ui("ZodNonOptional",(t,n)=>{_2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Fkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function EAt(t,n){return new ZLe({type:"nonoptional",innerType:t,...Jo(n)})}const kAt=ui("ZodSuccess",(t,n)=>{m2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>wkt(t,s,c),t.unwrap=()=>t._zod.def.innerType});function Ixr(t){return new kAt({type:"success",innerType:t})}const AAt=ui("ZodCatch",(t,n)=>{h2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Lkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function DAt(t,n){return new AAt({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const PAt=ui("ZodNaN",(t,n)=>{g2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bkt(t,s)});function Nxr(t){return Y2r(PAt,t)}const QLe=ui("ZodPipe",(t,n)=>{y2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Bkt(t,s,c,d),t.in=n.in,t.out=n.out});function Xme(t,n){return new QLe({type:"pipe",in:t,out:n})}const eBe=ui("ZodCodec",(t,n)=>{QLe.init(t,n),MEt.init(t,n)});function Oxr(t,n,s){return new eBe({type:"pipe",in:t,out:n,transform:s.decode,reverseTransform:s.encode})}const IAt=ui("ZodReadonly",(t,n)=>{v2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>$kt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function NAt(t){return new IAt({type:"readonly",innerType:t})}const OAt=ui("ZodTemplateLiteral",(t,n)=>{b2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Skt(t,s,c)});function Rxr(t,n){return new OAt({type:"template_literal",parts:t,...Jo(n)})}const RAt=ui("ZodLazy",(t,n)=>{w2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>zkt(t,s,c,d),t.unwrap=()=>t._zod.def.getter()});function FAt(t){return new RAt({type:"lazy",getter:t})}const MAt=ui("ZodPromise",(t,n)=>{x2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>qkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Fxr(t){return new MAt({type:"promise",innerType:t})}const jAt=ui("ZodFunction",(t,n)=>{S2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ckt(t,s)});function oht(t){return new jAt({type:"function",input:Array.isArray(t?.input)?Hme(t?.input):t?.input??Gd(t$()),output:t?.output??t$()})}const kye=ui("ZodCustom",(t,n)=>{T2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Tkt(t,s)});function Mxr(t){const n=new eh({check:"custom"});return n._zod.check=t,n}function YI(t,n){return dSr(kye,t??(()=>!0),n)}function LAt(t,n={}){return pSr(kye,t,n)}function BAt(t){return _Sr(t)}const jxr=hSr,Lxr=gSr;function Bxr(t,n={}){const s=new kye({type:"custom",check:"custom",fn:c=>c instanceof t,abort:!0,...Jo(n)});return s._zod.bag.Class=t,s._zod.check=c=>{c.value instanceof t||c.issues.push({code:"invalid_type",expected:t.name,input:c.value,inst:s,path:[...s._zod.def.path??[]]})},s}const $xr=(...t)=>ySr({Codec:eBe,Boolean:JLe,String:kLe},...t);function qxr(t){const n=FAt(()=>AR([bo(t),fu(),_y(),rAt(),Gd(n),wD(bo(),n)]));return n}function $At(t,n){return Xme(XLe(t),n)}const jgn=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:nAt,ZodArray:cAt,ZodBase64:$Le,ZodBase64URL:qLe,ZodBigInt:WLe,ZodBigIntFormat:HLe,ZodBoolean:JLe,ZodCIDRv4:LLe,ZodCIDRv6:BLe,ZodCUID:ILe,ZodCUID2:NLe,ZodCatch:AAt,ZodCodec:eBe,ZodCustom:kye,ZodCustomStringFormat:mee,ZodDate:aAt,ZodDefault:xAt,ZodDiscriminatedUnion:uAt,ZodE164:zLe,ZodEmail:ALe,ZodEmoji:DLe,ZodEnum:tQ,ZodExactOptional:vAt,ZodFile:gAt,ZodFunction:jAt,ZodGUID:Wme,ZodIPv4:MLe,ZodIPv6:jLe,ZodIntersection:dAt,ZodJWT:VLe,ZodKSUID:FLe,ZodLazy:RAt,ZodLiteral:hAt,ZodMAC:Zkt,ZodMap:_At,ZodNaN:PAt,ZodNanoID:PLe,ZodNever:oAt,ZodNonOptional:ZLe,ZodNull:tAt,ZodNullable:SAt,ZodNumber:ULe,ZodNumberFormat:j$,ZodObject:Tye,ZodOptional:YLe,ZodPipe:QLe,ZodPrefault:TAt,ZodPromise:MAt,ZodReadonly:IAt,ZodRecord:Eye,ZodSet:mAt,ZodString:kLe,ZodStringFormat:j_,ZodSuccess:kAt,ZodSymbol:Qkt,ZodTemplateLiteral:OAt,ZodTransform:yAt,ZodTuple:pAt,ZodType:Lu,ZodULID:OLe,ZodURL:wye,ZodUUID:aD,ZodUndefined:eAt,ZodUnion:Cye,ZodUnknown:iAt,ZodVoid:sAt,ZodXID:RLe,ZodXor:lAt,_ZodString:ELe,_default:wAt,_function:oht,any:gxr,array:Gd,base64:exr,base64url:txr,bigint:dxr,boolean:_y,catch:DAt,check:Mxr,cidrv4:ZSr,cidrv6:QSr,codec:Oxr,cuid:USr,cuid2:JSr,custom:YI,date:vxr,describe:jxr,discriminatedUnion:fAt,e164:rxr,email:RSr,emoji:zSr,enum:ed,exactOptional:bAt,file:Dxr,float32:cxr,float64:lxr,function:oht,guid:FSr,hash:axr,hex:sxr,hostname:oxr,httpUrl:qSr,instanceof:Bxr,int:nRe,int32:uxr,int64:pxr,intersection:KLe,ipv4:KSr,ipv6:YSr,json:qxr,jwt:nxr,keyof:bxr,ksuid:GSr,lazy:FAt,literal:Dg,looseObject:xxr,looseRecord:Cxr,mac:XSr,map:Exr,meta:Lxr,nan:Nxr,nanoid:VSr,nativeEnum:Axr,never:GLe,nonoptional:EAt,null:rAt,nullable:Kme,nullish:Pxr,number:fu,object:Pa,optional:Gme,partialRecord:Txr,pipe:Xme,prefault:CAt,preprocess:$At,promise:Fxr,readonly:NAt,record:wD,refine:LAt,set:kxr,strictObject:Sxr,string:bo,stringFormat:ixr,stringbool:$xr,success:Ixr,superRefine:BAt,symbol:mxr,templateLiteral:Rxr,transform:XLe,tuple:Hme,uint32:fxr,uint64:_xr,ulid:WSr,undefined:hxr,union:AR,unknown:t$,url:$Sr,uuid:MSr,uuidv4:jSr,uuidv6:LSr,uuidv7:BSr,void:yxr,xid:HSr,xor:wxr},Symbol.toStringTag,{value:"Module"})),sht={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Lgn(t){$S({customError:t})}function Bgn(){return $S().customError}var aht;aht||(aht={});const cht=ed(["mock","live"]),zxr=Pa({id:bo().min(1),name:bo().min(1),status:ed(["free","trialing","active","past_due","cancelling"]),interval:ed(["month","year"]).optional(),renewsAt:bo().datetime().optional(),endsAt:bo().datetime().optional()}),Vxr=Pa({included:fu().nonnegative(),purchased:fu().nonnegative(),used:fu().nonnegative(),reserved:fu().nonnegative(),remaining:fu().nonnegative(),resetsAt:bo().datetime().optional(),purchasedExpiresAt:bo().datetime().optional()}),Uxr=Pa({overageEnabled:_y(),monthlyLimitCredits:fu().nonnegative(),alertThresholds:Gd(fu().min(1).max(100)).max(8),autoReload:Pa({enabled:_y(),whenRemainingBelow:fu().nonnegative(),reloadTo:fu().positive(),monthlyLimitCredits:fu().nonnegative()}).optional()}),Jxr=Pa({id:bo().min(1),kind:ed(["threshold","auto_reload_succeeded","auto_reload_failed"]),message:bo().min(1),createdAt:bo().datetime(),readAt:bo().datetime().optional()}),Wxr=Pa({id:bo().min(1),email:bo().email(),name:bo().min(1).optional()}),Hxr=Pa({name:bo().min(1),verified:_y(),enrollmentMode:ed(["manual_invitation","automatic_invitation","automatic_suggestion","enterprise_sso"])}),Gxr=Pa({id:bo().min(1),name:bo().min(1),slug:bo().min(1).optional(),role:bo().min(1),domains:Gd(Hxr).max(50)}),Kxr=Pa({id:bo().min(1),occurredAt:bo().datetime(),kind:ed(["inference","generation","workspace","storage","relay","deployment"]),provider:bo().min(1),operation:bo().optional(),credits:fu().nonnegative(),state:ed(["reserved","settled","released"]),externalId:bo().optional()});ed(["free","creator","max","ultra"]);const Xxr=Pa({plans:Pa({free:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),creator:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),max:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),ultra:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()})}),creditPacks:wD(bo().min(1),Pa({name:bo().min(1),credits:fu().int().positive(),expiresInDays:fu().int().positive().optional()}))}),Yxr=fAt("authenticated",[Pa({authenticated:Dg(!1),backend:cht}),Pa({authenticated:Dg(!0),backend:cht,user:Wxr,organizations:Gd(Gxr).max(100).optional(),plan:zxr,credits:Vxr,spendPolicy:Uxr,alerts:Gd(Jxr).max(100).optional(),entitlements:Pa({generation:_y(),dailyJobs:fu().int().positive().optional()})})]),Zxr=ed(["auto","mock","managed","byok"]),qAt=ed(["fal","tripo","worldlabs","openrouter"]),Qxr=Pa({enabled:_y(),provider:Dg("openrouter"),model:bo().trim().min(1).max(256)}),ewr=ed(["environment","system","session","none"]),twr=Pa({provider:qAt,label:bo().min(1),environmentVariable:bo().min(1),configured:_y(),source:ewr,editable:_y(),persistence:ed(["system","session"]),maskedKey:bo().min(1).optional(),problem:bo().min(1).optional()}),rwr=Pa({provider:qAt,ok:Dg(!0),testedAt:bo().datetime()});function nwr(t){return{routes:{mock:!0,managed:t.routes.managed,byok:t.routes.byok,byokProviders:[...t.routes.byokProviders]},preferredRoute:t.preferredRoute}}const Aye=KLe(Yxr,Pa({accountEnvironment:ed(["test-mock","development-twin","production"]),routes:Pa({mock:Dg(!0),managed:_y(),byok:_y(),byokProviders:Gd(bo().min(1))}),preferredRoute:Zxr,providerCredentials:Gd(twr),codingInference:Qxr}));function iwr(t,n){return`${t}: this origin answered with its page fallback (${n||"no content-type"}) rather than JSON, so no editor server handled the request.`}function of(t,n){const s=t.headers.get("content-type")??"";if(!s.includes("application/json"))throw new Error(iwr(n,s))}function CN(t,n){if(!t.ok)throw new Error(`${n} (${t.status}).`);of(t,n)}async function L_(t,n){return CN(t,n),await t.json()}const lht="volter.collaboration.participant.v1",owr="volter.collaboration.remote-share.v1",iRe=globalThis.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__;function swr(){if(iRe?.participantId)return iRe.participantId;const t=globalThis.crypto?.randomUUID?.()??`participant-${Date.now()}`;try{const n=globalThis.localStorage?.getItem(lht);if(n)return n;globalThis.localStorage?.setItem(lht,t)}catch{}return t}const zAt=swr(),L$=(()=>{try{return globalThis.localStorage?.getItem(owr)==="1"}catch{return!1}})(),awr=iRe?.displayName||"Local editor",cwr=Symbol.for("volter.collaboration.revision"),oRe=globalThis[cwr]??={value:0};function VAt(t){Number.isInteger(t)&&t>=oRe.value&&(oRe.value=t)}function Dw(){return{participantId:zAt,expectedRevision:oRe.value}}const lwr={authenticated:!1,backend:"mock",accountEnvironment:"test-mock",routes:{mock:!0,managed:!1,byok:!1,byokProviders:[]},preferredRoute:"auto",providerCredentials:[],codingInference:{enabled:!1,provider:"openrouter",model:"z-ai/glm-5.2"}};let r$=lwr,UAt=0,sRe=null;const aRe=new Set;function lR(t,n=null){if(!(sRe===n&&JSON.stringify(r$)===JSON.stringify(t))){r$=t,sRe=n,UAt++;for(const s of aRe)s()}}async function JAt(t,n){of(t,n);const s=await t.json();if(!t.ok)throw new Error(typeof s.error=="string"?String(s.error):`Account request failed (${t.status}).`);return Aye.parse(s)}async function NC(t,n,s){const c=await fetch(t,{method:n,...s===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}}),d=await JAt(c,`${n} ${t} failed`);return lR(d),d}function tBe(){return r$}function rBe(){return nwr(r$)}function cN(){return UAt}function wpe(){return sRe}function Dye(t){return aRe.add(t),()=>aRe.delete(t)}async function uht(){try{const t=await JAt(await fetch("/__editor/account"),"Account read failed");return lR(t),t}catch(t){throw lR(r$,t instanceof Error?t.message:String(t)),t}}const uwr=t=>NC("/__editor/account/mock-session","POST",{email:t}),fwr=t=>NC("/__editor/account/twin-session","POST",{email:t}),dwr=()=>NC("/__editor/account/session","DELETE"),pwr=t=>NC("/__editor/account/spend-policy","PUT",t),_wr=()=>NC("/__editor/account/alerts/read","POST"),mwr=t=>NC("/__editor/account/execution-route","PUT",{route:t}),hwr=t=>NC("/__editor/account/coding-inference","PUT",t);async function gwr(t){const n=await fetch("/__editor/account/coding-inference/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});of(n,"Coding quote failed");const s=await n.json();if(!n.ok||typeof s.model!="string"||typeof s.promptTokens!="number"||typeof s.outputTokens!="number"||typeof s.providerAmountUsd!="number"||typeof s.estimatedCredits!="number")throw new Error(typeof s.error=="string"?s.error:"Coding quote failed.");return s}const ywr=(t,n)=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"PUT",{key:n}),vwr=t=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"DELETE");async function bwr(t){const n=await fetch(`/__editor/account/provider-credentials/${encodeURIComponent(t)}/test`,{method:"POST"});of(n,"Credential test failed");const s=await n.json();if(!n.ok)throw new Error(typeof s.error=="string"?s.error:`Credential test failed (${n.status}).`);return rwr.parse(s)}const fht=t=>NC("/__editor/account/plan","PUT",{action:t});async function WAt(t,n){const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID()},body:JSON.stringify(n)});of(s,"Checkout failed");const c=await s.json();if(!s.ok||!c.account)throw new Error(typeof c.error=="string"?c.error:"Checkout failed.");return lR(Aye.parse(c.account)),{...typeof c.checkoutUrl=="string"?{checkoutUrl:c.checkoutUrl}:{},mock:c.mock===!0}}const Swr=t=>WAt("/__editor/account/checkout",{plan:t}),xwr=t=>WAt("/__editor/account/credits",{packId:t});async function wwr(){const t=await fetch("/__editor/account/usage");of(t,"Usage failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Usage failed.");return Kxr.array().parse(n.entries??[])}async function Twr(){const t=await fetch("/__editor/account/catalog");of(t,"Catalog failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Catalog failed.");return Xxr.parse(n)}async function Cwr(){const t=await fetch("/__editor/account/billing-portal",{method:"POST"});of(t,"Billing portal failed");const n=await t.json();if(!t.ok||typeof n.url!="string")throw new Error(typeof n.error=="string"?n.error:"Billing portal failed.");return{url:n.url,mock:n.mock===!0}}async function Ewr(){const t=await fetch("/__editor/account/authorization-methods");of(t,"Sign-in methods are unavailable");const n=await t.json();if(!t.ok||n.browser!==!0||typeof n.device!="boolean")throw new Error(typeof n.error=="string"?n.error:"Sign-in methods are unavailable.");return{browser:!0,device:n.device}}async function kwr(){const t=await fetch("/__editor/account/browser-authorization",{method:"POST"});of(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function Awr(t){const n=await fetch(`/__editor/account/browser-authorization/${encodeURIComponent(t)}`);of(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(Aye.parse(s.account)),!0}async function Dwr(){const t=await fetch("/__editor/account/device-authorization",{method:"POST"});of(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function Pwr(t){const n=await fetch(`/__editor/account/device-authorization/${encodeURIComponent(t)}`);of(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(Aye.parse(s.account)),!0}function Iwr(){if(L$)return()=>{};const t=new URLSearchParams(window.location.search).get("checkout_id");t?NC("/__editor/account/checkout/confirm","POST",{checkoutId:t}).then(()=>{const s=new URL(window.location.href);s.searchParams.delete("checkout"),s.searchParams.delete("checkout_id"),window.history.replaceState(null,"",`${s.pathname}${s.search}${s.hash}`)}).catch(s=>lR(r$,s instanceof Error?s.message:String(s))):uht().catch(()=>{});const n=window.setInterval(()=>void uht().catch(()=>{}),3e4);return()=>window.clearInterval(n)}function HAt(t){return t?KAt(t)?null:t:null}function Nwr(t,n){try{return t.ownerOf(n)}catch{return"unresolved"}}function GAt(t){return t&&KAt(t)?t:null}function KAt(t){return t.keyedBy==="display"}const $gn=Object.freeze(Object.defineProperty({__proto__:null,displayKeyedPhysics:GAt,nodeKeyedPhysics:HAt,physicsOwnerOf:Nwr},Symbol.toStringTag,{value:"Module"})),Owr={"source-prop":!0,"source-structure":!0,"construction-literal":!0,"physics-binding":!0,"data-record":!0,"live-only":!0},nBe=Object.keys(Owr);function Rwr(){const t={};for(const n of nBe)t[n]=0;return t}const Fwr={provenance:!0,selection:!0,transforms:!0,inspector:!0,assetSubject:!0,related:!0,instances:!0,structure:!0,persistence:!0,pickable:!0,rects:!0,boxEdit:!0,text:!0,colorSample:!0,stories:!0,truth:!0,spatialHandles:!0,assetDrop:!0,subscribe:!0},iBe=Object.keys(Fwr);function Mwr(t){const n={};for(const s of iBe)n[s]=t[s]!==void 0;return n}const qgn=Object.freeze(Object.defineProperty({__proto__:null,AUTHORING_PROVIDER_KEYS:iBe,WRITE_ANCHOR_KINDS:nBe,emptyWriteAnchorKindCounts:Rwr,measureAuthoringProviders:Mwr},Symbol.toStringTag,{value:"Module"})),jwr=["claim","shape","operation","effect","round-trip"],Yme={claim:0,shape:1,operation:2,effect:3,"round-trip":4};function XAt(t,n){return Yme[t]>=Yme[n]}function rQ(t){const{seam:n,subject:s,epoch:c,required:d}=t;if(t.notApplicable!==void 0)return{seam:n,subject:s,epoch:c,required:d,state:"not-applicable",receipt:null,detail:t.notApplicable};let m=null;for(const g of t.receipts)g.seam!==n||g.subject!==s||g.epoch!==c||(!m||Yme[g.stage]>=Yme[m.stage])&&(m=g);return m?m.outcome==="fail"?{seam:n,subject:s,epoch:c,required:d,state:"failed",receipt:m,detail:m.detail}:m.outcome==="absent"?{seam:n,subject:s,epoch:c,required:d,state:"absent",receipt:m,detail:m.detail}:XAt(m.stage,d)?{seam:n,subject:s,epoch:c,required:d,state:"verified",receipt:m,detail:m.detail}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:m,detail:`${m.detail}; this proves ${m.stage}, but this seam requires ${d}`}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:null,detail:`no current-epoch evidence has reached the required ${d} stage`}}class YAt{#e=[];record(n){if(!n.seam||!n.subject||!n.epoch||!n.detail.trim())throw new Error("seam evidence requires non-empty seam, subject, epoch, and detail");this.#e.push(n)}receipts(n){return this.#e.filter(s=>(n?.subject===void 0||s.subject===n.subject)&&(n?.epoch===void 0||s.epoch===n.epoch))}verdict(n){return rQ({...n,receipts:this.#e})}clearSubject(n){for(let s=this.#e.length-1;s>=0;s-=1)this.#e[s]?.subject===n&&this.#e.splice(s,1)}clear(){this.#e.length=0}}function Ip(){return t=>t}function Lwr(t){if(t.value===void 0)return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:t.optional?"absent":"fail",source:"shape-check",detail:t.optional?`${t.seam} is not exposed by this subject`:`${t.seam} is required by the contract but is absent`};const n=typeof t.value,s=t.kind==="function"?n==="function":n!=="function";return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:s?"pass":"fail",source:"shape-check",detail:s?`${t.seam} has the contract's ${t.kind} shape`:`${t.seam} is ${n}; the contract requires a ${t.kind}`}}function vB(t){const n=[],s=t.value!==null&&(typeof t.value=="object"||typeof t.value=="function")?t.value:null,c=Object.entries(t.shape);for(const[d,m]of c){const g=`${t.prefix}.${d}`,S=s?.[d];n.push(Lwr({seam:g,subject:t.subject,epoch:t.epoch,value:S,optional:m.optional,kind:m.kind}))}return n}function Zme(t){const n=rQ(t);if(n.state==="absent"||n.state==="failed"||!t.shape)return n;for(const[s,c]of Object.entries(t.shape)){const d=rQ({seam:`${t.seam}.${s}`,subject:t.subject,epoch:t.epoch,required:c.required,receipts:t.receipts});if(!(c.optional&&d.state==="absent")){if(d.state==="failed"||d.state==="absent")return{...n,state:"failed",receipt:d.receipt,detail:`${t.seam} is malformed: ${d.detail}`};if(d.state!=="verified")return{...n,state:"unverified",detail:`${t.seam} has the required shape, but ${d.seam} is unverified: ${d.detail}`}}}return n}const zgn=Object.freeze(Object.defineProperty({__proto__:null,SEAM_PROOF_STAGES:jwr,SeamEvidenceLedger:YAt,defineSeamShape:Ip,gradeSeamCarrier:Zme,gradeSeamEvidence:rQ,inspectSeamShape:vB,seamStageAtLeast:XAt},Symbol.toStringTag,{value:"Module"})),XY=Ip()({capabilities:{optional:!1,kind:"value",required:"shape"},provenance:{optional:!0,kind:"value",required:"shape"},hierarchy:{optional:!1,kind:"value",required:"operation"},selection:{optional:!0,kind:"value",required:"effect"},transforms:{optional:!0,kind:"value",required:"effect"},inspector:{optional:!0,kind:"value",required:"effect"},assetSubject:{optional:!0,kind:"value",required:"operation"},related:{optional:!0,kind:"value",required:"operation"},instances:{optional:!0,kind:"value",required:"effect"},structure:{optional:!0,kind:"value",required:"round-trip"},persistence:{optional:!0,kind:"value",required:"round-trip"},pickable:{optional:!0,kind:"value",required:"operation"},rects:{optional:!0,kind:"value",required:"operation"},boxEdit:{optional:!0,kind:"value",required:"effect"},text:{optional:!0,kind:"value",required:"effect"},colorSample:{optional:!0,kind:"value",required:"operation"},stories:{optional:!0,kind:"value",required:"effect"},truth:{optional:!0,kind:"value",required:"operation"},spatialHandles:{optional:!0,kind:"value",required:"effect"},assetDrop:{optional:!0,kind:"value",required:"round-trip"},subscribe:{optional:!0,kind:"function",required:"effect"}}),cRe=Ip()({roots:{optional:!1,kind:"function",required:"operation"},node:{optional:!1,kind:"function",required:"operation"},crossSurfaceStructureSignature:{optional:!0,kind:"function",required:"operation"},object3D:{optional:!0,kind:"function",required:"operation"},idForObject3D:{optional:!0,kind:"function",required:"operation"}}),ZAt=Ip()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},resolve:{optional:!0,kind:"function",required:"operation"}}),QAt=Ip()({dimensions:{optional:!0,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},editability:{optional:!0,kind:"function",required:"operation"},beginEdit:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},endEdit:{optional:!1,kind:"function",required:"effect"},remove:{optional:!0,kind:"function",required:"round-trip"},sourceCommit:{optional:!0,kind:"value",required:"round-trip"}}),e3t=Ip()({properties:{optional:!1,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},preview:{optional:!0,kind:"function",required:"effect"},editability:{optional:!0,kind:"function",required:"operation"},remove:{optional:!0,kind:"function",required:"round-trip"}}),t3t=Ip()({get:{optional:!1,kind:"function",required:"operation"},entries:{optional:!0,kind:"function",required:"operation"}}),r3t=Ip()({links:{optional:!1,kind:"function",required:"operation"}}),n3t=Ip()({describe:{optional:!1,kind:"function",required:"operation"},openComponent:{optional:!0,kind:"function",required:"effect"},revert:{optional:!1,kind:"function",required:"round-trip"},applyToComponent:{optional:!1,kind:"function",required:"round-trip"}}),i3t=Ip()({create:{optional:!1,kind:"function",required:"round-trip"},remove:{optional:!1,kind:"function",required:"round-trip"},duplicate:{optional:!1,kind:"function",required:"round-trip"},duplicateMany:{optional:!0,kind:"function",required:"round-trip"},reparent:{optional:!1,kind:"function",required:"round-trip"},reorder:{optional:!0,kind:"function",required:"round-trip"},creatableKinds:{optional:!0,kind:"function",required:"operation"},wrap:{optional:!0,kind:"function",required:"round-trip"},unwrap:{optional:!0,kind:"function",required:"round-trip"},group:{optional:!0,kind:"function",required:"round-trip"},ungroup:{optional:!0,kind:"function",required:"round-trip"},canUngroup:{optional:!0,kind:"function",required:"operation"},removeMany:{optional:!0,kind:"function",required:"round-trip"},copy:{optional:!0,kind:"function",required:"effect"},canCopy:{optional:!0,kind:"function",required:"operation"},cut:{optional:!0,kind:"function",required:"round-trip"},paste:{optional:!0,kind:"function",required:"round-trip"},canPaste:{optional:!0,kind:"function",required:"operation"}}),o3t=Ip()({isDirty:{optional:!1,kind:"function",required:"operation"},lastError:{optional:!0,kind:"function",required:"operation"},save:{optional:!1,kind:"function",required:"round-trip"},destination:{optional:!1,kind:"value",required:"shape"},applyExternal:{optional:!0,kind:"function",required:"effect"}}),s3t=Ip()({pick:{optional:!1,kind:"function",required:"operation"},candidates:{optional:!0,kind:"function",required:"operation"}}),a3t=Ip()({storiesFor:{optional:!1,kind:"function",required:"operation"},active:{optional:!1,kind:"function",required:"operation"},apply:{optional:!1,kind:"function",required:"effect"},isolate:{optional:!0,kind:"function",required:"effect"},title:{optional:!0,kind:"value",required:"shape"},unavailable:{optional:!0,kind:"function",required:"operation"}}),c3t=Ip()({accepts:{optional:!1,kind:"function",required:"operation"},drop:{optional:!1,kind:"function",required:"round-trip"}}),l3t=Ip()({rect:{optional:!1,kind:"function",required:"operation"},contextRects:{optional:!0,kind:"function",required:"operation"},emptyContainers:{optional:!0,kind:"function",required:"operation"},frame:{optional:!0,kind:"function",required:"operation"}}),u3t=Ip()({begin:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},end:{optional:!1,kind:"function",required:"effect"},gizmoOrigin:{optional:!0,kind:"function",required:"operation"},referencePoint:{optional:!0,kind:"function",required:"operation"}}),f3t=Ip()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"}}),d3t=Ip()({backgroundChainAt:{optional:!1,kind:"function",required:"operation"}}),p3t=Ip()({resolve:{optional:!1,kind:"function",required:"operation"}}),_3t=Ip()({layers:{optional:!1,kind:"function",required:"operation"},preview:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"round-trip"}}),lRe={selection:ZAt,transforms:QAt,inspector:e3t,assetSubject:t3t,related:r3t,instances:n3t,structure:i3t,persistence:o3t,pickable:s3t,rects:l3t,boxEdit:u3t,text:f3t,colorSample:d3t,stories:a3t,truth:p3t,spatialHandles:_3t,assetDrop:c3t},Vgn=Object.freeze(Object.defineProperty({__proto__:null,ASSET_DROP_PROVIDER_SHAPE:c3t,ASSET_SUBJECT_PROVIDER_SHAPE:t3t,AUTHORING_ADAPTER_SHAPE:XY,AUTHORING_PROVIDER_SHAPES:lRe,BOX_EDIT_PROVIDER_SHAPE:u3t,COLOR_SAMPLE_PROVIDER_SHAPE:d3t,COMPONENT_INSTANCES_PROVIDER_SHAPE:n3t,HIERARCHY_PROVIDER_SHAPE:cRe,INSPECTOR_PROVIDER_SHAPE:e3t,PERSISTENCE_PROVIDER_SHAPE:o3t,PICK_PROVIDER_SHAPE:s3t,RECT_PROVIDER_SHAPE:l3t,RELATED_SUBJECTS_PROVIDER_SHAPE:r3t,SELECTION_PROVIDER_SHAPE:ZAt,SPATIAL_HANDLES_PROVIDER_SHAPE:_3t,STORIES_PROVIDER_SHAPE:a3t,STRUCTURE_PROVIDER_SHAPE:i3t,TEXT_PROVIDER_SHAPE:f3t,TRANSFORM_PROVIDER_SHAPE:QAt,TRUTH_PROVIDER_SHAPE:p3t},Symbol.toStringTag,{value:"Module"})),uRe=Ip()({physics:{optional:!0,kind:"value",required:"effect"},networking:{optional:!0,kind:"value",required:"operation"},navigation:{optional:!0,kind:"value",required:"operation"},audio:{optional:!0,kind:"value",required:"effect"},camera:{optional:!0,kind:"value",required:"effect"},debug:{optional:!0,kind:"value",required:"operation"},renderDebug:{optional:!0,kind:"value",required:"effect"}}),m3t=Ip()({keyedBy:{optional:!0,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"},debugDraw:{optional:!0,kind:"function",required:"operation"},setDebugDrawEnabled:{optional:!0,kind:"function",required:"effect"},contactPoints:{optional:!0,kind:"function",required:"operation"},colliders:{optional:!0,kind:"function",required:"operation"},previewCollider:{optional:!0,kind:"function",required:"effect"},joints:{optional:!0,kind:"function",required:"operation"},previewJointAnchor:{optional:!0,kind:"function",required:"effect"}}),h3t=Ip()({keyedBy:{optional:!1,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"}}),g3t=Ip()({peers:{optional:!1,kind:"function",required:"operation"},networkId:{optional:!1,kind:"function",required:"operation"},authority:{optional:!1,kind:"function",required:"operation"},editable:{optional:!1,kind:"function",required:"operation"},getConnectionState:{optional:!0,kind:"function",required:"operation"},getRoomInfo:{optional:!0,kind:"function",required:"operation"},getReplicationStats:{optional:!0,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"},getStateSnapshot:{optional:!0,kind:"function",required:"operation"},messageEvents:{optional:!0,kind:"function",required:"operation"},getRates:{optional:!0,kind:"function",required:"operation"},getConditioning:{optional:!0,kind:"function",required:"operation"},setConditioning:{optional:!0,kind:"function",required:"effect"},getServerConfig:{optional:!0,kind:"function",required:"operation"},getPlayerIdentity:{optional:!0,kind:"function",required:"operation"},setPlayerIdentity:{optional:!0,kind:"function",required:"effect"},getTrafficByType:{optional:!0,kind:"function",required:"operation"},sendMessage:{optional:!0,kind:"function",required:"effect"},getConditioningLimits:{optional:!0,kind:"function",required:"operation"},ping:{optional:!0,kind:"function",required:"effect"},inspectServer:{optional:!0,kind:"function",required:"operation"},disconnectClient:{optional:!0,kind:"function",required:"effect"},editServerState:{optional:!0,kind:"function",required:"effect"},deleteServerState:{optional:!0,kind:"function",required:"effect"},sendToClient:{optional:!0,kind:"function",required:"effect"},broadcast:{optional:!0,kind:"function",required:"effect"},disposeRoom:{optional:!0,kind:"function",required:"effect"},stateFieldType:{optional:!0,kind:"function",required:"operation"},clearTraffic:{optional:!0,kind:"function",required:"effect"},getTrafficByEntity:{optional:!0,kind:"function",required:"operation"},isRecording:{optional:!0,kind:"function",required:"operation"},setRecording:{optional:!0,kind:"function",required:"effect"}}),y3t=Ip()({hasNavMesh:{optional:!1,kind:"function",required:"operation"},findPath:{optional:!1,kind:"function",required:"effect"},debugMesh:{optional:!1,kind:"function",required:"operation"},bake:{optional:!0,kind:"function",required:"effect"},exportData:{optional:!0,kind:"function",required:"operation"},clear:{optional:!0,kind:"function",required:"effect"},crowdAgents:{optional:!0,kind:"function",required:"operation"}}),v3t=Ip()({resume:{optional:!0,kind:"function",required:"effect"},setMuted:{optional:!1,kind:"function",required:"effect"},isMuted:{optional:!1,kind:"function",required:"operation"},graphSnapshot:{optional:!0,kind:"function",required:"operation"},transportState:{optional:!0,kind:"function",required:"operation"},acquireMeters:{optional:!0,kind:"function",required:"effect"},acquireRecordingStream:{optional:!0,kind:"function",required:"effect"},renderOffline:{optional:!0,kind:"function",required:"operation"},audioEvents:{optional:!0,kind:"function",required:"operation"}}),b3t=Ip()({snapshot:{optional:!1,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"}}),S3t=Ip()({providers:{optional:!1,kind:"function",required:"operation"},state:{optional:!1,kind:"function",required:"operation"},stateAll:{optional:!1,kind:"function",required:"operation"},commands:{optional:!1,kind:"function",required:"operation"},invoke:{optional:!1,kind:"function",required:"effect"},events:{optional:!1,kind:"function",required:"operation"}}),x3t=Ip()({captureFrame:{optional:!1,kind:"function",required:"effect"},memorySnapshot:{optional:!0,kind:"function",required:"operation"}}),w3t={networking:g3t,navigation:y3t,audio:v3t,camera:b3t,debug:S3t,renderDebug:x3t},Ugn=Object.freeze(Object.defineProperty({__proto__:null,AUDIO_ADAPTER_SHAPE:v3t,CAMERA_ADAPTER_SHAPE:b3t,DEBUG_ADAPTER_SHAPE:S3t,NAVIGATION_ADAPTER_SHAPE:y3t,NETWORKING_ADAPTER_SHAPE:g3t,PHYSICS_2D_ADAPTER_SHAPE:h3t,PHYSICS_ADAPTER_SHAPE:m3t,RENDER_DEBUG_ADAPTER_SHAPE:x3t,SYSTEM_ADAPTERS_SHAPE:uRe,SYSTEM_PROVIDER_SHAPES:w3t},Symbol.toStringTag,{value:"Module"})),oBe=new YAt;function Bwr(t){oBe.record(t)}const dht=new WeakMap;let $wr=1;function T3t(t){const n=dht.get(t);if(n)return n;const s=`system-${$wr++}`;return dht.set(t,s),s}function qwr(t){const n=t.epoch??T3t(t.adapter),s=`system.${t.slot}`,c={[t.slot]:t.adapter},d=t.slot==="physics"?GAt(t.adapter)?h3t:m3t:w3t[t.slot],m=[...vB({prefix:"system",value:c,shape:uRe,subject:t.subject,epoch:n}).filter(g=>g.seam===s),...vB({prefix:s,value:t.adapter,shape:d,subject:t.subject,epoch:n}),...oBe.receipts({subject:t.subject,epoch:n}),...t.receipts??[]];return Zme({seam:s,subject:t.subject,epoch:n,required:uRe[t.slot].required,receipts:m,shape:d})}let qS={},nQ=null,sBe=null;const Qme=new Set,ehe=new Set,fRe=new Set;let aBe=0;function dRe(){for(const t of fRe)t()}function the(t){if(t!==Iye())for(const n of Qme)n()}function rhe(t,n){const s=Oye();if(!(t===Nye()&&n.length===s.length&&n.every((c,d)=>c===s[d]))){aBe++;for(const c of ehe)c()}}const LS=new Map;let S_e=null,C3t=0;const pRe=new Set,cBe="";function E3t(t,n){const s=["physics","networking","navigation","audio","camera","debug","renderDebug"];for(const c of s){const d=t[c];if(!d)continue;const m=qwr({slot:c,adapter:d,subject:n||"game"});if(m.state==="failed")throw new Error(`system adapter refused: ${m.detail}`)}}function ZI(){return S_e!==null&&LS.has(S_e)?S_e:LS.keys().next().value??null}function nhe(){C3t++;for(const t of pRe)t()}function zwr(t){const n=ZI();if(S_e=t,n!==ZI()){nhe(),aBe++;for(const s of Qme)s();for(const s of ehe)s()}}function Jgn(){return ZI()}function Vwr(t){return pRe.add(t),()=>pRe.delete(t)}function Wgn(){return C3t}function Pye(){const t=ZI();return(t===null?void 0:LS.get(t))??qS}function Uwr(t,n=cBe){const s=ZI(),c=Iye(),d=Nye(),m=Oye();if(t){E3t(t,n),LS.set(n,t),qS=t,the(c),rhe(d,m),dRe(),s!==ZI()&&nhe();return}LS.delete(n),qS=LS.values().next().value??{},the(c),rhe(d,m),dRe(),s!==ZI()&&nhe()}function Jwr(){for(const t of[...LS.keys()])Uwr(null,t);zwr(null)}function Hgn(t,n=cBe){const s=Iye(),c=Nye(),d=Oye(),m=LS.get(n);E3t(t,n),LS.set(n,t),qS===m&&(qS=t),the(s),rhe(c,d),dRe(),ZI()===n&&nhe()}function Ggn(){return qS}function Wwr(t){return fRe.add(t),()=>fRe.delete(t)}function Hwr(){return[...LS.keys()]}function pht(t){const n=t.filter(d=>d!==cBe),s=t.length>n.length,c=n.map(d=>`"${d}"`);return s&&c.push("the unnamed default (address it with no id at all)"),c.join(", ")}class _ht extends Error{instances;constructor(n,s){super(n),this.name="InstanceResolutionError",this.instances=s}}function Gwr(t){const n=Hwr();if(t!==void 0){const s=LS.get(t);if(s)return s;throw new _ht(n.length===0?`no instance "${t}" — no game is mounted`:`no instance "${t}" — live: ${pht(n)}`,n)}if(n.length===1)return LS.get(n[0]);if(n.length===0)return qS;throw new _ht(`${n.length} instances are live (${pht(n)}) — name one in your program (\`game.instance(id)\`, or \`await game.instances()\` for handles); refusing to guess`,n)}function Kgn(){return HAt(qS.physics)}function Kwr(){return qS.camera??null}function Iye(){return qS.networking??sBe??null}function Xwr(){return Pye().networking??sBe??null}function Ywr(t){return Qme.add(t),()=>Qme.delete(t)}function Xgn(t){const n=Iye();sBe=t,the(n)}function Ygn(){return qS.debug??null}function Zgn(t){const n=Nye(),s=Oye();nQ=t,rhe(n,s)}function Nye(){return qS.audio??nQ}function Zwr(){return Pye().audio??nQ}function Qwr(t){return ehe.add(t),()=>ehe.delete(t)}function eTr(){return aBe}function Oye(){const t=new Set;for(const n of LS.values())n.audio&&t.add(n.audio);return t.size===0&&nQ&&t.add(nQ),[...t]}function tTr(){return qS.renderDebug??null}function Qgn(){return Pye().renderDebug??null}let k3t=null;const _Re=new Set;function eyn(t){k3t=t;for(const n of _Re)n()}function Rye(){return k3t?.()??null}function Fye(t){_Re.add(t);const n=Vwr(t);return()=>{_Re.delete(t),n()}}function lN(){const t=Rye();return t?`play:${t.instanceId}`:"stopped"}function Mye(t,n){let s=!1,c=[];const d=()=>{s=!1;const g=c;c=[];for(let S=g.length-1;S>=0;S--)g[S]()};return{ensure(g){if(!s){s=!0;try{g(S=>c.push(S))}catch(S){throw d(),S}}},reset:d}}let xO=[],rTr=0,A3t=0;const mRe=new Set;function mht(){A3t++;for(const t of mRe)t()}function D3t(t){return mRe.add(t),()=>{mRe.delete(t)}}function hht(){return A3t}function Z4(t){if(xO.some(s=>s.contribution.id===t.id))throw new Error(`registerWorkspaceStatus: id "${t.id}" is already registered — status ids key status-bar slots, so they must be unique; unregister the previous contribution first.`);const n={contribution:t,seq:rTr++};return xO=[...xO,n],mht(),()=>{xO.includes(n)&&(xO=xO.filter(s=>s!==n),mht())}}function hRe(t){const n=s=>[...xO].filter(c=>(c.contribution.align??"left")===s).sort((c,d)=>(c.contribution.order??0)-(d.contribution.order??0)||c.seq-d.seq).map(c=>c.contribution);return t?n(t):[...n("left"),...n("right")]}let x_e=null,P3t=0;const gRe=new Set;function ght(){P3t++;for(const t of gRe)t()}function I3t(t){return gRe.add(t),()=>gRe.delete(t)}function yRe(){return P3t}function lBe(){return x_e}function nTr(t){const n=Symbol(t.documentId);return x_e={...t,token:n},ght(),()=>{x_e?.token===n&&(x_e=null,ght())}}function iTr(){Ye.useSyncExternalStore(I3t,yRe);const t=lBe();return t?.status?q.jsx("span",{className:"volter-status-copy","data-testid":"status-asset-editor","data-status-tone":"muted",children:t.status}):null}const oTr=Mye();function sTr(){oTr.ensure(t=>{t(Z4({id:"asset-editor-status",name:"Asset editor",align:"left",order:40,Content:iTr}))})}sTr();let bB=null,N3t=0;const vRe=new Set;function yht(){N3t+=1;for(const t of vRe)t()}function aTr(t){return vRe.add(t),()=>{vRe.delete(t)}}function vht(){return N3t}function cTr(t,n){const s=Symbol(t);return bB={documentId:t,readSubject:n,token:s},yht(),()=>{bB?.token===s&&(bB=null,yht())}}function bRe(){return bB===null?null:{documentId:bB.documentId,subject:bB.readSubject()}}const uN=new Map,SRe=new Map;function O3t(){typeof window>"u"||window.parent===window||uN.size===0||window.parent.postMessage({type:"volter:viewport-ready",documents:[...uN.keys()]},"*")}typeof window<"u"&&window.parent!==window&&window.addEventListener("message",t=>{t.source===window.parent&&t.data?.type==="volter:request-viewport-ready"&&O3t()});let Nc=null,uBe=null;function fBe(){if(typeof window>"u")return!1;const t=window.__VOLTER_VIEWPORT_TIMINGS__;if(t===!0||t==="1")return!0;try{return new URLSearchParams(window.location.search).get("volterTimings")==="1"}catch{return!1}}function R3t(t,n,s){return{documentId:t,visibilityState:typeof document>"u"?"unavailable":document.visibilityState,startedAtMs:n,reactActiveAtMs:null,boardBuildStartedAtMs:null,boardReadyAtMs:null,constructStartedAtMs:null,viewportReadyAtMs:null,rafResumeAtMs:null,firstRenderStartedAtMs:null,workspaceSyncMs:0,revealScheduleMs:0,componentIndexMs:0,componentIndexBusyMs:0,componentIndexWaitMs:0,candidateCollectMs:0,storyMountTotalMs:0,boundsMs:0,layoutMs:0,assembleMs:0,webglContextMs:0,rendererMs:0,adapterSetupMs:0,iblBakeMs:0,dressingMs:0,editorViewportMs:0,framingMs:0,resizeBindMs:0,viewportBindMs:0,firstRenderMs:0,candidateCount:0,exhibitCount:0,skippedCount:0,modulesAlreadyLoaded:s.modulesAlreadyLoaded===!0,stories:[]}}function lTr(t){let n=0,s=0;for(const c of t)n+=Math.max(0,c.runtimeMs)+Math.max(0,c.fiberMs),s+=Math.max(0,c.loadMs)+Math.max(0,c.settleMs);return{busyMs:n,waitMs:s}}function uTr(t,n){const s=t.reactActiveAtMs===null?0:Math.max(0,t.reactActiveAtMs-t.startedAtMs),c=t.reactActiveAtMs??t.startedAtMs,d=t.boardBuildStartedAtMs,m=d===null?0:Math.max(0,d-c),g=t.boardReadyAtMs===null||t.constructStartedAtMs===null?0:Math.max(0,t.constructStartedAtMs-t.boardReadyAtMs),S=t.viewportReadyAtMs??t.rafResumeAtMs,k=t.firstRenderStartedAtMs??n,A=S===null?0:Math.max(0,k-S),F=S===null?Math.max(0,n-t.startedAtMs):Math.max(0,n-S),D=lTr(t.stories),J=t.boardBuildStartedAtMs===null?"switch-back":"first-open",G=fTr({workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,componentIndexBusyMs:t.componentIndexBusyMs,componentIndexWaitMs:t.componentIndexWaitMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs}).reduce((pe,ue)=>pe+ue.ms,0),se=Math.max(0,n-t.startedAtMs);return{visibilityState:t.visibilityState,startedAtMs:t.startedAtMs,reactActiveAtMs:t.reactActiveAtMs,boardBuildStartedAtMs:t.boardBuildStartedAtMs,boardReadyAtMs:t.boardReadyAtMs,constructStartedAtMs:t.constructStartedAtMs,viewportReadyAtMs:t.viewportReadyAtMs,rafResumeAtMs:t.rafResumeAtMs,firstRenderStartedAtMs:t.firstRenderStartedAtMs,firstFrameAtMs:n,activationKind:J,workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs,firstPaintMs:F,unattributedMs:Math.max(0,se-G),accountedMs:G,candidateCount:t.candidateCount,exhibitCount:t.exhibitCount,skippedCount:t.skippedCount,modulesAlreadyLoaded:t.modulesAlreadyLoaded,stories:t.stories,storyDiscovery:uBe}}function Yb(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:s,waitMs:0,kind:"cpu"}}function Tpe(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:0,waitMs:s,kind:"idle"}}function bht(t,n,s,c){const d=Math.max(0,n);let m=Math.max(0,s),g=Math.max(0,c);if(m+g>d){const S=d/(m+g);m*=S,g*=S}else m+g<d&&(g+=d-m-g);return{name:t,ms:d,busyMs:m,waitMs:g,kind:"mixed"}}function fTr(t){return[Tpe("workspace-sync",t.workspaceSyncMs),Tpe("reveal-schedule",t.revealScheduleMs),bht("component-index",t.componentIndexMs,t.componentIndexBusyMs,t.componentIndexWaitMs>0||t.componentIndexMs===0?t.componentIndexWaitMs:t.componentIndexMs),Yb("candidate-collect",t.candidateCollectMs),bht("story-mounts",t.storyMountTotalMs,t.storyMountBusyMs,t.storyMountWaitMs),Yb("bounds",t.boundsMs),Yb("layout",t.layoutMs),Yb("assemble",t.assembleMs),Tpe("react-commit (board→viewport)",t.reactCommitMs),Yb("webgl-context",t.webglContextMs),Yb("renderer",t.rendererMs),Yb("adapter-setup",t.adapterSetupMs),Yb("ibl-bake (three PMREM)",t.iblBakeMs),Yb("dressing",t.dressingMs),Yb("editor-viewport",t.editorViewportMs),Yb("framing",t.framingMs),Yb("resize-bind",t.resizeBindMs),Yb("viewport-bind",t.viewportBindMs),Tpe("raf-wait",t.rafWaitMs),Yb("first-render",t.firstRenderMs)]}function tyn(t,n=Date.now()){const s=(SRe.get(t)??0)+1;SRe.set(t,s);const c={documentId:t,activation:s,firstFrameAtMs:n},d=Nc;if(d&&d.documentId===t){const m={...c,breakdown:uTr(d,n)};return Nc=null,uN.set(t,m),xht(),Sht(),m}return uN.set(t,c),xht(),Sht(),c}let xRe=new Set;const wRe=new Set;function Sht(){O3t();for(const t of wRe)t()}function dTr(t){return wRe.add(t),()=>wRe.delete(t)}function xht(){uN.size!==0&&F3t()}function F3t(){const t=xRe;xRe=new Set;for(const n of t)n()}let wht=!1;function pTr(){wht||typeof document>"u"||(wht=!0,document.addEventListener("visibilitychange",()=>{document.hidden&&F3t()}))}function jye(){return uN.size>0||typeof document<"u"&&document.hidden?Promise.resolve():(pTr(),new Promise(t=>xRe.add(t)))}function _Tr(){return[...uN.values()]}function mTr(t){fBe()&&(Nc=R3t(t,Date.now(),{}))}function ryn(t,n={}){if(!fBe())return;const s=Date.now();if(Nc&&Nc.documentId===t){Nc.boardBuildStartedAtMs===null&&(Nc.boardBuildStartedAtMs=s),n.modulesAlreadyLoaded===!0&&(Nc.modulesAlreadyLoaded=!0);return}Nc=R3t(t,s,n),Nc.boardBuildStartedAtMs=s}function nyn(t){Nc&&(t&&Nc.documentId!==t||(Nc=null))}function iyn(t,n,s){if(!Nc)return;const c=Math.max(0,n);switch(t){case"component-index":Nc.componentIndexMs=c,Nc.componentIndexBusyMs=Math.max(0,s?.busyMs??0),Nc.componentIndexWaitMs=Math.max(0,s?.waitMs??c);break;case"candidate-collect":Nc.candidateCollectMs=c;break;case"story-mounts":Nc.storyMountTotalMs=c;break;case"bounds":Nc.boundsMs=c;break;case"layout":Nc.layoutMs=c;break;case"assemble":Nc.assembleMs=c;break;case"webgl-context":Nc.webglContextMs=c;break;case"renderer":Nc.rendererMs=c;break;case"adapter-setup":Nc.adapterSetupMs=c;break;case"ibl-bake":Nc.iblBakeMs=c;break;case"dressing":Nc.dressingMs=c;break;case"editor-viewport":Nc.editorViewportMs=c;break;case"framing":Nc.framingMs=c;break;case"resize-bind":Nc.resizeBindMs=c;break;case"viewport-bind":Nc.viewportBindMs=c;break;case"first-render":Nc.firstRenderMs=c;break}}function oyn(t){!Nc||Nc.documentId!==t||Nc.reactActiveAtMs===null&&(Nc.reactActiveAtMs=Date.now())}function syn(t){!Nc||Nc.documentId!==t||Nc.rafResumeAtMs===null&&(Nc.rafResumeAtMs=Date.now())}function ayn(t){!Nc||Nc.documentId!==t||Nc.firstRenderStartedAtMs===null&&(Nc.firstRenderStartedAtMs=Date.now())}function cyn(t){Nc&&(t.candidateCount!==void 0&&(Nc.candidateCount=t.candidateCount),t.exhibitCount!==void 0&&(Nc.exhibitCount=t.exhibitCount),t.skippedCount!==void 0&&(Nc.skippedCount=t.skippedCount))}function lyn(){Nc&&(Nc.boardReadyAtMs=Date.now())}function uyn(){Nc&&(Nc.constructStartedAtMs=Date.now())}function fyn(){Nc&&(Nc.viewportReadyAtMs=Date.now())}function dyn(t){Nc&&Nc.stories.push(t)}function pyn(){return Nc?.documentId??null}function hTr(t){fBe()&&(uBe=t)}function gTr(){uN.clear(),SRe.clear(),Nc=null,uBe=null}const yTr=["scene","game","world","story","asset","behavior","generation","content-browser","project-tool","tool-contribution","document"];let hp=[],zk=null,i2=null,iQ=null,uR=null;function Tht(t){queueMicrotask(()=>{uR===t&&hp.some(n=>n.descriptor.id===t)&&(uR=null,X0(t))})}let M3t=0;const TRe=new Set,A5e=new Set,dBe=new Map,XO=new Map;function wC(){M3t++;for(const t of TRe)t()}function o2(t){return TRe.add(t),()=>{TRe.delete(t)}}function K1(){return M3t}function l0(){return hp}function Pp(){return i2}function CRe(){return iQ}function vTr(t,n){X0(t)&&iQ!==n&&(iQ=n,wC())}function TC(){return hp.find(t=>t.descriptor.id===i2)??null}function oQ(t){if(t===i2)return;t&&mTr(t);const n=hp.find(c=>c.descriptor.id===i2);i2=t,iQ=null,n?.descriptor.onDeactivate?.(n.descriptor.id);const s=hp.find(c=>c.descriptor.id===t);s?.descriptor.onActivate?.(s.descriptor.id)}function bTr(t,n,s,c){if(n){!s&&c&&zk===t&&(zk=null);return}s&&(zk&&EN(zk),zk=t)}function ND(t,n={}){const s=uR===t.id,c=s||n.activate!==!1,d=hp.find(g=>g.descriptor.id===t.id);if(bTr(t.id,!!d,n.preview===!0,c),!d)return hp=[...hp,{descriptor:t,dirty:!1,title:t.title}],!t.area&&(c||i2===null)&&oQ(t.id),s&&Tht(t.id),wC(),t.id;let m=!1;return(d.descriptor.Toolbar!==t.Toolbar||d.descriptor.Shelf!==t.Shelf||d.descriptor.Content!==t.Content)&&(hp=hp.map(g=>{if(g!==d)return g;const{Toolbar:S,Shelf:k,...A}=g.descriptor;return{...g,descriptor:{...A,Content:t.Content,...t.Toolbar?{Toolbar:t.Toolbar}:{},...t.Shelf?{Shelf:t.Shelf}:{}}}}),m=!0),c&&i2!==t.id&&(oQ(t.id),m=!0),m&&wC(),s&&Tht(t.id),t.id}function X0(t){return hp.some(n=>n.descriptor.id===t)?(i2!==t&&(oQ(t),wC()),!0):!1}function j3t(){uR=null}function STr(t){if(X0(t)){uR=null;return}uR=t}function EN(t,n={}){if(A5e.has(t))return!1;const s=hp.findIndex(d=>d.descriptor.id===t);if(s<0)return!1;const c=hp[s];if(c.dirty&&!n.discardDirty)return!1;A5e.add(t);try{if(i2===t){const m=s>0?hp[s-1]:hp[s+1]??null;oQ(m?m.descriptor.id:null)}return hp=hp.filter(m=>m.descriptor.id!==t),zk===t&&(zk=null),dBe.delete(t),XO.delete(t),c.descriptor.onDispose?.(t),wC(),!0}finally{A5e.delete(t)}}function L3t(){if(hp.length===0&&i2===null)return;const t=hp;oQ(null),hp=[],iQ=null,zk=null,dBe.clear(),XO.clear(),uR=null;for(const n of t)n.descriptor.onDispose?.(n.descriptor.id);wC()}function xTr(t,n){return hp.some(s=>s.descriptor.id===t)?(XO.set(t,n),wC(),()=>{XO.get(t)===n&&(XO.delete(t),wC())}):()=>{}}function _yn(t){XO.has(t)&&wC()}async function wTr(t){if(!hp.some(s=>s.descriptor.id===t))return null;const n=dBe.get(t);if(!n)return null;try{return await n()}catch{return!1}}function TTr(){return i2?wTr(i2):Promise.resolve(null)}function myn(t,n){n&&zk===t&&(zk=null);const s=hp.findIndex(d=>d.descriptor.id===t);s<0||hp[s].dirty===n||(hp=hp.map(d=>d.descriptor.id===t?{...d,dirty:n}:d),wC())}function B3t(t,n){const s=hp.find(c=>c.descriptor.id===t);!s||s.title===n||(hp=hp.map(c=>c.descriptor.id===t?{...c,title:n}:c),wC())}function pBe(t){const n=hp.find(c=>c.descriptor.id===t),s=XO.get(t)??n?.descriptor.selection;if(!s)return null;try{return s()}catch{return null}}function Lye(){return i2?pBe(i2):null}const CTr={adapter:null,nodeId:null};function ETr(t){return JSON.stringify({id:t.id,title:t.title,hint:t.hint,kindLabel:t.kindLabel,note:t.note,sections:t.sections.map(n=>({id:n.id,title:n.title,order:n.order,description:n.description,defaultOpen:n.defaultOpen,testId:n.testId,keepMounted:n.keepMounted,railGroup:n.railGroup,bodyKind:n.body.kind})),quickActions:t.quickActions?.map(n=>({id:n.id,title:n.title,label:n.label,placement:n.placement,pressed:n.pressed,disabled:n.disabled}))})}function _Be({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,selection:g}){Ye.useEffect(()=>{if(n)return nTr({documentId:t,title:c,type:s,...m?{status:m}:{}})},[n,t,m,c,s]);const S=Ye.useRef(g);S.current=g,Ye.useEffect(()=>{if(n)return xTr(t,()=>S.current?.()??CTr)},[n,t]);const k={id:t,title:c,kindLabel:s,...m?{note:{text:m,testId:"asset-editor-status"}}:{},sections:d??[]},A=Ye.useRef(k);A.current=k;const F=ETr(k);return Ye.useEffect(()=>{if(n)return cTr(t,()=>A.current)},[n,t,F]),null}function kTr({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,fill:g=!1,selection:S,children:k}){return q.jsxs("section",{className:"volter-asset-editor","data-testid":`asset-editor:${s}`,"aria-label":`${c} Asset Editor`,children:[q.jsx(_Be,{documentId:t,active:n,type:s,title:c,sections:d,status:m,selection:S}),q.jsx("main",{className:`volter-asset-editor__viewport${g?" volter-asset-editor__viewport--fill":""}`,children:k})]})}const ATr=Object.freeze(Object.defineProperty({__proto__:null,AssetEditorShell:kTr,AssetEditorSubject:_Be},Symbol.toStringTag,{value:"Module"})),w_e=new Map,ERe=new Set;function Cht(){for(const t of ERe)t()}function hyn(t){const n=Object.entries(t);for(const[s,c]of n)w_e.set(s,c);return Cht(),()=>{for(const[s,c]of n)w_e.get(s)===c&&w_e.delete(s);Cht()}}function DTr(t){return w_e.get(t)??null}function PTr(t){return ERe.add(t),()=>{ERe.delete(t)}}function ITr(t){return q.jsx(_Be,{...t})}const Eht=new Map;function NTr(t){const n=Eht.get(t);if(n)return n;function s(c){const d=Ye.useCallback(()=>DTr(t),[]),m=Ye.useSyncExternalStore(PTr,d,d);return m?q.jsx(m,{...c}):q.jsxs("div",{style:{minHeight:240},children:["Loading ",t,"…"]})}return s.displayName=`ContributionSurface(${t})`,Eht.set(t,s),s}const mBe=new Proxy(Object.freeze({AssetDocument:ITr}),{get(t,n,s){return typeof n!="string"||Reflect.has(t,n)||!/^[A-Z]/.test(n)?Reflect.get(t,n,s):NTr(n)}}),kht=Object.freeze({id:"classic",shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.6)",medium:"0 4px 12px rgba(0,0,0,0.5)",large:"0 8px 32px rgba(0,0,0,0.6)"}}),Ym=Object.freeze({id:"glass",color:{surface:{shell:"#12161f",panel:"rgba(255,255,255,0.06)",chrome:"rgba(255,255,255,0.10)",raised:"rgba(255,255,255,0.16)",inset:"rgba(10,14,22,0.38)",overlay:"rgba(255,255,255,0.08)"},boundary:{default:"rgba(255,255,255,0.22)",strong:"rgba(255,255,255,0.38)"},neutralOverlay:{hover:"color-mix(in srgb, currentColor 10%, transparent)",active:"color-mix(in srgb, currentColor 16%, transparent)"},scrim:"rgba(8,12,20,0.35)"},shape:{small:"4px",medium:"8px",large:"14px",full:"9999px"},elevation:{small:"0 4px 14px -6px rgba(0,0,0,0.45)",medium:"0 8px 24px -10px rgba(0,0,0,0.5)",large:"0 20px 46px -16px rgba(0,0,0,0.55), 0 4px 14px -6px rgba(0,0,0,0.35)"},treatment:{backdropBlurPx:1,backdropSaturation:1.15,edgeSpecular:.7,specularAngleDeg:120,refractionBezelPx:56,refractionThickness:1.25,textShadowOpacity:.72,contentFrostBlurPx:24,ambientLiftOpacity:.07,adaptiveContent:!0,brightTextShadowOpacity:0,brightFrostBg:"rgba(255,255,255,0.3)"},reducedTransparency:{surface:{shell:"#12161f",panel:"#33373e",chrome:"#3d4047",raised:"#4b4e55",inset:"#23272f",overlay:"#383b43"},scrim:"rgba(8,12,20,0.5)"}}),OTr=["classic","glass"],RTr=Object.freeze([{id:"classic",title:"Classic",description:"Opaque editor surfaces with conventional bars and panels."},{id:"glass",title:"Glass",description:"Adaptive clear material with refraction, frost, and floating chrome."}]),SB=new Map;let ihe=null;const ohe=new Set;function FTr(){return ihe??=[...RTr,...[...SB.values()].map(({id:t,title:n,description:s})=>({id:t,title:n,description:s}))],ihe}function MTr(t){return ohe.add(t),()=>ohe.delete(t)}function jTr(t){if(Bye(t.id))throw new Error(`registerContributedMaterial: material "${t.id}" is already registered.`);SB.set(t.id,t),ihe=null;for(const n of ohe)n();return()=>{if(SB.get(t.id)===t){SB.delete(t.id),ihe=null;for(const n of ohe)n()}}}function Bye(t){return typeof t=="string"&&(OTr.includes(t)||SB.has(t))}function LTr(t,n,s=!1){if(n!=="glass"){const d=SB.get(n);return{id:d?`${t.id}--${d.id}`:t.id,color:t.color,typography:t.typography,shape:d?.shape??kht.shape,elevation:d?.elevation??kht.elevation,...d?.density?{density:d.density}:{},...d?.stage?{stage:d.stage}:{},appearance:{material:"classic",transparency:"standard"}}}return{id:`${t.id}--${s?"glass-reduced":"glass"}`,color:{surface:s?Ym.reducedTransparency.surface:Ym.color.surface,boundary:Ym.color.boundary,content:t.color.content,accent:t.color.accent,semantic:t.color.semantic,neutralOverlay:Ym.color.neutralOverlay,scrim:s?Ym.reducedTransparency.scrim:Ym.color.scrim},typography:t.typography,shape:Ym.shape,elevation:Ym.elevation,appearance:{material:"glass",transparency:s?"reduced":"standard"},...s?{}:{treatment:Ym.treatment}}}const BTr={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},$Tr={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly"};function Cpe(t){return t===0?"0px":t===void 0?void 0:`var(--volter-space-${t})`}function $3t({gap:t,align:n,justify:s,padding:c,paddingX:d,paddingY:m,style:g}){return{gap:Cpe(t),alignItems:n?BTr[n]:void 0,justifyContent:s?$Tr[s]:void 0,padding:Cpe(c),paddingInline:Cpe(d),paddingBlock:Cpe(m),...g}}function hee(t,n){return n?`${t} ${n}`:t}function q3t({className:t,...n}){return q.jsx("div",{...n,className:hee("volter-stack",t),style:$3t(n)})}function bZ({className:t,...n}){return q.jsx("div",{...n,className:hee("volter-inline",t),style:$3t(n)})}function gyn({className:t,...n}){return q.jsx("span",{...n,"aria-hidden":"true",className:hee("volter-spacer",t)})}function qTr({orientation:t="horizontal",className:n,...s}){return q.jsx("div",{...s,"aria-hidden":"true","data-orientation":t,className:hee("volter-divider",n)})}function zTr({children:t,className:n,...s}){return q.jsx(bZ,{...s,className:hee("volter-actions",n),gap:2,align:"center",children:t})}function z3t(t,n){return n?`${t} ${n}`:t}const _p=Ye.forwardRef(function({as:n="span",variant:s="body",tone:c="primary",truncate:d=!1,selectable:m=!1,className:g,...S},k){const A=n;return q.jsx(A,{...S,ref:k,"data-variant":s,"data-tone":c,"data-truncate":d||void 0,"data-selectable":m||void 0,className:z3t("volter-text",g)})});function yyn({className:t,...n}){return q.jsx("kbd",{...n,className:z3t("volter-keycap",t)})}function B$(t,n){return n?`${t} ${n}`:t}function kRe({labelledBy:t,onDismiss:n,size:s="default",variant:c="default",className:d,...m}){const[g]=Ye.useState(()=>typeof document>"u"?null:document.querySelector(".volter-editor-theme")),S=Ye.useId(),k=q.jsx("div",{"data-volter-portal-content":g?S:void 0,className:"volter-dialog-scrim","data-variant":c,onPointerDown:A=>{A.target===A.currentTarget&&n?.()},children:q.jsx("div",{...m,role:"dialog","aria-modal":"true","aria-labelledby":t,"data-size":s,"data-variant":c,className:B$("volter-dialog",d)})});return g?q.jsxs(q.Fragment,{children:[q.jsx("span",{"data-volter-portal":S,style:{display:"none"}}),r2.createPortal(k,g)]}):k}function ARe({titleId:t,title:n,description:s}){return q.jsxs(q3t,{className:"volter-dialog-header",gap:2,children:[q.jsx(_p,{id:t,as:"h2",variant:"heading",children:n}),s&&q.jsx(_p,{as:"p",tone:"muted",children:s})]})}function V3t({className:t,...n}){return q.jsx(q3t,{...n,className:B$("volter-dialog-body",t)})}function DRe({children:t,className:n,...s}){return q.jsx(zTr,{...s,className:B$("volter-dialog-footer",n),children:t})}function vyn({className:t,...n}){return q.jsx("label",{...n,className:B$("volter-dialog-field",t)})}function byn({children:t}){return q.jsx(_p,{variant:"label",tone:"muted",children:t})}function Syn({className:t,...n}){return q.jsx(bZ,{...n,className:B$("volter-joined-field",t)})}function xyn({className:t,...n}){return q.jsx("span",{...n,className:B$("volter-joined-field-suffix",t)})}function hBe(t,n){return n?`${t} ${n}`:t}function VTr({className:t,...n}){return q.jsx("div",{...n,className:hBe("volter-field-group",t)})}function T_e({label:t,htmlFor:n,hint:s,compact:c=!1,className:d,children:m,...g}){return q.jsxs("div",{...g,"data-compact":c||void 0,className:hBe("volter-field-row",d),children:[q.jsx("label",{htmlFor:n,className:"volter-field-label",children:t}),q.jsx("div",{className:"volter-field-control",children:m}),s&&q.jsx("div",{className:"volter-field-hint",children:s})]})}function wyn({className:t,...n}){return q.jsx("label",{...n,className:hBe("volter-field-label",t)})}const Tyn=Ye.forwardRef(function({selected:n=!1,accent:s="bar",className:c,type:d="button",...m},g){return q.jsx("button",{...m,ref:g,type:d,"data-selected":n||void 0,"data-accent":s,className:c?`volter-list-button ${c}`:"volter-list-button"})});function UTr({tone:t="neutral",icon:n,title:s,description:c,action:d,compact:m=!1,className:g,...S}){const k=t==="error"?"alert":t==="loading"||t==="success"?"status":void 0;return q.jsxs("div",{...S,role:S.role??k,"data-tone":t,"data-compact":m||void 0,className:g?`volter-state-surface ${g}`:"volter-state-surface",children:[n&&q.jsx("div",{className:"volter-state-surface-icon",children:n}),q.jsx("strong",{className:"volter-state-surface-title",children:s}),c&&q.jsx("div",{className:"volter-state-surface-description",children:c}),d&&q.jsx("div",{className:"volter-state-surface-action",children:d})]})}function $$(t,n){return n?`${t} ${n}`:t}function JTr({variant:t="panel",border:n=!1,scroll:s=!1,className:c,...d}){return q.jsx("div",{...d,"data-variant":t,"data-border":n||void 0,"data-scroll":s||void 0,className:$$("volter-surface",c)})}function Cyn({tone:t="info",icon:n,actions:s,className:c,children:d,...m}){return q.jsxs("div",{...m,role:t==="error"?"alert":"status","data-tone":t,className:$$("volter-banner",c),children:[n&&q.jsx("span",{className:"volter-banner-icon",children:n}),q.jsx("div",{className:"volter-banner-content",children:d}),s&&q.jsx("div",{className:"volter-banner-actions",children:s})]})}const Eyn=Ye.forwardRef(function({className:n,...s},c){return q.jsx("div",{ref:c,...s,className:$$("volter-popover",n)})});function kyn({shape:t="label",className:n,...s}){return q.jsx("span",{...s,"data-shape":t,className:$$("volter-badge",n)})}function Aht({position:t="inside",className:n,...s}){return q.jsx("div",{...s,"aria-hidden":"true","data-position":t,className:$$("volter-drop-indicator",n)})}function Ayn({orientation:t,label:n,valueNow:s,valueMin:c=0,valueMax:d=100,className:m,...g}){return q.jsx("div",{...g,role:"separator","aria-label":n,"aria-orientation":t,"aria-valuenow":s,"aria-valuemin":s===void 0?void 0:c,"aria-valuemax":s===void 0?void 0:d,"data-orientation":t,className:$$("volter-resize-handle",m)})}function U3t(t,n){return n?`${t} ${n}`:t}const Dyn=Ye.forwardRef(function({className:n,onKeyDown:s,...c},d){return q.jsx("div",{...c,ref:d,role:"tablist",className:U3t("volter-tabs",n),onKeyDown:m=>{if(s?.(m),m.defaultPrevented||!["ArrowLeft","ArrowRight","Home","End"].includes(m.key))return;const g=Array.from(m.currentTarget.querySelectorAll('[role="tab"]:not(:disabled)'));if(g.length===0)return;m.preventDefault();const S=g.indexOf(document.activeElement);(m.key==="Home"?g[0]:m.key==="End"?g.at(-1):m.key==="ArrowRight"?g[(S+1+g.length)%g.length]:g[(S-1+g.length)%g.length])?.focus()}})}),Pyn=Ye.forwardRef(function({selected:n=!1,dirty:s=!1,badge:c,className:d,type:m="button",tabIndex:g,children:S,...k},A){return q.jsxs("button",{...k,ref:A,type:m,role:"tab",tabIndex:g??(n?0:-1),"aria-selected":n,"data-selected":n||void 0,className:U3t("volter-tab",d),children:[s&&q.jsxs(q.Fragment,{children:[q.jsx("span",{className:"volter-tab-dirty",title:"Unsaved","aria-hidden":"true"}),q.jsx("span",{className:"volter-sr-only",children:"Unsaved"})]}),q.jsx("span",{className:"volter-tab-label",children:S}),c!==void 0&&q.jsx("span",{className:"volter-tab-badge",children:c})]})});function gee(t,n){return n?`${t} ${n}`:t}const n$=Ye.forwardRef(function({label:n,compact:s=!1,selectionMode:c="independent",className:d,...m},g){return q.jsx("div",{...m,ref:g,role:"toolbar","aria-label":n,"data-compact":s||void 0,"data-selection-mode":c,className:gee("volter-toolbar",d)})});function Dht({className:t,...n}){return q.jsx("div",{...n,role:"group",className:gee("volter-toolbar-group",t)})}function Pht(t){return q.jsx("span",{...t,"aria-hidden":"true",className:gee("volter-toolbar-divider",t.className)})}function Iyn({className:t,onPointerDownCapture:n,...s}){return q.jsx(n$,{...s,compact:!0,className:gee("volter-floating-toolbar volter-glass-island",t),onPointerDownCapture:c=>{n?.(c),c.stopPropagation()}})}function Nyn({className:t,...n}){return q.jsx("div",{...n,role:"group",className:gee("volter-split-button",t)})}function J3t(t,n){return n?`${t} ${n}`:t}const Oyn=Ye.forwardRef(function({label:n,className:s,...c},d){return q.jsx("div",{...c,ref:d,role:"tree","aria-label":n,className:J3t("volter-tree",s)})}),Ryn=Ye.forwardRef(function({level:n=1,selected:s=!1,expanded:c,muted:d=!1,dragging:m=!1,leading:g,actions:S,className:k,children:A,style:F,...D},J){return q.jsxs("div",{...D,ref:J,role:"treeitem",tabIndex:D.tabIndex??-1,"aria-level":n,"aria-selected":s,...c===void 0?{}:{"aria-expanded":c},"data-selected":s||void 0,"data-muted":d||void 0,"data-dragging":m||void 0,className:J3t("volter-tree-row",k),style:{paddingLeft:6+Math.max(0,n-1)*14,...F},children:[g&&q.jsx("span",{className:"volter-tree-row-leading",children:g}),q.jsx("span",{className:"volter-tree-row-label",children:A}),S&&q.jsx("span",{className:"volter-tree-row-actions",children:S})]})});function W3t(t,n=8){const s=window.innerWidth,c=window.innerHeight,d=Math.max(n,s-t.width-n),m=Math.max(n,c-t.height-n);return{left:Math.min(Math.max(t.left,n),d),top:Math.min(Math.max(t.top,n),m)}}function $ye(t,n){return n?`${t} ${n}`:t}function PRe(t){return Array.from(t.querySelectorAll('[role="menuitem"]:not(:disabled), [role="menuitemradio"]:not(:disabled), [role="menuitemcheckbox"]:not(:disabled)'))}function WTr(t){PRe(t)[0]?.focus()}function Iht(t,n){if(!t)return!1;let s=n;for(;s;){if(t.contains(s))return!0;const d=((s instanceof Element?s:s.parentElement)?.closest("[data-volter-portal-content]")??null)?.getAttribute("data-volter-portal-content");if(!d)return!1;s=document.querySelector(`[data-volter-portal="${CSS.escape(d)}"]`)}return!1}const fN=Ye.forwardRef(function({className:n,role:s="menu",autoFocusFirst:c=!1,dismissBoundaryRef:d,onDismiss:m,onKeyDown:g,...S},k){const A=Ye.useRef(null);return Ye.useImperativeHandle(k,()=>A.current),Ye.useEffect(()=>{c&&PRe(A.current)[0]?.focus()},[c]),Ye.useEffect(()=>{if(!m)return;const F=D=>{const J=D.target;!Iht(A.current,J)&&!Iht(d?.current??null,J)&&m("outside")};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,m]),q.jsx("div",{...S,ref:A,role:s,className:$ye("volter-menu",n),onKeyDown:F=>{if(g?.(F),F.defaultPrevented)return;if(F.key==="Escape"){F.preventDefault(),m?.("escape");return}if(!["ArrowDown","ArrowUp","Home","End"].includes(F.key))return;F.preventDefault();const D=PRe(F.currentTarget);if(D.length===0)return;const J=D.indexOf(document.activeElement);F.key==="Home"?D[0]?.focus():F.key==="End"?D.at(-1)?.focus():F.key==="ArrowDown"?D[(J+1+D.length)%D.length]?.focus():D[(J-1+D.length)%D.length]?.focus()}})}),Jc=Ye.forwardRef(function({className:n,type:s="button",role:c="menuitem",onClick:d,onSelect:m,...g},S){return q.jsx("button",{...g,ref:S,type:s,role:c,className:$ye("volter-menu-item",n),onClick:k=>{d?.(k),k.defaultPrevented||m?.()}})});function t2(t){return q.jsx("hr",{...t,className:$ye("volter-menu-separator",t.className)})}const gBe=Ye.forwardRef(function({className:n,type:s="button",...c},d){return q.jsx("button",{...c,ref:d,type:s,"aria-haspopup":c["aria-haspopup"]??"menu",className:$ye("volter-menu-trigger",n)})});function she({children:t}){const n=Ye.useRef(null),[s,c]=Ye.useState(null),d=Ye.useId();return Ye.useLayoutEffect(()=>{c(n.current?.closest(".volter-editor-theme")??null)},[]),q.jsxs(q.Fragment,{children:[q.jsx("span",{ref:n,"data-volter-portal":d,style:{display:"none"}}),s?r2.createPortal(q.jsx("div",{"data-volter-portal-content":d,style:{display:"contents"},children:t}),s):null]})}function yBe({anchorRef:t,align:n="end",side:s="bottom",autoFocusFirst:c=!0,gap:d=4,clamp:m=!1,onDismiss:g,style:S,children:k,...A}){const[F,D]=Ye.useState(null),[J,$]=Ye.useState(null),G=Ye.useRef(null),se=Ye.useRef(!0),pe=Ye.useRef(!1),ue=Ye.useCallback(()=>{const De=t.current;if(!De||!F)return;const Pe=De.getBoundingClientRect(),be=F.getBoundingClientRect(),we=s==="right"||s==="left"?{left:s==="right"?Pe.right+d:Pe.left-d-be.width,top:Pe.top}:{left:n==="end"?Pe.right-be.width:Pe.left,top:s==="top"?Pe.top-d-be.height:Pe.bottom+d},qe=m?W3t({...we,width:be.width,height:be.height}):we,bt=G.current;bt?.left===qe.left&&bt.top===qe.top||(G.current=qe,$(qe))},[n,t,m,d,F,s]);Ye.useLayoutEffect(()=>{const De=t.current;if(!De||!F)return;ue();let Pe=0;const be=()=>{ue(),Pe=requestAnimationFrame(be)};Pe=requestAnimationFrame(be),window.addEventListener("resize",ue),document.addEventListener("scroll",ue,!0);const X=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return X?.observe(De),X?.observe(F),()=>{const we=se.current&&F.contains(document.activeElement);window.removeEventListener("resize",ue),document.removeEventListener("scroll",ue,!0),cancelAnimationFrame(Pe),X?.disconnect(),we&&queueMicrotask(()=>t.current?.focus())}},[t,F,ue]),Ye.useLayoutEffect(()=>{!c||pe.current||!F||!J||(pe.current=!0,WTr(F))},[c,F,J]);const Ce=De=>{se.current=De!=="outside",g(),De==="escape"&&t.current?.focus()};return q.jsx(she,{children:q.jsx(fN,{...A,ref:D,dismissBoundaryRef:t,onDismiss:Ce,style:{...S,position:"fixed",left:J?.left??0,top:J?.top??0,visibility:J?S?.visibility:"hidden"},children:k})})}function Fyn({label:t,children:n,gap:s=0,...c}){const[d,m]=Ye.useState(!1),g=Ye.useRef(null),S=Ye.useId(),k=F=>F instanceof Element&&(g.current?.contains(F)===!0||F.closest(`[data-volter-submenu="${S}"]`)!==null),A=F=>{k(F.relatedTarget)||m(!1)};return q.jsxs(q.Fragment,{children:[q.jsxs(Jc,{...c,ref:g,"aria-haspopup":"menu","aria-expanded":d,onPointerEnter:()=>m(!0),onPointerLeave:A,onClick:F=>{F.preventDefault(),m(!0)},onKeyDown:F=>{(F.key==="ArrowRight"||F.key==="Enter"||F.key===" ")&&(F.preventDefault(),m(!0)),F.key==="ArrowLeft"&&m(!1)},children:[q.jsx("span",{style:{flex:1},children:t}),q.jsx("span",{"aria-hidden":"true",style:{paddingInlineStart:"var(--volter-space-4)"},children:"▸"})]}),d&&q.jsx(yBe,{anchorRef:g,"data-volter-submenu":S,side:"right",gap:s,clamp:!0,autoFocusFirst:!1,onDismiss:()=>m(!1),onPointerLeave:A,children:n})]})}const Ms=Ye.forwardRef(function({variant:n="secondary",size:s="default",shape:c="default",className:d,type:m="button",...g},S){return q.jsx("button",{...g,ref:S,type:m,className:d?`volter-btn ${d}`:"volter-btn","data-variant":n,"data-size":s,"data-shape":c})}),dm=Ye.forwardRef(function({variant:n="ghost",visibleLabel:s,children:c,...d},m){return q.jsxs(Ms,{...d,ref:m,variant:n,"data-icon":"true","data-label-placement":s===void 0?void 0:"below",children:[c,s!==void 0&&q.jsx("span",{className:"volter-icon-button-label",children:s})]})}),PI={base:0,overlayLow:50,sticky:100,dropdown:1e3,toast:9999,modal:1e4},IG={0:"#1a1a1a",1:"#242424",2:"#2c2c2c",3:"#333333",inset:"#1e1e1e"},Nht={1:"#333333",2:"#444444"},xB={1:"#c5c8ce",2:"#9aa0a6",3:"#90959c"},HTr="#579EFF",GTr="rgba(87,158,255,0.15)",D5e={1:"#f2f6fb",2:"#d3d9e0",3:"#aab0b7"},vBe="#d8dee9",bBe="rgba(216,222,233,0.18)",H3t="#FF6B6B",G3t="#e0a030",K3t="#4caf50",X3t="rgba(76,175,80,0.15)",Y3t="rgba(255,107,107,0.15)",Z3t="rgba(224,160,48,0.12)",Q3t="rgba(255,107,107,0.06)",e4t="rgba(0,0,0,0.5)",t4t="#ff79c6",r4t="rgba(255,121,198,0.08)",n4t="#22b8d6",qye='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',zye='ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace',P5e={sm:"0 2px 8px rgba(0,0,0,0.6)",md:"0 4px 12px rgba(0,0,0,0.5)",lg:"0 8px 32px rgba(0,0,0,0.6)"},SBe={0:"var(--volter-surface-shell)",1:"var(--volter-surface-panel)",2:"var(--volter-surface-chrome)",3:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)"},ahe={1:"var(--volter-boundary-default)",2:"var(--volter-boundary-strong)"},Zf={1:"var(--volter-content-primary)",2:"var(--volter-content-muted)",3:"var(--volter-content-dim)"},Myn="var(--volter-accent)",jyn="var(--volter-accent-muted)",Lyn={background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},C_e="var(--volter-danger)",Byn="var(--volter-warn)",$yn="var(--volter-success)",qyn="var(--volter-success-muted)",zyn="var(--volter-danger-muted)",Vyn="var(--volter-warn-muted)",Uyn="var(--volter-danger-faint)",Jyn="var(--volter-scrim)",Wyn="var(--volter-dynamic)",Hyn="var(--volter-dynamic-muted)",R_={1:2,2:4,3:6,4:8,5:10,6:12,8:16,10:20,12:24},i4t={commandBar:36,panelHeader:30,localToolbar:28,treeRow:24,treeIndent:14,statusBar:36,toolSize:34,toolWidth:38,toolGap:7,areaSeam:1,areaEmboss:0},xBe=["solid","clay","unlit","wireframe","matcap","normals","overdraw","preview","rendered"];function Zb(t){return t===void 0?"":`${t}`}function Qp(t){return{control:{...KTr,...t.density?.control},font:{...YTr,...t.density?.font},icon:{...XTr,...t.density?.icon},chrome:{...i4t,...t.density?.chrome}}}const KTr={compact:20,default:24,comfortable:28},I5e={resting:1,active:2},XTr={xs:9,sm:10,md:12,lg:13,xl:14,"2xl":16},YTr={xs:9,sm:10,base:11,md:12,lg:13,xl:14,"2xl":16,heading:24},E_e={regular:400,semibold:600,bold:700},Epe={tight:1,snug:1.2,normal:1.4,relaxed:1.5},NG={duration:{fast:140,base:180,slow:300},easing:{standard:"cubic-bezier(0.32, 0.72, 0.28, 1)",out:"ease-out"}},Gyn="var(--volter-font-sans)",Kyn="var(--volter-font-mono)",qI={small:"3px",medium:"6px",large:"8px",full:"9999px"},sQ={sm:"var(--volter-radius-sm)",md:"var(--volter-radius-md)",lg:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},Xyn={sm:"var(--volter-shadow-sm)",md:"var(--volter-shadow-md)",lg:"var(--volter-shadow-lg)"},YY={xs:"var(--volter-font-xs)",sm:"var(--volter-font-sm)",base:"var(--volter-font-base)",md:"var(--volter-font-md)",lg:"var(--volter-font-lg)",xl:"var(--volter-font-xl)","2xl":"var(--volter-font-2xl)",heading:"var(--volter-font-heading)"},G0={1:"var(--volter-space-1)",2:"var(--volter-space-2)",3:"var(--volter-space-3)",4:"var(--volter-space-4)",5:"var(--volter-space-5)",6:"var(--volter-space-6)",8:"var(--volter-space-8)",10:"var(--volter-space-10)",12:"var(--volter-space-12)"},Oht={tight:"var(--volter-leading-tight)",snug:"var(--volter-leading-snug)",normal:"var(--volter-leading-normal)",relaxed:"var(--volter-leading-relaxed)"},Yyn={duration:{fast:"var(--volter-duration-fast)",base:"var(--volter-duration-base)",slow:"var(--volter-duration-slow)"},easing:{standard:"var(--volter-ease-standard)",out:"var(--volter-ease-out)"}},Zyn="var(--volter-focus-ring)",ZTr=["outliner","properties"],Vye=Object.keys({object:!0,modifier:!0,material:!0,tool:!0,operator:!0,data:!0,scene:!0,collection:!0,select:!0}),i$={id:"graphite-dark",color:{surface:{shell:IG[0],panel:IG[1],chrome:IG[2],raised:IG[3],inset:IG.inset,overlay:"rgba(36,36,36,0.94)"},boundary:{default:Nht[1],strong:Nht[2]},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:HTr,muted:GTr},semantic:{danger:H3t,dangerMuted:Y3t,dangerFaint:Q3t,warning:G3t,warningMuted:Z3t,success:K3t,successMuted:X3t,dynamic:t4t,dynamicMuted:r4t,instance:n4t},neutralOverlay:{hover:"rgba(255,255,255,0.08)",active:"rgba(255,255,255,0.14)"},scrim:e4t},typography:{sans:qye,mono:zye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:P5e.sm,medium:P5e.md,large:P5e.lg}},QTr={...i$,id:"graphite-neutral",color:{...i$.color,content:{primary:D5e[1],muted:D5e[2],dim:D5e[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:vBe,muted:bBe}}},eCr={id:"midnight-high-contrast",color:{surface:{shell:"#0b0f14",panel:"#111821",chrome:"#17212c",raised:"#223040",inset:"#080c11",overlay:"rgba(17,24,33,0.96)"},boundary:{default:"#34465a",strong:"#71869d"},content:{primary:"#f2f5f8",muted:"#bdc8d5",dim:"#8493a5",onAccent:"#071019",onBright:{primary:"#071019",muted:"rgba(7,16,25,0.82)",dim:"rgba(7,16,25,0.72)"}},accent:{default:"#65d1ff",muted:"rgba(101,209,255,0.18)"},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.18)",dangerFaint:"rgba(255,123,134,0.08)",warning:"#f3c969",warningMuted:"rgba(243,201,105,0.16)",success:"#62d394",successMuted:"rgba(98,211,148,0.18)",dynamic:"#e889ff",dynamicMuted:"rgba(232,137,255,0.12)",instance:"#a49bff"},neutralOverlay:{hover:"rgba(255,255,255,0.10)",active:"rgba(255,255,255,0.18)"},scrim:"rgba(0,0,0,0.68)"},typography:{sans:qye,mono:zye},shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.72)",medium:"0 6px 18px rgba(0,0,0,0.68)",large:"0 12px 40px rgba(0,0,0,0.76)"}},IRe={id:"glass-dark",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:"rgba(26,26,26,0.88)",panel:"rgba(36,36,36,0.62)",chrome:"rgba(44,44,44,0.68)",raised:"rgba(51,51,51,0.74)",inset:"rgba(30,30,30,0.7)",overlay:"rgba(36,36,36,0.55)"},boundary:{default:"rgba(255,255,255,0.14)",strong:"rgba(255,255,255,0.24)"},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:vBe,muted:bBe},semantic:{danger:H3t,dangerMuted:Y3t,dangerFaint:Q3t,warning:G3t,warningMuted:Z3t,success:K3t,successMuted:X3t,dynamic:t4t,dynamicMuted:r4t,instance:n4t},neutralOverlay:{hover:"color-mix(in srgb, currentColor 9%, transparent)",active:"color-mix(in srgb, currentColor 14%, transparent)"},scrim:"rgba(0,0,0,0.35)"},typography:{sans:qye,mono:zye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:"0 4px 16px rgba(0,0,0,0.55)",medium:"0 8px 28px rgba(0,0,0,0.5)",large:"0 16px 48px rgba(0,0,0,0.55)"},treatment:{backdropBlurPx:14,backdropSaturation:1.3,backdropBrightness:.5,edgeSpecular:.6,specularAngleDeg:120,thickness:.5}},tCr=(()=>{const{treatment:t,...n}=IRe;return{...n,id:"glass-dark-lite",appearance:{material:"glass",transparency:"reduced"},color:{...IRe.color,surface:{shell:"#1a1a1a",panel:"#222222",chrome:"#292929",raised:"#303030",inset:"#1d1d1d",overlay:"#202020"},scrim:e4t}}})(),NRe={id:"liquid-glass",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:Ym.color.surface.shell,panel:Ym.color.surface.panel,chrome:Ym.color.surface.chrome,raised:Ym.color.surface.raised,inset:Ym.color.surface.inset,overlay:Ym.color.surface.overlay},boundary:Ym.color.boundary,content:{primary:"#f2f6fb",muted:"rgba(242,246,251,0.85)",dim:"rgba(242,246,251,0.68)",onAccent:"#0b1526",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:vBe,muted:bBe},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.22)",dangerFaint:"rgba(255,123,134,0.10)",warning:"#ffd35f",warningMuted:"rgba(255,211,95,0.18)",success:"#58e078",successMuted:"rgba(88,224,120,0.20)",dynamic:"#ff8fd8",dynamicMuted:"rgba(255,143,216,0.14)",instance:"#3ad2ea"},neutralOverlay:Ym.color.neutralOverlay,scrim:Ym.color.scrim},typography:{sans:qye,mono:zye},shape:Ym.shape,elevation:Ym.elevation,treatment:Ym.treatment},rCr=(()=>{const{treatment:t,...n}=NRe;return{...n,id:"liquid-glass-lite",appearance:{material:"glass",transparency:"reduced"},color:{...NRe.color,surface:Ym.reducedTransparency.surface,scrim:Ym.reducedTransparency.scrim}}})(),o4t={"graphite-dark":i$,"graphite-neutral":QTr,"midnight-high-contrast":eCr,"glass-dark":IRe,"glass-dark-lite":tCr,"liquid-glass":NRe,"liquid-glass-lite":rCr};function nCr(t){return typeof t=="string"&&Object.hasOwn(o4t,t)}const Go={surface:{shell:"var(--volter-surface-shell)",panel:"var(--volter-surface-panel)",chrome:"var(--volter-surface-chrome)",raised:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)",overlay:"var(--volter-surface-overlay)"},boundary:{default:"var(--volter-boundary-default)",strong:"var(--volter-boundary-strong)"},content:{primary:"var(--volter-content-primary)",muted:"var(--volter-content-muted)",dim:"var(--volter-content-dim)",onAccent:"var(--volter-content-on-accent)",active:"var(--volter-content-active)",selected:"var(--volter-content-selected)"},accent:{default:"var(--volter-accent)",muted:"var(--volter-accent-muted)"},selection:{background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},semantic:{danger:"var(--volter-danger)",dangerMuted:"var(--volter-danger-muted)",dangerFaint:"var(--volter-danger-faint)",warning:"var(--volter-warn)",warningMuted:"var(--volter-warn-muted)",success:"var(--volter-success)",successMuted:"var(--volter-success-muted)",dynamic:"var(--volter-dynamic)",dynamicMuted:"var(--volter-dynamic-muted)",instance:"var(--volter-instance)"},neutralOverlay:{hover:"var(--volter-neutral-hover)",active:"var(--volter-neutral-active)"},scrim:"var(--volter-scrim)",typography:{sans:"var(--volter-font-sans)",mono:"var(--volter-font-mono)"},shape:{small:"var(--volter-radius-sm)",medium:"var(--volter-radius-md)",large:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},elevation:{small:"var(--volter-shadow-sm)",medium:"var(--volter-shadow-md)",large:"var(--volter-shadow-lg)"},focusRing:"var(--volter-focus-ring)"};function iCr(t){const n=`<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1L5 5L9 1' stroke='${t}' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(n)}")`}function oCr(t){if(!t)return"none";const n=[];return t.backdropBlurPx&&n.push(`blur(${t.backdropBlurPx}px)`),t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&n.push(`saturate(${t.backdropSaturation})`),t.backdropBrightness!==void 0&&t.backdropBrightness!==1&&n.push(`brightness(${t.backdropBrightness})`),n.length>0?n.join(" "):"none"}function Rht(t,n){return n?"transparent":`linear-gradient(var(${t}), var(${t})), linear-gradient(var(--volter-surface-shell), var(--volter-surface-shell))`}function Fht(t){const n=t?.contentFrostBlurPx??0;if(n<=0)return"none";const s=[`blur(${n}px)`];return t?.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function ORe(t){return(t?.contentFrostBlurPx??0)>0?"rgba(255,255,255,0.10)":"transparent"}function sCr(t){return t?"color-mix(in srgb, currentColor 7%, transparent)":"var(--volter-widget-field)"}function aCr(t){return t?"color-mix(in srgb, currentColor 26%, transparent)":"var(--volter-boundary-default)"}function cCr(t,n){const d=[n==="none"?"":n,t?"inset 0 1px 0 color-mix(in srgb, currentColor 14%, transparent), 0 5px 14px -12px color-mix(in srgb, currentColor 55%, transparent)":""].filter(Boolean);return d.length===0?"none":d.join(", ")}const lCr=.6,uCr=.5;function che(t,n){return`rgba(255,255,255,${Math.min(1,Number((t*n/lCr).toFixed(3)))})`}function s4t(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>che(d,n);return`linear-gradient(${s}deg, ${c(.95)} 0%, ${c(.38)} 16%, ${c(.16)} 40%, ${c(.14)} 60%, ${c(.45)} 84%, ${c(.85)} 100%)`}function fCr(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>che(d,n);return`linear-gradient(${s}deg, ${c(.16)} 0%, ${c(.05)} 24%, transparent 40%)`}function dCr(t){const n=t?.edgeSpecular??0,s=t?.thickness??0,c=[];if(n>0&&(c.push(`inset 0 1px 1px ${che(.28,n)}`),c.push(`inset 0 -1px 1px ${che(.1,n)}`)),s>0){const d=m=>`${Number((m*s/uCr).toFixed(1))}px`;c.push(`inset 0 ${d(12)} ${d(24)} ${d(-14)} rgba(255,255,255,0.35)`),c.push(`inset 0 ${d(-14)} ${d(28)} ${d(-18)} rgba(0,0,0,0.55)`),c.push(`0 ${d(18)} ${d(40)} ${d(-18)} rgba(0,0,0,0.55)`)}else c.push("var(--volter-shadow-lg)");return c.join(", ")}function q$(t){return t.appearance?t.appearance.material==="glass":t.treatment!==void 0}function pCr(t){return q$(t)?"var(--volter-surface-panel)":"color-mix(in srgb, var(--volter-surface-panel) 90%, transparent)"}function _Cr(t){return q$(t)?t.treatment?"var(--volter-surface-backdrop-filter)":"none":"blur(8px)"}function mCr(t){return t?"17px":"var(--volter-radius-md)"}function hCr(t){return t?"var(--volter-boundary-default)":"var(--volter-boundary-strong)"}function gCr(t){return t?"var(--volter-shadow-lg)":"var(--volter-shadow-sm)"}function yCr(t,n){const s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t.color.accent.default);if(!s)return null;const[c,d,m]=[s[1],s[2],s[3]].map(g=>Number.parseInt(g,16));return`rgba(${c},${d},${m},${n})`}function Uye(t){return q$(t)}function vCr(t){return Uye(t)?"var(--volter-neutral-active)":"var(--volter-accent-muted)"}function a4t(t){const n=t.trim().toLowerCase();if(n.startsWith("#"))return n.length===5?n.endsWith("f"):n.length===9?n.endsWith("ff"):!0;const s=/^rgba?\(([^)]*)\)$/.exec(n)??/^hsla?\(([^)]*)\)$/.exec(n);if(s){const c=(s[1]??"").split(/[,/]/)[3];return c===void 0||Number.parseFloat(c)>=1}return n!=="transparent"&&!n.includes("transparent")}function c4t(t){if(!a4t(t))return!1;const n=t.trim().toLowerCase();let s=null;const c=/^#([0-9a-f]{3}|[0-9a-f]{6})(?:f|ff)?$/.exec(n);if(c){const S=c[1].length===3?[...c[1]].map(k=>k+k).join(""):c[1];s=[0,2,4].map(k=>Number.parseInt(S.slice(k,k+2),16))}else{const S=/^rgba?\(([^)]*)\)$/.exec(n);S&&(s=(S[1]??"").split(/[,\s/]+/).filter(Boolean).slice(0,3).map(k=>k.endsWith("%")?Number.parseFloat(k)*2.55:Number.parseFloat(k)))}if(!s||s.some(S=>!Number.isFinite(S)))return!1;const[d,m,g]=s;return(.2126*d+.7152*m+.0722*g)/255>.5}function bCr(t){return Uye(t)?"var(--volter-content-primary)":a4t(t.color.accent.muted)?"var(--volter-content-on-accent)":"var(--volter-content-primary)"}function SCr(t){return Uye(t)?"color-mix(in srgb, currentColor 30%, transparent)":c4t(t.color.surface.panel)?`rgb(from ${t.color.accent.muted} r g b / 1)`:"var(--volter-accent)"}function xCr(t){return Uye(t)?"color-mix(in srgb, currentColor 76%, transparent)":"var(--volter-accent)"}function wCr(t){return t?"var(--volter-radius-full)":"var(--volter-radius-sm)"}function TCr(t){return!q$(t)||!t.treatment?"var(--volter-accent)":yCr(t,.82)??"var(--volter-accent)"}function CCr(t){const n=t?.edgeSpecular??0;return n<=0?"none":s4t({...t,edgeSpecular:n*.4})}function ECr(t){const n=t?.ambientLiftOpacity??0;if(n<=0)return"none";const s=Number(n.toFixed(3)),c=Number((n*.35).toFixed(3));return`linear-gradient(165deg, rgba(255,255,255,${s}) 0%, rgba(255,255,255,${c}) 55%, rgba(255,255,255,0) 100%)`}function l4t(t){return t<=0?"none":`0 1px 2px rgba(0,0,0,${Number(t.toFixed(3))})`}function u4t(t){return l4t(t?.textShadowOpacity??0)}function kCr(t){return t.treatment?.adaptiveContent?{primary:t.color.content.onBright.primary,muted:t.color.content.onBright.muted,dim:t.color.content.onBright.dim,textShadow:l4t(t.treatment.brightTextShadowOpacity??0),frostBg:t.treatment.brightFrostBg??ORe(t.treatment)}:{primary:t.color.content.primary,muted:t.color.content.muted,dim:t.color.content.dim,textShadow:u4t(t.treatment),frostBg:ORe(t.treatment)}}function ACr(t){return t.treatment?t.treatment.adaptiveContent?"rgba(255,255,255,0.9)":PCr(t.color.surface.chrome,.9):t.color.surface.chrome}function DCr(t){return t.color.surface.panel}function PCr(t,n){const s=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9.]+)\s*\)$/.exec(t);if(!s)return t;const c=Math.max(Number(s[4]),n);return`rgba(${s[1]},${s[2]},${s[3]},${c})`}function Mht(t){if(!t)return"none";const s=[`blur(${Math.max(16,t.contentFrostBlurPx??0)}px)`];return t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function ICr(t){return t.color.boundary.area??t.color.boundary.default}function NCr(t,n){return`color-mix(in srgb, ${t} 98.4%, ${n})`}function OG(t){return`color-mix(in srgb, var(--volter-area-emboss-mix), ${t})`}function OCr(t){const n=Qp(t).chrome.areaEmboss;return n>0?`#ffffff ${n}%`:"transparent 100%"}function RCr(t){const n=kCr(t),s=q$(t),c=t.color.widget?.regular??t.color.surface.raised,d=t.color.widget?.menu??t.color.surface.raised,m=t.color.widget?.field??t.color.surface.inset,g=t.color.widget?.emboss?`0 1px 0 ${t.color.widget.emboss}`:"none",S=A=>`color-mix(in srgb, ${A} 87.8%, ${t.color.content.primary})`,k=`color-mix(in srgb, ${t.color.surface.panel} 86.5%, ${t.color.surface.raised})`;return{"--volter-surface-shell":t.color.surface.shell,"--volter-surface-panel":t.color.surface.panel,"--volter-surface-chrome":t.color.surface.chrome,"--volter-surface-raised":t.color.surface.raised,"--volter-surface-inset":t.color.surface.inset,"--volter-surface-overlay":t.color.surface.overlay,"--volter-surface-backdrop-filter":oCr(t.treatment),"--volter-surface-sticky":Rht("--volter-surface-chrome",s),"--volter-surface-sticky-panel":Rht("--volter-surface-panel",s),"--volter-surface-sticky-backdrop-filter":"none","--volter-surface-body-frost-filter":Fht(t.treatment),"--volter-content-frost-filter":Fht(t.treatment),"--volter-content-frost-bg":ORe(t.treatment),"--volter-input-surface":sCr(s),"--volter-input-border":aCr(s),"--volter-input-shadow":cCr(s,g),"--volter-structural-divider":s?"transparent":t.color.boundary.default,"--volter-card-specular-ring":s4t(t.treatment),"--volter-card-specular-sheen":fCr(t.treatment),"--volter-card-specular-shadow":dCr(t.treatment),"--volter-card-refraction-thickness":String(t.treatment?.refractionThickness??0),"--volter-card-refraction-bezel":String(t.treatment?.refractionBezelPx??28),"--volter-card-refraction-angle":String(t.treatment?.specularAngleDeg??120),"--volter-ambient-lift":ECr(t.treatment),"--volter-island-surface":pCr(t),"--volter-island-backdrop-filter":_Cr(t),"--volter-island-radius":mCr(s),"--volter-island-border-color":hCr(s),"--volter-island-shadow":gCr(s),"--volter-island-specular-ring":CCr(t.treatment),"--volter-selection-bg":vCr(t),"--volter-content-on-selection":bCr(t),"--volter-selection-border":SCr(t),"--volter-selection-indicator":xCr(t),"--volter-island-control-radius":wCr(s),"--volter-island-primary-bg":TCr(t),"--volter-content-text-shadow":u4t(t.treatment),"--volter-content-primary-on-bright":n.primary,"--volter-content-muted-on-bright":n.muted,"--volter-content-dim-on-bright":n.dim,"--volter-content-text-shadow-on-bright":n.textShadow,"--volter-content-frost-bg-on-bright":n.frostBg,"--volter-content-adaptive":t.treatment?.adaptiveContent?"1":"0","--volter-glass-regular-bg":ACr(t),"--volter-glass-regular-backdrop-filter":Mht(t.treatment),"--volter-glass-regular-panel-bg":DCr(t),"--volter-glass-regular-panel-backdrop-filter":Mht(t.treatment),"--volter-glass-dark-frost-panel-bg":"rgba(5,8,13,0.74)","--volter-glass-dark-frost-content-bg":"rgba(5,8,13,0.84)","--volter-scrim-backdrop-filter":t.treatment?"blur(8px)":"none","--volter-boundary-default":t.color.boundary.default,"--volter-boundary-strong":t.color.boundary.strong,"--volter-boundary-area":ICr(t),"--volter-tree-indent-guide":t.color.boundary.indent??"transparent","--volter-boundary-divider":t.color.boundary.divider??t.color.boundary.default,"--volter-area-emboss-mix":OCr(t),"--volter-area-emboss":OG(t.color.surface.panel),"--volter-area-emboss-stage":OG(OG(t.color.viewport?.background??t.color.surface.panel)),"--volter-area-emboss-stage-header":OG(OG(k)),"--volter-content-primary":t.color.content.primary,"--volter-content-muted":t.color.content.muted,"--volter-content-dim":t.color.content.dim,"--volter-content-on-accent":t.color.content.onAccent,"--volter-content-menu":t.color.content.menu??t.color.content.primary,"--volter-content-status":t.color.content.status??t.color.content.dim,"--volter-content-placeholder":t.color.content.placeholder??t.color.content.dim,"--volter-content-active":t.color.content.active??"","--volter-content-selected":t.color.content.selected??t.color.content.active??"","--volter-accent":t.color.accent.default,"--volter-accent-muted":t.color.accent.muted,"--volter-danger":t.color.semantic.danger,"--volter-danger-muted":t.color.semantic.dangerMuted,"--volter-danger-faint":t.color.semantic.dangerFaint,"--volter-warn":t.color.semantic.warning,"--volter-warn-muted":t.color.semantic.warningMuted,"--volter-success":t.color.semantic.success,"--volter-success-muted":t.color.semantic.successMuted,"--volter-dynamic":t.color.semantic.dynamic,"--volter-dynamic-muted":t.color.semantic.dynamicMuted,"--volter-instance":t.color.semantic.instance,"--volter-neutral-hover":t.color.neutralOverlay.hover,"--volter-neutral-active":t.color.neutralOverlay.active,"--volter-scrim":t.color.scrim,"--volter-surface-section":`color-mix(in srgb, ${t.color.surface.panel} 64.9%, ${t.color.surface.raised})`,"--volter-surface-section-edge":`color-mix(in srgb, ${t.color.surface.panel} 29.7%, ${t.color.surface.raised})`,"--volter-surface-header":k,"--volter-surface-row-alt":NCr(t.color.surface.panel,t.color.content.primary),...c4t(t.color.surface.panel)?{"--volter-tree-row-selected-bg":t.color.accent.muted,"--volter-tree-row-active-bg":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-row-active-border":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-datablock-fill":"color-mix(in srgb, var(--volter-category-data, currentColor) 14%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 14%, transparent)"}:{"--volter-tree-row-selected-bg":`color-mix(in srgb, ${t.color.accent.default} 42%, #000)`,"--volter-tree-row-active-bg":`color-mix(in srgb, ${t.color.accent.default} 70%, #000)`,"--volter-tree-row-active-border":"rgb(from var(--volter-tree-row-active-bg) calc(r + 40) calc(g + 40) calc(b + 40))","--volter-tree-datablock-fill":"color-mix(in srgb, color-mix(in srgb, var(--volter-category-data, currentColor) 60%, black) 26%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 24%, transparent)"},"--volter-tree-active-name-underline":t.color.content.active?"none":"underline","--volter-viewport-background":t.color.viewport?.background??"","--volter-viewport-grid":t.color.viewport?.grid??"","--volter-viewport-axis-x":t.color.viewport?.axisX??"","--volter-viewport-axis-y":t.color.viewport?.axisY??"","--volter-viewport-axis-z":t.color.viewport?.axisZ??"","--volter-viewport-wire":t.color.viewport?.wire??"","--volter-viewport-wire-opacity":Zb(t.stage?.wireOpacity),"--volter-viewport-axis-line-width":Zb(t.stage?.axisLineWidth),"--volter-viewport-selection":t.color.viewport?.selection??"","--volter-viewport-active":t.color.viewport?.active??"","--volter-gizmo-x":t.color.gizmo?.x??"","--volter-gizmo-y":t.color.gizmo?.y??"","--volter-gizmo-z":t.color.gizmo?.z??"","--volter-gizmo-navigation-x":t.color.gizmo?.navigationX??"","--volter-gizmo-navigation-y":t.color.gizmo?.navigationY??"","--volter-gizmo-navigation-z":t.color.gizmo?.navigationZ??"","--volter-gizmo-hover":t.color.gizmo?.hover??"","--volter-gizmo-drag":t.color.gizmo?.drag??"","--volter-viewport-gizmo-opacity":Zb(t.stage?.gizmoOpacity),"--volter-viewport-gizmo-arrow-length":Zb(t.stage?.gizmoArrowLength),"--volter-viewport-gizmo-arrow-head":Zb(t.stage?.gizmoArrowHead),"--volter-viewport-gizmo-ring-width":Zb(t.stage?.gizmoRingWidth),"--volter-viewport-navigation-gizmo":t.stage?.navigationGizmo??"","--volter-viewport-navigation-corner":t.stage?.navigationCorner??"","--volter-viewport-navigation-size":Zb(t.stage?.navigationSize),"--volter-viewport-gizmo-highlight-saturation":Zb(t.stage?.gizmoHighlightSaturation),"--volter-viewport-gizmo-highlight-value":Zb(t.stage?.gizmoHighlightValue),"--volter-viewport-gizmo-size":t.stage?.gizmoSize===void 0?"":`${t.stage.gizmoSize}`,"--volter-viewport-grid-line-width":Zb(t.stage?.gridLineWidth),"--volter-viewport-grid-major-width":Zb(t.stage?.gridMajorWidth),"--volter-viewport-grid-major-contrast":Zb(t.stage?.gridMajorContrast),"--volter-viewport-selection-box":t.stage?.selectionBox??"","--volter-viewport-selection-box-frame":t.stage?.selectionBoxFrame??"","--volter-viewport-outline-style":t.stage?.outlineStyle??"","--volter-viewport-outline-width":Zb(t.stage?.outlineWidth),"--volter-viewport-outline-hidden":t.stage?.outlineHidden===void 0?"":`${t.stage.outlineHidden}`,"--volter-viewport-selection-box-width":Zb(t.stage?.selectionBoxWidth),"--volter-viewport-chrome-bar":t.stage?.chrome?.bar??"","--volter-viewport-chrome-view-name":t.stage?.chrome?.viewName??"","--volter-viewport-chrome-tools":t.stage?.chrome?.tools??"","--volter-viewport-chrome-display":t.stage?.chrome?.display??"","--volter-viewport-chrome-transform-controls":t.stage?.chrome?.transformControls??"",...Object.fromEntries(xBe.map(A=>[`--volter-viewport-word-${A}`,t.stage?.words?.shading?.[A]??""])),"--volter-viewport-word-helpers":t.stage?.words?.helpers??"","--volter-widget-regular":c,"--volter-widget-regular-hover":S(c),"--volter-widget-menu":d,"--volter-widget-menu-hover":S(d),"--volter-widget-field":m,"--volter-widget-emboss-shadow":g,...Object.fromEntries(Vye.map(A=>[`--volter-category-${A}`,t.color.category?.[A]??"currentColor"])),"--volter-region-outliner":t.color.region?.outliner??t.color.surface.panel,"--volter-region-outliner-header":t.color.region?.outliner??t.color.surface.chrome,"--volter-region-properties":t.color.region?.properties??t.color.surface.panel,"--volter-region-properties-header":t.color.region?.properties??t.color.surface.chrome,"--volter-font-sans":t.typography.sans,"--volter-font-mono":t.typography.mono,"--volter-radius-sm":t.shape.small,"--volter-radius-md":t.shape.medium,"--volter-radius-lg":t.shape.large,"--volter-radius-full":t.shape.full,"--volter-shadow-sm":t.elevation.small,"--volter-shadow-md":t.elevation.medium,"--volter-shadow-lg":t.elevation.large,"--volter-focus-ring":`${I5e.active}px solid ${t.color.accent.default}`,"--volter-select-chevron":iCr(t.color.content.muted),"--volter-space-1":`${R_[1]}px`,"--volter-space-2":`${R_[2]}px`,"--volter-space-3":`${R_[3]}px`,"--volter-space-4":`${R_[4]}px`,"--volter-space-5":`${R_[5]}px`,"--volter-space-6":`${R_[6]}px`,"--volter-space-8":`${R_[8]}px`,"--volter-space-10":`${R_[10]}px`,"--volter-space-12":`${R_[12]}px`,"--volter-command-bar-height":`${Qp(t).chrome.commandBar}px`,"--volter-panel-header-height":`${Qp(t).chrome.panelHeader}px`,"--volter-local-toolbar-height":`${Qp(t).chrome.localToolbar}px`,"--volter-tree-row-height":`${Qp(t).chrome.treeRow}px`,"--volter-tree-indent":`${Qp(t).chrome.treeIndent}px`,"--volter-status-bar-height":`${Qp(t).chrome.statusBar}px`,"--volter-tool-size":`${Qp(t).chrome.toolSize}px`,"--volter-tool-width":`${Qp(t).chrome.toolWidth}px`,"--volter-tool-gap":`${Qp(t).chrome.toolGap}px`,"--volter-area-seam-width":`${Qp(t).chrome.areaSeam}px`,"--volter-control-compact-height":`${Qp(t).control.compact}px`,"--volter-control-default-height":`${Qp(t).control.default}px`,"--volter-control-comfortable-height":`${Qp(t).control.comfortable}px`,"--volter-stroke-resting":`${I5e.resting}px`,"--volter-stroke-active":`${I5e.active}px`,"--volter-font-xs":`${Qp(t).font.xs}px`,"--volter-font-sm":`${Qp(t).font.sm}px`,"--volter-font-base":`${Qp(t).font.base}px`,"--volter-font-md":`${Qp(t).font.md}px`,"--volter-font-lg":`${Qp(t).font.lg}px`,"--volter-font-xl":`${Qp(t).font.xl}px`,"--volter-font-2xl":`${Qp(t).font["2xl"]}px`,"--volter-icon-xs":`${Qp(t).icon.xs}px`,"--volter-icon-sm":`${Qp(t).icon.sm}px`,"--volter-icon-md":`${Qp(t).icon.md}px`,"--volter-icon-lg":`${Qp(t).icon.lg}px`,"--volter-icon-xl":`${Qp(t).icon.xl}px`,"--volter-icon-2xl":`${Qp(t).icon["2xl"]}px`,"--volter-font-heading":`${Qp(t).font.heading}px`,"--volter-font-weight-regular":String(E_e.regular),"--volter-font-weight-semibold":String(E_e.semibold),"--volter-font-weight-bold":String(E_e.bold),"--volter-leading-tight":String(Epe.tight),"--volter-leading-snug":String(Epe.snug),"--volter-leading-normal":String(Epe.normal),"--volter-leading-relaxed":String(Epe.relaxed),"--volter-duration-fast":`${NG.duration.fast}ms`,"--volter-duration-base":`${NG.duration.base}ms`,"--volter-duration-slow":`${NG.duration.slow}ms`,"--volter-ease-standard":NG.easing.standard,"--volter-ease-out":NG.easing.out,"--volter-z-base":String(PI.base),"--volter-z-overlay-low":String(PI.overlayLow),"--volter-z-sticky":String(PI.sticky),"--volter-z-dropdown":String(PI.dropdown),"--volter-z-toast":String(PI.toast),"--volter-z-modal":String(PI.modal)}}const RRe="volter-editor-theme";function FCr(t,n=i$){t.classList.add(RRe),t.dataset.volterTheme=n.id,t.dataset.volterChrome=q$(n)?"islands":"bars";for(const[s,c]of Object.entries(RCr(n)))t.style.setProperty(s,c)}const Qyn={bg:Go.semantic.dangerFaint,border:Go.semantic.danger,fg:Go.semantic.danger},e0n={bg:Go.semantic.warningMuted,border:Go.semantic.warning,fg:Go.semantic.warning},f4t=Ye.createContext(null);function MCr(){return Ye.useContext(f4t)}function DR(t,n){return n?`${t} ${n}`:t}const Zm=Ye.forwardRef(function({className:n,type:s="text",...c},d){return q.jsx("input",{...c,ref:d,type:s,className:DR("volter-input",n)})}),Iw=Ye.forwardRef(function({className:n,...s},c){return q.jsx("select",{...s,ref:c,className:DR("volter-select",n)})}),wBe=Ye.forwardRef(function({className:n,...s},c){return q.jsx("textarea",{...s,ref:c,className:DR("volter-input volter-textarea",n)})}),TD=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"checkbox",className:DR("volter-checkbox",n)})}),d4t=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"color",className:DR("volter-color-swatch",n)})}),t0n=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"file",className:DR("volter-file-input",n)})}),r0n=Ye.forwardRef(function({className:n,...s},c){return q.jsx("input",{...s,ref:c,type:"range",className:DR("volter-range",n)})}),hC="default",jCr={id:hC,title:"Editor"},wB=new Map;let lhe=null,aQ=hC;const FRe=new Set;function MRe(){for(const t of FRe)t()}function n0n(){return lhe??=[jCr,...[...wB.values()].map(({id:t,title:n})=>({id:t,title:n}))],lhe}function yee(t){return typeof t=="string"&&(t===hC||wB.has(t))}function LCr(t){if(yee(t.id))throw new Error(`registerContributedIconSet: icon set "${t.id}" is already registered.`);return wB.set(t.id,t),lhe=null,MRe(),()=>{wB.get(t.id)===t&&(wB.delete(t.id),lhe=null,MRe())}}function uhe(){return aQ}function fhe(t){const n=yee(t)?t:hC;n!==aQ&&(aQ=n,MRe())}function TBe(t){return FRe.add(t),()=>FRe.delete(t)}function p4t(t){return aQ===hC?null:wB.get(aQ)?.glyphs[t]??null}const jht={xs:"var(--volter-icon-xs)",sm:"var(--volter-icon-sm)",md:"var(--volter-icon-md)",lg:"var(--volter-icon-lg)",xl:"var(--volter-icon-xl)","2xl":"var(--volter-icon-2xl)"},Lht={current:void 0,primary:Go.content.primary,muted:Go.content.muted,dim:Go.content.dim,accent:Go.accent.default,danger:Go.semantic.danger};function dc({icon:t,size:n="sm",tone:s="current",label:c,className:d,style:m,spin:g=!1,...S}){Ye.useSyncExternalStore(TBe,uhe,uhe);const k=p4t(t.iconName);if(k){const A=s!=="current",F=k.tone?`var(--volter-category-${k.tone}, currentColor)`:void 0,D=A?Lht[s]:k.tonedPath?void 0:F,J=A?"currentColor":F??"currentColor";return q.jsxs("svg",{...S,viewBox:k.viewBox??"0 0 16 16","data-volter-tone":A?void 0:k.tone,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{width:"1.25em",height:"1em",overflow:"visible",verticalAlign:"-0.125em",fontSize:jht[n],color:D,...m},children:[q.jsx("path",{d:k.path,fill:"currentColor"}),k.tonedPath?q.jsx("path",{d:k.tonedPath,fill:J}):null]})}return q.jsx(n0r,{...S,icon:t,fixedWidth:!0,spin:g,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{fontSize:jht[n],color:Lht[s],...m}})}function _4t({direction:t,size:n="xs",tone:s="current",style:c}){return q.jsx(dc,{icon:t==="right"?MTt:XTt,size:n,tone:s,...c?{style:c}:{}})}function i0n({direction:t,size:n="xs",tone:s="current"}){return q.jsx(dc,{icon:t==="right"?ITt:uLe,size:n,tone:s})}function fy(t,n){return{...n,iconName:t}}const Kk={action:{add:QTt,close:cLe,delete:OTt,search:NTt,refresh:tvr,undo:VOe,redo:Dmt,build:X0r,export:evr,select:Pmt},transport:{play:F0r,pause:Z0r,restart:Dmt,stop:RTt,step:j0r},content:{project:qOe,folder:uee,file:zTt,source:fLe,scene:pLe,entity:aR,component:GB,camera:cye,light:oLe,image:iB,audio:lLe,data:FTt,code:sLe,stateMachine:LTt},status:{success:aLe,info:R$,warning:fee,error:qTt,visible:iLe,hidden:dLe,locked:Fme,unlocked:zOe},viewport:{zoomIn:S0r,zoomOut:v0r,pan:I0r,frame:g0r,projection:fy("viewport-projection",E5e),projectionOrthographic:fy("viewport-orthographic",E5e),camera:fy("viewport-camera",Amt),cameraView:fy("viewport-camera-view",Amt),cameraLocked:fy("viewport-camera-locked",Fme),cameraUnlocked:fy("viewport-camera-unlocked",zOe)},modeling:{extrude:fy("mesh-extrude",BTt),inset:fy("mesh-inset",K0r),bevel:fy("mesh-bevel",rvr),loopCut:fy("mesh-loop-cut",x0r),knife:fy("mesh-knife",J0r),smooth:fy("mesh-smooth",y0r),shrinkFatten:fy("mesh-shrink-fatten",VTt),subdivide:fy("mesh-subdivide",M0r)},tool:{extension:GB,select:fy("tool-select-box",Pmt),move:JTt,rotate:PTt,scale:fy("tool-scale",T0r),transform:fy("tool-transform",N0r),snap:R0r,frame:ZTt,grid:E5e,profiler:KTt},panel:{outliner:fy("outliner",tCt),properties:fy("properties",WTt),"folder-open":qOe,"cubes-stacked":UTt,users:w0r,list:vZ,"rotate-left":VOe}};function SZ({value:t,onChange:n,onChangeEnd:s,step:c=.1,precision:d=3,disabled:m=!1,label:g,labelColor:S,style:k,testId:A,title:F}){const[D,J]=Ye.useState(!1),[$,G]=Ye.useState(""),se=Ye.useRef({startX:0,startVal:0,dragging:!1,gesture:!1,lastVal:0}),pe=Ye.useRef(null),ue=MCr();Ye.useEffect(()=>{if(!D)return;const we=pe.current;we&&(we.focus(),we.select())},[D]);const Ce=t===null,De=t??0,Pe=Ce?"—":Number.isFinite(De)?De.toFixed(d):0 .toFixed(d),be=we=>{if(m)return;se.current={startX:we.clientX,startVal:De,dragging:!1,gesture:!1,lastVal:De};const qe=Pt=>{const Wt=Pt.clientX-se.current.startX;if(Math.abs(Wt)>3&&(se.current.dragging=!0),se.current.dragging){se.current.gesture||(se.current.gesture=!0,ue?.begin());const zt=se.current.startVal+Wt*c,ft=Math.round(zt/c)*c;se.current.lastVal=ft,n(ft)}},bt=()=>{window.removeEventListener("pointermove",qe),window.removeEventListener("pointerup",bt),se.current.gesture&&ue?.end(),se.current.dragging?s?.(se.current.lastVal):(J(!0),G(Ce?"":Pe))};window.addEventListener("pointermove",qe),window.addEventListener("pointerup",bt)},X=()=>{J(!1);const we=Number.parseFloat($);Number.isFinite(we)&&(n(we),s?.(we))};return q.jsxs("div",{className:"volter-number-input","data-testid":A,title:F,style:k,children:[g&&q.jsx("span",{className:"volter-number-input-label",style:S?{color:S}:void 0,children:g}),D?q.jsx(Zm,{ref:pe,value:$,onChange:we=>G(we.target.value),onBlur:X,onKeyDown:we=>{we.key==="Enter"&&X(),we.key==="Escape"&&J(!1)},placeholder:Ce?"—":void 0,className:"volter-number-input-editor"}):q.jsx("div",{onPointerDown:be,className:"volter-number-input-scrub","data-mixed":Ce||void 0,"data-disabled":m||void 0,children:Pe})]})}const BCr={minHeight:"var(--volter-panel-header-height)",padding:`0 ${R_[4]}px`,color:Go.content.muted,fontSize:"var(--volter-font-base)",fontWeight:E_e.semibold,textTransform:"uppercase",display:"flex",alignItems:"center",gap:R_[2],userSelect:"none"},$Cr={...BCr,background:"var(--volter-surface-sticky)",borderBottom:"1px solid var(--volter-structural-divider)",flexShrink:0};function Jye({name:t,actions:n,onHeaderClick:s,hideHeader:c=!1,style:d,children:m,...g}){return q.jsxs("div",{...g,style:{display:"flex",flexDirection:"column",pointerEvents:"auto",...d},children:[!c&&q.jsxs("div",{role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?S=>{S.key==="Enter"&&s()}:void 0,style:{...$Cr,cursor:s?"pointer":void 0,pointerEvents:"auto"},children:[q.jsx("span",{style:{flexShrink:0},children:t}),n&&q.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:R_[3]},children:n})]}),m]})}function qCr({label:t,icon:n,description:s,actions:c,collapsible:d=!0,defaultOpen:m=!0,children:g}){const[S,k]=Ye.useState(m),A=q.jsxs("span",{className:"volter-section-title",children:[q.jsx("span",{children:t}),s?q.jsx("small",{children:s}):null]});return q.jsxs("section",{className:"volter-section",children:[q.jsxs("div",{className:"volter-section-header",children:[d?q.jsxs("button",{type:"button",className:"volter-section-trigger","aria-expanded":S,onClick:()=>k(!S),children:[q.jsx(_4t,{direction:S?"down":"right",style:{fontSize:"var(--volter-section-disclosure-size, var(--volter-icon-xs))"}}),n&&q.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}):q.jsxs("div",{className:"volter-section-trigger","data-volter-static":!0,children:[n&&q.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}),c?q.jsx("div",{className:"volter-section-actions",children:c}):null]}),(S||!d)&&q.jsx("div",{className:"volter-section-body",children:g})]})}const zI=8,VI=6;function zCr(t){return t==="top"?"bottom":t==="bottom"?"top":t==="left"?"right":"left"}function VCr(t,n,s){return t==="top"?n.top-s.height-VI>=zI:t==="bottom"?n.bottom+s.height+VI<=window.innerHeight-zI:t==="left"?n.left-s.width-VI>=zI:n.right+s.width+VI<=window.innerWidth-zI}function UCr(t,n,s){let c=n.left+(n.width-s.width)/2,d=n.top+(n.height-s.height)/2;return t==="top"?d=n.top-s.height-VI:t==="bottom"?d=n.bottom+VI:t==="left"?c=n.left-s.width-VI:c=n.right+VI,{left:Math.max(zI,Math.min(c,window.innerWidth-s.width-zI)),top:Math.max(zI,Math.min(d,window.innerHeight-s.height-zI)),ready:!0}}function mO({text:t,hotkey:n,children:s,position:c="bottom",delay:d=400}){const m=Ye.useId(),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef(null),A=Ye.useRef(!1),F=Ye.useRef(!1),[D,J]=Ye.useState(!1),[$,G]=Ye.useState(null),[se,pe]=Ye.useState({left:0,top:0,ready:!1});Ye.useLayoutEffect(()=>{G(g.current?.closest(".volter-editor-theme")??null)},[]),Ye.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const ue=()=>{k.current&&clearTimeout(k.current),k.current=null,J(!1)},Ce=()=>{!A.current&&!F.current&&ue()},De=be=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{pe(X=>({...X,ready:!1})),J(!0)},be)};Ye.useLayoutEffect(()=>{if(!D)return;const be=()=>{const X=g.current?.getBoundingClientRect(),we=S.current?.getBoundingClientRect();if(!X||!we)return;const qe=VCr(c,X,we)?c:zCr(c);pe(UCr(qe,X,we))};return be(),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[n,c,t,D]);let Pe=s;if(Ye.isValidElement(s)){const be=[s.props["aria-describedby"],D?m:null].filter(Boolean).join(" ");Pe=Ye.cloneElement(s,be?{"aria-describedby":be}:{})}return q.jsxs("span",{ref:g,className:"volter-tooltip-anchor",onMouseEnter:()=>{A.current=!0,De(d)},onMouseLeave:()=>{A.current=!1,Ce()},onFocusCapture:()=>{F.current=!0,De(0)},onBlurCapture:be=>{be.currentTarget.contains(be.relatedTarget)||(F.current=!1,Ce())},children:[Pe,D&&$&&r2.createPortal(q.jsxs("div",{ref:S,id:m,role:"tooltip",className:"volter-tooltip",style:{left:se.left,top:se.top,visibility:se.ready?"visible":"hidden"},children:[q.jsx("span",{children:t}),n&&q.jsx("kbd",{children:n})]}),$)]})}function JCr({value:t,onChange:n,onAxisChange:s,step:c=.1,disabled:d=!1,testIdPrefix:m}){const g=k=>m?`${m}-${k}`:void 0,S=k=>A=>{if(s)s(k,A);else{const F=[t[0]??0,t[1]??0,t[2]??0];F[k]=A,n(F)}};return q.jsxs("div",{style:{display:"flex",gap:4},children:[q.jsx(SZ,{label:"X",labelColor:"#E06178",value:t[0],onChange:S(0),step:c,disabled:d,style:{flex:1},testId:g("x")}),q.jsx(SZ,{label:"Y",labelColor:"#C2ED66",value:t[1],onChange:S(1),step:c,disabled:d,style:{flex:1},testId:g("y")}),q.jsx(SZ,{label:"Z",labelColor:"#6BABF5",value:t[2],onChange:S(2),step:c,disabled:d,style:{flex:1},testId:g("z")})]})}const N5e={bg:Go.surface.panel,surface:Go.surface.chrome,surfaceHover:Go.surface.raised,border:Go.boundary.default,text:Go.content.primary,textMuted:Go.content.muted,onAccent:Go.content.onAccent,accent:Go.accent.default,neutralHover:Go.neutralOverlay.hover,radiusSmall:Go.shape.small,radiusMedium:Go.shape.medium,inputBg:Go.surface.inset,dynamic:Go.semantic.dynamic,dynamicBg:Go.semantic.dynamicMuted},o0n=Go.typography.sans,s0n=Go.typography.mono;function a0n(t,n){t.onChange(n)}function c0n(t,n){(t.onChangeEnd??t.onChange)(n)}const l0n={display:"flex",alignItems:"center",gap:4},u0n={fontSize:"var(--volter-font-sm)",color:Go.content.muted,marginBottom:2},WCr={fontSize:"var(--volter-font-base)",fontWeight:600,color:Go.content.muted,textTransform:"uppercase",letterSpacing:.4},HCr=72;function f0n({label:t,active:n,disabled:s,onClick:c,testId:d}){return q.jsx(Ms,{variant:n?"primary":"secondary",size:"compact","aria-pressed":n,disabled:s,"data-testid":d,onClick:()=>{s||c()},style:{flex:1},children:t})}function d0n(t){const n=t.match(/^(-?\d+\.?\d*)\s*(px|em|rem|%|vh|vw|deg|s|ms)?$/);if(n)return{num:Number.parseFloat(n[1]??"0"),unit:n[2]||""};const s=Number.parseFloat(t);return{num:Number.isNaN(s)?0:s,unit:""}}const O5e=22,Bht={width:O5e,height:O5e,flex:`0 0 ${O5e}px`,borderRadius:N5e.radiusSmall,border:`1px solid ${N5e.border}`,background:N5e.inputBg,objectFit:"cover",backgroundImage:"linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%),linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px"};function GCr({value:t,onChange:n,options:s,previewUrlFor:c,disabled:d,note:m,testId:g}){const S=t&&!s.includes(t)?[t,...s]:s;return q.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[t?q.jsx("img",{src:c(t),alt:"",style:Bht,"data-testid":`${g}-thumb`}):q.jsx("span",{style:Bht,"aria-hidden":"true"}),q.jsxs(Iw,{"data-testid":g,disabled:d,value:t,title:t||"No texture assigned",onChange:k=>n(k.target.value),style:{flex:1,minWidth:0},children:[q.jsx("option",{value:"",children:"—"}),S.map(k=>q.jsx("option",{value:k,children:k},k))]}),q.jsx(dm,{"data-testid":`${g}-clear`,"aria-label":"Clear this texture slot",title:"Clear this texture slot",disabled:d||!t,onClick:()=>n(""),children:q.jsx(dc,{icon:cLe})})]}),m&&q.jsx("span",{"data-testid":`${g}-note`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.muted},children:m})]})}function jRe({value:t,onCommit:n,onKeyDown:s,onFocus:c,...d}){const[m,g]=Ye.useState(null),S=Ye.useRef(!1),k=()=>{!S.current&&m!==null&&m!==t&&n(m),S.current=!1,g(null)};return q.jsx(Zm,{...d,value:m??t,onFocus:A=>{g(t),c?.(A)},onChange:A=>g(A.target.value),onBlur:k,onKeyDown:A=>{A.key==="Enter"&&A.target.blur(),A.key==="Escape"&&(S.current=!0,A.target.blur()),s?.(A)}})}const k_e=new Map,LRe=new Set;let m4t=0;function $ht(){m4t+=1;for(const t of LRe)t()}function p0n(t,n){return k_e.set(t,n),$ht(),()=>{k_e.get(t)===n&&(k_e.delete(t),$ht())}}function CBe(t){return LRe.add(t),()=>LRe.delete(t)}function o$(){return m4t}function s2(t){return t?k_e.get(t)??null:null}const QL=new Map;function _0n(t){QL.set(t,(QL.get(t)??0)+1);let n=!1;return()=>{if(n)return;n=!0;const s=(QL.get(t)??0)-1;s>0?QL.set(t,s):QL.delete(t)}}function KCr(t){return(QL.get(t)??0)>0}const PR=1e4;async function CC(t,n=4e3){if(t())return!0;const s=performance.now();return new Promise(c=>{const d=()=>{t()?c(!0):performance.now()-s>=n?c(!1):setTimeout(d,25)};setTimeout(d,0)})}const xZ=new Map,TB=new Set,dhe=new Set,A_e=new Set;let h4t=0;function g4t(){h4t+=1;for(const t of[...TB])t()}function XCr(t,n){return xZ.set(t,n),g4t(),()=>{xZ.get(t)===n&&xZ.delete(t)}}function YCr(t){xZ.has(t)&&g4t()}function ZCr(t){return TB.add(t),()=>{TB.delete(t)}}function qht(){return h4t}function cQ(t){return xZ.get(t)}function y4t(t,n=1e4){const s=cQ(t);return s!==void 0?Promise.resolve(s):new Promise(c=>{const d=()=>{const g=cQ(t);g!==void 0&&(clearTimeout(m),TB.delete(d),c(g))},m=setTimeout(()=>{TB.delete(d),c(void 0)},n);TB.add(d)})}function v4t(t){dhe.add(t);for(const n of[...A_e])n();return()=>{dhe.delete(t)}}function b4t(t,n=1e4){return dhe.has(t)?Promise.resolve(!0):new Promise(s=>{const c=()=>{dhe.has(t)&&(clearTimeout(d),A_e.delete(c),s(!0))},d=setTimeout(()=>{A_e.delete(c),s(!1)},n);A_e.add(c)})}async function EBe(t){if(KCr(t)&&!await CC(()=>s2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}let BRe=null;const ZY=new Map;let YO=[];function QCr(t){if(BRe=t,!t)return;const n=YO;YO=[];for(const s of n)S4t(t,s)}function S4t(t,n){ZY.get(n.id)?.();const s=t.show(n),c=()=>{ZY.get(n.id)===c&&(ZY.delete(n.id),s(),n.onDismiss?.())};return ZY.set(n.id,c),c}let eEr=0;function s$(t){const n=t.id??`notification-${++eEr}`,s={...t,id:n};return BRe?S4t(BRe,s):(YO=[...YO.filter(c=>c.id!==n),s],()=>kBe(n))}function kBe(t){const n=ZY.get(t);if(n){n();return}const s=YO.find(c=>c.id===t);s&&(YO=YO.filter(c=>c.id!==t),s.onDismiss?.())}let Xk={sessions:[],selectedSessionId:null,selectedSession:null,cursorMs:0,liveEdgeMs:0,loading:!0,error:null},phe=!0,kpe=null,D_e=null,RG=null,P_e=!1;const QY=new Set;function tEr(t,n,s){const c=t[0]??null;return c!==null&&n.length>0&&!n.some(m=>m.id===c.id)?{sessionId:c.id,latestAppeared:!0}:s&&t.some(m=>m.id===s)?{sessionId:s,latestAppeared:!1}:{sessionId:c?.id??null,latestAppeared:!1}}function _he(t){Xk=t;for(const n of QY)n()}async function rEr(){const t=await fetch("/__editor/gameplay-sessions");return(await L_(t,"Could not load Gameplay Sessions")).sessions}async function nEr(t){return L_(await fetch(`/__editor/gameplay-sessions/${encodeURIComponent(t)}`),"Could not load the selected Gameplay Session").then(n=>n.session)}async function iEr(){try{const t={sessions:await rEr()},n=tEr(t.sessions,Xk.sessions,D_e),s=n.sessionId;n.latestAppeared&&(phe=!0),D_e=s;const c=s?await nEr(s):null;if(D_e!==s){P_e=!0;return}const d=t.sessions.map(S=>S.id===c?.id?c:S),m=c?.durationMs??0,g=phe?m:Math.min(Xk.cursorMs,m);_he({sessions:d,selectedSessionId:s,selectedSession:c,cursorMs:g,liveEdgeMs:m,loading:!1,error:null})}catch(t){_he({...Xk,loading:!1,error:t instanceof Error?t.message:String(t)})}}function lQ(){return RG?(P_e=!0,RG):(RG=iEr().finally(()=>{RG=null,P_e&&(P_e=!1,lQ())}),RG)}function oEr(t){return QY.add(t),QY.size===1&&(lQ(),kpe=window.setInterval(()=>void lQ(),1e3)),()=>{QY.delete(t),QY.size===0&&kpe!==null&&(window.clearInterval(kpe),kpe=null)}}function sEr(t){const n=Xk.sessions.find(s=>s.id===t);n&&(D_e=n.id,phe=!0,_he({...Xk,selectedSessionId:n.id,selectedSession:n,cursorMs:n.durationMs,liveEdgeMs:n.durationMs}),lQ())}function aEr(t){const n=Math.max(0,Math.min(t,Xk.liveEdgeMs));phe=Xk.liveEdgeMs-n<250,_he({...Xk,cursorMs:n})}const x4t={getSnapshot:()=>Xk,subscribe:oEr,select:sEr,seek:aEr,refresh:lQ};let w4t=null;const $Re=new Set,m0n={getSnapshot:()=>w4t,subscribe(t){return $Re.add(t),()=>$Re.delete(t)}};function h0n(t){w4t=t;for(const n of $Re)try{n()}catch{}}let ZO={phase:null,at:0,run:0},dN=ZO;const qRe=new Map;let T4t=null;function cEr(t){T4t=t,C4t(ZO)}function C4t(t){ZO=t;try{T4t?.(t)}catch{}}function uQ(){const t=[...qRe.values()].at(-1),n=t?{...t,run:dN.run}:dN;n.phase===ZO.phase&&n.at===ZO.at&&n.run===ZO.run||C4t(n)}function g0n(t=Date.now()){return dN={phase:null,at:t,run:dN.run+1},uQ(),ZO.run}function y0n(t,n=Date.now()){dN={phase:t,at:n,run:dN.run},uQ()}function v0n(t=Date.now()){dN={phase:null,at:t,run:dN.run},uQ()}function ABe(t,n=Date.now()){const s=Symbol();return qRe.set(s,{phase:t.slice(0,160),at:n}),uQ(),()=>{qRe.delete(s)&&uQ()}}const lEr=Ye.lazy(()=>lo(()=>import("./GameplaySessionTimeline-BOP2Rzca.js"),__vite__mapDeps([254,1,2,3,4,20,21,142,127,143,22,23])).then(t=>({default:t.GameplaySessionTimeline})));class DBe extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){console.error(`[tools] ${this.props.file} crashed while rendering:`,n,s.componentStack)}render(){return this.state.error?q.jsxs("div",{style:{padding:R_[6],fontSize:"var(--volter-font-md)",color:Go.semantic.danger,maxWidth:640},children:[q.jsxs("div",{style:{fontWeight:600,marginBottom:R_[2]},children:["Tool crashed: ",q.jsx("code",{children:this.props.file})]}),q.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)}),q.jsx("div",{style:{color:Go.content.muted,marginTop:R_[3]},children:"The editor is fine — fix the tool file and save; it reloads in place."})]}):this.props.children}}function uEr({contribution:t,Component:n,documentId:s,active:c,document:d,accountRevision:m,playKey:g}){const S=Ye.useRef(null),[k,A]=Ye.useState(null),F=Ye.useRef(null),D=Ye.useRef(null),J=Ye.useRef(t.file);J.current=t.file;const $=Ye.useRef(s);return $.current=s,Ye.useEffect(()=>{const G=S.current;if(!G)return;let se=!1;A(null);const pe=(De,Pe)=>{if(se)return;const be=De instanceof Error?De:new Error(String(De));console.error(`[tools] ${J.current} crashed while rendering:`,be,Pe?.componentStack),A(be),$.current&&v4t($.current)},ue=G.appendChild(document.createElement("div"));ue.style.display="contents";const Ce=rLe.createRoot(ue,{onUncaughtError:pe});return F.current=Ce,()=>{se=!0,F.current=null,D.current?.(),D.current=null,queueMicrotask(()=>{Ce.unmount(),ue.remove()})}},[]),Ye.useEffect(()=>{const G=F.current;if(!G)return;A(null);const se={contributionId:t.id,client:e0e(),surfaces:mBe,account:rBe(),work:Ce=>{D.current?.(),D.current=Ce===null?null:ABe(`building ${Ce.replace(/^building /,"")}`)},notify:Ce=>s$({...Ce,id:`contribution:${t.id}:${Ce.title}`,...Ce.tone==="warning"?{fades:!0}:{}}),...t.point==="workspace.analytics"?{gameplaySessions:x4t}:{play:Rye()},...s?{documentId:s,publishContext:Ce=>XCr(s,Ce)}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}},pe=n??t.Component,ue=Ye.createElement(pe,{...se,...t.tool?{tool:t.tool}:{}});G.render(s?Ye.createElement(fEr,{documentId:s},ue):ue)},[m,c,t,n,s,d,g]),q.jsxs(q.Fragment,{children:[k?q.jsxs("div",{style:{padding:R_[6],color:Go.semantic.danger},children:["Tool crashed: ",q.jsx("code",{children:t.file}),q.jsx("div",{style:{whiteSpace:"pre-wrap",marginTop:R_[2]},children:String(k)})]}):null,q.jsx("div",{ref:S,style:{minHeight:0,width:"100%"}})]})}function fEr({documentId:t,children:n}){return Ye.useEffect(()=>v4t(t),[t]),q.jsx(q.Fragment,{children:n})}function IR({contribution:t,Component:n,documentId:s,active:c,document:d}){const m=Ye.useSyncExternalStore(Dye,cN,cN),g=Ye.useSyncExternalStore(Fye,lN,lN),S=t.point==="workspace.analytics"?"gameplay-sessions":g;return q.jsxs("div",{"data-testid":`tool-panel-${t.id}`,style:{flex:1,minHeight:0,overflow:t.point==="workspace.analytics"?"visible":"auto",color:Go.content.primary,display:"flex",flexDirection:"column"},children:[t.point==="workspace.analytics"?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(lEr,{})}):null,q.jsx(DBe,{file:t.file,children:q.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:q.jsx(uEr,{contribution:t,...n?{Component:n}:{},accountRevision:m,playKey:S,...s?{documentId:s}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}})})})]})}function dEr({id:t,title:n,file:s,tool:c,Component:d,adapter:m,nodeId:g}){Ye.useSyncExternalStore(Dye,cN,cN),Ye.useSyncExternalStore(Fye,lN,lN);const S=g?m.hierarchy.node(g):null;return q.jsx("div",{className:"volter-inspector-tool-section","data-testid":`inspector-tool-${t}`,children:q.jsx(DBe,{file:s,children:q.jsx(Xvr,{adapter:m,nodeId:g,children:q.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:e0e(),surfaces:mBe,account:rBe(),play:Rye(),node:S,nodeId:g,adapter:m})})})})}const pEr=Symbol("volter.inspection.mixed");function zRe(t){return t===pEr}function PBe(t){return t.readonlyReason??"This field is read-only."}function IBe(t){return"column"}function NBe(t,n){return t.quickActions.filter(s=>s.placement===n)}const VRe="preview",zht="transform",R5e="properties",E4t="stories",b0n="story-args",S0n="Story Args";function Vht(t){return`group:${t}`}const k4t=100,_Er=1e3,fQ=2e3,A4t=3e3,mEr=4e3,hEr=5e3,gEr={nullSubjectId:null};function D4t(t){return"sections"in t}const I_e=[];let P4t=0;const URe=new Set;function Uht(){P4t++;for(const t of URe)t()}function yEr(t){return URe.add(t),()=>{URe.delete(t)}}function Jht(){return P4t}function I4t(t){return I_e.push(t),Uht(),()=>{const n=I_e.indexOf(t);n>=0&&(I_e.splice(n,1),Uht())}}function Wht(t,n,s=gEr){return I_e.filter(c=>c.match(t,n,s))}function N4t(t){if(typeof t!="object"||t===null)return!1;const n=t.name;return n==="Canceled"||n==="CancellationError"||n==="AbortError"}const vEr=1e3;class bEr{_entries=[];_listeners=new Set;_nextId=0;_version=0;_notifyScheduled=!1;_sink=null;setSink(n){this._sink=n}counts={info:0,warn:0,error:0};log(n,s){this._push("info",n,s)}warn(n,s){this._push("warn",n,s)}error(n,s){this._push("error",n,s)}logStructured(n,s,c,d,m){this._push(n,s,c,d,m)}clear(){this._entries=[],this.counts={info:0,warn:0,error:0},this._notify()}getEntries(){return this._entries}subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;_push(n,s,c,d,m){const g=this._entries[this._entries.length-1];if(g&&g.level===n&&g.message===s&&g.source===c&&g.metadata?.instanceId===m?.instanceId){g.count++,g.timestamp=Date.now(),this._sink?.(g),this._notify();return}const S={id:this._nextId++,timestamp:Date.now(),level:n,message:s,count:1};if(c&&(S.source=c),d&&(S.subsystem=d),m&&(S.metadata=m),this._entries.push(S),this.counts[n]++,this._sink?.(S),this._entries.length>vEr){const k=this._entries.shift();this.counts[k.level]=Math.max(0,this.counts[k.level]-1)}this._notify()}_notify(){this._version++,!this._notifyScheduled&&(this._notifyScheduled=!0,queueMicrotask(()=>{this._notifyScheduled=!1;for(const n of this._listeners)n()}))}}const Qs=new bEr;typeof window<"u"&&(window.__volterEditorConsole=Qs);const Hht=1e3,Ght=4e3;function CB(t){try{const n=t;return typeof t=="object"&&n!==null&&typeof n.stack=="string"&&n.stack!==""&&typeof n.message=="string"?n.stack.includes(n.message)?n.stack:`${String(t)}
46
46
  ${n.stack}`:String(t)}catch{return Object.prototype.toString.call(t)}}function SEr(t){if(typeof t!="object"||t===null)return CB(t);const n=new WeakSet;let s;try{s=JSON.stringify(t,(c,d)=>typeof d!="object"||d===null?d:n.has(d)?"[Circular]":(n.add(d),d))}catch{s=void 0}return s===void 0?CB(t):s.length>Hht?`${s.slice(0,Hht)}…`:s}function JRe(t){if(t.length===0)return"";const[n,...s]=t;if(typeof n!="string"||s.length===0)return t.map(CB).join(" ");let c=0;const d=n.replace(/%([sdifoOjc%])/g,(g,S)=>{if(S==="%")return"%";if(c>=s.length)return g;const k=s[c++];switch(S){case"s":return typeof k=="string"?k:CB(k);case"d":case"i":{if(typeof k=="symbol")return"NaN";if(typeof k=="bigint")return String(k);const A=Number(k);return Number.isFinite(A)?String(Math.trunc(A)):String(A)}case"f":return typeof k=="symbol"?"NaN":String(Number(k));case"c":return"";default:return SEr(k)}}),m=s.slice(c);return m.length===0?d:`${d} ${m.map(CB).join(" ")}`}function xEr(t,n){const s=t[0];if(typeof s!="string"||!/^(Encountered two children with the same key|Each child in a list should have a unique|Maximum update depth exceeded|Cannot update a component)/.test(s))return n;try{const c=Ye.captureOwnerStack?.();return c?`${n}
47
47
  Owner stack:${c}`:n}catch{return n}}function WRe(t,n={}){const s=t instanceof Error?`${t.name}: ${t.message}`:CB(t),c=[n.source?`[${n.source}] ${s}`:s],d=n.componentStack?.trim();d&&c.push(`Component stack:
48
48
  ${d}`),t instanceof Error&&t.stack&&t.stack!==s&&c.push(`JavaScript stack:
@@ -939,7 +939,7 @@ ${n}`,d=lZ.get(c);if(d)return d;const m=SYr(t,s,n).finally(()=>{lZ.get(c)===m&&l
939
939
  body{margin:0;min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 50% 30%,#1c2a3a 0,#101318 52%,#0b0e13 100%)}
940
940
  main{width:min(440px,100%);box-sizing:border-box;padding:34px;text-align:center;border:1px solid rgba(255,255,255,.1);border-radius:20px;background:rgba(23,28,35,.92);box-shadow:0 22px 60px rgba(0,0,0,.38)}
941
941
  .brand-mark{width:68px;height:68px;margin:0 auto 20px}.brand-mark img{display:block;width:100%;height:100%}h1{margin:0 0 10px;font-size:22px}p{margin:0;color:#aeb9c6;font-size:14px;line-height:1.6}
942
- </style><main><div class="brand-mark">${_4r()}</div><h1>Session ended</h1><p>This editor session has ended. You can close this tab.</p></main>`})}))}const Age=new Set;function _Zr(t){return Age.add(t),()=>{Age.delete(t)}}function mZr(){try{window.focus()}catch{}if(Age.size===0){window.location.reload();return}for(const t of[...Age])t()}function hZr(t,n,s={}){t.addEventListener("tab-refocus",c=>cZr(c)),t.addEventListener("tab-yield",c=>lZr(n,c)),t.addEventListener("tab-close",()=>pZr(n,s)),t.addEventListener("tab-adopt",()=>mZr())}const $k="/__editor",gZr=globalThis,md=gZr.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__,xC=md?.clientId??globalThis.crypto?.randomUUID?.()??`editor-${Date.now()}`,Q0e=zAt,yZr=awr;function vZr(t,n,s){md?.reportPhase?.(t,n,s)}function bZr(t){md?.reportCensus?.(t)}function SZr(){md?.stopHeartbeat?.();const t=kw;if(t!==null){kw=null,eB=0,md?.source===t&&(md.source=null),P$===t&&(P$=null);try{t.close()}catch{}}}function xZr(){const t=new URLSearchParams({clientId:xC,participantId:Q0e,displayName:yZr});return md?.tabId&&t.set("tabId",md.tabId),`${$k}/events?${t}`}let kw=md?.source??null,eB=md?.source&&md.pageOwned?1:0,P$=null;const BRt=new Set(["editor-command"]);function $Rt(t,n){if(!md||md.source!==t)return;md.queueListeners=md.queueListeners.filter(({type:c,listener:d})=>n(c)?(t.removeEventListener(c,d),!1):!0);const s=md.pending.filter(c=>n(c.type));md.pending=md.pending.filter(c=>!n(c.type));for(const{type:c,data:d}of s)t.dispatchEvent(new MessageEvent(c,{data:d}))}function wZr(t){P$!==t&&(P$=t,hZr(t,$k,{tabId:md?.tabId,epoch:md?.epoch}),$Rt(t,n=>!BRt.has(n)))}function jD(){kw||(md?.source?(kw=md.source,md.pageOwned&&eB++):(kw=new EventSource(xZr()),md&&(md.source=kw)));const t=kw;wZr(t),eB++;const n=[];let s=!1;return{addEventListener(c,d){const m=d;t.addEventListener(c,m),n.push({type:c,listener:m}),BRt.has(c)&&$Rt(t,g=>g===c)},removeEventListener(c,d){const m=d;t.removeEventListener(c,m);const g=n.findIndex(S=>S.type===c&&S.listener===m);g>=0&&n.splice(g,1)},close(){if(!s){s=!0;for(const{type:c,listener:d}of n)t.removeEventListener(c,d);n.length=0,eB--,eB<=0&&(t.close(),kw===t&&(kw=null),md?.source===t&&(md.source=null),P$===t&&(P$=null),eB=0)}}}}function TZr(){const t=kw??md?.source??null;if(!t)return"unknown";if(typeof t.connected=="boolean")return t.connected?"open":"closed";const n=t.readyState;return typeof n=="number"?n===1?"open":"closed":"unknown"}function CZr(){if(typeof EventSource>"u")return()=>{};const t=jD(),n=Lze(c=>{c!==null&&c.reason!=="server-gone"&&SZr()}),s=kZr();return()=>{s(),n(),t.close()}}const EZr=5;function kZr(){if(typeof window>"u")return()=>{};let t=0;const n=d=>{d===""||t>=EZr||(t+=1,FZ("console-entries",{entries:[{id:`boot-error:${t}`,severity:"error",message:`editor runtime error: ${d}`,source:"runtime",occurrences:1}],_clientId:md?.clientId??"boot"}))},s=d=>{const m=d.error;n(m?.stack??`${d.message} (${d.filename??"?"}:${d.lineno??0})`)},c=d=>{const m=d.reason;N4t(m)||n(m instanceof Error?m.stack??m.message:`unhandled rejection: ${String(m)}`)};return window.addEventListener("error",s),window.addEventListener("unhandledrejection",c),()=>{window.removeEventListener("error",s),window.removeEventListener("unhandledrejection",c)}}const AZr=2e3,DZr={"command-received":`${$k}/command-received`,"command-result":`${$k}/command-result`,"command-listener":`${$k}/command-listener`,"console-entries":`${$k}/console-entries`,"console-resolved":`${$k}/console-resolved`,"play-phase":`${$k}/play-phase`,state:`${$k}/state`,"tab-route":`${$k}/tab/route`};async function FZ(t,n){if(!(typeof fetch>"u"))try{await fetch(DZr[t],{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...md?.controlLifecycle?{_controlLifecycle:md.controlLifecycle}:{}})})}catch{}}async function bN(t,n){(kw??md?.source??null)?.send?.(t,n)||await FZ(t,n)}async function PZr(t,n){const s=kw??md?.source??null;if(!s){await FZ("command-result",n);return}let c;const d=new Promise(A=>{c=A}),m=A=>{const F=A.data;let D=F;if(typeof F=="string")try{D=JSON.parse(F)}catch{}D===t&&c()};s.addEventListener(qSt,m);const g={...n,_awaitCallerReceipt:!0};s.send?.("command-result",g)||await FZ("command-result",g);let S,k=!1;await Promise.race([d.then(()=>{k=!0}),new Promise(A=>{S=setTimeout(A,AZr)})]),S!==void 0&&clearTimeout(S),k||await FZ("command-result",n),s.removeEventListener(qSt,m)}function IZr(t){bN("tab-route",{clientId:xC,participantId:Q0e,route:t})}function Bze(t){return{ok:!1,reason:t instanceof Error?t.message:String(t)}}async function NZr(t,n){try{const s=new URLSearchParams({root:t,dir:n}),c=await fetch(`${Jl}/assets?${s}`,{cache:"no-store"});return{ok:!0,entries:(await L_(c,`Could not list ${t}/${n} from ${Jl}/assets`)).entries??[]}}catch(s){return Bze(s)}}async function eve(t,n){if(t!=="public")return NZr(t,n);try{return{ok:!0,entries:(await gR().list(n)).map(c=>({name:c.name,type:c.type==="dir"?"directory":"file",...c.size===void 0?{}:{size:c.size},...c.mtime===void 0?{}:{modifiedAt:c.mtime}}))}}catch(s){return Bze(s)}}async function qRt(){try{const t=await fetch(`${Jl}/project-components`,{cache:"no-store"});return{ok:!0,entries:(await L_(t,`Could not list project components from ${Jl}/project-components`)).components??[]}}catch(t){return Bze(t)}}function l2n(t){return`${Jl}/download?file=${encodeURIComponent(t)}`}class VSt extends Error{constructor(n,s){super(s),this.code=n,this.name="AssetDeliveryError"}}function USt(t){return{offline:"Network delivery is offline. SSD assets remain available.","quota-limited":"The remote provider quota is exhausted. Retry after the provider resets it.","license-blocked":"This delivery is blocked because its license terms are not accepted.",unavailable:"No healthy SSD, cloud, or remote delivery is available for this variant.","provider-error":"The remote provider could not return delivery metadata. Retry the request."}[t]}const Dge=new Map,Pge=new Set;function $ze(t,n){return`${t}:${n}`}function u2n(t,n){return Dge.get($ze(t,n))??null}function f2n(t){return Pge.add(t),()=>Pge.delete(t)}async function d2n(){try{const t=await fetch(`${Jl}/asset-library/downloaded`),n=await L_(t,"Could not read the downloaded-asset list");Dge.clear();for(const s of n.downloaded)Dge.set($ze(s.source,s.id),`/${s.path}`);for(const s of Pge)s()}catch{}}async function p2n(t){const n=new URLSearchParams;n.set("source",t.source),n.set("type",t.type),t.q&&n.set("q",t.q),t.category&&n.set("category",t.category),t.offset!=null&&n.set("offset",String(t.offset)),t.limit!=null&&n.set("limit",String(t.limit));const s=await fetch(`${Jl}/asset-library/search?${n}`);if(of(s,"Asset Library search failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset Library search failed (${s.status}).`)}return await s.json()}async function _2n(t,n){return OZr(t,n)}async function OZr(t,n){const s=new URLSearchParams({source:t,id:n});let c;try{c=await fetch(`${Jl}/asset-library/files?${s}`)}catch(m){throw new VSt("offline",m instanceof Error?m.message:USt("offline"))}if(of(c,"Asset Library file lookup failed"),!c.ok){const m=await c.json().catch(()=>null),g=c.status===403?"license-blocked":c.status===429?"quota-limited":c.status===404?"unavailable":"provider-error";throw new VSt(g,m?.error??USt(g))}return(await c.json()).files}async function m2n(t,n){const s=new URLSearchParams({source:t,id:n}),c=await fetch(`${Jl}/asset-library/preview?${s}`);return of(c,"Could not resolve an asset preview"),c.ok?await c.json():null}async function h2n(t){const n=await fetch(`${Jl}/asset-library/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,signal:void 0}),...t.signal?{signal:t.signal}:{}});of(n,"Could not download the asset");const s=await n.json();if(s.ok&&s.path){Dge.set($ze(t.source,t.id),`/${s.path}`);for(const c of Pge)c()}return s}async function g2n(t){const n=await fetch(`${Jl}/asset-library/history/capture`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t})});of(n,"Asset history capture failed");const s=await n.json();if(!n.ok||!s.token)throw new Error(s.error??`Asset history capture failed (${n.status}).`);return s.token}async function y2n(t,n){const s=await fetch(`${Jl}/asset-library/history/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t,token:n})});if(of(s,"Asset history restore failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset history restore failed (${s.status}).`)}}async function v2n(t,n){const s=new URLSearchParams({type:t});n&&s.set("source",n);const c=await fetch(`${Jl}/asset-library/categories?${s}`);return of(c,"Could not read Asset Library categories"),c.ok?(await c.json()).categories:[]}function RZr(t){if(!t||typeof t!="object")return null;const n=t;return n.apiVersion!==1||typeof n.engineVersion!="string"&&n.engineVersion!==null||typeof n.manifestVersion!="number"||typeof n.startedAt!="string"||!n.source||n.source.state!=="current"&&n.source.state!=="restart-required"||n.source.state==="restart-required"&&(typeof n.source.changedPath!="string"||typeof n.source.changedAt!="string")?null:n}async function FZr(){let t;try{t=await fetch(`${Jl}/compatibility`,{cache:"no-store"})}catch(n){throw qFe(n instanceof Error?n.message:String(n))}if(t.status>=500)throw qFe(`HTTP ${t.status}`);try{CN(t,`GET ${Jl}/compatibility`)}catch{return null}try{return RZr(await t.json())}catch{return null}}async function qze(){const t=await FZr();if(!t)throw S4r();return x4r(t),t}async function MZr(){try{const t=await fetch(`${Jl}/recent-projects`);return(await L_(t,"Could not list recent projects")).projects}catch{return[]}}async function b2n(t){const n=await fetch(`${Jl}/recent-projects`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,"Could not remove recent project")}const JSt={reopenLastProject:!1};async function jZr(){try{const t=await fetch(`${Jl}/launcher-settings`),n=await L_(t,"Could not read launcher settings");return{reopenLastProject:typeof n.reopenLastProject=="boolean"?n.reopenLastProject:JSt.reopenLastProject}}catch{return{...JSt}}}async function S2n(t){const n=await fetch(`${Jl}/launcher-settings`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await L_(n,"Could not save launcher settings")}async function x2n(t,n,s,c,d,m=[]){const g=await fetch(`${Jl}/create-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,location:n,template:s,...c?{exampleId:c}:{},...d?{presentation:d}:{},...m.length>0?{additions:m}:{}})});return of(g,"Could not create the project"),await g.json()}async function w2n(t){try{const n=await fetch(`${Jl}/browse-folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})});return(await L_(n,"Could not open the folder picker")).path}catch{return null}}async function T2n(t){const n=await fetch(`${Jl}/inspect-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});of(n,`Could not inspect ${t}`);const s=await n.json();if(!n.ok||!s.path||!s.report)throw new Error(s.error??`Could not inspect ${t}.`);return{path:s.path,report:s.report}}async function C2n(t,n){const s=await fetch(`${Jl}/adapt-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,...n})});of(s,`Could not add Volter Editor metadata to ${t}`);const c=await s.json();if(!s.ok||!c.path||!c.writes)throw new Error(c.error??`Could not add Volter Editor metadata to ${t}.`);return{path:c.path,writes:c.writes}}async function CMe(t){const n=await fetch(`${Jl}/reveal`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,`Could not reveal ${t}`)}async function E2n(t){try{const n=await fetch(`${Jl}/save-thumbnail`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:t})});return CN(n,"Could not save the project thumbnail"),!0}catch{return!1}}async function zze(){let t;try{const s=await fetch(`${Jl}/project`);t=await L_(s,`No answer from ${Jl}/project`)}catch(s){return{status:"unknown",error:s instanceof Error?s.message:String(s)}}if(t.project)return{status:"project",project:t.project};const n=t.serving;return n&&typeof n.path=="string"?{status:"unreadable",path:n.path,error:typeof n.error=="string"?n.error:"unknown error"}:t.project===null?{status:"none"}:{status:"unknown",error:`Unrecognized ${Jl}/project response`}}async function k2n(){const t=await zze();return t.status==="project"?t.project:null}async function A2n(t){const n=await qze(),s=await fetch(`${Jl}/open-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});let c;try{of(s,`Could not open project at ${t}`),c=await s.json()}catch(m){throw qFe(m instanceof Error?m.message:`HTTP ${s.status} returned an invalid response`)}if(!s.ok){if(c&&typeof c=="object"){const m=c;if(typeof m.error=="string"&&y4r(m.recovery))throw new AC(m.error,m.recovery);if(typeof m.error=="string")throw new Error(m.error)}throw new Error(`Could not open project at ${t}: HTTP ${s.status}`)}const d=c;return d.config&&x$e(d.config,n),d}function tve(t){return/^(\/|https?:|data:|blob:)/.test(t)?t:`/${t}`}async function LZr(t){try{const n=await fetch(tve(t));if(n.ok)return await n.text()}catch{}return null}async function EMe(t){try{const n=await fetch(`/__editor/source-file?path=${encodeURIComponent(t.replace(/^\.?\//,""))}`,{cache:"no-store"});if(n.ok)return await n.text()}catch{}return null}function BZr(t){return(t.headers.get("content-type")??"").toLowerCase().includes("text/html")}async function zRt(t){try{const n=await fetch(tve(t),{method:"HEAD"});return n.ok?BZr(n)?"absent":"present":"absent"}catch{return"unreachable"}}async function $Zr(t){return await zRt(t)==="present"}async function D2n(t,n,s){try{const c=s==="base64"?I4r(n):n;return await gR().write(t,c),!0}catch{return!1}}async function VRt(t,n={}){if(t.length===0)return[];const s=await fetch(`/__editor/source-files?${new URLSearchParams([...t.map(d=>["include",d]),...n.order==="mtime"?[["order","mtime"]]:[]])}`);return s.ok?(await s.json()).files??[]:[]}async function P2n(){const t=await fetch(`${Jl}/validation-log`);return(await L_(t,"Could not read the server validation log")).entries??[]}async function qZr(t=3e3){if(typeof fetch>"u")return{ok:!1};try{const n=await fetch(`${Jl}/project`,{signal:AbortSignal.timeout(t)}),s=await L_(n,"Editor lease poll failed");return{ok:!0,identity:{project:typeof s.project?.path=="string"?s.project.path:null,pid:typeof s.session?.pid=="number"?s.session.pid:null}}}catch{return{ok:!1}}}async function zZr(){try{const t=await fetch(`${Jl}/editor-state`);return await L_(t,"Could not read editor state")}catch{return{}}}let WSt=!1;async function VZr(t,n={}){try{const s=await nPt(`${Jl}/editor-state`,JSON.stringify(t),n.leaving===!0);return CN(s,"Could not save editor state"),!0}catch(s){return WSt||(WSt=!0,console.error(s instanceof Error?s.message:String(s))),!1}}let fZ=null,Ige=null;async function URt(){for(;fZ;){const t=fZ;fZ=null,await bN("state",{...t,_clientId:xC})}Ige=null,fZ&&(Ige=URt())}function HSt(t){return fZ=t,Ige??=URt(),Ige}async function UZr(t){await bN("command-received",{_requestId:t,_clientId:xC})}async function i_e(t){await bN("command-listener",{_clientId:xC,attached:t})}let JZr=0;function WZr(t){const n=++JZr;vZr(t.phase,xC,n),bN("play-phase",{_clientId:xC,...t,source:xC,sequence:n})}async function GSt(t,n,s,c,d=!1){const m={_requestId:t,_clientId:xC,ok:n,error:s,data:c};d?await PZr(t,m):await bN("command-result",m)}async function rte(t,n){of(t,`gameplay recording ${n} failed`);const s=await t.json().catch(()=>({}));if(!t.ok)throw new Error(`gameplay recording ${n} failed: ${typeof s.error=="string"?s.error:`HTTP ${t.status}`}`);return s}async function I2n(t,n){const s=await fetch(`${Jl}/recording/start`,{...n?{signal:n}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return rte(s,"start")}async function N2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/dom?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"DOM event upload")}async function O2n(t,n,s,c){const d=new URLSearchParams({id:t.id,name:n}),m=await fetch(`${Jl}/recording/asset?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":s.type||"application/octet-stream"},body:s});await rte(m,"replay asset upload")}async function R2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/chunk?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"chunk upload")}async function F2n(t,n,s,c){const d=await fetch(`${Jl}/recording/finish`,{...s?{signal:s}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id,reason:n??null,replay:c??null})});await rte(d,"finish")}async function M2n(t){await fetch(`${Jl}/recording/abort`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id})}).catch(()=>{})}async function j2n(){const t=await fetch(`${Jl}/repository-presence`,{cache:"no-store"});if(of(t,"Could not read repository presence"),!t.ok)return{currentWorktreeId:null,sessions:[]};const n=await t.json().catch(()=>null);return{currentWorktreeId:typeof n?.currentWorktreeId=="string"?n.currentWorktreeId:null,sessions:Array.isArray(n?.sessions)?n.sessions:[]}}async function HZr(){const t=await fetch(`${Jl}/project`,{cache:"no-store"});if(of(t,"Could not read this session’s worktree identity"),!t.ok)return{branch:null,worktreeId:null};const n=await t.json().catch(()=>null);return{branch:typeof n?.session?.branch=="string"?n.session.branch:null,worktreeId:typeof n?.session?.worktreeId=="string"?n.session.worktreeId:null}}async function BR(t,n){const s=await fetch(`${Jl}/worktrees${t}`,n);of(s,`Worktree operation ${t||"(list)"} failed`);const c=await s.json().catch(()=>null);if(!s.ok)throw new Error(typeof c?.error=="string"?c.error:`Worktree operation failed (${s.status}).`);return c??{}}function JRt(t){return{worktrees:Array.isArray(t.worktrees)?t.worktrees:[],branches:Array.isArray(t.branches)?t.branches:[]}}async function GZr(){const t=await BR("/harnesses");return Array.isArray(t.harnesses)?t.harnesses:[]}async function KZr(){const t=await BR("");return JRt(t)}async function XZr(t){return await BR("/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})})}async function KSt(t,n="HEAD"){return await BR("/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t,from:n})})}async function YZr(t){return BR("/delegate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function ZZr(t){const n=await BR("/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})});return JRt(n).worktrees}async function QZr(t,n){await BR("/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t,sessionId:n})})}let Nge=null;const kMe=new Set,AMe=new Set;function eQr(t){Nge=t;for(const n of kMe)n(t);for(const n of AMe)n()}function Ih(){return Nge}function L2n(t){return kMe.add(t),Nge&&t(Nge),()=>{kMe.delete(t)}}function o_e(t){return AMe.add(t),()=>{AMe.delete(t)}}const nA="references",WRt=["public",nA],Vze=`/project-game-static/${nA}/`;function Oge(t,n){return`${t}/${n}`}function rve(t,n){return t===nA?`${Vze}${n}`:`/${n}`}function tQr(t){return t.startsWith(Vze)}function rQr(t){const n=t.startsWith("/")?t:`/${t}`;if(tQr(n))return Oge(nA,n.slice(Vze.length));const s=t.startsWith("/")?t.slice(1):t;return s.startsWith("public/")?s:`public/${s}`}function HRt({assetPath:t,kind:n,sizeBytes:s}){return q.jsx(nQr,{assetPath:t,kind:n,sizeBytes:s},t)}function nQr({assetPath:t,kind:n,sizeBytes:s}){const c=t.split("#")[0],d=c.startsWith("/")||/^(?:data|blob|https?):/.test(c)?c:`/${c}`,m=rQr(c),[g,S]=Ye.useState(s),[k,A]=Ye.useState(null),[F,D]=Ye.useState(null);Ye.useEffect(()=>{if(s!==void 0){S(s);return}let pe=!1;const[ue,...Ce]=m.split("/"),De=Ce.pop();return eve(ue,Ce.join("/")).then(Pe=>{!pe&&Pe.ok&&S(Pe.entries.find(be=>be.name===De)?.size)}),()=>{pe=!0}},[m,s]),Ye.useEffect(()=>{if(A(null),D(null),n==="image"){const ue=new Image;return ue.onload=()=>A({width:ue.naturalWidth,height:ue.naturalHeight}),ue.onerror=()=>D("Image properties could not be read."),ue.src=d,()=>{ue.onload=null,ue.onerror=null}}const pe=document.createElement(n);return pe.preload="metadata",pe.onloadedmetadata=()=>A({...Number.isFinite(pe.duration)?{duration:pe.duration}:{},...pe instanceof HTMLVideoElement?{width:pe.videoWidth,height:pe.videoHeight}:{}}),pe.onerror=()=>D("Media properties could not be read. The file may be missing or unsupported."),pe.src=d,()=>{pe.onloadedmetadata=null,pe.onerror=null,pe.removeAttribute("src"),pe.load()}},[d,n]);const J=k?.width,$=k?.height,G=[];if(J&&$){let pe=J,ue=$;for(;ue;)[pe,ue]=[ue,pe%ue];G.push(["Dimensions",`${J} × ${$} px`],["Aspect ratio",`${J/pe}:${$/pe}`])}k?.duration!==void 0&&G.push(["Duration",`${Number(k.duration.toFixed(3))} s`]);const se=c.split("?")[0].match(/\.([^./]+)$/)?.[1];return se&&G.push(["Format",se.toUpperCase()]),g!==void 0&&G.push(["File size",g<1024?`${g} B`:`${(g/(g<1024*1024?1024:1024*1024)).toFixed(1)} ${g<1024*1024?"KB":"MB"}`]),G.push(["Location",m]),q.jsxs("div",{"data-testid":"media-properties",style:{padding:8,fontSize:12},children:[F?q.jsx("p",{role:"status",style:{color:Zf[2]},children:F}):!k&&q.jsx("p",{role:"status",style:{color:Zf[3]},children:"Reading media properties…"}),q.jsx("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",gap:"10px 12px"},children:G.map(([pe,ue])=>q.jsxs("div",{style:{display:"contents"},children:[q.jsx("dt",{style:{color:Zf[3]},children:pe}),q.jsx("dd",{style:{margin:0,color:Zf[1],overflowWrap:"anywhere"},children:ue})]},pe))})]})}const rOe=Ye.lazy(async()=>({default:(await lo(()=>Promise.resolve().then(()=>ATr),void 0)).AssetEditorShell})),iQr=Ye.lazy(async()=>({default:(await lo(()=>import("./AudioViewer-7fv2_fIl.js"),__vite__mapDeps([256,1,2,3,4,20,21,22,23]))).AudioViewer})),oQr=Ye.lazy(async()=>({default:(await lo(()=>import("./ImageViewer-CxnMTLaT.js"),__vite__mapDeps([257,1,2,3,4,20,21,22,23]))).ImageViewer})),sQr=Ye.lazy(async()=>({default:(await lo(()=>import("./VideoViewer-DUUQ1ea_.js"),__vite__mapDeps([258,1,2,3,4,20,21,22,23]))).VideoViewer})),aQr=Ye.lazy(async()=>({default:(await lo(()=>import("./JsonAssetDocument-CcbpdU55.js").then(n=>n.a),__vite__mapDeps([259,1,2,3,4,20,21]))).JsonAssetDocument})),XSt=Ye.lazy(async()=>({default:(await lo(()=>import("./OnlineAssetDetail-Dq7qIQlJ.js"),__vite__mapDeps([260,1,2,3,4,20,21,261,22,23]))).OnlineAssetDetail})),cQr=Ye.lazy(async()=>({default:(await lo(()=>import("./SourceAssetViewer-DgOFkYF8.js"),__vite__mapDeps([262,1,2,3,4,20,21,259,256,22,23,257]))).SourceAssetViewer})),G1=new Map,GRt=new Map,nOe=new Map;let KRt=0;const DMe=new Set;function nR(){KRt++;for(const t of DMe)t()}function lQr(t){return DMe.add(t),()=>{DMe.delete(t)}}function uQr(){return KRt}function fQr(t){return G1.get(t)}function XRt(t){return G1.has(t)}function dQr(t,n){const s=new Set([...Object.keys(t),...Object.keys(n)]);for(const c of s){const d=t[c],m=n[c];if(d!==m&&JSON.stringify(d)!==JSON.stringify(m))return!1}return!0}function Uze(t,n,s,c,d={}){typeof document<"u"&&document.activeElement instanceof HTMLElement&&nOe.set(t,document.activeElement);const m=G1.get(t);if(!m)G1.set(t,s),nR();else{const S={...m,...s};dQr(m,S)||(G1.set(t,S),nR())}const g={id:t,title:n,kind:"asset",workspaceRole:"authored-subject",...c?{provenance:c}:{},Content:vQr,closeable:!0,presentation:()=>{const S=G1.get(t);return S?S.entityId?{kind:"asset",entityId:S.entityId,assetKind:"model"}:!S.assetPath||S.online?null:{kind:"asset",path:S.assetPath,assetKind:S.kind}:null},persist:()=>{const S=G1.get(t);if(!(!S?.assetPath||S.online||S.entityId!==void 0))return{path:S.assetPath,assetKind:S.kind}},onActivate:()=>{(s.kind==="image"||s.kind==="video"||s.kind==="audio")&&oD()},onDispose:S=>{G1.delete(S)&&nR();const k=nOe.get(S);nOe.delete(S),k?.isConnected&&setTimeout(()=>k.focus(),0)}};return ND(g,d)}function sN(t,n,s={}){const c=GYr(t),{frameName:d}=Z0e(t),m=GRt.get(AO(t))??t;return Uze(m,c,d?{assetPath:t,kind:n,displayName:c}:{assetPath:t,kind:n},{sourcePath:t},s)}wee({kind:"asset",owner:"asset-documents",restore:async({state:t})=>{const n=t,s=typeof n?.path=="string"?n.path:null,c=typeof n?.assetKind=="string"?n.assetKind:null;return!s||!c||!await $Zr(s)?!1:(sN(s,c),!0)}});async function YRt(t,n){return CC(()=>{if(Pp()!==t)return!1;const s=pBe(t);return s?n!=="model"||s.adapter!==null:!1},PR)}kN({id:"asset-editor:entity",owner:"asset-documents",open:(t,{entityId:n,title:s})=>Uze(`asset-editor:entity:${n}`,s,{assetPath:"",kind:"model",entityId:n},{origin:`entity:${n}`})});kN({id:"asset",owner:"asset-documents",open:(t,n)=>{if(n.entityId){const c=Ih();if(!c)return null;const d=Nze(Y0(c),n.entityId)?.assetDocument?.open()??null;if(!d)throw new Error(`Scene entity is not available: ${n.entityId}`);return d}const s=n.path;return s===void 0?null:sN(s,YSt(n.assetKind,s))},ready:async(t,n)=>{const s=n.entityId?"model":YSt(n.assetKind,n.path??"");if(!await YRt(t,s))throw new Error(`Asset document did not finish mounting its Inspector: ${t}`);await EBe(t)}});function YSt(t,n){return t==="animation"?"source":t==="prefab"?"json":t??pQr(n)}function pQr(t){const n=t.slice(t.lastIndexOf(".")+1).toLowerCase();return n==="glb"||n==="gltf"?"model":["png","jpg","jpeg","webp","gif","svg"].includes(n)?"image":["mp3","ogg","wav","flac"].includes(n)?"audio":["glsl","vert","frag","ts","tsx","js","jsx","css","html","md","txt"].includes(n)?"source":"json"}function _Qr(t,n){const s=iZr(n);return Uze(`asset-editor:subject:${t}`,n.name,{assetPath:s,kind:n.kind,displayName:n.name,...n.sourcePath?{sourcePath:n.sourcePath}:{}},n.sourcePath?{sourcePath:n.sourcePath}:{origin:`entity:${t}`})}function mQr(t,n){const s=G1.get(t);if(!s)return;const{online:c,...d}=s;G1.set(t,{...d,assetPath:n}),nR()}function hQr(t,n){const s=G1.get(t);if(!s?.assetPath)return;const c=AO(s.assetPath);if(n.type==="move"&&n.oldPath&&n.newPath&&c===AO(n.oldPath)){const d=`/${AO(n.newPath)}`;G1.set(t,{...s,assetPath:d}),GRt.set(AO(d),t),B3t(t,d.split("/").pop()??d),nR()}else n.type==="delete"&&n.paths?.some(d=>AO(d)===c)?(G1.set(t,{...s,unavailableReason:`The source ${s.assetPath} was deleted. Undo the deletion or close this editor.`}),nR()):n.type==="change"&&n.paths?.some(d=>AO(d)===c)&&(G1.set(t,{...s,revision:(s.revision??0)+1}),nR())}function gQr(t){return t.online?"online":ig(t.assetPath).editor==="environment"?"environment":t.kind==="json"?"json":["model","image","video","audio","source"].includes(t.kind)?t.kind:"unsupported"}function iOe(t){return{id:"source",title:"Source",icon:HTt,order:fQ,body:{kind:"custom",render:()=>q.jsx("div",{style:{padding:4},children:t.sourcePath??t.assetPath})}}}function yQr({id:t,spec:n,active:s}){if(n.unavailableReason)return q.jsx(rOe,{documentId:t,active:s,type:n.kind,title:n.assetPath.split("/").pop()||"Deleted asset",status:"Source unavailable",children:q.jsx("div",{style:{padding:20,color:C_e},children:n.unavailableReason})});const c=gQr(n);if(c==="online"&&n.online){const k=n.online;return q.jsx(rOe,{documentId:t,active:s,type:"online",title:k.name,sections:[{id:"online-asset",title:"Asset",icon:V0r,order:fQ,body:{kind:"custom",render:()=>q.jsx(XSt,{online:k,mode:"inspector",onResolved:A=>mQr(t,A)})}}],status:`${k.type} · ${k.source}`,children:q.jsx(XSt,{online:k,mode:"preview"})})}const d=(n.displayName??n.assetPath.split("/").pop())||n.entityId||"Asset",m=`${t}:${n.revision??0}`,g=q.jsxs("div",{style:{padding:20,color:C_e},children:["No editor package in this project renders ",d,"."]});if(c==="model")return n.assetPath?q.jsx(tOe,{route:"model",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m):n.entityId?q.jsx(tOe,{route:"entity-model",documentId:t,assetPath:"",entityId:n.entityId,displayName:d,active:s,whenUnregistered:g},m):q.jsx("div",{style:{padding:20,color:C_e},children:"Model source is unavailable."});if(c==="environment")return q.jsx(tOe,{route:"environment",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m);if(c==="source")return q.jsx(cQr,{documentId:t,assetPath:n.assetPath,active:s},m);if(c==="json")return q.jsx(aQr,{documentId:t,assetPath:n.assetPath,displayName:d,active:s,sections:[iOe(n)],status:`json · ${n.sourcePath??n.displayName??n.assetPath}`},m);let S;switch(c){case"image":S=q.jsx(oQr,{assetPath:n.assetPath,...n.displayName?{displayName:n.displayName}:{}},m);break;case"video":S=q.jsx(sQr,{assetPath:n.assetPath},m);break;case"audio":S=q.jsx(iQr,{assetPath:n.assetPath},m);break;default:S=q.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"No viewer available for this asset type."})}return q.jsx(rOe,{documentId:t,active:s,type:c,title:d,fill:c==="image"||c==="video",sections:c==="image"&&!n.assetPath.includes("#")||c==="video"||c==="audio"?[{id:"media-properties",title:"Properties",icon:HTt,order:fQ,body:{kind:"custom",render:()=>q.jsx(HRt,{assetPath:n.assetPath,kind:c},m)}},...n.sourcePath?[iOe(n)]:[]]:[iOe(n)],status:`${c} · ${n.sourcePath??n.displayName??n.assetPath}`,children:S})}function vQr({documentId:t,active:n}){Ye.useSyncExternalStore(lQr,uQr),Ye.useEffect(()=>{const c=d=>{hQr(t,d.detail)};return window.addEventListener("editor:asset-mutation",c),()=>window.removeEventListener("editor:asset-mutation",c)},[t]);const s=G1.get(t);return q.jsx("div",{"data-testid":`asset-document:${t}`,style:{flex:1,minHeight:0,overflow:"hidden",pointerEvents:"auto",background:SBe[1]},children:s?q.jsx(Ye.Suspense,{fallback:q.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"Loading asset viewer…"}),children:q.jsx(yQr,{id:t,spec:s,active:n})}):q.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"This asset document is no longer available."})})}function AO(t){return t.split(/[?#]/,1)[0].replace(/^\/+/,"")}const ZRt=["three","pixi","dom","babylon","phaser"],Jze=Object.freeze({up:"y",groundHeight:0}),QRt=Pa({surface:ed(["three","canvas","dom"]).describe("An additional surface this root mounts, beside the manifest root’s own adapter"),include:Gd(bo().min(1)).min(1).describe("Project-relative globs (`**`, `*`, `?`) naming the source files that render on this additional surface")}).strict(),bQr=Pa({up:ed(["y","z"]).describe("World axis pointing away from the ground"),groundHeight:fu().describe("Ground offset along `up`, in world units")}).strict(),SQr=Pa({id:bo().min(1).describe("Manifest root id this region grades"),surface:ed(["three","canvas","dom"]).describe("Render surface the host hands this root"),substrate:ed(ZRt).describe("Native substrate serving this region, by name"),dialect:bo().min(1).nullable().describe("Dialect writer serving this region, by name; null states outright that the host writes no source here (the region's truth is the game's own code)"),anchors:Gd(ed(nBe)).describe("Anchor kinds this region’s writer serves"),basis:bQr.optional().describe("World basis (up axis + ground height); omit for the native +Y / 0 default"),include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(QRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with `surface`, the root’s full mounted surface set")}).strict(),xQr=AR([Dg("manifest-roots"),Gd(SQr).min(1)]),wQr=Pa({include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this derived region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(QRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with the derived region’s own surface, the root’s full mounted surface set")}).strict().refine(t=>t.include!==void 0||t.mounts!==void 0,{message:"regionIncludes entry declares neither `include` nor `mounts` — an empty overlay states nothing the derivation did not already say. Remove it, or name the files it owns."}),TQr=wD(bo().min(1),wQr).describe("Per-region parameters for the `manifest-roots` rule, keyed by manifest root id: the `include` globs and `mounts` surfaces the mechanical derivation cannot produce");function Wze(t,n={}){return t.map(s=>({...EQr(s),...CQr(n[s.id])}))}function CQr(t){return t?{...t.include?{include:t.include}:{},...t.mounts?{mounts:t.mounts}:{}}:{}}function eFt(t,n){const s=new Set(t.map(c=>c.id));return Object.keys(n).filter(c=>!s.has(c))}function EQr(t){const n=t.surface,s=t.adapter.type==="builtin",c=n==="canvas"?"pixi":n,d=Jze;return s?n==="dom"?{id:t.id,surface:n,substrate:c,dialect:"jsx",anchors:["source-prop","source-structure"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:n==="three"?"r3f":"pixi-react",anchors:["source-prop","source-structure","construction-literal"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:null,anchors:["live-only"],basis:d}}const VQ="exported-composition-regions",kQr=Pa({finder:bo().min(1).describe("Registered finder name")}).passthrough(),AQr=AR([Pa({kind:Dg("root-mount")}).strict(),Pa({kind:Dg("entrypoint-selection"),selection:bo().min(1),key:bo().min(1),active:_y().optional()}).strict(),Pa({kind:Dg("story"),storyId:bo().min(1)}).strict(),Pa({kind:Dg("game-contract"),sceneId:bo().min(1)}).strict(),Pa({kind:Dg("none"),reason:bo().min(1)}).strict()]),ZSt=Pa({path:bo().min(1),export:bo().min(1).optional()}).strict(),DQr=Pa({id:bo().min(1),label:bo().min(1),kind:bo().min(1),region:bo().min(1).nullable(),authorable:_y(),reach:AQr,source:ZSt.optional(),isolationSetup:ZSt.optional(),finder:bo().min(1).optional()}).strict(),PQr=Pa({entries:Gd(DQr).optional(),find:Gd(kQr).optional(),default:bo().min(1).optional()}).strict(),tFt=["command","state"],IQr="observation.kind must be 'command' or 'state' — the two DebugAdapter faces a declaration projects onto. A SystemAdapters slot is declared through the game contract’s `systemAdapters` carrier, which validates it per-surface; declaring one here would be a second door onto the same slot with no rule for which wins.",NQr=Pa({id:bo().min(1),kind:ed(tFt,{error:()=>IQr}),description:bo().min(1).optional(),locus:ed(["client","server"]).optional(),answer:YI(t=>typeof t=="function",{message:"observation.answer must be a function evaluated against the mounted game"}).optional()}).strict().refine(t=>t.kind==="command"||t.locus===void 0,{path:["locus"],message:"observation.locus is valid only for a command declaration"}),OQr=["digital","scalar","vector2","pointerDelta","pointerPosition"],RQr=Pa({root:bo().min(1),actions:YI(t=>typeof t=="function",{message:"input.actions must be a function returning the app-owned action vocabulary"}),set:YI(t=>typeof t=="function",{message:"input.set must be a function writing the app-owned input store"}),clear:YI(t=>typeof t=="function",{message:"input.clear must be a function releasing app-owned virtual actions"})}).strict(),FQr=Pa({Layout:YI(t=>typeof t=="function","Layout must be an imported React component").optional(),style:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","style must be an imported StyleContribution object").optional(),keymap:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","keymap must be an imported KeymapContribution object").optional(),workspace:bo().min(1).optional(),inspector:ed(["column","properties","card"]).optional(),playUtilities:Gd(bo().min(1)).optional()}).strict(),MQr="`regionIncludes` states parameters for the `manifest-roots` RULE, so it cannot be paired with an explicit `regions` list — that form is the full replacement, and each entry carries its own `include`/`mounts`. Move these globs onto the matching `regions[]` entry, or drop the list and let the derivation run.",rFt=Pa({editor:FQr.optional(),regions:xQr.optional(),regionIncludes:TQr.optional(),documents:PQr.optional(),observation:Gd(NQr).optional(),input:RQr.optional()}).strict().refine(t=>t.regionIncludes===void 0||Object.keys(t.regionIncludes).length===0||!Array.isArray(t.regions),{message:MQr});function Hze(t={}){const n=rFt.safeParse(t);if(!n.success)throw new Error(`volter.adapter.ts: invalid adapter definition — ${n.error.issues.map(s=>`${s.path.join(".")||"(root)"}: ${s.message}`).join("; ")}`);return Object.freeze({...t.editor?{editor:Object.freeze({...t.editor,...t.editor.playUtilities?{playUtilities:Object.freeze([...t.editor.playUtilities])}:{}})}:{},regions:t.regions??"manifest-roots",regionIncludes:Object.freeze({...t.regionIncludes??{}}),documents:Object.freeze({...t.documents??{}}),observation:Object.freeze([...t.observation??[]]),...t.input?{input:t.input}:{}})}function DO(t={}){return Hze({regions:"manifest-roots",...t.regionIncludes?{regionIncludes:t.regionIncludes}:{},documents:{...t.scenes?{entries:t.scenes}:{},find:[{finder:"scenesFromEntrypointSelection",regions:VQ},{finder:"prefabsFromStories"}]}})}function PMe(t){if(t===null||typeof t!="object")throw new Error(`volter.adapter.ts must default-export defineAdapter({…}) / nativeAdapter() — got ${t===null?"null":typeof t}`);return Hze(t)}const B2n=Object.freeze(Object.defineProperty({__proto__:null,ADAPTER_INPUT_VALUE_TYPES:OQr,AdapterDefinitionSchema:rFt,EXPORTED_COMPOSITION_REGIONS:VQ,NATIVE_REGION_BASIS:Jze,OBSERVATION_KINDS:tFt,SUBSTRATE_NAMES:ZRt,defineAdapter:Hze,nativeAdapter:DO,parseAdapterDefinition:PMe,regionsFromManifestRoots:Wze,unmatchedRegionIncludeIds:eFt},Symbol.toStringTag,{value:"Module"})),MZ=new Map;function Gze(t){const n=t;return MZ.set(t.name,n),()=>{MZ.get(t.name)===n&&MZ.delete(t.name)}}function Kze(t,n){const s=t??{},c=[];(typeof s.name!="string"||s.name.length===0)&&c.push("`name` must be a non-empty string");const d=s.schema;if((!d||typeof d.safeParse!="function")&&c.push("`schema` must be a Zod schema"),typeof s.run!="function"&&c.push("`run(selection, input)` must be a function"),c.length>0)throw new Error(`${n}: not a finder — ${c.join("; ")}`);return Gze(s)}function nFt(){return[...MZ.keys()]}function iFt(t,n){const s=MZ.get(t.finder);if(!s){const d=nFt();throw new Error(`Unknown finder ${JSON.stringify(t.finder)} — registered: ${d.length>0?d.map(m=>`"${m}"`).join(", "):"none"}`)}const c=s.schema.safeParse(t);if(!c.success)throw new Error(`Finder ${JSON.stringify(t.finder)}: ${c.error.issues.map(d=>`${d.path.join(".")||"(selection)"}: ${d.message}`).join("; ")}`);return s.run(c.data,n)}const $2n=Object.freeze(Object.defineProperty({__proto__:null,registerContributedFinder:Kze,registerFinder:Gze,registeredFinderNames:nFt,runRegisteredFinder:iFt},Symbol.toStringTag,{value:"Module"}));function QSt(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var oOe={exports:{}};const jQr={},LQr=Object.freeze(Object.defineProperty({__proto__:null,default:jQr},Symbol.toStringTag,{value:"Module"})),wI=i0r(LQr);var ext;function BQr(){return ext||(ext=1,(function(t){var n={};/*! *****************************************************************************
942
+ </style><main><div class="brand-mark">${_4r()}</div><h1>Session ended</h1><p>This editor session has ended. You can close this tab.</p></main>`})}))}const Age=new Set;function _Zr(t){return Age.add(t),()=>{Age.delete(t)}}function mZr(){try{window.focus()}catch{}if(Age.size===0){window.location.reload();return}for(const t of[...Age])t()}function hZr(t,n,s={}){t.addEventListener("tab-refocus",c=>cZr(c)),t.addEventListener("tab-yield",c=>lZr(n,c)),t.addEventListener("tab-close",()=>pZr(n,s)),t.addEventListener("tab-adopt",()=>mZr())}const $k="/__editor",gZr=globalThis,md=gZr.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__,xC=md?.clientId??globalThis.crypto?.randomUUID?.()??`editor-${Date.now()}`,Q0e=zAt,yZr=awr;function vZr(t,n,s){md?.reportPhase?.(t,n,s)}function bZr(t){md?.reportCensus?.(t)}function SZr(){md?.stopHeartbeat?.();const t=kw;if(t!==null){kw=null,eB=0,md?.source===t&&(md.source=null),P$===t&&(P$=null);try{t.close()}catch{}}}function xZr(){const t=new URLSearchParams({clientId:xC,participantId:Q0e,displayName:yZr});return md?.tabId&&t.set("tabId",md.tabId),`${$k}/events?${t}`}let kw=md?.source??null,eB=md?.source&&md.pageOwned?1:0,P$=null;const BRt=new Set(["editor-command"]);function $Rt(t,n){if(!md||md.source!==t)return;md.queueListeners=md.queueListeners.filter(({type:c,listener:d})=>n(c)?(t.removeEventListener(c,d),!1):!0);const s=md.pending.filter(c=>n(c.type));md.pending=md.pending.filter(c=>!n(c.type));for(const{type:c,data:d}of s)t.dispatchEvent(new MessageEvent(c,{data:d}))}function wZr(t){P$!==t&&(P$=t,hZr(t,$k,{tabId:md?.tabId,epoch:md?.epoch}),$Rt(t,n=>!BRt.has(n)))}function jD(){kw||(md?.source?(kw=md.source,md.pageOwned&&eB++):(kw=new EventSource(xZr()),md&&(md.source=kw)));const t=kw;wZr(t),eB++;const n=[];let s=!1;return{addEventListener(c,d){const m=d;t.addEventListener(c,m),n.push({type:c,listener:m}),BRt.has(c)&&$Rt(t,g=>g===c)},removeEventListener(c,d){const m=d;t.removeEventListener(c,m);const g=n.findIndex(S=>S.type===c&&S.listener===m);g>=0&&n.splice(g,1)},close(){if(!s){s=!0;for(const{type:c,listener:d}of n)t.removeEventListener(c,d);n.length=0,eB--,eB<=0&&(t.close(),kw===t&&(kw=null),md?.source===t&&(md.source=null),P$===t&&(P$=null),eB=0)}}}}function TZr(){const t=kw??md?.source??null;if(!t)return"unknown";if(typeof t.connected=="boolean")return t.connected?"open":"closed";const n=t.readyState;return typeof n=="number"?n===1?"open":"closed":"unknown"}function CZr(){if(typeof EventSource>"u")return()=>{};const t=jD(),n=Lze(c=>{c!==null&&c.reason!=="server-gone"&&SZr()}),s=kZr();return()=>{s(),n(),t.close()}}const EZr=5;function kZr(){if(typeof window>"u")return()=>{};let t=0;const n=d=>{d===""||t>=EZr||(t+=1,FZ("console-entries",{entries:[{id:`boot-error:${t}`,severity:"error",message:`editor runtime error: ${d}`,source:"runtime",occurrences:1}],_clientId:md?.clientId??"boot"}))},s=d=>{const m=d.error;n(m?.stack??`${d.message} (${d.filename??"?"}:${d.lineno??0})`)},c=d=>{const m=d.reason;N4t(m)||n(m instanceof Error?m.stack??m.message:`unhandled rejection: ${String(m)}`)};return window.addEventListener("error",s),window.addEventListener("unhandledrejection",c),()=>{window.removeEventListener("error",s),window.removeEventListener("unhandledrejection",c)}}const AZr=2e3,DZr={"command-received":`${$k}/command-received`,"command-result":`${$k}/command-result`,"command-listener":`${$k}/command-listener`,"console-entries":`${$k}/console-entries`,"console-resolved":`${$k}/console-resolved`,"play-phase":`${$k}/play-phase`,state:`${$k}/state`,"tab-route":`${$k}/tab/route`};async function FZ(t,n){if(!(typeof fetch>"u"))try{await fetch(DZr[t],{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...md?.controlLifecycle?{_controlLifecycle:md.controlLifecycle}:{}})})}catch{}}async function bN(t,n){(kw??md?.source??null)?.send?.(t,n)||await FZ(t,n)}async function PZr(t,n){const s=kw??md?.source??null;if(!s){await FZ("command-result",n);return}let c;const d=new Promise(A=>{c=A}),m=A=>{const F=A.data;let D=F;if(typeof F=="string")try{D=JSON.parse(F)}catch{}D===t&&c()};s.addEventListener(qSt,m);const g={...n,_awaitCallerReceipt:!0};s.send?.("command-result",g)||await FZ("command-result",g);let S,k=!1;await Promise.race([d.then(()=>{k=!0}),new Promise(A=>{S=setTimeout(A,AZr)})]),S!==void 0&&clearTimeout(S),k||await FZ("command-result",n),s.removeEventListener(qSt,m)}function IZr(t){bN("tab-route",{clientId:xC,participantId:Q0e,route:t})}function Bze(t){return{ok:!1,reason:t instanceof Error?t.message:String(t)}}async function NZr(t,n){try{const s=new URLSearchParams({root:t,dir:n}),c=await fetch(`${Jl}/assets?${s}`,{cache:"no-store"});return{ok:!0,entries:(await L_(c,`Could not list ${t}/${n} from ${Jl}/assets`)).entries??[]}}catch(s){return Bze(s)}}async function eve(t,n){if(t!=="public")return NZr(t,n);try{return{ok:!0,entries:(await gR().list(n)).map(c=>({name:c.name,type:c.type==="dir"?"directory":"file",...c.size===void 0?{}:{size:c.size},...c.mtime===void 0?{}:{modifiedAt:c.mtime}}))}}catch(s){return Bze(s)}}async function qRt(){try{const t=await fetch(`${Jl}/project-components`,{cache:"no-store"});return{ok:!0,entries:(await L_(t,`Could not list project components from ${Jl}/project-components`)).components??[]}}catch(t){return Bze(t)}}function l2n(t){return`${Jl}/download?file=${encodeURIComponent(t)}`}class VSt extends Error{constructor(n,s){super(s),this.code=n,this.name="AssetDeliveryError"}}function USt(t){return{offline:"Network delivery is offline. SSD assets remain available.","quota-limited":"The remote provider quota is exhausted. Retry after the provider resets it.","license-blocked":"This delivery is blocked because its license terms are not accepted.",unavailable:"No healthy SSD, cloud, or remote delivery is available for this variant.","provider-error":"The remote provider could not return delivery metadata. Retry the request."}[t]}const Dge=new Map,Pge=new Set;function $ze(t,n){return`${t}:${n}`}function u2n(t,n){return Dge.get($ze(t,n))??null}function f2n(t){return Pge.add(t),()=>Pge.delete(t)}async function d2n(){try{const t=await fetch(`${Jl}/asset-library/downloaded`),n=await L_(t,"Could not read the downloaded-asset list");Dge.clear();for(const s of n.downloaded)Dge.set($ze(s.source,s.id),`/${s.path}`);for(const s of Pge)s()}catch{}}async function p2n(t){const n=new URLSearchParams;n.set("source",t.source),n.set("type",t.type),t.q&&n.set("q",t.q),t.category&&n.set("category",t.category),t.offset!=null&&n.set("offset",String(t.offset)),t.limit!=null&&n.set("limit",String(t.limit));const s=await fetch(`${Jl}/asset-library/search?${n}`);if(of(s,"Asset Library search failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset Library search failed (${s.status}).`)}return await s.json()}async function _2n(t,n){return OZr(t,n)}async function OZr(t,n){const s=new URLSearchParams({source:t,id:n});let c;try{c=await fetch(`${Jl}/asset-library/files?${s}`)}catch(m){throw new VSt("offline",m instanceof Error?m.message:USt("offline"))}if(of(c,"Asset Library file lookup failed"),!c.ok){const m=await c.json().catch(()=>null),g=c.status===403?"license-blocked":c.status===429?"quota-limited":c.status===404?"unavailable":"provider-error";throw new VSt(g,m?.error??USt(g))}return(await c.json()).files}async function m2n(t,n){const s=new URLSearchParams({source:t,id:n}),c=await fetch(`${Jl}/asset-library/preview?${s}`);return of(c,"Could not resolve an asset preview"),c.ok?await c.json():null}async function h2n(t){const n=await fetch(`${Jl}/asset-library/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,signal:void 0}),...t.signal?{signal:t.signal}:{}});of(n,"Could not download the asset");const s=await n.json();if(s.ok&&s.path){Dge.set($ze(t.source,t.id),`/${s.path}`);for(const c of Pge)c()}return s}async function g2n(t){const n=await fetch(`${Jl}/asset-library/history/capture`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t})});of(n,"Asset history capture failed");const s=await n.json();if(!n.ok||!s.token)throw new Error(s.error??`Asset history capture failed (${n.status}).`);return s.token}async function y2n(t,n){const s=await fetch(`${Jl}/asset-library/history/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t,token:n})});if(of(s,"Asset history restore failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset history restore failed (${s.status}).`)}}async function v2n(t,n){const s=new URLSearchParams({type:t});n&&s.set("source",n);const c=await fetch(`${Jl}/asset-library/categories?${s}`);return of(c,"Could not read Asset Library categories"),c.ok?(await c.json()).categories:[]}function RZr(t){if(!t||typeof t!="object")return null;const n=t;return n.apiVersion!==1||typeof n.engineVersion!="string"&&n.engineVersion!==null||typeof n.manifestVersion!="number"||typeof n.startedAt!="string"||!n.source||n.source.state!=="current"&&n.source.state!=="restart-required"||n.source.state==="restart-required"&&(typeof n.source.changedPath!="string"||typeof n.source.changedAt!="string")?null:n}async function FZr(){let t;try{t=await fetch(`${Jl}/compatibility`,{cache:"no-store"})}catch(n){throw qFe(n instanceof Error?n.message:String(n))}if(t.status>=500)throw qFe(`HTTP ${t.status}`);try{CN(t,`GET ${Jl}/compatibility`)}catch{return null}try{return RZr(await t.json())}catch{return null}}async function qze(){const t=await FZr();if(!t)throw S4r();return x4r(t),t}async function MZr(){try{const t=await fetch(`${Jl}/recent-projects`);return(await L_(t,"Could not list recent projects")).projects}catch{return[]}}async function b2n(t){const n=await fetch(`${Jl}/recent-projects`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,"Could not remove recent project")}const JSt={reopenLastProject:!1};async function jZr(){try{const t=await fetch(`${Jl}/launcher-settings`),n=await L_(t,"Could not read launcher settings");return{reopenLastProject:typeof n.reopenLastProject=="boolean"?n.reopenLastProject:JSt.reopenLastProject}}catch{return{...JSt}}}async function S2n(t){const n=await fetch(`${Jl}/launcher-settings`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await L_(n,"Could not save launcher settings")}async function x2n(t,n,s,c,d,m=[]){const g=await fetch(`${Jl}/create-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,location:n,template:s,...c?{exampleId:c}:{},...d?{presentation:d}:{},...m.length>0?{additions:m}:{}})});return of(g,"Could not create the project"),await g.json()}async function w2n(t){try{const n=await fetch(`${Jl}/browse-folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})});return(await L_(n,"Could not open the folder picker")).path}catch{return null}}async function T2n(t){const n=await fetch(`${Jl}/inspect-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});of(n,`Could not inspect ${t}`);const s=await n.json();if(!n.ok||!s.path||!s.report)throw new Error(s.error??`Could not inspect ${t}.`);return{path:s.path,report:s.report}}async function C2n(t,n){const s=await fetch(`${Jl}/adapt-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,...n})});of(s,`Could not add Volter Editor metadata to ${t}`);const c=await s.json();if(!s.ok||!c.path||!c.writes)throw new Error(c.error??`Could not add Volter Editor metadata to ${t}.`);return{path:c.path,writes:c.writes}}async function CMe(t){const n=await fetch(`${Jl}/reveal`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,`Could not reveal ${t}`)}async function E2n(t){try{const n=await fetch(`${Jl}/save-thumbnail`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:t})});return CN(n,"Could not save the project thumbnail"),!0}catch{return!1}}async function zze(){let t;try{const s=await fetch(`${Jl}/project`);t=await L_(s,`No answer from ${Jl}/project`)}catch(s){return{status:"unknown",error:s instanceof Error?s.message:String(s)}}if(t.project)return{status:"project",project:t.project};const n=t.serving;return n&&typeof n.path=="string"?{status:"unreadable",path:n.path,error:typeof n.error=="string"?n.error:"unknown error"}:t.project===null?{status:"none"}:{status:"unknown",error:`Unrecognized ${Jl}/project response`}}async function k2n(){const t=await zze();return t.status==="project"?t.project:null}async function A2n(t){const n=await qze(),s=await fetch(`${Jl}/open-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});let c;try{of(s,`Could not open project at ${t}`),c=await s.json()}catch(m){throw qFe(m instanceof Error?m.message:`HTTP ${s.status} returned an invalid response`)}if(!s.ok){if(c&&typeof c=="object"){const m=c;if(typeof m.error=="string"&&y4r(m.recovery))throw new AC(m.error,m.recovery);if(typeof m.error=="string")throw new Error(m.error)}throw new Error(`Could not open project at ${t}: HTTP ${s.status}`)}const d=c;return d.config&&x$e(d.config,n),d}function tve(t){return/^(\/|https?:|data:|blob:)/.test(t)?t:`/${t}`}async function LZr(t){try{const n=await fetch(tve(t));if(n.ok)return await n.text()}catch{}return null}async function EMe(t){try{const n=await fetch(`/__editor/source-file?path=${encodeURIComponent(t.replace(/^\.?\//,""))}`,{cache:"no-store"});if(n.ok)return await n.text()}catch{}return null}function BZr(t){return(t.headers.get("content-type")??"").toLowerCase().includes("text/html")}async function zRt(t){try{const n=await fetch(tve(t),{method:"HEAD"});return n.ok?BZr(n)?"absent":"present":"absent"}catch{return"unreachable"}}async function $Zr(t){return await zRt(t)==="present"}async function D2n(t,n,s){try{const c=s==="base64"?I4r(n):n;return await gR().write(t,c),!0}catch{return!1}}async function VRt(t,n={}){if(t.length===0)return[];const s=await fetch(`/__editor/source-files?${new URLSearchParams([...t.map(d=>["include",d]),...n.order==="mtime"?[["order","mtime"]]:[]])}`);return s.ok?(await s.json()).files??[]:[]}async function P2n(){const t=await fetch(`${Jl}/validation-log`);return(await L_(t,"Could not read the server validation log")).entries??[]}async function qZr(t=3e3){if(typeof fetch>"u")return{ok:!1};try{const n=await fetch(`${Jl}/project`,{signal:AbortSignal.timeout(t)}),s=await L_(n,"Editor lease poll failed");return{ok:!0,identity:{project:typeof s.project?.path=="string"?s.project.path:null,pid:typeof s.session?.pid=="number"?s.session.pid:null}}}catch{return{ok:!1}}}async function zZr(){try{const t=await fetch(`${Jl}/editor-state`);return await L_(t,"Could not read editor state")}catch{return{}}}let WSt=!1;async function VZr(t,n={}){try{const s=await nPt(`${Jl}/editor-state`,JSON.stringify(t),n.leaving===!0);return CN(s,"Could not save editor state"),!0}catch(s){return WSt||(WSt=!0,console.error(s instanceof Error?s.message:String(s))),!1}}let fZ=null,Ige=null;async function URt(){for(;fZ;){const t=fZ;fZ=null,await bN("state",{...t,_clientId:xC})}Ige=null,fZ&&(Ige=URt())}function HSt(t){return fZ=t,Ige??=URt(),Ige}async function UZr(t){await bN("command-received",{_requestId:t,_clientId:xC})}async function i_e(t){await bN("command-listener",{_clientId:xC,attached:t})}let JZr=0;function WZr(t){const n=++JZr;vZr(t.phase,xC,n),bN("play-phase",{_clientId:xC,...t,source:xC,sequence:n})}async function GSt(t,n,s,c,d=!1){const m={_requestId:t,_clientId:xC,ok:n,error:s,data:c};d?await PZr(t,m):await bN("command-result",m)}async function rte(t,n){of(t,`gameplay recording ${n} failed`);const s=await t.json().catch(()=>({}));if(!t.ok)throw new Error(`gameplay recording ${n} failed: ${typeof s.error=="string"?s.error:`HTTP ${t.status}`}`);return s}async function I2n(t,n){const s=await fetch(`${Jl}/recording/start`,{...n?{signal:n}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return rte(s,"start")}async function N2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/dom?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"DOM event upload")}async function O2n(t,n,s,c){const d=new URLSearchParams({id:t.id,name:n}),m=await fetch(`${Jl}/recording/asset?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":s.type||"application/octet-stream"},body:s});await rte(m,"replay asset upload")}async function R2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/chunk?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"chunk upload")}async function F2n(t,n,s,c){const d=await fetch(`${Jl}/recording/finish`,{...s?{signal:s}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id,reason:n??null,replay:c??null})});await rte(d,"finish")}async function M2n(t){await fetch(`${Jl}/recording/abort`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id})}).catch(()=>{})}async function j2n(){const t=await fetch(`${Jl}/repository-presence`,{cache:"no-store"});if(of(t,"Could not read repository presence"),!t.ok)return{currentWorktreeId:null,sessions:[]};const n=await t.json().catch(()=>null);return{currentWorktreeId:typeof n?.currentWorktreeId=="string"?n.currentWorktreeId:null,sessions:Array.isArray(n?.sessions)?n.sessions:[]}}async function HZr(){const t=await fetch(`${Jl}/project`,{cache:"no-store"});if(of(t,"Could not read this session’s worktree identity"),!t.ok)return{branch:null,worktreeId:null};const n=await t.json().catch(()=>null);return{branch:typeof n?.session?.branch=="string"?n.session.branch:null,worktreeId:typeof n?.session?.worktreeId=="string"?n.session.worktreeId:null}}async function BR(t,n){const s=await fetch(`${Jl}/worktrees${t}`,n);of(s,`Worktree operation ${t||"(list)"} failed`);const c=await s.json().catch(()=>null);if(!s.ok)throw new Error(typeof c?.error=="string"?c.error:`Worktree operation failed (${s.status}).`);return c??{}}function JRt(t){return{worktrees:Array.isArray(t.worktrees)?t.worktrees:[],branches:Array.isArray(t.branches)?t.branches:[]}}async function GZr(){const t=await BR("/harnesses");return Array.isArray(t.harnesses)?t.harnesses:[]}async function KZr(){const t=await BR("");return JRt(t)}async function XZr(t){return await BR("/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})})}async function KSt(t,n="HEAD"){return await BR("/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t,from:n})})}async function YZr(t){return BR("/delegate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function ZZr(t){const n=await BR("/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})});return JRt(n).worktrees}async function QZr(t,n){await BR("/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t,sessionId:n})})}let Nge=null;const kMe=new Set,AMe=new Set;function eQr(t){Nge=t;for(const n of kMe)n(t);for(const n of AMe)n()}function Ih(){return Nge}function L2n(t){return kMe.add(t),Nge&&t(Nge),()=>{kMe.delete(t)}}function o_e(t){return AMe.add(t),()=>{AMe.delete(t)}}const nA="references",WRt=["public",nA],Vze=`/project-game-static/${nA}/`;function Oge(t,n){return`${t}/${n}`}function rve(t,n){return t===nA?`${Vze}${n}`:`/${n}`}function tQr(t){return t.startsWith(Vze)}function rQr(t){const n=t.startsWith("/")?t:`/${t}`;if(tQr(n))return Oge(nA,n.slice(Vze.length));const s=t.startsWith("/")?t.slice(1):t;return s.startsWith("public/")?s:`public/${s}`}function HRt({assetPath:t,kind:n,sizeBytes:s}){return q.jsx(nQr,{assetPath:t,kind:n,sizeBytes:s},t)}function nQr({assetPath:t,kind:n,sizeBytes:s}){const c=t.split("#")[0],d=c.startsWith("/")||/^(?:data|blob|https?):/.test(c)?c:`/${c}`,m=rQr(c),[g,S]=Ye.useState(s),[k,A]=Ye.useState(null),[F,D]=Ye.useState(null);Ye.useEffect(()=>{if(s!==void 0){S(s);return}let pe=!1;const[ue,...Ce]=m.split("/"),De=Ce.pop();return eve(ue,Ce.join("/")).then(Pe=>{!pe&&Pe.ok&&S(Pe.entries.find(be=>be.name===De)?.size)}),()=>{pe=!0}},[m,s]),Ye.useEffect(()=>{if(A(null),D(null),n==="image"){const ue=new Image;return ue.onload=()=>A({width:ue.naturalWidth,height:ue.naturalHeight}),ue.onerror=()=>D("Image properties could not be read."),ue.src=d,()=>{ue.onload=null,ue.onerror=null}}const pe=document.createElement(n);return pe.preload="metadata",pe.onloadedmetadata=()=>A({...Number.isFinite(pe.duration)?{duration:pe.duration}:{},...pe instanceof HTMLVideoElement?{width:pe.videoWidth,height:pe.videoHeight}:{}}),pe.onerror=()=>D("Media properties could not be read. The file may be missing or unsupported."),pe.src=d,()=>{pe.onloadedmetadata=null,pe.onerror=null,pe.removeAttribute("src"),pe.load()}},[d,n]);const J=k?.width,$=k?.height,G=[];if(J&&$){let pe=J,ue=$;for(;ue;)[pe,ue]=[ue,pe%ue];G.push(["Dimensions",`${J} × ${$} px`],["Aspect ratio",`${J/pe}:${$/pe}`])}k?.duration!==void 0&&G.push(["Duration",`${Number(k.duration.toFixed(3))} s`]);const se=c.split("?")[0].match(/\.([^./]+)$/)?.[1];return se&&G.push(["Format",se.toUpperCase()]),g!==void 0&&G.push(["File size",g<1024?`${g} B`:`${(g/(g<1024*1024?1024:1024*1024)).toFixed(1)} ${g<1024*1024?"KB":"MB"}`]),G.push(["Location",m]),q.jsxs("div",{"data-testid":"media-properties",style:{padding:8,fontSize:12},children:[F?q.jsx("p",{role:"status",style:{color:Zf[2]},children:F}):!k&&q.jsx("p",{role:"status",style:{color:Zf[3]},children:"Reading media properties…"}),q.jsx("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",gap:"10px 12px"},children:G.map(([pe,ue])=>q.jsxs("div",{style:{display:"contents"},children:[q.jsx("dt",{style:{color:Zf[3]},children:pe}),q.jsx("dd",{style:{margin:0,color:Zf[1],overflowWrap:"anywhere"},children:ue})]},pe))})]})}const rOe=Ye.lazy(async()=>({default:(await lo(()=>Promise.resolve().then(()=>ATr),void 0)).AssetEditorShell})),iQr=Ye.lazy(async()=>({default:(await lo(()=>import("./AudioViewer-Bjv_IoEK.js"),__vite__mapDeps([256,1,2,3,4,20,21,22,23]))).AudioViewer})),oQr=Ye.lazy(async()=>({default:(await lo(()=>import("./ImageViewer-BcGUTWQl.js"),__vite__mapDeps([257,1,2,3,4,20,21,22,23]))).ImageViewer})),sQr=Ye.lazy(async()=>({default:(await lo(()=>import("./VideoViewer-CipXVi35.js"),__vite__mapDeps([258,1,2,3,4,20,21,22,23]))).VideoViewer})),aQr=Ye.lazy(async()=>({default:(await lo(()=>import("./JsonAssetDocument-Xr6gjvcn.js").then(n=>n.a),__vite__mapDeps([259,1,2,3,4,20,21]))).JsonAssetDocument})),XSt=Ye.lazy(async()=>({default:(await lo(()=>import("./OnlineAssetDetail-BPVmIMPQ.js"),__vite__mapDeps([260,1,2,3,4,20,21,261,22,23]))).OnlineAssetDetail})),cQr=Ye.lazy(async()=>({default:(await lo(()=>import("./SourceAssetViewer-MYdqpyCb.js"),__vite__mapDeps([262,1,2,3,4,20,21,259,256,22,23,257]))).SourceAssetViewer})),G1=new Map,GRt=new Map,nOe=new Map;let KRt=0;const DMe=new Set;function nR(){KRt++;for(const t of DMe)t()}function lQr(t){return DMe.add(t),()=>{DMe.delete(t)}}function uQr(){return KRt}function fQr(t){return G1.get(t)}function XRt(t){return G1.has(t)}function dQr(t,n){const s=new Set([...Object.keys(t),...Object.keys(n)]);for(const c of s){const d=t[c],m=n[c];if(d!==m&&JSON.stringify(d)!==JSON.stringify(m))return!1}return!0}function Uze(t,n,s,c,d={}){typeof document<"u"&&document.activeElement instanceof HTMLElement&&nOe.set(t,document.activeElement);const m=G1.get(t);if(!m)G1.set(t,s),nR();else{const S={...m,...s};dQr(m,S)||(G1.set(t,S),nR())}const g={id:t,title:n,kind:"asset",workspaceRole:"authored-subject",...c?{provenance:c}:{},Content:vQr,closeable:!0,presentation:()=>{const S=G1.get(t);return S?S.entityId?{kind:"asset",entityId:S.entityId,assetKind:"model"}:!S.assetPath||S.online?null:{kind:"asset",path:S.assetPath,assetKind:S.kind}:null},persist:()=>{const S=G1.get(t);if(!(!S?.assetPath||S.online||S.entityId!==void 0))return{path:S.assetPath,assetKind:S.kind}},onActivate:()=>{(s.kind==="image"||s.kind==="video"||s.kind==="audio")&&oD()},onDispose:S=>{G1.delete(S)&&nR();const k=nOe.get(S);nOe.delete(S),k?.isConnected&&setTimeout(()=>k.focus(),0)}};return ND(g,d)}function sN(t,n,s={}){const c=GYr(t),{frameName:d}=Z0e(t),m=GRt.get(AO(t))??t;return Uze(m,c,d?{assetPath:t,kind:n,displayName:c}:{assetPath:t,kind:n},{sourcePath:t},s)}wee({kind:"asset",owner:"asset-documents",restore:async({state:t})=>{const n=t,s=typeof n?.path=="string"?n.path:null,c=typeof n?.assetKind=="string"?n.assetKind:null;return!s||!c||!await $Zr(s)?!1:(sN(s,c),!0)}});async function YRt(t,n){return CC(()=>{if(Pp()!==t)return!1;const s=pBe(t);return s?n!=="model"||s.adapter!==null:!1},PR)}kN({id:"asset-editor:entity",owner:"asset-documents",open:(t,{entityId:n,title:s})=>Uze(`asset-editor:entity:${n}`,s,{assetPath:"",kind:"model",entityId:n},{origin:`entity:${n}`})});kN({id:"asset",owner:"asset-documents",open:(t,n)=>{if(n.entityId){const c=Ih();if(!c)return null;const d=Nze(Y0(c),n.entityId)?.assetDocument?.open()??null;if(!d)throw new Error(`Scene entity is not available: ${n.entityId}`);return d}const s=n.path;return s===void 0?null:sN(s,YSt(n.assetKind,s))},ready:async(t,n)=>{const s=n.entityId?"model":YSt(n.assetKind,n.path??"");if(!await YRt(t,s))throw new Error(`Asset document did not finish mounting its Inspector: ${t}`);await EBe(t)}});function YSt(t,n){return t==="animation"?"source":t==="prefab"?"json":t??pQr(n)}function pQr(t){const n=t.slice(t.lastIndexOf(".")+1).toLowerCase();return n==="glb"||n==="gltf"?"model":["png","jpg","jpeg","webp","gif","svg"].includes(n)?"image":["mp3","ogg","wav","flac"].includes(n)?"audio":["glsl","vert","frag","ts","tsx","js","jsx","css","html","md","txt"].includes(n)?"source":"json"}function _Qr(t,n){const s=iZr(n);return Uze(`asset-editor:subject:${t}`,n.name,{assetPath:s,kind:n.kind,displayName:n.name,...n.sourcePath?{sourcePath:n.sourcePath}:{}},n.sourcePath?{sourcePath:n.sourcePath}:{origin:`entity:${t}`})}function mQr(t,n){const s=G1.get(t);if(!s)return;const{online:c,...d}=s;G1.set(t,{...d,assetPath:n}),nR()}function hQr(t,n){const s=G1.get(t);if(!s?.assetPath)return;const c=AO(s.assetPath);if(n.type==="move"&&n.oldPath&&n.newPath&&c===AO(n.oldPath)){const d=`/${AO(n.newPath)}`;G1.set(t,{...s,assetPath:d}),GRt.set(AO(d),t),B3t(t,d.split("/").pop()??d),nR()}else n.type==="delete"&&n.paths?.some(d=>AO(d)===c)?(G1.set(t,{...s,unavailableReason:`The source ${s.assetPath} was deleted. Undo the deletion or close this editor.`}),nR()):n.type==="change"&&n.paths?.some(d=>AO(d)===c)&&(G1.set(t,{...s,revision:(s.revision??0)+1}),nR())}function gQr(t){return t.online?"online":ig(t.assetPath).editor==="environment"?"environment":t.kind==="json"?"json":["model","image","video","audio","source"].includes(t.kind)?t.kind:"unsupported"}function iOe(t){return{id:"source",title:"Source",icon:HTt,order:fQ,body:{kind:"custom",render:()=>q.jsx("div",{style:{padding:4},children:t.sourcePath??t.assetPath})}}}function yQr({id:t,spec:n,active:s}){if(n.unavailableReason)return q.jsx(rOe,{documentId:t,active:s,type:n.kind,title:n.assetPath.split("/").pop()||"Deleted asset",status:"Source unavailable",children:q.jsx("div",{style:{padding:20,color:C_e},children:n.unavailableReason})});const c=gQr(n);if(c==="online"&&n.online){const k=n.online;return q.jsx(rOe,{documentId:t,active:s,type:"online",title:k.name,sections:[{id:"online-asset",title:"Asset",icon:V0r,order:fQ,body:{kind:"custom",render:()=>q.jsx(XSt,{online:k,mode:"inspector",onResolved:A=>mQr(t,A)})}}],status:`${k.type} · ${k.source}`,children:q.jsx(XSt,{online:k,mode:"preview"})})}const d=(n.displayName??n.assetPath.split("/").pop())||n.entityId||"Asset",m=`${t}:${n.revision??0}`,g=q.jsxs("div",{style:{padding:20,color:C_e},children:["No editor package in this project renders ",d,"."]});if(c==="model")return n.assetPath?q.jsx(tOe,{route:"model",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m):n.entityId?q.jsx(tOe,{route:"entity-model",documentId:t,assetPath:"",entityId:n.entityId,displayName:d,active:s,whenUnregistered:g},m):q.jsx("div",{style:{padding:20,color:C_e},children:"Model source is unavailable."});if(c==="environment")return q.jsx(tOe,{route:"environment",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m);if(c==="source")return q.jsx(cQr,{documentId:t,assetPath:n.assetPath,active:s},m);if(c==="json")return q.jsx(aQr,{documentId:t,assetPath:n.assetPath,displayName:d,active:s,sections:[iOe(n)],status:`json · ${n.sourcePath??n.displayName??n.assetPath}`},m);let S;switch(c){case"image":S=q.jsx(oQr,{assetPath:n.assetPath,...n.displayName?{displayName:n.displayName}:{}},m);break;case"video":S=q.jsx(sQr,{assetPath:n.assetPath},m);break;case"audio":S=q.jsx(iQr,{assetPath:n.assetPath},m);break;default:S=q.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"No viewer available for this asset type."})}return q.jsx(rOe,{documentId:t,active:s,type:c,title:d,fill:c==="image"||c==="video",sections:c==="image"&&!n.assetPath.includes("#")||c==="video"||c==="audio"?[{id:"media-properties",title:"Properties",icon:HTt,order:fQ,body:{kind:"custom",render:()=>q.jsx(HRt,{assetPath:n.assetPath,kind:c},m)}},...n.sourcePath?[iOe(n)]:[]]:[iOe(n)],status:`${c} · ${n.sourcePath??n.displayName??n.assetPath}`,children:S})}function vQr({documentId:t,active:n}){Ye.useSyncExternalStore(lQr,uQr),Ye.useEffect(()=>{const c=d=>{hQr(t,d.detail)};return window.addEventListener("editor:asset-mutation",c),()=>window.removeEventListener("editor:asset-mutation",c)},[t]);const s=G1.get(t);return q.jsx("div",{"data-testid":`asset-document:${t}`,style:{flex:1,minHeight:0,overflow:"hidden",pointerEvents:"auto",background:SBe[1]},children:s?q.jsx(Ye.Suspense,{fallback:q.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"Loading asset viewer…"}),children:q.jsx(yQr,{id:t,spec:s,active:n})}):q.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"This asset document is no longer available."})})}function AO(t){return t.split(/[?#]/,1)[0].replace(/^\/+/,"")}const ZRt=["three","pixi","dom","babylon","phaser"],Jze=Object.freeze({up:"y",groundHeight:0}),QRt=Pa({surface:ed(["three","canvas","dom"]).describe("An additional surface this root mounts, beside the manifest root’s own adapter"),include:Gd(bo().min(1)).min(1).describe("Project-relative globs (`**`, `*`, `?`) naming the source files that render on this additional surface")}).strict(),bQr=Pa({up:ed(["y","z"]).describe("World axis pointing away from the ground"),groundHeight:fu().describe("Ground offset along `up`, in world units")}).strict(),SQr=Pa({id:bo().min(1).describe("Manifest root id this region grades"),surface:ed(["three","canvas","dom"]).describe("Render surface the host hands this root"),substrate:ed(ZRt).describe("Native substrate serving this region, by name"),dialect:bo().min(1).nullable().describe("Dialect writer serving this region, by name; null states outright that the host writes no source here (the region's truth is the game's own code)"),anchors:Gd(ed(nBe)).describe("Anchor kinds this region’s writer serves"),basis:bQr.optional().describe("World basis (up axis + ground height); omit for the native +Y / 0 default"),include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(QRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with `surface`, the root’s full mounted surface set")}).strict(),xQr=AR([Dg("manifest-roots"),Gd(SQr).min(1)]),wQr=Pa({include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this derived region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(QRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with the derived region’s own surface, the root’s full mounted surface set")}).strict().refine(t=>t.include!==void 0||t.mounts!==void 0,{message:"regionIncludes entry declares neither `include` nor `mounts` — an empty overlay states nothing the derivation did not already say. Remove it, or name the files it owns."}),TQr=wD(bo().min(1),wQr).describe("Per-region parameters for the `manifest-roots` rule, keyed by manifest root id: the `include` globs and `mounts` surfaces the mechanical derivation cannot produce");function Wze(t,n={}){return t.map(s=>({...EQr(s),...CQr(n[s.id])}))}function CQr(t){return t?{...t.include?{include:t.include}:{},...t.mounts?{mounts:t.mounts}:{}}:{}}function eFt(t,n){const s=new Set(t.map(c=>c.id));return Object.keys(n).filter(c=>!s.has(c))}function EQr(t){const n=t.surface,s=t.adapter.type==="builtin",c=n==="canvas"?"pixi":n,d=Jze;return s?n==="dom"?{id:t.id,surface:n,substrate:c,dialect:"jsx",anchors:["source-prop","source-structure"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:n==="three"?"r3f":"pixi-react",anchors:["source-prop","source-structure","construction-literal"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:null,anchors:["live-only"],basis:d}}const VQ="exported-composition-regions",kQr=Pa({finder:bo().min(1).describe("Registered finder name")}).passthrough(),AQr=AR([Pa({kind:Dg("root-mount")}).strict(),Pa({kind:Dg("entrypoint-selection"),selection:bo().min(1),key:bo().min(1),active:_y().optional()}).strict(),Pa({kind:Dg("story"),storyId:bo().min(1)}).strict(),Pa({kind:Dg("game-contract"),sceneId:bo().min(1)}).strict(),Pa({kind:Dg("none"),reason:bo().min(1)}).strict()]),ZSt=Pa({path:bo().min(1),export:bo().min(1).optional()}).strict(),DQr=Pa({id:bo().min(1),label:bo().min(1),kind:bo().min(1),region:bo().min(1).nullable(),authorable:_y(),reach:AQr,source:ZSt.optional(),isolationSetup:ZSt.optional(),finder:bo().min(1).optional()}).strict(),PQr=Pa({entries:Gd(DQr).optional(),find:Gd(kQr).optional(),default:bo().min(1).optional()}).strict(),tFt=["command","state"],IQr="observation.kind must be 'command' or 'state' — the two DebugAdapter faces a declaration projects onto. A SystemAdapters slot is declared through the game contract’s `systemAdapters` carrier, which validates it per-surface; declaring one here would be a second door onto the same slot with no rule for which wins.",NQr=Pa({id:bo().min(1),kind:ed(tFt,{error:()=>IQr}),description:bo().min(1).optional(),locus:ed(["client","server"]).optional(),answer:YI(t=>typeof t=="function",{message:"observation.answer must be a function evaluated against the mounted game"}).optional()}).strict().refine(t=>t.kind==="command"||t.locus===void 0,{path:["locus"],message:"observation.locus is valid only for a command declaration"}),OQr=["digital","scalar","vector2","pointerDelta","pointerPosition"],RQr=Pa({root:bo().min(1),actions:YI(t=>typeof t=="function",{message:"input.actions must be a function returning the app-owned action vocabulary"}),set:YI(t=>typeof t=="function",{message:"input.set must be a function writing the app-owned input store"}),clear:YI(t=>typeof t=="function",{message:"input.clear must be a function releasing app-owned virtual actions"})}).strict(),FQr=Pa({Layout:YI(t=>typeof t=="function","Layout must be an imported React component").optional(),style:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","style must be an imported StyleContribution object").optional(),keymap:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","keymap must be an imported KeymapContribution object").optional(),workspace:bo().min(1).optional(),inspector:ed(["column","properties","card"]).optional(),playUtilities:Gd(bo().min(1)).optional()}).strict(),MQr="`regionIncludes` states parameters for the `manifest-roots` RULE, so it cannot be paired with an explicit `regions` list — that form is the full replacement, and each entry carries its own `include`/`mounts`. Move these globs onto the matching `regions[]` entry, or drop the list and let the derivation run.",rFt=Pa({editor:FQr.optional(),regions:xQr.optional(),regionIncludes:TQr.optional(),documents:PQr.optional(),observation:Gd(NQr).optional(),input:RQr.optional()}).strict().refine(t=>t.regionIncludes===void 0||Object.keys(t.regionIncludes).length===0||!Array.isArray(t.regions),{message:MQr});function Hze(t={}){const n=rFt.safeParse(t);if(!n.success)throw new Error(`volter.adapter.ts: invalid adapter definition — ${n.error.issues.map(s=>`${s.path.join(".")||"(root)"}: ${s.message}`).join("; ")}`);return Object.freeze({...t.editor?{editor:Object.freeze({...t.editor,...t.editor.playUtilities?{playUtilities:Object.freeze([...t.editor.playUtilities])}:{}})}:{},regions:t.regions??"manifest-roots",regionIncludes:Object.freeze({...t.regionIncludes??{}}),documents:Object.freeze({...t.documents??{}}),observation:Object.freeze([...t.observation??[]]),...t.input?{input:t.input}:{}})}function DO(t={}){return Hze({regions:"manifest-roots",...t.regionIncludes?{regionIncludes:t.regionIncludes}:{},documents:{...t.scenes?{entries:t.scenes}:{},find:[{finder:"scenesFromEntrypointSelection",regions:VQ},{finder:"prefabsFromStories"}]}})}function PMe(t){if(t===null||typeof t!="object")throw new Error(`volter.adapter.ts must default-export defineAdapter({…}) / nativeAdapter() — got ${t===null?"null":typeof t}`);return Hze(t)}const B2n=Object.freeze(Object.defineProperty({__proto__:null,ADAPTER_INPUT_VALUE_TYPES:OQr,AdapterDefinitionSchema:rFt,EXPORTED_COMPOSITION_REGIONS:VQ,NATIVE_REGION_BASIS:Jze,OBSERVATION_KINDS:tFt,SUBSTRATE_NAMES:ZRt,defineAdapter:Hze,nativeAdapter:DO,parseAdapterDefinition:PMe,regionsFromManifestRoots:Wze,unmatchedRegionIncludeIds:eFt},Symbol.toStringTag,{value:"Module"})),MZ=new Map;function Gze(t){const n=t;return MZ.set(t.name,n),()=>{MZ.get(t.name)===n&&MZ.delete(t.name)}}function Kze(t,n){const s=t??{},c=[];(typeof s.name!="string"||s.name.length===0)&&c.push("`name` must be a non-empty string");const d=s.schema;if((!d||typeof d.safeParse!="function")&&c.push("`schema` must be a Zod schema"),typeof s.run!="function"&&c.push("`run(selection, input)` must be a function"),c.length>0)throw new Error(`${n}: not a finder — ${c.join("; ")}`);return Gze(s)}function nFt(){return[...MZ.keys()]}function iFt(t,n){const s=MZ.get(t.finder);if(!s){const d=nFt();throw new Error(`Unknown finder ${JSON.stringify(t.finder)} — registered: ${d.length>0?d.map(m=>`"${m}"`).join(", "):"none"}`)}const c=s.schema.safeParse(t);if(!c.success)throw new Error(`Finder ${JSON.stringify(t.finder)}: ${c.error.issues.map(d=>`${d.path.join(".")||"(selection)"}: ${d.message}`).join("; ")}`);return s.run(c.data,n)}const $2n=Object.freeze(Object.defineProperty({__proto__:null,registerContributedFinder:Kze,registerFinder:Gze,registeredFinderNames:nFt,runRegisteredFinder:iFt},Symbol.toStringTag,{value:"Module"}));function QSt(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var oOe={exports:{}};const jQr={},LQr=Object.freeze(Object.defineProperty({__proto__:null,default:jQr},Symbol.toStringTag,{value:"Module"})),wI=i0r(LQr);var ext;function BQr(){return ext||(ext=1,(function(t){var n={};/*! *****************************************************************************
943
943
  Copyright (c) Microsoft Corporation. All rights reserved.
944
944
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
945
945
  this file except in compliance with the License. You may obtain a copy of the
@@ -1394,11 +1394,11 @@ volter.project.json does not match the current project format:
1394
1394
  ${Pen(g)}`)}const m={manifestVersion:d.manifestVersion,name:d.name,version:d.version,engine:d.engine,appId:d.appId,resolution:d.resolution,authoring:d.authoring?{hierarchy:xFt(d.authoring.hierarchy)}:void 0,hasThreeRoot:dFt(d,"three"),rootCount:d.roots.length,configurations:d.configurations};return _Le({rootPath:t,config:m})}const Nen=3,Oen=300;async function wFt(){const t=await qze();for(let n=1;;n++){const s=await zze(),c=C4r({status:s.status,attempt:n,maxAttempts:Nen});if(c==="continue-ladder")return null;if(c==="open"&&s.status==="project"){const d=s.project;return x$e(d.config,t),_Le({rootPath:d.path,config:d.config})}if(c==="retry"){await new Promise(d=>setTimeout(d,Oen));continue}throw new w$e(E4r(s.status==="unreadable"?{status:"unreadable",path:s.path,error:s.error}:{status:"unknown",error:s.status==="unknown"?s.error:"no answer from the server"}))}}async function Ren(){P4r(window.location.search);const t=await wFt();return t||Fen()}async function Fen(){const[t,n]=await Promise.all([jZr(),MZr()]),s=T4r({explicitTarget:null,hubRequested:D4r(window.location.search),reopenLastEnabled:t.reopenLastProject,recents:n});if(s.kind!=="reopen-last")return null;try{return await Ien(s.path)}catch(c){return console.warn(`[volter] "Reopen last project on launch" could not open ${s.path}; showing the project browser instead.`,c),null}}const LMe=new Map;function sSn(t){for(const[n,s]of LMe)if(TFt(n,t))return s;return null}function aSn(t){for(const n of[...LMe.keys()])TFt(n,t)&&LMe.delete(n)}function nxt(t){return t.replaceAll("\\","/")}function TFt(t,n){const s=nxt(t),c=nxt(n).replace(/^\.?\//,"");return s===c||s.endsWith(`/${c}`)}function CFt(t){return()=>{}}function Men(t,n,s){if(!t.startsWith("."))return null;const c=n.replaceAll("\\","/").split("/").slice(0,-1);for(const m of t.split("/"))m==="."||m===""||(m===".."?c.pop():c.push(m));const d=c.join("/");for(const m of[d,`${d}.tsx`,`${d}.ts`,`${d}/index.tsx`,`${d}/index.ts`])if(s.has(m))return m;return null}function ixt(t){const n=t.replaceAll("\\","/").replace(/^\.\//,""),s=n.lastIndexOf("/");return s>=0?n.slice(0,s):""}function jen(t){const n=new Map;for(const s of t){const c=s.componentName;if(c===void 0||c==="")continue;const d=n.get(c);d?d.push(s):n.set(c,[s])}return n}function Len(t,n){const s=n?t.filter(d=>ixt(d.modulePath)===ixt(n.path)):[],c=s.length>0?s:t;return{chosen:c.find(d=>d.isDefault===!0)??c[0],colocated:s.length>0}}function Ben(t,n){const s=[],c=[];for(const[d,m]of jen(n.stories)){const g=n.components?.find(A=>A.name===d),{chosen:S,colocated:k}=Len(m,g);S&&(g&&!k&&c.push(`prefabsFromStories: "${d}" is declared by ${S.modulePath}, which is not colocated with ${g.path}. The join is by name; confirm it names this component.`),s.push({id:d,label:d,kind:"prefab",region:g?.region??null,authorable:!0,reach:{kind:"story",storyId:S.storyId},...g?{source:{path:g.path,export:g.name}}:{},finder:"prefabsFromStories"}))}return{entries:s,notes:c}}function $en(){const t=[];for(const n of rq())if(n.ok)for(const s of n.stories)t.push({modulePath:n.modulePath,storyId:s.id,label:s.label,...s.componentName===void 0?{}:{componentName:s.componentName},isDefault:TRt(s)});return t}const qen={name:"prefabsFromStories",schema:Pa({finder:Dg("prefabsFromStories")}).strict(),run(t,n){return Ben(t,{stories:$en(),...n.components===void 0?{}:{components:n.components}})}},LB="volter.adapter.ts";let LZ=null,Mge=null,nve="__unscoped__",iR=null,EFt=0;const UQ=new Set;function u0(){return nve===Em()?LZ:null}async function cSn(){return iR&&await iR,nve===Em()?Mge:null}function Qze(){const t=()=>!wf()||!!u0();return t()?Promise.resolve():new Promise(n=>{const s=OC(()=>{t()&&(s(),n())})})}async function zen(){for(await(await lo(async()=>{const{projectBootstrapSettled:n}=await Promise.resolve().then(()=>nMt);return{projectBootstrapSettled:n}},void 0)).projectBootstrapSettled(),await mN(),await BB();iR;)await iR;const t=u0();if(!t||t.documentsPending)throw new Error("The project document table could not finish loading; inspect the project diagnostics.");return t.scenes}function OC(t){return UQ.add(t),()=>UQ.delete(t)}function cme(t,n=[],s=void 0,c=null){nve=Em(),LZ=t,Mge=c,IEr(c?.editor),ken(t?.regions??[]),cen(n),len(s??null);for(const d of UQ)d();QEr()}function Ven(t){return{id:t.id,kind:t.kind,answered:t.answer!==void 0}}function Uen(t){const{Layout:n,...s}=t;return{...s,...n?{layout:n.displayName??n.name??"Project layout"}:{}}}async function Jen(t){return await import(`${Xze(t,LB)}?t=${Date.now()}`)}function Wen(t,n){return t.find(s=>s.surface===n)?.id??null}function Hen(t){const n=new Set(t.map(s=>s.path));return(s,c)=>Men(s,c,n)}function Gen(t){const n=pFt(t);return n.length===1?n[0].id:null}const Ken={entrypoints:[],components:[]};async function Xen(t,n,s){const c=[];for(const A of MB(t))A.entry&&c.push({regionId:A.id,path:A.entry,source:await EMe(A.entry)});let d=[];const m=await qRt().catch(A=>({ok:!1,reason:A instanceof Error?A.message:String(A)}));m.ok?d=m.entries.map(A=>({name:A.name,path:A.path,region:Wen(n,A.surface)})):Qs.warn(`Component index unavailable, so prefabs resolve without source paths: ${m.reason}`,"project");const g=new Set;for(const A of s.documents.find??[])for(const F of A.include??[])g.add(F);const S=[],k=[];if(g.size>0){const A=await VRt([...g],{order:"mtime"}).catch(()=>[]);for(const F of A){k.push(F);const D=await EMe(F);D!==null&&!D.includes("\0")&&S.push({path:F,source:D})}}return{entrypoints:c,components:d,sources:S,files:k,resolveModule:Hen(d)}}function Yen(t,n){const s=[...t.documents.entries??[]],c=[],d=[];let m=0;for(const S of t.documents.find??[]){let k;try{k=nen(S,n)}catch(A){c.push(`finder ${JSON.stringify(S.finder)}: ${A instanceof Error?A.message:String(A)}`),m+=1;continue}s.push(...k.entries),c.push(...k.notes),k.default!==void 0&&d.push(k.default)}const g=d.length===1?d[0]:null;return{table:{entries:s,default:t.documents.default??g},notes:c,unresolved:m}}const MI=[];function lSn(t){const n=MI.findIndex(s=>s.owner===t.owner&&s.id===t.id);return n>=0&&MI.splice(n,1),MI.push(t),MI.sort((s,c)=>(s.order??0)-(c.order??0)),()=>{const s=MI.indexOf(t);s>=0&&MI.splice(s,1)}}function oxt(t){for(const n of MI){const s=n.modulePathFor(t);if(s!==null)return{source:n,modulePath:s}}return null}function sxt(t){return t!==null&&typeof t=="object"&&"default"in t?t.default:t}function KL(t,n){if(t.kind==="present")try{return{definition:PMe(sxt(t.module)),source:"project",modulePath:LB,error:null}}catch(c){return{definition:DO(),source:"native",modulePath:null,error:`${LB} did not load — ${JQ(c)}`}}if(t.kind==="broken")return{definition:DO(),source:"native",modulePath:null,error:`${LB} did not load — ${t.error}`};const s=t.kind==="unreachable"?t.error:null;if(n.kind==="present")try{return{definition:PMe(sxt(n.module)),source:"registry",modulePath:n.path,error:s}}catch(c){return{definition:DO(),source:"native",modulePath:null,error:`${n.path} did not load — ${JQ(c)}`}}return n.kind==="broken"?{definition:DO(),source:"native",modulePath:null,error:`${n.path} did not load — ${n.error}`}:n.kind==="unanswered"?{definition:DO(),source:"native",modulePath:null,error:`volter.project.json declares the ingest root \`${n.rootId}\`, and no registered adapter-definition source holds a declaration for it (${n.sources} source${n.sources===1?"":"s"} registered). The lane that owns a vendored game's declaration is \`@volter/editor-game\`, which registers through its \`ingest.service.ts\` contribution — so either this product does not compose that package, or its contribution pass did not load it. The declared native default is standing in, which means this game's own scene table is NOT what the editor is showing.`}:{definition:DO(),source:"native",modulePath:null,error:s}}function Zen(t,n,s){const{definition:c,source:d,modulePath:m,error:g}=n,S=c.regions==="manifest-roots"?Wze(MB(t),c.regionIncludes):[...c.regions],k=eFt(MB(t),c.regionIncludes),{table:A,notes:F,unresolved:D}=Yen(c,s);return{source:d,modulePath:m,regions:S,scenes:A,documentsPending:D>0,...c.editor?{editor:Uen(c.editor)}:{},observation:c.observation.map(Ven),notes:k.length>0?[...F,`adapter: regionIncludes names ${k.map(J=>`\`${J}\``).join(", ")}, which no root in volter.project.json declares (roots: ${MB(t).map(J=>`\`${J.id}\``).join(", ")}) — those globs were merged onto nothing.`]:F,error:g}}async function Qen(t,n){const s=Gen(n),c=await zRt(LB);if(c==="present")try{const g=await Jen(t.rootPath);return KL({kind:"present",module:g},{kind:"absent"})}catch(g){return KL({kind:"broken",error:JQ(g)},{kind:"absent"})}const d=c==="unreachable"?{kind:"unreachable",error:`${LB} could not be probed — the project's file routes did not answer, so whether this project owns an adapter is UNKNOWN.`}:{kind:"absent"};if(s===null)return KL(d,{kind:"absent"});let m=oxt(s);if(m===null&&(await etn(s),m=oxt(s)),m===null){const g=KL(d,{kind:"unanswered",rootId:s,sources:MI.length});return g.error&&Qs.warn(g.error,"ingest"),g}try{const g=await m.source.importModule(s);return KL(d,{kind:"present",module:g,path:m.modulePath})}catch(g){return KL(d,{kind:"broken",path:m.modulePath,error:JQ(g)})}}let axt=null,s_e=null,BMe=null;function cxt(){return BMe}function etn(t){const n=Em();if(axt!==n&&(axt=n,s_e=null),!s_e){BMe=`Loading the ingest lane — this project declares the unmodified-game root “${t}”, whose adapter declaration a package supplies.`;for(const s of UQ)s();s_e=mN().catch(()=>{}).finally(()=>{BMe=null;for(const s of UQ)s()})}return s_e}let aOe=[],$Me="";function ttn(){const t=s$e(),n=t.map(s=>s.entryPath).join("|");if(!(n===$Me&&t.every(s=>lme.has(s.module)))){for(const s of aOe)s();aOe=[],lme=new WeakSet;for(const{entryPath:s,module:c}of t)try{aOe.push(Kze(c?.finder,s)),lme.add(c)}catch(d){Qs.error(d instanceof Error?d.message:String(d),"project")}$Me=n}}let lme=new WeakSet;Kze(qen,"packages/editor-sdk/src/kit/stories/prefabs-finder.ts");u2(()=>{const t=s$e();(t.map(s=>s.entryPath).join("|")!==$Me||!t.every(s=>lme.has(s.module)))&&wf()&&BB()});tkr(()=>LZ&&!LZ.documentsPending?[...new Set(LZ.scenes.entries.map(t=>t.kind))]:null);function BB(){const t=rtn(++EFt,wf());return iR=t,t.then(()=>{iR===t&&(iR=null)}),t}async function rtn(t,n){const s=()=>t===EFt&&wf()===n;if(!n){cme(null);return}let c;try{c=await Cen()}catch(k){if(!s())return;cme({source:"native",modulePath:null,regions:[],scenes:{entries:[],default:null},observation:[],notes:[],documentsPending:!1,error:`adapter: the project's manifest did not load, so no region could be derived — ${JQ(k)}`});return}if(!s())return;const d=await Qen(n,c);if(!s())return;ttn();const m=d.definition.regions==="manifest-roots"?Wze(MB(c),d.definition.regionIncludes):[...d.definition.regions],g=(d.definition.documents.find??[]).length>0?await Xen(c,m,d.definition):Ken;if(!s())return;const S=Zen(c,d,g);cme(S,d.definition.observation,d.definition.input,d.source==="native"?null:d.definition)}function JQ(t){return t instanceof Error?t.message:String(t)}function ntn(t){if(!Mge)return!0;const n=Mge.documents.find??[];for(const s of n)for(const c of s.include??[])if(itn(c).test(t))return!0;return!1}function itn(t){const n="__DEEP__",s=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,n).replace(/\*/g,"[^/]*").split(n).join("(?:.*/)?");return new RegExp(`^${s}$`)}function otn(){BB();const t=CFt(),n=IC(()=>{nve!==Em()&&cme(null),BB()}),s=pen(c=>{(c===""||ntn(c))&&BB()});return()=>{t(),n(),s()}}const stn="scene:";function lxt(t){return`${stn}${t}`}function MY(t){const{kind:n}=t.reach;return n==="game-contract"||n==="root-mount"||n==="entrypoint-selection"?{liveReach:n}:{}}function eVe(t){if(!t.authorable)return{kind:"no-document",...MY(t),reason:`"${t.id}" is declared TRAVERSAL (boot/loading choreography), not an authorable composition, so it has no Edit document.`};switch(t.reach.kind){case"none":return{kind:"no-document",...MY(t),reason:t.reach.reason};case"root-mount":return t.region===null?{kind:"no-document",...MY(t),reason:`"${t.id}" is reached by mounting a region, but the entry names no region, so there is no standing document it could be.`}:{kind:"root-document",regionId:t.region,title:t.label};case"entrypoint-selection":return t.reach.active===!0&&t.region!==null?{kind:"root-document",regionId:t.region,title:t.label}:t.source?{kind:"isolation-document",documentId:lxt(t.id),title:t.label,regionId:t.region,source:t.source,...t.isolationSetup?{isolationSetup:t.isolationSetup}:{}}:{kind:"no-document",...MY(t),reason:`"${t.id}" is selected at the entrypoint's \`${t.reach.selection}\` slot, but the finder could not resolve the module it names, so there is nothing to mount in isolation.`};case"game-contract":return t.source?{kind:"isolation-document",documentId:lxt(t.id),title:t.label,regionId:t.region,source:t.source,...t.isolationSetup?{isolationSetup:t.isolationSetup}:{},contractSceneId:t.reach.sceneId}:{kind:"no-document",...MY(t),reason:`"${t.id}" is reached only through the running game's own navigation (its scenes contract calls it "${t.reach.sceneId}"), and the entry names no source module, so there is no Edit document — open it while the game is running.`};case"story":return{kind:"story-document",title:t.label,storyId:t.reach.storyId}}}function tVe(t){const n=[];for(const s of t.entries){if(s.kind!=="scene")continue;const c=eVe(s);c.kind!=="no-document"&&n.push({entry:s,plan:c,isDefault:t.default===s.id})}return n}function uSn(t,n,s){const c=tVe(t),d=c.flatMap(k=>k.plan.kind==="isolation-document"?[k.plan.documentId]:[]),m=new Set(n),g=new Set(s),S=t.entries.filter(k=>k.authorable&&k.kind!=="scene"&&k.kind!=="prefab").length;return{sceneDocuments:c.length+S,isolationDocuments:d.length,openIsolationDocuments:d.filter(k=>m.has(k)).length,availableIsolationDocuments:d.filter(k=>g.has(k)).length,pieces:t.entries.filter(k=>k.kind==="prefab").length,sceneEntries:t.entries.filter(k=>k.kind==="scene").length,storyFailures:rq().filter(k=>!k.ok).length}}function fSn(t){const n=tVe(t);return n.some(s=>s.plan.kind==="isolation-document")&&!n.some(s=>s.plan.kind==="root-document")}const a0="workspace:game",dSn="workspace:scene",atn="workspace:canvas-scene",ctn="workspace:3d-components",ltn="workspace:2d-components",utn="workspace:ui-components",ftn=new Set([atn,ltn,ctn,utn]),dtn=4e3;let BZ=null,ume=null,jge=null,WQ=!1,fme=null,uxt=!1,rVe=!1;const Lge=new Set,ptn=()=>null;function kFt(){if(!BZ)return null;const n=ume;return{id:a0,title:"Game",kind:"game",workspaceRole:"authored-subject",Content:n?.Content??ptn,...n?.Toolbar?{Toolbar:n.Toolbar}:{},closeable:!1,presentation:()=>({kind:"workspace",id:a0})}}function _tn(){const t={session:!0};return BZ=t,()=>{BZ===t&&(nVe(),BZ=null)}}function mtn(t){if(ume=t,iq()){const n=kFt();n&&ND(n,{activate:!1})}return()=>{ume===t&&(ume=null)}}function HQ(){return rVe&&iq()}function iq(){return l0().some(t=>t.descriptor.id===a0)}function pSn(){return iq()?(j3t(),X0(a0)):!1}function htn(){return jge}function gtn(t){jge=t,WQ=!0;for(const n of[...Lge])n();Lge.clear()}function ytn(t){jge===t&&(jge=null,WQ=!1)}async function vtn(t=dtn){const n=kFt();return n?(j3t(),rVe=!0,iq()?X0(n.id):(fme=Pp(),ND(n)),WQ?!0:new Promise(s=>{const c=()=>{clearTimeout(d),s(!0)},d=setTimeout(()=>{Lge.delete(c),s(WQ)},t);Lge.add(c)})):!1}function nVe(){if(rVe=!1,!BZ||!iq()){fme=null;return}const t=fme;fme=null,WQ=!1,EN(a0,{discardDirty:!0}),t&&X0(t)}function btn(t){uxt&&!t&&nVe(),uxt=t}let yC=[];const qMe=new Set,GQ=new Map;let iVe=!1,oVe=!1,zMe=!1;function AFt(t,n=!0){GQ.set(t,n),Bge()}const sVe=()=>{for(const t of qMe)t()},ive=()=>yC;function Stn(t){return qMe.add(t),()=>{qMe.delete(t)}}function SN(t,n=!0){const s=yC.find(c=>c.descriptor.id===t);return s?(ND({...s.descriptor,closeable:!0,persist:()=>({availableDocumentId:t})},{activate:n}),!0):!1}function Bge(){for(const[t,n]of GQ)SN(t,n&&!HQ())&&GQ.delete(t);if(iVe&&!oVe&&!zMe){const t=yC.find(n=>n.default);t&&(zMe=!0,SN(t.descriptor.id,!HQ()))}}function _Sn(t,n){const s=yC.find(d=>d.descriptor.id===t.id);if(s?.descriptor.Content===t.Content&&s?.descriptor.title===t.title&&s.descriptor.provenance?.sourcePath===t.provenance?.sourcePath&&s.descriptor.provenance?.rootId===t.provenance?.rootId&&s.descriptor.Toolbar===t.Toolbar&&s.descriptor.Shelf===t.Shelf&&s.descriptor.preview===t.preview&&s.default===(n.default??!1)&&s.category===n.category&&s.rootId===n.rootId)return t.id;const c={descriptor:t,category:n.category,default:n.default??!1,rootId:n.rootId};return yC=s?yC.map(d=>d.descriptor.id===t.id?c:d):[...yC,c],sVe(),Bge(),t.id}function mSn(t){yC.some(n=>n.descriptor.id===t)&&(yC=yC.filter(n=>n.descriptor.id!==t),EN(t,{discardDirty:!0}),sVe())}for(const t of yTr)wee({kind:t,owner:"workspace-available-documents",restore:({state:n,active:s})=>{const c=n?.availableDocumentId;return typeof c!="string"?!1:(GQ.set(c,s),Bge(),!0)},beginRestore:({hasDocumentsToRestore:n})=>{iVe=!0,oVe=n,Bge()}});function xtn(){yC=[],GQ.clear(),iVe=!1,oVe=!1,zMe=!1,sVe()}const dme=new Map;function hSn(t,n){return dme.set(t,n),()=>{dme.get(t)===n&&dme.delete(t)}}function aVe(t){return dme.get(t)??ive().find(n=>n.rootId===t)?.descriptor.id??null}function VMe(t){const n=aVe(t);return n?SN(n)||X0(n):!1}const pme=new Map;function gSn(t,n){return pme.set(t,n),()=>{pme.get(t)===n&&pme.delete(t)}}function fxt(t){return pme.get(t)?.()??null}const UMe=new Set;function ySn(t){return UMe.add(t),()=>{UMe.delete(t)}}function dxt(t){for(const n of UMe){const s=n(t);if(s!==null)return s}return null}const JMe="document:";function cVe(t){return`${JMe}${t}`}function wtn(t){return t.startsWith(JMe)?t.slice(JMe.length):null}const KQ=new Map;function Ttn(t){return KQ.get(t)?.entry}function Ctn(t){return{id:t.id,kind:t.kind,label:t.label,...t.source?{source:{path:t.source.path,...t.source.export?{export:t.source.export}:{}}}:{}}}function DFt(t){const n=t.source?.path;if(!n)return"source";const s=ig(n).kind;return s==="model"||s==="image"||s==="video"||s==="audio"||s==="json"?s:"source"}function WMe(t){return PN(t)!==void 0}function ID(t,n={}){const s=PN(t.kind);if(!s)return!1;const c=cVe(t.id);return KQ.set(c,{entry:t,props:Ctn(t)}),ND({id:c,title:t.label,kind:"document",workspaceRole:"authored-subject",provenance:{...t.source?{sourcePath:t.source.path}:{},origin:s.file},Content:Rtn,...s.Toolbar?{Toolbar:Ntn}:{},...s.Shelf?{Shelf:Otn}:{},presentation:()=>({kind:"document",id:t.id}),persist:()=>({entryId:t.id}),onDispose:d=>{KQ.delete(d)}},n),!0}kN({id:"document",owner:"kind-documents",open:(t,n)=>{const s=cOe(n.id);return!s||!WMe(s.kind)?null:ID(s)?cVe(s.id):null},settle:async t=>{await CC(()=>cOe(t.id)!==void 0,2e4);const s=cOe(t.id);if(!s)throw new Error(`The project's document table lists no document: ${t.id}`);if(!await CC(()=>WMe(s.kind),2e4))throw new Error(`No editor is registered for documents of kind '${s.kind}' (${t.id})`)},ready:async t=>{await b4t(t),await EBe(t)}});function cOe(t){return u0()?.scenes.entries.find(n=>n.id===t)}function PFt(t,n={}){if(ID(t,n))return;const s=u2(()=>{ID(t,n)&&s()})}function Etn(t){const n=wtn(t);if(n===null)return!1;const s=()=>{const c=u0()?.scenes.entries.find(d=>d.id===n);return c?(PFt(c,{activate:!1}),!0):!1};if(!s()){const c=OC(()=>{s()&&c()})}return!0}function ktn(){return u2(()=>{const t=new Set(l0().map(n=>n.descriptor.id));for(const[n,{entry:s}]of KQ)t.has(n)&&PN(s.kind)&&ID(s,{activate:!1})})}function Atn(t,n){const s=wf(),c=()=>{if(wf()!==s)return!0;const m=u0();if(!m)return!1;const g=m.scenes.entries.find(S=>S.id===t);return g?(n(g),!0):!1};if(c())return;const d=OC(()=>{c()&&d()})}function Dtn(t){const n=t.entries.filter(c=>c.kind!=="scene"&&c.kind!=="prefab"&&(c.source!==void 0||PN(c.kind)!==void 0)),s=n.find(c=>c.id===t.default);return s||(n[0]??null)}let pxt=null,$ge=null;function Ptn(t){pxt?.();let n=t?new Set(t):null;const s=()=>{const c=u0();if(!c||c.documentsPending)return;const d=new Set(c.scenes.entries.map(g=>g.id));if(n===null){n=d,$ge=d;return}const m=[...c.scenes.entries].reverse().find(g=>!n?.has(g.id)&&g.kind!=="scene"&&g.kind!=="prefab"&&g.source&&WMe(g.kind));n=d,$ge=d,m?.source&&ID(m,{activate:!0,preview:!0})&&BI({path:`/${m.source.path}`,name:m.label,kind:"source",capabilities:ig(m.source.path),origin:"project",health:"healthy",selectionCount:1})};s(),pxt=OC(s)}function Itn(t){const n=wf(),s=()=>{if(wf()!==n)return!0;const d=u0();return!d||d.documentsPending||d.error!==null?!1:(d.scenes.entries.some(m=>t.includes(m.id))||IFt(),!0)};if(s())return;const c=OC(()=>{s()&&c()})}function IFt(){const t=wf(),n=()=>{if(wf()!==t)return!0;const c=u0();if(!c||c.documentsPending)return!1;if(l0().some(m=>!m.descriptor.area))return!0;const d=Dtn(c.scenes);if(!d)return!c.scenes.entries.some(m=>m.kind!=="scene"&&m.kind!=="prefab");if(!d.source)return ID(d),!0;{const m=`/${d.source.path}`;ID(d)||sN(m,DFt(d)),BI({path:m,name:d.label,kind:"source",capabilities:ig(d.source.path),origin:"project",health:"healthy",selectionCount:1})}return!0};if(n())return;const s=OC(()=>{n()&&s()})}wee({kind:"document",owner:"kind-documents",restore:({state:t,active:n})=>{const s=t,c=typeof s?.entryId=="string"?s.entryId:null;return c?(Atn(c,d=>{PFt(d,{activate:n})}),!0):!1},persistKindState:()=>$ge?{seen:[...$ge]}:void 0,beginRestore:({state:t,hasDocumentsToRestore:n,documentsToRestore:s})=>{const c=t,d=Array.isArray(c?.seen)?c.seen.filter(m=>typeof m=="string"):void 0;if(!n)IFt();else{const m=s.map(g=>g.kind==="document"?g.state?.entryId:void 0);m.every(g=>typeof g=="string")&&Itn(m)}Ptn(d)}});function lVe(t){Ye.useSyncExternalStore(u2,rA);const n=KQ.get(t)?.props;return{entry:n,contribution:n?PN(n.kind):void 0}}function Ntn({documentId:t,active:n}){const{entry:s,contribution:c}=lVe(t);return!s||!c?.Toolbar?null:q.jsx(IR,{contribution:c,Component:c.Toolbar,documentId:t,active:n,document:s},`${c.id}:${c.version}:toolbar:${t}`)}function Otn({documentId:t,active:n}){const{entry:s,contribution:c}=lVe(t);return!s||!c?.Shelf?null:q.jsx(IR,{contribution:c,Component:c.Shelf,documentId:t,active:n,document:s},`${c.id}:${c.version}:shelf:${t}`)}function Rtn({documentId:t,active:n}){const{entry:s,contribution:c}=lVe(t);return!s||!c?q.jsx("div",{style:{padding:12,fontSize:12,color:Go.content.muted,pointerEvents:"auto"},children:"No editor is registered for this document's kind — close this document."}):q.jsx(IR,{contribution:c,documentId:t,active:n,document:s},`${c.id}:${c.version}:${t}`)}function Ftn(t){if(t)for(const n of tVe(t)){if(n.plan.kind!=="root-document")continue;const s=aVe(n.plan.regionId);s&&B3t(s,n.plan.title)}}function Mtn(){const t=()=>Ftn(u0()?.scenes??null);return t(),OC(t)}const jtn=15e3;async function Ltn(t){const n=()=>u0()?.scenes.entries.some(s=>s.id===t)??!1;return n()||await new Promise(s=>{let c=!1;const d=()=>{c||(c=!0,clearTimeout(m),g(),s())},m=setTimeout(d,jtn),g=OC(()=>{n()&&d()});n()&&d()}),NFt(t)}function NFt(t){const n=u0();if(!n)return{ok:!1,code:"SCENE_TABLE_UNAVAILABLE",error:"open: the project adapter has not loaded yet, so there is no scene table to open."};const s=n.scenes.entries.find(d=>d.id===t);if(!s){const d=n.scenes.entries.map(m=>m.id);return{ok:!1,code:"SCENE_NOT_FOUND",error:`open: "${t}" is not in the adapter's scene table. Known ids: ${d.length>0?d.join(", "):"(the table is empty)"}.`,known:d}}if(s.kind!=="scene"&&s.kind!=="prefab"&&ID(s,{activate:!0}))return{ok:!0,documentId:cVe(s.id),title:s.label};const c=eVe(s);switch(c.kind){case"no-document":return c.liveReach!==void 0?{ok:!1,code:"SCENE_NAVIGATION_NOT_RUNNING",error:`open: ${c.reason} No game is running in this session.`}:{ok:!1,code:"SCENE_NOT_OPENABLE",error:`open: "${t}" has no Edit document — ${c.reason}`};case"root-document":{const d=aVe(c.regionId);return d?(SN(d)||X0(d),{ok:!0,documentId:d,title:c.title}):{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t}" is region "${c.regionId}"'s own document, and no document is mounted for that region in this session.`}}case"isolation-document":{const d=CD("scene",Ih()??{},{entry:s,activate:!0});return d?{ok:!0,documentId:d,title:c.title}:{ok:!1,code:"SCENE_NOT_OPENABLE",error:`No installed scene editor can open "${t}".`}}case"story-document":{const d=CD("story",Ih()??{},{storyId:c.storyId,title:c.title});return d===null?{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t}" is reached by story "${c.storyId}", and nothing in this editor opened it — either this project's story registry does not hold that id, or its module declares no medium (declare it via \`volter.adapter.ts\` regionIncludes or a manifest root entry). The session console names which.`}:{ok:!0,documentId:d,title:c.title}}}}let dZ=[];function vSn(t){return dZ=[...dZ,t],()=>{dZ=dZ.filter(n=>n!==t)}}async function Btn(t){for(const n of dZ){const s=await n(t);if(s)return s}return null}let $Z=null;function bSn(t){return $Z=t,()=>{$Z===t&&($Z=null)}}async function SSn(t){return $Z?$Z.observe(t):{result:await t(),settled:async()=>{},frame:async()=>null}}let pZ=[];function xSn(t){return pZ=[...pZ,t],()=>{pZ=pZ.filter(n=>n!==t)}}async function $tn(t,n){for(const s of pZ){const c=s(t,n);if(c!==null)return c}return null}const XQ="data-volter-game-styles",qtn=`[${XQ}]`;function ztn(t){t.setAttribute(XQ,"")}const wSn=Object.freeze(Object.defineProperty({__proto__:null,GAME_CSS_SCOPE_ATTRIBUTE:XQ,GAME_CSS_SCOPE_SELECTOR:qtn,markGameCssScope:ztn},Symbol.toStringTag,{value:"Module"})),OFt={installed:!1,sources:[],note:null},_xt="data-volter-scoped-game-css";let lOe=null,RFt=OFt,FFt=null;function MFt(){return FFt}function Vtn(){return typeof globalThis.CSSScopeRule=="function"}async function Utn(t){if(lOe?.projectRoot===t)return lOe.state;const n=Wtn(t);return lOe={projectRoot:t,state:n},n}function Jtn(){return RFt}async function Wtn(t){const n=await Htn(t);return RFt=n,n}async function Htn(t){let n;try{const m=await fetch("/__editor/scoped-game-css");n=await L_(m,"Could not read the project scoped game CSS")}catch{return OFt}const s=typeof n.css=="string"?n.css:"",c=Array.isArray(n.sources)?n.sources:[],d=typeof n.note=="string"?n.note:null;if(s.length===0)return{installed:!1,sources:c,note:d};if(!Vtn()){const m="unstyled — this browser has no CSS `@scope`, so the game stylesheet cannot be contained to the game. Loading it anyway would restyle the editor.";return Qs.warn(`[scoped-game-css] ${m}`,"authoring"),{installed:!1,sources:c,note:m}}return Gtn(t,s),{installed:!0,sources:c,note:d}}function Gtn(t,n){const s=document.head.querySelector(`style[${_xt}]`),c=s instanceof HTMLStyleElement?s:document.createElement("style");c.setAttribute(_xt,t),c.textContent=n,c.isConnected||document.head.appendChild(c),FFt=n}const TSn=Object.freeze(Object.defineProperty({__proto__:null,ensureScopedGameStyles:Utn,scopedGameStylesCssText:MFt,scopedGameStylesState:Jtn},Symbol.toStringTag,{value:"Module"})),Ktn='[data-volter-root-surface="true"]';function ove(t){return t.matches(Ktn)||t.closest('[data-volter-canvas-scene="true"]')!==null}function Xtn(){return{imgs:new WeakMap}}const jFt=500,LFt=100,BFt=8;function Ytn(t=jFt,n=LFt){let s=null,c=null,d=!1,m=null;const g=S=>{c?.disconnect(),s=S,m=null,d=!1,c=typeof MutationObserver>"u"?null:new MutationObserver(()=>{d=!0}),c?.observe(S,{subtree:!0,childList:!0,attributes:!0,characterData:!0})};return{take(S,k,A){if(s!==S)return g(S),null;c&&c.takeRecords().length>0&&(d=!0);const F=performance.now();return m&&m.width===k&&m.height===A&&(!d&&F-m.builtAt<=t||d&&F<m.notBefore)?m:(m=null,d=!1,null)},store(S,k,A,F,D){if(s!==S)return;const J=performance.now();m={...F,width:k,height:A,builtAt:J,notBefore:J+Math.max(n,BFt*D)}},dispose(){c?.disconnect(),c=null,s=null,m=null}}}function uOe(t,n){try{const s=t.createElement("canvas"),c=n,d=n instanceof HTMLVideoElement?n:null;s.width=Math.max(1,Math.round(Number(d?.videoWidth||c.naturalWidth||n.width)||0)),s.height=Math.max(1,Math.round(Number(d?.videoHeight||c.naturalHeight||n.height)||0));const m=s.getContext("2d");return m?(m.drawImage(n,0,0),s.toDataURL("image/png")):null}catch{return null}}function $Ft(t,n){const s=new Set,c=d=>{if(s.has(d))return"";s.add(d);try{return Array.from(d.cssRules).map(m=>{const g=m.styleSheet;return g?c(g):m.type===CSSRule.FONT_FACE_RULE?m.cssText.replace(/url\((['"]?)(.*?)\1\)/g,(S,k,A)=>`url("${new URL(A,d.href??t.baseURI).href}")`):m.cssText}).join(`
1395
1395
  `)}catch{return""}};return Array.from(n,c).filter(Boolean).join(`
1396
1396
  `)}function qFt(t){return $Ft(t,Array.from(t.styleSheets))}function Ztn(t,n){const s=n?.replace(/\\/g,"/").replace(/\/$/,""),c=Array.from(t.styleSheets).filter(d=>{const m=d.ownerNode,g=m instanceof Element?m.getAttribute("data-vite-dev-id"):null;if(!g)return!1;const S=(g.split("?")[0]??g).replace(/\\/g,"/");return S.includes("/node_modules/")?!1:s?S.startsWith(`${s}/`):!0});return c.length===0?"":$Ft(t,c)}async function Qtn(t){await t.fonts.ready;let n=qFt(t);const s=new Set;for(const c of n.matchAll(/@font-face\s*\{[^}]*\}/g))for(const d of c[0].matchAll(/url\("([^"]+)"\)/g))d[1].startsWith("data:")||s.add(d[1]);return await Promise.all(Array.from(s,async c=>{const d=await fetch(c,{signal:AbortSignal.timeout(1e4)});if(!d.ok)throw new Error(`Capture font could not be loaded (${d.status}): ${c}`);const m=await d.blob(),g=await new Promise((S,k)=>{const A=new FileReader;A.onload=()=>S(String(A.result)),A.onerror=()=>k(A.error),A.readAsDataURL(m)});n=n.replaceAll(`url("${c}")`,`url("${g}")`)})),n}function ern(t,n){const s=t.ownerDocument.defaultView?.getComputedStyle(t);if(s){for(const c of Array.from(s)){if(!c.startsWith("--"))continue;const d=s.getPropertyValue(c);d&&n.style.setProperty(c,d)}for(const c of["color","color-scheme","font-family","font-size","font-weight","line-height","text-shadow"]){const d=s.getPropertyValue(c);d&&n.style.setProperty(c,d)}}}function uVe(t){const s=t.ownerDocument.defaultView?.getComputedStyle(t)?.backgroundColor;if(!s||s==="transparent")return null;const c=/^rgba?\([^)]*,\s*([\d.]+)\s*\)$/.exec(s)?.[1];return c!==void 0&&Number(c)===0?null:s}function zFt(t){const n=[],s=new Set;for(const c of Array.from(t.querySelectorAll("canvas"))){if(!ove(c))continue;const d=[];for(let m=c.parentElement;m&&(m===t||t.contains(m))&&(d.unshift(m),m!==t);m=m.parentElement);for(const m of[...d,...trn(t,c)])s.has(m)||(s.add(m),n.push(m))}return n}function trn(t,n){const s=t.ownerDocument,c=n.getBoundingClientRect();if(c.width<=0||c.height<=0||typeof s.elementsFromPoint!="function")return[];const d=new Set,m=[[c.left+c.width/2,c.top+c.height/2],[c.left+c.width*.1,c.top+c.height*.1],[c.left+c.width*.9,c.top+c.height*.1],[c.left+c.width*.1,c.top+c.height*.9],[c.left+c.width*.9,c.top+c.height*.9]];for(const[g,S]of m){const k=s.elementsFromPoint(g,S),A=k.indexOf(n);if(!(A<0))for(const F of k.slice(A+1))rrn(F,t)&&d.add(F)}return Array.from(d).reverse()}function rrn(t,n){return t instanceof HTMLElement&&(t===n||n.contains(t))&&uVe(t)!==null}function VFt(t){const n=[];for(let s=t.parentElement;s;s=s.parentElement)n.unshift(s);return n}function nrn(t,n){const s="select, input, textarea",c=g=>[...g.matches(s)?[g]:[],...Array.from(g.querySelectorAll(s))],d=c(t),m=c(n);d.forEach((g,S)=>{const k=m[S];if(k){if(g instanceof HTMLSelectElement&&k instanceof HTMLSelectElement){const A=Array.from(g.options);Array.from(k.options).forEach((F,D)=>{A[D]?.selected?F.setAttribute("selected",""):F.removeAttribute("selected")});return}if(g instanceof HTMLInputElement&&k instanceof HTMLInputElement){g.type==="checkbox"||g.type==="radio"?g.checked?k.setAttribute("checked",""):k.removeAttribute("checked"):k.setAttribute("value",g.value);return}g instanceof HTMLTextAreaElement&&k instanceof HTMLTextAreaElement&&(k.textContent=g.value)}})}function irn(t,n){const s=[t,...Array.from(t.querySelectorAll("*"))],c=[n,...Array.from(n.querySelectorAll("*"))];s.forEach((d,m)=>{const g=d.scrollTop,S=d.scrollLeft;if(g===0&&S===0)return;const k=c[m];if(!(k instanceof HTMLElement))return;const A=k.firstElementChild;if(!(A instanceof HTMLElement))return;k.style.overflow="hidden";const F=getComputedStyle(d.firstElementChild??d),D=Number.parseFloat(F.marginTop)||0,J=Number.parseFloat(F.marginLeft)||0;g!==0&&(A.style.marginTop=`${D-g}px`),S!==0&&(A.style.marginLeft=`${J-S}px`)})}function orn(t,n,s){if(!s?.size)return;const c=[t,...Array.from(t.querySelectorAll("*"))],d=[n,...Array.from(n.querySelectorAll("*"))];c.forEach((m,g)=>{if(!s.has(m))return;const S=d[g];S instanceof HTMLElement&&(S.style.background="transparent")})}function UFt(t,n,s,c){const d=Array.from(t.children).filter(se=>se.tagName.toLowerCase()!=="canvas");if(d.length===0)return null;const m=c?.includeDocumentStyles===!0,g=m?t.cloneNode(!1):t.ownerDocument.createElement("div");g.style.position="relative",g.style.inset="auto",g.style.width=`${n}px`,g.style.height=`${s}px`,g.style.margin="0",g.style.transform="none",m?ern(t,g):g.style.background="transparent";const S=c?.transparentBackdrops;if(S?.has(t)&&(g.style.background="transparent"),t.closest(`[${XQ}]`)&&g.setAttribute(XQ,""),m){const se=c?.documentCssText??qFt(t.ownerDocument);if(se){const pe=t.ownerDocument.createElement("style");pe.textContent=se,g.appendChild(pe)}}const k=t.ownerDocument.createElement("style");k.textContent="*,*::before,*::after{animation:none!important;transition:none!important;caret-color:transparent!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;}",g.appendChild(k);const A=MFt();if(A){const se=t.ownerDocument.createElement("style");se.textContent=A,g.appendChild(se)}if(!m){const se=Ztn(t.ownerDocument,c?.projectRoot);if(se){const pe=t.ownerDocument.createElement("style");pe.textContent=se,g.appendChild(pe)}}for(const se of d){const pe=se.cloneNode(!0);orn(se,pe,S),nrn(se,pe),irn(se,pe);const ue=[...se instanceof HTMLImageElement?[se]:[],...Array.from(se.querySelectorAll("img"))];[...pe instanceof HTMLImageElement?[pe]:[],...Array.from(pe.querySelectorAll("img"))].forEach((X,we)=>{const qe=ue[we];if(!qe?.complete||qe.naturalWidth<=0||qe.naturalHeight<=0)return;const bt=qe.currentSrc||qe.src,Pt=c?.snapshots?.imgs.get(qe),Wt=Pt&&Pt.src===bt?Pt.url:uOe(t.ownerDocument,qe);(!Pt||Pt.src!==bt)&&c?.snapshots?.imgs.set(qe,{src:bt,url:Wt}),Wt&&X.setAttribute("src",Wt)});const De=[...se instanceof HTMLVideoElement?[se]:[],...Array.from(se.querySelectorAll("video"))];[...pe instanceof HTMLVideoElement?[pe]:[],...Array.from(pe.querySelectorAll("video"))].forEach((X,we)=>{const qe=De[we];if(!qe||qe.readyState<2||qe.videoWidth<=0)return;const bt=uOe(t.ownerDocument,qe);if(!bt)return;const Pt=t.ownerDocument.createElement("img");Pt.setAttribute("src",bt),Pt.setAttribute("style",X.getAttribute("style")??""),X.replaceWith(Pt)});const be=Array.from(se.querySelectorAll("canvas"));Array.from(pe.querySelectorAll("canvas")).forEach((X,we)=>{const qe=be[we];if(qe&&ove(qe)){X.remove();return}const bt=qe?c?.canvasPixels?.get(qe):void 0,Pt=bt?uOe(t.ownerDocument,bt):null;if(!Pt){X.remove();return}const Wt=t.ownerDocument.createElement("img");Wt.setAttribute("src",Pt),Wt.setAttribute("style",`${X.getAttribute("style")??""}`);for(const zt of Array.from(X.attributes))Wt.setAttribute(zt.name,zt.value);X.replaceWith(Wt)}),g.appendChild(pe)}const F=new XMLSerializer().serializeToString(g),D=c?.rasterSize?.width??n,J=c?.rasterSize?.height??s,$=D===n&&J===s?"":` viewBox="0 0 ${n} ${s}"`;return{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="${D}" height="${J}"${$}><foreignObject width="100%" height="100%">${F}</foreignObject></svg>`,overlayCount:d.length}}const srn={canvas:"canvas layer","dom-overlay":"DOM overlay layer","composite-output":"composite output"};class HI extends Error{layer;constructor(n,s){const c=typeof s=="object"&&s!==null&&"message"in s&&typeof s.message=="string"?s.message:String(s);super(`${srn[n]} capture failed — ${c}`),this.name="CaptureLayerError",this.layer=n}}function qge(t,n){return n instanceof HI?n:new HI(t,n)}const X4=32,arn=24,fVe=.9;function JFt(t,n){return[t[n*4]??0,t[n*4+1]??0,t[n*4+2]??0]}function crn(t,n){const s=new Map;for(let m=0;m<n;m++){const[g,S,k]=JFt(t,m),A=g>>5<<10|S>>5<<5|k>>5,F=s.get(A)??{n:0,r:0,g:0,b:0};F.n+=1,F.r+=g,F.g+=S,F.b+=k,s.set(A,F)}let c={n:1,r:0,g:0,b:0},d=0;for(const m of s.values())m.n/n>=.01&&(d+=1),m.n>c.n&&(c=m);return{mean:[Math.round(c.r/c.n),Math.round(c.g/c.n),Math.round(c.b/c.n)],distinctRegions:d}}function lrn(t,n,s){let c=0;for(let d=0;d<n;d++){const m=JFt(t,d);Math.max(Math.abs(m[0]-s[0]),Math.abs(m[1]-s[1]),Math.abs(m[2]-s[2]))<=arn&&(c+=1)}return c}function WFt(t,n,s=fVe){const{mean:c,distinctRegions:d}=crn(t,n),m=Math.round(lrn(t,n,c)/n*1e3)/1e3,g=`#${c.map(A=>A.toString(16).padStart(2,"0")).join("")}`,S=m>=s,k=`this capture is ~${Math.round(m*100)}% one flat surface (${g}) — likely a wall, an empty view, or a buried camera; it is weak evidence.`;return{dominantFraction:m,dominantColor:g,distinctRegions:d,degenerate:S,...S?{warning:k}:{}}}function HMe(t,n,s=fVe){try{const c=n.createElement("canvas");c.width=X4,c.height=X4;const d=c.getContext("2d");if(!d)return null;d.drawImage(t,0,0,X4,X4);const m=d.getImageData(0,0,X4,X4);return WFt(m.data,X4*X4,s)}catch{return null}}async function HFt(t,n=350){if(typeof t.getAnimations!="function")return;const s=t.getAnimations({subtree:!0}).filter(c=>{const d=c.effect?.getComputedTiming().endTime;return typeof d=="number"&&Number.isFinite(d)});s.length!==0&&await Promise.race([Promise.allSettled(s.map(c=>c.finished)),new Promise(c=>setTimeout(c,n))])}async function YQ(t,n=75){const s=t.ownerDocument.defaultView?.requestAnimationFrame.bind(t.ownerDocument.defaultView);s&&await new Promise(c=>{let d=!1;const m=()=>{d||(d=!0,clearTimeout(g),c())},g=setTimeout(m,n);s(()=>s(m))})}async function GFt(t,n){return await YQ(t),(n?.presentsOnCanvas??t.querySelectorAll("canvas").length>0)||await new Promise(c=>setTimeout(c,650)),await HFt(t),await YQ(t),GMe(t,2,n??{})}const KFt=.03;function XFt(t,n){if(n<=0)return 0;let s=0;for(let c=3;c<t.length;c+=4)t[c]===0&&(s+=1);return s/n}function YFt(t,n,s=.08){if(n<=0)return!1;let c=0;for(let d=0;d<t.length;d+=4)t[d]<=8&&t[d+1]<=8&&t[d+2]<=8&&t[d+3]>=250&&(c+=1);return c/n>s}function urn(t,n,s,c){let d;try{d=t.getImageData(0,0,n,s)}catch{return{kind:"ok"}}const m=n*s,g=XFt(d.data,m),S=g>KFt;return c>0&&(S||YFt(d.data,m))?{kind:"retry"}:S?{kind:"blank",transparentFraction:g}:{kind:"ok"}}function frn(t,n,s){let c;try{c=t.getImageData(0,0,n,s)}catch{return{left:0,top:0,right:n,bottom:s}}let d=n,m=s,g=-1,S=-1;const k=c.data;for(let A=0;A<s;A+=1){const F=A*n*4;for(let D=0;D<n;D+=1)k[F+D*4+3]!==0&&(D<d&&(d=D),D>g&&(g=D),A<m&&(m=A),A>S&&(S=A))}return g<0?null:{left:d,top:m,right:g+1,bottom:S+1}}async function GMe(t,n,s){const c=t.ownerDocument.createElement("canvas"),d=await ZFt(t,c,s),m=c.width,g=c.height,S=c.getContext("2d");if(!S)throw new HI("composite-output","no 2d canvas context");if(d.canvases===0&&d.domOverlays>0&&s?.cropToContent===!0){const D=frn(S,m,g);if(D===null){if(s.allowTransparent)return{base64:c.toDataURL("image/png").split(",")[1],mimeType:"image/png",layers:d};if(n>0)return await new Promise(we=>setTimeout(we,300)),await YQ(t),GMe(t,n-1,s);throw new HI("dom-overlay","the composite is ~100% fully transparent after two repaints — nothing in it painted a backdrop, so the PNG would read as a flat black frame. This subject's background is painted by an element OUTSIDE what is being photographed (a detached clone carries no ancestors), or its own DOM never mounted.")}const J=16,$=Math.max(0,D.left-J),G=Math.max(0,D.top-J),se=Math.min(m,D.right+J),pe=Math.min(g,D.bottom+J),ue=t.ownerDocument.createElement("canvas");ue.width=Math.max(1,se-$),ue.height=Math.max(1,pe-G);const Ce=ue.getContext("2d");if(!Ce)throw new HI("composite-output","no 2d canvas context");const De=getComputedStyle(t).backgroundColor;De&&De!=="transparent"&&De!=="rgba(0, 0, 0, 0)"&&(Ce.fillStyle=De,Ce.fillRect(0,0,ue.width,ue.height)),Ce.drawImage(c,$,G,ue.width,ue.height,0,0,ue.width,ue.height);const Pe=HMe(ue,t.ownerDocument);let be;try{be=ue.toDataURL("image/png")}catch(we){throw qge("composite-output",we)}const X=be.indexOf(",");return{base64:X>=0?be.slice(X+1):be,mimeType:"image/png",layers:d,...Pe?{flatness:Pe}:{}}}if(d.canvases===0&&d.domOverlays>0&&!s.allowTransparent){const D=urn(S,m,g,n);if(D.kind==="retry")return await new Promise(J=>setTimeout(J,300)),await YQ(t),GMe(t,n-1,s);if(D.kind==="blank")throw new HI("dom-overlay",`the composite is ~${Math.round(D.transparentFraction*100)}% fully transparent after two repaints — nothing in it painted a backdrop, so the PNG would read as a flat black frame. This subject's background is painted by an element OUTSIDE what is being photographed (a detached clone carries no ancestors), or its own DOM never mounted.`)}const k=HMe(c,t.ownerDocument);let A;try{A=c.toDataURL("image/png")}catch(D){throw qge("composite-output",D)}const F=A.indexOf(",");return{base64:F>=0?A.slice(F+1):A,mimeType:"image/png",layers:d,...k?{flatness:k}:{}}}function mxt(t,n,s,c=1,d=1){for(const m of n){const g=uVe(m);if(!g)continue;const S=m.getBoundingClientRect();t.fillStyle=g,t.fillRect((S.left-s.left)*c,(S.top-s.top)*d,S.width*c,S.height*d)}}async function ZFt(t,n,s){const c=t.getBoundingClientRect(),d=Math.max(1,Math.round(s?.size?.width??c.width)),m=Math.max(1,Math.round(s?.size?.height??c.height)),g=s?.size?d/c.width:1,S=s?.size?m/c.height:1;n.width!==d&&(n.width=d),n.height!==m&&(n.height=m);const k=n.getContext("2d");if(!k)throw new HI("composite-output","no 2d canvas context");if(k.clearRect(0,0,d,m),s?.cropToContent!==!0){const se=getComputedStyle(t).backgroundColor;se&&se!=="transparent"&&se!=="rgba(0, 0, 0, 0)"&&(k.fillStyle=se,k.fillRect(0,0,d,m))}s?.includeDocumentStyles&&mxt(k,VFt(t),c,g,S);const F=Array.from(t.querySelectorAll("canvas")).some(se=>!ove(se))?null:s?.overlayCache?.take(t,d,m),D=F?.backdrops??zFt(t);mxt(k,D,c,g,S);const J=Array.from(t.querySelectorAll("canvas")).filter(se=>{const pe=se.getBoundingClientRect();return se.width>0&&se.height>0&&pe.width>0&&pe.height>0}),$=new Map;for(const se of J)try{const pe=se.getBoundingClientRect(),ue=await s?.canvasFrame?.(se)??se;$.set(se,ue),k.drawImage(ue,(pe.left-c.left)*g,(pe.top-c.top)*S,pe.width*g,pe.height*S)}catch(pe){throw qge("canvas",pe)}let G=0;try{if(F)F.image&&k.drawImage(F.image,0,0,d,m),G=F.overlayCount;else{const se=performance.now(),pe=UFt(t,d/g,m/S,{includeDocumentStyles:s?.includeDocumentStyles,projectRoot:s?.projectRoot,documentCssText:s?.includeDocumentStyles?await Qtn(t.ownerDocument):void 0,canvasPixels:$,transparentBackdrops:new Set(D),snapshots:s?.snapshots,rasterSize:{width:d,height:m}});if(pe){const ue=new Image;ue.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(pe.svg)}`,await ue.decode(),k.drawImage(ue,0,0,d,m),G=pe.overlayCount,s?.overlayCache?.store(t,d,m,{image:ue,overlayCount:pe.overlayCount,backdrops:D},performance.now()-se)}else s?.overlayCache?.store(t,d,m,{image:null,overlayCount:0,backdrops:D},performance.now()-se)}}catch(se){throw qge("dom-overlay",se)}return{canvases:J.length,domOverlays:G}}const drn=Object.freeze(Object.defineProperty({__proto__:null,CaptureLayerError:HI,FLATNESS_GRID:X4,FLATNESS_WARN_AT:fVe,OVERLAY_CACHE_MAX_AGE_MS:jFt,OVERLAY_REBUILD_COST_MULTIPLIER:BFt,OVERLAY_REBUILD_FLOOR_MS:LFt,TRANSPARENT_PIXEL_LIMIT:KFt,ancestorBackdrops:VFt,buildOverlaySvg:UFt,capturePlayComposite:GFt,createImageSnapshotCache:Xtn,createOverlayFrameCache:Ytn,drawPlayCompositeFrame:ZFt,hasExcessNearBlackPixels:YFt,isRootCanvas:ove,measureFlatness:WFt,opaqueBackgroundColor:uVe,rootSurfaceBackdrops:zFt,sampleFlatness:HMe,transparentPixelFraction:XFt,waitForFiniteMotion:HFt,waitForPaint:YQ},Symbol.toStringTag,{value:"Module"}));function ote(t){const n=TC(),s=n?.descriptor.presentation?.()??void 0,c=s2(n?.descriptor.id),d=Lye(),m=c?.selection?c.selection.read():d?.adapter?.selection?.get()??(c?[...t.selectedEntityIds]:[]),g=c?.read()??void 0,S=oDt();return{version:1,workspace:zS(),...Nhe()===null?{}:{style:Nhe()},keymap:dR(),...s?{document:s}:{},...m.length>0?{selection:{ids:[...m]}}:{},...g?{viewport:g}:{},...S?{panel:S}:{}}}function prn(t){return sCt(ote(t),window.location.href)}let $I=[],_rn=0,QFt=0;const KMe=new Set;function XMe(){QFt++;for(const t of KMe)t()}function e9t(){XMe()}function YMe(){return X1()}function dVe(){let t=null;for(const{session:n}of $I){const s=n.startedAt?.()??null;s!==null&&(!t||s>t.startedAt)&&(t={startedAt:s,endedAt:n.endedAt?.()??null})}return t}function t9t(){for(const{session:t}of $I){const n=t.restartRequired?.()??null;if(n!==null)return n}return null}function r9t(){(X1().find(s=>(s.restartRequired?.()??null)!==null)??X1().find(s=>s.mounted()&&s.restart))?.restart?.()}function pVe(){for(const t of X1()){if(!t.mounted())continue;const n=t.frameCanvas?.()??null;if(n)return n}return null}function _Ve(t){for(const n of X1())if(!(!n.mounted()||!n.snapshotFrame)&&n.frameCanvas?.()===t)return n.snapshotFrame();return null}function mVe(t){for(const n of X1()){if(!n.mounted()||!n.command)continue;const s=n.command(t);if(s)return s}return null}function hVe(){for(const t of X1()){if(!t.mounted())continue;const n=t.scenes?.()??null;if(n&&typeof n.goToScene=="function")return n}return null}function sve(){for(const t of X1()){if(!t.mounted())continue;const n=t.surface?.()??null;if(n)return n}return null}function gVe(){for(const t of X1()){if(!t.mounted())continue;const n=t.coverage?.()??null;if(n)return n}return null}function yVe(){for(const t of X1()){if(!t.mounted())continue;const n=t.authoringRefusal?.()??null;if(n!==null)return n}return null}function n9t(t){return X1().find(s=>s.mounted()&&s.remount)?.remount?.(t)??null}function i9t(t){if($I.some(s=>s.session.id===t.id))throw new Error(`live session "${t.id}" is already registered.`);const n={session:t,seq:_rn++};return $I=[...$I,n],XMe(),()=>{$I=$I.filter(s=>s!==n),XMe()}}function X1(){return[...$I].sort((t,n)=>(t.session.priority??0)-(n.session.priority??0)||t.seq-n.seq).map(t=>t.session)}function vVe(){return X1().some(t=>t.mounted())}function ave(){return X1().some(t=>t.playing())}function bVe(){for(const t of X1())t.stop()}function o9t(t){for(const n of X1()){const s=n.instanceContainer(t);if(s)return s}return null}function SVe(t){return KMe.add(t),()=>KMe.delete(t)}function s9t(){return QFt}const mrn=Object.freeze(Object.defineProperty({__proto__:null,anyLiveSessionMounted:vVe,anyLiveSessionPlaying:ave,dispatchLiveCommand:mVe,liveAuthoringRefusal:yVe,liveCoverage:gVe,liveFrameCanvas:pVe,liveInstanceContainer:o9t,liveRestartRequired:t9t,liveRunWindow:dVe,liveScenes:hVe,liveSessions:YMe,liveSessionsVersion:s9t,liveSurface:sve,notifyLiveSessionsChanged:e9t,registerLiveSession:i9t,remountLiveSelection:n9t,restartLiveSession:r9t,snapshotLiveFrame:_Ve,stopAllLiveSessions:bVe,subscribeLiveSessions:SVe},Symbol.toStringTag,{value:"Module"}));async function a9t(t){const n=_Ve(t);return n||Btn(t)}function hrn(t){const n=t;return n&&typeof n.toDataURL=="function"?n:null}const grn=Object.freeze(Object.defineProperty({__proto__:null,liveCanvasFrame:a9t,readablePngSource:hrn},Symbol.toStringTag,{value:"Module"}));let qZ=null;function yrn(){if(!qZ)return!0;try{return qZ()}catch{return!0}}function vrn(t){return qZ=t,()=>{qZ===t&&(qZ=null)}}const c9t=new WeakMap;function CSn(t,n){c9t.set(t,n)}function l9t(t){for(const n of Array.from(t.querySelectorAll("iframe"))){const s=c9t.get(n),c=s?.container();if(s&&c)return{container:c,canvasFrame:s.canvasFrame}}return null}function cve(t){return Array.from(document.querySelectorAll("[data-workspace-document-id]")).find(n=>n.dataset.workspaceDocumentId===t&&(CRe()===null||n.dataset.workspaceViewId===CRe()))??null}const ZMe=["document","header","shelf","rail","outliner","content","utility","menubar"],brn={rail:{part:"properties",view:"volter.properties",title:"Properties"},outliner:{part:"outliner",view:"volter.outliner",title:"Outliner"},content:{part:"content",view:"volter.content",title:"Content"}},Srn={header:{prefix:"document-header",title:"header strip"},shelf:{prefix:"document-shelf",title:"tool shelf"}};function xVe(t){const n=[t.container,...t.extraRoots??[]];for(let c=0;c<n.length;c++)for(const d of n[c].querySelectorAll("[data-volter-portal]")){const m=d.dataset.volterPortal;if(m===void 0)continue;const g=document.querySelector(`[data-volter-portal-content="${CSS.escape(m)}"]`);g&&!n.includes(g)&&n.push(g)}const s=l9t(t.container)?.container;return s&&!n.includes(s)&&n.push(s),n}function xrn(t){return document.querySelector(`[data-volter-part="${t}"]`)}function wrn(){const t=[...document.querySelectorAll("[data-volter-utility]")].find(s=>{const c=s.getBoundingClientRect();return c.width>0&&c.height>0});if(!t)throw new Error("No utility view is showing, so scope 'utility' has nothing to reach. Show one in the panel (View: Open View…) and retry.");const n=t.dataset.volterUtility??"";return{container:t,name:"utility",id:n,title:n}}function Trn(){const t=document.querySelector('[data-testid="app-menubar"]');if(!t)throw new Error("The application menus are not on screen, so scope 'menubar' has nothing to reach.");return{container:t,name:"menubar",id:"app-menubar",title:"application menus"}}function Crn(t){if(t==="utility")return wrn();if(t==="menubar")return Trn();const n=t==="rail"||t==="outliner"||t==="content"?brn[t]:null;if(n){const s=xrn(n.part),c=t==="rail"?[...document.querySelectorAll('[data-testid="inspector-panel"][data-volter-inspector-presentation="card"]')].find(d=>{const m=d.getBoundingClientRect();return m.width>0&&m.height>0})??null:null;if(c&&!s)return{container:c,name:t,id:n.view,title:"Inspector card"};if(c&&s)return{container:s,extraRoots:[c],name:t,id:n.view,title:`${n.title} and the inspector card`};if(!s)throw new Error(`The ${n.title} view (${n.view}) is not open, so scope '${t}' has nothing to reach. Open it from the workbench (View: Open View…) and retry — this door reads and drives what is on screen, and reports its absence rather than an empty match list.`);return{container:s,name:t,id:n.view,title:n.title}}return Ern(t)}function Ern(t){const n=TC();if(!n)throw new Error(`No active editor document, so scope '${t}' has nothing to reach. The editor's own views are still readable: scope 'outliner', scope 'rail', and scope 'content'.`);const s=Pp()??n.descriptor.id;if(s===a0&&t!=="header")throw new Error("The Game document is out of this door's scope: drive and read a game through its own doors — `game.commands()`/`game.command(n)`/`game.state(n)`, or `page(step)` during play — never through synthetic DOM gestures. Its header strip (the editor's own Play bar and controls) is scope 'header'; the editor's views around it stay readable: scope 'outliner' and scope 'rail'.");const c=cve(s);if(!c)throw new Error(`The active document's surface is not mounted: ${s} (${n.title}). Present it first (\`editor.present\`) and retry.`);const d=c.closest(".volter-dock-document")??c;if(t==="document")return{container:d,name:t,id:s,title:n.title};const m=Srn[t],g=d.querySelector(`[data-testid="${m.prefix}:${s}"]`);if(!g)throw new Error(`The active document "${n.title}" (${s}) draws no ${m.title}, so scope '${t}' has nothing to reach. Its whole box is scope 'document'.`);return{container:g,name:t,id:s,title:`${n.title} — ${m.title}`}}function hxt(t,n){return new Error(`Out of scope: ${n}. This step ran in scope '${t.name}' — "${t.title}" (${t.id}) — and reaches ONLY inside it. The other surfaces are named, not walked to: ${ZMe.filter(s=>s!==t.name).map(s=>`'${s}'`).join(", ")} (pass \`{ scope }\`). The rest of the page is deliberately unreachable.`)}const gxt=400,yxt="rgb(1, 2, 3)",krn="rgba(0, 0, 0, 0)";function Arn(t,n){const s=getComputedStyle(t).getPropertyValue(n).trim();if(s==="")return"";const d=t.ownerDocument.createElement("span");d.style.position="absolute",d.style.pointerEvents="none",d.style.visibility="hidden",d.style.backgroundColor=yxt,t.appendChild(d);try{d.style.backgroundColor=`var(${n})`;const m=getComputedStyle(d).backgroundColor.trim();return m===yxt||m===krn?s:m}finally{d.remove()}}function Drn(t,n){const s=getComputedStyle(t),c={};for(const d of n)c[d]=d.startsWith("--")?Arn(t,d):s.getPropertyValue(Prn(d)).trim();return c}function Prn(t){return t.includes("-")?t:t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function vxt(t,n,s){const c=t,d={};for(const A of Array.from(t.attributes))d[A.name]=A.value;const m=c.getBoundingClientRect(),g=t.value,S=t.checked,k=(c.innerText||t.textContent||"").trim();return{index:n,tag:t.tagName.toLowerCase(),text:k.length>gxt?`${k.slice(0,gxt)}…`:k,attributes:d,rect:{x:m.x,y:m.y,width:m.width,height:m.height},...typeof g=="string"?{value:g}:{},...typeof S=="boolean"?{checked:S}:{},...c.hasAttribute("disabled")?{disabled:!0}:{},...s&&s.length>0?{styles:Drn(c,s)}:{}}}function _me(t,n,s){const c=f9t(t,n),d=c[s];if(!d)throw hxt(t,`${JSON.stringify(n)} matched ${c.length} element(s), so index ${s} does not exist`);if(!xVe(t).some(m=>m.contains(d)))throw hxt(t,`${JSON.stringify(n)} resolved outside the document's container`);return d}function Irn(t,n=[.5,.5]){const s=t.getBoundingClientRect();return{bubbles:!0,cancelable:!0,composed:!0,view:t.ownerDocument.defaultView??window,clientX:s.x+s.width*n[0],clientY:s.y+s.height*n[1],button:0,buttons:1}}function wVe(t){let n=t;for(;n&&!(n.hasAttribute("tabindex")||n.tabIndex>=0||n.isContentEditable);)n=n.parentElement;(n??t).focus({preventScroll:!0})}function u9t(t,n=[.5,.5]){const s=t.getBoundingClientRect();return{clientX:s.x+s.width*n[0],clientY:s.y+s.height*n[1]}}function Nrn(t,n){const{clientX:s,clientY:c}=u9t(t,n);return t.ownerDocument.elementFromPoint(s,c)??t}async function Orn(t,n=1,s,c={},d){const m={...Irn(t,s),...d,...c},g=Math.max(1,Math.round(n)),S=t.ownerDocument;for(let k=1;k<=g;k++){const A={...m,detail:k},F={...m,buttons:0,detail:k};mme(t,()=>{t.dispatchEvent(new PointerEvent("pointerdown",{...A,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousedown",A)),wVe(t)}),await new Promise(J=>setTimeout(J,0));const D=t.isConnected?t:S.elementFromPoint(m.clientX??0,m.clientY??0)??S.body;if(mme(D,()=>{D.dispatchEvent(new PointerEvent("pointerup",{...F,pointerType:"mouse"})),D.dispatchEvent(new MouseEvent("mouseup",F)),D===t&&t.dispatchEvent(new MouseEvent("click",F))}),D!==t)return}g>=2&&mme(t,()=>t.dispatchEvent(new MouseEvent("dblclick",{...m,buttons:0,detail:g})))}function Rrn(t,n,s,c){const d=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null;if(!d)throw new Error(`Cannot type into a <${t.tagName.toLowerCase()}>: this verb drives a text field. Click the control that opens one first (the Outliner's rename is a double click — \`click(selector, { clicks: 2 })\`), then \`type\` into the field it puts up.`);const m=t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(m,"value")?.set,S=A=>{g?g.call(d,A):d.value=A};d.focus();let k=d.value;s&&k!==""&&(d.select?.(),k="",S(k),d.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0,inputType:"deleteContentBackward"})));for(const A of[...n]){const F={key:A,bubbles:!0,cancelable:!0,composed:!0};d.dispatchEvent(new KeyboardEvent("keydown",F)),k+=A,S(k),d.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0,inputType:"insertText",data:A})),d.dispatchEvent(new KeyboardEvent("keyup",F))}if(c){const A={key:"Enter",code:"Enter",bubbles:!0,cancelable:!0,composed:!0};d.dispatchEvent(new KeyboardEvent("keydown",A)),d.dispatchEvent(new KeyboardEvent("keyup",A))}}function mme(t,n){const c=(t.ownerDocument.defaultView??window).Element.prototype,d=c.setPointerCapture,m=c.releasePointerCapture;c.setPointerCapture=()=>{},c.releasePointerCapture=()=>{};try{n()}finally{c.setPointerCapture=d,c.releasePointerCapture=m}}function Frn(t,n,s,c,d={},m=[],g=0){const S=t.getBoundingClientRect(),k=g===0?1:g===2?2:4,A=(D,J)=>({bubbles:!0,cancelable:!0,composed:!0,view:window,clientX:S.x+S.width*D,clientY:S.y+S.height*J,button:g,buttons:k,altKey:d.altKey??!1,ctrlKey:d.ctrlKey??!1,metaKey:d.metaKey??!1,shiftKey:d.shiftKey??!1}),F=A(n[0],n[1]);mme(t,()=>{t.dispatchEvent(new PointerEvent("pointermove",{...F,button:-1,buttons:0,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousemove",{...F,buttons:0})),t.dispatchEvent(new PointerEvent("pointerdown",{...F,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousedown",F)),wVe(t);const D=Math.max(1,Math.round(c)),J=[n,...m,s];for(let G=0;G+1<J.length;G++){const se=J[G],pe=J[G+1];for(let ue=1;ue<=D;ue++){const Ce=ue/D,De=A(se[0]+(pe[0]-se[0])*Ce,se[1]+(pe[1]-se[1])*Ce);t.dispatchEvent(new PointerEvent("pointermove",{...De,button:-1,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousemove",De))}}const $={...A(s[0],s[1]),buttons:0};t.dispatchEvent(new PointerEvent("pointerup",{...$,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mouseup",$)),g===2?t.dispatchEvent(new MouseEvent("contextmenu",$)):g===0&&n[0]===s[0]&&n[1]===s[1]&&t.dispatchEvent(new MouseEvent("click",$))})}function Mrn(t,n){if(n)return n;const s=document.activeElement;return s instanceof HTMLElement&&xVe(t).some(c=>c.contains(s))?s:t.container}function f9t(t,n){try{return xVe(t).flatMap(s=>Array.from(s.querySelectorAll(n)))}catch(s){throw new Error(`Invalid selector ${JSON.stringify(n)}: ${String(s)}`)}}function fOe(t,n){const s=n.selector===void 0?null:_me(t,n.selector,n.index??0);return Mrn(t,s)}const jrn={" ":"Space","`":"Backquote","-":"Minus","=":"Equal","[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash"};function Lrn(t){return/^[a-z]$/i.test(t)?`Key${t.toUpperCase()}`:/^[0-9]$/.test(t)?`Digit${t}`:jrn[t]??t}const Brn={Backspace:8,Tab:9,Enter:13,Escape:27," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Delete:46};function $rn(t){if(/^[a-z0-9]$/i.test(t))return t.toUpperCase().charCodeAt(0);const n=/^F([1-9]|1[0-2])$/.exec(t);return n?111+Number(n[1]):Brn[t]??0}function qrn(t){const n=t===void 0?null:/^Numpad([0-9])$/.exec(t);return n?96+Number(n[1]):t==="NumpadDecimal"?110:null}function bxt(t,n){const s=new KeyboardEvent(t,zrn(n)),c=qrn(n.code)??$rn(n.key);return Object.defineProperty(s,"keyCode",{get:()=>c}),Object.defineProperty(s,"which",{get:()=>c}),s}function zrn(t){return{key:t.key,code:t.code??Lrn(t.key),bubbles:!0,cancelable:!0,composed:!0,...t.ctrlKey?{ctrlKey:!0}:{},...t.metaKey?{metaKey:!0}:{},...t.shiftKey?{shiftKey:!0}:{},...t.altKey?{altKey:!0}:{}}}function Vrn(t,n){const s=[...t.options].map(d=>d.value);if(!s.includes(n))throw new Error(`No option with value ${JSON.stringify(n)} on this <select> — it offers ${s.map(d=>JSON.stringify(d)).join(", ")||"(no options)"}. The value is the option's \`value\`, not its label; \`query\` reports both.`);const c=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;c?c.call(t,n):t.value=n,t.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),t.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}const dOe=["query","click","drag","key","paste","select","type"];function Urn(t){const n=t?.action;if(!dOe.includes(n))throw new Error(`Unknown document-probe action ${JSON.stringify(n)}. This door has exactly ${dOe.length} verbs: ${dOe.join(", ")} (\`editor.document.*\`).`);const s=t.scope??"document";if(!ZMe.includes(s))throw new Error(`Unknown scope ${JSON.stringify(s)}. This door addresses exactly these surfaces: ${ZMe.map(c=>`'${c}'`).join(", ")}.`);return Crn(s)}async function Jrn(t){const n=Urn(t);if(Pp()===a0&&yrn()&&t.action!=="query"&&t.action!=="click"&&t.action!=="select")throw new Error(`'${t.action}' is refused while the Game document holds the keyboard: its events would reach the game. Query, click and select still work; click into a view's field first, or drive the game through the game's own doors.`);const s={name:n.name,id:n.id,title:n.title},c=d=>({scope:s,matched:1,elements:[vxt(d,0)]});switch(t.action){case"query":{const d=f9t(n,t.selector);return{scope:s,matched:d.length,elements:d.slice(0,t.limit??25).map((m,g)=>vxt(m,g,t.styles))}}case"click":{const d=_me(n,t.selector,t.index??0),m=t.at;if(m!==void 0&&!(Array.isArray(m)&&m.length===2&&m.every(S=>typeof S=="number"&&Number.isFinite(S))))throw new Error(`click's \`at\` is [x, y], fractions of the element's box; got ${JSON.stringify(m)}.`);const g=d.ownerDocument===document?d:Nrn(d,m);return await Orn(g,t.clicks??1,m&&g===d?m:void 0,{...t.altKey?{altKey:!0}:{},...t.ctrlKey?{ctrlKey:!0}:{},...t.metaKey?{metaKey:!0}:{},...t.shiftKey?{shiftKey:!0}:{}},g===d?void 0:u9t(d,m)),c(g)}case"type":{const d=fOe(n,t);return Rrn(d,t.text,t.replace??!0,t.enter??!0),c(d)}case"drag":{if(t.button!==void 0&&![0,1,2].includes(t.button))throw new Error(`Unknown button ${JSON.stringify(t.button)}: 0 primary, 1 middle, 2 secondary.`);const d=_me(n,t.selector,t.index??0),m=d.getBoundingClientRect(),g=[["from",t.from],...(t.via??[]).map((S,k)=>[`via[${k}]`,S]),["to",t.to]];for(const[S,k]of g)if(!k.every(F=>Number.isFinite(F)&&F>=0&&F<=1)&&!(t.leave&&S!=="from"&&k.every(F=>Number.isFinite(F))))throw new Error(`drag ${S} ${JSON.stringify(k)} is not a fraction of the element's box: points are [x, y] from 0 to 1 from its top-left ([0.5, 0.5] is its centre). This element is ${Math.round(m.width)} x ${Math.round(m.height)} px at (${Math.round(m.x)}, ${Math.round(m.y)}); a page pixel px becomes (px - ${Math.round(m.x)}) / ${Math.round(m.width)}.`);return Frn(d,t.from,t.to,t.steps??8,{...t.altKey===void 0?{}:{altKey:t.altKey},...t.ctrlKey===void 0?{}:{ctrlKey:t.ctrlKey},...t.metaKey===void 0?{}:{metaKey:t.metaKey},...t.shiftKey===void 0?{}:{shiftKey:t.shiftKey}},t.via??[],t.button??0),c(d)}case"key":{const d=fOe(n,t);document.activeElement instanceof Node&&d.contains(document.activeElement)||wVe(d);const m=document.activeElement,g=m instanceof HTMLElement&&d.contains(m)?m:d;return g.dispatchEvent(bxt("keydown",t)),t.holdMs&&await new Promise(S=>setTimeout(S,t.holdMs)),g.dispatchEvent(bxt("keyup",t)),c(d)}case"select":{const d=_me(n,t.selector,t.index??0);if(!(d instanceof HTMLSelectElement))throw new Error(`${JSON.stringify(t.selector)} resolved a <${d.tagName.toLowerCase()}>, not a <select>. This verb sets a dropdown's value; a button or a checkbox takes \`click\`.`);return Vrn(d,t.value),c(d)}case"paste":{const d=fOe(n,t),m=new DataTransfer;return m.setData("text/plain",t.text),d.dispatchEvent(new ClipboardEvent("paste",{bubbles:!0,cancelable:!0,composed:!0,clipboardData:m})),c(d)}}}const Sxt="editor-chrome-root";function Wrn(t){return async n=>{const s={width:Math.max(1,Math.round(n.clientWidth*t)),height:Math.max(1,Math.round(n.clientHeight*t))};return await $tn(n,s)??a9t(n)}}async function Hrn(t,n){const s=document.getElementById(Sxt);if(!s)throw new Error(`The editor chrome root (#${Sxt}) is not mounted, so there is no editor page to photograph.`);let c=s;if(n?.region==="document"){const k=Pp(),A=k?cve(k):null;if(!A)throw new Error("No active document is showing, so there is no document region to photograph.");c=A}const d=n?.scale??window.devicePixelRatio??1,m=c.getBoundingClientRect(),g={width:Math.max(1,Math.round(m.width*d)),height:Math.max(1,Math.round(m.height*d))};return{...await GFt(c,{canvasFrame:Wrn(d),includeDocumentStyles:!0,size:g}),view:ote(t),size:g,scale:d}}function ste(){return ave()}function ESn(){return!ste()}const zge=new Set;function Grn(t,n){const s={collect:t,reusableKeys:n?.reusableKeys??[]};return zge.add(s),()=>{zge.delete(s)}}function Krn(t=null){const n={};for(const s of zge)Object.assign(n,s.collect(t));return n}function Xrn(){const t=[];for(const n of zge)t.push(...n.reusableKeys);return t}let zZ=null;const GI=[];function Yrn(t){if(zZ=t,GI.length!==0)for(const n of GI.splice(0,GI.length))n.resolve(t)}function Zrn(){return new Promise((t,n)=>{GI.push({resolve:t,reject:n})})}function Qrn(t){zZ===t&&(zZ=null,GI.length!==0&&queueMicrotask(()=>{if(!(zZ!==null||GI.length===0))for(const n of GI.splice(0,GI.length))n.reject(new Error("the hierarchy panel (GameHierarchy) unmounted before it published the mutated row tree, so the mutation cannot be acknowledged against a rendered tree. Open the Hierarchy panel in the workspace dock and retry."))}))}function xxt(){return zZ}function enn(t,n){const s=[],c=[];for(const d of t.rows){const m=tnn(d,t);for(;c.length>d.depth;)c.pop();const g=c.length>0?c[c.length-1]:void 0;if(g===void 0)s.push(m);else{const S=g.children;S===void 0?g.children=[m]:S.push(m)}c.push(m)}return{rowCount:t.rows.length,window:{start:t.window.start,end:t.window.end},...t.searchTerm?{search:t.searchTerm}:{},...t.scopeId?{scopeId:t.scopeId}:{},playState:n.playState,activeViewportTab:n.activeViewportTab,roots:s}}function tnn(t,n){const{node:s}=t;return t.more?{id:s.id,label:`… ${t.more.hidden} more`,depth:t.depth,childCount:0,internalChildCount:0,expandable:!1,more:{hidden:t.more.hidden}}:{id:s.id,label:s.label,...s.typeLabel===void 0?{}:{typeLabel:s.typeLabel},...s.role===void 0?{}:{role:s.role},depth:t.depth,childCount:s.childIds.length,internalChildCount:n.foldedInternalCount(s.id),expandable:t.hasChildren,...t.hasChildren?{expanded:n.isExpanded(t)}:{},...n.isInternal(s.id)?{internal:!0}:{},...n.isComponentRoot(s.id)?{componentRoot:!0}:{}}}const rnn=5e3,nnn=350,wxt=240;let a_e=null;function inn(t){if(typeof document>"u")return;const n=Pp(),s=n===null?null:cve(n),c=s?.closest(".volter-editor-theme")??document.querySelector(".volter-editor-theme")??document.body,d=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;if(s&&!d){const k=s.getBoundingClientRect(),A=document.createElement("div");A.dataset.testid="photograph-flash",Object.assign(A.style,{position:"fixed",left:`${k.left}px`,top:`${k.top}px`,width:`${k.width}px`,height:`${k.height}px`,background:"#ffffff",pointerEvents:"none",zIndex:"var(--volter-z-toast)"}),c.append(A),A.animate([{opacity:.85},{opacity:0}],{duration:nnn,easing:"ease-out"}).finished.finally(()=>A.remove())}a_e?.remove();const m=document.createElement("button");m.type="button",m.dataset.testid="photograph-notice",m.title="Photograph taken. Click to put it away.",m.setAttribute("aria-label","Photograph taken"),Object.assign(m.style,{position:"fixed",right:"var(--volter-space-4)",bottom:"40px",width:"220px",padding:"0",border:"1px solid var(--volter-selection-border)",borderRadius:"var(--volter-radius-md)",background:"var(--volter-surface-raised)",boxShadow:"var(--volter-shadow-lg)",overflow:"hidden",cursor:"pointer",zIndex:"var(--volter-z-toast)"});const g=document.createElement("img");g.src=`data:image/png;base64,${t}`,g.alt="The photograph just taken of the document",Object.assign(g.style,{display:"block",width:"100%",height:"auto"}),m.append(g),c.append(m),a_e=m;const S=()=>{if(a_e===m&&(a_e=null),!!m.isConnected){if(d){m.remove();return}m.animate([{transform:"translateX(0)"},{transform:"translateX(130%)"}],{duration:wxt,easing:"ease-in",fill:"forwards"}).finished.finally(()=>m.remove())}};m.addEventListener("click",S,{once:!0}),d||m.animate([{transform:"translateX(130%)"},{transform:"translateX(0)"}],{duration:wxt,easing:"ease-out"}),window.setTimeout(S,rnn)}const onn=new Set(["raw","url","worker","sharedworker","inline","init"]),snn=[".ts",".tsx",".js",".jsx",".mjs",".cjs"],ann=/\.stories\.[cm]?[jt]sx?$/i;function cnn(t){let n;try{n=new URL(t,"http://volter.invalid")}catch{return null}return{path:n.pathname,query:n.search}}function lnn(t){const n=new URLSearchParams(t);for(const s of n.keys())if(onn.has(s))return!0;return!1}function unn(t,n,s){if(t.startTime<s)return null;const c=cnn(t.name);if(!c)return null;const{path:d,query:m}=c;if(!d.includes(n)||!snn.some(A=>d.endsWith(A))||ann.test(d)||d.endsWith("/volter.adapter.ts")||lnn(m))return null;const g=new URLSearchParams(m),S=g.get(Rge)??"";g.delete(Rge);const k=g.toString();return{group:`${S}\0${d}`,path:d,url:`${d}${k?`?${k}`:""}`}}function fnn(t,n){const s=n.projectRoot.endsWith("/")?n.projectRoot.slice(0,-1):n.projectRoot;if(s.length===0)return[];const c=new Map;for(const m of t){const g=unn(m,s,n.since);if(!g)continue;const S=c.get(g.group);S===void 0?c.set(g.group,{path:g.path,urls:[g.url]}):S.urls.includes(g.url)||S.urls.push(g.url)}const d=[];for(const{path:m,urls:g}of c.values())g.length>1&&d.push({path:m,urls:g});return d}function kSn(t){return`Cross-root module split: ${t.path} was loaded ${t.urls.length} times in one mount, so each root holds its OWN copy of its module-level state (a \`let\` written by one root is invisible to the other). Urls: `+t.urls.join(" | ")}function d9t(){const t=globalThis.performance;if(!t||typeof t!="object")return null;const n=t;return typeof n.now!="function"||typeof n.getEntriesByType!="function"?null:n}let Gk=null,ZQ=[],VO=null,$B=[];function ASn(){$B=[],Gk?.disconnect(),Gk=null,ZQ=[];const t=d9t();if(!t){VO=null;return}VO=t.now(),typeof PerformanceObserver<"u"&&(Gk=new PerformanceObserver(n=>{ZQ.push(...n.getEntries())}),Gk.observe({type:"resource"}))}function DSn(t){const n=d9t();if(!n||VO===null)return VO=null,$B;const s=Gk?[...ZQ,...Gk.takeRecords()]:n.getEntriesByType("resource");return Gk?.disconnect(),Gk=null,ZQ=[],$B=fnn(s,{projectRoot:t,since:VO}),VO=null,$B}function dnn(){return $B}function PSn(){Gk?.disconnect(),Gk=null,ZQ=[],$B=[],VO=null}const QMe=new Set;let jY=null;function pnn(t){return QMe.add(t),()=>{QMe.delete(t)}}function _nn(){return jY||(jY=Promise.all([...QMe].map(t=>Promise.resolve().then(t))).then(()=>{}).finally(()=>{jY=null}),jY)}const mnn=500;function Txt(t){const n=globalThis,s=n.requestIdleCallback;if(typeof s=="function"){const d=s.call(globalThis,t,{timeout:mnn});return()=>n.cancelIdleCallback?.call(globalThis,d)}const c=setTimeout(t,0);return()=>clearTimeout(c)}const hme=new Map;function ISn(t,n){return hme.set(t,n),()=>{hme.get(t)===n&&hme.delete(t)}}function hnn(){return Object.fromEntries([...hme].map(([t,n])=>[t,n()]))}let p9t=null;function NSn(t){p9t=t}function gnn(){return p9t}const ynn=["three","canvas","dom"];function Cxt(t){return t.provenance?.source==="boundary"}function vnn(t){return ynn.includes(t)?t:null}function bnn(){const t=Lye(),n=TC()?.descriptor.provenance?.rootId,s=n?u0()?.regions.find(g=>g.id===n):void 0,c=t?.adapter&&n&&s?{worldId:n,surface:s.surface,adapter:t.adapter}:null,d=fPt();if(!d)return c?[c]:[];if(d instanceof hy){const g=d.childAdapters().filter(S=>S.role==="world"&&!Cxt(S.adapter)).map(S=>({worldId:S.worldId,surface:vnn(S.kind),adapter:S.adapter}));return c?[c,...g.filter(S=>S.worldId!==n)]:g}if(Cxt(d)||d===gnn())return c?[c]:[];const m={worldId:"root",surface:sve(),adapter:d};return c?[c,m]:[m]}const qB=new Map,eje=new Set;let _9t=0;function Ext(){_9t++;for(const t of eje)t()}function OSn(t){return qB.set(t.id,t),Ext(),()=>{qB.get(t.id)===t&&(qB.delete(t.id),Ext())}}function RSn(t){return t?qB.get(t)??null:null}function Snn(){return[...qB.values()]}function FSn(t){if(t===null)return null;for(const n of qB.values())if(n.kind==="game"&&n.instanceId===t)return n;return null}function MSn(t){return eje.add(t),()=>eje.delete(t)}function jSn(){return _9t}function TVe(t){return t.length===0?void 0:t.some(s=>s.hiddenBy===null)?null:[...t].sort((s,c)=>c.area-s.area)[0]?.hiddenBy??null}function xnn(t){return t.filter(n=>n.hiddenBy!==null).sort((n,s)=>s.area-n.area).map(n=>`${n.label} (${n.hiddenBy}, ${n.inlineHiding===null?"from an ancestor or a stylesheet":n.failsafeEligible?"its own inline style, unowned":"its own inline style, by a declared owner"}, ${Math.round(n.area)}px²)`)}function m9t(t){return t.filter(n=>n.failsafeEligible&&n.inlineHiding!==null)}function wnn(t){return t.some(n=>n.hiddenBy!==null)?m9t(t).length>0:null}const Tnn=4e3;function Cnn(t){const n=t.deadlineMs??Tnn;if(t.framesProduced<=0)return{fire:!1};if(t.hiddenForMs===null||t.hiddenForMs<n)return{fire:!1};if(TVe(t.canvases)===null)return{fire:!1};const s=[...m9t(t.canvases)].sort((c,d)=>d.area-c.area)[0];return s?{fire:!0,target:s,ledger:`canvas reveal FAILSAFE FIRED — the "${s.label}" canvas was still hidden by its own inline ${s.inlineHiding} (${s.hiddenBy}) ${Math.round(t.hiddenForMs/1e3)}s after frames started arriving, so the editor cleared that style to put the picture on screen. THIS IS A DEFECT, not a feature: the mount path that hid this canvas never ran its own reveal, and the failsafe fires ONCE — a second mount in this state stays blank. Report it upstream with the mount that owns this canvas.`}:{fire:!1}}const gme=new Map;function LSn(t){return gme.set(t.id,t),()=>{gme.get(t.id)===t&&gme.delete(t.id)}}function Enn(){return[...gme.values()]}const pOe=10,c_e=5e3;function knn(t){if(t.mode!=="edit")return{status:"ok",detail:"not in Edit mode — the invariant does not apply while playing"};if(t.loops===null)return{status:"unmeasured",detail:"nothing enumerated this session’s game loops",fix:"the session vitals collector must report a loop fact per live runtime (play, ingest, module)"};const n=t.designTimeSurfaces,s=[...t.loops.filter(S=>S.running).map(S=>S.name),...(n??[]).filter(S=>S.advanced===!0&&S.transportAdvanced!==!0).map(S=>`${S.label} (design-time surface)`)],c=(n??[]).filter(S=>S.advanced===!0&&S.transportAdvanced===!0);if(s.length>0)return{status:"violation",detail:`Edit mode, but content time is advancing in ${s.length} place(s): ${s.join(", ")}`,cause:`content time is advancing while the editor is in Edit: ${[...s].sort().join(", ")}`,missing:"authoring is happening on top of moving content: the thing under the gizmo moves while you edit it, a pose you are reading is a frame of an animation rather than what the source says, and every other instrument reports a still editor",fix:"one time policy at the shared viewport stack — presentation (orbit, turntable, dressing) keeps running while CONTENT time (mixers, useFrame, simulation) is held at design time"};const d=(n??[]).filter(S=>S.advanced===null),m=t.loops.map(S=>S.name).join(", ");if(n===null)return{status:"unmeasured",detail:`${t.loops.length} enumerated loop(s) stopped (${m}), but nothing enumerated this session's design-time surfaces`,fix:"the session vitals collector must enumerate the Object3DDocumentViewport stack’s live sessions"};if(d.length>0)return{status:"unmeasured",detail:`${t.loops.length} enumerated loop(s) stopped (${m}), and ${n.length-d.length} design-time surface(s) still — but ${d.length} publish no content clock: `+d.map(S=>`${S.label} (${S.unavailable??"no reason given"})`).join(", "),fix:"each design-time surface host must publish its own content clock (`Object3DDocumentSession.contentClock`) so this row can speak for it"};const g=c.length===0?"":`; ${c.length} advancing under an engaged transport (${c.map(S=>S.label).join(", ")})`;return{status:"ok",detail:`Edit is static — ${t.loops.length} enumerated loop(s) stopped (${m}), and ${n.length} design-time surface(s) hold their content time${g}`}}function Ann(t){return t.presentedThreeRoots===null?{status:"unmeasured",detail:"nothing enumerated which three roots this session presents",fix:"the session vitals collector must read the mounted roots off the active authoring surface"}:t.presentedThreeRoots.length<=1?{status:"ok",detail:`the scene presents ${t.presentedThreeRoots.length} three root(s)`}:{status:"violation",detail:`the scene presents ${t.presentedThreeRoots.length} three roots at once: ${t.presentedThreeRoots.join(", ")}`,cause:`the scene presents more than one three root: ${[...t.presentedThreeRoots].sort().join(", ")}`,missing:"a scene has ONE root by the authoring ontology — scenes swap inside it. Two presented at once means selection, framing and the gizmo are working over a tree no single document owns",fix:"declare one three root and swap SCENES inside it (ARCHITECTURE-CORE §Roots); a second world belongs behind its own document"}}function Dnn(t){return t.canvasHiddenBy===void 0?{status:"unmeasured",detail:"no canvas was found to measure",fix:"the session vitals collector must enumerate this session’s canvases before this can be checked"}:t.framesProduced===null?{status:"unmeasured",detail:"nothing sampled whether frames are being produced",fix:"the session vitals collector must run its frame sampler before this can be checked"}:t.canvasHiddenBy===null?{status:"ok",detail:"this session presents a revealed canvas"}:t.framesProduced===0?{status:"ok",detail:`every canvas is hidden (largest: ${t.canvasHiddenBy}) and nothing is drawing — not the failsafe's case`}:t.canvasHidesItself===!1?{status:"ok",detail:`every canvas is hidden but none is hiding ITSELF — the workspace is showing a non-canvas document, which is what the user opened: ${(t.hiddenCanvases??[]).join("; ")}`}:{status:"violation",detail:`${t.framesProduced} frame(s) produced in ${t.sampleWindowMs??0}ms while every canvas is hidden and one hides ITSELF: ${(t.hiddenCanvases??[]).join("; ")}`,cause:`frames are being produced while every canvas is hidden and one hides itself (${t.canvasHiddenBy})`,missing:"the session is burning frames onto a surface nobody can see — the user is looking at an empty viewport while every instrument reports a healthy, rendering session",fix:"reveal the canvas as soon as it produces frames — the bounded failsafe in `coverage/canvas-reveal.ts` does it for inline hiding on the canvas itself and says so loudly; hiding from an ancestor or a stylesheet is its owner’s to undo"}}function Pnn(t){return t.directManipulationExpected===!1?{status:"ok",detail:"browser automation is rendering evidence — no person is waiting on direct manipulation"}:t.tabVisible?t.fps===null?{status:"unmeasured",detail:t.fpsUnavailable??"no frame-rate sample exists",fix:"the session vitals collector must sample frame cadence while the tab is visible"}:t.fps>=pOe?{status:"ok",detail:`visible tab rendering at ${t.fps.toFixed(1)}fps`}:{status:"violation",detail:`visible tab rendering at ${t.fps.toFixed(1)}fps, below the ${pOe}fps floor`,cause:`the visible tab is rendering below the ${pOe}fps floor`,missing:"the editor has stopped being a direct-manipulation tool: a drag, a click and a keystroke all land seconds after the user made them",fix:"find the cost with the Profiler’s Overview (long-animation-frame attribution) — main-thread saturation and GPU/compositor cost are separate hunts"}:{status:"ok",detail:"the tab is hidden — a hidden tab is not owed a frame rate"}}function Inn(t){return t.play===null?{status:"ok",detail:"nothing is playing — the invariant does not apply"}:t.tabVisible?t.play.framesDrawn===null?{status:"unmeasured",detail:t.play.framesUnavailable??"the play session reports no frame count, so nothing can say whether it drew",fix:"the play session’s render loop must expose a frame count (its profiler source carries one only while telemetry is enabled)"}:t.play.framesDrawn>0?{status:"ok",detail:`play has drawn ${t.play.framesDrawn} frame(s)`}:t.play.startedMsAgo<c_e?{status:"ok",detail:`play started ${t.play.startedMsAgo}ms ago and has not drawn yet — inside the ${c_e}ms deadline`}:{status:"violation",detail:`play started ${t.play.startedMsAgo}ms ago and has drawn no frame (deadline ${c_e}ms)`,cause:`play started and no frame has drawn within the ${c_e}ms deadline`,missing:"the user pressed ▶ and the game is not running: the viewport shows whatever was there before, and every other instrument reports a live play session",fix:"find why the run loop never rendered — the console’s own errors from the play session are the first read"}:{status:"ok",detail:"the tab is hidden — the engine hidden-pauses the loop, so no frame is owed"}}const h9t={"edit-mode-static":knn,"single-root-scene":Ann,"canvas-revealed":Dnn,"visible-tab-fps-floor":Pnn,"play-drew-a-frame":Inn},Nnn=Object.keys(h9t);function Onn(t){return Nnn.map(n=>({id:n,...h9t[n](t)}))}function Rnn(t){if(t.status!=="violation")return null;const n=[`invariant "${t.id}" VIOLATED — ${t.cause??t.id}`];return t.missing&&n.push(` cost: ${t.missing}`),t.fix&&n.push(` fix: ${t.fix}`),n.join(`
1397
- `)}const tje=new Set;function Fnn(t){return tje.add(t),()=>{tje.delete(t)}}function Mnn(){for(const t of[...tje])try{t()}catch(n){Qs.error(`a session-sample subscriber threw: ${String(n)}`,"invariant")}}const jnn=5e3;let Aw={frames:0,since:0},VZ=null,zB=null,oR=null;const UZ=new Map;function Lnn(t){const n=window.getComputedStyle(t);if(n.display==="none")return"display: none";if(n.visibility==="hidden")return"visibility: hidden";if(Number.parseFloat(n.opacity||"1")===0)return"opacity: 0";const s=t.getBoundingClientRect();return s.width<=0||s.height<=0?"zero-size box":null}const Bnn="editor-canvas";function $nn(t){const n=t.style;return n.display==="none"?"display":n.visibility==="hidden"?"visibility":n.opacity!==""&&Number.parseFloat(n.opacity)===0?"opacity":null}function g9t(){return[...document.querySelectorAll("canvas")].map((n,s)=>{const c=n.getAttribute("data-testid"),d=n.getBoundingClientRect();return{label:c??(n.className||`canvas #${s}`),area:Math.max(0,d.width)*Math.max(0,d.height),hiddenBy:Lnn(n),inlineHiding:$nn(n),failsafeEligible:c!==Bnn&&!n.closest(".monaco-editor")}})}function qnn(){const t=Snn();if(t.length===0)return{framesDrawn:null,framesUnavailable:"no render loop registered a performance source, so nothing counts this session’s frames"};let n=null;for(const s of t){const d=s.profiler.getSnapshot().frames.at(-1);d&&(n=Math.max(n??0,d.id))}return n===null?{framesDrawn:null,framesUnavailable:"the registered render loop records no frames (its profiler has neither profiling nor telemetry enabled)"}:{framesDrawn:n,framesUnavailable:null}}const PO=new Map,LY=new Map;function znn(){const t=Enn(),n=new Set,s=t.map(c=>{const{id:d,label:m}=c;n.add(d);let g=null;try{g=c.transportAdvances?.()??null}catch{g=null}const S=LY.get(d);g===null?LY.delete(d):LY.set(d,g);const k=g===null||S===void 0?{}:{transportAdvanced:g!==S};let A;try{A=c.contentClock()}catch(J){return PO.delete(d),{id:d,label:m,advanced:null,unavailable:`its content clock threw: ${String(J)}`,...k}}if(A===null)return PO.delete(d),{id:d,label:m,advanced:null,unavailable:"its content clock is temporarily unavailable",...k};const F=A,D=PO.get(d);return PO.set(d,F),D===void 0?{id:d,label:m,advanced:null,unavailable:"first reading — nothing to compare it against yet",...k}:{id:d,label:m,advanced:F!==D,...k}});for(const c of[...PO.keys()])n.has(c)||PO.delete(c);for(const c of[...LY.keys()])n.has(c)||LY.delete(c);return s}function Vnn(t=Date.now()){const n=ste(),s=Aw.since===0?0:t-Aw.since,c=Aw.frames,d=s>0&&c>0?c*1e3/s:null,m=n?{startedMsAgo:oR===null?0:t-oR,...qnn()}:null;return{mode:n?"play":"edit",loops:[...YMe().map(g=>({name:`${g.id} session`,running:g.mounted()})),...YMe().map(g=>({name:`${g.id} playing`,running:g.playing()}))],designTimeSurfaces:znn(),presentedThreeRoots:fPt()?bnn().filter(g=>g.surface==="three").map(g=>g.worldId):null,...(()=>{const g=g9t();return{canvasHiddenBy:TVe(g),canvasHidesItself:wnn(g),hiddenCanvases:xnn(g)}})(),framesProduced:Aw.since===0?null:c,sampleWindowMs:Aw.since===0?null:s,tabVisible:!document.hidden,directManipulationExpected:navigator.webdriver!==!0,fps:d,fpsUnavailable:d===null?Aw.since===0?"the frame sampler has not opened a window yet":"no frame was produced in the sample window":null,play:m}}function y9t(){return Onn(Vnn())}let mB=null;const kxt=new WeakSet;function Unn(t,n){const s=TVe(t);if(s==null){mB=null;return}if(mB===null){mB=n;return}const c=Cnn({canvases:t,framesProduced:Aw.frames,hiddenForMs:n-mB});if(!c.fire)return;const d=[...document.querySelectorAll("canvas")].find(m=>(m.getAttribute("data-testid")??m.className)===c.target.label);!d||kxt.has(d)||(kxt.add(d),c.target.inlineHiding==="display"&&d.style.removeProperty("display"),c.target.inlineHiding==="visibility"&&d.style.removeProperty("visibility"),c.target.inlineHiding==="opacity"&&d.style.removeProperty("opacity"),Qs.error(c.ledger,"invariant"))}function Jnn(){const t=y9t();for(const n of t){const s=Rnn(n);if(!s){UZ.delete(n.id);continue}if(n.id==="visible-tab-fps-floor"){const c=(UZ.get(n.id)??0)+1;if(UZ.set(n.id,c),c<3)continue}Qs.warn(s,"invariant")}return t}function Wnn(){if(zB!==null)return Axt;Aw={frames:0,since:Date.now()};const t=()=>{Aw.frames++,VZ=requestAnimationFrame(t)};return VZ=requestAnimationFrame(t),zB=setInterval(()=>{const n=ste();n&&oR===null&&(oR=Date.now()),n||(oR=null),Mnn(),Unn(g9t(),Date.now()),Jnn(),Aw={frames:0,since:Date.now()}},jnn),Axt}function Hnn(){Aw={frames:0,since:zB===null?0:Date.now()},oR=null,mB=null,UZ.clear(),PO.clear()}function Axt(){VZ!==null&&cancelAnimationFrame(VZ),zB!==null&&clearInterval(zB),VZ=null,zB=null,Aw={frames:0,since:0},oR=null,mB=null,UZ.clear()}let rje=null;function Gnn(t){rje=t}function CVe(){return rje?(rje(),!0):!1}let EVe=[];const nje=new Set;function Dxt(t){EVe=t;for(const n of nje)n()}function Knn(){return EVe}function Xnn(t){return nje.add(t),()=>nje.delete(t)}function Ynn(t){const n=EVe.find(s=>s.id===t);return n?(n.run(),!0):!1}let QQ=null;function Znn(t){QQ=t}function Qnn(t){QQ&&Promise.resolve(QQ(`${t}.focus`)).catch(()=>{})}const ein=/^volter\.([^.]+)\.(.+)$/;async function tin(t,n){if(QQ)return await QQ(t,n);const s=ein.exec(t);if(!s)throw new Error(`No command "${t}". Without the Code-OSS frame there is no command service, so the only commands this editor answers are a view's own verbs, spelled volter.<view>.<verb> (for example volter.blender-node-view.view-all).`);const{invokeViewVerb:c}=await lo(async()=>{const{invokeViewVerb:d}=await Promise.resolve().then(()=>p4r);return{invokeViewVerb:d}},[]);return c(s[1],s[2],n)}const kVe=[{kind:"agent",title:"Conversations",hotkeyScope:"workspace",selectableText:!0,icon:"users"},{kind:"project-work",title:"Project work",hotkeyScope:"workspace",selectableText:!0,icon:"list"},{kind:"hierarchy",title:"Hierarchy",hotkeyScope:"hierarchy",selectableText:!1,region:"outliner",icon:"outliner"},{kind:"assets",title:"Content",hotkeyScope:"asset-browser",selectableText:!1,icon:"folder-open"},{kind:"asset-library",title:"Asset Library",hotkeyScope:"asset-browser",selectableText:!1,icon:"cubes-stacked"},{kind:"inspector",title:"Inspector",hotkeyScope:"inspector",selectableText:!1,region:"properties",icon:"properties"}];async function rin(t){const{liveCanvasFrame:n}=await lo(async()=>{const{liveCanvasFrame:s}=await Promise.resolve().then(()=>grn);return{liveCanvasFrame:s}},void 0);return n(t)}async function nin(...t){const{capturePlayComposite:n}=await lo(async()=>{const{capturePlayComposite:s}=await Promise.resolve().then(()=>drn);return{capturePlayComposite:s}},void 0);return n(...t)}async function Pxt(){return lo(()=>Promise.resolve().then(()=>ZDt),void 0)}async function iin(){return lo(()=>Promise.resolve().then(()=>ocn),void 0)}function oin(t,n=5e3){return bC().some(s=>s.id===t)?Promise.resolve():new Promise(s=>{let c=0,d=()=>{};const m=()=>{clearTimeout(c),d(),s()};d=Xye(()=>{bC().some(g=>g.id===t)&&m()}),bC().some(g=>g.id===t)?m():c=window.setTimeout(m,n)})}async function sin(t){if(t){if(!bC().some(n=>n.id===t)){const n=t.startsWith(Mme);if(n&&(await(await Pxt()).refreshProjectToolContributions(),await oin(t)),!bC().some(s=>s.id===t)){const s=bC().map(d=>d.id),c=n?(await Pxt()).contributionFailureHint(t.slice(Mme.length)):"";throw new Error(`Utility is not registered: ${t}.`+c+` Registered utilities: ${s.length>0?s.join(", "):"(none)"}. A project contributes one by exporting a \`workspace.utility\` tool contribution; its view id is \`tool:<contribution-id>\`.`)}}vC(t)}}async function v9t(t){const n=kVe.map(c=>c.kind),s=n.find(c=>c===t);if(!s)throw new Error(`"${t}" is not a panel of this editor. Panels: ${n.join(", ")}.`);if($Be(s),!await CC(()=>oDt()===s))throw new Error(`The ${s} panel is not in this workspace's layout, so it could not be focused. Panels: ${n.join(", ")}.`);return s}function ain(t,n){if(X0("workspace:scene"))return"workspace:scene";const s=l0().map(c=>c.descriptor.id);throw new Error(`This session has no Scene document open. Open documents: ${s.join(", ")||"none"}; address one as { kind: "workspace", id }.`)}async function cin(t){let n=!1;if(await CC(()=>(n=VMe(t.id),n||fxt(t.id)!==null),PR),n)return Pp();const s=fxt(t.id);throw s?new Error(s):new Error(`World document is not registered: ${t.id}`)}async function lin(t,n){const s=g=>g.filter(S=>S.id===n||S.label===n);let c=[];if(!await CC(()=>{const g=pBe(t)?.adapter?.stories;if(!g)return!1;c=g.storiesFor("");const S=s(c);return S.length===1?(g.apply(S[0].id,S[0].id),!0):c.length>0},PR))throw new Error(`The board mounted no stories provider within the wait window; story ${JSON.stringify(n)} was not applied.`);const m=s(c);if(m.length!==1)throw new Error(m.length===0?`No story matches ${JSON.stringify(n)}. This board's stories: ${c.map(g=>g.label).join(", ")||"(none)"}.`:`${JSON.stringify(n)} is ambiguous (${m.length} stories match) — use the story id: ${m.map(g=>g.id).join(" | ")}`)}async function uin(t,n){const s=await Yye(n.kind,t,n);if(s!==null)return s;let c=!1;if(await CC(()=>(c=SN(n.id)||X0(n.id),c||dxt(n.id)!==null),PR),c)return n.story!==void 0&&await lin(n.id,n.story),n.id;const d=dxt(n.id);throw d?new Error(d):new Error(`Workspace document is not available: ${n.id}`)}async function fin(t,n){const s=await Yye(n.kind,t,n);if(s===null){const{kind:c,...d}=n,m=bkr();throw new Error(`Nothing in this editor can open a '${c}' document (${JSON.stringify(d)}). Either no package registered an opener for that view address, or the subject does not exist. Registered view addresses: ${m.length>0?m.join(", "):"(none)"}.`)}return s}function din(t){const n=nkr();return n===null?"":n.includes(t)?`"${t}" is a kind in this project's document table, not an address — a document opens in the editor registered for its KIND, so address it as { kind: "document", id: "<that table entry's id>" }.`:n.length===0?"":`This project's document table holds ${n.map(s=>`"${s}"`).join(", ")}; each opens as { kind: "document", id: "<the table entry's id>" }.`}async function pin(t,n){if(!n)return Pp();if(!mvr(n.kind))throw new Error(`present-view does not know the document kind "${String(n.kind)}". An EditorView addresses a document by one of: ${iCt.join(", ")}. `+din(String(n.kind)));switch(n.kind){case"scene":return ain();case"world":return cin(n);case"asset":case"tool":case"document":case"story":case"project-tool":case"generation":return fin(t,n);case"workspace":return uin(t,n)}}function _in(t){const n=t.indexOf(",");return{base64:n>=0?t.slice(n+1):t,mimeType:"image/png"}}const Ixt=cve;function min(t,n,s){if(!s?.degenerate)return null;const c=pVe();return!c||!n.contains(c)?null:`This door photographs the "${t}" document, which for a live three ingest holds the GAME'S own canvas — created without \`preserveDrawingBuffer\`, so its pixels can only be read from inside the game's own render pass. This game did not draw inside that window (a render-on-demand world sitting idle, or a loop the Edit-tab input gate has frozen), so the frame came back BLANK (${s.warning??"essentially one flat colour"}) — a PNG that reads as a real image. The editor's own renderer is drawing this same world in the Scene viewport (the mount adopts the captured scene), so capture \`workspace:scene\` instead — or drive the game until it renders and ask again.`}async function b9t(t,n){const s=TC();if(!s)throw new Error("No active editor document to capture.");const{descriptor:c,title:d}=s,m=ote(t),g={id:c.id,title:d,kind:c.kind,...c.provenance?.sourcePath?{sourcePath:c.provenance.sourcePath}:{},...c.provenance?.rootId?{rootId:c.provenance.rootId}:{}},S=s2(c.id);if(S?.capture){const J=S.capture(n);if(!J)throw new Error(`Object3D document could not be captured: ${c.id}`);return{..._in(J),document:g,view:m,source:"object3d-document"}}const k=c.id===a0?o9t()??Ixt(c.id):Ixt(c.id);if(!k)throw new Error(`Active document surface is not mounted: ${c.id}`);const A=l9t(k),F=await nin(A?.container??k,{canvasFrame:A?.canvasFrame??rin,includeDocumentStyles:c.id!==a0&&!A}),D=min(c.id,k,F.flatness);if(D)throw new Error(D);return{base64:F.base64,mimeType:F.mimeType,document:g,view:m,source:c.id===a0?"game-composite":c.id==="workspace:scene"?"scene-viewport":"document-composite",layers:F.layers,...F.flatness?{flatness:F.flatness}:{}}}const hin="workspace:scene";function gin(t){return s2(t)??s2(hin)}function yin(t,n,s,c){const d=s2(n),m=gin(n);s.selection&&(d?.selection?d.selection.apply(s.selection.ids):t.selectMultiple(s.selection.ids));const g=s.viewport;g?.grid!==void 0&&(n&&F_e(n)?CAr(n,g.grid):c.push("This document draws no grid.")),g?.diagnostic&&!m?.setDiagnostic(g.diagnostic)&&c.push(`Diagnostic ${g.diagnostic} is unavailable for this document.`),g?.camera&&!m?.setCamera(g.camera)&&c.push(typeof g.camera=="string"?`${g.camera==="isometric"?"Isometric":g.camera} camera is unavailable for this document.`:"The camera is unavailable for this document."),s.selection?.focus||g?.frame==="selection"?m?.frame("selection")||c.push("The requested selection could not be framed."):g?.frame==="document"&&(m?.frame("document")||c.push("Document framing is unavailable for this document."))}async function Vge(t,n,s={}){if(n?.version!==1)throw new Error("present-view requires EditorView version 1.");const c=Object.keys(n).filter(F=>!Omt.includes(F));if(c.length>0)throw new Error(`present-view does not know ${c.map(F=>`"${F}"`).join(", ")}. An EditorView carries: ${Omt.join(", ")}. A document's own address (kind, and the fields that kind reads) goes under "document".`);const d=ote(t);if(n.style!==void 0){const F=OR().map(D=>D.id);if(!F.includes(n.style))throw new Error(`present-view requires a style of ${F.join(", ")}, got ${String(n.style)}.`);ZBe(n.style)}if(n.workspace!==void 0){if(!kB(n.workspace))throw new Error(`present-view requires a workspace of ${JBe().join(", ")}, got ${String(n.workspace)}.`);if(zS()!==n.workspace){const F=SDt();a2(n.workspace),await Promise.race([F,new Promise(D=>setTimeout(D,3e3))])}}const m=[];n.keymap!==void 0&&n.keymap!==dR()&&m.push(`Keymap "${n.keymap}" was not applied — a view reports the keymap, it does not set it. This project is on "${dR()}" (its adapter's declaration, or its own settings).`);const g=await pin(t,n.document);await sin(n.utility);const S=s2(g);if(await S?.prepare?.(),!S?.selection&&n.selection?.ids.length&&(n.document?.kind==="scene"||n.document?.kind==="world")){const F=n.selection.ids;if(!await CC(()=>F.every(J=>Y0(t).hierarchy.node(J)!==null),PR))throw new Error(`Shared view selection is not available: ${F.join(", ")}`)}g&&Pp()!==g&&X0(g),yin(t,g,n,m),n.panel!==void 0&&await v9t(n.panel);const k=sCt(n,window.location.href);s.updateUrl!==!1&&window.history.replaceState(window.history.state,"",k);const A={view:n,url:k,warnings:m};return(s.origin??"agent")==="agent"&&(await iin()).showEditorPresentationNotice({presented:A,previousView:d}),A}const Uge=new Map;let S9t=0;const ije=new Set;function x9t(){S9t+=1;for(const t of ije)t()}function vin(t,n,s){const c=Uge.get(t);c&&c.assetPath===n&&c.actions.length===s.length&&c.actions.every((d,m)=>d===s[m])||(Uge.set(t,{assetPath:n,actions:s}),x9t())}function bin(t){Uge.delete(t)&&x9t()}function Sin(t){const n=[];for(const s of Uge.values())s.assetPath===t&&n.push(...s.actions);return n}function xin(t){return ije.add(t),()=>ije.delete(t)}function Nxt(){return S9t}const win=[],Oxt=new Set;let Tin=0;function Cin(t){for(const n of win)if(n.match(t))return n;return null}function Ein(t){return Oxt.add(t),()=>{Oxt.delete(t)}}function Rxt(){return Tin}const O_={open:{id:"project-asset.open",shortcut:"Enter"},rename:{id:"project-asset.rename",shortcut:"F2"},move:{id:"project-asset.move",shortcut:null},duplicate:{id:"project-asset.duplicate",shortcut:"Mod+D"},delete:{id:"project-asset.delete",shortcut:"Delete"},copyPath:{id:"project-asset.copy-path",shortcut:"Mod+Shift+C"},reveal:{id:"project-asset.reveal",shortcut:null},refresh:{id:"project-asset.refresh",shortcut:"Mod+R"},import:{id:"project-asset.import",shortcut:null},createFolder:{id:"project-asset.create-folder",shortcut:"Mod+Shift+N"}},eD=[],oje=new Set,BY=new Map;let w9t=0;function _Oe(){w9t++;for(const t of oje)t()}function kin(t){const n=eD.findIndex(s=>s.owner===t.owner&&s.id===t.id);if(n>=0){const[s]=eD.splice(n,1);s&&(BY.get(s)?.(),BY.delete(s))}return eD.push(t),eD.sort((s,c)=>(s.order??0)-(c.order??0)),BY.set(t,t.subscribe(_Oe)),_Oe(),()=>{const s=eD.indexOf(t);s<0||(eD.splice(s,1),BY.get(t)?.(),BY.delete(t),_Oe())}}const Ain=[];function Din(){return eD.length===0?Ain:eD}function T9t(t){return oje.add(t),()=>{oje.delete(t)}}function Jge(){return w9t}function C9t(t){for(const n of eD){const s=n.entries({components:[t],surface:null})[0];if(s)return{source:n,entry:s}}return null}function Pin(){const t=X0e();return t?{path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}}:null}function Iin(t,n){return Ye.useEffect(()=>()=>bin(t),[t]),Ye.useCallback(s=>{n!==null&&vin(t,n,s)},[t,n])}function Nin({id:t,title:n,file:s,tool:c,Component:d}){Ye.useSyncExternalStore(K0e,qQ),Ye.useSyncExternalStore(Dye,cN,cN),Ye.useSyncExternalStore(Fye,lN,lN);const m=Pin(),g=Iin(t,m?.path??null),S=Ye.useRef(null),k=Ye.useCallback(F=>{S.current?.(),S.current=F===null?null:ABe(`building ${F.replace(/^building /,"")}`)},[]);Ye.useEffect(()=>()=>S.current?.(),[]);const A=Ye.useCallback(F=>s$({...F,id:`contribution:${t}:${F.title}`,...F.tone==="warning"?{fades:!0}:{}}),[t]);return q.jsxs("div",{"data-testid":`asset-inspector-tool-${t}`,style:{padding:8,borderTop:"1px solid var(--volter-structural-divider)",marginTop:4},children:[q.jsxs("div",{style:{...WCr,marginBottom:4},children:[q.jsx(dc,{icon:Kk.tool.extension,tone:"muted",style:{marginRight:4}}),n]}),q.jsx(DBe,{file:s,children:q.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:e0e(),surfaces:mBe,account:rBe(),play:Rye(),asset:m,setActions:g,notify:A,work:k})})]})}function Oin(t,n){if(n<=0)return[];if(t.length===0)return Array.from({length:n},()=>0);const s=new Array(n),c=t.length/n;let d=0;for(let m=0;m<n;m++){const g=Math.floor(m*c),S=Math.max(g+1,Math.floor((m+1)*c));let k=0;for(let A=g;A<S;A++)k=Math.max(k,Math.abs(t[A]??0));s[m]=k,d=Math.max(d,k)}return d<=1e-8?s.fill(0):s.map(m=>m/d)}const E9t=32,sje=new Set,Fxt=new Map,Mxt=new Map;let sR=null,JZ=null,k9t=0,aje=0,VB=0,xN=0,jxt=!1,pD={url:null,progress:0,playing:!1};function Rin(){for(const t of sje)t()}function I$(t){pD.url===t.url&&pD.playing===t.playing&&Math.abs(pD.progress-t.progress)<.002||(pD=t,Rin())}function AVe(){return sR??=new AudioContext,sR}function Fin(){if(jxt||typeof window>"u")return;jxt=!0;const t=()=>{if(!sR)return;const n=pD.url,s=xN;sR.resume().then(()=>{n&&s===xN&&!JZ&&sR?.state==="running"&&P9t(n,s)})};window.addEventListener("pointerdown",t,{capture:!0}),window.addEventListener("keydown",t,{capture:!0})}function DVe(){if(VB&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(VB),VB=0,!JZ)return;const t=JZ;JZ=null,t.onended=null;try{t.stop()}catch{}t.disconnect()}function A9t(){if(VB=0,!pD.playing||!sR||aje<=0)return;const t=Math.min(1,(sR.currentTime-k9t)/aje);I$({url:pD.url,progress:t,playing:t<1}),t<1&&typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(A9t))}function Min(t,n,s){if(s!==xN)return;DVe();const c=AVe(),d=c.createBufferSource(),m=c.createGain();m.gain.value=1,d.buffer=t,d.connect(m),m.connect(c.destination),d.onended=()=>{s===xN&&I$({url:n,progress:1,playing:!1})},d.start(),JZ=d,k9t=c.currentTime,aje=t.duration,I$({url:n,progress:0,playing:!0}),typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(A9t))}async function D9t(t){const n=Fxt.get(t);if(n)return n;const s=(async()=>{const c=await fetch(t);if(!c.ok)throw new Error(`Audio preview could not read ${t}.`);const d=await c.arrayBuffer();return AVe().decodeAudioData(d.slice(0))})().catch(()=>null);return Fxt.set(t,s),s}async function P9t(t,n){Fin();const s=await D9t(t);if(n!==xN)return;if(!s){I$({url:t,progress:0,playing:!1});return}const c=AVe();c.state==="suspended"&&(await c.resume(),n!==xN)||c.state==="running"&&Min(s,t,n)}function jin(t){return sje.add(t),()=>sje.delete(t)}function Lin(){return pD}function Bin(t){const n=++xN;DVe(),I$({url:t,progress:0,playing:!0}),P9t(t,n)}function $in(t){t&&pD.url!==t||(xN+=1,DVe(),I$({url:null,progress:0,playing:!1}))}function qin(t,n=E9t){const s=`${t}#${n}`,c=Mxt.get(s);if(c)return c;const d=D9t(t).then(m=>m?Oin(m.getChannelData(0),n):Array.from({length:n},()=>0));return Mxt.set(s,d),d}let _Z=[];function BSn(t){return _Z=[..._Z,t],()=>{_Z=_Z.filter(n=>n!==t)}}function I9t(t){return _Z.find(n=>n.accepts(t))??null}const PVe={folder:"var(--volter-asset-icon-folder)",model:"var(--volter-asset-icon-model)",prefab:"var(--volter-asset-icon-prefab)",component:"var(--volter-asset-icon-component)",audio:"var(--volter-asset-icon-audio)",image:"var(--volter-asset-icon-image)",video:"var(--volter-asset-icon-video)",json:"var(--volter-asset-icon-json)",unknown:"var(--volter-asset-icon-unknown)",source:"var(--volter-asset-icon-source)"},zin={folder:uee,model:$0r,prefab:GB,component:sLe,audio:lLe,image:D0r,video:L0r,json:fLe,unknown:zTt,source:rCt};function vD({kind:t,size:n=24}){return q.jsx(dc,{icon:zin[t],style:{fontSize:n,color:PVe[t]}})}const Vin=100,Uin=50,Jin=new YPt(t=>{const n=I9t(t);return n?n.render(t):Promise.reject(new Error(`No model preview loader for ${t}.`))},2);function N9t(t,n){const[s,c]=Ye.useState(null),[d,m]=Ye.useState(!1),[g,S]=Ye.useState(null),[k,A]=Ye.useState(!1);Ye.useEffect(()=>{c(null),m(!1),S(null),A(!1)},[t]),Ye.useEffect(()=>{let D=!1,J=null;return C$e().then($=>{if(D)return;const G=$.status==="ok"?$.manifest.entries[t.replace(/^\/+/,"")]:void 0;if(!k&&G?.path&&(G.state==="generated"||G.state==="upstream")){S(G.path.startsWith("/")?G.path:`/${G.path}`);return}return J=Jin.request(t,n),J.promise}).then($=>{!D&&$&&c($)}).catch(()=>{D||m(!0)}),()=>{D=!0,J?.cancel()}},[k,n,t]);const F=Ye.useCallback(()=>{S(null),A(!0)},[]);return{src:g??s,fromManifest:g!==null,failed:d,rejectManifest:F}}function O9t({url:t}){const n=N9t(t,Vin);return n.failed?q.jsx(vD,{kind:"model"}):n.fromManifest&&n.src?q.jsx("img",{src:n.src,alt:"cached model preview",onError:n.rejectManifest,style:{width:"100%",height:"100%",objectFit:"contain"}}):n.src?q.jsx("img",{src:n.src,alt:"model preview",style:{width:"100%",height:"100%",objectFit:"contain"}}):q.jsx("div",{style:{width:28,height:28,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center"},children:q.jsx("div",{className:"volter-anim-spin",style:{width:16,height:16,border:`2px solid ${ahe[2]}`,borderTopColor:PVe.model,borderRadius:"50%"}})})}function Win({url:t,name:n}){const[s,c]=Ye.useState(()=>Array.from({length:E9t},()=>.15)),d=Ye.useSyncExternalStore(jin,Lin);Ye.useEffect(()=>{let S=!1;return qin(t).then(k=>{S||c(k)}),()=>{S=!0}},[t]);const m=d.url===t,g=m?d.progress:0;return q.jsx("div",{role:"img","aria-label":`${n} waveform preview`,style:{display:"flex",alignItems:"center",gap:1,width:"86%",height:"62%"},children:s.map((S,k)=>{const A=k/s.length<=g;return q.jsx("i",{style:{flex:1,height:`${12+S*88}%`,background:"var(--volter-asset-icon-audio)",opacity:m&&A?1:.28,borderRadius:1}},k)})})}function wR({kind:t,name:n,variant:s="tile"}){const c=PVe[t],d=s==="cell";return t==="audio"?q.jsxs("svg",{role:"img","aria-label":`${n} waveform preview`,viewBox:"0 0 64 48",width:d?"78%":52,height:d?"78%":44,children:[q.jsx("rect",{width:"64",height:"48",rx:"4",fill:"var(--volter-bg-inset)"}),Array.from({length:16},(m,g)=>q.jsx("rect",{x:g*4+1,y:24-g*13%18/2,width:"2",height:g*13%18+3,fill:c},g))]}):q.jsxs("svg",{role:"img","aria-label":`${n} ${t} preview`,viewBox:"0 0 52 48",width:d?"66%":48,height:d?"72%":44,children:[q.jsx("rect",{x:"5",y:"3",width:"42",height:"42",rx:"4",fill:"var(--volter-bg-inset)",stroke:c}),q.jsx("path",{d:"M13 15h26M13 23h18M13 31h22",stroke:c,strokeWidth:"3",strokeLinecap:"round"})]})}function R9t(t,n,s,c){if(t<=0||n<=0||s<=0||c<=0)return 1;const d=t<=s?Math.floor(s/t):0,m=n<=c?Math.floor(c/n):0,g=Math.min(d,m);return g>=1?g:1/Math.max(Math.ceil(t/s),Math.ceil(n/c))}function $Sn(t,n,s,c,d){return t==="fit"?R9t(n,s,c,d):t}function Hin(t,n,s){const c=Math.max(1,s.sourceWidth??s.width),d=Math.max(1,s.sourceHeight??s.height);t.width=c,t.height=d;const m=t.getContext("2d");if(!m)return;m.imageSmoothingEnabled=!1,m.clearRect(0,0,c,d);const g=eZr(s);if(s.rotated){m.save(),m.translate(s.trimX,s.trimY+g.width),m.rotate(-Math.PI/2),m.drawImage(n,g.x,g.y,g.width,g.height,0,0,g.width,g.height),m.restore();return}m.drawImage(n,g.x,g.y,g.width,g.height,s.trimX,s.trimY,g.width,g.height)}function F9t({sheetUrl:t,frame:n,scale:s,maxEdge:c}){const d=Ye.useRef(null),m=Math.max(1,n.sourceWidth??n.width),g=Math.max(1,n.sourceHeight??n.height),S=c!=null?R9t(m,g,c,c):s??1,k=Math.max(1,Math.round(m*S)),A=Math.max(1,Math.round(g*S));return Ye.useEffect(()=>{const F=d.current;if(!F)return;const D=new Image;let J=!1;return D.onload=()=>{J||Hin(F,D,n)},D.src=t,()=>{J=!0}},[n,t]),q.jsx("canvas",{ref:d,width:m,height:g,"aria-hidden":!0,style:{width:k,height:A,imageRendering:"pixelated",display:"block"}})}const M9t={fontSize:11,color:Zf[3],marginBottom:2},Gin={fontSize:11,color:Zf[1],wordBreak:"break-all"};function mOe({asset:t}){Ye.useSyncExternalStore(u2,rA,rA);const n={path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}};return qDt().map(s=>{let c=!1;try{c=s.match(n)}catch(d){console.error(`[tool contributions] ${s.file}'s asset match() threw.`,d)}return c?q.jsx(Nin,{id:s.id,title:s.title,file:s.file,tool:s.tool,Component:s.Component},`${s.id}:${s.version}`):null})}function Lxt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ph({label:t,value:n}){return q.jsxs("div",{children:[q.jsx("div",{style:M9t,children:t}),q.jsx("div",{style:Gin,children:n})]})}function Kin({asset:t}){const n=t.capabilities?.editor==="environment";Ye.useSyncExternalStore(T9t,Jge,Jge);const s=t.componentPreview,c=s?C9t({name:t.name,path:s.sourcePath,surface:s.surface}):null;return q.jsx("div",{"data-testid":"inspector-asset-preview",style:{position:"absolute",inset:0,background:SBe.inset,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:c?q.jsx(c.source.Thumbnail,{entry:c.entry,previewRevision:0}):n?q.jsx(wR,{kind:"image",name:t.name,variant:"cell"}):t.kind==="image"?q.jsx(Yin,{path:t.path,name:t.name}):t.kind==="video"?q.jsx(Xin,{path:t.path}):t.kind==="model"?q.jsx(O9t,{url:t.path}):q.jsx(wR,{kind:t.kind,name:t.name,variant:"cell"})})}function Xin({path:t}){return q.jsx("video",{src:t,muted:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"contain"}})}function Yin({path:t,name:n}){const{sheetPath:s,frameName:c}=Z0e(t),[d,m]=Ye.useState(null);return Ye.useEffect(()=>{if(!c){m(null);return}let g=!1;return fetch(`/${FRt(s)}`).then(S=>S.ok?S.text():null).then(S=>{if(g||!S)return;const k=jze(S);m(k?.frames.find(A=>A.name===c)??null)}).catch(()=>{g||m(null)}),()=>{g=!0}},[c,s]),d?q.jsx(F9t,{sheetUrl:`/${s}`,frame:d,maxEdge:96}):q.jsx("img",{src:t.split("#")[0],alt:n,style:{width:"100%",height:"100%",objectFit:"contain"}})}function Zin({asset:t}){const[n,s]=Ye.useState(null),{sheetPath:c,frameName:d}=Z0e(t.path);return Ye.useEffect(()=>{if(s(null),t.kind!=="image"||t.capabilities?.editor==="environment")return;let m=!1;if(d)return fetch(`/${FRt(c)}`).then(S=>S.ok?S.text():null).then(S=>{if(m||!S)return;const k=jze(S)?.frames.find(A=>A.name===d);k&&s({w:k.sourceWidth,h:k.sourceHeight})}).catch(()=>{}),()=>{m=!0};const g=new Image;return g.onload=()=>{m||s({w:g.naturalWidth,h:g.naturalHeight})},g.src=t.path.split("#")[0]??t.path,()=>{m=!0}},[t.capabilities?.editor,t.kind,t.path,d,c]),n?q.jsx(Ph,{label:"Dimensions",value:`${n.w} × ${n.h}`}):null}function Qin(){Ye.useSyncExternalStore(Ein,Rxt,Rxt);const t=X0e();if(!t)return null;const n=Cin(t),s=t.name.includes(".")?t.name.split(".").pop()??"":"";return n?q.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",borderBottom:`1px solid ${ahe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[q.jsx(n.View,{asset:t}),q.jsx(mOe,{asset:t})]}):(t.selectionCount??1)===1&&(t.kind==="image"&&!t.path.includes("#")&&t.capabilities?.editor!=="environment"||t.kind==="video"||t.kind==="audio")?q.jsxs(q.Fragment,{children:[q.jsx(HRt,{assetPath:t.path,kind:t.kind,sizeBytes:t.sizeBytes}),q.jsxs("div",{style:{padding:"0 8px",display:"grid",gap:6},children:[t.health&&t.health!=="healthy"&&q.jsx(Ph,{label:"Health",value:t.health}),!!t.healthCodes?.length&&q.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.sourcePath&&q.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!!t.dependencies?.length&&q.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")}),!!t.references?.length&&q.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")})]}),q.jsx(mOe,{asset:t})]}):q.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${ahe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[q.jsx(Zin,{asset:t}),q.jsx("div",{style:{...M9t,marginBottom:0,textTransform:"uppercase"},children:"Asset"}),q.jsx("div",{style:{fontWeight:600,fontSize:12,color:Zf[1],wordBreak:"break-all"},children:t.name}),q.jsx(Ph,{label:"Path",value:t.path}),t.componentPreview&&q.jsx(Ph,{label:"Surface",value:t.componentPreview.surface==="canvas"?"2D / Pixi":t.componentPreview.surface==="three"?"3D / Three":t.componentPreview.surface}),t.selectionCount&&t.selectionCount>1&&q.jsxs(q.Fragment,{children:[q.jsx(Ph,{label:"Selection",value:`${t.selectionCount} assets`}),t.selectionTotalBytes!==void 0&&q.jsx(Ph,{label:"Total size",value:Lxt(t.selectionTotalBytes)}),t.selectionFormats&&q.jsx(Ph,{label:"Formats",value:t.selectionFormats.join(", ")})]}),s&&q.jsx(Ph,{label:"Format",value:s.toUpperCase()}),t.sizeBytes!==void 0&&q.jsx(Ph,{label:"Size",value:Lxt(t.sizeBytes)}),t.capabilities&&q.jsxs(q.Fragment,{children:[q.jsx(Ph,{label:"Runtime readiness",value:t.capabilities.runtimeReady?"Runtime-ready":"Import or conversion required"}),q.jsx(Ph,{label:"Preview",value:t.capabilities.previewable?"Available":"Unsupported"}),q.jsx(Ph,{label:"Placement",value:t.capabilities.placeable?"Placeable":"Not placeable"}),q.jsx(Ph,{label:"Editor",value:FB(t.capabilities)??"No editor"})]}),t.health&&q.jsx(Ph,{label:"Health",value:t.health}),t.healthCodes&&q.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.dependencies&&q.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")||"None"}),t.references&&q.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")||"None"}),t.sourcePath&&q.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!t.componentPreview&&q.jsxs("div",{style:{display:"flex",gap:6},children:[q.jsx(Ms,{type:"button","data-command-id":O_.open.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:open-project-asset",{detail:{path:t.path}})),children:"Open"}),t.selectionCount&&t.selectionCount>1&&q.jsxs(q.Fragment,{children:[q.jsx(Ms,{type:"button","data-command-id":O_.move.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.move.id}})),children:"Move selected"}),q.jsx(Ms,{type:"button","data-command-id":O_.delete.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.delete.id}})),children:"Delete selected"})]})]}),q.jsx("div",{style:{fontSize:10,color:Zf[3]},children:"Double-click (or press Enter) in the asset browser to open the full viewer."}),q.jsx(mOe,{asset:t})]})}function eon(t){return Sin(t).map(n=>({id:n.id,title:n.title,...n.label===void 0?{}:{label:n.label},placement:"identity",...n.disabled===void 0?{}:{disabled:n.disabled},run:n.run}))}function ton(){const t=X0e();if(t===null)return null;const n=Lye();return n&&(n.adapter!==null||n.nodeId!==null)?null:{quickActions:eon(t.path),id:`asset:${t.path}`,title:t.name,kindLabel:t.online?`${t.kind} · ${t.online.source}`:t.kind,note:{text:t.sourcePath??t.path,testId:"inspector-asset-path"},sections:[{id:VRe,title:"Preview",icon:iB,order:k4t,body:{kind:"preview",render:()=>q.jsx(Kin,{asset:t})}},{id:"asset-selection",title:"Asset",icon:R$,order:fQ,body:{kind:"custom",render:()=>q.jsx(Qin,{})},keepMounted:!0}]}}const ron={loop:"Loop control","contract.root":"DOM root","contract.lifecycle.start":"Cold start","contract.lifecycle.pause":"Pause / resume",persistence:"Source persistence",systems:"Commands and state"};function non(t){const n=ron[t];if(n)return n;const[s,c]=t.split("."),d=(c??t).replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase(),m=d.charAt(0).toUpperCase()+d.slice(1);return s==="system"?`${m} adapter`:m}const ion={ok:B0r,gap:qTt,na:nvr,info:R$},oon={ok:Go.semantic.success,gap:Go.semantic.warning,na:Go.content.dim,info:Go.content.dim};function son({row:t}){return q.jsxs("div",{"data-testid":`ingest-coverage-row-${t.seam}`,"data-status":t.status,style:{display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",gap:7,padding:"8px 10px",borderTop:"1px solid var(--volter-structural-divider)"},children:[q.jsx("span",{style:{color:oon[t.status],paddingTop:1},children:q.jsx(dc,{icon:ion[t.status]})}),q.jsxs("div",{style:{minWidth:0},children:[q.jsx("div",{style:{color:Go.content.primary,fontWeight:600},children:non(t.seam)}),q.jsx("div",{style:{marginTop:2,color:Go.content.muted,lineHeight:1.4,overflowWrap:"anywhere"},children:t.detail}),t.missing&&q.jsxs("div",{style:{marginTop:6,color:Go.content.muted,lineHeight:1.4},children:[q.jsx("strong",{style:{color:Go.semantic.warning},children:"Missing:"})," ",t.missing]}),t.fix&&q.jsxs("div",{style:{marginTop:4,color:Go.content.dim,lineHeight:1.4},children:[q.jsx("strong",{children:"Fix:"})," ",t.fix]})]})]})}function aon({report:t}){const{summary:n}=t;return q.jsxs("div",{"data-testid":"ingest-coverage-report",style:{fontSize:"var(--volter-font-base)"},children:[q.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,padding:"7px 10px 9px",color:Go.content.muted},children:[q.jsxs("span",{style:{color:n.gaps>0?Go.semantic.warning:Go.semantic.success},children:[n.gaps," ",n.gaps===1?"gap":"gaps"]}),q.jsxs("span",{children:[n.ok," integrated"]}),q.jsxs("span",{children:[n.na," not applicable"]}),q.jsxs("span",{children:[n.info," informational"]})]}),t.rows.map(s=>q.jsx(son,{row:s},s.seam))]})}function con(t){return{id:"ingest-coverage",title:"Ingest coverage",icon:KTt,order:9e3,description:`${t.summary.gaps} gap${t.summary.gaps===1?"":"s"}`,defaultOpen:!0,testId:"ingest-coverage-section",body:{kind:"custom",render:()=>q.jsx(aon,{report:t}),data:{summary:t.summary,rows:t.rows}}}}function lon(t,n,s){if(t)return t.nodeId;const c=[...n].at(-1);if(c)return c;const d=s.selection?.get().at(-1)??null;if(d===null)return null;const m=s.hierarchy.roots();return m.length===1&&m[0]?.id===d?null:d}const j9t="inspectorPresentation";function uon(t){return t==="card"||t==="column"||t==="properties"}function Bxt(){const t=o3r(j9t);if(!t||typeof t!="object")return{};const n={};for(const[s,c]of Object.entries(t))uon(c)&&(n[s]=c);return n}let UB=null,lve=0;const UO=new Set;let hOe=null;rPt().then(()=>{UB=null,lve++;for(const t of UO)t()});function fon(){lve++;for(const t of UO)t()}function L9t(){if(UB===null){if(!i3r())return Bxt();UB=Bxt()}return UB}function cje(t){return L9t()[t]??null}function IVe(t,n){if(Qnn("volter.properties"),cje(t)!==n){UB={...L9t(),[t]:n},lve++,s3r(j9t,UB);for(const s of UO)s()}}function don(t){return UO.size===0&&(hOe=e3r(fon)),UO.add(t),()=>{UO.delete(t),UO.size===0&&(hOe?.(),hOe=null)}}function $xt(){return lve}function pon(t,n,s=null){return n??s??t}function B9t(t){return t.sections.map(n=>({id:n.id,title:n.title,icon:n.icon,...n.railGroup===void 0?{}:{railGroup:n.railGroup},...n.railDefault===void 0?{}:{railDefault:n.railDefault}}))}function lje(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function _on(t,n){const s=n.selectedEntityId;if(s===null)return null;const c=t.childAdapters(),d=c.find(m=>m.worldId===t.ownerOf(s))??c.find(m=>t.groupNodeId(m.worldId)===s);return d?lje(d.kind):null}function mon(t){const n=lBe();if(n!==null&&n.documentId===Pp())return"asset-lab";const{adapter:s,surface:c}=Cm(t);if(c)return c;if(s instanceof hy){const d=s.childAdapters(),m=d.length===1?lje(d[0]?.kind??""):null;if(m)return m;const g=_on(s,t);if(g)return g}return lje(sve()??"")??"three"}function hon({stories:t,activeStoryId:n,onApplyStory:s,isolation:c,unavailableReason:d}){return q.jsxs("div",{style:{padding:"4px 0"},children:[t.length>0?q.jsxs(Iw,{"data-testid":"ingest-stories-select",value:n,onChange:m=>{const g=m.target.value;s(g===""?null:g)},style:{width:"100%"},children:[q.jsx("option",{value:"",children:"(none)"}),t.map(m=>q.jsx("option",{value:m.id,children:m.label},m.id))]}):q.jsx("div",{"data-testid":"ingest-stories-none",style:{fontSize:"var(--volter-font-base)",color:Go.content.dim,fontStyle:"italic"},children:d??"No stories — this root has no associated portable CSF previews."}),c&&q.jsx(Ms,{"data-testid":"catalog-isolate",onClick:c.toggle,variant:c.isolated?"primary":"secondary","aria-pressed":c.isolated,style:{marginTop:6,width:"100%"},children:c.isolated?"Exit isolation":"Isolate"})]})}const bD=180/Math.PI;function $9t(t,n,s){const c=Math.cos(t/2),d=Math.cos(n/2),m=Math.cos(s/2),g=Math.sin(t/2),S=Math.sin(n/2),k=Math.sin(s/2);return[g*d*m+c*S*k,c*S*m-g*d*k,c*d*k+g*S*m,c*d*m-g*S*k]}function gon([t,n,s,c]){const d=t+t,m=n+n,g=s+s,S=t*d,k=t*m,A=t*g,F=n*m,D=n*g,J=s*g,$=c*d,G=c*m,se=c*g,pe=1-(F+J),ue=k-se,Ce=A+G,De=1-(S+J),Pe=D-$,be=D+$,X=1-(S+F),we=Math.asin(Math.min(Math.max(Ce,-1),1));return Math.abs(Ce)<.9999999?[Math.atan2(-Pe,X),we,Math.atan2(-ue,pe)]:[Math.atan2(be,De),we,0]}function NVe(t){const[n,s,c,d]=t,m=n*n+s*s+c*c+d*d,g=Math.sqrt(m),S=m<Number.EPSILON?[0,0,0,1]:[n/g,s/g,c/g,d/g],[k,A,F]=gon(S);return[k*bD,A*bD,F*bD]}function yon(t,n,s){if(s.length!==3||s.some(d=>!Number.isFinite(d)))throw new Error(`transform.${n} expects three finite numbers.`);const c={position:[...t.position],rotation:[...t.rotation],scale:[...t.scale]};return n==="rotation"?{...c,rotation:$9t(s[0]/bD,s[1]/bD,s[2]/bD)}:{...c,[n]:[s[0],s[1],s[2]]}}function von(t,n,s){const c=NVe(t.rotation);return c[n]=s,{position:[...t.position],rotation:$9t(c[0]/bD,c[1]/bD,c[2]/bD),scale:[...t.scale]}}const bon={x:"#e0726d",y:"#83bd66",z:"#6390dd"};function gOe({axes:t,label:n,values:s,testidPrefix:c,step:d,precision:m,onBegin:g,onPreview:S,onCommit:k,readOnly:A,readOnlyReason:F}){const[D,J]=Ye.useState(null),$=Ye.useRef(!1);return q.jsx(T_e,{label:n,style:{padding:"4px 8px"},children:t.map(({axis:G,name:se})=>q.jsx(SZ,{testId:`${c}-${se}`,label:se,labelColor:bon[se],title:F,disabled:A,step:d,precision:m,value:D?.axis===G?D.value:Number.isFinite(s[G])?s[G]:0,style:{flex:1,minWidth:0},onChange:pe=>{$.current||($.current=!0,g?.()),J({axis:G,value:pe}),S?.(G,pe)},onChangeEnd:pe=>{$.current=!1,J(null),k(G,pe)}},se))})}function Son({dimensions:t="3d",transform:n,readOnly:s=!1,channelEditability:c,note:d,onBegin:m,onPreview:g,onCommit:S}){const k=[{axis:0,name:"x"},{axis:1,name:"y"}],A=[...k,{axis:2,name:"z"}],F=(se,pe,ue)=>{const Ce={position:[...n.position],rotation:[...n.rotation],scale:[...n.scale]};return Ce[pe][se]=ue,Ce},D=(se,pe)=>(ue,Ce)=>{Number.isFinite(Ce)&&pe?.(F(ue,se,Ce))},J=se=>(pe,ue)=>{Number.isFinite(ue)&&se?.(von(n,pe,ue))},$=se=>{const pe=c?.[se],ue=s||pe?.writable===!1;return pe?.reason?{readOnly:ue,readOnlyReason:pe.reason}:{readOnly:ue}},G=[...new Set(["position","rotation","scale"].map(se=>$(se)).filter(se=>se.readOnly&&se.readOnlyReason).map(se=>se.readOnlyReason))];return q.jsxs(VTr,{children:[q.jsx(gOe,{axes:t==="2d"?k:A,label:"Position",testidPrefix:"ingest-position",values:n.position,step:.1,precision:3,...$("position"),onBegin:m,onPreview:g&&D("position",g),onCommit:D("position",S)}),q.jsx(gOe,{axes:t==="2d"?[{axis:2,name:"z"}]:A,label:t==="2d"?"Rotation (degrees)":"Rotation",testidPrefix:"ingest-rotation",values:NVe(n.rotation),step:1,precision:1,...$("rotation"),onBegin:m,onPreview:g&&J(g),onCommit:J(S)}),q.jsx(gOe,{axes:t==="2d"?k:A,label:"Scale",testidPrefix:"ingest-scale",values:n.scale,step:.01,precision:3,...$("scale"),onBegin:m,onPreview:g&&D("scale",g),onCommit:D("scale",S)}),G.map(se=>q.jsx(_p,{"data-testid":"inspector-transform-readonly-reason",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:se},se)),d&&q.jsx(_p,{"data-testid":"inspector-transform-note",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:d})]})}function qxt(t){return t.revertsTo===void 0?`Revert ${t.label} to default`:`Revert ${t.label} to ${t.revertsTo}`}function xon({value:t,onCommit:n,onPreview:s,...c}){const[d,m]=Ye.useState(null),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef({draft:d,onCommit:n});return k.current={draft:d,onCommit:n},Ye.useEffect(()=>{const A=g.current;if(!A)return;const F=()=>{const{draft:D,onCommit:J}=k.current,$=D??A.value;$&&$!==S.current&&J($),S.current=null,m(null)};return A.addEventListener("change",F),()=>A.removeEventListener("change",F)},[]),q.jsx(d4t,{...c,ref:g,value:d??t,onChange:A=>{S.current===null&&(S.current=t),m(A.target.value),s?.(A.target.value)}})}async function q9t(t,n=WRt){const s=await Promise.all(n.map(c=>won(t,c)));return{assets:s.flatMap(c=>c.assets),failedListings:s.flatMap(c=>c.failedListings)}}async function won(t,n){const s=[""],c=[],d=[];let m=0;for(;s.length>0&&m<512;){const g=s.splice(0,8),S=await Promise.all(g.map(k=>t(n,k)));m+=g.length,S.forEach((k,A)=>{const F=g[A];if(!k.ok){d.push(`${n}/${F}: ${k.reason}`);return}for(const D of k.entries){const J=F?`${F}/${D.name}`:D.name;D.type==="directory"?s.push(J):c.push({path:J,root:n,entry:D})}})}return{assets:c,failedListings:d}}async function Ton(t,n){const s=t.filter(S=>S.root==="public"),c=Con(s),d=(await Promise.all(c.map(async S=>{const k=await n(S.path);if(!k)return null;const A=jze(k);return A?{sidecar:S,parsed:A}:null}))).flatMap(S=>S?[S]:[]),m=new Set;for(const{sidecar:S,parsed:k}of d){m.add(S.path);const A=zxt(S.path);for(const F of KYr(k.image))m.add(A?`${A}/${F}`:F);for(const F of s)wMe(F.path)===wMe(S.path)&&m.add(F.path)}const g=d.flatMap(({sidecar:S,parsed:k})=>{const A=zxt(S.path),F=A?`${A}/${k.image}`:k.image;return k.frames.map(D=>({path:`${F}#${D.name}`,root:S.root,entry:{name:`${D.name}.png`,type:"file",...S.entry.size===void 0?{}:{size:S.entry.size},...S.entry.modifiedAt===void 0?{}:{modifiedAt:S.entry.modifiedAt}},spritesheet:{sheetPath:F,x:D.x,y:D.y,width:D.width,height:D.height,rotated:D.rotated,sourceWidth:D.sourceWidth,sourceHeight:D.sourceHeight,trimX:D.trimX,trimY:D.trimY}}))});return[...t.filter(S=>S.root!=="public"||!m.has(S.path)),...g]}function Con(t){const n=new Map;for(const s of t){if(!/\.json$/i.test(s.path))continue;const c=wMe(s.path),d=n.get(c);(!d||LSt(s.path)>LSt(d.path))&&n.set(c,s)}return[...n.values()]}function zxt(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function z9t(t){const n=ig(t).kind;return n==="model"||n==="image"||n==="video"||n==="audio"?n:"other"}function Eon(t){const n=ig(t.entry.name);return n.placeable&&n.runtimeReady?10:n.kind==="model"&&n.runtimeReady?15:n.kind==="prefab"?25:n.runtimeReady&&(n.kind==="image"||n.kind==="audio")?30:n.runtimeReady?40:n.importable?70:90}function kon(t){return(t.surface==="three"?0:t.surface==="canvas"?10:t.surface==="dom"?20:30)+(t.exported?0:4)}const Aon=1e4,Don={paths:[],failures:[]};let $Y=null;async function Pon(){const t=await q9t(eve,["public"]);return{paths:t.assets.filter(n=>z9t(n.entry.name)==="image").map(n=>n.path).sort((n,s)=>n.localeCompare(s)),failures:t.failedListings}}function Ion(){const t=Date.now();return(!$Y||t-$Y.at>Aon)&&($Y={at:t,scan:Pon().catch(n=>($Y=null,{paths:[],failures:[n instanceof Error?n.message:String(n)]}))}),$Y.scan}function Non(t){const[n,s]=Ye.useState(Don);return Ye.useEffect(()=>{let c=!0;return Ion().then(d=>{c&&s(d)}),()=>{c=!1}},[t]),n}const Oon={width:64},Vxt={width:HCr,fontSize:"var(--volter-font-md)",color:Go.content.muted};function AI(t){return`ingest-prop-${t.replace(/\./g,"-")}`}function Ron({field:t,io:n,value:s}){const{paths:c,failures:d}=Non(!0),[m,g]=Ye.useState(null),S=F=>{g(null),Promise.resolve(n.set(t.path,F===""?null:F)).then(D=>{g(D&&!D.persisted?{forValue:F,text:`Not saved — ${D.destination}. See the editor console for the mechanism.`}:null)})},k=m?.forValue===s?m.text:void 0,A=d.length>0?`${d.length} folder(s) under public/ could not be read — this list may be incomplete.`:void 0;return q.jsx(GCr,{testId:AI(t.path),value:s,options:c,previewUrlFor:F=>`/${F}`,disabled:t.readonly,note:k??A,onChange:S})}function Fon({field:t,io:n}){const s=t,c=n.get(s.path),d=zRe(c)?void 0:c,m=s.defaulted===!0&&d===void 0,g=s.readonly?PBe(s):void 0,S=s.resettable?q.jsx(dm,{"data-testid":`ingest-revert-${s.path.replace(/\./g,"-")}`,"aria-label":qxt(s),title:qxt(s),onClick:()=>n.remove?.(s.path),children:q.jsx(dc,{icon:VOe})}):null;return s.type==="boolean"?q.jsxs("label",{title:g,style:{display:"flex",gap:6,alignItems:"center",padding:"6px 8px",fontSize:"var(--volter-font-md)"},children:[q.jsx(TD,{"data-testid":AI(s.path),checked:!!d,ref:k=>{k&&(k.indeterminate=m)},disabled:s.readonly,onChange:k=>n.set(s.path,k.target.checked)}),q.jsx("span",{style:s.defaulted?{color:Go.content.dim}:void 0,children:s.label}),S]}):q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[q.jsx("span",{style:s.defaulted?{...Vxt,color:Go.content.dim}:Vxt,title:g??(s.defaulted?`${s.label} — default (not set here)`:s.label),children:s.label}),s.type==="color"?q.jsx(xon,{"data-testid":s.path==="material.color"?"ingest-color":AI(s.path),value:d??"#ffffff",disabled:s.readonly,onCommit:k=>n.set(s.path,k),onPreview:k=>n.preview?.(s.path,k)}):s.type==="number"?q.jsx(jRe,{type:"number","data-testid":AI(s.path),disabled:s.readonly,value:typeof d=="number"?String(Math.round(d*1e3)/1e3):"",placeholder:m?"—":void 0,onCommit:k=>{const A=Number.parseFloat(k);Number.isFinite(A)&&n.set(s.path,A)},style:Oon}):s.type==="enum"?q.jsxs(Iw,{"data-testid":AI(s.path),disabled:s.readonly,value:String(d??""),onChange:k=>{const A=s.options?.find(F=>String(F)===k.target.value)??k.target.value;n.set(s.path,A)},style:{width:120},children:[m&&q.jsx("option",{value:"",children:"—"}),(s.options??[]).map(k=>q.jsx("option",{value:String(k),children:String(k)},String(k)))]}):s.type==="vec3"?q.jsx("div",{style:{width:190},children:q.jsx(JCr,{value:Array.isArray(d)&&d.length===3?[Number(d[0]),Number(d[1]),Number(d[2])]:[null,null,null],disabled:!!s.readonly,testIdPrefix:AI(s.path),onChange:k=>n.set(s.path,k)})}):s.type==="asset"?q.jsx(Ron,{field:s,io:n,value:typeof d=="string"?d:""}):s.type==="json"?q.jsx(wBe,{"data-testid":AI(s.path),"data-variant":"code",disabled:s.readonly,defaultValue:m?"":JSON.stringify(d??null),placeholder:m?"—":void 0,onBlur:k=>{try{n.set(s.path,JSON.parse(k.target.value))}catch{}},style:{width:160}},`${s.path}:${JSON.stringify(d??null)}`):q.jsx(jRe,{type:"text","data-testid":AI(s.path),readOnly:s.readonly,value:String(d??""),placeholder:m?"—":void 0,onCommit:k=>n.set(s.path,k),style:{width:120}}),S]})}function V9t({fields:t,io:n}){return q.jsx(q.Fragment,{children:t.map(s=>q.jsx(Fon,{field:s,io:n},s.path))})}function uve(t){const[n,s]=Ye.useState(null);return Ye.useEffect(()=>{let c=0;const d=requestAnimationFrame(()=>{c=requestAnimationFrame(()=>s(t))});return()=>{cancelAnimationFrame(d),cancelAnimationFrame(c)}},[t]),n===t}const Mon=Ye.lazy(()=>lo(()=>import("./InspectorCanvasPreview-BrFjhoiD.js"),__vite__mapDeps([263,1,2,3,4])).then(t=>({default:t.InspectorCanvasPreview})));function qSn({picture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=uve(n);return q.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&q.jsx(Ye.Suspense,{fallback:null,children:t()}),!d&&s.map(g=>q.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function jon({source:t,entry:n,previewKey:s,actions:c,mode:d="section"}){const m=d==="thumbnail",g=uve(s);return q.jsxs("div",{"data-testid":m?"inspection-preview-thumbnail":"inspection-preview",style:m?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[g&&q.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",background:"var(--volter-bg-inset)"},children:q.jsx(t.Thumbnail,{entry:n,previewRevision:0,width:m?96:256,height:m?96:256})}),!m&&c.map(S=>q.jsx(Ms,{"data-testid":S.id,size:"compact",disabled:S.disabled,title:S.title,onClick:S.run,style:{position:"absolute",right:8,bottom:8},children:S.label},S.id))]})}function Lon({capture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=uve(n);return q.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(Mon,{capture:t,previewKey:n,size:d?96:256})}),!d&&s.map(g=>q.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function Bon(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function $on(t){const n=[],s=[],c=new Map;for(const d of t)d.group?(c.has(d.group)||(c.set(d.group,[]),s.push(d.group)),c.get(d.group).push(d)):n.push(d);return{ungrouped:n,groups:s.map(d=>({name:d,groupId:Bon(d),properties:c.get(d)}))}}function qon(t,n){if(!t.transforms)return null;const s=t.transforms.dimensions?.(n);return s!==void 0?s:t.hierarchy.object3D===void 0||t.hierarchy.object3D(n)!==null?"3d":null}const zon=14,Von=[[/physic|rigid|collid/i,z0r],[/material/i,h0r],[/light/i,oLe],[/camera/i,cye],[/audio|sound|music/i,lLe],[/player|character|humanoid|person/i,q0r],[/anim|state|machine/i,LTt]];function Uon(t){for(const[n,s]of Von)if(n.test(t))return s;return GB}function Jon(t){return n=>Ye.createElement(jon,{source:t.picture.source,entry:t.picture.entry,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Won(t){return n=>Ye.createElement(Lon,{capture:t.capture,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Hon(t){return t.media?t.media.preview?t.media.preview({displayName:t.displayName,previewKey:t.previewKey,actions:t.actions}):null:t.canvasCapture?Won({capture:t.canvasCapture,previewKey:t.previewKey,actions:t.actions}):t.picture?Jon({picture:t.picture,previewKey:t.previewKey,actions:t.actions}):null}function yOe(t){const n=t.slice(10);if(n!=="position"&&n!=="rotation"&&n!=="scale")throw new Error(`The Transform section has no ${JSON.stringify(t)}.`);return n}const Gon={position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};function Kon(t,n,s,c){if(D4t(t))return t.sections(c,n);const d=t.Section;return[{id:t.id,title:t.title,icon:typeof t.icon=="function"?t.icon(c,n):t.icon,order:t.order,...t.railGroup===void 0?{}:{railGroup:t.railGroup},...t.railDefault===void 0?{}:{railDefault:t.railDefault},body:{kind:"custom",render:()=>Ye.createElement(d,{adapter:n,nodeId:s})}}]}function U9t(t,n,s,c){const d=new Set,m=new Map,g=[];for(const S of t){const k=Kon(S,n,s,c).filter(F=>!d.has(F.id)),A=(D4t(S)?S.claims??[]:[]).filter(F=>!d.has(F));if(!(k.length===0&&A.length===0)){for(const F of k)d.add(F.id),m.set(F.id,S.owner);for(const F of A)d.add(F);g.push(...k)}}return{sections:g,claimed:d,owners:m}}function J9t(t,n,s){return s===void 0?[...t]:t.filter(c=>n.get(c.id)===s.owner||s.builtins.includes(c.id))}function uje(t){const{adapter:n,nullSubject:s}=t,{sections:c,claimed:d,owners:m}=U9t(n?t.contributions??[]:[],n,null,null),g=J9t([...(s?.sections??[]).filter(S=>!d.has(S.id)),...c].sort((S,k)=>S.order-k.order),m,t.rail);return{id:s?.id??"nothing-selected",title:s?.title??"Nothing selected",identity:s?.kindLabel?{rename:{readOnly:!0,set:()=>{}},kindLabel:s.kindLabel,...s.note?{note:s.note}:{}}:null,...s?.hint?{hint:s.hint}:{},presentation:{preferred:IBe(t.surface)},quickActions:s?.quickActions??[],related:[],sections:g}}function Xon(t,n,s){if(t.body.kind!=="custom"||t.body.editable)return t;const c=s.get(t.id);return!c||c.length===0?t:{...t,body:{...t.body,editable:{fields:c,io:n}}}}function Yon(t){const{adapter:n,nodeId:s,node:c,contributions:d,onEdit:m}=t;if(s===null)return uje({nullSubject:t.nullSubject??null,surface:t.surface,contributions:d,adapter:n,rail:t.rail});const{sections:g,claimed:S,owners:k}=U9t(d,n,s,c),A={get:en=>n.inspector?.get(s,en),...n.inspector?.preview?{preview:(en,ii)=>{n.inspector?.preview?.(s,en,ii)}}:{},set:(en,ii)=>{if(!n.inspector)return;const No=gPt(n,s,en,ii);return m(),No},...n.inspector?.remove?{remove:en=>{const ii=O3r(n,s,en);return m(),ii}}:{}},F=n.inspector?.properties(s)??[],D=F.find(en=>en.path==="name"),{ungrouped:J,groups:$}=$on(F.filter(en=>en.path!=="name")),G=J.find(en=>en.path==="visible"&&en.type==="boolean"),se=G?J.filter(en=>en!==G):J,pe=[...D&&D.readonly!==!0?[D]:[],...G?[G]:[]],ue=[];if(G){const en=A.get(G.path)!==!1,ii=en?"Visible — click to hide":"Hidden — click to show";ue.push({id:"inspector-visibility-toggle",title:ii,icon:en?iLe:dLe,placement:"identity",pressed:!en,disabled:G.readonly===!0,run:async()=>{await A.set(G.path,!en)}})}t.assetDocument&&ue.push({id:"open-asset-editor",title:"Open in Asset Editor",label:"Open in Asset Editor",placement:"preview",run:t.assetDocument.open}),n.transforms?.sourceCommit?.availability(s)?.available&&ue.push({id:"commit-live-transform-source",title:"Commit this live transform to its authored source literal",label:"Commit transform to source",icon:BTt,placement:"identity",run:async()=>{await mPt(n,s),m()}});const Pe=new Map;Pe.set(R5e,se);for(const en of $)Pe.set(Vht(en.groupId),en.properties);const be=[],X=n.truth?.resolve(s,"position").site??null,we=t.media,qe=c?.typeLabel??c?.label??s,bt=t.surface==="canvas"&&we===null&&t.stories?C9t({name:qe,path:X?.anchored===!0?X.file:"",surface:"canvas"}):null,Pt=ue.filter(en=>en.placement==="preview"),Wt=Hon({media:we,canvasCapture:t.canvasPreview,picture:bt,displayName:c?.label??s,previewKey:s,actions:Pt});!S.has(VRe)&&Wt!==null&&be.push({id:VRe,title:"Preview",icon:aR,order:k4t,body:{kind:"preview",render:Wt}});const zt=qon(n,s),ft=!S.has(zht)&&zt!==null,tr=ft?$.find(en=>en.name==="Transform")?.properties??[]:[];if(ft){const en=n.transforms?.get(s)??Gon,ii=we?.instanced??null,No=Object.fromEntries(["position","rotation","scale"].map(En=>[En,n.transforms?.editability?.(s,En)??{writable:n.capabilities.transform}])),gn={position:[...en.position],rotation:NVe(en.rotation),scale:[...en.scale]};be.push({id:zht,title:"Transform",icon:JTt,order:_Er,body:{kind:"custom",data:{...gn,editability:No,...ii?{instanced:ii}:{}},editable:{fields:["position","rotation","scale"].map(En=>{const cs=!n.capabilities.transform||!No[En].writable;return{path:`transform.${En}`,label:En[0].toUpperCase()+En.slice(1),type:"vec3",value:gn[En],readonly:cs,...!cs&&n.transforms?.remove&&No[En].removable===!0?{resettable:!0}:{}}}),io:{get:En=>gn[yOe(En)],set:(En,cs)=>{if(!n.transforms)return;const On=yon(en,yOe(En),cs);jFe(n,s),q_e(n,s,On);const ji=LFe(n,s);return m(),ji},...n.transforms?.remove?{remove:En=>{const cs=_Pt(n,s,yOe(En));return m(),cs}}:{}}},render:()=>[Ye.createElement(Son,{key:"channels",dimensions:zt,transform:en,readOnly:!n.capabilities.transform,channelEditability:No,...ii?.note?{note:ii.note}:{},onBegin:()=>{jFe(n,s)},onPreview:En=>{q_e(n,s,En)},onCommit:En=>{q_e(n,s,En),LFe(n,s),m()}}),...tr.length>0?[Ye.createElement(V9t,{key:"rows",fields:tr,io:A})]:[]]}})}S.has(R5e)||(se.length>0&&be.push({id:R5e,title:"Properties",icon:WTt,order:fQ,defaultOpen:!0,body:{kind:"fields",fields:se,io:A}}),$.forEach((en,ii)=>{if(tr.length>0&&en.name==="Transform")return;const No=en.properties.filter(gn=>!gn.defaulted).length;be.push({id:Vht(en.groupId),title:en.name,icon:Uon(en.name),order:A4t+ii,description:No>0?`${No} set of ${en.properties.length}`:`${en.properties.length} properties`,defaultOpen:No>0&&en.properties.length<=zon,testId:`ingest-group-${en.groupId}`,body:{kind:"fields",fields:en.properties,io:A}})}));const Qt=t.stories;!S.has(E4t)&&Qt&&be.push(Zon(Qt)),be.push(...g.map(en=>Xon(en,A,Pe))),be.sort((en,ii)=>en.order-ii.order);const Tt=J9t(be,k,t.rail),vn=CPt(n,s),Yr=EPt(n);return{id:s,title:c?.label??"",identity:{rename:{readOnly:D===void 0||D.readonly===!0,set:en=>A.set("name",en)},kindLabel:`${c?.typeLabel??c?.kind??""}${vn?` · ${vn.label}`:""}`,...c?.kind?{kind:c.kind}:{},...Yr?{document:{path:Yr,...vn?.detail?{title:vn.detail}:{}}}:{},note:X?.anchored?{text:`${X.kind==="data"?"Level data":"Source"} · ${X.display}`,title:X.kind==="data"?`Placed by record ${X.record} of ${X.file}, the game's own level data`:`Constructed by a \`new\` expression at ${X.file} line ${X.line}, column ${X.col}`,testId:"inspector-creation-site"}:void 0},presentation:{preferred:IBe(t.surface)},...pe.length>0?{editable:{fields:pe,io:A}}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},quickActions:ue,related:n.related?.links(s)??[],sections:Tt}}function Zon(t){return{id:E4t,title:t.title??"Stories",icon:pLe,order:mEr,body:{kind:"custom",render:()=>Ye.createElement(hon,{stories:t.stories,activeStoryId:t.activeStoryId,onApplyStory:t.onApplyStory,isolation:t.isolation,unavailableReason:t.unavailableReason??null})}}}const Qon=["project-tool","tool-contribution"];function esn(t){const{activeDocumentKind:n,documentSelection:s}=t;return n===null||!Qon.includes(n)?!1:s===null}function Uxt(t){const{subject:n,surface:s,available:c,override:d,workspaceDefault:m=null,columnShown:g=!0}=t,S=n.presentation.preferred??IBe(),k=pon(S,d,m),A=k!=="card"&&!g?"card":k;return{subject:n,surface:s,presentation:A,available:c,card:c&&A==="card",column:A!=="card"}}const W9t="game";function tsn(t){const n=t.projectName?.trim();return{id:W9t,title:n&&n.length>0?n:"Game",kindLabel:"Game",...t.instanceName?{note:{text:t.instanceName}}:{},sections:[]}}function zSn(t){return b$e({match:()=>Pp()===a0,describe:()=>tsn(t())})}const rsn=3,nsn=Object.freeze({none:!0});function isn(t){const n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function eee(t,n=0){if(t===null)return null;const s=typeof t;if(s==="string"||s==="boolean")return t;if(s==="number")return Number.isFinite(t)?t===0?0:t:{kind:"opaque",type:"number"};if(s!=="object")return{kind:"opaque",type:s};if(n>=rsn)return{kind:"opaque",type:Jxt(t)};if(Array.isArray(t))return t.map(m=>eee(m,n+1));const c=t;if(!isn(c))return{kind:"opaque",type:Jxt(c)};const d={};for(const[m,g]of Object.entries(c))g!==void 0&&(d[m]=eee(g,n+1));return d}function Jxt(t){return t.constructor?.name??"object"}function Wxt(t,n){let s;try{s=n.get(t.path)}catch{s=void 0}return{path:t.path,label:t.label,type:t.type,...zRe(s)?{mixed:!0}:{},...!zRe(s)&&s!==void 0?{value:eee(s)}:{},...t.defaulted!==void 0?{defaulted:t.defaulted}:{},...t.readonly!==void 0?{readonly:t.readonly}:{},...t.readonly?{readonlyReason:PBe(t)}:{},...t.resettable!==void 0?{resettable:t.resettable}:{},...t.revertsTo!==void 0?{revertsTo:t.revertsTo}:{},...t.group!==void 0?{group:t.group}:{},...t.options!==void 0?{options:t.options.map(c=>eee(c))}:{}}}function Hxt(t){const n={};for(const[s,c]of Object.entries(t))c!==void 0&&(n[s]=eee(c));return n}function osn(t){const n=t.body;if(n.kind==="fields")return{kind:"fields",fields:n.fields.map(s=>Wxt(s,n.io))};if(n.kind==="custom"&&n.data!==void 0&&n.editable===void 0)return{kind:"custom",id:t.id,title:t.title,data:Hxt(n.data)};if(n.kind==="custom"&&n.editable!==void 0){const s=n.editable;return{kind:"fields",fields:s.fields.map(c=>Wxt(c,s.io)),...n.data!==void 0?{data:Hxt(n.data)}:{}}}return{kind:n.kind,id:t.id,title:t.title}}function ssn(t){return{id:t.id,title:t.title,order:t.order,...t.description!==void 0?{description:t.description}:{},body:osn(t)}}function asn(t,n){return{id:t.id,title:t.title,...t.identity?.kindLabel?{kindLabel:t.identity.kindLabel}:{},...t.identity?.note?{note:t.identity.note.text}:{},...t.hint?{hint:t.hint}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},presentation:{preferred:t.presentation.preferred,...n?{resolved:n.presentation,surface:n.surface}:{}},quickActions:t.quickActions.map(s=>({id:s.id,title:s.title,...s.label!==void 0?{label:s.label}:{},...s.pressed!==void 0?{pressed:s.pressed}:{},...s.disabled!==void 0?{disabled:s.disabled}:{}})),related:t.related.map(({id:s,title:c})=>({id:s,title:c})),sections:t.sections.map(ssn)}}const Gxt=new WeakMap;function csn(t){if(!t.capture)return null;const n=Gxt.get(t);if(n)return n;const s=async c=>t.capture?.(c)??null;return Gxt.set(t,s),s}function lsn(t){return typeof t.previewImage=="function"}function usn(t,n,s){if(!n)return null;if(s==="asset-lab"){const d=s2(Pp());return d?csn(d):null}let c=t;if(t instanceof hy){const d=t.ownerOf(n);c=t.childAdapters().find(m=>m.worldId===d)?.adapter??t}return lsn(c)?d=>c.previewImage(n,d,d):null}function fsn(){const t=Pp();if(t===null)return null;const n=Ttn(t);if(n===void 0)return null;const s=PN(n.kind);return s===void 0||s.inspectorRail!=="owned"?null:{rail:{owner:s.owner,builtins:s.inspectorBuiltins??[]}}}function dsn(t){const{store:n,adapter:s,documentSelection:c,surface:d}=t,m=ton();if(m!==null)return{subject:uje({nullSubject:m,surface:d}),available:!0};const g=lon(c,n.selectedEntityIds,s),S=g?s.hierarchy.node(g):null;if(g!==null&&S===null)return{subject:uje({nullSubject:null,surface:d}),available:!1};const k=()=>n.notifyIngestEdit(),A=g?null:o4r({adapter:s,surface:d,store:n,onEdit:k}),F=g?S?Wht(S,s):[]:Wht(null,s,{nullSubjectId:A?.id??null}),D=g?Nze(s,g):null;return{subject:Yon({adapter:s,nodeId:g,node:S,surface:d,contributions:F,...g?{}:{nullSubject:A},media:d==="asset-lab"?null:D,canvasPreview:usn(s,g,d),assetDocument:D?.assetDocument??null,stories:e4r(s,S,g),...fsn()??{},...c===null&&g!==null&&n.selectedEntityIds.size>1?{alsoSelected:n.selectedEntityIds.size-1}:{},onEdit:k}),available:g!==null||A!==null||F.length>0}}function fve(t){const n=mon(t),{adapter:s,documentSelection:c}=Cm(t),d=dsn({store:t,adapter:s,documentSelection:c,surface:n}),{subject:m}=d,g=d.available&&(m.id!==W9t||m.sections.length>0)&&!esn({activeDocumentKind:TC()?.descriptor.kind??null,documentSelection:c}),S=Pp()===a0?gVe():null;if(S){const k=con(S),A=g?{...m,sections:[...m.sections.filter(F=>F.id!==k.id),k].sort((F,D)=>F.order-D.order)}:{id:`ingest:${S.summary.worldId}`,title:"Ingested game",identity:null,hint:"This mount exposes no editable scene subject. Coverage below says exactly which editor seams it did earn.",presentation:m.presentation,quickActions:[],related:[],sections:[k]};return Uxt({subject:A,surface:n,available:!0,override:cje(n),workspaceDefault:mD().inspector??null,columnShown:Tgt("properties")!==!1})}return Uxt({subject:m,surface:n,available:g,override:cje(n),workspaceDefault:mD().inspector??null,columnShown:Tgt("properties")!==!1})}function dve(t){const{subject:n,surface:s,presentation:c,available:d}=fve(t);return d?asn(n,{surface:s,presentation:c}):nsn}async function psn(t,n){const{subject:s,available:c}=fve(t);if(!c)throw new Error("No Inspector subject is active.");const d=s.quickActions.filter(g=>g.id===n);if(d.length!==1){const g=s.quickActions.map(S=>S.id);throw new Error(d.length===0?`Inspector action ${JSON.stringify(n)} is not available. `+(g.length>0?`Available actions: ${g.join(", ")}.`:"This subject exposes no actions."):`Inspector action id ${JSON.stringify(n)} is ambiguous (${d.length} matches).`)}const m=d[0];if(!m||m.disabled)throw new Error(`Inspector action ${JSON.stringify(n)} is disabled.`);return await m.run(),dve(t)}function _sn(t,n){const s=c=>{throw new Error(`Inspector field ${JSON.stringify(t.path)} expects ${c}.`)};if(t.type==="number"&&(typeof n!="number"||!Number.isFinite(n))&&s("a finite number"),t.type==="boolean"&&typeof n!="boolean"&&s("a boolean"),(t.type==="string"||t.type==="color"||t.type==="asset"||t.type==="enum")&&typeof n!="string"&&s("a string"),t.type==="vec3"&&(!Array.isArray(n)||n.length!==3||n.some(c=>typeof c!="number"||!Number.isFinite(c)))&&s("three finite numbers"),t.type==="enum"&&t.options&&!t.options.includes(n))throw new Error(`Inspector field ${JSON.stringify(t.path)} accepts: ${t.options.map(String).join(", ")}.`)}async function msn(t,n,s){const c=H9t(t,n);_sn(c.field,s);const d=await c.io.set(n,s)??Lhe;return{subject:dve(t),write:d}}function H9t(t,n){const{subject:s,available:c}=fve(t);if(!c)throw new Error("No Inspector subject is active.");const d=(s.editable?.fields??[]).filter(k=>k.path===n).map(k=>({field:k,io:s.editable.io})),m=s.sections.flatMap(k=>{const A=k.body,F=A.kind==="fields"?{fields:A.fields,io:A.io}:A.kind==="custom"?A.editable:void 0;return F?F.fields.filter(D=>D.path===n).map(D=>({field:D,io:F.io})):[]}),g=[...d,...m];if(g.length===0)throw new Error(`The active Inspector has no field at ${JSON.stringify(n)}.`);if(g.length>1)throw new Error(`The active Inspector exposes ${JSON.stringify(n)} more than once.`);const S=g[0];if(S.field.readonly)throw new Error(`Inspector field ${JSON.stringify(n)} is read-only: ${PBe(S.field)}`);return S}class fje extends Error{constructor(n){super(n),this.name="InspectionRemovalUnavailableError"}}async function hsn(t,n){const s=H9t(t,n);if(s.field.resettable!==!0)throw new fje(`Inspector field ${JSON.stringify(n)} does not declare itself removable (\`resettable\`), so this lane has no way to express the property's absence. Write a value with \`set-inspection-field\` instead — and note that doing so cannot restore byte-absence for a property an edit ADDED.`);if(!s.io.remove)throw new fje(`The Inspector io that owns ${JSON.stringify(n)} implements no removal door, so the property's authored override cannot be dropped through this editor. The dialect writer that owns this source edit owns removal too; until it does, an edit/revert round trip over this lane is unverifiable at byte level.`);const c=await s.io.remove(n)??Lhe;return{subject:dve(t),write:c}}const OVe=new Map;let G9t=[];const dje=new Set;function K9t(){G9t=[...OVe.values()];for(const t of dje)t()}function VSn(t){return dje.add(t),()=>dje.delete(t)}function USn(t){OVe.set(t.rootId,t),K9t()}function JSn(t){OVe.delete(t)&&K9t()}function X9t(){return G9t}function gsn(){const t=X9t();if(t.length===0)return null;const n=t.filter(s=>s.source==="measured");return n.length===0?null:`${n.length} of ${t.length} root(s) have NO readiness declaration (${n.map(s=>s.rootId).join(", ")}) — the host is measuring instead. A self-booting game states it with \`window.volterGame.ready\`.`}function ysn(t){return t.liveMounted?t.livePlaying?t.storePlayState==="paused"?"paused":"playing":"paused":"stopped"}async function vsn(t,n){switch(t.reach.kind){case"game-contract":{const s=n.scenes();if(!s)return{ok:!1,code:"SCENE_CONTRACT_UNAVAILABLE",error:`open: "${t.id}" is reached through the running game's own scenes contract, and the game running in this session publishes none (\`window.volterGame.scenes\`).`};const c=s.goToScene(t.reach.sceneId);if(!c.ok)return{ok:!1,code:"SCENE_NOT_IN_CONTRACT",error:`open: "${t.id}" — ${c.error}`,known:c.known};const d=await c.settled;return d.error!==void 0?{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — the game's own navigation failed: ${d.error}`}:(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:d.requested,current:d.current}})}case"root-mount":return n.activateGameDocument()?{ok:!0,documentId:n.gameDocumentId,title:t.label}:{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t.id}" is the running game itself, and no game document is open in this session.`};case"entrypoint-selection":{const s=n.remountSelection,c=t.region;if(!s||c===null)return{ok:!1,code:"SCENE_NOT_OPENABLE_LIVE",error:`open: "${t.id}" sits at the entrypoint's \`${t.reach.selection}\` swap slot, and this session has no live remount for a native swap-slot scene — a running game cannot be sent there in place. Stop the game and open it as a document instead.`};const d=await s({selection:t.reach.selection,key:t.reach.key,regionId:c});return d.ok?(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:t.reach.key,current:t.reach.key},restart:!0}):{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — remount at \`${t.reach.selection}["${t.reach.key}"]\` failed: ${d.error}`}}case"story":case"none":return null}}const Wge="console";function bsn(t){let n=zQ().length>0;const s=PRt(()=>{const m=zQ().length>0;m&&!n&&mD().drawer!=="hidden"&&vC(Wge),n=m});let c=t.getSnapshot().lastError!==null;const d=t.subscribe(()=>{const m=t.getSnapshot().lastError,g=m!==null;g&&!c&&(Qs.error(`Source write rolled back: ${m.message} (${m.code})`,"history"),mD().drawer!=="hidden"&&vC(Wge)),c=g});return()=>{s(),d()}}function pve(){lkr(Wge)}function _ve(){vC(Wge)}const Hge=new Map;function WSn(t){return n=>{if(n.phase==="adopted"){Hge.set(t,{source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[]});return}const s=Hge.get(t);s&&s.alternates.push({sceneId:n.sceneId,cameraId:n.cameraId,sameRenderer:n.sameRenderer,drawCount:n.drawCount})}}function HSn(t){Hge.delete(t)}function Ssn(){return[...Hge].map(([t,n])=>({rootId:t,source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[...n.alternates],...n.alternates.length>0?{ambiguity:`"${t}" rendered ${n.alternates.length} other world(s) after the one the editor adopted (${n.source}: ${n.sceneId}). The adopted world is unchanged; if the editor is showing the wrong scene, one of these is it: `+n.alternates.map(s=>`${s.sceneId}${s.sameRenderer?"":" (a SECOND renderer)"}`).join(", ")}:{}}))}const xsn=new Set(["state","stateAll","providers","commands","events","snapshot"]);function wsn(t){if(t.type!=="bridge-call")return[];const n=t.method;if(typeof n!="string"||!xsn.has(n))return[];const s=t.instance;try{const c=Gwr(s).debug;if(c===void 0)return[];const d=[T3t(c),s??""].join(":"),m=(S,k="")=>[d,S,k].join(":");if(n==="snapshot")return[m("snapshot"),m("state","time"),m("stateAll"),m("events")];const g=n==="state"?String(t.callArgs?.[0]):"";return[m(n,g)]}catch{return[]}}function Tsn(t,n,s){const c=wsn(t),d=n&&c.length>0&&c.every(m=>s.has(m));if(n)for(const m of c)s.add(m);return{derived:d?"none":n&&c.length>0?"always":Hvr(t.type)??Jvr(t.type),playFullReport:n&&!d&&c.length>0?"explicit":n&&t.type==="bridge-call"&&t.method==="invoke"?"if-content-changed":"none"}}function Csn(t,n,s,c){return t==="none"?!1:!(t==="if-content-changed"&&n==="none"&&s===c)}function Kxt(t,n){const s=nq(t);return s.hierarchy.node(n)!==null||Nze(s,n)!==null?null:`select: no entity with id "${n}" — neither the active authoring adapter's hierarchy nor the live object index owns it, so there is nothing to select. Read the ids that exist with editor.hierarchy() (the rows the panel is rendering) or editor.status().entities.`}function vOe(t,n,s){const c=s2(Pp())?.selection;if(c){c.apply(n);return}const d=t.applySelectionBeforePresentation(n);s?.deferPresentation?s.deferPresentation(d):setTimeout(d,0)}function Esn(){return typeof document>"u"?null:{visibility:document.visibilityState,focused:document.hasFocus(),reportedAt:Date.now()}}const ksn=["entities","entityCount","ontologyInvariants"];function Asn(t){const n={...t};for(const s of ksn)delete n[s];for(const s of Xrn())delete n[s];return{...n,_statePatch:!0}}function Xxt(t,n=null){const s=zQ(),c=Pp(),d=Fze(t),m=x4t.getSnapshot(),g=n?.entities??Y0e(t);return{playState:ysn({storePlayState:t.playState,liveMounted:vVe(),livePlaying:ave()}),mountFailures:s.map(S=>({...S})),storyFailures:rq().flatMap(S=>S.ok?[]:[{modulePath:S.modulePath,error:S.error}]),moduleSplits:dnn().map(S=>({path:S.path,urls:[...S.urls]})),adapter:u0(),readiness:X9t().map(S=>({...S})),readinessWarning:gsn(),worldAdoption:Ssn().map(S=>({...S})),presence:Esn(),pageErrors:Dsn(),consoleErrors:Psn(),sessionErrors:Isn(),sessionWarnings:Nsn(),rendererResources:{...hnn()},ontologyInvariants:n?.ontologyInvariants??y9t().map(S=>({...S})),...Krn(n),selectedEntityId:d[0]??null,selectedEntityIds:d,selectedCreationSite:zYr(t),selectedWriteAnchorKind:VYr(t),activeViewportTab:t.activeViewportTab,activeDocumentId:c,activeUtilityId:akr(),gameplaySession:{selectedSessionId:m.selectedSessionId,latestSessionId:m.sessions[0]?.id??null,selectedStatus:m.selectedSession?.status??null,cursorMs:m.cursorMs,liveEdgeMs:m.liveEdgeMs},openDocumentIds:l0().map(S=>S.descriptor.id),availableDocuments:ive().map(S=>({id:S.descriptor.id,category:S.category,default:S.default})),activeTabKey:(()=>{const S=Pp();return S&&XRt(S)?S:"__inspector__"})(),entityCount:g.length,savePath:Rze(t),saveState:IRt(t),entities:g,viewportActivationTimings:_Tr()}}function Y9t(t,n){const s=n instanceof Error?n.message:String(n),c=`editor command "${String(t.type)}" threw: ${s}`;return console.error(c,n),{ok:!1,error:c}}function RVe(t){const n=dVe();return!n||t<n.startedAt?!1:n.endedAt===null||t<=n.endedAt}function Dsn(){return Qs.getEntries().filter(t=>t.level==="error"&&t.source==="runtime"&&RVe(t.timestamp)).slice(-100).map(t=>t.count>1?`${t.message} (×${t.count})`:t.message)}const Yxt=200;function Psn(){return FVe(Qs.getEntries().filter(t=>t.level==="error"&&t.source!=="runtime"&&RVe(t.timestamp)))}function FVe(t){const n=t.reduce((c,d)=>c+d.count,0),s=t.slice(-3).map(c=>{const d=c.source?`[${c.source}] `:"",m=c.count>1?` (×${c.count})`:"",g=c.message.length>Yxt?`${c.message.slice(0,Yxt)}…`:c.message;return`${d}${g}${m}`});return{count:n,recent:s}}function Isn(){return FVe(Qs.getEntries().filter(t=>t.level==="error"&&!RVe(t.timestamp)))}function Nsn(){return FVe(Qs.getEntries().filter(t=>t.level==="warn"))}async function Osn(t){const n=t.src;if(typeof n!="string")return{ok:!1,error:`document-script requires a string "src" (the step's toString())`};const s=Pp();if(!s)return{ok:!1,error:"document-script: no document is active",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE"}};await y4t(s);const c=cQ(s);if(Pp()!==s)return{ok:!1,error:"document-script: the active document changed while its context was loading",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};if(c===void 0)return{ok:!1,error:`document-script: the active document (${s}) publishes no context to run against — a document opts in through its \`publishContext\` prop (the mesh document publishes its session).`,data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};let d;try{d=new Function("ctx","info",`return (${n})(ctx, info)`)}catch(m){return{ok:!1,error:`document-script: failed to reconstruct the step function from source — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}try{const m=await d(c,{documentId:s});return{ok:!0,data:{result:m===void 0?null:m}}}catch(m){return{ok:!1,error:`document-script: step threw — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}}async function Rsn(t,n,s){if(JYr(n.type),TYr()&&n.type!=="stop")return{ok:!1,error:"Video export owns this paused run. Stop it to cancel before another command."};const c=mVe(n);if(c)return c;if(n.type==="play"||n.type==="restart"){const g=zQ();if(g.length>0)return{ok:!1,error:`this project's ${g.length===1?"root":"roots"} did not mount, so there is nothing to ${n.type==="play"?"play":"restart"}: `+g.map(S=>`"${S.worldId}" (${S.identity}) — ${S.message}`).join("; ")}}const d=await WYr(n.type);if(d)try{const g=await d.handle(n);return{ok:g.ok,...g.error!==void 0?{error:g.error}:{},...g.data!==void 0?{data:g.data}:{}}}catch(g){return Y9t(n,g)}if(!fye(n.type))return{ok:!1,error:`unknown command type "${n.type}" — not one of the editor's own, and no package this project declares contributes it (or the editor page predates this CLI)`,data:{code:"UNKNOWN_COMMAND_TYPE"}};const m=n.type;switch(m){case"session-prepare-close":return await _nn(),{ok:!0};case"select":{const g=n.id??null;if(g!==null){const S=Kxt(t,g);if(S)return{ok:!1,error:S}}vOe(t,g?[g]:[],s);break}case"select-multiple":{const g=n.ids;for(const S of g){const k=Kxt(t,S);if(k)return{ok:!1,error:k}}vOe(t,g,s);break}case"select-all":{vOe(t,Y0e(t).map(g=>g.id),s);break}case"viewport-tab":{const g=n.tab;if(g!=="edit"&&g!=="play")return{ok:!1,error:`viewport-tab requires "edit" or "play", got ${String(g)}.`};const S=l0().map(A=>A.descriptor.id),k=g==="play"?S.find(A=>A===a0):S.find(A=>A==="workspace:scene")??S.find(A=>A!==a0);if(!k||!X0(k))return{ok:!1,error:g==="play"?"viewport-tab play: no Game document is open. Start Play first.":"viewport-tab edit: no document other than Game is open."};break}case"show-panel":try{const g=n.panel;return typeof g!="string"||g.trim()===""?{ok:!1,error:'show-panel requires a non-empty "panel".'}:{ok:!0,data:{panel:await v9t(g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"active-tab":{const g=n.key;if(g!=="__inspector__"&&!X0(g)){const S=l0().map(k=>k.descriptor.id);return{ok:!1,error:`No open workspace document with id "${g}" — nothing was activated. `+(S.length>0?`Open documents: ${S.join(", ")}.`:"No documents are open in this workspace.")}}break}case"select-asset":{const g=n.path;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:'select-asset requires a non-empty "path".'};const S=g.replace(/^\/+/,""),k=S.split("/").pop()??S,A=ig(k);BI({path:g,name:k,kind:FB(A)??"unknown",capabilities:A,origin:"project"});break}case"open-asset-tab":{const g=n.kind,S=sN(n.path,g);if(!await YRt(S,g))return{ok:!1,error:`Asset document did not finish mounting its Inspector: ${S}`};break}case"close-asset-tab":{const g=n.key;XRt(g)&&EN(g);break}case"toggle-command-palette":CVe();break;case"toggle-console":pve();break;case"page-reload":return setTimeout(()=>{window.location.reload()},0),{ok:!0,data:{scheduled:!0}};case"set-workspace":{const g=n.workspace;if(!kB(g))return{ok:!1,error:`set-workspace requires one of ${JBe().join(", ")}, got ${String(g)}.`};if(zS()===g)return{ok:!0,data:{workspace:g,applied:!0}};const S=SDt().then(()=>!0);a2(g);const k=await Promise.race([S,new Promise(A=>setTimeout(()=>A(!1),3e3))]);return{ok:!0,data:{workspace:g,applied:k}}}case"set-style":{const g=n.style,S=OR().map(A=>A.id);if(typeof g!="string"||!S.includes(g))return{ok:!1,error:`set-style requires one of ${S.join(", ")}, got ${String(g)}.`};ZBe(g);const k=Nhe();return k!==g?{ok:!1,error:`set-style applied "${g}" but the editor is wearing ${k===null?"a custom mix of axes":`"${k}"`} (${_gt(g).join("; ")}).`,data:{style:k,differences:_gt(g)}}:{ok:!0,data:{style:g}}}case"viewport-presentation":{const g=n.documentId;if(typeof g!="string"||g==="")return{ok:!1,error:"viewport-presentation needs a `documentId` (a document stage)."};const S=F_e(g)===null&&F_e(`document:${g}`)!==null?`document:${g}`:g,k=n.layer;if(k!==void 0){if(typeof k!="object"||k===null)return{ok:!1,error:"viewport-presentation `layer` must be a presentation layer object."};QBe(S,k)}const A=n.preset;return A!==void 0&&(typeof A!="string"||!kAr(S,A))?{ok:!1,error:`viewport-presentation \`preset\` must be one of: ${hgt().map(F=>F.id).join(", ")||"(none registered)"}.`}:{ok:!0,data:{presentation:e$e(S),binding:F_e(S),bound:IAr(),lastDraw:PAr(S),presets:wAr().map(F=>F.id),viewPresets:hgt().map(F=>F.id),environmentImages:MAr().map(F=>F.id)}}}case"set-appearance":{const g=n.material;return g===void 0?{ok:!1,error:"set-appearance needs a `material` to set."}:Bye(g)?(DDt(g),{ok:!0,data:{material:_N(),style:Nhe()}}):{ok:!1,error:`set-appearance material must be one of ${FTr().map(k=>k.id).join(", ")}, got ${String(g)}.`}}case"present-view":try{return{ok:!0,data:{...await Vge(t,n.view)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"current-view":return{ok:!0,data:{view:ote(t)}};case"inspect":return{ok:!0,data:{subject:dve(t)}};case"run-inspection-action":try{const g=n.actionId;if(typeof g!="string"||g.trim()==="")throw new Error("run-inspection-action requires a non-empty actionId.");return{ok:!0,data:{subject:await psn(t,g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"run-command":try{const g=n.commandId;if(typeof g!="string"||g.trim()==="")throw new Error("run-command requires a non-empty commandId.");const S=await tin(g,n.args);return{ok:!0,data:{result:S===void 0?null:S}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"hierarchy":{const g=xxt();return g===null?{ok:!1,error:"the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to report. Open the Hierarchy panel in the workspace dock and retry."}:{ok:!0,data:{hierarchy:enn(g,{playState:t.playState,activeViewportTab:t.activeViewportTab})}}}case"expand-hierarchy-all":case"collapse-hierarchy-all":{const g=n.type==="expand-hierarchy-all",S=xxt();if(S===null)return{ok:!1,error:`the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to ${g?"expand":"collapse"}. Open the Hierarchy panel in the workspace dock and retry.`};const k=Zrn();g?S.expandAll():S.collapseAll();try{await k}catch(A){return{ok:!1,error:A instanceof Error?A.message:String(A)}}return{ok:!0,data:{}}}case"undo":case"redo":{const g=s?.history;if(!g)return{ok:!1,error:`${String(n.type)}: this editor has no history session attached, so there is nothing to undo.`};const S=n.type==="undo"?await g.undo():await g.redo(),k=g.getSnapshot();return{ok:!0,data:{moved:S,canUndo:k.canUndo,canRedo:k.canRedo,undoLabel:k.undoLabel,redoLabel:k.redoLabel}}}case"set-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("set-inspection-field requires a non-empty field path.");const S=await msn(t,g,n.value);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"remove-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("remove-inspection-field requires a non-empty field path.");const S=await hsn(t,g);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return g instanceof fje?{ok:!1,error:g.message,data:{code:"REMOVAL_UNAVAILABLE"}}:{ok:!1,error:g instanceof Error?g.message:String(g)}}case"structure-op":try{const g=String(n.op??""),S=Cm(t).adapter,k=Fze(t),A=Array.isArray(n.ids)?n.ids.filter(G=>typeof G=="string"):typeof n.id=="string"&&n.id.trim()!==""?[n.id]:k,F=A[0],D=()=>{if(!F)throw new Error(`structure-op "${g}" needs an id or a selected row.`);return F},J=G=>typeof n[G]=="string"&&n[G].trim()!==""?n[G]:void 0,$=S.structure;if(!$)return{ok:!1,error:"structure-op: the active authoring adapter exposes no structure provider."};switch(g){case"create":{const G=J("kind");if(!G)return{ok:!1,error:'structure-op "create" needs a `kind`.'};const se=t0e(S,G,J("parentId"));return{ok:!0,data:{id:se.id,write:await se.ack}}}case"delete":return{ok:!0,data:{write:A.length>1&&$.removeMany?await d$e(S,A):await jhe(S,D())}};case"duplicate":{if(A.length>1&&$.duplicateMany)return{ok:!0,data:{write:await bPt(S,A)}};const G=r0e(S,D());return{ok:!0,data:{id:G.id,write:await G.ack}}}case"reparent":{const G=J("parentId")??null;return{ok:!0,data:{write:await QO(S,D(),G)}}}case"reorder":{if(!$.reorder)return{ok:!1,error:"structure-op: this adapter has no `reorder`."};const G=J("beforeSiblingId")??null;return{ok:!0,data:{write:await p$e(S,D(),G)}}}case"wrap":return $.wrap?{ok:!0,data:{write:await n0e(S,D(),J("tag"))}}:{ok:!1,error:"structure-op: this adapter has no `wrap`."};case"unwrap":return $.unwrap?{ok:!0,data:{write:await i0e(S,D())}}:{ok:!1,error:"structure-op: this adapter has no `unwrap`."};case"group":{if(!$.group)return{ok:!1,error:"structure-op: this adapter has no `group`."};const G=o0e(S,A);return{ok:!0,data:{id:G.id,write:await G.ack}}}case"ungroup":{if(!$.ungroup)return{ok:!1,error:"structure-op: this adapter has no `ungroup`."};const G=_$e(S,D());return{ok:!0,data:{ids:G.ids,write:await G.ack}}}case"copy":return $.copy?{ok:!0,data:{copied:await s0e(S,A)}}:{ok:!1,error:"structure-op: this adapter has no `copy`."};case"cut":{if(!$.cut)return{ok:!1,error:"structure-op: this adapter has no `cut`."};const G=await a0e(S,A);return G===!1?{ok:!1,error:'structure-op "cut" was refused by the adapter.'}:{ok:!0,data:{write:G}}}case"paste":{if(!$.paste)return{ok:!1,error:"structure-op: this adapter has no `paste`."};const G=J("parentId")??(F?S.hierarchy.node(F)?.parentId??null:null),se=await c0e(S,G);return se===!1?{ok:!1,error:'structure-op "paste" was refused by the adapter.'}:{ok:!0,data:{write:se}}}default:return{ok:!1,error:`structure-op: unknown op ${JSON.stringify(g)}. Known ops: create, delete, duplicate, reparent, reorder, wrap, unwrap, group, ungroup, copy, cut, paste.`}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"document-probe":try{return{ok:!0,data:{...await Jrn(n.step)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"capture-active-document":{const g=qDr(n);if("error"in g)return{ok:!1,error:g.error};try{n.view&&await Vge(t,n.view);const S=await b9t(t,g.size);return inn(S.base64),{ok:!0,data:{...S}}}catch(S){return{ok:!1,error:S instanceof Error?S.message:String(S)}}}case"capture-editor-chrome":{const g=n.scale;if(g!==void 0&&(typeof g!="number"||!(g>0)||g>4))return{ok:!1,error:`capture-editor-chrome: "scale" must be a number greater than 0 and no more than 4 (output pixels per CSS pixel; the frame crosses the relay as base64 PNG). It defaults to the page's own devicePixelRatio.`};const S=n.region;if(S!==void 0&&S!=="page"&&S!=="document")return{ok:!1,error:'capture-editor-chrome: "region" is "page" or "document".'};try{return{ok:!0,data:{...await Hrn(t,{...g===void 0?{}:{scale:g},...S===void 0?{}:{region:S}})}}}catch(k){return{ok:!1,error:k instanceof Error?k.message:String(k)}}}case"document-table":{const g=u0();return g?{ok:!0,data:{default:g.scenes.default??null,entries:g.scenes.entries,pending:g.documentsPending===!0}}:{ok:!1,error:"The project adapter has not resolved yet — no document table to list.",data:{code:"SCENE_TABLE_UNAVAILABLE"}}}case"open":{const g=n.id;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:"open requires a non-empty scene-table entry id."};const S=ste(),k=S?u0()?.scenes.entries.find(J=>J.id===g&&PN(J.kind)===void 0):void 0,A=S?async J=>await n9t(J)??{ok:!1,error:"No running lane can remount with a selection."}:void 0,D=(k?await vsn(k,{scenes:hVe,activateGameDocument:()=>X0(a0),gameDocumentId:a0,...A?{remountSelection:A}:{}}):null)??await Ltn(g);return D.ok?{ok:!0,data:{documentId:D.documentId,title:D.title,..."scene"in D&&D.scene?{scene:D.scene}:{},..."restart"in D&&D.restart?{restart:!0}:{}}}:{ok:!1,error:D.error,data:{code:D.code,...D.known===void 0?{}:{known:[...D.known]}}}}case"document-script":return Osn(n);default:return{ok:!1,error:`unknown command type "${String(m)}" — editor page predates this CLI`,data:{code:"UNKNOWN_COMMAND_TYPE"}}}return{ok:!0}}function Fsn(t,n){const s=jD();let c=null,d=-1;const m=new Set;let g=!1,S=null,k=null,A=null;const F=()=>{n_e()===null&&(c=Xxt(t),d=t.contentVersion,HSt(c))};let D=null;const J=()=>{S!==null&&(clearTimeout(S),S=null),D?.(),D=null},$=()=>{k=null,A!==null&&clearTimeout(A),A=null},G=()=>{$(),g=!0,J(),S=setTimeout(()=>{S=null,D=Txt(()=>{D=null,g=!1,F()})},250)},se=vn=>{if(t.contentVersion!==vn){G();return}$(),k=vn,A=setTimeout($,1e3)},pe=()=>ste()&&t.playState==="playing",ue=vn=>{(vn!==null||k!==null&&t.contentVersion!==k||g&&t.contentVersion!==d)&&G()},Ce=(vn,Yr,en)=>pe()?(Csn(en,vn,t.contentVersion,d)&&(vn==="explicit"?G():vn==="if-content-changed"?se(Yr??t.contentVersion):ue(Yr)),!0):!1,De=(vn="always",Yr="none",en=null)=>{if(n_e()!==null)return;if(c===null){F();return}const ii=Xxt(t,c);c=ii,HSt(Asn(ii)),vn!=="none"&&(Ce(Yr,en,vn)||(J(),$(),g=!1,!(vn==="if-content-changed"&&t.contentVersion===d)&&D===null&&(D=Txt(()=>{D=null,F()}))))};let Pe=!1,be=!1,X=t.playState;const we=vn=>{vn&&(be=!0),!Pe&&(Pe=!0,queueMicrotask(()=>{Pe=!1;const Yr=be;be=!1;const en=X!==t.playState;X=t.playState,De(Yr?"always":"if-content-changed",en&&t.playState==="playing"?"explicit":"none")}))},qe=()=>we(!1),bt=()=>we(!0),Pt=t.subscribe(qe),Wt=SVe(bt),zt=OC(bt),ft=dTr(bt);F(),i_e(!0),cEr(WZr),s.addEventListener("open",()=>{De("if-content-changed"),i_e(n_e()===null)});const tr=Lze(vn=>{i_e(vn===null)});s.addEventListener("editor-command",vn=>{try{const Yr=JSON.parse(vn.data),en=Yr._requestId,ii=t.contentVersion,No=n_e();if(No!==null){const En=sZr(No,String(Yr.type));en&&GSt(en,!1,En);return}en&&UZr(en);let gn;Rsn(t,Yr,{deferPresentation:En=>{gn=En},...n?{history:n}:{}}).catch(En=>Y9t(Yr,En)).then(En=>{if(en){const On=GSt(en,En.ok,En.error,En.data,gn!==void 0);if(gn){const ji=()=>window.setTimeout(gn,0);On.then(ji,ji)}}else gn&&window.setTimeout(gn,0);const cs=Tsn(Yr,En.ok,m);De(cs.derived,cs.playFullReport,ii)})}catch{}}),s.addEventListener("project-changed",()=>{window.location.reload()});const Qt=()=>De();document.addEventListener("visibilitychange",Qt),window.addEventListener("focus",Qt),window.addEventListener("blur",Qt);const Tt=()=>setTimeout(Qt,0);return window.addEventListener("error",Tt),window.addEventListener("unhandledrejection",Tt),()=>{i_e(!1),D?.(),D=null,S!==null&&clearTimeout(S),S=null,$(),tr(),Pt(),Wt(),zt(),ft(),document.removeEventListener("visibilitychange",Qt),window.removeEventListener("focus",Qt),window.removeEventListener("blur",Qt),window.removeEventListener("error",Tt),window.removeEventListener("unhandledrejection",Tt),s.close()}}function Msn(t,n,s){return Ye.createContext(s)}const LD=Msn(void 0,"EditorContext",null);function jsn({runtime:t,children:n}){const s=Ye.useMemo(()=>({begin:()=>{},end:()=>{}}),[]);return q.jsx(LD.Provider,{value:t,children:q.jsx(f4t.Provider,{value:s,children:q.jsx(Ye.Suspense,{children:n})})})}function Yv(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStore must be used within <EditorProvider>");return t.store}function GSn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStats must be used within <EditorProvider>");return t.stats}function Lsn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorInit must be used within <EditorProvider>");return t.initPromise}function Z9t(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryService must be used within <EditorProvider>");return t.session.history}function Bsn(){return Ye.useContext(LD)?.session.history??null}function KSn(){return Ye.useContext(LD)?.store??null}function XSn(){return Ye.useContext(LD)?.stats??null}function mve(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryCommands must be used within <EditorProvider>");return t.session.historyCommands}function Q9t(){const t=mve();return Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}function $sn(t,n){return t==="selection"&&n==="selection"?"selection":"content"}class qsn{_viewportSelections={edit:new Set,play:new Set};_history=null;_playState="stopped";_playEditRegime=null;_followsWorkspaceFocus;constructor(n={}){if(this._followsWorkspaceFocus=n.followsWorkspaceFocus===!0,!this._followsWorkspaceFocus)return;let s=this.activeViewportTab;o2(()=>{const c=this.activeViewportTab;c!==s&&(s=c,this._notify())})}_listeners=new Set;_deferredNotifyTimer=null;_deferredNotifyScope="content";_version=0;_shellVersion=0;_contentVersion=0;_hierarchyRowFacetVersion=0;subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;getShellSnapshot=()=>this._shellVersion;get contentVersion(){return this._contentVersion}get hierarchyRowFacetVersion(){return this._hierarchyRowFacetVersion}get projectHistory(){return this._history}_notify(n="content",s="shell",c=n!=="selection"){this._deferredNotifyTimer!==null&&(clearTimeout(this._deferredNotifyTimer),this._deferredNotifyTimer=null),this._beforeNotify(),this._version++,s==="shell"&&this._shellVersion++,n!=="selection"&&this._contentVersion++,c&&this._hierarchyRowFacetVersion++;for(const d of this._listeners)d()}_transformMode="combined";_transformSpace="world";_snapEnabled=!1;_snapValues={translate:1,rotate:15,scale:.25};_snapToSurface=!1;_rotationSnap=!1;_snap2D={step:8,offsetX:0,offsetY:0,primaryEvery:8,rotationOffset:0,rotationStep:15,scaleStep:.1,relative:!1,pixel:!0};_scaleSnap=!1;_smartSnap={enabled:!1,parent:!0,others:!0,guides:!0,sides:!0,center:!0};_preserveChildrenTransform=!1;_pivotMode="active-element";_gizmoAnchor="auto";_showHelpers=!0;_helperVisibility={bounds:!1,lights:!0,cameras:!0,colliders:!0,joints:!0,particles:!0,lod:!0,audio:!0,splines:!0,navmesh:!0,constraints:!0,reflectionProbes:!0,triggerVolumes:!0,skeletons:!1,weights:!1,cursor:!0,empties:!0};get transformMode(){return this._transformMode}get transformSpace(){return this._transformSpace}get snapEnabled(){return this._snapEnabled}get snapValues(){return this._snapValues}get snapToSurface(){return this._snapToSurface}get snap2D(){return this._snap2D}setSnap2D(n){this._snap2D={...this._snap2D,...n},this._notify()}get rotationSnap(){return this._rotationSnap}get scaleSnap(){return this._scaleSnap}setRotationSnap(n){this._rotationSnap=n,this._notify()}setScaleSnap(n){this._scaleSnap=n,this._notify()}get smartSnap(){return this._smartSnap}get preserveChildrenTransform(){return this._preserveChildrenTransform}get pivotMode(){return this._pivotMode}get gizmoAnchor(){return this._gizmoAnchor}get showHelpers(){return this._showHelpers}get helperVisibility(){return this._helperVisibility}setTransformMode(n){this._transformMode=n,this._notify()}setTransformSpace(n){this._transformSpace=n,this._notify()}toggleSnap(){this._snapEnabled=!this._snapEnabled,this._notify()}setSnapValues(n){this._snapValues={...this._snapValues,...n},this._notify()}setSmartSnap(n){this._smartSnap={...this._smartSnap,...n},this._notify()}toggleSnapToSurface(){this._snapToSurface=!this._snapToSurface,this._notify()}togglePreserveChildrenTransform(){this._preserveChildrenTransform=!this._preserveChildrenTransform,this._notify()}setPivotMode(n){this._pivotMode=n,this._notify()}setGizmoAnchor(n){this._gizmoAnchor=n,this._notify()}toggleHelpers(){this._showHelpers=!this._showHelpers,this._notify()}toggleHelperType(n){this._helperVisibility[n]=!this._helperVisibility[n],this._helperVisibility[n]&&(this._showHelpers=!0),this._notify()}_viewportActionListeners=new Set;onViewportAction=n=>(this._viewportActionListeners.add(n),()=>this._viewportActionListeners.delete(n));requestViewportAction(n){for(const s of this._viewportActionListeners)s(n)}focusOnEntity(n){this.requestViewportAction({type:"focus-entity",id:n})}focusOnSelection(){this.requestViewportAction({type:"focus-selection"})}frameAll(){this.requestViewportAction({type:"frame-all"})}zoomView(n){this.requestViewportAction({type:"zoom-view",direction:n})}focusOnScene(){this.requestViewportAction({type:"focus-scene"})}snapSelectionToFloor(){this.requestViewportAction({type:"snap-selection-to-floor"})}setViewPreset(n){this.requestViewportAction({type:"set-view-preset",preset:n})}stepView(n){this.requestViewportAction({type:"step-view",step:n})}toggleCameraView(){this.requestViewportAction({type:"toggle-camera-view"})}toggleProjection(){this.requestViewportAction({type:"toggle-projection"})}setCameraPose(n,s,c){this.requestViewportAction({type:"set-camera-pose",position:n,target:s,...c!==void 0?{fov:c}:{}})}notifyChange(n="content",s="shell",c=n!=="selection"){this._notify(n,s,c)}_notifyDeferred(n="content"){if(this._deferredNotifyTimer!==null){this._deferredNotifyScope=$sn(this._deferredNotifyScope,n);return}this._deferredNotifyScope=n,this._deferredNotifyTimer=setTimeout(()=>{this._deferredNotifyTimer=null;const s=this._deferredNotifyScope;this._deferredNotifyScope="content",this._notify(s)},0)}attachHistory(n){if(this._history!==n){if(this._history)throw new Error("EditorStore is already attached to project history.");this._history=n,this._onHistoryAttached()}}get selectedEntityId(){const n=this._viewportSelections[this.activeViewportTab];return n.size===0?null:[...n].at(-1)}get selectedEntityIds(){return this._viewportSelections[this.activeViewportTab]}get canUndo(){return this._history?.getSnapshot().canUndo??!1}get canRedo(){return this._history?.getSnapshot().canRedo??!1}notifyIngestEdit(){this._notify()}get playState(){return this._playState}_blockedDuringPlay(n){return this._playState==="stopped"?!1:(console.warn(`EditorStore: "${n}" is disabled during play mode — stop the game first.`),!0)}setPlayState(n){const s=this._playState!=="stopped";this._playState=n,n==="stopped"&&s&&this._onPlayStopped(),this._notify()}get playEditRegime(){return this._playEditRegime}setPlayEditRegime(n){this._playEditRegime=n,this._notify()}get activeViewportTab(){return this._followsWorkspaceFocus&&Pp()===a0?"play":"edit"}select(n,s="immediate"){const c=this._viewportSelections[this.activeViewportTab];c.clear(),n&&c.add(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}selectMultiple(n,s="immediate"){this._viewportSelections[this.activeViewportTab]=new Set(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}applySelectionBeforePresentation(n){this._viewportSelections[this.activeViewportTab]=new Set(n);let s=!1;return()=>{s||(s=!0,this._notify("selection"))}}addToSelection(n){this._viewportSelections[this.activeViewportTab].add(n),this._notify("selection")}toggleSelection(n){const s=this._viewportSelections[this.activeViewportTab];s.has(n)?s.delete(n):s.add(n),this._notify("selection")}_beforeNotify(){}_onHistoryAttached(){}_onPlayStopped(){}}class zsn{constructor(n){this.history=n,this.snapshot=this.buildSnapshot(),this.unsubscribeHistory=n.subscribe(this.notify)}tail=Promise.resolve();listeners=new Set;pending=0;version=0;disposed=!1;idleWaiters=new Set;unsubscribeHistory;snapshot;subscribe=n=>this.disposed?()=>{}:(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.snapshot;undo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.undo()))}redo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.redo()))}jumpTo(n){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.jumpTo(n)))}get canUndo(){return this.snapshot.canUndo}get canRedo(){return this.snapshot.canRedo}dispose(){if(this.disposed)return;this.disposed=!0,this.unsubscribeHistory();const n=new Error("History commands are disposed.");for(const s of this.idleWaiters)s.unsubscribe(),s.reject(n);this.idleWaiters.clear(),this.listeners.clear(),this.notify()}enqueue(n){if(this.disposed)return Promise.reject(new Error("History commands are disposed."));this.pending++,this.notify();const s=()=>{if(this.disposed)throw new Error("History commands are disposed.");return n()},c=this.tail.then(s,s);return this.tail=c.then(()=>{},()=>{}),c.finally(()=>{this.pending--,this.notify()})}assertNotDisposed(){if(this.disposed)throw new Error("History commands are disposed.")}waitForServiceIdle(){return this.disposed?Promise.reject(new Error("History commands are disposed.")):this.history.getSnapshot().busy?new Promise((n,s)=>{const c={unsubscribe:()=>{},reject:s},d=()=>{c.unsubscribe(),this.idleWaiters.delete(c)};c.unsubscribe=this.history.subscribe(()=>{this.history.getSnapshot().busy||(d(),n())}),this.idleWaiters.add(c)}):Promise.resolve()}notify=()=>{this.version++,this.snapshot=this.buildSnapshot();for(const n of this.listeners)n()};buildSnapshot(){const n=this.history.getSnapshot(),s=this.pending>0||n.busy;return{version:this.version,busy:s,canUndo:!this.disposed&&!s&&n.canUndo,canRedo:!this.disposed&&!s&&n.canRedo,undoLabel:n.undoLabel,redoLabel:n.redoLabel}}}function Vsn(t){let n=t.getSnapshot().limitWarning,s=t.getSnapshot().lastEviction;return t.subscribe(()=>{const{limitWarning:c,lastEviction:d}=t.getSnapshot();c!==n&&(n=c,c&&(i0(c.message),Qs.warn(c.message,"history"))),d!==s&&(s=d,d&&Qs.warn(d.message,"history"))})}class Usn{constructor(n,s={}){this.projectIdentity=n,this.history=new TDr(s),this.historyCommands=new zsn(this.history),this.releaseLimitNotices=Vsn(this.history)}history;historyCommands;releaseLimitNotices;dispose(){this.releaseLimitNotices(),this.historyCommands.dispose(),this.history.dispose()}}function Jsn(){return eMt}let eMt=Promise.resolve();function tMt(){const t=Wsn();return eMt=t.then(()=>{},()=>{}),t}async function Wsn(){await rMt()}async function rMt(){const t=wf();if(t){Qs.log(`Opened project: ${t.config.name}`,"project");return}try{const n=await wFt();n&&Qs.log(`Opened project: ${n.config.name}`,"project")}catch{}}const nMt=Object.freeze(Object.defineProperty({__proto__:null,bootstrapProject:tMt,initProject:rMt,projectBootstrapSettled:Jsn},Symbol.toStringTag,{value:"Module"}));function bOe(t){return Promise.reject(new Error(`This editor tier cannot ${t}.`))}const iMt={openPersistence:()=>bOe("persist Asset Lab documents"),replaceSource:()=>bOe("write project source"),saveThumbnailFraming:()=>bOe("write project thumbnail framing")};let yme=iMt;function Hsn(t){if(yme!==t){if(yme!==iMt)throw new Error("An Object3D document write policy is already installed.");yme=t}}function Gsn(){return yme}function Ksn(){let t=0;const n=async()=>{const c=++t,d=wf();if(d)try{const m=await zze();if(m.status!=="project"||m.project.path!==d.rootPath)return;const g=m.project.config;if(c!==t||wf()!==d)return;_Le({...d,config:g})}catch(m){c===t&&wf()===d&&console.error("[project] Could not refresh project declarations:",m)}},s=den(()=>void n());return()=>{t++,s()}}function Xsn(){return Lvr(()=>{bVe(),E3r(null),Jwr(),Hnn(),gTr(),L3t(),xtn(),oD()})}async function Ysn(){typeof performance<"u"&&performance.getEntriesByType("navigation").length>0&&await Promise.race([jye(),new Promise(n=>setTimeout(n,5e3))]),await mN()}function Zsn(){Ysn();const t=IC(()=>void mN()),n=hFt(()=>void mN());return()=>{t(),n()}}const Qsn={tools:[],contributions:[],loadErrors:[]};let oMt=Qsn,sMt=0;const pje=new Set;function Zxt(t){oMt=t,sMt++;for(const n of pje)n()}function N$(){return oMt}function ean(){return sMt}function aMt(t){return pje.add(t),()=>pje.delete(t)}async function WZ(){try{const t=await fetch("/__editor/project-tools"),n=await L_(t,"Catalog request failed");return Zxt(n),n}catch(t){const n={tools:[],contributions:[],loadErrors:[{sourcePath:"package.json#volter.tools",message:t instanceof Error?t.message:String(t)}]};return Zxt(n),n}}async function tan(t,n,s={}){const c=await fetch("/__editor/project-tools/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,input:n,confirm:s.confirm===!0})}),d=await L_(c,`Running the project tool ${JSON.stringify(t)} failed`);if(!d||typeof d!="object"||typeof d.ok!="boolean")throw new Error(`Tool request returned an invalid response (${c.status}).`);return d}function ran(){WZ();const t=IC(()=>void WZ()),n=hFt(()=>void WZ());return()=>{t(),n()}}const Gge=new Map;function nan(t,n){if(n===null){Gge.delete(t);return}Gge.set(t,n),ian()}const Qxt=128;let mZ=[],HZ=null,cMt=0,vme=!1;function ian(){if(vme)return()=>{};if(typeof PerformanceObserver>"u")return()=>{};let t;try{t=new PerformanceObserver(n=>{for(const s of n.getEntries()){const c=s.duration;(HZ===null||c>HZ)&&(HZ=c),c>=100&&(cMt+=1),mZ.push({start:s.startTime,duration:c}),mZ.length>Qxt&&(mZ=mZ.slice(-Qxt))}}),t.observe({type:"longtask",buffered:!0})}catch{return()=>{}}return vme=!0,()=>{t.disconnect(),vme=!1}}function oan(){return vme?{longestTaskMs:HZ===null?null:Math.round(HZ),tasksOver100ms:cMt}:null}function san(t=performance.now()){if(Gge.size===0)return null;const n={};for(const[s,c]of Gge){const d=c(),m=d.lastCallWindow;let g=null;if(m!==null){const S=m.end??t;for(const k of mZ)k.start+k.duration<m.start||k.start>S||(g===null||k.duration>g)&&(g=k.duration)}n[s]={inFlightMs:d.inFlightMs,lastCallMs:d.lastCallMs,maxCallMs:d.maxCallMs,callsOver5s:d.callsOver5s,callsOver30s:d.callsOver30s,lastCallLongestTaskMs:g===null?null:Math.round(g),wasmMemoryMB:d.wasmMemoryMB}}return n}function ewt(t){return!("unavailable"in t)}function aan(t=globalThis.performance){const n=t?.memory;return!n||typeof n.usedJSHeapSize!="number"||typeof n.totalJSHeapSize!="number"?{unavailable:"performance.memory is unavailable — it is a non-standard Chromium-only API, not exposed by this browser."}:{usedBytes:n.usedJSHeapSize,totalBytes:n.totalJSHeapSize,limitBytes:typeof n.jsHeapSizeLimit=="number"?n.jsHeapSizeLimit:null}}const can=5e3,lan=4,uan=1024*1024;function SOe(t){return Math.round(t/uan*100)/100}function fan(t){const n=t.heap(),s=t.canvases(),c=t.rendererCounts(),d=t.workerCalls?.()??null,m=t.stalls?.()??null;let g=0;for(const S of s)g+=S.width*S.height*lan;return{heapUsedMB:ewt(n)?SOe(n.usedBytes):null,heapLimitMB:ewt(n)&&n.limitBytes!==null?SOe(n.limitBytes):null,mountEpochs:t.mountEpochs(),canvases:s.length,canvasMB:SOe(g),...d===null?{}:{workerCalls:d},...m===null?{}:{stalls:m},...c===null?{}:{textures:c.textures,geometries:c.geometries,...c.programs===null?{}:{programs:c.programs}}}}function dan(t){const n=new Set;for(const s of t)try{const c=new URL(s.name,"http://volter.invalid").searchParams.get(Rge);c!==null&&c.length>0&&n.add(c)}catch{}return n.size}function pan(){return{heap:()=>aan(),mountEpochs:()=>dan(performance.getEntriesByType("resource")),canvases:()=>[...document.querySelectorAll("canvas")],rendererCounts:()=>tTr()?.memorySnapshot?.().counts??null,workerCalls:()=>san(),stalls:()=>oan()}}let lMt=null;function YSn(){return lMt}function _an(t){const n=t.sources??pan(),s=t.hidden??(()=>document.visibilityState==="hidden"),c=()=>{if(s())return;const m=fan(n);lMt=m,t.report(m)};c();const d=setInterval(c,t.intervalMs??can);return()=>clearInterval(d)}function man({children:t}){const n=Ye.useRef(null);n.current||(n.current=new qsn({followsWorkspaceFocus:!0}),eQr(n.current));const s=Ye.useRef(null);if(!s.current){const g=wf();s.current=new Usn(g?.rootPath??"unknown-project")}n.current.attachHistory(s.current.history),Hsn($Dr);const c=Ye.useRef(null);c.current||(c.current={fps:0,frameTime:0,drawCalls:0,triangles:0,cameraPosition:{x:0,y:0,z:0},cameraTarget:{x:0,y:0,z:0}});const d=Ye.useRef(null);d.current||(d.current=tMt()),Ye.useEffect(()=>Fsn(n.current,s.current.historyCommands),[]),Ye.useEffect(()=>Zsn(),[]),Ye.useEffect(()=>ran(),[]),Ye.useEffect(()=>otn(),[]),Ye.useEffect(()=>Ksn(),[]),Ye.useEffect(()=>Xsn(),[]),Ye.useEffect(()=>Mtn(),[]),Ye.useEffect(()=>_an({report:bZr}),[]);const m=Ye.useRef(!1);return Ye.useEffect(()=>{m.current=!0;const g=s.current;return()=>{m.current=!1,queueMicrotask(()=>{m.current||g.dispose()})}},[]),q.jsx(jsn,{runtime:{store:n.current,stats:c.current,initPromise:d.current,session:s.current},children:t})}const Kge={x:0,y:0,zoom:1};function ZSn(t=Kge){let n=t;const s=new Set,c=()=>{for(const d of s)d()};return{get:()=>n,setView:(d,m,g)=>{const S=Math.min(4,Math.max(.1,g));n.x===d&&n.y===m&&n.zoom===S||(n={x:d,y:m,zoom:S},c())},setPan:(d,m)=>{const g=n.zoom;n.x===d&&n.y===m||(n={x:d,y:m,zoom:g},c())},setZoom:d=>{const m=Math.min(4,Math.max(.1,d));n.zoom!==m&&(n={x:n.x,y:n.y,zoom:m},c())},reset:()=>{n.x===0&&n.y===0&&n.zoom===1||(n=Kge,c())},subscribe:d=>(s.add(d),()=>s.delete(d))}}let n2=Kge;const _je=new Set,QSn={get:()=>han(),setView:(t,n,s)=>MVe(t,n,s),setPan:(t,n)=>fMt(t,n),setZoom:t=>gan(t),reset:()=>dMt(),subscribe:t=>yan(t)};function uMt(){for(const t of _je)t()}function han(){return n2}function MVe(t,n,s){const c=Math.min(4,Math.max(.1,s));n2.x===t&&n2.y===n&&n2.zoom===c||(n2={x:t,y:n,zoom:c},uMt())}function fMt(t,n){MVe(t,n,n2.zoom)}function gan(t){MVe(n2.x,n2.y,t)}function exn(t,n){fMt(n2.x+t,n2.y+n)}function dMt(){n2.x===0&&n2.y===0&&n2.zoom===1||(n2=Kge,uMt())}function yan(t){return _je.add(t),()=>_je.delete(t)}function txn(t){if(!(t.x===0&&t.y===0&&t.zoom===1))return t.zoom===1?`translate(${t.x}px, ${t.y}px)`:t.x===0&&t.y===0?`scale(${t.zoom})`:`translate(${t.x}px, ${t.y}px) scale(${t.zoom})`}const van=new Set(["opacity","zIndex","flexGrow","flexShrink","fontWeight","lineHeight"]);function ban(t){if(typeof t=="number")return t;if(typeof t!="string"||t==="")return;const n=Number.parseFloat(t);return Number.isNaN(n)?void 0:n}function rxn(t,n){if(typeof t!="number"||typeof n!="string")return t;const s=n.trim().match(/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?([a-z]+|%)$/i)?.[1];return s&&s.toLowerCase()!=="px"?`${t}${s}`:t}function nxn(t,n){return typeof n!="number"?n:n===0||van.has(t)?String(n):`${n}px`}const San={hidden:!1,interactive:!1,pickLock:!1},pMt=new Map;function hve(t){return pMt.get(t)??San}function jVe(t,n){pMt.set(t,{...hve(t),...n})}function oq(t){return hve(t).hidden}function xan(t,n){jVe(t,{hidden:n})}function wan(t){xan(t,!oq(t))}function _Mt(t){return hve(t).interactive}function Tan(t,n){jVe(t,{interactive:n})}function Can(t){Tan(t,!_Mt(t))}function mMt(t){return hve(t).pickLock}function Ean(t,n){jVe(t,{pickLock:n})}function kan(t){Ean(t,!mMt(t))}const twt=8,wN=8,ixn=[{pos:"nw",cursor:"nwse-resize"},{pos:"n",cursor:"ns-resize"},{pos:"ne",cursor:"nesw-resize"},{pos:"w",cursor:"ew-resize"},{pos:"e",cursor:"ew-resize"},{pos:"sw",cursor:"nesw-resize"},{pos:"s",cursor:"ns-resize"},{pos:"se",cursor:"nwse-resize"}];function oxn(t,n){const s=t.x+t.width/2,c=t.y+t.height/2;switch(n){case"nw":return{x:t.x,y:t.y};case"n":return{x:s,y:t.y};case"ne":return{x:t.x+t.width,y:t.y};case"w":return{x:t.x,y:c};case"e":return{x:t.x+t.width,y:c};case"sw":return{x:t.x,y:t.y+t.height};case"s":return{x:s,y:t.y+t.height};case"se":return{x:t.x+t.width,y:t.y+t.height}}}function iA(t,n){return n?Math.round(t):Math.round(t/twt)*twt}function hMt(t,n,s,c,d){let m=Math.max(wN,iA(n.width+t,s)),g=null;return c.length&&(g=vve(n.x+m,c,d),g&&(m=Math.max(wN,g.edge-n.x))),{value:m,match:g}}function gMt(t,n,s,c,d){const m=n.x+n.width;let g=Math.max(wN,iA(n.width-t,s)),S=null;return c.length&&(S=vve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,eastEdge:m,match:S}}function yMt(t,n,s,c,d){let m=Math.max(wN,iA(n.height+t,s)),g=null;return c.length&&(g=vve(n.y+m,c,d),g&&(m=Math.max(wN,g.edge-n.y))),{value:m,match:g}}function vMt(t,n,s,c,d){const m=n.y+n.height;let g=Math.max(wN,iA(n.height-t,s)),S=null;return c.length&&(S=vve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,southEdge:m,match:S}}function Aan(t,n,s,c,d,m,g){if(t==="e"||t==="ne"||t==="se")return{width:hMt(n,s,d,m,g).value};if(t==="w"||t==="nw"||t==="sw"){const{value:S,eastEdge:k}=gMt(n,s,d,m,g);return c?{width:S,x:k-S}:{width:S}}return{}}function Dan(t,n,s,c,d,m,g){if(t==="s"||t==="sw"||t==="se")return{height:yMt(n,s,d,m,g).value};if(t==="n"||t==="nw"||t==="ne"){const{value:S,southEdge:k}=vMt(n,s,d,m,g);return c?{height:S,y:k-S}:{height:S}}return{}}function sxn(t,n,s,c,d,m,g,S=TR){const k=!m&&g?ate(g):null,A=k?gve(k):[],F=k?yve(k):[];return{...Aan(t,n,c,d,m,A,S),...Dan(t,s,c,d,m,F,S)}}const TR=4;function ate(t){return{paddingBox:t.paddingBox??{x:0,y:0,width:0,height:0},siblingRects:(t.siblings??[]).filter(n=>n.width>0&&n.height>0),guideX:t.guideEdges?.x??[],guideY:t.guideEdges?.y??[]}}function gve(t){const n=[{edge:t.paddingBox.x,rect:t.paddingBox},{edge:t.paddingBox.x+t.paddingBox.width,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.x,rect:s}),n.push({edge:s.x+s.width,rect:s});for(const s of t.guideX??[])n.push({edge:s,rect:{x:s,y:-1e5,width:0,height:2e5}});return n}function yve(t){const n=[{edge:t.paddingBox.y,rect:t.paddingBox},{edge:t.paddingBox.y+t.paddingBox.height,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.y,rect:s}),n.push({edge:s.y+s.height,rect:s});for(const s of t.guideY??[])n.push({edge:s,rect:{x:-1e5,y:s,width:2e5,height:0}});return n}function tee(t,n,s,c){let d=t,m=c,g=null;for(const S of s){const k=Math.abs(t-S.edge);k<=m&&(m=k,d=S.edge,g=S);const A=Math.abs(t+n-S.edge);A<=m&&(m=A,d=S.edge-n,g=S)}return{value:d,match:g}}function vve(t,n,s){let c=null,d=s;for(const m of n){const g=Math.abs(t-m.edge);g<=d&&(d=g,c=m)}return c}function axn(t,n,s,c,d){let m=iA(s.x+t,c),g=iA(s.y+n,c);if(!c&&d){const S=ate(d);m=tee(m,s.width,gve(S),TR).value,g=tee(g,s.height,yve(S),TR).value}return{x:m,y:g}}function cxn(t,n,s,c,d,m=TR){if(s)return{guides:[],position:t};let g=null,S=m;for(const pe of d?.snapPoints??[]){const ue=Math.hypot(t.x-pe.x,t.y-pe.y);ue<=S&&(S=ue,g=pe)}if(g)return{guides:ree({x:g.x,y:g.y,width:0,height:0},{edge:g.x,rect:n},{edge:g.y,rect:n}),position:g};if(d?.bounded)return{guides:[],position:t};const k=iA(t.x,!1),A=iA(t.y,!1),F=[n,c?.parent,c?.paddingBox,...c?.siblings??[]].filter(pe=>!!pe&&pe.width>0&&pe.height>0);let D=null,J=null,$=m,G=m;for(const pe of F){for(const ue of[pe.x,pe.x+pe.width/2,pe.x+pe.width]){const Ce=Math.abs(k-ue);Ce<=$&&($=Ce,D={edge:ue,rect:pe})}for(const ue of[pe.y,pe.y+pe.height/2,pe.y+pe.height]){const Ce=Math.abs(A-ue);Ce<=G&&(G=Ce,J={edge:ue,rect:pe})}}const se={x:D?.edge??k,y:J?.edge??A};return{guides:ree({x:se.x,y:se.y,width:0,height:0},D,J),position:se}}function ree(t,n,s){const c=[];return n&&c.push({orientation:"vertical",at:n.edge,start:Math.min(t.y,n.rect.y),end:Math.max(t.y+t.height,n.rect.y+n.rect.height)}),s&&c.push({orientation:"horizontal",at:s.edge,start:Math.min(t.x,s.rect.x),end:Math.max(t.x+t.width,s.rect.x+s.rect.width)}),c}function lxn(t,n,s,c,d,m=TR){if(c||!d)return[];const g=iA(s.x+t,!1),S=iA(s.y+n,!1),k=ate(d),A=tee(g,s.width,gve(k),m).match,F=tee(S,s.height,yve(k),m).match,D={x:g,y:S,width:s.width,height:s.height};return ree(D,A,F)}function uxn(t,n,s,c,d="both",m=!1,g=TR,S={},k=Ian){if(m)return{position:t,guides:[]};const A={x:s.x+t.x-n.x,y:s.y+t.y-n.y,width:s.width,height:s.height},F=[],D=[],J=(pe,ue,Ce)=>{F.push({edge:pe.x,rect:pe},{edge:pe.x+pe.width,rect:pe}),D.push({edge:pe.y,rect:pe},{edge:pe.y+pe.height,rect:pe}),F.push({edge:pe.x+pe.width/2,rect:pe}),D.push({edge:pe.y+pe.height/2,rect:pe})};if(c){const pe=ate(c);if(k.parent&&pe.paddingBox.width>0&&pe.paddingBox.height>0&&J(pe.paddingBox),k.others)for(const ue of pe.siblingRects)J(ue)}if(k.guides){for(const pe of[...c?.guideEdges?.x??[],...S.x??[]])F.push({edge:pe,rect:{x:pe,y:A.y,width:0,height:A.height}});for(const pe of[...c?.guideEdges?.y??[],...S.y??[]])D.push({edge:pe,rect:{x:A.x,y:pe,width:A.width,height:0}})}if(F.length===0&&D.length===0)return{position:t,guides:[]};const $=d==="y"?{value:A.x,match:null}:rwt(A.x,A.width,F,g),G=d==="x"?{value:A.y,match:null}:rwt(A.y,A.height,D,g),se={...A,x:$.value,y:G.value};return{position:{x:t.x+se.x-A.x,y:t.y+se.y-A.y},guides:ree(se,$.match,G.match)}}function Pan(t,n,s,c,d){const m=n.tr.x-n.tl.x,g=n.tr.y-n.tl.y,S=n.bl.x-n.tl.x,k=n.bl.y-n.tl.y,A=m*k-g*S;if(Math.abs(A)<1e-9)return t;const F=t.x-n.tl.x,D=t.y-n.tl.y,J=[...s?[0,1]:[],...c?[.5]:[]],$=(pe,ue)=>{let Ce=pe,De=d;for(const Pe of J){const be=Math.abs(pe-Pe)*ue;be<=De&&(De=be,Ce=Pe)}return Ce},G=$((F*k-D*S)/A,Math.hypot(m,g)),se=$((m*D-g*F)/A,Math.hypot(S,k));return{x:n.tl.x+G*m+se*S,y:n.tl.y+G*g+se*k}}function fxn(t,n,s){const{smart:c,grid:d}=s;let m=t;return n&&c.enabled!==s.invert&&(c.sides||c.center)&&(m=Pan(t,n,c.sides,c.center,s.threshold)),n&&Math.abs(qan(n))>1e-6?m:(!(Math.hypot(m.x-t.x,m.y-t.y)>1e-9)&&s.gridOn&&d.step>0&&(m={x:Math.round((m.x-d.offsetX)/d.step)*d.step+d.offsetX,y:Math.round((m.y-d.offsetY)/d.step)*d.step+d.offsetY}),d.pixel?{x:Math.round(m.x),y:Math.round(m.y)}:m)}function dxn(t){return{tl:{x:t.x,y:t.y},tr:{x:t.x+t.width,y:t.y},br:{x:t.x+t.width,y:t.y+t.height},bl:{x:t.x,y:t.y+t.height}}}const Ian={parent:!0,others:!0,guides:!0};function rwt(t,n,s,c){const d=tee(t,n,s,c);let m=d.value,g=d.match,S=g?Math.abs(m-t):c;for(const k of s){const A=Math.abs(t+n/2-k.edge);A<S&&(S=A,m=k.edge-n/2,g=k)}return{value:m,match:g}}function pxn(t,n,s,c,d,m,g=TR){if(d||!m)return[];const S=t==="e"||t==="ne"||t==="se",k=t==="w"||t==="nw"||t==="sw",A=t==="s"||t==="sw"||t==="se",F=t==="n"||t==="nw"||t==="ne",D=ate(m),J=gve(D),$=yve(D);let G=null;S?G=hMt(n,c,!1,J,g).match:k&&(G=gMt(n,c,!1,J,g).match);let se=null;return A?se=yMt(s,c,!1,$,g).match:F&&(se=vMt(s,c,!1,$,g).match),ree(c,G,se)}function _xn(t,n,s,c,d=15){const m=F=>F*180/Math.PI,g=m(Math.atan2(n.y-t.y,n.x-t.x)),k=m(Math.atan2(s.y-t.y,s.x-t.x))-g;return{rotate:c?k:Math.round(k/d)*d}}function RN(t,n){if(t instanceof hy){const s=t.ownerOf(n);return s?t.childAdapters().find(c=>c.worldId===s)?.adapter??null:null}return t}const nwt=new WeakMap;function Nan(t){const n=t.boxEdit;if(!n)return null;const s=nwt.get(t);if(s?.provider===n)return s.recorded;const c={begin:d=>Pg({adapter:t,seam:"editor.boxEdit.begin",stage:"effect",detail:`the world overlay began a box edit for ${d}`,run:()=>n.begin(d)}),apply:(d,m)=>Pg({adapter:t,seam:"editor.boxEdit.apply",stage:"effect",detail:`the world overlay applied a ${Object.keys(m).join(", ")} box patch to ${d}`,run:()=>n.apply(d,m)}),end:d=>Pg({adapter:t,seam:"editor.boxEdit.end",stage:"effect",detail:`the world overlay ended a box edit for ${d}`,run:()=>n.end(d)}),...n.gizmoOrigin?{gizmoOrigin:d=>Pg({adapter:t,seam:"editor.boxEdit.gizmoOrigin",stage:"operation",detail:`the world overlay read the native gizmo origin for ${d}`,run:()=>n.gizmoOrigin?.(d)??null})}:{},...n.referencePoint?{referencePoint:d=>Pg({adapter:t,seam:"editor.boxEdit.referencePoint",stage:"operation",detail:`the world overlay read the native reference point for ${d}`,run:()=>n.referencePoint?.(d)??null})}:{}};return nwt.set(t,{provider:n,recorded:c}),c}function Oan(t,n){return RN(t,n)?.rects?.rect(n)??null}function Ran(t,n){const s=RN(t,n);return s?Nan(s):null}function mxn(t,n){return RN(t,n)?.rects?.contextRects?.(n)}function hxn(t,n){return RN(t,n)?.structure??null}function gxn(t,n){return RN(t,n)?.text??null}function yxn(t,n){return RN(t,n)?.colorSample??null}function vxn(t,n){const s=RN(t,n);return s?.rects?F3r(s):null}function bxn(t){const n=t instanceof hy?t.childAdapters():[{worldId:"",adapter:t}],s=[];for(const{worldId:c,adapter:d}of n)d.rects?.emptyContainers&&(c&&oq(c)||s.push(...d.rects.emptyContainers()));return s}function Fan(t,n){const s=c=>{const d=t.inspector?.get(n,`style.${c}`);return ban(d)??0};return{paddingTop:s("paddingTop"),paddingRight:s("paddingRight"),paddingBottom:s("paddingBottom"),paddingLeft:s("paddingLeft"),marginTop:s("marginTop"),marginRight:s("marginRight"),marginBottom:s("marginBottom"),marginLeft:s("marginLeft")}}const Man=4;function Sxn(t,n){const s=D=>D>0?D:Man,c=s(n.paddingTop),d=s(n.paddingRight),m=s(n.paddingBottom),g=s(n.paddingLeft),S=s(n.marginTop),k=s(n.marginRight),A=s(n.marginBottom),F=s(n.marginLeft);return[{side:"paddingTop",kind:"padding",x:t.x,y:t.y,width:t.width,height:c,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+c/2,value:n.paddingTop,isZero:n.paddingTop===0},{side:"paddingBottom",kind:"padding",x:t.x,y:t.y+t.height-m,width:t.width,height:m,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height-m/2,value:n.paddingBottom,isZero:n.paddingBottom===0},{side:"paddingLeft",kind:"padding",x:t.x,y:t.y,width:g,height:t.height,cursor:"ew-resize",labelX:t.x+g/2,labelY:t.y+t.height/2,value:n.paddingLeft,isZero:n.paddingLeft===0},{side:"paddingRight",kind:"padding",x:t.x+t.width-d,y:t.y,width:d,height:t.height,cursor:"ew-resize",labelX:t.x+t.width-d/2,labelY:t.y+t.height/2,value:n.paddingRight,isZero:n.paddingRight===0},{side:"marginTop",kind:"margin",x:t.x,y:t.y-S,width:t.width,height:S,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y-S/2,value:n.marginTop,isZero:n.marginTop===0},{side:"marginBottom",kind:"margin",x:t.x,y:t.y+t.height,width:t.width,height:A,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height+A/2,value:n.marginBottom,isZero:n.marginBottom===0},{side:"marginLeft",kind:"margin",x:t.x-F,y:t.y,width:F,height:t.height,cursor:"ew-resize",labelX:t.x-F/2,labelY:t.y+t.height/2,value:n.marginLeft,isZero:n.marginLeft===0},{side:"marginRight",kind:"margin",x:t.x+t.width,y:t.y,width:k,height:t.height,cursor:"ew-resize",labelX:t.x+t.width+k/2,labelY:t.y+t.height/2,value:n.marginRight,isZero:n.marginRight===0}]}function jan(t,n,s){switch(t){case"paddingTop":return s;case"paddingBottom":return-s;case"paddingLeft":return n;case"paddingRight":return-n;case"marginTop":return-s;case"marginBottom":return s;case"marginLeft":return-n;case"marginRight":return n}}function xxn(t,n,s,c){const d=jan(t,n,s),m=Math.max(0,Math.round(c+d));return{[t]:m}}function wxn(t,n,s){return{x:t.x+n,y:t.y+s,width:t.width,height:t.height}}const xOe=3;function SO(t,n){return n==="x"?t.x+t.width/2:t.y+t.height/2}function Lan(t,n,s){if(n===0){const m=t[0].rect;return s?m.x:m.y}if(n===t.length){const m=t[t.length-1].rect;return s?m.x+m.width:m.y+m.height}const c=t[n-1].rect,d=t[n].rect;return s?(c.x+c.width+d.x)/2:(c.y+c.height+d.y)/2}function Ban(t,n,s){const c=Math.min(...t.map(g=>s?g.rect.y:g.rect.x)),d=Math.max(...t.map(g=>s?g.rect.y+g.rect.height:g.rect.x+g.rect.width)),m=xOe/2;return s?{x:n-m,y:c,width:xOe,height:d-c}:{x:c,y:n-m,width:d-c,height:xOe}}function Txn(t,n){if(t.length===0)return null;const s=Math.max(...t.map(J=>SO(J.rect,"x")))-Math.min(...t.map(J=>SO(J.rect,"x"))),c=Math.max(...t.map(J=>SO(J.rect,"y")))-Math.min(...t.map(J=>SO(J.rect,"y"))),d=s>=c,m=d?"x":"y",g=[...t].sort((J,$)=>SO(J.rect,m)-SO($.rect,m)),S=d?n.x:n.y;let k=0;for(;k<g.length&&SO(g[k].rect,m)<S;)k++;const A=k<g.length?g[k].id:null,F=Lan(g,k,d),D=Ban(g,F,d);return{beforeSiblingId:A,index:k,marker:D}}function Cxn(t,n){const s=t.hierarchy.node(n);if(!s)return null;if(s.parentId){const c=t.hierarchy.node(s.parentId);return c?c.childIds:null}return t.hierarchy.roots().map(c=>c.id)}function Exn(t,n){const s=t.x,c=t.x+t.width,d=t.y,m=t.y+t.height,g=n.x,S=n.x+n.width,k=n.y,A=n.y+n.height,F=[];let D=null;if(c<=g?D={x1:c,x2:g}:S<=s&&(D={x1:S,x2:s}),D){const $=Math.max(d,k),G=Math.min(m,A),se=G>$?($+G)/2:((d+m)/2+(k+A)/2)/2;F.push({orientation:"horizontal",x1:D.x1,y1:se,x2:D.x2,y2:se,distance:Math.round(D.x2-D.x1),labelX:(D.x1+D.x2)/2,labelY:se})}let J=null;if(m<=k?J={y1:m,y2:k}:A<=d&&(J={y1:A,y2:d}),J){const $=Math.max(s,g),G=Math.min(c,S),se=G>$?($+G)/2:((s+c)/2+(g+S)/2)/2;F.push({orientation:"vertical",x1:se,y1:J.y1,x2:se,y2:J.y2,distance:Math.round(J.y2-J.y1),labelX:se,labelY:(J.y1+J.y2)/2})}return F}function wOe(t,n,s){const c=t?.get(n,s);return typeof c=="string"&&c.length>0?c:null}function kxn(t,n){const s=wOe(t.inspector,n,"style.position");let c=null;const d=t.hierarchy.node(n)?.parentId??null;if(d){const m=wOe(t.inspector,d,"style.display");m==="flex"||m==="inline-flex"?c=`flex ${(wOe(t.inspector,d,"style.flexDirection")??"row").startsWith("column")?"col":"row"}`:m==="grid"||m==="inline-grid"?c="grid":m&&(c=m)}return{position:s,parentLayout:c}}function Axn(t,n){if(t.length<2)return[];const s=t.map(F=>F.rect),c=Math.min(...s.map(F=>F.x)),d=Math.max(...s.map(F=>F.x+F.width)),m=Math.min(...s.map(F=>F.y)),g=Math.max(...s.map(F=>F.y+F.height)),S=(c+d)/2,k=(m+g)/2,A=[];for(const{id:F,rect:D}of t)switch(n){case"left":A.push({id:F,x:c});break;case"hcenter":A.push({id:F,x:S-D.width/2});break;case"right":A.push({id:F,x:d-D.width});break;case"top":A.push({id:F,y:m});break;case"vcenter":A.push({id:F,y:k-D.height/2});break;case"bottom":A.push({id:F,y:g-D.height});break}return A}function Dxn(t,n){if(t.length<3)return[];const s=n==="horizontal",c=[...t].sort((D,J)=>s?D.rect.x-J.rect.x:D.rect.y-J.rect.y),d=c[0],m=c[c.length-1],g=s?m.rect.x+m.rect.width-d.rect.x:m.rect.y+m.rect.height-d.rect.y,S=c.reduce((D,J)=>D+(s?J.rect.width:J.rect.height),0),k=(g-S)/(c.length-1);let A=s?d.rect.x:d.rect.y;const F=[];for(const D of c)F.push(s?{id:D.id,x:A}:{id:D.id,y:A}),A+=(s?D.rect.width:D.rect.height)+k;return F}function Pxn(t){if(t.length===0)return null;const n=Math.min(...t.map(m=>m.x)),s=Math.min(...t.map(m=>m.y)),c=Math.max(...t.map(m=>m.x+m.width)),d=Math.max(...t.map(m=>m.y+m.height));return{x:n,y:s,width:c-n,height:d-s}}function $an(t,n,s,c,d){const m={};return s?(t!==0&&(m.x=c.x+t),n!==0&&(m.y=c.y+n),m):(t!==0&&(m.marginLeft=d.left+t),n!==0&&(m.marginTop=d.top+n),m)}function Ixn(t,n){return RN(t,n)?.rects?.frame?.(n)??null}function Nxn(t){const n=t.tr.x-t.tl.x,s=t.tr.y-t.tl.y,c=t.bl.x-t.tl.x,d=t.bl.y-t.tl.y,m=Math.max(Math.hypot(n,s),Math.hypot(c,d),1e-9);return Math.abs(s)/m>.001||Math.abs(c)/m>.001}function qan(t){return Math.atan2(t.tr.y-t.tl.y,t.tr.x-t.tl.x)}function bMt(t,n,s){return{x:t.tl.x+n*(t.tr.x-t.tl.x)+s*(t.bl.x-t.tl.x),y:t.tl.y+n*(t.tr.y-t.tl.y)+s*(t.bl.y-t.tl.y)}}function SMt(t){const n=t.includes("w")?0:t.includes("e")?1:.5,s=t.includes("n")?0:t.includes("s")?1:.5;return{s:n,t:s}}function Oxn(t,n,s){if(s.length!==2||t.width===void 0||t.height===void 0||!(n.width>0)||!(n.height>0))return t;const c=Math.max(t.width/n.width,t.height/n.height),d=n.width*c,m=n.height*c;return{...t,width:d,height:m,...s.includes("w")?{x:n.x+n.width-d}:{},...s.includes("n")?{y:n.y+n.height-m}:{}}}function Rxn(t,n){const{s,t:c}=SMt(n);return bMt(t,s,c)}function iwt(t,n){const s=t.tr.x-t.tl.x,c=t.tr.y-t.tl.y,d=t.bl.x-t.tl.x,m=t.bl.y-t.tl.y,g=s*m-c*d;return Math.abs(g)<1e-12?{s:0,t:0}:{s:(n.x*m-n.y*d)/g,t:(s*n.y-c*n.x)/g}}function Fxn(t,n,s,c,d,m=!1){const g=iwt(t,{x:s,y:c}),S=n.includes("e")?1+g.s:n.includes("w")?1-g.s:1,k=n.includes("s")?1+g.t:n.includes("n")?1-g.t:1,A=Math.max(S,k),F=Math.max(.01,m&&n.length===2?A:S),D=Math.max(.01,m&&n.length===2?A:k),J=SMt(n),$=bMt(t,1-J.s,1-J.t),G=iwt(t,{x:$.x-d.x,y:$.y-d.y}),se={x:d.x+F*G.s*(t.tr.x-t.tl.x)+D*G.t*(t.bl.x-t.tl.x),y:d.y+F*G.s*(t.tr.y-t.tl.y)+D*G.t*(t.bl.y-t.tl.y)};return{scaleXFactor:F,scaleYFactor:D,originX:d.x+$.x-se.x,originY:d.y+$.y-se.y}}let owt=!1;const xMt=new Set(["viewport","hierarchy","inspector","asset-browser","workspace","global"]);let wMt="viewport";const TMt="editorActiveHotkeyScope";function Mxn(){const t=document.documentElement.dataset[TMt];return t&&xMt.has(t)?t:wMt}function CR(t){wMt=t,document.documentElement.dataset[TMt]=t}const zan="data-editor-app-undo";function swt(t){return t instanceof Element&&t.closest(`[${zan}]`)!==null}function mje(t){return t instanceof Element?t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable?!0:!!t.closest('[contenteditable]:not([contenteditable="false"])'):!1}function Van(t){for(const n of t.composedPath()){if(!(n instanceof HTMLElement)||t.type==="focusin"&&n.hasAttribute("data-editor-hotkey-fallback"))continue;const s=n.dataset.editorHotkeyScope;if(s&&xMt.has(s))return s}return null}function awt(t){const n=Van(t);n&&CR(n)}const TOe=[];function cwt(t){return TOe.push(...t),()=>{for(const n of t){const s=TOe.indexOf(n);s>=0&&TOe.splice(s,1)}}}function Uan(){owt||(window.addEventListener("pointerdown",awt,!0),window.addEventListener("focusin",awt,!0),owt=!0)}const GZ=new Map;let CMt=0;const hje=new Set;function lwt(){CMt++;for(const t of hje)t()}function Jan(t){return GZ.set(t.id,t),lwt(),()=>{GZ.get(t.id)===t&&(GZ.delete(t.id),lwt())}}function Wan(){return[...GZ.values()]}function Han(){return CMt}function Gan(t){return hje.add(t),()=>hje.delete(t)}function LVe(t){const n=GZ.get(t);return!n||n.enabled&&!n.enabled()?!1:(n.run(),!0)}const Tw=["viewport","hierarchy","inspector"];function XL(){return(globalThis.getSelection?.()?.toString()??"").length===0}function BD(t){return Fze(t)}async function BVe(t){const n=BD(t);n.length!==0&&await s0e(Cm(t).adapter,n)}async function $Ve(t){const n=BD(t);n.length!==0&&await a0e(Cm(t).adapter,n)}async function qVe(t){const n=Cm(t).adapter,s=BD(t)[0],c=s?n.hierarchy.node(s)?.parentId??null:null;await c0e(n,c)}let uwt=Promise.resolve();function bve(t){const n=uwt.then(()=>Kan(t));return uwt=n.then(()=>{},()=>{}),n}async function Kan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(!c)return;const d=n.length===1?s.hierarchy.node(n[0])?.label??"selection":`${n.length} objects`;if(i0(`Duplicating ${d}…`),c.duplicateMany){const m=await bPt(s,n);if(m&&!m.persisted){i0(m.destination);return}}else for(const m of n){const g=await r0e(s,m).ack;if(g&&!g.persisted){i0(g.destination);return}}i0(`Duplicated ${d}`)}async function Sve(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(c)if(c.removeMany)await d$e(s,n);else{const d=new Map(dPt(s).map((g,S)=>[g,S])),m=[...n].sort((g,S)=>(d.get(S)??-1)-(d.get(g)??-1));for(const g of m)await jhe(s,g)}}async function Xan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.wrap)for(const d of n)await n0e(s,d)}async function Yan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.unwrap)for(const d of n)await i0e(s,d)}async function Zan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;s.structure?.group&&await o0e(s,n).ack}function TI(t,n,s){const c=BD(t);if(c.length===0)return;const d=Cm(t).adapter;for(const m of c){const g=Ran(d,m);if(!g)continue;const S=Oan(d,m);if(!S)continue;const k=d.inspector?.get(m,"style.position"),A=k==="absolute"||k==="fixed",F=Fan(d,m),D=$an(n,s,A,S,{left:F.marginLeft,top:F.marginTop});Object.keys(D).length!==0&&(g.begin(m),g.apply(m,D),g.end(m))}}function Qan(t){const n=Array.isArray(t)?t:[t];return n.includes("global")?"global":n.length===1&&n[0]==="viewport"?"stage":"panel"}let bme=null;function pp(t,n){const{frameEnabled:s,...c}=n;return bme?.push(Jan({id:t,run:d=>c.action(d??new KeyboardEvent("keydown")),scope:Qan(c.scope),...s?{enabled:s}:{}})),LBe(t).map(d=>({...c,...d}))}function EMt(t){const n=()=>{const g=[],S=bme;bme=g;try{return{rows:t(),actions:g}}finally{bme=S}};let s=n(),c=cwt(s.rows);const d=()=>{c();for(const g of s.actions)g()},m=Kye(()=>{d(),s=n(),c=cwt(s.rows)});return()=>{m(),d()}}function ecn(t,n){const s=()=>{const m=n.getSnapshot().undoLabel;n.undo().then(g=>{g&&m&&i0(`Undid ${m}`)})},c=()=>{const m=n.getSnapshot().redoLabel;n.redo().then(g=>{g&&m&&i0(`Redid ${m}`)})},d=EMt(()=>[...pp("edit.redo",{scope:"global",allowInEditable:!0,when:m=>!mje(m.target)||swt(m.target),action:c}),...pp("edit.undo",{scope:"global",allowInEditable:!0,when:m=>!mje(m.target)||swt(m.target),action:s}),...pp("edit.copy",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void BVe(t)}),...pp("edit.cut",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void $Ve(t)}),...pp("edit.paste",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void qVe(t)}),...pp("edit.duplicate",{scope:Tw,action:()=>void bve(t)}),...pp("edit.group",{scope:Tw,action:()=>void Zan(t)}),...pp("edit.wrap",{scope:Tw,action:()=>Xan(t)}),...pp("edit.unwrap",{scope:Tw,action:()=>Yan(t)}),...pp("edit.nudgeUp",{scope:"viewport",action:()=>TI(t,0,-1)}),...pp("edit.nudgeUpCoarse",{scope:"viewport",action:()=>TI(t,0,-10)}),...pp("edit.nudgeDown",{scope:"viewport",action:()=>TI(t,0,1)}),...pp("edit.nudgeDownCoarse",{scope:"viewport",action:()=>TI(t,0,10)}),...pp("edit.nudgeLeft",{scope:"viewport",action:()=>TI(t,-1,0)}),...pp("edit.nudgeLeftCoarse",{scope:"viewport",action:()=>TI(t,-10,0)}),...pp("edit.nudgeRight",{scope:"viewport",action:()=>TI(t,1,0)}),...pp("edit.nudgeRightCoarse",{scope:"viewport",action:()=>TI(t,10,0)}),...pp("edit.selectAll",{scope:Tw,action:()=>{const m=Cm(t).adapter;c0(m,dPt(m))}}),...pp("edit.deselectAll",{scope:Tw,action:()=>c0(Cm(t).adapter,[])}),...pp("edit.save",{scope:"global",allowInEditable:!0,action:()=>{TTr().then(m=>{m===null&&ORt(t)})}}),...pp("view.resetPan",{scope:"viewport",action:()=>dMt()}),...pp("edit.enterScope",{scope:Tw,when:()=>t.playState==="stopped",frameEnabled:()=>t.playState==="stopped",action:()=>{J3r(Cm(t).adapter)}}),...pp("edit.delete",{scope:Tw,action:()=>void Sve(t)}),...pp("edit.exitScopeOrDeselect",{scope:Tw,when:()=>V3r()!==null||t.playState==="stopped",frameEnabled:()=>!0,action:()=>{const m=Cm(t).adapter;if(!U3r(m)){if(t.playState!=="stopped"){bVe();return}t.select(null)}}}),...pp("view.commandPalette",{scope:"global",action:()=>{CVe()||Qs.warn(`The command palette has not handed over its opener yet — run "Volter Editor: Open Workspace" first, or press the workbench's own Show All Commands.`)}}),...pp("view.toggleConsole",{scope:"global",action:()=>pve()}),...pp("view.focusMode",{scope:"global",action:()=>qBe()}),...pp("workspace.cycleNext",{scope:"global",action:()=>{Che(1)}}),...pp("workspace.cyclePrevious",{scope:"global",action:()=>{Che(-1)}})]);return Uan(),d}function tcn(t){return EMt(()=>t.flatMap(n=>{const s=n.enabled;return pp(n.id,{scope:n.scope==="stage"?"viewport":"global",action:c=>n.run(c),...s?{when:()=>s(),frameEnabled:()=>s()}:{}})}))}function zVe(){ukr("undo-history")}function rcn(){const t=()=>zVe();return window.addEventListener("editor:show-history-tab",t),()=>window.removeEventListener("editor:show-history-tab",t)}let gje=null,kMt=0;const yje=new Set;function VVe(t){if(gje!==t){gje=t,kMt++;for(const n of yje)n()}}function AMt(){return gje}function ncn(t){VVe(t)}function DMt(){VVe(null)}function PMt(t){return yje.add(t),()=>yje.delete(t)}function vje(){return kMt}function icn(){VVe(null)}const ocn=Object.freeze(Object.defineProperty({__proto__:null,__resetEditorPresentationNoticeForTest:icn,clearEditorPresentationNotice:DMt,editorPresentationNotice:AMt,editorPresentationNoticeVersion:vje,showEditorPresentationNotice:ncn,subscribeEditorPresentationNotice:PMt},Symbol.toStringTag,{value:"Module"})),fwt="agent-presented-view";function scn(){const t=Yv();Ye.useSyncExternalStore(PMt,vje,vje);const n=AMt();return Ye.useEffect(()=>{if(!n){kBe(fwt);return}s$({id:fwt,tone:"info",title:"Agent presented this view.",...n.presented.warnings.length>0?{detail:n.presented.warnings.join(" ")}:{},onDismiss:DMt,actions:[{label:"Copy Link",keeps:!0,run:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(n.presented.url)).catch(()=>{Qs.warn("Could not copy the view link to the clipboard.","editor")})}},{label:"Return",primary:!0,run:()=>{Vge(t,n.previousView,{origin:"return"}).catch(s=>{Qs.error(`Could not return to the previous editor view: ${s instanceof Error?s.message:String(s)}`,"editor")})}}]})},[n,t]),null}function acn(t){Ye.useEffect(()=>{const n=_tn(),s=()=>btn(t.playState!=="stopped");s();const c=t.subscribe(s);return()=>{c(),n(),L3t()}},[t])}const nee={console:{id:"console",title:"Console"},lightExplorer:{id:"light-explorer",title:"Light Explorer"}},ccn={storyActions:{id:"story-actions",title:"Actions"},storyInteractions:{id:"story-interactions",title:"Interactions"},storyAccessibility:{id:"story-accessibility",title:"Accessibility"},generations:{id:"generations",title:"Generations"}};[...Object.values(nee),...Object.values(ccn)];const lcn={info:Go.content.primary,warn:Go.semantic.warning,error:Go.semantic.danger},dwt={scene:"#78dce8",physics:"#ff6188",animation:"#a9dc76",network:"#fc9867",audio:"#ab9df2",ai:"#ffd866",input:"#78dce8",core:Go.content.primary},pwt={info:R$,warn:YTt,error:jTt};function ucn(){const t=Yv();Ye.useSyncExternalStore(Qs.subscribe,Qs.getSnapshot);const[n,s]=Ye.useState(""),[c,d]=Ye.useState("all"),[m,g]=Ye.useState({info:!0,warn:!0,error:!0}),S=Ye.useRef(null),[k,A]=Ye.useState(!0),F=Qs.getEntries(),D=new Map;for(const Ce of F){const De=Ce.metadata?.instanceId;if(typeof De!="string"||De.length===0)continue;const Pe=Ce.metadata?.instanceName;D.set(De,typeof Pe=="string"&&Pe.length>0?Pe:`Instance ${De}`)}const J=F.filter(Ce=>!(!m[Ce.level]||c!=="all"&&Ce.metadata?.instanceId!==c||n&&!Ce.message.toLowerCase().includes(n.toLowerCase())));Ye.useEffect(()=>{k&&S.current&&(S.current.scrollTop=S.current.scrollHeight)},[F.length,k]);const $=()=>{if(!S.current)return;const{scrollTop:Ce,scrollHeight:De,clientHeight:Pe}=S.current;A(De-Ce-Pe<20)},G=Ce=>{g(De=>({...De,[Ce]:!De[Ce]}))},se=Ce=>{const De=new Date(Ce);return`${De.getHours().toString().padStart(2,"0")}:${De.getMinutes().toString().padStart(2,"0")}:${De.getSeconds().toString().padStart(2,"0")}`},pe=Ce=>{c0(Y0(t),[Ce]),LVe("viewport.frameSelection")},ue=Qs.counts;return q.jsxs(JTr,{className:"volter-console",children:[q.jsxs(n$,{label:"Console filters",compact:!0,children:[q.jsx(dm,{"aria-label":"Clear console",size:"compact",onClick:()=>Qs.clear(),title:"Clear console",children:q.jsx(dc,{icon:OTt,size:"xs"})}),q.jsx(Pht,{}),q.jsxs(Iw,{"aria-label":"Filter console by game instance",title:"Show messages from all game instances or one inspected instance",value:c,onChange:Ce=>d(Ce.target.value),style:{width:"auto",minWidth:74,height:24,fontSize:11},children:[q.jsx("option",{value:"all",children:"All instances"}),[...D].map(([Ce,De])=>q.jsx("option",{value:Ce,children:De},Ce))]}),q.jsx(Pht,{}),["info","warn","error"].map(Ce=>q.jsxs(Ms,{variant:"ghost",size:"compact","aria-label":`Toggle ${Ce} messages`,"aria-pressed":m[Ce],"data-console-level":Ce,onClick:()=>G(Ce),children:[q.jsx(dc,{icon:pwt[Ce],size:"xs"}),ue[Ce]]},Ce)),q.jsx(Zm,{placeholder:"Filter...",value:n,onChange:Ce=>s(Ce.target.value),className:"volter-console-filter"})]}),q.jsxs("div",{ref:S,onScroll:$,className:"volter-console-list volter-selectable-text",children:[J.length===0&&q.jsx("div",{className:"volter-console-empty",children:"No messages"}),J.map(Ce=>{const De=Ce.metadata?.entityId!=null?String(Ce.metadata.entityId):null,Pe=(De?Y0(t).hierarchy.node(De)?.label:null)||De,be=typeof Ce.metadata?.instanceId=="string"?Ce.metadata.instanceId:null,X=typeof Ce.metadata?.instanceName=="string"?Ce.metadata.instanceName:be?`Instance ${be}`:null;return q.jsxs("div",{className:"volter-console-row","data-level":Ce.level,style:{color:lcn[Ce.level]},children:[q.jsx("span",{style:{color:Go.content.dim,marginRight:6,flexShrink:0},children:se(Ce.timestamp)}),q.jsx(dc,{icon:pwt[Ce.level],style:{fontSize:9,marginTop:4,marginRight:6,flexShrink:0}}),X&&q.jsx("span",{title:be?`Runtime instance ${be}`:void 0,style:{background:Go.accent.muted,color:Go.accent.default,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:X}),Ce.subsystem&&q.jsx("span",{style:{background:`${dwt[Ce.subsystem]??Go.content.muted}22`,color:dwt[Ce.subsystem]??Go.content.muted,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:Ce.subsystem}),q.jsxs("span",{style:{flex:1,wordBreak:"break-word"},children:[Ce.message,De&&q.jsxs("span",{onClick:()=>pe(De),style:{background:Go.semantic.successMuted,color:Go.semantic.success,borderRadius:Go.shape.small,padding:"0 5px",fontSize:10,marginLeft:6,cursor:"pointer",pointerEvents:"auto",display:"inline-flex",alignItems:"center",gap:3},title:`Select and focus "${Pe}"`,children:[q.jsx(dc,{icon:aR,style:{fontSize:8}}),Pe]}),Ce.source&&q.jsxs("span",{style:{color:Go.content.dim,marginLeft:6},children:["[",Ce.source,"]"]})]}),Ce.count>1&&q.jsx("span",{className:"volter-console-count",children:Ce.count})]},Ce.id)})]})]})}const fcn={enabled:"visible",color:"light.color",intensity:"light.intensity",range:"light.distance",shadows:"shadow.cast"};function IMt(t){const n=[],s=t;return W$(t.hierarchy,c=>{c.kind==="light"&&n.push(c)},{extraChildren:c=>s.internalChildren?.(c)}),n}function jxn(t){return IMt(t).length}function NMt(t,n){return t.find(s=>s.path===fcn[n])??null}function qY(t,n,s,c,d){const m=NMt(s,c);if(!m||!t.inspector)return{supported:!1,writable:!1,value:null};let g;try{g=t.inspector.get(n,m.path)}catch{g=void 0}return{supported:!0,writable:m.readonly!==!0,value:d(g)?g:null}}const _wt=t=>typeof t=="boolean",dcn=t=>typeof t=="string",mwt=t=>typeof t=="number"&&Number.isFinite(t);function pcn(t){return IMt(t).map(n=>{let s=[];try{s=t.inspector?.properties(n.id)??[]}catch{}const c=t.hierarchy.object3D?.(n.id)?.type;return{id:n.id,name:n.label,type:n.typeLabel??c??"Light",enabled:qY(t,n.id,s,"enabled",_wt),color:qY(t,n.id,s,"color",dcn),intensity:qY(t,n.id,s,"intensity",mwt),range:qY(t,n.id,s,"range",mwt),shadows:qY(t,n.id,s,"shadows",_wt)}})}function _cn(t,n,s,c){if(!t.inspector)return 0;let d=0;for(const m of n){let g=null;try{g=NMt(t.inspector.properties(m),s)}catch{continue}!g||g.readonly||(gPt(t,m,g.path,c),d++)}return d}function mcn(t,n){return t===null&&n===null?0:t===null?1:n===null?-1:typeof t=="string"&&typeof n=="string"?t.localeCompare(n,void 0,{numeric:!0,sensitivity:"base"}):Number(t)-Number(n)}function hwt(t,n){return n==="name"||n==="type"?t[n]:t[n].value}function zY({label:t,sortKey:n,activeKey:s,direction:c,onSort:d}){const m=n===s;return q.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-sort","aria-label":`Sort lights by ${t}`,onClick:()=>d(n),children:[t,m?q.jsx(dc,{icon:c==="ascending"?O0r:Q0r,size:"xs"}):null]})}function xve(){return q.jsx("span",{className:"volter-light-explorer-unavailable",children:"—"})}function hcn({row:t,edit:n}){return t.enabled.supported?q.jsx(TD,{"aria-label":`${t.enabled.value?"Disable":"Enable"} ${t.name}`,checked:t.enabled.value??!1,disabled:!t.enabled.writable,onChange:s=>n("enabled",s.target.checked)}):q.jsx(xve,{})}function gcn({row:t,edit:n}){return!t.color.supported||!t.color.value?q.jsx(xve,{}):q.jsxs("div",{className:"volter-light-explorer-color",children:[q.jsx(d4t,{"aria-label":`Color for ${t.name}`,value:t.color.value,disabled:!t.color.writable,onChange:s=>n("color",s.target.value)}),q.jsx("span",{children:t.color.value})]})}function gwt({row:t,field:n,step:s,edit:c}){const d=t[n];return d.supported?q.jsx(SZ,{value:d.value,disabled:!d.writable,precision:2,step:s,onChange:m=>c(n,m)}):q.jsx(xve,{})}function ycn({row:t,edit:n}){return t.shadows.supported?q.jsx(TD,{"aria-label":`Toggle shadows for ${t.name}`,checked:t.shadows.value??!1,disabled:!t.shadows.writable,onChange:s=>n("shadows",s.target.checked)}):q.jsx(xve,{})}function vcn({row:t,adapter:n,visibleRows:s,selected:c,selectionAnchor:d,edit:m}){const g=(S,k)=>m(t,S,k);return q.jsxs("tr",{"data-selected":c.has(t.id)||void 0,children:[q.jsx("td",{children:q.jsx(hcn,{row:t,edit:g})}),q.jsx("td",{children:q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-name","aria-pressed":c.has(t.id),onClick:S=>{Scn(n,s,t.id,d.current,S.shiftKey,S.metaKey||S.ctrlKey),S.shiftKey||(d.current=t.id)},children:t.name})}),q.jsx("td",{className:"volter-light-explorer-type",children:t.type}),q.jsx("td",{children:q.jsx(gcn,{row:t,edit:g})}),q.jsx("td",{children:q.jsx(gwt,{row:t,field:"intensity",step:.1,edit:g})}),q.jsx("td",{children:q.jsx(gwt,{row:t,field:"range",step:.5,edit:g})}),q.jsx("td",{children:q.jsx(ycn,{row:t,edit:g})})]})}function bcn(t,n,s){if(!n.has(t.id))return[t.id];const c=s.filter(d=>n.has(d.id));return c.length>1?c.map(d=>d.id):[t.id]}function Scn(t,n,s,c,d,m){if(!t.selection)return;const g=t.selection.get();if(d&&c){const S=n.findIndex(A=>A.id===c),k=n.findIndex(A=>A.id===s);if(S>=0&&k>=0){const A=n.slice(Math.min(S,k),Math.max(S,k)+1).map(F=>F.id);c0(t,m?[...new Set([...g,...A])]:A,{intent:"exact"});return}}if(m){c0(t,g.includes(s)?g.filter(S=>S!==s):[...g,s],{intent:"exact"});return}c0(t,[s],{intent:"exact"})}function xcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),Ye.useSyncExternalStore(o2,K1,K1),Ye.useSyncExternalStore(Cee,AD,AD);const{adapter:n}=Cm(t),[,s]=Ye.useReducer(Pe=>Pe+1,0);Ye.useEffect(()=>n.subscribe?.(s),[n]);const[c,d]=Ye.useState(""),[m,g]=Ye.useState("all"),[S,k]=Ye.useState("name"),[A,F]=Ye.useState("ascending"),D=Ye.useRef(null),J=pcn(n),$=Ye.useMemo(()=>[...new Set(J.map(Pe=>Pe.type))].sort((Pe,be)=>Pe.localeCompare(be)),[J]),G=c.trim().toLocaleLowerCase(),se=J.filter(Pe=>(m==="all"||Pe.type===m)&&(!G||Pe.name.toLocaleLowerCase().includes(G)||Pe.type.toLocaleLowerCase().includes(G))).sort((Pe,be)=>{const X=mcn(hwt(Pe,S),hwt(be,S));return A==="ascending"?X:-X}),pe=new Set(n.selection?.get()??[]),ue=J.filter(Pe=>pe.has(Pe.id)).length,Ce=Pe=>{Pe===S?F(be=>be==="ascending"?"descending":"ascending"):(k(Pe),F("ascending"))},De=(Pe,be,X)=>{const we=bcn(Pe,pe,se);_cn(n,we,be,X)>0&&t.notifyIngestEdit()};return q.jsxs("section",{className:"volter-light-explorer","aria-label":"Light Explorer",children:[q.jsxs("div",{className:"volter-light-explorer-toolbar",children:[q.jsx(Zm,{"aria-label":"Search lights",placeholder:"Search lights…",value:c,onChange:Pe=>d(Pe.target.value)}),q.jsxs(Iw,{"aria-label":"Filter lights by type",value:m,onChange:Pe=>g(Pe.target.value),children:[q.jsx("option",{value:"all",children:"All types"}),$.map(Pe=>q.jsx("option",{value:Pe,children:Pe},Pe))]}),q.jsxs("span",{className:"volter-light-explorer-summary",children:[J.length," ",J.length===1?"light":"lights",ue>0?` · ${ue} selected`:""]})]}),J.length===0?q.jsx("div",{className:"volter-light-explorer-empty",children:"The active document does not expose any lights."}):q.jsxs("div",{className:"volter-light-explorer-scroll",children:[q.jsxs("table",{className:"volter-light-explorer-table",children:[q.jsx("thead",{children:q.jsxs("tr",{children:[q.jsx("th",{className:"volter-light-explorer-check-column",scope:"col",children:"On"}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Name",sortKey:"name",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Type",sortKey:"type",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:"Color"}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Intensity",sortKey:"intensity",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Range",sortKey:"range",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Shadows",sortKey:"shadows",activeKey:S,direction:A,onSort:Ce})})]})}),q.jsx("tbody",{children:se.map(Pe=>q.jsx(vcn,{row:Pe,adapter:n,visibleRows:se,selected:pe,selectionAnchor:D,edit:De},Pe.id))})]}),se.length===0?q.jsx("div",{className:"volter-light-explorer-empty",children:"No lights match the current filters."}):null]})]})}const wcn=Mye();function Tcn(){const{error:t,warn:n}=Qs.counts;return t>0?{count:t+n,severity:"error"}:n>0?{count:n,severity:"warn"}:null}function Ccn(){wcn.ensure(t=>{t(cFe({...nee.console,order:-100,Content:ucn,badge:Tcn,subscribeBadge:Qs.subscribe,badgeSnapshot:Qs.getSnapshot,visibleByDefault:!1,closeable:!0})),t(cFe({...nee.lightExplorer,order:21,Content:xcn,visibleByDefault:!1,closeable:!0}))})}const Sme=new Map,xme=new Map,bje=new Set;let OMt=0;function RMt(){OMt++;for(const t of[...bje])t()}function Lxn(t,n){const s=Sme.get(t),c=n===null?null:Math.max(0,Math.round(n.headerWidth));(n===null?s===void 0:s?.headerWidth===c&&s.shelf===n.shelf)||(n===null||c===null?Sme.delete(t):Sme.set(t,{headerWidth:c,shelf:n.shelf}),RMt())}function FMt(t){return Sme.get(t)??null}function Bxn(t){return xme.get(t)??null}function Ecn(t,n){(xme.get(t)??null)!==n&&(n===null?xme.delete(t):xme.set(t,n),RMt())}function MMt(t){return bje.add(t),()=>{bje.delete(t)}}function Xge(){return OMt}const kcn=5742335;function jMt(t,n,s){return t<<16|n<<8|s}function ywt(t){const n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t.trim())?.[1];if(n){const d=n.length===3?[...n].map(m=>`${m}${m}`).join(""):n;return Number.parseInt(d.slice(0,6),16)}const s=/^rgba?\(\s*(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)/i.exec(t.trim());if(!s)return null;const c=s.slice(1,4).map(d=>Math.round(Number(d)));return c.some(d=>d<0||d>255)?null:jMt(c[0],c[1],c[2])}function iee(t){const n=ywt(t);if(n!==null||typeof document>"u")return n;if(typeof CSS<"u"&&!CSS.supports("color",t))return null;const s=document.createElement("canvas").getContext("2d");return s?(s.fillStyle="#010203",s.fillStyle=t,ywt(String(s.fillStyle))):null}function dA(t){return typeof document>"u"?null:t?.closest(`.${RRe}`)??document.querySelector(`.${RRe}`)}function vwt(t){const n=Math.round((t>>16&255)*.42),s=Math.round((t>>8&255)*.42),c=Math.round((t&255)*.42);return jMt(n,s,c)}function Ig(t,n){return t&&typeof getComputedStyle<"u"?getComputedStyle(t).getPropertyValue(n).trim():""}const LMt={"--volter-viewport-background":"--vscode-volter-viewport-background","--volter-viewport-grid":"--vscode-volter-viewport-grid","--volter-viewport-axis-x":"--vscode-volter-viewport-axisX","--volter-viewport-axis-y":"--vscode-volter-viewport-axisY","--volter-viewport-axis-z":"--vscode-volter-viewport-axisZ","--volter-viewport-selection":"--vscode-volter-viewport-selection","--volter-viewport-active":"--vscode-volter-viewport-active","--volter-viewport-wire":"--vscode-volter-viewport-wire","--volter-gizmo-x":"--vscode-volter-gizmo-x","--volter-gizmo-y":"--vscode-volter-gizmo-y","--volter-gizmo-z":"--vscode-volter-gizmo-z","--volter-gizmo-navigation-x":"--vscode-volter-gizmo-navigationX","--volter-gizmo-navigation-y":"--vscode-volter-gizmo-navigationY","--volter-gizmo-navigation-z":"--vscode-volter-gizmo-navigationZ","--volter-gizmo-hover":"--vscode-volter-gizmo-hover","--volter-gizmo-drag":"--vscode-volter-gizmo-drag"};function oee(t,n){const s=LMt[n];return(s?Ig(t,s):"")||Ig(t,n)}function $xn(t){const n=dA(t),s=oee(n,"--volter-viewport-selection")||Ig(n,"--volter-accent"),c=iee(s||i$.color.accent.default)??kcn,d=iee(oee(n,"--volter-viewport-active")),m=Ig(n,"--volter-viewport-outline-style"),g=Number.parseFloat(Ig(n,"--volter-viewport-outline-width")),S=Ig(n,"--volter-viewport-outline-hidden");return{visible:c,hidden:vwt(c),...d===null?{}:{active:{visible:d,hidden:vwt(d)}},...m===""&&S===""&&!Number.isFinite(g)?{}:{outline:{style:m==="crisp"?"crisp":"soft",width:Number.isFinite(g)&&g>0?g:null,hidden:S!=="false"}}}}function qxn(t){return BMt(t).background!==null}function zxn(t){const n=BMt(t).background;if(n===null)return!1;const s=n>>16&255,c=n>>8&255,d=n&255;return(.2126*s+.7152*c+.0722*d)/255>.5}function BMt(t){const n=dA(t),s=c=>{const d=oee(n,c);return d?iee(d):null};return{background:s("--volter-viewport-background"),grid:s("--volter-viewport-grid"),axisX:s("--volter-viewport-axis-x"),axisY:s("--volter-viewport-axis-y"),axisZ:s("--volter-viewport-axis-z"),axisLineWidth:(()=>{const c=Ig(n,"--volter-viewport-axis-line-width"),d=c?Number.parseFloat(c):Number.NaN;return Number.isFinite(d)?d:null})(),active:s("--volter-viewport-active")}}function Vxn(t){const n=dA(t),s=m=>{const g=oee(n,m);return g?iee(g):null},c=m=>{const g=Ig(n,m);if(!g)return null;const S=Number.parseFloat(g);return Number.isFinite(S)?S:null},d=m=>{const g=s(`${m}-x`),S=s(`${m}-y`),k=s(`${m}-z`);return g!==null&&S!==null&&k!==null?[g,S,k]:null};return{axes:d("--volter-gizmo"),navigation:d("--volter-gizmo-navigation"),hover:s("--volter-gizmo-hover"),drag:s("--volter-gizmo-drag"),opacity:c("--volter-viewport-gizmo-opacity"),arrowLength:c("--volter-viewport-gizmo-arrow-length"),arrowHead:c("--volter-viewport-gizmo-arrow-head"),ringWidth:c("--volter-viewport-gizmo-ring-width"),navigationSize:c("--volter-viewport-navigation-size"),background:s("--volter-viewport-background"),navigationForm:(m=>m==="cones"||m==="triad"||m==="godot"?m:"balls")(Ig(n,"--volter-viewport-navigation-gizmo")),navigationCorner:Ig(n,"--volter-viewport-navigation-corner")==="bottom-left"?"bottom-left":"top-right",highlightSaturation:c("--volter-viewport-gizmo-highlight-saturation"),highlightValue:c("--volter-viewport-gizmo-highlight-value")}}function Uxn(t){const n=Ig(dA(t),"--volter-viewport-gizmo-size");if(!n)return null;const s=Number.parseFloat(n);return Number.isFinite(s)&&s>0?s:null}function Jxn(t){const n=dA(t),s=(d,m)=>{const g=Number.parseFloat(Ig(n,d)??"");return Number.isFinite(g)&&g>0?g:m},c=s("--volter-viewport-grid-line-width",1);return{lineWidth:c,majorWidth:s("--volter-viewport-grid-major-width",c),majorContrast:s("--volter-viewport-grid-major-contrast",1)}}function Wxn(t){const n=dA(t),s=oee(n,"--volter-viewport-wire"),c=Number.parseFloat(Ig(n,"--volter-viewport-wire-opacity"));return{color:s?iee(s):null,opacity:Number.isFinite(c)?c:null}}function Hxn(t){const n=dA(t),s=Number.parseFloat(Ig(n,"--volter-viewport-selection-box-width"));return{edges:Ig(n,"--volter-viewport-selection-box")==="edges",frame:Ig(n,"--volter-viewport-selection-box-frame")==="object"?"object":"world",lineWidth:Number.isFinite(s)&&s>0?s:null}}function $Mt(t){const n=dA(t);return["--volter-viewport-chrome-bar","--volter-viewport-chrome-view-name","--volter-viewport-chrome-tools","--volter-viewport-chrome-display","--volter-viewport-chrome-transform-controls"].map(s=>Ig(n,s)).join("|")}function Acn(t){const[n,s,c,d,m]=t.split("|"),g=["strip","pills"],S=["menu","gizmo","bar"],k=["bar-start","bar-end"],A=(F,D,J)=>D.includes(F)?F:J;return{bar:A(n,g,"none"),viewName:A(s,S,"text"),tools:A(c,k,"shelf"),display:A(d,k,"corner"),transformControls:m==="bar"?"bar":"header"}}let Sje=null;function Dcn(t){return zMt(null,()=>{Sje=$Mt(),t()})}function bwt(){return Sje??=$Mt(),Sje}let xje=null;function qMt(){const t=dA();return JSON.stringify([xBe.map(n=>Ig(t,`--volter-viewport-word-${n}`)),Ig(t,"--volter-viewport-word-helpers")])}function Pcn(t){return zMt(null,()=>{xje=qMt(),t()})}function Swt(){return xje??=qMt(),xje}function Gxn(){const t=Ye.useSyncExternalStore(Pcn,Swt,Swt);return Ye.useMemo(()=>{const[n,s]=JSON.parse(t),c={};return xBe.forEach((d,m)=>{n[m]&&(c[d]=n[m])}),{shading:c,helpers:s||void 0}},[t])}function Icn(){const t=Ye.useSyncExternalStore(Dcn,bwt,bwt);return Ye.useMemo(()=>Acn(t),[t])}function zMt(t,n){n();const s=dA(t);if(!s||typeof MutationObserver>"u")return()=>{};const c=new MutationObserver(n);c.observe(s,{attributes:!0,attributeFilter:["style"]});const d=Ncn(s,n);return()=>{c.disconnect(),d()}}const l_e=new Set;let YL=null,COe="";function Ncn(t,n){const s=()=>Object.values(LMt).map(c=>Ig(t,c)).join("|");return l_e.add(n),!YL&&typeof document<"u"&&document.head&&(COe=s(),YL=new MutationObserver(()=>{const c=s();if(c!==COe){COe=c;for(const d of[...l_e])d()}}),YL.observe(document.head,{childList:!0,subtree:!0,characterData:!0})),()=>{l_e.delete(n),l_e.size===0&&YL&&(YL.disconnect(),YL=null)}}function Ocn({documentId:t,runtime:n=!1,island:s=!1,assetPath:c,transformControls:d,children:m}){Ye.useSyncExternalStore(CBe,o$,o$);const g=Ye.useSyncExternalStore(U$,eA,eA);Ye.useSyncExternalStore(MMt,Xge,Xge);const S=FMt(t)?.headerWidth??null,k=Ye.useCallback(F=>Ecn(t,F),[t]),A=s2(t)?.HeaderControls;return!m&&!A&&!d||!n&&g.includes("header:hidden")?null:q.jsxs("div",{className:s?"volter-dock-document-toolbar volter-chrome-island volter-glass-island":"volter-dock-document-toolbar","data-runtime-toolbar":n||void 0,"data-island-scale":"compact","data-testid":`document-header:${t}`,children:[m?q.jsx("div",{className:"volter-dock-document-toolbar-own",children:m}):null,d,A?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(A,{documentId:t,...c&&!c.startsWith("online:")?{assetPath:c}:{}})}):null,S===null?null:q.jsx("div",{ref:k,className:"volter-dock-document-toolbar-area","data-testid":`document-header-area:${t}`,style:{flex:"0 0 auto",width:S,alignSelf:"stretch",display:"flex",alignItems:"center"}})]})}function Rcn({documentId:t,children:n}){const s=Ye.useSyncExternalStore(U$,eA,eA);return!n||s.includes("shelf:hidden")?null:q.jsx("div",{className:"volter-dock-document-shelf","data-testid":`document-shelf:${t}`,role:"toolbar","aria-orientation":"vertical","aria-label":"Document tools",children:n})}function Fcn(t){return t==="game"||t==="scene"||t==="world"?"world":"resource"}function VMt({viewId:t,descriptor:n,active:s,backdrop:c=!1,chrome:d=!0}){const m=n.Content,g=n.Toolbar,S=n.Shelf,k=Fcn(n.kind),A=Yv();Ye.useSyncExternalStore(A.subscribe,A.getShellSnapshot??A.getSnapshot),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(CBe,o$,o$),Ye.useSyncExternalStore(uCt,GOe,GOe);const F=s2(n.id),D=s&&n.kind!=="game"?F?.transformTools?.()??"none":"none",J=F?.TransformTools,$=F?.TransformControls,G=Icn(),se=d&&F!==null&&F!==void 0&&!c,pe=se&&G.bar!=="none"&&G.tools!=="shelf",ue=Ye.useSyncExternalStore(U$,eA,eA).includes("shelf:hidden"),Ce=D==="none"||!J?null:q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(J,{documentId:n.id})});Ye.useSyncExternalStore(MMt,Xge,Xge);const De=FMt(n.id)?.shelf??null,Pe=se&&G.bar!=="none",be=!Pe||G.display==="corner"?null:G.display==="bar-start"?"start":"end",X=pe?G.tools==="bar-start"?"start":"end":null,we=Pe&&G.transformControls==="bar"&&D==="gizmo"&&$!==void 0,qe=we?X??be??"start":null,bt=Pt=>q.jsxs("div",{className:"volter-stage-bar-group","data-edge":Pt,children:[be===Pt?q.jsx("div",{className:"volter-stage-bar-slot","data-stage-bar-slot":"display"}):null,X===Pt?Ce:null,qe===Pt&&$?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx($,{documentId:n.id})}):null]});return q.jsxs("div",{className:"volter-dock-document","data-testid":`workspace-doc:${n.id}`,"data-editor-hotkey-scope":k==="world"?"viewport":"workspace","data-volter-document-family":k,children:[d&&q.jsx(Ocn,{documentId:n.id,runtime:n.kind==="game",island:c&&k==="world",assetPath:fQr(n.id)?.assetPath,transformControls:D==="gizmo"&&$&&!we?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx($,{documentId:n.id})}):null,children:g?q.jsx(g,{documentId:n.id,active:s}):null}),q.jsxs("div",{className:"volter-dock-document-content","data-workspace-document-id":n.id,"data-workspace-view-id":t,"data-volter-stage-bar":se&&G.bar!=="none"?G.bar:void 0,"data-volter-stage-rail":d&&!ue&&(Ce&&!pe||S)?void 0:"empty",children:[q.jsx(m,{documentId:n.id,...t?{viewId:t}:{},active:s}),Pe?q.jsxs("div",{className:"volter-stage-bar","data-form":G.bar,role:"toolbar","aria-label":"Viewport",children:[bt("start"),bt("end")]}):null,d&&!ue&&De&&Ce&&!pe?r2.createPortal(Ce,De):null,d&&q.jsx(Rcn,{documentId:n.id,children:Ce&&!pe||S?q.jsxs(q.Fragment,{children:[pe?null:Ce,S?q.jsx(S,{documentId:n.id,active:s}):null]}):null})]})]})}const u_e=new Map;function Mcn(t,n){const s=Em();let c=u_e.get(t);(!c||c.project!==s)&&(c={project:s,count:0,created:n},u_e.set(t,c)),c.count++;const d=c;return()=>{u_e.get(t)!==d||--d.count>0||(u_e.delete(t),d.created&&Em()===d.project&&EN(t))}}function jcn({document:t,chrome:n=!0,active:s=!0,onReady:c}){const d=Yv(),[m,g]=Ye.useState(null),[S,k]=Ye.useState(null),A=JSON.stringify(t),F=Ye.useRef(c);F.current=c;const D=Ye.useRef(null);Ye.useSyncExternalStore(o2,K1,K1);const J=Ye.useSyncExternalStore(CBe,o$,o$);Ye.useEffect(()=>{let G=!1,se;const pe=Em(),ue=()=>!G&&Em()===pe,Ce=JSON.parse(A);return g(null),k(null),(async()=>{if(await Qze(),!ue())return;const De=new Set(l0().map(be=>be.descriptor.id)),Pe=Ce.kind==="asset"?sN(Ce.path,Ce.assetKind??"source",{activate:s}):Ce.kind==="workspace"?De.has(Ce.id)?Ce.id:null:await Yye(Ce.kind,d,{...Ce,activate:s});if(ue()){if(!Pe)throw new Error("The requested layout document is unavailable.");se=Mcn(Pe,!De.has(Pe)),g(Pe)}})().catch(De=>{ue()&&k(De instanceof Error?De.message:String(De))}),()=>{G=!0,se?.()}},[d,A]),Ye.useEffect(()=>{!m||!s||X0(m)},[m,s]),Ye.useEffect(()=>{if(!m)return;const G=s2(m);if(!(!G||D.current===G)){D.current=G;try{F.current?.({select(se){const pe=G.idsNamed?.(se)??[];if(pe.length!==1)throw new Error(`Expected one object named "${se}"; found ${pe.length}.`);G.selection?.apply(pe)},transform(se){G.setTransformMode?.(se)},frame(){G.frame("document")}})}catch(se){k(se instanceof Error?se.message:String(se))}}},[m,J]);const $=m?l0().find(G=>G.descriptor.id===m):void 0;return q.jsx("div",{style:{position:"relative",flex:1,minWidth:0,minHeight:0,height:"100%",overflow:"hidden"},children:S?q.jsx("div",{role:"alert",children:S}):$?q.jsx(VMt,{descriptor:$.descriptor,active:s,chrome:n}):q.jsx("div",{role:"status",children:"Opening document…"})})}function Lcn(){return q.jsxs(kee,{children:[q.jsx(Aee,{}),q.jsx(Pee,{}),q.jsx(Dee,{})]})}function Bcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot);const n=Ye.useSyncExternalStore(Hye,c$,c$),[s,c]=Ye.useState(!1),d=Ye.useSyncExternalStore(OC,cxt,cxt);if(Ye.useEffect(()=>{let g=!1;return Qze().then(()=>{g||c(!0)}),()=>{g=!0}},[]),!s)return q.jsx("div",{role:"status",children:d??"Loading project layout…"});const m=n.Layout??Lcn;return q.jsx(m,{playing:t.playState!=="stopped",paused:t.playState==="paused"})}function UVe({size:t=64}){return q.jsx("img",{src:lee()?.logo??mR.logo,width:t,height:t,alt:"","aria-hidden":"true","data-testid":"volter-logo",style:{display:"block"}})}const wje="account";function UMt(){return ND({id:wje,title:"Account",kind:"tool-contribution",workspaceRole:"workspace-task",provenance:{origin:"Volter account"},Content:Vcn,closeable:!0,presentation:()=>({kind:"workspace",id:wje})})}kN({id:"workspace",owner:"account-documents",open:(t,n)=>n.id===wje?UMt():null});function $cn(t){return t.source==="environment"?`Environment · ${t.environmentVariable}`:t.source==="system"?"Secure system storage":t.source==="session"?t.configured?"Session only":"Session storage":"Not configured"}function hB({children:t}){return q.jsxs("div",{className:"volter-account-infostrip",children:[q.jsx(dc,{icon:R$,className:"volter-account-infostrip-icon","aria-hidden":"true"}),q.jsx("span",{children:t})]})}function qcn({provider:t,busy:n,run:s,editing:c,removing:d,onEdit:m,onStopEditing:g,onRemoveIntent:S}){const[k,A]=Ye.useState("");return q.jsxs("div",{className:"volter-account-provider","data-configured":t.configured,children:[q.jsx("span",{className:"volter-account-provider-monogram","aria-hidden":"true",children:t.label.slice(0,1)}),q.jsxs("div",{className:"volter-account-provider-main",children:[q.jsxs("div",{className:"volter-account-provider-name",children:[q.jsx("strong",{children:t.label}),t.configured&&q.jsxs(q.Fragment,{children:[q.jsx("span",{className:"volter-account-provider-dot","aria-hidden":"true"}),q.jsx("span",{className:"volter-account-provider-key",children:t.maskedKey})]})]}),q.jsx("span",{className:"volter-account-provider-source",children:$cn(t)}),t.source==="session"&&t.configured&&q.jsx("span",{className:"volter-account-provider-warning",children:"No system credential manager is available. This key will be forgotten when the editor stops."}),t.problem&&q.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:t.problem}),t.source==="environment"&&q.jsxs("span",{className:"volter-account-provider-source",children:["Restart the editor after changing ",t.environmentVariable,"."]})]}),c?q.jsxs("form",{className:"volter-account-provider-form",onSubmit:F=>{F.preventDefault(),s(async()=>{await ywr(t.provider,k),A(""),g()},`${t.label} credential saved.`)},children:[q.jsxs("label",{className:"volter-field",children:[q.jsxs("span",{className:"volter-field-label",children:[t.label," API key"]}),q.jsx(Zm,{autoComplete:"off",autoFocus:!0,type:"password",value:k,onChange:F=>A(F.target.value)})]}),q.jsxs("div",{className:"volter-account-provider-form-actions",children:[q.jsx(Ms,{type:"submit",variant:"primary",disabled:n||k.trim()==="",children:"Save key"}),q.jsx(Ms,{type:"button",variant:"ghost",disabled:n,onClick:()=>{A(""),g()},children:"Cancel"})]})]}):q.jsxs("div",{className:"volter-account-provider-actions",children:[t.configured&&q.jsx(Ms,{size:"compact",disabled:n,onClick:()=>void s(()=>bwr(t.provider),`${t.label} credential is valid.`),children:"Test"}),t.editable&&q.jsx(Ms,{size:"compact",variant:t.configured?"ghost":"secondary",disabled:n,onClick:()=>{A(""),m()},children:t.configured?"Replace":"Add key"}),t.editable&&t.configured&&!d&&q.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(t.provider),children:"Remove"}),d&&q.jsxs(q.Fragment,{children:[q.jsx(Ms,{size:"compact",variant:"danger",disabled:n,onClick:()=>void s(async()=>{await vwr(t.provider),S(null)},`${t.label} credential removed.`),children:"Confirm remove"}),q.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(null),children:"Cancel"})]})]})]})}function xwt({busy:t,run:n}){const s=tBe(),[c,d]=Ye.useState(null),[m,g]=Ye.useState(null),S=s.providerCredentials.filter(k=>k.configured).length;return q.jsxs("section",{className:"volter-account-card volter-provider-connections",children:[q.jsxs("div",{className:"volter-account-providers-header",children:[q.jsxs("div",{children:[q.jsx("h3",{className:"volter-account-card-title",children:"Provider connections"}),q.jsx("p",{className:"volter-account-card-sub",children:"Keys live in this computer's credential manager — never in project files or the editor UI."})]}),q.jsxs("span",{className:"volter-status-dot","data-state":S>0?"on":"off",children:[S," connected"]})]}),q.jsx("div",{className:"volter-account-provider-list",children:s.providerCredentials.map(k=>q.jsx(qcn,{provider:k,busy:t,run:n,editing:c===k.provider,removing:m===k.provider,onEdit:()=>{g(null),d(k.provider)},onStopEditing:()=>d(null),onRemoveIntent:g},k.provider))})]})}function wwt({busy:t,run:n}){const s=tBe(),c=s.codingInference,[d,m]=Ye.useState(c.model),[g,S]=Ye.useState(null),[k,A]=Ye.useState(null);Ye.useEffect(()=>m(c.model),[c.model]),Ye.useEffect(()=>{S(null),A(null)},[d,s.preferredRoute]);const F=D=>n(()=>hwr({...c,...D,model:(D.model??c.model).trim()}),"Coding inference settings saved.");return q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Coding inference"}),q.jsxs("p",{className:"volter-account-card-sub",children:["Coding agents run on the login you already did — ",q.jsx("code",{children:"codex login"}),", Claude's device login, ",q.jsx("code",{children:"grok login"})," — and Volter Editor injects nothing into them. Turn this on only for a harness you have no subscription for: it routes that harness through OpenRouter on this account's managed credits or your own key, and it takes effect only while Preferred route above is Managed or BYOK. Existing sessions keep the route they launched with."]}),q.jsxs("label",{className:"volter-account-switch-row",children:[q.jsx(TD,{checked:c.enabled,disabled:t,onChange:D=>void F({enabled:D.target.checked})}),q.jsxs("span",{className:"volter-account-switch-copy",children:[q.jsx("strong",{children:"Use OpenRouter for coding agents"}),q.jsx("small",{children:"Codex, Claude Code, OpenCode and Pi are configured per spawned process. Grok takes no provider configuration and always runs on its own device login."})]})]}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Managed coding model"}),q.jsxs(Iw,{value:d,disabled:t,onChange:D=>{const J=D.target.value;m(J),J!==c.model&&F({model:J})},children:[!["z-ai/glm-5.2","moonshotai/kimi-k3"].includes(d)&&q.jsxs("option",{value:d,children:[d," · custom"]}),q.jsx("option",{value:"z-ai/glm-5.2",children:"GLM-5.2 · managed default"}),q.jsx("option",{value:"moonshotai/kimi-k3",children:"Kimi K3 · higher-cost option"})]})]}),s.preferredRoute==="managed"?q.jsxs("div",{className:"volter-account-card-footer",children:[q.jsx(Ms,{size:"compact",disabled:t,onClick:()=>{A(null),gwr({model:d,promptTokens:1e5,outputTokens:2e4}).then(S).catch(D=>A(D instanceof Error?D.message:String(D)))},children:"Preflight typical coding session"}),g&&q.jsxs("span",{className:"volter-account-help",children:["Estimate: ",g.estimatedCredits.toLocaleString()," Volter credits ($",g.providerAmountUsd.toFixed(4)," provider cost) for 100k input + 20k output tokens."]}),k&&q.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:k})]}):s.preferredRoute==="byok"?q.jsx(hB,{children:"BYOK coding charges OpenRouter directly and consumes zero Volter credits."}):null,q.jsxs(hB,{children:["Active account route: ",s.preferredRoute,". BYOK requires the OpenRouter connection below; managed uses the Volter balance."]})]})}function zcn({plan:t}){const n=t.status.replace("_"," "),s=t.status==="active"||n.toLowerCase()===t.name.trim().toLowerCase();return q.jsxs("span",{className:"volter-account-plan-chips",children:[q.jsxs("span",{className:"volter-chip","data-tone":"accent",children:[t.name," plan"]}),!s&&q.jsx("span",{className:"volter-chip","data-tone":t.status==="cancelling"?"warn":void 0,children:n}),(t.renewsAt||t.endsAt)&&q.jsxs("span",{className:"volter-chip",children:[t.endsAt?"Access ends":"Renews"," ",new Date(t.endsAt??t.renewsAt).toLocaleDateString()]})]})}function Vcn(){Ye.useSyncExternalStore(Dye,cN,cN);const t=tBe(),[n,s]=Ye.useState("builder@example.test"),[c,d]=Ye.useState([]),[m,g]=Ye.useState(null),[S,k]=Ye.useState("creator"),[A,F]=Ye.useState(""),[D,J]=Ye.useState(!1),[$,G]=Ye.useState(null),[se,pe]=Ye.useState(null),[ue,Ce]=Ye.useState(null),[De,Pe]=Ye.useState(!1);Ye.useEffect(()=>{if(t.authenticated||t.backend!=="live"||t.accountEnvironment==="development-twin"){Pe(!1);return}Ewr().then(zt=>Pe(zt.device)).catch(()=>Pe(!1))},[t.authenticated,t.backend]),Ye.useEffect(()=>{if(!ue)return;const zt=()=>{Awr(ue.authorizationId).then(tr=>{tr&&Ce(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),Ce(null)})};zt();const ft=window.setInterval(zt,1e3);return()=>window.clearInterval(ft)},[ue]),Ye.useEffect(()=>{if(!se)return;const zt=()=>{Pwr(se.deviceCode).then(tr=>{tr&&pe(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),pe(null)})},ft=window.setInterval(zt,Math.max(1,se.intervalSeconds)*1e3);return()=>window.clearInterval(ft)},[se]),Ye.useEffect(()=>{if(!t.authenticated){d([]);return}wwr().then(d).catch(()=>d([]))},[t.authenticated,t.authenticated?t.user.id:"signed-out",t.authenticated?t.credits.used:0]),Ye.useEffect(()=>{if(!t.authenticated){g(null);return}Twr().then(zt=>{g(zt);const ft=["creator","max","ultra"].find(tr=>tr!==t.plan.id);k(ft??"creator"),F(Object.keys(zt.creditPacks)[0]??"")}).catch(()=>g(null))},[t.authenticated,t.authenticated?t.user.id:"signed-out"]);const be=async(zt,ft)=>{J(!0),G(null);try{await zt(),ft&&G(ft)}catch(tr){G(tr instanceof Error?tr.message:String(tr))}finally{J(!1)}};if(!t.authenticated)return q.jsx("div",{className:"volter-account","data-testid":"account-document",children:q.jsxs("div",{className:"volter-account-signin-stack",children:[q.jsxs("div",{className:"volter-account-signin-hero",children:[q.jsx("span",{className:"volter-account-signin-mark","aria-hidden":"true",children:q.jsx(UVe,{size:52})}),q.jsx("h1",{className:"volter-account-signin-title",children:"Sign in to Volter Editor"})]}),t.accountEnvironment==="development-twin"?q.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>fwr(n),"Signed in through the local Clerk Twin.")},children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Development email"}),q.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),q.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use Clerk Twin account"}),q.jsx(hB,{children:"Local Clerk and Polar twins — fake identity and checkout, with the real Volter account and credit boundaries."})]}):t.backend==="live"?q.jsxs("section",{className:"volter-account-card volter-account-signin-card",children:[q.jsx(Ms,{variant:"primary",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await kwr();Ce(zt),window.open(zt.authorizationUrl,"_blank","noopener,noreferrer")}),children:ue?"Waiting for browser sign-in…":"Continue in browser"}),De&&q.jsx(Ms,{variant:"ghost",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await Dwr();pe(zt),window.open(zt.verificationUri,"_blank","noopener,noreferrer")}),children:"Use a device code instead"}),se&&q.jsxs("div",{className:"volter-account-device-code",children:[q.jsx("strong",{children:se.userCode}),q.jsx("span",{children:"Complete authorization in the browser. This editor polls without receiving your password."})]}),q.jsx(hB,{children:"Authorization happens in your browser — this editor never sees your password."})]}):q.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>uwr(n),"Signed in to the zero-charge local account.")},children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Email"}),q.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),q.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use local mock account"}),q.jsx(hB,{children:"Local mock — no payment, network identity, or provider request."})]}),q.jsxs("ul",{className:"volter-account-signin-points",children:[q.jsx("li",{children:"Every paid generation shows its route and estimate first"}),q.jsx("li",{children:"Spend controls and hard limits are on by default"}),q.jsx("li",{children:"Provider keys stay in your system credential manager"})]}),q.jsx(wwt,{busy:D,run:be}),q.jsx(xwt,{busy:D,run:be}),($||wpe())&&q.jsx("div",{className:"volter-account-status",role:"status",children:$??wpe()})]})});const X=t.credits.included+t.credits.purchased,we=X===0?0:Math.min(100,t.credits.used/X*100),qe=X===0?0:Math.max(0,Math.min(100-we,t.credits.reserved/X*100)),bt=X>0&&t.credits.used>X,Pt=t.backend==="mock"||t.entitlements.generation,Wt=zt=>pwr({...t.spendPolicy,...zt});return q.jsxs("div",{className:"volter-account","data-testid":"account-document",children:[q.jsx("h1",{className:"volter-sr-only",children:"Account"}),q.jsxs("div",{className:"volter-account-stack",children:[q.jsxs("header",{className:"volter-account-identity",children:[q.jsx("span",{className:"volter-account-avatar","aria-hidden":"true",children:t.user.email.slice(0,1)}),q.jsxs("div",{className:"volter-account-identity-main",children:[q.jsxs("div",{className:"volter-account-identity-row",children:[q.jsx("h2",{className:"volter-account-identity-email",children:t.user.email}),q.jsx(zcn,{plan:t.plan})]}),q.jsx("p",{className:"volter-account-identity-note",children:t.accountEnvironment==="development-twin"?"Clerk + Polar Twin development account":t.backend==="mock"?"Isolated test account":"Volter account"})]}),q.jsx(Ms,{variant:"ghost",className:"volter-account-signout",disabled:D,onClick:()=>void be(dwr),children:"Sign out"})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsxs("div",{className:"volter-account-card-head",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Credits"}),t.plan.id!=="free"&&t.plan.status==="cancelling"&&q.jsx(Ms,{size:"compact",disabled:D,onClick:()=>void be(()=>fht("resume")),children:"Resume subscription"})]}),!Pt&&q.jsx(hB,{children:"This account has not been admitted to Volter managed services. Signing up or paying does not grant provider access; contact the Volter team for admission."}),m&&q.jsxs("div",{className:"volter-account-card-footer",children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Subscription tier"}),q.jsx(Iw,{value:S,disabled:D||!Pt,onChange:zt=>k(zt.target.value),children:Object.keys(m.plans).map(zt=>{const ft=m.plans[zt],tr=ft.monthlyPriceUsd;return q.jsxs("option",{value:zt,disabled:zt==="free",children:[ft.name,tr!==void 0?` · $${tr}/month`:""," ·"," ",ft.includedCredits.toLocaleString()," credits",zt===t.plan.id?" · current":""]},zt)})})]}),q.jsxs(Ms,{variant:"primary",size:"compact",disabled:D||!Pt||S===t.plan.id||S==="free",onClick:()=>void be(async()=>{const zt=await Swr(S);zt.checkoutUrl?window.open(zt.checkoutUrl,"_blank","noopener,noreferrer"):G(zt.mock?`Mock ${m.plans[S].name} upgrade completed. No payment occurred.`:`Subscription changed to ${m.plans[S].name}.`)}),children:["Choose ",m.plans[S].name]})]}),q.jsxs("div",{className:"volter-account-credit-figure",children:[q.jsx("span",{className:"volter-account-credit-number",children:t.credits.remaining.toLocaleString()}),q.jsx("span",{className:"volter-account-credit-unit",children:"credits remaining"})]}),q.jsxs("div",{className:"volter-meter",role:"progressbar","aria-label":"Credits used","aria-valuenow":Math.round(we),"aria-valuemin":0,"aria-valuemax":100,"data-state":bt?"over":void 0,children:[q.jsx("span",{className:"volter-meter-fill",style:{width:`${we}%`}}),qe>0&&q.jsx("span",{className:"volter-meter-fill","data-part":"reserved",style:{left:`${we}%`,width:`${qe}%`}})]}),q.jsxs("p",{className:"volter-account-cycle-line",children:[t.credits.used.toLocaleString()," of ",X.toLocaleString()," used this cycle",t.credits.resetsAt&&q.jsxs(q.Fragment,{children:[" · resets ",new Date(t.credits.resetsAt).toLocaleDateString()]}),bt&&q.jsx("span",{className:"volter-account-cycle-over",children:" · over allowance"})]}),q.jsxs("div",{className:"volter-account-legend","data-state":bt?"over":void 0,children:[q.jsxs("span",{className:"volter-account-legend-item","data-part":"included",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.included.toLocaleString()," included"]}),q.jsxs("span",{className:"volter-account-legend-item","data-part":"used",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.used.toLocaleString()," used"]}),q.jsxs("span",{className:"volter-account-legend-item","data-part":"reserved",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.reserved.toLocaleString()," reserved"]}),q.jsxs("span",{className:"volter-account-legend-item","data-part":"purchased",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.purchased.toLocaleString()," purchased"]})]}),t.credits.purchasedExpiresAt&&q.jsxs("p",{className:"volter-account-help volter-account-expiry",children:["Purchased credits expire"," ",new Date(t.credits.purchasedExpiresAt).toLocaleDateString(),"."]}),q.jsxs("div",{className:"volter-account-card-footer",children:[m&&A&&m.creditPacks[A]&&q.jsxs(q.Fragment,{children:[q.jsx(Iw,{"aria-label":"Credit pack",value:A,disabled:D||!Pt,onChange:zt=>F(zt.target.value),children:Object.entries(m.creditPacks).map(([zt,ft])=>q.jsxs("option",{value:zt,children:[ft.name," · ",ft.credits.toLocaleString()," credits"]},zt))}),q.jsx(Ms,{size:"compact",disabled:D||!Pt,onClick:()=>void be(async()=>{const zt=m.creditPacks[A],ft=await xwr(A);ft.checkoutUrl?window.open(ft.checkoutUrl,"_blank","noopener,noreferrer"):G(`Added ${zt?.credits.toLocaleString()??""} mock credits. No payment occurred.`)}),children:"Buy credits"})]}),q.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(async()=>{const zt=await Cwr();zt.mock?G("Mock billing portal: no payment page was opened."):window.open(zt.url,"_blank","noopener,noreferrer")}),children:"Billing and invoices"}),t.plan.id!=="free"&&t.plan.status==="active"&&q.jsx(Ms,{size:"compact",variant:"ghost",className:"volter-account-quiet-danger",disabled:D,onClick:()=>void be(()=>fht("cancel")),children:"Cancel at renewal"})]})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Generation routing"}),q.jsx("p",{className:"volter-account-card-sub",children:"Billing preference for AI usage. Provider libraries apply it automatically; requests show the resolved account and cost before submission."}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Preferred route"}),q.jsxs(Iw,{value:t.preferredRoute,onChange:zt=>void be(()=>mwr(zt.target.value)),children:[t.accountEnvironment==="test-mock"&&q.jsx("option",{value:"mock",children:"Mock · free and local"}),q.jsx("option",{value:"auto",children:"Automatic · saved key or Volter account"}),q.jsxs("option",{value:"managed",disabled:!t.routes.managed,children:["Managed · Volter credits",t.routes.managed?"":" (unavailable)"]}),q.jsxs("option",{value:"byok",disabled:!t.routes.byok,children:["BYOK · provider dollars",t.routes.byok?"":" (no key found)"]})]})]})]}),q.jsx(wwt,{busy:D,run:be}),q.jsx(xwt,{busy:D,run:be}),(t.alerts?.length??0)>0&&q.jsxs("section",{className:"volter-account-card",children:[q.jsxs("div",{className:"volter-account-card-head",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Account alerts"}),t.alerts?.some(zt=>!zt.readAt)&&q.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(_wr),children:"Mark read"})]}),q.jsx("div",{className:"volter-account-usage",children:t.alerts?.map(zt=>q.jsxs("div",{className:"volter-account-usage-row",children:[q.jsxs("span",{children:[q.jsx("strong",{children:zt.readAt?"Notice":"New"}),q.jsx("small",{children:zt.message})]}),q.jsx("span",{children:new Date(zt.createdAt).toLocaleDateString()})]},zt.id))})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Spend controls"}),q.jsxs("p",{className:"volter-account-card-sub",children:["Alerts at ",t.spendPolicy.alertThresholds.join("%, "),"% of the available allowance."]}),q.jsxs("label",{className:"volter-account-switch-row",children:[q.jsx(TD,{checked:t.spendPolicy.overageEnabled,onChange:zt=>void be(()=>Wt({overageEnabled:zt.target.checked,monthlyLimitCredits:zt.target.checked&&t.spendPolicy.monthlyLimitCredits===0?1e3:t.spendPolicy.monthlyLimitCredits}))}),q.jsxs("span",{className:"volter-account-switch-copy",children:[q.jsx("strong",{children:"Allow paid overage"}),q.jsx("small",{children:"Off by default. Managed requests stop before provider submission."})]})]}),q.jsx("div",{className:"volter-account-limit-field",children:q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Monthly overage hard limit"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.monthlyLimitCredits,disabled:!t.spendPolicy.overageEnabled,onBlur:zt=>void be(()=>Wt({monthlyLimitCredits:Number(zt.target.value)}))},t.spendPolicy.monthlyLimitCredits),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})}),q.jsxs("label",{className:"volter-account-switch-row",children:[q.jsx(TD,{checked:t.spendPolicy.autoReload?.enabled===!0,onChange:zt=>void be(()=>Wt({autoReload:{enabled:zt.target.checked,whenRemainingBelow:t.spendPolicy.autoReload?.whenRemainingBelow??100,reloadTo:t.spendPolicy.autoReload?.reloadTo??500,monthlyLimitCredits:t.spendPolicy.autoReload?.monthlyLimitCredits??2e3}}))}),q.jsxs("span",{className:"volter-account-switch-copy",children:[q.jsx("strong",{children:"Automatically reload credits"}),q.jsx("small",{children:"Optional, independently capped, and never enabled by checkout."})]})]}),t.spendPolicy.autoReload?.enabled&&q.jsxs("div",{className:"volter-account-policy-fields",children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Reload below"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.whenRemainingBelow,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,whenRemainingBelow:Number(zt.target.value)}}))},t.spendPolicy.autoReload.whenRemainingBelow),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Reload balance to"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:1,defaultValue:t.spendPolicy.autoReload.reloadTo,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,reloadTo:Number(zt.target.value)}}))},t.spendPolicy.autoReload.reloadTo),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Monthly reload cap"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.monthlyLimitCredits,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,monthlyLimitCredits:Number(zt.target.value)}}))},t.spendPolicy.autoReload.monthlyLimitCredits),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})]})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Current-cycle usage"}),c.length===0?q.jsx("p",{className:"volter-account-help",children:"No managed credit usage has been settled in this account."}):q.jsx("div",{className:"volter-account-usage",children:c.map(zt=>q.jsxs("div",{className:"volter-account-usage-row",children:[q.jsxs("span",{children:[zt.kind," · ",zt.provider," · ",zt.operation??"managed operation"]}),q.jsxs("strong",{children:[zt.credits.toLocaleString()," credits"]})]},zt.id))})]}),($||wpe())&&q.jsx("div",{className:"volter-account-status",role:"status",children:$??wpe()})]})]})}function Ucn(t,n,s){const d=navigator.platform.includes("Mac")?"⌘":"Ctrl+",m=Y0(t),g=[...t.selectedEntityIds],S=g[0],k=S?m.hierarchy.node(S)?.parentId??null:null,A=g.length>0&&!!m.structure?.copy&&(m.structure.canCopy?.(g)??!0),F=A&&!!m.structure?.cut,D=!!m.structure?.paste&&(m.structure.canPaste?.(k)??!0),J=[...F?[{id:"editor.cut",label:"Cut",category:"action",shortcut:Vv("edit.cut"),execute:()=>$Ve(t)}]:[],...A?[{id:"editor.copy",label:"Copy",category:"action",shortcut:Vv("edit.copy"),execute:()=>BVe(t)}]:[],...D?[{id:"editor.paste",label:"Paste",category:"action",shortcut:Vv("edit.paste"),execute:()=>qVe(t)}]:[]];return[{id:"account.open",label:"Account and Provider Connections",category:"action",execute:()=>{UMt()}},{id:"editor.undo",label:s?.undoLabel?`Undo ${s.undoLabel}`:"Undo",category:"action",shortcut:Vv("edit.undo"),execute:async()=>{await n.undo()}},{id:"editor.redo",label:s?.redoLabel?`Redo ${s.redoLabel}`:"Redo",category:"action",shortcut:Vv("edit.redo"),execute:async()=>{await n.redo()}},...J,{id:"editor.duplicate",label:"Duplicate",category:"action",shortcut:Vv("edit.duplicate"),execute:()=>bve(t)},{id:"editor.delete",label:"Delete Selected",category:"action",shortcut:Vv("edit.delete"),execute:()=>Sve(t)},{id:"editor.select-all",label:"Select All",category:"action",shortcut:Vv("edit.selectAll"),execute:()=>NRt(t)},{id:"editor.deselect",label:"Deselect All",category:"action",shortcut:Vv("edit.deselectAll")??Vv("edit.exitScopeOrDeselect"),execute:()=>Mze(t,[])},{id:"toggle.console",label:"Toggle Console",category:"action",shortcut:Vv("view.toggleConsole"),execute:()=>{pve()}},{id:"view.focusMode",label:"Toggle Focus Mode",category:"action",shortcut:Vv("view.focusMode"),execute:()=>{qBe()}},...AN().map($=>({id:`workspace.${$.id}`,label:`Workspace: ${$.title}`,category:"action",execute:()=>{Uk($.id)&&a2($.id)}})),{id:"workspace.cycleNext",label:"Next Workspace",category:"action",shortcut:Vv("workspace.cycleNext"),execute:()=>{Che(1)}},{id:"workspace.cyclePrevious",label:"Previous Workspace",category:"action",shortcut:Vv("workspace.cyclePrevious"),execute:()=>{Che(-1)}},...Y4t().map($=>({id:`keymap.${$.id}`,label:`Keymap: ${$.title}`,category:"action",execute:()=>{HEr($.id)}})),...OR().map($=>({id:`view.workspaceStyle.${$.id}`,label:`Workspace Style: ${$.title}`,category:"action",execute:()=>{ZBe($.id)}})),{id:"view.undoHistory",label:"Undo History",category:"action",execute:()=>{zVe()}},{id:"view.lightExplorer",label:"Open Light Explorer",category:"action",execute:()=>vC(nee.lightExplorer.id)},...Object.values(O_).filter($=>$.id!==O_.open.id).map($=>({id:$.id,label:`${$.id.replace("project-asset.","").split("-").map(G=>G[0]?.toUpperCase()+G.slice(1)).join(" ")} Project Asset`,category:"asset",...$.shortcut?{shortcut:$.shortcut.replace("Mod",d)}:{},execute:()=>{window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:$.id}}))}})),{id:"view.asset-library",label:"Asset Library",category:"action",execute:()=>{$Be("asset-library")}}]}function Jcn(t){return Y0e(t).filter(n=>n.id!==NFe).map(n=>({id:`entity:${n.id}`,label:n.name,category:"entity",execute:()=>{Mze(t,[n.id]),LVe("viewport.frameSelection")}}))}function Wcn(){return ive().filter(t=>t.category==="canvas").map(({descriptor:t})=>({id:`board:${t.id}`,label:`Open ${t.title}`,category:"action",execute:()=>void SN(t.id)}))}function aN(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Yge(t){const n=t.type;if(typeof n=="string")return n;if(Array.isArray(n))return n.find(s=>s!=="null")}function JMt(t){const n=aN(t);if("default"in n)return structuredClone(n.default);const s=Yge(n);if(s==="object"||n.properties){const c={};for(const[d,m]of Object.entries(aN(n.properties))){const g=aN(m);("default"in g||Array.isArray(n.required)&&n.required.includes(d))&&(c[d]=JMt(g))}return c}return s==="array"?[]:s==="boolean"?!1:s==="number"||s==="integer"?Number(n.minimum??0):""}function Tje(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase())}function Hcn({name:t,schema:n,value:s,required:c,onChange:d}){const m=Yge(n),g=typeof n.description=="string"?n.description:null,S=Array.isArray(n.enum)?n.enum:null,k=`tool-field:${t}`;if(m==="boolean")return q.jsxs("label",{style:{...VY,gridTemplateColumns:"18px minmax(0, 1fr)"},children:[q.jsx(TD,{id:k,checked:s===!0,onChange:F=>d(F.target.checked)}),q.jsxs("span",{children:[q.jsx("span",{style:Twt,children:Tje(t)}),g&&q.jsx("span",{style:FO,children:g})]})]});const A=q.jsxs("span",{style:Twt,children:[Tje(t)," ",!c&&q.jsx("span",{style:Kcn,children:"optional"})]});return S?q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsxs(Iw,{id:k,value:String(s??""),onChange:F=>d(F.target.value),style:f_e,children:[!c&&q.jsx("option",{value:"",children:"Not set"}),S.map(F=>q.jsx("option",{value:String(F),children:String(F)},String(F)))]}),g&&q.jsx("span",{style:FO,children:g})]}):m==="number"||m==="integer"?q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsx(Zm,{id:k,type:"number",value:typeof s=="number"?s:"",min:typeof n.minimum=="number"?n.minimum:void 0,max:typeof n.maximum=="number"?n.maximum:void 0,step:m==="integer"?1:"any",onChange:F=>d(F.target.value===""?void 0:Number(F.target.value)),style:f_e}),g&&q.jsx("span",{style:FO,children:g})]}):m==="array"&&Yge(aN(n.items))==="string"?q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsx(Zm,{id:k,value:Array.isArray(s)?s.join(", "):"",onChange:F=>d(F.target.value.split(",").map(D=>D.trim()).filter(Boolean)),placeholder:"Comma-separated values",style:f_e}),g&&q.jsx("span",{style:FO,children:g})]}):q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsx(Zm,{id:k,value:typeof s=="string"?s:"",onChange:F=>d(F.target.value||(c?"":void 0)),style:f_e}),g&&q.jsx("span",{style:FO,children:g})]})}function WMt({schema:t,value:n,onChange:s,path:c=""}){const d=aN(t.properties),m=new Set(Array.isArray(t.required)?t.required:[]);return q.jsx("div",{style:{display:"grid",gap:14},children:Object.entries(d).map(([g,S])=>{const k=aN(S),A=Yge(k),F=D=>{const J={...n};D===void 0?delete J[g]:J[g]=D,s(J)};return A==="object"||k.properties?q.jsxs("fieldset",{style:Xcn,children:[q.jsx("legend",{style:Ycn,children:Tje(g)}),typeof k.description=="string"&&q.jsx("p",{style:{...FO,marginTop:0},children:k.description}),q.jsx(WMt,{schema:k,value:aN(n[g]),onChange:F,path:c?`${c}.${g}`:g})]},g):q.jsx(Hcn,{name:c?`${c}.${g}`:g,schema:k,value:n[g],required:m.has(g),onChange:F},g)})})}function Gcn({schema:t,value:n,onChange:s}){const c=aN(t);return c.properties?q.jsx(WMt,{schema:c,value:n,onChange:s}):q.jsx("div",{style:FO,children:"This schema has no form-compatible fields."})}const VY={display:"grid",gap:5},Twt={color:Zf[1],fontWeight:600,fontSize:"var(--volter-font-sm)"},Kcn={color:Zf[3],fontWeight:400,marginLeft:5},FO={display:"block",color:Zf[2],fontSize:"var(--volter-font-sm)",lineHeight:1.4},f_e={boxSizing:"border-box",width:"100%"},Xcn={margin:0,padding:14,border:"1px solid var(--volter-boundary-default)",borderRadius:"var(--volter-radius-md)"},Ycn={padding:"0 6px",color:Zf[1],fontWeight:600},Zge="project-tools",Cje="project-tool:";function Zcn(t){return`${Cje}${t}`}function wve(){ND({id:Zge,title:"Project Tools",kind:"project-tool",workspaceRole:"workspace-reference",Content:HMt,closeable:!0,presentation:()=>({kind:"workspace",id:Zge}),persist:()=>({catalog:!0})})}function Tve(t){const n=N$().tools.find(c=>c.name===t);if(!n)return!1;const s=kC().filter(c=>c.tool?.name===t);return s.length===1?tA(s[0].id):(ND({id:Zcn(t),title:n.summary||n.name,kind:"project-tool",workspaceRole:"workspace-reference",provenance:{sourcePath:n.sourcePath,origin:n.name},Content:HMt,closeable:!0,presentation:()=>({kind:"project-tool",name:t}),persist:()=>({name:t})}),!0)}kN({id:"workspace",owner:"project-tool-documents",open:(t,n)=>n.id!==Zge?null:(wve(),Zge)});kN({id:"project-tool",owner:"project-tool-documents",open:(t,n)=>Tve(n.name)?Pp():null,settle:async t=>{if(await WZ().catch(()=>{}),!await CC(()=>N$().tools.some(n=>n.name===t.name)))throw new Error(`Project tool is not registered: ${t.name}`)}});wee({kind:"project-tool",owner:"project-tool-documents",prepare:()=>WZ().then(()=>{},()=>{}),restore:({state:t})=>{const n=t;return n?.catalog===!0?(wve(),!0):typeof n?.name=="string"&&Tve(n.name)}});function Qcn(){return[{id:"project-tools:open",label:"Open Project Tools",category:"action",execute:()=>wve()},...N$().tools.map(t=>({id:`project-tool:${t.name}`,label:`Run: ${t.summary||t.name}`,category:"action",execute:()=>void Tve(t.name)}))]}function Cwt({value:t}){return q.jsx("pre",{style:nln,children:JSON.stringify(t,null,2)})}function HMt({documentId:t}){Ye.useSyncExternalStore(aMt,ean),Ye.useSyncExternalStore(u2,rA);const n=N$(),s=t.startsWith(Cje)?t.slice(Cje.length):null,c=s?n.tools.find(d=>d.name===s):null;return s?c?q.jsx(eln,{tool:c},c.name):q.jsx("div",{style:Eje,children:"This tool is no longer available."}):q.jsxs("div",{style:Eje,"data-testid":"project-tools-catalog",children:[q.jsx("h2",{style:GMt,children:"Project Tools"}),q.jsxs("p",{style:{...kje,margin:"0 0 18px",maxWidth:720,lineHeight:1.5},children:["Explicitly registered in ",q.jsx("code",{children:"package.json#volter.tools"}),". Each tool is an ordinary project function; a registration may pair it with optional editor contributions."]}),q.jsx("div",{style:{display:"grid",gap:8},children:n.tools.map(d=>q.jsxs(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>Tve(d.name),"data-testid":`project-command-card:${d.name}`,children:[q.jsxs("span",{style:KMt,children:[q.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:d.summary}),q.jsx("span",{style:XMt,children:"Open"})]}),q.jsx("code",{style:{color:Zf[2],fontSize:"var(--volter-font-sm)"},children:d.name}),q.jsx("span",{style:tln,children:q.jsxs("span",{children:[d.host," · ",d.permission.risk," · ",d.sourcePath]})})]},d.name))}),n.tools.length===0&&n.loadErrors.length===0&&q.jsx("div",{style:kje,children:"No project tools registered."}),n.loadErrors.map(d=>q.jsxs("div",{style:Qge,children:[d.sourcePath,": ",d.message]},`${d.sourcePath}:${d.message}`)),o$e().map(d=>q.jsxs("div",{style:Qge,children:[d.entryPath,": ",d.error]},`${d.entryPath}:${d.error}`))]})}function eln({tool:t}){const n=kC().filter(se=>se.tool?.name===t.name),s=JMt(t.inputSchema),[c,d]=Ye.useState(s&&typeof s=="object"&&!Array.isArray(s)?s:{}),[m,g]=Ye.useState(()=>JSON.stringify(c,null,2)),[S,k]=Ye.useState(null),[A,F]=Ye.useState(!1),[D,J]=Ye.useState(null),$=t.host==="node",G=async()=>{if(t.permission.risk==="read"||window.confirm(`${t.permission.summary}
1397
+ `)}const tje=new Set;function Fnn(t){return tje.add(t),()=>{tje.delete(t)}}function Mnn(){for(const t of[...tje])try{t()}catch(n){Qs.error(`a session-sample subscriber threw: ${String(n)}`,"invariant")}}const jnn=5e3;let Aw={frames:0,since:0},VZ=null,zB=null,oR=null;const UZ=new Map;function Lnn(t){const n=window.getComputedStyle(t);if(n.display==="none")return"display: none";if(n.visibility==="hidden")return"visibility: hidden";if(Number.parseFloat(n.opacity||"1")===0)return"opacity: 0";const s=t.getBoundingClientRect();return s.width<=0||s.height<=0?"zero-size box":null}const Bnn="editor-canvas";function $nn(t){const n=t.style;return n.display==="none"?"display":n.visibility==="hidden"?"visibility":n.opacity!==""&&Number.parseFloat(n.opacity)===0?"opacity":null}function g9t(){return[...document.querySelectorAll("canvas")].map((n,s)=>{const c=n.getAttribute("data-testid"),d=n.getBoundingClientRect();return{label:c??(n.className||`canvas #${s}`),area:Math.max(0,d.width)*Math.max(0,d.height),hiddenBy:Lnn(n),inlineHiding:$nn(n),failsafeEligible:c!==Bnn&&!n.closest(".monaco-editor")}})}function qnn(){const t=Snn();if(t.length===0)return{framesDrawn:null,framesUnavailable:"no render loop registered a performance source, so nothing counts this session’s frames"};let n=null;for(const s of t){const d=s.profiler.getSnapshot().frames.at(-1);d&&(n=Math.max(n??0,d.id))}return n===null?{framesDrawn:null,framesUnavailable:"the registered render loop records no frames (its profiler has neither profiling nor telemetry enabled)"}:{framesDrawn:n,framesUnavailable:null}}const PO=new Map,LY=new Map;function znn(){const t=Enn(),n=new Set,s=t.map(c=>{const{id:d,label:m}=c;n.add(d);let g=null;try{g=c.transportAdvances?.()??null}catch{g=null}const S=LY.get(d);g===null?LY.delete(d):LY.set(d,g);const k=g===null||S===void 0?{}:{transportAdvanced:g!==S};let A;try{A=c.contentClock()}catch(J){return PO.delete(d),{id:d,label:m,advanced:null,unavailable:`its content clock threw: ${String(J)}`,...k}}if(A===null)return PO.delete(d),{id:d,label:m,advanced:null,unavailable:"its content clock is temporarily unavailable",...k};const F=A,D=PO.get(d);return PO.set(d,F),D===void 0?{id:d,label:m,advanced:null,unavailable:"first reading — nothing to compare it against yet",...k}:{id:d,label:m,advanced:F!==D,...k}});for(const c of[...PO.keys()])n.has(c)||PO.delete(c);for(const c of[...LY.keys()])n.has(c)||LY.delete(c);return s}function Vnn(t=Date.now()){const n=ste(),s=Aw.since===0?0:t-Aw.since,c=Aw.frames,d=s>0&&c>0?c*1e3/s:null,m=n?{startedMsAgo:oR===null?0:t-oR,...qnn()}:null;return{mode:n?"play":"edit",loops:[...YMe().map(g=>({name:`${g.id} session`,running:g.mounted()})),...YMe().map(g=>({name:`${g.id} playing`,running:g.playing()}))],designTimeSurfaces:znn(),presentedThreeRoots:fPt()?bnn().filter(g=>g.surface==="three").map(g=>g.worldId):null,...(()=>{const g=g9t();return{canvasHiddenBy:TVe(g),canvasHidesItself:wnn(g),hiddenCanvases:xnn(g)}})(),framesProduced:Aw.since===0?null:c,sampleWindowMs:Aw.since===0?null:s,tabVisible:!document.hidden,directManipulationExpected:navigator.webdriver!==!0,fps:d,fpsUnavailable:d===null?Aw.since===0?"the frame sampler has not opened a window yet":"no frame was produced in the sample window":null,play:m}}function y9t(){return Onn(Vnn())}let mB=null;const kxt=new WeakSet;function Unn(t,n){const s=TVe(t);if(s==null){mB=null;return}if(mB===null){mB=n;return}const c=Cnn({canvases:t,framesProduced:Aw.frames,hiddenForMs:n-mB});if(!c.fire)return;const d=[...document.querySelectorAll("canvas")].find(m=>(m.getAttribute("data-testid")??m.className)===c.target.label);!d||kxt.has(d)||(kxt.add(d),c.target.inlineHiding==="display"&&d.style.removeProperty("display"),c.target.inlineHiding==="visibility"&&d.style.removeProperty("visibility"),c.target.inlineHiding==="opacity"&&d.style.removeProperty("opacity"),Qs.error(c.ledger,"invariant"))}function Jnn(){const t=y9t();for(const n of t){const s=Rnn(n);if(!s){UZ.delete(n.id);continue}if(n.id==="visible-tab-fps-floor"){const c=(UZ.get(n.id)??0)+1;if(UZ.set(n.id,c),c<3)continue}Qs.warn(s,"invariant")}return t}function Wnn(){if(zB!==null)return Axt;Aw={frames:0,since:Date.now()};const t=()=>{Aw.frames++,VZ=requestAnimationFrame(t)};return VZ=requestAnimationFrame(t),zB=setInterval(()=>{const n=ste();n&&oR===null&&(oR=Date.now()),n||(oR=null),Mnn(),Unn(g9t(),Date.now()),Jnn(),Aw={frames:0,since:Date.now()}},jnn),Axt}function Hnn(){Aw={frames:0,since:zB===null?0:Date.now()},oR=null,mB=null,UZ.clear(),PO.clear()}function Axt(){VZ!==null&&cancelAnimationFrame(VZ),zB!==null&&clearInterval(zB),VZ=null,zB=null,Aw={frames:0,since:0},oR=null,mB=null,UZ.clear()}let rje=null;function Gnn(t){rje=t}function CVe(){return rje?(rje(),!0):!1}let EVe=[];const nje=new Set;function Dxt(t){EVe=t;for(const n of nje)n()}function Knn(){return EVe}function Xnn(t){return nje.add(t),()=>nje.delete(t)}function Ynn(t){const n=EVe.find(s=>s.id===t);return n?(n.run(),!0):!1}let QQ=null;function Znn(t){QQ=t}function Qnn(t){QQ&&Promise.resolve(QQ(`${t}.focus`)).catch(()=>{})}const ein=/^volter\.([^.]+)\.(.+)$/;async function tin(t,n){if(QQ)return await QQ(t,n);const s=ein.exec(t);if(!s)throw new Error(`No command "${t}". Without the Code-OSS frame there is no command service, so the only commands this editor answers are a view's own verbs, spelled volter.<view>.<verb> (for example volter.blender-node-view.view-all).`);const{invokeViewVerb:c}=await lo(async()=>{const{invokeViewVerb:d}=await Promise.resolve().then(()=>p4r);return{invokeViewVerb:d}},[]);return c(s[1],s[2],n)}const kVe=[{kind:"agent",title:"Conversations",hotkeyScope:"workspace",selectableText:!0,icon:"users"},{kind:"project-work",title:"Project work",hotkeyScope:"workspace",selectableText:!0,icon:"list"},{kind:"hierarchy",title:"Hierarchy",hotkeyScope:"hierarchy",selectableText:!1,region:"outliner",icon:"outliner"},{kind:"assets",title:"Content",hotkeyScope:"asset-browser",selectableText:!1,icon:"folder-open"},{kind:"asset-library",title:"Asset Library",hotkeyScope:"asset-browser",selectableText:!1,icon:"cubes-stacked"},{kind:"inspector",title:"Inspector",hotkeyScope:"inspector",selectableText:!1,region:"properties",icon:"properties"}];async function rin(t){const{liveCanvasFrame:n}=await lo(async()=>{const{liveCanvasFrame:s}=await Promise.resolve().then(()=>grn);return{liveCanvasFrame:s}},void 0);return n(t)}async function nin(...t){const{capturePlayComposite:n}=await lo(async()=>{const{capturePlayComposite:s}=await Promise.resolve().then(()=>drn);return{capturePlayComposite:s}},void 0);return n(...t)}async function Pxt(){return lo(()=>Promise.resolve().then(()=>ZDt),void 0)}async function iin(){return lo(()=>Promise.resolve().then(()=>ocn),void 0)}function oin(t,n=5e3){return bC().some(s=>s.id===t)?Promise.resolve():new Promise(s=>{let c=0,d=()=>{};const m=()=>{clearTimeout(c),d(),s()};d=Xye(()=>{bC().some(g=>g.id===t)&&m()}),bC().some(g=>g.id===t)?m():c=window.setTimeout(m,n)})}async function sin(t){if(t){if(!bC().some(n=>n.id===t)){const n=t.startsWith(Mme);if(n&&(await(await Pxt()).refreshProjectToolContributions(),await oin(t)),!bC().some(s=>s.id===t)){const s=bC().map(d=>d.id),c=n?(await Pxt()).contributionFailureHint(t.slice(Mme.length)):"";throw new Error(`Utility is not registered: ${t}.`+c+` Registered utilities: ${s.length>0?s.join(", "):"(none)"}. A project contributes one by exporting a \`workspace.utility\` tool contribution; its view id is \`tool:<contribution-id>\`.`)}}vC(t)}}async function v9t(t){const n=kVe.map(c=>c.kind),s=n.find(c=>c===t);if(!s)throw new Error(`"${t}" is not a panel of this editor. Panels: ${n.join(", ")}.`);if($Be(s),!await CC(()=>oDt()===s))throw new Error(`The ${s} panel is not in this workspace's layout, so it could not be focused. Panels: ${n.join(", ")}.`);return s}function ain(t,n){if(X0("workspace:scene"))return"workspace:scene";const s=l0().map(c=>c.descriptor.id);throw new Error(`This session has no Scene document open. Open documents: ${s.join(", ")||"none"}; address one as { kind: "workspace", id }.`)}async function cin(t){let n=!1;if(await CC(()=>(n=VMe(t.id),n||fxt(t.id)!==null),PR),n)return Pp();const s=fxt(t.id);throw s?new Error(s):new Error(`World document is not registered: ${t.id}`)}async function lin(t,n){const s=g=>g.filter(S=>S.id===n||S.label===n);let c=[];if(!await CC(()=>{const g=pBe(t)?.adapter?.stories;if(!g)return!1;c=g.storiesFor("");const S=s(c);return S.length===1?(g.apply(S[0].id,S[0].id),!0):c.length>0},PR))throw new Error(`The board mounted no stories provider within the wait window; story ${JSON.stringify(n)} was not applied.`);const m=s(c);if(m.length!==1)throw new Error(m.length===0?`No story matches ${JSON.stringify(n)}. This board's stories: ${c.map(g=>g.label).join(", ")||"(none)"}.`:`${JSON.stringify(n)} is ambiguous (${m.length} stories match) — use the story id: ${m.map(g=>g.id).join(" | ")}`)}async function uin(t,n){const s=await Yye(n.kind,t,n);if(s!==null)return s;let c=!1;if(await CC(()=>(c=SN(n.id)||X0(n.id),c||dxt(n.id)!==null),PR),c)return n.story!==void 0&&await lin(n.id,n.story),n.id;const d=dxt(n.id);throw d?new Error(d):new Error(`Workspace document is not available: ${n.id}`)}async function fin(t,n){const s=await Yye(n.kind,t,n);if(s===null){const{kind:c,...d}=n,m=bkr();throw new Error(`Nothing in this editor can open a '${c}' document (${JSON.stringify(d)}). Either no package registered an opener for that view address, or the subject does not exist. Registered view addresses: ${m.length>0?m.join(", "):"(none)"}.`)}return s}function din(t){const n=nkr();return n===null?"":n.includes(t)?`"${t}" is a kind in this project's document table, not an address — a document opens in the editor registered for its KIND, so address it as { kind: "document", id: "<that table entry's id>" }.`:n.length===0?"":`This project's document table holds ${n.map(s=>`"${s}"`).join(", ")}; each opens as { kind: "document", id: "<the table entry's id>" }.`}async function pin(t,n){if(!n)return Pp();if(!mvr(n.kind))throw new Error(`present-view does not know the document kind "${String(n.kind)}". An EditorView addresses a document by one of: ${iCt.join(", ")}. `+din(String(n.kind)));switch(n.kind){case"scene":return ain();case"world":return cin(n);case"asset":case"tool":case"document":case"story":case"project-tool":case"generation":return fin(t,n);case"workspace":return uin(t,n)}}function _in(t){const n=t.indexOf(",");return{base64:n>=0?t.slice(n+1):t,mimeType:"image/png"}}const Ixt=cve;function min(t,n,s){if(!s?.degenerate)return null;const c=pVe();return!c||!n.contains(c)?null:`This door photographs the "${t}" document, which for a live three ingest holds the GAME'S own canvas — created without \`preserveDrawingBuffer\`, so its pixels can only be read from inside the game's own render pass. This game did not draw inside that window (a render-on-demand world sitting idle, or a loop the Edit-tab input gate has frozen), so the frame came back BLANK (${s.warning??"essentially one flat colour"}) — a PNG that reads as a real image. The editor's own renderer is drawing this same world in the Scene viewport (the mount adopts the captured scene), so capture \`workspace:scene\` instead — or drive the game until it renders and ask again.`}async function b9t(t,n){const s=TC();if(!s)throw new Error("No active editor document to capture.");const{descriptor:c,title:d}=s,m=ote(t),g={id:c.id,title:d,kind:c.kind,...c.provenance?.sourcePath?{sourcePath:c.provenance.sourcePath}:{},...c.provenance?.rootId?{rootId:c.provenance.rootId}:{}},S=s2(c.id);if(S?.capture){const J=S.capture(n);if(!J)throw new Error(`Object3D document could not be captured: ${c.id}`);return{..._in(J),document:g,view:m,source:"object3d-document"}}const k=c.id===a0?o9t()??Ixt(c.id):Ixt(c.id);if(!k)throw new Error(`Active document surface is not mounted: ${c.id}`);const A=l9t(k),F=await nin(A?.container??k,{canvasFrame:A?.canvasFrame??rin,includeDocumentStyles:c.id!==a0&&!A}),D=min(c.id,k,F.flatness);if(D)throw new Error(D);return{base64:F.base64,mimeType:F.mimeType,document:g,view:m,source:c.id===a0?"game-composite":c.id==="workspace:scene"?"scene-viewport":"document-composite",layers:F.layers,...F.flatness?{flatness:F.flatness}:{}}}const hin="workspace:scene";function gin(t){return s2(t)??s2(hin)}function yin(t,n,s,c){const d=s2(n),m=gin(n);s.selection&&(d?.selection?d.selection.apply(s.selection.ids):t.selectMultiple(s.selection.ids));const g=s.viewport;g?.grid!==void 0&&(n&&F_e(n)?CAr(n,g.grid):c.push("This document draws no grid.")),g?.diagnostic&&!m?.setDiagnostic(g.diagnostic)&&c.push(`Diagnostic ${g.diagnostic} is unavailable for this document.`),g?.camera&&!m?.setCamera(g.camera)&&c.push(typeof g.camera=="string"?`${g.camera==="isometric"?"Isometric":g.camera} camera is unavailable for this document.`:"The camera is unavailable for this document."),s.selection?.focus||g?.frame==="selection"?m?.frame("selection")||c.push("The requested selection could not be framed."):g?.frame==="document"&&(m?.frame("document")||c.push("Document framing is unavailable for this document."))}async function Vge(t,n,s={}){if(n?.version!==1)throw new Error("present-view requires EditorView version 1.");const c=Object.keys(n).filter(F=>!Omt.includes(F));if(c.length>0)throw new Error(`present-view does not know ${c.map(F=>`"${F}"`).join(", ")}. An EditorView carries: ${Omt.join(", ")}. A document's own address (kind, and the fields that kind reads) goes under "document".`);const d=ote(t);if(n.style!==void 0){const F=OR().map(D=>D.id);if(!F.includes(n.style))throw new Error(`present-view requires a style of ${F.join(", ")}, got ${String(n.style)}.`);ZBe(n.style)}if(n.workspace!==void 0){if(!kB(n.workspace))throw new Error(`present-view requires a workspace of ${JBe().join(", ")}, got ${String(n.workspace)}.`);if(zS()!==n.workspace){const F=SDt();a2(n.workspace),await Promise.race([F,new Promise(D=>setTimeout(D,3e3))])}}const m=[];n.keymap!==void 0&&n.keymap!==dR()&&m.push(`Keymap "${n.keymap}" was not applied — a view reports the keymap, it does not set it. This project is on "${dR()}" (its adapter's declaration, or its own settings).`);const g=await pin(t,n.document);await sin(n.utility);const S=s2(g);if(await S?.prepare?.(),!S?.selection&&n.selection?.ids.length&&(n.document?.kind==="scene"||n.document?.kind==="world")){const F=n.selection.ids;if(!await CC(()=>F.every(J=>Y0(t).hierarchy.node(J)!==null),PR))throw new Error(`Shared view selection is not available: ${F.join(", ")}`)}g&&Pp()!==g&&X0(g),yin(t,g,n,m),n.panel!==void 0&&await v9t(n.panel);const k=sCt(n,window.location.href);s.updateUrl!==!1&&window.history.replaceState(window.history.state,"",k);const A={view:n,url:k,warnings:m};return(s.origin??"agent")==="agent"&&(await iin()).showEditorPresentationNotice({presented:A,previousView:d}),A}const Uge=new Map;let S9t=0;const ije=new Set;function x9t(){S9t+=1;for(const t of ije)t()}function vin(t,n,s){const c=Uge.get(t);c&&c.assetPath===n&&c.actions.length===s.length&&c.actions.every((d,m)=>d===s[m])||(Uge.set(t,{assetPath:n,actions:s}),x9t())}function bin(t){Uge.delete(t)&&x9t()}function Sin(t){const n=[];for(const s of Uge.values())s.assetPath===t&&n.push(...s.actions);return n}function xin(t){return ije.add(t),()=>ije.delete(t)}function Nxt(){return S9t}const win=[],Oxt=new Set;let Tin=0;function Cin(t){for(const n of win)if(n.match(t))return n;return null}function Ein(t){return Oxt.add(t),()=>{Oxt.delete(t)}}function Rxt(){return Tin}const O_={open:{id:"project-asset.open",shortcut:"Enter"},rename:{id:"project-asset.rename",shortcut:"F2"},move:{id:"project-asset.move",shortcut:null},duplicate:{id:"project-asset.duplicate",shortcut:"Mod+D"},delete:{id:"project-asset.delete",shortcut:"Delete"},copyPath:{id:"project-asset.copy-path",shortcut:"Mod+Shift+C"},reveal:{id:"project-asset.reveal",shortcut:null},refresh:{id:"project-asset.refresh",shortcut:"Mod+R"},import:{id:"project-asset.import",shortcut:null},createFolder:{id:"project-asset.create-folder",shortcut:"Mod+Shift+N"}},eD=[],oje=new Set,BY=new Map;let w9t=0;function _Oe(){w9t++;for(const t of oje)t()}function kin(t){const n=eD.findIndex(s=>s.owner===t.owner&&s.id===t.id);if(n>=0){const[s]=eD.splice(n,1);s&&(BY.get(s)?.(),BY.delete(s))}return eD.push(t),eD.sort((s,c)=>(s.order??0)-(c.order??0)),BY.set(t,t.subscribe(_Oe)),_Oe(),()=>{const s=eD.indexOf(t);s<0||(eD.splice(s,1),BY.get(t)?.(),BY.delete(t),_Oe())}}const Ain=[];function Din(){return eD.length===0?Ain:eD}function T9t(t){return oje.add(t),()=>{oje.delete(t)}}function Jge(){return w9t}function C9t(t){for(const n of eD){const s=n.entries({components:[t],surface:null})[0];if(s)return{source:n,entry:s}}return null}function Pin(){const t=X0e();return t?{path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}}:null}function Iin(t,n){return Ye.useEffect(()=>()=>bin(t),[t]),Ye.useCallback(s=>{n!==null&&vin(t,n,s)},[t,n])}function Nin({id:t,title:n,file:s,tool:c,Component:d}){Ye.useSyncExternalStore(K0e,qQ),Ye.useSyncExternalStore(Dye,cN,cN),Ye.useSyncExternalStore(Fye,lN,lN);const m=Pin(),g=Iin(t,m?.path??null),S=Ye.useRef(null),k=Ye.useCallback(F=>{S.current?.(),S.current=F===null?null:ABe(`building ${F.replace(/^building /,"")}`)},[]);Ye.useEffect(()=>()=>S.current?.(),[]);const A=Ye.useCallback(F=>s$({...F,id:`contribution:${t}:${F.title}`,...F.tone==="warning"?{fades:!0}:{}}),[t]);return q.jsxs("div",{"data-testid":`asset-inspector-tool-${t}`,style:{padding:8,borderTop:"1px solid var(--volter-structural-divider)",marginTop:4},children:[q.jsxs("div",{style:{...WCr,marginBottom:4},children:[q.jsx(dc,{icon:Kk.tool.extension,tone:"muted",style:{marginRight:4}}),n]}),q.jsx(DBe,{file:s,children:q.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:e0e(),surfaces:mBe,account:rBe(),play:Rye(),asset:m,setActions:g,notify:A,work:k})})]})}function Oin(t,n){if(n<=0)return[];if(t.length===0)return Array.from({length:n},()=>0);const s=new Array(n),c=t.length/n;let d=0;for(let m=0;m<n;m++){const g=Math.floor(m*c),S=Math.max(g+1,Math.floor((m+1)*c));let k=0;for(let A=g;A<S;A++)k=Math.max(k,Math.abs(t[A]??0));s[m]=k,d=Math.max(d,k)}return d<=1e-8?s.fill(0):s.map(m=>m/d)}const E9t=32,sje=new Set,Fxt=new Map,Mxt=new Map;let sR=null,JZ=null,k9t=0,aje=0,VB=0,xN=0,jxt=!1,pD={url:null,progress:0,playing:!1};function Rin(){for(const t of sje)t()}function I$(t){pD.url===t.url&&pD.playing===t.playing&&Math.abs(pD.progress-t.progress)<.002||(pD=t,Rin())}function AVe(){return sR??=new AudioContext,sR}function Fin(){if(jxt||typeof window>"u")return;jxt=!0;const t=()=>{if(!sR)return;const n=pD.url,s=xN;sR.resume().then(()=>{n&&s===xN&&!JZ&&sR?.state==="running"&&P9t(n,s)})};window.addEventListener("pointerdown",t,{capture:!0}),window.addEventListener("keydown",t,{capture:!0})}function DVe(){if(VB&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(VB),VB=0,!JZ)return;const t=JZ;JZ=null,t.onended=null;try{t.stop()}catch{}t.disconnect()}function A9t(){if(VB=0,!pD.playing||!sR||aje<=0)return;const t=Math.min(1,(sR.currentTime-k9t)/aje);I$({url:pD.url,progress:t,playing:t<1}),t<1&&typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(A9t))}function Min(t,n,s){if(s!==xN)return;DVe();const c=AVe(),d=c.createBufferSource(),m=c.createGain();m.gain.value=1,d.buffer=t,d.connect(m),m.connect(c.destination),d.onended=()=>{s===xN&&I$({url:n,progress:1,playing:!1})},d.start(),JZ=d,k9t=c.currentTime,aje=t.duration,I$({url:n,progress:0,playing:!0}),typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(A9t))}async function D9t(t){const n=Fxt.get(t);if(n)return n;const s=(async()=>{const c=await fetch(t);if(!c.ok)throw new Error(`Audio preview could not read ${t}.`);const d=await c.arrayBuffer();return AVe().decodeAudioData(d.slice(0))})().catch(()=>null);return Fxt.set(t,s),s}async function P9t(t,n){Fin();const s=await D9t(t);if(n!==xN)return;if(!s){I$({url:t,progress:0,playing:!1});return}const c=AVe();c.state==="suspended"&&(await c.resume(),n!==xN)||c.state==="running"&&Min(s,t,n)}function jin(t){return sje.add(t),()=>sje.delete(t)}function Lin(){return pD}function Bin(t){const n=++xN;DVe(),I$({url:t,progress:0,playing:!0}),P9t(t,n)}function $in(t){t&&pD.url!==t||(xN+=1,DVe(),I$({url:null,progress:0,playing:!1}))}function qin(t,n=E9t){const s=`${t}#${n}`,c=Mxt.get(s);if(c)return c;const d=D9t(t).then(m=>m?Oin(m.getChannelData(0),n):Array.from({length:n},()=>0));return Mxt.set(s,d),d}let _Z=[];function BSn(t){return _Z=[..._Z,t],()=>{_Z=_Z.filter(n=>n!==t)}}function I9t(t){return _Z.find(n=>n.accepts(t))??null}const PVe={folder:"var(--volter-asset-icon-folder)",model:"var(--volter-asset-icon-model)",prefab:"var(--volter-asset-icon-prefab)",component:"var(--volter-asset-icon-component)",audio:"var(--volter-asset-icon-audio)",image:"var(--volter-asset-icon-image)",video:"var(--volter-asset-icon-video)",json:"var(--volter-asset-icon-json)",unknown:"var(--volter-asset-icon-unknown)",source:"var(--volter-asset-icon-source)"},zin={folder:uee,model:$0r,prefab:GB,component:sLe,audio:lLe,image:D0r,video:L0r,json:fLe,unknown:zTt,source:rCt};function vD({kind:t,size:n=24}){return q.jsx(dc,{icon:zin[t],style:{fontSize:n,color:PVe[t]}})}const Vin=100,Uin=50,Jin=new YPt(t=>{const n=I9t(t);return n?n.render(t):Promise.reject(new Error(`No model preview loader for ${t}.`))},2);function N9t(t,n){const[s,c]=Ye.useState(null),[d,m]=Ye.useState(!1),[g,S]=Ye.useState(null),[k,A]=Ye.useState(!1);Ye.useEffect(()=>{c(null),m(!1),S(null),A(!1)},[t]),Ye.useEffect(()=>{let D=!1,J=null;return C$e().then($=>{if(D)return;const G=$.status==="ok"?$.manifest.entries[t.replace(/^\/+/,"")]:void 0;if(!k&&G?.path&&(G.state==="generated"||G.state==="upstream")){S(G.path.startsWith("/")?G.path:`/${G.path}`);return}return J=Jin.request(t,n),J.promise}).then($=>{!D&&$&&c($)}).catch(()=>{D||m(!0)}),()=>{D=!0,J?.cancel()}},[k,n,t]);const F=Ye.useCallback(()=>{S(null),A(!0)},[]);return{src:g??s,fromManifest:g!==null,failed:d,rejectManifest:F}}function O9t({url:t}){const n=N9t(t,Vin);return n.failed?q.jsx(vD,{kind:"model"}):n.fromManifest&&n.src?q.jsx("img",{src:n.src,alt:"cached model preview",onError:n.rejectManifest,style:{width:"100%",height:"100%",objectFit:"contain"}}):n.src?q.jsx("img",{src:n.src,alt:"model preview",style:{width:"100%",height:"100%",objectFit:"contain"}}):q.jsx("div",{style:{width:28,height:28,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center"},children:q.jsx("div",{className:"volter-anim-spin",style:{width:16,height:16,border:`2px solid ${ahe[2]}`,borderTopColor:PVe.model,borderRadius:"50%"}})})}function Win({url:t,name:n}){const[s,c]=Ye.useState(()=>Array.from({length:E9t},()=>.15)),d=Ye.useSyncExternalStore(jin,Lin);Ye.useEffect(()=>{let S=!1;return qin(t).then(k=>{S||c(k)}),()=>{S=!0}},[t]);const m=d.url===t,g=m?d.progress:0;return q.jsx("div",{role:"img","aria-label":`${n} waveform preview`,style:{display:"flex",alignItems:"center",gap:1,width:"86%",height:"62%"},children:s.map((S,k)=>{const A=k/s.length<=g;return q.jsx("i",{style:{flex:1,height:`${12+S*88}%`,background:"var(--volter-asset-icon-audio)",opacity:m&&A?1:.28,borderRadius:1}},k)})})}function wR({kind:t,name:n,variant:s="tile"}){const c=PVe[t],d=s==="cell";return t==="audio"?q.jsxs("svg",{role:"img","aria-label":`${n} waveform preview`,viewBox:"0 0 64 48",width:d?"78%":52,height:d?"78%":44,children:[q.jsx("rect",{width:"64",height:"48",rx:"4",fill:"var(--volter-bg-inset)"}),Array.from({length:16},(m,g)=>q.jsx("rect",{x:g*4+1,y:24-g*13%18/2,width:"2",height:g*13%18+3,fill:c},g))]}):q.jsxs("svg",{role:"img","aria-label":`${n} ${t} preview`,viewBox:"0 0 52 48",width:d?"66%":48,height:d?"72%":44,children:[q.jsx("rect",{x:"5",y:"3",width:"42",height:"42",rx:"4",fill:"var(--volter-bg-inset)",stroke:c}),q.jsx("path",{d:"M13 15h26M13 23h18M13 31h22",stroke:c,strokeWidth:"3",strokeLinecap:"round"})]})}function R9t(t,n,s,c){if(t<=0||n<=0||s<=0||c<=0)return 1;const d=t<=s?Math.floor(s/t):0,m=n<=c?Math.floor(c/n):0,g=Math.min(d,m);return g>=1?g:1/Math.max(Math.ceil(t/s),Math.ceil(n/c))}function $Sn(t,n,s,c,d){return t==="fit"?R9t(n,s,c,d):t}function Hin(t,n,s){const c=Math.max(1,s.sourceWidth??s.width),d=Math.max(1,s.sourceHeight??s.height);t.width=c,t.height=d;const m=t.getContext("2d");if(!m)return;m.imageSmoothingEnabled=!1,m.clearRect(0,0,c,d);const g=eZr(s);if(s.rotated){m.save(),m.translate(s.trimX,s.trimY+g.width),m.rotate(-Math.PI/2),m.drawImage(n,g.x,g.y,g.width,g.height,0,0,g.width,g.height),m.restore();return}m.drawImage(n,g.x,g.y,g.width,g.height,s.trimX,s.trimY,g.width,g.height)}function F9t({sheetUrl:t,frame:n,scale:s,maxEdge:c}){const d=Ye.useRef(null),m=Math.max(1,n.sourceWidth??n.width),g=Math.max(1,n.sourceHeight??n.height),S=c!=null?R9t(m,g,c,c):s??1,k=Math.max(1,Math.round(m*S)),A=Math.max(1,Math.round(g*S));return Ye.useEffect(()=>{const F=d.current;if(!F)return;const D=new Image;let J=!1;return D.onload=()=>{J||Hin(F,D,n)},D.src=t,()=>{J=!0}},[n,t]),q.jsx("canvas",{ref:d,width:m,height:g,"aria-hidden":!0,style:{width:k,height:A,imageRendering:"pixelated",display:"block"}})}const M9t={fontSize:11,color:Zf[3],marginBottom:2},Gin={fontSize:11,color:Zf[1],wordBreak:"break-all"};function mOe({asset:t}){Ye.useSyncExternalStore(u2,rA,rA);const n={path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}};return qDt().map(s=>{let c=!1;try{c=s.match(n)}catch(d){console.error(`[tool contributions] ${s.file}'s asset match() threw.`,d)}return c?q.jsx(Nin,{id:s.id,title:s.title,file:s.file,tool:s.tool,Component:s.Component},`${s.id}:${s.version}`):null})}function Lxt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ph({label:t,value:n}){return q.jsxs("div",{children:[q.jsx("div",{style:M9t,children:t}),q.jsx("div",{style:Gin,children:n})]})}function Kin({asset:t}){const n=t.capabilities?.editor==="environment";Ye.useSyncExternalStore(T9t,Jge,Jge);const s=t.componentPreview,c=s?C9t({name:t.name,path:s.sourcePath,surface:s.surface}):null;return q.jsx("div",{"data-testid":"inspector-asset-preview",style:{position:"absolute",inset:0,background:SBe.inset,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:c?q.jsx(c.source.Thumbnail,{entry:c.entry,previewRevision:0}):n?q.jsx(wR,{kind:"image",name:t.name,variant:"cell"}):t.kind==="image"?q.jsx(Yin,{path:t.path,name:t.name}):t.kind==="video"?q.jsx(Xin,{path:t.path}):t.kind==="model"?q.jsx(O9t,{url:t.path}):q.jsx(wR,{kind:t.kind,name:t.name,variant:"cell"})})}function Xin({path:t}){return q.jsx("video",{src:t,muted:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"contain"}})}function Yin({path:t,name:n}){const{sheetPath:s,frameName:c}=Z0e(t),[d,m]=Ye.useState(null);return Ye.useEffect(()=>{if(!c){m(null);return}let g=!1;return fetch(`/${FRt(s)}`).then(S=>S.ok?S.text():null).then(S=>{if(g||!S)return;const k=jze(S);m(k?.frames.find(A=>A.name===c)??null)}).catch(()=>{g||m(null)}),()=>{g=!0}},[c,s]),d?q.jsx(F9t,{sheetUrl:`/${s}`,frame:d,maxEdge:96}):q.jsx("img",{src:t.split("#")[0],alt:n,style:{width:"100%",height:"100%",objectFit:"contain"}})}function Zin({asset:t}){const[n,s]=Ye.useState(null),{sheetPath:c,frameName:d}=Z0e(t.path);return Ye.useEffect(()=>{if(s(null),t.kind!=="image"||t.capabilities?.editor==="environment")return;let m=!1;if(d)return fetch(`/${FRt(c)}`).then(S=>S.ok?S.text():null).then(S=>{if(m||!S)return;const k=jze(S)?.frames.find(A=>A.name===d);k&&s({w:k.sourceWidth,h:k.sourceHeight})}).catch(()=>{}),()=>{m=!0};const g=new Image;return g.onload=()=>{m||s({w:g.naturalWidth,h:g.naturalHeight})},g.src=t.path.split("#")[0]??t.path,()=>{m=!0}},[t.capabilities?.editor,t.kind,t.path,d,c]),n?q.jsx(Ph,{label:"Dimensions",value:`${n.w} × ${n.h}`}):null}function Qin(){Ye.useSyncExternalStore(Ein,Rxt,Rxt);const t=X0e();if(!t)return null;const n=Cin(t),s=t.name.includes(".")?t.name.split(".").pop()??"":"";return n?q.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",borderBottom:`1px solid ${ahe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[q.jsx(n.View,{asset:t}),q.jsx(mOe,{asset:t})]}):(t.selectionCount??1)===1&&(t.kind==="image"&&!t.path.includes("#")&&t.capabilities?.editor!=="environment"||t.kind==="video"||t.kind==="audio")?q.jsxs(q.Fragment,{children:[q.jsx(HRt,{assetPath:t.path,kind:t.kind,sizeBytes:t.sizeBytes}),q.jsxs("div",{style:{padding:"0 8px",display:"grid",gap:6},children:[t.health&&t.health!=="healthy"&&q.jsx(Ph,{label:"Health",value:t.health}),!!t.healthCodes?.length&&q.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.sourcePath&&q.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!!t.dependencies?.length&&q.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")}),!!t.references?.length&&q.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")})]}),q.jsx(mOe,{asset:t})]}):q.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${ahe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[q.jsx(Zin,{asset:t}),q.jsx("div",{style:{...M9t,marginBottom:0,textTransform:"uppercase"},children:"Asset"}),q.jsx("div",{style:{fontWeight:600,fontSize:12,color:Zf[1],wordBreak:"break-all"},children:t.name}),q.jsx(Ph,{label:"Path",value:t.path}),t.componentPreview&&q.jsx(Ph,{label:"Surface",value:t.componentPreview.surface==="canvas"?"2D / Pixi":t.componentPreview.surface==="three"?"3D / Three":t.componentPreview.surface}),t.selectionCount&&t.selectionCount>1&&q.jsxs(q.Fragment,{children:[q.jsx(Ph,{label:"Selection",value:`${t.selectionCount} assets`}),t.selectionTotalBytes!==void 0&&q.jsx(Ph,{label:"Total size",value:Lxt(t.selectionTotalBytes)}),t.selectionFormats&&q.jsx(Ph,{label:"Formats",value:t.selectionFormats.join(", ")})]}),s&&q.jsx(Ph,{label:"Format",value:s.toUpperCase()}),t.sizeBytes!==void 0&&q.jsx(Ph,{label:"Size",value:Lxt(t.sizeBytes)}),t.capabilities&&q.jsxs(q.Fragment,{children:[q.jsx(Ph,{label:"Runtime readiness",value:t.capabilities.runtimeReady?"Runtime-ready":"Import or conversion required"}),q.jsx(Ph,{label:"Preview",value:t.capabilities.previewable?"Available":"Unsupported"}),q.jsx(Ph,{label:"Placement",value:t.capabilities.placeable?"Placeable":"Not placeable"}),q.jsx(Ph,{label:"Editor",value:FB(t.capabilities)??"No editor"})]}),t.health&&q.jsx(Ph,{label:"Health",value:t.health}),t.healthCodes&&q.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.dependencies&&q.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")||"None"}),t.references&&q.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")||"None"}),t.sourcePath&&q.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!t.componentPreview&&q.jsxs("div",{style:{display:"flex",gap:6},children:[q.jsx(Ms,{type:"button","data-command-id":O_.open.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:open-project-asset",{detail:{path:t.path}})),children:"Open"}),t.selectionCount&&t.selectionCount>1&&q.jsxs(q.Fragment,{children:[q.jsx(Ms,{type:"button","data-command-id":O_.move.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.move.id}})),children:"Move selected"}),q.jsx(Ms,{type:"button","data-command-id":O_.delete.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.delete.id}})),children:"Delete selected"})]})]}),q.jsx("div",{style:{fontSize:10,color:Zf[3]},children:"Double-click (or press Enter) in the asset browser to open the full viewer."}),q.jsx(mOe,{asset:t})]})}function eon(t){return Sin(t).map(n=>({id:n.id,title:n.title,...n.label===void 0?{}:{label:n.label},placement:"identity",...n.disabled===void 0?{}:{disabled:n.disabled},run:n.run}))}function ton(){const t=X0e();if(t===null)return null;const n=Lye();return n&&(n.adapter!==null||n.nodeId!==null)?null:{quickActions:eon(t.path),id:`asset:${t.path}`,title:t.name,kindLabel:t.online?`${t.kind} · ${t.online.source}`:t.kind,note:{text:t.sourcePath??t.path,testId:"inspector-asset-path"},sections:[{id:VRe,title:"Preview",icon:iB,order:k4t,body:{kind:"preview",render:()=>q.jsx(Kin,{asset:t})}},{id:"asset-selection",title:"Asset",icon:R$,order:fQ,body:{kind:"custom",render:()=>q.jsx(Qin,{})},keepMounted:!0}]}}const ron={loop:"Loop control","contract.root":"DOM root","contract.lifecycle.start":"Cold start","contract.lifecycle.pause":"Pause / resume",persistence:"Source persistence",systems:"Commands and state"};function non(t){const n=ron[t];if(n)return n;const[s,c]=t.split("."),d=(c??t).replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase(),m=d.charAt(0).toUpperCase()+d.slice(1);return s==="system"?`${m} adapter`:m}const ion={ok:B0r,gap:qTt,na:nvr,info:R$},oon={ok:Go.semantic.success,gap:Go.semantic.warning,na:Go.content.dim,info:Go.content.dim};function son({row:t}){return q.jsxs("div",{"data-testid":`ingest-coverage-row-${t.seam}`,"data-status":t.status,style:{display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",gap:7,padding:"8px 10px",borderTop:"1px solid var(--volter-structural-divider)"},children:[q.jsx("span",{style:{color:oon[t.status],paddingTop:1},children:q.jsx(dc,{icon:ion[t.status]})}),q.jsxs("div",{style:{minWidth:0},children:[q.jsx("div",{style:{color:Go.content.primary,fontWeight:600},children:non(t.seam)}),q.jsx("div",{style:{marginTop:2,color:Go.content.muted,lineHeight:1.4,overflowWrap:"anywhere"},children:t.detail}),t.missing&&q.jsxs("div",{style:{marginTop:6,color:Go.content.muted,lineHeight:1.4},children:[q.jsx("strong",{style:{color:Go.semantic.warning},children:"Missing:"})," ",t.missing]}),t.fix&&q.jsxs("div",{style:{marginTop:4,color:Go.content.dim,lineHeight:1.4},children:[q.jsx("strong",{children:"Fix:"})," ",t.fix]})]})]})}function aon({report:t}){const{summary:n}=t;return q.jsxs("div",{"data-testid":"ingest-coverage-report",style:{fontSize:"var(--volter-font-base)"},children:[q.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,padding:"7px 10px 9px",color:Go.content.muted},children:[q.jsxs("span",{style:{color:n.gaps>0?Go.semantic.warning:Go.semantic.success},children:[n.gaps," ",n.gaps===1?"gap":"gaps"]}),q.jsxs("span",{children:[n.ok," integrated"]}),q.jsxs("span",{children:[n.na," not applicable"]}),q.jsxs("span",{children:[n.info," informational"]})]}),t.rows.map(s=>q.jsx(son,{row:s},s.seam))]})}function con(t){return{id:"ingest-coverage",title:"Ingest coverage",icon:KTt,order:9e3,description:`${t.summary.gaps} gap${t.summary.gaps===1?"":"s"}`,defaultOpen:!0,testId:"ingest-coverage-section",body:{kind:"custom",render:()=>q.jsx(aon,{report:t}),data:{summary:t.summary,rows:t.rows}}}}function lon(t,n,s){if(t)return t.nodeId;const c=[...n].at(-1);if(c)return c;const d=s.selection?.get().at(-1)??null;if(d===null)return null;const m=s.hierarchy.roots();return m.length===1&&m[0]?.id===d?null:d}const j9t="inspectorPresentation";function uon(t){return t==="card"||t==="column"||t==="properties"}function Bxt(){const t=o3r(j9t);if(!t||typeof t!="object")return{};const n={};for(const[s,c]of Object.entries(t))uon(c)&&(n[s]=c);return n}let UB=null,lve=0;const UO=new Set;let hOe=null;rPt().then(()=>{UB=null,lve++;for(const t of UO)t()});function fon(){lve++;for(const t of UO)t()}function L9t(){if(UB===null){if(!i3r())return Bxt();UB=Bxt()}return UB}function cje(t){return L9t()[t]??null}function IVe(t,n){if(Qnn("volter.properties"),cje(t)!==n){UB={...L9t(),[t]:n},lve++,s3r(j9t,UB);for(const s of UO)s()}}function don(t){return UO.size===0&&(hOe=e3r(fon)),UO.add(t),()=>{UO.delete(t),UO.size===0&&(hOe?.(),hOe=null)}}function $xt(){return lve}function pon(t,n,s=null){return n??s??t}function B9t(t){return t.sections.map(n=>({id:n.id,title:n.title,icon:n.icon,...n.railGroup===void 0?{}:{railGroup:n.railGroup},...n.railDefault===void 0?{}:{railDefault:n.railDefault}}))}function lje(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function _on(t,n){const s=n.selectedEntityId;if(s===null)return null;const c=t.childAdapters(),d=c.find(m=>m.worldId===t.ownerOf(s))??c.find(m=>t.groupNodeId(m.worldId)===s);return d?lje(d.kind):null}function mon(t){const n=lBe();if(n!==null&&n.documentId===Pp())return"asset-lab";const{adapter:s,surface:c}=Cm(t);if(c)return c;if(s instanceof hy){const d=s.childAdapters(),m=d.length===1?lje(d[0]?.kind??""):null;if(m)return m;const g=_on(s,t);if(g)return g}return lje(sve()??"")??"three"}function hon({stories:t,activeStoryId:n,onApplyStory:s,isolation:c,unavailableReason:d}){return q.jsxs("div",{style:{padding:"4px 0"},children:[t.length>0?q.jsxs(Iw,{"data-testid":"ingest-stories-select",value:n,onChange:m=>{const g=m.target.value;s(g===""?null:g)},style:{width:"100%"},children:[q.jsx("option",{value:"",children:"(none)"}),t.map(m=>q.jsx("option",{value:m.id,children:m.label},m.id))]}):q.jsx("div",{"data-testid":"ingest-stories-none",style:{fontSize:"var(--volter-font-base)",color:Go.content.dim,fontStyle:"italic"},children:d??"No stories — this root has no associated portable CSF previews."}),c&&q.jsx(Ms,{"data-testid":"catalog-isolate",onClick:c.toggle,variant:c.isolated?"primary":"secondary","aria-pressed":c.isolated,style:{marginTop:6,width:"100%"},children:c.isolated?"Exit isolation":"Isolate"})]})}const bD=180/Math.PI;function $9t(t,n,s){const c=Math.cos(t/2),d=Math.cos(n/2),m=Math.cos(s/2),g=Math.sin(t/2),S=Math.sin(n/2),k=Math.sin(s/2);return[g*d*m+c*S*k,c*S*m-g*d*k,c*d*k+g*S*m,c*d*m-g*S*k]}function gon([t,n,s,c]){const d=t+t,m=n+n,g=s+s,S=t*d,k=t*m,A=t*g,F=n*m,D=n*g,J=s*g,$=c*d,G=c*m,se=c*g,pe=1-(F+J),ue=k-se,Ce=A+G,De=1-(S+J),Pe=D-$,be=D+$,X=1-(S+F),we=Math.asin(Math.min(Math.max(Ce,-1),1));return Math.abs(Ce)<.9999999?[Math.atan2(-Pe,X),we,Math.atan2(-ue,pe)]:[Math.atan2(be,De),we,0]}function NVe(t){const[n,s,c,d]=t,m=n*n+s*s+c*c+d*d,g=Math.sqrt(m),S=m<Number.EPSILON?[0,0,0,1]:[n/g,s/g,c/g,d/g],[k,A,F]=gon(S);return[k*bD,A*bD,F*bD]}function yon(t,n,s){if(s.length!==3||s.some(d=>!Number.isFinite(d)))throw new Error(`transform.${n} expects three finite numbers.`);const c={position:[...t.position],rotation:[...t.rotation],scale:[...t.scale]};return n==="rotation"?{...c,rotation:$9t(s[0]/bD,s[1]/bD,s[2]/bD)}:{...c,[n]:[s[0],s[1],s[2]]}}function von(t,n,s){const c=NVe(t.rotation);return c[n]=s,{position:[...t.position],rotation:$9t(c[0]/bD,c[1]/bD,c[2]/bD),scale:[...t.scale]}}const bon={x:"#e0726d",y:"#83bd66",z:"#6390dd"};function gOe({axes:t,label:n,values:s,testidPrefix:c,step:d,precision:m,onBegin:g,onPreview:S,onCommit:k,readOnly:A,readOnlyReason:F}){const[D,J]=Ye.useState(null),$=Ye.useRef(!1);return q.jsx(T_e,{label:n,style:{padding:"4px 8px"},children:t.map(({axis:G,name:se})=>q.jsx(SZ,{testId:`${c}-${se}`,label:se,labelColor:bon[se],title:F,disabled:A,step:d,precision:m,value:D?.axis===G?D.value:Number.isFinite(s[G])?s[G]:0,style:{flex:1,minWidth:0},onChange:pe=>{$.current||($.current=!0,g?.()),J({axis:G,value:pe}),S?.(G,pe)},onChangeEnd:pe=>{$.current=!1,J(null),k(G,pe)}},se))})}function Son({dimensions:t="3d",transform:n,readOnly:s=!1,channelEditability:c,note:d,onBegin:m,onPreview:g,onCommit:S}){const k=[{axis:0,name:"x"},{axis:1,name:"y"}],A=[...k,{axis:2,name:"z"}],F=(se,pe,ue)=>{const Ce={position:[...n.position],rotation:[...n.rotation],scale:[...n.scale]};return Ce[pe][se]=ue,Ce},D=(se,pe)=>(ue,Ce)=>{Number.isFinite(Ce)&&pe?.(F(ue,se,Ce))},J=se=>(pe,ue)=>{Number.isFinite(ue)&&se?.(von(n,pe,ue))},$=se=>{const pe=c?.[se],ue=s||pe?.writable===!1;return pe?.reason?{readOnly:ue,readOnlyReason:pe.reason}:{readOnly:ue}},G=[...new Set(["position","rotation","scale"].map(se=>$(se)).filter(se=>se.readOnly&&se.readOnlyReason).map(se=>se.readOnlyReason))];return q.jsxs(VTr,{children:[q.jsx(gOe,{axes:t==="2d"?k:A,label:"Position",testidPrefix:"ingest-position",values:n.position,step:.1,precision:3,...$("position"),onBegin:m,onPreview:g&&D("position",g),onCommit:D("position",S)}),q.jsx(gOe,{axes:t==="2d"?[{axis:2,name:"z"}]:A,label:t==="2d"?"Rotation (degrees)":"Rotation",testidPrefix:"ingest-rotation",values:NVe(n.rotation),step:1,precision:1,...$("rotation"),onBegin:m,onPreview:g&&J(g),onCommit:J(S)}),q.jsx(gOe,{axes:t==="2d"?k:A,label:"Scale",testidPrefix:"ingest-scale",values:n.scale,step:.01,precision:3,...$("scale"),onBegin:m,onPreview:g&&D("scale",g),onCommit:D("scale",S)}),G.map(se=>q.jsx(_p,{"data-testid":"inspector-transform-readonly-reason",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:se},se)),d&&q.jsx(_p,{"data-testid":"inspector-transform-note",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:d})]})}function qxt(t){return t.revertsTo===void 0?`Revert ${t.label} to default`:`Revert ${t.label} to ${t.revertsTo}`}function xon({value:t,onCommit:n,onPreview:s,...c}){const[d,m]=Ye.useState(null),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef({draft:d,onCommit:n});return k.current={draft:d,onCommit:n},Ye.useEffect(()=>{const A=g.current;if(!A)return;const F=()=>{const{draft:D,onCommit:J}=k.current,$=D??A.value;$&&$!==S.current&&J($),S.current=null,m(null)};return A.addEventListener("change",F),()=>A.removeEventListener("change",F)},[]),q.jsx(d4t,{...c,ref:g,value:d??t,onChange:A=>{S.current===null&&(S.current=t),m(A.target.value),s?.(A.target.value)}})}async function q9t(t,n=WRt){const s=await Promise.all(n.map(c=>won(t,c)));return{assets:s.flatMap(c=>c.assets),failedListings:s.flatMap(c=>c.failedListings)}}async function won(t,n){const s=[""],c=[],d=[];let m=0;for(;s.length>0&&m<512;){const g=s.splice(0,8),S=await Promise.all(g.map(k=>t(n,k)));m+=g.length,S.forEach((k,A)=>{const F=g[A];if(!k.ok){d.push(`${n}/${F}: ${k.reason}`);return}for(const D of k.entries){const J=F?`${F}/${D.name}`:D.name;D.type==="directory"?s.push(J):c.push({path:J,root:n,entry:D})}})}return{assets:c,failedListings:d}}async function Ton(t,n){const s=t.filter(S=>S.root==="public"),c=Con(s),d=(await Promise.all(c.map(async S=>{const k=await n(S.path);if(!k)return null;const A=jze(k);return A?{sidecar:S,parsed:A}:null}))).flatMap(S=>S?[S]:[]),m=new Set;for(const{sidecar:S,parsed:k}of d){m.add(S.path);const A=zxt(S.path);for(const F of KYr(k.image))m.add(A?`${A}/${F}`:F);for(const F of s)wMe(F.path)===wMe(S.path)&&m.add(F.path)}const g=d.flatMap(({sidecar:S,parsed:k})=>{const A=zxt(S.path),F=A?`${A}/${k.image}`:k.image;return k.frames.map(D=>({path:`${F}#${D.name}`,root:S.root,entry:{name:`${D.name}.png`,type:"file",...S.entry.size===void 0?{}:{size:S.entry.size},...S.entry.modifiedAt===void 0?{}:{modifiedAt:S.entry.modifiedAt}},spritesheet:{sheetPath:F,x:D.x,y:D.y,width:D.width,height:D.height,rotated:D.rotated,sourceWidth:D.sourceWidth,sourceHeight:D.sourceHeight,trimX:D.trimX,trimY:D.trimY}}))});return[...t.filter(S=>S.root!=="public"||!m.has(S.path)),...g]}function Con(t){const n=new Map;for(const s of t){if(!/\.json$/i.test(s.path))continue;const c=wMe(s.path),d=n.get(c);(!d||LSt(s.path)>LSt(d.path))&&n.set(c,s)}return[...n.values()]}function zxt(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function z9t(t){const n=ig(t).kind;return n==="model"||n==="image"||n==="video"||n==="audio"?n:"other"}function Eon(t){const n=ig(t.entry.name);return n.placeable&&n.runtimeReady?10:n.kind==="model"&&n.runtimeReady?15:n.kind==="prefab"?25:n.runtimeReady&&(n.kind==="image"||n.kind==="audio")?30:n.runtimeReady?40:n.importable?70:90}function kon(t){return(t.surface==="three"?0:t.surface==="canvas"?10:t.surface==="dom"?20:30)+(t.exported?0:4)}const Aon=1e4,Don={paths:[],failures:[]};let $Y=null;async function Pon(){const t=await q9t(eve,["public"]);return{paths:t.assets.filter(n=>z9t(n.entry.name)==="image").map(n=>n.path).sort((n,s)=>n.localeCompare(s)),failures:t.failedListings}}function Ion(){const t=Date.now();return(!$Y||t-$Y.at>Aon)&&($Y={at:t,scan:Pon().catch(n=>($Y=null,{paths:[],failures:[n instanceof Error?n.message:String(n)]}))}),$Y.scan}function Non(t){const[n,s]=Ye.useState(Don);return Ye.useEffect(()=>{let c=!0;return Ion().then(d=>{c&&s(d)}),()=>{c=!1}},[t]),n}const Oon={width:64},Vxt={width:HCr,fontSize:"var(--volter-font-md)",color:Go.content.muted};function AI(t){return`ingest-prop-${t.replace(/\./g,"-")}`}function Ron({field:t,io:n,value:s}){const{paths:c,failures:d}=Non(!0),[m,g]=Ye.useState(null),S=F=>{g(null),Promise.resolve(n.set(t.path,F===""?null:F)).then(D=>{g(D&&!D.persisted?{forValue:F,text:`Not saved — ${D.destination}. See the editor console for the mechanism.`}:null)})},k=m?.forValue===s?m.text:void 0,A=d.length>0?`${d.length} folder(s) under public/ could not be read — this list may be incomplete.`:void 0;return q.jsx(GCr,{testId:AI(t.path),value:s,options:c,previewUrlFor:F=>`/${F}`,disabled:t.readonly,note:k??A,onChange:S})}function Fon({field:t,io:n}){const s=t,c=n.get(s.path),d=zRe(c)?void 0:c,m=s.defaulted===!0&&d===void 0,g=s.readonly?PBe(s):void 0,S=s.resettable?q.jsx(dm,{"data-testid":`ingest-revert-${s.path.replace(/\./g,"-")}`,"aria-label":qxt(s),title:qxt(s),onClick:()=>n.remove?.(s.path),children:q.jsx(dc,{icon:VOe})}):null;return s.type==="boolean"?q.jsxs("label",{title:g,style:{display:"flex",gap:6,alignItems:"center",padding:"6px 8px",fontSize:"var(--volter-font-md)"},children:[q.jsx(TD,{"data-testid":AI(s.path),checked:!!d,ref:k=>{k&&(k.indeterminate=m)},disabled:s.readonly,onChange:k=>n.set(s.path,k.target.checked)}),q.jsx("span",{style:s.defaulted?{color:Go.content.dim}:void 0,children:s.label}),S]}):q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[q.jsx("span",{style:s.defaulted?{...Vxt,color:Go.content.dim}:Vxt,title:g??(s.defaulted?`${s.label} — default (not set here)`:s.label),children:s.label}),s.type==="color"?q.jsx(xon,{"data-testid":s.path==="material.color"?"ingest-color":AI(s.path),value:d??"#ffffff",disabled:s.readonly,onCommit:k=>n.set(s.path,k),onPreview:k=>n.preview?.(s.path,k)}):s.type==="number"?q.jsx(jRe,{type:"number","data-testid":AI(s.path),disabled:s.readonly,value:typeof d=="number"?String(Math.round(d*1e3)/1e3):"",placeholder:m?"—":void 0,onCommit:k=>{const A=Number.parseFloat(k);Number.isFinite(A)&&n.set(s.path,A)},style:Oon}):s.type==="enum"?q.jsxs(Iw,{"data-testid":AI(s.path),disabled:s.readonly,value:String(d??""),onChange:k=>{const A=s.options?.find(F=>String(F)===k.target.value)??k.target.value;n.set(s.path,A)},style:{width:120},children:[m&&q.jsx("option",{value:"",children:"—"}),(s.options??[]).map(k=>q.jsx("option",{value:String(k),children:String(k)},String(k)))]}):s.type==="vec3"?q.jsx("div",{style:{width:190},children:q.jsx(JCr,{value:Array.isArray(d)&&d.length===3?[Number(d[0]),Number(d[1]),Number(d[2])]:[null,null,null],disabled:!!s.readonly,testIdPrefix:AI(s.path),onChange:k=>n.set(s.path,k)})}):s.type==="asset"?q.jsx(Ron,{field:s,io:n,value:typeof d=="string"?d:""}):s.type==="json"?q.jsx(wBe,{"data-testid":AI(s.path),"data-variant":"code",disabled:s.readonly,defaultValue:m?"":JSON.stringify(d??null),placeholder:m?"—":void 0,onBlur:k=>{try{n.set(s.path,JSON.parse(k.target.value))}catch{}},style:{width:160}},`${s.path}:${JSON.stringify(d??null)}`):q.jsx(jRe,{type:"text","data-testid":AI(s.path),readOnly:s.readonly,value:String(d??""),placeholder:m?"—":void 0,onCommit:k=>n.set(s.path,k),style:{width:120}}),S]})}function V9t({fields:t,io:n}){return q.jsx(q.Fragment,{children:t.map(s=>q.jsx(Fon,{field:s,io:n},s.path))})}function uve(t){const[n,s]=Ye.useState(null);return Ye.useEffect(()=>{let c=0;const d=requestAnimationFrame(()=>{c=requestAnimationFrame(()=>s(t))});return()=>{cancelAnimationFrame(d),cancelAnimationFrame(c)}},[t]),n===t}const Mon=Ye.lazy(()=>lo(()=>import("./InspectorCanvasPreview-BrFjhoiD.js"),__vite__mapDeps([263,1,2,3,4])).then(t=>({default:t.InspectorCanvasPreview})));function qSn({picture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=uve(n);return q.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&q.jsx(Ye.Suspense,{fallback:null,children:t()}),!d&&s.map(g=>q.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function jon({source:t,entry:n,previewKey:s,actions:c,mode:d="section"}){const m=d==="thumbnail",g=uve(s);return q.jsxs("div",{"data-testid":m?"inspection-preview-thumbnail":"inspection-preview",style:m?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[g&&q.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",background:"var(--volter-bg-inset)"},children:q.jsx(t.Thumbnail,{entry:n,previewRevision:0,width:m?96:256,height:m?96:256})}),!m&&c.map(S=>q.jsx(Ms,{"data-testid":S.id,size:"compact",disabled:S.disabled,title:S.title,onClick:S.run,style:{position:"absolute",right:8,bottom:8},children:S.label},S.id))]})}function Lon({capture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=uve(n);return q.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(Mon,{capture:t,previewKey:n,size:d?96:256})}),!d&&s.map(g=>q.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function Bon(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function $on(t){const n=[],s=[],c=new Map;for(const d of t)d.group?(c.has(d.group)||(c.set(d.group,[]),s.push(d.group)),c.get(d.group).push(d)):n.push(d);return{ungrouped:n,groups:s.map(d=>({name:d,groupId:Bon(d),properties:c.get(d)}))}}function qon(t,n){if(!t.transforms)return null;const s=t.transforms.dimensions?.(n);return s!==void 0?s:t.hierarchy.object3D===void 0||t.hierarchy.object3D(n)!==null?"3d":null}const zon=14,Von=[[/physic|rigid|collid/i,z0r],[/material/i,h0r],[/light/i,oLe],[/camera/i,cye],[/audio|sound|music/i,lLe],[/player|character|humanoid|person/i,q0r],[/anim|state|machine/i,LTt]];function Uon(t){for(const[n,s]of Von)if(n.test(t))return s;return GB}function Jon(t){return n=>Ye.createElement(jon,{source:t.picture.source,entry:t.picture.entry,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Won(t){return n=>Ye.createElement(Lon,{capture:t.capture,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Hon(t){return t.media?t.media.preview?t.media.preview({displayName:t.displayName,previewKey:t.previewKey,actions:t.actions}):null:t.canvasCapture?Won({capture:t.canvasCapture,previewKey:t.previewKey,actions:t.actions}):t.picture?Jon({picture:t.picture,previewKey:t.previewKey,actions:t.actions}):null}function yOe(t){const n=t.slice(10);if(n!=="position"&&n!=="rotation"&&n!=="scale")throw new Error(`The Transform section has no ${JSON.stringify(t)}.`);return n}const Gon={position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};function Kon(t,n,s,c){if(D4t(t))return t.sections(c,n);const d=t.Section;return[{id:t.id,title:t.title,icon:typeof t.icon=="function"?t.icon(c,n):t.icon,order:t.order,...t.railGroup===void 0?{}:{railGroup:t.railGroup},...t.railDefault===void 0?{}:{railDefault:t.railDefault},body:{kind:"custom",render:()=>Ye.createElement(d,{adapter:n,nodeId:s})}}]}function U9t(t,n,s,c){const d=new Set,m=new Map,g=[];for(const S of t){const k=Kon(S,n,s,c).filter(F=>!d.has(F.id)),A=(D4t(S)?S.claims??[]:[]).filter(F=>!d.has(F));if(!(k.length===0&&A.length===0)){for(const F of k)d.add(F.id),m.set(F.id,S.owner);for(const F of A)d.add(F);g.push(...k)}}return{sections:g,claimed:d,owners:m}}function J9t(t,n,s){return s===void 0?[...t]:t.filter(c=>n.get(c.id)===s.owner||s.builtins.includes(c.id))}function uje(t){const{adapter:n,nullSubject:s}=t,{sections:c,claimed:d,owners:m}=U9t(n?t.contributions??[]:[],n,null,null),g=J9t([...(s?.sections??[]).filter(S=>!d.has(S.id)),...c].sort((S,k)=>S.order-k.order),m,t.rail);return{id:s?.id??"nothing-selected",title:s?.title??"Nothing selected",identity:s?.kindLabel?{rename:{readOnly:!0,set:()=>{}},kindLabel:s.kindLabel,...s.note?{note:s.note}:{}}:null,...s?.hint?{hint:s.hint}:{},presentation:{preferred:IBe(t.surface)},quickActions:s?.quickActions??[],related:[],sections:g}}function Xon(t,n,s){if(t.body.kind!=="custom"||t.body.editable)return t;const c=s.get(t.id);return!c||c.length===0?t:{...t,body:{...t.body,editable:{fields:c,io:n}}}}function Yon(t){const{adapter:n,nodeId:s,node:c,contributions:d,onEdit:m}=t;if(s===null)return uje({nullSubject:t.nullSubject??null,surface:t.surface,contributions:d,adapter:n,rail:t.rail});const{sections:g,claimed:S,owners:k}=U9t(d,n,s,c),A={get:en=>n.inspector?.get(s,en),...n.inspector?.preview?{preview:(en,ii)=>{n.inspector?.preview?.(s,en,ii)}}:{},set:(en,ii)=>{if(!n.inspector)return;const No=gPt(n,s,en,ii);return m(),No},...n.inspector?.remove?{remove:en=>{const ii=O3r(n,s,en);return m(),ii}}:{}},F=n.inspector?.properties(s)??[],D=F.find(en=>en.path==="name"),{ungrouped:J,groups:$}=$on(F.filter(en=>en.path!=="name")),G=J.find(en=>en.path==="visible"&&en.type==="boolean"),se=G?J.filter(en=>en!==G):J,pe=[...D&&D.readonly!==!0?[D]:[],...G?[G]:[]],ue=[];if(G){const en=A.get(G.path)!==!1,ii=en?"Visible — click to hide":"Hidden — click to show";ue.push({id:"inspector-visibility-toggle",title:ii,icon:en?iLe:dLe,placement:"identity",pressed:!en,disabled:G.readonly===!0,run:async()=>{await A.set(G.path,!en)}})}t.assetDocument&&ue.push({id:"open-asset-editor",title:"Open in Asset Editor",label:"Open in Asset Editor",placement:"preview",run:t.assetDocument.open}),n.transforms?.sourceCommit?.availability(s)?.available&&ue.push({id:"commit-live-transform-source",title:"Commit this live transform to its authored source literal",label:"Commit transform to source",icon:BTt,placement:"identity",run:async()=>{await mPt(n,s),m()}});const Pe=new Map;Pe.set(R5e,se);for(const en of $)Pe.set(Vht(en.groupId),en.properties);const be=[],X=n.truth?.resolve(s,"position").site??null,we=t.media,qe=c?.typeLabel??c?.label??s,bt=t.surface==="canvas"&&we===null&&t.stories?C9t({name:qe,path:X?.anchored===!0?X.file:"",surface:"canvas"}):null,Pt=ue.filter(en=>en.placement==="preview"),Wt=Hon({media:we,canvasCapture:t.canvasPreview,picture:bt,displayName:c?.label??s,previewKey:s,actions:Pt});!S.has(VRe)&&Wt!==null&&be.push({id:VRe,title:"Preview",icon:aR,order:k4t,body:{kind:"preview",render:Wt}});const zt=qon(n,s),ft=!S.has(zht)&&zt!==null,tr=ft?$.find(en=>en.name==="Transform")?.properties??[]:[];if(ft){const en=n.transforms?.get(s)??Gon,ii=we?.instanced??null,No=Object.fromEntries(["position","rotation","scale"].map(En=>[En,n.transforms?.editability?.(s,En)??{writable:n.capabilities.transform}])),gn={position:[...en.position],rotation:NVe(en.rotation),scale:[...en.scale]};be.push({id:zht,title:"Transform",icon:JTt,order:_Er,body:{kind:"custom",data:{...gn,editability:No,...ii?{instanced:ii}:{}},editable:{fields:["position","rotation","scale"].map(En=>{const cs=!n.capabilities.transform||!No[En].writable;return{path:`transform.${En}`,label:En[0].toUpperCase()+En.slice(1),type:"vec3",value:gn[En],readonly:cs,...!cs&&n.transforms?.remove&&No[En].removable===!0?{resettable:!0}:{}}}),io:{get:En=>gn[yOe(En)],set:(En,cs)=>{if(!n.transforms)return;const On=yon(en,yOe(En),cs);jFe(n,s),q_e(n,s,On);const ji=LFe(n,s);return m(),ji},...n.transforms?.remove?{remove:En=>{const cs=_Pt(n,s,yOe(En));return m(),cs}}:{}}},render:()=>[Ye.createElement(Son,{key:"channels",dimensions:zt,transform:en,readOnly:!n.capabilities.transform,channelEditability:No,...ii?.note?{note:ii.note}:{},onBegin:()=>{jFe(n,s)},onPreview:En=>{q_e(n,s,En)},onCommit:En=>{q_e(n,s,En),LFe(n,s),m()}}),...tr.length>0?[Ye.createElement(V9t,{key:"rows",fields:tr,io:A})]:[]]}})}S.has(R5e)||(se.length>0&&be.push({id:R5e,title:"Properties",icon:WTt,order:fQ,defaultOpen:!0,body:{kind:"fields",fields:se,io:A}}),$.forEach((en,ii)=>{if(tr.length>0&&en.name==="Transform")return;const No=en.properties.filter(gn=>!gn.defaulted).length;be.push({id:Vht(en.groupId),title:en.name,icon:Uon(en.name),order:A4t+ii,description:No>0?`${No} set of ${en.properties.length}`:`${en.properties.length} properties`,defaultOpen:No>0&&en.properties.length<=zon,testId:`ingest-group-${en.groupId}`,body:{kind:"fields",fields:en.properties,io:A}})}));const Qt=t.stories;!S.has(E4t)&&Qt&&be.push(Zon(Qt)),be.push(...g.map(en=>Xon(en,A,Pe))),be.sort((en,ii)=>en.order-ii.order);const Tt=J9t(be,k,t.rail),vn=CPt(n,s),Yr=EPt(n);return{id:s,title:c?.label??"",identity:{rename:{readOnly:D===void 0||D.readonly===!0,set:en=>A.set("name",en)},kindLabel:`${c?.typeLabel??c?.kind??""}${vn?` · ${vn.label}`:""}`,...c?.kind?{kind:c.kind}:{},...Yr?{document:{path:Yr,...vn?.detail?{title:vn.detail}:{}}}:{},note:X?.anchored?{text:`${X.kind==="data"?"Level data":"Source"} · ${X.display}`,title:X.kind==="data"?`Placed by record ${X.record} of ${X.file}, the game's own level data`:`Constructed by a \`new\` expression at ${X.file} line ${X.line}, column ${X.col}`,testId:"inspector-creation-site"}:void 0},presentation:{preferred:IBe(t.surface)},...pe.length>0?{editable:{fields:pe,io:A}}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},quickActions:ue,related:n.related?.links(s)??[],sections:Tt}}function Zon(t){return{id:E4t,title:t.title??"Stories",icon:pLe,order:mEr,body:{kind:"custom",render:()=>Ye.createElement(hon,{stories:t.stories,activeStoryId:t.activeStoryId,onApplyStory:t.onApplyStory,isolation:t.isolation,unavailableReason:t.unavailableReason??null})}}}const Qon=["project-tool","tool-contribution"];function esn(t){const{activeDocumentKind:n,documentSelection:s}=t;return n===null||!Qon.includes(n)?!1:s===null}function Uxt(t){const{subject:n,surface:s,available:c,override:d,workspaceDefault:m=null,columnShown:g=!0}=t,S=n.presentation.preferred??IBe(),k=pon(S,d,m),A=k!=="card"&&!g?"card":k;return{subject:n,surface:s,presentation:A,available:c,card:c&&A==="card",column:A!=="card"}}const W9t="game";function tsn(t){const n=t.projectName?.trim();return{id:W9t,title:n&&n.length>0?n:"Game",kindLabel:"Game",...t.instanceName?{note:{text:t.instanceName}}:{},sections:[]}}function zSn(t){return b$e({match:()=>Pp()===a0,describe:()=>tsn(t())})}const rsn=3,nsn=Object.freeze({none:!0});function isn(t){const n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function eee(t,n=0){if(t===null)return null;const s=typeof t;if(s==="string"||s==="boolean")return t;if(s==="number")return Number.isFinite(t)?t===0?0:t:{kind:"opaque",type:"number"};if(s!=="object")return{kind:"opaque",type:s};if(n>=rsn)return{kind:"opaque",type:Jxt(t)};if(Array.isArray(t))return t.map(m=>eee(m,n+1));const c=t;if(!isn(c))return{kind:"opaque",type:Jxt(c)};const d={};for(const[m,g]of Object.entries(c))g!==void 0&&(d[m]=eee(g,n+1));return d}function Jxt(t){return t.constructor?.name??"object"}function Wxt(t,n){let s;try{s=n.get(t.path)}catch{s=void 0}return{path:t.path,label:t.label,type:t.type,...zRe(s)?{mixed:!0}:{},...!zRe(s)&&s!==void 0?{value:eee(s)}:{},...t.defaulted!==void 0?{defaulted:t.defaulted}:{},...t.readonly!==void 0?{readonly:t.readonly}:{},...t.readonly?{readonlyReason:PBe(t)}:{},...t.resettable!==void 0?{resettable:t.resettable}:{},...t.revertsTo!==void 0?{revertsTo:t.revertsTo}:{},...t.group!==void 0?{group:t.group}:{},...t.options!==void 0?{options:t.options.map(c=>eee(c))}:{}}}function Hxt(t){const n={};for(const[s,c]of Object.entries(t))c!==void 0&&(n[s]=eee(c));return n}function osn(t){const n=t.body;if(n.kind==="fields")return{kind:"fields",fields:n.fields.map(s=>Wxt(s,n.io))};if(n.kind==="custom"&&n.data!==void 0&&n.editable===void 0)return{kind:"custom",id:t.id,title:t.title,data:Hxt(n.data)};if(n.kind==="custom"&&n.editable!==void 0){const s=n.editable;return{kind:"fields",fields:s.fields.map(c=>Wxt(c,s.io)),...n.data!==void 0?{data:Hxt(n.data)}:{}}}return{kind:n.kind,id:t.id,title:t.title}}function ssn(t){return{id:t.id,title:t.title,order:t.order,...t.description!==void 0?{description:t.description}:{},body:osn(t)}}function asn(t,n){return{id:t.id,title:t.title,...t.identity?.kindLabel?{kindLabel:t.identity.kindLabel}:{},...t.identity?.note?{note:t.identity.note.text}:{},...t.hint?{hint:t.hint}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},presentation:{preferred:t.presentation.preferred,...n?{resolved:n.presentation,surface:n.surface}:{}},quickActions:t.quickActions.map(s=>({id:s.id,title:s.title,...s.label!==void 0?{label:s.label}:{},...s.pressed!==void 0?{pressed:s.pressed}:{},...s.disabled!==void 0?{disabled:s.disabled}:{}})),related:t.related.map(({id:s,title:c})=>({id:s,title:c})),sections:t.sections.map(ssn)}}const Gxt=new WeakMap;function csn(t){if(!t.capture)return null;const n=Gxt.get(t);if(n)return n;const s=async c=>t.capture?.(c)??null;return Gxt.set(t,s),s}function lsn(t){return typeof t.previewImage=="function"}function usn(t,n,s){if(!n)return null;if(s==="asset-lab"){const d=s2(Pp());return d?csn(d):null}let c=t;if(t instanceof hy){const d=t.ownerOf(n);c=t.childAdapters().find(m=>m.worldId===d)?.adapter??t}return lsn(c)?d=>c.previewImage(n,d,d):null}function fsn(){const t=Pp();if(t===null)return null;const n=Ttn(t);if(n===void 0)return null;const s=PN(n.kind);return s===void 0||s.inspectorRail!=="owned"?null:{rail:{owner:s.owner,builtins:s.inspectorBuiltins??[]}}}function dsn(t){const{store:n,adapter:s,documentSelection:c,surface:d}=t,m=ton();if(m!==null)return{subject:uje({nullSubject:m,surface:d}),available:!0};const g=lon(c,n.selectedEntityIds,s),S=g?s.hierarchy.node(g):null;if(g!==null&&S===null)return{subject:uje({nullSubject:null,surface:d}),available:!1};const k=()=>n.notifyIngestEdit(),A=g?null:o4r({adapter:s,surface:d,store:n,onEdit:k}),F=g?S?Wht(S,s):[]:Wht(null,s,{nullSubjectId:A?.id??null}),D=g?Nze(s,g):null;return{subject:Yon({adapter:s,nodeId:g,node:S,surface:d,contributions:F,...g?{}:{nullSubject:A},media:d==="asset-lab"?null:D,canvasPreview:usn(s,g,d),assetDocument:D?.assetDocument??null,stories:e4r(s,S,g),...fsn()??{},...c===null&&g!==null&&n.selectedEntityIds.size>1?{alsoSelected:n.selectedEntityIds.size-1}:{},onEdit:k}),available:g!==null||A!==null||F.length>0}}function fve(t){const n=mon(t),{adapter:s,documentSelection:c}=Cm(t),d=dsn({store:t,adapter:s,documentSelection:c,surface:n}),{subject:m}=d,g=d.available&&(m.id!==W9t||m.sections.length>0)&&!esn({activeDocumentKind:TC()?.descriptor.kind??null,documentSelection:c}),S=Pp()===a0?gVe():null;if(S){const k=con(S),A=g?{...m,sections:[...m.sections.filter(F=>F.id!==k.id),k].sort((F,D)=>F.order-D.order)}:{id:`ingest:${S.summary.worldId}`,title:"Ingested game",identity:null,hint:"This mount exposes no editable scene subject. Coverage below says exactly which editor seams it did earn.",presentation:m.presentation,quickActions:[],related:[],sections:[k]};return Uxt({subject:A,surface:n,available:!0,override:cje(n),workspaceDefault:mD().inspector??null,columnShown:Tgt("properties")!==!1})}return Uxt({subject:m,surface:n,available:g,override:cje(n),workspaceDefault:mD().inspector??null,columnShown:Tgt("properties")!==!1})}function dve(t){const{subject:n,surface:s,presentation:c,available:d}=fve(t);return d?asn(n,{surface:s,presentation:c}):nsn}async function psn(t,n){const{subject:s,available:c}=fve(t);if(!c)throw new Error("No Inspector subject is active.");const d=s.quickActions.filter(g=>g.id===n);if(d.length!==1){const g=s.quickActions.map(S=>S.id);throw new Error(d.length===0?`Inspector action ${JSON.stringify(n)} is not available. `+(g.length>0?`Available actions: ${g.join(", ")}.`:"This subject exposes no actions."):`Inspector action id ${JSON.stringify(n)} is ambiguous (${d.length} matches).`)}const m=d[0];if(!m||m.disabled)throw new Error(`Inspector action ${JSON.stringify(n)} is disabled.`);return await m.run(),dve(t)}function _sn(t,n){const s=c=>{throw new Error(`Inspector field ${JSON.stringify(t.path)} expects ${c}.`)};if(t.type==="number"&&(typeof n!="number"||!Number.isFinite(n))&&s("a finite number"),t.type==="boolean"&&typeof n!="boolean"&&s("a boolean"),(t.type==="string"||t.type==="color"||t.type==="asset"||t.type==="enum")&&typeof n!="string"&&s("a string"),t.type==="vec3"&&(!Array.isArray(n)||n.length!==3||n.some(c=>typeof c!="number"||!Number.isFinite(c)))&&s("three finite numbers"),t.type==="enum"&&t.options&&!t.options.includes(n))throw new Error(`Inspector field ${JSON.stringify(t.path)} accepts: ${t.options.map(String).join(", ")}.`)}async function msn(t,n,s){const c=H9t(t,n);_sn(c.field,s);const d=await c.io.set(n,s)??Lhe;return{subject:dve(t),write:d}}function H9t(t,n){const{subject:s,available:c}=fve(t);if(!c)throw new Error("No Inspector subject is active.");const d=(s.editable?.fields??[]).filter(k=>k.path===n).map(k=>({field:k,io:s.editable.io})),m=s.sections.flatMap(k=>{const A=k.body,F=A.kind==="fields"?{fields:A.fields,io:A.io}:A.kind==="custom"?A.editable:void 0;return F?F.fields.filter(D=>D.path===n).map(D=>({field:D,io:F.io})):[]}),g=[...d,...m];if(g.length===0)throw new Error(`The active Inspector has no field at ${JSON.stringify(n)}.`);if(g.length>1)throw new Error(`The active Inspector exposes ${JSON.stringify(n)} more than once.`);const S=g[0];if(S.field.readonly)throw new Error(`Inspector field ${JSON.stringify(n)} is read-only: ${PBe(S.field)}`);return S}class fje extends Error{constructor(n){super(n),this.name="InspectionRemovalUnavailableError"}}async function hsn(t,n){const s=H9t(t,n);if(s.field.resettable!==!0)throw new fje(`Inspector field ${JSON.stringify(n)} does not declare itself removable (\`resettable\`), so this lane has no way to express the property's absence. Write a value with \`set-inspection-field\` instead — and note that doing so cannot restore byte-absence for a property an edit ADDED.`);if(!s.io.remove)throw new fje(`The Inspector io that owns ${JSON.stringify(n)} implements no removal door, so the property's authored override cannot be dropped through this editor. The dialect writer that owns this source edit owns removal too; until it does, an edit/revert round trip over this lane is unverifiable at byte level.`);const c=await s.io.remove(n)??Lhe;return{subject:dve(t),write:c}}const OVe=new Map;let G9t=[];const dje=new Set;function K9t(){G9t=[...OVe.values()];for(const t of dje)t()}function VSn(t){return dje.add(t),()=>dje.delete(t)}function USn(t){OVe.set(t.rootId,t),K9t()}function JSn(t){OVe.delete(t)&&K9t()}function X9t(){return G9t}function gsn(){const t=X9t();if(t.length===0)return null;const n=t.filter(s=>s.source==="measured");return n.length===0?null:`${n.length} of ${t.length} root(s) have NO readiness declaration (${n.map(s=>s.rootId).join(", ")}) — the host is measuring instead. A self-booting game states it with \`window.volterGame.ready\`.`}function ysn(t){return t.liveMounted?t.livePlaying?t.storePlayState==="paused"?"paused":"playing":"paused":"stopped"}async function vsn(t,n){switch(t.reach.kind){case"game-contract":{const s=n.scenes();if(!s)return{ok:!1,code:"SCENE_CONTRACT_UNAVAILABLE",error:`open: "${t.id}" is reached through the running game's own scenes contract, and the game running in this session publishes none (\`window.volterGame.scenes\`).`};const c=s.goToScene(t.reach.sceneId);if(!c.ok)return{ok:!1,code:"SCENE_NOT_IN_CONTRACT",error:`open: "${t.id}" — ${c.error}`,known:c.known};const d=await c.settled;return d.error!==void 0?{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — the game's own navigation failed: ${d.error}`}:(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:d.requested,current:d.current}})}case"root-mount":return n.activateGameDocument()?{ok:!0,documentId:n.gameDocumentId,title:t.label}:{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t.id}" is the running game itself, and no game document is open in this session.`};case"entrypoint-selection":{const s=n.remountSelection,c=t.region;if(!s||c===null)return{ok:!1,code:"SCENE_NOT_OPENABLE_LIVE",error:`open: "${t.id}" sits at the entrypoint's \`${t.reach.selection}\` swap slot, and this session has no live remount for a native swap-slot scene — a running game cannot be sent there in place. Stop the game and open it as a document instead.`};const d=await s({selection:t.reach.selection,key:t.reach.key,regionId:c});return d.ok?(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:t.reach.key,current:t.reach.key},restart:!0}):{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — remount at \`${t.reach.selection}["${t.reach.key}"]\` failed: ${d.error}`}}case"story":case"none":return null}}const Wge="console";function bsn(t){let n=zQ().length>0;const s=PRt(()=>{const m=zQ().length>0;m&&!n&&mD().drawer!=="hidden"&&vC(Wge),n=m});let c=t.getSnapshot().lastError!==null;const d=t.subscribe(()=>{const m=t.getSnapshot().lastError,g=m!==null;g&&!c&&(Qs.error(`Source write rolled back: ${m.message} (${m.code})`,"history"),mD().drawer!=="hidden"&&vC(Wge)),c=g});return()=>{s(),d()}}function pve(){lkr(Wge)}function _ve(){vC(Wge)}const Hge=new Map;function WSn(t){return n=>{if(n.phase==="adopted"){Hge.set(t,{source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[]});return}const s=Hge.get(t);s&&s.alternates.push({sceneId:n.sceneId,cameraId:n.cameraId,sameRenderer:n.sameRenderer,drawCount:n.drawCount})}}function HSn(t){Hge.delete(t)}function Ssn(){return[...Hge].map(([t,n])=>({rootId:t,source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[...n.alternates],...n.alternates.length>0?{ambiguity:`"${t}" rendered ${n.alternates.length} other world(s) after the one the editor adopted (${n.source}: ${n.sceneId}). The adopted world is unchanged; if the editor is showing the wrong scene, one of these is it: `+n.alternates.map(s=>`${s.sceneId}${s.sameRenderer?"":" (a SECOND renderer)"}`).join(", ")}:{}}))}const xsn=new Set(["state","stateAll","providers","commands","events","snapshot"]);function wsn(t){if(t.type!=="bridge-call")return[];const n=t.method;if(typeof n!="string"||!xsn.has(n))return[];const s=t.instance;try{const c=Gwr(s).debug;if(c===void 0)return[];const d=[T3t(c),s??""].join(":"),m=(S,k="")=>[d,S,k].join(":");if(n==="snapshot")return[m("snapshot"),m("state","time"),m("stateAll"),m("events")];const g=n==="state"?String(t.callArgs?.[0]):"";return[m(n,g)]}catch{return[]}}function Tsn(t,n,s){const c=wsn(t),d=n&&c.length>0&&c.every(m=>s.has(m));if(n)for(const m of c)s.add(m);return{derived:d?"none":n&&c.length>0?"always":Hvr(t.type)??Jvr(t.type),playFullReport:n&&!d&&c.length>0?"explicit":n&&t.type==="bridge-call"&&t.method==="invoke"?"if-content-changed":"none"}}function Csn(t,n,s,c){return t==="none"?!1:!(t==="if-content-changed"&&n==="none"&&s===c)}function Kxt(t,n){const s=nq(t);return s.hierarchy.node(n)!==null||Nze(s,n)!==null?null:`select: no entity with id "${n}" — neither the active authoring adapter's hierarchy nor the live object index owns it, so there is nothing to select. Read the ids that exist with editor.hierarchy() (the rows the panel is rendering) or editor.status().entities.`}function vOe(t,n,s){const c=s2(Pp())?.selection;if(c){c.apply(n);return}const d=t.applySelectionBeforePresentation(n);s?.deferPresentation?s.deferPresentation(d):setTimeout(d,0)}function Esn(){return typeof document>"u"?null:{visibility:document.visibilityState,focused:document.hasFocus(),reportedAt:Date.now()}}const ksn=["entities","entityCount","ontologyInvariants"];function Asn(t){const n={...t};for(const s of ksn)delete n[s];for(const s of Xrn())delete n[s];return{...n,_statePatch:!0}}function Xxt(t,n=null){const s=zQ(),c=Pp(),d=Fze(t),m=x4t.getSnapshot(),g=n?.entities??Y0e(t);return{playState:ysn({storePlayState:t.playState,liveMounted:vVe(),livePlaying:ave()}),mountFailures:s.map(S=>({...S})),storyFailures:rq().flatMap(S=>S.ok?[]:[{modulePath:S.modulePath,error:S.error}]),moduleSplits:dnn().map(S=>({path:S.path,urls:[...S.urls]})),adapter:u0(),readiness:X9t().map(S=>({...S})),readinessWarning:gsn(),worldAdoption:Ssn().map(S=>({...S})),presence:Esn(),pageErrors:Dsn(),consoleErrors:Psn(),sessionErrors:Isn(),sessionWarnings:Nsn(),rendererResources:{...hnn()},ontologyInvariants:n?.ontologyInvariants??y9t().map(S=>({...S})),...Krn(n),selectedEntityId:d[0]??null,selectedEntityIds:d,selectedCreationSite:zYr(t),selectedWriteAnchorKind:VYr(t),activeViewportTab:t.activeViewportTab,activeDocumentId:c,activeUtilityId:akr(),gameplaySession:{selectedSessionId:m.selectedSessionId,latestSessionId:m.sessions[0]?.id??null,selectedStatus:m.selectedSession?.status??null,cursorMs:m.cursorMs,liveEdgeMs:m.liveEdgeMs},openDocumentIds:l0().map(S=>S.descriptor.id),availableDocuments:ive().map(S=>({id:S.descriptor.id,category:S.category,default:S.default})),activeTabKey:(()=>{const S=Pp();return S&&XRt(S)?S:"__inspector__"})(),entityCount:g.length,savePath:Rze(t),saveState:IRt(t),entities:g,viewportActivationTimings:_Tr()}}function Y9t(t,n){const s=n instanceof Error?n.message:String(n),c=`editor command "${String(t.type)}" threw: ${s}`;return console.error(c,n),{ok:!1,error:c}}function RVe(t){const n=dVe();return!n||t<n.startedAt?!1:n.endedAt===null||t<=n.endedAt}function Dsn(){return Qs.getEntries().filter(t=>t.level==="error"&&t.source==="runtime"&&RVe(t.timestamp)).slice(-100).map(t=>t.count>1?`${t.message} (×${t.count})`:t.message)}const Yxt=200;function Psn(){return FVe(Qs.getEntries().filter(t=>t.level==="error"&&t.source!=="runtime"&&RVe(t.timestamp)))}function FVe(t){const n=t.reduce((c,d)=>c+d.count,0),s=t.slice(-3).map(c=>{const d=c.source?`[${c.source}] `:"",m=c.count>1?` (×${c.count})`:"",g=c.message.length>Yxt?`${c.message.slice(0,Yxt)}…`:c.message;return`${d}${g}${m}`});return{count:n,recent:s}}function Isn(){return FVe(Qs.getEntries().filter(t=>t.level==="error"&&!RVe(t.timestamp)))}function Nsn(){return FVe(Qs.getEntries().filter(t=>t.level==="warn"))}async function Osn(t){const n=t.src;if(typeof n!="string")return{ok:!1,error:`document-script requires a string "src" (the step's toString())`};const s=Pp();if(!s)return{ok:!1,error:"document-script: no document is active",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE"}};await y4t(s);const c=cQ(s);if(Pp()!==s)return{ok:!1,error:"document-script: the active document changed while its context was loading",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};if(c===void 0)return{ok:!1,error:`document-script: the active document (${s}) publishes no context to run against — a document opts in through its \`publishContext\` prop (the mesh document publishes its session).`,data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};let d;try{d=new Function("ctx","info",`return (${n})(ctx, info)`)}catch(m){return{ok:!1,error:`document-script: failed to reconstruct the step function from source — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}try{const m=await d(c,{documentId:s});return{ok:!0,data:{result:m===void 0?null:m}}}catch(m){return{ok:!1,error:`document-script: step threw — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}}async function Rsn(t,n,s){if(JYr(n.type),TYr()&&n.type!=="stop")return{ok:!1,error:"Video export owns this paused run. Stop it to cancel before another command."};const c=mVe(n);if(c)return c;if(n.type==="play"||n.type==="restart"){const g=zQ();if(g.length>0)return{ok:!1,error:`this project's ${g.length===1?"root":"roots"} did not mount, so there is nothing to ${n.type==="play"?"play":"restart"}: `+g.map(S=>`"${S.worldId}" (${S.identity}) — ${S.message}`).join("; ")}}const d=await WYr(n.type);if(d)try{const g=await d.handle(n);return{ok:g.ok,...g.error!==void 0?{error:g.error}:{},...g.data!==void 0?{data:g.data}:{}}}catch(g){return Y9t(n,g)}if(!fye(n.type))return{ok:!1,error:`unknown command type "${n.type}" — not one of the editor's own, and no package this project declares contributes it (or the editor page predates this CLI)`,data:{code:"UNKNOWN_COMMAND_TYPE"}};const m=n.type;switch(m){case"session-prepare-close":return await _nn(),{ok:!0};case"select":{const g=n.id??null;if(g!==null){const S=Kxt(t,g);if(S)return{ok:!1,error:S}}vOe(t,g?[g]:[],s);break}case"select-multiple":{const g=n.ids;for(const S of g){const k=Kxt(t,S);if(k)return{ok:!1,error:k}}vOe(t,g,s);break}case"select-all":{vOe(t,Y0e(t).map(g=>g.id),s);break}case"viewport-tab":{const g=n.tab;if(g!=="edit"&&g!=="play")return{ok:!1,error:`viewport-tab requires "edit" or "play", got ${String(g)}.`};const S=l0().map(A=>A.descriptor.id),k=g==="play"?S.find(A=>A===a0):S.find(A=>A==="workspace:scene")??S.find(A=>A!==a0);if(!k||!X0(k))return{ok:!1,error:g==="play"?"viewport-tab play: no Game document is open. Start Play first.":"viewport-tab edit: no document other than Game is open."};break}case"show-panel":try{const g=n.panel;return typeof g!="string"||g.trim()===""?{ok:!1,error:'show-panel requires a non-empty "panel".'}:{ok:!0,data:{panel:await v9t(g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"active-tab":{const g=n.key;if(g!=="__inspector__"&&!X0(g)){const S=l0().map(k=>k.descriptor.id);return{ok:!1,error:`No open workspace document with id "${g}" — nothing was activated. `+(S.length>0?`Open documents: ${S.join(", ")}.`:"No documents are open in this workspace.")}}break}case"select-asset":{const g=n.path;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:'select-asset requires a non-empty "path".'};const S=g.replace(/^\/+/,""),k=S.split("/").pop()??S,A=ig(k);BI({path:g,name:k,kind:FB(A)??"unknown",capabilities:A,origin:"project"});break}case"open-asset-tab":{const g=n.kind,S=sN(n.path,g);if(!await YRt(S,g))return{ok:!1,error:`Asset document did not finish mounting its Inspector: ${S}`};break}case"close-asset-tab":{const g=n.key;XRt(g)&&EN(g);break}case"toggle-command-palette":CVe();break;case"toggle-console":pve();break;case"page-reload":return setTimeout(()=>{window.location.reload()},0),{ok:!0,data:{scheduled:!0}};case"set-workspace":{const g=n.workspace;if(!kB(g))return{ok:!1,error:`set-workspace requires one of ${JBe().join(", ")}, got ${String(g)}.`};if(zS()===g)return{ok:!0,data:{workspace:g,applied:!0}};const S=SDt().then(()=>!0);a2(g);const k=await Promise.race([S,new Promise(A=>setTimeout(()=>A(!1),3e3))]);return{ok:!0,data:{workspace:g,applied:k}}}case"set-style":{const g=n.style,S=OR().map(A=>A.id);if(typeof g!="string"||!S.includes(g))return{ok:!1,error:`set-style requires one of ${S.join(", ")}, got ${String(g)}.`};ZBe(g);const k=Nhe();return k!==g?{ok:!1,error:`set-style applied "${g}" but the editor is wearing ${k===null?"a custom mix of axes":`"${k}"`} (${_gt(g).join("; ")}).`,data:{style:k,differences:_gt(g)}}:{ok:!0,data:{style:g}}}case"viewport-presentation":{const g=n.documentId;if(typeof g!="string"||g==="")return{ok:!1,error:"viewport-presentation needs a `documentId` (a document stage)."};const S=F_e(g)===null&&F_e(`document:${g}`)!==null?`document:${g}`:g,k=n.layer;if(k!==void 0){if(typeof k!="object"||k===null)return{ok:!1,error:"viewport-presentation `layer` must be a presentation layer object."};QBe(S,k)}const A=n.preset;return A!==void 0&&(typeof A!="string"||!kAr(S,A))?{ok:!1,error:`viewport-presentation \`preset\` must be one of: ${hgt().map(F=>F.id).join(", ")||"(none registered)"}.`}:{ok:!0,data:{presentation:e$e(S),binding:F_e(S),bound:IAr(),lastDraw:PAr(S),presets:wAr().map(F=>F.id),viewPresets:hgt().map(F=>F.id),environmentImages:MAr().map(F=>F.id)}}}case"set-appearance":{const g=n.material;return g===void 0?{ok:!1,error:"set-appearance needs a `material` to set."}:Bye(g)?(DDt(g),{ok:!0,data:{material:_N(),style:Nhe()}}):{ok:!1,error:`set-appearance material must be one of ${FTr().map(k=>k.id).join(", ")}, got ${String(g)}.`}}case"present-view":try{return{ok:!0,data:{...await Vge(t,n.view)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"current-view":return{ok:!0,data:{view:ote(t)}};case"inspect":return{ok:!0,data:{subject:dve(t)}};case"run-inspection-action":try{const g=n.actionId;if(typeof g!="string"||g.trim()==="")throw new Error("run-inspection-action requires a non-empty actionId.");return{ok:!0,data:{subject:await psn(t,g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"run-command":try{const g=n.commandId;if(typeof g!="string"||g.trim()==="")throw new Error("run-command requires a non-empty commandId.");const S=await tin(g,n.args);return{ok:!0,data:{result:S===void 0?null:S}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"hierarchy":{const g=xxt();return g===null?{ok:!1,error:"the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to report. Open the Hierarchy panel in the workspace dock and retry."}:{ok:!0,data:{hierarchy:enn(g,{playState:t.playState,activeViewportTab:t.activeViewportTab})}}}case"expand-hierarchy-all":case"collapse-hierarchy-all":{const g=n.type==="expand-hierarchy-all",S=xxt();if(S===null)return{ok:!1,error:`the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to ${g?"expand":"collapse"}. Open the Hierarchy panel in the workspace dock and retry.`};const k=Zrn();g?S.expandAll():S.collapseAll();try{await k}catch(A){return{ok:!1,error:A instanceof Error?A.message:String(A)}}return{ok:!0,data:{}}}case"undo":case"redo":{const g=s?.history;if(!g)return{ok:!1,error:`${String(n.type)}: this editor has no history session attached, so there is nothing to undo.`};const S=n.type==="undo"?await g.undo():await g.redo(),k=g.getSnapshot();return{ok:!0,data:{moved:S,canUndo:k.canUndo,canRedo:k.canRedo,undoLabel:k.undoLabel,redoLabel:k.redoLabel}}}case"set-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("set-inspection-field requires a non-empty field path.");const S=await msn(t,g,n.value);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"remove-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("remove-inspection-field requires a non-empty field path.");const S=await hsn(t,g);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return g instanceof fje?{ok:!1,error:g.message,data:{code:"REMOVAL_UNAVAILABLE"}}:{ok:!1,error:g instanceof Error?g.message:String(g)}}case"structure-op":try{const g=String(n.op??""),S=Cm(t).adapter,k=Fze(t),A=Array.isArray(n.ids)?n.ids.filter(G=>typeof G=="string"):typeof n.id=="string"&&n.id.trim()!==""?[n.id]:k,F=A[0],D=()=>{if(!F)throw new Error(`structure-op "${g}" needs an id or a selected row.`);return F},J=G=>typeof n[G]=="string"&&n[G].trim()!==""?n[G]:void 0,$=S.structure;if(!$)return{ok:!1,error:"structure-op: the active authoring adapter exposes no structure provider."};switch(g){case"create":{const G=J("kind");if(!G)return{ok:!1,error:'structure-op "create" needs a `kind`.'};const se=t0e(S,G,J("parentId"));return{ok:!0,data:{id:se.id,write:await se.ack}}}case"delete":return{ok:!0,data:{write:A.length>1&&$.removeMany?await d$e(S,A):await jhe(S,D())}};case"duplicate":{if(A.length>1&&$.duplicateMany)return{ok:!0,data:{write:await bPt(S,A)}};const G=r0e(S,D());return{ok:!0,data:{id:G.id,write:await G.ack}}}case"reparent":{const G=J("parentId")??null;return{ok:!0,data:{write:await QO(S,D(),G)}}}case"reorder":{if(!$.reorder)return{ok:!1,error:"structure-op: this adapter has no `reorder`."};const G=J("beforeSiblingId")??null;return{ok:!0,data:{write:await p$e(S,D(),G)}}}case"wrap":return $.wrap?{ok:!0,data:{write:await n0e(S,D(),J("tag"))}}:{ok:!1,error:"structure-op: this adapter has no `wrap`."};case"unwrap":return $.unwrap?{ok:!0,data:{write:await i0e(S,D())}}:{ok:!1,error:"structure-op: this adapter has no `unwrap`."};case"group":{if(!$.group)return{ok:!1,error:"structure-op: this adapter has no `group`."};const G=o0e(S,A);return{ok:!0,data:{id:G.id,write:await G.ack}}}case"ungroup":{if(!$.ungroup)return{ok:!1,error:"structure-op: this adapter has no `ungroup`."};const G=_$e(S,D());return{ok:!0,data:{ids:G.ids,write:await G.ack}}}case"copy":return $.copy?{ok:!0,data:{copied:await s0e(S,A)}}:{ok:!1,error:"structure-op: this adapter has no `copy`."};case"cut":{if(!$.cut)return{ok:!1,error:"structure-op: this adapter has no `cut`."};const G=await a0e(S,A);return G===!1?{ok:!1,error:'structure-op "cut" was refused by the adapter.'}:{ok:!0,data:{write:G}}}case"paste":{if(!$.paste)return{ok:!1,error:"structure-op: this adapter has no `paste`."};const G=J("parentId")??(F?S.hierarchy.node(F)?.parentId??null:null),se=await c0e(S,G);return se===!1?{ok:!1,error:'structure-op "paste" was refused by the adapter.'}:{ok:!0,data:{write:se}}}default:return{ok:!1,error:`structure-op: unknown op ${JSON.stringify(g)}. Known ops: create, delete, duplicate, reparent, reorder, wrap, unwrap, group, ungroup, copy, cut, paste.`}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"document-probe":try{return{ok:!0,data:{...await Jrn(n.step)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"capture-active-document":{const g=qDr(n);if("error"in g)return{ok:!1,error:g.error};try{n.view&&await Vge(t,n.view);const S=await b9t(t,g.size);return inn(S.base64),{ok:!0,data:{...S}}}catch(S){return{ok:!1,error:S instanceof Error?S.message:String(S)}}}case"capture-editor-chrome":{const g=n.scale;if(g!==void 0&&(typeof g!="number"||!(g>0)||g>4))return{ok:!1,error:`capture-editor-chrome: "scale" must be a number greater than 0 and no more than 4 (output pixels per CSS pixel; the frame crosses the relay as base64 PNG). It defaults to the page's own devicePixelRatio.`};const S=n.region;if(S!==void 0&&S!=="page"&&S!=="document")return{ok:!1,error:'capture-editor-chrome: "region" is "page" or "document".'};try{return{ok:!0,data:{...await Hrn(t,{...g===void 0?{}:{scale:g},...S===void 0?{}:{region:S}})}}}catch(k){return{ok:!1,error:k instanceof Error?k.message:String(k)}}}case"document-table":{const g=u0();return g?{ok:!0,data:{default:g.scenes.default??null,entries:g.scenes.entries,pending:g.documentsPending===!0}}:{ok:!1,error:"The project adapter has not resolved yet — no document table to list.",data:{code:"SCENE_TABLE_UNAVAILABLE"}}}case"open":{const g=n.id;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:"open requires a non-empty scene-table entry id."};const S=ste(),k=S?u0()?.scenes.entries.find(J=>J.id===g&&PN(J.kind)===void 0):void 0,A=S?async J=>await n9t(J)??{ok:!1,error:"No running lane can remount with a selection."}:void 0,D=(k?await vsn(k,{scenes:hVe,activateGameDocument:()=>X0(a0),gameDocumentId:a0,...A?{remountSelection:A}:{}}):null)??await Ltn(g);return D.ok?{ok:!0,data:{documentId:D.documentId,title:D.title,..."scene"in D&&D.scene?{scene:D.scene}:{},..."restart"in D&&D.restart?{restart:!0}:{}}}:{ok:!1,error:D.error,data:{code:D.code,...D.known===void 0?{}:{known:[...D.known]}}}}case"document-script":return Osn(n);default:return{ok:!1,error:`unknown command type "${String(m)}" — editor page predates this CLI`,data:{code:"UNKNOWN_COMMAND_TYPE"}}}return{ok:!0}}function Fsn(t,n){const s=jD();let c=null,d=-1;const m=new Set;let g=!1,S=null,k=null,A=null;const F=()=>{n_e()===null&&(c=Xxt(t),d=t.contentVersion,HSt(c))};let D=null;const J=()=>{S!==null&&(clearTimeout(S),S=null),D?.(),D=null},$=()=>{k=null,A!==null&&clearTimeout(A),A=null},G=()=>{$(),g=!0,J(),S=setTimeout(()=>{S=null,D=Txt(()=>{D=null,g=!1,F()})},250)},se=vn=>{if(t.contentVersion!==vn){G();return}$(),k=vn,A=setTimeout($,1e3)},pe=()=>ste()&&t.playState==="playing",ue=vn=>{(vn!==null||k!==null&&t.contentVersion!==k||g&&t.contentVersion!==d)&&G()},Ce=(vn,Yr,en)=>pe()?(Csn(en,vn,t.contentVersion,d)&&(vn==="explicit"?G():vn==="if-content-changed"?se(Yr??t.contentVersion):ue(Yr)),!0):!1,De=(vn="always",Yr="none",en=null)=>{if(n_e()!==null)return;if(c===null){F();return}const ii=Xxt(t,c);c=ii,HSt(Asn(ii)),vn!=="none"&&(Ce(Yr,en,vn)||(J(),$(),g=!1,!(vn==="if-content-changed"&&t.contentVersion===d)&&D===null&&(D=Txt(()=>{D=null,F()}))))};let Pe=!1,be=!1,X=t.playState;const we=vn=>{vn&&(be=!0),!Pe&&(Pe=!0,queueMicrotask(()=>{Pe=!1;const Yr=be;be=!1;const en=X!==t.playState;X=t.playState,De(Yr?"always":"if-content-changed",en&&t.playState==="playing"?"explicit":"none")}))},qe=()=>we(!1),bt=()=>we(!0),Pt=t.subscribe(qe),Wt=SVe(bt),zt=OC(bt),ft=dTr(bt);F(),i_e(!0),cEr(WZr),s.addEventListener("open",()=>{De("if-content-changed"),i_e(n_e()===null)});const tr=Lze(vn=>{i_e(vn===null)});s.addEventListener("editor-command",vn=>{try{const Yr=JSON.parse(vn.data),en=Yr._requestId,ii=t.contentVersion,No=n_e();if(No!==null){const En=sZr(No,String(Yr.type));en&&GSt(en,!1,En);return}en&&UZr(en);let gn;Rsn(t,Yr,{deferPresentation:En=>{gn=En},...n?{history:n}:{}}).catch(En=>Y9t(Yr,En)).then(En=>{if(en){const On=GSt(en,En.ok,En.error,En.data,gn!==void 0);if(gn){const ji=()=>window.setTimeout(gn,0);On.then(ji,ji)}}else gn&&window.setTimeout(gn,0);const cs=Tsn(Yr,En.ok,m);De(cs.derived,cs.playFullReport,ii)})}catch{}}),s.addEventListener("project-changed",()=>{window.location.reload()});const Qt=()=>De();document.addEventListener("visibilitychange",Qt),window.addEventListener("focus",Qt),window.addEventListener("blur",Qt);const Tt=()=>setTimeout(Qt,0);return window.addEventListener("error",Tt),window.addEventListener("unhandledrejection",Tt),()=>{i_e(!1),D?.(),D=null,S!==null&&clearTimeout(S),S=null,$(),tr(),Pt(),Wt(),zt(),ft(),document.removeEventListener("visibilitychange",Qt),window.removeEventListener("focus",Qt),window.removeEventListener("blur",Qt),window.removeEventListener("error",Tt),window.removeEventListener("unhandledrejection",Tt),s.close()}}function Msn(t,n,s){return Ye.createContext(s)}const LD=Msn(void 0,"EditorContext",null);function jsn({runtime:t,children:n}){const s=Ye.useMemo(()=>({begin:()=>{},end:()=>{}}),[]);return q.jsx(LD.Provider,{value:t,children:q.jsx(f4t.Provider,{value:s,children:q.jsx(Ye.Suspense,{children:n})})})}function Yv(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStore must be used within <EditorProvider>");return t.store}function GSn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStats must be used within <EditorProvider>");return t.stats}function Lsn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorInit must be used within <EditorProvider>");return t.initPromise}function Z9t(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryService must be used within <EditorProvider>");return t.session.history}function Bsn(){return Ye.useContext(LD)?.session.history??null}function KSn(){return Ye.useContext(LD)?.store??null}function XSn(){return Ye.useContext(LD)?.stats??null}function mve(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryCommands must be used within <EditorProvider>");return t.session.historyCommands}function Q9t(){const t=mve();return Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}function $sn(t,n){return t==="selection"&&n==="selection"?"selection":"content"}class qsn{_viewportSelections={edit:new Set,play:new Set};_history=null;_playState="stopped";_playEditRegime=null;_followsWorkspaceFocus;constructor(n={}){if(this._followsWorkspaceFocus=n.followsWorkspaceFocus===!0,!this._followsWorkspaceFocus)return;let s=this.activeViewportTab;o2(()=>{const c=this.activeViewportTab;c!==s&&(s=c,this._notify())})}_listeners=new Set;_deferredNotifyTimer=null;_deferredNotifyScope="content";_version=0;_shellVersion=0;_contentVersion=0;_hierarchyRowFacetVersion=0;subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;getShellSnapshot=()=>this._shellVersion;get contentVersion(){return this._contentVersion}get hierarchyRowFacetVersion(){return this._hierarchyRowFacetVersion}get projectHistory(){return this._history}_notify(n="content",s="shell",c=n!=="selection"){this._deferredNotifyTimer!==null&&(clearTimeout(this._deferredNotifyTimer),this._deferredNotifyTimer=null),this._beforeNotify(),this._version++,s==="shell"&&this._shellVersion++,n!=="selection"&&this._contentVersion++,c&&this._hierarchyRowFacetVersion++;for(const d of this._listeners)d()}_transformMode="combined";_transformSpace="world";_snapEnabled=!1;_snapValues={translate:1,rotate:15,scale:.25};_snapToSurface=!1;_rotationSnap=!1;_snap2D={step:8,offsetX:0,offsetY:0,primaryEvery:8,rotationOffset:0,rotationStep:15,scaleStep:.1,relative:!1,pixel:!0};_scaleSnap=!1;_smartSnap={enabled:!1,parent:!0,others:!0,guides:!0,sides:!0,center:!0};_preserveChildrenTransform=!1;_pivotMode="active-element";_gizmoAnchor="auto";_showHelpers=!0;_helperVisibility={bounds:!1,lights:!0,cameras:!0,colliders:!0,joints:!0,particles:!0,lod:!0,audio:!0,splines:!0,navmesh:!0,constraints:!0,reflectionProbes:!0,triggerVolumes:!0,skeletons:!1,weights:!1,cursor:!0,empties:!0};get transformMode(){return this._transformMode}get transformSpace(){return this._transformSpace}get snapEnabled(){return this._snapEnabled}get snapValues(){return this._snapValues}get snapToSurface(){return this._snapToSurface}get snap2D(){return this._snap2D}setSnap2D(n){this._snap2D={...this._snap2D,...n},this._notify()}get rotationSnap(){return this._rotationSnap}get scaleSnap(){return this._scaleSnap}setRotationSnap(n){this._rotationSnap=n,this._notify()}setScaleSnap(n){this._scaleSnap=n,this._notify()}get smartSnap(){return this._smartSnap}get preserveChildrenTransform(){return this._preserveChildrenTransform}get pivotMode(){return this._pivotMode}get gizmoAnchor(){return this._gizmoAnchor}get showHelpers(){return this._showHelpers}get helperVisibility(){return this._helperVisibility}setTransformMode(n){this._transformMode=n,this._notify()}setTransformSpace(n){this._transformSpace=n,this._notify()}toggleSnap(){this._snapEnabled=!this._snapEnabled,this._notify()}setSnapValues(n){this._snapValues={...this._snapValues,...n},this._notify()}setSmartSnap(n){this._smartSnap={...this._smartSnap,...n},this._notify()}toggleSnapToSurface(){this._snapToSurface=!this._snapToSurface,this._notify()}togglePreserveChildrenTransform(){this._preserveChildrenTransform=!this._preserveChildrenTransform,this._notify()}setPivotMode(n){this._pivotMode=n,this._notify()}setGizmoAnchor(n){this._gizmoAnchor=n,this._notify()}toggleHelpers(){this._showHelpers=!this._showHelpers,this._notify()}toggleHelperType(n){this._helperVisibility[n]=!this._helperVisibility[n],this._helperVisibility[n]&&(this._showHelpers=!0),this._notify()}_viewportActionListeners=new Set;onViewportAction=n=>(this._viewportActionListeners.add(n),()=>this._viewportActionListeners.delete(n));requestViewportAction(n){for(const s of this._viewportActionListeners)s(n)}focusOnEntity(n){this.requestViewportAction({type:"focus-entity",id:n})}focusOnSelection(){this.requestViewportAction({type:"focus-selection"})}frameAll(){this.requestViewportAction({type:"frame-all"})}zoomView(n){this.requestViewportAction({type:"zoom-view",direction:n})}focusOnScene(){this.requestViewportAction({type:"focus-scene"})}snapSelectionToFloor(){this.requestViewportAction({type:"snap-selection-to-floor"})}setViewPreset(n){this.requestViewportAction({type:"set-view-preset",preset:n})}stepView(n){this.requestViewportAction({type:"step-view",step:n})}toggleCameraView(){this.requestViewportAction({type:"toggle-camera-view"})}toggleProjection(){this.requestViewportAction({type:"toggle-projection"})}setCameraPose(n,s,c){this.requestViewportAction({type:"set-camera-pose",position:n,target:s,...c!==void 0?{fov:c}:{}})}notifyChange(n="content",s="shell",c=n!=="selection"){this._notify(n,s,c)}_notifyDeferred(n="content"){if(this._deferredNotifyTimer!==null){this._deferredNotifyScope=$sn(this._deferredNotifyScope,n);return}this._deferredNotifyScope=n,this._deferredNotifyTimer=setTimeout(()=>{this._deferredNotifyTimer=null;const s=this._deferredNotifyScope;this._deferredNotifyScope="content",this._notify(s)},0)}attachHistory(n){if(this._history!==n){if(this._history)throw new Error("EditorStore is already attached to project history.");this._history=n,this._onHistoryAttached()}}get selectedEntityId(){const n=this._viewportSelections[this.activeViewportTab];return n.size===0?null:[...n].at(-1)}get selectedEntityIds(){return this._viewportSelections[this.activeViewportTab]}get canUndo(){return this._history?.getSnapshot().canUndo??!1}get canRedo(){return this._history?.getSnapshot().canRedo??!1}notifyIngestEdit(){this._notify()}get playState(){return this._playState}_blockedDuringPlay(n){return this._playState==="stopped"?!1:(console.warn(`EditorStore: "${n}" is disabled during play mode — stop the game first.`),!0)}setPlayState(n){const s=this._playState!=="stopped";this._playState=n,n==="stopped"&&s&&this._onPlayStopped(),this._notify()}get playEditRegime(){return this._playEditRegime}setPlayEditRegime(n){this._playEditRegime=n,this._notify()}get activeViewportTab(){return this._followsWorkspaceFocus&&Pp()===a0?"play":"edit"}select(n,s="immediate"){const c=this._viewportSelections[this.activeViewportTab];c.clear(),n&&c.add(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}selectMultiple(n,s="immediate"){this._viewportSelections[this.activeViewportTab]=new Set(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}applySelectionBeforePresentation(n){this._viewportSelections[this.activeViewportTab]=new Set(n);let s=!1;return()=>{s||(s=!0,this._notify("selection"))}}addToSelection(n){this._viewportSelections[this.activeViewportTab].add(n),this._notify("selection")}toggleSelection(n){const s=this._viewportSelections[this.activeViewportTab];s.has(n)?s.delete(n):s.add(n),this._notify("selection")}_beforeNotify(){}_onHistoryAttached(){}_onPlayStopped(){}}class zsn{constructor(n){this.history=n,this.snapshot=this.buildSnapshot(),this.unsubscribeHistory=n.subscribe(this.notify)}tail=Promise.resolve();listeners=new Set;pending=0;version=0;disposed=!1;idleWaiters=new Set;unsubscribeHistory;snapshot;subscribe=n=>this.disposed?()=>{}:(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.snapshot;undo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.undo()))}redo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.redo()))}jumpTo(n){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.jumpTo(n)))}get canUndo(){return this.snapshot.canUndo}get canRedo(){return this.snapshot.canRedo}dispose(){if(this.disposed)return;this.disposed=!0,this.unsubscribeHistory();const n=new Error("History commands are disposed.");for(const s of this.idleWaiters)s.unsubscribe(),s.reject(n);this.idleWaiters.clear(),this.listeners.clear(),this.notify()}enqueue(n){if(this.disposed)return Promise.reject(new Error("History commands are disposed."));this.pending++,this.notify();const s=()=>{if(this.disposed)throw new Error("History commands are disposed.");return n()},c=this.tail.then(s,s);return this.tail=c.then(()=>{},()=>{}),c.finally(()=>{this.pending--,this.notify()})}assertNotDisposed(){if(this.disposed)throw new Error("History commands are disposed.")}waitForServiceIdle(){return this.disposed?Promise.reject(new Error("History commands are disposed.")):this.history.getSnapshot().busy?new Promise((n,s)=>{const c={unsubscribe:()=>{},reject:s},d=()=>{c.unsubscribe(),this.idleWaiters.delete(c)};c.unsubscribe=this.history.subscribe(()=>{this.history.getSnapshot().busy||(d(),n())}),this.idleWaiters.add(c)}):Promise.resolve()}notify=()=>{this.version++,this.snapshot=this.buildSnapshot();for(const n of this.listeners)n()};buildSnapshot(){const n=this.history.getSnapshot(),s=this.pending>0||n.busy;return{version:this.version,busy:s,canUndo:!this.disposed&&!s&&n.canUndo,canRedo:!this.disposed&&!s&&n.canRedo,undoLabel:n.undoLabel,redoLabel:n.redoLabel}}}function Vsn(t){let n=t.getSnapshot().limitWarning,s=t.getSnapshot().lastEviction;return t.subscribe(()=>{const{limitWarning:c,lastEviction:d}=t.getSnapshot();c!==n&&(n=c,c&&(i0(c.message),Qs.warn(c.message,"history"))),d!==s&&(s=d,d&&Qs.warn(d.message,"history"))})}class Usn{constructor(n,s={}){this.projectIdentity=n,this.history=new TDr(s),this.historyCommands=new zsn(this.history),this.releaseLimitNotices=Vsn(this.history)}history;historyCommands;releaseLimitNotices;dispose(){this.releaseLimitNotices(),this.historyCommands.dispose(),this.history.dispose()}}function Jsn(){return eMt}let eMt=Promise.resolve();function tMt(){const t=Wsn();return eMt=t.then(()=>{},()=>{}),t}async function Wsn(){await rMt()}async function rMt(){const t=wf();if(t){Qs.log(`Opened project: ${t.config.name}`,"project");return}try{const n=await wFt();n&&Qs.log(`Opened project: ${n.config.name}`,"project")}catch{}}const nMt=Object.freeze(Object.defineProperty({__proto__:null,bootstrapProject:tMt,initProject:rMt,projectBootstrapSettled:Jsn},Symbol.toStringTag,{value:"Module"}));function bOe(t){return Promise.reject(new Error(`This editor tier cannot ${t}.`))}const iMt={openPersistence:()=>bOe("persist Asset Lab documents"),replaceSource:()=>bOe("write project source"),saveThumbnailFraming:()=>bOe("write project thumbnail framing")};let yme=iMt;function Hsn(t){if(yme!==t){if(yme!==iMt)throw new Error("An Object3D document write policy is already installed.");yme=t}}function Gsn(){return yme}function Ksn(){let t=0;const n=async()=>{const c=++t,d=wf();if(d)try{const m=await zze();if(m.status!=="project"||m.project.path!==d.rootPath)return;const g=m.project.config;if(c!==t||wf()!==d)return;_Le({...d,config:g})}catch(m){c===t&&wf()===d&&console.error("[project] Could not refresh project declarations:",m)}},s=den(()=>void n());return()=>{t++,s()}}function Xsn(){return Lvr(()=>{bVe(),E3r(null),Jwr(),Hnn(),gTr(),L3t(),xtn(),oD()})}async function Ysn(){typeof performance<"u"&&performance.getEntriesByType("navigation").length>0&&await Promise.race([jye(),new Promise(n=>setTimeout(n,5e3))]),await mN()}function Zsn(){Ysn();const t=IC(()=>void mN()),n=hFt(()=>void mN());return()=>{t(),n()}}const Qsn={tools:[],contributions:[],loadErrors:[]};let oMt=Qsn,sMt=0;const pje=new Set;function Zxt(t){oMt=t,sMt++;for(const n of pje)n()}function N$(){return oMt}function ean(){return sMt}function aMt(t){return pje.add(t),()=>pje.delete(t)}async function WZ(){try{const t=await fetch("/__editor/project-tools"),n=await L_(t,"Catalog request failed");return Zxt(n),n}catch(t){const n={tools:[],contributions:[],loadErrors:[{sourcePath:"package.json#volter.tools",message:t instanceof Error?t.message:String(t)}]};return Zxt(n),n}}async function tan(t,n,s={}){const c=await fetch("/__editor/project-tools/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,input:n,confirm:s.confirm===!0})}),d=await L_(c,`Running the project tool ${JSON.stringify(t)} failed`);if(!d||typeof d!="object"||typeof d.ok!="boolean")throw new Error(`Tool request returned an invalid response (${c.status}).`);return d}function ran(){WZ();const t=IC(()=>void WZ()),n=hFt(()=>void WZ());return()=>{t(),n()}}const Gge=new Map;function nan(t,n){if(n===null){Gge.delete(t);return}Gge.set(t,n),ian()}const Qxt=128;let mZ=[],HZ=null,cMt=0,vme=!1;function ian(){if(vme)return()=>{};if(typeof PerformanceObserver>"u")return()=>{};let t;try{t=new PerformanceObserver(n=>{for(const s of n.getEntries()){const c=s.duration;(HZ===null||c>HZ)&&(HZ=c),c>=100&&(cMt+=1),mZ.push({start:s.startTime,duration:c}),mZ.length>Qxt&&(mZ=mZ.slice(-Qxt))}}),t.observe({type:"longtask",buffered:!0})}catch{return()=>{}}return vme=!0,()=>{t.disconnect(),vme=!1}}function oan(){return vme?{longestTaskMs:HZ===null?null:Math.round(HZ),tasksOver100ms:cMt}:null}function san(t=performance.now()){if(Gge.size===0)return null;const n={};for(const[s,c]of Gge){const d=c(),m=d.lastCallWindow;let g=null;if(m!==null){const S=m.end??t;for(const k of mZ)k.start+k.duration<m.start||k.start>S||(g===null||k.duration>g)&&(g=k.duration)}n[s]={inFlightMs:d.inFlightMs,lastCallMs:d.lastCallMs,maxCallMs:d.maxCallMs,callsOver5s:d.callsOver5s,callsOver30s:d.callsOver30s,lastCallLongestTaskMs:g===null?null:Math.round(g),wasmMemoryMB:d.wasmMemoryMB}}return n}function ewt(t){return!("unavailable"in t)}function aan(t=globalThis.performance){const n=t?.memory;return!n||typeof n.usedJSHeapSize!="number"||typeof n.totalJSHeapSize!="number"?{unavailable:"performance.memory is unavailable — it is a non-standard Chromium-only API, not exposed by this browser."}:{usedBytes:n.usedJSHeapSize,totalBytes:n.totalJSHeapSize,limitBytes:typeof n.jsHeapSizeLimit=="number"?n.jsHeapSizeLimit:null}}const can=5e3,lan=4,uan=1024*1024;function SOe(t){return Math.round(t/uan*100)/100}function fan(t){const n=t.heap(),s=t.canvases(),c=t.rendererCounts(),d=t.workerCalls?.()??null,m=t.stalls?.()??null;let g=0;for(const S of s)g+=S.width*S.height*lan;return{heapUsedMB:ewt(n)?SOe(n.usedBytes):null,heapLimitMB:ewt(n)&&n.limitBytes!==null?SOe(n.limitBytes):null,mountEpochs:t.mountEpochs(),canvases:s.length,canvasMB:SOe(g),...d===null?{}:{workerCalls:d},...m===null?{}:{stalls:m},...c===null?{}:{textures:c.textures,geometries:c.geometries,...c.programs===null?{}:{programs:c.programs}}}}function dan(t){const n=new Set;for(const s of t)try{const c=new URL(s.name,"http://volter.invalid").searchParams.get(Rge);c!==null&&c.length>0&&n.add(c)}catch{}return n.size}function pan(){return{heap:()=>aan(),mountEpochs:()=>dan(performance.getEntriesByType("resource")),canvases:()=>[...document.querySelectorAll("canvas")],rendererCounts:()=>tTr()?.memorySnapshot?.().counts??null,workerCalls:()=>san(),stalls:()=>oan()}}let lMt=null;function YSn(){return lMt}function _an(t){const n=t.sources??pan(),s=t.hidden??(()=>document.visibilityState==="hidden"),c=()=>{if(s())return;const m=fan(n);lMt=m,t.report(m)};c();const d=setInterval(c,t.intervalMs??can);return()=>clearInterval(d)}function man({children:t}){const n=Ye.useRef(null);n.current||(n.current=new qsn({followsWorkspaceFocus:!0}),eQr(n.current));const s=Ye.useRef(null);if(!s.current){const g=wf();s.current=new Usn(g?.rootPath??"unknown-project")}n.current.attachHistory(s.current.history),Hsn($Dr);const c=Ye.useRef(null);c.current||(c.current={fps:0,frameTime:0,drawCalls:0,triangles:0,cameraPosition:{x:0,y:0,z:0},cameraTarget:{x:0,y:0,z:0}});const d=Ye.useRef(null);d.current||(d.current=tMt()),Ye.useEffect(()=>Fsn(n.current,s.current.historyCommands),[]),Ye.useEffect(()=>Zsn(),[]),Ye.useEffect(()=>ran(),[]),Ye.useEffect(()=>otn(),[]),Ye.useEffect(()=>Ksn(),[]),Ye.useEffect(()=>Xsn(),[]),Ye.useEffect(()=>Mtn(),[]),Ye.useEffect(()=>_an({report:bZr}),[]);const m=Ye.useRef(!1);return Ye.useEffect(()=>{m.current=!0;const g=s.current;return()=>{m.current=!1,queueMicrotask(()=>{m.current||g.dispose()})}},[]),q.jsx(jsn,{runtime:{store:n.current,stats:c.current,initPromise:d.current,session:s.current},children:t})}const Kge={x:0,y:0,zoom:1};function ZSn(t=Kge){let n=t;const s=new Set,c=()=>{for(const d of s)d()};return{get:()=>n,setView:(d,m,g)=>{const S=Math.min(4,Math.max(.1,g));n.x===d&&n.y===m&&n.zoom===S||(n={x:d,y:m,zoom:S},c())},setPan:(d,m)=>{const g=n.zoom;n.x===d&&n.y===m||(n={x:d,y:m,zoom:g},c())},setZoom:d=>{const m=Math.min(4,Math.max(.1,d));n.zoom!==m&&(n={x:n.x,y:n.y,zoom:m},c())},reset:()=>{n.x===0&&n.y===0&&n.zoom===1||(n=Kge,c())},subscribe:d=>(s.add(d),()=>s.delete(d))}}let n2=Kge;const _je=new Set,QSn={get:()=>han(),setView:(t,n,s)=>MVe(t,n,s),setPan:(t,n)=>fMt(t,n),setZoom:t=>gan(t),reset:()=>dMt(),subscribe:t=>yan(t)};function uMt(){for(const t of _je)t()}function han(){return n2}function MVe(t,n,s){const c=Math.min(4,Math.max(.1,s));n2.x===t&&n2.y===n&&n2.zoom===c||(n2={x:t,y:n,zoom:c},uMt())}function fMt(t,n){MVe(t,n,n2.zoom)}function gan(t){MVe(n2.x,n2.y,t)}function exn(t,n){fMt(n2.x+t,n2.y+n)}function dMt(){n2.x===0&&n2.y===0&&n2.zoom===1||(n2=Kge,uMt())}function yan(t){return _je.add(t),()=>_je.delete(t)}function txn(t){if(!(t.x===0&&t.y===0&&t.zoom===1))return t.zoom===1?`translate(${t.x}px, ${t.y}px)`:t.x===0&&t.y===0?`scale(${t.zoom})`:`translate(${t.x}px, ${t.y}px) scale(${t.zoom})`}const van=new Set(["opacity","zIndex","flexGrow","flexShrink","fontWeight","lineHeight"]);function ban(t){if(typeof t=="number")return t;if(typeof t!="string"||t==="")return;const n=Number.parseFloat(t);return Number.isNaN(n)?void 0:n}function rxn(t,n){if(typeof t!="number"||typeof n!="string")return t;const s=n.trim().match(/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?([a-z]+|%)$/i)?.[1];return s&&s.toLowerCase()!=="px"?`${t}${s}`:t}function nxn(t,n){return typeof n!="number"?n:n===0||van.has(t)?String(n):`${n}px`}const San={hidden:!1,interactive:!1,pickLock:!1},pMt=new Map;function hve(t){return pMt.get(t)??San}function jVe(t,n){pMt.set(t,{...hve(t),...n})}function oq(t){return hve(t).hidden}function xan(t,n){jVe(t,{hidden:n})}function wan(t){xan(t,!oq(t))}function _Mt(t){return hve(t).interactive}function Tan(t,n){jVe(t,{interactive:n})}function Can(t){Tan(t,!_Mt(t))}function mMt(t){return hve(t).pickLock}function Ean(t,n){jVe(t,{pickLock:n})}function kan(t){Ean(t,!mMt(t))}const twt=8,wN=8,ixn=[{pos:"nw",cursor:"nwse-resize"},{pos:"n",cursor:"ns-resize"},{pos:"ne",cursor:"nesw-resize"},{pos:"w",cursor:"ew-resize"},{pos:"e",cursor:"ew-resize"},{pos:"sw",cursor:"nesw-resize"},{pos:"s",cursor:"ns-resize"},{pos:"se",cursor:"nwse-resize"}];function oxn(t,n){const s=t.x+t.width/2,c=t.y+t.height/2;switch(n){case"nw":return{x:t.x,y:t.y};case"n":return{x:s,y:t.y};case"ne":return{x:t.x+t.width,y:t.y};case"w":return{x:t.x,y:c};case"e":return{x:t.x+t.width,y:c};case"sw":return{x:t.x,y:t.y+t.height};case"s":return{x:s,y:t.y+t.height};case"se":return{x:t.x+t.width,y:t.y+t.height}}}function iA(t,n){return n?Math.round(t):Math.round(t/twt)*twt}function hMt(t,n,s,c,d){let m=Math.max(wN,iA(n.width+t,s)),g=null;return c.length&&(g=vve(n.x+m,c,d),g&&(m=Math.max(wN,g.edge-n.x))),{value:m,match:g}}function gMt(t,n,s,c,d){const m=n.x+n.width;let g=Math.max(wN,iA(n.width-t,s)),S=null;return c.length&&(S=vve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,eastEdge:m,match:S}}function yMt(t,n,s,c,d){let m=Math.max(wN,iA(n.height+t,s)),g=null;return c.length&&(g=vve(n.y+m,c,d),g&&(m=Math.max(wN,g.edge-n.y))),{value:m,match:g}}function vMt(t,n,s,c,d){const m=n.y+n.height;let g=Math.max(wN,iA(n.height-t,s)),S=null;return c.length&&(S=vve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,southEdge:m,match:S}}function Aan(t,n,s,c,d,m,g){if(t==="e"||t==="ne"||t==="se")return{width:hMt(n,s,d,m,g).value};if(t==="w"||t==="nw"||t==="sw"){const{value:S,eastEdge:k}=gMt(n,s,d,m,g);return c?{width:S,x:k-S}:{width:S}}return{}}function Dan(t,n,s,c,d,m,g){if(t==="s"||t==="sw"||t==="se")return{height:yMt(n,s,d,m,g).value};if(t==="n"||t==="nw"||t==="ne"){const{value:S,southEdge:k}=vMt(n,s,d,m,g);return c?{height:S,y:k-S}:{height:S}}return{}}function sxn(t,n,s,c,d,m,g,S=TR){const k=!m&&g?ate(g):null,A=k?gve(k):[],F=k?yve(k):[];return{...Aan(t,n,c,d,m,A,S),...Dan(t,s,c,d,m,F,S)}}const TR=4;function ate(t){return{paddingBox:t.paddingBox??{x:0,y:0,width:0,height:0},siblingRects:(t.siblings??[]).filter(n=>n.width>0&&n.height>0),guideX:t.guideEdges?.x??[],guideY:t.guideEdges?.y??[]}}function gve(t){const n=[{edge:t.paddingBox.x,rect:t.paddingBox},{edge:t.paddingBox.x+t.paddingBox.width,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.x,rect:s}),n.push({edge:s.x+s.width,rect:s});for(const s of t.guideX??[])n.push({edge:s,rect:{x:s,y:-1e5,width:0,height:2e5}});return n}function yve(t){const n=[{edge:t.paddingBox.y,rect:t.paddingBox},{edge:t.paddingBox.y+t.paddingBox.height,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.y,rect:s}),n.push({edge:s.y+s.height,rect:s});for(const s of t.guideY??[])n.push({edge:s,rect:{x:-1e5,y:s,width:2e5,height:0}});return n}function tee(t,n,s,c){let d=t,m=c,g=null;for(const S of s){const k=Math.abs(t-S.edge);k<=m&&(m=k,d=S.edge,g=S);const A=Math.abs(t+n-S.edge);A<=m&&(m=A,d=S.edge-n,g=S)}return{value:d,match:g}}function vve(t,n,s){let c=null,d=s;for(const m of n){const g=Math.abs(t-m.edge);g<=d&&(d=g,c=m)}return c}function axn(t,n,s,c,d){let m=iA(s.x+t,c),g=iA(s.y+n,c);if(!c&&d){const S=ate(d);m=tee(m,s.width,gve(S),TR).value,g=tee(g,s.height,yve(S),TR).value}return{x:m,y:g}}function cxn(t,n,s,c,d,m=TR){if(s)return{guides:[],position:t};let g=null,S=m;for(const pe of d?.snapPoints??[]){const ue=Math.hypot(t.x-pe.x,t.y-pe.y);ue<=S&&(S=ue,g=pe)}if(g)return{guides:ree({x:g.x,y:g.y,width:0,height:0},{edge:g.x,rect:n},{edge:g.y,rect:n}),position:g};if(d?.bounded)return{guides:[],position:t};const k=iA(t.x,!1),A=iA(t.y,!1),F=[n,c?.parent,c?.paddingBox,...c?.siblings??[]].filter(pe=>!!pe&&pe.width>0&&pe.height>0);let D=null,J=null,$=m,G=m;for(const pe of F){for(const ue of[pe.x,pe.x+pe.width/2,pe.x+pe.width]){const Ce=Math.abs(k-ue);Ce<=$&&($=Ce,D={edge:ue,rect:pe})}for(const ue of[pe.y,pe.y+pe.height/2,pe.y+pe.height]){const Ce=Math.abs(A-ue);Ce<=G&&(G=Ce,J={edge:ue,rect:pe})}}const se={x:D?.edge??k,y:J?.edge??A};return{guides:ree({x:se.x,y:se.y,width:0,height:0},D,J),position:se}}function ree(t,n,s){const c=[];return n&&c.push({orientation:"vertical",at:n.edge,start:Math.min(t.y,n.rect.y),end:Math.max(t.y+t.height,n.rect.y+n.rect.height)}),s&&c.push({orientation:"horizontal",at:s.edge,start:Math.min(t.x,s.rect.x),end:Math.max(t.x+t.width,s.rect.x+s.rect.width)}),c}function lxn(t,n,s,c,d,m=TR){if(c||!d)return[];const g=iA(s.x+t,!1),S=iA(s.y+n,!1),k=ate(d),A=tee(g,s.width,gve(k),m).match,F=tee(S,s.height,yve(k),m).match,D={x:g,y:S,width:s.width,height:s.height};return ree(D,A,F)}function uxn(t,n,s,c,d="both",m=!1,g=TR,S={},k=Ian){if(m)return{position:t,guides:[]};const A={x:s.x+t.x-n.x,y:s.y+t.y-n.y,width:s.width,height:s.height},F=[],D=[],J=(pe,ue,Ce)=>{F.push({edge:pe.x,rect:pe},{edge:pe.x+pe.width,rect:pe}),D.push({edge:pe.y,rect:pe},{edge:pe.y+pe.height,rect:pe}),F.push({edge:pe.x+pe.width/2,rect:pe}),D.push({edge:pe.y+pe.height/2,rect:pe})};if(c){const pe=ate(c);if(k.parent&&pe.paddingBox.width>0&&pe.paddingBox.height>0&&J(pe.paddingBox),k.others)for(const ue of pe.siblingRects)J(ue)}if(k.guides){for(const pe of[...c?.guideEdges?.x??[],...S.x??[]])F.push({edge:pe,rect:{x:pe,y:A.y,width:0,height:A.height}});for(const pe of[...c?.guideEdges?.y??[],...S.y??[]])D.push({edge:pe,rect:{x:A.x,y:pe,width:A.width,height:0}})}if(F.length===0&&D.length===0)return{position:t,guides:[]};const $=d==="y"?{value:A.x,match:null}:rwt(A.x,A.width,F,g),G=d==="x"?{value:A.y,match:null}:rwt(A.y,A.height,D,g),se={...A,x:$.value,y:G.value};return{position:{x:t.x+se.x-A.x,y:t.y+se.y-A.y},guides:ree(se,$.match,G.match)}}function Pan(t,n,s,c,d){const m=n.tr.x-n.tl.x,g=n.tr.y-n.tl.y,S=n.bl.x-n.tl.x,k=n.bl.y-n.tl.y,A=m*k-g*S;if(Math.abs(A)<1e-9)return t;const F=t.x-n.tl.x,D=t.y-n.tl.y,J=[...s?[0,1]:[],...c?[.5]:[]],$=(pe,ue)=>{let Ce=pe,De=d;for(const Pe of J){const be=Math.abs(pe-Pe)*ue;be<=De&&(De=be,Ce=Pe)}return Ce},G=$((F*k-D*S)/A,Math.hypot(m,g)),se=$((m*D-g*F)/A,Math.hypot(S,k));return{x:n.tl.x+G*m+se*S,y:n.tl.y+G*g+se*k}}function fxn(t,n,s){const{smart:c,grid:d}=s;let m=t;return n&&c.enabled!==s.invert&&(c.sides||c.center)&&(m=Pan(t,n,c.sides,c.center,s.threshold)),n&&Math.abs(qan(n))>1e-6?m:(!(Math.hypot(m.x-t.x,m.y-t.y)>1e-9)&&s.gridOn&&d.step>0&&(m={x:Math.round((m.x-d.offsetX)/d.step)*d.step+d.offsetX,y:Math.round((m.y-d.offsetY)/d.step)*d.step+d.offsetY}),d.pixel?{x:Math.round(m.x),y:Math.round(m.y)}:m)}function dxn(t){return{tl:{x:t.x,y:t.y},tr:{x:t.x+t.width,y:t.y},br:{x:t.x+t.width,y:t.y+t.height},bl:{x:t.x,y:t.y+t.height}}}const Ian={parent:!0,others:!0,guides:!0};function rwt(t,n,s,c){const d=tee(t,n,s,c);let m=d.value,g=d.match,S=g?Math.abs(m-t):c;for(const k of s){const A=Math.abs(t+n/2-k.edge);A<S&&(S=A,m=k.edge-n/2,g=k)}return{value:m,match:g}}function pxn(t,n,s,c,d,m,g=TR){if(d||!m)return[];const S=t==="e"||t==="ne"||t==="se",k=t==="w"||t==="nw"||t==="sw",A=t==="s"||t==="sw"||t==="se",F=t==="n"||t==="nw"||t==="ne",D=ate(m),J=gve(D),$=yve(D);let G=null;S?G=hMt(n,c,!1,J,g).match:k&&(G=gMt(n,c,!1,J,g).match);let se=null;return A?se=yMt(s,c,!1,$,g).match:F&&(se=vMt(s,c,!1,$,g).match),ree(c,G,se)}function _xn(t,n,s,c,d=15){const m=F=>F*180/Math.PI,g=m(Math.atan2(n.y-t.y,n.x-t.x)),k=m(Math.atan2(s.y-t.y,s.x-t.x))-g;return{rotate:c?k:Math.round(k/d)*d}}function RN(t,n){if(t instanceof hy){const s=t.ownerOf(n);return s?t.childAdapters().find(c=>c.worldId===s)?.adapter??null:null}return t}const nwt=new WeakMap;function Nan(t){const n=t.boxEdit;if(!n)return null;const s=nwt.get(t);if(s?.provider===n)return s.recorded;const c={begin:d=>Pg({adapter:t,seam:"editor.boxEdit.begin",stage:"effect",detail:`the world overlay began a box edit for ${d}`,run:()=>n.begin(d)}),apply:(d,m)=>Pg({adapter:t,seam:"editor.boxEdit.apply",stage:"effect",detail:`the world overlay applied a ${Object.keys(m).join(", ")} box patch to ${d}`,run:()=>n.apply(d,m)}),end:d=>Pg({adapter:t,seam:"editor.boxEdit.end",stage:"effect",detail:`the world overlay ended a box edit for ${d}`,run:()=>n.end(d)}),...n.gizmoOrigin?{gizmoOrigin:d=>Pg({adapter:t,seam:"editor.boxEdit.gizmoOrigin",stage:"operation",detail:`the world overlay read the native gizmo origin for ${d}`,run:()=>n.gizmoOrigin?.(d)??null})}:{},...n.referencePoint?{referencePoint:d=>Pg({adapter:t,seam:"editor.boxEdit.referencePoint",stage:"operation",detail:`the world overlay read the native reference point for ${d}`,run:()=>n.referencePoint?.(d)??null})}:{}};return nwt.set(t,{provider:n,recorded:c}),c}function Oan(t,n){return RN(t,n)?.rects?.rect(n)??null}function Ran(t,n){const s=RN(t,n);return s?Nan(s):null}function mxn(t,n){return RN(t,n)?.rects?.contextRects?.(n)}function hxn(t,n){return RN(t,n)?.structure??null}function gxn(t,n){return RN(t,n)?.text??null}function yxn(t,n){return RN(t,n)?.colorSample??null}function vxn(t,n){const s=RN(t,n);return s?.rects?F3r(s):null}function bxn(t){const n=t instanceof hy?t.childAdapters():[{worldId:"",adapter:t}],s=[];for(const{worldId:c,adapter:d}of n)d.rects?.emptyContainers&&(c&&oq(c)||s.push(...d.rects.emptyContainers()));return s}function Fan(t,n){const s=c=>{const d=t.inspector?.get(n,`style.${c}`);return ban(d)??0};return{paddingTop:s("paddingTop"),paddingRight:s("paddingRight"),paddingBottom:s("paddingBottom"),paddingLeft:s("paddingLeft"),marginTop:s("marginTop"),marginRight:s("marginRight"),marginBottom:s("marginBottom"),marginLeft:s("marginLeft")}}const Man=4;function Sxn(t,n){const s=D=>D>0?D:Man,c=s(n.paddingTop),d=s(n.paddingRight),m=s(n.paddingBottom),g=s(n.paddingLeft),S=s(n.marginTop),k=s(n.marginRight),A=s(n.marginBottom),F=s(n.marginLeft);return[{side:"paddingTop",kind:"padding",x:t.x,y:t.y,width:t.width,height:c,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+c/2,value:n.paddingTop,isZero:n.paddingTop===0},{side:"paddingBottom",kind:"padding",x:t.x,y:t.y+t.height-m,width:t.width,height:m,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height-m/2,value:n.paddingBottom,isZero:n.paddingBottom===0},{side:"paddingLeft",kind:"padding",x:t.x,y:t.y,width:g,height:t.height,cursor:"ew-resize",labelX:t.x+g/2,labelY:t.y+t.height/2,value:n.paddingLeft,isZero:n.paddingLeft===0},{side:"paddingRight",kind:"padding",x:t.x+t.width-d,y:t.y,width:d,height:t.height,cursor:"ew-resize",labelX:t.x+t.width-d/2,labelY:t.y+t.height/2,value:n.paddingRight,isZero:n.paddingRight===0},{side:"marginTop",kind:"margin",x:t.x,y:t.y-S,width:t.width,height:S,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y-S/2,value:n.marginTop,isZero:n.marginTop===0},{side:"marginBottom",kind:"margin",x:t.x,y:t.y+t.height,width:t.width,height:A,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height+A/2,value:n.marginBottom,isZero:n.marginBottom===0},{side:"marginLeft",kind:"margin",x:t.x-F,y:t.y,width:F,height:t.height,cursor:"ew-resize",labelX:t.x-F/2,labelY:t.y+t.height/2,value:n.marginLeft,isZero:n.marginLeft===0},{side:"marginRight",kind:"margin",x:t.x+t.width,y:t.y,width:k,height:t.height,cursor:"ew-resize",labelX:t.x+t.width+k/2,labelY:t.y+t.height/2,value:n.marginRight,isZero:n.marginRight===0}]}function jan(t,n,s){switch(t){case"paddingTop":return s;case"paddingBottom":return-s;case"paddingLeft":return n;case"paddingRight":return-n;case"marginTop":return-s;case"marginBottom":return s;case"marginLeft":return-n;case"marginRight":return n}}function xxn(t,n,s,c){const d=jan(t,n,s),m=Math.max(0,Math.round(c+d));return{[t]:m}}function wxn(t,n,s){return{x:t.x+n,y:t.y+s,width:t.width,height:t.height}}const xOe=3;function SO(t,n){return n==="x"?t.x+t.width/2:t.y+t.height/2}function Lan(t,n,s){if(n===0){const m=t[0].rect;return s?m.x:m.y}if(n===t.length){const m=t[t.length-1].rect;return s?m.x+m.width:m.y+m.height}const c=t[n-1].rect,d=t[n].rect;return s?(c.x+c.width+d.x)/2:(c.y+c.height+d.y)/2}function Ban(t,n,s){const c=Math.min(...t.map(g=>s?g.rect.y:g.rect.x)),d=Math.max(...t.map(g=>s?g.rect.y+g.rect.height:g.rect.x+g.rect.width)),m=xOe/2;return s?{x:n-m,y:c,width:xOe,height:d-c}:{x:c,y:n-m,width:d-c,height:xOe}}function Txn(t,n){if(t.length===0)return null;const s=Math.max(...t.map(J=>SO(J.rect,"x")))-Math.min(...t.map(J=>SO(J.rect,"x"))),c=Math.max(...t.map(J=>SO(J.rect,"y")))-Math.min(...t.map(J=>SO(J.rect,"y"))),d=s>=c,m=d?"x":"y",g=[...t].sort((J,$)=>SO(J.rect,m)-SO($.rect,m)),S=d?n.x:n.y;let k=0;for(;k<g.length&&SO(g[k].rect,m)<S;)k++;const A=k<g.length?g[k].id:null,F=Lan(g,k,d),D=Ban(g,F,d);return{beforeSiblingId:A,index:k,marker:D}}function Cxn(t,n){const s=t.hierarchy.node(n);if(!s)return null;if(s.parentId){const c=t.hierarchy.node(s.parentId);return c?c.childIds:null}return t.hierarchy.roots().map(c=>c.id)}function Exn(t,n){const s=t.x,c=t.x+t.width,d=t.y,m=t.y+t.height,g=n.x,S=n.x+n.width,k=n.y,A=n.y+n.height,F=[];let D=null;if(c<=g?D={x1:c,x2:g}:S<=s&&(D={x1:S,x2:s}),D){const $=Math.max(d,k),G=Math.min(m,A),se=G>$?($+G)/2:((d+m)/2+(k+A)/2)/2;F.push({orientation:"horizontal",x1:D.x1,y1:se,x2:D.x2,y2:se,distance:Math.round(D.x2-D.x1),labelX:(D.x1+D.x2)/2,labelY:se})}let J=null;if(m<=k?J={y1:m,y2:k}:A<=d&&(J={y1:A,y2:d}),J){const $=Math.max(s,g),G=Math.min(c,S),se=G>$?($+G)/2:((s+c)/2+(g+S)/2)/2;F.push({orientation:"vertical",x1:se,y1:J.y1,x2:se,y2:J.y2,distance:Math.round(J.y2-J.y1),labelX:se,labelY:(J.y1+J.y2)/2})}return F}function wOe(t,n,s){const c=t?.get(n,s);return typeof c=="string"&&c.length>0?c:null}function kxn(t,n){const s=wOe(t.inspector,n,"style.position");let c=null;const d=t.hierarchy.node(n)?.parentId??null;if(d){const m=wOe(t.inspector,d,"style.display");m==="flex"||m==="inline-flex"?c=`flex ${(wOe(t.inspector,d,"style.flexDirection")??"row").startsWith("column")?"col":"row"}`:m==="grid"||m==="inline-grid"?c="grid":m&&(c=m)}return{position:s,parentLayout:c}}function Axn(t,n){if(t.length<2)return[];const s=t.map(F=>F.rect),c=Math.min(...s.map(F=>F.x)),d=Math.max(...s.map(F=>F.x+F.width)),m=Math.min(...s.map(F=>F.y)),g=Math.max(...s.map(F=>F.y+F.height)),S=(c+d)/2,k=(m+g)/2,A=[];for(const{id:F,rect:D}of t)switch(n){case"left":A.push({id:F,x:c});break;case"hcenter":A.push({id:F,x:S-D.width/2});break;case"right":A.push({id:F,x:d-D.width});break;case"top":A.push({id:F,y:m});break;case"vcenter":A.push({id:F,y:k-D.height/2});break;case"bottom":A.push({id:F,y:g-D.height});break}return A}function Dxn(t,n){if(t.length<3)return[];const s=n==="horizontal",c=[...t].sort((D,J)=>s?D.rect.x-J.rect.x:D.rect.y-J.rect.y),d=c[0],m=c[c.length-1],g=s?m.rect.x+m.rect.width-d.rect.x:m.rect.y+m.rect.height-d.rect.y,S=c.reduce((D,J)=>D+(s?J.rect.width:J.rect.height),0),k=(g-S)/(c.length-1);let A=s?d.rect.x:d.rect.y;const F=[];for(const D of c)F.push(s?{id:D.id,x:A}:{id:D.id,y:A}),A+=(s?D.rect.width:D.rect.height)+k;return F}function Pxn(t){if(t.length===0)return null;const n=Math.min(...t.map(m=>m.x)),s=Math.min(...t.map(m=>m.y)),c=Math.max(...t.map(m=>m.x+m.width)),d=Math.max(...t.map(m=>m.y+m.height));return{x:n,y:s,width:c-n,height:d-s}}function $an(t,n,s,c,d){const m={};return s?(t!==0&&(m.x=c.x+t),n!==0&&(m.y=c.y+n),m):(t!==0&&(m.marginLeft=d.left+t),n!==0&&(m.marginTop=d.top+n),m)}function Ixn(t,n){return RN(t,n)?.rects?.frame?.(n)??null}function Nxn(t){const n=t.tr.x-t.tl.x,s=t.tr.y-t.tl.y,c=t.bl.x-t.tl.x,d=t.bl.y-t.tl.y,m=Math.max(Math.hypot(n,s),Math.hypot(c,d),1e-9);return Math.abs(s)/m>.001||Math.abs(c)/m>.001}function qan(t){return Math.atan2(t.tr.y-t.tl.y,t.tr.x-t.tl.x)}function bMt(t,n,s){return{x:t.tl.x+n*(t.tr.x-t.tl.x)+s*(t.bl.x-t.tl.x),y:t.tl.y+n*(t.tr.y-t.tl.y)+s*(t.bl.y-t.tl.y)}}function SMt(t){const n=t.includes("w")?0:t.includes("e")?1:.5,s=t.includes("n")?0:t.includes("s")?1:.5;return{s:n,t:s}}function Oxn(t,n,s){if(s.length!==2||t.width===void 0||t.height===void 0||!(n.width>0)||!(n.height>0))return t;const c=Math.max(t.width/n.width,t.height/n.height),d=n.width*c,m=n.height*c;return{...t,width:d,height:m,...s.includes("w")?{x:n.x+n.width-d}:{},...s.includes("n")?{y:n.y+n.height-m}:{}}}function Rxn(t,n){const{s,t:c}=SMt(n);return bMt(t,s,c)}function iwt(t,n){const s=t.tr.x-t.tl.x,c=t.tr.y-t.tl.y,d=t.bl.x-t.tl.x,m=t.bl.y-t.tl.y,g=s*m-c*d;return Math.abs(g)<1e-12?{s:0,t:0}:{s:(n.x*m-n.y*d)/g,t:(s*n.y-c*n.x)/g}}function Fxn(t,n,s,c,d,m=!1){const g=iwt(t,{x:s,y:c}),S=n.includes("e")?1+g.s:n.includes("w")?1-g.s:1,k=n.includes("s")?1+g.t:n.includes("n")?1-g.t:1,A=Math.max(S,k),F=Math.max(.01,m&&n.length===2?A:S),D=Math.max(.01,m&&n.length===2?A:k),J=SMt(n),$=bMt(t,1-J.s,1-J.t),G=iwt(t,{x:$.x-d.x,y:$.y-d.y}),se={x:d.x+F*G.s*(t.tr.x-t.tl.x)+D*G.t*(t.bl.x-t.tl.x),y:d.y+F*G.s*(t.tr.y-t.tl.y)+D*G.t*(t.bl.y-t.tl.y)};return{scaleXFactor:F,scaleYFactor:D,originX:d.x+$.x-se.x,originY:d.y+$.y-se.y}}let owt=!1;const xMt=new Set(["viewport","hierarchy","inspector","asset-browser","workspace","global"]);let wMt="viewport";const TMt="editorActiveHotkeyScope";function Mxn(){const t=document.documentElement.dataset[TMt];return t&&xMt.has(t)?t:wMt}function CR(t){wMt=t,document.documentElement.dataset[TMt]=t}const zan="data-editor-app-undo";function swt(t){return t instanceof Element&&t.closest(`[${zan}]`)!==null}function mje(t){return t instanceof Element?t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable?!0:!!t.closest('[contenteditable]:not([contenteditable="false"])'):!1}function Van(t){for(const n of t.composedPath()){if(!(n instanceof HTMLElement)||t.type==="focusin"&&n.hasAttribute("data-editor-hotkey-fallback"))continue;const s=n.dataset.editorHotkeyScope;if(s&&xMt.has(s))return s}return null}function awt(t){const n=Van(t);n&&CR(n)}const TOe=[];function cwt(t){return TOe.push(...t),()=>{for(const n of t){const s=TOe.indexOf(n);s>=0&&TOe.splice(s,1)}}}function Uan(){owt||(window.addEventListener("pointerdown",awt,!0),window.addEventListener("focusin",awt,!0),owt=!0)}const GZ=new Map;let CMt=0;const hje=new Set;function lwt(){CMt++;for(const t of hje)t()}function Jan(t){return GZ.set(t.id,t),lwt(),()=>{GZ.get(t.id)===t&&(GZ.delete(t.id),lwt())}}function Wan(){return[...GZ.values()]}function Han(){return CMt}function Gan(t){return hje.add(t),()=>hje.delete(t)}function LVe(t){const n=GZ.get(t);return!n||n.enabled&&!n.enabled()?!1:(n.run(),!0)}const Tw=["viewport","hierarchy","inspector"];function XL(){return(globalThis.getSelection?.()?.toString()??"").length===0}function BD(t){return Fze(t)}async function BVe(t){const n=BD(t);n.length!==0&&await s0e(Cm(t).adapter,n)}async function $Ve(t){const n=BD(t);n.length!==0&&await a0e(Cm(t).adapter,n)}async function qVe(t){const n=Cm(t).adapter,s=BD(t)[0],c=s?n.hierarchy.node(s)?.parentId??null:null;await c0e(n,c)}let uwt=Promise.resolve();function bve(t){const n=uwt.then(()=>Kan(t));return uwt=n.then(()=>{},()=>{}),n}async function Kan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(!c)return;const d=n.length===1?s.hierarchy.node(n[0])?.label??"selection":`${n.length} objects`;if(i0(`Duplicating ${d}…`),c.duplicateMany){const m=await bPt(s,n);if(m&&!m.persisted){i0(m.destination);return}}else for(const m of n){const g=await r0e(s,m).ack;if(g&&!g.persisted){i0(g.destination);return}}i0(`Duplicated ${d}`)}async function Sve(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(c)if(c.removeMany)await d$e(s,n);else{const d=new Map(dPt(s).map((g,S)=>[g,S])),m=[...n].sort((g,S)=>(d.get(S)??-1)-(d.get(g)??-1));for(const g of m)await jhe(s,g)}}async function Xan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.wrap)for(const d of n)await n0e(s,d)}async function Yan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.unwrap)for(const d of n)await i0e(s,d)}async function Zan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;s.structure?.group&&await o0e(s,n).ack}function TI(t,n,s){const c=BD(t);if(c.length===0)return;const d=Cm(t).adapter;for(const m of c){const g=Ran(d,m);if(!g)continue;const S=Oan(d,m);if(!S)continue;const k=d.inspector?.get(m,"style.position"),A=k==="absolute"||k==="fixed",F=Fan(d,m),D=$an(n,s,A,S,{left:F.marginLeft,top:F.marginTop});Object.keys(D).length!==0&&(g.begin(m),g.apply(m,D),g.end(m))}}function Qan(t){const n=Array.isArray(t)?t:[t];return n.includes("global")?"global":n.length===1&&n[0]==="viewport"?"stage":"panel"}let bme=null;function pp(t,n){const{frameEnabled:s,...c}=n;return bme?.push(Jan({id:t,run:d=>c.action(d??new KeyboardEvent("keydown")),scope:Qan(c.scope),...s?{enabled:s}:{}})),LBe(t).map(d=>({...c,...d}))}function EMt(t){const n=()=>{const g=[],S=bme;bme=g;try{return{rows:t(),actions:g}}finally{bme=S}};let s=n(),c=cwt(s.rows);const d=()=>{c();for(const g of s.actions)g()},m=Kye(()=>{d(),s=n(),c=cwt(s.rows)});return()=>{m(),d()}}function ecn(t,n){const s=()=>{const m=n.getSnapshot().undoLabel;n.undo().then(g=>{g&&m&&i0(`Undid ${m}`)})},c=()=>{const m=n.getSnapshot().redoLabel;n.redo().then(g=>{g&&m&&i0(`Redid ${m}`)})},d=EMt(()=>[...pp("edit.redo",{scope:"global",allowInEditable:!0,when:m=>!mje(m.target)||swt(m.target),action:c}),...pp("edit.undo",{scope:"global",allowInEditable:!0,when:m=>!mje(m.target)||swt(m.target),action:s}),...pp("edit.copy",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void BVe(t)}),...pp("edit.cut",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void $Ve(t)}),...pp("edit.paste",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void qVe(t)}),...pp("edit.duplicate",{scope:Tw,action:()=>void bve(t)}),...pp("edit.group",{scope:Tw,action:()=>void Zan(t)}),...pp("edit.wrap",{scope:Tw,action:()=>Xan(t)}),...pp("edit.unwrap",{scope:Tw,action:()=>Yan(t)}),...pp("edit.nudgeUp",{scope:"viewport",action:()=>TI(t,0,-1)}),...pp("edit.nudgeUpCoarse",{scope:"viewport",action:()=>TI(t,0,-10)}),...pp("edit.nudgeDown",{scope:"viewport",action:()=>TI(t,0,1)}),...pp("edit.nudgeDownCoarse",{scope:"viewport",action:()=>TI(t,0,10)}),...pp("edit.nudgeLeft",{scope:"viewport",action:()=>TI(t,-1,0)}),...pp("edit.nudgeLeftCoarse",{scope:"viewport",action:()=>TI(t,-10,0)}),...pp("edit.nudgeRight",{scope:"viewport",action:()=>TI(t,1,0)}),...pp("edit.nudgeRightCoarse",{scope:"viewport",action:()=>TI(t,10,0)}),...pp("edit.selectAll",{scope:Tw,action:()=>{const m=Cm(t).adapter;c0(m,dPt(m))}}),...pp("edit.deselectAll",{scope:Tw,action:()=>c0(Cm(t).adapter,[])}),...pp("edit.save",{scope:"global",allowInEditable:!0,action:()=>{TTr().then(m=>{m===null&&ORt(t)})}}),...pp("view.resetPan",{scope:"viewport",action:()=>dMt()}),...pp("edit.enterScope",{scope:Tw,when:()=>t.playState==="stopped",frameEnabled:()=>t.playState==="stopped",action:()=>{J3r(Cm(t).adapter)}}),...pp("edit.delete",{scope:Tw,action:()=>void Sve(t)}),...pp("edit.exitScopeOrDeselect",{scope:Tw,when:()=>V3r()!==null||t.playState==="stopped",frameEnabled:()=>!0,action:()=>{const m=Cm(t).adapter;if(!U3r(m)){if(t.playState!=="stopped"){bVe();return}t.select(null)}}}),...pp("view.commandPalette",{scope:"global",action:()=>{CVe()||Qs.warn(`The command palette has not handed over its opener yet — run "Volter Editor: Open Workspace" first, or press the workbench's own Show All Commands.`)}}),...pp("view.toggleConsole",{scope:"global",action:()=>pve()}),...pp("view.focusMode",{scope:"global",action:()=>qBe()}),...pp("workspace.cycleNext",{scope:"global",action:()=>{Che(1)}}),...pp("workspace.cyclePrevious",{scope:"global",action:()=>{Che(-1)}})]);return Uan(),d}function tcn(t){return EMt(()=>t.flatMap(n=>{const s=n.enabled;return pp(n.id,{scope:n.scope==="stage"?"viewport":"global",action:c=>n.run(c),...s?{when:()=>s(),frameEnabled:()=>s()}:{}})}))}function zVe(){ukr("undo-history")}function rcn(){const t=()=>zVe();return window.addEventListener("editor:show-history-tab",t),()=>window.removeEventListener("editor:show-history-tab",t)}let gje=null,kMt=0;const yje=new Set;function VVe(t){if(gje!==t){gje=t,kMt++;for(const n of yje)n()}}function AMt(){return gje}function ncn(t){VVe(t)}function DMt(){VVe(null)}function PMt(t){return yje.add(t),()=>yje.delete(t)}function vje(){return kMt}function icn(){VVe(null)}const ocn=Object.freeze(Object.defineProperty({__proto__:null,__resetEditorPresentationNoticeForTest:icn,clearEditorPresentationNotice:DMt,editorPresentationNotice:AMt,editorPresentationNoticeVersion:vje,showEditorPresentationNotice:ncn,subscribeEditorPresentationNotice:PMt},Symbol.toStringTag,{value:"Module"})),fwt="agent-presented-view";function scn(){const t=Yv();Ye.useSyncExternalStore(PMt,vje,vje);const n=AMt();return Ye.useEffect(()=>{if(!n){kBe(fwt);return}s$({id:fwt,tone:"info",title:"Agent presented this view.",...n.presented.warnings.length>0?{detail:n.presented.warnings.join(" ")}:{},onDismiss:DMt,actions:[{label:"Copy Link",keeps:!0,run:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(n.presented.url)).catch(()=>{Qs.warn("Could not copy the view link to the clipboard.","editor")})}},{label:"Return",primary:!0,run:()=>{Vge(t,n.previousView,{origin:"return"}).catch(s=>{Qs.error(`Could not return to the previous editor view: ${s instanceof Error?s.message:String(s)}`,"editor")})}}]})},[n,t]),null}function acn(t){Ye.useEffect(()=>{const n=_tn(),s=()=>btn(t.playState!=="stopped");s();const c=t.subscribe(s);return()=>{c(),n(),L3t()}},[t])}const nee={console:{id:"console",title:"Console"},lightExplorer:{id:"light-explorer",title:"Light Explorer"}},ccn={storyActions:{id:"story-actions",title:"Actions"},storyInteractions:{id:"story-interactions",title:"Interactions"},storyAccessibility:{id:"story-accessibility",title:"Accessibility"},generations:{id:"generations",title:"Generations"}};[...Object.values(nee),...Object.values(ccn)];const lcn={info:Go.content.primary,warn:Go.semantic.warning,error:Go.semantic.danger},dwt={scene:"#78dce8",physics:"#ff6188",animation:"#a9dc76",network:"#fc9867",audio:"#ab9df2",ai:"#ffd866",input:"#78dce8",core:Go.content.primary},pwt={info:R$,warn:YTt,error:jTt};function ucn(){const t=Yv();Ye.useSyncExternalStore(Qs.subscribe,Qs.getSnapshot);const[n,s]=Ye.useState(""),[c,d]=Ye.useState("all"),[m,g]=Ye.useState({info:!0,warn:!0,error:!0}),S=Ye.useRef(null),[k,A]=Ye.useState(!0),F=Qs.getEntries(),D=new Map;for(const Ce of F){const De=Ce.metadata?.instanceId;if(typeof De!="string"||De.length===0)continue;const Pe=Ce.metadata?.instanceName;D.set(De,typeof Pe=="string"&&Pe.length>0?Pe:`Instance ${De}`)}const J=F.filter(Ce=>!(!m[Ce.level]||c!=="all"&&Ce.metadata?.instanceId!==c||n&&!Ce.message.toLowerCase().includes(n.toLowerCase())));Ye.useEffect(()=>{k&&S.current&&(S.current.scrollTop=S.current.scrollHeight)},[F.length,k]);const $=()=>{if(!S.current)return;const{scrollTop:Ce,scrollHeight:De,clientHeight:Pe}=S.current;A(De-Ce-Pe<20)},G=Ce=>{g(De=>({...De,[Ce]:!De[Ce]}))},se=Ce=>{const De=new Date(Ce);return`${De.getHours().toString().padStart(2,"0")}:${De.getMinutes().toString().padStart(2,"0")}:${De.getSeconds().toString().padStart(2,"0")}`},pe=Ce=>{c0(Y0(t),[Ce]),LVe("viewport.frameSelection")},ue=Qs.counts;return q.jsxs(JTr,{className:"volter-console",children:[q.jsxs(n$,{label:"Console filters",compact:!0,children:[q.jsx(dm,{"aria-label":"Clear console",size:"compact",onClick:()=>Qs.clear(),title:"Clear console",children:q.jsx(dc,{icon:OTt,size:"xs"})}),q.jsx(Pht,{}),q.jsxs(Iw,{"aria-label":"Filter console by game instance",title:"Show messages from all game instances or one inspected instance",value:c,onChange:Ce=>d(Ce.target.value),style:{width:"auto",minWidth:74,height:24,fontSize:11},children:[q.jsx("option",{value:"all",children:"All instances"}),[...D].map(([Ce,De])=>q.jsx("option",{value:Ce,children:De},Ce))]}),q.jsx(Pht,{}),["info","warn","error"].map(Ce=>q.jsxs(Ms,{variant:"ghost",size:"compact","aria-label":`Toggle ${Ce} messages`,"aria-pressed":m[Ce],"data-console-level":Ce,onClick:()=>G(Ce),children:[q.jsx(dc,{icon:pwt[Ce],size:"xs"}),ue[Ce]]},Ce)),q.jsx(Zm,{placeholder:"Filter...",value:n,onChange:Ce=>s(Ce.target.value),className:"volter-console-filter"})]}),q.jsxs("div",{ref:S,onScroll:$,className:"volter-console-list volter-selectable-text",children:[J.length===0&&q.jsx("div",{className:"volter-console-empty",children:"No messages"}),J.map(Ce=>{const De=Ce.metadata?.entityId!=null?String(Ce.metadata.entityId):null,Pe=(De?Y0(t).hierarchy.node(De)?.label:null)||De,be=typeof Ce.metadata?.instanceId=="string"?Ce.metadata.instanceId:null,X=typeof Ce.metadata?.instanceName=="string"?Ce.metadata.instanceName:be?`Instance ${be}`:null;return q.jsxs("div",{className:"volter-console-row","data-level":Ce.level,style:{color:lcn[Ce.level]},children:[q.jsx("span",{style:{color:Go.content.dim,marginRight:6,flexShrink:0},children:se(Ce.timestamp)}),q.jsx(dc,{icon:pwt[Ce.level],style:{fontSize:9,marginTop:4,marginRight:6,flexShrink:0}}),X&&q.jsx("span",{title:be?`Runtime instance ${be}`:void 0,style:{background:Go.accent.muted,color:Go.accent.default,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:X}),Ce.subsystem&&q.jsx("span",{style:{background:`${dwt[Ce.subsystem]??Go.content.muted}22`,color:dwt[Ce.subsystem]??Go.content.muted,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:Ce.subsystem}),q.jsxs("span",{style:{flex:1,wordBreak:"break-word"},children:[Ce.message,De&&q.jsxs("span",{onClick:()=>pe(De),style:{background:Go.semantic.successMuted,color:Go.semantic.success,borderRadius:Go.shape.small,padding:"0 5px",fontSize:10,marginLeft:6,cursor:"pointer",pointerEvents:"auto",display:"inline-flex",alignItems:"center",gap:3},title:`Select and focus "${Pe}"`,children:[q.jsx(dc,{icon:aR,style:{fontSize:8}}),Pe]}),Ce.source&&q.jsxs("span",{style:{color:Go.content.dim,marginLeft:6},children:["[",Ce.source,"]"]})]}),Ce.count>1&&q.jsx("span",{className:"volter-console-count",children:Ce.count})]},Ce.id)})]})]})}const fcn={enabled:"visible",color:"light.color",intensity:"light.intensity",range:"light.distance",shadows:"shadow.cast"};function IMt(t){const n=[],s=t;return W$(t.hierarchy,c=>{c.kind==="light"&&n.push(c)},{extraChildren:c=>s.internalChildren?.(c)}),n}function jxn(t){return IMt(t).length}function NMt(t,n){return t.find(s=>s.path===fcn[n])??null}function qY(t,n,s,c,d){const m=NMt(s,c);if(!m||!t.inspector)return{supported:!1,writable:!1,value:null};let g;try{g=t.inspector.get(n,m.path)}catch{g=void 0}return{supported:!0,writable:m.readonly!==!0,value:d(g)?g:null}}const _wt=t=>typeof t=="boolean",dcn=t=>typeof t=="string",mwt=t=>typeof t=="number"&&Number.isFinite(t);function pcn(t){return IMt(t).map(n=>{let s=[];try{s=t.inspector?.properties(n.id)??[]}catch{}const c=t.hierarchy.object3D?.(n.id)?.type;return{id:n.id,name:n.label,type:n.typeLabel??c??"Light",enabled:qY(t,n.id,s,"enabled",_wt),color:qY(t,n.id,s,"color",dcn),intensity:qY(t,n.id,s,"intensity",mwt),range:qY(t,n.id,s,"range",mwt),shadows:qY(t,n.id,s,"shadows",_wt)}})}function _cn(t,n,s,c){if(!t.inspector)return 0;let d=0;for(const m of n){let g=null;try{g=NMt(t.inspector.properties(m),s)}catch{continue}!g||g.readonly||(gPt(t,m,g.path,c),d++)}return d}function mcn(t,n){return t===null&&n===null?0:t===null?1:n===null?-1:typeof t=="string"&&typeof n=="string"?t.localeCompare(n,void 0,{numeric:!0,sensitivity:"base"}):Number(t)-Number(n)}function hwt(t,n){return n==="name"||n==="type"?t[n]:t[n].value}function zY({label:t,sortKey:n,activeKey:s,direction:c,onSort:d}){const m=n===s;return q.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-sort","aria-label":`Sort lights by ${t}`,onClick:()=>d(n),children:[t,m?q.jsx(dc,{icon:c==="ascending"?O0r:Q0r,size:"xs"}):null]})}function xve(){return q.jsx("span",{className:"volter-light-explorer-unavailable",children:"—"})}function hcn({row:t,edit:n}){return t.enabled.supported?q.jsx(TD,{"aria-label":`${t.enabled.value?"Disable":"Enable"} ${t.name}`,checked:t.enabled.value??!1,disabled:!t.enabled.writable,onChange:s=>n("enabled",s.target.checked)}):q.jsx(xve,{})}function gcn({row:t,edit:n}){return!t.color.supported||!t.color.value?q.jsx(xve,{}):q.jsxs("div",{className:"volter-light-explorer-color",children:[q.jsx(d4t,{"aria-label":`Color for ${t.name}`,value:t.color.value,disabled:!t.color.writable,onChange:s=>n("color",s.target.value)}),q.jsx("span",{children:t.color.value})]})}function gwt({row:t,field:n,step:s,edit:c}){const d=t[n];return d.supported?q.jsx(SZ,{value:d.value,disabled:!d.writable,precision:2,step:s,onChange:m=>c(n,m)}):q.jsx(xve,{})}function ycn({row:t,edit:n}){return t.shadows.supported?q.jsx(TD,{"aria-label":`Toggle shadows for ${t.name}`,checked:t.shadows.value??!1,disabled:!t.shadows.writable,onChange:s=>n("shadows",s.target.checked)}):q.jsx(xve,{})}function vcn({row:t,adapter:n,visibleRows:s,selected:c,selectionAnchor:d,edit:m}){const g=(S,k)=>m(t,S,k);return q.jsxs("tr",{"data-selected":c.has(t.id)||void 0,children:[q.jsx("td",{children:q.jsx(hcn,{row:t,edit:g})}),q.jsx("td",{children:q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-name","aria-pressed":c.has(t.id),onClick:S=>{Scn(n,s,t.id,d.current,S.shiftKey,S.metaKey||S.ctrlKey),S.shiftKey||(d.current=t.id)},children:t.name})}),q.jsx("td",{className:"volter-light-explorer-type",children:t.type}),q.jsx("td",{children:q.jsx(gcn,{row:t,edit:g})}),q.jsx("td",{children:q.jsx(gwt,{row:t,field:"intensity",step:.1,edit:g})}),q.jsx("td",{children:q.jsx(gwt,{row:t,field:"range",step:.5,edit:g})}),q.jsx("td",{children:q.jsx(ycn,{row:t,edit:g})})]})}function bcn(t,n,s){if(!n.has(t.id))return[t.id];const c=s.filter(d=>n.has(d.id));return c.length>1?c.map(d=>d.id):[t.id]}function Scn(t,n,s,c,d,m){if(!t.selection)return;const g=t.selection.get();if(d&&c){const S=n.findIndex(A=>A.id===c),k=n.findIndex(A=>A.id===s);if(S>=0&&k>=0){const A=n.slice(Math.min(S,k),Math.max(S,k)+1).map(F=>F.id);c0(t,m?[...new Set([...g,...A])]:A,{intent:"exact"});return}}if(m){c0(t,g.includes(s)?g.filter(S=>S!==s):[...g,s],{intent:"exact"});return}c0(t,[s],{intent:"exact"})}function xcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),Ye.useSyncExternalStore(o2,K1,K1),Ye.useSyncExternalStore(Cee,AD,AD);const{adapter:n}=Cm(t),[,s]=Ye.useReducer(Pe=>Pe+1,0);Ye.useEffect(()=>n.subscribe?.(s),[n]);const[c,d]=Ye.useState(""),[m,g]=Ye.useState("all"),[S,k]=Ye.useState("name"),[A,F]=Ye.useState("ascending"),D=Ye.useRef(null),J=pcn(n),$=Ye.useMemo(()=>[...new Set(J.map(Pe=>Pe.type))].sort((Pe,be)=>Pe.localeCompare(be)),[J]),G=c.trim().toLocaleLowerCase(),se=J.filter(Pe=>(m==="all"||Pe.type===m)&&(!G||Pe.name.toLocaleLowerCase().includes(G)||Pe.type.toLocaleLowerCase().includes(G))).sort((Pe,be)=>{const X=mcn(hwt(Pe,S),hwt(be,S));return A==="ascending"?X:-X}),pe=new Set(n.selection?.get()??[]),ue=J.filter(Pe=>pe.has(Pe.id)).length,Ce=Pe=>{Pe===S?F(be=>be==="ascending"?"descending":"ascending"):(k(Pe),F("ascending"))},De=(Pe,be,X)=>{const we=bcn(Pe,pe,se);_cn(n,we,be,X)>0&&t.notifyIngestEdit()};return q.jsxs("section",{className:"volter-light-explorer","aria-label":"Light Explorer",children:[q.jsxs("div",{className:"volter-light-explorer-toolbar",children:[q.jsx(Zm,{"aria-label":"Search lights",placeholder:"Search lights…",value:c,onChange:Pe=>d(Pe.target.value)}),q.jsxs(Iw,{"aria-label":"Filter lights by type",value:m,onChange:Pe=>g(Pe.target.value),children:[q.jsx("option",{value:"all",children:"All types"}),$.map(Pe=>q.jsx("option",{value:Pe,children:Pe},Pe))]}),q.jsxs("span",{className:"volter-light-explorer-summary",children:[J.length," ",J.length===1?"light":"lights",ue>0?` · ${ue} selected`:""]})]}),J.length===0?q.jsx("div",{className:"volter-light-explorer-empty",children:"The active document does not expose any lights."}):q.jsxs("div",{className:"volter-light-explorer-scroll",children:[q.jsxs("table",{className:"volter-light-explorer-table",children:[q.jsx("thead",{children:q.jsxs("tr",{children:[q.jsx("th",{className:"volter-light-explorer-check-column",scope:"col",children:"On"}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Name",sortKey:"name",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Type",sortKey:"type",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:"Color"}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Intensity",sortKey:"intensity",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Range",sortKey:"range",activeKey:S,direction:A,onSort:Ce})}),q.jsx("th",{scope:"col",children:q.jsx(zY,{label:"Shadows",sortKey:"shadows",activeKey:S,direction:A,onSort:Ce})})]})}),q.jsx("tbody",{children:se.map(Pe=>q.jsx(vcn,{row:Pe,adapter:n,visibleRows:se,selected:pe,selectionAnchor:D,edit:De},Pe.id))})]}),se.length===0?q.jsx("div",{className:"volter-light-explorer-empty",children:"No lights match the current filters."}):null]})]})}const wcn=Mye();function Tcn(){const{error:t,warn:n}=Qs.counts;return t>0?{count:t+n,severity:"error"}:n>0?{count:n,severity:"warn"}:null}function Ccn(){wcn.ensure(t=>{t(cFe({...nee.console,order:-100,Content:ucn,badge:Tcn,subscribeBadge:Qs.subscribe,badgeSnapshot:Qs.getSnapshot,visibleByDefault:!1,closeable:!0})),t(cFe({...nee.lightExplorer,order:21,Content:xcn,visibleByDefault:!1,closeable:!0}))})}const Sme=new Map,xme=new Map,bje=new Set;let OMt=0;function RMt(){OMt++;for(const t of[...bje])t()}function Lxn(t,n){const s=Sme.get(t),c=n===null?null:Math.max(0,Math.round(n.headerWidth));(n===null?s===void 0:s?.headerWidth===c&&s.shelf===n.shelf)||(n===null||c===null?Sme.delete(t):Sme.set(t,{headerWidth:c,shelf:n.shelf}),RMt())}function FMt(t){return Sme.get(t)??null}function Bxn(t){return xme.get(t)??null}function Ecn(t,n){(xme.get(t)??null)!==n&&(n===null?xme.delete(t):xme.set(t,n),RMt())}function MMt(t){return bje.add(t),()=>{bje.delete(t)}}function Xge(){return OMt}const kcn=5742335;function jMt(t,n,s){return t<<16|n<<8|s}function ywt(t){const n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t.trim())?.[1];if(n){const d=n.length===3?[...n].map(m=>`${m}${m}`).join(""):n;return Number.parseInt(d.slice(0,6),16)}const s=/^rgba?\(\s*(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)/i.exec(t.trim());if(!s)return null;const c=s.slice(1,4).map(d=>Math.round(Number(d)));return c.some(d=>d<0||d>255)?null:jMt(c[0],c[1],c[2])}function iee(t){const n=ywt(t);if(n!==null||typeof document>"u")return n;if(typeof CSS<"u"&&!CSS.supports("color",t))return null;const s=document.createElement("canvas").getContext("2d");return s?(s.fillStyle="#010203",s.fillStyle=t,ywt(String(s.fillStyle))):null}function dA(t){return typeof document>"u"?null:t?.closest(`.${RRe}`)??document.querySelector(`.${RRe}`)}function vwt(t){const n=Math.round((t>>16&255)*.42),s=Math.round((t>>8&255)*.42),c=Math.round((t&255)*.42);return jMt(n,s,c)}function Ig(t,n){return t&&typeof getComputedStyle<"u"?getComputedStyle(t).getPropertyValue(n).trim():""}const LMt={"--volter-viewport-background":"--vscode-volter-viewport-background","--volter-viewport-grid":"--vscode-volter-viewport-grid","--volter-viewport-axis-x":"--vscode-volter-viewport-axisX","--volter-viewport-axis-y":"--vscode-volter-viewport-axisY","--volter-viewport-axis-z":"--vscode-volter-viewport-axisZ","--volter-viewport-selection":"--vscode-volter-viewport-selection","--volter-viewport-active":"--vscode-volter-viewport-active","--volter-viewport-wire":"--vscode-volter-viewport-wire","--volter-gizmo-x":"--vscode-volter-gizmo-x","--volter-gizmo-y":"--vscode-volter-gizmo-y","--volter-gizmo-z":"--vscode-volter-gizmo-z","--volter-gizmo-navigation-x":"--vscode-volter-gizmo-navigationX","--volter-gizmo-navigation-y":"--vscode-volter-gizmo-navigationY","--volter-gizmo-navigation-z":"--vscode-volter-gizmo-navigationZ","--volter-gizmo-hover":"--vscode-volter-gizmo-hover","--volter-gizmo-drag":"--vscode-volter-gizmo-drag"};function oee(t,n){const s=LMt[n];return(s?Ig(t,s):"")||Ig(t,n)}function $xn(t){const n=dA(t),s=oee(n,"--volter-viewport-selection")||Ig(n,"--volter-accent"),c=iee(s||i$.color.accent.default)??kcn,d=iee(oee(n,"--volter-viewport-active")),m=Ig(n,"--volter-viewport-outline-style"),g=Number.parseFloat(Ig(n,"--volter-viewport-outline-width")),S=Ig(n,"--volter-viewport-outline-hidden");return{visible:c,hidden:vwt(c),...d===null?{}:{active:{visible:d,hidden:vwt(d)}},...m===""&&S===""&&!Number.isFinite(g)?{}:{outline:{style:m==="crisp"?"crisp":"soft",width:Number.isFinite(g)&&g>0?g:null,hidden:S!=="false"}}}}function qxn(t){return BMt(t).background!==null}function zxn(t){const n=BMt(t).background;if(n===null)return!1;const s=n>>16&255,c=n>>8&255,d=n&255;return(.2126*s+.7152*c+.0722*d)/255>.5}function BMt(t){const n=dA(t),s=c=>{const d=oee(n,c);return d?iee(d):null};return{background:s("--volter-viewport-background"),grid:s("--volter-viewport-grid"),axisX:s("--volter-viewport-axis-x"),axisY:s("--volter-viewport-axis-y"),axisZ:s("--volter-viewport-axis-z"),axisLineWidth:(()=>{const c=Ig(n,"--volter-viewport-axis-line-width"),d=c?Number.parseFloat(c):Number.NaN;return Number.isFinite(d)?d:null})(),active:s("--volter-viewport-active")}}function Vxn(t){const n=dA(t),s=m=>{const g=oee(n,m);return g?iee(g):null},c=m=>{const g=Ig(n,m);if(!g)return null;const S=Number.parseFloat(g);return Number.isFinite(S)?S:null},d=m=>{const g=s(`${m}-x`),S=s(`${m}-y`),k=s(`${m}-z`);return g!==null&&S!==null&&k!==null?[g,S,k]:null};return{axes:d("--volter-gizmo"),navigation:d("--volter-gizmo-navigation"),hover:s("--volter-gizmo-hover"),drag:s("--volter-gizmo-drag"),opacity:c("--volter-viewport-gizmo-opacity"),arrowLength:c("--volter-viewport-gizmo-arrow-length"),arrowHead:c("--volter-viewport-gizmo-arrow-head"),ringWidth:c("--volter-viewport-gizmo-ring-width"),navigationSize:c("--volter-viewport-navigation-size"),background:s("--volter-viewport-background"),navigationForm:(m=>m==="cones"||m==="triad"||m==="godot"?m:"balls")(Ig(n,"--volter-viewport-navigation-gizmo")),navigationCorner:Ig(n,"--volter-viewport-navigation-corner")==="bottom-left"?"bottom-left":"top-right",highlightSaturation:c("--volter-viewport-gizmo-highlight-saturation"),highlightValue:c("--volter-viewport-gizmo-highlight-value")}}function Uxn(t){const n=Ig(dA(t),"--volter-viewport-gizmo-size");if(!n)return null;const s=Number.parseFloat(n);return Number.isFinite(s)&&s>0?s:null}function Jxn(t){const n=dA(t),s=(d,m)=>{const g=Number.parseFloat(Ig(n,d)??"");return Number.isFinite(g)&&g>0?g:m},c=s("--volter-viewport-grid-line-width",1);return{lineWidth:c,majorWidth:s("--volter-viewport-grid-major-width",c),majorContrast:s("--volter-viewport-grid-major-contrast",1)}}function Wxn(t){const n=dA(t),s=oee(n,"--volter-viewport-wire"),c=Number.parseFloat(Ig(n,"--volter-viewport-wire-opacity"));return{color:s?iee(s):null,opacity:Number.isFinite(c)?c:null}}function Hxn(t){const n=dA(t),s=Number.parseFloat(Ig(n,"--volter-viewport-selection-box-width"));return{edges:Ig(n,"--volter-viewport-selection-box")==="edges",frame:Ig(n,"--volter-viewport-selection-box-frame")==="object"?"object":"world",lineWidth:Number.isFinite(s)&&s>0?s:null}}function $Mt(t){const n=dA(t);return["--volter-viewport-chrome-bar","--volter-viewport-chrome-view-name","--volter-viewport-chrome-tools","--volter-viewport-chrome-display","--volter-viewport-chrome-transform-controls"].map(s=>Ig(n,s)).join("|")}function Acn(t){const[n,s,c,d,m]=t.split("|"),g=["strip","pills"],S=["menu","gizmo","bar"],k=["bar-start","bar-end"],A=(F,D,J)=>D.includes(F)?F:J;return{bar:A(n,g,"none"),viewName:A(s,S,"text"),tools:A(c,k,"shelf"),display:A(d,k,"corner"),transformControls:m==="bar"?"bar":"header"}}let Sje=null;function Dcn(t){return zMt(null,()=>{Sje=$Mt(),t()})}function bwt(){return Sje??=$Mt(),Sje}let xje=null;function qMt(){const t=dA();return JSON.stringify([xBe.map(n=>Ig(t,`--volter-viewport-word-${n}`)),Ig(t,"--volter-viewport-word-helpers")])}function Pcn(t){return zMt(null,()=>{xje=qMt(),t()})}function Swt(){return xje??=qMt(),xje}function Gxn(){const t=Ye.useSyncExternalStore(Pcn,Swt,Swt);return Ye.useMemo(()=>{const[n,s]=JSON.parse(t),c={};return xBe.forEach((d,m)=>{n[m]&&(c[d]=n[m])}),{shading:c,helpers:s||void 0}},[t])}function Icn(){const t=Ye.useSyncExternalStore(Dcn,bwt,bwt);return Ye.useMemo(()=>Acn(t),[t])}function zMt(t,n){n();const s=dA(t);if(!s||typeof MutationObserver>"u")return()=>{};const c=new MutationObserver(n);c.observe(s,{attributes:!0,attributeFilter:["style"]});const d=Ncn(s,n);return()=>{c.disconnect(),d()}}const l_e=new Set;let YL=null,COe="";function Ncn(t,n){const s=()=>Object.values(LMt).map(c=>Ig(t,c)).join("|");return l_e.add(n),!YL&&typeof document<"u"&&document.head&&(COe=s(),YL=new MutationObserver(()=>{const c=s();if(c!==COe){COe=c;for(const d of[...l_e])d()}}),YL.observe(document.head,{childList:!0,subtree:!0,characterData:!0})),()=>{l_e.delete(n),l_e.size===0&&YL&&(YL.disconnect(),YL=null)}}function Ocn({documentId:t,runtime:n=!1,island:s=!1,assetPath:c,transformControls:d,children:m}){Ye.useSyncExternalStore(CBe,o$,o$);const g=Ye.useSyncExternalStore(U$,eA,eA);Ye.useSyncExternalStore(MMt,Xge,Xge);const S=FMt(t)?.headerWidth??null,k=Ye.useCallback(F=>Ecn(t,F),[t]),A=s2(t)?.HeaderControls;return!m&&!A&&!d||!n&&g.includes("header:hidden")?null:q.jsxs("div",{className:s?"volter-dock-document-toolbar volter-chrome-island volter-glass-island":"volter-dock-document-toolbar","data-runtime-toolbar":n||void 0,"data-island-scale":"compact","data-testid":`document-header:${t}`,children:[m?q.jsx("div",{className:"volter-dock-document-toolbar-own",children:m}):null,d,A?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(A,{documentId:t,...c&&!c.startsWith("online:")?{assetPath:c}:{}})}):null,S===null?null:q.jsx("div",{ref:k,className:"volter-dock-document-toolbar-area","data-testid":`document-header-area:${t}`,style:{flex:"0 0 auto",width:S,alignSelf:"stretch",display:"flex",alignItems:"center",position:"relative",zIndex:1,background:"var(--volter-surface-chrome)"}})]})}function Rcn({documentId:t,children:n}){const s=Ye.useSyncExternalStore(U$,eA,eA);return!n||s.includes("shelf:hidden")?null:q.jsx("div",{className:"volter-dock-document-shelf","data-testid":`document-shelf:${t}`,role:"toolbar","aria-orientation":"vertical","aria-label":"Document tools",children:n})}function Fcn(t){return t==="game"||t==="scene"||t==="world"?"world":"resource"}function VMt({viewId:t,descriptor:n,active:s,backdrop:c=!1,chrome:d=!0}){const m=n.Content,g=n.Toolbar,S=n.Shelf,k=Fcn(n.kind),A=Yv();Ye.useSyncExternalStore(A.subscribe,A.getShellSnapshot??A.getSnapshot),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(CBe,o$,o$),Ye.useSyncExternalStore(uCt,GOe,GOe);const F=s2(n.id),D=s&&n.kind!=="game"?F?.transformTools?.()??"none":"none",J=F?.TransformTools,$=F?.TransformControls,G=Icn(),se=d&&F!==null&&F!==void 0&&!c,pe=se&&G.bar!=="none"&&G.tools!=="shelf",ue=Ye.useSyncExternalStore(U$,eA,eA).includes("shelf:hidden"),Ce=D==="none"||!J?null:q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(J,{documentId:n.id})});Ye.useSyncExternalStore(MMt,Xge,Xge);const De=FMt(n.id)?.shelf??null,Pe=se&&G.bar!=="none",be=!Pe||G.display==="corner"?null:G.display==="bar-start"?"start":"end",X=pe?G.tools==="bar-start"?"start":"end":null,we=Pe&&G.transformControls==="bar"&&D==="gizmo"&&$!==void 0,qe=we?X??be??"start":null,bt=Pt=>q.jsxs("div",{className:"volter-stage-bar-group","data-edge":Pt,children:[be===Pt?q.jsx("div",{className:"volter-stage-bar-slot","data-stage-bar-slot":"display"}):null,X===Pt?Ce:null,qe===Pt&&$?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx($,{documentId:n.id})}):null]});return q.jsxs("div",{className:"volter-dock-document","data-testid":`workspace-doc:${n.id}`,"data-editor-hotkey-scope":k==="world"?"viewport":"workspace","data-volter-document-family":k,children:[d&&q.jsx(Ocn,{documentId:n.id,runtime:n.kind==="game",island:c&&k==="world",assetPath:fQr(n.id)?.assetPath,transformControls:D==="gizmo"&&$&&!we?q.jsx(Ye.Suspense,{fallback:null,children:q.jsx($,{documentId:n.id})}):null,children:g?q.jsx(g,{documentId:n.id,active:s}):null}),q.jsxs("div",{className:"volter-dock-document-content","data-workspace-document-id":n.id,"data-workspace-view-id":t,"data-volter-stage-bar":se&&G.bar!=="none"?G.bar:void 0,"data-volter-stage-rail":d&&!ue&&(Ce&&!pe||S)?void 0:"empty",children:[q.jsx(m,{documentId:n.id,...t?{viewId:t}:{},active:s}),Pe?q.jsxs("div",{className:"volter-stage-bar","data-form":G.bar,role:"toolbar","aria-label":"Viewport",children:[bt("start"),bt("end")]}):null,d&&!ue&&De&&Ce&&!pe?r2.createPortal(Ce,De):null,d&&q.jsx(Rcn,{documentId:n.id,children:Ce&&!pe||S?q.jsxs(q.Fragment,{children:[pe?null:Ce,S?q.jsx(S,{documentId:n.id,active:s}):null]}):null})]})]})}const u_e=new Map;function Mcn(t,n){const s=Em();let c=u_e.get(t);(!c||c.project!==s)&&(c={project:s,count:0,created:n},u_e.set(t,c)),c.count++;const d=c;return()=>{u_e.get(t)!==d||--d.count>0||(u_e.delete(t),d.created&&Em()===d.project&&EN(t))}}function jcn({document:t,chrome:n=!0,active:s=!0,onReady:c}){const d=Yv(),[m,g]=Ye.useState(null),[S,k]=Ye.useState(null),A=JSON.stringify(t),F=Ye.useRef(c);F.current=c;const D=Ye.useRef(null);Ye.useSyncExternalStore(o2,K1,K1);const J=Ye.useSyncExternalStore(CBe,o$,o$);Ye.useEffect(()=>{let G=!1,se;const pe=Em(),ue=()=>!G&&Em()===pe,Ce=JSON.parse(A);return g(null),k(null),(async()=>{if(await Qze(),!ue())return;const De=new Set(l0().map(be=>be.descriptor.id)),Pe=Ce.kind==="asset"?sN(Ce.path,Ce.assetKind??"source",{activate:s}):Ce.kind==="workspace"?De.has(Ce.id)?Ce.id:null:await Yye(Ce.kind,d,{...Ce,activate:s});if(ue()){if(!Pe)throw new Error("The requested layout document is unavailable.");se=Mcn(Pe,!De.has(Pe)),g(Pe)}})().catch(De=>{ue()&&k(De instanceof Error?De.message:String(De))}),()=>{G=!0,se?.()}},[d,A]),Ye.useEffect(()=>{!m||!s||X0(m)},[m,s]),Ye.useEffect(()=>{if(!m)return;const G=s2(m);if(!(!G||D.current===G)){D.current=G;try{F.current?.({select(se){const pe=G.idsNamed?.(se)??[];if(pe.length!==1)throw new Error(`Expected one object named "${se}"; found ${pe.length}.`);G.selection?.apply(pe)},transform(se){G.setTransformMode?.(se)},frame(){G.frame("document")}})}catch(se){k(se instanceof Error?se.message:String(se))}}},[m,J]);const $=m?l0().find(G=>G.descriptor.id===m):void 0;return q.jsx("div",{style:{position:"relative",flex:1,minWidth:0,minHeight:0,height:"100%",overflow:"hidden"},children:S?q.jsx("div",{role:"alert",children:S}):$?q.jsx(VMt,{descriptor:$.descriptor,active:s,chrome:n}):q.jsx("div",{role:"status",children:"Opening document…"})})}function Lcn(){return q.jsxs(kee,{children:[q.jsx(Aee,{}),q.jsx(Pee,{}),q.jsx(Dee,{})]})}function Bcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot);const n=Ye.useSyncExternalStore(Hye,c$,c$),[s,c]=Ye.useState(!1),d=Ye.useSyncExternalStore(OC,cxt,cxt);if(Ye.useEffect(()=>{let g=!1;return Qze().then(()=>{g||c(!0)}),()=>{g=!0}},[]),!s)return q.jsx("div",{role:"status",children:d??"Loading project layout…"});const m=n.Layout??Lcn;return q.jsx(m,{playing:t.playState!=="stopped",paused:t.playState==="paused"})}function UVe({size:t=64}){return q.jsx("img",{src:lee()?.logo??mR.logo,width:t,height:t,alt:"","aria-hidden":"true","data-testid":"volter-logo",style:{display:"block"}})}const wje="account";function UMt(){return ND({id:wje,title:"Account",kind:"tool-contribution",workspaceRole:"workspace-task",provenance:{origin:"Volter account"},Content:Vcn,closeable:!0,presentation:()=>({kind:"workspace",id:wje})})}kN({id:"workspace",owner:"account-documents",open:(t,n)=>n.id===wje?UMt():null});function $cn(t){return t.source==="environment"?`Environment · ${t.environmentVariable}`:t.source==="system"?"Secure system storage":t.source==="session"?t.configured?"Session only":"Session storage":"Not configured"}function hB({children:t}){return q.jsxs("div",{className:"volter-account-infostrip",children:[q.jsx(dc,{icon:R$,className:"volter-account-infostrip-icon","aria-hidden":"true"}),q.jsx("span",{children:t})]})}function qcn({provider:t,busy:n,run:s,editing:c,removing:d,onEdit:m,onStopEditing:g,onRemoveIntent:S}){const[k,A]=Ye.useState("");return q.jsxs("div",{className:"volter-account-provider","data-configured":t.configured,children:[q.jsx("span",{className:"volter-account-provider-monogram","aria-hidden":"true",children:t.label.slice(0,1)}),q.jsxs("div",{className:"volter-account-provider-main",children:[q.jsxs("div",{className:"volter-account-provider-name",children:[q.jsx("strong",{children:t.label}),t.configured&&q.jsxs(q.Fragment,{children:[q.jsx("span",{className:"volter-account-provider-dot","aria-hidden":"true"}),q.jsx("span",{className:"volter-account-provider-key",children:t.maskedKey})]})]}),q.jsx("span",{className:"volter-account-provider-source",children:$cn(t)}),t.source==="session"&&t.configured&&q.jsx("span",{className:"volter-account-provider-warning",children:"No system credential manager is available. This key will be forgotten when the editor stops."}),t.problem&&q.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:t.problem}),t.source==="environment"&&q.jsxs("span",{className:"volter-account-provider-source",children:["Restart the editor after changing ",t.environmentVariable,"."]})]}),c?q.jsxs("form",{className:"volter-account-provider-form",onSubmit:F=>{F.preventDefault(),s(async()=>{await ywr(t.provider,k),A(""),g()},`${t.label} credential saved.`)},children:[q.jsxs("label",{className:"volter-field",children:[q.jsxs("span",{className:"volter-field-label",children:[t.label," API key"]}),q.jsx(Zm,{autoComplete:"off",autoFocus:!0,type:"password",value:k,onChange:F=>A(F.target.value)})]}),q.jsxs("div",{className:"volter-account-provider-form-actions",children:[q.jsx(Ms,{type:"submit",variant:"primary",disabled:n||k.trim()==="",children:"Save key"}),q.jsx(Ms,{type:"button",variant:"ghost",disabled:n,onClick:()=>{A(""),g()},children:"Cancel"})]})]}):q.jsxs("div",{className:"volter-account-provider-actions",children:[t.configured&&q.jsx(Ms,{size:"compact",disabled:n,onClick:()=>void s(()=>bwr(t.provider),`${t.label} credential is valid.`),children:"Test"}),t.editable&&q.jsx(Ms,{size:"compact",variant:t.configured?"ghost":"secondary",disabled:n,onClick:()=>{A(""),m()},children:t.configured?"Replace":"Add key"}),t.editable&&t.configured&&!d&&q.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(t.provider),children:"Remove"}),d&&q.jsxs(q.Fragment,{children:[q.jsx(Ms,{size:"compact",variant:"danger",disabled:n,onClick:()=>void s(async()=>{await vwr(t.provider),S(null)},`${t.label} credential removed.`),children:"Confirm remove"}),q.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(null),children:"Cancel"})]})]})]})}function xwt({busy:t,run:n}){const s=tBe(),[c,d]=Ye.useState(null),[m,g]=Ye.useState(null),S=s.providerCredentials.filter(k=>k.configured).length;return q.jsxs("section",{className:"volter-account-card volter-provider-connections",children:[q.jsxs("div",{className:"volter-account-providers-header",children:[q.jsxs("div",{children:[q.jsx("h3",{className:"volter-account-card-title",children:"Provider connections"}),q.jsx("p",{className:"volter-account-card-sub",children:"Keys live in this computer's credential manager — never in project files or the editor UI."})]}),q.jsxs("span",{className:"volter-status-dot","data-state":S>0?"on":"off",children:[S," connected"]})]}),q.jsx("div",{className:"volter-account-provider-list",children:s.providerCredentials.map(k=>q.jsx(qcn,{provider:k,busy:t,run:n,editing:c===k.provider,removing:m===k.provider,onEdit:()=>{g(null),d(k.provider)},onStopEditing:()=>d(null),onRemoveIntent:g},k.provider))})]})}function wwt({busy:t,run:n}){const s=tBe(),c=s.codingInference,[d,m]=Ye.useState(c.model),[g,S]=Ye.useState(null),[k,A]=Ye.useState(null);Ye.useEffect(()=>m(c.model),[c.model]),Ye.useEffect(()=>{S(null),A(null)},[d,s.preferredRoute]);const F=D=>n(()=>hwr({...c,...D,model:(D.model??c.model).trim()}),"Coding inference settings saved.");return q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Coding inference"}),q.jsxs("p",{className:"volter-account-card-sub",children:["Coding agents run on the login you already did — ",q.jsx("code",{children:"codex login"}),", Claude's device login, ",q.jsx("code",{children:"grok login"})," — and Volter Editor injects nothing into them. Turn this on only for a harness you have no subscription for: it routes that harness through OpenRouter on this account's managed credits or your own key, and it takes effect only while Preferred route above is Managed or BYOK. Existing sessions keep the route they launched with."]}),q.jsxs("label",{className:"volter-account-switch-row",children:[q.jsx(TD,{checked:c.enabled,disabled:t,onChange:D=>void F({enabled:D.target.checked})}),q.jsxs("span",{className:"volter-account-switch-copy",children:[q.jsx("strong",{children:"Use OpenRouter for coding agents"}),q.jsx("small",{children:"Codex, Claude Code, OpenCode and Pi are configured per spawned process. Grok takes no provider configuration and always runs on its own device login."})]})]}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Managed coding model"}),q.jsxs(Iw,{value:d,disabled:t,onChange:D=>{const J=D.target.value;m(J),J!==c.model&&F({model:J})},children:[!["z-ai/glm-5.2","moonshotai/kimi-k3"].includes(d)&&q.jsxs("option",{value:d,children:[d," · custom"]}),q.jsx("option",{value:"z-ai/glm-5.2",children:"GLM-5.2 · managed default"}),q.jsx("option",{value:"moonshotai/kimi-k3",children:"Kimi K3 · higher-cost option"})]})]}),s.preferredRoute==="managed"?q.jsxs("div",{className:"volter-account-card-footer",children:[q.jsx(Ms,{size:"compact",disabled:t,onClick:()=>{A(null),gwr({model:d,promptTokens:1e5,outputTokens:2e4}).then(S).catch(D=>A(D instanceof Error?D.message:String(D)))},children:"Preflight typical coding session"}),g&&q.jsxs("span",{className:"volter-account-help",children:["Estimate: ",g.estimatedCredits.toLocaleString()," Volter credits ($",g.providerAmountUsd.toFixed(4)," provider cost) for 100k input + 20k output tokens."]}),k&&q.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:k})]}):s.preferredRoute==="byok"?q.jsx(hB,{children:"BYOK coding charges OpenRouter directly and consumes zero Volter credits."}):null,q.jsxs(hB,{children:["Active account route: ",s.preferredRoute,". BYOK requires the OpenRouter connection below; managed uses the Volter balance."]})]})}function zcn({plan:t}){const n=t.status.replace("_"," "),s=t.status==="active"||n.toLowerCase()===t.name.trim().toLowerCase();return q.jsxs("span",{className:"volter-account-plan-chips",children:[q.jsxs("span",{className:"volter-chip","data-tone":"accent",children:[t.name," plan"]}),!s&&q.jsx("span",{className:"volter-chip","data-tone":t.status==="cancelling"?"warn":void 0,children:n}),(t.renewsAt||t.endsAt)&&q.jsxs("span",{className:"volter-chip",children:[t.endsAt?"Access ends":"Renews"," ",new Date(t.endsAt??t.renewsAt).toLocaleDateString()]})]})}function Vcn(){Ye.useSyncExternalStore(Dye,cN,cN);const t=tBe(),[n,s]=Ye.useState("builder@example.test"),[c,d]=Ye.useState([]),[m,g]=Ye.useState(null),[S,k]=Ye.useState("creator"),[A,F]=Ye.useState(""),[D,J]=Ye.useState(!1),[$,G]=Ye.useState(null),[se,pe]=Ye.useState(null),[ue,Ce]=Ye.useState(null),[De,Pe]=Ye.useState(!1);Ye.useEffect(()=>{if(t.authenticated||t.backend!=="live"||t.accountEnvironment==="development-twin"){Pe(!1);return}Ewr().then(zt=>Pe(zt.device)).catch(()=>Pe(!1))},[t.authenticated,t.backend]),Ye.useEffect(()=>{if(!ue)return;const zt=()=>{Awr(ue.authorizationId).then(tr=>{tr&&Ce(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),Ce(null)})};zt();const ft=window.setInterval(zt,1e3);return()=>window.clearInterval(ft)},[ue]),Ye.useEffect(()=>{if(!se)return;const zt=()=>{Pwr(se.deviceCode).then(tr=>{tr&&pe(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),pe(null)})},ft=window.setInterval(zt,Math.max(1,se.intervalSeconds)*1e3);return()=>window.clearInterval(ft)},[se]),Ye.useEffect(()=>{if(!t.authenticated){d([]);return}wwr().then(d).catch(()=>d([]))},[t.authenticated,t.authenticated?t.user.id:"signed-out",t.authenticated?t.credits.used:0]),Ye.useEffect(()=>{if(!t.authenticated){g(null);return}Twr().then(zt=>{g(zt);const ft=["creator","max","ultra"].find(tr=>tr!==t.plan.id);k(ft??"creator"),F(Object.keys(zt.creditPacks)[0]??"")}).catch(()=>g(null))},[t.authenticated,t.authenticated?t.user.id:"signed-out"]);const be=async(zt,ft)=>{J(!0),G(null);try{await zt(),ft&&G(ft)}catch(tr){G(tr instanceof Error?tr.message:String(tr))}finally{J(!1)}};if(!t.authenticated)return q.jsx("div",{className:"volter-account","data-testid":"account-document",children:q.jsxs("div",{className:"volter-account-signin-stack",children:[q.jsxs("div",{className:"volter-account-signin-hero",children:[q.jsx("span",{className:"volter-account-signin-mark","aria-hidden":"true",children:q.jsx(UVe,{size:52})}),q.jsx("h1",{className:"volter-account-signin-title",children:"Sign in to Volter Editor"})]}),t.accountEnvironment==="development-twin"?q.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>fwr(n),"Signed in through the local Clerk Twin.")},children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Development email"}),q.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),q.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use Clerk Twin account"}),q.jsx(hB,{children:"Local Clerk and Polar twins — fake identity and checkout, with the real Volter account and credit boundaries."})]}):t.backend==="live"?q.jsxs("section",{className:"volter-account-card volter-account-signin-card",children:[q.jsx(Ms,{variant:"primary",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await kwr();Ce(zt),window.open(zt.authorizationUrl,"_blank","noopener,noreferrer")}),children:ue?"Waiting for browser sign-in…":"Continue in browser"}),De&&q.jsx(Ms,{variant:"ghost",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await Dwr();pe(zt),window.open(zt.verificationUri,"_blank","noopener,noreferrer")}),children:"Use a device code instead"}),se&&q.jsxs("div",{className:"volter-account-device-code",children:[q.jsx("strong",{children:se.userCode}),q.jsx("span",{children:"Complete authorization in the browser. This editor polls without receiving your password."})]}),q.jsx(hB,{children:"Authorization happens in your browser — this editor never sees your password."})]}):q.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>uwr(n),"Signed in to the zero-charge local account.")},children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Email"}),q.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),q.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use local mock account"}),q.jsx(hB,{children:"Local mock — no payment, network identity, or provider request."})]}),q.jsxs("ul",{className:"volter-account-signin-points",children:[q.jsx("li",{children:"Every paid generation shows its route and estimate first"}),q.jsx("li",{children:"Spend controls and hard limits are on by default"}),q.jsx("li",{children:"Provider keys stay in your system credential manager"})]}),q.jsx(wwt,{busy:D,run:be}),q.jsx(xwt,{busy:D,run:be}),($||wpe())&&q.jsx("div",{className:"volter-account-status",role:"status",children:$??wpe()})]})});const X=t.credits.included+t.credits.purchased,we=X===0?0:Math.min(100,t.credits.used/X*100),qe=X===0?0:Math.max(0,Math.min(100-we,t.credits.reserved/X*100)),bt=X>0&&t.credits.used>X,Pt=t.backend==="mock"||t.entitlements.generation,Wt=zt=>pwr({...t.spendPolicy,...zt});return q.jsxs("div",{className:"volter-account","data-testid":"account-document",children:[q.jsx("h1",{className:"volter-sr-only",children:"Account"}),q.jsxs("div",{className:"volter-account-stack",children:[q.jsxs("header",{className:"volter-account-identity",children:[q.jsx("span",{className:"volter-account-avatar","aria-hidden":"true",children:t.user.email.slice(0,1)}),q.jsxs("div",{className:"volter-account-identity-main",children:[q.jsxs("div",{className:"volter-account-identity-row",children:[q.jsx("h2",{className:"volter-account-identity-email",children:t.user.email}),q.jsx(zcn,{plan:t.plan})]}),q.jsx("p",{className:"volter-account-identity-note",children:t.accountEnvironment==="development-twin"?"Clerk + Polar Twin development account":t.backend==="mock"?"Isolated test account":"Volter account"})]}),q.jsx(Ms,{variant:"ghost",className:"volter-account-signout",disabled:D,onClick:()=>void be(dwr),children:"Sign out"})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsxs("div",{className:"volter-account-card-head",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Credits"}),t.plan.id!=="free"&&t.plan.status==="cancelling"&&q.jsx(Ms,{size:"compact",disabled:D,onClick:()=>void be(()=>fht("resume")),children:"Resume subscription"})]}),!Pt&&q.jsx(hB,{children:"This account has not been admitted to Volter managed services. Signing up or paying does not grant provider access; contact the Volter team for admission."}),m&&q.jsxs("div",{className:"volter-account-card-footer",children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Subscription tier"}),q.jsx(Iw,{value:S,disabled:D||!Pt,onChange:zt=>k(zt.target.value),children:Object.keys(m.plans).map(zt=>{const ft=m.plans[zt],tr=ft.monthlyPriceUsd;return q.jsxs("option",{value:zt,disabled:zt==="free",children:[ft.name,tr!==void 0?` · $${tr}/month`:""," ·"," ",ft.includedCredits.toLocaleString()," credits",zt===t.plan.id?" · current":""]},zt)})})]}),q.jsxs(Ms,{variant:"primary",size:"compact",disabled:D||!Pt||S===t.plan.id||S==="free",onClick:()=>void be(async()=>{const zt=await Swr(S);zt.checkoutUrl?window.open(zt.checkoutUrl,"_blank","noopener,noreferrer"):G(zt.mock?`Mock ${m.plans[S].name} upgrade completed. No payment occurred.`:`Subscription changed to ${m.plans[S].name}.`)}),children:["Choose ",m.plans[S].name]})]}),q.jsxs("div",{className:"volter-account-credit-figure",children:[q.jsx("span",{className:"volter-account-credit-number",children:t.credits.remaining.toLocaleString()}),q.jsx("span",{className:"volter-account-credit-unit",children:"credits remaining"})]}),q.jsxs("div",{className:"volter-meter",role:"progressbar","aria-label":"Credits used","aria-valuenow":Math.round(we),"aria-valuemin":0,"aria-valuemax":100,"data-state":bt?"over":void 0,children:[q.jsx("span",{className:"volter-meter-fill",style:{width:`${we}%`}}),qe>0&&q.jsx("span",{className:"volter-meter-fill","data-part":"reserved",style:{left:`${we}%`,width:`${qe}%`}})]}),q.jsxs("p",{className:"volter-account-cycle-line",children:[t.credits.used.toLocaleString()," of ",X.toLocaleString()," used this cycle",t.credits.resetsAt&&q.jsxs(q.Fragment,{children:[" · resets ",new Date(t.credits.resetsAt).toLocaleDateString()]}),bt&&q.jsx("span",{className:"volter-account-cycle-over",children:" · over allowance"})]}),q.jsxs("div",{className:"volter-account-legend","data-state":bt?"over":void 0,children:[q.jsxs("span",{className:"volter-account-legend-item","data-part":"included",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.included.toLocaleString()," included"]}),q.jsxs("span",{className:"volter-account-legend-item","data-part":"used",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.used.toLocaleString()," used"]}),q.jsxs("span",{className:"volter-account-legend-item","data-part":"reserved",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.reserved.toLocaleString()," reserved"]}),q.jsxs("span",{className:"volter-account-legend-item","data-part":"purchased",children:[q.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.purchased.toLocaleString()," purchased"]})]}),t.credits.purchasedExpiresAt&&q.jsxs("p",{className:"volter-account-help volter-account-expiry",children:["Purchased credits expire"," ",new Date(t.credits.purchasedExpiresAt).toLocaleDateString(),"."]}),q.jsxs("div",{className:"volter-account-card-footer",children:[m&&A&&m.creditPacks[A]&&q.jsxs(q.Fragment,{children:[q.jsx(Iw,{"aria-label":"Credit pack",value:A,disabled:D||!Pt,onChange:zt=>F(zt.target.value),children:Object.entries(m.creditPacks).map(([zt,ft])=>q.jsxs("option",{value:zt,children:[ft.name," · ",ft.credits.toLocaleString()," credits"]},zt))}),q.jsx(Ms,{size:"compact",disabled:D||!Pt,onClick:()=>void be(async()=>{const zt=m.creditPacks[A],ft=await xwr(A);ft.checkoutUrl?window.open(ft.checkoutUrl,"_blank","noopener,noreferrer"):G(`Added ${zt?.credits.toLocaleString()??""} mock credits. No payment occurred.`)}),children:"Buy credits"})]}),q.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(async()=>{const zt=await Cwr();zt.mock?G("Mock billing portal: no payment page was opened."):window.open(zt.url,"_blank","noopener,noreferrer")}),children:"Billing and invoices"}),t.plan.id!=="free"&&t.plan.status==="active"&&q.jsx(Ms,{size:"compact",variant:"ghost",className:"volter-account-quiet-danger",disabled:D,onClick:()=>void be(()=>fht("cancel")),children:"Cancel at renewal"})]})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Generation routing"}),q.jsx("p",{className:"volter-account-card-sub",children:"Billing preference for AI usage. Provider libraries apply it automatically; requests show the resolved account and cost before submission."}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Preferred route"}),q.jsxs(Iw,{value:t.preferredRoute,onChange:zt=>void be(()=>mwr(zt.target.value)),children:[t.accountEnvironment==="test-mock"&&q.jsx("option",{value:"mock",children:"Mock · free and local"}),q.jsx("option",{value:"auto",children:"Automatic · saved key or Volter account"}),q.jsxs("option",{value:"managed",disabled:!t.routes.managed,children:["Managed · Volter credits",t.routes.managed?"":" (unavailable)"]}),q.jsxs("option",{value:"byok",disabled:!t.routes.byok,children:["BYOK · provider dollars",t.routes.byok?"":" (no key found)"]})]})]})]}),q.jsx(wwt,{busy:D,run:be}),q.jsx(xwt,{busy:D,run:be}),(t.alerts?.length??0)>0&&q.jsxs("section",{className:"volter-account-card",children:[q.jsxs("div",{className:"volter-account-card-head",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Account alerts"}),t.alerts?.some(zt=>!zt.readAt)&&q.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(_wr),children:"Mark read"})]}),q.jsx("div",{className:"volter-account-usage",children:t.alerts?.map(zt=>q.jsxs("div",{className:"volter-account-usage-row",children:[q.jsxs("span",{children:[q.jsx("strong",{children:zt.readAt?"Notice":"New"}),q.jsx("small",{children:zt.message})]}),q.jsx("span",{children:new Date(zt.createdAt).toLocaleDateString()})]},zt.id))})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Spend controls"}),q.jsxs("p",{className:"volter-account-card-sub",children:["Alerts at ",t.spendPolicy.alertThresholds.join("%, "),"% of the available allowance."]}),q.jsxs("label",{className:"volter-account-switch-row",children:[q.jsx(TD,{checked:t.spendPolicy.overageEnabled,onChange:zt=>void be(()=>Wt({overageEnabled:zt.target.checked,monthlyLimitCredits:zt.target.checked&&t.spendPolicy.monthlyLimitCredits===0?1e3:t.spendPolicy.monthlyLimitCredits}))}),q.jsxs("span",{className:"volter-account-switch-copy",children:[q.jsx("strong",{children:"Allow paid overage"}),q.jsx("small",{children:"Off by default. Managed requests stop before provider submission."})]})]}),q.jsx("div",{className:"volter-account-limit-field",children:q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Monthly overage hard limit"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.monthlyLimitCredits,disabled:!t.spendPolicy.overageEnabled,onBlur:zt=>void be(()=>Wt({monthlyLimitCredits:Number(zt.target.value)}))},t.spendPolicy.monthlyLimitCredits),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})}),q.jsxs("label",{className:"volter-account-switch-row",children:[q.jsx(TD,{checked:t.spendPolicy.autoReload?.enabled===!0,onChange:zt=>void be(()=>Wt({autoReload:{enabled:zt.target.checked,whenRemainingBelow:t.spendPolicy.autoReload?.whenRemainingBelow??100,reloadTo:t.spendPolicy.autoReload?.reloadTo??500,monthlyLimitCredits:t.spendPolicy.autoReload?.monthlyLimitCredits??2e3}}))}),q.jsxs("span",{className:"volter-account-switch-copy",children:[q.jsx("strong",{children:"Automatically reload credits"}),q.jsx("small",{children:"Optional, independently capped, and never enabled by checkout."})]})]}),t.spendPolicy.autoReload?.enabled&&q.jsxs("div",{className:"volter-account-policy-fields",children:[q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Reload below"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.whenRemainingBelow,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,whenRemainingBelow:Number(zt.target.value)}}))},t.spendPolicy.autoReload.whenRemainingBelow),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Reload balance to"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:1,defaultValue:t.spendPolicy.autoReload.reloadTo,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,reloadTo:Number(zt.target.value)}}))},t.spendPolicy.autoReload.reloadTo),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),q.jsxs("label",{className:"volter-field",children:[q.jsx("span",{className:"volter-field-label",children:"Monthly reload cap"}),q.jsxs("span",{className:"volter-account-input-suffix",children:[q.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.monthlyLimitCredits,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,monthlyLimitCredits:Number(zt.target.value)}}))},t.spendPolicy.autoReload.monthlyLimitCredits),q.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})]})]}),q.jsxs("section",{className:"volter-account-card",children:[q.jsx("h3",{className:"volter-account-card-title",children:"Current-cycle usage"}),c.length===0?q.jsx("p",{className:"volter-account-help",children:"No managed credit usage has been settled in this account."}):q.jsx("div",{className:"volter-account-usage",children:c.map(zt=>q.jsxs("div",{className:"volter-account-usage-row",children:[q.jsxs("span",{children:[zt.kind," · ",zt.provider," · ",zt.operation??"managed operation"]}),q.jsxs("strong",{children:[zt.credits.toLocaleString()," credits"]})]},zt.id))})]}),($||wpe())&&q.jsx("div",{className:"volter-account-status",role:"status",children:$??wpe()})]})]})}function Ucn(t,n,s){const d=navigator.platform.includes("Mac")?"⌘":"Ctrl+",m=Y0(t),g=[...t.selectedEntityIds],S=g[0],k=S?m.hierarchy.node(S)?.parentId??null:null,A=g.length>0&&!!m.structure?.copy&&(m.structure.canCopy?.(g)??!0),F=A&&!!m.structure?.cut,D=!!m.structure?.paste&&(m.structure.canPaste?.(k)??!0),J=[...F?[{id:"editor.cut",label:"Cut",category:"action",shortcut:Vv("edit.cut"),execute:()=>$Ve(t)}]:[],...A?[{id:"editor.copy",label:"Copy",category:"action",shortcut:Vv("edit.copy"),execute:()=>BVe(t)}]:[],...D?[{id:"editor.paste",label:"Paste",category:"action",shortcut:Vv("edit.paste"),execute:()=>qVe(t)}]:[]];return[{id:"account.open",label:"Account and Provider Connections",category:"action",execute:()=>{UMt()}},{id:"editor.undo",label:s?.undoLabel?`Undo ${s.undoLabel}`:"Undo",category:"action",shortcut:Vv("edit.undo"),execute:async()=>{await n.undo()}},{id:"editor.redo",label:s?.redoLabel?`Redo ${s.redoLabel}`:"Redo",category:"action",shortcut:Vv("edit.redo"),execute:async()=>{await n.redo()}},...J,{id:"editor.duplicate",label:"Duplicate",category:"action",shortcut:Vv("edit.duplicate"),execute:()=>bve(t)},{id:"editor.delete",label:"Delete Selected",category:"action",shortcut:Vv("edit.delete"),execute:()=>Sve(t)},{id:"editor.select-all",label:"Select All",category:"action",shortcut:Vv("edit.selectAll"),execute:()=>NRt(t)},{id:"editor.deselect",label:"Deselect All",category:"action",shortcut:Vv("edit.deselectAll")??Vv("edit.exitScopeOrDeselect"),execute:()=>Mze(t,[])},{id:"toggle.console",label:"Toggle Console",category:"action",shortcut:Vv("view.toggleConsole"),execute:()=>{pve()}},{id:"view.focusMode",label:"Toggle Focus Mode",category:"action",shortcut:Vv("view.focusMode"),execute:()=>{qBe()}},...AN().map($=>({id:`workspace.${$.id}`,label:`Workspace: ${$.title}`,category:"action",execute:()=>{Uk($.id)&&a2($.id)}})),{id:"workspace.cycleNext",label:"Next Workspace",category:"action",shortcut:Vv("workspace.cycleNext"),execute:()=>{Che(1)}},{id:"workspace.cyclePrevious",label:"Previous Workspace",category:"action",shortcut:Vv("workspace.cyclePrevious"),execute:()=>{Che(-1)}},...Y4t().map($=>({id:`keymap.${$.id}`,label:`Keymap: ${$.title}`,category:"action",execute:()=>{HEr($.id)}})),...OR().map($=>({id:`view.workspaceStyle.${$.id}`,label:`Workspace Style: ${$.title}`,category:"action",execute:()=>{ZBe($.id)}})),{id:"view.undoHistory",label:"Undo History",category:"action",execute:()=>{zVe()}},{id:"view.lightExplorer",label:"Open Light Explorer",category:"action",execute:()=>vC(nee.lightExplorer.id)},...Object.values(O_).filter($=>$.id!==O_.open.id).map($=>({id:$.id,label:`${$.id.replace("project-asset.","").split("-").map(G=>G[0]?.toUpperCase()+G.slice(1)).join(" ")} Project Asset`,category:"asset",...$.shortcut?{shortcut:$.shortcut.replace("Mod",d)}:{},execute:()=>{window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:$.id}}))}})),{id:"view.asset-library",label:"Asset Library",category:"action",execute:()=>{$Be("asset-library")}}]}function Jcn(t){return Y0e(t).filter(n=>n.id!==NFe).map(n=>({id:`entity:${n.id}`,label:n.name,category:"entity",execute:()=>{Mze(t,[n.id]),LVe("viewport.frameSelection")}}))}function Wcn(){return ive().filter(t=>t.category==="canvas").map(({descriptor:t})=>({id:`board:${t.id}`,label:`Open ${t.title}`,category:"action",execute:()=>void SN(t.id)}))}function aN(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Yge(t){const n=t.type;if(typeof n=="string")return n;if(Array.isArray(n))return n.find(s=>s!=="null")}function JMt(t){const n=aN(t);if("default"in n)return structuredClone(n.default);const s=Yge(n);if(s==="object"||n.properties){const c={};for(const[d,m]of Object.entries(aN(n.properties))){const g=aN(m);("default"in g||Array.isArray(n.required)&&n.required.includes(d))&&(c[d]=JMt(g))}return c}return s==="array"?[]:s==="boolean"?!1:s==="number"||s==="integer"?Number(n.minimum??0):""}function Tje(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase())}function Hcn({name:t,schema:n,value:s,required:c,onChange:d}){const m=Yge(n),g=typeof n.description=="string"?n.description:null,S=Array.isArray(n.enum)?n.enum:null,k=`tool-field:${t}`;if(m==="boolean")return q.jsxs("label",{style:{...VY,gridTemplateColumns:"18px minmax(0, 1fr)"},children:[q.jsx(TD,{id:k,checked:s===!0,onChange:F=>d(F.target.checked)}),q.jsxs("span",{children:[q.jsx("span",{style:Twt,children:Tje(t)}),g&&q.jsx("span",{style:FO,children:g})]})]});const A=q.jsxs("span",{style:Twt,children:[Tje(t)," ",!c&&q.jsx("span",{style:Kcn,children:"optional"})]});return S?q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsxs(Iw,{id:k,value:String(s??""),onChange:F=>d(F.target.value),style:f_e,children:[!c&&q.jsx("option",{value:"",children:"Not set"}),S.map(F=>q.jsx("option",{value:String(F),children:String(F)},String(F)))]}),g&&q.jsx("span",{style:FO,children:g})]}):m==="number"||m==="integer"?q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsx(Zm,{id:k,type:"number",value:typeof s=="number"?s:"",min:typeof n.minimum=="number"?n.minimum:void 0,max:typeof n.maximum=="number"?n.maximum:void 0,step:m==="integer"?1:"any",onChange:F=>d(F.target.value===""?void 0:Number(F.target.value)),style:f_e}),g&&q.jsx("span",{style:FO,children:g})]}):m==="array"&&Yge(aN(n.items))==="string"?q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsx(Zm,{id:k,value:Array.isArray(s)?s.join(", "):"",onChange:F=>d(F.target.value.split(",").map(D=>D.trim()).filter(Boolean)),placeholder:"Comma-separated values",style:f_e}),g&&q.jsx("span",{style:FO,children:g})]}):q.jsxs("label",{style:VY,htmlFor:k,children:[A,q.jsx(Zm,{id:k,value:typeof s=="string"?s:"",onChange:F=>d(F.target.value||(c?"":void 0)),style:f_e}),g&&q.jsx("span",{style:FO,children:g})]})}function WMt({schema:t,value:n,onChange:s,path:c=""}){const d=aN(t.properties),m=new Set(Array.isArray(t.required)?t.required:[]);return q.jsx("div",{style:{display:"grid",gap:14},children:Object.entries(d).map(([g,S])=>{const k=aN(S),A=Yge(k),F=D=>{const J={...n};D===void 0?delete J[g]:J[g]=D,s(J)};return A==="object"||k.properties?q.jsxs("fieldset",{style:Xcn,children:[q.jsx("legend",{style:Ycn,children:Tje(g)}),typeof k.description=="string"&&q.jsx("p",{style:{...FO,marginTop:0},children:k.description}),q.jsx(WMt,{schema:k,value:aN(n[g]),onChange:F,path:c?`${c}.${g}`:g})]},g):q.jsx(Hcn,{name:c?`${c}.${g}`:g,schema:k,value:n[g],required:m.has(g),onChange:F},g)})})}function Gcn({schema:t,value:n,onChange:s}){const c=aN(t);return c.properties?q.jsx(WMt,{schema:c,value:n,onChange:s}):q.jsx("div",{style:FO,children:"This schema has no form-compatible fields."})}const VY={display:"grid",gap:5},Twt={color:Zf[1],fontWeight:600,fontSize:"var(--volter-font-sm)"},Kcn={color:Zf[3],fontWeight:400,marginLeft:5},FO={display:"block",color:Zf[2],fontSize:"var(--volter-font-sm)",lineHeight:1.4},f_e={boxSizing:"border-box",width:"100%"},Xcn={margin:0,padding:14,border:"1px solid var(--volter-boundary-default)",borderRadius:"var(--volter-radius-md)"},Ycn={padding:"0 6px",color:Zf[1],fontWeight:600},Zge="project-tools",Cje="project-tool:";function Zcn(t){return`${Cje}${t}`}function wve(){ND({id:Zge,title:"Project Tools",kind:"project-tool",workspaceRole:"workspace-reference",Content:HMt,closeable:!0,presentation:()=>({kind:"workspace",id:Zge}),persist:()=>({catalog:!0})})}function Tve(t){const n=N$().tools.find(c=>c.name===t);if(!n)return!1;const s=kC().filter(c=>c.tool?.name===t);return s.length===1?tA(s[0].id):(ND({id:Zcn(t),title:n.summary||n.name,kind:"project-tool",workspaceRole:"workspace-reference",provenance:{sourcePath:n.sourcePath,origin:n.name},Content:HMt,closeable:!0,presentation:()=>({kind:"project-tool",name:t}),persist:()=>({name:t})}),!0)}kN({id:"workspace",owner:"project-tool-documents",open:(t,n)=>n.id!==Zge?null:(wve(),Zge)});kN({id:"project-tool",owner:"project-tool-documents",open:(t,n)=>Tve(n.name)?Pp():null,settle:async t=>{if(await WZ().catch(()=>{}),!await CC(()=>N$().tools.some(n=>n.name===t.name)))throw new Error(`Project tool is not registered: ${t.name}`)}});wee({kind:"project-tool",owner:"project-tool-documents",prepare:()=>WZ().then(()=>{},()=>{}),restore:({state:t})=>{const n=t;return n?.catalog===!0?(wve(),!0):typeof n?.name=="string"&&Tve(n.name)}});function Qcn(){return[{id:"project-tools:open",label:"Open Project Tools",category:"action",execute:()=>wve()},...N$().tools.map(t=>({id:`project-tool:${t.name}`,label:`Run: ${t.summary||t.name}`,category:"action",execute:()=>void Tve(t.name)}))]}function Cwt({value:t}){return q.jsx("pre",{style:nln,children:JSON.stringify(t,null,2)})}function HMt({documentId:t}){Ye.useSyncExternalStore(aMt,ean),Ye.useSyncExternalStore(u2,rA);const n=N$(),s=t.startsWith(Cje)?t.slice(Cje.length):null,c=s?n.tools.find(d=>d.name===s):null;return s?c?q.jsx(eln,{tool:c},c.name):q.jsx("div",{style:Eje,children:"This tool is no longer available."}):q.jsxs("div",{style:Eje,"data-testid":"project-tools-catalog",children:[q.jsx("h2",{style:GMt,children:"Project Tools"}),q.jsxs("p",{style:{...kje,margin:"0 0 18px",maxWidth:720,lineHeight:1.5},children:["Explicitly registered in ",q.jsx("code",{children:"package.json#volter.tools"}),". Each tool is an ordinary project function; a registration may pair it with optional editor contributions."]}),q.jsx("div",{style:{display:"grid",gap:8},children:n.tools.map(d=>q.jsxs(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>Tve(d.name),"data-testid":`project-command-card:${d.name}`,children:[q.jsxs("span",{style:KMt,children:[q.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:d.summary}),q.jsx("span",{style:XMt,children:"Open"})]}),q.jsx("code",{style:{color:Zf[2],fontSize:"var(--volter-font-sm)"},children:d.name}),q.jsx("span",{style:tln,children:q.jsxs("span",{children:[d.host," · ",d.permission.risk," · ",d.sourcePath]})})]},d.name))}),n.tools.length===0&&n.loadErrors.length===0&&q.jsx("div",{style:kje,children:"No project tools registered."}),n.loadErrors.map(d=>q.jsxs("div",{style:Qge,children:[d.sourcePath,": ",d.message]},`${d.sourcePath}:${d.message}`)),o$e().map(d=>q.jsxs("div",{style:Qge,children:[d.entryPath,": ",d.error]},`${d.entryPath}:${d.error}`))]})}function eln({tool:t}){const n=kC().filter(se=>se.tool?.name===t.name),s=JMt(t.inputSchema),[c,d]=Ye.useState(s&&typeof s=="object"&&!Array.isArray(s)?s:{}),[m,g]=Ye.useState(()=>JSON.stringify(c,null,2)),[S,k]=Ye.useState(null),[A,F]=Ye.useState(!1),[D,J]=Ye.useState(null),$=t.host==="node",G=async()=>{if(t.permission.risk==="read"||window.confirm(`${t.permission.summary}
1398
1398
 
1399
- Run ${t.name}?`)){F(!0);try{k(await tan(t.name,c,{confirm:!0}))}catch(pe){k({ok:!1,error:{code:"REQUEST_FAILED",message:String(pe)}})}finally{F(!1)}}};return q.jsxs("div",{style:Eje,"data-testid":`project-tool:${t.name}`,children:[q.jsx("h2",{style:GMt,children:t.summary}),q.jsx("code",{style:{color:Zf[2]},children:t.name}),q.jsx("p",{style:{color:Zf[2]},children:t.description}),q.jsxs("div",{style:kje,children:[t.host," · ",t.permission.risk," · ",t.sourcePath]}),n.length>0&&q.jsxs("section",{style:{marginTop:18,maxWidth:760},children:[q.jsx("h3",{style:{margin:"0 0 8px",fontSize:13},children:"Presentations"}),q.jsx("div",{style:{display:"grid",gap:8},children:n.map(se=>q.jsx(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>tA(se.id),children:q.jsxs("span",{style:KMt,children:[q.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:se.title}),q.jsx("span",{style:XMt,children:"Open"})]})},se.id))})]}),!$&&q.jsx("div",{style:Qge,children:"This runner supports Node-hosted tools. Import the underlying function directly in browser or runtime code."}),q.jsxs("details",{open:n.length===0,style:{marginTop:18,maxWidth:760},children:[q.jsx("summary",{style:{cursor:"pointer",color:Zf[2],fontSize:12},children:n.length>0?"Advanced · invoke native schema":"Input"}),q.jsx("section",{style:{marginTop:12},children:q.jsx(Gcn,{schema:t.inputSchema,value:c,onChange:se=>{d(se),g(JSON.stringify(se,null,2)),J(null)}})}),D&&q.jsx("div",{style:Qge,children:D}),q.jsx(Ms,{variant:"primary",disabled:!$||A||D!==null,"aria-busy":A,onClick:()=>void G(),style:{marginTop:16},children:A?"Running…":"Run tool"}),q.jsxs("details",{style:{marginTop:16},children:[q.jsx("summary",{style:EOe,children:"Advanced JSON"}),q.jsx(wBe,{id:`tool-input:${t.name}`,value:m,onChange:se=>{const pe=se.target.value;g(pe);try{const ue=JSON.parse(pe);if(!ue||typeof ue!="object"||Array.isArray(ue))throw new Error("Input must be a JSON object.");d(ue),J(null)}catch(ue){J(ue instanceof Error?ue.message:String(ue))}},rows:10,"data-variant":"code",style:rln}),q.jsxs("details",{children:[q.jsx("summary",{style:EOe,children:"Input schema"}),q.jsx(Cwt,{value:t.inputSchema})]})]})]}),S!==null&&q.jsxs("section",{children:[q.jsx("div",{style:EOe,children:"Result"}),q.jsx(Cwt,{value:S})]})]})}const Eje={width:"100%",maxWidth:960,margin:"0 auto",padding:24,boxSizing:"border-box",overflow:"auto",pointerEvents:"auto",color:Zf[1],fontSize:"var(--volter-font-base)"},GMt={margin:"0 0 6px",fontSize:20},kje={color:Zf[2],fontSize:"var(--volter-font-sm)"},EOe={display:"block",margin:"14px 0 6px",color:Zf[1]},KMt={display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",gap:12},XMt={color:Zf[2],fontSize:"var(--volter-font-sm)",fontWeight:500},tln={display:"flex",width:"100%",minWidth:0,alignItems:"center",justifyContent:"space-between",gap:12,color:Zf[2],fontSize:"var(--volter-font-sm)"},Qge={marginTop:10,color:C_e,whiteSpace:"pre-wrap"},rln={width:"100%",boxSizing:"border-box",resize:"vertical"},nln={overflow:"auto",padding:10,background:SBe.inset,border:`1px solid ${ahe[1]}`,borderRadius:sQ.sm,color:Zf[2]};function iln(t,n,s){const c=Ucn(t,n,s),d=[...Qcn(),...Wcn(),...xkr()],m=Jcn(t),g=_Ct().map(S=>({id:S.id,label:S.label,category:"action",shortcut:S.shortcut?Vv(S.shortcut):void 0,execute:S.execute}));return[...c,...d,...g,...aln(),...m]}const oln=["view","window","debug","tools","help"],sln={view:"View",window:"Window",debug:"Debug",tools:"Tools",help:"Help"};function aln(){return oln.flatMap(t=>jme(t).map(n=>{const s=typeof n.label=="function"?n.label():n.label,c=`${sln[t]}: ${s}`;return{id:n.id,label:c,category:"action",menu:{id:t,label:s},execute:()=>{if(n.disabled?.({})){i0(`${c} is not available right now.`);return}return n.execute({})}}}))}function cln(t){return t.map(n=>`${n.id}\0${n.label}\0${n.menu?.id??""}`).join("")}function lln(){const t=Yv(),n=mve(),s=Q9t(),c=Ye.useSyncExternalStore(mLe,YB,YB),d=Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),m=Ye.useSyncExternalStore(IDt,Phe,Phe),g=Ye.useSyncExternalStore(Kye,mhe,mhe),S=Ye.useMemo(()=>iln(t,n,s),[t,n,s,c,d,m,g]),k=Ye.useRef(null);return Ye.useEffect(()=>{const A=cln(S);A!==k.current&&(k.current=A,Dxt(S.map(F=>({id:F.id,label:F.label,category:F.category,run:F.execute,...F.menu?{menu:F.menu}:{}}))))},[S]),Ye.useEffect(()=>()=>{k.current=null,Dxt([])},[]),null}let YMt=[];const Aje=new Set;function uln(t){return Aje.add(t),()=>Aje.delete(t)}function fln(){return YMt}function dln(){for(const t of Aje)t()}function pln(t){return`Starter asset "${t.key}" (pack "${t.pack}") did not materialize into ${t.dest}: ${t.reason} Nothing was written for it — features that read that file degrade (a missing clips GLB leaves the character standing without locomotion clips). Use Retry once the cause is fixed.`}function _ln(t){const n=t.failed.map(s=>({key:s.entry.key,dest:s.entry.dest,pack:s.entry.pack,reason:s.reason}));for(const s of n)Qs.error(pln(s),"assets");YMt=n,dln()}async function mln(t){try{const{materializeDeclaredAssetPacks:n}=await lo(async()=>{const{materializeDeclaredAssetPacks:c}=await import("./hosted-asset-materialization-s3VISszg.js");return{materializeDeclaredAssetPacks:c}},__vite__mapDeps([264,104,3,2,4,1,20,21,22,23])),s=await n(t);_ln(s)}catch(n){Qs.error(`Retrying asset materialization failed before any entry was attempted: ${n instanceof Error?n.message:String(n)}`,"assets")}}let ZMt={kind:"quiet"},QMt=0;const Dje=new Set;function hln(){return ZMt}function gln(t){ZMt=t,QMt+=1;for(const n of Dje)n()}function yln(t){return Dje.add(t),()=>Dje.delete(t)}function Ewt(){return QMt}const vln=()=>()=>{},kwt=()=>null;function bln(){const t=Yv(),n=Bsn();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Ye.useSyncExternalStore(n?.subscribe??vln,n?.getSnapshot??kwt,n?.getSnapshot??kwt);const s=IRt(t);if(s==="saved")return null;const c=Rze(t),d=s==="failed",m=d?qYr(t):null,g=d?{label:"Save failed",title:m?`Save failed: ${m} — click to open Console`:"Save failed — click to open Console"}:{label:"Unsaved",title:"Unsaved changes — click to save (Cmd/Ctrl+S)"},S=c?`${g.title} — ${c}`:g.title;return q.jsxs(Ms,{type:"button","data-testid":"save-status","data-save-state":s,variant:"ghost",size:"compact",className:"volter-save-status",onClick:()=>d?_ve():void ORt(t),title:S,children:[q.jsx("span",{className:"volter-save-status-dot"}),g.label]})}function Sln(){Ye.useSyncExternalStore(Qs.subscribe,Qs.getSnapshot);const t=Qs.counts,n=[{id:"info",icon:R$,label:"message",count:t.info},{id:"warn",icon:YTt,label:"warning",count:t.warn},{id:"error",icon:jTt,label:"error",count:t.error}];return q.jsx("span",{className:"volter-console-status-counts","data-testid":"status-console-counts",children:n.map(s=>q.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action volter-console-status-count","data-testid":`status-console-${s.id}`,"data-console-level":s.id,"data-has-count":s.count>0?!0:void 0,"data-has-errors":s.id==="error"&&s.count>0?!0:void 0,onClick:()=>_ve(),title:`${s.count} console ${s.label}${s.count===1?"":"s"} — open Console`,children:[q.jsx(dc,{icon:s.icon,size:"xs"}),s.count]},s.id))})}function xln(t){return[...t.map(s=>`"${s.worldId}" (${s.kind} / ${s.identity}) — ${s.message}`),"See the Console for the full trace."].join(`
1399
+ Run ${t.name}?`)){F(!0);try{k(await tan(t.name,c,{confirm:!0}))}catch(pe){k({ok:!1,error:{code:"REQUEST_FAILED",message:String(pe)}})}finally{F(!1)}}};return q.jsxs("div",{style:Eje,"data-testid":`project-tool:${t.name}`,children:[q.jsx("h2",{style:GMt,children:t.summary}),q.jsx("code",{style:{color:Zf[2]},children:t.name}),q.jsx("p",{style:{color:Zf[2]},children:t.description}),q.jsxs("div",{style:kje,children:[t.host," · ",t.permission.risk," · ",t.sourcePath]}),n.length>0&&q.jsxs("section",{style:{marginTop:18,maxWidth:760},children:[q.jsx("h3",{style:{margin:"0 0 8px",fontSize:13},children:"Presentations"}),q.jsx("div",{style:{display:"grid",gap:8},children:n.map(se=>q.jsx(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>tA(se.id),children:q.jsxs("span",{style:KMt,children:[q.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:se.title}),q.jsx("span",{style:XMt,children:"Open"})]})},se.id))})]}),!$&&q.jsx("div",{style:Qge,children:"This runner supports Node-hosted tools. Import the underlying function directly in browser or runtime code."}),q.jsxs("details",{open:n.length===0,style:{marginTop:18,maxWidth:760},children:[q.jsx("summary",{style:{cursor:"pointer",color:Zf[2],fontSize:12},children:n.length>0?"Advanced · invoke native schema":"Input"}),q.jsx("section",{style:{marginTop:12},children:q.jsx(Gcn,{schema:t.inputSchema,value:c,onChange:se=>{d(se),g(JSON.stringify(se,null,2)),J(null)}})}),D&&q.jsx("div",{style:Qge,children:D}),q.jsx(Ms,{variant:"primary",disabled:!$||A||D!==null,"aria-busy":A,onClick:()=>void G(),style:{marginTop:16},children:A?"Running…":"Run tool"}),q.jsxs("details",{style:{marginTop:16},children:[q.jsx("summary",{style:EOe,children:"Advanced JSON"}),q.jsx(wBe,{id:`tool-input:${t.name}`,value:m,onChange:se=>{const pe=se.target.value;g(pe);try{const ue=JSON.parse(pe);if(!ue||typeof ue!="object"||Array.isArray(ue))throw new Error("Input must be a JSON object.");d(ue),J(null)}catch(ue){J(ue instanceof Error?ue.message:String(ue))}},rows:10,"data-variant":"code",style:rln}),q.jsxs("details",{children:[q.jsx("summary",{style:EOe,children:"Input schema"}),q.jsx(Cwt,{value:t.inputSchema})]})]})]}),S!==null&&q.jsxs("section",{children:[q.jsx("div",{style:EOe,children:"Result"}),q.jsx(Cwt,{value:S})]})]})}const Eje={width:"100%",maxWidth:960,margin:"0 auto",padding:24,boxSizing:"border-box",overflow:"auto",pointerEvents:"auto",color:Zf[1],fontSize:"var(--volter-font-base)"},GMt={margin:"0 0 6px",fontSize:20},kje={color:Zf[2],fontSize:"var(--volter-font-sm)"},EOe={display:"block",margin:"14px 0 6px",color:Zf[1]},KMt={display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",gap:12},XMt={color:Zf[2],fontSize:"var(--volter-font-sm)",fontWeight:500},tln={display:"flex",width:"100%",minWidth:0,alignItems:"center",justifyContent:"space-between",gap:12,color:Zf[2],fontSize:"var(--volter-font-sm)"},Qge={marginTop:10,color:C_e,whiteSpace:"pre-wrap"},rln={width:"100%",boxSizing:"border-box",resize:"vertical"},nln={overflow:"auto",padding:10,background:SBe.inset,border:`1px solid ${ahe[1]}`,borderRadius:sQ.sm,color:Zf[2]};function iln(t,n,s){const c=Ucn(t,n,s),d=[...Qcn(),...Wcn(),...xkr()],m=Jcn(t),g=_Ct().map(S=>({id:S.id,label:S.label,category:"action",shortcut:S.shortcut?Vv(S.shortcut):void 0,execute:S.execute}));return[...c,...d,...g,...aln(),...m]}const oln=["view","window","debug","tools","help"],sln={view:"View",window:"Window",debug:"Debug",tools:"Tools",help:"Help"};function aln(){return oln.flatMap(t=>jme(t).map(n=>{const s=typeof n.label=="function"?n.label():n.label,c=`${sln[t]}: ${s}`;return{id:n.id,label:c,category:"action",menu:{id:t,label:s},execute:()=>{if(n.disabled?.({})){i0(`${c} is not available right now.`);return}return n.execute({})}}}))}function cln(t){return t.map(n=>`${n.id}\0${n.label}\0${n.menu?.id??""}`).join("")}function lln(){const t=Yv(),n=mve(),s=Q9t(),c=Ye.useSyncExternalStore(mLe,YB,YB),d=Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),m=Ye.useSyncExternalStore(IDt,Phe,Phe),g=Ye.useSyncExternalStore(Kye,mhe,mhe),S=Ye.useMemo(()=>iln(t,n,s),[t,n,s,c,d,m,g]),k=Ye.useRef(null);return Ye.useEffect(()=>{const A=cln(S);A!==k.current&&(k.current=A,Dxt(S.map(F=>({id:F.id,label:F.label,category:F.category,run:F.execute,...F.menu?{menu:F.menu}:{}}))))},[S]),Ye.useEffect(()=>()=>{k.current=null,Dxt([])},[]),null}let YMt=[];const Aje=new Set;function uln(t){return Aje.add(t),()=>Aje.delete(t)}function fln(){return YMt}function dln(){for(const t of Aje)t()}function pln(t){return`Starter asset "${t.key}" (pack "${t.pack}") did not materialize into ${t.dest}: ${t.reason} Nothing was written for it — features that read that file degrade (a missing clips GLB leaves the character standing without locomotion clips). Use Retry once the cause is fixed.`}function _ln(t){const n=t.failed.map(s=>({key:s.entry.key,dest:s.entry.dest,pack:s.entry.pack,reason:s.reason}));for(const s of n)Qs.error(pln(s),"assets");YMt=n,dln()}async function mln(t){try{const{materializeDeclaredAssetPacks:n}=await lo(async()=>{const{materializeDeclaredAssetPacks:c}=await import("./hosted-asset-materialization-e4G0wAK4.js");return{materializeDeclaredAssetPacks:c}},__vite__mapDeps([264,104,3,2,4,1,20,21,22,23])),s=await n(t);_ln(s)}catch(n){Qs.error(`Retrying asset materialization failed before any entry was attempted: ${n instanceof Error?n.message:String(n)}`,"assets")}}let ZMt={kind:"quiet"},QMt=0;const Dje=new Set;function hln(){return ZMt}function gln(t){ZMt=t,QMt+=1;for(const n of Dje)n()}function yln(t){return Dje.add(t),()=>Dje.delete(t)}function Ewt(){return QMt}const vln=()=>()=>{},kwt=()=>null;function bln(){const t=Yv(),n=Bsn();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Ye.useSyncExternalStore(n?.subscribe??vln,n?.getSnapshot??kwt,n?.getSnapshot??kwt);const s=IRt(t);if(s==="saved")return null;const c=Rze(t),d=s==="failed",m=d?qYr(t):null,g=d?{label:"Save failed",title:m?`Save failed: ${m} — click to open Console`:"Save failed — click to open Console"}:{label:"Unsaved",title:"Unsaved changes — click to save (Cmd/Ctrl+S)"},S=c?`${g.title} — ${c}`:g.title;return q.jsxs(Ms,{type:"button","data-testid":"save-status","data-save-state":s,variant:"ghost",size:"compact",className:"volter-save-status",onClick:()=>d?_ve():void ORt(t),title:S,children:[q.jsx("span",{className:"volter-save-status-dot"}),g.label]})}function Sln(){Ye.useSyncExternalStore(Qs.subscribe,Qs.getSnapshot);const t=Qs.counts,n=[{id:"info",icon:R$,label:"message",count:t.info},{id:"warn",icon:YTt,label:"warning",count:t.warn},{id:"error",icon:jTt,label:"error",count:t.error}];return q.jsx("span",{className:"volter-console-status-counts","data-testid":"status-console-counts",children:n.map(s=>q.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action volter-console-status-count","data-testid":`status-console-${s.id}`,"data-console-level":s.id,"data-has-count":s.count>0?!0:void 0,"data-has-errors":s.id==="error"&&s.count>0?!0:void 0,onClick:()=>_ve(),title:`${s.count} console ${s.label}${s.count===1?"":"s"} — open Console`,children:[q.jsx(dc,{icon:s.icon,size:"xs"}),s.count]},s.id))})}function xln(t){return[...t.map(s=>`"${s.worldId}" (${s.kind} / ${s.identity}) — ${s.message}`),"See the Console for the full trace."].join(`
1400
1400
  `)}function wln(){const t=Ye.useSyncExternalStore(PRt,zQ);return t.length===0?null:q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-mount-failure","data-status-tone":"danger",onClick:()=>_ve(),title:xln(t),children:t.length===1?"1 world failed to mount":`${t.length} worlds failed to mount`})}function Tln(t){return[...t.map(s=>`${s.dest} — ${s.reason}`),"Nothing was written for them, so features that read those files degrade.","See the Console (subsystem `assets`) for the full lines."].join(`
1401
- `)}function Cln(){const t=Ye.useSyncExternalStore(uln,fln),[n,s]=Ye.useState(!1),c=Ye.useCallback(()=>{s(!0),mln(gR()).finally(()=>s(!1))},[]);return t.length===0?null:q.jsxs(q.Fragment,{children:[q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization","data-status-tone":"danger",onClick:()=>_ve(),title:Tln(t),children:t.length===1?"1 starter asset did not download":`${t.length} starter assets did not download`}),q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization-retry",disabled:n,onClick:c,children:n?"Retrying…":"Retry"})]})}function Eln(){const t=ZEr(),n=Yv();if(Ye.useSyncExternalStore(n.subscribe,n.getShellSnapshot??n.getSnapshot),!t)return null;const s=n.playState,c={stopped:{label:"Play stopped",tone:void 0},playing:{label:"Playing",tone:"success"},paused:{label:"Paused",tone:"warning"}}[s];return q.jsx("span",{className:"volter-status-copy","data-testid":"status-play-state","data-play-state":s,"data-status-tone":c.tone,children:c.label})}function kln(){Ye.useSyncExternalStore(yln,Ewt,Ewt);const t=hln();if(t.kind==="quiet")return null;const n=t.kind==="void"?"error":"warning",s=t.kind==="void"?t.reason==="taken-over"?"Editor yielded":"Editor disconnected":t.subject==="busy"?"Editor slow":"Editor stale";return q.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-editor-lease","data-lease-state":t.kind,"data-tone":n,onClick:()=>window.location.reload(),title:t.kind==="void"&&t.reloadOffered?"The editor is served here again — reload":"The editor server is not answering — reload once it is served here again",children:[q.jsx(dc,{icon:n==="error"?Kk.status.error:Kk.status.warning})," ",s]})}function Aln(){Ye.useSyncExternalStore(Xye,ykr);const t=bC().filter(n=>n.section==="project");return t.length===0?null:q.jsx(q.Fragment,{children:t.map(n=>q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":`status-project-utility-${n.id}`,onClick:()=>vC(n.id),title:`Open the ${n.title} drawer tab (this project's own face)`,children:n.title},n.id))})}const Dln=Mye();function Pln(){Dln.ensure(t=>{t(Z4({id:"editor-lease",name:"Editor server",align:"left",order:-90,Content:kln})),t(Z4({id:"save-status",name:"Save state",align:"left",order:0,Content:bln})),t(Z4({id:"console-counts",name:"Console errors and warnings",align:"left",order:10,Content:Sln})),t(Z4({id:"mount-failure",name:"Mount failure",align:"left",order:5,Content:wln})),t(Z4({id:"asset-materialization",name:"Asset materialization",align:"left",order:15,Content:Cln})),t(Z4({id:"play-state",name:"Play state",align:"left",order:20,Content:Eln})),t(Z4({id:"project-utilities",name:"Project utilities",align:"left",order:25,Content:Aln}))})}const Iln=Ye.lazy(async()=>({default:(await lo(()=>import("./NonThreeAuthoringBootstrap-CDUdubAw.js"),__vite__mapDeps([265,3,2,4,266,91,1,20,21,22,23]))).ProjectAuthoringBootstrap}));function Nln(){const t=Yv(),n=Z9t(),s=mve();return Ye.use(Lsn()),Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),acn(t),Ye.useEffect(()=>Pln(),[]),Ye.useEffect(()=>Ccn(),[]),Ye.useEffect(()=>bsn(n),[n]),Ye.useEffect(()=>rcn(),[]),Ye.useEffect(()=>Skr(),[t]),Ye.useEffect(()=>ktn(),[t]),Ye.useEffect(()=>U4r(n),[n]),Ye.useEffect(()=>ecn(t,s),[t,s]),Ye.useEffect(()=>CYr(t),[t]),Ye.useEffect(()=>fen(()=>window.dispatchEvent(new CustomEvent("editor:assets-changed")),c=>window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:c}))),[]),q.jsxs(q.Fragment,{children:[q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(Iln,{store:t})}),q.jsx(Bcn,{}),q.jsx(scn,{}),q.jsx(lln,{})]})}const Oln=3,Rln=1e4,Fln=4e3;function Mln(t){return{bootIdentity:null,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:t}}function Awt(t,n,s,c){if(!n.ok){const d=s==="open";return{...t,lastIdentity:null,consecutiveFailures:t.consecutiveFailures+1,unbackedFailures:d?0:t.unbackedFailures+1,darkSince:d?c:t.darkSince}}return{bootIdentity:t.bootIdentity??n.identity,lastIdentity:n.identity,consecutiveFailures:0,unbackedFailures:0,darkSince:c}}function jln(t,n){return{bootIdentity:t.bootIdentity,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:n}}function ejt(t,n){return!(t.project!==null&&n.project!==null&&t.project!==n.project||t.pid!==null&&n.pid!==null&&t.pid!==n.pid)}function Lln(t){const{consecutiveFailures:n,unbackedFailures:s,failureThreshold:c,darkForMs:d,minDarkWindowMs:m,bootIdentity:g,lastIdentity:S}=t;return g&&S&&!ejt(g,S)?{status:"void",reason:"taken-over"}:n>=c?s>=c&&d>=m?{status:"void",reason:"server-gone"}:{status:"degraded",reason:null}:{status:"live",reason:null}}function Bln(t,n){return!t?.project||!n.project?!1:n.project===t.project}function $ln(t,n){if(!n.ok)return"none";const s=n.identity;return t&&t.pid!==null&&s.pid===t.pid&&ejt(t,s)?"resume":Bln(t,s)?"reload":t?.project?"none":"offer-reload"}const eye="volter.editor.orphaned-tab.v1";function qln(t){if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!="object"||n===null)return null;const s=n;if(typeof s.at!="number"||!Number.isFinite(s.at)||s.reason!=="server-gone")return null;const c=typeof s.project=="string"?s.project:null;return{at:s.at,reason:s.reason,project:c}}function zln(t){return JSON.stringify(t)}function Vln(t,n){const s=Math.max(0,Math.round((n-t.at)/1e3)),c=s<90?`${s}s ago`:s<5400?`${Math.round(s/60)}m ago`:`${Math.round(s/3600)}h ago`,d=t.project?` on ${t.project}`:"";return`A previous editor window at this address lost its server ${c}${d} and was left orphaned. If that window is still open it is a stale snapshot — nothing in it is saved and every click in it hangs on retries. Close it; this window is the live one.`}const Uln=720*60*1e3;function Jln(t,n){const s=n-t.at;return s>=0&&s<=Uln}function JVe(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Wln(t,n=JVe()){try{n?.setItem(eye,zln(t))}catch{}}function Hln(t=JVe()){if(!t)return null;try{const n=qln(t.getItem(eye));return t.removeItem(eye),n}catch{return null}}function Gln(t=JVe()){try{t?.removeItem(eye)}catch{}}function Kln(t){return t?t.split(/[\\/]/).filter(Boolean).at(-1)??null:null}async function Xln(){try{const{stopAllLiveSessions:t}=await lo(async()=>{const{stopAllLiveSessions:n}=await Promise.resolve().then(()=>mrn);return{stopAllLiveSessions:n}},void 0);t()}catch{}}function Yln(){const[t,n]=Ye.useState({kind:"quiet"}),s=Ye.useRef(Mln(Date.now())),c=Ye.useRef(null),d=Ye.useRef(!1);return Ye.useEffect(()=>{let m=!1,g=null;const S=()=>{g!==null&&(clearInterval(g),g=null)},k=async pe=>{c.current=pe,jRt(pe),pe==="taken-over"&&S(),pe==="server-gone"&&Wln({at:Date.now(),reason:"server-gone",project:s.current.bootIdentity?.project??null}),n(d.current?{kind:"degraded",subject:"stale"}:{kind:"void",reason:pe,reloadOffered:!1}),await Xln()},A=(pe,ue,Ce)=>{switch($ln(s.current.bootIdentity,pe)){case"resume":{c.current=null,oZr(),Gln(),s.current=Awt(s.current,pe,ue,Ce),n({kind:"quiet"});return}case"reload":if(d.current)return;window.location.reload();return;case"offer-reload":n(De=>De.kind==="void"&&!De.reloadOffered?{...De,reloadOffered:!0}:De);return;default:return}},F=async()=>{const pe=await qZr(),ue=TZr(),Ce=Date.now();if(m)return;if(c.current!==null){A(pe,ue,Ce);return}s.current=Awt(s.current,pe,ue,Ce);const De=Lln({consecutiveFailures:s.current.consecutiveFailures,unbackedFailures:s.current.unbackedFailures,failureThreshold:Oln,darkForMs:Ce-s.current.darkSince,minDarkWindowMs:Rln,bootIdentity:s.current.bootIdentity,lastIdentity:s.current.lastIdentity});if(De.status==="void"&&De.reason!==null){await k(De.reason);return}n(De.status==="degraded"?{kind:"degraded",subject:"busy"}:{kind:"quiet"})};let D=!1;const J=()=>{D||m||(D=!0,F().finally(()=>{D=!1}))},$=()=>{m||(c.current===null&&(s.current=jln(s.current,Date.now())),J())},G=()=>{document.visibilityState==="visible"&&$()};document.addEventListener("visibilitychange",G),window.addEventListener("pageshow",$);let se=null;try{const pe=jD();pe.addEventListener("error",J),pe.addEventListener("open",J),se=pe}catch{}return g=setInterval(J,Fln),()=>{m=!0,S(),document.removeEventListener("visibilitychange",G),window.removeEventListener("pageshow",$),se?.close()}},[]),Ye.useEffect(()=>{gln(t);const m=Kln(s.current.bootIdentity?.project??null),g=()=>{d.current=!0,n({kind:"degraded",subject:"stale"})};if(t.kind==="quiet"){kBe(kOe);return}if(t.kind==="degraded"){s$({id:kOe,tone:"warning",sticky:!0,...t.subject==="busy"?{title:"Editor server is slow to answer.",detail:"Still connected — this window keeps working, and this clears itself when the server catches up."}:{title:"This window's editor server has stopped.",detail:"You chose to keep reading it — nothing here saves, and it will not reconnect on its own. Reload once the editor is served here again.",actions:[{label:"Reload",primary:!0,run:()=>window.location.reload()}]}});return}s$({id:kOe,tone:"error",sticky:!0,title:"Editor disconnected.",detail:t.reason==="taken-over"?`${m?`${m}'s`:"This project's"} editor is now running in another window. This one has yielded.`:`This window's editor server has stopped — nothing here is saved, and a running game has left its room. Reopen with ${DB(`edit ${m??"<project>"}`)}${m?`, or leave this window open: it reloads by itself when ${m}'s editor is served here again.`:"."}`,onDismiss:()=>{d.current||g()},actions:[...t.reloadOffered?[{label:"Reload",primary:!0,run:()=>window.location.reload()}]:[],{label:"Close window",run:()=>window.close()},{label:"Continue anyway",run:g}]})},[t]),null}const kOe="editor-lease",Zln="0.5.87",Qln={version:Zln},eun="0.5.87",tun={version:eun},tjt=tun.version,run=Qln.version;function nun({error:t,onDismiss:n,onRetry:s,startup:c=!1}){const d=t.recovery&&"verbs"in t.recovery?oPt(t.recovery.verbs):null,[m,g]=Ye.useState(!1);return Ye.useEffect(()=>{if(!m)return;const S=window.setTimeout(()=>g(!1),1600);return()=>window.clearTimeout(S)},[m]),q.jsxs("div",{role:"alert",className:"volter-error-card volter-shell-rise",children:[q.jsx("div",{className:"volter-error-card-icon","aria-hidden":"true",children:q.jsx(dc,{icon:fee})}),q.jsxs("div",{className:"volter-error-card-body",children:[c?q.jsx("h1",{className:"volter-error-card-title",children:t.recovery?.title??"Couldn’t open this project"}):t.recovery&&q.jsx("div",{className:"volter-error-card-title",children:t.recovery.title}),t.recovery&&q.jsx("p",{className:"volter-error-card-guidance",children:t.recovery.guidance}),q.jsx("div",{className:"volter-error-card-message","data-testid":c?"project-startup-error-details":void 0,children:t.message}),d&&q.jsxs("div",{children:[c&&q.jsx("div",{className:"volter-error-card-recovery-label",children:"RUN FROM THE PROJECT FOLDER"}),q.jsxs("div",{className:"volter-error-card-command",children:[q.jsx("code",{"data-testid":c?"project-startup-recovery-command":"project-screen-recovery-command",children:d}),q.jsxs(Ms,{type:"button",variant:"secondary",size:"compact",onClick:()=>{navigator.clipboard?.writeText(d),g(!0)},children:[q.jsx(dc,{icon:m?aLe:G0r,"aria-hidden":"true"}),m?"Copied":"Copy"]})]})]}),q.jsxs("div",{className:"volter-error-card-actions",children:[s&&q.jsx(Ms,{type:"button",variant:"primary",className:"volter-shell-cta","data-testid":"retry-project-detection",onClick:s,children:"Retry"}),n&&q.jsx(Ms,{type:"button",variant:"ghost",className:"volter-shell-cta","aria-label":"Dismiss error",onClick:n,children:"Dismiss"})]})]})]})}function Pje({error:t,report:n,onRetry:s}){return q.jsx("div",{className:"volter-shell","data-testid":"project-detection-error",children:q.jsxs("div",{className:"volter-shell-container","data-view":"startup-error",children:[q.jsx("header",{className:"volter-shell-header",children:q.jsxs("span",{className:"volter-shell-brand-static",children:[q.jsx("span",{className:"volter-shell-brand-mark","aria-hidden":"true",children:q.jsx(UVe,{size:30})}),q.jsx("span",{className:"volter-shell-wordmark",children:mR.name})]})}),q.jsx(nun,{error:t,onRetry:s,startup:!0}),n?.projectPath&&q.jsx("div",{className:"volter-shell-notice","data-testid":"project-startup-serving",children:q.jsxs("span",{children:["This editor server is serving"," ",q.jsx("code",{"data-testid":"project-startup-serving-path",children:n.projectPath})," — the project exists; the editor could not read it. Fix the file it names above and press Retry."]})}),q.jsx("footer",{className:"volter-shell-footer",children:q.jsxs("span",{className:"volter-chip","data-variant":"tag",children:["Editor v",tjt," · Engine v",run]})})]})})}function iun({wait:t}={}){return q.jsx("main",{role:"status","aria-live":"polite","aria-label":"Opening project","data-testid":"startup-loading-screen",className:"volter-splash",children:q.jsxs("div",{className:"volter-splash-stack",children:[q.jsx("div",{"aria-hidden":"true",className:"volter-splash-logo",children:q.jsx(UVe,{size:72})}),q.jsx("div",{className:"volter-splash-title",children:mR.name}),q.jsx("div",{"aria-hidden":"true",className:"volter-splash-progress"}),t?q.jsxs(q.Fragment,{children:[q.jsx("div",{className:"volter-splash-status","data-testid":"startup-wait-status",children:`Asking the server which project it serves — ${t.seconds}s`}),q.jsx("div",{className:"volter-splash-note",children:"Still trying. The first boot of a fresh checkout can take a while, so this keeps asking until the server answers."}),t.detail?q.jsxs("div",{className:"volter-splash-note",children:["Last attempt: ",t.detail]}):null]}):q.jsx("div",{className:"volter-splash-status",children:"Opening project…"})]})})}class oun extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){Qs.error(`Editor chrome crashed while the command listener stayed attached: ${n.message}
1401
+ `)}function Cln(){const t=Ye.useSyncExternalStore(uln,fln),[n,s]=Ye.useState(!1),c=Ye.useCallback(()=>{s(!0),mln(gR()).finally(()=>s(!1))},[]);return t.length===0?null:q.jsxs(q.Fragment,{children:[q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization","data-status-tone":"danger",onClick:()=>_ve(),title:Tln(t),children:t.length===1?"1 starter asset did not download":`${t.length} starter assets did not download`}),q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization-retry",disabled:n,onClick:c,children:n?"Retrying…":"Retry"})]})}function Eln(){const t=ZEr(),n=Yv();if(Ye.useSyncExternalStore(n.subscribe,n.getShellSnapshot??n.getSnapshot),!t)return null;const s=n.playState,c={stopped:{label:"Play stopped",tone:void 0},playing:{label:"Playing",tone:"success"},paused:{label:"Paused",tone:"warning"}}[s];return q.jsx("span",{className:"volter-status-copy","data-testid":"status-play-state","data-play-state":s,"data-status-tone":c.tone,children:c.label})}function kln(){Ye.useSyncExternalStore(yln,Ewt,Ewt);const t=hln();if(t.kind==="quiet")return null;const n=t.kind==="void"?"error":"warning",s=t.kind==="void"?t.reason==="taken-over"?"Editor yielded":"Editor disconnected":t.subject==="busy"?"Editor slow":"Editor stale";return q.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-editor-lease","data-lease-state":t.kind,"data-tone":n,onClick:()=>window.location.reload(),title:t.kind==="void"&&t.reloadOffered?"The editor is served here again — reload":"The editor server is not answering — reload once it is served here again",children:[q.jsx(dc,{icon:n==="error"?Kk.status.error:Kk.status.warning})," ",s]})}function Aln(){Ye.useSyncExternalStore(Xye,ykr);const t=bC().filter(n=>n.section==="project");return t.length===0?null:q.jsx(q.Fragment,{children:t.map(n=>q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":`status-project-utility-${n.id}`,onClick:()=>vC(n.id),title:`Open the ${n.title} drawer tab (this project's own face)`,children:n.title},n.id))})}const Dln=Mye();function Pln(){Dln.ensure(t=>{t(Z4({id:"editor-lease",name:"Editor server",align:"left",order:-90,Content:kln})),t(Z4({id:"save-status",name:"Save state",align:"left",order:0,Content:bln})),t(Z4({id:"console-counts",name:"Console errors and warnings",align:"left",order:10,Content:Sln})),t(Z4({id:"mount-failure",name:"Mount failure",align:"left",order:5,Content:wln})),t(Z4({id:"asset-materialization",name:"Asset materialization",align:"left",order:15,Content:Cln})),t(Z4({id:"play-state",name:"Play state",align:"left",order:20,Content:Eln})),t(Z4({id:"project-utilities",name:"Project utilities",align:"left",order:25,Content:Aln}))})}const Iln=Ye.lazy(async()=>({default:(await lo(()=>import("./NonThreeAuthoringBootstrap-wLP33ygR.js"),__vite__mapDeps([265,3,2,4,266,91,1,20,21,22,23]))).ProjectAuthoringBootstrap}));function Nln(){const t=Yv(),n=Z9t(),s=mve();return Ye.use(Lsn()),Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),acn(t),Ye.useEffect(()=>Pln(),[]),Ye.useEffect(()=>Ccn(),[]),Ye.useEffect(()=>bsn(n),[n]),Ye.useEffect(()=>rcn(),[]),Ye.useEffect(()=>Skr(),[t]),Ye.useEffect(()=>ktn(),[t]),Ye.useEffect(()=>U4r(n),[n]),Ye.useEffect(()=>ecn(t,s),[t,s]),Ye.useEffect(()=>CYr(t),[t]),Ye.useEffect(()=>fen(()=>window.dispatchEvent(new CustomEvent("editor:assets-changed")),c=>window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:c}))),[]),q.jsxs(q.Fragment,{children:[q.jsx(Ye.Suspense,{fallback:null,children:q.jsx(Iln,{store:t})}),q.jsx(Bcn,{}),q.jsx(scn,{}),q.jsx(lln,{})]})}const Oln=3,Rln=1e4,Fln=4e3;function Mln(t){return{bootIdentity:null,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:t}}function Awt(t,n,s,c){if(!n.ok){const d=s==="open";return{...t,lastIdentity:null,consecutiveFailures:t.consecutiveFailures+1,unbackedFailures:d?0:t.unbackedFailures+1,darkSince:d?c:t.darkSince}}return{bootIdentity:t.bootIdentity??n.identity,lastIdentity:n.identity,consecutiveFailures:0,unbackedFailures:0,darkSince:c}}function jln(t,n){return{bootIdentity:t.bootIdentity,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:n}}function ejt(t,n){return!(t.project!==null&&n.project!==null&&t.project!==n.project||t.pid!==null&&n.pid!==null&&t.pid!==n.pid)}function Lln(t){const{consecutiveFailures:n,unbackedFailures:s,failureThreshold:c,darkForMs:d,minDarkWindowMs:m,bootIdentity:g,lastIdentity:S}=t;return g&&S&&!ejt(g,S)?{status:"void",reason:"taken-over"}:n>=c?s>=c&&d>=m?{status:"void",reason:"server-gone"}:{status:"degraded",reason:null}:{status:"live",reason:null}}function Bln(t,n){return!t?.project||!n.project?!1:n.project===t.project}function $ln(t,n){if(!n.ok)return"none";const s=n.identity;return t&&t.pid!==null&&s.pid===t.pid&&ejt(t,s)?"resume":Bln(t,s)?"reload":t?.project?"none":"offer-reload"}const eye="volter.editor.orphaned-tab.v1";function qln(t){if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!="object"||n===null)return null;const s=n;if(typeof s.at!="number"||!Number.isFinite(s.at)||s.reason!=="server-gone")return null;const c=typeof s.project=="string"?s.project:null;return{at:s.at,reason:s.reason,project:c}}function zln(t){return JSON.stringify(t)}function Vln(t,n){const s=Math.max(0,Math.round((n-t.at)/1e3)),c=s<90?`${s}s ago`:s<5400?`${Math.round(s/60)}m ago`:`${Math.round(s/3600)}h ago`,d=t.project?` on ${t.project}`:"";return`A previous editor window at this address lost its server ${c}${d} and was left orphaned. If that window is still open it is a stale snapshot — nothing in it is saved and every click in it hangs on retries. Close it; this window is the live one.`}const Uln=720*60*1e3;function Jln(t,n){const s=n-t.at;return s>=0&&s<=Uln}function JVe(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Wln(t,n=JVe()){try{n?.setItem(eye,zln(t))}catch{}}function Hln(t=JVe()){if(!t)return null;try{const n=qln(t.getItem(eye));return t.removeItem(eye),n}catch{return null}}function Gln(t=JVe()){try{t?.removeItem(eye)}catch{}}function Kln(t){return t?t.split(/[\\/]/).filter(Boolean).at(-1)??null:null}async function Xln(){try{const{stopAllLiveSessions:t}=await lo(async()=>{const{stopAllLiveSessions:n}=await Promise.resolve().then(()=>mrn);return{stopAllLiveSessions:n}},void 0);t()}catch{}}function Yln(){const[t,n]=Ye.useState({kind:"quiet"}),s=Ye.useRef(Mln(Date.now())),c=Ye.useRef(null),d=Ye.useRef(!1);return Ye.useEffect(()=>{let m=!1,g=null;const S=()=>{g!==null&&(clearInterval(g),g=null)},k=async pe=>{c.current=pe,jRt(pe),pe==="taken-over"&&S(),pe==="server-gone"&&Wln({at:Date.now(),reason:"server-gone",project:s.current.bootIdentity?.project??null}),n(d.current?{kind:"degraded",subject:"stale"}:{kind:"void",reason:pe,reloadOffered:!1}),await Xln()},A=(pe,ue,Ce)=>{switch($ln(s.current.bootIdentity,pe)){case"resume":{c.current=null,oZr(),Gln(),s.current=Awt(s.current,pe,ue,Ce),n({kind:"quiet"});return}case"reload":if(d.current)return;window.location.reload();return;case"offer-reload":n(De=>De.kind==="void"&&!De.reloadOffered?{...De,reloadOffered:!0}:De);return;default:return}},F=async()=>{const pe=await qZr(),ue=TZr(),Ce=Date.now();if(m)return;if(c.current!==null){A(pe,ue,Ce);return}s.current=Awt(s.current,pe,ue,Ce);const De=Lln({consecutiveFailures:s.current.consecutiveFailures,unbackedFailures:s.current.unbackedFailures,failureThreshold:Oln,darkForMs:Ce-s.current.darkSince,minDarkWindowMs:Rln,bootIdentity:s.current.bootIdentity,lastIdentity:s.current.lastIdentity});if(De.status==="void"&&De.reason!==null){await k(De.reason);return}n(De.status==="degraded"?{kind:"degraded",subject:"busy"}:{kind:"quiet"})};let D=!1;const J=()=>{D||m||(D=!0,F().finally(()=>{D=!1}))},$=()=>{m||(c.current===null&&(s.current=jln(s.current,Date.now())),J())},G=()=>{document.visibilityState==="visible"&&$()};document.addEventListener("visibilitychange",G),window.addEventListener("pageshow",$);let se=null;try{const pe=jD();pe.addEventListener("error",J),pe.addEventListener("open",J),se=pe}catch{}return g=setInterval(J,Fln),()=>{m=!0,S(),document.removeEventListener("visibilitychange",G),window.removeEventListener("pageshow",$),se?.close()}},[]),Ye.useEffect(()=>{gln(t);const m=Kln(s.current.bootIdentity?.project??null),g=()=>{d.current=!0,n({kind:"degraded",subject:"stale"})};if(t.kind==="quiet"){kBe(kOe);return}if(t.kind==="degraded"){s$({id:kOe,tone:"warning",sticky:!0,...t.subject==="busy"?{title:"Editor server is slow to answer.",detail:"Still connected — this window keeps working, and this clears itself when the server catches up."}:{title:"This window's editor server has stopped.",detail:"You chose to keep reading it — nothing here saves, and it will not reconnect on its own. Reload once the editor is served here again.",actions:[{label:"Reload",primary:!0,run:()=>window.location.reload()}]}});return}s$({id:kOe,tone:"error",sticky:!0,title:"Editor disconnected.",detail:t.reason==="taken-over"?`${m?`${m}'s`:"This project's"} editor is now running in another window. This one has yielded.`:`This window's editor server has stopped — nothing here is saved, and a running game has left its room. Reopen with ${DB(`edit ${m??"<project>"}`)}${m?`, or leave this window open: it reloads by itself when ${m}'s editor is served here again.`:"."}`,onDismiss:()=>{d.current||g()},actions:[...t.reloadOffered?[{label:"Reload",primary:!0,run:()=>window.location.reload()}]:[],{label:"Close window",run:()=>window.close()},{label:"Continue anyway",run:g}]})},[t]),null}const kOe="editor-lease",Zln="0.5.89",Qln={version:Zln},eun="0.5.89",tun={version:eun},tjt=tun.version,run=Qln.version;function nun({error:t,onDismiss:n,onRetry:s,startup:c=!1}){const d=t.recovery&&"verbs"in t.recovery?oPt(t.recovery.verbs):null,[m,g]=Ye.useState(!1);return Ye.useEffect(()=>{if(!m)return;const S=window.setTimeout(()=>g(!1),1600);return()=>window.clearTimeout(S)},[m]),q.jsxs("div",{role:"alert",className:"volter-error-card volter-shell-rise",children:[q.jsx("div",{className:"volter-error-card-icon","aria-hidden":"true",children:q.jsx(dc,{icon:fee})}),q.jsxs("div",{className:"volter-error-card-body",children:[c?q.jsx("h1",{className:"volter-error-card-title",children:t.recovery?.title??"Couldn’t open this project"}):t.recovery&&q.jsx("div",{className:"volter-error-card-title",children:t.recovery.title}),t.recovery&&q.jsx("p",{className:"volter-error-card-guidance",children:t.recovery.guidance}),q.jsx("div",{className:"volter-error-card-message","data-testid":c?"project-startup-error-details":void 0,children:t.message}),d&&q.jsxs("div",{children:[c&&q.jsx("div",{className:"volter-error-card-recovery-label",children:"RUN FROM THE PROJECT FOLDER"}),q.jsxs("div",{className:"volter-error-card-command",children:[q.jsx("code",{"data-testid":c?"project-startup-recovery-command":"project-screen-recovery-command",children:d}),q.jsxs(Ms,{type:"button",variant:"secondary",size:"compact",onClick:()=>{navigator.clipboard?.writeText(d),g(!0)},children:[q.jsx(dc,{icon:m?aLe:G0r,"aria-hidden":"true"}),m?"Copied":"Copy"]})]})]}),q.jsxs("div",{className:"volter-error-card-actions",children:[s&&q.jsx(Ms,{type:"button",variant:"primary",className:"volter-shell-cta","data-testid":"retry-project-detection",onClick:s,children:"Retry"}),n&&q.jsx(Ms,{type:"button",variant:"ghost",className:"volter-shell-cta","aria-label":"Dismiss error",onClick:n,children:"Dismiss"})]})]})]})}function Pje({error:t,report:n,onRetry:s}){return q.jsx("div",{className:"volter-shell","data-testid":"project-detection-error",children:q.jsxs("div",{className:"volter-shell-container","data-view":"startup-error",children:[q.jsx("header",{className:"volter-shell-header",children:q.jsxs("span",{className:"volter-shell-brand-static",children:[q.jsx("span",{className:"volter-shell-brand-mark","aria-hidden":"true",children:q.jsx(UVe,{size:30})}),q.jsx("span",{className:"volter-shell-wordmark",children:mR.name})]})}),q.jsx(nun,{error:t,onRetry:s,startup:!0}),n?.projectPath&&q.jsx("div",{className:"volter-shell-notice","data-testid":"project-startup-serving",children:q.jsxs("span",{children:["This editor server is serving"," ",q.jsx("code",{"data-testid":"project-startup-serving-path",children:n.projectPath})," — the project exists; the editor could not read it. Fix the file it names above and press Retry."]})}),q.jsx("footer",{className:"volter-shell-footer",children:q.jsxs("span",{className:"volter-chip","data-variant":"tag",children:["Editor v",tjt," · Engine v",run]})})]})})}function iun({wait:t}={}){return q.jsx("main",{role:"status","aria-live":"polite","aria-label":"Opening project","data-testid":"startup-loading-screen",className:"volter-splash",children:q.jsxs("div",{className:"volter-splash-stack",children:[q.jsx("div",{"aria-hidden":"true",className:"volter-splash-logo",children:q.jsx(UVe,{size:72})}),q.jsx("div",{className:"volter-splash-title",children:mR.name}),q.jsx("div",{"aria-hidden":"true",className:"volter-splash-progress"}),t?q.jsxs(q.Fragment,{children:[q.jsx("div",{className:"volter-splash-status","data-testid":"startup-wait-status",children:`Asking the server which project it serves — ${t.seconds}s`}),q.jsx("div",{className:"volter-splash-note",children:"Still trying. The first boot of a fresh checkout can take a while, so this keeps asking until the server answers."}),t.detail?q.jsxs("div",{className:"volter-splash-note",children:["Last attempt: ",t.detail]}):null]}):q.jsx("div",{className:"volter-splash-status",children:"Opening project…"})]})})}class oun extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){Qs.error(`Editor chrome crashed while the command listener stayed attached: ${n.message}
1402
1402
  ${s.componentStack??""}`,"editor")}render(){return this.state.error?q.jsx(Pje,{error:{message:`The editor surface crashed: ${this.state.error.message}`},onRetry:()=>this.setState({error:null})}):this.props.children}}function d_e({children:t}){return q.jsxs(q.Fragment,{children:[t,q.jsx(Yln,{})]})}function sun(t){const n=t instanceof Error?t.message:String(t);return t instanceof AC?{status:"error",message:n,recovery:t.recovery}:t instanceof w$e?{status:"error",message:n,report:t.report}:{status:"error",message:n}}const aun=8e3;function cun(t=Ren,n=aun){return new Promise((s,c)=>{const d=window.setTimeout(()=>{c(new GPt(n))},n);t().then(m=>{window.clearTimeout(d),s(m)},m=>{window.clearTimeout(d),c(m)})})}const lun=3;function uun(){const[t,n]=Ye.useState({status:"detecting",waitingSince:null}),[s,c]=Ye.useState(0);Ye.useEffect(()=>Iwr(),[]),Ye.useEffect(()=>CZr(),[]),Ye.useEffect(()=>_Zr(()=>c(k=>k+1)),[]),Ye.useEffect(()=>{let k=!1,A,F=0;const D=Date.now();n({status:"detecting",waitingSince:null});const J=()=>{cun().then($=>{k||n($?{status:"ready",project:$}:{status:"no-project"})},$=>{if(k)return;F+=1;const G=A4r($,F);if(G.kind==="terminal"){const pe=sun($),ue=pe.recovery&&"verbs"in pe.recovery?oPt(pe.recovery.verbs):null;Qs.error(`Startup failed: ${pe.message}${ue?` Run: ${ue}`:""}`,"editor"),n(pe);return}const se=$ instanceof Error?$.message:String($);F===lun&&Qs.error(`Project detection has failed ${F} times and is still retrying: ${se}`,"editor"),n({status:"detecting",waitingSince:D,lastError:se}),A=window.setTimeout(J,G.delayMs)})};return J(),()=>{k=!0,A!==void 0&&window.clearTimeout(A)}},[s]);const d=t.status==="detecting"?t.waitingSince:null,[m,g]=Ye.useState(0);Ye.useEffect(()=>{if(d===null){g(0);return}const k=()=>g(Math.max(0,Math.round((Date.now()-d)/1e3)));k();const A=window.setInterval(k,1e3);return()=>window.clearInterval(A)},[d]),Ye.useEffect(()=>{t.status!=="detecting"&&IZr(t.status==="ready"?"project":"no-project")},[t.status]);const S=t.status==="ready"?t.project.config.name:t.status==="error"?"Couldn't open project":null;return Ye.useEffect(()=>{document.title=BPt(S)},[S]),t.status==="detecting"?q.jsx(d_e,{children:q.jsx(iun,{wait:t.waitingSince===null?void 0:{seconds:m,detail:t.lastError}})}):t.status==="no-project"?q.jsx(d_e,{children:q.jsx(Pje,{error:{message:`This window has no project open. A session serves one project: open a folder that carries a volter.project.json, or start one from a terminal — ${DB("edit <folder>")}.`},onRetry:()=>c(k=>k+1)})}):t.status==="error"?q.jsx(d_e,{children:q.jsx(Pje,{error:{message:t.message,...t.recovery?{recovery:t.recovery}:{}},report:t.report,onRetry:()=>c(k=>k+1)})}):q.jsx(d_e,{children:q.jsx(man,{children:q.jsx(oun,{children:q.jsx(Nln,{})})})})}function WVe(t){Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot,t.getShellSnapshot),Ye.useSyncExternalStore(o2,K1,K1),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(Fye,lN,lN),Ye.useSyncExternalStore(don,$xt,$xt),Ye.useSyncExternalStore(U$,vhe,vhe),Ye.useSyncExternalStore(yEr,Jht,Jht),Ye.useSyncExternalStore(xin,Nxt,Nxt),Ye.useSyncExternalStore(K0e,qQ,qQ),Ye.useSyncExternalStore(I3t,yRe,yRe),Ye.useSyncExternalStore(aTr,vht,vht),Ye.useSyncExternalStore(ZCr,qht,qht);const[,n]=Ye.useReducer(d=>d+1,0),{adapter:s}=Cm(t),c=Ye.useRef({broad:t.getSnapshot(),shell:t.getShellSnapshot()});return c.current={broad:t.getSnapshot(),shell:t.getShellSnapshot()},Ye.useEffect(()=>{const d=s.subscribe;if(d)return Pg({adapter:s,seam:"editor.subscribe",stage:"effect",detail:"the active Inspector subscribed to adapter-owned changes",run:()=>d.call(s,()=>{const m=c.current,g={broad:t.getSnapshot(),shell:t.getShellSnapshot()};c.current=g,g.broad===m.broad&&g.shell===m.shell&&n()})})},[s,t]),fve(t)}let DI=null,rjt=0;const Ije=new Set;function fun(){return DI}function Dwt(){return rjt}function dun(t){return Ije.add(t),()=>Ije.delete(t)}function Pwt(t){if(!(DI===t||DI!==null&&t!==null&&DI.x===t.x&&DI.y===t.y&&DI.width===t.width&&DI.height===t.height)){DI=t,rjt+=1;for(const s of Ije)s()}}function pun(t,n,s){const c=Math.min(n.maxWidth,Math.max(n.minSize,t.width-n.margin*2)),d=Math.min(n.maxHeight,Math.max(n.minSize,t.height-n.margin*2)),m=t.x+n.margin,g=t.x+t.width-c-n.margin,S=t.y+n.margin,k=t.y+t.height-d-n.margin,A=t.x+t.width-s.right-c,F=t.y+t.height-s.bottom-d;return{width:c,height:d,left:Math.min(Math.max(A,m),Math.max(g,m)),top:Math.min(Math.max(F,S),Math.max(k,S))}}const njt=Ye.createContext(null);function _un({actions:t,children:n}){return q.jsx(njt.Provider,{value:t,children:n})}function mun(){return Ye.useContext(njt)}function RC(t,n){return{...n,iconName:t}}const hun=RC("outliner-object",aR),gun=RC("outliner-light",oLe),yun=RC("outliner-camera",cye),vun=RC("outliner-audio",U0r),AOe=RC("outliner-data",k0r),Iwt=RC("outliner-mesh",aR),bun={three:hun,react:sLe,canvas:nCt,scene:pLe,mesh:Iwt,"skinned-mesh":Iwt,"mesh-data":AOe,"three-source":AOe,"model-asset":AOe,light:gun,camera:yun,audio:vun,"reflection-probe":eCt,group:WOe,object:$Tt,component:GB,img:iB,a:P0r,ul:vZ,ol:vZ,li:vZ,button:UOe,sprite:iB,animatedsprite:GTt,nineslicesprite:iB,tilingsprite:iB,text:W0r,graphics:UOe,container:WOe},Sun=RC("outliner-render-on",cye),xun=RC("outliner-render-off",C0r),wun=RC("outliner-exclude-on",E0r),Tun=RC("outliner-exclude-off",UOe),Cun=/^blender-[a-z0-9-]+$/;function KZ(t,n=$Tt){const s=bun[t];return s||(Cun.test(t)?RC(t,n):n)}const Eun=new Set(["mesh-data","blender-material-data","blender-shapekey-data","blender-texture-data","blender-image-data"]),kun=["blender-outliner-data-","blender-light-","blender-lightprobe-"];function ijt(t){return t===void 0?!1:Eun.has(t)?!0:kun.some(n=>t.startsWith(n))}function Nje(t){return t.body.kind==="fields"?q.jsx(V9t,{fields:t.body.fields,io:t.body.io}):t.body.render()}function HVe({action:t}){return q.jsx(dm,{"data-testid":t.id,"aria-label":t.title,title:t.title,"aria-pressed":t.pressed,disabled:t.disabled,onClick:t.run,children:t.icon&&q.jsx(dc,{icon:t.icon})})}function GVe(t){return t.related.find(n=>n.id.startsWith("definition:"))??null}function Aun(t){return t.related.filter(n=>!n.id.startsWith("creation-site:")&&!n.id.startsWith("definition:"))}function KVe({link:t}){return q.jsxs(Ms,{variant:"secondary",size:"compact","data-testid":"inspector-open-definition",title:t.title,onClick:t.open,style:{display:"inline-flex",alignItems:"center",gap:4,flexShrink:0},children:[q.jsx(dc,{icon:Y0r}),q.jsx("span",{style:{maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.title})]})}function ojt({subject:t}){const n=Aun(t);return n.length===0?null:q.jsx("div",{"data-testid":"inspector-related-subjects",style:{display:"flex",flexWrap:"wrap",gap:4,padding:"6px 8px"},children:n.map(s=>q.jsx(Ms,{variant:"ghost",onClick:s.open,title:s.title,children:s.title},s.id))})}function Oje(t){const n=p4t(t.iconName);if(n)return`${n.path}|${n.tonedPath??""}`;const s=t.icon[4];return Array.isArray(s)?s.join("|"):s}function sjt({subject:t,onJump:n}){const s=B9t(t);return Ye.useSyncExternalStore(TBe,uhe,uhe),s.length<5||new Set(s.map(c=>Oje(c.icon))).size<3?null:q.jsx("div",{className:"volter-inspector-icon-strip",role:"toolbar","aria-label":"Sections","data-testid":"inspector-section-strip",children:s.map(c=>q.jsx(dm,{size:"compact","data-testid":`section-icon-${c.id}`,"aria-label":c.title,title:c.title,onClick:()=>n(c.id),children:q.jsx(dc,{icon:c.icon})},c.id))})}function Dun({render:t,glyph:n,subjectKey:s}){const c=uve(s)?t:null;return c?q.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none"},children:c("thumbnail")}):q.jsx(dc,{icon:n})}function XVe({subject:t}){const n=t.identity;if(!n)return null;const s=[n.kindLabel,n.note?.text].filter(Boolean).join(" — ");return n.rename.readOnly?q.jsx("div",{"data-testid":"ingest-name","data-readonly":"true",...s?{title:s}:{},style:{flex:1,minWidth:0,fontSize:"var(--volter-font-md)",fontWeight:600,color:Go.content.primary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.title}):q.jsx(jRe,{"data-testid":"ingest-name","aria-label":"Name",value:t.title,onCommit:c=>{c.trim()!==""&&n.rename.set(c)},"data-emphasis":"strong",...s?{title:s}:{},style:{flex:1,minWidth:0}})}function ajt({subject:t}){const n=t.identity;if(!n)return q.jsxs("div",{style:{padding:12},children:[q.jsx("div",{style:{fontSize:"var(--volter-font-md)",fontWeight:600},children:t.title}),t.hint&&q.jsx("div",{"data-testid":"inspector-subject-hint",style:{marginTop:4,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:t.hint})]});const s=GVe(t);return q.jsxs("div",{className:"volter-inspector-identity",style:{padding:`${G0[1]} ${G0[4]}`,borderBottom:"1px solid var(--volter-structural-divider)"},children:[q.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[q.jsx(XVe,{subject:t}),n.kindLabel&&q.jsx("span",{"data-testid":"inspector-kind-label",style:{fontSize:"var(--volter-font-base)",color:Go.content.dim,whiteSpace:"nowrap"},children:n.kindLabel}),NBe(t,"identity").map(c=>q.jsx(HVe,{action:c},c.id)),s&&q.jsx(KVe,{link:s})]}),n.document&&q.jsx("div",{"data-testid":"inspector-document-path","data-document-path":n.document.path,...n.document.title?{title:n.document.title}:{},style:{marginTop:G0[1],fontSize:"var(--volter-font-base)",color:Go.content.muted,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",direction:"rtl",textAlign:"left"},children:q.jsx("bdi",{children:n.document.path})}),t.alsoSelected?q.jsx("div",{"data-testid":"inspector-also-selected",style:{marginTop:6,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:`${t.alsoSelected+1} selected — fields edit this one, the gizmo moves all`}):null,n.note?.text&&q.jsx("div",{"data-testid":"inspector-subject-note",style:{marginTop:6,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:n.note.text})]})}function Pun({subject:t}){const n=t.identity;if(!n)return q.jsx(ajt,{subject:t});const s=GVe(t),c=n.kind?KZ(n.kind,tye(t)):tye(t),d=t.title||n.kindLabel||"",m=[n.kindLabel,n.document?.path,n.document?.title].filter(Boolean).join(" — ");return q.jsxs("div",{className:"volter-inspector-identity","data-volter-identity-layout":"properties",children:[q.jsxs("div",{className:"volter-inspector-breadcrumb",children:[q.jsx(dc,{icon:c,tone:"primary"}),q.jsx("span",{className:"volter-inspector-breadcrumb-chain","data-testid":"inspector-document-path",...n.document?{"data-document-path":n.document.path}:{},...m?{title:m}:{},children:q.jsx("bdi",{children:d})}),NBe(t,"identity").map(g=>q.jsx(HVe,{action:g},g.id))]}),q.jsxs("div",{className:"volter-inspector-datablock",children:[q.jsx("span",{className:"volter-inspector-datablock-kind","data-testid":"inspector-kind-label",...n.kindLabel?{title:n.kindLabel}:{},children:q.jsx(dc,{icon:c,tone:"primary"})}),q.jsx(XVe,{subject:t}),s&&q.jsx(KVe,{link:s})]}),t.alsoSelected?q.jsx("div",{"data-testid":"inspector-also-selected",style:{marginTop:G0[3],fontSize:"var(--volter-font-base)",color:Go.content.dim},children:`${t.alsoSelected+1} selected — fields edit this one, the gizmo moves all`}):null,n.note?.text&&q.jsx("div",{"data-testid":"inspector-subject-note",style:{marginTop:G0[3],fontSize:"var(--volter-font-base)",color:Go.content.dim},children:n.note.text})]})}function Iun({section:t}){return q.jsx("div",{"data-testid":t.testId,"data-inspector-section":t.id,children:q.jsx(qCr,{label:t.title,icon:t.icon,description:t.description,collapsible:!0,defaultOpen:t.defaultOpen??!0,children:Nje(t)})})}function Nun({subject:t}){const n=Ye.useRef(null),s=c=>{n.current?.querySelector(`[data-inspector-section="${c}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"})};return q.jsxs("div",{style:{pointerEvents:"auto"},children:[q.jsx(ajt,{subject:t}),q.jsx(sjt,{subject:t,onJump:s}),q.jsx(ojt,{subject:t}),q.jsx("div",{ref:n,children:t.sections.map(c=>q.jsx(Ye.Fragment,{children:q.jsx(Iun,{section:c})},c.id))})]})}const p_e=new Map;let Nwt=null;function Oun({subject:t}){const n=B9t(t),s=p_e.get(t.id)??Nwt,[c,d]=Ye.useState(null),m=(c&&n.some(k=>k.id===c)?c:null)??(s&&n.some(k=>k.id===s)?s:null)??n.find(k=>k.railDefault)?.id??n[0]?.id??null,g=t.sections.find(k=>k.id===m)??null,S=k=>{d(k),p_e.size>200&&p_e.clear(),p_e.set(t.id,k),Nwt=k};return q.jsx("div",{className:"volter-inspector-properties-fill",style:{pointerEvents:"auto"},children:q.jsxs("div",{className:"volter-inspector-properties","data-testid":"inspector-properties",children:[q.jsx("div",{className:"volter-inspector-properties-rail",role:"tablist","aria-orientation":"vertical","aria-label":"Sections",children:n.map((k,A)=>q.jsxs(Ye.Fragment,{children:[A>0&&k.railGroup!==n[A-1]?.railGroup?q.jsx("div",{className:"volter-inspector-properties-rail-separator","data-testid":"properties-tab-separator",role:"presentation"}):null,q.jsx(dm,{size:"compact",role:"tab","aria-selected":k.id===m,"data-testid":`properties-tab-${k.id}`,"aria-label":k.title,title:k.title,onClick:()=>S(k.id),children:q.jsx(dc,{icon:k.icon,size:"xl"})})]},k.id))}),q.jsxs("div",{className:"volter-inspector-properties-body",role:"tabpanel",children:[q.jsx(Pun,{subject:t}),q.jsx(ojt,{subject:t}),g?q.jsx("div",{"data-testid":g.testId,"data-inspector-section":g.id,children:Nje(g)}):null,t.sections.filter(k=>k.keepMounted&&k.id!==m).map(k=>q.jsx("div",{"data-inspector-section":k.id,"data-inspector-section-hidden":"true",style:{display:"none"},children:Nje(k)},k.id))]})]})})}function tye(t){const n=t.sections[0]?.icon;return n?Oje(n)===Oje(JOe)?aR:n:aR}function Run({subject:t,surface:n}){const s=mun(),c=t.sections.find(k=>k.body.kind==="preview"),d=c?.body.kind==="preview"?c.body:null,m=GVe(t),g=n?()=>IVe(n,"column"):null,S=t.identity!==null;return q.jsxs("div",{className:"volter-mini-inspector","data-testid":"inspector-panel","data-volter-inspector-presentation":"card",onPointerDown:()=>CR("inspector"),children:[s&&q.jsx(dm,{size:"compact",className:"volter-mini-inspector-minimize","data-testid":"inspector-minimize","aria-label":"Minimize inspector",title:"Minimize inspector",onClick:s.minimize,children:q.jsx(dc,{icon:b0r})}),q.jsx("div",{className:"volter-mini-inspector-preview","data-testid":"inspector-mini-preview",...g?{role:"button",tabIndex:0,"aria-label":`Expand inspector for ${t.title}`,title:`Expand inspector for ${t.title}`,onClick:g,onKeyDown:k=>{(k.key===" "||k.key==="Enter")&&(k.preventDefault(),g())}}:{},children:q.jsx(Dun,{render:d?d.render:null,glyph:tye(t),subjectKey:t.id})}),S?q.jsxs("div",{className:"volter-mini-inspector-identity",children:[q.jsx(XVe,{subject:t}),NBe(t,"identity").map(k=>q.jsx(HVe,{action:k},k.id))]}):q.jsx("div",{className:"volter-mini-inspector-identity",children:q.jsx("div",{style:{flex:1,minWidth:0,fontSize:"var(--volter-font-md)",fontWeight:600},children:t.title})}),q.jsx(sjt,{subject:t,onJump:()=>g?.()}),m&&q.jsx("div",{className:"volter-mini-inspector-actions",children:q.jsx(KVe,{link:m})})]})}function Fun({subject:t,onExpand:n,onClear:s}){const c=t.sections.find(m=>m.body.kind==="preview"),d=c?.body.kind==="preview"?c.body:null;return q.jsxs("div",{className:"volter-inspector-pill","data-testid":"inspector-pill",children:[q.jsxs("div",{role:"button",tabIndex:0,className:"volter-inspector-pill-open","aria-label":`Expand inspector for ${t.title}`,title:`Expand inspector for ${t.title}`,onClick:n,onKeyDown:m=>{(m.key===" "||m.key==="Enter")&&(m.preventDefault(),n())},children:[q.jsx("span",{className:"volter-inspector-pill-thumb","aria-hidden":"true",children:d?d.render("thumbnail"):q.jsx(dc,{icon:tye(t)})}),q.jsx("span",{className:"volter-inspector-pill-name",children:t.title})]}),s&&q.jsx(dm,{"data-testid":"inspector-fab-clear-selection","aria-label":"Clear selection",title:"Clear selection",onClick:s,children:q.jsx(dc,{icon:cLe})})]})}const __e=new Map;function Owt({subject:t,presentation:n,surface:s}){const c=t.id,d=Ye.useCallback(m=>{m&&(m.scrollTop=__e.get(c)??0)},[c]);return n==="card"?q.jsx(Run,{subject:t,...s?{surface:s}:{}}):q.jsx(Jye,{name:"Inspector",hideHeader:!0,className:"volter-content-frost","data-testid":"inspector-panel","data-volter-inspector-presentation":n,onPointerDown:()=>CR("inspector"),style:{overflowY:"auto"},ref:d,onScroll:m=>{__e.size>200&&__e.clear(),__e.set(c,m.currentTarget.scrollTop)},children:n==="properties"?q.jsx(Oun,{subject:t}):q.jsx(Nun,{subject:t})})}const Mun=250;let cjt=0,UY=null;const wme=new Set;function jun(){cjt++;for(const t of wme)t()}function YVe(t){return wme.add(t),UY===null&&(UY=setInterval(jun,Mun)),()=>{wme.delete(t),wme.size===0&&UY!==null&&(clearInterval(UY),UY=null)}}function Lun(){return cjt}function ljt(t){return Ye.useSyncExternalStore(YVe,t,t)}function Bun({presentation:t,surface:n}){const s=yVe(),c=q.jsx("div",{"data-testid":"no-authoring-note",style:{padding:12,color:Go.semantic.warning,fontSize:"var(--volter-font-md)",lineHeight:1.5},children:s!==null?q.jsxs(q.Fragment,{children:[q.jsx("strong",{children:"Nothing to author."})," ",s]}):q.jsxs(q.Fragment,{children:[q.jsx("strong",{children:"Nothing to author."})," This root's adapter publishes no inspector surface, so there is nothing here to describe or edit. The root is still hosted, sized, and disposed; play it in the Game tab."]})}),d=n?q.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"2px 4px"},children:q.jsx(dm,{size:"compact","data-testid":"inspector-expand","aria-label":"Expand inspector to side panel",title:"Expand inspector to side panel",onClick:()=>IVe(n,"column"),children:q.jsx(dc,{icon:VTt})})}):null;return t==="card"?q.jsxs("div",{className:"volter-mini-inspector","data-testid":"inspector-panel","data-volter-inspector-presentation":"card",onPointerDown:()=>CR("inspector"),children:[d,c]}):q.jsx(Jye,{name:"Inspector (nothing to author)",hideHeader:!0,className:"volter-content-frost","data-testid":"inspector-panel",onPointerDown:()=>CR("inspector"),children:c})}function ZVe(){const t=Yv();ljt(()=>Kwr());const n=WVe(t),{adapter:s}=Cm(t);return n.available?s.capabilities.inspectorFields?q.jsx(Owt,{subject:n.subject,presentation:n.presentation,surface:n.surface}):n.subject.identity!==null||n.subject.sections.length>0?q.jsx(Owt,{subject:n.subject,presentation:n.presentation,surface:n.surface}):l$()?q.jsx(Bun,{presentation:n.presentation,surface:n.surface}):null:null}function $un({surface:t}){return q.jsx(Jye,{name:"Inspector",hideHeader:!0,"data-testid":"inspector-shown-as-card",children:q.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"var(--volter-space-3)",padding:"var(--volter-space-4)",color:Go.content.muted,fontSize:"var(--volter-font-md)",lineHeight:1.5},children:[q.jsx("span",{children:"The inspector for this view is shown as a card in the viewport."}),q.jsx(Ms,{variant:"secondary",size:"compact","data-testid":"inspector-dock-here",onClick:()=>IVe(t,"column"),children:"Show it here"})]})})}const ujt=260,fjt=360,see=16,qun=200,djt=220,Rje=54,zun=52,Vun={maxWidth:ujt,maxHeight:fjt,minSize:qun,margin:see},Uun={right:see,bottom:see},Jun={maxWidth:djt,maxHeight:Rje,minSize:Rje,margin:see};function Wun(t,n,s){return pun(t,s?Jun:Vun,n)}function Hun(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot),Ye.useSyncExternalStore(o2,K1,K1),Ye.useSyncExternalStore(K0e,qQ,qQ),Ye.useSyncExternalStore(dun,Dwt,Dwt);const n=fun(),[s,c]=Ye.useState(!1),{subject:d}=WVe(t),m=Ye.useCallback(()=>{oD();const{adapter:S}=Cm(t);c0(S,[])||t.select(null)},[t]),g=n?Wun(n,Uun,s):null;return q.jsx("div",{style:{position:"absolute",...g?{left:g.left,top:g.top,width:g.width,height:g.height}:{right:see,bottom:zun,width:s?djt:ujt,height:s?Rje:fjt},display:"flex",alignItems:"flex-end",zIndex:PI.sticky,pointerEvents:"none"},children:q.jsx("div",{"data-testid":"compact-inspector-card",style:{display:"flex",width:"100%",...s?{height:"100%"}:{maxHeight:"100%"},borderRadius:s?999:"var(--dv-group-border-radius, 8px)",overflow:s?"hidden":"clip",border:"var(--dv-floating-border, 1px solid var(--volter-boundary-default))",boxShadow:"var(--dv-floating-box-shadow, var(--volter-shadow-lg))",background:"var(--dv-group-view-background-color, var(--volter-bg-1))",pointerEvents:"auto"},children:s?q.jsx(Fun,{subject:d,onExpand:()=>c(!1),onClear:m}):q.jsx(_un,{actions:{minimize:()=>c(!0)},children:q.jsx(ZVe,{})})})})}let Gun=1;const Rwt=new WeakMap;function Kun(t){if(!t)return 0;const n=Rwt.get(t);if(n!==void 0)return n;const s=Gun++;return Rwt.set(t,s),s}function QVe(t){const n=Y0(t);return n instanceof hy?n.childAdapters().find(c=>c.kind==="three"&&c.adapter.capabilities.transform)?.worldId??null:null}function Xun(t){const n=Y0(t);if(!(n instanceof hy))return!0;if(!n.childAdapters().some(d=>d.kind==="three"))return!1;const c=QVe(t);return c===null?!0:!oq(c)}const Yun="/__editor/collaboration",Fwt=["participants","presence","messages","revisions","audit","team-test"];let KI=null;const Fje=new Set,Mje=new Set;let Mwt=0;function m_e(t){KI=t,VAt(t.revision);for(const n of Fje)n(t);if(t.revision>Mwt){Mwt=t.revision;for(const n of Mje)n(t.revision)}}async function jje(t,n){const s=await fetch(`${Yun}${t}`,n);if(s.status!==204&&of(s,`Collaboration request ${t} failed`),!s.ok){const c=await s.json().catch(()=>null);throw new Error(typeof c?.error=="string"?c.error:"Collaboration request failed.")}return s.status===204?void 0:await s.json()}function Zun(){return KI}let h_e=null,g_e=0;function pjt(){if(g_e++,!h_e){const n=jD(),s=g=>{try{m_e(JSON.parse(g.data))}catch{}};let c=!1;const d=()=>{c||(c=!0,jje("").then(m_e).catch(()=>{}).finally(()=>{c=!1}))},m=g=>{try{const S=JSON.parse(g.data);if(!KI||S.sequence<=KI.sequence)return;if(S.channel!=="presence"){d();return}const k=S.payload;if(typeof k.participantId!="string"||!k.presence)return;m_e({...KI,sequence:S.sequence,participants:KI.participants.map(A=>A.participantId===k.participantId?{...A,presence:k.presence}:A)})}catch{}};n.addEventListener("collaboration-snapshot",s);for(const g of Fwt)n.addEventListener(`collaboration-${g}`,m);jje("").then(m_e).catch(()=>{}),h_e=()=>{n.removeEventListener("collaboration-snapshot",s);for(const g of Fwt)n.removeEventListener(`collaboration-${g}`,m);n.close()}}let t=!1;return()=>{t||(t=!0,g_e--,g_e<=0&&(g_e=0,h_e?.(),h_e=null))}}function Qun(t){Fje.add(t),KI&&t(KI);const n=pjt();return()=>{Fje.delete(t),n()}}function Kxn(t){Mje.add(t);const n=pjt();let s=!1;return()=>{s||(s=!0,Mje.delete(t),n())}}async function Xxn(t){await jje("/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({participantId:Q0e,presence:t})})}const jwt=500,_jt=()=>{};function efn(t,n){if(n===_jt)return{hierarchy:t.hierarchy,isComponentRoot:()=>!1,isBuiltInternal:()=>!1,...t.hasInternals?{hasInternals:A=>t.hasInternals(A)}:{},...t.internalChildren?{internalChildren:A=>t.internalChildren(A)}:{}};const s=new Map,c=A=>{const F=s.get(A);if(F!==void 0)return F;const D=[];let J=A,$=!1,G=0;for(;J!==null&&G++<jwt;){const se=s.get(J);if(se!==void 0){$=se;break}D.push(J);const pe=n(J);if(pe?.componentRoot!==void 0)break;if(pe?.builtInternal===!0){$=!0;break}if(pe?.authoredEntity===!0)break;J=t.hierarchy.node(J)?.parentId??null}for(const se of D)s.set(se,$);return $},d=A=>n(A)?.componentRoot!==void 0,m=(A,F=0)=>{if(F>jwt)return[];const D=[];for(const J of A.childIds){if(!c(J)){D.push(J);continue}const $=t.hierarchy.node(J);$&&D.push(...m($,F+1))}return D},g=A=>A.childIds.filter(F=>c(F)),S=A=>{if(!A)return null;const F=n(A.id)?.componentRoot,D=m(A),J=D.length===A.childIds.length&&D.every(($,G)=>$===A.childIds[G]);return F===void 0&&J?A:{...A,...F===void 0?{}:{role:"component",typeLabel:F},...J?{}:{childIds:D}}};return{hierarchy:{roots:()=>t.hierarchy.roots().flatMap(A=>c(A.id)?m(A).flatMap(F=>{const D=S(t.hierarchy.node(F));return D?[{...D,parentId:A.parentId}]:[]}):[S(A)]),node:A=>S(t.hierarchy.node(A))},isComponentRoot:d,isBuiltInternal:c,hasInternals:A=>{if(t.hasInternals?.(A)===!0)return!0;const F=t.hierarchy.node(A);return F?g(F).length>0:!1},internalChildren:A=>{const F=t.internalChildren?.(A),D=t.hierarchy.node(A),J=D?g(D).flatMap($=>{const G=S(t.hierarchy.node($));return G?[{...G,parentId:A}]:[]}):[];return F===void 0?J.length>0?J:void 0:[...F,...J]}}}function tfn(t,n,s){for(const c of n)c.more||s(c.node.id)&&t.set(c.node.id,!1);return t}function rfn(t,n){for(const s of t.childAdapters())if(t.groupNodeId(s.worldId)===n)return s.worldId;return t.ownerOf(n)}function nfn(t,n,s){if(!(t instanceof hy))return!0;const c=rfn(t,s);return c===null?!1:n.every(d=>t.ownerOf(d)===c)}const ifn="This world's structure comes from its own source, which the editor can't rewrite here — reparenting is not wired for it.",ofn="That row is part of a component instance's own output, not authored content. Drop onto the instance itself to place relative to it.";function Lwt(t){return t.hasStructureWritePath?t.targetIsInternal?ofn:null:ifn}const sfn=400,mjt="volter.projectLocalState";let JB=null,JY=null,ER={},Lje=!1,WB=null;function hjt(){return Em()}function cte(){const t=hjt();if(JB===t)return Promise.resolve();if(JY)return JY.then(()=>cte());const n=c$e(),s=n?Promise.resolve(afn(n.get(mjt))):zZr();return JY=Promise.all([s,G4t()]).then(([c])=>{ER=c&&typeof c=="object"?{...c}:{},JB=t}).catch(()=>{ER={},JB=t}).finally(()=>{JY=null}),JY}function lte(){return JB===hjt()}function Cve(t){if(lte())return ER[t]}function eUe(t=!1){if(WB!==null&&(clearTimeout(WB),WB=null),!Lje)return;Lje=!1;const n=c$e();n?n.store(mjt,JSON.stringify(ER)):VZr(ER,{leaving:t})}function afn(t){if(!t)return{};try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}}function Eve(t,n){const s=()=>{ER={...ER,[t]:n},Lje=!0,WB!==null&&clearTimeout(WB),WB=setTimeout(eUe,sfn)};lte()?s():cte().then(s)}function cfn(){eUe(!0)}IC(()=>{wf()&&cte()});r3r(()=>{JB!==null&&(eUe(),JB=null,wf()&&cte())});typeof window<"u"&&window.addEventListener("pagehide",cfn);const gjt="hierarchyExpansion",O$=new Map;let Bwt=!1;function tUe(){if(Bwt||!lte())return;Bwt=!0;const t=Cve(gjt)??{};for(const[n,s]of Object.entries(t))O$.set(n,new Map(Object.entries(s)))}function yjt(){const t={};for(const[n,s]of O$)t[n]=Object.fromEntries(s);Eve(gjt,t)}function lfn(t,n){return tUe(),O$.get(t)?.get(n)}function $wt(t,n){tUe();let s=O$.get(t);s||(s=new Map,O$.set(t,s));for(const[c,d]of n)s.set(c,d);yjt()}function ufn(t){tUe(),O$.delete(t),yjt()}let rye=null;const Bje=new Set;function ffn(){return rye}function dfn(t){return Bje.add(t),()=>{Bje.delete(t)}}function vjt(t){if(rye!==t){rye=t;for(const n of Bje)n()}}function pfn(t){rye===t&&vjt(null)}const _fn=500,qwt=new Set,aee=new Set;function Yxn(t){return aee.has(t)}function Zxn(t){return aee.delete(t)?!1:(aee.add(t),!0)}function Qxn(){return aee}function mfn(t,n=aee){if(typeof t.internalChildren!="function"||n.size===0)return{hierarchy:t.hierarchy,isInternal:()=>!1,revealRootIds:qwt,internalIds:qwt};const s=new Map,c=new Map,d=new Set,m=(S,k)=>{if(k>_fn||s.has(S))return;const A=t.internalChildren(S)??[];if(A.length!==0){s.set(S,A.map(F=>F.id));for(const F of A)c.has(F.id)||(c.set(F.id,F),m(F.id,k+1))}};for(const S of n)m(S,0),s.has(S)&&d.add(S);const g=S=>{if(!S)return null;const k=s.get(S.id);return k?{...S,childIds:[...S.childIds,...k]}:S};return{hierarchy:{roots:()=>t.hierarchy.roots().map(S=>g(S)),node:S=>g(c.get(S)??t.hierarchy.node(S))},isInternal:S=>c.has(S),revealRootIds:d,internalIds:new Set(c.keys())}}function hfn(t,n){for(const s of n.internalIds)t.set(s,!1);for(const s of n.revealRootIds)t.set(s,!0);return t}const nye=20,gfn="__more__:",bjt=500;function yfn(t,n,s){return t?Math.max(nye,n.get(s)??nye):Number.POSITIVE_INFINITY}function vfn(t,n,s,c,d){return{node:{id:`${gfn}${t}`,label:"",kind:"object",parentId:s,childIds:[]},depth:n,pathKey:`${t}/__more__`,hasChildren:!1,hiddenByCollapse:c,more:{parentPathKey:t,hidden:d}}}function zwt(t,n,s=new Map,c=!1){const d=[],m=new Set,g=(S,k,A,F)=>{if(m.has(S.id)||k>bjt)return;m.add(S.id);const D=S.childIds.length>0;d.push({node:S,depth:k,pathKey:A,hasChildren:D,hiddenByCollapse:F});const J=n.has(A);if(c&&J)return;const $=F||J,G=Math.min(S.childIds.length,yfn(c,s,A));for(let se=0;se<G;se++){const pe=t.node(S.childIds[se]);pe&&g(pe,k+1,`${A}.${se}`,$)}c&&S.childIds.length>G&&d.push(vfn(A,k+1,S.id,$,S.childIds.length-G))};return t.roots().forEach((S,k)=>{g(S,0,`r${k}`,!1)}),d}function bfn(t,n,s){if(s.size===0)return n;const c=new Map;for(let k=0;k<n.length;k+=1){const A=n[k];A.more||c.set(A.node.id,k)}const d=[];for(const k of s){const A=c.get(k),F=t.node(k);if(A===void 0||F===null)continue;const D=n[A];let J=A+1;for(;J<n.length&&n[J].depth>D.depth;)J+=1;d.push({start:A,end:J,row:D,node:F})}if(d.length===0)return null;d.sort((k,A)=>k.start-A.start);const m=[];for(const k of d){const A=m.at(-1);A&&k.start<A.end||m.push(k)}for(const k of s){const A=c.get(k);if(A!==void 0&&!m.some(({start:F,end:D})=>A>=F&&A<D))return null}const g=k=>{const A=[],F=new Set;let D=!0;const J=($,G,se)=>{if(D){if(F.has($.id)||G>bjt){D=!1;return}F.add($.id),A.push({node:$,depth:G,pathKey:se,hasChildren:$.childIds.length>0,hiddenByCollapse:!1});for(let pe=0;pe<$.childIds.length;pe+=1){const ue=t.node($.childIds[pe]);ue&&J(ue,G+1,`${se}.${String(pe)}`)}}};return J(k.node,k.row.depth,k.row.pathKey),D?A:null},S=[...n];for(let k=m.length-1;k>=0;k-=1){const A=m[k],F=g(A);if(F===null)return null;S.splice(A.start,A.end-A.start,...F)}return S}function Vwt(t){return`${t.pathKey}:${t.node.id}`}function Sfn(t,n,s,c,d){const m=Math.max(0,Math.floor(n/c)-d),g=Math.ceil(s/c)+d*2,S=Math.min(t,m+g);return{start:m,end:S}}function xfn(t,n){if(t.length!==n.length)return!1;for(let s=0;s<t.length;s+=1)if(!Object.is(t[s],n[s]))return!1;return!0}class DOe{#e=null;#t;computeCount=0;get current(){return this.#t}read(n,s){if(this.#e!==null&&xfn(this.#e,n))return this.#t;const c=s(this.#t);return this.#e=n,this.#t=c,this.computeCount+=1,c}}class wfn{#e=new DOe;#t=new DOe;#i=new DOe;#n;#r=Number.NEGATIVE_INFINITY;structural(n,s){const[c,d]=n;if(c===this.#n&&typeof d=="number"&&d<this.#r&&this.#e.current!==void 0)return this.#e.current;const m=this.#e.read(n,s);return c!==this.#n&&(this.#n=c,this.#r=Number.NEGATIVE_INFINITY),typeof d=="number"&&(this.#r=Math.max(this.#r,d)),m}collapsed(n,s){return this.#t.read(n,s)}browse(n,s){return this.#i.read(n,s)}get counts(){return{structural:this.#e.computeCount,collapsed:this.#t.computeCount,browse:this.#i.computeCount}}}function Tfn(t){const n=new Map,s=new Map;for(const c of t){if(c.more)continue;n.set(c.pathKey,c.node.id);const d=s.get(c.node.id);d?d.push(c.pathKey):s.set(c.node.id,[c.pathKey])}return{nodeIdByPathKey:n,pathKeysByNodeId:s}}function rUe(t){const n=t.split("."),s=[];for(let c=1;c<n.length;c++)s.push(n.slice(0,c).join("."));return s}function Uwt(t,n){const s=new Set;for(const c of n)for(const d of t.pathKeysByNodeId.get(c)??[])for(const m of rUe(d)){const g=t.nodeIdByPathKey.get(m);g&&s.add(g)}return s}function Cfn(t,n){const s=new Map;for(const c of n)for(const d of t.pathKeysByNodeId.get(c)??[]){const m=d.split(".");let g=m[0];for(let S=1;S<m.length;S++){const k=Number(m[S]);Number.isFinite(k)&&s.set(g,Math.max(s.get(g)??0,k+1)),g=`${g}.${m[S]}`}}return s}function Efn(t){return t.size===0?"":[...t].sort((n,s)=>n[0]<s[0]?-1:n[0]>s[0]?1:0).map(([n,s])=>`${n}=${String(s)}`).join(",")}const kfn=["position","rotation","scale"];function Afn(t){const n=t.role==="component"&&!!t.typeLabel;return{label:t.label,typeSuffix:n?t.typeLabel:null}}const nUe={locked:!1};function Dfn(t){let n;for(const s of kfn){const c=t(s);if(!c||c.writable)return nUe;s==="position"&&(n=c.reason)}return n===void 0?{locked:!0}:{locked:!0,reason:n}}class Pfn{entries=new Map;source=null;version=Number.NaN;computed=0;get computeCount(){return this.computed}summaryFor(n,s,c){(this.source!==n||this.version!==s)&&(this.entries.clear(),this.source=n,this.version=s);const d=this.entries.get(c);if(d)return d;this.computed++;const m=n.transforms?.editability,g=m?Dfn(S=>m(c,S)):nUe;return this.entries.set(c,g),g}}const Ifn={draggable:!0,renamable:!0,writable:!0,searchable:!0},Nfn={draggable:!1,renamable:!1,writable:!0,searchable:!0},Ofn={draggable:!1,renamable:!1,writable:!1,searchable:!1};function iUe(t){return t.internal?Ofn:t.structural?Nfn:Ifn}function Rfn(t){return!t||t.length===0?null:{count:t.length,tooltip:t.map(n=>n.message).join(`
1403
1403
  `),codes:t.map(n=>n.code)}}class Ffn{entries=new Map;source=null;version=Number.NaN;computed=0;get computeCount(){return this.computed}badgeFor(n,s,c){(this.source!==n||this.version!==s)&&(this.entries.clear(),this.source=n,this.version=s);const d=this.entries.get(c);if(d!==void 0)return d;this.computed++;const m=n.diagnosticsFor?Rfn(n.diagnosticsFor(c)):null;return this.entries.set(c,m),m}}const Tme=new Map;function ewn(t){return Tme.set(t.documentId,t),()=>{Tme.get(t.documentId)===t&&Tme.delete(t.documentId)}}function Mfn(t){return Tme.get(t)??null}function jfn(t,n){const s=[...n];return s.length===0||s.some(c=>t.hierarchy.node(c)===null)?null:t.rects?{worldId:null,kind:"dom"}:s.every(c=>t.hierarchy.object3D?.(c)!=null)?{worldId:null,kind:"three"}:null}function Lfn(t,n){const s=t.childAdapters();let c=null;for(const d of n){const m=s.find(g=>t.groupNodeId(g.worldId)===d)??s.find(g=>t.ownerOf(d)===g.worldId);if(!m||c&&c.worldId!==m.worldId)return null;c=m}return c?{worldId:c.worldId,kind:c.kind,adapter:c.adapter}:null}function Bfn(t,n){const s=[...n];if(s.length===0)return null;if(t instanceof hy)return Lfn(t,s);const c=jfn(t,s);return c?{...c,adapter:t}:null}function $fn(t,n){return!n||n.worldId!==null&&oq(n.worldId)?!1:n.kind!=="three"||n.worldId===null?!0:QVe(t)===n.worldId}const XZ=new Map;let Sjt=0;const $je=new Set;function Jwt(){Sjt++;for(const t of[...$je])t()}function twn(t,n){const s={store:n};return XZ.set(t,s),Jwt(),()=>{XZ.get(t)===s&&(XZ.delete(t),Jwt())}}function qfn(t){return t===null?null:XZ.get(t)?.store??null}function rwn(t){for(const[n,s]of XZ)if(s.store===t)return n;return null}function nwn(t){return $je.add(t),()=>{$je.delete(t)}}function iwn(){return Sjt}const rB=new Map;function own(t){return rB.set(t,(rB.get(t)??0)+1),()=>{const n=(rB.get(t)??1)-1;n>0?rB.set(t,n):rB.delete(t)}}const xjt={count:0,surface:null,visible:!1};function zfn(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function Wwt(t){switch(t){case"scene":case"world":return{kind:"composition"};case"story":return{kind:"story"};case"asset":return{kind:"artifact"};case"document":return{kind:"data"};default:return{kind:"unknown"}}}function Vfn(t){if(t===null)return{kind:"unknown"};const n=l0().find(d=>d.descriptor.id===t);if(!n)return{kind:"unknown"};const s=n.descriptor.presentation?.()??null,c=Wwt(s?.kind);return c.kind!=="unknown"?c:Wwt(n.descriptor.kind)}function Ufn(t){return t instanceof hy?t.childAdapters().some(n=>n.kind==="three"):!t.rects&&typeof t.hierarchy.object3D=="function"}function qje(t,n,s,c){const d=Y0(t),m=Xun(t)&&Ufn(d)?"three":null,g=t.playState,S=t.selectedEntityIds.size;if(S===0)return{documentId:n,chrome:c,subject:s,surface:m,selection:xjt,play:g};const k=Bfn(d,t.selectedEntityIds);return{documentId:n,chrome:c,subject:s,surface:m,selection:{count:S,surface:zfn(k?.kind),visible:$fn(t,k)},play:g}}function Jfn(t,n,s="document"){const c=Vfn(n);if(rB.has(n))return{...qje(t,n,c,s),surface:"canvas"};const d=Mfn(n);if(d===null){const g=l0().find(S=>S.descriptor.id===n)?.descriptor.kind;return g!==void 0&&g!=="game"&&g!=="scene"&&g!=="world"?{documentId:n,chrome:s,subject:c,surface:null,selection:xjt,play:t.playState}:qje(t,n,c,s)}const m=d.selection().length;return{documentId:n,chrome:s,subject:c,surface:"three",selection:{count:m,surface:m>0?"three":null,visible:!0},play:t.playState}}function Wfn(t){const n=Pp();return n!==null?Jfn(t,n):qje(t,null,{kind:"unknown"},"document")}function Hfn(t){return qfn(Pp())??t}function Gfn(t){return t.surface!=="three"?!1:t.selection.count===0?!0:t.selection.surface==="three"&&t.selection.visible}function swn(t){return Gfn(t)?lCt(t.documentId)===null?"gizmo":"modal":"none"}function awn(t){return t.surface==="three"&&t.selection.count>0&&t.selection.surface==="three"&&t.selection.visible}function wjt(t){return t.chrome==="embedded"||t.subject.kind==="story"||t.subject.kind==="artifact"}function cwn(t,n){return wjt(t)?!0:t.subject.kind==="data"&&!n}function lwn(t){return t.chrome==="document"&&wjt(t)}let Cme=null;const iye=new Set;function uwn(t){Cme=t;for(const n of iye)n();return()=>{if(Cme===t){Cme=null;for(const n of iye)n()}}}function oye(){return Cme}function Kfn(t){return iye.add(t),()=>{iye.delete(t)}}const POe="application/x-editor-asset",IOe="application/x-hierarchy-reorder";function NOe(t){const s=t?.querySelector(".volter-tree-row")?.getBoundingClientRect().height??0;if(s>0)return Math.round(s);const c=t?Number.parseFloat(getComputedStyle(t).getPropertyValue("--volter-tree-row-height")):Number.NaN;return Number.isFinite(c)&&c>0?c:i4t.treeRow}const hZ="var(--volter-tree-indent)";function Eme(t){return`calc(${hZ} * ${t})`}const Hwt=5;function Xfn(t,n,s){const c=[];for(let d=0;d<t;d++)c.push({column:d,starts:n===d,ends:s<=d});return c}const Yfn=[],Zfn=6,Qfn=8,edn=2400;function tdn(t){const n=new Map,s=d=>{const m=d.childIds.flatMap(g=>{const S=t.node(g);return S?.role==="document"&&S.secondaryLabel?S.childIds:[g]});return m.length===d.childIds.length&&m.every((g,S)=>g===d.childIds[S])?null:m},c=d=>{let m=n.get(d.id);return m===void 0&&(m=s(d),n.set(d.id,m)),m===null?d:{...d,childIds:m}};return{...t,roots:()=>{const d=t.roots();return d.length===1&&d[0]?.role==="document"?d[0].childIds.map(m=>t.node(m)).filter(m=>m!==null).map(c):d.map(c)},node:d=>{const m=t.node(d);return m?c(m):null}}}const rdn=300,ndn=new Map,idn={folder:uee,document:fLe,story:GTt,component:GB,instance:WOe,boundary:fee};function odn(t){return t.role==="root"?KZ(t.kind,nCt):t.role==="entity"||t.role==="element"?KZ(t.kind):(t.role?idn[t.role]:void 0)??KZ(t.kind)}const Tjt=new Set(["folder","root","document","story","boundary"]);function sdn(t,n,s){let c=t,d=0;for(;c&&d++<1e3;){if(n.includes(c))return!0;c=s.hierarchy.node(c)?.parentId??null}return!1}function adn(t,n){return n===null?t.hierarchy.roots().map(s=>s.id):t.hierarchy.node(n)?.childIds??[]}function oUe(t,n){if(!(t instanceof hy))return null;for(const s of t.childAdapters())if(t.groupNodeId(s.worldId)===n){const c=t.inspector?.get(n,"zOrder");return{zOrder:typeof c=="number"?c:s.zOrder,worldId:s.worldId,role:s.role,kind:s.kind,provenance:s.adapter.provenance??null}}return null}function kme(t,n){return oUe(t,n)!==null}function sUe(t,n){return t instanceof hy&&t.isOrganizationNode(n)}function Cjt(t,n){if(!(t instanceof hy))return t;const s=t.ownerOf(n);return t.childAdapters().find(c=>c.worldId===s)?.adapter??t}function Gwt(t,n){return n===void 0?t.structure!==void 0:Cjt(t,n).structure!==void 0}function cdn(t,n,s){return kme(t,n)||sUe(t,n)||s!==void 0&&Tjt.has(s)}function ldn(t,n){const s=new Map,c=[],d=[],m=new Map;for(const g of t)g.more||m.set(g.node.id,g.node.kind);for(const g of t){if(g.more)continue;const S=g.depth===0?0:c[g.depth-1]??0,k=g.depth===0?null:d[g.depth-1],A=cdn(n,g.node.id,g.node.role),F=S+(A?0:1);c[g.depth]=F,c.length=g.depth+1,d[g.depth]=g.node,d.length=g.depth+1;const D=g.node.childIds.length>0&&g.node.childIds.every(J=>ijt(m.get(J)));s.set(g.node.id,g.node.defaultExpanded??(!D&&(A||F<=1||k?.childIds.length===1)))}return s}function udn(t,n,s){const c=new Set;for(const d of t)if(!(d.more||!iUe({structural:!1,internal:s(d.node.id)}).searchable)&&d.node.label.toLowerCase().includes(n)){c.add(d.pathKey);for(const m of rUe(d.pathKey))c.add(m)}return c}function fdn(t,n){const s=new Map(t);for(const[c,d]of n)s.set(c,Math.max(s.get(c)??0,d));return s}function ddn({value:t,onChange:n}){const s=Ye.useRef(null);return q.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flex:`0 1 var(${_dn}, ${pdn}px)`,minWidth:mdn},children:[q.jsx(dc,{icon:NTt,"aria-hidden":"true",style:{position:"absolute",left:hdn,pointerEvents:"none",color:"var(--volter-text-1)",fontSize:"var(--volter-icon-lg)"}}),q.jsx(Zm,{ref:s,type:"text","data-testid":"ingest-search",placeholder:"Search",className:"volter-input",value:t,onChange:c=>n(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(c.stopPropagation(),t!==""?n(""):s.current?.blur())},style:{flex:1,minWidth:0,paddingLeft:`var(${ydn}, ${gdn}px)`,paddingRight:vdn}})]})}const pdn=64,_dn="--volter-hierarchy-search-basis",mdn=56,hdn=2,gdn=21,ydn="--volter-hierarchy-search-text-inset",vdn=2;function bdn({onCollapseAll:t,onResetExpansion:n,onExpandAll:s}){const[c,d]=Ye.useState(!1),m=Ye.useRef(null);return q.jsxs("div",{ref:m,style:{position:"relative",flexShrink:0},children:[q.jsx(dm,{title:"View","aria-label":"View","aria-haspopup":"menu","aria-expanded":c,"data-testid":"hierarchy-view-menu",onClick:()=>d(g=>!g),variant:"secondary",size:"compact",children:q.jsx(dc,{icon:XTt,"aria-hidden":"true",style:{fontSize:"var(--volter-icon-xs)"}})}),c&&q.jsxs(fN,{autoFocusFirst:!0,dismissBoundaryRef:m,onDismiss:()=>d(!1),style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:170},children:[q.jsx(Jc,{"data-testid":"hierarchy-collapse-all",onSelect:()=>{t(),d(!1)},children:"Collapse All"}),q.jsx(Jc,{"data-testid":"hierarchy-reset-expansion",onSelect:()=>{n(),d(!1)},children:"Reset Openness"}),q.jsx(Jc,{"data-testid":"hierarchy-expand-all",onSelect:()=>{s(),d(!1)},children:"Expand All"})]})]})}function Sdn({slot:t,search:n,setSearch:s,adapter:c,createTargetId:d,onCollapseAll:m,onResetExpansion:g,onExpandAll:S}){const k=q.jsxs(q.Fragment,{children:[q.jsx(ddn,{value:n,onChange:s}),q.jsx(bdn,{onCollapseAll:m,onResetExpansion:g,onExpandAll:S}),q.jsx(wdn,{adapter:c,parentId:d})]});return t?r2.createPortal(q.jsx("div",{"data-testid":"hierarchy-header-controls",style:{display:"flex",alignItems:"center",gap:G0[1],height:"100%",minWidth:0},children:k}),t):q.jsx(n$,{label:"Hierarchy controls",compact:!0,style:{gap:G0[2]},children:k})}function xdn({state:t,adapter:n,store:s,isGroupNode:c,isInternal:d,onRename:m,onClose:g}){const S=Ye.useRef(null),[k,A]=Ye.useState({left:t.x,top:t.y});Ye.useLayoutEffect(()=>{const Yr=S.current;if(!Yr)return;const en=Yr.getBoundingClientRect();A(W3t({top:t.y,left:t.x,width:en.width,height:en.height}))},[t.x,t.y]);const[F,D]=Ye.useState(!1),J=Ye.useRef(!1);Ye.useEffect(()=>{F&&(J.current=!1)},[F]),Ye.useEffect(()=>{const Yr=ii=>{S.current&&!S.current.contains(ii.target)&&g()},en=ii=>{ii.key==="Escape"&&g()};return document.addEventListener("mousedown",Yr),document.addEventListener("keydown",en),()=>{document.removeEventListener("mousedown",Yr),document.removeEventListener("keydown",en)}},[g]);const $=n.hierarchy.node(t.nodeId);if(!$)return null;const G=n.structure?.creatableKinds?.(t.nodeId)??[],pe=Cjt(n,t.nodeId).structure,ue=!!pe,Ce=n.inspector?.get(t.nodeId,"name")!==void 0,De=n.inspector?.get(t.nodeId,"locked")!==void 0,Pe=n.inspector?.get(t.nodeId,"locked")===!0,be=n.inspector?.get(t.nodeId,"visible")!==void 0,X=n.inspector?.get(t.nodeId,"visible")!==!1,we=n.inspector?.editability?.(t.nodeId,"locked"),qe=n.inspector?.editability?.(t.nodeId,"visible"),bt=De&&(we?.writable??!0),Pt=be&&(qe?.writable??!0),Wt=[...Hfn(s).selectedEntityIds],zt=Wt.includes(t.nodeId)?Wt:[t.nodeId],ft=Y3r(CPt(n,t.nodeId)),tr=pe?.copy?"Copy needs source-addressable entities from one world.":ft,Qt=pe?.paste?"Copy or cut a source-addressable entity in this world first.":ft,Tt=[],vn=iUe({structural:c,internal:d});if(d&&$.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[$.parentId]),g()}}),!c&&vn.writable){Tt.push({label:"Rename",testId:"hierarchy-context-menu-rename",...Ce?{}:{disabledReason:ft},action:()=>{m(t.nodeId),g()}}),Tt.push({label:"Cut",testId:"hierarchy-context-menu-cut",...pe?.cut&&(n.structure?.canCopy?.(zt)??!0)?{}:{disabledReason:tr},action:()=>{a0e(n,zt),g()}}),Tt.push({label:"Copy",testId:"hierarchy-context-menu-copy",...pe?.copy&&(n.structure?.canCopy?.(zt)??!0)?{}:{disabledReason:tr},action:()=>{s0e(n,zt),g()}}),Tt.push({label:"Paste",testId:"hierarchy-context-menu-paste",...pe?.paste&&(n.structure?.canPaste?.($.parentId)??!0)?{}:{disabledReason:Qt},action:()=>{c0e(n,$.parentId),g()}}),Tt.push({label:"Duplicate",testId:"hierarchy-context-menu-duplicate",...ue?{}:{disabledReason:ft},action:()=>{Wt.length>1&&Wt.includes(t.nodeId)?bve(s):r0e(n,t.nodeId).ack,g()}}),pe?.group&&Wt.length>1&&Wt.includes(t.nodeId)&&Tt.push({label:"Group Selection",testId:"hierarchy-context-menu-group",action:()=>{o0e(n,Wt).ack,g()}}),pe?.ungroup&&pe.canUngroup?.(t.nodeId)&&Tt.push({label:"Ungroup",testId:"hierarchy-context-menu-ungroup",action:()=>{_$e(n,t.nodeId).ack,g()}}),pe?.wrap&&Tt.push({label:"Wrap",testId:"hierarchy-context-menu-wrap",action:()=>{n0e(n,t.nodeId),g()}}),pe?.unwrap&&Tt.push({label:"Unwrap",testId:"hierarchy-context-menu-unwrap",action:()=>{i0e(n,t.nodeId),g()}}),$.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[$.parentId]),g()}}),Tt.push({label:be&&!X?"Show":"Hide",...Pt?{}:{disabledReason:qe?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"visible",!X),s.notifyIngestEdit(),g()}}),Tt.push({label:Pe?"Unlock":"Lock",...bt?{}:{disabledReason:we?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"locked",!Pe),s.notifyIngestEdit(),g()}});for(const Yr of f3r({nodeId:t.nodeId,store:s}))Tt.push({label:Yr.label,...Yr.color!==void 0?{color:Yr.color}:{},action:()=>{Yr.action(),g()}});Tt.push({label:"Delete",testId:"hierarchy-context-menu-delete",color:Go.semantic.danger,...ue?{}:{disabledReason:ft},action:()=>{Wt.length>1&&Wt.includes(t.nodeId)?Sve(s):n.structure.remove(t.nodeId),g()}})}return q.jsx(she,{children:q.jsxs(fN,{ref:S,"data-testid":"ingest-context-menu",style:{position:"fixed",left:k.left,top:k.top,minWidth:150,maxWidth:260,fontSize:"var(--volter-font-base)"},children:[!c&&vn.writable&&G.length>0&&q.jsxs("div",{children:[q.jsxs(Jc,{"data-testid":"hierarchy-context-menu-create",onSelect:()=>D(Yr=>!Yr),style:{justifyContent:"space-between",gap:R_[4]},children:[q.jsx("span",{children:"Create"}),q.jsx(_4t,{direction:"right",tone:"dim"})]}),F&&G.map(Yr=>q.jsx(Jc,{"data-testid":`hierarchy-context-menu-create-${Yr.kind}`,onSelect:()=>{J.current||(J.current=!0,t0e(n,Yr.kind,t.nodeId).ack,g())},style:{paddingLeft:G0[12]},children:Yr.label},Yr.kind))]}),Tt.map(Yr=>Yr.disabledReason!==void 0?q.jsx(Jc,{"data-testid":Yr.testId,"aria-disabled":"true",title:Yr.disabledReason,style:{cursor:"not-allowed",color:Go.content.dim,opacity:.7},children:Yr.label},Yr.label):q.jsx(Jc,{"data-testid":Yr.testId,onSelect:Yr.action,style:Yr.color!==void 0?{color:Yr.color}:void 0,children:Yr.label},Yr.label)),d&&q.jsx("div",{"data-testid":"hierarchy-context-menu-internal-note",style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.content.dim,maxWidth:240,lineHeight:Oht.normal},children:n.transforms?.editability?.(t.nodeId,"position")?.reason??"This rendered part has no authored source identity."}),!ue&&!d&&q.jsxs("div",{style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.semantic.warning,maxWidth:240,lineHeight:Oht.normal},children:[q.jsx("strong",{children:"Create / Delete / Reparent — not available."})," This game owns its own scene graph, so structural authoring isn't reapplicable. You can edit transform / material / visibility, or capture a subtree into the first-party editable format."]})]})})}function wdn({adapter:t,parentId:n}){const[s,c]=Ye.useState(!1),d=Ye.useRef(null),m=Ye.useRef(!1),g=t.structure?.creatableKinds?.(n)??[],S=n?t.hierarchy.node(n)?.label:null;return Ye.useEffect(()=>{if(!s)return;m.current=!1;const k=F=>{d.current&&!d.current.contains(F.target)&&c(!1)},A=F=>{F.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",k),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",A)}},[s]),g.length===0?null:q.jsxs("div",{ref:d,style:{position:"relative",flexShrink:0},children:[q.jsxs(Ms,{title:S?`Add to ${S}`:"Add","aria-label":S?`Add to ${S}`:"Add","aria-expanded":s,"data-testid":"hierarchy-add-menu",onClick:()=>c(!s),variant:s?"primary":"secondary",size:"compact",children:[q.jsx(dc,{icon:QTt,style:{fontSize:"var(--volter-font-sm)"}})," ",q.jsx(dc,{icon:uLe,style:{fontSize:"var(--volter-font-xs)"}})]}),s&&q.jsx(fN,{style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:130,maxHeight:"min(480px, 70vh)",overflowY:"auto"},children:g.map(k=>q.jsx(Jc,{"data-testid":`hierarchy-add-${k.kind}`,onSelect:()=>{m.current||(m.current=!0,t0e(t,k.kind,n??void 0).ack,c(!1))},children:k.label},k.kind))})]})}function Tdn({row:t,onReveal:n}){const s=t.more.hidden;return q.jsxs(Ms,{type:"button",variant:"ghost",className:"volter-hierarchy-more","data-testid":"ingest-row-more",onClick:()=>n(t.more.parentPathKey),style:{paddingLeft:Eme(t.depth+1)},children:["… ",s," more"]})}function Kwt(t,n){if(!n)return t;const s=t.toLowerCase(),c=n.toLowerCase(),d=[];let m=0,g=s.indexOf(c,m);if(g<0)return t;let S=0;for(;g>=0;)g>m&&d.push(t.slice(m,g)),d.push(q.jsx("mark",{"data-testid":"ingest-row-search-highlight",style:{background:Go.semantic.warning,color:Go.surface.shell,borderRadius:Go.shape.small},children:t.slice(g,g+c.length)},S++)),m=g+c.length,g=s.indexOf(c,m);return m<t.length&&d.push(t.slice(m)),d}function Ejt(t,n){return t.length===n.length&&t.every((s,c)=>s===n[c])}function Cdn(t,n){const s=t.node,c=n.node;return t.depth===n.depth&&t.pathKey===n.pathKey&&t.hasChildren===n.hasChildren&&t.hiddenByCollapse===n.hiddenByCollapse&&t.more?.parentPathKey===n.more?.parentPathKey&&t.more?.hidden===n.more?.hidden&&s.id===c.id&&s.label===c.label&&s.role===c.role&&s.secondaryLabel===c.secondaryLabel&&s.kind===c.kind&&s.typeLabel===c.typeLabel&&s.parentId===c.parentId&&Ejt(s.childIds,c.childIds)&&s.crossSurfaceId===c.crossSurfaceId&&s.crossSurfaceParentId===c.crossSurfaceParentId&&s.crossSurfaceOrder===c.crossSurfaceOrder&&s.crossSurfaceGroupLabel===c.crossSurfaceGroupLabel}function Edn(t,n){return Cdn(t.row,n.row)&&t.adapter===n.adapter&&t.store===n.store&&t.isSelected===n.isSelected&&t.isSelectionActive===n.isSelectionActive&&t.isEditing===n.isEditing&&t.isCollapsed===n.isCollapsed&&t.dropZone===n.dropZone&&t.isDragged===n.isDragged&&t.rowIndex===n.rowIndex&&t.prevDepth===n.prevDepth&&t.nextDepth===n.nextDepth&&t.isInternal===n.isInternal&&t.searchTerm===n.searchTerm&&t.lockCache===n.lockCache&&t.warningCache===n.warningCache&&t.editabilityVersion===n.editabilityVersion&&t.adapterVersion===n.adapterVersion&&t.threeRootId===n.threeRootId&&t.onToggleOpen===n.onToggleOpen&&t.onStartEditing===n.onStartEditing&&t.onContextMenu===n.onContextMenu&&t.onDragStart===n.onDragStart&&t.onClick===n.onClick&&t.onEnterScope===n.onEnterScope&&t.typeSuffixShown===n.typeSuffixShown&&t.instanceRuleShown===n.instanceRuleShown&&t.restrictionColumns===n.restrictionColumns&&t.excludeColumnShown===n.excludeColumnShown&&Ejt(t.remoteSelectionColors,n.remoteSelectionColors)}const kdn=Ye.memo(function({row:n,adapter:s,store:c,isSelected:d,isSelectionActive:m,isEditing:g,isCollapsed:S,dropZone:k,isDragged:A,rowIndex:F,prevDepth:D,nextDepth:J,isInternal:$,searchTerm:G,lockCache:se,warningCache:pe,editabilityVersion:ue,adapterVersion:Ce,onToggleOpen:De,onStartEditing:Pe,threeRootId:be,onContextMenu:X,onDragStart:we,onClick:qe,onEnterScope:bt,remoteSelectionColors:Pt,typeSuffixShown:Wt,instanceRuleShown:zt,restrictionColumns:ft,excludeColumnShown:tr}){const{node:Qt,depth:Tt,hasChildren:vn}=n,Yr=oUe(s,Qt.id),en=Yr!==null,ii=sUe(s,Qt.id),No=en||ii||Qt.role!==void 0&&Tjt.has(Qt.role),gn=iUe({structural:No,internal:$}),En=No?void 0:s.inspector?.get(Qt.id,"locked"),cs=No?void 0:s.inspector?.get(Qt.id,"name"),On=!No&&s.inspector?.get(Qt.id,"visible")!==void 0,ji=No?void 0:s.inspector?.editability?.(Qt.id,"locked"),Ja=No?void 0:s.inspector?.editability?.(Qt.id,"visible"),_a=No?void 0:s.inspector?.get(Qt.id,"renderVisible"),Pn=_a!==void 0,js=_a!==!1,fa=No?void 0:s.inspector?.editability?.(Qt.id,"renderVisible"),Nt=Pn&&(fa?.writable??!0),Bc=No?void 0:s.inspector?.get(Qt.id,"exclude"),Ni=Bc!==void 0,Dc=Bc===!0,vc=No?void 0:s.inspector?.editability?.(Qt.id,"exclude"),Tf=Ni&&(vc?.writable??!0),Np=Yr?oq(Yr.worldId):!1,Au=Yr?_Mt(Yr.worldId):!1,dl=Yr?mMt(Yr.worldId):!1,bu=en?!Np:s.inspector?.get(Qt.id,"visible")!==!1,Al=En!==void 0,Ku=En===!0,pl=Al&&(ji?.writable??!0),gs=On&&(Ja?.writable??!0),Xu=cs!==void 0,$r=Afn(Qt),Sl=No?0:s.instances?.describe(Qt.id)?.overrides.length??0,Rl=No?nUe:se.summaryFor(s,ue,Qt.id),mi=No?null:pe.badgeFor(s,ue,Qt.id),tu=No?null:oye()?.detail(s,Qt.id,c)??null,Wc=S&&vn?Qt.childIds.slice(0,Zfn).map(Ao=>s.hierarchy.node(Ao)).filter(Ao=>Ao!==null&&ijt(Ao.kind)):[];return q.jsxs("div",{className:"volter-tree-row","data-entity-name":No?void 0:Qt.label,"data-testid":"ingest-row","data-ingest-name":Qt.label,"data-node-role":Qt.role,"data-depth":Tt,"data-selected":d?"true":void 0,"data-selection-active":m?"true":void 0,"data-remotely-selected":Pt.length>0?"true":void 0,"data-dragging":A?"true":void 0,"data-row-alt":F%2===1?"true":void 0,"data-internal":$?"true":void 0,"data-muted":$||Dc||!No&&!bu?"true":void 0,draggable:gn.draggable,onDragStart:Ao=>we(Ao,Qt.id),onClick:Ao=>{if(Yr?.role==="world"&&VMe(Yr.worldId),Qt.role==="story"){const ia=s instanceof hy?s.ownerOf(Qt.id):null;ia&&VMe(ia),s.stories?.apply(Qt.id,Qt.id)}qe(Ao,Qt.id)},onDoubleClick:()=>{Qt.role==="story"?CD("story",c,{storyId:Qt.id}):Qt.role==="component"||Qt.role==="instance"||Qt.role==="boundary"?bt(Qt.id):gn.renamable&&Xu&&Pe(Qt.id)},onContextMenu:Ao=>{Ao.preventDefault(),X(Ao,Qt.id)},style:{position:"relative",paddingLeft:Eme(Tt),paddingRight:G0[2],gap:G0[2],cursor:"pointer",outline:k==="child"?`1px dashed ${Go.accent.default}`:"none",whiteSpace:"nowrap",overflow:"hidden",fontSize:"var(--volter-font-base)"},children:[k==="before"&&q.jsx(Aht,{position:"before",style:{left:Eme(Tt)}}),k==="after"&&q.jsx(Aht,{position:"after",style:{left:Eme(Tt)}}),Xfn(Tt,D,J).map(Ao=>q.jsx("span",{className:"volter-tree-indent-guide","aria-hidden":"true",style:{left:`calc(${hZ} * ${Ao.column+.5} - 0.5px)`,top:Ao.starts?Hwt:0,bottom:Ao.ends?Hwt:0}},Ao.column)),vn?q.jsx(dm,{type:"button",variant:"ghost",size:"compact","aria-label":S?`Expand ${Qt.label}`:`Collapse ${Qt.label}`,"aria-expanded":!S,"data-testid":"ingest-row-caret",onClick:Ao=>{Ao.stopPropagation(),De(n,Ao.altKey)},title:"Expand/collapse (Option/Alt-click applies to the branch)",className:"volter-tree-caret",children:q.jsx(dc,{icon:S?ITt:uLe,"aria-hidden":"true"})}):q.jsx("span",{"data-testid":"ingest-row-caret","aria-hidden":"true",style:{width:hZ,flexShrink:0}}),Pt.length>0&&q.jsx("span",{className:"volter-tree-remote-selection",role:"img",title:`Selected by ${Pt.length} collaborator${Pt.length===1?"":"s"}`,"aria-label":"Selected by a collaborator",children:Pt.slice(0,3).map(Ao=>q.jsx("span",{style:{background:Ao},"aria-hidden":"true"},Ao))}),Yr?.role==="world"&&Yr.worldId===be&&q.jsx("span",{"data-testid":"world-focus-radio","data-world-focused":"true",title:"Live Three world — shown in the viewport",style:{fontSize:"var(--volter-font-xs)",opacity:.8,flexShrink:0},children:q.jsx(dc,{icon:eCt,"aria-hidden":"true"})}),q.jsx("span",{className:"volter-tree-type-glyph",title:Qt.role?`${Qt.role}: ${Qt.kind}`:Qt.kind,style:{width:"var(--volter-icon-md)",fontSize:"var(--volter-icon-sm)",flexShrink:0,textAlign:"center"},children:q.jsx(dc,{icon:odn(Qt),"aria-hidden":"true"})}),g?q.jsx(Zm,{autoFocus:!0,defaultValue:Qt.label,onBlur:Ao=>{s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),Pe("")},onKeyDown:Ao=>{Ao.key==="Enter"&&(s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),Pe("")),Ao.key==="Escape"&&Pe("")},onClick:Ao=>Ao.stopPropagation(),"data-variant":"tree-edit",style:{flex:1,minWidth:0}}):q.jsxs("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:[$r.typeSuffix?q.jsxs("span",{"data-testid":"hierarchy-instance-label",...Wt?{}:{title:`Component instance of <${$r.typeSuffix}>`},style:{textDecorationLine:zt?d?"var(--volter-tree-active-name-underline)":"underline":"none",textDecorationStyle:"dotted",textDecorationColor:Go.semantic.instance,textUnderlineOffset:"3px",...d?{color:m?Go.content.active:Go.content.selected}:{}},children:[Kwt(Qt.label,G),!Wt&&Sl>0?"*":""]}):q.jsx("span",{"data-testid":"hierarchy-plain-label",style:d?{color:m?Go.content.active:Go.content.selected}:void 0,children:Kwt(Qt.label,G)}),Wc.map(Ao=>q.jsx("span",{className:"volter-tree-datablock","data-active":m?"true":void 0,title:`${Ao.kind}: ${Ao.label}`,children:q.jsx(dc,{icon:KZ(Ao.kind),"aria-hidden":"true"})},Ao.id)),$r.typeSuffix&&Wt&&q.jsxs("span",{"data-testid":"hierarchy-instance-type","data-type-label":$r.typeSuffix,title:`Component instance of <${$r.typeSuffix}>`,style:{marginLeft:G0[2],fontSize:"var(--volter-font-sm)",color:Go.content.dim},children:["·",$r.typeSuffix,Sl>0?"*":""]}),Qt.secondaryLabel&&q.jsx("span",{style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.5},children:Qt.secondaryLabel}),tu&&q.jsx("span",{"data-testid":"hierarchy-instanced-units",style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.5},children:tu}),Yr?.role==="world"&&Yr.zOrder!==0&&q.jsxs("span",{title:`Z order: ${Yr.zOrder}`,style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.6},children:["Z ",Yr.zOrder]}),Yr?.provenance&&q.jsx("span",{"data-testid":"world-provenance","data-provenance":Yr.provenance.source,title:Yr.provenance.detail,style:{marginLeft:G0[3],fontSize:"var(--volter-font-xs)",padding:`0 ${R_[2]}px`,borderRadius:Go.shape.small,border:`1px solid ${Go.boundary.strong}`,color:Go.content.muted,verticalAlign:"middle"},children:Yr.provenance.label})]}),mi&&q.jsx("span",{"data-testid":"hierarchy-row-warning","data-warning-codes":mi.codes.join(","),"data-warning-count":mi.count,role:"img",title:mi.tooltip,"aria-label":`${Qt.label}: ${mi.tooltip}`,style:{fontSize:"var(--volter-font-sm)",color:Go.semantic.warning,flexShrink:0},children:q.jsx(dc,{icon:fee,"aria-hidden":"true"})}),Rl.locked&&Rl.reason&&q.jsx("span",{"data-testid":"hierarchy-transform-lock",role:"img",title:Rl.reason,"aria-label":`${Qt.label}: ${Rl.reason}`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.dim,flexShrink:0},children:q.jsx(dc,{icon:Fme,"aria-hidden":"true"})}),ft==="select+viewport"&&Al&&gn.writable&&q.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-lock",disabled:!pl,title:pl?Ku?"Unlock":"Lock":ji?.reason||"Locked","aria-label":Ku?`Unlock ${Qt.label}`:`Lock ${Qt.label}`,"aria-pressed":Ku,onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"locked",!Ku),c.notifyIngestEdit()},children:q.jsx(dc,{icon:Ku?Fme:zOe,"aria-hidden":"true"})}),tr&&(Ni&&gn.writable?q.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-exclude",disabled:!Tf,title:Tf?Dc?"Include in view layer":"Exclude from view layer":vc?.reason||"Exclusion is read-only","aria-label":Dc?`Include ${Qt.label} in the view layer`:`Exclude ${Qt.label} from the view layer`,"aria-checked":!Dc,role:"checkbox",onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"exclude",!Dc),c.notifyIngestEdit()},children:q.jsx(dc,{icon:Dc?Tun:wun,"aria-hidden":"true"})}):q.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),(On||en)&&gn.writable&&q.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-visibility",disabled:!en&&!gs,title:en||gs?bu?"Hide":"Show":Ja?.reason||"Visibility is read-only","aria-label":bu?`Hide ${Qt.label}`:`Show ${Qt.label}`,"aria-pressed":!bu,onClick:Ao=>{Ao.stopPropagation(),Yr?(wan(Yr.worldId),c.notifyIngestEdit()):(s.inspector.set(Qt.id,"visible",!bu),c.notifyIngestEdit())},children:q.jsx(dc,{icon:bu?iLe:dLe,"aria-hidden":"true"})}),ft==="viewport+render"&&(Pn&&gn.writable?q.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-render-visibility",disabled:!Nt,title:Nt?js?"Disable in renders":"Enable in renders":fa?.reason||"Render visibility is read-only","aria-label":js?`Disable ${Qt.label} in renders`:`Enable ${Qt.label} in renders`,"aria-pressed":!js,onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"renderVisible",!js),c.notifyIngestEdit()},children:q.jsx(dc,{icon:js?Sun:xun,"aria-hidden":"true"})}):q.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),Yr&&q.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"world-interactive-toggle",title:Au?"Interactive (layer forwards pointer events)":"Not interactive (layer is pointer-events:none)","aria-label":`Forward pointer events to ${Qt.label}`,"aria-pressed":Au,onClick:Ao=>{Ao.stopPropagation(),Can(Yr.worldId),c.notifyIngestEdit()},children:q.jsx(dc,{icon:ovr,"aria-hidden":"true"})}),Yr&&q.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"world-picklock-toggle",title:dl?"Pick-locked (skipped by topmost-layer picking)":"Not pick-locked","aria-label":`Exclude ${Qt.label} from viewport picking`,"aria-pressed":dl,onClick:Ao=>{Ao.stopPropagation(),kan(Yr.worldId),c.notifyIngestEdit()},children:q.jsx(dc,{icon:ZTt,"aria-hidden":"true"})})]})},Edn);function Adn({store:t,adapter:n}){Ye.useSyncExternalStore(t.subscribe,t.getSnapshot);const s=Ye.useDeferredValue(t.contentVersion);Ye.useSyncExternalStore(q3r,z3r),Ye.useSyncExternalStore(U$,eA,eA);const c=mD().hierarchyTypeSuffix!=="hidden",d=mD().hierarchyInstanceRule!=="hidden",m=mD().hierarchyRestrictions??"select+viewport",[g,S]=Ye.useReducer(zi=>zi+1,0),k=Ye.useRef(t.getSnapshot());k.current=t.getSnapshot();const[A,F]=Ye.useState(Zun());Ye.useEffect(()=>n.subscribe?.(()=>{k.current=t.getSnapshot(),S()}),[n,t]),Ye.useEffect(()=>Qun(F),[]);const D=Ye.useMemo(()=>{const zi=new Map;for(const Jn of A?.participants??[])if(Jn.participantId!==Q0e)for(const Cs of Jn.presence.selection){const lc=zi.get(Cs)??[];lc.includes(Jn.color)||lc.push(Jn.color),zi.set(Cs,lc)}return zi},[A]),J=Ye.useRef(new Pfn),$=Ye.useRef(new Ffn),G=t.hierarchyRowFacetVersion,se=QVe(t),[pe,ue]=Ye.useState(""),Ce=Ye.useSyncExternalStore(dfn,ffn,()=>null),[De,Pe]=Ye.useState(null),[be,X]=Ye.useState(null),[we,qe]=Ye.useState(null),[bt,Pt]=Ye.useState(!1),[Wt,zt]=Ye.useState(null),ft=Ye.useRef(null),[tr,Qt]=Ye.useState(0),Tt=Ye.useRef(null),vn=Ye.useSyncExternalStore(ADt,dgt,dgt).includes("outliner")?"outliner":void 0,Yr=Ye.useRef(new Map),en=Ye.useRef(new Map),ii=Ye.useRef(new wfn),No=Ye.useRef(0),gn=Ye.useRef(null),En=Ye.useRef(null),cs=Ye.useRef(null),On=Ye.useRef(null),[,ji]=Ye.useReducer(zi=>zi+1,0),Ja=pe.trim().toLowerCase(),_a=wf()?.rootPath??"__unscoped__",Pn=n.selection?.get()??[],js=Pn.length===1?Pn[0]:null,fa=[...Pn].sort().join("\0"),Nt=Ye.useMemo(()=>new Set(fa===""?[]:fa.split("\0")),[fa]),Bc=Pn.at(-1)??null,Ni=l0e(n),Dc=Ni.at(-1)??null,vc=Ye.useRef("");Ye.useEffect(()=>{if(fa===""||vc.current===fa)return;const zi=Tt.current,Jn=zi?.querySelector('[data-selected="true"]');if(!zi||!Jn)return;const Cs=zi.getBoundingClientRect(),lc=Jn.getBoundingClientRect();(lc.top<Cs.top||lc.bottom>Cs.bottom)&&Jn.scrollIntoView({block:"nearest"}),vc.current=fa}),gn.current!==_a&&(en.current.clear(),gn.current=_a,En.current=null);const Tf=ii.current,Np=[n,s,g],Au=Tf.structural(Np,zi=>{const Jn=efn(n,oye()?.marks(n.hierarchy)??_jt),Cs=mfn(Jn),lc=tdn(Cs.hierarchy),Nu=oye()?.structureLog(t)??null,Fl=Nu?.epoch()??0,Yu=zi?s-zi.contentVersion:0,Ie=zi?Fl-zi.objectMapEpoch:0,Et=zi?.adapter===n&&s===t.contentVersion&&Yu>0&&Yu===Ie?Nu?.parentChangesSince(zi.objectMapEpoch)??null:null,In=(zi&&Et?bfn(lc,zi.structuralRows,Et.changedParentIds):null)??zwt(lc,new Set),pr=hfn(tfn(ldn(In,n),In,Ur=>Jn.isComponentRoot(Ur)),Cs);return{adapter:n,contentVersion:s,objectMapEpoch:Fl,marked:Jn,internals:Cs,hierarchyView:lc,structuralRows:In,defaultExpansion:pr,index:Tfn(In)}}),{marked:dl,internals:bu,hierarchyView:Al,structuralRows:Ku,defaultExpansion:pl}=Au,gs=zi=>en.current.get(zi)??lfn(_a,zi)??pl.get(zi)??!0,Xu=En.current;if(Xu?.adapter!==n||Xu.selection!==fa){for(const Jn of Uwt(Au.index,Nt))gs(Jn)||(en.current.set(Jn,!0),No.current+=1);[...Nt].every(Jn=>Au.index.pathKeysByNodeId.has(Jn))&&(En.current={adapter:n,selection:fa})}const $r=zi=>gs(zi.node.id),Sl=Ja.length===0&&(k3r()||t.playState!=="stopped"),Rl=fdn(Yr.current,Sl?Cfn(Au.index,Nt):ndn),mi=ii.current.collapsed([Au,No.current,_a,Dc],()=>{const zi=Dc?Ku.find(Cs=>!Cs.more&&Cs.node.id===Dc)??null:null,Jn=new Set(Ku.filter(Cs=>!Cs.more&&Cs.hasChildren&&!$r(Cs)).map(Cs=>Cs.pathKey));if(zi){Jn.delete(zi.pathKey);for(const Cs of rUe(zi.pathKey))Jn.delete(Cs)}return{scopeRow:zi,effectiveCollapsedPaths:Jn}}),{scopeRow:tu,effectiveCollapsedPaths:Wc}=mi,Ao=ii.current.browse([Au,mi,Ja,Sl,Sl?Efn(Rl):""],()=>{const zi=zwt(Al,Wc,Rl,Sl),Jn=Ja?udn(Ku,Ja,bu.isInternal):null,Cs=Jn?Ku.filter(Fl=>Jn.has(Fl.pathKey)):zi,Nu=(tu?Cs.filter(Fl=>Fl.pathKey.startsWith(`${tu.pathKey}.`)).map(Fl=>({...Fl,depth:Math.max(0,Fl.depth-tu.depth-1)})):Cs).filter(Fl=>{if(kme(n,Fl.node.id))return!0;let Yu=Fl.node.parentId;for(;Yu;){const Ie=oUe(n,Yu);if(Ie&&oq(Ie.worldId))return!1;Yu=Al.node(Yu)?.parentId??null}return!0});return{rows:Ja?Nu:Nu.filter(Fl=>!Fl.hiddenByCollapse)}}),{rows:ia}=Ao,Du=Ye.useMemo(()=>ia.some(zi=>!zi.more&&n.inspector?.get(zi.node.id,"exclude")!==void 0),[ia,n,g,s]);Ye.useEffect(()=>{Qt(0),Tt.current&&(Tt.current.scrollTop=0)},[Ja]);const gp=Tt.current?.clientHeight||edn,Id=NOe(Tt.current),{start:ea,end:Pu}=ia.length>rdn?Sfn(ia.length,tr,gp,Id,Qfn):{start:0,end:ia.length},Ls=ia.slice(ea,Pu),Ff=ea*Id,Hs=(ia.length-Pu)*Id,Ds=Ye.useCallback(zi=>{const Jn=Ku.filter(Cs=>Cs.hasChildren).map(Cs=>[Cs.node.id,zi]);for(const[Cs,lc]of Jn)en.current.set(Cs,lc);$wt(_a,Jn),No.current+=1,ji()},[_a,Ku]),Oc={rows:ia,window:{start:ea,end:Pu},searchTerm:Ja||null,scopeId:Dc,isExpanded:$r,isInternal:zi=>bu.isInternal(zi),isComponentRoot:zi=>dl.isComponentRoot(zi),foldedInternalCount:zi=>dl.internalChildren?.(zi)?.length??0,expandAll:()=>Ds(!0),collapseAll:()=>Ds(!1)};Ye.useEffect(()=>(Yrn(Oc),()=>Qrn(Oc)),[Oc]);const Ze=Ye.useRef({adapter:n,rows:ia,selectedIds:Nt,structuralRows:Ku,isExpanded:$r,projectIdentity:_a});Ze.current={adapter:n,rows:ia,selectedIds:Nt,structuralRows:Ku,isExpanded:$r,projectIdentity:_a};const jt=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current,lc=!Cs.isExpanded(zi),Nu=[[zi.node.id,lc]];if(Jn){const Fl=`${zi.pathKey}.`;for(const Yu of Cs.structuralRows)Yu.hasChildren&&Yu.pathKey.startsWith(Fl)&&Nu.push([Yu.node.id,lc])}for(const[Fl,Yu]of Nu)en.current.set(Fl,Yu);$wt(Cs.projectIdentity,Nu),No.current+=1,ji()},[]),mt=Ye.useCallback(()=>{en.current.clear();for(const zi of Uwt(Au.index,Nt))en.current.set(zi,!0);ufn(_a),No.current+=1,ji()},[_a,fa,Au]),xt=Ye.useCallback(zi=>{const Jn=Yr.current;Jn.set(zi,(Jn.get(zi)??nye)+nye),No.current+=1,ji()},[]),xr=Ye.useCallback(zi=>{H3r(n,zi)},[n,t]);Ye.useEffect(()=>{if(!fa){On.current=null;return}const zi=On.current;if(zi?.adapter===n&&zi.selection===fa)return;On.current={adapter:n,selection:fa};const Jn=ia.findIndex(Yu=>Nt.has(Yu.node.id)),Cs=Tt.current;if(Jn<0||!Cs)return;const lc=NOe(Cs),Nu=Jn*lc,Fl=Nu+lc;Nu<Cs.scrollTop?Cs.scrollTop=Nu:Fl>Cs.scrollTop+Cs.clientHeight&&(Cs.scrollTop=Math.max(0,Fl-Cs.clientHeight)),Qt(Cs.scrollTop)},[n,ia,Nt,fa]);const Vn=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current;if(Cs.adapter.selection){if(zi.metaKey||zi.ctrlKey){const lc=new Set(Cs.selectedIds);lc.has(Jn)?lc.delete(Jn):lc.add(Jn),c0(Cs.adapter,[...lc])}else if(zi.shiftKey&&cs.current){const lc=Cs.rows.findIndex(Fl=>Fl.node.id===cs.current),Nu=Cs.rows.findIndex(Fl=>Fl.node.id===Jn);if(lc>=0&&Nu>=0){const Fl=Math.min(lc,Nu),Yu=Math.max(lc,Nu),Ie=Cs.rows.slice(Fl,Yu+1).filter(Et=>!Et.more).map(Et=>Et.node.id);c0(Cs.adapter,Ie)}}else c0(Cs.adapter,[Jn]);cs.current=Jn}},[]),eo=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current.selectedIds,lc=Cs.has(Jn)?[...Cs]:[Jn];zt(lc),zi.dataTransfer.effectAllowed="move",zi.dataTransfer.setData(IOe,JSON.stringify(lc)),zi.dataTransfer.setData("text/plain",Jn)},[]),bi=Ye.useCallback((zi,Jn)=>{Pe({x:zi.clientX,y:zi.clientY,nodeId:Jn})},[]),ta=Ye.useCallback(zi=>{const Jn=zi.dataTransfer.types.includes(IOe),Cs=zi.dataTransfer.types.includes(POe);if(!Jn&&!Cs)return;zi.preventDefault(),zi.dataTransfer.dropEffect=Jn?"move":"copy",ft.current=null;const lc=Tt.current.getBoundingClientRect(),Nu=Tt.current.scrollTop,Fl=zi.clientY-lc.top+Nu,Yu=NOe(Tt.current),Ie=Math.floor(Fl/Yu);if(Ie>=ia.length){qe(null),Pt(!0),Jn&&Wt&&(ft.current=Lwt({hasStructureWritePath:Gwt(n,Wt[0]),targetIsInternal:!1}));return}Pt(!1);const Et=Ie>=0?ia[Ie]:void 0;if(!Et||Et.more){qe(null);return}const Nr=Lwt({hasStructureWritePath:Jn?Gwt(n,Et.node.id):!0,targetIsInternal:bu.isInternal(Et.node.id)});if(Nr!==null){ft.current=Nr,qe(null);return}const In=Fl-Ie*Yu;let pr;if(In<Yu*.25?pr="before":In>Yu*.75?pr="after":pr="child",Jn&&Wt){const Ur=Et.node.id;if(Wt.includes(Ur)||sdn(Ur,Wt,n))return;if(!nfn(n,Wt,Ur)){qe(null);return}}if(kme(n,Et.node.id)&&pr!=="child"&&(pr="child"),(Et.node.role==="document"||Et.node.role==="story")&&(pr="child"),Et.node.role==="folder"||Et.node.role==="boundary"){qe(null);return}qe({nodeId:Et.node.id,zone:pr})},[ia,Wt,n,bu]),ic=Ye.useCallback(()=>{qe(null),Pt(!1),zt(null),ft.current=null},[]),Ps=Ye.useCallback(zi=>{zi.preventDefault(),zi.stopPropagation();const Jn=we,Cs=bt,lc=ft.current;if(qe(null),Pt(!1),zt(null),ft.current=null,lc!==null){i0(lc);return}const Nu=n.structure,Fl=zi.dataTransfer.getData(IOe);if(Fl&&Nu){const Ie=JSON.parse(Fl);if(Cs){for(const Li of Ie)QO(n,Li,null);return}if(!Jn)return;const Et=ia.find(Li=>Li.node.id===Jn.nodeId);if(!Et)return;const Nr=Et.node.id;if(Jn.zone==="child"){for(const Li of Ie)QO(n,Li,Nr);return}const In=Et.node.parentId,pr=adn(n,In).filter(Li=>!Ie.includes(Li)),Ur=pr.indexOf(Nr),Ei=Jn.zone==="before"?Nr:Ur>=0?pr[Ur+1]??null:null;for(const Li of Ie)(n.hierarchy.node(Li)?.parentId??null)!==In&&QO(n,Li,In??null),p$e(n,Li,Ei);return}const Yu=zi.dataTransfer.getData(POe);if(Yu&&n.assetDrop)try{const Ie=JSON.parse(Yu);if(Ie.kind==="scene")return;const Et={item:Ie.component??{kind:"file",name:Ie.name??Ie.path.split("/").pop()??Ie.path}};if(Cs){n.assetDrop.accepts("",Ie.path,Et)&&BFe(n,"",Ie.path,Et);return}if(!Jn)return;const Nr=ia.find(pr=>pr.node.id===Jn.nodeId);if(!Nr)return;const In=Nr.node.id;n.assetDrop.accepts(In,Ie.path,Et)&&BFe(n,In,Ie.path,Et)}catch{}},[we,bt,ia,n]),Iu=EPt(n)??"Untitled";return q.jsxs(Jye,{name:null,hideHeader:!0,onPointerDown:()=>CR("hierarchy"),onDragOver:zi=>{zi.dataTransfer.types.includes(POe)&&(zi.preventDefault(),zi.dataTransfer.dropEffect="copy")},style:{flex:1,minWidth:0,minHeight:0,borderRight:`1px solid ${Go.boundary.default}`},children:[q.jsx("span",{"data-testid":"scene-name","data-scene":Iu,style:{display:"none"},children:Iu}),q.jsx(Sdn,{slot:Ce,search:pe,setSearch:ue,adapter:n,createTargetId:js,onCollapseAll:()=>Ds(!1),onResetExpansion:mt,onExpandAll:()=>Ds(!0)}),Dc&&q.jsxs("nav",{"data-testid":"selection-scope-breadcrumb","aria-label":"Selection scope",style:{display:"flex",alignItems:"center",gap:3,minHeight:26,padding:`0 ${R_[2]}px`,borderBottom:`1px solid ${Go.boundary.default}`,overflow:"hidden",flexShrink:0},children:[q.jsx(Ms,{variant:"ghost",size:"compact","data-testid":"selection-scope-root",onClick:()=>Ogt(n,null),children:"Game"}),Ni.map((zi,Jn)=>{const Cs=n.hierarchy.node(zi);if(!Cs)return null;const lc=Jn===Ni.length-1;return q.jsxs("span",{style:{display:"flex",alignItems:"center",minWidth:0},children:[q.jsx("span",{"aria-hidden":"true",style:{color:Go.content.muted},children:"/"}),q.jsx(Ms,{variant:"ghost",size:"compact","data-testid":"selection-scope-crumb","data-scope-current":lc?"true":void 0,"aria-current":lc?"location":void 0,onClick:()=>Ogt(n,zi),style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Cs.label})]},zi)})]}),q.jsxs("div",{ref:Tt,"data-testid":"ingest-hierarchy",className:"volter-content-frost volter-tree-body","data-volter-region":vn,style:{flex:1,minHeight:0,overflow:"auto",position:"relative",pointerEvents:"auto"},onDragOver:ta,onDrop:Ps,onDragEnd:ic,onScroll:zi=>Qt(zi.currentTarget.scrollTop),onDragLeave:zi=>{Tt.current?.contains(zi.relatedTarget)||(qe(null),Pt(!1))},children:[q.jsx("div",{"data-testid":"game-hierarchy-spacer-top",style:{height:Ff}}),Ls.map((zi,Jn)=>zi.more?q.jsx(Tdn,{row:zi,onReveal:xt},Vwt(zi)):q.jsx(kdn,{row:zi,rowIndex:ea+Jn,prevDepth:ia[ea+Jn-1]?.depth??-1,nextDepth:ia[ea+Jn+1]?.depth??-1,adapter:n,store:t,isSelected:Nt.has(zi.node.id),isSelectionActive:Bc===zi.node.id,isEditing:be===zi.node.id,isCollapsed:Ja?!1:Wc.has(zi.pathKey),dropZone:we&&we.nodeId===zi.node.id?we.zone:null,isDragged:Wt?.includes(zi.node.id)??!1,isInternal:bu.isInternal(zi.node.id),threeRootId:se,searchTerm:Ja,lockCache:J.current,warningCache:$.current,editabilityVersion:G,adapterVersion:g,onToggleOpen:jt,onStartEditing:X,onContextMenu:bi,onDragStart:eo,onClick:Vn,onEnterScope:xr,typeSuffixShown:c,instanceRuleShown:d,restrictionColumns:m,excludeColumnShown:Du,remoteSelectionColors:D.get(zi.node.id)??Yfn},Vwt(zi))),q.jsx("div",{"data-testid":"game-hierarchy-spacer-bottom",style:{height:Hs}}),q.jsx("div",{style:{minHeight:40}}),bt&&q.jsx("div",{style:{position:"absolute",left:0,right:0,top:ia.length*Id,height:2,background:Go.accent.default,pointerEvents:"none",zIndex:PI.overlayLow}})]}),De&&(()=>{const zi=Al.node(De.nodeId),Jn=zi?kme(n,zi.id)||sUe(n,zi.id):!1;return q.jsx(xdn,{state:De,adapter:n,store:t,isGroupNode:Jn,isInternal:bu.isInternal(De.nodeId),onRename:X,onClose:()=>Pe(null)})})()]})}function kjt(){const t=Yv(),[,n]=Ye.useReducer(c=>c+1,0);Ye.useSyncExternalStore(o2,K1),Ye.useSyncExternalStore(Cee,AD),Ye.useSyncExternalStore(Kfn,oye);const{adapter:s}=Cm(t);return Ye.useEffect(()=>s.subscribe?.(n),[s]),q.jsx(Adn,{store:t,adapter:s},Kun(s))}function Ddn(){const t=Yv(),n=Y0(t),s=n.structure,c=[...t.selectedEntityIds],d=c[0],m=d?n.hierarchy.node(d)?.parentId??null:null,g=mve(),S=Q9t(),k=Ye.useSyncExternalStore(u2,CFe,CFe);Ye.useSyncExternalStore(gDt,whe,whe),Ye.useSyncExternalStore(Kye,mhe,mhe),Ye.useSyncExternalStore(IDt,Phe,Phe),Ye.useSyncExternalStore(mLe,YB,YB);const A=De=>{const Pe=jme(De);return Pe.length===0?null:q.jsxs(q.Fragment,{children:[q.jsx(t2,{}),Pe.map(be=>q.jsx(Jc,{...be.testId?{"data-testid":be.testId}:{},disabled:be.disabled?.({})??!1,onSelect:ue(()=>be.execute({})),children:typeof be.label=="function"?be.label():be.label},be.id))]})},F=Ye.useSyncExternalStore(aMt,N$,N$),D=Ye.useSyncExternalStore(bDt,zS,zS),[J,$]=Ye.useState(null);ljt(()=>J?Uvr():"");const G=Ye.useRef(null),se=Ye.useRef({}),pe=De=>se.current[De]??={current:null},ue=De=>()=>{$(null),Promise.resolve().then(De).catch(Pe=>Qs.error(`The menu command failed: ${Pe instanceof Error?Pe.message:String(Pe)}`,"editor"))},Ce={edit:q.jsxs(q.Fragment,{children:[q.jsx(Jc,{disabled:S.busy||!S.canUndo,onSelect:ue(()=>g.undo()),children:S.undoLabel?`Undo ${S.undoLabel}`:"Undo"}),q.jsx(Jc,{disabled:S.busy||!S.canRedo,onSelect:ue(()=>g.redo()),children:S.redoLabel?`Redo ${S.redoLabel}`:"Redo"}),q.jsx(t2,{}),q.jsx(Jc,{onSelect:ue(zVe),children:"Undo History…"}),q.jsx(t2,{}),q.jsx(Jc,{disabled:c.length===0||!s?.cut||!(s.canCopy?.(c)??!0),onSelect:ue(()=>$Ve(t)),children:"Cut"}),q.jsx(Jc,{disabled:c.length===0||!s?.copy||!(s.canCopy?.(c)??!0),onSelect:ue(()=>BVe(t)),children:"Copy"}),q.jsx(Jc,{disabled:!s?.paste||!(s.canPaste?.(m)??!0),onSelect:ue(()=>qVe(t)),children:"Paste"}),q.jsx(t2,{}),q.jsx(Jc,{disabled:t.selectedEntityIds.size===0,onSelect:ue(()=>void bve(t)),children:"Duplicate"}),q.jsx(Jc,{disabled:t.selectedEntityIds.size===0,onSelect:ue(()=>void Sve(t)),children:"Delete"}),q.jsx(t2,{}),q.jsx(Jc,{onSelect:ue(()=>NRt(t)),children:"Select All"}),q.jsx(Jc,{disabled:t.selectedEntityIds.size===0,onSelect:ue(()=>t.select(null)),children:"Deselect All"})]}),view:q.jsxs(q.Fragment,{children:[q.jsx(Jc,{onSelect:ue(()=>CVe()),children:"Command Palette…"}),q.jsx(Jc,{onSelect:ue(async()=>{const De=prn(t);try{await navigator.clipboard.writeText(De),Qs.log("Copied a link to the current editor view.","editor")}catch(Pe){Qs.error(`Could not copy the editor view link: ${Pe instanceof Error?Pe.message:String(Pe)}`,"editor")}}),children:"Copy View Link"}),q.jsx(t2,{}),q.jsx(Jc,{onSelect:ue(qBe),children:"Toggle Focus Mode"}),A("view")]}),window:q.jsxs(q.Fragment,{children:[AN().filter(De=>Uk(De.id)).map(De=>q.jsxs(Jc,{role:"menuitemradio","aria-checked":D===De.id,"data-testid":`workspace-${De.id}`,title:De.description,onSelect:ue(()=>a2(De.id)),children:[q.jsx(dc,{icon:Kk.status.success,style:{opacity:D===De.id?1:0}}),"Workspace: ",De.title]},De.id)),q.jsx(t2,{}),q.jsx(Jc,{onSelect:ue(pve),children:"Console"}),q.jsx(Jc,{onSelect:ue(()=>vC(nee.lightExplorer.id)),children:"Light Explorer"}),q.jsx(Jc,{onSelect:ue(()=>$Be("asset-library")),children:"Asset Library"}),q.jsx(Jc,{onSelect:ue(()=>vC("generations")),children:"Generations"}),A("window")]}),debug:q.jsx(q.Fragment,{children:A("debug")}),tools:q.jsxs(q.Fragment,{children:[q.jsxs(Jc,{onSelect:ue(()=>wve()),children:["Project Tools…",F.tools.length>0?` (${F.tools.length})`:""]}),q.jsx(t2,{}),k.length?k.map(De=>q.jsx(Jc,{onSelect:ue(()=>{De.point==="workspace.document"?tA(De.id):vC(`tool:${De.id}`)}),children:De.title},De.id)):q.jsx(Jc,{disabled:!0,children:"No custom project tools"}),A("tools")]}),help:jme("help").length>0?A("help"):null};return q.jsx("div",{ref:G,"data-testid":"app-menubar",style:{display:"flex",alignItems:"stretch",marginLeft:"var(--volter-space-2)"},children:["edit","view","window","debug","tools","help"].filter(De=>Ce[De]!==null).map(De=>q.jsxs("div",{ref:pe(De),style:{position:"relative"},children:[q.jsx(gBe,{"data-testid":`app-menu-${De}`,"aria-haspopup":"menu","aria-expanded":J===De,onClick:()=>$(Pe=>Pe===De?null:De),onKeyDown:Pe=>{Pe.key==="ArrowDown"&&(Pe.preventDefault(),$(De))},onPointerEnter:()=>{J&&$(De)},style:{textTransform:"capitalize"},children:De}),J===De&&q.jsx(yBe,{anchorRef:pe(De),dismissBoundaryRef:pe(De),align:"start",gap:0,clamp:!0,autoFocusFirst:!0,onDismiss:()=>{const Pe=G.current?.querySelector(`[data-testid="app-menu-${De}"]`);$(null),requestAnimationFrame(()=>Pe?.focus())},style:{minWidth:190},children:Ce[De]})]},De))})}const Pdn=new Map,Xwt=new Set;let Idn=0;function Ndn(t){return Pdn.get(t)??Odn}const Odn=[];function Rdn(t){return Xwt.add(t),()=>Xwt.delete(t)}function Ywt(){return Idn}function Ame({slot:t}){return Ye.useSyncExternalStore(Rdn,Ywt,Ywt),q.jsx(q.Fragment,{children:Ndn(t).map(n=>q.jsx(n.Content,{},n.owner))})}const IO=[],zje=new Set;let Ajt=0;function Zwt(){Ajt++;for(const t of zje)t()}function Fdn(t){const n=IO.findIndex(s=>s.owner===t.owner);return n>=0&&IO.splice(n,1),IO.push(t),IO.sort((s,c)=>(s.order??0)-(c.order??0)),Zwt(),()=>{const s=IO.indexOf(t);s<0||(IO.splice(s,1),Zwt())}}async function Mdn(t){const n=new Set,s=[];for(const c of IO){let d;try{d=await c.harnesses(t)}catch{continue}for(const m of d)n.has(m.id)||(n.add(m.id),s.push(m))}return s}function jdn(t){return zje.add(t),()=>{zje.delete(t)}}function Qwt(){return Ajt}async function pA(t,n){const s=await fetch(`/__editor/share-control${t}`,{...n,headers:{...n?.body?{"Content-Type":"application/json"}:{},...n?.headers}});if(s.status!==204&&of(s,`Git request ${t} failed`),!s.ok){const c=await s.json().catch(()=>null);throw new Error(typeof c?.error=="string"?c.error:`Git request failed (${s.status}).`)}return s.status===204?void 0:await s.json()}async function Ldn(){const t=await fetch("/__editor/git/status");return L_(t,"Git status failed")}function Bdn(t){return pA("/git/checkpoint",{method:"POST",body:JSON.stringify(t)})}function $dn(t){return pA("/git/publish",{method:"POST",...t?{signal:t}:{}})}function eTt(t){return pA("/git/stage",{method:"POST",body:JSON.stringify(t)})}function qdn(t){return pA("/git/fetch",{method:"POST",...t?{signal:t}:{}})}function zdn(t){return pA("/git/update",{method:"POST",...t?{signal:t}:{}})}function tTt(t){return pA("/git/rebase",{method:"POST",body:JSON.stringify({action:t})})}function Vdn(){return pA("/git/readiness",{method:"POST"})}function Udn(t){return pA("/git/pull-request",{method:"POST",body:JSON.stringify(t)})}function Jdn(){return pA("/git/pull-request/status")}function Wdn(t){return pA("/git/pull-request/merge",{method:"POST",...t?{signal:t}:{}})}function Hdn(){const[t,n]=Ye.useState(null),[s,c]=Ye.useState(!1),[d,m]=Ye.useState(null),[g,S]=Ye.useState([]),[k,A]=Ye.useState(""),[F,D]=Ye.useState(null),[J,$]=Ye.useState(null),[G,se]=Ye.useState(null),[pe,ue]=Ye.useState(!1),Ce=Ye.useRef(null);Ye.useEffect(()=>{Ldn().then(we=>{m(we),S(we.changed.map(qe=>qe.path))}).catch(we=>n(String(we)))},[]);const De=we=>{m(we),S(qe=>qe.filter(bt=>we.changed.some(Pt=>Pt.path===bt)))},Pe=async(we,qe,bt)=>{const Pt=new AbortController;Ce.current=Pt,$(bt??null),c(!0),n(null),D(null);try{De(await we(Pt.signal)),D(qe)}catch(Wt){n(Wt instanceof Error?Wt.message:String(Wt))}finally{Ce.current===Pt&&(Ce.current=null),$(null),c(!1)}},be=we=>{se(null),Udn({title:we}).then(qe=>{De(qe.status),D(`Pull request: ${qe.url}`)}).catch(qe=>n(String(qe)))},X=()=>{ue(!1);const we=new AbortController;Ce.current=we,$("Merging pull request"),c(!0),Wdn(we.signal).then(qe=>D(`Merged pull request: ${qe.url}`)).catch(qe=>n(String(qe))).finally(()=>{Ce.current===we&&(Ce.current=null),$(null),c(!1)})};return q.jsxs("section",{className:"volter-worktree-version-control",children:[t&&q.jsx("div",{style:{color:Go.semantic.danger,fontSize:YY.sm,marginBottom:5},children:t}),d?.available?q.jsxs("details",{style:{marginTop:G0[4]},children:[q.jsxs("summary",{style:{cursor:"pointer",fontSize:YY.sm},children:["Git · ",d.branch??"detached"," ·"," ",d.dirty?`${d.changed.length} changed`:"clean",d.baseAhead!==null&&d.baseBehind!==null?` · base +${d.baseAhead}/-${d.baseBehind}`:"",d.ahead!==null&&d.behind!==null?` · remote +${d.ahead}/-${d.behind}`:""]}),q.jsxs("div",{style:{display:"grid",gap:5,marginTop:5,fontSize:YY.sm},children:[q.jsxs("span",{style:{color:Go.content.dim},children:[d.repositoryId.slice(0,20)," · ",d.worktreeId.slice(0,20)]}),d.changed.map(we=>{const qe=d.hunks.filter(bt=>bt.path===we.path);return q.jsxs("div",{style:{display:"grid",gap:3},children:[q.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[q.jsx(TD,{"aria-label":`Include ${we.path} in checkpoint`,checked:g.includes(we.path),onChange:bt=>S(Pt=>bt.target.checked?[...Pt,we.path]:Pt.filter(Wt=>Wt!==we.path))}),q.jsxs("code",{style:{minWidth:0,flex:1},children:[we.index,we.worktree," ",we.path]}),q.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void Pe(()=>eTt({path:we.path,staged:we.index!==" "&&we.index!=="?"}),we.index!==" "&&we.index!=="?"?`Unstaged ${we.path}.`:`Staged ${we.path}.`),children:we.index!==" "&&we.index!=="?"?"Unstage file":"Stage file"})]}),qe.map(bt=>q.jsxs("div",{style:{display:"flex",gap:5,paddingLeft:22,alignItems:"center"},children:[q.jsxs("code",{style:{minWidth:0,flex:1,color:Go.content.dim},children:[bt.header," · +",bt.additions,"/-",bt.deletions]}),q.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void Pe(()=>eTt({path:bt.path,hunkId:bt.id,staged:bt.staged}),bt.staged?"Hunk unstaged.":"Hunk staged."),children:bt.staged?"Unstage hunk":"Stage hunk"})]},bt.id))]},we.path)}),d.rebaseInProgress&&q.jsxs("div",{role:"alert",style:{display:"grid",gap:5,color:Go.semantic.warning},children:[q.jsxs("span",{children:["Rebase paused",d.conflicts.length>0?` · conflicts: ${d.conflicts.join(", ")}`:""]}),q.jsxs("span",{style:{display:"flex",gap:5},children:[q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.conflicts.length>0,onClick:()=>void Pe(()=>tTt("continue"),"Rebase continued."),children:"Continue rebase"}),q.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void Pe(()=>tTt("abort"),"Rebase aborted."),children:"Abort rebase"})]})]}),d.dirty&&q.jsxs("div",{style:{display:"flex",gap:5},children:[q.jsx(Zm,{"aria-label":"Git checkpoint message",placeholder:"Checkpoint message",value:k,onChange:we=>A(we.target.value),style:{minWidth:0,flex:1}}),q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!k.trim()||g.length===0,onClick:()=>void Pe(()=>Bdn({paths:g,message:k}),"Selected paths checkpointed with verified account attribution.").then(()=>A("")),children:"Checkpoint"})]}),q.jsxs("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:[q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!d.remoteUrl,onClick:()=>void Pe(qdn,"Remote refs fetched and pruned.","Fetching"),children:"Fetch"}),q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.remoteUrl,onClick:()=>void Pe($dn,"Branch published.","Publishing"),children:"Publish"}),q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.baseRef,onClick:()=>void Pe(zdn,"Branch rebased onto its base.","Fetching and rebasing"),children:"Update from base"}),q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>void Vdn().then(we=>{De(we.status),D(we.ready?"Merge-ready; no merge was performed.":we.reasons.join(" "))}).catch(we=>n(String(we))),children:"Check merge readiness"}),d.github&&d.upstream&&q.jsxs(q.Fragment,{children:[q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>se(k||d.branch||"Volter Editor changes"),children:"Create PR"}),q.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void Jdn().then(we=>D(we.available?`PR ${we.state??"open"} · ${we.mergeState??"status unknown"} · checks ${we.checks?.passed??0} passed/${we.checks?.pending??0} pending/${we.checks?.failed??0} failed${we.reviewDecision?` · review ${we.reviewDecision}`:""}${we.url?` · ${we.url}`:""}`:we.reason??"No pull request found.")).catch(we=>n(String(we))),children:"PR status"}),q.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||d.rebaseInProgress,onClick:()=>ue(!0),children:"Merge PR…"})]})]}),J&&q.jsxs("div",{role:"status",style:{display:"flex",gap:5,alignItems:"center"},children:[q.jsxs("span",{children:[J,"…"]}),q.jsx(Ms,{type:"button",size:"compact",variant:"ghost",onClick:()=>Ce.current?.abort(),children:"Cancel"})]}),d.history.length>0&&q.jsxs("details",{children:[q.jsx("summary",{style:{cursor:"pointer",color:Go.content.dim},children:"Recent history"}),q.jsx("div",{style:{display:"grid",gap:3,paddingTop:G0[2]},children:d.history.map(we=>q.jsxs("span",{title:`${we.author} · ${we.authoredAt}`,children:[q.jsx("code",{children:we.shortSha})," · ",we.subject]},we.sha))})]}),F&&q.jsx("span",{style:{color:Go.semantic.success},children:F})]})]}):q.jsx("span",{style:{color:Go.content.dim,fontSize:YY.sm},children:"Loading version control…"}),G!==null&&q.jsxs(kRe,{labelledBy:"volter-pull-request-title-heading",onDismiss:()=>se(null),children:[q.jsx(ARe,{titleId:"volter-pull-request-title-heading",title:"Create pull request",description:`Opens a pull request for ${d?.branch??"this branch"} on its remote.`}),q.jsx(V3t,{children:q.jsx(Zm,{"aria-label":"Pull request title",autoFocus:!0,value:G,onChange:we=>se(we.target.value),onKeyDown:we=>{we.key!=="Enter"||!G.trim()||(we.preventDefault(),be(G.trim()))}})}),q.jsxs(DRe,{children:[q.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>se(null),children:"Cancel"}),q.jsx(Ms,{type:"button",variant:"primary",disabled:!G.trim(),onClick:()=>be(G.trim()),children:"Create pull request"})]})]}),pe&&q.jsxs(kRe,{labelledBy:"volter-merge-pr-heading",onDismiss:()=>ue(!1),children:[q.jsx(ARe,{titleId:"volter-merge-pr-heading",title:"Merge pull request",description:`Merging the pull request for ${d?.branch??"this branch"} changes the remote repository.`}),q.jsxs(DRe,{children:[q.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>ue(!1),children:"Cancel"}),q.jsx(Ms,{type:"button",variant:"primary",onClick:X,children:"Merge pull request"})]})]})]})}Fdn({owner:"editor-core:supercode",harnesses:async()=>GZr()});const Gdn={worktrees:[],branches:[]};function Kdn(t){return`agent/${t.toLocaleLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,42)||"task"}`}function Xdn({currentLabel:t,onDone:n,onError:s}){const[c,d]=Ye.useState(""),[m,g]=Ye.useState("agent/task"),[S,k]=Ye.useState(!1),[A,F]=Ye.useState("worktree"),[D,J]=Ye.useState([]),[$,G]=Ye.useState(""),[se,pe]=Ye.useState(!1),ue=Ye.useSyncExternalStore(jdn,Qwt,Qwt);return Ye.useEffect(()=>{let Ce=!0;return Mdn(A).then(De=>{Ce&&(J(De),G(Pe=>De.some(be=>be.id===Pe)?Pe:De[0]?.id??""))}),()=>{Ce=!1}},[A,ue]),q.jsxs("div",{className:"volter-worktree-delegate",role:"group","aria-label":"Delegate task",children:[q.jsx(_p,{as:"div",variant:"label",children:"Delegate task"}),q.jsx(wBe,{"aria-label":"Task for the agent",placeholder:"Describe a bounded task…",value:c,onChange:Ce=>{const De=Ce.target.value;d(De),S||g(Kdn(De))}}),q.jsxs("label",{children:[q.jsx("span",{children:"Harness"}),q.jsxs(Iw,{value:$,onChange:Ce=>G(Ce.target.value),children:[D.length===0&&q.jsx("option",{value:"",children:"No harness ready"}),D.map(Ce=>q.jsx("option",{value:Ce.id,children:Ce.label},Ce.id))]})]}),q.jsxs("label",{children:[q.jsx("span",{children:"Isolation"}),q.jsxs(Iw,{value:A,onChange:Ce=>{F(Ce.target.value)},children:[q.jsx("option",{value:"worktree",children:"New worktree (recommended)"}),q.jsx("option",{value:"current",children:"Current worktree (shared files)"})]})]}),A!=="current"&&q.jsxs("label",{children:[q.jsx("span",{children:"Branch"}),q.jsx(Zm,{"aria-label":"Delegated branch",value:m,onChange:Ce=>{k(!0),g(Ce.target.value)}})]}),q.jsx(_p,{as:"div",variant:"caption",tone:"dim",children:A==="worktree"?`Creates a sibling checkout from ${t}, opens its editor, and starts the agent there.`:"The agent edits the files in this live worktree alongside you."}),q.jsx(Ms,{type:"button",variant:"primary",size:"compact",disabled:se||!c.trim()||!$||A!=="current"&&!m.trim(),onClick:()=>{pe(!0),YZr({task:c.trim(),harness:$,isolation:A,...A!=="current"?{branch:m.trim(),from:"HEAD"}:{}}).then(n).catch(Ce=>s(Ce instanceof Error?Ce.message:String(Ce))).finally(()=>pe(!1))},children:se?"Delegating…":"Delegate"})]})}function Ydn(t){return t.replace(/[\\/]$/,"").split(/[\\/]/).at(-1)??t}function Zdn(t){const n=t.current?["Current worktree"]:[Ydn(t.root)];t.sessions.length>0&&n.push("editor running"),t.dirty?n.push("uncommitted changes"):n.push("clean"),t.ahead&&n.push(`${t.ahead} ahead`),t.behind&&n.push(`${t.behind} behind`);const s=aUe(t);if(s.length===1){const c=s[0];n.push(c.kind==="agent"?`${c.displayName} ${c.status}${c.changeCount>0?` · ${c.changeCount} changes`:""}`:`${c.displayName} here`)}else s.length>1&&n.push(`${s.length} collaborators here`);return n.join(" · ")}function aUe(t){const n=new Map;for(const s of t.sessions)for(const c of s.presence?.participants??[]){const d=n.get(c.participantId);(!d||Date.parse(d.lastSeenAt)<Date.parse(c.lastSeenAt))&&n.set(c.participantId,c)}return[...n.values()].sort((s,c)=>{const d={"needs-input":0,active:1,idle:2,done:3};return d[s.status]-d[c.status]||s.displayName.localeCompare(c.displayName)})}function Qdn(t){return t.kind==="agent"?"AI":t.displayName.split(/\s+/).slice(0,2).map(n=>n[0]?.toLocaleUpperCase()??"").join("")}function rTt({worktree:t}){const n=aUe(t);if(n.length===0)return null;const s=n.slice(0,3);return q.jsxs("span",{className:"volter-worktree-presence",role:"img","aria-label":n.map(c=>`${c.displayName}, ${c.status}`).join("; "),children:[s.map(c=>q.jsx("span",{className:"volter-worktree-avatar","data-kind":c.kind,"data-status":c.status,style:{"--volter-participant-color":c.color},title:`${c.displayName} · ${c.kind} · ${c.status}`,"aria-hidden":"true",children:Qdn(c)},c.participantId)),n.length>s.length&&q.jsxs("span",{className:"volter-worktree-avatar volter-worktree-avatar-more","aria-hidden":"true",children:["+",n.length-s.length]})]})}function nTt(t,...n){const s=t.trim().toLocaleLowerCase();return!s||n.some(c=>c?.toLocaleLowerCase().includes(s))}function iTt(t,n){return[+!t.current,Math.min(...aUe(t).map(s=>s.status==="needs-input"?0:s.status==="active"?1:s.status==="idle"?2:3)),+(t.branch===null),+(t.sessions.length===0),+!t.dirty,-(t.branch?n.get(t.branch)??0:0)]}function epn(t){return(n,s)=>{const c=iTt(n,t),d=iTt(s,t);return c.reduce((g,S,k)=>g||S-(d[k]??0),0)||(n.branch??n.root).localeCompare(s.branch??s.root)}}function tpn(){const[t,n]=Ye.useState(Gdn),[s,c]=Ye.useState({branch:null,worktreeId:null}),[d,m]=Ye.useState(!1),[g,S]=Ye.useState(null),[k,A]=Ye.useState(null),F=Ye.useCallback(async(J=!1)=>{J||m(!0);try{n(await KZr()),A(null)}catch($){A($ instanceof Error?$.message:String($))}finally{J||m(!1)}},[]);return Ye.useEffect(()=>{if(L$)return;let J=!0;return HZr().then($=>{J&&c($)}).catch(()=>{}),()=>{J=!1}},[]),{state:t,sessionIdentity:s,loading:d,busy:g,error:k,setError:A,refresh:F,run:async(J,$,G)=>{S(J),A(null);try{await $(),G()}catch(se){A(se instanceof Error?se.message:String(se))}finally{S(null)}}}}function rpn(){const t=Ye.useRef(null),[n,s]=Ye.useState(!1),[c,d]=Ye.useState(""),[m,g]=Ye.useState(!1),{state:S,sessionIdentity:k,loading:A,busy:F,error:D,setError:J,refresh:$,run:G}=tpn();if(Ye.useEffect(()=>{n&&$()},[n,$]),L$)return null;const se=S.worktrees.find(ft=>ft.current),pe=se?.branch??k.branch??(S.worktrees.length>0||k.worktreeId?"detached":"Branches"),ue=pe!=="Branches",Ce=new Map(S.branches.map(ft=>[ft.name,ft.updatedAt])),Pe=[...S.worktrees].sort(epn(Ce)).filter(ft=>nTt(c,ft.branch,ft.root)),be=S.branches.filter(ft=>!ft.worktreeId&&nTt(c,ft.name)),X=Pe.slice(0,c.trim()?30:10),we=be.slice(0,c.trim()?50:20),qe=Pe.length-X.length,bt=be.length-we.length,Pt=c.trim(),Wt=S.branches.some(ft=>ft.name===Pt),zt=Pe.length>0||be.length>0;return q.jsxs("div",{className:"volter-worktree-switcher",children:[q.jsxs(gBe,{ref:t,className:"volter-worktree-trigger","aria-label":ue?`Branches and worktrees, current branch ${pe}${se?.dirty?", uncommitted changes":""}`:"Branches and worktrees","aria-expanded":n,title:ue?`Branches and worktrees — ${pe}${se?.dirty?" (uncommitted changes)":""}`:"Branches and worktrees",onClick:()=>{s(ft=>!ft),n||d("")},onKeyDown:ft=>{ft.key==="ArrowDown"&&(ft.preventDefault(),s(!0))},children:[q.jsx(dc,{icon:m0r}),se?.dirty&&q.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"}),se&&q.jsx(rTt,{worktree:se})]}),n&&q.jsxs(yBe,{anchorRef:t,align:"start",clamp:!0,autoFocusFirst:!1,className:"volter-worktree-menu","aria-label":"Branches and worktrees",onDismiss:()=>s(!1),children:[q.jsxs("div",{className:"volter-worktree-search",children:[q.jsx(Zm,{autoFocus:!0,"aria-label":"Find a branch",placeholder:"Find a branch…",value:c,disabled:F!==null||A,onChange:ft=>d(ft.target.value)}),q.jsx(Ms,{variant:"ghost",size:"compact","aria-label":"Refresh branches and worktrees",title:"Refresh",disabled:F!==null,onClick:()=>void G("refresh",$,()=>{}),children:q.jsx(dc,{icon:PTt})})]}),q.jsx(t2,{}),q.jsxs("div",{className:"volter-worktree-results",children:[A&&S.worktrees.length===0&&q.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"Loading branches…"}),X.length>0&&q.jsxs("section",{"aria-label":"Worktrees",children:[q.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-section-label",children:"Worktrees"}),X.map(ft=>{const tr=ft.branch??"Detached HEAD";return q.jsxs("div",{className:"volter-worktree-row-shell",children:[q.jsxs(Jc,{className:"volter-worktree-menu-item","data-current":ft.current||void 0,disabled:ft.current||!ft.project||F!==null,"aria-current":ft.current?"true":void 0,title:ft.root,onSelect:()=>void G(ft.worktreeId,()=>XZr(ft.worktreeId),()=>s(!1)),children:[q.jsx("span",{className:"volter-worktree-row-icon",children:ft.current&&q.jsx(dc,{icon:aLe})}),q.jsxs("span",{className:"volter-worktree-row-copy",children:[q.jsxs("span",{className:"volter-worktree-row-title",children:[tr,ft.dirty&&q.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"})]}),q.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.worktreeId?"Opening…":Zdn(ft)})]}),q.jsx(rTt,{worktree:ft})]}),!ft.current&&ft.sessions[0]?.sessionId&&q.jsx(Ms,{type:"button",size:"compact",variant:"ghost","aria-label":`Stop editor for ${tr}`,title:"Stop editor session",disabled:F!==null,onClick:()=>void G(`stop:${ft.worktreeId}`,()=>QZr(ft.worktreeId,ft.sessions[0].sessionId),()=>s(!1)),children:q.jsx(dc,{icon:RTt})}),!ft.current&&ft.sessions.length===0&&!ft.dirty&&q.jsx(Ms,{type:"button",size:"compact",variant:"ghost","aria-label":`Archive worktree ${tr}`,title:"Archive clean worktree",disabled:F!==null,onClick:()=>void G(`archive:${ft.worktreeId}`,()=>ZZr(ft.worktreeId),()=>s(!1)),children:q.jsx(dc,{icon:rCt})})]},ft.worktreeId)}),qe>0&&q.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[qe," more worktrees — search to narrow"]})]}),we.length>0&&q.jsxs("section",{"aria-label":"Local branches",children:[q.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-section-label",children:"Local branches"}),we.map(ft=>q.jsxs(Jc,{className:"volter-worktree-menu-item",disabled:F!==null,onSelect:()=>void G(ft.name,()=>KSt(ft.name),()=>s(!1)),children:[q.jsx("span",{className:"volter-worktree-row-icon"}),q.jsxs("span",{className:"volter-worktree-row-copy",children:[q.jsx("span",{className:"volter-worktree-row-title",children:ft.name}),q.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.name?"Creating worktree…":"Open in a new worktree"})]})]},ft.name)),bt>0&&q.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[bt," more ",Pt?"matches":"branches"," — search to narrow"]})]}),!A&&!zt&&!Pt&&q.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"No branches found."})]}),Pt&&!Wt&&!A&&q.jsxs(q.Fragment,{children:[q.jsx(t2,{}),q.jsxs(Jc,{className:"volter-worktree-create-command",disabled:F!==null,onSelect:()=>void G("create",()=>KSt(Pt),()=>s(!1)),children:[q.jsx("span",{className:"volter-worktree-row-icon",children:"+"}),q.jsxs("span",{className:"volter-worktree-row-copy",children:[q.jsxs("span",{className:"volter-worktree-row-title",children:["Create branch “",Pt,"”"]}),q.jsx("span",{className:"volter-worktree-row-detail",children:F==="create"?"Creating worktree…":`From ${pe}, in a new worktree`})]})]})]}),!Pt&&q.jsxs(q.Fragment,{children:[q.jsx(t2,{}),m?q.jsx(Xdn,{currentLabel:pe,onDone:()=>{g(!1),s(!1),$(!0)},onError:J}):q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-worktree-delegate-open",onClick:()=>g(!0),children:"Delegate to agent…"}),q.jsx(t2,{}),q.jsx(Hdn,{})]}),D&&q.jsx(_p,{as:"div",variant:"caption",tone:"danger",role:"alert",className:"volter-worktree-error",children:D})]})]})}function npn({transport:t}){const[,n]=Ye.useReducer(D=>D+1,0);Ye.useEffect(()=>IC(n),[]);const[s,c]=Ye.useState(!1),d=Ye.useRef(null),m=wf(),g=m?.config.name??"No Project",S=m?.config.version??null,k=m?.config.engine.version??null,A=m?.config.manifestVersion??null,F=m?.rootPath??"";return Ye.useEffect(()=>{if(!s)return;const D=J=>{d.current&&!d.current.contains(J.target)&&c(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[s]),q.jsxs("header",{className:"volter-project-header",children:[lee()?.nativeMenus?q.jsx("div",{className:"volter-project-header-left"}):q.jsxs("div",{ref:d,className:"volter-project-header-left",children:[q.jsxs("div",{className:"volter-project-header-cluster volter-chrome-island volter-glass-island",children:[q.jsxs(gBe,{"data-testid":"project-menu-trigger","aria-label":`${g} project menu`,title:F?`${g} — ${F}`:g,onClick:()=>c(D=>!D),onKeyDown:D=>{D.key==="ArrowDown"&&(D.preventDefault(),c(!0))},className:"volter-project-trigger",children:[q.jsx(dc,{icon:Kk.content.project}),q.jsx(_p,{"data-testid":"project-name","data-project":g,"data-project-version":S??void 0,variant:"label",className:"volter-sr-only",children:g})]}),q.jsx(rpn,{}),q.jsx(bZ,{onPointerDown:()=>c(!1),className:"volter-project-app-menus",children:q.jsx(Ddn,{})})]}),q.jsx(ipn,{}),s&&q.jsxs(fN,{autoFocusFirst:!0,onDismiss:()=>{const D=d.current?.querySelector('[data-testid="project-menu-trigger"]');c(!1),requestAnimationFrame(()=>D?.focus())},className:"volter-project-menu",children:[q.jsx(_p,{"data-testid":"project-menu-name",title:g,variant:"label",truncate:!0,className:"volter-project-menu-name",children:g}),F&&q.jsx(_p,{"data-testid":"project-menu-path",title:F,variant:"caption",tone:"dim",selectable:!0,truncate:!0,className:"volter-project-path",children:F}),S&&k&&A!==null&&q.jsxs(q.Fragment,{children:[F&&q.jsx(t2,{}),q.jsxs("div",{"data-testid":"project-version-summary",className:"volter-project-versions",children:[q.jsx("span",{children:"Editor"}),q.jsxs(_p,{variant:"code",tone:"muted",children:["v",tjt]}),q.jsx("span",{children:"Project"}),q.jsxs(_p,{variant:"code",tone:"muted",children:["v",S]}),q.jsx("span",{children:"Engine"}),q.jsxs(_p,{variant:"code",tone:"muted",children:["v",k]}),q.jsx("span",{children:"Format"}),q.jsxs(_p,{variant:"code",tone:"muted",children:["v",A]})]}),q.jsx(t2,{})]}),F&&q.jsx(Jc,{onSelect:()=>{c(!1),CMe(F)},children:"Show in Finder"}),q.jsx(Jc,{"data-testid":"project-menu-history",onSelect:()=>{c(!1),window.dispatchEvent(new CustomEvent("editor:show-history-tab"))},children:"Undo History…"})]})]}),q.jsx(bZ,{"data-testid":"header-transport",className:"volter-project-transport volter-chrome-island volter-glass-island",align:"center",children:t??q.jsx(opn,{})}),q.jsx(bZ,{className:"volter-project-header-right",justify:"end",align:"center",children:q.jsx(Ame,{slot:"header-trailing"})})]})}function ipn(){Ye.useSyncExternalStore(U$,vhe,vhe),Ye.useSyncExternalStore(gDt,whe,whe);const t=Ye.useSyncExternalStore(bDt,zS,zS);if(mD().workspaceTabs!=="shown")return null;const n=AN().filter(s=>Uk(s.id));return q.jsxs(q.Fragment,{children:[q.jsx(qTr,{orientation:"vertical",className:"volter-project-menu-rule"}),q.jsx("div",{role:"tablist","aria-label":"Workspaces","data-testid":"workspace-tabs",className:"volter-workspace-tabs",children:n.map(s=>q.jsx("button",{type:"button",role:"tab","aria-selected":s.id===t,title:s.description,className:"volter-workspace-tab",onClick:()=>a2(s.id),children:s.title},s.id))})]})}function opn(){Ye.useSyncExternalStore(mLe,YB,YB);const t=$vr();return t.length===0?null:q.jsx(q.Fragment,{children:t.map(({id:n,Component:s})=>q.jsx(s,{documentId:""},n))})}function spn({utility:t,testId:n}){const s=t.Content;return q.jsx("div",{className:"volter-dock-panel volter-regular-panel-portal","data-testid":n??`bottom-panel-utility-${t.id}`,"data-editor-hotkey-scope":"workspace","data-volter-noselect":"true",children:q.jsx(s,{})})}function apn(t,n){return window.confirm(n)}const cpn=4,lpn=4,upn=24,fpn=4,dpn=3,ppn=new Set(["model","image"]),_pn=new Set(["glb","gltf","fbx","obj","dae","stl","ply","spz","bvh","3ds"]);function mpn(t){const n=t.lastIndexOf(".");return n>0&&_pn.has(t.slice(n+1).toLowerCase())}const hpn=new Set(["audio","video","prefab","json"]);function Djt(t){let n=0;const s=[];return async c=>{n>=t&&await new Promise(d=>s.push(d)),n++;try{return await c()}finally{n--,s.shift()?.()}}}function cUe(t){return t.replace(/^(?:\.\/|\/)+/,"").replace(/\/+$/,"")}function gpn(t,n){const s=t?n.slice(t.length+1):n;return s.split("/",1)[0]??s}function oTt(t,n){return t.tier-n.tier||t.depth-n.depth||t.seq-n.seq}function ypn(t,n,s,c){for(const d of t){if(n.length>=c)break;s.has(d.subtree)||(s.add(d.subtree),n.push(d))}for(const d of t){if(n.length>=c)break;n.includes(d)||n.push(d)}}function vpn(t,n){const s=[...t].sort(oTt),c=[],d=new Set;for(const m of[1,2]){const g=s.filter(S=>S.tier===m);ypn(g,c,d,n)}return c.sort(oTt),c.map(({path:m,name:g,kind:S})=>({path:m,name:g,kind:S}))}function bpn(t){return ppn.has(t)?1:hpn.has(t)?2:0}function Spn(t,n,s,c){for(const d of s){if(d.name.startsWith("."))continue;const m=n.dir?`${n.dir}/${d.name}`:d.name;if(d.type==="directory"){n.depth+1>t.maxDepth?t.truncated=!0:c.push({dir:m,depth:n.depth+1});continue}t.totalAssets++;const g=mpn(d.name)?"model":ig(d.name).kind,S=bpn(g);S!==0&&t.candidates.push({path:m,name:d.name,kind:g,tier:S,depth:n.depth,seq:t.seq++,subtree:gpn(t.base,m)})}}async function xpn(t,n,s={}){const c=s.listAssets??eve,d=s.maxItems??cpn,m=s.maxListings??upn,g=Djt(s.listConcurrency??fpn),S=cUe(n),k={base:S,maxDepth:s.maxDepth??lpn,candidates:[],totalAssets:0,truncated:!1,failedListings:0,seq:0};let A=0,F=[{dir:S,depth:0}];for(;F.length>0;){const D=Math.max(0,m-A),J=F.slice(0,D);J.length<F.length&&(k.truncated=!0),A+=J.length;const $=await Promise.all(J.map(se=>g(()=>c(t,se.dir)))),G=[];for(const[se,pe]of J.entries()){const ue=$[se];if(!ue||!ue.ok){k.failedListings+=1;continue}Spn(k,pe,ue.entries,G)}F=G}return{items:vpn(k.candidates,d),totalAssets:k.totalAssets,scannedAll:!k.truncated&&k.failedListings===0,failedListings:k.failedListings}}const Pjt="\0",JO=new Map,wpn=Djt(dpn);function Tpn(t,n,s){const c=`${t}${Pjt}${cUe(n)}`,d=JO.get(c);if(d)return d;const m=wpn(()=>xpn(t,n,s));JO.set(c,m);const g=()=>{JO.get(c)===m&&JO.delete(c)};return m.then(S=>{(S.failedListings>0||S.items.length===0&&S.totalAssets===0)&&g()},g),m}function Cpn(t,n){return t===n||t===""||n===""||t.startsWith(`${n}/`)||n.startsWith(`${t}/`)}function sTt(t){if(t===void 0){JO.clear();return}const n=cUe(t);for(const s of[...JO.keys()]){const c=s.slice(s.indexOf(Pjt)+1);Cpn(c,n)&&JO.delete(s)}}function Vje(t,n="$"){return typeof t=="string"?[{path:n,value:t}]:Array.isArray(t)?t.flatMap((s,c)=>Vje(s,`${n}[${c}]`)):!t||typeof t!="object"?[]:Object.entries(t).flatMap(([s,c])=>Vje(c,`${n}.${s}`))}function Epn(t,n){if(!n||!t.toLowerCase().endsWith(".gltf"))return[];try{const s=JSON.parse(n),c=t.includes("/")?t.slice(0,t.lastIndexOf("/")+1):"";return[...s.buffers??[],...s.images??[]].flatMap(d=>d.uri&&!d.uri.startsWith("data:")?[`${c}${d.uri}`]:[])}catch{return[]}}function kpn(t){const n=new Map(t.files.map(A=>[A.path.replace(/^\//,""),A])),s=t.assetPath.replace(/^\//,""),c=n.get(s),d=new Set,m=ig(s);if(c||d.add("missing-file"),m.importable?m.runtimeReady||d.add("source-only"):d.add("unsupported-format"),c?.text&&m.kind==="json")try{JSON.parse(c.text)}catch{d.add("invalid-metadata")}const g=Epn(s,c?.text);g.some(A=>!n.has(A))&&d.add("missing-dependency");const S=[];for(const A of t.files)if(!(!A.text||!/\.json$/i.test(A.path)))try{for(const F of Vje(JSON.parse(A.text))){const D=F.value.replace(/^\//,"");D===s?S.push({ownerPath:A.path,jsonPath:F.path,assetPath:s}):D.startsWith("assets/")&&!n.has(D)&&d.add("broken-asset-reference")}}catch{}d.size===0&&d.add("healthy");const k=new Set(["missing-file","missing-dependency","invalid-metadata","broken-asset-reference"]);return{health:{status:[...d].some(A=>k.has(A))?"error":d.has("healthy")?"healthy":"warning",codes:[...d]},dependencies:g,references:S}}async function Ijt(t,n=""){const s=await t.list(n),c=[];for(const d of s){const m=n?`${n}/${d.name}`:d.name;d.type==="dir"?c.push(...await Ijt(t,m)):/\.json$|\.gltf$/i.test(m)?c.push({path:m,text:await t.read(m)}):c.push({path:m})}return c}async function Apn(t,n){return kpn({assetPath:n,files:await Ijt(t)})}function y_e(t){typeof window>"u"||(window.dispatchEvent(new CustomEvent("editor:asset-mutation",{detail:t})),window.dispatchEvent(new CustomEvent("editor:assets-changed")))}function K4(t){const n=t.replace(/^\/+/,"").replace(/\\/g,"/").replace(/\/{2,}/g,"/");if(!n||n==="."||n.split("/").some(s=>!s||s===".."))throw new Error(`Invalid project asset path: ${t}`);return n}async function OOe(t,n){for(const s of n)if(await t.exists(s))throw new Error(`An asset already exists at ${s}.`)}async function Dpn(t,n){const s=E$e(n.history,n.backend);switch(t.type){case"create-folder":{const c=K4(t.path),d=`${c}/.volter-folder`;if(await n.backend.exists(c))throw new Error(`Folder already exists: ${c}.`);return s.write(d,"",{label:`Create folder ${c}`})}case"duplicate":{const c=K4(t.source),d=K4(t.destination);await OOe(n.backend,[d]);const m=await n.backend.readBytes(c);return s.write(d,m,{label:`Duplicate ${c}`})}case"move":{const c=K4(t.source),d=K4(t.destination);await OOe(n.backend,[d]);const m=await n.backend.readBytes(c),g=new Map([[d,m],[c,null]]),S=await s.mutate([...g].map(([k,A])=>({path:k,data:A})),{label:`Move ${c}`});return S&&y_e({type:"move",oldPath:c,newPath:d}),S}case"move-many":{const c=t.moves.map(A=>({source:K4(A.source),destination:K4(A.destination)}));if(c.length===0)return!1;const d=new Set(c.map(A=>A.source)),m=c.map(A=>A.destination);if(new Set(m).size!==m.length)throw new Error("Batch move destinations must be unique.");for(const A of m)if(!d.has(A)&&await n.backend.exists(A))throw new Error(`An asset already exists at ${A}.`);const g=await Promise.all(c.map(async A=>({...A,bytes:await n.backend.readBytes(A.source)}))),S=new Map;for(const{destination:A,bytes:F}of g)S.set(A,F);for(const{source:A}of g)m.includes(A)||S.set(A,null);const k=await s.mutate([...S].map(([A,F])=>({path:A,data:F})),{label:`Move ${c.length} assets`});if(k)for(const A of c)y_e({type:"move",oldPath:A.source,newPath:A.destination});return k}case"delete":{const c=[...new Set(t.paths.map(K4))],d=await s.mutate(c.map(m=>({path:m,data:null})),{label:`Delete ${c.length} asset${c.length===1?"":"s"}`});return d&&y_e({type:"delete",paths:c}),d}case"import":{const c=t.files.map(m=>({path:K4(m.path),data:m.bytes}));await OOe(n.backend,c.map(m=>m.path));const d=await s.mutate(c,{label:`Import ${c.length} asset${c.length===1?"":"s"}`});return d&&y_e({type:"change",paths:c.map(m=>m.path)}),d}}}const Ppn=320,Ipn=180,Npn="document-preview-v4",gZ=new Map,Opn=new YPt(async t=>{const n=gZ.get(t);if(await new Promise(s=>{typeof requestIdleCallback=="function"?requestIdleCallback(()=>s(),{timeout:1e3}):setTimeout(s,0)}),[...n.consumers].every(s=>s.aborted))throw new DOMException("Preview demand was cancelled.","AbortError");return n.run()},1);let YZ=null,aTt,ROe=null;const WY=new Set;async function Njt(t){const n=gR();let s;try{s=await n.list(t)}catch{return[]}const c=[];for(const d of s)d.type==="dir"?c.push(...await Njt(d.path)):c.push(`${d.path}:${d.size??0}:${d.mtime??0}`);return c}async function Rpn(){const t=wf()?.rootPath;return aTt!==t&&(aTt=t,YZ=null),YZ??=Promise.all([VRt([xR,"volter.adapter.ts",".storybook/**/*","src/**/*.ts","src/**/*.tsx","src/**/*.js","src/**/*.jsx","src/**/*.mjs","src/**/*.cjs","src/**/*.json","src/**/*.css"]).then(async n=>Promise.all(n.map(async s=>`${s}:${await EMe(s)??""}`))),Njt("")]).then(([n,s])=>Ojt([...n,...s].sort().join(`
1404
1404
  `))),YZ}function Fpn(t){return WY.add(t),ROe??=Ag.watch(n=>{if(n.path===PB){XPt();for(const s of WY)s();return}if(!(!/^(src|public|\.storybook)\//.test(n.path)&&n.path!==xR&&n.path!=="volter.adapter.ts")){YZ=null;for(const s of WY)s()}}),()=>{WY.delete(t),WY.size===0&&(ROe?.(),ROe=null,YZ=null)}}async function Mpn(t,n,s){n.throwIfAborted();let c=gZ.get(t);c||(c={run:s,consumers:new Set},gZ.set(t,c)),c.consumers.add(n);const d=Opn.request(t,1);n.addEventListener("abort",d.cancel,{once:!0});try{return await d.promise}finally{n.removeEventListener("abort",d.cancel),c.consumers.delete(n),c.consumers.size===0&&gZ.get(t)===c&&gZ.delete(t)}}async function Ojt(t){const n=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",n);return[...new Uint8Array(s)].map(c=>c.toString(16).padStart(2,"0")).join("")}function jpn(t){const n=/^data:([^;,]+);base64,(.*)$/s.exec(t);if(!n)throw new Error("Document preview owner returned an invalid image data URL.");const s=atob(n[2]),c=new Uint8Array(s.length);for(let d=0;d<s.length;d++)c[d]=s.charCodeAt(d);return{mime:n[1],bytes:c}}function cTt(t,n="image/png"){const s=new Uint8Array(t.byteLength);return s.set(t),URL.createObjectURL(new Blob([s.buffer],{type:n}))}async function Lpn(t){const n=await C$e();if(n.status!=="ok")return;const s=n.manifest.entries[`document:${t}`]?.framing;return s?{position:{x:s.position[0],y:s.position[1],z:s.position[2]},target:{x:s.target[0],y:s.target[1],z:s.target[2]},...s.fov===void 0?{}:{fov:s.fov}}:void 0}async function Bpn(t,n,s,c){const d=wf()?.rootPath??"no-project",m=await Lpn(t),g=JSON.stringify({projectId:d,documentId:t,recipe:Npn,revision:n.revision(),dependencies:await Rpn(),camera:m});c.throwIfAborted();const S=await Ojt(g),k=`.volter/cache/document-previews/${S}.png`;if(s===0&&await Ag.exists(k))return cTt(await Ag.readBytes(k));const A=await Mpn(S,c,()=>n.capture({width:Ppn,height:Ipn,...m?{camera:m}:{}}));c.throwIfAborted();const F=jpn(A);return await Ag.write(k,F.bytes),cTt(F.bytes,F.mime)}function $pn({documentId:t,source:n,previewRevision:s}){const[c,d]=Ye.useState(null),[m,g]=Ye.useState(null),[S,k]=Ye.useState(0),[A,F]=Ye.useState(0),[D,J]=Ye.useState(!0),[$,G]=Ye.useState(!1),se=Ye.useRef(null),pe=Ye.useRef(null),ue=Ye.useRef(null),Ce=Ye.useRef({previewRevision:s,retry:A});return Ye.useEffect(()=>{let De=null;const Pe=()=>{pe.current?.abort(),J(!0),De&&clearTimeout(De),De=setTimeout(()=>k(we=>we+1),750)},be=n.subscribe(Pe),X=Fpn(Pe);return()=>{De&&clearTimeout(De),be(),X()}},[n]),Ye.useEffect(()=>()=>{ue.current?.startsWith("blob:")&&URL.revokeObjectURL(ue.current)},[]),Ye.useEffect(()=>{const De=se.current;if(!De)return;const Pe=new IntersectionObserver(([be])=>G(be?.isIntersecting??!1));return Pe.observe(De),()=>Pe.disconnect()},[]),Ye.useEffect(()=>{if(!$)return;const De=new AbortController;pe.current=De;const Pe=Ce.current.previewRevision!==s||Ce.current.retry!==A?1:0;return g(null),J(!0),Bpn(t,n,Pe,De.signal).then(be=>{if(De.signal.aborted){URL.revokeObjectURL(be);return}ue.current&&URL.revokeObjectURL(ue.current),Ce.current={previewRevision:s,retry:A},ue.current=be,d(be),J(!1)}).catch(be=>{De.signal.aborted||(g(be instanceof Error?be.message:String(be)),J(!1))}),()=>De.abort()},[t,s,A,n,S,$]),q.jsxs("div",{ref:se,style:{width:"100%",height:"100%",position:"relative",display:"grid",placeItems:"center"},children:[c&&q.jsx("img",{src:c,alt:`${t} preview`,style:{width:"100%",height:"100%",objectFit:"contain"}}),m?q.jsx("button",{type:"button",title:m,onClick:De=>{De.stopPropagation(),F(Pe=>Pe+1)},style:{position:"absolute",bottom:0,border:0,background:"var(--vscode-editor-background)",color:Zf[3],pointerEvents:"auto"},children:"Preview unavailable · Retry"}):D?q.jsx("span",{role:"status",style:{position:"absolute",bottom:0,background:"var(--vscode-editor-background)",color:Zf[3],fontSize:YY.xs},children:c?"Refreshing preview…":"Loading preview…"}):null]})}function Rjt(t,n){return rve(t,n.path)}function qpn({root:t,item:n}){const[s,c]=Ye.useState(!1);return s?q.jsx(vD,{kind:"image",size:14}):q.jsx("img",{src:Rjt(t,n),alt:n.name,loading:"lazy",onError:()=>c(!0)})}function zpn({root:t,item:n}){const s=N9t(Rjt(t,n),Uin);return s.failed?q.jsx(vD,{kind:"model",size:14}):s.src?q.jsx("img",{src:s.src,alt:n.name,"data-fit":"contain",onError:s.fromManifest?s.rejectManifest:void 0}):null}function Vpn({root:t,item:n}){return ig(n.name).editor==="environment"?q.jsx(wR,{kind:"image",name:n.name,variant:"cell"}):n.kind==="image"?q.jsx(qpn,{root:t,item:n}):n.kind==="model"?q.jsx(zpn,{root:t,item:n}):q.jsx(wR,{kind:n.kind,name:n.name,variant:"cell"})}function Upn({root:t,folderPath:n,revision:s}){const[c,d]=Ye.useState(null);if(Ye.useEffect(()=>{d(null)},[t,n]),Ye.useEffect(()=>{let g=!1;return Tpn(t,n).then(S=>{g||d(S)},()=>{g||d("failed")}),()=>{g=!0}},[t,n,s]),c===null||c==="failed")return q.jsx(vD,{kind:"folder"});if(c.totalAssets===0)return q.jsx("div",{className:"volter-folder-preview","data-testid":"folder-preview-empty","aria-hidden":"true",children:q.jsxs("div",{className:"volter-folder-preview__empty",children:[q.jsx(dc,{icon:qOe,className:"volter-folder-preview__empty-glyph"}),q.jsx("span",{className:"volter-folder-preview__empty-caption",children:"Empty"})]})});const m=c.scannedAll?`${c.totalAssets}`:`${c.totalAssets}+`;return c.items.length===0?q.jsxs("div",{className:"volter-folder-preview","data-testid":"folder-preview-plain","aria-hidden":"true",children:[q.jsx("div",{className:"volter-folder-preview__fallback",children:q.jsx(vD,{kind:"folder"})}),q.jsx("span",{className:"volter-folder-preview__count",children:m})]}):q.jsxs("div",{className:"volter-folder-preview","data-testid":"folder-preview","aria-hidden":"true",children:[q.jsx("div",{className:"volter-folder-preview__grid","data-count":c.items.length,children:c.items.map(g=>q.jsx("div",{className:"volter-folder-preview__cell",children:q.jsx(Vpn,{root:t,item:g})},g.path))}),q.jsx("span",{className:"volter-folder-preview__chip",children:q.jsx(dc,{icon:uee})}),q.jsx("span",{className:"volter-folder-preview__count",children:m})]})}const Fjt="contentBrowser";function Uje(t){return t.type==="directory"?"folder":ig(t.name).kind}function Jpn(t,n,s){return rve(t,n?`${n}/${s}`:s)}function Wpn(t,n,s){return n?`/${n}/${s}`:`/${s}`}function Hpn(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Jje(t){const n=ig(t);return n.importable?n.runtimeReady?"healthy":"source-only":"unsupported"}const Gpn=640,lTt={scope:"content",root:"public",currentPath:"",viewMode:"grid",sort:"relevance",filter:"all",density:96,expanded:["public"],treeVisibility:"auto",facets:["component"]};function Kpn(){try{const t=Cve(Fjt)??{},n=t.viewMode,s=t.treeVisibility,c=t.scope,d=t.root;return{...lTt,...t,root:d===nA?nA:"public",currentPath:t.currentPath??"",scope:c==="files"?"files":"content",viewMode:c==="files"&&n==="list"?"list":"grid",treeVisibility:s==="shown"||s==="hidden"?s:"auto",facets:Array.isArray(t.facets)&&t.facets.length>0?[t.facets[0]]:["component"]}}catch{return lTt}}const Xpn={listAssets:eve,listProjectComponents:qRt},FOe="Reference material is not part of the built game — it stays in the project's references/ folder and is never exported. Copy the file into public/ to use it in the game; edit or remove it where it lives.",Ypn=new Set(["component","scene","canvas","model","image","video","audio","other"]);function Zpn(t){const n=t.charAt(0).toUpperCase()+t.slice(1);return n.endsWith("s")?n:`${n}s`}async function uTt(t,n){if(!n&&Pp()!==t)throw new Error("Open this scene as the active document before using its current view.");const s=s2(t)?.read()?.camera,c=s&&typeof s!="string"?s:null;if(!n&&!c)throw new Error("The active scene has no ready 3D authoring view to save.");await Gsn().saveThumbnailFraming(`document:${t}`,n?void 0:{position:[c.position.x,c.position.y,c.position.z],target:[c.target.x,c.target.y,c.target.z],fov:c.fov??50})}function Qpn(t){return t.component.surface==="three"?"3d":t.component.surface==="canvas"?"2d":"ui"}function e_n(t){const n={"3d":"3D","2d":"2D",ui:"UI"};return["3d","2d","ui"].flatMap(s=>{const c=t.filter(d=>d.source==="component"&&Qpn(d)===s);return c.length>0?[{id:`prefabs-${s}`,label:n[s],headingLevel:"category",entries:c}]:[]})}function t_n(t,n,s){return n==="files"?[{id:"files",label:null,headingLevel:null,entries:[...t]}]:s.length===1&&s[0]==="component"?e_n(t):t.length>0?[{id:"content",label:null,headingLevel:null,entries:[...t]}]:[]}function Mjt(t){return t.source==="available"?t.available.category:t.source==="component"?t.component.contentKind??"component":t.source==="document"?t.document.kind:z9t(t.name)}function r_n(t){return t.source==="component"?t.component.contentKind??"component":t.source==="available"||t.source==="document"?"source":Uje(t.entry)}function WO(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function n_n(t,n){if(t.source==="component"||t.source==="document"||t.source==="available")return;const{entry:s}=t,{currentRoot:c,currentPath:d,navigate:m,openAsset:g}=n;if(s.type==="directory"){m(c,d?`${d}/${s.name}`:s.name);return}const S=ig(s.name),k=FB(S);if(k){if(t.spritesheet){const A=t.path.includes("#")?t.path.slice(t.path.lastIndexOf("#")+1):s.name.replace(/\.png$/i,"");g(`/${t.spritesheet.sheetPath}#${A}`,k);return}g(Jpn(t.root,d,s.name),k)}}function jjt(t){return t.source==="component"?`Component · line ${t.component.line}`:t.source==="available"?t.path||t.available.descriptor.title:t.source==="document"?`${t.document.kind} · ${t.path}`:t.entry.type!=="file"?"Folder":t.entry.size===void 0?"Size unknown":Hpn(t.entry.size)}function i_n(t){if(t.source==="component")return`${t.name}
@@ -1406,4 +1406,4 @@ ${t.path}:${t.component.line}`;if(t.source==="available")return`${t.name}
1406
1406
  ${t.path}`;if(t.source==="document")return`${t.name}
1407
1407
  ${t.path}`;const n=jjt(t);return n?`${t.name}
1408
1408
  ${n}`:t.name}function o_n(t,n,s){if(t.source==="component"||t.source==="document"||t.source==="available"||n==="all"||t.entry.type==="directory")return!0;const c=ig(t.name),d=s?`${s}/${t.name}`:t.name;return{"runtime-ready":c.runtimeReady,"source-only":c.importable&&!c.runtimeReady,unsupported:!c.importable,imported:d.startsWith("asset-library/local/"),generated:d.startsWith(".generated/")}[n]}function HB(t,n){return t.name.localeCompare(n.name)||t.path.localeCompare(n.path)}function fTt(t){return t.source==="asset"?Eon({path:t.path,root:t.root,entry:t.entry}):t.source==="available"||t.source==="document"?10:kon(t.component)-100}function s_n(t,n){const s=fTt(t),c=fTt(n);return s!==c?s-c:t.source!==n.source?t.source==="component"?-1:1:(t.source==="component"&&n.source==="component"||t.source!=="asset"||n.source!=="asset",HB(t,n))}function dTt(t,n){return t===void 0?n===void 0?0:1:n===void 0?-1:n-t}function a_n(t,n,s){if(t.entry.type!==n.entry.type)return t.entry.type==="directory"?-1:1;if(s==="size"&&t.entry.size!==n.entry.size)return dTt(t.entry.size,n.entry.size);if(s==="modified"&&t.entry.modifiedAt!==n.entry.modifiedAt)return dTt(t.entry.modifiedAt,n.entry.modifiedAt);if(s==="type"){const c=Uje(t.entry).localeCompare(Uje(n.entry));if(c!==0)return c}if(s==="health"){const c=Jje(t.name).localeCompare(Jje(n.name));if(c!==0)return c}return HB(t,n)}function c_n(t,n,s){return s==="relevance"?s_n(t,n):s==="name"?HB(t,n):t.source!==n.source?t.source==="component"?-1:1:t.source!=="asset"||n.source!=="asset"?HB(t,n):a_n(t,n,s)}function l_n(t,n){if(n.query&&!`${t.name} ${t.path}`.toLowerCase().includes(n.query))return!1;if(n.scope==="content"&&n.facets.length>0){const s=Mjt(t);return n.facets.includes(s)}return n.scope==="content"||o_n(t,n.filter,n.shownPath)}const u_n={width:"100%",minWidth:0,padding:0,textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:3},f_n={width:"100%",minWidth:0,minHeight:28,padding:"3px 6px",textAlign:"left",display:"flex",flexDirection:"row",alignItems:"center",gap:7};function d_n(t){const n=new Map;if(!t.assetSubject)return n;const s=t.assetSubject.entries?.()??N3r(t.hierarchy).flatMap(c=>{const d=t.assetSubject?.get(c.id);return d?[{id:c.id,subject:d}]:[]});for(const{id:c,subject:d}of s){const m=d.sourcePath?.replaceAll("\\","/").replace(/^\.\//,"")??"",g=m.lastIndexOf("/src/"),S=g>=0?m.slice(g+1):m;n.set(`${S}:${d.name}`,{id:c,subject:d})}return n}const p_n=()=>()=>{},__n=()=>0;function m_n({sheetUrl:t,frame:n}){return q.jsx(F9t,{sheetUrl:t,frame:{name:"",x:n.x,y:n.y,width:n.width,height:n.height,rotated:n.rotated,sourceWidth:n.sourceWidth,sourceHeight:n.sourceHeight,trimX:n.trimX,trimY:n.trimY},maxEdge:48})}function h_n({item:t,kind:n,assetUrl:s,grid:c,folderPath:d,previewRevision:m}){const g=s;if(n==="folder")return c?q.jsx(Upn,{root:t.source==="asset"?t.root:"public",folderPath:d,revision:m}):q.jsx(vD,{kind:"folder",size:15});if(n==="audio"&&s)return q.jsx(Win,{url:g,name:t.name});if(!c)return q.jsx(vD,{kind:n,size:15});if(t.source==="available"&&t.available.descriptor.preview)return q.jsx($pn,{documentId:t.available.descriptor.id,source:t.available.descriptor.preview,previewRevision:m});if(t.source==="component"){const{Thumbnail:S}=t.contentSource;return q.jsx(S,{entry:t.contentEntry,previewRevision:m})}return ig(t.name).editor==="environment"?q.jsx(wR,{kind:"image",name:t.name}):n==="image"?t.source==="asset"&&t.spritesheet?q.jsx(m_n,{sheetUrl:`/${t.spritesheet.sheetPath}`,frame:t.spritesheet}):q.jsx("img",{src:g,alt:t.name,style:{maxWidth:48,maxHeight:48,objectFit:"contain",borderRadius:sQ.sm}}):n==="video"&&g?q.jsx("video",{src:`${g}#t=0.1`,muted:!0,playsInline:!0,preload:"metadata",style:{maxWidth:48,maxHeight:48,objectFit:"contain",borderRadius:sQ.sm}}):n==="model"||I9t(s)?q.jsx(O9t,{url:s}):["prefab","json"].includes(n)?q.jsx(wR,{kind:n,name:t.name}):q.jsx(vD,{kind:n})}function g_n({item:t,selected:n,onDragStart:s,onSelect:c,onOpen:d,onContextMenu:m,viewMode:g,previewRevision:S,showPath:k}){const A=r_n(t),F=t.source==="asset"?t.entry:null,D=F?.type==="file"?ig(F.name):null,J=t.source==="asset"?rve(t.root,t.path):"",$=t.path,G=i_n(t),se=F?F.type==="directory"||D?.placeable?D?.placeable?"grab":"pointer":"default":"pointer",pe=jjt(t),ue=t.source==="component"?t.path:t.source==="asset"?Oge(t.root,WO(t.path)).replace(/\/$/,""):WO(t.path)||"public",Ce=k?`${ue} · ${pe}`:pe,De=g!=="list";return q.jsxs("div",{className:"volter-selectable volter-project-asset-entry","data-selected":n||void 0,"data-view":g,role:"option","aria-selected":n,tabIndex:0,draggable:t.source==="component"||t.source==="asset"&&F?.type==="file"&&D?.placeable===!0||t.source==="asset"&&t.spritesheet!==void 0||t.source==="asset"&&t.root===nA&&F?.type==="file",onPointerEnter:()=>{A==="audio"&&J&&Bin(J)},onPointerLeave:()=>{A==="audio"&&J&&$in(J)},onDragStart:Pe=>s(Pe,t),onDragEnd:S3r,onClick:Pe=>c(t,Pe),onDoubleClick:()=>d(t),onContextMenu:Pe=>m(Pe,t),onKeyDown:Pe=>{if(Pe.key==="ContextMenu"||Pe.shiftKey&&Pe.key==="F10"){Pe.preventDefault();const be=Pe.currentTarget.getBoundingClientRect();Pe.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:be.left,clientY:be.bottom}))}else Pe.key==="Enter"?d(t):Pe.key===" "&&(c(t,Pe),Pe.preventDefault())},title:G,style:{...De?u_n:f_n,borderRadius:sQ.sm,cursor:se,userSelect:"none"},children:[q.jsxs("div",{className:"volter-project-asset-entry__preview","data-testid":"asset-entry-preview",style:{...De?{width:"100%",aspectRatio:t.source==="available"&&t.available.descriptor.preview?"16 / 9":"1 / 1",margin:"0 auto"}:{width:18,height:18,margin:0},display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",borderRadius:sQ.sm,pointerEvents:"none",position:"relative"},children:[q.jsx(h_n,{item:t,kind:A,assetUrl:J,grid:De,folderPath:$,previewRevision:S}),De&&q.jsx("span",{className:"volter-project-asset-entry__kind","data-testid":"asset-entry-kind",title:`${A} asset`,children:q.jsx(vD,{kind:A,size:11})})]}),q.jsx("div",{"data-testid":"asset-entry-name",style:{...De?{fontSize:10,lineHeight:"13px",minHeight:26,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2}:{fontSize:11,lineHeight:"18px",flex:1},overflow:"hidden",textOverflow:"ellipsis",whiteSpace:De?"normal":"nowrap",color:Zf[1],minWidth:0},children:t.name}),!De&&q.jsx("div",{role:"listbox","aria-label":"Project assets","aria-multiselectable":"true",style:{maxWidth:"45%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:Zf[3],fontSize:10},children:Ce})]})}function y_n({scope:t,facets:n,availableFacets:s,currentPath:c,currentRoot:d,searchOpen:m,searchQuery:g,viewMode:S,density:k,treeVisible:A,onScopeChange:F,onFacetToggle:D,onFacetsClear:J,onNavigate:$,onSearchOpenChange:G,onSearchQueryChange:se,onViewModeChange:pe,onDensityChange:ue,onTreeVisibilityToggle:Ce,onCreateFolder:De,onImport:Pe,onDelete:be,deleteDisabled:X,onRefresh:we,generationTools:qe,onGenerate:bt}){const Pt=Ye.useRef(null),Wt=Ye.useRef(!0),zt=Ye.useRef(null),[ft,tr]=Ye.useState(!1),Qt=c?c.split("/"):[],Tt=WO(c),vn=d===nA?"References":"Files",Yr=()=>{se(""),G(!1)};return Ye.useEffect(()=>{if(!ft)return;const en=ii=>{Pt.current?.contains(ii.target)||tr(!1)};return document.addEventListener("pointerdown",en),()=>document.removeEventListener("pointerdown",en)},[ft]),Ye.useLayoutEffect(()=>{const en=zt.current;if(!en)return;const ii=()=>{en.scrollLeft=en.scrollWidth};Wt.current=!0,ii();const No=()=>{Wt.current=en.scrollWidth-en.clientWidth-en.scrollLeft<=1};en.addEventListener("scroll",No,{passive:!0});const gn=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{Wt.current&&ii()});return gn?.observe(en),()=>{en.removeEventListener("scroll",No),gn?.disconnect()}},[c,m]),q.jsxs("div",{className:"volter-project-assets-toolbar",children:[q.jsxs(n$,{label:"Content display",compact:!0,className:"volter-project-assets-toolbar__row",children:[q.jsxs(Dht,{children:[q.jsx(mO,{text:"Content grid",position:"top",children:q.jsx(dm,{"aria-label":"Content grid","data-testid":"content-scope-content","aria-pressed":t==="content",onClick:()=>{t!=="content"&&F("content"),pe("grid")},children:q.jsx(dc,{icon:ivr})})}),q.jsx(mO,{text:"Browse grid",position:"top",children:q.jsx(dm,{"aria-label":"Browse grid","data-testid":"content-scope-files","aria-pressed":t==="files"&&S==="grid",onClick:()=>{t!=="files"&&F("files"),pe("grid")},children:q.jsx(dc,{icon:FTt})})}),q.jsx(mO,{text:"Browse list",position:"top",children:q.jsx(dm,{"aria-label":"Browse list","data-testid":"asset-view-list","aria-pressed":t==="files"&&S==="list",onClick:()=>{t!=="files"&&F("files"),pe("list")},children:q.jsx(dc,{icon:vZ})})})]}),q.jsx("span",{style:{flex:1}}),m?q.jsx(Zm,{type:"text","data-testid":"asset-search-input","aria-label":"Search content",placeholder:"Search content...",value:g,onChange:en=>se(en.target.value),onKeyDown:en=>{en.key==="Escape"&&Yr()},className:"volter-input",autoFocus:!0,style:{flex:"0 1 160px",minWidth:60}}):null,q.jsx(mO,{text:m?"Close search":"Search",position:"top",children:q.jsx(dm,{"data-testid":m?"asset-search-close":"asset-search-toggle","aria-label":m?"Close search":"Search content",onClick:()=>{m?Yr():G(!0)},children:q.jsx(dc,{icon:m?Kk.action.close:Kk.action.search})})})]}),q.jsxs(n$,{label:t==="content"?"Content types":"Folder navigation",compact:!0,className:"volter-project-assets-toolbar__row",children:[t==="files"&&q.jsxs(q.Fragment,{children:[q.jsx(mO,{text:A?"Hide folders":"Show folders",position:"top",children:q.jsx(dm,{"data-testid":"asset-tree-toggle","aria-label":A?"Hide folder tree":"Show folder tree","aria-controls":"project-asset-tree","aria-expanded":A,onClick:Ce,children:q.jsx(dc,{icon:tCt})})}),q.jsx(mO,{text:"Back",position:"top",children:q.jsx(dm,{"data-testid":"asset-back","aria-label":"Back",disabled:!c,onClick:()=>$(d,Tt),children:q.jsx(dc,{icon:H0r})})}),q.jsxs("nav",{ref:zt,"data-testid":"asset-breadcrumb","aria-label":"Asset location",style:{flex:1,display:"flex",alignItems:"center",gap:2,fontSize:12,minWidth:0,overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap"},children:[c?q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>$(d,""),style:{flexShrink:0},children:vn}):q.jsx("span",{"aria-current":"location",style:{color:Zf[1]},children:vn}),Qt.map((en,ii)=>{const No=Qt.slice(0,ii+1).join("/"),gn=ii===Qt.length-1;return q.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,flexShrink:0},children:[q.jsx("span",{style:{color:Zf[3]},children:"/"}),gn?q.jsx("span",{"aria-current":"location",title:en,style:{color:Zf[1]},children:en}):q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>$(d,No),children:en})]},No)})]})]}),t==="content"&&q.jsxs(Dht,{className:"volter-content-filter-inline","aria-label":"Content types",children:[m&&q.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-content-filter-chip","data-testid":"content-filter-all","aria-pressed":n.length===0,onClick:J,children:"All"}),[...[["component","Prefabs"],["scene","Scenes"],["canvas","Canvases"],["model","Models"],["image","Images"],["video","Videos"],["audio","Audio"],["other","Other"]].filter(([en])=>s.has(en)),...[...s].filter(en=>!Ypn.has(en)).sort().map(en=>[en,Zpn(en)])].map(([en,ii])=>q.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-content-filter-chip","data-testid":`content-filter-${en}`,"aria-pressed":n.includes(en),onClick:()=>D(en),children:ii},en))]}),q.jsxs("div",{ref:Pt,className:"volter-project-assets-toolbar__more",children:[q.jsx(mO,{text:"More asset actions",position:"top",children:q.jsx(dm,{"aria-label":"More asset actions","aria-expanded":ft,"aria-haspopup":"menu",onClick:()=>tr(en=>!en),children:q.jsx(dc,{icon:_0r})})}),ft&&q.jsxs(fN,{autoFocusFirst:!0,className:"volter-project-assets-toolbar__menu",onDismiss:()=>tr(!1),children:[q.jsx(Jc,{"data-command-id":O_.import.id,onSelect:()=>{tr(!1),Pe()},children:"Import files…"}),q.jsx(Jc,{"data-command-id":O_.createFolder.id,onSelect:()=>{tr(!1),De()},children:"New folder"}),qe.length>0&&q.jsxs(q.Fragment,{children:[q.jsx("hr",{className:"volter-menu-separator"}),q.jsx(Jc,{onSelect:()=>{tr(!1),bt()},children:"Create asset…"})]}),q.jsx(Jc,{onSelect:()=>{tr(!1),ue(k<=96?132:88)},children:k<=96?"Larger thumbnails":"Smaller thumbnails"}),q.jsx(Jc,{disabled:X,"data-command-id":O_.delete.id,onSelect:()=>{tr(!1),be()},children:"Delete selected"}),q.jsx(Jc,{onSelect:()=>{tr(!1),we()},children:"Refresh"})]})]})]})]})}function v_n(t){const[n,s]=Ye.useState(new Map);Ye.useEffect(()=>{s(new Map)},[t.revision]),Ye.useEffect(()=>{for(const d of t.expanded){if(n.has(d))continue;const m=WRt.find(S=>d===S||d.startsWith(`${S}/`));if(!m)continue;const g=d===m?"":d.slice(`${m}/`.length);t.loadAssets(m,g).then(S=>{S.ok&&s(k=>{const A=new Map(k);return A.set(d,S.entries.filter(F=>F.type==="directory").map(F=>F.name)),A})})}},[n,t.expanded,t.loadAssets]);const c=(d,m,g)=>{const S=m?`${d}/${m}`:d,k=t.expanded.has(S),A=m.split("/").pop()||d;return q.jsxs("div",{children:[q.jsxs("div",{className:"volter-asset-tree-row",style:{paddingLeft:6+g*14},children:[q.jsx(dm,{className:"volter-asset-tree-toggle","aria-label":`${k?"Collapse":"Expand"} ${A}`,"aria-expanded":k,onClick:()=>t.onExpanded(S),children:q.jsx(dc,{icon:MTt,style:{transform:k?"rotate(90deg)":void 0}})}),q.jsxs(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target","aria-current":t.currentRoot===d&&t.currentPath===m?"page":void 0,onClick:()=>t.onNavigate(d,m),children:[q.jsx(dc,{icon:uee}),A]})]}),k&&n.get(S)?.map(F=>c(d,m?`${m}/${F}`:F,g+1))]},S)};return q.jsxs("aside",{id:"project-asset-tree",className:"volter-asset-tree","aria-label":"Project asset sources",hidden:t.hidden,children:[q.jsx("div",{className:"volter-asset-facet-title",children:"Project"}),c("public","",0),q.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target",onClick:()=>t.onNavigate("public","asset-library/local"),children:"Imported"}),q.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target",onClick:()=>t.onNavigate("public",".generated"),children:"Generated"}),q.jsx("div",{className:"volter-asset-facet-title",children:"References"}),c(nA,"",0)]})}function b_n(t){const n=Ye.useRef(null),[s,c]=Ye.useState(t),[d,m]=Ye.useState(!0);Ye.useLayoutEffect(()=>{const k=n.current;if(!k)return;const A=D=>{D>0&&m(D>=Gpn)};if(A(k.getBoundingClientRect().width),typeof ResizeObserver>"u")return;const F=new ResizeObserver(([D])=>{D&&A(D.contentRect.width)});return F.observe(k),()=>F.disconnect()},[]);const g=s==="shown"||s==="auto"&&d,S=Ye.useCallback(()=>{c(g?"hidden":"shown")},[g]);return{browserRef:n,treeVisibility:s,treeVisible:g,toggleTreeVisibility:S}}function S_n({services:t=Xpn}){const n=Yv(),s=typeof n.subscribe=="function"?n.subscribe:p_n,c=typeof n.getSnapshot=="function"?n.getSnapshot:__n,d=typeof n.getShellSnapshot=="function"?n.getShellSnapshot:c,m=Ye.useSyncExternalStore(s,d,d),g=Ye.useSyncExternalStore(Cee,AD,AD),S=Ye.useSyncExternalStore(o2,K1,K1),k=Ye.useRef(n);k.current=n;const A=Z9t(),F=Ye.useSyncExternalStore(u2,rA,rA),D=Ye.useSyncExternalStore(T9t,Jge,Jge),J=F.filter(pr=>pr.point==="workspace.document"&&pr.tool?.generation?.role==="submit"),$=Ye.useMemo(Kpn,[]),[G,se]=Ye.useState($.root),[pe,ue]=Ye.useState($.scope),[Ce,De]=Ye.useState($.facets),[Pe,be]=Ye.useState($.currentPath),[X,we]=Ye.useState($.viewMode),[qe,bt]=Ye.useState($.scope==="content"?"relevance":"name"),[Pt,Wt]=Ye.useState("all"),[zt,ft]=Ye.useState($.density),{browserRef:tr,treeVisibility:Qt,treeVisible:Tt,toggleTreeVisibility:vn}=b_n($.treeVisibility),[Yr,en]=Ye.useState(!1),[ii,No]=Ye.useState({path:$.currentPath,entries:[]}),[gn,En]=Ye.useState([]),[cs,On]=Ye.useState([]),ji=Ye.useSyncExternalStore(Stn,ive),Ja=Ye.useSyncExternalStore(OC,u0,u0),[_a,Pn]=Ye.useState(!1),[js,fa]=Ye.useState([]),[Nt,Bc]=Ye.useState(new Set($.expanded)),[Ni,Dc]=Ye.useState(0),[vc,Tf]=Ye.useState(0),[Np,Au]=Ye.useState(""),[dl,bu]=Ye.useState(new Set),[Al,Ku]=Ye.useState(null),[pl,gs]=Ye.useState(null),[Xu,$r]=Ye.useState(""),Sl=Ye.useCallback(pr=>{$r(pr.initial),gs(pr)},[]),[Rl,mi]=Ye.useState(!1),[tu,Wc]=Ye.useState(null),[Ao,ia]=Ye.useState(null),Du=Ye.useRef(null),gp=Ye.useRef(new Map),Id=Ye.useRef("");Ye.useEffect(()=>{Eve(Fjt,{scope:pe,root:G,facets:Ce,currentPath:Pe,viewMode:X,sort:qe,filter:Pt,density:zt,expanded:[...Nt],treeVisibility:Qt})},[Pe,G,zt,Nt,Ce,Pt,pe,qe,Qt,X]);const ea=Ye.useCallback(async(pr,Ur)=>{const Ei=`${pr}:${Ur}`;Id.current=Ei;const Li=(kc,Nd)=>{Id.current===Ei&&No({path:Ur,entries:kc,...Nd===void 0?{}:{failure:Nd}})},uc=gp.current.get(Ei);if(uc){Li(uc);return}try{const kc=await t.listAssets(pr,Ur);if(!kc.ok){Li([],kc.reason);return}gp.current.set(Ei,kc.entries),Li(kc.entries)}catch(kc){Li([],kc instanceof Error?kc.message:String(kc))}},[t]);Ye.useEffect(()=>{ea(G,Pe)},[G,Pe,ea]);const Pu=Ye.useCallback(async()=>{Pn(!0);try{const[pr,Ur]=await Promise.all([q9t(t.listAssets),t.listProjectComponents()]),Ei=await Ton(pr.assets,async Li=>{try{const uc=await fetch(`/${Li}`);return uc.ok?await uc.text():null}catch{return null}});En(Ei),On(Ur.ok?Ur.entries:[]),fa([...pr.failedListings,...Ur.ok?[]:[`component index: ${Ur.reason}`]])}catch(pr){En([]),On([]),fa([pr instanceof Error?pr.message:String(pr)])}finally{Pn(!1)}},[t]);Ye.useEffect(()=>{pe==="content"&&Pu()},[Pu,pe]);const Ls=Ye.useCallback((pr,Ur)=>{se(pr),be(Ur),bu(new Set),Wc(null),oD(),Au(""),en(!1)},[]),Ff=Ye.useCallback(pr=>{ue(pr),bt(pr==="content"?"relevance":"name"),Wt("all"),bu(new Set),Wc(null),oD()},[]),Hs=Ye.useCallback(pr=>{De([pr])},[]),Ds=Ye.useCallback(pr=>{en(pr),pr||De(Ur=>Ur.length>0?Ur:["component"])},[]),Oc=ii.path,Ze=Ye.useMemo(()=>d_n(Cm(k.current).adapter),[g,m,S]),jt=Ye.useMemo(()=>Cm(k.current).surface,[g,m,S]),mt=Ye.useMemo(()=>{if(pe==="content"){const pr=new Map(cs.map(Li=>[`${Li.path}:${Li.name}`,Li])),Ur=Din().flatMap(Li=>Li.entries({components:cs,surface:jt}).flatMap(uc=>{const kc=pr.get(`${uc.component.path}:${uc.component.name}`);if(!kc)return[];const Nd=`${kc.path.replace(/^\.\//,"")}:${kc.name}`,Lo=Ze.get(Nd);return[{source:"component",key:`component:${Li.id}:${uc.id}`,name:kc.name,path:kc.path,component:kc,contentSource:Li,contentEntry:uc,...Lo?{authoringAsset:Lo}:{}}]})),Ei=(Ja?.scenes.entries??[]).flatMap(Li=>{if(Li.kind==="prefab")return[];const uc=Li.kind==="scene"?eVe(Li):null;return uc&&ji.some(kc=>(kc.category==="scene"||kc.category==="canvas")&&(uc.kind==="root-document"&&kc.rootId===uc.regionId||uc.kind==="isolation-document"&&kc.descriptor.id===uc.documentId||!!Li.source?.path&&kc.descriptor.provenance?.sourcePath?.replace(/^\.\//,"")===Li.source.path.replace(/^\.\//,"")))?[]:Li.kind!=="scene"&&!Li.source?[]:[{source:"document",key:`document:${Li.id}`,name:Li.label,path:Li.source?.path??"",document:Li}]});return[...Ur,...Ei,...ji.map(Li=>({source:"available",key:`available:${Li.descriptor.id}`,name:Li.descriptor.title,path:Li.descriptor.provenance?.sourcePath??"",available:Li})),...gn.map(({path:Li,root:uc,entry:kc,spritesheet:Nd})=>({source:"asset",key:`asset:${uc}:${Li}`,name:kc.name,path:Li,root:uc,entry:kc,...Nd?{spritesheet:Nd}:{}}))]}return ii.entries.map(pr=>{const Ur=ii.path?`${ii.path}/${pr.name}`:pr.name;return{source:"asset",key:`asset:${G}:${Ur}`,name:pr.name,path:Ur,root:G,entry:pr}})},[jt,Ja,ji,Ze,cs,gn,D,G,ii,pe]),xt=pe==="content"?js[0]??null:ii.failure??null,xr=Ye.useMemo(()=>{const pr=Np.toLowerCase(),Ur=mt.filter(Li=>l_n(Li,{query:pr,scope:pe,facets:Ce,filter:Pt,shownPath:Oc})),Ei=pe==="files"&&qe==="relevance"?"name":qe;return[...Ur].sort((Li,uc)=>c_n(Li,uc,Ei))},[mt,Ce,Oc,Pt,pe,Np,qe]),Vn=Ye.useMemo(()=>{const pr=new Set;for(const Ur of mt)pr.add(Mjt(Ur));return pr},[mt]),eo=Ye.useMemo(()=>t_n(xr,pe,Ce),[Ce,xr,pe]),bi=Ye.useCallback((pr,Ur)=>{if(Ur.source==="component"){const Lo={path:Ur.path,kind:"component",name:Ur.name,component:{kind:"component",name:Ur.component.name,sourcePath:Ur.component.path,exportKind:Ur.component.defaultExport?"default":"named",surface:Ur.component.surface}};pr.dataTransfer.setData("text/plain",Ur.name),pr.dataTransfer.setData("application/x-editor-asset",JSON.stringify(Lo));return}if(Ur.source==="document"||Ur.source==="available"){if("dataTransfer"in pr){pr.dataTransfer.setData("text/plain",Ur.path);return}return}const{entry:Ei}=Ur,Li=ig(Ei.name);if(Ur.root===nA){pr.preventDefault(),i0(`${Ei.name} is reference material. ${FOe}`);return}if(Ur.spritesheet){pr.preventDefault(),i0(`${Ei.name} is one frame of the ${Ur.spritesheet.sheetPath.split("/").pop()??"sprite sheet"} sprite sheet — it is placed through the Prefab that animates it, not on its own. Drop a Prefab, or a standalone image file.`);return}if(Ei.type!=="file"||!Li.placeable){pr.preventDefault();return}const uc=FB(Li);if(!uc)return;const Nd={path:Wpn(G,WO(Ur.path),Ei.name),kind:uc,name:Ei.name};pr.dataTransfer.setData("text/plain",Ei.name),pr.dataTransfer.setData("application/x-editor-asset",JSON.stringify(Nd))},[G]),ta=Ye.useCallback((pr,Ur)=>{let Ei=new Set;if(Ur.shiftKey&&tu){const Op=xr.findIndex(Rh=>Rh.key===tu),ls=xr.findIndex(Rh=>Rh.key===pr.key);if(Op>=0&&ls>=0){const[Rh,Gi]=Op<ls?[Op,ls]:[ls,Op];Ei=new Set(xr.slice(Rh,Gi+1).map(U=>U.key))}}else Ur.metaKey||Ur.ctrlKey?(Ei=new Set(dl),Ei.has(pr.key)?Ei.delete(pr.key):Ei.add(pr.key),Wc(pr.key)):(Ei.add(pr.key),Wc(pr.key));if(bu(Ei),pr.source==="component"){if(pr.component.contentKind==="image"&&pr.authoringAsset){BI({path:pr.authoringAsset.subject.sourcePath??pr.path,name:pr.name,kind:"image",capabilities:ig("svg"),health:"healthy",selectionCount:Ei.size});return}BI({path:pr.path,name:pr.name,kind:"component",health:"healthy",selectionCount:Ei.size,componentPreview:{surface:pr.component.surface,sourcePath:pr.component.path}});return}if(pr.source==="document"||pr.source==="available"){BI({path:`/${pr.path}`,name:pr.name,kind:"source",capabilities:ig(pr.name),origin:"project",health:"healthy",selectionCount:Ei.size});return}const{entry:Li}=pr;if(Li.type==="directory"){oD();return}const uc=ig(Li.name),kc=FB(uc)??"unknown",Nd=rve(pr.root,pr.path);if(BI({path:Nd,name:Li.name,kind:kc,...Li.size===void 0?{}:{sizeBytes:Li.size},capabilities:uc,health:Jje(Li.name),selectionCount:Ei.size,...pr.path.startsWith("asset-library/local")?{sourcePath:"Asset Library provenance metadata"}:{}}),pr.root!=="public")return;const Lo=pr.path;Apn(gR(),Lo).then(Op=>{const ls=Nd;X0e()?.path===ls&&BI({path:ls,name:Li.name,kind:kc,...Li.size===void 0?{}:{sizeBytes:Li.size},capabilities:uc,health:Op.health.status==="healthy"?"healthy":uc.runtimeReady?"unsupported":"source-only",healthCodes:Op.health.codes,dependencies:Op.dependencies,references:Op.references,selectionCount:Ei.size})}).catch(()=>{})},[xr,dl,tu]),ic=Ye.useCallback(pr=>{if(pr.source==="component"){if(pr.authoringAsset){_Qr(pr.authoringAsset.id,pr.authoringAsset.subject);return}pr.contentSource.open(n,pr.contentEntry,pr.name);return}if(pr.source==="available"){SN(pr.available.descriptor.id);return}if(pr.source==="document"){if(pr.document.kind==="scene"){const Ur=NFt(pr.document.id);Ur.ok||Qs.error(Ur.error,"scene");return}ID(pr.document)||sN(`/${pr.path}`,DFt(pr.document));return}n_n(pr,{currentRoot:G,currentPath:pr.source==="asset"?WO(pr.path):"",navigate:Ls,openAsset:(Ur,Ei)=>sN(Ur,Ei)})},[G,Ls,n]),Ps=Ye.useCallback(pr=>{if(Dc(Ur=>Ur+1),gp.current.clear(),pr?.length)for(const Ur of pr)sTt(Ur);else sTt();Tf(Ur=>Ur+1),ea(G,Pe),pe==="content"&&Pu()},[G,Pe,Pu,ea,pe]);Ye.useEffect(()=>{const pr=Ur=>Ps(Ur.detail?.paths);return window.addEventListener("editor:assets-changed",pr),()=>window.removeEventListener("editor:assets-changed",pr)},[Ps]),Ye.useEffect(()=>{const pr=Ur=>{const Ei=Ur.detail?.path;if(!Ei)return;const Li=ig(Ei),uc=FB(Li);uc&&sN(Ei,uc)};return window.addEventListener("editor:open-project-asset",pr),()=>window.removeEventListener("editor:open-project-asset",pr)},[n]);const Iu=Ye.useMemo(()=>mt.filter(pr=>dl.has(pr.key)),[mt,dl]),zi=Ye.useMemo(()=>Iu.flatMap(pr=>pr.source==="asset"&&pr.entry.type==="file"&&pr.root==="public"?[pr.path]:[]),[Iu]),Jn=Ye.useMemo(()=>Iu.flatMap(pr=>pr.source==="asset"&&pr.entry.type==="file"?[Oge(pr.root,pr.path)]:[]),[Iu]);Ye.useEffect(()=>{const pr=new Set(mt.map(Ur=>Ur.key));bu(Ur=>{const Ei=new Set([...Ur].filter(Li=>pr.has(Li)));return Ur.size>0&&Ei.size===0&&(Wc(null),oD()),Ei.size===Ur.size?Ur:Ei})},[mt]);const Cs=Ye.useCallback(async pr=>{await Dpn(pr,{backend:gR(),history:A}),gp.current.clear(),G==="public"&&await ea(G,Pe),pe==="content"&&await Pu()},[Pe,G,Pu,ea,A,pe]),lc=Ye.useCallback(async()=>{zi.length!==0&&apn("delete",`Delete ${zi.length} selected asset(s)? This is undoable.`)&&(await Cs({type:"delete",paths:zi}),bu(new Set),Wc(null),oD())},[Cs,zi]),Nu=Ye.useCallback(()=>{zi.length!==0&&Sl({title:`Move ${zi.length} selected to folder`,initial:Pe,confirmLabel:"Move",run:async pr=>{const Ur=pr.replace(/^\/+|\/+$/g,"");Ku(null);try{await Cs({type:"move-many",moves:zi.map(Ei=>({source:Ei,destination:Ur?`${Ur}/${Ei.split("/").pop()}`:Ei.split("/").pop()}))})}catch(Ei){Ku(Ei instanceof Error?Ei.message:String(Ei))}}})},[Sl,Pe,Cs,zi]),Fl=Ye.useCallback(()=>{G==="public"&&Sl({title:"New folder name",initial:"",confirmLabel:"Create",run:async pr=>{pr&&await Cs({type:"create-folder",path:Pe?`${Pe}/${pr}`:pr})}})},[Sl,Pe,G,Cs]),Yu=Ye.useCallback(async pr=>{if(!pr||pr.length===0)return;const Ur=pe==="content"||G!=="public"?"":Pe,Ei=await Promise.all([...pr].map(async Li=>({path:Ur?`${Ur}/${Li.name}`:Li.name,bytes:new Uint8Array(await Li.arrayBuffer())})));Ku(null);try{await Cs({type:"import",files:Ei})}catch(Li){Ku(`Could not import ${Ei.length===1?Ei[0]?.path:`${Ei.length} files`}: ${Li instanceof Error?Li.message:String(Li)}`);return}pe==="content"&&Ff("files"),Ls("public",Ur),i0(Ei.length===1?`Imported ${Ei[0]?.path}`:`Imported ${Ei.length} files`)},[Ff,Pe,G,Cs,Ls,pe]),Ie=Ye.useCallback(pr=>{if(!(pr.source!=="asset"||pr.entry.type!=="file")){if(pr.root!=="public"){i0(`${pr.name} is reference material. ${FOe}`);return}Sl({title:`Rename ${pr.name}`,initial:pr.name,confirmLabel:"Rename",run:async Ur=>{if(!Ur||Ur===pr.name)return;const Ei=pr.path,Li=WO(pr.path),uc=Li?`${Li}/${Ur}`:Ur;await Cs({type:"move",source:Ei,destination:uc})}})}},[Sl,Cs]),Et=Ye.useCallback(async pr=>{if(pr.source!=="asset"||pr.entry.type!=="file")return;if(pr.root!=="public"){i0(`${pr.name} is reference material. ${FOe}`);return}const Ur=pr.name.lastIndexOf("."),Ei=Ur>0?`${pr.name.slice(0,Ur)} copy${pr.name.slice(Ur)}`:`${pr.name} copy`,Li=pr.path,uc=WO(pr.path),kc=uc?`${uc}/${Ei}`:Ei;await Cs({type:"duplicate",source:Li,destination:kc})},[Cs]),Nr=Ye.useCallback(pr=>{Bc(Ur=>{const Ei=new Set(Ur);return Ei.has(pr)?Ei.delete(pr):Ei.add(pr),Ei})},[]);Ye.useEffect(()=>{const pr=Ur=>{const Ei=Ur.detail?.id,Li=Iu[0];Ei===O_.refresh.id?Ps():Ei===O_.import.id?Du.current?.click():Ei===O_.createFolder.id?Fl():Ei===O_.move.id?Nu():Ei===O_.delete.id?lc():Ei===O_.rename.id&&Li?Ie(Li):Ei===O_.duplicate.id&&Li?Et(Li):Ei===O_.copyPath.id&&Jn[0]?navigator.clipboard.writeText(Jn[0]):Ei===O_.reveal.id&&Jn[0]&&CMe(Jn[0])};return window.addEventListener("editor:project-asset-command",pr),()=>window.removeEventListener("editor:project-asset-command",pr)},[Fl,Pe,lc,Et,Nu,Ps,Ie,Iu,Jn]);const In=Ao?.item.source==="available"&&Ao.item.available.descriptor.preview?Ao.item:null;return q.jsxs("div",{ref:tr,className:"volter-asset-browser","data-tree-visible":pe==="files"&&Tt,onPointerDown:()=>CR("asset-browser"),onKeyDown:pr=>{if(!mje(pr.target)){if(pr.key==="Delete"||pr.key==="Backspace")lc(),pr.preventDefault();else if((pr.metaKey||pr.ctrlKey)&&pr.key.toLowerCase()==="d"){const Ur=Iu[0];Ur&&Et(Ur),pr.preventDefault()}else if(pr.key==="F2"){const Ur=Iu[0];Ur&&Ie(Ur),pr.preventDefault()}}},onDragOver:pr=>{G!=="public"||!pr.dataTransfer.types.includes("Files")||(pr.preventDefault(),pr.dataTransfer.dropEffect="copy",Rl||mi(!0))},onDragLeave:pr=>{pr.currentTarget.contains(pr.relatedTarget)||mi(!1)},onDrop:pr=>{G!=="public"||!pr.dataTransfer.types.includes("Files")||(pr.preventDefault(),mi(!1),Yu(pr.dataTransfer.files))},style:{display:"flex",flex:1,minHeight:0,position:"relative",...Rl?{outline:`2px dashed ${Go.accent.default}`,outlineOffset:-2}:{}},children:[q.jsx(v_n,{currentRoot:G,currentPath:Pe,expanded:Nt,hidden:pe!=="files"||!Tt,revision:Ni,loadAssets:t.listAssets,onExpanded:Nr,onNavigate:Ls}),q.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,minHeight:0},children:[q.jsx(Zm,{ref:Du,type:"file",multiple:!0,"aria-label":"Import project assets",hidden:!0,onChange:pr=>{Yu(pr.target.files),pr.currentTarget.value=""}}),q.jsx(y_n,{availableFacets:Vn,scope:pe,facets:Ce,currentPath:Pe,currentRoot:G,searchOpen:Yr,searchQuery:Np,viewMode:X,density:zt,treeVisible:Tt,onScopeChange:Ff,onFacetToggle:Hs,onFacetsClear:()=>De([]),onNavigate:Ls,onSearchOpenChange:Ds,onSearchQueryChange:Au,onViewModeChange:we,onDensityChange:ft,onTreeVisibilityToggle:vn,onCreateFolder:()=>void Fl(),onImport:()=>Du.current?.click(),onDelete:()=>void lc(),deleteDisabled:zi.length===0,onRefresh:Ps,generationTools:J,onGenerate:()=>{CD("generation",n,{kind:"generation",id:"create"})}}),Al&&q.jsx("div",{role:"alert",className:"volter-asset-operation-error",children:Al}),pl&&q.jsxs("form",{className:"volter-asset-inline-prompt",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},onSubmit:pr=>{pr.preventDefault();const Ur=pl;gs(null),Ur.run(Xu.trim())},children:[q.jsx("span",{style:{fontSize:12},children:pl.title}),q.jsx(Zm,{autoFocus:!0,"aria-label":pl.title,value:Xu,onChange:pr=>$r(pr.target.value),onKeyDown:pr=>{pr.key==="Escape"&&gs(null)}}),q.jsx(Ms,{type:"submit",size:"compact",children:pl.confirmLabel}),q.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>gs(null),children:"Cancel"})]}),zi.length>0&&q.jsxs(n$,{label:"Selected asset actions",compact:!0,children:[q.jsxs("span",{children:[zi.length," selected"]}),q.jsx(Ms,{variant:"ghost",size:"compact",onClick:()=>void Nu(),children:"Move selected"}),q.jsx(Ms,{variant:"ghost",size:"compact","aria-label":"Delete selected assets",onClick:()=>void lc(),children:"Delete"})]}),q.jsxs("div",{className:"volter-project-assets-results","data-view":X,"data-testid":"project-asset-results",role:"listbox","aria-label":pe==="content"?"Project content":"Project files","aria-multiselectable":"true",style:{flex:1,overflowY:"auto",padding:8,display:X==="list"?"flex":"grid",gridTemplateColumns:X==="grid"?`repeat(auto-fill, minmax(${Math.round(zt*.75)}px, 1fr))`:void 0,gridAutoRows:X==="list"?void 0:"min-content",flexDirection:X==="list"?"column":void 0,gap:X==="list"?1:6,alignContent:"start"},children:[eo.map(pr=>q.jsxs("div",{role:"group","aria-label":pr.label??void 0,className:"volter-content-result-section",children:[pr.label&&q.jsx("div",{role:"presentation",className:"volter-content-section-heading","data-level":pr.headingLevel??void 0,"data-testid":`content-section-${pr.id}`,children:q.jsx("span",{children:pr.label})}),pr.entries.map(Ur=>q.jsx(g_n,{item:Ur,selected:dl.has(Ur.key),onDragStart:bi,onSelect:ta,onOpen:ic,onContextMenu:(Ei,Li)=>{Ei.preventDefault(),Li.source!=="component"&&(dl.has(Li.key)||ta(Li,Ei),ia({x:Ei.clientX,y:Ei.clientY,item:Li}))},viewMode:X,previewRevision:vc,showPath:pe==="content"},Ur.key))]},pr.id)),xr.length===0&&q.jsx(UTr,{compact:!0,style:{gridColumn:"1 / -1"},icon:q.jsx(dc,{icon:xt?Kk.status.warning:Np?Kk.action.search:Kk.content.folder}),title:_a?"Finding project content…":xt?"Listing failed":Np?"No matching content":pe==="content"?"No content in this type":"Empty folder",description:_a?"Scanning components and assets across the project.":xt?`Listing failed: ${xt}`:Np?"Try a broader search or another content type.":pe==="content"?"Choose another type or import an asset.":"Add files to this folder to see them here."})]})]}),In&&Ao&&q.jsx(she,{children:q.jsxs(fN,{autoFocusFirst:!0,className:"volter-asset-context-menu",style:{left:Ao.x,top:Ao.y},onDismiss:()=>ia(null),children:[q.jsxs(Jc,{type:"button",role:"menuitem",onClick:()=>{ic(In),ia(null)},children:["Open ",q.jsx("kbd",{children:"Enter"})]}),In.available.category==="scene"&&q.jsxs(q.Fragment,{children:[q.jsx(Jc,{type:"button",role:"menuitem",onClick:()=>{const pr=In.available.descriptor.id;ia(null),uTt(pr,!1).then(()=>Tf(Ur=>Ur+1)).catch(Ur=>Ku(Ur instanceof Error?Ur.message:String(Ur)))},children:"Use current view for preview"}),q.jsx(Jc,{type:"button",role:"menuitem",onClick:()=>{const pr=In.available.descriptor.id;ia(null),uTt(pr,!0).then(()=>Tf(Ur=>Ur+1)).catch(Ur=>Ku(Ur instanceof Error?Ur.message:String(Ur)))},children:"Reset preview view"})]}),q.jsx(Jc,{type:"button",role:"menuitem",onClick:()=>{ia(null),Tf(pr=>pr+1)},children:"Refresh preview"})]})}),Ao&&Ao.item.source==="asset"&&q.jsx(she,{children:q.jsxs(fN,{autoFocusFirst:!0,className:"volter-asset-context-menu",style:{left:Ao.x,top:Ao.y},onDismiss:()=>ia(null),children:[q.jsxs(Jc,{type:"button",role:"menuitem","data-command-id":O_.open.id,onClick:()=>{ic(Ao.item),ia(null)},children:["Open ",q.jsx("kbd",{children:"Enter"})]}),q.jsxs(Jc,{type:"button",role:"menuitem","data-command-id":O_.rename.id,onClick:()=>{Ie(Ao.item),ia(null)},children:["Rename ",q.jsx("kbd",{children:"F2"})]}),q.jsxs(Jc,{type:"button",role:"menuitem","data-command-id":O_.duplicate.id,onClick:()=>{Et(Ao.item),ia(null)},children:["Duplicate ",q.jsx("kbd",{children:"⌘D"})]}),q.jsx(Jc,{type:"button",role:"menuitem","data-command-id":O_.move.id,disabled:zi.length===0,title:zi.length?"Move selected assets":"Select a file to move",onClick:()=>{Nu(),ia(null)},children:"Move selected…"}),q.jsx(Jc,{type:"button",role:"menuitem","data-command-id":O_.copyPath.id,disabled:!Jn[0],onClick:()=>{Jn[0]&&navigator.clipboard.writeText(Jn[0]),ia(null)},children:"Copy path"}),jme("asset").map(pr=>{const Ur=Ao.item.source==="asset"&&Ao.item.entry.type==="file",Ei=Ao.item.source==="asset"?{assetPath:Oge(Ao.item.root,Ao.item.path)}:{};return q.jsx(Jc,{type:"button",role:"menuitem","data-testid":pr.testId,disabled:!Ur||(pr.disabled?.(Ei)??!1),onClick:()=>{pr.execute(Ei),ia(null)},children:typeof pr.label=="function"?pr.label():pr.label},pr.id)}),q.jsx(Jc,{type:"button",role:"menuitem","data-command-id":O_.reveal.id,disabled:!Jn[0],onClick:()=>{Jn[0]&&CMe(Jn[0]),ia(null)},children:"Reveal in Finder"}),q.jsxs(Jc,{type:"button",role:"menuitem","data-command-id":O_.delete.id,disabled:zi.length===0,onClick:()=>{lc(),ia(null)},children:["Delete ",q.jsx("kbd",{children:"⌫"})]})]})})]})}const x_n={agent:()=>q.jsx(Ame,{slot:"panel:agent"}),"project-work":()=>q.jsx(Ame,{slot:"panel:project-work"}),hierarchy:kjt,assets:({dependencies:t})=>q.jsx(S_n,{services:t?.assets}),"asset-library":()=>q.jsx(Ame,{slot:"panel:asset-library"}),inspector:ZVe};class w_n extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){Qs.error(`The ${this.props.title} panel crashed and was taken down alone (the rest of the editor stays up; Retry in the panel remounts it): ${n.message}
1409
- ${s.componentStack??""}`,"editor")}render(){return this.state.error?q.jsxs("div",{role:"alert","data-testid":"static-panel-crashed",style:{padding:12,display:"grid",gap:8,alignContent:"start"},children:[q.jsxs("strong",{children:[this.props.title," crashed."]}),q.jsx("span",{style:{opacity:.8,wordBreak:"break-word"},children:this.state.error.message}),q.jsx("div",{children:q.jsx(Ms,{type:"button",variant:"outline",size:"compact",onClick:()=>this.setState({error:null}),children:"Retry"})})]}):this.props.children}}const T_n=kVe.map(t=>{const n=x_n[t.kind],s=c=>q.jsx(w_n,{title:t.title,children:q.jsx(n,{...c})});return s.displayName=`StaticPanel(${t.kind})`,{...t,Content:s}});function C_n(t){return T_n.find(n=>n.kind===t)}function E_n({kind:t,dependencies:n}){const{Content:s}=C_n(t);return q.jsx(s,{dependencies:n})}const k_n=250;function A_n(){const t=R4t(),n=D_n();return()=>{n(),t()}}function D_n(){const t=new Map;let n=null,s=!1;function c(){const g=[],S=new Set;for(const k of Qs.getEntries()){if(S.add(k.id),k.level!=="error"&&k.level!=="warn")continue;const A=t.get(k.id)??0;k.count<=A||(t.set(k.id,k.count),g.push({severity:k.level,message:k.message,source:k.source??null,occurrences:k.count-A}))}for(const k of[...t.keys()])S.has(k)||t.delete(k);return g}function d(){if(n=null,s)return;const g=c();g.length!==0&&bN("console-entries",{entries:g,_clientId:xC})}const m=Qs.subscribe(()=>{if(s)return;const g=Qs.getEntries(),S=g[g.length-1];if(S&&S.level==="error"&&!t.has(S.id)){n!==null&&clearTimeout(n),n=null,queueMicrotask(d);return}n===null&&(n=setTimeout(d,k_n))});return bN("console-entries",{entries:[],_clientId:xC}),d(),()=>{s=!0,n!==null&&clearTimeout(n),m()}}const Y4={INPUT:"input",PRE_PHYSICS:"prePhysics",PHYSICS:"physics",POST_PHYSICS:"postPhysics",GAME_LOGIC:"gameLogic",ANIMATION:"animation",PRE_RENDER:"preRender",RENDER:"render"},yZ=[Y4.INPUT,Y4.PRE_PHYSICS,Y4.PHYSICS,Y4.POST_PHYSICS,Y4.GAME_LOGIC,Y4.ANIMATION,Y4.PRE_RENDER,Y4.RENDER],fwn=Object.freeze(Object.defineProperty({__proto__:null,PHASE_ORDER:yZ,SystemPhase:Y4},Symbol.toStringTag,{value:"Module"})),sye=1e-9,Ljt=1e5;function P_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>sye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=s.end-g;if(!d||S<=F+sye){const D=Math.min(g+S,s.end);m.push({from:g,to:D,direction:"forward"}),g=D;break}if(m.push({from:g,to:s.end,direction:"forward"}),S-=F,g=s.start,k=!0,A++,A>Ljt){const D=s.start+S%c;m.push({from:g,to:D,direction:"forward"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function I_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>sye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=g-s.start;if(!d||S<=F+sye){const D=Math.max(g-S,s.start);m.push({from:g,to:D,direction:"reverse"}),g=D;break}if(m.push({from:g,to:s.start,direction:"reverse"}),S-=F,g=s.end,k=!0,A++,A>Ljt){const D=s.end-S%c;m.push({from:g,to:D,direction:"reverse"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function pTt(t,n){return t<n.start?n.start:t>n.end?n.end:t}class N_n{_previousTime;_currentTime;_range;_timeScale;_playDirection="forward";_lastCrossingDirection="forward";_playbackState="stopped";_evaluators=[];_registrationCounter=0;constructor(n={}){const s=n.start??0,c=n.end??Math.max(s,1);if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);const d=n.timeScale??1;if(!Number.isFinite(d)||d<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${d}`);this._range={start:s,end:c,loop:n.loop??!1},this._timeScale=d,this._previousTime=s,this._currentTime=s}get time(){return this._currentTime}get previousTime(){return this._previousTime}get direction(){return this._playbackState==="playing"?this._playDirection:"paused"}get playbackState(){return this._playbackState}get timeScale(){return this._timeScale}set timeScale(n){if(!Number.isFinite(n)||n<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${n}`);this._timeScale=n}get range(){return this._range}setRange(n){const s=n.start??this._range.start,c=n.end??this._range.end,d=n.loop??this._range.loop;if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);this._range={start:s,end:c,loop:d};const m=pTt(this._currentTime,this._range);m!==this._currentTime&&this.seek(m)}play(n){n&&(this._playDirection=n),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="stopped"}seek(n){const s=pTt(n,this._range);if(s===this._currentTime)return this.emit(this._currentTime,this._currentTime,[{from:s,to:s,direction:this._lastCrossingDirection}],!1,this._lastCrossingDirection);const c=s>this._currentTime?"forward":"reverse",d=this._currentTime;return this._previousTime=d,this._currentTime=s,this._lastCrossingDirection=c,this.emit(d,s,[{from:d,to:s,direction:c}],!1,c)}seekFrame(n,s){if(!Number.isFinite(s)||s<=0)throw new Error(`[AnimationClock] seekFrame fps must be a finite number > 0, got ${s}`);return this.seek(this._range.start+n/s)}advance(n){if(this._playbackState!=="playing")return null;if(!Number.isFinite(n))throw new Error(`[AnimationClock] advance(dt) requires a finite dt, got ${n}`);const s=Math.abs(n)*this._timeScale,c=this._currentTime;if(s===0)return this.emit(c,c,[],!1,this._playDirection);const d=this._playDirection==="forward"?P_n(c,s,this._range):I_n(c,s,this._range);return this._previousTime=c,this._currentTime=d.pos,this._lastCrossingDirection=this._playDirection,this.emit(c,d.pos,d.intervals,d.looped,this._playDirection)}subscribe(n,s){if(!yZ.includes(n))throw new Error(`[AnimationClock] unknown phase "${n}". Valid: ${yZ.join(", ")}`);const c={phase:n,order:this._registrationCounter++,fn:s};return this._evaluators.push(c),{dispose:()=>{const d=this._evaluators.indexOf(c);d!==-1&&this._evaluators.splice(d,1)}}}emit(n,s,c,d,m){const g={previousTime:n,currentTime:s,direction:m,timeScale:this._timeScale,looped:d,intervals:c};if(this._evaluators.length>0){const S=[...this._evaluators].sort((k,A)=>{const F=yZ.indexOf(k.phase),D=yZ.indexOf(A.phase);return F!==D?F-D:k.order-A.order});for(const k of S)try{k.fn(g)}catch(A){console.error(`[AnimationClock] evaluator in phase "${k.phase}" threw:`,A)}}return g}}const v_e={start:0,end:0,fps:30},O_n=150;class dwn{constructor(n){this.store=n,this.stopStoreWatch=n.subscribe(()=>this.notify())}clock=new N_n;subjects=[];activeId=null;listeners=new Set;settleListeners=new Set;settleTimer=null;disposed=!1;cachedSnapshot=null;stopStoreWatch;attach(n){return this.subjects.push(n),this.activeId===null?this.setActiveSubject(n.id):(n.seek(this.clock.time),this.notify()),()=>{const s=this.subjects.indexOf(n);if(s<0)return;if(this.subjects.splice(s,1),this.activeId!==n.id){this.notify();return}this.activeId=null;const c=this.subjects[0];c?this.setActiveSubject(c.id):(this.clock.setRange({start:v_e.start,end:v_e.end,loop:!1}),this.notify())}}setActiveSubject(n){const s=this.subjects.find(d=>d.id===n);if(!s)return;this.activeId=n;const c=s.range();this.clock.setRange({start:c.start,end:c.end}),this.applyTime(this.clock.time),this.notify()}get active(){return this.subjects.find(n=>n.id===this.activeId)??null}fps(){return this.active?.range().fps??v_e.fps}get driver(){return this.store.playState==="stopped"?"editor":"world"}assertEditorDrives(){if(this.driver==="world")throw new Error("transport: the world is driving time (Play); pause the game to scrub")}play(n="forward"){this.assertEditorDrives(),this.active&&(this.cancelSettle(),this.clock.play(n),this.notify())}pause(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.settle(),this.notify()}stop(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.applyTime(this.clock.seek(this.clock.range.start).currentTime),this.clock.stop(),this.settle(),this.notify()}seek(n){this.assertEditorDrives(),this.applyTime(this.clock.seek(n).currentTime),this.clock.playbackState!=="playing"&&this.scheduleSettle(),this.notify()}seekFrame(n){this.seek(n/this.fps())}setLoop(n){this.clock.setRange({loop:n}),this.notify()}setTimeScale(n){this.clock.timeScale=n,this.notify()}tick(n){if(this.disposed||this.driver==="world"||this.clock.playbackState!=="playing")return 0;const s=this.clock.time,c=this.clock.advance(n);return c?(this.applyTime(c.currentTime),this.notify(),c.looped?Math.abs(n)*this.clock.timeScale:c.currentTime-s):0}applyTime(n){const s=this.active;s&&s.seek(n);for(const c of this.subjects)c!==s&&c.seek(n)}onSettled(n){return this.settleListeners.add(n),()=>{this.settleListeners.delete(n)}}scheduleSettle(){this.cancelSettle(),this.settleTimer=setTimeout(()=>{this.settleTimer=null,this.settle()},O_n)}cancelSettle(){this.settleTimer!==null&&(clearTimeout(this.settleTimer),this.settleTimer=null)}settle(){if(this.disposed)return;const n=this.clock.time;for(const s of[...this.settleListeners])s(n)}snapshot(){const n=this.cachedSnapshot;if(n)return n;const s=this.active?.range()??v_e,c={time:this.clock.time,range:{start:this.clock.range.start,end:this.clock.range.end,fps:s.fps,loop:this.clock.range.loop},playbackState:this.clock.playbackState,timeScale:this.clock.timeScale,activeSubject:this.activeId,subjects:this.subjects.map(d=>({id:d.id,label:d.label})),driver:this.driver};return this.cachedSnapshot=c,c}activeClips(){const s=this.active?.clips?.();return s&&s.length>1?s:null}setActiveClip(n){this.assertEditorDrives(),this.active?.setClip?.(n);const s=this.active?.range();s&&this.clock.setRange({start:s.start,end:s.end}),this.applyTime(this.clock.time),this.notify()}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}notify(){this.cachedSnapshot=null;for(const n of[...this.listeners])n()}dispose(){this.disposed=!0,this.stopStoreWatch(),this.cancelSettle(),this.clock.stop(),this.subjects.length=0,this.activeId=null,this.listeners.clear(),this.settleListeners.clear()}}const Dme=new Map,Wje=new Set;function _Tt(){for(const t of[...Wje])t()}function pwn(t,n){return Dme.set(t,n),_Tt(),()=>{Dme.get(t)===n&&(Dme.delete(t),_Tt())}}function R_n(t){return t===null?null:Dme.get(t)??null}function F_n(t){return Wje.add(t),()=>{Wje.delete(t)}}let Pme=null;function _wn(t){return Pme=t,()=>{Pme===t&&(Pme=null)}}function kve(){return Pme}const Bjt="__volterWorkspacePersistenceSuppressed";function $jt(){return globalThis}function qjt(t){$jt()[Bjt]=t}function M_n(){return $jt()[Bjt]===!0}function zjt(){return(See()?.immersivePlay??!1)&&!NR().play?.keepPanelsVisible}const Vjt={phase:"idle",flightDone:!1,gameReady:!1};function j_n(t,n){const s=t.flightDone||n==="flight-done",c=t.gameReady||n==="game-ready";return s&&c?{phase:"crossfade",flightDone:s,gameReady:c}:s?{phase:"holding",flightDone:s,gameReady:c}:{...t,flightDone:s,gameReady:c}}function L_n(t,n){if(n==="stop")return Vjt;switch(t.phase){case"idle":return n==="start"?{phase:"entering",flightDone:!1,gameReady:!1}:n==="start-reduced"?{phase:"playing",flightDone:!0,gameReady:!0}:t;case"entering":return j_n(t,n);case"holding":return n==="game-ready"?{...t,phase:"crossfade",gameReady:!0}:t;case"crossfade":return n==="crossfade-done"?{...t,phase:"playing"}:t;case"playing":return t}}const B_n=450,$_n=220,Ujt=250;function q_n(t){t.style.setProperty("--volter-play-dissolve-duration",`${B_n}ms`),t.style.setProperty("--volter-play-materialize-duration",`${$_n}ms`),t.style.setProperty("--volter-play-crossfade-duration",`${Ujt}ms`)}let SD=null;function z_n(t){return SD=t,typeof document<"u"&&q_n(document.documentElement),()=>{SD===t&&(SD=null)}}function Jjt(){return typeof window<"u"&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1)}let Qk=null;function V_n(){return Qk?.state.phase??"idle"}const Ime=new Set;function Wjt(){if(Ime.size===0)return;const t=[...Ime];Ime.clear();for(const n of t)n()}function U_n(t){if(!Qk||Qk.state.phase==="playing"){t();return}Ime.add(t)}function J_n(t,n,s){const c=setTimeout(()=>{t.timeouts.delete(c),s()},n);t.timeouts.add(c)}function gB(t){const n=Qk;if(!n)return;const s=n.state,c=L_n(s,t);c!==s&&(n.state=c,c.phase==="crossfade"&&s.phase!=="crossfade"&&(SD?.root.classList.add("volter-play-crossfade"),J_n(n,Ujt+30,()=>gB("crossfade-done"))),c.phase==="playing"&&s.phase!=="playing"&&(SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),n.flying&&kve()?.settle(),Wjt()))}function W_n(){H_n({immersive:zjt()})}function H_n(t){if(Qk&&lUe(),!t.immersive)return;const n=Jjt();qjt(!0);const s={state:Vjt,reducedMotion:n,flying:!1,timeouts:new Set};if(Qk=s,SD?.hideChrome(!n),n){gB("start-reduced");return}if(gB("start"),s.flying=kve()?.begin(()=>{Qk===s&&gB("flight-done")})??!1,!s.flying){gB("flight-done");return}SD?.root.classList.add("volter-play-flight")}function G_n(t,n){(!t||!n)&&lUe()}function K_n(t){const n=Qk;n&&(n.flying&&t&&kve()?.track(t),gB("game-ready"))}function lUe(){const t=Qk;if(t){Qk=null;for(const n of t.timeouts)clearTimeout(n);t.timeouts.clear(),Wjt(),SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),t.flying&&kve()?.end(),SD?.showChrome(!Jjt()),qjt(!1)}}const Hje=new Set;let Hjt=null;function Gjt(){return wf()?.rootPath??null}function X_n(t){Hje.add(t);const n=Gjt();return n!==null&&Hjt===n&&t(),()=>{Hje.delete(t)}}async function mwn(){Hjt=Gjt();for(const t of[...Hje])await t()}function Y_n(){const t=Pp();if(t===null)return null;const n=cQ(t);if(typeof n!="object"||n===null)return null;const s=n.stageMode;if(typeof s!="function")return null;const c=s.call(n);return typeof c=="string"?c:null}let Gje=null;function Z_n(t){Gje=t}function mTt(){if(!Gje)throw new Error("The workbench Output service is not connected.");return Gje}function Q_n(){aDr(Pp),a4r({output:{write:(...t)=>mTt().write(...t),show:t=>mTt().show(t)},console:{log:(t,n)=>Qs.log(t,n),warn:(t,n)=>Qs.warn(t,n),error:(t,n)=>Qs.error(t,n)},live:{register:i9t,mounted:vVe,playing:ave,runWindow:dVe,restartRequired:t9t,restart:r9t,subscribe:SVe,version:s9t,notifyChanged:e9t,snapshotFrame:_Ve,frameCanvas:pVe,authoringRefusal:yVe,dispatch:mVe,scenes:hVe,surface:sve,coverage:gVe},viewport:{transition:{begin:W_n,ready:K_n,end:lUe,onSettled:U_n,phase:V_n}},hierarchy:{subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0}},session:{beginWork:ABe,reportFacet:Grn,onSample:Fnn,onCommandDispatched:UYr,playState:()=>Ih()?.playState??"stopped",playEditRegime:()=>Ih()?.playEditRegime??null,subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0},open:()=>Ih()!==null,onEnded:t=>Lze(n=>{n!==null&&t()}),onBeforeClose:pnn,reportWorkerCallMeter:nan},project:{documentTable:zen,mounts:l$,engineVersion:()=>wf()?.config.engine.version??null,subscribe:IC,onReady:X_n},notify:t=>s$(t),systems:{inspected:Pye,subscribe:Wwr,inspectedNetworking:Xwr,subscribeNetworking:Ywr,inspectedAudio:()=>Zwr()??null,subscribeAudio:Qwr,audioVersion:eTr},availability:{subscribe:YVe,version:Lun},workspace:{showUtility:vC,openContributedDocument:t=>tA(t),open:async t=>await Yye(t.kind,Ih()??{},t)!==null,liveDocument:{id:a0,register:mtn,acquire:vtn,release:nVe,open:iq,container:htn,setContainer:gtn,releaseContainer:ytn}},documents:{activeId:Pp,active:()=>{const t=TC();return t?{id:t.descriptor.id,kind:t.descriptor.kind,title:t.title}:null},subscribe:o2,version:K1,context:cQ,waitForContext:y4t,contextChanged:YCr,captureActive:t=>{const n=Ih();return n?b9t(n,t):Promise.reject(new Error("No editor session is open to capture a document from."))}},transport:{for:t=>R_n(t),subscribe:F_n},projectLocalState:{ready:lte,read:Cve,write:Eve,projectRootPath:()=>wf()?.rootPath??null},history:{record:i6t,setDelegate:oDr,onElement:lDr,invalidate:uDr,onInvalidated:fDr,changed:sDr,elements:cDr,focusedResource:()=>{const t=TC();if(!t)return null;const n=t.descriptor.provenance?.sourcePath;if(n)return n;const s=Ih();return s?$Yr(s)??Rze(s):null},undo:()=>Ih()?.projectHistory?.undo()??Promise.resolve(!1),redo:()=>Ih()?.projectHistory?.redo()??Promise.resolve(!1),canUndo:()=>Ih()?.projectHistory?.getSnapshot().canUndo??!1,canRedo:()=>Ih()?.projectHistory?.getSnapshot().canRedo??!1,undoLabel:()=>Ih()?.projectHistory?.getSnapshot().undoLabel??null,redoLabel:()=>Ih()?.projectHistory?.getSnapshot().redoLabel??null,subscribe:t=>{const n=n6t(t),s=o_e(t),c=Ih()?.projectHistory?.subscribe(t),d=o2(t);return()=>{n(),s(),c?.(),d()}}},files:{setProvider:O4r,read:t=>Ag.read(t),readBytes:t=>Ag.readBytes(t),write:(t,n)=>Ag.write(t,n),exists:t=>Ag.exists(t),list:t=>Ag.list(t),watch:t=>Ag.watch(t)},settings:{setProvider:NEr,get:LEr,set:$Er,inspect:K4t,subscribe:t=>{const n=J4t(t),s=bee(t);return()=>{n(),s()}}},keyboard:{actions:()=>Wan().map(({id:t,scope:n})=>({id:t,scope:n})),keymaps:()=>Y4t().map(({id:t,title:n})=>({id:t,title:n,chords:nDt(t)})),activeKeymap:dR,invoke:t=>LVe(t),subscribe:t=>{const n=Gan(t),s=Kye(t),c=o_e(t),d=Ih()?.subscribe(t),m=o2(t);return()=>{n(),s(),c(),d?.(),m()}},version:()=>Han()+K1(),stage:()=>{const t=Ih();return t?{surface:Wfn(t).surface,mode:Y_n()}:{surface:null,mode:null}},bindActions:tcn,chordsFor:LBe,shortcutFor:t=>Vv(t)??null}})}let emn=0,cee=null;const Kje=new Set;function hTt(t){const n={generation:++emn,promise:t,active:!0};cee=n;for(const s of Kje)s(n);return Kje.clear(),n}function tmn(){const t=cee;return t?.active?Promise.resolve(t):new Promise(n=>Kje.add(n))}async function uUe(){for(;;){const t=await tmn();if(await t.promise,cee===t&&t.active)return}}const Kjt=16,rmn=300,nmn=1e4,Xjt="workspace";function imn(){const t=Cve(Xjt);return!t||t.version!==Kjt?null:t}function omn(t){Eve(Xjt,t)}function smn(t){const{descriptor:n}=t;if(!n.persist)return null;let s;try{s=n.persist({id:n.id,title:t.title})}catch{return null}if(s==null)return null;const c=AAr(n.id);return{kind:n.kind,id:n.id,state:s,...Object.keys(c).length>0?{presentation:c}:{}}}function amn(){const t={};let n=!1;for(const s of _Dt()){if(!s.persistKindState)continue;let c;try{c=s.persistKindState()}catch{continue}c!=null&&(t[s.kind]=c,n=!0)}return n?t:void 0}function cmn(){const t=[];for(const s of l0()){const c=smn(s);c&&t.push(c)}const n=amn();return{version:Kjt,workspace:zS(),documents:{open:t,activeId:Pp(),...n?{kinds:n}:{}}}}async function lmn(t,n,s){for(const c of pDt(n.kind))try{if(await c.restore({id:n.id,state:n.state,active:n.id===s&&!HQ(),store:t}))return!0}catch{}return!1}function gTt(t){if(!t)return!1;const n=!HQ();return SN(t,n)?!0:ftn.has(t)?(AFt(t),n&&STr(t),!0):n&&X0(t)}function umn(t,n){const s=n?.kinds??{},c=(n?.open.length??0)>0;for(const d of _Dt())if(d.beginRestore)try{d.beginRestore({state:s[d.kind],hasDocumentsToRestore:c,documentsToRestore:(n?.open??[]).map(m=>({kind:m.kind,state:m.state})),store:t})}catch{}}function fmn(t){const n=new Set;for(const s of t)for(const c of pDt(s.kind))c.prepare&&n.add(c.prepare);return Promise.all([...n].map(s=>s().catch(()=>{})))}async function dmn(t,n){const s=n?.documents;if(umn(t,s),!s||s.open.length===0){gTt(s?.activeId??null);return}await fmn(s.open);for(const c of s.open){const d=c.presentation;d&&typeof d=="object"&&!Array.isArray(d)&&DAr(c.id,d),await lmn(t,c,s.activeId)}gTt(s.activeId)}function Yjt(t){if(!lte()||wf()&&!u0()){let se=!1,pe=null,ue=()=>{};const Ce=new Promise(Pe=>{ue=Pe}),De=hTt(Ce);return Promise.all([cte(),Qze()]).then(()=>{if(se){ue();return}pe=Yjt(t),De.active=!1,uUe().finally(ue)}),()=>{se=!0,pe?.()}}const n=imn();n?.workspace&&kB(n.workspace)&&Uk(n.workspace)?a2(n.workspace):(n?.workspace&&Ikr(n.workspace),a2(pR(),{provisional:!0}));let s=!1,c=null;const d=[],m=()=>{c!==null&&(clearTimeout(c),c=null),!(M_n()||t.playState!==void 0&&t.playState!=="stopped")&&omn(cmn())},g=()=>{c!==null&&clearTimeout(c),c=setTimeout(m,rmn)},S=()=>m();let k=null;const A=typeof window<"u"&&aCt(window.location.href)!==null,F=A||!(n?.documents?.open.length??0)?Promise.resolve():mN().catch(()=>{}),D=F.then(()=>A?void 0:dmn(t,n)).catch(()=>{}),J=new Promise(se=>{F.then(()=>{s||(k=setTimeout(()=>{se()},nmn))})}),$=Promise.race([D,J]).then(()=>{k!==null&&clearTimeout(k),!s&&(d.push(o2(g)),d.push(OAr(g)),window.addEventListener("pagehide",S))}),G=hTt($);return()=>{s=!0,G.active=!1,cee===G&&(cee=null),k!==null&&clearTimeout(k);for(const se of d)se();window.removeEventListener("pagehide",S),c!==null&&m()}}function pmn(t){Ye.useEffect(()=>{const n=aCt(window.location.href);if(!n)return;let s=!1;const c=Em(),d=()=>!s&&Em()===c;return uUe().then(()=>{if(d())return Vge(t,n,{updateUrl:!1,origin:"link"})}).catch(m=>{Qs.error(`Could not restore shared editor view: ${m instanceof Error?m.message:String(m)}`,"editor")}),()=>{s=!0}},[t])}const yTt="volter:stale-chunk-reload";function _mn(){typeof window>"u"||window.addEventListener("vite:preloadError",t=>{let n=0;try{n=Number(sessionStorage.getItem(yTt)??0)}catch{}if(!(Date.now()-n<6e4)){try{sessionStorage.setItem(yTt,String(Date.now()))}catch{}t.preventDefault(),window.location.reload()}})}const jI=[];function mmn(t){const n=jI.findIndex(s=>s.owner===t.owner&&s.id===t.id);return n>=0&&jI.splice(n,1),jI.push(t),jI.sort((s,c)=>(s.order??0)-(c.order??0)),()=>{const s=jI.indexOf(t);s>=0&&jI.splice(s,1)}}function hwn(t,n,s){const c=new Map,d={surface:t,store:n},m=g=>{const S=s(g);if(!S)return null;for(const k of jI){const A=k.statesFor(S,d);if(A.length>0)return{source:k,states:A}}return null};return{storiesFor:g=>[...m(g)?.states??[]],active:g=>c.get(g)??null,apply:(g,S)=>{if(S===null){c.delete(g),n.notifyIngestEdit();return}const k=m(g);if(!k?.states.some(F=>F.id===S)){Qs.warn(`[component-states] stories.apply: state "${S}" does not belong to node "${g}" on the ${t} surface — ignoring.`,"authoring");return}const A=s(g);A&&(c.set(g,S),k.source.apply(A,S,d),n.notifyIngestEdit())},unavailable:()=>jI.length>0?null:"No package in this editor registered a source of component states, so this component's named states could not be read."}}class gwn extends Error{name="StoryMediumMismatch"}function ywn(t){return t instanceof Error&&t.name==="StoryMediumMismatch"}const Nme=new Map;function vwn(t,n){return Nme.set(t,n),()=>{Nme.get(t)===n&&Nme.delete(t)}}function hmn(t){return Nme.get(t)??null}function gmn(t,n){const s=[];for(const c of Object.keys(n).sort())s.push(`${c}=${ymn(n[c])}`);return`${t}|${s.join("&")}`}function ymn(t){if(typeof t=="function")return"fn";if(typeof t=="symbol")return"symbol";if(t===void 0)return"undefined";try{return JSON.stringify(t)??"undefined"}catch{return`[${typeof t}]`}}const aye=new Map,b_e=new Map,vTt=new WeakMap;let bTt=Promise.resolve(),STt=null,vmn=1;function bmn(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}async function Smn(){await Promise.race([jye(),new Promise(t=>setTimeout(t,5e3))]),await Promise.race([new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t()))),new Promise(t=>setTimeout(t,250))]),await new Promise(t=>setTimeout(t,750)),await new Promise(t=>{const n=globalThis.requestIdleCallback;if(typeof n=="function"){n(()=>t(),{timeout:2e3});return}setTimeout(t,0)})}function xmn(){return STt??=Smn(),STt}function wmn(t){const n=vTt.get(t);if(n!==void 0)return n;const s=vmn++;return vTt.set(t,s),s}function Tmn(t,n,s,c){const d=aye.get(t);if(d)return Promise.resolve(d);const m=b_e.get(t);if(m)return m;const g=bTt.then(async()=>{await xmn();const S=s.parameters.layout,k=S==="fullscreen"||S==="padded"||S==="centered"?S:"padded",A={...c,props:s.args,layout:k},F=hmn(n==="canvas"?"canvas":"three");if(!F)throw new Error(`No ${n} story capture is registered.`);return F(s.Component,A)});return bTt=g.then(()=>{},()=>{}),b_e.set(t,g),g.then(S=>{aye.set(t,S),b_e.delete(t)},()=>b_e.delete(t)),g}function Cmn({component:t,story:n,previewRevision:s,width:c=128,height:d=96}){const m=n.Component,g=`${t.surface}:${t.path}:${gmn(n.id,n.args)}:${wmn(m)}:${s}:${c}x${d}`,[S,k]=Ye.useState(()=>aye.get(g)),[A,F]=Ye.useState(!1);return Ye.useEffect(()=>{let D=!1;if(F(!1),k(aye.get(g)),!!bmn())return Tmn(g,t.surface,n,{width:c,height:d}).then(J=>{D||k(J)},()=>{D||F(!0)}),()=>{D=!0}},[t.surface,d,g,n,c]),S?q.jsx("img",{src:S,alt:`${t.name} preview`,className:"volter-component-thumbnail"}):q.jsx("span",{className:"volter-component-thumbnail-fallback","data-component-preview":A?"failed":"capturing-story",children:q.jsx(wR,{kind:"component",name:t.name})})}const Ave="story:three",Dve="story:isolated",Emn="story:docs";function kmn(t,n){return t.surface==="dom"?!1:n===null||t.surface===n}function Amn({entry:t,previewRevision:n,width:s,height:c}){const d=t.detail;return q.jsx(Cmn,{component:t.component,story:d,previewRevision:n,...s===void 0?{}:{width:s},...c===void 0?{}:{height:c}})}const Dmn="story",Pmn={id:Dmn,owner:"./component-content-source",entries(t){const n=rq(),s=[];for(const c of t.components){if(!kmn(c,t.surface))continue;const d=CRt(n,c.name,c.path);d&&s.push({id:`${c.path}:${c.name}`,component:c,detail:d})}return s},subscribe:G0e,Thumbnail:Amn,open(t,n,s){const c=n.detail,d=n.component.surface==="three";CD(d?Ave:Dve,t,d?{modulePath:c.modulePath,storyName:c.name,title:s}:{modulePath:c.modulePath,storyName:c.name})}};function xTt(t){return vYr(t.name,t.sourcePath)}const Imn={id:"portable-csf",owner:"./component-states",statesFor:(t,n)=>n.surface==="dom"?[]:xTt(t).map(s=>({id:s.id,label:s.label})),apply:(t,n,s)=>{const c=xTt(t).find(d=>d.id===n);if(c){if(s.surface==="three"){CD(Ave,s.store,{modulePath:c.modulePath,storyName:c.name,title:c.label});return}if(s.surface==="canvas"){CD(Dve,s.store,{modulePath:c.modulePath,storyName:c.name});return}Qs.warn(`[portable-csf] no story document is registered for the "${s.surface}" surface, so state "${n}" of "${t.name}" could not be opened.`,"authoring")}}};function Nmn(){let t=0,n=!1;const s=S=>{const k=++t;dYr(),jye().then(()=>{if(!(n||k!==t))return wYr(wf(),void 0,{deferUndeclared:!0,...S?{changedPaths:S}:{}})})};s();let c=null;const d=CFt(),m=IC(()=>s()),g=_en(s);return()=>{n=!0,t+=1,c!==null&&clearTimeout(c),d(),m(),g()}}const Zjt="story",MOe=new Set,jOe=new Set;function Omn(t){const n=vRt({modulePath:t.modulePath,title:t.title}).leaf;return n===t.label?n:`${n} · ${t.label}`}function LOe(t){for(const n of rq())if(n.ok){for(const s of n.stories)if(t.storyId===void 0?n.modulePath===t.modulePath&&s.name===t.storyName:s.id===t.storyId)return{modulePath:n.modulePath,storyName:s.name,title:t.title??Omn({modulePath:n.modulePath,title:s.title,label:s.label})}}return null}function Rmn(t,n,s){const c={modulePath:s.modulePath,storyName:s.storyName,title:s.title,...n.activate===void 0?{}:{activate:n.activate}};if(n.mode==="docs")return CD(Emn,t,c);const d=Pze({modulePath:s.modulePath,regions:Dze()});return d.medium===void 0?(fYr(s.modulePath,d.reason),null):CD(d.medium==="three"?Ave:Dve,t,c)}function wTt(t){Qs.warn(`No composed portable story carries the id ${JSON.stringify(t)}, so nothing opened it.`,"editor")}function Fmn(){return kN({id:Zjt,owner:"./story-opener",open:(t,n)=>{const s=LOe(n);return s?Rmn(t,n,s):(n.modulePath?MOe.add(n.modulePath):n.storyId!==void 0&&(jOe.add(n.storyId),hYr()&&wTt(n.storyId)),null)},settle:async()=>{await MDr();const t=[...MOe],n=[...jOe];if(MOe.clear(),jOe.clear(),await Promise.all(t.map(s=>bYr(wf(),s))),n.length!==0){await gYr();for(const s of n)LOe({storyId:s})||wTt(s)}},ready:async(t,n)=>{if(n.mode==="docs")return;const s=LOe(n);if(!(!s||Pze({modulePath:s.modulePath,regions:Dze()}).medium!=="three")&&!await CC(()=>s2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}})}const Mmn={actions:()=>{if(!ogt(Dve)&&!ogt(Ave))return[];const t=[];for(const n of rq()){if(!n.ok)continue;const s=n.modulePath.split("/").pop()??n.modulePath;for(const c of n.stories)t.push({id:`story:${c.id}`,label:`Open Story: ${c.name} — ${s}`,execute:()=>void n0().workspace.open({kind:Zjt,modulePath:n.modulePath,storyName:c.name,title:c.name})})}return t},subscribe:t=>G0e(t)};function jmn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.azimuthDegrees!="number"||!Number.isFinite(s.azimuthDegrees)||typeof s.elevationDegrees!="number"||!Number.isFinite(s.elevationDegrees)||s.elevationDegrees<-90||s.elevationDegrees>90||s.distance!==void 0&&(typeof s.distance!="number"||!Number.isFinite(s.distance)||s.distance<=0)?`${t} camera must be {azimuthDegrees, elevationDegrees in [-90, 90], distance? > 0 meters}.`:{azimuthDegrees:s.azimuthDegrees,elevationDegrees:s.elevationDegrees,...s.distance===void 0?{}:{distance:s.distance}}}function Lmn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.clip!="string"||s.clip.length===0||typeof s.timeSeconds!="number"||!Number.isFinite(s.timeSeconds)||s.timeSeconds<0?`${t} pose must be {clip: non-empty string, timeSeconds >= 0}.`:{clip:s.clip,timeSeconds:s.timeSeconds}}const Bmn="packages/editor-core/src/stories/story-capture-command.ts",nB="capture-story-variants";async function $mn(t){if(document.visibilityState==="hidden")return{ok:!1,error:"story capture needs a PRESENTING tab — the editor tab is hidden, so the browser suspends the frames a story mount must paint. Bring the editor tab to the foreground (or unminimize its window) and re-run."};const n=t.modulePath;if(typeof n!="string"||n==="")return{ok:!1,error:`${nB} requires a project-relative modulePath.`};const s=t.story;if(s!==void 0&&typeof s!="string")return{ok:!1,error:`${nB} story must be a CSF export name.`};const c=(d,m,g)=>{if(d===void 0)return m;if(typeof d!="number"||!Number.isInteger(d)||d<64||d>1024)throw new Error(`${nB} ${g} must be an integer from 64 to 1024.`);return d};try{const d=await(async()=>{try{const D=await LZr("volter.project.json");if(!D)return null;const J=JSON.parse(D),$=J.resolution?.width,G=J.resolution?.height;return typeof $!="number"||typeof G!="number"||$<64||G<64||$>4096||G>4096?null:{width:Math.min(1024,Math.round($)),height:Math.min(1024,Math.round(G))}}catch{return null}})(),m=c(t.width,d?.width??960,"width"),g=c(t.height,d?.height??540,"height"),S=jmn(nB,t.camera);if(typeof S=="string")return{ok:!1,error:S};const k=Lmn(nB,t.pose);if(typeof k=="string")return{ok:!1,error:k};const{captureProjectStoryVariants:A}=await lo(async()=>{const{captureProjectStoryVariants:D}=await import("./story-capture-CdblyPkl.js");return{captureProjectStoryVariants:D}},__vite__mapDeps([267,268,1,2,3,4,20,21,233,212,269,22,23]));return{ok:!0,data:{...await A(wf(),{modulePath:n,...s===void 0?{}:{story:s},width:m,height:g,...S?{camera:S}:{},...k?{pose:k}:{}})}}}catch(d){return{ok:!1,error:d instanceof Error?d.message:String(d)}}}const qmn={[nB]:{timeoutMs:12e4,derivedRefresh:"if-content-changed",handle:$mn}};function zmn(){const t=kin(Pmn),n=mmn(Imn),s=Fmn(),c=mCt(Mmn),d=gCt(Bmn,qmn),m=Nmn(),g=G0e(()=>{BB()});return()=>{g(),m(),d(),c(),s(),n(),t()}}const Vmn=[["descriptionForeground","--volter-content-dim"],["disabledForeground","--volter-content-placeholder"],["errorForeground","--volter-danger"],["focusBorder","--volter-accent"],["selection.background","--volter-accent","99"],["sash.hoverBorder","--volter-accent"],["menubar.selectionBackground","--volter-accent"],["menubar.selectionForeground","--volter-content-on-accent"],["menu.selectionBackground","--volter-accent"],["menu.selectionForeground","--volter-content-on-accent"],["editorGroupHeader.tabsBackground","--volter-surface-chrome"],["editorGroup.dropBackground","--volter-accent","66"],["tab.inactiveBackground","--volter-surface-chrome"],["tab.inactiveForeground","--volter-content-dim"],["editor.background","--volter-surface-chrome"],["editorLineNumber.foreground","--volter-content-placeholder"],["editor.selectionBackground","--volter-accent","99"],["editorGutter.background","--volter-surface-chrome"],["panelTitle.inactiveForeground","--volter-content-dim"],["list.activeSelectionBackground","--volter-accent"],["list.activeSelectionForeground","--volter-content-on-accent"],["list.focusOutline","--volter-accent"],["list.dropBackground","--volter-accent","66"],["button.background","--volter-accent"],["button.foreground","--volter-content-on-accent"],["checkbox.selectBackground","--volter-accent"],["input.background","--volter-surface-chrome"],["input.placeholderForeground","--volter-content-placeholder"],["inputOption.activeBackground","--volter-accent"],["inputOption.activeForeground","--volter-content-on-accent"],["inputValidation.errorBorder","--volter-danger"],["badge.background","--volter-accent"],["badge.foreground","--volter-content-on-accent"],["progressBar.background","--volter-accent"],["quickInputList.focusBackground","--volter-accent"],["quickInputList.focusForeground","--volter-content-on-accent"],["notificationsErrorIcon.foreground","--volter-danger"],["notificationsWarningIcon.foreground","--volter-warn"],["notificationsInfoIcon.foreground","--volter-accent"],["terminal.background","--volter-surface-chrome"],["commandCenter.background","--volter-surface-chrome"],["volter.view.background","--volter-surface-panel"],["foreground","--volter-content-primary"],["icon.foreground","--volter-content-muted"],["widget.border","--volter-boundary-default"],["titleBar.activeBackground","--volter-surface-shell"],["titleBar.inactiveBackground","--volter-surface-shell"],["titleBar.activeForeground","--volter-content-muted"],["titleBar.border","--volter-surface-shell"],["activityBar.background","--volter-surface-shell"],["activityBar.foreground","--volter-content-primary"],["activityBar.inactiveForeground","--volter-content-dim"],["activityBar.border","--volter-surface-shell"],["activityBar.activeBorder","--volter-accent"],["statusBar.background","--volter-surface-shell"],["statusBar.foreground","--volter-content-muted"],["statusBar.border","--volter-surface-shell"],["sideBar.background","--volter-surface-panel"],["sideBar.foreground","--volter-content-primary"],["sideBar.border","--volter-boundary-default"],["sideBarSectionHeader.background","--volter-surface-chrome"],["panel.background","--volter-surface-panel"],["panel.border","--volter-boundary-default"],["editorGroup.border","--volter-boundary-default"],["editorGroupHeader.tabsBorder","--volter-boundary-default"],["tab.activeBackground","--volter-surface-panel"],["tab.activeForeground","--volter-content-primary"],["tab.border","--volter-boundary-default"],["menu.background","--volter-widget-menu"],["menu.foreground","--volter-content-menu"],["menu.border","--volter-boundary-default"],["dropdown.background","--volter-widget-menu"],["dropdown.border","--volter-boundary-default"],["input.foreground","--volter-content-primary"],["input.border","--volter-boundary-default"]],Umn=[["volter.viewport.background","--volter-viewport-background"],["volter.viewport.grid","--volter-viewport-grid"],["volter.viewport.axisX","--volter-viewport-axis-x"],["volter.viewport.axisY","--volter-viewport-axis-y"],["volter.viewport.axisZ","--volter-viewport-axis-z"],["volter.viewport.selection","--volter-viewport-selection"],["volter.viewport.active","--volter-viewport-active"],["volter.viewport.wire","--volter-viewport-wire"],["volter.gizmo.x","--volter-gizmo-x"],["volter.gizmo.y","--volter-gizmo-y"],["volter.gizmo.z","--volter-gizmo-z"],["volter.gizmo.navigationX","--volter-gizmo-navigation-x"],["volter.gizmo.navigationY","--volter-gizmo-navigation-y"],["volter.gizmo.navigationZ","--volter-gizmo-navigation-z"],["volter.gizmo.hover","--volter-gizmo-hover"],["volter.gizmo.drag","--volter-gizmo-drag"]];function TTt(t){const n=t.trim().toLowerCase(),s=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(n)?.[1];if(s)return`#${s.length===3?[...s].map(S=>S+S).join(""):s}`;const c=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/.exec(n);if(!c)return null;const d=S=>Math.max(0,Math.min(255,Math.round(Number(S)))).toString(16).padStart(2,"0"),m=c[4],g=m===void 0?"":Math.round(Math.max(0,Math.min(1,m.endsWith("%")?Number.parseFloat(m)/100:Number(m)))*255).toString(16).padStart(2,"0");return`#${d(c[1])}${d(c[2])}${d(c[3])}${g==="ff"?"":g}`}function Jmn(t){const n=getComputedStyle(t),s={};for(const[c,d,m]of Vmn){const g=TTt(n.getPropertyValue(d));g!==null&&(g.length===9&&!m||(s[c]=m&&g.length===7?`${g}${m}`:g))}for(const[c,d]of Umn){const m=TTt(n.getPropertyValue(d));m!==null&&(s[c]=m)}return s}let xm=null,Qjt=0;const Xje=new Set;function Wmn(t){return Xje.add(t),()=>Xje.delete(t)}function CTt(){return Qjt}const BOe=new Map;function eLt(t,n){BOe.get(t)?.disconnect(),BOe.delete(t);const s=()=>{const d=n?.isConnected?n.getBoundingClientRect():null;QAr(t,d!==null&&d.width>0&&d.height>0)};if(s(),n===null||typeof ResizeObserver>"u")return;const c=new ResizeObserver(s);c.observe(n),BOe.set(t,c)}function Hmn(t,n){if(xm){if(n===null){if(xm[t]?.isConnected)return}else if(xm[t]===n)return;if(n===null&&(t==="outliner"||t==="properties"||t==="content")){const s={...xm};delete s[t],xm=s}else n!==null&&(xm={...xm,[t]:n});n!==null&&tLt(t,n),eLt(t,n),Qjt+=1;for(const s of Xje)s()}}function tLt(t,n){n.dataset.volterPart=t}const HO=new Map;let rLt=0;const Yje=new Set,nLt=new Set;let ETt=!1;function kTt(){for(const t of l0())nLt.add(t.descriptor.id)}function Gmn(t){ETt||(ETt=!0,o2(kTt)),kTt(),!(!t||nLt.has(t))&&(Etn(t)||AFt(t,!1))}function Kmn(t,n){if(n){if(!HO.delete(t.id))return}else{HO.has(t.id)||Gmn(t.documentId);const s=HO.get(t.id);if(s?.element===t.element&&s.documentId===t.documentId)return;HO.set(t.id,{...t})}rLt+=1;for(const s of[...Yje])s()}function Xmn(t){return Yje.add(t),()=>{Yje.delete(t)}}function ATt(){return rLt}function GO({children:t,row:n=!1,center:s=!1}){return q.jsx("div",{className:"volter-editor-shell volter-part",onWheel:c=>c.stopPropagation(),"data-editor-hotkey-scope":"workspace","data-editor-hotkey-fallback":!0,style:{display:"flex",flexDirection:n?"row":"column",justifyContent:s?"center":void 0,width:"100%",height:"100%",minHeight:0,minWidth:0,position:"relative",fontFamily:"var(--volter-font-sans)",fontSize:"var(--volter-font-base)",color:"var(--volter-content-primary)"},children:t})}function Ymn({children:t}){return q.jsx(q.Fragment,{children:t})}function Zmn(){return xm?r2.createPortal(q.jsx(GO,{center:!0,children:q.jsx(npn,{})}),xm.header):null}function Qmn(){return null}function ehn(){const t=Ye.useRef(null);return Ye.useEffect(()=>{const n=t.current;if(n)return vjt(n),()=>pfn(n)},[]),q.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[q.jsx("div",{ref:t,className:"volter-vscode-outliner-header",style:{padding:"var(--volter-space-2) var(--volter-space-4)","--volter-hierarchy-search-basis":"100%"}}),q.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:q.jsx(kjt,{})})]})}const Ome=new Map,Zje=new Set;let Qje=0;function thn(t,n){if(n){if(Ome.get(t)===n)return;n.dataset.volterUtility=t,Ome.set(t,n)}else if(!Ome.delete(t))return;Qje++;for(const s of Zje)s()}const Rme=new Map,eLe=new Set;let tLe=0;function rhn(t,n){if(n){if(Rme.get(t)===n)return;Rme.set(t,n)}else if(!Rme.delete(t))return;tLe++;for(const s of eLe)s()}function nhn(){return Ye.useSyncExternalStore(D3t,hht,hht),Ye.useSyncExternalStore(t=>(eLe.add(t),()=>eLe.delete(t)),()=>tLe,()=>tLe),q.jsx(q.Fragment,{children:[...hRe("left"),...hRe("right")].map(t=>{const n=Rme.get(t.id);if(!n)return null;const s=t.Content;return q.jsx(Ye.Fragment,{children:r2.createPortal(q.jsx(s,{}),n)},t.id)})})}function ihn(){return Ye.useSyncExternalStore(Xye,bhe,bhe),Ye.useSyncExternalStore(t=>(Zje.add(t),()=>Zje.delete(t)),()=>Qje,()=>Qje),q.jsx(q.Fragment,{children:bC().map(t=>{const n=Ome.get(t.id);return n?q.jsx(Ye.Fragment,{children:r2.createPortal(q.jsx(GO,{children:q.jsx(spn,{utility:t})}),n)},t.id):null})})}function ohn({descriptor:t,viewId:n,slot:s,parking:c,visible:d,inspector:m}){const[g]=Ye.useState(()=>document.createElement("div"));return Ye.useLayoutEffect(()=>{g.className="volter-vscode-document-slot",g.dataset.volterDocument=t.id,g.dataset.volterArea=t.area??"",g.style.cssText=`display:${d?"flex":"none"};flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;position:relative;`},[g,t.id,t.area,d]),Ye.useLayoutEffect(()=>((s??c).appendChild(g),()=>g.remove()),[g,s,c]),r2.createPortal(q.jsxs(GO,{children:[q.jsx(VMt,{descriptor:t,viewId:n,active:d,chrome:!t.area}),m&&q.jsx(Hun,{})]}),g)}let iLt=!0;function shn({arrangement:t,immersivePlay:n}){const s=Yv();pmn(s);const c=WVe(s);Ye.useLayoutEffect(()=>{iLt=c.column},[c.column]);const d=HO.get(CRe()??"")?.element??xm?.center;Ye.useLayoutEffect(()=>{if(!d)return;const F=()=>Pwt({x:0,y:0,width:d.clientWidth,height:d.clientHeight}),D=new ResizeObserver(F);return D.observe(d),F(),()=>{D.disconnect(),Pwt(null)}},[d]),Ye.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),Ye.useSyncExternalStore(o2,K1,K1),Ye.useSyncExternalStore(Xmn,ATt,ATt),Ye.useSyncExternalStore(Wmn,CTt,CTt),Ye.useLayoutEffect(()=>{const F=okr({...t?{arrangement:t}:{},...n===void 0?{}:{immersivePlay:n},playUtilities:[]});return t&&a2(t.id),Rkr(),F},[t,n]);const m=s.playState!=="stopped",g=Ye.useSyncExternalStore(bee,NR).play?.keepPanelsVisible;if(Ye.useEffect(()=>{G_n(m,zjt())},[m,n,g]),Ye.useEffect(()=>Yjt(s),[s]),!xm)return null;const S=xm.center,k=l0(),A=TC()??k[0]??null;return globalThis.__volterBridge={documents:k.map(F=>F.descriptor.id),active:A?.descriptor.id??null,workspace:t?.id??null,areas:k.flatMap(F=>F.descriptor.area?[{id:F.descriptor.id,area:F.descriptor.area}]:[]),slots:[...HO.values()].map(({id:F,documentId:D,element:J})=>({id:F,documentId:D,visible:!!J}))},q.jsxs(q.Fragment,{children:[[...HO.values()].map(F=>{const D=k.find(J=>J.descriptor.id===F.documentId)?.descriptor;return D?q.jsx(ohn,{descriptor:D,viewId:F.id,slot:F.element??void 0,parking:S,visible:!!F.element,inspector:c.card&&D.id===A?.descriptor.id},F.id):null}),k.length===0&&r2.createPortal(q.jsx(GO,{children:q.jsx("div",{className:"volter-vscode-empty",children:"No document open"})}),xm.center),xm.outliner&&r2.createPortal(q.jsx(GO,{children:q.jsx(ehn,{})}),xm.outliner),xm.properties&&r2.createPortal(q.jsx(GO,{children:c.column?q.jsx(ZVe,{}):q.jsx($un,{surface:c.surface})}),xm.properties),xm.content&&r2.createPortal(q.jsx(GO,{children:q.jsx(E_n,{kind:"assets"})}),xm.content),q.jsx(ihn,{}),q.jsx(nhn,{})]})}async function ahn(t,n={}){xm=t,n.workspaceStorage&&t3r(n.workspaceStorage),l3r();for(const[De,Pe]of Object.entries(t))Pe&&tLt(De,Pe),eLt(De,Pe??null);t.chromeRoot.id="editor-chrome-root",OPt({Frame:Ymn,Header:Zmn,Footer:Qmn,Workspace:shn,Document:jcn}),A_n(),Wnn();const s=Hln();s&&Jln(s,Date.now())&&Qs.warn(Vln(s,Date.now()),"editor"),_mn(),ODr(),Q_n(),zmn(),await Promise.all([G4t(),sAr(),rPt()]),SAr(t.chromeRoot),t.chromeRoot.classList.toggle("volter-native-menus",lee()?.nativeMenus===!0);const c=document.createElement("div");c.id="editor-root",c.className="volter-part",c.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:10;",t.chromeRoot.appendChild(c),rLe.createRoot(c).render(q.jsx(uun,{}));const d={activeKeymap:()=>n0().keyboard.activeKeymap(),invoke:De=>n0().keyboard.invoke(De),subscribe:De=>n0().keyboard.subscribe(De),facts:()=>{const De=n0(),Pe=De.keyboard.stage();return{surface:Pe.surface,mode:Pe.mode,documentKind:De.documents.active()?.kind??null,play:De.session.playState()}},report:(De,Pe)=>{const be=n0();De==="error"?be.console.error(Pe,"editor"):be.console.warn(Pe,"editor")}};let m=!1;const g={whenRestored:uUe,activeSource:()=>{const De=n0().documents.active();if(!De)return null;const Pe=De.kind==="model"&&De.id.startsWith("model:")?De.id.slice(6):"";return{kind:De.kind,path:Pe}},list:()=>l0().map(De=>{const Pe=De.descriptor.area?Ekr().find(be=>be.id===De.descriptor.area):void 0;return{id:De.descriptor.id,title:De.title,...Pe?{area:{id:Pe.id,place:Pe.place,ratio:Pe.ratio}}:{}}}),activeId:()=>TC()?.descriptor.id??null,subscribe:De=>{m=!0;const Pe=o2(De),be=kkr(De);return()=>{Pe(),be()}},activate:(De,Pe)=>{!m&&HQ()||(Pe?vTr(De,Pe):X0(De))},close:De=>{if(EN(De))return;const Pe=l0().find(be=>be.descriptor.id===De);Pe&&d.report("warn",`“${Pe.title}” has unsaved changes, so it stayed open. Save it (⌘S) and close it again.`)},setView:(De,Pe)=>Kmn(De,Pe)},S={elements:()=>n0().history.elements(),onElement:De=>n0().history.onElement(De),onInvalidated:De=>n0().history.onInvalidated(De),changed:()=>n0().history.changed(),focusedResource:()=>n0().history.focusedResource(),focusedDocument:()=>{const De=n0().documents.active();return De?{id:De.id,label:De.title}:null},setDelegate:De=>n0().history.setDelegate(De),report:d.report},k={setProvider:De=>n0().files.setProvider(De),report:d.report},A={setProvider:De=>n0().settings.setProvider(De),adapterValues:()=>[...REr()],workbenchValues:()=>{const De=xm?.chromeRoot;if(!De)return[];const Pe=getComputedStyle(De).getPropertyValue("--volter-command-bar-height").trim(),be=Number.parseFloat(Pe),X=["workbench.colorCustomizations",Jmn(De)];return!Number.isFinite(be)||be<=0?[X]:[["window.titleBarHeight",Math.round(be)],X]},lookId:()=>DN(),notify:De=>{n0().notify(De)},subscribe:De=>{const Pe=Hye(De),be=ADt(De);return()=>{Pe(),be()}},report:d.report},F={list:()=>Knn().map(De=>({id:De.id,label:De.label,category:De.category,...De.menu?{menu:De.menu}:{}})),invoke:De=>Ynn(De),subscribe:De=>Xnn(De),setPaletteOpener:De=>Gnn(De),setCommandExecutor:De=>Znn(De),report:d.report},D={setDelegate:De=>QCr(De?{show:Pe=>De({...Pe,source:c3r()})}:null)},J={list:()=>MPt().map(De=>({view:De.view,title:De.title,verbs:De.verbs.map(Pe=>({id:Pe.id,...Pe.title?{title:Pe.title}:{}}))})),invoke:(De,Pe,be)=>LPt(De,Pe,be),subscribe:De=>jPt(De)},$={list:()=>bC().map((De,Pe)=>({id:De.id,title:De.title,order:De.order??Pe})),subscribe:De=>{let Pe=bhe();const be=Xye(De),X=YVe(()=>{const we=bhe();we!==Pe&&(Pe=we,De())});return()=>{be(),X()}},offerBody:(De,Pe)=>thn(De,Pe)};let G=!0,se=null,pe=null;vrn(()=>G);const ue={setActiveStaticPanel:De=>tgt(kVe.find(Pe=>Pe.kind===De)?.kind??null),focusCompactInspector:()=>{if(iLt)return!1;const De=xm?.center.querySelector('[data-testid="compact-inspector-card"]');return De?(De.tabIndex=-1,De.focus(),tgt("inspector"),!0):!1},setPaneActive:De=>{G!==De&&(G=De)},setImmersive:De=>{se?.(),se=null,!(!De||!xm)&&(se=z_n({root:xm.chromeRoot,hideChrome:()=>De.enter(),showChrome:()=>De.exit()}))},setDockCommands:De=>{pe?.(),pe=null,De&&(pe=ckr({showUtility:Pe=>De.showUtility(Pe),toggleUtility:Pe=>De.toggleUtility(Pe),ensureUtility:Pe=>De.ensureUtility(Pe),closeUtility:Pe=>De.closeUtility(Pe),showStaticPanel:Pe=>De.showStaticPanel(Pe),setFocus:Pe=>De.setFocus(Pe),toggleFocus:()=>De.toggleFocus(),captureUtilities:Pe=>{for(const be of Pe)De.showUtility(be);return()=>{for(const be of Pe)De.closeUtility(be)}},showAuxiliary:()=>ue.report("warn","Undo history has no panel under the VS Code frame: the stack is the workbench's own (U4), reached through Edit → Undo/Redo and the Timeline.")}))},report:(De,Pe)=>d.report(De,Pe)};return{host:c,keyboard:d,documents:g,history:S,files:k,commands:F,notifications:D,views:J,utilities:$,output:{setProvider:Z_n},settings:A,status:{list:()=>["left","right"].flatMap(De=>hRe(De).map((Pe,be)=>({id:Pe.id,title:Pe.name,align:De,order:Pe.order??be}))),subscribe:De=>D3t(De),offerBody:(De,Pe)=>rhn(De,Pe)},game:ue,offerPart:Hmn}}function chn(t){const n=Object.keys(t.packages);return p0r({id:t.id,packages:n,look:t.look,workspace:t.workspace,nativeMenus:t.nativeMenus,logo:t.logo}),LDt(n.flatMap(s=>t.packages[s]??[])),{mountVolter:ahn}}const{mountVolter:bwn}=chn({id:"game-editor",packages:{"@volter/editor-game":l0r,"@volter/editor-react":u0r,"@volter/editor-threejs":f0r,"@volter/editor-xstate":d0r,"@volter/editor-blender":c0r},look:"classic",workspace:"game",logo:"https://brand.volter.ai/logo/volter-game-editor/svg",nativeMenus:!0});export{Jl as $,v3t as A,p0n as B,b3t as C,S3t as D,F_e as E,N0n as F,TAr as G,cRe as H,Cen as I,pFt as J,DB as K,u0 as L,OC as M,y3t as N,tVe as O,h3t as P,pSn as Q,x3t as R,jwr as S,L2n as T,Yv as U,Ih as V,nBe as W,YXr as X,nvn as Y,Qs as Z,lo as _,XY as a,h2n as a$,GFt as a0,Xtn as a1,ZFt as a2,L_ as a3,CN as a4,CSn as a5,Ms as a6,dc as a7,Kk as a8,ivn as a9,hRt as aA,Utn as aB,wf as aC,Y0 as aD,mp as aE,z0n as aF,hy as aG,oq as aH,mMt as aI,V3r as aJ,dSn as aK,_p as aL,dm as aM,Zm as aN,mwn as aO,ive as aP,l0 as aQ,AFt as aR,TD as aS,r0n as aT,qCr as aU,Z0e as aV,FRt as aW,jze as aX,$Sn as aY,Zf as aZ,F9t as a_,vC as aa,Ggn as ab,tan as ac,ccn as ad,lSn as ae,Yze as af,MB as ag,Hwr as ah,o9t as ai,t2n as aj,_0n as ak,Go as al,Ygn as am,Iye as an,Qun as ao,Q0e as ap,Ywr as aq,Xxn as ar,G0e as as,rq as at,Pze as au,Dze as av,fYr as aw,ban as ax,h$e as ay,ztn as az,iBe as b,E3r as b$,y2n as b0,J4r as b1,g2n as b2,gC as b3,E$e as b4,kTr as b5,tOe as b6,ig as b7,CFt as b8,gYr as b9,yBe as bA,Jc as bB,t2 as bC,aLe as bD,bhn as bE,$vr as bF,hgt as bG,Iw as bH,kAr as bI,wAr as bJ,QBe as bK,CAr as bL,_0r as bM,cye as bN,VOe as bO,Eyn as bP,Cyn as bQ,Gsn as bR,H0n as bS,W0n as bT,j3r as bU,Y0n as bV,Lhe as bW,r2n as bX,o2n as bY,vtn as bZ,C3r as b_,Ybn as ba,SRt as bb,gRt as bc,xRt as bd,tYr as be,hmn as bf,ywn as bg,SSn as bh,vRt as bi,mYr as bj,_vn as bk,mLe as bl,YB as bm,nwn as bn,iwn as bo,qfn as bp,OAr as bq,j0n as br,e$e as bs,mgt as bt,O0n as bu,n$ as bv,mO as bw,g0r as bx,aR as by,uLe as bz,lRe as c,E2n as c$,Uwr as c0,n2n as c1,htn as c2,i9t as c3,ed as c4,_y as c5,fu as c6,I2n as c7,R2n as c8,F2n as c9,GZr as cA,KZr as cB,qRt as cC,VRt as cD,MZr as cE,d2n as cF,zZr as cG,f2n as cH,XZr as cI,A2n as cJ,qZr as cK,zze as cL,zRt as cM,$Zr as cN,EMe as cO,LZr as cP,b2n as cQ,i_e as cR,UZr as cS,GSt as cT,HSt as cU,WZr as cV,IZr as cW,qze as cX,CMe as cY,VZr as cZ,D2n as c_,M2n as ca,VSt as cb,C2n as cc,O2n as cd,N2n as ce,ZZr as cf,USt as cg,w2n as ch,jD as ci,CZr as cj,KSt as ck,x2n as cl,YZr as cm,v2n as cn,k2n as co,l2n as cp,u2n as cq,FZr as cr,j2n as cs,HZr as ct,jZr as cu,_2n as cv,m2n as cw,P2n as cx,T2n as cy,eve as cz,g3t as d,Sxr as d$,p2n as d0,QZr as d1,S2n as d2,atn as d3,X0 as d4,lxt as d5,QSn as d6,Kye as d7,dR as d8,Iyn as d9,i$ as dA,yan as dB,han as dC,MVe as dD,txn as dE,v0r as dF,S0r as dG,PTt as dH,tyn as dI,pen as dJ,_Sn as dK,utn as dL,dMt as dM,u2 as dN,KAr as dO,i2n as dP,_Mt as dQ,fQ as dR,khn as dS,hEr as dT,WTt as dU,SZ as dV,MCr as dW,d4t as dX,yZ as dY,fAt as dZ,AR as d_,Vv as da,Nyn as db,N0r as dc,R0r as dd,q3t as de,bZ as df,yyn as dg,Ohn as dh,ZTt as di,eCt as dj,whn as dk,Q0r as dl,$0n as dm,q0n as dn,PI as dp,R_ as dq,rwn as dr,pBe as ds,Cm as dt,Dfn as du,i0 as dv,z2n as dw,FDr as dx,Zun as dy,RRe as dz,m3t as e,HCr as e$,SSr as e0,t$ as e1,Hme as e2,lCt as e3,K0n as e4,W0 as e5,tvn as e6,J2n as e7,ESn as e8,lvn as e9,fSn as eA,myn as eB,mSn as eC,$Yr as eD,Rze as eE,IRt as eF,_4t as eG,ltn as eH,hYr as eI,I4t as eJ,R5e as eK,Mye as eL,$on as eM,sLe as eN,Dhn as eO,h0r as eP,A4t as eQ,Uon as eR,Vht as eS,N5e as eT,Oht as eU,c0 as eV,s0n as eW,van as eX,jRe as eY,wBe as eZ,l0n as e_,qhe as ea,I4r as eb,$Qr as ec,uvn as ed,m$e as ee,dvn as ef,fvn as eg,Xbn as eh,nxn as ei,rxn as ej,rvn as ek,SBe as el,ahe as em,Tyn as en,G0 as eo,Myn as ep,YY as eq,$yn as er,C_e as es,Kyn as et,sQ as eu,Xgn as ev,IC as ew,Fhn as ex,UTr as ey,BSn as ez,uRe as f,gSn as f$,Ahn as f0,S0n as f1,b0n as f2,TC as f3,cFe as f4,wee as f5,kN as f6,Dve as f7,Emn as f8,wYr as f9,R0n as fA,D0n as fB,own as fC,dPt as fD,Lhn as fE,I0r as fF,jhn as fG,Fme as fH,zOe as fI,nCt as fJ,P0n as fK,Fyn as fL,vxn as fM,Oan as fN,fxn as fO,TR as fP,Ixn as fQ,dxn as fR,Xze as fS,Kbn as fT,CRt as fU,xTr as fV,cTr as fW,exn as fX,hSn as fY,ySn as fZ,a0 as f_,ND as fa,Kwr as fb,VTr as fc,T_e as fd,ctn as fe,y$e as ff,u3r as fg,mfn as fh,Qxn as fi,Zxn as fj,Yxn as fk,Ave as fl,EN as fm,A0n as fn,L0n as fo,vwn as fp,gwn as fq,vSn as fr,bSn as fs,x4t as ft,m0n as fu,Chn as fv,Nhn as fw,fN as fx,iLe as fy,dLe as fz,w3t as g,JTr as g$,HQ as g0,ZSn as g1,VSn as g2,X9t as g3,PRt as g4,zQ as g5,Bfn as g6,Kun as g7,CR as g8,eYr as g9,hwn as gA,Kgn as gB,RFe as gC,y3r as gD,pvn as gE,w0r as gF,e2n as gG,TYr as gH,Pht as gI,XTt as gJ,o2 as gK,K1 as gL,MSn as gM,jSn as gN,Vwr as gO,Wgn as gP,FSn as gQ,Jgn as gR,RSn as gS,e9t as gT,Q2n as gU,xR as gV,aen as gW,Grn as gX,Rhn as gY,HTt as gZ,LTt as g_,Zbn as ga,Jtn as gb,MDr as gc,Pg as gd,LSn as ge,y0r as gf,fee as gg,V2n as gh,aSn as gi,U2n as gj,_yn as gk,sSn as gl,d4r as gm,eSn as gn,V0n as go,oSn as gp,U0n as gq,cvn as gr,Dw as gs,of as gt,hR as gu,k3r as gv,J0n as gw,NSn as gx,fPt as gy,gnn as gz,YAt as h,i0n as h$,rA as h0,kC as h1,tA as h2,Ihn as h3,evn as h4,fBe as h5,tve as h6,c2n as h7,mCt as h8,Uan as h9,Aht as hA,Vye as hB,RTr as hC,OTr as hD,ZTr as hE,kyn as hF,Pyn as hG,Dyn as hH,Oyn as hI,Ryn as hJ,o0n as hK,wyn as hL,t0n as hM,Ym as hN,f4t as hO,Syn as hP,xyn as hQ,gBe as hR,Jye as hS,Ayn as hT,xBe as hU,gyn as hV,Qyn as hW,e0n as hX,she as hY,f0n as hZ,Dht as h_,Mxn as ha,vYr as hb,X0n as hc,Hgn as hd,iyn as he,cyn as hf,dyn as hg,R$ as hh,CD as hi,oyn as hj,ryn as hk,nyn as hl,lyn as hm,c0n as hn,a0n as ho,zTr as hp,GCr as hq,kht as hr,hC as hs,kRe as ht,V3t as hu,vyn as hv,byn as hw,DRe as hx,ARe as hy,qTr as hz,Ip as i,oLe as i$,JCr as i0,jyn as i1,p4t as i2,uhe as i3,FCr as i4,OG as i5,i4t as i6,W3t as i7,LTr as i8,KTr as i9,rCr as iA,eCr as iB,NG as iC,Yyn as iD,d0n as iE,NCr as iF,LCr as iG,jTr as iH,Jyn as iI,Lyn as iJ,fhe as iK,Xyn as iL,I5e as iM,MTr as iN,TBe as iO,qyn as iP,q$ as iQ,Byn as iR,Vyn as iS,GSn as iT,YSn as iU,Cee as iV,AD as iW,Icn as iX,Gxn as iY,E5e as iZ,jxn as i_,Uyn as ia,zyn as ib,Wyn as ic,Hyn as id,n0n as ie,FTr as ig,RCr as ih,o4t as ii,u0n as ij,WTr as ik,Zyn as il,Gyn as im,YTr as io,E_e as ip,IRe as iq,tCr as ir,QTr as is,WCr as it,XTr as iu,yee as iv,Bye as iw,nCr as ix,Epe as iy,NRe as iz,GAt as j,Dxn as j$,nee as j0,Jfn as j1,awn as j2,I0n as j3,AAr as j4,CBe as j5,o$ as j6,MMt as j7,Bxn as j8,s2 as j9,Win as jA,O9t as jB,zTt as jC,FB as jD,sN as jE,K2n as jF,Kxn as jG,U_n as jH,sGr as jI,cGr as jJ,uGr as jK,uSn as jL,qwr as jM,gVe as jN,bnn as jO,ste as jP,aan as jQ,ewt as jR,wI as jS,BFe as jT,Pxn as jU,hhn as jV,Shn as jW,vhn as jX,Axn as jY,yhn as jZ,x0r as j_,Lxn as ja,cPt as jb,T3r as jc,oBe as jd,Gwr as je,_ht as jf,Bwr as jg,T3t as jh,Dsn as ji,iSn as jj,HI as jk,HMe as jl,Zgn as jm,WRt as jn,rve as jo,Dye as jp,cN as jq,tBe as jr,Fye as js,lN as jt,qAr as ju,DBe as jv,mBe as jw,Rye as jx,rBe as jy,e0e as jz,Rwr as k,gR as k$,Ran as k0,gxn as k1,hxn as k2,qon as k3,Nxn as k4,mxn as k5,qan as k6,Fxn as k7,sxn as k8,Oxn as k9,o6t as kA,rSn as kB,JSn as kC,wD as kD,J0 as kE,QSt as kF,VAt as kG,Y4 as kH,xhn as kI,cLe as kJ,kEr as kK,Cve as kL,Eve as kM,OSn as kN,BMt as kO,zMt as kP,Xxt as kQ,jFe as kR,q_e as kS,LFe as kT,Xun as kU,QVe as kV,$xn as kW,Hfn as kX,k0n as kY,rvr as kZ,cSn as k_,pxn as ka,uxn as kb,axn as kc,wxn as kd,lxn as ke,cxn as kf,_xn as kg,xxn as kh,yxn as ki,Txn as kj,p$e as kk,bxn as kl,ixn as km,Rxn as kn,oxn as ko,Cxn as kp,vVe as kq,Sxn as kr,Fan as ks,Exn as kt,kxn as ku,WSn as kv,USn as kw,HSn as kx,tSn as ky,NDr as kz,Zme as l,uwn as l$,kDr as l0,Tve as l1,U$ as l2,eA as l3,mD as l4,Qwr as l5,eTr as l6,Zwr as l7,Oye as l8,Ehn as l9,KSn as lA,cwn as lB,lwn as lC,wjt as lD,XSn as lE,syn as lF,qsn as lG,uyn as lH,twn as lI,pwn as lJ,B0n as lK,RAr as lL,M0n as lM,pyn as lN,ayn as lO,fyn as lP,dwn as lQ,yrn as lR,G0n as lS,wEr as lT,$hn as lU,$fn as lV,s2n as lW,a2n as lX,xSn as lY,a9t as lZ,_jt as l_,U0r as la,o3r as lb,s3r as lc,Thn as ld,ljt as le,Qgn as lf,zwr as lg,Xwr as lh,LPt as li,Hxn as lj,Wxn as lk,Vxn as ll,Jxn as lm,Uxn as ln,T0n as lo,F3r as lp,Q0n as lq,Z0n as lr,nSn as ls,F0n as lt,swn as lu,ghn as lv,qxn as lw,zxn as lx,Phn as ly,Mhn as lz,rQ as m,cbr as m$,_wn as m0,Qbn as m1,qSn as m2,jfn as m3,jmn as m4,Lmn as m5,nq as m6,qDr as m7,hyn as m8,gCt as m9,mje as mA,FAt as mB,Bxr as mC,YI as mD,r1r as mE,xCt as mF,f1r as mG,zme as mH,iht as mI,F_ as mJ,Vme as mK,Ume as mL,Wbr as mM,Ybr as mN,yB as mO,Rbr as mP,Mbr as mQ,IEt as mR,zbr as mS,PEt as mT,Nbr as mU,Obr as mV,bbr as mW,Sbr as mX,h2r as mY,eh as mZ,X1r as m_,ISn as ma,H2n as mb,q2n as mc,G2n as md,OQr as me,zEr as mf,jEr as mg,ove as mh,Ytn as mi,h0n as mj,E0n as mk,g0n as ml,v0n as mm,y0n as mn,Jsn as mo,C0n as mp,ASn as mq,DSn as mr,kSn as ms,PSn as mt,TEr as mu,CEr as mv,JRe as mw,bN as mx,zSn as my,eyn as mz,vB as n,Rw as n$,kEt as n0,sbr as n1,rbr as n2,EEt as n3,ibr as n4,ebr as n5,Y1r as n6,ubr as n7,tbr as n8,Z1r as n9,Pbr as nA,Ebr as nB,Cbr as nC,Abr as nD,kbr as nE,r2r as nF,Bbr as nG,Tbr as nH,w2r as nI,a2r as nJ,Ibr as nK,i2r as nL,g2r as nM,vbr as nN,Gbr as nO,_2r as nP,Jbr as nQ,f2r as nR,DEt as nS,qbr as nT,Zbr as nU,Qbr as nV,FEt as nW,y2r as nX,p2r as nY,x2r as nZ,v2r as n_,G1r as na,K1r as nb,fbr as nc,lbr as nd,nbr as ne,Q1r as nf,abr as ng,bye as nh,obr as ni,MEt as nj,T2r as nk,$br as nl,Xbr as nm,d2r as nn,t2r as no,jbr as np,hbr as nq,ybr as nr,hLe as ns,s2r as nt,MCt as nu,u2r as nv,c2r as nw,S2r as nx,_br as ny,Dbr as nz,Mwr as o,tSr as o$,n2r as o0,C2r as o1,o2r as o2,Sye as o3,M_ as o4,m2r as o5,Vbr as o6,b2r as o7,l2r as o8,REt as o9,ZEt as oA,ogn as oB,ign as oC,sgn as oD,ngn as oE,tgn as oF,UEt as oG,JEt as oH,dSr as oI,X2r as oJ,LCt as oK,$Ct as oL,Egn as oM,_gn as oN,tkt as oO,jEt as oP,zEt as oQ,jCt as oR,BCt as oS,nSr as oT,bgn as oU,fSr as oV,F2r as oW,M2r as oX,QZ as oY,qk as oZ,tRe as o_,vu as oa,xbr as ob,gbr as oc,mbr as od,Ubr as oe,SLe as of,Hbr as og,Kbr as oh,wbr as oi,e2r as oj,qhn as ok,ui as ol,egn as om,Qhn as on,dbr as oo,qmt as op,rgn as oq,W2r as or,uSr as os,QEt as ot,ekt as ou,$2r as ov,B2r as ow,Dgn as ox,mSr as oy,YEt as oz,HAt as p,Agn as p$,R2r as p0,j2r as p1,q2r as p2,mgn as p3,KEt as p4,XEt as p5,P2r as p6,D2r as p7,N2r as p8,I2r as p9,Cgn as pA,O2r as pB,Tgn as pC,M$ as pD,hye as pE,gye as pF,Pgn as pG,agn as pH,Rgn as pI,fgn as pJ,Ign as pK,ggn as pL,pSr as pM,Z2r as pN,zCt as pO,UCt as pP,qCt as pQ,VCt as pR,yye as pS,vye as pT,vgn as pU,nkt as pV,lSr as pW,rSr as pX,k2r as pY,xye as pZ,ySr as p_,rkt as pa,GEt as pb,Ogn as pc,okt as pd,xgn as pe,Q2r as pf,ZZ as pg,XI as ph,A2r as pi,ygn as pj,ikt as pk,wLe as pl,iSr as pm,qme as pn,eQ as po,rRe as pp,Y2r as pq,VEt as pr,Sgn as ps,cgn as pt,G2r as pu,ugn as pv,kgn as pw,lgn as px,oSr as py,J2r as pz,Nwr as q,cAt as q$,_Sr as q0,V2r as q1,Ngn as q2,aSr as q3,cSr as q4,wgn as q5,sSr as q6,hgn as q7,L2r as q8,z2r as q9,AEt as qA,Fbr as qB,Lbr as qC,gSr as qD,Vmt as qE,Umt as qF,Uhn as qG,H1r as qH,E2r as qI,Xhn as qJ,Zhn as qK,Khn as qL,Yhn as qM,S1r as qN,x1r as qO,b1r as qP,Vhn as qQ,zhn as qR,pbr as qS,jgn as qT,Fgn as qU,kLe as qV,ULe as qW,JLe as qX,WLe as qY,aAt as qZ,nAt as q_,WEt as qa,U2r as qb,dgn as qc,H2r as qd,eSr as qe,xLe as qf,LEt as qg,BEt as qh,$Et as qi,qEt as qj,K2r as qk,HEt as ql,pgn as qm,sA as qn,$S as qo,Jme as qp,vSr as qq,Whn as qr,Ghn as qs,hSr as qt,Jhn as qu,Hhn as qv,y1r as qw,v1r as qx,ZOe as qy,sD as qz,n0 as r,eAt as r$,$Le as r0,qLe as r1,HLe as r2,LLe as r3,BLe as r4,ILe as r5,NLe as r6,AAt as r7,eBe as r8,kye as r9,_At as rA,PAt as rB,PLe as rC,oAt as rD,ZLe as rE,tAt as rF,SAt as rG,j$ as rH,Tye as rI,YLe as rJ,QLe as rK,TAt as rL,MAt as rM,IAt as rN,Fw as rO,Eye as rP,mAt as rQ,j_ as rR,kAt as rS,Qkt as rT,OAt as rU,yAt as rV,pAt as rW,Lu as rX,OLe as rY,wye as rZ,aD as r_,mee as ra,xAt as rb,uAt as rc,zLe as rd,ALe as re,DLe as rf,tQ as rg,Mgn as rh,vAt as ri,gAt as rj,aht as rk,jAt as rl,Wme as rm,MLe as rn,jLe as ro,Jkt as rp,Vkt as rq,Kkt as rr,Hkt as rs,dAt as rt,sht as ru,VLe as rv,FLe as rw,RAt as rx,hAt as ry,Zkt as rz,XAt as s,wSr as s$,Cye as s0,iAt as s1,sAt as s2,RLe as s3,lAt as s4,ELe as s5,wAt as s6,oht as s7,gxr as s8,exr as s9,oxr as sA,qSr as sB,nRe as sC,uxr as sD,pxr as sE,KLe as sF,KSr as sG,YSr as sH,qxr as sI,nxr as sJ,bxr as sK,GSr as sL,xxr as sM,Cxr as sN,XSr as sO,Exr as sP,Lxr as sQ,Nxr as sR,VSr as sS,Axr as sT,GLe as sU,EAt as sV,rAt as sW,Kme as sX,Pxr as sY,Gme as sZ,xSr as s_,txr as sa,dxr as sb,DAt as sc,Mxr as sd,ZSr as se,QSr as sf,Oxr as sg,USr as sh,JSr as si,vxr as sj,kSr as sk,DSr as sl,jxr as sm,rxr as sn,RSr as so,zSr as sp,ESr as sq,ASr as sr,bAt as ss,Dxr as st,cxr as su,lxr as sv,Bgn as sw,FSr as sx,axr as sy,sxr as sz,inn as t,X2n as t$,Txr as t0,Xme as t1,CAt as t2,$At as t3,Fxr as t4,NAt as t5,LAt as t6,ISr as t7,OSr as t8,PSr as t9,Omt as tA,Mme as tB,dvr as tC,fvr as tD,PG as tE,aCt as tF,sCt as tG,mvr as tH,_vr as tI,bwn as tJ,Bhn as tK,$gn as tL,qgn as tM,zgn as tN,Vgn as tO,Ugn as tP,AEr as tQ,x0n as tR,w0n as tS,ovn as tT,svn as tU,avn as tV,Gbn as tW,B2n as tX,$2n as tY,LQr as tZ,W2n as t_,NSr as ta,TSr as tb,CSr as tc,kxr as td,Lgn as te,ixr as tf,$xr as tg,Ixr as th,BAt as ti,mxr as tj,Rxr as tk,XLe as tl,fxr as tm,_xr as tn,WSr as to,hxr as tp,$Sr as tq,MSr as tr,jSr as ts,LSr as tt,BSr as tu,yxr as tv,HSr as tw,wxr as tx,pvr as ty,iCt as tz,Pa as u,Y2n as u0,Z2n as u1,wSn as u2,TSn as u3,grn as u4,fwn as u5,Gd as v,bo as w,Dg as x,Pp as y,ewn as z};
1409
+ ${s.componentStack??""}`,"editor")}render(){return this.state.error?q.jsxs("div",{role:"alert","data-testid":"static-panel-crashed",style:{padding:12,display:"grid",gap:8,alignContent:"start"},children:[q.jsxs("strong",{children:[this.props.title," crashed."]}),q.jsx("span",{style:{opacity:.8,wordBreak:"break-word"},children:this.state.error.message}),q.jsx("div",{children:q.jsx(Ms,{type:"button",variant:"outline",size:"compact",onClick:()=>this.setState({error:null}),children:"Retry"})})]}):this.props.children}}const T_n=kVe.map(t=>{const n=x_n[t.kind],s=c=>q.jsx(w_n,{title:t.title,children:q.jsx(n,{...c})});return s.displayName=`StaticPanel(${t.kind})`,{...t,Content:s}});function C_n(t){return T_n.find(n=>n.kind===t)}function E_n({kind:t,dependencies:n}){const{Content:s}=C_n(t);return q.jsx(s,{dependencies:n})}const k_n=250;function A_n(){const t=R4t(),n=D_n();return()=>{n(),t()}}function D_n(){const t=new Map;let n=null,s=!1;function c(){const g=[],S=new Set;for(const k of Qs.getEntries()){if(S.add(k.id),k.level!=="error"&&k.level!=="warn")continue;const A=t.get(k.id)??0;k.count<=A||(t.set(k.id,k.count),g.push({severity:k.level,message:k.message,source:k.source??null,occurrences:k.count-A}))}for(const k of[...t.keys()])S.has(k)||t.delete(k);return g}function d(){if(n=null,s)return;const g=c();g.length!==0&&bN("console-entries",{entries:g,_clientId:xC})}const m=Qs.subscribe(()=>{if(s)return;const g=Qs.getEntries(),S=g[g.length-1];if(S&&S.level==="error"&&!t.has(S.id)){n!==null&&clearTimeout(n),n=null,queueMicrotask(d);return}n===null&&(n=setTimeout(d,k_n))});return bN("console-entries",{entries:[],_clientId:xC}),d(),()=>{s=!0,n!==null&&clearTimeout(n),m()}}const Y4={INPUT:"input",PRE_PHYSICS:"prePhysics",PHYSICS:"physics",POST_PHYSICS:"postPhysics",GAME_LOGIC:"gameLogic",ANIMATION:"animation",PRE_RENDER:"preRender",RENDER:"render"},yZ=[Y4.INPUT,Y4.PRE_PHYSICS,Y4.PHYSICS,Y4.POST_PHYSICS,Y4.GAME_LOGIC,Y4.ANIMATION,Y4.PRE_RENDER,Y4.RENDER],fwn=Object.freeze(Object.defineProperty({__proto__:null,PHASE_ORDER:yZ,SystemPhase:Y4},Symbol.toStringTag,{value:"Module"})),sye=1e-9,Ljt=1e5;function P_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>sye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=s.end-g;if(!d||S<=F+sye){const D=Math.min(g+S,s.end);m.push({from:g,to:D,direction:"forward"}),g=D;break}if(m.push({from:g,to:s.end,direction:"forward"}),S-=F,g=s.start,k=!0,A++,A>Ljt){const D=s.start+S%c;m.push({from:g,to:D,direction:"forward"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function I_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>sye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=g-s.start;if(!d||S<=F+sye){const D=Math.max(g-S,s.start);m.push({from:g,to:D,direction:"reverse"}),g=D;break}if(m.push({from:g,to:s.start,direction:"reverse"}),S-=F,g=s.end,k=!0,A++,A>Ljt){const D=s.end-S%c;m.push({from:g,to:D,direction:"reverse"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function pTt(t,n){return t<n.start?n.start:t>n.end?n.end:t}class N_n{_previousTime;_currentTime;_range;_timeScale;_playDirection="forward";_lastCrossingDirection="forward";_playbackState="stopped";_evaluators=[];_registrationCounter=0;constructor(n={}){const s=n.start??0,c=n.end??Math.max(s,1);if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);const d=n.timeScale??1;if(!Number.isFinite(d)||d<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${d}`);this._range={start:s,end:c,loop:n.loop??!1},this._timeScale=d,this._previousTime=s,this._currentTime=s}get time(){return this._currentTime}get previousTime(){return this._previousTime}get direction(){return this._playbackState==="playing"?this._playDirection:"paused"}get playbackState(){return this._playbackState}get timeScale(){return this._timeScale}set timeScale(n){if(!Number.isFinite(n)||n<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${n}`);this._timeScale=n}get range(){return this._range}setRange(n){const s=n.start??this._range.start,c=n.end??this._range.end,d=n.loop??this._range.loop;if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);this._range={start:s,end:c,loop:d};const m=pTt(this._currentTime,this._range);m!==this._currentTime&&this.seek(m)}play(n){n&&(this._playDirection=n),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="stopped"}seek(n){const s=pTt(n,this._range);if(s===this._currentTime)return this.emit(this._currentTime,this._currentTime,[{from:s,to:s,direction:this._lastCrossingDirection}],!1,this._lastCrossingDirection);const c=s>this._currentTime?"forward":"reverse",d=this._currentTime;return this._previousTime=d,this._currentTime=s,this._lastCrossingDirection=c,this.emit(d,s,[{from:d,to:s,direction:c}],!1,c)}seekFrame(n,s){if(!Number.isFinite(s)||s<=0)throw new Error(`[AnimationClock] seekFrame fps must be a finite number > 0, got ${s}`);return this.seek(this._range.start+n/s)}advance(n){if(this._playbackState!=="playing")return null;if(!Number.isFinite(n))throw new Error(`[AnimationClock] advance(dt) requires a finite dt, got ${n}`);const s=Math.abs(n)*this._timeScale,c=this._currentTime;if(s===0)return this.emit(c,c,[],!1,this._playDirection);const d=this._playDirection==="forward"?P_n(c,s,this._range):I_n(c,s,this._range);return this._previousTime=c,this._currentTime=d.pos,this._lastCrossingDirection=this._playDirection,this.emit(c,d.pos,d.intervals,d.looped,this._playDirection)}subscribe(n,s){if(!yZ.includes(n))throw new Error(`[AnimationClock] unknown phase "${n}". Valid: ${yZ.join(", ")}`);const c={phase:n,order:this._registrationCounter++,fn:s};return this._evaluators.push(c),{dispose:()=>{const d=this._evaluators.indexOf(c);d!==-1&&this._evaluators.splice(d,1)}}}emit(n,s,c,d,m){const g={previousTime:n,currentTime:s,direction:m,timeScale:this._timeScale,looped:d,intervals:c};if(this._evaluators.length>0){const S=[...this._evaluators].sort((k,A)=>{const F=yZ.indexOf(k.phase),D=yZ.indexOf(A.phase);return F!==D?F-D:k.order-A.order});for(const k of S)try{k.fn(g)}catch(A){console.error(`[AnimationClock] evaluator in phase "${k.phase}" threw:`,A)}}return g}}const v_e={start:0,end:0,fps:30},O_n=150;class dwn{constructor(n){this.store=n,this.stopStoreWatch=n.subscribe(()=>this.notify())}clock=new N_n;subjects=[];activeId=null;listeners=new Set;settleListeners=new Set;settleTimer=null;disposed=!1;cachedSnapshot=null;stopStoreWatch;attach(n){return this.subjects.push(n),this.activeId===null?this.setActiveSubject(n.id):(n.seek(this.clock.time),this.notify()),()=>{const s=this.subjects.indexOf(n);if(s<0)return;if(this.subjects.splice(s,1),this.activeId!==n.id){this.notify();return}this.activeId=null;const c=this.subjects[0];c?this.setActiveSubject(c.id):(this.clock.setRange({start:v_e.start,end:v_e.end,loop:!1}),this.notify())}}setActiveSubject(n){const s=this.subjects.find(d=>d.id===n);if(!s)return;this.activeId=n;const c=s.range();this.clock.setRange({start:c.start,end:c.end}),this.applyTime(this.clock.time),this.notify()}get active(){return this.subjects.find(n=>n.id===this.activeId)??null}fps(){return this.active?.range().fps??v_e.fps}get driver(){return this.store.playState==="stopped"?"editor":"world"}assertEditorDrives(){if(this.driver==="world")throw new Error("transport: the world is driving time (Play); pause the game to scrub")}play(n="forward"){this.assertEditorDrives(),this.active&&(this.cancelSettle(),this.clock.play(n),this.notify())}pause(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.settle(),this.notify()}stop(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.applyTime(this.clock.seek(this.clock.range.start).currentTime),this.clock.stop(),this.settle(),this.notify()}seek(n){this.assertEditorDrives(),this.applyTime(this.clock.seek(n).currentTime),this.clock.playbackState!=="playing"&&this.scheduleSettle(),this.notify()}seekFrame(n){this.seek(n/this.fps())}setLoop(n){this.clock.setRange({loop:n}),this.notify()}setTimeScale(n){this.clock.timeScale=n,this.notify()}tick(n){if(this.disposed||this.driver==="world"||this.clock.playbackState!=="playing")return 0;const s=this.clock.time,c=this.clock.advance(n);return c?(this.applyTime(c.currentTime),this.notify(),c.looped?Math.abs(n)*this.clock.timeScale:c.currentTime-s):0}applyTime(n){const s=this.active;s&&s.seek(n);for(const c of this.subjects)c!==s&&c.seek(n)}onSettled(n){return this.settleListeners.add(n),()=>{this.settleListeners.delete(n)}}scheduleSettle(){this.cancelSettle(),this.settleTimer=setTimeout(()=>{this.settleTimer=null,this.settle()},O_n)}cancelSettle(){this.settleTimer!==null&&(clearTimeout(this.settleTimer),this.settleTimer=null)}settle(){if(this.disposed)return;const n=this.clock.time;for(const s of[...this.settleListeners])s(n)}snapshot(){const n=this.cachedSnapshot;if(n)return n;const s=this.active?.range()??v_e,c={time:this.clock.time,range:{start:this.clock.range.start,end:this.clock.range.end,fps:s.fps,loop:this.clock.range.loop},playbackState:this.clock.playbackState,timeScale:this.clock.timeScale,activeSubject:this.activeId,subjects:this.subjects.map(d=>({id:d.id,label:d.label})),driver:this.driver};return this.cachedSnapshot=c,c}activeClips(){const s=this.active?.clips?.();return s&&s.length>1?s:null}setActiveClip(n){this.assertEditorDrives(),this.active?.setClip?.(n);const s=this.active?.range();s&&this.clock.setRange({start:s.start,end:s.end}),this.applyTime(this.clock.time),this.notify()}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}notify(){this.cachedSnapshot=null;for(const n of[...this.listeners])n()}dispose(){this.disposed=!0,this.stopStoreWatch(),this.cancelSettle(),this.clock.stop(),this.subjects.length=0,this.activeId=null,this.listeners.clear(),this.settleListeners.clear()}}const Dme=new Map,Wje=new Set;function _Tt(){for(const t of[...Wje])t()}function pwn(t,n){return Dme.set(t,n),_Tt(),()=>{Dme.get(t)===n&&(Dme.delete(t),_Tt())}}function R_n(t){return t===null?null:Dme.get(t)??null}function F_n(t){return Wje.add(t),()=>{Wje.delete(t)}}let Pme=null;function _wn(t){return Pme=t,()=>{Pme===t&&(Pme=null)}}function kve(){return Pme}const Bjt="__volterWorkspacePersistenceSuppressed";function $jt(){return globalThis}function qjt(t){$jt()[Bjt]=t}function M_n(){return $jt()[Bjt]===!0}function zjt(){return(See()?.immersivePlay??!1)&&!NR().play?.keepPanelsVisible}const Vjt={phase:"idle",flightDone:!1,gameReady:!1};function j_n(t,n){const s=t.flightDone||n==="flight-done",c=t.gameReady||n==="game-ready";return s&&c?{phase:"crossfade",flightDone:s,gameReady:c}:s?{phase:"holding",flightDone:s,gameReady:c}:{...t,flightDone:s,gameReady:c}}function L_n(t,n){if(n==="stop")return Vjt;switch(t.phase){case"idle":return n==="start"?{phase:"entering",flightDone:!1,gameReady:!1}:n==="start-reduced"?{phase:"playing",flightDone:!0,gameReady:!0}:t;case"entering":return j_n(t,n);case"holding":return n==="game-ready"?{...t,phase:"crossfade",gameReady:!0}:t;case"crossfade":return n==="crossfade-done"?{...t,phase:"playing"}:t;case"playing":return t}}const B_n=450,$_n=220,Ujt=250;function q_n(t){t.style.setProperty("--volter-play-dissolve-duration",`${B_n}ms`),t.style.setProperty("--volter-play-materialize-duration",`${$_n}ms`),t.style.setProperty("--volter-play-crossfade-duration",`${Ujt}ms`)}let SD=null;function z_n(t){return SD=t,typeof document<"u"&&q_n(document.documentElement),()=>{SD===t&&(SD=null)}}function Jjt(){return typeof window<"u"&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1)}let Qk=null;function V_n(){return Qk?.state.phase??"idle"}const Ime=new Set;function Wjt(){if(Ime.size===0)return;const t=[...Ime];Ime.clear();for(const n of t)n()}function U_n(t){if(!Qk||Qk.state.phase==="playing"){t();return}Ime.add(t)}function J_n(t,n,s){const c=setTimeout(()=>{t.timeouts.delete(c),s()},n);t.timeouts.add(c)}function gB(t){const n=Qk;if(!n)return;const s=n.state,c=L_n(s,t);c!==s&&(n.state=c,c.phase==="crossfade"&&s.phase!=="crossfade"&&(SD?.root.classList.add("volter-play-crossfade"),J_n(n,Ujt+30,()=>gB("crossfade-done"))),c.phase==="playing"&&s.phase!=="playing"&&(SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),n.flying&&kve()?.settle(),Wjt()))}function W_n(){H_n({immersive:zjt()})}function H_n(t){if(Qk&&lUe(),!t.immersive)return;const n=Jjt();qjt(!0);const s={state:Vjt,reducedMotion:n,flying:!1,timeouts:new Set};if(Qk=s,SD?.hideChrome(!n),n){gB("start-reduced");return}if(gB("start"),s.flying=kve()?.begin(()=>{Qk===s&&gB("flight-done")})??!1,!s.flying){gB("flight-done");return}SD?.root.classList.add("volter-play-flight")}function G_n(t,n){(!t||!n)&&lUe()}function K_n(t){const n=Qk;n&&(n.flying&&t&&kve()?.track(t),gB("game-ready"))}function lUe(){const t=Qk;if(t){Qk=null;for(const n of t.timeouts)clearTimeout(n);t.timeouts.clear(),Wjt(),SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),t.flying&&kve()?.end(),SD?.showChrome(!Jjt()),qjt(!1)}}const Hje=new Set;let Hjt=null;function Gjt(){return wf()?.rootPath??null}function X_n(t){Hje.add(t);const n=Gjt();return n!==null&&Hjt===n&&t(),()=>{Hje.delete(t)}}async function mwn(){Hjt=Gjt();for(const t of[...Hje])await t()}function Y_n(){const t=Pp();if(t===null)return null;const n=cQ(t);if(typeof n!="object"||n===null)return null;const s=n.stageMode;if(typeof s!="function")return null;const c=s.call(n);return typeof c=="string"?c:null}let Gje=null;function Z_n(t){Gje=t}function mTt(){if(!Gje)throw new Error("The workbench Output service is not connected.");return Gje}function Q_n(){aDr(Pp),a4r({output:{write:(...t)=>mTt().write(...t),show:t=>mTt().show(t)},console:{log:(t,n)=>Qs.log(t,n),warn:(t,n)=>Qs.warn(t,n),error:(t,n)=>Qs.error(t,n)},live:{register:i9t,mounted:vVe,playing:ave,runWindow:dVe,restartRequired:t9t,restart:r9t,subscribe:SVe,version:s9t,notifyChanged:e9t,snapshotFrame:_Ve,frameCanvas:pVe,authoringRefusal:yVe,dispatch:mVe,scenes:hVe,surface:sve,coverage:gVe},viewport:{transition:{begin:W_n,ready:K_n,end:lUe,onSettled:U_n,phase:V_n}},hierarchy:{subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0}},session:{beginWork:ABe,reportFacet:Grn,onSample:Fnn,onCommandDispatched:UYr,playState:()=>Ih()?.playState??"stopped",playEditRegime:()=>Ih()?.playEditRegime??null,subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0},open:()=>Ih()!==null,onEnded:t=>Lze(n=>{n!==null&&t()}),onBeforeClose:pnn,reportWorkerCallMeter:nan},project:{documentTable:zen,mounts:l$,engineVersion:()=>wf()?.config.engine.version??null,subscribe:IC,onReady:X_n},notify:t=>s$(t),systems:{inspected:Pye,subscribe:Wwr,inspectedNetworking:Xwr,subscribeNetworking:Ywr,inspectedAudio:()=>Zwr()??null,subscribeAudio:Qwr,audioVersion:eTr},availability:{subscribe:YVe,version:Lun},workspace:{showUtility:vC,openContributedDocument:t=>tA(t),open:async t=>await Yye(t.kind,Ih()??{},t)!==null,liveDocument:{id:a0,register:mtn,acquire:vtn,release:nVe,open:iq,container:htn,setContainer:gtn,releaseContainer:ytn}},documents:{activeId:Pp,active:()=>{const t=TC();return t?{id:t.descriptor.id,kind:t.descriptor.kind,title:t.title}:null},subscribe:o2,version:K1,context:cQ,waitForContext:y4t,contextChanged:YCr,captureActive:t=>{const n=Ih();return n?b9t(n,t):Promise.reject(new Error("No editor session is open to capture a document from."))}},transport:{for:t=>R_n(t),subscribe:F_n},projectLocalState:{ready:lte,read:Cve,write:Eve,projectRootPath:()=>wf()?.rootPath??null},history:{record:i6t,setDelegate:oDr,onElement:lDr,invalidate:uDr,onInvalidated:fDr,changed:sDr,elements:cDr,focusedResource:()=>{const t=TC();if(!t)return null;const n=t.descriptor.provenance?.sourcePath;if(n)return n;const s=Ih();return s?$Yr(s)??Rze(s):null},undo:()=>Ih()?.projectHistory?.undo()??Promise.resolve(!1),redo:()=>Ih()?.projectHistory?.redo()??Promise.resolve(!1),canUndo:()=>Ih()?.projectHistory?.getSnapshot().canUndo??!1,canRedo:()=>Ih()?.projectHistory?.getSnapshot().canRedo??!1,undoLabel:()=>Ih()?.projectHistory?.getSnapshot().undoLabel??null,redoLabel:()=>Ih()?.projectHistory?.getSnapshot().redoLabel??null,subscribe:t=>{const n=n6t(t),s=o_e(t),c=Ih()?.projectHistory?.subscribe(t),d=o2(t);return()=>{n(),s(),c?.(),d()}}},files:{setProvider:O4r,read:t=>Ag.read(t),readBytes:t=>Ag.readBytes(t),write:(t,n)=>Ag.write(t,n),exists:t=>Ag.exists(t),list:t=>Ag.list(t),watch:t=>Ag.watch(t)},settings:{setProvider:NEr,get:LEr,set:$Er,inspect:K4t,subscribe:t=>{const n=J4t(t),s=bee(t);return()=>{n(),s()}}},keyboard:{actions:()=>Wan().map(({id:t,scope:n})=>({id:t,scope:n})),keymaps:()=>Y4t().map(({id:t,title:n})=>({id:t,title:n,chords:nDt(t)})),activeKeymap:dR,invoke:t=>LVe(t),subscribe:t=>{const n=Gan(t),s=Kye(t),c=o_e(t),d=Ih()?.subscribe(t),m=o2(t);return()=>{n(),s(),c(),d?.(),m()}},version:()=>Han()+K1(),stage:()=>{const t=Ih();return t?{surface:Wfn(t).surface,mode:Y_n()}:{surface:null,mode:null}},bindActions:tcn,chordsFor:LBe,shortcutFor:t=>Vv(t)??null}})}let emn=0,cee=null;const Kje=new Set;function hTt(t){const n={generation:++emn,promise:t,active:!0};cee=n;for(const s of Kje)s(n);return Kje.clear(),n}function tmn(){const t=cee;return t?.active?Promise.resolve(t):new Promise(n=>Kje.add(n))}async function uUe(){for(;;){const t=await tmn();if(await t.promise,cee===t&&t.active)return}}const Kjt=16,rmn=300,nmn=1e4,Xjt="workspace";function imn(){const t=Cve(Xjt);return!t||t.version!==Kjt?null:t}function omn(t){Eve(Xjt,t)}function smn(t){const{descriptor:n}=t;if(!n.persist)return null;let s;try{s=n.persist({id:n.id,title:t.title})}catch{return null}if(s==null)return null;const c=AAr(n.id);return{kind:n.kind,id:n.id,state:s,...Object.keys(c).length>0?{presentation:c}:{}}}function amn(){const t={};let n=!1;for(const s of _Dt()){if(!s.persistKindState)continue;let c;try{c=s.persistKindState()}catch{continue}c!=null&&(t[s.kind]=c,n=!0)}return n?t:void 0}function cmn(){const t=[];for(const s of l0()){const c=smn(s);c&&t.push(c)}const n=amn();return{version:Kjt,workspace:zS(),documents:{open:t,activeId:Pp(),...n?{kinds:n}:{}}}}async function lmn(t,n,s){for(const c of pDt(n.kind))try{if(await c.restore({id:n.id,state:n.state,active:n.id===s&&!HQ(),store:t}))return!0}catch{}return!1}function gTt(t){if(!t)return!1;const n=!HQ();return SN(t,n)?!0:ftn.has(t)?(AFt(t),n&&STr(t),!0):n&&X0(t)}function umn(t,n){const s=n?.kinds??{},c=(n?.open.length??0)>0;for(const d of _Dt())if(d.beginRestore)try{d.beginRestore({state:s[d.kind],hasDocumentsToRestore:c,documentsToRestore:(n?.open??[]).map(m=>({kind:m.kind,state:m.state})),store:t})}catch{}}function fmn(t){const n=new Set;for(const s of t)for(const c of pDt(s.kind))c.prepare&&n.add(c.prepare);return Promise.all([...n].map(s=>s().catch(()=>{})))}async function dmn(t,n){const s=n?.documents;if(umn(t,s),!s||s.open.length===0){gTt(s?.activeId??null);return}await fmn(s.open);for(const c of s.open){const d=c.presentation;d&&typeof d=="object"&&!Array.isArray(d)&&DAr(c.id,d),await lmn(t,c,s.activeId)}gTt(s.activeId)}function Yjt(t){if(!lte()||wf()&&!u0()){let se=!1,pe=null,ue=()=>{};const Ce=new Promise(Pe=>{ue=Pe}),De=hTt(Ce);return Promise.all([cte(),Qze()]).then(()=>{if(se){ue();return}pe=Yjt(t),De.active=!1,uUe().finally(ue)}),()=>{se=!0,pe?.()}}const n=imn();n?.workspace&&kB(n.workspace)&&Uk(n.workspace)?a2(n.workspace):(n?.workspace&&Ikr(n.workspace),a2(pR(),{provisional:!0}));let s=!1,c=null;const d=[],m=()=>{c!==null&&(clearTimeout(c),c=null),!(M_n()||t.playState!==void 0&&t.playState!=="stopped")&&omn(cmn())},g=()=>{c!==null&&clearTimeout(c),c=setTimeout(m,rmn)},S=()=>m();let k=null;const A=typeof window<"u"&&aCt(window.location.href)!==null,F=A||!(n?.documents?.open.length??0)?Promise.resolve():mN().catch(()=>{}),D=F.then(()=>A?void 0:dmn(t,n)).catch(()=>{}),J=new Promise(se=>{F.then(()=>{s||(k=setTimeout(()=>{se()},nmn))})}),$=Promise.race([D,J]).then(()=>{k!==null&&clearTimeout(k),!s&&(d.push(o2(g)),d.push(OAr(g)),window.addEventListener("pagehide",S))}),G=hTt($);return()=>{s=!0,G.active=!1,cee===G&&(cee=null),k!==null&&clearTimeout(k);for(const se of d)se();window.removeEventListener("pagehide",S),c!==null&&m()}}function pmn(t){Ye.useEffect(()=>{const n=aCt(window.location.href);if(!n)return;let s=!1;const c=Em(),d=()=>!s&&Em()===c;return uUe().then(()=>{if(d())return Vge(t,n,{updateUrl:!1,origin:"link"})}).catch(m=>{Qs.error(`Could not restore shared editor view: ${m instanceof Error?m.message:String(m)}`,"editor")}),()=>{s=!0}},[t])}const yTt="volter:stale-chunk-reload";function _mn(){typeof window>"u"||window.addEventListener("vite:preloadError",t=>{let n=0;try{n=Number(sessionStorage.getItem(yTt)??0)}catch{}if(!(Date.now()-n<6e4)){try{sessionStorage.setItem(yTt,String(Date.now()))}catch{}t.preventDefault(),window.location.reload()}})}const jI=[];function mmn(t){const n=jI.findIndex(s=>s.owner===t.owner&&s.id===t.id);return n>=0&&jI.splice(n,1),jI.push(t),jI.sort((s,c)=>(s.order??0)-(c.order??0)),()=>{const s=jI.indexOf(t);s>=0&&jI.splice(s,1)}}function hwn(t,n,s){const c=new Map,d={surface:t,store:n},m=g=>{const S=s(g);if(!S)return null;for(const k of jI){const A=k.statesFor(S,d);if(A.length>0)return{source:k,states:A}}return null};return{storiesFor:g=>[...m(g)?.states??[]],active:g=>c.get(g)??null,apply:(g,S)=>{if(S===null){c.delete(g),n.notifyIngestEdit();return}const k=m(g);if(!k?.states.some(F=>F.id===S)){Qs.warn(`[component-states] stories.apply: state "${S}" does not belong to node "${g}" on the ${t} surface — ignoring.`,"authoring");return}const A=s(g);A&&(c.set(g,S),k.source.apply(A,S,d),n.notifyIngestEdit())},unavailable:()=>jI.length>0?null:"No package in this editor registered a source of component states, so this component's named states could not be read."}}class gwn extends Error{name="StoryMediumMismatch"}function ywn(t){return t instanceof Error&&t.name==="StoryMediumMismatch"}const Nme=new Map;function vwn(t,n){return Nme.set(t,n),()=>{Nme.get(t)===n&&Nme.delete(t)}}function hmn(t){return Nme.get(t)??null}function gmn(t,n){const s=[];for(const c of Object.keys(n).sort())s.push(`${c}=${ymn(n[c])}`);return`${t}|${s.join("&")}`}function ymn(t){if(typeof t=="function")return"fn";if(typeof t=="symbol")return"symbol";if(t===void 0)return"undefined";try{return JSON.stringify(t)??"undefined"}catch{return`[${typeof t}]`}}const aye=new Map,b_e=new Map,vTt=new WeakMap;let bTt=Promise.resolve(),STt=null,vmn=1;function bmn(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}async function Smn(){await Promise.race([jye(),new Promise(t=>setTimeout(t,5e3))]),await Promise.race([new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t()))),new Promise(t=>setTimeout(t,250))]),await new Promise(t=>setTimeout(t,750)),await new Promise(t=>{const n=globalThis.requestIdleCallback;if(typeof n=="function"){n(()=>t(),{timeout:2e3});return}setTimeout(t,0)})}function xmn(){return STt??=Smn(),STt}function wmn(t){const n=vTt.get(t);if(n!==void 0)return n;const s=vmn++;return vTt.set(t,s),s}function Tmn(t,n,s,c){const d=aye.get(t);if(d)return Promise.resolve(d);const m=b_e.get(t);if(m)return m;const g=bTt.then(async()=>{await xmn();const S=s.parameters.layout,k=S==="fullscreen"||S==="padded"||S==="centered"?S:"padded",A={...c,props:s.args,layout:k},F=hmn(n==="canvas"?"canvas":"three");if(!F)throw new Error(`No ${n} story capture is registered.`);return F(s.Component,A)});return bTt=g.then(()=>{},()=>{}),b_e.set(t,g),g.then(S=>{aye.set(t,S),b_e.delete(t)},()=>b_e.delete(t)),g}function Cmn({component:t,story:n,previewRevision:s,width:c=128,height:d=96}){const m=n.Component,g=`${t.surface}:${t.path}:${gmn(n.id,n.args)}:${wmn(m)}:${s}:${c}x${d}`,[S,k]=Ye.useState(()=>aye.get(g)),[A,F]=Ye.useState(!1);return Ye.useEffect(()=>{let D=!1;if(F(!1),k(aye.get(g)),!!bmn())return Tmn(g,t.surface,n,{width:c,height:d}).then(J=>{D||k(J)},()=>{D||F(!0)}),()=>{D=!0}},[t.surface,d,g,n,c]),S?q.jsx("img",{src:S,alt:`${t.name} preview`,className:"volter-component-thumbnail"}):q.jsx("span",{className:"volter-component-thumbnail-fallback","data-component-preview":A?"failed":"capturing-story",children:q.jsx(wR,{kind:"component",name:t.name})})}const Ave="story:three",Dve="story:isolated",Emn="story:docs";function kmn(t,n){return t.surface==="dom"?!1:n===null||t.surface===n}function Amn({entry:t,previewRevision:n,width:s,height:c}){const d=t.detail;return q.jsx(Cmn,{component:t.component,story:d,previewRevision:n,...s===void 0?{}:{width:s},...c===void 0?{}:{height:c}})}const Dmn="story",Pmn={id:Dmn,owner:"./component-content-source",entries(t){const n=rq(),s=[];for(const c of t.components){if(!kmn(c,t.surface))continue;const d=CRt(n,c.name,c.path);d&&s.push({id:`${c.path}:${c.name}`,component:c,detail:d})}return s},subscribe:G0e,Thumbnail:Amn,open(t,n,s){const c=n.detail,d=n.component.surface==="three";CD(d?Ave:Dve,t,d?{modulePath:c.modulePath,storyName:c.name,title:s}:{modulePath:c.modulePath,storyName:c.name})}};function xTt(t){return vYr(t.name,t.sourcePath)}const Imn={id:"portable-csf",owner:"./component-states",statesFor:(t,n)=>n.surface==="dom"?[]:xTt(t).map(s=>({id:s.id,label:s.label})),apply:(t,n,s)=>{const c=xTt(t).find(d=>d.id===n);if(c){if(s.surface==="three"){CD(Ave,s.store,{modulePath:c.modulePath,storyName:c.name,title:c.label});return}if(s.surface==="canvas"){CD(Dve,s.store,{modulePath:c.modulePath,storyName:c.name});return}Qs.warn(`[portable-csf] no story document is registered for the "${s.surface}" surface, so state "${n}" of "${t.name}" could not be opened.`,"authoring")}}};function Nmn(){let t=0,n=!1;const s=S=>{const k=++t;dYr(),jye().then(()=>{if(!(n||k!==t))return wYr(wf(),void 0,{deferUndeclared:!0,...S?{changedPaths:S}:{}})})};s();let c=null;const d=CFt(),m=IC(()=>s()),g=_en(s);return()=>{n=!0,t+=1,c!==null&&clearTimeout(c),d(),m(),g()}}const Zjt="story",MOe=new Set,jOe=new Set;function Omn(t){const n=vRt({modulePath:t.modulePath,title:t.title}).leaf;return n===t.label?n:`${n} · ${t.label}`}function LOe(t){for(const n of rq())if(n.ok){for(const s of n.stories)if(t.storyId===void 0?n.modulePath===t.modulePath&&s.name===t.storyName:s.id===t.storyId)return{modulePath:n.modulePath,storyName:s.name,title:t.title??Omn({modulePath:n.modulePath,title:s.title,label:s.label})}}return null}function Rmn(t,n,s){const c={modulePath:s.modulePath,storyName:s.storyName,title:s.title,...n.activate===void 0?{}:{activate:n.activate}};if(n.mode==="docs")return CD(Emn,t,c);const d=Pze({modulePath:s.modulePath,regions:Dze()});return d.medium===void 0?(fYr(s.modulePath,d.reason),null):CD(d.medium==="three"?Ave:Dve,t,c)}function wTt(t){Qs.warn(`No composed portable story carries the id ${JSON.stringify(t)}, so nothing opened it.`,"editor")}function Fmn(){return kN({id:Zjt,owner:"./story-opener",open:(t,n)=>{const s=LOe(n);return s?Rmn(t,n,s):(n.modulePath?MOe.add(n.modulePath):n.storyId!==void 0&&(jOe.add(n.storyId),hYr()&&wTt(n.storyId)),null)},settle:async()=>{await MDr();const t=[...MOe],n=[...jOe];if(MOe.clear(),jOe.clear(),await Promise.all(t.map(s=>bYr(wf(),s))),n.length!==0){await gYr();for(const s of n)LOe({storyId:s})||wTt(s)}},ready:async(t,n)=>{if(n.mode==="docs")return;const s=LOe(n);if(!(!s||Pze({modulePath:s.modulePath,regions:Dze()}).medium!=="three")&&!await CC(()=>s2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}})}const Mmn={actions:()=>{if(!ogt(Dve)&&!ogt(Ave))return[];const t=[];for(const n of rq()){if(!n.ok)continue;const s=n.modulePath.split("/").pop()??n.modulePath;for(const c of n.stories)t.push({id:`story:${c.id}`,label:`Open Story: ${c.name} — ${s}`,execute:()=>void n0().workspace.open({kind:Zjt,modulePath:n.modulePath,storyName:c.name,title:c.name})})}return t},subscribe:t=>G0e(t)};function jmn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.azimuthDegrees!="number"||!Number.isFinite(s.azimuthDegrees)||typeof s.elevationDegrees!="number"||!Number.isFinite(s.elevationDegrees)||s.elevationDegrees<-90||s.elevationDegrees>90||s.distance!==void 0&&(typeof s.distance!="number"||!Number.isFinite(s.distance)||s.distance<=0)?`${t} camera must be {azimuthDegrees, elevationDegrees in [-90, 90], distance? > 0 meters}.`:{azimuthDegrees:s.azimuthDegrees,elevationDegrees:s.elevationDegrees,...s.distance===void 0?{}:{distance:s.distance}}}function Lmn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.clip!="string"||s.clip.length===0||typeof s.timeSeconds!="number"||!Number.isFinite(s.timeSeconds)||s.timeSeconds<0?`${t} pose must be {clip: non-empty string, timeSeconds >= 0}.`:{clip:s.clip,timeSeconds:s.timeSeconds}}const Bmn="packages/editor-core/src/stories/story-capture-command.ts",nB="capture-story-variants";async function $mn(t){if(document.visibilityState==="hidden")return{ok:!1,error:"story capture needs a PRESENTING tab — the editor tab is hidden, so the browser suspends the frames a story mount must paint. Bring the editor tab to the foreground (or unminimize its window) and re-run."};const n=t.modulePath;if(typeof n!="string"||n==="")return{ok:!1,error:`${nB} requires a project-relative modulePath.`};const s=t.story;if(s!==void 0&&typeof s!="string")return{ok:!1,error:`${nB} story must be a CSF export name.`};const c=(d,m,g)=>{if(d===void 0)return m;if(typeof d!="number"||!Number.isInteger(d)||d<64||d>1024)throw new Error(`${nB} ${g} must be an integer from 64 to 1024.`);return d};try{const d=await(async()=>{try{const D=await LZr("volter.project.json");if(!D)return null;const J=JSON.parse(D),$=J.resolution?.width,G=J.resolution?.height;return typeof $!="number"||typeof G!="number"||$<64||G<64||$>4096||G>4096?null:{width:Math.min(1024,Math.round($)),height:Math.min(1024,Math.round(G))}}catch{return null}})(),m=c(t.width,d?.width??960,"width"),g=c(t.height,d?.height??540,"height"),S=jmn(nB,t.camera);if(typeof S=="string")return{ok:!1,error:S};const k=Lmn(nB,t.pose);if(typeof k=="string")return{ok:!1,error:k};const{captureProjectStoryVariants:A}=await lo(async()=>{const{captureProjectStoryVariants:D}=await import("./story-capture-DAZ6UX6l.js");return{captureProjectStoryVariants:D}},__vite__mapDeps([267,268,1,2,3,4,20,21,233,212,269,22,23]));return{ok:!0,data:{...await A(wf(),{modulePath:n,...s===void 0?{}:{story:s},width:m,height:g,...S?{camera:S}:{},...k?{pose:k}:{}})}}}catch(d){return{ok:!1,error:d instanceof Error?d.message:String(d)}}}const qmn={[nB]:{timeoutMs:12e4,derivedRefresh:"if-content-changed",handle:$mn}};function zmn(){const t=kin(Pmn),n=mmn(Imn),s=Fmn(),c=mCt(Mmn),d=gCt(Bmn,qmn),m=Nmn(),g=G0e(()=>{BB()});return()=>{g(),m(),d(),c(),s(),n(),t()}}const Vmn=[["descriptionForeground","--volter-content-dim"],["disabledForeground","--volter-content-placeholder"],["errorForeground","--volter-danger"],["focusBorder","--volter-accent"],["selection.background","--volter-accent","99"],["sash.hoverBorder","--volter-accent"],["menubar.selectionBackground","--volter-accent"],["menubar.selectionForeground","--volter-content-on-accent"],["menu.selectionBackground","--volter-accent"],["menu.selectionForeground","--volter-content-on-accent"],["editorGroupHeader.tabsBackground","--volter-surface-chrome"],["editorGroup.dropBackground","--volter-accent","66"],["tab.inactiveBackground","--volter-surface-chrome"],["tab.inactiveForeground","--volter-content-dim"],["editor.background","--volter-surface-chrome"],["editorLineNumber.foreground","--volter-content-placeholder"],["editor.selectionBackground","--volter-accent","99"],["editorGutter.background","--volter-surface-chrome"],["panelTitle.inactiveForeground","--volter-content-dim"],["list.activeSelectionBackground","--volter-accent"],["list.activeSelectionForeground","--volter-content-on-accent"],["list.focusOutline","--volter-accent"],["list.dropBackground","--volter-accent","66"],["button.background","--volter-accent"],["button.foreground","--volter-content-on-accent"],["checkbox.selectBackground","--volter-accent"],["input.background","--volter-surface-chrome"],["input.placeholderForeground","--volter-content-placeholder"],["inputOption.activeBackground","--volter-accent"],["inputOption.activeForeground","--volter-content-on-accent"],["inputValidation.errorBorder","--volter-danger"],["badge.background","--volter-accent"],["badge.foreground","--volter-content-on-accent"],["progressBar.background","--volter-accent"],["quickInputList.focusBackground","--volter-accent"],["quickInputList.focusForeground","--volter-content-on-accent"],["notificationsErrorIcon.foreground","--volter-danger"],["notificationsWarningIcon.foreground","--volter-warn"],["notificationsInfoIcon.foreground","--volter-accent"],["terminal.background","--volter-surface-chrome"],["commandCenter.background","--volter-surface-chrome"],["volter.view.background","--volter-surface-panel"],["foreground","--volter-content-primary"],["icon.foreground","--volter-content-muted"],["widget.border","--volter-boundary-default"],["titleBar.activeBackground","--volter-surface-shell"],["titleBar.inactiveBackground","--volter-surface-shell"],["titleBar.activeForeground","--volter-content-muted"],["titleBar.border","--volter-surface-shell"],["activityBar.background","--volter-surface-shell"],["activityBar.foreground","--volter-content-primary"],["activityBar.inactiveForeground","--volter-content-dim"],["activityBar.border","--volter-surface-shell"],["activityBar.activeBorder","--volter-accent"],["statusBar.background","--volter-surface-shell"],["statusBar.foreground","--volter-content-muted"],["statusBar.border","--volter-surface-shell"],["sideBar.background","--volter-surface-panel"],["sideBar.foreground","--volter-content-primary"],["sideBar.border","--volter-boundary-default"],["sideBarSectionHeader.background","--volter-surface-chrome"],["panel.background","--volter-surface-panel"],["panel.border","--volter-boundary-default"],["editorGroup.border","--volter-boundary-default"],["editorGroupHeader.tabsBorder","--volter-boundary-default"],["tab.activeBackground","--volter-surface-panel"],["tab.activeForeground","--volter-content-primary"],["tab.border","--volter-boundary-default"],["menu.background","--volter-widget-menu"],["menu.foreground","--volter-content-menu"],["menu.border","--volter-boundary-default"],["dropdown.background","--volter-widget-menu"],["dropdown.border","--volter-boundary-default"],["input.foreground","--volter-content-primary"],["input.border","--volter-boundary-default"]],Umn=[["volter.viewport.background","--volter-viewport-background"],["volter.viewport.grid","--volter-viewport-grid"],["volter.viewport.axisX","--volter-viewport-axis-x"],["volter.viewport.axisY","--volter-viewport-axis-y"],["volter.viewport.axisZ","--volter-viewport-axis-z"],["volter.viewport.selection","--volter-viewport-selection"],["volter.viewport.active","--volter-viewport-active"],["volter.viewport.wire","--volter-viewport-wire"],["volter.gizmo.x","--volter-gizmo-x"],["volter.gizmo.y","--volter-gizmo-y"],["volter.gizmo.z","--volter-gizmo-z"],["volter.gizmo.navigationX","--volter-gizmo-navigation-x"],["volter.gizmo.navigationY","--volter-gizmo-navigation-y"],["volter.gizmo.navigationZ","--volter-gizmo-navigation-z"],["volter.gizmo.hover","--volter-gizmo-hover"],["volter.gizmo.drag","--volter-gizmo-drag"]];function TTt(t){const n=t.trim().toLowerCase(),s=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(n)?.[1];if(s)return`#${s.length===3?[...s].map(S=>S+S).join(""):s}`;const c=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/.exec(n);if(!c)return null;const d=S=>Math.max(0,Math.min(255,Math.round(Number(S)))).toString(16).padStart(2,"0"),m=c[4],g=m===void 0?"":Math.round(Math.max(0,Math.min(1,m.endsWith("%")?Number.parseFloat(m)/100:Number(m)))*255).toString(16).padStart(2,"0");return`#${d(c[1])}${d(c[2])}${d(c[3])}${g==="ff"?"":g}`}function Jmn(t){const n=getComputedStyle(t),s={};for(const[c,d,m]of Vmn){const g=TTt(n.getPropertyValue(d));g!==null&&(g.length===9&&!m||(s[c]=m&&g.length===7?`${g}${m}`:g))}for(const[c,d]of Umn){const m=TTt(n.getPropertyValue(d));m!==null&&(s[c]=m)}return s}let xm=null,Qjt=0;const Xje=new Set;function Wmn(t){return Xje.add(t),()=>Xje.delete(t)}function CTt(){return Qjt}const BOe=new Map;function eLt(t,n){BOe.get(t)?.disconnect(),BOe.delete(t);const s=()=>{const d=n?.isConnected?n.getBoundingClientRect():null;QAr(t,d!==null&&d.width>0&&d.height>0)};if(s(),n===null||typeof ResizeObserver>"u")return;const c=new ResizeObserver(s);c.observe(n),BOe.set(t,c)}function Hmn(t,n){if(xm){if(n===null){if(xm[t]?.isConnected)return}else if(xm[t]===n)return;if(n===null&&(t==="outliner"||t==="properties"||t==="content")){const s={...xm};delete s[t],xm=s}else n!==null&&(xm={...xm,[t]:n});n!==null&&tLt(t,n),eLt(t,n),Qjt+=1;for(const s of Xje)s()}}function tLt(t,n){n.dataset.volterPart=t}const HO=new Map;let rLt=0;const Yje=new Set,nLt=new Set;let ETt=!1;function kTt(){for(const t of l0())nLt.add(t.descriptor.id)}function Gmn(t){ETt||(ETt=!0,o2(kTt)),kTt(),!(!t||nLt.has(t))&&(Etn(t)||AFt(t,!1))}function Kmn(t,n){if(n){if(!HO.delete(t.id))return}else{HO.has(t.id)||Gmn(t.documentId);const s=HO.get(t.id);if(s?.element===t.element&&s.documentId===t.documentId)return;HO.set(t.id,{...t})}rLt+=1;for(const s of[...Yje])s()}function Xmn(t){return Yje.add(t),()=>{Yje.delete(t)}}function ATt(){return rLt}function GO({children:t,row:n=!1,center:s=!1}){return q.jsx("div",{className:"volter-editor-shell volter-part",onWheel:c=>c.stopPropagation(),"data-editor-hotkey-scope":"workspace","data-editor-hotkey-fallback":!0,style:{display:"flex",flexDirection:n?"row":"column",justifyContent:s?"center":void 0,width:"100%",height:"100%",minHeight:0,minWidth:0,position:"relative",fontFamily:"var(--volter-font-sans)",fontSize:"var(--volter-font-base)",color:"var(--volter-content-primary)"},children:t})}function Ymn({children:t}){return q.jsx(q.Fragment,{children:t})}function Zmn(){return xm?r2.createPortal(q.jsx(GO,{center:!0,children:q.jsx(npn,{})}),xm.header):null}function Qmn(){return null}function ehn(){const t=Ye.useRef(null);return Ye.useEffect(()=>{const n=t.current;if(n)return vjt(n),()=>pfn(n)},[]),q.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[q.jsx("div",{ref:t,className:"volter-vscode-outliner-header",style:{padding:"var(--volter-space-2) var(--volter-space-4)","--volter-hierarchy-search-basis":"100%"}}),q.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:q.jsx(kjt,{})})]})}const Ome=new Map,Zje=new Set;let Qje=0;function thn(t,n){if(n){if(Ome.get(t)===n)return;n.dataset.volterUtility=t,Ome.set(t,n)}else if(!Ome.delete(t))return;Qje++;for(const s of Zje)s()}const Rme=new Map,eLe=new Set;let tLe=0;function rhn(t,n){if(n){if(Rme.get(t)===n)return;Rme.set(t,n)}else if(!Rme.delete(t))return;tLe++;for(const s of eLe)s()}function nhn(){return Ye.useSyncExternalStore(D3t,hht,hht),Ye.useSyncExternalStore(t=>(eLe.add(t),()=>eLe.delete(t)),()=>tLe,()=>tLe),q.jsx(q.Fragment,{children:[...hRe("left"),...hRe("right")].map(t=>{const n=Rme.get(t.id);if(!n)return null;const s=t.Content;return q.jsx(Ye.Fragment,{children:r2.createPortal(q.jsx(s,{}),n)},t.id)})})}function ihn(){return Ye.useSyncExternalStore(Xye,bhe,bhe),Ye.useSyncExternalStore(t=>(Zje.add(t),()=>Zje.delete(t)),()=>Qje,()=>Qje),q.jsx(q.Fragment,{children:bC().map(t=>{const n=Ome.get(t.id);return n?q.jsx(Ye.Fragment,{children:r2.createPortal(q.jsx(GO,{children:q.jsx(spn,{utility:t})}),n)},t.id):null})})}function ohn({descriptor:t,viewId:n,slot:s,parking:c,visible:d,inspector:m}){const[g]=Ye.useState(()=>document.createElement("div"));return Ye.useLayoutEffect(()=>{g.className="volter-vscode-document-slot",g.dataset.volterDocument=t.id,g.dataset.volterArea=t.area??"",g.style.cssText=`display:${d?"flex":"none"};flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;position:relative;`},[g,t.id,t.area,d]),Ye.useLayoutEffect(()=>((s??c).appendChild(g),()=>g.remove()),[g,s,c]),r2.createPortal(q.jsxs(GO,{children:[q.jsx(VMt,{descriptor:t,viewId:n,active:d,chrome:!t.area}),m&&q.jsx(Hun,{})]}),g)}let iLt=!0;function shn({arrangement:t,immersivePlay:n}){const s=Yv();pmn(s);const c=WVe(s);Ye.useLayoutEffect(()=>{iLt=c.column},[c.column]);const d=HO.get(CRe()??"")?.element??xm?.center;Ye.useLayoutEffect(()=>{if(!d)return;const F=()=>Pwt({x:0,y:0,width:d.clientWidth,height:d.clientHeight}),D=new ResizeObserver(F);return D.observe(d),F(),()=>{D.disconnect(),Pwt(null)}},[d]),Ye.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),Ye.useSyncExternalStore(o2,K1,K1),Ye.useSyncExternalStore(Xmn,ATt,ATt),Ye.useSyncExternalStore(Wmn,CTt,CTt),Ye.useLayoutEffect(()=>{const F=okr({...t?{arrangement:t}:{},...n===void 0?{}:{immersivePlay:n},playUtilities:[]});return t&&a2(t.id),Rkr(),F},[t,n]);const m=s.playState!=="stopped",g=Ye.useSyncExternalStore(bee,NR).play?.keepPanelsVisible;if(Ye.useEffect(()=>{G_n(m,zjt())},[m,n,g]),Ye.useEffect(()=>Yjt(s),[s]),!xm)return null;const S=xm.center,k=l0(),A=TC()??k[0]??null;return globalThis.__volterBridge={documents:k.map(F=>F.descriptor.id),active:A?.descriptor.id??null,workspace:t?.id??null,areas:k.flatMap(F=>F.descriptor.area?[{id:F.descriptor.id,area:F.descriptor.area}]:[]),slots:[...HO.values()].map(({id:F,documentId:D,element:J})=>({id:F,documentId:D,visible:!!J}))},q.jsxs(q.Fragment,{children:[[...HO.values()].map(F=>{const D=k.find(J=>J.descriptor.id===F.documentId)?.descriptor;return D?q.jsx(ohn,{descriptor:D,viewId:F.id,slot:F.element??void 0,parking:S,visible:!!F.element,inspector:c.card&&D.id===A?.descriptor.id},F.id):null}),k.length===0&&r2.createPortal(q.jsx(GO,{children:q.jsx("div",{className:"volter-vscode-empty",children:"No document open"})}),xm.center),xm.outliner&&r2.createPortal(q.jsx(GO,{children:q.jsx(ehn,{})}),xm.outliner),xm.properties&&r2.createPortal(q.jsx(GO,{children:c.column?q.jsx(ZVe,{}):q.jsx($un,{surface:c.surface})}),xm.properties),xm.content&&r2.createPortal(q.jsx(GO,{children:q.jsx(E_n,{kind:"assets"})}),xm.content),q.jsx(ihn,{}),q.jsx(nhn,{})]})}async function ahn(t,n={}){xm=t,n.workspaceStorage&&t3r(n.workspaceStorage),l3r();for(const[De,Pe]of Object.entries(t))Pe&&tLt(De,Pe),eLt(De,Pe??null);t.chromeRoot.id="editor-chrome-root",OPt({Frame:Ymn,Header:Zmn,Footer:Qmn,Workspace:shn,Document:jcn}),A_n(),Wnn();const s=Hln();s&&Jln(s,Date.now())&&Qs.warn(Vln(s,Date.now()),"editor"),_mn(),ODr(),Q_n(),zmn(),await Promise.all([G4t(),sAr(),rPt()]),SAr(t.chromeRoot),t.chromeRoot.classList.toggle("volter-native-menus",lee()?.nativeMenus===!0);const c=document.createElement("div");c.id="editor-root",c.className="volter-part",c.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:10;",t.chromeRoot.appendChild(c),rLe.createRoot(c).render(q.jsx(uun,{}));const d={activeKeymap:()=>n0().keyboard.activeKeymap(),invoke:De=>n0().keyboard.invoke(De),subscribe:De=>n0().keyboard.subscribe(De),facts:()=>{const De=n0(),Pe=De.keyboard.stage();return{surface:Pe.surface,mode:Pe.mode,documentKind:De.documents.active()?.kind??null,play:De.session.playState()}},report:(De,Pe)=>{const be=n0();De==="error"?be.console.error(Pe,"editor"):be.console.warn(Pe,"editor")}};let m=!1;const g={whenRestored:uUe,activeSource:()=>{const De=n0().documents.active();if(!De)return null;const Pe=De.kind==="model"&&De.id.startsWith("model:")?De.id.slice(6):"";return{kind:De.kind,path:Pe}},list:()=>l0().map(De=>{const Pe=De.descriptor.area?Ekr().find(be=>be.id===De.descriptor.area):void 0;return{id:De.descriptor.id,title:De.title,...Pe?{area:{id:Pe.id,place:Pe.place,ratio:Pe.ratio}}:{}}}),activeId:()=>TC()?.descriptor.id??null,subscribe:De=>{m=!0;const Pe=o2(De),be=kkr(De);return()=>{Pe(),be()}},activate:(De,Pe)=>{!m&&HQ()||(Pe?vTr(De,Pe):X0(De))},close:De=>{if(EN(De))return;const Pe=l0().find(be=>be.descriptor.id===De);Pe&&d.report("warn",`“${Pe.title}” has unsaved changes, so it stayed open. Save it (⌘S) and close it again.`)},setView:(De,Pe)=>Kmn(De,Pe)},S={elements:()=>n0().history.elements(),onElement:De=>n0().history.onElement(De),onInvalidated:De=>n0().history.onInvalidated(De),changed:()=>n0().history.changed(),focusedResource:()=>n0().history.focusedResource(),focusedDocument:()=>{const De=n0().documents.active();return De?{id:De.id,label:De.title}:null},setDelegate:De=>n0().history.setDelegate(De),report:d.report},k={setProvider:De=>n0().files.setProvider(De),report:d.report},A={setProvider:De=>n0().settings.setProvider(De),adapterValues:()=>[...REr()],workbenchValues:()=>{const De=xm?.chromeRoot;if(!De)return[];const Pe=getComputedStyle(De).getPropertyValue("--volter-command-bar-height").trim(),be=Number.parseFloat(Pe),X=["workbench.colorCustomizations",Jmn(De)];return!Number.isFinite(be)||be<=0?[X]:[["window.titleBarHeight",Math.round(be)],X]},lookId:()=>DN(),notify:De=>{n0().notify(De)},subscribe:De=>{const Pe=Hye(De),be=ADt(De);return()=>{Pe(),be()}},report:d.report},F={list:()=>Knn().map(De=>({id:De.id,label:De.label,category:De.category,...De.menu?{menu:De.menu}:{}})),invoke:De=>Ynn(De),subscribe:De=>Xnn(De),setPaletteOpener:De=>Gnn(De),setCommandExecutor:De=>Znn(De),report:d.report},D={setDelegate:De=>QCr(De?{show:Pe=>De({...Pe,source:c3r()})}:null)},J={list:()=>MPt().map(De=>({view:De.view,title:De.title,verbs:De.verbs.map(Pe=>({id:Pe.id,...Pe.title?{title:Pe.title}:{}}))})),invoke:(De,Pe,be)=>LPt(De,Pe,be),subscribe:De=>jPt(De)},$={list:()=>bC().map((De,Pe)=>({id:De.id,title:De.title,order:De.order??Pe})),subscribe:De=>{let Pe=bhe();const be=Xye(De),X=YVe(()=>{const we=bhe();we!==Pe&&(Pe=we,De())});return()=>{be(),X()}},offerBody:(De,Pe)=>thn(De,Pe)};let G=!0,se=null,pe=null;vrn(()=>G);const ue={setActiveStaticPanel:De=>tgt(kVe.find(Pe=>Pe.kind===De)?.kind??null),focusCompactInspector:()=>{if(iLt)return!1;const De=xm?.center.querySelector('[data-testid="compact-inspector-card"]');return De?(De.tabIndex=-1,De.focus(),tgt("inspector"),!0):!1},setPaneActive:De=>{G!==De&&(G=De)},setImmersive:De=>{se?.(),se=null,!(!De||!xm)&&(se=z_n({root:xm.chromeRoot,hideChrome:()=>De.enter(),showChrome:()=>De.exit()}))},setDockCommands:De=>{pe?.(),pe=null,De&&(pe=ckr({showUtility:Pe=>De.showUtility(Pe),toggleUtility:Pe=>De.toggleUtility(Pe),ensureUtility:Pe=>De.ensureUtility(Pe),closeUtility:Pe=>De.closeUtility(Pe),showStaticPanel:Pe=>De.showStaticPanel(Pe),setFocus:Pe=>De.setFocus(Pe),toggleFocus:()=>De.toggleFocus(),captureUtilities:Pe=>{for(const be of Pe)De.showUtility(be);return()=>{for(const be of Pe)De.closeUtility(be)}},showAuxiliary:()=>ue.report("warn","Undo history has no panel under the VS Code frame: the stack is the workbench's own (U4), reached through Edit → Undo/Redo and the Timeline.")}))},report:(De,Pe)=>d.report(De,Pe)};return{host:c,keyboard:d,documents:g,history:S,files:k,commands:F,notifications:D,views:J,utilities:$,output:{setProvider:Z_n},settings:A,status:{list:()=>["left","right"].flatMap(De=>hRe(De).map((Pe,be)=>({id:Pe.id,title:Pe.name,align:De,order:Pe.order??be}))),subscribe:De=>D3t(De),offerBody:(De,Pe)=>rhn(De,Pe)},game:ue,offerPart:Hmn}}function chn(t){const n=Object.keys(t.packages);return p0r({id:t.id,packages:n,look:t.look,workspace:t.workspace,nativeMenus:t.nativeMenus,logo:t.logo}),LDt(n.flatMap(s=>t.packages[s]??[])),{mountVolter:ahn}}const{mountVolter:bwn}=chn({id:"game-editor",packages:{"@volter/editor-game":l0r,"@volter/editor-react":u0r,"@volter/editor-threejs":f0r,"@volter/editor-xstate":d0r,"@volter/editor-blender":c0r},look:"classic",workspace:"game",logo:"https://brand.volter.ai/logo/volter-game-editor/svg",nativeMenus:!0});export{Jl as $,v3t as A,p0n as B,b3t as C,S3t as D,F_e as E,N0n as F,TAr as G,cRe as H,Cen as I,pFt as J,DB as K,u0 as L,OC as M,y3t as N,tVe as O,h3t as P,pSn as Q,x3t as R,jwr as S,L2n as T,Yv as U,Ih as V,nBe as W,YXr as X,nvn as Y,Qs as Z,lo as _,XY as a,h2n as a$,GFt as a0,Xtn as a1,ZFt as a2,L_ as a3,CN as a4,CSn as a5,Ms as a6,dc as a7,Kk as a8,ivn as a9,hRt as aA,Utn as aB,wf as aC,Y0 as aD,mp as aE,z0n as aF,hy as aG,oq as aH,mMt as aI,V3r as aJ,dSn as aK,_p as aL,dm as aM,Zm as aN,mwn as aO,ive as aP,l0 as aQ,AFt as aR,TD as aS,r0n as aT,qCr as aU,Z0e as aV,FRt as aW,jze as aX,$Sn as aY,Zf as aZ,F9t as a_,vC as aa,Ggn as ab,tan as ac,ccn as ad,lSn as ae,Yze as af,MB as ag,Hwr as ah,o9t as ai,t2n as aj,_0n as ak,Go as al,Ygn as am,Iye as an,Qun as ao,Q0e as ap,Ywr as aq,Xxn as ar,G0e as as,rq as at,Pze as au,Dze as av,fYr as aw,ban as ax,h$e as ay,ztn as az,iBe as b,E3r as b$,y2n as b0,J4r as b1,g2n as b2,gC as b3,E$e as b4,kTr as b5,tOe as b6,ig as b7,CFt as b8,gYr as b9,yBe as bA,Jc as bB,t2 as bC,aLe as bD,bhn as bE,$vr as bF,hgt as bG,Iw as bH,kAr as bI,wAr as bJ,QBe as bK,CAr as bL,_0r as bM,cye as bN,VOe as bO,Eyn as bP,Cyn as bQ,Gsn as bR,H0n as bS,W0n as bT,j3r as bU,Y0n as bV,Lhe as bW,r2n as bX,o2n as bY,vtn as bZ,C3r as b_,Ybn as ba,SRt as bb,gRt as bc,xRt as bd,tYr as be,hmn as bf,ywn as bg,SSn as bh,vRt as bi,mYr as bj,_vn as bk,mLe as bl,YB as bm,nwn as bn,iwn as bo,qfn as bp,OAr as bq,j0n as br,e$e as bs,mgt as bt,O0n as bu,n$ as bv,mO as bw,g0r as bx,aR as by,uLe as bz,lRe as c,E2n as c$,Uwr as c0,n2n as c1,htn as c2,i9t as c3,ed as c4,_y as c5,fu as c6,I2n as c7,R2n as c8,F2n as c9,GZr as cA,KZr as cB,qRt as cC,VRt as cD,MZr as cE,d2n as cF,zZr as cG,f2n as cH,XZr as cI,A2n as cJ,qZr as cK,zze as cL,zRt as cM,$Zr as cN,EMe as cO,LZr as cP,b2n as cQ,i_e as cR,UZr as cS,GSt as cT,HSt as cU,WZr as cV,IZr as cW,qze as cX,CMe as cY,VZr as cZ,D2n as c_,M2n as ca,VSt as cb,C2n as cc,O2n as cd,N2n as ce,ZZr as cf,USt as cg,w2n as ch,jD as ci,CZr as cj,KSt as ck,x2n as cl,YZr as cm,v2n as cn,k2n as co,l2n as cp,u2n as cq,FZr as cr,j2n as cs,HZr as ct,jZr as cu,_2n as cv,m2n as cw,P2n as cx,T2n as cy,eve as cz,g3t as d,Sxr as d$,p2n as d0,QZr as d1,S2n as d2,atn as d3,X0 as d4,lxt as d5,QSn as d6,Kye as d7,dR as d8,Iyn as d9,i$ as dA,yan as dB,han as dC,MVe as dD,txn as dE,v0r as dF,S0r as dG,PTt as dH,tyn as dI,pen as dJ,_Sn as dK,utn as dL,dMt as dM,u2 as dN,KAr as dO,i2n as dP,_Mt as dQ,fQ as dR,khn as dS,hEr as dT,WTt as dU,SZ as dV,MCr as dW,d4t as dX,yZ as dY,fAt as dZ,AR as d_,Vv as da,Nyn as db,N0r as dc,R0r as dd,q3t as de,bZ as df,yyn as dg,Ohn as dh,ZTt as di,eCt as dj,whn as dk,Q0r as dl,$0n as dm,q0n as dn,PI as dp,R_ as dq,rwn as dr,pBe as ds,Cm as dt,Dfn as du,i0 as dv,z2n as dw,FDr as dx,Zun as dy,RRe as dz,m3t as e,HCr as e$,SSr as e0,t$ as e1,Hme as e2,lCt as e3,K0n as e4,W0 as e5,tvn as e6,J2n as e7,ESn as e8,lvn as e9,fSn as eA,myn as eB,mSn as eC,$Yr as eD,Rze as eE,IRt as eF,_4t as eG,ltn as eH,hYr as eI,I4t as eJ,R5e as eK,Mye as eL,$on as eM,sLe as eN,Dhn as eO,h0r as eP,A4t as eQ,Uon as eR,Vht as eS,N5e as eT,Oht as eU,c0 as eV,s0n as eW,van as eX,jRe as eY,wBe as eZ,l0n as e_,qhe as ea,I4r as eb,$Qr as ec,uvn as ed,m$e as ee,dvn as ef,fvn as eg,Xbn as eh,nxn as ei,rxn as ej,rvn as ek,SBe as el,ahe as em,Tyn as en,G0 as eo,Myn as ep,YY as eq,$yn as er,C_e as es,Kyn as et,sQ as eu,Xgn as ev,IC as ew,Fhn as ex,UTr as ey,BSn as ez,uRe as f,gSn as f$,Ahn as f0,S0n as f1,b0n as f2,TC as f3,cFe as f4,wee as f5,kN as f6,Dve as f7,Emn as f8,wYr as f9,R0n as fA,D0n as fB,own as fC,dPt as fD,Lhn as fE,I0r as fF,jhn as fG,Fme as fH,zOe as fI,nCt as fJ,P0n as fK,Fyn as fL,vxn as fM,Oan as fN,fxn as fO,TR as fP,Ixn as fQ,dxn as fR,Xze as fS,Kbn as fT,CRt as fU,xTr as fV,cTr as fW,exn as fX,hSn as fY,ySn as fZ,a0 as f_,ND as fa,Kwr as fb,VTr as fc,T_e as fd,ctn as fe,y$e as ff,u3r as fg,mfn as fh,Qxn as fi,Zxn as fj,Yxn as fk,Ave as fl,EN as fm,A0n as fn,L0n as fo,vwn as fp,gwn as fq,vSn as fr,bSn as fs,x4t as ft,m0n as fu,Chn as fv,Nhn as fw,fN as fx,iLe as fy,dLe as fz,w3t as g,JTr as g$,HQ as g0,ZSn as g1,VSn as g2,X9t as g3,PRt as g4,zQ as g5,Bfn as g6,Kun as g7,CR as g8,eYr as g9,hwn as gA,Kgn as gB,RFe as gC,y3r as gD,pvn as gE,w0r as gF,e2n as gG,TYr as gH,Pht as gI,XTt as gJ,o2 as gK,K1 as gL,MSn as gM,jSn as gN,Vwr as gO,Wgn as gP,FSn as gQ,Jgn as gR,RSn as gS,e9t as gT,Q2n as gU,xR as gV,aen as gW,Grn as gX,Rhn as gY,HTt as gZ,LTt as g_,Zbn as ga,Jtn as gb,MDr as gc,Pg as gd,LSn as ge,y0r as gf,fee as gg,V2n as gh,aSn as gi,U2n as gj,_yn as gk,sSn as gl,d4r as gm,eSn as gn,V0n as go,oSn as gp,U0n as gq,cvn as gr,Dw as gs,of as gt,hR as gu,k3r as gv,J0n as gw,NSn as gx,fPt as gy,gnn as gz,YAt as h,i0n as h$,rA as h0,kC as h1,tA as h2,Ihn as h3,evn as h4,fBe as h5,tve as h6,c2n as h7,mCt as h8,Uan as h9,Aht as hA,Vye as hB,RTr as hC,OTr as hD,ZTr as hE,kyn as hF,Pyn as hG,Dyn as hH,Oyn as hI,Ryn as hJ,o0n as hK,wyn as hL,t0n as hM,Ym as hN,f4t as hO,Syn as hP,xyn as hQ,gBe as hR,Jye as hS,Ayn as hT,xBe as hU,gyn as hV,Qyn as hW,e0n as hX,she as hY,f0n as hZ,Dht as h_,Mxn as ha,vYr as hb,X0n as hc,Hgn as hd,iyn as he,cyn as hf,dyn as hg,R$ as hh,CD as hi,oyn as hj,ryn as hk,nyn as hl,lyn as hm,c0n as hn,a0n as ho,zTr as hp,GCr as hq,kht as hr,hC as hs,kRe as ht,V3t as hu,vyn as hv,byn as hw,DRe as hx,ARe as hy,qTr as hz,Ip as i,oLe as i$,JCr as i0,jyn as i1,p4t as i2,uhe as i3,FCr as i4,OG as i5,i4t as i6,W3t as i7,LTr as i8,KTr as i9,rCr as iA,eCr as iB,NG as iC,Yyn as iD,d0n as iE,NCr as iF,LCr as iG,jTr as iH,Jyn as iI,Lyn as iJ,fhe as iK,Xyn as iL,I5e as iM,MTr as iN,TBe as iO,qyn as iP,q$ as iQ,Byn as iR,Vyn as iS,GSn as iT,YSn as iU,Cee as iV,AD as iW,Icn as iX,Gxn as iY,E5e as iZ,jxn as i_,Uyn as ia,zyn as ib,Wyn as ic,Hyn as id,n0n as ie,FTr as ig,RCr as ih,o4t as ii,u0n as ij,WTr as ik,Zyn as il,Gyn as im,YTr as io,E_e as ip,IRe as iq,tCr as ir,QTr as is,WCr as it,XTr as iu,yee as iv,Bye as iw,nCr as ix,Epe as iy,NRe as iz,GAt as j,Dxn as j$,nee as j0,Jfn as j1,awn as j2,I0n as j3,AAr as j4,CBe as j5,o$ as j6,MMt as j7,Bxn as j8,s2 as j9,Win as jA,O9t as jB,zTt as jC,FB as jD,sN as jE,K2n as jF,Kxn as jG,U_n as jH,sGr as jI,cGr as jJ,uGr as jK,uSn as jL,qwr as jM,gVe as jN,bnn as jO,ste as jP,aan as jQ,ewt as jR,wI as jS,BFe as jT,Pxn as jU,hhn as jV,Shn as jW,vhn as jX,Axn as jY,yhn as jZ,x0r as j_,Lxn as ja,cPt as jb,T3r as jc,oBe as jd,Gwr as je,_ht as jf,Bwr as jg,T3t as jh,Dsn as ji,iSn as jj,HI as jk,HMe as jl,Zgn as jm,WRt as jn,rve as jo,Dye as jp,cN as jq,tBe as jr,Fye as js,lN as jt,qAr as ju,DBe as jv,mBe as jw,Rye as jx,rBe as jy,e0e as jz,Rwr as k,gR as k$,Ran as k0,gxn as k1,hxn as k2,qon as k3,Nxn as k4,mxn as k5,qan as k6,Fxn as k7,sxn as k8,Oxn as k9,o6t as kA,rSn as kB,JSn as kC,wD as kD,J0 as kE,QSt as kF,VAt as kG,Y4 as kH,xhn as kI,cLe as kJ,kEr as kK,Cve as kL,Eve as kM,OSn as kN,BMt as kO,zMt as kP,Xxt as kQ,jFe as kR,q_e as kS,LFe as kT,Xun as kU,QVe as kV,$xn as kW,Hfn as kX,k0n as kY,rvr as kZ,cSn as k_,pxn as ka,uxn as kb,axn as kc,wxn as kd,lxn as ke,cxn as kf,_xn as kg,xxn as kh,yxn as ki,Txn as kj,p$e as kk,bxn as kl,ixn as km,Rxn as kn,oxn as ko,Cxn as kp,vVe as kq,Sxn as kr,Fan as ks,Exn as kt,kxn as ku,WSn as kv,USn as kw,HSn as kx,tSn as ky,NDr as kz,Zme as l,uwn as l$,kDr as l0,Tve as l1,U$ as l2,eA as l3,mD as l4,Qwr as l5,eTr as l6,Zwr as l7,Oye as l8,Ehn as l9,KSn as lA,cwn as lB,lwn as lC,wjt as lD,XSn as lE,syn as lF,qsn as lG,uyn as lH,twn as lI,pwn as lJ,B0n as lK,RAr as lL,M0n as lM,pyn as lN,ayn as lO,fyn as lP,dwn as lQ,yrn as lR,G0n as lS,wEr as lT,$hn as lU,$fn as lV,s2n as lW,a2n as lX,xSn as lY,a9t as lZ,_jt as l_,U0r as la,o3r as lb,s3r as lc,Thn as ld,ljt as le,Qgn as lf,zwr as lg,Xwr as lh,LPt as li,Hxn as lj,Wxn as lk,Vxn as ll,Jxn as lm,Uxn as ln,T0n as lo,F3r as lp,Q0n as lq,Z0n as lr,nSn as ls,F0n as lt,swn as lu,ghn as lv,qxn as lw,zxn as lx,Phn as ly,Mhn as lz,rQ as m,cbr as m$,_wn as m0,Qbn as m1,qSn as m2,jfn as m3,jmn as m4,Lmn as m5,nq as m6,qDr as m7,hyn as m8,gCt as m9,mje as mA,FAt as mB,Bxr as mC,YI as mD,r1r as mE,xCt as mF,f1r as mG,zme as mH,iht as mI,F_ as mJ,Vme as mK,Ume as mL,Wbr as mM,Ybr as mN,yB as mO,Rbr as mP,Mbr as mQ,IEt as mR,zbr as mS,PEt as mT,Nbr as mU,Obr as mV,bbr as mW,Sbr as mX,h2r as mY,eh as mZ,X1r as m_,ISn as ma,H2n as mb,q2n as mc,G2n as md,OQr as me,zEr as mf,jEr as mg,ove as mh,Ytn as mi,h0n as mj,E0n as mk,g0n as ml,v0n as mm,y0n as mn,Jsn as mo,C0n as mp,ASn as mq,DSn as mr,kSn as ms,PSn as mt,TEr as mu,CEr as mv,JRe as mw,bN as mx,zSn as my,eyn as mz,vB as n,Rw as n$,kEt as n0,sbr as n1,rbr as n2,EEt as n3,ibr as n4,ebr as n5,Y1r as n6,ubr as n7,tbr as n8,Z1r as n9,Pbr as nA,Ebr as nB,Cbr as nC,Abr as nD,kbr as nE,r2r as nF,Bbr as nG,Tbr as nH,w2r as nI,a2r as nJ,Ibr as nK,i2r as nL,g2r as nM,vbr as nN,Gbr as nO,_2r as nP,Jbr as nQ,f2r as nR,DEt as nS,qbr as nT,Zbr as nU,Qbr as nV,FEt as nW,y2r as nX,p2r as nY,x2r as nZ,v2r as n_,G1r as na,K1r as nb,fbr as nc,lbr as nd,nbr as ne,Q1r as nf,abr as ng,bye as nh,obr as ni,MEt as nj,T2r as nk,$br as nl,Xbr as nm,d2r as nn,t2r as no,jbr as np,hbr as nq,ybr as nr,hLe as ns,s2r as nt,MCt as nu,u2r as nv,c2r as nw,S2r as nx,_br as ny,Dbr as nz,Mwr as o,tSr as o$,n2r as o0,C2r as o1,o2r as o2,Sye as o3,M_ as o4,m2r as o5,Vbr as o6,b2r as o7,l2r as o8,REt as o9,ZEt as oA,ogn as oB,ign as oC,sgn as oD,ngn as oE,tgn as oF,UEt as oG,JEt as oH,dSr as oI,X2r as oJ,LCt as oK,$Ct as oL,Egn as oM,_gn as oN,tkt as oO,jEt as oP,zEt as oQ,jCt as oR,BCt as oS,nSr as oT,bgn as oU,fSr as oV,F2r as oW,M2r as oX,QZ as oY,qk as oZ,tRe as o_,vu as oa,xbr as ob,gbr as oc,mbr as od,Ubr as oe,SLe as of,Hbr as og,Kbr as oh,wbr as oi,e2r as oj,qhn as ok,ui as ol,egn as om,Qhn as on,dbr as oo,qmt as op,rgn as oq,W2r as or,uSr as os,QEt as ot,ekt as ou,$2r as ov,B2r as ow,Dgn as ox,mSr as oy,YEt as oz,HAt as p,Agn as p$,R2r as p0,j2r as p1,q2r as p2,mgn as p3,KEt as p4,XEt as p5,P2r as p6,D2r as p7,N2r as p8,I2r as p9,Cgn as pA,O2r as pB,Tgn as pC,M$ as pD,hye as pE,gye as pF,Pgn as pG,agn as pH,Rgn as pI,fgn as pJ,Ign as pK,ggn as pL,pSr as pM,Z2r as pN,zCt as pO,UCt as pP,qCt as pQ,VCt as pR,yye as pS,vye as pT,vgn as pU,nkt as pV,lSr as pW,rSr as pX,k2r as pY,xye as pZ,ySr as p_,rkt as pa,GEt as pb,Ogn as pc,okt as pd,xgn as pe,Q2r as pf,ZZ as pg,XI as ph,A2r as pi,ygn as pj,ikt as pk,wLe as pl,iSr as pm,qme as pn,eQ as po,rRe as pp,Y2r as pq,VEt as pr,Sgn as ps,cgn as pt,G2r as pu,ugn as pv,kgn as pw,lgn as px,oSr as py,J2r as pz,Nwr as q,cAt as q$,_Sr as q0,V2r as q1,Ngn as q2,aSr as q3,cSr as q4,wgn as q5,sSr as q6,hgn as q7,L2r as q8,z2r as q9,AEt as qA,Fbr as qB,Lbr as qC,gSr as qD,Vmt as qE,Umt as qF,Uhn as qG,H1r as qH,E2r as qI,Xhn as qJ,Zhn as qK,Khn as qL,Yhn as qM,S1r as qN,x1r as qO,b1r as qP,Vhn as qQ,zhn as qR,pbr as qS,jgn as qT,Fgn as qU,kLe as qV,ULe as qW,JLe as qX,WLe as qY,aAt as qZ,nAt as q_,WEt as qa,U2r as qb,dgn as qc,H2r as qd,eSr as qe,xLe as qf,LEt as qg,BEt as qh,$Et as qi,qEt as qj,K2r as qk,HEt as ql,pgn as qm,sA as qn,$S as qo,Jme as qp,vSr as qq,Whn as qr,Ghn as qs,hSr as qt,Jhn as qu,Hhn as qv,y1r as qw,v1r as qx,ZOe as qy,sD as qz,n0 as r,eAt as r$,$Le as r0,qLe as r1,HLe as r2,LLe as r3,BLe as r4,ILe as r5,NLe as r6,AAt as r7,eBe as r8,kye as r9,_At as rA,PAt as rB,PLe as rC,oAt as rD,ZLe as rE,tAt as rF,SAt as rG,j$ as rH,Tye as rI,YLe as rJ,QLe as rK,TAt as rL,MAt as rM,IAt as rN,Fw as rO,Eye as rP,mAt as rQ,j_ as rR,kAt as rS,Qkt as rT,OAt as rU,yAt as rV,pAt as rW,Lu as rX,OLe as rY,wye as rZ,aD as r_,mee as ra,xAt as rb,uAt as rc,zLe as rd,ALe as re,DLe as rf,tQ as rg,Mgn as rh,vAt as ri,gAt as rj,aht as rk,jAt as rl,Wme as rm,MLe as rn,jLe as ro,Jkt as rp,Vkt as rq,Kkt as rr,Hkt as rs,dAt as rt,sht as ru,VLe as rv,FLe as rw,RAt as rx,hAt as ry,Zkt as rz,XAt as s,wSr as s$,Cye as s0,iAt as s1,sAt as s2,RLe as s3,lAt as s4,ELe as s5,wAt as s6,oht as s7,gxr as s8,exr as s9,oxr as sA,qSr as sB,nRe as sC,uxr as sD,pxr as sE,KLe as sF,KSr as sG,YSr as sH,qxr as sI,nxr as sJ,bxr as sK,GSr as sL,xxr as sM,Cxr as sN,XSr as sO,Exr as sP,Lxr as sQ,Nxr as sR,VSr as sS,Axr as sT,GLe as sU,EAt as sV,rAt as sW,Kme as sX,Pxr as sY,Gme as sZ,xSr as s_,txr as sa,dxr as sb,DAt as sc,Mxr as sd,ZSr as se,QSr as sf,Oxr as sg,USr as sh,JSr as si,vxr as sj,kSr as sk,DSr as sl,jxr as sm,rxr as sn,RSr as so,zSr as sp,ESr as sq,ASr as sr,bAt as ss,Dxr as st,cxr as su,lxr as sv,Bgn as sw,FSr as sx,axr as sy,sxr as sz,inn as t,X2n as t$,Txr as t0,Xme as t1,CAt as t2,$At as t3,Fxr as t4,NAt as t5,LAt as t6,ISr as t7,OSr as t8,PSr as t9,Omt as tA,Mme as tB,dvr as tC,fvr as tD,PG as tE,aCt as tF,sCt as tG,mvr as tH,_vr as tI,bwn as tJ,Bhn as tK,$gn as tL,qgn as tM,zgn as tN,Vgn as tO,Ugn as tP,AEr as tQ,x0n as tR,w0n as tS,ovn as tT,svn as tU,avn as tV,Gbn as tW,B2n as tX,$2n as tY,LQr as tZ,W2n as t_,NSr as ta,TSr as tb,CSr as tc,kxr as td,Lgn as te,ixr as tf,$xr as tg,Ixr as th,BAt as ti,mxr as tj,Rxr as tk,XLe as tl,fxr as tm,_xr as tn,WSr as to,hxr as tp,$Sr as tq,MSr as tr,jSr as ts,LSr as tt,BSr as tu,yxr as tv,HSr as tw,wxr as tx,pvr as ty,iCt as tz,Pa as u,Y2n as u0,Z2n as u1,wSn as u2,TSn as u3,grn as u4,fwn as u5,Gd as v,bo as w,Dg as x,Pp as y,ewn as z};