@volter/game-editor 0.5.145 → 0.5.146
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 +2135 -2135
- package/dist/assets/{AssetBudgetPanel-8flhcwbD.js → AssetBudgetPanel-Cj7h9s3X.js} +3 -3
- package/dist/assets/{AudioViewer-BYZn4DUK.js → AudioViewer-C2NMmN1c.js} +1 -1
- package/dist/assets/{CanvasBoardDocument-CoNJL2CI.js → CanvasBoardDocument-Dd3wtq7p.js} +1 -1
- package/dist/assets/{CanvasSceneViewport-Dq3V66EU.js → CanvasSceneViewport-0FaWuBze.js} +1 -1
- package/dist/assets/{ColorInput-CZ9YSe5b.js → ColorInput-4LOMybLs.js} +1 -1
- package/dist/assets/{ColorPicker-DytPZaFB.js → ColorPicker-spH4IeyW.js} +1 -1
- package/dist/assets/{EntityModelDocument-BkXCSQxA.js → EntityModelDocument-CTnlWOAG.js} +1 -1
- package/dist/assets/{EnvironmentAssetDocument-DFZWx1WX.js → EnvironmentAssetDocument-DYjIexUh.js} +1 -1
- package/dist/assets/{GameplaySessionTimeline-B8wWEj5v.js → GameplaySessionTimeline-Dcx9Tust.js} +1 -1
- package/dist/assets/{ImageViewer-CIM_I8nH.js → ImageViewer-CQv4oEKB.js} +1 -1
- package/dist/assets/InspectorObjectPreview-BnEt3UNq.js +1 -0
- package/dist/assets/{JsonAssetDocument-gQuwiLdR.js → JsonAssetDocument-Dt86RAz-.js} +1 -1
- package/dist/assets/{LiveModuleDocument-DHCRcqhT.js → LiveModuleDocument-CBox9dZG.js} +1 -1
- package/dist/assets/{LutAssetDocument-B4RQTQCB.js → LutAssetDocument-CdYwavhv.js} +1 -1
- package/dist/assets/{ModelAssetDocument-DJnaaIHX.js → ModelAssetDocument-DIPUGMBf.js} +1 -1
- package/dist/assets/{NonThreeAuthoringBootstrap-CF7BPoB9.js → NonThreeAuthoringBootstrap-Cp7zJ6PO.js} +1 -1
- package/dist/assets/{Object3DDocumentToolbar-DsN2NUQv.js → Object3DDocumentToolbar-CRTrPiAi.js} +1 -1
- package/dist/assets/Object3DDocumentViewport-CMesyIkM.js +2 -0
- package/dist/assets/{Object3DPreview-BwZhzzAg.js → Object3DPreview-Fa0nVIWt.js} +1 -1
- package/dist/assets/{OnlineAssetDetail-DB3yzRTz.js → OnlineAssetDetail-DeY_kRhJ.js} +1 -1
- package/dist/assets/{PlayBar-CfImNQE-.js → PlayBar-D1twbgPU.js} +1 -1
- package/dist/assets/{QuarksAssetDocument-DJGQB4u7.js → QuarksAssetDocument-BwwK54MP.js} +1 -1
- package/dist/assets/{ReactCanvasControls-BkR9VVE8.js → ReactCanvasControls-BQ8gXxs4.js} +1 -1
- package/dist/assets/{RootSelectionOverlay-CSfOoibk.js → RootSelectionOverlay-6PrR0msJ.js} +1 -1
- package/dist/assets/{ShaderAssetDocument-CoiFAJWh.js → ShaderAssetDocument-C9_LgCgY.js} +1 -1
- package/dist/assets/{ShadowEditor-DgBjRx-V.js → ShadowEditor-CN7DmrkP.js} +1 -1
- package/dist/assets/{SourceAssetViewer-O0HH8IOS.js → SourceAssetViewer-CK7ciFBW.js} +1 -1
- package/dist/assets/StageHost-D56PzKrs.js +2 -0
- package/dist/assets/{StoryPreviewMount-Bdx5zbNZ.js → StoryPreviewMount-DJ04sEMk.js} +1 -1
- package/dist/assets/{ThreeBoardDocument-CXv7KFP1.js → ThreeBoardDocument-CH2oiNAp.js} +2 -2
- package/dist/assets/{ThreeIsolationSceneContent-D5WV80fA.js → ThreeIsolationSceneContent-D2DCIpv0.js} +1 -1
- package/dist/assets/{ToolObject3DPreview-BGrgHTE9.js → ToolObject3DPreview-DJWD_bUg.js} +1 -1
- package/dist/assets/{Toolbar-SOKVz9Is.js → Toolbar-CFrBc1nF.js} +1 -1
- package/dist/assets/{TransientHint-C-aFB2Ox.js → TransientHint-luDOQE4y.js} +1 -1
- package/dist/assets/{VideoViewer-B4I4Cbpl.js → VideoViewer-Ck3TJc3E.js} +1 -1
- package/dist/assets/{ViewportShadingMenu-DBsoDPhe.js → ViewportShadingMenu-BSbiK2XW.js} +1 -1
- package/dist/assets/{active-ingest-DOoYv5lC.js → active-ingest-DeIM9C5L.js} +2 -2
- package/dist/assets/{animation-clock-TPDD3KgB.js → animation-clock-D1kC4Z86.js} +1 -1
- package/dist/assets/{animation-mixers.service-fTlm79AY.js → animation-mixers.service-D_QEbPpn.js} +1 -1
- package/dist/assets/{animation-timeline.utility-CagyUWvy.js → animation-timeline.utility-BmvxYBF1.js} +1 -1
- package/dist/assets/{asset-budget-asset.menu-QnQQKyUV.js → asset-budget-asset.menu-BqmJBnJp.js} +1 -1
- package/dist/assets/{asset-budget.action-Denu9n8R.js → asset-budget.action-mfsCOaBe.js} +1 -1
- package/dist/assets/{asset-budget.document-DAQQudBF.js → asset-budget.document-DlTvmR9U.js} +1 -1
- package/dist/assets/{asset-budget.menu-Dhqm1ACI.js → asset-budget.menu-CfFFqH0a.js} +1 -1
- package/dist/assets/{asset-editor-persistence-BPJ80IV2.js → asset-editor-persistence-CYZFLtpb.js} +1 -1
- package/dist/assets/{asset-loaders-Dcnf7Bw6.js → asset-loaders-D-7Pz-E0.js} +1 -1
- package/dist/assets/{asset-preview-BmprxTYE.js → asset-preview-DwWy2SHE.js} +1 -1
- package/dist/assets/{audio-unlock.service-CDSrqMlA.js → audio-unlock.service-BzOgoK0f.js} +1 -1
- package/dist/assets/{audio.utility-Bk4p5xsL.js → audio.utility-Bq8w2r0V.js} +1 -1
- package/dist/assets/autoplay.service-_kVqba2M.js +1 -0
- package/dist/assets/{babylon-authoring-adapter-_KBkPwd9.js → babylon-authoring-adapter-ldSrOv7d.js} +1 -1
- package/dist/assets/{binding-resolver-ClWFzZwl.js → binding-resolver-CLAC4Oou.js} +2 -2
- package/dist/assets/{blender-node-editor.document-BJs-svOJ.js → blender-node-editor.document-Co514xJk.js} +1 -1
- package/dist/assets/{blender-properties-tab-Ca6GGoZA.js → blender-properties-tab-D0pPyu6C.js} +1 -1
- package/dist/assets/{blender-runtime-host-BDbcC0Zg.js → blender-runtime-host-BfAWl8jZ.js} +1 -1
- package/dist/assets/{blender-runtime-skin-C-J3OdY_.js → blender-runtime-skin-ClXU_pYv.js} +2 -2
- package/dist/assets/{blender-runtime.document-0fBzbVqg.js → blender-runtime.document-CzE-1h4j.js} +1 -1
- package/dist/assets/{blender-screenshot.menu-D3yZwxi6.js → blender-screenshot.menu-wvAjkf8o.js} +1 -1
- package/dist/assets/{blender-timeline.document-BOpLOn76.js → blender-timeline.document-D9b7dNPM.js} +1 -1
- package/dist/assets/{blender-uv-editor.document-CNlwlNsR.js → blender-uv-editor.document-BwwjBDOS.js} +1 -1
- package/dist/assets/{blender-version.status-BrfCcN3A.js → blender-version.status-ddgmM7fx.js} +1 -1
- package/dist/assets/{blender.command-B-4gubQH.js → blender.command-DwHKBUyF.js} +1 -1
- package/dist/assets/{board-guides-CAd3Uwwe.js → board-guides-2MWr9kZQ.js} +1 -1
- package/dist/assets/{bridge.command-B_ZMM1Af.js → bridge.command-snxNsDHL.js} +3 -3
- package/dist/assets/{browserAll-DJib4cRK.js → browserAll-DiFaRv4x.js} +1 -1
- package/dist/assets/{build-player.document-Dkk9-Cxq.js → build-player.document-BCYLGI6X.js} +1 -1
- package/dist/assets/{build-profiles.document-E4xigdal.js → build-profiles.document-BfALhOLS.js} +1 -1
- package/dist/assets/{build-progress.status-BmBmwXjj.js → build-progress.status-H9FVq1Nw.js} +1 -1
- package/dist/assets/{build-session-DhHsQRks.js → build-session-C8UTaRpP.js} +1 -1
- package/dist/assets/{build.action-CUifgV58.js → build.action-BZoNXYGP.js} +1 -1
- package/dist/assets/{build.command-BErZJdyz.js → build.command-Cq8b2ZJ6.js} +1 -1
- package/dist/assets/{build.header-Bx2ejMEG.js → build.header-Wgw5RsWT.js} +1 -1
- package/dist/assets/{build.menu-Dpl69Asc.js → build.menu-BfMIBsGC.js} +1 -1
- package/dist/assets/{build.service-BHf0-RtC.js → build.service-DiJ-3Vue.js} +1 -1
- package/dist/assets/{camera-D2f8WceK.js → camera-C04aN_OQ.js} +1 -1
- package/dist/assets/{camera-runtime.inspector-Bed8jPeG.js → camera-runtime.inspector-CnWrVWbT.js} +1 -1
- package/dist/assets/{canvas-design-mount-s-hs4sM5.js → canvas-design-mount-BEO3N1GH.js} +3 -3
- package/dist/assets/{canvas-entry-runtime-DtH7NAl5.js → canvas-entry-runtime-BKXjFEpC.js} +2 -2
- package/dist/assets/{canvas-preview-frames-BgBKQGAL.js → canvas-preview-frames-DlUOebf1.js} +1 -1
- package/dist/assets/{canvas-story-capture.service-Cqk4C8AX.js → canvas-story-capture.service-BD7jC9fG.js} +2 -2
- package/dist/assets/{capability-coverage-CRqjvzDo.js → capability-coverage-CKk539ZB.js} +1 -1
- package/dist/assets/{collaboration-presence-D-oYewcY.js → collaboration-presence-B72eeYMj.js} +1 -1
- package/dist/assets/{collider-phxm70qk.js → collider-C5zjn_5X.js} +1 -1
- package/dist/assets/{component-board.service-CLXsAGWX.js → component-board.service-DIjdm965.js} +2 -2
- package/dist/assets/{component-board.service-CE8B8nHy.js → component-board.service-e02WXSTY.js} +2 -2
- package/dist/assets/{component-board.service-D68yuC-G.js → component-board.service-efFkmqkQ.js} +2 -2
- package/dist/assets/{component-contracts.service-J0ThBCQb.js → component-contracts.service-BDAnLXr_.js} +1 -1
- package/dist/assets/{component-instance-root-CTNzehmC.js → component-instance-root-Bx-2lbRr.js} +1 -1
- package/dist/assets/{component-verbs.command-D9Y2aSPT.js → component-verbs.command-ZqVpT6_N.js} +1 -1
- package/dist/assets/{component-verbs.service-NmQpK7Cp.js → component-verbs.service-M_8-wbha.js} +1 -1
- package/dist/assets/{config-DtFNLMre.js → config-C-2s_BAP.js} +2 -2
- package/dist/assets/{configurations-DizIsCtw.js → configurations-DJKKldTl.js} +1 -1
- package/dist/assets/{connection.status-_545jhmC.js → connection.status-chAq26qI.js} +1 -1
- package/dist/assets/{constraints.inspector-Zg0371sI.js → constraints.inspector-ICwNPfFn.js} +1 -1
- package/dist/assets/{content-bounds-JcLbQeNM.js → content-bounds-_3L42iZv.js} +1 -1
- package/dist/assets/{contract-system-adapters-CborQejG.js → contract-system-adapters-CXVtEEG9.js} +1 -1
- package/dist/assets/{coverage.service-ZvzXk_RH.js → coverage.service-C8DwCiDf.js} +1 -1
- package/dist/assets/{create-runtime-BRhUNQFy.js → create-runtime-D5mvBwj7.js} +1 -1
- package/dist/assets/{curve-ViOyXS6d.js → curve-DJ-hYz0v.js} +1 -1
- package/dist/assets/{data-asset-C4dKbRfK.js → data-asset-Beu0kPMY.js} +1 -1
- package/dist/assets/{data-ref-B0raIwHa.js → data-ref-2NLWnVad.js} +1 -1
- package/dist/assets/{debug-bridge-DPTNskFv.js → debug-bridge-D8_tPne3.js} +1 -1
- package/dist/assets/{debug-registry-Dc3W6vwO.js → debug-registry-BUn-3w5j.js} +1 -1
- package/dist/assets/{deferred-ingest-play-CIebXfgB.js → deferred-ingest-play-CVy431tz.js} +2 -2
- package/dist/assets/{design-time-canvas-mount-BGOBVa9p.js → design-time-canvas-mount-CazAJNIm.js} +2 -2
- package/dist/assets/{design-time-layers-BPYiK7VF.js → design-time-layers-BdvwPtJ0.js} +1 -1
- package/dist/assets/{design-time-mount.service-qJ2qfNGK.js → design-time-mount.service-C20XC1lH.js} +2 -2
- package/dist/assets/{design-time-mount.service-CBc4Am_-.js → design-time-mount.service-CwW4PFPB.js} +2 -2
- package/dist/assets/{design-time-react-mount-CV5Hd5Jd.js → design-time-react-mount-j6ADy2Og.js} +1 -1
- package/dist/assets/{document-preview-three-C_6mBiiE.js → document-preview-three-BKlE3rQf.js} +1 -1
- package/dist/assets/{dom-authoring-adapter-CJzZxsuq.js → dom-authoring-adapter-DQLbnGyg.js} +1 -1
- package/dist/assets/{draco3d-CjtPWm52.js → draco3d-BJljm3nJ.js} +1 -1
- package/dist/assets/{edit-mode-audio.service-B-CjR9wW.js → edit-mode-audio.service-CsUeTv5u.js} +1 -1
- package/dist/assets/{edit-mode-authoring-CCBUV6q2.js → edit-mode-authoring-D54ihZgV.js} +1 -1
- package/dist/assets/{edit-mode-networking.service-Mx_poWhf.js → edit-mode-networking.service-C5uySvAm.js} +1 -1
- package/dist/assets/{editor-api-DNxuq7oq.js → editor-api-B_Q5T6QF.js} +1 -1
- package/dist/assets/{editor-layers-DdJOFmu5.js → editor-layers-Dsfzcx0b.js} +1 -1
- package/dist/assets/{editor-shell-store-BXKwqCuM.js → editor-shell-store-CMpd1UwI.js} +1 -1
- package/dist/assets/{entity-object-dwaTJjul.js → entity-object-BdDiGzfv.js} +1 -1
- package/dist/assets/{extend-D_CXDVWD.js → extend-CMh2M1Wu.js} +1 -1
- package/dist/assets/{fork-menu-DklvmtJS.js → fork-menu-36Axbn1w.js} +1 -1
- package/dist/assets/{frame-debugger-store-D2CIrmXD.js → frame-debugger-store-BcFRdkh5.js} +1 -1
- package/dist/assets/{game-contract-seams-C1m_P4SS.js → game-contract-seams-CkWXZKBr.js} +1 -1
- package/dist/assets/{game-css-scope-transform-BA7ZbLSi.js → game-css-scope-transform-BJCqOoR0.js} +1 -1
- package/dist/assets/{game-document.service-Cce4QU61.js → game-document.service-INZGkGbn.js} +1 -1
- package/dist/assets/{game-eval.command-BkWv-UfA.js → game-eval.command-DoTlb41L.js} +1 -1
- package/dist/assets/{game-module-access-XGEiv_PE.js → game-module-access-CnBDyF7n.js} +1 -1
- package/dist/assets/{game-network-D8ug1x3w.js → game-network-BtjFTt2o.js} +3 -3
- package/dist/assets/{gameplay-export-DoN38r9u.js → gameplay-export-DAFpXOU0.js} +1 -1
- package/dist/assets/{gameplay-replay-DtHDmjp5.js → gameplay-replay-BzXNC4jl.js} +1 -1
- package/dist/assets/{gameplay.command-DYnPT8Lo.js → gameplay.command-CFj50YCT.js} +1 -1
- package/dist/assets/{generation-jobs-BXHZFlzo.js → generation-jobs-DVPIfZGN.js} +1 -1
- package/dist/assets/{generation.service-CGSWxPf1.js → generation.service-B7jbiHj4.js} +1 -1
- package/dist/assets/{generations-DSXF1fKZ.js → generations-BdzYspx9.js} +1 -1
- package/dist/assets/{generations.status-Cf_3wvkx.js → generations.status-rF39D0fJ.js} +1 -1
- package/dist/assets/{hierarchy-marks-D-538fQp.js → hierarchy-marks-CmVlgczH.js} +1 -1
- package/dist/assets/{hosted-asset-materialization-DyuYIe1c.js → hosted-asset-materialization-BE-__aF1.js} +1 -1
- package/dist/assets/{index-Bako454B.js → index-77Pib7-L.js} +1 -1
- package/dist/assets/{index-B_PxgVrX.js → index-BdHcaUix.js} +1 -1
- package/dist/assets/{index-CCKpGWll.js → index-C3Cly1nm.js} +2 -2
- package/dist/assets/{index-CqiPDGfq.js → index-C5sjRs6U.js} +1 -1
- package/dist/assets/{index-9uCSEhwf.js → index-DQvF8ql8.js} +1 -1
- package/dist/assets/{index-BzRGSlHd.js → index-DSGmxuuA.js} +1 -1
- package/dist/assets/{index-Crsbhlhy.js → index-DaRQxpdW.js} +7 -7
- package/dist/assets/{index-B6n4-N99.js → index-DqZQbzOn.js} +1 -1
- package/dist/assets/{index-8RtOnhOo.js → index-DtXV3icG.js} +1 -1
- package/dist/assets/{inference-diagnostics-JiGwiJUe.js → inference-diagnostics-CFKZbcUX.js} +1 -1
- package/dist/assets/{ingest-boot-viewport-BqIgHJiK.js → ingest-boot-viewport-0RCIjGyr.js} +1 -1
- package/dist/assets/{ingest-siblings-C3KBC2OL.js → ingest-siblings-ipe3TEXW.js} +1 -1
- package/dist/assets/{ingest-source-persistence-Bk9qLkTV.js → ingest-source-persistence-BhLgFaNT.js} +1 -1
- package/dist/assets/{ingest.service-DdIqzdni.js → ingest.service-CTFUSkfm.js} +1 -1
- package/dist/assets/{inspect-DPJ1m-DR.js → inspect-BNHDIOcX.js} +1 -1
- package/dist/assets/instances.command-DoTOUMeC.js +1 -0
- package/dist/assets/{json-history-resource-BdE8EcB4.js → json-history-resource-BvTJaESk.js} +1 -1
- package/dist/assets/{layered-pick-CsPry26y.js → layered-pick-CeUEqXrE.js} +1 -1
- package/dist/assets/{light-P3HQqMJN.js → light-DWb5ql01.js} +1 -1
- package/dist/assets/{live-project-verbs-l0iIsIQL.js → live-project-verbs-BeIsYWK0.js} +1 -1
- package/dist/assets/{machine.document-Dz14QA8c.js → machine.document-R_hPyA6L.js} +1 -1
- package/dist/assets/{machines.finder-d1uSMp3z.js → machines.finder-SpgoWz9Z.js} +1 -1
- package/dist/assets/{material-D7yEfFFf.js → material-CBrVqKwQ.js} +1 -1
- package/dist/assets/{material-factory-DzsVJzgQ.js → material-factory-CsbWsZNA.js} +1 -1
- package/dist/assets/{mesh-f9oWqYCD.js → mesh-DJV7OYWi.js} +1 -1
- package/dist/assets/{model-asset-sections.service-Yh4yCNss.js → model-asset-sections.service-kr2Z47JF.js} +1 -1
- package/dist/assets/{model-inspection-C5OZWNER.js → model-inspection-CkDdmvUX.js} +1 -1
- package/dist/assets/{model-thumbnail-DFht0Zea.js → model-thumbnail-Dvqh6Alw.js} +1 -1
- package/dist/assets/{models.finder-zG-WERDy.js → models.finder-Cf1GuDeE.js} +1 -1
- package/dist/assets/{module-mode-CIRC4PLv.js → module-mode-oCNL6WcJ.js} +2 -2
- package/dist/assets/{mount-canvas-ingest-root-WOBvBU2u.js → mount-canvas-ingest-root-McTMBqUU.js} +2 -2
- package/dist/assets/{mount-dom-ingest-root-eYOFvDv6.js → mount-dom-ingest-root-LcPfHoVu.js} +2 -2
- package/dist/assets/{mount-ingest-root-BtlYDYMM.js → mount-ingest-root-N_xkoEr8.js} +2 -2
- package/dist/assets/{mount-manifest-BLFE1lZT.js → mount-manifest-CZcTVc7p.js} +1 -1
- package/dist/assets/{mount-three-ingest-root-Bp78LaZS.js → mount-three-ingest-root-yVgOHHUx.js} +1 -1
- package/dist/assets/{mounted-authoring-C7-8VFjR.js → mounted-authoring-BM-DX0X3.js} +1 -1
- package/dist/assets/{mounted-story-viewport-source-DYFGQweE.js → mounted-story-viewport-source-DzDp_0y7.js} +1 -1
- package/dist/assets/{native-debug-module-DZBcJZ3O.js → native-debug-module-DtxmnSHX.js} +1 -1
- package/dist/assets/{navigation-CLNvQtYC.js → navigation-BcFZXsQl.js} +1 -1
- package/dist/assets/{navmesh.menu-VhuMK-B9.js → navmesh.menu-C4JcsDqb.js} +1 -1
- package/dist/assets/{navmesh.service-9skC9KbW.js → navmesh.service-Cy1wNHHb.js} +1 -1
- package/dist/assets/network-observer.service-QBgwzA0p.js +1 -0
- package/dist/assets/{network.utility-Cx6YQWiW.js → network.utility-B3n9FPtM.js} +1 -1
- package/dist/assets/{object3d-document-session-registry-DYtU0S61.js → object3d-document-session-registry-C19aZYMr.js} +2 -2
- package/dist/assets/{oid-transform--LwgkNr9.js → oid-transform-IdvEHtlc.js} +1 -1
- package/dist/assets/{particles-DCL9brKJ.js → particles-DY5H6WOd.js} +1 -1
- package/dist/assets/{pixi-authoring-adapter-CJsDP9TC.js → pixi-authoring-adapter-Cx778K0H.js} +1 -1
- package/dist/assets/{pixi-live-write-target-BkbfLPLj.js → pixi-live-write-target-B9MBUwKH.js} +1 -1
- package/dist/assets/{play.command-D7U5ws3m.js → play.command-dSyfa0Mp.js} +2 -2
- package/dist/assets/{presentation-BlPdw2Jq.js → presentation-CwNm9mlh.js} +1 -1
- package/dist/assets/{product-BjUMoNzc.js → product-Bbc0LLza.js} +1 -1
- package/dist/assets/{profiler.action-BeMlKn0D.js → profiler.action-Cyyf6VWF.js} +1 -1
- package/dist/assets/{profiler.menu-ByNYDsb_.js → profiler.menu-ClEKTyWO.js} +1 -1
- package/dist/assets/{profiler.utility-QR-GTEWX.js → profiler.utility-C1D2Gg-U.js} +1 -1
- package/dist/assets/{project-authoring-session-D5fR27Xf.js → project-authoring-session-BSob2D65.js} +2 -2
- package/dist/assets/{properties-bone-constraints.inspector-CQ1kzpeW.js → properties-bone-constraints.inspector-L73QxWaS.js} +1 -1
- package/dist/assets/{properties-bone.inspector-BmWvLtS5.js → properties-bone.inspector-Bpp0cSF6.js} +1 -1
- package/dist/assets/{properties-collection.inspector-Bp4G6gAf.js → properties-collection.inspector-j0506O4s.js} +1 -1
- package/dist/assets/{properties-constraints.inspector-C5u2vHgr.js → properties-constraints.inspector-DjTr1Erm.js} +1 -1
- package/dist/assets/{properties-data.inspector-DLuIeVjK.js → properties-data.inspector-By5glSUR.js} +1 -1
- package/dist/assets/{properties-material.inspector-BazVBacy.js → properties-material.inspector-DN56JOAm.js} +1 -1
- package/dist/assets/{properties-modifiers.inspector-BR_xxGgB.js → properties-modifiers.inspector-BxRjWuOR.js} +1 -1
- package/dist/assets/{properties-object.inspector-BT8ErQ5C.js → properties-object.inspector-BHTl-m8G.js} +1 -1
- package/dist/assets/{properties-output.inspector-Db7k-X5n.js → properties-output.inspector-DjbAiJTY.js} +1 -1
- package/dist/assets/{properties-particles.inspector-GHdgdRSV.js → properties-particles.inspector-D1mTEKuy.js} +1 -1
- package/dist/assets/{properties-physics.inspector-CDa8fMg1.js → properties-physics.inspector-Ddxywk7T.js} +1 -1
- package/dist/assets/{properties-render.inspector-ChRA2wF6.js → properties-render.inspector-DlueZX_8.js} +1 -1
- package/dist/assets/{properties-scene.inspector-wox_pPvs.js → properties-scene.inspector-LB3sc51D.js} +1 -1
- package/dist/assets/{properties-texture.inspector-c5cYfvzG.js → properties-texture.inspector-BU-JEAY_.js} +1 -1
- package/dist/assets/{properties-view-layer.inspector-KfYDdJ83.js → properties-view-layer.inspector-BkAjyCpL.js} +1 -1
- package/dist/assets/{properties-world.inspector-DO4TsCFa.js → properties-world.inspector-BXybm5So.js} +1 -1
- package/dist/assets/{r3f-design-session-huIajqIc.js → r3f-design-session-DkmfD2Mx.js} +2 -2
- package/dist/assets/{r3f-physics-binding-YA43TdoL.js → r3f-physics-binding-CmR_FKS6.js} +1 -1
- package/dist/assets/{r3f-source-authoring-adapter-BlRstmGA.js → r3f-source-authoring-adapter-EkIj_j5C.js} +1 -1
- package/dist/assets/{react-canvas-navigation-M0ghQ3Pg.js → react-canvas-navigation-DnUWxFpr.js} +1 -1
- package/dist/assets/{react-inspector.service-CStUUFdZ.js → react-inspector.service-CVE2zwb_.js} +1 -1
- package/dist/assets/{react-story-board-CJ2rY1vM.js → react-story-board-BSUDIFUD.js} +1 -1
- package/dist/assets/{react-three-rapier.esm-2PI2GKyc.js → react-three-rapier.esm-HR--m53B.js} +1 -1
- package/dist/assets/{react-world-authoring-adapter-tdk4Hqj1.js → react-world-authoring-adapter-LUIUlDuG.js} +1 -1
- package/dist/assets/{realm-services-ZGsXIjKw.js → realm-services-DjWyEFlR.js} +1 -1
- package/dist/assets/{reflection-probe-capture.inspector-CacOiakh.js → reflection-probe-capture.inspector-CnnUUjZ1.js} +1 -1
- package/dist/assets/{registry-CCO8vgc4.js → registry-CoEgg4Uf.js} +1 -1
- package/dist/assets/{relative-import-specifier-CJ9epbC5.js → relative-import-specifier-qiLdR9s0.js} +1 -1
- package/dist/assets/{render-env-CcmQfcfh.js → render-env-uOmAJnlr.js} +1 -1
- package/dist/assets/{render-features-d6WsfyhR.js → render-features-BDTrZqsn.js} +1 -1
- package/dist/assets/{render-settings-2QiH0WvX.js → render-settings-B7DKAMUq.js} +1 -1
- package/dist/assets/{resolve-three-DaW6J3do.js → resolve-three-DqtjenoZ.js} +3 -3
- package/dist/assets/{root-seam-contract-BaqTf_0m.js → root-seam-contract-Dnk26mgR.js} +1 -1
- package/dist/assets/{run-selection-BmPqbXVv.js → run-selection-DMh0XzlK.js} +1 -1
- package/dist/assets/{scene-capture-BPf9CksU.js → scene-capture-B5Rcy1pe.js} +1 -1
- package/dist/assets/{scene-document.service-BCJX2wYL.js → scene-document.service-CptpkE8S.js} +2 -2
- package/dist/assets/{scene-framing-pfBwKlV1.js → scene-framing-k2LlZgVg.js} +1 -1
- package/dist/assets/{seeded-random-Cm0mJ9WK.js → seeded-random-nwY9ZTVx.js} +1 -1
- package/dist/assets/{setup-renderer-CDiOvS5v.js → setup-renderer-BuXtI2-s.js} +1 -1
- package/dist/assets/{source-object3d-authoring-adapter-CmnO36sT.js → source-object3d-authoring-adapter-D16iP0TM.js} +1 -1
- package/dist/assets/{source-persistence-backend-ECfFZPdn.js → source-persistence-backend-C35VQxKz.js} +1 -1
- package/dist/assets/{stage-keyboard-D9z07kMc.js → stage-keyboard-CjhoPz6i.js} +1 -1
- package/dist/assets/{stage-overlay-set-BEcLelHE.js → stage-overlay-set-B32HW5jr.js} +1 -1
- package/dist/assets/{stage-presence-markers-61iYjRz9.js → stage-presence-markers-CD1g5aVX.js} +1 -1
- package/dist/assets/{stage-transform-tools-D_zntx7x.js → stage-transform-tools-CVnmgj4G.js} +1 -1
- package/dist/assets/{standard-viewport-dressing-CvWc3TIo.js → standard-viewport-dressing-DbvBhJBU.js} +1 -1
- package/dist/assets/{state-watch.action-Dj33chqd.js → state-watch.action-BdPnoEng.js} +1 -1
- package/dist/assets/{state-watch.menu-BDbYVr9h.js → state-watch.menu-BmAXd2iE.js} +1 -1
- package/dist/assets/{state-watch.utility-YGDgFG4K.js → state-watch.utility-Bnzldqwo.js} +1 -1
- package/dist/assets/{story-capture-DRH3UvNr.js → story-capture-BofI_wKy.js} +1 -1
- package/dist/assets/{story-documents-DoLPg9Lx.js → story-documents-DkDjQXJJ.js} +1 -1
- package/dist/assets/{story-documents.service-Teg89FZc.js → story-documents.service-BsRPe5R4.js} +1 -1
- package/dist/assets/{story-documents.service-Ll8_ATjf.js → story-documents.service-DiAebTI9.js} +1 -1
- package/dist/assets/{story-media-presence-Xlo427K1.js → story-media-presence-CtYvsK-A.js} +1 -1
- package/dist/assets/{story-pixi-preview-BBP84uRR.js → story-pixi-preview-CMpik5gu.js} +1 -1
- package/dist/assets/{story-presentation-Bqi53kq0.js → story-presentation-D9-lh6hS.js} +1 -1
- package/dist/assets/{story-three-preview-BP4ILFDq.js → story-three-preview-DnW5SEf7.js} +2 -2
- package/dist/assets/{studio-environment-BLFX45T5.js → studio-environment-BSd_1eWm.js} +1 -1
- package/dist/assets/{surface-state-rZISD-ig.js → surface-state-C1SxqlW8.js} +1 -1
- package/dist/assets/{syntactic-prop-specs-BVVxIxx3.js → syntactic-prop-specs-mvpbkzOV.js} +1 -1
- package/dist/assets/{team-playtest.service-DqP8zQMt.js → team-playtest.service-sy9-i7wc.js} +1 -1
- package/dist/assets/{three-a5CVjo2i.js → three-CW7JxjOv.js} +1 -1
- package/dist/assets/{three-authoring-adapter-D9bJThN9.js → three-authoring-adapter-DH5IBxn4.js} +1 -1
- package/dist/assets/three-authoring.service-Epg_oejj.js +2 -0
- package/dist/assets/{three-ingest-runtime-CfjyePZf.js → three-ingest-runtime-BnjdzpH9.js} +1 -1
- package/dist/assets/{three-integration-Bq5NMTap.js → three-integration-h_YZxmn4.js} +2 -2
- package/dist/assets/three-integration.service-mHfKD3i5.js +1 -0
- package/dist/assets/{three-projection-core-BTQ_M-Ho.js → three-projection-core-RACdI_qj.js} +1 -1
- package/dist/assets/{three-state-DYl6KVhl.js → three-state-COm8p1VC.js} +1 -1
- package/dist/assets/{three-story-capture.service-CkEnDiGX.js → three-story-capture.service-DXOV7quR.js} +2 -2
- package/dist/assets/{three-story-model-DR4JL0tj.js → three-story-model-DWDPEwZs.js} +1 -1
- package/dist/assets/{three-viewport-presentation-Bu3_3jY0.js → three-viewport-presentation-DO_Tqsn5.js} +1 -1
- package/dist/assets/{transform-mode-request-CQMVP3gI.js → transform-mode-request-DLXLBh2a.js} +1 -1
- package/dist/assets/{transport-strip-7xF6Xkx1.js → transport-strip-Ck5zz3Th.js} +1 -1
- package/dist/assets/transport.header-DC3-PIO2.js +1 -0
- package/dist/assets/{tuples-Bi79tUJA.js → tuples-B4X2J9eQ.js} +1 -1
- package/dist/assets/{ui-board-document-ByN-Igr_.js → ui-board-document-BfrxNqBh.js} +2 -2
- package/dist/assets/{user-data-BJje5VYV.js → user-data-BVjl5VSz.js} +1 -1
- package/dist/assets/{utility-view-state-D_M1xdFg.js → utility-view-state-BwFHQqg-.js} +1 -1
- package/dist/assets/{viewport-door-Bn_5UYAF.js → viewport-door-DGEfF1wj.js} +1 -1
- package/dist/assets/{viewport-root-presentation-CMku-eFg.js → viewport-root-presentation-BzFN3-WC.js} +1 -1
- package/dist/assets/{viewport-surface-status-Z2lECnRZ.js → viewport-surface-status-BTe8UVhJ.js} +1 -1
- package/dist/assets/{webworkerAll-B66_oG9K.js → webworkerAll-Cys-YS-I.js} +1 -1
- package/dist/assets/{workspace-arrangement-BPsnvrOt.js → workspace-arrangement-BD3sTZSQ.js} +1 -1
- package/dist/assets/{world-documents-CEI6Ult8.js → world-documents-eSWWvQsk.js} +1 -1
- package/dist/assets/{world-root-stage-binding-BtFetoJf.js → world-root-stage-binding-D8sBh4Kt.js} +1 -1
- package/dist/assets/{xstate-animation-binding-5ogRENtk.js → xstate-animation-binding-CqpKrHn2.js} +1 -1
- package/dist/assets/{xstate-animation-meta-D3SfP75s.js → xstate-animation-meta-Cbd_n_eN.js} +1 -1
- package/dist-node/cli.js +16 -16
- package/package.json +16 -16
- package/dist/assets/InspectorObjectPreview-ec285ozq.js +0 -1
- package/dist/assets/Object3DDocumentViewport-DGFR-qkU.js +0 -2
- package/dist/assets/StageHost-CNkXkK_f.js +0 -2
- package/dist/assets/autoplay.service-B8dGBVjn.js +0 -1
- package/dist/assets/instances.command-BIwrjtVv.js +0 -1
- package/dist/assets/network-observer.service-ib7T4XSw.js +0 -1
- package/dist/assets/three-authoring.service-C0WuXyLN.js +0 -2
- package/dist/assets/three-integration.service-scS00K9w.js +0 -1
- package/dist/assets/transport.header-AqKlS4Ny.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as M,ls as bt}from"./index-
|
|
1
|
+
import{r as M,ls as bt}from"./index-DaRQxpdW.js";import{a as Mt}from"./preview-renderer-BrYNFV1p.js";import{v as vt}from"./output-pass-HurwNl0G.js";import{_ as xt,fx as De,bi as Ue,aC as Et,d7 as kt,ej as St,cP as be,el as Bt,cm as Ct,cl as Ve,fo as ue,ex as At,d5 as It,d9 as jt,cJ as Tt,e as We}from"./three.core-3arARmh6.js";import{f as Lt}from"./clip-planes-CnAI6DZn.js";import{a as Ft}from"./content-bounds-_3L42iZv.js";const _t=1024*1024,Ge={Uint8Array,Int8Array,Uint16Array,Int16Array,Uint32Array,Int32Array,Float32Array,Float64Array},$t=async t=>Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t)),e=>e.toString(16).padStart(2,"0")).join("");class Rt{constructor(){this.buffers=null,this.offsets=[]}reset(){this.buffers=null,this.offsets=[]}async accept(e){try{if(e.kind==="begin"){if(this.buffers)throw new Error("A frame value is already arriving");if(!e.lengths.length||e.lengths.length>4096||e.lengths.reduce((s,o)=>s+o,0)>2*1024**3||e.lengths.some(s=>!Number.isSafeInteger(s)||s<0||s>1024**3))throw new Error("Invalid frame buffer lengths");this.buffers=e.lengths.map(s=>new Uint8Array(s)),this.offsets=e.lengths.map(()=>0);return}if(!this.buffers)throw new Error("Frame chunk arrived without its manifest");if(e.kind==="bytes"){const s=this.buffers[e.slot];if(!s||!Number.isSafeInteger(e.offset)||e.offset!==this.offsets[e.slot]||e.bytes.byteLength>_t||!e.bytes.byteLength||e.offset+e.bytes.byteLength>s.byteLength)throw new Error("Frame chunk is out of order or exceeds its bound");if(await $t(e.bytes)!==e.sha256)throw new Error("Frame chunk digest mismatch");s.set(e.bytes,e.offset),this.offsets[e.slot]=e.offset+e.bytes.byteLength;return}if(e.kind!=="end")throw new Error("Unknown frame chunk");const n=this.buffers;if(n.some((s,o)=>s.length!==this.offsets[o]))throw new Error("Frame value is incomplete");const r=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(n[0]),(s,o)=>{if(!o||typeof o!="object"||!("$frameColumn"in o))return o;const a=n[o.$frameColumn],i=Ge[o.type];if(!Number.isSafeInteger(o.$frameColumn)||o.$frameColumn<1||!a||!Object.hasOwn(Ge,o.type)||!i||a.byteLength%i.BYTES_PER_ELEMENT)throw new Error("Invalid frame column descriptor");return new i(a.buffer)});return this.reset(),{value:r}}catch(n){throw this.reset(),n}}}const ze=4096;class Ot{#r;#o;#a=[];#n=new Map;#$=0;#h=null;#i=null;#l=!1;#k=!1;#S=e=>{!this.#k&&this.#y===0||(e.preventDefault(),e.returnValue="")};#f=new Map;#p=new Map;#w="engine-start";#B=null;#v=new Set;#g=null;#x=0;#C=0;#A=0;#c=null;#I=null;#u=null;constructor(e){this.#o=e,this.#r=new Worker(new URL("/assets/worker-CdXe6YZE.js",import.meta.url),{type:"module",name:"blender"}),globalThis.addEventListener?.("beforeunload",this.#S),this.#r.onmessage=n=>void this.#_(n.data),this.#r.onerror=n=>{const r=n.error,s=n.filename?` at ${n.filename}:${n.lineno}:${n.colno}`:"",o=r?.stack??r?.message??n.message,a=this.#a.length>0?`
|
|
2
2
|
Blender's last output:
|
|
3
3
|
${this.#a.join(`
|
|
4
4
|
`)}`:"",i=this.#u===null?null:Math.round(this.#u/1048576),c=i!==null&&i>=ze-16?`Blender ran out of memory: its heap reached ${i} MB of the in-tab engine's ${ze} MB, and this scene needs more. `:"",u=new Error(`${c}Blender worker failed: ${o||"the worker script did not load"}${s}${a}`);console.error(u.message);for(const l of[...this.#n.keys()])this.#m(l);for(const l of this.#n.values())l.reject(u);this.#n.clear(),this.terminate()}}#s=null;#d=null;get project(){return this.#s}get document(){return this.#d}get lastOutput(){return[...this.#a]}start(e,n){return this.#s!==null&&this.#s!==e?Promise.reject(new Error(`The Blender session is bound to ${this.#s}, not ${e}`)):n!==void 0&&this.#d!==null&&this.#d!==n?Promise.reject(new Error(`Blender resource conflict: the session holds ${this.#d}; cannot open ${n}`)):(this.#s=e,this.#d??=n??"models/model.blend",this.#h??=this.#e({op:"start",project:e,...n===void 0?{}:{document:n}}),this.#h)}#t(){return this.#s===null?Promise.reject(new Error("The Blender session has not been started with a project (blender-start)")):this.start(this.#s)}async execute(e,n=!0,r="Blender Python"){return await this.#t(),await this.#e({op:"execute",code:e,history:n,label:r})}async historyGesture(e){await this.#t(),await this.#e({op:e})}async historyStep(e,n){return await this.#t(),(await this.#e({op:"history-step",token:e,direction:n})).moved}async sceneInfo(){return await this.#t(),await this.#e({op:"scene-info"})}async objectInfo(e){return await this.#t(),await this.#e({op:"object-info",name:e})}async rna(e,n){return await this.#t(),await this.#e({op:"rna",path:e,...n===void 0?{}:{names:n}})}async rnaContext(e,n){return await this.#t(),await this.#e({op:"rna-context",...e===void 0?{}:{object:e},...n===void 0?{}:{collection:n}})}async rnaSet(e,n,r,s,o=!0){return await this.#t(),await this.#e({op:"rna-set",history:o,path:e,property:n,value:r,...s===void 0?{}:{index:s}})}async viewShading(e){await this.#t(),await this.#e({op:"view-shading",shading:e})}async outliner(e){return await this.#t(),await this.#e({op:"outliner",...e===void 0?{}:{selected:e}})}async nodeTree(e){return await this.#t(),await this.#e({op:"node-tree",...e?.path===void 0?{}:{path:e.path},...e?.material===void 0?{}:{material:e.material}})}async uvLayout(e){return await this.#t(),await this.#e({op:"uv-layout",...e?.object===void 0?{}:{object:e.object},...e?.uvLayer===void 0?{}:{uvLayer:e.uvLayer}})}async rig(e){return await this.#t(),await this.#e({op:"rig",...e?.object===void 0?{}:{object:e.object}})}async actionClip(e){return await this.#t(),await this.#e({op:"action-clip",...e?.object===void 0?{}:{object:e.object},...e?.bake===void 0?{}:{bake:e.bake}})}async outlinerSet(e,n,r){return await this.#t(),await this.#e({op:"outliner-set",path:e,column:n,value:r})}async present(){await this.#t(),await this.#e({op:"present"})}async screenshotView(e){return await this.#t(),await this.#e({op:"screenshot-view",maxSize:e})}async readFile(e){return await this.#t(),await this.#e({op:"read-file",path:e})}async writeFile(e,n){await this.#t(),await this.#e({op:"write-file",path:e,bytes:n})}async listFiles(e){return await this.#t(),await this.#e({op:"list-files",path:e})}get presented(){return this.#I}stop(){return this.#l?Promise.resolve():this.#i?this.#i:(this.#i=(async()=>{(this.#h?await this.#h.then(()=>!0,()=>!1):!1)&&await this.#e({op:"flush-document"},!0),this.terminate()})().catch(e=>{throw this.#i=null,e}),this.#i)}terminate(){if(this.#M(),this.#l)return;this.#l=!0,globalThis.removeEventListener?.("beforeunload",this.#S);const e=this.#E("terminating worker");try{this.#r.terminate()}finally{e()}const n=new Error("The Blender session was terminated");for(const r of[...this.#n.keys()])this.#m(r);for(const r of this.#n.values())r.reject(n);this.#n.clear();for(const r of this.#v)r()}metrics(e=performance.now()){let n=null,r=this.#x,s=this.#B,o=this.#C,a=this.#A;for(const[i,c]of this.#f){const u=e-c;(n===null||u>n)&&(n=u),u>r&&(r=u,s=this.#p.get(i)??null),u>=5e3&&(o+=1),u>=3e4&&(a+=1)}return{inFlightMs:n===null?null:Math.round(n),lastCallMs:this.#g===null?null:Math.round(this.#g),maxCallMs:this.#g===null&&n===null?null:Math.round(r),maxCallLabel:s,currentPhase:this.#y?this.#w:null,completedCalls:this.#j,callsOver5s:o,callsOver30s:a,lastCallWindow:this.#c,wasmMemoryMB:this.#u===null?null:Math.round(this.#u/1048576)}}#m(e){const n=this.#f.get(e);if(n===void 0)return;this.#f.delete(e);const r=this.#p.get(e)??null;this.#p.delete(e),this.#j++;const s=performance.now()-n;this.#g=s,s>this.#x&&(this.#x=s,this.#B=r),s>=5e3&&(this.#C+=1),s>=3e4&&(this.#A+=1),this.#c!==null&&this.#c.start===n&&(this.#c={start:n,end:n+s})}#j=0;#y=0;#T=Promise.resolve();#e(e,n=!1){if(this.#l||this.#i&&!n)return Promise.reject(new Error("The Blender session is stopping or terminated"));const r=performance.now();let s=()=>{};this.#y++;const o=this.#T.then(async()=>{const a=this.#E(`running worker ${e.op}`);s=()=>{this.#v.delete(s)&&a()},this.#v.add(s),this.#w=e.op;let i=await this.#L(e);for(;i?.load==="continue";)this.#w=i.phase,i=await this.#L({op:"load-next",token:i.token});return i?.load==="done"?i.value:i}).finally(()=>{this.#y--,s();const a=Math.round(performance.now()-r);try{a>=1e3&&this.#o.log?.("log",`@@VOLTER-WORK op=${e.op} totalMs=${a}`)}catch{}});return this.#T=o.then(()=>{},()=>{}),o}#L(e){if(this.#l)return Promise.reject(new Error("The Blender session is terminated"));const n=++this.#$;return new Promise((r,s)=>{this.#n.set(n,{resolve:r,reject:s});const o=performance.now();this.#f.set(n,o),this.#p.set(n,e.op==="load-next"?`load-next after ${this.#w}`:e.op),this.#c={start:o,end:null};try{this.#r.postMessage({...e,id:n})}catch(a){this.#n.delete(n),this.#m(n),s(a instanceof Error?a:new Error(String(a)))}})}#E(e){try{const n=this.#o.work?.(e);return()=>{try{n?.()}catch{}}}catch{return()=>{}}}#F=new Rt;#b=null;#M(){this.#F.reset();const e=this.#b;if(this.#b=null,e)try{Promise.resolve(this.#o.stage?.({...e,abort:!0})).catch(()=>{})}catch{}}async#_(e){if("op"in e){if(e.op==="frame-stream"){try{const o=await this.#F.accept(e.chunk);if(o){const a=o.value;if(a.op==="present"){await this.#_({...a,id:e.id});return}if(a.op!=="stage"||!this.#o.stage)throw new Error("The presenter does not support staged Blender frames");this.#b={session:a.session,revision:a.revision},await this.#o.stage(a)}this.#r.postMessage({op:"present-result",id:e.id})}catch(o){this.#M(),this.#r.postMessage({op:"present-result",id:e.id,error:o instanceof Error?o.message:String(o)})}return}if(e.op==="document-dirty"){this.#k=e.dirty;return}if(e.op==="history"){this.#o.history?.(e.entries);return}if(e.op==="log"){this.#a.push(e.text),this.#a.length>12&&this.#a.shift(),this.#o.log?.(e.level,e.text);return}if(e.op==="memory"){this.#u=e.bytes;return}const r=e.frame;typeof r?.session=="string"&&typeof r.revision=="number"&&(this.#I={session:r.session,revision:r.revision});const s=this.#E("presenting worker frame");try{const o=await this.#o.present(e.frame,e.description,e.capture);this.#b=null,this.#r.postMessage({op:"present-result",id:e.id,...o?.capture===void 0?{}:{capture:o.capture},...o!=null&&"held"in o?{held:o.held}:{}})}catch(o){this.#M(),this.#r.postMessage({op:"present-result",id:e.id,error:o instanceof Error?o.message:String(o)})}finally{s()}return}"error"in e&&this.#M();const n=this.#n.get(e.id);n&&(this.#n.delete(e.id),this.#m(e.id),"error"in e?n.reject(new Error(e.error)):n.resolve(e.result))}}const Nt="/assets/agx-base-srgb-BjWZJgrZ.lut",Pt="/assets/agx-look-medium-high-contrast-D5F_ob1L.lut",Dt="/assets/agx-look-punchy-dxsnycNs.lut",Ut="/assets/filmic-srgb-Ct35FIH6.lut",L=new Float64Array(12),qe=[0,0,0],O=new Float64Array(3),X=new Float64Array(3),F=new Int8Array([1,0,0,1,1,0,0,1,2,1,0,0,1,0,1,0,2,1,0,0,1,1,0,1,2,0,1,0,0,1,0,1,1,2,1,0,0,1,0,0,1,1,1,2,0,0,1,0,1,1,0,1,0,2]);function Vt(t,e,n){return t>e?e>n?0:t>n?1:2:n>e?3:n>t?4:5}function Je(t,e,n,r,s){const o=e*e,a=Math.min(1,Math.max(0,n))*(e-1),i=Math.min(1,Math.max(0,r))*(e-1),c=Math.min(1,Math.max(0,s))*(e-1),u=Math.min(Math.floor(a),e-2),l=Math.min(Math.floor(i),e-2),d=Math.min(Math.floor(c),e-2),k=a-u,m=i-l,S=c-d,b=(h,g,T,I)=>{const w=(u+g+(l+T)*e+(d+I)*o)*3;L[h]=t[w]/65535,L[h+1]=t[w+1]/65535,L[h+2]=t[w+2]/65535};b(0,0,0,0),b(9,1,1,1),O[0]=k,O[1]=m,O[2]=S;const p=Vt(k,m,S)*9;b(3,F[p],F[p+1],F[p+2]),b(6,F[p+3],F[p+4],F[p+5]);const A=O[F[p+6]],x=O[F[p+7]],f=O[F[p+8]];for(let h=0;h<3;h++){const g=L[h];qe[h]=g+A*(L[3+h]-g)+x*(L[6+h]-L[3+h])+f*(L[9+h]-L[6+h])}return qe}function Y(t){const e=t&32768?-1:1,n=t>>10&31,r=t&1023;return n===0?e*2**-24*r:n===31?r?Number.NaN:e*Number.POSITIVE_INFINITY:e*2**(n-15)*(1+r/1024)}function je(t,e,n,r){const s=new Uint8ClampedArray(e*4);for(let o=0;o<e;o++){const a=o*4,i=Y(t[a+3]),c=i===0?n:n/i;X[0]=Y(t[a])*c,X[1]=Y(t[a+1])*c,X[2]=Y(t[a+2])*c;const u=r(X);s[a]=Math.round(u[0]*255),s[a+1]=Math.round(u[1]*255),s[a+2]=Math.round(u[2]*255),s[a+3]=Math.round(Math.min(1,Math.max(0,i))*255)}return s}function Wt(t){return new URL(Object.assign({"./agx-base-srgb.lut":Nt,"./agx-look-medium-high-contrast.lut":Pt,"./agx-look-punchy.lut":Dt,"./filmic-srgb.lut":Ut})[`./${t.replace(/\.lut$/,"")}.lut`],import.meta.url)}const Gt=57,_=-12.47393,Qe=12.5260688117,zt=[[.4123908,.3575843,.1804808],[.212639,.7151687,.0721923],[.0193308,.1191948,.9505322]],qt=[[1.5250528,-.3159135,-.1226583],[-.5091526,1.3333274,.1382844],[.0957153,.0508974,.7879558]];function He(t,e,n){const r=e[0],s=e[1],o=e[2];n[0]=t[0][0]*r+t[0][1]*s+t[0][2]*o,n[1]=t[1][0]*r+t[1][1]*s+t[1][2]*o,n[2]=t[2][0]*r+t[2][1]*s+t[2][2]*o}const Z=new Float64Array(3),Xe=new Float64Array(3),K=[0,0,0];function de(t){const e=Math.min(1,Math.max(0,t));return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function et(t,e,n,r){return Je(t,Gt,e,n,r)}function Ht(t,e){He(zt,e,Xe),He(qt,Xe,Z);const n=Qe-_,r=et(t,(Math.log2(Math.max(Z[0],1e-10))-_)/n,(Math.log2(Math.max(Z[1],1e-10))-_)/n,(Math.log2(Math.max(Z[2],1e-10))-_)/n);return K[0]=de(Math.max(0,r[0])**2.4),K[1]=de(Math.max(0,r[1])**2.4),K[2]=de(Math.max(0,r[2])**2.4),K}const Xt={"AgX - Medium High Contrast":"agx-look-medium-high-contrast.lut","AgX - Punchy":"agx-look-punchy.lut"};function Yt(t,e){const n=Qe-_;return et(t,(Math.log2(Math.max(e[0],1e-10))-_)/n,(Math.log2(Math.max(e[1],1e-10))-_)/n,(Math.log2(Math.max(e[2],1e-10))-_)/n)}function Zt(t,e,n,r={}){const s=r.exposure??1,o=r.composedLook===!0?Yt:Ht;return je(e,n,s,a=>o(t,a))}const tt=33,Me=tt**3*3,ve=4096,he=-12.473931188,fe=25;function pe(t,e){const n=Math.min(1,Math.max(0,e))*(ve-1),r=Math.min(Math.floor(n),ve-2),s=n-r;return((1-s)*t[Me+r]+s*t[Me+r+1])/65535}const J=[0,0,0];function Kt(t,e){const n=Je(t,tt,(Math.log2(Math.max(e[0],1e-10))-he)/fe,(Math.log2(Math.max(e[1],1e-10))-he)/fe,(Math.log2(Math.max(e[2],1e-10))-he)/fe);return J[0]=pe(t,n[0]/.66),J[1]=pe(t,n[1]/.66),J[2]=pe(t,n[2]/.66),J}function Jt(t,e,n,r){if(t.length!==Me+ve)throw new Error("Invalid Blender Filmic display table");return je(e,n,r,s=>Kt(t,s))}const W=2.4,$=.055,nt=$/(W-1),Qt=1/(W/(1+$)*((nt+$)/(1+$))**(W-1)),en=((nt+$)/(1+$))**W;function we(t){return t>0?t<en?t*Qt:(1+$)*t**(1/W)-$:0}const Q=[0,0,0];function tn(t){return Q[0]=we(t[0]),Q[1]=we(t[1]),Q[2]=we(t[2]),Q}function nn(t,e,n){return je(t,e,n,tn)}function rt(t,e,n,r){if(!Number.isFinite(n.width)||!Number.isFinite(n.height)||n.width<1||n.height<1)throw new Error("Scene capture requires finite positive dimensions");const s=Math.min(2048,Math.round(n.width)),o=Math.min(2048,Math.round(n.height)),a=r?1:2,i=s*a,c=o*a,u=Mt(),l=u.renderer,d={target:l.getRenderTarget(),toneMapping:l.toneMapping,exposure:l.toneMappingExposure,colorSpace:l.outputColorSpace,shadows:l.shadowMap.enabled,shadowType:l.shadowMap.type,clearColor:l.getClearColor(new xt),clearAlpha:l.getClearAlpha(),background:t.background};let k,m,S=!1;try{k=new De(i,c,{type:Ue}),n.effect&&(k.depthTexture=new Et(i,c)),l.shadowMap.enabled=!0,l.shadowMap.type=kt,l.outputColorSpace=St,l.toneMapping=n.toneMapping??be,l.toneMappingExposure=n.exposure??1,l.setClearColor(0,n.transparent?0:1),n.transparent&&(t.background=null),l.setRenderTarget(k),l.clear(),l.render(t,e);const b=n.effect?.render(l,k,t,e)??k;if(b.texture.type!==Ue||b.width!==i||b.height!==c)throw new Error("Scene capture effect must return a same-size half-float target");if(r){const w=new Uint16Array(i*c*4);return l.readRenderTargetPixels(b,0,0,i,c,w),S=!0,{pixels:w,width:s,height:o}}m=new De(i,c),vt(n.transparent===!0).render(l,m,b,0,!1);const p=new Uint8Array(i*c*4);l.readRenderTargetPixels(m,0,0,i,c,p);const A=document.createElement("canvas");A.width=i,A.height=c;const x=A.getContext("2d");if(!x)throw new Error("Scene capture could not create an image canvas");const f=x.createImageData(i,c),h=i*4;for(let w=0;w<c;w++)f.data.set(p.subarray((c-1-w)*h,(c-w)*h),w*h);x.putImageData(f,0,0);const g=document.createElement("canvas");g.width=s,g.height=o;const T=g.getContext("2d");if(!T)throw new Error("Scene capture could not create an output canvas");T.drawImage(A,0,0,s,o);const I=g.toDataURL("image/png");return S=!0,I}finally{t.background=d.background,l.setRenderTarget(d.target),l.toneMapping=d.toneMapping,l.toneMappingExposure=d.exposure,l.outputColorSpace=d.colorSpace,l.shadowMap.enabled=d.shadows,l.shadowMap.type=d.shadowType,l.setClearColor(d.clearColor,d.clearAlpha),m?.dispose(),k?.dispose(),u.release({discard:!S})}}function rn(t,e,n){return rt(t,e,n,!0)}function on(t,e,n){return rt(t,e,n,!1)}const sn=t=>typeof t=="object"&&t!==null&&typeof t.subscribeFrames=="function"&&typeof t.objectForBlenderName=="function"&&typeof t.blenderObjectName=="function"&&typeof t.blenderSelection=="function"&&typeof t.setStageMode=="function";function Te(){const t=M().documents.context(ut());return sn(t)?t:null}function an(){return Te()?.blenderSelection()??{selected:[],active:null}}const ln={tree:null,byId:new Map,parentOf:new Map,error:null,loading:!1};let xe=ln,ot=0;const Ee=new Set;let D=null,ae=null,Le="",U=null;function cn(t){const e=new Map,n=new Map,r=(s,o)=>{e.set(s.id,s),n.set(s.id,o);for(const a of s.children)r(a,s.id)};for(const s of t?.rows??[])r(s,null);return{byId:e,parentOf:n}}function te(t){xe={...xe,...t},ot+=1;for(const e of[...Ee])e()}function Fn(t){return Ee.add(t),()=>{Ee.delete(t)}}function _n(){return ot}function $n(){return xe}function Fe(t){U!==t&&(U=t,setTimeout(()=>{U===t&&(U=null,st(t===""?[]:t.split("\0")))},0))}let ge=0,ke=Promise.resolve();function st(t){const e=un(t);return ke=e,e}async function un(t){const e=t.join("\0"),n=++ge;ae=e,Le=e,te({loading:!0});try{const r=await vn(t);if(n!==ge)return;Te()?.setStageMode(r?.mode??null),te({tree:r,...cn(r),loading:!1,error:null})}catch(r){if(n!==ge)return;te({loading:!1,error:at(r)})}}function dn(){ae=null,Fe(Le);for(const t of[...Se])t()}const Se=new Set;function Rn(t){return _e(),Se.add(t),()=>{Se.delete(t)}}let ee=!1,me=null;function _e(){const t=Te();if(D!==null&&me===t)return;D!==null&&(D(),D=null,me=null);const e=t;if(e!==null){D=e.subscribeFrames(dn),me=e;return}ee||(ee=!0,M().documents.waitForContext(ut()).then(()=>{ee=!1,_e()}).catch(()=>{ee=!1}))}function On(t){if(!C())return;_e();const e=[...t].sort().join("\0");ae!==e&&Fe(e)}async function hn(t){if(!C())return;U=null;let e=st([...t].sort());for(;;){if(await e,ke===e)return;e=ke}}async function Nn(t,e,n){try{return await ht(t,e,n),ae=null,Fe(Le),!0}catch(r){return te({error:at(r)}),!1}}function at(t){return t instanceof Error?t.message:String(t)}const fn={transform:{cx:0,cy:0,zoom:1},looked:null,refusal:null,size:{w:0,h:0},framedAt:0,drawn:[]};let Be=fn,$e=0;const se=new Set;let it=0;function ye(){return Be}function Pn(){return $e}function Dn(t){return se.add(t),()=>{se.delete(t)}}function V(t){Be={...Be,...t},$e+=1;for(const e of[...se])e()}function pn(){it+=1,$e+=1;for(const t of[...se])t()}function Un(){return it}function N(t){V({refusal:t})}const Ye=new Map;function wn(t){let e=Ye.get(t);return e||(e=fetch(Wt(t)).then(async n=>{if(!n.ok)throw new Error(`Blender display table ${t}: ${n.status} ${n.statusText}`);return new Uint16Array(await n.arrayBuffer())}),Ye.set(t,e)),e}function gn(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return new Uint16Array(n.buffer,n.byteOffset,n.byteLength>>1)}async function lt(t,e){const n=e.look??"None",r=e.toneMapping==="filmic",s=e.toneMapping==="none";if(!s&&e.toneMapping!=="agx"&&!r)throw new Error("Blender's Khronos PBR Neutral view transform has no scene-linear implementation in the browser, so it cannot resolve a composited or scene-referred frame (implemented: Standard, AgX, Filmic)");const o=s?null:r?"filmic-srgb.lut":n==="None"?"agx-base-srgb.lut":Xt[n];if(o===void 0)throw new Error(`Blender display transform has no table for look ${n}`);const a=o?await wn(o):null,i=e.linearInput,c=i?{pixels:gn(i.base64),width:i.width,height:i.height}:t;if(!c)throw new Error("Blender display transform requires a linear capture");const{pixels:u,width:l,height:d}=c,k=s?nn(u,l*d,e.exposure):r?Jt(a,u,l*d,e.exposure):Zt(a,u,l*d,{exposure:e.exposure,composedLook:n!=="None"}),m=document.createElement("canvas");m.width=l,m.height=d;const S=m.getContext("2d");if(!S)throw new Error("Blender display transform could not create its image canvas");const b=S.createImageData(l,d),p=l*4;for(let f=0;f<d;f++){const h=(d-1-f)*p;b.data.set(k.subarray(h,h+p),f*p)}S.putImageData(b,0,0);const A=m.toDataURL("image/png"),x={base64:A.slice(A.indexOf(",")+1),mimeType:"image/png"};if(e.linear===!0){const f=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);let h="";for(let g=0;g<f.length;g+=32768)h+=String.fromCharCode(...f.subarray(g,g+32768));x.linearBase64=btoa(h),x.linearWidth=l,x.linearHeight=d}return x}async function mn(t,e,n,r,s=()=>{}){const o={none:be,agx:We,neutral:Tt,filmic:be};await n.prepare(e),s();const a={effect:n.effect,width:r.width,height:r.height,transparent:r.transparent===!0,toneMapping:o[r.toneMapping]??We,exposure:r.exposure},i=r.toneMapping==="agx"||r.toneMapping==="filmic"||r.linear===!0?await lt(rn(t,e,a),r):null;if(s(),i)return i;const c=on(t,e,a);if(!c)throw new Error("Blender render could not capture its image");return{base64:c.slice(c.indexOf(",")+1),mimeType:"image/png"}}const ct="document:blender:runtime";let E=null,Ze=0;function Vn(t){const e=++Ze;return E=t,P(),()=>{Ze===e&&(E=null,P())}}function ne(){const t=y?.document,e=M().documents.activeId(),n=e?.startsWith("document:model:")?e.slice(15):E?.blend;return!n||!t||n===t?null:`Blender is editing ${t}; ${n} is not open. Return to ${t} before editing.`}function j(){return E?.documentId??ct}function ut(){return j()}function yn(t){if(E!==t)return!1;const e=M().documents.activeId();return!(e?.startsWith("document:model:")||e===ct)||e===t.documentId}async function Wn(t,e){const n=M();if(!n.session.open())throw new Error("Opening a model requires an open project session.");const r=n.projectLocalState.projectRootPath();if(r===null)throw new Error("Opening a model requires a project path.");if(!yn(t))return!1;const s=v(),o=s.start(r,t.blend);if(e(),await o,E!==t)return!1;const a=(await G()).snapshot();if(E!==t)return!1;const i=s.presented;return(!a||!i||a.session!==i.session||a.revision!==i.revision)&&await s.present(),E===t}function C(){return y?.project!=null&&ne()===null}let dt=0;const Ce=new Set;function Gn(){return dt}function zn(t){return Ce.add(t),()=>{Ce.delete(t)}}function P(){dt+=1;for(const t of[...Ce])t()}async function qn(t,e){return C()?v().rna(t,e):null}async function Hn(t,e){return C()?v().rnaContext(t,e):null}async function bn(t,e,n,r,s=!0){if(!C())return null;const o=await v().rnaSet(t,e,n,r,s);return P(),o}async function Xn(t){C()&&await v().viewShading(t)}async function Mn(t,e=!0,n="Blender Python"){const r=await v().execute(t,e,n);P();const s=/^Error executing code:/.exec(r);return{text:r,executed:s===null,result:s===null?r.replace(/^Code executed successfully: ?/,""):"",error:s===null?null:r.replace(/^Error executing code: ?/,"")}}function Yn(){v().historyGesture("history-begin").catch(t=>M().console.error(`Could not begin Blender undo gesture: ${String(t)}`,"blender-history"))}async function Zn(){await v().historyGesture("history-end")}async function vn(t){return C()?v().outliner(t):null}async function Kn(t){return C()?v().nodeTree(t):null}async function Jn(t){return C()?v().uvLayout(t):null}async function Qn(t){return C()?v().rig(t):null}async function er(t){return C()?v().actionClip(t):null}async function ht(t,e,n){if(!C())return null;const r=await v().outlinerSet(t,e,n);return P(),r}const xn={view:"blender-node-view",title:"Node Editor",verbs:[["state",void 0],["look",void 0],["view-all","Node Editor: Frame All"],["zoom",void 0],["pan",void 0],["move",void 0],["link",void 0],["set-value",void 0],["use-nodes",void 0],["collapse-panel",void 0]].map(([t,e])=>({id:t,...e?{title:e}:{},run:n=>ft({...n,action:t})}))};function ft(t){const e=typeof t.action=="string"?t.action:"state";switch(e){case"state":break;case"look":V({looked:typeof t.node=="string"?t.node:null,refusal:null});break;case"view-all":pn(),V({refusal:null});break;case"zoom":{const n=typeof t.zoom=="number"?t.zoom:1;V({transform:{...ye().transform,zoom:n},refusal:null});break}case"pan":{const n=ye().transform;V({transform:{...n,cx:typeof t.cx=="number"?t.cx:n.cx,cy:typeof t.cy=="number"?t.cy:n.cy},refusal:null});break}case"move":N(`Moving "${String(t.node??"a node")}" writes Node.location — editing parity is not the program.`);break;case"link":N("Dragging between sockets would make a link — editing parity is not the program.");break;case"set-value":N(`Changing "${String(t.socket??"a socket")}" writes the socket's default_value — editing parity is not the program.`);break;case"use-nodes":N("Use Nodes writes Material.use_nodes — editing parity is not the program.");break;case"collapse-panel":N(`Collapsing "${String(t.panel??"a panel")}" writes the panel's is_collapsed — editing parity is not the program.`);break;default:N(`blender-node-view: no action "${e}" — state, look, view-all, zoom, pan, and the refusals move, link, set-value, use-nodes, collapse-panel.`)}return ye()}let y=null;const re=new Set;function pt(){re.size&&M().history.invalidate([...re]),re.clear()}let Ae=null,Ke=!1;function oe(t){try{const e=M().session.beginWork(`Blender: ${t}`);return()=>{try{e()}catch{}}}catch{return()=>{}}}function Ie(){const t=oe("invalidating history and releasing runtime");try{pt(),Ae?.abort(),Ae=null,y?.terminate(),y=null,wt=null}finally{t()}}function En(){Ke||(Ke=!0,M().session.onBeforeClose(async()=>{await y?.stop(),Ie()}),M().session.onEnded(Ie))}let wt=null;const kn=t=>typeof t=="object"&&t!==null&&typeof t.applyFrame=="function"&&typeof t.stageFrame=="function"&&typeof t.snapshot=="function"&&typeof t.captureSnapshot=="function"&&typeof t.recordPresentation=="function"&&typeof t.recordPhotograph=="function";async function G(){const{documents:t}=M(),e=Date.now()+15e3;let n=j();for(;;){n=j();const r=await t.waitForContext(n,Math.max(0,Math.min(250,e-Date.now())));if(kn(r))return r;if(Date.now()>=e)break}throw new Error(`The Blender Model document is not open, or the open one is not a Model this engine can present to (it must answer stageFrame, applyFrame, captureSnapshot, recordPresentation and recordPhotograph): nothing published a presentable view as ${n} within 15 s (bound model: ${E?.documentId??"none"}). Open the Model document first (\`volter blender-mcp\` opens it before its first call).`)}function v(){const t=ne();if(t)throw new Error(t);if(y!==null)return y;En();const e=new AbortController;Ae=e;let n=!1,r=null;y=new Ot({work:oe,history:o=>{const a=y;if(!a)throw new Error("Blender history arrived before its runtime");for(const i of o){if("reset"in i){pt();continue}if(!i.resource)throw new Error("A Blender edit has no document resource");re.add(i.resource);const c=async u=>{if(y!==a)throw new Error("This Blender history belongs to a closed worker");const l=await a.historyStep(i.id,u);return P(),await hn(an().selected),l};M().history.record({id:i.id,label:i.label,resources:[i.resource],document:j(),undo:()=>c("undo"),redo:()=>c("redo")})}},stage:async o=>{if(o.abort){r?.stageFrame(o),r=null;return}const a=ne();if(a)throw new Error(a);if(E===null)return;const i=j(),c=await G();if(e.signal.throwIfAborted(),j()!==i)throw new Error("Blender document changed during frame transfer");r=c,c.stageFrame(o)},present:async(o,a,i)=>{const c=ne();if(c)throw new Error(c);if(E===null){if(i?.render)throw new Error("Rendering a Blender frame needs the Model document open; nothing is presenting.");return{}}const u=j(),l=oe("waiting for Model presenter");let d;try{d=await G()}finally{l()}if(e.signal.throwIfAborted(),j()!==u)throw new Error("Blender document changed before its frame could be presented");const k=oe("applying frame to Model"),m=(()=>{try{return d.applyFrame(o)}finally{k()}})(),S=typeof m=="object"&&m!==null&&"held"in m,b=S?m.held:null,p=w=>({...w===void 0?{}:{capture:w},...S?{held:b}:{}});if(d.recordPresentation(a),!i||(wt=i,!i.render))return p(void 0);const A=d.snapshot(),x=()=>{if(e.signal.throwIfAborted(),j()!==u||d.snapshot()!==A)throw new Error("Blender capture document or source revision changed before completion")};if(i.render.linearInput){const w=await lt(null,i.render);return x(),p(w)}const{render:f,position:h,target:g,up:T}=i;if(!h||!g||!T)throw new Error("A Blender render capture must carry the scene camera position, target and up");if(n)throw new Error("A Blender render capture is already in progress");const I=d.captureSnapshot();n=!0,e.signal.addEventListener("abort",I.dispose,{once:!0});try{x();const w=new Bt;w.add(I.root),w.updateMatrixWorld(!0);const z=I.root.matrixWorld,ie=new Ct().copy(z).invert(),gt=new Ve().setFromMatrix4(z),mt=new Ve().setFromMatrix4(ie),le=new ue(h[0],h[1],h[2]).applyMatrix4(z),Re=new ue(g[0],g[1],g[2]).applyMatrix4(z),Oe=new ue(T[0],T[1],T[2]).applyMatrix3(gt),ce=Math.min(2048,Math.round(f.width))/Math.min(2048,Math.round(f.height)),Ne=Ft(I.root).getBoundingSphere(new At),q=Lt(le.distanceTo(Ne.center),Ne.radius);let R;if(f.orthographic){const H=f.fov/2;R=new It(-H*ce,H*ce,H,-H,q.near,q.far)}else R=new jt(f.fov,ce,q.near,q.far);R.up.copy(Oe),R.position.copy(le),R.lookAt(Re),R.updateMatrixWorld(!0);const Pe={position:le.clone().applyMatrix4(ie).toArray(),target:Re.clone().applyMatrix4(ie).toArray(),up:Oe.clone().applyMatrix3(mt).toArray()};d.recordPhotograph({sent:{position:h,target:g,up:T},photographed:Pe,render:{width:f.width,height:f.height,fov:f.fov,orthographic:f.orthographic}});const yt=await mn(w,R,I,f,x);return p({...yt,camera:Pe})}finally{n=!1,e.signal.removeEventListener("abort",I.dispose),I.dispose()}},log:(o,a)=>console[o](`[blender] ${a}`)});const s=y;return M().session.reportWorkerCallMeter("Blender",()=>s.metrics()),y}const Sn="models/model.blend",B=(t,e)=>{const n=t[e];if(typeof n!="string")throw new Error(`${String(t.type)} requires a string "${e}"`);return n};async function Bn(t){const e=M().projectLocalState.projectRootPath();if(e===null)return{};let n;try{n=await t.execute(`import bpy
|
|
@@ -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 bo,b as yo,L as wo}from"./LineSegments2-DN9pUfWA.js";import{bh as ct,cl as Oo,fo as y,cm as q,N as oe,a$ as Nt,em as On,b4 as aa,co as Ft,ey as ra,cp as ke,_ as Mt,ej as Ut,fd as te,er as sa,M as ft,cj as wt,dp as St,aV as ia,cW as Ao,aE as Mo,c7 as bt,j as la,f6 as fa,fp as Ue,au as We,dw as qe,bi as An,aT as ca,c1 as ee,dd as fn,eC as cn,e7 as ze,aw as ge,da as Xt,I as ue,as as ua,e8 as da,b0 as To,K as ma,B as _a,b9 as ha,Y as So,cw as ne,ed as pa,cA as ga,fx as va,db as Po,el as xa,R as ba,e6 as ya,c0 as Eo,bX as wa,aI as $e,ao as Oa,eG as Aa,d3 as Ma,cs as Ta,b5 as He,bu as No,aM as Ro,a_ as Sa,E as we,ex as Mn,cO as Le,cY as Pa,eU as Ea,cE as un,c5 as Io,at as Na,ff as Ra,eW as Ia,f7 as Da,F as za,ev as Ca,et as Fa,dq as ka,fq as $a,n as La,l as ja,cf as Va}from"./three.core-3arARmh6.js";import{u as R,v as L,w as D,c5 as at,c4 as Y,c6 as I,e2 as W,_ as Ba,mB as Do,d_ as Wt,x as X,kE as Ot,e1 as zo,mC as G,dZ as Ua,mD as Wa}from"./index-
|
|
2
|
+
import{a as bo,b as yo,L as wo}from"./LineSegments2-DN9pUfWA.js";import{bh as ct,cl as Oo,fo as y,cm as q,N as oe,a$ as Nt,em as On,b4 as aa,co as Ft,ey as ra,cp as ke,_ as Mt,ej as Ut,fd as te,er as sa,M as ft,cj as wt,dp as St,aV as ia,cW as Ao,aE as Mo,c7 as bt,j as la,f6 as fa,fp as Ue,au as We,dw as qe,bi as An,aT as ca,c1 as ee,dd as fn,eC as cn,e7 as ze,aw as ge,da as Xt,I as ue,as as ua,e8 as da,b0 as To,K as ma,B as _a,b9 as ha,Y as So,cw as ne,ed as pa,cA as ga,fx as va,db as Po,el as xa,R as ba,e6 as ya,c0 as Eo,bX as wa,aI as $e,ao as Oa,eG as Aa,d3 as Ma,cs as Ta,b5 as He,bu as No,aM as Ro,a_ as Sa,E as we,ex as Mn,cO as Le,cY as Pa,eU as Ea,cE as un,c5 as Io,at as Na,ff as Ra,eW as Ia,f7 as Da,F as za,ev as Ca,et as Fa,dq as ka,fq as $a,n as La,l as ja,cf as Va}from"./three.core-3arARmh6.js";import{u as R,v as L,w as D,c5 as at,c4 as Y,c6 as I,e2 as W,_ as Ba,mB as Do,d_ as Wt,x as X,kE as Ot,e1 as zo,mC as G,dZ as Ua,mD as Wa}from"./index-DaRQxpdW.js";import{S as Yt}from"./three.module-BLhyNg0e.js";import{t as qa}from"./blender-runtime-host-BfAWl8jZ.js";const dn=new Set;function ht(){for(const n of[...dn])n()}function Ha(n){return dn.add(n),()=>{dn.delete(n)}}function mn(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 de=I().finite(),Ga=R({name:D(),parent:D().nullable(),connected:at(),hide:at(),length:de,matrix:L(W([de,de,de,de])).length(4),select:at(),active:at(),lockedWeight:at()}).strict(),Xa=R({object:D(),displayType:Y(["OCTAHEDRAL","STICK","BBONE","ENVELOPE","WIRE"]),showInFront:at(),mode:D(),bones:L(Ga)}).strict(),Et={solid:11711154,pose:5294335,poseActive:9240575,poseActiveUnsel:794150,wire:0,vertex:0,lockedWeight:16711680,lockedWeightFactor:128/255};function Ya(n){return new Mt(n.r*n.r*.1,n.g*n.g*.1,n.b*n.b*.1)}const Ge=[[0,0,0],[.1,.1,.1],[.1,.1,-.1],[-.1,.1,-.1],[-.1,.1,.1],[0,1,0]],Fn=[[2,1,0],[3,2,0],[4,3,0],[1,4,0],[5,1,2],[5,2,3],[5,3,4],[5,4,1]],$t=Math.SQRT1_2,Za=[[$t,-$t,0],[0,-$t,-$t],[-$t,-$t,0],[0,-$t,$t],[.99388373,.11043154,0],[0,.11043154,-.99388373],[-.99388373,.11043154,0],[0,.11043154,.99388373]],Ka=[[0,1],[1,5],[5,3],[3,0],[0,4],[4,5],[5,2],[2,0],[1,2],[2,3],[3,4],[4,1]],Qa=.05;function kn(n){return n.select||n.active?2:1}const Ja=10,tr=4,er=`
|
|
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
|
`,Cn=n=>En.map(t=>{const[e=0,o=0,r=0]=n(t);return new y(e,o,r)}),li=Cn(n=>n.direction).map(n=>n.normalize()),fi=Cn(n=>n.diffuse),ci=Cn(n=>n.specular),ui=new Ue(...En.map(n=>n.smooth));function di(n,t){const[e,o,r]=n.color,a=new Ta({side:t});return a.color.setRGB(e,o,r,bt),a.name="volter:blender-solid",a.onBeforeCompile=s=>{s.uniforms.wbDir={value:li},s.uniforms.wbDiffuse={value:fi},s.uniforms.wbSpecular={value:ci},s.uniforms.wbWrap={value:ui},s.uniforms.wbRoughness={value:n.roughness},s.uniforms.wbMetallic={value:n.metallic},s.fragmentShader=s.fragmentShader.replace("void main() {",`${ii}
|
|
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 mi=64;function _i(n,t){return Array.isArray(n)&&Array.isArray(t)?n.length===t.length&&n.every((e,o)=>e===t[o]):n===t}function Jt(n){for(let t=n;t;t=t.parent)if(!t.visible)return!1;return!0}function yn(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 hi{constructor(t){this.root=t,this.batches=[],this.inverse=new q,this.matrix=new q,this.box=new ue,this.projection=new q,this.frustum=new He,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(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)){r("material");continue}if(f.some(l=>Yo(l,s.geometry).size>12)){r("attributeBudget");continue}if(this.matrix.multiplyMatrices(this.inverse,s.matrixWorld),!yn(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>mi){this.box.makeEmpty();for(const h of f)this.box.expandByPoint(new y().setFromMatrixPosition(h.matrixWorld));const i=this.box.getSize(new y),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 No(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(Ro);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&&Jt(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){let o=0,r=!1;for(const a of e){const{mesh:s}=a;if(this.matrix.multiplyMatrices(this.inverse,s.matrixWorld),!(s.parent!==null&&s.geometry===t.geometry&&_i(s.material,t.material)&&yn(this.matrix))){s.layers.mask|=a.layers;continue}if(s.layers.mask&=~a.layers,!Jt(s)||this.camera&&(!this.camera.layers.isEnabled(0)||s.frustumCulled&&!this.frustum.intersectsObject(s)))continue;const c=o*16;this.matrix.elements.some((d,l)=>Math.fround(d)!==t.instanceMatrix.array[c+l])&&(t.setMatrixAt(o,this.matrix),r=!0),o++}r||=t.count!==o||t.boundingSphere===null,t.count=o,r&&(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 wn=64,an=4*1024*1024,pi=32*1024*1024,gi=1024;class vi{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 ft)||g.isInstancedBufferAttribute||g instanceof Sa||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>an)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<=an),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>an||this.bytes+r>pi,t.refused)continue;const a=new we(wn,e,o,t.material);a.sortObjects=!1,a.perObjectFrustumCulled=!1,a.frustumCulled=!1,a.matrixAutoUpdate=!1,a.boundingSphere=new Mn,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>=gi)return null;if(this.created>=4)return this.pending=!0,null;a=new we(1,0,0,o.material),a.dispose(),a.copy(r);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<wn;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 _o=128;class xi{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 we?"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=so(t,s.material)!==null,s.sourceVersion!==t.version&&(s.material.needsUpdate=!0),s.sourceVersion=t.version,s.frame=this.frame);else{if(this.count>=_o)return t;const f=so(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:_o}}}const re=wn;function ho(n){for(let t=n.parent;t;t=t.parent)if(t.isGroup)return t.renderOrder;return 0}class bi{constructor(t){this.root=t,this.objects=[],this.drawMaterials=new xi,this.ordered=new vi,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 He,this.centre=new y,this.depth=new Ue,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)||!Jt(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=ho(c);if(_&&_.visible&&_.transparent&&!_.isShaderMaterial&&!(_.transmission>0)&&(_.side!==$e||_.forceSinglePass)&&!c.isSkinnedMesh&&!c.morphTargetInfluences&&!c.isInstancedMesh&&c.layers.mask===1&&p===this.root.renderOrder){const v=c.geometry,O=v.index?.count??v.getAttribute("position").count,b=!Array.isArray(c.material)||v.groups.length===1&&v.groups[0].start===0&&v.groups[0].count===O&&v.groups[0].materialIndex===0,S=`${v.id}:${_.uuid}:${c.renderOrder}`;let w=s.get(S);w===void 0&&(w=Yo(_,v).size<=12,s.set(S,w)),this.matrix.multiplyMatrices(this.inverse,c.matrixWorld),b&&w&&yn(this.matrix)&&(m=_,h=S)}if(h===null){const v=_?_.isShaderMaterial?"customShader":_.transmission>0?"transmission":_.side===$e&&!_.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+re;_<l;_+=re)a[_-1].z===a[_].z&&(h=!1);if(h)for(let _=c;_<l;_+=re){const p=Math.min(re,l-_);if(p<2)continue;const g=a[_],v=f.get(d.key)??0;f.set(d.key,v+1);const O=d.key.startsWith("multi:");let b;if(O){const w=this.ordered.get(d.key,v);if(!w)continue;if(b=this.mixedDraws.get(w),!b){b={mesh:w,members:[]},this.mixedDraws.set(w,b);const A=b;w.raycast=(M,E)=>{if(w.visible)for(const F of A.members)Jt(F)&&F.raycast(M,E)},this.root.add(w)}}let S=this.pools.get(d.key);if(S||(S=[],this.pools.set(d.key,S)),O||(b=S[v]),!b){const w=new No(d.mesh.geometry,d.material,re);w.name="Blender ordered transparency",w.userData.engineInternal=!0,w.matrixAutoUpdate=!1,w.frustumCulled=!1,w.boundingSphere=new Mn,w.instanceMatrix.setUsage(Ro),b={mesh:w,members:[]};const A=b;w.raycast=(M,E)=>{if(w.visible)for(const F of A.members)Jt(F)&&F.raycast(M,E)},S.push(b),this.root.add(w)}b.mesh.material=this.drawMaterials.get(d.material,b.mesh),b.mesh.visible=!0,b.mesh.renderOrder=g.mesh.renderOrder,b.mesh.boundingSphere.center.copy(g.centre).applyMatrix4(this.inverse),b.mesh.updateMatrixWorld(!0);for(let w=0;w<p;w++){const A=a[_+w].mesh;this.matrix.multiplyMatrices(this.inverse,A.matrixWorld),b.mesh.setMatrixAt(w,this.matrix),b.mesh instanceof we&&(b.mesh.setGeometryIdAt(w,this.ordered.geometryId(d.key,A.geometry)),b.mesh.setVisibleAt(w,!0)),b.members.push(A),A.layers.disable(0),this.hidden.push(A)}if(b.mesh instanceof we)for(let w=p;w<re;w++)b.mesh.setVisibleAt(w,!1);else b.mesh.count=p,b.mesh.instanceMatrix.needsUpdate=!0;this.planned.push(b),this.batches++,this.instances+=p}}c=l}this.ordered.pending&&queueMicrotask(ht)}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 o of this.projection.elements)this.observe(o);for(const o of this.root.matrixWorld.elements)this.observe(o);const e=new Set;for(const o of this.objects){if(!(Array.isArray(o.material)?o.material:[o.material]).some(c=>c.visible&&c.transparent))continue;this.observe(o.parent?.id??-1),this.observe(Jt(o)?1:0),this.observe(o.layers.mask),this.observe(o.renderOrder),this.observe(ho(o)),this.observe(o.frustumCulled?1:0),this.observe(o.morphTargetInfluences?1:0);for(const c of o.matrixWorld.elements)this.observe(c);const a=o.geometry;if(this.observe(a.id),!e.has(a)){e.add(a),this.observe(a.index?.id??-1),this.observe(a.index?.version??-1),this.observe(JSON.stringify(a.userData.blenderUvChannels??null));for(const c of Object.keys(a.attributes).sort()){const d=a.getAttribute(c);this.observe(c),d instanceof ft&&(this.observe(d.id),this.observe(d.version))}}this.observe(a.drawRange.start),this.observe(a.drawRange.count),this.observe(a.index?.count??a.getAttribute("position").count),this.observe(a.groups.length);for(const c of a.groups)this.observe(c.start),this.observe(c.count),this.observe(c.materialIndex??0);const s=o.boundingSphere??a.boundingSphere;this.observe(s?.center.x??0),this.observe(s?.center.y??0),this.observe(s?.center.z??0),this.observe(s?.radius??-1);const f=Array.isArray(o.material)?o.material:null;if(this.observe(f?.length??-1),f)for(const c of f)this.observeMaterial(c);else this.observeMaterial(o.material)}return this.stateChanged||=this.planState.length!==this.stateIndex,this.planState.length=this.stateIndex,this.stateChanged}observeMaterial(t){this.observe(t.uuid),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 yi=8*1024*1024;class wi{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>yi)continue;const l=new oe;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 rn=64*1024*1024,po=150,Ie=49152,Pt=8192,go=Symbol("navigation geometry replaced");class Oi{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 He,this.centre=new y,this.boxCentre=new y,this.halfExtent=new y,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 ft)||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])=>s),this.next())}async next(){if(this.building||this.unavailable||this.bytes>=rn)return;const t=this.queue.shift();if(!t){this.worker?.terminate(),this.worker=null;return}this.building=!0;const e=this.generation,o=()=>{if(e!==this.generation)throw go;if(this.unavailable)throw new Error(this.unavailable)},r=async()=>{await new Promise(a=>setTimeout(a,0)),o()};try{this.worker||(this.worker=new Worker(new URL("/assets/blender-motion-worker-CtT2cV3V.js",import.meta.url),{type:"module"}),this.worker.onmessage=x=>{if(this.pending?.id===x.data.id){const N=this.pending;this.pending=null,N.resolve(x.data)}},this.worker.onerror=x=>{this.unavailable=x.message||"Navigation geometry worker unavailable",this.worker?.terminate(),this.worker=null;const N=this.pending;this.pending=null,N?.resolve({id:N.id,refusal:this.unavailable})});const a=t.getAttribute("position"),s=this.groups.get(t),f=Array.isArray(s[0].material);if(s.some(x=>Array.isArray(x.material)!==f))return;const c=f?t.groups:[{start:0,count:t.index.count}],d=c.flatMap(x=>{const N=[];for(let T=x.start;T<x.start+x.count;T+=Ie)N.push({start:T,count:Math.min(Ie,x.start+x.count-T),materialIndex:x.materialIndex});return N}),l=t.getAttribute("blenderVertex"),i=new Uint32Array(a.count),u=new Uint8Array(a.count),m=x=>l?l.getX(x):x;for(let x=0;x<d.length;x++){const N=d[x];for(let T=N.start;T<N.start+N.count;T+=Pt){await r();for(let U=T;U<Math.min(T+Pt,N.start+N.count);U++){const $=m(t.index.getX(U));if(!Number.isInteger($)||$<0||$>=i.length)return;i[$]?i[$]!==x+1&&(u[$]=1):i[$]=x+1}}}const h=Object.entries(t.attributes).filter(([x])=>x!=="position"&&x!=="blenderVertex"),_=h.reduce((x,[,N])=>x+N.itemSize,0);if(_>32)return;const p=[];let g=0;for(const[x,N]of h)for(let T=0;T<N.itemSize;T++,g++)x!=="normal"&&p.push(g);const v=h.flatMap(([x,N])=>Array(N.itemSize).fill(x==="normal"?.5:1)),O=t.boundingBox?.clone()??new ue;if(!t.boundingBox){const x=new y;for(let N=0;N<a.count;N+=Pt){await r();for(let T=N;T<Math.min(N+Pt,a.count);T++)O.expandByPoint(x.fromBufferAttribute(a,T))}}if(!t.boundingSphere)return;const b=Math.max(O.max.x-O.min.x,O.max.y-O.min.y,O.max.z-O.min.z)*.002,S=[],w=[];let A=0,M=0;for(const x of c){const N=A;for(let T=x.start;T<x.start+x.count;T+=Ie){await r();const U=Math.min(T+Ie,x.start+x.count),$=[],k=new Map,P=new Uint32Array(U-T);for(let Q=T;Q<U;Q++){const mt=t.index.getX(Q);let Tt=k.get(mt);Tt===void 0&&(Tt=$.length,$.push(mt),k.set(mt,Tt)),P[Q-T]=Tt}const B=new Uint8Array($.length),K=new Float32Array($.length*3),ot=new Float32Array($.length*_);for(let Q=0;Q<$.length;Q+=Pt){await r();for(let mt=Q;mt<Math.min(Q+Pt,$.length);mt++){const Tt=$[mt];B[mt]=u[m(Tt)];for(let kt=0;kt<3;kt++)K[mt*3+kt]=a.getComponent(Tt,kt);let qt=0;for(const[,kt]of h){for(let Ae=0;Ae<kt.itemSize;Ae++)ot[mt*_+qt+Ae]=kt.getComponent(Tt,Ae);qt+=kt.itemSize}}}const dt=++this.nextId,et=await new Promise(Q=>{this.pending={id:dt,resolve:Q};const mt={id:dt,positions:K,indices:P,attributes:ot,stride:_,weights:v,absoluteError:b,protectedComponents:p,locks:B};this.worker.postMessage(mt,[K.buffer,P.buffer,ot.buffer,B.buffer])});if(o(),et.refusal)throw new Error(et.refusal);if(!et.indices||!Number.isFinite(et.error))throw new Error("Invalid navigation geometry response");const rt=et.indices;for(let Q=0;Q<rt.length;Q++)rt[Q]=$[rt[Q]];if(A+=rt.length,A*4>rn-this.bytes)return;S.push(rt),M=Math.max(M,et.error)}f&&w.push({start:N,count:A-N,materialIndex:x.materialIndex})}const E={vertices:a.count,fullTriangles:t.index.count/3,reducedTriangles:A/3,error:M,accepted:!1};if(this.reductions.length<32&&this.reductions.push(E),!A||A>=t.index.count*.75)return;const F=new Int32Array(a.count).fill(-1),V=[],H=new Uint32Array(A);let tt=0;for(const x of S){for(let N=0;N<x.length;N+=Pt){await r();for(let T=N;T<Math.min(N+Pt,x.length);T++){const U=x[T];let $=F[U];$<0&&($=V.length,V.push(U),F[U]=$),H[tt+T]=$}}tt+=x.length}const Z=H.byteLength+Object.values(t.attributes).reduce((x,N)=>x+V.length*N.itemSize*N.array.BYTES_PER_ELEMENT,0);if(E.bytes=Z,this.bytes+Z>rn)return;const nt=new oe;nt.setIndex(new ft(H,1));for(const[x,N]of Object.entries(t.attributes)){const T=N,U=T.array.constructor,$=new U(V.length*T.itemSize);for(let k=0;k<V.length;k+=Pt){await r();for(let P=k;P<Math.min(k+Pt,V.length);P++)for(let B=0;B<T.itemSize;B++)$[P*T.itemSize+B]=T.array[V[P]*T.itemSize+B]}nt.setAttribute(x,new ft($,T.itemSize,T.normalized))}nt.boundingSphere=t.boundingSphere.clone(),nt.boundingBox=O.clone();for(const x of w)nt.addGroup(x.start,x.count,x.materialIndex);nt.userData={...t.userData},E.accepted=!0,this.cache.set(t,{geometry:nt,error:M,bytes:Z}),this.bytes+=Z}catch(a){if(a===go)return;this.unavailable=String(a),this.worker?.terminate(),this.worker=null,this.pending=null,this.queue.length=0}finally{e===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()},po+1)),r-this.movedAt>po)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.geometry.boundingBox;d.getSize(this.halfExtent).multiplyScalar(.5);for(const l of this.groups.get(f)??[]){if(!Jt(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)),O=f.boundingSphere;this.centre.copy(O.center).applyMatrix4(this.viewWorld);let b=1;if(t.isPerspectiveCamera){const w=-this.centre.z-O.radius*v;d.getCenter(this.boxCentre).applyMatrix4(this.viewWorld);const A=this.viewWorld.elements,M=Math.abs(A[2])*this.halfExtent.x+Math.abs(A[6])*this.halfExtent.y+Math.abs(A[10])*this.halfExtent.z;b=Math.max(w,-this.boxCentre.z-M)}const S=c.error*v*Math.abs(t.projectionMatrix.elements[5])*o/(2*b);if(!(b>0)||S>1){s++;continue}this.swapped.push({mesh:l,geometry:f}),l.geometry=c.geometry,this.drawnMeshes++,this.fullTriangles+=f.index.count/3,this.motionTriangles+=c.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,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())t.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 Ai={WIREFRAME:"wireframe",SOLID:"solid",MATERIAL:"preview",RENDERED:"rendered"},C=I().finite(),Jo=W([C,C,C]),De=W([I().int().nonnegative(),I().int().nonnegative()]),vt={name:D(),domain:Y(["POINT","EDGE","FACE","CORNER"])},Mi=Ua("type",[R({...vt,type:X("FLOAT2"),data:L(W([C,C]))}).strict(),R({...vt,type:X("FLOAT_VECTOR"),data:L(Jo)}).strict(),R({...vt,type:X("FLOAT_COLOR"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("BYTE_COLOR"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("QUATERNION"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("FLOAT4"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("FLOAT4X4"),data:L(L(C).length(16))}).strict(),R({...vt,type:X("INT16_2D"),data:L(W([I().int(),I().int()]))}).strict(),R({...vt,type:X("INT32_2D"),data:L(W([I().int(),I().int()]))}).strict(),R({...vt,type:X("FLOAT"),data:L(C)}).strict(),R({...vt,type:X("INT"),data:L(I().int())}).strict(),R({...vt,type:X("INT8"),data:L(I().int())}).strict(),R({...vt,type:X("BOOLEAN"),data:L(at())}).strict(),R({...vt,type:X("STRING"),data:L(D())}).strict()]),Ti=R({positions:G(Float32Array),normals:G(Float32Array).nullable(),uv:G(Float32Array).nullable(),uvLayers:L(R({name:D(),data:G(Float32Array)}).strict()).optional(),attributeLayers:L(R({name:D(),data:G(Float32Array)}).strict()).optional(),orco:G(Float32Array).nullable().optional(),indices:G(Uint32Array),groups:L(R({start:I().int().nonnegative(),count:I().int().nonnegative(),materialIndex:I().int().nonnegative()}).strict()),hash:D()}).strict(),Si=R({v:L(Jo),f:L(L(I().int().nonnegative())),e:L(De).optional(),edge_order:L(De).optional(),m:L(I().int().nonnegative()).optional(),s:L(at()).optional(),sharp:L(De).optional(),seams:L(De).optional(),creases:L(W([C,C,C])).optional(),attributes:L(Mi).optional(),active_uv:D().nullable().optional(),render_uv:D().nullable().optional()}).strict(),Pi=R({store:I().int().optional(),revision:I().int(),unchanged:X(!0)}).strict(),Ei=R({co:Wt([G(Float32Array),G(Float64Array)]),cornerNormal:G(Float32Array).optional(),cornerTri:G(Uint32Array).optional(),orco:G(Float32Array).optional(),faceStart:G(Uint32Array),corner:G(Uint32Array),cornerEdge:G(Int32Array),edge:G(Uint32Array),edgeSharp:G(Uint8Array),edgeSeam:G(Uint8Array),edgeCrease:G(Float32Array),material:G(Uint32Array),smooth:G(Uint8Array),vertSelect:G(Uint8Array),vertHide:G(Uint8Array),edgeSelect:G(Uint8Array),edgeHide:G(Uint8Array),faceSelect:G(Uint8Array),faceHide:G(Uint8Array)}).strict(),Ni=R({name:D(),domain:Y(["POINT","EDGE","FACE","CORNER"]),type:D(),data:Wa(n=>ArrayBuffer.isView(n))}).strict(),ta=R({columns:Ei,attributes:L(Ni),activeUv:D().nullable(),renderUv:D().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(),Ri=Wt([Ti,ta,Si,Pi]),vo=new Set;function Ii(n,t){const e=new Blob([n],{type:t}),o=new Ia;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,ht()}).finally(()=>{vo.delete(a)});return vo.add(a),a.catch(()=>{}),{texture:o,ready:a}}function Di(n,t,e,o){const r=new We(n,t,e,qe,Ra);return r.flipY=!1,r.colorSpace=o==="data"?Le:Ut,r.needsUpdate=!0,r}function zi(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?mn(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 Na(a,o,r,t.length);c.colorSpace=e==="data"?Le:Ut,c.magFilter=ee,c.minFilter=Io,c.generateMipmaps=!0,c.needsUpdate=!0;const d=new We(f,s,2,qe,To);return d.magFilter=d.minFilter=un,d.needsUpdate=!0,{tiles:c,map:d,frame:t}}const Ci=R({width:I().int().positive(),height:I().int().positive(),revision:I().int().nonnegative(),rgba:G(Uint8Array).optional(),rgbaBase64:D().optional(),colorspace:Y(["sRGB","data"]).optional(),tiles:L(R({number:I().int().min(1001),width:I().int().positive(),height:I().int().positive(),rgba:G(Uint8Array).optional(),rgbaBase64:D().optional()}).strict()).optional()}).strict(),Fi=R({revision:I().int().nonnegative(),encoded:G(Uint8Array).optional(),encodedBase64:D().optional(),mime:Y(["image/png","image/jpeg"]),colorspace:Y(["sRGB","data"]).optional()}).strict(),ea=Wt([Ci,Fi]),sn=R({image:R({name:D(),revision:I().int().nonnegative()}).strict(),extension:Y(["REPEAT","EXTEND","MIRROR","CLIP"]).default("REPEAT"),uv:D(),tint:W([C,C,C]).optional()}).strict(),ki=R({name:D(),color:W([C,C,C,C]),roughness:C,metallic:C,transmission:C,ior:C,physical:Cs.optional(),normal_texture:sn.optional(),normal_strength:C.default(1),normal_space:Y(["TANGENT","OBJECT"]).default("TANGENT"),normal_directx:at().default(!1),texture:sn.optional(),roughness_texture:sn.optional(),emission:R({color:W([C,C,C]),strength:C}).strict().optional(),graph:ls.optional(),viewport:R({color:W([C,C,C,C]),roughness:C,metallic:C}).strict().optional()}).strict(),$i=R({session:D(),revision:I().int().nonnegative(),volumes:Ot(D(),qo).default({}),lights:Ot(D(),qr).default({}),world:Jr.nullable().default(null),meshes:Ot(D(),Ri),materials:Ot(D(),ki),images:Ot(D(),ea).default({}),objects:L(R({id:D(),name:D(),type:Y(["MESH","CURVE","SURFACE","FONT","META","ARMATURE","LATTICE","VOLUME","EMPTY","CAMERA","LIGHT","SPEAKER","GREASEPENCIL","POINTCLOUD","LIGHT_PROBE"]),mesh:D().nullable(),volume:D().nullable().optional(),light:D().nullable().optional(),materials:L(D().nullable()),matrix:L(W([C,C,C,C])).length(4),visible:at(),render_visible:at().default(!0),selected:at(),parent:D().nullable(),texspace:W([W([C,C,C]),W([C,C,C])]).optional(),default_color:D().optional()}).strict()),active:D().nullable(),mode:D(),cameras:Ot(D(),Ot(D(),zo())).default({}),warnings:L(D()).default([]),updated:L(D()).default([]),frame:I().int().default(0),armatures:Ot(D(),Xa).default({}),weights:js.nullable().default(null),cursor:qs.optional(),camera_view:R({scene_camera:D().nullable(),view_layer_cameras:L(D()),aspect:I().finite().positive()}).optional(),light_distances:Ot(D(),W([I().finite(),I().finite()])).default({}),empties:Ot(D(),Ks).default({}),view:R({location:W([I(),I(),I()]),rotation:W([I(),I(),I(),I()]),distance:I().finite(),perspective:Y(["PERSP","ORTHO","CAMERA"]),lens:I().finite().positive().default(50),shading:Y(["WIREFRAME","SOLID","MATERIAL","RENDERED"]).optional()}).nullable().optional(),subject:R({frame:I().int(),body:D(),markers:L(W([I().int(),D()]))}).optional(),units:R({system:Y(["NONE","METRIC","IMPERIAL"]),scale_length:I().finite()}).optional()}).strict();function Li(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 ji={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 Be{constructor(){this.root=new ct,this.instances=new hi(this.root),this.materialRanges=new wi,this.transparentInstances=new bi(this.root),this.motionGeometry=new Oi(ht),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 Qr,this.world=new Nn,this.armatureOverlay=new rr,this.weightOverlay=new Ws,this.cursorOverlay=new Zs,this.extrasOverlay=new ti,this.armatureRoot=new ct,this.weightRoot=new ct,this.cursorRoot=new ct,this.cameraExtrasRoot=new ct,this.lightExtrasRoot=new ct,this.emptyExtrasRoot=new ct,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 ne({color:12172998,roughness:.72}),this.textures=new Map,this.textureNames=new Map,this.roughnessTextureNames=new Map,this.textureSamplers=new zs,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=oi,this.cameraViewPan=ai,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=ws(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&&ht()}subscribeFrames(t){return this.frameListeners.add(t),()=>{this.frameListeners.delete(t)}}onChange(t){const e=this.subscribeFrames(t),o=Ha(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 y(...t.location).applyMatrix4(this.root.matrix),c=d=>d.applyQuaternion(s).applyMatrix4(this.root.matrix).normalize();return{target:f.toArray(),direction:c(new y(0,0,1)).toArray(),up:c(new y(0,1,0)).toArray(),distance:t.distance,projection:t.perspective==="ORTHO"?"orthographic":"perspective",lens:t.lens,drawMode:t.shading?Ai[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 y(...t),new St(...e),new y(1,1,1)).premultiply(o),a=new y,s=new St;return r.decompose(a,s,new y),{location:a.toArray(),rotation:[s.w,s.x,s.y,s.z]}}cameraView(t,e,o,r){const a=this.frame,s=uo.safeParse(a?.cameras[t]);return!a?.camera_view||!s.success?null:ri(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=Li(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=ji[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),ht()),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 y).toArray().map(r=>r.toFixed(1)).join(","):"";return`${t.uuid}:${o}:${this.worldKey}`}report(t){t.then(ht,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(),ht())}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(),ht())}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)??si,a=`${r.color.join(",")}|${r.roughness}|${r.metallic}|${e}`;o.add(a);let s=this.workbenchMaterials.get(a);return s||(s=di(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?io(this.frame?.world)?.extinction:null)??new y;for(const a of[...this.materials.values(),this.fallback])ks(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 Gr(),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 ue().setFromObject(d);l.isEmpty()||o.push(l)}}if(!t||!o.length)return;const a=o.reduce((c,d)=>c.union(d),new ue).getBoundingSphere(new Mn),s=e?new He().setFromProjectionMatrix(new q().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse)):null,f=s?o.flatMap(c=>ns(c,s)):[];for(const c of this.lights.values())c.isDirectionalLight&&e?os(c,f,o):Zr(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),ht())}applyExtras(t){const e={};for(const[o,r]of Object.entries(t.cameras)){const a=uo.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),ht()},()=>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=ta.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:Ce(qn({...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,ea.parse(t.piece))}}applyFrame(t){const e=this.frame===null?null:{session:this.frame.session,revision:this.frame.revision},o=$i.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:as(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?`${Bn}: the presenter does not hold runtime mesh ${l} (store ${i.store}, revision ${i.revision})`:`${Bn}: 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?Ce(qn({...i.columns,attributes:i.attributes,activeUv:i.activeUv,renderUv:i.renderUv},h)):u?Ce(i):vr(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?mn(i.rgbaBase64):void 0);if(!g)throw new Error(`Runtime image ${l} carries no raster`);const v=i.tiles?zi(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 O=u.texture.image;if(O.data){O.data.set(g),u.texture.needsUpdate=!0,u.revision=i.revision,v&&(u.udim=v);continue}}u?.texture.dispose(),this.textures.set(l,{texture:Di(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?mn(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}=Ii(m,i.mime);_.colorSpace=h==="data"?Le:Ut,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 ne;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,bt):u.color.setRGB(i.color[0],i.color[1],i.color[2],bt),u.opacity=i.color[3];const h=u.opacity<1||i.graph!==void 0&&fs(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,Dn(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 b=this.textures.get(_);if(!b)throw new Error(`${me}: missing normal image ${_}`);const S=this.textureSamplers.get(`${l}:normal`,b.texture,i.normal_texture.extension,b.ready,i.normal_texture.uv);u.normalMap!==S&&(u.normalMap=S,u.needsUpdate=!0);const w=i.normal_space==="OBJECT"?Pa:Ea;u.normalMapType!==w&&(u.normalMapType=w,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],bt),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 b=this.textures.get(p);if(!b)throw new Error(`${me}: the presenter does not hold runtime image ${p} (revision ${i.roughness_texture.image.revision})`);const S=this.textureSamplers.get(`${l}:roughness`,b.texture,i.roughness_texture.extension,b.ready,i.roughness_texture.uv);u.roughnessMap!==S&&(u.roughnessMap=S,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 b=this.textures.get(g);if(!b)throw new Error(`${me}: the presenter does not hold runtime image ${g} (revision ${i.texture.image.revision})`);const S=this.textureSamplers.get(`${l}:color`,b.texture,i.texture.extension,b.ready,i.texture.uv);u.map!==S&&(u.map=S,this.textureNames.set(l,g),u.needsUpdate=!0)}const v=i.graph?this.compiledGraph(i.graph):null,O=new Set;As(u,v,b=>{const S=this.textures.get(b.name);if(!S)throw new Error(`${me}: the presenter does not hold runtime image ${b.name} (revision ${b.revision})`);if(b.tiled){if(!S.udim)throw new Error(`${me}: runtime image ${b.name} arrived without its UDIM tiles`);return S.udim}const w=`${l}:graph:${b.node}`;O.add(w);const A=this.textureSamplers.get(w,S.texture,b.extension,S.ready),M=b.closest?un:ee,E=b.closest?un:b.mipmap?Io:ee;return(A.magFilter!==M||A.minFilter!==E)&&(A.magFilter=M,A.minFilter=E,A.needsUpdate=!0),A},this.photograph);for(const b of this.graphSamplers.get(l)??[])O.has(b)||this.textureSamplers.delete(b);this.graphSamplers.set(l,O),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 Ft(this.meshes.get(l.mesh).geometry,this.fallback):new Ao),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,Es(m)}if(l.light){const m=this.lights.get(l.light)??null,h=Yr(o.lights[l.light],m);m&&m!==h&&(m.removeFromParent(),m.dispose()),h.parent!==i&&i.add(h),h.userData.volterOwnOverlay=!0,Kr(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 ft))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(Bt(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]=qo.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===Le?"data":"sRGB",...a.udim?{tiles:a.udim.frame}:{}}}}return e}follow(){const t=new Be;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 Be;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=io(this.frame?.world);return t?new Ls(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 Yi=new Be;function na(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 ln(n){const t=na(n);return new Float32Array(t.buffer,t.byteOffset,t.byteLength>>2)}function Vi(n){const t=na(n);return new Uint16Array(t.buffer,t.byteOffset,t.byteLength>>1)}function Bi(n){return new q().set(...n.flat())}function xo(n,t){return[n.object,n.mesh,n.armature,n.vertexCount,n.bones.length,t].join("|")}class Ui{#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=xo(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 w=0;w<d.count;w++)l=Math.max(l,d.getX(w));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=Vi(e.skinIndexBase64??""),u=ln(e.skinWeightBase64??""),m=d.count,h=new Uint16Array(m*4),_=new Float32Array(m*4);for(let w=0;w<m;w++){const A=d.getX(w);for(let M=0;M<4;M++)h[w*4+M]=i[A*4+M]??0,_[w*4+M]=u[A*4+M]??0}c.setAttribute("skinIndex",new Da(h,4)),c.setAttribute("skinWeight",new Nt(_,4));const p=new ct;p.name=`${e.armature}:bones`;const g=[],v=e.bones.map(w=>Bi(w.pose)),O=new Map(e.bones.map((w,A)=>[w.name,A]));e.bones.forEach((w,A)=>{const M=new za;M.name=w.name,g.push(M);const E=w.parent===null?void 0:O.get(w.parent);(E===void 0?v[A].clone():v[E].clone().invert().multiply(v[A])).decompose(M.position,M.quaternion,M.scale),(E===void 0?p:g[E]).add(M)}),s.add(p);const b=new Ca(c,f.material);b.name=f.name,b.matrixAutoUpdate=!1,b.matrix.copy(f.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale),b.userData=f.userData,b.frustumCulled=!1,t.replacePresentedObject(f,b),t.root.updateMatrixWorld(!0);const S=new Fa(g);return b.bind(S,b.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:b,boneRoot:p,bones:g,skeleton:S,frame:o,signature:xo(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=ln(i.timeBase64),h=ln(i.valueBase64),_=`${u.uuid}.${i.property}`;s.push(i.property==="quaternion"?new ka(_,Array.from(m),Array.from(h)):new $a(_,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 La(r),l=d.clipAction(new ja(e.action??"action",c,s));l.setLoop(Va,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 oa=new Ui;function Zi(n){return oa.subscribe(n)}function Ki(){return oa.version}export{oa as a,Ki as b,Yi as c,Zi as s};
|
|
7194
|
+
#include <opaque_fragment>`)},a.customProgramCacheKey=()=>"volter-blender-workbench",a}const mi=64;function _i(n,t){return Array.isArray(n)&&Array.isArray(t)?n.length===t.length&&n.every((e,o)=>e===t[o]):n===t}function Jt(n){for(let t=n;t;t=t.parent)if(!t.visible)return!1;return!0}function yn(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 hi{constructor(t){this.root=t,this.batches=[],this.inverse=new q,this.matrix=new q,this.box=new ue,this.projection=new q,this.frustum=new He,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(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)){r("material");continue}if(f.some(l=>Yo(l,s.geometry).size>12)){r("attributeBudget");continue}if(this.matrix.multiplyMatrices(this.inverse,s.matrixWorld),!yn(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>mi){this.box.makeEmpty();for(const h of f)this.box.expandByPoint(new y().setFromMatrixPosition(h.matrixWorld));const i=this.box.getSize(new y),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 No(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(Ro);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&&Jt(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){let o=0,r=!1;for(const a of e){const{mesh:s}=a;if(this.matrix.multiplyMatrices(this.inverse,s.matrixWorld),!(s.parent!==null&&s.geometry===t.geometry&&_i(s.material,t.material)&&yn(this.matrix))){s.layers.mask|=a.layers;continue}if(s.layers.mask&=~a.layers,!Jt(s)||this.camera&&(!this.camera.layers.isEnabled(0)||s.frustumCulled&&!this.frustum.intersectsObject(s)))continue;const c=o*16;this.matrix.elements.some((d,l)=>Math.fround(d)!==t.instanceMatrix.array[c+l])&&(t.setMatrixAt(o,this.matrix),r=!0),o++}r||=t.count!==o||t.boundingSphere===null,t.count=o,r&&(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 wn=64,an=4*1024*1024,pi=32*1024*1024,gi=1024;class vi{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 ft)||g.isInstancedBufferAttribute||g instanceof Sa||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>an)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<=an),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>an||this.bytes+r>pi,t.refused)continue;const a=new we(wn,e,o,t.material);a.sortObjects=!1,a.perObjectFrustumCulled=!1,a.frustumCulled=!1,a.matrixAutoUpdate=!1,a.boundingSphere=new Mn,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>=gi)return null;if(this.created>=4)return this.pending=!0,null;a=new we(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<wn;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 _o=128;class xi{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 we?"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=so(t,s.material)!==null,s.sourceVersion!==t.version&&(s.material.needsUpdate=!0),s.sourceVersion=t.version,s.frame=this.frame);else{if(this.count>=_o)return t;const f=so(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:_o}}}const re=wn;function ho(n){for(let t=n.parent;t;t=t.parent)if(t.isGroup)return t.renderOrder;return 0}class bi{constructor(t){this.root=t,this.objects=[],this.drawMaterials=new xi,this.ordered=new vi,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 He,this.centre=new y,this.depth=new Ue,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)||!Jt(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=ho(c);if(_&&_.visible&&_.transparent&&!_.isShaderMaterial&&!(_.transmission>0)&&(_.side!==$e||_.forceSinglePass)&&!c.isSkinnedMesh&&!c.morphTargetInfluences&&!c.isInstancedMesh&&c.layers.mask===1&&p===this.root.renderOrder){const v=c.geometry,O=v.index?.count??v.getAttribute("position").count,b=!Array.isArray(c.material)||v.groups.length===1&&v.groups[0].start===0&&v.groups[0].count===O&&v.groups[0].materialIndex===0,S=`${v.id}:${_.uuid}:${c.renderOrder}`;let w=s.get(S);w===void 0&&(w=Yo(_,v).size<=12,s.set(S,w)),this.matrix.multiplyMatrices(this.inverse,c.matrixWorld),b&&w&&yn(this.matrix)&&(m=_,h=S)}if(h===null){const v=_?_.isShaderMaterial?"customShader":_.transmission>0?"transmission":_.side===$e&&!_.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+re;_<l;_+=re)a[_-1].z===a[_].z&&(h=!1);if(h)for(let _=c;_<l;_+=re){const p=Math.min(re,l-_);if(p<2)continue;const g=a[_],v=f.get(d.key)??0;f.set(d.key,v+1);const O=d.key.startsWith("multi:");let b;if(O){const w=this.ordered.get(d.key,v);if(!w)continue;if(b=this.mixedDraws.get(w),!b){b={mesh:w,members:[]},this.mixedDraws.set(w,b);const A=b;w.raycast=(M,E)=>{if(w.visible)for(const F of A.members)Jt(F)&&F.raycast(M,E)},this.root.add(w)}}let S=this.pools.get(d.key);if(S||(S=[],this.pools.set(d.key,S)),O||(b=S[v]),!b){const w=new No(d.mesh.geometry,d.material,re);w.name="Blender ordered transparency",w.userData.engineInternal=!0,w.matrixAutoUpdate=!1,w.frustumCulled=!1,w.boundingSphere=new Mn,w.instanceMatrix.setUsage(Ro),b={mesh:w,members:[]};const A=b;w.raycast=(M,E)=>{if(w.visible)for(const F of A.members)Jt(F)&&F.raycast(M,E)},S.push(b),this.root.add(w)}b.mesh.material=this.drawMaterials.get(d.material,b.mesh),b.mesh.visible=!0,b.mesh.renderOrder=g.mesh.renderOrder,b.mesh.boundingSphere.center.copy(g.centre).applyMatrix4(this.inverse),b.mesh.updateMatrixWorld(!0);for(let w=0;w<p;w++){const A=a[_+w].mesh;this.matrix.multiplyMatrices(this.inverse,A.matrixWorld),b.mesh.setMatrixAt(w,this.matrix),b.mesh instanceof we&&(b.mesh.setGeometryIdAt(w,this.ordered.geometryId(d.key,A.geometry)),b.mesh.setVisibleAt(w,!0)),b.members.push(A),A.layers.disable(0),this.hidden.push(A)}if(b.mesh instanceof we)for(let w=p;w<re;w++)b.mesh.setVisibleAt(w,!1);else b.mesh.count=p,b.mesh.instanceMatrix.needsUpdate=!0;this.planned.push(b),this.batches++,this.instances+=p}}c=l}this.ordered.pending&&queueMicrotask(ht)}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 o of this.projection.elements)this.observe(o);for(const o of this.root.matrixWorld.elements)this.observe(o);const e=new Set;for(const o of this.objects){if(!(Array.isArray(o.material)?o.material:[o.material]).some(c=>c.visible&&c.transparent))continue;this.observe(o.parent?.id??-1),this.observe(Jt(o)?1:0),this.observe(o.layers.mask),this.observe(o.renderOrder),this.observe(ho(o)),this.observe(o.frustumCulled?1:0),this.observe(o.morphTargetInfluences?1:0);for(const c of o.matrixWorld.elements)this.observe(c);const a=o.geometry;if(this.observe(a.id),!e.has(a)){e.add(a),this.observe(a.index?.id??-1),this.observe(a.index?.version??-1),this.observe(JSON.stringify(a.userData.blenderUvChannels??null));for(const c of Object.keys(a.attributes).sort()){const d=a.getAttribute(c);this.observe(c),d instanceof ft&&(this.observe(d.id),this.observe(d.version))}}this.observe(a.drawRange.start),this.observe(a.drawRange.count),this.observe(a.index?.count??a.getAttribute("position").count),this.observe(a.groups.length);for(const c of a.groups)this.observe(c.start),this.observe(c.count),this.observe(c.materialIndex??0);const s=o.boundingSphere??a.boundingSphere;this.observe(s?.center.x??0),this.observe(s?.center.y??0),this.observe(s?.center.z??0),this.observe(s?.radius??-1);const f=Array.isArray(o.material)?o.material:null;if(this.observe(f?.length??-1),f)for(const c of f)this.observeMaterial(c);else this.observeMaterial(o.material)}return this.stateChanged||=this.planState.length!==this.stateIndex,this.planState.length=this.stateIndex,this.stateChanged}observeMaterial(t){this.observe(t.uuid),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 yi=8*1024*1024;class wi{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>yi)continue;const l=new oe;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 rn=64*1024*1024,po=150,Ie=49152,Pt=8192,go=Symbol("navigation geometry replaced");class Oi{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 He,this.centre=new y,this.boxCentre=new y,this.halfExtent=new y,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 ft)||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])=>s),this.next())}async next(){if(this.building||this.unavailable||this.bytes>=rn)return;const t=this.queue.shift();if(!t){this.worker?.terminate(),this.worker=null;return}this.building=!0;const e=this.generation,o=()=>{if(e!==this.generation)throw go;if(this.unavailable)throw new Error(this.unavailable)},r=async()=>{await new Promise(a=>setTimeout(a,0)),o()};try{this.worker||(this.worker=new Worker(new URL("/assets/blender-motion-worker-CtT2cV3V.js",import.meta.url),{type:"module"}),this.worker.onmessage=x=>{if(this.pending?.id===x.data.id){const N=this.pending;this.pending=null,N.resolve(x.data)}},this.worker.onerror=x=>{this.unavailable=x.message||"Navigation geometry worker unavailable",this.worker?.terminate(),this.worker=null;const N=this.pending;this.pending=null,N?.resolve({id:N.id,refusal:this.unavailable})});const a=t.getAttribute("position"),s=this.groups.get(t),f=Array.isArray(s[0].material);if(s.some(x=>Array.isArray(x.material)!==f))return;const c=f?t.groups:[{start:0,count:t.index.count}],d=c.flatMap(x=>{const N=[];for(let T=x.start;T<x.start+x.count;T+=Ie)N.push({start:T,count:Math.min(Ie,x.start+x.count-T),materialIndex:x.materialIndex});return N}),l=t.getAttribute("blenderVertex"),i=new Uint32Array(a.count),u=new Uint8Array(a.count),m=x=>l?l.getX(x):x;for(let x=0;x<d.length;x++){const N=d[x];for(let T=N.start;T<N.start+N.count;T+=Pt){await r();for(let U=T;U<Math.min(T+Pt,N.start+N.count);U++){const $=m(t.index.getX(U));if(!Number.isInteger($)||$<0||$>=i.length)return;i[$]?i[$]!==x+1&&(u[$]=1):i[$]=x+1}}}const h=Object.entries(t.attributes).filter(([x])=>x!=="position"&&x!=="blenderVertex"),_=h.reduce((x,[,N])=>x+N.itemSize,0);if(_>32)return;const p=[];let g=0;for(const[x,N]of h)for(let T=0;T<N.itemSize;T++,g++)x!=="normal"&&p.push(g);const v=h.flatMap(([x,N])=>Array(N.itemSize).fill(x==="normal"?.5:1)),O=t.boundingBox?.clone()??new ue;if(!t.boundingBox){const x=new y;for(let N=0;N<a.count;N+=Pt){await r();for(let T=N;T<Math.min(N+Pt,a.count);T++)O.expandByPoint(x.fromBufferAttribute(a,T))}}if(!t.boundingSphere)return;const b=Math.max(O.max.x-O.min.x,O.max.y-O.min.y,O.max.z-O.min.z)*.002,S=[],w=[];let A=0,M=0;for(const x of c){const N=A;for(let T=x.start;T<x.start+x.count;T+=Ie){await r();const U=Math.min(T+Ie,x.start+x.count),$=[],k=new Map,P=new Uint32Array(U-T);for(let Q=T;Q<U;Q++){const mt=t.index.getX(Q);let Tt=k.get(mt);Tt===void 0&&(Tt=$.length,$.push(mt),k.set(mt,Tt)),P[Q-T]=Tt}const B=new Uint8Array($.length),K=new Float32Array($.length*3),ot=new Float32Array($.length*_);for(let Q=0;Q<$.length;Q+=Pt){await r();for(let mt=Q;mt<Math.min(Q+Pt,$.length);mt++){const Tt=$[mt];B[mt]=u[m(Tt)];for(let kt=0;kt<3;kt++)K[mt*3+kt]=a.getComponent(Tt,kt);let qt=0;for(const[,kt]of h){for(let Ae=0;Ae<kt.itemSize;Ae++)ot[mt*_+qt+Ae]=kt.getComponent(Tt,Ae);qt+=kt.itemSize}}}const dt=++this.nextId,et=await new Promise(Q=>{this.pending={id:dt,resolve:Q};const mt={id:dt,positions:K,indices:P,attributes:ot,stride:_,weights:v,absoluteError:b,protectedComponents:p,locks:B};this.worker.postMessage(mt,[K.buffer,P.buffer,ot.buffer,B.buffer])});if(o(),et.refusal)throw new Error(et.refusal);if(!et.indices||!Number.isFinite(et.error))throw new Error("Invalid navigation geometry response");const rt=et.indices;for(let Q=0;Q<rt.length;Q++)rt[Q]=$[rt[Q]];if(A+=rt.length,A*4>rn-this.bytes)return;S.push(rt),M=Math.max(M,et.error)}f&&w.push({start:N,count:A-N,materialIndex:x.materialIndex})}const E={vertices:a.count,fullTriangles:t.index.count/3,reducedTriangles:A/3,error:M,accepted:!1};if(this.reductions.length<32&&this.reductions.push(E),!A||A>=t.index.count*.75)return;const F=new Int32Array(a.count).fill(-1),V=[],H=new Uint32Array(A);let tt=0;for(const x of S){for(let N=0;N<x.length;N+=Pt){await r();for(let T=N;T<Math.min(N+Pt,x.length);T++){const U=x[T];let $=F[U];$<0&&($=V.length,V.push(U),F[U]=$),H[tt+T]=$}}tt+=x.length}const Z=H.byteLength+Object.values(t.attributes).reduce((x,N)=>x+V.length*N.itemSize*N.array.BYTES_PER_ELEMENT,0);if(E.bytes=Z,this.bytes+Z>rn)return;const nt=new oe;nt.setIndex(new ft(H,1));for(const[x,N]of Object.entries(t.attributes)){const T=N,U=T.array.constructor,$=new U(V.length*T.itemSize);for(let k=0;k<V.length;k+=Pt){await r();for(let P=k;P<Math.min(k+Pt,V.length);P++)for(let B=0;B<T.itemSize;B++)$[P*T.itemSize+B]=T.array[V[P]*T.itemSize+B]}nt.setAttribute(x,new ft($,T.itemSize,T.normalized))}nt.boundingSphere=t.boundingSphere.clone(),nt.boundingBox=O.clone();for(const x of w)nt.addGroup(x.start,x.count,x.materialIndex);nt.userData={...t.userData},E.accepted=!0,this.cache.set(t,{geometry:nt,error:M,bytes:Z}),this.bytes+=Z}catch(a){if(a===go)return;this.unavailable=String(a),this.worker?.terminate(),this.worker=null,this.pending=null,this.queue.length=0}finally{e===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()},po+1)),r-this.movedAt>po)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.geometry.boundingBox;d.getSize(this.halfExtent).multiplyScalar(.5);for(const l of this.groups.get(f)??[]){if(!Jt(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)),O=f.boundingSphere;this.centre.copy(O.center).applyMatrix4(this.viewWorld);let b=1;if(t.isPerspectiveCamera){const w=-this.centre.z-O.radius*v;d.getCenter(this.boxCentre).applyMatrix4(this.viewWorld);const A=this.viewWorld.elements,M=Math.abs(A[2])*this.halfExtent.x+Math.abs(A[6])*this.halfExtent.y+Math.abs(A[10])*this.halfExtent.z;b=Math.max(w,-this.boxCentre.z-M)}const S=c.error*v*Math.abs(t.projectionMatrix.elements[5])*o/(2*b);if(!(b>0)||S>1){s++;continue}this.swapped.push({mesh:l,geometry:f}),l.geometry=c.geometry,this.drawnMeshes++,this.fullTriangles+=f.index.count/3,this.motionTriangles+=c.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,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())t.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 Ai={WIREFRAME:"wireframe",SOLID:"solid",MATERIAL:"preview",RENDERED:"rendered"},C=I().finite(),Jo=W([C,C,C]),De=W([I().int().nonnegative(),I().int().nonnegative()]),vt={name:D(),domain:Y(["POINT","EDGE","FACE","CORNER"])},Mi=Ua("type",[R({...vt,type:X("FLOAT2"),data:L(W([C,C]))}).strict(),R({...vt,type:X("FLOAT_VECTOR"),data:L(Jo)}).strict(),R({...vt,type:X("FLOAT_COLOR"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("BYTE_COLOR"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("QUATERNION"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("FLOAT4"),data:L(W([C,C,C,C]))}).strict(),R({...vt,type:X("FLOAT4X4"),data:L(L(C).length(16))}).strict(),R({...vt,type:X("INT16_2D"),data:L(W([I().int(),I().int()]))}).strict(),R({...vt,type:X("INT32_2D"),data:L(W([I().int(),I().int()]))}).strict(),R({...vt,type:X("FLOAT"),data:L(C)}).strict(),R({...vt,type:X("INT"),data:L(I().int())}).strict(),R({...vt,type:X("INT8"),data:L(I().int())}).strict(),R({...vt,type:X("BOOLEAN"),data:L(at())}).strict(),R({...vt,type:X("STRING"),data:L(D())}).strict()]),Ti=R({positions:G(Float32Array),normals:G(Float32Array).nullable(),uv:G(Float32Array).nullable(),uvLayers:L(R({name:D(),data:G(Float32Array)}).strict()).optional(),attributeLayers:L(R({name:D(),data:G(Float32Array)}).strict()).optional(),orco:G(Float32Array).nullable().optional(),indices:G(Uint32Array),groups:L(R({start:I().int().nonnegative(),count:I().int().nonnegative(),materialIndex:I().int().nonnegative()}).strict()),hash:D()}).strict(),Si=R({v:L(Jo),f:L(L(I().int().nonnegative())),e:L(De).optional(),edge_order:L(De).optional(),m:L(I().int().nonnegative()).optional(),s:L(at()).optional(),sharp:L(De).optional(),seams:L(De).optional(),creases:L(W([C,C,C])).optional(),attributes:L(Mi).optional(),active_uv:D().nullable().optional(),render_uv:D().nullable().optional()}).strict(),Pi=R({store:I().int().optional(),revision:I().int(),unchanged:X(!0)}).strict(),Ei=R({co:Wt([G(Float32Array),G(Float64Array)]),cornerNormal:G(Float32Array).optional(),cornerTri:G(Uint32Array).optional(),orco:G(Float32Array).optional(),faceStart:G(Uint32Array),corner:G(Uint32Array),cornerEdge:G(Int32Array),edge:G(Uint32Array),edgeSharp:G(Uint8Array),edgeSeam:G(Uint8Array),edgeCrease:G(Float32Array),material:G(Uint32Array),smooth:G(Uint8Array),vertSelect:G(Uint8Array),vertHide:G(Uint8Array),edgeSelect:G(Uint8Array),edgeHide:G(Uint8Array),faceSelect:G(Uint8Array),faceHide:G(Uint8Array)}).strict(),Ni=R({name:D(),domain:Y(["POINT","EDGE","FACE","CORNER"]),type:D(),data:Wa(n=>ArrayBuffer.isView(n))}).strict(),ta=R({columns:Ei,attributes:L(Ni),activeUv:D().nullable(),renderUv:D().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(),Ri=Wt([Ti,ta,Si,Pi]),vo=new Set;function Ii(n,t){const e=new Blob([n],{type:t}),o=new Ia;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,ht()}).finally(()=>{vo.delete(a)});return vo.add(a),a.catch(()=>{}),{texture:o,ready:a}}function Di(n,t,e,o){const r=new We(n,t,e,qe,Ra);return r.flipY=!1,r.colorSpace=o==="data"?Le:Ut,r.needsUpdate=!0,r}function zi(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?mn(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 Na(a,o,r,t.length);c.colorSpace=e==="data"?Le:Ut,c.magFilter=ee,c.minFilter=Io,c.generateMipmaps=!0,c.needsUpdate=!0;const d=new We(f,s,2,qe,To);return d.magFilter=d.minFilter=un,d.needsUpdate=!0,{tiles:c,map:d,frame:t}}const Ci=R({width:I().int().positive(),height:I().int().positive(),revision:I().int().nonnegative(),rgba:G(Uint8Array).optional(),rgbaBase64:D().optional(),colorspace:Y(["sRGB","data"]).optional(),tiles:L(R({number:I().int().min(1001),width:I().int().positive(),height:I().int().positive(),rgba:G(Uint8Array).optional(),rgbaBase64:D().optional()}).strict()).optional()}).strict(),Fi=R({revision:I().int().nonnegative(),encoded:G(Uint8Array).optional(),encodedBase64:D().optional(),mime:Y(["image/png","image/jpeg"]),colorspace:Y(["sRGB","data"]).optional()}).strict(),ea=Wt([Ci,Fi]),sn=R({image:R({name:D(),revision:I().int().nonnegative()}).strict(),extension:Y(["REPEAT","EXTEND","MIRROR","CLIP"]).default("REPEAT"),uv:D(),tint:W([C,C,C]).optional()}).strict(),ki=R({name:D(),color:W([C,C,C,C]),roughness:C,metallic:C,transmission:C,ior:C,physical:Cs.optional(),normal_texture:sn.optional(),normal_strength:C.default(1),normal_space:Y(["TANGENT","OBJECT"]).default("TANGENT"),normal_directx:at().default(!1),texture:sn.optional(),roughness_texture:sn.optional(),emission:R({color:W([C,C,C]),strength:C}).strict().optional(),graph:ls.optional(),viewport:R({color:W([C,C,C,C]),roughness:C,metallic:C}).strict().optional()}).strict(),$i=R({session:D(),revision:I().int().nonnegative(),volumes:Ot(D(),qo).default({}),lights:Ot(D(),qr).default({}),world:Jr.nullable().default(null),meshes:Ot(D(),Ri),materials:Ot(D(),ki),images:Ot(D(),ea).default({}),objects:L(R({id:D(),name:D(),type:Y(["MESH","CURVE","SURFACE","FONT","META","ARMATURE","LATTICE","VOLUME","EMPTY","CAMERA","LIGHT","SPEAKER","GREASEPENCIL","POINTCLOUD","LIGHT_PROBE"]),mesh:D().nullable(),volume:D().nullable().optional(),light:D().nullable().optional(),materials:L(D().nullable()),matrix:L(W([C,C,C,C])).length(4),visible:at(),render_visible:at().default(!0),selected:at(),parent:D().nullable(),texspace:W([W([C,C,C]),W([C,C,C])]).optional(),default_color:D().optional()}).strict()),active:D().nullable(),mode:D(),cameras:Ot(D(),Ot(D(),zo())).default({}),warnings:L(D()).default([]),updated:L(D()).default([]),frame:I().int().default(0),armatures:Ot(D(),Xa).default({}),weights:js.nullable().default(null),cursor:qs.optional(),camera_view:R({scene_camera:D().nullable(),view_layer_cameras:L(D()),aspect:I().finite().positive()}).optional(),light_distances:Ot(D(),W([I().finite(),I().finite()])).default({}),empties:Ot(D(),Ks).default({}),view:R({location:W([I(),I(),I()]),rotation:W([I(),I(),I(),I()]),distance:I().finite(),perspective:Y(["PERSP","ORTHO","CAMERA"]),lens:I().finite().positive().default(50),shading:Y(["WIREFRAME","SOLID","MATERIAL","RENDERED"]).optional()}).nullable().optional(),subject:R({frame:I().int(),body:D(),markers:L(W([I().int(),D()]))}).optional(),units:R({system:Y(["NONE","METRIC","IMPERIAL"]),scale_length:I().finite()}).optional()}).strict();function Li(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 ji={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 Be{constructor(){this.root=new ct,this.instances=new hi(this.root),this.materialRanges=new wi,this.transparentInstances=new bi(this.root),this.motionGeometry=new Oi(ht),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 Qr,this.world=new Nn,this.armatureOverlay=new rr,this.weightOverlay=new Ws,this.cursorOverlay=new Zs,this.extrasOverlay=new ti,this.armatureRoot=new ct,this.weightRoot=new ct,this.cursorRoot=new ct,this.cameraExtrasRoot=new ct,this.lightExtrasRoot=new ct,this.emptyExtrasRoot=new ct,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 ne({color:12172998,roughness:.72}),this.textures=new Map,this.textureNames=new Map,this.roughnessTextureNames=new Map,this.textureSamplers=new zs,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=oi,this.cameraViewPan=ai,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=ws(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&&ht()}subscribeFrames(t){return this.frameListeners.add(t),()=>{this.frameListeners.delete(t)}}onChange(t){const e=this.subscribeFrames(t),o=Ha(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 y(...t.location).applyMatrix4(this.root.matrix),c=d=>d.applyQuaternion(s).applyMatrix4(this.root.matrix).normalize();return{target:f.toArray(),direction:c(new y(0,0,1)).toArray(),up:c(new y(0,1,0)).toArray(),distance:t.distance,projection:t.perspective==="ORTHO"?"orthographic":"perspective",lens:t.lens,drawMode:t.shading?Ai[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 y(...t),new St(...e),new y(1,1,1)).premultiply(o),a=new y,s=new St;return r.decompose(a,s,new y),{location:a.toArray(),rotation:[s.w,s.x,s.y,s.z]}}cameraView(t,e,o,r){const a=this.frame,s=uo.safeParse(a?.cameras[t]);return!a?.camera_view||!s.success?null:ri(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=Li(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=ji[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),ht()),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 y).toArray().map(r=>r.toFixed(1)).join(","):"";return`${t.uuid}:${o}:${this.worldKey}`}report(t){t.then(ht,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(),ht())}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(),ht())}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)??si,a=`${r.color.join(",")}|${r.roughness}|${r.metallic}|${e}`;o.add(a);let s=this.workbenchMaterials.get(a);return s||(s=di(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?io(this.frame?.world)?.extinction:null)??new y;for(const a of[...this.materials.values(),this.fallback])ks(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 Gr(),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 ue().setFromObject(d);l.isEmpty()||o.push(l)}}if(!t||!o.length)return;const a=o.reduce((c,d)=>c.union(d),new ue).getBoundingSphere(new Mn),s=e?new He().setFromProjectionMatrix(new q().multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse)):null,f=s?o.flatMap(c=>ns(c,s)):[];for(const c of this.lights.values())c.isDirectionalLight&&e?os(c,f,o):Zr(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),ht())}applyExtras(t){const e={};for(const[o,r]of Object.entries(t.cameras)){const a=uo.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),ht()},()=>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=ta.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:Ce(qn({...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,ea.parse(t.piece))}}applyFrame(t){const e=this.frame===null?null:{session:this.frame.session,revision:this.frame.revision},o=$i.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:as(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?`${Bn}: the presenter does not hold runtime mesh ${l} (store ${i.store}, revision ${i.revision})`:`${Bn}: 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?Ce(qn({...i.columns,attributes:i.attributes,activeUv:i.activeUv,renderUv:i.renderUv},h)):u?Ce(i):vr(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?mn(i.rgbaBase64):void 0);if(!g)throw new Error(`Runtime image ${l} carries no raster`);const v=i.tiles?zi(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 O=u.texture.image;if(O.data){O.data.set(g),u.texture.needsUpdate=!0,u.revision=i.revision,v&&(u.udim=v);continue}}u?.texture.dispose(),this.textures.set(l,{texture:Di(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?mn(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}=Ii(m,i.mime);_.colorSpace=h==="data"?Le:Ut,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 ne;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,bt):u.color.setRGB(i.color[0],i.color[1],i.color[2],bt),u.opacity=i.color[3];const h=u.opacity<1||i.graph!==void 0&&fs(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,Dn(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 b=this.textures.get(_);if(!b)throw new Error(`${me}: missing normal image ${_}`);const S=this.textureSamplers.get(`${l}:normal`,b.texture,i.normal_texture.extension,b.ready,i.normal_texture.uv);u.normalMap!==S&&(u.normalMap=S,u.needsUpdate=!0);const w=i.normal_space==="OBJECT"?Pa:Ea;u.normalMapType!==w&&(u.normalMapType=w,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],bt),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 b=this.textures.get(p);if(!b)throw new Error(`${me}: the presenter does not hold runtime image ${p} (revision ${i.roughness_texture.image.revision})`);const S=this.textureSamplers.get(`${l}:roughness`,b.texture,i.roughness_texture.extension,b.ready,i.roughness_texture.uv);u.roughnessMap!==S&&(u.roughnessMap=S,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 b=this.textures.get(g);if(!b)throw new Error(`${me}: the presenter does not hold runtime image ${g} (revision ${i.texture.image.revision})`);const S=this.textureSamplers.get(`${l}:color`,b.texture,i.texture.extension,b.ready,i.texture.uv);u.map!==S&&(u.map=S,this.textureNames.set(l,g),u.needsUpdate=!0)}const v=i.graph?this.compiledGraph(i.graph):null,O=new Set;As(u,v,b=>{const S=this.textures.get(b.name);if(!S)throw new Error(`${me}: the presenter does not hold runtime image ${b.name} (revision ${b.revision})`);if(b.tiled){if(!S.udim)throw new Error(`${me}: runtime image ${b.name} arrived without its UDIM tiles`);return S.udim}const w=`${l}:graph:${b.node}`;O.add(w);const A=this.textureSamplers.get(w,S.texture,b.extension,S.ready),M=b.closest?un:ee,E=b.closest?un:b.mipmap?Io:ee;return(A.magFilter!==M||A.minFilter!==E)&&(A.magFilter=M,A.minFilter=E,A.needsUpdate=!0),A},this.photograph);for(const b of this.graphSamplers.get(l)??[])O.has(b)||this.textureSamplers.delete(b);this.graphSamplers.set(l,O),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 Ft(this.meshes.get(l.mesh).geometry,this.fallback):new Ao),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,Es(m)}if(l.light){const m=this.lights.get(l.light)??null,h=Yr(o.lights[l.light],m);m&&m!==h&&(m.removeFromParent(),m.dispose()),h.parent!==i&&i.add(h),h.userData.volterOwnOverlay=!0,Kr(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 ft))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(Bt(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]=qo.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===Le?"data":"sRGB",...a.udim?{tiles:a.udim.frame}:{}}}}return e}follow(){const t=new Be;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 Be;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=io(this.frame?.world);return t?new Ls(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 Yi=new Be;function na(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 ln(n){const t=na(n);return new Float32Array(t.buffer,t.byteOffset,t.byteLength>>2)}function Vi(n){const t=na(n);return new Uint16Array(t.buffer,t.byteOffset,t.byteLength>>1)}function Bi(n){return new q().set(...n.flat())}function xo(n,t){return[n.object,n.mesh,n.armature,n.vertexCount,n.bones.length,t].join("|")}class Ui{#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=xo(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 w=0;w<d.count;w++)l=Math.max(l,d.getX(w));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=Vi(e.skinIndexBase64??""),u=ln(e.skinWeightBase64??""),m=d.count,h=new Uint16Array(m*4),_=new Float32Array(m*4);for(let w=0;w<m;w++){const A=d.getX(w);for(let M=0;M<4;M++)h[w*4+M]=i[A*4+M]??0,_[w*4+M]=u[A*4+M]??0}c.setAttribute("skinIndex",new Da(h,4)),c.setAttribute("skinWeight",new Nt(_,4));const p=new ct;p.name=`${e.armature}:bones`;const g=[],v=e.bones.map(w=>Bi(w.pose)),O=new Map(e.bones.map((w,A)=>[w.name,A]));e.bones.forEach((w,A)=>{const M=new za;M.name=w.name,g.push(M);const E=w.parent===null?void 0:O.get(w.parent);(E===void 0?v[A].clone():v[E].clone().invert().multiply(v[A])).decompose(M.position,M.quaternion,M.scale),(E===void 0?p:g[E]).add(M)}),s.add(p);const b=new Ca(c,f.material);b.name=f.name,b.matrixAutoUpdate=!1,b.matrix.copy(f.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale),b.userData=f.userData,b.frustumCulled=!1,t.replacePresentedObject(f,b),t.root.updateMatrixWorld(!0);const S=new Fa(g);return b.bind(S,b.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:b,boneRoot:p,bones:g,skeleton:S,frame:o,signature:xo(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=ln(i.timeBase64),h=ln(i.valueBase64),_=`${u.uuid}.${i.property}`;s.push(i.property==="quaternion"?new ka(_,Array.from(m),Array.from(h)):new $a(_,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 La(r),l=d.clipAction(new ja(e.action??"action",c,s));l.setLoop(Va,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 oa=new Ui;function Zi(n){return oa.subscribe(n)}function Ki(){return oa.version}export{oa as a,Ki as b,Yi as c,Zi as s};
|
package/dist/assets/{blender-runtime.document-0fBzbVqg.js → blender-runtime.document-CzE-1h4j.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{j3 as Ie,bt as Ce,r as B,bv as Te,fN as H,bB as F,bC as U,hR as De,bA as Pe,j4 as Be,bK as $e,bq as be,bn as Ve,j5 as Ge,j6 as pe,j7 as He,j8 as We,j9 as ze,ja as fe,bs as me,bp as Ue}from"./index-Crsbhlhy.js";import{c as Ke,a as Y}from"./blender-runtime-skin-C-J3OdY_.js";import{r as m}from"./index-nmcBqr7Y.js";import{u as qe,v as J,k as X,w as Q,x as Ye,y as oe,t as he,z as Je,A as Xe,B as ge,C as Qe,D as te,E as Ze,F as et,G as tt,H as rt,I as nt}from"./blender-runtime-host-BDbcC0Zg.js";import{r as ot}from"./index-CtzuWnCS.js";import{a as at}from"./three-contract-Dkt6PmWY.js";import{b as W,o as re}from"./viewport-door-Bn_5UYAF.js";import{s as lt,a as st}from"./object3d-document-session-registry-DYtU0S61.js";import{d9 as it}from"./three.core-3arARmh6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./LineSegments2-DN9pUfWA.js";import"./three.module-BLhyNg0e.js";import"./preview-renderer-BrYNFV1p.js";import"./environment-Dg-YaLsA.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./renderer-ownership-BovSEcLv.js";import"./output-pass-HurwNl0G.js";import"./Pass-D1MRT672.js";import"./clip-planes-CnAI6DZn.js";import"./content-bounds-JcLbQeNM.js";import"./hierarchy-marks-D-538fQp.js";import"./workspace-arrangement-BPsnvrOt.js";function Oe(t){const a=Number.isFinite(t)&&t>0?t:50;return{degrees:2*Math.atan(72/(2*a))*180/Math.PI,axis:"larger"}}Ie("model",{camera:{fov:Oe(50),opening:[.8187,.4458,.3617]},interaction:{bootTool:"select",boxSelect:"touch"},all:{lighting:{source:"studio",studioPreset:Ce.id,auto:null,tone:{mapper:"none",exposure:1}},xray:{enabled:!1,alpha:.5}},modes:{wireframe:{xray:{enabled:!0,alpha:0}},preview:{lighting:{source:"preview",auto:null,preview:{sceneLights:!1,sun:{enabled:!1},environment:{enabled:!0,image:"blender:forest",energy:1,rotation:0}},tone:{mapper:"agx",exposure:1}},backdrop:{source:"fill"}},rendered:{lighting:{source:"scene",auto:null,tone:{mapper:"agx",exposure:1}},backdrop:{source:"scene"}}},overlays:{selection:{origins:!0}},world:{upAxis:"z"}});function ct(t){return`blender-${t.toLowerCase().replace(/_/g,"-")}`}function P(t){return t?.type==="TSE_SOME_ID"&&t.struct==="Object"&&t.object!==void 0}function _e(t){if(t.struct)return t.struct}function je(t,a){return{id:t.id,label:t.name,role:"entity",kind:ct(t.icon),..._e(t)?{typeLabel:_e(t)}:{},parentId:a,childIds:t.children.map(o=>o.id),defaultExpanded:t.expanded}}const dt={transform:!0,inspectorFields:!1,persist:!0},ee=new Set;let Ae=0;const ae=new Set;function ye(){queueMicrotask(()=>{Ae++;for(const t of ae)t()})}function ut(t){return ae.add(t),()=>{ae.delete(t)}}function ve(){return Ae}function bt(t){for(const a of ee)if(a.documentId===t||a.documentId===`object3d-document:${t}`)return a;return ee.values().next().value??null}const pt=()=>({position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]});function Se(t,a){t.updateWorldMatrix(!0,!1);const o=a.matrixWorld.clone().invert().multiply(t.matrixWorld).elements;return[[o[0],o[1],o[2],o[3]],[o[4],o[5],o[6],o[7]],[o[8],o[9],o[10],o[11]],[o[12],o[13],o[14],o[15]]]}function K(t,a){return`${t} needs a file, and this editor has no door to ask for one: the host's file door (\`EditorHost.files\`, \`@volter/editor-sdk/host\`) reads and writes project-relative paths and has no file-picker member, so there is nothing to open the workbench's own dialog through. Blender's row opens a file browser; run without one, the engine answers "${a}".`}const ft=[{kind:"mesh.plane",label:"Plane",group:"Mesh",call:"mesh.primitive_plane_add"},{kind:"mesh.cube",label:"Cube",group:"Mesh",call:"mesh.primitive_cube_add"},{kind:"mesh.circle",label:"Circle",group:"Mesh",call:"mesh.primitive_circle_add"},{kind:"mesh.uv-sphere",label:"UV Sphere",group:"Mesh",call:"mesh.primitive_uv_sphere_add"},{kind:"mesh.ico-sphere",label:"Ico Sphere",group:"Mesh",call:"mesh.primitive_ico_sphere_add"},{kind:"mesh.cylinder",label:"Cylinder",group:"Mesh",call:"mesh.primitive_cylinder_add"},{kind:"mesh.cone",label:"Cone",group:"Mesh",call:"mesh.primitive_cone_add"},{kind:"mesh.torus",label:"Torus",group:"Mesh",call:"mesh.primitive_torus_add"},{kind:"mesh.grid",label:"Grid",group:"Mesh",call:"mesh.primitive_grid_add",separatorBefore:!0},{kind:"mesh.monkey",label:"Monkey",group:"Mesh",call:"mesh.primitive_monkey_add"},{kind:"curve.bezier",label:"Bézier",group:"Curve",call:"curve.primitive_bezier_curve_add"},{kind:"curve.bezier-circle",label:"Circle",group:"Curve",call:"curve.primitive_bezier_circle_add"},{kind:"curve.nurbs-curve",label:"Nurbs Curve",group:"Curve",call:"curve.primitive_nurbs_curve_add",separatorBefore:!0},{kind:"curve.nurbs-circle",label:"Nurbs Circle",group:"Curve",call:"curve.primitive_nurbs_circle_add"},{kind:"curve.path",label:"Path",group:"Curve",call:"curve.primitive_nurbs_path_add"},{kind:"curve.empty-hair",label:"Empty Hair",group:"Curve",call:"object.curves_empty_hair_add",separatorBefore:!0},{kind:"curve.fur",label:"Fur",group:"Curve",call:"object.quick_fur"},{kind:"surface.nurbs-curve",label:"Nurbs Curve",group:"Surface",call:"surface.primitive_nurbs_surface_curve_add"},{kind:"surface.nurbs-circle",label:"Nurbs Circle",group:"Surface",call:"surface.primitive_nurbs_surface_circle_add"},{kind:"surface.nurbs-surface",label:"Nurbs Surface",group:"Surface",call:"surface.primitive_nurbs_surface_surface_add"},{kind:"surface.nurbs-cylinder",label:"Nurbs Cylinder",group:"Surface",call:"surface.primitive_nurbs_surface_cylinder_add"},{kind:"surface.nurbs-sphere",label:"Nurbs Sphere",group:"Surface",call:"surface.primitive_nurbs_surface_sphere_add"},{kind:"surface.nurbs-torus",label:"Nurbs Torus",group:"Surface",call:"surface.primitive_nurbs_surface_torus_add"},{kind:"metaball.ball",label:"Ball",group:"Metaball",call:"object.metaball_add, type='BALL'"},{kind:"metaball.capsule",label:"Capsule",group:"Metaball",call:"object.metaball_add, type='CAPSULE'"},{kind:"metaball.plane",label:"Plane",group:"Metaball",call:"object.metaball_add, type='PLANE'"},{kind:"metaball.ellipsoid",label:"Ellipsoid",group:"Metaball",call:"object.metaball_add, type='ELLIPSOID'"},{kind:"metaball.cube",label:"Cube",group:"Metaball",call:"object.metaball_add, type='CUBE'"},{kind:"text",label:"Text",group:null,call:"object.text_add"},{kind:"point-cloud",label:"Point Cloud",group:null,call:"object.pointcloud_random_add"},{kind:"volume.import",label:"Import OpenVDB...",group:"Volume",call:"object.volume_import",refusal:`${K("Importing an OpenVDB volume","CANCELLED, with nothing created")} This build also has no OpenVDB at all (\`bpy.app.build_options.openvdb\` is False), so a file would not be read even with a picker.`},{kind:"volume.empty",label:"Empty",group:"Volume",call:"object.volume_add"},{kind:"grease-pencil.blank",label:"Blank",group:"Grease Pencil",call:"object.grease_pencil_add, type='EMPTY'"},{kind:"grease-pencil.stroke",label:"Stroke",group:"Grease Pencil",call:"object.grease_pencil_add, type='STROKE'"},{kind:"grease-pencil.monkey",label:"Monkey",group:"Grease Pencil",call:"object.grease_pencil_add, type='MONKEY'"},{kind:"grease-pencil.lineart-scene",label:"Scene Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_SCENE'",separatorBefore:!0},{kind:"grease-pencil.lineart-collection",label:"Collection Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_COLLECTION'"},{kind:"grease-pencil.lineart-object",label:"Object Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_OBJECT'"},{kind:"armature",label:"Armature",group:null,call:"object.armature_add"},{kind:"lattice.lattice",label:"Lattice",group:"Lattice",call:"object.add, type='LATTICE'"},{kind:"lattice.deform-selected",label:"Lattice Deform Selected",group:"Lattice",call:"object.lattice_add_to_selected"},{kind:"empty.plain-axes",label:"Plain Axes",group:"Empty",call:"object.empty_add, type='PLAIN_AXES'"},{kind:"empty.arrows",label:"Arrows",group:"Empty",call:"object.empty_add, type='ARROWS'"},{kind:"empty.single-arrow",label:"Single Arrow",group:"Empty",call:"object.empty_add, type='SINGLE_ARROW'"},{kind:"empty.circle",label:"Circle",group:"Empty",call:"object.empty_add, type='CIRCLE'"},{kind:"empty.cube",label:"Cube",group:"Empty",call:"object.empty_add, type='CUBE'"},{kind:"empty.sphere",label:"Sphere",group:"Empty",call:"object.empty_add, type='SPHERE'"},{kind:"empty.cone",label:"Cone",group:"Empty",call:"object.empty_add, type='CONE'"},{kind:"image.reference",label:"Reference...",group:"Image",call:"object.empty_image_add, background=False",refusal:K("A reference image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.background",label:"Background...",group:"Image",call:"object.empty_image_add, background=True",refusal:K("A background image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.mesh-plane",label:"Mesh Plane...",group:"Image",call:"image.import_as_mesh_planes",refusal:K("An image as a mesh plane","CANCELLED, with nothing created")},{kind:"image.empty-image",label:"Empty Image",group:"Image",call:"object.empty_add, type='IMAGE'"},{kind:"light.point",label:"Point",group:"Light",call:"object.light_add, type='POINT'"},{kind:"light.sun",label:"Sun",group:"Light",call:"object.light_add, type='SUN'"},{kind:"light.spot",label:"Spot",group:"Light",call:"object.light_add, type='SPOT'"},{kind:"light.area",label:"Area",group:"Light",call:"object.light_add, type='AREA'"},{kind:"light-probe.sphere",label:"Sphere",group:"Light Probe",call:"object.lightprobe_add, type='SPHERE'"},{kind:"light-probe.plane",label:"Plane",group:"Light Probe",call:"object.lightprobe_add, type='PLANE'"},{kind:"light-probe.volume",label:"Volume",group:"Light Probe",call:"object.lightprobe_add, type='VOLUME'"},{kind:"camera",label:"Camera",group:null,call:"object.camera_add"},{kind:"speaker",label:"Speaker",group:null,call:"object.speaker_add"},{kind:"force-field.force",label:"Force",group:"Force Field",call:"object.effector_add, type='FORCE'"},{kind:"force-field.wind",label:"Wind",group:"Force Field",call:"object.effector_add, type='WIND'"},{kind:"force-field.vortex",label:"Vortex",group:"Force Field",call:"object.effector_add, type='VORTEX'"},{kind:"force-field.magnetic",label:"Magnetic",group:"Force Field",call:"object.effector_add, type='MAGNET'"},{kind:"force-field.harmonic",label:"Harmonic",group:"Force Field",call:"object.effector_add, type='HARMONIC'"},{kind:"force-field.charge",label:"Charge",group:"Force Field",call:"object.effector_add, type='CHARGE'"},{kind:"force-field.lennard-jones",label:"Lennard-Jones",group:"Force Field",call:"object.effector_add, type='LENNARDJ'"},{kind:"force-field.texture",label:"Texture",group:"Force Field",call:"object.effector_add, type='TEXTURE'"},{kind:"force-field.curve-guide",label:"Curve Guide",group:"Force Field",call:"object.effector_add, type='GUIDE'"},{kind:"force-field.boid",label:"Boid",group:"Force Field",call:"object.effector_add, type='BOID'"},{kind:"force-field.turbulence",label:"Turbulence",group:"Force Field",call:"object.effector_add, type='TURBULENCE'"},{kind:"force-field.drag",label:"Drag",group:"Force Field",call:"object.effector_add, type='DRAG'"},{kind:"force-field.fluid-flow",label:"Fluid Flow",group:"Force Field",call:"object.effector_add, type='FLUID'"}],mt="collection-instance:";function ht(){const t=new Map;for(const a of X().byId.values()){if(a.type!=="TSE_LAYER_COLLECTION")continue;const o=a.data;o===void 0||!o.startsWith("bpy.data.collections[")||t.has(a.name)||t.set(a.name,{kind:`${mt}${a.name}`,label:a.name,group:"Collection Instance",call:`object.collection_instance_add, collection=${V(a.name)}`})}return[...t.values()]}function Z(){return[...ft,...ht()]}function gt(t){const[a,...o]=t.call.split(", ");return`bpy.ops.${a}(${o.join(", ")})`}function V(t){return JSON.stringify(t)}const _t={"curve.primitive_bezier_circle_add":"Add Bézier Circle","curve.primitive_bezier_curve_add":"Add Bézier","curve.primitive_nurbs_circle_add":"Add Nurbs Circle","curve.primitive_nurbs_curve_add":"Add Nurbs Curve","curve.primitive_nurbs_path_add":"Add Path","image.import_as_mesh_planes":"Import Images as Planes","mesh.primitive_circle_add":"Add Circle","mesh.primitive_cone_add":"Add Cone","mesh.primitive_cube_add":"Add Cube","mesh.primitive_cylinder_add":"Add Cylinder","mesh.primitive_grid_add":"Add Grid","mesh.primitive_ico_sphere_add":"Add Ico Sphere","mesh.primitive_monkey_add":"Add Monkey","mesh.primitive_plane_add":"Add Plane","mesh.primitive_torus_add":"Add Torus","mesh.primitive_uv_sphere_add":"Add UV Sphere","object.armature_add":"Add Armature","object.camera_add":"Add Camera","object.collection_add":"Add to Collection","object.collection_instance_add":"Add Collection Instance","object.constraint_add":"Add Constraint","object.curves_empty_hair_add":"Add Empty Curves","object.curves_random_add":"Add Random Curves","object.data_instance_add":"Add Object Data Instance","object.delete":"Delete","object.duplicate":"Duplicate Objects","object.effector_add":"Add Effector","object.empty_add":"Add Empty","object.empty_image_add":"Add Empty Image/Drop Image to Empty","object.grease_pencil_add":"Add Grease Pencil","object.grease_pencil_dash_modifier_segment_add":"Add Segment","object.grease_pencil_time_modifier_segment_add":"Add Segment","object.lattice_add_to_selected":"Add Lattice Deformer","object.light_add":"Add Light","object.lightprobe_add":"Add Light Probe","object.location_clear":"Clear Location","object.material_slot_add":"Add Material Slot","object.metaball_add":"Add Metaball","object.modifier_add":"Add Modifier","object.origin_set":"Set Origin","object.particle_system_add":"Add Particle System Slot","object.pointcloud_random_add":"Add Point Cloud","object.quick_fur":"Quick Fur","object.rotation_clear":"Clear Rotation","object.scale_clear":"Clear Scale","object.shaderfx_add":"Add Effect","object.shape_key_add":"Add Shape Key","object.speaker_add":"Add Speaker","object.text_add":"Add Text","object.transform_apply":"Apply Object Transform","object.vertex_group_add":"Add Vertex Group","object.volume_add":"Add Volume","object.volume_import":"Import OpenVDB Volume","surface.primitive_nurbs_surface_circle_add":"Add Surface Circle","surface.primitive_nurbs_surface_curve_add":"Add Surface Curve","surface.primitive_nurbs_surface_cylinder_add":"Add Surface Cylinder","surface.primitive_nurbs_surface_sphere_add":"Add Surface Sphere","surface.primitive_nurbs_surface_surface_add":"Add Surface Patch","surface.primitive_nurbs_surface_torus_add":"Add Surface Torus"};function jt(t){const a=/bpy\.ops\.([a-z_]+\.[a-z0-9_]+)\(/.exec(t)?.[1];return a===void 0?void 0:_t[a]}async function z(t,a){const o=["before = {o.name for o in bpy.data.objects}",t,"made = [o.name for o in bpy.data.objects if o.name not in before]",'print("\\n".join(made))'].join(`
|
|
1
|
+
import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{j3 as Ie,bt as Ce,r as B,bv as Te,fN as H,bB as F,bC as U,hR as De,bA as Pe,j4 as Be,bK as $e,bq as be,bn as Ve,j5 as Ge,j6 as pe,j7 as He,j8 as We,j9 as ze,ja as fe,bs as me,bp as Ue}from"./index-DaRQxpdW.js";import{c as Ke,a as Y}from"./blender-runtime-skin-ClXU_pYv.js";import{r as m}from"./index-nmcBqr7Y.js";import{u as qe,v as J,k as X,w as Q,x as Ye,y as oe,t as he,z as Je,A as Xe,B as ge,C as Qe,D as te,E as Ze,F as et,G as tt,H as rt,I as nt}from"./blender-runtime-host-BfAWl8jZ.js";import{r as ot}from"./index-CtzuWnCS.js";import{a as at}from"./three-contract-Dkt6PmWY.js";import{b as W,o as re}from"./viewport-door-DGEfF1wj.js";import{s as lt,a as st}from"./object3d-document-session-registry-C19aZYMr.js";import{d9 as it}from"./three.core-3arARmh6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./LineSegments2-DN9pUfWA.js";import"./three.module-BLhyNg0e.js";import"./preview-renderer-BrYNFV1p.js";import"./environment-Dg-YaLsA.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./renderer-ownership-BovSEcLv.js";import"./output-pass-HurwNl0G.js";import"./Pass-D1MRT672.js";import"./clip-planes-CnAI6DZn.js";import"./content-bounds-_3L42iZv.js";import"./hierarchy-marks-CmVlgczH.js";import"./workspace-arrangement-BD3sTZSQ.js";function Oe(t){const a=Number.isFinite(t)&&t>0?t:50;return{degrees:2*Math.atan(72/(2*a))*180/Math.PI,axis:"larger"}}Ie("model",{camera:{fov:Oe(50),opening:[.8187,.4458,.3617]},interaction:{bootTool:"select",boxSelect:"touch"},all:{lighting:{source:"studio",studioPreset:Ce.id,auto:null,tone:{mapper:"none",exposure:1}},xray:{enabled:!1,alpha:.5}},modes:{wireframe:{xray:{enabled:!0,alpha:0}},preview:{lighting:{source:"preview",auto:null,preview:{sceneLights:!1,sun:{enabled:!1},environment:{enabled:!0,image:"blender:forest",energy:1,rotation:0}},tone:{mapper:"agx",exposure:1}},backdrop:{source:"fill"}},rendered:{lighting:{source:"scene",auto:null,tone:{mapper:"agx",exposure:1}},backdrop:{source:"scene"}}},overlays:{selection:{origins:!0}},world:{upAxis:"z"}});function ct(t){return`blender-${t.toLowerCase().replace(/_/g,"-")}`}function P(t){return t?.type==="TSE_SOME_ID"&&t.struct==="Object"&&t.object!==void 0}function _e(t){if(t.struct)return t.struct}function je(t,a){return{id:t.id,label:t.name,role:"entity",kind:ct(t.icon),..._e(t)?{typeLabel:_e(t)}:{},parentId:a,childIds:t.children.map(o=>o.id),defaultExpanded:t.expanded}}const dt={transform:!0,inspectorFields:!1,persist:!0},ee=new Set;let Ae=0;const ae=new Set;function ye(){queueMicrotask(()=>{Ae++;for(const t of ae)t()})}function ut(t){return ae.add(t),()=>{ae.delete(t)}}function ve(){return Ae}function bt(t){for(const a of ee)if(a.documentId===t||a.documentId===`object3d-document:${t}`)return a;return ee.values().next().value??null}const pt=()=>({position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]});function Se(t,a){t.updateWorldMatrix(!0,!1);const o=a.matrixWorld.clone().invert().multiply(t.matrixWorld).elements;return[[o[0],o[1],o[2],o[3]],[o[4],o[5],o[6],o[7]],[o[8],o[9],o[10],o[11]],[o[12],o[13],o[14],o[15]]]}function K(t,a){return`${t} needs a file, and this editor has no door to ask for one: the host's file door (\`EditorHost.files\`, \`@volter/editor-sdk/host\`) reads and writes project-relative paths and has no file-picker member, so there is nothing to open the workbench's own dialog through. Blender's row opens a file browser; run without one, the engine answers "${a}".`}const ft=[{kind:"mesh.plane",label:"Plane",group:"Mesh",call:"mesh.primitive_plane_add"},{kind:"mesh.cube",label:"Cube",group:"Mesh",call:"mesh.primitive_cube_add"},{kind:"mesh.circle",label:"Circle",group:"Mesh",call:"mesh.primitive_circle_add"},{kind:"mesh.uv-sphere",label:"UV Sphere",group:"Mesh",call:"mesh.primitive_uv_sphere_add"},{kind:"mesh.ico-sphere",label:"Ico Sphere",group:"Mesh",call:"mesh.primitive_ico_sphere_add"},{kind:"mesh.cylinder",label:"Cylinder",group:"Mesh",call:"mesh.primitive_cylinder_add"},{kind:"mesh.cone",label:"Cone",group:"Mesh",call:"mesh.primitive_cone_add"},{kind:"mesh.torus",label:"Torus",group:"Mesh",call:"mesh.primitive_torus_add"},{kind:"mesh.grid",label:"Grid",group:"Mesh",call:"mesh.primitive_grid_add",separatorBefore:!0},{kind:"mesh.monkey",label:"Monkey",group:"Mesh",call:"mesh.primitive_monkey_add"},{kind:"curve.bezier",label:"Bézier",group:"Curve",call:"curve.primitive_bezier_curve_add"},{kind:"curve.bezier-circle",label:"Circle",group:"Curve",call:"curve.primitive_bezier_circle_add"},{kind:"curve.nurbs-curve",label:"Nurbs Curve",group:"Curve",call:"curve.primitive_nurbs_curve_add",separatorBefore:!0},{kind:"curve.nurbs-circle",label:"Nurbs Circle",group:"Curve",call:"curve.primitive_nurbs_circle_add"},{kind:"curve.path",label:"Path",group:"Curve",call:"curve.primitive_nurbs_path_add"},{kind:"curve.empty-hair",label:"Empty Hair",group:"Curve",call:"object.curves_empty_hair_add",separatorBefore:!0},{kind:"curve.fur",label:"Fur",group:"Curve",call:"object.quick_fur"},{kind:"surface.nurbs-curve",label:"Nurbs Curve",group:"Surface",call:"surface.primitive_nurbs_surface_curve_add"},{kind:"surface.nurbs-circle",label:"Nurbs Circle",group:"Surface",call:"surface.primitive_nurbs_surface_circle_add"},{kind:"surface.nurbs-surface",label:"Nurbs Surface",group:"Surface",call:"surface.primitive_nurbs_surface_surface_add"},{kind:"surface.nurbs-cylinder",label:"Nurbs Cylinder",group:"Surface",call:"surface.primitive_nurbs_surface_cylinder_add"},{kind:"surface.nurbs-sphere",label:"Nurbs Sphere",group:"Surface",call:"surface.primitive_nurbs_surface_sphere_add"},{kind:"surface.nurbs-torus",label:"Nurbs Torus",group:"Surface",call:"surface.primitive_nurbs_surface_torus_add"},{kind:"metaball.ball",label:"Ball",group:"Metaball",call:"object.metaball_add, type='BALL'"},{kind:"metaball.capsule",label:"Capsule",group:"Metaball",call:"object.metaball_add, type='CAPSULE'"},{kind:"metaball.plane",label:"Plane",group:"Metaball",call:"object.metaball_add, type='PLANE'"},{kind:"metaball.ellipsoid",label:"Ellipsoid",group:"Metaball",call:"object.metaball_add, type='ELLIPSOID'"},{kind:"metaball.cube",label:"Cube",group:"Metaball",call:"object.metaball_add, type='CUBE'"},{kind:"text",label:"Text",group:null,call:"object.text_add"},{kind:"point-cloud",label:"Point Cloud",group:null,call:"object.pointcloud_random_add"},{kind:"volume.import",label:"Import OpenVDB...",group:"Volume",call:"object.volume_import",refusal:`${K("Importing an OpenVDB volume","CANCELLED, with nothing created")} This build also has no OpenVDB at all (\`bpy.app.build_options.openvdb\` is False), so a file would not be read even with a picker.`},{kind:"volume.empty",label:"Empty",group:"Volume",call:"object.volume_add"},{kind:"grease-pencil.blank",label:"Blank",group:"Grease Pencil",call:"object.grease_pencil_add, type='EMPTY'"},{kind:"grease-pencil.stroke",label:"Stroke",group:"Grease Pencil",call:"object.grease_pencil_add, type='STROKE'"},{kind:"grease-pencil.monkey",label:"Monkey",group:"Grease Pencil",call:"object.grease_pencil_add, type='MONKEY'"},{kind:"grease-pencil.lineart-scene",label:"Scene Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_SCENE'",separatorBefore:!0},{kind:"grease-pencil.lineart-collection",label:"Collection Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_COLLECTION'"},{kind:"grease-pencil.lineart-object",label:"Object Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_OBJECT'"},{kind:"armature",label:"Armature",group:null,call:"object.armature_add"},{kind:"lattice.lattice",label:"Lattice",group:"Lattice",call:"object.add, type='LATTICE'"},{kind:"lattice.deform-selected",label:"Lattice Deform Selected",group:"Lattice",call:"object.lattice_add_to_selected"},{kind:"empty.plain-axes",label:"Plain Axes",group:"Empty",call:"object.empty_add, type='PLAIN_AXES'"},{kind:"empty.arrows",label:"Arrows",group:"Empty",call:"object.empty_add, type='ARROWS'"},{kind:"empty.single-arrow",label:"Single Arrow",group:"Empty",call:"object.empty_add, type='SINGLE_ARROW'"},{kind:"empty.circle",label:"Circle",group:"Empty",call:"object.empty_add, type='CIRCLE'"},{kind:"empty.cube",label:"Cube",group:"Empty",call:"object.empty_add, type='CUBE'"},{kind:"empty.sphere",label:"Sphere",group:"Empty",call:"object.empty_add, type='SPHERE'"},{kind:"empty.cone",label:"Cone",group:"Empty",call:"object.empty_add, type='CONE'"},{kind:"image.reference",label:"Reference...",group:"Image",call:"object.empty_image_add, background=False",refusal:K("A reference image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.background",label:"Background...",group:"Image",call:"object.empty_image_add, background=True",refusal:K("A background image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.mesh-plane",label:"Mesh Plane...",group:"Image",call:"image.import_as_mesh_planes",refusal:K("An image as a mesh plane","CANCELLED, with nothing created")},{kind:"image.empty-image",label:"Empty Image",group:"Image",call:"object.empty_add, type='IMAGE'"},{kind:"light.point",label:"Point",group:"Light",call:"object.light_add, type='POINT'"},{kind:"light.sun",label:"Sun",group:"Light",call:"object.light_add, type='SUN'"},{kind:"light.spot",label:"Spot",group:"Light",call:"object.light_add, type='SPOT'"},{kind:"light.area",label:"Area",group:"Light",call:"object.light_add, type='AREA'"},{kind:"light-probe.sphere",label:"Sphere",group:"Light Probe",call:"object.lightprobe_add, type='SPHERE'"},{kind:"light-probe.plane",label:"Plane",group:"Light Probe",call:"object.lightprobe_add, type='PLANE'"},{kind:"light-probe.volume",label:"Volume",group:"Light Probe",call:"object.lightprobe_add, type='VOLUME'"},{kind:"camera",label:"Camera",group:null,call:"object.camera_add"},{kind:"speaker",label:"Speaker",group:null,call:"object.speaker_add"},{kind:"force-field.force",label:"Force",group:"Force Field",call:"object.effector_add, type='FORCE'"},{kind:"force-field.wind",label:"Wind",group:"Force Field",call:"object.effector_add, type='WIND'"},{kind:"force-field.vortex",label:"Vortex",group:"Force Field",call:"object.effector_add, type='VORTEX'"},{kind:"force-field.magnetic",label:"Magnetic",group:"Force Field",call:"object.effector_add, type='MAGNET'"},{kind:"force-field.harmonic",label:"Harmonic",group:"Force Field",call:"object.effector_add, type='HARMONIC'"},{kind:"force-field.charge",label:"Charge",group:"Force Field",call:"object.effector_add, type='CHARGE'"},{kind:"force-field.lennard-jones",label:"Lennard-Jones",group:"Force Field",call:"object.effector_add, type='LENNARDJ'"},{kind:"force-field.texture",label:"Texture",group:"Force Field",call:"object.effector_add, type='TEXTURE'"},{kind:"force-field.curve-guide",label:"Curve Guide",group:"Force Field",call:"object.effector_add, type='GUIDE'"},{kind:"force-field.boid",label:"Boid",group:"Force Field",call:"object.effector_add, type='BOID'"},{kind:"force-field.turbulence",label:"Turbulence",group:"Force Field",call:"object.effector_add, type='TURBULENCE'"},{kind:"force-field.drag",label:"Drag",group:"Force Field",call:"object.effector_add, type='DRAG'"},{kind:"force-field.fluid-flow",label:"Fluid Flow",group:"Force Field",call:"object.effector_add, type='FLUID'"}],mt="collection-instance:";function ht(){const t=new Map;for(const a of X().byId.values()){if(a.type!=="TSE_LAYER_COLLECTION")continue;const o=a.data;o===void 0||!o.startsWith("bpy.data.collections[")||t.has(a.name)||t.set(a.name,{kind:`${mt}${a.name}`,label:a.name,group:"Collection Instance",call:`object.collection_instance_add, collection=${V(a.name)}`})}return[...t.values()]}function Z(){return[...ft,...ht()]}function gt(t){const[a,...o]=t.call.split(", ");return`bpy.ops.${a}(${o.join(", ")})`}function V(t){return JSON.stringify(t)}const _t={"curve.primitive_bezier_circle_add":"Add Bézier Circle","curve.primitive_bezier_curve_add":"Add Bézier","curve.primitive_nurbs_circle_add":"Add Nurbs Circle","curve.primitive_nurbs_curve_add":"Add Nurbs Curve","curve.primitive_nurbs_path_add":"Add Path","image.import_as_mesh_planes":"Import Images as Planes","mesh.primitive_circle_add":"Add Circle","mesh.primitive_cone_add":"Add Cone","mesh.primitive_cube_add":"Add Cube","mesh.primitive_cylinder_add":"Add Cylinder","mesh.primitive_grid_add":"Add Grid","mesh.primitive_ico_sphere_add":"Add Ico Sphere","mesh.primitive_monkey_add":"Add Monkey","mesh.primitive_plane_add":"Add Plane","mesh.primitive_torus_add":"Add Torus","mesh.primitive_uv_sphere_add":"Add UV Sphere","object.armature_add":"Add Armature","object.camera_add":"Add Camera","object.collection_add":"Add to Collection","object.collection_instance_add":"Add Collection Instance","object.constraint_add":"Add Constraint","object.curves_empty_hair_add":"Add Empty Curves","object.curves_random_add":"Add Random Curves","object.data_instance_add":"Add Object Data Instance","object.delete":"Delete","object.duplicate":"Duplicate Objects","object.effector_add":"Add Effector","object.empty_add":"Add Empty","object.empty_image_add":"Add Empty Image/Drop Image to Empty","object.grease_pencil_add":"Add Grease Pencil","object.grease_pencil_dash_modifier_segment_add":"Add Segment","object.grease_pencil_time_modifier_segment_add":"Add Segment","object.lattice_add_to_selected":"Add Lattice Deformer","object.light_add":"Add Light","object.lightprobe_add":"Add Light Probe","object.location_clear":"Clear Location","object.material_slot_add":"Add Material Slot","object.metaball_add":"Add Metaball","object.modifier_add":"Add Modifier","object.origin_set":"Set Origin","object.particle_system_add":"Add Particle System Slot","object.pointcloud_random_add":"Add Point Cloud","object.quick_fur":"Quick Fur","object.rotation_clear":"Clear Rotation","object.scale_clear":"Clear Scale","object.shaderfx_add":"Add Effect","object.shape_key_add":"Add Shape Key","object.speaker_add":"Add Speaker","object.text_add":"Add Text","object.transform_apply":"Apply Object Transform","object.vertex_group_add":"Add Vertex Group","object.volume_add":"Add Volume","object.volume_import":"Import OpenVDB Volume","surface.primitive_nurbs_surface_circle_add":"Add Surface Circle","surface.primitive_nurbs_surface_curve_add":"Add Surface Curve","surface.primitive_nurbs_surface_cylinder_add":"Add Surface Cylinder","surface.primitive_nurbs_surface_sphere_add":"Add Surface Sphere","surface.primitive_nurbs_surface_surface_add":"Add Surface Patch","surface.primitive_nurbs_surface_torus_add":"Add Surface Torus"};function jt(t){const a=/bpy\.ops\.([a-z_]+\.[a-z0-9_]+)\(/.exec(t)?.[1];return a===void 0?void 0:_t[a]}async function z(t,a){const o=["before = {o.name for o in bpy.data.objects}",t,"made = [o.name for o in bpy.data.objects if o.name not in before]",'print("\\n".join(made))'].join(`
|
|
2
2
|
`),i=await te(o,!0,a??jt(t));return i.error!==null?{made:[],error:i.error}:{made:i.result.split(`
|
|
3
3
|
`).map(p=>p.trim()).filter(p=>p.length>0),error:null}}async function yt(t,a){const o=[`_sel = {${t.map(V).join(", ")}}`,"_vl = bpy.context.view_layer","for _o in _vl.objects:"," _o.select_set(_o.name in _sel)",a===null?"_vl.objects.active = None":`_vl.objects.active = bpy.data.objects.get(${V(a)})`].join(`
|
|
4
4
|
`),i=await te(o,!1);i.error!==null&&B().console.error(`Blender refused the selection write: ${i.error}`,"blender-outliner")}async function ne(t,a){if(t.length===0)return{destination:"Nothing is selected, so there was nothing to run it on.",persisted:!1};const o=[`targets = [bpy.data.objects[n] for n in [${t.map(V).join(", ")}]]`,"with bpy.context.temp_override(selected_objects=targets, selected_editable_objects=targets, active_object=targets[0], object=targets[0]):",` ${a}`].join(`
|
package/dist/assets/{blender-screenshot.menu-D3yZwxi6.js → blender-screenshot.menu-wvAjkf8o.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,t as n}from"./index-
|
|
1
|
+
import{r as s,t as n}from"./index-DaRQxpdW.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const w="workspace.menu",b={menu:"window",items:[{id:"blender-save-screenshot-editor",label:"Save Screenshot (Editor)…",testId:"menu-save-screenshot-editor",execute:async()=>{const e=s(),t=await e.documents.captureActive();n(t.base64);const o=`screenshots/screenshot-${new Date().toISOString().replace(/[:.]/g,"-")}.png`;await e.files.write(o,Uint8Array.from(atob(t.base64),r=>r.charCodeAt(0))),e.console.log(`Saved the screenshot to ${o}.`,"blender-screenshot")}}]};export{b as menu,w as point};
|