@volter/game-editor 0.5.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUNDLED_NOTICES +11228 -0
- package/LICENSE +686 -0
- package/LICENSE-BLENDER +1409 -0
- package/LICENSE-MCP +21 -0
- package/NOTICE +21 -0
- package/catalog/entries/audio.json +14 -0
- package/catalog/entries/bake.json +36 -0
- package/catalog/entries/blender.json +17 -0
- package/catalog/entries/react-root.json +24 -0
- package/catalog/entries/reflections.json +29 -0
- package/catalog/entries/static-batch.json +25 -0
- package/catalog/project-source/LICENSE +37 -0
- package/catalog/project-source/src/contributions/bake.kind.ts +40 -0
- package/catalog/project-source/src/contributions/builder-document.tsx +65 -0
- package/catalog/project-source/src/contributions/builder-state.ts +27 -0
- package/catalog/project-source/src/contributions/builder-ui.tsx +61 -0
- package/catalog/project-source/src/contributions/module-source.ts +502 -0
- package/catalog/project-source/src/contributions/pages.finder.ts +61 -0
- package/catalog/project-source/src/lib/audio/sfx.ts +255 -0
- package/catalog/project-source/src/lib/bake/asset-seed.ts +128 -0
- package/catalog/project-source/src/lib/bake/bake-schema.ts +65 -0
- package/catalog/project-source/src/lib/bake/clip-layering.ts +203 -0
- package/catalog/project-source/src/lib/bake/gltf-bake.ts +657 -0
- package/catalog/project-source/src/lib/bake/mesh-slice.ts +157 -0
- package/catalog/project-source/src/lib/bake/node-image.ts +463 -0
- package/catalog/project-source/src/lib/bake/object3d-bake.ts +121 -0
- package/catalog/project-source/src/lib/bake/object3d-lifecycle.ts +15 -0
- package/catalog/project-source/src/lib/bake/object3d-source.ts +8 -0
- package/catalog/project-source/src/lib/bake/params.ts +75 -0
- package/catalog/project-source/src/lib/bake/rest-relative-animation.ts +217 -0
- package/catalog/project-source/src/lib/bake/use-model.ts +95 -0
- package/catalog/project-source/src/lib/react-root/index.ts +20 -0
- package/catalog/project-source/src/lib/react-root/react-root-adapter.tsx +57 -0
- package/catalog/project-source/src/lib/reflections/ReflectionProbe.tsx +201 -0
- package/catalog/project-source/src/lib/reflections/index.ts +19 -0
- package/catalog/project-source/src/lib/reflections/probe-controller.ts +75 -0
- package/catalog/project-source/src/lib/reflections/reflection-probe-registry.ts +402 -0
- package/catalog/project-source/src/lib/reflections/volume-reflection-material.ts +416 -0
- package/catalog/project-source/src/lib/static-batch/Frozen.tsx +91 -0
- package/catalog/project-source/src/lib/static-batch/freeze.ts +579 -0
- package/catalog/project-source/src/lib/static-batch/index.ts +44 -0
- package/catalog/project-source/src/lib/static-batch/mutation-watch.ts +149 -0
- package/catalog/project-source/src/lib/static-batch/shadow-cache.ts +171 -0
- package/catalog/project-source/src/tools/bake-module.tool.ts +139 -0
- package/catalog/project-source/src/tools/bake-preview.tool.ts +475 -0
- package/dist/.vite/manifest.json +8304 -0
- package/dist/assets/AssetBudgetPanel-J9--TZPU.js +23 -0
- package/dist/assets/AudioViewer-CR7333fe.js +1 -0
- package/dist/assets/BVHLoader-6bQIXhMX.js +1 -0
- package/dist/assets/BufferGeometryUtils-Nz37EVXf.js +1 -0
- package/dist/assets/CCDIKSolver-CD7vLpsK.js +1 -0
- package/dist/assets/CSS3DRenderer-CL7ABLVK.js +1 -0
- package/dist/assets/CanvasSceneViewport-Bpi6gVTC.js +1 -0
- package/dist/assets/ColladaLoader-aVOPIsCh.js +3 -0
- package/dist/assets/ColorInput-DQBNrW-K.js +1 -0
- package/dist/assets/ConvexGeometry-CAzXlPVG.js +1 -0
- package/dist/assets/ConvexHull-BINCESFp.js +1 -0
- package/dist/assets/CopyShader-BzTUYzf6.js +24 -0
- package/dist/assets/DecalGeometry-160KRdfg.js +1 -0
- package/dist/assets/EXRLoader-Cdans_oJ.js +1 -0
- package/dist/assets/EffectComposer-DQxfsXBZ.js +1 -0
- package/dist/assets/EntityModelDocument-Ccvw66N9.js +1 -0
- package/dist/assets/EnvironmentAssetDocument-Dg-Qq6O6.js +1 -0
- package/dist/assets/FBXLoader-B4MoUtAn.js +1 -0
- package/dist/assets/Fbo-Dz-Soul3.js +1 -0
- package/dist/assets/FontLoader-CvGoVI5a.js +2 -0
- package/dist/assets/GLTFExporter-HgrCle4L.js +1 -0
- package/dist/assets/GameplaySessionTimeline-B52W3FVZ.js +1 -0
- package/dist/assets/Gltf-UHVWKz65.js +2 -0
- package/dist/assets/HDRLoader-THU88oVD.js +5 -0
- package/dist/assets/ImageViewer-Tn7s_MnW.js +1 -0
- package/dist/assets/InspectorCanvasPreview-CEr_Kxna.js +1 -0
- package/dist/assets/InspectorObjectPreview-CVejvLRg.js +1 -0
- package/dist/assets/JsonAssetDocument-C7VGcLhu.js +3 -0
- package/dist/assets/LineSegments2-CsOpKSiM.js +370 -0
- package/dist/assets/MTLLoader-_Xzd4_0p.js +2 -0
- package/dist/assets/MarchingCubes-Bsp4wrzd.js +1 -0
- package/dist/assets/MeshBVH-BiDHDcu-.js +1 -0
- package/dist/assets/ModelAssetDocument-F5GACirk.js +1 -0
- package/dist/assets/NonThreeAuthoringBootstrap-C3woOMxX.js +1 -0
- package/dist/assets/OBJLoader-BhIC6Hwo.js +5 -0
- package/dist/assets/Object3DDocumentViewport-DB7T0NTl.js +2 -0
- package/dist/assets/Object3DPreview-DL8oi7Xs.js +2 -0
- package/dist/assets/OnlineAssetDetail-C6z9RvYK.js +2 -0
- package/dist/assets/OrbitControls-CM3bPray.js +1 -0
- package/dist/assets/OrbitControls-DLpayAaK.js +1 -0
- package/dist/assets/OrthographicCamera-bQozawrh.js +1 -0
- package/dist/assets/PLYLoader-DYQqs5Ik.js +2 -0
- package/dist/assets/PerspectiveCamera-CQ2lh01o.js +1 -0
- package/dist/assets/PlayBar-BR-Vg3Jb.js +2 -0
- package/dist/assets/RGBELoader-BgBcQv8j.js +1 -0
- package/dist/assets/RectAreaLightUniformsLib-CMMoWfll.js +1 -0
- package/dist/assets/RenderPass-DPrn-Uky.js +1 -0
- package/dist/assets/ResolutionPicker-C67vs1F3.js +1 -0
- package/dist/assets/RootSelectionOverlay-BZPlxmXU.js +1 -0
- package/dist/assets/RoundedBox-BDGBg6QZ.js +1 -0
- package/dist/assets/RoundedBoxGeometry-CyUuYPfW.js +1 -0
- package/dist/assets/STLLoader-Dyv3lsxY.js +1 -0
- package/dist/assets/SelectionBox-D_75KrNW.js +1 -0
- package/dist/assets/ShaderPass-QYRpPuFJ.js +1 -0
- package/dist/assets/ShadowEditor-DkImwu1Y.js +1 -0
- package/dist/assets/SimplifyModifier-C8ayvRzd.js +1 -0
- package/dist/assets/SkeletonUtils-Cps8GOC6.js +1 -0
- package/dist/assets/Sky-CQKCgYDs.js +154 -0
- package/dist/assets/SourceAssetViewer-2SWQoUut.js +12 -0
- package/dist/assets/StageHost-BN-IoTef.js +2 -0
- package/dist/assets/StoryPreviewMount-DjyxRCXu.js +1 -0
- package/dist/assets/TDSLoader-D_T8XJ81.js +1 -0
- package/dist/assets/TextGeometry-DOWAEUV0.js +1 -0
- package/dist/assets/ThreeBoardDocument-CVncZyIq.js +2 -0
- package/dist/assets/ThreeIsolationSceneContent-C8C8whSF.js +1 -0
- package/dist/assets/ToolObject3DPreview-BRoDWe4Q.js +1 -0
- package/dist/assets/TrackballControls-DfznuQTh.js +1 -0
- package/dist/assets/TransientHint-BB1fwrvK.js +1 -0
- package/dist/assets/UnrealBloomPass-CR-cS_K5.js +83 -0
- package/dist/assets/VideoViewer-C6kocgIU.js +1 -0
- package/dist/assets/_commonjsHelpers-D6-XlEtG.js +1 -0
- package/dist/assets/active-ingest-CT6jSGhr.js +3 -0
- package/dist/assets/adapter-surface-Y37Nzcyw.js +1 -0
- package/dist/assets/after-paint-CB4bz1-e.js +1 -0
- package/dist/assets/agx-base-srgb-BjWZJgrZ.lut +0 -0
- package/dist/assets/agx-look-medium-high-contrast-D5F_ob1L.lut +0 -0
- package/dist/assets/agx-look-punchy-dxsnycNs.lut +0 -0
- package/dist/assets/animation-clock-CnjZqfJp.js +1 -0
- package/dist/assets/asset-budget-asset.menu-Di3KiQCd.js +1 -0
- package/dist/assets/asset-budget.action-DCzzcuTh.js +1 -0
- package/dist/assets/asset-budget.document-BWU8wnVW.js +1 -0
- package/dist/assets/asset-budget.menu-BGZpT_31.js +1 -0
- package/dist/assets/asset-editor-persistence-BBaONOJt.js +1 -0
- package/dist/assets/asset-loaders-BOy5Ss8k.js +2 -0
- package/dist/assets/asset-parse-error-BHMwBRU3.js +3 -0
- package/dist/assets/assets-BuSoGjBX.js +1 -0
- package/dist/assets/audio-meter-CyiToeUW.js +1 -0
- package/dist/assets/audio-unlock.service-CfUgUQVy.js +1 -0
- package/dist/assets/audio.utility-C6K6jem8.js +1 -0
- package/dist/assets/authoring-CgcOFhGS.js +1 -0
- package/dist/assets/autoplay.service-BZBGNSvt.js +1 -0
- package/dist/assets/axe-LkjAB6Lv.js +30 -0
- package/dist/assets/babylon-authoring-adapter-CL02gWDn.js +1 -0
- package/dist/assets/binding-Bmxqznjk.js +1 -0
- package/dist/assets/binding-identity-DcTpbvyg.js +1 -0
- package/dist/assets/binding-resolver-Dsh-6Vor.js +2 -0
- package/dist/assets/blender-emscripten-engine-9ZIRYNhe.js +2 -0
- package/dist/assets/blender-node-editor.document-iIDkB9sI.js +1 -0
- package/dist/assets/blender-properties-tab-C5CyPydi.js +3 -0
- package/dist/assets/blender-runtime-host-BpBwGv7r.js +4 -0
- package/dist/assets/blender-runtime-skin-DyQ9B6CR.js +7140 -0
- package/dist/assets/blender-runtime.document-lIYhhPtv.js +8 -0
- package/dist/assets/blender-timeline.document-77fx96N7.js +1 -0
- package/dist/assets/blender-uv-editor.document-fsT7B4gV.js +1 -0
- package/dist/assets/blender-version.status-o6dBm3n6.js +1 -0
- package/dist/assets/blender-wali-engine-wTOcrOMC.js +2 -0
- package/dist/assets/blender.command-BtJeWk-A.js +1 -0
- package/dist/assets/blender.keymap-GAQgeklK.js +1 -0
- package/dist/assets/blender.status-ujwGU6dU.js +1 -0
- package/dist/assets/blender.style-Dcem5f_T.js +1 -0
- package/dist/assets/board-guides-DziKSTss.js +1 -0
- package/dist/assets/body-marks-h_xDxiDE.js +1 -0
- package/dist/assets/bridge.command-o5gDNEwa.js +3 -0
- package/dist/assets/browserAll-DeWblVez.js +1 -0
- package/dist/assets/build-profiles.document-kW8iw8Xj.js +2 -0
- package/dist/assets/build-progress.status-BNRLytg2.js +1 -0
- package/dist/assets/build-session-C_sg3CEn.js +9 -0
- package/dist/assets/build.action-lYjTLb7K.js +1 -0
- package/dist/assets/build.command-DIGgUPU_.js +1 -0
- package/dist/assets/build.header-CKajx5U3.js +1 -0
- package/dist/assets/build.menu-BdU0QXny.js +1 -0
- package/dist/assets/build.service-CbBAyeu3.js +1 -0
- package/dist/assets/bus-mixer-CGfWDP3C.js +1 -0
- package/dist/assets/camera-KEsKvOL7.js +1 -0
- package/dist/assets/camera-runtime.inspector-B7unX4g1.js +1 -0
- package/dist/assets/canvas-entry-runtime-SfBxaR9M.js +2 -0
- package/dist/assets/capability-coverage-Czas4C18.js +7 -0
- package/dist/assets/chrome-trace-YZHMz60-.js +1 -0
- package/dist/assets/client-DNXj_opT.js +25 -0
- package/dist/assets/clip-planes-CnAI6DZn.js +1 -0
- package/dist/assets/collaboration-presence-DLoZ7EA3.js +1 -0
- package/dist/assets/collider-Bw0mXlsW.js +1 -0
- package/dist/assets/collider-dimensions-9xoFADXN.js +1 -0
- package/dist/assets/collision-system-DpNUJRJ3.js +1 -0
- package/dist/assets/command-results-CUQD49AB.js +1 -0
- package/dist/assets/component-board-registry-DrIa2csL.js +1 -0
- package/dist/assets/component-board.service-DCwcUssB.js +2 -0
- package/dist/assets/component-board.service-DidCyM4O.js +2 -0
- package/dist/assets/component-verbs.command-7xzfjGMZ.js +1 -0
- package/dist/assets/component-verbs.service-Bv9jId3q.js +1 -0
- package/dist/assets/config-CEZk921y.js +6 -0
- package/dist/assets/configurations-DTBMdaTL.js +1 -0
- package/dist/assets/connection.status-BifnQdOs.js +1 -0
- package/dist/assets/console-bridge-CHcb-xk5.js +1 -0
- package/dist/assets/constraint-De8f1Uiq.js +1 -0
- package/dist/assets/constraints.inspector-B9U9Yj-u.js +1 -0
- package/dist/assets/countdown-timer-CUm74dom.js +1 -0
- package/dist/assets/coverage.service-VTX5Mcsx.js +3 -0
- package/dist/assets/crash-null-boundary-v3a0uEgw.js +1 -0
- package/dist/assets/create-runtime-CVCc1BDx.js +1 -0
- package/dist/assets/curve-7Q79VgU4.js +1 -0
- package/dist/assets/data-asset-4hjS642k.js +5 -0
- package/dist/assets/data-check-core-CQEjuFyt.js +1 -0
- package/dist/assets/data-ref-CQI28C0D.js +1 -0
- package/dist/assets/debug-bridge-CCohG-d-.js +1 -0
- package/dist/assets/debug-registry-Dgvitx8M.js +1 -0
- package/dist/assets/defaults-DKiBJCPN.js +1 -0
- package/dist/assets/deferred-commands-CEMmvL47.js +1 -0
- package/dist/assets/deferred-ingest-play-DCJi_Pgu.js +2 -0
- package/dist/assets/design-time-layers-wYgOTgni.js +1 -0
- package/dist/assets/design-time-mount-registry-DUpXCg1U.js +1 -0
- package/dist/assets/design-time-mount.service-BzY21e1F.js +2 -0
- package/dist/assets/design-time-react-mount-DM9WLrF2.js +1 -0
- package/dist/assets/dev-build-gDYrq68M.js +1 -0
- package/dist/assets/directional-shadow-fit-BVkOKAv2.js +1 -0
- package/dist/assets/document-preview-three-Kbg2GCLm.js +1 -0
- package/dist/assets/dom-authoring-adapter-CY8C7f4T.js +1 -0
- package/dist/assets/draco3d-BBUTcNkz.js +1 -0
- package/dist/assets/draco_decoder-DsQ12WqX.wasm +0 -0
- package/dist/assets/draco_encoder-2Tcju8Ns.wasm +0 -0
- package/dist/assets/edit-mode-audio.service-Bzetwd5B.js +1 -0
- package/dist/assets/edit-mode-authoring-B47TfLqu.js +1 -0
- package/dist/assets/edit-mode-networking.service-YCX6RRb_.js +1 -0
- package/dist/assets/editor-api-BoJIcyZG.js +1 -0
- package/dist/assets/editor-port-C_FeBdeV.js +1 -0
- package/dist/assets/editor-presentation-activity-C7SNSmTd.js +1 -0
- package/dist/assets/entry-adjudication-Cq8Yeb74.js +1 -0
- package/dist/assets/environment-capture-7himRh2L.js +1 -0
- package/dist/assets/esbuild-BHljloGq.wasm +0 -0
- package/dist/assets/events-156d8d12.esm-ErOhDXXB.js +36 -0
- package/dist/assets/extend-B-eOccUm.js +36 -0
- package/dist/assets/extends-CF3RwP-h.js +1 -0
- package/dist/assets/eyedropper-session-bjPXnfeX.js +1 -0
- package/dist/assets/fflate.module-DPuTF8aG.js +6 -0
- package/dist/assets/filmic-srgb-Ct35FIH6.lut +0 -0
- package/dist/assets/first-party-audio-system-DxnGJOER.js +1 -0
- package/dist/assets/first-party-navigation-system-CL5Bquub.js +1 -0
- package/dist/assets/fork-menu-BoVyw2Wu.js +1 -0
- package/dist/assets/frame-debugger-store-D1Mf_5up.js +1 -0
- package/dist/assets/frame-delta-D2nsw_Ht.js +1 -0
- package/dist/assets/frame-pacing-D5acoOzO.js +1 -0
- package/dist/assets/frame-selector-cache-cCeUbcjG.js +1 -0
- package/dist/assets/game-DHOZVb-7.js +1 -0
- package/dist/assets/game-contract-seams-a5YXejOu.js +1 -0
- package/dist/assets/game-css-scope-transform-Eng4wS8E.js +33 -0
- package/dist/assets/game-document.service-DbRfx2V0.js +1 -0
- package/dist/assets/game-eval.command-D-7Dxbj_.js +2 -0
- package/dist/assets/game-input-seams-CIQdetRw.js +1 -0
- package/dist/assets/game-loop-CZvXlY00.js +1 -0
- package/dist/assets/game-module-access-B2mFxv-i.js +1 -0
- package/dist/assets/game.layout-CBASrvQu.js +1 -0
- package/dist/assets/gameplay-export-BoKXm51x.js +1 -0
- package/dist/assets/gameplay-replay-e5umMlXv.js +1 -0
- package/dist/assets/gameplay-rng-trap-CTNhm-UW.js +3 -0
- package/dist/assets/gameplay.command-DxcVYX6F.js +1 -0
- package/dist/assets/generation-DhwCUHPf.css +1 -0
- package/dist/assets/generation-jobs-BQrXbGp_.js +1 -0
- package/dist/assets/generation.service-CDIgObuw.js +1 -0
- package/dist/assets/generations-DzUogZsM.js +1 -0
- package/dist/assets/generations.status-CgOUBCum.js +1 -0
- package/dist/assets/hierarchy-marks-BLPfSIym.js +1 -0
- package/dist/assets/host-pointer-DbGSCjE9.js +1 -0
- package/dist/assets/hosted-asset-materialization-CiIvWkGU.js +2 -0
- package/dist/assets/ibl-override-material-BlmCxFKq.js +6 -0
- package/dist/assets/index-96FBF1Oj.js +1 -0
- package/dist/assets/index-BAWkB0dv.js +1 -0
- package/dist/assets/index-BDnS2b6S.js +1 -0
- package/dist/assets/index-BHp07vN0.js +2 -0
- package/dist/assets/index-BMxv2MNV.js +1 -0
- package/dist/assets/index-BP6wv2A0.js +5 -0
- package/dist/assets/index-BcCBqgM_.js +952 -0
- package/dist/assets/index-Bge9JUr6.js +1 -0
- package/dist/assets/index-BjTCPEQ7.js +134 -0
- package/dist/assets/index-BncK9THk.js +1 -0
- package/dist/assets/index-CJbYy-CF.js +3 -0
- package/dist/assets/index-CVCb_ImQ.js +1 -0
- package/dist/assets/index-CZd9o7Lu.js +1 -0
- package/dist/assets/index-CanA16PU.js +2 -0
- package/dist/assets/index-CinJrH5C.js +9 -0
- package/dist/assets/index-CtzuWnCS.js +1 -0
- package/dist/assets/index-D2fNXpHa.css +1 -0
- package/dist/assets/index-DUpHH6JR.js +3120 -0
- package/dist/assets/index-DUqP1RMl.js +1 -0
- package/dist/assets/index-D_NuPfjr.js +9 -0
- package/dist/assets/index-Da9JhEvW.js +25 -0
- package/dist/assets/index-DgapqSPi.js +7 -0
- package/dist/assets/index-FUuS4qwW.js +562 -0
- package/dist/assets/index-GIL7oGEO.js +4894 -0
- package/dist/assets/index-IEjydI9d.js +1 -0
- package/dist/assets/index-OrYXPk3Z.js +487 -0
- package/dist/assets/index-V1R-e5Bd.js +1 -0
- package/dist/assets/index-bQE2NA0D.js +1 -0
- package/dist/assets/index-gHZae-lw.js +13 -0
- package/dist/assets/index-mjWQmGhM.js +1 -0
- package/dist/assets/index-nmcBqr7Y.js +1 -0
- package/dist/assets/inference-diagnostics-Dhmtfbq_.js +1 -0
- package/dist/assets/ingest-BbYMC2vQ.js +1 -0
- package/dist/assets/ingest-boot-viewport-D5rI_Kk_.js +1 -0
- package/dist/assets/ingest-siblings-Bop2kqVl.js +1 -0
- package/dist/assets/ingest-source-persistence-C_6Hiyra.js +1 -0
- package/dist/assets/ingest.service-BTDnQfM1.js +1 -0
- package/dist/assets/input-manager-DH_hGW6d.js +1 -0
- package/dist/assets/input-router-BNQvtIqw.js +1 -0
- package/dist/assets/inspect-BZfi3mmo.js +1 -0
- package/dist/assets/inspection-CObLhnrs.js +1 -0
- package/dist/assets/instance-fork-actions-D3sRzS3K.js +1 -0
- package/dist/assets/instances.command-D6UkZNO8.js +1 -0
- package/dist/assets/instruments-CKR02Y8I.js +1 -0
- package/dist/assets/json-history-resource-BbxllWfV.js +1 -0
- package/dist/assets/jsx-runtime-DPjLkJKQ.js +9 -0
- package/dist/assets/light-D-_wsKTq.js +1 -0
- package/dist/assets/light-camera-factory-CWbbe9gI.js +1 -0
- package/dist/assets/lil-gui.module.min-BF55BEwA.js +10 -0
- package/dist/assets/live-behaviors-Bxq49Maz.js +1 -0
- package/dist/assets/live-gesture-lock-DJbrjOqf.js +1 -0
- package/dist/assets/loader-CaF_I7Yt.js +1 -0
- package/dist/assets/logger-Dqis-7W1.js +1 -0
- package/dist/assets/loop-gate-report-N52EWFGD.js +1 -0
- package/dist/assets/matcap-texture-CVfalpWT.js +1 -0
- package/dist/assets/material-CpAdjDxn.js +1 -0
- package/dist/assets/material-factory-Bz6h__6g.js +1 -0
- package/dist/assets/mesh-B3WPtNKO.js +1 -0
- package/dist/assets/mesh-shadow-CZnXrw_l.js +1 -0
- package/dist/assets/mikktspace.module-DO88SLib.js +1 -0
- package/dist/assets/model-asset-sections-CFvvihfx.css +1 -0
- package/dist/assets/model-asset-sections.service-CHhFS3ZX.js +1 -0
- package/dist/assets/model.layout-BJUEQYUI.js +1 -0
- package/dist/assets/models.finder-G2jQgIRu.js +1 -0
- package/dist/assets/module-mode-DVBLT9d-.js +2 -0
- package/dist/assets/mount-canvas-ingest-root-DDuAWf_C.js +2 -0
- package/dist/assets/mount-dom-ingest-root-D_EiBgpn.js +2 -0
- package/dist/assets/mount-game-6t9cKNo4.js +1 -0
- package/dist/assets/mount-ingest-root-glv2SSWf.js +2 -0
- package/dist/assets/mount-manifest-CGVxhmAw.js +1 -0
- package/dist/assets/mount-readiness-Ds0HvvLH.js +4 -0
- package/dist/assets/mount-three-ingest-root-hrUt9VVU.js +1 -0
- package/dist/assets/mounted-authoring-Dmg5xmhP.js +1 -0
- package/dist/assets/mounted-story-viewport-source-DjP6RA9U.js +1 -0
- package/dist/assets/native-debug-module-CWicoSGD.js +1 -0
- package/dist/assets/native-entry-surface-BE8LJNdu.js +1 -0
- package/dist/assets/navigation-CIiCx-SM.js +1 -0
- package/dist/assets/navmesh-workflow-store-Cmnm57TB.js +1 -0
- package/dist/assets/navmesh.menu-CAKiH8PW.js +1 -0
- package/dist/assets/navmesh.service-jgDWlgj1.js +1 -0
- package/dist/assets/network.utility-CEu5nHf7.js +1 -0
- package/dist/assets/object-marks-DwvIEBOK.js +1 -0
- package/dist/assets/object3d-authoring-subject-CH5sI2oP.js +1 -0
- package/dist/assets/output-DK8waum9.js +195 -0
- package/dist/assets/particles-Y626p22p.js +1 -0
- package/dist/assets/particles-factory-DnLOHXT8.js +1 -0
- package/dist/assets/pasteboard-materialize-BqSS4QzV.js +20 -0
- package/dist/assets/pasteboard.action-DU3UHtJG.js +2 -0
- package/dist/assets/performance-profiler-D_Jey87L.js +1 -0
- package/dist/assets/physics-registry-B2Jkp8e6.js +1 -0
- package/dist/assets/physics-registry-CUB9cT9p.js +1 -0
- package/dist/assets/pixi-authoring-adapter-CjibysC3.js +1 -0
- package/dist/assets/pixi-live-write-target-DuWydlWb.js +1 -0
- package/dist/assets/pixi-primitive-DlWbUPN9.js +1 -0
- package/dist/assets/pixi-react-root-factory-DYsznYRQ.js +1 -0
- package/dist/assets/pixi-story-model-DNkfnWUV.js +1 -0
- package/dist/assets/pixi-transform-channels-VjdohT11.js +1 -0
- package/dist/assets/play-mode-BFU2PCkG.js +22 -0
- package/dist/assets/play.command-BpqqLqkq.js +2 -0
- package/dist/assets/playtest-BXIL1JEF.js +1 -0
- package/dist/assets/pose-guard-6Osb2cFu.js +1 -0
- package/dist/assets/presentation-BPP5pXeQ.js +1 -0
- package/dist/assets/product-DFhyARJj.js +1 -0
- package/dist/assets/profiler.action-CaXJDp3t.js +1 -0
- package/dist/assets/profiler.menu-BIMF6Bi4.js +1 -0
- package/dist/assets/profiler.utility-BExw9wBO.js +1 -0
- package/dist/assets/project-authoring-session-Bnt6icLr.js +2 -0
- package/dist/assets/project-provenance-BoP3nrle.js +1 -0
- package/dist/assets/prompt-labels-DSMdM2_B.js +1 -0
- package/dist/assets/properties-bone-constraints.inspector-ByT6p7S-.js +1 -0
- package/dist/assets/properties-bone.inspector-z4qJwKO5.js +1 -0
- package/dist/assets/properties-collection.inspector-D0_3ijWU.js +1 -0
- package/dist/assets/properties-constraints.inspector-CESzjuls.js +1 -0
- package/dist/assets/properties-data.inspector-hG8Wgyzb.js +1 -0
- package/dist/assets/properties-material.inspector-CzY0JCQ6.js +1 -0
- package/dist/assets/properties-modifiers.inspector-3dDhwf7g.js +1 -0
- package/dist/assets/properties-object.inspector-CiarfxkT.js +1 -0
- package/dist/assets/properties-output.inspector-DKJxmKSD.js +1 -0
- package/dist/assets/properties-particles.inspector-CCEdYWGm.js +1 -0
- package/dist/assets/properties-physics.inspector-B2c0KUyA.js +1 -0
- package/dist/assets/properties-render.inspector-Bcm0HLRW.js +1 -0
- package/dist/assets/properties-scene.inspector-PIM_eTb_.js +1 -0
- package/dist/assets/properties-texture.inspector-CgFlnyr8.js +1 -0
- package/dist/assets/properties-view-layer.inspector-DGjF_Aqo.js +1 -0
- package/dist/assets/properties-world.inspector-CrMvaRvB.js +1 -0
- package/dist/assets/r3f-design-session-D-4yyDO9.js +2 -0
- package/dist/assets/r3f-physics-binding-BBo8oma9.js +1 -0
- package/dist/assets/r3f-root-factory-z9llD1OU.js +1 -0
- package/dist/assets/r3f-source-authoring-adapter-w6Bc60K-.js +13 -0
- package/dist/assets/rapier-physics-adapter-CaZqWLu0.js +1 -0
- package/dist/assets/rapier-physics-bridge-CMoeVo3Y.js +1 -0
- package/dist/assets/react-18-By2b4xR9.js +1 -0
- package/dist/assets/react-inspector.service-B_neRnSK.js +1 -0
- package/dist/assets/react-root-CEz5NTck.js +1 -0
- package/dist/assets/react-story-board-BDDwiE2H.js +1 -0
- package/dist/assets/react-three-fiber.esm-CycrbDlA.js +1 -0
- package/dist/assets/react-three-rapier.esm-CEfKpvxT.js +1 -0
- package/dist/assets/react-world-authoring-adapter-DmrwM3py.js +1 -0
- package/dist/assets/realm-services-CobQsq_X.js +1 -0
- package/dist/assets/rebind-controller-Dtq19Vb3.js +1 -0
- package/dist/assets/recast-navigation.wasm-compat-Dsoa_MD-.js +1 -0
- package/dist/assets/reflection-probe-Don-M3Fj.js +1 -0
- package/dist/assets/reflection-probe-capture.inspector-CmFUoJCx.js +1 -0
- package/dist/assets/register-render-vitals-BiZk29b2.js +1 -0
- package/dist/assets/registry-02YZjMNp.js +1 -0
- package/dist/assets/relative-path-guard-GiM7Lsz8.js +1 -0
- package/dist/assets/render-audio-control-vMRlePWb.js +1 -0
- package/dist/assets/render-batch-system-0vq7p0VC.js +1 -0
- package/dist/assets/render-census-BrQX_CXv.js +1 -0
- package/dist/assets/render-control-Df3yTiyr.js +1 -0
- package/dist/assets/render-env-D2IV2x5k.js +1 -0
- package/dist/assets/render-features-CPQ_e568.js +1 -0
- package/dist/assets/render-seed-DF4JHy7P.js +1 -0
- package/dist/assets/render-settings-Bw4W9SYF.js +1 -0
- package/dist/assets/render-vitals-BZ5HtvMi.js +1 -0
- package/dist/assets/renderer-config-BqG4O8i9.js +1 -0
- package/dist/assets/resolve-three-SZE_WWUM.js +702 -0
- package/dist/assets/root-seam-contract-Z0VWX3Bk.js +1 -0
- package/dist/assets/rrweb-Cd2ifIRP.js +142 -0
- package/dist/assets/run-ticks-settled-C4ksViyA.js +1 -0
- package/dist/assets/runtime-inspection-l2iFQSsg.js +1 -0
- package/dist/assets/scene-capture-BQKzU0NT.js +1 -0
- package/dist/assets/scene-capture-CGYF-Viw.js +1 -0
- package/dist/assets/scene-document.service-qkDjUrlP.js +2 -0
- package/dist/assets/scene-framing-Cat0GtyJ.js +1 -0
- package/dist/assets/scene-index-B6BZOHMk.js +1 -0
- package/dist/assets/scene-query-C7_N-TpI.js +1 -0
- package/dist/assets/schema-kl9-2B_J.js +1 -0
- package/dist/assets/sculpt.layout-zJF55yCR.js +1 -0
- package/dist/assets/seeded-random-i3mtgBKZ.js +1 -0
- package/dist/assets/session-CZ5JPg-z.js +4877 -0
- package/dist/assets/setup-audio-S8GQF91f.js +1 -0
- package/dist/assets/setup-particles-GCXlnkj_.js +1 -0
- package/dist/assets/setup-physics-BeZ7-LKD.js +1 -0
- package/dist/assets/setup-renderer-DVXaSGin.js +1587 -0
- package/dist/assets/shading.layout-DULYZV6M.js +1 -0
- package/dist/assets/sim-clock-CLflx7kg.js +1 -0
- package/dist/assets/sky-precompute-worker-ChN7J87v.js +1 -0
- package/dist/assets/soft-particle-depth-DGvfQDi1.js +1 -0
- package/dist/assets/source-object3d-authoring-adapter-B-L6Ha6f.js +1 -0
- package/dist/assets/source-persistence-backend-C-aR-B_Y.js +1 -0
- package/dist/assets/spark-renderer-lifecycle-ynWESJcv.js +1 -0
- package/dist/assets/spark.module-4pXQoz5d.js +12120 -0
- package/dist/assets/stage-invalidation-DBg3C3Ta.js +1 -0
- package/dist/assets/stage-keyboard-n-5kKH-m.js +1 -0
- package/dist/assets/stage-overlay-set-B9zp2sLB.js +1 -0
- package/dist/assets/stage-presence-markers-DiGI6A45.js +1 -0
- package/dist/assets/standard-viewport-dressing-CzjAe_0A.js +7 -0
- package/dist/assets/state-bridge-DLP1jLRW.js +1 -0
- package/dist/assets/state-watch.action-BOvQR2qt.js +1 -0
- package/dist/assets/state-watch.menu-CNLvDeeY.js +1 -0
- package/dist/assets/state-watch.utility-Bg1tTTQU.js +1 -0
- package/dist/assets/static-batch-advisor-B13QEH7d.js +1 -0
- package/dist/assets/stats.module-BL02l9NC.js +1 -0
- package/dist/assets/story-arg-descriptors-Ek86ExX7.js +1 -0
- package/dist/assets/story-capture-_gC8dXV-.js +1 -0
- package/dist/assets/story-documents--TDLaPeL.js +3 -0
- package/dist/assets/story-documents.service-BiS_YbNQ.js +1 -0
- package/dist/assets/story-documents.service-CxOPYJ2j.js +1 -0
- package/dist/assets/story-media-presence-BHzk2IV5.js +1 -0
- package/dist/assets/story-mount-turn-DFRTj5hi.js +1 -0
- package/dist/assets/story-pixi-preview-BUrOJZXS.js +1 -0
- package/dist/assets/story-presentation-j2AVN-mK.js +1 -0
- package/dist/assets/story-three-preview-BHEDZzcl.js +2 -0
- package/dist/assets/structural-ids-Dc-7rEwi.js +1 -0
- package/dist/assets/structural-signature-0w-i_ats.js +1 -0
- package/dist/assets/surface-content-Dg9Kkazf.js +1 -0
- package/dist/assets/surface-state-DaxyruCj.js +3 -0
- package/dist/assets/system-adapters-rIC8FSGP.js +1 -0
- package/dist/assets/system-runner-DkOjxEBt.js +1 -0
- package/dist/assets/system-slot-E2mEdiih.js +1 -0
- package/dist/assets/team-playtest.service-DqOinFVA.js +1 -0
- package/dist/assets/texture.layout-DASpHVht.js +1 -0
- package/dist/assets/three-CDSueJyJ.js +1 -0
- package/dist/assets/three-authoring-adapter-CmSQ3Vui.js +1 -0
- package/dist/assets/three-authoring.service-iuHLwtf1.js +2 -0
- package/dist/assets/three-ingest-runtime-QzDYk6tU.js +1 -0
- package/dist/assets/three-projection-core-BmKMZ-nf.js +1 -0
- package/dist/assets/three-viewport-presentation-QBQpSdMh.js +1 -0
- package/dist/assets/three.module-D396a9Mn.js +3840 -0
- package/dist/assets/three.quarks.esm-B1C61jGo.js +1039 -0
- package/dist/assets/tools-B_NJsk05.js +1 -0
- package/dist/assets/transform-writer-BhBBTx33.js +1 -0
- package/dist/assets/transport.header-B-6HQlU2.js +1 -0
- package/dist/assets/trigger-volume-BNK2XzPL.js +1 -0
- package/dist/assets/tuples-CIQ4Bn1U.js +1 -0
- package/dist/assets/tween.module-DciWpAG6.js +1 -0
- package/dist/assets/ui-board-document-Bwtt--xp.js +2 -0
- package/dist/assets/unexported-game-trap-Dm1JYKHy.js +2 -0
- package/dist/assets/unmanaged-root-detector-B8CpbkSN.js +2 -0
- package/dist/assets/upstream-pin-BdgRH6ID.js +1 -0
- package/dist/assets/use-data-Dzq-MytE.js +1 -0
- package/dist/assets/use-live-actor-state-DErbWQWF.js +1 -0
- package/dist/assets/use-selection-DbR73-xd.js +1 -0
- package/dist/assets/user-data-BB2Of6Ht.js +1 -0
- package/dist/assets/utility-view-state-BHypxA33.js +1 -0
- package/dist/assets/uv-editing.layout-BEKHxmHw.js +1 -0
- package/dist/assets/vgai-shared-fontawesome-CU65D4Ij.js +1 -0
- package/dist/assets/vgai-shared-jsx-dev-runtime-DFDKL7fx.js +1 -0
- package/dist/assets/vgai-shared-jsx-runtime-DIqBpTut.js +1 -0
- package/dist/assets/vgai-shared-react-BT7rMc2H.js +1 -0
- package/dist/assets/vgai-shared-react-dom-DFajMqMT.js +1 -0
- package/dist/assets/vgai-shared-react-dom-client-S0ozfl6_.js +1 -0
- package/dist/assets/vgai-shared-three-Bc5PvpLM.js +1 -0
- package/dist/assets/viewport-pick-context-DkawXbEi.js +1 -0
- package/dist/assets/viewport-root-presentation-CWsE56K6.js +1 -0
- package/dist/assets/viewport-shading-BuA88e_A.js +1 -0
- package/dist/assets/viewport-shading-boundary-B_-_gABg.js +82 -0
- package/dist/assets/viewport-surface-status-B3om4Kcf.js +1 -0
- package/dist/assets/vision_bundle-DX0dWqEa.js +15 -0
- package/dist/assets/voxel-surface-DtcsSWRL.js +1 -0
- package/dist/assets/wav-encode-D31zWF6O.js +1 -0
- package/dist/assets/webgl-frame-capture-FlF9zQmW.js +1 -0
- package/dist/assets/webgl-gpu-timer-D3YX7RaD.js +1 -0
- package/dist/assets/webworkerAll-CM2o_dnz.js +1 -0
- package/dist/assets/worker-UrMcrc5_.js +2 -0
- package/dist/assets/world-documents-147tiFZe.js +1 -0
- package/dist/assets/world-root-stage-binding-vwTrtBz6.js +1 -0
- package/dist/assets/world-state-BWG-IcOd.js +1 -0
- package/dist/assets/writer-B-KovzkA.js +5 -0
- package/dist/assets/xstate-animation-binding-Brd0NST6.js +1 -0
- package/dist/assets/xstate-animation-meta-Q3u9zh_m.js +1 -0
- package/dist/assets/xstate-behavior.action-B8UluFBK.js +1 -0
- package/dist/assets/xstate-behavior.document-CKAsE45I.js +1 -0
- package/dist/assets/xstate-behavior.inspector-vJJyuifc.js +1 -0
- package/dist/assets/xstate-behavior.menu-BXbPICIh.js +1 -0
- package/dist/assets/xstate-inspection-BsZv8LS9.js +1 -0
- package/dist/vgai-shared-react.json +10 -0
- package/dist/vgai-shared-three.json +3 -0
- package/dist-node/cli.js +9320 -0
- package/dist-node/create.js +3239 -0
- package/package.json +91 -0
- package/presets.mjs +2 -0
- package/src/contributions.d.ts +4 -0
- package/src/index.ts +38 -0
- package/starter/cube.blend +0 -0
- package/starter/cube.py +81 -0
- package/template/.agents/references/project-manual.md +341 -0
- package/template/.agents/skills/editor/SKILL.md +53 -0
- package/template/.agents/skills/editor/agents/openai.yaml +4 -0
- package/template/.agents/skills/editor/references/editor-control.md +363 -0
- package/template/.agents/skills/vgai-3d-models/SKILL.md +64 -0
- package/template/.agents/skills/vgai-ingest-existing-game/SKILL.md +112 -0
- package/template/.agents/skills/vgai-threejs-authoring/SKILL.md +347 -0
- package/template/.agents/skills/vgai-threejs-authoring/agents/openai.yaml +4 -0
- package/template/.agents/skills/vgai-threejs-authoring/references/helper-catalog.md +65 -0
- package/template/.claude/skills/editor/SKILL.md +53 -0
- package/template/.claude/skills/editor/agents/openai.yaml +4 -0
- package/template/.claude/skills/editor/references/editor-control.md +363 -0
- package/template/.claude/skills/vgai-3d-models/SKILL.md +64 -0
- package/template/.claude/skills/vgai-ingest-existing-game/SKILL.md +112 -0
- package/template/.claude/skills/vgai-threejs-authoring/SKILL.md +347 -0
- package/template/.claude/skills/vgai-threejs-authoring/agents/openai.yaml +4 -0
- package/template/.claude/skills/vgai-threejs-authoring/references/helper-catalog.md +65 -0
- package/template/.github/copilot-instructions.md +6 -0
- package/template/.github/skills/editor/SKILL.md +53 -0
- package/template/.github/skills/editor/agents/openai.yaml +4 -0
- package/template/.github/skills/editor/references/editor-control.md +363 -0
- package/template/.github/skills/vgai-3d-models/SKILL.md +64 -0
- package/template/.github/skills/vgai-ingest-existing-game/SKILL.md +112 -0
- package/template/.github/skills/vgai-threejs-authoring/SKILL.md +347 -0
- package/template/.github/skills/vgai-threejs-authoring/agents/openai.yaml +4 -0
- package/template/.github/skills/vgai-threejs-authoring/references/helper-catalog.md +65 -0
- package/template/.mcp.json +12 -0
- package/template/.vgai/assets.json +1 -0
- package/template/.vgai/provenance.json +4 -0
- package/template/.volter/tracker/validation/.preset.base.mts +178 -0
- package/template/.volter/tracker/validation/preset.mts +186 -0
- package/template/.volter/tracker/visualizer/.extension.base.tsx +14 -0
- package/template/.volter/tracker/visualizer/extension.tsx +14 -0
- package/template/.volter/tracker-config.json +17 -0
- package/template/AGENTS.md +176 -0
- package/template/CLAUDE.md +1 -0
- package/template/DEVLOG.md +20 -0
- package/template/IDIOMS.md +118 -0
- package/template/LICENSE +30 -0
- package/template/README.md +83 -0
- package/template/ROADMAP.md +20 -0
- package/template/asset-manifest.json +3 -0
- package/template/check-idioms.ts +1533 -0
- package/template/index.html +18 -0
- package/template/manifest-entry-modules-plugin.ts +53 -0
- package/template/package.json +62 -0
- package/template/public/jsm/libs/basis/basis_transcoder.js +19 -0
- package/template/public/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/template/public/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/template/public/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/template/public/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/template/public/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/template/public/shaders/daylight-sky.frag.glsl +15 -0
- package/template/public/shaders/daylight-sky.vert.glsl +7 -0
- package/template/scripts/patch-drei-stats-gl.mjs +35 -0
- package/template/server/colyseus-setup.ts +111 -0
- package/template/server/loopback.ts +76 -0
- package/template/server/main.ts +78 -0
- package/template/server/rooms/arena-room.ts +488 -0
- package/template/server/rooms/game-room.ts +274 -0
- package/template/server/rooms.ts +15 -0
- package/template/server/tsconfig.json +19 -0
- package/template/src/bot/QaTester.tsx +35 -0
- package/template/src/bot/behaviors.ts +203 -0
- package/template/src/bot/bot-station.ts +192 -0
- package/template/src/bot/tester-run.ts +238 -0
- package/template/src/bot/tester-station.ts +193 -0
- package/template/src/components/environment/DaylightSky.tsx +54 -0
- package/template/src/components/environment/Ground.tsx +129 -0
- package/template/src/components/environment/SceneAtmosphere.tsx +14 -0
- package/template/src/components/environment/SoftGroundShadow.tsx +62 -0
- package/template/src/components/environment/SunShadowFit.tsx +141 -0
- package/template/src/contributions/README.md +98 -0
- package/template/src/contributions/analytics.analytics.tsx +26 -0
- package/template/src/contributions/data.document.tsx +35 -0
- package/template/src/contributions/pages.finder.ts +61 -0
- package/template/src/contributions/tester.inspector.tsx +64 -0
- package/template/src/contributions/use-game-modules.ts +80 -0
- package/template/src/data/README.md +17 -0
- package/template/src/input.ts +97 -0
- package/template/src/lib/audio/capability.json +4 -0
- package/template/src/lib/audio/sfx.ts +255 -0
- package/template/src/lib/react-root/capability.json +4 -0
- package/template/src/lib/react-root/index.ts +20 -0
- package/template/src/lib/react-root/react-root-adapter.tsx +57 -0
- package/template/src/lib/reflections/ReflectionProbe.tsx +201 -0
- package/template/src/lib/reflections/capability.json +4 -0
- package/template/src/lib/reflections/index.ts +19 -0
- package/template/src/lib/reflections/probe-controller.ts +75 -0
- package/template/src/lib/reflections/reflection-probe-registry.ts +402 -0
- package/template/src/lib/reflections/volume-reflection-material.ts +416 -0
- package/template/src/lib/static-batch/Frozen.tsx +91 -0
- package/template/src/lib/static-batch/capability.json +4 -0
- package/template/src/lib/static-batch/freeze.ts +579 -0
- package/template/src/lib/static-batch/index.ts +44 -0
- package/template/src/lib/static-batch/mutation-watch.ts +149 -0
- package/template/src/lib/static-batch/shadow-cache.ts +171 -0
- package/template/src/main.ts +63 -0
- package/template/src/manifest-entry-modules.d.ts +3 -0
- package/template/src/prefabs/HeroBox.stories.tsx +23 -0
- package/template/src/prefabs/HeroBox.tsx +35 -0
- package/template/src/scenes/MainScene.tsx +77 -0
- package/template/src/world.tsx +87 -0
- package/template/tsconfig.json +35 -0
- package/template/tsconfig.node.json +32 -0
- package/template/tsconfig.tools.json +22 -0
- package/template/validate-asset-content.ts +27 -0
- package/template/validate-assets.ts +60 -0
- package/template/validate-manifest.ts +55 -0
- package/template/vgai.adapter.ts +76 -0
- package/template/vgai.project.json +24 -0
- package/template/vite.config.ts +247 -0
- package/template-dotfiles/gitignore +63 -0
- package/workbench/src/media/game-cover.css +83 -0
- package/workbench/src/product.contribution.ts +188 -0
- package/workbench/src/vgaiGameSkew.ts +276 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BcCBqgM_.js","assets/three.module-D396a9Mn.js","assets/stage-overlay-set-B9zp2sLB.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/index-GIL7oGEO.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-D2fNXpHa.css","assets/viewport-shading-boundary-B_-_gABg.js","assets/stage-invalidation-DBg3C3Ta.js","assets/clip-planes-CnAI6DZn.js","assets/three-CDSueJyJ.js","assets/viewport-pick-context-DkawXbEi.js","assets/OrbitControls-CM3bPray.js","assets/LineSegments2-CsOpKSiM.js","assets/three.quarks.esm-B1C61jGo.js","assets/live-gesture-lock-DJbrjOqf.js","assets/scene-framing-Cat0GtyJ.js","assets/three-viewport-presentation-QBQpSdMh.js","assets/TransientHint-BB1fwrvK.js","assets/stage-keyboard-n-5kKH-m.js","assets/stage-presence-markers-DiGI6A45.js","assets/collaboration-presence-DLoZ7EA3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aI as Wr,lP as Gt,aN as sr,ki as qt,ks as ut,aO as Ut,V as Ir,ek as Vr,lQ as Nr,lw as zr,aM as rr,_ as mt,ao as be,f8 as ge,a5 as ve,a6 as re,bo as Gr,a9 as dt,lR as nr,lS as Ur,dP as $r,f7 as Ie,an as qr,lT as Kr,jM as Xr,lU as Yr,lV as Zr,lW as Jr,lX as Qr,b4 as en,ah as Ts,lY as ir,aS as tn,fS as sn,lZ as Fs,l_ as As,l$ as Hs,b9 as _s,m0 as rn,kh as Bs,jO as nn,kG as Ls,m1 as Ds,m2 as on,m3 as an,hi as cn,fm as ln,kt as un,m4 as Ws,m5 as dn,kg as hn,gu as pn,eV as fn,m6 as Is,m7 as mn,lv as gn,m8 as vn,m9 as bn,ho as wn,ma as yn}from"./index-GIL7oGEO.js";import{a as d}from"./jsx-runtime-DPjLkJKQ.js";import{i as G,s as Vs}from"./stage-invalidation-DBg3C3Ta.js";import{r as p}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{A as Sn,a1 as xn,j as or,k as Ns,an as Pn,z as pt,ap as Mn,b7 as Cn,bc as kn,F as En,C as ne,aX as Kt,aB as Rn,aC as jn,a_ as On,b1 as Tn,V as K,ar,cE as zs,u as $t,o as Fn,h as An,b0 as Hn,cv as _n,aZ as Bn,a4 as Gs,K as Ln,S as Dn,r as cr,bF as Wn,D as In,w as lr,v as Vn,cb as Nn,as as Us,g as ht,t as $s,a as qs}from"./three.module-D396a9Mn.js";import{l as zn,w as Gn}from"./live-gesture-lock-DJbrjOqf.js";import{b as Un,p as ft,a as Ks,i as Xs,c as $n,C as qn,E as Kn}from"./viewport-shading-boundary-B_-_gABg.js";import{a as Xn,b as Yn,L as Zn}from"./LineSegments2-CsOpKSiM.js";import{S as Jn}from"./source-object3d-authoring-adapter-B-L6Ha6f.js";import{s as Qn,i as Dt}from"./editor-presentation-activity-C7SNSmTd.js";import{STANDARD_ENVIRONMENT_INTENSITY as ei,applyStandardViewportDressing as ti,watchPaletteBackdrop as si,createGradientBackgroundTexture as ri}from"./standard-viewport-dressing-CzjAe_0A.js";import{V as ni,O as ii}from"./viewport-surface-status-B3om4Kcf.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./clip-planes-CnAI6DZn.js";import"./three-CDSueJyJ.js";import"./viewport-pick-context-DkawXbEi.js";import"./OrbitControls-CM3bPray.js";import"./three.quarks.esm-B1C61jGo.js";import"./scene-framing-Cat0GtyJ.js";import"./three-projection-core-BmKMZ-nf.js";const ur=30;function dr(r,e,t){return r<e?e:r>t?t:r}function oi(r,e){const t=r.animations;if(t.length===0)return null;const s=new Sn(r);let i=t[0];if(!i)return null;const o=a=>{s.stopAllAction();const l=s.clipAction(a);l.paused=!0,l.play(),i=a};o(i);const c=e.attach({id:r.uuid,label:r.name||i.name||"Clip",range:()=>({start:0,end:i?.duration??0,fps:ur}),seek:a=>{s.setTime(dr(a,0,i?.duration??0))},clips:()=>t.map(a=>({id:a.name,label:a.name})),setClip:a=>{const l=t.find(w=>w.name===a);l&&o(l)}});return()=>{c(),s.stopAllAction(),s.uncacheRoot(r)}}function ai(r,e){const t=Wr(r,"_animationRuntime");if(!t)return null;const s=[...t.clips.entries()];let i=s[0]?.[1];if(!i)return null;const o=a=>{t.mixer.stopAllAction();const l=t.mixer.clipAction(a);l.paused=!0,l.play(),i=a};return e.attach({id:r.uuid,label:r.name||i.name||"Animation",range:()=>({start:0,end:i?.duration??0,fps:ur}),seek:a=>{t.mixer.setTime(dr(a,0,i?.duration??0))},clips:()=>s.map(([a,l])=>({id:a,label:l.name||a})),setClip:a=>{const l=t.clips.get(a);l&&o(l)}})}function Ys(r,e){const t=new Map,s=()=>{const i=new Set;r.traverse(o=>{if(t.has(o.uuid)){i.add(o.uuid);return}const c=ai(o,e)??oi(o,e);c&&(t.set(o.uuid,c),i.add(o.uuid))});for(const[o,c]of[...t])i.has(o)||(c(),t.delete(o))};return s(),{refresh:s,dispose:()=>{for(const i of t.values())i();t.clear()}}}const me=()=>globalThis.performance?.now()??Date.now();function ci(r,e){return r.length===0?0:r[Math.min(r.length-1,Math.floor((r.length-1)*e))]??0}function li(r=!1){const e=new Set,t=[],s=new Map,i=new Map,o=new Map;let c=[],a=[],l=r,w=!1,C=!1,f=0,_=0,S=0;const N=[];let U=0,$=0,v={gpuMs:null,drawCalls:0,triangles:0,geometries:0,textures:0,renderPasses:null},R={enabled:l,recording:C,fps:0,cpuMs:0,p95Ms:0,p99Ms:0,frames:[],phases:[],systems:[],components:[],render:v};function D(){const m=t.at(-1),T=t.slice();let O;const W=P=>(O??=T.map(M=>M.intervalMs).filter(M=>M>0).sort((M,ie)=>M-ie),ci(O,P));R={enabled:l,recording:C,fps:m?.intervalMs?1e3/m.intervalMs:0,cpuMs:m?.cpuMs??0,get p95Ms(){return W(.95)},get p99Ms(){return W(.99)},frames:T,phases:m?.phases??[],systems:[...i].map(([P,M])=>({name:P,ms:M})).sort((P,M)=>M.ms-P.ms),components:[...o].map(([P,M])=>({name:P,ms:M})).sort((P,M)=>M.ms-P.ms),render:v};for(const P of e)P()}return{get enabled(){return l},set enabled(m){l!==m&&(l=m,m&&!w&&(S=0),D())},get telemetryEnabled(){return w},set telemetryEnabled(m){if(w===m)return;const T=!l&&!w;w=m,m&&T&&(S=0),D()},get recording(){return C},startRecording(){const m=!l&&!w;l=!0,m&&(S=0),C=!0,t.length=0,D()},stopRecording(){C=!1,D()},clear(){t.length=0,D()},beginFrame(){!l&&!w||(s.clear(),i.clear(),o.clear(),c=[],a=[],N.length=0,v={gpuMs:null,drawCalls:0,triangles:0,geometries:0,textures:0,renderPasses:null},_=me())},beginPhase(){l&&N.push(me())},endPhase(m){if(!l)return;const T=N.pop()??_,O=me()-T,W=s.get(m);s.set(m,{ms:(W?.ms??0)+O,startMs:W?.startMs??T-_}),C&&performance.measure(`vgai.phase.${m}`,{start:T,duration:O})},systemObserver:{beginSystem(){l&&(U=me())},endSystem(m,T,O){if(!l)return;const W=me(),P=`${m} / ${T} / ${O}`;i.set(P,(i.get(P)??0)+W-U),c.push({name:P,phase:T,startMs:U-_,ms:W-U})}},beginComponent(){C&&($=me())},endComponent(m,T=""){if(!C)return;const O=me();o.set(m,(o.get(m)??0)+O-$),a.push({name:m,phase:T,startMs:$-_,ms:O-$})},reportRender(m){l&&(v={gpuMs:m.gpuMs??v.gpuMs,drawCalls:v.drawCalls+m.drawCalls,triangles:v.triangles+m.triangles,geometries:v.geometries+m.geometries,textures:v.textures+m.textures,renderPasses:m.renderPasses===void 0?v.renderPasses:(v.renderPasses??0)+m.renderPasses})},endFrame(){if(!l&&!w)return;const m=me(),T=S===0?0:_-S;S=_;const O={id:++f,timestamp:m,intervalMs:T,cpuMs:m-_,phases:[...s].map(([W,{ms:P,startMs:M}])=>({name:W,ms:P,startMs:M})).sort((W,P)=>P.ms-W.ms),systems:c.slice(),components:a.slice(),render:{...v}};t.push(O),t.length>600&&t.splice(0,t.length-600),C&&performance.measure("vgai.frame",{start:_,duration:O.cpuMs}),D()},subscribe(m){return e.add(m),()=>{e.delete(m)}},getSnapshot(){return R},exportJSON(){return JSON.stringify({version:2,capturedAt:new Date().toISOString(),frames:t},null,2)}}}const hr=256;function ui(r){const e=Math.min(1,Math.max(0,r));return e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055}function Wt(r,e,t){const s=Math.hypot(r,e,t)||1;return[r/s,e/s,t/s]}function di(r=hr){const e=document.createElement("canvas");e.width=r,e.height=r;const t=e.getContext("2d");if(!t)return e;const s=t.createImageData(r,r),i=Wt(-.45,.62,.64),o=Wt(.65,-.35,.5),c=Wt(i[0],i[1],i[2]+1),a=[.7,.69,.68],l=[.34,.4,.52],w=[.85,.88,1];for(let C=0;C<r;C++)for(let f=0;f<r;f++){const _=(f+.5)/r/.5-1,S=1-(C+.5)/r/.5,N=_*_+S*S,U=N>1,$=U?1/Math.sqrt(N):1,v=_*$,R=S*$,D=U?0:Math.sqrt(Math.max(0,1-N)),m=Math.max(0,v*i[0]+R*i[1]+D*i[2]),T=Math.max(0,v*o[0]+R*o[1]+D*o[2]),O=Math.max(0,v*c[0]+R*c[1]+D*c[2])**42*.5,W=(1-D)**3.2*.4,P=(C*r+f)*4;for(let M=0;M<3;M++){const ie=a[M]*(.16+.8*m)+l[M]*.3*T+w[M]*W+O;s.data[P+M]=Math.round(ui(ie)*255)}s.data[P+3]=255}return t.putImageData(s,0,0),e}function hi(r=hr){const e=new xn(di(r));return e.colorSpace=or,e.minFilter=Ns,e.magFilter=Ns,e.generateMipmaps=!1,e.needsUpdate=!0,e}function pi(r){return r.color?.clone()??new ne(12502993)}function It(r,e){return r[e]??null}class fi{_derived=new Map;_normals=new Pn;_matcap=null;_matcapTexture=null;_overdraw=new pt({color:16777215,transparent:!0,opacity:.08,depthTest:!1,depthWrite:!1,blending:Cn,side:Mn,toneMapped:!1});render(e,t,s,i=()=>!0){if(t==="solid"){s();return}const o=[];e.traverse(c=>{const a=c;!a.isMesh||!a.material||!i(a)||(o.push({mesh:a,material:a.material}),a.material=Array.isArray(a.material)?a.material.map(l=>this._materialFor(l,t)):this._materialFor(a.material,t))});try{s()}finally{for(const{mesh:c,material:a}of o)c.material=a}}dispose(){for(const e of this._derived.values())e.clay.dispose(),e.unlit.dispose(),e.wireframe.dispose();this._derived.clear(),this._normals.dispose(),this._overdraw.dispose(),this._matcap?.dispose(),this._matcapTexture?.dispose(),this._matcap=null,this._matcapTexture=null}_materialFor(e,t){if(t==="normals")return this._normals;if(t==="overdraw")return this._overdraw;if(t==="matcap")return this._matcap||(this._matcapTexture=hi(),this._matcap=new kn({matcap:this._matcapTexture,toneMapped:!1})),this._matcap;let s=this._derived.get(e);if(!s){const i={color:pi(e),map:It(e,"map"),alphaMap:It(e,"alphaMap"),alphaTest:e.alphaTest,opacity:e.opacity,transparent:e.transparent,side:e.side,depthTest:e.depthTest,depthWrite:e.depthWrite,vertexColors:!!e.vertexColors,fog:e.fog??!0};s={clay:new En({color:11450048,roughness:.82,metalness:0,flatShading:!0,alphaMap:It(e,"alphaMap"),alphaTest:e.alphaTest,opacity:e.opacity,transparent:e.transparent,side:e.side,depthTest:e.depthTest,depthWrite:e.depthWrite}),unlit:new pt(i),wireframe:new pt({...i,wireframe:!0})},this._derived.set(e,s)}return s[t]}}class mi extends Kt{constructor(e,t){super(),this.bones=e;const s=new Set;for(const a of e){const l=a.parent;l?.isBone&&this.addSegment(l,a,s);for(const w of a.children)w.isBone&&this.addSegment(a,w,s)}this.linePositions=new Float32Array(Math.max(this.segments.length*6,6));const i=new Xn;i.setPositions(this.linePositions),this.lineMaterial=new Yn({color:t,linewidth:5,worldUnits:!1,depthTest:!1,depthWrite:!1,toneMapped:!1,alphaToCoverage:!0}),this.lines=new Zn(i,this.lineMaterial),this.lines.onBeforeRender=a=>{a.getSize(this.lineMaterial.resolution)},this.lines.frustumCulled=!1,this.lines.renderOrder=1001,this.add(this.lines),this.pointPositions=new Float32Array(Math.max(e.length*3,3));const o=new Rn;o.setAttribute("position",new jn(this.pointPositions,3));const c=new On({color:t,size:11,sizeAttenuation:!1,depthTest:!1,depthWrite:!1,toneMapped:!1});this.points=new Tn(o,c),this.points.frustumCulled=!1,this.points.renderOrder=1002,this.add(this.points),this.name="__object3d_document_bone_selection",Gt(this,"editorHelper",!0),this.traverse(a=>a.layers.set(sr)),this.update()}segments=[];linePositions;pointPositions;lines;lineMaterial;points;worldPosition=new K;setColor(e){this.lineMaterial.color.setHex(e),this.points.material.color.setHex(e)}update(){let e=0;for(const[i,o]of this.segments)i.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e),o.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e+3),e+=6;const t=this.lines.geometry.getAttribute("instanceStart");t&&(t.data.needsUpdate=!0),e=0;for(const i of this.bones)i.getWorldPosition(this.worldPosition),this.pointPositions.set(this.worldPosition.toArray(),e),e+=3;const s=this.points.geometry.getAttribute("position");s&&(s.needsUpdate=!0)}dispose(){this.lines.geometry.dispose(),this.lineMaterial.dispose(),this.points.geometry.dispose(),this.points.material.dispose()}addSegment(e,t,s){const i=`${e.uuid}:${t.uuid}`;s.has(i)||(s.add(i),this.segments.push([e,t]))}}const gi="skeletons",Vt=new ne(58879),Nt=new ne(16756736);function vi(r){const e=r.geometry.getAttribute("color");for(let s=0;s<e.count;s+=2)e.setXYZ(s,Vt.r,Vt.g,Vt.b),s+1<e.count&&e.setXYZ(s+1,Nt.r,Nt.g,Nt.b);e.needsUpdate=!0,r.renderOrder=999;const t=r.material;t.depthTest=!1,t.depthWrite=!1,t.toneMapped=!1,Gt(r,"editorHelper",!0),Gt(r,"editorHelperType",gi),r.traverse(s=>s.layers.set(sr))}const bi=1,wi=700,yi=.001,Si=Math.PI-.001,xi=r=>r<.5?4*r*r*r:1-(-2*r+2)**3/2,Pi=r=>r;function Ee(r,e){return typeof r=="number"&&Number.isFinite(r)?r:e}const Zs={mode:"solid",grid:!0,background:"neutral",exposure:1,projection:"perspective",lighting:"studio",skeleton:!1,bounds:!1};class Mi{constructor(e,t,s,i,o,c=[],a,l=new ne(2106410),w=null){this.documentId=e,this.root=t,this.scene=s,this.renderer=i,this.viewport=o,this.editorLights=c,this.authoring=a,this.neutralBackground=l,this.frameBox=w,this.unsubscribeSelectionTheme=qt(i.domElement,this.syncSelectionTheme),o.orbitControls.addEventListener("start",this.cancelLookForHuman)}profiler=li();shading=new fi;helpers=[];skeletonHelper=null;boundsHelper=null;boneSelectionHighlight=null;boneSelectionSignature="";composer=null;composerLoading=!1;disposed=!1;sceneRenderPass=null;selectionOutline=null;selectionOutlinePass=null;selectedObjects=[];renderWidth=1;renderHeight=1;orthographicCamera=new ar;captureAspect=null;cameraOverride=null;beforeRender=null;state=Zs;version=0;listeners=new Set;unsubscribeSelectionTheme=()=>{};flight=null;flightPose=new K;topologyOverlay=null;topologyFollowers=[];replaceContent(e,t){G(),this.selectionOutline?.selection.clear(),this.selectedObjects=[],this.boneSelectionSignature="",this.clearBoneSelectionHighlight(),this.clearSkeletonHelper(),this.clearBoundsHelper(),this.clearTopologyOverlay(),this.root=e,this.authoring=t,this.state.mode==="wireframe"&&this.buildTopologyOverlay(),this.state.bounds&&(this.boundsHelper=new zs(e,16757844),this.addHelper(this.boundsHelper,"bounds")),this.syncSelectionPresentation(),this.refreshSkeletonHelper(),this.notify()}cancelLookForHuman=()=>{this.settleFlight("human")};syncSelectionTheme=()=>{const e=ut(this.renderer.domElement).visible;this.selectionOutline&&Un(this.selectionOutline,ut(this.renderer.domElement)),this.boneSelectionHighlight?.setColor(e)};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.version;presentation(){return this.state}resolveFrameBounds(){const e=this.authoring?.selection?.get()??[];if(e.length>0){const t=new $t;let s=!1;for(const i of e){const o=this.authoring?.hierarchy.object3D?.(i);if(!o)continue;const c=Ut(o);c.isEmpty()||(t.union(c),s=!0)}if(s)return t}return this.frameBox&&!this.frameBox.isEmpty()?this.frameBox:Ut(this.root)}frame(e=1){const t=this.resolveFrameBounds();if(t.isEmpty()){let a=0,l=0;return this.root.traverse(w=>{const C=w.geometry;C&&(a+=1,l+=C.getAttribute("position")?.count??0)}),Ir.warn(`frame: nothing to frame — root "${this.root.name}" (${this.root.children.length} children, ${a} meshes, ${l} positions), selection ${JSON.stringify(this.authoring?.selection?.get()??[])}, frameBox ${this.frameBox?this.frameBox.isEmpty()?"empty":"set":"none"}`,"document"),!1}this.settleFlight("superseded");const s=t.getCenter(new K),i=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize();i.lengthSq()===0&&i.set(.8,.5,-1).normalize();const o=Math.min(10,Math.max(.1,Ee(e,1))),c=ft(t,this.viewport.camera,i)*o;return this.viewport.setPose(s.clone().addScaledVector(i,c),s),!0}orbit(e){return this.launchFlight(Ee(e.azimuth,0),Ee(e.elevation,0),Math.min(60,Math.max(0,Ee(e.duration,.6))),xi)}turntable(e){const t=Ee(e.revolutions,1);return this.launchFlight(t*Math.PI*2,0,Math.min(60,Math.max(0,Ee(e.seconds,6))),Pi)}looking(){return this.flight!==null}launchFlight(e,t,s,i){this.settleFlight("superseded");const o=this.viewport.camera,c=this.viewport.orbitControls.target.clone(),a=new Fn().setFromVector3(o.position.clone().sub(c)),l=a.radius>1e-4?a.radius:Math.max(this.resolveFrameBounds().getSize(new K).length(),1),w={pivot:c,radius:l,startTheta:a.theta,startPhi:a.phi,deltaTheta:e,deltaPhi:-t,duration:s,ease:i,elapsed:0,theta:a.theta,phi:a.phi,settle:null};this.flight=w;const C=new Promise(f=>{w.settle=f});return this.applyFlightPose(w,0),s<=0&&this.settleFlight(null),C}applyFlightPose(e,t){const s=e.ease(t);e.theta=e.startTheta+e.deltaTheta*s,e.phi=Math.min(Si,Math.max(yi,e.startPhi+e.deltaPhi*s));const i=this.viewport.camera;i.position.setFromSphericalCoords(e.radius,e.phi,e.theta).add(e.pivot),this.viewport.orbitControls.target.copy(e.pivot),i.lookAt(e.pivot),i.updateMatrixWorld(),this.flightPose.copy(i.position)}advanceLook(e){const t=this.flight;if(!t)return;const s=Math.max(1e-4,t.radius*.001);if(this.viewport.camera.position.distanceToSquared(this.flightPose)>s*s){this.settleFlight("human");return}e>0&&Number.isFinite(e)&&(t.elapsed+=e);const i=t.duration<=0?1:Math.min(1,t.elapsed/t.duration);this.applyFlightPose(t,i),i>=1&&this.settleFlight(null)}settleFlight(e){const t=this.flight;if(!t)return;this.flight=null;const s={completed:e===null,azimuth:t.theta,elevation:Math.PI/2-t.phi,seconds:Math.min(t.elapsed,t.duration)};t.settle?.(e===null?s:{...s,cancelledBy:e})}select(e){G(),this.authoring&&Vr(this.authoring,[...e])}selection(){return[...this.authoring?.selection?.get()??[]]}idForObject(e){return this.authoring?.hierarchy.idForObject3D?.(e)??null}syncSelectionPresentation(){G();const e=(this.authoring?.selection?.get()??[]).map(i=>this.authoring?.hierarchy.object3D?.(i)??null).filter(i=>i!==null);this.selectedObjects=e,this.selectionOutline&&(Ks(this.selectionOutline,this.selectionOutlineWanted?e:[]),this.syncComposerOutput());const t=e.filter(i=>!!i.isBone),s=t.map(i=>i.uuid).join("\0");s!==this.boneSelectionSignature&&(this.boneSelectionSignature=s,this.clearBoneSelectionHighlight(),t.length>0&&(this.boneSelectionHighlight=new mi(t,ut(this.renderer.domElement).visible),this.scene.add(this.boneSelectionHighlight)),this.refreshSkeletonHelper())}frameSelection(){return this.frameIds(this.authoring?.selection?.get()??[])}frameIds(e){this.settleFlight("superseded");const t=e.map(s=>this.authoring?.hierarchy.object3D?.(s)??null).filter(s=>s!==null);return t.length===0?!1:t.every(s=>s.isBone)?(this.frameBones(t),!0):(this.viewport.focusOnMultiple(t),!0)}setViewPreset(e){G(),this.settleFlight("superseded");const t=this.resolveFrameBounds();if(t.isEmpty())return;const s=t.getCenter(new K),i=Nr(e),o=ft(t,this.viewport.camera,i),c=s.clone().addScaledVector(i,o);this.viewport.camera.up.set(0,e==="top"?0:1,e==="top"?-1:0),this.viewport.setPose(c,s),this.setProjection(e==="isometric"?"perspective":"orthographic")}setCameraPose(e,t,s){G(),this.settleFlight("superseded"),this.viewport.setPose(e,t,s)}cameraPose(){return{position:this.viewport.camera.position.toArray(),target:this.viewport.orbitControls.target.toArray(),fov:this.viewport.camera.fov}}camera(){return this.cameraOverride?this.cameraOverride:this.state.projection==="perspective"?this.viewport.camera:(this.syncOrthographicCamera(),this.orthographicCamera)}projection(){return this.state.projection}setProjection(e){G(),this.state.projection!==e&&(this.state={...this.state,projection:e},this.notify())}lightingAvailable(){return this.editorLights.length>0}setLighting(e){G(),this.state.lighting!==e&&(this.setLightingValues(e),this.state={...this.state,lighting:e},this.notify())}setMode(e){G(),this.state.mode!==e&&(this.clearDiagnosticPresentation(),this.state={...this.state,mode:e},e==="uv"?this.scene.overrideMaterial=new An({vertexShader:"varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }",fragmentShader:"varying vec2 vUv; void main(){ gl_FragColor=vec4(vUv,0.0,1.0); }"}):e==="vertex-colors"?this.scene.overrideMaterial=new pt({vertexColors:!0}):e==="wireframe"&&this.buildTopologyOverlay(),this.notify())}buildTopologyOverlay(){const e=new Kt,t=[];this.root.updateMatrixWorld(!0),this.root.traverse(s=>{const i=s;if(!i.isMesh||!i.geometry)return;const o=new Hn(new _n(i.geometry,bi),new Bn({color:1119773,toneMapped:!1,transparent:!0,opacity:.85,depthTest:!1,depthWrite:!1}));o.matrixAutoUpdate=!1,o.matrixWorldAutoUpdate=!1,o.matrixWorld.copy(i.matrixWorld),o.frustumCulled=!1,o.renderOrder=2,e.add(o),t.push({line:o,source:i})}),t.length!==0&&(this.topologyOverlay=e,this.topologyFollowers=t,this.addHelper(e,"topology"))}syncTopologyOverlay(){this.topologyFollowers.some(({source:e})=>e.parent===null)&&(this.clearTopologyOverlay(),this.buildTopologyOverlay());for(const{line:e,source:t}of this.topologyFollowers)e.matrixWorld.copy(t.matrixWorld),e.visible=t.visible}clearTopologyOverlay(){for(const{line:s}of this.topologyFollowers.splice(0))s.geometry.dispose(),s.material.dispose();const e=this.topologyOverlay;if(this.topologyOverlay=null,!e)return;e.removeFromParent();const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1)}setBounds(e){G(),this.state.bounds!==e&&(this.state={...this.state,bounds:e},e?(this.boundsHelper=new zs(this.root,16757844),this.addHelper(this.boundsHelper,"bounds")):this.clearBoundsHelper(),this.notify())}setSkeleton(e){G(),this.state.skeleton!==e&&(this.state={...this.state,skeleton:e},this.refreshSkeletonHelper(),this.notify())}setGrid(e){G(),this.state.grid!==e&&(this.viewport.grid.visible=e,this.state={...this.state,grid:e},this.notify())}neutralBackgroundTexture(){return this.neutralBackground}setNeutralBackground(e){G();const t=this.scene.background===this.neutralBackground;this.neutralBackground=e,t&&(this.scene.background=e)}setBackground(e){G(),this.state.background!==e&&(this.scene.background=e==="transparent"?null:this.neutralBackground,this.state={...this.state,background:e},this.notify())}setExposure(e){G(),!(!Number.isFinite(e)||e<.2||e>2)&&this.state.exposure!==e&&(this.renderer.toneMappingExposure=e,this.state={...this.state,exposure:e},this.notify())}resetPresentation(){G(),this.clearDiagnosticPresentation(),this.state=Zs,this.refreshSkeletonHelper(),this.clearBoundsHelper(),this.viewport.grid.visible=!0,this.scene.background=this.neutralBackground,this.renderer.toneMappingExposure=1,this.setLightingValues("studio"),this.viewport.camera.up.set(0,1,0),this.frame(),this.notify()}setBeforeRender(e){this.beforeRender=e}presentedFrameWaiters=[];presentsFrames=!1;setPresentsFrames(e){this.presentsFrames=e,e||this.resolvePresentedFrame(null)}requestPresentedFrame(){return this.presentsFrames?new Promise(e=>{let t=!1;const s=i=>{t||(t=!0,e(i))};this.presentedFrameWaiters.push(s),G(),setTimeout(()=>s(null),wi)}):Promise.resolve(null)}needsFrame(){return this.flight!==null||this.presentedFrameWaiters.length>0}servePresentedFrame(){if(this.presentedFrameWaiters.length===0)return;const e=this.renderer.domElement,t=document.createElement("canvas");t.width=Math.max(1,e.width),t.height=Math.max(1,e.height);const s=t.getContext("2d");if(!s){this.resolvePresentedFrame(null);return}s.drawImage(e,0,0),this.resolvePresentedFrame(t)}resolvePresentedFrame(e){const t=this.presentedFrameWaiters;this.presentedFrameWaiters=[];for(const s of t)s(e)}render(e){this.beforeRender?.(),this.boneSelectionHighlight?.update();const t=this.camera(),s=this.state.mode;if(this.boundsHelper?.update(),s==="uv"||s==="vertex-colors"){e(t);return}if(s==="wireframe"&&this.topologyOverlay){this.syncTopologyOverlay(),this.shading.render(this.scene,"clay",()=>e(t),Xs);return}this.shading.render(this.scene,s,()=>e(t),Xs)}renderViewport(e=0){this.advanceLook(e),this.ensureComposer(),this.render(t=>{const s=this.composer;if(!s){this.renderer.render(this.scene,t);return}s.setMainScene(this.scene),s.setMainCamera(t),s.render(e)})}resize(e,t){G(),this.renderWidth=Math.max(1,e),this.renderHeight=Math.max(1,t),this.composer?.setSize(this.renderWidth,this.renderHeight)}renderCapture(e,t){this.render(s=>{if(!t){e(s);return}const i=this.scene.background,o=this.renderer.getClearColor(new ne),c=this.renderer.getClearAlpha();try{this.scene.background=null,this.renderer.setClearColor(0,0),e(s)}finally{this.scene.background=i,this.renderer.setClearColor(o,c)}})}captureImage(e=512){const t=typeof e=="number"?e:e.width,s=typeof e=="number"?e:e.height;if(!Number.isFinite(t)||t<1||!Number.isFinite(s)||s<1)return null;const i=Math.min(2048,Math.round(t)),o=Math.min(2048,Math.round(s)),c=i*2,a=o*2,l=new Gs(c,a,{type:Ln}),w=new Gs(c,a),C=this.renderer.getRenderTarget(),f=this.renderer.getPixelRatio(),_=this.viewport.camera,S=_.aspect;try{this.captureAspect=i/o;const N=typeof e=="number"?void 0:e.camera;N?this.cameraOverride=N:(_.aspect=i/o,_.updateProjectionMatrix()),this.renderer.setPixelRatio(1),this.renderer.setRenderTarget(l),this.renderCapture(O=>this.renderSolidForCapture(O,l,c,a),typeof e!="number"&&e.transparent===!0),zr(typeof e!="number"&&e.transparent===!0).render(this.renderer,w,l,0,!1);const U=c*4,$=new Uint8Array(U*a);this.renderer.readRenderTargetPixels(w,0,0,c,a,$);const v=document.createElement("canvas");v.width=c,v.height=a;const R=v.getContext("2d");if(!R)return null;const D=R.createImageData(c,a);for(let O=0;O<a;O++){const W=(a-1-O)*U,P=O*U;D.data.set($.subarray(W,W+U),P)}R.putImageData(D,0,0);const m=document.createElement("canvas");m.width=i,m.height=o;const T=m.getContext("2d");return T?(T.drawImage(v,0,0,i,o),m.toDataURL("image/png")):null}finally{this.captureAspect=null,this.cameraOverride=null,_.aspect=S,_.updateProjectionMatrix(),this.renderer.setRenderTarget(C),this.renderer.setPixelRatio(f),w.dispose(),l.dispose()}}dispose(){this.disposed=!0,this.settleFlight("closed"),this.viewport.orbitControls.removeEventListener("start",this.cancelLookForHuman),this.unsubscribeSelectionTheme(),this.clearDiagnosticPresentation(),this.clearBoneSelectionHighlight(),this.clearBoundsHelper(),this.clearSkeletonHelper(),this.selectionOutline?.selection.clear(),this.composer?.dispose(),this.sceneRenderPass=null,this.selectionOutline=null,this.selectionOutlinePass=null,this.composer=null,this.shading.dispose(),this.listeners.clear()}addHelper(e,t){e.name=`__object3d_document_${t}`,rr(e,"editorHelper",!0),this.scene.add(e),this.helpers.push(e)}get selectionOutlineEnabled(){return this.selectionOutlineWanted}set selectionOutlineEnabled(e){e!==this.selectionOutlineWanted&&(this.selectionOutlineWanted=e,e?this.syncSelectionPresentation():(this.selectionOutline?.selection.clear(),this.syncComposerOutput()))}selectionOutlineWanted=!0;ensureComposer(){this.selectionOutlineWanted&&(this.composer||this.composerLoading||this.disposed||(this.composerLoading=!0,mt(()=>import("./index-BcCBqgM_.js"),__vite__mapDeps([0,1])).then(e=>{if(this.composerLoading=!1,this.disposed||this.composer)return;const t=this.camera(),s=new e.EffectComposer(this.renderer);this.sceneRenderPass=new e.RenderPass(this.scene,t),s.addPass(this.sceneRenderPass),this.selectionOutline=$n(e,this.scene,t,ut(this.renderer.domElement)),this.syncSelectionTheme(),Ks(this.selectionOutline,this.selectedObjects),this.selectionOutlinePass=new e.EffectPass(t,this.selectionOutline),s.addPass(this.selectionOutlinePass),this.composer=s,this.syncComposerOutput(),s.setSize(this.renderWidth,this.renderHeight),G()}).catch(()=>{this.composerLoading=!1})))}renderSolidForCapture(e,t,s,i){const o=this.composer,c=(this.selectionOutline?.selection.size??0)>0;if(!o||!c||!this.sceneRenderPass||!this.selectionOutlinePass){this.renderer.render(this.scene,e);return}const a=this.renderWidth,l=this.renderHeight;try{this.sceneRenderPass.renderToScreen=!1,this.selectionOutlinePass.renderToScreen=!1,o.setSize(s,i,!1),this.sceneRenderPass.render(this.renderer,o.inputBuffer,o.outputBuffer,0),this.selectionOutlinePass.render(this.renderer,o.inputBuffer,t,0)}finally{o.setSize(a,l,!1),this.syncComposerOutput(),this.renderer.setRenderTarget(t)}}syncComposerOutput(){const e=(this.selectionOutline?.selection.size??0)>0;this.sceneRenderPass&&(this.sceneRenderPass.renderToScreen=!e),this.selectionOutlinePass&&(this.selectionOutlinePass.enabled=e,this.selectionOutlinePass.renderToScreen=e)}refreshSkeletonHelper(){const e=this.state.skeleton||this.boneSelectionHighlight!==null;e&&!this.skeletonHelper?(this.skeletonHelper=new Dn(this.root),vi(this.skeletonHelper),this.scene.add(this.skeletonHelper)):e||this.clearSkeletonHelper()}clearSkeletonHelper(){this.skeletonHelper&&(this.skeletonHelper.removeFromParent(),this.skeletonHelper.dispose(),this.skeletonHelper=null)}clearBoneSelectionHighlight(){this.boneSelectionHighlight&&(this.boneSelectionHighlight.removeFromParent(),this.boneSelectionHighlight.dispose(),this.boneSelectionHighlight=null)}clearBoundsHelper(){if(!this.boundsHelper)return;const e=this.boundsHelper;this.boundsHelper=null;const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1),e.removeFromParent(),e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(s=>{s.dispose()}):e.material.dispose()}frameBones(e){const t=new $t,s=new K;for(const l of e){t.expandByPoint(l.getWorldPosition(s)),l.parent?.isBone&&t.expandByPoint(l.parent.getWorldPosition(s));for(const w of l.children)w.isBone&&t.expandByPoint(w.getWorldPosition(s))}const i=t.getCenter(new K),o=Math.max(t.getSize(new K).length(),.2);t.expandByScalar(o*.35);const c=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize(),a=ft(t,this.viewport.camera,c);this.viewport.setPose(i.clone().addScaledVector(c,a),i)}syncOrthographicCamera(){const e=this.viewport.camera,t=this.viewport.orbitControls.target,s=Math.max(e.position.distanceTo(t),.001),i=Math.max(s*Math.tan(cr.degToRad(e.fov)/2),.001),o=Math.max(this.renderer.domElement.clientWidth,1),c=Math.max(this.renderer.domElement.clientHeight,1),a=this.captureAspect??o/c;this.orthographicCamera.left=-i*a,this.orthographicCamera.right=i*a,this.orthographicCamera.top=i,this.orthographicCamera.bottom=-i,this.orthographicCamera.near=e.near,this.orthographicCamera.far=e.far,this.orthographicCamera.position.copy(e.position),this.orthographicCamera.quaternion.copy(e.quaternion),this.orthographicCamera.up.copy(e.up),this.orthographicCamera.layers.mask=e.layers.mask,this.orthographicCamera.updateProjectionMatrix(),this.orthographicCamera.updateMatrixWorld(!0)}setLightingValues(e){for(const t of this.editorLights)t instanceof Wn?t.intensity=e==="flat"?2:e==="outdoor"?1.15:1.7:t instanceof In&&(t.intensity=e==="flat"?0:e==="outdoor"?2.2:2.4,t.color.set(16777215))}clearDiagnosticPresentation(){this.clearTopologyOverlay(),this.scene.overrideMaterial?.dispose(),this.scene.overrideMaterial=null;for(const e of this.helpers.splice(0)){e.removeFromParent();const t=e;t.geometry?.dispose();const s=t.material;Array.isArray(s)?s.forEach(i=>{i.dispose()}):s?.dispose()}}notify(){this.version++;for(const e of this.listeners)e()}}class Ci{constructor(e){this.options=e}active=null;settling=!1;idleWaiters=new Set;begin(e){if(this.active||this.settling)return!1;try{const t=this.options.begin(e);return t?(this.active={pointerId:e.pointerId,gesture:t},!0):!1}catch(t){return this.options.reportError(t),!1}}update(e){if(!(!this.active||this.active.pointerId!==e.pointerId))try{this.active.gesture.update(e)}catch(t){this.cancelWithError(t)}}async commit(e){const t=this.take(e.pointerId);if(!t)return!1;this.settling=!0;try{return await t.commit(e),await this.options.persist(t.label),!0}catch(s){try{await t.cancel()}catch(i){return this.options.reportError({operationError:s,rollbackError:i}),!1}return this.options.reportError(s),!1}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}async cancel(e){const t=this.take(e);if(!t)return!1;this.settling=!0;try{return await t.cancel(),!0}catch(s){return this.options.reportError(s),!1}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}async settle(){this.active&&await this.cancel(),this.settling&&await new Promise(e=>this.idleWaiters.add(e))}hasActiveGesture(){return this.active!==null}take(e){if(!this.active||e!==void 0&&this.active.pointerId!==e)return null;const t=this.active.gesture;return this.active=null,t}async cancelWithError(e){const t=this.take();if(t){this.settling=!0;try{await t.cancel(),this.options.reportError(e)}catch(s){this.options.reportError({operationError:e,rollbackError:s})}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}}}class ki{constructor(e,t){this.frame=e,this.releaseRenderer=t,this.unsubscribeActivity=Qn(()=>this.syncActivity())}rafId=0;running=!1;disposed=!1;active=!1;unsubscribeActivity;get isDisposed(){return this.disposed}get isRunning(){return this.running}setActive(e){this.disposed||(this.active=e,this.syncActivity())}syncActivity(){this.active&&Dt()?this.start():this.stop()}redraw(){this.running&&!this.disposed&&Dt()&&this.guardedFrame(performance.now())}dispose(){this.stop(),!this.disposed&&(this.disposed=!0,this.unsubscribeActivity(),this.releaseRenderer())}start(){this.disposed||this.running||(this.running=!0,this.guardedFrame(performance.now(),!0),!(!this.running||this.disposed)&&(this.rafId=requestAnimationFrame(this.tick)))}lastFrameFailure=null;guardedFrame(e,t=!1){try{this.frame(e,t),this.lastFrameFailure=null}catch(s){const i=s instanceof Error?s.message:String(s);i!==this.lastFrameFailure&&(this.lastFrameFailure=i,console.error("[document renderer] a frame threw; the loop continues:",s))}}stop(){this.running=!1,this.rafId!==0&&(cancelAnimationFrame(this.rafId),this.rafId=0)}tick=e=>{if(!(!this.running||this.disposed)){if(!Dt()){this.stop();return}this.guardedFrame(e),!(!this.running||this.disposed)&&(this.rafId=requestAnimationFrame(this.tick))}}}class Ei{constructor(e,t,s){this.create=e,this.isOpen=t,this.subscribe=s}states=new Map;generations=new WeakMap;unsubscribe=null;claim(e){const t=this.states.get(e)??[];let s=t.find(i=>!i.inUse);return s||(s=this.create(e),t.push(s),this.states.set(e,t)),s.inUse=!0,this.generations.set(s,this.generation(s)+1),this.unsubscribe??=this.subscribe(()=>this.discardClosed()),s}generation(e){return this.generations.get(e)??0}release(e,t=this.generation(e)){this.generation(e)===t&&(e.inUse=!1,queueMicrotask(()=>this.discardClosed()))}retain(e,t,s){if(!this.isOpen(e.documentId)||!this.states.get(e.documentId)?.includes(e)||this.generation(e)!==s){t.dispose();return}const i=e.source;e.source=t,i!==t&&i?.dispose()}discardClosed(){const e=[];for(const[s,i]of this.states){if(this.isOpen(s))continue;const o=i.filter(c=>c.inUse);e.push(...i.filter(c=>!c.inUse)),o.length?this.states.set(s,o):this.states.delete(s)}this.states.size===0&&(this.unsubscribe?.(),this.unsubscribe=null);const t=[];for(const s of e){const i=s.source;s.source=null;try{i?.dispose()}catch(o){t.push(o)}}if(t.length)throw new AggregateError(t,"Retained document cleanup failed")}}const Ri=p.lazy(async()=>({default:(await mt(()=>import("./stage-overlay-set-B9zp2sLB.js"),__vite__mapDeps([2,3,4,5,6,7,8,9,10,11,1,12,13,14,15,16,17,18,19,20,21,22,23,24]))).StageOverlaySet}));function ji(r){return d.jsx(p.Suspense,{fallback:null,children:d.jsx(Ri,{...r})})}const Oi=[.25,.5,1,2];function Ti(r,e){const t=Math.round(r*e);return`${r.toFixed(2)}s · f${t}`}function Fi({transport:r}){const e=p.useSyncExternalStore(p.useCallback(f=>r?r.subscribe(f):()=>{},[r]),p.useCallback(()=>r?.snapshot()??null,[r]));if(!r||!e||e.activeSubject===null)return null;const t=e.driver==="world",s=e.playbackState==="playing",{start:i,end:o,fps:c,loop:a}=e.range,l=e.subjects.find(f=>f.id===e.activeSubject),w=e.subjects.length>1?e.subjects:null,C=r.activeClips();return d.jsxs("section",{"aria-label":"Transport","data-testid":"stage-transport-strip",style:{display:"flex",alignItems:"center",gap:"var(--vgai-space-2)",padding:"var(--vgai-space-1) var(--vgai-space-3)",borderTop:`var(--vgai-stroke-resting) solid ${be.boundary.default}`,background:be.surface.raised},children:[d.jsx(ge,{size:"compact","aria-label":s?"Pause":"Play",disabled:t,onClick:()=>s?r.pause():r.play(),children:d.jsx(ve,{icon:s?re.transport.pause:re.transport.play})}),d.jsx(ge,{size:"compact","aria-label":"Stop",disabled:t,onClick:()=>r.stop(),children:d.jsx(ve,{icon:re.transport.stop})}),d.jsx(Gr,{"aria-label":"Playhead",type:"range",min:i,max:o,step:1/c,value:e.time,disabled:t,onChange:f=>r.seek(Number(f.target.value)),style:{flex:1}}),d.jsx(dt,{as:"span",variant:"caption",children:Ti(e.time,c)}),w?d.jsx("select",{"aria-label":"Subject",value:e.activeSubject,disabled:t,onChange:f=>r.setActiveSubject(f.target.value),children:w.map(f=>d.jsx("option",{value:f.id,children:f.label},f.id))}):null,C?d.jsx("select",{"aria-label":"Clip",disabled:t,onChange:f=>r.setActiveClip(f.target.value),children:C.map(f=>d.jsx("option",{value:f.id,children:f.label},f.id))}):null,d.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"var(--vgai-space-1)"},children:[d.jsx("input",{type:"checkbox",checked:a,disabled:t,onChange:f=>r.setLoop(f.target.checked)}),d.jsx(dt,{as:"span",variant:"caption",children:"Loop"})]}),d.jsx("select",{"aria-label":"Speed",value:String(e.timeScale),disabled:t,onChange:f=>r.setTimeScale(Number(f.target.value)),children:Oi.map(f=>d.jsxs("option",{value:String(f),children:[f,"×"]},f))}),t?d.jsx(dt,{as:"span",variant:"caption",children:"The world is driving time (Play); pause the game to scrub"}):l?d.jsx(dt,{as:"span",variant:"caption",children:l.label}):null]})}const Ai=qn;function Hi(r){return qt(null,r)}const _i=()=>()=>{},Js=()=>0,Bi=5,Li=58;function Di({viewport:r,session:e,store:t,projection:s,displayName:i,objectName:o,statistics:c}){p.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),p.useSyncExternalStore(e?.subscribe??_i,e?.getSnapshot??Js,e?.getSnapshot??Js);const l=p.useSyncExternalStore(Hi,nr)?be.content.onAccent:be.content.primary;if(!r)return null;const w=Ur(r.camera.position.clone().sub(r.orbitControls.target))??"User",C=e?.projection()??s,f=`${w} ${C==="perspective"?"Perspective":"Orthographic"}`,_=t.selectedEntityId,S=(_===null?null:o(_))||null,N=S===null||S===i?i:`${i} | ${S}`,U=v=>{const R=r.renderCamera;if(R instanceof ar){R.zoom=Math.max(.01,R.zoom/v),R.updateProjectionMatrix();return}const D=r.orbitControls.target;r.camera.position.sub(D).multiplyScalar(v).add(D),r.orbitControls.update()},$=v=>{v.preventDefault();const R=v.currentTarget;R.setPointerCapture(v.pointerId);let D=v.clientX,m=v.clientY;const T=new K,O=new K,W=M=>{const ie=M.clientX-D,oe=M.clientY-m;D=M.clientX,m=M.clientY;const we=r.camera,ae=r.orbitControls.target,Ve=we.position.distanceTo(ae),ce=Math.max(1,R.ownerDocument.defaultView?.innerHeight??1),je=2*Ve*Math.tan(cr.degToRad(we.fov/2))/ce;T.setFromMatrixColumn(we.matrixWorld,0).multiplyScalar(-ie*je),O.setFromMatrixColumn(we.matrixWorld,1).multiplyScalar(oe*je),we.position.add(T).add(O),ae.add(T).add(O),r.orbitControls.update()},P=()=>{R.removeEventListener("pointermove",W),R.removeEventListener("pointerup",P),R.removeEventListener("pointercancel",P)};R.addEventListener("pointermove",W),R.addEventListener("pointerup",P),R.addEventListener("pointercancel",P)};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{"data-testid":"viewport-view-text","aria-hidden":"true",style:{position:"absolute",top:"var(--vgai-space-3)",left:"calc(var(--vgai-space-4) + var(--vgai-control-comfortable-height) * 2 + var(--vgai-space-4))",display:"flex",flexDirection:"column",gap:"var(--vgai-space-1)",fontSize:"var(--vgai-font-sm)",color:l,textShadow:"var(--vgai-content-text-shadow, none)",pointerEvents:"none",userSelect:"none"},children:[d.jsx("span",{children:f}),d.jsx("span",{children:N}),c&&c.length>0?d.jsx("div",{"data-testid":"viewport-statistics",style:{display:"grid",gridTemplateColumns:`${Li}px auto`,rowGap:"var(--vgai-space-1)",marginTop:$r[Bi]},children:c.map(v=>d.jsxs(p.Fragment,{children:[d.jsx("span",{children:v.label}),d.jsx("span",{children:v.value})]},v.id))}):null]}),d.jsxs("div",{"data-testid":"viewport-navigation",role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",className:"vgai-chrome-island vgai-viewport-navigation",style:{position:"absolute",top:Ai,right:"var(--vgai-space-6)",display:"flex",flexDirection:"column",gap:"var(--vgai-space-1)",padding:"var(--vgai-space-1) 0",borderRadius:"var(--vgai-radius-full)",background:"var(--vgai-island-surface, var(--vgai-surface-overlay))",pointerEvents:"auto"},children:[d.jsx(Ie,{text:"Zoom in",children:d.jsx(ge,{size:"comfortable","aria-label":"Zoom in",onClick:()=>U(.8),children:d.jsx(ve,{size:"2xl",icon:re.viewport.zoomIn})})}),d.jsx(Ie,{text:"Zoom out",children:d.jsx(ge,{size:"comfortable","aria-label":"Zoom out",onClick:()=>U(1.25),children:d.jsx(ve,{size:"2xl",icon:re.viewport.zoomOut})})}),d.jsx(Ie,{text:"Pan (drag)",children:d.jsx(ge,{size:"comfortable","aria-label":"Pan the view",onPointerDown:$,children:d.jsx(ve,{size:"2xl",icon:re.viewport.pan})})}),d.jsx(Ie,{text:"Frame all",children:d.jsx(ge,{size:"comfortable","aria-label":"Frame all",onClick:()=>{e?.frame()||r.focusOn(r.orbitControls.object)},children:d.jsx(ve,{size:"2xl",icon:re.viewport.frame})})}),d.jsx(Ie,{text:C==="perspective"?"Orthographic":"Perspective",children:d.jsx(ge,{size:"comfortable","aria-label":"Toggle perspective and orthographic","aria-pressed":C==="orthographic",onClick:()=>{const v=C==="perspective"?"orthographic":"perspective";e?e.setProjection(v):r.setProjection(v)},children:d.jsx(ve,{size:"2xl",icon:re.viewport.projection})})})]})]})}const Wi=p.lazy(async()=>({default:(await mt(()=>import("./stage-keyboard-n-5kKH-m.js"),__vite__mapDeps([25,5,4,6,7,3,8,9,10,11,1,12]))).StageKeyboardBinding})),Qs=()=>bn(),zt=12;function er(r){if(!r)return null;const e=new $t(new K(r.min[0],r.min[1],r.min[2]),new K(r.max[0],r.max[1],r.max[2]));return e.isEmpty()?null:e}const Ii=500;function Vi(r){return qt(null,r)}let Ni=0;const Re=new Ei(r=>({documentId:r,store:new ir,inUse:!1,source:null,camera:null,presentation:null,transport:null,contentSeconds:0,transportAdvances:0}),r=>tn().some(e=>e.descriptor.id===r),sn);function zi({canvasHostRef:r}){return d.jsx("div",{ref:r,style:{position:"absolute",inset:0}})}function Gi(r,e,t,s,i){if(e==="inspector-preview"){const l=gn();return l.canvas.setAttribute("aria-label",`${t} authoring viewport`),r.appendChild(l.canvas),{canvas:l.canvas,renderer:l.renderer,lease:l}}const o=vn(s.width,s.height,i),{canvas:c,renderer:a}=o;return c.setAttribute("aria-label",`${t} authoring viewport`),r.appendChild(c),{canvas:c,renderer:a,lease:o}}class tr{constructor(e,t,s){this.lane=e,this.surface=t,this.store=s??new ir,this.transport=new mn(this.store)}scene=new lr;store;cleanups=[];rendererSession=new ki((e,t)=>this.frame?.(e,t),()=>{});viewport=null;session=null;dressing=null;defaultEnvironment=null;defaultBackground=null;adapter=null;content=null;frame=null;syncHostScene=null;presence=null;initialized=!1;contentSeconds=0;transportAdvances=0;users=0;closed=!1;released=!1;get isClosed(){return this.closed}transport;borrow(){this.users++;let e=!1;return()=>{e||(e=!0,this.users--,this.releaseIfClosed())}}close(){this.closed=!0,this.frame=null,this.syncHostScene=null,this.session?.setBeforeRender(null),this.session?.setPresentsFrames(!1),this.rendererSession.setActive(!1),this.content?.dispose(),this.transport.dispose(),this.releaseIfClosed()}releaseIfClosed(){if(!this.closed||this.users!==0||this.released)return;this.released=!0;const{lease:e,renderer:t,canvas:s}=this.surface;for(const i of[...this.cleanups.splice(0),()=>this.session?.dispose(),()=>this.viewport?.dispose(),()=>this.rendererSession.dispose(),()=>this.dressing?.dispose(),...e?[()=>e.release()]:[()=>t.dispose(),()=>t.forceContextLoss(),()=>s.remove()]])try{i()}catch(o){console.error("Object3D document cleanup failed.",o)}}}function Ui({documentId:r,sourcePath:e,build:t,displayName:s="Source Object3D",background:i,cameraDirection:o,persistence:c,documentSource:a,authoring:l,interaction:w,selectionOutline:C=!0,active:f=!0,audit:_=!0,chromeless:S=!1,modelSource:N,assetType:U,sourceAuthoring:$,dressing:v,rendererLane:R="own",onOpenNode:D,frameBounds:m,openingFrameBounds:T,openingFit:O,statistics:W,content:P}){p.useEffect(()=>{if(!S)return qr(r)},[r,S]);const M=Kr(),ie=M??Ts(),oe=ie?Xr(ie,r,S?"embedded":"document"):null,we=p.useSyncExternalStore(Vi,nr),ae=oe!==null&&Yr(oe,we),Ve=p.useRef(ae);Ve.current=ae;const ce=oe!==null&&Zr(oe),je=p.useRef(ce);je.current=ce;const Xt=oe!==null&&Jr(oe),Yt=p.useRef(Xt);Yt.current=Xt;const Zt=Qr(),gt=p.useRef(Zt);gt.current=Zt;const vt=p.useRef(null),bt=p.useRef(null),V=p.useRef(null),ye=p.useRef(null);(!ye.current||ye.current.documentId!==r)&&(ye.current&&Re.release(ye.current),ye.current=Re.claim(r)),p.useEffect(()=>{const k=ye.current,le=Re.generation(k);return()=>Re.release(k,le)},[r]);const B=ye.current,xe=P?.kind==="world-root",wt=f||xe,Jt=p.useRef(P?.kind==="world-root"?P.load:null);Jt.current=P?.kind==="world-root"?P.load:null;const[Pe,yt]=p.useState(wt);p.useEffect(()=>yt(wt),[wt]);const Qt=p.useRef(C);p.useEffect(()=>{Qt.current=C;const k=V.current?.session;k&&(k.selectionOutlineEnabled=R!=="inspector-preview"&&C)},[C,R]);const es=p.useRef(Promise.resolve()),St=p.useRef(!1);p.useEffect(()=>{if(Pe)return Oe.current=!1,Mt("building"),()=>{const k=V.current;if(k&&!xe){St.current=!Ne.current;const le=k.store.cameraPose;B.camera=le&&k.viewport?{...le,up:k.viewport.camera.up.clone()}:null,B.presentation=k.session?.presentation()??null,B.transport=k.transport.snapshot(),B.contentSeconds=k.contentSeconds,B.transportAdvances=k.transportAdvances}Ue.current=null,$e.current=null,Ge.current=null,ze.current=null,k?.close(),V.current=null}},[r,R,B,Pe,xe]);const ts=p.useRef(D);ts.current=D;const ss=p.useRef(m);ss.current=m;const rs=p.useRef(T);rs.current=T;const Ne=p.useRef(f);Ne.current=f;const ns=p.useRef(f),is=p.useRef({build:t,sourcePath:e});p.useEffect(()=>{const k=is.current;is.current={build:t,sourcePath:e},!(k.build===t&&k.sourcePath===e)&&!Pe&&B.source&&(B.source.dispose(),B.source=null)},[t,B,e,Pe]);const ze=p.useRef(null),Oe=p.useRef(!1),Ge=p.useRef(null),Ue=p.useRef(null),$e=p.useRef(null),[xt,Y]=p.useState(null),[Pt,Mt]=p.useState("building"),[os,pr]=p.useState(null),[fr,mr]=p.useState("mounting"),[gr,vr]=p.useState([]),as=p.useRef(null),[cs,br]=p.useState("perspective"),[wr,ls]=p.useState(null),qe=p.useRef(null);qe.current=wr;const Ct=o?.[0],kt=o?.[1],Et=o?.[2],Te=N?.kind,Rt=N?.kind==="project-file"?N.path:void 0,Ke=N?.kind==="entity"?N.entityId:void 0,jt=v?.environment,us=v?.background,Ot=v?.keyLight,Tt=v?.grid,Xe=v?.viewLocked,ds=v?.toneMapping;f&&wn(r),p.useEffect(()=>{let k=!1;if(!Pe)return;const le=async ue=>{const L=vt.current,Fe=bt.current;if(!L||!Fe||V.current)return;const x=gt.current;if(!x){Y("The world root needs the editor shell above it; this host has none.");return}const Ae=await ue();if(k||V.current)return;pr(()=>Ae),Fs();const n=new tr("own",Ae.mountWorldRootSurface(Fe,L,s),Ts()??void 0);V.current=n,n.cleanups.push(As(r,n.store)),n.cleanups.push(Hs(r,n.transport));const Z=Ae.installWorldRootStage({store:n.store,documentId:r,container:L,canvas:n.surface.canvas,renderer:n.surface.renderer,stats:x,cameraPreview:()=>as.current,onMountStatus:mr,onRootIds:vr,runFrame:de=>Ds(r,de)});n.viewport=Z.viewport,n.frame=Z.frame,n.content={scene:Z.scene,settle:()=>Promise.resolve(),dispose:async()=>Z.dispose()};const A=Ys(Z.scene,n.transport);let X=0;n.cleanups.push(()=>A.dispose()),n.cleanups.push(n.store.subscribe(()=>{if(n.store.playState!=="stopped")return;const de=performance.now();de-X<Ii||(X=de,A.refresh())})),n.cleanups.push(Ws({camera:Z.viewport.camera,orbit:Z.viewport.orbitControls,scene:Z.scene},Z.present,Z.setHelper,{documentId:r})),ze.current=n.rendererSession,n.initialized=!0,Is(),Mt("ready"),n.rendererSession.setActive(!0)},Sr=async()=>{for(await V.current?.content?.settle();zn();)await Gn();if(k)return;const ue=Jt.current;if(ue)return le(ue);const L=vt.current,Fe=bt.current;if(!L||!Fe)return;if(!t||e===void 0){Y("This stage shows `build` content and was given no `build()`/`sourcePath`.");return}let x;const Ae=Re.generation(B);try{x=B.source??t(),B.source=null}catch(q){Y(q instanceof Error?q.message:String(q));return}try{V.current||(Fs(),V.current=new tr(R,Gi(Fe,R,s,{width:Math.max(1,L.clientWidth),height:Math.max(1,L.clientHeight)},()=>{yt(!1),window.setTimeout(()=>{Ne.current&&yt(!0)},0)}),B.store),V.current.contentSeconds=B.contentSeconds,V.current.transportAdvances=B.transportAdvances)}catch(q){throw x.dispose(),q}const n=V.current,Z=n.borrow(),{renderer:A,canvas:X,lease:de}=n.surface,F=n.store;S||(n.cleanups.push(As(r,F)),n.cleanups.push(Hs(r,n.transport)));const Ze=_s();Ze&&F.attachHistory(Ze);const Pr=R==="inspector-preview",Me=Ve.current,ps=je.current,fs=Yt.current,H=new lr;jt!==!1&&(H.environmentIntensity=ei);const Je=x.root.parent;H.add(x.root),x.animations&&(x.root.animations=[...x.animations]);const At={root:x.root,animations:x.root.animations};let He=null,_e=null,Ce=null,he=null,J=null,Qe=null,et=null,tt=null,st=null,rt=null,Ht=null,ms=null,gs=null,vs=!1,nt=!1,it=null;const _t={scene:H,settle:()=>J?.settle()??Promise.resolve(),dispose:()=>{if(it)return it;nt=!0;const q=St.current;return St.current=!1,Qe&&L.removeEventListener("pointerdown",Qe,!0),et&&L.removeEventListener("pointermove",et,!0),tt&&L.removeEventListener("pointerup",tt,!0),st&&L.removeEventListener("pointercancel",st,!0),rt&&window.removeEventListener("keydown",rt),Ht?.(),Ht=null,it=(async()=>{await J?.settle();const Be=[];for(const ee of[()=>he?.dispose(),()=>_e?.dispose?.(),()=>He?.dispose(),()=>H.removeFromParent(),()=>{q?Re.retain(B,x,Ae):x.dispose()},Z])try{ee()}catch(ot){Be.push(ot)}Be.length&&console.error("Object3D source cleanup failed.",...Be)})(),it}};try{const q=async h=>{try{const b=At;if(a&&!c){if(!b)throw new Error("Project history is unavailable; the edit was not saved.");const u=_s();if(!u)throw new Error("Project history is unavailable; the edit was not saved.");const g=a.serialize(b);if(g===null)return Y(null),!1;const j=await Qs().replaceSource(u,{file:a.path,source:g,label:h??a.label??`Edit ${s}`});return Y(null),j}if(!c)throw new Error("This Asset Lab document has no persistence binding.");if(!Ce||!b)throw new Error("Project history is unavailable; the edit was not saved.");const{persisted:E}=await(await Ce).commit(b,h);return Y(null),E}catch(b){throw Y(b instanceof Error?b.message:JSON.stringify(b)),b}};He=new Jn(F,H,{documentId:r,title:s,sourcePath:e,documentKind:fs?"asset":"source",audit:_,...x.hierarchyRoots?{hierarchyRoots:x.hierarchyRoots}:{},...Te==="project-file"&&Rt?{modelSource:{kind:Te,path:Rt}}:Te==="entity"&&Ke?{modelSource:{kind:Te,entityId:Ke}}:{}});const Be={documentId:r,sourcePath:e,root:x.root,animations:x.root.animations,scene:H,defaultAdapter:He,commit:q};_e=l?.(Be)??null,!_e&&$&&(_e=$({store:F,scene:H,...x.hierarchyRoots?{hierarchyRoots:x.hierarchyRoots}:{}}),He.dispose()),Ce=c&&Ze?Qs().openPersistence({binding:c,document:At,history:Ze}):null,Ce&&Ce.catch(h=>{!nt&&V.current?.content===_t&&Y(h instanceof Error?h.message:JSON.stringify(h))});const ee=_e?.adapter??He;if(!n.dressing){A.outputColorSpace=or,A.toneMapping=ds??Vn,A.shadowMap.enabled=!0,A.shadowMap.type=Nn,A.info.autoReset=!1,A.setPixelRatio(Math.min(window.devicePixelRatio,2)),Me&&A.setClearColor(0,0);const h=jt===!1?null:de&&"environment"in de?de.environment():rn(A),b=Bs(X);n.dressing=ti(n.scene,{environment:h,background:!Me&&i===void 0&&us!==!1&&b.background===null,keyLight:Ot!==!1,grid:Tt===!0,content:x.root}),!Me&&i!==void 0?n.scene.background=new ne(i):!Me&&b.background!==null&&(n.scene.background=new ne(b.background)),n.defaultEnvironment=n.scene.environment,n.defaultBackground=n.scene.background,n.cleanups.push(()=>{n.defaultBackground instanceof Us&&n.defaultBackground!==n.dressing?.backgroundTexture&&n.defaultBackground.dispose()})}const ot=(h,b)=>{const E=n.adapter,u=n.viewport;if(!E||!u)return null;const g=X.getBoundingClientRect(),j=new ht((h-g.left)/Math.max(g.width,1)*2-1,-((b-g.top)/Math.max(g.height,1))*2+1),z=new $s;z.layers.enableAll(),z.setFromCamera(j,n.session?.camera()??u.camera);for(const fe of z.intersectObjects([...F.objectMap.values()],!0)){if(nn(fe.object))continue;let se=fe.object;for(;se;){const lt=E.hierarchy.idForObject3D?.(se);if(lt)return lt;se=se.parent}}return null};if(!n.viewport){n.viewport=new Kn(X,n.scene,F,L,{renderer:A,authoring:()=>n.adapter??ee,pick:ot,publishPickContext:!1,onProjectionChange:br,chromeInsetPx:S||ps?0:zt,lightRig:Ot!==!1}),Tt===!0&&n.viewport.grid.removeFromParent();const h=b=>{const E=ot(b.clientX,b.clientY),u=E?n.adapter?.hierarchy.object3D?.(E):null;u&&ts.current?.(u)};L.addEventListener("dblclick",h),n.cleanups.push(()=>L.removeEventListener("dblclick",h))}const y=n.viewport;if(Xe){const h=y.camera;n.scene.add(h),h.add(Xe),n.cleanups.push(()=>{Xe.removeFromParent(),h.removeFromParent()})}if(w){const h=new Kt;h.name="__object3d_document_overlay",rr(h,"editorHelper",!0),H.add(h),he=w.setup({root:x.root,scene:H,renderer:A,overlay:h,camera:()=>n.session?.camera()??y.camera,writable:c!==void 0||a!==void 0});const b=u=>{const g=X.getBoundingClientRect(),j=new ht((u.clientX-g.left)/Math.max(g.width,1)*2-1,-((u.clientY-g.top)/Math.max(g.height,1))*2+1),z=new $s;return z.layers.enableAll(),z.setFromCamera(j,n.session?.camera()??y.camera),{pointerId:u.pointerId,button:u.button,buttons:u.buttons,clientX:u.clientX,clientY:u.clientY,altKey:u.altKey,ctrlKey:u.ctrlKey,metaKey:u.metaKey,shiftKey:u.shiftKey,ray:z.ray.clone(),hits:z.intersectObjects([x.root,h],!0)}};J=new Ci({begin:u=>{if(!c&&!a)throw new Error("This Asset Lab document has no persistence binding; project gestures are read-only.");return he.begin(u)},persist:async u=>{await q(u)},reportError:u=>Y(u instanceof Error?u.message:JSON.stringify(u))});const E=u=>{u.preventDefault(),u.stopPropagation()};Qe=u=>{u.target instanceof Element&&u.target.closest('[role="alert"], [role="toolbar"]')!==null||J?.begin(b(u))&&(E(u),u.isTrusted&&X.setPointerCapture?.(u.pointerId))},et=u=>{J?.hasActiveGesture()&&(E(u),J.update(b(u)))},tt=u=>{J?.hasActiveGesture()&&(E(u),X.hasPointerCapture?.(u.pointerId)&&X.releasePointerCapture?.(u.pointerId),J.commit(b(u)))},st=u=>{J?.hasActiveGesture()&&(E(u),J.cancel(u.pointerId))},rt=u=>{u.key!=="Escape"||!J?.hasActiveGesture()||(u.preventDefault(),J.cancel())},ms=()=>{L.addEventListener("pointerdown",Qe,!0),L.addEventListener("pointermove",et,!0),L.addEventListener("pointerup",tt,!0),L.addEventListener("pointercancel",st,!0),window.addEventListener("keydown",rt)}}const Se=n.content,bs=[...F.selectedEntityIds],Le=n.adapter,Mr=new Map(F.objectMap),De=n.session?.root,Cr=n.frame,kr=n.syncHostScene,Er=Ue.current,Rr=$e.current,jr=Ge.current,ws=n.session?.neutralBackgroundTexture(),Or=n.dressing.lights.map(h=>h.visible),Tr=n.cleanups.length,Fr=n.initialized;if(gs=()=>{H.removeFromParent(),Je&&Je.add(x.root),Se&&n.scene.add(Se.scene),n.adapter=Le,n.content=Se,n.frame=Cr,n.syncHostScene=kr,n.initialized=Fr;for(const h of n.cleanups.splice(Tr))h();!De&&n.session&&(n.session.dispose(),n.session=null),F.objectMap.clear();for(const[h,b]of Mr)F.objectMap.set(h,b);Se&&F.bindScene(Se.scene,A,y.batchedRenderer,y.camera),De&&Le&&n.session?.replaceContent(De,Le),Ue.current=Er,$e.current=Rr,Ge.current=jr,qe.current=Le,ls(Le),ws!==void 0&&n.session?.setNeutralBackground(ws),n.dressing?.lights.forEach((h,b)=>{h.visible=Or[b]??!0}),De&&n.dressing?.frameContent(De),F.selectMultiple(bs),F.notifyIngestObjectMapEdit()},Se?.scene.removeFromParent(),n.scene.add(H),n.adapter=ee,n.content=_t,F.bindScene(H,A,y.batchedRenderer,y.camera),F.setOrbitTarget(y.orbitControls.target),F.objectMap.clear(),H.traverse(h=>{const b=ee.hierarchy.idForObject3D?.(h);b&&F.objectMap.set(b,h)}),n.session)n.session.replaceContent(x.root,ee);else{const h=er(ss.current),b=er(rs.current)??h;if(b||y.focusOn(x.root),Ct!==void 0&&kt!==void 0&&Et!==void 0){const E=b??Ut(x.root),u=E.getCenter(new K),g=new K(Ct,kt,Et).normalize(),j=ft(E,y.camera,g)*Math.min(10,Math.max(.1,O??1));y.camera.position.copy(u).add(g.multiplyScalar(j)),y.orbitControls.target.copy(u)}if(n.session=new Mi(r,x.root,n.scene,A,y,n.dressing.lights,ee,Me?null:i===void 0?n.dressing.backgroundTexture:new ne(i),h),n.session.selectionOutlineEnabled=!Pr&&Qt.current,!Me&&i===void 0&&n.dressing.backgroundTexture){const E=n.session;n.cleanups.push(si(()=>{const u=Bs(X).background;if(u!==null){n.scene.background=new ne(u);return}const g=n.defaultBackground;n.defaultBackground=ri(),E.neutralBackgroundTexture()===g&&E.setNeutralBackground(n.defaultBackground),g instanceof Us&&g!==n.dressing?.backgroundTexture&&g.dispose()}))}}const We=B.camera;We&&(y.camera.up.copy(We.up),y.setProjection(cs),y.setPose(We.position,We.target,We.fov||void 0),B.camera=null);const I=n.session;Ue.current=At,$e.current=Ce,Ge.current=he,qe.current=ee,ls(ee);let ys=!1;x.root.traverse(h=>{h.isLight&&(ys=!0)});for(const h of n.dressing.lights)h.visible=!ys;n.dressing.frameContent(x.root),F.selectMultiple(bs.filter(h=>F.objectMap.has(h))),F.notifyIngestObjectMapEdit(),I.syncSelectionPresentation(),ms?.(),Y(null),S||Ls(r);let at=H.background;I.setNeutralBackground(at??n.defaultBackground);const te=B.presentation;te&&(I.setMode(te.mode),I.setGrid(te.grid),I.setBackground(te.background),I.setExposure(te.exposure),I.setProjection(te.projection),I.setLighting(te.lighting),I.setSkeleton(te.skeleton),I.setBounds(te.bounds),B.presentation=null);const Ar=()=>{n.scene.environment=H.environment??n.defaultEnvironment,n.scene.fog=H.fog,n.scene.environmentIntensity=H.environmentIntensity,n.scene.environmentRotation.copy(H.environmentRotation),n.scene.backgroundIntensity=H.backgroundIntensity,n.scene.backgroundBlurriness=H.backgroundBlurriness,n.scene.backgroundRotation.copy(H.backgroundRotation),at!==H.background&&(at=H.background,I.setNeutralBackground(at??n.defaultBackground))};n.syncHostScene=Ar,I.setBeforeRender(()=>n.syncHostScene?.()),I.setPresentsFrames(!0);const Hr=h=>{nt||!(h>0)||!Number.isFinite(h)||(n.contentSeconds+=h,n.transportAdvances++,x.update?.(h))},_r=Ys(x.root,n.transport);n.cleanups.push(()=>_r.dispose());const pe=B.transport;pe&&(pe.activeSubject&&n.transport.setActiveSubject(pe.activeSubject),n.transport.setLoop(pe.range.loop),n.transport.setTimeScale(pe.timeScale),n.transport.seek(pe.time),pe.playbackState==="playing"?n.transport.play():pe.playbackState==="paused"&&n.transport.pause(),B.transport=null);let Bt=performance.now();const Ss=typeof x.onChange=="function";let Lt=!0;const ct=()=>{Lt=!0};if(Ss){const h=x.onChange(ct),b=F.subscribe(ct),E=["pointerdown","pointermove","pointerup","pointerleave","wheel","keydown","keyup"];for(const u of E)L.addEventListener(u,ct,{capture:!0,passive:!0});Ht=()=>{h(),b();for(const u of E)L.removeEventListener(u,ct,{capture:!0})}}let xs=-1;const Ps=new qs,Ms=new qs,Cs=new ht,ks=new ht;let Es,Rs=null,js=Number.NaN;const Br=h=>{if(!Ss||Lt||h>0||Vs()!==xs||I.needsFrame()||n.presence?.live()||he?.prepareFrame||he?.update||(y.batchedRenderer.batches?.length??0)>0)return!0;const b=I.camera();return b.updateMatrixWorld(),A.getDrawingBufferSize(ks),!b.matrixWorld.equals(Ps)||!b.projectionMatrix.equals(Ms)||!ks.equals(Cs)||n.scene.background!==Es||A.toneMapping!==Rs||A.toneMappingExposure!==js},Lr=()=>{Lt=!1,xs=Vs();const h=I.camera();Ps.copy(h.matrixWorld),Ms.copy(h.projectionMatrix),A.getDrawingBufferSize(Cs),Es=n.scene.background,Rs=A.toneMapping,js=A.toneMappingExposure},Dr=(h,b)=>{if(nt||!A||!y)return;const E=A,u=y,g=I?.profiler;g?.beginFrame(),b&&(Bt=h);const j=Math.min((h-Bt)/1e3,.1);Bt=h,g?.beginPhase();const z=n.transport.tick(j);if(z>0&&Hr(z),he?.prepareFrame?.(j),he?.update?.(j),g?.endPhase("animation"),g?.beginPhase(),n.presence?.syncMarkers(j),y.update(j),S||Ds(r,j),y.batchedRenderer.update(j),g?.endPhase("editor"),!b&&!Br(z)){g?.endFrame();return}g?.beginPhase(),E.info.reset();const fe=!Oe.current&&on()===r;fe&&an(r);const se=fe?Date.now():0,lt=n.scene.overrideMaterial,Os=I.presentation().mode;Os!=="uv"&&Os!=="vertex-colors"&&(n.scene.overrideMaterial=H.overrideMaterial);try{u.renderWithInfrastructure(()=>{I.renderViewport(j),u.renderViewCube(E)})}finally{n.scene.overrideMaterial=lt}I.servePresentedFrame(),Lr(),Oe.current||(Oe.current=!0,fe&&cn("first-render",Date.now()-se),ln(r),Mt("ready")),g?.reportRender({gpuMs:null,drawCalls:E.info.render.calls,triangles:E.info.render.triangles,geometries:E.info.memory.geometries,textures:E.info.memory.textures}),g?.endPhase("render"),g?.endFrame();const Q=gt.current;if(Q&&M&&un(M)===F){const ke=I.cameraPose();Q.frameTime=j*1e3,Q.fps=j>0?1/j:0,Q.drawCalls=E.info.render.calls,Q.triangles=E.info.render.triangles,Q.cameraPosition.x=ke.position[0],Q.cameraPosition.y=ke.position[1],Q.cameraPosition.z=ke.position[2],Q.cameraTarget.x=ke.target[0],Q.cameraTarget.y=ke.target[1],Q.cameraTarget.z=ke.target[2]}};if(n.frame=Dr,ze.current=n.rendererSession,!n.initialized){S||(n.cleanups.push(Ws({camera:y.camera,orbit:y.orbitControls,scene:n.scene},()=>null,(g,j)=>y.setHelper(g,j),{documentId:r})),mt(()=>import("./stage-presence-markers-DiGI6A45.js"),__vite__mapDeps([26,3,4,5,6,8,9,7,10,11,1,12,27])).then(g=>{if(n.isClosed||V.current!==n||n.presence)return;const j=g.bindStagePresenceMarkers({scene:n.scene,store:F,documentId:r,container:L,canvas:X,viewport:y,readVisibleCameraPose:()=>{const z=n.session?.camera()??y.renderCamera,fe=z.getWorldPosition(new K),se=z.fov;return{position:fe,target:y.orbitControls.target,fov:typeof se=="number"?se:0}}});n.presence=j,n.cleanups.push(()=>j.dispose())}),n.cleanups.push(dn(I)),n.cleanups.push(hn({id:r,label:s,kind:fs?"asset":"source",profiler:I.profiler}))),!S&&!ps&&n.cleanups.push(pn(r,()=>({adapter:n.adapter,nodeId:n.adapter?.selection?.get()[0]??null})));const h=S?`${r}#chromeless-${++Ni}`:r;n.cleanups.push(fn({id:h,label:s,contentClock:()=>n.contentSeconds,transportAdvances:()=>n.transportAdvances})),n.cleanups.push(F.onViewportAction(g=>{switch(g.type){case"focus-selection":case"focus-scene":!n.session?.frame()&&n.session?.root&&y.focusOn(n.session.root);break;case"focus-entity":{const j=n.adapter?.hierarchy.object3D?.(g.id)??null;j&&y.focusOn(j);break}case"snap-selection-to-floor":y.snapSelectionToFloor();break;case"set-view-preset":y.setViewPreset(g.preset);break;case"set-camera-pose":y.setPose(g.position,g.target,g.fov);break}}));let b="";n.cleanups.push(F.subscribe(()=>{y.objectMap=F.objectMap,y.syncFromStore(),n.session?.syncSelectionPresentation();const g=(n.adapter?.selection?.get()??[]).join("\0");g!==b&&(b=g,S||Ls(r))}));const E=()=>{const g=Math.max(1,L.clientWidth),j=Math.max(1,L.clientHeight),z=A.getPixelRatio();(X.width!==Math.floor(g*z)||X.height!==Math.floor(j*z))&&A.setSize(g,j,!1),y.resize(g,j),n.session?.resize(g,j),n.rendererSession.redraw()},u=new ResizeObserver(E);u.observe(L),n.cleanups.push(()=>u.disconnect()),E(),n.initialized=!0,Is()}y.objectMap=F.objectMap,y.syncFromStore(),n.rendererSession.setActive(Ne.current),n.rendererSession.redraw(),vs=!0,Se?.dispose()}catch(q){if(!vs)try{gs?.()}finally{Je&&x.root.parent===H&&Je.add(x.root),_t.dispose()}console.error(`[object3d document] ${s}: source update failed`,q),Y(q instanceof Error?q.message:String(q))}},xr=es.current.then(Sr);return es.current=xr.catch(ue=>{k||Y(ue instanceof Error?ue.message:String(ue))}),()=>{k=!0}},[l,i,t,Ct,kt,Et,s,r,ae,us,jt,Tt,Ot,Xe,ds,S,Ke,Te,Rt,w,c,a,R,B,Pe,$,e,xe]),p.useEffect(()=>{const k=ze.current,le=f&&!ns.current;ns.current=f,k&&(le&&(Oe.current=!1,yn(r)),k.setActive(f||xe))},[f,r,xe]);const Ye=V.current,Ft=Pt==="ready"&&Ye?.viewport?{store:Ye.store,viewport:Ye.viewport,canvas:Ye.surface.canvas}:null,yr=p.useCallback(()=>{const k=qe.current;return k?{adapter:k,nodeId:k.selection?.get()[0]??k.hierarchy.roots()[0]?.id??null}:null},[]),hs=d.jsx("div",{"data-testid":"tool-object3d-authoring","data-vgai-chromeless":S||void 0,className:ae?"vgai-object3d-studio-stage":void 0,style:{position:S||ce?"relative":"absolute",...S?{width:"100%",height:"100%"}:ce?{flex:1,minHeight:0}:{inset:-zt},overflow:"hidden",background:ae?void 0:be.surface.raised,pointerEvents:"auto"},children:d.jsxs("div",{ref:vt,style:{position:"absolute",inset:0,minHeight:0,overflow:"hidden"},children:[d.jsx(zi,{canvasHostRef:bt}),f&&Ft&&!S?d.jsx(p.Suspense,{fallback:null,children:d.jsx(Wi,{stage:Ft})}):null,M&&!S?d.jsx(ji,{store:M,documentId:r,stage:Ft,active:f,chrome:"document"}):null,M&&os?d.jsx(os.Overlays,{store:M,documentId:r,cameraPreviewRef:as,mountStatus:fr,rootIds:gr}):null,xt&&d.jsx("div",{role:"alert",style:{position:"absolute",insetInline:0,top:0,display:"flex",justifyContent:"center",padding:"var(--vgai-space-3)",pointerEvents:"none"},children:d.jsxs("div",{className:"vgai-chrome-island",style:{display:"flex",alignItems:"center",gap:"var(--vgai-space-3)",maxWidth:"80%",padding:"var(--vgai-space-2) var(--vgai-space-3)",borderRadius:"var(--vgai-radius-md)",border:`var(--vgai-stroke-resting) solid ${be.semantic.danger}`,background:be.surface.raised,color:be.semantic.danger,pointerEvents:"auto"},children:[d.jsx("span",{children:xt}),d.jsx(ge,{size:"compact","aria-label":"Dismiss",onClick:()=>Y(null),"data-testid":"object3d-document-error-dismiss",children:d.jsx(ve,{icon:re.action.close})})]})}),!xt&&Pt==="building"&&d.jsx(ni,{testId:"object3d-document-status",children:ii}),d.jsx("div",{style:{position:"absolute",inset:S||ce?0:zt,pointerEvents:"none"},children:!S&&Pt==="ready"&&V.current&&d.jsx(Di,{viewport:V.current.viewport,session:V.current.session,store:V.current.store,projection:cs,displayName:s,...W?{statistics:W}:{},objectName:k=>V.current?.adapter?.hierarchy.object3D?.(k)?.name??V.current?.store.objectMap.get(k)?.name??null})})]})});return ce?d.jsx(en,{documentId:r,active:f,type:U??(Ke?"entity":"model"),title:s,status:e,selection:yr,fill:!0,children:d.jsxs("div",{className:"vgai-object3d-asset-workspace",children:[hs,d.jsx(Fi,{transport:V.current?.transport??null})]})}):hs}function bo(r){return d.jsx(Ui,{...r})}export{Ui as Object3DDocumentViewport,bo as ToolObject3DAuthoring};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{aC as y,aD as f,ao as g,aE as x,aF as S}from"./index-GIL7oGEO.js";import{r as j}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";class w extends j.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,o){console.error(`[stories] ${this.props.modulePath} — story "${this.props.storyName}" crashed while rendering:`,t,o.componentStack)}render(){return this.state.error?e.jsxs("div",{style:{padding:12,fontSize:12,color:g.semantic.danger,maxWidth:640},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:["Story crashed: ",e.jsx("code",{children:this.props.modulePath})," — export"," ",e.jsx("code",{children:this.props.storyName})]}),e.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)})]}):this.props.children}}const a=new WeakMap;async function k(r,t,o,i,s){const n=a.get(r),c=(n?.generation??0)+1;a.set(r,{root:n?.root,generation:c}),y(r);const d=S();d&&await x(d.rootPath),await i.load();const{createRoot:m,flushSync:h}=await f(),p=a.get(r);if(!p||p.generation!==c)return null;const l=n?.root??m(r);return a.set(r,{root:l,generation:c}),h(()=>{l.render(e.jsx(w,{modulePath:t,storyName:o,children:e.jsx(i,{...s??{}})}))}),{root:l,unmount:()=>{queueMicrotask(()=>{const u=a.get(r);!u||u.generation!==c||!u.root||(a.delete(r),u.root.unmount())})}}}async function C(r,t,o,i){if(typeof o.play!="function")return{ran:!1};try{return await o.play({canvasElement:i}),{ran:!0}}catch(s){const n=String(s instanceof Error?s.message:s);return console.error(`[stories] ${r} — story "${t}"'s play() threw:`,s),{ran:!0,error:`[stories] ${r} — story "${t}"'s play() failed: ${n}`}}}export{k as m,C as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ak as M,b2 as f,al as A,aX as p,a$ as u,ap as b,b7 as x,aB as m,M as C,aY as c,a as g,e as T,C as _}from"./three.module-D396a9Mn.js";class ce extends M{constructor(t){super(t),this.debug=!1,this.group=null,this.materials=[],this.meshes=[]}load(t,s,e,a){const r=this,n=this.path===""?f.extractUrlBase(t):this.path,i=new A(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(t,function(o){try{s(r.parse(o,n))}catch(d){a?a(d):console.error(d),r.manager.itemError(t)}},e,a)}parse(t,s){this.group=new p,this.materials=[],this.meshes=[],this.readFile(t,s);for(let e=0;e<this.meshes.length;e++)this.group.add(this.meshes[e]);return this.group}readFile(t,s){const e=new DataView(t),a=new h(e,0,this.debugMessage);if(a.id===E||a.id===w||a.id===F){let r=a.readChunk();for(;r;){if(r.id===I){const n=r.readDWord();this.debugMessage("3DS file version: "+n)}else r.id===P?this.readMeshData(r,s):this.debugMessage("Unknown main chunk: "+r.hexId);r=a.readChunk()}}this.debugMessage("Parsed "+this.meshes.length+" meshes")}readMeshData(t,s){let e=t.readChunk();for(;e;){if(e.id===N){const a=+e.readDWord();this.debugMessage("Mesh Version: "+a)}else if(e.id===B){const a=e.readFloat();this.debugMessage("Master scale: "+a),this.group.scale.set(a,a,a)}else e.id===ae?(this.debugMessage("Named Object"),this.readNamedObject(e)):e.id===U?(this.debugMessage("Material"),this.readMaterialEntry(e,s)):this.debugMessage("Unknown MDATA chunk: "+e.hexId);e=t.readChunk()}}readNamedObject(t){const s=t.readString();let e=t.readChunk();for(;e;){if(e.id===ie){const a=this.readMesh(e);a.name=s,this.meshes.push(a)}else this.debugMessage("Unknown named object chunk: "+e.hexId);e=t.readChunk()}}readMaterialEntry(t,s){let e=t.readChunk();const a=new u;for(;e;){if(e.id===W)a.name=e.readString(),this.debugMessage(" Name: "+a.name);else if(e.id===j)this.debugMessage(" Wireframe"),a.wireframe=!0;else if(e.id===z){const r=e.readByte();a.wireframeLinewidth=r,this.debugMessage(" Wireframe Thickness: "+r)}else if(e.id===H)a.side=b,this.debugMessage(" DoubleSided");else if(e.id===X)this.debugMessage(" Additive Blending"),a.blending=x;else if(e.id===v)this.debugMessage(" Diffuse Color"),a.color=this.readColor(e);else if(e.id===G)this.debugMessage(" Specular Color"),a.specular=this.readColor(e);else if(e.id===L)this.debugMessage(" Ambient color"),a.color=this.readColor(e);else if(e.id===V){const r=this.readPercentage(e);a.shininess=r*100,this.debugMessage(" Shininess : "+r)}else if(e.id===Y){const r=this.readPercentage(e);a.opacity=1-r,this.debugMessage(" Transparency : "+r),a.transparent=a.opacity<1}else e.id===q?(this.debugMessage(" ColorMap"),a.map=this.readMap(e,s)):e.id===Z?(this.debugMessage(" BumpMap"),a.bumpMap=this.readMap(e,s)):e.id===J?(this.debugMessage(" OpacityMap"),a.alphaMap=this.readMap(e,s)):e.id===$?(this.debugMessage(" SpecularMap"),a.specularMap=this.readMap(e,s)):this.debugMessage(" Unknown material chunk: "+e.hexId);e=t.readChunk()}this.materials[a.name]=a}readMesh(t){let s=t.readChunk();const e=new m,a=new u,r=new C(e,a);for(r.name="mesh";s;){if(s.id===re){const n=s.readWord();this.debugMessage(" Vertex: "+n);const i=[];for(let o=0;o<n;o++)i.push(s.readFloat()),i.push(s.readFloat()),i.push(s.readFloat());e.setAttribute("position",new c(i,3))}else if(s.id===ne)this.readFaceArray(s,r);else if(s.id===de){const n=s.readWord();this.debugMessage(" UV: "+n);const i=[];for(let o=0;o<n;o++)i.push(s.readFloat()),i.push(s.readFloat());e.setAttribute("uv",new c(i,2))}else if(s.id===he){this.debugMessage(" Transformation Matrix (TODO)");const n=[];for(let d=0;d<12;d++)n[d]=s.readFloat();const i=new g;i.elements[0]=n[0],i.elements[1]=n[6],i.elements[2]=n[3],i.elements[3]=n[9],i.elements[4]=n[2],i.elements[5]=n[8],i.elements[6]=n[5],i.elements[7]=n[11],i.elements[8]=n[1],i.elements[9]=n[7],i.elements[10]=n[4],i.elements[11]=n[10],i.elements[12]=0,i.elements[13]=0,i.elements[14]=0,i.elements[15]=1,i.transpose();const o=new g;o.copy(i).invert(),e.applyMatrix4(o),i.decompose(r.position,r.quaternion,r.scale)}else this.debugMessage(" Unknown mesh chunk: "+s.hexId);s=t.readChunk()}return e.computeVertexNormals(),r}readFaceArray(t,s){const e=t.readWord();this.debugMessage(" Faces: "+e);const a=[];for(let i=0;i<e;++i)a.push(t.readWord(),t.readWord(),t.readWord()),t.readWord();s.geometry.setIndex(a);let r=0,n=0;for(;!t.endOfChunk;){const i=t.readChunk();if(i.id===oe){this.debugMessage(" Material Group");const o=this.readMaterialGroup(i),d=o.index.length*3;s.geometry.addGroup(n,d,r),n+=d,r++;const l=this.materials[o.name];Array.isArray(s.material)===!1&&(s.material=[]),l!==void 0&&s.material.push(l)}else this.debugMessage(" Unknown face array chunk: "+i.hexId)}s.material.length===1&&(s.material=s.material[0])}readMap(t,s){let e=t.readChunk(),a={};const r=new T(this.manager);for(r.setPath(this.resourcePath||s).setCrossOrigin(this.crossOrigin);e;){if(e.id===K){const n=e.readString();a=r.load(n),this.debugMessage(" File: "+s+n)}else e.id===se?(a.offset.x=e.readFloat(),this.debugMessage(" OffsetX: "+a.offset.x)):e.id===te?(a.offset.y=e.readFloat(),this.debugMessage(" OffsetY: "+a.offset.y)):e.id===Q?(a.repeat.x=e.readFloat(),this.debugMessage(" RepeatX: "+a.repeat.x)):e.id===ee?(a.repeat.y=e.readFloat(),this.debugMessage(" RepeatY: "+a.repeat.y)):this.debugMessage(" Unknown map chunk: "+e.hexId);e=t.readChunk()}return a}readMaterialGroup(t){const s=t.readString(),e=t.readWord();this.debugMessage(" Name: "+s),this.debugMessage(" Faces: "+e);const a=[];for(let r=0;r<e;++r)a.push(t.readWord());return{name:s,index:a}}readColor(t){const s=t.readChunk(),e=new _;if(s.id===y||s.id===k){const a=s.readByte(),r=s.readByte(),n=s.readByte();e.setRGB(a/255,r/255,n/255),this.debugMessage(" Color: "+e.r+", "+e.g+", "+e.b)}else if(s.id===S||s.id===O){const a=s.readFloat(),r=s.readFloat(),n=s.readFloat();e.setRGB(a,r,n),this.debugMessage(" Color: "+e.r+", "+e.g+", "+e.b)}else this.debugMessage(" Unknown color chunk: "+s.hexId);return e}readPercentage(t){const s=t.readChunk();switch(s.id){case D:return s.readShort()/100;case R:return s.readFloat();default:return this.debugMessage(" Unknown percentage chunk: "+s.hexId),0}}debugMessage(t){this.debug&&console.log(t)}}class h{constructor(t,s,e){this.data=t,this.offset=s,this.position=s,this.debugMessage=e,this.debugMessage instanceof Function&&(this.debugMessage=function(){}),this.id=this.readWord(),this.size=this.readDWord(),this.end=this.offset+this.size,this.end>t.byteLength&&this.debugMessage("Bad chunk size for chunk at "+s)}readChunk(){if(this.endOfChunk)return null;try{const t=new h(this.data,this.position,this.debugMessage);return this.position+=t.size,t}catch{return this.debugMessage("Unable to read chunk at "+this.position),null}}get hexId(){return this.id.toString(16)}get endOfChunk(){return this.position>=this.end}readByte(){const t=this.data.getUint8(this.position,!0);return this.position+=1,t}readFloat(){try{const t=this.data.getFloat32(this.position,!0);return this.position+=4,t}catch(t){return this.debugMessage(t+" "+this.position+" "+this.data.byteLength),0}}readInt(){const t=this.data.getInt32(this.position,!0);return this.position+=4,t}readShort(){const t=this.data.getInt16(this.position,!0);return this.position+=2,t}readDWord(){const t=this.data.getUint32(this.position,!0);return this.position+=4,t}readWord(){const t=this.data.getUint16(this.position,!0);return this.position+=2,t}readString(){let t="",s=this.readByte();for(;s;)t+=String.fromCharCode(s),s=this.readByte();return t}}const F=19789,E=15786,w=49725,I=2,S=16,y=17,k=18,O=19,D=48,R=49,P=15677,N=15678,B=256,U=45055,W=40960,L=40976,v=40992,G=41008,V=41024,Y=41040,H=41089,X=41091,j=41093,z=41095,q=41472,J=41488,Z=41520,$=41476,K=41728,Q=41812,ee=41814,se=41816,te=41818,ae=16384,ie=16640,re=16656,ne=16672,oe=16688,de=16704,he=16736;export{ce as TDSLoader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bl as f}from"./three.module-D396a9Mn.js";class s extends f{constructor(i,e={}){const n=e.font;if(n===void 0)super();else{const d=n.generateShapes(i,e.size);e.depth===void 0&&(e.depth=50),e.bevelThickness===void 0&&(e.bevelThickness=10),e.bevelSize===void 0&&(e.bevelSize=8),e.bevelEnabled===void 0&&(e.bevelEnabled=!1),super(d,e)}this.type="TextGeometry"}}export{s as TextGeometry};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/document-preview-three-Kbg2GCLm.js","assets/index-GIL7oGEO.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/three.module-D396a9Mn.js","assets/index-D2fNXpHa.css","assets/scene-framing-Cat0GtyJ.js","assets/standard-viewport-dressing-CzjAe_0A.js","assets/stage-invalidation-DBg3C3Ta.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{hi as P,hj as lt,ax as Q,az as $t,bO as zt,hk as It,bP as Vt,de as Ht,hl as St,aN as Xt,ay as tt,eS as Zt,hm as Ut,ao as g,e7 as Wt,b2 as Yt,g6 as qt,ev as Jt,eH as Z,di as Qt,av as Mt,hn as te,eQ as ee,fK as mt,e9 as ne,bF as oe,aw as U,cG as Et,_ as N,ho as re,hp as se,V as ie,hq as X,hr as ae,dG as ce,hs as ue}from"./index-GIL7oGEO.js";import{a as m}from"./jsx-runtime-DPjLkJKQ.js";import{O as de}from"./Object3DDocumentViewport-DB7T0NTl.js";import{STANDARD_COMPONENT_CAMERA_DIRECTION as le}from"./standard-viewport-dressing-CzjAe_0A.js";import{t as me}from"./viewport-surface-status-B3om4Kcf.js";import{r as w}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{withStoryMountTurn as vt,lastStoryMountPhaseTiming as pe}from"./story-three-preview-BHEDZzcl.js";import{setUserData as he}from"./user-data-BB2Of6Ht.js";import{aX as R,M as Dt,B as fe,F as xe,y as ge,z as ye,ap as be,aB as we,aY as Se,b0 as Me,cm as Ee,w as ve,u as De,V as O,s as _e,r as Pe}from"./three.module-D396a9Mn.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./stage-invalidation-DBg3C3Ta.js";import"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-ErOhDXXB.js";import"./index-bQE2NA0D.js";import"./story-mount-turn-DFRTj5hi.js";import"./object-marks-DwvIEBOK.js";const L={neighbourGapFactor:.45,minGap:.5,districtGapFactor:.6,minDistrictGap:3},K=.7,Oe={min:[0,0,0],max:[0,0,0]};function et(t){return[...t.min,...t.max].some(r=>!Number.isFinite(r))?Oe:{min:[Math.min(t.min[0],t.max[0]),Math.min(t.min[1],t.max[1]),Math.min(t.min[2],t.max[2])],max:[Math.max(t.min[0],t.max[0]),Math.max(t.min[1],t.max[1]),Math.max(t.min[2],t.max[2])]}}function nt(t){return[t.max[0]-t.min[0],t.max[1]-t.min[1],t.max[2]-t.min[2]]}function pt(t){const e=nt(et(t));return e[0]*e[2]}function Te(t){return-et(t).min[1]}function _t(t){const e=Math.max(t[0],t[2]),r=Math.max(.15,.1*e);return[Math.max(t[0]+2*r,K),Math.max(t[2]+2*r,K)]}function Pt(t){return Math.max(t[0],t[1])}function ke(t){return t.map(e=>({item:e,bounds:et(e.bounds)})).sort((e,r)=>{const n=pt(e.bounds)-pt(r.bounds);return n!==0?n:e.item.id<r.item.id?-1:1})}function Be(t){const e=Math.max(K,...t.map(({bounds:r})=>Pt(_t(nt(r)))));return Math.max(10,2.2*e)}function Re(t,e,r){const n=Be(t),s=[];let o={slots:[],xEdge:0,depth:0,previousSpan:null};const i=()=>{o.slots.length>0&&s.push({slots:o.slots,xEdge:o.xEdge,depth:o.depth}),o={slots:[],xEdge:0,depth:0,previousSpan:null}};for(const{item:a,bounds:u}of t){const c=nt(u),d=_t(c),l=Pt(d),p=o.previousSpan===null?0:Math.max(r,e*Math.max(o.previousSpan,l));o.slots.length>0&&o.xEdge+p+d[0]>n&&i();const y=o.previousSpan===null?0:p,b=o.xEdge+y+d[0]/2;o.xEdge=b+d[0]/2,o.depth=Math.max(o.depth,d[1]),o.previousSpan=l,o.slots.push({item:a,bounds:u,size:c,footprint:d,centreX:b})}return i(),s}function ht(t,e,r,n,s){const o=Re(e,n,s),i=[];let a=r,u=null,c=0;for(const d of o){u!==null&&(a+=Math.max(s,n*Math.max(u,d.depth)));const l=a+d.depth/2;a=l+d.depth/2,u=d.depth,c=Math.max(c,d.xEdge);for(const p of d.slots)i.push({id:p.item.id,groupKey:t,translation:[p.centreX-(p.bounds.min[0]+p.bounds.max[0])/2,Te(p.bounds),l-(p.bounds.min[2]+p.bounds.max[2])/2],anchor:[p.centreX,0,l],size:p.size,footprint:p.footprint})}return{placements:i,xEdge:c,depth:a-r}}function Ce(t){return Math.min(3,Math.max(.6,.08*t))}function je(t,e={}){const r=e.neighbourGapFactor??L.neighbourGapFactor,n=e.minGap??L.minGap,s=e.districtGapFactor??L.districtGapFactor,o=e.minDistrictGap??L.minDistrictGap,i=new Map;for(const l of t){const p=i.get(l.groupKey);p?p.push(l):i.set(l.groupKey,[l])}const a=[];let u=0,c=null;for(const l of i.keys()){const p=ke(i.get(l)??[]),y=ht(l,p,0,r,n),b=Ce(Math.max(y.depth,K)),x=y.depth+2*b;c!==null&&(u+=Math.max(o,s*Math.max(c,x)));const h=u;u=h+x,c=x;const{placements:E,xEdge:V}=ht(l,p,h+b,r,n),_={minX:-b,maxX:V+b,minZ:h,maxZ:h+x};a.push({groupKey:l,items:E,extent:_,anchor:[(_.minX+_.maxX)/2,0,_.minZ]})}const d=a.length===0?{minX:0,maxX:0,minZ:0,maxZ:0}:{minX:Math.min(...a.map(l=>l.extent.minX)),maxX:Math.max(...a.map(l=>l.extent.maxX)),minZ:Math.min(...a.map(l=>l.extent.minZ)),maxZ:Math.max(...a.map(l=>l.extent.maxZ))};return{districts:a,extent:d}}const Ot={min:[0,0,0],max:[0,0,0]},Ae=.35,ft=20;function ot(t){return[...t.min,...t.max].every(e=>Number.isFinite(e))}function z(t){return ot(t)?{min:[Math.min(t.min[0],t.max[0]),Math.min(t.min[1],t.max[1]),Math.min(t.min[2],t.max[2])],max:[Math.max(t.min[0],t.max[0]),Math.max(t.min[1],t.max[1]),Math.max(t.min[2],t.max[2])]}:Ot}function Tt(t){const e=z(t);return[e.max[0]-e.min[0],e.max[1]-e.min[1],e.max[2]-e.min[2]]}function $(t){const e=t.map(z).filter(o=>ot(o));if(e.length===0)return Ot;const r=e[0],n=[r.min[0],r.min[1],r.min[2]],s=[r.max[0],r.max[1],r.max[2]];for(let o=1;o<e.length;o++){const i=e[o];n[0]=Math.min(n[0],i.min[0]),n[1]=Math.min(n[1],i.min[1]),n[2]=Math.min(n[2],i.min[2]),s[0]=Math.max(s[0],i.max[0]),s[1]=Math.max(s[1],i.max[1]),s[2]=Math.max(s[2],i.max[2])}return{min:n,max:s}}function W(t,e){const r=z(t);return{min:[r.min[0]+e[0],r.min[1]+e[1],r.min[2]+e[2]],max:[r.max[0]+e[0],r.max[1]+e[1],r.max[2]+e[2]]}}function Ne(t){return"min"in t?{bounds:t}:{bounds:t.bounds,...t.overlay===!0?{overlay:!0}:{},...t.enclosure===!0?{enclosure:!0}:{}}}function Le(t,e={}){if(e.overlay)return"volume";if(e.enclosure)return"environment-scale";const n=[...Tt(t)].sort((a,u)=>u-a),s=n[0]??0,o=n[1]??0;return(n[2]??0)<Ae&&o>=ft&&s>=ft?"unbounded-plane":null}function Ge(t){const e=t.map(Ne).map(a=>({bounds:z(a.bounds),overlay:a.overlay===!0,enclosure:a.enclosure===!0})).filter(a=>ot(a.bounds)),r=e.map(a=>a.bounds),n=$(r);if(e.length<2)return{full:n,presence:n,helpers:[]};const s=e.map(a=>Le(a.bounds,{overlay:a.overlay,enclosure:a.enclosure})),o=e.filter((a,u)=>s[u]===null).map(a=>a.bounds);if(o.length===0)return{full:n,presence:n,helpers:[]};const i=[];for(let a=0;a<e.length;a++){const u=s[a]??null;u!==null&&i.push({kind:u,bounds:e[a].bounds,size:Tt(e[a].bounds)})}return{full:n,presence:$(o),helpers:i}}function Fe(t){const e=t.map(u=>({exhibit:u,presence:Ge(u.nodes)})),r=e.map(({exhibit:u,presence:c})=>({id:u.id,groupKey:u.groupKey,bounds:c.presence})),n=je(r),s=new Map;for(const u of n.districts)for(const c of u.items)s.set(c.id,c);const o=[],i=[],a=[];for(const{exhibit:u,presence:c}of e){const d=s.get(u.id);d&&(o.push({id:u.id,groupKey:u.groupKey,full:c.full,presence:c.presence,helpers:c.helpers,placement:d}),i.push(W(c.presence,d.translation)),a.push(W(c.full,d.translation)))}return{layout:n,exhibits:o,frame:$(i),fullFrame:$(a)}}const kt="vgaiBoardStoryId",Bt="vgaiBoardComponentKey",I="vgai:board:no-story";function Ke(t){return{stories:t.length,modules:new Set(t.map(e=>e.modulePath)).size}}const Y="Ungrouped",xt="No story yet",$e=.9;function ze(t){return t instanceof Error?t.message:String(t)}async function Ie(t,e,r){const n=Date.now();let s=null,o=null;try{s=await r(e),Zt(s.root)||(s.dispose(),s=null,o="The story mounted no three content.")}catch(a){o=ze(a)}const i=pe();return Ut({id:t.id,ms:Date.now()-n,runtimeMs:i?.runtimeMs??0,loadMs:i?.loadMs??0,fiberMs:i?.fiberMs??0,settleMs:i?.settleMs??0,ok:s!==null}),{identity:t,mounted:s,reason:o}}function Rt(t){t.traverse(e=>{e.layers.enable(Xt),he(e,"editorHelper",!0)})}const Ve={color:3291977,roughness:.92,metalness:.04,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:2},gt=.06,He=0,yt=0,Xe=11124182,Ze=9413565;function Ue(t){const e=t.extent.maxX-t.extent.minX,r=t.extent.maxZ-t.extent.minZ,n=new Dt(new fe(e,gt,r),new xe(Ve));return n.name=`vgai:board-pad:${t.groupKey||Y}`,n.position.set((t.extent.minX+t.extent.maxX)/2,He-gt/2,(t.extent.minZ+t.extent.maxZ)/2),n.receiveShadow=!0,Rt(n),n}function We(t,e){const r=t/2,n=e/2,s=[[-r,-n],[r,-n],[r,n],[-r,n]],o=[];for(let u=0;u<s.length;u++){const c=s[u],d=s[(u+1)%s.length];o.push(c[0],0,c[1],d[0],0,d[1])}const i=new we;i.setAttribute("position",new Se(o,3));const a=new Me(i,new Ee({color:Xe,dashSize:.09,gapSize:.06}));return a.computeLineDistances(),a}function Ye(t){const e=new R;e.name=`vgai:board-ghost:${t.name}`,e.userData[Bt]=t.key;const[r,n]=t.placement.footprint,s=new Dt(new ge(r,n),new ye({color:Ze,transparent:!0,opacity:.1,depthWrite:!1,side:be}));s.rotation.x=-Math.PI/2,s.position.y=yt;const o=We(r,n);return o.position.y=yt,e.add(s,o),e.position.set(t.placement.anchor[0],0,t.placement.anchor[2]),e}function qe(t,e,r){if(!r.componentName)return!0;const n=St(t,r.componentName,e);return!n||n.modulePath===e&&n.name===r.name}function Je(t){return Ct(t).length}function Ct(t){const e=[],r=new Map,n=tt();for(const s of t)if(s.ok)for(const o of s.stories){const i=Q({modulePath:s.modulePath,regions:n});if(i.medium!=="three"){i.via==="undeclared"&&$t(s.modulePath,i.reason);continue}if(!qe(t,s.modulePath,o))continue;const a=zt({modulePath:s.modulePath,...o.title===void 0?{}:{title:o.title}}),u=It(a),c=`${u}/${a.leaf}`;r.set(c,(r.get(c)??0)+1),e.push({identity:{id:`${s.modulePath}#${o.name}`,storyName:o.name,modulePath:s.modulePath,groupKey:u,groupLeaf:a.leaf,groupPath:Vt(a)},storyLabel:o.label,Component:o.Component})}return e.map(({identity:s,storyLabel:o,Component:i})=>({identity:{...s,label:(r.get(`${s.groupKey}/${s.groupLeaf}`)??0)>1?`${s.groupLeaf} · ${o}`:s.groupLeaf},Component:i}))}function Qe(t,e){const r=new Set,n=[];for(const s of e){if(s.surface!=="three"||s.contentKind==="image")continue;const o=`${s.path}#${s.name}`;r.has(o)||(r.add(o),!St(t,s.name,s.path)&&n.push(s))}return n}function tn(t,e,r){const n=new R;return n.name=`vgai:board-exhibit:${t.label}`,n.position.set(...e.translation),n.add(r.root),n.userData[kt]=t.id,n}function q(t){return vt(async()=>{t.dispose()})}async function jt(t,e=[],r){return vt(n=>sn(t,e,r,n))}async function en(t,e,r){const n=[];for(const{identity:s,Component:o}of t){if(e?.aborted)break;n.push(await Ie(s,o,r))}return n}function nn(t){return{min:t.min.toArray(),max:t.max.toArray()}}function on(t){const e=new Map,r=new Map,n=[],s=[];for(const o of t){if(!o.mounted){s.push({id:o.identity.id,modulePath:o.identity.modulePath,storyName:o.identity.storyName,reason:o.reason??"The story produced no Object3D."});continue}const i=Ht(o.mounted.root).map(a=>({bounds:nn(a.box),overlay:a.overlay,enclosure:a.enclosure}));e.set(o.identity.id,o.mounted),r.set(o.identity.id,o.identity),n.push({id:o.identity.id,groupKey:o.identity.groupKey,nodes:i})}return{mounts:e,identities:r,measures:n,skipped:s}}function rn(t){const e=$e/2;return{id:`${t.path}#${t.name}`,groupKey:I,nodes:[{min:[-e,0,-e],max:[e,0,e]}]}}async function sn(t,e,r,n){const s=Date.now(),o=Ct(t);P("candidate-collect",Date.now()-s),lt({candidateCount:o.length});const i=Date.now(),a=await en(o,r,n);P("story-mounts",Date.now()-i);const u=Date.now(),{mounts:c,identities:d,measures:l,skipped:p}=on(a);P("bounds",Date.now()-u);const y=Date.now(),b=Qe(t,e),x=new Map(b.map(f=>[`${f.path}#${f.name}`,f])),h=Fe([...l,...b.map(rn)]),E=h.layout,V=new Map(h.exhibits.map(f=>[f.id,f]));P("layout",Date.now()-y);const _=Date.now(),T=new R;T.name="vgai:three-board";const k=new R;k.name="vgai:board-chrome",Rt(k),T.add(k);const C=[],rt=[],st=[],it=[k];for(const f of E.districts){const M=f.groupKey===I,D=new R;D.name=`vgai:board-district:${M?xt:f.groupKey||Y}`,T.add(D),k.add(Ue(f));for(const S of f.items){if(M){const A=x.get(S.id);if(!A)continue;const ut={key:S.id,name:A.name,path:A.path,line:A.line,placement:S},dt=Ye(ut);D.add(dt),it.push(dt),st.push(ut);continue}const j=c.get(S.id),H=d.get(S.id),v=V.get(S.id);!j||!H||!v||(D.add(tn(H,S,j)),C.push({...H,placement:S,fullSize:[v.full.max[0]-v.full.min[0],v.full.max[1]-v.full.min[1],v.full.max[2]-v.full.min[2]],helpers:v.helpers}))}rt.push({groupKey:f.groupKey,label:M?xt:f.groupKey||Y,placement:f})}const Kt=C.flatMap(f=>f.helpers.map(M=>({exhibitId:f.id,exhibitLabel:f.label,kind:M.kind,size:M.size})));let at=!1;const ct={root:T,exhibits:C,districts:rt,ghostSlots:st,skipped:p,frameBounds:h.frame,openingFrameBounds:h.exhibits[0]?W(h.exhibits[0].presence,h.exhibits[0].placement.translation):h.frame,helperVolumes:Kt,dispose(){if(!at){at=!0;for(const f of it)f.traverse(M=>{const D=M;D.geometry?.dispose();const S=D.material;if(Array.isArray(S))for(const j of S)j.dispose();else S?.dispose()}),f.removeFromParent();for(const f of c.values())try{f.dispose()}catch(M){console.error("[three-board] a story mount failed to dispose.",M)}c.clear(),T.clear()}}};if(P("assemble",Date.now()-_),lt({exhibitCount:C.length,skippedCount:p.length}),r?.aborted)throw ct.dispose(),new Error("The 3D board build was superseded by a newer one.");return ct}function an(t){return At(t,kt)}function cn(t){return At(t,Bt)}function At(t,e){let r=t;for(;r;){const n=r.userData[e];if(typeof n=="string")return n;r=r.parent}return null}const Nt="3D";let F=null,Lt=0;const J=new Set;function bt(){Lt++;for(const t of J)t()}function un(t){return J.add(t),()=>{J.delete(t)}}function dn(){return Lt}function Gt(t){return Number.isFinite(t)?t>=10?`${Math.round(t)} m`:t>=1?`${t.toFixed(1)} m`:`${t.toFixed(2)} m`:"—"}function ln(t,e,r){const n=Ft(e,r);return n?te(ee,t,{modulePath:n.modulePath,storyName:n.storyName,title:n.label}):null}function mn(t,e,r){const n=Sn(t,e);if(!n)return null;const s={definitionLocation:()=>({file:n.path,line:n.line})};return r?mt(s,n.key,"definition",r):mt(s,n.key,"definition")}function pn(t){const e=tt(),r=t.filter(o=>o.ok&&Q({modulePath:o.modulePath,regions:e}).medium==="three"),n=w.useRef([]),s=n.current;return(s.length!==r.length||s.some((o,i)=>o!==r[i]))&&(n.current=r),n.current}function hn({documentId:t,active:e,store:r}){const n=w.useSyncExternalStore(Mt,U),s=pn(n),[o,i]=w.useState({status:"idle"});e&&re(t);const[a,u]=w.useState(e);w.useEffect(()=>{e&&u(!0)},[e]),w.useEffect(()=>{if(!a)return;const p=new AbortController;let y=null;i({status:"building"}),se(t,{modulesAlreadyLoaded:s.length>0});const b=Date.now();return Et().then(x=>{const h=Date.now()-b;return P("component-index",h,{busyMs:0,waitMs:h}),x.ok||ie.warn(`Component index unavailable, so this board shows no ghost slots: ${x.reason}`,"three-board"),jt(s,x.ok?x.entries:[],p.signal)}).then(x=>{if(p.signal.aborted){X(t),q(x);return}y=x,F=x,bt(),ae(),i({status:"ready",scene:x})},x=>{if(p.signal.aborted){X(t);return}i({status:"error",message:x instanceof Error?x.message:String(x)})}),()=>{p.abort(),y?(F===y&&(F=null),q(y),bt()):X(t)}},[s,a,t]);const c=o.status==="ready"?o.scene:null,d=w.useCallback(()=>{if(!c)throw new Error("The 3D board is still building.");return{root:c.root,dispose(){}}},[c]),l=w.useCallback(p=>{if(ln(r,c,p)!==null)return;const y=mn(c,p);y&&y.then(ce)},[c,r]);return m.jsx("div",{style:{position:"relative",flex:1,minHeight:0,pointerEvents:"auto"},children:c?m.jsxs(m.Fragment,{children:[m.jsx(de,{documentId:t,sourcePath:"Generated from this project’s stories",displayName:Nt,build:d,active:e,onOpenNode:l,cameraDirection:le,frameBounds:c.frameBounds,openingFrameBounds:c.openingFrameBounds,dressing:{grid:!0}}),m.jsx(xn,{documentId:t,scene:c,active:e}),m.jsx(fn,{scene:c})]}):m.jsxs("div",{"data-testid":"three-board-status",style:{padding:16,fontSize:12,color:g.content.muted},children:[o.status==="error"&&o.message,o.status==="building"&&me(Je(s)),o.status==="idle"&&"Open this tab to lay out every story at true scale."]})})}function fn({scene:t}){const[e,r]=w.useState(!1),n=Ke(t.skipped),s=t.districts.filter(o=>o.groupKey!==I).length;return m.jsxs("div",{"data-testid":"three-board-status",style:{position:"absolute",left:8,bottom:8,maxWidth:420,padding:"4px 8px",borderRadius:g.shape.small,background:g.surface.raised,border:`1px solid ${g.boundary.default}`,fontSize:10,color:g.content.muted,pointerEvents:"auto"},children:[t.exhibits.length," exhibit",t.exhibits.length===1?"":"s"," · ",s," ","district",s===1?"":"s",t.helperVolumes.length>0&&m.jsxs(m.Fragment,{children:[" · ",t.helperVolumes.length," helper volume",t.helperVolumes.length===1?"":"s"," at true scale, outside the default frame"]}),t.ghostSlots.length>0&&m.jsxs(m.Fragment,{children:[" · ",t.ghostSlots.length," component",t.ghostSlots.length===1?"":"s"," without stories"]}),t.skipped.length>0&&m.jsxs(m.Fragment,{children:[" · ",m.jsxs("span",{role:"button",tabIndex:0,"aria-expanded":e,onClick:()=>r(o=>!o),onKeyDown:o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),r(i=>!i))},style:{cursor:"pointer",color:g.accent.default},children:[n.stories," ",n.stories===1?"story":"stories"," in ",n.modules," ",n.modules===1?"module":"modules"," not on this board"]})]}),e&&m.jsx("div",{style:{marginTop:4,maxHeight:160,overflow:"auto"},children:t.skipped.map(o=>m.jsxs("div",{style:{padding:"1px 0"},children:[m.jsxs("code",{style:{color:g.content.dim},children:[o.modulePath,"#",o.storyName]})," ","— ",o.reason]},o.id))})]})}function xn({documentId:t,scene:e,active:r}){const n=w.useRef(null),[s,o]=w.useState([]);return w.useEffect(()=>{if(!r)return;let i=0,a=!1;const u=gn(e),c=()=>{if(a)return;i=requestAnimationFrame(c);const d=n.current,l=ue(t);!d||!l||d.clientWidth===0||d.clientHeight===0||o(yn(u,l.camera(),d.clientWidth,d.clientHeight))};return i=requestAnimationFrame(c),()=>{a=!0,cancelAnimationFrame(i)}},[r,t,e]),m.jsx("div",{ref:n,"data-testid":"three-board-labels",style:{position:"absolute",inset:-12,pointerEvents:"none",overflow:"hidden"},children:s.map(i=>m.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y,transform:"translate(-50%, -100%)",whiteSpace:"nowrap",padding:i.district?"2px 7px":"1px 5px",borderRadius:g.shape.small,background:g.surface.raised,border:`1px ${i.ghost?"dashed":"solid"} ${i.district&&!i.ghost?g.accent.default:g.boundary.default}`,color:i.district&&!i.ghost?g.content.primary:g.content.muted,fontSize:i.district?12:10,fontWeight:i.district?600:400,opacity:i.ghost?.9:1},children:[i.text,m.jsx("span",{style:{marginLeft:6,color:g.content.dim,fontWeight:400},children:i.detail})]},i.key))})}const B=new O;function wt(t){return[t.anchor[0],0,t.anchor[2]-t.footprint[1]/2]}function gn(t){return[...t.districts.map(e=>{const r=e.groupKey===I,n=e.placement.items.length;return{key:`district:${e.groupKey}`,text:e.label,detail:r?`${n} component${n===1?"":"s"}`:`${n} exhibit${n===1?"":"s"}`,district:!0,ghost:r,point:e.placement.anchor}}),...t.exhibits.map(e=>({key:`exhibit:${e.id}`,text:e.label,detail:Gt(e.placement.size[1]),district:!1,ghost:!1,point:wt(e.placement)})),...t.ghostSlots.map(e=>({key:`ghost:${e.key}`,text:e.name,detail:"No story yet",district:!1,ghost:!0,point:wt(e.placement)}))]}function yn(t,e,r,n){e.updateMatrixWorld();const s=[];for(const o of t)B.set(o.point[0],o.point[1],o.point[2]).project(e),!(B.z>1)&&s.push({key:o.key,text:o.text,detail:o.detail,district:o.district,ghost:o.ghost,x:(B.x*.5+.5)*r,y:(-B.y*.5+.5)*n,depth:B.z});return wn(s).sort((o,i)=>i.depth-o.depth)}function bn(t){const e=t.district?12:10,r=(t.text.length+t.detail.length)*e*.62+24,n=e+8;return[t.x-r/2,t.y-n,t.x+r/2,t.y]}function wn(t){const e=[...t].sort((n,s)=>(s.district?1:0)-(n.district?1:0)||n.depth-s.depth),r=[];for(const n of e){const s=bn(n);r.some(i=>s[0]<i.rect[2]&&s[2]>i.rect[0]&&s[1]<i.rect[3]&&s[3]>i.rect[1])||r.push({label:n,rect:s})}return r.map(n=>n.label)}function Ft(t,e){if(!t)return null;const r=an(e);return r?t.exhibits.find(n=>n.id===r)??null:null}function Sn(t,e){if(!t)return null;const r=cn(e);return r?t.ghostSlots.find(n=>n.key===r)??null:null}function Mn({adapter:t,nodeId:e}){w.useSyncExternalStore(un,dn);const n=[...e?[e]:[],...t.selection?.get()??[]].reduce((s,o)=>s??Ft(F,t.hierarchy.object3D?.(o)??null),null);return m.jsx("div",{"data-testid":"inspector-exhibit",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${g.boundary.default}`},children:n?m.jsxs("div",{style:{display:"grid",gap:3,fontSize:11},children:[m.jsx("div",{style:{color:g.content.primary,fontWeight:600},children:n.label}),m.jsx(G,{label:"Story",value:n.storyName}),m.jsx(G,{label:"Group",value:n.groupPath}),m.jsx(G,{label:"Module",value:n.modulePath}),m.jsx(G,{label:"Size",value:n.placement.size.map(s=>Gt(s)).join(" × ")})]}):m.jsx("div",{style:{fontSize:11,color:g.content.dim},children:"Pick an exhibit to read its story."})})}function G({label:t,value:e}){return m.jsxs("div",{style:{display:"flex",gap:6},children:[m.jsx("span",{style:{width:52,flexShrink:0,color:g.content.muted},children:t}),m.jsx("code",{style:{color:g.content.primary,overflow:"hidden",textOverflow:"ellipsis"},title:e,children:e})]})}const En=ne();function vn(){En.ensure(t=>{t(Wt({match:()=>Jt()?.descriptor.id===Z,id:"exhibit",title:"Exhibit",icon:qt,order:Yt,Section:Mn}))})}const Dn={revision:()=>JSON.stringify(U().map(t=>t.modulePath)),subscribe:Mt,capture:async t=>{await oe();const e=tt(),r=U().filter(o=>o.ok&&Q({modulePath:o.modulePath,regions:e}).medium==="three"),n=await Et(),s=await jt(r,n.ok?n.entries:[]);try{const{captureAuthoredThreeScenePreview:o}=await N(async()=>{const{captureAuthoredThreeScenePreview:h}=await import("./document-preview-three-Kbg2GCLm.js");return{captureAuthoredThreeScenePreview:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),{createStandardEnvironment:i}=await N(async()=>{const{createStandardEnvironment:h}=await import("./index-GIL7oGEO.js").then(E=>E.tK);return{createStandardEnvironment:h}},__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11])),{applyStandardViewportDressing:a}=await N(async()=>{const{applyStandardViewportDressing:h}=await import("./standard-viewport-dressing-CzjAe_0A.js");return{applyStandardViewportDressing:h}},__vite__mapDeps([13,14,1,2,3,4,5,6,7,8,9,10,11])),{isEditorOwnedObject:u}=await N(async()=>{const{isEditorOwnedObject:h}=await import("./index-GIL7oGEO.js").then(E=>E.tL);return{isEditorOwnedObject:h}},__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11]));s.root.traverse(h=>{u(h)&&(h.visible=!1)});const c=new ve;c.add(s.root);const d=new De(new O(...s.frameBounds.min),new O(...s.frameBounds.max)),l=d.isEmpty()?new O:d.getCenter(new O),y=(d.isEmpty()?1:Math.max(.01,d.getBoundingSphere(new _e).radius))/Math.sin(Pe.degToRad(42/2))*1.15,b=l.clone().addScaledVector(new O(1,.75,1).normalize(),y),x={...t,camera:{position:b,target:l,fov:42}};return o(s.root,c,x,h=>{const E=a(c,{environment:i(h),background:!1});return()=>E.dispose()})}finally{await q(s)}}};function Zn(t){return vn(),Qt({id:Z,title:Nt,kind:"content-browser",workspaceRole:"workspace-reference",Content:e=>m.jsx(hn,{...e,store:t}),readOnly:!0,preview:Dn,presentation:()=>({kind:"workspace",id:Z}),onActivate:()=>t.setActiveViewportTab("edit")},{category:"canvas"})}export{Mn as BoardExhibitSection,Z as THREE_COMPONENTS_DOCUMENT_ID,vn as ensureThreeBoardContributionsRegistered,Zn as installThreeBoardDocument,ln as openExhibitStoryDocument,mn as openGhostComponentSource};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{ao as m,fd as g,aF as b}from"./index-GIL7oGEO.js";import{r as s}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{captureAuthoredThreeScenePreview as E}from"./document-preview-three-Kbg2GCLm.js";import{m as v}from"./mounted-story-viewport-source-DjP6RA9U.js";import{mountStoryObject3D as w,disposeStoryObject3D as x}from"./story-three-preview-BHEDZzcl.js";import{O as N}from"./Object3DDocumentViewport-DB7T0NTl.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-D396a9Mn.js";import"./scene-framing-Cat0GtyJ.js";import"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-ErOhDXXB.js";import"./index-bQE2NA0D.js";import"./story-mount-turn-DFRTj5hi.js";import"./viewport-surface-status-B3om4Kcf.js";async function P(t,n,e){const c=(await import(t))[e??"default"];if(typeof c!="function")throw new Error(`${n} does not export ${e===void 0?"a default component":`\`${e}\``}, which is what the adapter's scene table names. The table and the module disagree.`);return c}function L({active:t,documentId:n,state:e}){const[o,a]=s.useState(null),[c,p]=s.useState(null),u=s.useRef(null),[f,j]=s.useState(t);s.useEffect(()=>{t&&j(!0)},[t]);const d=e?.path,h=e?.exportName;return s.useEffect(()=>{if(!f||!d)return;let l=!1;return p(null),a(null),y(d,h).then(r=>w(r,{})).then(r=>{if(l){x(r);return}const S=v(r);u.current=S,a(S)}).catch(r=>{l||p(r instanceof Error?r.message:String(r))}),()=>{l=!0,u.current?.dispose(),u.current=null,a(null)}},[f,d,h]),e?c?i.jsxs("div",{role:"alert","data-testid":"scene-document-error",style:{padding:12,fontSize:12,color:m.semantic.danger,maxWidth:640},children:[i.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:[e.path,e.exportName?` — ${e.exportName}`:""]}),i.jsx("div",{style:{color:m.content.muted,whiteSpace:"pre-wrap"},children:c})]}):o?i.jsx(N,{documentId:n,sourcePath:e.path,build:o.build,displayName:e.label,active:t}):i.jsx("div",{"data-testid":"scene-document-loading",style:{padding:12,fontSize:12,color:m.content.muted,fontStyle:"italic"},children:"mounting…"}):i.jsx("div",{style:{padding:12,fontSize:12,color:m.content.muted},children:"This scene document is no longer declared by the project's adapter."})}async function y(t,n){const e=b();if(!e)throw new Error("No project is open, so its scene modules cannot be loaded.");const o=`${g(e.rootPath,t)}?t=${Date.now()}`;return P(o,t,n)}async function M(t,n){const e=await y(t.path,t.exportName),o=await w(e,{});try{return E(o.root,o.scene,n)}finally{await x(o)}}export{L as ThreeIsolationSceneContent,M as captureThreeIsolationScenePreview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DPreview as d}from"./Object3DPreview-DL8oi7Xs.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";import"./OrbitControls-CM3bPray.js";import"./editor-presentation-activity-C7SNSmTd.js";function F({build:r,displayName:e="Object3D preview",height:m=360,background:p,showSkeleton:s=!1,cameraDirection:n,showGrid:c,useDefaultLighting:u,exposure:a,setupPreview:t,active:j=!0}){const i=t!==void 0;return o.jsx("div",{style:{width:"100%",height:m,minHeight:240},children:o.jsx(d,{sourceFactory:r,displayName:e,active:j,showSkeleton:s,background:p,cameraDirection:n,showGrid:c??!i,useDefaultLighting:u??!i,exposure:a,setupPreview:t})})}export{F as ToolObject3DPreview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as O,m as r,V as o,g as n,Q as S,r as f}from"./three.module-D396a9Mn.js";const u={type:"change"},E={type:"start"},b={type:"end"},P=1e-6,s={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},p=new n,h=new n,M=new o,_=new o,y=new o,a=new S,w=new o,m=new o,g=new o,l=new o;class X extends O{constructor(t,i=null){super(t,i),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:r.ROTATE,MIDDLE:r.DOLLY,RIGHT:r.PAN},this.target=new o,this.state=s.NONE,this.keyState=s.NONE,this._lastPosition=new o,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new o,this._movePrev=new n,this._moveCurr=new n,this._lastAxis=new o,this._zoomStart=new n,this._zoomEnd=new n,this._panStart=new n,this._panEnd=new n,this._pointers=[],this._pointerPositions={},this._onPointerMove=j.bind(this),this._onPointerDown=C.bind(this),this._onPointerUp=T.bind(this),this._onPointerCancel=k.bind(this),this._onContextMenu=L.bind(this),this._onMouseWheel=N.bind(this),this._onKeyDown=z.bind(this),this._onKeyUp=D.bind(this),this._onTouchStart=U.bind(this),this._onTouchMove=R.bind(this),this._onTouchEnd=Y.bind(this),this._onMouseDown=A.bind(this),this._onMouseMove=x.bind(this),this._onMouseUp=Z.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,i!==null&&(this.connect(i),this.handleResize()),this.update()}connect(t){super.connect(t),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}handleResize(){const t=this.domElement.getBoundingClientRect(),i=this.domElement.ownerDocument.documentElement;this.screen.left=t.left+window.pageXOffset-i.clientLeft,this.screen.top=t.top+window.pageYOffset-i.clientTop,this.screen.width=t.width,this.screen.height=t.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>P&&(this.dispatchEvent(u),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>P||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(u),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=s.NONE,this.keyState=s.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(u),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(h.copy(this._panEnd).sub(this._panStart),h.lengthSq()){if(this.object.isOrthographicCamera){const t=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,i=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;h.x*=t,h.y*=i}h.multiplyScalar(this._eye.length()*this.panSpeed),_.copy(this._eye).cross(this.object.up).setLength(h.x),_.add(M.copy(this.object.up).setLength(h.y)),this.object.position.add(_),this.target.add(_),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(h.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){l.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let t=l.length();t?(this._eye.copy(this.object.position).sub(this.target),w.copy(this._eye).normalize(),m.copy(this.object.up).normalize(),g.crossVectors(m,w).normalize(),m.setLength(this._moveCurr.y-this._movePrev.y),g.setLength(this._moveCurr.x-this._movePrev.x),l.copy(m.add(g)),y.crossVectors(l,this._eye).normalize(),t*=this.rotateSpeed,a.setFromAxisAngle(y,t),this._eye.applyQuaternion(a),this.object.up.applyQuaternion(a),this._lastAxis.copy(y),this._lastAngle=t):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),a.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(a),this.object.up.applyQuaternion(a)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let t;this.state===s.TOUCH_ZOOM_PAN?(t=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(t):this.object.isOrthographicCamera?(this.object.zoom=f.clamp(this.object.zoom/t,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(t=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,t!==1&&t>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(t):this.object.isOrthographicCamera?(this.object.zoom=f.clamp(this.object.zoom/t,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(t,i){return p.set((t-this.screen.left)/this.screen.width,(i-this.screen.top)/this.screen.height),p}_getMouseOnCircle(t,i){return p.set((t-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-i))/this.screen.width),p}_addPointer(t){this._pointers.push(t)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let i=0;i<this._pointers.length;i++)if(this._pointers[i].pointerId==t.pointerId){this._pointers.splice(i,1);return}}_trackPointer(t){let i=this._pointerPositions[t.pointerId];i===void 0&&(i=new n,this._pointerPositions[t.pointerId]=i),i.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const i=t.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[i.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}}function C(e){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),this._addPointer(e),e.pointerType==="touch"?this._onTouchStart(e):this._onMouseDown(e))}function j(e){this.enabled!==!1&&(e.pointerType==="touch"?this._onTouchMove(e):this._onMouseMove(e))}function T(e){this.enabled!==!1&&(e.pointerType==="touch"?this._onTouchEnd(e):this._onMouseUp(),this._removePointer(e),this._pointers.length===0&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp)))}function k(e){this._removePointer(e)}function D(){this.enabled!==!1&&(this.keyState=s.NONE,window.addEventListener("keydown",this._onKeyDown))}function z(e){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===s.NONE&&(e.code===this.keys[s.ROTATE]&&!this.noRotate?this.keyState=s.ROTATE:e.code===this.keys[s.ZOOM]&&!this.noZoom?this.keyState=s.ZOOM:e.code===this.keys[s.PAN]&&!this.noPan&&(this.keyState=s.PAN)))}function A(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case r.DOLLY:this.state=s.ZOOM;break;case r.ROTATE:this.state=s.ROTATE;break;case r.PAN:this.state=s.PAN;break;default:this.state=s.NONE}const i=this.keyState!==s.NONE?this.keyState:this.state;i===s.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY)),this._movePrev.copy(this._moveCurr)):i===s.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(e.pageX,e.pageY)),this._zoomEnd.copy(this._zoomStart)):i===s.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(e.pageX,e.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(E)}function x(e){const t=this.keyState!==s.NONE?this.keyState:this.state;t===s.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY))):t===s.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(e.pageX,e.pageY)):t===s.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(e.pageX,e.pageY))}function Z(){this.state=s.NONE,this.dispatchEvent(b)}function N(e){if(this.enabled!==!1&&this.noZoom!==!0){switch(e.preventDefault(),e.deltaMode){case 2:this._zoomStart.y-=e.deltaY*.025;break;case 1:this._zoomStart.y-=e.deltaY*.01;break;default:this._zoomStart.y-=e.deltaY*25e-5;break}this.dispatchEvent(E),this.dispatchEvent(b)}}function L(e){this.enabled!==!1&&e.preventDefault()}function U(e){switch(this._trackPointer(e),this._pointers.length){case 1:this.state=s.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);break;default:this.state=s.TOUCH_ZOOM_PAN;const t=this._pointers[0].pageX-this._pointers[1].pageX,i=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(t*t+i*i);const c=(this._pointers[0].pageX+this._pointers[1].pageX)/2,d=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(c,d)),this._panEnd.copy(this._panStart);break}this.dispatchEvent(E)}function R(e){switch(this._trackPointer(e),this._pointers.length){case 1:this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY));break;default:const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,c=e.pageY-t.y;this._touchZoomDistanceEnd=Math.sqrt(i*i+c*c);const d=(e.pageX+t.x)/2,v=(e.pageY+t.y)/2;this._panEnd.copy(this._getMouseOnScreen(d,v));break}}function Y(e){switch(this._pointers.length){case 0:this.state=s.NONE;break;case 1:this.state=s.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=s.TOUCH_ZOOM_PAN;for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId!==e.pointerId){const i=this._pointerPositions[this._pointers[t].pointerId];this._moveCurr.copy(this._getMouseOnCircle(i.x,i.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(b)}export{X as TrackballControls};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./jsx-runtime-DPjLkJKQ.js";import{r as s}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{bB as i,bC as n,bD as o,ao as t,bE as r}from"./index-GIL7oGEO.js";function u(){const e=s.useSyncExternalStore(i,n,n);return e?a.jsx("div",{role:"status","aria-live":"polite","data-testid":"transient-hint",style:{position:"absolute",left:"50%",bottom:r[6],transform:"translateX(-50%)",maxWidth:"min(440px, 80%)",padding:`${r[3]}px ${r[5]}px`,borderRadius:t.shape.medium,border:`1px solid ${t.boundary.strong}`,background:t.surface.overlay,color:t.content.primary,fontSize:"var(--vgai-font-base)",lineHeight:1.4,textAlign:"center",pointerEvents:"none",zIndex:o.toast},children:e.message},e.id):null}export{u as T};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import{C as T,g as u,a4 as d,K as p,U as x,h as f,V as h,b7 as M,z as C}from"./three.module-D396a9Mn.js";import{X as S,Y as U}from"./index-GIL7oGEO.js";import{C as g}from"./CopyShader-BzTUYzf6.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const _={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new T(0)},defaultOpacity:{value:0}},vertexShader:`
|
|
2
|
+
|
|
3
|
+
varying vec2 vUv;
|
|
4
|
+
|
|
5
|
+
void main() {
|
|
6
|
+
|
|
7
|
+
vUv = uv;
|
|
8
|
+
|
|
9
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
10
|
+
|
|
11
|
+
}`,fragmentShader:`
|
|
12
|
+
|
|
13
|
+
uniform sampler2D tDiffuse;
|
|
14
|
+
uniform vec3 defaultColor;
|
|
15
|
+
uniform float defaultOpacity;
|
|
16
|
+
uniform float luminosityThreshold;
|
|
17
|
+
uniform float smoothWidth;
|
|
18
|
+
|
|
19
|
+
varying vec2 vUv;
|
|
20
|
+
|
|
21
|
+
void main() {
|
|
22
|
+
|
|
23
|
+
vec4 texel = texture2D( tDiffuse, vUv );
|
|
24
|
+
|
|
25
|
+
float v = luminance( texel.xyz );
|
|
26
|
+
|
|
27
|
+
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
|
|
28
|
+
|
|
29
|
+
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
|
|
30
|
+
|
|
31
|
+
gl_FragColor = mix( outputColor, texel, alpha );
|
|
32
|
+
|
|
33
|
+
}`};class m extends S{constructor(e,l=1,r,s){super(),this.strength=l,this.radius=r,this.threshold=s,this.resolution=e!==void 0?new u(e.x,e.y):new u(256,256),this.clearColor=new T(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let t=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new d(t,o,{type:p}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let a=0;a<this.nMips;a++){const c=new d(t,o,{type:p});c.texture.name="UnrealBloomPass.h"+a,c.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(c);const v=new d(t,o,{type:p});v.texture.name="UnrealBloomPass.v"+a,v.texture.generateMipmaps=!1,this.renderTargetsVertical.push(v),t=Math.round(t/2),o=Math.round(o/2)}const n=_;this.highPassUniforms=x.clone(n.uniforms),this.highPassUniforms.luminosityThreshold.value=s,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new f({uniforms:this.highPassUniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),this.separableBlurMaterials=[];const i=[3,5,7,9,11];t=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);for(let a=0;a<this.nMips;a++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(i[a])),this.separableBlurMaterials[a].uniforms.invSize.value=new u(1/t,1/o),t=Math.round(t/2),o=Math.round(o/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=l,this.compositeMaterial.uniforms.bloomRadius.value=.1;const b=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=b,this.bloomTintColors=[new h(1,1,1),new h(1,1,1),new h(1,1,1),new h(1,1,1),new h(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=x.clone(g.uniforms),this.blendMaterial=new f({uniforms:this.copyUniforms,vertexShader:g.vertexShader,fragmentShader:g.fragmentShader,blending:M,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new T,this._oldClearAlpha=1,this._basic=new C,this._fsQuad=new U(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(e,l){let r=Math.round(e/2),s=Math.round(l/2);this.renderTargetBright.setSize(r,s);for(let t=0;t<this.nMips;t++)this.renderTargetsHorizontal[t].setSize(r,s),this.renderTargetsVertical[t].setSize(r,s),this.separableBlurMaterials[t].uniforms.invSize.value=new u(1/r,1/s),r=Math.round(r/2),s=Math.round(s/2)}render(e,l,r,s,t){e.getClearColor(this._oldClearColor),this._oldClearAlpha=e.getClearAlpha();const o=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),t&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this._fsQuad.material=this._basic,this._basic.map=r.texture,e.setRenderTarget(null),e.clear(),this._fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this._fsQuad.render(e);let n=this.renderTargetBright;for(let i=0;i<this.nMips;i++)this._fsQuad.material=this.separableBlurMaterials[i],this.separableBlurMaterials[i].uniforms.colorTexture.value=n.texture,this.separableBlurMaterials[i].uniforms.direction.value=m.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[i]),e.clear(),this._fsQuad.render(e),this.separableBlurMaterials[i].uniforms.colorTexture.value=this.renderTargetsHorizontal[i].texture,this.separableBlurMaterials[i].uniforms.direction.value=m.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[i]),e.clear(),this._fsQuad.render(e),n=this.renderTargetsVertical[i];this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this._fsQuad.render(e),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,t&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(r),this._fsQuad.render(e)),e.setClearColor(this._oldClearColor,this._oldClearAlpha),e.autoClear=o}_getSeparableBlurMaterial(e){const l=[];for(let r=0;r<e;r++)l.push(.39894*Math.exp(-.5*r*r/(e*e))/e);return new f({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new u(.5,.5)},direction:{value:new u(.5,.5)},gaussianCoefficients:{value:l}},vertexShader:`varying vec2 vUv;
|
|
34
|
+
void main() {
|
|
35
|
+
vUv = uv;
|
|
36
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
37
|
+
}`,fragmentShader:`#include <common>
|
|
38
|
+
varying vec2 vUv;
|
|
39
|
+
uniform sampler2D colorTexture;
|
|
40
|
+
uniform vec2 invSize;
|
|
41
|
+
uniform vec2 direction;
|
|
42
|
+
uniform float gaussianCoefficients[KERNEL_RADIUS];
|
|
43
|
+
|
|
44
|
+
void main() {
|
|
45
|
+
float weightSum = gaussianCoefficients[0];
|
|
46
|
+
vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
|
|
47
|
+
for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
|
|
48
|
+
float x = float(i);
|
|
49
|
+
float w = gaussianCoefficients[i];
|
|
50
|
+
vec2 uvOffset = direction * invSize * x;
|
|
51
|
+
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
|
|
52
|
+
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
|
|
53
|
+
diffuseSum += (sample1 + sample2) * w;
|
|
54
|
+
weightSum += 2.0 * w;
|
|
55
|
+
}
|
|
56
|
+
gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
|
|
57
|
+
}`})}_getCompositeMaterial(e){return new f({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
|
|
58
|
+
void main() {
|
|
59
|
+
vUv = uv;
|
|
60
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
61
|
+
}`,fragmentShader:`varying vec2 vUv;
|
|
62
|
+
uniform sampler2D blurTexture1;
|
|
63
|
+
uniform sampler2D blurTexture2;
|
|
64
|
+
uniform sampler2D blurTexture3;
|
|
65
|
+
uniform sampler2D blurTexture4;
|
|
66
|
+
uniform sampler2D blurTexture5;
|
|
67
|
+
uniform float bloomStrength;
|
|
68
|
+
uniform float bloomRadius;
|
|
69
|
+
uniform float bloomFactors[NUM_MIPS];
|
|
70
|
+
uniform vec3 bloomTintColors[NUM_MIPS];
|
|
71
|
+
|
|
72
|
+
float lerpBloomFactor(const in float factor) {
|
|
73
|
+
float mirrorFactor = 1.2 - factor;
|
|
74
|
+
return mix(factor, mirrorFactor, bloomRadius);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void main() {
|
|
78
|
+
gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
|
|
79
|
+
lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
|
|
80
|
+
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
|
|
81
|
+
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
|
|
82
|
+
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
|
|
83
|
+
}`})}}m.BlurDirectionX=new u(1,0);m.BlurDirectionY=new u(0,1);export{m as UnrealBloomPass};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{a9 as c,bg as x}from"./index-GIL7oGEO.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";function W({assetPath:s}){const[p,a]=r.useState(!1),[d,m]=r.useState(null),i=s;r.useEffect(()=>{a(!1)},[i]);const n=s.split("/").pop()??s,l=r.useCallback(e=>{if(e){if(e.error){a(!0);return}e.videoWidth<=0||m(o=>o&&o.w===e.videoWidth&&o.h===e.videoHeight?o:{w:e.videoWidth,h:e.videoHeight})}},[]);return t.jsxs("div",{"data-testid":"video-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[t.jsx(c,{tone:"dim",variant:"label",children:n}),d&&t.jsxs(c,{tone:"muted",variant:"code",children:[d.w," × ",d.h]})]}),t.jsx("div",{className:"vgai-asset-transparency-well",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",padding:12},children:p?t.jsxs("div",{style:{color:x[2],fontSize:12,textAlign:"center"},children:[n," could not be played from ",i,". The file may be missing, or its codec may not be one this browser decodes."]}):t.jsx("video",{src:i,controls:!0,playsInline:!0,preload:"metadata",ref:l,onError:()=>a(!0),onLoadedMetadata:e=>l(e.currentTarget),style:{maxWidth:"100%",maxHeight:"100%",display:"block"}},i)})]})}export{W as VideoViewer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var t=function o(){return this instanceof o?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}),t}export{l as a,u as c,f as g};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/game-css-scope-transform-Eng4wS8E.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-GIL7oGEO.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/three.module-D396a9Mn.js","assets/index-D2fNXpHa.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as oe,l9 as Fe,mb as He,mc as De,V as P,md as ze,j1 as je,me as Ne,ad as pe,kw as We,bX as B,bY as O,bZ as q,c0 as Be}from"./index-GIL7oGEO.js";import{GAME_SCENES_SHAPE as Oe}from"./game-contract-seams-a5YXejOu.js";import{g as qe,c as Ve,d as Ue,e as Ke,S as Ye}from"./capability-coverage-Czas4C18.js";import{i as Qe,b as Je,l as Xe}from"./ingest-source-persistence-C_6Hiyra.js";import{p as Ze}from"./playtest-BXIL1JEF.js";const rn="contain: layout;";function ae(e){return typeof e=="boolean"?e:e?.capture??!1}const ie="vgaiScopedCss";let ce=null;function et(){return ce??=Promise.all([oe(()=>import("./game-css-scope-transform-Eng4wS8E.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),oe(()=>import("./index-GIL7oGEO.js").then(e=>e.tW),__vite__mapDeps([2,3,1,4,5,6,7,8,9,10,11]))]).then(([{scopeGameCss:e},{GAME_CSS_SCOPE_SELECTOR:t}])=>n=>e({css:n,scopeSelector:t,styleSheetPath:"/"})),ce}function tt(e){let t=null;const n=()=>et().then(i=>{t=i}),s=i=>{const g=i.textContent??"";if(g.length===0||i.dataset[ie]===g)return;if(!t){const y=g;i.textContent="",n().then(()=>{i.isConnected&&(i.textContent??"")===""&&(i.textContent=y,s(i))});return}let h;try{h=t(g)}catch{i.textContent="";return}i.dataset[ie]=h,i.textContent=h},a=i=>{if(i instanceof HTMLStyleElement)return i;const g=i.parentElement;return g instanceof HTMLStyleElement?g:null},u=new MutationObserver(i=>{const g=new Set;for(const h of i)if(h.type==="childList")for(const y of h.addedNodes){const w=a(y);if(w)g.add(w);else if(y instanceof Element)for(const d of y.querySelectorAll("style"))g.add(d)}else if(h.type==="characterData"){const y=a(h.target);y&&g.add(y)}for(const h of g)h.isConnected&&s(h)});u.observe(e,{childList:!0,subtree:!0,characterData:!0});for(const i of e.querySelectorAll("style"))s(i);return u}class nt{surfaceElement=null;injectedStyles=null;get surface(){return this.surfaceElement}set surface(t){this.injectedStyles?.disconnect(),this.injectedStyles=null,this.surfaceElement=t,t&&(this.injectedStyles=tt(t))}pageTitle="";executingClassicScript=null;headElement=null;resizeBus=new EventTarget;resizeListeners=new Map;addResizeListener(t,n){let s=this.resizeListeners.get(t);s||(s=new Set,this.resizeListeners.set(t,s)),s.add(ae(n)),this.resizeBus.addEventListener("resize",t,n)}removeResizeListener(t,n){const s=this.resizeListeners.get(t);s&&(s.delete(ae(n)),s.size===0&&this.resizeListeners.delete(t)),this.resizeBus.removeEventListener("resize",t,n)}get gameResizesItself(){return this.resizeListeners.size>0}reset(){this.headElement?.remove(),this.headElement=null,this.pageTitle="",this.executingClassicScript=null,this.surface=null,this.resizeListeners.clear(),this.resizeBus=new EventTarget}dispatchResize(){this.resizeBus.dispatchEvent(new Event("resize"))}viewport(){const t=this.surface;return t?{width:t.clientWidth,height:t.clientHeight}:null}get title(){return this.pageTitle}set title(t){this.pageTitle=String(t)}get currentScript(){return this.executingClassicScript}withCurrentScript(t,n){const s=this.executingClassicScript,a=document.createElement("script");a.src=t,this.executingClassicScript=a;try{return n()}finally{this.executingClassicScript=s}}head(){const t=this.surface;if(!t)return null;if(!this.headElement||this.headElement.parentElement!==t){const n=document.createElement("div");n.dataset.vgaiGameHead="",n.hidden=!0,t.prepend(n),this.headElement=n}return this.headElement}}function rt(e){const t=`(__vgaiHost.__vgaiGameRealm?__vgaiHost.__vgaiGameRealm(${JSON.stringify("")}):null)`;return st.replace("__VGAI_REALM__",t)}const st=`const __vgaiHost=({}).constructor.constructor('return globalThis')(),__vgaiR=__VGAI_REALM__,__vgaiGlobal=((__vgaiR&&__vgaiR.globalThis)||__vgaiHost.__vgaiGameWindow||__vgaiHost),globalThis=__vgaiGlobal,__vgaiSched=((__vgaiR&&__vgaiR.timers)||__vgaiHost.__vgaiGameTimers||__vgaiHost),__vgaiBind=function(n){var f=__vgaiSched[n];return typeof f==='function'?f.bind(__vgaiSched):f;},console=((__vgaiR&&__vgaiR.console)||__vgaiHost.__vgaiGameConsole||__vgaiHost.console),window=((__vgaiR&&__vgaiR.window)||__vgaiHost.__vgaiGameWindow||__vgaiGlobal.window),document=((__vgaiR&&__vgaiR.document)||__vgaiHost.__vgaiGameDocument||__vgaiGlobal.document),__vgaiWindowBind=function(n){var f=window&&window[n];return typeof f==='function'?f.bind(window):f;},localStorage=(window&&window.localStorage),sessionStorage=(window&&window.sessionStorage),location=(window&&window.location),addEventListener=__vgaiWindowBind('addEventListener'),removeEventListener=__vgaiWindowBind('removeEventListener'),dispatchEvent=__vgaiWindowBind('dispatchEvent'),fetch=function(){var f=__vgaiHost.__vgaiProjectFetch;return f?f.apply(null,arguments):__vgaiHost.fetch.apply(__vgaiHost,arguments)},setTimeout=__vgaiBind('setTimeout'),clearTimeout=__vgaiBind('clearTimeout'),setInterval=__vgaiBind('setInterval'),clearInterval=__vgaiBind('clearInterval'),requestAnimationFrame=__vgaiBind('requestAnimationFrame'),cancelAnimationFrame=__vgaiBind('cancelAnimationFrame');
|
|
3
|
+
`,sn=rt(),ot=new Set(["href","protocol","host","hostname","port","pathname","search"]),at=new Set(["assign","replace","reload"]),it=new Set(["play","project","hub","scene","ingest","create-from","checkout_id"]);function ct(e){return it.has(e)||e.startsWith("vgai")}function _e(e){const t=e.startsWith("?")?e.slice(1):e;if(!t)return"";const n=new URLSearchParams;for(const[a,u]of new URLSearchParams(t))ct(a)||n.append(a,u);const s=n.toString();return s.length>0?`?${s}`:""}function lt(e){try{const t=new URL(e);return t.search=_e(t.search),t.href}catch{return e}}function ut(e,t,n){const s=Object.create(null);return new Proxy(s,{get(a,u){if(typeof u=="string"&&at.has(u))return(...g)=>{u==="reload"&&n?.reloadGame?.()||t(`location.${u}(${g.map(h=>String(h)).join(", ")})`)};if(u==="search")return _e(String(Reflect.get(e,"search")??""));if(u==="href")return lt(String(Reflect.get(e,"href")??""));const i=Reflect.get(e,u);return typeof i=="function"?i.bind(e):i},set(a,u,i){return typeof u=="string"&&ot.has(u)?(t(`location.${u} = ${String(i)}`),!0):Reflect.set(e,u,i)},has(a,u){return Reflect.has(e,u)}})}function dt(e){return`Ingested game attempted to navigate the editor away (${e}) — refused. A game running in-realm shares the editor's document, so leaving it would take the whole session with it; game code sees a scoped \`location\` facade whose reads pass through and whose navigating writes do not (packages/editor/src/game-location-guard.ts).`}function ft(e){let t=0,n=0;const s=Object.create(Object.getPrototypeOf(e)),a=w=>(t+=1,e.getItem(String(w))),u=(w,d)=>{n+=1,e.setItem(String(w),String(d))},i=w=>{n+=1,e.removeItem(String(w))},g=()=>{n+=1,e.clear()},h=w=>(t+=1,e.key(Number(w)));return{storage:new Proxy(s,{get(w,d){return d==="length"?(t+=1,e.length):d==="getItem"?a:d==="setItem"?u:d==="removeItem"?i:d==="clear"?g:d==="key"?h:d===Symbol.toStringTag?"Storage":typeof d=="string"?a(d)??void 0:Reflect.get(s,d,s)},set(w,d,p){return typeof d!="string"?Reflect.set(s,d,p,s):(u(d,String(p)),!0)},deleteProperty(w,d){return typeof d!="string"?Reflect.deleteProperty(s,d):(i(d),!0)},defineProperty(w,d,p){return typeof d!="string"||!("value"in p)?!1:(u(d,String(p.value)),!0)},has(w,d){return typeof d!="string"?Reflect.has(s,d):d in s?!0:a(d)!==null},ownKeys(){const w=[];for(let d=0;d<e.length;d+=1){const p=e.key(d);p!==null&&w.push(p)}return w},getOwnPropertyDescriptor(w,d){if(typeof d!="string")return;const p=e.getItem(d);return p===null?void 0:{configurable:!0,enumerable:!0,value:p,writable:!0}}}),stats:()=>({reads:t,writes:n})}}function mt(e){return!e||e.loop!=="gated"&&e.loop!=="self-driven"?null:{verdict:e.loop,evidence:e.evidence}}function gt(e){let t="open",n=0,s=0,a=0,u=0,i=0,g=0,h=0,y=0,w=!1;const d=[],p=new Set,I=new Set,T=new Set,S=new Map,L=()=>(t==="held"?h:e.now())-y,l=m=>{a++,t==="held"&&u++;try{m.run()}catch(_){e.setTimeout(()=>{throw _},0)}},f=()=>{const m=d.splice(0,d.length);S.clear();for(const _ of m)l(_)},o=m=>{d.push(m)},r=m=>()=>{if(t==="held"){o(m);return}l(m)},c=()=>{t!=="held"&&(h=e.now(),t="held")},v=()=>{t==="held"&&(y+=e.now()-h)};return{schedulers:{setTimeout(m,_,...E){if(s++,w)return-1;const R={run:()=>m(...E)};let A=-1;const C=r(R);return A=e.setTimeout(()=>{p.delete(A),C()},_),p.add(A),R.timerId=A,A},clearTimeout(m){e.clearTimeout(m),p.delete(m);const _=d.findIndex(E=>E.timerId===m);_!==-1&&d.splice(_,1)},setInterval(m,_,...E){if(s++,w)return-1;let R=-1;const A=()=>{const C={run:()=>m(...E)};if(t==="held"){const re=S.get(R);if(re){const se=d.indexOf(re);se!==-1&&d.splice(se,1)}S.set(R,C),o(C);return}l(C)};return R=e.setInterval(A,_),I.add(R),R},clearInterval(m){e.clearInterval(m),I.delete(m);const _=S.get(m);if(_){S.delete(m);const E=d.indexOf(_);E!==-1&&d.splice(E,1)}},requestAnimationFrame(m){if(s++,w)return-1;const _={run:()=>m(L())};let E=-1;const R=r(_);return E=e.requestAnimationFrame(()=>{T.delete(E),R()}),T.add(E),_.frameId=E,E},cancelAnimationFrame(m){e.cancelAnimationFrame(m),T.delete(m);const _=d.findIndex(E=>E.frameId===m);_!==-1&&d.splice(_,1)}},hold:c,release(){w||(v(),t="open",f())},step(m=1){if(!w){for(v(),n=m>0?m:1,t="step";n>0&&d.length>0;)n--,f();t="held",h=e.now()}},stats(){return{mode:t,pending:d.length,requests:s,fired:a,firedWhileHeld:u,activeTimeouts:p.size,activeIntervals:I.size,activeAnimationFrames:T.size,input:i,inputBlocked:g}},recordInput(m){i++,m&&g++},dispose(){if(w)return{timeouts:0,intervals:0,animationFrames:0,parkedCallbacks:0};w=!0;const m={timeouts:p.size,intervals:I.size,animationFrames:T.size,parkedCallbacks:d.length};for(const _ of p)e.clearTimeout(_);for(const _ of I)e.clearInterval(_);for(const _ of T)e.cancelAnimationFrame(_);return p.clear(),I.clear(),T.clear(),d.length=0,S.clear(),n=0,t="held",h=e.now(),m}}}async function on(e){const t=e.windowMs??1500,n=Math.max(1,Math.min(e.sampleMs??50,t)),s=e.sleep??(I=>new Promise(T=>setTimeout(T,I))),a=e.gate;if(!a)return{loop:"self-driven",reason:"no same-realm loop gate is installed, so nothing here controls this game’s scheduling",evidence:{pendingWhileHeld:0,firedWhileHeld:0,progressBefore:0,progressAfter:0,windowMs:t}};const u=a.stats(),i=e.progress();let g=u,h=i,y=u.pending,w=u.mode==="held";for(let I=0;I<t;I+=n)if(await s(Math.min(n,t-I)),g=a.stats(),h=e.progress(),y=Math.max(y,g.pending),g.mode!=="held"){w=!1;break}const d=g.firedWhileHeld-u.firedWhileHeld,p={pendingWhileHeld:y,firedWhileHeld:d,progressBefore:i,progressAfter:h,windowMs:t};return!w||g.mode!=="held"?{loop:"unmeasured",reason:"the gate was not held for the whole probe window — something else released it, so control was not measured",evidence:p}:d>0?{loop:"self-driven",reason:`${d} gated callback(s) ran while the gate was held — the gate leaked, so it cannot claim control`,evidence:p}:h>i?{loop:"self-driven",reason:`the game kept rendering while its scheduling was withheld (frame ${i} → ${h} in ${t}ms) — something outside this gate drives its loop`,evidence:p}:y===0?{loop:"unmeasured",reason:"nothing was due while the gate was held, so it withheld nothing and the probe learned nothing about this loop — note a hidden or backgrounded tab schedules no frames at all, which is a fact about the TAB, never about the game",evidence:p}:{loop:"gated",reason:`verified: ${y} scheduled callback(s) withheld, none ran, and no frame advanced in ${t}ms of held time`,evidence:p}}let V=null;function ht(){return V}const j=new Set(["keydown","keyup","keypress","mousedown","mouseup","mousemove","click","dblclick","contextmenu","wheel","pointerdown","pointerup","pointermove","pointercancel","touchstart","touchmove","touchend","touchcancel"]);function Se(e){const t=new Set,n=new WeakSet,s=((a,u)=>{const i=vt(a,u),g=yt(a,u);if(e()){for(const y of i)t.add(y);for(const y of g)t.delete(y);return!1}if(n.has(u))return!1;let h=!1;for(const y of g)t.delete(y)&&(h=!0);return h&&n.add(u),!h});return s.outstandingReleases=()=>{const a=[];for(const u of t){const i=u.indexOf(":"),g=u.slice(0,i),h=u.slice(i+1);g==="key"?a.push(new KeyboardEvent("keyup",{code:h,key:wt(h),bubbles:!0})):g==="mouse"?a.push(new MouseEvent("mouseup",{button:Number(h),bubbles:!0})):g==="pointer"&&typeof PointerEvent=="function"&&a.push(new PointerEvent("pointerup",{pointerId:Number(h),bubbles:!0}))}return a},s}function wt(e){const t=/^Key([A-Z])$/.exec(e);if(t)return t[1].toLowerCase();const n=/^Digit(\d)$/.exec(e);return n?n[1]:e==="Space"?" ":e}function be(e){const t=e.changedTouches;return t?Array.from(t,n=>`touch:${n.identifier}`):["touch"]}function vt(e,t){switch(e){case"keydown":return[`key:${t.code}`];case"mousedown":return[`mouse:${t.button}`];case"pointerdown":return[`pointer:${t.pointerId}`];case"touchstart":return be(t);default:return[]}}function yt(e,t){switch(e){case"keyup":return[`key:${t.code}`];case"mouseup":return[`mouse:${t.button}`];case"pointerup":case"pointercancel":return[`pointer:${t.pointerId}`];case"touchend":case"touchcancel":return be(t);default:return[]}}const Ee=new Set(["setTimeout","clearTimeout","setInterval","clearInterval","requestAnimationFrame","cancelAnimationFrame"]);function Re(e,t){return typeof e!="function"||Object.hasOwn(e,"prototype")?e:e.bind(t)}const k="",F=new Map,U=new Map,H=new Map,le=new WeakMap;function K(e){let t=H.get(e);return t||(t=new nt,H.set(e,t)),t}function an(e,t=k){const n=K(t);return n.surface=e,n}function cn(e=k){H.get(e)?.reset()}function ln(e=k){return K(e)}function un(){const e=[];for(const[t,n]of H)n.surface&&e.push({surface:n.surface,gate:Ie(t)});return e}function Ie(e){return()=>Fe()&&(U.get(e)??(()=>!0))()}function pt(e,t){const n=Ie(e);return()=>t.alive&&n()}const M=[];function _t(){return M[M.length-1]??null}De(_t);function $(e,t){M.push(e);try{return t()}finally{M.pop()}}function St(e,t){return{setTimeout(n,s,...a){return t.setTimeout((...u)=>$(e,()=>n(...u)),s,...a)},clearTimeout:n=>t.clearTimeout(n),setInterval(n,s,...a){return t.setInterval((...u)=>$(e,()=>n(...u)),s,...a)},clearInterval:n=>t.clearInterval(n),requestAnimationFrame(n){return t.requestAnimationFrame(s=>$(e,()=>n(s)))},cancelAnimationFrame:n=>t.cancelAnimationFrame(n)}}function bt(e){const t=new Map;return new Proxy(console,{get(n,s){const a=Reflect.get(n,s,n);if(typeof a!="function")return a;let u=t.get(s);return u||(u=(...i)=>$(e,()=>a.apply(n,i)),t.set(s,u)),u}})}function ue(e){let t=!1,n=null;return()=>{if(t)return n;t=!0;try{n=ft(window[e])}catch{n=null}return n}}let Te=null;function Et(e){Te=e}let Pe=null;function Rt(e){const t={alive:!0},n=new Map,s=pt(e,t),a=gt({setTimeout:(S,L)=>window.setTimeout(S,L),clearTimeout:S=>window.clearTimeout(S),setInterval:(S,L)=>window.setInterval(S,L),clearInterval:S=>window.clearInterval(S),requestAnimationFrame:S=>window.requestAnimationFrame(S),cancelAnimationFrame:S=>window.cancelAnimationFrame(S),now:()=>performance.now()}),u=new WeakSet,i=(S,L)=>{u.has(S)||(u.add(S),a.recordInput?.(L))};e===k&&(Pe=a);const g=K(e),h=St(e,a.schedulers),y=ue("localStorage"),w=ue("sessionStorage");let d,p;const I=me(de(window,()=>!0,{page:g,role:"window"}),s,{execute:S=>$(e,S),realmId:e,recordInput:i,role:"window",schedulers:h,self:()=>d,document:()=>p,localStorage:y,sessionStorage:w,isolateExpandos:!0});d=I.proxy;const T=me(de(document,()=>!0,{page:g,role:"document"}),s,{execute:S=>$(e,S),realmId:e,recordInput:i,role:"document",self:()=>d});return p=T.proxy,{moduleUrls:n,live:t,loop:a,document:T,localStorage:y,sessionStorage:w,window:I,public:{recordModuleUrl(S){t.alive&&n.set(new URL(S).pathname,S)},console:bt(e),document:p,globalThis:d,timers:h,window:d}}}function Y(e=k){let t=F.get(e);return t||(t=Rt(e),F.set(e,t)),t.public}function It(e){return[...F.get(e)?.moduleUrls.values()??[]]}function dn(e){const t=F.get(e);if(!t)return null;const n={reads:0,writes:0};return{globals:t.window.expandoCount(),mountId:e,loop:t.loop.stats(),listeners:{document:t.document.count(),window:t.window.count()},storage:{local:t.localStorage()?.stats()??n,session:t.sessionStorage()?.stats()??n}}}function Tt(e=k){U.delete(e),H.get(e)?.reset(),e!==k&&H.delete(e);const n=F.get(e);if(!n)return{mountId:e,listeners:0,timers:{timeouts:0,intervals:0,animationFrames:0,parkedCallbacks:0}};F.delete(e),n.moduleUrls.clear(),n.live.alive=!1;const s=n.document.dispose()+n.window.dispose(),a=n.loop.dispose?.()??{timeouts:0,intervals:0,animationFrames:0,parkedCallbacks:0};return e===k&&Ce(),{mountId:e,listeners:s,timers:a}}function fn(e,t=k){U.set(t,e)}function de(e,t,n){const s=new Map,a=Se(t),u=()=>n?.page.surface??null,i=()=>n?.role==="window"&&n.page.surface?n.page:null,g=(l,f,o)=>{const r=i();if(r&&l==="resize"&&f!==null){r.addResizeListener(f,o);return}if((l==="load"||l==="DOMContentLoaded"||l==="pageshow")&&f!==null&&document.readyState==="complete"){window.setTimeout(()=>{const c=new Event(l);typeof f=="function"?f.call(p,c):f.handleEvent(c)},0);return}if(j.has(l)&&f!==null){let c=s.get(l);c||(c=new Map,s.set(l,c));const v=f;let b=c.get(v);b||(b=function(m){if(!a(l,m))return typeof v=="function"?v.call(this,m):v.handleEvent(m)},c.set(v,b)),e.addEventListener(l,b,o);return}e.addEventListener(l,f,o)},h=(l,f,o)=>{const r=i();if(r&&l==="resize"&&f!==null){r.removeResizeListener(f,o);return}if(j.has(l)&&f!==null){const c=s.get(l),v=c?.get(f);if(v){c?.delete(f),e.removeEventListener(l,v,o);return}}e.removeEventListener(l,f,o)},y=new WeakMap,w=l=>{if(typeof l!="string"||!l.startsWith("on"))return null;const f=l.slice(2);return j.has(f)?f:null},d=l=>{console.error(dt(l))};let p;const I=()=>{const l=Reflect.get(e,"location",e);if(!l||!n)return null;const f=le.get(n.page);if(f?.source===l)return{value:f.view};const o=ut(l,d,{reloadGame:()=>{const r=Te;return r?(r(),!0):!1}});return le.set(n.page,{source:l,view:o}),{value:o}},T=l=>{const f=i();if(!f)return null;if(l==="window"||l==="self"||l==="top"||l==="parent")return{value:p};if(l!=="innerWidth"&&l!=="outerWidth"&&l!=="innerHeight"&&l!=="outerHeight")return null;const o=f.viewport();return o?l==="innerWidth"||l==="outerWidth"?{value:o.width}:l==="innerHeight"||l==="outerHeight"?{value:o.height}:null:null},S=l=>{if(!n)return null;if(l==="location")return I();if(n.role==="document"){const f=u();if(f&&(l==="body"||l==="documentElement"))return{value:f};if(f&&l==="head")return{value:n.page.head()};if(f&&l==="title")return{value:n.page.title};if(f&&l==="currentScript")return{value:n.page.currentScript};if(f&&l==="activeElement"){const o=Reflect.get(e,"activeElement",e);return{value:o&&f.contains(o)?o:f}}}return T(l)},L=l=>{if(n?.role!=="document"||typeof l!="string")return;const f=u();if(!f)return;const o=e;if(l==="querySelector")return r=>r.trim().toLowerCase()==="head"?n.page.head():f.matches(r)?f:f.querySelector(r);if(l==="querySelectorAll")return f.querySelectorAll.bind(f);if(l==="getElementById")return r=>{const c=o.getElementById(r);return c&&f.contains(c)?c:null};if(l==="getElementsByClassName")return f.getElementsByClassName.bind(f);if(l==="getElementsByTagName")return r=>{if(r.toLowerCase()!=="head")return f.getElementsByTagName(r);const c=n.page.head();return c?Object.assign([c],{item:v=>v===0?c:null,namedItem:v=>c.id===v?c:null}):[]};if(l==="elementFromPoint"||l==="elementsFromPoint")return(r,c)=>{const v=f.getBoundingClientRect(),m=o[l].bind(o)(r+v.left,c+v.top);return Array.isArray(m)?m.filter(_=>f.contains(_)):m&&f.contains(m)?m:null}};return p=new Proxy(e,{get(l,f){if(f==="addEventListener")return g;if(f==="removeEventListener")return h;const o=S(f);if(o)return o.value;const r=L(f);if(r)return r;if(typeof f=="string"&&Ee.has(f)){const v=V;if(v)return v.schedulers[f]}const c=Reflect.get(l,f,l);return typeof c!="function"?c:y.get(c)??Re(c,l)},set(l,f,o){if(f==="location"&&n)return d(`${n.role}.location = ${String(o)}`),!0;if(n?.role==="document"&&f==="title"&&n.page.surface)return n.page.title=String(o),!0;if(w(f)!==null&&typeof o=="function"){const c=o,v=function(b){if(t())return c.call(this,b)};return y.set(v,c),Reflect.set(l,f,v,l)}if(f==="onload"&&typeof o=="function"&&document.readyState==="complete"){const c=o;return window.setTimeout(()=>c.call(p,new Event("load")),0),!0}return Reflect.set(l,f,o,l)}}),p}function fe(e){return typeof e=="boolean"?e:e?.capture??!1}function me(e,t,n){const s=n.execute??(o=>o()),a=[],u=Se(t);let i=!1,g=!1;const h=o=>{if(g)return;g=!0;const r=n.realmId?`"${n.realmId}"`:"the default realm";console.warn(`vgai: a stopped game tried to register ${o} on its ${n.role} after its realm (${r}) was reclaimed; refused. Later refusals in this generation are silent.`)},y=new Map,w=new Map,d=new WeakMap;let p;const I=o=>n.role==="window"&&n.self&&(o===e||typeof window<"u"&&o===window)?n.self():n.document&&(o===n.document()||typeof document<"u"&&o===document)?n.document():o,T=o=>{const r=d.get(o);if(r)return r;const c=new Proxy(o,{get(v,b){if(b==="currentTarget")return p;if(b==="target"||b==="srcElement"){const _=Reflect.get(v,b,v);return _===v.currentTarget?p:I(_)}if(b==="view")return I(Reflect.get(v,b,v));if(b==="composedPath")return()=>v.composedPath().map(I);const m=Reflect.get(v,b,v);return typeof m=="function"?m.bind(v):m}});return d.set(o,c),c},S=o=>{const r=a.indexOf(o);r!==-1&&a.splice(r,1),e.removeEventListener(o.type,o.actual,o.capture),o.abort?.signal.removeEventListener("abort",o.abort.handler)},L=(o,r,c)=>{if(r===null)return;if(i){h(`a "${o}" listener`);return}const v=fe(c),b=c&&typeof c!="boolean"?c.signal:void 0;if(b?.aborted||a.some(R=>R.type===o&&R.original===r&&R.capture===v))return;let m;const _=function(R){if(c&&typeof c!="boolean"&&c.once){const C=a.indexOf(m);C!==-1&&a.splice(C,1),m.abort?.signal.removeEventListener("abort",m.abort.handler)}if(j.has(o)){const C=u(o,R);if(n.recordInput?.(R,C),C)return}const A=T(R);return s(()=>typeof r=="function"?r.call(p,A):r.handleEvent(A))},E=()=>S(m);m={type:o,original:r,actual:_,capture:v,...b?{abort:{signal:b,handler:E}}:{}},a.push(m),e.addEventListener(o,_,c),b?.addEventListener("abort",E,{once:!0}),(o==="load"||o==="DOMContentLoaded"||o==="pageshow")&&document.readyState==="complete"&&window.setTimeout(()=>{!i&&a.includes(m)&&_.call(e,new Event(o))},0)},l=(o,r,c)=>{if(r===null)return;const v=fe(c),b=a.find(m=>m.type===o&&m.original===r&&m.capture===v);b?S(b):e.removeEventListener(o,r,c)},f=o=>typeof o=="string"&&o.startsWith("on")&&o.length>2?o.slice(2):null;return p=new Proxy(e,{get(o,r){if(r==="addEventListener")return L;if(r==="removeEventListener")return l;const c=w.get(r);if(c)return c.original;if(n.self&&(n.role==="window"&&(r==="window"||r==="self"||r==="frames"||r==="top"||r==="parent")||n.role==="document"&&r==="defaultView"))return n.self();if(n.role==="window"&&r==="document"&&n.document)return n.document();if(n.role==="window"&&r==="globalThis"&&n.self)return n.self();if(n.role==="window"&&r==="localStorage"&&n.localStorage)return n.localStorage()?.storage;if(n.role==="window"&&r==="sessionStorage"&&n.sessionStorage)return n.sessionStorage()?.storage;if(typeof r=="string"&&Ee.has(r)&&n.schedulers)return n.schedulers[r];const v=y.get(r);if(v)return v.get?v.get.call(p):v.value;const b=Reflect.get(o,r,o);return typeof b!="function"?b:Re(b,o)},set(o,r,c){if(r==="location")return Reflect.set(o,r,c,o);if(n.role==="window"&&(r==="document"||r==="globalThis"||r==="localStorage"||r==="sessionStorage"))return!0;const v=f(r);if(v){if(i)return h(`an "${String(r)}" handler`),!0;const b=w.get(r);if(b&&(e.removeEventListener(b.type,b.actual),w.delete(r)),typeof c!="function")return!0;const m=c,_=(v==="load"||v==="DOMContentLoaded"||v==="pageshow")&&document.readyState==="complete",E=function(R){if(j.has(v)){const C=u(v,R);if(n.recordInput?.(R,C),C)return}const A=s(()=>m.call(p,T(R)));return A===!1&&R.preventDefault(),A};return w.set(r,{type:v,original:m,actual:E}),e.addEventListener(v,E),_&&window.setTimeout(()=>{!i&&w.get(r)?.actual===E&&E.call(e,new Event(v))},0),!0}return n.isolateExpandos?(y.set(r,{configurable:!0,enumerable:!0,value:c,writable:!0}),!0):Reflect.set(o,r,c,o)},defineProperty(o,r,c){return n.isolateExpandos?Reflect.getOwnPropertyDescriptor(o,r)?.configurable===!1?!1:(y.set(r,{...c,configurable:!0,enumerable:c.enumerable??!0}),!0):Reflect.defineProperty(o,r,c)},deleteProperty(o,r){return y.delete(r)?!0:n.isolateExpandos?Reflect.getOwnPropertyDescriptor(o,r)?.configurable!==!1:Reflect.deleteProperty(o,r)},has(o,r){return y.has(r)||Reflect.has(o,r)},ownKeys(o){const r=new Set(Reflect.ownKeys(o));for(const c of y.keys())typeof c!="number"&&r.add(c);return[...r]},getOwnPropertyDescriptor(o,r){const c=Reflect.getOwnPropertyDescriptor(o,r);return c?.configurable===!1?c:y.get(r)??c}}),{proxy:p,count:()=>a.length+w.size,expandoCount:()=>y.size,dispose(){for(const r of u.outstandingReleases()){for(const c of[...a])c.type===r.type&&c.actual.call(p,r);for(const c of w.values())c.type===r.type&&c.actual.call(p,r)}i=!0;const o=a.length+w.size;for(const r of[...a])S(r);for(const r of w.values())e.removeEventListener(r.type,r.actual);return w.clear(),y.clear(),o}}}let W=!1;function Ce(){if(!W)return;const e=globalThis,t=Y();V=Pe,e.__vgaiGameTimers=t.timers,e.__vgaiGameWindow=t.window,e.__vgaiGameDocument=t.document,e.__vgaiGameConsole=t.console}function mn(){if(W||typeof window>"u"||typeof document>"u")return;W=!0;const e=globalThis;He(),e.__vgaiGameModuleUrls=It,e.__vgaiGameRealm=t=>(M.push(t),queueMicrotask(()=>{const n=M.lastIndexOf(t);n>=0&&M.splice(n,1)}),Y(t)),Ce()}function Q(e,t){const n=Tt(e),s=n.timers.timeouts+n.timers.intervals+n.timers.animationFrames+n.timers.parkedCallbacks;if(n.listeners===0&&s===0)return;const a=[];n.listeners>0&&a.push(`${n.listeners} window/document listener${n.listeners===1?"":"s"}`),s>0&&a.push(`${s} timer/frame callback${s===1?"":"s"}`),P.logStructured("warn",`${t} stopped without releasing ${a.join(" and ")}; the editor reclaimed them.`,"environment",void 0,{instanceId:e,instanceName:t})}function Ae(e=typeof window>"u"?null:window){const t=e?.vgaiGame;return!t||t.contractVersion!==1?null:t}const Pt=Object.entries(Oe).filter(([,e])=>!e.optional).map(([e])=>e);function Le(e){const t=e?.scenes;if(t==null)return{scenes:null,malformed:null};if(typeof t!="object")return{scenes:null,malformed:`declared as ${typeof t}; expected an object with list(), current() and goTo()`};const n=Pt.filter(s=>typeof t[s]!="function");return n.length>0?{scenes:null,malformed:`declared a scenes surface missing required member(s): ${n.join(", ")}`}:{scenes:t,malformed:null}}function Ct(e){const t=e?.ready;if(t==null)return{ready:null,malformed:null};if(typeof t=="function"){const n=t;return{ready:()=>Promise.resolve(n()),malformed:null}}if(typeof t.then=="function"){const n=t;return{ready:()=>Promise.resolve(n),malformed:null}}return{ready:null,malformed:`declared \`ready\` as ${typeof t}; expected a promise or a function returning one`}}function At(e){const t=e?.world;return t==null?{world:null,malformed:null}:typeof t!="object"||t.isScene!==!0?{world:null,malformed:`declared \`world\` as ${typeof t}; expected the game's own THREE.Scene`}:{world:t,malformed:null}}function Lt(e){const t=e?.presentation;if(t==null)return{canvas:null,malformed:null};const n=t;return typeof n!="object"||n.tagName!=="CANVAS"||typeof n.getContext!="function"?{canvas:null,malformed:`declared \`presentation\` as ${typeof t=="object"?String(n.tagName??"object"):typeof t}; expected the game's own <canvas> element`}:{canvas:t,malformed:null}}const gn=Object.freeze(Object.defineProperty({__proto__:null,readGameContract:Ae,readGamePresentation:Lt,readGameReady:Ct,readGameScenes:Le,readGameWorld:At},Symbol.toStringTag,{value:"Module"}));function kt(e){if(!Array.isArray(e))throw new Error("scenes.list() did not return an array");const t=new Set;for(const n of e){if(typeof n!="object"||n===null||typeof n.id!="string"||n.id.trim().length===0||typeof n.label!="string"||n.label.trim().length===0)throw new Error("scenes.list() returned an invalid { id, label } scene");if(t.has(n.id))throw new Error(`scenes.list() returned duplicate id "${n.id}"`);t.add(n.id)}return e}function xt(e){return typeof e?.goToScene=="function"}function hn(e,t={}){const{scenes:n,malformed:s}=Le(e);if(s!==null&&P.warn(`Ignored the game contract's \`scenes\` surface: ${s}`,"ingest"),!n)return null;let a=!1;const u=()=>{try{return kt(n.list())}catch(g){return a||(a=!0,P.warn(`Ignored invalid game-contract scenes: ${g instanceof Error?g.message:String(g)}`,"ingest")),[]}},i=g=>{const h=u().map(w=>w.id);return h.includes(g)?(t.onSwitchAccepted?.(g),{ok:!0,settled:(async()=>{try{return await n.goTo(g),{requested:g,current:n.current()}}catch(w){return{requested:g,current:n.current(),error:w instanceof Error?w.message:String(w)}}})()}):{ok:!1,error:`scenes.goTo: "${g}" is not one of this game's scenes (${h.length>0?h.join(", "):"it lists none"}).`,known:h}};return{title:"Scenes",storiesFor:g=>u().map(({id:h,label:y})=>({id:h,label:y})),active:g=>n.current(),goToScene:i,apply:(g,h)=>{if(h===null){P.warn("This game’s scenes cannot be cleared: it is always in one of its own scenes. Pick the scene to switch to instead.","ingest");return}const y=i(h);if(!y.ok){P.warn(`${y.error} — ignoring.`,"ingest");return}y.settled.then(w=>{w.error!==void 0&&P.error(`scenes.goTo("${h}") failed: ${w.error}`,"ingest")})}}}function Gt(){const e=G();if(!e)return null;const n=(()=>{switch(e.kind){case"canvas":return e.session.adapter;case"dom":return e.session.adapter;case"three":return e.session.mount?.authoring}})()?.stories;return xt(n)?n:null}let J=!1;function ge(){return J}function wn(){J=!0}function vn(){J=!1}let D=null,x=null;function yn(e){D=e,e||X()}function pn(){D=null,X()}function X(){const e=x;x=null,e&&(clearTimeout(e.timer),e.settle(null))}function ke(){const e=D?.renderer.domElement;return typeof e=="object"&&e!==null?e:null}function _n(){const e=x;if(!(!e||!D))try{const t=D.renderer;if(typeof t.getRenderTarget=="function"&&t.getRenderTarget()!==null)return;const n=ke();if(!n||n.width===0||n.height===0)return;const s=e.image??n.ownerDocument.createElement("canvas");s.width=n.width,s.height=n.height;const a=s.getContext("2d");if(!a||(a.drawImage(n,0,0),e.image=s,e.delivering))return;e.delivering=!0,setTimeout(()=>{x===e&&(x=null,clearTimeout(e.timer),e.settle(e.image))},0)}catch{}}function Mt(e=2e3){return D?(X(),new Promise(t=>{const n=setTimeout(()=>{x?.timer===n&&(x=null),t(null)},e);x={settle:t,timer:n,image:null,delivering:!1}})):Promise.resolve(null)}const $t={play:e=>(e.play(),"driven"),resume:e=>(e.resume(),"driven"),stop:(e,t)=>t?.stopEndsRun?"declined":(e.pause(),"driven"),pause:e=>(e.pause(),"driven"),step:e=>e.canStep?(e.step(),"driven"):{ok:!1,error:"this ingested game cannot be stepped — no serve-time loop gate measured control over its frames, so a single-frame step would be a button that lies (see ingest/same-realm-loop-gate.ts)"}};function Ft(e,t,n){if(!ze(t))return null;const s=$t[t](e,n);return s==="declined"?null:s!=="driven"?s:{ok:!0,data:{ingest:!0,playing:e.playing}}}function Ht(){return Y().window}function Z(){return typeof window>"u"?null:Ae(Ht())}let ee=!1;function Dt(){return ee}function N(e){ee=e}function zt(){N(!1);const e=window;delete e.__vgaiMountCold,delete e.__vgaiIngestPlayed}function he(e,t,n){const s=(a,u)=>je({seam:`contract.lifecycle.${t}`,subject:"game",epoch:qe(e),stage:"effect",outcome:a,source:"consumer",detail:u});try{n(),s("pass",`the mounted ingest lifecycle consumed lifecycle.${t}`)}catch(a){throw s("fail",`lifecycle.${t} failed: ${a instanceof Error?a.message:String(a)}`),a}}function Sn(e={}){const t=Z(),n=t?.lifecycle,s=()=>{if(t&&n?.start){he(t,"start",()=>n.start?.());return}window.dispatchEvent(new CustomEvent("vgai:ingest-play"))},a=typeof n?.pause=="function",u=typeof n?.resume=="function";return t&&a!==u?{start:s,pauseGap:a?"the game contract declares lifecycle.pause without lifecycle.resume":"the game contract declares lifecycle.resume without lifecycle.pause"}:t&&a&&u?{start:s,setPaused:i=>he(t,i?"pause":"resume",()=>{i?n?.pause?.():n?.resume?.()})}:e.setPaused?{start:s,setPaused:e.setPaused,...e.step?{step:e.step}:{},...e.canStep?{canStep:e.canStep}:{}}:{start:s,pauseGap:e.pauseGap??"the game declares no lifecycle.pause/resume pair and its mounted adapter exposes no setPaused capability"}}function bn(){const e=G();return e?e.session.lifecycle.pauseGap??null:null}function we(e){const t=G();if(t)for(const n of t.siblings)try{n.setPaused?.(e)}catch(s){P.error(`Composite sibling setPaused(${e}) failed: ${s}`,"ingest")}}function jt(){return Z()}function xe(){const e=G()?.session.lifecycle;if(!e?.setPaused)return null;const t=()=>{e.setPaused?.(!0),we(!0),N(!1)},n=()=>{e.setPaused?.(!1),we(!1),N(!0)};return{get playing(){return ee},play(){Ne();const s=window;if(s.__vgaiIngestPlayed)return n();s.__vgaiIngestPlayed=!0,e.start(),n()},pause:t,resume:n,canStep:!!e.step&&(e.canStep?.()??!0),step(){e.canStep?.()!==!1&&(e.step?.(),N(!1))}}}function En(e){const t=xe();return t?(t.pause(),!0):!1}const Nt=Ve(e=>{e.level==="warn"?P.warn(e.message,"ingest"):P.log(e.message,"ingest")});let Wt=0,Ge="";function Rn(e){Ge=`${e}#${++Wt}`}function In(e){const t=mt(e.realmLoopVerdict?.()),n=e.realmLoopVerdict?.()?.reason??null;return t!==null||n!==null?{loop:t,reason:n}:e.realmLoopVerdict?{loop:null,reason:null}:{loop:null,reason:Bt}}function Tn(){return{loop:null,reason:"⏸ calls the host runtime's own play pause on this route, but no probe has measured whether that reaches this game's frames — an unmodified React game that schedules its own timers is not held by the host loop"}}const Bt="this mount installs no loop gate, so no verdict will ever be measured here — nothing in the editor holds this game's frames";function Ot(e,t,n){const s=Ze(t?.systems,n),a=new Map(s.empty.map(i=>[i.slot,i.evidence])),u=new Map(s.malformed.map(i=>[i.slot,i.reason]));return Ye.map(i=>{if(e[i]!=null)return{slot:i,state:"bound",proof:We({slot:i,adapter:e[i],subject:"game"})};const g=a.get(i);if(g!==void 0)return{slot:i,state:"empty",evidence:g};const h=u.get(i);return h!==void 0?{slot:i,state:"malformed",evidence:h}:{slot:i,state:"unanswered"}})}function qt(){const e=Je();switch(e.state){case"absent":return null;case"loading":return{state:"loading"};case"ready":return{state:"ready",dataFile:e.writer.dataFile};default:return{state:"failed",reason:e.reason}}}function te(){const e=G(),t=e?.coverage;if(!e||!t)return null;const n=Qe(),s=t.loop(),a=jt();return Ue({worldId:e.worldId,reach:t.reach,surface:e.kind,reachMechanism:t.reachMechanism,loop:s.loop,loopReason:s.reason,contract:Ke(a),systemAdapters:Ot(pe(),a,e.kind),ownership:n?{writable:n.writable,reason:n.reason??null,recorder:n.recorder??null}:null,dataWriter:qt(),projectVerbs:[],writeReach:t.writeReach?.()??null})}function Pn(e){const t=G();if(!t)return;t.coverage=e;const n=te();n&&Nt.report(Ge,n)}function Cn(e,t){if(!t)return;const n=`Ingest "${e}" loop: ${t.loop} — ${t.reason}`;t.loop==="gated"?P.log(n,"ingest"):P.warn(n,"adapter")}const Vt=["hierarchy","selection","transforms","inspector","assetSubject","structure","persistence","pickable","rects","boxEdit","text","colorSample","stories","truth","assetDrop"];function Ut(e){return Vt.filter(t=>e[t]!==void 0)}function An(e){return{coverage:()=>te(),prepareCoverage:()=>Xe(),authoringProviders:()=>Ut(e),engineSystems:()=>Object.keys(pe())}}function Ln(e,t){Object.defineProperties(e,{loop:{enumerable:!0,get:()=>t.realmLoopVerdict?.()?.loop??null},loopReason:{enumerable:!0,get:()=>t.realmLoopVerdict?.()?.reason??null}}),e.realmLoopStats=()=>ht()?.stats()??null}function kn(e,t){const n=e,s=typeof n.querySelectorAll=="function"?n.querySelectorAll("*").length:t.nodeCount(),a=Object.keys(e).some(u=>u.startsWith("__reactContainer"));return{elementCount:s,hierarchyNodeCount:t.nodeCount(),reactRootPresent:a}}function xn(e,t){window[e]=t}function ne(e){delete window[e]}function Me(){Et(null);const e=G();if(e){Jt(null),zt();try{Z()?.lifecycle?.dispose?.()}catch(t){P.error(`The game's own lifecycle.dispose threw at teardown: ${t}`,"ingest")}for(let t=e.siblings.length-1;t>=0;t--)try{e.siblings[t].dispose()}catch(n){P.error(`Composite sibling dispose failed: ${n}`,"ingest")}switch(e.kind){case"three":Kt(e.session);return;case"canvas":Yt(e.session);return;case"dom":Qt(e.session);return}}}function Kt(e){if(e.mount?.authoring&&e.mount.authoring.dispose?.(),B(null),O(null),q(),e.resizeObserver?.disconnect(),e.inputGateUnsubscribe?.(),e.mount)try{e.store.exitPlayScene()}catch{}e.store.setPlayState("stopped");try{e.mount?.game.dispose()}catch{}Q("","The ingested game"),ne("__vgaiIngest"),P.log("Ingest root unmounted","ingest")}function Yt(e){e.adapter&&e.adapter.dispose(),B(null),O(null),q(),e.store.setPlayState("stopped");try{e.dispose()}catch{}Q("","The ingested canvas game"),ne("__vgaiIngest2D"),P.log("canvas ingest root unmounted","ingest")}function Qt(e){e.adapter.dispose(),B(null),O(null),q(),e.store.setPlayState("stopped");try{e.stop()}catch{}Q("","The ingested DOM game"),ne("__vgaiIngestReact"),P.log("DOM ingest root unmounted","ingest")}function Gn(){G()?.kind==="three"&&Me()}let z=null;function G(){return z}function Jt(e){z=e}function $e(){return z?.kind??null}function ve(){return $e()!==null}function Mn(e){z&&(z.siblings=[...e])}let ye=Promise.resolve();function $n(e){const t=ye.then(e);return ye=t.then(()=>{},()=>{}),t}Be({id:"ingest",priority:1,mounted:ve,playing:()=>Dt()||ge(),stop:Me,instanceContainer:()=>null,frameCanvas:ke,snapshotFrame:()=>Mt(),command:e=>{const t=ve()?xe():null;return t?Ft(t,e.type,{stopEndsRun:ge()}):null},scenes:Gt,surface:$e,coverage:te,authoringRefusal:()=>z?.kind==="dom"?"This is an ingested native-React game: its components render directly as a DOM layer under the host React — there is no scene graph or renderer to introspect, and authoring is deliberately off for react ingests (the editor never writes JSX back into an unmodified game). The game is hosted, sized, and disposed; play it in the Game tab.":null});export{ln as $,un as A,an as B,Ct as C,Z as D,cn as E,Lt as F,rn as G,Ht as H,on as I,pn as J,ht as K,At as L,Rn as M,N,Cn as O,In as P,Ln as Q,Gt as R,hn as S,Bt as T,Q as U,mn as V,_t as W,dn as X,yn as Y,_n as Z,sn as _,G as a,et as a0,ie as a1,gn as a2,wn as b,Me as c,ge as d,vn as e,bn as f,xe as g,En as h,ve as i,Sn as j,Jt as k,fn as l,Tn as m,kn as n,An as o,xn as p,mt as q,Pn as r,$n as s,te as t,Dt as u,zt as v,Mn as w,$e as x,Gn as y,jt as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(r,e){throw new Error(`Unreachable${e?` ${e}`:""}: unexpected value ${JSON.stringify(r)}`)}export{n as assertNever};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function c(e){let t=!1,o=0,r=0,n;const m=()=>typeof document<"u"&&document.hidden,u=()=>{m()&&i()},a=()=>{typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(o),cancelAnimationFrame(r)),n!==void 0&&clearTimeout(n),typeof document<"u"&&document.removeEventListener("visibilitychange",u)};function i(){t||(t=!0,a(),e())}return m()||typeof requestAnimationFrame!="function"?n=setTimeout(i,0):(o=requestAnimationFrame(()=>{r=requestAnimationFrame(i)}),typeof document<"u"&&document.addEventListener("visibilitychange",u),n=setTimeout(i,1e3)),()=>{t||(t=!0,a())}}const s=32;function f(){return typeof requestAnimationFrame!="function"?new Promise(e=>setTimeout(e,s)):new Promise(e=>{requestAnimationFrame(()=>e()),setTimeout(e,s)})}export{f as n,c as s};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c1 as p}from"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";const u=1e-9,d=1e5;function f(m,e,t){const r=t.end-t.start,i=t.loop&&r>u,o=[];let s=m,a=e,c=!1,l=0;for(;;){const h=t.end-s;if(!i||a<=h+u){const n=Math.min(s+a,t.end);o.push({from:s,to:n,direction:"forward"}),s=n;break}if(o.push({from:s,to:t.end,direction:"forward"}),a-=h,s=t.start,c=!0,l++,l>d){const n=t.start+a%r;o.push({from:s,to:n,direction:"forward"}),s=n;break}}return{pos:s,intervals:o,looped:c}}function g(m,e,t){const r=t.end-t.start,i=t.loop&&r>u,o=[];let s=m,a=e,c=!1,l=0;for(;;){const h=s-t.start;if(!i||a<=h+u){const n=Math.max(s-a,t.start);o.push({from:s,to:n,direction:"reverse"}),s=n;break}if(o.push({from:s,to:t.start,direction:"reverse"}),a-=h,s=t.end,c=!0,l++,l>d){const n=t.end-a%r;o.push({from:s,to:n,direction:"reverse"}),s=n;break}}return{pos:s,intervals:o,looped:c}}function _(m,e){return m<e.start?e.start:m>e.end?e.end:m}class E{_previousTime;_currentTime;_range;_timeScale;_playDirection="forward";_lastCrossingDirection="forward";_playbackState="stopped";_evaluators=[];_registrationCounter=0;constructor(e={}){const t=e.start??0,r=e.end??Math.max(t,1);if(r<t)throw new Error(`[AnimationClock] range end (${r}) must be >= start (${t})`);const i=e.timeScale??1;if(!Number.isFinite(i)||i<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${i}`);this._range={start:t,end:r,loop:e.loop??!1},this._timeScale=i,this._previousTime=t,this._currentTime=t}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(e){if(!Number.isFinite(e)||e<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${e}`);this._timeScale=e}get range(){return this._range}setRange(e){const t=e.start??this._range.start,r=e.end??this._range.end,i=e.loop??this._range.loop;if(r<t)throw new Error(`[AnimationClock] range end (${r}) must be >= start (${t})`);this._range={start:t,end:r,loop:i};const o=_(this._currentTime,this._range);o!==this._currentTime&&this.seek(o)}play(e){e&&(this._playDirection=e),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="stopped"}seek(e){const t=_(e,this._range);if(t===this._currentTime)return this.emit(this._currentTime,this._currentTime,[{from:t,to:t,direction:this._lastCrossingDirection}],!1,this._lastCrossingDirection);const r=t>this._currentTime?"forward":"reverse",i=this._currentTime;return this._previousTime=i,this._currentTime=t,this._lastCrossingDirection=r,this.emit(i,t,[{from:i,to:t,direction:r}],!1,r)}seekFrame(e,t){if(!Number.isFinite(t)||t<=0)throw new Error(`[AnimationClock] seekFrame fps must be a finite number > 0, got ${t}`);return this.seek(this._range.start+e/t)}advance(e){if(this._playbackState!=="playing")return null;if(!Number.isFinite(e))throw new Error(`[AnimationClock] advance(dt) requires a finite dt, got ${e}`);const t=Math.abs(e)*this._timeScale,r=this._currentTime;if(t===0)return this.emit(r,r,[],!1,this._playDirection);const i=this._playDirection==="forward"?f(r,t,this._range):g(r,t,this._range);return this._previousTime=r,this._currentTime=i.pos,this._lastCrossingDirection=this._playDirection,this.emit(r,i.pos,i.intervals,i.looped,this._playDirection)}subscribe(e,t){if(!p.includes(e))throw new Error(`[AnimationClock] unknown phase "${e}". Valid: ${p.join(", ")}`);const r={phase:e,order:this._registrationCounter++,fn:t};return this._evaluators.push(r),{dispose:()=>{const i=this._evaluators.indexOf(r);i!==-1&&this._evaluators.splice(i,1)}}}emit(e,t,r,i,o){const s={previousTime:e,currentTime:t,direction:o,timeScale:this._timeScale,looped:i,intervals:r};if(this._evaluators.length>0){const a=[...this._evaluators].sort((c,l)=>{const h=p.indexOf(c.phase),n=p.indexOf(l.phase);return h!==n?h-n:c.order-l.order});for(const c of a)try{c.fn(s)}catch(l){console.error(`[AnimationClock] evaluator in phase "${c.phase}" threw:`,l)}}return s}}export{E as AnimationClock};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o}from"./AssetBudgetPanel-J9--TZPU.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";import"./asset-loaders-BOy5Ss8k.js";import"./SkeletonUtils-Cps8GOC6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-BB2Of6Ht.js";import"./object-marks-DwvIEBOK.js";import"./loader-CaF_I7Yt.js";const B="workspace.menu",k={menu:"asset",items:[{id:"open-budget",label:"Open in Asset Budget",testId:"asset-context-open-budget",execute:({assetPath:t})=>{t!==void 0&&o(t)}}]};export{k as menu,B as point};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as t}from"./AssetBudgetPanel-J9--TZPU.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";import"./asset-loaders-BOy5Ss8k.js";import"./SkeletonUtils-Cps8GOC6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-BB2Of6Ht.js";import"./object-marks-DwvIEBOK.js";import"./loader-CaF_I7Yt.js";const B="workspace.action",f=[{id:"asset-budget",label:"Open Asset Budget",execute:()=>{t()}}];export{f as actions,B as point};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{A as o}from"./AssetBudgetPanel-J9--TZPU.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";import"./asset-loaders-BOy5Ss8k.js";import"./SkeletonUtils-Cps8GOC6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-BB2Of6Ht.js";import"./object-marks-DwvIEBOK.js";import"./loader-CaF_I7Yt.js";const k="workspace.document",w="Asset Budget";function D(r){return t.jsx(o,{})}export{D as default,k as point,w as title};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as t}from"./AssetBudgetPanel-J9--TZPU.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-GIL7oGEO.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-D396a9Mn.js";import"./asset-loaders-BOy5Ss8k.js";import"./SkeletonUtils-Cps8GOC6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-BB2Of6Ht.js";import"./object-marks-DwvIEBOK.js";import"./loader-CaF_I7Yt.js";const A="workspace.menu",B={menu:"window",items:[{id:"asset-budget",label:"Asset Budget",testId:"menu-asset-budget",execute:()=>{t()}}]};export{B as menu,A as point};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b6 as v,b7 as l,b8 as b,b9 as h,ba as g,bb as m}from"./index-GIL7oGEO.js";const p=new WeakMap;function w(e){typeof window>"u"||(window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:{paths:[u(e)]}})),window.dispatchEvent(new CustomEvent("editor:asset-mutation",{detail:{type:"change",paths:[u(e)]}})))}function k(e,a){const s=u(a);let n=p.get(e);n||(n=new Map,p.set(e,n));const t=n.get(s);if(t)return t;const d=e.registry.registerProject("project-file",`.vgai/history/imported-assets/${s}`,s.split("/").pop()),o={revision:0,driver:void 0},r=async()=>{const i=await g(s),c=new TextEncoder().encode(i);return{revision:o.revision,contentType:"application/vnd.vgai.asset-history-token",bytes:c,sha256:await m(c)}};return o.driver={descriptor:d,capture:r,preflight:async i=>{const c=await r();return c.sha256===i.sha256?{ok:!0}:{ok:!1,reason:"content-conflict",actualRevision:o.revision,actualSha256:c.sha256}},restore:async i=>{const c=new TextDecoder().decode(e.snapshots.read(i).bytes);await l(s,c),o.revision++,w(s)},estimateBytes:i=>i.byteLength},e.registerDriver(o.driver),n.set(s,o),o}function f(e){return new TextEncoder().encode(e)}async function A(e,a){if(e.length===0)return;const s=h();if(!s)return;const n=e.map(t=>({entry:t,resource:k(s,t.assetPath)}));try{await s.recordAppliedTransaction({label:a,detail:e.map(t=>u(t.assetPath)).join(", "),resources:n.map(({resource:t})=>t.driver.descriptor.key),scope:"project"},n.map(({entry:t,resource:d})=>({resource:d.driver.descriptor.key,beforeBytes:f(t.beforeToken),afterBytes:f(t.afterToken),contentType:"application/vnd.vgai.asset-history-token"})))}catch(t){const d=await Promise.allSettled(e.map(r=>l(r.assetPath,r.beforeToken)));for(const r of e)w(r.assetPath);const o=d.find(r=>r.status==="rejected");throw o?.status==="rejected"?new Error(`Project history could not record undo/redo and rollback failed: ${o.reason instanceof Error?o.reason.message:String(o.reason)}`):new Error(`Assets were rolled back because project history could not record undo/redo: ${t instanceof Error?t.message:String(t)}`)}}async function E(e,a=`Import ${e.name}`){const s=await v(e);return s.ok&&s.history&&await A([s.history],a),s}function u(e){const a=e.split(/[?#]/,1)[0].replace(/^\/+/,"");if(!a)throw new Error("Project asset path cannot be empty.");return a}function P(e,a){const s=h(),n=u(e);let t=!1;const d=()=>{t||(t=!0,queueMicrotask(()=>{t=!1,a()}))},o=s?b(s).subscribeAll(i=>{i===n&&d()}):()=>{},r=i=>{const c=i.detail?.paths;(!c||c.some(y=>u(y)===n))&&d()};return typeof window<"u"&&window.addEventListener("editor:assets-changed",r),()=>{o(),typeof window<"u"&&window.removeEventListener("editor:assets-changed",r)}}export{E as d,P as s};
|