@volter/game-editor 0.5.65 → 0.5.66

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 (544) hide show
  1. package/BUNDLED_NOTICES +1962 -363
  2. package/catalog/entries/bake.json +0 -1
  3. package/catalog/entries/blender.json +2 -2
  4. package/catalog/entries/reflections.json +2 -4
  5. package/catalog/project-source/src/lib/bake/asset-seed.ts +1 -2
  6. package/catalog/project-source/src/lib/bake/clip-layering.ts +3 -4
  7. package/catalog/project-source/src/lib/bake/gltf-bake.ts +1 -1
  8. package/catalog/project-source/src/lib/bake/params.ts +3 -5
  9. package/catalog/project-source/src/lib/bake/rest-relative-animation.ts +2 -3
  10. package/dist/.vite/manifest.json +2406 -2182
  11. package/dist/assets/{AssetBudgetPanel-J9--TZPU.js → AssetBudgetPanel-csYWK2H4.js} +8 -8
  12. package/dist/assets/{AudioViewer-CR7333fe.js → AudioViewer-BH_LUYs5.js} +1 -1
  13. package/dist/assets/{BVHLoader-6bQIXhMX.js → BVHLoader-Jkzh8hMf.js} +1 -1
  14. package/dist/assets/BufferGeometryUtils-CAbuTPOA.js +1 -0
  15. package/dist/assets/{CCDIKSolver-CD7vLpsK.js → CCDIKSolver-D4NvkJ8d.js} +1 -1
  16. package/dist/assets/{CSS3DRenderer-CL7ABLVK.js → CSS3DRenderer-CAS2WZZy.js} +1 -1
  17. package/dist/assets/CanvasSceneViewport-BlsRTk-X.js +1 -0
  18. package/dist/assets/ColladaLoader-DxYB89DA.js +3 -0
  19. package/dist/assets/{ColorInput-DQBNrW-K.js → ColorInput-CPQNsDf1.js} +1 -1
  20. package/dist/assets/{ConvexGeometry-CAzXlPVG.js → ConvexGeometry-Dinf-sev.js} +1 -1
  21. package/dist/assets/{ConvexHull-BINCESFp.js → ConvexHull-CrJ8FY-w.js} +1 -1
  22. package/dist/assets/{DecalGeometry-160KRdfg.js → DecalGeometry-owkbefLa.js} +1 -1
  23. package/dist/assets/EffectComposer-BHDH-NLz.js +1 -0
  24. package/dist/assets/EntityModelDocument-DuQivdvc.js +1 -0
  25. package/dist/assets/EnvironmentAssetDocument-CnTEMn3A.js +1 -0
  26. package/dist/assets/FBXLoader-BMUbIhtE.js +1 -0
  27. package/dist/assets/Fbo-DrK7CWlB.js +1 -0
  28. package/dist/assets/{FontLoader-CvGoVI5a.js → FontLoader-BR_K6Baw.js} +2 -2
  29. package/dist/assets/GLTFExporter-BZqAQJbw.js +1 -0
  30. package/dist/assets/{GameplaySessionTimeline-B52W3FVZ.js → GameplaySessionTimeline-Crqwv2fP.js} +1 -1
  31. package/dist/assets/Gltf-7cVbZUzT.js +2 -0
  32. package/dist/assets/ImageViewer-BkFie7Hm.js +1 -0
  33. package/dist/assets/InspectorObjectPreview-Dl3tyJBn.js +1 -0
  34. package/dist/assets/JsonAssetDocument-BUFzubHM.js +2 -0
  35. package/dist/assets/{LineSegments2-CsOpKSiM.js → LineSegments2-Cicm_Hu1.js} +2 -2
  36. package/dist/assets/LiveModuleDocument-C3OQxiba.js +1 -0
  37. package/dist/assets/LutAssetDocument-DVzd1RZ9.js +1 -0
  38. package/dist/assets/{MTLLoader-_Xzd4_0p.js → MTLLoader-Bg_grNiT.js} +2 -2
  39. package/dist/assets/{MarchingCubes-Bsp4wrzd.js → MarchingCubes-a78AL3HB.js} +1 -1
  40. package/dist/assets/MeshBVH-BCSLNEeP.js +1 -0
  41. package/dist/assets/ModelAssetDocument-pN84goRT.js +1 -0
  42. package/dist/assets/{NonThreeAuthoringBootstrap-C3woOMxX.js → NonThreeAuthoringBootstrap-BKNejRiW.js} +1 -1
  43. package/dist/assets/{OBJLoader-BhIC6Hwo.js → OBJLoader-BiwzVj5b.js} +2 -2
  44. package/dist/assets/Object3DDocumentToolbar-D5Bg5FEf.js +1 -0
  45. package/dist/assets/Object3DDocumentViewport-DFHqru3a.js +2 -0
  46. package/dist/assets/Object3DPreview-BTtZ-41z.js +2 -0
  47. package/dist/assets/OnlineAssetDetail-BAqozdAp.js +1 -0
  48. package/dist/assets/{OrbitControls-DLpayAaK.js → OrbitControls-CzKVCORl.js} +1 -1
  49. package/dist/assets/{OrbitControls-CM3bPray.js → OrbitControls-CzTRRI7x.js} +1 -1
  50. package/dist/assets/{OrthographicCamera-bQozawrh.js → OrthographicCamera-CSDDsvu7.js} +1 -1
  51. package/dist/assets/{PLYLoader-DYQqs5Ik.js → PLYLoader-QxrxxMpE.js} +2 -2
  52. package/dist/assets/{PerspectiveCamera-CQ2lh01o.js → PerspectiveCamera-DzD_NfVh.js} +1 -1
  53. package/dist/assets/PlayBar-qVJpgwJt.js +2 -0
  54. package/dist/assets/QuarksAssetDocument-B4vBlUsS.js +2 -0
  55. package/dist/assets/RGBELoader-WQ7xZofE.js +1 -0
  56. package/dist/assets/RectAreaLightUniformsLib-CwcuoVqt.js +1 -0
  57. package/dist/assets/{RenderPass-DPrn-Uky.js → RenderPass-C_CeQNdh.js} +1 -1
  58. package/dist/assets/{ResolutionPicker-C67vs1F3.js → ResolutionPicker-DpHVJxn5.js} +1 -1
  59. package/dist/assets/RootSelectionOverlay-BxvsunO4.js +1 -0
  60. package/dist/assets/{RoundedBox-BDGBg6QZ.js → RoundedBox-B_cZ0NFy.js} +1 -1
  61. package/dist/assets/{RoundedBoxGeometry-CyUuYPfW.js → RoundedBoxGeometry-Y4rcSIvX.js} +1 -1
  62. package/dist/assets/STLLoader-Bej_Nkpr.js +1 -0
  63. package/dist/assets/{SelectionBox-D_75KrNW.js → SelectionBox-Cn9vm7f9.js} +1 -1
  64. package/dist/assets/ShaderAssetDocument-Dx2x8CLr.js +12 -0
  65. package/dist/assets/{ShaderPass-QYRpPuFJ.js → ShaderPass-qtkA7CQ8.js} +1 -1
  66. package/dist/assets/{ShadowEditor-DkImwu1Y.js → ShadowEditor-BEIUkrHL.js} +1 -1
  67. package/dist/assets/SimplifyModifier-D2EesGr2.js +1 -0
  68. package/dist/assets/{SkeletonUtils-Cps8GOC6.js → SkeletonUtils-C8ayciDc.js} +1 -1
  69. package/dist/assets/{Sky-CQKCgYDs.js → Sky-BBpnAJZV.js} +1 -1
  70. package/dist/assets/SourceAssetViewer-BpMbbuy6.js +1 -0
  71. package/dist/assets/StageHost-lB8f---y.js +2 -0
  72. package/dist/assets/{StoryPreviewMount-DjyxRCXu.js → StoryPreviewMount-BIfxmkYh.js} +1 -1
  73. package/dist/assets/{TDSLoader-D_T8XJ81.js → TDSLoader-rHl5Uwc0.js} +1 -1
  74. package/dist/assets/{TextGeometry-DOWAEUV0.js → TextGeometry-BRHSufuM.js} +1 -1
  75. package/dist/assets/ThreeBoardDocument-BHV92Ia3.js +2 -0
  76. package/dist/assets/{ThreeIsolationSceneContent-C8C8whSF.js → ThreeIsolationSceneContent-BqtgDHBK.js} +1 -1
  77. package/dist/assets/{ToolObject3DPreview-BRoDWe4Q.js → ToolObject3DPreview-CcaPJTyH.js} +1 -1
  78. package/dist/assets/Toolbar-keHcSvDD.js +1 -0
  79. package/dist/assets/{TrackballControls-DfznuQTh.js → TrackballControls-Cce-6Ff5.js} +1 -1
  80. package/dist/assets/{TransientHint-BB1fwrvK.js → TransientHint-Dlslh3oX.js} +1 -1
  81. package/dist/assets/{UnrealBloomPass-CR-cS_K5.js → UnrealBloomPass-DiseEiFK.js} +2 -2
  82. package/dist/assets/{VideoViewer-C6kocgIU.js → VideoViewer-naGSXHd6.js} +1 -1
  83. package/dist/assets/ViewportShadingMenu-C7Hdhtca.js +1 -0
  84. package/dist/assets/{active-ingest-CT6jSGhr.js → active-ingest-DEgq9JiA.js} +3 -3
  85. package/dist/assets/{animation-clock-CnjZqfJp.js → animation-clock-lTIb6nk3.js} +1 -1
  86. package/dist/assets/animation-mixers.service-2O2rVwQf.js +1 -0
  87. package/dist/assets/asset-budget-asset.menu-9NhdHAC9.js +1 -0
  88. package/dist/assets/asset-budget.action-yg6-luUJ.js +1 -0
  89. package/dist/assets/asset-budget.document-B46_VFqa.js +1 -0
  90. package/dist/assets/asset-budget.menu-DuH07N-e.js +1 -0
  91. package/dist/assets/{asset-editor-persistence-BBaONOJt.js → asset-editor-persistence-BVtzjadu.js} +1 -1
  92. package/dist/assets/{asset-loaders-BOy5Ss8k.js → asset-loaders-BxG1LykH.js} +2 -2
  93. package/dist/assets/{assets-BuSoGjBX.js → assets-Do88ZdV_.js} +1 -1
  94. package/dist/assets/{audio-unlock.service-CfUgUQVy.js → audio-unlock.service-BJH0mWvX.js} +1 -1
  95. package/dist/assets/{audio.utility-C6K6jem8.js → audio.utility-Cp4aVYFU.js} +1 -1
  96. package/dist/assets/autoplay.service-FxpRy7Ev.js +1 -0
  97. package/dist/assets/{babylon-authoring-adapter-CL02gWDn.js → babylon-authoring-adapter-B_8iE8fK.js} +1 -1
  98. package/dist/assets/{binding-resolver-Dsh-6Vor.js → binding-resolver-BWwG10zJ.js} +2 -2
  99. package/dist/assets/blender-emscripten-engine-CEsWgnR7.js +2 -0
  100. package/dist/assets/{blender-node-editor.document-iIDkB9sI.js → blender-node-editor.document-DTgwy8KC.js} +1 -1
  101. package/dist/assets/blender-properties-tab-DWSJpkxq.js +3 -0
  102. package/dist/assets/blender-runtime-host-OGjPjTrG.js +4 -0
  103. package/dist/assets/{blender-runtime-skin-DyQ9B6CR.js → blender-runtime-skin-DymtXlpt.js} +37 -39
  104. package/dist/assets/blender-runtime.document-CzH2ohHR.js +8 -0
  105. package/dist/assets/{blender-timeline.document-77fx96N7.js → blender-timeline.document-BRy_QPHt.js} +1 -1
  106. package/dist/assets/{blender-uv-editor.document-fsT7B4gV.js → blender-uv-editor.document-D-AbUCqz.js} +1 -1
  107. package/dist/assets/{blender-version.status-o6dBm3n6.js → blender-version.status-B7flzX_7.js} +1 -1
  108. package/dist/assets/{blender-wali-engine-wTOcrOMC.js → blender-wali-engine-D3iKpzn9.js} +1 -1
  109. package/dist/assets/blender.command-BVHtgTQy.js +1 -0
  110. package/dist/assets/blender.environment-CG-pC7sk.js +1 -0
  111. package/dist/assets/{blender.style-Dcem5f_T.js → blender.style-CxfbTFcE.js} +1 -1
  112. package/dist/assets/{board-guides-DziKSTss.js → board-guides-C3usUZZk.js} +1 -1
  113. package/dist/assets/body-marks-D8iaje6y.js +1 -0
  114. package/dist/assets/bridge.command-BF9u6r0A.js +3 -0
  115. package/dist/assets/browserAll-38aBu-cf.js +1 -0
  116. package/dist/assets/{build-profiles.document-kW8iw8Xj.js → build-profiles.document-DO7oNRuo.js} +2 -2
  117. package/dist/assets/{build-progress.status-BNRLytg2.js → build-progress.status-COeNVhYd.js} +1 -1
  118. package/dist/assets/{build-session-C_sg3CEn.js → build-session-IWIriS5P.js} +1 -1
  119. package/dist/assets/{build.action-lYjTLb7K.js → build.action-DlkFvZf6.js} +1 -1
  120. package/dist/assets/{build.command-DIGgUPU_.js → build.command-DPqQIYj_.js} +1 -1
  121. package/dist/assets/{build.header-CKajx5U3.js → build.header-CNLG-pV8.js} +1 -1
  122. package/dist/assets/{build.menu-BdU0QXny.js → build.menu-hUlH6loi.js} +1 -1
  123. package/dist/assets/{build.service-CbBAyeu3.js → build.service-C86Td3_9.js} +1 -1
  124. package/dist/assets/{camera-KEsKvOL7.js → camera-CKbyBXMe.js} +1 -1
  125. package/dist/assets/camera-authoring-Ci3KnE-W.js +1 -0
  126. package/dist/assets/{camera-runtime.inspector-B7unX4g1.js → camera-runtime.inspector-DdR3P2BF.js} +1 -1
  127. package/dist/assets/canvas-entry-runtime-E5YjSgre.js +2 -0
  128. package/dist/assets/canvas-preview-frames-CiAx7dpV.js +1 -0
  129. package/dist/assets/{capability-coverage-Czas4C18.js → capability-coverage-CfUeULDN.js} +5 -5
  130. package/dist/assets/city-EkhAOo5s.exr +0 -0
  131. package/dist/assets/{collaboration-presence-DLoZ7EA3.js → collaboration-presence-CSLFNT7m.js} +1 -1
  132. package/dist/assets/{collider-Bw0mXlsW.js → collider-DRSaLRM9.js} +1 -1
  133. package/dist/assets/{component-board.service-DCwcUssB.js → component-board.service-B7Sv8b7m.js} +2 -2
  134. package/dist/assets/component-board.service-B8UHw8dn.js +2 -0
  135. package/dist/assets/component-contracts.service-LFGekycZ.js +1 -0
  136. package/dist/assets/{component-verbs.command-7xzfjGMZ.js → component-verbs.command-D4SvFjfG.js} +1 -1
  137. package/dist/assets/component-verbs.service-TGvWxf2b.js +1 -0
  138. package/dist/assets/{config-CEZk921y.js → config-DB_RH-hO.js} +3 -3
  139. package/dist/assets/{configurations-DTBMdaTL.js → configurations-C2qgJNnW.js} +1 -1
  140. package/dist/assets/{connection.status-BifnQdOs.js → connection.status-CG7X2brL.js} +1 -1
  141. package/dist/assets/{console-bridge-CHcb-xk5.js → console-bridge-B5Ltae37.js} +1 -1
  142. package/dist/assets/{constraint-De8f1Uiq.js → constraint-C_Jj7dXy.js} +1 -1
  143. package/dist/assets/constraints.inspector-D6QZJS4b.js +1 -0
  144. package/dist/assets/courtyard-DqlebbpC.exr +0 -0
  145. package/dist/assets/coverage.service-Clo86874.js +3 -0
  146. package/dist/assets/{create-runtime-CVCc1BDx.js → create-runtime-lmA910XT.js} +1 -1
  147. package/dist/assets/{curve-7Q79VgU4.js → curve-6-TR6dNb.js} +1 -1
  148. package/dist/assets/{data-asset-4hjS642k.js → data-asset-BNbd309U.js} +1 -1
  149. package/dist/assets/{data-ref-CQI28C0D.js → data-ref-Dvmd7eb1.js} +1 -1
  150. package/dist/assets/{debug-bridge-CCohG-d-.js → debug-bridge-BUNhgyY6.js} +1 -1
  151. package/dist/assets/{debug-registry-Dgvitx8M.js → debug-registry-B3Cnne3x.js} +1 -1
  152. package/dist/assets/deferred-ingest-play-7V8OrW3e.js +2 -0
  153. package/dist/assets/design-time-layers-g9VS6amb.js +1 -0
  154. package/dist/assets/design-time-mount.service-HtMr_vBd.js +2 -0
  155. package/dist/assets/design-time-react-mount-Dx6fJ-Hg.js +1 -0
  156. package/dist/assets/{directional-shadow-fit-BVkOKAv2.js → directional-shadow-fit-Cjz_Eg2b.js} +1 -1
  157. package/dist/assets/{document-preview-three-Kbg2GCLm.js → document-preview-three-C3y0syYQ.js} +1 -1
  158. package/dist/assets/{dom-authoring-adapter-CY8C7f4T.js → dom-authoring-adapter-CEeFyatF.js} +1 -1
  159. package/dist/assets/{draco3d-BBUTcNkz.js → draco3d-FKy0apkb.js} +1 -1
  160. package/dist/assets/drei-asset-caches-jJoHXbTj.js +2 -0
  161. package/dist/assets/{edit-mode-audio.service-Bzetwd5B.js → edit-mode-audio.service-DZTnrW6t.js} +1 -1
  162. package/dist/assets/edit-mode-authoring-D_BiHCQj.js +1 -0
  163. package/dist/assets/{edit-mode-networking.service-YCX6RRb_.js → edit-mode-networking.service-BzMI2VxO.js} +1 -1
  164. package/dist/assets/editor-api-Bzmo0o8_.js +1 -0
  165. package/dist/assets/{entry-adjudication-Cq8Yeb74.js → entry-adjudication-BYy7TXOB.js} +1 -1
  166. package/dist/assets/{events-156d8d12.esm-ErOhDXXB.js → events-156d8d12.esm-C734MYnx.js} +7 -7
  167. package/dist/assets/{extend-B-eOccUm.js → extend-CLG0ymiX.js} +1 -1
  168. package/dist/assets/forest-P_CQY3b_.exr +0 -0
  169. package/dist/assets/fork-menu-De7HU6_H.js +1 -0
  170. package/dist/assets/{frame-debugger-store-D1Mf_5up.js → frame-debugger-store-BZgIOlU6.js} +1 -1
  171. package/dist/assets/{game-DHOZVb-7.js → game-D5EJoILQ.js} +1 -1
  172. package/dist/assets/{game-contract-seams-a5YXejOu.js → game-contract-seams-TCpIMmHP.js} +1 -1
  173. package/dist/assets/{game-css-scope-transform-Eng4wS8E.js → game-css-scope-transform-NbpajQr-.js} +1 -1
  174. package/dist/assets/game-document.service-6eRlrI-d.js +1 -0
  175. package/dist/assets/game-eval.command-hKnSMlX0.js +2 -0
  176. package/dist/assets/{game-input-seams-CIQdetRw.js → game-input-seams-BC6xhZy3.js} +1 -1
  177. package/dist/assets/{game-module-access-B2mFxv-i.js → game-module-access-ry3xb1Ix.js} +1 -1
  178. package/dist/assets/{gameplay-export-BoKXm51x.js → gameplay-export-DiLQuPpn.js} +1 -1
  179. package/dist/assets/gameplay-replay-Bsre-1K8.js +1 -0
  180. package/dist/assets/{gameplay-rng-trap-CTNhm-UW.js → gameplay-rng-trap-BhRx_CtU.js} +1 -1
  181. package/dist/assets/gameplay.command-BqiyGn-I.js +1 -0
  182. package/dist/assets/{generation-jobs-BQrXbGp_.js → generation-jobs-BYcpgeGk.js} +1 -1
  183. package/dist/assets/generation.service-O81IqA-6.js +1 -0
  184. package/dist/assets/{generations-DzUogZsM.js → generations-CsGQ3twi.js} +1 -1
  185. package/dist/assets/{generations.status-CgOUBCum.js → generations.status-C3YU0_ml.js} +1 -1
  186. package/dist/assets/godot.style-DxJaFWOP.js +1 -0
  187. package/dist/assets/godot.view-BFsHk8b2.js +1 -0
  188. package/dist/assets/{hosted-asset-materialization-CiIvWkGU.js → hosted-asset-materialization-Bk-plQF6.js} +2 -2
  189. package/dist/assets/{ibl-override-material-BlmCxFKq.js → ibl-override-material-BhbGwgS1.js} +1 -1
  190. package/dist/assets/{index-mjWQmGhM.js → index-0n9eSzwT.js} +1 -1
  191. package/dist/assets/index-B4bmKkgY.css +1 -0
  192. package/dist/assets/index-BLo2LE8C.js +3404 -0
  193. package/dist/assets/index-BWW4-DBH.js +1 -0
  194. package/dist/assets/index-CLcsjKUs.js +1 -0
  195. package/dist/assets/index-CU5YUq-x.js +134 -0
  196. package/dist/assets/{index-DUpHH6JR.js → index-Cb6o_Td_.js} +1 -1
  197. package/dist/assets/index-Ckxb31Yz.js +1500 -0
  198. package/dist/assets/index-CnpsJMao.js +1 -0
  199. package/dist/assets/index-Cr23XhNm.js +1 -0
  200. package/dist/assets/index-DO1rWQ_r.js +487 -0
  201. package/dist/assets/{index-BcCBqgM_.js → index-DUh02lTr.js} +1 -1
  202. package/dist/assets/index-DXEHfb0b.js +1 -0
  203. package/dist/assets/{index-V1R-e5Bd.js → index-wRCvCebM.js} +1 -1
  204. package/dist/assets/{inference-diagnostics-Dhmtfbq_.js → inference-diagnostics-YW0yJkKx.js} +1 -1
  205. package/dist/assets/{ingest-BbYMC2vQ.js → ingest-BlQnR7s3.js} +1 -1
  206. package/dist/assets/ingest-boot-viewport-uG9jQ1zm.js +1 -0
  207. package/dist/assets/ingest-siblings-DRQXSWax.js +1 -0
  208. package/dist/assets/{ingest-source-persistence-C_6Hiyra.js → ingest-source-persistence-DH6ioCOu.js} +1 -1
  209. package/dist/assets/{ingest.service-BTDnQfM1.js → ingest.service-GeaWMaZX.js} +1 -1
  210. package/dist/assets/{input-manager-DH_hGW6d.js → input-manager-Cxx3RJgG.js} +1 -1
  211. package/dist/assets/{input-router-BNQvtIqw.js → input-router-FzxO5ld6.js} +1 -1
  212. package/dist/assets/{inspect-BZfi3mmo.js → inspect-BRgDdtVk.js} +1 -1
  213. package/dist/assets/instances.command-CFOMPSj3.js +1 -0
  214. package/dist/assets/{instruments-CKR02Y8I.js → instruments-IKn-vvNb.js} +1 -1
  215. package/dist/assets/interior-Bo_lba15.exr +0 -0
  216. package/dist/assets/{json-history-resource-BbxllWfV.js → json-history-resource-r-9q_hxP.js} +1 -1
  217. package/dist/assets/{light-D-_wsKTq.js → light-CFAor97k.js} +1 -1
  218. package/dist/assets/light-camera-factory-D1sgz3YB.js +1 -0
  219. package/dist/assets/live-mixers-BRkRHd6g.js +1 -0
  220. package/dist/assets/{loader-CaF_I7Yt.js → loader-BbMsvIxP.js} +1 -1
  221. package/dist/assets/machine.document-CgmsOh-s.js +24 -0
  222. package/dist/assets/machines.finder-nxiCgQc2.js +1 -0
  223. package/dist/assets/matcap-texture-Dh65bX5V.js +1 -0
  224. package/dist/assets/{material-CpAdjDxn.js → material-D5kXEZWQ.js} +1 -1
  225. package/dist/assets/{material-factory-Bz6h__6g.js → material-factory-0Qb0VuZ5.js} +1 -1
  226. package/dist/assets/material-preview.view-DqNcpd_b.js +1 -0
  227. package/dist/assets/{mesh-B3WPtNKO.js → mesh-BKPgNTwh.js} +1 -1
  228. package/dist/assets/{mesh-shadow-CZnXrw_l.js → mesh-shadow-BDQP4mHs.js} +1 -1
  229. package/dist/assets/model-asset-sections.service-DWPLmkqa.js +1 -0
  230. package/dist/assets/model-inspection-Cxfg_Fei.js +1 -0
  231. package/dist/assets/model.layout-BpZE1W9V.js +1 -0
  232. package/dist/assets/{models.finder-G2jQgIRu.js → models.finder-DHW17ZEa.js} +1 -1
  233. package/dist/assets/module-mode-CRfHyIMS.js +2 -0
  234. package/dist/assets/mount-canvas-ingest-root-BZZ8M3Lu.js +2 -0
  235. package/dist/assets/mount-dom-ingest-root-D1GV6Jjt.js +2 -0
  236. package/dist/assets/{mount-game-6t9cKNo4.js → mount-game-F9e76auh.js} +1 -1
  237. package/dist/assets/mount-ingest-root-B5D-Lmmk.js +2 -0
  238. package/dist/assets/{mount-manifest-CGVxhmAw.js → mount-manifest-cYRhgHfo.js} +1 -1
  239. package/dist/assets/mount-three-ingest-root-BNnouaBn.js +1 -0
  240. package/dist/assets/{mounted-authoring-Dmg5xmhP.js → mounted-authoring-TIN5EnCb.js} +1 -1
  241. package/dist/assets/{mounted-story-viewport-source-DjP6RA9U.js → mounted-story-viewport-source-CAlEmE0_.js} +1 -1
  242. package/dist/assets/{native-debug-module-CWicoSGD.js → native-debug-module-j-MekcLS.js} +1 -1
  243. package/dist/assets/{navigation-CIiCx-SM.js → navigation-DmR1BDVo.js} +1 -1
  244. package/dist/assets/{navmesh.menu-CAKiH8PW.js → navmesh.menu-FhL1pGx1.js} +1 -1
  245. package/dist/assets/{navmesh.service-jgDWlgj1.js → navmesh.service-usyDeJlm.js} +1 -1
  246. package/dist/assets/{network.utility-CEu5nHf7.js → network.utility-BPh4hTmh.js} +1 -1
  247. package/dist/assets/night-CvV4Gybt.exr +0 -0
  248. package/dist/assets/{object3d-authoring-subject-CH5sI2oP.js → object3d-authoring-subject-CyE4rQ2A.js} +1 -1
  249. package/dist/assets/oid-transform-BOqL6YH6.js +2 -0
  250. package/dist/assets/{particles-Y626p22p.js → particles-C47L-dda.js} +1 -1
  251. package/dist/assets/particles-factory-CRqPLdS7.js +1 -0
  252. package/dist/assets/pixi-authoring-adapter-C5Ikqj5-.js +1 -0
  253. package/dist/assets/{pixi-live-write-target-DuWydlWb.js → pixi-live-write-target-OWBk79dp.js} +1 -1
  254. package/dist/assets/pixi-primitive-D5igywJ_.js +1 -0
  255. package/dist/assets/pixi-react-root-factory-9lZ0Yz-n.js +1 -0
  256. package/dist/assets/play-mode-DomOvQie.js +22 -0
  257. package/dist/assets/play.command-DoqjH-Pp.js +2 -0
  258. package/dist/assets/{playtest-BXIL1JEF.js → playtest-BnFenMBW.js} +1 -1
  259. package/dist/assets/{pose-guard-6Osb2cFu.js → pose-guard-Bb3gZOzk.js} +1 -1
  260. package/dist/assets/{product-DFhyARJj.js → product-CTDJoVo5.js} +1 -1
  261. package/dist/assets/{profiler.action-CaXJDp3t.js → profiler.action-C_OFGkDw.js} +1 -1
  262. package/dist/assets/{profiler.menu-BIMF6Bi4.js → profiler.menu-BJbnVoo4.js} +1 -1
  263. package/dist/assets/{profiler.utility-BExw9wBO.js → profiler.utility-qpfhuwRw.js} +1 -1
  264. package/dist/assets/project-authoring-session-BV-MM8Fl.js +2 -0
  265. package/dist/assets/{project-provenance-BoP3nrle.js → project-provenance-4ldz-EOG.js} +1 -1
  266. package/dist/assets/{properties-bone-constraints.inspector-ByT6p7S-.js → properties-bone-constraints.inspector-C-ByIdg1.js} +1 -1
  267. package/dist/assets/{properties-bone.inspector-z4qJwKO5.js → properties-bone.inspector-CXY0xCQB.js} +1 -1
  268. package/dist/assets/{properties-collection.inspector-D0_3ijWU.js → properties-collection.inspector-DIfkZAel.js} +1 -1
  269. package/dist/assets/{properties-constraints.inspector-CESzjuls.js → properties-constraints.inspector-BaunL5nT.js} +1 -1
  270. package/dist/assets/{properties-data.inspector-hG8Wgyzb.js → properties-data.inspector-DQD-jfO2.js} +1 -1
  271. package/dist/assets/{properties-material.inspector-CzY0JCQ6.js → properties-material.inspector-A0HZ4SX6.js} +1 -1
  272. package/dist/assets/{properties-modifiers.inspector-3dDhwf7g.js → properties-modifiers.inspector-GUnVhVwZ.js} +1 -1
  273. package/dist/assets/{properties-object.inspector-CiarfxkT.js → properties-object.inspector-Chsfa4Xa.js} +1 -1
  274. package/dist/assets/{properties-output.inspector-DKJxmKSD.js → properties-output.inspector-U7ZmD0Me.js} +1 -1
  275. package/dist/assets/{properties-particles.inspector-CCEdYWGm.js → properties-particles.inspector-umkW-OlI.js} +1 -1
  276. package/dist/assets/{properties-physics.inspector-B2c0KUyA.js → properties-physics.inspector-CLVBlWwL.js} +1 -1
  277. package/dist/assets/{properties-render.inspector-Bcm0HLRW.js → properties-render.inspector-D0u9taKy.js} +1 -1
  278. package/dist/assets/{properties-scene.inspector-PIM_eTb_.js → properties-scene.inspector-JwGCZQAx.js} +1 -1
  279. package/dist/assets/{properties-texture.inspector-CgFlnyr8.js → properties-texture.inspector-B1vC28pw.js} +1 -1
  280. package/dist/assets/{properties-view-layer.inspector-DGjF_Aqo.js → properties-view-layer.inspector-BuUKyBFp.js} +1 -1
  281. package/dist/assets/{properties-world.inspector-CrMvaRvB.js → properties-world.inspector-VXUj4dT4.js} +1 -1
  282. package/dist/assets/r3f-design-session-qJ2v5SrB.js +2 -0
  283. package/dist/assets/r3f-physics-binding-C8OqNRG2.js +1 -0
  284. package/dist/assets/{r3f-root-factory-z9llD1OU.js → r3f-root-factory-DjGnbU4n.js} +1 -1
  285. package/dist/assets/r3f-source-authoring-adapter-CG9heazM.js +12 -0
  286. package/dist/assets/{rapier-physics-bridge-CMoeVo3Y.js → rapier-physics-bridge-B-EK7KYV.js} +1 -1
  287. package/dist/assets/react-inspector.service-DWeXDHJq.js +1 -0
  288. package/dist/assets/{react-root-CEz5NTck.js → react-root-DGLRLr-F.js} +1 -1
  289. package/dist/assets/react-story-board-CSqHY0Cg.js +1 -0
  290. package/dist/assets/{react-three-fiber.esm-CycrbDlA.js → react-three-fiber.esm-BxIoqVh1.js} +1 -1
  291. package/dist/assets/{react-three-rapier.esm-CEfKpvxT.js → react-three-rapier.esm-BYzLhdSV.js} +1 -1
  292. package/dist/assets/react-world-authoring-adapter-BMT9kLWU.js +1 -0
  293. package/dist/assets/{realm-services-CobQsq_X.js → realm-services-D25JHoqD.js} +1 -1
  294. package/dist/assets/{reflection-probe-Don-M3Fj.js → reflection-probe-CqXWlicu.js} +1 -1
  295. package/dist/assets/{reflection-probe-capture.inspector-CmFUoJCx.js → reflection-probe-capture.inspector-B7Qa30vB.js} +1 -1
  296. package/dist/assets/regions-DWeEBnE2.js +1 -0
  297. package/dist/assets/{register-render-vitals-BiZk29b2.js → register-render-vitals-BO7x64kR.js} +1 -1
  298. package/dist/assets/{registry-02YZjMNp.js → registry-DlTluc4x.js} +1 -1
  299. package/dist/assets/{render-audio-control-vMRlePWb.js → render-audio-control-DCa_bOBI.js} +1 -1
  300. package/dist/assets/{render-batch-system-0vq7p0VC.js → render-batch-system-CzCp9YKM.js} +1 -1
  301. package/dist/assets/{render-control-Df3yTiyr.js → render-control-BNQr1eNO.js} +1 -1
  302. package/dist/assets/{render-env-D2IV2x5k.js → render-env-emvlfeTG.js} +1 -1
  303. package/dist/assets/{render-features-CPQ_e568.js → render-features-COF7MSQ9.js} +1 -1
  304. package/dist/assets/{render-settings-Bw4W9SYF.js → render-settings-C_kIMq8Y.js} +1 -1
  305. package/dist/assets/{resolve-three-SZE_WWUM.js → resolve-three-C-nx-QdA.js} +13 -13
  306. package/dist/assets/{root-seam-contract-Z0VWX3Bk.js → root-seam-contract-C7GOxf5x.js} +1 -1
  307. package/dist/assets/{run-ticks-settled-C4ksViyA.js → run-ticks-settled-B0cTtmhQ.js} +1 -1
  308. package/dist/assets/{scene-capture-CGYF-Viw.js → scene-capture-CLOc7GXc.js} +1 -1
  309. package/dist/assets/{scene-capture-BQKzU0NT.js → scene-capture-D10Nxkvp.js} +1 -1
  310. package/dist/assets/scene-document.service-B7kAVTko.js +2 -0
  311. package/dist/assets/{scene-framing-Cat0GtyJ.js → scene-framing-50N7SKuX.js} +1 -1
  312. package/dist/assets/{scene-index-B6BZOHMk.js → scene-index-Bce459yu.js} +1 -1
  313. package/dist/assets/{scene-query-C7_N-TpI.js → scene-query-IUZhw6pA.js} +1 -1
  314. package/dist/assets/{schema-kl9-2B_J.js → schema-Iy-mbzll.js} +1 -1
  315. package/dist/assets/sculpt.layout-D-K5cLw6.js +1 -0
  316. package/dist/assets/{seeded-random-i3mtgBKZ.js → seeded-random-CN0scLZj.js} +1 -1
  317. package/dist/assets/{session-CZ5JPg-z.js → session-CsR0lApe.js} +24 -15
  318. package/dist/assets/{setup-audio-S8GQF91f.js → setup-audio-BJ18gvXZ.js} +1 -1
  319. package/dist/assets/setup-particles-B6H-GbAA.js +1 -0
  320. package/dist/assets/{setup-physics-BeZ7-LKD.js → setup-physics-GugbTT0J.js} +1 -1
  321. package/dist/assets/{setup-renderer-DVXaSGin.js → setup-renderer-wt_a-p8r.js} +20 -20
  322. package/dist/assets/shading.layout-CZZHKBer.js +1 -0
  323. package/dist/assets/{sim-clock-CLflx7kg.js → sim-clock-DEfbb_-P.js} +1 -1
  324. package/dist/assets/{soft-particle-depth-DGvfQDi1.js → soft-particle-depth-CKUS1j0Y.js} +1 -1
  325. package/dist/assets/source-object3d-authoring-adapter-CfHQLFAL.js +1 -0
  326. package/dist/assets/{source-persistence-backend-C-aR-B_Y.js → source-persistence-backend-_-JMEXxE.js} +1 -1
  327. package/dist/assets/{spark-renderer-lifecycle-ynWESJcv.js → spark-renderer-lifecycle-9mnMW3Z4.js} +1 -1
  328. package/dist/assets/{spark.module-4pXQoz5d.js → spark.module-CXth-y_a.js} +1 -1
  329. package/dist/assets/stage-keyboard-C0FdDLOQ.js +1 -0
  330. package/dist/assets/stage-overlay-set-CwhCzbOy.js +1 -0
  331. package/dist/assets/stage-presence-markers-DVMDKiB-.js +1 -0
  332. package/dist/assets/stage-transform-tools-B09Z7v0o.js +1 -0
  333. package/dist/assets/standard-viewport-dressing-GUUr6GuK.js +20 -0
  334. package/dist/assets/{state-watch.action-BOvQR2qt.js → state-watch.action-CgF8qoFC.js} +1 -1
  335. package/dist/assets/{state-watch.menu-CNLvDeeY.js → state-watch.menu-CIMncESW.js} +1 -1
  336. package/dist/assets/{state-watch.utility-Bg1tTTQU.js → state-watch.utility-zTHkUALC.js} +1 -1
  337. package/dist/assets/static-batch-advisor-DqfXWRUq.js +1 -0
  338. package/dist/assets/story-capture-COQgezzl.js +1 -0
  339. package/dist/assets/story-documents-DQ0KORmd.js +3 -0
  340. package/dist/assets/story-documents.service-DOSaqPqv.js +1 -0
  341. package/dist/assets/story-documents.service-Gb7oUkbg.js +1 -0
  342. package/dist/assets/{story-media-presence-BHzk2IV5.js → story-media-presence-nW3zJqKv.js} +1 -1
  343. package/dist/assets/story-pixi-preview-COPTEsHo.js +1 -0
  344. package/dist/assets/story-presentation-CxADj5oz.js +1 -0
  345. package/dist/assets/{story-three-preview-BHEDZzcl.js → story-three-preview-C9W__8Or.js} +2 -2
  346. package/dist/assets/{structural-ids-Dc-7rEwi.js → structural-ids-CblajJQK.js} +1 -1
  347. package/dist/assets/studio-CysTBGIb.exr +0 -0
  348. package/dist/assets/sunrise-Dj0psFrf.exr +0 -0
  349. package/dist/assets/sunset-Bw3x2Bot.exr +0 -0
  350. package/dist/assets/{surface-state-DaxyruCj.js → surface-state-BAUJu6GY.js} +1 -1
  351. package/dist/assets/{system-runner-DkOjxEBt.js → system-runner-D_DtVrer.js} +1 -1
  352. package/dist/assets/team-playtest.service--79O6xkx.js +1 -0
  353. package/dist/assets/{three-CDSueJyJ.js → three-DSsr_Lvp.js} +1 -1
  354. package/dist/assets/{three-authoring-adapter-CmSQ3Vui.js → three-authoring-adapter-Yqsank46.js} +1 -1
  355. package/dist/assets/three-authoring.service-BDos-bRt.js +2 -0
  356. package/dist/assets/{three-ingest-runtime-QzDYk6tU.js → three-ingest-runtime-DWijtqQ8.js} +1 -1
  357. package/dist/assets/{three-projection-core-BmKMZ-nf.js → three-projection-core-kubBTx0s.js} +1 -1
  358. package/dist/assets/three-story-model-BraQFA9h.js +1 -0
  359. package/dist/assets/three-viewport-presentation-BL7Uc2i6.js +1 -0
  360. package/dist/assets/{three.module-D396a9Mn.js → three.module-IFn-4i31.js} +1 -1
  361. package/dist/assets/three.quarks.esm-CRKGjKAH.js +1039 -0
  362. package/dist/assets/transform-mode-request-Cu7ewbtr.js +1 -0
  363. package/dist/assets/{transform-writer-BhBBTx33.js → transform-writer-DXxrI4t7.js} +1 -1
  364. package/dist/assets/transport.header-CeND8Vzh.js +1 -0
  365. package/dist/assets/{trigger-volume-BNK2XzPL.js → trigger-volume-BCVRS3NM.js} +1 -1
  366. package/dist/assets/{tuples-CIQ4Bn1U.js → tuples-DKDGrN1t.js} +1 -1
  367. package/dist/assets/ui-board-document-DD2CAEAo.js +2 -0
  368. package/dist/assets/unity.style-vCmLw4gI.js +1 -0
  369. package/dist/assets/unity.view-DIn2S6Do.js +1 -0
  370. package/dist/assets/unreal.style-BQn-HhOX.js +1 -0
  371. package/dist/assets/unreal.view-adNBETZK.js +1 -0
  372. package/dist/assets/user-data-CZqsJDk-.js +1 -0
  373. package/dist/assets/{utility-view-state-BHypxA33.js → utility-view-state-DYJY8V8O.js} +1 -1
  374. package/dist/assets/uv-editing.layout-A8RA-cbM.js +1 -0
  375. package/dist/assets/{vgai-shared-three-Bc5PvpLM.js → vgai-shared-three-D_RAEumG.js} +1 -1
  376. package/dist/assets/{viewport-root-presentation-CWsE56K6.js → viewport-root-presentation-C9M98VNM.js} +1 -1
  377. package/dist/assets/{viewport-shading-BuA88e_A.js → viewport-shading-BzcvgJhK.js} +1 -1
  378. package/dist/assets/viewport-shading-boundary-CBvvzS-p.js +84 -0
  379. package/dist/assets/{viewport-surface-status-B3om4Kcf.js → viewport-surface-status-BFmnWp7z.js} +1 -1
  380. package/dist/assets/voxel-surface-ROWYug7H.js +1 -0
  381. package/dist/assets/webgl-frame-capture-CRKX73E9.js +1 -0
  382. package/dist/assets/webworkerAll-CehoCtFb.js +1 -0
  383. package/dist/assets/{worker-UrMcrc5_.js → worker-B7zhIsFh.js} +2 -2
  384. package/dist/assets/world-documents-DErHq15h.js +1 -0
  385. package/dist/assets/world-root-stage-binding-BIymcQ4K.js +1 -0
  386. package/dist/assets/{world-state-BWG-IcOd.js → world-state-ZGDGY_Xl.js} +1 -1
  387. package/dist/assets/{writer-B-KovzkA.js → writer-BPbm4_my.js} +5 -5
  388. package/dist/assets/xstate-animation-binding-Cvd4JbEY.js +1 -0
  389. package/dist/assets/{xstate-animation-meta-Q3u9zh_m.js → xstate-animation-meta-B3OZR8Q2.js} +1 -1
  390. package/dist/vgai-shared-three.json +1 -1
  391. package/dist-node/cli.js +317 -73
  392. package/dist-node/create.js +59 -19
  393. package/package.json +16 -13
  394. package/src/index.ts +6 -0
  395. package/template/.agents/skills/vgai-3d-models/SKILL.md +3 -3
  396. package/template/.agents/skills/vgai-threejs-authoring/SKILL.md +4 -9
  397. package/template/.claude/skills/vgai-3d-models/SKILL.md +3 -3
  398. package/template/.claude/skills/vgai-threejs-authoring/SKILL.md +4 -9
  399. package/template/.github/skills/vgai-3d-models/SKILL.md +3 -3
  400. package/template/.github/skills/vgai-threejs-authoring/SKILL.md +4 -9
  401. package/template/AGENTS.md +1 -1
  402. package/template/check-idioms.ts +4 -5
  403. package/template/package.json +9 -9
  404. package/template/tsconfig.json +1 -0
  405. package/template/vgai.adapter.ts +1 -0
  406. package/template-dotfiles/gitignore +2 -0
  407. package/workbench/src/media/game-cover.css +1 -1
  408. package/catalog/project-source/src/lib/bake/mesh-slice.ts +0 -157
  409. package/dist/assets/BufferGeometryUtils-Nz37EVXf.js +0 -1
  410. package/dist/assets/CanvasSceneViewport-Bpi6gVTC.js +0 -1
  411. package/dist/assets/ColladaLoader-aVOPIsCh.js +0 -3
  412. package/dist/assets/EXRLoader-Cdans_oJ.js +0 -1
  413. package/dist/assets/EffectComposer-DQxfsXBZ.js +0 -1
  414. package/dist/assets/EntityModelDocument-Ccvw66N9.js +0 -1
  415. package/dist/assets/EnvironmentAssetDocument-Dg-Qq6O6.js +0 -1
  416. package/dist/assets/FBXLoader-B4MoUtAn.js +0 -1
  417. package/dist/assets/Fbo-Dz-Soul3.js +0 -1
  418. package/dist/assets/GLTFExporter-HgrCle4L.js +0 -1
  419. package/dist/assets/Gltf-UHVWKz65.js +0 -2
  420. package/dist/assets/HDRLoader-THU88oVD.js +0 -5
  421. package/dist/assets/ImageViewer-Tn7s_MnW.js +0 -1
  422. package/dist/assets/InspectorObjectPreview-CVejvLRg.js +0 -1
  423. package/dist/assets/JsonAssetDocument-C7VGcLhu.js +0 -3
  424. package/dist/assets/MeshBVH-BiDHDcu-.js +0 -1
  425. package/dist/assets/ModelAssetDocument-F5GACirk.js +0 -1
  426. package/dist/assets/Object3DDocumentViewport-DB7T0NTl.js +0 -2
  427. package/dist/assets/Object3DPreview-DL8oi7Xs.js +0 -2
  428. package/dist/assets/OnlineAssetDetail-C6z9RvYK.js +0 -2
  429. package/dist/assets/PlayBar-BR-Vg3Jb.js +0 -2
  430. package/dist/assets/RGBELoader-BgBcQv8j.js +0 -1
  431. package/dist/assets/RectAreaLightUniformsLib-CMMoWfll.js +0 -1
  432. package/dist/assets/RootSelectionOverlay-BZPlxmXU.js +0 -1
  433. package/dist/assets/STLLoader-Dyv3lsxY.js +0 -1
  434. package/dist/assets/SimplifyModifier-C8ayvRzd.js +0 -1
  435. package/dist/assets/SourceAssetViewer-2SWQoUut.js +0 -12
  436. package/dist/assets/StageHost-BN-IoTef.js +0 -2
  437. package/dist/assets/ThreeBoardDocument-CVncZyIq.js +0 -2
  438. package/dist/assets/asset-budget-asset.menu-Di3KiQCd.js +0 -1
  439. package/dist/assets/asset-budget.action-DCzzcuTh.js +0 -1
  440. package/dist/assets/asset-budget.document-BWU8wnVW.js +0 -1
  441. package/dist/assets/asset-budget.menu-BGZpT_31.js +0 -1
  442. package/dist/assets/autoplay.service-BZBGNSvt.js +0 -1
  443. package/dist/assets/blender-emscripten-engine-9ZIRYNhe.js +0 -2
  444. package/dist/assets/blender-properties-tab-C5CyPydi.js +0 -3
  445. package/dist/assets/blender-runtime-host-BpBwGv7r.js +0 -4
  446. package/dist/assets/blender-runtime.document-lIYhhPtv.js +0 -8
  447. package/dist/assets/blender.command-BtJeWk-A.js +0 -1
  448. package/dist/assets/body-marks-h_xDxiDE.js +0 -1
  449. package/dist/assets/bridge.command-o5gDNEwa.js +0 -3
  450. package/dist/assets/browserAll-DeWblVez.js +0 -1
  451. package/dist/assets/canvas-entry-runtime-SfBxaR9M.js +0 -2
  452. package/dist/assets/component-board.service-DidCyM4O.js +0 -2
  453. package/dist/assets/component-verbs.service-Bv9jId3q.js +0 -1
  454. package/dist/assets/constraints.inspector-B9U9Yj-u.js +0 -1
  455. package/dist/assets/coverage.service-VTX5Mcsx.js +0 -3
  456. package/dist/assets/deferred-ingest-play-DCJi_Pgu.js +0 -2
  457. package/dist/assets/design-time-layers-wYgOTgni.js +0 -1
  458. package/dist/assets/design-time-mount.service-BzY21e1F.js +0 -2
  459. package/dist/assets/design-time-react-mount-DM9WLrF2.js +0 -1
  460. package/dist/assets/edit-mode-authoring-B47TfLqu.js +0 -1
  461. package/dist/assets/editor-api-BoJIcyZG.js +0 -1
  462. package/dist/assets/fflate.module-DPuTF8aG.js +0 -6
  463. package/dist/assets/fork-menu-BoVyw2Wu.js +0 -1
  464. package/dist/assets/game-document.service-DbRfx2V0.js +0 -1
  465. package/dist/assets/game-eval.command-D-7Dxbj_.js +0 -2
  466. package/dist/assets/gameplay-replay-e5umMlXv.js +0 -1
  467. package/dist/assets/gameplay.command-DxcVYX6F.js +0 -1
  468. package/dist/assets/generation.service-CDIgObuw.js +0 -1
  469. package/dist/assets/index-96FBF1Oj.js +0 -1
  470. package/dist/assets/index-BAWkB0dv.js +0 -1
  471. package/dist/assets/index-BDnS2b6S.js +0 -1
  472. package/dist/assets/index-BjTCPEQ7.js +0 -134
  473. package/dist/assets/index-CVCb_ImQ.js +0 -1
  474. package/dist/assets/index-CZd9o7Lu.js +0 -1
  475. package/dist/assets/index-D2fNXpHa.css +0 -1
  476. package/dist/assets/index-GIL7oGEO.js +0 -4894
  477. package/dist/assets/index-OrYXPk3Z.js +0 -487
  478. package/dist/assets/ingest-boot-viewport-D5rI_Kk_.js +0 -1
  479. package/dist/assets/ingest-siblings-Bop2kqVl.js +0 -1
  480. package/dist/assets/instances.command-D6UkZNO8.js +0 -1
  481. package/dist/assets/light-camera-factory-CWbbe9gI.js +0 -1
  482. package/dist/assets/live-behaviors-Bxq49Maz.js +0 -1
  483. package/dist/assets/matcap-texture-CVfalpWT.js +0 -1
  484. package/dist/assets/model-asset-sections.service-CHhFS3ZX.js +0 -1
  485. package/dist/assets/model.layout-BJUEQYUI.js +0 -1
  486. package/dist/assets/module-mode-DVBLT9d-.js +0 -2
  487. package/dist/assets/mount-canvas-ingest-root-DDuAWf_C.js +0 -2
  488. package/dist/assets/mount-dom-ingest-root-D_EiBgpn.js +0 -2
  489. package/dist/assets/mount-ingest-root-glv2SSWf.js +0 -2
  490. package/dist/assets/mount-three-ingest-root-hrUt9VVU.js +0 -1
  491. package/dist/assets/particles-factory-DnLOHXT8.js +0 -1
  492. package/dist/assets/pasteboard-materialize-BqSS4QzV.js +0 -20
  493. package/dist/assets/pasteboard.action-DU3UHtJG.js +0 -2
  494. package/dist/assets/pixi-authoring-adapter-CjibysC3.js +0 -1
  495. package/dist/assets/pixi-primitive-DlWbUPN9.js +0 -1
  496. package/dist/assets/pixi-react-root-factory-DYsznYRQ.js +0 -1
  497. package/dist/assets/play-mode-BFU2PCkG.js +0 -22
  498. package/dist/assets/play.command-BpqqLqkq.js +0 -2
  499. package/dist/assets/project-authoring-session-Bnt6icLr.js +0 -2
  500. package/dist/assets/r3f-design-session-D-4yyDO9.js +0 -2
  501. package/dist/assets/r3f-physics-binding-BBo8oma9.js +0 -1
  502. package/dist/assets/r3f-source-authoring-adapter-w6Bc60K-.js +0 -13
  503. package/dist/assets/react-inspector.service-B_neRnSK.js +0 -1
  504. package/dist/assets/react-story-board-BDDwiE2H.js +0 -1
  505. package/dist/assets/react-world-authoring-adapter-DmrwM3py.js +0 -1
  506. package/dist/assets/runtime-inspection-l2iFQSsg.js +0 -1
  507. package/dist/assets/scene-document.service-qkDjUrlP.js +0 -2
  508. package/dist/assets/sculpt.layout-zJF55yCR.js +0 -1
  509. package/dist/assets/setup-particles-GCXlnkj_.js +0 -1
  510. package/dist/assets/shading.layout-DULYZV6M.js +0 -1
  511. package/dist/assets/source-object3d-authoring-adapter-B-L6Ha6f.js +0 -1
  512. package/dist/assets/stage-invalidation-DBg3C3Ta.js +0 -1
  513. package/dist/assets/stage-keyboard-n-5kKH-m.js +0 -1
  514. package/dist/assets/stage-overlay-set-B9zp2sLB.js +0 -1
  515. package/dist/assets/stage-presence-markers-DiGI6A45.js +0 -1
  516. package/dist/assets/standard-viewport-dressing-CzjAe_0A.js +0 -7
  517. package/dist/assets/static-batch-advisor-B13QEH7d.js +0 -1
  518. package/dist/assets/story-capture-_gC8dXV-.js +0 -1
  519. package/dist/assets/story-documents--TDLaPeL.js +0 -3
  520. package/dist/assets/story-documents.service-BiS_YbNQ.js +0 -1
  521. package/dist/assets/story-documents.service-CxOPYJ2j.js +0 -1
  522. package/dist/assets/story-pixi-preview-BUrOJZXS.js +0 -1
  523. package/dist/assets/story-presentation-j2AVN-mK.js +0 -1
  524. package/dist/assets/team-playtest.service-DqOinFVA.js +0 -1
  525. package/dist/assets/three-authoring.service-iuHLwtf1.js +0 -2
  526. package/dist/assets/three-viewport-presentation-QBQpSdMh.js +0 -1
  527. package/dist/assets/three.quarks.esm-B1C61jGo.js +0 -1039
  528. package/dist/assets/transport.header-B-6HQlU2.js +0 -1
  529. package/dist/assets/ui-board-document-Bwtt--xp.js +0 -2
  530. package/dist/assets/use-live-actor-state-DErbWQWF.js +0 -1
  531. package/dist/assets/user-data-BB2Of6Ht.js +0 -1
  532. package/dist/assets/uv-editing.layout-BEKHxmHw.js +0 -1
  533. package/dist/assets/viewport-shading-boundary-B_-_gABg.js +0 -82
  534. package/dist/assets/voxel-surface-DtcsSWRL.js +0 -1
  535. package/dist/assets/webgl-frame-capture-FlF9zQmW.js +0 -1
  536. package/dist/assets/webworkerAll-CM2o_dnz.js +0 -1
  537. package/dist/assets/world-documents-147tiFZe.js +0 -1
  538. package/dist/assets/world-root-stage-binding-vwTrtBz6.js +0 -1
  539. package/dist/assets/xstate-animation-binding-Brd0NST6.js +0 -1
  540. package/dist/assets/xstate-behavior.action-B8UluFBK.js +0 -1
  541. package/dist/assets/xstate-behavior.document-CKAsE45I.js +0 -1
  542. package/dist/assets/xstate-behavior.inspector-vJJyuifc.js +0 -1
  543. package/dist/assets/xstate-behavior.menu-BXbPICIh.js +0 -1
  544. package/dist/assets/xstate-inspection-BsZv8LS9.js +0 -1
