@volter/game-editor 0.5.69 → 0.5.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUNDLED_NOTICES +28 -44
- package/LICENSE +9 -10
- package/catalog/entries/blender.json +2 -2
- package/catalog/entries/music.json +2 -2
- package/catalog/project-source/LICENSE +5 -5
- package/dist/.vite/manifest.json +2125 -2125
- package/dist/assets/{AssetBudgetPanel-BMR3AQhc.js → AssetBudgetPanel-DpXsaQ6w.js} +3 -3
- package/dist/assets/{AudioViewer-DESxi7pU.js → AudioViewer-BdTHfNhD.js} +1 -1
- package/dist/assets/{CanvasBoardDocument-Q_nrYFlB.js → CanvasBoardDocument-DY-7zohc.js} +1 -1
- package/dist/assets/{CanvasSceneViewport-WZMoKy_F.js → CanvasSceneViewport-57CEFqSM.js} +1 -1
- package/dist/assets/{ColorInput-C2EK-OnD.js → ColorInput-Co6tCY9p.js} +1 -1
- package/dist/assets/{EntityModelDocument-B_4ENTCq.js → EntityModelDocument-C-lhKrxv.js} +1 -1
- package/dist/assets/{EnvironmentAssetDocument-BZBp6OFJ.js → EnvironmentAssetDocument-BNe6ANTN.js} +1 -1
- package/dist/assets/{GameplaySessionTimeline-1ivaucpv.js → GameplaySessionTimeline-CryFYfYN.js} +1 -1
- package/dist/assets/{ImageViewer-D16OExYu.js → ImageViewer-DiD2yIG4.js} +1 -1
- package/dist/assets/InspectorObjectPreview-BBVO8bDT.js +1 -0
- package/dist/assets/{JsonAssetDocument-CvjTlcdr.js → JsonAssetDocument-xyXetSbl.js} +1 -1
- package/dist/assets/{LiveModuleDocument-ne1o9giX.js → LiveModuleDocument-BiAunjHS.js} +1 -1
- package/dist/assets/{LutAssetDocument-Cp0v-O7q.js → LutAssetDocument-5sW-5rb0.js} +1 -1
- package/dist/assets/{ModelAssetDocument-Ceu7OIN9.js → ModelAssetDocument-Bdy7x47a.js} +1 -1
- package/dist/assets/{NonThreeAuthoringBootstrap-DiElZf-e.js → NonThreeAuthoringBootstrap-BP-1bVEr.js} +1 -1
- package/dist/assets/{Object3DDocumentToolbar-BLNamqii.js → Object3DDocumentToolbar-CvnSLDPI.js} +1 -1
- package/dist/assets/Object3DDocumentViewport-BE_OPc8T.js +2 -0
- package/dist/assets/{Object3DPreview-ZVokr044.js → Object3DPreview-D3w_dKrX.js} +1 -1
- package/dist/assets/{OnlineAssetDetail-Dnckd7zB.js → OnlineAssetDetail-BnT8_p1W.js} +1 -1
- package/dist/assets/{PlayBar-DsMitSgy.js → PlayBar-C8Mn-EI0.js} +1 -1
- package/dist/assets/{QuarksAssetDocument-B5J8uHFM.js → QuarksAssetDocument-DLMH5Csk.js} +1 -1
- package/dist/assets/{ReactCanvasControls-CmfvxJYY.js → ReactCanvasControls-rNz8syVB.js} +1 -1
- package/dist/assets/{RootSelectionOverlay-BWsNiSuM.js → RootSelectionOverlay-Cn2Rbr1N.js} +1 -1
- package/dist/assets/{ShaderAssetDocument-CT7XzsZq.js → ShaderAssetDocument-CsJCsNfA.js} +1 -1
- package/dist/assets/{ShadowEditor-YO5KEfnz.js → ShadowEditor-jB05hr1W.js} +1 -1
- package/dist/assets/{SourceAssetViewer-FSLup2km.js → SourceAssetViewer-D0NgGrER.js} +1 -1
- package/dist/assets/{StageHost-DYfGYwvq.js → StageHost-B3Yt4I7r.js} +2 -2
- package/dist/assets/{StoryPreviewMount-BhvT5QlB.js → StoryPreviewMount-CzzRn24c.js} +1 -1
- package/dist/assets/{ThreeBoardDocument-B-z2nwnH.js → ThreeBoardDocument-BoHTN4Vl.js} +2 -2
- package/dist/assets/{ThreeIsolationSceneContent-B5pU4Y6k.js → ThreeIsolationSceneContent-BM-0S6J5.js} +1 -1
- package/dist/assets/{ToolObject3DPreview-VtraiQ4Q.js → ToolObject3DPreview-BeM_kx_u.js} +1 -1
- package/dist/assets/{Toolbar-M62Gob9T.js → Toolbar-BZyog9MR.js} +1 -1
- package/dist/assets/{TransientHint-Cc40mHWE.js → TransientHint-RJEkOJoy.js} +1 -1
- package/dist/assets/{VideoViewer-BxcUwXQm.js → VideoViewer-CxajgKrf.js} +1 -1
- package/dist/assets/{ViewportShadingMenu-BoMPnTVh.js → ViewportShadingMenu-S2lADFJg.js} +1 -1
- package/dist/assets/active-ingest-CjZtqL7Q.js +3 -0
- package/dist/assets/{animation-clock-BXEwUJtz.js → animation-clock-CWVW-mqY.js} +1 -1
- package/dist/assets/{animation-mixers.service-C-Ko4KzM.js → animation-mixers.service-CpoYw8cs.js} +1 -1
- package/dist/assets/{animation-timeline.utility-Bl15-rYb.js → animation-timeline.utility-CEerojaB.js} +1 -1
- package/dist/assets/{asset-budget-asset.menu-BUa3g0Wy.js → asset-budget-asset.menu-Bk6scVWQ.js} +1 -1
- package/dist/assets/{asset-budget.action-Dl5eVPIo.js → asset-budget.action-DtBDSfDj.js} +1 -1
- package/dist/assets/{asset-budget.document-DJylQ-0h.js → asset-budget.document-R2zyoJ8E.js} +1 -1
- package/dist/assets/{asset-budget.menu-BJtvNMLj.js → asset-budget.menu-D6jza5Bc.js} +1 -1
- package/dist/assets/{asset-editor-persistence-BIbf5u0Q.js → asset-editor-persistence-DrgwOZIW.js} +1 -1
- package/dist/assets/{asset-loaders-DoNflsHL.js → asset-loaders-CUeYIjeH.js} +1 -1
- package/dist/assets/{asset-preview-DxlSdRZn.js → asset-preview-CQfnI2cX.js} +1 -1
- package/dist/assets/{audio-unlock.service-CTaiyXF9.js → audio-unlock.service-W3UBKsw9.js} +1 -1
- package/dist/assets/{audio.utility-CEmNc68t.js → audio.utility-qrXBdGXg.js} +1 -1
- package/dist/assets/autoplay.service-DQD3Swo9.js +1 -0
- package/dist/assets/{babylon-authoring-adapter-BZvV2bz_.js → babylon-authoring-adapter-CS9LZNmz.js} +1 -1
- package/dist/assets/{binding-resolver-DGbk9_XR.js → binding-resolver-B9VI52zt.js} +2 -2
- package/dist/assets/{blender-emscripten-engine-B7lfg-RX.js → blender-emscripten-engine-Cd6az4pU.js} +1 -1
- package/dist/assets/{blender-node-editor.document-wXJobGNH.js → blender-node-editor.document-BWLFvA2g.js} +1 -1
- package/dist/assets/{blender-properties-tab-7GFf80ev.js → blender-properties-tab-BSmWG9d0.js} +1 -1
- package/dist/assets/{blender-runtime-host-CILxrx5T.js → blender-runtime-host-Cbkie7m4.js} +2 -2
- package/dist/assets/{blender-runtime-skin-Cd5lQYsC.js → blender-runtime-skin-C_ATCb-z.js} +1 -1
- package/dist/assets/{blender-runtime.document-C0r_R49S.js → blender-runtime.document-P9zdgwMt.js} +1 -1
- package/dist/assets/{blender-timeline.document-BaISZMBc.js → blender-timeline.document-DRwySEJO.js} +1 -1
- package/dist/assets/{blender-uv-editor.document-CT_fsyyA.js → blender-uv-editor.document-CmLoL2Vo.js} +1 -1
- package/dist/assets/{blender-version.status-DzEx7u7k.js → blender-version.status-CP4Jqkry.js} +1 -1
- package/dist/assets/{blender-wali-engine-DOiQCBXH.js → blender-wali-engine-CZcS3eAd.js} +1 -1
- package/dist/assets/{blender.command-DdiKd8mZ.js → blender.command-BYGm0Q_s.js} +1 -1
- package/dist/assets/{board-guides-CjHQ9Ynm.js → board-guides-BG-MHK2G.js} +1 -1
- package/dist/assets/{bridge.command-DXUeavn5.js → bridge.command-DpUNErKN.js} +3 -3
- package/dist/assets/{browserAll-Dg46xT22.js → browserAll-DES3i79H.js} +1 -1
- package/dist/assets/{build-player.document-BHwVV3K0.js → build-player.document-B42HrdSU.js} +1 -1
- package/dist/assets/{build-profiles.document-HkpS-Kxa.js → build-profiles.document-Di5CQoH9.js} +1 -1
- package/dist/assets/{build-progress.status-u1J0Rm1D.js → build-progress.status-B4te7-3j.js} +1 -1
- package/dist/assets/{build-session-BLboUUbw.js → build-session-Yw4JoE8T.js} +1 -1
- package/dist/assets/{build.action-C00DL83N.js → build.action-B-DBpUj6.js} +1 -1
- package/dist/assets/{build.command-Cjk_NY75.js → build.command-CfWoHNp0.js} +1 -1
- package/dist/assets/{build.header-BWNmNWFT.js → build.header-BaURztYD.js} +1 -1
- package/dist/assets/{build.menu-BBYtqCIq.js → build.menu-BFBn-dPJ.js} +1 -1
- package/dist/assets/{build.service-DOU15tKN.js → build.service-D8gYWB3n.js} +1 -1
- package/dist/assets/{camera-7DGyYW7Y.js → camera-C-uR_xQp.js} +1 -1
- package/dist/assets/{camera-runtime.inspector-n-jiOR-3.js → camera-runtime.inspector-BOGGEqVq.js} +1 -1
- package/dist/assets/{canvas-design-mount-CSRHU-ag.js → canvas-design-mount-DamLAaWn.js} +3 -3
- package/dist/assets/{canvas-entry-runtime-BST8yRuK.js → canvas-entry-runtime-a6N7Rsrj.js} +2 -2
- package/dist/assets/{canvas-preview-frames-Cja32aW2.js → canvas-preview-frames-XbrKuyJu.js} +1 -1
- package/dist/assets/{canvas-story-capture.service-D5R5HJ8n.js → canvas-story-capture.service-DYRdEzkG.js} +2 -2
- package/dist/assets/{capability-coverage-ByWftxk4.js → capability-coverage-7wKVA3PF.js} +1 -1
- package/dist/assets/{collaboration-presence-D6MC9xJN.js → collaboration-presence-DaVKEfxs.js} +1 -1
- package/dist/assets/{collider-B78EcUc9.js → collider-BEwlgkG5.js} +1 -1
- package/dist/assets/{component-board.service-CkjrsD8x.js → component-board.service-BWSBM2Bb.js} +2 -2
- package/dist/assets/{component-board.service-BaQI5Oas.js → component-board.service-C9ZouakC.js} +2 -2
- package/dist/assets/{component-board.service-Dvjz_g-x.js → component-board.service-D2eGKqHf.js} +2 -2
- package/dist/assets/{component-contracts.service-C3-AXQp7.js → component-contracts.service-D0uElctD.js} +1 -1
- package/dist/assets/{component-instance-root-DLI40MiB.js → component-instance-root-C1Xf4SwR.js} +1 -1
- package/dist/assets/{component-verbs.command-Brr_WcaR.js → component-verbs.command-N-Tj8KOS.js} +1 -1
- package/dist/assets/{component-verbs.service-DC2sC3j3.js → component-verbs.service-CWh4mQ7X.js} +1 -1
- package/dist/assets/{config-BI_7osdR.js → config-hmmj-QHZ.js} +2 -2
- package/dist/assets/{configurations-XP9YLkrt.js → configurations-B9Pi_eRN.js} +1 -1
- package/dist/assets/{connection.status-BhRwcFx0.js → connection.status-C2HPxoww.js} +1 -1
- package/dist/assets/{constraints.inspector-Dm1cycK3.js → constraints.inspector-D-h1f3K2.js} +1 -1
- package/dist/assets/{content-bounds-DROIchTa.js → content-bounds-7UyI42Vj.js} +1 -1
- package/dist/assets/{contract-system-adapters-Cn7OW_ay.js → contract-system-adapters-Bq1LGdjs.js} +1 -1
- package/dist/assets/{coverage.service-l42ty7lr.js → coverage.service-BiBikIsV.js} +1 -1
- package/dist/assets/{create-runtime-B_uTwsmi.js → create-runtime-Cx-q5z2y.js} +1 -1
- package/dist/assets/{curve-THOUsg-j.js → curve-Co_mro-I.js} +1 -1
- package/dist/assets/{data-asset-DAANayR6.js → data-asset-Ckx4D_U_.js} +1 -1
- package/dist/assets/{data-ref-CN34UeVw.js → data-ref-70PUrMuT.js} +1 -1
- package/dist/assets/{debug-bridge-BD1XVAIB.js → debug-bridge-CarsgKpm.js} +1 -1
- package/dist/assets/{debug-registry-ggQWxtu-.js → debug-registry-DgYNlhH_.js} +1 -1
- package/dist/assets/{deferred-ingest-play-B2JUlwlT.js → deferred-ingest-play-Bpdhu2i-.js} +2 -2
- package/dist/assets/{design-time-canvas-mount-as9cN9I6.js → design-time-canvas-mount-Ca9Q75Ui.js} +2 -2
- package/dist/assets/{design-time-layers-BRseeSmV.js → design-time-layers-BIb71snu.js} +1 -1
- package/dist/assets/{design-time-mount.service-BTVu3yKo.js → design-time-mount.service-DL6ZK2TQ.js} +2 -2
- package/dist/assets/{design-time-mount.service-DKvc7lVK.js → design-time-mount.service-zKUVjKAu.js} +2 -2
- package/dist/assets/{design-time-react-mount-C7rB56QD.js → design-time-react-mount-NrWimSxY.js} +1 -1
- package/dist/assets/{document-preview-three-CxmRhCcV.js → document-preview-three-DoDs6q1q.js} +1 -1
- package/dist/assets/{dom-authoring-adapter-L8OzXfmE.js → dom-authoring-adapter-adLQog9l.js} +1 -1
- package/dist/assets/{draco3d-BjNuXv66.js → draco3d-aUvQF1Zx.js} +1 -1
- package/dist/assets/{edit-mode-audio.service-BwI5u845.js → edit-mode-audio.service-CHZ1ultu.js} +1 -1
- package/dist/assets/{edit-mode-authoring-D5f7aHHl.js → edit-mode-authoring-ZQuUwc6e.js} +1 -1
- package/dist/assets/{edit-mode-networking.service-DqP_4lbI.js → edit-mode-networking.service-C7fk2fL1.js} +1 -1
- package/dist/assets/{editor-api-BM7H_F4G.js → editor-api-C8MUOrwt.js} +1 -1
- package/dist/assets/{editor-layers-D-CTUqco.js → editor-layers-CGX7iCSP.js} +1 -1
- package/dist/assets/{editor-shell-store-DHVWS8cE.js → editor-shell-store-BRqB1JZO.js} +1 -1
- package/dist/assets/{entity-object-MKYemTFM.js → entity-object--ZpqIat7.js} +1 -1
- package/dist/assets/{extend-BrgqZiMY.js → extend-BZQIQ18F.js} +1 -1
- package/dist/assets/{fork-menu-DE2MK3Nq.js → fork-menu-CziehkPx.js} +1 -1
- package/dist/assets/{frame-debugger-store-BXoLKTdZ.js → frame-debugger-store-BOQjrPsh.js} +1 -1
- package/dist/assets/{game-contract-seams-tyKDsfaP.js → game-contract-seams-Dgqv6S8X.js} +1 -1
- package/dist/assets/{game-css-scope-transform-DcjrwtVc.js → game-css-scope-transform-anfk8vP_.js} +1 -1
- package/dist/assets/{game-document.service-CTb2itHQ.js → game-document.service-CqmgrRUA.js} +1 -1
- package/dist/assets/game-eval.command-CoetFm6_.js +2 -0
- package/dist/assets/{game-module-access-BTInp2NG.js → game-module-access-Cg1EB8Mx.js} +1 -1
- package/dist/assets/{game-network-DW5ARz4R.js → game-network-BqI-Ehz0.js} +3 -3
- package/dist/assets/{gameplay-export-cHk3v9y-.js → gameplay-export-D0hZoeSg.js} +1 -1
- package/dist/assets/{gameplay-replay-HRenPTtU.js → gameplay-replay-BHz6VAVa.js} +1 -1
- package/dist/assets/{gameplay.command-DcY2lKKX.js → gameplay.command-CPc9GKuW.js} +1 -1
- package/dist/assets/{generation-jobs-CJBehuUp.js → generation-jobs-D-zXQNZI.js} +1 -1
- package/dist/assets/{generation.service-BMOc-C9i.js → generation.service-Bwt9lQEG.js} +1 -1
- package/dist/assets/{generations-ssgVOe_6.js → generations-d-U9lCVo.js} +1 -1
- package/dist/assets/{generations.status-B_SmPReI.js → generations.status-BQ8xhaLN.js} +1 -1
- package/dist/assets/{hierarchy-marks-BuCO8Ke-.js → hierarchy-marks-CndAXtie.js} +1 -1
- package/dist/assets/{hosted-asset-materialization-CiXZI85V.js → hosted-asset-materialization-r2vKfJGY.js} +1 -1
- package/dist/assets/{index-CfpGZrbC.js → index-BPVnvJfX.js} +1 -1
- package/dist/assets/{index-BweKDdi_.js → index-BqzpzjSB.js} +1 -1
- package/dist/assets/{index-Bm4_DmRO.js → index-CMU7lnXk.js} +1 -1
- package/dist/assets/{index-C5ZAyrKq.js → index-Cr9NTnJp.js} +8 -8
- package/dist/assets/{index-Czvj6whv.js → index-DSMLYme2.js} +1 -1
- package/dist/assets/{index-B0S4fQQV.js → index-DoGlzvsX.js} +1 -1
- package/dist/assets/{index-BvBlIRwM.js → index-dlvCCB72.js} +1 -1
- package/dist/assets/{index-B9bd4k-t.js → index-xjc_62Ha.js} +1 -1
- package/dist/assets/{index-DgPDGGSV.js → index-z0_InXxO.js} +2 -2
- package/dist/assets/{inference-diagnostics-DLt9ql9I.js → inference-diagnostics-D5jfxI5p.js} +1 -1
- package/dist/assets/{ingest-boot-viewport-BXVXjYpG.js → ingest-boot-viewport-Be0v44yf.js} +1 -1
- package/dist/assets/{ingest-siblings-DWJ7OGB_.js → ingest-siblings-BowXSozE.js} +1 -1
- package/dist/assets/{ingest-source-persistence-6ShMoSCa.js → ingest-source-persistence-BGIvThcv.js} +1 -1
- package/dist/assets/{ingest.service-BBbX8ibg.js → ingest.service-wVm-ZcTI.js} +1 -1
- package/dist/assets/{inspect-Cz3Zyx_1.js → inspect-CN92MgRT.js} +1 -1
- package/dist/assets/instances.command-B6gJuL1Z.js +1 -0
- package/dist/assets/{json-history-resource-Uqrihfc8.js → json-history-resource-C9G_vCX9.js} +1 -1
- package/dist/assets/{layered-pick-CAVQMPI7.js → layered-pick-D9tIz_m7.js} +1 -1
- package/dist/assets/{light-CqzsCWeJ.js → light-BGbl1a8K.js} +1 -1
- package/dist/assets/{live-project-verbs-CdFmLYOo.js → live-project-verbs-p1sdTwhF.js} +1 -1
- package/dist/assets/{machine.document-DRIFOVaa.js → machine.document-C1acXU7l.js} +1 -1
- package/dist/assets/{machines.finder-DPCT6few.js → machines.finder-sOxNTYPx.js} +1 -1
- package/dist/assets/{material-BVApn1V_.js → material-D7289cYI.js} +1 -1
- package/dist/assets/{material-factory-B_75xxFD.js → material-factory-D0T-DH8c.js} +1 -1
- package/dist/assets/{mesh-DdA3mExo.js → mesh-1A-HHxD6.js} +1 -1
- package/dist/assets/{model-asset-sections.service-CJnSIckZ.js → model-asset-sections.service-DF-mllTL.js} +1 -1
- package/dist/assets/{model-inspection-DvspbmJl.js → model-inspection-CuVwNVvv.js} +1 -1
- package/dist/assets/{model-thumbnail-BmQs-h6t.js → model-thumbnail-xm1Fabi2.js} +1 -1
- package/dist/assets/{models.finder-Qv_Hsccy.js → models.finder-DrvU1qGk.js} +1 -1
- package/dist/assets/{module-mode-MJ4Gbsry.js → module-mode-BHOAAbgO.js} +2 -2
- package/dist/assets/{mount-canvas-ingest-root-BxtM8OaB.js → mount-canvas-ingest-root-aVZkVNh4.js} +2 -2
- package/dist/assets/{mount-dom-ingest-root-pGatqO46.js → mount-dom-ingest-root-eOOGPaxi.js} +2 -2
- package/dist/assets/{mount-ingest-root-C7jb-mCl.js → mount-ingest-root-BsWbEvr_.js} +2 -2
- package/dist/assets/{mount-manifest-BfoHBuzn.js → mount-manifest-t6ipNsoF.js} +1 -1
- package/dist/assets/{mount-three-ingest-root-Boa5mcaF.js → mount-three-ingest-root-DIR0wKrN.js} +1 -1
- package/dist/assets/{mounted-authoring-DxMISwvR.js → mounted-authoring-DX3DC9PJ.js} +1 -1
- package/dist/assets/{mounted-story-viewport-source-DfnLxI1f.js → mounted-story-viewport-source-D8FqGpci.js} +1 -1
- package/dist/assets/{native-debug-module-BlrALjM3.js → native-debug-module-CB738yQu.js} +1 -1
- package/dist/assets/{navigation-CqG5o5AR.js → navigation-B9ihB0qU.js} +1 -1
- package/dist/assets/{navmesh.menu-D4TdVDhe.js → navmesh.menu-CPxr9LPT.js} +1 -1
- package/dist/assets/{navmesh.service-DWKT5ruQ.js → navmesh.service-BAtili_Y.js} +1 -1
- package/dist/assets/network-observer.service-CqTuZNtI.js +1 -0
- package/dist/assets/{network.utility-DjeOEvAY.js → network.utility-CclYEmfV.js} +1 -1
- package/dist/assets/{object3d-document-session-registry-CMRJdFp6.js → object3d-document-session-registry-BWeuL0nf.js} +2 -2
- package/dist/assets/{oid-transform-DaA6yW6o.js → oid-transform-BYeAsBKI.js} +1 -1
- package/dist/assets/{particles-DsQRcDBY.js → particles-BXiQDiB-.js} +1 -1
- package/dist/assets/{pixi-authoring-adapter-BoBt8bB5.js → pixi-authoring-adapter-CPsN0Yk7.js} +1 -1
- package/dist/assets/{pixi-live-write-target-CYZgvC6U.js → pixi-live-write-target-BUbt5ixX.js} +1 -1
- package/dist/assets/{play.command-D9JGJP-e.js → play.command-Bz5Ra6Uj.js} +2 -2
- package/dist/assets/{presentation-COhHQdmR.js → presentation-C7ZHYsKF.js} +1 -1
- package/dist/assets/{product-CaRGoiIH.js → product-MSpbAqgo.js} +1 -1
- package/dist/assets/{profiler.action-Cz7HYWjh.js → profiler.action-1Jbc-7Q4.js} +1 -1
- package/dist/assets/{profiler.menu-D5aR_FBy.js → profiler.menu-C544DxWZ.js} +1 -1
- package/dist/assets/{profiler.utility-KwxlIPKb.js → profiler.utility-QnzedS3X.js} +1 -1
- package/dist/assets/{project-authoring-session-DKXHVwxO.js → project-authoring-session-BhNfg7TY.js} +2 -2
- package/dist/assets/{properties-bone-constraints.inspector-Bo-sU8eR.js → properties-bone-constraints.inspector-DRCPfugt.js} +1 -1
- package/dist/assets/{properties-bone.inspector-BQiWplQv.js → properties-bone.inspector-CYHeZX0p.js} +1 -1
- package/dist/assets/{properties-collection.inspector-C5BnR-GE.js → properties-collection.inspector-DtGhPkiU.js} +1 -1
- package/dist/assets/{properties-constraints.inspector-CyheU12R.js → properties-constraints.inspector-TIyIV777.js} +1 -1
- package/dist/assets/{properties-data.inspector-CkycARja.js → properties-data.inspector-vA0MTaup.js} +1 -1
- package/dist/assets/{properties-material.inspector-Bl_PUmY-.js → properties-material.inspector-C73spBQh.js} +1 -1
- package/dist/assets/{properties-modifiers.inspector-j7SnOxQq.js → properties-modifiers.inspector-9oyLBBE0.js} +1 -1
- package/dist/assets/{properties-object.inspector-DcR3MGLK.js → properties-object.inspector-7BuiUgbd.js} +1 -1
- package/dist/assets/{properties-output.inspector-BLjw6K4b.js → properties-output.inspector-CjYAggz2.js} +1 -1
- package/dist/assets/{properties-particles.inspector-BUIm2-Jf.js → properties-particles.inspector-DpSfjykX.js} +1 -1
- package/dist/assets/{properties-physics.inspector-DNvRcxb6.js → properties-physics.inspector-BUTvmfU9.js} +1 -1
- package/dist/assets/{properties-render.inspector-8FMZ-qoZ.js → properties-render.inspector-CEdsDqbI.js} +1 -1
- package/dist/assets/{properties-scene.inspector-Dx7_z75k.js → properties-scene.inspector-4kp0sLNw.js} +1 -1
- package/dist/assets/{properties-texture.inspector-WT15951-.js → properties-texture.inspector-Ckpqy9eo.js} +1 -1
- package/dist/assets/{properties-view-layer.inspector-P7VNTdqr.js → properties-view-layer.inspector-CQIFbY8-.js} +1 -1
- package/dist/assets/{properties-world.inspector-B3t1q8TF.js → properties-world.inspector-xZgNV6rI.js} +1 -1
- package/dist/assets/{r3f-design-session-lsbFnoWH.js → r3f-design-session-D8VF-hty.js} +2 -2
- package/dist/assets/{r3f-physics-binding-Cx8yhuwt.js → r3f-physics-binding-oippu1v_.js} +1 -1
- package/dist/assets/{r3f-source-authoring-adapter-jH3G0TeH.js → r3f-source-authoring-adapter-CZJX6VLM.js} +1 -1
- package/dist/assets/{react-canvas-navigation-B_gOe3CI.js → react-canvas-navigation-DuzvnFoN.js} +1 -1
- package/dist/assets/{react-inspector.service-CZf1vfdX.js → react-inspector.service-CV4p6nrb.js} +1 -1
- package/dist/assets/{react-story-board-CCm2Opwn.js → react-story-board-mhldts6w.js} +1 -1
- package/dist/assets/{react-three-rapier.esm-CHXGG51p.js → react-three-rapier.esm-Bo9LjrZe.js} +1 -1
- package/dist/assets/{react-world-authoring-adapter-CnzxMtYz.js → react-world-authoring-adapter-CuyruDfq.js} +1 -1
- package/dist/assets/{realm-services-Do9J6nsb.js → realm-services-BtiLE3a-.js} +1 -1
- package/dist/assets/{reflection-probe-capture.inspector-BAjjIybz.js → reflection-probe-capture.inspector-mrrOHs-9.js} +1 -1
- package/dist/assets/{registry-Xnduk02T.js → registry-DpUr2YIM.js} +1 -1
- package/dist/assets/{relative-import-specifier-CPFTrxi4.js → relative-import-specifier-CyT6yU4l.js} +1 -1
- package/dist/assets/{render-env-YJlI8K0i.js → render-env-C63BGT5v.js} +1 -1
- package/dist/assets/{render-features-DMSV2qKJ.js → render-features-CBl6rom9.js} +1 -1
- package/dist/assets/{render-settings-CRyDhHyz.js → render-settings-DjarlnjI.js} +1 -1
- package/dist/assets/{resolve-three-D27rMc37.js → resolve-three-OiswFiIS.js} +4 -4
- package/dist/assets/{root-seam-contract-gjWUd5uu.js → root-seam-contract-BYLQx4CQ.js} +1 -1
- package/dist/assets/{run-selection-B0jOdyYt.js → run-selection-BMu0v3qC.js} +1 -1
- package/dist/assets/{scene-capture-Di9cM1p4.js → scene-capture-BLf3lJ44.js} +1 -1
- package/dist/assets/{scene-document.service-XxGs4HHE.js → scene-document.service-CjPDph5k.js} +2 -2
- package/dist/assets/{scene-framing-DkZKDwH3.js → scene-framing-BhNk0WhI.js} +1 -1
- package/dist/assets/{seeded-random-BJthDRMu.js → seeded-random-DmdE0u-C.js} +1 -1
- package/dist/assets/{session-x8E_NJk2.js → session-CeyQA0Dv.js} +1 -1
- package/dist/assets/{setup-renderer-F9mG7t6r.js → setup-renderer-Bf8g2S0f.js} +1 -1
- package/dist/assets/{source-object3d-authoring-adapter-CvmFpSUj.js → source-object3d-authoring-adapter-IDRws2Nk.js} +1 -1
- package/dist/assets/{source-persistence-backend-au3WtEn6.js → source-persistence-backend-Dzc6MsmN.js} +1 -1
- package/dist/assets/{stage-keyboard-BQkndG_D.js → stage-keyboard-CpnIYiph.js} +1 -1
- package/dist/assets/{stage-overlay-set-g6eWhuRv.js → stage-overlay-set-BrJzOTCe.js} +1 -1
- package/dist/assets/{stage-presence-markers-0CDfO5f4.js → stage-presence-markers-BFTl9Djp.js} +1 -1
- package/dist/assets/{stage-transform-tools-BzPl7OIo.js → stage-transform-tools-QaenmSrC.js} +1 -1
- package/dist/assets/{standard-viewport-dressing-BW-dM_1h.js → standard-viewport-dressing-DuKH01r4.js} +1 -1
- package/dist/assets/{state-watch.action-Z1nQ5awu.js → state-watch.action-BaRZ6YII.js} +1 -1
- package/dist/assets/{state-watch.menu-CQHGUF3W.js → state-watch.menu-DR2AtQ6r.js} +1 -1
- package/dist/assets/{state-watch.utility-DCIg2i79.js → state-watch.utility-VW8H9Fgi.js} +1 -1
- package/dist/assets/{story-capture-BIrjDKeY.js → story-capture-BEVV48wm.js} +1 -1
- package/dist/assets/{story-documents-BvG2xeaR.js → story-documents-DndjqJ7Y.js} +1 -1
- package/dist/assets/{story-documents.service-y1m7XGMJ.js → story-documents.service-CPrZ7gRM.js} +1 -1
- package/dist/assets/{story-documents.service-DOSEa3ja.js → story-documents.service-wCVmBPhh.js} +1 -1
- package/dist/assets/{story-media-presence-HLV-KaMj.js → story-media-presence-BSX78yVJ.js} +1 -1
- package/dist/assets/{story-pixi-preview-CMhho2gG.js → story-pixi-preview-D4FuH7lJ.js} +1 -1
- package/dist/assets/{story-presentation-CYhVv8Ku.js → story-presentation-2AxtnKGb.js} +1 -1
- package/dist/assets/{story-three-preview-CgcLF5lE.js → story-three-preview-DjObHSAF.js} +2 -2
- package/dist/assets/{studio-environment-R9qXUUcC.js → studio-environment-B--4k2mN.js} +1 -1
- package/dist/assets/{surface-state-D8Qnowo6.js → surface-state-CQHVfsma.js} +1 -1
- package/dist/assets/{syntactic-prop-specs-8gkBuc5j.js → syntactic-prop-specs-CewRyC4c.js} +1 -1
- package/dist/assets/{team-playtest.service-BBMZ2iyk.js → team-playtest.service-B9m6CNk7.js} +1 -1
- package/dist/assets/{three-DiL6vMXq.js → three-B86IzdNg.js} +1 -1
- package/dist/assets/{three-authoring-adapter-CkLR2zGf.js → three-authoring-adapter-BD8_MtYK.js} +1 -1
- package/dist/assets/three-authoring.service-BjJ9wetk.js +2 -0
- package/dist/assets/{three-ingest-runtime-CwTqAHgX.js → three-ingest-runtime-CXySzulx.js} +1 -1
- package/dist/assets/{three-integration-DXOFI88n.js → three-integration-nl5TC6EF.js} +2 -2
- package/dist/assets/three-integration.service-BEk5QkKM.js +1 -0
- package/dist/assets/{three-projection-core-B7Lf8tOp.js → three-projection-core-D4m8lsPU.js} +1 -1
- package/dist/assets/{three-state-BCACvUtm.js → three-state-C36FeFK4.js} +1 -1
- package/dist/assets/{three-story-capture.service-rTFKNtHA.js → three-story-capture.service-C0icETyL.js} +2 -2
- package/dist/assets/{three-story-model-BjKr7OMn.js → three-story-model-CqWu9S2a.js} +1 -1
- package/dist/assets/{three-viewport-presentation-CBzvc2v2.js → three-viewport-presentation-CCMgGLI2.js} +1 -1
- package/dist/assets/tools-BnE3UWVA.js +1 -0
- package/dist/assets/{transform-mode-request-DlEApNrA.js → transform-mode-request-CIgYj1Qb.js} +1 -1
- package/dist/assets/{transport-strip-xCg94CuI.js → transport-strip-B1AJKpn-.js} +1 -1
- package/dist/assets/transport.header-D-n6dQ5n.js +1 -0
- package/dist/assets/{tuples-BDz3wbQL.js → tuples-uyiMYXrv.js} +1 -1
- package/dist/assets/{ui-board-document-DvbK_HVN.js → ui-board-document-6e4w4a8B.js} +2 -2
- package/dist/assets/{user-data-C84W0V47.js → user-data-BXFD1jg-.js} +1 -1
- package/dist/assets/{utility-view-state-CDRxZSo-.js → utility-view-state-I_o0WThv.js} +1 -1
- package/dist/assets/{viewport-door-BARIpMu-.js → viewport-door-AsLxGhLN.js} +1 -1
- package/dist/assets/{viewport-root-presentation-hRLF0BeO.js → viewport-root-presentation-B1qtThOB.js} +1 -1
- package/dist/assets/{viewport-surface-status-TUfhXKR9.js → viewport-surface-status-CWmQeKTO.js} +1 -1
- package/dist/assets/{webworkerAll-PJtcQ1FD.js → webworkerAll-DC445ANd.js} +1 -1
- package/dist/assets/{worker-BtXrsgFy.js → worker-jepHAPPr.js} +1 -1
- package/dist/assets/{workspace-arrangement-DqG5sUns.js → workspace-arrangement-dkubzCff.js} +1 -1
- package/dist/assets/{world-documents-D69XaqUX.js → world-documents-psBK5u_2.js} +1 -1
- package/dist/assets/{world-root-stage-binding-BgZWZEuD.js → world-root-stage-binding-BrvO8VMz.js} +1 -1
- package/dist/assets/{xstate-animation-binding-CIyLzGHs.js → xstate-animation-binding-ChVFHSlM.js} +1 -1
- package/dist/assets/{xstate-animation-meta-CbYWup3R.js → xstate-animation-meta-D7xnhyCE.js} +1 -1
- package/dist-node/cli.js +42 -42
- package/dist-node/create.js +5 -5
- package/package.json +16 -16
- package/template/.agents/references/project-manual.md +1 -2
- package/template/.agents/skills/editor/SKILL.md +2 -2
- package/template/.agents/skills/editor/agents/openai.yaml +3 -3
- package/template/.agents/skills/editor/references/editor-control.md +1 -1
- package/template/.agents/skills/volter-ingest-existing-game/SKILL.md +1 -1
- package/template/.agents/skills/volter-threejs-authoring/SKILL.md +4 -4
- package/template/.agents/skills/volter-threejs-authoring/agents/openai.yaml +1 -1
- package/template/.claude/skills/editor/SKILL.md +2 -2
- package/template/.claude/skills/editor/agents/openai.yaml +3 -3
- package/template/.claude/skills/editor/references/editor-control.md +1 -1
- package/template/.claude/skills/volter-ingest-existing-game/SKILL.md +1 -1
- package/template/.claude/skills/volter-threejs-authoring/SKILL.md +4 -4
- package/template/.claude/skills/volter-threejs-authoring/agents/openai.yaml +1 -1
- package/template/.github/copilot-instructions.md +1 -1
- package/template/.github/skills/editor/SKILL.md +2 -2
- package/template/.github/skills/editor/agents/openai.yaml +3 -3
- package/template/.github/skills/editor/references/editor-control.md +1 -1
- package/template/.github/skills/volter-ingest-existing-game/SKILL.md +1 -1
- package/template/.github/skills/volter-threejs-authoring/SKILL.md +4 -4
- package/template/.github/skills/volter-threejs-authoring/agents/openai.yaml +1 -1
- package/template/AGENTS.md +3 -4
- package/template/README.md +2 -3
- package/template/check-idioms.ts +26 -50
- package/template/package.json +10 -10
- package/template/server/colyseus-setup.ts +1 -9
- package/template/server/main.ts +0 -5
- package/template/server/rooms/arena-room.ts +2 -2
- package/template/server/rooms/game-room.ts +2 -2
- package/template/server/rooms.ts +1 -3
- package/template/src/net/NetworkedPlayers.tsx +3 -3
- package/template/vite.config.ts +1 -1
- package/template-dotfiles/gitignore +1 -1
- package/dist/assets/InspectorObjectPreview-CY5xVsPR.js +0 -1
- package/dist/assets/Object3DDocumentViewport-D6QoHfa_.js +0 -2
- package/dist/assets/active-ingest-0QjJWb7i.js +0 -3
- package/dist/assets/autoplay.service-BZLSUyL8.js +0 -1
- package/dist/assets/game-eval.command-CpDKXOQU.js +0 -2
- package/dist/assets/instances.command-BrdlngrL.js +0 -1
- package/dist/assets/network-observer.service-ZRAquNq4.js +0 -1
- package/dist/assets/three-authoring.service-CovhlCGx.js +0 -2
- package/dist/assets/three-integration.service-rCAqpqSp.js +0 -1
- package/dist/assets/tools-DfctM216.js +0 -1
- package/dist/assets/transport.header-BRtdky0x.js +0 -1
- package/template/server/loopback.ts +0 -76
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/blender-node-editor.document-wXJobGNH.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/blender-runtime-host-CILxrx5T.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-DROIchTa.js","assets/hierarchy-marks-BuCO8Ke-.js","assets/workspace-arrangement-DqG5sUns.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/blender-timeline.document-BaISZMBc.js","assets/blender-runtime-skin-Cd5lQYsC.js","assets/LineSegments2-DN9pUfWA.js","assets/blender-uv-editor.document-CT_fsyyA.js","assets/blender-runtime.document-C0r_R49S.js","assets/three-contract-Dkt6PmWY.js","assets/viewport-door-BARIpMu-.js","assets/blender-version.status-DzEx7u7k.js","assets/blender.command-DdiKd8mZ.js","assets/blender.status-BMETIbb2.js","assets/model.layout-BpZE1W9V.js","assets/regions-DWeEBnE2.js","assets/models.finder-Qv_Hsccy.js","assets/properties-bone-constraints.inspector-Bo-sU8eR.js","assets/blender-properties-tab-7GFf80ev.js","assets/properties-constraints.inspector-CyheU12R.js","assets/properties-bone.inspector-BQiWplQv.js","assets/properties-collection.inspector-C5BnR-GE.js","assets/properties-data.inspector-CkycARja.js","assets/properties-material.inspector-Bl_PUmY-.js","assets/properties-modifiers.inspector-j7SnOxQq.js","assets/properties-object.inspector-DcR3MGLK.js","assets/properties-output.inspector-BLjw6K4b.js","assets/properties-particles.inspector-BUIm2-Jf.js","assets/properties-physics.inspector-DNvRcxb6.js","assets/properties-render.inspector-8FMZ-qoZ.js","assets/properties-scene.inspector-Dx7_z75k.js","assets/properties-texture.inspector-WT15951-.js","assets/properties-view-layer.inspector-P7VNTdqr.js","assets/properties-world.inspector-B3t1q8TF.js","assets/sculpt.layout-D-K5cLw6.js","assets/shading.layout-CZZHKBer.js","assets/uv-editing.layout-A8RA-cbM.js","assets/asset-budget-asset.menu-BUa3g0Wy.js","assets/AssetBudgetPanel-BMR3AQhc.js","assets/asset-loaders-DoNflsHL.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-Dl5eVPIo.js","assets/asset-budget.document-DJylQ-0h.js","assets/asset-budget.menu-BJtvNMLj.js","assets/audio-unlock.service-CTaiyXF9.js","assets/pose-guard-CLabLSzf.js","assets/game-audio-BeCyd0Ha.js","assets/network-observer.service-ZRAquNq4.js","assets/game-network-DW5ARz4R.js","assets/index-OZVqp6xS.js","assets/index-Da9JhEvW.js","assets/native-debug-module-BlrALjM3.js","assets/native-entry-surface-BE8LJNdu.js","assets/debug-registry-ggQWxtu-.js","assets/contract-system-adapters-Cn7OW_ay.js","assets/game-contract-seams-tyKDsfaP.js","assets/seeded-random-BJthDRMu.js","assets/rapier-physics-adapter-CaZqWLu0.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/live-project-verbs-CdFmLYOo.js","assets/capability-coverage-ByWftxk4.js","assets/edit-mode-authoring-D5f7aHHl.js","assets/json-history-resource-Uqrihfc8.js","assets/binding-resolver-DGbk9_XR.js","assets/adapter-surface-Y37Nzcyw.js","assets/structural-signature-Dc7skRiy.js","assets/webgl-frame-capture-DdJkM2mi.js","assets/realm-services-Do9J6nsb.js","assets/canvas-entry-runtime-BST8yRuK.js","assets/three-ingest-runtime-CwTqAHgX.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-0QjJWb7i.js","assets/ingest-source-persistence-6ShMoSCa.js","assets/pixi-story-model-DNkfnWUV.js","assets/surface-content-Dg9Kkazf.js","assets/viewport-root-presentation-hRLF0BeO.js","assets/mounted-authoring-DxMISwvR.js","assets/entity-object-MKYemTFM.js","assets/user-data-C84W0V47.js","assets/three-DiL6vMXq.js","assets/editor-layers-D-CTUqco.js","assets/component-instance-root-DLI40MiB.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/three-authoring-adapter-CkLR2zGf.js","assets/source-persistence-backend-au3WtEn6.js","assets/three-projection-core-B7Lf8tOp.js","assets/body-marks-C1LxJtQb.js","assets/structural-ids-BOo2BRoY.js","assets/object3d-authoring-subject-XccsO0xG.js","assets/r3f-physics-binding-Cx8yhuwt.js","assets/deferred-ingest-play-B2JUlwlT.js","assets/rrweb-Cd2ifIRP.js","assets/react-world-authoring-adapter-CnzxMtYz.js","assets/board-guides-CjHQ9Ynm.js","assets/relative-import-specifier-CPFTrxi4.js","assets/story-arg-descriptors-Ek86ExX7.js","assets/inspect-Cz3Zyx_1.js","assets/inference-diagnostics-DLt9ql9I.js","assets/writer-tw6EcuVO.js","assets/three-state-BCACvUtm.js","assets/editor-shell-store-DHVWS8cE.js","assets/audio.utility-CEmNc68t.js","assets/audio-meter-Cddyq1vI.js","assets/autoplay.service-BZLSUyL8.js","assets/bridge.command-DXUeavn5.js","assets/gameplay-replay-HRenPTtU.js","assets/output-DK8waum9.js","assets/command-results-CUQD49AB.js","assets/debug-bridge-BD1XVAIB.js","assets/build-profiles.document-HkpS-Kxa.js","assets/build-session-BLboUUbw.js","assets/configurations-XP9YLkrt.js","assets/build-player.document-BHwVV3K0.js","assets/build-progress.status-u1J0Rm1D.js","assets/build.action-C00DL83N.js","assets/build.command-Cjk_NY75.js","assets/build.header-BWNmNWFT.js","assets/build.menu-BBYtqCIq.js","assets/build.service-DOU15tKN.js","assets/connection.status-BhRwcFx0.js","assets/coverage.service-l42ty7lr.js","assets/edit-mode-audio.service-BwI5u845.js","assets/edit-mode-networking.service-DqP_4lbI.js","assets/game-document.service-CTb2itHQ.js","assets/frame-debugger-store-BXoLKTdZ.js","assets/utility-view-state-CDRxZSo-.js","assets/PlayBar-DsMitSgy.js","assets/run-selection-B0jOdyYt.js","assets/presentation-COhHQdmR.js","assets/surface-state-D8Qnowo6.js","assets/game-eval.command-CpDKXOQU.js","assets/game-module-access-BTInp2NG.js","assets/gameplay.command-DcY2lKKX.js","assets/generation.service-BMOc-C9i.js","assets/model-thumbnail-BmQs-h6t.js","assets/studio-environment-R9qXUUcC.js","assets/generation-jobs-CJBehuUp.js","assets/generation-CdOATubd.css","assets/generations.status-B_SmPReI.js","assets/ingest.service-BBbX8ibg.js","assets/registry-Xnduk02T.js","assets/mount-ingest-root-C7jb-mCl.js","assets/instances.command-BrdlngrL.js","assets/navmesh.menu-D4TdVDhe.js","assets/navmesh-workflow-store-Cmnm57TB.js","assets/navmesh.service-DWKT5ruQ.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/network.utility-DjeOEvAY.js","assets/play.command-D9JGJP-e.js","assets/profiler.action-Cz7HYWjh.js","assets/profiler.menu-D5aR_FBy.js","assets/profiler.utility-KwxlIPKb.js","assets/scene-document.service-XxGs4HHE.js","assets/Object3DDocumentViewport-D6QoHfa_.js","assets/viewport-surface-status-TUfhXKR9.js","assets/after-paint-CB4bz1-e.js","assets/state-watch.action-Z1nQ5awu.js","assets/state-watch.menu-CQHGUF3W.js","assets/state-watch.utility-DCIg2i79.js","assets/team-playtest.service-BBMZ2iyk.js","assets/collaboration-presence-D6MC9xJN.js","assets/transport.header-BRtdky0x.js","assets/component-board.service-BaQI5Oas.js","assets/component-board-registry-DrIa2csL.js","assets/story-media-presence-HLV-KaMj.js","assets/design-time-mount.service-BTVu3yKo.js","assets/design-time-mount-registry-DUpXCg1U.js","assets/component-board.service-CkjrsD8x.js","assets/design-time-mount.service-DKvc7lVK.js","assets/react-inspector.service-CZf1vfdX.js","assets/ShadowEditor-YO5KEfnz.js","assets/eyedropper-session-bjPXnfeX.js","assets/dom-authoring-adapter-L8OzXfmE.js","assets/story-documents.service-DOSEa3ja.js","assets/story-documents-BvG2xeaR.js","assets/StoryPreviewMount-BhvT5QlB.js","assets/camera-runtime.inspector-n-jiOR-3.js","assets/component-board.service-Dvjz_g-x.js","assets/component-verbs.command-Brr_WcaR.js","assets/instance-fork-actions-D3sRzS3K.js","assets/fork-menu-DE2MK3Nq.js","assets/component-verbs.service-DC2sC3j3.js","assets/constraints.inspector-Dm1cycK3.js","assets/constraint-Bp1l8hY-.js","assets/model-asset-sections.service-CJnSIckZ.js","assets/model-inspection-DvspbmJl.js","assets/source-object3d-authoring-adapter-CvmFpSUj.js","assets/project-provenance-BGnJXJwa.js","assets/model-asset-sections-D1uxOu2v.css","assets/reflection-probe-capture.inspector-BAjjIybz.js","assets/reflection-probe-sIto9mh0.js","assets/story-documents.service-y1m7XGMJ.js","assets/standard-viewport-dressing-BW-dM_1h.js","assets/mounted-story-viewport-source-DfnLxI1f.js","assets/story-three-preview-CgcLF5lE.js","assets/asset-preview-DxlSdRZn.js","assets/bitmap-label-Ct4k6ehY.js","assets/crash-null-boundary-v3a0uEgw.js","assets/story-mount-turn-DFRTj5hi.js","assets/three-story-model-BjKr7OMn.js","assets/r3f-source-authoring-adapter-jH3G0TeH.js","assets/live-gesture-lock-DJbrjOqf.js","assets/oid-transform-DaA6yW6o.js","assets/three-authoring.service-CovhlCGx.js","assets/three-story-capture.service-rTFKNtHA.js","assets/canvas-story-capture.service-D5R5HJ8n.js","assets/component-contracts.service-C3-AXQp7.js","assets/three-integration.service-rCAqpqSp.js","assets/three-integration-DXOFI88n.js","assets/layered-pick-CAVQMPI7.js","assets/root-stacking-BEd9ZvxC.js","assets/object3d-document-session-registry-CMRJdFp6.js","assets/animation-mixers.service-C-Ko4KzM.js","assets/live-mixers-B-bwLZ7c.js","assets/animation-timeline.utility-Bl15-rYb.js","assets/transport-strip-xCg94CuI.js","assets/machines.finder-DPCT6few.js","assets/machine.document-DRIFOVaa.js","assets/GameplaySessionTimeline-1ivaucpv.js","assets/react-18-By2b4xR9.js","assets/AudioViewer-DESxi7pU.js","assets/ImageViewer-D16OExYu.js","assets/VideoViewer-BxcUwXQm.js","assets/JsonAssetDocument-CvjTlcdr.js","assets/OnlineAssetDetail-Dnckd7zB.js","assets/asset-editor-persistence-BIbf5u0Q.js","assets/SourceAssetViewer-FSLup2km.js","assets/InspectorCanvasPreview-BrFjhoiD.js","assets/hosted-asset-materialization-CiXZI85V.js","assets/NonThreeAuthoringBootstrap-DiElZf-e.js","assets/project-authoring-session-DKXHVwxO.js","assets/story-capture-BIrjDKeY.js","assets/react-story-board-CCm2Opwn.js","assets/story-presentation-CYhVv8Ku.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as Ye,a as mC}from"./index-nmcBqr7Y.js";import{a as $}from"./jsx-runtime-DPjLkJKQ.js";import{r as MS}from"./index-CtzuWnCS.js";import{F as Kyr}from"./index-FUuS4qwW.js";import{a as Xje}from"./client-DNXj_opT.js";import{g as Yje,a as Xyr,c as xmt}from"./_commonjsHelpers-D6-XlEtG.js";function Yyr(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 Zyr="modulepreload",Qyr=function(t){return"/"+t},wmt={},fo=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=Qyr(A),A in wmt)return;wmt[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":Zyr,F||(J.as="script"),J.crossOrigin="",J.href=A,k&&J.setAttribute("nonce",k),document.head.appendChild(J),F)return new Promise((q,G)=>{J.addEventListener("load",q),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)})},e0r=[{entryPath:"@volter/editor-blender/contributions/blender-node-editor.document.tsx",load:()=>fo(()=>import("./blender-node-editor.document-wXJobGNH.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:()=>fo(()=>import("./blender-timeline.document-BaISZMBc.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:()=>fo(()=>import("./blender-uv-editor.document-CT_fsyyA.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:()=>fo(()=>import("./blender-runtime.document-C0r_R49S.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,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-version.status.tsx",load:()=>fo(()=>import("./blender-version.status-DzEx7u7k.js"),__vite__mapDeps([31,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.command.ts",load:()=>fo(()=>import("./blender.command-DdiKd8mZ.js"),__vite__mapDeps([32,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:()=>fo(()=>import("./blender.environment-CG-pC7sk.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.keymap.ts",load:()=>fo(()=>import("./blender.keymap-BmOBRY7p.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.status.tsx",load:()=>fo(()=>import("./blender.status-BMETIbb2.js"),__vite__mapDeps([33,1,2]))},{entryPath:"@volter/editor-blender/contributions/blender.style.ts",load:()=>fo(()=>import("./blender.style-DaIh9SiA.js"),[])},{entryPath:"@volter/editor-blender/contributions/model.layout.ts",load:()=>fo(()=>import("./model.layout-BpZE1W9V.js"),__vite__mapDeps([34,35]))},{entryPath:"@volter/editor-blender/contributions/models.finder.ts",load:()=>fo(()=>import("./models.finder-Qv_Hsccy.js"),__vite__mapDeps([36,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone-constraints.inspector.tsx",load:()=>fo(()=>import("./properties-bone-constraints.inspector-Bo-sU8eR.js"),__vite__mapDeps([37,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,39,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone.inspector.tsx",load:()=>fo(()=>import("./properties-bone.inspector-BQiWplQv.js"),__vite__mapDeps([40,38,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:()=>fo(()=>import("./properties-collection.inspector-C5BnR-GE.js"),__vite__mapDeps([41,38,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:()=>fo(()=>import("./properties-constraints.inspector-CyheU12R.js"),__vite__mapDeps([39,38,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:()=>fo(()=>import("./properties-data.inspector-CkycARja.js"),__vite__mapDeps([42,38,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:()=>fo(()=>import("./properties-material.inspector-Bl_PUmY-.js"),__vite__mapDeps([43,38,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:()=>fo(()=>import("./properties-modifiers.inspector-j7SnOxQq.js"),__vite__mapDeps([44,38,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:()=>fo(()=>import("./properties-object.inspector-DcR3MGLK.js"),__vite__mapDeps([45,38,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:()=>fo(()=>import("./properties-output.inspector-BLjw6K4b.js"),__vite__mapDeps([46,38,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:()=>fo(()=>import("./properties-particles.inspector-BUIm2-Jf.js"),__vite__mapDeps([47,38,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:()=>fo(()=>import("./properties-physics.inspector-DNvRcxb6.js"),__vite__mapDeps([48,38,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:()=>fo(()=>import("./properties-render.inspector-8FMZ-qoZ.js"),__vite__mapDeps([49,38,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:()=>fo(()=>import("./properties-scene.inspector-Dx7_z75k.js"),__vite__mapDeps([50,38,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:()=>fo(()=>import("./properties-texture.inspector-WT15951-.js"),__vite__mapDeps([51,38,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:()=>fo(()=>import("./properties-view-layer.inspector-P7VNTdqr.js"),__vite__mapDeps([52,38,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:()=>fo(()=>import("./properties-world.inspector-B3t1q8TF.js"),__vite__mapDeps([53,38,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:()=>fo(()=>import("./sculpt.layout-D-K5cLw6.js"),__vite__mapDeps([54,35]))},{entryPath:"@volter/editor-blender/contributions/shading.layout.ts",load:()=>fo(()=>import("./shading.layout-CZZHKBer.js"),__vite__mapDeps([55,35]))},{entryPath:"@volter/editor-blender/contributions/uv-editing.layout.ts",load:()=>fo(()=>import("./uv-editing.layout-A8RA-cbM.js"),__vite__mapDeps([56,35]))},{entryPath:"@volter/editor-blender/contributions/texture.layout.ts",load:()=>fo(()=>import("./texture.layout-DASpHVht.js"),[])}],t0r=[{entryPath:"@volter/editor-game/contributions/asset-budget-asset.menu.ts",load:()=>fo(()=>import("./asset-budget-asset.menu-BUa3g0Wy.js"),__vite__mapDeps([57,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.action.ts",load:()=>fo(()=>import("./asset-budget.action-Dl5eVPIo.js"),__vite__mapDeps([68,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.document.tsx",load:()=>fo(()=>import("./asset-budget.document-DJylQ-0h.js"),__vite__mapDeps([69,1,2,58,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.menu.ts",load:()=>fo(()=>import("./asset-budget.menu-BJtvNMLj.js"),__vite__mapDeps([70,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/audio-unlock.service.ts",load:()=>fo(()=>import("./audio-unlock.service-CTaiyXF9.js"),__vite__mapDeps([71,72,8,73,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network-observer.service.ts",load:()=>fo(()=>import("./network-observer.service-ZRAquNq4.js"),__vite__mapDeps([74,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/audio.utility.tsx",load:()=>fo(()=>import("./audio.utility-CEmNc68t.js"),__vite__mapDeps([135,1,2,3,4,20,21,136,22,23]))},{entryPath:"@volter/editor-game/contributions/autoplay.service.ts",load:()=>fo(()=>import("./autoplay.service-BZLSUyL8.js"),__vite__mapDeps([137,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/bridge.command.ts",load:()=>fo(()=>import("./bridge.command-DXUeavn5.js"),__vite__mapDeps([138,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,139,140,141,142]))},{entryPath:"@volter/editor-game/contributions/build-profiles.document.tsx",load:()=>fo(()=>import("./build-profiles.document-HkpS-Kxa.js"),__vite__mapDeps([143,1,2,3,4,20,21,144,145,22,23]))},{entryPath:"@volter/editor-game/contributions/build-player.document.tsx",load:()=>fo(()=>import("./build-player.document-BHwVV3K0.js"),__vite__mapDeps([146,1,2,3,4,144,145,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build-progress.status.tsx",load:()=>fo(()=>import("./build-progress.status-u1J0Rm1D.js"),__vite__mapDeps([147,1,2,3,4,144,145,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.action.ts",load:()=>fo(()=>import("./build.action-C00DL83N.js"),__vite__mapDeps([148,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.command.ts",load:()=>fo(()=>import("./build.command-Cjk_NY75.js"),__vite__mapDeps([149,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.header.tsx",load:()=>fo(()=>import("./build.header-BWNmNWFT.js"),__vite__mapDeps([150,1,2,3,4,20,21,144,145,22,23]))},{entryPath:"@volter/editor-game/contributions/build.menu.ts",load:()=>fo(()=>import("./build.menu-BBYtqCIq.js"),__vite__mapDeps([151,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.service.ts",load:()=>fo(()=>import("./build.service-DOU15tKN.js"),__vite__mapDeps([152,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/connection.status.tsx",load:()=>fo(()=>import("./connection.status-BhRwcFx0.js"),__vite__mapDeps([153,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/coverage.service.ts",load:()=>fo(()=>import("./coverage.service-l42ty7lr.js"),__vite__mapDeps([154,88,82,3,2,4,1,20,21,22,23,87]))},{entryPath:"@volter/editor-game/contributions/edit-mode-audio.service.ts",load:()=>fo(()=>import("./edit-mode-audio.service-BwI5u845.js"),__vite__mapDeps([155,72,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/edit-mode-networking.service.ts",load:()=>fo(()=>import("./edit-mode-networking.service-DqP_4lbI.js"),__vite__mapDeps([156,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/game-document.service.ts",load:()=>fo(()=>import("./game-document.service-CTb2itHQ.js"),__vite__mapDeps([157,1,2,3,4,20,21,158,136,159,160,145,161,75,76,77,78,79,80,81,82,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,162,163]))},{entryPath:"@volter/editor-game/contributions/game-eval.command.ts",load:()=>fo(()=>import("./game-eval.command-CpDKXOQU.js"),__vite__mapDeps([164,165,3,2,4,1,20,21,22,23,141,105,82,88,106,81,75,76,77,78,79,80,83,73,84,85,7,8,86,87,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/game.layout.ts",load:()=>fo(()=>import("./game.layout-CBASrvQu.js"),[])},{entryPath:"@volter/editor-game/contributions/gameplay.command.ts",load:()=>fo(()=>import("./gameplay.command-DcY2lKKX.js"),__vite__mapDeps([166,141,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/generation.service.ts",load:()=>fo(()=>import("./generation.service-BMOc-C9i.js"),__vite__mapDeps([167,1,2,3,4,168,13,169,112,19,65,7,8,66,67,9,10,11,12,20,21,170,22,23,171]))},{entryPath:"@volter/editor-game/contributions/generations.status.tsx",load:()=>fo(()=>import("./generations.status-B_SmPReI.js"),__vite__mapDeps([172,1,2,3,4,20,21,170,22,23]))},{entryPath:"@volter/editor-game/contributions/godot.style.ts",load:()=>fo(()=>import("./godot.style-NCC0Pm-A.js"),[])},{entryPath:"@volter/editor-game/contributions/godot.view.ts",load:()=>fo(()=>import("./godot.view-DinHwC_o.js"),[])},{entryPath:"@volter/editor-game/contributions/ingest.service.ts",load:()=>fo(()=>import("./ingest.service-BBbX8ibg.js"),__vite__mapDeps([173,174,175,105,82,3,2,4,1,20,21,22,23,88,106,81,133,134,14,7,8,15,114,19,112,111,29]))},{entryPath:"@volter/editor-game/contributions/instances.command.ts",load:()=>fo(()=>import("./instances.command-BrdlngrL.js"),__vite__mapDeps([176,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/navmesh.menu.ts",load:()=>fo(()=>import("./navmesh.menu-D4TdVDhe.js"),__vite__mapDeps([177,178,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/navmesh.service.ts",load:()=>fo(()=>import("./navmesh.service-DWKT5ruQ.js"),__vite__mapDeps([179,62,63,178,29,180,30,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network.utility.tsx",load:()=>fo(()=>import("./network.utility-DjeOEvAY.js"),__vite__mapDeps([181,1,2,75,76,77,78,79,80,81,82,3,4,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/play.command.ts",load:()=>fo(()=>import("./play.command-D9JGJP-e.js"),__vite__mapDeps([182,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,141,161,145]))},{entryPath:"@volter/editor-game/contributions/profiler.action.ts",load:()=>fo(()=>import("./profiler.action-Cz7HYWjh.js"),__vite__mapDeps([183,159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.menu.ts",load:()=>fo(()=>import("./profiler.menu-D5aR_FBy.js"),__vite__mapDeps([184,159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.utility.tsx",load:()=>fo(()=>import("./profiler.utility-KwxlIPKb.js"),__vite__mapDeps([185,1,2,159,3,4,20,21,158,22,23]))},{entryPath:"@volter/editor-game/contributions/scene-document.service.ts",load:()=>fo(()=>import("./scene-document.service-XxGs4HHE.js"),__vite__mapDeps([186,1,2,187,3,4,188,20,21,189,133,134,14,7,8,15,114,19,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/state-watch.action.ts",load:()=>fo(()=>import("./state-watch.action-Z1nQ5awu.js"),__vite__mapDeps([190,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.menu.ts",load:()=>fo(()=>import("./state-watch.menu-CQHGUF3W.js"),__vite__mapDeps([191,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.utility.tsx",load:()=>fo(()=>import("./state-watch.utility-DCIg2i79.js"),__vite__mapDeps([192,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/team-playtest.service.ts",load:()=>fo(()=>import("./team-playtest.service-BBMZ2iyk.js"),__vite__mapDeps([193,194,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/transport.header.tsx",load:()=>fo(()=>import("./transport.header-BRtdky0x.js"),__vite__mapDeps([195,1,2,3,4,160,145,161,75,76,77,78,79,80,81,82,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/unity.style.ts",load:()=>fo(()=>import("./unity.style-BUZD1vdX.js"),[])},{entryPath:"@volter/editor-game/contributions/unity.view.ts",load:()=>fo(()=>import("./unity.view--n1Xt50A.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.style.ts",load:()=>fo(()=>import("./unreal.style-Cqf-hEzT.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.view.ts",load:()=>fo(()=>import("./unreal.view-CKSsDgA8.js"),[])},{entryPath:"@volter/editor-game/contributions/canvas/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-BaQI5Oas.js"),__vite__mapDeps([196,197,198,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-BTVu3yKo.js"),__vite__mapDeps([199,200,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-CkjrsD8x.js").then(t=>t.c),__vite__mapDeps([201,197,198]))},{entryPath:"@volter/editor-game/contributions/react/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-DKvc7lVK.js"),__vite__mapDeps([202,200,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/react-inspector.service.ts",load:()=>fo(()=>import("./react-inspector.service-CZf1vfdX.js"),__vite__mapDeps([203,1,2,3,4,20,21,204,127,205,130,131,206,90,126,128,129,132,22,23]))},{entryPath:"@volter/editor-game/contributions/react/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-DOSEa3ja.js"),__vite__mapDeps([207,208,1,2,3,4,20,21,162,163,209,108,22,23]))},{entryPath:"@volter/editor-game/contributions/three/camera-runtime.inspector.tsx",load:()=>fo(()=>import("./camera-runtime.inspector-n-jiOR-3.js"),__vite__mapDeps([210,1,2,29,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-Dvjz_g-x.js"),__vite__mapDeps([211,197,198,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.command.ts",load:()=>fo(()=>import("./component-verbs.command-Brr_WcaR.js"),__vite__mapDeps([212,213,214,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29,133]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.service.ts",load:()=>fo(()=>import("./component-verbs.service-DC2sC3j3.js"),__vite__mapDeps([215,214,213,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/three/constraints.inspector.tsx",load:()=>fo(()=>import("./constraints.inspector-Dm1cycK3.js"),__vite__mapDeps([216,1,2,29,115,112,19,217,62,63,3,4,20,21,133,134,14,7,8,15,114,22,23,111]))},{entryPath:"@volter/editor-game/contributions/three/model-asset-sections.service.ts",load:()=>fo(()=>import("./model-asset-sections.service-CJnSIckZ.js"),__vite__mapDeps([218,1,2,29,219,112,19,8,220,114,3,4,20,21,22,23,113,115,111,116,119,221,122,62,63,222]))},{entryPath:"@volter/editor-game/contributions/three/reflection-probe-capture.inspector.tsx",load:()=>fo(()=>import("./reflection-probe-capture.inspector-BAjjIybz.js"),__vite__mapDeps([223,1,2,29,224,62,63,3,4,20,21,133,134,14,7,8,15,114,19,22,23,112,111]))},{entryPath:"@volter/editor-game/contributions/three/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-y1m7XGMJ.js"),__vite__mapDeps([225,1,2,187,3,4,188,20,21,163,226,17,18,19,8,114,22,23,9,7,10,11,12,112,227,228,229,13,169,65,66,67,230,231,85,86,232,129,233,208,162,209,108,234,115,235,128,119,113,111,29,116,131,213,236,132,123,122,62,63]))},{entryPath:"@volter/editor-game/contributions/three/three-authoring.service.ts",load:()=>fo(()=>import("./three-authoring.service-CovhlCGx.js"),__vite__mapDeps([237,200,89,90,117,115,112,19,118,106,119,114,3,2,4,1,20,21,22,23,113,111,29,116,8,120,62,63,121,122,84,123,134,14,7,15]))},{entryPath:"@volter/editor-game/contributions/three-story-capture.service.ts",load:()=>fo(()=>import("./three-story-capture.service-rTFKNtHA.js"),__vite__mapDeps([238,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas-story-capture.service.ts",load:()=>fo(()=>import("./canvas-story-capture.service-D5R5HJ8n.js"),__vite__mapDeps([239,3,2,4,1,20,21,22,23]))}],r0r=[{entryPath:"@volter/editor-react/contributions/component-contracts.service.ts",load:()=>fo(()=>import("./component-contracts.service-C3-AXQp7.js"),__vite__mapDeps([240,236,132,123,3,2,4,1,20,21,22,23]))}],n0r=[{entryPath:"@volter/editor-threejs/contributions/three-integration.service.ts",load:()=>fo(()=>import("./three-integration.service-rCAqpqSp.js"),__vite__mapDeps([241,242,180,13,7,8,6,9,10,11,12,243,244,112,19,1,2,3,4,168,169,65,66,67,245,133,134,14,15,114,20,21,22,23,111,29,18,115,30,17,229,230]))},{entryPath:"@volter/editor-threejs/contributions/animation-mixers.service.ts",load:()=>fo(()=>import("./animation-mixers.service-C-Ko4KzM.js"),__vite__mapDeps([246,247,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-threejs/contributions/animation-timeline.utility.tsx",load:()=>fo(()=>import("./animation-timeline.utility-Bl15-rYb.js"),__vite__mapDeps([248,1,2,249,3,4,20,21,22,23]))}],i0r=[{entryPath:"@volter/editor-xstate/contributions/machines.finder.ts",load:()=>fo(()=>import("./machines.finder-DPCT6few.js"),__vite__mapDeps([250,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-xstate/contributions/machine.document.tsx",load:()=>fo(()=>import("./machine.document-DRIFOVaa.js"),__vite__mapDeps([251,1,2,3,4,20,21,22,23]))}];let HY=null;const FOe=new Set;function lee(){return HY}function o0r(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 FOe)n()}function TTt(t){return FOe.add(t),()=>FOe.delete(t)}/*!
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/blender-node-editor.document-BWLFvA2g.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/blender-runtime-host-Cbkie7m4.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-7UyI42Vj.js","assets/hierarchy-marks-CndAXtie.js","assets/workspace-arrangement-dkubzCff.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/blender-timeline.document-DRwySEJO.js","assets/blender-runtime-skin-C_ATCb-z.js","assets/LineSegments2-DN9pUfWA.js","assets/blender-uv-editor.document-CmLoL2Vo.js","assets/blender-runtime.document-P9zdgwMt.js","assets/three-contract-Dkt6PmWY.js","assets/viewport-door-AsLxGhLN.js","assets/blender-version.status-CP4Jqkry.js","assets/blender.command-BYGm0Q_s.js","assets/blender.status-BMETIbb2.js","assets/model.layout-BpZE1W9V.js","assets/regions-DWeEBnE2.js","assets/models.finder-DrvU1qGk.js","assets/properties-bone-constraints.inspector-DRCPfugt.js","assets/blender-properties-tab-BSmWG9d0.js","assets/properties-constraints.inspector-TIyIV777.js","assets/properties-bone.inspector-CYHeZX0p.js","assets/properties-collection.inspector-DtGhPkiU.js","assets/properties-data.inspector-vA0MTaup.js","assets/properties-material.inspector-C73spBQh.js","assets/properties-modifiers.inspector-9oyLBBE0.js","assets/properties-object.inspector-7BuiUgbd.js","assets/properties-output.inspector-CjYAggz2.js","assets/properties-particles.inspector-DpSfjykX.js","assets/properties-physics.inspector-BUTvmfU9.js","assets/properties-render.inspector-CEdsDqbI.js","assets/properties-scene.inspector-4kp0sLNw.js","assets/properties-texture.inspector-Ckpqy9eo.js","assets/properties-view-layer.inspector-CQIFbY8-.js","assets/properties-world.inspector-xZgNV6rI.js","assets/sculpt.layout-D-K5cLw6.js","assets/shading.layout-CZZHKBer.js","assets/uv-editing.layout-A8RA-cbM.js","assets/asset-budget-asset.menu-Bk6scVWQ.js","assets/AssetBudgetPanel-DpXsaQ6w.js","assets/asset-loaders-CUeYIjeH.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-DtBDSfDj.js","assets/asset-budget.document-R2zyoJ8E.js","assets/asset-budget.menu-D6jza5Bc.js","assets/audio-unlock.service-W3UBKsw9.js","assets/pose-guard-CLabLSzf.js","assets/game-audio-BeCyd0Ha.js","assets/network-observer.service-CqTuZNtI.js","assets/game-network-BqI-Ehz0.js","assets/index-OZVqp6xS.js","assets/index-Da9JhEvW.js","assets/native-debug-module-CB738yQu.js","assets/native-entry-surface-BE8LJNdu.js","assets/debug-registry-DgYNlhH_.js","assets/contract-system-adapters-Bq1LGdjs.js","assets/game-contract-seams-Dgqv6S8X.js","assets/seeded-random-DmdE0u-C.js","assets/rapier-physics-adapter-CaZqWLu0.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/live-project-verbs-p1sdTwhF.js","assets/capability-coverage-7wKVA3PF.js","assets/edit-mode-authoring-ZQuUwc6e.js","assets/json-history-resource-C9G_vCX9.js","assets/binding-resolver-B9VI52zt.js","assets/adapter-surface-Y37Nzcyw.js","assets/structural-signature-Dc7skRiy.js","assets/webgl-frame-capture-DdJkM2mi.js","assets/realm-services-BtiLE3a-.js","assets/canvas-entry-runtime-a6N7Rsrj.js","assets/three-ingest-runtime-CXySzulx.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-CjZtqL7Q.js","assets/ingest-source-persistence-BGIvThcv.js","assets/pixi-story-model-DNkfnWUV.js","assets/surface-content-Dg9Kkazf.js","assets/viewport-root-presentation-B1qtThOB.js","assets/mounted-authoring-DX3DC9PJ.js","assets/entity-object--ZpqIat7.js","assets/user-data-BXFD1jg-.js","assets/three-B86IzdNg.js","assets/editor-layers-CGX7iCSP.js","assets/component-instance-root-C1Xf4SwR.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/three-authoring-adapter-BD8_MtYK.js","assets/source-persistence-backend-Dzc6MsmN.js","assets/three-projection-core-D4m8lsPU.js","assets/body-marks-C1LxJtQb.js","assets/structural-ids-BOo2BRoY.js","assets/object3d-authoring-subject-XccsO0xG.js","assets/r3f-physics-binding-oippu1v_.js","assets/deferred-ingest-play-Bpdhu2i-.js","assets/rrweb-Cd2ifIRP.js","assets/react-world-authoring-adapter-CuyruDfq.js","assets/board-guides-BG-MHK2G.js","assets/relative-import-specifier-CyT6yU4l.js","assets/story-arg-descriptors-Ek86ExX7.js","assets/inspect-CN92MgRT.js","assets/inference-diagnostics-D5jfxI5p.js","assets/writer-tw6EcuVO.js","assets/three-state-C36FeFK4.js","assets/editor-shell-store-BRqB1JZO.js","assets/audio.utility-qrXBdGXg.js","assets/audio-meter-Cddyq1vI.js","assets/autoplay.service-DQD3Swo9.js","assets/bridge.command-DpUNErKN.js","assets/gameplay-replay-BHz6VAVa.js","assets/output-DK8waum9.js","assets/command-results-CUQD49AB.js","assets/debug-bridge-CarsgKpm.js","assets/build-profiles.document-Di5CQoH9.js","assets/build-session-Yw4JoE8T.js","assets/configurations-B9Pi_eRN.js","assets/build-player.document-B42HrdSU.js","assets/build-progress.status-B4te7-3j.js","assets/build.action-B-DBpUj6.js","assets/build.command-CfWoHNp0.js","assets/build.header-BaURztYD.js","assets/build.menu-BFBn-dPJ.js","assets/build.service-D8gYWB3n.js","assets/connection.status-C2HPxoww.js","assets/coverage.service-BiBikIsV.js","assets/edit-mode-audio.service-CHZ1ultu.js","assets/edit-mode-networking.service-C7fk2fL1.js","assets/game-document.service-CqmgrRUA.js","assets/frame-debugger-store-BOQjrPsh.js","assets/utility-view-state-I_o0WThv.js","assets/PlayBar-C8Mn-EI0.js","assets/run-selection-BMu0v3qC.js","assets/presentation-C7ZHYsKF.js","assets/surface-state-CQHVfsma.js","assets/game-eval.command-CoetFm6_.js","assets/game-module-access-Cg1EB8Mx.js","assets/gameplay.command-CPc9GKuW.js","assets/generation.service-Bwt9lQEG.js","assets/model-thumbnail-xm1Fabi2.js","assets/studio-environment-B--4k2mN.js","assets/generation-jobs-D-zXQNZI.js","assets/generation-CdOATubd.css","assets/generations.status-BQ8xhaLN.js","assets/ingest.service-wVm-ZcTI.js","assets/registry-DpUr2YIM.js","assets/mount-ingest-root-BsWbEvr_.js","assets/instances.command-B6gJuL1Z.js","assets/navmesh.menu-CPxr9LPT.js","assets/navmesh-workflow-store-Cmnm57TB.js","assets/navmesh.service-BAtili_Y.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/network.utility-CclYEmfV.js","assets/play.command-Bz5Ra6Uj.js","assets/profiler.action-1Jbc-7Q4.js","assets/profiler.menu-C544DxWZ.js","assets/profiler.utility-QnzedS3X.js","assets/scene-document.service-CjPDph5k.js","assets/Object3DDocumentViewport-BE_OPc8T.js","assets/viewport-surface-status-CWmQeKTO.js","assets/after-paint-CB4bz1-e.js","assets/state-watch.action-BaRZ6YII.js","assets/state-watch.menu-DR2AtQ6r.js","assets/state-watch.utility-VW8H9Fgi.js","assets/team-playtest.service-B9m6CNk7.js","assets/collaboration-presence-DaVKEfxs.js","assets/transport.header-D-n6dQ5n.js","assets/component-board.service-C9ZouakC.js","assets/component-board-registry-DrIa2csL.js","assets/story-media-presence-BSX78yVJ.js","assets/design-time-mount.service-DL6ZK2TQ.js","assets/design-time-mount-registry-DUpXCg1U.js","assets/component-board.service-BWSBM2Bb.js","assets/design-time-mount.service-zKUVjKAu.js","assets/react-inspector.service-CV4p6nrb.js","assets/ShadowEditor-jB05hr1W.js","assets/eyedropper-session-bjPXnfeX.js","assets/dom-authoring-adapter-adLQog9l.js","assets/story-documents.service-wCVmBPhh.js","assets/story-documents-DndjqJ7Y.js","assets/StoryPreviewMount-CzzRn24c.js","assets/camera-runtime.inspector-BOGGEqVq.js","assets/component-board.service-D2eGKqHf.js","assets/component-verbs.command-N-Tj8KOS.js","assets/instance-fork-actions-D3sRzS3K.js","assets/fork-menu-CziehkPx.js","assets/component-verbs.service-CWh4mQ7X.js","assets/constraints.inspector-D-h1f3K2.js","assets/constraint-Bp1l8hY-.js","assets/model-asset-sections.service-DF-mllTL.js","assets/model-inspection-CuVwNVvv.js","assets/source-object3d-authoring-adapter-IDRws2Nk.js","assets/project-provenance-BGnJXJwa.js","assets/model-asset-sections-D1uxOu2v.css","assets/reflection-probe-capture.inspector-mrrOHs-9.js","assets/reflection-probe-sIto9mh0.js","assets/story-documents.service-CPrZ7gRM.js","assets/standard-viewport-dressing-DuKH01r4.js","assets/mounted-story-viewport-source-D8FqGpci.js","assets/story-three-preview-DjObHSAF.js","assets/asset-preview-CQfnI2cX.js","assets/bitmap-label-Ct4k6ehY.js","assets/crash-null-boundary-v3a0uEgw.js","assets/story-mount-turn-DFRTj5hi.js","assets/three-story-model-CqWu9S2a.js","assets/r3f-source-authoring-adapter-CZJX6VLM.js","assets/live-gesture-lock-DJbrjOqf.js","assets/oid-transform-BYeAsBKI.js","assets/three-authoring.service-BjJ9wetk.js","assets/three-story-capture.service-C0icETyL.js","assets/canvas-story-capture.service-DYRdEzkG.js","assets/component-contracts.service-D0uElctD.js","assets/three-integration.service-BEk5QkKM.js","assets/three-integration-nl5TC6EF.js","assets/layered-pick-D9tIz_m7.js","assets/root-stacking-BEd9ZvxC.js","assets/object3d-document-session-registry-BWeuL0nf.js","assets/animation-mixers.service-CpoYw8cs.js","assets/live-mixers-B-bwLZ7c.js","assets/animation-timeline.utility-CEerojaB.js","assets/transport-strip-B1AJKpn-.js","assets/machines.finder-sOxNTYPx.js","assets/machine.document-C1acXU7l.js","assets/GameplaySessionTimeline-CryFYfYN.js","assets/react-18-By2b4xR9.js","assets/AudioViewer-BdTHfNhD.js","assets/ImageViewer-DiD2yIG4.js","assets/VideoViewer-CxajgKrf.js","assets/JsonAssetDocument-xyXetSbl.js","assets/OnlineAssetDetail-BnT8_p1W.js","assets/asset-editor-persistence-DrgwOZIW.js","assets/SourceAssetViewer-D0NgGrER.js","assets/InspectorCanvasPreview-BrFjhoiD.js","assets/hosted-asset-materialization-r2vKfJGY.js","assets/NonThreeAuthoringBootstrap-BP-1bVEr.js","assets/project-authoring-session-BhNfg7TY.js","assets/story-capture-BEVV48wm.js","assets/react-story-board-mhldts6w.js","assets/story-presentation-2AxtnKGb.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as Ye,a as mC}from"./index-nmcBqr7Y.js";import{a as $}from"./jsx-runtime-DPjLkJKQ.js";import{r as MS}from"./index-CtzuWnCS.js";import{F as Kyr}from"./index-FUuS4qwW.js";import{a as Xje}from"./client-DNXj_opT.js";import{g as Yje,a as Xyr,c as xmt}from"./_commonjsHelpers-D6-XlEtG.js";function Yyr(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 Zyr="modulepreload",Qyr=function(t){return"/"+t},wmt={},fo=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=Qyr(A),A in wmt)return;wmt[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":Zyr,F||(J.as="script"),J.crossOrigin="",J.href=A,k&&J.setAttribute("nonce",k),document.head.appendChild(J),F)return new Promise((q,G)=>{J.addEventListener("load",q),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)})},e0r=[{entryPath:"@volter/editor-blender/contributions/blender-node-editor.document.tsx",load:()=>fo(()=>import("./blender-node-editor.document-BWLFvA2g.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:()=>fo(()=>import("./blender-timeline.document-DRwySEJO.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:()=>fo(()=>import("./blender-uv-editor.document-CmLoL2Vo.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:()=>fo(()=>import("./blender-runtime.document-P9zdgwMt.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,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-version.status.tsx",load:()=>fo(()=>import("./blender-version.status-CP4Jqkry.js"),__vite__mapDeps([31,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.command.ts",load:()=>fo(()=>import("./blender.command-BYGm0Q_s.js"),__vite__mapDeps([32,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:()=>fo(()=>import("./blender.environment-CG-pC7sk.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.keymap.ts",load:()=>fo(()=>import("./blender.keymap-BmOBRY7p.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.status.tsx",load:()=>fo(()=>import("./blender.status-BMETIbb2.js"),__vite__mapDeps([33,1,2]))},{entryPath:"@volter/editor-blender/contributions/blender.style.ts",load:()=>fo(()=>import("./blender.style-DaIh9SiA.js"),[])},{entryPath:"@volter/editor-blender/contributions/model.layout.ts",load:()=>fo(()=>import("./model.layout-BpZE1W9V.js"),__vite__mapDeps([34,35]))},{entryPath:"@volter/editor-blender/contributions/models.finder.ts",load:()=>fo(()=>import("./models.finder-DrvU1qGk.js"),__vite__mapDeps([36,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone-constraints.inspector.tsx",load:()=>fo(()=>import("./properties-bone-constraints.inspector-DRCPfugt.js"),__vite__mapDeps([37,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,39,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone.inspector.tsx",load:()=>fo(()=>import("./properties-bone.inspector-CYHeZX0p.js"),__vite__mapDeps([40,38,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:()=>fo(()=>import("./properties-collection.inspector-DtGhPkiU.js"),__vite__mapDeps([41,38,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:()=>fo(()=>import("./properties-constraints.inspector-TIyIV777.js"),__vite__mapDeps([39,38,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:()=>fo(()=>import("./properties-data.inspector-vA0MTaup.js"),__vite__mapDeps([42,38,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:()=>fo(()=>import("./properties-material.inspector-C73spBQh.js"),__vite__mapDeps([43,38,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:()=>fo(()=>import("./properties-modifiers.inspector-9oyLBBE0.js"),__vite__mapDeps([44,38,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:()=>fo(()=>import("./properties-object.inspector-7BuiUgbd.js"),__vite__mapDeps([45,38,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:()=>fo(()=>import("./properties-output.inspector-CjYAggz2.js"),__vite__mapDeps([46,38,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:()=>fo(()=>import("./properties-particles.inspector-DpSfjykX.js"),__vite__mapDeps([47,38,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:()=>fo(()=>import("./properties-physics.inspector-BUTvmfU9.js"),__vite__mapDeps([48,38,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:()=>fo(()=>import("./properties-render.inspector-CEdsDqbI.js"),__vite__mapDeps([49,38,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:()=>fo(()=>import("./properties-scene.inspector-4kp0sLNw.js"),__vite__mapDeps([50,38,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:()=>fo(()=>import("./properties-texture.inspector-Ckpqy9eo.js"),__vite__mapDeps([51,38,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:()=>fo(()=>import("./properties-view-layer.inspector-CQIFbY8-.js"),__vite__mapDeps([52,38,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:()=>fo(()=>import("./properties-world.inspector-xZgNV6rI.js"),__vite__mapDeps([53,38,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:()=>fo(()=>import("./sculpt.layout-D-K5cLw6.js"),__vite__mapDeps([54,35]))},{entryPath:"@volter/editor-blender/contributions/shading.layout.ts",load:()=>fo(()=>import("./shading.layout-CZZHKBer.js"),__vite__mapDeps([55,35]))},{entryPath:"@volter/editor-blender/contributions/uv-editing.layout.ts",load:()=>fo(()=>import("./uv-editing.layout-A8RA-cbM.js"),__vite__mapDeps([56,35]))},{entryPath:"@volter/editor-blender/contributions/texture.layout.ts",load:()=>fo(()=>import("./texture.layout-DASpHVht.js"),[])}],t0r=[{entryPath:"@volter/editor-game/contributions/asset-budget-asset.menu.ts",load:()=>fo(()=>import("./asset-budget-asset.menu-Bk6scVWQ.js"),__vite__mapDeps([57,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.action.ts",load:()=>fo(()=>import("./asset-budget.action-DtBDSfDj.js"),__vite__mapDeps([68,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.document.tsx",load:()=>fo(()=>import("./asset-budget.document-R2zyoJ8E.js"),__vite__mapDeps([69,1,2,58,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.menu.ts",load:()=>fo(()=>import("./asset-budget.menu-D6jza5Bc.js"),__vite__mapDeps([70,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/audio-unlock.service.ts",load:()=>fo(()=>import("./audio-unlock.service-W3UBKsw9.js"),__vite__mapDeps([71,72,8,73,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network-observer.service.ts",load:()=>fo(()=>import("./network-observer.service-CqTuZNtI.js"),__vite__mapDeps([74,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/audio.utility.tsx",load:()=>fo(()=>import("./audio.utility-qrXBdGXg.js"),__vite__mapDeps([135,1,2,3,4,20,21,136,22,23]))},{entryPath:"@volter/editor-game/contributions/autoplay.service.ts",load:()=>fo(()=>import("./autoplay.service-DQD3Swo9.js"),__vite__mapDeps([137,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/bridge.command.ts",load:()=>fo(()=>import("./bridge.command-DpUNErKN.js"),__vite__mapDeps([138,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,139,140,141,142]))},{entryPath:"@volter/editor-game/contributions/build-profiles.document.tsx",load:()=>fo(()=>import("./build-profiles.document-Di5CQoH9.js"),__vite__mapDeps([143,1,2,3,4,20,21,144,145,22,23]))},{entryPath:"@volter/editor-game/contributions/build-player.document.tsx",load:()=>fo(()=>import("./build-player.document-B42HrdSU.js"),__vite__mapDeps([146,1,2,3,4,144,145,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build-progress.status.tsx",load:()=>fo(()=>import("./build-progress.status-B4te7-3j.js"),__vite__mapDeps([147,1,2,3,4,144,145,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.action.ts",load:()=>fo(()=>import("./build.action-B-DBpUj6.js"),__vite__mapDeps([148,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.command.ts",load:()=>fo(()=>import("./build.command-CfWoHNp0.js"),__vite__mapDeps([149,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.header.tsx",load:()=>fo(()=>import("./build.header-BaURztYD.js"),__vite__mapDeps([150,1,2,3,4,20,21,144,145,22,23]))},{entryPath:"@volter/editor-game/contributions/build.menu.ts",load:()=>fo(()=>import("./build.menu-BFBn-dPJ.js"),__vite__mapDeps([151,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.service.ts",load:()=>fo(()=>import("./build.service-D8gYWB3n.js"),__vite__mapDeps([152,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/connection.status.tsx",load:()=>fo(()=>import("./connection.status-C2HPxoww.js"),__vite__mapDeps([153,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/coverage.service.ts",load:()=>fo(()=>import("./coverage.service-BiBikIsV.js"),__vite__mapDeps([154,88,82,3,2,4,1,20,21,22,23,87]))},{entryPath:"@volter/editor-game/contributions/edit-mode-audio.service.ts",load:()=>fo(()=>import("./edit-mode-audio.service-CHZ1ultu.js"),__vite__mapDeps([155,72,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/edit-mode-networking.service.ts",load:()=>fo(()=>import("./edit-mode-networking.service-C7fk2fL1.js"),__vite__mapDeps([156,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/game-document.service.ts",load:()=>fo(()=>import("./game-document.service-CqmgrRUA.js"),__vite__mapDeps([157,1,2,3,4,20,21,158,136,159,160,145,161,75,76,77,78,79,80,81,82,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,162,163]))},{entryPath:"@volter/editor-game/contributions/game-eval.command.ts",load:()=>fo(()=>import("./game-eval.command-CoetFm6_.js"),__vite__mapDeps([164,165,3,2,4,1,20,21,22,23,141,105,82,88,106,81,75,76,77,78,79,80,83,73,84,85,7,8,86,87,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/game.layout.ts",load:()=>fo(()=>import("./game.layout-CBASrvQu.js"),[])},{entryPath:"@volter/editor-game/contributions/gameplay.command.ts",load:()=>fo(()=>import("./gameplay.command-CPc9GKuW.js"),__vite__mapDeps([166,141,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/generation.service.ts",load:()=>fo(()=>import("./generation.service-Bwt9lQEG.js"),__vite__mapDeps([167,1,2,3,4,168,13,169,112,19,65,7,8,66,67,9,10,11,12,20,21,170,22,23,171]))},{entryPath:"@volter/editor-game/contributions/generations.status.tsx",load:()=>fo(()=>import("./generations.status-BQ8xhaLN.js"),__vite__mapDeps([172,1,2,3,4,20,21,170,22,23]))},{entryPath:"@volter/editor-game/contributions/godot.style.ts",load:()=>fo(()=>import("./godot.style-NCC0Pm-A.js"),[])},{entryPath:"@volter/editor-game/contributions/godot.view.ts",load:()=>fo(()=>import("./godot.view-DinHwC_o.js"),[])},{entryPath:"@volter/editor-game/contributions/ingest.service.ts",load:()=>fo(()=>import("./ingest.service-wVm-ZcTI.js"),__vite__mapDeps([173,174,175,105,82,3,2,4,1,20,21,22,23,88,106,81,133,134,14,7,8,15,114,19,112,111,29]))},{entryPath:"@volter/editor-game/contributions/instances.command.ts",load:()=>fo(()=>import("./instances.command-B6gJuL1Z.js"),__vite__mapDeps([176,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/navmesh.menu.ts",load:()=>fo(()=>import("./navmesh.menu-CPxr9LPT.js"),__vite__mapDeps([177,178,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/navmesh.service.ts",load:()=>fo(()=>import("./navmesh.service-BAtili_Y.js"),__vite__mapDeps([179,62,63,178,29,180,30,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network.utility.tsx",load:()=>fo(()=>import("./network.utility-CclYEmfV.js"),__vite__mapDeps([181,1,2,75,76,77,78,79,80,81,82,3,4,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/play.command.ts",load:()=>fo(()=>import("./play.command-Bz5Ra6Uj.js"),__vite__mapDeps([182,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,141,161,145]))},{entryPath:"@volter/editor-game/contributions/profiler.action.ts",load:()=>fo(()=>import("./profiler.action-1Jbc-7Q4.js"),__vite__mapDeps([183,159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.menu.ts",load:()=>fo(()=>import("./profiler.menu-C544DxWZ.js"),__vite__mapDeps([184,159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.utility.tsx",load:()=>fo(()=>import("./profiler.utility-QnzedS3X.js"),__vite__mapDeps([185,1,2,159,3,4,20,21,158,22,23]))},{entryPath:"@volter/editor-game/contributions/scene-document.service.ts",load:()=>fo(()=>import("./scene-document.service-CjPDph5k.js"),__vite__mapDeps([186,1,2,187,3,4,188,20,21,189,133,134,14,7,8,15,114,19,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/state-watch.action.ts",load:()=>fo(()=>import("./state-watch.action-BaRZ6YII.js"),__vite__mapDeps([190,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.menu.ts",load:()=>fo(()=>import("./state-watch.menu-DR2AtQ6r.js"),__vite__mapDeps([191,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.utility.tsx",load:()=>fo(()=>import("./state-watch.utility-VW8H9Fgi.js"),__vite__mapDeps([192,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/team-playtest.service.ts",load:()=>fo(()=>import("./team-playtest.service-B9m6CNk7.js"),__vite__mapDeps([193,194,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/transport.header.tsx",load:()=>fo(()=>import("./transport.header-D-n6dQ5n.js"),__vite__mapDeps([195,1,2,3,4,160,145,161,75,76,77,78,79,80,81,82,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/unity.style.ts",load:()=>fo(()=>import("./unity.style-BUZD1vdX.js"),[])},{entryPath:"@volter/editor-game/contributions/unity.view.ts",load:()=>fo(()=>import("./unity.view--n1Xt50A.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.style.ts",load:()=>fo(()=>import("./unreal.style-Cqf-hEzT.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.view.ts",load:()=>fo(()=>import("./unreal.view-CKSsDgA8.js"),[])},{entryPath:"@volter/editor-game/contributions/canvas/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-C9ZouakC.js"),__vite__mapDeps([196,197,198,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-DL6ZK2TQ.js"),__vite__mapDeps([199,200,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-BWSBM2Bb.js").then(t=>t.c),__vite__mapDeps([201,197,198]))},{entryPath:"@volter/editor-game/contributions/react/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-zKUVjKAu.js"),__vite__mapDeps([202,200,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/react-inspector.service.ts",load:()=>fo(()=>import("./react-inspector.service-CV4p6nrb.js"),__vite__mapDeps([203,1,2,3,4,20,21,204,127,205,130,131,206,90,126,128,129,132,22,23]))},{entryPath:"@volter/editor-game/contributions/react/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-wCVmBPhh.js"),__vite__mapDeps([207,208,1,2,3,4,20,21,162,163,209,108,22,23]))},{entryPath:"@volter/editor-game/contributions/three/camera-runtime.inspector.tsx",load:()=>fo(()=>import("./camera-runtime.inspector-BOGGEqVq.js"),__vite__mapDeps([210,1,2,29,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-D2eGKqHf.js"),__vite__mapDeps([211,197,198,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.command.ts",load:()=>fo(()=>import("./component-verbs.command-N-Tj8KOS.js"),__vite__mapDeps([212,213,214,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29,133]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.service.ts",load:()=>fo(()=>import("./component-verbs.service-CWh4mQ7X.js"),__vite__mapDeps([215,214,213,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/three/constraints.inspector.tsx",load:()=>fo(()=>import("./constraints.inspector-D-h1f3K2.js"),__vite__mapDeps([216,1,2,29,115,112,19,217,62,63,3,4,20,21,133,134,14,7,8,15,114,22,23,111]))},{entryPath:"@volter/editor-game/contributions/three/model-asset-sections.service.ts",load:()=>fo(()=>import("./model-asset-sections.service-DF-mllTL.js"),__vite__mapDeps([218,1,2,29,219,112,19,8,220,114,3,4,20,21,22,23,113,115,111,116,119,221,122,62,63,222]))},{entryPath:"@volter/editor-game/contributions/three/reflection-probe-capture.inspector.tsx",load:()=>fo(()=>import("./reflection-probe-capture.inspector-mrrOHs-9.js"),__vite__mapDeps([223,1,2,29,224,62,63,3,4,20,21,133,134,14,7,8,15,114,19,22,23,112,111]))},{entryPath:"@volter/editor-game/contributions/three/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-CPrZ7gRM.js"),__vite__mapDeps([225,1,2,187,3,4,188,20,21,163,226,17,18,19,8,114,22,23,9,7,10,11,12,112,227,228,229,13,169,65,66,67,230,231,85,86,232,129,233,208,162,209,108,234,115,235,128,119,113,111,29,116,131,213,236,132,123,122,62,63]))},{entryPath:"@volter/editor-game/contributions/three/three-authoring.service.ts",load:()=>fo(()=>import("./three-authoring.service-BjJ9wetk.js"),__vite__mapDeps([237,200,89,90,117,115,112,19,118,106,119,114,3,2,4,1,20,21,22,23,113,111,29,116,8,120,62,63,121,122,84,123,134,14,7,15]))},{entryPath:"@volter/editor-game/contributions/three-story-capture.service.ts",load:()=>fo(()=>import("./three-story-capture.service-C0icETyL.js"),__vite__mapDeps([238,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas-story-capture.service.ts",load:()=>fo(()=>import("./canvas-story-capture.service-DYRdEzkG.js"),__vite__mapDeps([239,3,2,4,1,20,21,22,23]))}],r0r=[{entryPath:"@volter/editor-react/contributions/component-contracts.service.ts",load:()=>fo(()=>import("./component-contracts.service-D0uElctD.js"),__vite__mapDeps([240,236,132,123,3,2,4,1,20,21,22,23]))}],n0r=[{entryPath:"@volter/editor-threejs/contributions/three-integration.service.ts",load:()=>fo(()=>import("./three-integration.service-BEk5QkKM.js"),__vite__mapDeps([241,242,180,13,7,8,6,9,10,11,12,243,244,112,19,1,2,3,4,168,169,65,66,67,245,133,134,14,15,114,20,21,22,23,111,29,18,115,30,17,229,230]))},{entryPath:"@volter/editor-threejs/contributions/animation-mixers.service.ts",load:()=>fo(()=>import("./animation-mixers.service-CpoYw8cs.js"),__vite__mapDeps([246,247,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-threejs/contributions/animation-timeline.utility.tsx",load:()=>fo(()=>import("./animation-timeline.utility-CEerojaB.js"),__vite__mapDeps([248,1,2,249,3,4,20,21,22,23]))}],i0r=[{entryPath:"@volter/editor-xstate/contributions/machines.finder.ts",load:()=>fo(()=>import("./machines.finder-sOxNTYPx.js"),__vite__mapDeps([250,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-xstate/contributions/machine.document.tsx",load:()=>fo(()=>import("./machine.document-C1acXU7l.js"),__vite__mapDeps([251,1,2,3,4,20,21,22,23]))}];let HY=null;const FOe=new Set;function lee(){return HY}function o0r(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 FOe)n()}function TTt(t){return FOe.add(t),()=>FOe.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 mC}from"./index-nmcBqr7Y.js";import{a as $}from"./jsx-runtim
|
|
|
42
42
|
|
|
43
43
|
`)}q.write("payload.value = newResult;"),q.write("return payload;");const Ce=q.compile();return(Fe,De)=>Ce(J,Fe,De)};let m;const g=ZB,S=!HOe.jitless,A=S&&mCt.value,F=n.catchall;let D;t._zod.parse=(J,q)=>{D??(D=c.value);const G=J.value;return g(G)?S&&A&&q?.async===!1&&q.jitless!==!0?(m||(m=d(n.shape)),J=m(J,q),F?AEt([],G,J,q,D,t):J):s(J,q):(J.issues.push({expected:"object",code:"invalid_type",input:G,inst:t}),J)}});function Vmt(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 hLe=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=>aye(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=>Vmt(k,d,t,m)):Vmt(S,d,t,m)}});function Umt(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 Wbr=ui("$ZodXor",(t,n)=>{hLe.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=>Umt(k,d,t,m)):Umt(S,d,t,m)}}),Hbr=ui("$ZodDiscriminatedUnion",(t,n)=>{n.inclusive=!1,hLe.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)}}),Gbr=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])=>Jmt(s,k,A)):Jmt(s,m,g)}});function KOe(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=KOe(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=KOe(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 Jmt(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=KOe(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 DEt=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(q=>vpe(q,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(...hC(s,t.issues)),n.value[s]=t.value}const Kbr=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(...hC(A,D.issues)),s.value[A]=D.value})):(F.issues.length&&s.issues.push(...hC(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"&&mLe.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(...hC(S,D.issues)),s.value[k.value]=D.value})):(F.issues.length&&s.issues.push(...hC(S,F.issues)),s.value[k.value]=F.value)}}return m.length?Promise.all(m).then(()=>s):s}}),Xbr=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])=>{Wmt(F,D,s,g,d,t,c)})):Wmt(k,A,s,g,d,t,c)}return m.length?Promise.all(m).then(()=>s):s}});function Wmt(t,n,s,c,d,m,g){t.issues.length&&(Fme.has(typeof c)?s.issues.push(...hC(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&&(Fme.has(typeof c)?s.issues.push(...hC(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 Ybr=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=>Hmt(k,s))):Hmt(S,s)}return m.length?Promise.all(m).then(()=>s):s}});function Hmt(t,n){t.issues.length&&n.issues.push(...t.issues),n.value.add(t.value)}const Zbr=ui("$ZodEnum",(t,n)=>{vu.init(t,n);const s=dLe(n.entries),c=new Set(s);t._zod.values=c,t._zod.pattern=new RegExp(`^(${s.filter(d=>Fme.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}}),Qbr=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}}),e2r=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}}),t2r=ui("$ZodTransform",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe(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 Gmt(t,n){return t.issues.length&&n===void 0?{issues:[],value:void 0}:t}const PEt=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(`^(${aye(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=>Gmt(m,s.value)):Gmt(d,s.value)}return s.value===void 0?s:n.innerType._zod.run(s,c)}}),r2r=ui("$ZodExactOptional",(t,n)=>{PEt.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)}),n2r=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(`^(${aye(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)}),i2r=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=>Kmt(m,n)):Kmt(d,n)}});function Kmt(t,n){return t.value===void 0&&(t.value=n.defaultValue),t}const o2r=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))}),s2r=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=>Xmt(m,t)):Xmt(d,t)}});function Xmt(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 a2r=ui("$ZodSuccess",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe("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)}}),c2r=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)}}),l2r=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)}),u2r=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 IEt=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 f2r=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(Ymt):Ymt(d)}});function Ymt(t){return t.value=Object.freeze(t.value),t}const d2r=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||hCt.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)}),p2r=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?Bmt(t._def.input,c):c,m=Reflect.apply(s,this,d);return t._def.output?Bmt(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 $mt(t._def.input,c):c,m=await Reflect.apply(s,this,d);return t._def.output?await $mt(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 DEt({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)),_2r=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))}),m2r=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)}),h2r=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=>Zmt(m,s,c,t));Zmt(d,s,c,t)}});function Zmt(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 Qmt;const zhn=Symbol("ZodOutput"),Vhn=Symbol("ZodInput");class g2r{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 y2r(){return new g2r}(Qmt=globalThis).__zod_globalRegistry??(Qmt.__zod_globalRegistry=y2r());const sD=globalThis.__zod_globalRegistry;function v2r(t,n){return new t({type:"string",...Jo(n)})}function Uhn(t,n){return new t({type:"string",coerce:!0,...Jo(n)})}function NEt(t,n){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Jo(n)})}function XOe(t,n){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Jo(n)})}function OEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Jo(n)})}function REt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Jo(n)})}function FEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Jo(n)})}function MEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Jo(n)})}function gLe(t,n){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Jo(n)})}function jEt(t,n){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Jo(n)})}function LEt(t,n){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Jo(n)})}function BEt(t,n){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Jo(n)})}function $Et(t,n){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Jo(n)})}function qEt(t,n){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Jo(n)})}function zEt(t,n){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Jo(n)})}function VEt(t,n){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Jo(n)})}function UEt(t,n){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Jo(n)})}function JEt(t,n){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Jo(n)})}function b2r(t,n){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...Jo(n)})}function WEt(t,n){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Jo(n)})}function HEt(t,n){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Jo(n)})}function GEt(t,n){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Jo(n)})}function KEt(t,n){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Jo(n)})}function XEt(t,n){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Jo(n)})}function YEt(t,n){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Jo(n)})}const Jhn={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function S2r(t,n){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Jo(n)})}function x2r(t,n){return new t({type:"string",format:"date",check:"string_format",...Jo(n)})}function w2r(t,n){return new t({type:"string",format:"time",check:"string_format",precision:null,...Jo(n)})}function T2r(t,n){return new t({type:"string",format:"duration",check:"string_format",...Jo(n)})}function C2r(t,n){return new t({type:"number",checks:[],...Jo(n)})}function Whn(t,n){return new t({type:"number",coerce:!0,checks:[],...Jo(n)})}function E2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Jo(n)})}function k2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...Jo(n)})}function A2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...Jo(n)})}function D2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...Jo(n)})}function P2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...Jo(n)})}function I2r(t,n){return new t({type:"boolean",...Jo(n)})}function Hhn(t,n){return new t({type:"boolean",coerce:!0,...Jo(n)})}function N2r(t,n){return new t({type:"bigint",...Jo(n)})}function Ghn(t,n){return new t({type:"bigint",coerce:!0,...Jo(n)})}function O2r(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Jo(n)})}function R2r(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Jo(n)})}function F2r(t,n){return new t({type:"symbol",...Jo(n)})}function M2r(t,n){return new t({type:"undefined",...Jo(n)})}function j2r(t,n){return new t({type:"null",...Jo(n)})}function L2r(t){return new t({type:"any"})}function B2r(t){return new t({type:"unknown"})}function $2r(t,n){return new t({type:"never",...Jo(n)})}function q2r(t,n){return new t({type:"void",...Jo(n)})}function z2r(t,n){return new t({type:"date",...Jo(n)})}function Khn(t,n){return new t({type:"date",coerce:!0,...Jo(n)})}function V2r(t,n){return new t({type:"nan",...Jo(n)})}function ZZ(t,n){return new SEt({check:"less_than",...Jo(n),value:t,inclusive:!1})}function XI(t,n){return new SEt({check:"less_than",...Jo(n),value:t,inclusive:!0})}function QZ(t,n){return new xEt({check:"greater_than",...Jo(n),value:t,inclusive:!1})}function qk(t,n){return new xEt({check:"greater_than",...Jo(n),value:t,inclusive:!0})}function Xhn(t){return QZ(0,t)}function Yhn(t){return ZZ(0,t)}function Zhn(t){return XI(0,t)}function Qhn(t){return qk(0,t)}function YOe(t,n){return new $1r({check:"multiple_of",...Jo(n),value:t})}function yLe(t,n){return new V1r({check:"max_size",...Jo(n),maximum:t})}function eQ(t,n){return new U1r({check:"min_size",...Jo(n),minimum:t})}function ZEt(t,n){return new J1r({check:"size_equals",...Jo(n),size:t})}function QEt(t,n){return new W1r({check:"max_length",...Jo(n),maximum:t})}function jme(t,n){return new H1r({check:"min_length",...Jo(n),minimum:t})}function ekt(t,n){return new G1r({check:"length_equals",...Jo(n),length:t})}function U2r(t,n){return new K1r({check:"string_format",format:"regex",...Jo(n),pattern:t})}function J2r(t){return new X1r({check:"string_format",format:"lowercase",...Jo(t)})}function W2r(t){return new Y1r({check:"string_format",format:"uppercase",...Jo(t)})}function H2r(t,n){return new Z1r({check:"string_format",format:"includes",...Jo(n),includes:t})}function G2r(t,n){return new Q1r({check:"string_format",format:"starts_with",...Jo(n),prefix:t})}function K2r(t,n){return new ebr({check:"string_format",format:"ends_with",...Jo(n),suffix:t})}function egn(t,n,s){return new tbr({check:"property",property:t,schema:n,...Jo(s)})}function X2r(t,n){return new rbr({check:"mime_type",mime:t,...Jo(n)})}function M$(t){return new nbr({check:"overwrite",tx:t})}function Y2r(t){return M$(n=>n.normalize(t))}function Z2r(){return M$(t=>t.trim())}function Q2r(){return M$(t=>t.toLowerCase())}function eSr(){return M$(t=>t.toUpperCase())}function tSr(){return M$(t=>_Ct(t))}function rSr(t,n,s){return new t({type:"array",element:n,...Jo(s)})}function tgn(t,n,s){return new t({type:"union",options:n,...Jo(s)})}function rgn(t,n,s){return new t({type:"union",options:n,inclusive:!1,...Jo(s)})}function ngn(t,n,s,c){return new t({type:"union",options:s,discriminator:n,...Jo(c)})}function ign(t,n,s){return new t({type:"intersection",left:n,right:s})}function ogn(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 sgn(t,n,s,c){return new t({type:"record",keyType:n,valueType:s,...Jo(c)})}function agn(t,n,s,c){return new t({type:"map",keyType:n,valueType:s,...Jo(c)})}function cgn(t,n,s){return new t({type:"set",valueType:n,...Jo(s)})}function lgn(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 ugn(t,n,s){return new t({type:"enum",entries:n,...Jo(s)})}function fgn(t,n,s){return new t({type:"literal",values:Array.isArray(n)?n:[n],...Jo(s)})}function nSr(t,n){return new t({type:"file",...Jo(n)})}function dgn(t,n){return new t({type:"transform",transform:n})}function pgn(t,n){return new t({type:"optional",innerType:n})}function _gn(t,n){return new t({type:"nullable",innerType:n})}function mgn(t,n,s){return new t({type:"default",innerType:n,get defaultValue(){return typeof s=="function"?s():cye(s)}})}function hgn(t,n,s){return new t({type:"nonoptional",innerType:n,...Jo(s)})}function ggn(t,n){return new t({type:"success",innerType:n})}function ygn(t,n,s){return new t({type:"catch",innerType:n,catchValue:typeof s=="function"?s:()=>s})}function vgn(t,n,s){return new t({type:"pipe",in:n,out:s})}function bgn(t,n){return new t({type:"readonly",innerType:n})}function Sgn(t,n,s){return new t({type:"template_literal",parts:n,...Jo(s)})}function xgn(t,n){return new t({type:"lazy",getter:n})}function wgn(t,n){return new t({type:"promise",innerType:n})}function iSr(t,n,s){const c=Jo(s);return c.abort??(c.abort=!0),new t({type:"custom",check:"custom",fn:n,...c})}function oSr(t,n,s){return new t({type:"custom",check:"custom",fn:n,...Jo(s)})}function sSr(t){const n=aSr(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 aSr(t,n){const s=new eh({check:"custom",...Jo(n)});return s._zod.check=t,s}function cSr(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 lSr(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 uSr(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(q=>typeof q=="string"?q.toLowerCase():q),d=d.map(q=>typeof q=="string"?q.toLowerCase():q));const m=new Set(c),g=new Set(d),S=t.Codec??IEt,k=t.Boolean??CEt,A=t.String??hye,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:((q,G)=>{let se=q;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:((q,G)=>q===!0?c[0]||"true":d[0]||"false"),error:s.error});return J}function gye(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 Lme(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,q=n.processors[d.type];if(!q)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${d.type}`);q(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 Bme(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 q=g[1].defId??g[1].schema.id??`schema${t.counter++}`;return g[1].defId=q,{defId:q,ref:`${J("__shared")}#/${S}/${q}`}}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 $me(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),q=J.schema;if(q.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push(q)):Object.assign(k,q),Object.assign(k,A),g._zod.parent===F)for(const se in k)se==="$ref"||se==="allOf"||se in A||delete k[se];if(q.$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 q in k)q==="$ref"||q==="allOf"||q in J.def&&JSON.stringify(k[q])===JSON.stringify(J.def[q])&&delete k[q]}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:qme(n,"input",t.processors),output:qme(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 fSr=(t,n={})=>s=>{const c=Lme({...s,processors:n});return F_(t,c),Bme(c,t),$me(c,t)},qme=(t,n,s={})=>c=>{const{libraryOptions:d,target:m}=c??{},g=Lme({...d??{},target:m,io:n,processors:s});return F_(t,g),Bme(g,t),$me(g,t)},dSr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tkt=(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=dSr[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}))])}},rkt=(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)},nkt=(t,n,s,c)=>{s.type="boolean"},ikt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},okt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},skt=(t,n,s,c)=>{n.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},akt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ckt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},lkt=(t,n,s,c)=>{s.not={}},ukt=(t,n,s,c)=>{},fkt=(t,n,s,c)=>{},dkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},pkt=(t,n,s,c)=>{const d=t._zod.def,m=dLe(d.entries);m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),s.enum=m},_kt=(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},mkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},hkt=(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},gkt=(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)},ykt=(t,n,s,c)=>{s.type="boolean"},vkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},bkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Skt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},xkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},wkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Tkt=(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"]})},Ckt=(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)},vLe=(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},Ekt=(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},kkt=(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,q)=>F_(J,n,{...c,path:[...c.path,g,q]})),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)},Akt=(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)}},Dkt=(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"}]},Pkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},Ikt=(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))},Nkt=(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)))},Okt=(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},Rkt=(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},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,s.readOnly=!0},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},bLe=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},jkt=(t,n,s,c)=>{const d=t._zod.innerType;F_(d,n,c);const m=n.seen.get(t);m.ref=d},eht={string:tkt,number:rkt,boolean:nkt,bigint:ikt,symbol:okt,null:skt,undefined:akt,void:ckt,never:lkt,any:ukt,unknown:fkt,date:dkt,enum:pkt,literal:_kt,nan:mkt,template_literal:hkt,file:gkt,success:ykt,custom:vkt,function:bkt,transform:Skt,map:xkt,set:wkt,array:Tkt,object:Ckt,union:vLe,intersection:Ekt,tuple:kkt,record:Akt,nullable:Dkt,nonoptional:Pkt,default:Ikt,prefault:Nkt,catch:Okt,pipe:Rkt,readonly:Fkt,promise:Mkt,optional:bLe,lazy:jkt};function pSr(t,n){if("_idmap"in t){const c=t,d=Lme({...n,processors:eht}),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;Bme(d,F),g[A]=$me(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=Lme({...n,processors:eht});return F_(t,s),Bme(s,t),$me(s,t)}const Lkt=ui("ZodISODateTime",(t,n)=>{gbr.init(t,n),j_.init(t,n)});function Bkt(t){return S2r(Lkt,t)}const $kt=ui("ZodISODate",(t,n)=>{ybr.init(t,n),j_.init(t,n)});function qkt(t){return x2r($kt,t)}const zkt=ui("ZodISOTime",(t,n)=>{vbr.init(t,n),j_.init(t,n)});function Vkt(t){return w2r(zkt,t)}const Ukt=ui("ZodISODuration",(t,n)=>{bbr.init(t,n),j_.init(t,n)});function Jkt(t){return T2r(Ukt,t)}const Tgn=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:$kt,ZodISODateTime:Lkt,ZodISODuration:Ukt,ZodISOTime:zkt,date:qkt,datetime:Bkt,duration:Jkt,time:Vkt},Symbol.toStringTag,{value:"Module"})),Wkt=(t,n)=>{ICt.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:s=>f1r(t,s)},flatten:{value:s=>u1r(t,s)},addIssue:{value:s=>{t.issues.push(s),t.message=JSON.stringify(t.issues,Rme,2)}},addIssues:{value:s=>{t.issues.push(...s),t.message=JSON.stringify(t.issues,Rme,2)}},isEmpty:{get(){return t.issues.length===0}}})},Cgn=ui("ZodError",Wkt),Mw=ui("ZodError",Wkt,{Parent:Error}),_Sr=fye(Mw),mSr=dye(Mw),hSr=pye(Mw),gSr=_ye(Mw),ySr=NCt(Mw),vSr=OCt(Mw),bSr=RCt(Mw),SSr=FCt(Mw),xSr=MCt(Mw),wSr=jCt(Mw),TSr=LCt(Mw),CSr=BCt(Mw),Lu=ui("ZodType",(t,n)=>(vu.init(t,n),Object.assign(t["~standard"],{jsonSchema:{input:qme(t,"input"),output:qme(t,"output")}}),t.toJSONSchema=fSr(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)=>_Sr(t,s,c,{callee:t.parse}),t.safeParse=(s,c)=>hSr(t,s,c),t.parseAsync=async(s,c)=>mSr(t,s,c,{callee:t.parseAsync}),t.safeParseAsync=async(s,c)=>gSr(t,s,c),t.spa=t.safeParseAsync,t.encode=(s,c)=>ySr(t,s,c),t.decode=(s,c)=>vSr(t,s,c),t.encodeAsync=async(s,c)=>bSr(t,s,c),t.decodeAsync=async(s,c)=>SSr(t,s,c),t.safeEncode=(s,c)=>xSr(t,s,c),t.safeDecode=(s,c)=>wSr(t,s,c),t.safeEncodeAsync=async(s,c)=>TSr(t,s,c),t.safeDecodeAsync=async(s,c)=>CSr(t,s,c),t.refine=(s,c)=>t.check(OAt(s,c)),t.superRefine=s=>t.check(RAt(s)),t.overwrite=s=>t.check(M$(s)),t.optional=()=>Ume(t),t.exactOptional=()=>mAt(t),t.nullable=()=>Jme(t),t.nullish=()=>Ume(Jme(t)),t.nonoptional=s=>SAt(t,s),t.array=()=>Gd(t),t.or=s=>AR([t,s]),t.and=s=>ULe(t,s),t.transform=s=>Wme(t,JLe(s)),t.default=s=>yAt(t,s),t.prefault=s=>bAt(t,s),t.catch=s=>TAt(t,s),t.pipe=s=>Wme(t,s),t.readonly=()=>kAt(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)),SLe=ui("_ZodString",(t,n)=>{hye.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>tkt(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(U2r(...c)),t.includes=(...c)=>t.check(H2r(...c)),t.startsWith=(...c)=>t.check(G2r(...c)),t.endsWith=(...c)=>t.check(K2r(...c)),t.min=(...c)=>t.check(jme(...c)),t.max=(...c)=>t.check(QEt(...c)),t.length=(...c)=>t.check(ekt(...c)),t.nonempty=(...c)=>t.check(jme(1,...c)),t.lowercase=c=>t.check(J2r(c)),t.uppercase=c=>t.check(W2r(c)),t.trim=()=>t.check(Z2r()),t.normalize=(...c)=>t.check(Y2r(...c)),t.toLowerCase=()=>t.check(Q2r()),t.toUpperCase=()=>t.check(eSr()),t.slugify=()=>t.check(tSr())}),xLe=ui("ZodString",(t,n)=>{hye.init(t,n),SLe.init(t,n),t.email=s=>t.check(NEt(wLe,s)),t.url=s=>t.check(gLe(yye,s)),t.jwt=s=>t.check(YEt(LLe,s)),t.emoji=s=>t.check(jEt(TLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.uuid=s=>t.check(OEt(aD,s)),t.uuidv4=s=>t.check(REt(aD,s)),t.uuidv6=s=>t.check(FEt(aD,s)),t.uuidv7=s=>t.check(MEt(aD,s)),t.nanoid=s=>t.check(LEt(CLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.cuid=s=>t.check(BEt(ELe,s)),t.cuid2=s=>t.check($Et(kLe,s)),t.ulid=s=>t.check(qEt(ALe,s)),t.base64=s=>t.check(GEt(FLe,s)),t.base64url=s=>t.check(KEt(MLe,s)),t.xid=s=>t.check(zEt(DLe,s)),t.ksuid=s=>t.check(VEt(PLe,s)),t.ipv4=s=>t.check(UEt(ILe,s)),t.ipv6=s=>t.check(JEt(NLe,s)),t.cidrv4=s=>t.check(WEt(OLe,s)),t.cidrv6=s=>t.check(HEt(RLe,s)),t.e164=s=>t.check(XEt(jLe,s)),t.datetime=s=>t.check(Bkt(s)),t.date=s=>t.check(qkt(s)),t.time=s=>t.check(Vkt(s)),t.duration=s=>t.check(Jkt(s))});function bo(t){return v2r(xLe,t)}const j_=ui("ZodStringFormat",(t,n)=>{M_.init(t,n),SLe.init(t,n)}),wLe=ui("ZodEmail",(t,n)=>{cbr.init(t,n),j_.init(t,n)});function ESr(t){return NEt(wLe,t)}const zme=ui("ZodGUID",(t,n)=>{sbr.init(t,n),j_.init(t,n)});function kSr(t){return XOe(zme,t)}const aD=ui("ZodUUID",(t,n)=>{abr.init(t,n),j_.init(t,n)});function ASr(t){return OEt(aD,t)}function DSr(t){return REt(aD,t)}function PSr(t){return FEt(aD,t)}function ISr(t){return MEt(aD,t)}const yye=ui("ZodURL",(t,n)=>{lbr.init(t,n),j_.init(t,n)});function NSr(t){return gLe(yye,t)}function OSr(t){return gLe(yye,{protocol:/^https?$/,hostname:iEt,...Jo(t)})}const TLe=ui("ZodEmoji",(t,n)=>{ubr.init(t,n),j_.init(t,n)});function RSr(t){return jEt(TLe,t)}const CLe=ui("ZodNanoID",(t,n)=>{fbr.init(t,n),j_.init(t,n)});function FSr(t){return LEt(CLe,t)}const ELe=ui("ZodCUID",(t,n)=>{dbr.init(t,n),j_.init(t,n)});function MSr(t){return BEt(ELe,t)}const kLe=ui("ZodCUID2",(t,n)=>{pbr.init(t,n),j_.init(t,n)});function jSr(t){return $Et(kLe,t)}const ALe=ui("ZodULID",(t,n)=>{_br.init(t,n),j_.init(t,n)});function LSr(t){return qEt(ALe,t)}const DLe=ui("ZodXID",(t,n)=>{mbr.init(t,n),j_.init(t,n)});function BSr(t){return zEt(DLe,t)}const PLe=ui("ZodKSUID",(t,n)=>{hbr.init(t,n),j_.init(t,n)});function $Sr(t){return VEt(PLe,t)}const ILe=ui("ZodIPv4",(t,n)=>{Sbr.init(t,n),j_.init(t,n)});function qSr(t){return UEt(ILe,t)}const Hkt=ui("ZodMAC",(t,n)=>{wbr.init(t,n),j_.init(t,n)});function zSr(t){return b2r(Hkt,t)}const NLe=ui("ZodIPv6",(t,n)=>{xbr.init(t,n),j_.init(t,n)});function VSr(t){return JEt(NLe,t)}const OLe=ui("ZodCIDRv4",(t,n)=>{Tbr.init(t,n),j_.init(t,n)});function USr(t){return WEt(OLe,t)}const RLe=ui("ZodCIDRv6",(t,n)=>{Cbr.init(t,n),j_.init(t,n)});function JSr(t){return HEt(RLe,t)}const FLe=ui("ZodBase64",(t,n)=>{Ebr.init(t,n),j_.init(t,n)});function WSr(t){return GEt(FLe,t)}const MLe=ui("ZodBase64URL",(t,n)=>{Abr.init(t,n),j_.init(t,n)});function HSr(t){return KEt(MLe,t)}const jLe=ui("ZodE164",(t,n)=>{Dbr.init(t,n),j_.init(t,n)});function GSr(t){return XEt(jLe,t)}const LLe=ui("ZodJWT",(t,n)=>{Ibr.init(t,n),j_.init(t,n)});function KSr(t){return YEt(LLe,t)}const mee=ui("ZodCustomStringFormat",(t,n)=>{Nbr.init(t,n),j_.init(t,n)});function XSr(t,n,s={}){return gye(mee,t,n,s)}function YSr(t){return gye(mee,"hostname",nEt,t)}function ZSr(t){return gye(mee,"hex",vEt,t)}function QSr(t,n){const s=n?.enc??"hex",c=`${t}_${s}`,d=B1r[c];if(!d)throw new Error(`Unrecognized hash format: ${c}`);return gye(mee,c,d,n)}const BLe=ui("ZodNumber",(t,n)=>{TEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>rkt(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(ZOe(c)),t.safe=c=>t.check(ZOe(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(YOe(c,d)),t.step=(c,d)=>t.check(YOe(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 C2r(BLe,t)}const j$=ui("ZodNumberFormat",(t,n)=>{Obr.init(t,n),BLe.init(t,n)});function ZOe(t){return E2r(j$,t)}function exr(t){return k2r(j$,t)}function txr(t){return A2r(j$,t)}function rxr(t){return D2r(j$,t)}function nxr(t){return P2r(j$,t)}const $Le=ui("ZodBoolean",(t,n)=>{CEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>nkt(t,s,c)});function _y(t){return I2r($Le,t)}const qLe=ui("ZodBigInt",(t,n)=>{EEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>ikt(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(YOe(c,d));const s=t._zod.bag;t.minValue=s.minimum??null,t.maxValue=s.maximum??null,t.format=s.format??null});function ixr(t){return N2r(qLe,t)}const zLe=ui("ZodBigIntFormat",(t,n)=>{Rbr.init(t,n),qLe.init(t,n)});function oxr(t){return O2r(zLe,t)}function sxr(t){return R2r(zLe,t)}const Gkt=ui("ZodSymbol",(t,n)=>{Fbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>okt(t,s)});function axr(t){return F2r(Gkt,t)}const Kkt=ui("ZodUndefined",(t,n)=>{Mbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>akt(t,s)});function cxr(t){return M2r(Kkt,t)}const Xkt=ui("ZodNull",(t,n)=>{jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>skt(t,s,c)});function Ykt(t){return j2r(Xkt,t)}const Zkt=ui("ZodAny",(t,n)=>{Lbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ukt()});function lxr(){return L2r(Zkt)}const Qkt=ui("ZodUnknown",(t,n)=>{Bbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>fkt()});function t$(){return B2r(Qkt)}const eAt=ui("ZodNever",(t,n)=>{$br.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>lkt(t,s,c)});function VLe(t){return $2r(eAt,t)}const tAt=ui("ZodVoid",(t,n)=>{qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ckt(t,s)});function uxr(t){return q2r(tAt,t)}const rAt=ui("ZodDate",(t,n)=>{zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>dkt(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 fxr(t){return z2r(rAt,t)}const nAt=ui("ZodArray",(t,n)=>{Vbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Tkt(t,s,c,d),t.element=n.element,t.min=(s,c)=>t.check(jme(s,c)),t.nonempty=s=>t.check(jme(1,s)),t.max=(s,c)=>t.check(QEt(s,c)),t.length=(s,c)=>t.check(ekt(s,c)),t.unwrap=()=>t.element});function Gd(t,n){return rSr(nAt,t,n)}function dxr(t){const n=t._zod.def.shape;return ed(Object.keys(n))}const vye=ui("ZodObject",(t,n)=>{Jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ckt(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:VLe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=s=>wCt(t,s),t.safeExtend=s=>TCt(t,s),t.merge=s=>CCt(t,s),t.pick=s=>SCt(t,s),t.omit=s=>xCt(t,s),t.partial=(...s)=>ECt(WLe,t,s[0]),t.required=(...s)=>kCt(HLe,t,s[0])});function Pa(t,n){const s={type:"object",shape:t??{},...Jo(n)};return new vye(s)}function pxr(t,n){return new vye({type:"object",shape:t,catchall:VLe(),...Jo(n)})}function _xr(t,n){return new vye({type:"object",shape:t,catchall:t$(),...Jo(n)})}const bye=ui("ZodUnion",(t,n)=>{hLe.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function AR(t,n){return new bye({type:"union",options:t,...Jo(n)})}const iAt=ui("ZodXor",(t,n)=>{bye.init(t,n),Wbr.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function mxr(t,n){return new iAt({type:"union",options:t,inclusive:!1,...Jo(n)})}const oAt=ui("ZodDiscriminatedUnion",(t,n)=>{bye.init(t,n),Hbr.init(t,n)});function sAt(t,n,s){return new oAt({type:"union",options:n,discriminator:t,...Jo(s)})}const aAt=ui("ZodIntersection",(t,n)=>{Gbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ekt(t,s,c,d)});function ULe(t,n){return new aAt({type:"intersection",left:t,right:n})}const cAt=ui("ZodTuple",(t,n)=>{DEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>kkt(t,s,c,d),t.rest=s=>t.clone({...t._zod.def,rest:s})});function Vme(t,n,s){const c=n instanceof vu,d=c?s:n,m=c?n:null;return new cAt({type:"tuple",items:t,rest:m,...Jo(d)})}const Sye=ui("ZodRecord",(t,n)=>{Kbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Akt(t,s,c,d),t.keyType=n.keyType,t.valueType=n.valueType});function wD(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,...Jo(s)})}function hxr(t,n,s){const c=sA(t);return c._zod.values=void 0,new Sye({type:"record",keyType:c,valueType:n,...Jo(s)})}function gxr(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,mode:"loose",...Jo(s)})}const lAt=ui("ZodMap",(t,n)=>{Xbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>xkt(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(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function yxr(t,n,s){return new lAt({type:"map",keyType:t,valueType:n,...Jo(s)})}const uAt=ui("ZodSet",(t,n)=>{Ybr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>wkt(t,s),t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function vxr(t,n){return new uAt({type:"set",valueType:t,...Jo(n)})}const tQ=ui("ZodEnum",(t,n)=>{Zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>pkt(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 bxr(t,n){return new tQ({type:"enum",entries:t,...Jo(n)})}const fAt=ui("ZodLiteral",(t,n)=>{Qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>_kt(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 fAt({type:"literal",values:Array.isArray(t)?t:[t],...Jo(n)})}const dAt=ui("ZodFile",(t,n)=>{e2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>gkt(t,s,c),t.min=(s,c)=>t.check(eQ(s,c)),t.max=(s,c)=>t.check(yLe(s,c)),t.mime=(s,c)=>t.check(X2r(Array.isArray(s)?s:[s],c))});function Sxr(t){return nSr(dAt,t)}const pAt=ui("ZodTransform",(t,n)=>{t2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Skt(t,s),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe(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 JLe(t){return new pAt({type:"transform",transform:t})}const WLe=ui("ZodOptional",(t,n)=>{PEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Ume(t){return new WLe({type:"optional",innerType:t})}const _At=ui("ZodExactOptional",(t,n)=>{r2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function mAt(t){return new _At({type:"optional",innerType:t})}const hAt=ui("ZodNullable",(t,n)=>{n2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Dkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Jme(t){return new hAt({type:"nullable",innerType:t})}function xxr(t){return Ume(Jme(t))}const gAt=ui("ZodDefault",(t,n)=>{i2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ikt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yAt(t,n){return new gAt({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const vAt=ui("ZodPrefault",(t,n)=>{o2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Nkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function bAt(t,n){return new vAt({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const HLe=ui("ZodNonOptional",(t,n)=>{s2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Pkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function SAt(t,n){return new HLe({type:"nonoptional",innerType:t,...Jo(n)})}const xAt=ui("ZodSuccess",(t,n)=>{a2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ykt(t,s,c),t.unwrap=()=>t._zod.def.innerType});function wxr(t){return new xAt({type:"success",innerType:t})}const wAt=ui("ZodCatch",(t,n)=>{c2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Okt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function TAt(t,n){return new wAt({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const CAt=ui("ZodNaN",(t,n)=>{l2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>mkt(t,s)});function Txr(t){return V2r(CAt,t)}const GLe=ui("ZodPipe",(t,n)=>{u2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Rkt(t,s,c,d),t.in=n.in,t.out=n.out});function Wme(t,n){return new GLe({type:"pipe",in:t,out:n})}const KLe=ui("ZodCodec",(t,n)=>{GLe.init(t,n),IEt.init(t,n)});function Cxr(t,n,s){return new KLe({type:"pipe",in:t,out:n,transform:s.decode,reverseTransform:s.encode})}const EAt=ui("ZodReadonly",(t,n)=>{f2r.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 kAt(t){return new EAt({type:"readonly",innerType:t})}const AAt=ui("ZodTemplateLiteral",(t,n)=>{d2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>hkt(t,s,c)});function Exr(t,n){return new AAt({type:"template_literal",parts:t,...Jo(n)})}const DAt=ui("ZodLazy",(t,n)=>{m2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>jkt(t,s,c,d),t.unwrap=()=>t._zod.def.getter()});function PAt(t){return new DAt({type:"lazy",getter:t})}const IAt=ui("ZodPromise",(t,n)=>{_2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Mkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function kxr(t){return new IAt({type:"promise",innerType:t})}const NAt=ui("ZodFunction",(t,n)=>{p2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bkt(t,s)});function tht(t){return new NAt({type:"function",input:Array.isArray(t?.input)?Vme(t?.input):t?.input??Gd(t$()),output:t?.output??t$()})}const xye=ui("ZodCustom",(t,n)=>{h2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vkt(t,s)});function Axr(t){const n=new eh({check:"custom"});return n._zod.check=t,n}function YI(t,n){return iSr(xye,t??(()=>!0),n)}function OAt(t,n={}){return oSr(xye,t,n)}function RAt(t){return sSr(t)}const Dxr=cSr,Pxr=lSr;function Ixr(t,n={}){const s=new xye({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 Nxr=(...t)=>uSr({Codec:KLe,Boolean:$Le,String:xLe},...t);function Oxr(t){const n=PAt(()=>AR([bo(t),fu(),_y(),Ykt(),Gd(n),wD(bo(),n)]));return n}function FAt(t,n){return Wme(JLe(t),n)}const Egn=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Zkt,ZodArray:nAt,ZodBase64:FLe,ZodBase64URL:MLe,ZodBigInt:qLe,ZodBigIntFormat:zLe,ZodBoolean:$Le,ZodCIDRv4:OLe,ZodCIDRv6:RLe,ZodCUID:ELe,ZodCUID2:kLe,ZodCatch:wAt,ZodCodec:KLe,ZodCustom:xye,ZodCustomStringFormat:mee,ZodDate:rAt,ZodDefault:gAt,ZodDiscriminatedUnion:oAt,ZodE164:jLe,ZodEmail:wLe,ZodEmoji:TLe,ZodEnum:tQ,ZodExactOptional:_At,ZodFile:dAt,ZodFunction:NAt,ZodGUID:zme,ZodIPv4:ILe,ZodIPv6:NLe,ZodIntersection:aAt,ZodJWT:LLe,ZodKSUID:PLe,ZodLazy:DAt,ZodLiteral:fAt,ZodMAC:Hkt,ZodMap:lAt,ZodNaN:CAt,ZodNanoID:CLe,ZodNever:eAt,ZodNonOptional:HLe,ZodNull:Xkt,ZodNullable:hAt,ZodNumber:BLe,ZodNumberFormat:j$,ZodObject:vye,ZodOptional:WLe,ZodPipe:GLe,ZodPrefault:vAt,ZodPromise:IAt,ZodReadonly:EAt,ZodRecord:Sye,ZodSet:uAt,ZodString:xLe,ZodStringFormat:j_,ZodSuccess:xAt,ZodSymbol:Gkt,ZodTemplateLiteral:AAt,ZodTransform:pAt,ZodTuple:cAt,ZodType:Lu,ZodULID:ALe,ZodURL:yye,ZodUUID:aD,ZodUndefined:Kkt,ZodUnion:bye,ZodUnknown:Qkt,ZodVoid:tAt,ZodXID:DLe,ZodXor:iAt,_ZodString:SLe,_default:yAt,_function:tht,any:lxr,array:Gd,base64:WSr,base64url:HSr,bigint:ixr,boolean:_y,catch:TAt,check:Axr,cidrv4:USr,cidrv6:JSr,codec:Cxr,cuid:MSr,cuid2:jSr,custom:YI,date:fxr,describe:Dxr,discriminatedUnion:sAt,e164:GSr,email:ESr,emoji:RSr,enum:ed,exactOptional:mAt,file:Sxr,float32:exr,float64:txr,function:tht,guid:kSr,hash:QSr,hex:ZSr,hostname:YSr,httpUrl:OSr,instanceof:Ixr,int:ZOe,int32:rxr,int64:oxr,intersection:ULe,ipv4:qSr,ipv6:VSr,json:Oxr,jwt:KSr,keyof:dxr,ksuid:$Sr,lazy:PAt,literal:Dg,looseObject:_xr,looseRecord:gxr,mac:zSr,map:yxr,meta:Pxr,nan:Txr,nanoid:FSr,nativeEnum:bxr,never:VLe,nonoptional:SAt,null:Ykt,nullable:Jme,nullish:xxr,number:fu,object:Pa,optional:Ume,partialRecord:hxr,pipe:Wme,prefault:bAt,preprocess:FAt,promise:kxr,readonly:kAt,record:wD,refine:OAt,set:vxr,strictObject:pxr,string:bo,stringFormat:XSr,stringbool:Nxr,success:wxr,superRefine:RAt,symbol:axr,templateLiteral:Exr,transform:JLe,tuple:Vme,uint32:nxr,uint64:sxr,ulid:LSr,undefined:cxr,union:AR,unknown:t$,url:NSr,uuid:ASr,uuidv4:DSr,uuidv6:PSr,uuidv7:ISr,void:uxr,xid:BSr,xor:mxr},Symbol.toStringTag,{value:"Module"})),rht={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 kgn(t){$S({customError:t})}function Agn(){return $S().customError}var nht;nht||(nht={});const iht=ed(["mock","live"]),Rxr=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()}),Fxr=Pa({included:fu().nonnegative(),purchased:fu().nonnegative(),used:fu().nonnegative(),reserved:fu().nonnegative(),remaining:fu().nonnegative(),resetsAt:bo().datetime().optional(),purchasedExpiresAt:bo().datetime().optional()}),Mxr=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()}),Lxr=Pa({id:bo().min(1),email:bo().email(),name:bo().min(1).optional()}),Bxr=Pa({name:bo().min(1),verified:_y(),enrollmentMode:ed(["manual_invitation","automatic_invitation","automatic_suggestion","enterprise_sso"])}),$xr=Pa({id:bo().min(1),name:bo().min(1),slug:bo().min(1).optional(),role:bo().min(1),domains:Gd(Bxr).max(50)}),qxr=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 zxr=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()}))}),Vxr=sAt("authenticated",[Pa({authenticated:Dg(!1),backend:iht}),Pa({authenticated:Dg(!0),backend:iht,user:Lxr,organizations:Gd($xr).max(100).optional(),plan:Rxr,credits:Fxr,spendPolicy:Mxr,alerts:Gd(jxr).max(100).optional(),entitlements:Pa({generation:_y(),dailyJobs:fu().int().positive().optional()})})]),Uxr=ed(["auto","mock","managed","byok"]),MAt=ed(["fal","tripo","worldlabs","openrouter"]),Jxr=Pa({enabled:_y(),provider:Dg("openrouter"),model:bo().trim().min(1).max(256)}),Wxr=ed(["environment","system","session","none"]),Hxr=Pa({provider:MAt,label:bo().min(1),environmentVariable:bo().min(1),configured:_y(),source:Wxr,editable:_y(),persistence:ed(["system","session"]),maskedKey:bo().min(1).optional(),problem:bo().min(1).optional()}),Gxr=Pa({provider:MAt,ok:Dg(!0),testedAt:bo().datetime()});function Kxr(t){return{routes:{mock:!0,managed:t.routes.managed,byok:t.routes.byok,byokProviders:[...t.routes.byokProviders]},preferredRoute:t.preferredRoute}}const wye=ULe(Vxr,Pa({accountEnvironment:ed(["test-mock","development-twin","production"]),routes:Pa({mock:Dg(!0),managed:_y(),byok:_y(),byokProviders:Gd(bo().min(1))}),preferredRoute:Uxr,providerCredentials:Gd(Hxr),codingInference:Jxr}));function Xxr(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 sf(t,n){const s=t.headers.get("content-type")??"";if(!s.includes("application/json"))throw new Error(Xxr(n,s))}function CN(t,n){if(!t.ok)throw new Error(`${n} (${t.status}).`);sf(t,n)}async function L_(t,n){return CN(t,n),await t.json()}const oht="volter.collaboration.participant.v1",Yxr="volter.collaboration.remote-share.v1",QOe=globalThis.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__;function Zxr(){if(QOe?.participantId)return QOe.participantId;const t=globalThis.crypto?.randomUUID?.()??`participant-${Date.now()}`;try{const n=globalThis.localStorage?.getItem(oht);if(n)return n;globalThis.localStorage?.setItem(oht,t)}catch{}return t}const jAt=Zxr(),L$=(()=>{try{return globalThis.localStorage?.getItem(Yxr)==="1"}catch{return!1}})(),Qxr=QOe?.displayName||"Local editor",ewr=Symbol.for("volter.collaboration.revision"),eRe=globalThis[ewr]??={value:0};function LAt(t){Number.isInteger(t)&&t>=eRe.value&&(eRe.value=t)}function Dw(){return{participantId:jAt,expectedRevision:eRe.value}}const twr={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$=twr,BAt=0,tRe=null;const rRe=new Set;function lR(t,n=null){if(!(tRe===n&&JSON.stringify(r$)===JSON.stringify(t))){r$=t,tRe=n,BAt++;for(const s of rRe)s()}}async function $At(t,n){sf(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 wye.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 $At(c,`${n} ${t} failed`);return lR(d),d}function XLe(){return r$}function YLe(){return Kxr(r$)}function cN(){return BAt}function wpe(){return tRe}function Tye(t){return rRe.add(t),()=>rRe.delete(t)}async function sht(){try{const t=await $At(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 rwr=t=>NC("/__editor/account/mock-session","POST",{email:t}),nwr=t=>NC("/__editor/account/twin-session","POST",{email:t}),iwr=()=>NC("/__editor/account/session","DELETE"),owr=t=>NC("/__editor/account/spend-policy","PUT",t),swr=()=>NC("/__editor/account/alerts/read","POST"),awr=t=>NC("/__editor/account/execution-route","PUT",{route:t}),cwr=t=>NC("/__editor/account/coding-inference","PUT",t);async function lwr(t){const n=await fetch("/__editor/account/coding-inference/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});sf(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 uwr=(t,n)=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"PUT",{key:n}),fwr=t=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"DELETE");async function dwr(t){const n=await fetch(`/__editor/account/provider-credentials/${encodeURIComponent(t)}/test`,{method:"POST"});sf(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 Gxr.parse(s)}const aht=t=>NC("/__editor/account/plan","PUT",{action:t});async function qAt(t,n){const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID()},body:JSON.stringify(n)});sf(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(wye.parse(c.account)),{...typeof c.checkoutUrl=="string"?{checkoutUrl:c.checkoutUrl}:{},mock:c.mock===!0}}const pwr=t=>qAt("/__editor/account/checkout",{plan:t}),_wr=t=>qAt("/__editor/account/credits",{packId:t});async function mwr(){const t=await fetch("/__editor/account/usage");sf(t,"Usage failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Usage failed.");return qxr.array().parse(n.entries??[])}async function hwr(){const t=await fetch("/__editor/account/catalog");sf(t,"Catalog failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Catalog failed.");return zxr.parse(n)}async function gwr(){const t=await fetch("/__editor/account/billing-portal",{method:"POST"});sf(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 ywr(){const t=await fetch("/__editor/account/authorization-methods");sf(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 vwr(){const t=await fetch("/__editor/account/browser-authorization",{method:"POST"});sf(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 bwr(t){const n=await fetch(`/__editor/account/browser-authorization/${encodeURIComponent(t)}`);sf(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(wye.parse(s.account)),!0}async function Swr(){const t=await fetch("/__editor/account/device-authorization",{method:"POST"});sf(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 xwr(t){const n=await fetch(`/__editor/account/device-authorization/${encodeURIComponent(t)}`);sf(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(wye.parse(s.account)),!0}function wwr(){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))):sht().catch(()=>{});const n=window.setInterval(()=>void sht().catch(()=>{}),3e4);return()=>window.clearInterval(n)}function zAt(t){return t?UAt(t)?null:t:null}function Twr(t,n){try{return t.ownerOf(n)}catch{return"unresolved"}}function VAt(t){return t&&UAt(t)?t:null}function UAt(t){return t.keyedBy==="display"}const Dgn=Object.freeze(Object.defineProperty({__proto__:null,displayKeyedPhysics:VAt,nodeKeyedPhysics:zAt,physicsOwnerOf:Twr},Symbol.toStringTag,{value:"Module"})),Cwr={"source-prop":!0,"source-structure":!0,"construction-literal":!0,"physics-binding":!0,"data-record":!0,"live-only":!0},ZLe=Object.keys(Cwr);function Ewr(){const t={};for(const n of ZLe)t[n]=0;return t}const kwr={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},QLe=Object.keys(kwr);function Awr(t){const n={};for(const s of QLe)n[s]=t[s]!==void 0;return n}const Pgn=Object.freeze(Object.defineProperty({__proto__:null,AUTHORING_PROVIDER_KEYS:QLe,WRITE_ANCHOR_KINDS:ZLe,emptyWriteAnchorKindCounts:Ewr,measureAuthoringProviders:Awr},Symbol.toStringTag,{value:"Module"})),Dwr=["claim","shape","operation","effect","round-trip"],Hme={claim:0,shape:1,operation:2,effect:3,"round-trip":4};function JAt(t,n){return Hme[t]>=Hme[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||Hme[g.stage]>=Hme[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}:JAt(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 WAt{#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 Pp(){return t=>t}function Pwr(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(Pwr({seam:g,subject:t.subject,epoch:t.epoch,value:S,optional:m.optional,kind:m.kind}))}return n}function Gme(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 Ign=Object.freeze(Object.defineProperty({__proto__:null,SEAM_PROOF_STAGES:Dwr,SeamEvidenceLedger:WAt,defineSeamShape:Pp,gradeSeamCarrier:Gme,gradeSeamEvidence:rQ,inspectSeamShape:vB,seamStageAtLeast:JAt},Symbol.toStringTag,{value:"Module"})),XY=Pp()({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"}}),nRe=Pp()({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"}}),HAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},resolve:{optional:!0,kind:"function",required:"operation"}}),GAt=Pp()({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"}}),KAt=Pp()({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"}}),XAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},entries:{optional:!0,kind:"function",required:"operation"}}),YAt=Pp()({links:{optional:!1,kind:"function",required:"operation"}}),ZAt=Pp()({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"}}),QAt=Pp()({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"}}),e3t=Pp()({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"}}),t3t=Pp()({pick:{optional:!1,kind:"function",required:"operation"},candidates:{optional:!0,kind:"function",required:"operation"}}),r3t=Pp()({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"}}),n3t=Pp()({accepts:{optional:!1,kind:"function",required:"operation"},drop:{optional:!1,kind:"function",required:"round-trip"}}),i3t=Pp()({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"}}),o3t=Pp()({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"}}),s3t=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"}}),a3t=Pp()({backgroundChainAt:{optional:!1,kind:"function",required:"operation"}}),c3t=Pp()({resolve:{optional:!1,kind:"function",required:"operation"}}),l3t=Pp()({layers:{optional:!1,kind:"function",required:"operation"},preview:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"round-trip"}}),iRe={selection:HAt,transforms:GAt,inspector:KAt,assetSubject:XAt,related:YAt,instances:ZAt,structure:QAt,persistence:e3t,pickable:t3t,rects:i3t,boxEdit:o3t,text:s3t,colorSample:a3t,stories:r3t,truth:c3t,spatialHandles:l3t,assetDrop:n3t},Ngn=Object.freeze(Object.defineProperty({__proto__:null,ASSET_DROP_PROVIDER_SHAPE:n3t,ASSET_SUBJECT_PROVIDER_SHAPE:XAt,AUTHORING_ADAPTER_SHAPE:XY,AUTHORING_PROVIDER_SHAPES:iRe,BOX_EDIT_PROVIDER_SHAPE:o3t,COLOR_SAMPLE_PROVIDER_SHAPE:a3t,COMPONENT_INSTANCES_PROVIDER_SHAPE:ZAt,HIERARCHY_PROVIDER_SHAPE:nRe,INSPECTOR_PROVIDER_SHAPE:KAt,PERSISTENCE_PROVIDER_SHAPE:e3t,PICK_PROVIDER_SHAPE:t3t,RECT_PROVIDER_SHAPE:i3t,RELATED_SUBJECTS_PROVIDER_SHAPE:YAt,SELECTION_PROVIDER_SHAPE:HAt,SPATIAL_HANDLES_PROVIDER_SHAPE:l3t,STORIES_PROVIDER_SHAPE:r3t,STRUCTURE_PROVIDER_SHAPE:QAt,TEXT_PROVIDER_SHAPE:s3t,TRANSFORM_PROVIDER_SHAPE:GAt,TRUTH_PROVIDER_SHAPE:c3t},Symbol.toStringTag,{value:"Module"})),oRe=Pp()({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"}}),u3t=Pp()({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"}}),f3t=Pp()({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"}}),d3t=Pp()({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"}}),p3t=Pp()({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"}}),_3t=Pp()({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"}}),m3t=Pp()({snapshot:{optional:!1,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"}}),h3t=Pp()({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"}}),g3t=Pp()({captureFrame:{optional:!1,kind:"function",required:"effect"},memorySnapshot:{optional:!0,kind:"function",required:"operation"}}),y3t={networking:d3t,navigation:p3t,audio:_3t,camera:m3t,debug:h3t,renderDebug:g3t},Ogn=Object.freeze(Object.defineProperty({__proto__:null,AUDIO_ADAPTER_SHAPE:_3t,CAMERA_ADAPTER_SHAPE:m3t,DEBUG_ADAPTER_SHAPE:h3t,NAVIGATION_ADAPTER_SHAPE:p3t,NETWORKING_ADAPTER_SHAPE:d3t,PHYSICS_2D_ADAPTER_SHAPE:f3t,PHYSICS_ADAPTER_SHAPE:u3t,RENDER_DEBUG_ADAPTER_SHAPE:g3t,SYSTEM_ADAPTERS_SHAPE:oRe,SYSTEM_PROVIDER_SHAPES:y3t},Symbol.toStringTag,{value:"Module"})),eBe=new WAt;function Iwr(t){eBe.record(t)}const cht=new WeakMap;let Nwr=1;function v3t(t){const n=cht.get(t);if(n)return n;const s=`system-${Nwr++}`;return cht.set(t,s),s}function Owr(t){const n=t.epoch??v3t(t.adapter),s=`system.${t.slot}`,c={[t.slot]:t.adapter},d=t.slot==="physics"?VAt(t.adapter)?f3t:u3t:y3t[t.slot],m=[...vB({prefix:"system",value:c,shape:oRe,subject:t.subject,epoch:n}).filter(g=>g.seam===s),...vB({prefix:s,value:t.adapter,shape:d,subject:t.subject,epoch:n}),...eBe.receipts({subject:t.subject,epoch:n}),...t.receipts??[]];return Gme({seam:s,subject:t.subject,epoch:n,required:oRe[t.slot].required,receipts:m,shape:d})}let qS={},nQ=null,tBe=null;const Kme=new Set,Xme=new Set,sRe=new Set;let rBe=0;function aRe(){for(const t of sRe)t()}function Yme(t){if(t!==Eye())for(const n of Kme)n()}function Zme(t,n){const s=Aye();if(!(t===kye()&&n.length===s.length&&n.every((c,d)=>c===s[d]))){rBe++;for(const c of Xme)c()}}const LS=new Map;let S_e=null,b3t=0;const cRe=new Set,nBe="";function S3t(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=Owr({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 Qme(){b3t++;for(const t of cRe)t()}function Rwr(t){const n=ZI();if(S_e=t,n!==ZI()){Qme(),rBe++;for(const s of Kme)s();for(const s of Xme)s()}}function Rgn(){return ZI()}function Fwr(t){return cRe.add(t),()=>cRe.delete(t)}function Fgn(){return b3t}function Cye(){const t=ZI();return(t===null?void 0:LS.get(t))??qS}function Mwr(t,n=nBe){const s=ZI(),c=Eye(),d=kye(),m=Aye();if(t){S3t(t,n),LS.set(n,t),qS=t,Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme();return}LS.delete(n),qS=LS.values().next().value??{},Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme()}function jwr(){for(const t of[...LS.keys()])Mwr(null,t);Rwr(null)}function Mgn(t,n=nBe){const s=Eye(),c=kye(),d=Aye(),m=LS.get(n);S3t(t,n),LS.set(n,t),qS===m&&(qS=t),Yme(s),Zme(c,d),aRe(),ZI()===n&&Qme()}function jgn(){return qS}function Lwr(t){return sRe.add(t),()=>sRe.delete(t)}function Bwr(){return[...LS.keys()]}function lht(t){const n=t.filter(d=>d!==nBe),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 uht extends Error{instances;constructor(n,s){super(n),this.name="InstanceResolutionError",this.instances=s}}function $wr(t){const n=Bwr();if(t!==void 0){const s=LS.get(t);if(s)return s;throw new uht(n.length===0?`no instance "${t}" — no game is mounted`:`no instance "${t}" — live: ${lht(n)}`,n)}if(n.length===1)return LS.get(n[0]);if(n.length===0)return qS;throw new uht(`${n.length} instances are live (${lht(n)}) — name one in your program (\`game.instance(id)\`, or \`await game.instances()\` for handles); refusing to guess`,n)}function Lgn(){return zAt(qS.physics)}function qwr(){return qS.camera??null}function Eye(){return qS.networking??tBe??null}function zwr(){return Cye().networking??tBe??null}function Vwr(t){return Kme.add(t),()=>Kme.delete(t)}function Bgn(t){const n=Eye();tBe=t,Yme(n)}function $gn(){return qS.debug??null}function qgn(t){const n=kye(),s=Aye();nQ=t,Zme(n,s)}function kye(){return qS.audio??nQ}function Uwr(){return Cye().audio??nQ}function Jwr(t){return Xme.add(t),()=>Xme.delete(t)}function Wwr(){return rBe}function Aye(){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 Hwr(){return qS.renderDebug??null}function zgn(){return Cye().renderDebug??null}let x3t=null;const lRe=new Set;function Vgn(t){x3t=t;for(const n of lRe)n()}function Dye(){return x3t?.()??null}function Pye(t){lRe.add(t);const n=Fwr(t);return()=>{lRe.delete(t),n()}}function lN(){const t=Dye();return t?`play:${t.instanceId}`:"stopped"}function Iye(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=[],Gwr=0,w3t=0;const uRe=new Set;function fht(){w3t++;for(const t of uRe)t()}function T3t(t){return uRe.add(t),()=>{uRe.delete(t)}}function dht(){return w3t}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:Gwr++};return xO=[...xO,n],fht(),()=>{xO.includes(n)&&(xO=xO.filter(s=>s!==n),fht())}}function fRe(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,C3t=0;const dRe=new Set;function pht(){C3t++;for(const t of dRe)t()}function E3t(t){return dRe.add(t),()=>dRe.delete(t)}function pRe(){return C3t}function iBe(){return x_e}function Kwr(t){const n=Symbol(t.documentId);return x_e={...t,token:n},pht(),()=>{x_e?.token===n&&(x_e=null,pht())}}function Xwr(){Ye.useSyncExternalStore(E3t,pRe);const t=iBe();return t?.status?$.jsx("span",{className:"volter-status-copy","data-testid":"status-asset-editor","data-status-tone":"muted",children:t.status}):null}const Ywr=Iye();function Zwr(){Ywr.ensure(t=>{t(Z4({id:"asset-editor-status",name:"Asset editor",align:"left",order:40,Content:Xwr}))})}Zwr();let bB=null,k3t=0;const _Re=new Set;function _ht(){k3t+=1;for(const t of _Re)t()}function Qwr(t){return _Re.add(t),()=>{_Re.delete(t)}}function mht(){return k3t}function eTr(t,n){const s=Symbol(t);return bB={documentId:t,readSubject:n,token:s},_ht(),()=>{bB?.token===s&&(bB=null,_ht())}}function mRe(){return bB===null?null:{documentId:bB.documentId,subject:bB.readSubject()}}const uN=new Map,hRe=new Map;function A3t(){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"&&A3t()});let Oc=null,oBe=null;function sBe(){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 D3t(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 tTr(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 rTr(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=tTr(t.stories),J=t.boardBuildStartedAtMs===null?"switch-back":"first-open",G=nTr({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:oBe}}function Zb(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 hht(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 nTr(t){return[Tpe("workspace-sync",t.workspaceSyncMs),Tpe("reveal-schedule",t.revealScheduleMs),hht("component-index",t.componentIndexMs,t.componentIndexBusyMs,t.componentIndexWaitMs>0||t.componentIndexMs===0?t.componentIndexWaitMs:t.componentIndexMs),Zb("candidate-collect",t.candidateCollectMs),hht("story-mounts",t.storyMountTotalMs,t.storyMountBusyMs,t.storyMountWaitMs),Zb("bounds",t.boundsMs),Zb("layout",t.layoutMs),Zb("assemble",t.assembleMs),Tpe("react-commit (board→viewport)",t.reactCommitMs),Zb("webgl-context",t.webglContextMs),Zb("renderer",t.rendererMs),Zb("adapter-setup",t.adapterSetupMs),Zb("ibl-bake (three PMREM)",t.iblBakeMs),Zb("dressing",t.dressingMs),Zb("editor-viewport",t.editorViewportMs),Zb("framing",t.framingMs),Zb("resize-bind",t.resizeBindMs),Zb("viewport-bind",t.viewportBindMs),Tpe("raf-wait",t.rafWaitMs),Zb("first-render",t.firstRenderMs)]}function Ugn(t,n=Date.now()){const s=(hRe.get(t)??0)+1;hRe.set(t,s);const c={documentId:t,activation:s,firstFrameAtMs:n},d=Oc;if(d&&d.documentId===t){const m={...c,breakdown:rTr(d,n)};return Oc=null,uN.set(t,m),yht(),ght(),m}return uN.set(t,c),yht(),ght(),c}let gRe=new Set;const yRe=new Set;function ght(){A3t();for(const t of yRe)t()}function iTr(t){return yRe.add(t),()=>yRe.delete(t)}function yht(){uN.size!==0&&P3t()}function P3t(){const t=gRe;gRe=new Set;for(const n of t)n()}let vht=!1;function oTr(){vht||typeof document>"u"||(vht=!0,document.addEventListener("visibilitychange",()=>{document.hidden&&P3t()}))}function Nye(){return uN.size>0||typeof document<"u"&&document.hidden?Promise.resolve():(oTr(),new Promise(t=>gRe.add(t)))}function sTr(){return[...uN.values()]}function aTr(t){sBe()&&(Oc=D3t(t,Date.now(),{}))}function Jgn(t,n={}){if(!sBe())return;const s=Date.now();if(Oc&&Oc.documentId===t){Oc.boardBuildStartedAtMs===null&&(Oc.boardBuildStartedAtMs=s),n.modulesAlreadyLoaded===!0&&(Oc.modulesAlreadyLoaded=!0);return}Oc=D3t(t,s,n),Oc.boardBuildStartedAtMs=s}function Wgn(t){Oc&&(t&&Oc.documentId!==t||(Oc=null))}function Hgn(t,n,s){if(!Oc)return;const c=Math.max(0,n);switch(t){case"component-index":Oc.componentIndexMs=c,Oc.componentIndexBusyMs=Math.max(0,s?.busyMs??0),Oc.componentIndexWaitMs=Math.max(0,s?.waitMs??c);break;case"candidate-collect":Oc.candidateCollectMs=c;break;case"story-mounts":Oc.storyMountTotalMs=c;break;case"bounds":Oc.boundsMs=c;break;case"layout":Oc.layoutMs=c;break;case"assemble":Oc.assembleMs=c;break;case"webgl-context":Oc.webglContextMs=c;break;case"renderer":Oc.rendererMs=c;break;case"adapter-setup":Oc.adapterSetupMs=c;break;case"ibl-bake":Oc.iblBakeMs=c;break;case"dressing":Oc.dressingMs=c;break;case"editor-viewport":Oc.editorViewportMs=c;break;case"framing":Oc.framingMs=c;break;case"resize-bind":Oc.resizeBindMs=c;break;case"viewport-bind":Oc.viewportBindMs=c;break;case"first-render":Oc.firstRenderMs=c;break}}function Ggn(t){!Oc||Oc.documentId!==t||Oc.reactActiveAtMs===null&&(Oc.reactActiveAtMs=Date.now())}function Kgn(t){!Oc||Oc.documentId!==t||Oc.rafResumeAtMs===null&&(Oc.rafResumeAtMs=Date.now())}function Xgn(t){!Oc||Oc.documentId!==t||Oc.firstRenderStartedAtMs===null&&(Oc.firstRenderStartedAtMs=Date.now())}function Ygn(t){Oc&&(t.candidateCount!==void 0&&(Oc.candidateCount=t.candidateCount),t.exhibitCount!==void 0&&(Oc.exhibitCount=t.exhibitCount),t.skippedCount!==void 0&&(Oc.skippedCount=t.skippedCount))}function Zgn(){Oc&&(Oc.boardReadyAtMs=Date.now())}function Qgn(){Oc&&(Oc.constructStartedAtMs=Date.now())}function eyn(){Oc&&(Oc.viewportReadyAtMs=Date.now())}function tyn(t){Oc&&Oc.stories.push(t)}function ryn(){return Oc?.documentId??null}function cTr(t){sBe()&&(oBe=t)}function lTr(){uN.clear(),hRe.clear(),Oc=null,oBe=null}const uTr=["scene","game","world","story","asset","behavior","generation","content-browser","project-tool","tool-contribution","document"];let hp=[],zk=null,n2=null,iQ=null,uR=null;function bht(t){queueMicrotask(()=>{uR===t&&hp.some(n=>n.descriptor.id===t)&&(uR=null,X0(t))})}let I3t=0;const vRe=new Set,w5e=new Set,aBe=new Map,XO=new Map;function TC(){I3t++;for(const t of vRe)t()}function i2(t){return vRe.add(t),()=>{vRe.delete(t)}}function X1(){return I3t}function l0(){return hp}function e_(){return n2}function bRe(){return iQ}function fTr(t,n){X0(t)&&iQ!==n&&(iQ=n,TC())}function CC(){return hp.find(t=>t.descriptor.id===n2)??null}function oQ(t){if(t===n2)return;t&&aTr(t);const n=hp.find(c=>c.descriptor.id===n2);n2=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 dTr(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(dTr(t.id,!!d,n.preview===!0,c),!d)return hp=[...hp,{descriptor:t,dirty:!1,title:t.title}],!t.area&&(c||n2===null)&&oQ(t.id),s&&bht(t.id),TC(),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&&n2!==t.id&&(oQ(t.id),m=!0),m&&TC(),s&&bht(t.id),t.id}function X0(t){return hp.some(n=>n.descriptor.id===t)?(n2!==t&&(oQ(t),TC()),!0):!1}function N3t(){uR=null}function pTr(t){if(X0(t)){uR=null;return}uR=t}function EN(t,n={}){if(w5e.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;w5e.add(t);try{if(n2===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),aBe.delete(t),XO.delete(t),c.descriptor.onDispose?.(t),TC(),!0}finally{w5e.delete(t)}}function O3t(){if(hp.length===0&&n2===null)return;const t=hp;oQ(null),hp=[],iQ=null,zk=null,aBe.clear(),XO.clear(),uR=null;for(const n of t)n.descriptor.onDispose?.(n.descriptor.id);TC()}function _Tr(t,n){return hp.some(s=>s.descriptor.id===t)?(XO.set(t,n),TC(),()=>{XO.get(t)===n&&(XO.delete(t),TC())}):()=>{}}function nyn(t){XO.has(t)&&TC()}async function mTr(t){if(!hp.some(s=>s.descriptor.id===t))return null;const n=aBe.get(t);if(!n)return null;try{return await n()}catch{return!1}}function hTr(){return n2?mTr(n2):Promise.resolve(null)}function iyn(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),TC())}function R3t(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),TC())}function cBe(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 Oye(){return n2?cBe(n2):null}const gTr={adapter:null,nodeId:null};function yTr(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 lBe({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,selection:g}){Ye.useEffect(()=>{if(n)return Kwr({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 _Tr(t,()=>S.current?.()??gTr)},[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=yTr(k);return Ye.useEffect(()=>{if(n)return eTr(t,()=>A.current)},[n,t,F]),null}function vTr({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,fill:g=!1,selection:S,children:k}){return $.jsxs("section",{className:"volter-asset-editor","data-testid":`asset-editor:${s}`,"aria-label":`${c} Asset Editor`,children:[$.jsx(lBe,{documentId:t,active:n,type:s,title:c,sections:d,status:m,selection:S}),$.jsx("main",{className:`volter-asset-editor__viewport${g?" volter-asset-editor__viewport--fill":""}`,children:k})]})}const bTr=Object.freeze(Object.defineProperty({__proto__:null,AssetEditorShell:vTr,AssetEditorSubject:lBe},Symbol.toStringTag,{value:"Module"})),w_e=new Map,SRe=new Set;function Sht(){for(const t of SRe)t()}function oyn(t){const n=Object.entries(t);for(const[s,c]of n)w_e.set(s,c);return Sht(),()=>{for(const[s,c]of n)w_e.get(s)===c&&w_e.delete(s);Sht()}}function STr(t){return w_e.get(t)??null}function xTr(t){return SRe.add(t),()=>{SRe.delete(t)}}function wTr(t){return $.jsx(lBe,{...t})}const xht=new Map;function TTr(t){const n=xht.get(t);if(n)return n;function s(c){const d=Ye.useCallback(()=>STr(t),[]),m=Ye.useSyncExternalStore(xTr,d,d);return m?$.jsx(m,{...c}):$.jsxs("div",{style:{minHeight:240},children:["Loading ",t,"…"]})}return s.displayName=`ContributionSurface(${t})`,xht.set(t,s),s}const uBe=new Proxy(Object.freeze({AssetDocument:wTr}),{get(t,n,s){return typeof n!="string"||Reflect.has(t,n)||!/^[A-Z]/.test(n)?Reflect.get(t,n,s):TTr(n)}}),wht=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)"}}),CTr=["classic","glass"],ETr=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 ehe=null;const the=new Set;function kTr(){return ehe??=[...ETr,...[...SB.values()].map(({id:t,title:n,description:s})=>({id:t,title:n,description:s}))],ehe}function ATr(t){return the.add(t),()=>the.delete(t)}function DTr(t){if(Rye(t.id))throw new Error(`registerContributedMaterial: material "${t.id}" is already registered.`);SB.set(t.id,t),ehe=null;for(const n of the)n();return()=>{if(SB.get(t.id)===t){SB.delete(t.id),ehe=null;for(const n of the)n()}}}function Rye(t){return typeof t=="string"&&(CTr.includes(t)||SB.has(t))}function PTr(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??wht.shape,elevation:d?.elevation??wht.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 ITr={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},NTr={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 F3t({gap:t,align:n,justify:s,padding:c,paddingX:d,paddingY:m,style:g}){return{gap:Cpe(t),alignItems:n?ITr[n]:void 0,justifyContent:s?NTr[s]:void 0,padding:Cpe(c),paddingInline:Cpe(d),paddingBlock:Cpe(m),...g}}function hee(t,n){return n?`${t} ${n}`:t}function M3t({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-stack",t),style:F3t(n)})}function bZ({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-inline",t),style:F3t(n)})}function syn({className:t,...n}){return $.jsx("span",{...n,"aria-hidden":"true",className:hee("volter-spacer",t)})}function OTr({orientation:t="horizontal",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-orientation":t,className:hee("volter-divider",n)})}function RTr({children:t,className:n,...s}){return $.jsx(bZ,{...s,className:hee("volter-actions",n),gap:2,align:"center",children:t})}function j3t(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 $.jsx(A,{...S,ref:k,"data-variant":s,"data-tone":c,"data-truncate":d||void 0,"data-selectable":m||void 0,className:j3t("volter-text",g)})});function ayn({className:t,...n}){return $.jsx("kbd",{...n,className:j3t("volter-keycap",t)})}function B$(t,n){return n?`${t} ${n}`:t}function xRe({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=$.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:$.jsx("div",{...m,role:"dialog","aria-modal":"true","aria-labelledby":t,"data-size":s,"data-variant":c,className:B$("volter-dialog",d)})});return g?$.jsxs($.Fragment,{children:[$.jsx("span",{"data-volter-portal":S,style:{display:"none"}}),MS.createPortal(k,g)]}):k}function wRe({titleId:t,title:n,description:s}){return $.jsxs(M3t,{className:"volter-dialog-header",gap:2,children:[$.jsx(_p,{id:t,as:"h2",variant:"heading",children:n}),s&&$.jsx(_p,{as:"p",tone:"muted",children:s})]})}function L3t({className:t,...n}){return $.jsx(M3t,{...n,className:B$("volter-dialog-body",t)})}function TRe({children:t,className:n,...s}){return $.jsx(RTr,{...s,className:B$("volter-dialog-footer",n),children:t})}function cyn({className:t,...n}){return $.jsx("label",{...n,className:B$("volter-dialog-field",t)})}function lyn({children:t}){return $.jsx(_p,{variant:"label",tone:"muted",children:t})}function uyn({className:t,...n}){return $.jsx(bZ,{...n,className:B$("volter-joined-field",t)})}function fyn({className:t,...n}){return $.jsx("span",{...n,className:B$("volter-joined-field-suffix",t)})}function fBe(t,n){return n?`${t} ${n}`:t}function FTr({className:t,...n}){return $.jsx("div",{...n,className:fBe("volter-field-group",t)})}function T_e({label:t,htmlFor:n,hint:s,compact:c=!1,className:d,children:m,...g}){return $.jsxs("div",{...g,"data-compact":c||void 0,className:fBe("volter-field-row",d),children:[$.jsx("label",{htmlFor:n,className:"volter-field-label",children:t}),$.jsx("div",{className:"volter-field-control",children:m}),s&&$.jsx("div",{className:"volter-field-hint",children:s})]})}function dyn({className:t,...n}){return $.jsx("label",{...n,className:fBe("volter-field-label",t)})}const pyn=Ye.forwardRef(function({selected:n=!1,accent:s="bar",className:c,type:d="button",...m},g){return $.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 MTr({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 $.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&&$.jsx("div",{className:"volter-state-surface-icon",children:n}),$.jsx("strong",{className:"volter-state-surface-title",children:s}),c&&$.jsx("div",{className:"volter-state-surface-description",children:c}),d&&$.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 $.jsx("div",{...d,"data-variant":t,"data-border":n||void 0,"data-scroll":s||void 0,className:$$("volter-surface",c)})}function _yn({tone:t="info",icon:n,actions:s,className:c,children:d,...m}){return $.jsxs("div",{...m,role:t==="error"?"alert":"status","data-tone":t,className:$$("volter-banner",c),children:[n&&$.jsx("span",{className:"volter-banner-icon",children:n}),$.jsx("div",{className:"volter-banner-content",children:d}),s&&$.jsx("div",{className:"volter-banner-actions",children:s})]})}const myn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("div",{ref:c,...s,className:$$("volter-popover",n)})});function hyn({shape:t="label",className:n,...s}){return $.jsx("span",{...s,"data-shape":t,className:$$("volter-badge",n)})}function Tht({position:t="inside",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-position":t,className:$$("volter-drop-indicator",n)})}function gyn({orientation:t,label:n,valueNow:s,valueMin:c=0,valueMax:d=100,className:m,...g}){return $.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 B3t(t,n){return n?`${t} ${n}`:t}const yyn=Ye.forwardRef(function({className:n,onKeyDown:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tablist",className:B3t("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()}})}),vyn=Ye.forwardRef(function({selected:n=!1,dirty:s=!1,badge:c,className:d,type:m="button",tabIndex:g,children:S,...k},A){return $.jsxs("button",{...k,ref:A,type:m,role:"tab",tabIndex:g??(n?0:-1),"aria-selected":n,"data-selected":n||void 0,className:B3t("volter-tab",d),children:[s&&$.jsxs($.Fragment,{children:[$.jsx("span",{className:"volter-tab-dirty",title:"Unsaved","aria-hidden":"true"}),$.jsx("span",{className:"volter-sr-only",children:"Unsaved"})]}),$.jsx("span",{className:"volter-tab-label",children:S}),c!==void 0&&$.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 $.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 Cht({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-toolbar-group",t)})}function Eht(t){return $.jsx("span",{...t,"aria-hidden":"true",className:gee("volter-toolbar-divider",t.className)})}function byn({className:t,onPointerDownCapture:n,...s}){return $.jsx(n$,{...s,compact:!0,className:gee("volter-floating-toolbar volter-glass-island",t),onPointerDownCapture:c=>{n?.(c),c.stopPropagation()}})}function Syn({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-split-button",t)})}function $3t(t,n){return n?`${t} ${n}`:t}const xyn=Ye.forwardRef(function({label:n,className:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tree","aria-label":n,className:$3t("volter-tree",s)})}),wyn=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 $.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:$3t("volter-tree-row",k),style:{paddingLeft:6+Math.max(0,n-1)*14,...F},children:[g&&$.jsx("span",{className:"volter-tree-row-leading",children:g}),$.jsx("span",{className:"volter-tree-row-label",children:A}),S&&$.jsx("span",{className:"volter-tree-row-actions",children:S})]})});function q3t(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 Fye(t,n){return n?`${t} ${n}`:t}function CRe(t){return Array.from(t.querySelectorAll('[role="menuitem"]:not(:disabled), [role="menuitemradio"]:not(:disabled), [role="menuitemcheckbox"]:not(:disabled)'))}function LTr(t){CRe(t)[0]?.focus()}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&&CRe(A.current)[0]?.focus()},[c]),Ye.useEffect(()=>{if(!m)return;const F=D=>{const J=D.target;!A.current?.contains(J)&&!d?.current?.contains(J)&&m("outside")};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,m]),$.jsx("div",{...S,ref:A,role:s,className:Fye("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=CRe(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()}})}),Nc=Ye.forwardRef(function({className:n,type:s="button",role:c="menuitem",onClick:d,onSelect:m,...g},S){return $.jsx("button",{...g,ref:S,type:s,role:c,className:Fye("volter-menu-item",n),onClick:k=>{d?.(k),k.defaultPrevented||m?.()}})});function H1(t){return $.jsx("hr",{...t,className:Fye("volter-menu-separator",t.className)})}const dBe=Ye.forwardRef(function({className:n,type:s="button",...c},d){return $.jsx("button",{...c,ref:d,type:s,"aria-haspopup":c["aria-haspopup"]??"menu",className:Fye("volter-menu-trigger",n)})});function rhe({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)},[]),$.jsxs($.Fragment,{children:[$.jsx("span",{ref:n,"data-volter-portal":d,style:{display:"none"}}),s?MS.createPortal($.jsx("div",{"data-volter-portal-content":d,style:{display:"contents"},children:t}),s):null]})}function pBe({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,q]=Ye.useState(null),G=Ye.useRef(null),se=Ye.useRef(!0),pe=Ye.useRef(!1),ue=Ye.useCallback(()=>{const Fe=t.current;if(!Fe||!F)return;const De=Fe.getBoundingClientRect(),be=F.getBoundingClientRect(),we=s==="right"||s==="left"?{left:s==="right"?De.right+d:De.left-d-be.width,top:De.top}:{left:n==="end"?De.right-be.width:De.left,top:s==="top"?De.top-d-be.height:De.bottom+d},Be=m?q3t({...we,width:be.width,height:be.height}):we,bt=G.current;bt?.left===Be.left&&bt.top===Be.top||(G.current=Be,q(Be))},[n,t,m,d,F,s]);Ye.useLayoutEffect(()=>{const Fe=t.current;if(!Fe||!F)return;ue();let De=0;const be=()=>{ue(),De=requestAnimationFrame(be)};De=requestAnimationFrame(be),window.addEventListener("resize",ue),document.addEventListener("scroll",ue,!0);const X=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return X?.observe(Fe),X?.observe(F),()=>{const we=se.current&&F.contains(document.activeElement);window.removeEventListener("resize",ue),document.removeEventListener("scroll",ue,!0),cancelAnimationFrame(De),X?.disconnect(),we&&queueMicrotask(()=>t.current?.focus())}},[t,F,ue]),Ye.useLayoutEffect(()=>{!c||pe.current||!F||!J||(pe.current=!0,LTr(F))},[c,F,J]);const Ce=Fe=>{se.current=Fe!=="outside",g(),Fe==="escape"&&t.current?.focus()};return $.jsx(rhe,{children:$.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 Tyn({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 $.jsxs($.Fragment,{children:[$.jsxs(Nc,{...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:[$.jsx("span",{style:{flex:1},children:t}),$.jsx("span",{"aria-hidden":"true",style:{paddingInlineStart:"var(--volter-space-4)"},children:"▸"})]}),d&&$.jsx(pBe,{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 $.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 $.jsxs(Ms,{...d,ref:m,variant:n,"data-icon":"true","data-label-placement":s===void 0?void 0:"below",children:[c,s!==void 0&&$.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"},kht={1:"#333333",2:"#444444"},xB={1:"#c5c8ce",2:"#9aa0a6",3:"#90959c"},BTr="#579EFF",$Tr="rgba(87,158,255,0.15)",T5e={1:"#f2f6fb",2:"#d3d9e0",3:"#aab0b7"},_Be="#d8dee9",mBe="rgba(216,222,233,0.18)",z3t="#FF6B6B",V3t="#e0a030",U3t="#4caf50",J3t="rgba(76,175,80,0.15)",W3t="rgba(255,107,107,0.15)",H3t="rgba(224,160,48,0.12)",G3t="rgba(255,107,107,0.06)",K3t="rgba(0,0,0,0.5)",X3t="#ff79c6",Y3t="rgba(255,121,198,0.08)",Z3t="#22b8d6",Mye='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',jye='ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace',C5e={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)"},hBe={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)"},nhe={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)"},Cyn="var(--volter-accent)",Eyn="var(--volter-accent-muted)",kyn={background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},C_e="var(--volter-danger)",Ayn="var(--volter-warn)",Dyn="var(--volter-success)",Pyn="var(--volter-success-muted)",Iyn="var(--volter-danger-muted)",Nyn="var(--volter-warn-muted)",Oyn="var(--volter-danger-faint)",Ryn="var(--volter-scrim)",Fyn="var(--volter-dynamic)",Myn="var(--volter-dynamic-muted)",R_={1:2,2:4,3:6,4:8,5:10,6:12,8:16,10:20,12:24},Q3t={commandBar:36,panelHeader:30,localToolbar:28,treeRow:24,treeIndent:14,statusBar:36,toolSize:34,toolWidth:38,toolGap:7,areaSeam:1,areaEmboss:0},gBe=["solid","clay","unlit","wireframe","matcap","normals","overdraw","preview","rendered"];function Qb(t){return t===void 0?"":`${t}`}function Zp(t){return{control:{...qTr,...t.density?.control},font:{...VTr,...t.density?.font},icon:{...zTr,...t.density?.icon},chrome:{...Q3t,...t.density?.chrome}}}const qTr={compact:20,default:24,comfortable:28},E5e={resting:1,active:2},zTr={xs:9,sm:10,md:12,lg:13,xl:14,"2xl":16},VTr={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"}},jyn="var(--volter-font-sans)",Lyn="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)"},Byn={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)"},Aht={tight:"var(--volter-leading-tight)",snug:"var(--volter-leading-snug)",normal:"var(--volter-leading-normal)",relaxed:"var(--volter-leading-relaxed)"},$yn={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)"}},qyn="var(--volter-focus-ring)",UTr=["outliner","properties"],Lye=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:kht[1],strong:kht[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:BTr,muted:$Tr},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},neutralOverlay:{hover:"rgba(255,255,255,0.08)",active:"rgba(255,255,255,0.14)"},scrim:K3t},typography:{sans:Mye,mono:jye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:C5e.sm,medium:C5e.md,large:C5e.lg}},JTr={...i$,id:"graphite-neutral",color:{...i$.color,content:{primary:T5e[1],muted:T5e[2],dim:T5e[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe}}},WTr={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:Mye,mono:jye},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)"}},ERe={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:_Be,muted:mBe},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},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:Mye,mono:jye},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}},HTr=(()=>{const{treatment:t,...n}=ERe;return{...n,id:"glass-dark-lite",appearance:{material:"glass",transparency:"reduced"},color:{...ERe.color,surface:{shell:"#1a1a1a",panel:"#222222",chrome:"#292929",raised:"#303030",inset:"#1d1d1d",overlay:"#202020"},scrim:K3t}}})(),kRe={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:_Be,muted:mBe},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:Mye,mono:jye},shape:Ym.shape,elevation:Ym.elevation,treatment:Ym.treatment},GTr=(()=>{const{treatment:t,...n}=kRe;return{...n,id:"liquid-glass-lite",appearance:{material:"glass",transparency:"reduced"},color:{...kRe.color,surface:Ym.reducedTransparency.surface,scrim:Ym.reducedTransparency.scrim}}})(),e4t={"graphite-dark":i$,"graphite-neutral":JTr,"midnight-high-contrast":WTr,"glass-dark":ERe,"glass-dark-lite":HTr,"liquid-glass":kRe,"liquid-glass-lite":GTr};function KTr(t){return typeof t=="string"&&Object.hasOwn(e4t,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 XTr(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 YTr(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 Dht(t,n){return n?"transparent":`linear-gradient(var(${t}), var(${t})), linear-gradient(var(--volter-surface-shell), var(--volter-surface-shell))`}function Pht(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 ARe(t){return(t?.contentFrostBlurPx??0)>0?"rgba(255,255,255,0.10)":"transparent"}function ZTr(t){return t?"color-mix(in srgb, currentColor 7%, transparent)":"var(--volter-widget-field)"}function QTr(t){return t?"color-mix(in srgb, currentColor 26%, transparent)":"var(--volter-boundary-default)"}function eCr(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 tCr=.6,rCr=.5;function ihe(t,n){return`rgba(255,255,255,${Math.min(1,Number((t*n/tCr).toFixed(3)))})`}function t4t(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(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 nCr(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(d,n);return`linear-gradient(${s}deg, ${c(.16)} 0%, ${c(.05)} 24%, transparent 40%)`}function iCr(t){const n=t?.edgeSpecular??0,s=t?.thickness??0,c=[];if(n>0&&(c.push(`inset 0 1px 1px ${ihe(.28,n)}`),c.push(`inset 0 -1px 1px ${ihe(.1,n)}`)),s>0){const d=m=>`${Number((m*s/rCr).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 oCr(t){return q$(t)?"var(--volter-surface-panel)":"color-mix(in srgb, var(--volter-surface-panel) 90%, transparent)"}function sCr(t){return q$(t)?t.treatment?"var(--volter-surface-backdrop-filter)":"none":"blur(8px)"}function aCr(t){return t?"17px":"var(--volter-radius-md)"}function cCr(t){return t?"var(--volter-boundary-default)":"var(--volter-boundary-strong)"}function lCr(t){return t?"var(--volter-shadow-lg)":"var(--volter-shadow-sm)"}function uCr(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 Bye(t){return q$(t)}function fCr(t){return Bye(t)?"var(--volter-neutral-active)":"var(--volter-accent-muted)"}function r4t(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 n4t(t){if(!r4t(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 dCr(t){return Bye(t)?"var(--volter-content-primary)":r4t(t.color.accent.muted)?"var(--volter-content-on-accent)":"var(--volter-content-primary)"}function pCr(t){return Bye(t)?"color-mix(in srgb, currentColor 30%, transparent)":n4t(t.color.surface.panel)?`rgb(from ${t.color.accent.muted} r g b / 1)`:"var(--volter-accent)"}function _Cr(t){return Bye(t)?"color-mix(in srgb, currentColor 76%, transparent)":"var(--volter-accent)"}function mCr(t){return t?"var(--volter-radius-full)":"var(--volter-radius-sm)"}function hCr(t){return!q$(t)||!t.treatment?"var(--volter-accent)":uCr(t,.82)??"var(--volter-accent)"}function gCr(t){const n=t?.edgeSpecular??0;return n<=0?"none":t4t({...t,edgeSpecular:n*.4})}function yCr(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 i4t(t){return t<=0?"none":`0 1px 2px rgba(0,0,0,${Number(t.toFixed(3))})`}function o4t(t){return i4t(t?.textShadowOpacity??0)}function vCr(t){return t.treatment?.adaptiveContent?{primary:t.color.content.onBright.primary,muted:t.color.content.onBright.muted,dim:t.color.content.onBright.dim,textShadow:i4t(t.treatment.brightTextShadowOpacity??0),frostBg:t.treatment.brightFrostBg??ARe(t.treatment)}:{primary:t.color.content.primary,muted:t.color.content.muted,dim:t.color.content.dim,textShadow:o4t(t.treatment),frostBg:ARe(t.treatment)}}function bCr(t){return t.treatment?t.treatment.adaptiveContent?"rgba(255,255,255,0.9)":xCr(t.color.surface.chrome,.9):t.color.surface.chrome}function SCr(t){return t.color.surface.panel}function xCr(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 Iht(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 wCr(t){return t.color.boundary.area??t.color.boundary.default}function TCr(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 CCr(t){const n=Zp(t).chrome.areaEmboss;return n>0?`#ffffff ${n}%`:"transparent 100%"}function ECr(t){const n=vCr(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":YTr(t.treatment),"--volter-surface-sticky":Dht("--volter-surface-chrome",s),"--volter-surface-sticky-panel":Dht("--volter-surface-panel",s),"--volter-surface-sticky-backdrop-filter":"none","--volter-surface-body-frost-filter":Pht(t.treatment),"--volter-content-frost-filter":Pht(t.treatment),"--volter-content-frost-bg":ARe(t.treatment),"--volter-input-surface":ZTr(s),"--volter-input-border":QTr(s),"--volter-input-shadow":eCr(s,g),"--volter-structural-divider":s?"transparent":t.color.boundary.default,"--volter-card-specular-ring":t4t(t.treatment),"--volter-card-specular-sheen":nCr(t.treatment),"--volter-card-specular-shadow":iCr(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":yCr(t.treatment),"--volter-island-surface":oCr(t),"--volter-island-backdrop-filter":sCr(t),"--volter-island-radius":aCr(s),"--volter-island-border-color":cCr(s),"--volter-island-shadow":lCr(s),"--volter-island-specular-ring":gCr(t.treatment),"--volter-selection-bg":fCr(t),"--volter-content-on-selection":dCr(t),"--volter-selection-border":pCr(t),"--volter-selection-indicator":_Cr(t),"--volter-island-control-radius":mCr(s),"--volter-island-primary-bg":hCr(t),"--volter-content-text-shadow":o4t(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":bCr(t),"--volter-glass-regular-backdrop-filter":Iht(t.treatment),"--volter-glass-regular-panel-bg":SCr(t),"--volter-glass-regular-panel-backdrop-filter":Iht(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":wCr(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":CCr(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":TCr(t.color.surface.panel,t.color.content.primary),...n4t(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":Qb(t.stage?.wireOpacity),"--volter-viewport-axis-line-width":Qb(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":Qb(t.stage?.gizmoOpacity),"--volter-viewport-gizmo-arrow-length":Qb(t.stage?.gizmoArrowLength),"--volter-viewport-gizmo-arrow-head":Qb(t.stage?.gizmoArrowHead),"--volter-viewport-gizmo-ring-width":Qb(t.stage?.gizmoRingWidth),"--volter-viewport-navigation-gizmo":t.stage?.navigationGizmo??"","--volter-viewport-navigation-corner":t.stage?.navigationCorner??"","--volter-viewport-navigation-size":Qb(t.stage?.navigationSize),"--volter-viewport-gizmo-highlight-saturation":Qb(t.stage?.gizmoHighlightSaturation),"--volter-viewport-gizmo-highlight-value":Qb(t.stage?.gizmoHighlightValue),"--volter-viewport-gizmo-size":t.stage?.gizmoSize===void 0?"":`${t.stage.gizmoSize}`,"--volter-viewport-grid-line-width":Qb(t.stage?.gridLineWidth),"--volter-viewport-grid-major-width":Qb(t.stage?.gridMajorWidth),"--volter-viewport-grid-major-contrast":Qb(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":Qb(t.stage?.outlineWidth),"--volter-viewport-outline-hidden":t.stage?.outlineHidden===void 0?"":`${t.stage.outlineHidden}`,"--volter-viewport-selection-box-width":Qb(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(gBe.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(Lye.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":`${E5e.active}px solid ${t.color.accent.default}`,"--volter-select-chevron":XTr(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":`${Zp(t).chrome.commandBar}px`,"--volter-panel-header-height":`${Zp(t).chrome.panelHeader}px`,"--volter-local-toolbar-height":`${Zp(t).chrome.localToolbar}px`,"--volter-tree-row-height":`${Zp(t).chrome.treeRow}px`,"--volter-tree-indent":`${Zp(t).chrome.treeIndent}px`,"--volter-status-bar-height":`${Zp(t).chrome.statusBar}px`,"--volter-tool-size":`${Zp(t).chrome.toolSize}px`,"--volter-tool-width":`${Zp(t).chrome.toolWidth}px`,"--volter-tool-gap":`${Zp(t).chrome.toolGap}px`,"--volter-area-seam-width":`${Zp(t).chrome.areaSeam}px`,"--volter-control-compact-height":`${Zp(t).control.compact}px`,"--volter-control-default-height":`${Zp(t).control.default}px`,"--volter-control-comfortable-height":`${Zp(t).control.comfortable}px`,"--volter-stroke-resting":`${E5e.resting}px`,"--volter-stroke-active":`${E5e.active}px`,"--volter-font-xs":`${Zp(t).font.xs}px`,"--volter-font-sm":`${Zp(t).font.sm}px`,"--volter-font-base":`${Zp(t).font.base}px`,"--volter-font-md":`${Zp(t).font.md}px`,"--volter-font-lg":`${Zp(t).font.lg}px`,"--volter-font-xl":`${Zp(t).font.xl}px`,"--volter-font-2xl":`${Zp(t).font["2xl"]}px`,"--volter-icon-xs":`${Zp(t).icon.xs}px`,"--volter-icon-sm":`${Zp(t).icon.sm}px`,"--volter-icon-md":`${Zp(t).icon.md}px`,"--volter-icon-lg":`${Zp(t).icon.lg}px`,"--volter-icon-xl":`${Zp(t).icon.xl}px`,"--volter-icon-2xl":`${Zp(t).icon["2xl"]}px`,"--volter-font-heading":`${Zp(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 DRe="volter-editor-theme";function kCr(t,n=i$){t.classList.add(DRe),t.dataset.volterTheme=n.id,t.dataset.volterChrome=q$(n)?"islands":"bars";for(const[s,c]of Object.entries(ECr(n)))t.style.setProperty(s,c)}const zyn={bg:Go.semantic.dangerFaint,border:Go.semantic.danger,fg:Go.semantic.danger},Vyn={bg:Go.semantic.warningMuted,border:Go.semantic.warning,fg:Go.semantic.warning},s4t=Ye.createContext(null);function ACr(){return Ye.useContext(s4t)}function DR(t,n){return n?`${t} ${n}`:t}const Zm=Ye.forwardRef(function({className:n,type:s="text",...c},d){return $.jsx("input",{...c,ref:d,type:s,className:DR("volter-input",n)})}),Iw=Ye.forwardRef(function({className:n,...s},c){return $.jsx("select",{...s,ref:c,className:DR("volter-select",n)})}),yBe=Ye.forwardRef(function({className:n,...s},c){return $.jsx("textarea",{...s,ref:c,className:DR("volter-input volter-textarea",n)})}),TD=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"checkbox",className:DR("volter-checkbox",n)})}),a4t=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"color",className:DR("volter-color-swatch",n)})}),Uyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"file",className:DR("volter-file-input",n)})}),Jyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"range",className:DR("volter-range",n)})}),gC="default",DCr={id:gC,title:"Editor"},wB=new Map;let ohe=null,aQ=gC;const PRe=new Set;function IRe(){for(const t of PRe)t()}function Wyn(){return ohe??=[DCr,...[...wB.values()].map(({id:t,title:n})=>({id:t,title:n}))],ohe}function yee(t){return typeof t=="string"&&(t===gC||wB.has(t))}function PCr(t){if(yee(t.id))throw new Error(`registerContributedIconSet: icon set "${t.id}" is already registered.`);return wB.set(t.id,t),ohe=null,IRe(),()=>{wB.get(t.id)===t&&(wB.delete(t.id),ohe=null,IRe())}}function she(){return aQ}function ahe(t){const n=yee(t)?t:gC;n!==aQ&&(aQ=n,IRe())}function vBe(t){return PRe.add(t),()=>PRe.delete(t)}function c4t(t){return aQ===gC?null:wB.get(aQ)?.glyphs[t]??null}const Nht={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)"},Oht={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(vBe,she,she);const k=c4t(t.iconName);if(k){const A=s!=="current",F=k.tone?`var(--volter-category-${k.tone}, currentColor)`:void 0,D=A?Oht[s]:k.tonedPath?void 0:F,J=A?"currentColor":F??"currentColor";return $.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:Nht[n],color:D,...m},children:[$.jsx("path",{d:k.path,fill:"currentColor"}),k.tonedPath?$.jsx("path",{d:k.tonedPath,fill:J}):null]})}return $.jsx(Kyr,{...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:Nht[n],color:Oht[s],...m}})}function l4t({direction:t,size:n="xs",tone:s="current",style:c}){return $.jsx(dc,{icon:t==="right"?ITt:JTt,size:n,tone:s,...c?{style:c}:{}})}function Hyn({direction:t,size:n="xs",tone:s="current"}){return $.jsx(dc,{icon:t==="right"?ETt:iLe,size:n,tone:s})}function fy(t,n){return{...n,iconName:t}}const Kk={action:{add:GTt,close:rLe,delete:ATt,search:kTt,refresh:H0r,undo:LOe,redo:Cmt,build:z0r,export:W0r,select:Emt},transport:{play:k0r,pause:U0r,restart:Cmt,stop:DTt,step:D0r},content:{project:MOe,folder:uee,file:jTt,source:oLe,scene:aLe,entity:aR,component:GB,camera:nye,light:Qje,image:iB,audio:nLe,data:PTt,code:eLe,stateMachine:OTt},status:{success:tLe,info:R$,warning:fee,error:MTt,visible:Zje,hidden:sLe,locked:Nme,unlocked:jOe},viewport:{zoomIn:p0r,zoomOut:f0r,pan:w0r,frame:l0r,projection:fy("viewport-projection",S5e),projectionOrthographic:fy("viewport-orthographic",S5e),camera:fy("viewport-camera",Tmt),cameraView:fy("viewport-camera-view",Tmt),cameraLocked:fy("viewport-camera-locked",Nme),cameraUnlocked:fy("viewport-camera-unlocked",jOe)},modeling:{extrude:fy("mesh-extrude",RTt),inset:fy("mesh-inset",q0r),bevel:fy("mesh-bevel",G0r),loopCut:fy("mesh-loop-cut",_0r),knife:fy("mesh-knife",j0r),smooth:fy("mesh-smooth",u0r),shrinkFatten:fy("mesh-shrink-fatten",LTt),subdivide:fy("mesh-subdivide",A0r)},tool:{extension:GB,select:fy("tool-select-box",Emt),move:$Tt,rotate:CTt,scale:fy("tool-scale",h0r),transform:fy("tool-transform",T0r),snap:E0r,frame:HTt,grid:S5e,profiler:UTt},panel:{outliner:fy("outliner",XTt),properties:fy("properties",qTt),"folder-open":MOe,"cubes-stacked":BTt,users:m0r,list:vZ,"rotate-left":LOe}};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),[q,G]=Ye.useState(""),se=Ye.useRef({startX:0,startVal:0,dragging:!1,gesture:!1,lastVal:0}),pe=Ye.useRef(null),ue=ACr();Ye.useEffect(()=>{if(!D)return;const we=pe.current;we&&(we.focus(),we.select())},[D]);const Ce=t===null,Fe=t??0,De=Ce?"—":Number.isFinite(Fe)?Fe.toFixed(d):0 .toFixed(d),be=we=>{if(m)return;se.current={startX:we.clientX,startVal:Fe,dragging:!1,gesture:!1,lastVal:Fe};const Be=It=>{const Wt=It.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",Be),window.removeEventListener("pointerup",bt),se.current.gesture&&ue?.end(),se.current.dragging?s?.(se.current.lastVal):(J(!0),G(Ce?"":De))};window.addEventListener("pointermove",Be),window.addEventListener("pointerup",bt)},X=()=>{J(!1);const we=Number.parseFloat(q);Number.isFinite(we)&&(n(we),s?.(we))};return $.jsxs("div",{className:"volter-number-input","data-testid":A,title:F,style:k,children:[g&&$.jsx("span",{className:"volter-number-input-label",style:S?{color:S}:void 0,children:g}),D?$.jsx(Zm,{ref:pe,value:q,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"}):$.jsx("div",{onPointerDown:be,className:"volter-number-input-scrub","data-mixed":Ce||void 0,"data-disabled":m||void 0,children:De})]})}const ICr={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"},NCr={...ICr,background:"var(--volter-surface-sticky)",borderBottom:"1px solid var(--volter-structural-divider)",flexShrink:0};function $ye({name:t,actions:n,onHeaderClick:s,hideHeader:c=!1,style:d,children:m,...g}){return $.jsxs("div",{...g,style:{display:"flex",flexDirection:"column",pointerEvents:"auto",...d},children:[!c&&$.jsxs("div",{role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?S=>{S.key==="Enter"&&s()}:void 0,style:{...NCr,cursor:s?"pointer":void 0,pointerEvents:"auto"},children:[$.jsx("span",{style:{flexShrink:0},children:t}),n&&$.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:R_[3]},children:n})]}),m]})}function OCr({label:t,icon:n,description:s,actions:c,collapsible:d=!0,defaultOpen:m=!0,children:g}){const[S,k]=Ye.useState(m),A=$.jsxs("span",{className:"volter-section-title",children:[$.jsx("span",{children:t}),s?$.jsx("small",{children:s}):null]});return $.jsxs("section",{className:"volter-section",children:[$.jsxs("div",{className:"volter-section-header",children:[d?$.jsxs("button",{type:"button",className:"volter-section-trigger","aria-expanded":S,onClick:()=>k(!S),children:[$.jsx(l4t,{direction:S?"down":"right",style:{fontSize:"var(--volter-section-disclosure-size, var(--volter-icon-xs))"}}),n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}):$.jsxs("div",{className:"volter-section-trigger","data-volter-static":!0,children:[n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}),c?$.jsx("div",{className:"volter-section-actions",children:c}):null]}),(S||!d)&&$.jsx("div",{className:"volter-section-body",children:g})]})}const zI=8,VI=6;function RCr(t){return t==="top"?"bottom":t==="bottom"?"top":t==="left"?"right":"left"}function FCr(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 MCr(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),[q,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()},Fe=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 Be=FCr(c,X,we)?c:RCr(c);pe(MCr(Be,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 De=s;if(Ye.isValidElement(s)){const be=[s.props["aria-describedby"],D?m:null].filter(Boolean).join(" ");De=Ye.cloneElement(s,be?{"aria-describedby":be}:{})}return $.jsxs("span",{ref:g,className:"volter-tooltip-anchor",onMouseEnter:()=>{A.current=!0,Fe(d)},onMouseLeave:()=>{A.current=!1,Ce()},onFocusCapture:()=>{F.current=!0,Fe(0)},onBlurCapture:be=>{be.currentTarget.contains(be.relatedTarget)||(F.current=!1,Ce())},children:[De,D&&q&&MS.createPortal($.jsxs("div",{ref:S,id:m,role:"tooltip",className:"volter-tooltip",style:{left:se.left,top:se.top,visibility:se.ready?"visible":"hidden"},children:[$.jsx("span",{children:t}),n&&$.jsx("kbd",{children:n})]}),q)]})}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 $.jsxs("div",{style:{display:"flex",gap:4},children:[$.jsx(SZ,{label:"X",labelColor:"#E06178",value:t[0],onChange:S(0),step:c,disabled:d,style:{flex:1},testId:g("x")}),$.jsx(SZ,{label:"Y",labelColor:"#C2ED66",value:t[1],onChange:S(1),step:c,disabled:d,style:{flex:1},testId:g("y")}),$.jsx(SZ,{label:"Z",labelColor:"#6BABF5",value:t[2],onChange:S(2),step:c,disabled:d,style:{flex:1},testId:g("z")})]})}const k5e={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},Gyn=Go.typography.sans,Kyn=Go.typography.mono;function Xyn(t,n){t.onChange(n)}function Yyn(t,n){(t.onChangeEnd??t.onChange)(n)}const Zyn={display:"flex",alignItems:"center",gap:4},Qyn={fontSize:"var(--volter-font-sm)",color:Go.content.muted,marginBottom:2},LCr={fontSize:"var(--volter-font-base)",fontWeight:600,color:Go.content.muted,textTransform:"uppercase",letterSpacing:.4},BCr=72;function e0n({label:t,active:n,disabled:s,onClick:c,testId:d}){return $.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 t0n(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 A5e=22,Rht={width:A5e,height:A5e,flex:`0 0 ${A5e}px`,borderRadius:k5e.radiusSmall,border:`1px solid ${k5e.border}`,background:k5e.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 $Cr({value:t,onChange:n,options:s,previewUrlFor:c,disabled:d,note:m,testId:g}){const S=t&&!s.includes(t)?[t,...s]:s;return $.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[t?$.jsx("img",{src:c(t),alt:"",style:Rht,"data-testid":`${g}-thumb`}):$.jsx("span",{style:Rht,"aria-hidden":"true"}),$.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:[$.jsx("option",{value:"",children:"—"}),S.map(k=>$.jsx("option",{value:k,children:k},k))]}),$.jsx(dm,{"data-testid":`${g}-clear`,"aria-label":"Clear this texture slot",title:"Clear this texture slot",disabled:d||!t,onClick:()=>n(""),children:$.jsx(dc,{icon:rLe})})]}),m&&$.jsx("span",{"data-testid":`${g}-note`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.muted},children:m})]})}function NRe({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 $.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,ORe=new Set;let u4t=0;function Fht(){u4t+=1;for(const t of ORe)t()}function r0n(t,n){return k_e.set(t,n),Fht(),()=>{k_e.get(t)===n&&(k_e.delete(t),Fht())}}function bBe(t){return ORe.add(t),()=>ORe.delete(t)}function o$(){return u4t}function o2(t){return t?k_e.get(t)??null:null}const QL=new Map;function n0n(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 qCr(t){return(QL.get(t)??0)>0}const PR=1e4;async function EC(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,che=new Set,A_e=new Set;let f4t=0;function d4t(){f4t+=1;for(const t of[...TB])t()}function zCr(t,n){return xZ.set(t,n),d4t(),()=>{xZ.get(t)===n&&xZ.delete(t)}}function VCr(t){xZ.has(t)&&d4t()}function UCr(t){return TB.add(t),()=>{TB.delete(t)}}function Mht(){return f4t}function cQ(t){return xZ.get(t)}function p4t(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 _4t(t){che.add(t);for(const n of[...A_e])n();return()=>{che.delete(t)}}function m4t(t,n=1e4){return che.has(t)?Promise.resolve(!0):new Promise(s=>{const c=()=>{che.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 SBe(t){if(qCr(t)&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}let RRe=null;const ZY=new Map;let YO=[];function JCr(t){if(RRe=t,!t)return;const n=YO;YO=[];for(const s of n)h4t(t,s)}function h4t(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 WCr=0;function s$(t){const n=t.id??`notification-${++WCr}`,s={...t,id:n};return RRe?h4t(RRe,s):(YO=[...YO.filter(c=>c.id!==n),s],()=>xBe(n))}function xBe(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},lhe=!0,kpe=null,D_e=null,RG=null,P_e=!1;const QY=new Set;function HCr(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 uhe(t){Xk=t;for(const n of QY)n()}async function GCr(){const t=await fetch("/__editor/gameplay-sessions");return(await L_(t,"Could not load Gameplay Sessions")).sessions}async function KCr(t){return L_(await fetch(`/__editor/gameplay-sessions/${encodeURIComponent(t)}`),"Could not load the selected Gameplay Session").then(n=>n.session)}async function XCr(){try{const t={sessions:await GCr()},n=HCr(t.sessions,Xk.sessions,D_e),s=n.sessionId;n.latestAppeared&&(lhe=!0),D_e=s;const c=s?await KCr(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=lhe?m:Math.min(Xk.cursorMs,m);uhe({sessions:d,selectedSessionId:s,selectedSession:c,cursorMs:g,liveEdgeMs:m,loading:!1,error:null})}catch(t){uhe({...Xk,loading:!1,error:t instanceof Error?t.message:String(t)})}}function lQ(){return RG?(P_e=!0,RG):(RG=XCr().finally(()=>{RG=null,P_e&&(P_e=!1,lQ())}),RG)}function YCr(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 ZCr(t){const n=Xk.sessions.find(s=>s.id===t);n&&(D_e=n.id,lhe=!0,uhe({...Xk,selectedSessionId:n.id,selectedSession:n,cursorMs:n.durationMs,liveEdgeMs:n.durationMs}),lQ())}function QCr(t){const n=Math.max(0,Math.min(t,Xk.liveEdgeMs));lhe=Xk.liveEdgeMs-n<250,uhe({...Xk,cursorMs:n})}const g4t={getSnapshot:()=>Xk,subscribe:YCr,select:ZCr,seek:QCr,refresh:lQ};let y4t=null;const FRe=new Set,i0n={getSnapshot:()=>y4t,subscribe(t){return FRe.add(t),()=>FRe.delete(t)}};function o0n(t){y4t=t;for(const n of FRe)try{n()}catch{}}let ZO={phase:null,at:0,run:0},dN=ZO;const MRe=new Map;let v4t=null;function eEr(t){v4t=t,b4t(ZO)}function b4t(t){ZO=t;try{v4t?.(t)}catch{}}function uQ(){const t=[...MRe.values()].at(-1),n=t?{...t,run:dN.run}:dN;n.phase===ZO.phase&&n.at===ZO.at&&n.run===ZO.run||b4t(n)}function s0n(t=Date.now()){return dN={phase:null,at:t,run:dN.run+1},uQ(),ZO.run}function a0n(t,n=Date.now()){dN={phase:t,at:n,run:dN.run},uQ()}function c0n(t=Date.now()){dN={phase:null,at:t,run:dN.run},uQ()}function wBe(t,n=Date.now()){const s=Symbol();return MRe.set(s,{phase:t.slice(0,160),at:n}),uQ(),()=>{MRe.delete(s)&&uQ()}}const tEr=Ye.lazy(()=>fo(()=>import("./GameplaySessionTimeline-1ivaucpv.js"),__vite__mapDeps([252,1,2,3,4,20,21,139,125,140,22,23])).then(t=>({default:t.GameplaySessionTimeline})));class TBe 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?$.jsxs("div",{style:{padding:R_[6],fontSize:"var(--volter-font-md)",color:Go.semantic.danger,maxWidth:640},children:[$.jsxs("div",{style:{fontWeight:600,marginBottom:R_[2]},children:["Tool crashed: ",$.jsx("code",{children:this.props.file})]}),$.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)}),$.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 rEr({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 q=Ye.useRef(s);return q.current=s,Ye.useEffect(()=>{const G=S.current;if(!G)return;let se=!1;A(null);const pe=(Fe,De)=>{if(se)return;const be=Fe instanceof Error?Fe:new Error(String(Fe));console.error(`[tools] ${J.current} crashed while rendering:`,be,De?.componentStack),A(be),q.current&&_4t(q.current)},ue=G.appendChild(document.createElement("div"));ue.style.display="contents";const Ce=Xje.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:Kye(),surfaces:uBe,account:YLe(),work:Ce=>{D.current?.(),D.current=Ce===null?null:wBe(`building ${Ce.replace(/^building /,"")}`)},notify:Ce=>s$({...Ce,id:`contribution:${t.id}:${Ce.title}`,...Ce.tone==="warning"?{fades:!0}:{}}),...t.point==="workspace.analytics"?{gameplaySessions:g4t}:{play:Dye()},...s?{documentId:s,publishContext:Ce=>zCr(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(nEr,{documentId:s},ue):ue)},[m,c,t,n,s,d,g]),$.jsxs($.Fragment,{children:[k?$.jsxs("div",{style:{padding:R_[6],color:Go.semantic.danger},children:["Tool crashed: ",$.jsx("code",{children:t.file}),$.jsx("div",{style:{whiteSpace:"pre-wrap",marginTop:R_[2]},children:String(k)})]}):null,$.jsx("div",{ref:S,style:{minHeight:0,width:"100%"}})]})}function nEr({documentId:t,children:n}){return Ye.useEffect(()=>_4t(t),[t]),$.jsx($.Fragment,{children:n})}function IR({contribution:t,Component:n,documentId:s,active:c,document:d}){const m=Ye.useSyncExternalStore(Tye,cN,cN),g=Ye.useSyncExternalStore(Pye,lN,lN),S=t.point==="workspace.analytics"?"gameplay-sessions":g;return $.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"?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(tEr,{})}):null,$.jsx(TBe,{file:t.file,children:$.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:$.jsx(rEr,{contribution:t,...n?{Component:n}:{},accountRevision:m,playKey:S,...s?{documentId:s}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}})})})]})}function iEr({id:t,title:n,file:s,tool:c,Component:d,adapter:m,nodeId:g}){Ye.useSyncExternalStore(Tye,cN,cN),Ye.useSyncExternalStore(Pye,lN,lN);const S=g?m.hierarchy.node(g):null;return $.jsx("div",{className:"volter-inspector-tool-section","data-testid":`inspector-tool-${t}`,children:$.jsx(TBe,{file:s,children:$.jsx(zvr,{adapter:m,nodeId:g,children:$.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:Kye(),surfaces:uBe,account:YLe(),play:Dye(),node:S,nodeId:g,adapter:m})})})})}const oEr=Symbol("volter.inspection.mixed");function jRe(t){return t===oEr}function CBe(t){return t.readonlyReason??"This field is read-only."}function EBe(t){return"column"}function kBe(t,n){return t.quickActions.filter(s=>s.placement===n)}const LRe="preview",jht="transform",D5e="properties",S4t="stories",l0n="story-args",u0n="Story Args";function Lht(t){return`group:${t}`}const x4t=100,sEr=1e3,fQ=2e3,w4t=3e3,aEr=4e3,cEr=5e3,lEr={nullSubjectId:null};function T4t(t){return"sections"in t}const I_e=[];let C4t=0;const BRe=new Set;function Bht(){C4t++;for(const t of BRe)t()}function uEr(t){return BRe.add(t),()=>{BRe.delete(t)}}function $ht(){return C4t}function E4t(t){return I_e.push(t),Bht(),()=>{const n=I_e.indexOf(t);n>=0&&(I_e.splice(n,1),Bht())}}function qht(t,n,s=lEr){return I_e.filter(c=>c.match(t,n,s))}function k4t(t){if(typeof t!="object"||t===null)return!1;const n=t.name;return n==="Canceled"||n==="CancellationError"||n==="AbortError"}const fEr=1e3;class dEr{_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>fEr){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 ea=new dEr;typeof window<"u"&&(window.__volterEditorConsole=ea);const zht=1e3,Vht=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 $me(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),q=J.schema;if(q.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push(q)):Object.assign(k,q),Object.assign(k,A),g._zod.parent===F)for(const se in k)se==="$ref"||se==="allOf"||se in A||delete k[se];if(q.$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 q in k)q==="$ref"||q==="allOf"||q in J.def&&JSON.stringify(k[q])===JSON.stringify(J.def[q])&&delete k[q]}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:qme(n,"input",t.processors),output:qme(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 fSr=(t,n={})=>s=>{const c=Lme({...s,processors:n});return F_(t,c),Bme(c,t),$me(c,t)},qme=(t,n,s={})=>c=>{const{libraryOptions:d,target:m}=c??{},g=Lme({...d??{},target:m,io:n,processors:s});return F_(t,g),Bme(g,t),$me(g,t)},dSr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tkt=(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=dSr[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}))])}},rkt=(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)},nkt=(t,n,s,c)=>{s.type="boolean"},ikt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},okt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},skt=(t,n,s,c)=>{n.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},akt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ckt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},lkt=(t,n,s,c)=>{s.not={}},ukt=(t,n,s,c)=>{},fkt=(t,n,s,c)=>{},dkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},pkt=(t,n,s,c)=>{const d=t._zod.def,m=dLe(d.entries);m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),s.enum=m},_kt=(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},mkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},hkt=(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},gkt=(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)},ykt=(t,n,s,c)=>{s.type="boolean"},vkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},bkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Skt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},xkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},wkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Tkt=(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"]})},Ckt=(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)},vLe=(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},Ekt=(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},kkt=(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,q)=>F_(J,n,{...c,path:[...c.path,g,q]})),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)},Akt=(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)}},Dkt=(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"}]},Pkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},Ikt=(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))},Nkt=(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)))},Okt=(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},Rkt=(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},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,s.readOnly=!0},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},bLe=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},jkt=(t,n,s,c)=>{const d=t._zod.innerType;F_(d,n,c);const m=n.seen.get(t);m.ref=d},eht={string:tkt,number:rkt,boolean:nkt,bigint:ikt,symbol:okt,null:skt,undefined:akt,void:ckt,never:lkt,any:ukt,unknown:fkt,date:dkt,enum:pkt,literal:_kt,nan:mkt,template_literal:hkt,file:gkt,success:ykt,custom:vkt,function:bkt,transform:Skt,map:xkt,set:wkt,array:Tkt,object:Ckt,union:vLe,intersection:Ekt,tuple:kkt,record:Akt,nullable:Dkt,nonoptional:Pkt,default:Ikt,prefault:Nkt,catch:Okt,pipe:Rkt,readonly:Fkt,promise:Mkt,optional:bLe,lazy:jkt};function pSr(t,n){if("_idmap"in t){const c=t,d=Lme({...n,processors:eht}),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;Bme(d,F),g[A]=$me(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=Lme({...n,processors:eht});return F_(t,s),Bme(s,t),$me(s,t)}const Lkt=ui("ZodISODateTime",(t,n)=>{gbr.init(t,n),j_.init(t,n)});function Bkt(t){return S2r(Lkt,t)}const $kt=ui("ZodISODate",(t,n)=>{ybr.init(t,n),j_.init(t,n)});function qkt(t){return x2r($kt,t)}const zkt=ui("ZodISOTime",(t,n)=>{vbr.init(t,n),j_.init(t,n)});function Vkt(t){return w2r(zkt,t)}const Ukt=ui("ZodISODuration",(t,n)=>{bbr.init(t,n),j_.init(t,n)});function Jkt(t){return T2r(Ukt,t)}const Tgn=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:$kt,ZodISODateTime:Lkt,ZodISODuration:Ukt,ZodISOTime:zkt,date:qkt,datetime:Bkt,duration:Jkt,time:Vkt},Symbol.toStringTag,{value:"Module"})),Wkt=(t,n)=>{ICt.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:s=>f1r(t,s)},flatten:{value:s=>u1r(t,s)},addIssue:{value:s=>{t.issues.push(s),t.message=JSON.stringify(t.issues,Rme,2)}},addIssues:{value:s=>{t.issues.push(...s),t.message=JSON.stringify(t.issues,Rme,2)}},isEmpty:{get(){return t.issues.length===0}}})},Cgn=ui("ZodError",Wkt),Mw=ui("ZodError",Wkt,{Parent:Error}),_Sr=fye(Mw),mSr=dye(Mw),hSr=pye(Mw),gSr=_ye(Mw),ySr=NCt(Mw),vSr=OCt(Mw),bSr=RCt(Mw),SSr=FCt(Mw),xSr=MCt(Mw),wSr=jCt(Mw),TSr=LCt(Mw),CSr=BCt(Mw),Lu=ui("ZodType",(t,n)=>(vu.init(t,n),Object.assign(t["~standard"],{jsonSchema:{input:qme(t,"input"),output:qme(t,"output")}}),t.toJSONSchema=fSr(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)=>_Sr(t,s,c,{callee:t.parse}),t.safeParse=(s,c)=>hSr(t,s,c),t.parseAsync=async(s,c)=>mSr(t,s,c,{callee:t.parseAsync}),t.safeParseAsync=async(s,c)=>gSr(t,s,c),t.spa=t.safeParseAsync,t.encode=(s,c)=>ySr(t,s,c),t.decode=(s,c)=>vSr(t,s,c),t.encodeAsync=async(s,c)=>bSr(t,s,c),t.decodeAsync=async(s,c)=>SSr(t,s,c),t.safeEncode=(s,c)=>xSr(t,s,c),t.safeDecode=(s,c)=>wSr(t,s,c),t.safeEncodeAsync=async(s,c)=>TSr(t,s,c),t.safeDecodeAsync=async(s,c)=>CSr(t,s,c),t.refine=(s,c)=>t.check(OAt(s,c)),t.superRefine=s=>t.check(RAt(s)),t.overwrite=s=>t.check(M$(s)),t.optional=()=>Ume(t),t.exactOptional=()=>mAt(t),t.nullable=()=>Jme(t),t.nullish=()=>Ume(Jme(t)),t.nonoptional=s=>SAt(t,s),t.array=()=>Gd(t),t.or=s=>AR([t,s]),t.and=s=>ULe(t,s),t.transform=s=>Wme(t,JLe(s)),t.default=s=>yAt(t,s),t.prefault=s=>bAt(t,s),t.catch=s=>TAt(t,s),t.pipe=s=>Wme(t,s),t.readonly=()=>kAt(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)),SLe=ui("_ZodString",(t,n)=>{hye.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>tkt(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(U2r(...c)),t.includes=(...c)=>t.check(H2r(...c)),t.startsWith=(...c)=>t.check(G2r(...c)),t.endsWith=(...c)=>t.check(K2r(...c)),t.min=(...c)=>t.check(jme(...c)),t.max=(...c)=>t.check(QEt(...c)),t.length=(...c)=>t.check(ekt(...c)),t.nonempty=(...c)=>t.check(jme(1,...c)),t.lowercase=c=>t.check(J2r(c)),t.uppercase=c=>t.check(W2r(c)),t.trim=()=>t.check(Z2r()),t.normalize=(...c)=>t.check(Y2r(...c)),t.toLowerCase=()=>t.check(Q2r()),t.toUpperCase=()=>t.check(eSr()),t.slugify=()=>t.check(tSr())}),xLe=ui("ZodString",(t,n)=>{hye.init(t,n),SLe.init(t,n),t.email=s=>t.check(NEt(wLe,s)),t.url=s=>t.check(gLe(yye,s)),t.jwt=s=>t.check(YEt(LLe,s)),t.emoji=s=>t.check(jEt(TLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.uuid=s=>t.check(OEt(aD,s)),t.uuidv4=s=>t.check(REt(aD,s)),t.uuidv6=s=>t.check(FEt(aD,s)),t.uuidv7=s=>t.check(MEt(aD,s)),t.nanoid=s=>t.check(LEt(CLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.cuid=s=>t.check(BEt(ELe,s)),t.cuid2=s=>t.check($Et(kLe,s)),t.ulid=s=>t.check(qEt(ALe,s)),t.base64=s=>t.check(GEt(FLe,s)),t.base64url=s=>t.check(KEt(MLe,s)),t.xid=s=>t.check(zEt(DLe,s)),t.ksuid=s=>t.check(VEt(PLe,s)),t.ipv4=s=>t.check(UEt(ILe,s)),t.ipv6=s=>t.check(JEt(NLe,s)),t.cidrv4=s=>t.check(WEt(OLe,s)),t.cidrv6=s=>t.check(HEt(RLe,s)),t.e164=s=>t.check(XEt(jLe,s)),t.datetime=s=>t.check(Bkt(s)),t.date=s=>t.check(qkt(s)),t.time=s=>t.check(Vkt(s)),t.duration=s=>t.check(Jkt(s))});function bo(t){return v2r(xLe,t)}const j_=ui("ZodStringFormat",(t,n)=>{M_.init(t,n),SLe.init(t,n)}),wLe=ui("ZodEmail",(t,n)=>{cbr.init(t,n),j_.init(t,n)});function ESr(t){return NEt(wLe,t)}const zme=ui("ZodGUID",(t,n)=>{sbr.init(t,n),j_.init(t,n)});function kSr(t){return XOe(zme,t)}const aD=ui("ZodUUID",(t,n)=>{abr.init(t,n),j_.init(t,n)});function ASr(t){return OEt(aD,t)}function DSr(t){return REt(aD,t)}function PSr(t){return FEt(aD,t)}function ISr(t){return MEt(aD,t)}const yye=ui("ZodURL",(t,n)=>{lbr.init(t,n),j_.init(t,n)});function NSr(t){return gLe(yye,t)}function OSr(t){return gLe(yye,{protocol:/^https?$/,hostname:iEt,...Jo(t)})}const TLe=ui("ZodEmoji",(t,n)=>{ubr.init(t,n),j_.init(t,n)});function RSr(t){return jEt(TLe,t)}const CLe=ui("ZodNanoID",(t,n)=>{fbr.init(t,n),j_.init(t,n)});function FSr(t){return LEt(CLe,t)}const ELe=ui("ZodCUID",(t,n)=>{dbr.init(t,n),j_.init(t,n)});function MSr(t){return BEt(ELe,t)}const kLe=ui("ZodCUID2",(t,n)=>{pbr.init(t,n),j_.init(t,n)});function jSr(t){return $Et(kLe,t)}const ALe=ui("ZodULID",(t,n)=>{_br.init(t,n),j_.init(t,n)});function LSr(t){return qEt(ALe,t)}const DLe=ui("ZodXID",(t,n)=>{mbr.init(t,n),j_.init(t,n)});function BSr(t){return zEt(DLe,t)}const PLe=ui("ZodKSUID",(t,n)=>{hbr.init(t,n),j_.init(t,n)});function $Sr(t){return VEt(PLe,t)}const ILe=ui("ZodIPv4",(t,n)=>{Sbr.init(t,n),j_.init(t,n)});function qSr(t){return UEt(ILe,t)}const Hkt=ui("ZodMAC",(t,n)=>{wbr.init(t,n),j_.init(t,n)});function zSr(t){return b2r(Hkt,t)}const NLe=ui("ZodIPv6",(t,n)=>{xbr.init(t,n),j_.init(t,n)});function VSr(t){return JEt(NLe,t)}const OLe=ui("ZodCIDRv4",(t,n)=>{Tbr.init(t,n),j_.init(t,n)});function USr(t){return WEt(OLe,t)}const RLe=ui("ZodCIDRv6",(t,n)=>{Cbr.init(t,n),j_.init(t,n)});function JSr(t){return HEt(RLe,t)}const FLe=ui("ZodBase64",(t,n)=>{Ebr.init(t,n),j_.init(t,n)});function WSr(t){return GEt(FLe,t)}const MLe=ui("ZodBase64URL",(t,n)=>{Abr.init(t,n),j_.init(t,n)});function HSr(t){return KEt(MLe,t)}const jLe=ui("ZodE164",(t,n)=>{Dbr.init(t,n),j_.init(t,n)});function GSr(t){return XEt(jLe,t)}const LLe=ui("ZodJWT",(t,n)=>{Ibr.init(t,n),j_.init(t,n)});function KSr(t){return YEt(LLe,t)}const mee=ui("ZodCustomStringFormat",(t,n)=>{Nbr.init(t,n),j_.init(t,n)});function XSr(t,n,s={}){return gye(mee,t,n,s)}function YSr(t){return gye(mee,"hostname",nEt,t)}function ZSr(t){return gye(mee,"hex",vEt,t)}function QSr(t,n){const s=n?.enc??"hex",c=`${t}_${s}`,d=B1r[c];if(!d)throw new Error(`Unrecognized hash format: ${c}`);return gye(mee,c,d,n)}const BLe=ui("ZodNumber",(t,n)=>{TEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>rkt(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(ZOe(c)),t.safe=c=>t.check(ZOe(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(YOe(c,d)),t.step=(c,d)=>t.check(YOe(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 C2r(BLe,t)}const j$=ui("ZodNumberFormat",(t,n)=>{Obr.init(t,n),BLe.init(t,n)});function ZOe(t){return E2r(j$,t)}function exr(t){return k2r(j$,t)}function txr(t){return A2r(j$,t)}function rxr(t){return D2r(j$,t)}function nxr(t){return P2r(j$,t)}const $Le=ui("ZodBoolean",(t,n)=>{CEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>nkt(t,s,c)});function _y(t){return I2r($Le,t)}const qLe=ui("ZodBigInt",(t,n)=>{EEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>ikt(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(YOe(c,d));const s=t._zod.bag;t.minValue=s.minimum??null,t.maxValue=s.maximum??null,t.format=s.format??null});function ixr(t){return N2r(qLe,t)}const zLe=ui("ZodBigIntFormat",(t,n)=>{Rbr.init(t,n),qLe.init(t,n)});function oxr(t){return O2r(zLe,t)}function sxr(t){return R2r(zLe,t)}const Gkt=ui("ZodSymbol",(t,n)=>{Fbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>okt(t,s)});function axr(t){return F2r(Gkt,t)}const Kkt=ui("ZodUndefined",(t,n)=>{Mbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>akt(t,s)});function cxr(t){return M2r(Kkt,t)}const Xkt=ui("ZodNull",(t,n)=>{jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>skt(t,s,c)});function Ykt(t){return j2r(Xkt,t)}const Zkt=ui("ZodAny",(t,n)=>{Lbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ukt()});function lxr(){return L2r(Zkt)}const Qkt=ui("ZodUnknown",(t,n)=>{Bbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>fkt()});function t$(){return B2r(Qkt)}const eAt=ui("ZodNever",(t,n)=>{$br.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>lkt(t,s,c)});function VLe(t){return $2r(eAt,t)}const tAt=ui("ZodVoid",(t,n)=>{qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ckt(t,s)});function uxr(t){return q2r(tAt,t)}const rAt=ui("ZodDate",(t,n)=>{zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>dkt(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 fxr(t){return z2r(rAt,t)}const nAt=ui("ZodArray",(t,n)=>{Vbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Tkt(t,s,c,d),t.element=n.element,t.min=(s,c)=>t.check(jme(s,c)),t.nonempty=s=>t.check(jme(1,s)),t.max=(s,c)=>t.check(QEt(s,c)),t.length=(s,c)=>t.check(ekt(s,c)),t.unwrap=()=>t.element});function Gd(t,n){return rSr(nAt,t,n)}function dxr(t){const n=t._zod.def.shape;return ed(Object.keys(n))}const vye=ui("ZodObject",(t,n)=>{Jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ckt(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:VLe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=s=>wCt(t,s),t.safeExtend=s=>TCt(t,s),t.merge=s=>CCt(t,s),t.pick=s=>SCt(t,s),t.omit=s=>xCt(t,s),t.partial=(...s)=>ECt(WLe,t,s[0]),t.required=(...s)=>kCt(HLe,t,s[0])});function Pa(t,n){const s={type:"object",shape:t??{},...Jo(n)};return new vye(s)}function pxr(t,n){return new vye({type:"object",shape:t,catchall:VLe(),...Jo(n)})}function _xr(t,n){return new vye({type:"object",shape:t,catchall:t$(),...Jo(n)})}const bye=ui("ZodUnion",(t,n)=>{hLe.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function AR(t,n){return new bye({type:"union",options:t,...Jo(n)})}const iAt=ui("ZodXor",(t,n)=>{bye.init(t,n),Wbr.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function mxr(t,n){return new iAt({type:"union",options:t,inclusive:!1,...Jo(n)})}const oAt=ui("ZodDiscriminatedUnion",(t,n)=>{bye.init(t,n),Hbr.init(t,n)});function sAt(t,n,s){return new oAt({type:"union",options:n,discriminator:t,...Jo(s)})}const aAt=ui("ZodIntersection",(t,n)=>{Gbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ekt(t,s,c,d)});function ULe(t,n){return new aAt({type:"intersection",left:t,right:n})}const cAt=ui("ZodTuple",(t,n)=>{DEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>kkt(t,s,c,d),t.rest=s=>t.clone({...t._zod.def,rest:s})});function Vme(t,n,s){const c=n instanceof vu,d=c?s:n,m=c?n:null;return new cAt({type:"tuple",items:t,rest:m,...Jo(d)})}const Sye=ui("ZodRecord",(t,n)=>{Kbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Akt(t,s,c,d),t.keyType=n.keyType,t.valueType=n.valueType});function wD(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,...Jo(s)})}function hxr(t,n,s){const c=sA(t);return c._zod.values=void 0,new Sye({type:"record",keyType:c,valueType:n,...Jo(s)})}function gxr(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,mode:"loose",...Jo(s)})}const lAt=ui("ZodMap",(t,n)=>{Xbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>xkt(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(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function yxr(t,n,s){return new lAt({type:"map",keyType:t,valueType:n,...Jo(s)})}const uAt=ui("ZodSet",(t,n)=>{Ybr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>wkt(t,s),t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function vxr(t,n){return new uAt({type:"set",valueType:t,...Jo(n)})}const tQ=ui("ZodEnum",(t,n)=>{Zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>pkt(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 bxr(t,n){return new tQ({type:"enum",entries:t,...Jo(n)})}const fAt=ui("ZodLiteral",(t,n)=>{Qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>_kt(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 fAt({type:"literal",values:Array.isArray(t)?t:[t],...Jo(n)})}const dAt=ui("ZodFile",(t,n)=>{e2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>gkt(t,s,c),t.min=(s,c)=>t.check(eQ(s,c)),t.max=(s,c)=>t.check(yLe(s,c)),t.mime=(s,c)=>t.check(X2r(Array.isArray(s)?s:[s],c))});function Sxr(t){return nSr(dAt,t)}const pAt=ui("ZodTransform",(t,n)=>{t2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Skt(t,s),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe(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 JLe(t){return new pAt({type:"transform",transform:t})}const WLe=ui("ZodOptional",(t,n)=>{PEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Ume(t){return new WLe({type:"optional",innerType:t})}const _At=ui("ZodExactOptional",(t,n)=>{r2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function mAt(t){return new _At({type:"optional",innerType:t})}const hAt=ui("ZodNullable",(t,n)=>{n2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Dkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Jme(t){return new hAt({type:"nullable",innerType:t})}function xxr(t){return Ume(Jme(t))}const gAt=ui("ZodDefault",(t,n)=>{i2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ikt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yAt(t,n){return new gAt({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const vAt=ui("ZodPrefault",(t,n)=>{o2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Nkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function bAt(t,n){return new vAt({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const HLe=ui("ZodNonOptional",(t,n)=>{s2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Pkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function SAt(t,n){return new HLe({type:"nonoptional",innerType:t,...Jo(n)})}const xAt=ui("ZodSuccess",(t,n)=>{a2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ykt(t,s,c),t.unwrap=()=>t._zod.def.innerType});function wxr(t){return new xAt({type:"success",innerType:t})}const wAt=ui("ZodCatch",(t,n)=>{c2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Okt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function TAt(t,n){return new wAt({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const CAt=ui("ZodNaN",(t,n)=>{l2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>mkt(t,s)});function Txr(t){return V2r(CAt,t)}const GLe=ui("ZodPipe",(t,n)=>{u2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Rkt(t,s,c,d),t.in=n.in,t.out=n.out});function Wme(t,n){return new GLe({type:"pipe",in:t,out:n})}const KLe=ui("ZodCodec",(t,n)=>{GLe.init(t,n),IEt.init(t,n)});function Cxr(t,n,s){return new KLe({type:"pipe",in:t,out:n,transform:s.decode,reverseTransform:s.encode})}const EAt=ui("ZodReadonly",(t,n)=>{f2r.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 kAt(t){return new EAt({type:"readonly",innerType:t})}const AAt=ui("ZodTemplateLiteral",(t,n)=>{d2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>hkt(t,s,c)});function Exr(t,n){return new AAt({type:"template_literal",parts:t,...Jo(n)})}const DAt=ui("ZodLazy",(t,n)=>{m2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>jkt(t,s,c,d),t.unwrap=()=>t._zod.def.getter()});function PAt(t){return new DAt({type:"lazy",getter:t})}const IAt=ui("ZodPromise",(t,n)=>{_2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Mkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function kxr(t){return new IAt({type:"promise",innerType:t})}const NAt=ui("ZodFunction",(t,n)=>{p2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bkt(t,s)});function tht(t){return new NAt({type:"function",input:Array.isArray(t?.input)?Vme(t?.input):t?.input??Gd(t$()),output:t?.output??t$()})}const xye=ui("ZodCustom",(t,n)=>{h2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vkt(t,s)});function Axr(t){const n=new eh({check:"custom"});return n._zod.check=t,n}function YI(t,n){return iSr(xye,t??(()=>!0),n)}function OAt(t,n={}){return oSr(xye,t,n)}function RAt(t){return sSr(t)}const Dxr=cSr,Pxr=lSr;function Ixr(t,n={}){const s=new xye({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 Nxr=(...t)=>uSr({Codec:KLe,Boolean:$Le,String:xLe},...t);function Oxr(t){const n=PAt(()=>AR([bo(t),fu(),_y(),Ykt(),Gd(n),wD(bo(),n)]));return n}function FAt(t,n){return Wme(JLe(t),n)}const Egn=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Zkt,ZodArray:nAt,ZodBase64:FLe,ZodBase64URL:MLe,ZodBigInt:qLe,ZodBigIntFormat:zLe,ZodBoolean:$Le,ZodCIDRv4:OLe,ZodCIDRv6:RLe,ZodCUID:ELe,ZodCUID2:kLe,ZodCatch:wAt,ZodCodec:KLe,ZodCustom:xye,ZodCustomStringFormat:mee,ZodDate:rAt,ZodDefault:gAt,ZodDiscriminatedUnion:oAt,ZodE164:jLe,ZodEmail:wLe,ZodEmoji:TLe,ZodEnum:tQ,ZodExactOptional:_At,ZodFile:dAt,ZodFunction:NAt,ZodGUID:zme,ZodIPv4:ILe,ZodIPv6:NLe,ZodIntersection:aAt,ZodJWT:LLe,ZodKSUID:PLe,ZodLazy:DAt,ZodLiteral:fAt,ZodMAC:Hkt,ZodMap:lAt,ZodNaN:CAt,ZodNanoID:CLe,ZodNever:eAt,ZodNonOptional:HLe,ZodNull:Xkt,ZodNullable:hAt,ZodNumber:BLe,ZodNumberFormat:j$,ZodObject:vye,ZodOptional:WLe,ZodPipe:GLe,ZodPrefault:vAt,ZodPromise:IAt,ZodReadonly:EAt,ZodRecord:Sye,ZodSet:uAt,ZodString:xLe,ZodStringFormat:j_,ZodSuccess:xAt,ZodSymbol:Gkt,ZodTemplateLiteral:AAt,ZodTransform:pAt,ZodTuple:cAt,ZodType:Lu,ZodULID:ALe,ZodURL:yye,ZodUUID:aD,ZodUndefined:Kkt,ZodUnion:bye,ZodUnknown:Qkt,ZodVoid:tAt,ZodXID:DLe,ZodXor:iAt,_ZodString:SLe,_default:yAt,_function:tht,any:lxr,array:Gd,base64:WSr,base64url:HSr,bigint:ixr,boolean:_y,catch:TAt,check:Axr,cidrv4:USr,cidrv6:JSr,codec:Cxr,cuid:MSr,cuid2:jSr,custom:YI,date:fxr,describe:Dxr,discriminatedUnion:sAt,e164:GSr,email:ESr,emoji:RSr,enum:ed,exactOptional:mAt,file:Sxr,float32:exr,float64:txr,function:tht,guid:kSr,hash:QSr,hex:ZSr,hostname:YSr,httpUrl:OSr,instanceof:Ixr,int:ZOe,int32:rxr,int64:oxr,intersection:ULe,ipv4:qSr,ipv6:VSr,json:Oxr,jwt:KSr,keyof:dxr,ksuid:$Sr,lazy:PAt,literal:Dg,looseObject:_xr,looseRecord:gxr,mac:zSr,map:yxr,meta:Pxr,nan:Txr,nanoid:FSr,nativeEnum:bxr,never:VLe,nonoptional:SAt,null:Ykt,nullable:Jme,nullish:xxr,number:fu,object:Pa,optional:Ume,partialRecord:hxr,pipe:Wme,prefault:bAt,preprocess:FAt,promise:kxr,readonly:kAt,record:wD,refine:OAt,set:vxr,strictObject:pxr,string:bo,stringFormat:XSr,stringbool:Nxr,success:wxr,superRefine:RAt,symbol:axr,templateLiteral:Exr,transform:JLe,tuple:Vme,uint32:nxr,uint64:sxr,ulid:LSr,undefined:cxr,union:AR,unknown:t$,url:NSr,uuid:ASr,uuidv4:DSr,uuidv6:PSr,uuidv7:ISr,void:uxr,xid:BSr,xor:mxr},Symbol.toStringTag,{value:"Module"})),rht={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 kgn(t){$S({customError:t})}function Agn(){return $S().customError}var nht;nht||(nht={});const iht=ed(["mock","live"]),Rxr=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()}),Fxr=Pa({included:fu().nonnegative(),purchased:fu().nonnegative(),used:fu().nonnegative(),reserved:fu().nonnegative(),remaining:fu().nonnegative(),resetsAt:bo().datetime().optional(),purchasedExpiresAt:bo().datetime().optional()}),Mxr=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()}),Lxr=Pa({id:bo().min(1),email:bo().email(),name:bo().min(1).optional()}),Bxr=Pa({name:bo().min(1),verified:_y(),enrollmentMode:ed(["manual_invitation","automatic_invitation","automatic_suggestion","enterprise_sso"])}),$xr=Pa({id:bo().min(1),name:bo().min(1),slug:bo().min(1).optional(),role:bo().min(1),domains:Gd(Bxr).max(50)}),qxr=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 zxr=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()}))}),Vxr=sAt("authenticated",[Pa({authenticated:Dg(!1),backend:iht}),Pa({authenticated:Dg(!0),backend:iht,user:Lxr,organizations:Gd($xr).max(100).optional(),plan:Rxr,credits:Fxr,spendPolicy:Mxr,alerts:Gd(jxr).max(100).optional(),entitlements:Pa({generation:_y(),dailyJobs:fu().int().positive().optional()})})]),Uxr=ed(["auto","mock","managed","byok"]),MAt=ed(["fal","tripo","worldlabs","openrouter"]),Jxr=Pa({enabled:_y(),provider:Dg("openrouter"),model:bo().trim().min(1).max(256)}),Wxr=ed(["environment","system","session","none"]),Hxr=Pa({provider:MAt,label:bo().min(1),environmentVariable:bo().min(1),configured:_y(),source:Wxr,editable:_y(),persistence:ed(["system","session"]),maskedKey:bo().min(1).optional(),problem:bo().min(1).optional()}),Gxr=Pa({provider:MAt,ok:Dg(!0),testedAt:bo().datetime()});function Kxr(t){return{routes:{mock:!0,managed:t.routes.managed,byok:t.routes.byok,byokProviders:[...t.routes.byokProviders]},preferredRoute:t.preferredRoute}}const wye=ULe(Vxr,Pa({accountEnvironment:ed(["test-mock","development-twin","production"]),routes:Pa({mock:Dg(!0),managed:_y(),byok:_y(),byokProviders:Gd(bo().min(1))}),preferredRoute:Uxr,providerCredentials:Gd(Hxr),codingInference:Jxr}));function Xxr(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 sf(t,n){const s=t.headers.get("content-type")??"";if(!s.includes("application/json"))throw new Error(Xxr(n,s))}function CN(t,n){if(!t.ok)throw new Error(`${n} (${t.status}).`);sf(t,n)}async function L_(t,n){return CN(t,n),await t.json()}const oht="volter.collaboration.participant.v1",Yxr="volter.collaboration.remote-share.v1",QOe=globalThis.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__;function Zxr(){if(QOe?.participantId)return QOe.participantId;const t=globalThis.crypto?.randomUUID?.()??`participant-${Date.now()}`;try{const n=globalThis.localStorage?.getItem(oht);if(n)return n;globalThis.localStorage?.setItem(oht,t)}catch{}return t}const jAt=Zxr(),L$=(()=>{try{return globalThis.localStorage?.getItem(Yxr)==="1"}catch{return!1}})(),Qxr=QOe?.displayName||"Local editor",ewr=Symbol.for("volter.collaboration.revision"),eRe=globalThis[ewr]??={value:0};function LAt(t){Number.isInteger(t)&&t>=eRe.value&&(eRe.value=t)}function Dw(){return{participantId:jAt,expectedRevision:eRe.value}}const twr={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$=twr,BAt=0,tRe=null;const rRe=new Set;function lR(t,n=null){if(!(tRe===n&&JSON.stringify(r$)===JSON.stringify(t))){r$=t,tRe=n,BAt++;for(const s of rRe)s()}}async function $At(t,n){sf(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 wye.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 $At(c,`${n} ${t} failed`);return lR(d),d}function XLe(){return r$}function YLe(){return Kxr(r$)}function cN(){return BAt}function wpe(){return tRe}function Tye(t){return rRe.add(t),()=>rRe.delete(t)}async function sht(){try{const t=await $At(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 rwr=t=>NC("/__editor/account/mock-session","POST",{email:t}),nwr=t=>NC("/__editor/account/twin-session","POST",{email:t}),iwr=()=>NC("/__editor/account/session","DELETE"),owr=t=>NC("/__editor/account/spend-policy","PUT",t),swr=()=>NC("/__editor/account/alerts/read","POST"),awr=t=>NC("/__editor/account/execution-route","PUT",{route:t}),cwr=t=>NC("/__editor/account/coding-inference","PUT",t);async function lwr(t){const n=await fetch("/__editor/account/coding-inference/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});sf(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 uwr=(t,n)=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"PUT",{key:n}),fwr=t=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"DELETE");async function dwr(t){const n=await fetch(`/__editor/account/provider-credentials/${encodeURIComponent(t)}/test`,{method:"POST"});sf(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 Gxr.parse(s)}const aht=t=>NC("/__editor/account/plan","PUT",{action:t});async function qAt(t,n){const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID()},body:JSON.stringify(n)});sf(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(wye.parse(c.account)),{...typeof c.checkoutUrl=="string"?{checkoutUrl:c.checkoutUrl}:{},mock:c.mock===!0}}const pwr=t=>qAt("/__editor/account/checkout",{plan:t}),_wr=t=>qAt("/__editor/account/credits",{packId:t});async function mwr(){const t=await fetch("/__editor/account/usage");sf(t,"Usage failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Usage failed.");return qxr.array().parse(n.entries??[])}async function hwr(){const t=await fetch("/__editor/account/catalog");sf(t,"Catalog failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Catalog failed.");return zxr.parse(n)}async function gwr(){const t=await fetch("/__editor/account/billing-portal",{method:"POST"});sf(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 ywr(){const t=await fetch("/__editor/account/authorization-methods");sf(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 vwr(){const t=await fetch("/__editor/account/browser-authorization",{method:"POST"});sf(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 bwr(t){const n=await fetch(`/__editor/account/browser-authorization/${encodeURIComponent(t)}`);sf(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(wye.parse(s.account)),!0}async function Swr(){const t=await fetch("/__editor/account/device-authorization",{method:"POST"});sf(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 xwr(t){const n=await fetch(`/__editor/account/device-authorization/${encodeURIComponent(t)}`);sf(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(wye.parse(s.account)),!0}function wwr(){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))):sht().catch(()=>{});const n=window.setInterval(()=>void sht().catch(()=>{}),3e4);return()=>window.clearInterval(n)}function zAt(t){return t?UAt(t)?null:t:null}function Twr(t,n){try{return t.ownerOf(n)}catch{return"unresolved"}}function VAt(t){return t&&UAt(t)?t:null}function UAt(t){return t.keyedBy==="display"}const Dgn=Object.freeze(Object.defineProperty({__proto__:null,displayKeyedPhysics:VAt,nodeKeyedPhysics:zAt,physicsOwnerOf:Twr},Symbol.toStringTag,{value:"Module"})),Cwr={"source-prop":!0,"source-structure":!0,"construction-literal":!0,"physics-binding":!0,"data-record":!0,"live-only":!0},ZLe=Object.keys(Cwr);function Ewr(){const t={};for(const n of ZLe)t[n]=0;return t}const kwr={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},QLe=Object.keys(kwr);function Awr(t){const n={};for(const s of QLe)n[s]=t[s]!==void 0;return n}const Pgn=Object.freeze(Object.defineProperty({__proto__:null,AUTHORING_PROVIDER_KEYS:QLe,WRITE_ANCHOR_KINDS:ZLe,emptyWriteAnchorKindCounts:Ewr,measureAuthoringProviders:Awr},Symbol.toStringTag,{value:"Module"})),Dwr=["claim","shape","operation","effect","round-trip"],Hme={claim:0,shape:1,operation:2,effect:3,"round-trip":4};function JAt(t,n){return Hme[t]>=Hme[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||Hme[g.stage]>=Hme[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}:JAt(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 WAt{#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 Pp(){return t=>t}function Pwr(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(Pwr({seam:g,subject:t.subject,epoch:t.epoch,value:S,optional:m.optional,kind:m.kind}))}return n}function Gme(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 Ign=Object.freeze(Object.defineProperty({__proto__:null,SEAM_PROOF_STAGES:Dwr,SeamEvidenceLedger:WAt,defineSeamShape:Pp,gradeSeamCarrier:Gme,gradeSeamEvidence:rQ,inspectSeamShape:vB,seamStageAtLeast:JAt},Symbol.toStringTag,{value:"Module"})),XY=Pp()({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"}}),nRe=Pp()({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"}}),HAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},resolve:{optional:!0,kind:"function",required:"operation"}}),GAt=Pp()({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"}}),KAt=Pp()({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"}}),XAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},entries:{optional:!0,kind:"function",required:"operation"}}),YAt=Pp()({links:{optional:!1,kind:"function",required:"operation"}}),ZAt=Pp()({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"}}),QAt=Pp()({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"}}),e3t=Pp()({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"}}),t3t=Pp()({pick:{optional:!1,kind:"function",required:"operation"},candidates:{optional:!0,kind:"function",required:"operation"}}),r3t=Pp()({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"}}),n3t=Pp()({accepts:{optional:!1,kind:"function",required:"operation"},drop:{optional:!1,kind:"function",required:"round-trip"}}),i3t=Pp()({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"}}),o3t=Pp()({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"}}),s3t=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"}}),a3t=Pp()({backgroundChainAt:{optional:!1,kind:"function",required:"operation"}}),c3t=Pp()({resolve:{optional:!1,kind:"function",required:"operation"}}),l3t=Pp()({layers:{optional:!1,kind:"function",required:"operation"},preview:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"round-trip"}}),iRe={selection:HAt,transforms:GAt,inspector:KAt,assetSubject:XAt,related:YAt,instances:ZAt,structure:QAt,persistence:e3t,pickable:t3t,rects:i3t,boxEdit:o3t,text:s3t,colorSample:a3t,stories:r3t,truth:c3t,spatialHandles:l3t,assetDrop:n3t},Ngn=Object.freeze(Object.defineProperty({__proto__:null,ASSET_DROP_PROVIDER_SHAPE:n3t,ASSET_SUBJECT_PROVIDER_SHAPE:XAt,AUTHORING_ADAPTER_SHAPE:XY,AUTHORING_PROVIDER_SHAPES:iRe,BOX_EDIT_PROVIDER_SHAPE:o3t,COLOR_SAMPLE_PROVIDER_SHAPE:a3t,COMPONENT_INSTANCES_PROVIDER_SHAPE:ZAt,HIERARCHY_PROVIDER_SHAPE:nRe,INSPECTOR_PROVIDER_SHAPE:KAt,PERSISTENCE_PROVIDER_SHAPE:e3t,PICK_PROVIDER_SHAPE:t3t,RECT_PROVIDER_SHAPE:i3t,RELATED_SUBJECTS_PROVIDER_SHAPE:YAt,SELECTION_PROVIDER_SHAPE:HAt,SPATIAL_HANDLES_PROVIDER_SHAPE:l3t,STORIES_PROVIDER_SHAPE:r3t,STRUCTURE_PROVIDER_SHAPE:QAt,TEXT_PROVIDER_SHAPE:s3t,TRANSFORM_PROVIDER_SHAPE:GAt,TRUTH_PROVIDER_SHAPE:c3t},Symbol.toStringTag,{value:"Module"})),oRe=Pp()({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"}}),u3t=Pp()({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"}}),f3t=Pp()({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"}}),d3t=Pp()({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"}}),p3t=Pp()({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"}}),_3t=Pp()({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"}}),m3t=Pp()({snapshot:{optional:!1,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"}}),h3t=Pp()({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"}}),g3t=Pp()({captureFrame:{optional:!1,kind:"function",required:"effect"},memorySnapshot:{optional:!0,kind:"function",required:"operation"}}),y3t={networking:d3t,navigation:p3t,audio:_3t,camera:m3t,debug:h3t,renderDebug:g3t},Ogn=Object.freeze(Object.defineProperty({__proto__:null,AUDIO_ADAPTER_SHAPE:_3t,CAMERA_ADAPTER_SHAPE:m3t,DEBUG_ADAPTER_SHAPE:h3t,NAVIGATION_ADAPTER_SHAPE:p3t,NETWORKING_ADAPTER_SHAPE:d3t,PHYSICS_2D_ADAPTER_SHAPE:f3t,PHYSICS_ADAPTER_SHAPE:u3t,RENDER_DEBUG_ADAPTER_SHAPE:g3t,SYSTEM_ADAPTERS_SHAPE:oRe,SYSTEM_PROVIDER_SHAPES:y3t},Symbol.toStringTag,{value:"Module"})),eBe=new WAt;function Iwr(t){eBe.record(t)}const cht=new WeakMap;let Nwr=1;function v3t(t){const n=cht.get(t);if(n)return n;const s=`system-${Nwr++}`;return cht.set(t,s),s}function Owr(t){const n=t.epoch??v3t(t.adapter),s=`system.${t.slot}`,c={[t.slot]:t.adapter},d=t.slot==="physics"?VAt(t.adapter)?f3t:u3t:y3t[t.slot],m=[...vB({prefix:"system",value:c,shape:oRe,subject:t.subject,epoch:n}).filter(g=>g.seam===s),...vB({prefix:s,value:t.adapter,shape:d,subject:t.subject,epoch:n}),...eBe.receipts({subject:t.subject,epoch:n}),...t.receipts??[]];return Gme({seam:s,subject:t.subject,epoch:n,required:oRe[t.slot].required,receipts:m,shape:d})}let qS={},nQ=null,tBe=null;const Kme=new Set,Xme=new Set,sRe=new Set;let rBe=0;function aRe(){for(const t of sRe)t()}function Yme(t){if(t!==Eye())for(const n of Kme)n()}function Zme(t,n){const s=Aye();if(!(t===kye()&&n.length===s.length&&n.every((c,d)=>c===s[d]))){rBe++;for(const c of Xme)c()}}const LS=new Map;let S_e=null,b3t=0;const cRe=new Set,nBe="";function S3t(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=Owr({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 Qme(){b3t++;for(const t of cRe)t()}function Rwr(t){const n=ZI();if(S_e=t,n!==ZI()){Qme(),rBe++;for(const s of Kme)s();for(const s of Xme)s()}}function Rgn(){return ZI()}function Fwr(t){return cRe.add(t),()=>cRe.delete(t)}function Fgn(){return b3t}function Cye(){const t=ZI();return(t===null?void 0:LS.get(t))??qS}function Mwr(t,n=nBe){const s=ZI(),c=Eye(),d=kye(),m=Aye();if(t){S3t(t,n),LS.set(n,t),qS=t,Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme();return}LS.delete(n),qS=LS.values().next().value??{},Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme()}function jwr(){for(const t of[...LS.keys()])Mwr(null,t);Rwr(null)}function Mgn(t,n=nBe){const s=Eye(),c=kye(),d=Aye(),m=LS.get(n);S3t(t,n),LS.set(n,t),qS===m&&(qS=t),Yme(s),Zme(c,d),aRe(),ZI()===n&&Qme()}function jgn(){return qS}function Lwr(t){return sRe.add(t),()=>sRe.delete(t)}function Bwr(){return[...LS.keys()]}function lht(t){const n=t.filter(d=>d!==nBe),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 uht extends Error{instances;constructor(n,s){super(n),this.name="InstanceResolutionError",this.instances=s}}function $wr(t){const n=Bwr();if(t!==void 0){const s=LS.get(t);if(s)return s;throw new uht(n.length===0?`no instance "${t}" — no game is mounted`:`no instance "${t}" — live: ${lht(n)}`,n)}if(n.length===1)return LS.get(n[0]);if(n.length===0)return qS;throw new uht(`${n.length} instances are live (${lht(n)}) — name one in your program (\`game.instance(id)\`, or \`await game.instances()\` for handles); refusing to guess`,n)}function Lgn(){return zAt(qS.physics)}function qwr(){return qS.camera??null}function Eye(){return qS.networking??tBe??null}function zwr(){return Cye().networking??tBe??null}function Vwr(t){return Kme.add(t),()=>Kme.delete(t)}function Bgn(t){const n=Eye();tBe=t,Yme(n)}function $gn(){return qS.debug??null}function qgn(t){const n=kye(),s=Aye();nQ=t,Zme(n,s)}function kye(){return qS.audio??nQ}function Uwr(){return Cye().audio??nQ}function Jwr(t){return Xme.add(t),()=>Xme.delete(t)}function Wwr(){return rBe}function Aye(){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 Hwr(){return qS.renderDebug??null}function zgn(){return Cye().renderDebug??null}let x3t=null;const lRe=new Set;function Vgn(t){x3t=t;for(const n of lRe)n()}function Dye(){return x3t?.()??null}function Pye(t){lRe.add(t);const n=Fwr(t);return()=>{lRe.delete(t),n()}}function lN(){const t=Dye();return t?`play:${t.instanceId}`:"stopped"}function Iye(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=[],Gwr=0,w3t=0;const uRe=new Set;function fht(){w3t++;for(const t of uRe)t()}function T3t(t){return uRe.add(t),()=>{uRe.delete(t)}}function dht(){return w3t}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:Gwr++};return xO=[...xO,n],fht(),()=>{xO.includes(n)&&(xO=xO.filter(s=>s!==n),fht())}}function fRe(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,C3t=0;const dRe=new Set;function pht(){C3t++;for(const t of dRe)t()}function E3t(t){return dRe.add(t),()=>dRe.delete(t)}function pRe(){return C3t}function iBe(){return x_e}function Kwr(t){const n=Symbol(t.documentId);return x_e={...t,token:n},pht(),()=>{x_e?.token===n&&(x_e=null,pht())}}function Xwr(){Ye.useSyncExternalStore(E3t,pRe);const t=iBe();return t?.status?$.jsx("span",{className:"volter-status-copy","data-testid":"status-asset-editor","data-status-tone":"muted",children:t.status}):null}const Ywr=Iye();function Zwr(){Ywr.ensure(t=>{t(Z4({id:"asset-editor-status",name:"Asset editor",align:"left",order:40,Content:Xwr}))})}Zwr();let bB=null,k3t=0;const _Re=new Set;function _ht(){k3t+=1;for(const t of _Re)t()}function Qwr(t){return _Re.add(t),()=>{_Re.delete(t)}}function mht(){return k3t}function eTr(t,n){const s=Symbol(t);return bB={documentId:t,readSubject:n,token:s},_ht(),()=>{bB?.token===s&&(bB=null,_ht())}}function mRe(){return bB===null?null:{documentId:bB.documentId,subject:bB.readSubject()}}const uN=new Map,hRe=new Map;function A3t(){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"&&A3t()});let Oc=null,oBe=null;function sBe(){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 D3t(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 tTr(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 rTr(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=tTr(t.stories),J=t.boardBuildStartedAtMs===null?"switch-back":"first-open",G=nTr({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:oBe}}function Zb(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 hht(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 nTr(t){return[Tpe("workspace-sync",t.workspaceSyncMs),Tpe("reveal-schedule",t.revealScheduleMs),hht("component-index",t.componentIndexMs,t.componentIndexBusyMs,t.componentIndexWaitMs>0||t.componentIndexMs===0?t.componentIndexWaitMs:t.componentIndexMs),Zb("candidate-collect",t.candidateCollectMs),hht("story-mounts",t.storyMountTotalMs,t.storyMountBusyMs,t.storyMountWaitMs),Zb("bounds",t.boundsMs),Zb("layout",t.layoutMs),Zb("assemble",t.assembleMs),Tpe("react-commit (board→viewport)",t.reactCommitMs),Zb("webgl-context",t.webglContextMs),Zb("renderer",t.rendererMs),Zb("adapter-setup",t.adapterSetupMs),Zb("ibl-bake (three PMREM)",t.iblBakeMs),Zb("dressing",t.dressingMs),Zb("editor-viewport",t.editorViewportMs),Zb("framing",t.framingMs),Zb("resize-bind",t.resizeBindMs),Zb("viewport-bind",t.viewportBindMs),Tpe("raf-wait",t.rafWaitMs),Zb("first-render",t.firstRenderMs)]}function Ugn(t,n=Date.now()){const s=(hRe.get(t)??0)+1;hRe.set(t,s);const c={documentId:t,activation:s,firstFrameAtMs:n},d=Oc;if(d&&d.documentId===t){const m={...c,breakdown:rTr(d,n)};return Oc=null,uN.set(t,m),yht(),ght(),m}return uN.set(t,c),yht(),ght(),c}let gRe=new Set;const yRe=new Set;function ght(){A3t();for(const t of yRe)t()}function iTr(t){return yRe.add(t),()=>yRe.delete(t)}function yht(){uN.size!==0&&P3t()}function P3t(){const t=gRe;gRe=new Set;for(const n of t)n()}let vht=!1;function oTr(){vht||typeof document>"u"||(vht=!0,document.addEventListener("visibilitychange",()=>{document.hidden&&P3t()}))}function Nye(){return uN.size>0||typeof document<"u"&&document.hidden?Promise.resolve():(oTr(),new Promise(t=>gRe.add(t)))}function sTr(){return[...uN.values()]}function aTr(t){sBe()&&(Oc=D3t(t,Date.now(),{}))}function Jgn(t,n={}){if(!sBe())return;const s=Date.now();if(Oc&&Oc.documentId===t){Oc.boardBuildStartedAtMs===null&&(Oc.boardBuildStartedAtMs=s),n.modulesAlreadyLoaded===!0&&(Oc.modulesAlreadyLoaded=!0);return}Oc=D3t(t,s,n),Oc.boardBuildStartedAtMs=s}function Wgn(t){Oc&&(t&&Oc.documentId!==t||(Oc=null))}function Hgn(t,n,s){if(!Oc)return;const c=Math.max(0,n);switch(t){case"component-index":Oc.componentIndexMs=c,Oc.componentIndexBusyMs=Math.max(0,s?.busyMs??0),Oc.componentIndexWaitMs=Math.max(0,s?.waitMs??c);break;case"candidate-collect":Oc.candidateCollectMs=c;break;case"story-mounts":Oc.storyMountTotalMs=c;break;case"bounds":Oc.boundsMs=c;break;case"layout":Oc.layoutMs=c;break;case"assemble":Oc.assembleMs=c;break;case"webgl-context":Oc.webglContextMs=c;break;case"renderer":Oc.rendererMs=c;break;case"adapter-setup":Oc.adapterSetupMs=c;break;case"ibl-bake":Oc.iblBakeMs=c;break;case"dressing":Oc.dressingMs=c;break;case"editor-viewport":Oc.editorViewportMs=c;break;case"framing":Oc.framingMs=c;break;case"resize-bind":Oc.resizeBindMs=c;break;case"viewport-bind":Oc.viewportBindMs=c;break;case"first-render":Oc.firstRenderMs=c;break}}function Ggn(t){!Oc||Oc.documentId!==t||Oc.reactActiveAtMs===null&&(Oc.reactActiveAtMs=Date.now())}function Kgn(t){!Oc||Oc.documentId!==t||Oc.rafResumeAtMs===null&&(Oc.rafResumeAtMs=Date.now())}function Xgn(t){!Oc||Oc.documentId!==t||Oc.firstRenderStartedAtMs===null&&(Oc.firstRenderStartedAtMs=Date.now())}function Ygn(t){Oc&&(t.candidateCount!==void 0&&(Oc.candidateCount=t.candidateCount),t.exhibitCount!==void 0&&(Oc.exhibitCount=t.exhibitCount),t.skippedCount!==void 0&&(Oc.skippedCount=t.skippedCount))}function Zgn(){Oc&&(Oc.boardReadyAtMs=Date.now())}function Qgn(){Oc&&(Oc.constructStartedAtMs=Date.now())}function eyn(){Oc&&(Oc.viewportReadyAtMs=Date.now())}function tyn(t){Oc&&Oc.stories.push(t)}function ryn(){return Oc?.documentId??null}function cTr(t){sBe()&&(oBe=t)}function lTr(){uN.clear(),hRe.clear(),Oc=null,oBe=null}const uTr=["scene","game","world","story","asset","behavior","generation","content-browser","project-tool","tool-contribution","document"];let hp=[],zk=null,n2=null,iQ=null,uR=null;function bht(t){queueMicrotask(()=>{uR===t&&hp.some(n=>n.descriptor.id===t)&&(uR=null,X0(t))})}let I3t=0;const vRe=new Set,w5e=new Set,aBe=new Map,XO=new Map;function TC(){I3t++;for(const t of vRe)t()}function i2(t){return vRe.add(t),()=>{vRe.delete(t)}}function X1(){return I3t}function l0(){return hp}function e_(){return n2}function bRe(){return iQ}function fTr(t,n){X0(t)&&iQ!==n&&(iQ=n,TC())}function CC(){return hp.find(t=>t.descriptor.id===n2)??null}function oQ(t){if(t===n2)return;t&&aTr(t);const n=hp.find(c=>c.descriptor.id===n2);n2=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 dTr(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(dTr(t.id,!!d,n.preview===!0,c),!d)return hp=[...hp,{descriptor:t,dirty:!1,title:t.title}],!t.area&&(c||n2===null)&&oQ(t.id),s&&bht(t.id),TC(),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&&n2!==t.id&&(oQ(t.id),m=!0),m&&TC(),s&&bht(t.id),t.id}function X0(t){return hp.some(n=>n.descriptor.id===t)?(n2!==t&&(oQ(t),TC()),!0):!1}function N3t(){uR=null}function pTr(t){if(X0(t)){uR=null;return}uR=t}function EN(t,n={}){if(w5e.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;w5e.add(t);try{if(n2===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),aBe.delete(t),XO.delete(t),c.descriptor.onDispose?.(t),TC(),!0}finally{w5e.delete(t)}}function O3t(){if(hp.length===0&&n2===null)return;const t=hp;oQ(null),hp=[],iQ=null,zk=null,aBe.clear(),XO.clear(),uR=null;for(const n of t)n.descriptor.onDispose?.(n.descriptor.id);TC()}function _Tr(t,n){return hp.some(s=>s.descriptor.id===t)?(XO.set(t,n),TC(),()=>{XO.get(t)===n&&(XO.delete(t),TC())}):()=>{}}function nyn(t){XO.has(t)&&TC()}async function mTr(t){if(!hp.some(s=>s.descriptor.id===t))return null;const n=aBe.get(t);if(!n)return null;try{return await n()}catch{return!1}}function hTr(){return n2?mTr(n2):Promise.resolve(null)}function iyn(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),TC())}function R3t(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),TC())}function cBe(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 Oye(){return n2?cBe(n2):null}const gTr={adapter:null,nodeId:null};function yTr(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 lBe({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,selection:g}){Ye.useEffect(()=>{if(n)return Kwr({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 _Tr(t,()=>S.current?.()??gTr)},[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=yTr(k);return Ye.useEffect(()=>{if(n)return eTr(t,()=>A.current)},[n,t,F]),null}function vTr({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,fill:g=!1,selection:S,children:k}){return $.jsxs("section",{className:"volter-asset-editor","data-testid":`asset-editor:${s}`,"aria-label":`${c} Asset Editor`,children:[$.jsx(lBe,{documentId:t,active:n,type:s,title:c,sections:d,status:m,selection:S}),$.jsx("main",{className:`volter-asset-editor__viewport${g?" volter-asset-editor__viewport--fill":""}`,children:k})]})}const bTr=Object.freeze(Object.defineProperty({__proto__:null,AssetEditorShell:vTr,AssetEditorSubject:lBe},Symbol.toStringTag,{value:"Module"})),w_e=new Map,SRe=new Set;function Sht(){for(const t of SRe)t()}function oyn(t){const n=Object.entries(t);for(const[s,c]of n)w_e.set(s,c);return Sht(),()=>{for(const[s,c]of n)w_e.get(s)===c&&w_e.delete(s);Sht()}}function STr(t){return w_e.get(t)??null}function xTr(t){return SRe.add(t),()=>{SRe.delete(t)}}function wTr(t){return $.jsx(lBe,{...t})}const xht=new Map;function TTr(t){const n=xht.get(t);if(n)return n;function s(c){const d=Ye.useCallback(()=>STr(t),[]),m=Ye.useSyncExternalStore(xTr,d,d);return m?$.jsx(m,{...c}):$.jsxs("div",{style:{minHeight:240},children:["Loading ",t,"…"]})}return s.displayName=`ContributionSurface(${t})`,xht.set(t,s),s}const uBe=new Proxy(Object.freeze({AssetDocument:wTr}),{get(t,n,s){return typeof n!="string"||Reflect.has(t,n)||!/^[A-Z]/.test(n)?Reflect.get(t,n,s):TTr(n)}}),wht=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)"}}),CTr=["classic","glass"],ETr=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 ehe=null;const the=new Set;function kTr(){return ehe??=[...ETr,...[...SB.values()].map(({id:t,title:n,description:s})=>({id:t,title:n,description:s}))],ehe}function ATr(t){return the.add(t),()=>the.delete(t)}function DTr(t){if(Rye(t.id))throw new Error(`registerContributedMaterial: material "${t.id}" is already registered.`);SB.set(t.id,t),ehe=null;for(const n of the)n();return()=>{if(SB.get(t.id)===t){SB.delete(t.id),ehe=null;for(const n of the)n()}}}function Rye(t){return typeof t=="string"&&(CTr.includes(t)||SB.has(t))}function PTr(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??wht.shape,elevation:d?.elevation??wht.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 ITr={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},NTr={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 F3t({gap:t,align:n,justify:s,padding:c,paddingX:d,paddingY:m,style:g}){return{gap:Cpe(t),alignItems:n?ITr[n]:void 0,justifyContent:s?NTr[s]:void 0,padding:Cpe(c),paddingInline:Cpe(d),paddingBlock:Cpe(m),...g}}function hee(t,n){return n?`${t} ${n}`:t}function M3t({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-stack",t),style:F3t(n)})}function bZ({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-inline",t),style:F3t(n)})}function syn({className:t,...n}){return $.jsx("span",{...n,"aria-hidden":"true",className:hee("volter-spacer",t)})}function OTr({orientation:t="horizontal",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-orientation":t,className:hee("volter-divider",n)})}function RTr({children:t,className:n,...s}){return $.jsx(bZ,{...s,className:hee("volter-actions",n),gap:2,align:"center",children:t})}function j3t(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 $.jsx(A,{...S,ref:k,"data-variant":s,"data-tone":c,"data-truncate":d||void 0,"data-selectable":m||void 0,className:j3t("volter-text",g)})});function ayn({className:t,...n}){return $.jsx("kbd",{...n,className:j3t("volter-keycap",t)})}function B$(t,n){return n?`${t} ${n}`:t}function xRe({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=$.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:$.jsx("div",{...m,role:"dialog","aria-modal":"true","aria-labelledby":t,"data-size":s,"data-variant":c,className:B$("volter-dialog",d)})});return g?$.jsxs($.Fragment,{children:[$.jsx("span",{"data-volter-portal":S,style:{display:"none"}}),MS.createPortal(k,g)]}):k}function wRe({titleId:t,title:n,description:s}){return $.jsxs(M3t,{className:"volter-dialog-header",gap:2,children:[$.jsx(_p,{id:t,as:"h2",variant:"heading",children:n}),s&&$.jsx(_p,{as:"p",tone:"muted",children:s})]})}function L3t({className:t,...n}){return $.jsx(M3t,{...n,className:B$("volter-dialog-body",t)})}function TRe({children:t,className:n,...s}){return $.jsx(RTr,{...s,className:B$("volter-dialog-footer",n),children:t})}function cyn({className:t,...n}){return $.jsx("label",{...n,className:B$("volter-dialog-field",t)})}function lyn({children:t}){return $.jsx(_p,{variant:"label",tone:"muted",children:t})}function uyn({className:t,...n}){return $.jsx(bZ,{...n,className:B$("volter-joined-field",t)})}function fyn({className:t,...n}){return $.jsx("span",{...n,className:B$("volter-joined-field-suffix",t)})}function fBe(t,n){return n?`${t} ${n}`:t}function FTr({className:t,...n}){return $.jsx("div",{...n,className:fBe("volter-field-group",t)})}function T_e({label:t,htmlFor:n,hint:s,compact:c=!1,className:d,children:m,...g}){return $.jsxs("div",{...g,"data-compact":c||void 0,className:fBe("volter-field-row",d),children:[$.jsx("label",{htmlFor:n,className:"volter-field-label",children:t}),$.jsx("div",{className:"volter-field-control",children:m}),s&&$.jsx("div",{className:"volter-field-hint",children:s})]})}function dyn({className:t,...n}){return $.jsx("label",{...n,className:fBe("volter-field-label",t)})}const pyn=Ye.forwardRef(function({selected:n=!1,accent:s="bar",className:c,type:d="button",...m},g){return $.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 MTr({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 $.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&&$.jsx("div",{className:"volter-state-surface-icon",children:n}),$.jsx("strong",{className:"volter-state-surface-title",children:s}),c&&$.jsx("div",{className:"volter-state-surface-description",children:c}),d&&$.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 $.jsx("div",{...d,"data-variant":t,"data-border":n||void 0,"data-scroll":s||void 0,className:$$("volter-surface",c)})}function _yn({tone:t="info",icon:n,actions:s,className:c,children:d,...m}){return $.jsxs("div",{...m,role:t==="error"?"alert":"status","data-tone":t,className:$$("volter-banner",c),children:[n&&$.jsx("span",{className:"volter-banner-icon",children:n}),$.jsx("div",{className:"volter-banner-content",children:d}),s&&$.jsx("div",{className:"volter-banner-actions",children:s})]})}const myn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("div",{ref:c,...s,className:$$("volter-popover",n)})});function hyn({shape:t="label",className:n,...s}){return $.jsx("span",{...s,"data-shape":t,className:$$("volter-badge",n)})}function Tht({position:t="inside",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-position":t,className:$$("volter-drop-indicator",n)})}function gyn({orientation:t,label:n,valueNow:s,valueMin:c=0,valueMax:d=100,className:m,...g}){return $.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 B3t(t,n){return n?`${t} ${n}`:t}const yyn=Ye.forwardRef(function({className:n,onKeyDown:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tablist",className:B3t("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()}})}),vyn=Ye.forwardRef(function({selected:n=!1,dirty:s=!1,badge:c,className:d,type:m="button",tabIndex:g,children:S,...k},A){return $.jsxs("button",{...k,ref:A,type:m,role:"tab",tabIndex:g??(n?0:-1),"aria-selected":n,"data-selected":n||void 0,className:B3t("volter-tab",d),children:[s&&$.jsxs($.Fragment,{children:[$.jsx("span",{className:"volter-tab-dirty",title:"Unsaved","aria-hidden":"true"}),$.jsx("span",{className:"volter-sr-only",children:"Unsaved"})]}),$.jsx("span",{className:"volter-tab-label",children:S}),c!==void 0&&$.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 $.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 Cht({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-toolbar-group",t)})}function Eht(t){return $.jsx("span",{...t,"aria-hidden":"true",className:gee("volter-toolbar-divider",t.className)})}function byn({className:t,onPointerDownCapture:n,...s}){return $.jsx(n$,{...s,compact:!0,className:gee("volter-floating-toolbar volter-glass-island",t),onPointerDownCapture:c=>{n?.(c),c.stopPropagation()}})}function Syn({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-split-button",t)})}function $3t(t,n){return n?`${t} ${n}`:t}const xyn=Ye.forwardRef(function({label:n,className:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tree","aria-label":n,className:$3t("volter-tree",s)})}),wyn=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 $.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:$3t("volter-tree-row",k),style:{paddingLeft:6+Math.max(0,n-1)*14,...F},children:[g&&$.jsx("span",{className:"volter-tree-row-leading",children:g}),$.jsx("span",{className:"volter-tree-row-label",children:A}),S&&$.jsx("span",{className:"volter-tree-row-actions",children:S})]})});function q3t(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 Fye(t,n){return n?`${t} ${n}`:t}function CRe(t){return Array.from(t.querySelectorAll('[role="menuitem"]:not(:disabled), [role="menuitemradio"]:not(:disabled), [role="menuitemcheckbox"]:not(:disabled)'))}function LTr(t){CRe(t)[0]?.focus()}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&&CRe(A.current)[0]?.focus()},[c]),Ye.useEffect(()=>{if(!m)return;const F=D=>{const J=D.target;!A.current?.contains(J)&&!d?.current?.contains(J)&&m("outside")};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,m]),$.jsx("div",{...S,ref:A,role:s,className:Fye("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=CRe(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()}})}),Nc=Ye.forwardRef(function({className:n,type:s="button",role:c="menuitem",onClick:d,onSelect:m,...g},S){return $.jsx("button",{...g,ref:S,type:s,role:c,className:Fye("volter-menu-item",n),onClick:k=>{d?.(k),k.defaultPrevented||m?.()}})});function H1(t){return $.jsx("hr",{...t,className:Fye("volter-menu-separator",t.className)})}const dBe=Ye.forwardRef(function({className:n,type:s="button",...c},d){return $.jsx("button",{...c,ref:d,type:s,"aria-haspopup":c["aria-haspopup"]??"menu",className:Fye("volter-menu-trigger",n)})});function rhe({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)},[]),$.jsxs($.Fragment,{children:[$.jsx("span",{ref:n,"data-volter-portal":d,style:{display:"none"}}),s?MS.createPortal($.jsx("div",{"data-volter-portal-content":d,style:{display:"contents"},children:t}),s):null]})}function pBe({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,q]=Ye.useState(null),G=Ye.useRef(null),se=Ye.useRef(!0),pe=Ye.useRef(!1),ue=Ye.useCallback(()=>{const Fe=t.current;if(!Fe||!F)return;const De=Fe.getBoundingClientRect(),be=F.getBoundingClientRect(),we=s==="right"||s==="left"?{left:s==="right"?De.right+d:De.left-d-be.width,top:De.top}:{left:n==="end"?De.right-be.width:De.left,top:s==="top"?De.top-d-be.height:De.bottom+d},Be=m?q3t({...we,width:be.width,height:be.height}):we,bt=G.current;bt?.left===Be.left&&bt.top===Be.top||(G.current=Be,q(Be))},[n,t,m,d,F,s]);Ye.useLayoutEffect(()=>{const Fe=t.current;if(!Fe||!F)return;ue();let De=0;const be=()=>{ue(),De=requestAnimationFrame(be)};De=requestAnimationFrame(be),window.addEventListener("resize",ue),document.addEventListener("scroll",ue,!0);const X=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return X?.observe(Fe),X?.observe(F),()=>{const we=se.current&&F.contains(document.activeElement);window.removeEventListener("resize",ue),document.removeEventListener("scroll",ue,!0),cancelAnimationFrame(De),X?.disconnect(),we&&queueMicrotask(()=>t.current?.focus())}},[t,F,ue]),Ye.useLayoutEffect(()=>{!c||pe.current||!F||!J||(pe.current=!0,LTr(F))},[c,F,J]);const Ce=Fe=>{se.current=Fe!=="outside",g(),Fe==="escape"&&t.current?.focus()};return $.jsx(rhe,{children:$.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 Tyn({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 $.jsxs($.Fragment,{children:[$.jsxs(Nc,{...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:[$.jsx("span",{style:{flex:1},children:t}),$.jsx("span",{"aria-hidden":"true",style:{paddingInlineStart:"var(--volter-space-4)"},children:"▸"})]}),d&&$.jsx(pBe,{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 $.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 $.jsxs(Ms,{...d,ref:m,variant:n,"data-icon":"true","data-label-placement":s===void 0?void 0:"below",children:[c,s!==void 0&&$.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"},kht={1:"#333333",2:"#444444"},xB={1:"#c5c8ce",2:"#9aa0a6",3:"#90959c"},BTr="#579EFF",$Tr="rgba(87,158,255,0.15)",T5e={1:"#f2f6fb",2:"#d3d9e0",3:"#aab0b7"},_Be="#d8dee9",mBe="rgba(216,222,233,0.18)",z3t="#FF6B6B",V3t="#e0a030",U3t="#4caf50",J3t="rgba(76,175,80,0.15)",W3t="rgba(255,107,107,0.15)",H3t="rgba(224,160,48,0.12)",G3t="rgba(255,107,107,0.06)",K3t="rgba(0,0,0,0.5)",X3t="#ff79c6",Y3t="rgba(255,121,198,0.08)",Z3t="#22b8d6",Mye='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',jye='ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace',C5e={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)"},hBe={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)"},nhe={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)"},Cyn="var(--volter-accent)",Eyn="var(--volter-accent-muted)",kyn={background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},C_e="var(--volter-danger)",Ayn="var(--volter-warn)",Dyn="var(--volter-success)",Pyn="var(--volter-success-muted)",Iyn="var(--volter-danger-muted)",Nyn="var(--volter-warn-muted)",Oyn="var(--volter-danger-faint)",Ryn="var(--volter-scrim)",Fyn="var(--volter-dynamic)",Myn="var(--volter-dynamic-muted)",R_={1:2,2:4,3:6,4:8,5:10,6:12,8:16,10:20,12:24},Q3t={commandBar:36,panelHeader:30,localToolbar:28,treeRow:24,treeIndent:14,statusBar:36,toolSize:34,toolWidth:38,toolGap:7,areaSeam:1,areaEmboss:0},gBe=["solid","clay","unlit","wireframe","matcap","normals","overdraw","preview","rendered"];function Qb(t){return t===void 0?"":`${t}`}function Zp(t){return{control:{...qTr,...t.density?.control},font:{...VTr,...t.density?.font},icon:{...zTr,...t.density?.icon},chrome:{...Q3t,...t.density?.chrome}}}const qTr={compact:20,default:24,comfortable:28},E5e={resting:1,active:2},zTr={xs:9,sm:10,md:12,lg:13,xl:14,"2xl":16},VTr={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"}},jyn="var(--volter-font-sans)",Lyn="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)"},Byn={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)"},Aht={tight:"var(--volter-leading-tight)",snug:"var(--volter-leading-snug)",normal:"var(--volter-leading-normal)",relaxed:"var(--volter-leading-relaxed)"},$yn={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)"}},qyn="var(--volter-focus-ring)",UTr=["outliner","properties"],Lye=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:kht[1],strong:kht[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:BTr,muted:$Tr},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},neutralOverlay:{hover:"rgba(255,255,255,0.08)",active:"rgba(255,255,255,0.14)"},scrim:K3t},typography:{sans:Mye,mono:jye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:C5e.sm,medium:C5e.md,large:C5e.lg}},JTr={...i$,id:"graphite-neutral",color:{...i$.color,content:{primary:T5e[1],muted:T5e[2],dim:T5e[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe}}},WTr={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:Mye,mono:jye},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)"}},ERe={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:_Be,muted:mBe},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},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:Mye,mono:jye},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}},HTr=(()=>{const{treatment:t,...n}=ERe;return{...n,id:"glass-dark-lite",appearance:{material:"glass",transparency:"reduced"},color:{...ERe.color,surface:{shell:"#1a1a1a",panel:"#222222",chrome:"#292929",raised:"#303030",inset:"#1d1d1d",overlay:"#202020"},scrim:K3t}}})(),kRe={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:_Be,muted:mBe},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:Mye,mono:jye},shape:Ym.shape,elevation:Ym.elevation,treatment:Ym.treatment},GTr=(()=>{const{treatment:t,...n}=kRe;return{...n,id:"liquid-glass-lite",appearance:{material:"glass",transparency:"reduced"},color:{...kRe.color,surface:Ym.reducedTransparency.surface,scrim:Ym.reducedTransparency.scrim}}})(),e4t={"graphite-dark":i$,"graphite-neutral":JTr,"midnight-high-contrast":WTr,"glass-dark":ERe,"glass-dark-lite":HTr,"liquid-glass":kRe,"liquid-glass-lite":GTr};function KTr(t){return typeof t=="string"&&Object.hasOwn(e4t,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 XTr(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 YTr(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 Dht(t,n){return n?"transparent":`linear-gradient(var(${t}), var(${t})), linear-gradient(var(--volter-surface-shell), var(--volter-surface-shell))`}function Pht(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 ARe(t){return(t?.contentFrostBlurPx??0)>0?"rgba(255,255,255,0.10)":"transparent"}function ZTr(t){return t?"color-mix(in srgb, currentColor 7%, transparent)":"var(--volter-widget-field)"}function QTr(t){return t?"color-mix(in srgb, currentColor 26%, transparent)":"var(--volter-boundary-default)"}function eCr(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 tCr=.6,rCr=.5;function ihe(t,n){return`rgba(255,255,255,${Math.min(1,Number((t*n/tCr).toFixed(3)))})`}function t4t(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(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 nCr(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(d,n);return`linear-gradient(${s}deg, ${c(.16)} 0%, ${c(.05)} 24%, transparent 40%)`}function iCr(t){const n=t?.edgeSpecular??0,s=t?.thickness??0,c=[];if(n>0&&(c.push(`inset 0 1px 1px ${ihe(.28,n)}`),c.push(`inset 0 -1px 1px ${ihe(.1,n)}`)),s>0){const d=m=>`${Number((m*s/rCr).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 oCr(t){return q$(t)?"var(--volter-surface-panel)":"color-mix(in srgb, var(--volter-surface-panel) 90%, transparent)"}function sCr(t){return q$(t)?t.treatment?"var(--volter-surface-backdrop-filter)":"none":"blur(8px)"}function aCr(t){return t?"17px":"var(--volter-radius-md)"}function cCr(t){return t?"var(--volter-boundary-default)":"var(--volter-boundary-strong)"}function lCr(t){return t?"var(--volter-shadow-lg)":"var(--volter-shadow-sm)"}function uCr(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 Bye(t){return q$(t)}function fCr(t){return Bye(t)?"var(--volter-neutral-active)":"var(--volter-accent-muted)"}function r4t(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 n4t(t){if(!r4t(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 dCr(t){return Bye(t)?"var(--volter-content-primary)":r4t(t.color.accent.muted)?"var(--volter-content-on-accent)":"var(--volter-content-primary)"}function pCr(t){return Bye(t)?"color-mix(in srgb, currentColor 30%, transparent)":n4t(t.color.surface.panel)?`rgb(from ${t.color.accent.muted} r g b / 1)`:"var(--volter-accent)"}function _Cr(t){return Bye(t)?"color-mix(in srgb, currentColor 76%, transparent)":"var(--volter-accent)"}function mCr(t){return t?"var(--volter-radius-full)":"var(--volter-radius-sm)"}function hCr(t){return!q$(t)||!t.treatment?"var(--volter-accent)":uCr(t,.82)??"var(--volter-accent)"}function gCr(t){const n=t?.edgeSpecular??0;return n<=0?"none":t4t({...t,edgeSpecular:n*.4})}function yCr(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 i4t(t){return t<=0?"none":`0 1px 2px rgba(0,0,0,${Number(t.toFixed(3))})`}function o4t(t){return i4t(t?.textShadowOpacity??0)}function vCr(t){return t.treatment?.adaptiveContent?{primary:t.color.content.onBright.primary,muted:t.color.content.onBright.muted,dim:t.color.content.onBright.dim,textShadow:i4t(t.treatment.brightTextShadowOpacity??0),frostBg:t.treatment.brightFrostBg??ARe(t.treatment)}:{primary:t.color.content.primary,muted:t.color.content.muted,dim:t.color.content.dim,textShadow:o4t(t.treatment),frostBg:ARe(t.treatment)}}function bCr(t){return t.treatment?t.treatment.adaptiveContent?"rgba(255,255,255,0.9)":xCr(t.color.surface.chrome,.9):t.color.surface.chrome}function SCr(t){return t.color.surface.panel}function xCr(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 Iht(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 wCr(t){return t.color.boundary.area??t.color.boundary.default}function TCr(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 CCr(t){const n=Zp(t).chrome.areaEmboss;return n>0?`#ffffff ${n}%`:"transparent 100%"}function ECr(t){const n=vCr(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":YTr(t.treatment),"--volter-surface-sticky":Dht("--volter-surface-chrome",s),"--volter-surface-sticky-panel":Dht("--volter-surface-panel",s),"--volter-surface-sticky-backdrop-filter":"none","--volter-surface-body-frost-filter":Pht(t.treatment),"--volter-content-frost-filter":Pht(t.treatment),"--volter-content-frost-bg":ARe(t.treatment),"--volter-input-surface":ZTr(s),"--volter-input-border":QTr(s),"--volter-input-shadow":eCr(s,g),"--volter-structural-divider":s?"transparent":t.color.boundary.default,"--volter-card-specular-ring":t4t(t.treatment),"--volter-card-specular-sheen":nCr(t.treatment),"--volter-card-specular-shadow":iCr(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":yCr(t.treatment),"--volter-island-surface":oCr(t),"--volter-island-backdrop-filter":sCr(t),"--volter-island-radius":aCr(s),"--volter-island-border-color":cCr(s),"--volter-island-shadow":lCr(s),"--volter-island-specular-ring":gCr(t.treatment),"--volter-selection-bg":fCr(t),"--volter-content-on-selection":dCr(t),"--volter-selection-border":pCr(t),"--volter-selection-indicator":_Cr(t),"--volter-island-control-radius":mCr(s),"--volter-island-primary-bg":hCr(t),"--volter-content-text-shadow":o4t(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":bCr(t),"--volter-glass-regular-backdrop-filter":Iht(t.treatment),"--volter-glass-regular-panel-bg":SCr(t),"--volter-glass-regular-panel-backdrop-filter":Iht(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":wCr(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":CCr(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":TCr(t.color.surface.panel,t.color.content.primary),...n4t(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":Qb(t.stage?.wireOpacity),"--volter-viewport-axis-line-width":Qb(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":Qb(t.stage?.gizmoOpacity),"--volter-viewport-gizmo-arrow-length":Qb(t.stage?.gizmoArrowLength),"--volter-viewport-gizmo-arrow-head":Qb(t.stage?.gizmoArrowHead),"--volter-viewport-gizmo-ring-width":Qb(t.stage?.gizmoRingWidth),"--volter-viewport-navigation-gizmo":t.stage?.navigationGizmo??"","--volter-viewport-navigation-corner":t.stage?.navigationCorner??"","--volter-viewport-navigation-size":Qb(t.stage?.navigationSize),"--volter-viewport-gizmo-highlight-saturation":Qb(t.stage?.gizmoHighlightSaturation),"--volter-viewport-gizmo-highlight-value":Qb(t.stage?.gizmoHighlightValue),"--volter-viewport-gizmo-size":t.stage?.gizmoSize===void 0?"":`${t.stage.gizmoSize}`,"--volter-viewport-grid-line-width":Qb(t.stage?.gridLineWidth),"--volter-viewport-grid-major-width":Qb(t.stage?.gridMajorWidth),"--volter-viewport-grid-major-contrast":Qb(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":Qb(t.stage?.outlineWidth),"--volter-viewport-outline-hidden":t.stage?.outlineHidden===void 0?"":`${t.stage.outlineHidden}`,"--volter-viewport-selection-box-width":Qb(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(gBe.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(Lye.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":`${E5e.active}px solid ${t.color.accent.default}`,"--volter-select-chevron":XTr(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":`${Zp(t).chrome.commandBar}px`,"--volter-panel-header-height":`${Zp(t).chrome.panelHeader}px`,"--volter-local-toolbar-height":`${Zp(t).chrome.localToolbar}px`,"--volter-tree-row-height":`${Zp(t).chrome.treeRow}px`,"--volter-tree-indent":`${Zp(t).chrome.treeIndent}px`,"--volter-status-bar-height":`${Zp(t).chrome.statusBar}px`,"--volter-tool-size":`${Zp(t).chrome.toolSize}px`,"--volter-tool-width":`${Zp(t).chrome.toolWidth}px`,"--volter-tool-gap":`${Zp(t).chrome.toolGap}px`,"--volter-area-seam-width":`${Zp(t).chrome.areaSeam}px`,"--volter-control-compact-height":`${Zp(t).control.compact}px`,"--volter-control-default-height":`${Zp(t).control.default}px`,"--volter-control-comfortable-height":`${Zp(t).control.comfortable}px`,"--volter-stroke-resting":`${E5e.resting}px`,"--volter-stroke-active":`${E5e.active}px`,"--volter-font-xs":`${Zp(t).font.xs}px`,"--volter-font-sm":`${Zp(t).font.sm}px`,"--volter-font-base":`${Zp(t).font.base}px`,"--volter-font-md":`${Zp(t).font.md}px`,"--volter-font-lg":`${Zp(t).font.lg}px`,"--volter-font-xl":`${Zp(t).font.xl}px`,"--volter-font-2xl":`${Zp(t).font["2xl"]}px`,"--volter-icon-xs":`${Zp(t).icon.xs}px`,"--volter-icon-sm":`${Zp(t).icon.sm}px`,"--volter-icon-md":`${Zp(t).icon.md}px`,"--volter-icon-lg":`${Zp(t).icon.lg}px`,"--volter-icon-xl":`${Zp(t).icon.xl}px`,"--volter-icon-2xl":`${Zp(t).icon["2xl"]}px`,"--volter-font-heading":`${Zp(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 DRe="volter-editor-theme";function kCr(t,n=i$){t.classList.add(DRe),t.dataset.volterTheme=n.id,t.dataset.volterChrome=q$(n)?"islands":"bars";for(const[s,c]of Object.entries(ECr(n)))t.style.setProperty(s,c)}const zyn={bg:Go.semantic.dangerFaint,border:Go.semantic.danger,fg:Go.semantic.danger},Vyn={bg:Go.semantic.warningMuted,border:Go.semantic.warning,fg:Go.semantic.warning},s4t=Ye.createContext(null);function ACr(){return Ye.useContext(s4t)}function DR(t,n){return n?`${t} ${n}`:t}const Zm=Ye.forwardRef(function({className:n,type:s="text",...c},d){return $.jsx("input",{...c,ref:d,type:s,className:DR("volter-input",n)})}),Iw=Ye.forwardRef(function({className:n,...s},c){return $.jsx("select",{...s,ref:c,className:DR("volter-select",n)})}),yBe=Ye.forwardRef(function({className:n,...s},c){return $.jsx("textarea",{...s,ref:c,className:DR("volter-input volter-textarea",n)})}),TD=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"checkbox",className:DR("volter-checkbox",n)})}),a4t=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"color",className:DR("volter-color-swatch",n)})}),Uyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"file",className:DR("volter-file-input",n)})}),Jyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"range",className:DR("volter-range",n)})}),gC="default",DCr={id:gC,title:"Editor"},wB=new Map;let ohe=null,aQ=gC;const PRe=new Set;function IRe(){for(const t of PRe)t()}function Wyn(){return ohe??=[DCr,...[...wB.values()].map(({id:t,title:n})=>({id:t,title:n}))],ohe}function yee(t){return typeof t=="string"&&(t===gC||wB.has(t))}function PCr(t){if(yee(t.id))throw new Error(`registerContributedIconSet: icon set "${t.id}" is already registered.`);return wB.set(t.id,t),ohe=null,IRe(),()=>{wB.get(t.id)===t&&(wB.delete(t.id),ohe=null,IRe())}}function she(){return aQ}function ahe(t){const n=yee(t)?t:gC;n!==aQ&&(aQ=n,IRe())}function vBe(t){return PRe.add(t),()=>PRe.delete(t)}function c4t(t){return aQ===gC?null:wB.get(aQ)?.glyphs[t]??null}const Nht={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)"},Oht={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(vBe,she,she);const k=c4t(t.iconName);if(k){const A=s!=="current",F=k.tone?`var(--volter-category-${k.tone}, currentColor)`:void 0,D=A?Oht[s]:k.tonedPath?void 0:F,J=A?"currentColor":F??"currentColor";return $.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:Nht[n],color:D,...m},children:[$.jsx("path",{d:k.path,fill:"currentColor"}),k.tonedPath?$.jsx("path",{d:k.tonedPath,fill:J}):null]})}return $.jsx(Kyr,{...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:Nht[n],color:Oht[s],...m}})}function l4t({direction:t,size:n="xs",tone:s="current",style:c}){return $.jsx(dc,{icon:t==="right"?ITt:JTt,size:n,tone:s,...c?{style:c}:{}})}function Hyn({direction:t,size:n="xs",tone:s="current"}){return $.jsx(dc,{icon:t==="right"?ETt:iLe,size:n,tone:s})}function fy(t,n){return{...n,iconName:t}}const Kk={action:{add:GTt,close:rLe,delete:ATt,search:kTt,refresh:H0r,undo:LOe,redo:Cmt,build:z0r,export:W0r,select:Emt},transport:{play:k0r,pause:U0r,restart:Cmt,stop:DTt,step:D0r},content:{project:MOe,folder:uee,file:jTt,source:oLe,scene:aLe,entity:aR,component:GB,camera:nye,light:Qje,image:iB,audio:nLe,data:PTt,code:eLe,stateMachine:OTt},status:{success:tLe,info:R$,warning:fee,error:MTt,visible:Zje,hidden:sLe,locked:Nme,unlocked:jOe},viewport:{zoomIn:p0r,zoomOut:f0r,pan:w0r,frame:l0r,projection:fy("viewport-projection",S5e),projectionOrthographic:fy("viewport-orthographic",S5e),camera:fy("viewport-camera",Tmt),cameraView:fy("viewport-camera-view",Tmt),cameraLocked:fy("viewport-camera-locked",Nme),cameraUnlocked:fy("viewport-camera-unlocked",jOe)},modeling:{extrude:fy("mesh-extrude",RTt),inset:fy("mesh-inset",q0r),bevel:fy("mesh-bevel",G0r),loopCut:fy("mesh-loop-cut",_0r),knife:fy("mesh-knife",j0r),smooth:fy("mesh-smooth",u0r),shrinkFatten:fy("mesh-shrink-fatten",LTt),subdivide:fy("mesh-subdivide",A0r)},tool:{extension:GB,select:fy("tool-select-box",Emt),move:$Tt,rotate:CTt,scale:fy("tool-scale",h0r),transform:fy("tool-transform",T0r),snap:E0r,frame:HTt,grid:S5e,profiler:UTt},panel:{outliner:fy("outliner",XTt),properties:fy("properties",qTt),"folder-open":MOe,"cubes-stacked":BTt,users:m0r,list:vZ,"rotate-left":LOe}};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),[q,G]=Ye.useState(""),se=Ye.useRef({startX:0,startVal:0,dragging:!1,gesture:!1,lastVal:0}),pe=Ye.useRef(null),ue=ACr();Ye.useEffect(()=>{if(!D)return;const we=pe.current;we&&(we.focus(),we.select())},[D]);const Ce=t===null,Fe=t??0,De=Ce?"—":Number.isFinite(Fe)?Fe.toFixed(d):0 .toFixed(d),be=we=>{if(m)return;se.current={startX:we.clientX,startVal:Fe,dragging:!1,gesture:!1,lastVal:Fe};const Be=It=>{const Wt=It.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",Be),window.removeEventListener("pointerup",bt),se.current.gesture&&ue?.end(),se.current.dragging?s?.(se.current.lastVal):(J(!0),G(Ce?"":De))};window.addEventListener("pointermove",Be),window.addEventListener("pointerup",bt)},X=()=>{J(!1);const we=Number.parseFloat(q);Number.isFinite(we)&&(n(we),s?.(we))};return $.jsxs("div",{className:"volter-number-input","data-testid":A,title:F,style:k,children:[g&&$.jsx("span",{className:"volter-number-input-label",style:S?{color:S}:void 0,children:g}),D?$.jsx(Zm,{ref:pe,value:q,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"}):$.jsx("div",{onPointerDown:be,className:"volter-number-input-scrub","data-mixed":Ce||void 0,"data-disabled":m||void 0,children:De})]})}const ICr={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"},NCr={...ICr,background:"var(--volter-surface-sticky)",borderBottom:"1px solid var(--volter-structural-divider)",flexShrink:0};function $ye({name:t,actions:n,onHeaderClick:s,hideHeader:c=!1,style:d,children:m,...g}){return $.jsxs("div",{...g,style:{display:"flex",flexDirection:"column",pointerEvents:"auto",...d},children:[!c&&$.jsxs("div",{role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?S=>{S.key==="Enter"&&s()}:void 0,style:{...NCr,cursor:s?"pointer":void 0,pointerEvents:"auto"},children:[$.jsx("span",{style:{flexShrink:0},children:t}),n&&$.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:R_[3]},children:n})]}),m]})}function OCr({label:t,icon:n,description:s,actions:c,collapsible:d=!0,defaultOpen:m=!0,children:g}){const[S,k]=Ye.useState(m),A=$.jsxs("span",{className:"volter-section-title",children:[$.jsx("span",{children:t}),s?$.jsx("small",{children:s}):null]});return $.jsxs("section",{className:"volter-section",children:[$.jsxs("div",{className:"volter-section-header",children:[d?$.jsxs("button",{type:"button",className:"volter-section-trigger","aria-expanded":S,onClick:()=>k(!S),children:[$.jsx(l4t,{direction:S?"down":"right",style:{fontSize:"var(--volter-section-disclosure-size, var(--volter-icon-xs))"}}),n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}):$.jsxs("div",{className:"volter-section-trigger","data-volter-static":!0,children:[n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}),c?$.jsx("div",{className:"volter-section-actions",children:c}):null]}),(S||!d)&&$.jsx("div",{className:"volter-section-body",children:g})]})}const zI=8,VI=6;function RCr(t){return t==="top"?"bottom":t==="bottom"?"top":t==="left"?"right":"left"}function FCr(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 MCr(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),[q,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()},Fe=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 Be=FCr(c,X,we)?c:RCr(c);pe(MCr(Be,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 De=s;if(Ye.isValidElement(s)){const be=[s.props["aria-describedby"],D?m:null].filter(Boolean).join(" ");De=Ye.cloneElement(s,be?{"aria-describedby":be}:{})}return $.jsxs("span",{ref:g,className:"volter-tooltip-anchor",onMouseEnter:()=>{A.current=!0,Fe(d)},onMouseLeave:()=>{A.current=!1,Ce()},onFocusCapture:()=>{F.current=!0,Fe(0)},onBlurCapture:be=>{be.currentTarget.contains(be.relatedTarget)||(F.current=!1,Ce())},children:[De,D&&q&&MS.createPortal($.jsxs("div",{ref:S,id:m,role:"tooltip",className:"volter-tooltip",style:{left:se.left,top:se.top,visibility:se.ready?"visible":"hidden"},children:[$.jsx("span",{children:t}),n&&$.jsx("kbd",{children:n})]}),q)]})}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 $.jsxs("div",{style:{display:"flex",gap:4},children:[$.jsx(SZ,{label:"X",labelColor:"#E06178",value:t[0],onChange:S(0),step:c,disabled:d,style:{flex:1},testId:g("x")}),$.jsx(SZ,{label:"Y",labelColor:"#C2ED66",value:t[1],onChange:S(1),step:c,disabled:d,style:{flex:1},testId:g("y")}),$.jsx(SZ,{label:"Z",labelColor:"#6BABF5",value:t[2],onChange:S(2),step:c,disabled:d,style:{flex:1},testId:g("z")})]})}const k5e={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},Gyn=Go.typography.sans,Kyn=Go.typography.mono;function Xyn(t,n){t.onChange(n)}function Yyn(t,n){(t.onChangeEnd??t.onChange)(n)}const Zyn={display:"flex",alignItems:"center",gap:4},Qyn={fontSize:"var(--volter-font-sm)",color:Go.content.muted,marginBottom:2},LCr={fontSize:"var(--volter-font-base)",fontWeight:600,color:Go.content.muted,textTransform:"uppercase",letterSpacing:.4},BCr=72;function e0n({label:t,active:n,disabled:s,onClick:c,testId:d}){return $.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 t0n(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 A5e=22,Rht={width:A5e,height:A5e,flex:`0 0 ${A5e}px`,borderRadius:k5e.radiusSmall,border:`1px solid ${k5e.border}`,background:k5e.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 $Cr({value:t,onChange:n,options:s,previewUrlFor:c,disabled:d,note:m,testId:g}){const S=t&&!s.includes(t)?[t,...s]:s;return $.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[t?$.jsx("img",{src:c(t),alt:"",style:Rht,"data-testid":`${g}-thumb`}):$.jsx("span",{style:Rht,"aria-hidden":"true"}),$.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:[$.jsx("option",{value:"",children:"—"}),S.map(k=>$.jsx("option",{value:k,children:k},k))]}),$.jsx(dm,{"data-testid":`${g}-clear`,"aria-label":"Clear this texture slot",title:"Clear this texture slot",disabled:d||!t,onClick:()=>n(""),children:$.jsx(dc,{icon:rLe})})]}),m&&$.jsx("span",{"data-testid":`${g}-note`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.muted},children:m})]})}function NRe({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 $.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,ORe=new Set;let u4t=0;function Fht(){u4t+=1;for(const t of ORe)t()}function r0n(t,n){return k_e.set(t,n),Fht(),()=>{k_e.get(t)===n&&(k_e.delete(t),Fht())}}function bBe(t){return ORe.add(t),()=>ORe.delete(t)}function o$(){return u4t}function o2(t){return t?k_e.get(t)??null:null}const QL=new Map;function n0n(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 qCr(t){return(QL.get(t)??0)>0}const PR=1e4;async function EC(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,che=new Set,A_e=new Set;let f4t=0;function d4t(){f4t+=1;for(const t of[...TB])t()}function zCr(t,n){return xZ.set(t,n),d4t(),()=>{xZ.get(t)===n&&xZ.delete(t)}}function VCr(t){xZ.has(t)&&d4t()}function UCr(t){return TB.add(t),()=>{TB.delete(t)}}function Mht(){return f4t}function cQ(t){return xZ.get(t)}function p4t(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 _4t(t){che.add(t);for(const n of[...A_e])n();return()=>{che.delete(t)}}function m4t(t,n=1e4){return che.has(t)?Promise.resolve(!0):new Promise(s=>{const c=()=>{che.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 SBe(t){if(qCr(t)&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}let RRe=null;const ZY=new Map;let YO=[];function JCr(t){if(RRe=t,!t)return;const n=YO;YO=[];for(const s of n)h4t(t,s)}function h4t(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 WCr=0;function s$(t){const n=t.id??`notification-${++WCr}`,s={...t,id:n};return RRe?h4t(RRe,s):(YO=[...YO.filter(c=>c.id!==n),s],()=>xBe(n))}function xBe(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},lhe=!0,kpe=null,D_e=null,RG=null,P_e=!1;const QY=new Set;function HCr(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 uhe(t){Xk=t;for(const n of QY)n()}async function GCr(){const t=await fetch("/__editor/gameplay-sessions");return(await L_(t,"Could not load Gameplay Sessions")).sessions}async function KCr(t){return L_(await fetch(`/__editor/gameplay-sessions/${encodeURIComponent(t)}`),"Could not load the selected Gameplay Session").then(n=>n.session)}async function XCr(){try{const t={sessions:await GCr()},n=HCr(t.sessions,Xk.sessions,D_e),s=n.sessionId;n.latestAppeared&&(lhe=!0),D_e=s;const c=s?await KCr(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=lhe?m:Math.min(Xk.cursorMs,m);uhe({sessions:d,selectedSessionId:s,selectedSession:c,cursorMs:g,liveEdgeMs:m,loading:!1,error:null})}catch(t){uhe({...Xk,loading:!1,error:t instanceof Error?t.message:String(t)})}}function lQ(){return RG?(P_e=!0,RG):(RG=XCr().finally(()=>{RG=null,P_e&&(P_e=!1,lQ())}),RG)}function YCr(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 ZCr(t){const n=Xk.sessions.find(s=>s.id===t);n&&(D_e=n.id,lhe=!0,uhe({...Xk,selectedSessionId:n.id,selectedSession:n,cursorMs:n.durationMs,liveEdgeMs:n.durationMs}),lQ())}function QCr(t){const n=Math.max(0,Math.min(t,Xk.liveEdgeMs));lhe=Xk.liveEdgeMs-n<250,uhe({...Xk,cursorMs:n})}const g4t={getSnapshot:()=>Xk,subscribe:YCr,select:ZCr,seek:QCr,refresh:lQ};let y4t=null;const FRe=new Set,i0n={getSnapshot:()=>y4t,subscribe(t){return FRe.add(t),()=>FRe.delete(t)}};function o0n(t){y4t=t;for(const n of FRe)try{n()}catch{}}let ZO={phase:null,at:0,run:0},dN=ZO;const MRe=new Map;let v4t=null;function eEr(t){v4t=t,b4t(ZO)}function b4t(t){ZO=t;try{v4t?.(t)}catch{}}function uQ(){const t=[...MRe.values()].at(-1),n=t?{...t,run:dN.run}:dN;n.phase===ZO.phase&&n.at===ZO.at&&n.run===ZO.run||b4t(n)}function s0n(t=Date.now()){return dN={phase:null,at:t,run:dN.run+1},uQ(),ZO.run}function a0n(t,n=Date.now()){dN={phase:t,at:n,run:dN.run},uQ()}function c0n(t=Date.now()){dN={phase:null,at:t,run:dN.run},uQ()}function wBe(t,n=Date.now()){const s=Symbol();return MRe.set(s,{phase:t.slice(0,160),at:n}),uQ(),()=>{MRe.delete(s)&&uQ()}}const tEr=Ye.lazy(()=>fo(()=>import("./GameplaySessionTimeline-CryFYfYN.js"),__vite__mapDeps([252,1,2,3,4,20,21,139,125,140,22,23])).then(t=>({default:t.GameplaySessionTimeline})));class TBe 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?$.jsxs("div",{style:{padding:R_[6],fontSize:"var(--volter-font-md)",color:Go.semantic.danger,maxWidth:640},children:[$.jsxs("div",{style:{fontWeight:600,marginBottom:R_[2]},children:["Tool crashed: ",$.jsx("code",{children:this.props.file})]}),$.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)}),$.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 rEr({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 q=Ye.useRef(s);return q.current=s,Ye.useEffect(()=>{const G=S.current;if(!G)return;let se=!1;A(null);const pe=(Fe,De)=>{if(se)return;const be=Fe instanceof Error?Fe:new Error(String(Fe));console.error(`[tools] ${J.current} crashed while rendering:`,be,De?.componentStack),A(be),q.current&&_4t(q.current)},ue=G.appendChild(document.createElement("div"));ue.style.display="contents";const Ce=Xje.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:Kye(),surfaces:uBe,account:YLe(),work:Ce=>{D.current?.(),D.current=Ce===null?null:wBe(`building ${Ce.replace(/^building /,"")}`)},notify:Ce=>s$({...Ce,id:`contribution:${t.id}:${Ce.title}`,...Ce.tone==="warning"?{fades:!0}:{}}),...t.point==="workspace.analytics"?{gameplaySessions:g4t}:{play:Dye()},...s?{documentId:s,publishContext:Ce=>zCr(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(nEr,{documentId:s},ue):ue)},[m,c,t,n,s,d,g]),$.jsxs($.Fragment,{children:[k?$.jsxs("div",{style:{padding:R_[6],color:Go.semantic.danger},children:["Tool crashed: ",$.jsx("code",{children:t.file}),$.jsx("div",{style:{whiteSpace:"pre-wrap",marginTop:R_[2]},children:String(k)})]}):null,$.jsx("div",{ref:S,style:{minHeight:0,width:"100%"}})]})}function nEr({documentId:t,children:n}){return Ye.useEffect(()=>_4t(t),[t]),$.jsx($.Fragment,{children:n})}function IR({contribution:t,Component:n,documentId:s,active:c,document:d}){const m=Ye.useSyncExternalStore(Tye,cN,cN),g=Ye.useSyncExternalStore(Pye,lN,lN),S=t.point==="workspace.analytics"?"gameplay-sessions":g;return $.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"?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(tEr,{})}):null,$.jsx(TBe,{file:t.file,children:$.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:$.jsx(rEr,{contribution:t,...n?{Component:n}:{},accountRevision:m,playKey:S,...s?{documentId:s}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}})})})]})}function iEr({id:t,title:n,file:s,tool:c,Component:d,adapter:m,nodeId:g}){Ye.useSyncExternalStore(Tye,cN,cN),Ye.useSyncExternalStore(Pye,lN,lN);const S=g?m.hierarchy.node(g):null;return $.jsx("div",{className:"volter-inspector-tool-section","data-testid":`inspector-tool-${t}`,children:$.jsx(TBe,{file:s,children:$.jsx(zvr,{adapter:m,nodeId:g,children:$.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:Kye(),surfaces:uBe,account:YLe(),play:Dye(),node:S,nodeId:g,adapter:m})})})})}const oEr=Symbol("volter.inspection.mixed");function jRe(t){return t===oEr}function CBe(t){return t.readonlyReason??"This field is read-only."}function EBe(t){return"column"}function kBe(t,n){return t.quickActions.filter(s=>s.placement===n)}const LRe="preview",jht="transform",D5e="properties",S4t="stories",l0n="story-args",u0n="Story Args";function Lht(t){return`group:${t}`}const x4t=100,sEr=1e3,fQ=2e3,w4t=3e3,aEr=4e3,cEr=5e3,lEr={nullSubjectId:null};function T4t(t){return"sections"in t}const I_e=[];let C4t=0;const BRe=new Set;function Bht(){C4t++;for(const t of BRe)t()}function uEr(t){return BRe.add(t),()=>{BRe.delete(t)}}function $ht(){return C4t}function E4t(t){return I_e.push(t),Bht(),()=>{const n=I_e.indexOf(t);n>=0&&(I_e.splice(n,1),Bht())}}function qht(t,n,s=lEr){return I_e.filter(c=>c.match(t,n,s))}function k4t(t){if(typeof t!="object"||t===null)return!1;const n=t.name;return n==="Canceled"||n==="CancellationError"||n==="AbortError"}const fEr=1e3;class dEr{_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>fEr){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 ea=new dEr;typeof window<"u"&&(window.__volterEditorConsole=ea);const zht=1e3,Vht=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 pEr(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>zht?`${s.slice(0,zht)}…`:s}function $Re(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 pEr(k)}}),m=s.slice(c);return m.length===0?d:`${d} ${m.map(CB).join(" ")}`}function _Er(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 qRe(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=pYr(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">${s4r()}</div><h1>Session ended</h1><p>This editor session has ended. You can close this tab.</p></main>`})}))}const Tge=new Set;function sZr(t){return Tge.add(t),()=>{Tge.delete(t)}}function aZr(){try{window.focus()}catch{}if(Tge.size===0){window.location.reload();return}for(const t of[...Tge])t()}function cZr(t,n,s={}){t.addEventListener("tab-refocus",c=>eZr(c)),t.addEventListener("tab-yield",c=>tZr(n,c)),t.addEventListener("tab-close",()=>oZr(n,s)),t.addEventListener("tab-adopt",()=>aZr())}const $k="/__editor",lZr=globalThis,md=lZr.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__,wC=md?.clientId??globalThis.crypto?.randomUUID?.()??`editor-${Date.now()}`,G0e=jAt,uZr=Qxr;function fZr(t,n,s){md?.reportPhase?.(t,n,s)}function dZr(t){md?.reportCensus?.(t)}function pZr(){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 _Zr(){const t=new URLSearchParams({clientId:wC,participantId:G0e,displayName:uZr});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 RRt=new Set(["editor-command"]);function FRt(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 mZr(t){P$!==t&&(P$=t,cZr(t,$k,{tabId:md?.tabId,epoch:md?.epoch}),FRt(t,n=>!RRt.has(n)))}function jD(){kw||(md?.source?(kw=md.source,md.pageOwned&&eB++):(kw=new EventSource(_Zr()),md&&(md.source=kw)));const t=kw;mZr(t),eB++;const n=[];let s=!1;return{addEventListener(c,d){const m=d;t.addEventListener(c,m),n.push({type:c,listener:m}),RRt.has(c)&&FRt(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 hZr(){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 gZr(){if(typeof EventSource>"u")return()=>{};const t=jD(),n=Oze(c=>{c!==null&&c.reason!=="server-gone"&&pZr()}),s=vZr();return()=>{s(),n(),t.close()}}const yZr=5;function vZr(){if(typeof window>"u")return()=>{};let t=0;const n=d=>{d===""||t>=yZr||(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;k4t(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 bZr=2e3,SZr={"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(SZr[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 xZr(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(MSt,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,bZr)})]),S!==void 0&&clearTimeout(S),k||await FZ("command-result",n),s.removeEventListener(MSt,m)}function wZr(t){bN("tab-route",{clientId:wC,participantId:G0e,route:t})}function Rze(t){return{ok:!1,reason:t instanceof Error?t.message:String(t)}}async function TZr(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 Rze(s)}}async function K0e(t,n){if(t!=="public")return TZr(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 Rze(s)}}async function MRt(){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 Rze(t)}}function Zbn(t){return`${Jl}/download?file=${encodeURIComponent(t)}`}class LSt extends Error{constructor(n,s){super(s),this.code=n,this.name="AssetDeliveryError"}}function BSt(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 Cge=new Map,Ege=new Set;function Fze(t,n){return`${t}:${n}`}function Qbn(t,n){return Cge.get(Fze(t,n))??null}function e2n(t){return Ege.add(t),()=>Ege.delete(t)}async function t2n(){try{const t=await fetch(`${Jl}/asset-library/downloaded`),n=await L_(t,"Could not read the downloaded-asset list");Cge.clear();for(const s of n.downloaded)Cge.set(Fze(s.source,s.id),`/${s.path}`);for(const s of Ege)s()}catch{}}async function r2n(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(sf(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 n2n(t,n){return CZr(t,n)}async function CZr(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 LSt("offline",m instanceof Error?m.message:BSt("offline"))}if(sf(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 LSt(g,m?.error??BSt(g))}return(await c.json()).files}async function i2n(t,n){const s=new URLSearchParams({source:t,id:n}),c=await fetch(`${Jl}/asset-library/preview?${s}`);return sf(c,"Could not resolve an asset preview"),c.ok?await c.json():null}async function o2n(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}:{}});sf(n,"Could not download the asset");const s=await n.json();if(s.ok&&s.path){Cge.set(Fze(t.source,t.id),`/${s.path}`);for(const c of Ege)c()}return s}async function s2n(t){const n=await fetch(`${Jl}/asset-library/history/capture`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t})});sf(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 a2n(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(sf(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 c2n(t,n){const s=new URLSearchParams({type:t});n&&s.set("source",n);const c=await fetch(`${Jl}/asset-library/categories?${s}`);return sf(c,"Could not read Asset Library categories"),c.ok?(await c.json()).categories:[]}function EZr(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 kZr(){let t;try{t=await fetch(`${Jl}/compatibility`,{cache:"no-store"})}catch(n){throw MFe(n instanceof Error?n.message:String(n))}if(t.status>=500)throw MFe(`HTTP ${t.status}`);try{CN(t,`GET ${Jl}/compatibility`)}catch{return null}try{return EZr(await t.json())}catch{return null}}async function Mze(){const t=await kZr();if(!t)throw p4r();return _4r(t),t}async function AZr(){try{const t=await fetch(`${Jl}/recent-projects`);return(await L_(t,"Could not list recent projects")).projects}catch{return[]}}async function l2n(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 $St={reopenLastProject:!1};async function DZr(){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:$St.reopenLastProject}}catch{return{...$St}}}async function u2n(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 f2n(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 sf(g,"Could not create the project"),await g.json()}async function d2n(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 p2n(t){const n=await fetch(`${Jl}/inspect-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});sf(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 _2n(t,n){const s=await fetch(`${Jl}/adapt-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,...n})});sf(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 bMe(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 m2n(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 jze(){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 h2n(){const t=await jze();return t.status==="project"?t.project:null}async function g2n(t){const n=await Mze(),s=await fetch(`${Jl}/open-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});let c;try{sf(s,`Could not open project at ${t}`),c=await s.json()}catch(m){throw MFe(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"&&u4r(m.recovery))throw new DC(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&&g$e(d.config,n),d}function X0e(t){return/^(\/|https?:|data:|blob:)/.test(t)?t:`/${t}`}async function PZr(t){try{const n=await fetch(X0e(t));if(n.ok)return await n.text()}catch{}return null}async function SMe(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 IZr(t){return(t.headers.get("content-type")??"").toLowerCase().includes("text/html")}async function jRt(t){try{const n=await fetch(X0e(t),{method:"HEAD"});return n.ok?IZr(n)?"absent":"present":"absent"}catch{return"unreachable"}}async function NZr(t){return await jRt(t)==="present"}async function y2n(t,n,s){try{const c=s==="base64"?w4r(n):n;return await gR().write(t,c),!0}catch{return!1}}async function LRt(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 v2n(){const t=await fetch(`${Jl}/validation-log`);return(await L_(t,"Could not read the server validation log")).entries??[]}async function OZr(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 RZr(){try{const t=await fetch(`${Jl}/editor-state`);return await L_(t,"Could not read editor state")}catch{return{}}}let qSt=!1;async function FZr(t,n={}){try{const s=await ZDt(`${Jl}/editor-state`,JSON.stringify(t),n.leaving===!0);return CN(s,"Could not save editor state"),!0}catch(s){return qSt||(qSt=!0,console.error(s instanceof Error?s.message:String(s))),!1}}let fZ=null,kge=null;async function BRt(){for(;fZ;){const t=fZ;fZ=null,await bN("state",{...t,_clientId:wC})}kge=null,fZ&&(kge=BRt())}function zSt(t){return fZ=t,kge??=BRt(),kge}async function MZr(t){await bN("command-received",{_requestId:t,_clientId:wC})}async function i_e(t){await bN("command-listener",{_clientId:wC,attached:t})}let jZr=0;function LZr(t){const n=++jZr;fZr(t.phase,wC,n),bN("play-phase",{_clientId:wC,...t,source:wC,sequence:n})}async function VSt(t,n,s,c,d=!1){const m={_requestId:t,_clientId:wC,ok:n,error:s,data:c};d?await xZr(t,m):await bN("command-result",m)}async function rte(t,n){sf(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 b2n(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 S2n(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 x2n(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 w2n(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 T2n(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 C2n(t){await fetch(`${Jl}/recording/abort`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id})}).catch(()=>{})}async function E2n(){const t=await fetch(`${Jl}/repository-presence`,{cache:"no-store"});if(sf(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 BZr(){const t=await fetch(`${Jl}/project`,{cache:"no-store"});if(sf(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);sf(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 $Rt(t){return{worktrees:Array.isArray(t.worktrees)?t.worktrees:[],branches:Array.isArray(t.branches)?t.branches:[]}}async function $Zr(){const t=await BR("/harnesses");return Array.isArray(t.harnesses)?t.harnesses:[]}async function qZr(){const t=await BR("");return $Rt(t)}async function zZr(t){return await BR("/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})})}async function USt(t,n="HEAD"){return await BR("/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t,from:n})})}async function VZr(t){return BR("/delegate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function UZr(t){const n=await BR("/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})});return $Rt(n).worktrees}async function JZr(t,n){await BR("/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t,sessionId:n})})}let Age=null;const xMe=new Set,wMe=new Set;function WZr(t){Age=t;for(const n of xMe)n(t);for(const n of wMe)n()}function Ih(){return Age}function k2n(t){return xMe.add(t),Age&&t(Age),()=>{xMe.delete(t)}}function o_e(t){return wMe.add(t),()=>{wMe.delete(t)}}const nA="references",qRt=["public",nA],Lze=`/project-game-static/${nA}/`;function Dge(t,n){return`${t}/${n}`}function Y0e(t,n){return t===nA?`${Lze}${n}`:`/${n}`}function HZr(t){return t.startsWith(Lze)}function GZr(t){const n=t.startsWith("/")?t:`/${t}`;if(HZr(n))return Dge(nA,n.slice(Lze.length));const s=t.startsWith("/")?t.slice(1):t;return s.startsWith("public/")?s:`public/${s}`}function zRt({assetPath:t,kind:n,sizeBytes:s}){return $.jsx(KZr,{assetPath:t,kind:n,sizeBytes:s},t)}function KZr({assetPath:t,kind:n,sizeBytes:s}){const c=t.split("#")[0],d=c.startsWith("/")||/^(?:data|blob|https?):/.test(c)?c:`/${c}`,m=GZr(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("/"),Fe=Ce.pop();return K0e(ue,Ce.join("/")).then(De=>{!pe&&De.ok&&S(De.entries.find(be=>be.name===Fe)?.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,q=k?.height,G=[];if(J&&q){let pe=J,ue=q;for(;ue;)[pe,ue]=[ue,pe%ue];G.push(["Dimensions",`${J} × ${q} px`],["Aspect ratio",`${J/pe}:${q/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]),$.jsxs("div",{"data-testid":"media-properties",style:{padding:8,fontSize:12},children:[F?$.jsx("p",{role:"status",style:{color:Zf[2]},children:F}):!k&&$.jsx("p",{role:"status",style:{color:Zf[3]},children:"Reading media properties…"}),$.jsx("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",gap:"10px 12px"},children:G.map(([pe,ue])=>$.jsxs("div",{style:{display:"contents"},children:[$.jsx("dt",{style:{color:Zf[3]},children:pe}),$.jsx("dd",{style:{margin:0,color:Zf[1],overflowWrap:"anywhere"},children:ue})]},pe))})]})}const Y7e=Ye.lazy(async()=>({default:(await fo(()=>Promise.resolve().then(()=>bTr),void 0)).AssetEditorShell})),XZr=Ye.lazy(async()=>({default:(await fo(()=>import("./AudioViewer-DESxi7pU.js"),__vite__mapDeps([254,1,2,3,4,20,21,22,23]))).AudioViewer})),YZr=Ye.lazy(async()=>({default:(await fo(()=>import("./ImageViewer-D16OExYu.js"),__vite__mapDeps([255,1,2,3,4,20,21,22,23]))).ImageViewer})),ZZr=Ye.lazy(async()=>({default:(await fo(()=>import("./VideoViewer-BxcUwXQm.js"),__vite__mapDeps([256,1,2,3,4,20,21,22,23]))).VideoViewer})),QZr=Ye.lazy(async()=>({default:(await fo(()=>import("./JsonAssetDocument-CvjTlcdr.js").then(n=>n.a),__vite__mapDeps([257,1,2,3,4,20,21]))).JsonAssetDocument})),JSt=Ye.lazy(async()=>({default:(await fo(()=>import("./OnlineAssetDetail-Dnckd7zB.js"),__vite__mapDeps([258,1,2,3,4,20,21,259,22,23]))).OnlineAssetDetail})),eQr=Ye.lazy(async()=>({default:(await fo(()=>import("./SourceAssetViewer-FSLup2km.js"),__vite__mapDeps([260,1,2,3,4,20,21,257,254,22,23,255]))).SourceAssetViewer})),K1=new Map,VRt=new Map,Z7e=new Map;let URt=0;const TMe=new Set;function nR(){URt++;for(const t of TMe)t()}function tQr(t){return TMe.add(t),()=>{TMe.delete(t)}}function rQr(){return URt}function nQr(t){return K1.get(t)}function JRt(t){return K1.has(t)}function iQr(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 Bze(t,n,s,c,d={}){typeof document<"u"&&document.activeElement instanceof HTMLElement&&Z7e.set(t,document.activeElement);const m=K1.get(t);if(!m)K1.set(t,s),nR();else{const S={...m,...s};iQr(m,S)||(K1.set(t,S),nR())}const g={id:t,title:n,kind:"asset",workspaceRole:"authored-subject",...c?{provenance:c}:{},Content:fQr,closeable:!0,presentation:()=>{const S=K1.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=K1.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=>{K1.delete(S)&&nR();const k=Z7e.get(S);Z7e.delete(S),k?.isConnected&&setTimeout(()=>k.focus(),0)}};return ND(g,d)}function sN(t,n,s={}){const c=$Yr(t),{frameName:d}=H0e(t),m=VRt.get(AO(t))??t;return Bze(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 NZr(s)?!1:(sN(s,c),!0)}});async function WRt(t,n){return EC(()=>{if(e_()!==t)return!1;const s=cBe(t);return s?n!=="model"||s.adapter!==null:!1},PR)}kN({id:"asset-editor:entity",owner:"asset-documents",open:(t,{entityId:n,title:s})=>Bze(`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=kze(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,WSt(n.assetKind,s))},ready:async(t,n)=>{const s=n.entityId?"model":WSt(n.assetKind,n.path??"");if(!await WRt(t,s))throw new Error(`Asset document did not finish mounting its Inspector: ${t}`);await SBe(t)}});function WSt(t,n){return t==="animation"?"source":t==="prefab"?"json":t??oQr(n)}function oQr(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 sQr(t,n){const s=XYr(n);return Bze(`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 aQr(t,n){const s=K1.get(t);if(!s)return;const{online:c,...d}=s;K1.set(t,{...d,assetPath:n}),nR()}function cQr(t,n){const s=K1.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)}`;K1.set(t,{...s,assetPath:d}),VRt.set(AO(d),t),R3t(t,d.split("/").pop()??d),nR()}else n.type==="delete"&&n.paths?.some(d=>AO(d)===c)?(K1.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)&&(K1.set(t,{...s,revision:(s.revision??0)+1}),nR())}function lQr(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 Q7e(t){return{id:"source",title:"Source",icon:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx("div",{style:{padding:4},children:t.sourcePath??t.assetPath})}}}function uQr({id:t,spec:n,active:s}){if(n.unavailableReason)return $.jsx(Y7e,{documentId:t,active:s,type:n.kind,title:n.assetPath.split("/").pop()||"Deleted asset",status:"Source unavailable",children:$.jsx("div",{style:{padding:20,color:C_e},children:n.unavailableReason})});const c=lQr(n);if(c==="online"&&n.online){const k=n.online;return $.jsx(Y7e,{documentId:t,active:s,type:"online",title:k.name,sections:[{id:"online-asset",title:"Asset",icon:F0r,order:fQ,body:{kind:"custom",render:()=>$.jsx(JSt,{online:k,mode:"inspector",onResolved:A=>aQr(t,A)})}}],status:`${k.type} · ${k.source}`,children:$.jsx(JSt,{online:k,mode:"preview"})})}const d=(n.displayName??n.assetPath.split("/").pop())||n.entityId||"Asset",m=`${t}:${n.revision??0}`,g=$.jsxs("div",{style:{padding:20,color:C_e},children:["No editor package in this project renders ",d,"."]});if(c==="model")return n.assetPath?$.jsx(X7e,{route:"model",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m):n.entityId?$.jsx(X7e,{route:"entity-model",documentId:t,assetPath:"",entityId:n.entityId,displayName:d,active:s,whenUnregistered:g},m):$.jsx("div",{style:{padding:20,color:C_e},children:"Model source is unavailable."});if(c==="environment")return $.jsx(X7e,{route:"environment",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m);if(c==="source")return $.jsx(eQr,{documentId:t,assetPath:n.assetPath,active:s},m);if(c==="json")return $.jsx(QZr,{documentId:t,assetPath:n.assetPath,displayName:d,active:s,sections:[Q7e(n)],status:`json · ${n.sourcePath??n.displayName??n.assetPath}`},m);let S;switch(c){case"image":S=$.jsx(YZr,{assetPath:n.assetPath,...n.displayName?{displayName:n.displayName}:{}},m);break;case"video":S=$.jsx(ZZr,{assetPath:n.assetPath},m);break;case"audio":S=$.jsx(XZr,{assetPath:n.assetPath},m);break;default:S=$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"No viewer available for this asset type."})}return $.jsx(Y7e,{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:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx(zRt,{assetPath:n.assetPath,kind:c},m)}},...n.sourcePath?[Q7e(n)]:[]]:[Q7e(n)],status:`${c} · ${n.sourcePath??n.displayName??n.assetPath}`,children:S})}function fQr({documentId:t,active:n}){Ye.useSyncExternalStore(tQr,rQr),Ye.useEffect(()=>{const c=d=>{cQr(t,d.detail)};return window.addEventListener("editor:asset-mutation",c),()=>window.removeEventListener("editor:asset-mutation",c)},[t]);const s=K1.get(t);return $.jsx("div",{"data-testid":`asset-document:${t}`,style:{flex:1,minHeight:0,overflow:"hidden",pointerEvents:"auto",background:hBe[1]},children:s?$.jsx(Ye.Suspense,{fallback:$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"Loading asset viewer…"}),children:$.jsx(uQr,{id:t,spec:s,active:n})}):$.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 HRt=["three","pixi","dom","babylon","phaser"],$ze=Object.freeze({up:"y",groundHeight:0}),GRt=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(),dQr=Pa({up:ed(["y","z"]).describe("World axis pointing away from the ground"),groundHeight:fu().describe("Ground offset along `up`, in world units")}).strict(),pQr=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(HRt).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(ZLe)).describe("Anchor kinds this region’s writer serves"),basis:dQr.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(GRt).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(),_Qr=AR([Dg("manifest-roots"),Gd(pQr).min(1)]),mQr=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(GRt).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."}),hQr=wD(bo().min(1),mQr).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 qze(t,n={}){return t.map(s=>({...yQr(s),...gQr(n[s.id])}))}function gQr(t){return t?{...t.include?{include:t.include}:{},...t.mounts?{mounts:t.mounts}:{}}:{}}function KRt(t,n){const s=new Set(t.map(c=>c.id));return Object.keys(n).filter(c=>!s.has(c))}function yQr(t){const n=t.surface,s=t.adapter.type==="builtin",c=n==="canvas"?"pixi":n,d=$ze;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",vQr=Pa({finder:bo().min(1).describe("Registered finder name")}).passthrough(),bQr=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()]),HSt=Pa({path:bo().min(1),export:bo().min(1).optional()}).strict(),SQr=Pa({id:bo().min(1),label:bo().min(1),kind:bo().min(1),region:bo().min(1).nullable(),authorable:_y(),reach:bQr,source:HSt.optional(),isolationSetup:HSt.optional(),finder:bo().min(1).optional()}).strict(),xQr=Pa({entries:Gd(SQr).optional(),find:Gd(vQr).optional(),default:bo().min(1).optional()}).strict(),XRt=["command","state"],wQr="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.",TQr=Pa({id:bo().min(1),kind:ed(XRt,{error:()=>wQr}),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"}),CQr=["digital","scalar","vector2","pointerDelta","pointerPosition"],EQr=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(),kQr=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(),AQr="`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.",YRt=Pa({editor:kQr.optional(),regions:_Qr.optional(),regionIncludes:hQr.optional(),documents:xQr.optional(),observation:Gd(TQr).optional(),input:EQr.optional()}).strict().refine(t=>t.regionIncludes===void 0||Object.keys(t.regionIncludes).length===0||!Array.isArray(t.regions),{message:AQr});function zze(t={}){const n=YRt.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 zze({regions:"manifest-roots",...t.regionIncludes?{regionIncludes:t.regionIncludes}:{},documents:{...t.scenes?{entries:t.scenes}:{},find:[{finder:"scenesFromEntrypointSelection",regions:VQ},{finder:"prefabsFromStories"}]}})}function CMe(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 zze(t)}const A2n=Object.freeze(Object.defineProperty({__proto__:null,ADAPTER_INPUT_VALUE_TYPES:CQr,AdapterDefinitionSchema:YRt,EXPORTED_COMPOSITION_REGIONS:VQ,NATIVE_REGION_BASIS:$ze,OBSERVATION_KINDS:XRt,SUBSTRATE_NAMES:HRt,defineAdapter:zze,nativeAdapter:DO,parseAdapterDefinition:CMe,regionsFromManifestRoots:qze,unmatchedRegionIncludeIds:KRt},Symbol.toStringTag,{value:"Module"})),MZ=new Map;function Vze(t){const n=t;return MZ.set(t.name,n),()=>{MZ.get(t.name)===n&&MZ.delete(t.name)}}function Uze(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 Vze(s)}function ZRt(){return[...MZ.keys()]}function QRt(t,n){const s=MZ.get(t.finder);if(!s){const d=ZRt();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 D2n=Object.freeze(Object.defineProperty({__proto__:null,registerContributedFinder:Uze,registerFinder:Vze,registeredFinderNames:ZRt,runRegisteredFinder:QRt},Symbol.toStringTag,{value:"Module"}));function GSt(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 eOe={exports:{}};const DQr={},PQr=Object.freeze(Object.defineProperty({__proto__:null,default:DQr},Symbol.toStringTag,{value:"Module"})),wI=Xyr(PQr);var KSt;function IQr(){return KSt||(KSt=1,(function(t){var n={};/*! *****************************************************************************
|
|
942
|
+
</style><main><div class="brand-mark">${s4r()}</div><h1>Session ended</h1><p>This editor session has ended. You can close this tab.</p></main>`})}))}const Tge=new Set;function sZr(t){return Tge.add(t),()=>{Tge.delete(t)}}function aZr(){try{window.focus()}catch{}if(Tge.size===0){window.location.reload();return}for(const t of[...Tge])t()}function cZr(t,n,s={}){t.addEventListener("tab-refocus",c=>eZr(c)),t.addEventListener("tab-yield",c=>tZr(n,c)),t.addEventListener("tab-close",()=>oZr(n,s)),t.addEventListener("tab-adopt",()=>aZr())}const $k="/__editor",lZr=globalThis,md=lZr.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__,wC=md?.clientId??globalThis.crypto?.randomUUID?.()??`editor-${Date.now()}`,G0e=jAt,uZr=Qxr;function fZr(t,n,s){md?.reportPhase?.(t,n,s)}function dZr(t){md?.reportCensus?.(t)}function pZr(){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 _Zr(){const t=new URLSearchParams({clientId:wC,participantId:G0e,displayName:uZr});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 RRt=new Set(["editor-command"]);function FRt(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 mZr(t){P$!==t&&(P$=t,cZr(t,$k,{tabId:md?.tabId,epoch:md?.epoch}),FRt(t,n=>!RRt.has(n)))}function jD(){kw||(md?.source?(kw=md.source,md.pageOwned&&eB++):(kw=new EventSource(_Zr()),md&&(md.source=kw)));const t=kw;mZr(t),eB++;const n=[];let s=!1;return{addEventListener(c,d){const m=d;t.addEventListener(c,m),n.push({type:c,listener:m}),RRt.has(c)&&FRt(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 hZr(){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 gZr(){if(typeof EventSource>"u")return()=>{};const t=jD(),n=Oze(c=>{c!==null&&c.reason!=="server-gone"&&pZr()}),s=vZr();return()=>{s(),n(),t.close()}}const yZr=5;function vZr(){if(typeof window>"u")return()=>{};let t=0;const n=d=>{d===""||t>=yZr||(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;k4t(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 bZr=2e3,SZr={"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(SZr[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 xZr(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(MSt,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,bZr)})]),S!==void 0&&clearTimeout(S),k||await FZ("command-result",n),s.removeEventListener(MSt,m)}function wZr(t){bN("tab-route",{clientId:wC,participantId:G0e,route:t})}function Rze(t){return{ok:!1,reason:t instanceof Error?t.message:String(t)}}async function TZr(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 Rze(s)}}async function K0e(t,n){if(t!=="public")return TZr(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 Rze(s)}}async function MRt(){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 Rze(t)}}function Zbn(t){return`${Jl}/download?file=${encodeURIComponent(t)}`}class LSt extends Error{constructor(n,s){super(s),this.code=n,this.name="AssetDeliveryError"}}function BSt(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 Cge=new Map,Ege=new Set;function Fze(t,n){return`${t}:${n}`}function Qbn(t,n){return Cge.get(Fze(t,n))??null}function e2n(t){return Ege.add(t),()=>Ege.delete(t)}async function t2n(){try{const t=await fetch(`${Jl}/asset-library/downloaded`),n=await L_(t,"Could not read the downloaded-asset list");Cge.clear();for(const s of n.downloaded)Cge.set(Fze(s.source,s.id),`/${s.path}`);for(const s of Ege)s()}catch{}}async function r2n(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(sf(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 n2n(t,n){return CZr(t,n)}async function CZr(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 LSt("offline",m instanceof Error?m.message:BSt("offline"))}if(sf(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 LSt(g,m?.error??BSt(g))}return(await c.json()).files}async function i2n(t,n){const s=new URLSearchParams({source:t,id:n}),c=await fetch(`${Jl}/asset-library/preview?${s}`);return sf(c,"Could not resolve an asset preview"),c.ok?await c.json():null}async function o2n(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}:{}});sf(n,"Could not download the asset");const s=await n.json();if(s.ok&&s.path){Cge.set(Fze(t.source,t.id),`/${s.path}`);for(const c of Ege)c()}return s}async function s2n(t){const n=await fetch(`${Jl}/asset-library/history/capture`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t})});sf(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 a2n(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(sf(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 c2n(t,n){const s=new URLSearchParams({type:t});n&&s.set("source",n);const c=await fetch(`${Jl}/asset-library/categories?${s}`);return sf(c,"Could not read Asset Library categories"),c.ok?(await c.json()).categories:[]}function EZr(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 kZr(){let t;try{t=await fetch(`${Jl}/compatibility`,{cache:"no-store"})}catch(n){throw MFe(n instanceof Error?n.message:String(n))}if(t.status>=500)throw MFe(`HTTP ${t.status}`);try{CN(t,`GET ${Jl}/compatibility`)}catch{return null}try{return EZr(await t.json())}catch{return null}}async function Mze(){const t=await kZr();if(!t)throw p4r();return _4r(t),t}async function AZr(){try{const t=await fetch(`${Jl}/recent-projects`);return(await L_(t,"Could not list recent projects")).projects}catch{return[]}}async function l2n(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 $St={reopenLastProject:!1};async function DZr(){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:$St.reopenLastProject}}catch{return{...$St}}}async function u2n(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 f2n(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 sf(g,"Could not create the project"),await g.json()}async function d2n(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 p2n(t){const n=await fetch(`${Jl}/inspect-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});sf(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 _2n(t,n){const s=await fetch(`${Jl}/adapt-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,...n})});sf(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 bMe(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 m2n(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 jze(){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 h2n(){const t=await jze();return t.status==="project"?t.project:null}async function g2n(t){const n=await Mze(),s=await fetch(`${Jl}/open-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});let c;try{sf(s,`Could not open project at ${t}`),c=await s.json()}catch(m){throw MFe(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"&&u4r(m.recovery))throw new DC(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&&g$e(d.config,n),d}function X0e(t){return/^(\/|https?:|data:|blob:)/.test(t)?t:`/${t}`}async function PZr(t){try{const n=await fetch(X0e(t));if(n.ok)return await n.text()}catch{}return null}async function SMe(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 IZr(t){return(t.headers.get("content-type")??"").toLowerCase().includes("text/html")}async function jRt(t){try{const n=await fetch(X0e(t),{method:"HEAD"});return n.ok?IZr(n)?"absent":"present":"absent"}catch{return"unreachable"}}async function NZr(t){return await jRt(t)==="present"}async function y2n(t,n,s){try{const c=s==="base64"?w4r(n):n;return await gR().write(t,c),!0}catch{return!1}}async function LRt(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 v2n(){const t=await fetch(`${Jl}/validation-log`);return(await L_(t,"Could not read the server validation log")).entries??[]}async function OZr(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 RZr(){try{const t=await fetch(`${Jl}/editor-state`);return await L_(t,"Could not read editor state")}catch{return{}}}let qSt=!1;async function FZr(t,n={}){try{const s=await ZDt(`${Jl}/editor-state`,JSON.stringify(t),n.leaving===!0);return CN(s,"Could not save editor state"),!0}catch(s){return qSt||(qSt=!0,console.error(s instanceof Error?s.message:String(s))),!1}}let fZ=null,kge=null;async function BRt(){for(;fZ;){const t=fZ;fZ=null,await bN("state",{...t,_clientId:wC})}kge=null,fZ&&(kge=BRt())}function zSt(t){return fZ=t,kge??=BRt(),kge}async function MZr(t){await bN("command-received",{_requestId:t,_clientId:wC})}async function i_e(t){await bN("command-listener",{_clientId:wC,attached:t})}let jZr=0;function LZr(t){const n=++jZr;fZr(t.phase,wC,n),bN("play-phase",{_clientId:wC,...t,source:wC,sequence:n})}async function VSt(t,n,s,c,d=!1){const m={_requestId:t,_clientId:wC,ok:n,error:s,data:c};d?await xZr(t,m):await bN("command-result",m)}async function rte(t,n){sf(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 b2n(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 S2n(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 x2n(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 w2n(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 T2n(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 C2n(t){await fetch(`${Jl}/recording/abort`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id})}).catch(()=>{})}async function E2n(){const t=await fetch(`${Jl}/repository-presence`,{cache:"no-store"});if(sf(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 BZr(){const t=await fetch(`${Jl}/project`,{cache:"no-store"});if(sf(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);sf(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 $Rt(t){return{worktrees:Array.isArray(t.worktrees)?t.worktrees:[],branches:Array.isArray(t.branches)?t.branches:[]}}async function $Zr(){const t=await BR("/harnesses");return Array.isArray(t.harnesses)?t.harnesses:[]}async function qZr(){const t=await BR("");return $Rt(t)}async function zZr(t){return await BR("/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})})}async function USt(t,n="HEAD"){return await BR("/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t,from:n})})}async function VZr(t){return BR("/delegate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function UZr(t){const n=await BR("/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})});return $Rt(n).worktrees}async function JZr(t,n){await BR("/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t,sessionId:n})})}let Age=null;const xMe=new Set,wMe=new Set;function WZr(t){Age=t;for(const n of xMe)n(t);for(const n of wMe)n()}function Ih(){return Age}function k2n(t){return xMe.add(t),Age&&t(Age),()=>{xMe.delete(t)}}function o_e(t){return wMe.add(t),()=>{wMe.delete(t)}}const nA="references",qRt=["public",nA],Lze=`/project-game-static/${nA}/`;function Dge(t,n){return`${t}/${n}`}function Y0e(t,n){return t===nA?`${Lze}${n}`:`/${n}`}function HZr(t){return t.startsWith(Lze)}function GZr(t){const n=t.startsWith("/")?t:`/${t}`;if(HZr(n))return Dge(nA,n.slice(Lze.length));const s=t.startsWith("/")?t.slice(1):t;return s.startsWith("public/")?s:`public/${s}`}function zRt({assetPath:t,kind:n,sizeBytes:s}){return $.jsx(KZr,{assetPath:t,kind:n,sizeBytes:s},t)}function KZr({assetPath:t,kind:n,sizeBytes:s}){const c=t.split("#")[0],d=c.startsWith("/")||/^(?:data|blob|https?):/.test(c)?c:`/${c}`,m=GZr(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("/"),Fe=Ce.pop();return K0e(ue,Ce.join("/")).then(De=>{!pe&&De.ok&&S(De.entries.find(be=>be.name===Fe)?.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,q=k?.height,G=[];if(J&&q){let pe=J,ue=q;for(;ue;)[pe,ue]=[ue,pe%ue];G.push(["Dimensions",`${J} × ${q} px`],["Aspect ratio",`${J/pe}:${q/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]),$.jsxs("div",{"data-testid":"media-properties",style:{padding:8,fontSize:12},children:[F?$.jsx("p",{role:"status",style:{color:Zf[2]},children:F}):!k&&$.jsx("p",{role:"status",style:{color:Zf[3]},children:"Reading media properties…"}),$.jsx("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",gap:"10px 12px"},children:G.map(([pe,ue])=>$.jsxs("div",{style:{display:"contents"},children:[$.jsx("dt",{style:{color:Zf[3]},children:pe}),$.jsx("dd",{style:{margin:0,color:Zf[1],overflowWrap:"anywhere"},children:ue})]},pe))})]})}const Y7e=Ye.lazy(async()=>({default:(await fo(()=>Promise.resolve().then(()=>bTr),void 0)).AssetEditorShell})),XZr=Ye.lazy(async()=>({default:(await fo(()=>import("./AudioViewer-BdTHfNhD.js"),__vite__mapDeps([254,1,2,3,4,20,21,22,23]))).AudioViewer})),YZr=Ye.lazy(async()=>({default:(await fo(()=>import("./ImageViewer-DiD2yIG4.js"),__vite__mapDeps([255,1,2,3,4,20,21,22,23]))).ImageViewer})),ZZr=Ye.lazy(async()=>({default:(await fo(()=>import("./VideoViewer-CxajgKrf.js"),__vite__mapDeps([256,1,2,3,4,20,21,22,23]))).VideoViewer})),QZr=Ye.lazy(async()=>({default:(await fo(()=>import("./JsonAssetDocument-xyXetSbl.js").then(n=>n.a),__vite__mapDeps([257,1,2,3,4,20,21]))).JsonAssetDocument})),JSt=Ye.lazy(async()=>({default:(await fo(()=>import("./OnlineAssetDetail-BnT8_p1W.js"),__vite__mapDeps([258,1,2,3,4,20,21,259,22,23]))).OnlineAssetDetail})),eQr=Ye.lazy(async()=>({default:(await fo(()=>import("./SourceAssetViewer-D0NgGrER.js"),__vite__mapDeps([260,1,2,3,4,20,21,257,254,22,23,255]))).SourceAssetViewer})),K1=new Map,VRt=new Map,Z7e=new Map;let URt=0;const TMe=new Set;function nR(){URt++;for(const t of TMe)t()}function tQr(t){return TMe.add(t),()=>{TMe.delete(t)}}function rQr(){return URt}function nQr(t){return K1.get(t)}function JRt(t){return K1.has(t)}function iQr(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 Bze(t,n,s,c,d={}){typeof document<"u"&&document.activeElement instanceof HTMLElement&&Z7e.set(t,document.activeElement);const m=K1.get(t);if(!m)K1.set(t,s),nR();else{const S={...m,...s};iQr(m,S)||(K1.set(t,S),nR())}const g={id:t,title:n,kind:"asset",workspaceRole:"authored-subject",...c?{provenance:c}:{},Content:fQr,closeable:!0,presentation:()=>{const S=K1.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=K1.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=>{K1.delete(S)&&nR();const k=Z7e.get(S);Z7e.delete(S),k?.isConnected&&setTimeout(()=>k.focus(),0)}};return ND(g,d)}function sN(t,n,s={}){const c=$Yr(t),{frameName:d}=H0e(t),m=VRt.get(AO(t))??t;return Bze(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 NZr(s)?!1:(sN(s,c),!0)}});async function WRt(t,n){return EC(()=>{if(e_()!==t)return!1;const s=cBe(t);return s?n!=="model"||s.adapter!==null:!1},PR)}kN({id:"asset-editor:entity",owner:"asset-documents",open:(t,{entityId:n,title:s})=>Bze(`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=kze(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,WSt(n.assetKind,s))},ready:async(t,n)=>{const s=n.entityId?"model":WSt(n.assetKind,n.path??"");if(!await WRt(t,s))throw new Error(`Asset document did not finish mounting its Inspector: ${t}`);await SBe(t)}});function WSt(t,n){return t==="animation"?"source":t==="prefab"?"json":t??oQr(n)}function oQr(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 sQr(t,n){const s=XYr(n);return Bze(`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 aQr(t,n){const s=K1.get(t);if(!s)return;const{online:c,...d}=s;K1.set(t,{...d,assetPath:n}),nR()}function cQr(t,n){const s=K1.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)}`;K1.set(t,{...s,assetPath:d}),VRt.set(AO(d),t),R3t(t,d.split("/").pop()??d),nR()}else n.type==="delete"&&n.paths?.some(d=>AO(d)===c)?(K1.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)&&(K1.set(t,{...s,revision:(s.revision??0)+1}),nR())}function lQr(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 Q7e(t){return{id:"source",title:"Source",icon:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx("div",{style:{padding:4},children:t.sourcePath??t.assetPath})}}}function uQr({id:t,spec:n,active:s}){if(n.unavailableReason)return $.jsx(Y7e,{documentId:t,active:s,type:n.kind,title:n.assetPath.split("/").pop()||"Deleted asset",status:"Source unavailable",children:$.jsx("div",{style:{padding:20,color:C_e},children:n.unavailableReason})});const c=lQr(n);if(c==="online"&&n.online){const k=n.online;return $.jsx(Y7e,{documentId:t,active:s,type:"online",title:k.name,sections:[{id:"online-asset",title:"Asset",icon:F0r,order:fQ,body:{kind:"custom",render:()=>$.jsx(JSt,{online:k,mode:"inspector",onResolved:A=>aQr(t,A)})}}],status:`${k.type} · ${k.source}`,children:$.jsx(JSt,{online:k,mode:"preview"})})}const d=(n.displayName??n.assetPath.split("/").pop())||n.entityId||"Asset",m=`${t}:${n.revision??0}`,g=$.jsxs("div",{style:{padding:20,color:C_e},children:["No editor package in this project renders ",d,"."]});if(c==="model")return n.assetPath?$.jsx(X7e,{route:"model",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m):n.entityId?$.jsx(X7e,{route:"entity-model",documentId:t,assetPath:"",entityId:n.entityId,displayName:d,active:s,whenUnregistered:g},m):$.jsx("div",{style:{padding:20,color:C_e},children:"Model source is unavailable."});if(c==="environment")return $.jsx(X7e,{route:"environment",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m);if(c==="source")return $.jsx(eQr,{documentId:t,assetPath:n.assetPath,active:s},m);if(c==="json")return $.jsx(QZr,{documentId:t,assetPath:n.assetPath,displayName:d,active:s,sections:[Q7e(n)],status:`json · ${n.sourcePath??n.displayName??n.assetPath}`},m);let S;switch(c){case"image":S=$.jsx(YZr,{assetPath:n.assetPath,...n.displayName?{displayName:n.displayName}:{}},m);break;case"video":S=$.jsx(ZZr,{assetPath:n.assetPath},m);break;case"audio":S=$.jsx(XZr,{assetPath:n.assetPath},m);break;default:S=$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"No viewer available for this asset type."})}return $.jsx(Y7e,{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:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx(zRt,{assetPath:n.assetPath,kind:c},m)}},...n.sourcePath?[Q7e(n)]:[]]:[Q7e(n)],status:`${c} · ${n.sourcePath??n.displayName??n.assetPath}`,children:S})}function fQr({documentId:t,active:n}){Ye.useSyncExternalStore(tQr,rQr),Ye.useEffect(()=>{const c=d=>{cQr(t,d.detail)};return window.addEventListener("editor:asset-mutation",c),()=>window.removeEventListener("editor:asset-mutation",c)},[t]);const s=K1.get(t);return $.jsx("div",{"data-testid":`asset-document:${t}`,style:{flex:1,minHeight:0,overflow:"hidden",pointerEvents:"auto",background:hBe[1]},children:s?$.jsx(Ye.Suspense,{fallback:$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"Loading asset viewer…"}),children:$.jsx(uQr,{id:t,spec:s,active:n})}):$.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 HRt=["three","pixi","dom","babylon","phaser"],$ze=Object.freeze({up:"y",groundHeight:0}),GRt=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(),dQr=Pa({up:ed(["y","z"]).describe("World axis pointing away from the ground"),groundHeight:fu().describe("Ground offset along `up`, in world units")}).strict(),pQr=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(HRt).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(ZLe)).describe("Anchor kinds this region’s writer serves"),basis:dQr.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(GRt).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(),_Qr=AR([Dg("manifest-roots"),Gd(pQr).min(1)]),mQr=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(GRt).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."}),hQr=wD(bo().min(1),mQr).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 qze(t,n={}){return t.map(s=>({...yQr(s),...gQr(n[s.id])}))}function gQr(t){return t?{...t.include?{include:t.include}:{},...t.mounts?{mounts:t.mounts}:{}}:{}}function KRt(t,n){const s=new Set(t.map(c=>c.id));return Object.keys(n).filter(c=>!s.has(c))}function yQr(t){const n=t.surface,s=t.adapter.type==="builtin",c=n==="canvas"?"pixi":n,d=$ze;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",vQr=Pa({finder:bo().min(1).describe("Registered finder name")}).passthrough(),bQr=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()]),HSt=Pa({path:bo().min(1),export:bo().min(1).optional()}).strict(),SQr=Pa({id:bo().min(1),label:bo().min(1),kind:bo().min(1),region:bo().min(1).nullable(),authorable:_y(),reach:bQr,source:HSt.optional(),isolationSetup:HSt.optional(),finder:bo().min(1).optional()}).strict(),xQr=Pa({entries:Gd(SQr).optional(),find:Gd(vQr).optional(),default:bo().min(1).optional()}).strict(),XRt=["command","state"],wQr="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.",TQr=Pa({id:bo().min(1),kind:ed(XRt,{error:()=>wQr}),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"}),CQr=["digital","scalar","vector2","pointerDelta","pointerPosition"],EQr=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(),kQr=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(),AQr="`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.",YRt=Pa({editor:kQr.optional(),regions:_Qr.optional(),regionIncludes:hQr.optional(),documents:xQr.optional(),observation:Gd(TQr).optional(),input:EQr.optional()}).strict().refine(t=>t.regionIncludes===void 0||Object.keys(t.regionIncludes).length===0||!Array.isArray(t.regions),{message:AQr});function zze(t={}){const n=YRt.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 zze({regions:"manifest-roots",...t.regionIncludes?{regionIncludes:t.regionIncludes}:{},documents:{...t.scenes?{entries:t.scenes}:{},find:[{finder:"scenesFromEntrypointSelection",regions:VQ},{finder:"prefabsFromStories"}]}})}function CMe(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 zze(t)}const A2n=Object.freeze(Object.defineProperty({__proto__:null,ADAPTER_INPUT_VALUE_TYPES:CQr,AdapterDefinitionSchema:YRt,EXPORTED_COMPOSITION_REGIONS:VQ,NATIVE_REGION_BASIS:$ze,OBSERVATION_KINDS:XRt,SUBSTRATE_NAMES:HRt,defineAdapter:zze,nativeAdapter:DO,parseAdapterDefinition:CMe,regionsFromManifestRoots:qze,unmatchedRegionIncludeIds:KRt},Symbol.toStringTag,{value:"Module"})),MZ=new Map;function Vze(t){const n=t;return MZ.set(t.name,n),()=>{MZ.get(t.name)===n&&MZ.delete(t.name)}}function Uze(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 Vze(s)}function ZRt(){return[...MZ.keys()]}function QRt(t,n){const s=MZ.get(t.finder);if(!s){const d=ZRt();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 D2n=Object.freeze(Object.defineProperty({__proto__:null,registerContributedFinder:Uze,registerFinder:Vze,registeredFinderNames:ZRt,runRegisteredFinder:QRt},Symbol.toStringTag,{value:"Module"}));function GSt(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 eOe={exports:{}};const DQr={},PQr=Object.freeze(Object.defineProperty({__proto__:null,default:DQr},Symbol.toStringTag,{value:"Module"})),wI=Xyr(PQr);var KSt;function IQr(){return KSt||(KSt=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
|
|
@@ -1391,14 +1391,14 @@ Fix: rename it — \`git mv ${ame} ${xR}\`. The contents are unchanged; only the
|
|
|
1391
1391
|
Failed to load volter.project.json: ${s.status} ${s.statusText}`);let c;try{c=await s.json()}catch(g){throw new Error(`Could not open project at ${t}.
|
|
1392
1392
|
volter.project.json is not valid JSON: ${g instanceof Error?g.message:String(g)}`)}g$e(c&&typeof c=="object"?c:{},n);let d;try{d=Wze(c,{configurationKinds:"defer"})}catch(g){throw new Error(`Could not open project at ${t}.
|
|
1393
1393
|
volter.project.json does not match the current project format:
|
|
1394
|
-
${xen(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:gFt(d.authoring.hierarchy)}:void 0,hasThreeRoot:aFt(d,"three"),rootCount:d.roots.length,configurations:d.configurations};return cLe({rootPath:t,config:m})}const Ten=3,Cen=300;async function yFt(){const t=await Mze();for(let n=1;;n++){const s=await jze(),c=g4r({status:s.status,attempt:n,maxAttempts:Ten});if(c==="continue-ladder")return null;if(c==="open"&&s.status==="project"){const d=s.project;return g$e(d.config,t),cLe({rootPath:d.path,config:d.config})}if(c==="retry"){await new Promise(d=>setTimeout(d,Cen));continue}throw new y$e(y4r(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 Een(){x4r(window.location.search);const t=await yFt();return t||ken()}async function ken(){const[t,n]=await Promise.all([DZr(),AZr()]),s=h4r({explicitTarget:null,hubRequested:S4r(window.location.search),reopenLastEnabled:t.reopenLastProject,recents:n});if(s.kind!=="reopen-last")return null;try{return await wen(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 OMe=new Map;function K2n(t){for(const[n,s]of OMe)if(vFt(n,t))return s;return null}function X2n(t){for(const n of[...OMe.keys()])vFt(n,t)&&OMe.delete(n)}function ZSt(t){return t.replaceAll("\\","/")}function vFt(t,n){const s=ZSt(t),c=ZSt(n).replace(/^\.?\//,"");return s===c||s.endsWith(`/${c}`)}function bFt(t){return()=>{}}function Aen(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 QSt(t){const n=t.replaceAll("\\","/").replace(/^\.\//,""),s=n.lastIndexOf("/");return s>=0?n.slice(0,s):""}function Den(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 Pen(t,n){const s=n?t.filter(d=>QSt(d.modulePath)===QSt(n.path)):[],c=s.length>0?s:t;return{chosen:c.find(d=>d.isDefault===!0)??c[0],colocated:s.length>0}}function Ien(t,n){const s=[],c=[];for(const[d,m]of Den(n.stories)){const g=n.components?.find(A=>A.name===d),{chosen:S,colocated:k}=Pen(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 Nen(){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:vRt(s)});return t}const Oen={name:"prefabsFromStories",schema:Pa({finder:Dg("prefabsFromStories")}).strict(),run(t,n){return Ien(t,{stories:Nen(),...n.components===void 0?{}:{components:n.components}})}},LB="volter.adapter.ts";let LZ=null,Nge=null,Z0e="__unscoped__",iR=null,SFt=0;const UQ=new Set;function u0(){return Z0e===Em()?LZ:null}async function Y2n(){return iR&&await iR,Z0e===Em()?Nge:null}function Gze(){const t=()=>!of()||!!u0();return t()?Promise.resolve():new Promise(n=>{const s=OC(()=>{t()&&(s(),n())})})}async function Ren(){for(await(await fo(async()=>{const{projectBootstrapSettled:n}=await Promise.resolve().then(()=>Z9t);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){Z0e=Em(),LZ=t,Nge=c,wEr(c?.editor),ven(t?.regions??[]),een(n),ten(s??null);for(const d of UQ)d();JEr()}function Fen(t){return{id:t.id,kind:t.kind,answered:t.answer!==void 0}}function Men(t){const{Layout:n,...s}=t;return{...s,...n?{layout:n.displayName??n.name??"Project layout"}:{}}}async function jen(t){return await import(`${Jze(t,LB)}?t=${Date.now()}`)}function Len(t,n){return t.find(s=>s.surface===n)?.id??null}function Ben(t){const n=new Set(t.map(s=>s.path));return(s,c)=>Aen(s,c,n)}function $en(t){const n=cFt(t);return n.length===1?n[0].id:null}const qen={entrypoints:[],components:[]};async function zen(t,n,s){const c=[];for(const A of MB(t))A.entry&&c.push({regionId:A.id,path:A.entry,source:await SMe(A.entry)});let d=[];const m=await MRt().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:Len(n,A.surface)})):ea.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 LRt([...g],{order:"mtime"}).catch(()=>[]);for(const F of A){k.push(F);const D=await SMe(F);D!==null&&!D.includes("\0")&&S.push({path:F,source:D})}}return{entrypoints:c,components:d,sources:S,files:k,resolveModule:Ben(d)}}function Ven(t,n){const s=[...t.documents.entries??[]],c=[],d=[];let m=0;for(const S of t.documents.find??[]){let k;try{k=KQr(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 Z2n(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 ext(t){for(const n of MI){const s=n.modulePathFor(t);if(s!==null)return{source:n,modulePath:s}}return null}function txt(t){return t!==null&&typeof t=="object"&&"default"in t?t.default:t}function KL(t,n){if(t.kind==="present")try{return{definition:CMe(txt(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:CMe(txt(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/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 Uen(t,n,s){const{definition:c,source:d,modulePath:m,error:g}=n,S=c.regions==="manifest-roots"?qze(MB(t),c.regionIncludes):[...c.regions],k=KRt(MB(t),c.regionIncludes),{table:A,notes:F,unresolved:D}=Ven(c,s);return{source:d,modulePath:m,regions:S,scenes:A,documentsPending:D>0,...c.editor?{editor:Men(c.editor)}:{},observation:c.observation.map(Fen),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 Jen(t,n){const s=$en(n),c=await jRt(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=ext(s);if(m===null&&(await Wen(s),m=ext(s)),m===null){const g=KL(d,{kind:"unanswered",rootId:s,sources:MI.length});return g.error&&ea.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 rxt=null,s_e=null,RMe=null;function nxt(){return RMe}function Wen(t){const n=Em();if(rxt!==n&&(rxt=n,s_e=null),!s_e){RMe=`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(()=>{RMe=null;for(const s of UQ)s()})}return s_e}let rOe=[],FMe="";function Hen(){const t=t$e(),n=t.map(s=>s.entryPath).join("|");if(!(n===FMe&&t.every(s=>lme.has(s.module)))){for(const s of rOe)s();rOe=[],lme=new WeakSet;for(const{entryPath:s,module:c}of t)try{rOe.push(Uze(c?.finder,s)),lme.add(c)}catch(d){ea.error(d instanceof Error?d.message:String(d),"project")}FMe=n}}let lme=new WeakSet;Uze(Oen,"packages/editor/src/stories/prefabs-finder.ts");l2(()=>{const t=t$e();(t.map(s=>s.entryPath).join("|")!==FMe||!t.every(s=>lme.has(s.module)))&&of()&&BB()});HEr(()=>LZ&&!LZ.documentsPending?[...new Set(LZ.scenes.entries.map(t=>t.kind))]:null);function BB(){const t=Gen(++SFt,of());return iR=t,t.then(()=>{iR===t&&(iR=null)}),t}async function Gen(t,n){const s=()=>t===SFt&&of()===n;if(!n){cme(null);return}let c;try{c=await gen()}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 Jen(n,c);if(!s())return;Hen();const m=d.definition.regions==="manifest-roots"?qze(MB(c),d.definition.regionIncludes):[...d.definition.regions],g=(d.definition.documents.find??[]).length>0?await zen(c,m,d.definition):qen;if(!s())return;const S=Uen(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 Ken(t){if(!Nge)return!0;const n=Nge.documents.find??[];for(const s of n)for(const c of s.include??[])if(Xen(c).test(t))return!0;return!1}function Xen(t){const n="__DEEP__",s=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,n).replace(/\*/g,"[^/]*").split(n).join("(?:.*/)?");return new RegExp(`^${s}$`)}function Yen(){BB();const t=bFt(),n=Rw(()=>{Z0e!==Em()&&cme(null),BB()}),s=oen(c=>{(c===""||Ken(c))&&BB()});return()=>{t(),n(),s()}}const Zen="scene:";function ixt(t){return`${Zen}${t}`}function MY(t){const{kind:n}=t.reach;return n==="game-contract"||n==="root-mount"||n==="entrypoint-selection"?{liveReach:n}:{}}function Kze(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:ixt(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:ixt(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 Xze(t){const n=[];for(const s of t.entries){if(s.kind!=="scene")continue;const c=Kze(s);c.kind!=="no-document"&&n.push({entry:s,plan:c,isDefault:t.default===s.id})}return n}function Q2n(t,n,s){const c=Xze(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 eSn(t){const n=Xze(t);return n.some(s=>s.plan.kind==="isolation-document")&&!n.some(s=>s.plan.kind==="root-document")}const a0="workspace:game",tSn="workspace:scene",Qen="workspace:canvas-scene",etn="workspace:3d-components",ttn="workspace:2d-components",rtn="workspace:ui-components",ntn=new Set([Qen,ttn,etn,rtn]),itn=4e3;let BZ=null,ume=null,Oge=null,WQ=!1,fme=null,oxt=!1,Yze=!1;const Rge=new Set,otn=()=>null;function xFt(){if(!BZ)return null;const n=ume;return{id:a0,title:"Game",kind:"game",workspaceRole:"authored-subject",Content:n?.Content??otn,...n?.Toolbar?{Toolbar:n.Toolbar}:{},closeable:!1,presentation:()=>({kind:"workspace",id:a0})}}function stn(){const t={session:!0};return BZ=t,()=>{BZ===t&&(Zze(),BZ=null)}}function atn(t){if(ume=t,iq()){const n=xFt();n&&ND(n,{activate:!1})}return()=>{ume===t&&(ume=null)}}function HQ(){return Yze&&iq()}function iq(){return l0().some(t=>t.descriptor.id===a0)}function rSn(){return iq()?(N3t(),X0(a0)):!1}function ctn(){return Oge}function ltn(t){Oge=t,WQ=!0;for(const n of[...Rge])n();Rge.clear()}function utn(t){Oge===t&&(Oge=null,WQ=!1)}async function ftn(t=itn){const n=xFt();return n?(N3t(),Yze=!0,iq()?X0(n.id):(fme=e_(),ND(n)),WQ?!0:new Promise(s=>{const c=()=>{clearTimeout(d),s(!0)},d=setTimeout(()=>{Rge.delete(c),s(WQ)},t);Rge.add(c)})):!1}function Zze(){if(Yze=!1,!BZ||!iq()){fme=null;return}const t=fme;fme=null,WQ=!1,EN(a0,{discardDirty:!0}),t&&X0(t)}function dtn(t){oxt&&!t&&Zze(),oxt=t}let vC=[];const MMe=new Set,GQ=new Map;let Qze=!1,eVe=!1,jMe=!1;function wFt(t,n=!0){GQ.set(t,n),Fge()}const tVe=()=>{for(const t of MMe)t()},Q0e=()=>vC;function ptn(t){return MMe.add(t),()=>{MMe.delete(t)}}function SN(t,n=!0){const s=vC.find(c=>c.descriptor.id===t);return s?(ND({...s.descriptor,closeable:!0,persist:()=>({availableDocumentId:t})},{activate:n}),!0):!1}function Fge(){for(const[t,n]of GQ)SN(t,n&&!HQ())&&GQ.delete(t);if(Qze&&!eVe&&!jMe){const t=vC.find(n=>n.default);t&&(jMe=!0,SN(t.descriptor.id,!HQ()))}}function nSn(t,n){const s=vC.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 vC=s?vC.map(d=>d.descriptor.id===t.id?c:d):[...vC,c],tVe(),Fge(),t.id}function iSn(t){vC.some(n=>n.descriptor.id===t)&&(vC=vC.filter(n=>n.descriptor.id!==t),EN(t,{discardDirty:!0}),tVe())}for(const t of uTr)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),Fge(),!0)},beginRestore:({hasDocumentsToRestore:n})=>{Qze=!0,eVe=n,Fge()}});function _tn(){vC=[],GQ.clear(),Qze=!1,eVe=!1,jMe=!1,tVe()}const dme=new Map;function oSn(t,n){return dme.set(t,n),()=>{dme.get(t)===n&&dme.delete(t)}}function rVe(t){return dme.get(t)??Q0e().find(n=>n.rootId===t)?.descriptor.id??null}function LMe(t){const n=rVe(t);return n?SN(n)||X0(n):!1}const pme=new Map;function sSn(t,n){return pme.set(t,n),()=>{pme.get(t)===n&&pme.delete(t)}}function sxt(t){return pme.get(t)?.()??null}const BMe=new Set;function aSn(t){return BMe.add(t),()=>{BMe.delete(t)}}function axt(t){for(const n of BMe){const s=n(t);if(s!==null)return s}return null}const $Me="document:";function nVe(t){return`${$Me}${t}`}function mtn(t){return t.startsWith($Me)?t.slice($Me.length):null}const KQ=new Map;function htn(t){return KQ.get(t)?.entry}function gtn(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 TFt(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 qMe(t){return PN(t)!==void 0}function ID(t,n={}){const s=PN(t.kind);if(!s)return!1;const c=nVe(t.id);return KQ.set(c,{entry:t,props:gtn(t)}),ND({id:c,title:t.label,kind:"document",workspaceRole:"authored-subject",provenance:{...t.source?{sourcePath:t.source.path}:{},origin:s.file},Content:Etn,...s.Toolbar?{Toolbar:Ttn}:{},...s.Shelf?{Shelf:Ctn}:{},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=nOe(n.id);return!s||!qMe(s.kind)?null:ID(s)?nVe(s.id):null},settle:async t=>{await EC(()=>nOe(t.id)!==void 0,2e4);const s=nOe(t.id);if(!s)throw new Error(`The project's document table lists no document: ${t.id}`);if(!await EC(()=>qMe(s.kind),2e4))throw new Error(`No editor is registered for documents of kind '${s.kind}' (${t.id})`)},ready:async t=>{await m4t(t),await SBe(t)}});function nOe(t){return u0()?.scenes.entries.find(n=>n.id===t)}function CFt(t,n={}){if(ID(t,n))return;const s=l2(()=>{ID(t,n)&&s()})}function ytn(t){const n=mtn(t);if(n===null)return!1;const s=()=>{const c=u0()?.scenes.entries.find(d=>d.id===n);return c?(CFt(c,{activate:!1}),!0):!1};if(!s()){const c=OC(()=>{s()&&c()})}return!0}function vtn(){return l2(()=>{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 btn(t,n){const s=of(),c=()=>{if(of()!==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 Stn(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 cxt=null,Mge=null;function xtn(t){cxt?.();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,Mge=d;return}const m=[...c.scenes.entries].reverse().find(g=>!n?.has(g.id)&&g.kind!=="scene"&&g.kind!=="prefab"&&g.source&&qMe(g.kind));n=d,Mge=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(),cxt=OC(s)}function wtn(t){const n=of(),s=()=>{if(of()!==n)return!0;const d=u0();return!d||d.documentsPending||d.error!==null?!1:(d.scenes.entries.some(m=>t.includes(m.id))||EFt(),!0)};if(s())return;const c=OC(()=>{s()&&c()})}function EFt(){const t=of(),n=()=>{if(of()!==t)return!0;const c=u0();if(!c||c.documentsPending)return!1;if(l0().some(m=>!m.descriptor.area))return!0;const d=Stn(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,TFt(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?(btn(c,d=>{CFt(d,{activate:n})}),!0):!1},persistKindState:()=>Mge?{seen:[...Mge]}: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)EFt();else{const m=s.map(g=>g.kind==="document"?g.state?.entryId:void 0);m.every(g=>typeof g=="string")&&wtn(m)}xtn(d)}});function iVe(t){Ye.useSyncExternalStore(l2,rA);const n=KQ.get(t)?.props;return{entry:n,contribution:n?PN(n.kind):void 0}}function Ttn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?.Toolbar?null:$.jsx(IR,{contribution:c,Component:c.Toolbar,documentId:t,active:n,document:s},`${c.id}:${c.version}:toolbar:${t}`)}function Ctn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?.Shelf?null:$.jsx(IR,{contribution:c,Component:c.Shelf,documentId:t,active:n,document:s},`${c.id}:${c.version}:shelf:${t}`)}function Etn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?$.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."}):$.jsx(IR,{contribution:c,documentId:t,active:n,document:s},`${c.id}:${c.version}:${t}`)}function ktn(t){if(t)for(const n of Xze(t)){if(n.plan.kind!=="root-document")continue;const s=rVe(n.plan.regionId);s&&R3t(s,n.plan.title)}}function Atn(){const t=()=>ktn(u0()?.scenes??null);return t(),OC(t)}const Dtn=15e3;async function Ptn(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,Dtn),g=OC(()=>{n()&&d()});n()&&d()}),kFt(t)}function kFt(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:nVe(s.id),title:s.label};const c=Kze(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=rVe(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 cSn(t){return dZ=[...dZ,t],()=>{dZ=dZ.filter(n=>n!==t)}}async function Itn(t){for(const n of dZ){const s=await n(t);if(s)return s}return null}let $Z=null;function lSn(t){return $Z=t,()=>{$Z===t&&($Z=null)}}async function uSn(t){return $Z?$Z.observe(t):{result:await t(),settled:async()=>{},frame:async()=>null}}let pZ=[];function fSn(t){return pZ=[...pZ,t],()=>{pZ=pZ.filter(n=>n!==t)}}async function Ntn(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",Otn=`[${XQ}]`;function Rtn(t){t.setAttribute(XQ,"")}const dSn=Object.freeze(Object.defineProperty({__proto__:null,GAME_CSS_SCOPE_ATTRIBUTE:XQ,GAME_CSS_SCOPE_SELECTOR:Otn,markGameCssScope:Rtn},Symbol.toStringTag,{value:"Module"})),AFt={installed:!1,sources:[],note:null},lxt="data-volter-scoped-game-css";let iOe=null,DFt=AFt,PFt=null;function IFt(){return PFt}function Ftn(){return typeof globalThis.CSSScopeRule=="function"}async function Mtn(t){if(iOe?.projectRoot===t)return iOe.state;const n=Ltn(t);return iOe={projectRoot:t,state:n},n}function jtn(){return DFt}async function Ltn(t){const n=await Btn(t);return DFt=n,n}async function Btn(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 AFt}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(!Ftn()){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 ea.warn(`[scoped-game-css] ${m}`,"authoring"),{installed:!1,sources:c,note:m}}return $tn(t,s),{installed:!0,sources:c,note:d}}function $tn(t,n){const s=document.head.querySelector(`style[${lxt}]`),c=s instanceof HTMLStyleElement?s:document.createElement("style");c.setAttribute(lxt,t),c.textContent=n,c.isConnected||document.head.appendChild(c),PFt=n}const pSn=Object.freeze(Object.defineProperty({__proto__:null,ensureScopedGameStyles:Mtn,scopedGameStylesCssText:IFt,scopedGameStylesState:jtn},Symbol.toStringTag,{value:"Module"})),qtn='[data-volter-root-surface="true"]';function eve(t){return t.matches(qtn)||t.closest('[data-volter-canvas-scene="true"]')!==null}function ztn(){return{imgs:new WeakMap}}const NFt=500,OFt=100,RFt=8;function Vtn(t=NFt,n=OFt){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,RFt*D)}},dispose(){c?.disconnect(),c=null,s=null,m=null}}}function oOe(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 FFt(t){const n=new Set,s=c=>{if(n.has(c))return"";n.add(c);try{return Array.from(c.cssRules).map(d=>{const m=d.styleSheet;return m?s(m):d.type===CSSRule.FONT_FACE_RULE?d.cssText.replace(/url\((['"]?)(.*?)\1\)/g,(g,S,k)=>`url("${new URL(k,c.href??t.baseURI).href}")`):d.cssText}).join(`
|
|
1394
|
+
${xen(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:gFt(d.authoring.hierarchy)}:void 0,hasThreeRoot:aFt(d,"three"),rootCount:d.roots.length,configurations:d.configurations};return cLe({rootPath:t,config:m})}const Ten=3,Cen=300;async function yFt(){const t=await Mze();for(let n=1;;n++){const s=await jze(),c=g4r({status:s.status,attempt:n,maxAttempts:Ten});if(c==="continue-ladder")return null;if(c==="open"&&s.status==="project"){const d=s.project;return g$e(d.config,t),cLe({rootPath:d.path,config:d.config})}if(c==="retry"){await new Promise(d=>setTimeout(d,Cen));continue}throw new y$e(y4r(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 Een(){x4r(window.location.search);const t=await yFt();return t||ken()}async function ken(){const[t,n]=await Promise.all([DZr(),AZr()]),s=h4r({explicitTarget:null,hubRequested:S4r(window.location.search),reopenLastEnabled:t.reopenLastProject,recents:n});if(s.kind!=="reopen-last")return null;try{return await wen(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 OMe=new Map;function K2n(t){for(const[n,s]of OMe)if(vFt(n,t))return s;return null}function X2n(t){for(const n of[...OMe.keys()])vFt(n,t)&&OMe.delete(n)}function ZSt(t){return t.replaceAll("\\","/")}function vFt(t,n){const s=ZSt(t),c=ZSt(n).replace(/^\.?\//,"");return s===c||s.endsWith(`/${c}`)}function bFt(t){return()=>{}}function Aen(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 QSt(t){const n=t.replaceAll("\\","/").replace(/^\.\//,""),s=n.lastIndexOf("/");return s>=0?n.slice(0,s):""}function Den(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 Pen(t,n){const s=n?t.filter(d=>QSt(d.modulePath)===QSt(n.path)):[],c=s.length>0?s:t;return{chosen:c.find(d=>d.isDefault===!0)??c[0],colocated:s.length>0}}function Ien(t,n){const s=[],c=[];for(const[d,m]of Den(n.stories)){const g=n.components?.find(A=>A.name===d),{chosen:S,colocated:k}=Pen(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 Nen(){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:vRt(s)});return t}const Oen={name:"prefabsFromStories",schema:Pa({finder:Dg("prefabsFromStories")}).strict(),run(t,n){return Ien(t,{stories:Nen(),...n.components===void 0?{}:{components:n.components}})}},LB="volter.adapter.ts";let LZ=null,Nge=null,Z0e="__unscoped__",iR=null,SFt=0;const UQ=new Set;function u0(){return Z0e===Em()?LZ:null}async function Y2n(){return iR&&await iR,Z0e===Em()?Nge:null}function Gze(){const t=()=>!of()||!!u0();return t()?Promise.resolve():new Promise(n=>{const s=OC(()=>{t()&&(s(),n())})})}async function Ren(){for(await(await fo(async()=>{const{projectBootstrapSettled:n}=await Promise.resolve().then(()=>Z9t);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){Z0e=Em(),LZ=t,Nge=c,wEr(c?.editor),ven(t?.regions??[]),een(n),ten(s??null);for(const d of UQ)d();JEr()}function Fen(t){return{id:t.id,kind:t.kind,answered:t.answer!==void 0}}function Men(t){const{Layout:n,...s}=t;return{...s,...n?{layout:n.displayName??n.name??"Project layout"}:{}}}async function jen(t){return await import(`${Jze(t,LB)}?t=${Date.now()}`)}function Len(t,n){return t.find(s=>s.surface===n)?.id??null}function Ben(t){const n=new Set(t.map(s=>s.path));return(s,c)=>Aen(s,c,n)}function $en(t){const n=cFt(t);return n.length===1?n[0].id:null}const qen={entrypoints:[],components:[]};async function zen(t,n,s){const c=[];for(const A of MB(t))A.entry&&c.push({regionId:A.id,path:A.entry,source:await SMe(A.entry)});let d=[];const m=await MRt().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:Len(n,A.surface)})):ea.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 LRt([...g],{order:"mtime"}).catch(()=>[]);for(const F of A){k.push(F);const D=await SMe(F);D!==null&&!D.includes("\0")&&S.push({path:F,source:D})}}return{entrypoints:c,components:d,sources:S,files:k,resolveModule:Ben(d)}}function Ven(t,n){const s=[...t.documents.entries??[]],c=[],d=[];let m=0;for(const S of t.documents.find??[]){let k;try{k=KQr(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 Z2n(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 ext(t){for(const n of MI){const s=n.modulePathFor(t);if(s!==null)return{source:n,modulePath:s}}return null}function txt(t){return t!==null&&typeof t=="object"&&"default"in t?t.default:t}function KL(t,n){if(t.kind==="present")try{return{definition:CMe(txt(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:CMe(txt(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 Uen(t,n,s){const{definition:c,source:d,modulePath:m,error:g}=n,S=c.regions==="manifest-roots"?qze(MB(t),c.regionIncludes):[...c.regions],k=KRt(MB(t),c.regionIncludes),{table:A,notes:F,unresolved:D}=Ven(c,s);return{source:d,modulePath:m,regions:S,scenes:A,documentsPending:D>0,...c.editor?{editor:Men(c.editor)}:{},observation:c.observation.map(Fen),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 Jen(t,n){const s=$en(n),c=await jRt(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=ext(s);if(m===null&&(await Wen(s),m=ext(s)),m===null){const g=KL(d,{kind:"unanswered",rootId:s,sources:MI.length});return g.error&&ea.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 rxt=null,s_e=null,RMe=null;function nxt(){return RMe}function Wen(t){const n=Em();if(rxt!==n&&(rxt=n,s_e=null),!s_e){RMe=`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(()=>{RMe=null;for(const s of UQ)s()})}return s_e}let rOe=[],FMe="";function Hen(){const t=t$e(),n=t.map(s=>s.entryPath).join("|");if(!(n===FMe&&t.every(s=>lme.has(s.module)))){for(const s of rOe)s();rOe=[],lme=new WeakSet;for(const{entryPath:s,module:c}of t)try{rOe.push(Uze(c?.finder,s)),lme.add(c)}catch(d){ea.error(d instanceof Error?d.message:String(d),"project")}FMe=n}}let lme=new WeakSet;Uze(Oen,"packages/editor-sdk/src/kit/stories/prefabs-finder.ts");l2(()=>{const t=t$e();(t.map(s=>s.entryPath).join("|")!==FMe||!t.every(s=>lme.has(s.module)))&&of()&&BB()});HEr(()=>LZ&&!LZ.documentsPending?[...new Set(LZ.scenes.entries.map(t=>t.kind))]:null);function BB(){const t=Gen(++SFt,of());return iR=t,t.then(()=>{iR===t&&(iR=null)}),t}async function Gen(t,n){const s=()=>t===SFt&&of()===n;if(!n){cme(null);return}let c;try{c=await gen()}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 Jen(n,c);if(!s())return;Hen();const m=d.definition.regions==="manifest-roots"?qze(MB(c),d.definition.regionIncludes):[...d.definition.regions],g=(d.definition.documents.find??[]).length>0?await zen(c,m,d.definition):qen;if(!s())return;const S=Uen(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 Ken(t){if(!Nge)return!0;const n=Nge.documents.find??[];for(const s of n)for(const c of s.include??[])if(Xen(c).test(t))return!0;return!1}function Xen(t){const n="__DEEP__",s=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,n).replace(/\*/g,"[^/]*").split(n).join("(?:.*/)?");return new RegExp(`^${s}$`)}function Yen(){BB();const t=bFt(),n=Rw(()=>{Z0e!==Em()&&cme(null),BB()}),s=oen(c=>{(c===""||Ken(c))&&BB()});return()=>{t(),n(),s()}}const Zen="scene:";function ixt(t){return`${Zen}${t}`}function MY(t){const{kind:n}=t.reach;return n==="game-contract"||n==="root-mount"||n==="entrypoint-selection"?{liveReach:n}:{}}function Kze(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:ixt(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:ixt(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 Xze(t){const n=[];for(const s of t.entries){if(s.kind!=="scene")continue;const c=Kze(s);c.kind!=="no-document"&&n.push({entry:s,plan:c,isDefault:t.default===s.id})}return n}function Q2n(t,n,s){const c=Xze(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 eSn(t){const n=Xze(t);return n.some(s=>s.plan.kind==="isolation-document")&&!n.some(s=>s.plan.kind==="root-document")}const a0="workspace:game",tSn="workspace:scene",Qen="workspace:canvas-scene",etn="workspace:3d-components",ttn="workspace:2d-components",rtn="workspace:ui-components",ntn=new Set([Qen,ttn,etn,rtn]),itn=4e3;let BZ=null,ume=null,Oge=null,WQ=!1,fme=null,oxt=!1,Yze=!1;const Rge=new Set,otn=()=>null;function xFt(){if(!BZ)return null;const n=ume;return{id:a0,title:"Game",kind:"game",workspaceRole:"authored-subject",Content:n?.Content??otn,...n?.Toolbar?{Toolbar:n.Toolbar}:{},closeable:!1,presentation:()=>({kind:"workspace",id:a0})}}function stn(){const t={session:!0};return BZ=t,()=>{BZ===t&&(Zze(),BZ=null)}}function atn(t){if(ume=t,iq()){const n=xFt();n&&ND(n,{activate:!1})}return()=>{ume===t&&(ume=null)}}function HQ(){return Yze&&iq()}function iq(){return l0().some(t=>t.descriptor.id===a0)}function rSn(){return iq()?(N3t(),X0(a0)):!1}function ctn(){return Oge}function ltn(t){Oge=t,WQ=!0;for(const n of[...Rge])n();Rge.clear()}function utn(t){Oge===t&&(Oge=null,WQ=!1)}async function ftn(t=itn){const n=xFt();return n?(N3t(),Yze=!0,iq()?X0(n.id):(fme=e_(),ND(n)),WQ?!0:new Promise(s=>{const c=()=>{clearTimeout(d),s(!0)},d=setTimeout(()=>{Rge.delete(c),s(WQ)},t);Rge.add(c)})):!1}function Zze(){if(Yze=!1,!BZ||!iq()){fme=null;return}const t=fme;fme=null,WQ=!1,EN(a0,{discardDirty:!0}),t&&X0(t)}function dtn(t){oxt&&!t&&Zze(),oxt=t}let vC=[];const MMe=new Set,GQ=new Map;let Qze=!1,eVe=!1,jMe=!1;function wFt(t,n=!0){GQ.set(t,n),Fge()}const tVe=()=>{for(const t of MMe)t()},Q0e=()=>vC;function ptn(t){return MMe.add(t),()=>{MMe.delete(t)}}function SN(t,n=!0){const s=vC.find(c=>c.descriptor.id===t);return s?(ND({...s.descriptor,closeable:!0,persist:()=>({availableDocumentId:t})},{activate:n}),!0):!1}function Fge(){for(const[t,n]of GQ)SN(t,n&&!HQ())&&GQ.delete(t);if(Qze&&!eVe&&!jMe){const t=vC.find(n=>n.default);t&&(jMe=!0,SN(t.descriptor.id,!HQ()))}}function nSn(t,n){const s=vC.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 vC=s?vC.map(d=>d.descriptor.id===t.id?c:d):[...vC,c],tVe(),Fge(),t.id}function iSn(t){vC.some(n=>n.descriptor.id===t)&&(vC=vC.filter(n=>n.descriptor.id!==t),EN(t,{discardDirty:!0}),tVe())}for(const t of uTr)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),Fge(),!0)},beginRestore:({hasDocumentsToRestore:n})=>{Qze=!0,eVe=n,Fge()}});function _tn(){vC=[],GQ.clear(),Qze=!1,eVe=!1,jMe=!1,tVe()}const dme=new Map;function oSn(t,n){return dme.set(t,n),()=>{dme.get(t)===n&&dme.delete(t)}}function rVe(t){return dme.get(t)??Q0e().find(n=>n.rootId===t)?.descriptor.id??null}function LMe(t){const n=rVe(t);return n?SN(n)||X0(n):!1}const pme=new Map;function sSn(t,n){return pme.set(t,n),()=>{pme.get(t)===n&&pme.delete(t)}}function sxt(t){return pme.get(t)?.()??null}const BMe=new Set;function aSn(t){return BMe.add(t),()=>{BMe.delete(t)}}function axt(t){for(const n of BMe){const s=n(t);if(s!==null)return s}return null}const $Me="document:";function nVe(t){return`${$Me}${t}`}function mtn(t){return t.startsWith($Me)?t.slice($Me.length):null}const KQ=new Map;function htn(t){return KQ.get(t)?.entry}function gtn(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 TFt(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 qMe(t){return PN(t)!==void 0}function ID(t,n={}){const s=PN(t.kind);if(!s)return!1;const c=nVe(t.id);return KQ.set(c,{entry:t,props:gtn(t)}),ND({id:c,title:t.label,kind:"document",workspaceRole:"authored-subject",provenance:{...t.source?{sourcePath:t.source.path}:{},origin:s.file},Content:Etn,...s.Toolbar?{Toolbar:Ttn}:{},...s.Shelf?{Shelf:Ctn}:{},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=nOe(n.id);return!s||!qMe(s.kind)?null:ID(s)?nVe(s.id):null},settle:async t=>{await EC(()=>nOe(t.id)!==void 0,2e4);const s=nOe(t.id);if(!s)throw new Error(`The project's document table lists no document: ${t.id}`);if(!await EC(()=>qMe(s.kind),2e4))throw new Error(`No editor is registered for documents of kind '${s.kind}' (${t.id})`)},ready:async t=>{await m4t(t),await SBe(t)}});function nOe(t){return u0()?.scenes.entries.find(n=>n.id===t)}function CFt(t,n={}){if(ID(t,n))return;const s=l2(()=>{ID(t,n)&&s()})}function ytn(t){const n=mtn(t);if(n===null)return!1;const s=()=>{const c=u0()?.scenes.entries.find(d=>d.id===n);return c?(CFt(c,{activate:!1}),!0):!1};if(!s()){const c=OC(()=>{s()&&c()})}return!0}function vtn(){return l2(()=>{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 btn(t,n){const s=of(),c=()=>{if(of()!==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 Stn(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 cxt=null,Mge=null;function xtn(t){cxt?.();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,Mge=d;return}const m=[...c.scenes.entries].reverse().find(g=>!n?.has(g.id)&&g.kind!=="scene"&&g.kind!=="prefab"&&g.source&&qMe(g.kind));n=d,Mge=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(),cxt=OC(s)}function wtn(t){const n=of(),s=()=>{if(of()!==n)return!0;const d=u0();return!d||d.documentsPending||d.error!==null?!1:(d.scenes.entries.some(m=>t.includes(m.id))||EFt(),!0)};if(s())return;const c=OC(()=>{s()&&c()})}function EFt(){const t=of(),n=()=>{if(of()!==t)return!0;const c=u0();if(!c||c.documentsPending)return!1;if(l0().some(m=>!m.descriptor.area))return!0;const d=Stn(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,TFt(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?(btn(c,d=>{CFt(d,{activate:n})}),!0):!1},persistKindState:()=>Mge?{seen:[...Mge]}: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)EFt();else{const m=s.map(g=>g.kind==="document"?g.state?.entryId:void 0);m.every(g=>typeof g=="string")&&wtn(m)}xtn(d)}});function iVe(t){Ye.useSyncExternalStore(l2,rA);const n=KQ.get(t)?.props;return{entry:n,contribution:n?PN(n.kind):void 0}}function Ttn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?.Toolbar?null:$.jsx(IR,{contribution:c,Component:c.Toolbar,documentId:t,active:n,document:s},`${c.id}:${c.version}:toolbar:${t}`)}function Ctn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?.Shelf?null:$.jsx(IR,{contribution:c,Component:c.Shelf,documentId:t,active:n,document:s},`${c.id}:${c.version}:shelf:${t}`)}function Etn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?$.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."}):$.jsx(IR,{contribution:c,documentId:t,active:n,document:s},`${c.id}:${c.version}:${t}`)}function ktn(t){if(t)for(const n of Xze(t)){if(n.plan.kind!=="root-document")continue;const s=rVe(n.plan.regionId);s&&R3t(s,n.plan.title)}}function Atn(){const t=()=>ktn(u0()?.scenes??null);return t(),OC(t)}const Dtn=15e3;async function Ptn(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,Dtn),g=OC(()=>{n()&&d()});n()&&d()}),kFt(t)}function kFt(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:nVe(s.id),title:s.label};const c=Kze(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=rVe(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 cSn(t){return dZ=[...dZ,t],()=>{dZ=dZ.filter(n=>n!==t)}}async function Itn(t){for(const n of dZ){const s=await n(t);if(s)return s}return null}let $Z=null;function lSn(t){return $Z=t,()=>{$Z===t&&($Z=null)}}async function uSn(t){return $Z?$Z.observe(t):{result:await t(),settled:async()=>{},frame:async()=>null}}let pZ=[];function fSn(t){return pZ=[...pZ,t],()=>{pZ=pZ.filter(n=>n!==t)}}async function Ntn(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",Otn=`[${XQ}]`;function Rtn(t){t.setAttribute(XQ,"")}const dSn=Object.freeze(Object.defineProperty({__proto__:null,GAME_CSS_SCOPE_ATTRIBUTE:XQ,GAME_CSS_SCOPE_SELECTOR:Otn,markGameCssScope:Rtn},Symbol.toStringTag,{value:"Module"})),AFt={installed:!1,sources:[],note:null},lxt="data-volter-scoped-game-css";let iOe=null,DFt=AFt,PFt=null;function IFt(){return PFt}function Ftn(){return typeof globalThis.CSSScopeRule=="function"}async function Mtn(t){if(iOe?.projectRoot===t)return iOe.state;const n=Ltn(t);return iOe={projectRoot:t,state:n},n}function jtn(){return DFt}async function Ltn(t){const n=await Btn(t);return DFt=n,n}async function Btn(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 AFt}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(!Ftn()){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 ea.warn(`[scoped-game-css] ${m}`,"authoring"),{installed:!1,sources:c,note:m}}return $tn(t,s),{installed:!0,sources:c,note:d}}function $tn(t,n){const s=document.head.querySelector(`style[${lxt}]`),c=s instanceof HTMLStyleElement?s:document.createElement("style");c.setAttribute(lxt,t),c.textContent=n,c.isConnected||document.head.appendChild(c),PFt=n}const pSn=Object.freeze(Object.defineProperty({__proto__:null,ensureScopedGameStyles:Mtn,scopedGameStylesCssText:IFt,scopedGameStylesState:jtn},Symbol.toStringTag,{value:"Module"})),qtn='[data-volter-root-surface="true"]';function eve(t){return t.matches(qtn)||t.closest('[data-volter-canvas-scene="true"]')!==null}function ztn(){return{imgs:new WeakMap}}const NFt=500,OFt=100,RFt=8;function Vtn(t=NFt,n=OFt){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,RFt*D)}},dispose(){c?.disconnect(),c=null,s=null,m=null}}}function oOe(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 FFt(t){const n=new Set,s=c=>{if(n.has(c))return"";n.add(c);try{return Array.from(c.cssRules).map(d=>{const m=d.styleSheet;return m?s(m):d.type===CSSRule.FONT_FACE_RULE?d.cssText.replace(/url\((['"]?)(.*?)\1\)/g,(g,S,k)=>`url("${new URL(k,c.href??t.baseURI).href}")`):d.cssText}).join(`
|
|
1395
1395
|
`)}catch{return""}};return Array.from(t.styleSheets,s).filter(Boolean).join(`
|
|
1396
1396
|
`)}async function Utn(t){await t.fonts.ready;let n=FFt(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 Jtn(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 oVe(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 MFt(t){const n=[],s=new Set;for(const c of Array.from(t.querySelectorAll("canvas"))){if(!eve(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,...Wtn(t,c)])s.has(m)||(s.add(m),n.push(m))}return n}function Wtn(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))Htn(F,t)&&d.add(F)}return Array.from(d).reverse()}function Htn(t,n){return t instanceof HTMLElement&&(t===n||n.contains(t))&&oVe(t)!==null}function jFt(t){const n=[];for(let s=t.parentElement;s;s=s.parentElement)n.unshift(s);return n}function Gtn(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 Ktn(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 Xtn(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 LFt(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?Jtn(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??FFt(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=IFt();if(A){const se=t.ownerDocument.createElement("style");se.textContent=A,g.appendChild(se)}for(const se of d){const pe=se.cloneNode(!0);Xtn(se,pe,S),Gtn(se,pe),Ktn(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 Be=ue[we];if(!Be?.complete||Be.naturalWidth<=0||Be.naturalHeight<=0)return;const bt=Be.currentSrc||Be.src,It=c?.snapshots?.imgs.get(Be),Wt=It&&It.src===bt?It.url:oOe(t.ownerDocument,Be);(!It||It.src!==bt)&&c?.snapshots?.imgs.set(Be,{src:bt,url:Wt}),Wt&&X.setAttribute("src",Wt)});const Fe=[...se instanceof HTMLVideoElement?[se]:[],...Array.from(se.querySelectorAll("video"))];[...pe instanceof HTMLVideoElement?[pe]:[],...Array.from(pe.querySelectorAll("video"))].forEach((X,we)=>{const Be=Fe[we];if(!Be||Be.readyState<2||Be.videoWidth<=0)return;const bt=oOe(t.ownerDocument,Be);if(!bt)return;const It=t.ownerDocument.createElement("img");It.setAttribute("src",bt),It.setAttribute("style",X.getAttribute("style")??""),X.replaceWith(It)});const be=Array.from(se.querySelectorAll("canvas"));Array.from(pe.querySelectorAll("canvas")).forEach((X,we)=>{const Be=be[we];if(Be&&eve(Be)){X.remove();return}const bt=Be?c?.canvasPixels?.get(Be):void 0,It=bt?oOe(t.ownerDocument,bt):null;if(!It){X.remove();return}const Wt=t.ownerDocument.createElement("img");Wt.setAttribute("src",It),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,q=D===n&&J===s?"":` viewBox="0 0 ${n} ${s}"`;return{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="${D}" height="${J}"${q}><foreignObject width="100%" height="100%">${F}</foreignObject></svg>`,overlayCount:d.length}}const Ytn={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(`${Ytn[n]} capture failed — ${c}`),this.name="CaptureLayerError",this.layer=n}}function jge(t,n){return n instanceof HI?n:new HI(t,n)}const X4=32,Ztn=24,sVe=.9;function BFt(t,n){return[t[n*4]??0,t[n*4+1]??0,t[n*4+2]??0]}function Qtn(t,n){const s=new Map;for(let m=0;m<n;m++){const[g,S,k]=BFt(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 ern(t,n,s){let c=0;for(let d=0;d<n;d++){const m=BFt(t,d);Math.max(Math.abs(m[0]-s[0]),Math.abs(m[1]-s[1]),Math.abs(m[2]-s[2]))<=Ztn&&(c+=1)}return c}function $Ft(t,n,s=sVe){const{mean:c,distinctRegions:d}=Qtn(t,n),m=Math.round(ern(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 zMe(t,n,s=sVe){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 $Ft(m.data,X4*X4,s)}catch{return null}}async function qFt(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 zFt(t,n){return await YQ(t),(n?.presentsOnCanvas??t.querySelectorAll("canvas").length>0)||await new Promise(c=>setTimeout(c,650)),await qFt(t),await YQ(t),VMe(t,2,n??{})}const VFt=.03;function UFt(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 JFt(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 trn(t,n,s,c){let d;try{d=t.getImageData(0,0,n,s)}catch{return{kind:"ok"}}const m=n*s,g=UFt(d.data,m),S=g>VFt;return c>0&&(S||JFt(d.data,m))?{kind:"retry"}:S?{kind:"blank",transparentFraction:g}:{kind:"ok"}}function rrn(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 VMe(t,n,s){const c=t.ownerDocument.createElement("canvas"),d=await WFt(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=rrn(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),VMe(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,q=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-q),ue.height=Math.max(1,pe-G);const Ce=ue.getContext("2d");if(!Ce)throw new HI("composite-output","no 2d canvas context");const Fe=getComputedStyle(t).backgroundColor;Fe&&Fe!=="transparent"&&Fe!=="rgba(0, 0, 0, 0)"&&(Ce.fillStyle=Fe,Ce.fillRect(0,0,ue.width,ue.height)),Ce.drawImage(c,q,G,ue.width,ue.height,0,0,ue.width,ue.height);const De=zMe(ue,t.ownerDocument);let be;try{be=ue.toDataURL("image/png")}catch(we){throw jge("composite-output",we)}const X=be.indexOf(",");return{base64:X>=0?be.slice(X+1):be,mimeType:"image/png",layers:d,...De?{flatness:De}:{}}}if(d.canvases===0&&d.domOverlays>0&&!s.allowTransparent){const D=trn(S,m,g,n);if(D.kind==="retry")return await new Promise(J=>setTimeout(J,300)),await YQ(t),VMe(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=zMe(c,t.ownerDocument);let A;try{A=c.toDataURL("image/png")}catch(D){throw jge("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 uxt(t,n,s,c=1,d=1){for(const m of n){const g=oVe(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 WFt(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&&uxt(k,jFt(t),c,g,S);const F=Array.from(t.querySelectorAll("canvas")).some(se=>!eve(se))?null:s?.overlayCache?.take(t,d,m),D=F?.backdrops??MFt(t);uxt(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}),q=new Map;for(const se of J)try{const pe=se.getBoundingClientRect(),ue=await s?.canvasFrame?.(se)??se;q.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 jge("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=LFt(t,d/g,m/S,{includeDocumentStyles:s?.includeDocumentStyles,documentCssText:s?.includeDocumentStyles?await Utn(t.ownerDocument):void 0,canvasPixels:q,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 jge("dom-overlay",se)}return{canvases:J.length,domOverlays:G}}const nrn=Object.freeze(Object.defineProperty({__proto__:null,CaptureLayerError:HI,FLATNESS_GRID:X4,FLATNESS_WARN_AT:sVe,OVERLAY_CACHE_MAX_AGE_MS:NFt,OVERLAY_REBUILD_COST_MULTIPLIER:RFt,OVERLAY_REBUILD_FLOOR_MS:OFt,TRANSPARENT_PIXEL_LIMIT:VFt,ancestorBackdrops:jFt,buildOverlaySvg:LFt,capturePlayComposite:zFt,createImageSnapshotCache:ztn,createOverlayFrameCache:Vtn,drawPlayCompositeFrame:WFt,hasExcessNearBlackPixels:JFt,isRootCanvas:eve,measureFlatness:$Ft,opaqueBackgroundColor:oVe,rootSurfaceBackdrops:MFt,sampleFlatness:zMe,transparentPixelFraction:UFt,waitForFiniteMotion:qFt,waitForPaint:YQ},Symbol.toStringTag,{value:"Module"}));function ote(t){const n=CC(),s=n?.descriptor.presentation?.()??void 0,c=o2(n?.descriptor.id),d=Oye(),m=c?.selection?c.selection.read():d?.adapter?.selection?.get()??(c?[...t.selectedEntityIds]:[]),g=c?.read()??void 0,S=eDt();return{version:1,workspace:zS(),...Ahe()===null?{}:{style:Ahe()},keymap:dR(),...s?{document:s}:{},...m.length>0?{selection:{ids:[...m]}}:{},...g?{viewport:g}:{},...S?{panel:S}:{}}}function irn(t){return tCt(ote(t),window.location.href)}let $I=[],orn=0,HFt=0;const UMe=new Set;function JMe(){HFt++;for(const t of UMe)t()}function GFt(){JMe()}function WMe(){return Y1()}function aVe(){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 KFt(){for(const{session:t}of $I){const n=t.restartRequired?.()??null;if(n!==null)return n}return null}function XFt(){(Y1().find(s=>(s.restartRequired?.()??null)!==null)??Y1().find(s=>s.mounted()&&s.restart))?.restart?.()}function cVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.frameCanvas?.()??null;if(n)return n}return null}function lVe(t){for(const n of Y1())if(!(!n.mounted()||!n.snapshotFrame)&&n.frameCanvas?.()===t)return n.snapshotFrame();return null}function uVe(t){for(const n of Y1()){if(!n.mounted()||!n.command)continue;const s=n.command(t);if(s)return s}return null}function fVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.scenes?.()??null;if(n&&typeof n.goToScene=="function")return n}return null}function tve(){for(const t of Y1()){if(!t.mounted())continue;const n=t.surface?.()??null;if(n)return n}return null}function dVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.coverage?.()??null;if(n)return n}return null}function pVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.authoringRefusal?.()??null;if(n!==null)return n}return null}function YFt(t){return Y1().find(s=>s.mounted()&&s.remount)?.remount?.(t)??null}function ZFt(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:orn++};return $I=[...$I,n],JMe(),()=>{$I=$I.filter(s=>s!==n),JMe()}}function Y1(){return[...$I].sort((t,n)=>(t.session.priority??0)-(n.session.priority??0)||t.seq-n.seq).map(t=>t.session)}function _Ve(){return Y1().some(t=>t.mounted())}function rve(){return Y1().some(t=>t.playing())}function mVe(){for(const t of Y1())t.stop()}function QFt(t){for(const n of Y1()){const s=n.instanceContainer(t);if(s)return s}return null}function hVe(t){return UMe.add(t),()=>UMe.delete(t)}function e9t(){return HFt}const srn=Object.freeze(Object.defineProperty({__proto__:null,anyLiveSessionMounted:_Ve,anyLiveSessionPlaying:rve,dispatchLiveCommand:uVe,liveAuthoringRefusal:pVe,liveCoverage:dVe,liveFrameCanvas:cVe,liveInstanceContainer:QFt,liveRestartRequired:KFt,liveRunWindow:aVe,liveScenes:fVe,liveSessions:WMe,liveSessionsVersion:e9t,liveSurface:tve,notifyLiveSessionsChanged:GFt,registerLiveSession:ZFt,remountLiveSelection:YFt,restartLiveSession:XFt,snapshotLiveFrame:lVe,stopAllLiveSessions:mVe,subscribeLiveSessions:hVe},Symbol.toStringTag,{value:"Module"}));async function t9t(t){const n=lVe(t);return n||Itn(t)}function arn(t){const n=t;return n&&typeof n.toDataURL=="function"?n:null}const crn=Object.freeze(Object.defineProperty({__proto__:null,liveCanvasFrame:t9t,readablePngSource:arn},Symbol.toStringTag,{value:"Module"}));let qZ=null;function lrn(){if(!qZ)return!0;try{return qZ()}catch{return!0}}function urn(t){return qZ=t,()=>{qZ===t&&(qZ=null)}}const r9t=new WeakMap;function _Sn(t,n){r9t.set(t,n)}function n9t(t){for(const n of Array.from(t.querySelectorAll("iframe"))){const s=r9t.get(n),c=s?.container();if(s&&c)return{container:c,canvasFrame:s.canvasFrame}}return null}function gVe(t){return Array.from(document.querySelectorAll("[data-workspace-document-id]")).find(n=>n.dataset.workspaceDocumentId===t&&(bRe()===null||n.dataset.workspaceViewId===bRe()))??null}const HMe=["document","header","shelf","rail","outliner","content","utility"],frn={rail:{part:"properties",view:"volter.properties",title:"Properties"},outliner:{part:"outliner",view:"volter.outliner",title:"Outliner"},content:{part:"content",view:"volter.content",title:"Content"}},drn={header:{prefix:"document-header",title:"header strip"},shelf:{prefix:"document-shelf",title:"tool shelf"}};function yVe(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=n9t(t.container)?.container;return s&&!n.includes(s)&&n.push(s),n}function prn(t){return document.querySelector(`[data-volter-part="${t}"]`)}function _rn(){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 mrn(t){if(t==="utility")return _rn();const n=t==="rail"||t==="outliner"||t==="content"?frn[t]:null;if(n){const s=prn(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 hrn(t)}function hrn(t){const n=CC();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=e_()??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=gVe(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=drn[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 fxt(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: ${HMe.filter(s=>s!==t.name).map(s=>`'${s}'`).join(", ")} (pass \`{ scope }\`). The rest of the page is deliberately unreachable.`)}const dxt=400,pxt="rgb(1, 2, 3)",grn="rgba(0, 0, 0, 0)";function yrn(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=pxt,t.appendChild(d);try{d.style.backgroundColor=`var(${n})`;const m=getComputedStyle(d).backgroundColor.trim();return m===pxt||m===grn?s:m}finally{d.remove()}}function vrn(t,n){const s=getComputedStyle(t),c={};for(const d of n)c[d]=d.startsWith("--")?yrn(t,d):s.getPropertyValue(brn(d)).trim();return c}function brn(t){return t.includes("-")?t:t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function _xt(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>dxt?`${k.slice(0,dxt)}…`: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:vrn(c,s)}:{}}}function _me(t,n,s){const c=s9t(t,n),d=c[s];if(!d)throw fxt(t,`${JSON.stringify(n)} matched ${c.length} element(s), so index ${s} does not exist`);if(!yVe(t).some(m=>m.contains(d)))throw fxt(t,`${JSON.stringify(n)} resolved outside the document's container`);return d}function Srn(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 vVe(t){let n=t;for(;n&&!(n.hasAttribute("tabindex")||n.tabIndex>=0||n.isContentEditable);)n=n.parentElement;(n??t).focus({preventScroll:!0})}function i9t(t,n=[.5,.5]){const s=t.getBoundingClientRect();return{clientX:s.x+s.width*n[0],clientY:s.y+s.height*n[1]}}function xrn(t,n){const{clientX:s,clientY:c}=i9t(t,n);return t.ownerDocument.elementFromPoint(s,c)??t}function wrn(t,n=1,s,c={},d){const m={...Srn(t,s),...d,...c},g=Math.max(1,Math.round(n));o9t(t,()=>{for(let S=1;S<=g;S++){const k={...m,detail:S},A={...m,buttons:0,detail:S};t.dispatchEvent(new PointerEvent("pointerdown",{...k,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousedown",k)),vVe(t),t.dispatchEvent(new PointerEvent("pointerup",{...A,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mouseup",A)),t.dispatchEvent(new MouseEvent("click",A))}g>=2&&t.dispatchEvent(new MouseEvent("dblclick",{...m,buttons:0,detail:g}))})}function Trn(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 o9t(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 Crn(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]);o9t(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)),vVe(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,Fe=A(se[0]+(pe[0]-se[0])*Ce,se[1]+(pe[1]-se[1])*Ce);t.dispatchEvent(new PointerEvent("pointermove",{...Fe,button:-1,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousemove",Fe))}}const q={...A(s[0],s[1]),buttons:0};t.dispatchEvent(new PointerEvent("pointerup",{...q,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mouseup",q)),g===2?t.dispatchEvent(new MouseEvent("contextmenu",q)):g===0&&n[0]===s[0]&&n[1]===s[1]&&t.dispatchEvent(new MouseEvent("click",q))})}function Ern(t,n){if(n)return n;const s=document.activeElement;return s instanceof HTMLElement&&yVe(t).some(c=>c.contains(s))?s:t.container}function s9t(t,n){try{return yVe(t).flatMap(s=>Array.from(s.querySelectorAll(n)))}catch(s){throw new Error(`Invalid selector ${JSON.stringify(n)}: ${String(s)}`)}}function sOe(t,n){const s=n.selector===void 0?null:_me(t,n.selector,n.index??0);return Ern(t,s)}const krn={" ":"Space","`":"Backquote","-":"Minus","=":"Equal","[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash"};function Arn(t){return/^[a-z]$/i.test(t)?`Key${t.toUpperCase()}`:/^[0-9]$/.test(t)?`Digit${t}`:krn[t]??t}const Drn={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 Prn(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]):Drn[t]??0}function Irn(t){const n=t===void 0?null:/^Numpad([0-9])$/.exec(t);return n?96+Number(n[1]):t==="NumpadDecimal"?110:null}function mxt(t,n){const s=new KeyboardEvent(t,Nrn(n)),c=Irn(n.code)??Prn(n.key);return Object.defineProperty(s,"keyCode",{get:()=>c}),Object.defineProperty(s,"which",{get:()=>c}),s}function Nrn(t){return{key:t.key,code:t.code??Arn(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 Orn(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 aOe=["query","click","drag","key","paste","select","type"];function Rrn(t){const n=t?.action;if(!aOe.includes(n))throw new Error(`Unknown document-probe action ${JSON.stringify(n)}. This door has exactly ${aOe.length} verbs: ${aOe.join(", ")} (\`editor.document.*\`).`);const s=t.scope??"document";if(!HMe.includes(s))throw new Error(`Unknown scope ${JSON.stringify(s)}. This door addresses exactly these surfaces: ${HMe.map(c=>`'${c}'`).join(", ")}.`);return mrn(s)}async function Frn(t){const n=Rrn(t);if(e_()===a0&&lrn()&&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:[_xt(d,0)]});switch(t.action){case"query":{const d=s9t(n,t.selector);return{scope:s,matched:d.length,elements:d.slice(0,t.limit??25).map((m,g)=>_xt(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:xrn(d,m);return wrn(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:i9t(d,m)),c(g)}case"type":{const d=sOe(n,t);return Trn(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 Crn(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=sOe(n,t);document.activeElement instanceof Node&&d.contains(document.activeElement)||vVe(d);const m=document.activeElement,g=m instanceof HTMLElement&&d.contains(m)?m:d;return g.dispatchEvent(mxt("keydown",t)),t.holdMs&&await new Promise(S=>setTimeout(S,t.holdMs)),g.dispatchEvent(mxt("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 Orn(d,t.value),c(d)}case"paste":{const d=sOe(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 hxt="editor-chrome-root";function Mrn(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 Ntn(n,s)??t9t(n)}}async function jrn(t,n){const s=document.getElementById(hxt);if(!s)throw new Error(`The editor chrome root (#${hxt}) is not mounted, so there is no editor page to photograph.`);let c=s;if(n?.region==="document"){const k=e_(),A=k?gVe(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 zFt(c,{canvasFrame:Mrn(d),includeDocumentStyles:!0,size:g}),view:ote(t),size:g,scale:d}}function ste(){return rve()}function mSn(){return!ste()}const Lge=new Set;function Lrn(t,n){const s={collect:t,reusableKeys:n?.reusableKeys??[]};return Lge.add(s),()=>{Lge.delete(s)}}function Brn(t=null){const n={};for(const s of Lge)Object.assign(n,s.collect(t));return n}function $rn(){const t=[];for(const n of Lge)t.push(...n.reusableKeys);return t}let zZ=null;const GI=[];function qrn(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 Vrn(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 gxt(){return zZ}function Urn(t,n){const s=[],c=[];for(const d of t.rows){const m=Jrn(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 Jrn(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 Wrn=new Set(["raw","url","worker","sharedworker","inline","init"]),Hrn=[".ts",".tsx",".js",".jsx",".mjs",".cjs"],Grn=/\.stories\.[cm]?[jt]sx?$/i;function Krn(t){let n;try{n=new URL(t,"http://volter.invalid")}catch{return null}return{path:n.pathname,query:n.search}}function Xrn(t){const n=new URLSearchParams(t);for(const s of n.keys())if(Wrn.has(s))return!0;return!1}function Yrn(t,n,s){if(t.startTime<s)return null;const c=Krn(t.name);if(!c)return null;const{path:d,query:m}=c;if(!d.includes(n)||!Hrn.some(A=>d.endsWith(A))||Grn.test(d)||d.endsWith("/volter.adapter.ts")||Xrn(m))return null;const g=new URLSearchParams(m),S=g.get(Pge)??"";g.delete(Pge);const k=g.toString();return{group:`${S}\0${d}`,path:d,url:`${d}${k?`?${k}`:""}`}}function Zrn(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=Yrn(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 hSn(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 a9t(){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 gSn(){$B=[],Gk?.disconnect(),Gk=null,ZQ=[];const t=a9t();if(!t){VO=null;return}VO=t.now(),typeof PerformanceObserver<"u"&&(Gk=new PerformanceObserver(n=>{ZQ.push(...n.getEntries())}),Gk.observe({type:"resource"}))}function ySn(t){const n=a9t();if(!n||VO===null)return VO=null,$B;const s=Gk?[...ZQ,...Gk.takeRecords()]:n.getEntriesByType("resource");return Gk?.disconnect(),Gk=null,ZQ=[],$B=Zrn(s,{projectRoot:t,since:VO}),VO=null,$B}function Qrn(){return $B}function vSn(){Gk?.disconnect(),Gk=null,ZQ=[],$B=[],VO=null}const GMe=new Set;let jY=null;function enn(t){return GMe.add(t),()=>{GMe.delete(t)}}function tnn(){return jY||(jY=Promise.all([...GMe].map(t=>Promise.resolve().then(t))).then(()=>{}).finally(()=>{jY=null}),jY)}const rnn=500;function yxt(t){const n=globalThis,s=n.requestIdleCallback;if(typeof s=="function"){const d=s.call(globalThis,t,{timeout:rnn});return()=>n.cancelIdleCallback?.call(globalThis,d)}const c=setTimeout(t,0);return()=>clearTimeout(c)}const mme=new Map;function bSn(t,n){return mme.set(t,n),()=>{mme.get(t)===n&&mme.delete(t)}}function nnn(){return Object.fromEntries([...mme].map(([t,n])=>[t,n()]))}let c9t=null;function SSn(t){c9t=t}function inn(){return c9t}const onn=["three","canvas","dom"];function vxt(t){return t.provenance?.source==="boundary"}function snn(t){return onn.includes(t)?t:null}function ann(){const t=Oye(),n=CC()?.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=sPt();if(!d)return c?[c]:[];if(d instanceof hy){const g=d.childAdapters().filter(S=>S.role==="world"&&!vxt(S.adapter)).map(S=>({worldId:S.worldId,surface:snn(S.kind),adapter:S.adapter}));return c?[c,...g.filter(S=>S.worldId!==n)]:g}if(vxt(d)||d===inn())return c?[c]:[];const m={worldId:"root",surface:tve(),adapter:d};return c?[c,m]:[m]}const qB=new Map,KMe=new Set;let l9t=0;function bxt(){l9t++;for(const t of KMe)t()}function xSn(t){return qB.set(t.id,t),bxt(),()=>{qB.get(t.id)===t&&(qB.delete(t.id),bxt())}}function wSn(t){return t?qB.get(t)??null:null}function cnn(){return[...qB.values()]}function TSn(t){if(t===null)return null;for(const n of qB.values())if(n.kind==="game"&&n.instanceId===t)return n;return null}function CSn(t){return KMe.add(t),()=>KMe.delete(t)}function ESn(){return l9t}function bVe(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 lnn(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 u9t(t){return t.filter(n=>n.failsafeEligible&&n.inlineHiding!==null)}function unn(t){return t.some(n=>n.hiddenBy!==null)?u9t(t).length>0:null}const fnn=4e3;function dnn(t){const n=t.deadlineMs??fnn;if(t.framesProduced<=0)return{fire:!1};if(t.hiddenForMs===null||t.hiddenForMs<n)return{fire:!1};if(bVe(t.canvases)===null)return{fire:!1};const s=[...u9t(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 hme=new Map;function kSn(t){return hme.set(t.id,t),()=>{hme.get(t.id)===t&&hme.delete(t.id)}}function pnn(){return[...hme.values()]}const cOe=10,a_e=5e3;function _nn(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 mnn(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 hnn(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 gnn(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>=cOe?{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 ${cOe}fps floor`,cause:`the visible tab is rendering below the ${cOe}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 ynn(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<a_e?{status:"ok",detail:`play started ${t.play.startedMsAgo}ms ago and has not drawn yet — inside the ${a_e}ms deadline`}:{status:"violation",detail:`play started ${t.play.startedMsAgo}ms ago and has drawn no frame (deadline ${a_e}ms)`,cause:`play started and no frame has drawn within the ${a_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 f9t={"edit-mode-static":_nn,"single-root-scene":mnn,"canvas-revealed":hnn,"visible-tab-fps-floor":gnn,"play-drew-a-frame":ynn},vnn=Object.keys(f9t);function bnn(t){return vnn.map(n=>({id:n,...f9t[n](t)}))}function Snn(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
1397
|
`)}const XMe=new Set;function xnn(t){return XMe.add(t),()=>{XMe.delete(t)}}function wnn(){for(const t of[...XMe])try{t()}catch(n){ea.error(`a session-sample subscriber threw: ${String(n)}`,"invariant")}}const Tnn=5e3;let Aw={frames:0,since:0},VZ=null,zB=null,oR=null;const UZ=new Map;function Cnn(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 Enn="editor-canvas";function knn(t){const n=t.style;return n.display==="none"?"display":n.visibility==="hidden"?"visibility":n.opacity!==""&&Number.parseFloat(n.opacity)===0?"opacity":null}function d9t(){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:Cnn(n),inlineHiding:knn(n),failsafeEligible:c!==Enn&&!n.closest(".monaco-editor")}})}function Ann(){const t=cnn();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 Dnn(){const t=pnn(),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 Pnn(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,...Ann()}:null;return{mode:n?"play":"edit",loops:[...WMe().map(g=>({name:`${g.id} session`,running:g.mounted()})),...WMe().map(g=>({name:`${g.id} playing`,running:g.playing()}))],designTimeSurfaces:Dnn(),presentedThreeRoots:sPt()?ann().filter(g=>g.surface==="three").map(g=>g.worldId):null,...(()=>{const g=d9t();return{canvasHiddenBy:bVe(g),canvasHidesItself:unn(g),hiddenCanvases:lnn(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 p9t(){return bnn(Pnn())}let mB=null;const Sxt=new WeakSet;function Inn(t,n){const s=bVe(t);if(s==null){mB=null;return}if(mB===null){mB=n;return}const c=dnn({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||Sxt.has(d)||(Sxt.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"),ea.error(c.ledger,"invariant"))}function Nnn(){const t=p9t();for(const n of t){const s=Snn(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}ea.warn(s,"invariant")}return t}function Onn(){if(zB!==null)return xxt;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),wnn(),Inn(d9t(),Date.now()),Nnn(),Aw={frames:0,since:Date.now()}},Tnn),xxt}function Rnn(){Aw={frames:0,since:zB===null?0:Date.now()},oR=null,mB=null,UZ.clear(),PO.clear()}function xxt(){VZ!==null&&cancelAnimationFrame(VZ),zB!==null&&clearInterval(zB),VZ=null,zB=null,Aw={frames:0,since:0},oR=null,mB=null,UZ.clear()}let YMe=null;function Fnn(t){YMe=t}function SVe(){return YMe?(YMe(),!0):!1}let xVe=[];const ZMe=new Set;function wxt(t){xVe=t;for(const n of ZMe)n()}function Mnn(){return xVe}function jnn(t){return ZMe.add(t),()=>ZMe.delete(t)}function Lnn(t){const n=xVe.find(s=>s.id===t);return n?(n.run(),!0):!1}let QQ=null;function Bnn(t){QQ=t}function $nn(t){QQ&&Promise.resolve(QQ(`${t}.focus`)).catch(()=>{})}const qnn=/^volter\.([^.]+)\.(.+)$/;async function znn(t,n){if(QQ)return await QQ(t,n);const s=qnn.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 fo(async()=>{const{invokeViewVerb:d}=await Promise.resolve().then(()=>o4r);return{invokeViewVerb:d}},[]);return c(s[1],s[2],n)}const wVe=[{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 Vnn(t){const{liveCanvasFrame:n}=await fo(async()=>{const{liveCanvasFrame:s}=await Promise.resolve().then(()=>crn);return{liveCanvasFrame:s}},void 0);return n(t)}async function Unn(...t){const{capturePlayComposite:n}=await fo(async()=>{const{capturePlayComposite:s}=await Promise.resolve().then(()=>nrn);return{capturePlayComposite:s}},void 0);return n(...t)}async function Txt(){return fo(()=>Promise.resolve().then(()=>HDt),void 0)}async function Jnn(){return fo(()=>Promise.resolve().then(()=>Wan),void 0)}function Wnn(t,n=5e3){return SC().some(s=>s.id===t)?Promise.resolve():new Promise(s=>{let c=0,d=()=>{};const m=()=>{clearTimeout(c),d(),s()};d=Jye(()=>{SC().some(g=>g.id===t)&&m()}),SC().some(g=>g.id===t)?m():c=window.setTimeout(m,n)})}async function Hnn(t){if(t){if(!SC().some(n=>n.id===t)){const n=t.startsWith(Ome);if(n&&(await(await Txt()).refreshProjectToolContributions(),await Wnn(t)),!SC().some(s=>s.id===t)){const s=SC().map(d=>d.id),c=n?(await Txt()).contributionFailureHint(t.slice(Ome.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>\`.`)}}bC(t)}}async function _9t(t){const n=wVe.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(FBe(s),!await EC(()=>eDt()===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 Gnn(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 Knn(t){let n=!1;if(await EC(()=>(n=LMe(t.id),n||sxt(t.id)!==null),PR),n)return e_();const s=sxt(t.id);throw s?new Error(s):new Error(`World document is not registered: ${t.id}`)}async function Xnn(t,n){const s=g=>g.filter(S=>S.id===n||S.label===n);let c=[];if(!await EC(()=>{const g=cBe(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 Ynn(t,n){const s=await Wye(n.kind,t,n);if(s!==null)return s;let c=!1;if(await EC(()=>(c=SN(n.id)||X0(n.id),c||axt(n.id)!==null),PR),c)return n.story!==void 0&&await Xnn(n.id,n.story),n.id;const d=axt(n.id);throw d?new Error(d):new Error(`Workspace document is not available: ${n.id}`)}async function Znn(t,n){const s=await Wye(n.kind,t,n);if(s===null){const{kind:c,...d}=n,m=dkr();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 Qnn(t){const n=KEr();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 ein(t,n){if(!n)return e_();if(!avr(n.kind))throw new Error(`present-view does not know the document kind "${String(n.kind)}". An EditorView addresses a document by one of: ${QTt.join(", ")}. `+Qnn(String(n.kind)));switch(n.kind){case"scene":return Gnn();case"world":return Knn(n);case"asset":case"tool":case"document":case"story":case"project-tool":case"generation":return Znn(t,n);case"workspace":return Ynn(t,n)}}function tin(t){const n=t.indexOf(",");return{base64:n>=0?t.slice(n+1):t,mimeType:"image/png"}}const Cxt=gVe;function rin(t,n,s){if(!s?.degenerate)return null;const c=cVe();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 m9t(t,n){const s=CC();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=o2(c.id);if(S?.capture){const J=S.capture(n);if(!J)throw new Error(`Object3D document could not be captured: ${c.id}`);return{...tin(J),document:g,view:m,source:"object3d-document"}}const k=c.id===a0?QFt()??Cxt(c.id):Cxt(c.id);if(!k)throw new Error(`Active document surface is not mounted: ${c.id}`);const A=n9t(k),F=await Unn(A?.container??k,{canvasFrame:A?.canvasFrame??Vnn,includeDocumentStyles:c.id!==a0&&!A}),D=rin(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 nin="workspace:scene";function iin(t){return o2(t)??o2(nin)}function oin(t,n,s,c){const d=o2(n),m=iin(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)?gAr(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 Bge(t,n,s={}){if(n?.version!==1)throw new Error("present-view requires EditorView version 1.");const c=Object.keys(n).filter(F=>!Dmt.includes(F));if(c.length>0)throw new Error(`present-view does not know ${c.map(F=>`"${F}"`).join(", ")}. An EditorView carries: ${Dmt.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)}.`);HBe(n.style)}if(n.workspace!==void 0){if(!kB(n.workspace))throw new Error(`present-view requires a workspace of ${$Be().join(", ")}, got ${String(n.workspace)}.`);if(zS()!==n.workspace){const F=hDt();s2(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 ein(t,n.document);await Hnn(n.utility);const S=o2(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 EC(()=>F.every(J=>Y0(t).hierarchy.node(J)!==null),PR))throw new Error(`Shared view selection is not available: ${F.join(", ")}`)}g&&e_()!==g&&X0(g),oin(t,g,n,m),n.panel!==void 0&&await _9t(n.panel);const k=tCt(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 Jnn()).showEditorPresentationNotice({presented:A,previousView:d}),A}const $ge=new Map;let h9t=0;const QMe=new Set;function g9t(){h9t+=1;for(const t of QMe)t()}function sin(t,n,s){const c=$ge.get(t);c&&c.assetPath===n&&c.actions.length===s.length&&c.actions.every((d,m)=>d===s[m])||($ge.set(t,{assetPath:n,actions:s}),g9t())}function ain(t){$ge.delete(t)&&g9t()}function cin(t){const n=[];for(const s of $ge.values())s.assetPath===t&&n.push(...s.actions);return n}function lin(t){return QMe.add(t),()=>QMe.delete(t)}function Ext(){return h9t}const uin=[],kxt=new Set;let fin=0;function din(t){for(const n of uin)if(n.match(t))return n;return null}function pin(t){return kxt.add(t),()=>{kxt.delete(t)}}function Axt(){return fin}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=[],eje=new Set,BY=new Map;let y9t=0;function lOe(){y9t++;for(const t of eje)t()}function _in(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(lOe)),lOe(),()=>{const s=eD.indexOf(t);s<0||(eD.splice(s,1),BY.get(t)?.(),BY.delete(t),lOe())}}const min=[];function hin(){return eD.length===0?min:eD}function v9t(t){return eje.add(t),()=>{eje.delete(t)}}function qge(){return y9t}function b9t(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 gin(){const t=J0e();return t?{path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}}:null}function yin(t,n){return Ye.useEffect(()=>()=>ain(t),[t]),Ye.useCallback(s=>{n!==null&&sin(t,n,s)},[t,n])}function vin({id:t,title:n,file:s,tool:c,Component:d}){Ye.useSyncExternalStore(U0e,qQ),Ye.useSyncExternalStore(Tye,cN,cN),Ye.useSyncExternalStore(Pye,lN,lN);const m=gin(),g=yin(t,m?.path??null),S=Ye.useRef(null),k=Ye.useCallback(F=>{S.current?.(),S.current=F===null?null:wBe(`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 $.jsxs("div",{"data-testid":`asset-inspector-tool-${t}`,style:{padding:8,borderTop:"1px solid var(--volter-structural-divider)",marginTop:4},children:[$.jsxs("div",{style:{...LCr,marginBottom:4},children:[$.jsx(dc,{icon:Kk.tool.extension,tone:"muted",style:{marginRight:4}}),n]}),$.jsx(TBe,{file:s,children:$.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:Kye(),surfaces:uBe,account:YLe(),play:Dye(),asset:m,setActions:g,notify:A,work:k})})]})}function bin(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 S9t=32,tje=new Set,Dxt=new Map,Pxt=new Map;let sR=null,JZ=null,x9t=0,rje=0,VB=0,xN=0,Ixt=!1,pD={url:null,progress:0,playing:!1};function Sin(){for(const t of tje)t()}function I$(t){pD.url===t.url&&pD.playing===t.playing&&Math.abs(pD.progress-t.progress)<.002||(pD=t,Sin())}function TVe(){return sR??=new AudioContext,sR}function xin(){if(Ixt||typeof window>"u")return;Ixt=!0;const t=()=>{if(!sR)return;const n=pD.url,s=xN;sR.resume().then(()=>{n&&s===xN&&!JZ&&sR?.state==="running"&&C9t(n,s)})};window.addEventListener("pointerdown",t,{capture:!0}),window.addEventListener("keydown",t,{capture:!0})}function CVe(){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 w9t(){if(VB=0,!pD.playing||!sR||rje<=0)return;const t=Math.min(1,(sR.currentTime-x9t)/rje);I$({url:pD.url,progress:t,playing:t<1}),t<1&&typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(w9t))}function win(t,n,s){if(s!==xN)return;CVe();const c=TVe(),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,x9t=c.currentTime,rje=t.duration,I$({url:n,progress:0,playing:!0}),typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(w9t))}async function T9t(t){const n=Dxt.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 TVe().decodeAudioData(d.slice(0))})().catch(()=>null);return Dxt.set(t,s),s}async function C9t(t,n){xin();const s=await T9t(t);if(n!==xN)return;if(!s){I$({url:t,progress:0,playing:!1});return}const c=TVe();c.state==="suspended"&&(await c.resume(),n!==xN)||c.state==="running"&&win(s,t,n)}function Tin(t){return tje.add(t),()=>tje.delete(t)}function Cin(){return pD}function Ein(t){const n=++xN;CVe(),I$({url:t,progress:0,playing:!0}),C9t(t,n)}function kin(t){t&&pD.url!==t||(xN+=1,CVe(),I$({url:null,progress:0,playing:!1}))}function Ain(t,n=S9t){const s=`${t}#${n}`,c=Pxt.get(s);if(c)return c;const d=T9t(t).then(m=>m?bin(m.getChannelData(0),n):Array.from({length:n},()=>0));return Pxt.set(s,d),d}let _Z=[];function ASn(t){return _Z=[..._Z,t],()=>{_Z=_Z.filter(n=>n!==t)}}function E9t(t){return _Z.find(n=>n.accepts(t))??null}const EVe={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)"},Din={folder:uee,model:N0r,prefab:GB,component:eLe,audio:nLe,image:S0r,video:P0r,json:oLe,unknown:jTt,source:YTt};function vD({kind:t,size:n=24}){return $.jsx(dc,{icon:Din[t],style:{fontSize:n,color:EVe[t]}})}const Pin=100,Iin=50,Nin=new WPt(t=>{const n=E9t(t);return n?n.render(t):Promise.reject(new Error(`No model preview loader for ${t}.`))},2);function k9t(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 b$e().then(q=>{if(D)return;const G=q.status==="ok"?q.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=Nin.request(t,n),J.promise}).then(q=>{!D&&q&&c(q)}).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 A9t({url:t}){const n=k9t(t,Pin);return n.failed?$.jsx(vD,{kind:"model"}):n.fromManifest&&n.src?$.jsx("img",{src:n.src,alt:"cached model preview",onError:n.rejectManifest,style:{width:"100%",height:"100%",objectFit:"contain"}}):n.src?$.jsx("img",{src:n.src,alt:"model preview",style:{width:"100%",height:"100%",objectFit:"contain"}}):$.jsx("div",{style:{width:28,height:28,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center"},children:$.jsx("div",{className:"volter-anim-spin",style:{width:16,height:16,border:`2px solid ${nhe[2]}`,borderTopColor:EVe.model,borderRadius:"50%"}})})}function Oin({url:t,name:n}){const[s,c]=Ye.useState(()=>Array.from({length:S9t},()=>.15)),d=Ye.useSyncExternalStore(Tin,Cin);Ye.useEffect(()=>{let S=!1;return Ain(t).then(k=>{S||c(k)}),()=>{S=!0}},[t]);const m=d.url===t,g=m?d.progress:0;return $.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 $.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=EVe[t],d=s==="cell";return t==="audio"?$.jsxs("svg",{role:"img","aria-label":`${n} waveform preview`,viewBox:"0 0 64 48",width:d?"78%":52,height:d?"78%":44,children:[$.jsx("rect",{width:"64",height:"48",rx:"4",fill:"var(--volter-bg-inset)"}),Array.from({length:16},(m,g)=>$.jsx("rect",{x:g*4+1,y:24-g*13%18/2,width:"2",height:g*13%18+3,fill:c},g))]}):$.jsxs("svg",{role:"img","aria-label":`${n} ${t} preview`,viewBox:"0 0 52 48",width:d?"66%":48,height:d?"72%":44,children:[$.jsx("rect",{x:"5",y:"3",width:"42",height:"42",rx:"4",fill:"var(--volter-bg-inset)",stroke:c}),$.jsx("path",{d:"M13 15h26M13 23h18M13 31h22",stroke:c,strokeWidth:"3",strokeLinecap:"round"})]})}function D9t(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 DSn(t,n,s,c,d){return t==="fit"?D9t(n,s,c,d):t}function Rin(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=WYr(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 P9t({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?D9t(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||Rin(F,D,n)},D.src=t,()=>{J=!0}},[n,t]),$.jsx("canvas",{ref:d,width:m,height:g,"aria-hidden":!0,style:{width:k,height:A,imageRendering:"pixelated",display:"block"}})}const I9t={fontSize:11,color:Zf[3],marginBottom:2},Fin={fontSize:11,color:Zf[1],wordBreak:"break-all"};function uOe({asset:t}){Ye.useSyncExternalStore(l2,rA,rA);const n={path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}};return MDt().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?$.jsx(vin,{id:s.id,title:s.title,file:s.file,tool:s.tool,Component:s.Component},`${s.id}:${s.version}`):null})}function Nxt(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 $.jsxs("div",{children:[$.jsx("div",{style:I9t,children:t}),$.jsx("div",{style:Fin,children:n})]})}function Min({asset:t}){const n=t.capabilities?.editor==="environment";Ye.useSyncExternalStore(v9t,qge,qge);const s=t.componentPreview,c=s?b9t({name:t.name,path:s.sourcePath,surface:s.surface}):null;return $.jsx("div",{"data-testid":"inspector-asset-preview",style:{position:"absolute",inset:0,background:hBe.inset,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:c?$.jsx(c.source.Thumbnail,{entry:c.entry,previewRevision:0}):n?$.jsx(wR,{kind:"image",name:t.name,variant:"cell"}):t.kind==="image"?$.jsx(Lin,{path:t.path,name:t.name}):t.kind==="video"?$.jsx(jin,{path:t.path}):t.kind==="model"?$.jsx(A9t,{url:t.path}):$.jsx(wR,{kind:t.kind,name:t.name,variant:"cell"})})}function jin({path:t}){return $.jsx("video",{src:t,muted:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"contain"}})}function Lin({path:t,name:n}){const{sheetPath:s,frameName:c}=H0e(t),[d,m]=Ye.useState(null);return Ye.useEffect(()=>{if(!c){m(null);return}let g=!1;return fetch(`/${PRt(s)}`).then(S=>S.ok?S.text():null).then(S=>{if(g||!S)return;const k=Nze(S);m(k?.frames.find(A=>A.name===c)??null)}).catch(()=>{g||m(null)}),()=>{g=!0}},[c,s]),d?$.jsx(P9t,{sheetUrl:`/${s}`,frame:d,maxEdge:96}):$.jsx("img",{src:t.split("#")[0],alt:n,style:{width:"100%",height:"100%",objectFit:"contain"}})}function Bin({asset:t}){const[n,s]=Ye.useState(null),{sheetPath:c,frameName:d}=H0e(t.path);return Ye.useEffect(()=>{if(s(null),t.kind!=="image"||t.capabilities?.editor==="environment")return;let m=!1;if(d)return fetch(`/${PRt(c)}`).then(S=>S.ok?S.text():null).then(S=>{if(m||!S)return;const k=Nze(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?$.jsx(Ph,{label:"Dimensions",value:`${n.w} × ${n.h}`}):null}function $in(){Ye.useSyncExternalStore(pin,Axt,Axt);const t=J0e();if(!t)return null;const n=din(t),s=t.name.includes(".")?t.name.split(".").pop()??"":"";return n?$.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",borderBottom:`1px solid ${nhe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[$.jsx(n.View,{asset:t}),$.jsx(uOe,{asset:t})]}):(t.selectionCount??1)===1&&(t.kind==="image"&&!t.path.includes("#")&&t.capabilities?.editor!=="environment"||t.kind==="video"||t.kind==="audio")?$.jsxs($.Fragment,{children:[$.jsx(zRt,{assetPath:t.path,kind:t.kind,sizeBytes:t.sizeBytes}),$.jsxs("div",{style:{padding:"0 8px",display:"grid",gap:6},children:[t.health&&t.health!=="healthy"&&$.jsx(Ph,{label:"Health",value:t.health}),!!t.healthCodes?.length&&$.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.sourcePath&&$.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!!t.dependencies?.length&&$.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")}),!!t.references?.length&&$.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")})]}),$.jsx(uOe,{asset:t})]}):$.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${nhe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[$.jsx(Bin,{asset:t}),$.jsx("div",{style:{...I9t,marginBottom:0,textTransform:"uppercase"},children:"Asset"}),$.jsx("div",{style:{fontWeight:600,fontSize:12,color:Zf[1],wordBreak:"break-all"},children:t.name}),$.jsx(Ph,{label:"Path",value:t.path}),t.componentPreview&&$.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&&$.jsxs($.Fragment,{children:[$.jsx(Ph,{label:"Selection",value:`${t.selectionCount} assets`}),t.selectionTotalBytes!==void 0&&$.jsx(Ph,{label:"Total size",value:Nxt(t.selectionTotalBytes)}),t.selectionFormats&&$.jsx(Ph,{label:"Formats",value:t.selectionFormats.join(", ")})]}),s&&$.jsx(Ph,{label:"Format",value:s.toUpperCase()}),t.sizeBytes!==void 0&&$.jsx(Ph,{label:"Size",value:Nxt(t.sizeBytes)}),t.capabilities&&$.jsxs($.Fragment,{children:[$.jsx(Ph,{label:"Runtime readiness",value:t.capabilities.runtimeReady?"Runtime-ready":"Import or conversion required"}),$.jsx(Ph,{label:"Preview",value:t.capabilities.previewable?"Available":"Unsupported"}),$.jsx(Ph,{label:"Placement",value:t.capabilities.placeable?"Placeable":"Not placeable"}),$.jsx(Ph,{label:"Editor",value:FB(t.capabilities)??"No editor"})]}),t.health&&$.jsx(Ph,{label:"Health",value:t.health}),t.healthCodes&&$.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.dependencies&&$.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")||"None"}),t.references&&$.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")||"None"}),t.sourcePath&&$.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!t.componentPreview&&$.jsxs("div",{style:{display:"flex",gap:6},children:[$.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&&$.jsxs($.Fragment,{children:[$.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"}),$.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"})]})]}),$.jsx("div",{style:{fontSize:10,color:Zf[3]},children:"Double-click (or press Enter) in the asset browser to open the full viewer."}),$.jsx(uOe,{asset:t})]})}function qin(t){return cin(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 zin(){const t=J0e();if(t===null)return null;const n=Oye();return n&&(n.adapter!==null||n.nodeId!==null)?null:{quickActions:qin(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:LRe,title:"Preview",icon:iB,order:x4t,body:{kind:"preview",render:()=>$.jsx(Min,{asset:t})}},{id:"asset-selection",title:"Asset",icon:R$,order:fQ,body:{kind:"custom",render:()=>$.jsx($in,{})},keepMounted:!0}]}}const Vin={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 Uin(t){const n=Vin[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 Jin={ok:I0r,gap:MTt,na:K0r,info:R$},Win={ok:Go.semantic.success,gap:Go.semantic.warning,na:Go.content.dim,info:Go.content.dim};function Hin({row:t}){return $.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:[$.jsx("span",{style:{color:Win[t.status],paddingTop:1},children:$.jsx(dc,{icon:Jin[t.status]})}),$.jsxs("div",{style:{minWidth:0},children:[$.jsx("div",{style:{color:Go.content.primary,fontWeight:600},children:Uin(t.seam)}),$.jsx("div",{style:{marginTop:2,color:Go.content.muted,lineHeight:1.4,overflowWrap:"anywhere"},children:t.detail}),t.missing&&$.jsxs("div",{style:{marginTop:6,color:Go.content.muted,lineHeight:1.4},children:[$.jsx("strong",{style:{color:Go.semantic.warning},children:"Missing:"})," ",t.missing]}),t.fix&&$.jsxs("div",{style:{marginTop:4,color:Go.content.dim,lineHeight:1.4},children:[$.jsx("strong",{children:"Fix:"})," ",t.fix]})]})]})}function Gin({report:t}){const{summary:n}=t;return $.jsxs("div",{"data-testid":"ingest-coverage-report",style:{fontSize:"var(--volter-font-base)"},children:[$.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,padding:"7px 10px 9px",color:Go.content.muted},children:[$.jsxs("span",{style:{color:n.gaps>0?Go.semantic.warning:Go.semantic.success},children:[n.gaps," ",n.gaps===1?"gap":"gaps"]}),$.jsxs("span",{children:[n.ok," integrated"]}),$.jsxs("span",{children:[n.na," not applicable"]}),$.jsxs("span",{children:[n.info," informational"]})]}),t.rows.map(s=>$.jsx(Hin,{row:s},s.seam))]})}function Kin(t){return{id:"ingest-coverage",title:"Ingest coverage",icon:UTt,order:9e3,description:`${t.summary.gaps} gap${t.summary.gaps===1?"":"s"}`,defaultOpen:!0,testId:"ingest-coverage-section",body:{kind:"custom",render:()=>$.jsx(Gin,{report:t}),data:{summary:t.summary,rows:t.rows}}}}function Xin(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 N9t="inspectorPresentation";function Yin(t){return t==="card"||t==="column"||t==="properties"}function Oxt(){const t=YAr(N9t);if(!t||typeof t!="object")return{};const n={};for(const[s,c]of Object.entries(t))Yin(c)&&(n[s]=c);return n}let UB=null,nve=0;const UO=new Set;let fOe=null;YDt().then(()=>{UB=null,nve++;for(const t of UO)t()});function Zin(){nve++;for(const t of UO)t()}function O9t(){if(UB===null){if(!XAr())return Oxt();UB=Oxt()}return UB}function nje(t){return O9t()[t]??null}function kVe(t,n){if($nn("volter.properties"),nje(t)!==n){UB={...O9t(),[t]:n},nve++,ZAr(N9t,UB);for(const s of UO)s()}}function Qin(t){return UO.size===0&&(fOe=WAr(Zin)),UO.add(t),()=>{UO.delete(t),UO.size===0&&(fOe?.(),fOe=null)}}function Rxt(){return nve}function eon(t,n,s=null){return n??s??t}function R9t(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 ije(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function ton(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?ije(d.kind):null}function ron(t){const n=iBe();if(n!==null&&n.documentId===e_())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?ije(d[0]?.kind??""):null;if(m)return m;const g=ton(s,t);if(g)return g}return ije(tve()??"")??"three"}function non({stories:t,activeStoryId:n,onApplyStory:s,isolation:c,unavailableReason:d}){return $.jsxs("div",{style:{padding:"4px 0"},children:[t.length>0?$.jsxs(Iw,{"data-testid":"ingest-stories-select",value:n,onChange:m=>{const g=m.target.value;s(g===""?null:g)},style:{width:"100%"},children:[$.jsx("option",{value:"",children:"(none)"}),t.map(m=>$.jsx("option",{value:m.id,children:m.label},m.id))]}):$.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&&$.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 F9t(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 ion([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,q=c*d,G=c*m,se=c*g,pe=1-(F+J),ue=k-se,Ce=A+G,Fe=1-(S+J),De=D-q,be=D+q,X=1-(S+F),we=Math.asin(Math.min(Math.max(Ce,-1),1));return Math.abs(Ce)<.9999999?[Math.atan2(-De,X),we,Math.atan2(-ue,pe)]:[Math.atan2(be,Fe),we,0]}function AVe(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]=ion(S);return[k*bD,A*bD,F*bD]}function oon(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:F9t(s[0]/bD,s[1]/bD,s[2]/bD)}:{...c,[n]:[s[0],s[1],s[2]]}}function son(t,n,s){const c=AVe(t.rotation);return c[n]=s,{position:[...t.position],rotation:F9t(c[0]/bD,c[1]/bD,c[2]/bD),scale:[...t.scale]}}const aon={x:"#e0726d",y:"#83bd66",z:"#6390dd"};function dOe({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),q=Ye.useRef(!1);return $.jsx(T_e,{label:n,style:{padding:"4px 8px"},children:t.map(({axis:G,name:se})=>$.jsx(SZ,{testId:`${c}-${se}`,label:se,labelColor:aon[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=>{q.current||(q.current=!0,g?.()),J({axis:G,value:pe}),S?.(G,pe)},onChangeEnd:pe=>{q.current=!1,J(null),k(G,pe)}},se))})}function con({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?.(son(n,pe,ue))},q=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=>q(se)).filter(se=>se.readOnly&&se.readOnlyReason).map(se=>se.readOnlyReason))];return $.jsxs(FTr,{children:[$.jsx(dOe,{axes:t==="2d"?k:A,label:"Position",testidPrefix:"ingest-position",values:n.position,step:.1,precision:3,...q("position"),onBegin:m,onPreview:g&&D("position",g),onCommit:D("position",S)}),$.jsx(dOe,{axes:t==="2d"?[{axis:2,name:"z"}]:A,label:t==="2d"?"Rotation (degrees)":"Rotation",testidPrefix:"ingest-rotation",values:AVe(n.rotation),step:1,precision:1,...q("rotation"),onBegin:m,onPreview:g&&J(g),onCommit:J(S)}),$.jsx(dOe,{axes:t==="2d"?k:A,label:"Scale",testidPrefix:"ingest-scale",values:n.scale,step:.01,precision:3,...q("scale"),onBegin:m,onPreview:g&&D("scale",g),onCommit:D("scale",S)}),G.map(se=>$.jsx(_p,{"data-testid":"inspector-transform-readonly-reason",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:se},se)),d&&$.jsx(_p,{"data-testid":"inspector-transform-note",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:d})]})}function Fxt(t){return t.revertsTo===void 0?`Revert ${t.label} to default`:`Revert ${t.label} to ${t.revertsTo}`}function lon({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,q=D??A.value;q&&q!==S.current&&J(q),S.current=null,m(null)};return A.addEventListener("change",F),()=>A.removeEventListener("change",F)},[]),$.jsx(a4t,{...c,ref:g,value:d??t,onChange:A=>{S.current===null&&(S.current=t),m(A.target.value),s?.(A.target.value)}})}async function M9t(t,n=qRt){const s=await Promise.all(n.map(c=>uon(t,c)));return{assets:s.flatMap(c=>c.assets),failedListings:s.flatMap(c=>c.failedListings)}}async function uon(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 fon(t,n){const s=t.filter(S=>S.root==="public"),c=don(s),d=(await Promise.all(c.map(async S=>{const k=await n(S.path);if(!k)return null;const A=Nze(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=Mxt(S.path);for(const F of qYr(k.image))m.add(A?`${A}/${F}`:F);for(const F of s)yMe(F.path)===yMe(S.path)&&m.add(F.path)}const g=d.flatMap(({sidecar:S,parsed:k})=>{const A=Mxt(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 don(t){const n=new Map;for(const s of t){if(!/\.json$/i.test(s.path))continue;const c=yMe(s.path),d=n.get(c);(!d||OSt(s.path)>OSt(d.path))&&n.set(c,s)}return[...n.values()]}function Mxt(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function j9t(t){const n=ig(t).kind;return n==="model"||n==="image"||n==="video"||n==="audio"?n:"other"}function pon(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 _on(t){return(t.surface==="three"?0:t.surface==="canvas"?10:t.surface==="dom"?20:30)+(t.exported?0:4)}const mon=1e4,hon={paths:[],failures:[]};let $Y=null;async function gon(){const t=await M9t(K0e,["public"]);return{paths:t.assets.filter(n=>j9t(n.entry.name)==="image").map(n=>n.path).sort((n,s)=>n.localeCompare(s)),failures:t.failedListings}}function yon(){const t=Date.now();return(!$Y||t-$Y.at>mon)&&($Y={at:t,scan:gon().catch(n=>($Y=null,{paths:[],failures:[n instanceof Error?n.message:String(n)]}))}),$Y.scan}function von(t){const[n,s]=Ye.useState(hon);return Ye.useEffect(()=>{let c=!0;return yon().then(d=>{c&&s(d)}),()=>{c=!1}},[t]),n}const bon={width:64},jxt={width:BCr,fontSize:"var(--volter-font-md)",color:Go.content.muted};function AI(t){return`ingest-prop-${t.replace(/\./g,"-")}`}function Son({field:t,io:n,value:s}){const{paths:c,failures:d}=von(!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 $.jsx($Cr,{testId:AI(t.path),value:s,options:c,previewUrlFor:F=>`/${F}`,disabled:t.readonly,note:k??A,onChange:S})}function xon({field:t,io:n}){const s=t,c=n.get(s.path),d=jRe(c)?void 0:c,m=s.defaulted===!0&&d===void 0,g=s.readonly?CBe(s):void 0,S=s.resettable?$.jsx(dm,{"data-testid":`ingest-revert-${s.path.replace(/\./g,"-")}`,"aria-label":Fxt(s),title:Fxt(s),onClick:()=>n.remove?.(s.path),children:$.jsx(dc,{icon:LOe})}):null;return s.type==="boolean"?$.jsxs("label",{title:g,style:{display:"flex",gap:6,alignItems:"center",padding:"6px 8px",fontSize:"var(--volter-font-md)"},children:[$.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)}),$.jsx("span",{style:s.defaulted?{color:Go.content.dim}:void 0,children:s.label}),S]}):$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[$.jsx("span",{style:s.defaulted?{...jxt,color:Go.content.dim}:jxt,title:g??(s.defaulted?`${s.label} — default (not set here)`:s.label),children:s.label}),s.type==="color"?$.jsx(lon,{"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"?$.jsx(NRe,{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:bon}):s.type==="enum"?$.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&&$.jsx("option",{value:"",children:"—"}),(s.options??[]).map(k=>$.jsx("option",{value:String(k),children:String(k)},String(k)))]}):s.type==="vec3"?$.jsx("div",{style:{width:190},children:$.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"?$.jsx(Son,{field:s,io:n,value:typeof d=="string"?d:""}):s.type==="json"?$.jsx(yBe,{"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)}`):$.jsx(NRe,{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 L9t({fields:t,io:n}){return $.jsx($.Fragment,{children:t.map(s=>$.jsx(xon,{field:s,io:n},s.path))})}function ive(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 won=Ye.lazy(()=>fo(()=>import("./InspectorCanvasPreview-BrFjhoiD.js"),__vite__mapDeps([261,1,2,3,4])).then(t=>({default:t.InspectorCanvasPreview})));function PSn({picture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=ive(n);return $.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&&$.jsx(Ye.Suspense,{fallback:null,children:t()}),!d&&s.map(g=>$.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 Ton({source:t,entry:n,previewKey:s,actions:c,mode:d="section"}){const m=d==="thumbnail",g=ive(s);return $.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&&$.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",background:"var(--volter-bg-inset)"},children:$.jsx(t.Thumbnail,{entry:n,previewRevision:0,width:m?96:256,height:m?96:256})}),!m&&c.map(S=>$.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 Con({capture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=ive(n);return $.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&&$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(won,{capture:t,previewKey:n,size:d?96:256})}),!d&&s.map(g=>$.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 Eon(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function kon(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:Eon(d),properties:c.get(d)}))}}function Aon(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 Don=14,Pon=[[/physic|rigid|collid/i,R0r],[/material/i,c0r],[/light/i,Qje],[/camera/i,nye],[/audio|sound|music/i,nLe],[/player|character|humanoid|person/i,O0r],[/anim|state|machine/i,OTt]];function Ion(t){for(const[n,s]of Pon)if(n.test(t))return s;return GB}function Non(t){return n=>Ye.createElement(Ton,{source:t.picture.source,entry:t.picture.entry,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Oon(t){return n=>Ye.createElement(Con,{capture:t.capture,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Ron(t){return t.media?t.media.preview?t.media.preview({displayName:t.displayName,previewKey:t.previewKey,actions:t.actions}):null:t.canvasCapture?Oon({capture:t.canvasCapture,previewKey:t.previewKey,actions:t.actions}):t.picture?Non({picture:t.picture,previewKey:t.previewKey,actions:t.actions}):null}function pOe(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 Fon={position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};function Mon(t,n,s,c){if(T4t(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 B9t(t,n,s,c){const d=new Set,m=new Map,g=[];for(const S of t){const k=Mon(S,n,s,c).filter(F=>!d.has(F.id)),A=(T4t(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 $9t(t,n,s){return s===void 0?[...t]:t.filter(c=>n.get(c.id)===s.owner||s.builtins.includes(c.id))}function oje(t){const{adapter:n,nullSubject:s}=t,{sections:c,claimed:d,owners:m}=B9t(n?t.contributions??[]:[],n,null,null),g=$9t([...(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:EBe(t.surface)},quickActions:s?.quickActions??[],related:[],sections:g}}function jon(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 Lon(t){const{adapter:n,nodeId:s,node:c,contributions:d,onEdit:m}=t;if(s===null)return oje({nullSubject:t.nullSubject??null,surface:t.surface,contributions:d,adapter:n,rail:t.rail});const{sections:g,claimed:S,owners:k}=B9t(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=dPt(n,s,en,ii);return m(),No},...n.inspector?.remove?{remove:en=>{const ii=C3r(n,s,en);return m(),ii}}:{}},F=n.inspector?.properties(s)??[],D=F.find(en=>en.path==="name"),{ungrouped:J,groups:q}=kon(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?Zje:sLe,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:RTt,placement:"identity",run:async()=>{await uPt(n,s),m()}});const De=new Map;De.set(D5e,se);for(const en of q)De.set(Lht(en.groupId),en.properties);const be=[],X=n.truth?.resolve(s,"position").site??null,we=t.media,Be=c?.typeLabel??c?.label??s,bt=t.surface==="canvas"&&we===null&&t.stories?b9t({name:Be,path:X?.anchored===!0?X.file:"",surface:"canvas"}):null,It=ue.filter(en=>en.placement==="preview"),Wt=Ron({media:we,canvasCapture:t.canvasPreview,picture:bt,displayName:c?.label??s,previewKey:s,actions:It});!S.has(LRe)&&Wt!==null&&be.push({id:LRe,title:"Preview",icon:aR,order:x4t,body:{kind:"preview",render:Wt}});const zt=Aon(n,s),ft=!S.has(jht)&&zt!==null,tr=ft?q.find(en=>en.name==="Transform")?.properties??[]:[];if(ft){const en=n.transforms?.get(s)??Fon,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:AVe(en.rotation),scale:[...en.scale]};be.push({id:jht,title:"Transform",icon:$Tt,order:sEr,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[pOe(En)],set:(En,cs)=>{if(!n.transforms)return;const On=oon(en,pOe(En),cs);NFe(n,s),q_e(n,s,On);const ji=OFe(n,s);return m(),ji},...n.transforms?.remove?{remove:En=>{const cs=lPt(n,s,pOe(En));return m(),cs}}:{}}},render:()=>[Ye.createElement(con,{key:"channels",dimensions:zt,transform:en,readOnly:!n.capabilities.transform,channelEditability:No,...ii?.note?{note:ii.note}:{},onBegin:()=>{NFe(n,s)},onPreview:En=>{q_e(n,s,En)},onCommit:En=>{q_e(n,s,En),OFe(n,s),m()}}),...tr.length>0?[Ye.createElement(L9t,{key:"rows",fields:tr,io:A})]:[]]}})}S.has(D5e)||(se.length>0&&be.push({id:D5e,title:"Properties",icon:qTt,order:fQ,defaultOpen:!0,body:{kind:"fields",fields:se,io:A}}),q.forEach((en,ii)=>{if(tr.length>0&&en.name==="Transform")return;const No=en.properties.filter(gn=>!gn.defaulted).length;be.push({id:Lht(en.groupId),title:en.name,icon:Ion(en.name),order:w4t+ii,description:No>0?`${No} set of ${en.properties.length}`:`${en.properties.length} properties`,defaultOpen:No>0&&en.properties.length<=Don,testId:`ingest-group-${en.groupId}`,body:{kind:"fields",fields:en.properties,io:A}})}));const Qt=t.stories;!S.has(S4t)&&Qt&&be.push(Bon(Qt)),be.push(...g.map(en=>jon(en,A,De))),be.sort((en,ii)=>en.order-ii.order);const Tt=$9t(be,k,t.rail),vn=bPt(n,s),Yr=SPt(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:EBe(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 Bon(t){return{id:S4t,title:t.title??"Stories",icon:aLe,order:aEr,body:{kind:"custom",render:()=>Ye.createElement(non,{stories:t.stories,activeStoryId:t.activeStoryId,onApplyStory:t.onApplyStory,isolation:t.isolation,unavailableReason:t.unavailableReason??null})}}}const $on=["project-tool","tool-contribution"];function qon(t){const{activeDocumentKind:n,documentSelection:s}=t;return n===null||!$on.includes(n)?!1:s===null}function Lxt(t){const{subject:n,surface:s,available:c,override:d,workspaceDefault:m=null,columnShown:g=!0}=t,S=n.presentation.preferred??EBe(),k=eon(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 q9t="game";function zon(t){const n=t.projectName?.trim();return{id:q9t,title:n&&n.length>0?n:"Game",kindLabel:"Game",...t.instanceName?{note:{text:t.instanceName}}:{},sections:[]}}function ISn(t){return m$e({match:()=>e_()===a0,describe:()=>zon(t())})}const Von=3,Uon=Object.freeze({none:!0});function Jon(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>=Von)return{kind:"opaque",type:Bxt(t)};if(Array.isArray(t))return t.map(m=>eee(m,n+1));const c=t;if(!Jon(c))return{kind:"opaque",type:Bxt(c)};const d={};for(const[m,g]of Object.entries(c))g!==void 0&&(d[m]=eee(g,n+1));return d}function Bxt(t){return t.constructor?.name??"object"}function $xt(t,n){let s;try{s=n.get(t.path)}catch{s=void 0}return{path:t.path,label:t.label,type:t.type,...jRe(s)?{mixed:!0}:{},...!jRe(s)&&s!==void 0?{value:eee(s)}:{},...t.defaulted!==void 0?{defaulted:t.defaulted}:{},...t.readonly!==void 0?{readonly:t.readonly}:{},...t.readonly?{readonlyReason:CBe(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 qxt(t){const n={};for(const[s,c]of Object.entries(t))c!==void 0&&(n[s]=eee(c));return n}function Won(t){const n=t.body;if(n.kind==="fields")return{kind:"fields",fields:n.fields.map(s=>$xt(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:qxt(n.data)};if(n.kind==="custom"&&n.editable!==void 0){const s=n.editable;return{kind:"fields",fields:s.fields.map(c=>$xt(c,s.io)),...n.data!==void 0?{data:qxt(n.data)}:{}}}return{kind:n.kind,id:t.id,title:t.title}}function Hon(t){return{id:t.id,title:t.title,order:t.order,...t.description!==void 0?{description:t.description}:{},body:Won(t)}}function Gon(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(Hon)}}const zxt=new WeakMap;function Kon(t){if(!t.capture)return null;const n=zxt.get(t);if(n)return n;const s=async c=>t.capture?.(c)??null;return zxt.set(t,s),s}function Xon(t){return typeof t.previewImage=="function"}function Yon(t,n,s){if(!n)return null;if(s==="asset-lab"){const d=o2(e_());return d?Kon(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 Xon(c)?d=>c.previewImage(n,d,d):null}function Zon(){const t=e_();if(t===null)return null;const n=htn(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 Qon(t){const{store:n,adapter:s,documentSelection:c,surface:d}=t,m=zin();if(m!==null)return{subject:oje({nullSubject:m,surface:d}),available:!0};const g=Xin(c,n.selectedEntityIds,s),S=g?s.hierarchy.node(g):null;if(g!==null&&S===null)return{subject:oje({nullSubject:null,surface:d}),available:!1};const k=()=>n.notifyIngestEdit(),A=g?null:Y3r({adapter:s,surface:d,store:n,onEdit:k}),F=g?S?qht(S,s):[]:qht(null,s,{nullSubjectId:A?.id??null}),D=g?kze(s,g):null;return{subject:Lon({adapter:s,nodeId:g,node:S,surface:d,contributions:F,...g?{}:{nullSubject:A},media:d==="asset-lab"?null:D,canvasPreview:Yon(s,g,d),assetDocument:D?.assetDocument??null,stories:W3r(s,S,g),...Zon()??{},...c===null&&g!==null&&n.selectedEntityIds.size>1?{alsoSelected:n.selectedEntityIds.size-1}:{},onEdit:k}),available:g!==null||A!==null||F.length>0}}function ove(t){const n=ron(t),{adapter:s,documentSelection:c}=Cm(t),d=Qon({store:t,adapter:s,documentSelection:c,surface:n}),{subject:m}=d,g=d.available&&(m.id!==q9t||m.sections.length>0)&&!qon({activeDocumentKind:CC()?.descriptor.kind??null,documentSelection:c}),S=e_()===a0?dVe():null;if(S){const k=Kin(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 Lxt({subject:A,surface:n,available:!0,override:nje(n),workspaceDefault:mD().inspector??null,columnShown:vgt("properties")!==!1})}return Lxt({subject:m,surface:n,available:g,override:nje(n),workspaceDefault:mD().inspector??null,columnShown:vgt("properties")!==!1})}function sve(t){const{subject:n,surface:s,presentation:c,available:d}=ove(t);return d?Gon(n,{surface:s,presentation:c}):Uon}async function esn(t,n){const{subject:s,available:c}=ove(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(),sve(t)}function tsn(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 rsn(t,n,s){const c=z9t(t,n);tsn(c.field,s);const d=await c.io.set(n,s)??Rhe;return{subject:sve(t),write:d}}function z9t(t,n){const{subject:s,available:c}=ove(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: ${CBe(S.field)}`);return S}class sje extends Error{constructor(n){super(n),this.name="InspectionRemovalUnavailableError"}}async function nsn(t,n){const s=z9t(t,n);if(s.field.resettable!==!0)throw new sje(`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 sje(`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)??Rhe;return{subject:sve(t),write:c}}const DVe=new Map;let V9t=[];const aje=new Set;function U9t(){V9t=[...DVe.values()];for(const t of aje)t()}function NSn(t){return aje.add(t),()=>aje.delete(t)}function OSn(t){DVe.set(t.rootId,t),U9t()}function RSn(t){DVe.delete(t)&&U9t()}function J9t(){return V9t}function isn(){const t=J9t();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 osn(t){return t.liveMounted?t.livePlaying?t.storePlayState==="paused"?"paused":"playing":"paused":"stopped"}async function ssn(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 zge="console";function asn(t){let n=zQ().length>0;const s=CRt(()=>{const m=zQ().length>0;m&&!n&&mD().drawer!=="hidden"&&bC(zge),n=m});let c=t.getSnapshot().lastError!==null;const d=t.subscribe(()=>{const m=t.getSnapshot().lastError,g=m!==null;g&&!c&&(ea.error(`Source write rolled back: ${m.message} (${m.code})`,"history"),mD().drawer!=="hidden"&&bC(zge)),c=g});return()=>{s(),d()}}function ave(){tkr(zge)}function cve(){bC(zge)}const Vge=new Map;function FSn(t){return n=>{if(n.phase==="adopted"){Vge.set(t,{source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[]});return}const s=Vge.get(t);s&&s.alternates.push({sceneId:n.sceneId,cameraId:n.cameraId,sameRenderer:n.sameRenderer,drawCount:n.drawCount})}}function MSn(t){Vge.delete(t)}function csn(){return[...Vge].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 lsn=new Set(["state","stateAll","providers","commands","events","snapshot"]);function usn(t){if(t.type!=="bridge-call")return[];const n=t.method;if(typeof n!="string"||!lsn.has(n))return[];const s=t.instance;try{const c=$wr(s).debug;if(c===void 0)return[];const d=[v3t(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 fsn(t,n,s){const c=usn(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":Bvr(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 dsn(t,n,s,c){return t==="none"?!1:!(t==="if-content-changed"&&n==="none"&&s===c)}function Vxt(t,n){const s=nq(t);return s.hierarchy.node(n)!==null||kze(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 _Oe(t,n,s){const c=o2(e_())?.selection;if(c){c.apply(n);return}const d=t.applySelectionBeforePresentation(n);s?.deferPresentation?s.deferPresentation(d):setTimeout(d,0)}function psn(){return typeof document>"u"?null:{visibility:document.visibilityState,focused:document.hasFocus(),reportedAt:Date.now()}}const _sn=["entities","entityCount","ontologyInvariants"];function msn(t){const n={...t};for(const s of _sn)delete n[s];for(const s of $rn())delete n[s];return{...n,_statePatch:!0}}function Uxt(t,n=null){const s=zQ(),c=e_(),d=Pze(t),m=g4t.getSnapshot(),g=n?.entities??W0e(t);return{playState:osn({storePlayState:t.playState,liveMounted:_Ve(),livePlaying:rve()}),mountFailures:s.map(S=>({...S})),storyFailures:rq().flatMap(S=>S.ok?[]:[{modulePath:S.modulePath,error:S.error}]),moduleSplits:Qrn().map(S=>({path:S.path,urls:[...S.urls]})),adapter:u0(),readiness:J9t().map(S=>({...S})),readinessWarning:isn(),worldAdoption:csn().map(S=>({...S})),presence:psn(),pageErrors:hsn(),consoleErrors:gsn(),sessionErrors:ysn(),sessionWarnings:vsn(),rendererResources:{...nnn()},ontologyInvariants:n?.ontologyInvariants??p9t().map(S=>({...S})),...Brn(n),selectedEntityId:d[0]??null,selectedEntityIds:d,selectedCreationSite:RYr(t),selectedWriteAnchorKind:FYr(t),activeViewportTab:t.activeViewportTab,activeDocumentId:c,activeUtilityId:QEr(),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:Q0e().map(S=>({id:S.descriptor.id,category:S.category,default:S.default})),activeTabKey:(()=>{const S=e_();return S&&JRt(S)?S:"__inspector__"})(),entityCount:g.length,savePath:Dze(t),saveState:ERt(t),entities:g,viewportActivationTimings:sTr()}}function W9t(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 PVe(t){const n=aVe();return!n||t<n.startedAt?!1:n.endedAt===null||t<=n.endedAt}function hsn(){return ea.getEntries().filter(t=>t.level==="error"&&t.source==="runtime"&&PVe(t.timestamp)).slice(-100).map(t=>t.count>1?`${t.message} (×${t.count})`:t.message)}const Jxt=200;function gsn(){return IVe(ea.getEntries().filter(t=>t.level==="error"&&t.source!=="runtime"&&PVe(t.timestamp)))}function IVe(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>Jxt?`${c.message.slice(0,Jxt)}…`:c.message;return`${d}${g}${m}`});return{count:n,recent:s}}function ysn(){return IVe(ea.getEntries().filter(t=>t.level==="error"&&!PVe(t.timestamp)))}function vsn(){return IVe(ea.getEntries().filter(t=>t.level==="warn"))}async function bsn(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=e_();if(!s)return{ok:!1,error:"document-script: no document is active",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE"}};await p4t(s);const c=cQ(s);if(e_()!==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 Ssn(t,n,s){if(jYr(n.type),hYr()&&n.type!=="stop")return{ok:!1,error:"Video export owns this paused run. Stop it to cancel before another command."};const c=uVe(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 LYr(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 W9t(n,g)}if(!sye(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 tnn(),{ok:!0};case"select":{const g=n.id??null;if(g!==null){const S=Vxt(t,g);if(S)return{ok:!1,error:S}}_Oe(t,g?[g]:[],s);break}case"select-multiple":{const g=n.ids;for(const S of g){const k=Vxt(t,S);if(k)return{ok:!1,error:k}}_Oe(t,g,s);break}case"select-all":{_Oe(t,W0e(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 _9t(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 WRt(S,g))return{ok:!1,error:`Asset document did not finish mounting its Inspector: ${S}`};break}case"close-asset-tab":{const g=n.key;JRt(g)&&EN(g);break}case"toggle-command-palette":SVe();break;case"toggle-console":ave();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 ${$Be().join(", ")}, got ${String(g)}.`};if(zS()===g)return{ok:!0,data:{workspace:g,applied:!0}};const S=hDt().then(()=>!0);s2(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)}.`};HBe(g);const k=Ahe();return k!==g?{ok:!1,error:`set-style applied "${g}" but the editor is wearing ${k===null?"a custom mix of axes":`"${k}"`} (${lgt(g).join("; ")}).`,data:{style:k,differences:lgt(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."};GBe(S,k)}const A=n.preset;return A!==void 0&&(typeof A!="string"||!vAr(S,A))?{ok:!1,error:`viewport-presentation \`preset\` must be one of: ${fgt().map(F=>F.id).join(", ")||"(none registered)"}.`}:{ok:!0,data:{presentation:KBe(S),binding:F_e(S),bound:wAr(),lastDraw:xAr(S),presets:mAr().map(F=>F.id),viewPresets:fgt().map(F=>F.id),environmentImages:AAr().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."}:Rye(g)?(TDt(g),{ok:!0,data:{material:_N(),style:Ahe()}}):{ok:!1,error:`set-appearance material must be one of ${kTr().map(k=>k.id).join(", ")}, got ${String(g)}.`}}case"present-view":try{return{ok:!0,data:{...await Bge(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:sve(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 esn(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 znn(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=gxt();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:Urn(g,{playState:t.playState,activeViewportTab:t.activeViewportTab})}}}case"expand-hierarchy-all":case"collapse-hierarchy-all":{const g=n.type==="expand-hierarchy-all",S=gxt();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 rsn(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 nsn(t,g);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return g instanceof sje?{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=Pze(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,q=S.structure;if(!q)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=Xye(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&&q.removeMany?await a$e(S,A):await Ohe(S,D())}};case"duplicate":{if(A.length>1&&q.duplicateMany)return{ok:!0,data:{write:await mPt(S,A)}};const G=Yye(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(!q.reorder)return{ok:!1,error:"structure-op: this adapter has no `reorder`."};const G=J("beforeSiblingId")??null;return{ok:!0,data:{write:await c$e(S,D(),G)}}}case"wrap":return q.wrap?{ok:!0,data:{write:await Zye(S,D(),J("tag"))}}:{ok:!1,error:"structure-op: this adapter has no `wrap`."};case"unwrap":return q.unwrap?{ok:!0,data:{write:await Qye(S,D())}}:{ok:!1,error:"structure-op: this adapter has no `unwrap`."};case"group":{if(!q.group)return{ok:!1,error:"structure-op: this adapter has no `group`."};const G=e0e(S,A);return{ok:!0,data:{id:G.id,write:await G.ack}}}case"ungroup":{if(!q.ungroup)return{ok:!1,error:"structure-op: this adapter has no `ungroup`."};const G=l$e(S,D());return{ok:!0,data:{ids:G.ids,write:await G.ack}}}case"copy":return q.copy?{ok:!0,data:{copied:await t0e(S,A)}}:{ok:!1,error:"structure-op: this adapter has no `copy`."};case"cut":{if(!q.cut)return{ok:!1,error:"structure-op: this adapter has no `cut`."};const G=await r0e(S,A);return G===!1?{ok:!1,error:'structure-op "cut" was refused by the adapter.'}:{ok:!0,data:{write:G}}}case"paste":{if(!q.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 n0e(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 Frn(n.step)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"capture-active-document":{const g=ODr(n);if("error"in g)return{ok:!1,error:g.error};try{return n.view&&await Bge(t,n.view),{ok:!0,data:{...await m9t(t,g.size)}}}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 jrn(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 YFt(J)??{ok:!1,error:"No running lane can remount with a selection."}:void 0,D=(k?await ssn(k,{scenes:fVe,activateGameDocument:()=>X0(a0),gameDocumentId:a0,...A?{remountSelection:A}:{}}):null)??await Ptn(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 bsn(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 xsn(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=Uxt(t),d=t.contentVersion,zSt(c))};let D=null;const J=()=>{S!==null&&(clearTimeout(S),S=null),D?.(),D=null},q=()=>{k=null,A!==null&&clearTimeout(A),A=null},G=()=>{q(),g=!0,J(),S=setTimeout(()=>{S=null,D=yxt(()=>{D=null,g=!1,F()})},250)},se=vn=>{if(t.contentVersion!==vn){G();return}q(),k=vn,A=setTimeout(q,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()?(dsn(en,vn,t.contentVersion,d)&&(vn==="explicit"?G():vn==="if-content-changed"?se(Yr??t.contentVersion):ue(Yr)),!0):!1,Fe=(vn="always",Yr="none",en=null)=>{if(n_e()!==null)return;if(c===null){F();return}const ii=Uxt(t,c);c=ii,zSt(msn(ii)),vn!=="none"&&(Ce(Yr,en,vn)||(J(),q(),g=!1,!(vn==="if-content-changed"&&t.contentVersion===d)&&D===null&&(D=yxt(()=>{D=null,F()}))))};let De=!1,be=!1,X=t.playState;const we=vn=>{vn&&(be=!0),!De&&(De=!0,queueMicrotask(()=>{De=!1;const Yr=be;be=!1;const en=X!==t.playState;X=t.playState,Fe(Yr?"always":"if-content-changed",en&&t.playState==="playing"?"explicit":"none")}))},Be=()=>we(!1),bt=()=>we(!0),It=t.subscribe(Be),Wt=hVe(bt),zt=OC(bt),ft=iTr(bt);F(),i_e(!0),eEr(LZr),s.addEventListener("open",()=>{Fe("if-content-changed"),i_e(n_e()===null)});const tr=Oze(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=ZYr(No,String(Yr.type));en&&VSt(en,!1,En);return}en&&MZr(en);let gn;Ssn(t,Yr,{deferPresentation:En=>{gn=En},...n?{history:n}:{}}).catch(En=>W9t(Yr,En)).then(En=>{if(en){const On=VSt(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=fsn(Yr,En.ok,m);Fe(cs.derived,cs.playFullReport,ii)})}catch{}}),s.addEventListener("project-changed",()=>{window.location.reload()});const Qt=()=>Fe();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,q(),tr(),It(),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 wsn(t,n,s){return Ye.createContext(s)}const LD=wsn(void 0,"EditorContext",null);function Tsn({runtime:t,children:n}){const s=Ye.useMemo(()=>({begin:()=>{},end:()=>{}}),[]);return $.jsx(LD.Provider,{value:t,children:$.jsx(s4t.Provider,{value:s,children:$.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 jSn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStats must be used within <EditorProvider>");return t.stats}function Csn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorInit must be used within <EditorProvider>");return t.initPromise}function H9t(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryService must be used within <EditorProvider>");return t.session.history}function Esn(){return Ye.useContext(LD)?.session.history??null}function LSn(){return Ye.useContext(LD)?.store??null}function BSn(){return Ye.useContext(LD)?.stats??null}function lve(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryCommands must be used within <EditorProvider>");return t.session.historyCommands}function G9t(){const t=lve();return Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}function ksn(t,n){return t==="selection"&&n==="selection"?"selection":"content"}class Asn{_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;i2(()=>{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=ksn(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&&e_()===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 Dsn{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 Psn(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),ea.warn(c.message,"history"))),d!==s&&(s=d,d&&ea.warn(d.message,"history"))})}class Isn{constructor(n,s={}){this.projectIdentity=n,this.history=new hDr(s),this.historyCommands=new Dsn(this.history),this.releaseLimitNotices=Psn(this.history)}history;historyCommands;releaseLimitNotices;dispose(){this.releaseLimitNotices(),this.historyCommands.dispose(),this.history.dispose()}}function Nsn(){return K9t}let K9t=Promise.resolve();function X9t(){const t=Osn();return K9t=t.then(()=>{},()=>{}),t}async function Osn(){await Y9t()}async function Y9t(){const t=of();if(t){ea.log(`Opened project: ${t.config.name}`,"project");return}try{const n=await yFt();n&&ea.log(`Opened project: ${n.config.name}`,"project")}catch{}}const Z9t=Object.freeze(Object.defineProperty({__proto__:null,bootstrapProject:X9t,initProject:Y9t,projectBootstrapSettled:Nsn},Symbol.toStringTag,{value:"Module"}));function mOe(t){return Promise.reject(new Error(`This editor tier cannot ${t}.`))}const Q9t={openPersistence:()=>mOe("persist Asset Lab documents"),replaceSource:()=>mOe("write project source"),saveThumbnailFraming:()=>mOe("write project thumbnail framing")};let gme=Q9t;function Rsn(t){if(gme!==t){if(gme!==Q9t)throw new Error("An Object3D document write policy is already installed.");gme=t}}function Fsn(){return gme}function Msn(){let t=0;const n=async()=>{const c=++t,d=of();if(d)try{const m=await jze();if(m.status!=="project"||m.project.path!==d.rootPath)return;const g=m.project.config;if(c!==t||of()!==d)return;cLe({...d,config:g})}catch(m){c===t&&of()===d&&console.error("[project] Could not refresh project declarations:",m)}},s=ien(()=>void n());return()=>{t++,s()}}function jsn(){return Pvr(()=>{mVe(),y3r(null),jwr(),Rnn(),lTr(),O3t(),_tn(),oD()})}async function Lsn(){typeof performance<"u"&&performance.getEntriesByType("navigation").length>0&&await Promise.race([Nye(),new Promise(n=>setTimeout(n,5e3))]),await mN()}function Bsn(){Lsn();const t=Rw(()=>void mN()),n=fFt(()=>void mN());return()=>{t(),n()}}const $sn={tools:[],contributions:[],loadErrors:[]};let eMt=$sn,tMt=0;const cje=new Set;function Wxt(t){eMt=t,tMt++;for(const n of cje)n()}function N$(){return eMt}function qsn(){return tMt}function rMt(t){return cje.add(t),()=>cje.delete(t)}async function WZ(){try{const t=await fetch("/__editor/project-tools"),n=await L_(t,"Catalog request failed");return Wxt(n),n}catch(t){const n={tools:[],contributions:[],loadErrors:[{sourcePath:"package.json#volter.tools",message:t instanceof Error?t.message:String(t)}]};return Wxt(n),n}}async function zsn(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 Vsn(){WZ();const t=Rw(()=>void WZ()),n=fFt(()=>void WZ());return()=>{t(),n()}}const Uge=new Map;function Usn(t,n){if(n===null){Uge.delete(t);return}Uge.set(t,n),Jsn()}const Hxt=128;let mZ=[],HZ=null,nMt=0,yme=!1;function Jsn(){if(yme)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&&(nMt+=1),mZ.push({start:s.startTime,duration:c}),mZ.length>Hxt&&(mZ=mZ.slice(-Hxt))}}),t.observe({type:"longtask",buffered:!0})}catch{return()=>{}}return yme=!0,()=>{t.disconnect(),yme=!1}}function Wsn(){return yme?{longestTaskMs:HZ===null?null:Math.round(HZ),tasksOver100ms:nMt}:null}function Hsn(t=performance.now()){if(Uge.size===0)return null;const n={};for(const[s,c]of Uge){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 Gxt(t){return!("unavailable"in t)}function Gsn(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 Ksn=5e3,Xsn=4,Ysn=1024*1024;function hOe(t){return Math.round(t/Ysn*100)/100}function Zsn(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*Xsn;return{heapUsedMB:Gxt(n)?hOe(n.usedBytes):null,heapLimitMB:Gxt(n)&&n.limitBytes!==null?hOe(n.limitBytes):null,mountEpochs:t.mountEpochs(),canvases:s.length,canvasMB:hOe(g),...d===null?{}:{workerCalls:d},...m===null?{}:{stalls:m},...c===null?{}:{textures:c.textures,geometries:c.geometries,...c.programs===null?{}:{programs:c.programs}}}}function Qsn(t){const n=new Set;for(const s of t)try{const c=new URL(s.name,"http://volter.invalid").searchParams.get(Pge);c!==null&&c.length>0&&n.add(c)}catch{}return n.size}function ean(){return{heap:()=>Gsn(),mountEpochs:()=>Qsn(performance.getEntriesByType("resource")),canvases:()=>[...document.querySelectorAll("canvas")],rendererCounts:()=>Hwr()?.memorySnapshot?.().counts??null,workerCalls:()=>Hsn(),stalls:()=>Wsn()}}let iMt=null;function $Sn(){return iMt}function tan(t){const n=t.sources??ean(),s=t.hidden??(()=>document.visibilityState==="hidden"),c=()=>{if(s())return;const m=Zsn(n);iMt=m,t.report(m)};c();const d=setInterval(c,t.intervalMs??Ksn);return()=>clearInterval(d)}function ran({children:t}){const n=Ye.useRef(null);n.current||(n.current=new Asn({followsWorkspaceFocus:!0}),WZr(n.current));const s=Ye.useRef(null);if(!s.current){const g=of();s.current=new Isn(g?.rootPath??"unknown-project")}n.current.attachHistory(s.current.history),Rsn(NDr);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=X9t()),Ye.useEffect(()=>xsn(n.current,s.current.historyCommands),[]),Ye.useEffect(()=>Bsn(),[]),Ye.useEffect(()=>Vsn(),[]),Ye.useEffect(()=>Yen(),[]),Ye.useEffect(()=>Msn(),[]),Ye.useEffect(()=>jsn(),[]),Ye.useEffect(()=>Atn(),[]),Ye.useEffect(()=>tan({report:dZr}),[]);const m=Ye.useRef(!1);return Ye.useEffect(()=>{m.current=!0;const g=s.current;return()=>{m.current=!1,queueMicrotask(()=>{m.current||g.dispose()})}},[]),$.jsx(Tsn,{runtime:{store:n.current,stats:c.current,initPromise:d.current,session:s.current},children:t})}const Jge={x:0,y:0,zoom:1};function qSn(t=Jge){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=Jge,c())},subscribe:d=>(s.add(d),()=>s.delete(d))}}let r2=Jge;const lje=new Set,zSn={get:()=>nan(),setView:(t,n,s)=>NVe(t,n,s),setPan:(t,n)=>sMt(t,n),setZoom:t=>ian(t),reset:()=>aMt(),subscribe:t=>oan(t)};function oMt(){for(const t of lje)t()}function nan(){return r2}function NVe(t,n,s){const c=Math.min(4,Math.max(.1,s));r2.x===t&&r2.y===n&&r2.zoom===c||(r2={x:t,y:n,zoom:c},oMt())}function sMt(t,n){NVe(t,n,r2.zoom)}function ian(t){NVe(r2.x,r2.y,t)}function VSn(t,n){sMt(r2.x+t,r2.y+n)}function aMt(){r2.x===0&&r2.y===0&&r2.zoom===1||(r2=Jge,oMt())}function oan(t){return lje.add(t),()=>lje.delete(t)}function USn(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 san=new Set(["opacity","zIndex","flexGrow","flexShrink","fontWeight","lineHeight"]);function aan(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 JSn(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 WSn(t,n){return typeof n!="number"?n:n===0||san.has(t)?String(n):`${n}px`}const can={hidden:!1,interactive:!1,pickLock:!1},cMt=new Map;function uve(t){return cMt.get(t)??can}function OVe(t,n){cMt.set(t,{...uve(t),...n})}function oq(t){return uve(t).hidden}function lan(t,n){OVe(t,{hidden:n})}function uan(t){lan(t,!oq(t))}function lMt(t){return uve(t).interactive}function fan(t,n){OVe(t,{interactive:n})}function dan(t){fan(t,!lMt(t))}function uMt(t){return uve(t).pickLock}function pan(t,n){OVe(t,{pickLock:n})}function _an(t){pan(t,!uMt(t))}const Kxt=8,wN=8,HSn=[{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 GSn(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/Kxt)*Kxt}function fMt(t,n,s,c,d){let m=Math.max(wN,iA(n.width+t,s)),g=null;return c.length&&(g=pve(n.x+m,c,d),g&&(m=Math.max(wN,g.edge-n.x))),{value:m,match:g}}function dMt(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=pve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,eastEdge:m,match:S}}function pMt(t,n,s,c,d){let m=Math.max(wN,iA(n.height+t,s)),g=null;return c.length&&(g=pve(n.y+m,c,d),g&&(m=Math.max(wN,g.edge-n.y))),{value:m,match:g}}function _Mt(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=pve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,southEdge:m,match:S}}function man(t,n,s,c,d,m,g){if(t==="e"||t==="ne"||t==="se")return{width:fMt(n,s,d,m,g).value};if(t==="w"||t==="nw"||t==="sw"){const{value:S,eastEdge:k}=dMt(n,s,d,m,g);return c?{width:S,x:k-S}:{width:S}}return{}}function han(t,n,s,c,d,m,g){if(t==="s"||t==="sw"||t==="se")return{height:pMt(n,s,d,m,g).value};if(t==="n"||t==="nw"||t==="ne"){const{value:S,southEdge:k}=_Mt(n,s,d,m,g);return c?{height:S,y:k-S}:{height:S}}return{}}function KSn(t,n,s,c,d,m,g,S=TR){const k=!m&&g?ate(g):null,A=k?fve(k):[],F=k?dve(k):[];return{...man(t,n,c,d,m,A,S),...han(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 fve(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 dve(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 pve(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 XSn(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,fve(S),TR).value,g=tee(g,s.height,dve(S),TR).value}return{x:m,y:g}}function YSn(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,q=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<=q&&(q=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 ZSn(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,fve(k),m).match,F=tee(S,s.height,dve(k),m).match,D={x:g,y:S,width:s.width,height:s.height};return ree(D,A,F)}function QSn(t,n,s,c,d="both",m=!1,g=TR,S={},k=yan){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 q=d==="y"?{value:A.x,match:null}:Xxt(A.x,A.width,F,g),G=d==="x"?{value:A.y,match:null}:Xxt(A.y,A.height,D,g),se={...A,x:q.value,y:G.value};return{position:{x:t.x+se.x-A.x,y:t.y+se.y-A.y},guides:ree(se,q.match,G.match)}}function gan(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]:[]],q=(pe,ue)=>{let Ce=pe,Fe=d;for(const De of J){const be=Math.abs(pe-De)*ue;be<=Fe&&(Fe=be,Ce=De)}return Ce},G=q((F*k-D*S)/A,Math.hypot(m,g)),se=q((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 exn(t,n,s){const{smart:c,grid:d}=s;let m=t;return n&&c.enabled!==s.invert&&(c.sides||c.center)&&(m=gan(t,n,c.sides,c.center,s.threshold)),n&&Math.abs(Aan(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 txn(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 yan={parent:!0,others:!0,guides:!0};function Xxt(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 rxn(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=fve(D),q=dve(D);let G=null;S?G=fMt(n,c,!1,J,g).match:k&&(G=dMt(n,c,!1,J,g).match);let se=null;return A?se=pMt(s,c,!1,q,g).match:F&&(se=_Mt(s,c,!1,q,g).match),ree(c,G,se)}function nxn(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 Yxt=new WeakMap;function van(t){const n=t.boxEdit;if(!n)return null;const s=Yxt.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 Yxt.set(t,{provider:n,recorded:c}),c}function ban(t,n){return RN(t,n)?.rects?.rect(n)??null}function San(t,n){const s=RN(t,n);return s?van(s):null}function ixn(t,n){return RN(t,n)?.rects?.contextRects?.(n)}function oxn(t,n){return RN(t,n)?.structure??null}function sxn(t,n){return RN(t,n)?.text??null}function axn(t,n){return RN(t,n)?.colorSample??null}function cxn(t,n){const s=RN(t,n);return s?.rects?k3r(s):null}function lxn(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 xan(t,n){const s=c=>{const d=t.inspector?.get(n,`style.${c}`);return aan(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 wan=4;function uxn(t,n){const s=D=>D>0?D:wan,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 Tan(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 fxn(t,n,s,c){const d=Tan(t,n,s),m=Math.max(0,Math.round(c+d));return{[t]:m}}function dxn(t,n,s){return{x:t.x+n,y:t.y+s,width:t.width,height:t.height}}const gOe=3;function SO(t,n){return n==="x"?t.x+t.width/2:t.y+t.height/2}function Can(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 Ean(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=gOe/2;return s?{x:n-m,y:c,width:gOe,height:d-c}:{x:c,y:n-m,width:d-c,height:gOe}}function pxn(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,q)=>SO(J.rect,m)-SO(q.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=Can(g,k,d),D=Ean(g,F,d);return{beforeSiblingId:A,index:k,marker:D}}function _xn(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 mxn(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 q=Math.max(d,k),G=Math.min(m,A),se=G>q?(q+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 q=Math.max(s,g),G=Math.min(c,S),se=G>q?(q+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 yOe(t,n,s){const c=t?.get(n,s);return typeof c=="string"&&c.length>0?c:null}function hxn(t,n){const s=yOe(t.inspector,n,"style.position");let c=null;const d=t.hierarchy.node(n)?.parentId??null;if(d){const m=yOe(t.inspector,d,"style.display");m==="flex"||m==="inline-flex"?c=`flex ${(yOe(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 gxn(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 yxn(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 vxn(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 kan(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 bxn(t,n){return RN(t,n)?.rects?.frame?.(n)??null}function Sxn(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 Aan(t){return Math.atan2(t.tr.y-t.tl.y,t.tr.x-t.tl.x)}function mMt(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 hMt(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 xxn(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 wxn(t,n){const{s,t:c}=hMt(n);return mMt(t,s,c)}function Zxt(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 Txn(t,n,s,c,d,m=!1){const g=Zxt(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=hMt(n),q=mMt(t,1-J.s,1-J.t),G=Zxt(t,{x:q.x-d.x,y:q.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+q.x-se.x,originY:d.y+q.y-se.y}}let Qxt=!1;const gMt=new Set(["viewport","hierarchy","inspector","asset-browser","workspace","global"]);let yMt="viewport";const vMt="editorActiveHotkeyScope";function Cxn(){const t=document.documentElement.dataset[vMt];return t&&gMt.has(t)?t:yMt}function CR(t){yMt=t,document.documentElement.dataset[vMt]=t}const Dan="data-editor-app-undo";function ewt(t){return t instanceof Element&&t.closest(`[${Dan}]`)!==null}function uje(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 Pan(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&&gMt.has(s))return s}return null}function twt(t){const n=Pan(t);n&&CR(n)}const vOe=[];function rwt(t){return vOe.push(...t),()=>{for(const n of t){const s=vOe.indexOf(n);s>=0&&vOe.splice(s,1)}}}function Ian(){Qxt||(window.addEventListener("pointerdown",twt,!0),window.addEventListener("focusin",twt,!0),Qxt=!0)}const GZ=new Map;let bMt=0;const fje=new Set;function nwt(){bMt++;for(const t of fje)t()}function Nan(t){return GZ.set(t.id,t),nwt(),()=>{GZ.get(t.id)===t&&(GZ.delete(t.id),nwt())}}function Oan(){return[...GZ.values()]}function Ran(){return bMt}function Fan(t){return fje.add(t),()=>fje.delete(t)}function RVe(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 Pze(t)}async function FVe(t){const n=BD(t);n.length!==0&&await t0e(Cm(t).adapter,n)}async function MVe(t){const n=BD(t);n.length!==0&&await r0e(Cm(t).adapter,n)}async function jVe(t){const n=Cm(t).adapter,s=BD(t)[0],c=s?n.hierarchy.node(s)?.parentId??null:null;await n0e(n,c)}let iwt=Promise.resolve();function _ve(t){const n=iwt.then(()=>Man(t));return iwt=n.then(()=>{},()=>{}),n}async function Man(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 mPt(s,n);if(m&&!m.persisted){i0(m.destination);return}}else for(const m of n){const g=await Yye(s,m).ack;if(g&&!g.persisted){i0(g.destination);return}}i0(`Duplicated ${d}`)}async function mve(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(c)if(c.removeMany)await a$e(s,n);else{const d=new Map(aPt(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 Ohe(s,g)}}async function jan(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 Zye(s,d)}async function Lan(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 Qye(s,d)}async function Ban(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;s.structure?.group&&await e0e(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=San(d,m);if(!g)continue;const S=ban(d,m);if(!S)continue;const k=d.inspector?.get(m,"style.position"),A=k==="absolute"||k==="fixed",F=xan(d,m),D=kan(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 $an(t){const n=Array.isArray(t)?t:[t];return n.includes("global")?"global":n.length===1&&n[0]==="viewport"?"stage":"panel"}let vme=null;function pp(t,n){const{frameEnabled:s,...c}=n;return vme?.push(Nan({id:t,run:d=>c.action(d??new KeyboardEvent("keydown")),scope:$an(c.scope),...s?{enabled:s}:{}})),OBe(t).map(d=>({...c,...d}))}function SMt(t){const n=()=>{const g=[],S=vme;vme=g;try{return{rows:t(),actions:g}}finally{vme=S}};let s=n(),c=rwt(s.rows);const d=()=>{c();for(const g of s.actions)g()},m=Uye(()=>{d(),s=n(),c=rwt(s.rows)});return()=>{m(),d()}}function qan(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=SMt(()=>[...pp("edit.redo",{scope:"global",allowInEditable:!0,when:m=>!uje(m.target)||ewt(m.target),action:c}),...pp("edit.undo",{scope:"global",allowInEditable:!0,when:m=>!uje(m.target)||ewt(m.target),action:s}),...pp("edit.copy",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void FVe(t)}),...pp("edit.cut",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void MVe(t)}),...pp("edit.paste",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void jVe(t)}),...pp("edit.duplicate",{scope:Tw,action:()=>void _ve(t)}),...pp("edit.group",{scope:Tw,action:()=>void Ban(t)}),...pp("edit.wrap",{scope:Tw,action:()=>jan(t)}),...pp("edit.unwrap",{scope:Tw,action:()=>Lan(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,aPt(m))}}),...pp("edit.deselectAll",{scope:Tw,action:()=>c0(Cm(t).adapter,[])}),...pp("edit.save",{scope:"global",allowInEditable:!0,action:()=>{hTr().then(m=>{m===null&&ARt(t)})}}),...pp("view.resetPan",{scope:"viewport",action:()=>aMt()}),...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 mve(t)}),...pp("edit.exitScopeOrDeselect",{scope:Tw,when:()=>F3r()!==null||t.playState==="stopped",frameEnabled:()=>!0,action:()=>{const m=Cm(t).adapter;if(!M3r(m)){if(t.playState!=="stopped"){mVe();return}t.select(null)}}}),...pp("view.commandPalette",{scope:"global",action:()=>{SVe()||ea.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:()=>ave()}),...pp("view.focusMode",{scope:"global",action:()=>MBe()}),...pp("workspace.cycleNext",{scope:"global",action:()=>{She(1)}}),...pp("workspace.cyclePrevious",{scope:"global",action:()=>{She(-1)}})]);return Ian(),d}function zan(t){return SMt(()=>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 LVe(){rkr("undo-history")}function Van(){const t=()=>LVe();return window.addEventListener("editor:show-history-tab",t),()=>window.removeEventListener("editor:show-history-tab",t)}let dje=null,xMt=0;const pje=new Set;function BVe(t){if(dje!==t){dje=t,xMt++;for(const n of pje)n()}}function wMt(){return dje}function Uan(t){BVe(t)}function TMt(){BVe(null)}function CMt(t){return pje.add(t),()=>pje.delete(t)}function _je(){return xMt}function Jan(){BVe(null)}const Wan=Object.freeze(Object.defineProperty({__proto__:null,__resetEditorPresentationNoticeForTest:Jan,clearEditorPresentationNotice:TMt,editorPresentationNotice:wMt,editorPresentationNoticeVersion:_je,showEditorPresentationNotice:Uan,subscribeEditorPresentationNotice:CMt},Symbol.toStringTag,{value:"Module"})),owt="agent-presented-view";function Han(){const t=Yv();Ye.useSyncExternalStore(CMt,_je,_je);const n=wMt();return Ye.useEffect(()=>{if(!n){xBe(owt);return}s$({id:owt,tone:"info",title:"Agent presented this view.",...n.presented.warnings.length>0?{detail:n.presented.warnings.join(" ")}:{},onDismiss:TMt,actions:[{label:"Copy Link",keeps:!0,run:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(n.presented.url)).catch(()=>{ea.warn("Could not copy the view link to the clipboard.","editor")})}},{label:"Return",primary:!0,run:()=>{Bge(t,n.previousView,{origin:"return"}).catch(s=>{ea.error(`Could not return to the previous editor view: ${s instanceof Error?s.message:String(s)}`,"editor")})}}]})},[n,t]),null}function Gan(t){Ye.useEffect(()=>{const n=stn(),s=()=>dtn(t.playState!=="stopped");s();const c=t.subscribe(s);return()=>{c(),n(),O3t()}},[t])}const nee={console:{id:"console",title:"Console"},lightExplorer:{id:"light-explorer",title:"Light Explorer"}},Kan={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(Kan)];const Xan={info:Go.content.primary,warn:Go.semantic.warning,error:Go.semantic.danger},swt={scene:"#78dce8",physics:"#ff6188",animation:"#a9dc76",network:"#fc9867",audio:"#ab9df2",ai:"#ffd866",input:"#78dce8",core:Go.content.primary},awt={info:R$,warn:WTt,error:NTt};function Yan(){const t=Yv();Ye.useSyncExternalStore(ea.subscribe,ea.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=ea.getEntries(),D=new Map;for(const Ce of F){const Fe=Ce.metadata?.instanceId;if(typeof Fe!="string"||Fe.length===0)continue;const De=Ce.metadata?.instanceName;D.set(Fe,typeof De=="string"&&De.length>0?De:`Instance ${Fe}`)}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 q=()=>{if(!S.current)return;const{scrollTop:Ce,scrollHeight:Fe,clientHeight:De}=S.current;A(Fe-Ce-De<20)},G=Ce=>{g(Fe=>({...Fe,[Ce]:!Fe[Ce]}))},se=Ce=>{const Fe=new Date(Ce);return`${Fe.getHours().toString().padStart(2,"0")}:${Fe.getMinutes().toString().padStart(2,"0")}:${Fe.getSeconds().toString().padStart(2,"0")}`},pe=Ce=>{c0(Y0(t),[Ce]),RVe("viewport.frameSelection")},ue=ea.counts;return $.jsxs(jTr,{className:"volter-console",children:[$.jsxs(n$,{label:"Console filters",compact:!0,children:[$.jsx(dm,{"aria-label":"Clear console",size:"compact",onClick:()=>ea.clear(),title:"Clear console",children:$.jsx(dc,{icon:ATt,size:"xs"})}),$.jsx(Eht,{}),$.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:[$.jsx("option",{value:"all",children:"All instances"}),[...D].map(([Ce,Fe])=>$.jsx("option",{value:Ce,children:Fe},Ce))]}),$.jsx(Eht,{}),["info","warn","error"].map(Ce=>$.jsxs(Ms,{variant:"ghost",size:"compact","aria-label":`Toggle ${Ce} messages`,"aria-pressed":m[Ce],"data-console-level":Ce,onClick:()=>G(Ce),children:[$.jsx(dc,{icon:awt[Ce],size:"xs"}),ue[Ce]]},Ce)),$.jsx(Zm,{placeholder:"Filter...",value:n,onChange:Ce=>s(Ce.target.value),className:"volter-console-filter"})]}),$.jsxs("div",{ref:S,onScroll:q,className:"volter-console-list volter-selectable-text",children:[J.length===0&&$.jsx("div",{className:"volter-console-empty",children:"No messages"}),J.map(Ce=>{const Fe=Ce.metadata?.entityId!=null?String(Ce.metadata.entityId):null,De=(Fe?Y0(t).hierarchy.node(Fe)?.label:null)||Fe,be=typeof Ce.metadata?.instanceId=="string"?Ce.metadata.instanceId:null,X=typeof Ce.metadata?.instanceName=="string"?Ce.metadata.instanceName:be?`Instance ${be}`:null;return $.jsxs("div",{className:"volter-console-row","data-level":Ce.level,style:{color:Xan[Ce.level]},children:[$.jsx("span",{style:{color:Go.content.dim,marginRight:6,flexShrink:0},children:se(Ce.timestamp)}),$.jsx(dc,{icon:awt[Ce.level],style:{fontSize:9,marginTop:4,marginRight:6,flexShrink:0}}),X&&$.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&&$.jsx("span",{style:{background:`${swt[Ce.subsystem]??Go.content.muted}22`,color:swt[Ce.subsystem]??Go.content.muted,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:Ce.subsystem}),$.jsxs("span",{style:{flex:1,wordBreak:"break-word"},children:[Ce.message,Fe&&$.jsxs("span",{onClick:()=>pe(Fe),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 "${De}"`,children:[$.jsx(dc,{icon:aR,style:{fontSize:8}}),De]}),Ce.source&&$.jsxs("span",{style:{color:Go.content.dim,marginLeft:6},children:["[",Ce.source,"]"]})]}),Ce.count>1&&$.jsx("span",{className:"volter-console-count",children:Ce.count})]},Ce.id)})]})]})}const Zan={enabled:"visible",color:"light.color",intensity:"light.intensity",range:"light.distance",shadows:"shadow.cast"};function EMt(t){const n=[],s=t;return W$(t.hierarchy,c=>{c.kind==="light"&&n.push(c)},{extraChildren:c=>s.internalChildren?.(c)}),n}function Exn(t){return EMt(t).length}function kMt(t,n){return t.find(s=>s.path===Zan[n])??null}function qY(t,n,s,c,d){const m=kMt(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 cwt=t=>typeof t=="boolean",Qan=t=>typeof t=="string",lwt=t=>typeof t=="number"&&Number.isFinite(t);function ecn(t){return EMt(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",cwt),color:qY(t,n.id,s,"color",Qan),intensity:qY(t,n.id,s,"intensity",lwt),range:qY(t,n.id,s,"range",lwt),shadows:qY(t,n.id,s,"shadows",cwt)}})}function tcn(t,n,s,c){if(!t.inspector)return 0;let d=0;for(const m of n){let g=null;try{g=kMt(t.inspector.properties(m),s)}catch{continue}!g||g.readonly||(dPt(t,m,g.path,c),d++)}return d}function rcn(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 uwt(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 $.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?$.jsx(dc,{icon:c==="ascending"?C0r:J0r,size:"xs"}):null]})}function hve(){return $.jsx("span",{className:"volter-light-explorer-unavailable",children:"—"})}function ncn({row:t,edit:n}){return t.enabled.supported?$.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)}):$.jsx(hve,{})}function icn({row:t,edit:n}){return!t.color.supported||!t.color.value?$.jsx(hve,{}):$.jsxs("div",{className:"volter-light-explorer-color",children:[$.jsx(a4t,{"aria-label":`Color for ${t.name}`,value:t.color.value,disabled:!t.color.writable,onChange:s=>n("color",s.target.value)}),$.jsx("span",{children:t.color.value})]})}function fwt({row:t,field:n,step:s,edit:c}){const d=t[n];return d.supported?$.jsx(SZ,{value:d.value,disabled:!d.writable,precision:2,step:s,onChange:m=>c(n,m)}):$.jsx(hve,{})}function ocn({row:t,edit:n}){return t.shadows.supported?$.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)}):$.jsx(hve,{})}function scn({row:t,adapter:n,visibleRows:s,selected:c,selectionAnchor:d,edit:m}){const g=(S,k)=>m(t,S,k);return $.jsxs("tr",{"data-selected":c.has(t.id)||void 0,children:[$.jsx("td",{children:$.jsx(ncn,{row:t,edit:g})}),$.jsx("td",{children:$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-name","aria-pressed":c.has(t.id),onClick:S=>{ccn(n,s,t.id,d.current,S.shiftKey,S.metaKey||S.ctrlKey),S.shiftKey||(d.current=t.id)},children:t.name})}),$.jsx("td",{className:"volter-light-explorer-type",children:t.type}),$.jsx("td",{children:$.jsx(icn,{row:t,edit:g})}),$.jsx("td",{children:$.jsx(fwt,{row:t,field:"intensity",step:.1,edit:g})}),$.jsx("td",{children:$.jsx(fwt,{row:t,field:"range",step:.5,edit:g})}),$.jsx("td",{children:$.jsx(ocn,{row:t,edit:g})})]})}function acn(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 ccn(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 lcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(Cee,AD,AD);const{adapter:n}=Cm(t),[,s]=Ye.useReducer(De=>De+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=ecn(n),q=Ye.useMemo(()=>[...new Set(J.map(De=>De.type))].sort((De,be)=>De.localeCompare(be)),[J]),G=c.trim().toLocaleLowerCase(),se=J.filter(De=>(m==="all"||De.type===m)&&(!G||De.name.toLocaleLowerCase().includes(G)||De.type.toLocaleLowerCase().includes(G))).sort((De,be)=>{const X=rcn(uwt(De,S),uwt(be,S));return A==="ascending"?X:-X}),pe=new Set(n.selection?.get()??[]),ue=J.filter(De=>pe.has(De.id)).length,Ce=De=>{De===S?F(be=>be==="ascending"?"descending":"ascending"):(k(De),F("ascending"))},Fe=(De,be,X)=>{const we=acn(De,pe,se);tcn(n,we,be,X)>0&&t.notifyIngestEdit()};return $.jsxs("section",{className:"volter-light-explorer","aria-label":"Light Explorer",children:[$.jsxs("div",{className:"volter-light-explorer-toolbar",children:[$.jsx(Zm,{"aria-label":"Search lights",placeholder:"Search lights…",value:c,onChange:De=>d(De.target.value)}),$.jsxs(Iw,{"aria-label":"Filter lights by type",value:m,onChange:De=>g(De.target.value),children:[$.jsx("option",{value:"all",children:"All types"}),q.map(De=>$.jsx("option",{value:De,children:De},De))]}),$.jsxs("span",{className:"volter-light-explorer-summary",children:[J.length," ",J.length===1?"light":"lights",ue>0?` · ${ue} selected`:""]})]}),J.length===0?$.jsx("div",{className:"volter-light-explorer-empty",children:"The active document does not expose any lights."}):$.jsxs("div",{className:"volter-light-explorer-scroll",children:[$.jsxs("table",{className:"volter-light-explorer-table",children:[$.jsx("thead",{children:$.jsxs("tr",{children:[$.jsx("th",{className:"volter-light-explorer-check-column",scope:"col",children:"On"}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Name",sortKey:"name",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Type",sortKey:"type",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:"Color"}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Intensity",sortKey:"intensity",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Range",sortKey:"range",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Shadows",sortKey:"shadows",activeKey:S,direction:A,onSort:Ce})})]})}),$.jsx("tbody",{children:se.map(De=>$.jsx(scn,{row:De,adapter:n,visibleRows:se,selected:pe,selectionAnchor:D,edit:Fe},De.id))})]}),se.length===0?$.jsx("div",{className:"volter-light-explorer-empty",children:"No lights match the current filters."}):null]})]})}const ucn=Iye();function fcn(){const{error:t,warn:n}=ea.counts;return t>0?{count:t+n,severity:"error"}:n>0?{count:n,severity:"warn"}:null}function dcn(){ucn.ensure(t=>{t(nFe({...nee.console,order:-100,Content:Yan,badge:fcn,subscribeBadge:ea.subscribe,badgeSnapshot:ea.getSnapshot,visibleByDefault:!1,closeable:!0})),t(nFe({...nee.lightExplorer,order:21,Content:lcn,visibleByDefault:!1,closeable:!0}))})}const pcn=5742335;function AMt(t,n,s){return t<<16|n<<8|s}function dwt(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:AMt(c[0],c[1],c[2])}function iee(t){const n=dwt(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,dwt(String(s.fillStyle))):null}function dA(t){return typeof document>"u"?null:t?.closest(`.${DRe}`)??document.querySelector(`.${DRe}`)}function pwt(t){const n=Math.round((t>>16&255)*.42),s=Math.round((t>>8&255)*.42),c=Math.round((t&255)*.42);return AMt(n,s,c)}function Ig(t,n){return t&&typeof getComputedStyle<"u"?getComputedStyle(t).getPropertyValue(n).trim():""}const DMt={"--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=DMt[n];return(s?Ig(t,s):"")||Ig(t,n)}function kxn(t){const n=dA(t),s=oee(n,"--volter-viewport-selection")||Ig(n,"--volter-accent"),c=iee(s||i$.color.accent.default)??pcn,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:pwt(c),...d===null?{}:{active:{visible:d,hidden:pwt(d)}},...m===""&&S===""&&!Number.isFinite(g)?{}:{outline:{style:m==="crisp"?"crisp":"soft",width:Number.isFinite(g)&&g>0?g:null,hidden:S!=="false"}}}}function Axn(t){return PMt(t).background!==null}function Dxn(t){const n=PMt(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 PMt(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 Pxn(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 Ixn(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 Nxn(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 Oxn(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 Rxn(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 IMt(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 _cn(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 mje=null;function mcn(t){return OMt(null,()=>{mje=IMt(),t()})}function _wt(){return mje??=IMt(),mje}let hje=null;function NMt(){const t=dA();return JSON.stringify([gBe.map(n=>Ig(t,`--volter-viewport-word-${n}`)),Ig(t,"--volter-viewport-word-helpers")])}function hcn(t){return OMt(null,()=>{hje=NMt(),t()})}function mwt(){return hje??=NMt(),hje}function Fxn(){const t=Ye.useSyncExternalStore(hcn,mwt,mwt);return Ye.useMemo(()=>{const[n,s]=JSON.parse(t),c={};return gBe.forEach((d,m)=>{n[m]&&(c[d]=n[m])}),{shading:c,helpers:s||void 0}},[t])}function gcn(){const t=Ye.useSyncExternalStore(mcn,_wt,_wt);return Ye.useMemo(()=>_cn(t),[t])}function OMt(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=ycn(s,n);return()=>{c.disconnect(),d()}}const c_e=new Set;let YL=null,bOe="";function ycn(t,n){const s=()=>Object.values(DMt).map(c=>Ig(t,c)).join("|");return c_e.add(n),!YL&&typeof document<"u"&&document.head&&(bOe=s(),YL=new MutationObserver(()=>{const c=s();if(c!==bOe){bOe=c;for(const d of[...c_e])d()}}),YL.observe(document.head,{childList:!0,subtree:!0,characterData:!0})),()=>{c_e.delete(n),c_e.size===0&&YL&&(YL.disconnect(),YL=null)}}function vcn({documentId:t,runtime:n=!1,island:s=!1,assetPath:c,transformControls:d,children:m}){Ye.useSyncExternalStore(bBe,o$,o$);const g=Ye.useSyncExternalStore(U$,eA,eA),S=o2(t)?.HeaderControls;return!m&&!S&&!d||!n&&g.includes("header:hidden")?null:$.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?$.jsx("div",{className:"volter-dock-document-toolbar-own",children:m}):null,d,S?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(S,{documentId:t,...c&&!c.startsWith("online:")?{assetPath:c}:{}})}):null]})}function bcn({documentId:t,children:n}){const s=Ye.useSyncExternalStore(U$,eA,eA);return!n||s.includes("shelf:hidden")?null:$.jsx("div",{className:"volter-dock-document-shelf","data-testid":`document-shelf:${t}`,role:"toolbar","aria-orientation":"vertical","aria-label":"Document tools",children:n})}function Scn(t){return t==="game"||t==="scene"||t==="world"?"world":"resource"}function RMt({viewId:t,descriptor:n,active:s,backdrop:c=!1,chrome:d=!0}){const m=n.Content,g=n.Toolbar,S=n.Shelf,k=Scn(n.kind),A=Yv();Ye.useSyncExternalStore(A.subscribe,A.getShellSnapshot??A.getSnapshot),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(bBe,o$,o$),Ye.useSyncExternalStore(oCt,VOe,VOe);const F=o2(n.id),D=s&&n.kind!=="game"?F?.transformTools?.()??"none":"none",J=F?.TransformTools,q=F?.TransformControls,G=gcn(),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:$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(J,{documentId:n.id})}),Fe=se&&G.bar!=="none",De=!Fe||G.display==="corner"?null:G.display==="bar-start"?"start":"end",be=pe?G.tools==="bar-start"?"start":"end":null,X=Fe&&G.transformControls==="bar"&&D==="gizmo"&&q!==void 0,we=X?be??De??"start":null,Be=bt=>$.jsxs("div",{className:"volter-stage-bar-group","data-edge":bt,children:[De===bt?$.jsx("div",{className:"volter-stage-bar-slot","data-stage-bar-slot":"display"}):null,be===bt?Ce:null,we===bt&&q?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(q,{documentId:n.id})}):null]});return $.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&&$.jsx(vcn,{documentId:n.id,runtime:n.kind==="game",island:c&&k==="world",assetPath:nQr(n.id)?.assetPath,transformControls:D==="gizmo"&&q&&!X?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(q,{documentId:n.id})}):null,children:g?$.jsx(g,{documentId:n.id,active:s}):null}),$.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:[$.jsx(m,{documentId:n.id,...t?{viewId:t}:{},active:s}),Fe?$.jsxs("div",{className:"volter-stage-bar","data-form":G.bar,role:"toolbar","aria-label":"Viewport",children:[Be("start"),Be("end")]}):null,d&&$.jsx(bcn,{documentId:n.id,children:Ce&&!pe||S?$.jsxs($.Fragment,{children:[pe?null:Ce,S?$.jsx(S,{documentId:n.id,active:s}):null]}):null})]})]})}const l_e=new Map;function xcn(t,n){const s=Em();let c=l_e.get(t);(!c||c.project!==s)&&(c={project:s,count:0,created:n},l_e.set(t,c)),c.count++;const d=c;return()=>{l_e.get(t)!==d||--d.count>0||(l_e.delete(t),d.created&&Em()===d.project&&EN(t))}}function wcn({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(i2,X1,X1);const J=Ye.useSyncExternalStore(bBe,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 Gze(),!ue())return;const Fe=new Set(l0().map(be=>be.descriptor.id)),De=Ce.kind==="asset"?sN(Ce.path,Ce.assetKind??"source",{activate:s}):Ce.kind==="workspace"?Fe.has(Ce.id)?Ce.id:null:await Wye(Ce.kind,d,{...Ce,activate:s});if(ue()){if(!De)throw new Error("The requested layout document is unavailable.");se=xcn(De,!Fe.has(De)),g(De)}})().catch(Fe=>{ue()&&k(Fe instanceof Error?Fe.message:String(Fe))}),()=>{G=!0,se?.()}},[d,A]),Ye.useEffect(()=>{!m||!s||X0(m)},[m,s]),Ye.useEffect(()=>{if(!m)return;const G=o2(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 q=m?l0().find(G=>G.descriptor.id===m):void 0;return $.jsx("div",{style:{position:"relative",flex:1,minWidth:0,minHeight:0,height:"100%",overflow:"hidden"},children:S?$.jsx("div",{role:"alert",children:S}):q?$.jsx(RMt,{descriptor:q.descriptor,active:s,chrome:n}):$.jsx("div",{role:"status",children:"Opening document…"})})}function Tcn(){return $.jsxs(kee,{children:[$.jsx(Aee,{}),$.jsx(Pee,{}),$.jsx(Dee,{})]})}function Ccn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot);const n=Ye.useSyncExternalStore(zye,c$,c$),[s,c]=Ye.useState(!1),d=Ye.useSyncExternalStore(OC,nxt,nxt);if(Ye.useEffect(()=>{let g=!1;return Gze().then(()=>{g||c(!0)}),()=>{g=!0}},[]),!s)return $.jsx("div",{role:"status",children:d??"Loading project layout…"});const m=n.Layout??Tcn;return $.jsx(m,{playing:t.playState!=="stopped",paused:t.playState==="paused"})}function $Ve({size:t=64}){return $.jsx("img",{src:lee()?.logo??mR.logo,width:t,height:t,alt:"","aria-hidden":"true","data-testid":"volter-logo",style:{display:"block"}})}const gje="account";function FMt(){return ND({id:gje,title:"Account",kind:"tool-contribution",workspaceRole:"workspace-task",provenance:{origin:"Volter account"},Content:Dcn,closeable:!0,presentation:()=>({kind:"workspace",id:gje})})}kN({id:"workspace",owner:"account-documents",open:(t,n)=>n.id===gje?FMt():null});function Ecn(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 $.jsxs("div",{className:"volter-account-infostrip",children:[$.jsx(dc,{icon:R$,className:"volter-account-infostrip-icon","aria-hidden":"true"}),$.jsx("span",{children:t})]})}function kcn({provider:t,busy:n,run:s,editing:c,removing:d,onEdit:m,onStopEditing:g,onRemoveIntent:S}){const[k,A]=Ye.useState("");return $.jsxs("div",{className:"volter-account-provider","data-configured":t.configured,children:[$.jsx("span",{className:"volter-account-provider-monogram","aria-hidden":"true",children:t.label.slice(0,1)}),$.jsxs("div",{className:"volter-account-provider-main",children:[$.jsxs("div",{className:"volter-account-provider-name",children:[$.jsx("strong",{children:t.label}),t.configured&&$.jsxs($.Fragment,{children:[$.jsx("span",{className:"volter-account-provider-dot","aria-hidden":"true"}),$.jsx("span",{className:"volter-account-provider-key",children:t.maskedKey})]})]}),$.jsx("span",{className:"volter-account-provider-source",children:Ecn(t)}),t.source==="session"&&t.configured&&$.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&&$.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:t.problem}),t.source==="environment"&&$.jsxs("span",{className:"volter-account-provider-source",children:["Restart the editor after changing ",t.environmentVariable,"."]})]}),c?$.jsxs("form",{className:"volter-account-provider-form",onSubmit:F=>{F.preventDefault(),s(async()=>{await uwr(t.provider,k),A(""),g()},`${t.label} credential saved.`)},children:[$.jsxs("label",{className:"volter-field",children:[$.jsxs("span",{className:"volter-field-label",children:[t.label," API key"]}),$.jsx(Zm,{autoComplete:"off",autoFocus:!0,type:"password",value:k,onChange:F=>A(F.target.value)})]}),$.jsxs("div",{className:"volter-account-provider-form-actions",children:[$.jsx(Ms,{type:"submit",variant:"primary",disabled:n||k.trim()==="",children:"Save key"}),$.jsx(Ms,{type:"button",variant:"ghost",disabled:n,onClick:()=>{A(""),g()},children:"Cancel"})]})]}):$.jsxs("div",{className:"volter-account-provider-actions",children:[t.configured&&$.jsx(Ms,{size:"compact",disabled:n,onClick:()=>void s(()=>dwr(t.provider),`${t.label} credential is valid.`),children:"Test"}),t.editable&&$.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&&$.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(t.provider),children:"Remove"}),d&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{size:"compact",variant:"danger",disabled:n,onClick:()=>void s(async()=>{await fwr(t.provider),S(null)},`${t.label} credential removed.`),children:"Confirm remove"}),$.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(null),children:"Cancel"})]})]})]})}function hwt({busy:t,run:n}){const s=XLe(),[c,d]=Ye.useState(null),[m,g]=Ye.useState(null),S=s.providerCredentials.filter(k=>k.configured).length;return $.jsxs("section",{className:"volter-account-card volter-provider-connections",children:[$.jsxs("div",{className:"volter-account-providers-header",children:[$.jsxs("div",{children:[$.jsx("h3",{className:"volter-account-card-title",children:"Provider connections"}),$.jsx("p",{className:"volter-account-card-sub",children:"Keys live in this computer's credential manager — never in project files or the editor UI."})]}),$.jsxs("span",{className:"volter-status-dot","data-state":S>0?"on":"off",children:[S," connected"]})]}),$.jsx("div",{className:"volter-account-provider-list",children:s.providerCredentials.map(k=>$.jsx(kcn,{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 gwt({busy:t,run:n}){const s=XLe(),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(()=>cwr({...c,...D,model:(D.model??c.model).trim()}),"Coding inference settings saved.");return $.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Coding inference"}),$.jsxs("p",{className:"volter-account-card-sub",children:["Coding agents run on the login you already did — ",$.jsx("code",{children:"codex login"}),", Claude's device login, ",$.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."]}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.jsx(TD,{checked:c.enabled,disabled:t,onChange:D=>void F({enabled:D.target.checked})}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Use OpenRouter for coding agents"}),$.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."})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Managed coding model"}),$.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)&&$.jsxs("option",{value:d,children:[d," · custom"]}),$.jsx("option",{value:"z-ai/glm-5.2",children:"GLM-5.2 · managed default"}),$.jsx("option",{value:"moonshotai/kimi-k3",children:"Kimi K3 · higher-cost option"})]})]}),s.preferredRoute==="managed"?$.jsxs("div",{className:"volter-account-card-footer",children:[$.jsx(Ms,{size:"compact",disabled:t,onClick:()=>{A(null),lwr({model:d,promptTokens:1e5,outputTokens:2e4}).then(S).catch(D=>A(D instanceof Error?D.message:String(D)))},children:"Preflight typical coding session"}),g&&$.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&&$.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:k})]}):s.preferredRoute==="byok"?$.jsx(hB,{children:"BYOK coding charges OpenRouter directly and consumes zero Volter credits."}):null,$.jsxs(hB,{children:["Active account route: ",s.preferredRoute,". BYOK requires the OpenRouter connection below; managed uses the Volter balance."]})]})}function Acn({plan:t}){const n=t.status.replace("_"," "),s=t.status==="active"||n.toLowerCase()===t.name.trim().toLowerCase();return $.jsxs("span",{className:"volter-account-plan-chips",children:[$.jsxs("span",{className:"volter-chip","data-tone":"accent",children:[t.name," plan"]}),!s&&$.jsx("span",{className:"volter-chip","data-tone":t.status==="cancelling"?"warn":void 0,children:n}),(t.renewsAt||t.endsAt)&&$.jsxs("span",{className:"volter-chip",children:[t.endsAt?"Access ends":"Renews"," ",new Date(t.endsAt??t.renewsAt).toLocaleDateString()]})]})}function Dcn(){Ye.useSyncExternalStore(Tye,cN,cN);const t=XLe(),[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),[q,G]=Ye.useState(null),[se,pe]=Ye.useState(null),[ue,Ce]=Ye.useState(null),[Fe,De]=Ye.useState(!1);Ye.useEffect(()=>{if(t.authenticated||t.backend!=="live"||t.accountEnvironment==="development-twin"){De(!1);return}ywr().then(zt=>De(zt.device)).catch(()=>De(!1))},[t.authenticated,t.backend]),Ye.useEffect(()=>{if(!ue)return;const zt=()=>{bwr(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=()=>{xwr(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}mwr().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}hwr().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 $.jsx("div",{className:"volter-account","data-testid":"account-document",children:$.jsxs("div",{className:"volter-account-signin-stack",children:[$.jsxs("div",{className:"volter-account-signin-hero",children:[$.jsx("span",{className:"volter-account-signin-mark","aria-hidden":"true",children:$.jsx($Ve,{size:52})}),$.jsx("h1",{className:"volter-account-signin-title",children:"Sign in to Volter Editor"})]}),t.accountEnvironment==="development-twin"?$.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>nwr(n),"Signed in through the local Clerk Twin.")},children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Development email"}),$.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),$.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use Clerk Twin account"}),$.jsx(hB,{children:"Local Clerk and Polar twins — fake identity and checkout, with the real Volter account and credit boundaries."})]}):t.backend==="live"?$.jsxs("section",{className:"volter-account-card volter-account-signin-card",children:[$.jsx(Ms,{variant:"primary",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await vwr();Ce(zt),window.open(zt.authorizationUrl,"_blank","noopener,noreferrer")}),children:ue?"Waiting for browser sign-in…":"Continue in browser"}),Fe&&$.jsx(Ms,{variant:"ghost",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await Swr();pe(zt),window.open(zt.verificationUri,"_blank","noopener,noreferrer")}),children:"Use a device code instead"}),se&&$.jsxs("div",{className:"volter-account-device-code",children:[$.jsx("strong",{children:se.userCode}),$.jsx("span",{children:"Complete authorization in the browser. This editor polls without receiving your password."})]}),$.jsx(hB,{children:"Authorization happens in your browser — this editor never sees your password."})]}):$.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>rwr(n),"Signed in to the zero-charge local account.")},children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Email"}),$.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),$.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use local mock account"}),$.jsx(hB,{children:"Local mock — no payment, network identity, or provider request."})]}),$.jsxs("ul",{className:"volter-account-signin-points",children:[$.jsx("li",{children:"Every paid generation shows its route and estimate first"}),$.jsx("li",{children:"Spend controls and hard limits are on by default"}),$.jsx("li",{children:"Provider keys stay in your system credential manager"})]}),$.jsx(gwt,{busy:D,run:be}),$.jsx(hwt,{busy:D,run:be}),(q||wpe())&&$.jsx("div",{className:"volter-account-status",role:"status",children:q??wpe()})]})});const X=t.credits.included+t.credits.purchased,we=X===0?0:Math.min(100,t.credits.used/X*100),Be=X===0?0:Math.max(0,Math.min(100-we,t.credits.reserved/X*100)),bt=X>0&&t.credits.used>X,It=t.backend==="mock"||t.entitlements.generation,Wt=zt=>owr({...t.spendPolicy,...zt});return $.jsxs("div",{className:"volter-account","data-testid":"account-document",children:[$.jsx("h1",{className:"volter-sr-only",children:"Account"}),$.jsxs("div",{className:"volter-account-stack",children:[$.jsxs("header",{className:"volter-account-identity",children:[$.jsx("span",{className:"volter-account-avatar","aria-hidden":"true",children:t.user.email.slice(0,1)}),$.jsxs("div",{className:"volter-account-identity-main",children:[$.jsxs("div",{className:"volter-account-identity-row",children:[$.jsx("h2",{className:"volter-account-identity-email",children:t.user.email}),$.jsx(Acn,{plan:t.plan})]}),$.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"})]}),$.jsx(Ms,{variant:"ghost",className:"volter-account-signout",disabled:D,onClick:()=>void be(iwr),children:"Sign out"})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsxs("div",{className:"volter-account-card-head",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Credits"}),t.plan.id!=="free"&&t.plan.status==="cancelling"&&$.jsx(Ms,{size:"compact",disabled:D,onClick:()=>void be(()=>aht("resume")),children:"Resume subscription"})]}),!It&&$.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&&$.jsxs("div",{className:"volter-account-card-footer",children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Subscription tier"}),$.jsx(Iw,{value:S,disabled:D||!It,onChange:zt=>k(zt.target.value),children:Object.keys(m.plans).map(zt=>{const ft=m.plans[zt],tr=ft.monthlyPriceUsd;return $.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)})})]}),$.jsxs(Ms,{variant:"primary",size:"compact",disabled:D||!It||S===t.plan.id||S==="free",onClick:()=>void be(async()=>{const zt=await pwr(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]})]}),$.jsxs("div",{className:"volter-account-credit-figure",children:[$.jsx("span",{className:"volter-account-credit-number",children:t.credits.remaining.toLocaleString()}),$.jsx("span",{className:"volter-account-credit-unit",children:"credits remaining"})]}),$.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:[$.jsx("span",{className:"volter-meter-fill",style:{width:`${we}%`}}),Be>0&&$.jsx("span",{className:"volter-meter-fill","data-part":"reserved",style:{left:`${we}%`,width:`${Be}%`}})]}),$.jsxs("p",{className:"volter-account-cycle-line",children:[t.credits.used.toLocaleString()," of ",X.toLocaleString()," used this cycle",t.credits.resetsAt&&$.jsxs($.Fragment,{children:[" · resets ",new Date(t.credits.resetsAt).toLocaleDateString()]}),bt&&$.jsx("span",{className:"volter-account-cycle-over",children:" · over allowance"})]}),$.jsxs("div",{className:"volter-account-legend","data-state":bt?"over":void 0,children:[$.jsxs("span",{className:"volter-account-legend-item","data-part":"included",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.included.toLocaleString()," included"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"used",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.used.toLocaleString()," used"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"reserved",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.reserved.toLocaleString()," reserved"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"purchased",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.purchased.toLocaleString()," purchased"]})]}),t.credits.purchasedExpiresAt&&$.jsxs("p",{className:"volter-account-help volter-account-expiry",children:["Purchased credits expire"," ",new Date(t.credits.purchasedExpiresAt).toLocaleDateString(),"."]}),$.jsxs("div",{className:"volter-account-card-footer",children:[m&&A&&m.creditPacks[A]&&$.jsxs($.Fragment,{children:[$.jsx(Iw,{"aria-label":"Credit pack",value:A,disabled:D||!It,onChange:zt=>F(zt.target.value),children:Object.entries(m.creditPacks).map(([zt,ft])=>$.jsxs("option",{value:zt,children:[ft.name," · ",ft.credits.toLocaleString()," credits"]},zt))}),$.jsx(Ms,{size:"compact",disabled:D||!It,onClick:()=>void be(async()=>{const zt=m.creditPacks[A],ft=await _wr(A);ft.checkoutUrl?window.open(ft.checkoutUrl,"_blank","noopener,noreferrer"):G(`Added ${zt?.credits.toLocaleString()??""} mock credits. No payment occurred.`)}),children:"Buy credits"})]}),$.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(async()=>{const zt=await gwr();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"&&$.jsx(Ms,{size:"compact",variant:"ghost",className:"volter-account-quiet-danger",disabled:D,onClick:()=>void be(()=>aht("cancel")),children:"Cancel at renewal"})]})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Generation routing"}),$.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."}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Preferred route"}),$.jsxs(Iw,{value:t.preferredRoute,onChange:zt=>void be(()=>awr(zt.target.value)),children:[t.accountEnvironment==="test-mock"&&$.jsx("option",{value:"mock",children:"Mock · free and local"}),$.jsx("option",{value:"auto",children:"Automatic · saved key or Volter account"}),$.jsxs("option",{value:"managed",disabled:!t.routes.managed,children:["Managed · Volter credits",t.routes.managed?"":" (unavailable)"]}),$.jsxs("option",{value:"byok",disabled:!t.routes.byok,children:["BYOK · provider dollars",t.routes.byok?"":" (no key found)"]})]})]})]}),$.jsx(gwt,{busy:D,run:be}),$.jsx(hwt,{busy:D,run:be}),(t.alerts?.length??0)>0&&$.jsxs("section",{className:"volter-account-card",children:[$.jsxs("div",{className:"volter-account-card-head",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Account alerts"}),t.alerts?.some(zt=>!zt.readAt)&&$.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(swr),children:"Mark read"})]}),$.jsx("div",{className:"volter-account-usage",children:t.alerts?.map(zt=>$.jsxs("div",{className:"volter-account-usage-row",children:[$.jsxs("span",{children:[$.jsx("strong",{children:zt.readAt?"Notice":"New"}),$.jsx("small",{children:zt.message})]}),$.jsx("span",{children:new Date(zt.createdAt).toLocaleDateString()})]},zt.id))})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Spend controls"}),$.jsxs("p",{className:"volter-account-card-sub",children:["Alerts at ",t.spendPolicy.alertThresholds.join("%, "),"% of the available allowance."]}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.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}))}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Allow paid overage"}),$.jsx("small",{children:"Off by default. Managed requests stop before provider submission."})]})]}),$.jsx("div",{className:"volter-account-limit-field",children:$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Monthly overage hard limit"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.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),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.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}}))}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Automatically reload credits"}),$.jsx("small",{children:"Optional, independently capped, and never enabled by checkout."})]})]}),t.spendPolicy.autoReload?.enabled&&$.jsxs("div",{className:"volter-account-policy-fields",children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Reload below"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.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),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Reload balance to"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.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),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Monthly reload cap"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.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),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})]})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Current-cycle usage"}),c.length===0?$.jsx("p",{className:"volter-account-help",children:"No managed credit usage has been settled in this account."}):$.jsx("div",{className:"volter-account-usage",children:c.map(zt=>$.jsxs("div",{className:"volter-account-usage-row",children:[$.jsxs("span",{children:[zt.kind," · ",zt.provider," · ",zt.operation??"managed operation"]}),$.jsxs("strong",{children:[zt.credits.toLocaleString()," credits"]})]},zt.id))})]}),(q||wpe())&&$.jsx("div",{className:"volter-account-status",role:"status",children:q??wpe()})]})]})}function Pcn(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:()=>MVe(t)}]:[],...A?[{id:"editor.copy",label:"Copy",category:"action",shortcut:Vv("edit.copy"),execute:()=>FVe(t)}]:[],...D?[{id:"editor.paste",label:"Paste",category:"action",shortcut:Vv("edit.paste"),execute:()=>jVe(t)}]:[]];return[{id:"account.open",label:"Account and Provider Connections",category:"action",execute:()=>{FMt()}},{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:()=>_ve(t)},{id:"editor.delete",label:"Delete Selected",category:"action",shortcut:Vv("edit.delete"),execute:()=>mve(t)},{id:"editor.select-all",label:"Select All",category:"action",shortcut:Vv("edit.selectAll"),execute:()=>kRt(t)},{id:"editor.deselect",label:"Deselect All",category:"action",shortcut:Vv("edit.deselectAll")??Vv("edit.exitScopeOrDeselect"),execute:()=>Ize(t,[])},{id:"toggle.console",label:"Toggle Console",category:"action",shortcut:Vv("view.toggleConsole"),execute:()=>{ave()}},{id:"view.focusMode",label:"Toggle Focus Mode",category:"action",shortcut:Vv("view.focusMode"),execute:()=>{MBe()}},...AN().map(q=>({id:`workspace.${q.id}`,label:`Workspace: ${q.title}`,category:"action",execute:()=>{Uk(q.id)&&s2(q.id)}})),{id:"workspace.cycleNext",label:"Next Workspace",category:"action",shortcut:Vv("workspace.cycleNext"),execute:()=>{She(1)}},{id:"workspace.cyclePrevious",label:"Previous Workspace",category:"action",shortcut:Vv("workspace.cyclePrevious"),execute:()=>{She(-1)}},...W4t().map(q=>({id:`keymap.${q.id}`,label:`Keymap: ${q.title}`,category:"action",execute:()=>{BEr(q.id)}})),...OR().map(q=>({id:`view.workspaceStyle.${q.id}`,label:`Workspace Style: ${q.title}`,category:"action",execute:()=>{HBe(q.id)}})),{id:"view.undoHistory",label:"Undo History",category:"action",execute:()=>{LVe()}},{id:"view.lightExplorer",label:"Open Light Explorer",category:"action",execute:()=>bC(nee.lightExplorer.id)},...Object.values(O_).filter(q=>q.id!==O_.open.id).map(q=>({id:q.id,label:`${q.id.replace("project-asset.","").split("-").map(G=>G[0]?.toUpperCase()+G.slice(1)).join(" ")} Project Asset`,category:"asset",...q.shortcut?{shortcut:q.shortcut.replace("Mod",d)}:{},execute:()=>{window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:q.id}}))}})),{id:"view.asset-library",label:"Asset Library",category:"action",execute:()=>{FBe("asset-library")}}]}function Icn(t){return W0e(t).filter(n=>n.id!==kFe).map(n=>({id:`entity:${n.id}`,label:n.name,category:"entity",execute:()=>{Ize(t,[n.id]),RVe("viewport.frameSelection")}}))}function Ncn(){return Q0e().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 Wge(t){const n=t.type;if(typeof n=="string")return n;if(Array.isArray(n))return n.find(s=>s!=="null")}function MMt(t){const n=aN(t);if("default"in n)return structuredClone(n.default);const s=Wge(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]=MMt(g))}return c}return s==="array"?[]:s==="boolean"?!1:s==="number"||s==="integer"?Number(n.minimum??0):""}function yje(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase())}function Ocn({name:t,schema:n,value:s,required:c,onChange:d}){const m=Wge(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 $.jsxs("label",{style:{...VY,gridTemplateColumns:"18px minmax(0, 1fr)"},children:[$.jsx(TD,{id:k,checked:s===!0,onChange:F=>d(F.target.checked)}),$.jsxs("span",{children:[$.jsx("span",{style:ywt,children:yje(t)}),g&&$.jsx("span",{style:FO,children:g})]})]});const A=$.jsxs("span",{style:ywt,children:[yje(t)," ",!c&&$.jsx("span",{style:Fcn,children:"optional"})]});return S?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsxs(Iw,{id:k,value:String(s??""),onChange:F=>d(F.target.value),style:u_e,children:[!c&&$.jsx("option",{value:"",children:"Not set"}),S.map(F=>$.jsx("option",{value:String(F),children:String(F)},String(F)))]}),g&&$.jsx("span",{style:FO,children:g})]}):m==="number"||m==="integer"?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.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:u_e}),g&&$.jsx("span",{style:FO,children:g})]}):m==="array"&&Wge(aN(n.items))==="string"?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.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:u_e}),g&&$.jsx("span",{style:FO,children:g})]}):$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsx(Zm,{id:k,value:typeof s=="string"?s:"",onChange:F=>d(F.target.value||(c?"":void 0)),style:u_e}),g&&$.jsx("span",{style:FO,children:g})]})}function jMt({schema:t,value:n,onChange:s,path:c=""}){const d=aN(t.properties),m=new Set(Array.isArray(t.required)?t.required:[]);return $.jsx("div",{style:{display:"grid",gap:14},children:Object.entries(d).map(([g,S])=>{const k=aN(S),A=Wge(k),F=D=>{const J={...n};D===void 0?delete J[g]:J[g]=D,s(J)};return A==="object"||k.properties?$.jsxs("fieldset",{style:Mcn,children:[$.jsx("legend",{style:jcn,children:yje(g)}),typeof k.description=="string"&&$.jsx("p",{style:{...FO,marginTop:0},children:k.description}),$.jsx(jMt,{schema:k,value:aN(n[g]),onChange:F,path:c?`${c}.${g}`:g})]},g):$.jsx(Ocn,{name:c?`${c}.${g}`:g,schema:k,value:n[g],required:m.has(g),onChange:F},g)})})}function Rcn({schema:t,value:n,onChange:s}){const c=aN(t);return c.properties?$.jsx(jMt,{schema:c,value:n,onChange:s}):$.jsx("div",{style:FO,children:"This schema has no form-compatible fields."})}const VY={display:"grid",gap:5},ywt={color:Zf[1],fontWeight:600,fontSize:"var(--volter-font-sm)"},Fcn={color:Zf[3],fontWeight:400,marginLeft:5},FO={display:"block",color:Zf[2],fontSize:"var(--volter-font-sm)",lineHeight:1.4},u_e={boxSizing:"border-box",width:"100%"},Mcn={margin:0,padding:14,border:"1px solid var(--volter-boundary-default)",borderRadius:"var(--volter-radius-md)"},jcn={padding:"0 6px",color:Zf[1],fontWeight:600},Hge="project-tools",vje="project-tool:";function Lcn(t){return`${vje}${t}`}function gve(){ND({id:Hge,title:"Project Tools",kind:"project-tool",workspaceRole:"workspace-reference",Content:LMt,closeable:!0,presentation:()=>({kind:"workspace",id:Hge}),persist:()=>({catalog:!0})})}function yve(t){const n=N$().tools.find(c=>c.name===t);if(!n)return!1;const s=AC().filter(c=>c.tool?.name===t);return s.length===1?tA(s[0].id):(ND({id:Lcn(t),title:n.summary||n.name,kind:"project-tool",workspaceRole:"workspace-reference",provenance:{sourcePath:n.sourcePath,origin:n.name},Content:LMt,closeable:!0,presentation:()=>({kind:"project-tool",name:t}),persist:()=>({name:t})}),!0)}kN({id:"workspace",owner:"project-tool-documents",open:(t,n)=>n.id!==Hge?null:(gve(),Hge)});kN({id:"project-tool",owner:"project-tool-documents",open:(t,n)=>yve(n.name)?e_():null,settle:async t=>{if(await WZ().catch(()=>{}),!await EC(()=>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?(gve(),!0):typeof n?.name=="string"&&yve(n.name)}});function Bcn(){return[{id:"project-tools:open",label:"Open Project Tools",category:"action",execute:()=>gve()},...N$().tools.map(t=>({id:`project-tool:${t.name}`,label:`Run: ${t.summary||t.name}`,category:"action",execute:()=>void yve(t.name)}))]}function vwt({value:t}){return $.jsx("pre",{style:Vcn,children:JSON.stringify(t,null,2)})}function LMt({documentId:t}){Ye.useSyncExternalStore(rMt,qsn),Ye.useSyncExternalStore(l2,rA);const n=N$(),s=t.startsWith(vje)?t.slice(vje.length):null,c=s?n.tools.find(d=>d.name===s):null;return s?c?$.jsx($cn,{tool:c},c.name):$.jsx("div",{style:bje,children:"This tool is no longer available."}):$.jsxs("div",{style:bje,"data-testid":"project-tools-catalog",children:[$.jsx("h2",{style:BMt,children:"Project Tools"}),$.jsxs("p",{style:{...Sje,margin:"0 0 18px",maxWidth:720,lineHeight:1.5},children:["Explicitly registered in ",$.jsx("code",{children:"package.json#volter.tools"}),". Each tool is an ordinary project function; a registration may pair it with optional editor contributions."]}),$.jsx("div",{style:{display:"grid",gap:8},children:n.tools.map(d=>$.jsxs(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>yve(d.name),"data-testid":`project-command-card:${d.name}`,children:[$.jsxs("span",{style:$Mt,children:[$.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:d.summary}),$.jsx("span",{style:qMt,children:"Open"})]}),$.jsx("code",{style:{color:Zf[2],fontSize:"var(--volter-font-sm)"},children:d.name}),$.jsx("span",{style:qcn,children:$.jsxs("span",{children:[d.host," · ",d.permission.risk," · ",d.sourcePath]})})]},d.name))}),n.tools.length===0&&n.loadErrors.length===0&&$.jsx("div",{style:Sje,children:"No project tools registered."}),n.loadErrors.map(d=>$.jsxs("div",{style:Gge,children:[d.sourcePath,": ",d.message]},`${d.sourcePath}:${d.message}`)),e$e().map(d=>$.jsxs("div",{style:Gge,children:[d.entryPath,": ",d.error]},`${d.entryPath}:${d.error}`))]})}function $cn({tool:t}){const n=AC().filter(se=>se.tool?.name===t.name),s=MMt(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),q=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 zsn(t.name,c,{confirm:!0}))}catch(pe){k({ok:!1,error:{code:"REQUEST_FAILED",message:String(pe)}})}finally{F(!1)}}};return $.jsxs("div",{style:bje,"data-testid":`project-tool:${t.name}`,children:[$.jsx("h2",{style:BMt,children:t.summary}),$.jsx("code",{style:{color:Zf[2]},children:t.name}),$.jsx("p",{style:{color:Zf[2]},children:t.description}),$.jsxs("div",{style:Sje,children:[t.host," · ",t.permission.risk," · ",t.sourcePath]}),n.length>0&&$.jsxs("section",{style:{marginTop:18,maxWidth:760},children:[$.jsx("h3",{style:{margin:"0 0 8px",fontSize:13},children:"Presentations"}),$.jsx("div",{style:{display:"grid",gap:8},children:n.map(se=>$.jsx(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>tA(se.id),children:$.jsxs("span",{style:$Mt,children:[$.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:se.title}),$.jsx("span",{style:qMt,children:"Open"})]})},se.id))})]}),!q&&$.jsx("div",{style:Gge,children:"This runner supports Node-hosted tools. Import the underlying function directly in browser or runtime code."}),$.jsxs("details",{open:n.length===0,style:{marginTop:18,maxWidth:760},children:[$.jsx("summary",{style:{cursor:"pointer",color:Zf[2],fontSize:12},children:n.length>0?"Advanced · invoke native schema":"Input"}),$.jsx("section",{style:{marginTop:12},children:$.jsx(Rcn,{schema:t.inputSchema,value:c,onChange:se=>{d(se),g(JSON.stringify(se,null,2)),J(null)}})}),D&&$.jsx("div",{style:Gge,children:D}),$.jsx(Ms,{variant:"primary",disabled:!q||A||D!==null,"aria-busy":A,onClick:()=>void G(),style:{marginTop:16},children:A?"Running…":"Run tool"}),$.jsxs("details",{style:{marginTop:16},children:[$.jsx("summary",{style:SOe,children:"Advanced JSON"}),$.jsx(yBe,{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:zcn}),$.jsxs("details",{children:[$.jsx("summary",{style:SOe,children:"Input schema"}),$.jsx(vwt,{value:t.inputSchema})]})]})]}),S!==null&&$.jsxs("section",{children:[$.jsx("div",{style:SOe,children:"Result"}),$.jsx(vwt,{value:S})]})]})}const bje={width:"100%",maxWidth:960,margin:"0 auto",padding:24,boxSizing:"border-box",overflow:"auto",pointerEvents:"auto",color:Zf[1],fontSize:"var(--volter-font-base)"},BMt={margin:"0 0 6px",fontSize:20},Sje={color:Zf[2],fontSize:"var(--volter-font-sm)"},SOe={display:"block",margin:"14px 0 6px",color:Zf[1]},$Mt={display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",gap:12},qMt={color:Zf[2],fontSize:"var(--volter-font-sm)",fontWeight:500},qcn={display:"flex",width:"100%",minWidth:0,alignItems:"center",justifyContent:"space-between",gap:12,color:Zf[2],fontSize:"var(--volter-font-sm)"},Gge={marginTop:10,color:C_e,whiteSpace:"pre-wrap"},zcn={width:"100%",boxSizing:"border-box",resize:"vertical"},Vcn={overflow:"auto",padding:10,background:hBe.inset,border:`1px solid ${nhe[1]}`,borderRadius:sQ.sm,color:Zf[2]};function Ucn(t,n,s){const c=Pcn(t,n,s),d=[...Bcn(),...Ncn(),..._kr()],m=Icn(t),g=lCt().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,...Hcn(),...m]}const Jcn=["view","window","debug","tools","help"],Wcn={view:"View",window:"Window",debug:"Debug",tools:"Tools",help:"Help"};function Hcn(){return Jcn.flatMap(t=>uLe(t).map(n=>{const s=typeof n.label=="function"?n.label():n.label,c=`${Wcn[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 Gcn(t){return t.map(n=>`${n.id}\0${n.label}\0${n.menu?.id??""}`).join("")}function Kcn(){const t=Yv(),n=lve(),s=G9t(),c=Ye.useSyncExternalStore(lLe,YB,YB),d=Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),m=Ye.useSyncExternalStore(EDt,Ehe,Ehe),g=Ye.useSyncExternalStore(Uye,fhe,fhe),S=Ye.useMemo(()=>Ucn(t,n,s),[t,n,s,c,d,m,g]),k=Ye.useRef(null);return Ye.useEffect(()=>{const A=Gcn(S);A!==k.current&&(k.current=A,wxt(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,wxt([])},[]),null}let zMt=[];const xje=new Set;function Xcn(t){return xje.add(t),()=>xje.delete(t)}function Ycn(){return zMt}function Zcn(){for(const t of xje)t()}function Qcn(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 eln(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)ea.error(Qcn(s),"assets");zMt=n,Zcn()}async function tln(t){try{const{materializeDeclaredAssetPacks:n}=await fo(async()=>{const{materializeDeclaredAssetPacks:c}=await import("./hosted-asset-materialization-
|
|
1399
|
+
Run ${t.name}?`)){F(!0);try{k(await zsn(t.name,c,{confirm:!0}))}catch(pe){k({ok:!1,error:{code:"REQUEST_FAILED",message:String(pe)}})}finally{F(!1)}}};return $.jsxs("div",{style:bje,"data-testid":`project-tool:${t.name}`,children:[$.jsx("h2",{style:BMt,children:t.summary}),$.jsx("code",{style:{color:Zf[2]},children:t.name}),$.jsx("p",{style:{color:Zf[2]},children:t.description}),$.jsxs("div",{style:Sje,children:[t.host," · ",t.permission.risk," · ",t.sourcePath]}),n.length>0&&$.jsxs("section",{style:{marginTop:18,maxWidth:760},children:[$.jsx("h3",{style:{margin:"0 0 8px",fontSize:13},children:"Presentations"}),$.jsx("div",{style:{display:"grid",gap:8},children:n.map(se=>$.jsx(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>tA(se.id),children:$.jsxs("span",{style:$Mt,children:[$.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:se.title}),$.jsx("span",{style:qMt,children:"Open"})]})},se.id))})]}),!q&&$.jsx("div",{style:Gge,children:"This runner supports Node-hosted tools. Import the underlying function directly in browser or runtime code."}),$.jsxs("details",{open:n.length===0,style:{marginTop:18,maxWidth:760},children:[$.jsx("summary",{style:{cursor:"pointer",color:Zf[2],fontSize:12},children:n.length>0?"Advanced · invoke native schema":"Input"}),$.jsx("section",{style:{marginTop:12},children:$.jsx(Rcn,{schema:t.inputSchema,value:c,onChange:se=>{d(se),g(JSON.stringify(se,null,2)),J(null)}})}),D&&$.jsx("div",{style:Gge,children:D}),$.jsx(Ms,{variant:"primary",disabled:!q||A||D!==null,"aria-busy":A,onClick:()=>void G(),style:{marginTop:16},children:A?"Running…":"Run tool"}),$.jsxs("details",{style:{marginTop:16},children:[$.jsx("summary",{style:SOe,children:"Advanced JSON"}),$.jsx(yBe,{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:zcn}),$.jsxs("details",{children:[$.jsx("summary",{style:SOe,children:"Input schema"}),$.jsx(vwt,{value:t.inputSchema})]})]})]}),S!==null&&$.jsxs("section",{children:[$.jsx("div",{style:SOe,children:"Result"}),$.jsx(vwt,{value:S})]})]})}const bje={width:"100%",maxWidth:960,margin:"0 auto",padding:24,boxSizing:"border-box",overflow:"auto",pointerEvents:"auto",color:Zf[1],fontSize:"var(--volter-font-base)"},BMt={margin:"0 0 6px",fontSize:20},Sje={color:Zf[2],fontSize:"var(--volter-font-sm)"},SOe={display:"block",margin:"14px 0 6px",color:Zf[1]},$Mt={display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",gap:12},qMt={color:Zf[2],fontSize:"var(--volter-font-sm)",fontWeight:500},qcn={display:"flex",width:"100%",minWidth:0,alignItems:"center",justifyContent:"space-between",gap:12,color:Zf[2],fontSize:"var(--volter-font-sm)"},Gge={marginTop:10,color:C_e,whiteSpace:"pre-wrap"},zcn={width:"100%",boxSizing:"border-box",resize:"vertical"},Vcn={overflow:"auto",padding:10,background:hBe.inset,border:`1px solid ${nhe[1]}`,borderRadius:sQ.sm,color:Zf[2]};function Ucn(t,n,s){const c=Pcn(t,n,s),d=[...Bcn(),...Ncn(),..._kr()],m=Icn(t),g=lCt().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,...Hcn(),...m]}const Jcn=["view","window","debug","tools","help"],Wcn={view:"View",window:"Window",debug:"Debug",tools:"Tools",help:"Help"};function Hcn(){return Jcn.flatMap(t=>uLe(t).map(n=>{const s=typeof n.label=="function"?n.label():n.label,c=`${Wcn[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 Gcn(t){return t.map(n=>`${n.id}\0${n.label}\0${n.menu?.id??""}`).join("")}function Kcn(){const t=Yv(),n=lve(),s=G9t(),c=Ye.useSyncExternalStore(lLe,YB,YB),d=Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),m=Ye.useSyncExternalStore(EDt,Ehe,Ehe),g=Ye.useSyncExternalStore(Uye,fhe,fhe),S=Ye.useMemo(()=>Ucn(t,n,s),[t,n,s,c,d,m,g]),k=Ye.useRef(null);return Ye.useEffect(()=>{const A=Gcn(S);A!==k.current&&(k.current=A,wxt(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,wxt([])},[]),null}let zMt=[];const xje=new Set;function Xcn(t){return xje.add(t),()=>xje.delete(t)}function Ycn(){return zMt}function Zcn(){for(const t of xje)t()}function Qcn(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 eln(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)ea.error(Qcn(s),"assets");zMt=n,Zcn()}async function tln(t){try{const{materializeDeclaredAssetPacks:n}=await fo(async()=>{const{materializeDeclaredAssetPacks:c}=await import("./hosted-asset-materialization-r2vKfJGY.js");return{materializeDeclaredAssetPacks:c}},__vite__mapDeps([262,102,3,2,4,1,20,21,22,23])),s=await n(t);eln(s)}catch(n){ea.error(`Retrying asset materialization failed before any entry was attempted: ${n instanceof Error?n.message:String(n)}`,"assets")}}let VMt={kind:"quiet"},UMt=0;const wje=new Set;function rln(){return VMt}function nln(t){VMt=t,UMt+=1;for(const n of wje)n()}function iln(t){return wje.add(t),()=>wje.delete(t)}function bwt(){return UMt}const oln=()=>()=>{},Swt=()=>null;function sln(){const t=Yv(),n=Esn();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Ye.useSyncExternalStore(n?.subscribe??oln,n?.getSnapshot??Swt,n?.getSnapshot??Swt);const s=ERt(t);if(s==="saved")return null;const c=Dze(t),d=s==="failed",m=d?OYr(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 $.jsxs(Ms,{type:"button","data-testid":"save-status","data-save-state":s,variant:"ghost",size:"compact",className:"volter-save-status",onClick:()=>d?cve():void ARt(t),title:S,children:[$.jsx("span",{className:"volter-save-status-dot"}),g.label]})}function aln(){Ye.useSyncExternalStore(ea.subscribe,ea.getSnapshot);const t=ea.counts,n=[{id:"info",icon:R$,label:"message",count:t.info},{id:"warn",icon:WTt,label:"warning",count:t.warn},{id:"error",icon:NTt,label:"error",count:t.error}];return $.jsx("span",{className:"volter-console-status-counts","data-testid":"status-console-counts",children:n.map(s=>$.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:()=>cve(),title:`${s.count} console ${s.label}${s.count===1?"":"s"} — open Console`,children:[$.jsx(dc,{icon:s.icon,size:"xs"}),s.count]},s.id))})}function cln(t){return[...t.map(s=>`"${s.worldId}" (${s.kind} / ${s.identity}) — ${s.message}`),"See the Console for the full trace."].join(`
|
|
1400
1400
|
`)}function lln(){const t=Ye.useSyncExternalStore(CRt,zQ);return t.length===0?null:$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-mount-failure","data-status-tone":"danger",onClick:()=>cve(),title:cln(t),children:t.length===1?"1 world failed to mount":`${t.length} worlds failed to mount`})}function uln(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 fln(){const t=Ye.useSyncExternalStore(Xcn,Ycn),[n,s]=Ye.useState(!1),c=Ye.useCallback(()=>{s(!0),tln(gR()).finally(()=>s(!1))},[]);return t.length===0?null:$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization","data-status-tone":"danger",onClick:()=>cve(),title:uln(t),children:t.length===1?"1 starter asset did not download":`${t.length} starter assets did not download`}),$.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 dln(){const t=UEr(),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 $.jsx("span",{className:"volter-status-copy","data-testid":"status-play-state","data-play-state":s,"data-status-tone":c.tone,children:c.label})}function pln(){Ye.useSyncExternalStore(iln,bwt,bwt);const t=rln();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 $.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:[$.jsx(dc,{icon:n==="error"?Kk.status.error:Kk.status.warning})," ",s]})}function _ln(){Ye.useSyncExternalStore(Jye,ukr);const t=SC().filter(n=>n.section==="project");return t.length===0?null:$.jsx($.Fragment,{children:t.map(n=>$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":`status-project-utility-${n.id}`,onClick:()=>bC(n.id),title:`Open the ${n.title} drawer tab (this project's own face)`,children:n.title},n.id))})}const mln=Iye();function hln(){mln.ensure(t=>{t(Z4({id:"editor-lease",name:"Editor server",align:"left",order:-90,Content:pln})),t(Z4({id:"save-status",name:"Save state",align:"left",order:0,Content:sln})),t(Z4({id:"console-counts",name:"Console errors and warnings",align:"left",order:10,Content:aln})),t(Z4({id:"mount-failure",name:"Mount failure",align:"left",order:5,Content:lln})),t(Z4({id:"asset-materialization",name:"Asset materialization",align:"left",order:15,Content:fln})),t(Z4({id:"play-state",name:"Play state",align:"left",order:20,Content:dln})),t(Z4({id:"project-utilities",name:"Project utilities",align:"left",order:25,Content:_ln}))})}const gln=Ye.lazy(async()=>({default:(await fo(()=>import("./NonThreeAuthoringBootstrap-DiElZf-e.js"),__vite__mapDeps([263,3,2,4,264,89,1,20,21,22,23]))).ProjectAuthoringBootstrap}));function yln(){const t=Yv(),n=H9t(),s=lve();return Ye.use(Csn()),Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Gan(t),Ye.useEffect(()=>hln(),[]),Ye.useEffect(()=>dcn(),[]),Ye.useEffect(()=>asn(n),[n]),Ye.useEffect(()=>Van(),[]),Ye.useEffect(()=>pkr(),[t]),Ye.useEffect(()=>vtn(),[t]),Ye.useEffect(()=>M4r(n),[n]),Ye.useEffect(()=>qan(t,s),[t,s]),Ye.useEffect(()=>gYr(t),[t]),Ye.useEffect(()=>nen(()=>window.dispatchEvent(new CustomEvent("editor:assets-changed")),c=>window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:c}))),[]),$.jsxs($.Fragment,{children:[$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(gln,{store:t})}),$.jsx(Ccn,{}),$.jsx(Han,{}),$.jsx(Kcn,{})]})}const vln=3,bln=1e4,Sln=4e3;function xln(t){return{bootIdentity:null,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:t}}function xwt(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 wln(t,n){return{bootIdentity:t.bootIdentity,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:n}}function JMt(t,n){return!(t.project!==null&&n.project!==null&&t.project!==n.project||t.pid!==null&&n.pid!==null&&t.pid!==n.pid)}function Tln(t){const{consecutiveFailures:n,unbackedFailures:s,failureThreshold:c,darkForMs:d,minDarkWindowMs:m,bootIdentity:g,lastIdentity:S}=t;return g&&S&&!JMt(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 Cln(t,n){return!t?.project||!n.project?!1:n.project===t.project}function Eln(t,n){if(!n.ok)return"none";const s=n.identity;return t&&t.pid!==null&&s.pid===t.pid&&JMt(t,s)?"resume":Cln(t,s)?"reload":t?.project?"none":"offer-reload"}const Kge="volter.editor.orphaned-tab.v1";function kln(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 Aln(t){return JSON.stringify(t)}function Dln(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 Pln=720*60*1e3;function Iln(t,n){const s=n-t.at;return s>=0&&s<=Pln}function qVe(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Nln(t,n=qVe()){try{n?.setItem(Kge,Aln(t))}catch{}}function Oln(t=qVe()){if(!t)return null;try{const n=kln(t.getItem(Kge));return t.removeItem(Kge),n}catch{return null}}function Rln(t=qVe()){try{t?.removeItem(Kge)}catch{}}function Fln(t){return t?t.split(/[\\/]/).filter(Boolean).at(-1)??null:null}async function Mln(){try{const{stopAllLiveSessions:t}=await fo(async()=>{const{stopAllLiveSessions:n}=await Promise.resolve().then(()=>srn);return{stopAllLiveSessions:n}},void 0);t()}catch{}}function jln(){const[t,n]=Ye.useState({kind:"quiet"}),s=Ye.useRef(xln(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,NRt(pe),pe==="taken-over"&&S(),pe==="server-gone"&&Nln({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 Mln()},A=(pe,ue,Ce)=>{switch(Eln(s.current.bootIdentity,pe)){case"resume":{c.current=null,YYr(),Rln(),s.current=xwt(s.current,pe,ue,Ce),n({kind:"quiet"});return}case"reload":if(d.current)return;window.location.reload();return;case"offer-reload":n(Fe=>Fe.kind==="void"&&!Fe.reloadOffered?{...Fe,reloadOffered:!0}:Fe);return;default:return}},F=async()=>{const pe=await OZr(),ue=hZr(),Ce=Date.now();if(m)return;if(c.current!==null){A(pe,ue,Ce);return}s.current=xwt(s.current,pe,ue,Ce);const Fe=Tln({consecutiveFailures:s.current.consecutiveFailures,unbackedFailures:s.current.unbackedFailures,failureThreshold:vln,darkForMs:Ce-s.current.darkSince,minDarkWindowMs:bln,bootIdentity:s.current.bootIdentity,lastIdentity:s.current.lastIdentity});if(Fe.status==="void"&&Fe.reason!==null){await k(Fe.reason);return}n(Fe.status==="degraded"?{kind:"degraded",subject:"busy"}:{kind:"quiet"})};let D=!1;const J=()=>{D||m||(D=!0,F().finally(()=>{D=!1}))},q=()=>{m||(c.current===null&&(s.current=wln(s.current,Date.now())),J())},G=()=>{document.visibilityState==="visible"&&q()};document.addEventListener("visibilitychange",G),window.addEventListener("pageshow",q);let se=null;try{const pe=jD();pe.addEventListener("error",J),pe.addEventListener("open",J),se=pe}catch{}return g=setInterval(J,Sln),()=>{m=!0,S(),document.removeEventListener("visibilitychange",G),window.removeEventListener("pageshow",q),se?.close()}},[]),Ye.useEffect(()=>{nln(t);const m=Fln(s.current.bootIdentity?.project??null),g=()=>{d.current=!0,n({kind:"degraded",subject:"stale"})};if(t.kind==="quiet"){xBe(xOe);return}if(t.kind==="degraded"){s$({id:xOe,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:xOe,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 xOe="editor-lease",Lln="0.5.69",Bln={version:Lln},$ln="0.5.69",qln={version:$ln},WMt=qln.version,zln=Bln.version;function Vln({error:t,onDismiss:n,onRetry:s,startup:c=!1}){const d=t.recovery&&"verbs"in t.recovery?ePt(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]),$.jsxs("div",{role:"alert",className:"volter-error-card volter-shell-rise",children:[$.jsx("div",{className:"volter-error-card-icon","aria-hidden":"true",children:$.jsx(dc,{icon:fee})}),$.jsxs("div",{className:"volter-error-card-body",children:[c?$.jsx("h1",{className:"volter-error-card-title",children:t.recovery?.title??"Couldn’t open this project"}):t.recovery&&$.jsx("div",{className:"volter-error-card-title",children:t.recovery.title}),t.recovery&&$.jsx("p",{className:"volter-error-card-guidance",children:t.recovery.guidance}),$.jsx("div",{className:"volter-error-card-message","data-testid":c?"project-startup-error-details":void 0,children:t.message}),d&&$.jsxs("div",{children:[c&&$.jsx("div",{className:"volter-error-card-recovery-label",children:"RUN FROM THE PROJECT FOLDER"}),$.jsxs("div",{className:"volter-error-card-command",children:[$.jsx("code",{"data-testid":c?"project-startup-recovery-command":"project-screen-recovery-command",children:d}),$.jsxs(Ms,{type:"button",variant:"secondary",size:"compact",onClick:()=>{navigator.clipboard?.writeText(d),g(!0)},children:[$.jsx(dc,{icon:m?tLe:$0r,"aria-hidden":"true"}),m?"Copied":"Copy"]})]})]}),$.jsxs("div",{className:"volter-error-card-actions",children:[s&&$.jsx(Ms,{type:"button",variant:"primary",className:"volter-shell-cta","data-testid":"retry-project-detection",onClick:s,children:"Retry"}),n&&$.jsx(Ms,{type:"button",variant:"ghost",className:"volter-shell-cta","aria-label":"Dismiss error",onClick:n,children:"Dismiss"})]})]})]})}function Tje({error:t,report:n,onRetry:s}){return $.jsx("div",{className:"volter-shell","data-testid":"project-detection-error",children:$.jsxs("div",{className:"volter-shell-container","data-view":"startup-error",children:[$.jsx("header",{className:"volter-shell-header",children:$.jsxs("span",{className:"volter-shell-brand-static",children:[$.jsx("span",{className:"volter-shell-brand-mark","aria-hidden":"true",children:$.jsx($Ve,{size:30})}),$.jsx("span",{className:"volter-shell-wordmark",children:mR.name})]})}),$.jsx(Vln,{error:t,onRetry:s,startup:!0}),n?.projectPath&&$.jsx("div",{className:"volter-shell-notice","data-testid":"project-startup-serving",children:$.jsxs("span",{children:["This editor server is serving"," ",$.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."]})}),$.jsx("footer",{className:"volter-shell-footer",children:$.jsxs("span",{className:"volter-chip","data-variant":"tag",children:["Editor v",WMt," · Engine v",zln]})})]})})}function Uln({wait:t}={}){return $.jsx("main",{role:"status","aria-live":"polite","aria-label":"Opening project","data-testid":"startup-loading-screen",className:"volter-splash",children:$.jsxs("div",{className:"volter-splash-stack",children:[$.jsx("div",{"aria-hidden":"true",className:"volter-splash-logo",children:$.jsx($Ve,{size:72})}),$.jsx("div",{className:"volter-splash-title",children:mR.name}),$.jsx("div",{"aria-hidden":"true",className:"volter-splash-progress"}),t?$.jsxs($.Fragment,{children:[$.jsx("div",{className:"volter-splash-status","data-testid":"startup-wait-status",children:`Asking the server which project it serves — ${t.seconds}s`}),$.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?$.jsxs("div",{className:"volter-splash-note",children:["Last attempt: ",t.detail]}):null]}):$.jsx("div",{className:"volter-splash-status",children:"Opening project…"})]})})}class Jln extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){ea.error(`Editor chrome crashed while the command listener stayed attached: ${n.message}
|
|
1401
|
+
`)}function fln(){const t=Ye.useSyncExternalStore(Xcn,Ycn),[n,s]=Ye.useState(!1),c=Ye.useCallback(()=>{s(!0),tln(gR()).finally(()=>s(!1))},[]);return t.length===0?null:$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization","data-status-tone":"danger",onClick:()=>cve(),title:uln(t),children:t.length===1?"1 starter asset did not download":`${t.length} starter assets did not download`}),$.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 dln(){const t=UEr(),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 $.jsx("span",{className:"volter-status-copy","data-testid":"status-play-state","data-play-state":s,"data-status-tone":c.tone,children:c.label})}function pln(){Ye.useSyncExternalStore(iln,bwt,bwt);const t=rln();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 $.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:[$.jsx(dc,{icon:n==="error"?Kk.status.error:Kk.status.warning})," ",s]})}function _ln(){Ye.useSyncExternalStore(Jye,ukr);const t=SC().filter(n=>n.section==="project");return t.length===0?null:$.jsx($.Fragment,{children:t.map(n=>$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":`status-project-utility-${n.id}`,onClick:()=>bC(n.id),title:`Open the ${n.title} drawer tab (this project's own face)`,children:n.title},n.id))})}const mln=Iye();function hln(){mln.ensure(t=>{t(Z4({id:"editor-lease",name:"Editor server",align:"left",order:-90,Content:pln})),t(Z4({id:"save-status",name:"Save state",align:"left",order:0,Content:sln})),t(Z4({id:"console-counts",name:"Console errors and warnings",align:"left",order:10,Content:aln})),t(Z4({id:"mount-failure",name:"Mount failure",align:"left",order:5,Content:lln})),t(Z4({id:"asset-materialization",name:"Asset materialization",align:"left",order:15,Content:fln})),t(Z4({id:"play-state",name:"Play state",align:"left",order:20,Content:dln})),t(Z4({id:"project-utilities",name:"Project utilities",align:"left",order:25,Content:_ln}))})}const gln=Ye.lazy(async()=>({default:(await fo(()=>import("./NonThreeAuthoringBootstrap-BP-1bVEr.js"),__vite__mapDeps([263,3,2,4,264,89,1,20,21,22,23]))).ProjectAuthoringBootstrap}));function yln(){const t=Yv(),n=H9t(),s=lve();return Ye.use(Csn()),Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Gan(t),Ye.useEffect(()=>hln(),[]),Ye.useEffect(()=>dcn(),[]),Ye.useEffect(()=>asn(n),[n]),Ye.useEffect(()=>Van(),[]),Ye.useEffect(()=>pkr(),[t]),Ye.useEffect(()=>vtn(),[t]),Ye.useEffect(()=>M4r(n),[n]),Ye.useEffect(()=>qan(t,s),[t,s]),Ye.useEffect(()=>gYr(t),[t]),Ye.useEffect(()=>nen(()=>window.dispatchEvent(new CustomEvent("editor:assets-changed")),c=>window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:c}))),[]),$.jsxs($.Fragment,{children:[$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(gln,{store:t})}),$.jsx(Ccn,{}),$.jsx(Han,{}),$.jsx(Kcn,{})]})}const vln=3,bln=1e4,Sln=4e3;function xln(t){return{bootIdentity:null,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:t}}function xwt(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 wln(t,n){return{bootIdentity:t.bootIdentity,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:n}}function JMt(t,n){return!(t.project!==null&&n.project!==null&&t.project!==n.project||t.pid!==null&&n.pid!==null&&t.pid!==n.pid)}function Tln(t){const{consecutiveFailures:n,unbackedFailures:s,failureThreshold:c,darkForMs:d,minDarkWindowMs:m,bootIdentity:g,lastIdentity:S}=t;return g&&S&&!JMt(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 Cln(t,n){return!t?.project||!n.project?!1:n.project===t.project}function Eln(t,n){if(!n.ok)return"none";const s=n.identity;return t&&t.pid!==null&&s.pid===t.pid&&JMt(t,s)?"resume":Cln(t,s)?"reload":t?.project?"none":"offer-reload"}const Kge="volter.editor.orphaned-tab.v1";function kln(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 Aln(t){return JSON.stringify(t)}function Dln(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 Pln=720*60*1e3;function Iln(t,n){const s=n-t.at;return s>=0&&s<=Pln}function qVe(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Nln(t,n=qVe()){try{n?.setItem(Kge,Aln(t))}catch{}}function Oln(t=qVe()){if(!t)return null;try{const n=kln(t.getItem(Kge));return t.removeItem(Kge),n}catch{return null}}function Rln(t=qVe()){try{t?.removeItem(Kge)}catch{}}function Fln(t){return t?t.split(/[\\/]/).filter(Boolean).at(-1)??null:null}async function Mln(){try{const{stopAllLiveSessions:t}=await fo(async()=>{const{stopAllLiveSessions:n}=await Promise.resolve().then(()=>srn);return{stopAllLiveSessions:n}},void 0);t()}catch{}}function jln(){const[t,n]=Ye.useState({kind:"quiet"}),s=Ye.useRef(xln(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,NRt(pe),pe==="taken-over"&&S(),pe==="server-gone"&&Nln({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 Mln()},A=(pe,ue,Ce)=>{switch(Eln(s.current.bootIdentity,pe)){case"resume":{c.current=null,YYr(),Rln(),s.current=xwt(s.current,pe,ue,Ce),n({kind:"quiet"});return}case"reload":if(d.current)return;window.location.reload();return;case"offer-reload":n(Fe=>Fe.kind==="void"&&!Fe.reloadOffered?{...Fe,reloadOffered:!0}:Fe);return;default:return}},F=async()=>{const pe=await OZr(),ue=hZr(),Ce=Date.now();if(m)return;if(c.current!==null){A(pe,ue,Ce);return}s.current=xwt(s.current,pe,ue,Ce);const Fe=Tln({consecutiveFailures:s.current.consecutiveFailures,unbackedFailures:s.current.unbackedFailures,failureThreshold:vln,darkForMs:Ce-s.current.darkSince,minDarkWindowMs:bln,bootIdentity:s.current.bootIdentity,lastIdentity:s.current.lastIdentity});if(Fe.status==="void"&&Fe.reason!==null){await k(Fe.reason);return}n(Fe.status==="degraded"?{kind:"degraded",subject:"busy"}:{kind:"quiet"})};let D=!1;const J=()=>{D||m||(D=!0,F().finally(()=>{D=!1}))},q=()=>{m||(c.current===null&&(s.current=wln(s.current,Date.now())),J())},G=()=>{document.visibilityState==="visible"&&q()};document.addEventListener("visibilitychange",G),window.addEventListener("pageshow",q);let se=null;try{const pe=jD();pe.addEventListener("error",J),pe.addEventListener("open",J),se=pe}catch{}return g=setInterval(J,Sln),()=>{m=!0,S(),document.removeEventListener("visibilitychange",G),window.removeEventListener("pageshow",q),se?.close()}},[]),Ye.useEffect(()=>{nln(t);const m=Fln(s.current.bootIdentity?.project??null),g=()=>{d.current=!0,n({kind:"degraded",subject:"stale"})};if(t.kind==="quiet"){xBe(xOe);return}if(t.kind==="degraded"){s$({id:xOe,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:xOe,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 xOe="editor-lease",Lln="0.5.70",Bln={version:Lln},$ln="0.5.70",qln={version:$ln},WMt=qln.version,zln=Bln.version;function Vln({error:t,onDismiss:n,onRetry:s,startup:c=!1}){const d=t.recovery&&"verbs"in t.recovery?ePt(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]),$.jsxs("div",{role:"alert",className:"volter-error-card volter-shell-rise",children:[$.jsx("div",{className:"volter-error-card-icon","aria-hidden":"true",children:$.jsx(dc,{icon:fee})}),$.jsxs("div",{className:"volter-error-card-body",children:[c?$.jsx("h1",{className:"volter-error-card-title",children:t.recovery?.title??"Couldn’t open this project"}):t.recovery&&$.jsx("div",{className:"volter-error-card-title",children:t.recovery.title}),t.recovery&&$.jsx("p",{className:"volter-error-card-guidance",children:t.recovery.guidance}),$.jsx("div",{className:"volter-error-card-message","data-testid":c?"project-startup-error-details":void 0,children:t.message}),d&&$.jsxs("div",{children:[c&&$.jsx("div",{className:"volter-error-card-recovery-label",children:"RUN FROM THE PROJECT FOLDER"}),$.jsxs("div",{className:"volter-error-card-command",children:[$.jsx("code",{"data-testid":c?"project-startup-recovery-command":"project-screen-recovery-command",children:d}),$.jsxs(Ms,{type:"button",variant:"secondary",size:"compact",onClick:()=>{navigator.clipboard?.writeText(d),g(!0)},children:[$.jsx(dc,{icon:m?tLe:$0r,"aria-hidden":"true"}),m?"Copied":"Copy"]})]})]}),$.jsxs("div",{className:"volter-error-card-actions",children:[s&&$.jsx(Ms,{type:"button",variant:"primary",className:"volter-shell-cta","data-testid":"retry-project-detection",onClick:s,children:"Retry"}),n&&$.jsx(Ms,{type:"button",variant:"ghost",className:"volter-shell-cta","aria-label":"Dismiss error",onClick:n,children:"Dismiss"})]})]})]})}function Tje({error:t,report:n,onRetry:s}){return $.jsx("div",{className:"volter-shell","data-testid":"project-detection-error",children:$.jsxs("div",{className:"volter-shell-container","data-view":"startup-error",children:[$.jsx("header",{className:"volter-shell-header",children:$.jsxs("span",{className:"volter-shell-brand-static",children:[$.jsx("span",{className:"volter-shell-brand-mark","aria-hidden":"true",children:$.jsx($Ve,{size:30})}),$.jsx("span",{className:"volter-shell-wordmark",children:mR.name})]})}),$.jsx(Vln,{error:t,onRetry:s,startup:!0}),n?.projectPath&&$.jsx("div",{className:"volter-shell-notice","data-testid":"project-startup-serving",children:$.jsxs("span",{children:["This editor server is serving"," ",$.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."]})}),$.jsx("footer",{className:"volter-shell-footer",children:$.jsxs("span",{className:"volter-chip","data-variant":"tag",children:["Editor v",WMt," · Engine v",zln]})})]})})}function Uln({wait:t}={}){return $.jsx("main",{role:"status","aria-live":"polite","aria-label":"Opening project","data-testid":"startup-loading-screen",className:"volter-splash",children:$.jsxs("div",{className:"volter-splash-stack",children:[$.jsx("div",{"aria-hidden":"true",className:"volter-splash-logo",children:$.jsx($Ve,{size:72})}),$.jsx("div",{className:"volter-splash-title",children:mR.name}),$.jsx("div",{"aria-hidden":"true",className:"volter-splash-progress"}),t?$.jsxs($.Fragment,{children:[$.jsx("div",{className:"volter-splash-status","data-testid":"startup-wait-status",children:`Asking the server which project it serves — ${t.seconds}s`}),$.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?$.jsxs("div",{className:"volter-splash-note",children:["Last attempt: ",t.detail]}):null]}):$.jsx("div",{className:"volter-splash-status",children:"Opening project…"})]})})}class Jln extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){ea.error(`Editor chrome crashed while the command listener stayed attached: ${n.message}
|
|
1402
1402
|
${s.componentStack??""}`,"editor")}render(){return this.state.error?$.jsx(Tje,{error:{message:`The editor surface crashed: ${this.state.error.message}`},onRetry:()=>this.setState({error:null})}):this.props.children}}function f_e({children:t}){return $.jsxs($.Fragment,{children:[t,$.jsx(jln,{})]})}function Wln(t){const n=t instanceof Error?t.message:String(t);return t instanceof DC?{status:"error",message:n,recovery:t.recovery}:t instanceof y$e?{status:"error",message:n,report:t.report}:{status:"error",message:n}}const Hln=8e3;function Gln(t=Een,n=Hln){return new Promise((s,c)=>{const d=window.setTimeout(()=>{c(new VPt(n))},n);t().then(m=>{window.clearTimeout(d),s(m)},m=>{window.clearTimeout(d),c(m)})})}const Kln=3;function Xln(){const[t,n]=Ye.useState({status:"detecting",waitingSince:null}),[s,c]=Ye.useState(0);Ye.useEffect(()=>wwr(),[]),Ye.useEffect(()=>gZr(),[]),Ye.useEffect(()=>sZr(()=>c(k=>k+1)),[]),Ye.useEffect(()=>{let k=!1,A,F=0;const D=Date.now();n({status:"detecting",waitingSince:null});const J=()=>{Gln().then(q=>{k||n(q?{status:"ready",project:q}:{status:"no-project"})},q=>{if(k)return;F+=1;const G=b4r(q,F);if(G.kind==="terminal"){const pe=Wln(q),ue=pe.recovery&&"verbs"in pe.recovery?ePt(pe.recovery.verbs):null;ea.error(`Startup failed: ${pe.message}${ue?` Run: ${ue}`:""}`,"editor"),n(pe);return}const se=q instanceof Error?q.message:String(q);F===Kln&&ea.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"&&wZr(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=RPt(S)},[S]),t.status==="detecting"?$.jsx(f_e,{children:$.jsx(Uln,{wait:t.waitingSince===null?void 0:{seconds:m,detail:t.lastError}})}):t.status==="no-project"?$.jsx(f_e,{children:$.jsx(Tje,{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"?$.jsx(f_e,{children:$.jsx(Tje,{error:{message:t.message,...t.recovery?{recovery:t.recovery}:{}},report:t.report,onRetry:()=>c(k=>k+1)})}):$.jsx(f_e,{children:$.jsx(ran,{children:$.jsx(Jln,{children:$.jsx(yln,{})})})})}function zVe(t){Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot,t.getShellSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(Pye,lN,lN),Ye.useSyncExternalStore(Qin,Rxt,Rxt),Ye.useSyncExternalStore(U$,mhe,mhe),Ye.useSyncExternalStore(uEr,$ht,$ht),Ye.useSyncExternalStore(lin,Ext,Ext),Ye.useSyncExternalStore(U0e,qQ,qQ),Ye.useSyncExternalStore(E3t,pRe,pRe),Ye.useSyncExternalStore(Qwr,mht,mht),Ye.useSyncExternalStore(UCr,Mht,Mht);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]),ove(t)}let DI=null,HMt=0;const Cje=new Set;function Yln(){return DI}function wwt(){return HMt}function Zln(t){return Cje.add(t),()=>Cje.delete(t)}function Twt(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,HMt+=1;for(const s of Cje)s()}}function Qln(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 GMt=Ye.createContext(null);function eun({actions:t,children:n}){return $.jsx(GMt.Provider,{value:t,children:n})}function tun(){return Ye.useContext(GMt)}function RC(t,n){return{...n,iconName:t}}const run=RC("outliner-object",aR),nun=RC("outliner-light",Qje),iun=RC("outliner-camera",nye),oun=RC("outliner-audio",M0r),wOe=RC("outliner-data",v0r),Cwt=RC("outliner-mesh",aR),sun={three:run,react:eLe,canvas:ZTt,scene:aLe,mesh:Cwt,"skinned-mesh":Cwt,"mesh-data":wOe,"three-source":wOe,"model-asset":wOe,light:nun,camera:iun,audio:oun,"reflection-probe":KTt,group:qOe,object:FTt,component:GB,img:iB,a:x0r,ul:vZ,ol:vZ,li:vZ,button:BOe,sprite:iB,animatedsprite:VTt,nineslicesprite:iB,tilingsprite:iB,text:L0r,graphics:BOe,container:qOe},aun=RC("outliner-render-on",nye),cun=RC("outliner-render-off",g0r),lun=RC("outliner-exclude-on",y0r),uun=RC("outliner-exclude-off",BOe),fun=/^blender-[a-z0-9-]+$/;function KZ(t,n=FTt){const s=sun[t];return s||(fun.test(t)?RC(t,n):n)}const dun=new Set(["mesh-data","blender-material-data","blender-shapekey-data","blender-texture-data","blender-image-data"]),pun=["blender-outliner-data-","blender-light-","blender-lightprobe-"];function KMt(t){return t===void 0?!1:dun.has(t)?!0:pun.some(n=>t.startsWith(n))}function Eje(t){return t.body.kind==="fields"?$.jsx(L9t,{fields:t.body.fields,io:t.body.io}):t.body.render()}function VVe({action:t}){return $.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&&$.jsx(dc,{icon:t.icon})})}function UVe(t){return t.related.find(n=>n.id.startsWith("definition:"))??null}function _un(t){return t.related.filter(n=>!n.id.startsWith("creation-site:")&&!n.id.startsWith("definition:"))}function JVe({link:t}){return $.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:[$.jsx(dc,{icon:V0r}),$.jsx("span",{style:{maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.title})]})}function XMt({subject:t}){const n=_un(t);return n.length===0?null:$.jsx("div",{"data-testid":"inspector-related-subjects",style:{display:"flex",flexWrap:"wrap",gap:4,padding:"6px 8px"},children:n.map(s=>$.jsx(Ms,{variant:"ghost",onClick:s.open,title:s.title,children:s.title},s.id))})}function kje(t){const n=c4t(t.iconName);if(n)return`${n.path}|${n.tonedPath??""}`;const s=t.icon[4];return Array.isArray(s)?s.join("|"):s}function YMt({subject:t,onJump:n}){const s=R9t(t);return Ye.useSyncExternalStore(vBe,she,she),s.length<5||new Set(s.map(c=>kje(c.icon))).size<3?null:$.jsx("div",{className:"volter-inspector-icon-strip",role:"toolbar","aria-label":"Sections","data-testid":"inspector-section-strip",children:s.map(c=>$.jsx(dm,{size:"compact","data-testid":`section-icon-${c.id}`,"aria-label":c.title,title:c.title,onClick:()=>n(c.id),children:$.jsx(dc,{icon:c.icon})},c.id))})}function mun({render:t,glyph:n,subjectKey:s}){const c=ive(s)?t:null;return c?$.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none"},children:c("thumbnail")}):$.jsx(dc,{icon:n})}function WVe({subject:t}){const n=t.identity;if(!n)return null;const s=[n.kindLabel,n.note?.text].filter(Boolean).join(" — ");return n.rename.readOnly?$.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}):$.jsx(NRe,{"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 ZMt({subject:t}){const n=t.identity;if(!n)return $.jsxs("div",{style:{padding:12},children:[$.jsx("div",{style:{fontSize:"var(--volter-font-md)",fontWeight:600},children:t.title}),t.hint&&$.jsx("div",{"data-testid":"inspector-subject-hint",style:{marginTop:4,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:t.hint})]});const s=UVe(t);return $.jsxs("div",{className:"volter-inspector-identity",style:{padding:`${G0[1]} ${G0[4]}`,borderBottom:"1px solid var(--volter-structural-divider)"},children:[$.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[$.jsx(WVe,{subject:t}),n.kindLabel&&$.jsx("span",{"data-testid":"inspector-kind-label",style:{fontSize:"var(--volter-font-base)",color:Go.content.dim,whiteSpace:"nowrap"},children:n.kindLabel}),kBe(t,"identity").map(c=>$.jsx(VVe,{action:c},c.id)),s&&$.jsx(JVe,{link:s})]}),n.document&&$.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:$.jsx("bdi",{children:n.document.path})}),t.alsoSelected?$.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&&$.jsx("div",{"data-testid":"inspector-subject-note",style:{marginTop:6,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:n.note.text})]})}function hun({subject:t}){const n=t.identity;if(!n)return $.jsx(ZMt,{subject:t});const s=UVe(t),c=n.kind?KZ(n.kind,Xge(t)):Xge(t),d=t.title||n.kindLabel||"",m=[n.kindLabel,n.document?.path,n.document?.title].filter(Boolean).join(" — ");return $.jsxs("div",{className:"volter-inspector-identity","data-volter-identity-layout":"properties",children:[$.jsxs("div",{className:"volter-inspector-breadcrumb",children:[$.jsx(dc,{icon:c,tone:"primary"}),$.jsx("span",{className:"volter-inspector-breadcrumb-chain","data-testid":"inspector-document-path",...n.document?{"data-document-path":n.document.path}:{},...m?{title:m}:{},children:$.jsx("bdi",{children:d})}),kBe(t,"identity").map(g=>$.jsx(VVe,{action:g},g.id))]}),$.jsxs("div",{className:"volter-inspector-datablock",children:[$.jsx("span",{className:"volter-inspector-datablock-kind","data-testid":"inspector-kind-label",...n.kindLabel?{title:n.kindLabel}:{},children:$.jsx(dc,{icon:c,tone:"primary"})}),$.jsx(WVe,{subject:t}),s&&$.jsx(JVe,{link:s})]}),t.alsoSelected?$.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&&$.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 gun({section:t}){return $.jsx("div",{"data-testid":t.testId,"data-inspector-section":t.id,children:$.jsx(OCr,{label:t.title,icon:t.icon,description:t.description,collapsible:!0,defaultOpen:t.defaultOpen??!0,children:Eje(t)})})}function yun({subject:t}){const n=Ye.useRef(null),s=c=>{n.current?.querySelector(`[data-inspector-section="${c}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"})};return $.jsxs("div",{style:{pointerEvents:"auto"},children:[$.jsx(ZMt,{subject:t}),$.jsx(YMt,{subject:t,onJump:s}),$.jsx(XMt,{subject:t}),$.jsx("div",{ref:n,children:t.sections.map(c=>$.jsx(Ye.Fragment,{children:$.jsx(gun,{section:c})},c.id))})]})}const d_e=new Map;let Ewt=null;function vun({subject:t}){const n=R9t(t),s=d_e.get(t.id)??Ewt,[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),d_e.size>200&&d_e.clear(),d_e.set(t.id,k),Ewt=k};return $.jsx("div",{className:"volter-inspector-properties-fill",style:{pointerEvents:"auto"},children:$.jsxs("div",{className:"volter-inspector-properties","data-testid":"inspector-properties",children:[$.jsx("div",{className:"volter-inspector-properties-rail",role:"tablist","aria-orientation":"vertical","aria-label":"Sections",children:n.map((k,A)=>$.jsxs(Ye.Fragment,{children:[A>0&&k.railGroup!==n[A-1]?.railGroup?$.jsx("div",{className:"volter-inspector-properties-rail-separator","data-testid":"properties-tab-separator",role:"presentation"}):null,$.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:$.jsx(dc,{icon:k.icon,size:"xl"})})]},k.id))}),$.jsxs("div",{className:"volter-inspector-properties-body",role:"tabpanel",children:[$.jsx(hun,{subject:t}),$.jsx(XMt,{subject:t}),g?$.jsx("div",{"data-testid":g.testId,"data-inspector-section":g.id,children:Eje(g)}):null,t.sections.filter(k=>k.keepMounted&&k.id!==m).map(k=>$.jsx("div",{"data-inspector-section":k.id,"data-inspector-section-hidden":"true",style:{display:"none"},children:Eje(k)},k.id))]})]})})}function Xge(t){const n=t.sections[0]?.icon;return n?kje(n)===kje($Oe)?aR:n:aR}function bun({subject:t,surface:n}){const s=tun(),c=t.sections.find(k=>k.body.kind==="preview"),d=c?.body.kind==="preview"?c.body:null,m=UVe(t),g=n?()=>kVe(n,"column"):null,S=t.identity!==null;return $.jsxs("div",{className:"volter-mini-inspector","data-testid":"inspector-panel","data-volter-inspector-presentation":"card",onPointerDown:()=>CR("inspector"),children:[s&&$.jsx(dm,{size:"compact",className:"volter-mini-inspector-minimize","data-testid":"inspector-minimize","aria-label":"Minimize inspector",title:"Minimize inspector",onClick:s.minimize,children:$.jsx(dc,{icon:d0r})}),$.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:$.jsx(mun,{render:d?d.render:null,glyph:Xge(t),subjectKey:t.id})}),S?$.jsxs("div",{className:"volter-mini-inspector-identity",children:[$.jsx(WVe,{subject:t}),kBe(t,"identity").map(k=>$.jsx(VVe,{action:k},k.id))]}):$.jsx("div",{className:"volter-mini-inspector-identity",children:$.jsx("div",{style:{flex:1,minWidth:0,fontSize:"var(--volter-font-md)",fontWeight:600},children:t.title})}),$.jsx(YMt,{subject:t,onJump:()=>g?.()}),m&&$.jsx("div",{className:"volter-mini-inspector-actions",children:$.jsx(JVe,{link:m})})]})}function Sun({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 $.jsxs("div",{className:"volter-inspector-pill","data-testid":"inspector-pill",children:[$.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:[$.jsx("span",{className:"volter-inspector-pill-thumb","aria-hidden":"true",children:d?d.render("thumbnail"):$.jsx(dc,{icon:Xge(t)})}),$.jsx("span",{className:"volter-inspector-pill-name",children:t.title})]}),s&&$.jsx(dm,{"data-testid":"inspector-fab-clear-selection","aria-label":"Clear selection",title:"Clear selection",onClick:s,children:$.jsx(dc,{icon:rLe})})]})}const p_e=new Map;function kwt({subject:t,presentation:n,surface:s}){const c=t.id,d=Ye.useCallback(m=>{m&&(m.scrollTop=p_e.get(c)??0)},[c]);return n==="card"?$.jsx(bun,{subject:t,...s?{surface:s}:{}}):$.jsx($ye,{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=>{p_e.size>200&&p_e.clear(),p_e.set(c,m.currentTarget.scrollTop)},children:n==="properties"?$.jsx(vun,{subject:t}):$.jsx(yun,{subject:t})})}const xun=250;let QMt=0,UY=null;const bme=new Set;function wun(){QMt++;for(const t of bme)t()}function HVe(t){return bme.add(t),UY===null&&(UY=setInterval(wun,xun)),()=>{bme.delete(t),bme.size===0&&UY!==null&&(clearInterval(UY),UY=null)}}function Tun(){return QMt}function ejt(t){return Ye.useSyncExternalStore(HVe,t,t)}function Cun({presentation:t,surface:n}){const s=pVe(),c=$.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?$.jsxs($.Fragment,{children:[$.jsx("strong",{children:"Nothing to author."})," ",s]}):$.jsxs($.Fragment,{children:[$.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?$.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"2px 4px"},children:$.jsx(dm,{size:"compact","data-testid":"inspector-expand","aria-label":"Expand inspector to side panel",title:"Expand inspector to side panel",onClick:()=>kVe(n,"column"),children:$.jsx(dc,{icon:LTt})})}):null;return t==="card"?$.jsxs("div",{className:"volter-mini-inspector","data-testid":"inspector-panel","data-volter-inspector-presentation":"card",onPointerDown:()=>CR("inspector"),children:[d,c]}):$.jsx($ye,{name:"Inspector (nothing to author)",hideHeader:!0,className:"volter-content-frost","data-testid":"inspector-panel",onPointerDown:()=>CR("inspector"),children:c})}function GVe(){const t=Yv();ejt(()=>qwr());const n=zVe(t),{adapter:s}=Cm(t);return n.available?s.capabilities.inspectorFields?$.jsx(kwt,{subject:n.subject,presentation:n.presentation,surface:n.surface}):n.subject.identity!==null||n.subject.sections.length>0?$.jsx(kwt,{subject:n.subject,presentation:n.presentation,surface:n.surface}):l$()?$.jsx(Cun,{presentation:n.presentation,surface:n.surface}):null:null}function Eun({surface:t}){return $.jsx($ye,{name:"Inspector",hideHeader:!0,"data-testid":"inspector-shown-as-card",children:$.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:[$.jsx("span",{children:"The inspector for this view is shown as a card in the viewport."}),$.jsx(Ms,{variant:"secondary",size:"compact","data-testid":"inspector-dock-here",onClick:()=>kVe(t,"column"),children:"Show it here"})]})})}const tjt=260,rjt=360,see=16,kun=200,njt=220,Aje=54,Aun=52,Dun={maxWidth:tjt,maxHeight:rjt,minSize:kun,margin:see},Pun={right:see,bottom:see},Iun={maxWidth:njt,maxHeight:Aje,minSize:Aje,margin:see};function Nun(t,n,s){return Qln(t,s?Iun:Dun,n)}function Oun(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(U0e,qQ,qQ),Ye.useSyncExternalStore(Zln,wwt,wwt);const n=Yln(),[s,c]=Ye.useState(!1),{subject:d}=zVe(t),m=Ye.useCallback(()=>{oD();const{adapter:S}=Cm(t);c0(S,[])||t.select(null)},[t]),g=n?Nun(n,Pun,s):null;return $.jsx("div",{style:{position:"absolute",...g?{left:g.left,top:g.top,width:g.width,height:g.height}:{right:see,bottom:Aun,width:s?njt:tjt,height:s?Aje:rjt},display:"flex",alignItems:"flex-end",zIndex:PI.sticky,pointerEvents:"none"},children:$.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?$.jsx(Sun,{subject:d,onExpand:()=>c(!1),onClear:m}):$.jsx(eun,{actions:{minimize:()=>c(!0)},children:$.jsx(GVe,{})})})})}let Run=1;const Awt=new WeakMap;function Fun(t){if(!t)return 0;const n=Awt.get(t);if(n!==void 0)return n;const s=Run++;return Awt.set(t,s),s}function KVe(t){const n=Y0(t);return n instanceof hy?n.childAdapters().find(c=>c.kind==="three"&&c.adapter.capabilities.transform)?.worldId??null:null}function Mun(t){const n=Y0(t);if(!(n instanceof hy))return!0;if(!n.childAdapters().some(d=>d.kind==="three"))return!1;const c=KVe(t);return c===null?!0:!oq(c)}const jun="/__editor/collaboration",Dwt=["participants","presence","messages","revisions","audit","team-test"];let KI=null;const Dje=new Set,Pje=new Set;let Pwt=0;function __e(t){KI=t,LAt(t.revision);for(const n of Dje)n(t);if(t.revision>Pwt){Pwt=t.revision;for(const n of Pje)n(t.revision)}}async function Ije(t,n){const s=await fetch(`${jun}${t}`,n);if(s.status!==204&&sf(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 Lun(){return KI}let m_e=null,h_e=0;function ijt(){if(h_e++,!m_e){const n=jD(),s=g=>{try{__e(JSON.parse(g.data))}catch{}};let c=!1;const d=()=>{c||(c=!0,Ije("").then(__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;__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 Dwt)n.addEventListener(`collaboration-${g}`,m);Ije("").then(__e).catch(()=>{}),m_e=()=>{n.removeEventListener("collaboration-snapshot",s);for(const g of Dwt)n.removeEventListener(`collaboration-${g}`,m);n.close()}}let t=!1;return()=>{t||(t=!0,h_e--,h_e<=0&&(h_e=0,m_e?.(),m_e=null))}}function Bun(t){Dje.add(t),KI&&t(KI);const n=ijt();return()=>{Dje.delete(t),n()}}function Mxn(t){Pje.add(t);const n=ijt();let s=!1;return()=>{s||(s=!0,Pje.delete(t),n())}}async function jxn(t){await Ije("/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({participantId:G0e,presence:t})})}const Iwt=500,ojt=()=>{};function $un(t,n){if(n===ojt)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,q=!1,G=0;for(;J!==null&&G++<Iwt;){const se=s.get(J);if(se!==void 0){q=se;break}D.push(J);const pe=n(J);if(pe?.componentRoot!==void 0)break;if(pe?.builtInternal===!0){q=!0;break}if(pe?.authoredEntity===!0)break;J=t.hierarchy.node(J)?.parentId??null}for(const se of D)s.set(se,q);return q},d=A=>n(A)?.componentRoot!==void 0,m=(A,F=0)=>{if(F>Iwt)return[];const D=[];for(const J of A.childIds){if(!c(J)){D.push(J);continue}const q=t.hierarchy.node(J);q&&D.push(...m(q,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((q,G)=>q===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(q=>{const G=S(t.hierarchy.node(q));return G?[{...G,parentId:A}]:[]}):[];return F===void 0?J.length>0?J:void 0:[...F,...J]}}}function qun(t,n,s){for(const c of n)c.more||s(c.node.id)&&t.set(c.node.id,!1);return t}function zun(t,n){for(const s of t.childAdapters())if(t.groupNodeId(s.worldId)===n)return s.worldId;return t.ownerOf(n)}function Vun(t,n,s){if(!(t instanceof hy))return!0;const c=zun(t,s);return c===null?!1:n.every(d=>t.ownerOf(d)===c)}const Uun="This world's structure comes from its own source, which the editor can't rewrite here — reparenting is not wired for it.",Jun="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 Nwt(t){return t.hasStructureWritePath?t.targetIsInternal?Jun:null:Uun}const Wun=400,sjt="volter.projectLocalState";let JB=null,JY=null,ER={},Nje=!1,WB=null;function ajt(){return Em()}function cte(){const t=ajt();if(JB===t)return Promise.resolve();if(JY)return JY.then(()=>cte());const n=n$e(),s=n?Promise.resolve(Hun(n.get(sjt))):RZr();return JY=Promise.all([s,V4t()]).then(([c])=>{ER=c&&typeof c=="object"?{...c}:{},JB=t}).catch(()=>{ER={},JB=t}).finally(()=>{JY=null}),JY}function lte(){return JB===ajt()}function vve(t){if(lte())return ER[t]}function XVe(t=!1){if(WB!==null&&(clearTimeout(WB),WB=null),!Nje)return;Nje=!1;const n=n$e();n?n.store(sjt,JSON.stringify(ER)):FZr(ER,{leaving:t})}function Hun(t){if(!t)return{};try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}}function bve(t,n){const s=()=>{ER={...ER,[t]:n},Nje=!0,WB!==null&&clearTimeout(WB),WB=setTimeout(XVe,Wun)};lte()?s():cte().then(s)}function Gun(){XVe(!0)}Rw(()=>{of()&&cte()});GAr(()=>{JB!==null&&(XVe(),JB=null,of()&&cte())});typeof window<"u"&&window.addEventListener("pagehide",Gun);const cjt="hierarchyExpansion",O$=new Map;let Owt=!1;function YVe(){if(Owt||!lte())return;Owt=!0;const t=vve(cjt)??{};for(const[n,s]of Object.entries(t))O$.set(n,new Map(Object.entries(s)))}function ljt(){const t={};for(const[n,s]of O$)t[n]=Object.fromEntries(s);bve(cjt,t)}function Kun(t,n){return YVe(),O$.get(t)?.get(n)}function Rwt(t,n){YVe();let s=O$.get(t);s||(s=new Map,O$.set(t,s));for(const[c,d]of n)s.set(c,d);ljt()}function Xun(t){YVe(),O$.delete(t),ljt()}let Yge=null;const Oje=new Set;function Yun(){return Yge}function Zun(t){return Oje.add(t),()=>{Oje.delete(t)}}function ujt(t){if(Yge!==t){Yge=t;for(const n of Oje)n()}}function Qun(t){Yge===t&&ujt(null)}const efn=500,Fwt=new Set,aee=new Set;function Lxn(t){return aee.has(t)}function Bxn(t){return aee.delete(t)?!1:(aee.add(t),!0)}function $xn(){return aee}function tfn(t,n=aee){if(typeof t.internalChildren!="function"||n.size===0)return{hierarchy:t.hierarchy,isInternal:()=>!1,revealRootIds:Fwt,internalIds:Fwt};const s=new Map,c=new Map,d=new Set,m=(S,k)=>{if(k>efn||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 rfn(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 Zge=20,nfn="__more__:",fjt=500;function ifn(t,n,s){return t?Math.max(Zge,n.get(s)??Zge):Number.POSITIVE_INFINITY}function ofn(t,n,s,c,d){return{node:{id:`${nfn}${t}`,label:"",kind:"object",parentId:s,childIds:[]},depth:n,pathKey:`${t}/__more__`,hasChildren:!1,hiddenByCollapse:c,more:{parentPathKey:t,hidden:d}}}function Mwt(t,n,s=new Map,c=!1){const d=[],m=new Set,g=(S,k,A,F)=>{if(m.has(S.id)||k>fjt)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 q=F||J,G=Math.min(S.childIds.length,ifn(c,s,A));for(let se=0;se<G;se++){const pe=t.node(S.childIds[se]);pe&&g(pe,k+1,`${A}.${se}`,q)}c&&S.childIds.length>G&&d.push(ofn(A,k+1,S.id,q,S.childIds.length-G))};return t.roots().forEach((S,k)=>{g(S,0,`r${k}`,!1)}),d}function sfn(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=(q,G,se)=>{if(D){if(F.has(q.id)||G>fjt){D=!1;return}F.add(q.id),A.push({node:q,depth:G,pathKey:se,hasChildren:q.childIds.length>0,hiddenByCollapse:!1});for(let pe=0;pe<q.childIds.length;pe+=1){const ue=t.node(q.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 jwt(t){return`${t.pathKey}:${t.node.id}`}function afn(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 cfn(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 TOe{#e=null;#t;computeCount=0;get current(){return this.#t}read(n,s){if(this.#e!==null&&cfn(this.#e,n))return this.#t;const c=s(this.#t);return this.#e=n,this.#t=c,this.computeCount+=1,c}}class lfn{#e=new TOe;#t=new TOe;#i=new TOe;#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 ufn(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 ZVe(t){const n=t.split("."),s=[];for(let c=1;c<n.length;c++)s.push(n.slice(0,c).join("."));return s}function Lwt(t,n){const s=new Set;for(const c of n)for(const d of t.pathKeysByNodeId.get(c)??[])for(const m of ZVe(d)){const g=t.nodeIdByPathKey.get(m);g&&s.add(g)}return s}function ffn(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 dfn(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 pfn=["position","rotation","scale"];function _fn(t){const n=t.role==="component"&&!!t.typeLabel;return{label:t.label,typeSuffix:n?t.typeLabel:null}}const QVe={locked:!1};function mfn(t){let n;for(const s of pfn){const c=t(s);if(!c||c.writable)return QVe;s==="position"&&(n=c.reason)}return n===void 0?{locked:!0}:{locked:!0,reason:n}}class hfn{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?mfn(S=>m(c,S)):QVe;return this.entries.set(c,g),g}}const gfn={draggable:!0,renamable:!0,writable:!0,searchable:!0},yfn={draggable:!1,renamable:!1,writable:!0,searchable:!0},vfn={draggable:!1,renamable:!1,writable:!1,searchable:!1};function eUe(t){return t.internal?vfn:t.structural?yfn:gfn}function bfn(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 Sfn{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?bfn(n.diagnosticsFor(c)):null;return this.entries.set(c,m),m}}const Sme=new Map;function qxn(t){return Sme.set(t.documentId,t),()=>{Sme.get(t.documentId)===t&&Sme.delete(t.documentId)}}function xfn(t){return Sme.get(t)??null}function wfn(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 Tfn(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 Cfn(t,n){const s=[...n];if(s.length===0)return null;if(t instanceof hy)return Tfn(t,s);const c=wfn(t,s);return c?{...c,adapter:t}:null}function Efn(t,n){return!n||n.worldId!==null&&oq(n.worldId)?!1:n.kind!=="three"||n.worldId===null?!0:KVe(t)===n.worldId}const XZ=new Map;let djt=0;const Rje=new Set;function Bwt(){djt++;for(const t of[...Rje])t()}function zxn(t,n){const s={store:n};return XZ.set(t,s),Bwt(),()=>{XZ.get(t)===s&&(XZ.delete(t),Bwt())}}function kfn(t){return t===null?null:XZ.get(t)?.store??null}function Vxn(t){for(const[n,s]of XZ)if(s.store===t)return n;return null}function Uxn(t){return Rje.add(t),()=>{Rje.delete(t)}}function Jxn(){return djt}const rB=new Map;function Wxn(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 pjt={count:0,surface:null,visible:!1};function Afn(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function $wt(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 Dfn(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=$wt(s?.kind);return c.kind!=="unknown"?c:$wt(n.descriptor.kind)}function Pfn(t){return t instanceof hy?t.childAdapters().some(n=>n.kind==="three"):!t.rects&&typeof t.hierarchy.object3D=="function"}function Fje(t,n,s,c){const d=Y0(t),m=Mun(t)&&Pfn(d)?"three":null,g=t.playState,S=t.selectedEntityIds.size;if(S===0)return{documentId:n,chrome:c,subject:s,surface:m,selection:pjt,play:g};const k=Cfn(d,t.selectedEntityIds);return{documentId:n,chrome:c,subject:s,surface:m,selection:{count:S,surface:Afn(k?.kind),visible:Efn(t,k)},play:g}}function Ifn(t,n,s="document"){const c=Dfn(n);if(rB.has(n))return{...Fje(t,n,c,s),surface:"canvas"};const d=xfn(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:pjt,play:t.playState}:Fje(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 Nfn(t){const n=e_();return n!==null?Ifn(t,n):Fje(t,null,{kind:"unknown"},"document")}function Ofn(t){return kfn(e_())??t}function Rfn(t){return t.surface!=="three"?!1:t.selection.count===0?!0:t.selection.surface==="three"&&t.selection.visible}function Hxn(t){return Rfn(t)?iCt(t.documentId)===null?"gizmo":"modal":"none"}function Gxn(t){return t.surface==="three"&&t.selection.count>0&&t.selection.surface==="three"&&t.selection.visible}function _jt(t){return t.chrome==="embedded"||t.subject.kind==="story"||t.subject.kind==="artifact"}function Kxn(t,n){return _jt(t)?!0:t.subject.kind==="data"&&!n}function Xxn(t){return t.chrome==="document"&&_jt(t)}let xme=null;const Qge=new Set;function Yxn(t){xme=t;for(const n of Qge)n();return()=>{if(xme===t){xme=null;for(const n of Qge)n()}}}function eye(){return xme}function Ffn(t){return Qge.add(t),()=>{Qge.delete(t)}}const COe="application/x-editor-asset",EOe="application/x-hierarchy-reorder";function kOe(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:Q3t.treeRow}const hZ="var(--volter-tree-indent)";function wme(t){return`calc(${hZ} * ${t})`}const qwt=5;function Mfn(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 jfn=[],Lfn=6,Bfn=8,$fn=2400;function qfn(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 zfn=300,Vfn=new Map,Ufn={folder:uee,document:oLe,story:VTt,component:GB,instance:qOe,boundary:fee};function Jfn(t){return t.role==="root"?KZ(t.kind,ZTt):t.role==="entity"||t.role==="element"?KZ(t.kind):(t.role?Ufn[t.role]:void 0)??KZ(t.kind)}const mjt=new Set(["folder","root","document","story","boundary"]);function Wfn(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 Hfn(t,n){return n===null?t.hierarchy.roots().map(s=>s.id):t.hierarchy.node(n)?.childIds??[]}function tUe(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 Tme(t,n){return tUe(t,n)!==null}function rUe(t,n){return t instanceof hy&&t.isOrganizationNode(n)}function hjt(t,n){if(!(t instanceof hy))return t;const s=t.ownerOf(n);return t.childAdapters().find(c=>c.worldId===s)?.adapter??t}function zwt(t,n){return n===void 0?t.structure!==void 0:hjt(t,n).structure!==void 0}function Gfn(t,n,s){return Tme(t,n)||rUe(t,n)||s!==void 0&&mjt.has(s)}function Kfn(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=Gfn(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=>KMt(m.get(J)));s.set(g.node.id,g.node.defaultExpanded??(!D&&(A||F<=1||k?.childIds.length===1)))}return s}function Xfn(t,n,s){const c=new Set;for(const d of t)if(!(d.more||!eUe({structural:!1,internal:s(d.node.id)}).searchable)&&d.node.label.toLowerCase().includes(n)){c.add(d.pathKey);for(const m of ZVe(d.pathKey))c.add(m)}return c}function Yfn(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 Zfn({value:t,onChange:n}){const s=Ye.useRef(null);return $.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flex:`0 1 var(${edn}, ${Qfn}px)`,minWidth:tdn},children:[$.jsx(dc,{icon:kTt,"aria-hidden":"true",style:{position:"absolute",left:rdn,pointerEvents:"none",color:"var(--volter-text-1)",fontSize:"var(--volter-icon-lg)"}}),$.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(${idn}, ${ndn}px)`,paddingRight:odn}})]})}const Qfn=64,edn="--volter-hierarchy-search-basis",tdn=56,rdn=2,ndn=21,idn="--volter-hierarchy-search-text-inset",odn=2;function sdn({onCollapseAll:t,onResetExpansion:n,onExpandAll:s}){const[c,d]=Ye.useState(!1),m=Ye.useRef(null);return $.jsxs("div",{ref:m,style:{position:"relative",flexShrink:0},children:[$.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:$.jsx(dc,{icon:JTt,"aria-hidden":"true",style:{fontSize:"var(--volter-icon-xs)"}})}),c&&$.jsxs(fN,{autoFocusFirst:!0,dismissBoundaryRef:m,onDismiss:()=>d(!1),style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:170},children:[$.jsx(Nc,{"data-testid":"hierarchy-collapse-all",onSelect:()=>{t(),d(!1)},children:"Collapse All"}),$.jsx(Nc,{"data-testid":"hierarchy-reset-expansion",onSelect:()=>{n(),d(!1)},children:"Reset Openness"}),$.jsx(Nc,{"data-testid":"hierarchy-expand-all",onSelect:()=>{s(),d(!1)},children:"Expand All"})]})]})}function adn({slot:t,search:n,setSearch:s,adapter:c,createTargetId:d,onCollapseAll:m,onResetExpansion:g,onExpandAll:S}){const k=$.jsxs($.Fragment,{children:[$.jsx(Zfn,{value:n,onChange:s}),$.jsx(sdn,{onCollapseAll:m,onResetExpansion:g,onExpandAll:S}),$.jsx(ldn,{adapter:c,parentId:d})]});return t?MS.createPortal($.jsx("div",{"data-testid":"hierarchy-header-controls",style:{display:"flex",alignItems:"center",gap:G0[1],height:"100%",minWidth:0},children:k}),t):$.jsx(n$,{label:"Hierarchy controls",compact:!0,style:{gap:G0[2]},children:k})}function cdn({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(q3t({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 q=n.hierarchy.node(t.nodeId);if(!q)return null;const G=n.structure?.creatableKinds?.(t.nodeId)??[],pe=hjt(n,t.nodeId).structure,ue=!!pe,Ce=n.inspector?.get(t.nodeId,"name")!==void 0,Fe=n.inspector?.get(t.nodeId,"locked")!==void 0,De=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"),Be=n.inspector?.editability?.(t.nodeId,"visible"),bt=Fe&&(we?.writable??!0),It=be&&(Be?.writable??!0),Wt=[...Ofn(s).selectedEntityIds],zt=Wt.includes(t.nodeId)?Wt:[t.nodeId],ft=V3r(bPt(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=eUe({structural:c,internal:d});if(d&&q.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[q.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:()=>{r0e(n,zt),g()}}),Tt.push({label:"Copy",testId:"hierarchy-context-menu-copy",...pe?.copy&&(n.structure?.canCopy?.(zt)??!0)?{}:{disabledReason:tr},action:()=>{t0e(n,zt),g()}}),Tt.push({label:"Paste",testId:"hierarchy-context-menu-paste",...pe?.paste&&(n.structure?.canPaste?.(q.parentId)??!0)?{}:{disabledReason:Qt},action:()=>{n0e(n,q.parentId),g()}}),Tt.push({label:"Duplicate",testId:"hierarchy-context-menu-duplicate",...ue?{}:{disabledReason:ft},action:()=>{Wt.length>1&&Wt.includes(t.nodeId)?_ve(s):Yye(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:()=>{e0e(n,Wt).ack,g()}}),pe?.ungroup&&pe.canUngroup?.(t.nodeId)&&Tt.push({label:"Ungroup",testId:"hierarchy-context-menu-ungroup",action:()=>{l$e(n,t.nodeId).ack,g()}}),pe?.wrap&&Tt.push({label:"Wrap",testId:"hierarchy-context-menu-wrap",action:()=>{Zye(n,t.nodeId),g()}}),pe?.unwrap&&Tt.push({label:"Unwrap",testId:"hierarchy-context-menu-unwrap",action:()=>{Qye(n,t.nodeId),g()}}),q.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[q.parentId]),g()}}),Tt.push({label:be&&!X?"Show":"Hide",...It?{}:{disabledReason:Be?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"visible",!X),s.notifyIngestEdit(),g()}}),Tt.push({label:De?"Unlock":"Lock",...bt?{}:{disabledReason:we?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"locked",!De),s.notifyIngestEdit(),g()}});for(const Yr of n3r({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)?mve(s):n.structure.remove(t.nodeId),g()}})}return $.jsx(rhe,{children:$.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&&$.jsxs("div",{children:[$.jsxs(Nc,{"data-testid":"hierarchy-context-menu-create",onSelect:()=>D(Yr=>!Yr),style:{justifyContent:"space-between",gap:R_[4]},children:[$.jsx("span",{children:"Create"}),$.jsx(l4t,{direction:"right",tone:"dim"})]}),F&&G.map(Yr=>$.jsx(Nc,{"data-testid":`hierarchy-context-menu-create-${Yr.kind}`,onSelect:()=>{J.current||(J.current=!0,Xye(n,Yr.kind,t.nodeId).ack,g())},style:{paddingLeft:G0[12]},children:Yr.label},Yr.kind))]}),Tt.map(Yr=>Yr.disabledReason!==void 0?$.jsx(Nc,{"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):$.jsx(Nc,{"data-testid":Yr.testId,onSelect:Yr.action,style:Yr.color!==void 0?{color:Yr.color}:void 0,children:Yr.label},Yr.label)),d&&$.jsx("div",{"data-testid":"hierarchy-context-menu-internal-note",style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.content.dim,maxWidth:240,lineHeight:Aht.normal},children:n.transforms?.editability?.(t.nodeId,"position")?.reason??"This rendered part has no authored source identity."}),!ue&&!d&&$.jsxs("div",{style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.semantic.warning,maxWidth:240,lineHeight:Aht.normal},children:[$.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 ldn({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:$.jsxs("div",{ref:d,style:{position:"relative",flexShrink:0},children:[$.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:[$.jsx(dc,{icon:GTt,style:{fontSize:"var(--volter-font-sm)"}})," ",$.jsx(dc,{icon:iLe,style:{fontSize:"var(--volter-font-xs)"}})]}),s&&$.jsx(fN,{style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:130,maxHeight:"min(480px, 70vh)",overflowY:"auto"},children:g.map(k=>$.jsx(Nc,{"data-testid":`hierarchy-add-${k.kind}`,onSelect:()=>{m.current||(m.current=!0,Xye(t,k.kind,n??void 0).ack,c(!1))},children:k.label},k.kind))})]})}function udn({row:t,onReveal:n}){const s=t.more.hidden;return $.jsxs(Ms,{type:"button",variant:"ghost",className:"volter-hierarchy-more","data-testid":"ingest-row-more",onClick:()=>n(t.more.parentPathKey),style:{paddingLeft:wme(t.depth+1)},children:["… ",s," more"]})}function Vwt(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($.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 gjt(t,n){return t.length===n.length&&t.every((s,c)=>s===n[c])}function fdn(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&&gjt(s.childIds,c.childIds)&&s.crossSurfaceId===c.crossSurfaceId&&s.crossSurfaceParentId===c.crossSurfaceParentId&&s.crossSurfaceOrder===c.crossSurfaceOrder&&s.crossSurfaceGroupLabel===c.crossSurfaceGroupLabel}function ddn(t,n){return fdn(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&&gjt(t.remoteSelectionColors,n.remoteSelectionColors)}const pdn=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:q,searchTerm:G,lockCache:se,warningCache:pe,editabilityVersion:ue,adapterVersion:Ce,onToggleOpen:Fe,onStartEditing:De,threeRootId:be,onContextMenu:X,onDragStart:we,onClick:Be,onEnterScope:bt,remoteSelectionColors:It,typeSuffixShown:Wt,instanceRuleShown:zt,restrictionColumns:ft,excludeColumnShown:tr}){const{node:Qt,depth:Tt,hasChildren:vn}=n,Yr=tUe(s,Qt.id),en=Yr!==null,ii=rUe(s,Qt.id),No=en||ii||Qt.role!==void 0&&mjt.has(Qt.role),gn=eUe({structural:No,internal:q}),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),$c=No?void 0:s.inspector?.get(Qt.id,"exclude"),Ni=$c!==void 0,Dc=$c===!0,vc=No?void 0:s.inspector?.editability?.(Qt.id,"exclude"),Tf=Ni&&(vc?.writable??!0),Ip=Yr?oq(Yr.worldId):!1,Au=Yr?lMt(Yr.worldId):!1,dl=Yr?uMt(Yr.worldId):!1,bu=en?!Ip: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=_fn(Qt),Sl=No?0:s.instances?.describe(Qt.id)?.overrides.length??0,Rl=No?QVe:se.summaryFor(s,ue,Qt.id),mi=No?null:pe.badgeFor(s,ue,Qt.id),tu=No?null:eye()?.detail(s,Qt.id,c)??null,Wc=S&&vn?Qt.childIds.slice(0,Lfn).map(Ao=>s.hierarchy.node(Ao)).filter(Ao=>Ao!==null&&KMt(Ao.kind)):[];return $.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":It.length>0?"true":void 0,"data-dragging":A?"true":void 0,"data-row-alt":F%2===1?"true":void 0,"data-internal":q?"true":void 0,"data-muted":q||Dc||!No&&!bu?"true":void 0,draggable:gn.draggable,onDragStart:Ao=>we(Ao,Qt.id),onClick:Ao=>{if(Yr?.role==="world"&&LMe(Yr.worldId),Qt.role==="story"){const ia=s instanceof hy?s.ownerOf(Qt.id):null;ia&&LMe(ia),s.stories?.apply(Qt.id,Qt.id)}Be(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&&De(Qt.id)},onContextMenu:Ao=>{Ao.preventDefault(),X(Ao,Qt.id)},style:{position:"relative",paddingLeft:wme(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"&&$.jsx(Tht,{position:"before",style:{left:wme(Tt)}}),k==="after"&&$.jsx(Tht,{position:"after",style:{left:wme(Tt)}}),Mfn(Tt,D,J).map(Ao=>$.jsx("span",{className:"volter-tree-indent-guide","aria-hidden":"true",style:{left:`calc(${hZ} * ${Ao.column+.5} - 0.5px)`,top:Ao.starts?qwt:0,bottom:Ao.ends?qwt:0}},Ao.column)),vn?$.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(),Fe(n,Ao.altKey)},title:"Expand/collapse (Option/Alt-click applies to the branch)",className:"volter-tree-caret",children:$.jsx(dc,{icon:S?ETt:iLe,"aria-hidden":"true"})}):$.jsx("span",{"data-testid":"ingest-row-caret","aria-hidden":"true",style:{width:hZ,flexShrink:0}}),It.length>0&&$.jsx("span",{className:"volter-tree-remote-selection",role:"img",title:`Selected by ${It.length} collaborator${It.length===1?"":"s"}`,"aria-label":"Selected by a collaborator",children:It.slice(0,3).map(Ao=>$.jsx("span",{style:{background:Ao},"aria-hidden":"true"},Ao))}),Yr?.role==="world"&&Yr.worldId===be&&$.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:$.jsx(dc,{icon:KTt,"aria-hidden":"true"})}),$.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:$.jsx(dc,{icon:Jfn(Qt),"aria-hidden":"true"})}),g?$.jsx(Zm,{autoFocus:!0,defaultValue:Qt.label,onBlur:Ao=>{s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),De("")},onKeyDown:Ao=>{Ao.key==="Enter"&&(s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),De("")),Ao.key==="Escape"&&De("")},onClick:Ao=>Ao.stopPropagation(),"data-variant":"tree-edit",style:{flex:1,minWidth:0}}):$.jsxs("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:[$r.typeSuffix?$.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:[Vwt(Qt.label,G),!Wt&&Sl>0?"*":""]}):$.jsx("span",{"data-testid":"hierarchy-plain-label",style:d?{color:m?Go.content.active:Go.content.selected}:void 0,children:Vwt(Qt.label,G)}),Wc.map(Ao=>$.jsx("span",{className:"volter-tree-datablock","data-active":m?"true":void 0,title:`${Ao.kind}: ${Ao.label}`,children:$.jsx(dc,{icon:KZ(Ao.kind),"aria-hidden":"true"})},Ao.id)),$r.typeSuffix&&Wt&&$.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&&$.jsx("span",{style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.5},children:Qt.secondaryLabel}),tu&&$.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&&$.jsxs("span",{title:`Z order: ${Yr.zOrder}`,style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.6},children:["Z ",Yr.zOrder]}),Yr?.provenance&&$.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&&$.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:$.jsx(dc,{icon:fee,"aria-hidden":"true"})}),Rl.locked&&Rl.reason&&$.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:$.jsx(dc,{icon:Nme,"aria-hidden":"true"})}),ft==="select+viewport"&&Al&&gn.writable&&$.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:$.jsx(dc,{icon:Ku?Nme:jOe,"aria-hidden":"true"})}),tr&&(Ni&&gn.writable?$.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:$.jsx(dc,{icon:Dc?uun:lun,"aria-hidden":"true"})}):$.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),(On||en)&&gn.writable&&$.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?(uan(Yr.worldId),c.notifyIngestEdit()):(s.inspector.set(Qt.id,"visible",!bu),c.notifyIngestEdit())},children:$.jsx(dc,{icon:bu?Zje:sLe,"aria-hidden":"true"})}),ft==="viewport+render"&&(Pn&&gn.writable?$.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:$.jsx(dc,{icon:js?aun:cun,"aria-hidden":"true"})}):$.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),Yr&&$.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(),dan(Yr.worldId),c.notifyIngestEdit()},children:$.jsx(dc,{icon:Y0r,"aria-hidden":"true"})}),Yr&&$.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(),_an(Yr.worldId),c.notifyIngestEdit()},children:$.jsx(dc,{icon:HTt,"aria-hidden":"true"})})]})},ddn);function _dn({store:t,adapter:n}){Ye.useSyncExternalStore(t.subscribe,t.getSnapshot);const s=Ye.useDeferredValue(t.contentVersion);Ye.useSyncExternalStore(O3r,R3r),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(Lun());Ye.useEffect(()=>n.subscribe?.(()=>{k.current=t.getSnapshot(),S()}),[n,t]),Ye.useEffect(()=>Bun(F),[]);const D=Ye.useMemo(()=>{const zi=new Map;for(const Jn of A?.participants??[])if(Jn.participantId!==G0e)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 hfn),q=Ye.useRef(new Sfn),G=t.hierarchyRowFacetVersion,se=KVe(t),[pe,ue]=Ye.useState(""),Ce=Ye.useSyncExternalStore(Zun,Yun,()=>null),[Fe,De]=Ye.useState(null),[be,X]=Ye.useState(null),[we,Be]=Ye.useState(null),[bt,It]=Ye.useState(!1),[Wt,zt]=Ye.useState(null),ft=Ye.useRef(null),[tr,Qt]=Ye.useState(0),Tt=Ye.useRef(null),vn=Ye.useSyncExternalStore(wDt,agt,agt).includes("outliner")?"outliner":void 0,Yr=Ye.useRef(new Map),en=Ye.useRef(new Map),ii=Ye.useRef(new lfn),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=of()?.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]),$c=Pn.at(-1)??null,Ni=i0e(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,Ip=[n,s,g],Au=Tf.structural(Ip,zi=>{const Jn=$un(n,eye()?.marks(n.hierarchy)??ojt),Cs=tfn(Jn),lc=qfn(Cs.hierarchy),Nu=eye()?.structureLog(t)??null,Fl=Nu?.epoch()??0,Yu=zi?s-zi.contentVersion:0,Pe=zi?Fl-zi.objectMapEpoch:0,Et=zi?.adapter===n&&s===t.contentVersion&&Yu>0&&Yu===Pe?Nu?.parentChangesSince(zi.objectMapEpoch)??null:null,In=(zi&&Et?sfn(lc,zi.structuralRows,Et.changedParentIds):null)??Mwt(lc,new Set),pr=rfn(qun(Kfn(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:ufn(In)}}),{marked:dl,internals:bu,hierarchyView:Al,structuralRows:Ku,defaultExpansion:pl}=Au,gs=zi=>en.current.get(zi)??Kun(_a,zi)??pl.get(zi)??!0,Xu=En.current;if(Xu?.adapter!==n||Xu.selection!==fa){for(const Jn of Lwt(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&&(v3r()||t.playState!=="stopped"),Rl=Yfn(Yr.current,Sl?ffn(Au.index,Nt):Vfn),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 ZVe(zi.pathKey))Jn.delete(Cs)}return{scopeRow:zi,effectiveCollapsedPaths:Jn}}),{scopeRow:tu,effectiveCollapsedPaths:Wc}=mi,Ao=ii.current.browse([Au,mi,Ja,Sl,Sl?dfn(Rl):""],()=>{const zi=Mwt(Al,Wc,Rl,Sl),Jn=Ja?Xfn(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(Tme(n,Fl.node.id))return!0;let Yu=Fl.node.parentId;for(;Yu;){const Pe=tUe(n,Yu);if(Pe&&oq(Pe.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||$fn,Id=kOe(Tt.current),{start:Qs,end:Pu}=ia.length>zfn?afn(ia.length,tr,gp,Id,Bfn):{start:0,end:ia.length},Ls=ia.slice(Qs,Pu),Ff=Qs*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);Rwt(_a,Jn),No.current+=1,ji()},[_a,Ku]),Rc={rows:ia,window:{start:Qs,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(()=>(qrn(Rc),()=>Vrn(Rc)),[Rc]);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);Rwt(Cs.projectIdentity,Nu),No.current+=1,ji()},[]),mt=Ye.useCallback(()=>{en.current.clear();for(const zi of Lwt(Au.index,Nt))en.current.set(zi,!0);Xun(_a),No.current+=1,ji()},[_a,fa,Au]),xt=Ye.useCallback(zi=>{const Jn=Yr.current;Jn.set(zi,(Jn.get(zi)??Zge)+Zge),No.current+=1,ji()},[]),xr=Ye.useCallback(zi=>{B3r(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=kOe(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),Pe=Cs.rows.slice(Fl,Yu+1).filter(Et=>!Et.more).map(Et=>Et.node.id);c0(Cs.adapter,Pe)}}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(EOe,JSON.stringify(lc)),zi.dataTransfer.setData("text/plain",Jn)},[]),bi=Ye.useCallback((zi,Jn)=>{De({x:zi.clientX,y:zi.clientY,nodeId:Jn})},[]),ta=Ye.useCallback(zi=>{const Jn=zi.dataTransfer.types.includes(EOe),Cs=zi.dataTransfer.types.includes(COe);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=kOe(Tt.current),Pe=Math.floor(Fl/Yu);if(Pe>=ia.length){Be(null),It(!0),Jn&&Wt&&(ft.current=Nwt({hasStructureWritePath:zwt(n,Wt[0]),targetIsInternal:!1}));return}It(!1);const Et=Pe>=0?ia[Pe]:void 0;if(!Et||Et.more){Be(null);return}const Nr=Nwt({hasStructureWritePath:Jn?zwt(n,Et.node.id):!0,targetIsInternal:bu.isInternal(Et.node.id)});if(Nr!==null){ft.current=Nr,Be(null);return}const In=Fl-Pe*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)||Wfn(Ur,Wt,n))return;if(!Vun(n,Wt,Ur)){Be(null);return}}if(Tme(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"){Be(null);return}Be({nodeId:Et.node.id,zone:pr})},[ia,Wt,n,bu]),ic=Ye.useCallback(()=>{Be(null),It(!1),zt(null),ft.current=null},[]),Ps=Ye.useCallback(zi=>{zi.preventDefault(),zi.stopPropagation();const Jn=we,Cs=bt,lc=ft.current;if(Be(null),It(!1),zt(null),ft.current=null,lc!==null){i0(lc);return}const Nu=n.structure,Fl=zi.dataTransfer.getData(EOe);if(Fl&&Nu){const Pe=JSON.parse(Fl);if(Cs){for(const Li of Pe)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 Pe)QO(n,Li,Nr);return}const In=Et.node.parentId,pr=Hfn(n,In).filter(Li=>!Pe.includes(Li)),Ur=pr.indexOf(Nr),Ei=Jn.zone==="before"?Nr:Ur>=0?pr[Ur+1]??null:null;for(const Li of Pe)(n.hierarchy.node(Li)?.parentId??null)!==In&&QO(n,Li,In??null),c$e(n,Li,Ei);return}const Yu=zi.dataTransfer.getData(COe);if(Yu&&n.assetDrop)try{const Pe=JSON.parse(Yu);if(Pe.kind==="scene")return;const Et={item:Pe.component??{kind:"file",name:Pe.name??Pe.path.split("/").pop()??Pe.path}};if(Cs){n.assetDrop.accepts("",Pe.path,Et)&&RFe(n,"",Pe.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,Pe.path,Et)&&RFe(n,In,Pe.path,Et)}catch{}},[we,bt,ia,n]),Iu=SPt(n)??"Untitled";return $.jsxs($ye,{name:null,hideHeader:!0,onPointerDown:()=>CR("hierarchy"),onDragOver:zi=>{zi.dataTransfer.types.includes(COe)&&(zi.preventDefault(),zi.dataTransfer.dropEffect="copy")},style:{flex:1,minWidth:0,minHeight:0,borderRight:`1px solid ${Go.boundary.default}`},children:[$.jsx("span",{"data-testid":"scene-name","data-scene":Iu,style:{display:"none"},children:Iu}),$.jsx(adn,{slot:Ce,search:pe,setSearch:ue,adapter:n,createTargetId:js,onCollapseAll:()=>Ds(!1),onResetExpansion:mt,onExpandAll:()=>Ds(!0)}),Dc&&$.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:[$.jsx(Ms,{variant:"ghost",size:"compact","data-testid":"selection-scope-root",onClick:()=>Agt(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 $.jsxs("span",{style:{display:"flex",alignItems:"center",minWidth:0},children:[$.jsx("span",{"aria-hidden":"true",style:{color:Go.content.muted},children:"/"}),$.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:()=>Agt(n,zi),style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Cs.label})]},zi)})]}),$.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)||(Be(null),It(!1))},children:[$.jsx("div",{"data-testid":"game-hierarchy-spacer-top",style:{height:Ff}}),Ls.map((zi,Jn)=>zi.more?$.jsx(udn,{row:zi,onReveal:xt},jwt(zi)):$.jsx(pdn,{row:zi,rowIndex:Qs+Jn,prevDepth:ia[Qs+Jn-1]?.depth??-1,nextDepth:ia[Qs+Jn+1]?.depth??-1,adapter:n,store:t,isSelected:Nt.has(zi.node.id),isSelectionActive:$c===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:q.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)??jfn},jwt(zi))),$.jsx("div",{"data-testid":"game-hierarchy-spacer-bottom",style:{height:Hs}}),$.jsx("div",{style:{minHeight:40}}),bt&&$.jsx("div",{style:{position:"absolute",left:0,right:0,top:ia.length*Id,height:2,background:Go.accent.default,pointerEvents:"none",zIndex:PI.overlayLow}})]}),Fe&&(()=>{const zi=Al.node(Fe.nodeId),Jn=zi?Tme(n,zi.id)||rUe(n,zi.id):!1;return $.jsx(cdn,{state:Fe,adapter:n,store:t,isGroupNode:Jn,isInternal:bu.isInternal(Fe.nodeId),onRename:X,onClose:()=>De(null)})})()]})}function yjt(){const t=Yv(),[,n]=Ye.useReducer(c=>c+1,0);Ye.useSyncExternalStore(i2,X1),Ye.useSyncExternalStore(Cee,AD),Ye.useSyncExternalStore(Ffn,eye);const{adapter:s}=Cm(t);return Ye.useEffect(()=>s.subscribe?.(n),[s]),$.jsx(_dn,{store:t,adapter:s},Fun(s))}const Sve="https://volter-learn.pages.dev/",mdn=`${Sve}quick-starts/`,hdn=`${Sve}manual/`,Uwt=`${Sve}reference/`;function vjt(t){const n=/^(\d+)\.(\d+)(?:[.+-]|$)/.exec(t?.trim()??"");if(!n)return null;const s=`${Number(n[1])}.${Number(n[2])}`;return s==="0.0"?null:s}function gdn(t){const n=vjt(t);return n===null?Uwt:`${Uwt}${n}/`}function g_e(t){window.open(t,"_blank","noopener,noreferrer")}function ydn(){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=lve(),S=G9t(),k=Ye.useSyncExternalStore(l2,bFe,bFe);Ye.useSyncExternalStore(dDt,vhe,vhe),Ye.useSyncExternalStore(Uye,fhe,fhe),Ye.useSyncExternalStore(EDt,Ehe,Ehe),Ye.useSyncExternalStore(lLe,YB,YB);const A=X=>{const we=uLe(X);return we.length===0?null:$.jsxs($.Fragment,{children:[$.jsx(H1,{}),we.map(Be=>$.jsx(Nc,{...Be.testId?{"data-testid":Be.testId}:{},disabled:Be.disabled?.({})??!1,onSelect:De(()=>void Be.execute({})),children:typeof Be.label=="function"?Be.label():Be.label},Be.id))]})},F=Ye.useSyncExternalStore(rMt,N$,N$),D=Ye.useSyncExternalStore(mDt,zS,zS),q=Ye.useSyncExternalStore(Rw,of,of)?.config.engine.version??null,G=vjt(q),[se,pe]=Ye.useState(null);ejt(()=>se?Mvr():"");const ue=Ye.useRef(null),Ce=Ye.useRef({}),Fe=X=>Ce.current[X]??={current:null};Ye.useEffect(()=>{if(!se)return;const X=we=>{ue.current?.contains(we.target)||pe(null)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[se]);const De=X=>()=>{pe(null),X()},be={edit:$.jsxs($.Fragment,{children:[$.jsx(Nc,{disabled:S.busy||!S.canUndo,onSelect:De(()=>g.undo()),children:S.undoLabel?`Undo ${S.undoLabel}`:"Undo"}),$.jsx(Nc,{disabled:S.busy||!S.canRedo,onSelect:De(()=>g.redo()),children:S.redoLabel?`Redo ${S.redoLabel}`:"Redo"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(LVe),children:"Undo History…"}),$.jsx(H1,{}),$.jsx(Nc,{disabled:c.length===0||!s?.cut||!(s.canCopy?.(c)??!0),onSelect:De(()=>MVe(t)),children:"Cut"}),$.jsx(Nc,{disabled:c.length===0||!s?.copy||!(s.canCopy?.(c)??!0),onSelect:De(()=>FVe(t)),children:"Copy"}),$.jsx(Nc,{disabled:!s?.paste||!(s.canPaste?.(m)??!0),onSelect:De(()=>jVe(t)),children:"Paste"}),$.jsx(H1,{}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>void _ve(t)),children:"Duplicate"}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>void mve(t)),children:"Delete"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(()=>kRt(t)),children:"Select All"}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>t.select(null)),children:"Deselect All"})]}),view:$.jsxs($.Fragment,{children:[$.jsx(Nc,{onSelect:De(()=>SVe()),children:"Command Palette…"}),$.jsx(Nc,{onSelect:De(async()=>{const X=irn(t);try{await navigator.clipboard.writeText(X),ea.log("Copied a link to the current editor view.","editor")}catch(we){ea.error(`Could not copy the editor view link: ${we instanceof Error?we.message:String(we)}`,"editor")}}),children:"Copy View Link"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(MBe),children:"Toggle Focus Mode"}),A("view")]}),window:$.jsxs($.Fragment,{children:[AN().filter(X=>Uk(X.id)).map(X=>$.jsxs(Nc,{role:"menuitemradio","aria-checked":D===X.id,"data-testid":`workspace-${X.id}`,title:X.description,onSelect:De(()=>s2(X.id)),children:[$.jsx(dc,{icon:Kk.status.success,style:{opacity:D===X.id?1:0}}),"Workspace: ",X.title]},X.id)),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(ave),children:"Console"}),$.jsx(Nc,{onSelect:De(()=>bC(nee.lightExplorer.id)),children:"Light Explorer"}),$.jsx(Nc,{onSelect:De(()=>FBe("asset-library")),children:"Asset Library"}),$.jsx(Nc,{onSelect:De(()=>bC("generations")),children:"Generations"}),A("window")]}),debug:$.jsx($.Fragment,{children:A("debug")}),tools:$.jsxs($.Fragment,{children:[$.jsxs(Nc,{onSelect:De(()=>gve()),children:["Project Tools…",F.tools.length>0?` (${F.tools.length})`:""]}),$.jsx(H1,{}),k.length?k.map(X=>$.jsx(Nc,{onSelect:De(()=>{X.point==="workspace.document"?tA(X.id):bC(`tool:${X.id}`)}),children:X.title},X.id)):$.jsx(Nc,{disabled:!0,children:"No custom project tools"}),A("tools")]}),help:$.jsxs($.Fragment,{children:[$.jsx(Nc,{"data-testid":"help-learn-home",onSelect:De(()=>g_e(Sve)),children:"volter Learn"}),$.jsx(Nc,{"data-testid":"help-quick-starts",onSelect:De(()=>g_e(mdn)),children:"Quick-starts"}),$.jsx(Nc,{"data-testid":"help-manual",onSelect:De(()=>g_e(hdn)),children:"Manual"}),$.jsx(H1,{}),$.jsx(Nc,{"data-testid":"help-reference",title:G?`API/schema reference pinned to this project's engine (v${q})`:"API/schema reference (no engine version pin available)",onSelect:De(()=>g_e(gdn(q))),children:G?`Reference for v${q}`:"Reference"}),A("help")]})};return $.jsx("div",{ref:ue,style:{display:"flex",alignItems:"stretch",marginLeft:"var(--volter-space-2)"},children:["edit","view","window","debug","tools","help"].map(X=>$.jsxs("div",{ref:Fe(X),style:{position:"relative"},children:[$.jsx(dBe,{"data-testid":`app-menu-${X}`,"aria-haspopup":"menu","aria-expanded":se===X,onClick:()=>pe(we=>we===X?null:X),onKeyDown:we=>{we.key==="ArrowDown"&&(we.preventDefault(),pe(X))},onPointerEnter:()=>{se&&pe(X)},style:{textTransform:"capitalize"},children:X}),se===X&&$.jsx(pBe,{anchorRef:Fe(X),dismissBoundaryRef:Fe(X),align:"start",gap:0,clamp:!0,autoFocusFirst:!0,onDismiss:()=>{const we=ue.current?.querySelector(`[data-testid="app-menu-${X}"]`);pe(null),requestAnimationFrame(()=>we?.focus())},style:{minWidth:190},children:be[X]})]},X))})}const vdn=new Map,Jwt=new Set;let bdn=0;function Sdn(t){return vdn.get(t)??xdn}const xdn=[];function wdn(t){return Jwt.add(t),()=>Jwt.delete(t)}function Wwt(){return bdn}function Cme({slot:t}){return Ye.useSyncExternalStore(wdn,Wwt,Wwt),$.jsx($.Fragment,{children:Sdn(t).map(n=>$.jsx(n.Content,{},n.owner))})}const IO=[],Mje=new Set;let bjt=0;function Hwt(){bjt++;for(const t of Mje)t()}function Tdn(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)),Hwt(),()=>{const s=IO.indexOf(t);s<0||(IO.splice(s,1),Hwt())}}async function Cdn(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 Edn(t){return Mje.add(t),()=>{Mje.delete(t)}}function Gwt(){return bjt}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&&sf(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 kdn(){const t=await fetch("/__editor/git/status");return L_(t,"Git status failed")}function Adn(t){return pA("/git/checkpoint",{method:"POST",body:JSON.stringify(t)})}function Ddn(t){return pA("/git/publish",{method:"POST",...t?{signal:t}:{}})}function Kwt(t){return pA("/git/stage",{method:"POST",body:JSON.stringify(t)})}function Pdn(t){return pA("/git/fetch",{method:"POST",...t?{signal:t}:{}})}function Idn(t){return pA("/git/update",{method:"POST",...t?{signal:t}:{}})}function Xwt(t){return pA("/git/rebase",{method:"POST",body:JSON.stringify({action:t})})}function Ndn(){return pA("/git/readiness",{method:"POST"})}function Odn(t){return pA("/git/pull-request",{method:"POST",body:JSON.stringify(t)})}function Rdn(){return pA("/git/pull-request/status")}function Fdn(t){return pA("/git/pull-request/merge",{method:"POST",...t?{signal:t}:{}})}function Mdn(){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,q]=Ye.useState(null),[G,se]=Ye.useState(null),[pe,ue]=Ye.useState(!1),Ce=Ye.useRef(null);Ye.useEffect(()=>{kdn().then(we=>{m(we),S(we.changed.map(Be=>Be.path))}).catch(we=>n(String(we)))},[]);const Fe=we=>{m(we),S(Be=>Be.filter(bt=>we.changed.some(It=>It.path===bt)))},De=async(we,Be,bt)=>{const It=new AbortController;Ce.current=It,q(bt??null),c(!0),n(null),D(null);try{Fe(await we(It.signal)),D(Be)}catch(Wt){n(Wt instanceof Error?Wt.message:String(Wt))}finally{Ce.current===It&&(Ce.current=null),q(null),c(!1)}},be=we=>{se(null),Odn({title:we}).then(Be=>{Fe(Be.status),D(`Pull request: ${Be.url}`)}).catch(Be=>n(String(Be)))},X=()=>{ue(!1);const we=new AbortController;Ce.current=we,q("Merging pull request"),c(!0),Fdn(we.signal).then(Be=>D(`Merged pull request: ${Be.url}`)).catch(Be=>n(String(Be))).finally(()=>{Ce.current===we&&(Ce.current=null),q(null),c(!1)})};return $.jsxs("section",{className:"volter-worktree-version-control",children:[t&&$.jsx("div",{style:{color:Go.semantic.danger,fontSize:YY.sm,marginBottom:5},children:t}),d?.available?$.jsxs("details",{style:{marginTop:G0[4]},children:[$.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}`:""]}),$.jsxs("div",{style:{display:"grid",gap:5,marginTop:5,fontSize:YY.sm},children:[$.jsxs("span",{style:{color:Go.content.dim},children:[d.repositoryId.slice(0,20)," · ",d.worktreeId.slice(0,20)]}),d.changed.map(we=>{const Be=d.hunks.filter(bt=>bt.path===we.path);return $.jsxs("div",{style:{display:"grid",gap:3},children:[$.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[$.jsx(TD,{"aria-label":`Include ${we.path} in checkpoint`,checked:g.includes(we.path),onChange:bt=>S(It=>bt.target.checked?[...It,we.path]:It.filter(Wt=>Wt!==we.path))}),$.jsxs("code",{style:{minWidth:0,flex:1},children:[we.index,we.worktree," ",we.path]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Kwt({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"})]}),Be.map(bt=>$.jsxs("div",{style:{display:"flex",gap:5,paddingLeft:22,alignItems:"center"},children:[$.jsxs("code",{style:{minWidth:0,flex:1,color:Go.content.dim},children:[bt.header," · +",bt.additions,"/-",bt.deletions]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Kwt({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&&$.jsxs("div",{role:"alert",style:{display:"grid",gap:5,color:Go.semantic.warning},children:[$.jsxs("span",{children:["Rebase paused",d.conflicts.length>0?` · conflicts: ${d.conflicts.join(", ")}`:""]}),$.jsxs("span",{style:{display:"flex",gap:5},children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.conflicts.length>0,onClick:()=>void De(()=>Xwt("continue"),"Rebase continued."),children:"Continue rebase"}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Xwt("abort"),"Rebase aborted."),children:"Abort rebase"})]})]}),d.dirty&&$.jsxs("div",{style:{display:"flex",gap:5},children:[$.jsx(Zm,{"aria-label":"Git checkpoint message",placeholder:"Checkpoint message",value:k,onChange:we=>A(we.target.value),style:{minWidth:0,flex:1}}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!k.trim()||g.length===0,onClick:()=>void De(()=>Adn({paths:g,message:k}),"Selected paths checkpointed with verified account attribution.").then(()=>A("")),children:"Checkpoint"})]}),$.jsxs("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!d.remoteUrl,onClick:()=>void De(Pdn,"Remote refs fetched and pruned.","Fetching"),children:"Fetch"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.remoteUrl,onClick:()=>void De(Ddn,"Branch published.","Publishing"),children:"Publish"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.baseRef,onClick:()=>void De(Idn,"Branch rebased onto its base.","Fetching and rebasing"),children:"Update from base"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>void Ndn().then(we=>{Fe(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&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>se(k||d.branch||"Volter Editor changes"),children:"Create PR"}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void Rdn().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"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||d.rebaseInProgress,onClick:()=>ue(!0),children:"Merge PR…"})]})]}),J&&$.jsxs("div",{role:"status",style:{display:"flex",gap:5,alignItems:"center"},children:[$.jsxs("span",{children:[J,"…"]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",onClick:()=>Ce.current?.abort(),children:"Cancel"})]}),d.history.length>0&&$.jsxs("details",{children:[$.jsx("summary",{style:{cursor:"pointer",color:Go.content.dim},children:"Recent history"}),$.jsx("div",{style:{display:"grid",gap:3,paddingTop:G0[2]},children:d.history.map(we=>$.jsxs("span",{title:`${we.author} · ${we.authoredAt}`,children:[$.jsx("code",{children:we.shortSha})," · ",we.subject]},we.sha))})]}),F&&$.jsx("span",{style:{color:Go.semantic.success},children:F})]})]}):$.jsx("span",{style:{color:Go.content.dim,fontSize:YY.sm},children:"Loading version control…"}),G!==null&&$.jsxs(xRe,{labelledBy:"volter-pull-request-title-heading",onDismiss:()=>se(null),children:[$.jsx(wRe,{titleId:"volter-pull-request-title-heading",title:"Create pull request",description:`Opens a pull request for ${d?.branch??"this branch"} on its remote.`}),$.jsx(L3t,{children:$.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()))}})}),$.jsxs(TRe,{children:[$.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>se(null),children:"Cancel"}),$.jsx(Ms,{type:"button",variant:"primary",disabled:!G.trim(),onClick:()=>be(G.trim()),children:"Create pull request"})]})]}),pe&&$.jsxs(xRe,{labelledBy:"volter-merge-pr-heading",onDismiss:()=>ue(!1),children:[$.jsx(wRe,{titleId:"volter-merge-pr-heading",title:"Merge pull request",description:`Merging the pull request for ${d?.branch??"this branch"} changes the remote repository.`}),$.jsxs(TRe,{children:[$.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>ue(!1),children:"Cancel"}),$.jsx(Ms,{type:"button",variant:"primary",onClick:X,children:"Merge pull request"})]})]})]})}Tdn({owner:"editor-core:supercode",harnesses:async()=>$Zr()});const jdn={worktrees:[],branches:[]};function Ldn(t){return`agent/${t.toLocaleLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,42)||"task"}`}function Bdn({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([]),[q,G]=Ye.useState(""),[se,pe]=Ye.useState(!1),ue=Ye.useSyncExternalStore(Edn,Gwt,Gwt);return Ye.useEffect(()=>{let Ce=!0;return Cdn(A).then(Fe=>{Ce&&(J(Fe),G(De=>Fe.some(be=>be.id===De)?De:Fe[0]?.id??""))}),()=>{Ce=!1}},[A,ue]),$.jsxs("div",{className:"volter-worktree-delegate",role:"group","aria-label":"Delegate task",children:[$.jsx(_p,{as:"div",variant:"label",children:"Delegate task"}),$.jsx(yBe,{"aria-label":"Task for the agent",placeholder:"Describe a bounded task…",value:c,onChange:Ce=>{const Fe=Ce.target.value;d(Fe),S||g(Ldn(Fe))}}),$.jsxs("label",{children:[$.jsx("span",{children:"Harness"}),$.jsxs(Iw,{value:q,onChange:Ce=>G(Ce.target.value),children:[D.length===0&&$.jsx("option",{value:"",children:"No harness ready"}),D.map(Ce=>$.jsx("option",{value:Ce.id,children:Ce.label},Ce.id))]})]}),$.jsxs("label",{children:[$.jsx("span",{children:"Isolation"}),$.jsxs(Iw,{value:A,onChange:Ce=>{F(Ce.target.value)},children:[$.jsx("option",{value:"worktree",children:"New worktree (recommended)"}),$.jsx("option",{value:"current",children:"Current worktree (shared files)"})]})]}),A!=="current"&&$.jsxs("label",{children:[$.jsx("span",{children:"Branch"}),$.jsx(Zm,{"aria-label":"Delegated branch",value:m,onChange:Ce=>{k(!0),g(Ce.target.value)}})]}),$.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."}),$.jsx(Ms,{type:"button",variant:"primary",size:"compact",disabled:se||!c.trim()||!q||A!=="current"&&!m.trim(),onClick:()=>{pe(!0),VZr({task:c.trim(),harness:q,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 $dn(t){return t.replace(/[\\/]$/,"").split(/[\\/]/).at(-1)??t}function qdn(t){const n=t.current?["Current worktree"]:[$dn(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=nUe(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 nUe(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 zdn(t){return t.kind==="agent"?"AI":t.displayName.split(/\s+/).slice(0,2).map(n=>n[0]?.toLocaleUpperCase()??"").join("")}function Ywt({worktree:t}){const n=nUe(t);if(n.length===0)return null;const s=n.slice(0,3);return $.jsxs("span",{className:"volter-worktree-presence",role:"img","aria-label":n.map(c=>`${c.displayName}, ${c.status}`).join("; "),children:[s.map(c=>$.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:zdn(c)},c.participantId)),n.length>s.length&&$.jsxs("span",{className:"volter-worktree-avatar volter-worktree-avatar-more","aria-hidden":"true",children:["+",n.length-s.length]})]})}function Zwt(t,...n){const s=t.trim().toLocaleLowerCase();return!s||n.some(c=>c?.toLocaleLowerCase().includes(s))}function Qwt(t,n){return[+!t.current,Math.min(...nUe(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 Vdn(t){return(n,s)=>{const c=Qwt(n,t),d=Qwt(s,t);return c.reduce((g,S,k)=>g||S-(d[k]??0),0)||(n.branch??n.root).localeCompare(s.branch??s.root)}}function Udn(){const[t,n]=Ye.useState(jdn),[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 qZr()),A(null)}catch(q){A(q instanceof Error?q.message:String(q))}finally{J||m(!1)}},[]);return Ye.useEffect(()=>{if(L$)return;let J=!0;return BZr().then(q=>{J&&c(q)}).catch(()=>{}),()=>{J=!1}},[]),{state:t,sessionIdentity:s,loading:d,busy:g,error:k,setError:A,refresh:F,run:async(J,q,G)=>{S(J),A(null);try{await q(),G()}catch(se){A(se instanceof Error?se.message:String(se))}finally{S(null)}}}}function Jdn(){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:q,run:G}=Udn();if(Ye.useEffect(()=>{n&&q()},[n,q]),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])),De=[...S.worktrees].sort(Vdn(Ce)).filter(ft=>Zwt(c,ft.branch,ft.root)),be=S.branches.filter(ft=>!ft.worktreeId&&Zwt(c,ft.name)),X=De.slice(0,c.trim()?30:10),we=be.slice(0,c.trim()?50:20),Be=De.length-X.length,bt=be.length-we.length,It=c.trim(),Wt=S.branches.some(ft=>ft.name===It),zt=De.length>0||be.length>0;return $.jsxs("div",{className:"volter-worktree-switcher",children:[$.jsxs(dBe,{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:[$.jsx(dc,{icon:a0r}),se?.dirty&&$.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"}),se&&$.jsx(Ywt,{worktree:se})]}),n&&$.jsxs(pBe,{anchorRef:t,align:"start",clamp:!0,autoFocusFirst:!1,className:"volter-worktree-menu","aria-label":"Branches and worktrees",onDismiss:()=>s(!1),children:[$.jsxs("div",{className:"volter-worktree-search",children:[$.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)}),$.jsx(Ms,{variant:"ghost",size:"compact","aria-label":"Refresh branches and worktrees",title:"Refresh",disabled:F!==null,onClick:()=>void G("refresh",q,()=>{}),children:$.jsx(dc,{icon:CTt})})]}),$.jsx(H1,{}),$.jsxs("div",{className:"volter-worktree-results",children:[A&&S.worktrees.length===0&&$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"Loading branches…"}),X.length>0&&$.jsxs("section",{"aria-label":"Worktrees",children:[$.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 $.jsxs("div",{className:"volter-worktree-row-shell",children:[$.jsxs(Nc,{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,()=>zZr(ft.worktreeId),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon",children:ft.current&&$.jsx(dc,{icon:tLe})}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsxs("span",{className:"volter-worktree-row-title",children:[tr,ft.dirty&&$.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"})]}),$.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.worktreeId?"Opening…":qdn(ft)})]}),$.jsx(Ywt,{worktree:ft})]}),!ft.current&&ft.sessions[0]?.sessionId&&$.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}`,()=>JZr(ft.worktreeId,ft.sessions[0].sessionId),()=>s(!1)),children:$.jsx(dc,{icon:DTt})}),!ft.current&&ft.sessions.length===0&&!ft.dirty&&$.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}`,()=>UZr(ft.worktreeId),()=>s(!1)),children:$.jsx(dc,{icon:YTt})})]},ft.worktreeId)}),Be>0&&$.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[Be," more worktrees — search to narrow"]})]}),we.length>0&&$.jsxs("section",{"aria-label":"Local branches",children:[$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-section-label",children:"Local branches"}),we.map(ft=>$.jsxs(Nc,{className:"volter-worktree-menu-item",disabled:F!==null,onSelect:()=>void G(ft.name,()=>USt(ft.name),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon"}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsx("span",{className:"volter-worktree-row-title",children:ft.name}),$.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.name?"Creating worktree…":"Open in a new worktree"})]})]},ft.name)),bt>0&&$.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[bt," more ",It?"matches":"branches"," — search to narrow"]})]}),!A&&!zt&&!It&&$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"No branches found."})]}),It&&!Wt&&!A&&$.jsxs($.Fragment,{children:[$.jsx(H1,{}),$.jsxs(Nc,{className:"volter-worktree-create-command",disabled:F!==null,onSelect:()=>void G("create",()=>USt(It),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon",children:"+"}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsxs("span",{className:"volter-worktree-row-title",children:["Create branch “",It,"”"]}),$.jsx("span",{className:"volter-worktree-row-detail",children:F==="create"?"Creating worktree…":`From ${pe}, in a new worktree`})]})]})]}),!It&&$.jsxs($.Fragment,{children:[$.jsx(H1,{}),m?$.jsx(Bdn,{currentLabel:pe,onDone:()=>{g(!1),s(!1),q(!0)},onError:J}):$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-worktree-delegate-open",onClick:()=>g(!0),children:"Delegate to agent…"}),$.jsx(H1,{}),$.jsx(Mdn,{})]}),D&&$.jsx(_p,{as:"div",variant:"caption",tone:"danger",role:"alert",className:"volter-worktree-error",children:D})]})]})}function Wdn({transport:t}){const[,n]=Ye.useReducer(D=>D+1,0);Ye.useEffect(()=>Rw(n),[]);const[s,c]=Ye.useState(!1),d=Ye.useRef(null),m=of(),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]),$.jsxs("header",{className:"volter-project-header",children:[lee()?.nativeMenus?$.jsx("div",{className:"volter-project-header-left"}):$.jsxs("div",{ref:d,className:"volter-project-header-left",children:[$.jsxs("div",{className:"volter-project-header-cluster volter-chrome-island volter-glass-island",children:[$.jsxs(dBe,{"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:[$.jsx(dc,{icon:Kk.content.project}),$.jsx(_p,{"data-testid":"project-name","data-project":g,"data-project-version":S??void 0,variant:"label",className:"volter-sr-only",children:g})]}),$.jsx(Jdn,{}),$.jsx(bZ,{onPointerDown:()=>c(!1),className:"volter-project-app-menus",children:$.jsx(ydn,{})})]}),$.jsx(Hdn,{}),s&&$.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:[$.jsx(_p,{"data-testid":"project-menu-name",title:g,variant:"label",truncate:!0,className:"volter-project-menu-name",children:g}),F&&$.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&&$.jsxs($.Fragment,{children:[F&&$.jsx(H1,{}),$.jsxs("div",{"data-testid":"project-version-summary",className:"volter-project-versions",children:[$.jsx("span",{children:"Editor"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",WMt]}),$.jsx("span",{children:"Project"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",S]}),$.jsx("span",{children:"Engine"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",k]}),$.jsx("span",{children:"Format"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",A]})]}),$.jsx(H1,{})]}),F&&$.jsx(Nc,{onSelect:()=>{c(!1),bMe(F)},children:"Show in Finder"}),$.jsx(Nc,{"data-testid":"project-menu-history",onSelect:()=>{c(!1),window.dispatchEvent(new CustomEvent("editor:show-history-tab"))},children:"Undo History…"})]})]}),$.jsx(bZ,{"data-testid":"header-transport",className:"volter-project-transport volter-chrome-island volter-glass-island",align:"center",children:t??$.jsx(Gdn,{})}),$.jsx(bZ,{className:"volter-project-header-right",justify:"end",align:"center",children:$.jsx(Cme,{slot:"header-trailing"})})]})}function Hdn(){Ye.useSyncExternalStore(U$,mhe,mhe),Ye.useSyncExternalStore(dDt,vhe,vhe);const t=Ye.useSyncExternalStore(mDt,zS,zS);if(mD().workspaceTabs!=="shown")return null;const n=AN().filter(s=>Uk(s.id));return $.jsxs($.Fragment,{children:[$.jsx(OTr,{orientation:"vertical",className:"volter-project-menu-rule"}),$.jsx("div",{role:"tablist","aria-label":"Workspaces","data-testid":"workspace-tabs",className:"volter-workspace-tabs",children:n.map(s=>$.jsx("button",{type:"button",role:"tab","aria-selected":s.id===t,title:s.description,className:"volter-workspace-tab",onClick:()=>s2(s.id),children:s.title},s.id))})]})}function Gdn(){Ye.useSyncExternalStore(lLe,YB,YB);const t=Nvr();return t.length===0?null:$.jsx($.Fragment,{children:t.map(({id:n,Component:s})=>$.jsx(s,{documentId:""},n))})}function Kdn({utility:t,testId:n}){const s=t.Content;return $.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:$.jsx(s,{})})}function Xdn(t,n){return window.confirm(n)}const Ydn=4,Zdn=4,Qdn=24,epn=4,tpn=3,rpn=new Set(["model","image"]),npn=new Set(["glb","gltf","fbx","obj","dae","stl","ply","spz","bvh","3ds"]);function ipn(t){const n=t.lastIndexOf(".");return n>0&&npn.has(t.slice(n+1).toLowerCase())}const opn=new Set(["audio","video","prefab","json"]);function Sjt(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 iUe(t){return t.replace(/^(?:\.\/|\/)+/,"").replace(/\/+$/,"")}function spn(t,n){const s=t?n.slice(t.length+1):n;return s.split("/",1)[0]??s}function eTt(t,n){return t.tier-n.tier||t.depth-n.depth||t.seq-n.seq}function apn(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 cpn(t,n){const s=[...t].sort(eTt),c=[],d=new Set;for(const m of[1,2]){const g=s.filter(S=>S.tier===m);apn(g,c,d,n)}return c.sort(eTt),c.map(({path:m,name:g,kind:S})=>({path:m,name:g,kind:S}))}function lpn(t){return rpn.has(t)?1:opn.has(t)?2:0}function upn(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=ipn(d.name)?"model":ig(d.name).kind,S=lpn(g);S!==0&&t.candidates.push({path:m,name:d.name,kind:g,tier:S,depth:n.depth,seq:t.seq++,subtree:spn(t.base,m)})}}async function fpn(t,n,s={}){const c=s.listAssets??K0e,d=s.maxItems??Ydn,m=s.maxListings??Qdn,g=Sjt(s.listConcurrency??epn),S=iUe(n),k={base:S,maxDepth:s.maxDepth??Zdn,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 q=await Promise.all(J.map(se=>g(()=>c(t,se.dir)))),G=[];for(const[se,pe]of J.entries()){const ue=q[se];if(!ue||!ue.ok){k.failedListings+=1;continue}upn(k,pe,ue.entries,G)}F=G}return{items:cpn(k.candidates,d),totalAssets:k.totalAssets,scannedAll:!k.truncated&&k.failedListings===0,failedListings:k.failedListings}}const xjt="\0",JO=new Map,dpn=Sjt(tpn);function ppn(t,n,s){const c=`${t}${xjt}${iUe(n)}`,d=JO.get(c);if(d)return d;const m=dpn(()=>fpn(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 _pn(t,n){return t===n||t===""||n===""||t.startsWith(`${n}/`)||n.startsWith(`${t}/`)}function tTt(t){if(t===void 0){JO.clear();return}const n=iUe(t);for(const s of[...JO.keys()]){const c=s.slice(s.indexOf(xjt)+1);_pn(c,n)&&JO.delete(s)}}function jje(t,n="$"){return typeof t=="string"?[{path:n,value:t}]:Array.isArray(t)?t.flatMap((s,c)=>jje(s,`${n}[${c}]`)):!t||typeof t!="object"?[]:Object.entries(t).flatMap(([s,c])=>jje(c,`${n}.${s}`))}function mpn(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 hpn(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=mpn(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 jje(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 wjt(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 wjt(t,m)):/\.json$|\.gltf$/i.test(m)?c.push({path:m,text:await t.read(m)}):c.push({path:m})}return c}async function gpn(t,n){return hpn({assetPath:n,files:await wjt(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 AOe(t,n){for(const s of n)if(await t.exists(s))throw new Error(`An asset already exists at ${s}.`)}async function ypn(t,n){const s=S$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 AOe(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 AOe(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 AOe(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 vpn=320,bpn=180,Spn="document-preview-v4",gZ=new Map,xpn=new WPt(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,rTt,DOe=null;const WY=new Set;async function Tjt(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 Tjt(d.path)):c.push(`${d.path}:${d.size??0}:${d.mtime??0}`);return c}async function wpn(){const t=of()?.rootPath;return rTt!==t&&(rTt=t,YZ=null),YZ??=Promise.all([LRt([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 SMe(s)??""}`))),Tjt("")]).then(([n,s])=>Cjt([...n,...s].sort().join(`
|
|
1404
1404
|
`))),YZ}function Tpn(t){return WY.add(t),DOe??=Ag.watch(n=>{if(n.path===PB){JPt();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&&(DOe?.(),DOe=null,YZ=null)}}async function Cpn(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=xpn.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 Cjt(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 Epn(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 nTt(t,n="image/png"){const s=new Uint8Array(t.byteLength);return s.set(t),URL.createObjectURL(new Blob([s.buffer],{type:n}))}async function kpn(t){const n=await b$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 Apn(t,n,s,c){const d=of()?.rootPath??"no-project",m=await kpn(t),g=JSON.stringify({projectId:d,documentId:t,recipe:Spn,revision:n.revision(),dependencies:await wpn(),camera:m});c.throwIfAborted();const S=await Cjt(g),k=`.volter/cache/document-previews/${S}.png`;if(s===0&&await Ag.exists(k))return nTt(await Ag.readBytes(k));const A=await Cpn(S,c,()=>n.capture({width:vpn,height:bpn,...m?{camera:m}:{}}));c.throwIfAborted();const F=Epn(A);return await Ag.write(k,F.bytes),nTt(F.bytes,F.mime)}function Dpn({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),[q,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 Fe=null;const De=()=>{pe.current?.abort(),J(!0),Fe&&clearTimeout(Fe),Fe=setTimeout(()=>k(we=>we+1),750)},be=n.subscribe(De),X=Tpn(De);return()=>{Fe&&clearTimeout(Fe),be(),X()}},[n]),Ye.useEffect(()=>()=>{ue.current?.startsWith("blob:")&&URL.revokeObjectURL(ue.current)},[]),Ye.useEffect(()=>{const Fe=se.current;if(!Fe)return;const De=new IntersectionObserver(([be])=>G(be?.isIntersecting??!1));return De.observe(Fe),()=>De.disconnect()},[]),Ye.useEffect(()=>{if(!q)return;const Fe=new AbortController;pe.current=Fe;const De=Ce.current.previewRevision!==s||Ce.current.retry!==A?1:0;return g(null),J(!0),Apn(t,n,De,Fe.signal).then(be=>{if(Fe.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=>{Fe.signal.aborted||(g(be instanceof Error?be.message:String(be)),J(!1))}),()=>Fe.abort()},[t,s,A,n,S,q]),$.jsxs("div",{ref:se,style:{width:"100%",height:"100%",position:"relative",display:"grid",placeItems:"center"},children:[c&&$.jsx("img",{src:c,alt:`${t} preview`,style:{width:"100%",height:"100%",objectFit:"contain"}}),m?$.jsx("button",{type:"button",title:m,onClick:Fe=>{Fe.stopPropagation(),F(De=>De+1)},style:{position:"absolute",bottom:0,border:0,background:"var(--vscode-editor-background)",color:Zf[3],pointerEvents:"auto"},children:"Preview unavailable · Retry"}):D?$.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 Ejt(t,n){return Y0e(t,n.path)}function Ppn({root:t,item:n}){const[s,c]=Ye.useState(!1);return s?$.jsx(vD,{kind:"image",size:14}):$.jsx("img",{src:Ejt(t,n),alt:n.name,loading:"lazy",onError:()=>c(!0)})}function Ipn({root:t,item:n}){const s=k9t(Ejt(t,n),Iin);return s.failed?$.jsx(vD,{kind:"model",size:14}):s.src?$.jsx("img",{src:s.src,alt:n.name,"data-fit":"contain",onError:s.fromManifest?s.rejectManifest:void 0}):null}function Npn({root:t,item:n}){return ig(n.name).editor==="environment"?$.jsx(wR,{kind:"image",name:n.name,variant:"cell"}):n.kind==="image"?$.jsx(Ppn,{root:t,item:n}):n.kind==="model"?$.jsx(Ipn,{root:t,item:n}):$.jsx(wR,{kind:n.kind,name:n.name,variant:"cell"})}function Opn({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 ppn(t,n).then(S=>{g||d(S)},()=>{g||d("failed")}),()=>{g=!0}},[t,n,s]),c===null||c==="failed")return $.jsx(vD,{kind:"folder"});if(c.totalAssets===0)return $.jsx("div",{className:"volter-folder-preview","data-testid":"folder-preview-empty","aria-hidden":"true",children:$.jsxs("div",{className:"volter-folder-preview__empty",children:[$.jsx(dc,{icon:MOe,className:"volter-folder-preview__empty-glyph"}),$.jsx("span",{className:"volter-folder-preview__empty-caption",children:"Empty"})]})});const m=c.scannedAll?`${c.totalAssets}`:`${c.totalAssets}+`;return c.items.length===0?$.jsxs("div",{className:"volter-folder-preview","data-testid":"folder-preview-plain","aria-hidden":"true",children:[$.jsx("div",{className:"volter-folder-preview__fallback",children:$.jsx(vD,{kind:"folder"})}),$.jsx("span",{className:"volter-folder-preview__count",children:m})]}):$.jsxs("div",{className:"volter-folder-preview","data-testid":"folder-preview","aria-hidden":"true",children:[$.jsx("div",{className:"volter-folder-preview__grid","data-count":c.items.length,children:c.items.map(g=>$.jsx("div",{className:"volter-folder-preview__cell",children:$.jsx(Npn,{root:t,item:g})},g.path))}),$.jsx("span",{className:"volter-folder-preview__chip",children:$.jsx(dc,{icon:uee})}),$.jsx("span",{className:"volter-folder-preview__count",children:m})]})}const kjt="contentBrowser";function Lje(t){return t.type==="directory"?"folder":ig(t.name).kind}function Rpn(t,n,s){return Y0e(t,n?`${n}/${s}`:s)}function Fpn(t,n,s){return n?`/${n}/${s}`:`/${s}`}function Mpn(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Bje(t){const n=ig(t);return n.importable?n.runtimeReady?"healthy":"source-only":"unsupported"}const jpn=640,iTt={scope:"content",root:"public",currentPath:"",viewMode:"grid",sort:"relevance",filter:"all",density:96,expanded:["public"],treeVisibility:"auto",facets:["component"]};function Lpn(){try{const t=vve(kjt)??{},n=t.viewMode,s=t.treeVisibility,c=t.scope,d=t.root;return{...iTt,...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 iTt}}const Bpn={listAssets:K0e,listProjectComponents:MRt},POe="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.",$pn=new Set(["component","scene","canvas","model","image","video","audio","other"]);function qpn(t){const n=t.charAt(0).toUpperCase()+t.slice(1);return n.endsWith("s")?n:`${n}s`}async function oTt(t,n){if(!n&&e_()!==t)throw new Error("Open this scene as the active document before using its current view.");const s=o2(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 Fsn().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 zpn(t){return t.component.surface==="three"?"3d":t.component.surface==="canvas"?"2d":"ui"}function Vpn(t){const n={"3d":"3D","2d":"2D",ui:"UI"};return["3d","2d","ui"].flatMap(s=>{const c=t.filter(d=>d.source==="component"&&zpn(d)===s);return c.length>0?[{id:`prefabs-${s}`,label:n[s],headingLevel:"category",entries:c}]:[]})}function Upn(t,n,s){return n==="files"?[{id:"files",label:null,headingLevel:null,entries:[...t]}]:s.length===1&&s[0]==="component"?Vpn(t):t.length>0?[{id:"content",label:null,headingLevel:null,entries:[...t]}]:[]}function Ajt(t){return t.source==="available"?t.available.category:t.source==="component"?t.component.contentKind??"component":t.source==="document"?t.document.kind:j9t(t.name)}function Jpn(t){return t.source==="component"?t.component.contentKind??"component":t.source==="available"||t.source==="document"?"source":Lje(t.entry)}function WO(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function Wpn(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(Rpn(t.root,d,s.name),k)}}function Djt(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":Mpn(t.entry.size)}function Hpn(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=Djt(t);return n?`${t.name}
|
|
1408
1408
|
${n}`:t.name}function Gpn(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 sTt(t){return t.source==="asset"?pon({path:t.path,root:t.root,entry:t.entry}):t.source==="available"||t.source==="document"?10:_on(t.component)-100}function Kpn(t,n){const s=sTt(t),c=sTt(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 aTt(t,n){return t===void 0?n===void 0?0:1:n===void 0?-1:n-t}function Xpn(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 aTt(t.entry.size,n.entry.size);if(s==="modified"&&t.entry.modifiedAt!==n.entry.modifiedAt)return aTt(t.entry.modifiedAt,n.entry.modifiedAt);if(s==="type"){const c=Lje(t.entry).localeCompare(Lje(n.entry));if(c!==0)return c}if(s==="health"){const c=Bje(t.name).localeCompare(Bje(n.name));if(c!==0)return c}return HB(t,n)}function Ypn(t,n,s){return s==="relevance"?Kpn(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):Xpn(t,n,s)}function Zpn(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=Ajt(t);return n.facets.includes(s)}return n.scope==="content"||Gpn(t,n.filter,n.shownPath)}const Qpn={width:"100%",minWidth:0,padding:0,textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:3},e_n={width:"100%",minWidth:0,minHeight:28,padding:"3px 6px",textAlign:"left",display:"flex",flexDirection:"row",alignItems:"center",gap:7};function t_n(t){const n=new Map;if(!t.assetSubject)return n;const s=t.assetSubject.entries?.()??T3r(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 r_n=()=>()=>{},n_n=()=>0;function i_n({sheetUrl:t,frame:n}){return $.jsx(P9t,{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 o_n({item:t,kind:n,assetUrl:s,grid:c,folderPath:d,previewRevision:m}){const g=s;if(n==="folder")return c?$.jsx(Opn,{root:t.source==="asset"?t.root:"public",folderPath:d,revision:m}):$.jsx(vD,{kind:"folder",size:15});if(n==="audio"&&s)return $.jsx(Oin,{url:g,name:t.name});if(!c)return $.jsx(vD,{kind:n,size:15});if(t.source==="available"&&t.available.descriptor.preview)return $.jsx(Dpn,{documentId:t.available.descriptor.id,source:t.available.descriptor.preview,previewRevision:m});if(t.source==="component"){const{Thumbnail:S}=t.contentSource;return $.jsx(S,{entry:t.contentEntry,previewRevision:m})}return ig(t.name).editor==="environment"?$.jsx(wR,{kind:"image",name:t.name}):n==="image"?t.source==="asset"&&t.spritesheet?$.jsx(i_n,{sheetUrl:`/${t.spritesheet.sheetPath}`,frame:t.spritesheet}):$.jsx("img",{src:g,alt:t.name,style:{maxWidth:48,maxHeight:48,objectFit:"contain",borderRadius:sQ.sm}}):n==="video"&&g?$.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"||E9t(s)?$.jsx(A9t,{url:s}):["prefab","json"].includes(n)?$.jsx(wR,{kind:n,name:t.name}):$.jsx(vD,{kind:n})}function s_n({item:t,selected:n,onDragStart:s,onSelect:c,onOpen:d,onContextMenu:m,viewMode:g,previewRevision:S,showPath:k}){const A=Jpn(t),F=t.source==="asset"?t.entry:null,D=F?.type==="file"?ig(F.name):null,J=t.source==="asset"?Y0e(t.root,t.path):"",q=t.path,G=Hpn(t),se=F?F.type==="directory"||D?.placeable?D?.placeable?"grab":"pointer":"default":"pointer",pe=Djt(t),ue=t.source==="component"?t.path:t.source==="asset"?Dge(t.root,WO(t.path)).replace(/\/$/,""):WO(t.path)||"public",Ce=k?`${ue} · ${pe}`:pe,Fe=g!=="list";return $.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&&Ein(J)},onPointerLeave:()=>{A==="audio"&&J&&kin(J)},onDragStart:De=>s(De,t),onDragEnd:p3r,onClick:De=>c(t,De),onDoubleClick:()=>d(t),onContextMenu:De=>m(De,t),onKeyDown:De=>{if(De.key==="ContextMenu"||De.shiftKey&&De.key==="F10"){De.preventDefault();const be=De.currentTarget.getBoundingClientRect();De.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:be.left,clientY:be.bottom}))}else De.key==="Enter"?d(t):De.key===" "&&(c(t,De),De.preventDefault())},title:G,style:{...Fe?Qpn:e_n,borderRadius:sQ.sm,cursor:se,userSelect:"none"},children:[$.jsxs("div",{className:"volter-project-asset-entry__preview","data-testid":"asset-entry-preview",style:{...Fe?{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:[$.jsx(o_n,{item:t,kind:A,assetUrl:J,grid:Fe,folderPath:q,previewRevision:S}),Fe&&$.jsx("span",{className:"volter-project-asset-entry__kind","data-testid":"asset-entry-kind",title:`${A} asset`,children:$.jsx(vD,{kind:A,size:11})})]}),$.jsx("div",{"data-testid":"asset-entry-name",style:{...Fe?{fontSize:10,lineHeight:"13px",minHeight:26,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2}:{fontSize:11,lineHeight:"18px",flex:1},overflow:"hidden",textOverflow:"ellipsis",whiteSpace:Fe?"normal":"nowrap",color:Zf[1],minWidth:0},children:t.name}),!Fe&&$.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 a_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:q,onSearchOpenChange:G,onSearchQueryChange:se,onViewModeChange:pe,onDensityChange:ue,onTreeVisibilityToggle:Ce,onCreateFolder:Fe,onImport:De,onDelete:be,deleteDisabled:X,onRefresh:we,generationTools:Be,onGenerate:bt}){const It=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=>{It.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]),$.jsxs("div",{className:"volter-project-assets-toolbar",children:[$.jsxs(n$,{label:"Content display",compact:!0,className:"volter-project-assets-toolbar__row",children:[$.jsxs(Cht,{children:[$.jsx(mO,{text:"Content grid",position:"top",children:$.jsx(dm,{"aria-label":"Content grid","data-testid":"content-scope-content","aria-pressed":t==="content",onClick:()=>{t!=="content"&&F("content"),pe("grid")},children:$.jsx(dc,{icon:X0r})})}),$.jsx(mO,{text:"Browse grid",position:"top",children:$.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:$.jsx(dc,{icon:PTt})})}),$.jsx(mO,{text:"Browse list",position:"top",children:$.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:$.jsx(dc,{icon:vZ})})})]}),$.jsx("span",{style:{flex:1}}),m?$.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,$.jsx(mO,{text:m?"Close search":"Search",position:"top",children:$.jsx(dm,{"data-testid":m?"asset-search-close":"asset-search-toggle","aria-label":m?"Close search":"Search content",onClick:()=>{m?Yr():G(!0)},children:$.jsx(dc,{icon:m?Kk.action.close:Kk.action.search})})})]}),$.jsxs(n$,{label:t==="content"?"Content types":"Folder navigation",compact:!0,className:"volter-project-assets-toolbar__row",children:[t==="files"&&$.jsxs($.Fragment,{children:[$.jsx(mO,{text:A?"Hide folders":"Show folders",position:"top",children:$.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:$.jsx(dc,{icon:XTt})})}),$.jsx(mO,{text:"Back",position:"top",children:$.jsx(dm,{"data-testid":"asset-back","aria-label":"Back",disabled:!c,onClick:()=>q(d,Tt),children:$.jsx(dc,{icon:B0r})})}),$.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?$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>q(d,""),style:{flexShrink:0},children:vn}):$.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 $.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,flexShrink:0},children:[$.jsx("span",{style:{color:Zf[3]},children:"/"}),gn?$.jsx("span",{"aria-current":"location",title:en,style:{color:Zf[1]},children:en}):$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>q(d,No),children:en})]},No)})]})]}),t==="content"&&$.jsxs(Cht,{className:"volter-content-filter-inline","aria-label":"Content types",children:[m&&$.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=>!$pn.has(en)).sort().map(en=>[en,qpn(en)])].map(([en,ii])=>$.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))]}),$.jsxs("div",{ref:It,className:"volter-project-assets-toolbar__more",children:[$.jsx(mO,{text:"More asset actions",position:"top",children:$.jsx(dm,{"aria-label":"More asset actions","aria-expanded":ft,"aria-haspopup":"menu",onClick:()=>tr(en=>!en),children:$.jsx(dc,{icon:s0r})})}),ft&&$.jsxs(fN,{autoFocusFirst:!0,className:"volter-project-assets-toolbar__menu",onDismiss:()=>tr(!1),children:[$.jsx(Nc,{"data-command-id":O_.import.id,onSelect:()=>{tr(!1),De()},children:"Import files…"}),$.jsx(Nc,{"data-command-id":O_.createFolder.id,onSelect:()=>{tr(!1),Fe()},children:"New folder"}),Be.length>0&&$.jsxs($.Fragment,{children:[$.jsx("hr",{className:"volter-menu-separator"}),$.jsx(Nc,{onSelect:()=>{tr(!1),bt()},children:"Create asset…"})]}),$.jsx(Nc,{onSelect:()=>{tr(!1),ue(k<=96?132:88)},children:k<=96?"Larger thumbnails":"Smaller thumbnails"}),$.jsx(Nc,{disabled:X,"data-command-id":O_.delete.id,onSelect:()=>{tr(!1),be()},children:"Delete selected"}),$.jsx(Nc,{onSelect:()=>{tr(!1),we()},children:"Refresh"})]})]})]})]})}function c_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=qRt.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 $.jsxs("div",{children:[$.jsxs("div",{className:"volter-asset-tree-row",style:{paddingLeft:6+g*14},children:[$.jsx(dm,{className:"volter-asset-tree-toggle","aria-label":`${k?"Collapse":"Expand"} ${A}`,"aria-expanded":k,onClick:()=>t.onExpanded(S),children:$.jsx(dc,{icon:ITt,style:{transform:k?"rotate(90deg)":void 0}})}),$.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:[$.jsx(dc,{icon:uee}),A]})]}),k&&n.get(S)?.map(F=>c(d,m?`${m}/${F}`:F,g+1))]},S)};return $.jsxs("aside",{id:"project-asset-tree",className:"volter-asset-tree","aria-label":"Project asset sources",hidden:t.hidden,children:[$.jsx("div",{className:"volter-asset-facet-title",children:"Project"}),c("public","",0),$.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target",onClick:()=>t.onNavigate("public","asset-library/local"),children:"Imported"}),$.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target",onClick:()=>t.onNavigate("public",".generated"),children:"Generated"}),$.jsx("div",{className:"volter-asset-facet-title",children:"References"}),c(nA,"",0)]})}function l_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>=jpn)};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 u_n({services:t=Bpn}){const n=Yv(),s=typeof n.subscribe=="function"?n.subscribe:r_n,c=typeof n.getSnapshot=="function"?n.getSnapshot:n_n,d=typeof n.getShellSnapshot=="function"?n.getShellSnapshot:c,m=Ye.useSyncExternalStore(s,d,d),g=Ye.useSyncExternalStore(Cee,AD,AD),S=Ye.useSyncExternalStore(i2,X1,X1),k=Ye.useRef(n);k.current=n;const A=H9t(),F=Ye.useSyncExternalStore(l2,rA,rA),D=Ye.useSyncExternalStore(v9t,qge,qge),J=F.filter(pr=>pr.point==="workspace.document"&&pr.tool?.generation?.role==="submit"),q=Ye.useMemo(Lpn,[]),[G,se]=Ye.useState(q.root),[pe,ue]=Ye.useState(q.scope),[Ce,Fe]=Ye.useState(q.facets),[De,be]=Ye.useState(q.currentPath),[X,we]=Ye.useState(q.viewMode),[Be,bt]=Ye.useState(q.scope==="content"?"relevance":"name"),[It,Wt]=Ye.useState("all"),[zt,ft]=Ye.useState(q.density),{browserRef:tr,treeVisibility:Qt,treeVisible:Tt,toggleTreeVisibility:vn}=l_n(q.treeVisibility),[Yr,en]=Ye.useState(!1),[ii,No]=Ye.useState({path:q.currentPath,entries:[]}),[gn,En]=Ye.useState([]),[cs,On]=Ye.useState([]),ji=Ye.useSyncExternalStore(ptn,Q0e),Ja=Ye.useSyncExternalStore(OC,u0,u0),[_a,Pn]=Ye.useState(!1),[js,fa]=Ye.useState([]),[Nt,$c]=Ye.useState(new Set(q.expanded)),[Ni,Dc]=Ye.useState(0),[vc,Tf]=Ye.useState(0),[Ip,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(()=>{bve(kjt,{scope:pe,root:G,facets:Ce,currentPath:De,viewMode:X,sort:Be,filter:It,density:zt,expanded:[...Nt],treeVisibility:Qt})},[De,G,zt,Nt,Ce,It,pe,Be,Qt,X]);const Qs=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(()=>{Qs(G,De)},[G,De,Qs]);const Pu=Ye.useCallback(async()=>{Pn(!0);try{const[pr,Ur]=await Promise.all([M9t(t.listAssets),t.listProjectComponents()]),Ei=await fon(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=>{Fe([pr])},[]),Ds=Ye.useCallback(pr=>{en(pr),pr||Fe(Ur=>Ur.length>0?Ur:["component"])},[]),Rc=ii.path,Ze=Ye.useMemo(()=>t_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=hin().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"?Kze(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=Ip.toLowerCase(),Ur=mt.filter(Li=>Zpn(Li,{query:pr,scope:pe,facets:Ce,filter:It,shownPath:Rc})),Ei=pe==="files"&&Be==="relevance"?"name":Be;return[...Ur].sort((Li,uc)=>Ypn(Li,uc,Ei))},[mt,Ce,Rc,It,pe,Ip,Be]),Vn=Ye.useMemo(()=>{const pr=new Set;for(const Ur of mt)pr.add(Ajt(Ur));return pr},[mt]),eo=Ye.useMemo(()=>Upn(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. ${POe}`);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:Fpn(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 Np=xr.findIndex(Rh=>Rh.key===tu),ls=xr.findIndex(Rh=>Rh.key===pr.key);if(Np>=0&&ls>=0){const[Rh,Gi]=Np<ls?[Np,ls]:[ls,Np];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=Y0e(pr.root,pr.path);if(BI({path:Nd,name:Li.name,kind:kc,...Li.size===void 0?{}:{sizeBytes:Li.size},capabilities:uc,health:Bje(Li.name),selectionCount:Ei.size,...pr.path.startsWith("asset-library/local")?{sourcePath:"Asset Library provenance metadata"}:{}}),pr.root!=="public")return;const Lo=pr.path;gpn(gR(),Lo).then(Np=>{const ls=Nd;J0e()?.path===ls&&BI({path:ls,name:Li.name,kind:kc,...Li.size===void 0?{}:{sizeBytes:Li.size},capabilities:uc,health:Np.health.status==="healthy"?"healthy":uc.runtimeReady?"unsupported":"source-only",healthCodes:Np.health.codes,dependencies:Np.dependencies,references:Np.references,selectionCount:Ei.size})}).catch(()=>{})},[xr,dl,tu]),ic=Ye.useCallback(pr=>{if(pr.source==="component"){if(pr.authoringAsset){sQr(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=kFt(pr.document.id);Ur.ok||ea.error(Ur.error,"scene");return}ID(pr.document)||sN(`/${pr.path}`,TFt(pr.document));return}Wpn(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)tTt(Ur);else tTt();Tf(Ur=>Ur+1),Qs(G,De),pe==="content"&&Pu()},[G,De,Pu,Qs,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"?[Dge(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 ypn(pr,{backend:gR(),history:A}),gp.current.clear(),G==="public"&&await Qs(G,De),pe==="content"&&await Pu()},[De,G,Pu,Qs,A,pe]),lc=Ye.useCallback(async()=>{zi.length!==0&&Xdn("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:De,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,De,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:De?`${De}/${pr}`:pr})}})},[Sl,De,G,Cs]),Yu=Ye.useCallback(async pr=>{if(!pr||pr.length===0)return;const Ur=pe==="content"||G!=="public"?"":De,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,De,G,Cs,Ls,pe]),Pe=Ye.useCallback(pr=>{if(!(pr.source!=="asset"||pr.entry.type!=="file")){if(pr.root!=="public"){i0(`${pr.name} is reference material. ${POe}`);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. ${POe}`);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=>{$c(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?Pe(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]&&bMe(Jn[0])};return window.addEventListener("editor:project-asset-command",pr),()=>window.removeEventListener("editor:project-asset-command",pr)},[Fl,De,lc,Et,Nu,Ps,Pe,Iu,Jn]);const In=Ao?.item.source==="available"&&Ao.item.available.descriptor.preview?Ao.item:null;return $.jsxs("div",{ref:tr,className:"volter-asset-browser","data-tree-visible":pe==="files"&&Tt,onPointerDown:()=>CR("asset-browser"),onKeyDown:pr=>{if(!uje(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&&Pe(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:[$.jsx(c_n,{currentRoot:G,currentPath:De,expanded:Nt,hidden:pe!=="files"||!Tt,revision:Ni,loadAssets:t.listAssets,onExpanded:Nr,onNavigate:Ls}),$.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,minHeight:0},children:[$.jsx(Zm,{ref:Du,type:"file",multiple:!0,"aria-label":"Import project assets",hidden:!0,onChange:pr=>{Yu(pr.target.files),pr.currentTarget.value=""}}),$.jsx(a_n,{availableFacets:Vn,scope:pe,facets:Ce,currentPath:De,currentRoot:G,searchOpen:Yr,searchQuery:Ip,viewMode:X,density:zt,treeVisible:Tt,onScopeChange:Ff,onFacetToggle:Hs,onFacetsClear:()=>Fe([]),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&&$.jsx("div",{role:"alert",className:"volter-asset-operation-error",children:Al}),pl&&$.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:[$.jsx("span",{style:{fontSize:12},children:pl.title}),$.jsx(Zm,{autoFocus:!0,"aria-label":pl.title,value:Xu,onChange:pr=>$r(pr.target.value),onKeyDown:pr=>{pr.key==="Escape"&&gs(null)}}),$.jsx(Ms,{type:"submit",size:"compact",children:pl.confirmLabel}),$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>gs(null),children:"Cancel"})]}),zi.length>0&&$.jsxs(n$,{label:"Selected asset actions",compact:!0,children:[$.jsxs("span",{children:[zi.length," selected"]}),$.jsx(Ms,{variant:"ghost",size:"compact",onClick:()=>void Nu(),children:"Move selected"}),$.jsx(Ms,{variant:"ghost",size:"compact","aria-label":"Delete selected assets",onClick:()=>void lc(),children:"Delete"})]}),$.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=>$.jsxs("div",{role:"group","aria-label":pr.label??void 0,className:"volter-content-result-section",children:[pr.label&&$.jsx("div",{role:"presentation",className:"volter-content-section-heading","data-level":pr.headingLevel??void 0,"data-testid":`content-section-${pr.id}`,children:$.jsx("span",{children:pr.label})}),pr.entries.map(Ur=>$.jsx(s_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&&$.jsx(MTr,{compact:!0,style:{gridColumn:"1 / -1"},icon:$.jsx(dc,{icon:xt?Kk.status.warning:Ip?Kk.action.search:Kk.content.folder}),title:_a?"Finding project content…":xt?"Listing failed":Ip?"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}`:Ip?"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&&$.jsx(rhe,{children:$.jsxs(fN,{autoFocusFirst:!0,className:"volter-asset-context-menu",style:{left:Ao.x,top:Ao.y},onDismiss:()=>ia(null),children:[$.jsxs(Nc,{type:"button",role:"menuitem",onClick:()=>{ic(In),ia(null)},children:["Open ",$.jsx("kbd",{children:"Enter"})]}),In.available.category==="scene"&&$.jsxs($.Fragment,{children:[$.jsx(Nc,{type:"button",role:"menuitem",onClick:()=>{const pr=In.available.descriptor.id;ia(null),oTt(pr,!1).then(()=>Tf(Ur=>Ur+1)).catch(Ur=>Ku(Ur instanceof Error?Ur.message:String(Ur)))},children:"Use current view for preview"}),$.jsx(Nc,{type:"button",role:"menuitem",onClick:()=>{const pr=In.available.descriptor.id;ia(null),oTt(pr,!0).then(()=>Tf(Ur=>Ur+1)).catch(Ur=>Ku(Ur instanceof Error?Ur.message:String(Ur)))},children:"Reset preview view"})]}),$.jsx(Nc,{type:"button",role:"menuitem",onClick:()=>{ia(null),Tf(pr=>pr+1)},children:"Refresh preview"})]})}),Ao&&Ao.item.source==="asset"&&$.jsx(rhe,{children:$.jsxs(fN,{autoFocusFirst:!0,className:"volter-asset-context-menu",style:{left:Ao.x,top:Ao.y},onDismiss:()=>ia(null),children:[$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.open.id,onClick:()=>{ic(Ao.item),ia(null)},children:["Open ",$.jsx("kbd",{children:"Enter"})]}),$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.rename.id,onClick:()=>{Pe(Ao.item),ia(null)},children:["Rename ",$.jsx("kbd",{children:"F2"})]}),$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.duplicate.id,onClick:()=>{Et(Ao.item),ia(null)},children:["Duplicate ",$.jsx("kbd",{children:"⌘D"})]}),$.jsx(Nc,{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…"}),$.jsx(Nc,{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"}),uLe("asset").map(pr=>{const Ur=Ao.item.source==="asset"&&Ao.item.entry.type==="file",Ei=Ao.item.source==="asset"?{assetPath:Dge(Ao.item.root,Ao.item.path)}:{};return $.jsx(Nc,{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)}),$.jsx(Nc,{type:"button",role:"menuitem","data-command-id":O_.reveal.id,disabled:!Jn[0],onClick:()=>{Jn[0]&&bMe(Jn[0]),ia(null)},children:"Reveal in Finder"}),$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.delete.id,disabled:zi.length===0,onClick:()=>{lc(),ia(null)},children:["Delete ",$.jsx("kbd",{children:"⌫"})]})]})})]})}const f_n={agent:()=>$.jsx(Cme,{slot:"panel:agent"}),"project-work":()=>$.jsx(Cme,{slot:"panel:project-work"}),hierarchy:yjt,assets:({dependencies:t})=>$.jsx(u_n,{services:t?.assets}),"asset-library":()=>$.jsx(Cme,{slot:"panel:asset-library"}),inspector:GVe};class d_n extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){ea.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?$.jsxs("div",{role:"alert","data-testid":"static-panel-crashed",style:{padding:12,display:"grid",gap:8,alignContent:"start"},children:[$.jsxs("strong",{children:[this.props.title," crashed."]}),$.jsx("span",{style:{opacity:.8,wordBreak:"break-word"},children:this.state.error.message}),$.jsx("div",{children:$.jsx(Ms,{type:"button",variant:"outline",size:"compact",onClick:()=>this.setState({error:null}),children:"Retry"})})]}):this.props.children}}const p_n=wVe.map(t=>{const n=f_n[t.kind],s=c=>$.jsx(d_n,{title:t.title,children:$.jsx(n,{...c})});return s.displayName=`StaticPanel(${t.kind})`,{...t,Content:s}});function __n(t){return p_n.find(n=>n.kind===t)}function m_n({kind:t,dependencies:n}){const{Content:s}=__n(t);return $.jsx(s,{dependencies:n})}const h_n=250;function g_n(){const t=D4t(),n=y_n();return()=>{n(),t()}}function y_n(){const t=new Map;let n=null,s=!1;function c(){const g=[],S=new Set;for(const k of ea.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:wC})}const m=ea.subscribe(()=>{if(s)return;const g=ea.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,h_n))});return bN("console-entries",{entries:[],_clientId:wC}),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],Zxn=Object.freeze(Object.defineProperty({__proto__:null,PHASE_ORDER:yZ,SystemPhase:Y4},Symbol.toStringTag,{value:"Module"})),tye=1e-9,Pjt=1e5;function v_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=s.end-g;if(!d||S<=F+tye){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>Pjt){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 b_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=g-s.start;if(!d||S<=F+tye){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>Pjt){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 cTt(t,n){return t<n.start?n.start:t>n.end?n.end:t}class S_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=cTt(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=cTt(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"?v_n(c,s,this._range):b_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},x_n=150;class Qxn{constructor(n){this.store=n,this.stopStoreWatch=n.subscribe(()=>this.notify())}clock=new S_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()},x_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 Eme=new Map,$je=new Set;function lTt(){for(const t of[...$je])t()}function ewn(t,n){return Eme.set(t,n),lTt(),()=>{Eme.get(t)===n&&(Eme.delete(t),lTt())}}function w_n(t){return t===null?null:Eme.get(t)??null}function T_n(t){return $je.add(t),()=>{$je.delete(t)}}let kme=null;function twn(t){return kme=t,()=>{kme===t&&(kme=null)}}function xve(){return kme}const Ijt="__volterWorkspacePersistenceSuppressed";function Njt(){return globalThis}function Ojt(t){Njt()[Ijt]=t}function C_n(){return Njt()[Ijt]===!0}function Rjt(){return(See()?.immersivePlay??!1)&&!NR().play?.keepPanelsVisible}const Fjt={phase:"idle",flightDone:!1,gameReady:!1};function E_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 k_n(t,n){if(n==="stop")return Fjt;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 E_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 A_n=450,D_n=220,Mjt=250;function P_n(t){t.style.setProperty("--volter-play-dissolve-duration",`${A_n}ms`),t.style.setProperty("--volter-play-materialize-duration",`${D_n}ms`),t.style.setProperty("--volter-play-crossfade-duration",`${Mjt}ms`)}let SD=null;function I_n(t){return SD=t,typeof document<"u"&&P_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 N_n(){return Qk?.state.phase??"idle"}const Ame=new Set;function Ljt(){if(Ame.size===0)return;const t=[...Ame];Ame.clear();for(const n of t)n()}function O_n(t){if(!Qk||Qk.state.phase==="playing"){t();return}Ame.add(t)}function R_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=k_n(s,t);c!==s&&(n.state=c,c.phase==="crossfade"&&s.phase!=="crossfade"&&(SD?.root.classList.add("volter-play-crossfade"),R_n(n,Mjt+30,()=>gB("crossfade-done"))),c.phase==="playing"&&s.phase!=="playing"&&(SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),n.flying&&xve()?.settle(),Ljt()))}function F_n(){M_n({immersive:Rjt()})}function M_n(t){if(Qk&&oUe(),!t.immersive)return;const n=jjt();Ojt(!0);const s={state:Fjt,reducedMotion:n,flying:!1,timeouts:new Set};if(Qk=s,SD?.hideChrome(!n),n){gB("start-reduced");return}if(gB("start"),s.flying=xve()?.begin(()=>{Qk===s&&gB("flight-done")})??!1,!s.flying){gB("flight-done");return}SD?.root.classList.add("volter-play-flight")}function j_n(t,n){(!t||!n)&&oUe()}function L_n(t){const n=Qk;n&&(n.flying&&t&&xve()?.track(t),gB("game-ready"))}function oUe(){const t=Qk;if(t){Qk=null;for(const n of t.timeouts)clearTimeout(n);t.timeouts.clear(),Ljt(),SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),t.flying&&xve()?.end(),SD?.showChrome(!jjt()),Ojt(!1)}}const qje=new Set;let Bjt=null;function $jt(){return of()?.rootPath??null}function B_n(t){qje.add(t);const n=$jt();return n!==null&&Bjt===n&&t(),()=>{qje.delete(t)}}async function rwn(){Bjt=$jt();for(const t of[...qje])await t()}function $_n(){const t=e_();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 zje=null;function q_n(t){zje=t}function uTt(){if(!zje)throw new Error("The workbench Output service is not connected.");return zje}function z_n(){Q4r(e_),Q3r({output:{write:(...t)=>uTt().write(...t),show:t=>uTt().show(t)},console:{log:(t,n)=>ea.log(t,n),warn:(t,n)=>ea.warn(t,n),error:(t,n)=>ea.error(t,n)},live:{register:ZFt,mounted:_Ve,playing:rve,runWindow:aVe,restartRequired:KFt,restart:XFt,subscribe:hVe,version:e9t,notifyChanged:GFt,snapshotFrame:lVe,frameCanvas:cVe,authoringRefusal:pVe,dispatch:uVe,scenes:fVe,surface:tve,coverage:dVe},viewport:{transition:{begin:F_n,ready:L_n,end:oUe,onSettled:O_n,phase:N_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:wBe,reportFacet:Lrn,onSample:xnn,onCommandDispatched:MYr,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=>Oze(n=>{n!==null&&t()}),onBeforeClose:enn,reportWorkerCallMeter:Usn},project:{documentTable:Ren,mounts:l$,engineVersion:()=>of()?.config.engine.version??null,subscribe:Rw,onReady:B_n},notify:t=>s$(t),systems:{inspected:Cye,subscribe:Lwr,inspectedNetworking:zwr,subscribeNetworking:Vwr,inspectedAudio:()=>Uwr()??null,subscribeAudio:Jwr,audioVersion:Wwr},availability:{subscribe:HVe,version:Tun},workspace:{showUtility:bC,openContributedDocument:t=>tA(t),open:async t=>await Wye(t.kind,Ih()??{},t)!==null,liveDocument:{id:a0,register:atn,acquire:ftn,release:Zze,open:iq,container:ctn,setContainer:ltn,releaseContainer:utn}},documents:{activeId:e_,active:()=>{const t=CC();return t?{id:t.descriptor.id,kind:t.descriptor.kind,title:t.title}:null},subscribe:i2,version:X1,context:cQ,waitForContext:p4t,contextChanged:VCr,captureActive:t=>{const n=Ih();return n?m9t(n,t):Promise.reject(new Error("No editor session is open to capture a document from."))}},transport:{for:t=>w_n(t),subscribe:T_n},projectLocalState:{ready:lte,read:vve,write:bve,projectRootPath:()=>of()?.rootPath??null},history:{record:QPt,setDelegate:Y4r,onElement:tDr,invalidate:rDr,onInvalidated:nDr,changed:Z4r,elements:eDr,focusedResource:()=>{const t=CC();if(!t)return null;const n=t.descriptor.provenance?.sourcePath;if(n)return n;const s=Ih();return s?NYr(s)??Dze(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=ZPt(t),s=o_e(t),c=Ih()?.projectHistory?.subscribe(t),d=i2(t);return()=>{n(),s(),c?.(),d()}}},files:{setProvider:C4r,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:TEr,get:PEr,set:NEr,inspect:U4t,subscribe:t=>{const n=$4t(t),s=bee(t);return()=>{n(),s()}}},keyboard:{actions:()=>Oan().map(({id:t,scope:n})=>({id:t,scope:n})),keymaps:()=>W4t().map(({id:t,title:n})=>({id:t,title:n,chords:Z4t(t)})),activeKeymap:dR,invoke:t=>RVe(t),subscribe:t=>{const n=Fan(t),s=Uye(t),c=o_e(t),d=Ih()?.subscribe(t),m=i2(t);return()=>{n(),s(),c(),d?.(),m()}},version:()=>Ran()+X1(),stage:()=>{const t=Ih();return t?{surface:Nfn(t).surface,mode:$_n()}:{surface:null,mode:null}},bindActions:zan,chordsFor:OBe,shortcutFor:t=>Vv(t)??null}})}let V_n=0,cee=null;const Vje=new Set;function fTt(t){const n={generation:++V_n,promise:t,active:!0};cee=n;for(const s of Vje)s(n);return Vje.clear(),n}function U_n(){const t=cee;return t?.active?Promise.resolve(t):new Promise(n=>Vje.add(n))}async function sUe(){for(;;){const t=await U_n();if(await t.promise,cee===t&&t.active)return}}const qjt=16,J_n=300,W_n=1e4,zjt="workspace";function H_n(){const t=vve(zjt);return!t||t.version!==qjt?null:t}function G_n(t){bve(zjt,t)}function K_n(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=bAr(n.id);return{kind:n.kind,id:n.id,state:s,...Object.keys(c).length>0?{presentation:c}:{}}}function X_n(){const t={};let n=!1;for(const s of lDt()){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 Y_n(){const t=[];for(const s of l0()){const c=K_n(s);c&&t.push(c)}const n=X_n();return{version:qjt,workspace:zS(),documents:{open:t,activeId:e_(),...n?{kinds:n}:{}}}}async function Z_n(t,n,s){for(const c of cDt(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 dTt(t){if(!t)return!1;const n=!HQ();return SN(t,n)?!0:ntn.has(t)?(wFt(t),n&&pTr(t),!0):n&&X0(t)}function Q_n(t,n){const s=n?.kinds??{},c=(n?.open.length??0)>0;for(const d of lDt())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 emn(t){const n=new Set;for(const s of t)for(const c of cDt(s.kind))c.prepare&&n.add(c.prepare);return Promise.all([...n].map(s=>s().catch(()=>{})))}async function tmn(t,n){const s=n?.documents;if(Q_n(t,s),!s||s.open.length===0){dTt(s?.activeId??null);return}await emn(s.open);for(const c of s.open){const d=c.presentation;d&&typeof d=="object"&&!Array.isArray(d)&&SAr(c.id,d),await Z_n(t,c,s.activeId)}dTt(s.activeId)}function Vjt(t){if(!lte()||of()&&!u0()){let se=!1,pe=null,ue=()=>{};const Ce=new Promise(De=>{ue=De}),Fe=fTt(Ce);return Promise.all([cte(),Gze()]).then(()=>{if(se){ue();return}pe=Vjt(t),Fe.active=!1,sUe().finally(ue)}),()=>{se=!0,pe?.()}}const n=H_n();n?.workspace&&kB(n.workspace)&&Uk(n.workspace)?s2(n.workspace):(n?.workspace&&wkr(n.workspace),s2(pR(),{provisional:!0}));let s=!1,c=null;const d=[],m=()=>{c!==null&&(clearTimeout(c),c=null),!(C_n()||t.playState!==void 0&&t.playState!=="stopped")&&G_n(Y_n())},g=()=>{c!==null&&clearTimeout(c),c=setTimeout(m,J_n)},S=()=>m();let k=null;const A=typeof window<"u"&&rCt(window.location.href)!==null,F=A||!(n?.documents?.open.length??0)?Promise.resolve():mN().catch(()=>{}),D=F.then(()=>A?void 0:tmn(t,n)).catch(()=>{}),J=new Promise(se=>{F.then(()=>{s||(k=setTimeout(()=>{se()},W_n))})}),q=Promise.race([D,J]).then(()=>{k!==null&&clearTimeout(k),!s&&(d.push(i2(g)),d.push(CAr(g)),window.addEventListener("pagehide",S))}),G=fTt(q);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 rmn(t){Ye.useEffect(()=>{const n=rCt(window.location.href);if(!n)return;let s=!1;const c=Em(),d=()=>!s&&Em()===c;return sUe().then(()=>{if(d())return Bge(t,n,{updateUrl:!1,origin:"link"})}).catch(m=>{ea.error(`Could not restore shared editor view: ${m instanceof Error?m.message:String(m)}`,"editor")}),()=>{s=!0}},[t])}const pTt="volter:stale-chunk-reload";function nmn(){typeof window>"u"||window.addEventListener("vite:preloadError",t=>{let n=0;try{n=Number(sessionStorage.getItem(pTt)??0)}catch{}if(!(Date.now()-n<6e4)){try{sessionStorage.setItem(pTt,String(Date.now()))}catch{}t.preventDefault(),window.location.reload()}})}const jI=[];function imn(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 nwn(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)){ea.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 iwn extends Error{name="StoryMediumMismatch"}function own(t){return t instanceof Error&&t.name==="StoryMediumMismatch"}const Dme=new Map;function swn(t,n){return Dme.set(t,n),()=>{Dme.get(t)===n&&Dme.delete(t)}}function omn(t){return Dme.get(t)??null}function smn(t,n){const s=[];for(const c of Object.keys(n).sort())s.push(`${c}=${amn(n[c])}`);return`${t}|${s.join("&")}`}function amn(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 rye=new Map,b_e=new Map,_Tt=new WeakMap;let mTt=Promise.resolve(),hTt=null,cmn=1;function lmn(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}async function umn(){await Promise.race([Nye(),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 fmn(){return hTt??=umn(),hTt}function dmn(t){const n=_Tt.get(t);if(n!==void 0)return n;const s=cmn++;return _Tt.set(t,s),s}function pmn(t,n,s,c){const d=rye.get(t);if(d)return Promise.resolve(d);const m=b_e.get(t);if(m)return m;const g=mTt.then(async()=>{await fmn();const S=s.parameters.layout,k=S==="fullscreen"||S==="padded"||S==="centered"?S:"padded",A={...c,props:s.args,layout:k},F=omn(n==="canvas"?"canvas":"three");if(!F)throw new Error(`No ${n} story capture is registered.`);return F(s.Component,A)});return mTt=g.then(()=>{},()=>{}),b_e.set(t,g),g.then(S=>{rye.set(t,S),b_e.delete(t)},()=>b_e.delete(t)),g}function _mn({component:t,story:n,previewRevision:s,width:c=128,height:d=96}){const m=n.Component,g=`${t.surface}:${t.path}:${smn(n.id,n.args)}:${dmn(m)}:${s}:${c}x${d}`,[S,k]=Ye.useState(()=>rye.get(g)),[A,F]=Ye.useState(!1);return Ye.useEffect(()=>{let D=!1;if(F(!1),k(rye.get(g)),!!lmn())return pmn(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?$.jsx("img",{src:S,alt:`${t.name} preview`,className:"volter-component-thumbnail"}):$.jsx("span",{className:"volter-component-thumbnail-fallback","data-component-preview":A?"failed":"capturing-story",children:$.jsx(wR,{kind:"component",name:t.name})})}const wve="story:three",Tve="story:isolated",mmn="story:docs";function hmn(t,n){return t.surface==="dom"?!1:n===null||t.surface===n}function gmn({entry:t,previewRevision:n,width:s,height:c}){const d=t.detail;return $.jsx(_mn,{component:t.component,story:d,previewRevision:n,...s===void 0?{}:{width:s},...c===void 0?{}:{height:c}})}const ymn="story",vmn={id:ymn,owner:"./component-content-source",entries(t){const n=rq(),s=[];for(const c of t.components){if(!hmn(c,t.surface))continue;const d=bRt(n,c.name,c.path);d&&s.push({id:`${c.path}:${c.name}`,component:c,detail:d})}return s},subscribe:V0e,Thumbnail:gmn,open(t,n,s){const c=n.detail,d=n.component.surface==="three";CD(d?wve:Tve,t,d?{modulePath:c.modulePath,storyName:c.name,title:s}:{modulePath:c.modulePath,storyName:c.name})}};function gTt(t){return fYr(t.name,t.sourcePath)}const bmn={id:"portable-csf",owner:"./component-states",statesFor:(t,n)=>n.surface==="dom"?[]:gTt(t).map(s=>({id:s.id,label:s.label})),apply:(t,n,s)=>{const c=gTt(t).find(d=>d.id===n);if(c){if(s.surface==="three"){CD(wve,s.store,{modulePath:c.modulePath,storyName:c.name,title:c.label});return}if(s.surface==="canvas"){CD(Tve,s.store,{modulePath:c.modulePath,storyName:c.name});return}ea.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 Smn(){let t=0,n=!1;const s=S=>{const k=++t;iYr(),Nye().then(()=>{if(!(n||k!==t))return mYr(of(),void 0,{deferUndeclared:!0,...S?{changedPaths:S}:{}})})};s();let c=null;const d=bFt(),m=Rw(()=>s()),g=sen(s);return()=>{n=!0,t+=1,c!==null&&clearTimeout(c),d(),m(),g()}}const Ujt="story",IOe=new Set,NOe=new Set;function xmn(t){const n=_Rt({modulePath:t.modulePath,title:t.title}).leaf;return n===t.label?n:`${n} · ${t.label}`}function OOe(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??xmn({modulePath:n.modulePath,title:s.title,label:s.label})}}return null}function wmn(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(mmn,t,c);const d=Cze({modulePath:s.modulePath,regions:Tze()});return d.medium===void 0?(nYr(s.modulePath,d.reason),null):CD(d.medium==="three"?wve:Tve,t,c)}function yTt(t){ea.warn(`No composed portable story carries the id ${JSON.stringify(t)}, so nothing opened it.`,"editor")}function Tmn(){return kN({id:Ujt,owner:"./story-opener",open:(t,n)=>{const s=OOe(n);return s?wmn(t,n,s):(n.modulePath?IOe.add(n.modulePath):n.storyId!==void 0&&(NOe.add(n.storyId),cYr()&&yTt(n.storyId)),null)},settle:async()=>{await ADr();const t=[...IOe],n=[...NOe];if(IOe.clear(),NOe.clear(),await Promise.all(t.map(s=>dYr(of(),s))),n.length!==0){await lYr();for(const s of n)OOe({storyId:s})||yTt(s)}},ready:async(t,n)=>{if(n.mode==="docs")return;const s=OOe(n);if(!(!s||Cze({modulePath:s.modulePath,regions:Tze()}).medium!=="three")&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}})}const Cmn={actions:()=>{if(!egt(Tve)&&!egt(wve))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:Ujt,modulePath:n.modulePath,storyName:c.name,title:c.name})})}return t},subscribe:t=>V0e(t)};function Emn(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 kmn(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 Amn="packages/editor/src/stories/story-capture-command.ts",nB="capture-story-variants";async function Dmn(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 PZr("volter.project.json");if(!D)return null;const J=JSON.parse(D),q=J.resolution?.width,G=J.resolution?.height;return typeof q!="number"||typeof G!="number"||q<64||G<64||q>4096||G>4096?null:{width:Math.min(1024,Math.round(q)),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=Emn(nB,t.camera);if(typeof S=="string")return{ok:!1,error:S};const k=kmn(nB,t.pose);if(typeof k=="string")return{ok:!1,error:k};const{captureProjectStoryVariants:A}=await fo(async()=>{const{captureProjectStoryVariants:D}=await import("./story-capture-BIrjDKeY.js");return{captureProjectStoryVariants:D}},__vite__mapDeps([265,266,1,2,3,4,20,21,230,209,267,22,23]));return{ok:!0,data:{...await A(of(),{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 Pmn={[nB]:{timeoutMs:12e4,derivedRefresh:"if-content-changed",handle:Dmn}};function Imn(){const t=_in(vmn),n=imn(bmn),s=Tmn(),c=uCt(Cmn),d=dCt(Amn,Pmn),m=Smn(),g=V0e(()=>{BB()});return()=>{g(),m(),d(),c(),s(),n(),t()}}const Nmn=[["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"]],Omn=[["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 vTt(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 Rmn(t){const n=getComputedStyle(t),s={};for(const[c,d,m]of Nmn){const g=vTt(n.getPropertyValue(d));g!==null&&(g.length===9&&!m||(s[c]=m&&g.length===7?`${g}${m}`:g))}for(const[c,d]of Omn){const m=vTt(n.getPropertyValue(d));m!==null&&(s[c]=m)}return s}let xm=null,Jjt=0;const Uje=new Set;function Fmn(t){return Uje.add(t),()=>Uje.delete(t)}function bTt(){return Jjt}const ROe=new Map;function Wjt(t,n){ROe.get(t)?.disconnect(),ROe.delete(t);const s=()=>{const d=n?.isConnected?n.getBoundingClientRect():null;JAr(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),ROe.set(t,c)}function Mmn(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&&Hjt(t,n),Wjt(t,n),Jjt+=1;for(const s of Uje)s()}}function Hjt(t,n){n.dataset.volterPart=t}const HO=new Map;let Gjt=0;const Jje=new Set,Kjt=new Set;let STt=!1;function xTt(){for(const t of l0())Kjt.add(t.descriptor.id)}function jmn(t){STt||(STt=!0,i2(xTt)),xTt(),!(!t||Kjt.has(t))&&(ytn(t)||wFt(t,!1))}function Lmn(t,n){if(n){if(!HO.delete(t.id))return}else{HO.has(t.id)||jmn(t.documentId);const s=HO.get(t.id);if(s?.element===t.element&&s.documentId===t.documentId)return;HO.set(t.id,{...t})}Gjt+=1;for(const s of[...Jje])s()}function Bmn(t){return Jje.add(t),()=>{Jje.delete(t)}}function wTt(){return Gjt}function GO({children:t,row:n=!1,center:s=!1}){return $.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 $mn({children:t}){return $.jsx($.Fragment,{children:t})}function qmn(){return xm?MS.createPortal($.jsx(GO,{center:!0,children:$.jsx(Wdn,{})}),xm.header):null}function zmn(){return null}function Vmn(){const t=Ye.useRef(null);return Ye.useEffect(()=>{const n=t.current;if(n)return ujt(n),()=>Qun(n)},[]),$.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[$.jsx("div",{ref:t,className:"volter-vscode-outliner-header",style:{padding:"var(--volter-space-2) var(--volter-space-4)","--volter-hierarchy-search-basis":"100%"}}),$.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:$.jsx(yjt,{})})]})}const Pme=new Map,Wje=new Set;let Hje=0;function Umn(t,n){if(n){if(Pme.get(t)===n)return;n.dataset.volterUtility=t,Pme.set(t,n)}else if(!Pme.delete(t))return;Hje++;for(const s of Wje)s()}const Ime=new Map,Gje=new Set;let Kje=0;function Jmn(t,n){if(n){if(Ime.get(t)===n)return;Ime.set(t,n)}else if(!Ime.delete(t))return;Kje++;for(const s of Gje)s()}function Wmn(){return Ye.useSyncExternalStore(T3t,dht,dht),Ye.useSyncExternalStore(t=>(Gje.add(t),()=>Gje.delete(t)),()=>Kje,()=>Kje),$.jsx($.Fragment,{children:[...fRe("left"),...fRe("right")].map(t=>{const n=Ime.get(t.id);if(!n)return null;const s=t.Content;return $.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(s,{}),n)},t.id)})})}function Hmn(){return Ye.useSyncExternalStore(Jye,hhe,hhe),Ye.useSyncExternalStore(t=>(Wje.add(t),()=>Wje.delete(t)),()=>Hje,()=>Hje),$.jsx($.Fragment,{children:SC().map(t=>{const n=Pme.get(t.id);return n?$.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(GO,{children:$.jsx(Kdn,{utility:t})}),n)},t.id):null})})}function Gmn({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]),MS.createPortal($.jsxs(GO,{children:[$.jsx(RMt,{descriptor:t,viewId:n,active:d,chrome:!t.area}),m&&$.jsx(Oun,{})]}),g)}let Xjt=!0;function Kmn({arrangement:t,immersivePlay:n}){const s=Yv();rmn(s);const c=zVe(s);Ye.useLayoutEffect(()=>{Xjt=c.column},[c.column]);const d=HO.get(bRe()??"")?.element??xm?.center;Ye.useLayoutEffect(()=>{if(!d)return;const F=()=>Twt({x:0,y:0,width:d.clientWidth,height:d.clientHeight}),D=new ResizeObserver(F);return D.observe(d),F(),()=>{D.disconnect(),Twt(null)}},[d]),Ye.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(Bmn,wTt,wTt),Ye.useSyncExternalStore(Fmn,bTt,bTt),Ye.useLayoutEffect(()=>{const F=YEr({...t?{arrangement:t}:{},...n===void 0?{}:{immersivePlay:n},playUtilities:[]});return t&&s2(t.id),Ekr(),F},[t,n]);const m=s.playState!=="stopped",g=Ye.useSyncExternalStore(bee,NR).play?.keepPanelsVisible;if(Ye.useEffect(()=>{j_n(m,Rjt())},[m,n,g]),Ye.useEffect(()=>Vjt(s),[s]),!xm)return null;const S=xm.center,k=l0(),A=CC()??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}))},$.jsxs($.Fragment,{children:[[...HO.values()].map(F=>{const D=k.find(J=>J.descriptor.id===F.documentId)?.descriptor;return D?$.jsx(Gmn,{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&&MS.createPortal($.jsx(GO,{children:$.jsx("div",{className:"volter-vscode-empty",children:"No document open"})}),xm.center),xm.outliner&&MS.createPortal($.jsx(GO,{children:$.jsx(Vmn,{})}),xm.outliner),xm.properties&&MS.createPortal($.jsx(GO,{children:c.column?$.jsx(GVe,{}):$.jsx(Eun,{surface:c.surface})}),xm.properties),xm.content&&MS.createPortal($.jsx(GO,{children:$.jsx(m_n,{kind:"assets"})}),xm.content),$.jsx(Hmn,{}),$.jsx(Wmn,{})]})}async function Xmn(t,n={}){xm=t,n.workspaceStorage&&HAr(n.workspaceStorage),t3r();for(const[Fe,De]of Object.entries(t))De&&Hjt(Fe,De),Wjt(Fe,De??null);t.chromeRoot.id="editor-chrome-root",APt({Frame:$mn,Header:qmn,Footer:zmn,Workspace:Kmn,Document:wcn}),g_n(),Onn();const s=Oln();s&&Iln(s,Date.now())&&ea.warn(Dln(s,Date.now()),"editor"),nmn(),CDr(),z_n(),Imn(),await Promise.all([V4t(),Zkr(),YDt()]),pAr(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),Xje.createRoot(c).render($.jsx(Xln,{}));const d={activeKeymap:()=>n0().keyboard.activeKeymap(),invoke:Fe=>n0().keyboard.invoke(Fe),subscribe:Fe=>n0().keyboard.subscribe(Fe),facts:()=>{const Fe=n0(),De=Fe.keyboard.stage();return{surface:De.surface,mode:De.mode,documentKind:Fe.documents.active()?.kind??null,play:Fe.session.playState()}},report:(Fe,De)=>{const be=n0();Fe==="error"?be.console.error(De,"editor"):be.console.warn(De,"editor")}};let m=!1;const g={whenRestored:sUe,activeSource:()=>{const Fe=n0().documents.active();if(!Fe)return null;const De=Fe.kind==="model"&&Fe.id.startsWith("model:")?Fe.id.slice(6):"";return{kind:Fe.kind,path:De}},list:()=>l0().map(Fe=>{const De=Fe.descriptor.area?ykr().find(be=>be.id===Fe.descriptor.area):void 0;return{id:Fe.descriptor.id,title:Fe.title,...De?{area:{id:De.id,place:De.place,ratio:De.ratio}}:{}}}),activeId:()=>CC()?.descriptor.id??null,subscribe:Fe=>{m=!0;const De=i2(Fe),be=vkr(Fe);return()=>{De(),be()}},activate:(Fe,De)=>{!m&&HQ()||(De?fTr(Fe,De):X0(Fe))},close:Fe=>{if(EN(Fe))return;const De=l0().find(be=>be.descriptor.id===Fe);De&&d.report("warn",`“${De.title}” has unsaved changes, so it stayed open. Save it (⌘S) and close it again.`)},setView:(Fe,De)=>Lmn(Fe,De)},S={elements:()=>n0().history.elements(),onElement:Fe=>n0().history.onElement(Fe),onInvalidated:Fe=>n0().history.onInvalidated(Fe),changed:()=>n0().history.changed(),focusedResource:()=>n0().history.focusedResource(),focusedDocument:()=>{const Fe=n0().documents.active();return Fe?{id:Fe.id,label:Fe.title}:null},setDelegate:Fe=>n0().history.setDelegate(Fe),report:d.report},k={setProvider:Fe=>n0().files.setProvider(Fe),report:d.report},A={setProvider:Fe=>n0().settings.setProvider(Fe),adapterValues:()=>[...EEr()],workbenchValues:()=>{const Fe=xm?.chromeRoot;if(!Fe)return[];const De=getComputedStyle(Fe).getPropertyValue("--volter-command-bar-height").trim(),be=Number.parseFloat(De),X=["workbench.colorCustomizations",Rmn(Fe)];return!Number.isFinite(be)||be<=0?[X]:[["window.titleBarHeight",Math.round(be)],X]},lookId:()=>DN(),notify:Fe=>{n0().notify(Fe)},subscribe:Fe=>{const De=zye(Fe),be=wDt(Fe);return()=>{De(),be()}},report:d.report},F={list:()=>Mnn().map(Fe=>({id:Fe.id,label:Fe.label,category:Fe.category,...Fe.menu?{menu:Fe.menu}:{}})),invoke:Fe=>Lnn(Fe),subscribe:Fe=>jnn(Fe),setPaletteOpener:Fe=>Fnn(Fe),setCommandExecutor:Fe=>Bnn(Fe),report:d.report},D={setDelegate:Fe=>JCr(Fe?{show:De=>Fe({...De,source:e3r()})}:null)},J={list:()=>IPt().map(Fe=>({view:Fe.view,title:Fe.title,verbs:Fe.verbs.map(De=>({id:De.id,...De.title?{title:De.title}:{}}))})),invoke:(Fe,De,be)=>OPt(Fe,De,be),subscribe:Fe=>NPt(Fe)},q={list:()=>SC().map((Fe,De)=>({id:Fe.id,title:Fe.title,order:Fe.order??De})),subscribe:Fe=>{let De=hhe();const be=Jye(Fe),X=HVe(()=>{const we=hhe();we!==De&&(De=we,Fe())});return()=>{be(),X()}},offerBody:(Fe,De)=>Umn(Fe,De)};let G=!0,se=null,pe=null;urn(()=>G);const ue={setActiveStaticPanel:Fe=>Xht(wVe.find(De=>De.kind===Fe)?.kind??null),focusCompactInspector:()=>{if(Xjt)return!1;const Fe=xm?.center.querySelector('[data-testid="compact-inspector-card"]');return Fe?(Fe.tabIndex=-1,Fe.focus(),Xht("inspector"),!0):!1},setPaneActive:Fe=>{G!==Fe&&(G=Fe)},setImmersive:Fe=>{se?.(),se=null,!(!Fe||!xm)&&(se=I_n({root:xm.chromeRoot,hideChrome:()=>Fe.enter(),showChrome:()=>Fe.exit()}))},setDockCommands:Fe=>{pe?.(),pe=null,Fe&&(pe=ekr({showUtility:De=>Fe.showUtility(De),toggleUtility:De=>Fe.toggleUtility(De),ensureUtility:De=>Fe.ensureUtility(De),closeUtility:De=>Fe.closeUtility(De),showStaticPanel:De=>Fe.showStaticPanel(De),setFocus:De=>Fe.setFocus(De),toggleFocus:()=>Fe.toggleFocus(),captureUtilities:De=>{for(const be of De)Fe.showUtility(be);return()=>{for(const be of De)Fe.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:(Fe,De)=>d.report(Fe,De)};return{host:c,keyboard:d,documents:g,history:S,files:k,commands:F,notifications:D,views:J,utilities:q,output:{setProvider:q_n},settings:A,status:{list:()=>["left","right"].flatMap(Fe=>fRe(Fe).map((De,be)=>({id:De.id,title:De.name,align:Fe,order:De.order??be}))),subscribe:Fe=>T3t(Fe),offerBody:(Fe,De)=>Jmn(Fe,De)},game:ue,offerPart:Mmn}}function Ymn(t){const n=Object.keys(t.packages);return o0r({id:t.id,packages:n,look:t.look,workspace:t.workspace,nativeMenus:t.nativeMenus,logo:t.logo}),ODt(n.flatMap(s=>t.packages[s]??[])),{mountVolter:Xmn}}const{mountVolter:awn}=Ymn({id:"game-editor",packages:{"@volter/editor-game":t0r,"@volter/editor-react":r0r,"@volter/editor-threejs":n0r,"@volter/editor-xstate":i0r,"@volter/editor-blender":e0r},look:"classic",workspace:"game",logo:"https://brand.volter.ai/logo/volter-game-editor/svg",nativeMenus:!0});export{_Sn as $,_3t as A,DB as B,m3t as C,h3t as D,u0 as E,OC as F,Xze as G,nRe as H,rSn as I,k2n as J,Yv as K,Ih as L,VXr as M,p3t as N,ea as O,f3t as P,Jl as Q,g3t as R,Dwr as S,W0n as T,zFt as U,ztn as V,ZLe as W,WFt as X,L_ as Y,CN as Z,fo as _,XY as a,a2n as a$,Ms as a0,dc as a1,Kk as a2,H0n as a3,bC as a4,jgn as a5,zsn as a6,Kan as a7,Z2n as a8,Wze as a9,hy as aA,oq as aB,uMt as aC,F3r as aD,tSn as aE,qxn as aF,r0n as aG,F_e as aH,S0n as aI,hAr as aJ,_p as aK,dm as aL,Zm as aM,rwn as aN,Q0e as aO,l0 as aP,wFt as aQ,TD as aR,Jyn as aS,OCr as aT,H0e as aU,PRt as aV,Nze as aW,DSn as aX,Zf as aY,P9t as aZ,o2n as a_,MB as aa,Bwr as ab,QFt as ac,Ubn as ad,n0n as ae,Go as af,$gn as ag,Eye as ah,Bun as ai,G0e as aj,Vwr as ak,jxn as al,V0e as am,rq as an,Cze as ao,Tze as ap,nYr as aq,aan as ar,f$e as as,Rtn as at,fRt as au,Mtn as av,of as aw,Y0 as ax,mp as ay,I0n as az,QLe as b,v2n as b$,j4r as b0,s2n as b1,yC as b2,S$e as b3,vTr as b4,X7e as b5,ig as b6,bFt as b7,lYr as b8,$bn as b9,fu as bA,b2n as bB,w2n as bC,T2n as bD,C2n as bE,LSt as bF,_2n as bG,x2n as bH,S2n as bI,UZr as bJ,BSt as bK,d2n as bL,jD as bM,gZr as bN,USt as bO,f2n as bP,VZr as bQ,c2n as bR,h2n as bS,Zbn as bT,Qbn as bU,kZr as bV,E2n as bW,BZr as bX,DZr as bY,n2n as bZ,i2n as b_,hRt as ba,dRt as bb,gRt as bc,HXr as bd,omn as be,own as bf,uSn as bg,_Rt as bh,aYr as bi,nvn as bj,M0n as bk,F0n as bl,D3r as bm,$0n as bn,Rhe as bo,Jbn as bp,Gbn as bq,ftn as br,g3r as bs,y3r as bt,Mwr as bu,Wbn as bv,ctn as bw,ZFt as bx,ed as by,_y as bz,iRe as c,R_ as c$,p2n as c0,K0e as c1,$Zr as c2,qZr as c3,MRt as c4,LRt as c5,AZr as c6,t2n as c7,RZr as c8,e2n as c9,zSn as cA,Uye as cB,dR as cC,byn as cD,mO as cE,Vv as cF,Syn as cG,T0r as cH,E0r as cI,iLe as cJ,myn as cK,M3t as cL,bZ as cM,ayn as cN,n$ as cO,xhn as cP,aR as cQ,pBe as cR,Nc as cS,tLe as cT,HTt as cU,KTt as cV,dhn as cW,J0r as cX,D0n as cY,P0n as cZ,PI as c_,zZr as ca,g2n as cb,OZr as cc,jze as cd,jRt as ce,NZr as cf,SMe as cg,PZr as ch,l2n as ci,i_e as cj,MZr as ck,VSt as cl,zSt as cm,LZr as cn,wZr as co,Mze as cp,bMe as cq,FZr as cr,y2n as cs,m2n as ct,r2n as cu,JZr as cv,u2n as cw,Qen as cx,X0 as cy,ixt as cz,d3t as d,pSr as d$,Vxn as d0,cBe as d1,Cm as d2,mfn as d3,i0 as d4,I2n as d5,kDr as d6,Lun as d7,DRe as d8,i$ as d9,a4t as dA,lLe as dB,YB as dC,Uxn as dD,Jxn as dE,kfn as dF,CAr as dG,E0n as dH,KBe as dI,ugt as dJ,x0n as dK,lhn as dL,Nvr as dM,fgt as dN,vAr as dO,mAr as dP,GBe as dQ,gAr as dR,s0r as dS,nye as dT,LOe as dU,_yn as dV,Fsn as dW,yZ as dX,sAt as dY,AR as dZ,pxr as d_,oan as da,nan as db,NVe as dc,USn as dd,f0r as de,p0r as df,l0r as dg,Iw as dh,CTt as di,H1 as dj,Ugn as dk,oen as dl,nSn as dm,rtn as dn,aMt as dp,l2 as dq,qAr as dr,Hbn as ds,lMt as dt,fQ as du,hhn as dv,cEr as dw,qTt as dx,SZ as dy,ACr as dz,u3t as e,ghn as e$,t$ as e0,Vme as e1,iCt as e2,L0n as e3,W0 as e4,U0n as e5,R2n as e6,mSn as e7,Z0n as e8,jhe as e9,iyn as eA,iSn as eB,NYr as eC,Dze as eD,ERt as eE,l4t as eF,ttn as eG,cYr as eH,E4t as eI,D5e as eJ,Iye as eK,kon as eL,eLe as eM,yhn as eN,c0r as eO,w4t as eP,Ion as eQ,Lht as eR,k5e as eS,Aht as eT,c0 as eU,Kyn as eV,san as eW,NRe as eX,yBe as eY,Zyn as eZ,BCr as e_,w4r as ea,NQr as eb,Q0n as ec,u$e as ed,tvn as ee,evn as ef,Bbn as eg,WSn as eh,JSn as ei,J0n as ej,hBe as ek,nhe as el,pyn as em,G0 as en,Cyn as eo,YY as ep,Dyn as eq,C_e as er,Lyn as es,sQ as et,Bgn as eu,Rw as ev,Thn as ew,MTr as ex,ASn as ey,eSn as ez,oRe as f,J9t as f$,u0n as f0,l0n as f1,CC as f2,nFe as f3,wee as f4,kN as f5,Tve as f6,mmn as f7,mYr as f8,ND as f9,khn as fA,w0r as fB,Ehn as fC,Nme as fD,jOe as fE,ZTt as fF,v0n as fG,Tyn as fH,cxn as fI,ban as fJ,exn as fK,TR as fL,bxn as fM,txn as fN,Jze as fO,Lbn as fP,bRt as fQ,_Tr as fR,eTr as fS,VSn as fT,oSn as fU,aSn as fV,a0 as fW,sSn as fX,HQ as fY,qSn as fZ,NSn as f_,qwr as fa,FTr as fb,T_e as fc,etn as fd,p$e as fe,r3r as ff,tfn as fg,$xn as fh,Bxn as fi,Lxn as fj,wve as fk,EN as fl,g0n as fm,k0n as fn,swn as fo,iwn as fp,cSn as fq,lSn as fr,g4t as fs,i0n as ft,_hn as fu,Shn as fv,w0n as fw,y0n as fx,Wxn as fy,aPt as fz,y3t as g,rA as g$,CRt as g0,zQ as g1,Cfn as g2,Fun as g3,CR as g4,WXr as g5,qbn as g6,jtn as g7,ADr as g8,Pg as g9,Lgn as gA,DFe as gB,u3r as gC,rvn as gD,m0r as gE,Vbn as gF,hYr as gG,Eht as gH,JTt as gI,i2 as gJ,X1 as gK,CSn as gL,ESn as gM,Fwr as gN,Fgn as gO,TSn as gP,Rgn as gQ,wSn as gR,GFt as gS,z2n as gT,xR as gU,QQr as gV,Lrn as gW,whn as gX,zTt as gY,OTt as gZ,jTr as g_,kSn as ga,u0r as gb,fee as gc,N2n as gd,X2n as ge,O2n as gf,nyn as gg,K2n as gh,fN as gi,Zje as gj,sLe as gk,i4r as gl,V2n as gm,N0n as gn,G2n as go,O0n as gp,Y0n as gq,Dw as gr,sf as gs,hR as gt,v3r as gu,R0n as gv,SSn as gw,sPt as gx,inn as gy,nwn as gz,WAt as h,Hyn as h$,AC as h0,tA as h1,bhn as h2,V0n as h3,sBe as h4,X0e as h5,Ybn as h6,uCt as h7,Ian as h8,Cxn as h9,OTr as hA,Tht as hB,Lye as hC,ETr as hD,CTr as hE,UTr as hF,hyn as hG,vyn as hH,yyn as hI,xyn as hJ,wyn as hK,Gyn as hL,dyn as hM,Uyn as hN,Ym as hO,s4t as hP,uyn as hQ,fyn as hR,$ye as hS,gyn as hT,gBe as hU,syn as hV,zyn as hW,Vyn as hX,rhe as hY,e0n as hZ,Cht as h_,fYr as ha,B0n as hb,Mgn as hc,b0n as hd,dBe as he,Hgn as hf,Ygn as hg,tyn as hh,R$ as hi,CD as hj,Ggn as hk,Jgn as hl,Wgn as hm,Zgn as hn,Yyn as ho,Xyn as hp,RTr as hq,$Cr as hr,wht as hs,gC as ht,xRe as hu,L3t as hv,cyn as hw,lyn as hx,TRe as hy,wRe as hz,Pp as i,Qje as i$,jCr as i0,Eyn as i1,c4t as i2,she as i3,kCr as i4,OG as i5,Q3t as i6,q3t as i7,PTr as i8,qTr as i9,GTr as iA,WTr as iB,NG as iC,$yn as iD,t0n as iE,TCr as iF,PCr as iG,DTr as iH,Ryn as iI,kyn as iJ,ahe as iK,Byn as iL,E5e as iM,ATr as iN,vBe as iO,Pyn as iP,q$ as iQ,Ayn as iR,Nyn as iS,jSn as iT,$Sn as iU,Cee as iV,AD as iW,gcn as iX,Fxn as iY,S5e as iZ,Exn as i_,Oyn as ia,Iyn as ib,Fyn as ic,Myn as id,Wyn as ie,kTr as ig,ECr as ih,e4t as ii,Qyn as ij,LTr as ik,qyn as il,jyn as im,VTr as io,E_e as ip,ERe as iq,HTr as ir,JTr as is,LCr as it,zTr as iu,yee as iv,Rye as iw,KTr as ix,Epe as iy,kRe as iz,VAt as j,Txn as j$,nee as j0,Ifn as j1,Gxn as j2,nPt as j3,h3r as j4,eBe as j5,$wr as j6,uht as j7,Iwr as j8,v3t as j9,ZHr as jA,eGr as jB,rGr as jC,Q2n as jD,Owr as jE,dVe as jF,ann as jG,ste as jH,Gsn as jI,Gxt as jJ,wI as jK,RFe as jL,vxn as jM,ohn as jN,uhn as jO,chn as jP,gxn as jQ,ahn as jR,_0r as jS,yxn as jT,San as jU,sxn as jV,oxn as jW,Aon as jX,Sxn as jY,ixn as jZ,Aan as j_,hsn as ja,H2n as jb,HI as jc,zMe as jd,qgn as je,qRt as jf,Y0e as jg,Tye as jh,cN as ji,XLe as jj,Pye as jk,lN as jl,OAr as jm,TBe as jn,uBe as jo,Dye as jp,YLe as jq,Kye as jr,Oin as js,A9t as jt,jTt as ju,FB as jv,sN as jw,L2n as jx,Mxn as jy,O_n as jz,Ewr as k,Uwr as k$,KSn as k0,xxn as k1,rxn as k2,QSn as k3,XSn as k4,dxn as k5,ZSn as k6,YSn as k7,nxn as k8,fxn as k9,fhn as kA,rLe as kB,vEr as kC,vve as kD,bve as kE,xSn as kF,PMt as kG,OMt as kH,Uxt as kI,NFe as kJ,q_e as kK,OFe as kL,Mun as kM,KVe as kN,kxn as kO,Ofn as kP,h0n as kQ,G0r as kR,Y2n as kS,gR as kT,vDr as kU,yve as kV,U$ as kW,eA as kX,mD as kY,Jwr as kZ,Wwr as k_,axn as ka,pxn as kb,c$e as kc,lxn as kd,HSn as ke,wxn as kf,GSn as kg,_xn as kh,_Ve as ki,uxn as kj,xan as kk,mxn as kl,hxn as km,FSn as kn,OSn as ko,MSn as kp,U2n as kq,TDr as kr,e6t as ks,J2n as kt,RSn as ku,wD as kv,J0 as kw,GSt as kx,LAt as ky,Y4 as kz,Gme as l,Qxn as l$,Aye as l0,mhn as l1,M0r as l2,YAr as l3,ZAr as l4,phn as l5,ejt as l6,zgn as l7,Rwr as l8,zwr as l9,oyn as lA,dCt as lB,bSn as lC,T0n as lD,Hxn as lE,shn as lF,Axn as lG,Dxn as lH,vhn as lI,Chn as lJ,LSn as lK,Kxn as lL,Xxn as lM,_jt as lN,BSn as lO,Kgn as lP,Asn as lQ,Qgn as lR,zxn as lS,ewn as lT,A0n as lU,EAr as lV,bAr as lW,C0n as lX,ryn as lY,Xgn as lZ,eyn as l_,OPt as la,Rxn as lb,Oxn as lc,Pxn as ld,Nxn as le,Ixn as lf,p0n as lg,k3r as lh,z0n as li,q0n as lj,W2n as lk,Efn as ll,Kbn as lm,Xbn as ln,fSn as lo,t9t as lp,ojt as lq,Yxn as lr,twn as ls,zbn as lt,PSn as lu,wfn as lv,Emn as lw,kmn as lx,nq as ly,ODr as lz,rQ as m,V1r as m$,lrn as m0,j0n as m1,mEr as m2,Dhn as m3,M2n as m4,P2n as m5,j2n as m6,CQr as m7,REr as m8,DEr as m9,Lme as mA,eht as mB,F_ as mC,Bme as mD,$me as mE,Lbr as mF,Vbr as mG,yB as mH,Ebr as mI,Abr as mJ,EEt as mK,Rbr as mL,CEt as mM,Tbr as mN,Cbr as mO,dbr as mP,pbr as mQ,c2r as mR,eh as mS,z1r as mT,ebr as mU,xEt as mV,Z1r as mW,G1r as mX,SEt as mY,X1r as mZ,W1r as m_,eve as ma,Vtn as mb,o0n as mc,m0n as md,s0n as me,c0n as mf,a0n as mg,Nsn as mh,_0n as mi,gSn as mj,ySn as mk,hSn as ml,vSn as mm,hEr as mn,gEr as mo,$Re as mp,bN as mq,ISn as mr,Vgn as ms,uje as mt,PAt as mu,Ixr as mv,YI as mw,Gvr as mx,gCt as my,n1r as mz,vB as n,Fbr as n$,rbr as n0,H1r as n1,U1r as n2,$1r as n3,q1r as n4,nbr as n5,tbr as n6,K1r as n7,J1r as n8,Q1r as n9,hbr as nA,m2r as nB,Qbr as nC,wbr as nD,Xbr as nE,l2r as nF,fbr as nG,$br as nH,s2r as nI,jbr as nJ,n2r as nK,TEt as nL,Obr as nM,Ubr as nN,Jbr as nO,PEt as nP,u2r as nQ,o2r as nR,_2r as nS,f2r as nT,Fw as nU,Kbr as nV,g2r as nW,Ybr as nX,hye as nY,M_ as nZ,a2r as n_,mye as na,Y1r as nb,IEt as nc,h2r as nd,Nbr as ne,zbr as nf,i2r as ng,Hbr as nh,Dbr as ni,cbr as nj,ubr as nk,fLe as nl,Zbr as nm,ICt as nn,r2r as no,e2r as np,p2r as nq,sbr as nr,Sbr as ns,xbr as nt,ybr as nu,gbr as nv,bbr as nw,vbr as nx,Gbr as ny,Ibr as nz,Awr as o,x2r as o$,d2r as o0,t2r as o1,DEt as o2,vu as o3,_br as o4,lbr as o5,abr as o6,Mbr as o7,hLe as o8,Bbr as o9,$Et as oA,iSr as oB,z2r as oC,OCt as oD,FCt as oE,mgn as oF,ngn as oG,XEt as oH,NEt as oI,jEt as oJ,NCt as oK,RCt as oL,K2r as oM,lgn as oN,nSr as oO,k2r as oP,A2r as oQ,QZ as oR,qk as oS,XOe as oT,H2r as oU,E2r as oV,D2r as oW,O2r as oX,ign as oY,UEt as oZ,JEt as o_,qbr as oa,mbr as ob,Wbr as oc,Phn as od,ui as oe,Vhn as of,zhn as og,ibr as oh,jmt as oi,Jhn as oj,L2r as ok,rSr as ol,GEt as om,KEt as on,N2r as oo,I2r as op,ygn as oq,aSr as or,WEt as os,HEt as ot,Ghn as ou,Hhn as ov,Khn as ow,Whn as ox,Uhn as oy,BEt as oz,zAt as p,Z2r as p$,S2r as p0,T2r as p1,w2r as p2,YEt as p3,VEt as p4,xgn as p5,ekt as p6,fgn as p7,J2r as p8,ZZ as p9,Xhn as pA,wgn as pB,egn as pC,bgn as pD,sgn as pE,oSr as pF,U2r as pG,jCt as pH,BCt as pI,MCt as pJ,LCt as pK,pye as pL,_ye as pM,cgn as pN,ZEt as pO,tSr as pP,G2r as pQ,v2r as pR,gye as pS,uSr as pT,ggn as pU,sSr as pV,F2r as pW,Sgn as pX,Q2r as pY,eSr as pZ,dgn as p_,XI as pa,b2r as pb,agn as pc,QEt as pd,yLe as pe,X2r as pf,jme as pg,eQ as ph,YOe as pi,V2r as pj,LEt as pk,ugn as pl,Yhn as pm,$2r as pn,Qhn as po,hgn as pp,Zhn as pq,Y2r as pr,j2r as ps,_gn as pt,C2r as pu,pgn as pv,M$ as pw,fye as px,dye as py,vgn as pz,Twr as q,kLe as q$,ogn as q0,P2r as q1,R2r as q2,qEt as q3,M2r as q4,tgn as q5,B2r as q6,W2r as q7,gLe as q8,OEt as q9,B1r as qA,y2r as qB,Bhn as qC,qhn as qD,Lhn as qE,$hn as qF,p1r as qG,_1r as qH,d1r as qI,Nhn as qJ,Ihn as qK,obr as qL,Egn as qM,Tgn as qN,xLe as qO,BLe as qP,$Le as qQ,qLe as qR,rAt as qS,Zkt as qT,nAt as qU,FLe as qV,MLe as qW,zLe as qX,OLe as qY,RLe as qZ,ELe as q_,REt as qa,FEt as qb,MEt as qc,q2r as qd,zEt as qe,rgn as qf,sA as qg,$S as qh,qme as qi,fSr as qj,Fhn as qk,jhn as ql,cSr as qm,Rhn as qn,Mhn as qo,u1r as qp,f1r as qq,HOe as qr,sD as qs,wEt as qt,kbr as qu,Pbr as qv,lSr as qw,Bmt as qx,$mt as qy,Ohn as qz,n0 as r,yAt as r$,wAt as r0,KLe as r1,xye as r2,mee as r3,gAt as r4,oAt as r5,jLe as r6,wLe as r7,TLe as r8,tQ as r9,j$ as rA,vye as rB,WLe as rC,GLe as rD,vAt as rE,IAt as rF,EAt as rG,Mw as rH,Sye as rI,uAt as rJ,j_ as rK,xAt as rL,Gkt as rM,AAt as rN,pAt as rO,cAt as rP,Lu as rQ,ALe as rR,yye as rS,aD as rT,Kkt as rU,bye as rV,Qkt as rW,tAt as rX,DLe as rY,iAt as rZ,SLe as r_,Cgn as ra,_At as rb,dAt as rc,nht as rd,NAt as re,zme as rf,ILe as rg,NLe as rh,$kt as ri,Lkt as rj,Ukt as rk,zkt as rl,aAt as rm,rht as rn,LLe as ro,PLe as rp,DAt as rq,fAt as rr,Hkt as rs,lAt as rt,CAt as ru,CLe as rv,eAt as rw,HLe as rx,Xkt as ry,hAt as rz,JAt as s,OAt as s$,tht as s0,lxr as s1,WSr as s2,HSr as s3,ixr as s4,TAt as s5,Axr as s6,USr as s7,JSr as s8,Cxr as s9,VSr as sA,Oxr as sB,KSr as sC,dxr as sD,$Sr as sE,_xr as sF,gxr as sG,zSr as sH,yxr as sI,Pxr as sJ,Txr as sK,FSr as sL,bxr as sM,VLe as sN,SAt as sO,Ykt as sP,Jme as sQ,xxr as sR,Ume as sS,_Sr as sT,mSr as sU,hxr as sV,Wme as sW,bAt as sX,FAt as sY,kxr as sZ,kAt as s_,MSr as sa,jSr as sb,fxr as sc,vSr as sd,SSr as se,Dxr as sf,GSr as sg,ESr as sh,RSr as si,ySr as sj,bSr as sk,mAt as sl,Sxr as sm,exr as sn,txr as so,Agn as sp,kSr as sq,QSr as sr,ZSr as ss,YSr as st,OSr as su,ZOe as sv,rxr as sw,oxr as sx,ULe as sy,qSr as sz,Pa as t,wSr as t0,CSr as t1,xSr as t2,TSr as t3,hSr as t4,gSr as t5,vxr as t6,kgn as t7,XSr as t8,Nxr as t9,avr as tA,svr as tB,awn as tC,Ahn as tD,Dgn as tE,Pgn as tF,Ign as tG,Ngn as tH,Ogn as tI,bEr as tJ,f0n as tK,d0n as tL,G0n as tM,K0n as tN,X0n as tO,jbn as tP,A2n as tQ,D2n as tR,PQr as tS,F2n as tT,B2n as tU,$2n as tV,q2n as tW,dSn as tX,pSn as tY,crn as tZ,Zxn as t_,wxr as ta,RAt as tb,axr as tc,Exr as td,JLe as te,nxr as tf,sxr as tg,LSr as th,cxr as ti,NSr as tj,ASr as tk,DSr as tl,PSr as tm,ISr as tn,uxr as to,BSr as tp,mxr as tq,ovr as tr,QTt as ts,Dmt as tt,Ome as tu,ivr as tv,nvr as tw,PG as tx,rCt as ty,tCt as tz,Gd as u,bo as v,Dg as w,e_ as x,gen as y,cFt as z};
|
|
1409
|
+
${s.componentStack??""}`,"editor")}render(){return this.state.error?$.jsxs("div",{role:"alert","data-testid":"static-panel-crashed",style:{padding:12,display:"grid",gap:8,alignContent:"start"},children:[$.jsxs("strong",{children:[this.props.title," crashed."]}),$.jsx("span",{style:{opacity:.8,wordBreak:"break-word"},children:this.state.error.message}),$.jsx("div",{children:$.jsx(Ms,{type:"button",variant:"outline",size:"compact",onClick:()=>this.setState({error:null}),children:"Retry"})})]}):this.props.children}}const p_n=wVe.map(t=>{const n=f_n[t.kind],s=c=>$.jsx(d_n,{title:t.title,children:$.jsx(n,{...c})});return s.displayName=`StaticPanel(${t.kind})`,{...t,Content:s}});function __n(t){return p_n.find(n=>n.kind===t)}function m_n({kind:t,dependencies:n}){const{Content:s}=__n(t);return $.jsx(s,{dependencies:n})}const h_n=250;function g_n(){const t=D4t(),n=y_n();return()=>{n(),t()}}function y_n(){const t=new Map;let n=null,s=!1;function c(){const g=[],S=new Set;for(const k of ea.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:wC})}const m=ea.subscribe(()=>{if(s)return;const g=ea.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,h_n))});return bN("console-entries",{entries:[],_clientId:wC}),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],Zxn=Object.freeze(Object.defineProperty({__proto__:null,PHASE_ORDER:yZ,SystemPhase:Y4},Symbol.toStringTag,{value:"Module"})),tye=1e-9,Pjt=1e5;function v_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=s.end-g;if(!d||S<=F+tye){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>Pjt){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 b_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=g-s.start;if(!d||S<=F+tye){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>Pjt){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 cTt(t,n){return t<n.start?n.start:t>n.end?n.end:t}class S_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=cTt(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=cTt(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"?v_n(c,s,this._range):b_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},x_n=150;class Qxn{constructor(n){this.store=n,this.stopStoreWatch=n.subscribe(()=>this.notify())}clock=new S_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()},x_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 Eme=new Map,$je=new Set;function lTt(){for(const t of[...$je])t()}function ewn(t,n){return Eme.set(t,n),lTt(),()=>{Eme.get(t)===n&&(Eme.delete(t),lTt())}}function w_n(t){return t===null?null:Eme.get(t)??null}function T_n(t){return $je.add(t),()=>{$je.delete(t)}}let kme=null;function twn(t){return kme=t,()=>{kme===t&&(kme=null)}}function xve(){return kme}const Ijt="__volterWorkspacePersistenceSuppressed";function Njt(){return globalThis}function Ojt(t){Njt()[Ijt]=t}function C_n(){return Njt()[Ijt]===!0}function Rjt(){return(See()?.immersivePlay??!1)&&!NR().play?.keepPanelsVisible}const Fjt={phase:"idle",flightDone:!1,gameReady:!1};function E_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 k_n(t,n){if(n==="stop")return Fjt;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 E_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 A_n=450,D_n=220,Mjt=250;function P_n(t){t.style.setProperty("--volter-play-dissolve-duration",`${A_n}ms`),t.style.setProperty("--volter-play-materialize-duration",`${D_n}ms`),t.style.setProperty("--volter-play-crossfade-duration",`${Mjt}ms`)}let SD=null;function I_n(t){return SD=t,typeof document<"u"&&P_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 N_n(){return Qk?.state.phase??"idle"}const Ame=new Set;function Ljt(){if(Ame.size===0)return;const t=[...Ame];Ame.clear();for(const n of t)n()}function O_n(t){if(!Qk||Qk.state.phase==="playing"){t();return}Ame.add(t)}function R_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=k_n(s,t);c!==s&&(n.state=c,c.phase==="crossfade"&&s.phase!=="crossfade"&&(SD?.root.classList.add("volter-play-crossfade"),R_n(n,Mjt+30,()=>gB("crossfade-done"))),c.phase==="playing"&&s.phase!=="playing"&&(SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),n.flying&&xve()?.settle(),Ljt()))}function F_n(){M_n({immersive:Rjt()})}function M_n(t){if(Qk&&oUe(),!t.immersive)return;const n=jjt();Ojt(!0);const s={state:Fjt,reducedMotion:n,flying:!1,timeouts:new Set};if(Qk=s,SD?.hideChrome(!n),n){gB("start-reduced");return}if(gB("start"),s.flying=xve()?.begin(()=>{Qk===s&&gB("flight-done")})??!1,!s.flying){gB("flight-done");return}SD?.root.classList.add("volter-play-flight")}function j_n(t,n){(!t||!n)&&oUe()}function L_n(t){const n=Qk;n&&(n.flying&&t&&xve()?.track(t),gB("game-ready"))}function oUe(){const t=Qk;if(t){Qk=null;for(const n of t.timeouts)clearTimeout(n);t.timeouts.clear(),Ljt(),SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),t.flying&&xve()?.end(),SD?.showChrome(!jjt()),Ojt(!1)}}const qje=new Set;let Bjt=null;function $jt(){return of()?.rootPath??null}function B_n(t){qje.add(t);const n=$jt();return n!==null&&Bjt===n&&t(),()=>{qje.delete(t)}}async function rwn(){Bjt=$jt();for(const t of[...qje])await t()}function $_n(){const t=e_();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 zje=null;function q_n(t){zje=t}function uTt(){if(!zje)throw new Error("The workbench Output service is not connected.");return zje}function z_n(){Q4r(e_),Q3r({output:{write:(...t)=>uTt().write(...t),show:t=>uTt().show(t)},console:{log:(t,n)=>ea.log(t,n),warn:(t,n)=>ea.warn(t,n),error:(t,n)=>ea.error(t,n)},live:{register:ZFt,mounted:_Ve,playing:rve,runWindow:aVe,restartRequired:KFt,restart:XFt,subscribe:hVe,version:e9t,notifyChanged:GFt,snapshotFrame:lVe,frameCanvas:cVe,authoringRefusal:pVe,dispatch:uVe,scenes:fVe,surface:tve,coverage:dVe},viewport:{transition:{begin:F_n,ready:L_n,end:oUe,onSettled:O_n,phase:N_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:wBe,reportFacet:Lrn,onSample:xnn,onCommandDispatched:MYr,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=>Oze(n=>{n!==null&&t()}),onBeforeClose:enn,reportWorkerCallMeter:Usn},project:{documentTable:Ren,mounts:l$,engineVersion:()=>of()?.config.engine.version??null,subscribe:Rw,onReady:B_n},notify:t=>s$(t),systems:{inspected:Cye,subscribe:Lwr,inspectedNetworking:zwr,subscribeNetworking:Vwr,inspectedAudio:()=>Uwr()??null,subscribeAudio:Jwr,audioVersion:Wwr},availability:{subscribe:HVe,version:Tun},workspace:{showUtility:bC,openContributedDocument:t=>tA(t),open:async t=>await Wye(t.kind,Ih()??{},t)!==null,liveDocument:{id:a0,register:atn,acquire:ftn,release:Zze,open:iq,container:ctn,setContainer:ltn,releaseContainer:utn}},documents:{activeId:e_,active:()=>{const t=CC();return t?{id:t.descriptor.id,kind:t.descriptor.kind,title:t.title}:null},subscribe:i2,version:X1,context:cQ,waitForContext:p4t,contextChanged:VCr,captureActive:t=>{const n=Ih();return n?m9t(n,t):Promise.reject(new Error("No editor session is open to capture a document from."))}},transport:{for:t=>w_n(t),subscribe:T_n},projectLocalState:{ready:lte,read:vve,write:bve,projectRootPath:()=>of()?.rootPath??null},history:{record:QPt,setDelegate:Y4r,onElement:tDr,invalidate:rDr,onInvalidated:nDr,changed:Z4r,elements:eDr,focusedResource:()=>{const t=CC();if(!t)return null;const n=t.descriptor.provenance?.sourcePath;if(n)return n;const s=Ih();return s?NYr(s)??Dze(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=ZPt(t),s=o_e(t),c=Ih()?.projectHistory?.subscribe(t),d=i2(t);return()=>{n(),s(),c?.(),d()}}},files:{setProvider:C4r,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:TEr,get:PEr,set:NEr,inspect:U4t,subscribe:t=>{const n=$4t(t),s=bee(t);return()=>{n(),s()}}},keyboard:{actions:()=>Oan().map(({id:t,scope:n})=>({id:t,scope:n})),keymaps:()=>W4t().map(({id:t,title:n})=>({id:t,title:n,chords:Z4t(t)})),activeKeymap:dR,invoke:t=>RVe(t),subscribe:t=>{const n=Fan(t),s=Uye(t),c=o_e(t),d=Ih()?.subscribe(t),m=i2(t);return()=>{n(),s(),c(),d?.(),m()}},version:()=>Ran()+X1(),stage:()=>{const t=Ih();return t?{surface:Nfn(t).surface,mode:$_n()}:{surface:null,mode:null}},bindActions:zan,chordsFor:OBe,shortcutFor:t=>Vv(t)??null}})}let V_n=0,cee=null;const Vje=new Set;function fTt(t){const n={generation:++V_n,promise:t,active:!0};cee=n;for(const s of Vje)s(n);return Vje.clear(),n}function U_n(){const t=cee;return t?.active?Promise.resolve(t):new Promise(n=>Vje.add(n))}async function sUe(){for(;;){const t=await U_n();if(await t.promise,cee===t&&t.active)return}}const qjt=16,J_n=300,W_n=1e4,zjt="workspace";function H_n(){const t=vve(zjt);return!t||t.version!==qjt?null:t}function G_n(t){bve(zjt,t)}function K_n(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=bAr(n.id);return{kind:n.kind,id:n.id,state:s,...Object.keys(c).length>0?{presentation:c}:{}}}function X_n(){const t={};let n=!1;for(const s of lDt()){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 Y_n(){const t=[];for(const s of l0()){const c=K_n(s);c&&t.push(c)}const n=X_n();return{version:qjt,workspace:zS(),documents:{open:t,activeId:e_(),...n?{kinds:n}:{}}}}async function Z_n(t,n,s){for(const c of cDt(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 dTt(t){if(!t)return!1;const n=!HQ();return SN(t,n)?!0:ntn.has(t)?(wFt(t),n&&pTr(t),!0):n&&X0(t)}function Q_n(t,n){const s=n?.kinds??{},c=(n?.open.length??0)>0;for(const d of lDt())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 emn(t){const n=new Set;for(const s of t)for(const c of cDt(s.kind))c.prepare&&n.add(c.prepare);return Promise.all([...n].map(s=>s().catch(()=>{})))}async function tmn(t,n){const s=n?.documents;if(Q_n(t,s),!s||s.open.length===0){dTt(s?.activeId??null);return}await emn(s.open);for(const c of s.open){const d=c.presentation;d&&typeof d=="object"&&!Array.isArray(d)&&SAr(c.id,d),await Z_n(t,c,s.activeId)}dTt(s.activeId)}function Vjt(t){if(!lte()||of()&&!u0()){let se=!1,pe=null,ue=()=>{};const Ce=new Promise(De=>{ue=De}),Fe=fTt(Ce);return Promise.all([cte(),Gze()]).then(()=>{if(se){ue();return}pe=Vjt(t),Fe.active=!1,sUe().finally(ue)}),()=>{se=!0,pe?.()}}const n=H_n();n?.workspace&&kB(n.workspace)&&Uk(n.workspace)?s2(n.workspace):(n?.workspace&&wkr(n.workspace),s2(pR(),{provisional:!0}));let s=!1,c=null;const d=[],m=()=>{c!==null&&(clearTimeout(c),c=null),!(C_n()||t.playState!==void 0&&t.playState!=="stopped")&&G_n(Y_n())},g=()=>{c!==null&&clearTimeout(c),c=setTimeout(m,J_n)},S=()=>m();let k=null;const A=typeof window<"u"&&rCt(window.location.href)!==null,F=A||!(n?.documents?.open.length??0)?Promise.resolve():mN().catch(()=>{}),D=F.then(()=>A?void 0:tmn(t,n)).catch(()=>{}),J=new Promise(se=>{F.then(()=>{s||(k=setTimeout(()=>{se()},W_n))})}),q=Promise.race([D,J]).then(()=>{k!==null&&clearTimeout(k),!s&&(d.push(i2(g)),d.push(CAr(g)),window.addEventListener("pagehide",S))}),G=fTt(q);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 rmn(t){Ye.useEffect(()=>{const n=rCt(window.location.href);if(!n)return;let s=!1;const c=Em(),d=()=>!s&&Em()===c;return sUe().then(()=>{if(d())return Bge(t,n,{updateUrl:!1,origin:"link"})}).catch(m=>{ea.error(`Could not restore shared editor view: ${m instanceof Error?m.message:String(m)}`,"editor")}),()=>{s=!0}},[t])}const pTt="volter:stale-chunk-reload";function nmn(){typeof window>"u"||window.addEventListener("vite:preloadError",t=>{let n=0;try{n=Number(sessionStorage.getItem(pTt)??0)}catch{}if(!(Date.now()-n<6e4)){try{sessionStorage.setItem(pTt,String(Date.now()))}catch{}t.preventDefault(),window.location.reload()}})}const jI=[];function imn(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 nwn(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)){ea.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 iwn extends Error{name="StoryMediumMismatch"}function own(t){return t instanceof Error&&t.name==="StoryMediumMismatch"}const Dme=new Map;function swn(t,n){return Dme.set(t,n),()=>{Dme.get(t)===n&&Dme.delete(t)}}function omn(t){return Dme.get(t)??null}function smn(t,n){const s=[];for(const c of Object.keys(n).sort())s.push(`${c}=${amn(n[c])}`);return`${t}|${s.join("&")}`}function amn(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 rye=new Map,b_e=new Map,_Tt=new WeakMap;let mTt=Promise.resolve(),hTt=null,cmn=1;function lmn(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}async function umn(){await Promise.race([Nye(),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 fmn(){return hTt??=umn(),hTt}function dmn(t){const n=_Tt.get(t);if(n!==void 0)return n;const s=cmn++;return _Tt.set(t,s),s}function pmn(t,n,s,c){const d=rye.get(t);if(d)return Promise.resolve(d);const m=b_e.get(t);if(m)return m;const g=mTt.then(async()=>{await fmn();const S=s.parameters.layout,k=S==="fullscreen"||S==="padded"||S==="centered"?S:"padded",A={...c,props:s.args,layout:k},F=omn(n==="canvas"?"canvas":"three");if(!F)throw new Error(`No ${n} story capture is registered.`);return F(s.Component,A)});return mTt=g.then(()=>{},()=>{}),b_e.set(t,g),g.then(S=>{rye.set(t,S),b_e.delete(t)},()=>b_e.delete(t)),g}function _mn({component:t,story:n,previewRevision:s,width:c=128,height:d=96}){const m=n.Component,g=`${t.surface}:${t.path}:${smn(n.id,n.args)}:${dmn(m)}:${s}:${c}x${d}`,[S,k]=Ye.useState(()=>rye.get(g)),[A,F]=Ye.useState(!1);return Ye.useEffect(()=>{let D=!1;if(F(!1),k(rye.get(g)),!!lmn())return pmn(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?$.jsx("img",{src:S,alt:`${t.name} preview`,className:"volter-component-thumbnail"}):$.jsx("span",{className:"volter-component-thumbnail-fallback","data-component-preview":A?"failed":"capturing-story",children:$.jsx(wR,{kind:"component",name:t.name})})}const wve="story:three",Tve="story:isolated",mmn="story:docs";function hmn(t,n){return t.surface==="dom"?!1:n===null||t.surface===n}function gmn({entry:t,previewRevision:n,width:s,height:c}){const d=t.detail;return $.jsx(_mn,{component:t.component,story:d,previewRevision:n,...s===void 0?{}:{width:s},...c===void 0?{}:{height:c}})}const ymn="story",vmn={id:ymn,owner:"./component-content-source",entries(t){const n=rq(),s=[];for(const c of t.components){if(!hmn(c,t.surface))continue;const d=bRt(n,c.name,c.path);d&&s.push({id:`${c.path}:${c.name}`,component:c,detail:d})}return s},subscribe:V0e,Thumbnail:gmn,open(t,n,s){const c=n.detail,d=n.component.surface==="three";CD(d?wve:Tve,t,d?{modulePath:c.modulePath,storyName:c.name,title:s}:{modulePath:c.modulePath,storyName:c.name})}};function gTt(t){return fYr(t.name,t.sourcePath)}const bmn={id:"portable-csf",owner:"./component-states",statesFor:(t,n)=>n.surface==="dom"?[]:gTt(t).map(s=>({id:s.id,label:s.label})),apply:(t,n,s)=>{const c=gTt(t).find(d=>d.id===n);if(c){if(s.surface==="three"){CD(wve,s.store,{modulePath:c.modulePath,storyName:c.name,title:c.label});return}if(s.surface==="canvas"){CD(Tve,s.store,{modulePath:c.modulePath,storyName:c.name});return}ea.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 Smn(){let t=0,n=!1;const s=S=>{const k=++t;iYr(),Nye().then(()=>{if(!(n||k!==t))return mYr(of(),void 0,{deferUndeclared:!0,...S?{changedPaths:S}:{}})})};s();let c=null;const d=bFt(),m=Rw(()=>s()),g=sen(s);return()=>{n=!0,t+=1,c!==null&&clearTimeout(c),d(),m(),g()}}const Ujt="story",IOe=new Set,NOe=new Set;function xmn(t){const n=_Rt({modulePath:t.modulePath,title:t.title}).leaf;return n===t.label?n:`${n} · ${t.label}`}function OOe(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??xmn({modulePath:n.modulePath,title:s.title,label:s.label})}}return null}function wmn(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(mmn,t,c);const d=Cze({modulePath:s.modulePath,regions:Tze()});return d.medium===void 0?(nYr(s.modulePath,d.reason),null):CD(d.medium==="three"?wve:Tve,t,c)}function yTt(t){ea.warn(`No composed portable story carries the id ${JSON.stringify(t)}, so nothing opened it.`,"editor")}function Tmn(){return kN({id:Ujt,owner:"./story-opener",open:(t,n)=>{const s=OOe(n);return s?wmn(t,n,s):(n.modulePath?IOe.add(n.modulePath):n.storyId!==void 0&&(NOe.add(n.storyId),cYr()&&yTt(n.storyId)),null)},settle:async()=>{await ADr();const t=[...IOe],n=[...NOe];if(IOe.clear(),NOe.clear(),await Promise.all(t.map(s=>dYr(of(),s))),n.length!==0){await lYr();for(const s of n)OOe({storyId:s})||yTt(s)}},ready:async(t,n)=>{if(n.mode==="docs")return;const s=OOe(n);if(!(!s||Cze({modulePath:s.modulePath,regions:Tze()}).medium!=="three")&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}})}const Cmn={actions:()=>{if(!egt(Tve)&&!egt(wve))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:Ujt,modulePath:n.modulePath,storyName:c.name,title:c.name})})}return t},subscribe:t=>V0e(t)};function Emn(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 kmn(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 Amn="packages/editor-core/src/stories/story-capture-command.ts",nB="capture-story-variants";async function Dmn(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 PZr("volter.project.json");if(!D)return null;const J=JSON.parse(D),q=J.resolution?.width,G=J.resolution?.height;return typeof q!="number"||typeof G!="number"||q<64||G<64||q>4096||G>4096?null:{width:Math.min(1024,Math.round(q)),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=Emn(nB,t.camera);if(typeof S=="string")return{ok:!1,error:S};const k=kmn(nB,t.pose);if(typeof k=="string")return{ok:!1,error:k};const{captureProjectStoryVariants:A}=await fo(async()=>{const{captureProjectStoryVariants:D}=await import("./story-capture-BEVV48wm.js");return{captureProjectStoryVariants:D}},__vite__mapDeps([265,266,1,2,3,4,20,21,230,209,267,22,23]));return{ok:!0,data:{...await A(of(),{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 Pmn={[nB]:{timeoutMs:12e4,derivedRefresh:"if-content-changed",handle:Dmn}};function Imn(){const t=_in(vmn),n=imn(bmn),s=Tmn(),c=uCt(Cmn),d=dCt(Amn,Pmn),m=Smn(),g=V0e(()=>{BB()});return()=>{g(),m(),d(),c(),s(),n(),t()}}const Nmn=[["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"]],Omn=[["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 vTt(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 Rmn(t){const n=getComputedStyle(t),s={};for(const[c,d,m]of Nmn){const g=vTt(n.getPropertyValue(d));g!==null&&(g.length===9&&!m||(s[c]=m&&g.length===7?`${g}${m}`:g))}for(const[c,d]of Omn){const m=vTt(n.getPropertyValue(d));m!==null&&(s[c]=m)}return s}let xm=null,Jjt=0;const Uje=new Set;function Fmn(t){return Uje.add(t),()=>Uje.delete(t)}function bTt(){return Jjt}const ROe=new Map;function Wjt(t,n){ROe.get(t)?.disconnect(),ROe.delete(t);const s=()=>{const d=n?.isConnected?n.getBoundingClientRect():null;JAr(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),ROe.set(t,c)}function Mmn(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&&Hjt(t,n),Wjt(t,n),Jjt+=1;for(const s of Uje)s()}}function Hjt(t,n){n.dataset.volterPart=t}const HO=new Map;let Gjt=0;const Jje=new Set,Kjt=new Set;let STt=!1;function xTt(){for(const t of l0())Kjt.add(t.descriptor.id)}function jmn(t){STt||(STt=!0,i2(xTt)),xTt(),!(!t||Kjt.has(t))&&(ytn(t)||wFt(t,!1))}function Lmn(t,n){if(n){if(!HO.delete(t.id))return}else{HO.has(t.id)||jmn(t.documentId);const s=HO.get(t.id);if(s?.element===t.element&&s.documentId===t.documentId)return;HO.set(t.id,{...t})}Gjt+=1;for(const s of[...Jje])s()}function Bmn(t){return Jje.add(t),()=>{Jje.delete(t)}}function wTt(){return Gjt}function GO({children:t,row:n=!1,center:s=!1}){return $.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 $mn({children:t}){return $.jsx($.Fragment,{children:t})}function qmn(){return xm?MS.createPortal($.jsx(GO,{center:!0,children:$.jsx(Wdn,{})}),xm.header):null}function zmn(){return null}function Vmn(){const t=Ye.useRef(null);return Ye.useEffect(()=>{const n=t.current;if(n)return ujt(n),()=>Qun(n)},[]),$.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[$.jsx("div",{ref:t,className:"volter-vscode-outliner-header",style:{padding:"var(--volter-space-2) var(--volter-space-4)","--volter-hierarchy-search-basis":"100%"}}),$.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:$.jsx(yjt,{})})]})}const Pme=new Map,Wje=new Set;let Hje=0;function Umn(t,n){if(n){if(Pme.get(t)===n)return;n.dataset.volterUtility=t,Pme.set(t,n)}else if(!Pme.delete(t))return;Hje++;for(const s of Wje)s()}const Ime=new Map,Gje=new Set;let Kje=0;function Jmn(t,n){if(n){if(Ime.get(t)===n)return;Ime.set(t,n)}else if(!Ime.delete(t))return;Kje++;for(const s of Gje)s()}function Wmn(){return Ye.useSyncExternalStore(T3t,dht,dht),Ye.useSyncExternalStore(t=>(Gje.add(t),()=>Gje.delete(t)),()=>Kje,()=>Kje),$.jsx($.Fragment,{children:[...fRe("left"),...fRe("right")].map(t=>{const n=Ime.get(t.id);if(!n)return null;const s=t.Content;return $.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(s,{}),n)},t.id)})})}function Hmn(){return Ye.useSyncExternalStore(Jye,hhe,hhe),Ye.useSyncExternalStore(t=>(Wje.add(t),()=>Wje.delete(t)),()=>Hje,()=>Hje),$.jsx($.Fragment,{children:SC().map(t=>{const n=Pme.get(t.id);return n?$.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(GO,{children:$.jsx(Kdn,{utility:t})}),n)},t.id):null})})}function Gmn({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]),MS.createPortal($.jsxs(GO,{children:[$.jsx(RMt,{descriptor:t,viewId:n,active:d,chrome:!t.area}),m&&$.jsx(Oun,{})]}),g)}let Xjt=!0;function Kmn({arrangement:t,immersivePlay:n}){const s=Yv();rmn(s);const c=zVe(s);Ye.useLayoutEffect(()=>{Xjt=c.column},[c.column]);const d=HO.get(bRe()??"")?.element??xm?.center;Ye.useLayoutEffect(()=>{if(!d)return;const F=()=>Twt({x:0,y:0,width:d.clientWidth,height:d.clientHeight}),D=new ResizeObserver(F);return D.observe(d),F(),()=>{D.disconnect(),Twt(null)}},[d]),Ye.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(Bmn,wTt,wTt),Ye.useSyncExternalStore(Fmn,bTt,bTt),Ye.useLayoutEffect(()=>{const F=YEr({...t?{arrangement:t}:{},...n===void 0?{}:{immersivePlay:n},playUtilities:[]});return t&&s2(t.id),Ekr(),F},[t,n]);const m=s.playState!=="stopped",g=Ye.useSyncExternalStore(bee,NR).play?.keepPanelsVisible;if(Ye.useEffect(()=>{j_n(m,Rjt())},[m,n,g]),Ye.useEffect(()=>Vjt(s),[s]),!xm)return null;const S=xm.center,k=l0(),A=CC()??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}))},$.jsxs($.Fragment,{children:[[...HO.values()].map(F=>{const D=k.find(J=>J.descriptor.id===F.documentId)?.descriptor;return D?$.jsx(Gmn,{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&&MS.createPortal($.jsx(GO,{children:$.jsx("div",{className:"volter-vscode-empty",children:"No document open"})}),xm.center),xm.outliner&&MS.createPortal($.jsx(GO,{children:$.jsx(Vmn,{})}),xm.outliner),xm.properties&&MS.createPortal($.jsx(GO,{children:c.column?$.jsx(GVe,{}):$.jsx(Eun,{surface:c.surface})}),xm.properties),xm.content&&MS.createPortal($.jsx(GO,{children:$.jsx(m_n,{kind:"assets"})}),xm.content),$.jsx(Hmn,{}),$.jsx(Wmn,{})]})}async function Xmn(t,n={}){xm=t,n.workspaceStorage&&HAr(n.workspaceStorage),t3r();for(const[Fe,De]of Object.entries(t))De&&Hjt(Fe,De),Wjt(Fe,De??null);t.chromeRoot.id="editor-chrome-root",APt({Frame:$mn,Header:qmn,Footer:zmn,Workspace:Kmn,Document:wcn}),g_n(),Onn();const s=Oln();s&&Iln(s,Date.now())&&ea.warn(Dln(s,Date.now()),"editor"),nmn(),CDr(),z_n(),Imn(),await Promise.all([V4t(),Zkr(),YDt()]),pAr(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),Xje.createRoot(c).render($.jsx(Xln,{}));const d={activeKeymap:()=>n0().keyboard.activeKeymap(),invoke:Fe=>n0().keyboard.invoke(Fe),subscribe:Fe=>n0().keyboard.subscribe(Fe),facts:()=>{const Fe=n0(),De=Fe.keyboard.stage();return{surface:De.surface,mode:De.mode,documentKind:Fe.documents.active()?.kind??null,play:Fe.session.playState()}},report:(Fe,De)=>{const be=n0();Fe==="error"?be.console.error(De,"editor"):be.console.warn(De,"editor")}};let m=!1;const g={whenRestored:sUe,activeSource:()=>{const Fe=n0().documents.active();if(!Fe)return null;const De=Fe.kind==="model"&&Fe.id.startsWith("model:")?Fe.id.slice(6):"";return{kind:Fe.kind,path:De}},list:()=>l0().map(Fe=>{const De=Fe.descriptor.area?ykr().find(be=>be.id===Fe.descriptor.area):void 0;return{id:Fe.descriptor.id,title:Fe.title,...De?{area:{id:De.id,place:De.place,ratio:De.ratio}}:{}}}),activeId:()=>CC()?.descriptor.id??null,subscribe:Fe=>{m=!0;const De=i2(Fe),be=vkr(Fe);return()=>{De(),be()}},activate:(Fe,De)=>{!m&&HQ()||(De?fTr(Fe,De):X0(Fe))},close:Fe=>{if(EN(Fe))return;const De=l0().find(be=>be.descriptor.id===Fe);De&&d.report("warn",`“${De.title}” has unsaved changes, so it stayed open. Save it (⌘S) and close it again.`)},setView:(Fe,De)=>Lmn(Fe,De)},S={elements:()=>n0().history.elements(),onElement:Fe=>n0().history.onElement(Fe),onInvalidated:Fe=>n0().history.onInvalidated(Fe),changed:()=>n0().history.changed(),focusedResource:()=>n0().history.focusedResource(),focusedDocument:()=>{const Fe=n0().documents.active();return Fe?{id:Fe.id,label:Fe.title}:null},setDelegate:Fe=>n0().history.setDelegate(Fe),report:d.report},k={setProvider:Fe=>n0().files.setProvider(Fe),report:d.report},A={setProvider:Fe=>n0().settings.setProvider(Fe),adapterValues:()=>[...EEr()],workbenchValues:()=>{const Fe=xm?.chromeRoot;if(!Fe)return[];const De=getComputedStyle(Fe).getPropertyValue("--volter-command-bar-height").trim(),be=Number.parseFloat(De),X=["workbench.colorCustomizations",Rmn(Fe)];return!Number.isFinite(be)||be<=0?[X]:[["window.titleBarHeight",Math.round(be)],X]},lookId:()=>DN(),notify:Fe=>{n0().notify(Fe)},subscribe:Fe=>{const De=zye(Fe),be=wDt(Fe);return()=>{De(),be()}},report:d.report},F={list:()=>Mnn().map(Fe=>({id:Fe.id,label:Fe.label,category:Fe.category,...Fe.menu?{menu:Fe.menu}:{}})),invoke:Fe=>Lnn(Fe),subscribe:Fe=>jnn(Fe),setPaletteOpener:Fe=>Fnn(Fe),setCommandExecutor:Fe=>Bnn(Fe),report:d.report},D={setDelegate:Fe=>JCr(Fe?{show:De=>Fe({...De,source:e3r()})}:null)},J={list:()=>IPt().map(Fe=>({view:Fe.view,title:Fe.title,verbs:Fe.verbs.map(De=>({id:De.id,...De.title?{title:De.title}:{}}))})),invoke:(Fe,De,be)=>OPt(Fe,De,be),subscribe:Fe=>NPt(Fe)},q={list:()=>SC().map((Fe,De)=>({id:Fe.id,title:Fe.title,order:Fe.order??De})),subscribe:Fe=>{let De=hhe();const be=Jye(Fe),X=HVe(()=>{const we=hhe();we!==De&&(De=we,Fe())});return()=>{be(),X()}},offerBody:(Fe,De)=>Umn(Fe,De)};let G=!0,se=null,pe=null;urn(()=>G);const ue={setActiveStaticPanel:Fe=>Xht(wVe.find(De=>De.kind===Fe)?.kind??null),focusCompactInspector:()=>{if(Xjt)return!1;const Fe=xm?.center.querySelector('[data-testid="compact-inspector-card"]');return Fe?(Fe.tabIndex=-1,Fe.focus(),Xht("inspector"),!0):!1},setPaneActive:Fe=>{G!==Fe&&(G=Fe)},setImmersive:Fe=>{se?.(),se=null,!(!Fe||!xm)&&(se=I_n({root:xm.chromeRoot,hideChrome:()=>Fe.enter(),showChrome:()=>Fe.exit()}))},setDockCommands:Fe=>{pe?.(),pe=null,Fe&&(pe=ekr({showUtility:De=>Fe.showUtility(De),toggleUtility:De=>Fe.toggleUtility(De),ensureUtility:De=>Fe.ensureUtility(De),closeUtility:De=>Fe.closeUtility(De),showStaticPanel:De=>Fe.showStaticPanel(De),setFocus:De=>Fe.setFocus(De),toggleFocus:()=>Fe.toggleFocus(),captureUtilities:De=>{for(const be of De)Fe.showUtility(be);return()=>{for(const be of De)Fe.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:(Fe,De)=>d.report(Fe,De)};return{host:c,keyboard:d,documents:g,history:S,files:k,commands:F,notifications:D,views:J,utilities:q,output:{setProvider:q_n},settings:A,status:{list:()=>["left","right"].flatMap(Fe=>fRe(Fe).map((De,be)=>({id:De.id,title:De.name,align:Fe,order:De.order??be}))),subscribe:Fe=>T3t(Fe),offerBody:(Fe,De)=>Jmn(Fe,De)},game:ue,offerPart:Mmn}}function Ymn(t){const n=Object.keys(t.packages);return o0r({id:t.id,packages:n,look:t.look,workspace:t.workspace,nativeMenus:t.nativeMenus,logo:t.logo}),ODt(n.flatMap(s=>t.packages[s]??[])),{mountVolter:Xmn}}const{mountVolter:awn}=Ymn({id:"game-editor",packages:{"@volter/editor-game":t0r,"@volter/editor-react":r0r,"@volter/editor-threejs":n0r,"@volter/editor-xstate":i0r,"@volter/editor-blender":e0r},look:"classic",workspace:"game",logo:"https://brand.volter.ai/logo/volter-game-editor/svg",nativeMenus:!0});export{_Sn as $,_3t as A,DB as B,m3t as C,h3t as D,u0 as E,OC as F,Xze as G,nRe as H,rSn as I,k2n as J,Yv as K,Ih as L,VXr as M,p3t as N,ea as O,f3t as P,Jl as Q,g3t as R,Dwr as S,W0n as T,zFt as U,ztn as V,ZLe as W,WFt as X,L_ as Y,CN as Z,fo as _,XY as a,a2n as a$,Ms as a0,dc as a1,Kk as a2,H0n as a3,bC as a4,jgn as a5,zsn as a6,Kan as a7,Z2n as a8,Wze as a9,hy as aA,oq as aB,uMt as aC,F3r as aD,tSn as aE,qxn as aF,r0n as aG,F_e as aH,S0n as aI,hAr as aJ,_p as aK,dm as aL,Zm as aM,rwn as aN,Q0e as aO,l0 as aP,wFt as aQ,TD as aR,Jyn as aS,OCr as aT,H0e as aU,PRt as aV,Nze as aW,DSn as aX,Zf as aY,P9t as aZ,o2n as a_,MB as aa,Bwr as ab,QFt as ac,Ubn as ad,n0n as ae,Go as af,$gn as ag,Eye as ah,Bun as ai,G0e as aj,Vwr as ak,jxn as al,V0e as am,rq as an,Cze as ao,Tze as ap,nYr as aq,aan as ar,f$e as as,Rtn as at,fRt as au,Mtn as av,of as aw,Y0 as ax,mp as ay,I0n as az,QLe as b,v2n as b$,j4r as b0,s2n as b1,yC as b2,S$e as b3,vTr as b4,X7e as b5,ig as b6,bFt as b7,lYr as b8,$bn as b9,fu as bA,b2n as bB,w2n as bC,T2n as bD,C2n as bE,LSt as bF,_2n as bG,x2n as bH,S2n as bI,UZr as bJ,BSt as bK,d2n as bL,jD as bM,gZr as bN,USt as bO,f2n as bP,VZr as bQ,c2n as bR,h2n as bS,Zbn as bT,Qbn as bU,kZr as bV,E2n as bW,BZr as bX,DZr as bY,n2n as bZ,i2n as b_,hRt as ba,dRt as bb,gRt as bc,HXr as bd,omn as be,own as bf,uSn as bg,_Rt as bh,aYr as bi,nvn as bj,M0n as bk,F0n as bl,D3r as bm,$0n as bn,Rhe as bo,Jbn as bp,Gbn as bq,ftn as br,g3r as bs,y3r as bt,Mwr as bu,Wbn as bv,ctn as bw,ZFt as bx,ed as by,_y as bz,iRe as c,R_ as c$,p2n as c0,K0e as c1,$Zr as c2,qZr as c3,MRt as c4,LRt as c5,AZr as c6,t2n as c7,RZr as c8,e2n as c9,zSn as cA,Uye as cB,dR as cC,byn as cD,mO as cE,Vv as cF,Syn as cG,T0r as cH,E0r as cI,iLe as cJ,myn as cK,M3t as cL,bZ as cM,ayn as cN,n$ as cO,xhn as cP,aR as cQ,pBe as cR,Nc as cS,tLe as cT,HTt as cU,KTt as cV,dhn as cW,J0r as cX,D0n as cY,P0n as cZ,PI as c_,zZr as ca,g2n as cb,OZr as cc,jze as cd,jRt as ce,NZr as cf,SMe as cg,PZr as ch,l2n as ci,i_e as cj,MZr as ck,VSt as cl,zSt as cm,LZr as cn,wZr as co,Mze as cp,bMe as cq,FZr as cr,y2n as cs,m2n as ct,r2n as cu,JZr as cv,u2n as cw,Qen as cx,X0 as cy,ixt as cz,d3t as d,pSr as d$,Vxn as d0,cBe as d1,Cm as d2,mfn as d3,i0 as d4,I2n as d5,kDr as d6,Lun as d7,DRe as d8,i$ as d9,a4t as dA,lLe as dB,YB as dC,Uxn as dD,Jxn as dE,kfn as dF,CAr as dG,E0n as dH,KBe as dI,ugt as dJ,x0n as dK,lhn as dL,Nvr as dM,fgt as dN,vAr as dO,mAr as dP,GBe as dQ,gAr as dR,s0r as dS,nye as dT,LOe as dU,_yn as dV,Fsn as dW,yZ as dX,sAt as dY,AR as dZ,pxr as d_,oan as da,nan as db,NVe as dc,USn as dd,f0r as de,p0r as df,l0r as dg,Iw as dh,CTt as di,H1 as dj,Ugn as dk,oen as dl,nSn as dm,rtn as dn,aMt as dp,l2 as dq,qAr as dr,Hbn as ds,lMt as dt,fQ as du,hhn as dv,cEr as dw,qTt as dx,SZ as dy,ACr as dz,u3t as e,ghn as e$,t$ as e0,Vme as e1,iCt as e2,L0n as e3,W0 as e4,U0n as e5,R2n as e6,mSn as e7,Z0n as e8,jhe as e9,iyn as eA,iSn as eB,NYr as eC,Dze as eD,ERt as eE,l4t as eF,ttn as eG,cYr as eH,E4t as eI,D5e as eJ,Iye as eK,kon as eL,eLe as eM,yhn as eN,c0r as eO,w4t as eP,Ion as eQ,Lht as eR,k5e as eS,Aht as eT,c0 as eU,Kyn as eV,san as eW,NRe as eX,yBe as eY,Zyn as eZ,BCr as e_,w4r as ea,NQr as eb,Q0n as ec,u$e as ed,tvn as ee,evn as ef,Bbn as eg,WSn as eh,JSn as ei,J0n as ej,hBe as ek,nhe as el,pyn as em,G0 as en,Cyn as eo,YY as ep,Dyn as eq,C_e as er,Lyn as es,sQ as et,Bgn as eu,Rw as ev,Thn as ew,MTr as ex,ASn as ey,eSn as ez,oRe as f,J9t as f$,u0n as f0,l0n as f1,CC as f2,nFe as f3,wee as f4,kN as f5,Tve as f6,mmn as f7,mYr as f8,ND as f9,khn as fA,w0r as fB,Ehn as fC,Nme as fD,jOe as fE,ZTt as fF,v0n as fG,Tyn as fH,cxn as fI,ban as fJ,exn as fK,TR as fL,bxn as fM,txn as fN,Jze as fO,Lbn as fP,bRt as fQ,_Tr as fR,eTr as fS,VSn as fT,oSn as fU,aSn as fV,a0 as fW,sSn as fX,HQ as fY,qSn as fZ,NSn as f_,qwr as fa,FTr as fb,T_e as fc,etn as fd,p$e as fe,r3r as ff,tfn as fg,$xn as fh,Bxn as fi,Lxn as fj,wve as fk,EN as fl,g0n as fm,k0n as fn,swn as fo,iwn as fp,cSn as fq,lSn as fr,g4t as fs,i0n as ft,_hn as fu,Shn as fv,w0n as fw,y0n as fx,Wxn as fy,aPt as fz,y3t as g,rA as g$,CRt as g0,zQ as g1,Cfn as g2,Fun as g3,CR as g4,WXr as g5,qbn as g6,jtn as g7,ADr as g8,Pg as g9,Lgn as gA,DFe as gB,u3r as gC,rvn as gD,m0r as gE,Vbn as gF,hYr as gG,Eht as gH,JTt as gI,i2 as gJ,X1 as gK,CSn as gL,ESn as gM,Fwr as gN,Fgn as gO,TSn as gP,Rgn as gQ,wSn as gR,GFt as gS,z2n as gT,xR as gU,QQr as gV,Lrn as gW,whn as gX,zTt as gY,OTt as gZ,jTr as g_,kSn as ga,u0r as gb,fee as gc,N2n as gd,X2n as ge,O2n as gf,nyn as gg,K2n as gh,fN as gi,Zje as gj,sLe as gk,i4r as gl,V2n as gm,N0n as gn,G2n as go,O0n as gp,Y0n as gq,Dw as gr,sf as gs,hR as gt,v3r as gu,R0n as gv,SSn as gw,sPt as gx,inn as gy,nwn as gz,WAt as h,Hyn as h$,AC as h0,tA as h1,bhn as h2,V0n as h3,sBe as h4,X0e as h5,Ybn as h6,uCt as h7,Ian as h8,Cxn as h9,OTr as hA,Tht as hB,Lye as hC,ETr as hD,CTr as hE,UTr as hF,hyn as hG,vyn as hH,yyn as hI,xyn as hJ,wyn as hK,Gyn as hL,dyn as hM,Uyn as hN,Ym as hO,s4t as hP,uyn as hQ,fyn as hR,$ye as hS,gyn as hT,gBe as hU,syn as hV,zyn as hW,Vyn as hX,rhe as hY,e0n as hZ,Cht as h_,fYr as ha,B0n as hb,Mgn as hc,b0n as hd,dBe as he,Hgn as hf,Ygn as hg,tyn as hh,R$ as hi,CD as hj,Ggn as hk,Jgn as hl,Wgn as hm,Zgn as hn,Yyn as ho,Xyn as hp,RTr as hq,$Cr as hr,wht as hs,gC as ht,xRe as hu,L3t as hv,cyn as hw,lyn as hx,TRe as hy,wRe as hz,Pp as i,Qje as i$,jCr as i0,Eyn as i1,c4t as i2,she as i3,kCr as i4,OG as i5,Q3t as i6,q3t as i7,PTr as i8,qTr as i9,GTr as iA,WTr as iB,NG as iC,$yn as iD,t0n as iE,TCr as iF,PCr as iG,DTr as iH,Ryn as iI,kyn as iJ,ahe as iK,Byn as iL,E5e as iM,ATr as iN,vBe as iO,Pyn as iP,q$ as iQ,Ayn as iR,Nyn as iS,jSn as iT,$Sn as iU,Cee as iV,AD as iW,gcn as iX,Fxn as iY,S5e as iZ,Exn as i_,Oyn as ia,Iyn as ib,Fyn as ic,Myn as id,Wyn as ie,kTr as ig,ECr as ih,e4t as ii,Qyn as ij,LTr as ik,qyn as il,jyn as im,VTr as io,E_e as ip,ERe as iq,HTr as ir,JTr as is,LCr as it,zTr as iu,yee as iv,Rye as iw,KTr as ix,Epe as iy,kRe as iz,VAt as j,Txn as j$,nee as j0,Ifn as j1,Gxn as j2,nPt as j3,h3r as j4,eBe as j5,$wr as j6,uht as j7,Iwr as j8,v3t as j9,ZHr as jA,eGr as jB,rGr as jC,Q2n as jD,Owr as jE,dVe as jF,ann as jG,ste as jH,Gsn as jI,Gxt as jJ,wI as jK,RFe as jL,vxn as jM,ohn as jN,uhn as jO,chn as jP,gxn as jQ,ahn as jR,_0r as jS,yxn as jT,San as jU,sxn as jV,oxn as jW,Aon as jX,Sxn as jY,ixn as jZ,Aan as j_,hsn as ja,H2n as jb,HI as jc,zMe as jd,qgn as je,qRt as jf,Y0e as jg,Tye as jh,cN as ji,XLe as jj,Pye as jk,lN as jl,OAr as jm,TBe as jn,uBe as jo,Dye as jp,YLe as jq,Kye as jr,Oin as js,A9t as jt,jTt as ju,FB as jv,sN as jw,L2n as jx,Mxn as jy,O_n as jz,Ewr as k,Uwr as k$,KSn as k0,xxn as k1,rxn as k2,QSn as k3,XSn as k4,dxn as k5,ZSn as k6,YSn as k7,nxn as k8,fxn as k9,fhn as kA,rLe as kB,vEr as kC,vve as kD,bve as kE,xSn as kF,PMt as kG,OMt as kH,Uxt as kI,NFe as kJ,q_e as kK,OFe as kL,Mun as kM,KVe as kN,kxn as kO,Ofn as kP,h0n as kQ,G0r as kR,Y2n as kS,gR as kT,vDr as kU,yve as kV,U$ as kW,eA as kX,mD as kY,Jwr as kZ,Wwr as k_,axn as ka,pxn as kb,c$e as kc,lxn as kd,HSn as ke,wxn as kf,GSn as kg,_xn as kh,_Ve as ki,uxn as kj,xan as kk,mxn as kl,hxn as km,FSn as kn,OSn as ko,MSn as kp,U2n as kq,TDr as kr,e6t as ks,J2n as kt,RSn as ku,wD as kv,J0 as kw,GSt as kx,LAt as ky,Y4 as kz,Gme as l,Qxn as l$,Aye as l0,mhn as l1,M0r as l2,YAr as l3,ZAr as l4,phn as l5,ejt as l6,zgn as l7,Rwr as l8,zwr as l9,oyn as lA,dCt as lB,bSn as lC,T0n as lD,Hxn as lE,shn as lF,Axn as lG,Dxn as lH,vhn as lI,Chn as lJ,LSn as lK,Kxn as lL,Xxn as lM,_jt as lN,BSn as lO,Kgn as lP,Asn as lQ,Qgn as lR,zxn as lS,ewn as lT,A0n as lU,EAr as lV,bAr as lW,C0n as lX,ryn as lY,Xgn as lZ,eyn as l_,OPt as la,Rxn as lb,Oxn as lc,Pxn as ld,Nxn as le,Ixn as lf,p0n as lg,k3r as lh,z0n as li,q0n as lj,W2n as lk,Efn as ll,Kbn as lm,Xbn as ln,fSn as lo,t9t as lp,ojt as lq,Yxn as lr,twn as ls,zbn as lt,PSn as lu,wfn as lv,Emn as lw,kmn as lx,nq as ly,ODr as lz,rQ as m,V1r as m$,lrn as m0,j0n as m1,mEr as m2,Dhn as m3,M2n as m4,P2n as m5,j2n as m6,CQr as m7,REr as m8,DEr as m9,Lme as mA,eht as mB,F_ as mC,Bme as mD,$me as mE,Lbr as mF,Vbr as mG,yB as mH,Ebr as mI,Abr as mJ,EEt as mK,Rbr as mL,CEt as mM,Tbr as mN,Cbr as mO,dbr as mP,pbr as mQ,c2r as mR,eh as mS,z1r as mT,ebr as mU,xEt as mV,Z1r as mW,G1r as mX,SEt as mY,X1r as mZ,W1r as m_,eve as ma,Vtn as mb,o0n as mc,m0n as md,s0n as me,c0n as mf,a0n as mg,Nsn as mh,_0n as mi,gSn as mj,ySn as mk,hSn as ml,vSn as mm,hEr as mn,gEr as mo,$Re as mp,bN as mq,ISn as mr,Vgn as ms,uje as mt,PAt as mu,Ixr as mv,YI as mw,Gvr as mx,gCt as my,n1r as mz,vB as n,Fbr as n$,rbr as n0,H1r as n1,U1r as n2,$1r as n3,q1r as n4,nbr as n5,tbr as n6,K1r as n7,J1r as n8,Q1r as n9,hbr as nA,m2r as nB,Qbr as nC,wbr as nD,Xbr as nE,l2r as nF,fbr as nG,$br as nH,s2r as nI,jbr as nJ,n2r as nK,TEt as nL,Obr as nM,Ubr as nN,Jbr as nO,PEt as nP,u2r as nQ,o2r as nR,_2r as nS,f2r as nT,Fw as nU,Kbr as nV,g2r as nW,Ybr as nX,hye as nY,M_ as nZ,a2r as n_,mye as na,Y1r as nb,IEt as nc,h2r as nd,Nbr as ne,zbr as nf,i2r as ng,Hbr as nh,Dbr as ni,cbr as nj,ubr as nk,fLe as nl,Zbr as nm,ICt as nn,r2r as no,e2r as np,p2r as nq,sbr as nr,Sbr as ns,xbr as nt,ybr as nu,gbr as nv,bbr as nw,vbr as nx,Gbr as ny,Ibr as nz,Awr as o,x2r as o$,d2r as o0,t2r as o1,DEt as o2,vu as o3,_br as o4,lbr as o5,abr as o6,Mbr as o7,hLe as o8,Bbr as o9,$Et as oA,iSr as oB,z2r as oC,OCt as oD,FCt as oE,mgn as oF,ngn as oG,XEt as oH,NEt as oI,jEt as oJ,NCt as oK,RCt as oL,K2r as oM,lgn as oN,nSr as oO,k2r as oP,A2r as oQ,QZ as oR,qk as oS,XOe as oT,H2r as oU,E2r as oV,D2r as oW,O2r as oX,ign as oY,UEt as oZ,JEt as o_,qbr as oa,mbr as ob,Wbr as oc,Phn as od,ui as oe,Vhn as of,zhn as og,ibr as oh,jmt as oi,Jhn as oj,L2r as ok,rSr as ol,GEt as om,KEt as on,N2r as oo,I2r as op,ygn as oq,aSr as or,WEt as os,HEt as ot,Ghn as ou,Hhn as ov,Khn as ow,Whn as ox,Uhn as oy,BEt as oz,zAt as p,Z2r as p$,S2r as p0,T2r as p1,w2r as p2,YEt as p3,VEt as p4,xgn as p5,ekt as p6,fgn as p7,J2r as p8,ZZ as p9,Xhn as pA,wgn as pB,egn as pC,bgn as pD,sgn as pE,oSr as pF,U2r as pG,jCt as pH,BCt as pI,MCt as pJ,LCt as pK,pye as pL,_ye as pM,cgn as pN,ZEt as pO,tSr as pP,G2r as pQ,v2r as pR,gye as pS,uSr as pT,ggn as pU,sSr as pV,F2r as pW,Sgn as pX,Q2r as pY,eSr as pZ,dgn as p_,XI as pa,b2r as pb,agn as pc,QEt as pd,yLe as pe,X2r as pf,jme as pg,eQ as ph,YOe as pi,V2r as pj,LEt as pk,ugn as pl,Yhn as pm,$2r as pn,Qhn as po,hgn as pp,Zhn as pq,Y2r as pr,j2r as ps,_gn as pt,C2r as pu,pgn as pv,M$ as pw,fye as px,dye as py,vgn as pz,Twr as q,kLe as q$,ogn as q0,P2r as q1,R2r as q2,qEt as q3,M2r as q4,tgn as q5,B2r as q6,W2r as q7,gLe as q8,OEt as q9,B1r as qA,y2r as qB,Bhn as qC,qhn as qD,Lhn as qE,$hn as qF,p1r as qG,_1r as qH,d1r as qI,Nhn as qJ,Ihn as qK,obr as qL,Egn as qM,Tgn as qN,xLe as qO,BLe as qP,$Le as qQ,qLe as qR,rAt as qS,Zkt as qT,nAt as qU,FLe as qV,MLe as qW,zLe as qX,OLe as qY,RLe as qZ,ELe as q_,REt as qa,FEt as qb,MEt as qc,q2r as qd,zEt as qe,rgn as qf,sA as qg,$S as qh,qme as qi,fSr as qj,Fhn as qk,jhn as ql,cSr as qm,Rhn as qn,Mhn as qo,u1r as qp,f1r as qq,HOe as qr,sD as qs,wEt as qt,kbr as qu,Pbr as qv,lSr as qw,Bmt as qx,$mt as qy,Ohn as qz,n0 as r,yAt as r$,wAt as r0,KLe as r1,xye as r2,mee as r3,gAt as r4,oAt as r5,jLe as r6,wLe as r7,TLe as r8,tQ as r9,j$ as rA,vye as rB,WLe as rC,GLe as rD,vAt as rE,IAt as rF,EAt as rG,Mw as rH,Sye as rI,uAt as rJ,j_ as rK,xAt as rL,Gkt as rM,AAt as rN,pAt as rO,cAt as rP,Lu as rQ,ALe as rR,yye as rS,aD as rT,Kkt as rU,bye as rV,Qkt as rW,tAt as rX,DLe as rY,iAt as rZ,SLe as r_,Cgn as ra,_At as rb,dAt as rc,nht as rd,NAt as re,zme as rf,ILe as rg,NLe as rh,$kt as ri,Lkt as rj,Ukt as rk,zkt as rl,aAt as rm,rht as rn,LLe as ro,PLe as rp,DAt as rq,fAt as rr,Hkt as rs,lAt as rt,CAt as ru,CLe as rv,eAt as rw,HLe as rx,Xkt as ry,hAt as rz,JAt as s,OAt as s$,tht as s0,lxr as s1,WSr as s2,HSr as s3,ixr as s4,TAt as s5,Axr as s6,USr as s7,JSr as s8,Cxr as s9,VSr as sA,Oxr as sB,KSr as sC,dxr as sD,$Sr as sE,_xr as sF,gxr as sG,zSr as sH,yxr as sI,Pxr as sJ,Txr as sK,FSr as sL,bxr as sM,VLe as sN,SAt as sO,Ykt as sP,Jme as sQ,xxr as sR,Ume as sS,_Sr as sT,mSr as sU,hxr as sV,Wme as sW,bAt as sX,FAt as sY,kxr as sZ,kAt as s_,MSr as sa,jSr as sb,fxr as sc,vSr as sd,SSr as se,Dxr as sf,GSr as sg,ESr as sh,RSr as si,ySr as sj,bSr as sk,mAt as sl,Sxr as sm,exr as sn,txr as so,Agn as sp,kSr as sq,QSr as sr,ZSr as ss,YSr as st,OSr as su,ZOe as sv,rxr as sw,oxr as sx,ULe as sy,qSr as sz,Pa as t,wSr as t0,CSr as t1,xSr as t2,TSr as t3,hSr as t4,gSr as t5,vxr as t6,kgn as t7,XSr as t8,Nxr as t9,avr as tA,svr as tB,awn as tC,Ahn as tD,Dgn as tE,Pgn as tF,Ign as tG,Ngn as tH,Ogn as tI,bEr as tJ,f0n as tK,d0n as tL,G0n as tM,K0n as tN,X0n as tO,jbn as tP,A2n as tQ,D2n as tR,PQr as tS,F2n as tT,B2n as tU,$2n as tV,q2n as tW,dSn as tX,pSn as tY,crn as tZ,Zxn as t_,wxr as ta,RAt as tb,axr as tc,Exr as td,JLe as te,nxr as tf,sxr as tg,LSr as th,cxr as ti,NSr as tj,ASr as tk,DSr as tl,PSr as tm,ISr as tn,uxr as to,BSr as tp,mxr as tq,ovr as tr,QTt as ts,Dmt as tt,Ome as tu,ivr as tv,nvr as tw,PG as tx,rCt as ty,tCt as tz,Gd as u,bo as v,Dg as w,e_ as x,gen as y,cFt as z};
|