@volter/game-editor 0.5.87 → 0.5.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/BUNDLED_NOTICES +22 -22
  2. package/catalog/entries/blender.json +2 -2
  3. package/catalog/entries/music.json +2 -2
  4. package/dist/.vite/manifest.json +2111 -2111
  5. package/dist/assets/{AssetBudgetPanel-D0x2TPPy.js → AssetBudgetPanel-DzURBeos.js} +3 -3
  6. package/dist/assets/{AudioViewer-7fv2_fIl.js → AudioViewer-Bjv_IoEK.js} +1 -1
  7. package/dist/assets/{CanvasBoardDocument-BUQYVz1c.js → CanvasBoardDocument-BGQ7YLW7.js} +1 -1
  8. package/dist/assets/{CanvasSceneViewport-TaZbM0Uh.js → CanvasSceneViewport-zDjY0paV.js} +1 -1
  9. package/dist/assets/{ColorInput-28XnXD8Q.js → ColorInput-CuQY7Ukq.js} +1 -1
  10. package/dist/assets/{EntityModelDocument-BQrvx0KQ.js → EntityModelDocument-Ci2gTM0_.js} +1 -1
  11. package/dist/assets/{EnvironmentAssetDocument-C5PRXs6G.js → EnvironmentAssetDocument-sGeD9CmA.js} +1 -1
  12. package/dist/assets/{GameplaySessionTimeline-Dm7lYtRi.js → GameplaySessionTimeline-BOP2Rzca.js} +1 -1
  13. package/dist/assets/{ImageViewer-CxnMTLaT.js → ImageViewer-BcGUTWQl.js} +1 -1
  14. package/dist/assets/InspectorObjectPreview-DmfoiHtC.js +1 -0
  15. package/dist/assets/{JsonAssetDocument-CcbpdU55.js → JsonAssetDocument-Xr6gjvcn.js} +1 -1
  16. package/dist/assets/{LiveModuleDocument-0Y2ulK7n.js → LiveModuleDocument-9cuyXCj5.js} +1 -1
  17. package/dist/assets/{LutAssetDocument-CRDeRQAX.js → LutAssetDocument-Bsha8T14.js} +1 -1
  18. package/dist/assets/{ModelAssetDocument-ncfazuj_.js → ModelAssetDocument-7R43ez0l.js} +1 -1
  19. package/dist/assets/{NonThreeAuthoringBootstrap-CDUdubAw.js → NonThreeAuthoringBootstrap-wLP33ygR.js} +1 -1
  20. package/dist/assets/{Object3DDocumentToolbar-C1YPcedp.js → Object3DDocumentToolbar-CIq-prtb.js} +1 -1
  21. package/dist/assets/Object3DDocumentViewport-5UbfDYx0.js +2 -0
  22. package/dist/assets/{Object3DPreview-XQ6au59A.js → Object3DPreview-4vfSYgvf.js} +1 -1
  23. package/dist/assets/{OnlineAssetDetail-Dq7qIQlJ.js → OnlineAssetDetail-BPVmIMPQ.js} +1 -1
  24. package/dist/assets/{PlayBar-Bv5GHcPD.js → PlayBar-BvBQdixl.js} +1 -1
  25. package/dist/assets/{QuarksAssetDocument-DYm3hBv_.js → QuarksAssetDocument-NerGNPg0.js} +1 -1
  26. package/dist/assets/{ReactCanvasControls-Dp4Mrlcc.js → ReactCanvasControls-SptIZCBm.js} +1 -1
  27. package/dist/assets/{RootSelectionOverlay-cQHen-VZ.js → RootSelectionOverlay-D7sUM12Z.js} +1 -1
  28. package/dist/assets/{ShaderAssetDocument-C7kkzHkA.js → ShaderAssetDocument-DEt0lzyh.js} +1 -1
  29. package/dist/assets/{ShadowEditor-PJ_mLUFF.js → ShadowEditor-CuWsWRr6.js} +1 -1
  30. package/dist/assets/{SourceAssetViewer-DgOFkYF8.js → SourceAssetViewer-MYdqpyCb.js} +1 -1
  31. package/dist/assets/StageHost-CiSH61U_.js +2 -0
  32. package/dist/assets/{StoryPreviewMount-BgEpExfI.js → StoryPreviewMount-CfSy0VwU.js} +1 -1
  33. package/dist/assets/{ThreeBoardDocument-BuRk6Y48.js → ThreeBoardDocument-CtUpkbIn.js} +2 -2
  34. package/dist/assets/{ThreeIsolationSceneContent-DFuMyzKv.js → ThreeIsolationSceneContent-BYYWnbjH.js} +1 -1
  35. package/dist/assets/{ToolObject3DPreview-Cp8p3a28.js → ToolObject3DPreview-OBfMBUDF.js} +1 -1
  36. package/dist/assets/{Toolbar-vKOFpei3.js → Toolbar-CxS4bdaI.js} +1 -1
  37. package/dist/assets/{TransientHint-C5KuaIRn.js → TransientHint-D61eMqKf.js} +1 -1
  38. package/dist/assets/{VideoViewer-DUUQ1ea_.js → VideoViewer-CipXVi35.js} +1 -1
  39. package/dist/assets/{ViewportShadingMenu-T8V04Ys6.js → ViewportShadingMenu-DTn7jMyb.js} +1 -1
  40. package/dist/assets/{active-ingest-pGqBlJ3x.js → active-ingest-LYjpgY9a.js} +2 -2
  41. package/dist/assets/{animation-clock-BTHwjILC.js → animation-clock-BcjKnlWY.js} +1 -1
  42. package/dist/assets/{animation-mixers.service-DeVSjWCQ.js → animation-mixers.service-DlJoI9HX.js} +1 -1
  43. package/dist/assets/{animation-timeline.utility-BDxeS3S6.js → animation-timeline.utility-BU8dSrf_.js} +1 -1
  44. package/dist/assets/{asset-budget-asset.menu-DeXFc_i4.js → asset-budget-asset.menu-B8IP-Hc9.js} +1 -1
  45. package/dist/assets/{asset-budget.action-ahMeLSui.js → asset-budget.action-C4kmlL33.js} +1 -1
  46. package/dist/assets/{asset-budget.document-KWIkUTsV.js → asset-budget.document-C9UTBsOF.js} +1 -1
  47. package/dist/assets/{asset-budget.menu-Cqqi1SeP.js → asset-budget.menu-B-iPbxew.js} +1 -1
  48. package/dist/assets/{asset-editor-persistence-DXkf1Ont.js → asset-editor-persistence-BRnb4jvT.js} +1 -1
  49. package/dist/assets/{asset-loaders-CbVPGx4H.js → asset-loaders-C3GABpnY.js} +1 -1
  50. package/dist/assets/{asset-preview-CzxD7k3P.js → asset-preview-C_0EqGmT.js} +1 -1
  51. package/dist/assets/{audio-unlock.service-GcroL0E_.js → audio-unlock.service-BptKOQO1.js} +1 -1
  52. package/dist/assets/{audio.utility-C4N50YHj.js → audio.utility-DCWEdoWy.js} +1 -1
  53. package/dist/assets/autoplay.service-D_fRasDc.js +1 -0
  54. package/dist/assets/{babylon-authoring-adapter-BOmSvh08.js → babylon-authoring-adapter-CACBsDlN.js} +1 -1
  55. package/dist/assets/{binding-resolver-DJANjeUb.js → binding-resolver-BU_WvMpR.js} +2 -2
  56. package/dist/assets/{blender-emscripten-engine-3RrRUwov.js → blender-emscripten-engine-CbHHZuUu.js} +1 -1
  57. package/dist/assets/{blender-node-editor.document-YYmUWtFG.js → blender-node-editor.document-QB62WBX4.js} +1 -1
  58. package/dist/assets/{blender-properties-tab-D80eJbBQ.js → blender-properties-tab-BD_ERulO.js} +1 -1
  59. package/dist/assets/{blender-runtime-host-Bn0epPY3.js → blender-runtime-host-DpyeRB-e.js} +2 -2
  60. package/dist/assets/{blender-runtime-skin-Cn0ASAMa.js → blender-runtime-skin-B-KaOx39.js} +2 -2
  61. package/dist/assets/blender-runtime.document-CTLsZn-9.js +12 -0
  62. package/dist/assets/{blender-screenshot.menu-G1T9yHAS.js → blender-screenshot.menu-DcgjDXya.js} +1 -1
  63. package/dist/assets/{blender-timeline.document-CAGoSZu5.js → blender-timeline.document-C7-UEVr2.js} +1 -1
  64. package/dist/assets/{blender-uv-editor.document-DYPUZcpl.js → blender-uv-editor.document-lclK5qPX.js} +1 -1
  65. package/dist/assets/{blender-version.status-DsVsMeQK.js → blender-version.status-DZv7eV2U.js} +1 -1
  66. package/dist/assets/{blender-wali-engine-DGwF1KiV.js → blender-wali-engine-uH9q2l3f.js} +1 -1
  67. package/dist/assets/{blender.command-CcERMUCW.js → blender.command-BjHEelMQ.js} +1 -1
  68. package/dist/assets/{board-guides-00sD4eH-.js → board-guides-BA6WCb96.js} +1 -1
  69. package/dist/assets/{bridge.command-CMoJfehR.js → bridge.command-CUhxGpj2.js} +3 -3
  70. package/dist/assets/{browserAll-11QAfzPK.js → browserAll-EMydKylk.js} +1 -1
  71. package/dist/assets/{build-player.document-DsUvuNEg.js → build-player.document-DF_n7mCc.js} +1 -1
  72. package/dist/assets/{build-profiles.document-Dplz6cEh.js → build-profiles.document-BGmStXtV.js} +1 -1
  73. package/dist/assets/{build-progress.status-DcyAYfmg.js → build-progress.status-BNYV8dLT.js} +1 -1
  74. package/dist/assets/{build-session-B1kjCtLl.js → build-session-Dfo6ygXA.js} +1 -1
  75. package/dist/assets/{build.action-DkF5EN9B.js → build.action-DyzZR4nY.js} +1 -1
  76. package/dist/assets/{build.command-BPqTTSKN.js → build.command-D1dxLByR.js} +1 -1
  77. package/dist/assets/{build.header-f8Tr7zEY.js → build.header-Dd4Vfzk5.js} +1 -1
  78. package/dist/assets/{build.menu-DLaEv9N7.js → build.menu-haq0aE0s.js} +1 -1
  79. package/dist/assets/{build.service-Dy6AryUr.js → build.service-C0PLYrGi.js} +1 -1
  80. package/dist/assets/{camera-8sZjiQAG.js → camera-BQnvv5fW.js} +1 -1
  81. package/dist/assets/{camera-runtime.inspector-DZZS6sNs.js → camera-runtime.inspector-DY8V2BIf.js} +1 -1
  82. package/dist/assets/{canvas-design-mount-BVYzxXv8.js → canvas-design-mount-BHkK0LpO.js} +3 -3
  83. package/dist/assets/{canvas-entry-runtime-DjWxb-E0.js → canvas-entry-runtime-0dJpA53a.js} +2 -2
  84. package/dist/assets/{canvas-preview-frames-BrQTpJQz.js → canvas-preview-frames-BFWsz9nA.js} +1 -1
  85. package/dist/assets/{canvas-story-capture.service-BAkinpiS.js → canvas-story-capture.service-DkK9YEBa.js} +2 -2
  86. package/dist/assets/{capability-coverage-B6O--La7.js → capability-coverage-LbU4Sxnt.js} +1 -1
  87. package/dist/assets/{collaboration-presence-cP5Ts934.js → collaboration-presence-B_rzt_Ua.js} +1 -1
  88. package/dist/assets/{collider-54zqlTON.js → collider-ByI7A54k.js} +1 -1
  89. package/dist/assets/{component-board.service-DDeBE2OE.js → component-board.service-BpDTVVAI.js} +2 -2
  90. package/dist/assets/{component-board.service-DhZt21fj.js → component-board.service-C0oYmE9t.js} +2 -2
  91. package/dist/assets/{component-board.service-D0VCR7cX.js → component-board.service-DtE1d9v1.js} +2 -2
  92. package/dist/assets/{component-contracts.service-Dc6K48l4.js → component-contracts.service-FqaewMKQ.js} +1 -1
  93. package/dist/assets/{component-instance-root-DdBt03jn.js → component-instance-root-BNr-40yw.js} +1 -1
  94. package/dist/assets/{component-verbs.command-DLa5nz3l.js → component-verbs.command-DGDMOsdk.js} +1 -1
  95. package/dist/assets/{component-verbs.service-B84g803c.js → component-verbs.service-C1NY4Sth.js} +1 -1
  96. package/dist/assets/{config-zfLGOjWb.js → config-BNYp1dbK.js} +2 -2
  97. package/dist/assets/{configurations-CGDwLMu_.js → configurations-WH5EPk8d.js} +1 -1
  98. package/dist/assets/{connection.status-BFzCWtq1.js → connection.status-hDer8RHe.js} +1 -1
  99. package/dist/assets/{constraints.inspector-CXekv0Vm.js → constraints.inspector-DCDUNzXi.js} +1 -1
  100. package/dist/assets/{content-bounds-CI1FWjZr.js → content-bounds-DMLXg0Ob.js} +1 -1
  101. package/dist/assets/{contract-system-adapters-jyRyHuQ8.js → contract-system-adapters-CsMtQANL.js} +1 -1
  102. package/dist/assets/{coverage.service-D4yN5TY8.js → coverage.service-DkOf3jFn.js} +1 -1
  103. package/dist/assets/{create-runtime-BjLMBQRi.js → create-runtime-A9IjDY9I.js} +1 -1
  104. package/dist/assets/{curve-DSNbckBp.js → curve-DOpfSq5v.js} +1 -1
  105. package/dist/assets/{data-asset-BKaaE_1L.js → data-asset-CNGL3WNY.js} +1 -1
  106. package/dist/assets/{data-ref-DncjB-QD.js → data-ref-CZlj4K6p.js} +1 -1
  107. package/dist/assets/{debug-bridge-BPhia8r7.js → debug-bridge-C2ydYYkR.js} +1 -1
  108. package/dist/assets/{debug-registry-C9Ke9_60.js → debug-registry-SleqbaS2.js} +1 -1
  109. package/dist/assets/{deferred-ingest-play-PPRnQWUC.js → deferred-ingest-play-BSFkfZKQ.js} +2 -2
  110. package/dist/assets/{design-time-canvas-mount-74odEa7g.js → design-time-canvas-mount-D65uuYQ7.js} +2 -2
  111. package/dist/assets/{design-time-layers-Ct04Hsts.js → design-time-layers-q1BaQsMZ.js} +1 -1
  112. package/dist/assets/{design-time-mount.service-BTAbxIOm.js → design-time-mount.service-BZXwHkG9.js} +2 -2
  113. package/dist/assets/{design-time-mount.service-Dvf8zkqu.js → design-time-mount.service-D6XPrjMo.js} +2 -2
  114. package/dist/assets/{design-time-react-mount-ZZj-ooUP.js → design-time-react-mount-C7V61i4j.js} +1 -1
  115. package/dist/assets/{document-preview-three-qv-LfRMg.js → document-preview-three-C7Lqobxp.js} +1 -1
  116. package/dist/assets/{dom-authoring-adapter-CuDSWSNb.js → dom-authoring-adapter-COdzQqK7.js} +1 -1
  117. package/dist/assets/{draco3d-B6aUXg6s.js → draco3d-iz9iYVwt.js} +1 -1
  118. package/dist/assets/{edit-mode-audio.service-BKoUB-tG.js → edit-mode-audio.service-BQwXzUX5.js} +1 -1
  119. package/dist/assets/{edit-mode-authoring-D81aayTm.js → edit-mode-authoring-yRPEq3c6.js} +1 -1
  120. package/dist/assets/{edit-mode-networking.service-DFB5C5ba.js → edit-mode-networking.service-VQu-oNGR.js} +1 -1
  121. package/dist/assets/{editor-api-DSvaYurK.js → editor-api-DkYQ4Mf7.js} +1 -1
  122. package/dist/assets/{editor-layers-CBGpXUff.js → editor-layers-psmpPtJ8.js} +1 -1
  123. package/dist/assets/{editor-shell-store-qkVBJ5hp.js → editor-shell-store-CLsRck8r.js} +1 -1
  124. package/dist/assets/{entity-object-DkwEzWRw.js → entity-object-CI5Ws16u.js} +1 -1
  125. package/dist/assets/{extend-CLTmKGid.js → extend-CVyU45KC.js} +1 -1
  126. package/dist/assets/{fork-menu-zClJ54w5.js → fork-menu-fgKUSFoA.js} +1 -1
  127. package/dist/assets/{frame-debugger-store-BBnS81lf.js → frame-debugger-store-C4h48Lk1.js} +1 -1
  128. package/dist/assets/{game-contract-seams-CQ6ox7EM.js → game-contract-seams-CtyMWXL3.js} +1 -1
  129. package/dist/assets/{game-css-scope-transform-CN_8Qjng.js → game-css-scope-transform-BRD7WElK.js} +1 -1
  130. package/dist/assets/{game-document.service-BMfUUdBk.js → game-document.service-5xW7XyMV.js} +1 -1
  131. package/dist/assets/{game-eval.command-DjPaPh0W.js → game-eval.command-BsdLCKBs.js} +1 -1
  132. package/dist/assets/{game-module-access-Dqt4Iyj9.js → game-module-access-DzeZ8taf.js} +1 -1
  133. package/dist/assets/{game-network-rU8CiVS9.js → game-network-BadWSUYT.js} +3 -3
  134. package/dist/assets/{gameplay-export-CvuSZBqw.js → gameplay-export-CzpOG_fP.js} +1 -1
  135. package/dist/assets/{gameplay-replay-DN_8e-mL.js → gameplay-replay-CiA4AIid.js} +1 -1
  136. package/dist/assets/{gameplay.command-feHlbPUd.js → gameplay.command-D34pNEIv.js} +1 -1
  137. package/dist/assets/{generation-jobs-ktwK3BpH.js → generation-jobs-DXPVDHPe.js} +1 -1
  138. package/dist/assets/{generation.service-CCk8hp9U.js → generation.service-D-v4Kboa.js} +1 -1
  139. package/dist/assets/{generations-CLxU3M32.js → generations-D4MdQolQ.js} +1 -1
  140. package/dist/assets/{generations.status-DNuE1Jbz.js → generations.status-CnpAZzCw.js} +1 -1
  141. package/dist/assets/{hierarchy-marks-jS62BeX5.js → hierarchy-marks-BUeQ6to3.js} +1 -1
  142. package/dist/assets/{hosted-asset-materialization-s3VISszg.js → hosted-asset-materialization-e4G0wAK4.js} +1 -1
  143. package/dist/assets/{index-SFPYv_SM.js → index-6ys6rxaj.js} +1 -1
  144. package/dist/assets/{index-CvsX-Yba.js → index-BUSnq0Z6.js} +1 -1
  145. package/dist/assets/{index-BmMDCu1J.js → index-BV1zcaKy.js} +1 -1
  146. package/dist/assets/{index-BkJMq17U.js → index-C5D8xjRu.js} +1 -1
  147. package/dist/assets/{index-BrB0Nhz0.js → index-C6GLGVwl.js} +1 -1
  148. package/dist/assets/{index-C-AbcRfU.js → index-D34RCuxS.js} +1 -1
  149. package/dist/assets/{index-DMLiFNqS.js → index-DAZrOXB3.js} +1 -1
  150. package/dist/assets/{index-D9mY4HWY.js → index-DBIFLhzt.js} +8 -8
  151. package/dist/assets/{index-D6w_9PlP.js → index-DouvpS6-.js} +2 -2
  152. package/dist/assets/{inference-diagnostics-A5B9gTUw.js → inference-diagnostics-CDR3DmKF.js} +1 -1
  153. package/dist/assets/{ingest-boot-viewport-BLsKtCr1.js → ingest-boot-viewport-BTBeKgzE.js} +1 -1
  154. package/dist/assets/{ingest-siblings-BzP3xOiB.js → ingest-siblings-Cj7VEwcy.js} +1 -1
  155. package/dist/assets/{ingest-source-persistence-BThzUuxZ.js → ingest-source-persistence-Bfhu6YfK.js} +1 -1
  156. package/dist/assets/{ingest.service-BWOTrTci.js → ingest.service-BU4np-aB.js} +1 -1
  157. package/dist/assets/{inspect-Dq9Josls.js → inspect-Ddg78nmj.js} +1 -1
  158. package/dist/assets/instances.command-eYwh5Dyr.js +1 -0
  159. package/dist/assets/{json-history-resource-9PueHFpl.js → json-history-resource-DFBTBtzt.js} +1 -1
  160. package/dist/assets/{layered-pick-0Okyt-XO.js → layered-pick-C0UzN9rC.js} +1 -1
  161. package/dist/assets/{light-BwkhC5IX.js → light-DglaQiPf.js} +1 -1
  162. package/dist/assets/{live-project-verbs-SDUR-zvs.js → live-project-verbs-CJ_zDSoA.js} +1 -1
  163. package/dist/assets/{machine.document-B5CwoKNt.js → machine.document-DKgl-HxK.js} +1 -1
  164. package/dist/assets/{machines.finder-BvxeCFhA.js → machines.finder-rzKrqf0P.js} +1 -1
  165. package/dist/assets/{material-CSVfeUuo.js → material-BtLdoiM1.js} +1 -1
  166. package/dist/assets/{material-factory-QE9DFL5K.js → material-factory-DVTrr57P.js} +1 -1
  167. package/dist/assets/{mesh-Bo_sjmdD.js → mesh-Dg-hqV4U.js} +1 -1
  168. package/dist/assets/{model-asset-sections.service-930QHt1S.js → model-asset-sections.service-Dz77qWhH.js} +1 -1
  169. package/dist/assets/{model-inspection-DPzXOOlc.js → model-inspection-BajTg63P.js} +1 -1
  170. package/dist/assets/{model-thumbnail-h7btiG_9.js → model-thumbnail-DQHRVOqE.js} +1 -1
  171. package/dist/assets/{models.finder-MCvsYYwL.js → models.finder-Jhy7YA-r.js} +1 -1
  172. package/dist/assets/{module-mode-BgMcHcSF.js → module-mode-B4YjyMYv.js} +2 -2
  173. package/dist/assets/{mount-canvas-ingest-root-CBRh2FuY.js → mount-canvas-ingest-root-XkqClzbU.js} +2 -2
  174. package/dist/assets/{mount-dom-ingest-root-Cjd8PL36.js → mount-dom-ingest-root-witYuq5g.js} +2 -2
  175. package/dist/assets/{mount-ingest-root-CZsGJYhm.js → mount-ingest-root-DeA7CLzy.js} +2 -2
  176. package/dist/assets/{mount-manifest-ExL3lRP3.js → mount-manifest-ivMktbkB.js} +1 -1
  177. package/dist/assets/{mount-three-ingest-root-Cd03g4Dp.js → mount-three-ingest-root-BmDUnQow.js} +1 -1
  178. package/dist/assets/{mounted-authoring-0w9-bjZS.js → mounted-authoring-zPVxiKxa.js} +1 -1
  179. package/dist/assets/{mounted-story-viewport-source-dan_Vkgv.js → mounted-story-viewport-source-ByPTlo40.js} +1 -1
  180. package/dist/assets/{native-debug-module-DmU0unhp.js → native-debug-module-DEIj-ml1.js} +1 -1
  181. package/dist/assets/{navigation-Bc9nb-uQ.js → navigation-Yf3zwolr.js} +1 -1
  182. package/dist/assets/{navmesh.menu-D1QrM_-o.js → navmesh.menu-CaH6tdbH.js} +1 -1
  183. package/dist/assets/{navmesh.service-CLOjMejZ.js → navmesh.service-qPZ8sHuM.js} +1 -1
  184. package/dist/assets/network-observer.service-BGd1BMED.js +1 -0
  185. package/dist/assets/{network.utility-zwrDmtd_.js → network.utility-DCa1vV7t.js} +1 -1
  186. package/dist/assets/{object3d-document-session-registry-PR4Yulm3.js → object3d-document-session-registry-DYr6Iepm.js} +2 -2
  187. package/dist/assets/{oid-transform-C2fzvPah.js → oid-transform-DP9nPVMY.js} +1 -1
  188. package/dist/assets/{particles-CHbu-G1Q.js → particles-HwlzQnli.js} +1 -1
  189. package/dist/assets/{pixi-authoring-adapter-9s9JpXqj.js → pixi-authoring-adapter-CQVwY0mw.js} +1 -1
  190. package/dist/assets/{pixi-live-write-target-PTG8VADy.js → pixi-live-write-target-B0CUAzvW.js} +1 -1
  191. package/dist/assets/{play.command-BR_Yo82K.js → play.command-CSYsCbbE.js} +2 -2
  192. package/dist/assets/{presentation-2yyoHrBo.js → presentation-1SZXKXRj.js} +1 -1
  193. package/dist/assets/{product-Uo-d2MPf.js → product-CF4E_r6C.js} +1 -1
  194. package/dist/assets/{profiler.action-CvDYE5cW.js → profiler.action-BIvAZOpX.js} +1 -1
  195. package/dist/assets/{profiler.menu-B66yUdVF.js → profiler.menu-B-IVHBPz.js} +1 -1
  196. package/dist/assets/{profiler.utility-5fF94exR.js → profiler.utility-CKeHA3jm.js} +1 -1
  197. package/dist/assets/{project-authoring-session-DvpmSYet.js → project-authoring-session-d1SmjQh8.js} +2 -2
  198. package/dist/assets/{properties-bone-constraints.inspector-DBRuBJ33.js → properties-bone-constraints.inspector-C1nbUxby.js} +1 -1
  199. package/dist/assets/{properties-bone.inspector-CfK2l-bJ.js → properties-bone.inspector-B4CVy1PL.js} +1 -1
  200. package/dist/assets/{properties-collection.inspector-LFWBWYfs.js → properties-collection.inspector-BAb5XRrg.js} +1 -1
  201. package/dist/assets/{properties-constraints.inspector-DPokGobY.js → properties-constraints.inspector-CTi1QOaJ.js} +1 -1
  202. package/dist/assets/{properties-data.inspector-CNBOZiDY.js → properties-data.inspector-Bu4Um-vv.js} +1 -1
  203. package/dist/assets/{properties-material.inspector-kPZWt_rK.js → properties-material.inspector-CakxEoQj.js} +1 -1
  204. package/dist/assets/{properties-modifiers.inspector-DKRESmSW.js → properties-modifiers.inspector-ClQMHVFK.js} +1 -1
  205. package/dist/assets/{properties-object.inspector-ax0-g3BA.js → properties-object.inspector-C1Ab-w33.js} +1 -1
  206. package/dist/assets/{properties-output.inspector-DOEOcZsy.js → properties-output.inspector-Dcu8lb8C.js} +1 -1
  207. package/dist/assets/{properties-particles.inspector-CQI00oYh.js → properties-particles.inspector-Dfs-ZBpE.js} +1 -1
  208. package/dist/assets/{properties-physics.inspector-DA6-7mMn.js → properties-physics.inspector-Ce4mMWzM.js} +1 -1
  209. package/dist/assets/{properties-render.inspector-Bv3snYNC.js → properties-render.inspector-DWri-DTC.js} +1 -1
  210. package/dist/assets/{properties-scene.inspector-B1ksacVC.js → properties-scene.inspector-BSNjU00G.js} +1 -1
  211. package/dist/assets/{properties-texture.inspector-BLxK7oXf.js → properties-texture.inspector-DnH7CwRl.js} +1 -1
  212. package/dist/assets/{properties-view-layer.inspector-DY9u7Fpy.js → properties-view-layer.inspector-B19cZc6X.js} +1 -1
  213. package/dist/assets/{properties-world.inspector-tmQPQ_g6.js → properties-world.inspector-BSt8WRSj.js} +1 -1
  214. package/dist/assets/{r3f-design-session-BV6GpTxq.js → r3f-design-session-DqKrI14b.js} +2 -2
  215. package/dist/assets/{r3f-physics-binding-iNCeJZwd.js → r3f-physics-binding-CoSwbmVM.js} +1 -1
  216. package/dist/assets/{r3f-source-authoring-adapter-Bzera0C7.js → r3f-source-authoring-adapter-BG3vhahx.js} +1 -1
  217. package/dist/assets/{react-canvas-navigation-UK_BMgIh.js → react-canvas-navigation-DoPpWrKL.js} +1 -1
  218. package/dist/assets/{react-inspector.service-4wPq1GWF.js → react-inspector.service-CrqYw3Jb.js} +1 -1
  219. package/dist/assets/{react-story-board-C4NAg1lF.js → react-story-board-DOAfFP3M.js} +1 -1
  220. package/dist/assets/{react-three-rapier.esm-fDJrAP5J.js → react-three-rapier.esm-BAEEeUsU.js} +1 -1
  221. package/dist/assets/{react-world-authoring-adapter-DPCvrFSd.js → react-world-authoring-adapter-DArpj4xo.js} +1 -1
  222. package/dist/assets/{realm-services-Ca4lSqMJ.js → realm-services-qj234a0C.js} +1 -1
  223. package/dist/assets/{reflection-probe-capture.inspector-7miikRuQ.js → reflection-probe-capture.inspector-DQTWUver.js} +1 -1
  224. package/dist/assets/{registry-FkWo9b5Y.js → registry-CHxUhnK7.js} +1 -1
  225. package/dist/assets/{relative-import-specifier-IIDPACUn.js → relative-import-specifier-CCwfBo2s.js} +1 -1
  226. package/dist/assets/{render-env-D0PPvYFc.js → render-env-B5TZmt31.js} +1 -1
  227. package/dist/assets/{render-features-ep0qUnew.js → render-features-B8bt5hFs.js} +1 -1
  228. package/dist/assets/{render-settings-BTkn8WQP.js → render-settings-D7S62Nwc.js} +1 -1
  229. package/dist/assets/{resolve-three-CuV3phZY.js → resolve-three-CXRmbpha.js} +3 -3
  230. package/dist/assets/{root-seam-contract-Bnxtdl5s.js → root-seam-contract-Rc5I2-cn.js} +1 -1
  231. package/dist/assets/{run-selection-deRqeYOX.js → run-selection-v_KGXaMz.js} +1 -1
  232. package/dist/assets/{scene-capture-aB8WVI9e.js → scene-capture-D4xR-bOK.js} +1 -1
  233. package/dist/assets/{scene-document.service-C1ZS_ibm.js → scene-document.service-B4alF5qm.js} +2 -2
  234. package/dist/assets/{scene-framing-BAZ4vw1j.js → scene-framing-DFvmwkrW.js} +1 -1
  235. package/dist/assets/{seeded-random-CwE1f6qb.js → seeded-random-z3KAs46E.js} +1 -1
  236. package/dist/assets/{session-kSIjcXJT.js → session-kTroQqmY.js} +19 -0
  237. package/dist/assets/{setup-renderer-DPkC1cFW.js → setup-renderer-BZFzQu0R.js} +1 -1
  238. package/dist/assets/{source-object3d-authoring-adapter-a_OLVl70.js → source-object3d-authoring-adapter-CzJdhhwn.js} +1 -1
  239. package/dist/assets/{source-persistence-backend-C5Gwhj0u.js → source-persistence-backend-CNNtYr-8.js} +1 -1
  240. package/dist/assets/{stage-keyboard-Dx7_k-Wa.js → stage-keyboard-7_1scYGH.js} +1 -1
  241. package/dist/assets/{stage-overlay-set-CvBJVuHr.js → stage-overlay-set-BdCP3eMw.js} +1 -1
  242. package/dist/assets/{stage-presence-markers-DOcpLmDw.js → stage-presence-markers-DT5j8fjP.js} +1 -1
  243. package/dist/assets/{stage-transform-tools-Cl_ltUkU.js → stage-transform-tools-i3ajje5q.js} +1 -1
  244. package/dist/assets/{standard-viewport-dressing-Dk79QHkl.js → standard-viewport-dressing-BfmTiIR4.js} +1 -1
  245. package/dist/assets/{state-watch.action-DnUgK57Q.js → state-watch.action-B2f1FDbM.js} +1 -1
  246. package/dist/assets/{state-watch.menu-D6yJ2ajq.js → state-watch.menu-BlXPZu9x.js} +1 -1
  247. package/dist/assets/{state-watch.utility-Bd1_ckSi.js → state-watch.utility-v0OIiOK5.js} +1 -1
  248. package/dist/assets/{story-capture-CdblyPkl.js → story-capture-DAZ6UX6l.js} +1 -1
  249. package/dist/assets/{story-documents-Cl5_DGOO.js → story-documents-skwdip6D.js} +1 -1
  250. package/dist/assets/{story-documents.service-5S-t2VA6.js → story-documents.service-14jxNb7v.js} +1 -1
  251. package/dist/assets/{story-documents.service-BG3kxdaA.js → story-documents.service-DsiGg2Wu.js} +1 -1
  252. package/dist/assets/{story-media-presence-C0ANS1oT.js → story-media-presence-Cjm_WU4H.js} +1 -1
  253. package/dist/assets/{story-pixi-preview-CMwV6H-J.js → story-pixi-preview-BfrC6Uip.js} +1 -1
  254. package/dist/assets/{story-presentation-C0eOpS5C.js → story-presentation-D2yF9kbW.js} +1 -1
  255. package/dist/assets/{story-three-preview-DI_zKDDq.js → story-three-preview-E2uJuH0p.js} +2 -2
  256. package/dist/assets/{studio-environment-tkipngTI.js → studio-environment-Kj8vdH82.js} +1 -1
  257. package/dist/assets/{surface-state-D2pDEwDu.js → surface-state-P-IhoubG.js} +1 -1
  258. package/dist/assets/{syntactic-prop-specs-FgPDDm9j.js → syntactic-prop-specs-DWKYi4Ib.js} +1 -1
  259. package/dist/assets/{team-playtest.service-LdRKOcl_.js → team-playtest.service-Da2I3-HT.js} +1 -1
  260. package/dist/assets/{three-DHXw9ma-.js → three-43Ky3-7O.js} +1 -1
  261. package/dist/assets/{three-authoring-adapter-O2lbHGpC.js → three-authoring-adapter-ChAme627.js} +1 -1
  262. package/dist/assets/three-authoring.service-CkS5Twej.js +2 -0
  263. package/dist/assets/{three-ingest-runtime-ByNriHPr.js → three-ingest-runtime-CsWe59E_.js} +1 -1
  264. package/dist/assets/{three-integration-DKfjgbTQ.js → three-integration-BG2YybqE.js} +2 -2
  265. package/dist/assets/three-integration.service-BxtSDKHH.js +1 -0
  266. package/dist/assets/{three-projection-core-BdssKHsg.js → three-projection-core-BKmXcOPL.js} +1 -1
  267. package/dist/assets/{three-state-DMGhb3kR.js → three-state-DnYP1ZtA.js} +1 -1
  268. package/dist/assets/{three-story-capture.service-0Ol3grw1.js → three-story-capture.service-DBEJS-XE.js} +2 -2
  269. package/dist/assets/{three-story-model-2DccXqHD.js → three-story-model-mOvJH3cm.js} +1 -1
  270. package/dist/assets/{three-viewport-presentation-CAUvCLK_.js → three-viewport-presentation-BHtVY2rJ.js} +1 -1
  271. package/dist/assets/{transform-mode-request-C__lyOsr.js → transform-mode-request-BuKv4Vre.js} +1 -1
  272. package/dist/assets/{transport-strip-CAIpxT3_.js → transport-strip-BmlKGYbk.js} +1 -1
  273. package/dist/assets/transport.header-B9Zj0jSD.js +1 -0
  274. package/dist/assets/{tuples-DkfP4uzY.js → tuples-BpJkRF4Y.js} +1 -1
  275. package/dist/assets/{ui-board-document-UJvS4sh4.js → ui-board-document-BVE1yfZS.js} +2 -2
  276. package/dist/assets/{user-data-CCbOet5N.js → user-data-FwfU1u6l.js} +1 -1
  277. package/dist/assets/{utility-view-state-BgaKdtXK.js → utility-view-state-C4KOJ6su.js} +1 -1
  278. package/dist/assets/{viewport-door-BAsTiZlJ.js → viewport-door-CQdsFqWV.js} +1 -1
  279. package/dist/assets/{viewport-root-presentation-Ck-Whc0J.js → viewport-root-presentation-CnkX7rnP.js} +1 -1
  280. package/dist/assets/{viewport-surface-status-BFEHA5hI.js → viewport-surface-status-_DF-oTje.js} +1 -1
  281. package/dist/assets/{webworkerAll-8G6Qnb-k.js → webworkerAll-CVRDBA6B.js} +1 -1
  282. package/dist/assets/{worker-BRY0I3XJ.js → worker-DLnISz0i.js} +1 -1
  283. package/dist/assets/{workspace-arrangement-BvdkrAj4.js → workspace-arrangement-B2HQOv9w.js} +1 -1
  284. package/dist/assets/{world-documents-Eb1WwqL0.js → world-documents-Bk_76qpi.js} +1 -1
  285. package/dist/assets/{world-root-stage-binding-BpN6rSfy.js → world-root-stage-binding-BBvT6Ll0.js} +1 -1
  286. package/dist/assets/{xstate-animation-binding-DChnwHzU.js → xstate-animation-binding-BU0uAeKC.js} +1 -1
  287. package/dist/assets/{xstate-animation-meta-CCAibHR5.js → xstate-animation-meta-DybNY6kD.js} +1 -1
  288. package/dist-node/cli.js +16 -16
  289. package/package.json +16 -16
  290. package/dist/assets/InspectorObjectPreview-DiEEGsLN.js +0 -1
  291. package/dist/assets/Object3DDocumentViewport-BADKGKhs.js +0 -2
  292. package/dist/assets/StageHost-BoFys0SE.js +0 -2
  293. package/dist/assets/autoplay.service-Da27q2rr.js +0 -1
  294. package/dist/assets/blender-runtime.document-CgNjacD9.js +0 -12
  295. package/dist/assets/instances.command-Bd6DWVvV.js +0 -1
  296. package/dist/assets/network-observer.service-UzN4E98-.js +0 -1
  297. package/dist/assets/three-authoring.service-C0w1UwZr.js +0 -2
  298. package/dist/assets/three-integration.service-B9y90uQa.js +0 -1
  299. package/dist/assets/transport.header-DakqnjMc.js +0 -1
