@volter/game-editor 0.5.155 → 0.5.156
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 +22 -22
- package/catalog/entries/blender.json +2 -2
- package/catalog/entries/music.json +2 -2
- package/dist/.vite/manifest.json +2138 -2138
- package/dist/assets/{AssetBudgetPanel-B2Wb7-b1.js → AssetBudgetPanel-BQdPOlqp.js} +3 -3
- package/dist/assets/{AudioViewer-gge--M-h.js → AudioViewer-C5y-GQP-.js} +1 -1
- package/dist/assets/{CanvasBoardDocument-CyGiXrEJ.js → CanvasBoardDocument-DbChIzOl.js} +1 -1
- package/dist/assets/{CanvasSceneViewport-ChG9oRS8.js → CanvasSceneViewport-BAUsxjQl.js} +1 -1
- package/dist/assets/{ColorInput-Dzpqy-J3.js → ColorInput-DGN6sIXS.js} +1 -1
- package/dist/assets/{ColorPicker-CqJPBHlh.js → ColorPicker-C83d-sVK.js} +1 -1
- package/dist/assets/{EntityModelDocument-D7XDf6uB.js → EntityModelDocument-D4IbBjti.js} +1 -1
- package/dist/assets/{EnvironmentAssetDocument-BgO7Hl3g.js → EnvironmentAssetDocument-BqTeI8cz.js} +1 -1
- package/dist/assets/{GameplaySessionTimeline-BBmwHCKA.js → GameplaySessionTimeline-FqH6Sz1y.js} +1 -1
- package/dist/assets/{ImageViewer-BjxoscVa.js → ImageViewer-C_4yhkuB.js} +1 -1
- package/dist/assets/InspectorObjectPreview-DCEUdndv.js +1 -0
- package/dist/assets/{JsonAssetDocument-D81JuRAm.js → JsonAssetDocument-C-drMm6I.js} +1 -1
- package/dist/assets/{LiveModuleDocument-bgStMiU1.js → LiveModuleDocument-C73e8H-p.js} +1 -1
- package/dist/assets/{LutAssetDocument-cl9Jq0Zw.js → LutAssetDocument-DfBf46zV.js} +1 -1
- package/dist/assets/{ModelAssetDocument-CYCLKpxJ.js → ModelAssetDocument-BgP4YOdh.js} +1 -1
- package/dist/assets/{NonThreeAuthoringBootstrap-DhHjvD5d.js → NonThreeAuthoringBootstrap-qnG1AmuP.js} +1 -1
- package/dist/assets/{Object3DDocumentToolbar-CQbARBIW.js → Object3DDocumentToolbar-34bmavxS.js} +1 -1
- package/dist/assets/Object3DDocumentViewport-Blr8aQeS.js +2 -0
- package/dist/assets/{Object3DPreview-BOZYzjz_.js → Object3DPreview-wWjXCo6v.js} +1 -1
- package/dist/assets/{OnlineAssetDetail-DdKHHjxg.js → OnlineAssetDetail-C4iaJDOr.js} +1 -1
- package/dist/assets/{PlayBar-CAarfEOh.js → PlayBar-CBvuzv1Q.js} +1 -1
- package/dist/assets/{QuarksAssetDocument-GTbawoy7.js → QuarksAssetDocument-BlYjfRGp.js} +1 -1
- package/dist/assets/{ReactCanvasControls-DIFkxeKv.js → ReactCanvasControls-C06AmSIB.js} +1 -1
- package/dist/assets/{RootSelectionOverlay-Dv_w1D9s.js → RootSelectionOverlay-CPw5aFQf.js} +1 -1
- package/dist/assets/{ShaderAssetDocument-OA-nshNN.js → ShaderAssetDocument-BVeK6Owt.js} +1 -1
- package/dist/assets/{ShadowEditor-Cp1QVCo9.js → ShadowEditor-BKEyyzOq.js} +1 -1
- package/dist/assets/{SourceAssetViewer-CGGHBzgL.js → SourceAssetViewer-DB6Fg4Re.js} +1 -1
- package/dist/assets/{StageHost-BMgCrIPG.js → StageHost-dHitOcUe.js} +2 -2
- package/dist/assets/{StoryPreviewMount-CyF7FwI7.js → StoryPreviewMount-BONsNxze.js} +1 -1
- package/dist/assets/{ThreeBoardDocument-DCJkLWU8.js → ThreeBoardDocument-D4CSNWux.js} +2 -2
- package/dist/assets/{ThreeIsolationSceneContent-CxsM-QHW.js → ThreeIsolationSceneContent-DkXfPv14.js} +1 -1
- package/dist/assets/{ToolObject3DPreview-lsAoRxtr.js → ToolObject3DPreview-DvGqYC9c.js} +1 -1
- package/dist/assets/{Toolbar-yvFlRv8R.js → Toolbar-BqUPRrhs.js} +1 -1
- package/dist/assets/{TransientHint-Bslncm_l.js → TransientHint-w6qEumzV.js} +1 -1
- package/dist/assets/{VideoViewer-Ba-e91kP.js → VideoViewer-B99XdTSg.js} +1 -1
- package/dist/assets/{ViewportShadingMenu-CgbuQ0e-.js → ViewportShadingMenu-9AaJLhq_.js} +1 -1
- package/dist/assets/{active-ingest-CJ2U5L1O.js → active-ingest-DwF45MBm.js} +2 -2
- package/dist/assets/{animation-clock-CVpGQSVj.js → animation-clock-DW8tJ4l7.js} +1 -1
- package/dist/assets/{animation-mixers.service-CI0K1tfi.js → animation-mixers.service-kllpdYjk.js} +1 -1
- package/dist/assets/{animation-timeline.utility-Wg6WxkxK.js → animation-timeline.utility-C9UVqsSv.js} +1 -1
- package/dist/assets/{asset-budget-asset.menu-BbCBxjLY.js → asset-budget-asset.menu-Cl8tmAtz.js} +1 -1
- package/dist/assets/{asset-budget.action-CK8h0v1A.js → asset-budget.action-dw6ctYdi.js} +1 -1
- package/dist/assets/{asset-budget.document-CYVcDLvH.js → asset-budget.document-BfDL1bS4.js} +1 -1
- package/dist/assets/{asset-budget.menu-BcTijQ2R.js → asset-budget.menu-DiOMl0Yh.js} +1 -1
- package/dist/assets/{asset-editor-persistence-DWp0E8cc.js → asset-editor-persistence-D2o6zb5I.js} +1 -1
- package/dist/assets/{asset-loaders-Bo91oPiL.js → asset-loaders-bMb8Nvq8.js} +1 -1
- package/dist/assets/{asset-preview-BUpxsHNd.js → asset-preview-uRqIcg3G.js} +1 -1
- package/dist/assets/{audio-unlock.service-CyiXe5qk.js → audio-unlock.service-CBeaLfYT.js} +1 -1
- package/dist/assets/{audio.utility-BN4mANCx.js → audio.utility-iWLchCUR.js} +1 -1
- package/dist/assets/autoplay.service---Nu6koq.js +1 -0
- package/dist/assets/{babylon-authoring-adapter-C-EAsfMr.js → babylon-authoring-adapter-Bt8B089v.js} +1 -1
- package/dist/assets/{binding-resolver-DoOAFM2m.js → binding-resolver-qdReeiXP.js} +2 -2
- package/dist/assets/{blender-node-editor.document-BzkGPs0i.js → blender-node-editor.document-DHj3Luuz.js} +1 -1
- package/dist/assets/{blender-properties-tab-B1ggqOYB.js → blender-properties-tab-mrwIpZz_.js} +1 -1
- package/dist/assets/{blender-runtime-host-MJZEPwHA.js → blender-runtime-host-rAbOjzv5.js} +1 -1
- package/dist/assets/{blender-runtime-skin-hw-op7Nt.js → blender-runtime-skin-CVACAkwd.js} +2 -2
- package/dist/assets/{blender-runtime.document-CvTyAou8.js → blender-runtime.document-VP-2qjfk.js} +10 -10
- package/dist/assets/{blender-screenshot.menu-C4VXpXVa.js → blender-screenshot.menu-B_zThqdR.js} +1 -1
- package/dist/assets/{blender-timeline.document-BRFDd7JZ.js → blender-timeline.document-BMNJBWXP.js} +1 -1
- package/dist/assets/{blender-uv-editor.document-CM09ITWu.js → blender-uv-editor.document-B2xmye2O.js} +1 -1
- package/dist/assets/{blender-version.status-CPyc_-kA.js → blender-version.status-BzVGyJhB.js} +1 -1
- package/dist/assets/{blender.command-ktKz-2Zi.js → blender.command-CNlvvxaj.js} +1 -1
- package/dist/assets/{board-guides-CCiyx8cT.js → board-guides-BPvQZ1ob.js} +1 -1
- package/dist/assets/{bridge.command-tP5j6w72.js → bridge.command-dqFe1Lyp.js} +3 -3
- package/dist/assets/{browserAll-BSQVVrNG.js → browserAll-DLXEw1rV.js} +1 -1
- package/dist/assets/{build-player.document-BwbBXtF5.js → build-player.document-Bra3vDcF.js} +1 -1
- package/dist/assets/{build-profiles.document-UiF_BsjE.js → build-profiles.document-DuSvWEO8.js} +1 -1
- package/dist/assets/{build-progress.status-Bf5KpnxC.js → build-progress.status-hkKRXBcc.js} +1 -1
- package/dist/assets/{build-session-C4jVDt-u.js → build-session-B5GOV8fm.js} +1 -1
- package/dist/assets/{build.action-DP2d1Uhj.js → build.action-DUrS97Yw.js} +1 -1
- package/dist/assets/{build.command-D5pyNcoj.js → build.command-fNnr9pdz.js} +1 -1
- package/dist/assets/{build.header-DupBIAOw.js → build.header-C-WQMQD8.js} +1 -1
- package/dist/assets/{build.menu-DWrKtdoV.js → build.menu-CsVJRmY6.js} +1 -1
- package/dist/assets/{build.service-qnz73gSX.js → build.service-CJfK8K6X.js} +1 -1
- package/dist/assets/{camera-C74U5X7o.js → camera-CpvCFt-Y.js} +1 -1
- package/dist/assets/{camera-runtime.inspector-B2l34Xhl.js → camera-runtime.inspector-BwSdtfTT.js} +1 -1
- package/dist/assets/{canvas-design-mount-D4M3E1AX.js → canvas-design-mount-CE-67ZS9.js} +3 -3
- package/dist/assets/{canvas-entry-runtime-CLOuJcgT.js → canvas-entry-runtime-CBpGQGRw.js} +2 -2
- package/dist/assets/{canvas-preview-frames-CSCcu2sG.js → canvas-preview-frames-DoDVjE4O.js} +1 -1
- package/dist/assets/{canvas-story-capture.service-onD_xSpQ.js → canvas-story-capture.service-hibqSqwB.js} +2 -2
- package/dist/assets/{capability-coverage-EnZ99FoT.js → capability-coverage-DWVel6Wq.js} +1 -1
- package/dist/assets/{collaboration-presence-1_UMOAkw.js → collaboration-presence-B9eqNDDB.js} +1 -1
- package/dist/assets/{collider-C6R1tHfa.js → collider-DD5wreOq.js} +1 -1
- package/dist/assets/{component-board.service-BX_2bwX3.js → component-board.service-B1RineLo.js} +2 -2
- package/dist/assets/{component-board.service-Cuf_SXeA.js → component-board.service-eXvcrWzD.js} +2 -2
- package/dist/assets/{component-board.service-Ckl-5tA4.js → component-board.service-r8KlRes9.js} +2 -2
- package/dist/assets/{component-contracts.service-rI-rbvDG.js → component-contracts.service-YWaJqTzM.js} +1 -1
- package/dist/assets/{component-instance-root-wO1p-rLr.js → component-instance-root-BrRLxTKu.js} +1 -1
- package/dist/assets/{component-verbs.command-O2bwqmK3.js → component-verbs.command-D5LCfxHY.js} +1 -1
- package/dist/assets/{component-verbs.service-BiiQMtJt.js → component-verbs.service-BUTHHNRT.js} +1 -1
- package/dist/assets/{config-dVnV1cxW.js → config-DQqPM4dV.js} +2 -2
- package/dist/assets/{configurations-8qaUqMH7.js → configurations-Dn9LLbWO.js} +1 -1
- package/dist/assets/{connection.status-vH9WCDDg.js → connection.status-CMZKs7ch.js} +1 -1
- package/dist/assets/{constraints.inspector-C7UjUxPR.js → constraints.inspector-CRay8pK8.js} +1 -1
- package/dist/assets/{content-bounds-Dl5Y3LLv.js → content-bounds-UvcUv1DD.js} +1 -1
- package/dist/assets/{contract-system-adapters-BDUpDoKd.js → contract-system-adapters-Bbw5uUUi.js} +1 -1
- package/dist/assets/{coverage.service-IS7Oklo8.js → coverage.service-DeTXoRCC.js} +1 -1
- package/dist/assets/{create-runtime-Bucz0XVU.js → create-runtime-Z7LcpKwn.js} +1 -1
- package/dist/assets/{curve-D0Q6TczG.js → curve-DGhnvtG4.js} +1 -1
- package/dist/assets/{data-asset-B0a1y8M-.js → data-asset-CrnqULWS.js} +1 -1
- package/dist/assets/{data-ref-dRt2Wi5L.js → data-ref-ym18xkxV.js} +1 -1
- package/dist/assets/{debug-bridge-EhDkhrLX.js → debug-bridge-BknWW_8M.js} +1 -1
- package/dist/assets/{debug-registry-B2THKz1v.js → debug-registry-C7poEnyY.js} +1 -1
- package/dist/assets/{deferred-ingest-play-To3ZratW.js → deferred-ingest-play-3qS-wvgF.js} +2 -2
- package/dist/assets/{design-time-canvas-mount-BnSaRAbS.js → design-time-canvas-mount-JkGmMINz.js} +2 -2
- package/dist/assets/{design-time-layers-OMAIxOrv.js → design-time-layers-nxUfMfKI.js} +1 -1
- package/dist/assets/{design-time-mount.service-Bgr_nCDs.js → design-time-mount.service-DQganiM8.js} +2 -2
- package/dist/assets/{design-time-mount.service-RFkiqPIn.js → design-time-mount.service-EBZKN6cL.js} +2 -2
- package/dist/assets/{design-time-react-mount-BsSBoX7J.js → design-time-react-mount-COvuTCBY.js} +1 -1
- package/dist/assets/{document-preview-three-Qni0oVBw.js → document-preview-three-BaWpv458.js} +1 -1
- package/dist/assets/{dom-authoring-adapter-DsUgOtQy.js → dom-authoring-adapter-wlPbZwHo.js} +1 -1
- package/dist/assets/{draco3d-DyZllcka.js → draco3d-DdFfLaRu.js} +1 -1
- package/dist/assets/{edit-mode-audio.service-CjXNAZEs.js → edit-mode-audio.service-B74d6zkz.js} +1 -1
- package/dist/assets/{edit-mode-authoring-BDgZD47j.js → edit-mode-authoring-Cf83TffW.js} +1 -1
- package/dist/assets/{edit-mode-networking.service-3dUr2g_0.js → edit-mode-networking.service-C7FSPHzl.js} +1 -1
- package/dist/assets/{editor-api-DTrNJMXL.js → editor-api-DLfSJ2g2.js} +1 -1
- package/dist/assets/{editor-layers-DwaX5UFy.js → editor-layers-BVicagU1.js} +1 -1
- package/dist/assets/{editor-shell-store-aKHbAoCV.js → editor-shell-store-CV73gQk5.js} +1 -1
- package/dist/assets/{entity-object-BLJ-I8XT.js → entity-object-DTQ4I2K5.js} +1 -1
- package/dist/assets/{extend-6LrR7eSL.js → extend-B7YOIXSU.js} +1 -1
- package/dist/assets/{fork-menu-V-FM6YuY.js → fork-menu-BToX8Jv4.js} +1 -1
- package/dist/assets/{frame-debugger-store-DwDC0wAm.js → frame-debugger-store-CuCtiEQ1.js} +1 -1
- package/dist/assets/{game-contract-seams-C22a4B79.js → game-contract-seams-DRUf45xM.js} +1 -1
- package/dist/assets/{game-css-scope-transform-Wv0ZdTsR.js → game-css-scope-transform-rbFoxfMV.js} +1 -1
- package/dist/assets/{game-document.service-BzvFIWCc.js → game-document.service-D409VVnQ.js} +1 -1
- package/dist/assets/{game-eval.command-DpQn_nY8.js → game-eval.command-BJ51kPy3.js} +1 -1
- package/dist/assets/{game-module-access-BI6oBa8Y.js → game-module-access-ib9tWhJc.js} +1 -1
- package/dist/assets/{game-network-Deo8lcPw.js → game-network-BZM-o9Ey.js} +3 -3
- package/dist/assets/{gameplay-export-BOLhxmII.js → gameplay-export-Bsvbs7wO.js} +1 -1
- package/dist/assets/{gameplay-replay-Dkvmv6hf.js → gameplay-replay-k_14DJ5F.js} +1 -1
- package/dist/assets/{gameplay.command-DCKqLv7C.js → gameplay.command-DGVwoOz_.js} +1 -1
- package/dist/assets/{generation-jobs-6D562vMB.js → generation-jobs-BxpAnwDo.js} +1 -1
- package/dist/assets/{generation.service-BFRoLb7y.js → generation.service-D1win2Pl.js} +1 -1
- package/dist/assets/{generations-HwV1btKK.js → generations-Dlu2fhGN.js} +1 -1
- package/dist/assets/{generations.status-BLiDcKsg.js → generations.status-BPYUSGr_.js} +1 -1
- package/dist/assets/{hierarchy-marks-DeG4E4Ke.js → hierarchy-marks-Dn7SO2iG.js} +1 -1
- package/dist/assets/{hosted-asset-materialization-Bod7CEMF.js → hosted-asset-materialization-DPmn23AM.js} +1 -1
- package/dist/assets/{index-CLUA6PYq.js → index-B41IX0yA.js} +1 -1
- package/dist/assets/{index-CyLPQ8pY.js → index-B4NI0L5I.js} +1 -1
- package/dist/assets/{index-DkYeh000.js → index-BjUxirz3.js} +1 -1
- package/dist/assets/{index-KIR4Has5.js → index-C_XSSPHO.js} +1 -1
- package/dist/assets/{index-4hL3-0yz.js → index-Cp9b5Qfa.js} +1 -1
- package/dist/assets/{index-jS3rfNkZ.js → index-D1nMmQxJ.js} +1 -1
- package/dist/assets/{index-ClgrFOcX.js → index-D9shXtZ9.js} +7 -7
- package/dist/assets/{index-CHOT9sYh.js → index-FWtJb07f.js} +2 -2
- package/dist/assets/{index-CdLhNxor.js → index-_-7lUYI-.js} +1 -1
- package/dist/assets/{inference-diagnostics-BmZ5ggEK.js → inference-diagnostics-V4igFQX2.js} +1 -1
- package/dist/assets/{ingest-boot-viewport-CipkFljr.js → ingest-boot-viewport-DBpKatwo.js} +1 -1
- package/dist/assets/{ingest-siblings-CEwYp-xg.js → ingest-siblings-C8OmNNTc.js} +1 -1
- package/dist/assets/{ingest-source-persistence-CVU1rTj0.js → ingest-source-persistence-DH7q9G1S.js} +1 -1
- package/dist/assets/{ingest.service-bNqvcqoK.js → ingest.service-D3Ru3YUS.js} +1 -1
- package/dist/assets/{inspect-BunjdqX7.js → inspect-Bhr2b3pa.js} +1 -1
- package/dist/assets/instances.command-CDIwEW8H.js +1 -0
- package/dist/assets/{json-history-resource-CDEoQe1R.js → json-history-resource-B8_YpeAT.js} +1 -1
- package/dist/assets/{layered-pick-guh6WlA7.js → layered-pick-MdBIQeUt.js} +1 -1
- package/dist/assets/{light-BPZivpCK.js → light-BvCKNW4e.js} +1 -1
- package/dist/assets/{live-project-verbs-Bqmxbr2o.js → live-project-verbs-DggWGgn-.js} +1 -1
- package/dist/assets/{machine.document-CAFPFq5K.js → machine.document-CTyXmK5a.js} +1 -1
- package/dist/assets/{machines.finder-CbUWReMp.js → machines.finder-C6WR7N-k.js} +1 -1
- package/dist/assets/{material-huG6lNEK.js → material-BoHGaIcq.js} +1 -1
- package/dist/assets/{material-factory-BkyOzJ7B.js → material-factory-D-cyMEti.js} +1 -1
- package/dist/assets/{mesh-CjCfRcFK.js → mesh-B-ksBKUU.js} +1 -1
- package/dist/assets/{model-asset-sections.service-Dt4V2K2v.js → model-asset-sections.service-DHsGD1SZ.js} +1 -1
- package/dist/assets/{model-inspection-BDA5jikL.js → model-inspection-Bsfj6b48.js} +1 -1
- package/dist/assets/{model-thumbnail-CF3qGQWb.js → model-thumbnail-Bp-1yQ-X.js} +1 -1
- package/dist/assets/{models.finder-yh4YeGrA.js → models.finder-DksRlbR8.js} +1 -1
- package/dist/assets/{module-mode-D8en13PD.js → module-mode-qROy_5Tk.js} +2 -2
- package/dist/assets/{mount-canvas-ingest-root-JOkm2Ypj.js → mount-canvas-ingest-root-CLbJS_Ob.js} +2 -2
- package/dist/assets/{mount-dom-ingest-root-CVXFnJZb.js → mount-dom-ingest-root-CI7VtdaS.js} +2 -2
- package/dist/assets/{mount-ingest-root-C3o0o28C.js → mount-ingest-root-BX_usF8y.js} +2 -2
- package/dist/assets/{mount-manifest-d7WQ9MYp.js → mount-manifest-lQBlK2Y1.js} +1 -1
- package/dist/assets/{mount-three-ingest-root-Dqd4XWP1.js → mount-three-ingest-root-g6yhs1S-.js} +1 -1
- package/dist/assets/{mounted-authoring-B697dYuN.js → mounted-authoring-D5cvzNXX.js} +1 -1
- package/dist/assets/{mounted-story-viewport-source-BvNZ3QQn.js → mounted-story-viewport-source-C-RZo_xH.js} +1 -1
- package/dist/assets/{native-debug-module-iX2-V5kg.js → native-debug-module-Bh_HQdg_.js} +1 -1
- package/dist/assets/{navigation-CIl9OY1F.js → navigation-DVO5eQO6.js} +1 -1
- package/dist/assets/{navmesh.menu-DrMoj7Ag.js → navmesh.menu-Cu9R-p4V.js} +1 -1
- package/dist/assets/{navmesh.service-CTr1NVfz.js → navmesh.service-D6EeQxE0.js} +1 -1
- package/dist/assets/network-observer.service-CLE3M7gH.js +1 -0
- package/dist/assets/{network.utility-Btexm5ao.js → network.utility-D4Uo1xUC.js} +1 -1
- package/dist/assets/{object3d-document-session-registry-CADiW-LP.js → object3d-document-session-registry-bor-eSgr.js} +2 -2
- package/dist/assets/{oid-transform-Ca1oU_Ei.js → oid-transform-rEmA5PfE.js} +1 -1
- package/dist/assets/{particles-D1oPwNJh.js → particles-BxlIkQUX.js} +1 -1
- package/dist/assets/{pixi-authoring-adapter-B1BBfTju.js → pixi-authoring-adapter-CTSRtvNw.js} +1 -1
- package/dist/assets/{pixi-live-write-target-BcUhtqmJ.js → pixi-live-write-target-DaUAvNu7.js} +1 -1
- package/dist/assets/{play.command-ScnwcvJr.js → play.command-BtV56gUr.js} +2 -2
- package/dist/assets/{presentation-DPfnCjNA.js → presentation-DxTT40_3.js} +1 -1
- package/dist/assets/{product-D_9saRiZ.js → product-BAGhTFHw.js} +1 -1
- package/dist/assets/{profiler.action-PXTw93E5.js → profiler.action-DaSS1RoY.js} +1 -1
- package/dist/assets/{profiler.menu-DPFV6QQD.js → profiler.menu-5OyI3lyY.js} +1 -1
- package/dist/assets/{profiler.utility-eDooJGnI.js → profiler.utility-DLzaMOPh.js} +1 -1
- package/dist/assets/{project-authoring-session-BmeutotA.js → project-authoring-session-DZOgiTch.js} +2 -2
- package/dist/assets/{properties-bone-constraints.inspector-BW0V1WXQ.js → properties-bone-constraints.inspector-JMlHKfN2.js} +1 -1
- package/dist/assets/{properties-bone.inspector-DIvTZhY8.js → properties-bone.inspector-C-c7iGEx.js} +1 -1
- package/dist/assets/{properties-collection.inspector-Dbt5XMhs.js → properties-collection.inspector-PXHDUs1b.js} +1 -1
- package/dist/assets/{properties-constraints.inspector-5SvB0GDC.js → properties-constraints.inspector-CQnnGi1O.js} +1 -1
- package/dist/assets/{properties-data.inspector-C-SngIsI.js → properties-data.inspector-DuEPeVBm.js} +1 -1
- package/dist/assets/{properties-material.inspector-CYAWsvsX.js → properties-material.inspector-BhKP0Zc_.js} +1 -1
- package/dist/assets/{properties-modifiers.inspector-XN6BL-Ll.js → properties-modifiers.inspector-lOMb72vk.js} +1 -1
- package/dist/assets/{properties-object.inspector-CfryU0kN.js → properties-object.inspector-BU2hn26Q.js} +1 -1
- package/dist/assets/{properties-output.inspector-COfgmFUW.js → properties-output.inspector-yNaC3IgX.js} +1 -1
- package/dist/assets/{properties-particles.inspector-BCh0vFr6.js → properties-particles.inspector-CaHfdQZB.js} +1 -1
- package/dist/assets/{properties-physics.inspector-B6to1u6U.js → properties-physics.inspector-Bt9Xjyu-.js} +1 -1
- package/dist/assets/{properties-render.inspector-C4hVfo7j.js → properties-render.inspector-Cl8UBLPY.js} +1 -1
- package/dist/assets/{properties-scene.inspector-dKta4xn5.js → properties-scene.inspector-D9cgONMx.js} +1 -1
- package/dist/assets/{properties-texture.inspector-ZlNhW25m.js → properties-texture.inspector-804GEF8F.js} +1 -1
- package/dist/assets/{properties-view-layer.inspector-CIxHmkDR.js → properties-view-layer.inspector-CLo0Z-B1.js} +1 -1
- package/dist/assets/{properties-world.inspector-Ce0q2dmK.js → properties-world.inspector-CjywenDE.js} +1 -1
- package/dist/assets/{r3f-design-session-1riISktt.js → r3f-design-session-B2k02ypD.js} +2 -2
- package/dist/assets/{r3f-physics-binding-DuG97FR9.js → r3f-physics-binding-D1rgVgsz.js} +1 -1
- package/dist/assets/{r3f-source-authoring-adapter-B8qqrdwk.js → r3f-source-authoring-adapter-Dj0r13-b.js} +1 -1
- package/dist/assets/{react-canvas-navigation-CxBm8iw8.js → react-canvas-navigation-t00NiEKB.js} +1 -1
- package/dist/assets/{react-inspector.service-BcdePwno.js → react-inspector.service-Xp4f-M0O.js} +1 -1
- package/dist/assets/{react-story-board-CMvkLAkF.js → react-story-board-DAQaZNga.js} +1 -1
- package/dist/assets/{react-three-rapier.esm-D5svf-ME.js → react-three-rapier.esm-D13B7Exz.js} +1 -1
- package/dist/assets/{react-world-authoring-adapter-Dq8NqvWu.js → react-world-authoring-adapter-zzyaxcpN.js} +1 -1
- package/dist/assets/{realm-services-CqjVBanw.js → realm-services-CyeBcuLZ.js} +1 -1
- package/dist/assets/{reflection-probe-capture.inspector-uEvyppEj.js → reflection-probe-capture.inspector-BpdGQ2gf.js} +1 -1
- package/dist/assets/{registry-D7lFIA8c.js → registry-DM1tIelZ.js} +1 -1
- package/dist/assets/{relative-import-specifier-CA9mSNXO.js → relative-import-specifier-txHdCBKR.js} +1 -1
- package/dist/assets/{render-env-BHasp-z3.js → render-env-DiO35wd3.js} +1 -1
- package/dist/assets/{render-features-sSb1-c5x.js → render-features-Bv3_74_x.js} +1 -1
- package/dist/assets/{render-settings-CUbo4Sw5.js → render-settings-8kb_yvkr.js} +1 -1
- package/dist/assets/{resolve-three-TQ367RQD.js → resolve-three-D9rgCC5Z.js} +3 -3
- package/dist/assets/{root-seam-contract-CneTgNww.js → root-seam-contract-BgkkJVuJ.js} +1 -1
- package/dist/assets/{run-selection-CNsOQTEG.js → run-selection-WrcYgYP3.js} +1 -1
- package/dist/assets/{scene-capture-KbdRgsD3.js → scene-capture-C08wT5TW.js} +1 -1
- package/dist/assets/{scene-document.service-CmPSUocW.js → scene-document.service-D7sb6hvQ.js} +2 -2
- package/dist/assets/{scene-framing-B5JC4NeG.js → scene-framing-BSvegpi4.js} +1 -1
- package/dist/assets/{seeded-random-B6zqGkWP.js → seeded-random-Bc5190so.js} +1 -1
- package/dist/assets/{setup-renderer-efjIBSGF.js → setup-renderer-JwrNwzqH.js} +1 -1
- package/dist/assets/{source-object3d-authoring-adapter-DeeboYub.js → source-object3d-authoring-adapter-BJwLQVsv.js} +1 -1
- package/dist/assets/{source-persistence-backend-Cwy93SmQ.js → source-persistence-backend-DsG30XMj.js} +1 -1
- package/dist/assets/{stage-keyboard-GNCaTXLA.js → stage-keyboard-BnzybgXw.js} +1 -1
- package/dist/assets/{stage-overlay-set-DV3SCzJb.js → stage-overlay-set-BWxO_Pk6.js} +1 -1
- package/dist/assets/{stage-presence-markers-CBEU1Kzo.js → stage-presence-markers-BD5JPVX6.js} +1 -1
- package/dist/assets/{stage-transform-tools-C9nNDW6n.js → stage-transform-tools-CHvXlnKB.js} +1 -1
- package/dist/assets/{standard-viewport-dressing-BJkGwiNT.js → standard-viewport-dressing-4xAZCGJ3.js} +1 -1
- package/dist/assets/{state-watch.action-Doz_jrzS.js → state-watch.action-0KAywung.js} +1 -1
- package/dist/assets/{state-watch.menu-Dj4DUUxN.js → state-watch.menu-4xjTZIEx.js} +1 -1
- package/dist/assets/{state-watch.utility-COPa8xpV.js → state-watch.utility-DZgzPGEZ.js} +1 -1
- package/dist/assets/{story-capture-stRSY4PQ.js → story-capture-d695eMLJ.js} +1 -1
- package/dist/assets/{story-documents-CYzWYY1o.js → story-documents-C1hZeYU3.js} +1 -1
- package/dist/assets/{story-documents.service-DJBu4rve.js → story-documents.service-CSXB6uqT.js} +1 -1
- package/dist/assets/{story-documents.service-C5r8KFEG.js → story-documents.service-bB0UDbvA.js} +1 -1
- package/dist/assets/{story-media-presence-D4AIsAtK.js → story-media-presence-CxD6G_Mu.js} +1 -1
- package/dist/assets/{story-pixi-preview-mPo3OFOd.js → story-pixi-preview-CJKGDBKs.js} +1 -1
- package/dist/assets/{story-presentation-Dw4Vw65P.js → story-presentation-BBS9x4BP.js} +1 -1
- package/dist/assets/{story-three-preview-CWM0Rj7x.js → story-three-preview-v22RRpqB.js} +2 -2
- package/dist/assets/{studio-environment-Bw9zMFE8.js → studio-environment-CvCEc6PK.js} +1 -1
- package/dist/assets/{surface-state-b_H4iOCJ.js → surface-state-EsG-yMSi.js} +1 -1
- package/dist/assets/{syntactic-prop-specs-BCdwWi-T.js → syntactic-prop-specs-DvSr6VoQ.js} +1 -1
- package/dist/assets/{team-playtest.service-CnxdTghn.js → team-playtest.service-Bp6j6MAv.js} +1 -1
- package/dist/assets/{three-DWy0sZom.js → three-Do16bEo9.js} +1 -1
- package/dist/assets/{three-authoring-adapter-9LcUBPaU.js → three-authoring-adapter-C2QFVlpK.js} +1 -1
- package/dist/assets/three-authoring.service-DxL4grJx.js +2 -0
- package/dist/assets/{three-ingest-runtime-x9nLmUl-.js → three-ingest-runtime-DW-lHDmp.js} +1 -1
- package/dist/assets/{three-integration-DB-xQHD5.js → three-integration-C1onOQwq.js} +2 -2
- package/dist/assets/three-integration.service-26hsEOk3.js +1 -0
- package/dist/assets/{three-projection-core-IUovHgg_.js → three-projection-core-1FETWj5n.js} +1 -1
- package/dist/assets/{three-state-_ImCbP87.js → three-state-d-szeOea.js} +1 -1
- package/dist/assets/{three-story-capture.service-wKwfSnqA.js → three-story-capture.service-gnrRzcjj.js} +2 -2
- package/dist/assets/{three-story-model-BxWKcl9d.js → three-story-model-CbEMWEte.js} +1 -1
- package/dist/assets/{three-viewport-presentation-Bg86EsDJ.js → three-viewport-presentation-D1ysWIW4.js} +1 -1
- package/dist/assets/{transform-mode-request-BnV8FSnx.js → transform-mode-request-B3AxgwGW.js} +1 -1
- package/dist/assets/{transport-strip-BZQnaxFN.js → transport-strip-D4N14xHx.js} +1 -1
- package/dist/assets/transport.header-D3j_V-tN.js +1 -0
- package/dist/assets/{tuples-DR33sMq6.js → tuples-B3URXxaa.js} +1 -1
- package/dist/assets/{ui-board-document-VJMvm6Ks.js → ui-board-document-BSrfzH8L.js} +2 -2
- package/dist/assets/{user-data-DL6HsBPf.js → user-data-DHB4MWum.js} +1 -1
- package/dist/assets/{utility-view-state-ghWXsYXq.js → utility-view-state-CfZ51NRS.js} +1 -1
- package/dist/assets/{viewport-door-BV_lf5uK.js → viewport-door-DkDcO9tp.js} +1 -1
- package/dist/assets/{viewport-root-presentation-CKqhX3mt.js → viewport-root-presentation-DtuBFJ-J.js} +1 -1
- package/dist/assets/{viewport-surface-status-D7M2L2lI.js → viewport-surface-status-HKbJtC2G.js} +1 -1
- package/dist/assets/{webworkerAll-DDbFvxgB.js → webworkerAll-JD3yAUg1.js} +1 -1
- package/dist/assets/{workspace-arrangement-86_8Kk5K.js → workspace-arrangement-BOk46mGq.js} +1 -1
- package/dist/assets/{world-documents-DeNJUefV.js → world-documents-AnhAH_9y.js} +1 -1
- package/dist/assets/{world-root-stage-binding-VOrldLB4.js → world-root-stage-binding-H0SUNbfK.js} +1 -1
- package/dist/assets/{xstate-animation-binding-747CfEeB.js → xstate-animation-binding-BjWKb5ne.js} +1 -1
- package/dist/assets/{xstate-animation-meta-DNMlMnr-.js → xstate-animation-meta-CTBp-Vc5.js} +1 -1
- package/dist-node/cli.js +16 -16
- package/package.json +16 -16
- package/dist/assets/InspectorObjectPreview-C87CasN_.js +0 -1
- package/dist/assets/Object3DDocumentViewport-BpiyRQ5p.js +0 -2
- package/dist/assets/autoplay.service-CKBqjozr.js +0 -1
- package/dist/assets/instances.command-DzcXdKuG.js +0 -1
- package/dist/assets/network-observer.service-DyzpGKA7.js +0 -1
- package/dist/assets/three-authoring.service-DdTMF4A2.js +0 -2
- package/dist/assets/three-integration.service-DwToRGIc.js +0 -1
- package/dist/assets/transport.header-1SF4ZbEd.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RectAreaLightUniformsLib-DpPyArRG.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as To,b as So,L as Po}from"./LineSegments2-DN9pUfWA.js";import{bh as ut,cl as Eo,fo as b,cm as q,N as re,a$ as Rt,em as Pn,b4 as ca,co as kt,ey as ua,cp as je,_ as Mt,ej as Ht,fd as ne,er as da,M as lt,cj as wt,dp as St,aV as ma,cW as Ve,aE as No,c7 as xt,j as _a,f6 as ha,fp as Xe,au as Ye,dw as Ze,bi as En,aT as pa,c1 as oe,dd as _n,eC as hn,e7 as ke,aw as xe,da as Zt,I as me,as as ga,e8 as va,b0 as Ro,K as xa,B as ba,b9 as ya,Y as Io,cw as ae,ed as wa,cA as Oa,ch as Aa,fx as Ma,db as Do,el as Ta,R as Sa,e6 as Pa,c0 as zo,bX as Ea,aI as Be,ao as Na,eG as Ra,d3 as Ia,cs as Da,b5 as Ke,bu as Co,aM as Fo,a_ as za,E as Ae,ex as Nn,cO as Ue,cY as Ca,eU as Fa,cE as pn,c5 as ko,at as ka,ff as $a,eW as La,f7 as ja,F as Va,ev as Ba,et as Ua,dq as Wa,fq as qa,n as Ha,l as Ga,cf as Xa}from"./three.core-3arARmh6.js";import{u as R,v as j,w as z,c5 as et,c4 as Q,c6 as I,e2 as W,_ as Ya,mB as $o,d_ as Gt,x as Z,kE as Ot,e1 as Lo,mC as Y,dZ as Za,mD as Ka}from"./index-
|
|
2
|
+
import{a as To,b as So,L as Po}from"./LineSegments2-DN9pUfWA.js";import{bh as ut,cl as Eo,fo as b,cm as q,N as re,a$ as Rt,em as Pn,b4 as ca,co as kt,ey as ua,cp as je,_ as Mt,ej as Ht,fd as ne,er as da,M as lt,cj as wt,dp as St,aV as ma,cW as Ve,aE as No,c7 as xt,j as _a,f6 as ha,fp as Xe,au as Ye,dw as Ze,bi as En,aT as pa,c1 as oe,dd as _n,eC as hn,e7 as ke,aw as xe,da as Zt,I as me,as as ga,e8 as va,b0 as Ro,K as xa,B as ba,b9 as ya,Y as Io,cw as ae,ed as wa,cA as Oa,ch as Aa,fx as Ma,db as Do,el as Ta,R as Sa,e6 as Pa,c0 as zo,bX as Ea,aI as Be,ao as Na,eG as Ra,d3 as Ia,cs as Da,b5 as Ke,bu as Co,aM as Fo,a_ as za,E as Ae,ex as Nn,cO as Ue,cY as Ca,eU as Fa,cE as pn,c5 as ko,at as ka,ff as $a,eW as La,f7 as ja,F as Va,ev as Ba,et as Ua,dq as Wa,fq as qa,n as Ha,l as Ga,cf as Xa}from"./three.core-3arARmh6.js";import{u as R,v as j,w as z,c5 as et,c4 as Q,c6 as I,e2 as W,_ as Ya,mB as $o,d_ as Gt,x as Z,kE as Ot,e1 as Lo,mC as Y,dZ as Za,mD as Ka}from"./index-D9shXtZ9.js";import{S as Kt}from"./three.module-BLhyNg0e.js";import{t as Qa}from"./blender-runtime-host-rAbOjzv5.js";const gn=new Set;function _t(){for(const n of[...gn])n()}function Ja(n){return gn.add(n),()=>{gn.delete(n)}}function vn(n){const t=atob(n),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);return e}const _e=I().finite(),tr=R({name:z(),parent:z().nullable(),connected:et(),hide:et(),length:_e,matrix:j(W([_e,_e,_e,_e])).length(4),select:et(),active:et(),lockedWeight:et()}).strict(),er=R({object:z(),displayType:Q(["OCTAHEDRAL","STICK","BBONE","ENVELOPE","WIRE"]),showInFront:et(),mode:z(),bones:j(tr)}).strict(),Nt={solid:11711154,pose:5294335,poseActive:9240575,poseActiveUnsel:794150,wire:0,vertex:0,lockedWeight:16711680,lockedWeightFactor:128/255};function nr(n){return new Mt(n.r*n.r*.1,n.g*n.g*.1,n.b*n.b*.1)}const Qe=[[0,0,0],[.1,.1,.1],[.1,.1,-.1],[-.1,.1,-.1],[-.1,.1,.1],[0,1,0]],Bn=[[2,1,0],[3,2,0],[4,3,0],[1,4,0],[5,1,2],[5,2,3],[5,3,4],[5,4,1]],Vt=Math.SQRT1_2,or=[[Vt,-Vt,0],[0,-Vt,-Vt],[-Vt,-Vt,0],[0,-Vt,Vt],[.99388373,.11043154,0],[0,.11043154,-.99388373],[-.99388373,.11043154,0],[0,.11043154,.99388373]],ar=[[0,1],[1,5],[5,3],[3,0],[0,4],[4,5],[5,2],[2,0],[1,2],[2,3],[3,4],[4,1]],rr=.05;function Un(n){return n.select||n.active?2:1}const sr=10,ir=4,lr=`
|
|
3
3
|
attribute vec3 aSolid;
|
|
4
4
|
attribute vec3 aHint;
|
|
5
5
|
varying vec3 vColor;
|
|
@@ -7191,4 +7191,4 @@ vec3 volterWorkbenchLighting(vec3 baseColor, vec3 N, vec3 I) {
|
|
|
7191
7191
|
}
|
|
7192
7192
|
`,jn=n=>zn.map(t=>{const[e=0,o=0,r=0]=n(t);return new b(e,o,r)}),pi=jn(n=>n.direction).map(n=>n.normalize()),gi=jn(n=>n.diffuse),vi=jn(n=>n.specular),xi=new Xe(...zn.map(n=>n.smooth));function bi(n,t){const[e,o,r]=n.color,a=new Da({side:t});return a.color.setRGB(e,o,r,xt),a.name="volter:blender-solid",a.onBeforeCompile=s=>{s.uniforms.wbDir={value:pi},s.uniforms.wbDiffuse={value:gi},s.uniforms.wbSpecular={value:vi},s.uniforms.wbWrap={value:xi},s.uniforms.wbRoughness={value:n.roughness},s.uniforms.wbMetallic={value:n.metallic},s.fragmentShader=s.fragmentShader.replace("void main() {",`${hi}
|
|
7193
7193
|
void main() {`).replace("#include <opaque_fragment>",`outgoingLight = volterWorkbenchLighting(diffuseColor.rgb, normal, isOrthographic ? vec3(0.0, 0.0, 1.0) : normalize(vViewPosition));
|
|
7194
|
-
#include <opaque_fragment>`)},a.customProgramCacheKey=()=>"volter-blender-workbench",a}const yi=64;function wi(n,t){return Array.isArray(n)&&Array.isArray(t)?n.length===t.length&&n.every((e,o)=>e===t[o]):n===t}function He(n){return n.onBeforeRender===Ve.prototype.onBeforeRender&&n.onAfterRender===Ve.prototype.onAfterRender}function ee(n){for(let t=n;t;t=t.parent)if(!t.visible)return!1;return!0}function Tn(n){if(n.determinant()<=0)return!1;const t=n.elements,e=Math.hypot(t[0],t[1],t[2]),o=Math.hypot(t[4],t[5],t[6]),r=Math.hypot(t[8],t[9],t[10]),a=(s,f)=>t[s]*t[f]+t[s+1]*t[f+1]+t[s+2]*t[f+2];return Number.isFinite(e+o+r)&&Math.min(e,o,r)>0&&Math.abs(a(0,4))<=1e-7*e*o&&Math.abs(a(0,8))<=1e-7*e*r&&Math.abs(a(4,8))<=1e-7*o*r}class Oi{constructor(t){this.root=t,this.batches=[],this.inverse=new q,this.matrix=new q,this.box=new me,this.projection=new q,this.frustum=new Ke,this.camera=null,this.eligible=0,this.excluded={}}rebuild(t,e){if(this.clear(),!e)return;const o=new Map,r=a=>{this.excluded[a]=(this.excluded[a]??0)+1};this.inverse.copy(this.root.matrixWorld).invert();for(const a of t){const s=a;if(!s.isMesh)continue;if(!He(s)){r("customHooks");continue}if(s.isSkinnedMesh||s.isInstancedMesh||s.morphTargetInfluences||s.layers.mask!==1){r("deformationOrLayers");continue}const f=Array.isArray(s.material)?s.material:[s.material];if(f.some(l=>l.transparent||l.transmission>0||l.isShaderMaterial||!Te(l))){r("material");continue}if(f.some(l=>ta(l,s.geometry).size>12)){r("attributeBudget");continue}if(this.matrix.multiplyMatrices(this.inverse,s.matrixWorld),!Tn(this.matrix)){r("transform");continue}this.eligible++;const c=`${s.geometry.id}:${Array.isArray(s.material)?"slots":"single"}:`+f.map(l=>l.uuid).join(",")+`:${s.renderOrder}`,d=o.get(c);d?d.push(s):o.set(c,[s])}for(const a of o.values()){if(a.length<2)continue;const s=f=>{if(f.length>yi){this.box.makeEmpty();for(const h of f)this.box.expandByPoint(new b().setFromMatrixPosition(h.matrixWorld));const i=this.box.getSize(new b),u=i.x>=i.y&&i.x>=i.z?12:i.y>=i.z?13:14;f.sort((h,_)=>h.matrixWorld.elements[u]-_.matrixWorld.elements[u]);const m=Math.floor(f.length/2);s(f.slice(0,m)),s(f.slice(m));return}if(f.length<2)return;const c=f[0],d=new Co(c.geometry,c.material,f.length);d.name="Blender repeated geometry",d.userData.engineInternal=!0,d.matrixAutoUpdate=!1,d.renderOrder=c.renderOrder,d.instanceMatrix.setUsage(Fo);const l={draw:d,members:f.map(i=>({mesh:i,layers:i.layers.mask}))};d.raycast=(i,u)=>{for(const{mesh:m}of l.members)m.layers.mask===0&&ee(m)&&m.raycast(i,u)},this.root.add(d),d.updateMatrixWorld(!0),this.batches.push(l)};s(a)}this.sync()}sync(){if(this.batches.length){this.inverse.copy(this.root.matrixWorld).invert();for(const{draw:t,members:e}of this.batches){const r=(Array.isArray(t.material)?t.material:[t.material]).every(Te);let a=0,s=!1;for(const f of e){const{mesh:c}=f;if(this.matrix.multiplyMatrices(this.inverse,c.matrixWorld),!(c.parent!==null&&c.geometry===t.geometry&&r&&He(c)&&wi(c.material,t.material)&&Tn(this.matrix))){c.layers.mask|=f.layers;continue}if(c.layers.mask&=~f.layers,!ee(c)||this.camera&&(!this.camera.layers.isEnabled(0)||c.frustumCulled&&!this.frustum.intersectsObject(c)))continue;const l=a*16;this.matrix.elements.some((i,u)=>Math.fround(i)!==t.instanceMatrix.array[l+u])&&(t.setMatrixAt(a,this.matrix),s=!0),a++}s||=t.count!==a||t.boundingSphere===null,t.count=a,s&&(t.instanceMatrix.needsUpdate=!0,t.computeBoundingBox(),t.computeBoundingSphere())}}}prepareDraw(t){t.updateMatrixWorld(),this.camera=t,this.projection.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this.frustum.setFromProjectionMatrix(this.projection)}finishDraw(){this.camera=null}clear(){this.camera=null;for(const{draw:t,members:e}of this.batches){for(const{mesh:o,layers:r}of e)o.layers.mask|=r;t.removeFromParent(),t.dispose()}this.batches.length=0,this.eligible=0,this.excluded={}}inspect(){return{batches:this.batches.length,instances:this.batches.reduce((t,{draw:e})=>t+e.count,0),eligible:this.eligible,excluded:{...this.excluded}}}}const Sn=64,cn=4*1024*1024,Ai=32*1024*1024,Mi=1024;class Ti{constructor(){this.families=new Map,this.partitions=new Map,this.registrations=new Map,this.bytes=0,this.drawCount=0,this.created=0,this.pending=!1}begin(){this.created=0,this.pending=!1,this.registrations.clear()}register(t,e,o){const r=`${t.id}:${e.uuid}:${o}`;if(this.registrations.has(r))return this.registrations.get(r);this.registrations.set(r,null);const a=t.getAttribute("position"),s=t.index?.count??a?.count??0;if(!a||t.drawRange.start!==0||t.drawRange.count<s||Object.keys(t.morphAttributes).length)return null;const f=[!!t.index,t.userData.blenderUvChannels??null],c=[t.index?.id,t.index?.version];let d=(t.index?.count??0)*4;for(const p of Object.keys(t.attributes).sort()){const g=t.getAttribute(p);if(!(g instanceof lt)||g.isInstancedBufferAttribute||g instanceof za||g.count!==a.count)return null;f.push([p,g.array.constructor.name,g.itemSize,g.normalized,g.gpuType]),c.push(p,g.id,g.version),d+=g.array.byteLength}if(d>cn)return null;const l=`multi:${e.uuid}:${o}:${JSON.stringify(f)}`;let i=this.partitions.get(l);i||(i=[],this.partitions.set(l,i));let u=i.find(p=>this.families.get(p).shapes.has(t.id));u??=i.find(p=>this.families.get(p).reservedBytes+d<=cn),u||(u=`${l}:${i.length}`,i.push(u));let m=this.families.get(u);m||(m={material:e,shapes:new Map,template:null,ids:new Map,draws:[],dirty:!0,bytes:0,reservedBytes:0,refused:!1},this.families.set(u,m));const h=JSON.stringify(c),_=m.shapes.get(t.id);return(!_||_.stamp!==h)&&(m.reservedBytes+=d-(_?.bytes??0),m.shapes.set(t.id,{geometry:t,stamp:h,bytes:d}),m.dirty=!0),this.registrations.set(r,u),u}pack(){for(const t of this.families.values()){if(!t.dirty)continue;this.release(t),t.dirty=!1;let e=0,o=0,r=0;for(const{geometry:f}of t.shapes.values()){e+=f.getAttribute("position").count,o+=f.index?.count??0;for(const c of Object.values(f.attributes))r+=c.array.byteLength}if(r+=o*(e>65535?4:2),t.refused=r>cn||this.bytes+r>Ai,t.refused)continue;const a=new Ae(Sn,e,o,t.material);a.sortObjects=!1,a.perObjectFrustumCulled=!1,a.frustumCulled=!1,a.matrixAutoUpdate=!1,a.boundingSphere=new Nn,a.name="Blender ordered multi-draw",a.userData.engineInternal=!0;for(const{geometry:f}of t.shapes.values())t.ids.set(f.id,a.addGeometry(f));const s=t.shapes.values().next().value.geometry;a.geometry.userData.blenderUvChannels=s.userData.blenderUvChannels;for(const f of Object.keys(s.attributes))a.geometry.getAttribute(f).gpuType=s.getAttribute(f).gpuType;t.template=a,t.bytes=r,this.bytes+=r}}available(t){return!!this.families.get(t)?.template}get(t,e){const o=this.families.get(t),r=o.template;if(!r)return null;let a=o.draws[e];if(!a){if(this.drawCount>=Mi)return null;if(this.created>=4)return this.pending=!0,null;a=new Ae(1,0,0,o.material),a.dispose(),a.copy(r),Object.defineProperty(a,"colorTexture",{value:null});for(const f of Object.keys(r.geometry.attributes))a.geometry.setAttribute(f,r.geometry.getAttribute(f));a.geometry.setIndex(r.geometry.index);const s=o.ids.values().next().value;for(let f=0;f<Sn;f++)a.addInstance(s),a.setVisibleAt(f,!1);o.draws.push(a),this.created++,this.drawCount++}return a}geometryId(t,e){return this.families.get(t).ids.get(e.id)}inspect(){return{bytes:this.bytes,draws:this.drawCount,pending:this.pending,refusedFamilies:[...this.families.values()].filter(t=>t.refused).length}}release(t){for(const e of t.draws){e.removeFromParent();for(const o of Object.keys(e.geometry.attributes))e.geometry.deleteAttribute(o);e.geometry.setIndex(null),e.dispose(),this.drawCount--}t.draws.length=0,t.template?.dispose(),t.template=null,t.ids.clear(),this.bytes-=t.bytes,t.bytes=0}clear(){for(const t of this.families.values())this.release(t);this.families.clear(),this.partitions.clear(),this.registrations.clear(),this.pending=!1}}const bo=128;class Si{constructor(){this.sources=new Map,this.geometryKeys=new Map,this.frame=0,this.count=0}begin(){this.frame++,this.geometryKeys.clear()}get(t,e){let o=this.geometryKeys.get(e.geometry);o===void 0&&(o=JSON.stringify([e.geometry.userData.blenderUvChannels??null,Object.keys(e.geometry.attributes).sort().map(f=>[f,e.geometry.getAttribute(f).itemSize])]),this.geometryKeys.set(e.geometry,o));const r=`${e instanceof Ae?"batch":"instance"}:${o}`;let a=this.sources.get(t);a||(a=new Map,this.sources.set(t,a));let s=a.get(r);if(s)s.frame!==this.frame&&(s.ready=mo(t,s.material)!==null,s.sourceVersion!==t.version&&(s.material.needsUpdate=!0),s.sourceVersion=t.version,s.frame=this.frame);else{if(this.count>=bo)return t;const f=mo(t);if(!f)return t;s={material:f,sourceVersion:t.version,frame:this.frame,ready:!0},a.set(r,s),this.count++}return s.ready?s.material:t}clear(){for(const t of this.sources.values())for(const{material:e}of t.values())e.dispose();this.sources.clear(),this.geometryKeys.clear(),this.count=0}inspect(){return{variants:this.count,limit:bo}}}const ie=Sn;function yo(n){for(let t=n.parent;t;t=t.parent)if(t.isGroup)return t.renderOrder;return 0}class Pi{constructor(t){this.root=t,this.objects=[],this.drawMaterials=new Si,this.ordered=new Ti,this.mixedDraws=new Map,this.multiDraw=!1,this.pools=new Map,this.hidden=[],this.inverse=new q,this.matrix=new q,this.projection=new q,this.frustum=new Ke,this.centre=new b,this.depth=new Xe,this.batches=0,this.instances=0,this.excluded={},this.plannedProjection=new q,this.projectionKnown=!1,this.planState=[],this.planned=[],this.stateIndex=0,this.stateChanged=!1}setObjects(t){this.clear(),this.objects=[...t].filter(e=>e.isMesh===!0)}prepare(t,e=!1){if(this.finishDraw(),this.drawMaterials.begin(),!this.objects.length)return;t.updateMatrixWorld(),this.projection.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);const o=this.multiDraw!==e;if(this.multiDraw=e,!this.planChanged(t)&&!o&&!this.ordered.pending){for(const c of this.planned){c.mesh.visible=!0;const d=c.members[0].material;c.mesh.material=this.drawMaterials.get(Array.isArray(d)?d[0]:d,c.mesh);for(const l of c.members)l.layers.disable(0),this.hidden.push(l)}return}this.planned.length=0;for(const c of this.mixedDraws.values())c.members.length=0;this.ordered.begin();for(const c of this.pools.values())for(const d of c)d.mesh.visible=!1,d.members.length=0;this.batches=this.instances=0,this.excluded={},this.frustum.setFromProjectionMatrix(this.projection),this.inverse.copy(this.root.matrixWorld).invert();const a=[],s=new Map;for(const c of this.objects){const d=Array.isArray(c.material)?c.material:[c.material];if(!d.some(v=>v.visible&&v.transparent)||!ee(c)||!c.layers.test(t.layers)||c.frustumCulled&&!this.frustum.intersectsObject(c))continue;const l=c;l.boundingSphere!==void 0?(l.boundingSphere===null&&l.computeBoundingSphere?.(),this.centre.copy(l.boundingSphere.center)):(c.geometry.boundingSphere||c.geometry.computeBoundingSphere(),this.centre.copy(c.geometry.boundingSphere.center)),this.centre.applyMatrix4(c.matrixWorld);const i=this.centre.clone(),u=this.depth.set(i.x,i.y,i.z,1).applyMatrix4(this.projection).z;let m=null,h=null;const _=d.length===1?d[0]:null,p=yo(c);if(_&&_.visible&&_.transparent&&Te(_)&&He(c)&&!_.isShaderMaterial&&!(_.transmission>0)&&(_.side!==Be||_.forceSinglePass)&&!c.isSkinnedMesh&&!c.morphTargetInfluences&&!c.isInstancedMesh&&c.layers.mask===1&&p===this.root.renderOrder){const v=c.geometry,w=v.index?.count??v.getAttribute("position").count,x=!Array.isArray(c.material)||v.groups.length===1&&v.groups[0].start===0&&v.groups[0].count===w&&v.groups[0].materialIndex===0,T=`${v.id}:${_.uuid}:${c.renderOrder}`;let y=s.get(T);y===void 0&&(y=ta(_,v).size<=12,s.set(T,y)),this.matrix.multiplyMatrices(this.inverse,c.matrixWorld),x&&y&&Tn(this.matrix)&&(m=_,h=T)}if(h===null){const v=_?_.isShaderMaterial?"customShader":_.transmission>0?"transmission":_.side===Be&&!_.forceSinglePass?"twoPass":"geometryLayersOrTransform":"multipleMaterials";this.excluded[v]=(this.excluded[v]??0)+1}const g=e&&h&&m?this.ordered.register(c.geometry,m,c.renderOrder):null;a.push({mesh:c,material:m,key:h,batchKey:g,groupOrder:p,z:u,centre:i})}this.ordered.pack();for(const c of a)c.batchKey&&this.ordered.available(c.batchKey)&&(c.key=c.batchKey);for(const[c]of this.mixedDraws)c.parent||this.mixedDraws.delete(c);a.sort((c,d)=>c.groupOrder-d.groupOrder||c.mesh.renderOrder-d.mesh.renderOrder||d.z-c.z||c.mesh.id-d.mesh.id);const f=new Map;for(let c=0;c<a.length;){const d=a[c];let l=c+1;if(d.key!==null)for(;l<a.length&&a[l].key===d.key;)l++;const i=a[c-1],u=a[l],m=i?.z===d.z&&i.mesh.renderOrder===d.mesh.renderOrder||u?.z===a[l-1].z&&u.mesh.renderOrder===d.mesh.renderOrder;if(d.key!==null&&l-c>=2&&!m){let h=!0;for(let _=c+ie;_<l;_+=ie)a[_-1].z===a[_].z&&(h=!1);if(h)for(let _=c;_<l;_+=ie){const p=Math.min(ie,l-_);if(p<2)continue;const g=a[_],v=f.get(d.key)??0;f.set(d.key,v+1);const w=d.key.startsWith("multi:");let x;if(w){const y=this.ordered.get(d.key,v);if(!y)continue;if(x=this.mixedDraws.get(y),!x){x={mesh:y,members:[]},this.mixedDraws.set(y,x);const A=x;y.raycast=(M,P)=>{if(y.visible)for(const F of A.members)ee(F)&&F.raycast(M,P)},this.root.add(y)}}let T=this.pools.get(d.key);if(T||(T=[],this.pools.set(d.key,T)),w||(x=T[v]),!x){const y=new Co(d.mesh.geometry,d.material,ie);y.name="Blender ordered transparency",y.userData.engineInternal=!0,y.matrixAutoUpdate=!1,y.frustumCulled=!1,y.boundingSphere=new Nn,y.instanceMatrix.setUsage(Fo),x={mesh:y,members:[]};const A=x;y.raycast=(M,P)=>{if(y.visible)for(const F of A.members)ee(F)&&F.raycast(M,P)},T.push(x),this.root.add(y)}x.mesh.material=this.drawMaterials.get(d.material,x.mesh),x.mesh.visible=!0,x.mesh.renderOrder=g.mesh.renderOrder,x.mesh.boundingSphere.center.copy(g.centre).applyMatrix4(this.inverse),x.mesh.updateMatrixWorld(!0);for(let y=0;y<p;y++){const A=a[_+y].mesh;this.matrix.multiplyMatrices(this.inverse,A.matrixWorld),x.mesh.setMatrixAt(y,this.matrix),x.mesh instanceof Ae&&(x.mesh.setGeometryIdAt(y,this.ordered.geometryId(d.key,A.geometry)),x.mesh.setVisibleAt(y,!0)),x.members.push(A),A.layers.disable(0),this.hidden.push(A)}if(x.mesh instanceof Ae)for(let y=p;y<ie;y++)x.mesh.setVisibleAt(y,!1);else x.mesh.count=p,x.mesh.instanceMatrix.needsUpdate=!0;this.planned.push(x),this.batches++,this.instances+=p}}c=l}this.ordered.pending&&queueMicrotask(_t)}inspect(){return{batches:this.batches,instances:this.instances,excluded:{...this.excluded},multiDraw:this.ordered.inspect(),materials:this.drawMaterials.inspect()}}observe(t){this.planState[this.stateIndex]!==t&&(this.planState[this.stateIndex]=t,this.stateChanged=!0),this.stateIndex++}planChanged(t){if(!this.projectionKnown||!this.plannedProjection.equals(this.projection))return this.plannedProjection.copy(this.projection),this.projectionKnown=!0,this.planState.length=0,!0;this.stateIndex=0,this.stateChanged=this.planState.length===0,this.observe(t.layers.mask);for(const r of this.projection.elements)this.observe(r);for(const r of this.root.matrixWorld.elements)this.observe(r);const e=new Set,o=new Set;for(const r of this.objects){if(!(Array.isArray(r.material)?r.material:[r.material]).some(d=>d.visible&&d.transparent))continue;this.observe(r.parent?.id??-1),this.observe(ee(r)?1:0),this.observe(r.layers.mask),this.observe(r.renderOrder),this.observe(yo(r)),this.observe(r.frustumCulled?1:0),this.observe(He(r)?1:0),this.observe(r.morphTargetInfluences?1:0);for(const d of r.matrixWorld.elements)this.observe(d);const s=r.geometry;if(this.observe(s.id),!e.has(s)){e.add(s),this.observe(s.index?.id??-1),this.observe(s.index?.version??-1),this.observe(JSON.stringify(s.userData.blenderUvChannels??null));for(const d of Object.keys(s.attributes).sort()){const l=s.getAttribute(d);this.observe(d),l instanceof lt&&(this.observe(l.id),this.observe(l.version))}}this.observe(s.drawRange.start),this.observe(s.drawRange.count),this.observe(s.index?.count??s.getAttribute("position").count),this.observe(s.groups.length);for(const d of s.groups)this.observe(d.start),this.observe(d.count),this.observe(d.materialIndex??0);const f=r.boundingSphere??s.boundingSphere;this.observe(f?.center.x??0),this.observe(f?.center.y??0),this.observe(f?.center.z??0),this.observe(f?.radius??-1);const c=Array.isArray(r.material)?r.material:null;if(this.observe(c?.length??-1),c)for(const d of c)this.observeMaterial(d,o);else this.observeMaterial(r.material,o)}return this.stateChanged||=this.planState.length!==this.stateIndex,this.planState.length=this.stateIndex,this.stateChanged}observeMaterial(t,e){this.observe(t.uuid),!e.has(t)&&(e.add(t),this.observe(Te(t)?1:0),this.observe(t.version),this.observe(t.visible?1:0),this.observe(t.transparent?1:0),this.observe(t.side),this.observe(t.forceSinglePass?1:0),this.observe(t.transmission??0))}finishDraw(){for(const t of this.hidden)t.layers.enable(0);this.hidden.length=0;for(const t of this.pools.values())for(const{mesh:e}of t)e.visible=!1;for(const{mesh:t}of this.mixedDraws.values())t.visible=!1}clear(){this.finishDraw();for(const t of this.pools.values())for(const{mesh:e}of t)e.removeFromParent(),e.dispose();this.pools.clear(),this.ordered.clear(),this.drawMaterials.clear(),this.mixedDraws.clear(),this.planned.length=0,this.planState.length=0,this.projectionKnown=!1,this.objects=[],this.batches=this.instances=0}}const Ei=8*1024*1024;class Ni{constructor(){this.objects=[],this.copies=new Map,this.swapped=[],this.bytes=0,this.savedDraws=0}setObjects(t){this.clear(),this.objects=[...t].filter(e=>e.isMesh===!0)}prepare(){this.savedDraws=0;for(const t of this.objects){const e=t.geometry,o=t.material;if(t.layers.mask===0||!Array.isArray(o)||e.groups.length<8||!e.index||t.isSkinnedMesh||t.isInstancedMesh||t.morphTargetInfluences||Object.keys(e.morphAttributes).length||e.drawRange.start!==0||e.drawRange.count<e.index.count||o.some(s=>s.transparent||s.transmission>0||s.isShaderMaterial))continue;const r=JSON.stringify([e.id,e.index.id,e.index.version,o.map(s=>s.uuid),e.groups,Object.entries(e.attributes).map(([s,f])=>[s,f.id])]);let a=this.copies.get(r);if(!a){let s=0,f=!0;const c=new Map;for(const m of e.groups){const h=m.materialIndex??0,_=o[h];if(!_||m.start!==s||m.count<=0||m.count%3!==0){f=!1;break}s+=m.count;const p=c.get(_.uuid);p?p.groups.push(m):c.set(_.uuid,{slot:h,groups:[m]})}if(!f||s!==e.index.count||c.size>=e.groups.length)continue;const d=e.index.array.byteLength;if(this.bytes+d>Ei)continue;const l=new re;for(const[m,h]of Object.entries(e.attributes))l.setAttribute(m,h);const i=e.index.clone();let u=0;for(const m of c.values()){const h=u;for(const _ of m.groups)i.array.set(e.index.array.subarray(_.start,_.start+_.count),u),u+=_.count;l.addGroup(h,u-h,m.slot)}l.setIndex(i),l.boundingBox=e.boundingBox?.clone()??null,l.boundingSphere=e.boundingSphere?.clone()??null,l.userData={...e.userData},a={geometry:l,signature:r,bytes:d,before:e.groups.length,after:c.size},this.copies.set(r,a),this.bytes+=d}this.swapped.push({mesh:t,geometry:e}),t.geometry=a.geometry,this.savedDraws+=a.before-a.after}}finish(){for(const{mesh:t,geometry:e}of this.swapped)t.geometry=e;this.swapped.length=0}inspect(){return{copies:this.copies.size,bytes:this.bytes,savedRanges:this.savedDraws}}release(t){for(const e of Object.keys(t.geometry.attributes))t.geometry.deleteAttribute(e);t.geometry.dispose(),this.bytes-=t.bytes}clear(){this.finish();for(const t of this.copies.values())this.release(t);this.copies.clear(),this.objects=[],this.savedDraws=0}}const un=64*1024*1024,wo=150,Ce=49152,Et=8192,Oo=Symbol("navigation geometry replaced");class Ri{constructor(t){this.invalidate=t,this.groups=new Map,this.cache=new Map,this.swapped=[],this.queue=[],this.worker=null,this.pending=null,this.generation=0,this.building=!1,this.nextId=0,this.signature="",this.identities=new WeakMap,this.nextIdentity=0,this.bytes=0,this.unavailable=null,this.reductions=[],this.timer=null,this.cameraWorld=new q,this.cameraProjection=new q,this.cameraKnown=!1,this.movedAt=-1/0,this.projection=new q,this.frustum=new Ke,this.centre=new b,this.boxCentre=new b,this.halfExtent=new b,this.viewWorld=new q,this.drawnMeshes=0,this.fullTriangles=0,this.motionTriangles=0,this.lastNavigation={meshes:0,fullTriangles:0,motionTriangles:0,tooClose:0},this.quietTimer=null}setObjects(t){const e=new Map;for(const s of t){const f=s;if(!f.isMesh||f.isSkinnedMesh||f.isInstancedMesh||f.morphTargetInfluences)continue;const c=f.geometry,d=c.getAttribute("position");if(!c.index||c.index.count<6144||!d||d.count>8e6||Object.values(c.attributes).some(i=>!(i instanceof lt)||i.isFloat16BufferAttribute||i.isInstancedBufferAttribute)||Object.keys(c.morphAttributes).length||c.drawRange.start!==0||c.drawRange.count<c.index.count)continue;if(Array.isArray(f.material)){let i=0;if(!c.groups.length||c.groups.some(u=>{const m=u.start===i&&u.count>0&&u.count%3===0&&Number.isInteger(u.materialIndex)&&u.materialIndex>=0&&u.materialIndex<f.material.length;return i=u.start+u.count,!m})||i!==c.index.count)continue}const l=e.get(c);l?l.push(f):e.set(c,[f])}this.groups=e;const o=s=>{let f=this.identities.get(s);return f===void 0&&(f=++this.nextIdentity,this.identities.set(s,f)),f},r=[...e].map(([s,f])=>`${s.id}:${o(s.index)}:${s.index.version}:${Array.isArray(f[0].material)}:${JSON.stringify(s.groups)}:`+Object.entries(s.attributes).map(([c,d])=>`${c}:${o(d)}:${d.version}`).join(",")).join(";");if(r===this.signature)return;this.releaseCopies(),this.signature=r,this.unavailable=null;const a=[...e].filter(([,s])=>s.length>=3);a.reduce((s,[f,c])=>s+f.index.count*c.length,0)<6e6||(a.sort(([s,f],[c,d])=>c.index.count*d.length-s.index.count*f.length),this.queue=a.map(([s])=>({geometry:s,fine:!1})),this.next())}async next(){if(this.building||this.unavailable||this.bytes>=un)return;const t=this.queue.shift();if(!t){this.worker?.terminate(),this.worker=null;return}const{geometry:e,fine:o}=t;this.building=!0;const r=this.generation,a=()=>{if(r!==this.generation)throw Oo;if(this.unavailable)throw new Error(this.unavailable)},s=async()=>{await new Promise(f=>setTimeout(f,0)),a()};try{this.worker||(this.worker=new Worker(new URL("/assets/blender-motion-worker-CtT2cV3V.js",import.meta.url),{type:"module"}),this.worker.onmessage=N=>{if(this.pending?.id===N.data.id){const D=this.pending;this.pending=null,D.resolve(N.data)}},this.worker.onerror=N=>{this.unavailable=N.message||"Navigation geometry worker unavailable",this.worker?.terminate(),this.worker=null;const D=this.pending;this.pending=null,D?.resolve({id:D.id,refusal:this.unavailable})});const f=e.getAttribute("position"),c=this.groups.get(e),d=Array.isArray(c[0].material);if(c.some(N=>Array.isArray(N.material)!==d))return;const l=d?e.groups:[{start:0,count:e.index.count}],i=l.flatMap(N=>{const D=[];for(let E=N.start;E<N.start+N.count;E+=Ce)D.push({start:E,count:Math.min(Ce,N.start+N.count-E),materialIndex:N.materialIndex});return D}),u=e.getAttribute("blenderVertex"),m=new Uint32Array(f.count),h=new Uint8Array(f.count),_=N=>u?u.getX(N):N;for(let N=0;N<i.length;N++){const D=i[N];for(let E=D.start;E<D.start+D.count;E+=Et){await s();for(let S=E;S<Math.min(E+Et,D.start+D.count);S++){const $=_(e.index.getX(S));if(!Number.isInteger($)||$<0||$>=m.length)return;m[$]?m[$]!==N+1&&(h[$]=1):m[$]=N+1}}}const p=Object.entries(e.attributes).filter(([N])=>N!=="position"&&N!=="blenderVertex"),g=p.reduce((N,[,D])=>N+D.itemSize,0);if(g>32)return;const v=[];let w=0;for(const[N,D]of p)for(let E=0;E<D.itemSize;E++,w++)N!=="normal"&&v.push(w);const x=p.flatMap(([N,D])=>Array(D.itemSize).fill(N==="normal"?.5:1)),T=e.boundingBox?.clone()??new me;if(!e.boundingBox){const N=new b;for(let D=0;D<f.count;D+=Et){await s();for(let E=D;E<Math.min(D+Et,f.count);E++)T.expandByPoint(N.fromBufferAttribute(f,E))}}if(!e.boundingSphere)return;const y=Math.max(T.max.x-T.min.x,T.max.y-T.min.y,T.max.z-T.min.z)*(o?5e-4:.002),A=[],M=[];let P=0,F=0;for(const N of l){const D=P;for(let E=N.start;E<N.start+N.count;E+=Ce){await s();const S=Math.min(E+Ce,N.start+N.count),$=[],X=new Map,K=new Uint32Array(S-E);for(let rt=E;rt<S;rt++){const Tt=e.index.getX(rt);let Lt=X.get(Tt);Lt===void 0&&(Lt=$.length,$.push(Tt),X.set(Tt,Lt)),K[rt-E]=Lt}const nt=new Uint8Array($.length),ot=new Float32Array($.length*3),at=new Float32Array($.length*g);for(let rt=0;rt<$.length;rt+=Et){await s();for(let Tt=rt;Tt<Math.min(rt+Et,$.length);Tt++){const Lt=$[Tt];nt[Tt]=h[_(Lt)];for(let jt=0;jt<3;jt++)ot[Tt*3+jt]=f.getComponent(Lt,jt);let Vn=0;for(const[,jt]of p){for(let Se=0;Se<jt.itemSize;Se++)at[Tt*g+Vn+Se]=jt.getComponent(Lt,Se);Vn+=jt.itemSize}}}const bt=++this.nextId,Pt=await new Promise(rt=>{this.pending={id:bt,resolve:rt};const Tt={id:bt,positions:ot,indices:K,attributes:at,stride:g,weights:x,absoluteError:y,protectedComponents:v,locks:nt};this.worker.postMessage(Tt,[ot.buffer,K.buffer,at.buffer,nt.buffer])});if(a(),Pt.refusal)throw new Error(Pt.refusal);if(!Pt.indices||!Number.isFinite(Pt.error))throw new Error("Invalid navigation geometry response");const $t=Pt.indices;for(let rt=0;rt<$t.length;rt++)$t[rt]=$[$t[rt]];if(P+=$t.length,P*4>un-this.bytes)return;A.push($t),F=Math.max(F,Pt.error)}d&&M.push({start:D,count:P-D,materialIndex:N.materialIndex})}const U={vertices:f.count,fullTriangles:e.index.count/3,reducedTriangles:P/3,error:F,fine:o,accepted:!1};if(this.reductions.length<32&&this.reductions.push(U),!P||P>=e.index.count*.75)return;const H=o?null:new Int32Array(f.count).fill(-1),G=[],J=new Uint32Array(P);let ft=0;for(const N of A){for(let D=0;D<N.length;D+=Et){await s();for(let E=D;E<Math.min(D+Et,N.length);E++){const S=N[E];let $=H?H[S]:S;$<0&&($=G.length,G.push(S),H[S]=$),J[ft+E]=$}}ft+=N.length}const O=J.byteLength+(o?0:Object.values(e.attributes).reduce((N,D)=>N+G.length*D.itemSize*D.array.BYTES_PER_ELEMENT,0));if(U.bytes=O,this.bytes+O>un)return;const B=new re;B.setIndex(new lt(J,1));for(const[N,D]of Object.entries(e.attributes)){if(o){B.setAttribute(N,D);continue}const E=D,S=E.array.constructor,$=new S(G.length*E.itemSize);for(let X=0;X<G.length;X+=Et){await s();for(let K=X;K<Math.min(X+Et,G.length);K++)for(let nt=0;nt<E.itemSize;nt++)$[K*E.itemSize+nt]=E.array[G[K]*E.itemSize+nt]}B.setAttribute(N,new lt($,E.itemSize,E.normalized))}B.boundingSphere=e.boundingSphere.clone(),B.boundingBox=T.clone();for(const N of M)B.addGroup(N.start,N.count,N.materialIndex);B.userData={...e.userData},U.accepted=!0;const L=this.cache.get(e)??[];L.push({geometry:B,error:F,bytes:O,sharedAttributes:o}),this.cache.set(e,L),this.bytes+=O,!o&&e.index.count>=3e5&&P<e.index.count*.25&&this.queue.push({geometry:e,fine:!0})}catch(f){if(f===Oo)return;this.unavailable=String(f),this.worker?.terminate(),this.worker=null,this.pending=null,this.queue.length=0}finally{r===this.generation&&(this.building=!1,this.timer=setTimeout(()=>{this.timer=null,this.next()},0))}}prepare(t,e,o){if(this.finish(),this.drawnMeshes=this.fullTriangles=this.motionTriangles=0,!e||!(o>0))return!1;const r=performance.now(),a=this.cameraKnown&&(!t.matrixWorld.equals(this.cameraWorld)||!t.projectionMatrix.equals(this.cameraProjection));if(this.cameraKnown=!0,this.cameraWorld.copy(t.matrixWorld),this.cameraProjection.copy(t.projectionMatrix),a&&(this.movedAt=r,this.quietTimer&&clearTimeout(this.quietTimer),this.quietTimer=setTimeout(()=>{this.quietTimer=null,this.invalidate()},wo+1)),r-this.movedAt>wo)return!1;this.projection.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this.frustum.setFromProjectionMatrix(this.projection);let s=0;for(const[f,c]of this.cache){const d=c[0].geometry.boundingBox;d.getSize(this.halfExtent).multiplyScalar(.5);for(const l of this.groups.get(f)??[]){if(!ee(l)||l.frustumCulled&&!this.frustum.intersectsObject(l))continue;this.viewWorld.multiplyMatrices(t.matrixWorldInverse,l.matrixWorld);const i=this.viewWorld.elements,u=i[0]**2+i[1]**2+i[2]**2,m=i[4]**2+i[5]**2+i[6]**2,h=i[8]**2+i[9]**2+i[10]**2,_=Math.abs(i[0]*i[4]+i[1]*i[5]+i[2]*i[6]),p=Math.abs(i[0]*i[8]+i[1]*i[9]+i[2]*i[10]),g=Math.abs(i[4]*i[8]+i[5]*i[9]+i[6]*i[10]),v=Math.sqrt(Math.max(u+_+p,m+_+g,h+p+g)),w=f.boundingSphere;this.centre.copy(w.center).applyMatrix4(this.viewWorld);let x=1;if(t.isPerspectiveCamera){const A=-this.centre.z-w.radius*v;d.getCenter(this.boxCentre).applyMatrix4(this.viewWorld);const M=this.viewWorld.elements,P=Math.abs(M[2])*this.halfExtent.x+Math.abs(M[6])*this.halfExtent.y+Math.abs(M[10])*this.halfExtent.z;x=Math.max(A,-this.boxCentre.z-P)}const T=v*Math.abs(t.projectionMatrix.elements[5])*o/(2*x);let y;if(x>0){for(const A of c)if(A.error*T<=1){y=A;break}}if(!y){s++;continue}this.swapped.push({mesh:l,geometry:f}),l.geometry=y.geometry,this.drawnMeshes++,this.fullTriangles+=f.index.count/3,this.motionTriangles+=y.geometry.index.count/3}}return this.lastNavigation={meshes:this.drawnMeshes,fullTriangles:this.fullTriangles,motionTriangles:this.motionTriangles,tooClose:s},this.swapped.length>0}finish(){for(const{mesh:t,geometry:e}of this.swapped)t.geometry=e;this.swapped.length=0}inspect(){return{copies:this.cache.size,levels:[...this.cache.values()].reduce((t,e)=>t+e.length,0),bytes:this.bytes,queued:this.queue.length,pending:this.building,unavailable:this.unavailable,reductions:this.reductions.map(t=>({...t})),lastNavigation:{...this.lastNavigation}}}releaseCopies(){this.finish(),this.timer&&clearTimeout(this.timer),this.timer=null,this.generation++,this.worker?.terminate(),this.worker=null,this.pending?.resolve({id:this.pending.id,refusal:"Navigation geometry replaced"}),this.pending=null,this.building=!1,this.queue=[];for(const t of this.cache.values())for(const e of t){if(e.sharedAttributes)for(const o of Object.keys(e.geometry.attributes))e.geometry.deleteAttribute(o);e.geometry.dispose()}this.cache.clear(),this.bytes=0,this.reductions=[]}clear(){this.releaseCopies(),this.quietTimer&&clearTimeout(this.quietTimer),this.quietTimer=null,this.groups.clear(),this.signature="",this.cameraKnown=!1,this.movedAt=-1/0}}const Ii={WIREFRAME:"wireframe",SOLID:"solid",MATERIAL:"preview",RENDERED:"rendered"},k=I().finite(),ra=W([k,k,k]),Fe=W([I().int().nonnegative(),I().int().nonnegative()]),gt={name:z(),domain:Q(["POINT","EDGE","FACE","CORNER"])},Di=Za("type",[R({...gt,type:Z("FLOAT2"),data:j(W([k,k]))}).strict(),R({...gt,type:Z("FLOAT_VECTOR"),data:j(ra)}).strict(),R({...gt,type:Z("FLOAT_COLOR"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("BYTE_COLOR"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("QUATERNION"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("FLOAT4"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("FLOAT4X4"),data:j(j(k).length(16))}).strict(),R({...gt,type:Z("INT16_2D"),data:j(W([I().int(),I().int()]))}).strict(),R({...gt,type:Z("INT32_2D"),data:j(W([I().int(),I().int()]))}).strict(),R({...gt,type:Z("FLOAT"),data:j(k)}).strict(),R({...gt,type:Z("INT"),data:j(I().int())}).strict(),R({...gt,type:Z("INT8"),data:j(I().int())}).strict(),R({...gt,type:Z("BOOLEAN"),data:j(et())}).strict(),R({...gt,type:Z("STRING"),data:j(z())}).strict()]),zi=R({positions:Y(Float32Array),normals:Y(Float32Array).nullable(),uv:Y(Float32Array).nullable(),uvLayers:j(R({name:z(),data:Y(Float32Array)}).strict()).optional(),attributeLayers:j(R({name:z(),data:Y(Float32Array)}).strict()).optional(),orco:Y(Float32Array).nullable().optional(),indices:Y(Uint32Array),groups:j(R({start:I().int().nonnegative(),count:I().int().nonnegative(),materialIndex:I().int().nonnegative()}).strict()),hash:z()}).strict(),Ci=R({v:j(ra),f:j(j(I().int().nonnegative())),e:j(Fe).optional(),edge_order:j(Fe).optional(),m:j(I().int().nonnegative()).optional(),s:j(et()).optional(),sharp:j(Fe).optional(),seams:j(Fe).optional(),creases:j(W([k,k,k])).optional(),attributes:j(Di).optional(),active_uv:z().nullable().optional(),render_uv:z().nullable().optional()}).strict(),Fi=R({store:I().int().optional(),revision:I().int(),unchanged:Z(!0)}).strict(),ki=R({co:Gt([Y(Float32Array),Y(Float64Array)]),cornerNormal:Y(Float32Array).optional(),cornerTri:Y(Uint32Array).optional(),orco:Y(Float32Array).optional(),faceStart:Y(Uint32Array),corner:Y(Uint32Array),cornerEdge:Y(Int32Array),edge:Y(Uint32Array),edgeSharp:Y(Uint8Array),edgeSeam:Y(Uint8Array),edgeCrease:Y(Float32Array),material:Y(Uint32Array),smooth:Y(Uint8Array),vertSelect:Y(Uint8Array),vertHide:Y(Uint8Array),edgeSelect:Y(Uint8Array),edgeHide:Y(Uint8Array),faceSelect:Y(Uint8Array),faceHide:Y(Uint8Array)}).strict(),$i=R({name:z(),domain:Q(["POINT","EDGE","FACE","CORNER"]),type:z(),data:Ka(n=>ArrayBuffer.isView(n))}).strict(),sa=R({columns:ki,attributes:j($i),activeUv:z().nullable(),renderUv:z().nullable(),counts:R({verts:I().int().nonnegative(),edges:I().int().nonnegative(),faces:I().int().nonnegative(),corners:I().int().nonnegative()}).strict(),revision:I().int().nonnegative()}).strict(),Li=Gt([zi,sa,Ci,Fi]),Ao=new Set;function ji(n,t){const e=new Blob([n],{type:t}),o=new La;let r=!1;o.addEventListener("dispose",()=>{r=!0,o.image?.close?.()});const a=createImageBitmap(e,{imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(s=>{if(r){s.close();return}o.image=s,o.needsUpdate=!0,_t()}).finally(()=>{Ao.delete(a)});return Ao.add(a),a.catch(()=>{}),{texture:o,ready:a}}function Vi(n,t,e,o){const r=new Ye(n,t,e,Ze,$a);return r.flipY=!1,r.colorSpace=o==="data"?Ue:Ht,r.needsUpdate=!0,r}function Bi(n,t,e){if(t.length===0)throw new Error(`Runtime image ${n} is tiled with no tiles`);const o=Math.max(...t.map(l=>l.width)),r=Math.max(...t.map(l=>l.height)),a=new Uint8Array(o*r*4*t.length),s=Math.max(...t.map(l=>l.number-1001))+1,f=new Float32Array(s*2*4);for(let l=0;l<s;l++)f[l*4]=-1;t.forEach((l,i)=>{const u=l.rgba??(l.rgbaBase64?vn(l.rgbaBase64):void 0);if(!u)throw new Error(`Runtime image ${n} tile ${l.number} carries no raster`);for(let h=0;h<l.height;h++)a.set(u.subarray(h*l.width*4,(h+1)*l.width*4),(i*r+h)*o*4);const m=l.number-1001;f[m*4]=i,f.set([0,0,l.width/o,l.height/r],(s+m)*4)});const c=new ka(a,o,r,t.length);c.colorSpace=e==="data"?Ue:Ht,c.magFilter=oe,c.minFilter=ko,c.generateMipmaps=!0,c.needsUpdate=!0;const d=new Ye(f,s,2,Ze,Ro);return d.magFilter=d.minFilter=pn,d.needsUpdate=!0,{tiles:c,map:d,frame:t}}const Ui=R({width:I().int().positive(),height:I().int().positive(),revision:I().int().nonnegative(),rgba:Y(Uint8Array).optional(),rgbaBase64:z().optional(),colorspace:Q(["sRGB","data"]).optional(),tiles:j(R({number:I().int().min(1001),width:I().int().positive(),height:I().int().positive(),rgba:Y(Uint8Array).optional(),rgbaBase64:z().optional()}).strict()).optional()}).strict(),Wi=R({revision:I().int().nonnegative(),encoded:Y(Uint8Array).optional(),encodedBase64:z().optional(),mime:Q(["image/png","image/jpeg"]),colorspace:Q(["sRGB","data"]).optional()}).strict(),ia=Gt([Ui,Wi]),dn=R({image:R({name:z(),revision:I().int().nonnegative()}).strict(),extension:Q(["REPEAT","EXTEND","MIRROR","CLIP"]).default("REPEAT"),uv:z(),tint:W([k,k,k]).optional()}).strict(),qi=R({name:z(),color:W([k,k,k,k]),roughness:k,metallic:k,transmission:k,ior:k,physical:Us.optional(),normal_texture:dn.optional(),normal_strength:k.default(1),normal_space:Q(["TANGENT","OBJECT"]).default("TANGENT"),normal_directx:et().default(!1),texture:dn.optional(),roughness_texture:dn.optional(),emission:R({color:W([k,k,k]),strength:k}).strict().optional(),graph:hs.optional(),viewport:R({color:W([k,k,k,k]),roughness:k,metallic:k}).strict().optional()}).strict(),Hi=R({session:z(),revision:I().int().nonnegative(),volumes:Ot(z(),Zo).default({}),lights:Ot(z(),Qr).default({}),world:ss.nullable().default(null),meshes:Ot(z(),Li),materials:Ot(z(),qi),images:Ot(z(),ia).default({}),objects:j(R({id:z(),name:z(),type:Q(["MESH","CURVE","SURFACE","FONT","META","ARMATURE","LATTICE","VOLUME","EMPTY","CAMERA","LIGHT","SPEAKER","GREASEPENCIL","POINTCLOUD","LIGHT_PROBE"]),mesh:z().nullable(),volume:z().nullable().optional(),light:z().nullable().optional(),materials:j(z().nullable()),matrix:j(W([k,k,k,k])).length(4),visible:et(),render_visible:et().default(!0),selected:et(),parent:z().nullable(),texspace:W([W([k,k,k]),W([k,k,k])]).optional(),default_color:z().optional()}).strict()),active:z().nullable(),mode:z(),cameras:Ot(z(),Ot(z(),Lo())).default({}),warnings:j(z()).default([]),updated:j(z()).default([]),frame:I().int().default(0),armatures:Ot(z(),er).default({}),weights:Xs.nullable().default(null),cursor:Js.optional(),camera_view:R({scene_camera:z().nullable(),view_layer_cameras:j(z()),aspect:I().finite().positive()}).optional(),light_distances:Ot(z(),W([I().finite(),I().finite()])).default({}),empties:Ot(z(),ri).default({}),view:R({location:W([I(),I(),I()]),rotation:W([I(),I(),I(),I()]),distance:I().finite(),perspective:Q(["PERSP","ORTHO","CAMERA"]),lens:I().finite().positive().default(50),shading:Q(["WIREFRAME","SOLID","MATERIAL","RENDERED"]).optional()}).nullable().optional(),subject:R({frame:I().int(),body:z(),markers:j(W([I().int(),z()]))}).optional(),units:R({system:Q(["NONE","METRIC","IMPERIAL"]),scale_length:I().finite()}).optional()}).strict();function Gi(n,t){for(let e=0,o=n.length-1;e<n.length&&o>=0;e++,o--){if(n[e][0]===t)return n[e][1];if(e===o)break;if(n[o][0]===t)return n[o][1]}return null}const Xi={METRIC:[[1e-6,"Micrometers"],[.001,"Millimeters"],[.01,"Centimeters"],[.1,"10 Centimeters"],[1,"Meters"],[10,"10 Meters"],[100,"100 Meters"],[1e3,"Kilometers"]],IMPERIAL:[[254e-7,"Thou"],[.0254,"Inches"],[.3048,"Feet"],[.9144,"Yards"],[20.1168,"Chains"],[201.168,"Furlongs"],[1609.344,"Miles"]]};class Ge{constructor(){this.root=new ut,this.instances=new Oi(this.root),this.materialRanges=new Ni,this.transparentInstances=new Pi(this.root),this.motionGeometry=new Ri(_t),this.drawBatching=!0,this.objects=new Map,this.meshes=new Map,this.volumes=new Map,this.materials=new Map,this.lights=new Map,this.lighting=new rs,this.world=new Cn,this.armatureOverlay=new dr,this.weightOverlay=new Qs,this.cursorOverlay=new ai,this.extrasOverlay=new li,this.armatureRoot=new ut,this.weightRoot=new ut,this.cursorRoot=new ut,this.cameraExtrasRoot=new ut,this.lightExtrasRoot=new ut,this.emptyExtrasRoot=new ut,this.rendered=!1,this.heldRendered=null,this.worldApplied=null,this.worldKey="null",this.capturing=!1,this.workbench=!1,this.workbenchMaterials=new Map,this.fallback=new ae({color:12172998,roughness:.72}),this.textures=new Map,this.textureNames=new Map,this.roughnessTextureNames=new Map,this.textureSamplers=new Bs,this.graphSamplers=new Map,this.photograph=!1,this.graphs=new Map,this.frame=null,this.retiredSessions=new Set,this.geometryBuilds=0,this.submittedMeshes=new Map,this.submitted=null,this.submittedSession=null,this.photographs=[],this.frameListeners=new Set,this.followers=new Set,this.leader=null,this.cameraViewZoom=ui,this.cameraViewPan=di,this.mode=null,this.drawPreparation={last:null,navigation:null},this.awaitedImages=new Set,this.lookingThrough=null,this.staged=null;const t=this.root.updateMatrixWorld.bind(this.root);this.root.updateMatrixWorld=e=>{t(e),this.instances.sync()},this.root.name="Model",this.root.matrixAutoUpdate=!1,this.root.matrix.set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),this.root.updateMatrixWorld(!0);for(const[e,o]of[[this.armatureRoot,this.armatureOverlay.group],[this.weightRoot,this.weightOverlay.group],[this.cursorRoot,this.cursorOverlay.group],[this.cameraExtrasRoot,this.extrasOverlay.cameras],[this.lightExtrasRoot,this.extrasOverlay.lights],[this.emptyExtrasRoot,this.extrasOverlay.empties]])e.matrixAutoUpdate=!1,e.matrix.copy(this.root.matrix),e.add(o),e.updateMatrixWorld(!0);this.armatureRoot.name="BlenderBones",this.weightRoot.name="BlenderWeights",this.cursorRoot.name="Blender3DCursor",this.cameraExtrasRoot.name="BlenderCameraExtras";for(const e of[this.cameraExtrasRoot,this.lightExtrasRoot,this.emptyExtrasRoot])e.userData.volterPickable=!0;this.lightExtrasRoot.name="BlenderLightExtras",this.emptyExtrasRoot.name="BlenderEmptyExtras"}compiledGraph(t){const e=JSON.stringify(t);let o=this.graphs.get(e);return o||(o=Es(t),this.graphs.size>256&&this.graphs.clear(),this.graphs.set(e,o)),o}mirrorPose(t){let e=null;for(const[a,s]of this.objects)if(s===t){e=a;break}if(e===null)return;const o=this.leader?[this.leader,...this.leader.followers]:[...this.followers];let r=!1;for(const a of o){if(a===this)continue;const s=a.objects.get(e);s!==void 0&&(s.matrix.copy(t.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),r=!0)}r&&_t()}subscribeFrames(t){return this.frameListeners.add(t),()=>{this.frameListeners.delete(t)}}onChange(t){const e=this.subscribeFrames(t),o=Ja(t);return()=>{e(),o()}}blenderObjectName(t){for(const[e,o]of this.objects)if(o===t)return this.frame?.objects.find(r=>r.id===e)?.name??null;return null}noteSavedShading(t){this.frame?.view&&(this.frame.view.shading=t)}savedView(){const t=this.frame?.view;if(!t)return null;const[e,o,r,a]=t.rotation,s=new St(o,r,a,e),f=new b(...t.location).applyMatrix4(this.root.matrix),c=d=>d.applyQuaternion(s).applyMatrix4(this.root.matrix).normalize();return{target:f.toArray(),direction:c(new b(0,0,1)).toArray(),up:c(new b(0,1,0)).toArray(),distance:t.distance,projection:t.perspective==="ORTHO"?"orthographic":"perspective",lens:t.lens,drawMode:t.shading?Ii[t.shading]:null}}cameraViewCamera(){const t=this.frame,e=t?.camera_view;return!t||!e?null:e.scene_camera!==null&&t.cameras[e.scene_camera]?e.scene_camera:t.active!==null&&t.cameras[t.active]?t.active:e.view_layer_cameras.find(o=>t.cameras[o])??null}blenderPose(t,e){const o=new q().copy(this.root.matrix).invert(),r=new q().compose(new b(...t),new St(...e),new b(1,1,1)).premultiply(o),a=new b,s=new St;return r.decompose(a,s,new b),{location:a.toArray(),rotation:[s.w,s.x,s.y,s.z]}}cameraView(t,e,o,r){const a=this.frame,s=vo.safeParse(a?.cameras[t]);return!a?.camera_view||!s.success?null:mi(s.data,this.root.matrix,e,o,r,a.camera_view.aspect)}subjectLine(t){const e=this.frame?.subject;if(e===void 0)return null;const o=t??e.frame,r=Gi(e.markers,o);return`(${o})${e.body}${r===null?"":` <${r}>`}`}gridUnitName(t){const e=this.frame?.units;if(e===void 0||e.system==="NONE")return null;const o=Xi[e.system],r=6*t,a=1/(e.scale_length||1);return(o.find(([f])=>f*a>r)??o[o.length-1])[1]}blenderSelection(){const t=this.frame;return t===null?{selected:[],active:null}:{selected:t.objects.filter(e=>e.selected).map(e=>e.name),active:t.active}}setStageMode(t){this.mode=t}stageMode(){return this.mode}objectForBlenderName(t){const e=this.frame?.objects.find(o=>o.name===t);return e===void 0?null:this.objects.get(e.id)??null}replacePresentedObject(t,e){for(const[o,r]of this.objects)if(r===t){const a=t.parent,s=[...t.children];t.removeFromParent();for(const f of s)e.add(f);a?.add(e),this.objects.set(o,e),this.rebuildInstances();return}}studioLights(){return this.lighting.group}overlayGroups(){return[{kind:"skeletons",object:this.armatureRoot},{kind:"weights",object:this.weightRoot},{kind:"cursor",object:this.cursorRoot},{kind:"cameras",object:this.cameraExtrasRoot},{kind:"lights",object:this.lightExtrasRoot},{kind:"empties",object:this.emptyExtrasRoot}]}placeCursor(t,e,o){const r=new Set(this.objects.values()),a=this.cursorOverlay.placementAt(t,e,o,this.root,s=>r.has(s));return a!==null&&(this.cursorOverlay.show(a),_t()),a}holdRendered(t){t!==this.heldRendered&&(this.heldRendered=t,!this.capturing&&this.report(t===null?this.applyRendered(!1):this.applyRendered(!0,t())))}refreshRendered(){if(this.heldRendered===null||this.capturing)return;const t=this.heldRendered();this.worldKeyFor(t)!==this.worldApplied&&this.report(this.applyRendered(!0,t))}worldKeyFor(t){const o=t.isOrthographicCamera?t.getWorldDirection(new b).toArray().map(r=>r.toFixed(1)).join(","):"";return`${t.uuid}:${o}:${this.worldKey}`}report(t){t.then(_t,e=>console.error(`Rendered shading could not be applied: ${e instanceof Error?e.message:String(e)}`))}setWorkbench(t){t!==this.workbench&&(this.workbench=t,this.applyWorkbench(),_t())}applyWorkbench(){const t=this.workbench&&!this.rendered,e=new Set;for(const o of this.frame?.objects??[]){if(o.mesh===null||o.volume)continue;const r=this.objects.get(o.id);if(!r?.isMesh)continue;const s=(o.materials.length?o.materials:[null]).map(f=>{const c=f===null?this.fallback:this.materials.get(f)??this.fallback;return t?this.workbenchFor(f,c.side,e):c});r.material=o.materials.length?s:s[0]}for(const[o,r]of this.workbenchMaterials)e.has(o)||(r.dispose(),this.workbenchMaterials.delete(o));this.rebuildInstances()}rebuildInstances(){this.transparentInstances.clear(),this.instances.rebuild(this.objects.values(),this.drawBatching&&!this.rendered),this.drawBatching&&!this.rendered&&this.transparentInstances.setObjects(this.objects.values()),this.motionGeometry.setObjects(this.objects.values()),this.materialRanges.setObjects(this.drawBatching&&!this.rendered?this.objects.values():[])}setDrawBatching(t){t!==this.drawBatching&&(this.drawBatching=t,this.rebuildInstances(),_t())}prepareDraw(t,e){try{const o=performance.now();this.instances.prepareDraw(t),this.root.updateMatrixWorld(!0);const r=performance.now(),a=this.motionGeometry.prepare(t,!this.rendered&&(this.mode??this.frame?.mode)==="OBJECT"&&e?.interactive===!0,e?.height??0);a&&this.instances.sync();const s=performance.now();this.materialRanges.prepare();const f=performance.now();this.transparentInstances.prepare(t,e?.multiDraw===!0);const c={opaqueMs:r-o,motionMs:s-r,rangesMs:f-s,transparentMs:performance.now()-f};this.drawPreparation.last=c,a&&(this.drawPreparation.navigation=c)}catch(o){throw this.materialRanges.finish(),this.motionGeometry.finish(),this.instances.finishDraw(),this.transparentInstances.finishDraw(),o}return()=>{this.materialRanges.finish(),this.motionGeometry.finish(),this.instances.finishDraw(),this.transparentInstances.finishDraw()}}workbenchFor(t,e,o){const r=(t!==null?this.frame?.materials[t]?.viewport:void 0)??_i,a=`${r.color.join(",")}|${r.roughness}|${r.metallic}|${e}`;o.add(a);let s=this.workbenchMaterials.get(a);return s||(s=bi(r,e),this.workbenchMaterials.set(a,s)),s}renderedHeld(){return this.heldRendered!==null}async setRendered(t,e){return this.capturing=t,!t&&this.heldRendered!==null?this.applyRendered(!0,this.heldRendered()):this.applyRendered(t,e)}async applyRendered(t,e){const o=(t?_o(this.frame?.world)?.extinction:null)??new b;for(const a of[...this.materials.values(),this.fallback])qs(a,o);this.rendered=t,this.lighting.setRendered(t);const r=t&&e?this.worldKeyFor(e):null;t?(this.capturing||r!==this.worldApplied)&&this.world.apply(this.root,this.frame?.world??null,e):this.world.clear(),this.worldApplied=this.capturing?null:r,this.applyVisibility(),this.applyWorkbench(),this.applyShadows(t,e),t&&(await ts(),await Promise.all([...this.textures.values()].map(a=>a.ready)),await this.world.ready())}applyShadows(t,e){this.root.updateMatrixWorld(!0);const o=[];for(const c of this.objects.values()){const d=c;if(d.isMesh&&(d.castShadow=t,d.receiveShadow=t,t&&d.visible)){const l=new me().setFromObject(d);l.isEmpty()||o.push(l)}}if(!t||!o.length)return;const a=o.reduce((c,d)=>c.union(d),new me).getBoundingSphere(new Nn),s=e?new Ke().setFromProjectionMatrix(new q().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse)):null,f=s?o.flatMap(c=>fs(c,s)):[];for(const c of this.lights.values())c.isDirectionalLight&&e?cs(c,f,o):os(c,a.center,a.radius)}applyOverlays(t){const e=s=>{const f=t.objects.find(c=>c.name===s);return f===void 0?null:new q().set(...f.matrix.flat())},o=[...this.armatureOverlay.apply(t.armatures,e)],r=t.weights?this.objects.get(t.objects.find(s=>s.name===t.weights?.object)?.id??""):void 0,a=this.weightOverlay.apply(t.weights,r??null,t.weights?e(t.weights.object):null);return a!==null&&o.push(a),this.cursorOverlay.apply(t.cursor),this.applyExtras(t),o}setCameraViewShowing(t){this.lookingThrough!==t&&(this.lookingThrough=t,this.frame&&this.applyExtras(this.frame),_t())}applyExtras(t){const e={};for(const[o,r]of Object.entries(t.cameras)){const a=vo.safeParse(r);a.success&&(e[o]=a.data)}this.extrasOverlay.apply({lookingThrough:this.lookingThrough,lightDistances:t.light_distances,objects:t.objects.filter(o=>o.visible),active:t.active,cameras:e,lights:t.lights,empties:t.empties,sceneCamera:t.camera_view?.scene_camera??null,renderAspect:t.camera_view?.aspect??1,presented:o=>{const r=t.objects.find(a=>a.name===o);return r?this.objects.get(r.id)??null:null},image:o=>{const r=this.textures.get(o);if(!r)return null;const a=r.texture.image,s=r.width||a?.width||0,f=r.height||a?.height||0;return(s===0||f===0)&&r.ready&&!this.awaitedImages.has(o)&&(this.awaitedImages.add(o),r.ready.then(()=>{this.awaitedImages.delete(o),this.frame&&this.applyExtras(this.frame),_t()},()=>this.awaitedImages.delete(o))),{texture:r.texture,width:s,height:f}}})}applyVisibility(){for(const t of this.frame?.objects??[]){const e=this.objects.get(t.id);if(e&&(e.visible=this.rendered?t.render_visible:t.visible),!t.light)continue;const o=this.lights.get(t.light);o&&(o.visible=this.rendered&&t.render_visible)}this.armatureOverlay.group.visible=!this.capturing,this.weightOverlay.group.visible=!this.capturing,this.cursorOverlay.group.visible=!this.capturing;for(const t of[this.extrasOverlay.cameras,this.extrasOverlay.lights,this.extrasOverlay.empties])t.visible=!this.capturing}stageFrame(t){if(t.abort||!t.mesh&&!t.image){for(const o of this.staged?.meshes.values()??[])o.geometry.dispose();this.staged=t.abort?null:{session:t.session,revision:t.revision,meshes:new Map,images:new Map};return}const e=this.staged;if(!e||e.session!==t.session||e.revision!==t.revision)throw new Error("Blender frame piece does not belong to the pending revision");if(t.mesh!==void 0){const o=sa.parse(t.piece);if(e.meshes.has(t.mesh))throw new Error("Duplicate Blender mesh piece");const r=`revision:${o.revision}`;e.meshes.set(t.mesh,{signature:r,geometry:$e(Kn({...o.columns,attributes:o.attributes,activeUv:o.activeUv,renderUv:o.renderUv},r))})}else if(t.image!==void 0){if(e.images.has(t.image))throw new Error("Duplicate Blender image piece");e.images.set(t.image,ia.parse(t.piece))}}applyFrame(t){const e=this.frame===null?null:{session:this.frame.session,revision:this.frame.revision},o=Hi.parse(t),r=this.staged;if(r&&(r.session!==o.session||r.revision!==o.revision))throw new Error("Blender frame manifest does not match its staged revision");if(r)for(const[l,i]of r.images)o.images[l]=i;if(this.retiredSessions.has(o.session))throw new Error("The runtime session was replaced; its delayed frame cannot overwrite the active model");if(this.frame?.session===o.session&&o.revision<this.frame.revision)throw new Error("The runtime frame is older than the displayed model");const a=new Set(o.objects.map(l=>l.id));if(a.size!==o.objects.length)throw new Error("Runtime object IDs must be unique");const s=new Map(o.objects.map(l=>[l.id,l]));for(const l of o.objects){if(l.mesh!==null&&!o.meshes[l.mesh])throw new Error(`Missing runtime mesh ${l.mesh}`);if(l.volume&&(!o.volumes[l.volume]||l.mesh!==null))throw new Error(`Invalid runtime volume ${l.volume}`);if(l.light&&(!o.lights[l.light]||l.mesh!==null))throw new Error(`Invalid runtime light ${l.light}`);for(const m of l.materials)if(m!==null&&!o.materials[m])throw new Error(`Missing runtime material ${m}`);const i=new Set([l.id]);let u=l.parent;for(;u!==null;){if(i.has(u))throw new Error("Runtime parent cycle");i.add(u);const m=s.get(u);if(!m)throw new Error(`Missing runtime parent ${u}`);u=m.parent}}const f=new Map,c=new Map;try{for(const[l,i]of Object.entries(o.volumes)){const u=JSON.stringify(i);this.frame?.session===o.session&&this.volumes.get(l)?.signature===u||c.set(l,{signature:u,mesh:us(i)})}for(const[l,i]of Object.entries(o.meshes)){if("unchanged"in i){const _=r?.meshes.get(l);if(_){if(_.signature!==`revision:${i.revision}`)throw new Error("Staged Blender mesh revision mismatch");f.set(l,_);continue}const p=this.meshes.get(l)?.signature;if(this.frame?.session===o.session&&p!==void 0&&(p===`revision:${i.revision}`||!p.startsWith("revision:")))continue;throw new Error(p===void 0?`${Xn}: the presenter does not hold runtime mesh ${l} (store ${i.store}, revision ${i.revision})`:`${Xn}: the presenter holds runtime mesh ${l} at ${p}, not revision ${i.revision}`)}const u="hash"in i,m="columns"in i,h=m?`revision:${i.revision}`:u?i.hash:JSON.stringify(i);this.frame?.session===o.session&&this.meshes.get(l)?.signature===h||f.set(l,{signature:h,geometry:m?$e(Kn({...i.columns,attributes:i.attributes,activeUv:i.activeUv,renderUv:i.renderUv},h)):u?$e(i):Mr(i)})}}catch(l){for(const i of f.values())i.geometry.dispose();for(const{mesh:i}of c.values())i.geometry.dispose(),i.material.dispose();throw l}if(r){for(const[l,i]of r.meshes)f.has(l)||i.geometry.dispose();this.staged=null}this.frame?.session!==o.session&&(this.frame&&this.retiredSessions.add(this.frame.session),this.clear());for(const[l,i]of c){const u=this.volumes.get(l)?.mesh;u&&(u.removeFromParent(),u.geometry.dispose(),u.material.dispose()),this.volumes.set(l,i)}for(const[l,i]of f)this.meshes.get(l)?.geometry.dispose(),this.meshes.set(l,i),this.geometryBuilds++;for(const[l,i]of Object.entries(o.images)){const u=this.textures.get(l);if("width"in i){const g=i.rgba??(i.rgbaBase64?vn(i.rgbaBase64):void 0);if(!g)throw new Error(`Runtime image ${l} carries no raster`);const v=i.tiles?Bi(l,i.tiles,i.colorspace??"sRGB"):void 0;if(u?.udim&&(u.udim.tiles.dispose(),u.udim.map.dispose(),delete u.udim),u&&u.width===i.width&&u.height===i.height){const w=u.texture.image;if(w.data){w.data.set(g),u.texture.needsUpdate=!0,u.revision=i.revision,v&&(u.udim=v);continue}}u?.texture.dispose(),this.textures.set(l,{texture:Vi(g,i.width,i.height,i.colorspace??"sRGB"),width:i.width,height:i.height,revision:i.revision,...v?{udim:v}:{}});continue}const m=i.encoded??(i.encodedBase64?vn(i.encodedBase64):void 0);if(!m)throw new Error(`Runtime image ${l} carries no bytes`);u?.texture.dispose(),u?.udim?.tiles.dispose(),u?.udim?.map.dispose();const h=i.colorspace??"sRGB",{texture:_,ready:p}=ji(m,i.mime);_.colorSpace=h==="data"?Ue:Ht,this.textures.set(l,{texture:_,ready:p,width:0,height:0,revision:i.revision,encoded:{bytes:m.slice(),mime:i.mime,colorspace:h}})}for(const[l,i]of Object.entries(o.materials)){const u=this.materials.get(l)??new ae;u.name=i.name;const m=i.texture?.tint;i.texture!==void 0?u.color.setRGB(m?.[0]??1,m?.[1]??1,m?.[2]??1,xt):u.color.setRGB(i.color[0],i.color[1],i.color[2],xt),u.opacity=i.color[3];const h=u.opacity<1||i.graph!==void 0&&ps(i.graph);u.transparent!==h&&(u.transparent=h,u.needsUpdate=!0),u.roughness=i.roughness,u.metalness=i.metallic,u.transmission=i.transmission,u.ior=i.ior,$n(u,i.physical,{map:i.texture?.extension==="CLIP",roughness:i.roughness_texture?.extension==="CLIP",normal:i.normal_texture?.extension==="CLIP"});const _=i.normal_texture?.image.name;if(_===void 0)u.normalMap&&(this.textureSamplers.delete(`${l}:normal`),u.normalMap=null,u.needsUpdate=!0);else{const x=this.textures.get(_);if(!x)throw new Error(`${he}: missing normal image ${_}`);const T=this.textureSamplers.get(`${l}:normal`,x.texture,i.normal_texture.extension,x.ready,i.normal_texture.uv);u.normalMap!==T&&(u.normalMap=T,u.needsUpdate=!0);const y=i.normal_space==="OBJECT"?Ca:Fa;u.normalMapType!==y&&(u.normalMapType=y,u.needsUpdate=!0),u.normalScale.set(i.normal_strength,i.normal_strength*(i.normal_directx?-1:1))}i.emission?(u.emissive.setRGB(i.emission.color[0],i.emission.color[1],i.emission.color[2],xt),u.emissiveIntensity=i.emission.strength):(u.emissive.setRGB(0,0,0),u.emissiveIntensity=1);const p=i.roughness_texture?.image.name??null;if(p===null)this.roughnessTextureNames.has(l)&&(this.textureSamplers.delete(`${l}:roughness`),u.roughnessMap=null,this.roughnessTextureNames.delete(l),u.needsUpdate=!0);else{const x=this.textures.get(p);if(!x)throw new Error(`${he}: the presenter does not hold runtime image ${p} (revision ${i.roughness_texture.image.revision})`);const T=this.textureSamplers.get(`${l}:roughness`,x.texture,i.roughness_texture.extension,x.ready,i.roughness_texture.uv);u.roughnessMap!==T&&(u.roughnessMap=T,this.roughnessTextureNames.set(l,p),u.needsUpdate=!0)}const g=i.texture?.image.name??null;if(g===null)this.textureNames.has(l)&&(this.textureSamplers.delete(`${l}:color`),u.map=null,this.textureNames.delete(l),u.needsUpdate=!0);else{const x=this.textures.get(g);if(!x)throw new Error(`${he}: the presenter does not hold runtime image ${g} (revision ${i.texture.image.revision})`);const T=this.textureSamplers.get(`${l}:color`,x.texture,i.texture.extension,x.ready,i.texture.uv);u.map!==T&&(u.map=T,this.textureNames.set(l,g),u.needsUpdate=!0)}const v=i.graph?this.compiledGraph(i.graph):null,w=new Set;Rs(u,v,x=>{const T=this.textures.get(x.name);if(!T)throw new Error(`${he}: the presenter does not hold runtime image ${x.name} (revision ${x.revision})`);if(x.tiled){if(!T.udim)throw new Error(`${he}: runtime image ${x.name} arrived without its UDIM tiles`);return T.udim}const y=`${l}:graph:${x.node}`;w.add(y);const A=this.textureSamplers.get(y,T.texture,x.extension,T.ready),M=x.closest?pn:oe,P=x.closest?pn:x.mipmap?ko:oe;return(A.magFilter!==M||A.minFilter!==P)&&(A.magFilter=M,A.minFilter=P,A.needsUpdate=!0),A},this.photograph);for(const x of this.graphSamplers.get(l)??[])w.has(x)||this.textureSamplers.delete(x);this.graphSamplers.set(l,w),this.materials.set(l,u)}for(const l of o.objects){let i=this.objects.get(l.id);const u=l.volume?this.volumes.get(l.volume).mesh:null;if((!i||(u?i!==u:!!i.isMesh!=(l.mesh!==null)))&&(i?.removeFromParent(),i=u??(l.mesh!==null?new kt(this.meshes.get(l.mesh).geometry,this.fallback):new Ve),this.objects.set(l.id,i)),i.name=l.name,l.type==="CAMERA"||l.type==="LIGHT"||l.type==="EMPTY"?i.userData.volterOwnOverlay=!0:delete i.userData.volterOwnOverlay,i.matrixAutoUpdate=!1,i.matrix.set(...l.matrix.flat()),l.parent){const m=new q().set(...s.get(l.parent).matrix.flat());i.matrix.premultiply(m.invert())}if(i.matrix.decompose(i.position,i.quaternion,i.scale),l.texspace?i.userData.blenderTexspace=l.texspace:delete i.userData.blenderTexspace,l.default_color!==void 0?i.userData.blenderDefaultColor=l.default_color:delete i.userData.blenderDefaultColor,l.mesh!==null){const m=i;m.geometry=this.meshes.get(l.mesh).geometry,m.material=l.materials.length?l.materials.map(h=>h===null?this.fallback:this.materials.get(h)):this.fallback,ks(m)}if(l.light){const m=this.lights.get(l.light)??null,h=ns(o.lights[l.light],m);m&&m!==h&&(m.removeFromParent(),m.dispose()),h.parent!==i&&i.add(h),h.userData.volterOwnOverlay=!0,as(h,i),this.lights.set(l.light,h)}}for(const l of o.objects){const i=this.objects.get(l.id),u=l.parent===null?this.root:this.objects.get(l.parent);i.parent!==u&&u.add(i)}for(const[l,i]of this.objects)a.has(l)||(i.removeFromParent(),this.objects.delete(l));for(const[l,i]of this.volumes)o.volumes[l]||(i.mesh.geometry.dispose(),i.mesh.material.dispose(),this.volumes.delete(l));for(const[l,i]of this.meshes)o.meshes[l]||(i.geometry.dispose(),this.meshes.delete(l));for(const[l,i]of this.materials)if(!o.materials[l]){for(const u of["normal","roughness","color"])this.textureSamplers.delete(`${l}:${u}`);for(const u of this.graphSamplers.get(l)??[])this.textureSamplers.delete(u);this.graphSamplers.delete(l),i.dispose(),this.materials.delete(l)}for(const[l,i]of this.lights)o.lights[l]||(i.removeFromParent(),i.dispose(),this.lights.delete(l));this.root.updateMatrixWorld(!0),this.frame={...o,meshes:{},volumes:{},images:{}},this.worldKey=JSON.stringify(o.world??null);const d=this.applyOverlays(o);d.length&&(this.frame={...this.frame,warnings:[...this.frame.warnings,...d]}),this.applyVisibility(),this.applyWorkbench(),this.heldRendered!==null&&!this.capturing&&this.report(this.applyRendered(!0,this.heldRendered()));for(const l of[...this.frameListeners])l();for(const l of this.followers)try{l.applyFrame(t)}catch{l.applyFrame(this.fullFrame())}return{...this.inspect(),held:e}}inspect(){return{session:this.frame?.session,revision:this.frame?.revision,active:this.frame?.active,mode:this.frame?.mode,geometryBuilds:this.geometryBuilds,instancing:this.drawStatistics(),objects:[...this.objects].map(([t,e])=>({id:t,name:e.name,uuid:e.uuid,geometry:e.geometry?.uuid,visible:e.visible}))}}drawStatistics(){return{enabled:this.drawBatching,preparation:{...this.drawPreparation},materialRanges:this.materialRanges.inspect(),opaque:this.instances.inspect(),transparent:this.transparentInstances.inspect(),motion:this.motionGeometry.inspect()}}snapshot(){return this.frame}fullFrame(){const t=this.frame;if(!t)throw new Error("Blender capture requires a presented frame");const e=structuredClone({...t,images:{},armatures:{},weights:null});for(const[r,{signature:a,geometry:s}]of this.meshes){const f=l=>{const i=s.getAttribute(l);if(!i)return null;if(!(i instanceof lt))throw new Error(`Blender capture cannot copy interleaved ${l}`);return new Float32Array(i.array)},c=f("position");if(!c)throw new Error(`Blender capture mesh ${r} has no positions`);const d=s.getIndex();e.meshes[r]={hash:a,positions:c,normals:f("normal"),uv:f("uv"),uvLayers:Object.entries(s.userData.blenderUvChannels??{}).map(([l,i])=>{const u=f(`uv${i}`);if(!u)throw new Error(`Blender capture mesh ${r} is missing UV layer ${l}`);return{name:l,data:u}}),orco:s.userData.blenderOrcoFromDoor?f("blenderOrco"):null,attributeLayers:(s.userData.blenderAttributes??[]).map(l=>{const i=f(qt(l));if(!i)throw new Error(`Blender capture mesh ${r} is missing attribute ${l}`);return{name:l,data:i}}),indices:d?new Uint32Array(d.array):Uint32Array.from({length:c.length/3},(l,i)=>i),groups:s.groups.map(l=>({start:l.start,count:l.count,materialIndex:l.materialIndex??0}))}}for(const[r,{signature:a}]of this.volumes)e.volumes[r]=Zo.parse(JSON.parse(a));const o=new Set(Object.values(e.materials).flatMap(r=>[r.texture?.image.name,r.roughness_texture?.image.name,r.normal_texture?.image.name,...Object.values(r.graph?.nodes??{}).map(a=>a.props.image?.name)].filter(a=>a!==void 0)));for(const r of o){const a=this.textures.get(r);if(!a)throw new Error(`Blender capture image ${r} is not resident`);if(a.encoded)e.images[r]={revision:a.revision,encoded:a.encoded.bytes.slice(),mime:a.encoded.mime,colorspace:a.encoded.colorspace};else{const s=a.texture.image?.data;if(!(s instanceof Uint8Array))throw new Error(`Blender capture image ${r} has no resident raster`);e.images[r]={revision:a.revision,width:a.width,height:a.height,rgba:s.slice(),colorspace:a.texture.colorSpace===Ue?"data":"sRGB",...a.udim?{tiles:a.udim.frame}:{}}}}return e}follow(){const t=new Ge;this.frame&&t.applyFrame(this.fullFrame()),this.followers.add(t),t.leader=this;let e=!1;return{view:t,dispose:()=>{e||(e=!0,this.followers.delete(t),t.leader=null,t.dispose(),t.root.removeFromParent())}}}captureSnapshot(){const t=this.fullFrame(),e=this.frame,o=this.createWorldVolumePass(),r=new Ge;r.photograph=!0;let a=!1;const s=()=>{a||(a=!0,o?.dispose(),r.dispose(),r.root.removeFromParent())};try{r.applyFrame(t),this.root.updateWorldMatrix(!0,!1),r.root.matrix.copy(this.root.matrixWorld),r.root.updateMatrixWorld(!0)}catch(f){throw s(),f}return{effect:o,root:r.root,session:e.session,revision:e.revision,prepare:f=>{if(a)throw new Error("Blender capture snapshot is disposed");return r.setRendered(!0,f)},dispose:s}}createWorldVolumePass(){const t=_o(this.frame?.world);return t?new Gs(t):void 0}recordPresentation(t){if(typeof t!="object"||t===null)return;const e=t,o=e.meshes;if(typeof o!="object"||o===null)return;const r=typeof e.session=="string"?e.session:null;r!==this.submittedSession&&(this.submittedMeshes.clear(),this.photographs.length=0,this.submittedSession=r);const a=o;for(const[s,f]of Object.entries(a))typeof f=="object"&&f!==null&&!("unchanged"in f)&&this.submittedMeshes.set(s,f);for(const s of[...this.submittedMeshes.keys()])s in a||this.submittedMeshes.delete(s);this.submitted={...e,meshes:Object.fromEntries(this.submittedMeshes)}}recordPhotograph(t){this.photographs.push(t)}observations(){return{presentation:this.submitted,photographs:this.photographs}}clear(){this.materialRanges.clear(),this.motionGeometry.clear(),this.transparentInstances.clear(),this.instances.clear();for(const t of this.staged?.meshes.values()??[])t.geometry.dispose();this.staged=null;for(const t of this.lights.values())t.removeFromParent(),t.dispose();this.lights.clear();for(const t of this.objects.values())t.removeFromParent();for(const t of this.meshes.values())t.geometry.dispose();for(const t of this.materials.values())t.dispose();for(const{mesh:t}of this.volumes.values())t.geometry.dispose(),t.material.dispose();for(const{texture:t,udim:e}of this.textures.values())t.dispose(),e?.tiles.dispose(),e?.map.dispose();this.textures.clear(),this.textureNames.clear(),this.roughnessTextureNames.clear(),this.textureSamplers.clear(),this.volumes.clear(),this.objects.clear(),this.meshes.clear(),this.materials.clear()}dispose(){this.clear(),this.fallback.dispose(),this.lighting.dispose(),this.world.dispose(),this.armatureOverlay.dispose(),this.weightOverlay.dispose(),this.cursorOverlay.dispose(),this.extrasOverlay.dispose();for(const t of this.workbenchMaterials.values())t.dispose();this.workbenchMaterials.clear(),this.frame=null,this.retiredSessions.clear(),this.submittedMeshes.clear(),this.submitted=null,this.submittedSession=null,this.photographs.length=0}}const ol=new Ge;function la(n){const t=atob(n),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);return e}function mn(n){const t=la(n);return new Float32Array(t.buffer,t.byteOffset,t.byteLength>>2)}function Yi(n){const t=la(n);return new Uint16Array(t.buffer,t.byteOffset,t.byteLength>>1)}function Zi(n){return new q().set(...n.flat())}function Mo(n,t){return[n.object,n.mesh,n.armature,n.vertexCount,n.bones.length,t].join("|")}class Ki{#e=new Map;#o=null;#a=null;#t=null;#r=null;#n=null;#i=null;#l=new Set;#u=0;#d=[];#s=0;get version(){return this.#u}get engineCalls(){return this.#s}subscribe(t){return this.#l.add(t),()=>this.#l.delete(t)}#f(){this.#u++;for(const t of[...this.#l])t()}state(){const t=this.#t,e=t?.frameStart??1,o=t?.frameEnd??250,r=t?.fps??24;return{frame:this.frame(),start:e,end:o,fps:r,action:t?.action??null,object:t?.object??null,armature:t?.armature??null,bones:[...this.#e.values()].reduce((a,s)=>a+s.bones.length,0),keyframes:t?.keyframes??[],summary:t?.summary??[],clipStart:t?.clipStart??null,clipEnd:t?.clipEnd??null,tracks:t?.tracks.length??0,bound:[...this.#e.keys()],warnings:this.#d,engineCalls:this.#s,blenderFrame:t?.frameCurrent??null}}playhead(){return this.#t?this.frame():null}frame(){const t=this.#t;return this.#r!==null?this.#r:!t||!this.#a||t.clipStart===void 0?t?.frameCurrent??1:t.clipStart+this.#a.time*t.fps}get playable(){return this.#t!==null&&this.#n!==null}async bind(t,e){this.#s++;const o=await e.rig();if(!o)return;const r=[],a=new Set;let s=!1;for(const m of o.rigs){if(!m.object||!m.armature||!m.skinIndexBase64||!m.skinWeightBase64){m.reason&&r.push(m.reason);continue}a.add(m.object);const h=Mo(m,o.frame);if(this.#e.get(m.object)?.signature===h)continue;const _=this.#_(t,m,o.frame,r);_&&(this.#e.get(m.object)?.skeleton.dispose(),this.#e.set(m.object,_),s=!0)}for(const[m,h]of[...this.#e])a.has(m)||(h.skeleton.dispose(),h.boneRoot.removeFromParent(),this.#e.delete(m),s=!0);this.#s++;const f=await e.clip(),c=this.#t,d=f?.frameStart!==c?.frameStart||f?.frameEnd!==c?.frameEnd||f?.fps!==c?.fps,l=f?.action!==c?.action||f?.tracks.length!==c?.tracks.length||f?.clipStart!==c?.clipStart||f?.clipEnd!==c?.clipEnd;this.#t=f??null,(!f||f.scene!==c?.scene)&&(this.#r=null),f?.reason&&r.push(f.reason),f&&(l||s)&&this.#h(t,f,r);const i=this.#n?.snapshot().activeSubject;d&&i&&this.#n?.setActiveSubject(i);const u=this.#n?.snapshot().playbackState==="playing";f&&!u&&(d||c?.frameCurrent!==f.frameCurrent)&&(this.#c(f.frameCurrent),this.#n&&f.fps>0&&this.#n.seek(f.frameCurrent/f.fps)),this.#d=r,this.#f()}#_(t,e,o,r){const a=t.objectForBlenderName(e.object??""),s=t.objectForBlenderName(e.armature??"");if(!a||!s)return null;const f=a,c=f.geometry;if(!c)return null;const d=c.getAttribute("blenderVertex");if(!d)return r.push(`"${e.object}" cannot be skinned: its presented geometry carries no \`blenderVertex\` attribute, so a per-Blender-vertex weight cannot be expanded onto its drawn vertices.`),null;if(e.vertexCount===0)return null;let l=0;for(let y=0;y<d.count;y++)l=Math.max(l,d.getX(y));if(l>=e.vertexCount)return r.push(`"${e.object}" is not skinned here: its presented geometry references Blender vertex ${l} while the mesh declares ${e.vertexCount}, which is a generative modifier (Subdivision, Mirror, Array…) between the two. Blender's own viewport shows the evaluated result; this presenter shows the exported columns unskinned.`),null;const i=Yi(e.skinIndexBase64??""),u=mn(e.skinWeightBase64??""),m=d.count,h=new Uint16Array(m*4),_=new Float32Array(m*4);for(let y=0;y<m;y++){const A=d.getX(y);for(let M=0;M<4;M++)h[y*4+M]=i[A*4+M]??0,_[y*4+M]=u[A*4+M]??0}c.setAttribute("skinIndex",new ja(h,4)),c.setAttribute("skinWeight",new Rt(_,4));const p=new ut;p.name=`${e.armature}:bones`;const g=[],v=e.bones.map(y=>Zi(y.pose)),w=new Map(e.bones.map((y,A)=>[y.name,A]));e.bones.forEach((y,A)=>{const M=new Va;M.name=y.name,g.push(M);const P=y.parent===null?void 0:w.get(y.parent);(P===void 0?v[A].clone():v[P].clone().invert().multiply(v[A])).decompose(M.position,M.quaternion,M.scale),(P===void 0?p:g[P]).add(M)}),s.add(p);const x=new Ba(c,f.material);x.name=f.name,x.matrixAutoUpdate=!1,x.matrix.copy(f.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale),x.userData=f.userData,x.frustumCulled=!1,t.replacePresentedObject(f,x),t.root.updateMatrixWorld(!0);const T=new Ua(g);return x.bind(T,x.matrixWorld.clone()),e.constrainedBones?.length&&r.push(`Bone constraints on ${e.constrainedBones.join(", ")}: the clip is derived from the F-Curves alone, so those bones play their channels rather than Blender's solved pose.`),e.unmappedGroups?.length&&r.push(`${e.object} carries vertex groups no bone is named for (${e.unmappedGroups.join(", ")}); they weight nothing here, exactly as they deform nothing in Blender.`),{object:e.object??"",armature:e.armature??"",mesh:x,boneRoot:p,bones:g,skeleton:T,frame:o,signature:Mo(e,o)}}#h(t,e,o){if(this.#o?.stopAllAction(),this.#o=null,this.#a=null,!e.tracks.length||e.clipStart===void 0||e.clipEnd===void 0)return;const r=e.armature?t.objectForBlenderName(e.armature):null;if(!r)return;const a=new Map;for(const i of this.#e.values())if(i.armature===e.armature)for(const u of i.bones)a.set(u.name,u);const s=[],f=new Set;for(const i of e.tracks){const u=a.get(i.bone);if(!u){f.add(i.bone);continue}const m=mn(i.timeBase64),h=mn(i.valueBase64),_=`${u.uuid}.${i.property}`;s.push(i.property==="quaternion"?new Wa(_,Array.from(m),Array.from(h)):new qa(_,Array.from(m),Array.from(h)))}if(f.size&&o.push(`${e.action} animates ${[...f].join(", ")}, which this binding has no bone for.`),!s.length)return;const c=e.duration??(e.clipEnd-e.clipStart)/e.fps,d=new Ha(r),l=d.clipAction(new Ga(e.action??"action",c,s));l.setLoop(Xa,Number.POSITIVE_INFINITY),l.play(),this.#o=d,this.#a=l,this.#c(e.frameCurrent),this.#m()}#c(t){const e=this.#t;if(!e)return;const o=Math.min(e.frameEnd,Math.max(e.frameStart,t));if(this.#r=o,!this.#o||e.clipStart===void 0||e.clipEnd===void 0)return;const r=(e.clipEnd-e.clipStart)/e.fps;this.#o.setTime(Math.max(0,Math.min(r-1e-4,(o-e.clipStart)/e.fps))),this.#m()}#m(){for(const t of this.#e.values())t.boneRoot.updateMatrixWorld(!0),t.skeleton.update()}get scene(){return this.#t?.scene??null}async writeBookmark(){const t=Math.round(this.frame()),e=this.#t;if(!e)return t;const o=e.scene;return!o||e.frameCurrent===t||(this.#s++,await Qa(`bpy.data.scenes[${JSON.stringify(o)}]`,"frame_current",t,void 0,!1),this.#t={...e,frameCurrent:t},this.#f()),t}get transport(){return this.#n}attachTo(t){this.#i?.(),this.#n=t;const e=t.attach({id:this.#t?.action??"blender-action",label:this.#t?.action??"Action",range:()=>{const s=this.#t,f=s?.fps||24;return{start:(s?.frameStart??1)/f,end:(s?.frameEnd??250)/f,fps:f}},seek:s=>this.seekSeconds(s)}),o=t.onSettled(()=>{this.writeBookmark()}),r=()=>{o(),e(),this.#n===t&&(this.#n=null),this.#i=null};this.#i=r;const a=this.#t;return a&&a.fps>0&&t.seek(a.frameCurrent/a.fps),r}seekSeconds(t){const e=this.#t?.fps||24;this.#c(Math.round(t*e)),this.#f()}keyframes(){return(this.#t?.keyframes??[]).map(t=>t.frame)}dispose(){this.#i?.(),this.#o?.stopAllAction(),this.#o=null,this.#a=null,this.#t=null,this.#r=null;for(const t of this.#e.values())t.skeleton.dispose(),t.boneRoot.removeFromParent();this.#e.clear()}}const fa=new Ki;function al(n){return fa.subscribe(n)}function rl(){return fa.version}export{fa as a,rl as b,ol as c,al as s};
|
|
7194
|
+
#include <opaque_fragment>`)},a.customProgramCacheKey=()=>"volter-blender-workbench",a}const yi=64;function wi(n,t){return Array.isArray(n)&&Array.isArray(t)?n.length===t.length&&n.every((e,o)=>e===t[o]):n===t}function He(n){return n.onBeforeRender===Ve.prototype.onBeforeRender&&n.onAfterRender===Ve.prototype.onAfterRender}function ee(n){for(let t=n;t;t=t.parent)if(!t.visible)return!1;return!0}function Tn(n){if(n.determinant()<=0)return!1;const t=n.elements,e=Math.hypot(t[0],t[1],t[2]),o=Math.hypot(t[4],t[5],t[6]),r=Math.hypot(t[8],t[9],t[10]),a=(s,f)=>t[s]*t[f]+t[s+1]*t[f+1]+t[s+2]*t[f+2];return Number.isFinite(e+o+r)&&Math.min(e,o,r)>0&&Math.abs(a(0,4))<=1e-7*e*o&&Math.abs(a(0,8))<=1e-7*e*r&&Math.abs(a(4,8))<=1e-7*o*r}class Oi{constructor(t){this.root=t,this.batches=[],this.inverse=new q,this.matrix=new q,this.box=new me,this.projection=new q,this.frustum=new Ke,this.camera=null,this.eligible=0,this.excluded={}}rebuild(t,e){if(this.clear(),!e)return;const o=new Map,r=a=>{this.excluded[a]=(this.excluded[a]??0)+1};this.inverse.copy(this.root.matrixWorld).invert();for(const a of t){const s=a;if(!s.isMesh)continue;if(!He(s)){r("customHooks");continue}if(s.isSkinnedMesh||s.isInstancedMesh||s.morphTargetInfluences||s.layers.mask!==1){r("deformationOrLayers");continue}const f=Array.isArray(s.material)?s.material:[s.material];if(f.some(l=>l.transparent||l.transmission>0||l.isShaderMaterial||!Te(l))){r("material");continue}if(f.some(l=>ta(l,s.geometry).size>12)){r("attributeBudget");continue}if(this.matrix.multiplyMatrices(this.inverse,s.matrixWorld),!Tn(this.matrix)){r("transform");continue}this.eligible++;const c=`${s.geometry.id}:${Array.isArray(s.material)?"slots":"single"}:`+f.map(l=>l.uuid).join(",")+`:${s.renderOrder}`,d=o.get(c);d?d.push(s):o.set(c,[s])}for(const a of o.values()){if(a.length<2)continue;const s=f=>{if(f.length>yi){this.box.makeEmpty();for(const h of f)this.box.expandByPoint(new b().setFromMatrixPosition(h.matrixWorld));const i=this.box.getSize(new b),u=i.x>=i.y&&i.x>=i.z?12:i.y>=i.z?13:14;f.sort((h,_)=>h.matrixWorld.elements[u]-_.matrixWorld.elements[u]);const m=Math.floor(f.length/2);s(f.slice(0,m)),s(f.slice(m));return}if(f.length<2)return;const c=f[0],d=new Co(c.geometry,c.material,f.length);d.name="Blender repeated geometry",d.userData.engineInternal=!0,d.matrixAutoUpdate=!1,d.renderOrder=c.renderOrder,d.instanceMatrix.setUsage(Fo);const l={draw:d,members:f.map(i=>({mesh:i,layers:i.layers.mask}))};d.raycast=(i,u)=>{for(const{mesh:m}of l.members)m.layers.mask===0&&ee(m)&&m.raycast(i,u)},this.root.add(d),d.updateMatrixWorld(!0),this.batches.push(l)};s(a)}this.sync()}sync(){if(this.batches.length){this.inverse.copy(this.root.matrixWorld).invert();for(const{draw:t,members:e}of this.batches){const r=(Array.isArray(t.material)?t.material:[t.material]).every(Te);let a=0,s=!1;for(const f of e){const{mesh:c}=f;if(this.matrix.multiplyMatrices(this.inverse,c.matrixWorld),!(c.parent!==null&&c.geometry===t.geometry&&r&&He(c)&&wi(c.material,t.material)&&Tn(this.matrix))){c.layers.mask|=f.layers;continue}if(c.layers.mask&=~f.layers,!ee(c)||this.camera&&(!this.camera.layers.isEnabled(0)||c.frustumCulled&&!this.frustum.intersectsObject(c)))continue;const l=a*16;this.matrix.elements.some((i,u)=>Math.fround(i)!==t.instanceMatrix.array[l+u])&&(t.setMatrixAt(a,this.matrix),s=!0),a++}s||=t.count!==a||t.boundingSphere===null,t.count=a,s&&(t.instanceMatrix.needsUpdate=!0,t.computeBoundingBox(),t.computeBoundingSphere())}}}prepareDraw(t){t.updateMatrixWorld(),this.camera=t,this.projection.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this.frustum.setFromProjectionMatrix(this.projection)}finishDraw(){this.camera=null}clear(){this.camera=null;for(const{draw:t,members:e}of this.batches){for(const{mesh:o,layers:r}of e)o.layers.mask|=r;t.removeFromParent(),t.dispose()}this.batches.length=0,this.eligible=0,this.excluded={}}inspect(){return{batches:this.batches.length,instances:this.batches.reduce((t,{draw:e})=>t+e.count,0),eligible:this.eligible,excluded:{...this.excluded}}}}const Sn=64,cn=4*1024*1024,Ai=32*1024*1024,Mi=1024;class Ti{constructor(){this.families=new Map,this.partitions=new Map,this.registrations=new Map,this.bytes=0,this.drawCount=0,this.created=0,this.pending=!1}begin(){this.created=0,this.pending=!1,this.registrations.clear()}register(t,e,o){const r=`${t.id}:${e.uuid}:${o}`;if(this.registrations.has(r))return this.registrations.get(r);this.registrations.set(r,null);const a=t.getAttribute("position"),s=t.index?.count??a?.count??0;if(!a||t.drawRange.start!==0||t.drawRange.count<s||Object.keys(t.morphAttributes).length)return null;const f=[!!t.index,t.userData.blenderUvChannels??null],c=[t.index?.id,t.index?.version];let d=(t.index?.count??0)*4;for(const p of Object.keys(t.attributes).sort()){const g=t.getAttribute(p);if(!(g instanceof lt)||g.isInstancedBufferAttribute||g instanceof za||g.count!==a.count)return null;f.push([p,g.array.constructor.name,g.itemSize,g.normalized,g.gpuType]),c.push(p,g.id,g.version),d+=g.array.byteLength}if(d>cn)return null;const l=`multi:${e.uuid}:${o}:${JSON.stringify(f)}`;let i=this.partitions.get(l);i||(i=[],this.partitions.set(l,i));let u=i.find(p=>this.families.get(p).shapes.has(t.id));u??=i.find(p=>this.families.get(p).reservedBytes+d<=cn),u||(u=`${l}:${i.length}`,i.push(u));let m=this.families.get(u);m||(m={material:e,shapes:new Map,template:null,ids:new Map,draws:[],dirty:!0,bytes:0,reservedBytes:0,refused:!1},this.families.set(u,m));const h=JSON.stringify(c),_=m.shapes.get(t.id);return(!_||_.stamp!==h)&&(m.reservedBytes+=d-(_?.bytes??0),m.shapes.set(t.id,{geometry:t,stamp:h,bytes:d}),m.dirty=!0),this.registrations.set(r,u),u}pack(){for(const t of this.families.values()){if(!t.dirty)continue;this.release(t),t.dirty=!1;let e=0,o=0,r=0;for(const{geometry:f}of t.shapes.values()){e+=f.getAttribute("position").count,o+=f.index?.count??0;for(const c of Object.values(f.attributes))r+=c.array.byteLength}if(r+=o*(e>65535?4:2),t.refused=r>cn||this.bytes+r>Ai,t.refused)continue;const a=new Ae(Sn,e,o,t.material);a.sortObjects=!1,a.perObjectFrustumCulled=!1,a.frustumCulled=!1,a.matrixAutoUpdate=!1,a.boundingSphere=new Nn,a.name="Blender ordered multi-draw",a.userData.engineInternal=!0;for(const{geometry:f}of t.shapes.values())t.ids.set(f.id,a.addGeometry(f));const s=t.shapes.values().next().value.geometry;a.geometry.userData.blenderUvChannels=s.userData.blenderUvChannels;for(const f of Object.keys(s.attributes))a.geometry.getAttribute(f).gpuType=s.getAttribute(f).gpuType;t.template=a,t.bytes=r,this.bytes+=r}}available(t){return!!this.families.get(t)?.template}get(t,e){const o=this.families.get(t),r=o.template;if(!r)return null;let a=o.draws[e];if(!a){if(this.drawCount>=Mi)return null;if(this.created>=4)return this.pending=!0,null;a=new Ae(1,0,0,o.material),a.dispose(),a.copy(r),Object.defineProperty(a,"colorTexture",{value:null});for(const f of Object.keys(r.geometry.attributes))a.geometry.setAttribute(f,r.geometry.getAttribute(f));a.geometry.setIndex(r.geometry.index);const s=o.ids.values().next().value;for(let f=0;f<Sn;f++)a.addInstance(s),a.setVisibleAt(f,!1);o.draws.push(a),this.created++,this.drawCount++}return a}geometryId(t,e){return this.families.get(t).ids.get(e.id)}inspect(){return{bytes:this.bytes,draws:this.drawCount,pending:this.pending,refusedFamilies:[...this.families.values()].filter(t=>t.refused).length}}release(t){for(const e of t.draws){e.removeFromParent();for(const o of Object.keys(e.geometry.attributes))e.geometry.deleteAttribute(o);e.geometry.setIndex(null),e.dispose(),this.drawCount--}t.draws.length=0,t.template?.dispose(),t.template=null,t.ids.clear(),this.bytes-=t.bytes,t.bytes=0}clear(){for(const t of this.families.values())this.release(t);this.families.clear(),this.partitions.clear(),this.registrations.clear(),this.pending=!1}}const bo=128;class Si{constructor(){this.sources=new Map,this.geometryKeys=new Map,this.frame=0,this.count=0}begin(){this.frame++,this.geometryKeys.clear()}get(t,e){let o=this.geometryKeys.get(e.geometry);o===void 0&&(o=JSON.stringify([e.geometry.userData.blenderUvChannels??null,Object.keys(e.geometry.attributes).sort().map(f=>[f,e.geometry.getAttribute(f).itemSize])]),this.geometryKeys.set(e.geometry,o));const r=`${e instanceof Ae?"batch":"instance"}:${o}`;let a=this.sources.get(t);a||(a=new Map,this.sources.set(t,a));let s=a.get(r);if(s)s.frame!==this.frame&&(s.ready=mo(t,s.material)!==null,s.sourceVersion!==t.version&&(s.material.needsUpdate=!0),s.sourceVersion=t.version,s.frame=this.frame);else{if(this.count>=bo)return t;const f=mo(t);if(!f)return t;s={material:f,sourceVersion:t.version,frame:this.frame,ready:!0},a.set(r,s),this.count++}return s.ready?s.material:t}clear(){for(const t of this.sources.values())for(const{material:e}of t.values())e.dispose();this.sources.clear(),this.geometryKeys.clear(),this.count=0}inspect(){return{variants:this.count,limit:bo}}}const ie=Sn;function yo(n){for(let t=n.parent;t;t=t.parent)if(t.isGroup)return t.renderOrder;return 0}class Pi{constructor(t){this.root=t,this.objects=[],this.drawMaterials=new Si,this.ordered=new Ti,this.mixedDraws=new Map,this.multiDraw=!1,this.pools=new Map,this.hidden=[],this.inverse=new q,this.matrix=new q,this.projection=new q,this.frustum=new Ke,this.centre=new b,this.depth=new Xe,this.batches=0,this.instances=0,this.excluded={},this.plannedProjection=new q,this.projectionKnown=!1,this.planState=[],this.planned=[],this.stateIndex=0,this.stateChanged=!1}setObjects(t){this.clear(),this.objects=[...t].filter(e=>e.isMesh===!0)}prepare(t,e=!1){if(this.finishDraw(),this.drawMaterials.begin(),!this.objects.length)return;t.updateMatrixWorld(),this.projection.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);const o=this.multiDraw!==e;if(this.multiDraw=e,!this.planChanged(t)&&!o&&!this.ordered.pending){for(const c of this.planned){c.mesh.visible=!0;const d=c.members[0].material;c.mesh.material=this.drawMaterials.get(Array.isArray(d)?d[0]:d,c.mesh);for(const l of c.members)l.layers.disable(0),this.hidden.push(l)}return}this.planned.length=0;for(const c of this.mixedDraws.values())c.members.length=0;this.ordered.begin();for(const c of this.pools.values())for(const d of c)d.mesh.visible=!1,d.members.length=0;this.batches=this.instances=0,this.excluded={},this.frustum.setFromProjectionMatrix(this.projection),this.inverse.copy(this.root.matrixWorld).invert();const a=[],s=new Map;for(const c of this.objects){const d=Array.isArray(c.material)?c.material:[c.material];if(!d.some(v=>v.visible&&v.transparent)||!ee(c)||!c.layers.test(t.layers)||c.frustumCulled&&!this.frustum.intersectsObject(c))continue;const l=c;l.boundingSphere!==void 0?(l.boundingSphere===null&&l.computeBoundingSphere?.(),this.centre.copy(l.boundingSphere.center)):(c.geometry.boundingSphere||c.geometry.computeBoundingSphere(),this.centre.copy(c.geometry.boundingSphere.center)),this.centre.applyMatrix4(c.matrixWorld);const i=this.centre.clone(),u=this.depth.set(i.x,i.y,i.z,1).applyMatrix4(this.projection).z;let m=null,h=null;const _=d.length===1?d[0]:null,p=yo(c);if(_&&_.visible&&_.transparent&&Te(_)&&He(c)&&!_.isShaderMaterial&&!(_.transmission>0)&&(_.side!==Be||_.forceSinglePass)&&!c.isSkinnedMesh&&!c.morphTargetInfluences&&!c.isInstancedMesh&&c.layers.mask===1&&p===this.root.renderOrder){const v=c.geometry,w=v.index?.count??v.getAttribute("position").count,x=!Array.isArray(c.material)||v.groups.length===1&&v.groups[0].start===0&&v.groups[0].count===w&&v.groups[0].materialIndex===0,T=`${v.id}:${_.uuid}:${c.renderOrder}`;let y=s.get(T);y===void 0&&(y=ta(_,v).size<=12,s.set(T,y)),this.matrix.multiplyMatrices(this.inverse,c.matrixWorld),x&&y&&Tn(this.matrix)&&(m=_,h=T)}if(h===null){const v=_?_.isShaderMaterial?"customShader":_.transmission>0?"transmission":_.side===Be&&!_.forceSinglePass?"twoPass":"geometryLayersOrTransform":"multipleMaterials";this.excluded[v]=(this.excluded[v]??0)+1}const g=e&&h&&m?this.ordered.register(c.geometry,m,c.renderOrder):null;a.push({mesh:c,material:m,key:h,batchKey:g,groupOrder:p,z:u,centre:i})}this.ordered.pack();for(const c of a)c.batchKey&&this.ordered.available(c.batchKey)&&(c.key=c.batchKey);for(const[c]of this.mixedDraws)c.parent||this.mixedDraws.delete(c);a.sort((c,d)=>c.groupOrder-d.groupOrder||c.mesh.renderOrder-d.mesh.renderOrder||d.z-c.z||c.mesh.id-d.mesh.id);const f=new Map;for(let c=0;c<a.length;){const d=a[c];let l=c+1;if(d.key!==null)for(;l<a.length&&a[l].key===d.key;)l++;const i=a[c-1],u=a[l],m=i?.z===d.z&&i.mesh.renderOrder===d.mesh.renderOrder||u?.z===a[l-1].z&&u.mesh.renderOrder===d.mesh.renderOrder;if(d.key!==null&&l-c>=2&&!m){let h=!0;for(let _=c+ie;_<l;_+=ie)a[_-1].z===a[_].z&&(h=!1);if(h)for(let _=c;_<l;_+=ie){const p=Math.min(ie,l-_);if(p<2)continue;const g=a[_],v=f.get(d.key)??0;f.set(d.key,v+1);const w=d.key.startsWith("multi:");let x;if(w){const y=this.ordered.get(d.key,v);if(!y)continue;if(x=this.mixedDraws.get(y),!x){x={mesh:y,members:[]},this.mixedDraws.set(y,x);const A=x;y.raycast=(M,P)=>{if(y.visible)for(const F of A.members)ee(F)&&F.raycast(M,P)},this.root.add(y)}}let T=this.pools.get(d.key);if(T||(T=[],this.pools.set(d.key,T)),w||(x=T[v]),!x){const y=new Co(d.mesh.geometry,d.material,ie);y.name="Blender ordered transparency",y.userData.engineInternal=!0,y.matrixAutoUpdate=!1,y.frustumCulled=!1,y.boundingSphere=new Nn,y.instanceMatrix.setUsage(Fo),x={mesh:y,members:[]};const A=x;y.raycast=(M,P)=>{if(y.visible)for(const F of A.members)ee(F)&&F.raycast(M,P)},T.push(x),this.root.add(y)}x.mesh.material=this.drawMaterials.get(d.material,x.mesh),x.mesh.visible=!0,x.mesh.renderOrder=g.mesh.renderOrder,x.mesh.boundingSphere.center.copy(g.centre).applyMatrix4(this.inverse),x.mesh.updateMatrixWorld(!0);for(let y=0;y<p;y++){const A=a[_+y].mesh;this.matrix.multiplyMatrices(this.inverse,A.matrixWorld),x.mesh.setMatrixAt(y,this.matrix),x.mesh instanceof Ae&&(x.mesh.setGeometryIdAt(y,this.ordered.geometryId(d.key,A.geometry)),x.mesh.setVisibleAt(y,!0)),x.members.push(A),A.layers.disable(0),this.hidden.push(A)}if(x.mesh instanceof Ae)for(let y=p;y<ie;y++)x.mesh.setVisibleAt(y,!1);else x.mesh.count=p,x.mesh.instanceMatrix.needsUpdate=!0;this.planned.push(x),this.batches++,this.instances+=p}}c=l}this.ordered.pending&&queueMicrotask(_t)}inspect(){return{batches:this.batches,instances:this.instances,excluded:{...this.excluded},multiDraw:this.ordered.inspect(),materials:this.drawMaterials.inspect()}}observe(t){this.planState[this.stateIndex]!==t&&(this.planState[this.stateIndex]=t,this.stateChanged=!0),this.stateIndex++}planChanged(t){if(!this.projectionKnown||!this.plannedProjection.equals(this.projection))return this.plannedProjection.copy(this.projection),this.projectionKnown=!0,this.planState.length=0,!0;this.stateIndex=0,this.stateChanged=this.planState.length===0,this.observe(t.layers.mask);for(const r of this.projection.elements)this.observe(r);for(const r of this.root.matrixWorld.elements)this.observe(r);const e=new Set,o=new Set;for(const r of this.objects){if(!(Array.isArray(r.material)?r.material:[r.material]).some(d=>d.visible&&d.transparent))continue;this.observe(r.parent?.id??-1),this.observe(ee(r)?1:0),this.observe(r.layers.mask),this.observe(r.renderOrder),this.observe(yo(r)),this.observe(r.frustumCulled?1:0),this.observe(He(r)?1:0),this.observe(r.morphTargetInfluences?1:0);for(const d of r.matrixWorld.elements)this.observe(d);const s=r.geometry;if(this.observe(s.id),!e.has(s)){e.add(s),this.observe(s.index?.id??-1),this.observe(s.index?.version??-1),this.observe(JSON.stringify(s.userData.blenderUvChannels??null));for(const d of Object.keys(s.attributes).sort()){const l=s.getAttribute(d);this.observe(d),l instanceof lt&&(this.observe(l.id),this.observe(l.version))}}this.observe(s.drawRange.start),this.observe(s.drawRange.count),this.observe(s.index?.count??s.getAttribute("position").count),this.observe(s.groups.length);for(const d of s.groups)this.observe(d.start),this.observe(d.count),this.observe(d.materialIndex??0);const f=r.boundingSphere??s.boundingSphere;this.observe(f?.center.x??0),this.observe(f?.center.y??0),this.observe(f?.center.z??0),this.observe(f?.radius??-1);const c=Array.isArray(r.material)?r.material:null;if(this.observe(c?.length??-1),c)for(const d of c)this.observeMaterial(d,o);else this.observeMaterial(r.material,o)}return this.stateChanged||=this.planState.length!==this.stateIndex,this.planState.length=this.stateIndex,this.stateChanged}observeMaterial(t,e){this.observe(t.uuid),!e.has(t)&&(e.add(t),this.observe(Te(t)?1:0),this.observe(t.version),this.observe(t.visible?1:0),this.observe(t.transparent?1:0),this.observe(t.side),this.observe(t.forceSinglePass?1:0),this.observe(t.transmission??0))}finishDraw(){for(const t of this.hidden)t.layers.enable(0);this.hidden.length=0;for(const t of this.pools.values())for(const{mesh:e}of t)e.visible=!1;for(const{mesh:t}of this.mixedDraws.values())t.visible=!1}clear(){this.finishDraw();for(const t of this.pools.values())for(const{mesh:e}of t)e.removeFromParent(),e.dispose();this.pools.clear(),this.ordered.clear(),this.drawMaterials.clear(),this.mixedDraws.clear(),this.planned.length=0,this.planState.length=0,this.projectionKnown=!1,this.objects=[],this.batches=this.instances=0}}const Ei=8*1024*1024;class Ni{constructor(){this.objects=[],this.copies=new Map,this.swapped=[],this.bytes=0,this.savedDraws=0}setObjects(t){this.clear(),this.objects=[...t].filter(e=>e.isMesh===!0)}prepare(){this.savedDraws=0;for(const t of this.objects){const e=t.geometry,o=t.material;if(t.layers.mask===0||!Array.isArray(o)||e.groups.length<8||!e.index||t.isSkinnedMesh||t.isInstancedMesh||t.morphTargetInfluences||Object.keys(e.morphAttributes).length||e.drawRange.start!==0||e.drawRange.count<e.index.count||o.some(s=>s.transparent||s.transmission>0||s.isShaderMaterial))continue;const r=JSON.stringify([e.id,e.index.id,e.index.version,o.map(s=>s.uuid),e.groups,Object.entries(e.attributes).map(([s,f])=>[s,f.id])]);let a=this.copies.get(r);if(!a){let s=0,f=!0;const c=new Map;for(const m of e.groups){const h=m.materialIndex??0,_=o[h];if(!_||m.start!==s||m.count<=0||m.count%3!==0){f=!1;break}s+=m.count;const p=c.get(_.uuid);p?p.groups.push(m):c.set(_.uuid,{slot:h,groups:[m]})}if(!f||s!==e.index.count||c.size>=e.groups.length)continue;const d=e.index.array.byteLength;if(this.bytes+d>Ei)continue;const l=new re;for(const[m,h]of Object.entries(e.attributes))l.setAttribute(m,h);const i=e.index.clone();let u=0;for(const m of c.values()){const h=u;for(const _ of m.groups)i.array.set(e.index.array.subarray(_.start,_.start+_.count),u),u+=_.count;l.addGroup(h,u-h,m.slot)}l.setIndex(i),l.boundingBox=e.boundingBox?.clone()??null,l.boundingSphere=e.boundingSphere?.clone()??null,l.userData={...e.userData},a={geometry:l,signature:r,bytes:d,before:e.groups.length,after:c.size},this.copies.set(r,a),this.bytes+=d}this.swapped.push({mesh:t,geometry:e}),t.geometry=a.geometry,this.savedDraws+=a.before-a.after}}finish(){for(const{mesh:t,geometry:e}of this.swapped)t.geometry=e;this.swapped.length=0}inspect(){return{copies:this.copies.size,bytes:this.bytes,savedRanges:this.savedDraws}}release(t){for(const e of Object.keys(t.geometry.attributes))t.geometry.deleteAttribute(e);t.geometry.dispose(),this.bytes-=t.bytes}clear(){this.finish();for(const t of this.copies.values())this.release(t);this.copies.clear(),this.objects=[],this.savedDraws=0}}const un=64*1024*1024,wo=150,Ce=49152,Et=8192,Oo=Symbol("navigation geometry replaced");class Ri{constructor(t){this.invalidate=t,this.groups=new Map,this.cache=new Map,this.swapped=[],this.queue=[],this.worker=null,this.pending=null,this.generation=0,this.building=!1,this.nextId=0,this.signature="",this.identities=new WeakMap,this.nextIdentity=0,this.bytes=0,this.unavailable=null,this.reductions=[],this.timer=null,this.cameraWorld=new q,this.cameraProjection=new q,this.cameraKnown=!1,this.movedAt=-1/0,this.projection=new q,this.frustum=new Ke,this.centre=new b,this.boxCentre=new b,this.halfExtent=new b,this.viewWorld=new q,this.drawnMeshes=0,this.fullTriangles=0,this.motionTriangles=0,this.lastNavigation={meshes:0,fullTriangles:0,motionTriangles:0,tooClose:0},this.quietTimer=null}setObjects(t){const e=new Map;for(const s of t){const f=s;if(!f.isMesh||f.isSkinnedMesh||f.isInstancedMesh||f.morphTargetInfluences)continue;const c=f.geometry,d=c.getAttribute("position");if(!c.index||c.index.count<6144||!d||d.count>8e6||Object.values(c.attributes).some(i=>!(i instanceof lt)||i.isFloat16BufferAttribute||i.isInstancedBufferAttribute)||Object.keys(c.morphAttributes).length||c.drawRange.start!==0||c.drawRange.count<c.index.count)continue;if(Array.isArray(f.material)){let i=0;if(!c.groups.length||c.groups.some(u=>{const m=u.start===i&&u.count>0&&u.count%3===0&&Number.isInteger(u.materialIndex)&&u.materialIndex>=0&&u.materialIndex<f.material.length;return i=u.start+u.count,!m})||i!==c.index.count)continue}const l=e.get(c);l?l.push(f):e.set(c,[f])}this.groups=e;const o=s=>{let f=this.identities.get(s);return f===void 0&&(f=++this.nextIdentity,this.identities.set(s,f)),f},r=[...e].map(([s,f])=>`${s.id}:${o(s.index)}:${s.index.version}:${Array.isArray(f[0].material)}:${JSON.stringify(s.groups)}:`+Object.entries(s.attributes).map(([c,d])=>`${c}:${o(d)}:${d.version}`).join(",")).join(";");if(r===this.signature)return;this.releaseCopies(),this.signature=r,this.unavailable=null;const a=[...e].filter(([,s])=>s.length>=3);a.reduce((s,[f,c])=>s+f.index.count*c.length,0)<6e6||(a.sort(([s,f],[c,d])=>c.index.count*d.length-s.index.count*f.length),this.queue=a.map(([s])=>({geometry:s,fine:!1})),this.next())}async next(){if(this.building||this.unavailable||this.bytes>=un)return;const t=this.queue.shift();if(!t){this.worker?.terminate(),this.worker=null;return}const{geometry:e,fine:o}=t;this.building=!0;const r=this.generation,a=()=>{if(r!==this.generation)throw Oo;if(this.unavailable)throw new Error(this.unavailable)},s=async()=>{await new Promise(f=>setTimeout(f,0)),a()};try{this.worker||(this.worker=new Worker(new URL("/assets/blender-motion-worker-CtT2cV3V.js",import.meta.url),{type:"module"}),this.worker.onmessage=N=>{if(this.pending?.id===N.data.id){const D=this.pending;this.pending=null,D.resolve(N.data)}},this.worker.onerror=N=>{this.unavailable=N.message||"Navigation geometry worker unavailable",this.worker?.terminate(),this.worker=null;const D=this.pending;this.pending=null,D?.resolve({id:D.id,refusal:this.unavailable})});const f=e.getAttribute("position"),c=this.groups.get(e),d=Array.isArray(c[0].material);if(c.some(N=>Array.isArray(N.material)!==d))return;const l=d?e.groups:[{start:0,count:e.index.count}],i=l.flatMap(N=>{const D=[];for(let E=N.start;E<N.start+N.count;E+=Ce)D.push({start:E,count:Math.min(Ce,N.start+N.count-E),materialIndex:N.materialIndex});return D}),u=e.getAttribute("blenderVertex"),m=new Uint32Array(f.count),h=new Uint8Array(f.count),_=N=>u?u.getX(N):N;for(let N=0;N<i.length;N++){const D=i[N];for(let E=D.start;E<D.start+D.count;E+=Et){await s();for(let S=E;S<Math.min(E+Et,D.start+D.count);S++){const $=_(e.index.getX(S));if(!Number.isInteger($)||$<0||$>=m.length)return;m[$]?m[$]!==N+1&&(h[$]=1):m[$]=N+1}}}const p=Object.entries(e.attributes).filter(([N])=>N!=="position"&&N!=="blenderVertex"),g=p.reduce((N,[,D])=>N+D.itemSize,0);if(g>32)return;const v=[];let w=0;for(const[N,D]of p)for(let E=0;E<D.itemSize;E++,w++)N!=="normal"&&v.push(w);const x=p.flatMap(([N,D])=>Array(D.itemSize).fill(N==="normal"?.5:1)),T=e.boundingBox?.clone()??new me;if(!e.boundingBox){const N=new b;for(let D=0;D<f.count;D+=Et){await s();for(let E=D;E<Math.min(D+Et,f.count);E++)T.expandByPoint(N.fromBufferAttribute(f,E))}}if(!e.boundingSphere)return;const y=Math.max(T.max.x-T.min.x,T.max.y-T.min.y,T.max.z-T.min.z)*(o?5e-4:.002),A=[],M=[];let P=0,F=0;for(const N of l){const D=P;for(let E=N.start;E<N.start+N.count;E+=Ce){await s();const S=Math.min(E+Ce,N.start+N.count),$=[],X=new Map,K=new Uint32Array(S-E);for(let rt=E;rt<S;rt++){const Tt=e.index.getX(rt);let Lt=X.get(Tt);Lt===void 0&&(Lt=$.length,$.push(Tt),X.set(Tt,Lt)),K[rt-E]=Lt}const nt=new Uint8Array($.length),ot=new Float32Array($.length*3),at=new Float32Array($.length*g);for(let rt=0;rt<$.length;rt+=Et){await s();for(let Tt=rt;Tt<Math.min(rt+Et,$.length);Tt++){const Lt=$[Tt];nt[Tt]=h[_(Lt)];for(let jt=0;jt<3;jt++)ot[Tt*3+jt]=f.getComponent(Lt,jt);let Vn=0;for(const[,jt]of p){for(let Se=0;Se<jt.itemSize;Se++)at[Tt*g+Vn+Se]=jt.getComponent(Lt,Se);Vn+=jt.itemSize}}}const bt=++this.nextId,Pt=await new Promise(rt=>{this.pending={id:bt,resolve:rt};const Tt={id:bt,positions:ot,indices:K,attributes:at,stride:g,weights:x,absoluteError:y,protectedComponents:v,locks:nt};this.worker.postMessage(Tt,[ot.buffer,K.buffer,at.buffer,nt.buffer])});if(a(),Pt.refusal)throw new Error(Pt.refusal);if(!Pt.indices||!Number.isFinite(Pt.error))throw new Error("Invalid navigation geometry response");const $t=Pt.indices;for(let rt=0;rt<$t.length;rt++)$t[rt]=$[$t[rt]];if(P+=$t.length,P*4>un-this.bytes)return;A.push($t),F=Math.max(F,Pt.error)}d&&M.push({start:D,count:P-D,materialIndex:N.materialIndex})}const U={vertices:f.count,fullTriangles:e.index.count/3,reducedTriangles:P/3,error:F,fine:o,accepted:!1};if(this.reductions.length<32&&this.reductions.push(U),!P||P>=e.index.count*.75)return;const H=o?null:new Int32Array(f.count).fill(-1),G=[],J=new Uint32Array(P);let ft=0;for(const N of A){for(let D=0;D<N.length;D+=Et){await s();for(let E=D;E<Math.min(D+Et,N.length);E++){const S=N[E];let $=H?H[S]:S;$<0&&($=G.length,G.push(S),H[S]=$),J[ft+E]=$}}ft+=N.length}const O=J.byteLength+(o?0:Object.values(e.attributes).reduce((N,D)=>N+G.length*D.itemSize*D.array.BYTES_PER_ELEMENT,0));if(U.bytes=O,this.bytes+O>un)return;const B=new re;B.setIndex(new lt(J,1));for(const[N,D]of Object.entries(e.attributes)){if(o){B.setAttribute(N,D);continue}const E=D,S=E.array.constructor,$=new S(G.length*E.itemSize);for(let X=0;X<G.length;X+=Et){await s();for(let K=X;K<Math.min(X+Et,G.length);K++)for(let nt=0;nt<E.itemSize;nt++)$[K*E.itemSize+nt]=E.array[G[K]*E.itemSize+nt]}B.setAttribute(N,new lt($,E.itemSize,E.normalized))}B.boundingSphere=e.boundingSphere.clone(),B.boundingBox=T.clone();for(const N of M)B.addGroup(N.start,N.count,N.materialIndex);B.userData={...e.userData},U.accepted=!0;const L=this.cache.get(e)??[];L.push({geometry:B,error:F,bytes:O,sharedAttributes:o}),this.cache.set(e,L),this.bytes+=O,!o&&e.index.count>=3e5&&P<e.index.count*.25&&this.queue.push({geometry:e,fine:!0})}catch(f){if(f===Oo)return;this.unavailable=String(f),this.worker?.terminate(),this.worker=null,this.pending=null,this.queue.length=0}finally{r===this.generation&&(this.building=!1,this.timer=setTimeout(()=>{this.timer=null,this.next()},0))}}prepare(t,e,o){if(this.finish(),this.drawnMeshes=this.fullTriangles=this.motionTriangles=0,!e||!(o>0))return!1;const r=performance.now(),a=this.cameraKnown&&(!t.matrixWorld.equals(this.cameraWorld)||!t.projectionMatrix.equals(this.cameraProjection));if(this.cameraKnown=!0,this.cameraWorld.copy(t.matrixWorld),this.cameraProjection.copy(t.projectionMatrix),a&&(this.movedAt=r,this.quietTimer&&clearTimeout(this.quietTimer),this.quietTimer=setTimeout(()=>{this.quietTimer=null,this.invalidate()},wo+1)),r-this.movedAt>wo)return!1;this.projection.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this.frustum.setFromProjectionMatrix(this.projection);let s=0;for(const[f,c]of this.cache){const d=c[0].geometry.boundingBox;d.getSize(this.halfExtent).multiplyScalar(.5);for(const l of this.groups.get(f)??[]){if(!ee(l)||l.frustumCulled&&!this.frustum.intersectsObject(l))continue;this.viewWorld.multiplyMatrices(t.matrixWorldInverse,l.matrixWorld);const i=this.viewWorld.elements,u=i[0]**2+i[1]**2+i[2]**2,m=i[4]**2+i[5]**2+i[6]**2,h=i[8]**2+i[9]**2+i[10]**2,_=Math.abs(i[0]*i[4]+i[1]*i[5]+i[2]*i[6]),p=Math.abs(i[0]*i[8]+i[1]*i[9]+i[2]*i[10]),g=Math.abs(i[4]*i[8]+i[5]*i[9]+i[6]*i[10]),v=Math.sqrt(Math.max(u+_+p,m+_+g,h+p+g)),w=f.boundingSphere;this.centre.copy(w.center).applyMatrix4(this.viewWorld);let x=1;if(t.isPerspectiveCamera){const A=-this.centre.z-w.radius*v;d.getCenter(this.boxCentre).applyMatrix4(this.viewWorld);const M=this.viewWorld.elements,P=Math.abs(M[2])*this.halfExtent.x+Math.abs(M[6])*this.halfExtent.y+Math.abs(M[10])*this.halfExtent.z;x=Math.max(A,-this.boxCentre.z-P)}const T=v*Math.abs(t.projectionMatrix.elements[5])*o/(2*x);let y;if(x>0){for(const A of c)if(A.error*T<=1){y=A;break}}if(!y){s++;continue}this.swapped.push({mesh:l,geometry:f}),l.geometry=y.geometry,this.drawnMeshes++,this.fullTriangles+=f.index.count/3,this.motionTriangles+=y.geometry.index.count/3}}return this.lastNavigation={meshes:this.drawnMeshes,fullTriangles:this.fullTriangles,motionTriangles:this.motionTriangles,tooClose:s},this.swapped.length>0}finish(){for(const{mesh:t,geometry:e}of this.swapped)t.geometry=e;this.swapped.length=0}inspect(){return{copies:this.cache.size,levels:[...this.cache.values()].reduce((t,e)=>t+e.length,0),bytes:this.bytes,queued:this.queue.length,pending:this.building,unavailable:this.unavailable,reductions:this.reductions.map(t=>({...t})),lastNavigation:{...this.lastNavigation}}}releaseCopies(){this.finish(),this.timer&&clearTimeout(this.timer),this.timer=null,this.generation++,this.worker?.terminate(),this.worker=null,this.pending?.resolve({id:this.pending.id,refusal:"Navigation geometry replaced"}),this.pending=null,this.building=!1,this.queue=[];for(const t of this.cache.values())for(const e of t){if(e.sharedAttributes)for(const o of Object.keys(e.geometry.attributes))e.geometry.deleteAttribute(o);e.geometry.dispose()}this.cache.clear(),this.bytes=0,this.reductions=[]}clear(){this.releaseCopies(),this.quietTimer&&clearTimeout(this.quietTimer),this.quietTimer=null,this.groups.clear(),this.signature="",this.cameraKnown=!1,this.movedAt=-1/0}}const Ii={WIREFRAME:"wireframe",SOLID:"solid",MATERIAL:"preview",RENDERED:"rendered"},k=I().finite(),ra=W([k,k,k]),Fe=W([I().int().nonnegative(),I().int().nonnegative()]),gt={name:z(),domain:Q(["POINT","EDGE","FACE","CORNER"])},Di=Za("type",[R({...gt,type:Z("FLOAT2"),data:j(W([k,k]))}).strict(),R({...gt,type:Z("FLOAT_VECTOR"),data:j(ra)}).strict(),R({...gt,type:Z("FLOAT_COLOR"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("BYTE_COLOR"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("QUATERNION"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("FLOAT4"),data:j(W([k,k,k,k]))}).strict(),R({...gt,type:Z("FLOAT4X4"),data:j(j(k).length(16))}).strict(),R({...gt,type:Z("INT16_2D"),data:j(W([I().int(),I().int()]))}).strict(),R({...gt,type:Z("INT32_2D"),data:j(W([I().int(),I().int()]))}).strict(),R({...gt,type:Z("FLOAT"),data:j(k)}).strict(),R({...gt,type:Z("INT"),data:j(I().int())}).strict(),R({...gt,type:Z("INT8"),data:j(I().int())}).strict(),R({...gt,type:Z("BOOLEAN"),data:j(et())}).strict(),R({...gt,type:Z("STRING"),data:j(z())}).strict()]),zi=R({positions:Y(Float32Array),normals:Y(Float32Array).nullable(),uv:Y(Float32Array).nullable(),uvLayers:j(R({name:z(),data:Y(Float32Array)}).strict()).optional(),attributeLayers:j(R({name:z(),data:Y(Float32Array)}).strict()).optional(),orco:Y(Float32Array).nullable().optional(),indices:Y(Uint32Array),groups:j(R({start:I().int().nonnegative(),count:I().int().nonnegative(),materialIndex:I().int().nonnegative()}).strict()),hash:z()}).strict(),Ci=R({v:j(ra),f:j(j(I().int().nonnegative())),e:j(Fe).optional(),edge_order:j(Fe).optional(),m:j(I().int().nonnegative()).optional(),s:j(et()).optional(),sharp:j(Fe).optional(),seams:j(Fe).optional(),creases:j(W([k,k,k])).optional(),attributes:j(Di).optional(),active_uv:z().nullable().optional(),render_uv:z().nullable().optional()}).strict(),Fi=R({store:I().int().optional(),revision:I().int(),unchanged:Z(!0)}).strict(),ki=R({co:Gt([Y(Float32Array),Y(Float64Array)]),cornerNormal:Y(Float32Array).optional(),cornerTri:Y(Uint32Array).optional(),orco:Y(Float32Array).optional(),faceStart:Y(Uint32Array),corner:Y(Uint32Array),cornerEdge:Y(Int32Array),edge:Y(Uint32Array),edgeSharp:Y(Uint8Array),edgeSeam:Y(Uint8Array),edgeCrease:Y(Float32Array),material:Y(Uint32Array),smooth:Y(Uint8Array),vertSelect:Y(Uint8Array),vertHide:Y(Uint8Array),edgeSelect:Y(Uint8Array),edgeHide:Y(Uint8Array),faceSelect:Y(Uint8Array),faceHide:Y(Uint8Array)}).strict(),$i=R({name:z(),domain:Q(["POINT","EDGE","FACE","CORNER"]),type:z(),data:Ka(n=>ArrayBuffer.isView(n))}).strict(),sa=R({columns:ki,attributes:j($i),activeUv:z().nullable(),renderUv:z().nullable(),counts:R({verts:I().int().nonnegative(),edges:I().int().nonnegative(),faces:I().int().nonnegative(),corners:I().int().nonnegative()}).strict(),revision:I().int().nonnegative()}).strict(),Li=Gt([zi,sa,Ci,Fi]),Ao=new Set;function ji(n,t){const e=new Blob([n],{type:t}),o=new La;let r=!1;o.addEventListener("dispose",()=>{r=!0,o.image?.close?.()});const a=createImageBitmap(e,{imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(s=>{if(r){s.close();return}o.image=s,o.needsUpdate=!0,_t()}).finally(()=>{Ao.delete(a)});return Ao.add(a),a.catch(()=>{}),{texture:o,ready:a}}function Vi(n,t,e,o){const r=new Ye(n,t,e,Ze,$a);return r.flipY=!1,r.colorSpace=o==="data"?Ue:Ht,r.needsUpdate=!0,r}function Bi(n,t,e){if(t.length===0)throw new Error(`Runtime image ${n} is tiled with no tiles`);const o=Math.max(...t.map(l=>l.width)),r=Math.max(...t.map(l=>l.height)),a=new Uint8Array(o*r*4*t.length),s=Math.max(...t.map(l=>l.number-1001))+1,f=new Float32Array(s*2*4);for(let l=0;l<s;l++)f[l*4]=-1;t.forEach((l,i)=>{const u=l.rgba??(l.rgbaBase64?vn(l.rgbaBase64):void 0);if(!u)throw new Error(`Runtime image ${n} tile ${l.number} carries no raster`);for(let h=0;h<l.height;h++)a.set(u.subarray(h*l.width*4,(h+1)*l.width*4),(i*r+h)*o*4);const m=l.number-1001;f[m*4]=i,f.set([0,0,l.width/o,l.height/r],(s+m)*4)});const c=new ka(a,o,r,t.length);c.colorSpace=e==="data"?Ue:Ht,c.magFilter=oe,c.minFilter=ko,c.generateMipmaps=!0,c.needsUpdate=!0;const d=new Ye(f,s,2,Ze,Ro);return d.magFilter=d.minFilter=pn,d.needsUpdate=!0,{tiles:c,map:d,frame:t}}const Ui=R({width:I().int().positive(),height:I().int().positive(),revision:I().int().nonnegative(),rgba:Y(Uint8Array).optional(),rgbaBase64:z().optional(),colorspace:Q(["sRGB","data"]).optional(),tiles:j(R({number:I().int().min(1001),width:I().int().positive(),height:I().int().positive(),rgba:Y(Uint8Array).optional(),rgbaBase64:z().optional()}).strict()).optional()}).strict(),Wi=R({revision:I().int().nonnegative(),encoded:Y(Uint8Array).optional(),encodedBase64:z().optional(),mime:Q(["image/png","image/jpeg"]),colorspace:Q(["sRGB","data"]).optional()}).strict(),ia=Gt([Ui,Wi]),dn=R({image:R({name:z(),revision:I().int().nonnegative()}).strict(),extension:Q(["REPEAT","EXTEND","MIRROR","CLIP"]).default("REPEAT"),uv:z(),tint:W([k,k,k]).optional()}).strict(),qi=R({name:z(),color:W([k,k,k,k]),roughness:k,metallic:k,transmission:k,ior:k,physical:Us.optional(),normal_texture:dn.optional(),normal_strength:k.default(1),normal_space:Q(["TANGENT","OBJECT"]).default("TANGENT"),normal_directx:et().default(!1),texture:dn.optional(),roughness_texture:dn.optional(),emission:R({color:W([k,k,k]),strength:k}).strict().optional(),graph:hs.optional(),viewport:R({color:W([k,k,k,k]),roughness:k,metallic:k}).strict().optional()}).strict(),Hi=R({session:z(),revision:I().int().nonnegative(),volumes:Ot(z(),Zo).default({}),lights:Ot(z(),Qr).default({}),world:ss.nullable().default(null),meshes:Ot(z(),Li),materials:Ot(z(),qi),images:Ot(z(),ia).default({}),objects:j(R({id:z(),name:z(),type:Q(["MESH","CURVE","SURFACE","FONT","META","ARMATURE","LATTICE","VOLUME","EMPTY","CAMERA","LIGHT","SPEAKER","GREASEPENCIL","POINTCLOUD","LIGHT_PROBE"]),mesh:z().nullable(),volume:z().nullable().optional(),light:z().nullable().optional(),materials:j(z().nullable()),matrix:j(W([k,k,k,k])).length(4),visible:et(),render_visible:et().default(!0),selected:et(),parent:z().nullable(),texspace:W([W([k,k,k]),W([k,k,k])]).optional(),default_color:z().optional()}).strict()),active:z().nullable(),mode:z(),cameras:Ot(z(),Ot(z(),Lo())).default({}),warnings:j(z()).default([]),updated:j(z()).default([]),frame:I().int().default(0),armatures:Ot(z(),er).default({}),weights:Xs.nullable().default(null),cursor:Js.optional(),camera_view:R({scene_camera:z().nullable(),view_layer_cameras:j(z()),aspect:I().finite().positive()}).optional(),light_distances:Ot(z(),W([I().finite(),I().finite()])).default({}),empties:Ot(z(),ri).default({}),view:R({location:W([I(),I(),I()]),rotation:W([I(),I(),I(),I()]),distance:I().finite(),perspective:Q(["PERSP","ORTHO","CAMERA"]),lens:I().finite().positive().default(50),shading:Q(["WIREFRAME","SOLID","MATERIAL","RENDERED"]).optional()}).nullable().optional(),subject:R({frame:I().int(),body:z(),markers:j(W([I().int(),z()]))}).optional(),units:R({system:Q(["NONE","METRIC","IMPERIAL"]),scale_length:I().finite()}).optional()}).strict();function Gi(n,t){for(let e=0,o=n.length-1;e<n.length&&o>=0;e++,o--){if(n[e][0]===t)return n[e][1];if(e===o)break;if(n[o][0]===t)return n[o][1]}return null}const Xi={METRIC:[[1e-6,"Micrometers"],[.001,"Millimeters"],[.01,"Centimeters"],[.1,"10 Centimeters"],[1,"Meters"],[10,"10 Meters"],[100,"100 Meters"],[1e3,"Kilometers"]],IMPERIAL:[[254e-7,"Thou"],[.0254,"Inches"],[.3048,"Feet"],[.9144,"Yards"],[20.1168,"Chains"],[201.168,"Furlongs"],[1609.344,"Miles"]]};class Ge{constructor(){this.root=new ut,this.instances=new Oi(this.root),this.materialRanges=new Ni,this.transparentInstances=new Pi(this.root),this.motionGeometry=new Ri(_t),this.drawBatching=!0,this.objects=new Map,this.meshes=new Map,this.volumes=new Map,this.materials=new Map,this.lights=new Map,this.lighting=new rs,this.world=new Cn,this.armatureOverlay=new dr,this.weightOverlay=new Qs,this.cursorOverlay=new ai,this.extrasOverlay=new li,this.armatureRoot=new ut,this.weightRoot=new ut,this.cursorRoot=new ut,this.cameraExtrasRoot=new ut,this.lightExtrasRoot=new ut,this.emptyExtrasRoot=new ut,this.rendered=!1,this.heldRendered=null,this.worldApplied=null,this.worldKey="null",this.capturing=!1,this.workbench=!1,this.workbenchMaterials=new Map,this.fallback=new ae({color:12172998,roughness:.72}),this.textures=new Map,this.textureNames=new Map,this.roughnessTextureNames=new Map,this.textureSamplers=new Bs,this.graphSamplers=new Map,this.photograph=!1,this.graphs=new Map,this.frame=null,this.retiredSessions=new Set,this.geometryBuilds=0,this.submittedMeshes=new Map,this.submitted=null,this.submittedSession=null,this.photographs=[],this.frameListeners=new Set,this.followers=new Set,this.leader=null,this.cameraViewZoom=ui,this.cameraViewPan=di,this.mode=null,this.drawPreparation={last:null,navigation:null},this.awaitedImages=new Set,this.lookingThrough=null,this.staged=null;const t=this.root.updateMatrixWorld.bind(this.root);this.root.updateMatrixWorld=e=>{t(e),this.instances.sync()},this.root.name="Model",this.root.matrixAutoUpdate=!1,this.root.matrix.set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),this.root.updateMatrixWorld(!0);for(const[e,o]of[[this.armatureRoot,this.armatureOverlay.group],[this.weightRoot,this.weightOverlay.group],[this.cursorRoot,this.cursorOverlay.group],[this.cameraExtrasRoot,this.extrasOverlay.cameras],[this.lightExtrasRoot,this.extrasOverlay.lights],[this.emptyExtrasRoot,this.extrasOverlay.empties]])e.matrixAutoUpdate=!1,e.matrix.copy(this.root.matrix),e.add(o),e.updateMatrixWorld(!0);this.armatureRoot.name="BlenderBones",this.weightRoot.name="BlenderWeights",this.cursorRoot.name="Blender3DCursor",this.cameraExtrasRoot.name="BlenderCameraExtras";for(const e of[this.cameraExtrasRoot,this.lightExtrasRoot,this.emptyExtrasRoot])e.userData.volterPickable=!0;this.lightExtrasRoot.name="BlenderLightExtras",this.emptyExtrasRoot.name="BlenderEmptyExtras"}compiledGraph(t){const e=JSON.stringify(t);let o=this.graphs.get(e);return o||(o=Es(t),this.graphs.size>256&&this.graphs.clear(),this.graphs.set(e,o)),o}mirrorPose(t){let e=null;for(const[a,s]of this.objects)if(s===t){e=a;break}if(e===null)return;const o=this.leader?[this.leader,...this.leader.followers]:[...this.followers];let r=!1;for(const a of o){if(a===this)continue;const s=a.objects.get(e);s!==void 0&&(s.matrix.copy(t.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),r=!0)}r&&_t()}subscribeFrames(t){return this.frameListeners.add(t),()=>{this.frameListeners.delete(t)}}onChange(t){const e=this.subscribeFrames(t),o=Ja(t);return()=>{e(),o()}}blenderObjectName(t){for(const[e,o]of this.objects)if(o===t)return this.frame?.objects.find(r=>r.id===e)?.name??null;return null}noteSavedShading(t){this.frame?.view&&(this.frame.view.shading=t)}savedView(){const t=this.frame?.view;if(!t)return null;const[e,o,r,a]=t.rotation,s=new St(o,r,a,e),f=new b(...t.location).applyMatrix4(this.root.matrix),c=d=>d.applyQuaternion(s).applyMatrix4(this.root.matrix).normalize();return{target:f.toArray(),direction:c(new b(0,0,1)).toArray(),up:c(new b(0,1,0)).toArray(),distance:t.distance,projection:t.perspective==="ORTHO"?"orthographic":"perspective",lens:t.lens,drawMode:t.shading?Ii[t.shading]:null}}cameraViewCamera(){const t=this.frame,e=t?.camera_view;return!t||!e?null:e.scene_camera!==null&&t.cameras[e.scene_camera]?e.scene_camera:t.active!==null&&t.cameras[t.active]?t.active:e.view_layer_cameras.find(o=>t.cameras[o])??null}blenderPose(t,e){const o=new q().copy(this.root.matrix).invert(),r=new q().compose(new b(...t),new St(...e),new b(1,1,1)).premultiply(o),a=new b,s=new St;return r.decompose(a,s,new b),{location:a.toArray(),rotation:[s.w,s.x,s.y,s.z]}}cameraView(t,e,o,r){const a=this.frame,s=vo.safeParse(a?.cameras[t]);return!a?.camera_view||!s.success?null:mi(s.data,this.root.matrix,e,o,r,a.camera_view.aspect)}subjectLine(t){const e=this.frame?.subject;if(e===void 0)return null;const o=t??e.frame,r=Gi(e.markers,o);return`(${o})${e.body}${r===null?"":` <${r}>`}`}gridUnitName(t){const e=this.frame?.units;if(e===void 0||e.system==="NONE")return null;const o=Xi[e.system],r=6*t,a=1/(e.scale_length||1);return(o.find(([f])=>f*a>r)??o[o.length-1])[1]}blenderSelection(){const t=this.frame;return t===null?{selected:[],active:null}:{selected:t.objects.filter(e=>e.selected).map(e=>e.name),active:t.active}}setStageMode(t){this.mode=t}stageMode(){return this.mode}objectForBlenderName(t){const e=this.frame?.objects.find(o=>o.name===t);return e===void 0?null:this.objects.get(e.id)??null}replacePresentedObject(t,e){for(const[o,r]of this.objects)if(r===t){const a=t.parent,s=[...t.children];t.removeFromParent();for(const f of s)e.add(f);a?.add(e),this.objects.set(o,e),this.rebuildInstances();return}}studioLights(){return this.lighting.group}overlayGroups(){return[{kind:"skeletons",object:this.armatureRoot},{kind:"weights",object:this.weightRoot},{kind:"cursor",object:this.cursorRoot},{kind:"cameras",object:this.cameraExtrasRoot},{kind:"lights",object:this.lightExtrasRoot},{kind:"empties",object:this.emptyExtrasRoot}]}placeCursor(t,e,o){const r=new Set(this.objects.values()),a=this.cursorOverlay.placementAt(t,e,o,this.root,s=>r.has(s));return a!==null&&(this.cursorOverlay.show(a),_t()),a}holdRendered(t){t!==this.heldRendered&&(this.heldRendered=t,!this.capturing&&this.report(t===null?this.applyRendered(!1):this.applyRendered(!0,t())))}refreshRendered(){if(this.heldRendered===null||this.capturing)return;const t=this.heldRendered();this.worldKeyFor(t)!==this.worldApplied&&this.report(this.applyRendered(!0,t))}worldKeyFor(t){const o=t.isOrthographicCamera?t.getWorldDirection(new b).toArray().map(r=>r.toFixed(1)).join(","):"";return`${t.uuid}:${o}:${this.worldKey}`}report(t){t.then(_t,e=>console.error(`Rendered shading could not be applied: ${e instanceof Error?e.message:String(e)}`))}setWorkbench(t){t!==this.workbench&&(this.workbench=t,this.applyWorkbench(),_t())}applyWorkbench(){const t=this.workbench&&!this.rendered,e=new Set;for(const o of this.frame?.objects??[]){if(o.mesh===null||o.volume)continue;const r=this.objects.get(o.id);if(!r?.isMesh)continue;const s=(o.materials.length?o.materials:[null]).map(f=>{const c=f===null?this.fallback:this.materials.get(f)??this.fallback;return t?this.workbenchFor(f,c.side,e):c});r.material=o.materials.length?s:s[0]}for(const[o,r]of this.workbenchMaterials)e.has(o)||(r.dispose(),this.workbenchMaterials.delete(o));this.rebuildInstances()}rebuildInstances(){this.transparentInstances.clear(),this.instances.rebuild(this.objects.values(),this.drawBatching&&!this.rendered),this.drawBatching&&!this.rendered&&this.transparentInstances.setObjects(this.objects.values()),this.motionGeometry.setObjects(this.objects.values()),this.materialRanges.setObjects(this.drawBatching&&!this.rendered?this.objects.values():[])}setDrawBatching(t){t!==this.drawBatching&&(this.drawBatching=t,this.rebuildInstances(),_t())}prepareDraw(t,e){try{const o=performance.now();this.instances.prepareDraw(t),this.root.updateMatrixWorld(!0);const r=performance.now(),a=this.motionGeometry.prepare(t,!this.rendered&&(this.mode??this.frame?.mode)==="OBJECT"&&e?.interactive===!0,e?.height??0);a&&this.instances.sync();const s=performance.now();this.materialRanges.prepare();const f=performance.now();this.transparentInstances.prepare(t,e?.multiDraw===!0);const c={opaqueMs:r-o,motionMs:s-r,rangesMs:f-s,transparentMs:performance.now()-f};this.drawPreparation.last=c,a&&(this.drawPreparation.navigation=c)}catch(o){throw this.materialRanges.finish(),this.motionGeometry.finish(),this.instances.finishDraw(),this.transparentInstances.finishDraw(),o}return()=>{this.materialRanges.finish(),this.motionGeometry.finish(),this.instances.finishDraw(),this.transparentInstances.finishDraw()}}workbenchFor(t,e,o){const r=(t!==null?this.frame?.materials[t]?.viewport:void 0)??_i,a=`${r.color.join(",")}|${r.roughness}|${r.metallic}|${e}`;o.add(a);let s=this.workbenchMaterials.get(a);return s||(s=bi(r,e),this.workbenchMaterials.set(a,s)),s}renderedHeld(){return this.heldRendered!==null}async setRendered(t,e){return this.capturing=t,!t&&this.heldRendered!==null?this.applyRendered(!0,this.heldRendered()):this.applyRendered(t,e)}async applyRendered(t,e){const o=(t?_o(this.frame?.world)?.extinction:null)??new b;for(const a of[...this.materials.values(),this.fallback])qs(a,o);this.rendered=t,this.lighting.setRendered(t);const r=t&&e?this.worldKeyFor(e):null;t?(this.capturing||r!==this.worldApplied)&&this.world.apply(this.root,this.frame?.world??null,e):this.world.clear(),this.worldApplied=this.capturing?null:r,this.applyVisibility(),this.applyWorkbench(),this.applyShadows(t,e),t&&(await ts(),await Promise.all([...this.textures.values()].map(a=>a.ready)),await this.world.ready())}applyShadows(t,e){this.root.updateMatrixWorld(!0);const o=[];for(const c of this.objects.values()){const d=c;if(d.isMesh&&(d.castShadow=t,d.receiveShadow=t,t&&d.visible)){const l=new me().setFromObject(d);l.isEmpty()||o.push(l)}}if(!t||!o.length)return;const a=o.reduce((c,d)=>c.union(d),new me).getBoundingSphere(new Nn),s=e?new Ke().setFromProjectionMatrix(new q().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse)):null,f=s?o.flatMap(c=>fs(c,s)):[];for(const c of this.lights.values())c.isDirectionalLight&&e?cs(c,f,o):os(c,a.center,a.radius)}applyOverlays(t){const e=s=>{const f=t.objects.find(c=>c.name===s);return f===void 0?null:new q().set(...f.matrix.flat())},o=[...this.armatureOverlay.apply(t.armatures,e)],r=t.weights?this.objects.get(t.objects.find(s=>s.name===t.weights?.object)?.id??""):void 0,a=this.weightOverlay.apply(t.weights,r??null,t.weights?e(t.weights.object):null);return a!==null&&o.push(a),this.cursorOverlay.apply(t.cursor),this.applyExtras(t),o}setCameraViewShowing(t){this.lookingThrough!==t&&(this.lookingThrough=t,this.frame&&this.applyExtras(this.frame),_t())}applyExtras(t){const e={};for(const[o,r]of Object.entries(t.cameras)){const a=vo.safeParse(r);a.success&&(e[o]=a.data)}this.extrasOverlay.apply({lookingThrough:this.lookingThrough,lightDistances:t.light_distances,objects:t.objects.filter(o=>o.visible),active:t.active,cameras:e,lights:t.lights,empties:t.empties,sceneCamera:t.camera_view?.scene_camera??null,renderAspect:t.camera_view?.aspect??1,presented:o=>{const r=t.objects.find(a=>a.name===o);return r?this.objects.get(r.id)??null:null},image:o=>{const r=this.textures.get(o);if(!r)return null;const a=r.texture.image,s=r.width||a?.width||0,f=r.height||a?.height||0;return(s===0||f===0)&&r.ready&&!this.awaitedImages.has(o)&&(this.awaitedImages.add(o),r.ready.then(()=>{this.awaitedImages.delete(o),this.frame&&this.applyExtras(this.frame),_t()},()=>this.awaitedImages.delete(o))),{texture:r.texture,width:s,height:f}}})}applyVisibility(){for(const t of this.frame?.objects??[]){const e=this.objects.get(t.id);if(e&&(e.visible=this.rendered?t.render_visible:t.visible),!t.light)continue;const o=this.lights.get(t.light);o&&(o.visible=this.rendered&&t.render_visible)}this.armatureOverlay.group.visible=!this.capturing,this.weightOverlay.group.visible=!this.capturing,this.cursorOverlay.group.visible=!this.capturing;for(const t of[this.extrasOverlay.cameras,this.extrasOverlay.lights,this.extrasOverlay.empties])t.visible=!this.capturing}stageFrame(t){if(t.abort||!t.mesh&&!t.image){for(const o of this.staged?.meshes.values()??[])o.geometry.dispose();this.staged=t.abort?null:{session:t.session,revision:t.revision,meshes:new Map,images:new Map};return}const e=this.staged;if(!e||e.session!==t.session||e.revision!==t.revision)throw new Error("Blender frame piece does not belong to the pending revision");if(t.mesh!==void 0){const o=sa.parse(t.piece);if(e.meshes.has(t.mesh))throw new Error("Duplicate Blender mesh piece");const r=`revision:${o.revision}`;e.meshes.set(t.mesh,{signature:r,geometry:$e(Kn({...o.columns,attributes:o.attributes,activeUv:o.activeUv,renderUv:o.renderUv},r))})}else if(t.image!==void 0){if(e.images.has(t.image))throw new Error("Duplicate Blender image piece");e.images.set(t.image,ia.parse(t.piece))}}applyFrame(t){const e=this.frame===null?null:{session:this.frame.session,revision:this.frame.revision},o=Hi.parse(t),r=this.staged;if(r&&(r.session!==o.session||r.revision!==o.revision))throw new Error("Blender frame manifest does not match its staged revision");if(r)for(const[l,i]of r.images)o.images[l]=i;if(this.retiredSessions.has(o.session))throw new Error("The runtime session was replaced; its delayed frame cannot overwrite the active model");if(this.frame?.session===o.session&&o.revision<this.frame.revision)throw new Error("The runtime frame is older than the displayed model");const a=new Set(o.objects.map(l=>l.id));if(a.size!==o.objects.length)throw new Error("Runtime object IDs must be unique");const s=new Map(o.objects.map(l=>[l.id,l]));for(const l of o.objects){if(l.mesh!==null&&!o.meshes[l.mesh])throw new Error(`Missing runtime mesh ${l.mesh}`);if(l.volume&&(!o.volumes[l.volume]||l.mesh!==null))throw new Error(`Invalid runtime volume ${l.volume}`);if(l.light&&(!o.lights[l.light]||l.mesh!==null))throw new Error(`Invalid runtime light ${l.light}`);for(const m of l.materials)if(m!==null&&!o.materials[m])throw new Error(`Missing runtime material ${m}`);const i=new Set([l.id]);let u=l.parent;for(;u!==null;){if(i.has(u))throw new Error("Runtime parent cycle");i.add(u);const m=s.get(u);if(!m)throw new Error(`Missing runtime parent ${u}`);u=m.parent}}const f=new Map,c=new Map;try{for(const[l,i]of Object.entries(o.volumes)){const u=JSON.stringify(i);this.frame?.session===o.session&&this.volumes.get(l)?.signature===u||c.set(l,{signature:u,mesh:us(i)})}for(const[l,i]of Object.entries(o.meshes)){if("unchanged"in i){const _=r?.meshes.get(l);if(_){if(_.signature!==`revision:${i.revision}`)throw new Error("Staged Blender mesh revision mismatch");f.set(l,_);continue}const p=this.meshes.get(l)?.signature;if(this.frame?.session===o.session&&p!==void 0&&(p===`revision:${i.revision}`||!p.startsWith("revision:")))continue;throw new Error(p===void 0?`${Xn}: the presenter does not hold runtime mesh ${l} (store ${i.store}, revision ${i.revision})`:`${Xn}: the presenter holds runtime mesh ${l} at ${p}, not revision ${i.revision}`)}const u="hash"in i,m="columns"in i,h=m?`revision:${i.revision}`:u?i.hash:JSON.stringify(i);this.frame?.session===o.session&&this.meshes.get(l)?.signature===h||f.set(l,{signature:h,geometry:m?$e(Kn({...i.columns,attributes:i.attributes,activeUv:i.activeUv,renderUv:i.renderUv},h)):u?$e(i):Mr(i)})}}catch(l){for(const i of f.values())i.geometry.dispose();for(const{mesh:i}of c.values())i.geometry.dispose(),i.material.dispose();throw l}if(r){for(const[l,i]of r.meshes)f.has(l)||i.geometry.dispose();this.staged=null}this.frame?.session!==o.session&&(this.frame&&this.retiredSessions.add(this.frame.session),this.clear());for(const[l,i]of c){const u=this.volumes.get(l)?.mesh;u&&(u.removeFromParent(),u.geometry.dispose(),u.material.dispose()),this.volumes.set(l,i)}for(const[l,i]of f)this.meshes.get(l)?.geometry.dispose(),this.meshes.set(l,i),this.geometryBuilds++;for(const[l,i]of Object.entries(o.images)){const u=this.textures.get(l);if("width"in i){const g=i.rgba??(i.rgbaBase64?vn(i.rgbaBase64):void 0);if(!g)throw new Error(`Runtime image ${l} carries no raster`);const v=i.tiles?Bi(l,i.tiles,i.colorspace??"sRGB"):void 0;if(u?.udim&&(u.udim.tiles.dispose(),u.udim.map.dispose(),delete u.udim),u&&u.width===i.width&&u.height===i.height){const w=u.texture.image;if(w.data){w.data.set(g),u.texture.needsUpdate=!0,u.revision=i.revision,v&&(u.udim=v);continue}}u?.texture.dispose(),this.textures.set(l,{texture:Vi(g,i.width,i.height,i.colorspace??"sRGB"),width:i.width,height:i.height,revision:i.revision,...v?{udim:v}:{}});continue}const m=i.encoded??(i.encodedBase64?vn(i.encodedBase64):void 0);if(!m)throw new Error(`Runtime image ${l} carries no bytes`);u?.texture.dispose(),u?.udim?.tiles.dispose(),u?.udim?.map.dispose();const h=i.colorspace??"sRGB",{texture:_,ready:p}=ji(m,i.mime);_.colorSpace=h==="data"?Ue:Ht,this.textures.set(l,{texture:_,ready:p,width:0,height:0,revision:i.revision,encoded:{bytes:m.slice(),mime:i.mime,colorspace:h}})}for(const[l,i]of Object.entries(o.materials)){const u=this.materials.get(l)??new ae;u.name=i.name;const m=i.texture?.tint;i.texture!==void 0?u.color.setRGB(m?.[0]??1,m?.[1]??1,m?.[2]??1,xt):u.color.setRGB(i.color[0],i.color[1],i.color[2],xt),u.opacity=i.color[3];const h=u.opacity<1||i.graph!==void 0&&ps(i.graph);u.transparent!==h&&(u.transparent=h,u.needsUpdate=!0),u.roughness=i.roughness,u.metalness=i.metallic,u.transmission=i.transmission,u.ior=i.ior,$n(u,i.physical,{map:i.texture?.extension==="CLIP",roughness:i.roughness_texture?.extension==="CLIP",normal:i.normal_texture?.extension==="CLIP"});const _=i.normal_texture?.image.name;if(_===void 0)u.normalMap&&(this.textureSamplers.delete(`${l}:normal`),u.normalMap=null,u.needsUpdate=!0);else{const x=this.textures.get(_);if(!x)throw new Error(`${he}: missing normal image ${_}`);const T=this.textureSamplers.get(`${l}:normal`,x.texture,i.normal_texture.extension,x.ready,i.normal_texture.uv);u.normalMap!==T&&(u.normalMap=T,u.needsUpdate=!0);const y=i.normal_space==="OBJECT"?Ca:Fa;u.normalMapType!==y&&(u.normalMapType=y,u.needsUpdate=!0),u.normalScale.set(i.normal_strength,i.normal_strength*(i.normal_directx?-1:1))}i.emission?(u.emissive.setRGB(i.emission.color[0],i.emission.color[1],i.emission.color[2],xt),u.emissiveIntensity=i.emission.strength):(u.emissive.setRGB(0,0,0),u.emissiveIntensity=1);const p=i.roughness_texture?.image.name??null;if(p===null)this.roughnessTextureNames.has(l)&&(this.textureSamplers.delete(`${l}:roughness`),u.roughnessMap=null,this.roughnessTextureNames.delete(l),u.needsUpdate=!0);else{const x=this.textures.get(p);if(!x)throw new Error(`${he}: the presenter does not hold runtime image ${p} (revision ${i.roughness_texture.image.revision})`);const T=this.textureSamplers.get(`${l}:roughness`,x.texture,i.roughness_texture.extension,x.ready,i.roughness_texture.uv);u.roughnessMap!==T&&(u.roughnessMap=T,this.roughnessTextureNames.set(l,p),u.needsUpdate=!0)}const g=i.texture?.image.name??null;if(g===null)this.textureNames.has(l)&&(this.textureSamplers.delete(`${l}:color`),u.map=null,this.textureNames.delete(l),u.needsUpdate=!0);else{const x=this.textures.get(g);if(!x)throw new Error(`${he}: the presenter does not hold runtime image ${g} (revision ${i.texture.image.revision})`);const T=this.textureSamplers.get(`${l}:color`,x.texture,i.texture.extension,x.ready,i.texture.uv);u.map!==T&&(u.map=T,this.textureNames.set(l,g),u.needsUpdate=!0)}const v=i.graph?this.compiledGraph(i.graph):null,w=new Set;Rs(u,v,x=>{const T=this.textures.get(x.name);if(!T)throw new Error(`${he}: the presenter does not hold runtime image ${x.name} (revision ${x.revision})`);if(x.tiled){if(!T.udim)throw new Error(`${he}: runtime image ${x.name} arrived without its UDIM tiles`);return T.udim}const y=`${l}:graph:${x.node}`;w.add(y);const A=this.textureSamplers.get(y,T.texture,x.extension,T.ready),M=x.closest?pn:oe,P=x.closest?pn:x.mipmap?ko:oe;return(A.magFilter!==M||A.minFilter!==P)&&(A.magFilter=M,A.minFilter=P,A.needsUpdate=!0),A},this.photograph);for(const x of this.graphSamplers.get(l)??[])w.has(x)||this.textureSamplers.delete(x);this.graphSamplers.set(l,w),this.materials.set(l,u)}for(const l of o.objects){let i=this.objects.get(l.id);const u=l.volume?this.volumes.get(l.volume).mesh:null;if((!i||(u?i!==u:!!i.isMesh!=(l.mesh!==null)))&&(i?.removeFromParent(),i=u??(l.mesh!==null?new kt(this.meshes.get(l.mesh).geometry,this.fallback):new Ve),this.objects.set(l.id,i)),i.name=l.name,l.type==="CAMERA"||l.type==="LIGHT"||l.type==="EMPTY"?i.userData.volterOwnOverlay=!0:delete i.userData.volterOwnOverlay,i.matrixAutoUpdate=!1,i.matrix.set(...l.matrix.flat()),l.parent){const m=new q().set(...s.get(l.parent).matrix.flat());i.matrix.premultiply(m.invert())}if(i.matrix.decompose(i.position,i.quaternion,i.scale),l.texspace?i.userData.blenderTexspace=l.texspace:delete i.userData.blenderTexspace,l.default_color!==void 0?i.userData.blenderDefaultColor=l.default_color:delete i.userData.blenderDefaultColor,l.mesh!==null){const m=i;m.geometry=this.meshes.get(l.mesh).geometry,m.material=l.materials.length?l.materials.map(h=>h===null?this.fallback:this.materials.get(h)):this.fallback,ks(m)}if(l.light){const m=this.lights.get(l.light)??null,h=ns(o.lights[l.light],m);m&&m!==h&&(m.removeFromParent(),m.dispose()),h.parent!==i&&i.add(h),h.userData.volterOwnOverlay=!0,as(h,i),this.lights.set(l.light,h)}}for(const l of o.objects){const i=this.objects.get(l.id),u=l.parent===null?this.root:this.objects.get(l.parent);i.parent!==u&&u.add(i)}for(const[l,i]of this.objects)a.has(l)||(i.removeFromParent(),this.objects.delete(l));for(const[l,i]of this.volumes)o.volumes[l]||(i.mesh.geometry.dispose(),i.mesh.material.dispose(),this.volumes.delete(l));for(const[l,i]of this.meshes)o.meshes[l]||(i.geometry.dispose(),this.meshes.delete(l));for(const[l,i]of this.materials)if(!o.materials[l]){for(const u of["normal","roughness","color"])this.textureSamplers.delete(`${l}:${u}`);for(const u of this.graphSamplers.get(l)??[])this.textureSamplers.delete(u);this.graphSamplers.delete(l),i.dispose(),this.materials.delete(l)}for(const[l,i]of this.lights)o.lights[l]||(i.removeFromParent(),i.dispose(),this.lights.delete(l));this.root.updateMatrixWorld(!0),this.frame={...o,meshes:{},volumes:{},images:{}},this.worldKey=JSON.stringify(o.world??null);const d=this.applyOverlays(o);d.length&&(this.frame={...this.frame,warnings:[...this.frame.warnings,...d]}),this.applyVisibility(),this.applyWorkbench(),this.heldRendered!==null&&!this.capturing&&this.report(this.applyRendered(!0,this.heldRendered()));for(const l of[...this.frameListeners])l();for(const l of this.followers)try{l.applyFrame(t)}catch{l.applyFrame(this.fullFrame())}return{...this.inspect(),held:e}}inspect(){return{session:this.frame?.session,revision:this.frame?.revision,active:this.frame?.active,mode:this.frame?.mode,geometryBuilds:this.geometryBuilds,instancing:this.drawStatistics(),objects:[...this.objects].map(([t,e])=>({id:t,name:e.name,uuid:e.uuid,geometry:e.geometry?.uuid,visible:e.visible}))}}drawStatistics(){return{enabled:this.drawBatching,preparation:{...this.drawPreparation},materialRanges:this.materialRanges.inspect(),opaque:this.instances.inspect(),transparent:this.transparentInstances.inspect(),motion:this.motionGeometry.inspect()}}snapshot(){return this.frame}fullFrame(){const t=this.frame;if(!t)throw new Error("Blender capture requires a presented frame");const e=structuredClone({...t,images:{},armatures:{},weights:null});for(const[r,{signature:a,geometry:s}]of this.meshes){const f=l=>{const i=s.getAttribute(l);if(!i)return null;if(!(i instanceof lt))throw new Error(`Blender capture cannot copy interleaved ${l}`);return new Float32Array(i.array)},c=f("position");if(!c)throw new Error(`Blender capture mesh ${r} has no positions`);const d=s.getIndex();e.meshes[r]={hash:a,positions:c,normals:f("normal"),uv:f("uv"),uvLayers:Object.entries(s.userData.blenderUvChannels??{}).map(([l,i])=>{const u=f(`uv${i}`);if(!u)throw new Error(`Blender capture mesh ${r} is missing UV layer ${l}`);return{name:l,data:u}}),orco:s.userData.blenderOrcoFromDoor?f("blenderOrco"):null,attributeLayers:(s.userData.blenderAttributes??[]).map(l=>{const i=f(qt(l));if(!i)throw new Error(`Blender capture mesh ${r} is missing attribute ${l}`);return{name:l,data:i}}),indices:d?new Uint32Array(d.array):Uint32Array.from({length:c.length/3},(l,i)=>i),groups:s.groups.map(l=>({start:l.start,count:l.count,materialIndex:l.materialIndex??0}))}}for(const[r,{signature:a}]of this.volumes)e.volumes[r]=Zo.parse(JSON.parse(a));const o=new Set(Object.values(e.materials).flatMap(r=>[r.texture?.image.name,r.roughness_texture?.image.name,r.normal_texture?.image.name,...Object.values(r.graph?.nodes??{}).map(a=>a.props.image?.name)].filter(a=>a!==void 0)));for(const r of o){const a=this.textures.get(r);if(!a)throw new Error(`Blender capture image ${r} is not resident`);if(a.encoded)e.images[r]={revision:a.revision,encoded:a.encoded.bytes.slice(),mime:a.encoded.mime,colorspace:a.encoded.colorspace};else{const s=a.texture.image?.data;if(!(s instanceof Uint8Array))throw new Error(`Blender capture image ${r} has no resident raster`);e.images[r]={revision:a.revision,width:a.width,height:a.height,rgba:s.slice(),colorspace:a.texture.colorSpace===Ue?"data":"sRGB",...a.udim?{tiles:a.udim.frame}:{}}}}return e}follow(){const t=new Ge;this.frame&&t.applyFrame(this.fullFrame()),this.followers.add(t),t.leader=this;let e=!1;return{view:t,dispose:()=>{e||(e=!0,this.followers.delete(t),t.leader=null,t.dispose(),t.root.removeFromParent())}}}captureSnapshot(){const t=this.fullFrame(),e=this.frame,o=this.createWorldVolumePass(),r=new Ge;r.photograph=!0;let a=!1;const s=()=>{a||(a=!0,o?.dispose(),r.dispose(),r.root.removeFromParent())};try{r.applyFrame(t),this.root.updateWorldMatrix(!0,!1),r.root.matrix.copy(this.root.matrixWorld),r.root.updateMatrixWorld(!0)}catch(f){throw s(),f}return{effect:o,root:r.root,session:e.session,revision:e.revision,prepare:f=>{if(a)throw new Error("Blender capture snapshot is disposed");return r.setRendered(!0,f)},dispose:s}}createWorldVolumePass(){const t=_o(this.frame?.world);return t?new Gs(t):void 0}recordPresentation(t){if(typeof t!="object"||t===null)return;const e=t,o=e.meshes;if(typeof o!="object"||o===null)return;const r=typeof e.session=="string"?e.session:null;r!==this.submittedSession&&(this.submittedMeshes.clear(),this.photographs.length=0,this.submittedSession=r);const a=o;for(const[s,f]of Object.entries(a))typeof f=="object"&&f!==null&&!("unchanged"in f)&&this.submittedMeshes.set(s,f);for(const s of[...this.submittedMeshes.keys()])s in a||this.submittedMeshes.delete(s);this.submitted={...e,meshes:Object.fromEntries(this.submittedMeshes)}}recordPhotograph(t){this.photographs.push(t)}observations(){return{presentation:this.submitted,photographs:this.photographs}}clear(){this.materialRanges.clear(),this.motionGeometry.clear(),this.transparentInstances.clear(),this.instances.clear();for(const t of this.staged?.meshes.values()??[])t.geometry.dispose();this.staged=null;for(const t of this.lights.values())t.removeFromParent(),t.dispose();this.lights.clear();for(const t of this.objects.values())t.removeFromParent();for(const t of this.meshes.values())t.geometry.dispose();for(const t of this.materials.values())t.dispose();for(const{mesh:t}of this.volumes.values())t.geometry.dispose(),t.material.dispose();for(const{texture:t,udim:e}of this.textures.values())t.dispose(),e?.tiles.dispose(),e?.map.dispose();this.textures.clear(),this.textureNames.clear(),this.roughnessTextureNames.clear(),this.textureSamplers.clear(),this.volumes.clear(),this.objects.clear(),this.meshes.clear(),this.materials.clear()}dispose(){this.clear(),this.fallback.dispose(),this.lighting.dispose(),this.world.dispose(),this.armatureOverlay.dispose(),this.weightOverlay.dispose(),this.cursorOverlay.dispose(),this.extrasOverlay.dispose();for(const t of this.workbenchMaterials.values())t.dispose();this.workbenchMaterials.clear(),this.frame=null,this.retiredSessions.clear(),this.submittedMeshes.clear(),this.submitted=null,this.submittedSession=null,this.photographs.length=0}}const ol=new Ge;function la(n){const t=atob(n),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);return e}function mn(n){const t=la(n);return new Float32Array(t.buffer,t.byteOffset,t.byteLength>>2)}function Yi(n){const t=la(n);return new Uint16Array(t.buffer,t.byteOffset,t.byteLength>>1)}function Zi(n){return new q().set(...n.flat())}function Mo(n,t){return[n.object,n.mesh,n.armature,n.vertexCount,n.bones.length,t].join("|")}class Ki{#e=new Map;#o=null;#a=null;#t=null;#r=null;#n=null;#s=null;#l=new Set;#u=0;#d=[];#i=0;get version(){return this.#u}get engineCalls(){return this.#i}subscribe(t){return this.#l.add(t),()=>this.#l.delete(t)}#f(){this.#u++;for(const t of[...this.#l])t()}state(){const t=this.#t,e=t?.frameStart??1,o=t?.frameEnd??250,r=t?.fps??24;return{frame:this.frame(),start:e,end:o,fps:r,action:t?.action??null,object:t?.object??null,armature:t?.armature??null,bones:[...this.#e.values()].reduce((a,s)=>a+s.bones.length,0),keyframes:t?.keyframes??[],summary:t?.summary??[],clipStart:t?.clipStart??null,clipEnd:t?.clipEnd??null,tracks:t?.tracks.length??0,bound:[...this.#e.keys()],warnings:this.#d,engineCalls:this.#i,blenderFrame:t?.frameCurrent??null}}playhead(){return this.#t?this.frame():null}frame(){const t=this.#t;return this.#r!==null?this.#r:!t||!this.#a||t.clipStart===void 0?t?.frameCurrent??1:t.clipStart+this.#a.time*t.fps}get playable(){return this.#t!==null&&this.#n!==null}async bind(t,e){this.#i++;const o=await e.rig();if(!o)return;const r=[],a=new Set;let s=!1;for(const m of o.rigs){if(!m.object||!m.armature||!m.skinIndexBase64||!m.skinWeightBase64){m.reason&&r.push(m.reason);continue}a.add(m.object);const h=Mo(m,o.frame);if(this.#e.get(m.object)?.signature===h)continue;const _=this.#_(t,m,o.frame,r);_&&(this.#e.get(m.object)?.skeleton.dispose(),this.#e.set(m.object,_),s=!0)}for(const[m,h]of[...this.#e])a.has(m)||(h.skeleton.dispose(),h.boneRoot.removeFromParent(),this.#e.delete(m),s=!0);this.#i++;const f=await e.clip(),c=this.#t,d=f?.frameStart!==c?.frameStart||f?.frameEnd!==c?.frameEnd||f?.fps!==c?.fps,l=f?.action!==c?.action||f?.tracks.length!==c?.tracks.length||f?.clipStart!==c?.clipStart||f?.clipEnd!==c?.clipEnd;this.#t=f??null,(!f||f.scene!==c?.scene)&&(this.#r=null),f?.reason&&r.push(f.reason),f&&(l||s)&&this.#h(t,f,r);const i=this.#n?.snapshot().activeSubject;d&&i&&this.#n?.setActiveSubject(i);const u=this.#n?.snapshot().playbackState==="playing";f&&!u&&(d||c?.frameCurrent!==f.frameCurrent)&&(this.#c(f.frameCurrent),this.#n&&f.fps>0&&this.#n.seek(f.frameCurrent/f.fps)),this.#d=r,this.#f()}#_(t,e,o,r){const a=t.objectForBlenderName(e.object??""),s=t.objectForBlenderName(e.armature??"");if(!a||!s)return null;const f=a,c=f.geometry;if(!c)return null;const d=c.getAttribute("blenderVertex");if(!d)return r.push(`"${e.object}" cannot be skinned: its presented geometry carries no \`blenderVertex\` attribute, so a per-Blender-vertex weight cannot be expanded onto its drawn vertices.`),null;if(e.vertexCount===0)return null;let l=0;for(let y=0;y<d.count;y++)l=Math.max(l,d.getX(y));if(l>=e.vertexCount)return r.push(`"${e.object}" is not skinned here: its presented geometry references Blender vertex ${l} while the mesh declares ${e.vertexCount}, which is a generative modifier (Subdivision, Mirror, Array…) between the two. Blender's own viewport shows the evaluated result; this presenter shows the exported columns unskinned.`),null;const i=Yi(e.skinIndexBase64??""),u=mn(e.skinWeightBase64??""),m=d.count,h=new Uint16Array(m*4),_=new Float32Array(m*4);for(let y=0;y<m;y++){const A=d.getX(y);for(let M=0;M<4;M++)h[y*4+M]=i[A*4+M]??0,_[y*4+M]=u[A*4+M]??0}c.setAttribute("skinIndex",new ja(h,4)),c.setAttribute("skinWeight",new Rt(_,4));const p=new ut;p.name=`${e.armature}:bones`;const g=[],v=e.bones.map(y=>Zi(y.pose)),w=new Map(e.bones.map((y,A)=>[y.name,A]));e.bones.forEach((y,A)=>{const M=new Va;M.name=y.name,g.push(M);const P=y.parent===null?void 0:w.get(y.parent);(P===void 0?v[A].clone():v[P].clone().invert().multiply(v[A])).decompose(M.position,M.quaternion,M.scale),(P===void 0?p:g[P]).add(M)}),s.add(p);const x=new Ba(c,f.material);x.name=f.name,x.matrixAutoUpdate=!1,x.matrix.copy(f.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale),x.userData=f.userData,x.frustumCulled=!1,t.replacePresentedObject(f,x),t.root.updateMatrixWorld(!0);const T=new Ua(g);return x.bind(T,x.matrixWorld.clone()),e.constrainedBones?.length&&r.push(`Bone constraints on ${e.constrainedBones.join(", ")}: the clip is derived from the F-Curves alone, so those bones play their channels rather than Blender's solved pose.`),e.unmappedGroups?.length&&r.push(`${e.object} carries vertex groups no bone is named for (${e.unmappedGroups.join(", ")}); they weight nothing here, exactly as they deform nothing in Blender.`),{object:e.object??"",armature:e.armature??"",mesh:x,boneRoot:p,bones:g,skeleton:T,frame:o,signature:Mo(e,o)}}#h(t,e,o){if(this.#o?.stopAllAction(),this.#o=null,this.#a=null,!e.tracks.length||e.clipStart===void 0||e.clipEnd===void 0)return;const r=e.armature?t.objectForBlenderName(e.armature):null;if(!r)return;const a=new Map;for(const i of this.#e.values())if(i.armature===e.armature)for(const u of i.bones)a.set(u.name,u);const s=[],f=new Set;for(const i of e.tracks){const u=a.get(i.bone);if(!u){f.add(i.bone);continue}const m=mn(i.timeBase64),h=mn(i.valueBase64),_=`${u.uuid}.${i.property}`;s.push(i.property==="quaternion"?new Wa(_,Array.from(m),Array.from(h)):new qa(_,Array.from(m),Array.from(h)))}if(f.size&&o.push(`${e.action} animates ${[...f].join(", ")}, which this binding has no bone for.`),!s.length)return;const c=e.duration??(e.clipEnd-e.clipStart)/e.fps,d=new Ha(r),l=d.clipAction(new Ga(e.action??"action",c,s));l.setLoop(Xa,Number.POSITIVE_INFINITY),l.play(),this.#o=d,this.#a=l,this.#c(e.frameCurrent),this.#m()}#c(t){const e=this.#t;if(!e)return;const o=Math.min(e.frameEnd,Math.max(e.frameStart,t));if(this.#r=o,!this.#o||e.clipStart===void 0||e.clipEnd===void 0)return;const r=(e.clipEnd-e.clipStart)/e.fps;this.#o.setTime(Math.max(0,Math.min(r-1e-4,(o-e.clipStart)/e.fps))),this.#m()}#m(){for(const t of this.#e.values())t.boneRoot.updateMatrixWorld(!0),t.skeleton.update()}get scene(){return this.#t?.scene??null}async writeBookmark(){const t=Math.round(this.frame()),e=this.#t;if(!e)return t;const o=e.scene;return!o||e.frameCurrent===t||(this.#i++,await Qa(`bpy.data.scenes[${JSON.stringify(o)}]`,"frame_current",t,void 0,!1),this.#t={...e,frameCurrent:t},this.#f()),t}get transport(){return this.#n}attachTo(t){this.#s?.(),this.#n=t;const e=t.attach({id:this.#t?.action??"blender-action",label:this.#t?.action??"Action",range:()=>{const f=this.#t,c=f?.fps||24;return{start:(f?.frameStart??1)/c,end:(f?.frameEnd??250)/c,fps:c}},seek:f=>this.seekSeconds(f)}),o=t.onSettled(()=>{this.writeBookmark()});let r=!1;const a=()=>{r||(r=!0,o(),e(),this.#s===a&&(this.#n===t&&(this.#n=null),this.#s=null))};this.#s=a;const s=this.#t;return s&&s.fps>0&&t.seek(s.frameCurrent/s.fps),a}seekSeconds(t){const e=this.#t?.fps||24;this.#c(Math.round(t*e)),this.#f()}keyframes(){return(this.#t?.keyframes??[]).map(t=>t.frame)}dispose(){this.#s?.(),this.#o?.stopAllAction(),this.#o=null,this.#a=null,this.#t=null,this.#r=null;for(const t of this.#e.values())t.skeleton.dispose(),t.boneRoot.removeFromParent();this.#e.clear()}}const fa=new Ki;function al(n){return fa.subscribe(n)}function rl(){return fa.version}export{fa as a,rl as b,ol as c,al as s};
|