@@ -1,13 +0,0 @@
1
- import{dE as Mt,fE as Lt,aH as fe,lp as Ft,fJ as _,lq as Bt,lr as jt,fI as M,fG as re,eP as ne,ls as B,lt as Dt,d9 as Nt,eH as Wt,bT as ie,bU as oe,dG as j,V as Pe,lu as Re,bV as _t}from"./index-GIL7oGEO.js";import{b as Ht,e as Ae}from"./live-gesture-lock-DJbrjOqf.js";import{f as me,a as ke,i as xe,b as zt,o as Jt,r as Vt,c as Ut}from"./writer-B-KovzkA.js";import{S as Kt,C as Gt,r as qt}from"./three-projection-core-BmKMZ-nf.js";import{w as Xt}from"./inference-diagnostics-Dhmtfbq_.js";import{f as Qt,d as Zt,e as Ee,g as Yt,h as er,j as tr,k as rr,l as Te,m as nr,n as ir}from"./instance-fork-actions-D3sRzS3K.js";import{c as or,T as sr,n as ar}from"./three-CDSueJyJ.js";import{b as cr,p as lr}from"./r3f-physics-binding-BBo8oma9.js";import{object3DAuthoringSubjectOf as Ce}from"./object3d-authoring-subject-CH5sI2oP.js";import{getUserData as ye}from"./user-data-BB2Of6Ht.js";import{r as C,V as m,e as ur,j as dr,ae as hr,Q as Y,u as Me}from"./three.module-D396a9Mn.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./viewport-pick-context-DkawXbEi.js";import"./object-marks-DwvIEBOK.js";function H(o,e,t){let r=0,n=1;for(;n<e;){const i=o.indexOf(`
2
- `,r);if(i===-1)return o.length;r=i+1,n+=1}return r+t}function pr(o){return`${o.code}|${o.file}|${o.line}|${o.col}`}function fr(...o){const e=new Set,t=[];for(const r of o)for(const n of r?.diagnostics??[]){const i=pr(n);e.has(i)||(e.add(i),t.push(n))}return t}const Le=["#7dd3fc","#60a5fa","#818cf8","#a78bfa","#c084fc"],Fe=1e3;function ft(o){return o.lod.updateWorldMatrix(!0,!1),o.lod.getWorldPosition(new m)}function Be(o){return Le[o%Le.length]}function mr(o){const e=ft(o),t=[],r=[];return o.lod.levels.forEach((n,i)=>{!Number.isFinite(n.distance)||n.distance<=0||(t.push({kind:"sphere",center:[e.x,e.y,e.z],radius:n.distance,color:Be(i),opacity:.56}),r.push({id:`lod:${encodeURIComponent(o.key)}:${i}`,label:`LOD ${i} distance`,position:[e.x+n.distance,e.y,e.z],color:Be(i),writable:o.writableDistances.has(i)}))}),{id:`lod:${o.key}`,category:"lod",guides:t,handles:r}}function yr(o){return Math.round(o*Fe)/Fe}function mt(o,e,t){const r=o.lod.levels[e-1]?.distance,n=o.lod.levels[e+1]?.distance,i=r===void 0?0:r+.01,s=n===void 0?Number.POSITIVE_INFINITY:Math.max(i,n-.01);return yr(C.clamp(t,i,s))}function je(o,e,t){const r=/^lod:([^:]+):(\d+)$/.exec(e);if(!r)return null;const n=decodeURIComponent(r[1]),i=Number(r[2]),s=o.find(c=>c.key===n);if(!s||!s.writableDistances.has(i))return null;const a=new m(...t).distanceTo(ft(s));return{binding:s,level:i,value:mt(s,i,a)}}function yt(o){const e=o.binding.lod.levels[o.level];e&&(e.distance=o.value)}const gt="#ff9f43",gr="#ffd166",De=1e3;function wr(o){const e=o.system?.emitterShape;return e&&typeof e.type=="string"?e:null}function $e(o){return encodeURIComponent(o.sourceOid)}function wt(o){return[o.x,o.y,o.z]}function br(o,e){return o.emitter.updateWorldMatrix(!0,!1),wt(e.clone().applyMatrix4(o.emitter.matrixWorld))}function b(o,e,t=.72){o.emitter.updateWorldMatrix(!0,!1);const r=o.emitter.matrixWorld;return{kind:"line",points:e.map(n=>wt(n.clone().applyMatrix4(r))),color:gt,opacity:t}}function A(o,e="xy",t=48,r=Math.PI*2){const n=[];for(let i=0;i<=t;i+=1){const s=i/t*r,a=Math.cos(s)*o,c=Math.sin(s)*o;n.push(e==="xy"?new m(a,c,0):e==="xz"?new m(a,0,c):new m(0,a,c))}return n}function Ne(o,e){return o.map(t=>t.clone().applyAxisAngle(new m(0,0,1),e))}function We(o,e,t=24){const r=[];for(let n=0;n<=t;n+=1){const i=n/t*Math.PI,s=Math.cos(i)*o,a=Math.sin(i)*o;r.push(new m(s,0,a))}return r}function P(o,e,t){const r=o[e];return typeof r=="number"&&Number.isFinite(r)?r:t}function vr(o){const e=o.shape,t=P(e,"radius",10),r=C.clamp(P(e,"arc",Math.PI*2),0,Math.PI*2),n=Math.abs(r-Math.PI*2)<.001;switch(e.type){case"point":return[b(o,[new m(-.2,0,0),new m(.2,0,0)]),b(o,[new m(0,-.2,0),new m(0,.2,0)]),b(o,[new m(0,0,-.2),new m(0,0,.2)])];case"sphere":return[b(o,A(t,"xy",48,r)),b(o,A(t,"xz"),.5),b(o,Ne(A(t,"xz"),n?Math.PI/2:r),.5)];case"hemisphere":return[b(o,A(t,"xy",48,r)),b(o,We(t),.55),b(o,Ne(We(t),n?Math.PI/2:r),.55)];case"cone":{const i=P(e,"angle",Math.PI/6),s=Math.max(t,1),a=[b(o,A(t,"xy",48,r))],c=n?[0,Math.PI/2,Math.PI,3*Math.PI/2]:[0,r/3,r*2/3,r];for(const l of c){const u=new m(Math.cos(l)*t,Math.sin(l)*t,0),d=u.clone().add(new m(Math.cos(l)*Math.sin(i),Math.sin(l)*Math.sin(i),Math.cos(i)).multiplyScalar(s));a.push(b(o,[u,d],.58))}return a}case"circle":return[b(o,A(t,"xy",48,r))];case"donut":{const i=P(e,"donutRadius",t*.2);return[b(o,A(Math.max(0,t-i),"xy",48,r),.45),b(o,A(t,"xy",48,r)),b(o,A(t+i,"xy",48,r),.45),b(o,A(i,"xz").map(s=>s.add(new m(t,0,0))),.45)]}case"rectangle":case"grid":{const i=P(e,"width",e.type==="grid"?1:10),s=P(e,"height",e.type==="grid"?1:10),a=i/2,c=s/2,l=[b(o,[new m(-a,-c,0),new m(a,-c,0),new m(a,c,0),new m(-a,c,0),new m(-a,-c,0)])];if(e.type==="grid"){const u=Math.min(16,Math.max(1,Math.round(P(e,"column",10)))),d=Math.min(16,Math.max(1,Math.round(P(e,"row",10))));for(let h=1;h<u;h+=1){const p=-a+h/u*i;l.push(b(o,[new m(p,-c,0),new m(p,c,0)],.24))}for(let h=1;h<d;h+=1){const p=-c+h/d*s;l.push(b(o,[new m(-a,p,0),new m(a,p,0)],.24))}}return l}}}function z(o,e,t,r){return{id:`particle:${$e(o)}:${e}`,label:t,position:br(o,r),color:e==="angle"?gr:gt,writable:o.writableFields.has(e)}}function Or(o){const e=o.shape,t=P(e,"radius",10),r=[];if(["sphere","hemisphere","cone","circle","donut"].includes(e.type)&&r.push(z(o,"radius","Emitter radius",new m(t,0,0))),e.type==="cone"){const n=P(e,"angle",Math.PI/6),i=Math.max(t,1);r.push(z(o,"angle","Cone angle",new m(t+Math.sin(n)*i,0,Math.cos(n)*i)))}return e.type==="donut"&&r.push(z(o,"donutRadius","Donut tube radius",new m(t,0,P(e,"donutRadius",t*.2)))),(e.type==="rectangle"||e.type==="grid")&&r.push(z(o,"width","Emitter width",new m(P(e,"width",1)/2,0,0)),z(o,"height","Emitter height",new m(0,P(e,"height",1)/2,0))),{id:`particle:${$e(o)}`,category:"particles",guides:vr(o),handles:r}}function se(o){return Math.round(o*De)/De}function bt(o,e){return o==="angle"?se(C.clamp(e,.01,Math.PI/2-.01)):o==="arc"?se(C.clamp(e,0,Math.PI*2)):o==="thickness"?se(C.clamp(e,0,1)):o==="column"||o==="row"?Math.max(1,Math.round(e)):se(Math.max(.01,e))}function Sr(o,e){return bt(o,e)}function _e(o,e,t){const r=/^particle:([^:]+):(radius|angle|donutRadius|width|height)$/.exec(e),n=r?o.find(l=>$e(l)===r[1]):void 0,i=r?.[2];if(!n||!i||!n.writableFields.has(i))return null;n.emitter.updateWorldMatrix(!0,!1);const s=n.emitter.worldToLocal(new m(...t)),a=P(n.shape,"radius",10);let c;return i==="radius"?c=n.shape.type==="sphere"||n.shape.type==="hemisphere"?s.length():Math.hypot(s.x,s.y):i==="angle"?c=Math.atan2(Math.max(0,Math.hypot(s.x,s.y)-a),Math.abs(s.z)||.001):i==="donutRadius"?c=Math.abs(s.z):i==="width"?c=Math.abs(s.x)*2:c=Math.abs(s.y)*2,{binding:n,field:i,value:bt(i,c)}}function vt(o){o.binding.shape[o.field]=o.value}const Ot={Light:"light",Material:"material",Camera:"camera",Audio:"audio"};function y(o,e,t,r,n,i=`${Ot[o]}.${t}`,s){return{prop:t,label:r,type:n,group:o,target:e,path:i,...s?{options:s}:{}}}function D(o,e,t){return{prop:o,label:e,type:"asset",group:"Material",target:"material",path:`${Ot.Material}.${o}`,colorSpace:t}}const Pr=[D("map","Base Color Map","srgb"),D("normalMap","Normal Map","linear"),D("roughnessMap","Roughness Map","linear"),D("metalnessMap","Metalness Map","linear"),D("emissiveMap","Emissive Map","srgb"),D("aoMap","Ambient Occlusion Map","linear")];function xr(o){const e=o;return e&&e.isColor?`#${e.getHexString()}`:void 0}const St="vgaiAssetPath",He=new WeakSet,$r=new ur;function Pt(o){const e=o;if(!e||!e.isTexture)return"";const t=e.userData?.[St];if(typeof t=="string"&&t)return t;if(e.name)return e.name;const r=e.image?.src;return typeof r=="string"?r:""}function Ir(o){return/^(?:[a-z]+:|\/)/i.test(o)?o:`/${o}`}function Rr(o,e,t){if(!o)return null;const r=o,n=r[e.prop],i=t==null?"":String(t);if(n&&He.has(n)&&Pt(n)!==i&&n.dispose(),!i)return r[e.prop]=null,o.needsUpdate=!0,"";const s=$r.load(Ir(i));return s.colorSpace=e.colorSpace==="srgb"?dr:hr,s.userData[St]=i,s.name=i,He.add(s),r[e.prop]=s,o.needsUpdate=!0,i}function Ar(o){const e=o,t=[y("Light","self","color","Color","color"),y("Light","self","intensity","Intensity","number")];return(e.isPointLight||e.isSpotLight)&&t.push(y("Light","self","distance","Distance","number"),y("Light","self","decay","Decay","number")),e.isSpotLight&&t.push(y("Light","self","angle","Angle","number"),y("Light","self","penumbra","Penumbra","number")),t}function xt(o){const e=o;return e.isDirectionalLight||e.isPointLight||e.isSpotLight?y("Light","self","castShadow","Cast Shadow","boolean","shadow.cast"):void 0}function kr(o){const e=o,t=[];e.color?.isColor&&t.push(y("Material","material","color","Color","color")),typeof e.roughness=="number"&&t.push(y("Material","material","roughness","Roughness","number")),typeof e.metalness=="number"&&t.push(y("Material","material","metalness","Metalness","number")),e.emissive?.isColor&&t.push(y("Material","material","emissive","Emissive","color")),t.push(y("Material","material","opacity","Opacity","number"),y("Material","material","transparent","Transparent","boolean")),typeof e.wireframe=="boolean"&&t.push(y("Material","material","wireframe","Wireframe","boolean"));const r=o;for(const n of Pr)n.prop in r&&t.push(n);return t}function Er(o){const e=o;return e.isPerspectiveCamera?[y("Camera","self","fov","FOV","number"),y("Camera","self","near","Near","number"),y("Camera","self","far","Far","number"),y("Camera","self","zoom","Zoom","number")]:e.isOrthographicCamera?[y("Camera","self","zoom","Zoom","number"),y("Camera","self","near","Near","number"),y("Camera","self","far","Far","number"),y("Camera","self","left","Left","number"),y("Camera","self","right","Right","number"),y("Camera","self","top","Top","number"),y("Camera","self","bottom","Bottom","number")]:[]}function ee(o){const e=o;return typeof e.getRefDistance=="function"&&typeof e.setRefDistance=="function"&&!!e.panner}function Tr(o="PositionalAudio"){return[y("Audio","self",o==="PositionalAudio"?"distance":"panner-refDistance","Reference Distance","number","audio.refDistance"),y("Audio","self","panner-distanceModel","Distance Model","enum","audio.distanceModel",["inverse","linear","exponential"]),y("Audio","self","panner-rolloffFactor","Rolloff","number","audio.rolloffFactor"),y("Audio","self","panner-maxDistance","Maximum Distance","number","audio.maxDistance"),y("Audio","self","panner-coneInnerAngle","Inner Cone","number","audio.coneInnerAngle"),y("Audio","self","panner-coneOuterAngle","Outer Cone","number","audio.coneOuterAngle"),y("Audio","self","panner-coneOuterGain","Outside Gain","number","audio.coneOuterGain")]}function $t(o,e,t){const r=o,n=[];return r.isLight&&n.push(...Ar(o)),r.isCamera&&n.push(...Er(o)),ee(o)&&n.push(...Tr(t)),e&&n.push(...kr(e)),n}function Z(o,e,t,r){const n=xt(o);return $t(o,e,r).find(i=>i.path===t)??(n?.path===t?n:void 0)}function It(o,e,t){return t.target==="material"?e:o}function J(o,e,t){if(t.group==="Audio"&&ee(o)){const i=o.panner;switch(t.path){case"audio.refDistance":return o.getRefDistance();case"audio.distanceModel":return o.getDistanceModel();case"audio.rolloffFactor":return o.getRolloffFactor();case"audio.maxDistance":return o.getMaxDistance();case"audio.coneInnerAngle":return i.coneInnerAngle;case"audio.coneOuterAngle":return i.coneOuterAngle;case"audio.coneOuterGain":return i.coneOuterGain}}const r=It(o,e,t);if(!r)return;const n=r[t.prop];return t.type==="color"?xr(n):t.type==="asset"?Pt(n):n}function Cr(o,e,t){if(e.path==="audio.distanceModel"){const n=String(t);return n!=="inverse"&&n!=="linear"&&n!=="exponential"?null:(o.setDistanceModel(n),n)}const r=Number(t);if(!Number.isFinite(r))return null;switch(e.path){case"audio.refDistance":return o.setRefDistance(Math.max(.01,r)),Math.max(.01,r);case"audio.rolloffFactor":return o.setRolloffFactor(Math.max(0,r)),Math.max(0,r);case"audio.maxDistance":return o.setMaxDistance(Math.max(o.getRefDistance()+.01,r)),Math.max(o.getRefDistance()+.01,r);case"audio.coneInnerAngle":{const n=Math.max(0,Math.min(o.panner.coneOuterAngle,r));return o.setDirectionalCone(n,o.panner.coneOuterAngle,o.panner.coneOuterGain),n}case"audio.coneOuterAngle":{const n=Math.max(o.panner.coneInnerAngle,Math.min(360,r));return o.setDirectionalCone(o.panner.coneInnerAngle,n,o.panner.coneOuterGain),n}case"audio.coneOuterGain":{const n=Math.max(0,Math.min(1,r));return o.setDirectionalCone(o.panner.coneInnerAngle,o.panner.coneOuterAngle,n),n}default:return null}}function T(o,e,t,r){if(t.group==="Audio"&&ee(o))return Cr(o,t,r);if(t.type==="asset")return Rr(e,t,r);const n=It(o,e,t);if(!n)return null;if(t.type==="color"){const s=String(r);return n[t.prop]?.set(s),s}if(t.type==="boolean"){const s=!!r;return n[t.prop]=s,ze(o,e,t),s}const i=Number(r);return Number.isFinite(i)?(n[t.prop]=i,ze(o,e,t),i):null}function ze(o,e,t){t.group==="Camera"&&o.updateProjectionMatrix?.(),t.target==="material"&&e&&(t.prop==="transparent"||t.prop==="wireframe")&&(e.needsUpdate=!0)}const Je="#42c8ff",Ve="#287fb8",Ue="#ffd166",Ke="#ff9f43",Ge=100;function k(o){return[o.x,o.y,o.z]}function Rt(o){o.updateWorldMatrix(!0,!1);const e=o.getWorldPosition(new m),t=o.getWorldQuaternion(new Y);return{origin:e,forward:new m(0,0,1).applyQuaternion(t).normalize(),right:new m(1,0,0).applyQuaternion(t).normalize()}}function qe(o,e,t,r,n){const i=C.degToRad(n/2);return o.clone().addScaledVector(e,Math.cos(i)*r).addScaledVector(t,Math.sin(i)*r)}function Mr(o,e){if(!ee(o))return null;const{origin:t,forward:r,right:n}=Rt(o),i=o.getRefDistance(),s=o.getMaxDistance(),a=o.getDistanceModel(),c=o.panner.coneInnerAngle,l=o.panner.coneOuterAngle,u=l<359.5,d=Math.max(1,Math.min(8,i*2.5)),h=[{kind:"sphere",center:k(t),radius:i,color:Je,opacity:.75}],p=[{id:"audio-ref-distance",label:"Reference distance",position:k(t.clone().addScaledVector(n,i)),color:Je,writable:e("audio.refDistance")}];return a==="linear"&&(h.push({kind:"sphere",center:k(t),radius:s,color:Ve,opacity:.42,dashed:!0}),p.push({id:"audio-max-distance",label:"Maximum distance",position:k(t.clone().addScaledVector(n,s)),color:Ve,writable:e("audio.maxDistance")})),u&&(h.push({kind:"cone",origin:k(t),direction:k(r),length:d,angle:l,color:Ke,opacity:.72}),p.push({id:"audio-outer-cone",label:"Outer cone angle",position:k(qe(t,r,n,d,l)),color:Ke,writable:e("audio.coneOuterAngle")}),c<359.5&&(h.push({kind:"cone",origin:k(t),direction:k(r),length:d,angle:c,color:Ue,opacity:.58,dashed:!0}),p.push({id:"audio-inner-cone",label:"Inner cone angle",position:k(qe(t,r,n,d,c)),color:Ue,writable:e("audio.coneInnerAngle")}))),{id:"positional-audio",category:"audio",guides:h,handles:p}}function ge(o){return Math.round(o*Ge)/Ge}function Lr(o,e,t,r){if(!ee(o))return null;const{origin:n,forward:i}=Rt(o),a=new m(...r).sub(n);let c,l;switch(t){case"audio-ref-distance":c="audio.refDistance",l=Math.max(.01,ge(a.length()));break;case"audio-max-distance":c="audio.maxDistance",l=Math.max(o.getRefDistance()+.01,ge(a.length()));break;case"audio-inner-cone":case"audio-outer-cone":{c=t==="audio-inner-cone"?"audio.coneInnerAngle":"audio.coneOuterAngle";const d=a.dot(i),h=Math.sqrt(Math.max(0,a.lengthSq()-d*d));l=ge(C.radToDeg(Math.atan2(h,d))*2);break}default:return null}const u=Z(o,null,c,e);return u?{field:u,value:l}:null}function Fr(o,e){T(o,null,e.field,e.value)}const Br="#00e58a",jr="#c77dff",ae=.01,Xe=1e3;function E(o){return Math.round(o*Xe)/Xe}function Dr(o){return[o.x,o.y,o.z]}function At(o){return{center:new m(...o.position),rotation:new Y(...o.rotation)}}function ce(o,e){const{center:t,rotation:r}=At(o);return Dr(new m(...e).applyQuaternion(r).add(t))}function le(o,e){return`collider:${encodeURIComponent(o.sourceOid)}:${e}`}function Nr(o){const{snapshot:e}=o,t=e.sensor?jr:Br,r={color:t,writable:o.writable},n=[],i=[];switch(e.shape.type){case"cuboid":{const s=e.shape.halfExtents;n.push({kind:"box",center:e.position,rotation:e.rotation,halfExtents:s,color:t,opacity:.78});for(const[a,c]of[[0,"X"],[1,"Y"],[2,"Z"]])for(const l of[-1,1]){const u=[0,0,0];u[a]=s[a]*l,i.push({id:le(o,`${a}:${l}`),label:`${c} ${l>0?"positive":"negative"} half extent`,position:ce(e,u),...r})}break}case"ball":n.push({kind:"sphere",center:e.position,radius:e.shape.radius,color:t,opacity:.78}),i.push({id:le(o,"radius"),label:"Collider radius",position:ce(e,[e.shape.radius,0,0]),...r});break;case"capsule":n.push({kind:"capsule",center:e.position,rotation:e.rotation,radius:e.shape.radius,halfHeight:e.shape.halfHeight,color:t,opacity:.78}),i.push({id:le(o,"radius"),label:"Collider radius",position:ce(e,[e.shape.radius,0,0]),...r},{id:le(o,"half-height"),label:"Collider half height",position:ce(e,[0,e.shape.halfHeight+e.shape.radius,0]),...r});break}return{id:`collider:${o.sourceOid}`,category:"colliders",guides:n,handles:i}}function Wr(o){if(!o.startsWith("collider:"))return null;const e=o.slice(9),t=e.indexOf(":");if(t<1)return null;try{return{oid:decodeURIComponent(e.slice(0,t)),part:e.slice(t+1)}}catch{return null}}function _r(o){return o>1e-8?o:1}function Qe(o,e,t){const r=Wr(e),n=r?o.find(u=>u.sourceOid===r.oid):null;if(!n||!r||!n.writable)return null;const{center:i,rotation:s}=At(n.snapshot),a=new m(...t).sub(i).applyQuaternion(s.clone().invert()),c=n.snapshot.shape,l=n.snapshot.scale.map(_r);if(c.type==="cuboid"&&/^[012]:(?:-1|1)$/.test(r.part)){const u=Number(r.part[0]),d=[...c.halfExtents];return d[u]=Math.max(ae,E(Math.abs(a.getComponent(u)))),{sourceOid:n.sourceOid,colliderId:n.snapshot.id,shape:{type:"cuboid",halfExtents:d},args:d.map((h,p)=>E(h/l[p]))}}if(c.type==="ball"&&r.part==="radius"){const u=Math.max(ae,E(a.length()));return{sourceOid:n.sourceOid,colliderId:n.snapshot.id,shape:{type:"ball",radius:u},args:[E(u/l[0])]}}if(c.type==="capsule"){if(r.part==="radius"){const u=Math.max(ae,E(Math.hypot(a.x,a.z)));return{sourceOid:n.sourceOid,colliderId:n.snapshot.id,shape:{...c,radius:u},args:[E(c.halfHeight/l[0]),E(u/l[1])]}}if(r.part==="half-height"){const u=Math.max(ae,E(Math.abs(a.y)-c.radius));return{sourceOid:n.sourceOid,colliderId:n.snapshot.id,shape:{...c,halfHeight:u},args:[E(u/l[0]),E(c.radius/l[1])]}}}return null}const we="#ffb020",Ze=1e3;function Ie(o){return`${o.source.line}:${o.source.col}`}function Ye(o,e){return`joint:${Ie(o)}:${e}`}function Hr(o){const e=o.snapshot,t=[{kind:"line",points:[e.worldAnchor1,e.worldAnchor2],color:we,opacity:.9}];if(e.worldAxis){const r=new m(...e.worldAnchor1),n=new m(...e.worldAxis).normalize();t.push({kind:"line",points:[[r.x-n.x,r.y-n.y,r.z-n.z],[r.x+n.x,r.y+n.y,r.z+n.z]],color:"#ffd166",opacity:.82,dashed:!0})}return{id:`joint:${Ie(o)}`,category:"joints",guides:t,handles:[{id:Ye(o,0),label:"Joint anchor A",position:e.worldAnchor1,color:we,writable:o.writable},{id:Ye(o,1),label:"Joint anchor B",position:e.worldAnchor2,color:we,writable:o.writable}]}}function be(o){return Math.round(o*Ze)/Ze}function zr(o){const e=/^joint:(\d+:\d+):([01])$/.exec(o);return e?{key:e[1],endpoint:Number(e[2])}:null}function Jr(o,e){return o.source.hook==="useFixedJoint"&&e===1?2:e}function et(o,e,t){const r=zr(e),n=r?o.find(d=>Ie(d)===r.key):void 0;if(!n||!r||!n.writable||!n.source.params)return null;const i=n.snapshot,s=r.endpoint===0?i.body1Position:i.body2Position,a=r.endpoint===0?i.body1Rotation:i.body2Rotation,c=new m(...t).sub(new m(...s)).applyQuaternion(new Y(...a).invert()),l=[be(c.x),be(c.y),be(c.z)],u=n.source.params.map(d=>Array.isArray(d)?[...d]:d);return u[Jr(n,r.endpoint)]=l,{binding:n,endpoint:r.endpoint,anchor:l,params:u}}const tt="#ffd166",rt="#ff9f43",nt=1e3;function V(o){return[o.x,o.y,o.z]}function it(o){return Math.round(o*nt)/nt}function kt(o){o.updateWorldMatrix(!0,!1);const e=o.getWorldQuaternion(new Y);return{origin:o.getWorldPosition(new m),rangeAxis:new m(1,0,0).applyQuaternion(e).normalize()}}function Et(o){o.updateWorldMatrix(!0,!1),o.target.updateWorldMatrix(!0,!1);const e=o.getWorldPosition(new m),r=o.target.getWorldPosition(new m).sub(e).normalize();r.lengthSq()<1e-8&&r.set(0,0,-1).applyQuaternion(o.getWorldQuaternion(new Y));const n=Math.abs(r.y)>.98?new m(1,0,0):new m(0,1,0),i=new m().crossVectors(r,n).normalize();return{origin:e,direction:r,radial:i}}function Vr(o,e,t,r,n){return o.clone().addScaledVector(e,Math.cos(n)*r).addScaledVector(t,Math.sin(n)*r)}function Ur(o,e){const t=o;if(!t.isPointLight&&!t.isSpotLight)return null;const{origin:r,rangeAxis:n}=kt(o),i=typeof t.distance=="number"?t.distance:0,s=[],a=[];if(i>0&&(s.push({kind:"sphere",center:V(r),radius:i,color:tt,opacity:.62}),a.push({id:"light-range",label:"Light range",position:V(r.clone().addScaledVector(n,i)),color:tt,writable:e("light.distance")})),t.isSpotLight){const c=o,{direction:l,radial:u}=Et(c),d=r.distanceTo(c.target.getWorldPosition(new m)),h=i>0?i:Math.max(1,d),p=C.radToDeg(c.angle*2);s.push({kind:"cone",origin:V(r),direction:V(l),length:h,angle:p,color:rt,opacity:.75}),a.push({id:"light-angle",label:"Spot angle",position:V(Vr(r,l,u,h,c.angle)),color:rt,writable:e("light.angle")})}return s.length>0||a.length>0?{id:"light",category:"lights",guides:s,handles:a}:null}function Kr(o,e,t,r){const n=o,i=new m(...r);let s,a;if(t==="light-range"&&(n.isPointLight||n.isSpotLight))s="light.distance",a=Math.max(.01,it(i.distanceTo(kt(o).origin)));else if(t==="light-angle"&&n.isSpotLight){s="light.angle";const{origin:l,direction:u}=Et(o),d=i.sub(l),h=d.dot(u),p=Math.sqrt(Math.max(0,d.lengthSq()-h*h));a=it(Math.max(.01,Math.min(Math.PI/2,Math.atan2(p,h))))}else return null;const c=Z(o,null,s,e);return c?{field:c,value:a}:null}function Gr(o,e){T(o,null,e.field,e.value)}function qr(o){const e=(t,r,n)=>{const i=o.object(t);if(!i)return null;const s=o.sourceTag(t),a=Kr(i,s,r,n);if(a)return{field:a.field,value:a.value,preview:()=>Gr(i,a)};const c=Lr(i,s,r,n);return c?{field:c.field,value:c.value,preview:()=>Fr(i,c)}:null};return{layers:t=>{const r=o.object(t);if(!r)return[];const n=i=>o.writable(t,i);return[...o.colliderBindings(t).map(Nr),...o.jointBindings(t).map(Hr),...o.particleBindings(t).map(Or),...o.lodBindings(t).map(mr),Ur(r,n),Mr(r,n)].filter(i=>i!==null)},preview:(t,r,n)=>{const i=Qe(o.colliderBindings(t),r,n);if(i){o.previewCollider(i.colliderId,i.shape);return}const s=et(o.jointBindings(t),r,n);if(s){o.previewJointAnchor(s.binding.snapshot.id,s.endpoint,s.anchor);return}const a=_e(o.particleBindings(t),r,n);if(a){vt(a);return}const c=je(o.lodBindings(t),r,n);if(c){yt(c);return}e(t,r,n)?.preview()},commit:(t,r,n)=>{const i=Qe(o.colliderBindings(t),r,n);if(i)return o.commitCollider(t,i.sourceOid,i.args);const s=et(o.jointBindings(t),r,n);if(s)return o.commitJoint(s.binding,s.params);const a=_e(o.particleBindings(t),r,n);if(a)return o.commitParticle(a.binding,a.field,a.value);const c=je(o.lodBindings(t),r,n);if(c)return o.commitLodDistance(c.binding,c.level,c.value);const l=e(t,r,n);if(!(!l||!o.writable(t,l.field.path)))return o.commit(t,l.field.path,l.value)}}}const Q=/^-?\d+(\.\d+)?$/,Xr=/^#[0-9a-fA-F]{3,8}$/,U=1e-6;function $(o){const e=o.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").trim();return e?e[0].toUpperCase()+e.slice(1):o}const Qr=new Set(["key","ref","data-oid","userData-oid","children"]),Zr=o=>Qr.has(o)||/^on[A-Z]/.test(o)||o.startsWith("userData-")||o.startsWith("__vgai"),Yr=new Set(["position","rotation","scale","name","visible"]),en=new Set;function ue(o){return o instanceof Error?o.message:String(o)}function F(o){const e=Math.round(o*1e4)/1e4;return Object.is(e,-0)?"0":String(e)}function K(o){return`[${o.map(F).join(", ")}]`}function ve(o){return o.replace(/^\.?\//,"")}function ot(o){return o.replace(/["\\]/g,"")}function tn(o){return(o.split("/").pop()??o).replace(Ct,"")||"Model"}function rn(o){if(!xe(o))return!1;const e=o.trim().slice(1,-1).split(",").map(t=>t.trim()).filter(t=>t!=="");return e.length===3&&e.every(t=>Q.test(t))}function Oe(o){return o.isCamera===!0&&_(o)!==void 0}function I(o){const e=o.material;return Array.isArray(e)?e[0]??null:e??null}const de="this session has no source-write backend",O="jsx.",he="wrap.",N="collider.",st="joint.",at="particle.",Se="lod.",R="scene.background.",W="scene.environment.",S="scene.fog.",ct={CuboidCollider:"cuboid",BallCollider:"ball",CapsuleCollider:"capsule"},nn={useFixedJoint:"fixed",useSphericalJoint:"spherical",useRevoluteJoint:"revolute",usePrismaticJoint:"prismatic",useRopeJoint:"rope",useSpringJoint:"spring"};function G(o){return!!o&&o.isColor===!0}function on(o){return!!o&&o.isTexture===!0}function L(o){return!!o&&o.isFog===!0}function q(o){return!!o&&o.isFogExp2===!0}function lt(o){return o&&typeof o=="object"?o:null}function sn(o){const e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(o.trim());if(!e)return null;const t=e[1].toLowerCase();return t.length===3?t.split("").map(r=>`${r}${r}`).join(""):t}function an(o){return Array.isArray(o)}function Tt(o,e,t,r,n){const i=Array.isArray(e),s=Array.isArray(t),a=an(r);if(i||s||a)return!i||!s||!a||e.length!==t.length||e.length!==r.length?!1:e.every((l,u)=>Tt(o,l,t[u],r[u],n));if(e===t)return!0;const c=o.slice(r.start,r.end);return(typeof e=="number"?Number(c)!==e:c!==String(e))?!1:(n.push({start:r.start,end:r.end,text:typeof t=="number"?F(t):t?"true":"false"}),!0)}function cn(o,e){const t=o.source.params?.[e];if(t!==void 0)return t;const r=o.source.hook,n=o.snapshot;if(e===0)return n.anchor1;if(e===(r==="useFixedJoint"?2:1))return n.anchor2;if(e===2&&(r==="useRevoluteJoint"||r==="usePrismaticJoint"))return n.axis;if(e===3&&n.limits)return[n.limits.min,n.limits.max]}function ln(o,e){return e===void 0?o:Array.isArray(o)?o[e]:void 0}const ut={group:`<group>
3
- </group>`,mesh:`<mesh position={[0, 0, 0]}>
4
- <boxGeometry />
5
- <meshStandardMaterial color="#8888ff" />
6
- </mesh>`,pointLight:"<pointLight position={[0, 2, 0]} intensity={1} />",ambientLight:"<ambientLight intensity={0.5} />",directionalLight:"<directionalLight position={[5, 10, 5]} intensity={1} />",reflectionProbe:"<ReflectionProbe position={[0, 2, 0]} size={[10, 6, 10]} blendDistance={1} />"},Ct=/\.(glb|gltf)$/i,dt=new Set(["name","position","rotation","scale","children"]),pe="@react-three/drei",X="Gltf",ht={group:"Group",mesh:"Mesh (box)",pointLight:"Point Light",ambientLight:"Ambient Light",directionalLight:"Directional Light",reflectionProbe:"Reflection Probe"};class Cn{constructor(e,t,r){this.store=e,this.options=r,this.scene=t,this.documentNodeId=`r3f-document:${r.worldId}`,this.identity=or(r.worldId),this.projector=new sr(this.identity,{pickScope:"store-object-map"}),this.writeBackend=Mt(r.writeBackend,e.projectHistory),this.capabilities={transform:!0,inspectorFields:!0,persist:this.writeBackend!==void 0},this.writeBackend&&(this.persistence={isDirty:()=>!1,save:async()=>{},destination:r.entryPath,lastError:()=>{const n=e.projectHistory?.getSnapshot().lastError;return n&&(n.code==="apply-failed"||n.code==="compensation-failed"||n.code==="history-limit")?n.message:null}}),this.selectionState=new Kt({store:e,owns:n=>this.byId.has(n),initial:[this.documentNodeId]}),this.indexGraph(),this.definitionRootIds=(r.hierarchyRoots??this.projectedChildren(this.scene)).map(n=>this.idByObject.get(n)).filter(n=>n!==void 0),this.definitionView=new Gt({projector:this.projector,scene:this.scene,documentNodeId:this.documentNodeId,rootIds:this.definitionRootIds}),this.stories=Lt("three",e,n=>this.storyComponent(n)),this.refreshSourceState()}documentNodeId;scene;identity;projector;definitionRootIds;definitionView;selectionState;oidIndex=new Map;sourceRefreshId=0;sourceRefreshPending=!1;sources=new Map;valueEcho=new Map;dynamicPaths=new Set;reflectionProbeAvailable=!1;lockedIds=new Set;structureClipboard=null;writeBackend;transformEdits=new Map;completedTransformEdits=[];transformCommitQueue=Promise.resolve();stories;capabilities;persistence;provenance={source:"source-code",label:"R3F source",detail:"Live react-three-fiber scene; literal JSX props write back to the .tsx source (expression-bound props are read-only)."};get byId(){return this.projector.objects}get idByObject(){return this.projector.idsByObject}get instanceRoots(){return this.identity.instanceRoots}get oidRepresentative(){return this.identity.representatives}indexGraph(){this.projector.project(this.scene),this.watchStructure()}disposed=!1;dispose(){if(!this.disposed){this.disposed=!0;for(const e of this.watchedForStructure)e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure=[]}}watchedForStructure=[];structureReindexQueued=!1;staleOidRefreshes=new Set;onStructureChanged=e=>{fe(e.child)||this.scheduleStructureReindex()};watchStructure(){const e=r=>r;for(const r of this.watchedForStructure)e(r).removeEventListener("childadded",this.onStructureChanged),e(r).removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure=[];const t=r=>{e(r).addEventListener("childadded",this.onStructureChanged),e(r).addEventListener("childremoved",this.onStructureChanged),this.watchedForStructure.push(r)};t(this.scene);for(const[,r]of this.byId)t(r)}scheduleStructureReindex(){this.disposed||this.structureReindexQueued||(this.structureReindexQueued=!0,queueMicrotask(()=>{if(this.structureReindexQueued=!1,this.disposed)return;this.indexGraph();let e=!1;for(const t of this.liveOids()){const r=this.oidIndex.get(t);if(r===void 0||!this.sources.has(r.file)){e=!0;break}}e&&this.refreshSourceState(),this.syncAdoptedObjectMap(),this.store.notifyIngestEdit()}))}syncAdoptedObjectMap(){if(this.store.scene!==this.scene)return;const e=this.store.objectMap;e.clear();for(const[r,n]of this.byId)e.set(r,n);const t=[...this.store.selectedEntityIds].filter(r=>e.has(r));t.length!==this.store.selectedEntityIds.size&&this.store.selectMultiple(t)}liveInstanceCount(e){const t=this.oidOf(e);return t?this.instanceRoots.get(t):void 0}borrowsRepresentativeCallsite(e){if(!Ft(e))return!1;const t=this.byId.get(e),r=t?_(t):void 0,n=r?this.oidRepresentative.get(r):void 0;return!n||!Bt(t,n)}adoptScene(e){this.scene=e,this.valueEcho.clear(),this.dynamicPaths.clear(),this.pendingDuplicateLabels.clear(),this.pendingDuplicateCounts.clear(),this.indexGraph(),setTimeout(()=>this.applyPendingCreatedSelection(),0),this.refreshSourceState()}pendingCreatedSelection=null;recordPendingCreatedSelection(e,t){this.pendingCreatedSelection={parentId:e,before:new Set(this.hierarchy.node(e)?.childIds??[]),selectionAtWrite:new Set(this.store.selectedEntityIds),...t?{afterId:t}:{}}}applyPendingCreatedSelection(){const e=this.pendingCreatedSelection;if(this.pendingCreatedSelection=null,!e)return;const t=this.store.selectedEntityIds;if(!(t.size===e.selectionAtWrite.size&&[...t].every(a=>e.selectionAtWrite.has(a))))return;const n=this.hierarchy.node(e.parentId)?.childIds??[],i=e.afterId?this.childWrittenAfter(n,e.afterId):null;if(i){this.store.selectMultiple([i]);return}const s=n.filter(a=>!e.before.has(a));s.length>0&&this.store.selectMultiple(s)}childWrittenAfter(e,t){const r=this.sourceLocation(t);if(!r)return null;let n=null;for(const i of e){if(i===t)continue;const s=this.sourceLocation(i);!s||s.file!==r.file||!(s.line>r.line||s.line===r.line&&s.col>r.col)||(!n||s.line<n.line||s.line===n.line&&s.col<n.col)&&(n={id:i,line:s.line,col:s.col})}return n?.id??null}async refreshSourceState(){const e=this.writeBackend;if(this.disposed||!e?.index||!e.readSource)return;const t=++this.sourceRefreshId;this.sourceRefreshPending=!0;try{const r=await e.index();if(this.disposed||t!==this.sourceRefreshId)return;const n=new Map(Object.entries(r)),i=new Set;for(const c of this.liveOids()){const l=n.get(c);l&&i.add(l.file)}const s=new Map;if(await Promise.all([...i].map(async c=>{const l=await e.readSource(c);s.set(c,l.source)})),this.disposed||t!==this.sourceRefreshId)return;const a=await jt().exists("src/lib/reflections/index.ts").catch(()=>!1);if(this.disposed||t!==this.sourceRefreshId)return;this.oidIndex=n,this.sources=s,this.reflectionProbeAvailable=a,this.store.notifyIngestEdit()}catch{}finally{t===this.sourceRefreshId&&(this.sourceRefreshPending=!1)}}liveOids(){const e=new Set;for(const[,t]of this.byId){const r=_(t);r!==void 0&&e.add(r)}for(const t of[this.scene.background,this.scene.environment,this.scene.fog]){const r=M(lt(t));r!==void 0&&e.add(r)}return e}oidOf(e){return _(this.byId.get(e))??null}attrsOf(e){const t=this.oidOf(e);if(!t)return null;const r=this.oidIndex.get(t);if(!r)return null;const n=this.sources.get(r.file);if(n===void 0)return null;const i=H(n,r.line,r.col);if(n[i]!=="<")return null;const s=me(n,i);return s<0?null:ke(n,i,s)}sourceLocation(e){const t=this.oidOf(e);return t?this.oidIndex.get(t):void 0}definitionLocation(e){const t=this.definitionOid(e);return t?this.oidIndex.get(t):void 0}storyComponent(e){const t=this.hierarchy.node(e);if(t?.role!=="component")return null;const r=this.definitionLocation(e),n=this.sourceLocation(e),i=r?.component??n?.tag??t.typeLabel??t.label;return r?.file?{name:i,sourcePath:r.file}:{name:i}}definitionOid(e){const t=this.byId.get(e);if(!t||!re(t))return null;const r=ne(t),n=M(t);return n===void 0||n===r?null:n}canForkComponent(e){return typeof this.writeBackend?.forkComponent!="function"?!1:!!this.oidOf(e)&&!!this.definitionOid(e)}async forkComponent(e){const t=this.sourceLocation(e),r=this.oidOf(e),n=this.definitionOid(e),i=t?.tag??"component";if(!r||!n||!t)return Qt(i);const s=this.writeBackend,a=this.store.projectHistory;if(!s?.forkComponent||!s.readSource||!s.applySource||!a)return Zt(i);let c;try{c=await s.forkComponent(r,n,this.forkNameSeed(e))}catch(p){return Ee(ue(p))}const{newName:l,newResourcePath:u,callsiteFile:d,callsiteNewSource:h}=c;if(!c.ok||!l||!u||!d||!h)return Ee(c.error??"the fork was refused without a reason.");try{await B(s,a,{file:d,source:h,label:c.label??`Fork ${i} → ${l}`})}catch(p){return Yt(i,l,u,ue(p))}return await this.refreshSourceState(),er(c.tag??i,l,u)}forkNameSeed(e){const t=this.attrsOf(e)?.find(r=>r.name==="name");return t?.isLiteral&&t.rawValue?t.rawValue:this.byId.get(e)?.name||void 0}canExtractComponent(e){return!!(this.oidOf(e)&&this.writeBackend?.extractComponent)}async extractComponent(e,t){const r=this.sourceLocation(e),n=this.oidOf(e),i=r?.tag??"element";if(!n||!r)return tr(i);const s=this.writeBackend,a=this.store.projectHistory;if(!s?.extractComponent||!s.readSource||!s.applySource||!a)return rr(i);let c;try{c=await s.extractComponent(n,t??this.forkNameSeed(e))}catch(f){return Te(ue(f))}const{newName:l,componentResourcePath:u,storyResourcePath:d,callsiteFile:h,callsiteNewSource:p}=c;if(!c.ok||!l||!u||!d||!h||!p)return Te(c.error??"the extraction was refused without a reason.");try{await B(s,a,{file:h,source:p,label:c.label??`Extract ${l}`})}catch(f){return nr(i,l,u,ue(f))}return await this.refreshSourceState(),ir(c.tag??i,l,u,d)}diagnosticsFor(e){const t=this.borrowsRepresentativeCallsite(e)?void 0:this.sourceLocation(e);return fr(t,this.definitionLocation(e))}internalChildren(e){if(this.options.hierarchyMode==="definition")return;const t=this.byId.get(e);if(t)return this.internalChildObjects(t).map(r=>({...this.objectNode(r),parentId:e}))}hasInternals(e){if(this.options.hierarchyMode==="definition")return!1;const t=this.byId.get(e);return t?this.internalChildObjects(t).length>0:!1}internalChildObjects(e){return e.children.filter(t=>this.idByObject.has(t)&&!this.isProjectedRow(t))}objectNode(e){const t=this.idByObject.get(e),r=this.projectedParentId(e),n=this.borrowsRepresentativeCallsite(t),i=this.isComponentBoundary(e)&&!n,s=n?void 0:this.oidEntryOf(e)?.tag;return{id:t,label:i?ye(e,"authoringLabel")||e.name||s||"Component":e.name||e.type||"Object3D",role:i?"component":"entity",kind:ar(this.transformObject(t)??e),...i&&s&&/^[A-Z]/.test(s)?{typeLabel:s}:{},parentId:r,childIds:this.projector.childIdsOf(this.projectedChildren(e))}}isComponentBoundary(e){return re(e)&&ye(e,"authoringRoot")!==!0}spatialTargetOf(e){return e}transformObject(e){const t=this.byId.get(e);return t?this.isComponentBoundary(t)?this.spatialTargetOf(t):t:null}oidEntryOf(e){const t=this.idByObject.get(e);return t?this.sourceLocation(t):void 0}componentOwnerChain(e){const t=[];let r=e;for(;r&&r!==this.scene;){for(;r&&r!==this.scene&&!this.isComponentBoundary(r);)r=r.parent;if(!r||r===this.scene)break;const n=ne(r);let i=r;for(;i.parent&&i.parent!==this.scene&&ne(i.parent)===n;)i=i.parent;t.push(i),r=i.parent}return t.reverse()}selectionOwnerObject(e,t=this.componentOwnerChain(e)){return t.at(-1)??this.stampedOwnerObject(e)}stampedOwnerObject(e){let t=e;for(;t&&t!==this.scene&&this.oidOf(this.idByObject.get(t)??"")===null;)t=t.parent??void 0;return!t||t===this.scene?null:t}insideTransparentTopLevel(e){return this.componentOwnerChain(e).length===1}isProjectedRow(e){if(e===this.scene||fe(e))return!1;const t=this.idByObject.get(e);if(t===void 0)return!1;if(Oe(e))return!0;const r=this.componentOwnerChain(e);return this.selectionOwnerObject(e,r)===e?!0:r.length===1&&this.oidOf(t)!==null}projectedChildren(e){const t=[],r=new Set,n=i=>{if(!fe(i)){if(this.isProjectedRow(i)){r.has(i)||(r.add(i),t.push(i));return}for(const s of i.children)n(s)}};for(const i of e.children)n(i);return t}projectedParentId(e){let t=e.parent;for(;t&&t!==this.scene;){if(this.isProjectedRow(t))return this.idByObject.get(t);t=t.parent}return this.documentNodeId}selectionOwnerId(e){const t=this.byId.get(e);if(!t)return null;if(Oe(t))return e;const n=this.componentOwnerChain(t).slice(1).at(-1)??this.stampedOwnerObject(t);return n?this.idByObject.get(n)??null:null}hierarchy={roots:()=>[this.hierarchy.node(this.documentNodeId)],node:e=>{if(e===this.documentNodeId)return{id:e,label:this.options.worldId,secondaryLabel:this.options.entryPath,role:"document",kind:"three-source",parentId:null,childIds:this.options.hierarchyMode==="definition"?this.definitionView.rootIds():this.projector.childIdsOf(this.projectedChildren(this.scene))};const t=this.byId.get(e);return t?this.options.hierarchyMode==="definition"?this.definitionView.node(t):this.objectNode(t):null},object3D:e=>this.transformObject(e),idForObject3D:e=>this.idByObject.get(e)??null};truth={resolve:e=>{const t=this.oidOf(e);if(!t)return{site:{anchored:!1,reason:e===this.documentNodeId?"The World document is a composition, not a source element.":"This rendered object has no authored source identity."},writeAnchorKind:this.transformWriteAnchorKind(e)};const r=this.oidIndex.get(t);if(!r)return{site:{anchored:!1,reason:"Source metadata is still loading or unavailable."},writeAnchorKind:this.transformWriteAnchorKind(e)};const n=this.projectRelativeSourceFile(r.file);return{site:{anchored:!0,kind:"source",file:n,line:r.line,col:r.col,display:`${n}:${r.line}`},writeAnchorKind:this.transformWriteAnchorKind(e)}}};transformWriteAnchorKind(e){if(!this.byId.has(e))return;const t=this.oidOf(e);return!t||!this.writeBackend?.writeProp?"live-only":cr(this.oidIndex.get(t),"position")?"physics-binding":"source-prop"}pickable={pick:(e,t)=>this.projector.pick(this.store,e,t,r=>this.isPickLocked(r)),candidates:(e,t)=>this.projector.candidates(this.store,e,t,r=>this.isPickLocked(r))};isPickLocked(e){let t=e,r=0;for(;t&&r++<1e3;){if(this.lockedIds.has(t))return!0;t=this.hierarchy.node(t)?.parentId??null}return!1}selection={get:()=>this.selectionState.current(),set:(e,t)=>this.selectionState.publish(e.map(r=>this.options.hierarchyMode==="definition"||t?.intent==="exact"||r===this.documentNodeId?r:this.selectionOwnerId(r)??r).filter(r=>r===this.documentNodeId||this.byId.has(r))),resolve:(e,t)=>{const r=this.byId.get(e);if(!r)return null;if(this.options.hierarchyMode==="definition")return{id:e};if(Oe(r))return{id:e};const n=this.componentOwnerChain(r),i=t?.scopeId?n.findIndex(u=>this.idByObject.get(u)===t.scopeId):-1,s=i>=0?i+1:1,a=t?.intent==="deep"?s+1:s,c=n[a]??n[s]??this.stampedOwnerObject(r),l=c?this.idByObject.get(c)??null:null;return l?{id:l}:null}};related={links:e=>{const t=ye(this.byId.get(e),"authoringDocument");return!t||t.kind!=="project-tool"?[]:[{id:`definition:project-tool:${t.name}`,title:t.title,open:()=>{Dt(this.store,t.name)}}]}};instanceProp(e,t){if(!t.startsWith(O))return null;const r=t.slice(O.length),n=this.declaredPropsOf(e).find(s=>s.name===r),i=this.attrsOf(e)?.find(s=>s.name===r);return n&&i?{prop:r,spec:n,attr:i}:null}affectedInstances(e,t){const r=this.definitionLocation(e);if(!r)return 0;let n=0;for(const[i,s]of this.byId){if(!re(s))continue;const a=this.definitionLocation(i);a?.file!==r.file||a.component!==r.component||this.attrsOf(i)?.some(c=>c.name===t)||(n+=1)}return n+1}instances={openComponent:()=>{Nt(Wt)},describe:e=>{const t=this.storyComponent(e);if(!t||this.stories.storiesFor(e).length===0)return null;const r=this.inspector.properties(e).filter(n=>n.resettable&&n.path.startsWith(O)).map(n=>{const i=this.instanceProp(e,n.path),s=!!i?.attr.isLiteral&&i.spec.defaultValue!==void 0&&!!this.definitionOid(e)&&!!this.writeBackend?.runGesture&&!!this.writeBackend.writeComponentDefault&&!!this.writeBackend.removeProp;return{path:n.path,label:n.label,value:this.inspector.get(e,n.path),...n.revertsTo===void 0?{}:{defaultText:n.revertsTo},canApplyToComponent:s,affectedInstanceCount:i?this.affectedInstances(e,i.prop):0,...s?{}:{applyUnavailableReason:i?.spec.defaultValue===void 0?"The component default is computed or absent, so source cannot be changed safely.":"This session cannot atomically update the component and its callsite."}}});return{componentName:t.name,...t.sourcePath?{sourcePath:this.projectRelativeSourceFile(t.sourcePath)}:{},overrides:r}},revert:async(e,t)=>{const r=this.oidOf(e),n=this.writeBackend;if(!r||!n?.removeProp)return;const i=t.map(c=>this.instanceProp(e,c)?.prop).filter(c=>!!c);let s=!1;const a=async c=>{for(const l of i){const u=await c.removeProp?.(r,l);s||=u?.changed===!0}};return i.length>1&&n.runGesture?await n.runGesture(`Revert ${i.length} Overrides`,a):await a(n),await this.refreshSourceState(),s?{destination:this.destinationOf(e),persisted:!0}:void 0},applyToComponent:async(e,t)=>{const r=this.instanceProp(e,t),n=this.definitionOid(e),i=this.oidOf(e),s=this.writeBackend;if(!r||r.spec.defaultValue===void 0||!n||!i||!s?.runGesture||!s.writeComponentDefault||!s.removeProp)return{changed:!1,message:"Apply was refused because both literal source writes are not available."};const a=this.inspector.get(e,t);return await s.runGesture(`Apply ${r.prop} to ${this.storyComponent(e)?.name??"Component"}`,async c=>{const l=await c.writeComponentDefault?.(n,r.prop,this.serializeValue(a));if(!l?.changed)throw new Error(l?.error??"The component default did not change.");const u=await c.removeProp?.(i,r.prop);if(!u?.changed)throw new Error(u?.error??"The callsite override was not removed.")}),await this.refreshSourceState(),{changed:!0,message:`${r.prop} now defaults to ${String(a)} in ${this.storyComponent(e)?.name??"the component"}.`,write:{destination:this.destinationOf(e),persisted:!0}}}};transforms={dimensions:e=>this.transformObject(e)?"3d":null,get:e=>qt(this.transformObject(e)),editability:(e,t)=>this.transformEditability(e,t),beginEdit:e=>{if(!this.transformEditability(e,"position").writable&&!this.transformEditability(e,"rotation").writable&&!this.transformEditability(e,"scale").writable)return;const t=this.transformObject(e);t&&(this.transformEdits.has(e)||this.transformEdits.set(e,{id:e,position:t.position.toArray(),quaternion:t.quaternion.toArray(),euler:[t.rotation.x,t.rotation.y,t.rotation.z],scale:t.scale.toArray()}))},apply:(e,t)=>{const r=this.transformObject(e);r&&(r.position.fromArray(t.position),r.quaternion.fromArray(t.rotation),r.scale.fromArray(t.scale))},endEdit:e=>{const t=this.transformEdits.get(e);if(!t||(this.transformEdits.delete(e),this.completedTransformEdits.push(t),this.transformEdits.size>0))return;const r=this.completedTransformEdits.splice(0);Ht();const n=this.transformCommitQueue.then(()=>ie(this.pipedTransformCommit(r)));return n.then(Ae,Ae),this.transformCommitQueue=n.then(()=>{},i=>{console.error("[R3fSourceAuthoringAdapter] transform commit failed",i)}),n},remove:(e,t)=>{const r=this.oidOf(e);if(r)return this.pipedJsxRemove(()=>this.removeTransformChannel(e,r,t),this.destinationOf(e))}};async removeTransformChannel(e,t,r){const n=this.transformEditability(e,r);return!n.writable||n.removable!==!0?(console.warn(`[R3fSourceAuthoringAdapter] cannot drop "${r}" on "${e}": ${n.reason??"this callsite authors no such attribute"}.`),!1):this.removeOidProp(e,t,`${O}${r}`,r)}destinationOf(e){const t=this.sourceLocation(e);return t?this.projectRelativeSourceFile(t.file):this.options.entryPath}pipedJsxWrite(e,t=this.writeBackend?.writeProp!==void 0,r=this.options.entryPath){return ie({resolve:()=>t?{reaches:"writer",anchorKind:"source-prop",destination:r,write:e}:oe(de),record:()=>{},report:n=>console.warn(`[R3fSourceAuthoringAdapter] this edit stays live-only — ${n}.`)})}pipedSourceTokenWrite(e){return ie({resolve:()=>this.writeBackend&&this.store.projectHistory?{reaches:"writer",anchorKind:"construction-literal",destination:this.options.entryPath,write:()=>e().catch(t=>(console.error("[R3fSourceAuthoringAdapter] source token write failed",t),!1))}:oe(de),record:()=>{},report:t=>console.warn(`[R3fSourceAuthoringAdapter] this edit stays live-only — ${t}.`)})}pipedTransformCommit(e){return{resolve:()=>this.writeBackend?.writeProp?{reaches:"writer",anchorKind:"source-prop",destination:this.destinationOf(e[0]?.id??""),write:()=>this.commitTransformEdits(e).catch(t=>(console.error("[R3fSourceAuthoringAdapter] transform commit failed",t),!1))}:oe(de),record:()=>{},report:t=>console.warn(`[R3fSourceAuthoringAdapter] this edit stays live-only — ${t}.`)}}transformEditability(e,t){if(this.borrowsRepresentativeCallsite(e)){const c=this.byId.get(e),l=c?this.oidEntryOf(c)?.tag:void 0;return{writable:!1,reason:`Rendered by ${l?`<${l}>`:"its component"} — this object has no writable source transform of its own.`}}const r=this.oidOf(e);if(!r){const c=ne(this.byId.get(e)),l=c!==void 0?this.oidIndex.get(c)?.tag:void 0;return{writable:!1,reason:l?`Rendered by <${l}> — this object has no writable source transform of its own.`:"This rendered part has no authored source identity."}}if(!this.writeBackend?.writeProp)return{writable:!1,reason:"This session has no source writer."};const n=lr(this.oidIndex.get(r),t);if(n)return{writable:!1,reason:n};const i=this.attrsOf(e);if(!i)return this.staleOidRefreshes.has(r)||(this.staleOidRefreshes.add(r),this.refreshSourceState()),this.sourceRefreshPending?{writable:!1,reason:"Source metadata for this element is being refreshed — try again in a moment."}:(un(e),{writable:!1,reason:"Source metadata is missing for this element — an element added by hot reload is not in the OID index until the page reloads. Reload the editor page to author it."});const s=i.find(c=>c.name===t),a=this.byId.get(e);if(a&&this.isComponentBoundary(a)){const c=this.oidEntryOf(a)?.r3fAuthoring,l=c?.transformProps.includes(t)??!1,u=c?.simulationOwnedTransform===!0;if(u)return{writable:!1,reason:`${this.oidEntryOf(a)?.tag??"This component"} drives its own ${t} every frame — this instance is placed by the simulation, not by the editor.`};if(!s){if(l)return{writable:!0};const h=u?`drives its own ${t} every frame — this instance is placed by the simulation, not by the editor`:c?.root==="multiple"?"renders multiple roots":c?.root==="non-spatial"?"has no spatial root":c?.root==="unknown"?"has no statically provable native root":c?.root==="single"?`does not forward ${t} to its ${c.rootTag??"native"} root`:`does not expose a ${t} prop`;return{writable:!1,reason:`${this.oidEntryOf(a)?.tag??"This component"} ${h}.`}}if(c&&!l)return{writable:!1,reason:`${this.oidEntryOf(a)?.tag??"This component"} does not forward ${t} to its ${c.rootTag??"native"} root.`};if(!(s.isExpression&&(rn(s.rawValue)||t==="scale"&&Q.test(s.rawValue))))return{writable:!1,reason:t==="scale"?"scale is not exposed as a number or three-number tuple by this component.":`${t} is not exposed as a three-number tuple by this component.`}}return s?.isExpression&&!s.isLiteral?{writable:!1,reason:`${t} is controlled by the JSX expression {${s.rawValue}}.`}:{writable:!0,...s&&this.writeBackend?.removeProp?{removable:!0}:{}}}async commitTransformEdits(e){if(e.length===0)return!1;const t=this.writeBackend;let r=!1;const n=async i=>{for(const s of e)await this.commitTransformEdit(s,i,!1)&&(r=!0)};return e.length>1&&t?.runGesture?await t.runGesture("Transform Selection",i=>n(i)):await n(t),r}async commitTransformEdit(e,t,r=!0){const n=this.transformObject(e.id);if(!n)return!1;const i=this.oidOf(e.id),s=i?this.attrsOf(e.id):null,a={position:!this.nearlyEqual(n.position.toArray(),e.position),rotation:!this.nearlyEqual([n.rotation.x,n.rotation.y,n.rotation.z],e.euler),scale:!this.nearlyEqual(n.scale.toArray(),e.scale)};if(!a.position&&!a.rotation&&!a.scale)return!1;const c=p=>{p==="position"?n.position.fromArray(e.position):p==="rotation"?n.quaternion.fromArray(e.quaternion):n.scale.fromArray(e.scale),this.store.notifyIngestEdit()},l=t??this.writeBackend;if(!i||!l?.writeProp){console.warn(`[R3fSourceAuthoringAdapter] transform on "${e.id}" is not persistable (${i?"no source-write backend":"node has no source stamp"}) — reverting.`);for(const p of["position","rotation","scale"])a[p]&&c(p);return!1}const u=[];for(const p of["position","rotation","scale"]){if(!a[p])continue;const f=p==="position"?n.position.toArray():p==="rotation"?[n.rotation.x,n.rotation.y,n.rotation.z]:n.scale.toArray(),g=s?.find(v=>v.name===p);if(g&&g.isExpression&&!g.isLiteral){console.warn(`[R3fSourceAuthoringAdapter] "${p}" on "${e.id}" is expression-bound (guarded) — reverting the live object.`),this.dynamicPaths.add(`${e.id}|${p}`),c(p);continue}if(p==="scale"&&g&&Q.test(g.rawValue)){const[v,x,w]=f;Math.abs(v-x)<U&&Math.abs(x-w)<U?u.push({channel:p,value:F(v)}):u.push({channel:p,value:K(f),shapeUpgrade:!0});continue}u.push({channel:p,value:K(f)})}if(u.length===0)return!1;let d=!1;const h=async p=>{for(const f of u){const g=await p.writeProp(i,f.channel,f.value,{addIfMissing:!0,...f.shapeUpgrade?{allowShapeUpgrade:!0}:{}});g.changed&&(d=!0),g.changed||(g.dynamic&&this.dynamicPaths.add(`${e.id}|${f.channel}`),console.warn(`[R3fSourceAuthoringAdapter] ${f.channel} write refused for oid "${i}": ${g.dynamic?"dynamic expression (guarded)":g.error??"no change"} — reverting.`),c(f.channel))}};return r&&u.length>1&&l.runGesture?await l.runGesture("Transform",p=>h(p)):await h(l),this.store.notifyIngestEdit(),d}nearlyEqual(e,t){return e.length===t.length&&e.every((r,n)=>Math.abs(r-(t[n]??0))<U)}materialOidOf(e){return M(I(e))??null}attrsOfOid(e){const t=this.oidIndex.get(e);if(!t)return null;const r=this.sources.get(t.file);if(r===void 0)return null;const n=H(r,t.line,t.col);if(r[n]!=="<")return null;const i=me(r,n);return i<0?null:ke(r,n,i)}descriptorTypeFor(e,t,r,n){const i=(()=>{if(!e.isLiteral)return"string";const c=e.rawValue;if(c==="true"||c==="false")return"boolean";if(e.isExpression&&Q.test(c))return"number";if(e.isExpression&&xe(c))return"json";const l=e.isExpression?c.replace(/^['"]|['"]$/g,""):c;return Xr.test(l)?"color":"string"})(),s=this.oidIndex.get(t.oid);return n===void 0&&s?.propsResolved===!0&&/^[A-Z]/.test(s.tag??"")&&Xt(s?.file??this.options.entryPath,r,i),i}literalValueOf(e){if(!e.isLiteral)return`{${e.rawValue}}`;const t=e.rawValue;if(!e.isExpression)return t;if(t==="true")return!0;if(t==="false")return!1;if(Q.test(t))return Number(t);if(xe(t))try{return JSON.parse(t.replace(/,\s*\]$/,"]"))}catch{return t}return t.replace(/^['"]|['"]$/g,"")}parseWrapperPropertyPath(e){if(!e.startsWith(he))return null;const t=e.slice(he.length),r=t.indexOf(".");if(r<1)return null;try{return{oid:decodeURIComponent(t.slice(0,r)),prop:t.slice(r+1)}}catch{return null}}declaredPropsOf(e){const t=this.oidOf(e);return(t?this.oidIndex.get(t)?.props:void 0)??[]}nodeSubject(e){const t=this.oidOf(e);return t?{oid:t,declared:this.declaredPropsOf(e),pathFor:r=>`${O}${r}`,keyFor:r=>`${e}|${O}${r}`}:null}wrapperSubject(e){const t=r=>`${he}${encodeURIComponent(e)}.${r}`;return{oid:e,declared:this.oidIndex.get(e)?.props??[],pathFor:t,keyFor:t}}collapsedWrappersOf(e){const t=this.oidOf(e);if(!t)return[];const r=this.liveOids(),n=[];let i=this.oidIndex.get(t)?.parentOid;for(let s=0;i&&s<16&&!r.has(i);s+=1){const a=this.oidIndex.get(i);if(!a)break;/^[A-Z]/.test(a.tag)&&n.push({oid:i,tag:a.tag}),i=a.parentOid}return n.reverse()}rigidBodyOidOf(e){const t=this.byId.get(e),r=[this.definitionOid(e),M(t),this.oidOf(e)].filter(n=>typeof n=="string");for(const n of r){let i=n;for(let s=0;i&&s<32;s+=1){const a=this.oidIndex.get(i);if(!a)break;if(a.tag==="RigidBody")return i;i=a.parentOid}}return null}explicitColliderOids(e){const t=r=>{let n=this.oidIndex.get(r)?.parentOid;for(let i=0;n&&i<32;i+=1){if(n===e)return!0;const s=this.oidIndex.get(n);if(!s||s.tag==="RigidBody")return!1;n=s.parentOid}return!1};return[...this.oidIndex.entries()].filter(([r,n])=>n.tag in ct&&t(r)).sort(([,r],[,n])=>r.file===n.file?r.line-n.line||r.col-n.col:r.file.localeCompare(n.file)).map(([r])=>r)}steppingPhysics(){return this.store.playState==="stopped"?null:this.options.physics?.()??null}colliderBindingsOf(e){const t=this.rigidBodyOidOf(e),r=this.steppingPhysics();if(!t||!r?.colliders)return[];const n=this.explicitColliderOids(t),i=[...r.colliders(e)];if(n.length===0||n.length!==i.length)return[];const s=[];for(let a=0;a<n.length;a+=1){const c=n[a],l=this.oidIndex.get(c)?.tag,u=i[a];if(!l||ct[l]!==u.shape.type)return[];const d=this.attrsOfOid(c)?.find(h=>h.name==="args");s.push({sourceOid:c,sourceTag:l,snapshot:u,writable:!!this.writeBackend?.writeProp&&!!d?.isLiteral&&!this.dynamicPaths.has(`${N}${encodeURIComponent(c)}.args`)})}return s}parseColliderArgPath(e){if(!e.startsWith(N))return null;const t=/^collider\.([^.]*)\.arg\.(\d+)$/.exec(e);if(!t)return null;try{return{oid:decodeURIComponent(t[1]),index:Number(t[2])}}catch{return null}}colliderArgs(e){const t=this.valueEcho.get(`${N}${encodeURIComponent(e)}.args`);if(Array.isArray(t)&&t.every(i=>typeof i=="number"))return[...t];const r=this.attrsOfOid(e)?.find(i=>i.name==="args"),n=r?this.literalValueOf(r):null;return Array.isArray(n)&&n.every(i=>typeof i=="number")?[...n]:null}colliderDimensionRows(e){return(e.sourceTag==="CuboidCollider"?["Half extent X","Half extent Y","Half extent Z"]:e.sourceTag==="CapsuleCollider"?["Half height","Radius"]:["Radius"]).map((r,n)=>({path:`${N}${encodeURIComponent(e.sourceOid)}.arg.${n}`,label:r,type:"number",group:$(e.sourceTag),readonly:!e.writable}))}jointBindingsOf(e){const t=this.rigidBodyOidOf(e),r=t?this.oidIndex.get(t):void 0,n=this.steppingPhysics();if(!t||!r?.jointBindings||!n?.joints)return[];const i=[...n.joints(e)];if(r.jointBindings.length!==i.length)return[];const s=[];for(let a=0;a<r.jointBindings.length;a+=1){const c=r.jointBindings[a],l=i[a];if(nn[c.hook]!==l.type)return[];s.push({sourceOid:t,sourceFile:r.file,source:c,snapshot:l,writable:!!c.params&&!!c.paramRanges&&!!this.writeBackend?.readSource&&!!this.writeBackend.applySource&&!!this.store.projectHistory})}return s}jointKey(e){return`${e.source.line}:${e.source.col}`}jointPath(e,t){return`${st}${this.jointKey(e)}.${t}`}jointBindingForPath(e,t){const r=/^joint\.(\d+:\d+)\./.exec(t);return r?this.jointBindingsOf(e).find(n=>this.jointKey(n)===r[1])??null:null}jointParamPath(e){const t=/^joint\.\d+:\d+\.param\.(\d+)(?:\.(\d+))?$/.exec(e);return t?{param:Number(t[1]),...t[2]===void 0?{}:{part:Number(t[2])}}:null}jointTupleRows(e,t,r,n=["X","Y","Z"]){const i=$(e.source.hook.replace(/^use/,""));return n.map((s,a)=>({path:this.jointPath(e,`param.${r}.${a}`),label:`${t} ${s}`,type:"number",readonly:!e.writable,group:i}))}jointScalarRow(e,t,r){return{path:this.jointPath(e,`param.${r}`),label:t,type:"number",readonly:!e.writable,group:$(e.source.hook.replace(/^use/,""))}}jointDetailRows(e){switch(e.source.hook){case"useFixedJoint":return e.source.params?[...this.jointTupleRows(e,"Local Frame A",1,["X","Y","Z","W"]),...this.jointTupleRows(e,"Local Frame B",3,["X","Y","Z","W"])]:[];case"useRevoluteJoint":case"usePrismaticJoint":return[...this.jointTupleRows(e,"Axis",2),...e.source.params?.[3]||e.snapshot.limits?[...this.jointTupleRows(e,"Limit",3,["Min","Max"])]:[]];case"useRopeJoint":return e.source.params?[this.jointScalarRow(e,"Length",2)]:[];case"useSpringJoint":return e.source.params?[this.jointScalarRow(e,"Rest Length",2),this.jointScalarRow(e,"Stiffness",3),this.jointScalarRow(e,"Damping",4)]:[];default:return[]}}jointRows(e){const t=$(e.source.hook.replace(/^use/,""));return[{path:this.jointPath(e,"body1"),label:"Body A",type:"string",readonly:!0,group:t},{path:this.jointPath(e,"body2"),label:"Body B",type:"string",readonly:!0,group:t},...this.jointTupleRows(e,"Anchor A",0),...this.jointTupleRows(e,"Anchor B",e.source.hook==="useFixedJoint"?2:1),...this.jointDetailRows(e),{path:this.jointPath(e,"contacts"),label:"Contacts Enabled",type:"boolean",readonly:!0,group:t}]}jointValue(e,t){const r=this.jointBindingForPath(e,t);if(!r)return;if(t.endsWith(".body1"))return r.source.body1Ref;if(t.endsWith(".body2"))return r.source.body2Ref;if(t.endsWith(".contacts"))return r.snapshot.contactsEnabled;const n=this.jointParamPath(t);if(n)return ln(cn(r,n.param),n.part)}particleBindingsOf(e){const t=this.byId.get(e);if(!t)return[];const r=[];t.traverse(i=>{const s=M(i)??_(i);!s||!this.oidIndex.get(s)?.particleBinding||r.push({emitter:i,sourceOid:s})});const n=[];for(const{emitter:i,sourceOid:s}of r){const a=this.oidIndex.get(s),c=a?.particleBinding,l=wr(i);!a||!c||!l||c.shape!==l.type||n.push({sourceOid:s,sourceFile:a.file,source:c,emitter:i,shape:l,writableFields:new Set(Object.keys(c.fields).filter(()=>!!this.writeBackend?.readSource&&!!this.writeBackend.applySource&&!!this.store.projectHistory))})}return n}particleKey(e){return encodeURIComponent(e.sourceOid)}particlePath(e,t){return`${at}${this.particleKey(e)}.${t}`}particleBindingForPath(e,t){const r=/^particle\.([^.]+)\./.exec(t);return r?this.particleBindingsOf(e).find(n=>this.particleKey(n)===r[1])??null:null}particleFieldPath(e){return/^particle\.[^.]+\.([A-Za-z][A-Za-z0-9]*)$/.exec(e)?.[1]??null}particleRows(e){const t=$(e.source.constructor),r={radius:"Radius",arc:"Arc",thickness:"Thickness",angle:"Angle",donutRadius:"Donut Radius",width:"Width",height:"Height",column:"Columns",row:"Rows"},n={point:[],sphere:["radius","arc","thickness"],hemisphere:["radius","arc","thickness"],cone:["radius","arc","thickness","angle"],circle:["radius","arc","thickness"],donut:["radius","arc","thickness","donutRadius"],rectangle:["width","height","thickness"],grid:["width","height","column","row"]};return[{path:this.particlePath(e,"type"),label:"Shape",type:"string",readonly:!0,group:t},...(n[e.shape.type]??[]).map(i=>({path:this.particlePath(e,i),label:r[i]??$(i),type:"number",readonly:!e.writableFields.has(i),group:t}))]}particleValue(e,t){const r=this.particleBindingForPath(e,t),n=this.particleFieldPath(t);if(!(!r||!n))return n==="type"?r.shape.type:r.shape[n]}async writeParticleField(e,t,r){const n=this.writeBackend,i=this.store.projectHistory,s=e.source.fields[t],a=this.sources.get(e.sourceFile);if(!n||!i||!s||!e.writableFields.has(t)||a===void 0||s.start<0||s.end>a.length||Number(a.slice(s.start,s.end))!==s.value)return!1;const c=Sr(t,r),l=e.shape[t];vt({binding:e,field:t,value:c}),this.store.notifyIngestEdit();const u=`${a.slice(0,s.start)}${F(c)}${a.slice(s.end)}`;try{return await B(n,i,{file:e.sourceFile,source:u,label:`Edit ${$(e.source.constructor)} ${$(t)}`}),this.sources.set(e.sourceFile,u),await this.refreshSourceState(),!0}catch(d){throw e.shape[t]=l,this.store.notifyIngestEdit(),d}}lodBindingsOf(e){const t=this.byId.get(e);if(!t)return[];const r=[];t.traverse(i=>{i.isLOD&&r.push(i)});const n=!!this.writeBackend?.readSource&&!!this.writeBackend.applySource&&!!this.store.projectHistory;return r.map((i,s)=>{const a=M(i)??_(i),c=a?this.oidIndex.get(a):void 0,l=c?.lodBinding,u=!!l?.distances&&l.distances.length===i.levels.length&&l.distances.every((h,p)=>Math.abs(h.value-i.levels[p].distance)<U),d=!!l?.hysteresis&&i.levels.every(h=>Math.abs(h.hysteresis-l.hysteresis.value)<U);return{key:a??`${e}:${s}`,...a?{sourceOid:a}:{},...c?{sourceFile:c.file}:{},...l?{source:l}:{},lod:i,writableDistances:new Set(n&&u?i.levels.map((h,p)=>p):[]),writableHysteresis:n&&d}})}lodPath(e,t){return`${Se}${encodeURIComponent(e.key)}.${t}`}lodBindingForPath(e,t){const r=/^lod\.([^.]+)\./.exec(t);if(!r)return null;const n=decodeURIComponent(r[1]);return this.lodBindingsOf(e).find(i=>i.key===n)??null}lodPreviewOption(e,t){const r=e.lod.levels[t]?.object,n=r?r.name||r.type:"";return`Level ${t}${n?` — ${n}`:""}`}lodRows(e){const t="Level of Detail",r=[{path:this.lodPath(e,"preview"),label:"Preview Level",type:"enum",options:["Auto",...e.lod.levels.map((n,i)=>this.lodPreviewOption(e,i))],group:t},{path:this.lodPath(e,"active"),label:"Active Level",type:"string",readonly:!0,group:t}];return e.lod.levels.forEach((n,i)=>{r.push({path:this.lodPath(e,`level.${i}.object`),label:`Level ${i} Object`,type:"string",readonly:!0,group:t},{path:this.lodPath(e,`level.${i}.distance`),label:`Level ${i} Distance`,type:"number",readonly:!e.writableDistances.has(i),group:t})}),e.lod.levels.length>0&&r.push({path:this.lodPath(e,"hysteresis"),label:"Hysteresis",type:"number",readonly:!e.writableHysteresis,group:t}),r}lodValue(e,t){const r=this.lodBindingForPath(e,t);if(!r)return;if(t.endsWith(".preview")){const s=this.store.getLodForcedLevel(e);return s===null?"Auto":this.lodPreviewOption(r,s)}if(t.endsWith(".active")){const s=this.store.getLodForcedLevel(e);return this.lodPreviewOption(r,s??r.lod.getCurrentLevel())}if(t.endsWith(".hysteresis"))return r.lod.levels[0]?.hysteresis;const n=/\.level\.(\d+)\.(object|distance)$/.exec(t);if(!n)return;const i=r.lod.levels[Number(n[1])];if(i)return n[2]==="distance"?i.distance:i.object.name||i.object.type||`Level ${n[1]}`}async writeLodToken(e,t,r,n,i,s){const a=this.writeBackend,c=this.store.projectHistory,l=e.sourceFile,u=l?this.sources.get(l):void 0;if(!a||!c||!l||u===void 0||t.start<0||t.end>u.length||Number(u.slice(t.start,t.end))!==t.value)return!1;i(),this.store.notifyIngestEdit();const d=`${u.slice(0,t.start)}${F(r)}${u.slice(t.end)}`;try{return await B(a,c,{file:l,source:d,label:n}),this.sources.set(l,d),await this.refreshSourceState(),!0}catch(h){throw s(),this.store.notifyIngestEdit(),h}}writeLodDistance(e,t,r){const n=e.source?.distances?.[t];if(!n||!e.writableDistances.has(t))return Promise.resolve(!1);const i=mt(e,t,r),s=e.lod.levels[t]?.distance;return this.writeLodToken(e,n,i,`Edit LOD ${t} distance`,()=>yt({binding:e,level:t,value:i}),()=>{const a=e.lod.levels[t];a&&s!==void 0&&(a.distance=s)})}writeLodHysteresis(e,t){const r=e.source?.hysteresis;if(!r||!e.writableHysteresis)return Promise.resolve(!1);const n=Math.round(Math.max(0,Math.min(1,t))*1e3)/1e3,i=e.lod.levels.map(s=>s.hysteresis);return this.writeLodToken(e,r,n,"Edit LOD hysteresis",()=>{for(const s of e.lod.levels)s.hysteresis=n},()=>{e.lod.levels.forEach((s,a)=>{s.hysteresis=i[a]??s.hysteresis})})}async writeJointParams(e,t){const r=this.writeBackend,n=this.store.projectHistory,i=this.sources.get(e.sourceFile),s=e.source.params,a=e.source.paramRanges;if(!r||!n||i===void 0||!s||!a)return!1;const c=[];if(!Tt(i,s,t,a,c)||c.length===0)return!1;c.sort((u,d)=>d.start-u.start);let l=i;for(const u of c){if(u.start<0||u.end>l.length)return!1;l=`${l.slice(0,u.start)}${u.text}${l.slice(u.end)}`}return await B(r,n,{file:e.sourceFile,source:l,label:`Edit ${$(e.source.hook.replace(/^use/,""))}`}),this.sources.set(e.sourceFile,l),await this.refreshSourceState(),!0}isOverride(e,t,r){return!e?.isLiteral||this.dynamicPaths.has(r)||!t?.optional?!1:!!this.writeBackend?.removeProp}measuredTypeFor(e,t){if(!e)return null;const r=e[t];return typeof r=="number"?"number":typeof r=="boolean"?"boolean":typeof r=="object"&&r!==null&&r.isColor?"color":null}componentProperties(e,t,r,n=en,i=null){const s=new Map(r.map(d=>[d.name,d])),a=e.declared,c=[],l=(d,h)=>{if(Zr(d)||Yr.has(d)||n.has(d))return;const p=s.get(d),f=!p&&h?.defaultText!==void 0&&h.defaultValue===void 0,g=h?.type??null,v=e.pathFor(d),x=this.isOverride(p,h,e.keyFor(d));c.push({path:v,label:$(d),type:f?"string":g??this.measuredTypeFor(i,d)??(p?this.descriptorTypeFor(p,e,d,h):"string"),...h?.options?{options:[...h.options]}:{},readonly:f||(p?!p.isLiteral:!1)||this.dynamicPaths.has(e.keyFor(d)),...p?{}:{defaulted:!0},...x?{resettable:!0}:{},...x&&h?.defaultText!==void 0?{revertsTo:h.defaultText}:{},group:t})};for(const d of a)l(d.name,d);const u=new Set(a.map(d=>d.name));for(const d of r)u.has(d.name)||l(d.name,void 0);return c}nativeEnvironmentSource(e,t){const r=M(lt(e)),n=r?this.oidIndex.get(r):void 0;return r&&n?.environmentBinding?.kind===t?{oid:r,file:n.file,binding:n.environmentBinding}:null}canWriteEnvironmentToken(e,t){if(!e||!t||!this.writeBackend?.readSource||!this.writeBackend.applySource||!this.store.projectHistory)return!1;const r=this.sources.get(e.file);if(r===void 0||t.start<0||t.end>r.length)return!1;const n=r.slice(t.start,t.end);return"quote"in t?n===`${t.quote}${t.value}${t.quote}`:Number(n)===t.value}backgroundSource(){return G(this.scene.background)?this.nativeEnvironmentSource(this.scene.background,"background-color"):null}fogSource(){return L(this.scene.fog)?this.nativeEnvironmentSource(this.scene.fog,"fog"):q(this.scene.fog)?this.nativeEnvironmentSource(this.scene.fog,"fog-exp2"):null}textureLabel(e){return e?e.isCubeTexture?e.name||"Cube Texture":e.name||"Texture":"None"}worldProperties(){const e=[{path:"name",label:"World",type:"string",readonly:!0,group:"World"},{path:"source.path",label:"Entry",type:"string",readonly:!0,group:"World"}],t=this.scene.background,r=this.backgroundSource();if(e.push({path:`${R}type`,label:"Background",type:"string",readonly:!0,group:"Environment"}),G(t)){const s=r?.binding.kind==="background-color"?r.binding.color:void 0;e.push({path:`${R}color`,label:"Background Color",type:"color",readonly:!this.canWriteEnvironmentToken(r,s),group:"Environment"})}else on(t)&&e.push({path:`${R}intensity`,label:"Background Intensity",type:"number",readonly:!0,group:"Environment"},{path:`${R}blurriness`,label:"Background Blur",type:"number",readonly:!0,group:"Environment"},{path:`${R}rotation`,label:"Background Rotation Y",type:"number",readonly:!0,group:"Environment"});e.push({path:`${W}map`,label:"Lighting Environment",type:"string",readonly:!0,group:"Environment"}),this.scene.environment&&e.push({path:`${W}intensity`,label:"Environment Intensity",type:"number",readonly:!0,group:"Environment"},{path:`${W}rotation`,label:"Environment Rotation Y",type:"number",readonly:!0,group:"Environment"});const n=this.scene.fog,i=this.fogSource();if(e.push({path:`${S}mode`,label:"Mode",type:"string",readonly:!0,group:"Fog"}),n){const s=i?.binding.color;e.push({path:`${S}color`,label:"Color",type:"color",readonly:!this.canWriteEnvironmentToken(i,s),group:"Fog"})}if(L(n)){const s=i?.binding.kind==="fog"?i.binding:void 0;e.push({path:`${S}near`,label:"Near",type:"number",readonly:!this.canWriteEnvironmentToken(i,s?.near),group:"Fog"},{path:`${S}far`,label:"Far",type:"number",readonly:!this.canWriteEnvironmentToken(i,s?.far),group:"Fog"})}else if(q(n)){const s=i?.binding.kind==="fog-exp2"?i.binding:void 0;e.push({path:`${S}density`,label:"Density",type:"number",readonly:!this.canWriteEnvironmentToken(i,s?.density),group:"Fog"})}return e}worldValue(e){const t=this.scene.background,r=this.scene.fog;if(e==="name")return this.options.worldId;if(e==="source.path")return this.options.entryPath;if(e===`${R}type`)return t?G(t)?"Color":this.textureLabel(t):"None";if(e===`${R}color`&&G(t))return`#${t.getHexString()}`;if(e===`${R}intensity`)return this.scene.backgroundIntensity;if(e===`${R}blurriness`)return this.scene.backgroundBlurriness;if(e===`${R}rotation`)return this.scene.backgroundRotation.y*180/Math.PI;if(e===`${W}map`)return this.textureLabel(this.scene.environment);if(e===`${W}intensity`)return this.scene.environmentIntensity;if(e===`${W}rotation`)return this.scene.environmentRotation.y*180/Math.PI;if(e===`${S}mode`)return L(r)?"Linear":q(r)?"Exponential":"None";if(e===`${S}color`&&r)return`#${r.color.getHexString()}`;if(e===`${S}near`&&L(r))return r.near;if(e===`${S}far`&&L(r))return r.far;if(e===`${S}density`&&q(r))return r.density}setWorldValue(e,t){const r=this.scene.background,n=this.scene.fog;if(e===`${R}color`&&G(r)){const s=this.backgroundSource(),a=s?.binding.kind==="background-color"?s.binding.color:void 0;if(typeof t!="string"||!s||!a)return!1;const c=`#${r.getHexString()}`;return this.writeEnvironmentToken(s,a,t,"Edit background color",()=>r.set(t),()=>r.set(c))}const i=this.fogSource();if(!n||!i)return!1;if(e===`${S}color`&&typeof t=="string"){const s=i.binding.color;if(!s)return!1;const a=`#${n.color.getHexString()}`;return this.writeEnvironmentToken(i,s,t,"Edit fog color",()=>n.color.set(t),()=>n.color.set(a))}if(typeof t!="number")return!1;if(e===`${S}near`&&L(n)){const s=i.binding.kind==="fog"?i.binding.near:void 0;if(!s)return!1;const a=n.near,c=Math.max(0,Math.min(t,n.far-.01));return this.writeEnvironmentToken(i,s,c,"Edit fog near",()=>{n.near=c},()=>{n.near=a})}else if(e===`${S}far`&&L(n)){const s=i.binding.kind==="fog"?i.binding.far:void 0;if(!s)return!1;const a=n.far,c=Math.max(n.near+.01,t);return this.writeEnvironmentToken(i,s,c,"Edit fog far",()=>{n.far=c},()=>{n.far=a})}else if(e===`${S}density`&&q(n)){const s=i.binding.kind==="fog-exp2"?i.binding.density:void 0;if(!s)return!1;const a=n.density,c=Math.max(0,t);return this.writeEnvironmentToken(i,s,c,"Edit fog density",()=>{n.density=c},()=>{n.density=a})}return!1}async writeEnvironmentToken(e,t,r,n,i,s){const a=this.writeBackend,c=this.store.projectHistory,l=this.sources.get(e.file);if(!a||!c||l===void 0||!this.canWriteEnvironmentToken(e,t))return!1;let u;if("quote"in t){if(typeof r!="string"||sn(r)===null)return!1;const h=r.replaceAll("\\","\\\\").replaceAll(t.quote,`\\${t.quote}`);u=`${t.quote}${h}${t.quote}`}else{if(typeof r!="number"||!Number.isFinite(r))return!1;u=F(r)}i(),this.store.notifyIngestEdit();const d=`${l.slice(0,t.start)}${u}${l.slice(t.end)}`;try{return await B(a,c,{file:e.file,source:d,label:n}),this.sources.set(e.file,d),await this.refreshSourceState(),!0}catch(h){throw s(),this.store.notifyIngestEdit(),h}}visibilityEditability(e){if(this.borrowsRepresentativeCallsite(e))return{writable:!1,reason:"This rendered part has no visibility prop of its own."};if(!this.oidOf(e))return{writable:!1,reason:"This rendered part has no authored source identity."};if(!this.writeBackend?.writeProp)return{writable:!1,reason:"This session has no source writer."};const r=this.attrsOf(e);if(!r)return{writable:!1,reason:"Source metadata is still loading or unavailable."};const n=r.find(a=>a.name==="visible"),i=this.byId.get(e);if(i&&this.isComponentBoundary(i)){const a=this.oidEntryOf(i),c=a?.r3fAuthoring;if(c?.visibleProp!==!0)return{writable:!1,reason:`${a?.tag??"This component"} does not prove that visible reaches its ${c?.rootTag??"native"} root.`}}return n?n.isLiteral?n.valueStart<0||n.isExpression&&(n.rawValue==="true"||n.rawValue==="false")?{writable:!0}:{writable:!1,reason:"visible is not exposed as a boolean JSX literal."}:{writable:!1,reason:`visible is controlled by the JSX expression {${n.rawValue}}.`}:{writable:!0}}async writeVisibility(e,t,r){const n=this.visibilityEditability(e),i=this.oidOf(e),s=this.writeBackend;if(!n.writable||!i||!s?.writeProp){const l=n.reason??"No native visibility write is available.";return console.warn(`[R3fSourceAuthoringAdapter] visibility write refused: ${l}`),j(l),!1}const a=t.visible,c=this.echoKey(e,"visible");t.visible=r,this.valueEcho.set(c,r),this.store.notifyIngestEdit();try{const l=await s.writeProp(i,"visible",this.serializeValue(r),{addIfMissing:!0});return l.changed?!0:(l.dynamic&&this.dynamicPaths.add(c),t.visible=a,this.valueEcho.delete(c),this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] visibility write refused for oid "${i}": ${l.dynamic?"dynamic expression (guarded)":l.error??"no change"} — reverting.`),!1)}catch(l){return t.visible=a,this.valueEcho.delete(c),this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] visibility write failed for oid "${i}": ${String(l)} — reverting.`),!1}}inspector={preview:(e,t,r)=>{const n=this.transformObject(e);if(!n)return;const i=Z(n,I(n),t,this.sourceLocation(e)?.tag);!i||i.type==="asset"||(T(n,I(n),i,r),this.store.notifyIngestEdit())},properties:e=>{if(e===this.documentNodeId)return this.worldProperties();const t=this.byId.get(e),r=this.transformObject(e);if(!t||!r)return[];const n=this.attrsOf(e)?.find(f=>f.name==="visible"),i=this.visibilityEditability(e),s=this.attrsOf(e)?.find(f=>f.name==="name"),a=[{path:"name",label:"Name",type:"string",readonly:!this.writeBackend?.writeProp||s?.isLiteral===!1},{path:"visible",label:"Visible",type:"boolean",readonly:!i.writable,...!i.writable&&i.reason?{readonlyReason:i.reason}:{},...n?{}:{defaulted:!0}},{path:"locked",label:"Locked",type:"boolean"}],c=Ce(r);c?.fields&&a.push(...c.fields().filter(f=>!["name","visible","locked"].includes(f.path)).map(({value:f,...g})=>g));const l=xt(r),u=[...$t(r,I(r),this.sourceLocation(e)?.tag),...l?[l]:[]],d=new Set(u.filter(f=>f.target==="self").map(f=>f.prop)),h=this.lodBindingsOf(e);h.length>0&&(d.add("distances"),d.add("hysteresis"));for(const f of h)a.push(...this.lodRows(f));const p=this.attrsOf(e);if(p){for(const w of this.collapsedWrappersOf(e))a.push(...this.componentProperties(this.wrapperSubject(w.oid),$(w.tag),this.attrsOfOid(w.oid)??[]));for(const w of this.colliderBindingsOf(e))a.push(...this.colliderDimensionRows(w)),a.push(...this.componentProperties(this.wrapperSubject(w.sourceOid),$(w.sourceTag),this.attrsOfOid(w.sourceOid)??[],new Set(["args"])));for(const w of this.jointBindingsOf(e))a.push(...this.jointRows(w));for(const w of this.particleBindingsOf(e))a.push(...this.particleRows(w));const f=this.oidEntryOf(t),g=f?.tag?$(f.tag):"Properties";this.sourceLocation(e)&&a.push({path:"source.location",label:"Source",type:"string",readonly:!0,group:g});const x=this.nodeSubject(e);x&&a.push(...this.componentProperties(x,g,p,d,r))}for(const f of u)a.push(this.typedThreeRow(e,r,f));return a},editability:(e,t)=>t==="visible"?this.visibilityEditability(e):t==="locked"?{writable:this.byId.has(e)}:{writable:!0},get:(e,t)=>{if(e===this.documentNodeId)return this.worldValue(t);const r=this.byId.get(e),n=this.transformObject(e);if(!r||!n)return;const i=this.valueEcho.get(this.echoKey(e,t));if(i!==void 0)return i;if(t==="name")return this.oidEntryOf(r)?.tag||n.name||n.type;if(t==="visible")return n.visible;if(t==="locked")return this.lockedIds.has(e);if(t==="object.type")return n.type;const s=Ce(n)?.fields?.().find(u=>u.path===t);if(s)return s.value();if(t==="source.location"){const u=this.sourceLocation(e);return u?`${u.file.split("/").slice(-2).join("/")}:${u.line}`:""}const a=Z(n,I(n),t,this.sourceLocation(e)?.tag);if(a)return this.readTypedThree(n,a);const c=this.parseColliderArgPath(t);if(c)return this.colliderArgs(c.oid)?.[c.index];if(t.startsWith(st))return this.jointValue(e,t);if(t.startsWith(at))return this.particleValue(e,t);if(t.startsWith(Se))return this.lodValue(e,t);const l=this.parseWrapperPropertyPath(t);if(l)return this.propValue(this.attrsOfOid(l.oid),this.oidIndex.get(l.oid)?.props??[],l.prop);if(t.startsWith(O)){const u=t.slice(O.length);return this.propValue(this.attrsOf(e),this.declaredPropsOf(e),u)}},set:(e,t,r)=>{if(e===this.documentNodeId)return this.pipedSourceTokenWrite(async()=>this.setWorldValue(t,r));const n=this.byId.get(e),i=this.transformObject(e);if(!n||!i)return;if(t==="visible")return this.pipedJsxWrite(()=>this.writeVisibility(e,i,!!r),void 0,this.destinationOf(e));if(t==="name"){const d=String(r??"").trim();return!d||d===i.name?void 0:this.pipedJsxWrite(()=>this.writeJsxProp(e,"name","name",d),void 0,this.destinationOf(e))}if(t==="locked"){r?this.lockedIds.add(e):this.lockedIds.delete(e),this.store.notifyIngestEdit();return}const s=Z(i,I(i),t,this.sourceLocation(e)?.tag);if(s)return s.type==="asset"?this.setTypedAsset(e,i,s,r):this.pipedJsxWrite(()=>this.writeTypedThree(e,i,s,r),void 0,this.destinationOf(e));const a=this.parseColliderArgPath(t);if(a&&typeof r=="number"){const d=this.colliderArgs(a.oid);return!d||a.index>=d.length?void 0:(d[a.index]=Math.max(.01,r),this.pipedJsxWrite(()=>this.writeOidProp(e,a.oid,`${N}${encodeURIComponent(a.oid)}.args`,"args",d),void 0,this.destinationOf(e)))}const c=this.jointParamPath(t);if(c&&typeof r=="number"){const d=this.jointBindingForPath(e,t);if(!d?.writable||!d.source.params)return;const h=d.source.params.map(f=>Array.isArray(f)?[...f]:f),p=h[c.param];if(c.part===void 0){if(typeof p!="number")return;h[c.param]=r}else{if(!Array.isArray(p)||typeof p[c.part]!="number")return;p[c.part]=r}return this.pipedSourceTokenWrite(()=>this.writeJointParams(d,h))}const l=this.particleFieldPath(t);if(l&&typeof r=="number"){const d=this.particleBindingForPath(e,t);return!d||!d.writableFields.has(l)?void 0:this.pipedSourceTokenWrite(()=>this.writeParticleField(d,l,r))}if(t.startsWith(Se)){const d=this.lodBindingForPath(e,t);if(!d)return;if(t.endsWith(".preview")){const p=typeof r=="string"?/^Level (\d+)/.exec(r):null,f=r==="Auto"?null:p?Number(p[1]):Number.NaN;(f===null||Number.isInteger(f)&&f>=0&&f<d.lod.levels.length)&&this.store.setLodForcedLevel(e,f);return}const h=/\.level\.(\d+)\.distance$/.exec(t);if(h&&typeof r=="number")return this.pipedSourceTokenWrite(()=>this.writeLodDistance(d,Number(h[1]),r));if(t.endsWith(".hysteresis")&&typeof r=="number")return this.pipedSourceTokenWrite(()=>this.writeLodHysteresis(d,r))}const u=this.parseWrapperPropertyPath(t);if(u)return this.pipedJsxWrite(()=>this.writeOidProp(e,u.oid,t,u.prop,r),void 0,this.destinationOf(e));if(t.startsWith(O))return this.pipedJsxWrite(()=>this.writeJsxProp(e,t,t.slice(O.length),r),void 0,this.destinationOf(e))},remove:(e,t)=>{const r=this.parseWrapperPropertyPath(t);if(r)return this.pipedJsxRemove(()=>this.removeOidProp(e,r.oid,t,r.prop),this.destinationOf(e));if(!t.startsWith(O))return;const n=this.oidOf(e);if(n)return this.pipedJsxRemove(()=>this.removeOidProp(e,n,t,t.slice(O.length)),this.destinationOf(e))}};spatialHandles=qr({object:e=>this.transformObject(e),sourceTag:e=>this.sourceLocation(e)?.tag,writable:(e,t)=>{const r=this.inspector.properties(e).find(n=>n.path===t);return!!r&&r.readonly!==!0},commit:(e,t,r)=>this.inspector.set(e,t,r),colliderBindings:e=>this.colliderBindingsOf(e),previewCollider:(e,t)=>this.options.physics?.()?.previewCollider?.(e,t),commitCollider:(e,t,r)=>this.pipedJsxWrite(()=>this.writeOidProp(e,t,`${N}${encodeURIComponent(t)}.args`,"args",r),void 0,this.destinationOf(e)),jointBindings:e=>this.jointBindingsOf(e),previewJointAnchor:(e,t,r)=>this.options.physics?.()?.previewJointAnchor?.(e,t,r),commitJoint:(e,t)=>this.pipedSourceTokenWrite(()=>this.writeJointParams(e,t)),particleBindings:e=>this.particleBindingsOf(e),commitParticle:(e,t,r)=>this.pipedSourceTokenWrite(()=>this.writeParticleField(e,t,r)),lodBindings:e=>this.lodBindingsOf(e),commitLodDistance:(e,t,r)=>this.pipedSourceTokenWrite(()=>this.writeLodDistance(e,t,r))});serializeValue(e){return Array.isArray(e)?K(e.map(t=>Number(t))):typeof e=="number"?F(e):typeof e=="boolean"?e?"true":"false":String(e)}propValue(e,t,r){const n=e?.find(s=>s.name===r);if(n)return this.literalValueOf(n);const i=t.find(s=>s.name===r);return i?i.defaultValue??i.defaultText:void 0}echoKey(e,t){return t.startsWith(he)?t:`${e}|${t}`}projectRelativeSourceFile(e){const t=e.replaceAll("\\","/"),r=this.options.entryPath.replaceAll("\\","/").replace(/^\.\//,"");if(!t.startsWith("/")&&!/^[A-Za-z]:\//.test(t))return t;for(const n of this.oidIndex.values()){const i=n.file.replaceAll("\\","/");if(i!==r&&!i.endsWith(`/${r}`))continue;const s=i.slice(0,-r.length);if(t.startsWith(s))return t.slice(s.length)}return r}pipedJsxRemove(e,t=this.options.entryPath){return this.pipedJsxWrite(e,this.writeBackend?.removeProp!==void 0,t)}async removeOidProp(e,t,r,n){if(!this.writeBackend?.removeProp)return console.warn(`[R3fSourceAuthoringAdapter] cannot revert "${n}": no source-write backend.`),!1;this.valueEcho.delete(this.echoKey(e,r));const i=await this.writeBackend.removeProp(t,n);return i.changed?(await this.refreshSourceState(),!0):(this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] revert refused/no-op for oid "${t}" prop "${n}": ${i.dynamic?"dynamic expression (guarded)":i.error??"no change"}`),!1)}async writeOidProp(e,t,r,n,i){if(!this.writeBackend?.writeProp)return console.warn(`[R3fSourceAuthoringAdapter] cannot write "${n}": no source-write backend.`),!1;const s=this.echoKey(e,r);this.valueEcho.set(s,i),this.store.notifyIngestEdit();let a;try{a=await this.writeBackend.writeProp(t,n,this.serializeValue(i),{addIfMissing:!0})}catch(c){return this.valueEcho.delete(s),this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] prop write failed for oid "${t}" prop "${n}": ${String(c)}`),!1}return a.changed?!0:(this.valueEcho.delete(s),a.dynamic&&this.dynamicPaths.add(s),this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] prop write refused/no-op for oid "${t}" prop "${n}": ${a.dynamic?"dynamic expression (guarded)":a.error??"no change"}`),!1)}async writeJsxProp(e,t,r,n){const i=this.oidOf(e);if(!i||!this.writeBackend?.writeProp)return console.warn(`[R3fSourceAuthoringAdapter] cannot write "${r}" on "${e}": ${i?"no source-write backend in this session":"node has no source stamp"}.`),!1;const s=`${e}|${t}`;this.valueEcho.set(s,n),this.store.notifyIngestEdit();let a;try{a=await this.writeBackend.writeProp(i,r,this.serializeValue(n),{addIfMissing:r==="name"||this.declaredPropsOf(e).some(c=>c.name===r)})}catch(c){return this.valueEcho.delete(s),this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] prop write failed for oid "${i}" prop "${r}": ${String(c)}`),!1}return a.changed?!0:(this.valueEcho.delete(s),a.dynamic&&this.dynamicPaths.add(s),this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] prop write refused/no-op for oid "${i}" prop "${r}": ${a.dynamic?"dynamic expression (guarded)":a.error??"no change"}`),!1)}typedFieldOid(e,t,r){return r.target==="material"?this.materialOidOf(t):this.oidOf(e)}propDrivingTypedField(e,t,r){if(r.target!=="material")return null;const n=this.materialOidOf(t);if(!n)return null;const i=this.attrsOfOid(n)?.find(a=>a.name===r.prop);if(!i||i.isLiteral)return null;const s=i.rawValue.trim();return/^[A-Za-z_$][\w$]*$/.test(s)&&this.declaredPropsOf(e).some(a=>a.name===s)?s:null}typedThreeRow(e,t,r){if(r.type==="asset")return{path:r.path,label:r.label,type:r.type,group:r.group,readonly:!I(t),...I(t)?{}:{readonlyReason:"This object has no material to assign a texture to."}};const n=this.typedFieldOid(e,t,r),s=(r.target==="material"?n?this.attrsOfOid(n):null:this.attrsOf(e))?.find(u=>u.name===r.prop)??null,a=this.propDrivingTypedField(e,t,r),c=(s?!s.isLiteral:!1)&&!a||this.dynamicPaths.has(`${e}|${r.path}`),l=!!n&&!!this.writeBackend?.writeProp&&!c;return{path:r.path,label:r.label,type:r.type,...r.options?{options:[...r.options]}:{},group:r.group,readonly:!l,...s?{}:{defaulted:!0}}}readTypedThree(e,t){return J(e,I(e),t)}setTypedAsset(e,t,r,n){const i=I(t),s=T(t,i,r,n);return s!==null&&(this.valueEcho.set(`${e}|${r.path}`,J(t,i,r)),this.store.notifyIngestEdit()),ie({resolve:()=>oe(s===null?`"${r.label}" has no material on "${e}" to assign to`:`a texture slot binds a loaded THREE.Texture, not a JSX attribute literal — assigning "${r.prop}" in source means adding a useTexture() binding to the component, which this adapter's attribute writer cannot author`),record:()=>{},report:a=>console.warn(`[R3fSourceAuthoringAdapter] this edit stays live-only — ${a}.`)})}async writeTypedThree(e,t,r,n){const i=this.propDrivingTypedField(e,t,r);if(i){const h=I(t),p=J(t,h,r),f=T(t,h,r,n);if(f===null)return!1;this.store.notifyIngestEdit();const g=await this.writeJsxProp(e,`${O}${i}`,i,f);return!g&&p!==null&&p!==void 0&&(T(t,h,r,p),this.store.notifyIngestEdit()),g}const s=this.typedFieldOid(e,t,r),a=I(t);if(!s||!this.writeBackend?.writeProp)return console.warn(`[R3fSourceAuthoringAdapter] cannot write "${r.path}" on "${e}": ${s?"no source-write backend in this session":"no source stamp for this field"}.`),!1;const c=J(t,a,r),l=T(t,a,r,n);if(l===null)return!1;const u=`${e}|${r.path}`;this.valueEcho.set(u,J(t,a,r)),this.store.notifyIngestEdit();let d;try{d=await this.writeBackend.writeProp(s,r.prop,this.serializeValue(l),{addIfMissing:!0})}catch(h){return this.valueEcho.delete(u),await this.refreshSourceState(),this.store.notifyIngestEdit(),console.warn(`[R3fSourceAuthoringAdapter] typed "${r.prop}" write failed for oid "${s}": ${String(h)}`),!1}return d.changed||d.dynamic&&this.declaredPropsOf(e).some(h=>h.name===r.prop)&&(this.valueEcho.delete(u),await this.writeJsxProp(e,`${O}${r.prop}`,r.prop,l))?!0:(this.valueEcho.delete(u),d.dynamic&&this.dynamicPaths.add(u),c!=null&&T(t,a,r,c),this.store.notifyIngestEdit(),Pe.warn(`“${r.prop}” on “${this.hierarchy.node(e)?.label??e}” is ${d.dynamic?"bound to an expression in the component’s own source, so a direct edit cannot land — the preview was reverted. Edit the prop that drives it (or the component source) instead.":`not writable here (${d.error??"no change"}) — the preview was reverted.`}`,"editor"),!1)}structureClipboardPayload(e){const t=new Set(e),r=[...new Set(e)].filter(l=>{let u=this.hierarchy.node(l)?.parentId??null;for(;u;){if(t.has(u))return!1;u=this.hierarchy.node(u)?.parentId??null}return!0}),n=[],i=new Set;for(const l of r){const u=this.oidOf(l);if(!u||i.has(u))continue;i.add(u);const d=this.oidIndex.get(u),h=d?this.sources.get(d.file):void 0;if(!d||h===void 0)return null;const p=H(h,d.line,d.col),f=zt(h,p);if(h[p]!=="<"||f<=p)return null;const g=h.slice(h.lastIndexOf(`
7
- `,p-1)+1,p),v=h.slice(p,f),x=/^\s*$/.test(g)?v.split(`
8
- `).map((w,te)=>te>0&&w.startsWith(g)?w.slice(g.length):w).join(`
9
- `):v;n.push({file:d.file,offset:p,text:x})}if(n.length===0)return null;const s=n[0].file;if(n.some(l=>l.file!==s))return null;n.sort((l,u)=>l.offset-u.offset);const a=this.transformObject(r[0]??""),c=a?new Me().setFromObject(a).getSize(new m).x:Number.NaN;return{sourceFile:s,text:n.map(l=>l.text).join(`
10
- `),count:n.length,pasteOffset:[Number.isFinite(c)&&c>0?c+.5:1.5,0,0]}}refuseStructureClipboard(e){return console.warn(`[R3fSourceAuthoringAdapter] ${e}`),j(e),!1}async copyStructure(e){this.structureClipboard=null;const t=this.structureClipboardPayload(e);if(!t)return this.refuseStructureClipboard("Copy needs source-addressable entities from one source file. Generated or cross-file selections stay unchanged.");const r=globalThis.navigator?.clipboard;if(!r?.writeText)return this.refuseStructureClipboard("The system clipboard is unavailable, so no entities were copied.");try{await r.writeText(t.text)}catch{return this.refuseStructureClipboard("The system clipboard refused the entity copy.")}return this.structureClipboard=t,j(`Copied ${t.count} ${t.count===1?"entity":"entities"}.`),!0}async cutStructure(e){return await this.copyStructure(e)?Re(await this.removeMany(e)):!1}clipboardPasteTarget(e){if(!e||e===this.documentNodeId){const i=this.topLevelEntryElements(),s=i.at(-1)??null,a=s?this.oidOf(s):null,c=a?this.oidIndex.get(a):void 0;if(!s||!a||!c)return null;const l=this.topLevelInstanceDefinitionRoot(s);if(l&&this.childrenSlotForOid(l.oid)==="open"){const d=this.sceneDropAnchor(l);return d?{id:s,oid:d,file:l.file,op:"create-sibling"}:{id:s,oid:l.oid,file:l.file,op:"create"}}const u=i.length===1&&this.childrenSlotForOid(a)==="open"?"create":i.length>1?"create-sibling":null;return u?{id:s,oid:a,file:c.file,op:u}:null}const t=this.definitionOid(e)??this.oidOf(e),r=t?this.oidIndex.get(t):void 0;if(!t||!r||this.childrenSlotForOid(t)!=="open")return null;const n=this.definitionOid(e);if(n){const i=this.sceneDropAnchor({oid:n,file:r.file});if(i)return{id:e,oid:i,file:r.file,op:"create-sibling"}}return{id:e,oid:t,file:r.file,op:"create"}}canPasteStructure(e){const t=this.structureClipboard,r=this.clipboardPasteTarget(e);return!!t&&!!r&&r.file===t.sourceFile}async pasteStructure(e){const t=this.structureClipboard;if(!t)return this.refuseStructureClipboard("Copy or cut an entity in this scene before pasting.");const r=globalThis.navigator?.clipboard;if(!r?.readText)return this.refuseStructureClipboard("The system clipboard is unavailable, so nothing was pasted.");try{const s=a=>a.replace(/\r\n/g,`
11
- `);if(s(await r.readText())!==s(t.text))return this.refuseStructureClipboard("The clipboard changed after the entity copy, so nothing was pasted.")}catch{return this.refuseStructureClipboard("The system clipboard refused the entity paste.")}const n=this.clipboardPasteTarget(e);if(!n)return this.refuseStructureClipboard("Paste needs a source-addressable parent with a children slot.");if(n.file!==t.sourceFile)return this.refuseStructureClipboard("Cross-file paste is refused because the destination may not import the copied component dependencies.");const i=t.pasteOffset?Jt(t.text,t.pasteOffset):t.text;return this.recordPendingCreatedSelection(n.op==="create"?n.id:this.hierarchy.node(n.id)?.parentId??this.documentNodeId),Re(await this.structOp(n.id,n.op,{snippet:i},n.oid))}structure={create:(e,t)=>{const r=ut[e];if(!r||!t)return{id:"",ack:this.structRefusal(`create refused: ${r?"no parent node given":`unknown preset kind "${e}"`}.`)};const n=this.definitionOid(t),i=n??this.oidOf(t),s=i?this.oidIndex.get(i)?.file:void 0,a=this.structOp(t,"create",{snippet:r,...e==="reflectionProbe"?{ensureImport:{name:"ReflectionProbe",module:Vt(s?this.projectRelativeSourceFile(s):this.options.entryPath,"src/lib/reflections")}}:{}},i),c=this.byId.get(t);if(!(this.options.hierarchyMode!=="definition"&&n!==void 0&&e!=="reflectionProbe"&&!(c&&this.insideTransparentTopLevel(c))))return{id:"",ack:a};const u=this.hierarchy.node(t)?.label??t,d=ht[e]??e,h=s?this.projectRelativeSourceFile(s):void 0;return{id:"",ack:a.then(p=>(p.persisted&&Pe.warn(`Added ${d} inside ${u}'s definition${h?` (${h})`:""}. This hierarchy folds ${u}'s own elements under it, so the new ${d} cannot be selected here yet — edit it in ${h??"that file"} (right-click ${u} → Open Component Source).`,"authoring"),p))}},creatableKinds:e=>{if(!e||e===this.documentNodeId)return[];const t=this.definitionOid(e)??this.oidOf(e);return!t||this.childrenSlotForOid(t)!=="open"?[]:Object.keys(ut).filter(r=>r!=="reflectionProbe"||this.reflectionProbeAvailable).map(r=>({kind:r,label:ht[r]??r}))},wrap:(e,t)=>this.structOp(e,"wrap",{wrapperTag:t??"group"}),unwrap:e=>this.structOp(e,"unwrap"),group:e=>{const t=[...new Set(e)];if(t.length<2||!this.writeBackend?.writeStructMany)return{id:null,ack:void 0};const r=t.map(i=>this.hierarchy.node(i)),n=r[0]?.parentId;return!n||r.some(i=>!i||i.parentId!==n)||t.some(i=>!this.oidOf(i))?{id:null,ack:this.structRefusal("group requires two or more source-addressable siblings.")}:{id:"",ack:this.groupMany(t)}},canUngroup:e=>{const t=this.byId.get(e),r=t?this.oidEntryOf(t):null;return!!(t&&r?.tag==="group"&&!this.isComponentBoundary(t)&&this.hierarchy.node(e)?.childIds.length)},ungroup:e=>this.structure.canUngroup?.(e)?{ids:[...this.hierarchy.node(e)?.childIds??[]],ack:this.structOp(e,"unwrap")}:{ids:[],ack:void 0},remove:e=>this.dropSelectionOnRemoval([e],this.structOp(e,"delete")),removeMany:e=>this.dropSelectionOnRemoval(e,this.removeMany(e)),copy:e=>this.copyStructure(e),canCopy:e=>this.structureClipboardPayload(e)!==null,cut:e=>this.cutStructure(e),paste:e=>this.pasteStructure(e),canPaste:e=>this.canPasteStructure(e),duplicate:e=>(this.recordPendingCreatedSelection(this.hierarchy.node(e)?.parentId??this.documentNodeId,e),{id:e,ack:this.structOp(e,"duplicate",{duplicate:this.duplicateRewrite(e)})}),reparent:(e,t)=>{const r=t?this.topLevelInstanceDefinitionRoot(t)?.oid??this.oidOf(t):null;if(!r)return this.refuseReparent(t?"That row has no authored source element to move into.":"The world root is not an authored source element — drop onto a row instead.");const n=this.reparentContext(e,t);return"error"in n?this.refuseReparent(n.error):this.reparentThrough(e,r,n)},reorder:(e,t)=>{const r={};if(t){const n=this.oidOf(t);if(!n)return this.structRefusal("reorder target has no source stamp — refused.");r.targetOid=n}else{const n=this.hierarchy.node(e),i=n?.parentId?this.oidOf(n.parentId):null;if(!i)return this.structRefusal("reorder-to-end needs a source-addressable parent — refused.");r.parentOid=i}return this.structOp(e,"reorder",r)}};assetDrop={accepts:(e,t,r)=>{const n=r?.item?.kind==="component"?r.item:null;return n&&this.ensureComponentPropSpecs(n),this.assetDropPlan(e,t,r).ok},drop:async(e,t,r)=>{const n=r?.item?.kind==="component"?r.item:null;if(n){await this.ensureComponentPropSpecs(n);const c=this.unsuppliedRequiredProps(n);if(c.length>0){const l=`${n.name} needs ${c.map(u=>`\`${u.name}\``).join(", ")} — required props with no default, which a drop cannot supply. Place it from a story that provides them, or give them defaults in ${n.sourcePath}.`;console.warn(`[R3fSourceAuthoringAdapter] asset drop refused — ${l}`),j(l);return}}const i=this.assetDropPlan(e,t,r);if(!i.ok){console.warn(`[R3fSourceAuthoringAdapter] asset drop refused — ${i.reason}`),j(i.reason);return}const s=i.op==="create-sibling"?this.idForOid(i.sourceOid):null,a=s?this.hierarchy.node(s)?.parentId??i.parentId:i.parentId;return this.recordPendingCreatedSelection(a,s??void 0),this.structOp(i.parentId,i.op,{snippet:i.snippet,ensureImport:i.ensureImport},i.sourceOid??null)}};idForOid(e){if(!e)return null;const t=this.oidRepresentative.get(e);return t?this.idByObject.get(t)??null:null}assetDropPlan(e,t,r){if(!this.writeBackend)return{ok:!1,reason:"This session has no source writer, so nothing can be added."};const n=r?.item?.kind==="component"?r.item:null;if(n&&n.surface!=="three")return{ok:!1,reason:`${n.name} is a ${n.surface} component, not a Three prefab.`};if(!n&&!Ct.test(t))return{ok:!1,reason:`${t} is not a .glb/.gltf model. A three world mounts models as scene nodes; an image or an audio file has no element to become here — a texture belongs on a material, not in the hierarchy.`};const i=c=>n?this.componentSnippet(n.name,r,c):this.modelSnippet(t,r,c);if(e===""||e===this.documentNodeId){const c=this.lastTopLevelEntryElement();if(!c)return{ok:!1,reason:`No top-level element of this world is authored in ${this.options.entryPath}, so there is nowhere to append the model — drop it onto a hierarchy row instead.`};const l=this.topLevelInstanceDefinitionRoot(c);if(l&&this.childrenSlotForOid(l.oid)==="open"){const u=this.sceneDropAnchor(l);return{ok:!0,parentId:c,op:u?"create-sibling":"create",snippet:i(c),sourceOid:u??l.oid,ensureImport:n?this.componentImport(c,n,l.file):{name:X,module:pe}}}return{ok:!0,parentId:c,op:"create-sibling",snippet:i(this.documentNodeId),ensureImport:n?this.componentImport(c,n):{name:X,module:pe}}}if(!this.oidOf(e))return{ok:!1,reason:"That row has no authored source element to add the model to."};const s=this.topLevelInstanceDefinitionRoot(e);if(s){const c=this.childrenSlotForOid(s.oid);if(c!=="open")return{ok:!1,reason:c==="unknown"?"That component's source file has not loaded yet — try the drop again in a moment.":`${this.hierarchy.node(e)?.label??"That component"}'s root element is written self-closing, so nothing can be authored inside it.`};const l=this.sceneDropAnchor(s);return{ok:!0,parentId:e,op:l?"create-sibling":"create",snippet:i(e),sourceOid:l??s.oid,ensureImport:n?this.componentImport(e,n,s.file):{name:X,module:pe}}}const a=this.childrenSlot(e);return a==="unknown"?{ok:!1,reason:"That row's source file has not loaded yet — try the drop again in a moment."}:a==="self-closing"?{ok:!1,reason:`<${this.hierarchy.node(e)?.label??"That element"}> is written self-closing, so it has no children slot to put the model in. Drop onto a row that wraps its children, or onto the viewport.`}:{ok:!0,parentId:e,op:"create",snippet:i(e),ensureImport:n?this.componentImport(e,n):{name:X,module:pe}}}uniqueSiblingName(e,t){const r=new Set((t?this.hierarchy.node(t)?.childIds??[]:[]).map(i=>this.hierarchy.node(i)?.label).filter(i=>typeof i=="string"));let n=e;for(let i=2;r.has(n);i++)n=`${e} ${i}`;return n}componentSnippet(e,t,r){const n=this.uniqueSiblingName(e,r),i=t?.item?.kind==="component"?t.item:null,s=` name=${JSON.stringify(n)}`+(t?.position?` position={${K(t.position)}}`:"")+(i?this.requiredEnumDefaults(i):"");return`<${e}${s} />`}componentPropSpecs=new Map;componentPropSpecsPending=new Map;componentSpecKey(e){return`${e.sourcePath}::${e.exportKind}:${e.name}`}ensureComponentPropSpecs(e){const t=this.componentSpecKey(e);if(this.componentPropSpecs.has(t))return Promise.resolve();const r=this.componentPropSpecsPending.get(t);if(r)return r;const n=this.writeBackend?.componentProps;if(!n)return this.componentPropSpecs.set(t,null),Promise.resolve();const i=n(this.projectRelativeSourceFile(e.sourcePath),{name:e.name,exportKind:e.exportKind}).then(s=>{this.componentPropSpecs.set(t,s)}).catch(s=>{console.warn(`[R3fSourceAuthoringAdapter] declared props of ${e.name} unavailable — ${s instanceof Error?s.message:String(s)}`),this.componentPropSpecs.set(t,null)}).finally(()=>{this.componentPropSpecsPending.delete(t)});return this.componentPropSpecsPending.set(t,i),i}unsuppliedRequiredProps(e){const t=this.componentPropSpecs.get(this.componentSpecKey(e));return t?t.filter(r=>!r.optional&&r.defaultText===void 0&&r.type!=="enum"&&!dt.has(r.name)):[]}requiredEnumDefaults(e){const t=this.componentPropSpecs.get(this.componentSpecKey(e));if(!t)return"";let r="";for(const n of t){if(n.optional||n.defaultText!==void 0||n.type!=="enum"||dt.has(n.name))continue;const i=n.options?.[0];i!==void 0&&(r+=typeof i=="string"?` ${n.name}=${JSON.stringify(i)}`:` ${n.name}={${i}}`)}return r}sceneDropAnchor(e){let t=null;for(const n of this.sceneInstancesByParent(e).values())(!t||n.length>t.length)&&(t=n);if(!t)return null;let r=t[0];for(const n of t)(n.line>r.line||n.line===r.line&&n.col>r.col)&&(r=n);return r.oid}sceneInstancesByParent(e){const t=this.oidIndex.get(e.oid)?.component??null,r=new Map;for(const[n,i]of this.oidIndex){if(i.file!==e.file||t!==null&&i.component!==t||!/^[A-Z]/.test(i.tag)||n===e.oid)continue;const s=r.get(i.parentOid??"")??[];s.push({oid:n,line:i.line,col:i.col}),r.set(i.parentOid??"",s)}return r}topLevelInstanceDefinitionRoot(e){const t=this.byId.get(e);if(!t||!re(t)||this.componentOwnerChain(t).length>1)return null;const r=this.definitionOid(e),n=r?this.oidIndex.get(r)?.file:void 0;return r&&n?{oid:r,file:n}:null}componentImport(e,t,r){const n=r??this.sourceLocation(e)?.file??this.options.entryPath;return{name:t.name,module:this.relativeProjectModule(n,t.sourcePath),kind:t.exportKind}}relativeProjectModule(e,t){const n=this.projectRelativeSourceFile(e).split("/").slice(0,-1),i=ve(this.projectRelativeSourceFile(t)).replace(/\.[cm]?[jt]sx?$/,"").split("/");for(;n[0]&&n[0]===i[0];)n.shift(),i.shift();const s=[...n.map(()=>".."),...i].join("/");return s.startsWith(".")?s:`./${s}`}modelSnippet(e,t,r){const n=[`name="${ot(this.uniqueSiblingName(tn(e),r))}"`];return t?.position&&n.push(`position={${K(t.position)}}`),`<group ${n.join(" ")}>
12
- <${X} src="${ot(e)}" />
13
- </group>`}lastTopLevelEntryElement(){return this.topLevelEntryElements().at(-1)??null}topLevelEntryElements(){const e=ve(this.options.entryPath),t=[];for(const r of this.hierarchy.node(this.documentNodeId)?.childIds??[]){const n=this.oidOf(r),i=n?this.oidIndex.get(n):void 0;if(!i||ve(i.file)!==e)continue;const s=this.sources.get(i.file);if(s===void 0)continue;const a=H(s,i.line,i.col);s[a]==="<"&&t.push({id:r,offset:a})}return t.sort((r,n)=>r.offset-n.offset),t.map(r=>r.id)}childrenSlot(e){const t=this.oidOf(e);return t?this.childrenSlotForOid(t):"unknown"}childrenSlotForOid(e){const t=this.oidIndex.get(e);if(!t)return"unknown";const r=this.sources.get(t.file);if(r===void 0)return"unknown";const n=H(r,t.line,t.col);if(r[n]!=="<")return"unknown";const i=me(r,n);return i<0?"unknown":r[i-1]==="/"?"self-closing":"open"}refuseReparent(e){return this.structRefusal(`reparent refused — ${e}`,e)}reparentContext(e,t){const r=this.liveInstanceCount(t),n=this.liveInstanceCount(e),i={...r===void 0?{}:{destinationInstances:r},...n===void 0?{}:{sourceInstances:n}},s=this.transformObject(e),a=this.byId.get(t);if(!s||!a)return i;s.updateWorldMatrix(!0,!1),a.updateWorldMatrix(!0,!1);const c=a.matrixWorld.clone().invert().multiply(s.matrixWorld),l=s.position.clone(),u=s.quaternion.clone(),d=s.scale.clone();c.decompose(l,u,d);const h=s.rotation.clone().setFromQuaternion(u,s.rotation.order),p=[["position",l.toArray(),s.position.toArray()],["rotation",[h.x,h.y,h.z],[s.rotation.x,s.rotation.y,s.rotation.z]],["scale",d.toArray(),s.scale.toArray()]],f={};for(const[v,x,w]of p){if(this.nearlyEqual(x,w))continue;const te=this.transformEditability(e,v);if(!te.writable)return{error:`Moving this changes its world ${v}, so the move would have to rewrite ${v} — but ${te.reason??`${v} is not writable here.`}`};f[v]=x}const g=Object.keys(f).length>0;return{...i,...g?{rebase:f}:{}}}reparentThrough(e,t,r){const n=this.oidOf(e);return n?this.structPipe.pipedStruct(async()=>{const i=await this.writeBackend.writeStruct(n,"reparent",{parentOid:t,...r});return i.changed?(i.warning&&j(i.warning),this.store.notifyIngestEdit(),!0):(this.refuseReparent(i.error??"The move produced no source change."),!1)},"reparent",this.writeBackend?.writeStruct!==void 0,this.destinationOf(e)):this.refuseReparent("This row has no authored source element to move.")}structPipe=Ut({report:e=>console.warn(`[R3fSourceAuthoringAdapter] ${e}`),noWriterReason:de,backend:()=>this.writeBackend,onChanged:()=>this.store.notifyIngestEdit()});pendingDuplicateLabels=new Set;pendingDuplicateCounts=new Map;duplicateRewrite(e){const t=this.hierarchy.node(e),r={};if(t){const i=t.label.replace(/ \d+$/,""),s=new Set((t.parentId?this.hierarchy.node(t.parentId)?.childIds??[]:[]).map(c=>this.hierarchy.node(c)?.label).filter(c=>typeof c=="string"));let a=2;for(;s.has(`${i} ${a}`)||this.pendingDuplicateLabels.has(`${i} ${a}`);)a++;r.name=`${i} ${a}`,this.pendingDuplicateLabels.add(r.name)}const n=this.transformObject(e);if(n){const i=new Me().setFromObject(n).getSize(new m),s=Number.isFinite(i.x)&&i.x>0?i.x:1,a=(this.pendingDuplicateCounts.get(e)??0)+1;this.pendingDuplicateCounts.set(e,a),r.positionOffset=[(s+.5)*a,0,0]}return r}structOp(e,t,r,n){return this.structPipe.structOp(n??this.oidOf(e),e,t,r,this.destinationOf(e))}dropSelectionOnRemoval(e,t){const r=new Set(e);return[...this.store.selectedEntityIds].some(i=>r.has(i))&&this.store.selectMultiple([]),t}async removeMany(e){const t=[...new Set(e.map(r=>this.oidOf(r)).filter(r=>!!r))];if(t.length===0||!this.writeBackend?.writeStructMany){let r=_t;for(const n of e)r=await this.structOp(n,"delete");return r}return this.structPipe.structMany(t,"delete",void 0,this.destinationOf(e[0]??""))}groupMany(e){const t=e.map(r=>this.oidOf(r)).filter(r=>!!r);return this.structPipe.structMany(t,"group",void 0,this.destinationOf(e[0]??""))}structRefusal(e,t){return this.structPipe.structRefusal(e,t)}subscribe(e){return this.store.subscribe(e)}get documentId(){return this.documentNodeId}}const pt=new Set;function un(o){pt.has(o)||(pt.add(o),Pe.warn(`Element "${o}" has no source metadata — added by hot reload, so the OID index does not cover it until the editor page reloads. Its Inspector fields refuse writes until then; reload the page to author it.`))}export{Cn as R3fSourceAuthoringAdapter};
@@ -1 +0,0 @@
1
- import{a as n}from"./jsx-runtime-DPjLkJKQ.js";import{e7 as ye,e8 as ne,e9 as xe,ea as be,eb as je,ec as Se,b0 as ve,ed as Ce,ee as Re,ef as ke,eg as we,eh as Ee,ei as m,dP as u,dR as j,a4 as k,ej as M,ek as $e,el as H,em as V,aY as B,dW as Te,bo as Y,en as se,eo as Ie,ep as Ne,aV as Ae,aA as ie,eq as Me,er as Oe}from"./index-GIL7oGEO.js";import{r as v}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{p as re,G as ae,c as A,B as Be,A as Fe,S as O,a as De,b as _e,F as Le,d as J,e as ze,f as Pe,T as We,g as X,h as Ge,C as He,i as Ue,j as Ve}from"./ShadowEditor-DkImwu1Y.js";import{s as oe,a as U,b as Ke}from"./board-guides-DziKSTss.js";import{b as Ye}from"./eyedropper-session-bjPXnfeX.js";import{l as Je,m as Xe}from"./inspect-BZfi3mmo.js";import{D as qe}from"./dom-authoring-adapter-CY8C7f4T.js";import{R as _,c as Qe}from"./react-world-authoring-adapter-DmrwM3py.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-D396a9Mn.js";import"./inference-diagnostics-Dhmtfbq_.js";import"./json-history-resource-BbxllWfV.js";import"./writer-B-KovzkA.js";import"./story-arg-descriptors-Ek86ExX7.js";function le(e,t){if(!e)return null;const s=(()=>{if(!(t instanceof Ee))return t;const i=t.ownerOf(e.id);return i===null?null:t.childAdapters().find(a=>a.worldId===i)?.adapter??null})();return s instanceof _||s instanceof qe?s:null}const Ze=(e,t)=>le(e,t)!==null,et="element",tt=1500,nt="story",st=1600;function T(e){const t=e.indexOf(".");return t===-1?e:e.slice(t+1)}function it(e){const t=T(e.path);return e.type==="color"?"color":/^fontFamily$/i.test(t)?"font":t==="background"||t==="backgroundImage"?"gradient":t==="boxShadow"?"shadow":t==="textShadow"?"text-shadow":t==="filter"?"filter":t==="backdropFilter"?"backdrop-filter":t==="borderRadius"?"radius":e.type==="string"&&t==="transform"?"transform":e.type==="boolean"?"checkbox":e.type==="enum"?"select":e.type==="json"?"json":e.type==="number"?"scrub":"text"}function rt(e,t,s,i){if(!(e.path==="style.borderWidth"||e.path==="style.borderStyle"||e.path==="style.borderColor"))return!1;const o=t.get("style.borderWidth"),c=t.get("style.borderStyle"),r=t.get("style.borderColor");return!o||!c||!r?!1:(i.push({kind:"border",width:o,style:c,color:r}),s.add(o.path),s.add(c.path),s.add(r.path),!0)}function at(e,t,s,i){if(!(e.path==="style.justifyContent"||e.path==="style.alignItems"))return!1;const o=t.get("style.justifyContent"),c=t.get("style.alignItems");return!o||!c?!1:(i.push({kind:"align",justify:o,align:c}),s.add(o.path),s.add(c.path),!0)}function ce(e){const t=new Map(e.map(a=>[a.path,a])),s=new Set,i=[];for(const a of e)s.has(a.path)||rt(a,t,s,i)||at(a,t,s,i)||i.push({kind:"single",prop:a});return i}function L(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function F(e){return`react-prop-${e.replace(/\./g,"-")}`}const de={type:"linear",angle:180,stops:[{color:"#ffffff",position:0},{color:"#000000",position:1}]};function w({label:e,testId:t,children:s}){return n.jsxs("div",{"data-testid":t?`${t}-row`:void 0,style:{...Me,padding:`${u[2]} ${u[4]}`},children:[n.jsx("span",{style:{width:Oe,flexShrink:0,fontSize:j.base,color:m.textMuted},children:e}),n.jsx("div",{style:{flex:1,minWidth:0},children:s})]})}function ot({prop:e,raw:t,disabled:s,testId:i,commit:a}){return n.jsx(w,{label:e.label,testId:i,children:n.jsx(He,{testId:i,value:String(t??"#ffffff"),disabled:s,onChange:o=>a(e.path,o),onChangeEnd:o=>a(e.path,o),eyedropperFallback:()=>Xe([String(t??"")]),onEyedropperPick:o=>Ye(o)})})}function lt({prop:e,raw:t,disabled:s,fonts:i,testId:a,commit:o}){return n.jsx(w,{label:e.label,testId:a,children:n.jsx(Ge,{testId:a,value:String(t??""),fonts:i,disabled:s,onChange:c=>o(e.path,c)})})}function ct({prop:e,raw:t,disabled:s,testId:i,commit:a}){const o=re(String(t??"none"));return o?n.jsx(w,{label:e.label,testId:i,children:n.jsx(ae,{testId:i,value:o,disabled:s,onChange:c=>a(e.path,A(c)),onChangeEnd:c=>a(e.path,A(c))})}):n.jsx(w,{label:e.label,testId:i,children:n.jsx(k,{type:"button",variant:"secondary",className:"vgai-field-trigger","data-testid":i,disabled:s,onClick:()=>a(e.path,A(de)),children:"No gradient — click to add"})})}function q({prop:e,raw:t,disabled:s,testId:i,commit:a,withSpreadInset:o}){const c=ze(String(t??"none"),o),r=o?Pe:We;return n.jsx(w,{label:e.label,testId:i,children:n.jsx(r,{value:c,disabled:s,onChange:l=>a(e.path,X(l,o)),onChangeEnd:l=>a(e.path,X(l,o))})})}function Q({prop:e,raw:t,disabled:s,testId:i,commit:a,label:o}){const c=_e(String(t??"none"));return n.jsx(w,{label:e.label,testId:i,children:n.jsx(Le,{testId:i,label:o,value:c,disabled:s,onChange:r=>a(e.path,J(r)),onChangeEnd:r=>a(e.path,J(r))})})}const G=[{key:"topLeft",suffix:"TopLeft"},{key:"topRight",suffix:"TopRight"},{key:"bottomLeft",suffix:"BottomLeft"},{key:"bottomRight",suffix:"BottomRight"}];function dt({adapter:e,id:t,prop:s,raw:i,disabled:a,testId:o,commit:c,removeStyle:r}){const l=L(i),d=G.reduce((g,{key:f,suffix:S})=>{const x=e.inspector?.get(t,`style.border${S}Radius`);return g[f]=ie(x)??l,g},{}),y=g=>{if(Ve(g)){c(s.path,g.topLeft);for(const{suffix:f}of G)r(`style.border${f}Radius`);return}for(const{key:f,suffix:S}of G)c(`style.border${S}Radius`,g[f])};return n.jsx(w,{label:s.label,testId:o,children:n.jsx(De,{value:d,disabled:a,onChange:y,onChangeEnd:y})})}function ut({prop:e,raw:t,disabled:s,testId:i,commit:a}){const o=se.has(T(e.path))?"":"px";return n.jsx(O,{testId:i,label:e.label,value:L(t),unit:o,disabled:s,onChange:c=>a(e.path,c),onChangeEnd:c=>a(e.path,c),style:{padding:`${u[2]} ${u[4]}`}})}function pt({prop:e,raw:t,disabled:s,testId:i,commit:a}){return n.jsx(w,{label:e.label,testId:i,children:n.jsx(V,{"data-testid":i,value:String(t??""),disabled:s,"data-dynamic":s||void 0,onChange:o=>a(e.path,o.target.value),style:{width:"100%"},children:(e.options??[]).map(o=>n.jsx("option",{value:String(o),children:String(o)},String(o)))})})}function gt({prop:e,raw:t,disabled:s,testId:i,commit:a}){return n.jsxs("label",{style:{display:"flex",gap:u[3],alignItems:"center",padding:`${u[3]} ${u[4]}`,fontSize:j.md},children:[n.jsx(Ae,{className:"vgai-checkbox","data-testid":i,checked:t!==!1,disabled:s,onChange:o=>a(e.path,o.target.checked)}),e.label]})}function ht({prop:e,raw:t,disabled:s,testId:i,commit:a}){return n.jsx(w,{label:e.label,testId:i,children:n.jsx(Ne,{"data-testid":i,defaultValue:JSON.stringify(t??null),disabled:s,"data-dynamic":s||void 0,"data-variant":"code",style:{width:"100%",minHeight:40},onBlur:o=>{try{a(e.path,JSON.parse(o.target.value))}catch{}}})})}function ue({prop:e,raw:t,disabled:s,testId:i,commit:a}){return n.jsx(w,{label:e.label,testId:i,children:n.jsx(Ie,{type:"text","data-testid":i,readOnly:s,"data-dynamic":s||void 0,value:String(t??""),onCommit:o=>a(e.path,o),style:{width:"100%"}})})}const ft=/^rotate\(\s*(-?[\d.]+)deg\s*\)\s*scale\(\s*(-?[\d.]+)\s*\)$/i,mt=/^scale\(\s*(-?[\d.]+)\s*\)\s*rotate\(\s*(-?[\d.]+)deg\s*\)$/i,yt=/^rotate\(\s*(-?[\d.]+)deg\s*\)$/i,xt=/^scale\(\s*(-?[\d.]+)\s*\)$/i,bt=/^matrix\(\s*(-?[\d.eE+-]+)\s*,\s*(-?[\d.eE+-]+)\s*,\s*(-?[\d.eE+-]+)\s*,\s*(-?[\d.eE+-]+)\s*,\s*(-?[\d.eE+-]+)\s*,\s*(-?[\d.eE+-]+)\s*\)$/,D=1e-4;function jt(e){const t=e.trim();if(t===""||t==="none")return{rotateDeg:0,scale:1};const s=ft.exec(t);if(s)return{rotateDeg:Number(s[1]),scale:Number(s[2])};const i=mt.exec(t);if(i)return{rotateDeg:Number(i[2]),scale:Number(i[1])};const a=yt.exec(t);if(a)return{rotateDeg:Number(a[1]),scale:1};const o=xt.exec(t);if(o)return{rotateDeg:0,scale:Number(o[1])};const c=bt.exec(t);if(!c)return null;const[r,l,d,y,g,f]=c.slice(1,7).map(Number);if(Math.abs(g)>D||Math.abs(f)>D||Math.abs(d+l)>D||Math.abs(y-r)>D)return null;const S=Math.hypot(r,l);if(S<D)return null;const x=Math.atan2(l,r)*180/Math.PI;return{rotateDeg:Math.round(x*100)/100,scale:Math.round(S*1e3)/1e3}}function St(e){return`rotate(${e.rotateDeg}deg) scale(${e.scale})`}function vt(e){const{prop:t,raw:s,disabled:i,testId:a,commit:o}=e,c=jt(String(s??"none"));if(!c)return n.jsx(ue,{...e});const r=l=>o(t.path,St(l));return n.jsx(w,{label:t.label,testId:a,children:n.jsxs("div",{style:{display:"flex",gap:u[3]},children:[n.jsx(O,{testId:`${a}-rotate`,label:"Rotate",value:c.rotateDeg,unit:"deg",disabled:i,onChange:l=>r({...c,rotateDeg:l}),onChangeEnd:l=>r({...c,rotateDeg:l}),style:{flex:1}}),n.jsx(O,{testId:`${a}-scale`,label:"Scale",value:c.scale,unit:"x",step:.1,disabled:i,onChange:l=>r({...c,scale:l}),onChangeEnd:l=>r({...c,scale:l}),style:{flex:1}})]})})}function $({adapter:e,id:t,prop:s,fonts:i}){const a=B(),o=(l,d)=>{e.inspector?.set(t,l,d),a.notifyIngestEdit()},c=l=>{e.inspector?.remove?.(t,l),a.notifyIngestEdit()},r={prop:s,raw:e.inspector?.get(t,s.path),disabled:s.readonly,testId:F(s.path),commit:o,fonts:i};switch(it(s)){case"color":return n.jsx(ot,{...r});case"font":return n.jsx(lt,{...r});case"gradient":return n.jsx(ct,{...r});case"shadow":return n.jsx(q,{...r,withSpreadInset:!0});case"text-shadow":return n.jsx(q,{...r,withSpreadInset:!1});case"filter":return n.jsx(Q,{...r,label:"Filter"});case"backdrop-filter":return n.jsx(Q,{...r,label:"Backdrop Filter"});case"radius":return n.jsx(dt,{...r,adapter:e,id:t,removeStyle:c});case"transform":return n.jsx(vt,{...r});case"scrub":return n.jsx(ut,{...r});case"select":return n.jsx(pt,{...r});case"checkbox":return n.jsx(gt,{...r});case"json":return n.jsx(ht,{...r});default:return n.jsx(ue,{...r})}}function pe({adapter:e,id:t,row:s}){const i=B(),a=(r,l)=>{e.inspector?.set(t,r,l),i.notifyIngestEdit()},o=r=>{e.inspector?.remove?.(t,r),i.notifyIngestEdit()};if(s.kind==="border"){const r={width:L(e.inspector?.get(t,s.width.path)),style:String(e.inspector?.get(t,s.style.path)??"solid"),color:String(e.inspector?.get(t,s.color.path)??"#000000")},l=f=>{const S=ie(e.inspector?.get(t,`style.border${f}Width`)),x=e.inspector?.get(t,`style.border${f}Style`),C=e.inspector?.get(t,`style.border${f}Color`),p=typeof C=="string"?Qe(C):void 0;return{width:S??r.width,style:typeof x=="string"&&x?x:r.style,color:p??r.color}},d={top:l("Top"),right:l("Right"),bottom:l("Bottom"),left:l("Left")},y=["Top","Right","Bottom","Left"],g=f=>{if(Ue(f)){a(s.width.path,f.top.width),a(s.style.path,f.top.style),a(s.color.path,f.top.color);for(const x of y)o(`style.border${x}Width`),o(`style.border${x}Style`),o(`style.border${x}Color`);return}const S=y.map(x=>({suffix:x,side:f[x.toLowerCase()]}));for(const{suffix:x,side:C}of S)a(`style.border${x}Width`,C.width),a(`style.border${x}Style`,C.style),a(`style.border${x}Color`,C.color)};return n.jsx(w,{label:"Border",testId:"react-prop-border",children:n.jsx(Be,{value:d,onChange:g,onChangeEnd:g})})}const c={justify:e.inspector?.get(t,s.justify.path)??"flex-start",align:e.inspector?.get(t,s.align.path)??"flex-start"};return n.jsx(w,{label:"Align",testId:"react-prop-align",children:n.jsx(Fe,{value:c,onChange:r=>{a(s.justify.path,r.justify),a(s.align.path,r.align)}})})}function z(e){return e.kind==="single"?e.prop.path:e.kind==="border"?`border:${e.width.path}`:`align:${e.justify.path}`}function E(e,t,s,i,a){if(!s)return null;const o=se.has(T(s.path))?"":"px",c=F(s.path);return n.jsx(O,{testId:c,label:i,value:L(e.inspector?.get(t,s.path)),unit:o,disabled:s.readonly,onChange:r=>a(s.path,r),onChangeEnd:r=>a(s.path,r),style:{flex:1,minWidth:0}},s.path)}function Ct({adapter:e,id:t,props:s,fonts:i,showConstraints:a,onToggleConstraints:o}){const c=B(),r=new Map(s.map(p=>[T(p.path),p])),l=(p,P)=>{e.inspector?.set(t,p,P),c.notifyIngestEdit()},d=String(e.inspector?.get(t,r.get("display")?.path??"style.display")??""),y=d==="flex"||d==="inline-flex",g=d==="grid"||d==="inline-grid",f=r.get("display"),S=r.get("gap"),x=ce(s.filter(p=>["justifyContent","alignItems"].includes(T(p.path)))),C=["flexDirection","flexWrap","overflow"].map(p=>r.get(p)).filter(p=>!!p);return n.jsxs("div",{style:{padding:"2px 8px 7px"},children:[n.jsxs("div",{style:{display:"flex",gap:u[3]},children:[E(e,t,r.get("width"),"W",l),E(e,t,r.get("height"),"H",l)]}),a&&n.jsxs("div",{"data-testid":"react-layout-constraints",style:{marginTop:5},children:[n.jsxs("div",{style:{display:"flex",gap:u[3]},children:[E(e,t,r.get("minWidth"),"Min W",l),E(e,t,r.get("minHeight"),"Min H",l)]}),n.jsxs("div",{style:{display:"flex",gap:u[3],marginTop:u[2]},children:[E(e,t,r.get("maxWidth"),"Max W",l),E(e,t,r.get("maxHeight"),"Max H",l)]})]}),n.jsx(k,{type:"button",variant:"ghost",size:"compact","data-testid":"react-layout-toggle-constraints",onClick:o,style:{display:"flex",margin:"2px auto 5px"},children:a?"− constraints":"··· constraints"}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1.35fr) minmax(0, 1fr)",gap:u[3]},children:[f&&n.jsx(V,{"data-testid":F(f.path),value:d,disabled:f.readonly,"data-dynamic":f.readonly||void 0,onChange:p=>l(f.path,p.target.value),style:{width:"100%"},children:(f.options??[]).map(p=>n.jsx("option",{value:String(p),children:String(p)},String(p)))}),E(e,t,S,"Gap",l)]}),y&&n.jsxs("div",{"data-testid":"react-layout-flex-controls",style:{marginTop:5},children:[C.filter(p=>T(p.path)!=="overflow").map(p=>n.jsx($,{adapter:e,id:t,prop:p,fonts:i},p.path)),x.map(p=>p.kind==="single"?n.jsx($,{adapter:e,id:t,prop:p.prop,fonts:i},z(p)):n.jsx(pe,{adapter:e,id:t,row:p},z(p)))]}),g&&n.jsxs("div",{"data-testid":"react-layout-grid-controls",style:{marginTop:5},children:[n.jsxs("div",{style:{display:"flex",gap:u[3]},children:[Z(e,t,r.get("gridTemplateColumns"),"Cols",l),Z(e,t,r.get("gridTemplateRows"),"Rows",l)]}),[r.get("gridTemplateColumns"),r.get("gridTemplateRows")].filter(p=>!!p).map(p=>n.jsx($,{adapter:e,id:t,prop:p,fonts:i},p.path)),n.jsxs("div",{style:{display:"flex",gap:u[3],marginTop:u[1]},children:[E(e,t,r.get("rowGap"),"Row Gap",l),E(e,t,r.get("columnGap"),"Col Gap",l)]}),r.get("gridAutoFlow")&&n.jsx($,{adapter:e,id:t,prop:r.get("gridAutoFlow"),fonts:i})]}),C.filter(p=>T(p.path)==="overflow").map(p=>n.jsx($,{adapter:e,id:t,prop:p,fonts:i},p.path)),n.jsx(Rt,{adapter:e,id:t,byName:r,fonts:i})]})}function ge(e){const t=e.trim();if(!t||t==="none")return 0;const s=[];let i=0,a=0;for(let c=0;c<t.length;c++){const r=t[c];r==="("||r==="["?i++:r===")"||r==="]"?i--:r===" "&&i===0&&(c>a&&s.push(t.slice(a,c)),a=c+1)}a<t.length&&s.push(t.slice(a));let o=0;for(const c of s){const r=/^repeat\(\s*(\d+)\s*,([\s\S]*)\)$/.exec(c);o+=r?.[1]&&r[2]!==void 0?Number(r[1])*ge(r[2]):1}return o}function Z(e,t,s,i,a){if(!s)return null;let o=null;const c=r=>{const d=`repeat(${Math.max(1,Math.round(r))}, 1fr)`;d!==o&&(o=d,a(s.path,d))};return n.jsx(O,{testId:`${F(s.path)}-count`,label:i,value:ge(String(e.inspector?.get(t,s.path)??"")),min:1,disabled:s.readonly,onChange:c,onChangeEnd:c,style:{flex:1,minWidth:0}},`${s.path}-count`)}function Rt({adapter:e,id:t,byName:s,fonts:i}){const[a,o]=v.useState(!1),c=["gridColumn","gridRow","justifySelf"].map(r=>s.get(r)).filter(r=>!!r);return c.length===0?null:n.jsxs(n.Fragment,{children:[n.jsx(k,{type:"button",variant:"ghost",size:"compact","data-testid":"react-layout-toggle-grid-item",onClick:()=>o(r=>!r),style:{display:"flex",margin:"2px auto 0"},children:a?"− grid item":"··· grid item"}),a&&n.jsx("div",{"data-testid":"react-layout-grid-item",children:c.map(r=>n.jsx($,{adapter:e,id:t,prop:r,fonts:i},r.path))})]})}function kt(e){const t=e.trim();if(!t||t==="none")return[];const s=[];let i=0,a=0;for(let o=0;o<t.length;o++){const c=t[o];c==="("?i++:c===")"?i--:c===","&&i===0&&(s.push(t.slice(a,o).trim()),a=o+1)}return s.push(t.slice(a).trim()),s.filter(Boolean)}function ee(e){return/^url\((['"]?)([\s\S]*)\1\)$/.exec(e.trim())?.[2]??null}function wt({adapter:e,id:t,props:s,fonts:i}){const a=B(),o=new Map(s.map(h=>[T(h.path),h])),c=(h,b)=>{e.inspector?.set(t,h,b),a.notifyIngestEdit()},r=o.get("backgroundImage"),l=o.get("backgroundColor"),[d,y]=v.useState(null),[g,f]=v.useState(null),S=String(r?e.inspector?.get(t,r.path)??"":""),x=kt(S),C=h=>{if(r){if(h.length>0){c(r.path,h.join(", "));return}e.inspector?.remove?.(t,r.path),a.notifyIngestEdit()}},p=(h,b)=>C(x.map((R,I)=>I===h?b:R)),P=h=>{y(null),C(x.filter((b,R)=>R!==h))},K=(h,b)=>{const R=[...x],I=R[h+b];I===void 0||R[h]===void 0||(R[h+b]=R[h],R[h]=I,y(null),C(R))},W={background:"none",border:"none",color:m.textMuted,cursor:"pointer",fontSize:j.base,padding:`${u[2]} ${u[3]}`,lineHeight:M.tight};return n.jsxs("div",{"data-testid":"react-fill-list",style:{padding:"2px 8px 7px"},children:[x.map((h,b)=>{const R=re(h),I=ee(h),me=R?`${R.type} gradient`:I!==null?I.split("/").pop()??"image":h.slice(0,22);return n.jsxs("div",{style:{marginBottom:3},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5},children:[n.jsxs("button",{type:"button","data-testid":`react-fill-layer-${b}`,title:h,onClick:()=>y(d===b?null:b),style:{display:"flex",alignItems:"center",gap:u[3],flex:1,minWidth:0,background:"none",border:"none",cursor:"pointer",padding:`${u[1]} 0`,color:m.text,fontSize:j.base,textAlign:"left"},children:[n.jsx("span",{style:{width:16,height:16,flexShrink:0,borderRadius:Te.sm,border:`1px solid ${m.border}`,background:h,backgroundSize:"cover"}}),n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me})]}),b>0&&n.jsx("button",{type:"button","data-testid":`react-fill-up-${b}`,title:"Raise this fill",onClick:()=>K(b,-1),style:W,children:"↑"}),b<x.length-1&&n.jsx("button",{type:"button","data-testid":`react-fill-down-${b}`,title:"Lower this fill",onClick:()=>K(b,1),style:W,children:"↓"}),n.jsx("button",{type:"button","data-testid":`react-fill-remove-${b}`,title:"Remove this fill (CSS has no hidden-layer state — removing is Figma's eye)",onClick:()=>P(b),style:W,children:"✕"})]}),d===b&&R&&n.jsx(ae,{testId:`react-fill-gradient-${b}`,value:R,onChange:N=>p(b,A(N)),onChangeEnd:N=>p(b,A(N))}),d===b&&I!==null&&n.jsx(Y,{"data-testid":`react-fill-url-${b}`,defaultValue:I,placeholder:"image url",onBlur:N=>p(b,`url("${N.target.value.trim()}")`),onKeyDown:N=>{N.key==="Enter"&&p(b,`url("${N.currentTarget.value.trim()}")`)},style:{width:"100%",marginTop:u[1]}})]},`${b}-${h.slice(0,24)}`)}),g!==null&&n.jsx(Y,{"data-testid":"react-fill-image-draft",value:g,placeholder:"image url — Enter to add",autoFocus:!0,onChange:h=>f(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g.trim()&&(C([`url("${g.trim()}")`,...x]),f(null)),h.key==="Escape"&&f(null)},style:{width:"100%",marginBottom:3}}),n.jsxs("div",{style:{display:"flex",gap:u[2]},children:[n.jsx(k,{type:"button",variant:"ghost",size:"compact","data-testid":"react-fill-add-gradient",onClick:()=>{C([A(de),...x]),y(0)},children:"+ gradient"}),n.jsx(k,{type:"button",variant:"ghost",size:"compact","data-testid":"react-fill-add-image",onClick:()=>f(""),children:"+ image"})]}),x.some(h=>ee(h)!==null)&&["backgroundSize","backgroundPosition","backgroundRepeat"].map(h=>o.get(h)).filter(h=>!!h).map(h=>n.jsx($,{adapter:e,id:t,prop:h,fonts:i},h.path)),l&&n.jsx($,{adapter:e,id:t,prop:l,fonts:i})]})}function Et({adapter:e,id:t,props:s,fonts:i}){const a=B(),o=new Map(s.map(g=>[T(g.path),g])),c=o.get("position"),r=String(c?e.inspector?.get(t,c.path)??"static":"static"),l=(g,f)=>{e.inspector?.set(t,g,f),a.notifyIngestEdit()},d=["top","right","bottom","left"],y=["zIndex","flexGrow","flexShrink","flexBasis","alignSelf"].map(g=>o.get(g)).filter(g=>!!g);return n.jsxs("div",{style:{padding:"2px 8px 7px"},children:[c&&n.jsx("div",{"data-testid":F(c.path),style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:u[1]},children:(c.options??[]).map(g=>{const f=String(g),S=f===r;return n.jsx(k,{type:"button",variant:S?"primary":"secondary",size:"compact","aria-pressed":S,title:f,disabled:c.readonly,onClick:()=>l(c.path,f),children:f.slice(0,3)},f)})}),r!=="static"&&n.jsx("div",{"data-testid":"react-position-offsets",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:u[2],marginTop:u[3]},children:d.map(g=>E(e,t,o.get(g),g[0].toUpperCase(),l))}),y.length>0&&n.jsxs("div",{style:{borderTop:`1px solid ${m.border}`,marginTop:7,paddingTop:3},children:[n.jsx("div",{style:{color:m.textMuted,fontSize:j.xs,padding:"2px 0 1px"},children:"STACKING & FLEX ITEM"}),y.map(g=>n.jsx($,{adapter:e,id:t,prop:g,fonts:i},g.path))]})]})}function $t({adapter:e,id:t,props:s}){const i=B(),a=new Map(s.map(d=>[T(d.path),d])),o=(d,y)=>{e.inspector?.set(t,d,y),i.notifyIngestEdit()},c=d=>{const y=a.get(d);return y?n.jsx(O,{testId:F(y.path),label:"",value:L(e.inspector?.get(t,y.path)),unit:"px",disabled:y.readonly,onChange:g=>o(y.path,g),onChangeEnd:g=>o(y.path,g),style:{width:46,minWidth:0,flex:"none"}},y.path):n.jsx("span",{},d)},r=d=>n.jsx("span",{style:{position:"absolute",top:2,left:6,fontSize:8,letterSpacing:".08em",color:m.textMuted,pointerEvents:"none"},children:d}),l={display:"flex",alignItems:"center",justifyContent:"center"};return n.jsx("div",{style:{padding:`${u[1]} ${u[4]} ${u[4]}`},"data-testid":"react-spacing-box",children:n.jsxs("div",{style:{position:"relative",border:`1px solid ${m.border}`,borderRadius:4,padding:"11px 4px 3px"},children:[r("MARGIN"),n.jsx("div",{style:l,children:c("marginTop")}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[1]},children:[c("marginLeft"),n.jsxs("div",{style:{position:"relative",flex:1,minWidth:0,border:`1px dashed ${m.border}`,borderRadius:4,padding:"11px 4px 3px"},children:[r("PADDING"),n.jsx("div",{style:l,children:c("paddingTop")}),n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:u[1]},children:[c("paddingLeft"),c("paddingRight")]}),n.jsx("div",{style:l,children:c("paddingBottom")})]}),c("marginRight")]}),n.jsx("div",{style:l,children:c("marginBottom")})]})})}function Tt({name:e,groupId:t,props:s,adapter:i,id:a,fonts:o}){const[c,r]=v.useState(!1),l=ce(s);return n.jsxs("div",{"data-testid":`react-inspector-group-${t}`,children:[e==="Layout"&&n.jsx(Ct,{adapter:i,id:a,props:s,fonts:o,showConstraints:c,onToggleConstraints:()=>r(d=>!d)}),e==="Position"&&n.jsx(Et,{adapter:i,id:a,props:s,fonts:o}),e==="Spacing"&&n.jsx($t,{adapter:i,id:a,props:s}),e==="Fill"&&n.jsx(wt,{adapter:i,id:a,props:s,fonts:o}),e!=="Layout"&&e!=="Position"&&e!=="Spacing"&&e!=="Fill"&&l.map(d=>d.kind==="single"?n.jsx($,{adapter:i,id:a,prop:d.prop,fonts:o},z(d)):n.jsx(pe,{adapter:i,id:a,row:d},z(d)))]})}function It({adapter:e,node:t}){const s=[];let i=t,a=0;for(;i&&a++<100;)s.unshift(i),i=i.parentId?e.hierarchy.node(i.parentId):null;return n.jsx("nav",{"aria-label":"Selection ancestry","data-testid":"react-inspector-breadcrumbs",style:{display:"flex",alignItems:"center",gap:3,padding:`${u[3]} ${u[4]}`,overflowX:"auto",borderBottom:`1px solid ${m.border}`,whiteSpace:"nowrap"},children:s.map((o,c)=>n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[c>0&&n.jsx("span",{style:{color:m.textMuted},children:"/"}),n.jsx(k,{type:"button",variant:"ghost",size:"compact","aria-current":o.id===t.id?"page":void 0,title:o.secondaryLabel??o.label,onClick:()=>$e(e,[o.id]),children:o.label})]},o.id))})}function Nt({owner:e,node:t}){const s=e.portableArgs(t.id),[i,a]=v.useState("idle"),[o,c]=v.useState(""),[r,l]=v.useState(null),d=async y=>{const g=await e.writeStory(t.id,y);l(g.changed?null:g.error??"refused"),g.changed&&(a("idle"),c(""))};return n.jsxs("div",{"data-testid":"react-story-controls-header",style:{borderBottom:`1px solid ${m.border}`},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:u[4],padding:"7px 8px"},children:[n.jsxs("div",{style:{minWidth:0},children:[n.jsx("div",{style:{color:m.text,fontSize:j.md,fontWeight:600},children:t.label}),n.jsx("div",{style:{color:m.textMuted,fontSize:j.sm},children:s?`${Object.keys(s).length} args · session controls`:"Portable CSF story"})]}),n.jsx(k,{type:"button",variant:"secondary",size:"compact","data-testid":"react-story-reset-args",onClick:()=>e.resetPortableArgs(t.id),children:"Reset"})]}),n.jsxs("div",{style:{display:"flex",gap:u[2],padding:`0 ${u[4]} ${u[3]}`,flexWrap:"wrap"},children:[n.jsx(k,{type:"button",variant:"ghost",size:"compact","data-testid":"react-story-save-as",title:"Write the CURRENT session args as a new story export in this file",onClick:()=>{l(null),c(""),a(i==="save-as"?"idle":"save-as")},children:"Save as…"}),n.jsx(k,{type:"button",variant:"ghost",size:"compact","data-testid":"react-story-rename",onClick:()=>{l(null),c(""),a(i==="rename"?"idle":"rename")},children:"Rename…"}),i==="confirm-delete"?n.jsx(k,{type:"button",variant:"secondary",size:"compact","data-testid":"react-story-delete-confirm",onClick:()=>void d({kind:"delete"}),children:"Delete story?"}):n.jsx(k,{type:"button",variant:"ghost",size:"compact","data-testid":"react-story-delete",onClick:()=>{l(null),a("confirm-delete")},children:"Delete"})]}),(i==="save-as"||i==="rename")&&n.jsxs("div",{style:{display:"flex",gap:u[2],padding:`0 ${u[4]} ${u[4]}`,alignItems:"center"},children:[n.jsx("input",{"data-testid":"react-story-name-input",autoFocus:!0,value:o,placeholder:i==="save-as"?"NewStoryName":`Rename ${t.label}`,onChange:y=>c(y.target.value),onKeyDown:y=>{y.key==="Enter"&&o.trim()&&d(i==="save-as"?{kind:"save-as",name:o.trim()}:{kind:"rename",newName:o.trim()}),y.key==="Escape"&&a("idle")},style:{flex:1,minWidth:0,background:m.neutralHover,border:`1px solid ${m.border}`,borderRadius:4,color:m.text,fontSize:j.base,padding:"3px 6px"}}),n.jsx(k,{type:"button",variant:"secondary",size:"compact","data-testid":"react-story-name-commit",onClick:()=>void d(i==="save-as"?{kind:"save-as",name:o.trim()}:{kind:"rename",newName:o.trim()}),children:i==="save-as"?"Save":"Rename"})]}),r&&n.jsx("div",{"data-testid":"react-story-write-notice",style:{padding:`0 ${u[4]} ${u[4]}`,color:fe(),fontSize:j.sm,lineHeight:M.normal},children:r})]})}function At({owner:e,nodeId:t}){const s=e.elementClasses(t),[i,a]=v.useState(""),[o,c]=v.useState(null),r=async()=>{const l=i.trim().replace(/^\./,"");if(!l)return;const d=await e.writeNamedStyle(t,{kind:"set",className:l});c(d.changed?null:d.error??"refused"),d.changed&&a("")};return n.jsxs("div",{"data-testid":"react-element-classes",style:{padding:`${u[3]} ${u[4]}`,borderBottom:`1px solid ${m.border}`},children:[n.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:u[2],alignItems:"center"},children:[n.jsx("span",{style:{fontSize:j.sm,color:m.textMuted,marginRight:u[1]},children:"Style class"}),s.map(l=>n.jsxs("span",{"data-testid":`react-class-chip-${l.name}`,title:l.styledIn?`.${l.name} — ${l.count} element${l.count===1?"":"s"} in this game share this style (${l.styledIn.split("/").pop()??l.styledIn})`:`.${l.name} — utility/generated class (no first-party rule to edit)`,style:{display:"inline-flex",alignItems:"center",gap:3,fontFamily:H,fontSize:j.sm,color:l.styledIn?m.text:m.textMuted,background:m.neutralHover,border:`1px solid ${m.border}`,borderRadius:4,padding:"1px 4px"},children:[".",l.name,l.count>1&&n.jsxs("span",{style:{color:m.textMuted,fontSize:j.xs},children:["×",l.count]}),n.jsx("button",{type:"button","data-testid":`react-class-remove-${l.name}`,title:`Remove .${l.name} from this element`,onClick:()=>void e.writeNamedStyle(t,{kind:"remove",className:l.name}).then(d=>c(d.changed?null:d.error??"refused")),style:{background:"none",border:"none",color:m.textMuted,cursor:"pointer",fontSize:j.base,padding:"3px 5px",margin:"-3px -4px -3px -1px",lineHeight:M.tight},children:"✕"})]},l.name)),n.jsx("input",{"data-testid":"react-class-input",value:i,placeholder:s.length===0?"create style…":"add class…",title:"Type a class name — an existing first-party class is applied; a new name creates a style from this element's inline declarations",onChange:l=>{a(l.target.value),o&&c(null)},onKeyDown:l=>{l.key==="Enter"&&r(),l.key==="Escape"&&a("")},style:{flex:1,minWidth:72,background:"transparent",border:`1px dashed ${m.border}`,borderRadius:4,color:m.text,fontSize:j.sm,fontFamily:H,padding:"2px 5px"}})]}),o&&n.jsx("div",{"data-testid":"react-class-notice",style:{paddingTop:u[2],color:fe(),fontSize:j.sm,lineHeight:M.normal},children:o}),n.jsx(Mt,{})]})}function Mt(){const e=v.useSyncExternalStore(Ke,U);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,paddingTop:5},children:[n.jsx("span",{style:{fontSize:j.sm,color:m.textMuted},children:"Breakpoint"}),n.jsx(V,{"data-testid":"react-breakpoint-select",value:e??"",onChange:t=>oe(t.target.value||null),style:{fontSize:j.sm,flex:1,...e?{color:m.accent,borderColor:m.accent}:{}},children:he.map(t=>n.jsx("option",{value:t.media??"",children:t.label},t.label))})]}),e&&n.jsxs("div",{"data-testid":"react-breakpoint-note",style:{paddingTop:3,color:m.textMuted,fontSize:j.xs,lineHeight:M.normal},children:["Style edits write @media ",e," — previewed live by frame width."]})]})}const he=[{label:"Base",media:null},{label:"Tablet ≤991",media:"(max-width: 991px)"},{label:"Phone L ≤767",media:"(max-width: 767px)"},{label:"Phone ≤479",media:"(max-width: 479px)"}];function fe(){return"#e06c75"}function Ot({entry:e}){const[t,s]=v.useState(!1),i=`${e.file}:${e.line}`,a=`${e.file.split("/").pop()??e.file}:${e.line}`,o=async()=>{try{await navigator.clipboard.writeText(i),s(!0),setTimeout(()=>s(!1),1500)}catch{}};return n.jsx("button",{type:"button","data-testid":"react-source-location",title:`${i} — click to copy the path`,onClick:()=>void o(),style:{fontFamily:H,fontSize:"inherit",color:m.textMuted,cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,background:"none",border:"none",padding:0,textAlign:"left"},children:t?"Copied":a})}function Bt({owner:e,node:t,nodeId:s}){const i=e instanceof _,a=i?e.sourceLocation(s):void 0,o=t?.role==="story"?`Story · ${t.label}`:t?.role==="document"?`CSF · ${t.secondaryLabel??t.label}`:i?"Source":"Session overlay — not written to source",c=t?.role==="story"?`${t.label} is the active portable CSF design state.`:t?.role==="document"?`${t.secondaryLabel??t.label} owns this root's design states.`:i?`Edits change ${t?.label??"this component"}'s source — every rendered instance updates.`:"This is an ingested game: edits persist as a per-project overlay only, never written to source.";return n.jsxs("div",{"data-testid":i?"react-lane-b-disclosure":"react-overlay-disclosure",title:c,style:{display:"flex",alignItems:"center",gap:u[3],padding:`${u[1]} ${u[4]} ${u[3]}`,borderBottom:`1px solid ${m.border}`,color:m.textMuted,fontSize:j.sm,lineHeight:M.normal,minWidth:0},children:[n.jsx("span",{style:{flexShrink:0,...i?{}:{color:m.accent}},children:o}),a&&n.jsx(Ot,{entry:a})]})}function Ft({adapter:e,node:t,nodeId:s,owner:i}){return n.jsxs("div",{"data-testid":"react-inspector-section",children:[n.jsx(It,{adapter:e,node:t}),i instanceof _&&n.jsx(At,{owner:i,nodeId:s}),n.jsx(Bt,{owner:i,node:t,nodeId:s})]})}function te({adapter:e,id:t,name:s,groupId:i,props:a}){const o=v.useMemo(()=>Je(),[]);return n.jsx(Tt,{name:s,groupId:i,props:a,adapter:e,id:t,fonts:o})}function Dt(e,t){const s=le(e,t);if(!s||!e)return[];const i=e.id,a=(t.inspector?.properties(i)??[]).filter(l=>l.path!=="name"),{ungrouped:o,groups:c}=be(a),r=[{id:et,title:"Element",icon:je,order:tt,body:{kind:"custom",render:()=>v.createElement(Ft,{adapter:t,node:e,nodeId:i,owner:s}),...s instanceof _?{data:{classes:s.elementClasses(i),breakpoint:U()},editable:{fields:[{path:"element.breakpoint",label:"Breakpoint",type:"enum",options:he.map(l=>l.media??"")}],io:{get:l=>l==="element.breakpoint"?U()??"":void 0,set:(l,d)=>{l==="element.breakpoint"&&oe(typeof d=="string"&&d?d:null)}}}}:{}}}];return e.role==="story"&&s instanceof _&&r.push({id:nt,title:"Story",icon:Se,order:st,body:{kind:"custom",render:()=>v.createElement(Nt,{owner:s,node:e})}}),o.length>0&&r.push({id:ne,title:"Style",icon:Ce,order:ve,defaultOpen:!0,body:{kind:"custom",render:()=>v.createElement(te,{adapter:t,id:i,name:"Style",groupId:"style",props:o})}}),c.forEach((l,d)=>{r.push({id:we(l.groupId),title:l.name,icon:ke(l.name),order:Re+d,defaultOpen:!0,body:{kind:"custom",render:()=>v.createElement(te,{adapter:t,id:i,name:l.name,groupId:l.groupId,props:l.properties})}})}),r}const _t=xe();function Lt(){_t.ensure(e=>{e(ye({match:Ze,sections:Dt,claims:[ne]}))})}const on="workspace.service";function ln(){return Lt(),()=>{}}export{on as point,ln as start};
@@ -1 +0,0 @@
1
- import"./jsx-runtime-DPjLkJKQ.js";import"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{bD as Et,ao as b,bt as At,bA as Mt,gk as Rt}from"./index-GIL7oGEO.js";const kt={width:null,height:null};let J=kt;const et=new Set;function _t(){return J}function St(n,s){const l=n===null?null:Math.max(1,Math.round(n)),i=s===null?null:Math.max(1,Math.round(s));if(!(J.width===l&&J.height===i)){J={width:l,height:i};for(const d of et)d()}}function jt(){St(null,null)}function It(n){return et.add(n),()=>et.delete(n)}const qt="#191c22",Kt="rgba(255, 255, 255, 0.2)",Ct="#20242a",K="#2d323a";function Lt(){return`linear-gradient(45deg, ${K} 25%, transparent 25%, transparent 75%, ${K} 75%), linear-gradient(45deg, ${K} 25%, transparent 25%, transparent 75%, ${K} 75%)`}const O=20,Q=6,H=22,nt=10,dt=O+Q,ut=H+nt,$t=.6,Bt=.4,Ot=.7,Ft=.45;function yt(n,s,l){return n>=s?[1,!0]:n<=l?[0,!1]:[(n-l)/(s-l),!0]}function ft(n,s){const l=Math.max(0,n),i=s?Math.min(1,l/ut):0,[d,u]=yt(i,Ot,Ft),c=Math.max(0,l-ut*i),y=Math.min(1,c/dt),[v,_]=yt(y,$t,Bt),w=_?dt*y:0;return{frame:{scale:y,opacity:v,visible:_,offset:Q*y+O},group:s?{scale:i,opacity:d,visible:u,offset:w+nt*i+H}:null}}function pt(n,s){n.style.transformOrigin="0 100%",n.style.transform=s.scale>=1?"":`scale(${s.scale})`,n.style.opacity=s.visible?String(s.opacity):"0",n.style.display=s.visible?"":"none"}const Pt=640,Tt=400,N=64,C=64,ht=72,Vt=28,tt=C+H+nt+O+Q;function gt(n,s){const l=new Map(n.map(i=>[i.id,i]));return s.sections.map(i=>({key:i.id,label:i.label,stories:i.storyIds.flatMap(d=>{const u=l.get(d);return u?[u]:[]})}))}const zt=n=>n.split("/").map(s=>s.trim()).filter(Boolean);function bt(n){const s=new Set(n.filter(i=>i.stories.length===1).map(i=>i.key)),l=[];{const i=new Map;for(const d of n){if(!s.has(d.key)){l.push({key:d.key,label:d.label,stories:[...d.stories]});continue}const u=zt(d.label).slice(0,-1).join("/");let c=i.get(u);c||(c={key:`category:${u}`,label:u||null,stories:[]},i.set(u,c),l.push(c)),c.stories.push(...d.stories)}}return l}function Nt(n,s,l){const i=bt(gt(n,s)),d=new Map,u=new Map;let c=N,y=0;i.forEach((w,F)=>{const E=Math.max(1,Math.ceil(Math.sqrt(w.stories.length))),S=Math.ceil(w.stories.length/E),L=w.stories.map(h=>l(h)),I=Array.from({length:E},()=>0),R=Array.from({length:S},()=>0);L.forEach((h,f)=>{const m=f%E,M=Math.floor(f/E);I[m]=Math.max(I[m],h.width),R[M]=Math.max(R[M],h.height)});const P=I.map((h,f)=>I.slice(0,f).reduce((m,M)=>m+M+C,0)),D=R.map((h,f)=>R.slice(0,f).reduce((m,M)=>m+M+C,0)),$=F===0?Number.POSITIVE_INFINITY:w.label!==null?tt:C+O+Q;w.label!==null&&u.set(w.key,{x:N,y:c,roomAbove:$}),w.stories.forEach((h,f)=>{const m=Math.floor(f/E),M=f%E,W=L[f],{width:T,height:U}=W,st=N+P[M],Y=c+D[m];d.set(h.id,{x:st,y:Y,width:T,height:U,roomAbove:m===0?$:C,withGroupLabel:i.length>1&&m===0&&w.label!==null})});const x=I.reduce((h,f)=>h+f,0)+Math.max(0,E-1)*C,B=R.reduce((h,f)=>h+f,0)+Math.max(0,S-1)*C;y=Math.max(y,x),c+=B+tt});const v=N*2+y,_=c-tt+N;return{layouts:d,groupOrigins:u,width:v,height:n.length?_:0}}const A=new WeakMap,ot=new Set,Gt=null;function G(){for(const n of ot)n()}function Jt(n){return ot.add(n),()=>ot.delete(n)}function Qt(n){const s=n?A.get(n)??(n.parentElement?A.get(n.parentElement):void 0):void 0;if(!s)return null;const l=[];for(const[i,d]of s.frames)l.push({storyId:i,x:Math.round(Number.parseFloat(d.element.style.left)||0),y:Math.round(Number.parseFloat(d.element.style.top)||0)});return l}function Xt(n){return n?A.get(n)?.viewport()??Gt:null}function Zt(n,s){const l=n?A.get(n):void 0;return l?(l.setViewport(s),!0):!1}function te(n){const s=n?A.get(n):void 0;return!s||s.viewport().locked?!1:(s.setRotation(!s.viewport().rotated),!0)}function Ht(){const n=_t();return{width:n.width??Pt,height:n.height??Tt}}function mt(n,s,l){if(s.width<=0||s.height<=0)return;const i=Math.max(1,n.clientWidth-ht*2),d=Math.max(1,n.clientHeight-ht*2),u=Math.min(l,Math.max(.1,Math.min(i/s.width,d/s.height)));Rt(n.clientWidth/2-(s.x+s.width/2)*u,n.clientHeight/2-(s.y+s.height/2)*u,u)}function ee(n){const s=A.get(n);return s?(s.fitAll(),!0):!1}function oe(n,s,l){return n?A.get(n)?.selectAtClientPoint(s,l)??!1:!1}function ne(n,s,l){return n?A.get(n)?.zoomAtClientPoint(s,l)??!1:!1}function se(n,s,l,i,d){if(s.length===0)throw new Error("A React story board requires at least one story.");const u=n.parentElement;if(!u)throw new Error("A React story board layer must be attached before mounting.");n.dataset.vgaiReactStoryBoard="true",n.style.contain="none";const c=document.createElement("div");c.dataset.testid="react-story-board",c.dataset.vgaiReactStoryBoardCanvas="true",c.style.position="absolute",c.style.left="0",c.style.top="0",c.style.transformOrigin="0 0",n.appendChild(c);const y=document.createElement("div");y.dataset.testid="react-story-board-chrome",y.dataset.vgaiStoryBoardChromeFor=n.dataset.worldId??"",y.style.position="absolute",y.style.inset="0",y.style.zIndex=String(Et.sticky),y.style.display=n.style.display||"block",y.style.pointerEvents="none",y.style.overflow="visible",u.appendChild(y);const v=new Map,_=new Map,w=new Map,F=new Map,E=new Map,S=new Map,L=gt(s,d.index),I=new Map,R=new Map,P=new Map,D=new Map;let $,x=s.some(t=>t.id===l)?l:s[0].id,B=!1,h=!1;const f=t=>{const e=d.resolve(t,t.frameSize??Ht(),P.has(t.id)?P.get(t.id):void 0,D.get(t.id)),o=S.get(t.id);return o?{...e,width:o.frame.width,height:o.frame.height,layout:"fullscreen"}:t.frameSize?{...e,layout:"fullscreen"}:e},m=()=>{const t=f(s.find(e=>e.id===x));$={storyId:x,selectedViewportId:t.selectedViewportId,locked:t.locked,rotated:t.rotated,choices:t.choices}};m();const M=new Set(L.filter(t=>t.stories.length===1).map(t=>t.key)),W=t=>t.split("/").map(e=>e.trim()).filter(Boolean),T=new Map;for(const t of L)for(const e of t.stories){const o=(e.title?W(e.title).at(-1):void 0)??W(t.label).at(-1);T.set(e.id,M.has(t.key)?o??e.label:e.label)}const U=bt(L);for(const t of L.flatMap(e=>e.stories)){const e=document.createElement("section");e.dataset.testid="react-story-frame",e.dataset.storyId=t.id,e.dataset.storyLabel=t.label,e.dataset.storyGroup=d.index.sections.find(Z=>Z.storyIds.includes(t.id))?.label??"",e.style.position="absolute",e.style.border=`1px solid ${b.boundary.strong}`,e.style.borderRadius="0",e.style.backgroundColor=Ct,e.style.backgroundImage=Lt(),e.style.backgroundPosition="0 0, 8px 8px",e.style.backgroundSize="16px 16px",e.style.boxShadow="none";const o=document.createElement("button");o.type="button",o.dataset.testid="react-story-frame-label",o.dataset.storyId=t.id,o.title=`${T.get(t.id)??t.label} — click to select, double-click to zoom — ${t.modulePath}`,o.textContent=T.get(t.id)??t.label,o.style.position="absolute",o.style.height=`${O}px`,o.style.padding="0 2px",o.style.border="0",o.style.appearance="none",o.style.background="transparent",o.style.color=b.content.primary,o.style.font=`600 12px ${b.typography.sans}`,o.style.lineHeight=`${O}px`,o.style.textAlign="left",o.style.cursor="default",o.style.pointerEvents="auto",o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis",o.style.width="max-content",o.addEventListener("click",()=>i(t.id,"highlight")),o.addEventListener("dblclick",()=>i(t.id,"zoom"));const r=document.createElement("div");r.dataset.testid="react-story-frame-content",r.dataset.storyId=t.id,r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.overflow="hidden",r.style.contain="layout paint",r.style.boxSizing="border-box";const a=document.createElement("div");a.dataset.testid="react-story-frame-note",a.dataset.storyId=t.id,a.style.position="absolute",a.style.left="0",a.style.right="0",a.style.bottom="0",a.style.display="none",a.style.padding="6px 8px",a.style.boxSizing="border-box",a.style.background=b.surface.overlay,a.style.color=b.content.muted,a.style.font=`11px ${b.typography.sans}`,a.style.pointerEvents="none";const p=document.createElement("div");p.dataset.testid="react-story-frame-error",p.dataset.storyId=t.id,p.style.position="absolute",p.style.inset="0",p.style.display="none",p.style.padding="16px",p.style.boxSizing="border-box",p.style.background=b.surface.overlay,p.style.color=b.semantic.danger,p.style.font=`12px ${b.typography.mono}`,p.style.pointerEvents="none",e.append(r,a,p),c.appendChild(e),y.appendChild(o),v.set(t.id,{element:e,content:r}),_.set(t.id,p),w.set(t.id,a),F.set(t.id,o)}if(U.length>1)for(const t of U){if(t.label===null)continue;const e=document.createElement("div");e.dataset.testid="react-story-group-label",e.dataset.storyGroup=t.key,e.textContent=t.label,e.style.position="absolute",e.style.height=`${H}px`,e.style.lineHeight=`${H}px`,e.style.color=b.content.primary,e.style.font=`700 14px ${b.typography.sans}`,e.style.whiteSpace="nowrap",e.style.pointerEvents="none",e.style.width="max-content",y.appendChild(e),I.set(t.key,e)}const Y=()=>{for(const[t,e]of v){const o=t===x;e.element.dataset.active=o?"true":"false",e.element.style.outline=o?`2px solid ${b.accent.default}`:"none",e.element.style.outlineOffset=o?"3px":"0";const r=F.get(t);r.setAttribute("aria-pressed",String(o)),r.style.color=o?b.accent.default:b.content.muted}},rt=(t,e)=>Number.isFinite(t)?t*e:Number.POSITIVE_INFINITY,j=()=>{const t=Mt();for(const[e,o]of E){const r=F.get(e),{frame:a}=ft(rt(o.roomAbove,t.zoom),o.withGroupLabel);r.style.left=`${t.x+o.x*t.zoom}px`,r.style.top=`${t.y+o.y*t.zoom-a.offset}px`;const p=Math.max(1,(o.width+C/2)*t.zoom);r.style.maxWidth=`${p}px`,pt(r,p>=Vt?a:{...a,opacity:0,visible:!1})}for(const[e,o]of R){const r=I.get(e);if(!r)continue;const{group:a}=ft(rt(o.roomAbove,t.zoom),!0);a&&(r.style.left=`${t.x+o.x*t.zoom}px`,r.style.top=`${t.y+o.y*t.zoom-a.offset}px`,pt(r,a))}},V=()=>{E.clear(),R.clear();const t=Nt(s,d.index,f);for(const[r,a]of t.groupOrigins)R.set(r,a);for(const r of s){const a=t.layouts.get(r.id);if(!a)continue;E.set(r.id,a);const{x:p,y:Z,width:lt,height:ct}=a,z=f(r),g=v.get(r.id);g.element.style.left=`${p}px`,g.element.style.top=`${Z}px`,g.element.style.width=`${lt}px`,g.element.style.height=`${ct}px`;const k=S.get(r.id);g.element.style.overflow=k?"hidden":"",g.content.style.width=`${k?k.mount.width:lt}px`,g.content.style.height=`${k?k.mount.height:ct}px`,g.content.style.left=`${k?-k.offset.x:0}px`,g.content.style.top=`${k?-k.offset.y:0}px`,g.content.dataset.storyLayout=z.layout,g.content.style.padding=z.layout==="padded"?"16px":"0",g.content.style.display=z.layout==="centered"?"flex":"block",g.content.style.alignItems=z.layout==="centered"?"center":"",g.content.style.justifyContent=z.layout==="centered"?"center":""}const e=t.width,o=t.height;c.style.width=`${e}px`,c.style.height=`${o}px`,n.style.width=`${e}px`,n.style.height=`${o}px`,j()},wt=()=>{const t=Number.parseFloat(c.style.width),e=Number.parseFloat(c.style.height);mt(u,{x:0,y:0,width:t,height:e},1)},at=()=>{h||(h=!0,queueMicrotask(()=>{h=!1,B||q(x,!0)}))},q=(t,e=!1)=>{const o=v.get(t),r=E.get(t);!o||!r||(x=t,Y(),m(),G(),e&&mt(u,r,2))},it=(t,e)=>{for(const[o,r]of v){const a=r.content.getBoundingClientRect();if(t>=a.left&&t<=a.right&&e>=a.top&&e<=a.bottom)return o}return null},xt=It(()=>{V(),at()}),vt=At(j);V(),Y(),j();const X={element:c,frames:v,activeContent:()=>v.get(x).content,activate:q,clearError:t=>{const e=_.get(t);e&&(e.style.display="none",e.textContent="")},fitAll:wt,selectAtClientPoint:(t,e)=>{const o=it(t,e);return!o||o===x?!1:(i(o,"highlight"),!0)},zoomAtClientPoint:(t,e)=>{const o=it(t,e);return o?(i(o,"zoom"),!0):!1},setError:(t,e)=>{const o=_.get(t);o&&(o.textContent=e,o.style.display="block")},setMeasuredFrame:(t,e)=>{if(B||!v.has(t))return;const o=S.get(t);if(e===null){if(!o)return;S.delete(t)}else{if(o&&o.frame.width===e.frame.width&&o.frame.height===e.frame.height&&o.mount.width===e.mount.width&&o.mount.height===e.mount.height&&o.offset.x===e.offset.x&&o.offset.y===e.offset.y)return;S.set(t,e)}V(),j()},setNote:t=>{for(const e of w.values())e.textContent=t??"",e.style.display=t===null?"none":"block"},viewport:()=>$,setViewport:t=>{$.locked||(P.set(x,t),V(),m(),G(),q(x,!0))},setRotation:t=>{$.locked||(D.set(x,t),V(),m(),G(),q(x,!0))},dispose:()=>{B||(B=!0,xt(),vt(),A.get(u)===X&&A.delete(u),G(),c.remove(),y.remove())}};return A.set(u,X),G(),at(),X}export{qt as R,It as a,Nt as b,Qt as c,se as d,Jt as e,Xt as f,_t as g,Zt as h,ee as i,Kt as j,oe as k,jt as r,St as s,te as t,ne as z};
@@ -1 +0,0 @@
1
- import{g as re,a as oe}from"./board-guides-DziKSTss.js";import{dE as se,bP as ne,bO as ie,av as ae,dF as le,dj as P,d9 as M,bA as j,aA as I,dG as $,dH as C,dI as ce,dJ as de,dK as O,dL as ue,bT as he,V as pe,bU as ge}from"./index-GIL7oGEO.js";import{r as fe,n as W,p as ye,t as be,c as me}from"./writer-B-KovzkA.js";import{s as Se}from"./story-arg-descriptors-Ek86ExX7.js";import{b as we,a as Re,c as ve,d as Ie,e as E,f as Ee,g as m,h as Ae,i as _,j as Te,k as ke}from"./inspect-BZfi3mmo.js";const H={count:0},xe="data-oid";function Pe(u){return{count:u.size}}function K(u){return u.tagName.toLowerCase()==="svg"}function Y(u,e){const t=new Map,r=[];e.begin?.();const o=(s,n,i)=>{const c=Array.from(s.children);c.forEach((d,l)=>{if(e.skip?.(d))return;const a=e.identify(d,{ownerId:n,ownedByAncestor:i,parent:s,siblingIndex:l,siblings:c});a!==null&&(t.set(a,{object:d,id:a,parentId:n,childIds:[]}),n===null?r.push(a):t.get(n)?.childIds.push(a));const h=a??n,p=i||a!==null;e.descend?.(d)!==!1&&o(d,h,p),e.leave?.(d,a)})};return o(u,null,!1),{nodes:t,rootIds:r,stats:Pe(t)}}function et(){return{project:u=>{const e=new Map;return Y(u,{begin:()=>e.clear(),identify:(t,r)=>{const o=t.tagName.toLowerCase();let s=0;for(let l=0;l<r.siblingIndex;l++)r.siblings[l].tagName.toLowerCase()===o&&s++;const n=`${o}[${s}]`,i=r.ownerId?e.get(r.ownerId)??"":"",c=i?`${i}/${n}`:n,d=`rdom:${c}`;return e.set(d,c),d},descend:t=>!K(t)})}}}function q(){return{project:u=>{const e=new Map;return Y(u,{begin:()=>e.clear(),identify:t=>{const r=t.getAttribute(xe);if(!r)return null;const o=e.get(r)??0;return e.set(r,o+1),o===0?r:`${r}#${o}`},descend:t=>!K(t)})}}}function $e(u){return q().project(u)}class Ce{constructor(e){this.identity=e}nodesById=new Map;objectsById=new Map;idsByObjectIndex=new Map;roots=[];walkStats=H;project(e){if(!e)return this.nodesById=new Map,this.objectsById=new Map,this.idsByObjectIndex=new Map,this.roots=[],this.walkStats=H,this.walkStats;const{nodes:t,rootIds:r,stats:o}=this.identity.project(e);return this.nodesById=t,this.objectsById=new Map([...t].map(([s,n])=>[s,n.object])),this.idsByObjectIndex=new Map([...t].map(([s,n])=>[n.object,s])),this.roots=r,this.walkStats=o,o}get nodes(){return this.nodesById}get objects(){return this.objectsById}get idsByObject(){return this.idsByObjectIndex}get rootIds(){return this.roots}get stats(){return this.walkStats}node(e){return this.nodesById.get(e)??null}rootNodes(){return this.roots.map(e=>this.nodesById.get(e)).filter(e=>e!==void 0)}objectOf(e){return this.objectsById.get(e)??null}idOf(e){return this.idsByObjectIndex.get(e)??null}}const F=64;function S(u){const e=u?.replace(/\s+/g," ").trim();return e?e.length<=F?e:`${e.slice(0,F-1).trimEnd()}…`:null}function x(u,e){return u?u[e]:void 0}const Oe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)$/;function Be(u){if(typeof u!="string"||u==="")return;if(u.startsWith("#"))return u;const e=Oe.exec(u);if(!e)return;const t=r=>Number.parseInt(r,10).toString(16).padStart(2,"0");return`#${t(e[1])}${t(e[2])}${t(e[3])}`}function Ne(u,e){switch(u){case"width":case"height":case"marginTop":case"marginRight":case"marginBottom":case"marginLeft":case"paddingTop":case"paddingRight":case"paddingBottom":case"paddingLeft":return{prop:u,cssValue:t=>`${t}px`};case"x":return e?{prop:"left",cssValue:t=>`${t}px`}:null;case"y":return e?{prop:"top",cssValue:t=>`${t}px`}:null;case"rotate":return{prop:"transform",cssValue:t=>`rotate(${t}deg)`};default:return null}}function Le(u){return u.getAttribute("data-vgai-at")==="true"}const De="data-oid",Me="http://www.w3.org/1999/xhtml",je=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function G(u,e){const t=u.namespaceURI;return t!=null&&t!==Me?!1:!je.has(e)}function A(u){const e=u.replaceAll("\\","/").replace(/^\.\//,""),t=e.lastIndexOf("/src/");return t>=0?e.slice(t+1):e}function We(u){return Q($e(u))}function Q(u){const e=new Map;for(const[t,r]of u.nodes)e.set(t,{id:t,oid:r.object.getAttribute(De)??t,tag:r.object.tagName.toLowerCase(),el:r.object,parentId:r.parentId,childIds:[...r.childIds]});return{nodes:e,rootIds:[...u.rootIds]}}const Z=[{prop:"display",label:"Display",type:"enum",group:"Layout",options:["block","flex","grid","inline","inline-block","inline-flex","none"]},{prop:"flexDirection",label:"Direction",type:"enum",group:"Layout",options:["row","column","row-reverse","column-reverse"]},{prop:"flexWrap",label:"Wrap",type:"enum",group:"Layout",options:["nowrap","wrap","wrap-reverse"]},{prop:"justifyContent",label:"Justify",type:"enum",group:"Layout",options:["flex-start","center","flex-end","space-between","space-around","space-evenly"]},{prop:"alignItems",label:"Align",type:"enum",group:"Layout",options:["stretch","flex-start","center","flex-end","baseline"]},{prop:"gap",label:"Gap",type:"number",group:"Layout"},{prop:"gridTemplateColumns",label:"Columns",type:"string",group:"Layout"},{prop:"gridTemplateRows",label:"Rows",type:"string",group:"Layout"},{prop:"gridAutoFlow",label:"Flow",type:"enum",group:"Layout",options:["row","column","row dense","column dense"]},{prop:"rowGap",label:"Row Gap",type:"number",group:"Layout"},{prop:"columnGap",label:"Col Gap",type:"number",group:"Layout"},{prop:"gridColumn",label:"Grid Col",type:"string",group:"Layout"},{prop:"gridRow",label:"Grid Row",type:"string",group:"Layout"},{prop:"justifySelf",label:"Justify Self",type:"enum",group:"Layout",options:["auto","start","center","end","stretch"]},{prop:"overflow",label:"Overflow",type:"enum",group:"Layout",options:["visible","hidden","scroll","auto"]},{prop:"width",label:"Width",type:"number",group:"Layout"},{prop:"height",label:"Height",type:"number",group:"Layout"},{prop:"minWidth",label:"Min W",type:"number",group:"Layout"},{prop:"minHeight",label:"Min H",type:"number",group:"Layout"},{prop:"maxWidth",label:"Max W",type:"number",group:"Layout"},{prop:"maxHeight",label:"Max H",type:"number",group:"Layout"},{prop:"position",label:"Position",type:"enum",group:"Position",options:["static","relative","absolute","fixed","sticky"]},{prop:"top",label:"Top",type:"number",group:"Position"},{prop:"right",label:"Right",type:"number",group:"Position"},{prop:"bottom",label:"Bottom",type:"number",group:"Position"},{prop:"left",label:"Left",type:"number",group:"Position"},{prop:"zIndex",label:"Z Index",type:"number",group:"Position"},{prop:"flexGrow",label:"Grow",type:"number",group:"Position"},{prop:"flexShrink",label:"Shrink",type:"number",group:"Position"},{prop:"flexBasis",label:"Basis",type:"string",group:"Position"},{prop:"alignSelf",label:"Self Align",type:"enum",group:"Position",options:["auto","stretch","flex-start","center","flex-end","baseline"]},{prop:"marginTop",label:"Margin T",type:"number",group:"Spacing"},{prop:"marginRight",label:"Margin R",type:"number",group:"Spacing"},{prop:"marginBottom",label:"Margin B",type:"number",group:"Spacing"},{prop:"marginLeft",label:"Margin L",type:"number",group:"Spacing"},{prop:"paddingTop",label:"Padding T",type:"number",group:"Spacing"},{prop:"paddingRight",label:"Padding R",type:"number",group:"Spacing"},{prop:"paddingBottom",label:"Padding B",type:"number",group:"Spacing"},{prop:"paddingLeft",label:"Padding L",type:"number",group:"Spacing"},{prop:"color",label:"Color",type:"color",group:"Type"},{prop:"fontSize",label:"Size",type:"number",group:"Type"},{prop:"fontWeight",label:"Weight",type:"string",group:"Type"},{prop:"lineHeight",label:"Line H",type:"string",group:"Type"},{prop:"letterSpacing",label:"Spacing",type:"string",group:"Type"},{prop:"textAlign",label:"Align",type:"enum",group:"Type",options:["left","center","right","justify"]},{prop:"textTransform",label:"Transform",type:"enum",group:"Type",options:["none","uppercase","lowercase","capitalize"]},{prop:"fontStyle",label:"Style",type:"enum",group:"Type",options:["normal","italic"]},{prop:"fontFamily",label:"Font",type:"string",group:"Type"},{prop:"textDecoration",label:"Decoration",type:"enum",group:"Type",options:["none","underline","line-through","overline"]},{prop:"backgroundColor",label:"Background",type:"color",group:"Fill"},{prop:"backgroundImage",label:"Fills",type:"string",group:"Fill"},{prop:"backgroundSize",label:"Size",type:"enum",group:"Fill",options:["auto","cover","contain"]},{prop:"backgroundPosition",label:"Pos",type:"string",group:"Fill"},{prop:"backgroundRepeat",label:"Repeat",type:"enum",group:"Fill",options:["repeat","no-repeat","repeat-x","repeat-y"]},{prop:"borderColor",label:"Border Color",type:"color",group:"Stroke"},{prop:"borderWidth",label:"Border Width",type:"number",group:"Stroke"},{prop:"borderStyle",label:"Border Style",type:"enum",group:"Stroke",options:["none","solid","dashed","dotted","double"]},{prop:"borderRadius",label:"Radius",type:"number",group:"Stroke"},{prop:"opacity",label:"Opacity",type:"number",group:"Effects"},{prop:"boxShadow",label:"Box Shadow",type:"string",group:"Effects"},{prop:"mixBlendMode",label:"Blend",type:"enum",group:"Effects",options:["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]},{prop:"filter",label:"Filter",type:"string",group:"Effects"},{prop:"backdropFilter",label:"Backdrop",type:"string",group:"Effects"},{prop:"textShadow",label:"Text Shadow",type:"string",group:"Effects"},{prop:"cursor",label:"Cursor",type:"enum",group:"Effects",options:["auto","default","pointer","text","move","wait","help","crosshair","not-allowed","grab","grabbing","zoom-in","zoom-out","col-resize","row-resize","none"]},{prop:"transform",label:"Transform",type:"string",group:"Transform"}],f="style.",w="component source (JSX, via /__ui-source — writes are immediate; nothing pending to flush)",B="component source (JSX) — no source-write backend in this session",y="prop.",R="token.",T="story.arg.",z="text",_e=30;let V=!1;const U=40,N="The source value is a dynamic expression, so replacing it with a literal is guarded.",ee={border:["borderWidth","borderStyle","borderColor"],borderWidth:["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],borderStyle:["borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"],borderColor:["borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"],borderRadius:["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],padding:["paddingTop","paddingRight","paddingBottom","paddingLeft"],margin:["marginTop","marginRight","marginBottom","marginLeft"],inset:["top","right","bottom","left"]},J=new Map(Object.entries(ee).flatMap(([u,e])=>e.map(t=>[t,u])));function He(u){const e=[];for(let t=J.get(u);t;t=J.get(t))e.unshift(t);return e}const k="portable-document",L="React Preview",Fe=new Map(Z.map(({prop:u,type:e})=>[u,e])),Ge={borderTopLeftRadius:"borderRadius",borderTopRightRadius:"borderRadius",borderBottomLeftRadius:"borderRadius",borderBottomRightRadius:"borderRadius",borderTopWidth:"borderWidth",borderRightWidth:"borderWidth",borderBottomWidth:"borderWidth",borderLeftWidth:"borderWidth",borderTopStyle:"borderStyle",borderRightStyle:"borderStyle",borderBottomStyle:"borderStyle",borderLeftStyle:"borderStyle",borderTopColor:"borderColor",borderRightColor:"borderColor",borderBottomColor:"borderColor",borderLeftColor:"borderColor"},ze=[{kind:"div",label:"Container"},{kind:"span",label:"Text"},{kind:"p",label:"Paragraph"},{kind:"button",label:"Button"},{kind:"a",label:"Link"},{kind:"img",label:"Image"},{kind:"ul",label:"List"},{kind:"li",label:"List Item"}],Ve=/\.(?:avif|gif|jpe?g|png|svg|webp)(?:[?#].*)?$/i;function Ue(u,e){return e.type==="number"?String(Number(u)):e.type==="boolean"?u===!0||u==="true"?"true":"false":e.type==="vec3"&&Array.isArray(u)?`[${u.map(t=>Number(t)).join(", ")}]`:e.type==="json"?JSON.stringify(u):JSON.stringify(String(u))}const Je={source:"source-code",label:"jsx",detail:"The JSX source is the document — edits write back to the component source file."};function X(u){const e=u;return(typeof e?.getAttribute=="function"?e.getAttribute("class")??"":"").split(/\s+/).filter(Boolean)}function Xe(u,e){const t=u.style;return typeof t?.getPropertyValue!="function"?!1:t.getPropertyValue(ke(e))!==""}class tt{constructor(e,t,r={}){this.root=e,this.store=t,this.assetRoot=r.assetRoot??e,this.provenance=r.provenance??Je,this.writeBackend=se(r.writeBackend,t.projectHistory),this.computedStyle=r.computedStyle??we,this.matchedCssRules=r.matchedCssRules??(a=>Re(a));const o=()=>{const a=this.root,h=typeof Element<"u"&&a instanceof Element?a.querySelector("[data-vgai-game-styles]")??a.closest?.("[data-vgai-game-styles]")??a:typeof document<"u"?document.documentElement:null;return typeof getComputedStyle=="function"&&h instanceof Element?getComputedStyle(h):void 0};this.designTokens=r.designTokens??(()=>ve(o())),this.designTokenValue=r.designTokens?a=>r.designTokens().find(h=>h.name===a)?.value:a=>o()?.getPropertyValue(a).trim()||void 0,this.portableStories=[...r.portableStories??[]];for(const a of this.portableStories)this.portableStoryArgs.set(a.id,{...a.args??{}});const s=r.portableDocuments??(this.portableStories.length>0?[{id:k,label:L,storyIds:this.portableStories.map(a=>a.id)}]:[]),n=new Set(this.portableStories.map(a=>a.id)),i=new Set,c=new Set,d=s.flatMap(a=>{if(c.has(a.id))return[];c.add(a.id);const h=a.storyIds.filter(p=>!n.has(p)||i.has(p)?!1:(i.add(p),!0));return h.length===0?[]:[{id:a.id,label:a.label??(a.path?ne(ie({modulePath:a.path,title:a.title})):L),...a.path?{path:a.path}:{},storyIds:h}]}),l=this.portableStories.map(a=>a.id).filter(a=>!i.has(a));l.length>0&&d.push({id:c.has(k)?`${k}:unassigned`:k,label:L,storyIds:l}),this.portableDocuments=d,this.portableHierarchy=r.portableHierarchy??null,this.portableDefaultStoryId=this.portableStories.some(a=>a.id===r.activePortableStoryId)?r.activePortableStoryId??null:this.portableStories[0]?.id??null,this.onPortableStoryApplied=r.onPortableStoryApplied,this.onPortableStoryArgsChanged=r.onPortableStoryArgsChanged,this.activeStoryId=this.portableDefaultStoryId,this.capabilities={transform:!1,inspectorFields:!0,persist:!0};{const a=ae(()=>this.reconcileEchoAfterReload());this.disposeReloadSignal=a}this.writeBackend?.index&&this.writeBackend.index().then(a=>{this.oidIndex=new Map(Object.entries(a)),this.store.notifyIngestEdit()}).catch(()=>{})}capabilities;provenance;writeBackend;projector=new Ce(q());hierarchySnapshotCache=null;hierarchySnapshotClearQueued=!1;computedStyle;matchedCssRules;designTokens;designTokenValue;oidIndex=new Map;dirty=!1;valueEcho=new Map;guardedPaths=new Map;lockedIds=new Set;assetRoot;pendingSourceReconcile=0;lastResolvedSelection=[];selectionRepairWatching=!1;disposeReloadSignal;portableStories;portableStoryArgs=new Map;portableDocuments;portableHierarchy;portableDefaultStoryId;onPortableStoryApplied;onPortableStoryArgsChanged;activeStoryId=null;boxEditSession=null;boxEditTail=Promise.resolve();snapshot(){return this.projector.project(this.root),Q({nodes:this.projector.nodes,rootIds:[...this.projector.rootIds]})}hierarchySnapshot(){return this.hierarchySnapshotCache??=this.snapshot(),this.hierarchySnapshotClearQueued||(this.hierarchySnapshotClearQueued=!0,queueMicrotask(()=>{this.hierarchySnapshotCache=null,this.hierarchySnapshotClearQueued=!1})),this.hierarchySnapshotCache}async refreshOidIndex(){const e=await this.writeBackend?.index?.();e&&(this.oidIndex=new Map(Object.entries(e)),this.store.notifyIngestEdit())}setEcho(e,t,r){let o=this.valueEcho.get(e);o||(o=new Map,this.valueEcho.set(e,o)),o.set(t,r)}clearEcho(e,t){const r=this.valueEcho.get(e);r&&(r.delete(t),r.size===0&&this.valueEcho.delete(e))}markGuarded(e,t,r){this.guardedPaths.set(`${e}|${t}`,r)}readEcho(e,t){const r=this.valueEcho.get(e);return r?.has(t)?{hit:!0,value:r.get(t)}:{hit:!1,value:void 0}}reconcileEchoAfterReload(){this.scheduleSelectionRepair(),!(this.valueEcho.size===0&&this.pendingSourceReconcile===0)&&(this.valueEcho.clear(),this.pendingSourceReconcile>0&&this.pendingSourceReconcile--,this.store.notifyIngestEdit())}scheduleSelectionRepair(){if(this.selectionRepairWatching||this.lastResolvedSelection.length===0)return;this.selectionRepairWatching=!0;let e=0,t=!1;const r=()=>{if(e++,t=this.repairSelectionAfterReprojection(t)||t,e>=_e){this.selectionRepairWatching=!1;return}setTimeout(r,U)};setTimeout(r,U)}repairSelectionAfterReprojection(e){const t=this.lastResolvedSelection;if(t.length===0||this.store.selectedEntityIds.size>0)return!1;const r=this.snapshot(),o=t.filter(s=>r.nodes.has(s));return o.length===0?(e||console.warn(`[ReactRootAuthoringAdapter] the re-projection dropped the selection (${t.join(", ")}) and none of those ids resolve in the remounted tree, so it cannot be restored. An inspector write issued now has no subject — re-select.`),this.lastResolvedSelection=[],!0):(!e&&!V&&(V=!0,console.warn(`[ReactRootAuthoringAdapter] OPEN DEFECT, repaired: an HMR re-projection drops this root's selection, and the editor is putting it back — restoring ${o.length} of ${t.length} id(s) that still resolve in the remounted tree (${o.join(", ")}). A write issued in that window has no subject. Named once per session; the repair runs on every re-projection.`)),this.store.selectMultiple([...o]),!0)}disposeReactRootAdapter(){this.disposeReloadSignal?.()}componentName(e){return this.oidIndex.get(e.oid)?.component??Ie(e.el)??null}elementLabel(e,t){const r=S(e.el.getAttribute("data-vgai-name"));if(r)return r;const o=e.el.getAttribute("aria-labelledby");if(o){const c=o.split(/\s+/).map(l=>Array.from(t.nodes.values()).find(a=>a.el.getAttribute("id")===l)).map(l=>S(l?.el.textContent)).filter(l=>l!==null),d=S(c.join(" "));if(d)return d}const s=S(e.el.getAttribute("aria-label"));if(s)return s;if(["section","article","aside","nav","main","header","footer"].includes(e.tag)){const c=e.childIds.map(l=>t.nodes.get(l)).find(l=>l!==void 0&&/^h[1-6]$/.test(l.tag)),d=S(c?.el.textContent);if(d)return d}if(/^(h[1-6]|p|span|label|button|a|time|output|dt|dd|li|legend|caption|summary)$/.test(e.tag)){const c=S(e.el.textContent);if(c)return c}for(const c of["alt","title","placeholder","name"]){const d=S(e.el.getAttribute(c));if(d)return d}const n=e.el.getAttribute("id");if(n)return`#${n}`;const i=(e.el.getAttribute("class")??"").split(/\s+/).filter(Boolean)[0];return i?`${e.tag}.${i}`:e.tag}toEditorNode(e,t=this.snapshot()){const r=this.componentName(e),o=e.parentId?t.nodes.get(e.parentId):null,s=o?this.componentName(o):null,n=r!==null&&r!==s,i=e.el.getAttribute("data-vgai-hierarchy-id"),c=e.el.getAttribute("data-vgai-hierarchy-parent-id"),d=e.el.getAttribute("data-vgai-hierarchy-order"),l=e.el.getAttribute("data-vgai-hierarchy-group-label"),a=d===null?void 0:Number(d),h={id:e.id,label:n?r:this.elementLabel(e,t),...n?{secondaryLabel:`<${e.tag}>`}:{},role:n?"component":"element",kind:e.tag,parentId:e.parentId,childIds:e.childIds,...i===null?{}:{crossSurfaceId:i},...c===null?{}:{crossSurfaceParentId:c},...a===void 0||!Number.isInteger(a)?{}:{crossSurfaceOrder:a},...l===null?{}:{crossSurfaceGroupLabel:l}};return this.portableStories.length>0&&h.parentId===null?{...h,parentId:this.activeStoryId}:h}crossSurfaceStructureSignature(){const e=this.hierarchySnapshot(),t=new Set;for(const r of e.nodes.values())(r.el.getAttribute("data-vgai-hierarchy-id")!==null||r.el.getAttribute("data-vgai-hierarchy-parent-id")!==null||r.el.getAttribute("data-vgai-hierarchy-order")!==null||r.el.getAttribute("data-vgai-hierarchy-group-label")!==null)&&t.add(r.id);return t.size===0?null:JSON.stringify([...e.nodes.values()].flatMap(r=>{if(!t.has(r.id))return[];let o=r.parentId;for(;o!==null&&!t.has(o);)o=e.nodes.get(o)?.parentId??null;return[[r.id,o,r.el.getAttribute("data-vgai-hierarchy-id"),r.el.getAttribute("data-vgai-hierarchy-parent-id"),r.el.getAttribute("data-vgai-hierarchy-order"),r.el.getAttribute("data-vgai-hierarchy-group-label")]]}))}portableDocumentNode(e){return{id:e.id,label:e.label,...e.path?{secondaryLabel:e.path}:{},role:"document",kind:"tsx",parentId:null,childIds:[...e.storyIds]}}portableDocumentForStory(e){return this.portableDocuments.find(t=>t.storyIds.includes(e))??null}portableHierarchyNode(e){return this.portableHierarchy?.nodes.find(t=>t.id===e)??null}portableStoriesForNode(e){if(e===le)return[...this.portableStories];if(!this.portableHierarchy)return[...this.portableStories];const t=this.portableHierarchyNode(e);if(t&&t.role!=="component")return[];const r=t?.role==="component"?t.id:this.portableHierarchy.storyParentIds.get(e)??this.portableHierarchy.storyParentIds.get(this.activeStoryId??"");if(!r)return[];const o=this.portableHierarchyNode(r),s=new Set(o?.childIds??[]);return this.portableStories.filter(n=>s.has(n.id))}portableStoryNode(e,t){const r=e.id===this.activeStoryId;return{id:e.id,label:e.label,role:"story",kind:"story",parentId:this.portableHierarchy?.storyParentIds.get(e.id)??this.portableDocumentForStory(e.id)?.id??k,childIds:r?t:[]}}hierarchy={crossSurfaceStructureSignature:()=>this.crossSurfaceStructureSignature(),roots:()=>{const e=this.hierarchySnapshot(),{nodes:t,rootIds:r}=e;return this.portableStories.length>0?this.portableHierarchy?this.portableHierarchy.rootIds.flatMap(o=>{const s=this.portableHierarchy?.nodes.find(n=>n.id===o);return s?[{...s,childIds:[...s.childIds]}]:[]}):this.portableDocuments.map(o=>this.portableDocumentNode(o)):r.map(o=>this.toEditorNode(t.get(o),e))},node:e=>{if(this.portableStories.length>0){const o=this.portableHierarchy?.nodes.find(i=>i.id===e);if(o)return{...o,childIds:[...o.childIds]};const s=this.portableDocuments.find(i=>i.id===e);if(s)return this.portableDocumentNode(s);const n=this.portableStories.find(i=>i.id===e);if(n)return this.portableStoryNode(n,this.hierarchySnapshot().rootIds)}const t=this.hierarchySnapshot(),r=t.nodes.get(e);return r?this.toEditorNode(r,t):null}};selection={get:()=>{const e=[...this.store.selectedEntityIds];return e.length>0&&(this.lastResolvedSelection=e),e},set:e=>this.store.selectMultiple(e),resolve:(e,t)=>{const r=this.hierarchy.node(e);if(!r)return null;const o=[];let s=r,n=0;for(;s&&n++<1e3;)(s.role==="component"||s.role==="instance"||s.role==="boundary")&&o.push(s),s=s.parentId?this.hierarchy.node(s.parentId):null;const i=o.reverse();if(i.length===0)return{id:e};const c=t?.scopeId?i.findIndex(a=>a.id===t.scopeId):-1;let d=c>=0?c+1:0;return t?.intent==="deep"&&(d+=1),{id:(i[d]??r).id}}};truth={resolve:e=>{const t=this.snapshot().nodes.get(e);if(!t)return{site:{anchored:!1,reason:"This row is a design document, not a JSX element."},writeAnchorKind:void 0};const r=this.oidIndex.get(t.oid),o=this.writeBackend?"source-prop":"live-only";if(!r)return{site:{anchored:!1,reason:"Source metadata is still loading or unavailable."},writeAnchorKind:o};const s=A(r.file);return{site:{anchored:!0,kind:"source",file:s,line:r.line,col:r.col,display:`${s}:${r.line}`},writeAnchorKind:o}}};related={links:e=>this.hierarchy.node(e)?.role!=="component"||this.stories.storiesFor(e).length===0?[]:[{id:`definition:${P}`,title:"Open in UI Components",open:()=>{M(P)}}]};instanceSource(e){const t=this.snapshot().nodes.get(e);if(!t||this.hierarchy.node(e)?.role!=="component")return null;const r=E(t.el);if(!r)return null;const o=this.oidIndex.get(r.callSiteOid);return!o||!/^[A-Z]/.test(o.tag)?null:{node:t,callSiteOid:r.callSiteOid,callSite:o,props:r.props}}instanceProp(e,t){if(!t.startsWith(y))return null;const r=this.instanceSource(e);if(!r)return null;const o=t.slice(y.length),s=r.callSite.props?.find(i=>i.name===o),n=r.callSite.authoredProps?.find(i=>i.name===o);return s&&n?{source:r,prop:o,spec:s,authored:n}:null}affectedInstances(e,t){const r=this.instanceSource(e);if(!r)return 0;let o=0;for(const s of this.snapshot().nodes.values()){const n=E(s.el);if(!n)continue;const i=this.oidIndex.get(n.callSiteOid);!i||i.tag!==r.callSite.tag||(s.id===e||!i.authoredProps?.some(c=>c.name===t))&&o++}return Math.max(1,o)}instances={openComponent:()=>{M(P)},describe:e=>{const t=this.instanceSource(e);if(!t||this.stories.storiesFor(e).length===0)return null;const r=Object.entries(t.props).flatMap(([o,s])=>{const n=`${y}${o}`,i=this.instanceProp(e,n);if(!i)return[];const c=i.authored.literal&&i.spec.defaultValue!==void 0&&t.node.oid!==t.callSiteOid&&!!this.writeBackend?.runGesture&&!!this.writeBackend.writeComponentDefault&&!!this.writeBackend.removeProp;return[{path:n,label:o,value:s,...i.spec.defaultText===void 0?{}:{defaultText:i.spec.defaultText},canApplyToComponent:c,affectedInstanceCount:this.affectedInstances(e,o),...c?{}:{applyUnavailableReason:i.authored.literal?i.spec.defaultValue===void 0?"The component default is computed or absent, so source cannot be changed safely.":"This session cannot atomically update the component and its callsite.":"The callsite value is a dynamic expression, so it cannot become a component literal."}}]});return{componentName:t.callSite.tag,sourcePath:A(t.callSite.file),overrides:r}},revert:async(e,t)=>{const r=this.instanceSource(e),o=this.writeBackend;if(!r||!o?.removeProp)return;const s=t.map(c=>this.instanceProp(e,c)?.prop).filter(c=>!!c);let n=!1;const i=async c=>{for(const d of s){const l=await c.removeProp?.(r.callSiteOid,d);n||=l?.changed===!0}};if(s.length>1&&o.runGesture?await o.runGesture(`Revert ${s.length} Overrides`,i):await i(o),!!n)return this.dirty=!0,this.pendingSourceReconcile++,await this.refreshOidIndex(),{destination:w,persisted:!0}},applyToComponent:async(e,t)=>{const r=this.instanceProp(e,t),o=this.writeBackend;if(!r||!r.authored.literal||r.spec.defaultValue===void 0||r.source.node.oid===r.source.callSiteOid||!o?.runGesture||!o.writeComponentDefault||!o.removeProp)return{changed:!1,message:"Apply was refused because both literal source writes are not available."};const s=r.source.props[r.prop];return await o.runGesture(`Apply ${r.prop} to ${r.source.callSite.tag}`,async n=>{const i=await n.writeComponentDefault?.(r.source.node.oid,r.prop,Ue(s,r.spec));if(!i?.changed)throw new Error(i?.error??"The component default did not change.");const c=await n.removeProp?.(r.source.callSiteOid,r.prop);if(!c?.changed)throw new Error(c?.error??"The callsite override was not removed.")}),this.dirty=!0,this.pendingSourceReconcile++,await this.refreshOidIndex(),{changed:!0,message:`${r.prop} now defaults to ${String(s)} in ${r.source.callSite.tag}.`,write:{destination:w,persisted:!0}}}};pickable={pick:(e,t)=>{const{nodes:r}=this.snapshot();let o=null,s=Number.POSITIVE_INFINITY,n=-1,i=-1;for(const c of r.values()){if(i++,this.lockedIds.has(c.id)||x(c.el.style,"pointerEvents")==="none")continue;const d=c.el.getBoundingClientRect?.();if(!d||e<d.left||e>d.right||t<d.top||t>d.bottom)continue;const l=d.width*d.height;(l<s||l===s&&i>n)&&(o=c.id,s=l,n=i)}return o===null?null:this.resolvePlacementUnit(o)}};resolvePlacementUnit(e){const{nodes:t}=this.snapshot(),o=t.get(e)?.el;if(!o?.closest||o.getAttribute?.("data-vgai-at")==="true")return e;const s=o.closest('[data-vgai-at="true"]');if(!s)return e;for(const[n,i]of t)if(i.el===s)return n;return e}hostRect(){const e=this.root.getBoundingClientRect?.();return{left:e?.left??0,top:e?.top??0}}toHostRelative(e){const t=this.hostRect(),r=j().zoom;return{x:(e.left-t.left)/r,y:(e.top-t.top)/r,width:e.width/r,height:e.height/r}}rects={rect:e=>{const r=this.snapshot().nodes.get(e)?.el.getBoundingClientRect?.();return r?this.toHostRelative(r):null},contextRects:e=>{const{nodes:t}=this.snapshot(),r=t.get(e);if(!r)return{};const o=r.parentId?t.get(r.parentId):void 0,s=o?.el.getBoundingClientRect?.(),i=(o?o.childIds:this.snapshot().rootIds).filter(g=>g!==e).map(g=>t.get(g)?.el.getBoundingClientRect?.()).filter(g=>g!=null).map(g=>this.toHostRelative(g)),c=r.el,d=c.getBoundingClientRect?.();let l;if(d){const g=I(m(c,"borderTopWidth",this.computedStyle))??0,v=I(m(c,"borderRightWidth",this.computedStyle))??0,te=I(m(c,"borderBottomWidth",this.computedStyle))??0,D=I(m(c,"borderLeftWidth",this.computedStyle))??0;l=this.toHostRelative({left:d.left+D,top:d.top+g,width:Math.max(0,d.width-D-v),height:Math.max(0,d.height-g-te)})}const a=re(),h=this.hostRect(),p=j().zoom,b=a.x.length>0||a.y.length>0?{x:a.x.map(g=>(g-h.left)/p),y:a.y.map(g=>(g-h.top)/p)}:void 0;return{...s?{parent:this.toHostRelative(s)}:{},...i.length?{siblings:i}:{},...l?{paddingBox:l}:{},...b?{guideEdges:b}:{}}},emptyContainers:()=>{const{nodes:e}=this.snapshot(),t=[];for(const r of e.values()){const o=r.el.getBoundingClientRect?.();!o||!G(r.el,r.tag)||t.push({oid:r.id,rect:this.toHostRelative(o),displayName:r.tag,hasVisibleChildren:r.el.children.length>0,hasText:(r.el.textContent??"").trim().length>0})}return Ee(t).map(r=>({id:r.oid,rect:r.rect,displayName:r.displayName}))}};colorSample={backgroundChainAt:(e,t)=>{const r=this.pickable.pick(e,t);if(!r)return null;const{nodes:o}=this.snapshot(),s=[];let n=o.get(r);for(;n;)s.push(m(n.el,"backgroundColor",this.computedStyle)),n=n.parentId?o.get(n.parentId):void 0;return s}};boxEdit={begin:e=>{this.boxEditSession={id:e,touched:new Map,priorInline:new Map}},apply:(e,t)=>{const r=this.boxEditSession;if(!r||r.id!==e)return;const o=this.snapshot().nodes.get(e);if(!o)return;const s=m(o.el,"position",this.computedStyle),n=s==="absolute"||s==="fixed";for(const[i,c]of Object.entries(t)){const d=Ne(i,n);if(!d){console.warn(`[ReactRootAuthoringAdapter] boxEdit: dropping patch key "${i}" for "${e}" — `+(i==="x"||i==="y"?`node is not absolutely/fixed positioned (computed position: "${s}"), no left/top to move`:"unrecognized box-edit patch key")),(i==="x"||i==="y")&&!r.hinted&&(r.hinted=!0,$(`${o.tag} flows in its layout (position: ${s}), so a drag cannot move it. Set Position to "abs" in the Inspector to place it freely; drag a handle to resize.`));continue}if(!r.priorInline.has(d.prop)){const h=x(o.el.style,d.prop);r.priorInline.set(d.prop,h==null?"":String(h))}let l=c;if((i==="x"||i==="y")&&typeof c=="number"){const h=o.el,p=h.getBoundingClientRect?.();if(p&&typeof h.offsetLeft=="number"&&typeof h.offsetTop=="number"){const b=this.toHostRelative(p),g=i==="x"?b.x-h.offsetLeft:b.y-h.offsetTop;l=Math.round(c-g)}}const a=d.cssValue(l);o.el.style&&(o.el.style[d.prop]=a),r.touched.set(d.prop,d.prop==="transform"?a:l)}},end:e=>{const t=this.boxEditSession;this.boxEditSession=null,!(!t||t.id!==e||t.touched.size===0)&&(this.boxEditTail=this.boxEditTail.then(()=>this.commitBoxEdit(e,t.touched,t.priorInline),()=>this.commitBoxEdit(e,t.touched,t.priorInline)),this.boxEditTail.catch(r=>{console.error("[ReactRootAuthoringAdapter] box edit failed and was not committed.",r)}))}};async commitBoxEdit(e,t,r){const o=this.dirty,s=this.snapshot().nodes.get(e),n=s&&Le(s.el)?Ae(s.el):null,i=l=>n===null?null:l==="left"?"x":l==="top"?"y":null;for(const[l,a]of t){const h=i(l);h&&typeof a=="number"?this.setEcho(e,`${y}${h}`,String(Math.round(a))):this.setEcho(e,`${f}${l}`,a)}let c=0;this.lastStyleWriteRefusal=null;const d=async l=>{for(const[a,h]of t){const p=i(a);if(p&&typeof h=="number"){await this.writeAtPlacement(e,n,p,h,l),c+=1;continue}const b=typeof h=="number"?`${h}px`:h;await this.writeStyleEntry(e,a,b,r.get(a),l)&&(c+=1)}if(c===0&&t.size>0){const a=this.lastStyleWriteRefusal??"the write was refused without a reason";pe.error(`The last edit on this element was NOT saved — ${a}`,"authoring"),$("Not saved: the edit could not be written to source — see the Console.")}};try{this.writeBackend?.runGesture?await this.writeBackend.runGesture(`Edit ${t.size} Styles`,d):await d(this.writeBackend)}catch(l){const a=this.snapshot().nodes.get(e);for(const[h,p]of r)this.clearEcho(e,`${f}${h}`),a?.el.style&&(a.el.style[h]=p);throw this.dirty=o,this.store.notifyIngestEdit(),l}}async writeAtPlacement(e,t,r,o,s){const n=`${y}${r}`,i=s??this.writeBackend;if(!i?.writeProp){this.clearEcho(e,n),console.warn(`[ReactRootAuthoringAdapter] cannot write At placement "${r}" on "${e}": no source-write backend with prop support in this session (hosted/no dev server).`);return}const c=await i.writeProp(t,r,String(Math.round(o)),{addIfMissing:!0});if(!c.changed){this.clearEcho(e,n),c.dynamic&&this.markGuarded(e,n,N),this.store.notifyIngestEdit(),console.warn(`[ReactRootAuthoringAdapter] At placement write refused/no-op for oid "${t}" prop "${r}": ${c.dynamic?"value is a dynamic expression (guarded) — authored truth the drag must not flatten":c.error??"no change"}`);return}this.dirty=!0}text={get:e=>{if(this.guardedPaths.has(`${e}|${z}`))return null;const t=this.snapshot().nodes.get(e);if(!t||t.el.children.length>0)return null;const r=t.el.textContent;if(r==null)return null;const o=r.trim();return o||null},set:(e,t)=>{this.editText(e,t)}};inspector={properties:e=>{const t=this.portableHierarchyNode(e);if(t)return t.secondaryLabel?[{path:"document.path",label:"Source",type:"string",readonly:!0,group:"Document"}]:[];const r=this.portableDocuments.find(n=>n.id===e);if(r)return r.path?[{path:"document.path",label:"Source",type:"string",readonly:!0,group:"Document"}]:[];if(this.portableStories.some(n=>n.id===e))return this.portableStoryArgDescriptors(e);const s=[...Z.map(({prop:n,label:i,type:c,group:d,options:l})=>({path:`${f}${n}`,label:i,type:c,group:d,...l?{options:l}:{}})),...this.propDescriptors(e),...this.tokenDescriptors()];return this.guardedPaths.size===0?s:s.map(n=>{const i=this.guardedPaths.get(`${e}|${n.path}`);return i?{...n,readonly:!0,readonlyReason:i}:n})},get:(e,t)=>{const r=this.portableHierarchyNode(e);if(r)return t==="document.path"?r.secondaryLabel:void 0;const o=this.portableDocuments.find(a=>a.id===e);if(o)return t==="document.path"?o.path:void 0;if(this.portableStories.some(a=>a.id===e))return t==="story.active"?e===this.activeStoryId:t.startsWith(T)?this.portableStoryArgs.get(e)?.[t.slice(T.length)]:void 0;const s=this.readEcho(e,t);if(s.hit)return s.value;if(t==="locked")return this.lockedIds.has(e);if(t==="visible"){const a=this.readEcho(e,`${f}visibility`);if(a.hit)return a.value!=="hidden";const h=this.snapshot().nodes.get(e);return h?m(h.el,"visibility",this.computedStyle)!=="hidden":void 0}if(t.startsWith(R)){const a=t.slice(R.length);return this.designTokenValue(a)}if(t.startsWith(y)){const a=this.snapshot().nodes.get(e);return(a?E(a.el):null)?.props[t.slice(y.length)]}if(!t.startsWith(f))return;const n=t.slice(f.length),i=this.snapshot().nodes.get(e);if(!i)return;const c=x(i.el.style,n),d=typeof c=="string"&&c!==""?c:typeof c=="number"?String(c):m(i.el,n,this.computedStyle),l=Fe.get(n);return l==="number"?I(d):l==="color"?Be(d):d||void 0},set:(e,t,r)=>{if(this.portableHierarchyNode(e)||this.portableDocuments.some(s=>s.id===e))return;if(this.portableStories.some(s=>s.id===e)){if(!t.startsWith(T))return;const s=t.slice(T.length),n=this.portableStoryArgs.get(e);if(!n||!(s in n))return;const i={...n,[s]:r};this.portableStoryArgs.set(e,i),this.onPortableStoryArgsChanged?.(e,{...i}),this.store.notifyIngestEdit();return}if(t==="locked"){r?this.lockedIds.add(e):this.lockedIds.delete(e),this.store.notifyIngestEdit();return}if(t==="visible"){const s=r?"visible":"hidden";return this.setEcho(e,`${f}visibility`,s),this.pipedSourceWrite(()=>this.writeStyle(e,"visibility",s))}if(t.startsWith(y))return this.setEcho(e,t,r),this.pipedSourceWrite(()=>this.writePropEdit(e,t.slice(y.length),String(r)));if(t.startsWith(R))return this.setEcho(e,t,r),this.pipedSourceWrite(()=>this.writeTokenValue(e,t.slice(R.length),String(r)));if(!t.startsWith(f))return;const o=t.slice(f.length);return this.setEcho(e,t,r),this.pipedSourceWrite(()=>this.writeStyle(e,o,r))},remove:(e,t)=>{if(!t.startsWith(f))return;const r=t.slice(f.length),o=Ge[r];return o?this.setEcho(e,t,this.inspector.get(e,`${f}${o}`)):this.clearEcho(e,t),this.pipedSourceWrite(()=>this.removeStyleProp(e,r))}};assetSubject={get:e=>this.assetSubjectForNode(this.snapshot(),e),entries:()=>{const e=We(this.assetRoot);return[...e.nodes.keys()].flatMap(t=>{const r=this.assetSubjectForNode(e,t);return r?[{id:t,subject:r}]:[]})}};assetSubjectForNode(e,t){const r=e.nodes.get(t);if(!r||r.tag!=="svg"||!r.el.outerHTML)return null;const o=this.oidIndex.get(r.oid);return{kind:"image",name:this.componentName(r)??this.elementLabel(r,e),mediaType:"image/svg+xml",text:r.el.outerHTML,...o?.file?{sourcePath:A(o.file)}:{}}}portableStoryArgDescriptors(e){return Se(this.portableStoryArgs.get(e)??{},T)}portableArgs(e){const t=this.portableStoryArgs.get(e);return t?{...t}:null}elementClasses(e){const r=this.snapshot().nodes.get(e)?.el;if(!r||typeof r.getAttribute!="function")return[];const o=(r.getAttribute("class")??"").split(/\s+/).filter(Boolean),s=(typeof r.closest=="function"?r.closest("[data-vgai-game-styles]"):null)??r.ownerDocument;return o.map(n=>{let i=0;try{i=s?.querySelectorAll?.(`.${CSS.escape(n)}`).length??0}catch{}return{name:n,count:i,styledIn:_(n)?.sourceFile??null}})}async writeNamedStyle(e,t){const r=this.snapshot().nodes.get(e);if(!r)return{changed:!1,error:`"${e}" no longer resolves in this root`};const o=l=>(console.warn(`[ReactRootAuthoringAdapter] named-style ${t.kind} refused: ${l}`),{changed:!1,error:l});if(t.kind==="remove"){const l=await C({op:"remove",oid:r.oid,className:t.className});return l.changed?(this.dirty=!0,this.store.notifyIngestEdit(),{changed:!0}):o(l.error??"no change")}if(_(t.className)){const l=await C({op:"apply",oid:r.oid,className:t.className});return l.changed?(this.dirty=!0,this.store.notifyIngestEdit(),{changed:!0}):o(l.error??"the element already wears this class")}const n=l=>l!==void 0&&!l.includes("/packages/editor/")&&!l.includes("/node_modules/")&&!l.includes("/vendor/"),i=this.matchedCssRules(r.el).filter(l=>n(l.sourceFile)),c=i[i.length-1]?.sourceFile??Te().find(n),d=await C({op:"create",oid:r.oid,className:t.className,...c!==void 0?{file:c}:{}});return d.changed?(this.dirty=!0,this.store.notifyIngestEdit(),{changed:!0,created:!0}):o(d.error??"no change")}async writeStory(e,t){const r=this.portableStories.find(n=>n.id===e);if(!r)return{changed:!1,error:`unknown portable story '${e}'`};if(!r.name||!r.modulePath)return{changed:!1,error:`story '${r.label}' carries no source address (name/modulePath) — it is not writable from this session`};const o=t.kind==="save-as"?{op:"save",file:r.modulePath,name:t.name,args:this.portableStoryArgs.get(e)??{}}:t.kind==="rename"?{op:"rename",file:r.modulePath,name:r.name,newName:t.newName}:{op:"delete",file:r.modulePath,name:r.name},s=await ce(o);if(!s.changed)return console.warn(`[ReactRootAuthoringAdapter] csf-story ${t.kind} refused for '${r.label}': ${s.error??"no change"}`),{changed:!1,...s.error!==void 0?{error:s.error}:{}};if(t.kind==="rename")r.name=t.newName,r.label=t.newName.replace(/([a-z])([A-Z])/g,"$1 $2");else if(t.kind==="delete"){const n=this.portableStories.indexOf(r);n>=0&&this.portableStories.splice(n,1),this.activeStoryId===e&&(this.activeStoryId=null)}return this.dirty=!0,this.store.notifyIngestEdit(),{changed:!0}}resetPortableArgs(e){const t=this.portableStories.find(o=>o.id===e);if(!t)return;const r={...t.args??{}};this.portableStoryArgs.set(e,r),this.onPortableStoryArgsChanged?.(e,{...r}),this.store.notifyIngestEdit()}propDescriptors(e){const t=this.snapshot().nodes.get(e),r=t?E(t.el):null;return r?Object.keys(r.props).map(o=>({path:`${y}${o}`,label:o,type:"string",group:"Props"})):[]}tokenDescriptors(){return this.designTokens().map(e=>({path:`${R}${e.name}`,label:e.name,type:"string",group:"Tokens",readonly:!e.declaredIn}))}async writeTokenValue(e,t,r){const o=`${R}${t}`,s=this.designTokens().find(c=>c.name===t);if(!s)return this.clearEcho(e,o),console.warn(`[ReactRootAuthoringAdapter] unknown design token "${t}".`),!1;if(!s.declaredIn)return this.clearEcho(e,o),console.warn(`[ReactRootAuthoringAdapter] token "${t}" has no stylesheet declaration to edit — it is set by script (a theme data module mirroring itself onto :root, or host style). Edit that source; it is plain data.`),!1;const n=this.writeBackend;if(!n?.writeCss)return this.clearEcho(e,o),console.warn(`[ReactRootAuthoringAdapter] cannot write token "${t}": no css-capable source-write backend in this session (hosted/no dev server).`),!1;const i=await n.writeCss(s.declaredIn.sourceFile,s.declaredIn.selector,t,r);return i.changed?(this.dirty=!0,this.store.notifyIngestEdit(),!0):(this.clearEcho(e,o),console.warn(`[ReactRootAuthoringAdapter] token write refused/no-op for "${t}" at ${s.declaredIn.sourceFile} (${s.declaredIn.selector}): ${i.error??"no change"}`),!1)}stories={storiesFor:e=>this.portableStories.length>0?this.portableStoriesForNode(e):[],active:e=>this.activeStoryId,apply:(e,t)=>{if(t!==null&&!this.portableStories.some(r=>r.id===t)){console.warn(`[ReactRootAuthoringAdapter] stories.apply: unknown portable CSF story id "${t}" — ignoring.`);return}this.activeStoryId=t??this.portableDefaultStoryId,this.onPortableStoryApplied?.(t),this.store.notifyIngestEdit()},unavailable:()=>de()};structure={create:(e,t)=>({id:"",ack:this.structOp(t??"","create",{wrapperTag:e})}),remove:e=>this.removeElement(e),removeMany:e=>this.removeManyElements(e),duplicate:e=>({id:e,ack:this.structOp(e,"duplicate")}),reparent:(e,t)=>{const r=t?this.oidOf(t):void 0;return r?this.structOp(e,"reparent",{parentOid:r}):this.structRefusal(`reparent refused: "${t??"the document root"}" has no authored source element to move into.`)},reorder:(e,t)=>{const r=t===null?this.snapshot().nodes.get(e)?.parentId??null:null;return this.reorder(e,t,r)},creatableKinds:()=>[...ze],wrap:(e,t)=>this.wrap(e,t),unwrap:e=>this.unwrap(e)};assetDrop={accepts:(e,t,r)=>this.assetDropPlan(e,t,r).ok,drop:(e,t,r)=>{const o=this.assetDropPlan(e,t,r);return o.ok?this.structOp(o.parentId,"create",{snippet:o.snippet,...o.ensureImport?{ensureImport:o.ensureImport}:{}}):this.structRefusal(`asset drop refused — ${o.reason}`)}};assetDropPlan(e,t,r){if(!this.writeBackend)return{ok:!1,reason:"This session has no source writer, so nothing can be added."};const o=this.snapshot().nodes.get(e);if(!o)return{ok:!1,reason:"That row has no authored JSX element."};if(!G(o.el,o.tag))return{ok:!1,reason:`<${o.tag}> cannot contain child elements.`};const s=r?.item?.kind==="component"?r.item:null;if(s){if(s.surface!=="dom")return{ok:!1,reason:`${s.name} is a ${s.surface} component, not a React UI component.`};const n=this.sourceLocation(e)?.file;return n?{ok:!0,parentId:e,snippet:`<${s.name} />`,ensureImport:{name:s.name,module:this.relativeProjectModule(n,s.sourcePath),kind:s.exportKind}}:{ok:!1,reason:"The target source location has not loaded yet."}}return Ve.test(t)?{ok:!0,parentId:e,snippet:`<img src=${JSON.stringify(t)} alt="" />`}:{ok:!1,reason:`${t} is not a browser image asset and has no DOM element to become.`}}relativeProjectModule(e,t){return fe(A(e),A(t))}wrap(e,t="div"){return this.structOp(e,"wrap",{wrapperTag:t})}unwrap(e){return this.structOp(e,"unwrap")}reorder(e,t,r){const o={},s=t?this.oidOf(t):void 0,n=r?this.oidOf(r):void 0;return s&&(o.targetOid=s),n&&(o.parentOid=n),this.structOp(e,"reorder",o)}oidOf(e){return this.snapshot().nodes.get(e)?.oid}sourceLocation(e){const t=this.oidOf(e);if(t)return this.oidIndex.get(t)}structOp(e,t,r){return this.structPipe.structOp(this.oidOf(e),e,t,r,w)}lastStyleWriteRefusal=null;refuseStyleWrite(e){this.lastStyleWriteRefusal=e,console.warn(e)}async writeStyleEntry(e,t,r,o,s=this.writeBackend){const n=`${f}${t}`,i=this.snapshot().nodes.get(e);if(!i)return this.clearEcho(e,n),this.refuseStyleWrite(`[ReactRootAuthoringAdapter] cannot write "${t}": "${e}" no longer resolves in this root (the tree was re-projected — an HMR remount — between the selection and the write). Nothing was written. Re-select and retry.`),!1;if(!s)return this.clearEcho(e,n),this.refuseStyleWrite(`[ReactRootAuthoringAdapter] cannot write "${t}" on "${e}": no source-write backend in this session (hosted/no dev server) — selection/inspection still work.`),!1;await this.expandShorthandsFor(e,t,s);const c=oe();if(c!==null){const l=W(this.matchedCssRules(i.el),X(i.el)),a=s.writeCss?l?null:"no style class carries this element — create one in the Style class row first (inline styles cannot be responsive, so a breakpoint edit needs a class rule).":"breakpoint edits need the dev-server css door (a hosted session cannot write @media).";if(a!==null||!l||!s.writeCss)return this.clearEcho(e,n),a&&(this.markGuarded(e,n,a),$(a)),this.store.notifyIngestEdit(),this.refuseStyleWrite(`[ReactRootAuthoringAdapter] breakpoint edit refused: ${a}`),!1;const h=await s.writeCss(l.sourceFile,l.selectorText,t,O(t,r),c);return h.changed?(this.dirty=!0,this.store.notifyIngestEdit(),!0):(this.clearEcho(e,n),this.refuseStyleWrite(`[ReactRootAuthoringAdapter] breakpoint css write refused/no-op for "${l.selectorText}" ${t} at ${c}: ${h.error??"no change"}`),!1)}if(s.writeCss){const l=this.matchedCssRules(i.el),a=ye(l,t),h=!a&&!Xe(i.el,t)?W(l,X(i.el)):null,p=a?.rule??h;if(p){const b={rule:p},{rule:g}=b,v=await s.writeCss(g.sourceFile,g.selectorText,t,O(t,r));if(v.changed)return this.dirty=!0,this.store.notifyIngestEdit(),!0;if(!v.generated)return this.clearEcho(e,n),this.refuseStyleWrite(`[ReactRootAuthoringAdapter] CSS write refused/no-op for selector "${g.selectorText}" prop "${t}": ${v.error??"no change"}`),!1}}r=ue(r,x(i.el.style,t));const d=await s.writeStyle(i.oid,t,r);if(!d.changed){this.clearEcho(e,n);const l=d.tokenRef?be(t,d.tokenRef):d.dynamic?N:null;return l&&this.markGuarded(e,n,l),this.store.notifyIngestEdit(),this.refuseStyleWrite(`[ReactRootAuthoringAdapter] style write refused/no-op for oid "${i.oid}" prop "${t}": ${l??d.error??"no change"}`),!1}return this.dirty=!0,o===void 0&&i.el.style&&(i.el.style[t]=O(t,r)),this.store.notifyIngestEdit(),!0}async writeStyle(e,t,r){return this.writeStyleEntry(e,t,r)}async expandShorthandsFor(e,t,r){const o=He(t);if(o.length===0)return;const s=this.snapshot().nodes.get(e);if(!(!s||!r))for(const n of o){const i=ee[n]??[],c=i.map(d=>m(s.el,d,this.computedStyle));if(await this.removeStyleProp(e,n,r))for(const[d,l]of i.entries()){if(l===t)continue;const a=c[d];a&&await this.writeStyleEntry(e,l,a,void 0,r)}}}async removeStyleProp(e,t,r=this.writeBackend){const o=this.snapshot().nodes.get(e);return!o||!r||!(await r.removeStyle(o.oid,t)).changed?!1:(this.dirty=!0,o.el.style&&delete o.el.style[t],this.store.notifyIngestEdit(),!0)}async editText(e,t){const r=this.snapshot().nodes.get(e);if(!r)return;if(!this.writeBackend?.writeText){console.warn(`[ReactRootAuthoringAdapter] cannot edit text on "${e}": no source-write backend with text support in this session (hosted/no dev server).`);return}const o=await this.writeBackend.writeText(r.oid,t);if(!o.changed){o.dynamic&&this.markGuarded(e,z,"The body has an expression or child elements, so replacing it with text is guarded."),this.store.notifyIngestEdit(),console.warn(`[ReactRootAuthoringAdapter] text edit refused/no-op for oid "${r.oid}": ${o.dynamic?"body has an expression/children (guarded)":o.error??"no change"}`);return}this.dirty=!0,this.pendingSourceReconcile++,this.store.notifyIngestEdit()}async writePropEdit(e,t,r){const o=`${y}${t}`,s=this.snapshot().nodes.get(e);if(!s)return this.clearEcho(e,o),!1;if(!this.writeBackend?.writeProp)return this.clearEcho(e,o),console.warn(`[ReactRootAuthoringAdapter] cannot write prop "${t}" on "${e}": no source-write backend with prop support in this session (hosted/no dev server).`),!1;const n=E(s.el);if(!n)return this.clearEcho(e,o),console.warn(`[ReactRootAuthoringAdapter] "${e}" is not a component call site with props — cannot write prop "${t}".`),!1;const i=await this.writeBackend.writeProp(n.callSiteOid,t,r);return i.changed?(this.dirty=!0,this.store.notifyIngestEdit(),!0):(this.clearEcho(e,o),i.dynamic&&this.markGuarded(e,o,N),this.store.notifyIngestEdit(),console.warn(`[ReactRootAuthoringAdapter] prop write refused/no-op for oid "${n.callSiteOid}" prop "${t}": ${i.dynamic?"value is a dynamic expression (guarded)":i.error??"no change"}`),!1)}removeElement(e){const t=this.snapshot().nodes.get(e);return t?this.structPipe.structOp(t.oid,e,"delete",void 0,w):this.structRefusal(`cannot delete "${e}": no such node in this world.`)}removeManyElements(e){const t=this.snapshot(),r=[...new Set(e.map(o=>t.nodes.get(o)?.oid).filter(o=>!!o))];return r.length===0?this.structRefusal("batch delete reached no source-addressable element."):this.structPipe.structMany(r,"delete",void 0,w)}subscribe(e){return this.store.subscribe(e)}get persistence(){const e=this.writeBackend;return{isDirty:()=>this.dirty,save:async()=>{},destination:e?w:B}}pipedSourceWrite(e){return he({resolve:()=>this.writeBackend?{reaches:"writer",anchorKind:"source-prop",destination:w,write:e}:ge(B),record:()=>{},report:t=>console.warn(`[ReactRootAuthoringAdapter] this edit stays live-only — ${t}.`)})}structPipe=me({report:e=>console.warn(`[ReactRootAuthoringAdapter] ${e}`),noWriterReason:B,backend:()=>this.writeBackend,onChanged:()=>{this.dirty=!0,this.pendingSourceReconcile++,this.store.notifyIngestEdit()}});structRefusal(e){return this.structPipe.structRefusal(e)}}export{Ce as D,tt as R,x as a,Be as c,Ne as m,et as s,We as w};
@@ -1 +0,0 @@
1
- import{setUserData as a,getUserData as r,deleteUserData as s}from"./user-data-BB2Of6Ht.js";import"./object-marks-DwvIEBOK.js";let o=0;const n=new Set;function e(){o++;for(const t of n)t()}function c(t){return n.add(t),()=>n.delete(t)}function f(){return o}function R(t,i){return a(t,"_animationRuntime",i),e(),()=>{r(t,"_animationRuntime")===i&&(s(t,"_animationRuntime"),e())}}export{f as animationRuntimeInspectionsVersion,R as attachAnimationRuntimeInspection,c as subscribeAnimationRuntimeInspections};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreeIsolationSceneContent-C8C8whSF.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-GIL7oGEO.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/three.module-D396a9Mn.js","assets/index-D2fNXpHa.css","assets/document-preview-three-Kbg2GCLm.js","assets/scene-framing-Cat0GtyJ.js","assets/mounted-story-viewport-source-DjP6RA9U.js","assets/story-three-preview-BHEDZzcl.js","assets/crash-null-boundary-v3a0uEgw.js","assets/events-156d8d12.esm-ErOhDXXB.js","assets/index-bQE2NA0D.js","assets/story-mount-turn-DFRTj5hi.js","assets/Object3DDocumentViewport-DB7T0NTl.js","assets/viewport-surface-status-B3om4Kcf.js","assets/world-root-stage-binding-vwTrtBz6.js","assets/RootSelectionOverlay-BZPlxmXU.js","assets/eyedropper-session-bjPXnfeX.js","assets/react-story-board-BDDwiE2H.js","assets/viewport-pick-context-DkawXbEi.js","assets/inspect-BZfi3mmo.js","assets/inference-diagnostics-Dhmtfbq_.js","assets/surface-state-DaxyruCj.js","assets/three-viewport-presentation-QBQpSdMh.js","assets/viewport-shading-boundary-B_-_gABg.js","assets/stage-invalidation-DBg3C3Ta.js","assets/clip-planes-CnAI6DZn.js","assets/three-CDSueJyJ.js","assets/OrbitControls-CM3bPray.js","assets/LineSegments2-CsOpKSiM.js","assets/three.quarks.esm-B1C61jGo.js","assets/live-gesture-lock-DJbrjOqf.js","assets/surface-content-Dg9Kkazf.js","assets/performance-profiler-D_Jey87L.js","assets/webgl-gpu-timer-D3YX7RaD.js","assets/renderer-config-BqG4O8i9.js","assets/user-data-BB2Of6Ht.js","assets/object-marks-DwvIEBOK.js","assets/loader-CaF_I7Yt.js","assets/render-settings-Bw4W9SYF.js","assets/render-features-CPQ_e568.js","assets/soft-particle-depth-DGvfQDi1.js","assets/viewport-shading-BuA88e_A.js","assets/matcap-texture-CVfalpWT.js","assets/setup-renderer-DVXaSGin.js","assets/index-BcCBqgM_.js","assets/defaults-DKiBJCPN.js","assets/design-time-mount-registry-DUpXCg1U.js","assets/project-authoring-session-Bnt6icLr.js","assets/edit-mode-authoring-B47TfLqu.js","assets/editor-presentation-activity-C7SNSmTd.js","assets/viewport-root-presentation-CWsE56K6.js","assets/mounted-authoring-Dmg5xmhP.js","assets/asset-editor-persistence-BBaONOJt.js","assets/stage-presence-markers-DiGI6A45.js","assets/collaboration-presence-DLoZ7EA3.js"])))=>i.map(i=>d[i]);
2
- import{F as v,d8 as u,aF as w,E as f,d$ as S,I as g,di as R,e0 as E,e1 as T,e2 as l,d9 as y,e3 as P,e4 as D,e5 as _,_ as b,V as x,ao as d,a4 as A,aS as N,aU as C,x as k}from"./index-GIL7oGEO.js";import{a as c}from"./jsx-runtime-DPjLkJKQ.js";import{O as I}from"./Object3DDocumentViewport-DB7T0NTl.js";import{r as m}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{s as V}from"./after-paint-CB4bz1-e.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-D396a9Mn.js";import"./viewport-surface-status-B3om4Kcf.js";const h="Scene";function j(e){const t=()=>{const r=f()?.scenes,a=(r?g(r).find(s=>s.plan.kind==="root-document"):void 0)?.entry.source,i=a?.path??e.sourcePath??e.savePath;return i?{path:i,...a?.export===void 0?{}:{exportName:a.export}}:null};return{revision:()=>{const r=t();return r?`${r.path}:${r.exportName??"default"}`:"unavailable"},subscribe:r=>{let o=JSON.stringify(t());const a=()=>{const n=JSON.stringify(t());n!==o&&(o=n,r())},i=e.subscribe(a),s=v(a);return()=>{i(),s()}},capture:async r=>{const o=t();if(!o)throw new Error("The Scene has no declared source module to preview.");return(await b(()=>import("./ThreeIsolationSceneContent-C8C8whSF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))).captureThreeIsolationScenePreview({path:o.path,exportName:o.exportName,label:h},r)}}}const O=/creating WebGL context/i,W=/null \(reading 'precision'\)/;function M(e){return O.test(e.message)||W.test(e.message)}const U=3;class F extends m.Component{state={error:null,autoRetryPending:!1};autoRetryCount=0;retryTimer=null;static getDerivedStateFromError(t){return{error:t,autoRetryPending:!1}}clearPendingRetry(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.retryTimer=null)}componentDidCatch(t,r){if(x.error(`Viewport failed to start: ${t.message}`,"editor"),console.error("[vgai] Viewport failed to start",t,r.componentStack),M(t)&&this.autoRetryCount<U){this.clearPendingRetry();const o=500*2**this.autoRetryCount;this.autoRetryCount++,this.retryTimer=window.setTimeout(()=>{this.retryTimer=null,this.setState({error:null,autoRetryPending:!1})},o),this.setState({autoRetryPending:!0})}}componentWillUnmount(){this.clearPendingRetry()}handleManualRetry=()=>{this.clearPendingRetry(),this.setState({error:null,autoRetryPending:!1})};render(){if(!this.state.error)return this.props.children;const t=this.state.autoRetryPending;return c.jsxs("div",{"data-testid":"viewport-startup-error",role:"alert",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:24,background:d.surface.shell,color:d.content.muted,textAlign:"center"},children:[c.jsx("div",{style:{color:d.content.primary,fontSize:14},children:t?"Viewport unavailable — retrying…":"Viewport unavailable"}),c.jsx("div",{style:{maxWidth:520,color:d.content.dim,fontSize:11},children:this.state.error.message}),c.jsx(A,{type:"button",className:"vgai-btn","data-testid":"retry-viewport",onClick:this.handleManualRetry,children:"Retry Viewport"})]})}}const L={kind:"world-root",load:()=>b(()=>import("./world-root-stage-binding-vwTrtBz6.js"),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,13,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62])).then(e=>e.worldRootStageBinding)};function $({documentId:e,active:t}){const[r,o]=m.useState(!1);return m.useEffect(()=>V(()=>o(!0)),[]),c.jsx(F,{children:r?c.jsx(I,{documentId:e,active:t,content:L,displayName:h}):null})}function B(e){const t=e.sourcePath??e.savePath;return{scene:{id:u,title:h,kind:"scene",workspaceRole:"authored-subject",...t?{provenance:{sourcePath:t}}:{},Content:$,preview:j(e),presentation:()=>e.savePath?{kind:"scene",path:e.savePath}:{kind:"workspace",id:u},onActivate:()=>e.setActiveViewportTab("edit")}}}function G(e,t,r=!0){const o=n=>N().some(p=>p.descriptor.id===n),a=e.activeViewportTab,i=f()?.scenes;if(r&&!(i&&S(i))){const n=i?g(i).find(p=>p.plan.kind==="root-document"):void 0;R({...t.scene,title:n?.plan.kind==="root-document"?n.plan.title:t.scene.title,provenance:{...t.scene.provenance,...n?.entry.source?.path?{sourcePath:n.entry.source.path}:{},...n?.plan.kind==="root-document"?{rootId:n.plan.regionId}:{}}},{category:"scene",rootId:n?.plan.kind==="root-document"?n.plan.regionId:void 0,default:i!==void 0&&(n?.isDefault??i.entries.length===0)}),E(u,e.isDirty)}else T(u);const s=C();a==="play"&&o(l)?s!==l&&y(l):r&&(s===l||s===null)&&y(u)}function z(e){let t=null;const r={subscribe:n=>e.subscribe(n),get playState(){return e.playState},get activeViewportTab(){return e.activeViewportTab},get savePath(){return _(e)},get sourcePath(){const n=D(e);return n&&(t=n),t},get isDirty(){return P(e)==="unsaved"},setActiveViewportTab:n=>e.setActiveViewportTab(n)},o=B(r),a=()=>G(r,o,w()?.config.hasThreeRoot!==!1);a();const i=e.subscribe(a),s=v(a);return()=>{i(),s()}}const ae="workspace.service";function ie(){let e=null;const t=k(r=>{e?.(),e=z(r)});return()=>{t(),e?.(),e=null,T(u)}}export{ae as point,ie as start};
@@ -1 +0,0 @@
1
- const e="workspace.layout",s={id:"sculpt",title:"Sculpt",description:"ZBrush-shaped sculpting. Uses Model's arrangement until the sculpt program ships its brush rail.",requires:{documentKind:"model"},regions:{header:"shown",shelf:"shown",inspector:"properties",drawer:"hidden"}};export{s as layout,e as point};
@@ -1 +0,0 @@
1
- import{B as t}from"./three.quarks.esm-B1C61jGo.js";import{farDepthTexture as o}from"./soft-particle-depth-DGvfQDi1.js";import"./three.module-D396a9Mn.js";function d(r){const e=new t;return e.setDepthTexture(o()),r.add(e),{batchedRenderer:e}}export{d as setupParticles};
@@ -1 +0,0 @@
1
- const e="workspace.layout",o={id:"shading",title:"Shading",description:"Blender-shaped shading: the viewport over the material's node tree, read-only.",requires:{documentKind:"model"},regions:{header:"shown",shelf:"shown",inspector:"properties",drawer:"hidden"},areas:[{id:"shader",document:"blender-node-editor.document",place:"below",ratio:.5}]};export{o as layout,e as point};