@@ -1 +1 @@
1
- import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{r as $}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{eT as v,a6 as L,ho as N,bP as wt,aN as pt,hn as B,e_ as zt,bH as ut,a7 as X,iZ as ft,kZ as it,eG as Bt,hZ as ht,dV as Dt,aS as Ft}from"./index-D9mY4HWY.js";const Ht={full:{anchor:{left:0,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},top:{anchor:{left:0,top:0,right:1,bottom:0},offset:{left:0,top:0,right:0,bottom:0}},bottom:{anchor:{left:0,top:1,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},left:{anchor:{left:0,top:0,right:0,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},right:{anchor:{left:1,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},center:{anchor:{left:.5,top:.5,right:.5,bottom:.5},offset:{left:-60,top:-20,right:60,bottom:20}},"top-left":{anchor:{left:0,top:0,right:0,bottom:0},offset:{left:0,top:0,right:120,bottom:40}},"top-right":{anchor:{left:1,top:0,right:1,bottom:0},offset:{left:-120,top:0,right:0,bottom:40}}},mt=["flex-start","center","flex-end"],gt=["flex-start","center","flex-end"];function At({row:t,col:e,justify:n,align:r,isActive:a,disabled:s,onSelect:c}){return o.jsx("div",{"data-testid":`alignment-grid-${t}-${e}`,onClick:()=>{s||c(n,r)},style:{width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:s?"not-allowed":"pointer",borderRadius:v.radiusSmall,background:a?v.accent:"transparent"},children:o.jsx("div",{style:{width:a?6:4,height:a?6:4,borderRadius:"50%",background:a?v.onAccent:v.textMuted}})})}function ce({value:t,onChange:e,disabled:n}){const r=mt.indexOf(t.justify),a=gt.indexOf(t.align);return o.jsx("div",{"data-testid":"alignment-grid",style:{display:"inline-grid",gridTemplateColumns:"repeat(3, 16px)",gridTemplateRows:"repeat(3, 16px)",gap:1,background:v.inputBg,borderRadius:v.radiusMedium,padding:4,opacity:n?.35:1},children:gt.map((s,c)=>mt.map((l,u)=>o.jsx(At,{row:c,col:u,justify:l,align:s,isActive:c===a&&u===r,disabled:n,onSelect:(p,h)=>e({justify:p,align:h})},`${c}-${u}`)))})}function de({onSelect:t,disabled:e}){return o.jsx("div",{"data-testid":"anchor-presets",style:{display:"flex",flexWrap:"wrap",gap:4},children:Object.entries(Ht).map(([n,r])=>o.jsx(L,{type:"button",variant:"secondary",size:"compact","data-testid":`anchor-preset-${n}`,disabled:e,onClick:()=>t(n,r),children:n},n))})}function nt(t){let e=t.replace("#","");e.length===3&&(e=`${e[0]??"0"}${e[0]??"0"}${e[1]??"0"}${e[1]??"0"}${e[2]??"0"}${e[2]??"0"}`);const n=Number.parseInt(e,16);return[n>>16&255,n>>8&255,n&255]}function St(t,e,n){return`#${[t,e,n].map(r=>Math.round(Math.max(0,Math.min(255,r))).toString(16).padStart(2,"0")).join("")}`}function Q(t,e,n){const r=t/255,a=e/255,s=n/255,c=Math.max(r,a,s),l=Math.min(r,a,s),u=c-l;let p=0;u!==0&&(c===r?p=((a-s)/u%6+6)%6:c===a?p=(s-r)/u+2:p=(r-a)/u+4,p/=6);const h=c===0?0:u/c;return[p,h,c]}function K(t,e,n){const r=Math.floor(t*6),a=t*6-r,s=n*(1-e),c=n*(1-a*e),l=n*(1-(1-a)*e);let u=0,p=0,h=0;switch(r%6){case 0:u=n,p=l,h=s;break;case 1:u=c,p=n,h=s;break;case 2:u=s,p=n,h=l;break;case 3:u=s,p=c,h=n;break;case 4:u=l,p=s,h=n;break;case 5:u=n,p=s,h=c;break}return[Math.round(u*255),Math.round(p*255),Math.round(h*255)]}function kt(t,e,n){let r,a,s;if(e===0)r=a=s=n;else{const c=(p,h,d)=>{let b=d;return b<0&&(b+=1),b>1&&(b-=1),b<.16666666666666666?p+(h-p)*6*b:b<.5?h:b<.6666666666666666?p+(h-p)*(.6666666666666666-b)*6:p},l=n<.5?n*(1+e):n+e-n*e,u=2*n-l;r=c(u,l,t+1/3),a=c(u,l,t),s=c(u,l,t-1/3)}return[Math.round(r*255),Math.round(a*255),Math.round(s*255)]}function Pt(t,e,n){const r=t/255,a=e/255,s=n/255,c=Math.max(r,a,s),l=Math.min(r,a,s);let u=0,p=0;const h=(c+l)/2;if(c!==l){const d=c-l;p=h>.5?d/(2-c-l):d/(c+l),c===r?u=((a-s)/d+(a<s?6:0))/6:c===a?u=((s-r)/d+2)/6:u=((r-a)/d+4)/6}return[u,p,h]}function rt(t){if(t.startsWith("#")&&(t.length===4||t.length===7))return t;if(t.startsWith("#")&&t.length===9)return t.slice(0,7);const e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(e){const[,r,a,s]=e;return`#${[r??"0",a??"0",s??"0"].map(c=>Number.parseInt(c,10).toString(16).padStart(2,"0")).join("")}`}const n=t.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?/);if(n){const[r,a,s]=kt(Number.parseInt(n[1]??"0",10)/360,Number.parseInt(n[2]??"0",10)/100,Number.parseInt(n[3]??"0",10)/100);return St(r,a,s)}return"#000000"}function lt(t){const e=t.match(/rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);if(e?.[1])return Number.parseFloat(e[1]);const n=t.match(/hsla\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);return n?.[1]?Number.parseFloat(n[1]):t.startsWith("#")&&t.length===9?Number.parseInt(t.slice(7,9),16)/255:1}function xt(t,e,n,r,a){if(a==="hex"){const d=St(t,e,n);return r<1?`rgba(${t}, ${e}, ${n}, ${r.toFixed(2)})`:d}if(a==="rgb")return r<1?`rgba(${t}, ${e}, ${n}, ${r.toFixed(2)})`:`rgb(${t}, ${e}, ${n})`;const[s,c,l]=Pt(t,e,n),u=Math.round(s*360),p=Math.round(c*100),h=Math.round(l*100);return r<1?`hsla(${u}, ${p}%, ${h}%, ${r.toFixed(2)})`:`hsl(${u}, ${p}%, ${h}%)`}function Mt(t){const e=t.match(/\d+/g);return!e||e.length<3?"#000000":`#${[e[0]??"0",e[1]??"0",e[2]??"0"].map(n=>Number.parseInt(n,10).toString(16).padStart(2,"0")).join("")}`}const F=200,J=150,U=14;function Gt({value:t,onChange:e,onChangeEnd:n,onClose:r,recentColors:a,onAddRecentColor:s,eyedropperFallback:c,onEyedropperPick:l,disabled:u}){const p=rt(t),h=nt(p),[d,b]=$.useState(()=>Q(...h)),[m,i]=$.useState(()=>lt(t)),[f,g]=$.useState("hex"),[k,C]=$.useState(p),z=$.useRef(null),S=$.useRef(null),w=$.useRef(null),E=$.useRef(null),T=$.useRef(null),H=$.useCallback((x=d,y=m,j=f)=>{const[M,R,I]=K(x[0],x[1],x[2]);return xt(M,R,I,y,j)},[d,m,f]);$.useEffect(()=>{C(H())},[H]),$.useEffect(()=>{const x=S.current,y=x?.getContext("2d");if(!x||!y)return;const[j,M,R]=K(d[0],1,1),I=y.createLinearGradient(0,0,F,0);I.addColorStop(0,"#ffffff"),I.addColorStop(1,`rgb(${j},${M},${R})`),y.fillStyle=I,y.fillRect(0,0,F,J);const P=y.createLinearGradient(0,0,0,J);P.addColorStop(0,"rgba(0,0,0,0)"),P.addColorStop(1,"rgba(0,0,0,1)"),y.fillStyle=P,y.fillRect(0,0,F,J)},[d[0]]),$.useEffect(()=>{const x=w.current,y=x?.getContext("2d");if(!x||!y)return;const j=y.createLinearGradient(0,0,F,0);for(let M=0;M<=6;M++){const[R,I,P]=K(M/6,1,1);j.addColorStop(M/6,`rgb(${R},${I},${P})`)}y.fillStyle=j,y.fillRect(0,0,F,U)},[]),$.useEffect(()=>{const x=E.current,y=x?.getContext("2d");if(!x||!y)return;const j=4;for(let q=0;q<U;q+=j)for(let Z=0;Z<F;Z+=j)y.fillStyle=(Z/j+q/j)%2===0?"#ffffff":"#cccccc",y.fillRect(Z,q,j,j);const[M,R,I]=K(d[0],d[1],d[2]),P=y.createLinearGradient(0,0,F,0);P.addColorStop(0,`rgba(${M},${R},${I},0)`),P.addColorStop(1,`rgba(${M},${R},${I},1)`),y.fillStyle=P,y.fillRect(0,0,F,U)},[d]),$.useEffect(()=>{if(!r)return;function x(j){j.key==="Escape"&&r?.()}function y(j){z.current&&!z.current.contains(j.target)&&r?.()}return document.addEventListener("keydown",x),document.addEventListener("mousedown",y,!0),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",y,!0)}},[r]);const _=$.useCallback((x,y,j,M)=>{const R=y?.getBoundingClientRect();if(R)if(x==="sat"){const I=[d[0],ct(j,R.left,R.width),_t(M,R.top,R.height)];b(I),N({onChange:e},H(I))}else if(x==="hue"){const I=[ct(j,R.left,R.width),d[1],d[2]];b(I),N({onChange:e},H(I))}else{const I=Math.round(ct(j,R.left,R.width)*100)/100;i(I),N({onChange:e},H(d,I))}},[d,H,e]);$.useEffect(()=>{function x(j){const M=T.current;if(!M)return;j.preventDefault();const R=M==="sat"?S.current:M==="hue"?w.current:E.current;_(M,R,j.clientX,j.clientY)}function y(){if(T.current){T.current=null;const j=H();B({onChange:e,onChangeEnd:n},j),s?.(j)}}return window.addEventListener("mousemove",x),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",y)}},[_,H,e,n,s]);const D=(x,y)=>{u||(y.preventDefault(),T.current=x,_(x,y.currentTarget,y.clientX,y.clientY))},G=()=>{const x=k.trim(),y=Ot(x),j=y?{r:y[0],g:y[1],b:y[2],a:1}:Kt(x)??Ut(x);if(!j)return;b(Q(j.r,j.g,j.b)),i(j.a);const M=y?x:xt(j.r,j.g,j.b,j.a,f);N({onChange:e},M),B({onChange:e,onChangeEnd:n},M),s?.(M)},st=()=>{g(x=>x==="hex"?"rgb":x==="rgb"?"hsl":"hex")},O=typeof globalThis.EyeDropper=="function",at=x=>{const y=rt(x);b(Q(...nt(y))),i(lt(x)),N({onChange:e},x),B({onChange:e,onChangeEnd:n},x)},Ct=async()=>{if(O){try{const y=globalThis.EyeDropper,j=await new y().open();at(j.sRGBHex)}catch{}return}if(l){l(y=>{y&&at(y)});return}const x=c?.();x&&at(x)},[It,Lt,Tt]=K(d[0],d[1],d[2]),Nt=`rgba(${It},${Lt},${Tt},${m})`;return o.jsxs(wt,{ref:z,"data-testid":"inspector-color-picker",onMouseDown:x=>x.stopPropagation(),style:{padding:10,width:F+16,boxSizing:"border-box"},children:[o.jsx("canvas",{ref:S,"data-testid":"color-picker-sv",width:F,height:J,onMouseDown:x=>D("sat",x),style:{cursor:"crosshair",borderRadius:v.radiusSmall,display:"block"}}),o.jsx("canvas",{ref:w,"data-testid":"color-picker-hue",width:F,height:U,onMouseDown:x=>D("hue",x),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),o.jsx("canvas",{ref:E,"data-testid":"color-picker-alpha",width:F,height:U,onMouseDown:x=>D("alpha",x),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),o.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginTop:8},children:[o.jsx("div",{style:{width:22,height:22,borderRadius:v.radiusSmall,flexShrink:0,border:`1px solid ${v.border}`,background:Nt}}),o.jsx(pt,{type:"text","data-testid":"color-picker-text",value:k,onChange:x=>C(x.target.value),onKeyDown:x=>{x.key==="Enter"&&G()},onBlur:G,"data-density":"compact","data-monospace":"true",style:{flex:1}}),o.jsx(L,{type:"button",variant:"secondary",size:"compact","data-testid":"color-format-toggle",onClick:st,title:"Cycle color format",style:{flexShrink:0},children:f.toUpperCase()}),(O||c||l)&&o.jsx(L,{type:"button",variant:"secondary",size:"compact","data-testid":"color-picker-eyedropper",onClick:Ct,title:"Eyedropper",style:{flexShrink:0},children:"⌖"})]}),a&&a.length>0&&o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3,marginTop:8,paddingTop:6,borderTop:`1px solid ${v.border}`},children:a.map((x,y)=>o.jsx("div",{"data-testid":"color-picker-recent",onClick:()=>{const j=rt(x);b(Q(...nt(j))),i(lt(x)),N({onChange:e},x),B({onChange:e,onChangeEnd:n},x)},title:x,style:{width:16,height:16,borderRadius:v.radiusSmall,cursor:"pointer",background:x,border:`1px solid ${v.border}`}},`${x}-${y}`))})]})}function Y({label:t,value:e,onChange:n,onChangeEnd:r,recentColors:a,onAddRecentColor:s,eyedropperFallback:c,onEyedropperPick:l,disabled:u,testId:p}){const[h,d]=$.useState(!1),b=rt(e);return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,position:"relative"},children:[o.jsx("div",{"data-testid":p?`${p}-swatch`:"color-swatch",onClick:()=>{u||d(m=>!m)},style:{width:20,height:20,borderRadius:v.radiusSmall,flexShrink:0,background:b,border:`1px solid ${v.border}`,cursor:u?"not-allowed":"pointer"}}),t&&o.jsx("span",{style:{fontSize:10,color:v.textMuted,flexShrink:0},children:t}),h&&!u&&o.jsx("div",{style:{position:"absolute",zIndex:"var(--volter-z-dropdown)",top:"100%",left:0,marginTop:4},children:o.jsx(Gt,{value:e,onChange:n,onChangeEnd:r,onClose:()=>d(!1),recentColors:a,onAddRecentColor:s,eyedropperFallback:c,onEyedropperPick:l})})]})}function Et(t){return Math.max(0,Math.min(1,t))}function ct(t,e,n){return Et(n?(t-e)/n:0)}function _t(t,e,n){return Et(n?1-(t-e)/n:0)}function Ot(t){return/^#[0-9a-fA-F]{6}$/.test(t)?nt(t):null}function Kt(t){const e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!e)return null;const[,n,r,a,s]=e;return{r:Number.parseInt(n??"0",10),g:Number.parseInt(r??"0",10),b:Number.parseInt(a??"0",10),a:s?Number.parseFloat(s):1}}function Ut(t){const e=t.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?(?:,\s*([\d.]+))?\)/);if(!e)return null;const[,n,r,a,s]=e,[c,l,u]=kt(Number.parseInt(n??"0",10)/360,Number.parseInt(r??"0",10)/100,Number.parseInt(a??"0",10)/100);return{r:c,g:l,b:u,a:s?Number.parseFloat(s):1}}function A({label:t,value:e,unit:n="",step:r=1,min:a,max:s,precision:c,disabled:l,onChange:u,onChangeEnd:p,testId:h,style:d}){const b=$.useRef(null),m=c??(r<1?2:r>=100?-2:0),i=$.useMemo(()=>w=>{if(m<0){const T=10**-m;return Math.round(w/T)*T}const E=10**m;return Math.round(w*E)/E},[m]),f=w=>{let E=w;return a!==void 0&&(E=Math.max(a,E)),s!==void 0&&(E=Math.min(s,E)),i(E)},g=w=>{if(l)return;w.preventDefault(),b.current={startX:w.clientX,startValue:e,last:e},document.body.style.cursor="ew-resize";const E=D=>{if(!b.current)return;D.preventDefault();const G=D.clientX-b.current.startX,st=D.shiftKey?10:D.altKey?.1:1,O=f(b.current.startValue+G*r*st);b.current.last=O,N({onChange:u},O)},T=()=>{document.body.style.cursor="",window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",H),window.removeEventListener("keydown",_)},H=()=>{if(b.current){const D=b.current.last;b.current=null,B({onChange:u,onChangeEnd:p},D)}T()},_=D=>{if(D.key==="Escape"&&b.current){const G=f(b.current.startValue);b.current=null,N({onChange:u},G),B({onChange:u,onChangeEnd:p},G),T()}};window.addEventListener("mousemove",E),window.addEventListener("mouseup",H),window.addEventListener("keydown",_)},[k,C]=$.useState(null),z=$.useRef(!1),S=w=>{const E=Number.parseFloat(w);if(Number.isNaN(E))return;const T=f(E);T!==e&&B({onChange:u,onChangeEnd:p},T)};return o.jsxs("div",{style:{...zt,...d},children:[o.jsx("span",{className:"volter-scrub-label","data-testid":h?`${h}-label`:void 0,onMouseDown:g,"data-disabled":l||void 0,style:{fontSize:11,...l?{color:v.dynamic}:{},flexShrink:0,cursor:l?"not-allowed":"ew-resize",userSelect:"none",fontWeight:500},children:t}),o.jsx(pt,{"data-testid":h,type:"text",value:k??`${e}${n}`,readOnly:l,"data-dynamic":l||void 0,onFocus:w=>{C(`${e}${n}`),w.target.select()},onChange:w=>C(w.target.value),onBlur:w=>{z.current||S(w.target.value),z.current=!1,C(null)},onKeyDown:w=>{w.key==="Enter"&&w.target.blur(),w.key==="Escape"&&(z.current=!0,w.target.blur())},style:{flex:1,width:0}})]})}const bt=["none","solid","dashed","dotted","double"];function Wt(t){return{top:t,right:t,bottom:t,left:t}}function Xt(t){const e=r=>`${r.width}|${r.style}|${r.color}`,n=e(t.top);return e(t.right)===n&&e(t.bottom)===n&&e(t.left)===n}function pe({value:t,onChange:e,onChangeEnd:n,disabled:r,recentColors:a,onAddRecentColor:s}){const[c,l]=$.useState(!Xt(t)),u=(d,b)=>{const m={...t.top,...d},i=Wt(m);b?B({onChange:e,onChangeEnd:n},i):N({onChange:e},i)},p=(d,b,m)=>{const i={...t,[d]:{...t[d],...b}};m?B({onChange:e,onChangeEnd:n},i):N({onChange:e},i)};if(!c)return o.jsxs("div",{"data-testid":"border-editor-uniform",style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsx(Y,{testId:"border-color",value:t.top.color,disabled:r,onChange:d=>u({color:d},!1),onChangeEnd:d=>u({color:d},!0),recentColors:a,onAddRecentColor:s}),o.jsx(A,{testId:"border-width",label:"W",value:t.top.width,min:0,disabled:r,onChange:d=>u({width:d},!1),onChangeEnd:d=>u({width:d},!0),style:{width:64}}),o.jsx(ut,{className:"volter-select","data-testid":"border-style",value:t.top.style,disabled:r,"data-dynamic":r||void 0,onChange:d=>u({style:d.target.value},!0),style:{flex:1},children:bt.map(d=>o.jsx("option",{value:d,children:d},d))}),o.jsx(L,{type:"button","data-testid":"border-expand",title:"Per-side borders","aria-label":"Edit borders per side",onClick:()=>l(!0),variant:"ghost",size:"compact",children:o.jsx(X,{icon:ft})})]});const h=[{key:"top",label:"T"},{key:"right",label:"R"},{key:"bottom",label:"B"},{key:"left",label:"L"}];return o.jsxs("div",{"data-testid":"border-editor-expanded",style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{fontSize:10,color:v.textMuted},children:"Per-side"}),o.jsx("div",{style:{flex:1}}),o.jsx(L,{type:"button",variant:"primary",size:"compact","data-testid":"border-collapse",title:"Uniform border","aria-label":"Use one border for all sides",onClick:()=>l(!1),children:o.jsx(X,{icon:ft})})]}),h.map(({key:d,label:b})=>o.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx("span",{style:{fontSize:10,color:v.textMuted,width:10,textAlign:"center"},children:b}),o.jsx(Y,{testId:`border-${d}-color`,value:t[d].color,disabled:r,onChange:m=>p(d,{color:m},!1),onChangeEnd:m=>p(d,{color:m},!0),recentColors:a,onAddRecentColor:s}),o.jsx(A,{testId:`border-${d}-width`,label:"",value:t[d].width,min:0,disabled:r,onChange:m=>p(d,{width:m},!1),onChangeEnd:m=>p(d,{width:m},!0),style:{width:48}}),o.jsx(ut,{className:"volter-select","data-testid":`border-${d}-style`,value:t[d].style,disabled:r,"data-density":"compact","data-dynamic":r||void 0,onChange:m=>p(d,{style:m.target.value},!0),style:{flex:1},children:bt.map(m=>o.jsx("option",{value:m,children:m},m))})]},d))]})}function Vt(t){return{topLeft:t,topRight:t,bottomLeft:t,bottomRight:t}}function Yt(t){return t.topLeft===t.topRight&&t.topRight===t.bottomLeft&&t.bottomLeft===t.bottomRight}function ue({value:t,onChange:e,onChangeEnd:n,disabled:r}){const[a,s]=$.useState(!Yt(t)),c=(p,h)=>{const d=Vt(p);h?B({onChange:e,onChangeEnd:n},d):N({onChange:e},d)},l=(p,h,d)=>{const b={...t,[p]:h};d?B({onChange:e,onChangeEnd:n},b):N({onChange:e},b)};if(!a)return o.jsxs("div",{"data-testid":"border-radius-editor-uniform",style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx(A,{testId:"border-radius",label:o.jsx(X,{icon:it,label:"Radius"}),value:t.topLeft,min:0,disabled:r,onChange:p=>c(p,!1),onChangeEnd:p=>c(p,!0),style:{flex:1}}),o.jsx(L,{type:"button","data-testid":"border-radius-expand",title:"Independent corners","aria-label":"Edit radius per corner",onClick:()=>s(!0),variant:"ghost",size:"compact",children:o.jsx(X,{icon:it})})]});const u=[{key:"topLeft",label:"TL"},{key:"topRight",label:"TR"},{key:"bottomLeft",label:"BL"},{key:"bottomRight",label:"BR"}];return o.jsxs("div",{"data-testid":"border-radius-editor-expanded",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx("span",{style:{fontSize:10,color:v.textMuted},children:"Corners"}),o.jsx("div",{style:{flex:1}}),o.jsx(L,{type:"button",variant:"primary",size:"compact","data-testid":"border-radius-collapse",title:"Uniform radius","aria-label":"Use one radius for all corners",onClick:()=>s(!1),children:o.jsx(X,{icon:it})})]}),o.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:u.map(({key:p,label:h})=>o.jsx(A,{testId:`border-radius-${p}`,label:h,value:t[p],min:0,disabled:r,onChange:d=>l(p,d,!1),onChangeEnd:d=>l(p,d,!0)},p))})]})}const ot=[{name:"blur",unit:"px",min:0,max:50,step:.5,default:0},{name:"brightness",unit:"%",min:0,max:300,step:1,default:100},{name:"contrast",unit:"%",min:0,max:300,step:1,default:100},{name:"saturate",unit:"%",min:0,max:300,step:1,default:100},{name:"grayscale",unit:"%",min:0,max:100,step:1,default:0},{name:"hue-rotate",unit:"deg",min:0,max:360,step:1,default:0}];function fe(t){return!t||t==="none"?ot.map(e=>({name:e.name,value:e.default})):ot.map(e=>{const n=new RegExp(`${e.name}\\(([\\d.]+)${e.unit}?\\)`),r=t.match(n);return{name:e.name,value:r?.[1]?Number.parseFloat(r[1]):e.default}})}function he(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n],a=ot[n];r&&a&&r.value!==a.default&&e.push(`${r.name}(${r.value}${a.unit})`)}return e.length?e.join(" "):"none"}function me({value:t,onChange:e,onChangeEnd:n,disabled:r,label:a="Filter",testId:s="filter-editor"}){const c=(l,u,p)=>{const h=t.map((d,b)=>b===l?{...d,value:u}:d);p?B({onChange:e,onChangeEnd:n},h):N({onChange:e},h)};return o.jsxs("div",{"data-testid":s,children:[o.jsx("div",{style:{fontSize:9,color:v.textMuted,marginBottom:4},children:a}),t.map((l,u)=>{const p=ot[u];return p?o.jsx("div",{"data-testid":`filter-row-${l.name}`,style:{marginBottom:3},children:o.jsx(A,{testId:`filter-${l.name}`,label:l.name.replace("hue-rotate","hue"),value:l.value,unit:p.unit,min:p.min,max:p.max,step:p.step,disabled:r,onChange:h=>c(u,h,!1),onChangeEnd:h=>c(u,h,!0)})},l.name):null})]})}const W=28,yt=10;function ge({value:t,onChange:e,disabled:n,fonts:r,testId:a="font-picker"}){const[s,c]=$.useState(!1),[l,u]=$.useState(""),[p,h]=$.useState(0),d=$.useRef(null),b=$.useRef(null);$.useEffect(()=>{s&&b.current?.focus()},[s]),$.useEffect(()=>{if(!s)return;const S=w=>{d.current&&!d.current.contains(w.target)&&c(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[s]),$.useEffect(()=>{if(!s)return;const S=w=>{w.key==="Escape"&&c(!1)};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[s]);const m=$.useMemo(()=>{if(!l)return r;const S=l.toLowerCase();return r.filter(w=>w.toLowerCase().includes(S))},[r,l]),i=m.length*W,f=Math.floor(p/W),g=Math.min(m.length,f+yt+2),k=m.slice(f,g),C=S=>{e(S),c(!1),u("")},z=t.replace(/^["']|["']$/g,"");return o.jsxs("div",{ref:d,"data-testid":a,style:{position:"relative",flex:1},children:[o.jsxs(L,{type:"button",variant:"secondary",className:"volter-field-trigger","aria-haspopup":"listbox","aria-expanded":s,disabled:n,"data-testid":"font-picker-input",onClick:()=>{n||c(S=>!S)},children:[o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z||"—"}),o.jsx(Bt,{direction:"down",tone:"muted",style:{marginLeft:4}})]}),s&&o.jsxs(wt,{"data-testid":"font-picker-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:"var(--volter-z-dropdown)",marginTop:2},children:[o.jsx("div",{style:{padding:4},children:o.jsx(pt,{ref:b,type:"text","data-testid":"font-picker-search",value:l,onChange:S=>{u(S.target.value),h(0)},placeholder:"Search fonts…","data-density":"compact",style:{width:"100%",boxSizing:"border-box"}})}),o.jsx("div",{"data-testid":"font-picker-list",onScroll:S=>h(S.target.scrollTop),style:{maxHeight:yt*W,overflowY:"auto"},children:o.jsx("div",{style:{height:i,position:"relative"},children:k.map((S,w)=>{const E=f+w,T=S.toLowerCase()===z.toLowerCase();return o.jsx("div",{"data-testid":`font-picker-option-${S}`,onClick:()=>C(S),style:{position:"absolute",top:E*W,left:0,right:0,height:W,display:"flex",alignItems:"center",padding:"0 8px",cursor:"pointer",fontSize:12,background:T?v.accent:"transparent",color:T?v.onAccent:v.text},children:o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S})},S)})})}),m.length===0&&o.jsx("div",{style:{padding:"8px 12px",color:v.textMuted,fontSize:10,textAlign:"center"},children:"No matching fonts"})]})]})}function qt(t){const e=t.stops.map(n=>`${n.color} ${Math.round(n.position*100)}%`).join(", ");return t.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${t.angle}deg, ${e})`}function Zt(t){const e=t.match(/^linear-gradient\((.+)\)$/);if(e?.[1]!==void 0)return{type:"linear",inner:e[1]};const n=t.match(/^radial-gradient\((.+)\)$/);return n?.[1]!==void 0?{type:"radial",inner:n[1]}:null}function Qt(t){const e=t.match(/^(\d+)deg\s*,\s*/);if(e)return{angle:Number.parseInt(e[1]??"180",10),colorPart:t.slice(e[0].length)};if(t.startsWith("to ")){const n=t.match(/^to\s+\w+\s*,\s*/);if(n)return{angle:180,colorPart:t.slice(n[0].length)}}return{angle:180,colorPart:t}}function Jt(t){const e=t.split(/,\s*(?![^(]*\))/).map(n=>{const r=n.trim(),a=r.match(/\s+(\d+)%$/),s=a?Number.parseInt(a[1]??"0",10)/100:-1;return{color:a?r.slice(0,-a[0].length).trim():r,position:s}});for(let n=0;n<e.length;n++){const r=e[n];r&&r.position<0&&(r.position=e.length>1?n/(e.length-1):0)}return e}function xe(t){if(!t||t==="none")return null;const e=Zt(t);if(!e)return null;const{angle:n,colorPart:r}=e.type==="linear"?Qt(e.inner):{angle:180,colorPart:e.inner},a=Jt(r);return a.length<2?null:{type:e.type,angle:n,stops:a}}function dt({stops:t,selected:e,onSelect:n,onMove:r,disabled:a,testIdPrefix:s}){return o.jsx("div",{style:{position:"relative",height:12,marginTop:2},children:t.map((c,l)=>o.jsx("div",{"data-testid":`${s}-${l}`,onClick:()=>n(l),onMouseDown:u=>{if(a)return;u.preventDefault(),n(l);const h=u.target.parentElement?.getBoundingClientRect(),d=i=>h?.width?Math.max(0,Math.min(1,(i-h.left)/h.width)):c.position,b=i=>r(l,d(i.clientX),!1),m=i=>{r(l,d(i.clientX),!0),window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",m)};window.addEventListener("mousemove",b),window.addEventListener("mouseup",m)},style:{position:"absolute",left:`${c.position*100}%`,top:0,width:10,height:10,borderRadius:"50%",background:c.css,border:`2px solid ${l===e?v.accent:"#fff"}`,transform:"translateX(-50%)",cursor:a?"not-allowed":"pointer"}},l))})}function be({value:t,onChange:e,onChangeEnd:n,disabled:r,recentColors:a,onAddRecentColor:s,testId:c="gradient-editor"}){const[l,u]=$.useState(0),p=(f,g)=>{g?B({onChange:e,onChangeEnd:n},f):N({onChange:e},f)},h=(f,g,k)=>{const C=t.stops.map((z,S)=>S===f?{...z,...g}:z);p({...t,stops:C},k)},d=()=>{const f=t.stops[t.stops.length-1]?.position??1,g=t.stops[0]?.position??0,k=(f+g)/2,C=[...t.stops,{color:"#888888",position:k}].sort((z,S)=>z.position-S.position);u(C.length-1),p({...t,stops:C},!0)},b=f=>{if(t.stops.length<=2)return;const g=t.stops.filter((k,C)=>C!==f);u(Math.min(l,g.length-1)),p({...t,stops:g},!0)},m=t.stops[l]?.color??"#000000",i=m.startsWith("#")?m:Mt(m);return o.jsxs("div",{"data-testid":c,children:[o.jsxs("div",{style:{position:"relative",marginBottom:8},children:[o.jsx("div",{"data-testid":"gradient-preview",style:{height:20,borderRadius:v.radiusSmall,border:`1px solid ${v.border}`,background:qt(t)}}),o.jsx(dt,{stops:t.stops.map(f=>({position:f.position,css:f.color})),selected:l,onSelect:u,onMove:(f,g,k)=>h(f,{position:g},k),disabled:r,testIdPrefix:"gradient-stop"})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[o.jsx(Y,{testId:"gradient-selected-color",value:i,disabled:r,onChange:f=>h(l,{color:f},!1),onChangeEnd:f=>h(l,{color:f},!0),recentColors:a,onAddRecentColor:s}),o.jsxs("span",{style:{fontSize:9,color:v.textMuted},children:["Stop ",l+1]}),t.stops.length>2&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove gradient stop","data-testid":"gradient-remove-stop",onClick:()=>b(l),children:"×"}),o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":"gradient-add-stop",onClick:d,children:"+ stop"})]}),o.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",gap:1,flex:1},children:[o.jsx(ht,{testId:"gradient-type-linear",label:"Linear",active:t.type==="linear",disabled:r,onClick:()=>p({...t,type:"linear"},!0)}),o.jsx(ht,{testId:"gradient-type-radial",label:"Radial",active:t.type==="radial",disabled:r,onClick:()=>p({...t,type:"radial"},!0)})]}),t.type==="linear"&&o.jsx(A,{testId:"gradient-angle",label:"°",value:t.angle,unit:"deg",disabled:r,onChange:f=>p({...t,angle:f},!1),onChangeEnd:f=>p({...t,angle:f},!0),style:{width:70}})]})]})}function jt(t){const e=n=>Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}function vt(t){return{r:Number.parseInt(t.slice(1,3),16)/255,g:Number.parseInt(t.slice(3,5),16)/255,b:Number.parseInt(t.slice(5,7),16)/255}}function tt(t,e,n){if(t.length===0)return;if(e<=t[0].pos)return t[0].value;const r=t[t.length-1];if(e>=r.pos)return r.value;for(let a=0;a+1<t.length;a++){const s=t[a],c=t[a+1];if(e>=s.pos&&e<=c.pos){const l=c.pos>s.pos?(e-s.pos)/(c.pos-s.pos):0;return n(s.value,c.value,l)}}return r.value}const V=(t,e,n)=>t+(e-t)*n,$t=(t,e,n)=>({r:V(t.r,e.r,n),g:V(t.g,e.g,n),b:V(t.b,e.b,n)});function et(t,e,n){const r={...t[e],pos:n},a=[...t.filter((s,c)=>c!==e),r].sort((s,c)=>s.pos-c.pos);return{keys:a,index:a.indexOf(r)}}function ye({value:t,onChange:e,onChangeEnd:n,disabled:r,testId:a="quarks-gradient"}){const[s,c]=$.useState({track:"color",i:0}),l=(i,f)=>{f?B({onChange:e,onChangeEnd:n},i):N({onChange:e},i)},u=i=>({...t,color:{...t.color,keys:i}}),p=i=>({...t,alpha:{...t.alpha,keys:i}}),d=[...new Set([...t.color.keys.map(i=>i.pos),...t.alpha.keys.map(i=>i.pos)])].sort((i,f)=>i-f).map(i=>{const f=tt(t.color.keys,i,$t)??{r:1,g:1,b:1},g=tt(t.alpha.keys,i,V)??1;return`rgba(${Math.round(f.r*255)},${Math.round(f.g*255)},${Math.round(f.b*255)},${Math.round(g*1e3)/1e3}) ${Math.round(i*100)}%`}).join(", "),b=t.color.keys[s.track==="color"?s.i:0],m=t.alpha.keys[s.track==="alpha"?s.i:0];return o.jsxs("div",{"data-testid":a,children:[o.jsx(dt,{stops:t.alpha.keys.map(i=>{const f=Math.round(Math.max(0,Math.min(1,i.value))*255);return{position:i.pos,css:`rgb(${f},${f},${f})`}}),selected:s.track==="alpha"?s.i:-1,onSelect:i=>c({track:"alpha",i}),onMove:(i,f,g)=>{const{keys:k,index:C}=et(t.alpha.keys,i,f);c({track:"alpha",i:C}),l(p(k),g)},disabled:r,testIdPrefix:`${a}-alpha-stop`}),o.jsx("div",{"data-testid":`${a}-preview`,style:{height:20,borderRadius:v.radiusSmall,border:`1px solid ${v.border}`,backgroundImage:`linear-gradient(90deg, ${d}), repeating-linear-gradient(45deg, #777 0 5px, #aaa 5px 10px)`}}),o.jsx(dt,{stops:t.color.keys.map(i=>({position:i.pos,css:jt(i.value)})),selected:s.track==="color"?s.i:-1,onSelect:i=>c({track:"color",i}),onMove:(i,f,g)=>{const{keys:k,index:C}=et(t.color.keys,i,f);c({track:"color",i:C}),l(u(k),g)},disabled:r,testIdPrefix:`${a}-color-stop`}),s.track==="color"&&b&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(Y,{testId:`${a}-color-swatch`,value:jt(b.value),disabled:r,onChange:i=>l(u(t.color.keys.map((f,g)=>g===s.i?{...f,value:vt(i)}:f)),!1),onChangeEnd:i=>l(u(t.color.keys.map((f,g)=>g===s.i?{...f,value:vt(i)}:f)),!0)}),o.jsxs("span",{style:{fontSize:9,color:v.textMuted},children:["Color ",s.i+1,"/",t.color.keys.length]}),t.color.keys.length>2&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove color stop","data-testid":`${a}-remove-color-stop`,onClick:()=>{const i=t.color.keys.filter((f,g)=>g!==s.i);c({track:"color",i:Math.min(s.i,i.length-1)}),l(u(i),!0)},children:"×"}),o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":`${a}-add-color-stop`,onClick:()=>{const f=tt(t.color.keys,.5,$t)??{r:1,g:1,b:1},{keys:g,index:k}=et([...t.color.keys,{value:f,pos:.5}],t.color.keys.length,.5);c({track:"color",i:k}),l(u(g),!0)},children:"+ stop"})]}),s.track==="alpha"&&m&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(Dt,{label:"a",step:.05,testId:`${a}-alpha-value`,value:Math.round(m.value*1e3)/1e3,onChange:i=>l(p(t.alpha.keys.map((f,g)=>g===s.i?{...f,value:Math.max(0,Math.min(1,i))}:f)),!1),onChangeEnd:i=>l(p(t.alpha.keys.map((f,g)=>g===s.i?{...f,value:Math.max(0,Math.min(1,i))}:f)),!0)}),o.jsxs("span",{style:{fontSize:9,color:v.textMuted},children:["Alpha ",s.i+1,"/",t.alpha.keys.length]}),t.alpha.keys.length>2&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove alpha stop","data-testid":`${a}-remove-alpha-stop`,onClick:()=>{const i=t.alpha.keys.filter((f,g)=>g!==s.i);c({track:"alpha",i:Math.min(s.i,i.length-1)}),l(p(i),!0)},children:"×"}),o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":`${a}-add-alpha-stop`,onClick:()=>{const f=tt(t.alpha.keys,.5,V)??1,{keys:g,index:k}=et([...t.alpha.keys,{value:f,pos:.5}],t.alpha.keys.length,.5);c({track:"alpha",i:k}),l(p(g),!0)},children:"+ stop"})]})]})}const te={x:0,y:4,blur:8,spread:0,color:"rgba(0,0,0,0.25)",inset:!1,enabled:!0},ee={x:0,y:2,blur:4,spread:0,color:"rgba(0,0,0,0.3)",inset:!1,enabled:!0};function ne(t,e){return(e?[t.inset?"inset":"",`${t.x}px`,`${t.y}px`,`${t.blur}px`,`${t.spread}px`,t.color]:[`${t.x}px`,`${t.y}px`,`${t.blur}px`,t.color]).filter(Boolean).join(" ")}function je(t,e=!0){const n=t.filter(r=>r.enabled);return n.length===0?"none":n.map(r=>ne(r,e)).join(", ")}function re(t){const e=t.match(/(rgba?\([^)]+\))/);if(e?.[1])return{color:e[1],nums:t.replace(e[1],"").trim()};const n=t.match(/(#[0-9a-fA-F]{3,8})/);return n?.[1]?{color:n[1],nums:t.replace(n[1],"").trim()}:{color:"#000000",nums:t}}function oe(t,e){if(!t||t==="none")return null;const n=t.trim(),r=e&&n.startsWith("inset"),a=r?n.slice(5).trim():n,{color:s,nums:c}=re(a),l=c.split(/\s+/).map(u=>Number.parseFloat(u)).filter(u=>!Number.isNaN(u));return e?{inset:r,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:l[3]??0,color:s}:l.length<2?null:{inset:!1,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:0,color:s}}function ve(t,e=!0){if(!t||t==="none")return[];const n=t.split(/,\s*(?![^(]*\))/),r=[];for(const a of n){const s=oe(a.trim(),e);s&&r.push({...s,enabled:!0})}return r}function Rt({value:t,onChange:e,onChangeEnd:n,disabled:r,withSpreadInset:a=!0,label:s="Shadow",testId:c="shadow-editor",recentColors:l,onAddRecentColor:u}){const p=(m,i)=>{i?B({onChange:e,onChangeEnd:n},m):N({onChange:e},m)},h=(m,i,f=!1)=>{p(t.map((g,k)=>k===m?{...g,...i}:g),f)},d=m=>{p(t.filter((i,f)=>f!==m),!0)},b=()=>{p([...t,{...a?te:ee}],!0)};return o.jsxs("div",{"data-testid":c,children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:t.length>0?4:0},children:[o.jsx("span",{style:{fontSize:9,color:v.textMuted},children:s}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":`${c}-add`,onClick:b,children:"+"})]}),t.map((m,i)=>{const f=m.color.startsWith("#")?m.color:Mt(m.color);return o.jsxs("div",{"data-testid":`${c}-row-${i}`,style:{marginBottom:6,padding:"4px 0",borderBottom:`1px solid ${v.border}`},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-pressed":m.enabled,"data-testid":`${c}-toggle-${i}`,onClick:()=>{r||h(i,{enabled:!m.enabled},!0)},children:m.enabled?"●":"○"}),o.jsx(Y,{testId:`${c}-color-${i}`,value:f,disabled:r,onChange:g=>h(i,{color:g}),onChangeEnd:g=>h(i,{color:g},!0),recentColors:l,onAddRecentColor:u}),a&&o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:2,fontSize:8,color:v.textMuted,cursor:"pointer"},children:[o.jsx(Ft,{className:"volter-checkbox","data-testid":`${c}-inset-${i}`,checked:m.inset,disabled:r,onChange:g=>h(i,{inset:g.target.checked},!0)}),"in"]}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":`Remove ${s.toLowerCase()} ${i+1}`,"data-testid":`${c}-remove-${i}`,onClick:()=>d(i),children:"×"})]}),m.enabled&&o.jsxs("div",{style:{display:"flex",gap:4},children:[o.jsx(A,{label:"X",value:m.x,disabled:r,onChange:g=>h(i,{x:g}),onChangeEnd:g=>h(i,{x:g},!0),style:{flex:1}}),o.jsx(A,{label:"Y",value:m.y,disabled:r,onChange:g=>h(i,{y:g}),onChangeEnd:g=>h(i,{y:g},!0),style:{flex:1}}),o.jsx(A,{label:"B",value:m.blur,min:0,disabled:r,onChange:g=>h(i,{blur:Math.max(0,g)}),onChangeEnd:g=>h(i,{blur:Math.max(0,g)},!0),style:{flex:1}}),a&&o.jsx(A,{label:"S",value:m.spread,disabled:r,onChange:g=>h(i,{spread:g}),onChangeEnd:g=>h(i,{spread:g},!0),style:{flex:1}})]})]},i)})]})}function $e(t){return o.jsx(Rt,{...t,withSpreadInset:!0,testId:"box-shadow-editor",label:t.label??"Shadow"})}function we(t){return o.jsx(Rt,{...t,withSpreadInset:!1,testId:"text-shadow-editor",label:t.label??"Text Shadow"})}export{ce as A,pe as B,Y as C,te as D,me as F,be as G,ye as Q,A as S,we as T,ue as a,fe as b,qt as c,he as d,ve as e,$e as f,je as g,ge as h,Xt as i,Yt as j,de as k,Gt as l,ee as m,dt as n,Rt as o,xe as p,Vt as q,Wt as u};
1
+ import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{r as $}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{eT as v,a6 as L,ho as N,bP as wt,aN as pt,hn as B,e_ as zt,bH as ut,a7 as X,iZ as ft,kZ as it,eG as Bt,hZ as ht,dV as Dt,aS as Ft}from"./index-DBIFLhzt.js";const Ht={full:{anchor:{left:0,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},top:{anchor:{left:0,top:0,right:1,bottom:0},offset:{left:0,top:0,right:0,bottom:0}},bottom:{anchor:{left:0,top:1,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},left:{anchor:{left:0,top:0,right:0,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},right:{anchor:{left:1,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},center:{anchor:{left:.5,top:.5,right:.5,bottom:.5},offset:{left:-60,top:-20,right:60,bottom:20}},"top-left":{anchor:{left:0,top:0,right:0,bottom:0},offset:{left:0,top:0,right:120,bottom:40}},"top-right":{anchor:{left:1,top:0,right:1,bottom:0},offset:{left:-120,top:0,right:0,bottom:40}}},mt=["flex-start","center","flex-end"],gt=["flex-start","center","flex-end"];function At({row:t,col:e,justify:n,align:r,isActive:a,disabled:s,onSelect:c}){return o.jsx("div",{"data-testid":`alignment-grid-${t}-${e}`,onClick:()=>{s||c(n,r)},style:{width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:s?"not-allowed":"pointer",borderRadius:v.radiusSmall,background:a?v.accent:"transparent"},children:o.jsx("div",{style:{width:a?6:4,height:a?6:4,borderRadius:"50%",background:a?v.onAccent:v.textMuted}})})}function ce({value:t,onChange:e,disabled:n}){const r=mt.indexOf(t.justify),a=gt.indexOf(t.align);return o.jsx("div",{"data-testid":"alignment-grid",style:{display:"inline-grid",gridTemplateColumns:"repeat(3, 16px)",gridTemplateRows:"repeat(3, 16px)",gap:1,background:v.inputBg,borderRadius:v.radiusMedium,padding:4,opacity:n?.35:1},children:gt.map((s,c)=>mt.map((l,u)=>o.jsx(At,{row:c,col:u,justify:l,align:s,isActive:c===a&&u===r,disabled:n,onSelect:(p,h)=>e({justify:p,align:h})},`${c}-${u}`)))})}function de({onSelect:t,disabled:e}){return o.jsx("div",{"data-testid":"anchor-presets",style:{display:"flex",flexWrap:"wrap",gap:4},children:Object.entries(Ht).map(([n,r])=>o.jsx(L,{type:"button",variant:"secondary",size:"compact","data-testid":`anchor-preset-${n}`,disabled:e,onClick:()=>t(n,r),children:n},n))})}function nt(t){let e=t.replace("#","");e.length===3&&(e=`${e[0]??"0"}${e[0]??"0"}${e[1]??"0"}${e[1]??"0"}${e[2]??"0"}${e[2]??"0"}`);const n=Number.parseInt(e,16);return[n>>16&255,n>>8&255,n&255]}function St(t,e,n){return`#${[t,e,n].map(r=>Math.round(Math.max(0,Math.min(255,r))).toString(16).padStart(2,"0")).join("")}`}function Q(t,e,n){const r=t/255,a=e/255,s=n/255,c=Math.max(r,a,s),l=Math.min(r,a,s),u=c-l;let p=0;u!==0&&(c===r?p=((a-s)/u%6+6)%6:c===a?p=(s-r)/u+2:p=(r-a)/u+4,p/=6);const h=c===0?0:u/c;return[p,h,c]}function K(t,e,n){const r=Math.floor(t*6),a=t*6-r,s=n*(1-e),c=n*(1-a*e),l=n*(1-(1-a)*e);let u=0,p=0,h=0;switch(r%6){case 0:u=n,p=l,h=s;break;case 1:u=c,p=n,h=s;break;case 2:u=s,p=n,h=l;break;case 3:u=s,p=c,h=n;break;case 4:u=l,p=s,h=n;break;case 5:u=n,p=s,h=c;break}return[Math.round(u*255),Math.round(p*255),Math.round(h*255)]}function kt(t,e,n){let r,a,s;if(e===0)r=a=s=n;else{const c=(p,h,d)=>{let b=d;return b<0&&(b+=1),b>1&&(b-=1),b<.16666666666666666?p+(h-p)*6*b:b<.5?h:b<.6666666666666666?p+(h-p)*(.6666666666666666-b)*6:p},l=n<.5?n*(1+e):n+e-n*e,u=2*n-l;r=c(u,l,t+1/3),a=c(u,l,t),s=c(u,l,t-1/3)}return[Math.round(r*255),Math.round(a*255),Math.round(s*255)]}function Pt(t,e,n){const r=t/255,a=e/255,s=n/255,c=Math.max(r,a,s),l=Math.min(r,a,s);let u=0,p=0;const h=(c+l)/2;if(c!==l){const d=c-l;p=h>.5?d/(2-c-l):d/(c+l),c===r?u=((a-s)/d+(a<s?6:0))/6:c===a?u=((s-r)/d+2)/6:u=((r-a)/d+4)/6}return[u,p,h]}function rt(t){if(t.startsWith("#")&&(t.length===4||t.length===7))return t;if(t.startsWith("#")&&t.length===9)return t.slice(0,7);const e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(e){const[,r,a,s]=e;return`#${[r??"0",a??"0",s??"0"].map(c=>Number.parseInt(c,10).toString(16).padStart(2,"0")).join("")}`}const n=t.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?/);if(n){const[r,a,s]=kt(Number.parseInt(n[1]??"0",10)/360,Number.parseInt(n[2]??"0",10)/100,Number.parseInt(n[3]??"0",10)/100);return St(r,a,s)}return"#000000"}function lt(t){const e=t.match(/rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);if(e?.[1])return Number.parseFloat(e[1]);const n=t.match(/hsla\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);return n?.[1]?Number.parseFloat(n[1]):t.startsWith("#")&&t.length===9?Number.parseInt(t.slice(7,9),16)/255:1}function xt(t,e,n,r,a){if(a==="hex"){const d=St(t,e,n);return r<1?`rgba(${t}, ${e}, ${n}, ${r.toFixed(2)})`:d}if(a==="rgb")return r<1?`rgba(${t}, ${e}, ${n}, ${r.toFixed(2)})`:`rgb(${t}, ${e}, ${n})`;const[s,c,l]=Pt(t,e,n),u=Math.round(s*360),p=Math.round(c*100),h=Math.round(l*100);return r<1?`hsla(${u}, ${p}%, ${h}%, ${r.toFixed(2)})`:`hsl(${u}, ${p}%, ${h}%)`}function Mt(t){const e=t.match(/\d+/g);return!e||e.length<3?"#000000":`#${[e[0]??"0",e[1]??"0",e[2]??"0"].map(n=>Number.parseInt(n,10).toString(16).padStart(2,"0")).join("")}`}const F=200,J=150,U=14;function Gt({value:t,onChange:e,onChangeEnd:n,onClose:r,recentColors:a,onAddRecentColor:s,eyedropperFallback:c,onEyedropperPick:l,disabled:u}){const p=rt(t),h=nt(p),[d,b]=$.useState(()=>Q(...h)),[m,i]=$.useState(()=>lt(t)),[f,g]=$.useState("hex"),[k,C]=$.useState(p),z=$.useRef(null),S=$.useRef(null),w=$.useRef(null),E=$.useRef(null),T=$.useRef(null),H=$.useCallback((x=d,y=m,j=f)=>{const[M,R,I]=K(x[0],x[1],x[2]);return xt(M,R,I,y,j)},[d,m,f]);$.useEffect(()=>{C(H())},[H]),$.useEffect(()=>{const x=S.current,y=x?.getContext("2d");if(!x||!y)return;const[j,M,R]=K(d[0],1,1),I=y.createLinearGradient(0,0,F,0);I.addColorStop(0,"#ffffff"),I.addColorStop(1,`rgb(${j},${M},${R})`),y.fillStyle=I,y.fillRect(0,0,F,J);const P=y.createLinearGradient(0,0,0,J);P.addColorStop(0,"rgba(0,0,0,0)"),P.addColorStop(1,"rgba(0,0,0,1)"),y.fillStyle=P,y.fillRect(0,0,F,J)},[d[0]]),$.useEffect(()=>{const x=w.current,y=x?.getContext("2d");if(!x||!y)return;const j=y.createLinearGradient(0,0,F,0);for(let M=0;M<=6;M++){const[R,I,P]=K(M/6,1,1);j.addColorStop(M/6,`rgb(${R},${I},${P})`)}y.fillStyle=j,y.fillRect(0,0,F,U)},[]),$.useEffect(()=>{const x=E.current,y=x?.getContext("2d");if(!x||!y)return;const j=4;for(let q=0;q<U;q+=j)for(let Z=0;Z<F;Z+=j)y.fillStyle=(Z/j+q/j)%2===0?"#ffffff":"#cccccc",y.fillRect(Z,q,j,j);const[M,R,I]=K(d[0],d[1],d[2]),P=y.createLinearGradient(0,0,F,0);P.addColorStop(0,`rgba(${M},${R},${I},0)`),P.addColorStop(1,`rgba(${M},${R},${I},1)`),y.fillStyle=P,y.fillRect(0,0,F,U)},[d]),$.useEffect(()=>{if(!r)return;function x(j){j.key==="Escape"&&r?.()}function y(j){z.current&&!z.current.contains(j.target)&&r?.()}return document.addEventListener("keydown",x),document.addEventListener("mousedown",y,!0),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",y,!0)}},[r]);const _=$.useCallback((x,y,j,M)=>{const R=y?.getBoundingClientRect();if(R)if(x==="sat"){const I=[d[0],ct(j,R.left,R.width),_t(M,R.top,R.height)];b(I),N({onChange:e},H(I))}else if(x==="hue"){const I=[ct(j,R.left,R.width),d[1],d[2]];b(I),N({onChange:e},H(I))}else{const I=Math.round(ct(j,R.left,R.width)*100)/100;i(I),N({onChange:e},H(d,I))}},[d,H,e]);$.useEffect(()=>{function x(j){const M=T.current;if(!M)return;j.preventDefault();const R=M==="sat"?S.current:M==="hue"?w.current:E.current;_(M,R,j.clientX,j.clientY)}function y(){if(T.current){T.current=null;const j=H();B({onChange:e,onChangeEnd:n},j),s?.(j)}}return window.addEventListener("mousemove",x),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",y)}},[_,H,e,n,s]);const D=(x,y)=>{u||(y.preventDefault(),T.current=x,_(x,y.currentTarget,y.clientX,y.clientY))},G=()=>{const x=k.trim(),y=Ot(x),j=y?{r:y[0],g:y[1],b:y[2],a:1}:Kt(x)??Ut(x);if(!j)return;b(Q(j.r,j.g,j.b)),i(j.a);const M=y?x:xt(j.r,j.g,j.b,j.a,f);N({onChange:e},M),B({onChange:e,onChangeEnd:n},M),s?.(M)},st=()=>{g(x=>x==="hex"?"rgb":x==="rgb"?"hsl":"hex")},O=typeof globalThis.EyeDropper=="function",at=x=>{const y=rt(x);b(Q(...nt(y))),i(lt(x)),N({onChange:e},x),B({onChange:e,onChangeEnd:n},x)},Ct=async()=>{if(O){try{const y=globalThis.EyeDropper,j=await new y().open();at(j.sRGBHex)}catch{}return}if(l){l(y=>{y&&at(y)});return}const x=c?.();x&&at(x)},[It,Lt,Tt]=K(d[0],d[1],d[2]),Nt=`rgba(${It},${Lt},${Tt},${m})`;return o.jsxs(wt,{ref:z,"data-testid":"inspector-color-picker",onMouseDown:x=>x.stopPropagation(),style:{padding:10,width:F+16,boxSizing:"border-box"},children:[o.jsx("canvas",{ref:S,"data-testid":"color-picker-sv",width:F,height:J,onMouseDown:x=>D("sat",x),style:{cursor:"crosshair",borderRadius:v.radiusSmall,display:"block"}}),o.jsx("canvas",{ref:w,"data-testid":"color-picker-hue",width:F,height:U,onMouseDown:x=>D("hue",x),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),o.jsx("canvas",{ref:E,"data-testid":"color-picker-alpha",width:F,height:U,onMouseDown:x=>D("alpha",x),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),o.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginTop:8},children:[o.jsx("div",{style:{width:22,height:22,borderRadius:v.radiusSmall,flexShrink:0,border:`1px solid ${v.border}`,background:Nt}}),o.jsx(pt,{type:"text","data-testid":"color-picker-text",value:k,onChange:x=>C(x.target.value),onKeyDown:x=>{x.key==="Enter"&&G()},onBlur:G,"data-density":"compact","data-monospace":"true",style:{flex:1}}),o.jsx(L,{type:"button",variant:"secondary",size:"compact","data-testid":"color-format-toggle",onClick:st,title:"Cycle color format",style:{flexShrink:0},children:f.toUpperCase()}),(O||c||l)&&o.jsx(L,{type:"button",variant:"secondary",size:"compact","data-testid":"color-picker-eyedropper",onClick:Ct,title:"Eyedropper",style:{flexShrink:0},children:"⌖"})]}),a&&a.length>0&&o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3,marginTop:8,paddingTop:6,borderTop:`1px solid ${v.border}`},children:a.map((x,y)=>o.jsx("div",{"data-testid":"color-picker-recent",onClick:()=>{const j=rt(x);b(Q(...nt(j))),i(lt(x)),N({onChange:e},x),B({onChange:e,onChangeEnd:n},x)},title:x,style:{width:16,height:16,borderRadius:v.radiusSmall,cursor:"pointer",background:x,border:`1px solid ${v.border}`}},`${x}-${y}`))})]})}function Y({label:t,value:e,onChange:n,onChangeEnd:r,recentColors:a,onAddRecentColor:s,eyedropperFallback:c,onEyedropperPick:l,disabled:u,testId:p}){const[h,d]=$.useState(!1),b=rt(e);return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,position:"relative"},children:[o.jsx("div",{"data-testid":p?`${p}-swatch`:"color-swatch",onClick:()=>{u||d(m=>!m)},style:{width:20,height:20,borderRadius:v.radiusSmall,flexShrink:0,background:b,border:`1px solid ${v.border}`,cursor:u?"not-allowed":"pointer"}}),t&&o.jsx("span",{style:{fontSize:10,color:v.textMuted,flexShrink:0},children:t}),h&&!u&&o.jsx("div",{style:{position:"absolute",zIndex:"var(--volter-z-dropdown)",top:"100%",left:0,marginTop:4},children:o.jsx(Gt,{value:e,onChange:n,onChangeEnd:r,onClose:()=>d(!1),recentColors:a,onAddRecentColor:s,eyedropperFallback:c,onEyedropperPick:l})})]})}function Et(t){return Math.max(0,Math.min(1,t))}function ct(t,e,n){return Et(n?(t-e)/n:0)}function _t(t,e,n){return Et(n?1-(t-e)/n:0)}function Ot(t){return/^#[0-9a-fA-F]{6}$/.test(t)?nt(t):null}function Kt(t){const e=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!e)return null;const[,n,r,a,s]=e;return{r:Number.parseInt(n??"0",10),g:Number.parseInt(r??"0",10),b:Number.parseInt(a??"0",10),a:s?Number.parseFloat(s):1}}function Ut(t){const e=t.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?(?:,\s*([\d.]+))?\)/);if(!e)return null;const[,n,r,a,s]=e,[c,l,u]=kt(Number.parseInt(n??"0",10)/360,Number.parseInt(r??"0",10)/100,Number.parseInt(a??"0",10)/100);return{r:c,g:l,b:u,a:s?Number.parseFloat(s):1}}function A({label:t,value:e,unit:n="",step:r=1,min:a,max:s,precision:c,disabled:l,onChange:u,onChangeEnd:p,testId:h,style:d}){const b=$.useRef(null),m=c??(r<1?2:r>=100?-2:0),i=$.useMemo(()=>w=>{if(m<0){const T=10**-m;return Math.round(w/T)*T}const E=10**m;return Math.round(w*E)/E},[m]),f=w=>{let E=w;return a!==void 0&&(E=Math.max(a,E)),s!==void 0&&(E=Math.min(s,E)),i(E)},g=w=>{if(l)return;w.preventDefault(),b.current={startX:w.clientX,startValue:e,last:e},document.body.style.cursor="ew-resize";const E=D=>{if(!b.current)return;D.preventDefault();const G=D.clientX-b.current.startX,st=D.shiftKey?10:D.altKey?.1:1,O=f(b.current.startValue+G*r*st);b.current.last=O,N({onChange:u},O)},T=()=>{document.body.style.cursor="",window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",H),window.removeEventListener("keydown",_)},H=()=>{if(b.current){const D=b.current.last;b.current=null,B({onChange:u,onChangeEnd:p},D)}T()},_=D=>{if(D.key==="Escape"&&b.current){const G=f(b.current.startValue);b.current=null,N({onChange:u},G),B({onChange:u,onChangeEnd:p},G),T()}};window.addEventListener("mousemove",E),window.addEventListener("mouseup",H),window.addEventListener("keydown",_)},[k,C]=$.useState(null),z=$.useRef(!1),S=w=>{const E=Number.parseFloat(w);if(Number.isNaN(E))return;const T=f(E);T!==e&&B({onChange:u,onChangeEnd:p},T)};return o.jsxs("div",{style:{...zt,...d},children:[o.jsx("span",{className:"volter-scrub-label","data-testid":h?`${h}-label`:void 0,onMouseDown:g,"data-disabled":l||void 0,style:{fontSize:11,...l?{color:v.dynamic}:{},flexShrink:0,cursor:l?"not-allowed":"ew-resize",userSelect:"none",fontWeight:500},children:t}),o.jsx(pt,{"data-testid":h,type:"text",value:k??`${e}${n}`,readOnly:l,"data-dynamic":l||void 0,onFocus:w=>{C(`${e}${n}`),w.target.select()},onChange:w=>C(w.target.value),onBlur:w=>{z.current||S(w.target.value),z.current=!1,C(null)},onKeyDown:w=>{w.key==="Enter"&&w.target.blur(),w.key==="Escape"&&(z.current=!0,w.target.blur())},style:{flex:1,width:0}})]})}const bt=["none","solid","dashed","dotted","double"];function Wt(t){return{top:t,right:t,bottom:t,left:t}}function Xt(t){const e=r=>`${r.width}|${r.style}|${r.color}`,n=e(t.top);return e(t.right)===n&&e(t.bottom)===n&&e(t.left)===n}function pe({value:t,onChange:e,onChangeEnd:n,disabled:r,recentColors:a,onAddRecentColor:s}){const[c,l]=$.useState(!Xt(t)),u=(d,b)=>{const m={...t.top,...d},i=Wt(m);b?B({onChange:e,onChangeEnd:n},i):N({onChange:e},i)},p=(d,b,m)=>{const i={...t,[d]:{...t[d],...b}};m?B({onChange:e,onChangeEnd:n},i):N({onChange:e},i)};if(!c)return o.jsxs("div",{"data-testid":"border-editor-uniform",style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsx(Y,{testId:"border-color",value:t.top.color,disabled:r,onChange:d=>u({color:d},!1),onChangeEnd:d=>u({color:d},!0),recentColors:a,onAddRecentColor:s}),o.jsx(A,{testId:"border-width",label:"W",value:t.top.width,min:0,disabled:r,onChange:d=>u({width:d},!1),onChangeEnd:d=>u({width:d},!0),style:{width:64}}),o.jsx(ut,{className:"volter-select","data-testid":"border-style",value:t.top.style,disabled:r,"data-dynamic":r||void 0,onChange:d=>u({style:d.target.value},!0),style:{flex:1},children:bt.map(d=>o.jsx("option",{value:d,children:d},d))}),o.jsx(L,{type:"button","data-testid":"border-expand",title:"Per-side borders","aria-label":"Edit borders per side",onClick:()=>l(!0),variant:"ghost",size:"compact",children:o.jsx(X,{icon:ft})})]});const h=[{key:"top",label:"T"},{key:"right",label:"R"},{key:"bottom",label:"B"},{key:"left",label:"L"}];return o.jsxs("div",{"data-testid":"border-editor-expanded",style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{fontSize:10,color:v.textMuted},children:"Per-side"}),o.jsx("div",{style:{flex:1}}),o.jsx(L,{type:"button",variant:"primary",size:"compact","data-testid":"border-collapse",title:"Uniform border","aria-label":"Use one border for all sides",onClick:()=>l(!1),children:o.jsx(X,{icon:ft})})]}),h.map(({key:d,label:b})=>o.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx("span",{style:{fontSize:10,color:v.textMuted,width:10,textAlign:"center"},children:b}),o.jsx(Y,{testId:`border-${d}-color`,value:t[d].color,disabled:r,onChange:m=>p(d,{color:m},!1),onChangeEnd:m=>p(d,{color:m},!0),recentColors:a,onAddRecentColor:s}),o.jsx(A,{testId:`border-${d}-width`,label:"",value:t[d].width,min:0,disabled:r,onChange:m=>p(d,{width:m},!1),onChangeEnd:m=>p(d,{width:m},!0),style:{width:48}}),o.jsx(ut,{className:"volter-select","data-testid":`border-${d}-style`,value:t[d].style,disabled:r,"data-density":"compact","data-dynamic":r||void 0,onChange:m=>p(d,{style:m.target.value},!0),style:{flex:1},children:bt.map(m=>o.jsx("option",{value:m,children:m},m))})]},d))]})}function Vt(t){return{topLeft:t,topRight:t,bottomLeft:t,bottomRight:t}}function Yt(t){return t.topLeft===t.topRight&&t.topRight===t.bottomLeft&&t.bottomLeft===t.bottomRight}function ue({value:t,onChange:e,onChangeEnd:n,disabled:r}){const[a,s]=$.useState(!Yt(t)),c=(p,h)=>{const d=Vt(p);h?B({onChange:e,onChangeEnd:n},d):N({onChange:e},d)},l=(p,h,d)=>{const b={...t,[p]:h};d?B({onChange:e,onChangeEnd:n},b):N({onChange:e},b)};if(!a)return o.jsxs("div",{"data-testid":"border-radius-editor-uniform",style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx(A,{testId:"border-radius",label:o.jsx(X,{icon:it,label:"Radius"}),value:t.topLeft,min:0,disabled:r,onChange:p=>c(p,!1),onChangeEnd:p=>c(p,!0),style:{flex:1}}),o.jsx(L,{type:"button","data-testid":"border-radius-expand",title:"Independent corners","aria-label":"Edit radius per corner",onClick:()=>s(!0),variant:"ghost",size:"compact",children:o.jsx(X,{icon:it})})]});const u=[{key:"topLeft",label:"TL"},{key:"topRight",label:"TR"},{key:"bottomLeft",label:"BL"},{key:"bottomRight",label:"BR"}];return o.jsxs("div",{"data-testid":"border-radius-editor-expanded",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx("span",{style:{fontSize:10,color:v.textMuted},children:"Corners"}),o.jsx("div",{style:{flex:1}}),o.jsx(L,{type:"button",variant:"primary",size:"compact","data-testid":"border-radius-collapse",title:"Uniform radius","aria-label":"Use one radius for all corners",onClick:()=>s(!1),children:o.jsx(X,{icon:it})})]}),o.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:u.map(({key:p,label:h})=>o.jsx(A,{testId:`border-radius-${p}`,label:h,value:t[p],min:0,disabled:r,onChange:d=>l(p,d,!1),onChangeEnd:d=>l(p,d,!0)},p))})]})}const ot=[{name:"blur",unit:"px",min:0,max:50,step:.5,default:0},{name:"brightness",unit:"%",min:0,max:300,step:1,default:100},{name:"contrast",unit:"%",min:0,max:300,step:1,default:100},{name:"saturate",unit:"%",min:0,max:300,step:1,default:100},{name:"grayscale",unit:"%",min:0,max:100,step:1,default:0},{name:"hue-rotate",unit:"deg",min:0,max:360,step:1,default:0}];function fe(t){return!t||t==="none"?ot.map(e=>({name:e.name,value:e.default})):ot.map(e=>{const n=new RegExp(`${e.name}\\(([\\d.]+)${e.unit}?\\)`),r=t.match(n);return{name:e.name,value:r?.[1]?Number.parseFloat(r[1]):e.default}})}function he(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n],a=ot[n];r&&a&&r.value!==a.default&&e.push(`${r.name}(${r.value}${a.unit})`)}return e.length?e.join(" "):"none"}function me({value:t,onChange:e,onChangeEnd:n,disabled:r,label:a="Filter",testId:s="filter-editor"}){const c=(l,u,p)=>{const h=t.map((d,b)=>b===l?{...d,value:u}:d);p?B({onChange:e,onChangeEnd:n},h):N({onChange:e},h)};return o.jsxs("div",{"data-testid":s,children:[o.jsx("div",{style:{fontSize:9,color:v.textMuted,marginBottom:4},children:a}),t.map((l,u)=>{const p=ot[u];return p?o.jsx("div",{"data-testid":`filter-row-${l.name}`,style:{marginBottom:3},children:o.jsx(A,{testId:`filter-${l.name}`,label:l.name.replace("hue-rotate","hue"),value:l.value,unit:p.unit,min:p.min,max:p.max,step:p.step,disabled:r,onChange:h=>c(u,h,!1),onChangeEnd:h=>c(u,h,!0)})},l.name):null})]})}const W=28,yt=10;function ge({value:t,onChange:e,disabled:n,fonts:r,testId:a="font-picker"}){const[s,c]=$.useState(!1),[l,u]=$.useState(""),[p,h]=$.useState(0),d=$.useRef(null),b=$.useRef(null);$.useEffect(()=>{s&&b.current?.focus()},[s]),$.useEffect(()=>{if(!s)return;const S=w=>{d.current&&!d.current.contains(w.target)&&c(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[s]),$.useEffect(()=>{if(!s)return;const S=w=>{w.key==="Escape"&&c(!1)};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[s]);const m=$.useMemo(()=>{if(!l)return r;const S=l.toLowerCase();return r.filter(w=>w.toLowerCase().includes(S))},[r,l]),i=m.length*W,f=Math.floor(p/W),g=Math.min(m.length,f+yt+2),k=m.slice(f,g),C=S=>{e(S),c(!1),u("")},z=t.replace(/^["']|["']$/g,"");return o.jsxs("div",{ref:d,"data-testid":a,style:{position:"relative",flex:1},children:[o.jsxs(L,{type:"button",variant:"secondary",className:"volter-field-trigger","aria-haspopup":"listbox","aria-expanded":s,disabled:n,"data-testid":"font-picker-input",onClick:()=>{n||c(S=>!S)},children:[o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z||"—"}),o.jsx(Bt,{direction:"down",tone:"muted",style:{marginLeft:4}})]}),s&&o.jsxs(wt,{"data-testid":"font-picker-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:"var(--volter-z-dropdown)",marginTop:2},children:[o.jsx("div",{style:{padding:4},children:o.jsx(pt,{ref:b,type:"text","data-testid":"font-picker-search",value:l,onChange:S=>{u(S.target.value),h(0)},placeholder:"Search fonts…","data-density":"compact",style:{width:"100%",boxSizing:"border-box"}})}),o.jsx("div",{"data-testid":"font-picker-list",onScroll:S=>h(S.target.scrollTop),style:{maxHeight:yt*W,overflowY:"auto"},children:o.jsx("div",{style:{height:i,position:"relative"},children:k.map((S,w)=>{const E=f+w,T=S.toLowerCase()===z.toLowerCase();return o.jsx("div",{"data-testid":`font-picker-option-${S}`,onClick:()=>C(S),style:{position:"absolute",top:E*W,left:0,right:0,height:W,display:"flex",alignItems:"center",padding:"0 8px",cursor:"pointer",fontSize:12,background:T?v.accent:"transparent",color:T?v.onAccent:v.text},children:o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S})},S)})})}),m.length===0&&o.jsx("div",{style:{padding:"8px 12px",color:v.textMuted,fontSize:10,textAlign:"center"},children:"No matching fonts"})]})]})}function qt(t){const e=t.stops.map(n=>`${n.color} ${Math.round(n.position*100)}%`).join(", ");return t.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${t.angle}deg, ${e})`}function Zt(t){const e=t.match(/^linear-gradient\((.+)\)$/);if(e?.[1]!==void 0)return{type:"linear",inner:e[1]};const n=t.match(/^radial-gradient\((.+)\)$/);return n?.[1]!==void 0?{type:"radial",inner:n[1]}:null}function Qt(t){const e=t.match(/^(\d+)deg\s*,\s*/);if(e)return{angle:Number.parseInt(e[1]??"180",10),colorPart:t.slice(e[0].length)};if(t.startsWith("to ")){const n=t.match(/^to\s+\w+\s*,\s*/);if(n)return{angle:180,colorPart:t.slice(n[0].length)}}return{angle:180,colorPart:t}}function Jt(t){const e=t.split(/,\s*(?![^(]*\))/).map(n=>{const r=n.trim(),a=r.match(/\s+(\d+)%$/),s=a?Number.parseInt(a[1]??"0",10)/100:-1;return{color:a?r.slice(0,-a[0].length).trim():r,position:s}});for(let n=0;n<e.length;n++){const r=e[n];r&&r.position<0&&(r.position=e.length>1?n/(e.length-1):0)}return e}function xe(t){if(!t||t==="none")return null;const e=Zt(t);if(!e)return null;const{angle:n,colorPart:r}=e.type==="linear"?Qt(e.inner):{angle:180,colorPart:e.inner},a=Jt(r);return a.length<2?null:{type:e.type,angle:n,stops:a}}function dt({stops:t,selected:e,onSelect:n,onMove:r,disabled:a,testIdPrefix:s}){return o.jsx("div",{style:{position:"relative",height:12,marginTop:2},children:t.map((c,l)=>o.jsx("div",{"data-testid":`${s}-${l}`,onClick:()=>n(l),onMouseDown:u=>{if(a)return;u.preventDefault(),n(l);const h=u.target.parentElement?.getBoundingClientRect(),d=i=>h?.width?Math.max(0,Math.min(1,(i-h.left)/h.width)):c.position,b=i=>r(l,d(i.clientX),!1),m=i=>{r(l,d(i.clientX),!0),window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",m)};window.addEventListener("mousemove",b),window.addEventListener("mouseup",m)},style:{position:"absolute",left:`${c.position*100}%`,top:0,width:10,height:10,borderRadius:"50%",background:c.css,border:`2px solid ${l===e?v.accent:"#fff"}`,transform:"translateX(-50%)",cursor:a?"not-allowed":"pointer"}},l))})}function be({value:t,onChange:e,onChangeEnd:n,disabled:r,recentColors:a,onAddRecentColor:s,testId:c="gradient-editor"}){const[l,u]=$.useState(0),p=(f,g)=>{g?B({onChange:e,onChangeEnd:n},f):N({onChange:e},f)},h=(f,g,k)=>{const C=t.stops.map((z,S)=>S===f?{...z,...g}:z);p({...t,stops:C},k)},d=()=>{const f=t.stops[t.stops.length-1]?.position??1,g=t.stops[0]?.position??0,k=(f+g)/2,C=[...t.stops,{color:"#888888",position:k}].sort((z,S)=>z.position-S.position);u(C.length-1),p({...t,stops:C},!0)},b=f=>{if(t.stops.length<=2)return;const g=t.stops.filter((k,C)=>C!==f);u(Math.min(l,g.length-1)),p({...t,stops:g},!0)},m=t.stops[l]?.color??"#000000",i=m.startsWith("#")?m:Mt(m);return o.jsxs("div",{"data-testid":c,children:[o.jsxs("div",{style:{position:"relative",marginBottom:8},children:[o.jsx("div",{"data-testid":"gradient-preview",style:{height:20,borderRadius:v.radiusSmall,border:`1px solid ${v.border}`,background:qt(t)}}),o.jsx(dt,{stops:t.stops.map(f=>({position:f.position,css:f.color})),selected:l,onSelect:u,onMove:(f,g,k)=>h(f,{position:g},k),disabled:r,testIdPrefix:"gradient-stop"})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[o.jsx(Y,{testId:"gradient-selected-color",value:i,disabled:r,onChange:f=>h(l,{color:f},!1),onChangeEnd:f=>h(l,{color:f},!0),recentColors:a,onAddRecentColor:s}),o.jsxs("span",{style:{fontSize:9,color:v.textMuted},children:["Stop ",l+1]}),t.stops.length>2&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove gradient stop","data-testid":"gradient-remove-stop",onClick:()=>b(l),children:"×"}),o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":"gradient-add-stop",onClick:d,children:"+ stop"})]}),o.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",gap:1,flex:1},children:[o.jsx(ht,{testId:"gradient-type-linear",label:"Linear",active:t.type==="linear",disabled:r,onClick:()=>p({...t,type:"linear"},!0)}),o.jsx(ht,{testId:"gradient-type-radial",label:"Radial",active:t.type==="radial",disabled:r,onClick:()=>p({...t,type:"radial"},!0)})]}),t.type==="linear"&&o.jsx(A,{testId:"gradient-angle",label:"°",value:t.angle,unit:"deg",disabled:r,onChange:f=>p({...t,angle:f},!1),onChangeEnd:f=>p({...t,angle:f},!0),style:{width:70}})]})]})}function jt(t){const e=n=>Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}function vt(t){return{r:Number.parseInt(t.slice(1,3),16)/255,g:Number.parseInt(t.slice(3,5),16)/255,b:Number.parseInt(t.slice(5,7),16)/255}}function tt(t,e,n){if(t.length===0)return;if(e<=t[0].pos)return t[0].value;const r=t[t.length-1];if(e>=r.pos)return r.value;for(let a=0;a+1<t.length;a++){const s=t[a],c=t[a+1];if(e>=s.pos&&e<=c.pos){const l=c.pos>s.pos?(e-s.pos)/(c.pos-s.pos):0;return n(s.value,c.value,l)}}return r.value}const V=(t,e,n)=>t+(e-t)*n,$t=(t,e,n)=>({r:V(t.r,e.r,n),g:V(t.g,e.g,n),b:V(t.b,e.b,n)});function et(t,e,n){const r={...t[e],pos:n},a=[...t.filter((s,c)=>c!==e),r].sort((s,c)=>s.pos-c.pos);return{keys:a,index:a.indexOf(r)}}function ye({value:t,onChange:e,onChangeEnd:n,disabled:r,testId:a="quarks-gradient"}){const[s,c]=$.useState({track:"color",i:0}),l=(i,f)=>{f?B({onChange:e,onChangeEnd:n},i):N({onChange:e},i)},u=i=>({...t,color:{...t.color,keys:i}}),p=i=>({...t,alpha:{...t.alpha,keys:i}}),d=[...new Set([...t.color.keys.map(i=>i.pos),...t.alpha.keys.map(i=>i.pos)])].sort((i,f)=>i-f).map(i=>{const f=tt(t.color.keys,i,$t)??{r:1,g:1,b:1},g=tt(t.alpha.keys,i,V)??1;return`rgba(${Math.round(f.r*255)},${Math.round(f.g*255)},${Math.round(f.b*255)},${Math.round(g*1e3)/1e3}) ${Math.round(i*100)}%`}).join(", "),b=t.color.keys[s.track==="color"?s.i:0],m=t.alpha.keys[s.track==="alpha"?s.i:0];return o.jsxs("div",{"data-testid":a,children:[o.jsx(dt,{stops:t.alpha.keys.map(i=>{const f=Math.round(Math.max(0,Math.min(1,i.value))*255);return{position:i.pos,css:`rgb(${f},${f},${f})`}}),selected:s.track==="alpha"?s.i:-1,onSelect:i=>c({track:"alpha",i}),onMove:(i,f,g)=>{const{keys:k,index:C}=et(t.alpha.keys,i,f);c({track:"alpha",i:C}),l(p(k),g)},disabled:r,testIdPrefix:`${a}-alpha-stop`}),o.jsx("div",{"data-testid":`${a}-preview`,style:{height:20,borderRadius:v.radiusSmall,border:`1px solid ${v.border}`,backgroundImage:`linear-gradient(90deg, ${d}), repeating-linear-gradient(45deg, #777 0 5px, #aaa 5px 10px)`}}),o.jsx(dt,{stops:t.color.keys.map(i=>({position:i.pos,css:jt(i.value)})),selected:s.track==="color"?s.i:-1,onSelect:i=>c({track:"color",i}),onMove:(i,f,g)=>{const{keys:k,index:C}=et(t.color.keys,i,f);c({track:"color",i:C}),l(u(k),g)},disabled:r,testIdPrefix:`${a}-color-stop`}),s.track==="color"&&b&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(Y,{testId:`${a}-color-swatch`,value:jt(b.value),disabled:r,onChange:i=>l(u(t.color.keys.map((f,g)=>g===s.i?{...f,value:vt(i)}:f)),!1),onChangeEnd:i=>l(u(t.color.keys.map((f,g)=>g===s.i?{...f,value:vt(i)}:f)),!0)}),o.jsxs("span",{style:{fontSize:9,color:v.textMuted},children:["Color ",s.i+1,"/",t.color.keys.length]}),t.color.keys.length>2&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove color stop","data-testid":`${a}-remove-color-stop`,onClick:()=>{const i=t.color.keys.filter((f,g)=>g!==s.i);c({track:"color",i:Math.min(s.i,i.length-1)}),l(u(i),!0)},children:"×"}),o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":`${a}-add-color-stop`,onClick:()=>{const f=tt(t.color.keys,.5,$t)??{r:1,g:1,b:1},{keys:g,index:k}=et([...t.color.keys,{value:f,pos:.5}],t.color.keys.length,.5);c({track:"color",i:k}),l(u(g),!0)},children:"+ stop"})]}),s.track==="alpha"&&m&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(Dt,{label:"a",step:.05,testId:`${a}-alpha-value`,value:Math.round(m.value*1e3)/1e3,onChange:i=>l(p(t.alpha.keys.map((f,g)=>g===s.i?{...f,value:Math.max(0,Math.min(1,i))}:f)),!1),onChangeEnd:i=>l(p(t.alpha.keys.map((f,g)=>g===s.i?{...f,value:Math.max(0,Math.min(1,i))}:f)),!0)}),o.jsxs("span",{style:{fontSize:9,color:v.textMuted},children:["Alpha ",s.i+1,"/",t.alpha.keys.length]}),t.alpha.keys.length>2&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove alpha stop","data-testid":`${a}-remove-alpha-stop`,onClick:()=>{const i=t.alpha.keys.filter((f,g)=>g!==s.i);c({track:"alpha",i:Math.min(s.i,i.length-1)}),l(p(i),!0)},children:"×"}),o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":`${a}-add-alpha-stop`,onClick:()=>{const f=tt(t.alpha.keys,.5,V)??1,{keys:g,index:k}=et([...t.alpha.keys,{value:f,pos:.5}],t.alpha.keys.length,.5);c({track:"alpha",i:k}),l(p(g),!0)},children:"+ stop"})]})]})}const te={x:0,y:4,blur:8,spread:0,color:"rgba(0,0,0,0.25)",inset:!1,enabled:!0},ee={x:0,y:2,blur:4,spread:0,color:"rgba(0,0,0,0.3)",inset:!1,enabled:!0};function ne(t,e){return(e?[t.inset?"inset":"",`${t.x}px`,`${t.y}px`,`${t.blur}px`,`${t.spread}px`,t.color]:[`${t.x}px`,`${t.y}px`,`${t.blur}px`,t.color]).filter(Boolean).join(" ")}function je(t,e=!0){const n=t.filter(r=>r.enabled);return n.length===0?"none":n.map(r=>ne(r,e)).join(", ")}function re(t){const e=t.match(/(rgba?\([^)]+\))/);if(e?.[1])return{color:e[1],nums:t.replace(e[1],"").trim()};const n=t.match(/(#[0-9a-fA-F]{3,8})/);return n?.[1]?{color:n[1],nums:t.replace(n[1],"").trim()}:{color:"#000000",nums:t}}function oe(t,e){if(!t||t==="none")return null;const n=t.trim(),r=e&&n.startsWith("inset"),a=r?n.slice(5).trim():n,{color:s,nums:c}=re(a),l=c.split(/\s+/).map(u=>Number.parseFloat(u)).filter(u=>!Number.isNaN(u));return e?{inset:r,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:l[3]??0,color:s}:l.length<2?null:{inset:!1,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:0,color:s}}function ve(t,e=!0){if(!t||t==="none")return[];const n=t.split(/,\s*(?![^(]*\))/),r=[];for(const a of n){const s=oe(a.trim(),e);s&&r.push({...s,enabled:!0})}return r}function Rt({value:t,onChange:e,onChangeEnd:n,disabled:r,withSpreadInset:a=!0,label:s="Shadow",testId:c="shadow-editor",recentColors:l,onAddRecentColor:u}){const p=(m,i)=>{i?B({onChange:e,onChangeEnd:n},m):N({onChange:e},m)},h=(m,i,f=!1)=>{p(t.map((g,k)=>k===m?{...g,...i}:g),f)},d=m=>{p(t.filter((i,f)=>f!==m),!0)},b=()=>{p([...t,{...a?te:ee}],!0)};return o.jsxs("div",{"data-testid":c,children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:t.length>0?4:0},children:[o.jsx("span",{style:{fontSize:9,color:v.textMuted},children:s}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","data-testid":`${c}-add`,onClick:b,children:"+"})]}),t.map((m,i)=>{const f=m.color.startsWith("#")?m.color:Mt(m.color);return o.jsxs("div",{"data-testid":`${c}-row-${i}`,style:{marginBottom:6,padding:"4px 0",borderBottom:`1px solid ${v.border}`},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-pressed":m.enabled,"data-testid":`${c}-toggle-${i}`,onClick:()=>{r||h(i,{enabled:!m.enabled},!0)},children:m.enabled?"●":"○"}),o.jsx(Y,{testId:`${c}-color-${i}`,value:f,disabled:r,onChange:g=>h(i,{color:g}),onChangeEnd:g=>h(i,{color:g},!0),recentColors:l,onAddRecentColor:u}),a&&o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:2,fontSize:8,color:v.textMuted,cursor:"pointer"},children:[o.jsx(Ft,{className:"volter-checkbox","data-testid":`${c}-inset-${i}`,checked:m.inset,disabled:r,onChange:g=>h(i,{inset:g.target.checked},!0)}),"in"]}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(L,{type:"button",variant:"ghost",size:"compact","aria-label":`Remove ${s.toLowerCase()} ${i+1}`,"data-testid":`${c}-remove-${i}`,onClick:()=>d(i),children:"×"})]}),m.enabled&&o.jsxs("div",{style:{display:"flex",gap:4},children:[o.jsx(A,{label:"X",value:m.x,disabled:r,onChange:g=>h(i,{x:g}),onChangeEnd:g=>h(i,{x:g},!0),style:{flex:1}}),o.jsx(A,{label:"Y",value:m.y,disabled:r,onChange:g=>h(i,{y:g}),onChangeEnd:g=>h(i,{y:g},!0),style:{flex:1}}),o.jsx(A,{label:"B",value:m.blur,min:0,disabled:r,onChange:g=>h(i,{blur:Math.max(0,g)}),onChangeEnd:g=>h(i,{blur:Math.max(0,g)},!0),style:{flex:1}}),a&&o.jsx(A,{label:"S",value:m.spread,disabled:r,onChange:g=>h(i,{spread:g}),onChangeEnd:g=>h(i,{spread:g},!0),style:{flex:1}})]})]},i)})]})}function $e(t){return o.jsx(Rt,{...t,withSpreadInset:!0,testId:"box-shadow-editor",label:t.label??"Shadow"})}function we(t){return o.jsx(Rt,{...t,withSpreadInset:!1,testId:"text-shadow-editor",label:t.label??"Text Shadow"})}export{ce as A,pe as B,Y as C,te as D,me as F,be as G,ye as Q,A as S,we as T,ue as a,fe as b,qt as c,he as d,ve as e,$e as f,je as g,ge as h,Xt as i,Yt as j,de as k,Gt as l,ee as m,dt as n,Rt as o,xe as p,Vt as q,Wt as u};
@@ -1 +1 @@
1
- import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{b5 as m,al as n,b6 as x,b7 as C,b8 as $,aC as V}from"./index-D9mY4HWY.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{J as E,C as N,c as A}from"./JsonAssetDocument-CcbpdU55.js";import{AudioViewer as H}from"./AudioViewer-7fv2_fIl.js";import{ImageViewer as R}from"./ImageViewer-CxnMTLaT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";function k(t){const e=(t.split(/[?#]/,1)[0]??"").replace(/^\//,"");return e.startsWith("src/")&&/\.(?:[cm]?[jt]sx?)$/.test(e)}function j(t){const e=C(t);return e.editor==="model"?"model":e.editor==="image"?"image":e.editor==="audio"?"audio":e.editor==="data"?"json":e.editor==="environment"?"environment":e.format==="cube"?"lut":e.format==="glsl"||e.format==="vert"||e.format==="frag"?"shader":k(t)?"module":e.editor==="source"&&e.previewable?"text":"binary"}function b({documentId:t,assetPath:e,active:i=!0}){const[o,l]=f.useState(null),[c,u]=f.useState(null),y=e.split("/").pop()??e;return f.useEffect(()=>{let a=!1;l(null),u(null);const w=e.replace(/^\//,"");let d=0;async function h(){const g=++d;try{const s=`/__editor/source-file?path=${encodeURIComponent(w)}`,S=await fetch(s,{cache:"no-store"}).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.text()});!a&&g===d&&(l(S),u(null))}catch(s){!a&&g===d&&u(s instanceof Error?s.message:String(s))}}const v=$();return h(),()=>{a=!0,v()}},[e]),r.jsx(m,{documentId:t,active:i,type:"source",title:y,sections:[],status:`source · ${e}`,fill:!0,children:r.jsx("div",{style:{padding:12,height:"100%",minHeight:0,display:"flex",flexDirection:"column",gap:8},children:r.jsx("div",{style:{padding:8,flex:1,minHeight:0,display:"flex",overflow:"hidden",background:n.surface.inset,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},children:c!==null||o===null?r.jsx("div",{style:{fontFamily:n.typography.mono,fontSize:11,lineHeight:1.5,color:c?n.semantic.danger:n.content.muted,padding:4},children:c??"Loading…"}):r.jsx(N,{value:o,followChanges:!0,language:A(e),fontSize:11,maxHeight:"100%",ariaLabel:`Source of ${e}`})})})})}function z({documentId:t,assetPath:e,active:i}){const o=e.split("/").pop()??e;return r.jsx(m,{documentId:t,active:i,type:"source",title:o,sections:[],status:`no viewer · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:["No editor package in this project renders ",o,"; the file is available in the project and stays selectable and referenceable."]})})}function K({documentId:t,assetPath:e,active:i=!0}){switch(j(e)){case"model":case"environment":case"lut":case"shader":{const o=j(e);return r.jsx(x,{route:o,documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,whenUnregistered:r.jsx(z,{documentId:t,assetPath:e,active:i})})}case"image":return r.jsx(R,{assetPath:e});case"audio":return r.jsx(H,{assetPath:e});case"json":return r.jsx(E,{documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,sections:[],status:`json · ${e}`});case"module":{const o=V()?.rootPath,l=r.jsx(b,{documentId:t,assetPath:e,active:i});return o?r.jsx(x,{route:"module",documentId:t,assetPath:e,projectRoot:o,displayName:e.split("/").pop()??e,active:i,fallback:l,whenUnregistered:l}):l}case"text":return r.jsx(b,{documentId:t,assetPath:e,active:i});case"binary":return r.jsx(m,{documentId:t,active:i,type:"binary source",title:e.split("/").pop()??e,sections:[],status:`binary · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:[r.jsx("div",{style:{color:n.content.primary,fontWeight:600,marginBottom:6},children:e.split("/").pop()}),"This binary source is available in the project, but it has no safe in-editor renderer. Its file remains selectable and referenceable without being misidentified as another format."]})})}}export{K as SourceAssetViewer,j as sourceAssetRoute};
1
+ import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{b5 as m,al as n,b6 as x,b7 as C,b8 as $,aC as V}from"./index-DBIFLhzt.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{J as E,C as N,c as A}from"./JsonAssetDocument-Xr6gjvcn.js";import{AudioViewer as H}from"./AudioViewer-Bjv_IoEK.js";import{ImageViewer as R}from"./ImageViewer-BcGUTWQl.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";function k(t){const e=(t.split(/[?#]/,1)[0]??"").replace(/^\//,"");return e.startsWith("src/")&&/\.(?:[cm]?[jt]sx?)$/.test(e)}function j(t){const e=C(t);return e.editor==="model"?"model":e.editor==="image"?"image":e.editor==="audio"?"audio":e.editor==="data"?"json":e.editor==="environment"?"environment":e.format==="cube"?"lut":e.format==="glsl"||e.format==="vert"||e.format==="frag"?"shader":k(t)?"module":e.editor==="source"&&e.previewable?"text":"binary"}function b({documentId:t,assetPath:e,active:i=!0}){const[o,l]=f.useState(null),[c,u]=f.useState(null),y=e.split("/").pop()??e;return f.useEffect(()=>{let a=!1;l(null),u(null);const w=e.replace(/^\//,"");let d=0;async function h(){const g=++d;try{const s=`/__editor/source-file?path=${encodeURIComponent(w)}`,S=await fetch(s,{cache:"no-store"}).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.text()});!a&&g===d&&(l(S),u(null))}catch(s){!a&&g===d&&u(s instanceof Error?s.message:String(s))}}const v=$();return h(),()=>{a=!0,v()}},[e]),r.jsx(m,{documentId:t,active:i,type:"source",title:y,sections:[],status:`source · ${e}`,fill:!0,children:r.jsx("div",{style:{padding:12,height:"100%",minHeight:0,display:"flex",flexDirection:"column",gap:8},children:r.jsx("div",{style:{padding:8,flex:1,minHeight:0,display:"flex",overflow:"hidden",background:n.surface.inset,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},children:c!==null||o===null?r.jsx("div",{style:{fontFamily:n.typography.mono,fontSize:11,lineHeight:1.5,color:c?n.semantic.danger:n.content.muted,padding:4},children:c??"Loading…"}):r.jsx(N,{value:o,followChanges:!0,language:A(e),fontSize:11,maxHeight:"100%",ariaLabel:`Source of ${e}`})})})})}function z({documentId:t,assetPath:e,active:i}){const o=e.split("/").pop()??e;return r.jsx(m,{documentId:t,active:i,type:"source",title:o,sections:[],status:`no viewer · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:["No editor package in this project renders ",o,"; the file is available in the project and stays selectable and referenceable."]})})}function K({documentId:t,assetPath:e,active:i=!0}){switch(j(e)){case"model":case"environment":case"lut":case"shader":{const o=j(e);return r.jsx(x,{route:o,documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,whenUnregistered:r.jsx(z,{documentId:t,assetPath:e,active:i})})}case"image":return r.jsx(R,{assetPath:e});case"audio":return r.jsx(H,{assetPath:e});case"json":return r.jsx(E,{documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,sections:[],status:`json · ${e}`});case"module":{const o=V()?.rootPath,l=r.jsx(b,{documentId:t,assetPath:e,active:i});return o?r.jsx(x,{route:"module",documentId:t,assetPath:e,projectRoot:o,displayName:e.split("/").pop()??e,active:i,fallback:l,whenUnregistered:l}):l}case"text":return r.jsx(b,{documentId:t,assetPath:e,active:i});case"binary":return r.jsx(m,{documentId:t,active:i,type:"binary source",title:e.split("/").pop()??e,sections:[],status:`binary · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:[r.jsx("div",{style:{color:n.content.primary,fontWeight:600,marginBottom:6},children:e.split("/").pop()}),"This binary source is available in the project, but it has no safe in-editor renderer. Its file remains selectable and referenceable without being misidentified as another format."]})})}}export{K as SourceAssetViewer,j as sourceAssetRoute};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DHhMOs_s.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/stage-transform-tools-i3ajje5q.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-DBIFLhzt.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-CPiRKiDC.css","assets/editor-shell-store-CLsRck8r.js","assets/output-pass-HurwNl0G.js","assets/Pass-D1MRT672.js","assets/editor-layers-psmpPtJ8.js","assets/workspace-arrangement-B2HQOv9w.js","assets/user-data-FwfU1u6l.js","assets/entity-object-CI5Ws16u.js","assets/three-contract-Dkt6PmWY.js","assets/Toolbar-CxS4bdaI.js","assets/transform-mode-request-BuKv4Vre.js","assets/three-state-DnYP1ZtA.js","assets/standard-viewport-dressing-BfmTiIR4.js","assets/content-bounds-DMLXg0Ob.js","assets/hierarchy-marks-BUeQ6to3.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/preview-renderer-BrYNFV1p.js","assets/renderer-ownership-BovSEcLv.js","assets/live-mixers-B-bwLZ7c.js","assets/live-gesture-lock-DJbrjOqf.js","assets/three-integration-BG2YybqE.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/layered-pick-C0UzN9rC.js","assets/root-stacking-BEd9ZvxC.js","assets/model-thumbnail-DQHRVOqE.js","assets/studio-environment-Kj8vdH82.js","assets/KTX2Loader-CaqVE6nY.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/object3d-document-session-registry-DYr6Iepm.js","assets/component-instance-root-BNr-40yw.js","assets/viewport-door-CQdsFqWV.js","assets/asset-preview-C_0EqGmT.js","assets/bitmap-label-Ct4k6ehY.js","assets/model-inspection-BajTg63P.js","assets/three-viewport-presentation-BHtVY2rJ.js","assets/clip-planes-CnAI6DZn.js","assets/three-43Ky3-7O.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/OrbitControls-B13MKuwC.js","assets/LineSegments2-DN9pUfWA.js","assets/three.quarks.esm-C_HmSKXo.js","assets/scene-framing-DFvmwkrW.js","assets/source-object3d-authoring-adapter-CzJdhhwn.js","assets/three-projection-core-BKmXcOPL.js","assets/editor-presentation-activity-CqJH4G9t.js","assets/transport-strip-BmlKGYbk.js","assets/viewport-surface-status-_DF-oTje.js","assets/stage-overlay-set-BdCP3eMw.js","assets/TransientHint-D61eMqKf.js","assets/ViewportShadingMenu-DTn7jMyb.js","assets/stage-keyboard-7_1scYGH.js","assets/camera-authoring-DYjhU5Zp.js","assets/stage-presence-markers-DT5j8fjP.js","assets/collaboration-presence-B_rzt_Ua.js"])))=>i.map(i=>d[i]);
2
+ import{kP as Sr,lo as lr,kW as Ie,Z as os,eV as Fn,lt as Dn,_ as Ke,G as Hn,lu as Bn,j1 as Ns,bw as qe,aM as Te,a7 as we,bz as _n,bN as zn,a6 as Ne,lv as Wn,bP as In,de as Nn,aL as as,df as cs,lw as $s,lx as $n,iX as Gn,bq as fr,br as ls,bs as ct,al as Ue,eo as qn,ly as Un,lz as Kn,a8 as ve,ak as Xn,lA as Yn,lB as Zn,lC as Qn,lD as Jn,lE as ei,hj as ti,lF as ri,b5 as si,lG as Gs,aQ as ni,gK as ii,lH as us,lI as hs,lJ as ds,b1 as ps,kO as fs,fA as ms,lK as oi,F as ai,bu as ci,bt as gs,lL as li,bK as ui,j4 as hi,gk as vs,lM as di,lN as pi,lO as fi,he as mi,dI as gi,kX as vi,kN as wi,fV as bi,ge as yi,lP as ws,B as Si,lQ as xi,bR as Pi}from"./index-DBIFLhzt.js";import{a as d}from"./jsx-runtime-DPjLkJKQ.js";import{t as mr,a as Ci}from"./three-state-DnYP1ZtA.js";import{i as D,b as ki,a as Ei,w as Oi,c as Mi,s as bs}from"./standard-viewport-dressing-BfmTiIR4.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{a as gr}from"./content-bounds-DMLXg0Ob.js";import{EDITOR_LAYER as qs,isInEditorOwnedSubtree as Ri}from"./editor-layers-psmpPtJ8.js";import{createStandardEnvironment as ji}from"./environment-Dg-YaLsA.js";import{a as Ti}from"./preview-renderer-BrYNFV1p.js";import{s as Us}from"./user-data-FwfU1u6l.js";import{s as Vi,a as Ai}from"./live-mixers-B-bwLZ7c.js";import{n as Li,bh as At,N as Ks,M as Xs,dg as Ys,df as Zs,fo as H,_ as me,d5 as vr,d9 as Fi,L as ys,I as wr,ez as Di,dp as Ss,cj as br,em as Hi,cp as Bi,c0 as _i,aO as zi,bX as Wi,fx as xs,bi as Ii,eu as Ni,cg as fe,T as $i,ej as Qs,el as Js,A as Gi,d7 as qi,eW as Ps,fd as Tt,e6 as Cs,cm as ks}from"./three.core-3arARmh6.js";import{l as Ui,w as Ki}from"./live-gesture-lock-DJbrjOqf.js";import{v as Xi}from"./output-pass-HurwNl0G.js";import{V as Yi,a as Zi}from"./three-integration-BG2YybqE.js";import{a as Ve}from"./three-contract-Dkt6PmWY.js";import{d as Lt,f as Qi}from"./model-inspection-BajTg63P.js";import{c as Ji,p as Vt,d as Es,i as Os,r as eo,b as to,a as ro,t as Ms,s as Rs,C as so,e as no,f as io,E as oo}from"./three-viewport-presentation-BHtVY2rJ.js";import{s as yr}from"./workspace-arrangement-B2HQOv9w.js";import{a as ao,b as co,L as lo}from"./LineSegments2-DN9pUfWA.js";import{s as uo,o as ho,a as po,b as fo}from"./object3d-document-session-registry-DYr6Iepm.js";import{S as mo}from"./source-object3d-authoring-adapter-CzJdhhwn.js";import{s as go,i as ur}from"./editor-presentation-activity-CqJH4G9t.js";import{r as js,c as Ts}from"./viewport-door-CQdsFqWV.js";import{T as vo}from"./transport-strip-BmlKGYbk.js";import{V as wo,O as bo}from"./viewport-surface-status-_DF-oTje.js";import{t as en}from"./editor-shell-store-CLsRck8r.js";const tn=30;function rn(n,e,t){return n<e?e:n>t?t:n}function yo(n,e){const t=n.animations;if(t.length===0)return null;const s=new Li(n);let i=t[0];if(!i)return null;const a=o=>{s.stopAllAction();const l=s.clipAction(o);l.paused=!1,l.play(),i=o};a(i);const c=e.attach({id:n.uuid,label:n.name||i.name||"Clip",range:()=>({start:0,end:i?.duration??0,fps:tn}),seek:o=>{s.setTime(rn(o,0,i?.duration??0))},clips:()=>t.map(o=>({id:o.name,label:o.name})),setClip:o=>{const l=t.find(p=>p.name===o);l&&a(l)}});return()=>{c(),s.stopAllAction(),s.uncacheRoot(n)}}function So(n,e){const t=Ai(n);if(!t)return null;let s=t.clips.values().next().value;if(!s)return null;const i=c=>{t.mixer.stopAllAction();const o=t.mixer.clipAction(c);o.paused=!1,o.play(),s=c};return e.attach({id:n.uuid,label:n.name||s.name||"Animation",range:()=>({start:0,end:s?.duration??0,fps:tn}),seek:c=>{t.mixer.setTime(rn(c,0,s?.duration??0))},clips:()=>[...t.clips.entries()].map(([c,o])=>({id:c,label:o.name||c})),setClip:c=>{const o=t.clips.get(c);o&&i(o)}})}function Vs(n,e,t={}){const s=new Map,i=()=>{const o=new Set;(typeof n=="function"?n():n)?.traverse(p=>{if(s.has(p.uuid)){o.add(p.uuid);return}const P=So(p,e)??yo(p,e);P&&(s.set(p.uuid,P),o.add(p.uuid))});for(const[p,P]of[...s])o.has(p)||(P(),s.delete(p))};i();const a=t.rescanOnLiveMixers,c=a?Vi(()=>{a()&&i()}):()=>{};return{refresh:i,dispose:()=>{c();for(const o of s.values())o();s.clear()}}}const ke=()=>globalThis.performance?.now()??Date.now();function xo(n,e){return n.length===0?0:n[Math.min(n.length-1,Math.floor((n.length-1)*e))]??0}function Po(n=!1){const e=new Set,t=[],s=new Map,i=new Map,a=new Map;let c=[],o=[],l=n,p=!1,P=!1,w=0,x=0,S=0;const z=[];let B=0,E=0,C={gpuMs:null,drawCalls:0,triangles:0,geometries:0,textures:0,renderPasses:null},W={enabled:l,recording:P,fps:0,cpuMs:0,p95Ms:0,p99Ms:0,frames:[],phases:[],systems:[],components:[],render:C};function Q(){const y=t.at(-1),$=t.slice();let _;const K=L=>(_??=$.map(X=>X.intervalMs).filter(X=>X>0).sort((X,V)=>X-V),xo(_,L));W={enabled:l,recording:P,fps:y?.intervalMs?1e3/y.intervalMs:0,cpuMs:y?.cpuMs??0,get p95Ms(){return K(.95)},get p99Ms(){return K(.99)},frames:$,phases:y?.phases??[],systems:[...i].map(([L,X])=>({name:L,ms:X})).sort((L,X)=>X.ms-L.ms),components:[...a].map(([L,X])=>({name:L,ms:X})).sort((L,X)=>X.ms-L.ms),render:C};for(const L of e)L()}return{get enabled(){return l},set enabled(y){l!==y&&(l=y,y&&!p&&(S=0),Q())},get telemetryEnabled(){return p},set telemetryEnabled(y){if(p===y)return;const $=!l&&!p;p=y,y&&$&&(S=0),Q()},get recording(){return P},startRecording(){const y=!l&&!p;l=!0,y&&(S=0),P=!0,t.length=0,Q()},stopRecording(){P=!1,Q()},clear(){t.length=0,Q()},beginFrame(){!l&&!p||(s.clear(),i.clear(),a.clear(),c=[],o=[],z.length=0,C={gpuMs:null,drawCalls:0,triangles:0,geometries:0,textures:0,renderPasses:null},x=ke())},beginPhase(){l&&z.push(ke())},endPhase(y){if(!l)return;const $=z.pop()??x,_=ke()-$,K=s.get(y);s.set(y,{ms:(K?.ms??0)+_,startMs:K?.startMs??$-x}),P&&performance.measure(`volter.phase.${y}`,{start:$,duration:_})},systemObserver:{beginSystem(){l&&(B=ke())},endSystem(y,$,_){if(!l)return;const K=ke(),L=`${y} / ${$} / ${_}`;i.set(L,(i.get(L)??0)+K-B),c.push({name:L,phase:$,startMs:B-x,ms:K-B})}},beginComponent(){P&&(E=ke())},endComponent(y,$=""){if(!P)return;const _=ke();a.set(y,(a.get(y)??0)+_-E),o.push({name:y,phase:$,startMs:E-x,ms:_-E})},reportRender(y){l&&(C={gpuMs:y.gpuMs??C.gpuMs,drawCalls:C.drawCalls+y.drawCalls,triangles:C.triangles+y.triangles,geometries:C.geometries+y.geometries,textures:C.textures+y.textures,renderPasses:y.renderPasses===void 0?C.renderPasses:(C.renderPasses??0)+y.renderPasses})},endFrame(){if(!l&&!p)return;const y=ke(),$=S===0?0:x-S;S=x;const _={id:++w,timestamp:y,intervalMs:$,cpuMs:y-x,phases:[...s].map(([K,{ms:L,startMs:X}])=>({name:K,ms:L,startMs:X})).sort((K,L)=>L.ms-K.ms),systems:c.slice(),components:o.slice(),render:{...C}};t.push(_),t.length>600&&t.splice(0,t.length-600),P&&performance.measure("volter.frame",{start:x,duration:_.cpuMs}),Q()},subscribe(y){return e.add(y),()=>{e.delete(y)}},getSnapshot(){return W},exportJSON(){return JSON.stringify({version:2,capturedAt:new Date().toISOString(),frames:t},null,2)}}}class Co extends At{constructor(e,t){super(),this.bones=e;const s=new Set;for(const o of e){const l=o.parent;l?.isBone&&this.addSegment(l,o,s);for(const p of o.children)p.isBone&&this.addSegment(o,p,s)}this.linePositions=new Float32Array(Math.max(this.segments.length*6,6));const i=new ao;i.setPositions(this.linePositions),this.lineMaterial=new co({color:t,linewidth:5,worldUnits:!1,depthTest:!1,depthWrite:!1,toneMapped:!1,alphaToCoverage:!0}),this.lines=new lo(i,this.lineMaterial),this.lines.onBeforeRender=o=>{o.getSize(this.lineMaterial.resolution)},this.lines.frustumCulled=!1,this.lines.renderOrder=1001,this.add(this.lines),this.pointPositions=new Float32Array(Math.max(e.length*3,3));const a=new Ks;a.setAttribute("position",new Xs(this.pointPositions,3));const c=new Ys({color:t,size:11,sizeAttenuation:!1,depthTest:!1,depthWrite:!1,toneMapped:!1});this.points=new Zs(a,c),this.points.frustumCulled=!1,this.points.renderOrder=1002,this.add(this.points),this.name="__object3d_document_bone_selection",yr(this,"editorHelper",!0),this.traverse(o=>o.layers.set(qs)),this.update()}segments=[];linePositions;pointPositions;lines;lineMaterial;points;worldPosition=new H;setColor(e){this.lineMaterial.color.setHex(e),this.points.material.color.setHex(e)}update(){let e=0;for(const[i,a]of this.segments)i.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e),a.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e+3),e+=6;const t=this.lines.geometry.getAttribute("instanceStart");t&&(t.data.needsUpdate=!0),e=0;for(const i of this.bones)i.getWorldPosition(this.worldPosition),this.pointPositions.set(this.worldPosition.toArray(),e),e+=3;const s=this.points.geometry.getAttribute("position");s&&(s.needsUpdate=!0)}dispose(){this.lines.geometry.dispose(),this.lineMaterial.dispose(),this.points.geometry.dispose(),this.points.material.dispose()}addSegment(e,t,s){const i=`${e.uuid}:${t.uuid}`;s.has(i)||(s.add(i),this.segments.push([e,t]))}}const ko="skeletons",hr=new me(58879),dr=new me(16756736);function Eo(n){const e=n.geometry.getAttribute("color");for(let s=0;s<e.count;s+=2)e.setXYZ(s,hr.r,hr.g,hr.b),s+1<e.count&&e.setXYZ(s+1,dr.r,dr.g,dr.b);e.needsUpdate=!0,n.renderOrder=999;const t=n.material;t.depthTest=!1,t.depthWrite=!1,t.toneMapped=!1,yr(n,"editorHelper",!0),yr(n,"editorHelperType",ko),n.traverse(s=>s.layers.set(qs))}const Oo=1,Mo=700,Ro=.001,jo=Math.PI-.001,To=n=>n<.5?4*n*n*n:1-(-2*n+2)**3/2,Vo=n=>n;function $e(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}const As={mode:"solid",background:"neutral",projection:"perspective",skeleton:!1,bounds:!1},Ls=1119773;class Ao{constructor(e,t,s,i,a,c,o=new me(2106410),l=null){this.documentId=e,this.root=t,this.scene=s,this.renderer=i,this.viewport=a,this.authoring=c,this.neutralBackground=o,this.frameBox=l,this.unsubscribeSelectionTheme=Sr(i.domElement,this.syncSelectionTheme),a.orbitControls.addEventListener("start",this.cancelLookForHuman),this.unsubscribeRotateStart=a.onRotateStart(this.autoPerspective),this.unsubscribeAxisView=a.onAxisView(this.axisView)}profiler=Po();shading=new Yi;helpers=[];skeletonHelper=null;boundsHelper=null;boneSelectionHighlight=null;boneSelectionSignature="";composer=null;composerLoading=!1;disposed=!1;sceneRenderPass=null;selectionOutline=null;selectionOutlinePass=null;selectedObjects=[];selectionOrigins=null;renderWidth=1;renderHeight=1;orthographicCamera=new vr;captureAspect=null;cameraOverride=null;cameraViewSource=null;through=null;leaving=!1;viewMemo=null;throughPerspective=new Fi;throughOrthographic=new vr;beforeRender=null;state=As;version=0;listeners=new Set;unsubscribeSelectionTheme=()=>{};flight=null;flightPose=new H;topologyOverlay=null;topologyFollowers=[];unsubscribeRotateStart;unsubscribeAxisView;axisView=()=>(this.leaveCameraView(!1),this.settleFlight("superseded"),lr().autoPerspective&&this.setProjection("orthographic"),!0);autoPerspective=()=>{if(!lr().autoPerspective||this.cameraView()!==null||this.state.projection!=="orthographic")return;const e=this.viewport.camera,t=e.position.clone().sub(this.viewport.orbitControls.target),s=new H(0,1,0).applyQuaternion(e.quaternion);Lt(t,s)!==null&&this.setProjection("perspective")};replaceContent(e,t){D(),this.selectionOutline?.selection.clear(),this.selectedObjects=[],this.boneSelectionSignature="",this.clearBoneSelectionHighlight(),this.clearSkeletonHelper(),this.clearBoundsHelper(),this.clearTopologyOverlay(),this.root=e,this.authoring=t,this.state.mode==="wireframe"&&this.buildTopologyOverlay(),this.state.bounds&&(this.boundsHelper=new ys(e,16757844),this.addHelper(this.boundsHelper,"bounds")),this.syncSelectionPresentation(),this.refreshSkeletonHelper(),this.notify()}cancelLookForHuman=()=>{this.settleFlight("human")};selectionColors=null;syncSelectionTheme=()=>{this.selectionColors=Ie(this.renderer.domElement);const e=this.selectionColors.visible;this.selectionOutline&&Ji(this.selectionOutline,Ie(this.renderer.domElement)),this.boneSelectionHighlight?.setColor(e)};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.version;presentation(){return this.state}resolveFrameBounds(e="selection"){const t=e==="all"?[]:this.authoring?.selection?.get()??[];if(t.length>0){const s=new wr;let i=!1;for(const a of t){const c=this.authoring?Ve(this.authoring.hierarchy,a):null;if(!c)continue;const o=gr(c);o.isEmpty()||(s.union(o),i=!0)}if(i)return s}return this.frameBox&&!this.frameBox.isEmpty()?this.frameBox:gr(this.root)}frame(e=1,t="selection"){this.leaveCameraView(!1);const s=this.resolveFrameBounds(t);if(s.isEmpty()){let l=0,p=0;return this.root.traverse(P=>{const w=P.geometry;w&&(l+=1,p+=w.getAttribute("position")?.count??0)}),os.warn(`frame: nothing to frame — root "${this.root.name}" (${this.root.children.length} children, ${l} meshes, ${p} positions), selection ${JSON.stringify(this.authoring?.selection?.get()??[])}, frameBox ${this.frameBox?this.frameBox.isEmpty()?"empty":"set":"none"}`,"document"),!1}this.settleFlight("superseded");const i=s.getCenter(new H),a=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize();a.lengthSq()===0&&a.set(.8,.5,-1).normalize();const c=Math.min(10,Math.max(.1,$e(e,1))),o=Vt(s,this.viewport.camera,a)*c;return this.viewport.setPose(i.clone().addScaledVector(a,o),i),!0}orbit(e){return this.launchFlight($e(e.azimuth,0),$e(e.elevation,0),Math.min(60,Math.max(0,$e(e.duration,.6))),To)}turntable(e){const t=$e(e.revolutions,1);return this.launchFlight(t*Math.PI*2,0,Math.min(60,Math.max(0,$e(e.seconds,6))),Vo)}looking(){return this.flight!==null}launchFlight(e,t,s,i){this.settleFlight("superseded");const a=this.viewport.camera,c=this.viewport.orbitControls.target.clone(),o=new Di().setFromVector3(a.position.clone().sub(c)),l=o.radius>1e-4?o.radius:Math.max(this.resolveFrameBounds().getSize(new H).length(),1),p={pivot:c,radius:l,startTheta:o.theta,startPhi:o.phi,deltaTheta:e,deltaPhi:-t,duration:s,ease:i,elapsed:0,theta:o.theta,phi:o.phi,settle:null};this.flight=p;const P=new Promise(w=>{p.settle=w});return this.applyFlightPose(p,0),s<=0&&this.settleFlight(null),P}applyFlightPose(e,t){const s=e.ease(t);e.theta=e.startTheta+e.deltaTheta*s,e.phi=Math.min(jo,Math.max(Ro,e.startPhi+e.deltaPhi*s));const i=this.viewport.camera;i.position.setFromSphericalCoords(e.radius,e.phi,e.theta).add(e.pivot),this.viewport.orbitControls.target.copy(e.pivot),i.lookAt(e.pivot),i.updateMatrixWorld(),this.flightPose.copy(i.position)}advanceLook(e){const t=this.flight;if(!t)return;const s=Math.max(1e-4,t.radius*.001);if(this.viewport.camera.position.distanceToSquared(this.flightPose)>s*s){this.settleFlight("human");return}e>0&&Number.isFinite(e)&&(t.elapsed+=e);const i=t.duration<=0?1:Math.min(1,t.elapsed/t.duration);this.applyFlightPose(t,i),i>=1&&this.settleFlight(null)}settleFlight(e){const t=this.flight;if(!t)return;this.flight=null;const s={completed:e===null,azimuth:t.theta,elevation:Math.PI/2-t.phi,seconds:Math.min(t.elapsed,t.duration)};t.settle?.(e===null?s:{...s,cancelledBy:e})}select(e){D(),this.authoring&&Fn(this.authoring,[...e])}selection(){return[...this.authoring?.selection?.get()??[]]}idForObject(e){return this.authoring?.hierarchy.idForObject3D?.(e)??null}syncSelectionPresentation(){D();const e=(this.authoring?.selection?.get()??[]).map(i=>this.authoring?Ve(this.authoring.hierarchy,i):null).filter(i=>i!==null);if(this.selectedObjects=e,this.selectionOutline&&(Es(this.selectionOutline,this.selectionOutlineWanted?e:[]),this.syncComposerOutput()),this.selectionOrigins){const i=Ie(this.renderer.domElement);this.selectionOrigins.update(e,{visible:i.visible,...i.active?{active:i.active.visible}:{}})}const t=e.filter(i=>!!i.isBone),s=t.map(i=>i.uuid).join("\0");s!==this.boneSelectionSignature&&(this.boneSelectionSignature=s,this.clearBoneSelectionHighlight(),t.length>0&&(this.boneSelectionHighlight=new Co(t,Ie(this.renderer.domElement).visible),this.scene.add(this.boneSelectionHighlight)),this.refreshSkeletonHelper())}frameSelection(){return this.frameIds(this.authoring?.selection?.get()??[])}frameIds(e){this.leaveCameraView(!1),this.settleFlight("superseded");const t=e.map(s=>this.authoring?Ve(this.authoring.hierarchy,s):null).filter(s=>s!==null);return t.length===0?!1:t.every(s=>s.isBone)?(this.frameBones(t),!0):(this.viewport.focusOnMultiple(t),!0)}setViewPreset(e,t="bounds"){D(),this.leaveCameraView(!1),this.settleFlight("superseded");const s=Qi(e);let i,a;if(t==="view")i=this.viewport.orbitControls.target.clone(),a=this.viewport.camera.position.distanceTo(i);else{const l=this.resolveFrameBounds();if(l.isEmpty())return;i=l.getCenter(new H),a=Vt(l,this.viewport.camera,s)}const c=i.clone().addScaledVector(s,a),o=e==="top"?{x:0,y:0,z:-1}:e==="bottom"?{x:0,y:0,z:1}:{x:0,y:1,z:0};this.viewport.setPose(c,i,void 0,o),this.setProjection(e==="isometric"?"perspective":"orthographic")}setCameraPose(e,t,s){D(),this.leaveCameraView(!1),this.settleFlight("superseded"),this.viewport.setPose(e,t,s)}cameraPose(){return{position:this.viewport.camera.position.toArray(),target:this.viewport.orbitControls.target.toArray(),fov:this.viewport.camera.fov}}camera(){if(this.cameraOverride)return this.cameraOverride;const e=this.drawnCamera();return this.viewport.setGizmoCamera(e===this.viewport.camera?null:e),e}drawnCamera(){const e=this.through?this.cameraView():null;return e?this.throughCamera(e):(this.through&&!this.leaving&&(this.leaving=!0,queueMicrotask(()=>{this.leaving=!1,this.through&&!this.cameraView()&&this.leaveCameraView(!1)})),this.state.projection==="perspective"?this.viewport.camera:(this.syncOrthographicCamera(),this.orthographicCamera))}setCameraViewSource(e){this.cameraViewSource!==e&&(this.cameraViewSource=e,e||this.leaveCameraView(!1),this.notify())}hasCameraView(){return this.cameraViewSource!==null}cameraView(){const e=this.through,t=this.cameraViewSource;if(!e||!t)return null;const s=this.renderer.domElement,i=this.captureAspect?{width:this.captureAspect,height:1}:{width:s.clientWidth,height:s.clientHeight},a=this.viewport.camera,c=e.locked?`${a.position.toArray().join(",")}|${a.quaternion.toArray().join(",")}`:"",o=`${e.camera}|${i.width}|${i.height}|${e.zoom}|${e.offset.join(",")}|${c}`;if(this.viewMemo?.key===o)return this.viewMemo.view;const l=t.view(e.camera,i,e.zoom,e.offset),p=l&&e.locked?{...l,position:a.position.toArray(),quaternion:a.quaternion.toArray()}:l;return this.viewMemo={key:o,view:p},queueMicrotask(()=>{this.viewMemo=null}),p}toggleCameraView(){if(this.through)return this.leaveCameraView(!0),!0;const e=this.cameraViewSource,t=e?.camera()??null;if(!e)return!1;if(t===null)return os.warn("camera view: No active camera — the scene has no camera to look through","document"),!1;D(),this.settleFlight("superseded");const s=this.viewport,i=s.orbitControls,a=i.enableDamping;return i.enableDamping=!1,i.update(),i.enableDamping=a,this.through={camera:t,zoom:e.zoom.opening,offset:[0,0],left:{position:s.camera.position.clone(),target:s.orbitControls.target.clone(),up:s.camera.up.clone(),projection:this.state.projection},release:this.captureCameraViewInput(),locked:!1},e.showing?.(t),this.notify(),!0}cameraViewLocked(){return!this.through||!this.cameraViewSource?.setPose?null:this.through.locked}toggleCameraViewLock(){const e=this.through,t=this.cameraViewSource;if(!(!e||!t?.setPose)){if(e.release(),e.locked=!e.locked,!e.locked)e.release=this.captureCameraViewInput();else{const s=this.cameraView(),i=this.viewport.orbitControls,a=this.viewport.camera;if(s){const E=new H(...s.position),C=new Ss(...s.quaternion),W=e.left.position.distanceTo(e.left.target);a.up.set(0,1,0).applyQuaternion(C),a.position.copy(E),a.quaternion.copy(C),i.target.copy(E).addScaledVector(new H(0,0,-1).applyQuaternion(C),W),i.update()}const c=i.enabled;i.enabled=!0;const o=i.enableDamping;i.enableDamping=!1;const l=e.camera,p=E=>({position:a.position.toArray(),quaternion:a.quaternion.toArray(),final:E});let P=!1,w=null,x=!1;const S=E=>{if(P){w={...E,final:E.final||(w?.final??!1)};return}P=!0,w=null,Promise.resolve(t.setPose(l,E.position,E.quaternion,E.final)).catch(()=>{}).finally(()=>{P=!1,w&&S(w)})},z=()=>{x=!0,D(),this.notify(),S(p(!1))},B=()=>{x&&(x=!1,S(p(!0)))};i.addEventListener("change",z),i.addEventListener("end",B),e.release=()=>{B(),i.removeEventListener("change",z),i.removeEventListener("end",B),i.enabled=c,i.enableDamping=o}}this.viewMemo=null,D(),this.notify()}}cameraViewZoom(){return this.through?.zoom??null}setCameraViewZoom(e){const t=this.through,s=this.cameraViewSource;!t||!s||!Number.isFinite(e)||e<=0||(t.zoom=Math.min(s.zoom.max,Math.max(s.zoom.min,e)),D(),this.notify())}zoomCameraView(e){this.through&&this.setCameraViewZoom(this.through.zoom*e)}panCameraView(e,t){const s=this.through,i=this.cameraViewSource;if(!s||!i)return;const[a,c]=i.pan(s.offset,s.zoom,e,t);s.offset=[a,c],D(),this.notify()}leaveCameraView(e){const t=this.through;if(!t)return;const s=this.cameraView();t.release(),this.through=null,this.viewMemo=null,this.cameraViewSource?.showing?.(null),this.viewport.setGizmoCamera(null);const i=this.viewport;if(e)i.camera.position.copy(t.left.position),i.camera.up.copy(t.left.up),i.orbitControls.target.copy(t.left.target),this.state={...this.state,projection:t.left.projection};else if(s){const a=t.left.position.distanceTo(t.left.target),c=new H(...s.position),o=new Ss(...s.quaternion),l=new H(0,0,-1).applyQuaternion(o);i.camera.up.set(0,1,0).applyQuaternion(o),i.camera.position.copy(c),i.orbitControls.target.copy(c).addScaledVector(l,a);const p=Lt(t.left.position.clone().sub(t.left.target),t.left.up)!==null,P=lr().autoPerspective&&p?"perspective":t.left.projection;this.state={...this.state,projection:P}}i.camera.lookAt(i.orbitControls.target),i.orbitControls.update(),D(),this.notify()}throughCamera(e){const{left:t,right:s,top:i,bottom:a}=e.window,c=this.viewport.camera.layers.mask;if(e.projection==="orthographic"){const l=this.throughOrthographic;return Object.assign(l,{left:t,right:s,top:i,bottom:a,near:e.near,far:e.far,zoom:1}),l.position.set(...e.position),l.quaternion.set(...e.quaternion),l.layers.mask=c,l.updateProjectionMatrix(),l.updateMatrixWorld(!0),l}const o=this.throughPerspective;return o.near=e.near,o.far=e.far,o.fov=br.radToDeg(2*Math.atan((i-a)/2)),o.aspect=(s-t)/(i-a),o.zoom=1,o.position.set(...e.position),o.quaternion.set(...e.quaternion),o.layers.mask=c,o.projectionMatrix.makePerspective(t*e.near,s*e.near,i*e.near,a*e.near,e.near,e.far),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.updateMatrixWorld(!0),o}captureCameraViewInput(){const e=this.viewport.orbitControls,t=this.renderer.domElement,s=t.parentElement??t,i=e.enabled;e.enabled=!1;const a=o=>{o.target!==t||o.deltaY===0||(o.preventDefault(),this.zoomCameraView(o.deltaY<0?1.2:1/1.2))},c=o=>{if(o.target!==t)return;const l=e.mouseButtons;let p=[l.LEFT,l.MIDDLE,l.RIGHT][o.button]??null;const P=o.ctrlKey||o.metaKey||o.shiftKey;if(o.button===1&&(o.ctrlKey||o.metaKey)&&p===fe.ROTATE?p=fe.DOLLY:P&&p===fe.ROTATE?p=fe.PAN:P&&p===fe.PAN&&(p=fe.ROTATE),p===fe.ROTATE){this.leaveCameraView(!1);return}if(p!==fe.PAN&&p!==fe.DOLLY)return;o.preventDefault();const w=t.getBoundingClientRect();let x=o.clientX,S=o.clientY;const z=this.through?.zoom??1,B=Math.max(5+o.clientY-w.top,1),E=W=>{if(p===fe.PAN){this.panCameraView((W.clientX-x)/Math.max(w.width,1),(W.clientY-S)/Math.max(w.height,1)),x=W.clientX,S=W.clientY;return}const Q=Math.max(.01,2*((5+W.clientY-w.top)/B-1)+1);this.setCameraViewZoom(z/Q)},C=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",C),window.removeEventListener("pointercancel",C)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",C),window.addEventListener("pointercancel",C)};return s.addEventListener("wheel",a,{capture:!0,passive:!1}),s.addEventListener("pointerdown",c,{capture:!0}),()=>{s.removeEventListener("wheel",a,{capture:!0}),s.removeEventListener("pointerdown",c,{capture:!0}),e.enabled=i}}projection(){return this.state.projection}setProjection(e){D(),this.state.projection!==e&&(this.state={...this.state,projection:e},this.notify())}setMode(e){D(),this.state.mode!==e&&(this.clearDiagnosticPresentation(),this.state={...this.state,mode:e},e==="uv"?this.scene.overrideMaterial=new Hi({vertexShader:"varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }",fragmentShader:"varying vec2 vUv; void main(){ gl_FragColor=vec4(vUv,0.0,1.0); }"}):e==="vertex-colors"?this.scene.overrideMaterial=new Bi({vertexColors:!0}):e==="wireframe"&&this.buildTopologyOverlay(),this.notify())}buildTopologyOverlay(){const e=new At,t=[];this.root.updateMatrixWorld(!0),this.root.traverse(s=>{const i=s;if(!i.isMesh||!i.geometry)return;const a=new _i(new zi(i.geometry,Oo),new Wi({color:Ls,toneMapped:!1,transparent:!0,opacity:.85,depthTest:!1,depthWrite:!1}));a.matrixAutoUpdate=!1,a.matrixWorldAutoUpdate=!1,a.matrixWorld.copy(i.matrixWorld),a.frustumCulled=!1,a.renderOrder=2,e.add(a),t.push({line:a,source:i})}),t.length!==0&&(this.topologyOverlay=e,this.topologyFollowers=t,this.addHelper(e,"topology"))}syncTopologyOverlay(){this.topologyFollowers.some(({source:i})=>i.parent===null)&&(this.clearTopologyOverlay(),this.buildTopologyOverlay()),this.selectionColors??=Ie(this.renderer.domElement);const e=this.selectionColors,t=this.selectedObjects.at(-1)??null,s=(i,a)=>{for(let c=i;c;c=c.parent)if(c===a)return!0;return!1};for(const{line:i,source:a}of this.topologyFollowers){i.matrixWorld.copy(a.matrixWorld),i.visible=a.visible;const c=i.material,o=t!==null&&s(a,t),l=o||this.selectedObjects.some(P=>s(a,P)),p=o?e.active?.visible??e.visible:l?e.visible:null;c.color.setHex(p??Ls)}}clearTopologyOverlay(){for(const{line:s}of this.topologyFollowers.splice(0))s.geometry.dispose(),s.material.dispose();const e=this.topologyOverlay;if(this.topologyOverlay=null,!e)return;e.removeFromParent();const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1)}setBounds(e){D(),this.state.bounds!==e&&(this.state={...this.state,bounds:e},e?(this.boundsHelper=new ys(this.root,16757844),this.addHelper(this.boundsHelper,"bounds")):this.clearBoundsHelper(),this.notify())}setSkeleton(e){D(),this.state.skeleton!==e&&(this.state={...this.state,skeleton:e},this.refreshSkeletonHelper(),this.notify())}neutralBackgroundTexture(){return this.neutralBackground}setNeutralBackground(e){D();const t=this.scene.background,s=this.neutralBackground,i=t===s||t instanceof me&&s instanceof me&&t.equals(s);this.neutralBackground=e,i&&(this.scene.background=e)}setBackground(e){D(),this.state.background!==e&&(this.scene.background=e==="transparent"?null:this.neutralBackground,this.state={...this.state,background:e},this.notify())}resetPresentation(){D(),Dn(this.documentId),this.clearDiagnosticPresentation(),this.state=As,this.refreshSkeletonHelper(),this.clearBoundsHelper(),this.scene.background=this.neutralBackground,this.viewport.camera.up.set(0,1,0),this.frame(),this.notify()}setBeforeRender(e){this.beforeRender=e}presentedFrameWaiters=[];presentsFrames=!1;setPresentsFrames(e){this.presentsFrames=e,e||this.resolvePresentedFrame(null)}requestPresentedFrame(){return this.presentsFrames?new Promise(e=>{let t=!1;const s=i=>{t||(t=!0,e(i))};this.presentedFrameWaiters.push(s),D(),setTimeout(()=>s(null),Mo)}):Promise.resolve(null)}needsFrame(){return this.flight!==null||this.presentedFrameWaiters.length>0}servePresentedFrame(){if(this.presentedFrameWaiters.length===0)return;const e=this.renderer.domElement,t=document.createElement("canvas");t.width=Math.max(1,e.width),t.height=Math.max(1,e.height);const s=t.getContext("2d");if(!s){this.resolvePresentedFrame(null);return}s.drawImage(e,0,0),this.resolvePresentedFrame(t)}resolvePresentedFrame(e){const t=this.presentedFrameWaiters;this.presentedFrameWaiters=[];for(const s of t)s(e)}render(e){this.beforeRender?.(),this.boneSelectionHighlight?.update();const t=this.camera(),s=this.state.mode;if(this.boundsHelper?.update(),this.selectionOrigins?.place(),s==="uv"||s==="vertex-colors"){e(t);return}if(s==="wireframe"&&this.topologyOverlay){if(this.syncTopologyOverlay(),this.xray.enabled&&this.xray.alpha<=0){const i=new Set;this.root.traverse(a=>{const c=a;if(c.isMesh)for(const o of Array.isArray(c.material)?c.material:[c.material])o?.visible&&(o.visible=!1,i.add(o))});try{e(t)}finally{for(const a of i)a.visible=!0}return}this.shading.render(this.scene,"clay",()=>e(t),Os);return}this.shading.render(this.scene,s,()=>e(t),Os)}renderViewport(e=0){this.advanceLook(e),this.ensureComposer(),this.render(t=>{const s=this.composer;if(!s){this.renderer.render(this.scene,t);return}s.setMainScene(this.scene),s.setMainCamera(t),s.render(e)})}resize(e,t){D(),this.renderWidth=Math.max(1,e),this.renderHeight=Math.max(1,t),this.composer?.setSize(this.renderWidth,this.renderHeight)}renderCapture(e,t){this.render(s=>{if(!t){e(s);return}const i=this.scene.background,a=this.renderer.getClearColor(new me),c=this.renderer.getClearAlpha();try{this.scene.background=null,this.renderer.setClearColor(0,0),e(s)}finally{this.scene.background=i,this.renderer.setClearColor(a,c)}})}captureImage(e=512){const t=typeof e=="number"?e:e.width,s=typeof e=="number"?e:e.height;if(!Number.isFinite(t)||t<1||!Number.isFinite(s)||s<1)return null;const i=Math.min(2048,Math.round(t)),a=Math.min(2048,Math.round(s)),c=i*2,o=a*2,l=new xs(c,o,{type:Ii}),p=new xs(c,o),P=this.renderer.getRenderTarget(),w=this.renderer.getPixelRatio(),x=this.viewport.camera,S=x.aspect;try{this.captureAspect=i/a;const z=typeof e=="number"?void 0:e.camera;z?this.cameraOverride=z:(x.aspect=i/a,x.updateProjectionMatrix()),this.renderer.setPixelRatio(1),this.renderer.setRenderTarget(l),this.renderCapture(_=>this.renderSolidForCapture(_,l,c,o),typeof e!="number"&&e.transparent===!0),Xi(typeof e!="number"&&e.transparent===!0).render(this.renderer,p,l,0,!1);const B=c*4,E=new Uint8Array(B*o);this.renderer.readRenderTargetPixels(p,0,0,c,o,E);const C=document.createElement("canvas");C.width=c,C.height=o;const W=C.getContext("2d");if(!W)return null;const Q=W.createImageData(c,o);for(let _=0;_<o;_++){const K=(o-1-_)*B,L=_*B;Q.data.set(E.subarray(K,K+B),L)}W.putImageData(Q,0,0);const y=document.createElement("canvas");y.width=i,y.height=a;const $=y.getContext("2d");return $?($.drawImage(C,0,0,i,a),y.toDataURL("image/png")):null}finally{this.captureAspect=null,this.cameraOverride=null,x.aspect=S,x.updateProjectionMatrix(),this.renderer.setRenderTarget(P),this.renderer.setPixelRatio(w),this.composer?.setSize(this.renderWidth,this.renderHeight,!1),p.dispose(),l.dispose(),D()}}dispose(){this.disposed=!0,this.leaveCameraView(!1),this.selectionOrigins?.dispose(),this.selectionOrigins=null,this.settleFlight("closed"),this.viewport.orbitControls.removeEventListener("start",this.cancelLookForHuman),this.unsubscribeRotateStart(),this.unsubscribeAxisView(),this.unsubscribeSelectionTheme(),this.clearDiagnosticPresentation(),this.clearBoneSelectionHighlight(),this.clearBoundsHelper(),this.clearSkeletonHelper(),this.selectionOutline&&eo(this.renderer,this.selectionOutline,this.selectionOutlinePass),this.composer?.dispose(),this.sceneRenderPass=null,this.selectionOutline=null,this.selectionOutlinePass=null,this.composer=null,this.shading.dispose(),this.listeners.clear()}addHelper(e,t){e.name=`__object3d_document_${t}`,Us(e,"editorHelper",!0),this.scene.add(e),this.helpers.push(e)}get selectionOutlineEnabled(){return this.selectionOutlineWanted}set selectionOutlineEnabled(e){e!==this.selectionOutlineWanted&&(this.selectionOutlineWanted=e,e?this.syncSelectionPresentation():(this.selectionOutline?.selection.clear(),this.syncComposerOutput()))}selectionOutlineWanted=!0;xray={enabled:!1,alpha:1};setXray(e){this.xray.enabled===e.enabled&&this.xray.alpha===e.alpha||(this.xray=e,D())}set selectionOriginsEnabled(e){e!==(this.selectionOrigins!==null)&&(e?(this.selectionOrigins=new Do,this.scene.add(this.selectionOrigins),this.syncSelectionPresentation()):(this.selectionOrigins?.dispose(),this.selectionOrigins=null,D()))}ensureComposer(){this.selectionOutlineWanted&&(this.composer||this.composerLoading||this.disposed||(this.composerLoading=!0,Ke(()=>import("./index-DHhMOs_s.js"),__vite__mapDeps([0,1,2])).then(e=>{if(this.composerLoading=!1,this.disposed||this.composer)return;const t=this.camera(),s=new e.EffectComposer(this.renderer);this.sceneRenderPass=new e.RenderPass(this.scene,t),s.addPass(this.sceneRenderPass),this.selectionOutline=to(e,this.renderer,this.scene,t,Ie(this.renderer.domElement)),this.syncSelectionTheme(),Es(this.selectionOutline,this.selectedObjects),this.selectionOutlinePass=new e.EffectPass(t,this.selectionOutline),s.addPass(this.selectionOutlinePass),this.composer=s,this.syncComposerOutput(),s.setSize(this.renderWidth,this.renderHeight),D()}).catch(()=>{this.composerLoading=!1})))}renderSolidForCapture(e,t,s,i){const a=this.composer,c=(this.selectionOutline?.selection.size??0)>0;if(!a||!c||!this.sceneRenderPass||!this.selectionOutlinePass){this.renderer.render(this.scene,e);return}const o=this.renderWidth,l=this.renderHeight;try{this.sceneRenderPass.renderToScreen=!1,this.selectionOutlinePass.renderToScreen=!1,a.setSize(s,i,!1),this.sceneRenderPass.render(this.renderer,a.inputBuffer,a.outputBuffer,0),this.selectionOutlinePass.render(this.renderer,a.inputBuffer,t,0)}finally{a.setSize(o,l,!1),this.syncComposerOutput(),this.renderer.setRenderTarget(t)}}syncComposerOutput(){const e=(this.selectionOutline?.selection.size??0)>0;this.sceneRenderPass&&(this.sceneRenderPass.renderToScreen=!e),this.selectionOutlinePass&&(this.selectionOutlinePass.enabled=e,this.selectionOutlinePass.renderToScreen=e)}refreshSkeletonHelper(){const e=this.state.skeleton||this.boneSelectionHighlight!==null;e&&!this.skeletonHelper?(this.skeletonHelper=new Ni(this.root),Eo(this.skeletonHelper),this.scene.add(this.skeletonHelper)):e||this.clearSkeletonHelper()}clearSkeletonHelper(){this.skeletonHelper&&(this.skeletonHelper.removeFromParent(),this.skeletonHelper.dispose(),this.skeletonHelper=null)}clearBoneSelectionHighlight(){this.boneSelectionHighlight&&(this.boneSelectionHighlight.removeFromParent(),this.boneSelectionHighlight.dispose(),this.boneSelectionHighlight=null)}clearBoundsHelper(){if(!this.boundsHelper)return;const e=this.boundsHelper;this.boundsHelper=null;const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1),e.removeFromParent(),e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(s=>{s.dispose()}):e.material.dispose()}frameBones(e){const t=new wr,s=new H;for(const l of e){t.expandByPoint(l.getWorldPosition(s)),l.parent?.isBone&&t.expandByPoint(l.parent.getWorldPosition(s));for(const p of l.children)p.isBone&&t.expandByPoint(p.getWorldPosition(s))}const i=t.getCenter(new H),a=Math.max(t.getSize(new H).length(),.2);t.expandByScalar(a*.35);const c=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize(),o=Vt(t,this.viewport.camera,c);this.viewport.setPose(i.clone().addScaledVector(c,o),i)}syncOrthographicCamera(){const e=this.viewport.camera,t=this.viewport.orbitControls.target,s=Math.max(e.position.distanceTo(t),.001),i=Math.max(s*Math.tan(br.degToRad(e.fov)/2),.001),a=Math.max(this.renderer.domElement.clientWidth,1),c=Math.max(this.renderer.domElement.clientHeight,1),o=this.captureAspect??a/c;this.orthographicCamera.left=-i*o,this.orthographicCamera.right=i*o,this.orthographicCamera.top=i,this.orthographicCamera.bottom=-i,this.orthographicCamera.near=e.near,this.orthographicCamera.far=e.far,this.orthographicCamera.position.copy(e.position),this.orthographicCamera.quaternion.copy(e.quaternion),this.orthographicCamera.up.copy(e.up),this.orthographicCamera.layers.mask=e.layers.mask,this.orthographicCamera.updateProjectionMatrix(),this.orthographicCamera.updateMatrixWorld(!0)}clearDiagnosticPresentation(){this.clearTopologyOverlay(),this.scene.overrideMaterial?.dispose(),this.scene.overrideMaterial=null;for(const e of this.helpers.splice(0)){e.removeFromParent();const t=e;t.geometry?.dispose();const s=t.material;Array.isArray(s)?s.forEach(i=>{i.dispose()}):s?.dispose()}}notify(){this.version++;for(const e of this.listeners)e()}}const Lo=7;let at=null;function Fo(){if(at)return at;const n=64,e=document.createElement("canvas");e.width=n,e.height=n;const t=e.getContext("2d");return t.beginPath(),t.arc(n/2,n/2,n/2-1,0,Math.PI*2),t.fillStyle="rgba(0, 0, 0, 0.75)",t.fill(),t.beginPath(),t.arc(n/2,n/2,n/2-8,0,Math.PI*2),t.fillStyle="#ffffff",t.fill(),at=new $i(e),at.colorSpace=Qs,at}class Do extends Zs{objects=[];origin=new H;constructor(){super(new Ks,new Ys({map:Fo(),size:Lo,sizeAttenuation:!1,transparent:!0,alphaTest:.05,depthTest:!1,depthWrite:!1,toneMapped:!1})),this.name="volter:selection-origins",this.userData.editorHelper=!0,this.renderOrder=1e3,this.frustumCulled=!1,this.raycast=()=>{}}update(e,t){this.objects=e,this.material.color.setHex(e.length===1&&t.active!==void 0?t.active:t.visible),this.visible=e.length>0}place(){const e=this.objects.length;let t=this.geometry.getAttribute("position");(t===void 0||t.count<e)&&(this.geometry.dispose(),t=new Xs(new Float32Array(Math.max(e,8)*3),3),this.geometry.setAttribute("position",t)),this.geometry.setDrawRange(0,e),this.objects.forEach((s,i)=>{s.getWorldPosition(this.origin),t.setXYZ(i,this.origin.x,this.origin.y,this.origin.z)}),t.needsUpdate=!0}dispose(){this.removeFromParent(),this.geometry.dispose(),this.material.dispose()}}class Ho{constructor(e){this.options=e}active=null;settling=!1;idleWaiters=new Set;begin(e){if(this.active||this.settling)return!1;try{const t=this.options.begin(e);return t?(this.active={pointerId:e.pointerId,gesture:t},!0):!1}catch(t){return this.options.reportError(t),!1}}update(e){if(!(!this.active||this.active.pointerId!==e.pointerId))try{this.active.gesture.update(e)}catch(t){this.cancelWithError(t)}}async commit(e){const t=this.take(e.pointerId);if(!t)return!1;this.settling=!0;try{return await t.commit(e),await this.options.persist(t.label),!0}catch(s){try{await t.cancel()}catch(i){return this.options.reportError({operationError:s,rollbackError:i}),!1}return this.options.reportError(s),!1}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}async cancel(e){const t=this.take(e);if(!t)return!1;this.settling=!0;try{return await t.cancel(),!0}catch(s){return this.options.reportError(s),!1}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}async settle(){this.active&&await this.cancel(),this.settling&&await new Promise(e=>this.idleWaiters.add(e))}hasActiveGesture(){return this.active!==null}take(e){if(!this.active||e!==void 0&&this.active.pointerId!==e)return null;const t=this.active.gesture;return this.active=null,t}async cancelWithError(e){const t=this.take();if(t){this.settling=!0;try{await t.cancel(),this.options.reportError(e)}catch(s){this.options.reportError({operationError:e,rollbackError:s})}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}}}class Bo{constructor(e,t){this.frame=e,this.releaseRenderer=t,this.unsubscribeActivity=go(()=>this.syncActivity())}rafId=0;running=!1;disposed=!1;active=!1;unsubscribeActivity;get isDisposed(){return this.disposed}get isRunning(){return this.running}setActive(e){this.disposed||(this.active=e,this.syncActivity())}syncActivity(){this.active&&ur()?this.start():this.stop()}redraw(){this.running&&!this.disposed&&ur()&&this.guardedFrame(performance.now())}dispose(){this.stop(),!this.disposed&&(this.disposed=!0,this.unsubscribeActivity(),this.releaseRenderer())}start(){this.disposed||this.running||(this.running=!0,this.guardedFrame(performance.now(),!0),!(!this.running||this.disposed)&&(this.rafId=requestAnimationFrame(this.tick)))}lastFrameFailure=null;guardedFrame(e,t=!1){try{this.frame(e,t),this.lastFrameFailure=null}catch(s){const i=s instanceof Error?s.message:String(s);i!==this.lastFrameFailure&&(this.lastFrameFailure=i,console.error("[document renderer] a frame threw; the loop continues:",s))}}stop(){this.running=!1,this.rafId!==0&&(cancelAnimationFrame(this.rafId),this.rafId=0)}tick=e=>{if(!(!this.running||this.disposed)){if(!ur()){this.stop();return}this.guardedFrame(e),!(!this.running||this.disposed)&&(this.rafId=requestAnimationFrame(this.tick))}}}const _o=new Set(["solid","clay","unlit","wireframe","normals","overdraw"]);function zo(n,e){return{read:()=>{const t=n.cameraPose;if(!t)return null;const{position:s,target:i}=t;return{camera:{position:{x:s.x,y:s.y,z:s.z},target:{x:i.x,y:i.y,z:i.z},...t.fov?{fov:t.fov}:{}},diagnostic:n.shadingMode,grid:Hn(e)}},setDiagnostic:t=>_o.has(t)?(n.setShadingMode(t),!0):!1,setCamera:t=>typeof t!="string"?(n.shell.setCameraPose(t.position,t.target,t.fov),!0):t==="isometric"?!1:(n.shell.setViewPreset(t),!0),frame:t=>t==="document"?!1:(n.shell.focusOnSelection(),!0)}}function Wo(n){const e=mr();return e?Bn(Ns(e.shell,n)):"none"}const Io=f.lazy(()=>Ke(()=>import("./stage-transform-tools-i3ajje5q.js"),__vite__mapDeps([3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63])).then(n=>({default:n.ThreeStageTransformTools}))),No=f.lazy(()=>Ke(()=>import("./stage-transform-tools-i3ajje5q.js"),__vite__mapDeps([3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63])).then(n=>({default:n.ThreeStageTransformControls})));function Fs(n){return{transformTools:()=>Wo(n),TransformTools:Io,TransformControls:No}}class $o{constructor(e,t,s){this.create=e,this.isOpen=t,this.subscribe=s}states=new Map;generations=new WeakMap;unsubscribe=null;claim(e){const t=this.states.get(e)??[];let s=t.find(i=>!i.inUse);return s||(s=this.create(e),t.push(s),this.states.set(e,t)),s.inUse=!0,this.generations.set(s,this.generation(s)+1),this.unsubscribe??=this.subscribe(()=>this.discardClosed()),s}generation(e){return this.generations.get(e)??0}release(e,t=this.generation(e)){this.generation(e)===t&&(e.inUse=!1,queueMicrotask(()=>this.discardClosed()))}retain(e,t,s){if(!this.isOpen(e.documentId)||!this.states.get(e.documentId)?.includes(e)||this.generation(e)!==s){t.dispose();return}const i=e.source;e.source=t,i!==t&&i?.dispose()}discardClosed(){const e=[];for(const[s,i]of this.states){if(this.isOpen(s))continue;const a=i.filter(c=>c.inUse);e.push(...i.filter(c=>!c.inUse)),a.length?this.states.set(s,a):this.states.delete(s)}this.states.size===0&&(this.unsubscribe?.(),this.unsubscribe=null);const t=[];for(const s of e){const i=s.source;s.source=null;try{i?.dispose()}catch(a){t.push(a)}}if(t.length)throw new AggregateError(t,"Retained document cleanup failed")}}const Go=f.lazy(async()=>({default:(await Ke(()=>import("./stage-overlay-set-BdCP3eMw.js"),__vite__mapDeps([64,4,5,7,8,6,9,10,11,12,13,45,65,66,24,14,15,1,2,16,17,18,19,20,21,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63]))).StageOverlaySet}));function qo(n){return d.jsx(f.Suspense,{fallback:null,children:d.jsx(Go,{...n})})}function Ds(n,e,t){if(e==="orthographic"){const s=Lt(n.camera.position.clone().sub(n.orbitControls.target),new H(0,1,0).applyQuaternion(n.camera.quaternion));return s!==null?s:t==="short"?"Iso":"Orthographic"}return t==="short"?"Persp":"Perspective"}const Uo=()=>()=>{},Hs=()=>0;function Ko({shell:n,documentId:e,label:t,kebab:s=!1}){const i=f.useSyncExternalStore(ro,Ms,Ms);f.useSyncExternalStore(uo,ho);const a=e?po(e):null;f.useSyncExternalStore(a?.subscribe??Uo,a?.getSnapshot??Hs,a?.getSnapshot??Hs);const c=a?a.projection():i.projection,o=x=>{a?a.setProjection(x):Rs(x)},[l,p]=f.useState(!1),P=f.useRef(null);f.useEffect(()=>{if(!l)return;const x=S=>{P.current?.contains(S.target)||p(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]);const w=x=>{if(a){a.setViewPreset(x,"view");return}Rs("orthographic"),n.setViewPreset(x)};return d.jsxs("div",{ref:P,className:"volter-viewport-popover-anchor",children:[t===void 0?d.jsx(qe,{text:c==="perspective"?"Perspective":"Orthographic",children:d.jsx(Te,{"aria-label":"Viewport views","aria-expanded":l,size:"comfortable",onClick:()=>p(x=>!x),children:d.jsx(we,{icon:l?_n:zn,size:"md"})})}):d.jsxs(Ne,{size:"comfortable",variant:"ghost","aria-label":"Viewport views","aria-expanded":l,"data-testid":"viewport-view-name",onClick:()=>p(x=>!x),children:[s?d.jsx(we,{icon:Wn,size:"sm"}):null,t]}),l?d.jsx(In,{style:{minWidth:230},children:d.jsxs(Nn,{gap:3,children:[d.jsx(as,{variant:"caption",tone:"muted",children:"Projection"}),d.jsxs(cs,{gap:1,children:[d.jsx(Ne,{size:"compact",variant:c==="perspective"?"primary":"ghost",onClick:()=>o("perspective"),children:"Perspective"}),d.jsx(Ne,{size:"compact",variant:c==="orthographic"?"primary":"ghost",onClick:()=>o("orthographic"),children:"Orthographic"})]}),d.jsx(as,{variant:"caption",tone:"muted",children:"Axis View"}),d.jsxs(cs,{gap:1,children:[d.jsx(Ne,{size:"compact",variant:"ghost",onClick:()=>w("top"),children:"Top"}),d.jsx(Ne,{size:"compact",variant:"ghost",onClick:()=>w("front"),children:"Front"}),d.jsx(Ne,{size:"compact",variant:"ghost",onClick:()=>w("right"),children:"Right"})]})]})}):null]})}const Xo=io;function Bs(n){return Sr(null,n)}const Yo=()=>()=>{},_s=()=>0,Zo=5,Qo=58;function Jo(n,e){const t=e?.camera()??n.renderCamera,s=n.camera.position,i=n.orbitControls.target,a=t.isOrthographicCamera?sn(t,n,e):0;return[s.x,s.y,s.z,i.x,i.y,i.z,a].map(c=>c.toPrecision(6)).join(",")}function sn(n,e,t){const s=e.orbitControls.domElement,i=Math.max(1,t?.renderer.domElement.height??(s?.clientHeight??1)*(s?.ownerDocument.defaultView?.devicePixelRatio??1));return(n.top-n.bottom)/n.zoom/i}function ea({viewport:n,documentId:e,session:t,store:s,projection:i,displayName:a,objectName:c,statistics:o,subject:l,gridScale:p}){f.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),f.useSyncExternalStore(f.useCallback(V=>{const F=n?.orbitControls;return F?.addEventListener("change",V),()=>F?.removeEventListener("change",V)},[n]),()=>n?Jo(n,t):""),f.useSyncExternalStore(t?.subscribe??Yo,t?.getSnapshot??_s,t?.getSnapshot??_s);const P=f.useSyncExternalStore(Bs,$s),w=f.useSyncExternalStore(Bs,$n),x=P&&!w?Ue.content.onAccent:Ue.content.primary,S=Gn();f.useSyncExternalStore(fr,ls,ls);const z=ct(e).overlays.navigationControls;if(!n)return null;const B=Lt(n.camera.position.clone().sub(n.orbitControls.target),new H(0,1,0).applyQuaternion(n.camera.quaternion))??"User",E=t?.projection()??i,C=t?.cameraView()??null,W=C?`Camera ${C.projection==="perspective"?"Perspective":"Orthographic"}`:`${B} ${E==="perspective"?"Perspective":"Orthographic"}`,Q=s.selectedEntityId,y=(Q===null?null:c(Q))||null,$=l??(y===null||y===a?a:`${a} | ${y}`),_=t?.camera()??n.renderCamera,K=p&&!C&&B!=="User"&&_.isOrthographicCamera?p(sn(_,n,t)):null,L=V=>{V.preventDefault();const F=V.currentTarget;F.setPointerCapture(V.pointerId);const be=n.orbitControls.domElement?.getBoundingClientRect().top??0,Ee=Math.max(5+V.clientY-be,1),oe=n.camera,le=n.orbitControls.target,ae=oe.position.clone().sub(le),te=!t&&n.renderCamera instanceof vr?n.renderCamera:null,se=te?.zoom??1,Oe=t?.cameraViewZoom()??null,ue=he=>{const Ae=5+he.clientY-be,ye=Math.max(.01,2*(Ae/Ee-1)+1);Oe!==null&&t?.cameraView()?t.setCameraViewZoom(Oe/ye):te?(te.zoom=se/ye,te.updateProjectionMatrix()):oe.position.copy(le).addScaledVector(ae,ye),n.orbitControls.update()},J=()=>{F.removeEventListener("pointermove",ue),F.removeEventListener("pointerup",J),F.removeEventListener("pointercancel",J),F.removeEventListener("lostpointercapture",J)};F.addEventListener("pointermove",ue),F.addEventListener("pointerup",J),F.addEventListener("pointercancel",J),F.addEventListener("lostpointercapture",J)},X=V=>{V.preventDefault();const F=V.currentTarget;F.setPointerCapture(V.pointerId);let be=V.clientX,Ee=V.clientY;const oe=new H,le=new H,ae=se=>{const Oe=se.clientX-be,ue=se.clientY-Ee;if(be=se.clientX,Ee=se.clientY,t?.cameraView()){const Ye=t.renderer.domElement;t.panCameraView(Oe/Math.max(Ye.clientWidth,1),ue/Math.max(Ye.clientHeight,1));return}const J=n.camera,he=n.orbitControls.target,Ae=J.position.distanceTo(he),ye=Math.max(1,F.ownerDocument.defaultView?.innerHeight??1),Xe=2*Ae*Math.tan(br.degToRad(J.fov/2))/ye;oe.setFromMatrixColumn(J.matrixWorld,0).multiplyScalar(-Oe*Xe),le.setFromMatrixColumn(J.matrixWorld,1).multiplyScalar(ue*Xe),J.position.add(oe).add(le),he.add(oe).add(le),n.orbitControls.update()},te=()=>{F.removeEventListener("pointermove",ae),F.removeEventListener("pointerup",te),F.removeEventListener("pointercancel",te),F.removeEventListener("lostpointercapture",te)};F.addEventListener("pointermove",ae),F.addEventListener("pointerup",te),F.addEventListener("pointercancel",te),F.addEventListener("lostpointercapture",te)};return d.jsxs(d.Fragment,{children:[S.viewName==="text"&&s.showHelpers?d.jsxs("div",{"data-testid":"viewport-view-text","aria-hidden":"true",style:{position:"absolute",top:"var(--volter-space-3)",left:"calc(var(--volter-space-4) + var(--volter-control-comfortable-height) * 2 + var(--volter-space-4))",display:"flex",flexDirection:"column",gap:"var(--volter-space-1)",fontSize:"var(--volter-font-sm)",color:x,textShadow:"var(--volter-content-text-shadow, none)",pointerEvents:"none",userSelect:"none"},children:[d.jsx("span",{children:W}),d.jsx("span",{children:$}),K?d.jsx("span",{"data-testid":"viewport-grid-scale",children:K}):null,o&&o.length>0?d.jsx("div",{"data-testid":"viewport-statistics",style:{display:"grid",gridTemplateColumns:`${Qo}px auto`,rowGap:"var(--volter-space-1)",marginTop:qn[Zo]},children:o.map(V=>d.jsxs(f.Fragment,{children:[d.jsx("span",{children:V.label}),d.jsx("span",{children:V.value})]},V.id))}):null]}):null,S.viewName==="menu"?d.jsx("div",{className:"volter-viewport-view-pill",style:{position:"absolute",top:"var(--volter-viewport-overlay-top, var(--volter-space-4))",left:"var(--volter-stage-name-left, calc(var(--volter-space-4) + var(--volter-control-comfortable-height) * 2 + var(--volter-space-4)))",zIndex:"calc(var(--volter-z-dropdown, 1000) - 1)",pointerEvents:"auto"},children:d.jsx(Ko,{shell:s,documentId:e,label:Ds(n,E,"long"),kebab:!0})}):null,S.viewName==="gizmo"?d.jsxs("button",{type:"button","data-testid":"viewport-view-name",className:"volter-viewport-gizmo-label","aria-label":E==="perspective"?"Switch to orthographic":"Switch to perspective",onClick:()=>{const V=E==="perspective"?"orthographic":"perspective";t?t.setProjection(V):n.setProjection(V)},style:{position:"absolute",top:no+4,right:so,transform:"translateX(50%)",display:"inline-flex",alignItems:"center",gap:"var(--volter-space-1)",padding:0,border:0,background:"none",fontSize:"var(--volter-font-sm)",color:x,textShadow:"var(--volter-content-text-shadow, none)",cursor:"pointer",pointerEvents:"auto"},children:[d.jsx(we,{size:"xs",icon:E==="perspective"?Un:Kn}),Ds(n,E,"short")]}):null,z?d.jsxs("div",{"data-testid":"viewport-navigation",role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",className:"volter-chrome-island volter-viewport-navigation",style:{position:"absolute",top:Xo,right:"var(--volter-space-6)",display:"flex",flexDirection:"column",gap:"var(--volter-space-1)",padding:"var(--volter-space-1) 0",borderRadius:"var(--volter-radius-full)",background:"var(--volter-island-surface, var(--volter-surface-overlay))",pointerEvents:"auto"},children:[d.jsx(qe,{text:"Zoom (drag)",children:d.jsx(Te,{size:"comfortable","aria-label":"Zoom the view",onPointerDown:L,children:d.jsx(we,{size:"2xl",icon:ve.viewport.zoomIn})})}),d.jsx(qe,{text:"Pan (drag)",children:d.jsx(Te,{size:"comfortable","aria-label":"Pan the view",onPointerDown:X,children:d.jsx(we,{size:"2xl",icon:ve.viewport.pan})})}),t?.hasCameraView()?d.jsx(qe,{text:C?"Leave the camera view":"Look through the camera",children:d.jsx(Te,{size:"comfortable","aria-label":"Toggle the camera view",onClick:()=>t.toggleCameraView(),children:d.jsx(we,{size:"2xl",icon:C?ve.viewport.cameraView:ve.viewport.camera})})}):null,C&&t?.cameraViewLocked()!==null?d.jsx(qe,{text:t?.cameraViewLocked()?"Unlock the camera from the view":"Lock the camera to the view",children:d.jsx(Te,{size:"comfortable","aria-label":"Lock the camera to the view",onClick:()=>t?.toggleCameraViewLock(),children:d.jsx(we,{size:"2xl",icon:t?.cameraViewLocked()?ve.viewport.cameraLocked:ve.viewport.cameraUnlocked})})}):null,C||S.viewName==="gizmo"?null:d.jsx(qe,{text:E==="perspective"?"Orthographic":"Perspective",children:d.jsx(Te,{size:"comfortable","aria-label":"Toggle perspective and orthographic",onClick:()=>{const V=E==="perspective"?"orthographic":"perspective";t?t.setProjection(V):n.setProjection(V)},children:d.jsx(we,{size:"2xl",icon:E==="orthographic"?ve.viewport.projectionOrthographic:ve.viewport.projection})})})]}):null,C&&t?d.jsx(ta,{view:C,canvas:t.renderer.domElement,locked:t.cameraViewLocked()===!0}):null]})}function ta({view:n,canvas:e,locked:t}){const[s,i]=f.useState(null),[,a]=f.useState(0);f.useEffect(()=>{const E=new ResizeObserver(()=>a(C=>C+1));return E.observe(e),()=>E.disconnect()},[e]);const c=e.clientWidth,o=e.clientHeight,l=e.ownerDocument.defaultView?.devicePixelRatio??1,p=e.getBoundingClientRect(),P=s?.getBoundingClientRect(),w=1/l,x=n.frame.left*c-w,S=n.frame.top*o-w,z=n.frame.width*c+2*w,B=n.frame.height*o+2*w;return d.jsx("div",{ref:i,"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none"},children:P?d.jsxs("svg",{"data-testid":"viewport-camera-frame",width:c,height:o,style:{position:"absolute",left:p.left-P.left,top:p.top-P.top},children:[n.passepartout.opacity>0?d.jsx("path",{d:`M0 0H${c}V${o}H0Z M${x} ${S}V${S+B}H${x+z}V${S}Z`,fill:n.passepartout.color,fillOpacity:n.passepartout.opacity,fillRule:"evenodd"}):null,n.passepartout.opacity>0?d.jsx("rect",{x,y:S,width:z,height:B,fill:"none",stroke:n.border.solid,strokeWidth:w,shapeRendering:"crispEdges"}):null,d.jsx("rect",{x,y:S,width:z,height:B,fill:"none",stroke:n.border.dashed,strokeWidth:w,strokeDasharray:`${3*w} ${3*w}`,shapeRendering:"crispEdges"}),t?d.jsx("rect",{x:x-w,y:S-w,width:z+2*w,height:B+2*w,fill:"none",stroke:n.border.locked,strokeWidth:w,strokeDasharray:`${3*w} ${3*w}`,shapeRendering:"crispEdges"}):null]}):null})}const ra=f.lazy(async()=>({default:(await Ke(()=>import("./stage-keyboard-7_1scYGH.js"),__vite__mapDeps([67,7,5,8,68,6,4,9,10,11,12,13,45,23]))).StageKeyboardBinding})),sa=n=>{const e=n.split(":");return(e[0]==="document"?e[1]:e[0])??n},zs=()=>Pi(),pr=12;function Ws(n){if(!n)return null;const e=new wr(new H(n.min[0],n.min[1],n.min[2]),new H(n.max[0],n.max[1],n.max[2]));return e.isEmpty()?null:e}const na=500;function ia(n){return Sr(null,n)}const oa=["solid","preview","rendered","clay","unlit","wireframe","matcap","normals","overdraw"];let aa=0;const Ge=new $o(n=>({documentId:n,store:en(new Gs),inUse:!1,source:null,camera:null,presentation:null,transport:null,contentSeconds:0,transportAdvances:0}),n=>ni().some(e=>e.descriptor.id===n),ii);function ca({canvasHostRef:n}){return d.jsx("div",{ref:n,style:{position:"absolute",inset:0}})}function la(n,e,t,s,i){if(e==="inspector-preview"){const l=Ti();return l.canvas.setAttribute("aria-label",`${t} authoring viewport`),n.appendChild(l.canvas),{canvas:l.canvas,renderer:l.renderer,lease:l}}const a=Zi(s.width,s.height,i),{canvas:c,renderer:o}=a;return c.setAttribute("aria-label",`${t} authoring viewport`),n.appendChild(c),{canvas:c,renderer:o,lease:a}}class Is{constructor(e,t,s){this.lane=e,this.surface=t,this.store=s??en(new Gs),this.transport=new xi(this.store.shell)}scene=new Js;store;cleanups=[];rendererSession=new Bo((e,t)=>this.frame?.(e,t),()=>{});viewport=null;session=null;dressing=null;presentationRig=null;applyPresentation=null;backdropOverridden=!1;documentStudio=null;contentLights=[];contentHas={light:!1,"directional-light":!1};darkened=[];darkenContentLights(){for(const t of this.contentLights)t.visible&&(t.visible=!1,this.darkened.push(t));if(this.darkened.length===0)return 0;const e=this.darkened.length;return this.scene.onAfterRender=()=>{for(const t of this.darkened)t.visible=!0;this.darkened=[],this.scene.onAfterRender=()=>{}},e}defaultEnvironment=null;defaultBackground=null;adapter=null;presentationAdapter=null;content=null;frame=null;syncHostScene=null;presence=null;initialized=!1;contentSeconds=0;transportAdvances=0;users=0;closed=!1;released=!1;get isClosed(){return this.closed}transport;borrow(){this.users++;let e=!1;return()=>{e||(e=!0,this.users--,this.releaseIfClosed())}}close(){this.closed=!0,this.frame=null,this.syncHostScene=null,this.session?.setBeforeRender(null),this.session?.setPresentsFrames(!1),this.rendererSession.setActive(!1),this.content?.dispose(),this.transport.dispose(),this.releaseIfClosed()}releaseIfClosed(){if(!this.closed||this.users!==0||this.released)return;this.released=!0;const{lease:e,renderer:t,canvas:s}=this.surface;for(const i of[...this.cleanups.splice(0),()=>this.session?.dispose(),()=>this.viewport?.dispose(),()=>this.rendererSession.dispose(),()=>this.dressing?.dispose(),...e?[()=>e.release()]:[()=>t.dispose(),()=>t.forceContextLoss(),()=>s.remove()]])try{i()}catch(a){console.error("Object3D document cleanup failed.",a)}}}function nn({documentId:n,sourcePath:e,build:t,displayName:s="Source Object3D",background:i,cameraDirection:a,persistence:c,documentSource:o,authoring:l,interaction:p,selectionOutline:P=!0,active:w=!0,audit:x=!0,chromeless:S=!1,modelSource:z,assetType:B,sourceAuthoring:E,dressing:C,rendererLane:W="own",onOpenNode:Q,frameBounds:y,openingFrameBounds:$,openingFit:_,openingView:K,presentation:L,cameraView:X,stageKind:V,statistics:F,subject:be,gridScale:Ee,content:oe}){const le=V??sa(n);f.useEffect(()=>{if(!S)return Xn(n)},[n,S]);const ae=Ci(Yn()),te=ae??mr(),se=te?Ns(te.shell,n,S?"embedded":"document"):null,Oe=f.useSyncExternalStore(ia,$s),ue=se!==null&&Zn(se,Oe),J=f.useRef(ue);J.current=ue;const he=se!==null&&Qn(se),Ae=f.useRef(he);Ae.current=he;const ye=se!==null&&Jn(se),Xe=f.useRef(ye);Xe.current=ye;const Ye=ei(),Ft=f.useRef(Ye);Ft.current=Ye;const Dt=f.useRef(null),Ht=f.useRef(null),G=f.useRef(null),Me=f.useRef(null);(!Me.current||Me.current.documentId!==n)&&(Me.current&&Ge.release(Me.current),Me.current=Ge.claim(n)),f.useEffect(()=>{const M=Me.current,de=Ge.generation(M);return()=>Ge.release(M,de)},[n]);const I=Me.current,Le=oe?.kind==="world-root",Bt=w||Le,xr=f.useRef(oe?.kind==="world-root"?oe.load:null);xr.current=oe?.kind==="world-root"?oe.load:null;const[Fe,_t]=f.useState(Bt);f.useEffect(()=>_t(Bt),[Bt]);const zt=f.useRef(P);f.useEffect(()=>{zt.current=P;const M=G.current?.session;M&&(M.selectionOutlineEnabled=W!=="inspector-preview"&&P),G.current?.applyPresentation?.()},[P,W]);const Pr=f.useRef(Promise.resolve()),Wt=f.useRef(!1);f.useEffect(()=>{if(Fe)return Ze.current=!1,Gt("building"),()=>{const M=G.current;if(M&&!Le){Wt.current=!lt.current;const de=M.store.cameraPose;I.camera=de&&M.viewport?{...de,up:M.viewport.camera.up.clone()}:null,I.presentation=M.session?.presentation()??null,I.transport=M.transport.snapshot(),I.contentSeconds=M.contentSeconds,I.transportAdvances=M.transportAdvances}dt.current=null,pt.current=null,ht.current=null,ut.current=null,M?.close(),G.current=null}},[n,W,I,Fe,Le]);const Cr=f.useRef(Q);Cr.current=Q;const kr=f.useRef(y);kr.current=y;const Er=f.useRef($);Er.current=$;const It=f.useRef(K);It.current=K;const Or=f.useRef(L);Or.current=L;const Mr=f.useRef(X);Mr.current=X;const lt=f.useRef(w);lt.current=w;const Rr=f.useRef(w),jr=f.useRef({build:t,sourcePath:e});f.useEffect(()=>{const M=jr.current;jr.current={build:t,sourcePath:e},!(M.build===t&&M.sourcePath===e)&&!Fe&&I.source&&(I.source.dispose(),I.source=null)},[t,I,e,Fe]);const ut=f.useRef(null),Ze=f.useRef(!1),ht=f.useRef(null),dt=f.useRef(null),pt=f.useRef(null),[Nt,ne]=f.useState(null),[$t,Gt]=f.useState("building"),[Tr,on]=f.useState(null),[an,cn]=f.useState("mounting"),[ln,un]=f.useState([]),Vr=f.useRef(null),[Ar,hn]=f.useState("perspective"),[dn,Lr]=f.useState(null),ft=f.useRef(null);ft.current=dn;const qt=a?.[0],Ut=a?.[1],Kt=a?.[2],Qe=z?.kind,Xt=z?.kind==="project-file"?z.path:void 0,mt=z?.kind==="entity"?z.entityId:void 0,Fr=C?.environment,Dr=C?.background,Hr=C?.keyLight,Yt=C?.grid,Je=C?.viewLocked,Zt=C?.toneMapping;w&&ti(n),f.useEffect(()=>{let M=!1;if(!Fe)return;const de=async Se=>{const N=Dt.current,et=Ht.current;if(!N||!et||G.current)return;const O=Ft.current;if(!O){ne("The world root needs the editor shell above it; this host has none.");return}const tt=await Se();if(M||G.current)return;on(()=>tt),us();const r=new Is("own",tt.mountWorldRootSurface(et,N,s),mr()??void 0);G.current=r,r.cleanups.push(hs(n,r.store.shell)),r.cleanups.push(ds(n,r.transport)),r.cleanups.push(Si(n,{...zo(r.store,n),...Fs(n)}));const ie=tt.installWorldRootStage({store:r.store,documentId:n,container:N,canvas:r.surface.canvas,renderer:r.surface.renderer,stats:O,cameraPreview:()=>Vr.current,onMountStatus:cn,onRootIds:un,runFrame:xe=>js(n,xe)});r.viewport=ie.viewport,r.frame=ie.frame,r.content={scene:ie.scene,settle:()=>Promise.resolve(),dispose:async()=>ie.dispose()};const j=Vs(()=>r.store.scene??ie.scene,r.transport,{rescanOnLiveMixers:()=>r.store.shell.playState==="stopped"});let re=0;r.cleanups.push(()=>j.dispose()),r.cleanups.push(r.store.shell.subscribe(()=>{if(r.store.shell.playState!=="stopped")return;const xe=performance.now();xe-re<na||(re=xe,j.refresh())})),r.cleanups.push(Ts({camera:ie.viewport.camera,drawCamera:()=>ie.viewport.renderCamera,orbit:ie.viewport.orbitControls,scene:ie.scene},ie.present,ie.setHelper,{documentId:n})),ut.current=r.rendererSession,r.initialized=!0,ws(),Gt("ready"),r.rendererSession.setActive(!0)},fn=async()=>{for(await G.current?.content?.settle();Ui();)await Ki();if(M)return;const Se=xr.current;if(Se)return de(Se);const N=Dt.current,et=Ht.current;if(!N||!et)return;if(!t||e===void 0){ne("This stage shows `build` content and was given no `build()`/`sourcePath`.");return}let O;const tt=Ge.generation(I);try{O=I.source??t(),I.source=null}catch(ee){ne(ee instanceof Error?ee.message:String(ee));return}try{G.current||(us(),G.current=new Is(W,la(et,W,s,{width:Math.max(1,N.clientWidth),height:Math.max(1,N.clientHeight)},()=>{_t(!1),window.setTimeout(()=>{lt.current&&_t(!0)},0)}),I.store),G.current.contentSeconds=I.contentSeconds,G.current.transportAdvances=I.transportAdvances)}catch(ee){throw O.dispose(),ee}const r=G.current,ie=r.borrow(),{renderer:j,canvas:re,lease:xe}=r.surface,T=r.store;S||(r.cleanups.push(hs(n,T.shell)),r.cleanups.push(ds(n,r.transport)));const vt=ps();vt&&T.shell.attachHistory(vt);const Jt=W==="inspector-preview",De=J.current,_r=Ae.current,zr=Xe.current,A=new Js,wt=O.root.parent;A.add(O.root),O.animations&&(O.root.animations=[...O.animations]);const er={root:O.root,animations:O.root.animations};let He=null,Be=null,_e=null,Pe=null,ce=null,bt=null,yt=null,St=null,xt=null,Pt=null,tr=null,Wr=null,Ir=null,Nr=!1,Ct=!1,kt=null;const rr={scene:A,settle:()=>ce?.settle()??Promise.resolve(),dispose:()=>{if(kt)return kt;Ct=!0;const ee=Wt.current;return Wt.current=!1,bt&&N.removeEventListener("pointerdown",bt,!0),yt&&N.removeEventListener("pointermove",yt,!0),St&&N.removeEventListener("pointerup",St,!0),xt&&N.removeEventListener("pointercancel",xt,!0),Pt&&window.removeEventListener("keydown",Pt),tr?.(),tr=null,kt=(async()=>{await ce?.settle();const rt=[];for(const Et of[()=>Pe?.dispose(),()=>Be?.dispose?.(),()=>He?.dispose(),()=>A.removeFromParent(),()=>{ee?Ge.retain(I,O,tt):O.dispose()},ie])try{Et()}catch(pe){rt.push(pe)}rt.length&&console.error("Object3D source cleanup failed.",...rt)})(),kt}};try{const ee=async u=>{try{const g=er;if(o&&!c){if(!g)throw new Error("Project history is unavailable; the edit was not saved.");const h=ps();if(!h)throw new Error("Project history is unavailable; the edit was not saved.");const v=o.serialize(g);if(v===null)return ne(null),!1;const m=await zs().replaceSource(h,{file:o.path,source:v,label:u??o.label??`Edit ${s}`});return ne(null),m}if(!c)throw new Error("This Asset Lab document has no persistence binding.");if(!_e||!g)throw new Error("Project history is unavailable; the edit was not saved.");const{persisted:k}=await(await _e).commit(g,u);return ne(null),k}catch(g){throw ne(g instanceof Error?g.message:JSON.stringify(g)),g}};He=new mo(T,A,{documentId:n,title:s,sourcePath:e,documentKind:zr?"asset":"source",audit:x,...O.hierarchyRoots?{hierarchyRoots:O.hierarchyRoots}:{},...Qe==="project-file"&&Xt?{modelSource:{kind:Qe,path:Xt}}:Qe==="entity"&&mt?{modelSource:{kind:Qe,entityId:mt}}:{}});const rt={documentId:n,sourcePath:e,root:O.root,animations:O.root.animations,scene:A,defaultAdapter:He,commit:ee};Be=l?.(rt)??null;const Et=Be?He:null;!Be&&E&&(Be=E({store:T,scene:A,...O.hierarchyRoots?{hierarchyRoots:O.hierarchyRoots}:{}}),He.dispose()),_e=c&&vt?zs().openPersistence({binding:c,document:er,history:vt}):null,_e&&_e.catch(u=>{!Ct&&G.current?.content===rr&&ne(u instanceof Error?u.message:JSON.stringify(u))});const pe=Be?.adapter??He;if(!r.dressing){j.outputColorSpace=Qs,j.toneMapping=Zt??Gi,j.shadowMap.enabled=!0,j.shadowMap.type=qi,j.info.autoReset=!1,j.setPixelRatio(Math.min(window.devicePixelRatio,2)),De&&j.setClearColor(0,0);const u=Fr===!1?null:xe&&"environment"in xe?xe.environment():ji(j),g=fs(re);r.dressing=ki(r.scene,{environment:u,background:!De&&i===void 0&&Dr!==!1,keyLight:!1,grid:Yt===!0,content:O.root}),!De&&i!==void 0?r.scene.background=new me(i):!De&&g.background!==null&&(r.scene.background=new me(g.background)),r.defaultEnvironment=r.scene.environment,r.defaultBackground=r.scene.background;{const k=new Ei(r.scene,D);r.presentationRig=k,ms(n,le);let h=r.store.shell.showHelpers;const v=()=>{const m=ct(n);if(h=r.store.shell.showHelpers,k.apply(m,j,Zt),r.viewport?.setStageFunction(m.world,m.interaction),r.viewport?.setFieldOfView(m.camera.fov),r.viewport?.setSelectionMarks(m.overlays.selection),r.viewport?.setGridMajorEvery(m.overlays.grid.majorEvery),r.viewport?.setAxisLines(m.overlays.axes),r.viewport?.setNavigation(m.overlays.navigation),r.viewport?.setGridVisible(m.overlays.grid.visible&&h),r.session){const R=r.session.presentation().mode==="wireframe"&&m.xray.enabled&&m.xray.alpha<=0;r.session.selectionOutlineEnabled=!Jt&&h&&zt.current&&m.overlays.selection.outline&&!R,r.session.selectionOriginsEnabled=!Jt&&h&&m.overlays.selection.origins,r.session.setXray(m.xray)}D()};r.applyPresentation=v,v(),r.cleanups.push(fr(v)),r.cleanups.push(r.store.shell.subscribe(()=>{r.store.shell.showHelpers!==h&&v()})),r.cleanups.push(oi(()=>{k.forgetFailedImages(),v()})),r.cleanups.push(()=>{k.dispose(),r.presentationRig===k&&(r.presentationRig=null)})}r.cleanups.push(()=>{r.defaultBackground instanceof Ps&&r.defaultBackground!==r.dressing?.backgroundTexture&&r.defaultBackground.dispose()})}const $r=(u,g)=>{const k=r.adapter,h=r.viewport;if(!k||!h)return null;const v=re.getBoundingClientRect(),m=new Tt((u-v.left)/Math.max(v.width,1)*2-1,-((g-v.top)/Math.max(v.height,1))*2+1),R=new Cs;R.layers.enableAll(),R.params.Line2={threshold:4},R.setFromCamera(m,r.session?.camera()??h.camera);const Z=r.presentationAdapter,ge=U=>{for(let Y=U;Y;Y=Y.parent){const it=Z?.hierarchy.idForObject3D?.(Y)??k.hierarchy.idForObject3D?.(Y);if(it)return it}return null};let je=null;for(const U of R.intersectObjects([...T.objectMap.values()],!0)){if(Ri(U.object))continue;const Y=ge(U.object);if(Y){je={distance:U.distance,id:Y};break}}const jt=h.visibleHelpers().filter(U=>U.userData.volterPickable===!0);for(const U of R.intersectObjects(jt,!0)){let Y=null,it=!0;for(let ot=U.object;ot;ot=ot.parent)ot.visible||(it=!1),Y??=ot.userData.volterPicksAs??null;if(!it)continue;const is=Y?ge(Y):null;if(is){(!je||U.distance<je.distance)&&(je={distance:U.distance,id:is});break}}return je?.id??null};if(!r.viewport){r.viewport=new oo(re,r.scene,T,N,{renderer:j,authoring:()=>r.adapter??pe,pick:$r,drawCamera:()=>r.session?.camera()??r.viewport.camera,publishPickContext:!1,onProjectionChange:hn,chromeInsetPx:S||_r?0:pr,lightRig:!1}),Yt===!0&&r.viewport.grid.removeFromParent();const u=g=>{const k=$r(g.clientX,g.clientY),h=k&&r.adapter?Ve(r.adapter.hierarchy,k):null;h&&Cr.current?.(h)};N.addEventListener("dblclick",u),r.cleanups.push(()=>N.removeEventListener("dblclick",u))}const b=r.viewport;if(Je){const u=b.camera;r.scene.add(u);const g=new At;g.name="volter:document-studio",g.add(Je),u.add(g),r.documentStudio=g,r.cleanups.push(()=>{Je.removeFromParent(),g.removeFromParent(),r.documentStudio===g&&(r.documentStudio=null),u.removeFromParent()})}if(p){const u=new At;u.name="__object3d_document_overlay",Us(u,"editorHelper",!0),A.add(u),Pe=p.setup({root:O.root,scene:A,renderer:j,overlay:u,camera:()=>r.session?.camera()??b.camera,writable:c!==void 0||o!==void 0});const g=h=>{const v=re.getBoundingClientRect(),m=new Tt((h.clientX-v.left)/Math.max(v.width,1)*2-1,-((h.clientY-v.top)/Math.max(v.height,1))*2+1),R=new Cs;return R.layers.enableAll(),R.setFromCamera(m,r.session?.camera()??b.camera),{pointerId:h.pointerId,button:h.button,buttons:h.buttons,clientX:h.clientX,clientY:h.clientY,altKey:h.altKey,ctrlKey:h.ctrlKey,metaKey:h.metaKey,shiftKey:h.shiftKey,ray:R.ray.clone(),hits:R.intersectObjects([O.root,u],!0)}};ce=new Ho({begin:h=>{if(!c&&!o)throw new Error("This Asset Lab document has no persistence binding; project gestures are read-only.");return Pe.begin(h)},persist:async h=>{await ee(h)},reportError:h=>ne(h instanceof Error?h.message:JSON.stringify(h))});const k=h=>{h.preventDefault(),h.stopPropagation()};bt=h=>{h.target instanceof Element&&h.target.closest('[role="alert"], [role="toolbar"]')!==null||ce?.begin(g(h))&&(k(h),h.isTrusted&&re.setPointerCapture?.(h.pointerId))},yt=h=>{ce?.hasActiveGesture()&&(k(h),ce.update(g(h)))},St=h=>{ce?.hasActiveGesture()&&(k(h),re.hasPointerCapture?.(h.pointerId)&&re.releasePointerCapture?.(h.pointerId),ce.commit(g(h)))},xt=h=>{ce?.hasActiveGesture()&&(k(h),ce.cancel(h.pointerId))},Pt=h=>{h.key!=="Escape"||!ce?.hasActiveGesture()||(h.preventDefault(),ce.cancel())},Wr=()=>{N.addEventListener("pointerdown",bt,!0),N.addEventListener("pointermove",yt,!0),N.addEventListener("pointerup",St,!0),N.addEventListener("pointercancel",xt,!0),window.addEventListener("keydown",Pt)}}const Re=r.content,Gr=[...T.shell.selectedEntityIds],st=r.adapter,gn=r.presentationAdapter,vn=new Map(T.objectMap),ze=r.session?.root,wn=r.frame,bn=r.syncHostScene,yn=dt.current,Sn=pt.current,xn=ht.current,qr=r.session?.neutralBackgroundTexture(),Pn=r.dressing.lights.map(u=>u.visible),Cn=r.cleanups.length,kn=r.initialized;if(Ir=()=>{A.removeFromParent(),wt&&wt.add(O.root),Re&&r.scene.add(Re.scene),r.adapter=st,r.presentationAdapter=gn,r.content=Re,r.frame=wn,r.syncHostScene=bn,r.initialized=kn;for(const u of r.cleanups.splice(Cn))u();!ze&&r.session&&(r.session.dispose(),r.session=null),T.objectMap.clear();for(const[u,g]of vn)T.objectMap.set(u,g);Re&&T.bindScene(Re.scene,j,b.batchedRenderer,b.camera),ze&&st&&r.session?.replaceContent(ze,st),dt.current=yn,pt.current=Sn,ht.current=xn,ft.current=st,Lr(st),qr!==void 0&&r.session?.setNeutralBackground(qr),r.dressing?.lights.forEach((u,g)=>{u.visible=Pn[g]??!0}),ze&&(r.dressing?.frameContent(ze),r.presentationRig?.placeFloor(ze)),T.shell.selectMultiple(Gr),T.notifyIngestObjectMapEdit()},Re?.scene.removeFromParent(),r.scene.add(A),r.adapter=pe,r.presentationAdapter=Et,r.content=rr,T.bindScene(A,j,b.batchedRenderer,b.camera),T.setOrbitTarget(b.orbitControls.target),T.objectMap.clear(),A.traverse(u=>{const g=Et?.hierarchy.idForObject3D?.(u)??pe.hierarchy.idForObject3D?.(u);g&&T.objectMap.set(g,u)}),r.session)r.session.replaceContent(O.root,pe);else{const u=Ws(kr.current),g=Ws(Er.current)??u,k=ct(n).camera;b.setFieldOfView(k.fov);const h=It.current,v=qt!==void 0&&Ut!==void 0&&Kt!==void 0;if(!h&&!v){const m=b.orbitControls.target,R=b.camera.position.distanceTo(m);b.camera.position.copy(m).addScaledVector(new H(...k.opening).normalize(),R)}if(g||b.focusOn(O.root),h){const m=new H(...h.target),R=new H(...h.direction).normalize();b.camera.position.copy(m).addScaledVector(R,h.distance),b.camera.up.set(0,1,0),h.up&&b.camera.up.set(...h.up),b.orbitControls.target.copy(m)}else if(v){const m=g??gr(O.root),R=m.getCenter(new H),Z=new H(qt,Ut,Kt).normalize(),ge=Vt(m,b.camera,Z)*Math.min(10,Math.max(.1,_??1));b.camera.position.copy(R).add(Z.multiplyScalar(ge)),b.orbitControls.target.copy(R)}if(r.session=new Ao(n,O.root,r.scene,j,b,pe,De?null:i===void 0?r.dressing.backgroundTexture:new me(i),u),r.session.selectionOutlineEnabled=!Jt&&zt.current,r.session.setCameraViewSource(Mr.current??null),r.applyPresentation?.(),It.current?.projection==="orthographic"&&r.session.setProjection("orthographic"),!De&&i===void 0&&r.dressing.backgroundTexture){const m=r.session;r.cleanups.push(Oi(()=>{const R=fs(re).background,Z=r.defaultBackground;r.defaultBackground=R!==null?new me(R):Mi(),m.neutralBackgroundTexture()===Z&&m.setNeutralBackground(r.defaultBackground),Z instanceof Ps&&Z!==r.dressing?.backgroundTexture&&Z.dispose()}))}}const nt=I.camera;nt&&(b.setPose(nt.position,nt.target,nt.fov||void 0,nt.up),b.setProjection(Ar),I.camera=null);const q=r.session;dt.current=er,pt.current=_e,ht.current=Pe,ft.current=pe,Lr(pe);const sr=ai(le)?.all?.lighting!==void 0||ci(le)?null:Je?{all:{lighting:{source:"studio",studioPreset:gs.id,auto:null}}}:Hr===!1?{all:{lighting:{source:"scene"}}}:null,nr=Or.current??null;ms(n,le,sr&&nr?li(sr,nr):nr??sr);const ir=new Set(oa);let Ur;const Kr=()=>{const u=r.session?.presentation().mode;u!==Ur&&(Ur=u,r.applyPresentation?.()),!(u===void 0||!ir.has(u))&&ct(n).drawMode!==u&&ui(n,{drawMode:u})},or=hi(n).drawMode;or!==void 0&&ir.has(or)&&r.session?r.session.setMode(or):Kr();const En=r.session?.subscribe(Kr),On=fr(()=>{const u=r.session,g=ct(n).drawMode;u&&u.presentation().mode!==g&&ir.has(u.presentation().mode)&&u.setMode(g)});r.cleanups.push(()=>{En?.(),On()});const Ot=[];O.root.traverse(u=>{u.isLight&&Ot.push(u)});const Mn={light:Ot.length>0,"directional-light":Ot.some(u=>u.isDirectionalLight)};r.contentLights=Ot,r.contentHas=Mn,r.dressing.frameContent(O.root),r.presentationRig?.placeFloor(O.root),r.cleanups.push(T.shell.subscribe(()=>r.presentationRig?.placeFloor(O.root)));const Xr=new Set;T.shell.selectMultiple(Gr.filter(u=>{const g=T.objectMap.get(u)??Ve(pe.hierarchy,u);if(g===null&&!T.objectMap.has(u))return!1;const k=g??u;return Xr.has(k)?!1:(Xr.add(k),!0)})),T.notifyIngestObjectMapEdit(),q.syncSelectionPresentation(),Wr?.(),ne(null),S||vs(n);let Mt=A.background;q.setNeutralBackground(Mt??r.defaultBackground);const We=I.presentation;We&&(q.setMode(We.mode),q.setBackground(We.background),q.setProjection(We.projection),q.setSkeleton(We.skeleton),q.setBounds(We.bounds),I.presentation=null);const Rn=()=>{r.viewport?.alignGridToView(q.camera(),j.domElement.width),r.scene.environment=A.environment??r.defaultEnvironment,r.scene.fog=A.fog,r.scene.environmentIntensity=A.environmentIntensity,r.scene.environmentRotation.copy(A.environmentRotation),r.scene.backgroundIntensity=A.backgroundIntensity,r.scene.backgroundBlurriness=A.backgroundBlurriness,r.scene.backgroundRotation.copy(A.backgroundRotation);const u=r.presentationRig;if(u){const g=u.resolveSource({...r.contentHas,environment:A.environment!==null}),k=u.environment();k&&(r.scene.environment=k.texture??r.defaultEnvironment,r.scene.environmentIntensity=k.intensity,r.scene.environmentRotation.set(0,k.rotation,0));const h=u.backdrop();h!=="keep"?(r.scene.background=h.value,r.scene.backgroundBlurriness=h.blur,r.scene.backgroundIntensity=h.intensity,r.scene.backgroundRotation.set(0,h.rotation,0),r.backdropOverridden=!0):r.backdropOverridden&&(r.scene.background=q.neutralBackgroundTexture(),r.scene.backgroundBlurriness=A.backgroundBlurriness,r.scene.backgroundIntensity=A.backgroundIntensity,r.backdropOverridden=!1);const v=g==="studio"&&u.presetId()===gs.id;r.documentStudio&&(r.documentStudio.visible=v);const m=g==="studio"&&!v||g==="preview"&&!u.sceneLightsShown()?r.darkenContentLights():0;u.update(q.camera()),di(n,{source:g,presetId:u.presetId(),presetLights:u.lightsVisible(),documentStudio:r.documentStudio?r.documentStudio.visible:null,contentLights:r.contentLights.length,contentLightsDarkened:m,environmentIntensity:r.scene.environmentIntensity,environmentImage:u.imageReport().shown,environmentImagePending:u.imageReport().pending,toneMapping:String(j.toneMapping)})}Mt!==A.background&&(Mt=A.background,q.setNeutralBackground(Mt??r.defaultBackground))};r.syncHostScene=Rn,q.setBeforeRender(()=>r.syncHostScene?.()),q.setPresentsFrames(!0);const jn=u=>{Ct||!(u>0)||!Number.isFinite(u)||(r.contentSeconds+=u,r.transportAdvances++,O.update?.(u))},Tn=Vs(O.root,r.transport);r.cleanups.push(()=>Tn.dispose());const Ce=I.transport;Ce&&(Ce.activeSubject&&r.transport.setActiveSubject(Ce.activeSubject),r.transport.setLoop(Ce.range.loop),r.transport.setTimeScale(Ce.timeScale),r.transport.seek(Ce.time),Ce.playbackState==="playing"?r.transport.play():Ce.playbackState==="paused"&&r.transport.pause(),I.transport=null);let ar=performance.now();const Yr=typeof O.onChange=="function";let cr=!0;const Rt=()=>{cr=!0};if(Yr){const u=O.onChange(Rt),g=T.shell.subscribe(Rt),k=["pointerdown","pointermove","pointerup","pointerleave","wheel","keydown","keyup"];for(const h of k)N.addEventListener(h,Rt,{capture:!0,passive:!0});tr=()=>{u(),g();for(const h of k)N.removeEventListener(h,Rt,{capture:!0})}}let Zr=-1;const Qr=new ks,Jr=new ks,es=new Tt,ts=new Tt;let rs,ss=null,ns=Number.NaN;const Vn=u=>{if(!Yr||cr||u>0||bs()!==Zr||q.needsFrame()||r.presence?.live()||Pe?.prepareFrame||Pe?.update||(b.batchedRenderer.batches?.length??0)>0)return!0;const g=q.camera();return g.updateMatrixWorld(),j.getDrawingBufferSize(ts),!g.matrixWorld.equals(Qr)||!g.projectionMatrix.equals(Jr)||!ts.equals(es)||r.scene.background!==rs||j.toneMapping!==ss||j.toneMappingExposure!==ns},An=()=>{cr=!1,Zr=bs();const u=q.camera();Qr.copy(u.matrixWorld),Jr.copy(u.projectionMatrix),j.getDrawingBufferSize(es),rs=r.scene.background,ss=j.toneMapping,ns=j.toneMappingExposure},Ln=(u,g)=>{if(Ct||!j||!b)return;const k=j,h=b,v=q?.profiler;v?.beginFrame(),g&&(ar=u);const m=Math.min((u-ar)/1e3,.1);ar=u,v?.beginPhase();const R=r.transport.tick(m);if(R>0&&jn(R),Pe?.prepareFrame?.(m),Pe?.update?.(m),v?.endPhase("animation"),v?.beginPhase(),r.presence?.syncMarkers(m),b.update(m),S||js(n,m),b.batchedRenderer.update(m),v?.endPhase("editor"),!g&&!Vn(R)){v?.endFrame();return}v?.beginPhase(),k.info.reset();const Z=!Ze.current&&pi()===n;Z&&fi(n);const ge=Z?Date.now():0,je=r.scene.overrideMaterial,jt=q.presentation().mode;jt!=="uv"&&jt!=="vertex-colors"&&(r.scene.overrideMaterial=A.overrideMaterial);try{h.renderWithInfrastructure(()=>{q.renderViewport(m),h.renderViewCube(k)})}finally{r.scene.overrideMaterial=je}q.servePresentedFrame(),An(),Ze.current||(Ze.current=!0,Z&&mi("first-render",Date.now()-ge),gi(n),Gt("ready")),v?.reportRender({gpuMs:null,drawCalls:k.info.render.calls,triangles:k.info.render.triangles,geometries:k.info.memory.geometries,textures:k.info.memory.textures}),v?.endPhase("render"),v?.endFrame();const U=Ft.current;if(U&&ae&&vi(ae.shell)===T.shell){const Y=q.cameraPose();U.frameTime=m*1e3,U.fps=m>0?1/m:0,U.drawCalls=k.info.render.calls,U.triangles=k.info.render.triangles,U.cameraPosition.x=Y.position[0],U.cameraPosition.y=Y.position[1],U.cameraPosition.z=Y.position[2],U.cameraTarget.x=Y.target[0],U.cameraTarget.y=Y.target[1],U.cameraTarget.z=Y.target[2]}};if(r.frame=Ln,ut.current=r.rendererSession,!r.initialized){S||(r.cleanups.push(Ts({camera:b.camera,drawCamera:()=>r.session?.camera()??b.camera,orbit:b.orbitControls,scene:r.scene},()=>null,(v,m)=>b.setHelper(v,m),{documentId:n})),Ke(()=>import("./stage-presence-markers-DT5j8fjP.js"),__vite__mapDeps([69,4,5,7,8,9,10,6,11,12,13,26,27,18,2,70])).then(v=>{if(r.isClosed||G.current!==r||r.presence)return;const m=v.bindStagePresenceMarkers({scene:r.scene,store:T,documentId:n,container:N,canvas:re,viewport:b,readVisibleCameraPose:()=>{const R=r.session?.camera()??b.renderCamera,Z=R.getWorldPosition(new H),ge=R.fov;return{position:Z,target:b.orbitControls.target,fov:typeof ge=="number"?ge:0}}});r.presence=m,r.cleanups.push(()=>m.dispose())}),r.cleanups.push(fo(q,Fs(n))),r.cleanups.push(wi({id:n,label:s,kind:zr?"asset":"source",profiler:q.profiler}))),!S&&!_r&&r.cleanups.push(bi(n,()=>({adapter:r.adapter,nodeId:r.adapter?.selection?.get()[0]??null})));const u=S?`${n}#chromeless-${++aa}`:n;r.cleanups.push(yi({id:u,label:s,contentClock:()=>r.contentSeconds,transportAdvances:()=>r.transportAdvances})),r.cleanups.push(T.shell.onViewportAction(v=>{switch(v.type){case"focus-selection":case"focus-scene":!r.session?.frame()&&r.session?.root&&b.focusOn(r.session.root);break;case"focus-entity":{const m=r.adapter?Ve(r.adapter.hierarchy,v.id):null;m&&b.focusOn(m);break}case"snap-selection-to-floor":b.snapSelectionToFloor();break;case"set-view-preset":r.session?r.session.setViewPreset(v.preset==="perspective"?"isometric":v.preset,"view"):b.setViewPreset(v.preset);break;case"toggle-camera-view":r.session?.toggleCameraView();break;case"frame-all":!r.session?.frame(1,"all")&&r.session?.root?b.focusOn(r.session.root):r.session||b.focusOnScene();break;case"zoom-view":r.session?.cameraView()&&!r.session.cameraViewLocked()?r.session.zoomCameraView(v.direction>0?1.2:1/1.2):b.zoomStep(v.direction);break;case"step-view":if(r.session?.cameraView()&&!r.session.cameraViewLocked())break;b.stepView(v.step);break;case"toggle-projection":{const m=r.session;if(m?.cameraView())break;const Z=(m?m.projection():b.projection)==="perspective"?"orthographic":"perspective";m?m.setProjection(Z):b.setProjection(Z);break}case"set-camera-pose":b.setPose(v.position,v.target,v.fov);break}}));let g="";r.cleanups.push(T.shell.subscribe(()=>{b.objectMap=T.objectMap,b.syncFromStore(),r.session?.syncSelectionPresentation();const v=(r.adapter?.selection?.get()??[]).join("\0");v!==g&&(g=v,S||vs(n))}));const k=()=>{const v=Math.max(1,N.clientWidth),m=Math.max(1,N.clientHeight),R=j.getPixelRatio();(re.width!==Math.floor(v*R)||re.height!==Math.floor(m*R))&&j.setSize(v,m,!1),b.resize(v,m),r.session?.resize(v,m),r.rendererSession.redraw()},h=new ResizeObserver(k);h.observe(N),r.cleanups.push(()=>h.disconnect()),k(),r.initialized=!0,ws()}b.objectMap=T.objectMap,b.syncFromStore(),r.rendererSession.setActive(lt.current),r.rendererSession.redraw(),Nr=!0,Re?.dispose()}catch(ee){if(!Nr)try{Ir?.()}finally{wt&&O.root.parent===A&&wt.add(O.root),rr.dispose()}console.error(`[object3d document] ${s}: source update failed`,ee),ne(ee instanceof Error?ee.message:String(ee))}},mn=Pr.current.then(fn);return Pr.current=mn.catch(Se=>{M||ne(Se instanceof Error?Se.message:String(Se))}),()=>{M=!0}},[l,i,t,qt,Ut,Kt,s,n,ue,Dr,Fr,Yt,Hr,Je,Zt,S,mt,Qe,Xt,p,c,o,W,I,Fe,E,e,Le]),f.useEffect(()=>{const M=ut.current,de=w&&!Rr.current;Rr.current=w,M&&(de&&(Ze.current=!1,ri(n)),M.setActive(w||Le))},[w,n,Le]);const gt=G.current,Qt=$t==="ready"&&gt?.viewport?{store:gt.store,viewport:gt.viewport,canvas:gt.surface.canvas}:null,pn=f.useCallback(()=>{const M=ft.current;return M?{adapter:M,nodeId:M.selection?.get()[0]??M.hierarchy.roots()[0]?.id??null}:null},[]),Br=d.jsx("div",{"data-testid":"tool-object3d-authoring","data-volter-chromeless":S||void 0,className:ue?"volter-object3d-studio-stage":void 0,style:{position:S||he?"relative":"absolute",...S?{width:"100%",height:"100%"}:he?{flex:1,minHeight:0}:{inset:-pr},overflow:"hidden",background:ue?void 0:Ue.surface.raised,pointerEvents:"auto"},children:d.jsxs("div",{ref:Dt,style:{position:"absolute",inset:0,minHeight:0,overflow:"hidden"},children:[d.jsx(ca,{canvasHostRef:Ht}),w&&Qt&&!S?d.jsx(f.Suspense,{fallback:null,children:d.jsx(ra,{stage:Qt})}):null,ae&&!S?d.jsx(qo,{store:ae,documentId:n,stage:Qt,active:w,chrome:"document"}):null,ae&&Tr?d.jsx(Tr.Overlays,{store:ae,documentId:n,cameraPreviewRef:Vr,mountStatus:an,rootIds:ln}):null,Nt&&d.jsx("div",{role:"alert",style:{position:"absolute",insetInline:0,top:0,display:"flex",justifyContent:"center",padding:"var(--volter-space-3)",pointerEvents:"none"},children:d.jsxs("div",{className:"volter-chrome-island",style:{display:"flex",alignItems:"center",gap:"var(--volter-space-3)",maxWidth:"80%",padding:"var(--volter-space-2) var(--volter-space-3)",borderRadius:"var(--volter-radius-md)",border:`var(--volter-stroke-resting) solid ${Ue.semantic.danger}`,background:Ue.surface.raised,color:Ue.semantic.danger,pointerEvents:"auto"},children:[d.jsx("span",{children:Nt}),d.jsx(Te,{size:"compact","aria-label":"Dismiss",onClick:()=>ne(null),"data-testid":"object3d-document-error-dismiss",children:d.jsx(we,{icon:ve.action.close})})]})}),!Nt&&$t==="building"&&d.jsx(wo,{testId:"object3d-document-status",children:bo}),d.jsx("div",{style:{position:"absolute",inset:S||he?0:pr,pointerEvents:"none"},children:!S&&$t==="ready"&&G.current&&d.jsx(ea,{viewport:G.current.viewport,documentId:n,session:G.current.session,store:G.current.store.shell,projection:Ar,displayName:s,...F?{statistics:F}:{},...be!==void 0?{subject:be}:{},...Ee?{gridScale:Ee}:{},objectName:M=>(de=>de?Ve(de.hierarchy,M)?.name:void 0)(G.current?.adapter)??G.current?.store.objectMap.get(M)?.name??null})})]})});return he?d.jsx(si,{documentId:n,active:w,type:B??(mt?"entity":"model"),title:s,status:e,selection:pn,fill:!0,children:d.jsxs("div",{className:"volter-object3d-asset-workspace",children:[Br,d.jsx(vo,{transport:G.current?.transport??null})]})}):Br}function ua(n){return d.jsx(nn,{...n})}const za=Object.freeze(Object.defineProperty({__proto__:null,Object3DDocumentViewport:nn,ToolObject3DAuthoring:ua},Symbol.toStringTag,{value:"Module"}));export{nn as O,za as S,Ko as V,Ds as s,Wo as t};
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{az as y,aA as f,al as g,aB as x,aC as S}from"./index-D9mY4HWY.js";import{r as j}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";class w extends j.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,o){console.error(`[stories] ${this.props.modulePath} — story "${this.props.storyName}" crashed while rendering:`,t,o.componentStack)}render(){return this.state.error?e.jsxs("div",{style:{padding:12,fontSize:12,color:g.semantic.danger,maxWidth:640},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:["Story crashed: ",e.jsx("code",{children:this.props.modulePath})," — export"," ",e.jsx("code",{children:this.props.storyName})]}),e.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)})]}):this.props.children}}const a=new WeakMap;async function k(r,t,o,i,s){const n=a.get(r),c=(n?.generation??0)+1;a.set(r,{root:n?.root,generation:c}),y(r);const d=S();d&&await x(d.rootPath),await i.load();const{createRoot:m,flushSync:h}=await f(),p=a.get(r);if(!p||p.generation!==c)return null;const u=n?.root??m(r);return a.set(r,{root:u,generation:c}),h(()=>{u.render(e.jsx(w,{modulePath:t,storyName:o,children:e.jsx(i,{...s??{}})}))}),{root:u,unmount:()=>{queueMicrotask(()=>{const l=a.get(r);!l||l.generation!==c||!l.root||(a.delete(r),l.root.unmount())})}}}async function B(r,t,o,i){if(typeof o.play!="function")return{ran:!1};try{return await o.play({canvasElement:i}),{ran:!0}}catch(s){const n=String(s instanceof Error?s.message:s);return console.error(`[stories] ${r} — story "${t}"'s play() threw:`,s),{ran:!0,error:`[stories] ${r} — story "${t}"'s play() failed: ${n}`}}}export{k as m,B as r};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{az as y,aA as f,al as g,aB as x,aC as S}from"./index-DBIFLhzt.js";import{r as j}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";class w extends j.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,o){console.error(`[stories] ${this.props.modulePath} — story "${this.props.storyName}" crashed while rendering:`,t,o.componentStack)}render(){return this.state.error?e.jsxs("div",{style:{padding:12,fontSize:12,color:g.semantic.danger,maxWidth:640},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:["Story crashed: ",e.jsx("code",{children:this.props.modulePath})," — export"," ",e.jsx("code",{children:this.props.storyName})]}),e.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)})]}):this.props.children}}const a=new WeakMap;async function k(r,t,o,i,s){const n=a.get(r),c=(n?.generation??0)+1;a.set(r,{root:n?.root,generation:c}),y(r);const d=S();d&&await x(d.rootPath),await i.load();const{createRoot:m,flushSync:h}=await f(),p=a.get(r);if(!p||p.generation!==c)return null;const u=n?.root??m(r);return a.set(r,{root:u,generation:c}),h(()=>{u.render(e.jsx(w,{modulePath:t,storyName:o,children:e.jsx(i,{...s??{}})}))}),{root:u,unmount:()=>{queueMicrotask(()=>{const l=a.get(r);!l||l.generation!==c||!l.root||(a.delete(r),l.root.unmount())})}}}async function B(r,t,o,i){if(typeof o.play!="function")return{ran:!1};try{return await o.play({canvasElement:i}),{ran:!0}}catch(s){const n=String(s instanceof Error?s.message:s);return console.error(`[stories] ${r} — story "${t}"'s play() threw:`,s),{ran:!0,error:`[stories] ${r} — story "${t}"'s play() failed: ${n}`}}}export{k as m,B as r};