decocms 4.451.0 → 4.451.1

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 (360) hide show
  1. package/dist/client/assets/{AlertCircle-DrwoGJpd.js → AlertCircle-DDHQi3fm.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BAAHWXOl.js → AreaChart-xcCkJdeX.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DKYwT7KB.js → ArrowLeft-CIsJnvjF.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-NsPNRi9p.js → ArrowUp-CtvQk6Vg.js} +1 -1
  5. package/dist/client/assets/{Building02-DlH3FV2M.js → Building02-BVSXudo-.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-8XeONUcg.js → CartesianChart-YXdY8HHd.js} +1 -1
  7. package/dist/client/assets/{Check-BcGsLSsp.js → Check-Cf-cMW3t.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-iXm3h-fF.js → CheckCircle-BemNEpVg.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-BAvbedXO.js → ChevronUp-B79uJeZN.js} +1 -1
  10. package/dist/client/assets/{Copy01-C_KnfAlj.js → Copy01-DluK-JtU.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-B7CL5INn.js → CreditCard01-BzBUMTax.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-wjfpXF6W.js → DotsVertical-COzw8ydu.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-JpptrruU.js → ErrorBarContext-CICGscAV.js} +1 -1
  14. package/dist/client/assets/{Image01-BVwA4uCp.js → Image01-DnRAAkhy.js} +1 -1
  15. package/dist/client/assets/{Key01-C3aJH3VU.js → Key01-DXvy1NNO.js} +1 -1
  16. package/dist/client/assets/{Line-CE2RR3X9.js → Line-DooN19Jn.js} +1 -1
  17. package/dist/client/assets/{Link01-BezCCi1I.js → Link01-iwXPIeVc.js} +1 -1
  18. package/dist/client/assets/{LinkBroken01-CYAPpruG.js → LinkBroken01-ChSpe7Cq.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-D_cGFYPK.js → LinkExternal01-BVDnNs6j.js} +1 -1
  20. package/dist/client/assets/{Monitor01-R0RI8JD-.js → Monitor01-BLZH5esy.js} +1 -1
  21. package/dist/client/assets/{Palette-Bh_thK5-.js → Palette-CaKXG6S_.js} +1 -1
  22. package/dist/client/assets/{Plus-GNsqHUli.js → Plus-DjsQQqpw.js} +1 -1
  23. package/dist/client/assets/{SearchMd-DeSQISfo.js → SearchMd-oXON6Mge.js} +1 -1
  24. package/dist/client/assets/{Sector-CPFqrWxD.js → Sector-Df4GIa0t.js} +1 -1
  25. package/dist/client/assets/{ShoppingBag01-P4dMHDVk.js → ShoppingBag01-DktiI11o.js} +1 -1
  26. package/dist/client/assets/{Sun-7PdNidQ5.js → Sun-BWosC3Su.js} +1 -1
  27. package/dist/client/assets/{Tool01-CWjV8YTI.js → Tool01-BchdJG2X.js} +1 -1
  28. package/dist/client/assets/{Trash01-BJ_e57Kj.js → Trash01-BfnCKCGB.js} +1 -1
  29. package/dist/client/assets/{Upload01-3jf5OQDv.js → Upload01-CNtxqXvb.js} +1 -1
  30. package/dist/client/assets/{User01-CN7JcgS_.js → User01-DXNh3TnB.js} +1 -1
  31. package/dist/client/assets/{UserSquare-CEkD4_s5.js → UserSquare-DZJwwd71.js} +1 -1
  32. package/dist/client/assets/{Users01-B-RFC-RT.js → Users01-DAfCqIN7.js} +1 -1
  33. package/dist/client/assets/{X-DvEbwZ22.js → X-C52mq3mn.js} +1 -1
  34. package/dist/client/assets/{XAxis-DdJd7RhS.js → XAxis-DgLHWAdH.js} +1 -1
  35. package/dist/client/assets/{XClose-eArhRgkd.js → XClose-BqRoe3QG.js} +1 -1
  36. package/dist/client/assets/{ZoomOut-B5FfXkUf.js → ZoomOut-BlDSjKri.js} +1 -1
  37. package/dist/client/assets/{access-gate-Cno0bRAg.js → access-gate-DbBQLMiF.js} +1 -1
  38. package/dist/client/assets/{add-connection-dialog-BRrDiP3N.js → add-connection-dialog-Bll7Vib1.js} +1 -1
  39. package/dist/client/assets/{agent-analytics-ZqkZ1GcW.js → agent-analytics-DRKGLO_x.js} +1 -1
  40. package/dist/client/assets/agent-app-DI84JCkP.js +1 -0
  41. package/dist/client/assets/{agent-assets-2FdntYeU.js → agent-assets-D9BHI5EW.js} +1 -1
  42. package/dist/client/assets/{agent-automation-DeOilbKj.js → agent-automation-ClR5yW20.js} +1 -1
  43. package/dist/client/assets/{agent-automations-CU5BfClm.js → agent-automations-CCiWhcgf.js} +1 -1
  44. package/dist/client/assets/{agent-connect-sources-BlWCNkZ9.js → agent-connect-sources-DFTkcmVS.js} +1 -1
  45. package/dist/client/assets/agent-deck-CgsUwnay.js +1 -0
  46. package/dist/client/assets/{agent-e2e-Dp5CImx5.js → agent-e2e-pbVC7Vx7.js} +1 -1
  47. package/dist/client/assets/{agent-experiments-CT9FOKqn.js → agent-experiments-_aODOZpq.js} +1 -1
  48. package/dist/client/assets/{agent-file-BWzZimsi.js → agent-file-DtN8kaxY.js} +1 -1
  49. package/dist/client/assets/{agent-git-C1iinKRI.js → agent-git-BCddyL27.js} +1 -1
  50. package/dist/client/assets/{agent-hosting-BsslI9uH.js → agent-hosting-CgLWSfX9.js} +1 -1
  51. package/dist/client/assets/{agent-icon-CfuzWIKW.js → agent-icon-DEoEcQYL.js} +1 -1
  52. package/dist/client/assets/agent-library-BMVOMtwg.js +1 -0
  53. package/dist/client/assets/agent-library-file-Bs_Ov692.js +1 -0
  54. package/dist/client/assets/{agent-monitor-C2aIDenY.js → agent-monitor-YUBiIydT.js} +1 -1
  55. package/dist/client/assets/{agent-overview-DDbsx1gU.js → agent-overview-HCAO8obL.js} +1 -1
  56. package/dist/client/assets/agent-settings-JOvgc7kq.js +1 -0
  57. package/dist/client/assets/{agent-site-editor-xt5GtnuW.js → agent-site-editor-DH5igdCT.js} +1 -1
  58. package/dist/client/assets/agent-site-editor-code-De-iSok_.js +2 -0
  59. package/dist/client/assets/{agent-site-editor-content-Cboi32wv.js → agent-site-editor-content-Ch2WC4sl.js} +7 -7
  60. package/dist/client/assets/{agent-site-editor-preview-C9chmhlV.js → agent-site-editor-preview-BBSy8s7P.js} +3 -3
  61. package/dist/client/assets/agent-view-BtBtSuEv.js +1 -0
  62. package/dist/client/assets/{agent-view-guard-Vq5CpblU.js → agent-view-guard-BYimT8Jz.js} +1 -1
  63. package/dist/client/assets/{agents-list-L_NaMW9r.js → agents-list-C434Mp2b.js} +1 -1
  64. package/dist/client/assets/{ai-providers-C1Gld-NP.js → ai-providers-DINDBcoG.js} +1 -1
  65. package/dist/client/assets/{alert-DSDuF6qI.js → alert-_Nu0OQ4m.js} +1 -1
  66. package/dist/client/assets/{alert-dialog-BbSmZoVi.js → alert-dialog-D9wz_Poi.js} +1 -1
  67. package/dist/client/assets/{analytics-sections-B7erlEU9.js → analytics-sections-_zTIyETq.js} +1 -1
  68. package/dist/client/assets/api-keys-2hDzDTH9.js +1 -0
  69. package/dist/client/assets/{api-keys-DJHmuI-k.js → api-keys-tqQH4z9A.js} +1 -1
  70. package/dist/client/assets/app-editor-BqD9kpqg.js +1 -0
  71. package/dist/client/assets/{asset-utils-CiYXoNyJ.js → asset-utils-WUpNFBXm.js} +1 -1
  72. package/dist/client/assets/{auth-5kOh9gsa.js → auth-DDdLUET9.js} +1 -1
  73. package/dist/client/assets/{auth-catchall-DxlXq7tK.js → auth-catchall-mR81Birw.js} +1 -1
  74. package/dist/client/assets/{auth-entry-Exunf2v5.js → auth-entry-DCUAgWIX.js} +1 -1
  75. package/dist/client/assets/{auth-split-layout-BAIpdvCx.js → auth-split-layout-FX4F99rm.js} +1 -1
  76. package/dist/client/assets/{authenticate-and-persist-oauth-IbhNDJn9.js → authenticate-and-persist-oauth-Bb2l090x.js} +1 -1
  77. package/dist/client/assets/{automation-list-row-BGPK9DDr.js → automation-list-row-SxUdqZJz.js} +1 -1
  78. package/dist/client/assets/{automation-runs-79Bdx95q.js → automation-runs-Cw-2J5pa.js} +1 -1
  79. package/dist/client/assets/{automations-DEsgrDFl.js → automations-DXUfchhU.js} +1 -1
  80. package/dist/client/assets/{autosend-CsHrH9Xo.js → autosend-CeDtnxlk.js} +1 -1
  81. package/dist/client/assets/{avatar-CrasAAzq.js → avatar-BeFEVdWT.js} +1 -1
  82. package/dist/client/assets/{badge-BrDXjbHd.js → badge-Dw0XHZAq.js} +1 -1
  83. package/dist/client/assets/block-document-HhERskFc.js +3 -0
  84. package/dist/client/assets/{blocks-preview-workspace-context-DAcrAS0Y.js → blocks-preview-workspace-context-BqdqlnAP.js} +1 -1
  85. package/dist/client/assets/{blog-schema-CpOSYi5o.js → blog-schema-Bzw5lTdw.js} +1 -1
  86. package/dist/client/assets/{buckets-CJHv6B92.js → buckets-C_vclPuO.js} +1 -1
  87. package/dist/client/assets/{build-improve-prompt-doc-Dp9hBbaC.js → build-improve-prompt-doc-DG46Mbz-.js} +1 -1
  88. package/dist/client/assets/{calendar-DJbd_Mk0.js → calendar-BGvJ_APz.js} +1 -1
  89. package/dist/client/assets/{capability-load-error-B8JQAANB.js → capability-load-error-m8D5eiRW.js} +1 -1
  90. package/dist/client/assets/category-editor-BoAaFme1.js +1 -0
  91. package/dist/client/assets/{chart-CrYOX1s7.js → chart-AQf5J0lZ.js} +1 -1
  92. package/dist/client/assets/{chat-context-CbVc7tEo.js → chat-context-DHGUafJ4.js} +1 -1
  93. package/dist/client/assets/{chat-draft-DCJfKWx2.js → chat-draft-Du6X8nKJ.js} +1 -1
  94. package/dist/client/assets/{checkbox-C68xjrg5.js → checkbox-D-g_vU3W.js} +1 -1
  95. package/dist/client/assets/{choose-editor-9DBH_8WX.js → choose-editor-DJMezn9k.js} +1 -1
  96. package/dist/client/assets/{claim-phase-copy-C42LUZgr.js → claim-phase-copy-BTrkr4bY.js} +1 -1
  97. package/dist/client/assets/{cli-auth-success-CQ-Ph_Z8.js → cli-auth-success-M_9Lwmu5.js} +1 -1
  98. package/dist/client/assets/{client-icons-B2afUpOp.js → client-icons-Do1roBGh.js} +1 -1
  99. package/dist/client/assets/{collapsible-BouI-hE9.js → collapsible-DUefED3P.js} +1 -1
  100. package/dist/client/assets/{collection-detail-BIyd346E.js → collection-detail-CuQUNXH_.js} +1 -1
  101. package/dist/client/assets/{collection-display-button-CJGrnpdv.js → collection-display-button-CMHxbURQ.js} +1 -1
  102. package/dist/client/assets/{collection-search-FRa3rbYr.js → collection-search-CKxipBbw.js} +1 -1
  103. package/dist/client/assets/{collection-table-wrapper-CWM8G_TB.js → collection-table-wrapper-CN227TJm.js} +1 -1
  104. package/dist/client/assets/{collection-tabs-JVe-o8Om.js → collection-tabs-z-VIWVMA.js} +1 -1
  105. package/dist/client/assets/{column-rules-D2GeNGaF.js → column-rules-BOkclOCh.js} +1 -1
  106. package/dist/client/assets/{combobox-BYzyVsfP.js → combobox-D_pkyBdU.js} +1 -1
  107. package/dist/client/assets/{command-DA3SiBwF.js → command-B-LkMxT6.js} +1 -1
  108. package/dist/client/assets/{companion-mcps-section-nJ90DS7n.js → companion-mcps-section-BPWHNlmG.js} +1 -1
  109. package/dist/client/assets/{config-CiQU6gsO.js → config-F8FEDZHV.js} +1 -1
  110. package/dist/client/assets/{connect-BfDqgAhE.js → connect-CSAnQalo.js} +1 -1
  111. package/dist/client/assets/{connect-layout-D9lxOI4T.js → connect-layout-CSKeZ95g.js} +1 -1
  112. package/dist/client/assets/{connection-B1RIZdkW.js → connection-Da57b2wi.js} +1 -1
  113. package/dist/client/assets/{connection-card-CBKnCj0k.js → connection-card-UvAhqwBj.js} +1 -1
  114. package/dist/client/assets/{connection-detail-DCoDGHIg.js → connection-detail-C-Hcx_Z9.js} +1 -1
  115. package/dist/client/assets/{connection-form-helpers-CTzk01jW.js → connection-form-helpers-DyaTkO-i.js} +1 -1
  116. package/dist/client/assets/{connections-g7AYRhCW.js → connections-B2s4aP98.js} +1 -1
  117. package/dist/client/assets/{context-CtvGGIuc.js → context-BPEjFj2c.js} +1 -1
  118. package/dist/client/assets/{context-menu-BHpyeRN3.js → context-menu-D65fsibc.js} +1 -1
  119. package/dist/client/assets/{create-organization-dialog-DM0EVF-D.js → create-organization-dialog-rmBJe-TK.js} +1 -1
  120. package/dist/client/assets/{daily-pulse-BOdn-UxC.js → daily-pulse-39bOcAjW.js} +1 -1
  121. package/dist/client/assets/{decopilot-BEZXwH2l.js → decopilot-CDg-MCtI.js} +1 -1
  122. package/dist/client/assets/{device-hint-Bcob3UqV.js → device-hint-BckoyQwI.js} +1 -1
  123. package/dist/client/assets/{dialog-BJny2srB.js → dialog-C9YQM7Rb.js} +1 -1
  124. package/dist/client/assets/{discover-Be00RGyY.js → discover-B4mPS-t0.js} +1 -1
  125. package/dist/client/assets/{domain-settings-ChkNgBLE.js → domain-settings-C5SxoG2E.js} +1 -1
  126. package/dist/client/assets/{download-app-dialog-CYxTt_wl.js → download-app-dialog-D3HwAGf1.js} +1 -1
  127. package/dist/client/assets/{drawer-ugS5r2iQ.js → drawer-BbtvDSmI.js} +1 -1
  128. package/dist/client/assets/{editor-BFX6ra4l.js → editor-DiFPb_7W.js} +1 -1
  129. package/dist/client/assets/{empty-state-CrLuHHe8.js → empty-state-ChIdoRAZ.js} +1 -1
  130. package/dist/client/assets/{empty-state-BgjT33mH.js → empty-state-Jq3vDmCi.js} +1 -1
  131. package/dist/client/assets/{extract-connection-data-DzRM76JF.js → extract-connection-data-0OXYM8zm.js} +1 -1
  132. package/dist/client/assets/{feature-gate-D5RLRNV5.js → feature-gate-DyX-49Cz.js} +1 -1
  133. package/dist/client/assets/{feature-paywall-BOUIyLME.js → feature-paywall-CMm2o9Ho.js} +1 -1
  134. package/dist/client/assets/{file-explorer-WHZll4h4.js → file-explorer-BsD7GHt-.js} +1 -1
  135. package/dist/client/assets/{file-preview-C0y1VI3d.js → file-preview-DG7_swxk.js} +1 -1
  136. package/dist/client/assets/{file-share-button-BIJj7BbT.js → file-share-button-d423tG-P.js} +1 -1
  137. package/dist/client/assets/{file-type-icon-CvWWoRAO.js → file-type-icon-Zo3jfkM-.js} +1 -1
  138. package/dist/client/assets/flat-project-DUdVe5OD.js +1 -0
  139. package/dist/client/assets/{folder-icon-CMZRw_lE.js → folder-icon-DrGtPSK9.js} +1 -1
  140. package/dist/client/assets/{form-BsbEXxEk.js → form-CYA-1Wz9.js} +1 -1
  141. package/dist/client/assets/{gateway-client-DPQb-ray.js → gateway-client-DE4QITdV.js} +1 -1
  142. package/dist/client/assets/{general-DcmU5ljh.js → general-C_08074W.js} +1 -1
  143. package/dist/client/assets/{home-Cluz7ZcZ.js → home-HCpI5IEw.js} +1 -1
  144. package/dist/client/assets/{icon-button-Cpld4nrH.js → icon-button-Cag62vyF.js} +1 -1
  145. package/dist/client/assets/{index-CMWyW-nP.js → index-BGzd8qMa.js} +1 -1
  146. package/dist/client/assets/{index-C5LlvZFc.js → index-BiuSAlzd.js} +6 -6
  147. package/dist/client/assets/{index-B7-3R-Wc.js → index-BxwNVsQv.js} +1 -1
  148. package/dist/client/assets/{index-DR8phzsm.js → index-C-HKqiI5.js} +1 -1
  149. package/dist/client/assets/{index-BmjSoeeS.js → index-C9yvlucI.js} +1 -1
  150. package/dist/client/assets/{index-Bnq5a3RF.js → index-CFxmc0DR.js} +1 -1
  151. package/dist/client/assets/{index-DnCv4gDA.js → index-D3bKcVsq.js} +1 -1
  152. package/dist/client/assets/{index-svk4_uTN.js → index-DBg3Da4o.js} +1 -1
  153. package/dist/client/assets/{index-Dm8tF0P6.js → index-DX971x0F.js} +1 -1
  154. package/dist/client/assets/{index-LUzyiStE.js → index-Dm3Ro6iT.js} +1 -1
  155. package/dist/client/assets/{index-CFVUUkFw.js → index-DzWyHXO2.js} +1 -1
  156. package/dist/client/assets/{index-BnLwnO1e.js → index-LffHYdj2.js} +1 -1
  157. package/dist/client/assets/{index-CeE78dnN.js → index-UAWA_mBS.js} +1 -1
  158. package/dist/client/assets/{index-BsSf6-Tp.js → index-cj3FPIlo.js} +1 -1
  159. package/dist/client/assets/{index-CMxk_Q0b.js → index-qFmYqkwW.js} +3 -3
  160. package/dist/client/assets/{index-redirect-2EYYlLWV.js → index-redirect-Cms0d9Rf.js} +1 -1
  161. package/dist/client/assets/{infiniteQueryObserver-DS3r5RyQ.js → infiniteQueryObserver-B7-m24Hr.js} +1 -1
  162. package/dist/client/assets/{infra-billing-BP0k6gQd.js → infra-billing-BD4W3COQ.js} +1 -1
  163. package/dist/client/assets/{input-NPHEwu7D.js → input-B5d33h6X.js} +1 -1
  164. package/dist/client/assets/{input-DtRnGymn.js → input-CYlwvkm5.js} +3 -3
  165. package/dist/client/assets/{input-BYbHl7fH.js → input-CpjWxr53.js} +1 -1
  166. package/dist/client/assets/{integration-icon-Db99lv2a.js → integration-icon-BcFb9WXn.js} +1 -1
  167. package/dist/client/assets/{label-DFV1EjGx.js → label-BmSaj4OS.js} +1 -1
  168. package/dist/client/assets/{layout-DT9fBwIn.js → layout-DKTnWTMe.js} +1 -1
  169. package/dist/client/assets/{legacy-agents-deep-CB9Z2QQP.js → legacy-agents-deep-CbFqRQlc.js} +1 -1
  170. package/dist/client/assets/{legacy-main-redirect-DL_OU_ve.js → legacy-main-redirect-1k1KX6mL.js} +1 -1
  171. package/dist/client/assets/library-D9RnFFGm.js +1 -0
  172. package/dist/client/assets/{library-tab-zwg8I-zT.js → library-tab-rskkU2DA.js} +1 -1
  173. package/dist/client/assets/{login-B_u9hKdd.js → login-BUVWJTBG.js} +1 -1
  174. package/dist/client/assets/{markdown-BNkxJvOO.js → markdown-D5RcIxaz.js} +1 -1
  175. package/dist/client/assets/{mcp-app-renderer-BEPdGRWf.js → mcp-app-renderer-4bTrB0jF.js} +1 -1
  176. package/dist/client/assets/{mcp-oauth-B9fQInjX.js → mcp-oauth-C-EEuNZg.js} +1 -1
  177. package/dist/client/assets/{members-BDa5FNmm.js → members-CWz-dF_G.js} +1 -1
  178. package/dist/client/assets/{memory-DLlNfrtQ.js → memory-BfINHUTl.js} +1 -1
  179. package/dist/client/assets/{message-templates-BfVwoNvk.js → message-templates-Cq847r4U.js} +1 -1
  180. package/dist/client/assets/{mini-report-page-Ci8p_7Qc.js → mini-report-page-BxFxCQ_x.js} +1 -1
  181. package/dist/client/assets/{mock-board-CWXm4av0.js → mock-board-BFAIWkA7.js} +1 -1
  182. package/dist/client/assets/{monaco-editor-D29Kd2Kr.js → monaco-editor-DrtzucP0.js} +1 -1
  183. package/dist/client/assets/{monitoring-stats-row-slQbN1nA.js → monitoring-stats-row-DWbeH1RS.js} +1 -1
  184. package/dist/client/assets/{multi-select-W9MlzeC1.js → multi-select-BidbKgY6.js} +1 -1
  185. package/dist/client/assets/{mustache-BgbWTbKV.js → mustache-Dy9IxQRw.js} +1 -1
  186. package/dist/client/assets/{new-project-dialog-CJlermXp.js → new-project-dialog-Dj5TFcCk.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-BuGfhU-z.js → oauth-callback-Diqg-5tw.js} +1 -1
  188. package/dist/client/assets/{oauth-callback-ai-provider-BAJwl5IS.js → oauth-callback-ai-provider-DdjEQJSy.js} +1 -1
  189. package/dist/client/assets/{onboarding-kTCKp428.js → onboarding-BiJRVogp.js} +1 -1
  190. package/dist/client/assets/{openai-conversation-C-yPKbTo.js → openai-conversation-Cssz-znB.js} +1 -1
  191. package/dist/client/assets/{optimistic-project-sidebar-views-CIecA9o-.js → optimistic-project-sidebar-views-Bl6nsH4A.js} +1 -1
  192. package/dist/client/assets/{org-file-open-context-C7-ltXbm.js → org-file-open-context-CTyFwctz.js} +1 -1
  193. package/dist/client/assets/{organization-choice-D3SzAbEY.js → organization-choice-BtNQMYzV.js} +1 -1
  194. package/dist/client/assets/{orgs-BGO2o2om.js → orgs-BYnZJx1z.js} +1 -1
  195. package/dist/client/assets/{page-seo-form-syG_NsyC.js → page-seo-form-RJHH5jjR.js} +1 -1
  196. package/dist/client/assets/{pair-BXahrBJ-.js → pair-PmQIQCBI.js} +1 -1
  197. package/dist/client/assets/{plan-ladder-jHsL2xiU.js → plan-ladder-BbGn-NgZ.js} +1 -1
  198. package/dist/client/assets/{popover-98ItoIiE.js → popover-DwQhmYZx.js} +1 -1
  199. package/dist/client/assets/{post-calendar-DA7gf-iD.js → post-calendar-u9yIz1ap.js} +1 -1
  200. package/dist/client/assets/post-editor-zwUoRB_d.js +2 -0
  201. package/dist/client/assets/{preview-content-B3SrY9U6.js → preview-content-YklxPrDD.js} +1 -1
  202. package/dist/client/assets/{preview-dialog-DtE8hySm.js → preview-dialog-B6-Ghng-.js} +1 -1
  203. package/dist/client/assets/{profile-BqkkPgHb.js → profile-DZ3TYytY.js} +1 -1
  204. package/dist/client/assets/{project-app-view-DJNcLbfl.js → project-app-view-B13_tHdE.js} +1 -1
  205. package/dist/client/assets/{project-feed-5oGhucIT.js → project-feed-CuWJElvp.js} +1 -1
  206. package/dist/client/assets/{project-icon-ss5TCI0R.js → project-icon-C1TVO88N.js} +1 -1
  207. package/dist/client/assets/project-reports-hbeMiS7q.js +1 -0
  208. package/dist/client/assets/project-tasks-DcinQO1a.js +1 -0
  209. package/dist/client/assets/{projects-empty-state-AWojsVAU.js → projects-empty-state-BBcr5xLl.js} +1 -1
  210. package/dist/client/assets/{projects-C0NE_8ue.js → projects-qlg8VwGy.js} +1 -1
  211. package/dist/client/assets/{prompts-CkLT7Pp3.js → prompts-IW4xrems.js} +1 -1
  212. package/dist/client/assets/record-editor-DZiiw2X4.js +1 -0
  213. package/dist/client/assets/{redirect-editor-Co-NnhcC.js → redirect-editor-Djr6TkEe.js} +1 -1
  214. package/dist/client/assets/{reports-BZp0upxy.js → reports-DD_aD-uv.js} +1 -1
  215. package/dist/client/assets/reports-RkncIczX.js +1 -0
  216. package/dist/client/assets/{reports-onboarding-BBsNQaBV.js → reports-onboarding-Btv0f8sO.js} +1 -1
  217. package/dist/client/assets/{reports-tab-yZ-nVssc.js → reports-tab-DoBMpRJD.js} +2 -2
  218. package/dist/client/assets/{repositories-DuKOCOxg.js → repositories-ZgvcUEvA.js} +1 -1
  219. package/dist/client/assets/{repository-binding-BzfYTDYg.js → repository-binding-CQsr_3Zk.js} +1 -1
  220. package/dist/client/assets/{repository-import-picker-BZ4SbZxQ.js → repository-import-picker-D6vKdpbU.js} +1 -1
  221. package/dist/client/assets/{repository-picker-Bzznh2XU.js → repository-picker-DnfKLU2E.js} +1 -1
  222. package/dist/client/assets/{require-capability-ZVnNGQoT.js → require-capability-B1clucXi.js} +1 -1
  223. package/dist/client/assets/{required-auth-layout-DanliwF9.js → required-auth-layout-5x9XYN7k.js} +1 -1
  224. package/dist/client/assets/{reset-password-DW3qLKpy.js → reset-password-JId6yrpe.js} +1 -1
  225. package/dist/client/assets/{resizable-DywAIc1-.js → resizable-00FuDjCF.js} +1 -1
  226. package/dist/client/assets/{resolve-tab-icon-C5M35tEP.js → resolve-tab-icon-Bi-w5DjE.js} +1 -1
  227. package/dist/client/assets/{review-settings-Cu2P77Gp.js → review-settings-IzuHTtkG.js} +1 -1
  228. package/dist/client/assets/{rich-text-link-control-DGgBIkoQ.js → rich-text-link-control-B3wmUrSm.js} +1 -1
  229. package/dist/client/assets/{roles-55Tdfjs_.js → roles-6EAMaiCw.js} +1 -1
  230. package/dist/client/assets/{route-BSEkxVC-.js → route-Bp7poLJJ.js} +1 -1
  231. package/dist/client/assets/route-DLd5XMus.js +1 -0
  232. package/dist/client/assets/{route-BvV_LTTA.js → route-DcKDacvo.js} +1 -1
  233. package/dist/client/assets/{runnable-block-editor-246vsgYp.js → runnable-block-editor-BPu9lbHb.js} +2 -2
  234. package/dist/client/assets/{sandbox-lifecycle-context-BvXjf7rx.js → sandbox-lifecycle-context-_l6ILxBR.js} +1 -1
  235. package/dist/client/assets/{schema-DvFu1ToO.js → schema-CepQKFSq.js} +1 -1
  236. package/dist/client/assets/{scroll-area-DaBuMKS9.js → scroll-area-BNMPUKzn.js} +1 -1
  237. package/dist/client/assets/{search-input--Cs2kN0G.js → search-input-DroJjkYC.js} +1 -1
  238. package/dist/client/assets/{search-toggle-C3WefJ2y.js → search-toggle-Vpxqce5X.js} +1 -1
  239. package/dist/client/assets/{secret-picker-CEdXEQdI.js → secret-picker-CIV9Pyxx.js} +1 -1
  240. package/dist/client/assets/{secrets-CqHQ9R62.js → secrets-Ddw-OUj-.js} +1 -1
  241. package/dist/client/assets/{sections-editor-BBgqWNXJ.js → sections-editor-B6DapFds.js} +1 -1
  242. package/dist/client/assets/{select-BlojSjop.js → select-QknS4jya.js} +1 -1
  243. package/dist/client/assets/{select-model-qkZsSZ-s.js → select-model-MWiJU5BO.js} +1 -1
  244. package/dist/client/assets/{seo-editor-vSFjIyB8.js → seo-editor-BmySIXEZ.js} +1 -1
  245. package/dist/client/assets/{separator-DVd2LxRQ.js → separator-C5QeX-ze.js} +1 -1
  246. package/dist/client/assets/{settings-tab-BB1cUOmY.js → settings-tab-pWdRgoZd.js} +1 -1
  247. package/dist/client/assets/{sheet-DhV5S-lN.js → sheet-CuQcjl8J.js} +1 -1
  248. package/dist/client/assets/{shell-layout-BCgx5xUt.js → shell-layout-DgCL-aOA.js} +1 -1
  249. package/dist/client/assets/{skills-CGor4YeE.js → skills-C9HRCrz7.js} +1 -1
  250. package/dist/client/assets/{sso-DT447B-z.js → sso-eRxfAwx6.js} +1 -1
  251. package/dist/client/assets/{suggestion-20OWsU93.js → suggestion-CUAhSpKi.js} +1 -1
  252. package/dist/client/assets/{switch-CMfc7QV5.js → switch-WI6sluFx.js} +1 -1
  253. package/dist/client/assets/{synced-repos-mHQN0OHN.js → synced-repos-B7M4g-ab.js} +1 -1
  254. package/dist/client/assets/{tab-icon-glyph-Cv2jvczH.js → tab-icon-glyph-BUy8eStz.js} +1 -1
  255. package/dist/client/assets/{table-Dh5pobpb.js → table-DahiKrUr.js} +1 -1
  256. package/dist/client/assets/{tabs-BQf21wqw.js → tabs-mZ2AJpie.js} +1 -1
  257. package/dist/client/assets/{task-board-DGnwsIns.js → task-board-Cg5OuTdd.js} +1 -1
  258. package/dist/client/assets/{task-route-T3lqK1Fh.js → task-route-CcdO9T8s.js} +1 -1
  259. package/dist/client/assets/{task-status-BXB-vdW8.js → task-status--I5ZFulR.js} +1 -1
  260. package/dist/client/assets/{taskboard-analytics-DorE9nZU.js → taskboard-analytics-CwIKc_CA.js} +1 -1
  261. package/dist/client/assets/{tasks-DJSTWu0I.js → tasks-Cx199_rB.js} +1 -1
  262. package/dist/client/assets/tasks-DQZjFSh-.js +1 -0
  263. package/dist/client/assets/{textarea-CVYfh0wC.js → textarea-IAy-ownU.js} +1 -1
  264. package/dist/client/assets/{thread-analytics-DnKw3wA2.js → thread-analytics-DoucYhij.js} +1 -1
  265. package/dist/client/assets/{thread-button-DLBvXKcS.js → thread-button-BS5hFLVf.js} +1 -1
  266. package/dist/client/assets/{thread-intent-Cc5BAaIc.js → thread-intent-ags1XWir.js} +1 -1
  267. package/dist/client/assets/{thread-route-BfHTBheT.js → thread-route-Cbe9daAp.js} +1 -1
  268. package/dist/client/assets/{thread-route-CmSAw42O.js → thread-route-SwwHxRrN.js} +1 -1
  269. package/dist/client/assets/{thread-sheet-body-tvi3Cu-i.js → thread-sheet-body-BzLo18UG.js} +1 -1
  270. package/dist/client/assets/{toggle-group-D_XfPgvt.js → toggle-group-C7J6hm1X.js} +1 -1
  271. package/dist/client/assets/{toolbar-icon-button-CUSdjojs.js → toolbar-icon-button-MH5hFCTi.js} +1 -1
  272. package/dist/client/assets/{tooltip-66nc6La-.js → tooltip-rVl8jzih.js} +1 -1
  273. package/dist/client/assets/{track-C-MP37D4.js → track-D9Kj7slb.js} +1 -1
  274. package/dist/client/assets/{types-Ch9SdRcv.js → types-B77htmoi.js} +1 -1
  275. package/dist/client/assets/{usage-stats-yiZ6SKAb.js → usage-stats-B9NCjY7p.js} +1 -1
  276. package/dist/client/assets/{use-ai-providers-M9Gfv9f8.js → use-ai-providers-BBj3hH0A.js} +1 -1
  277. package/dist/client/assets/{use-automations-CY_zEchX.js → use-automations-BMeSuYUl.js} +1 -1
  278. package/dist/client/assets/{use-autosave-Cn0WfmQ8.js → use-autosave-DddhIIlH.js} +1 -1
  279. package/dist/client/assets/{use-chat-layout-state-EbMrj1Yk.js → use-chat-layout-state-CcLE4xPO.js} +1 -1
  280. package/dist/client/assets/{use-clock-tick-Db61eAzB.js → use-clock-tick-WbPH8S5J.js} +1 -1
  281. package/dist/client/assets/{use-connect-companion-DxqzImGI.js → use-connect-companion-ooa0I2Ht.js} +1 -1
  282. package/dist/client/assets/{use-connection-aogXB8HT.js → use-connection-BJVimXqv.js} +1 -1
  283. package/dist/client/assets/{use-copy-B1c_EBRx.js → use-copy-XLZP4Fnf.js} +1 -1
  284. package/dist/client/assets/{use-create-virtual-mcp-CV_Qkq--.js → use-create-virtual-mcp-P_mw-sB2.js} +1 -1
  285. package/dist/client/assets/{use-date-fns-locale-B2cpFjnp.js → use-date-fns-locale-D1z6vY0T.js} +1 -1
  286. package/dist/client/assets/{use-debounced-autosave-CNHp8gYO.js → use-debounced-autosave-DM7h6lLt.js} +1 -1
  287. package/dist/client/assets/{use-debounced-value-C3ROkLpe.js → use-debounced-value-PqnB6cMC.js} +1 -1
  288. package/dist/client/assets/{use-deco-credits-u3-i822p.js → use-deco-credits-CWMvx_aN.js} +1 -1
  289. package/dist/client/assets/{use-decopilot-events-DSjzPVBT.js → use-decopilot-events-B_Wj2FDs.js} +1 -1
  290. package/dist/client/assets/{use-delete-connection-DUF2NW3l.js → use-delete-connection-Ct_NbrFe.js} +1 -1
  291. package/dist/client/assets/{use-deployment-admin-Cc2a3wOb.js → use-deployment-admin-BrRZ5JXH.js} +1 -1
  292. package/dist/client/assets/{use-fast-preview-draft-url-ClRKZFue.js → use-fast-preview-draft-url-Ckawo-Vn.js} +1 -1
  293. package/dist/client/assets/{use-file-configs-CF1-8iPu.js → use-file-configs-BCUJhrSS.js} +1 -1
  294. package/dist/client/assets/{use-infinite-scroll-DwjxrCBI.js → use-infinite-scroll-DOZLICG8.js} +1 -1
  295. package/dist/client/assets/{use-join-requests-CX1Z0mNX.js → use-join-requests-LL4W5sq2.js} +1 -1
  296. package/dist/client/assets/{use-main-panel-tabs-D9RE-lnQ.js → use-main-panel-tabs-CUdUAhvy.js} +1 -1
  297. package/dist/client/assets/{use-mcp-auth-status-BoAIHl4N.js → use-mcp-auth-status-D_jLHFPt.js} +1 -1
  298. package/dist/client/assets/{use-mcp-client-B2Vh9Cd7.js → use-mcp-client-5sJCC1_2.js} +1 -1
  299. package/dist/client/assets/{use-mcp-prompts-BBIzvKJ-.js → use-mcp-prompts-5OccjpiV.js} +1 -1
  300. package/dist/client/assets/{use-mcp-tools-BTm2d3TE.js → use-mcp-tools-cj_8qKci.js} +1 -1
  301. package/dist/client/assets/{use-members-C6qHLZqu.js → use-members-C5RWM84Q.js} +1 -1
  302. package/dist/client/assets/{use-mobile-Du3isCXQ.js → use-mobile-D06E6E9A.js} +1 -1
  303. package/dist/client/assets/{use-navigate-to-agent-DeIS5d_A.js → use-navigate-to-agent-2D1RSJEE.js} +1 -1
  304. package/dist/client/assets/use-new-blocks-editor-DxwEKp1u.js +1 -0
  305. package/dist/client/assets/{use-open-billing-url-C43__85H.js → use-open-billing-url-CrzuSkfk.js} +1 -1
  306. package/dist/client/assets/{use-org-auth-client-BBNuWvcV.js → use-org-auth-client-CXExidw4.js} +1 -1
  307. package/dist/client/assets/{use-org-fs-Can_Zv1k.js → use-org-fs-BI2aRf-g.js} +1 -1
  308. package/dist/client/assets/{use-org-repo-syncs-DSCXfgI7.js → use-org-repo-syncs-DhxRO-sX.js} +1 -1
  309. package/dist/client/assets/{use-org-sso-CW6lGteH.js → use-org-sso-C8LeExfy.js} +1 -1
  310. package/dist/client/assets/{use-organization-roles-BawJTbcK.js → use-organization-roles-Z4A7wlo_.js} +1 -1
  311. package/dist/client/assets/{use-organization-settings-Bq69ux21.js → use-organization-settings-0Ql08vCb.js} +1 -1
  312. package/dist/client/assets/{use-panel-navigate-BVY-Wy0A.js → use-panel-navigate-DvFfVppm.js} +1 -1
  313. package/dist/client/assets/{use-project-scope-Cg6fEvSs.js → use-project-scope-DJC0Rmd2.js} +1 -1
  314. package/dist/client/assets/{use-releases-BKi-DdL8.js → use-releases-UqMY8RcZ.js} +1 -1
  315. package/dist/client/assets/{use-reports-diagnostic-6cATxGHb.js → use-reports-diagnostic-zVwryKCp.js} +1 -1
  316. package/dist/client/assets/{use-secrets-BD6_VEse.js → use-secrets-DGDpC9hp.js} +1 -1
  317. package/dist/client/assets/{use-section-preview-base-BGOkvMCT.js → use-section-preview-base-DryOEAAN.js} +1 -1
  318. package/dist/client/assets/{use-session-runtime-XVdydjwY.js → use-session-runtime-Cosw4CCW.js} +1 -1
  319. package/dist/client/assets/{use-tags-BzBCpaxP.js → use-tags-BCCzUzPa.js} +1 -1
  320. package/dist/client/assets/{use-task-board-analytics-OYMnbU1S.js → use-task-board-analytics-CCFQvvsk.js} +1 -1
  321. package/dist/client/assets/{use-task-board-events-j6Gt2_bO.js → use-task-board-events-B2orELe0.js} +1 -1
  322. package/dist/client/assets/{use-task-metadata-BJMv-ITR.js → use-task-metadata-8O-Ga8Wr.js} +1 -1
  323. package/dist/client/assets/{use-thread-analytics-2OqfjnUQ.js → use-thread-analytics-BYmN2LQm.js} +1 -1
  324. package/dist/client/assets/{use-thread-outputs-DqGdi_Az.js → use-thread-outputs-DqnIgfuG.js} +1 -1
  325. package/dist/client/assets/useInfiniteQuery-BAMBgsXo.js +1 -0
  326. package/dist/client/assets/{useQueries-hEYaMROO.js → useQueries-Cdt1TSyJ.js} +1 -1
  327. package/dist/client/assets/useSuspenseInfiniteQuery-B_8hQc1u.js +1 -0
  328. package/dist/client/assets/{users-CVUsc3a5.js → users-BLEnjq5F.js} +1 -1
  329. package/dist/client/assets/{utils-DWTn-3pm.js → utils-BiBoFq--.js} +1 -1
  330. package/dist/client/assets/{variant-calendar-BwZCUSvP.js → variant-calendar-Csv8MReF.js} +1 -1
  331. package/dist/client/assets/{variant-matcher-override-Dv_-MENJ.js → variant-matcher-override-CdOGya1b.js} +1 -1
  332. package/dist/client/assets/{view-mode-toggle-D-i9WhgV.js → view-mode-toggle-D3nXTaNQ.js} +1 -1
  333. package/dist/client/assets/{virtual-mcp-CYrVMkY_.js → virtual-mcp-DUyYKScq.js} +1 -1
  334. package/dist/client/index.html +1 -1
  335. package/dist/server/cli.js +1 -1
  336. package/dist/server/server.js +1 -1
  337. package/package.json +1 -1
  338. package/dist/client/assets/agent-app-DrzBZfr1.js +0 -1
  339. package/dist/client/assets/agent-deck-CMkJu0nT.js +0 -1
  340. package/dist/client/assets/agent-library-BnziJi08.js +0 -1
  341. package/dist/client/assets/agent-library-file-Cf4X2sXR.js +0 -1
  342. package/dist/client/assets/agent-settings-CXCG6lM5.js +0 -1
  343. package/dist/client/assets/agent-site-editor-code-BA8Iz10L.js +0 -2
  344. package/dist/client/assets/agent-view-CWGAdnJH.js +0 -1
  345. package/dist/client/assets/api-keys-bQee7GZd.js +0 -1
  346. package/dist/client/assets/app-editor-BUUQAodh.js +0 -1
  347. package/dist/client/assets/block-document-CWFqlSnH.js +0 -3
  348. package/dist/client/assets/category-editor-DdyY6pMr.js +0 -1
  349. package/dist/client/assets/flat-project-DklPJ7ot.js +0 -1
  350. package/dist/client/assets/library-DVDKWOCj.js +0 -1
  351. package/dist/client/assets/post-editor-DJSWFkVZ.js +0 -2
  352. package/dist/client/assets/project-reports-BLn_609q.js +0 -1
  353. package/dist/client/assets/project-tasks-B2djFoeX.js +0 -1
  354. package/dist/client/assets/record-editor-DyjHgKTD.js +0 -1
  355. package/dist/client/assets/reports-z77dCvga.js +0 -1
  356. package/dist/client/assets/route-efW7oDD1.js +0 -1
  357. package/dist/client/assets/tasks-BCug_duM.js +0 -1
  358. package/dist/client/assets/use-new-blocks-editor-Bq5-foqH.js +0 -1
  359. package/dist/client/assets/useInfiniteQuery-DpDVtLXw.js +0 -1
  360. package/dist/client/assets/useSuspenseInfiniteQuery-Exur-lii.js +0 -1
@@ -1,2 +1,2 @@
1
- import{o as X,r as o,ds as Ce,dq as De,c as Pe,e as Ae,d3 as ee,X as ye,j as Ee,K as M,z as _e}from"./index-C5LlvZFc.js";import{u as Le}from"./use-mcp-client-B2Vh9Cd7.js";import{u as Ue}from"./use-session-runtime-XVdydjwY.js";import{u as Re,b as Oe}from"./chat-context-CbVc7tEo.js";import{u as Be}from"./thread-intent-Cc5BAaIc.js";import{e as ge}from"./backoff-8mStPHYB.js";import{b as Ne}from"./sandbox-url-D3mC8qhT.js";import{a as Fe}from"./repository-binding-BzfYTDYg.js";import{d as $e}from"./sandbox-start-errors-BK_aDCyt.js";function Ke(e,t){const n=X(t);return Ve({filters:{...e,status:"pending"}},n).length}function fe(e,t){return e.findAll(t.filters).map(n=>t.select?t.select(n):n.state)}function Ve(e={},t){const n=X(t).getMutationCache(),s=o.useRef(e),u=o.useRef(null);return u.current===null&&(u.current=fe(n,e)),o.useEffect(()=>{s.current=e}),o.useSyncExternalStore(o.useCallback(c=>n.subscribe(()=>{const a=Ce(u.current,fe(n,s.current));u.current!==a&&(u.current=a,De.schedule(c))}),[n]),()=>u.current,()=>u.current)}async function qe(e,t,n){const s=await e.callTool({name:t,arguments:n});if(s.isError){const u=s.content?.[0]?.text??`Tool ${t} failed without a message`;throw new Error(u)}return s}const be=["SANDBOX_START"],W=new Map,He=e=>`${e.virtualMcpId}::${e.branch??""}`,Qe=e=>e.message.includes("retry shortly"),ie=new Set,le={mark:(e,t)=>ie.add(`${e}::${t}`),clear:(e,t)=>ie.delete(`${e}::${t}`),isStopped:(e,t)=>ie.has(`${e}::${t}`)};function Ye(e,t){const n=X();return Ae({mutationKey:be,retry:(s,u)=>Qe(u)&&s<6,retryDelay:s=>ge(5e3,500,s,2,0),mutationFn:async s=>{s.branch&&le.clear(s.virtualMcpId,s.branch);const u=He(s),c=W.get(u);if(c)return c;const a=(async()=>(await qe(e,"SANDBOX_START",s)).structuredContent)();W.set(u,a);try{return await a}finally{W.get(u)===a&&W.delete(u)}},onSuccess:()=>{ee(n),t?.onStarted?.()}})}function Rt(e,t){const n=Pe.c(3);let s;return n[0]!==t||n[1]!==e?(s={mutationKey:be,predicate:c=>{if(!e)return!1;const a=c.state.variables;return!a||a.virtualMcpId!==e?!1:(a.branch??"")===(t??"")}},n[0]=t,n[1]=e,n[2]=s):s=n[2],Ke(s)>0}function Se(e){return e==="installing"||e==="install-failed"||e==="starting"||e==="start-failed"||e==="running"||e==="crashed"}const Me={phase:null,lifecycle:{phase:"idle"},status:{state:"running"},branch:{kind:"unknown"},notFound:!1,scripts:[],activeProcesses:[],getBuffer:()=>"",hasData:()=>!1,subscribeChunks:()=>()=>{},subscribeReload:()=>()=>{}},ve=o.createContext(Me),me=16384;class Xe{data="";append(t){this.data+=t,this.data.length>me&&(this.data=this.data.slice(this.data.length-me))}get(){return this.data}clear(){this.data=""}}const je=1e3,Ge=3e4,Ie=3e3,he=["lifecycle","status","tasks","scripts","branch","reload","file-changed"],pe="log";function Je(e){if(!e)return null;try{return new URL("/_sandbox/events",e).href}catch{return null}}function We(e){return e===404}async function ze(e){try{const t=await fetch(e,{headers:{Accept:"text/event-stream"},cache:"no-store",signal:AbortSignal.timeout(Ie)});return await t.body?.cancel().catch(()=>{}),We(t.status)}catch{return!1}}function gt({virtualMcpId:e,branch:t,previewUrl:n=null,enabled:s=!0,children:u}){const{org:c}=ye(),a=X(),V=Re()?.taskId??null,[j,y]=o.useState(null),[te,b]=o.useState({phase:"idle"}),[ne,U]=o.useState({state:"running"}),[re,E]=o.useState({kind:"unknown"}),[G,h]=o.useState(!1),[k,q]=o.useState([]),[se,R]=o.useState([]),[,H]=o.useState(0),v=o.useRef(new Map),O=o.useRef(new Set),w=o.useRef(new Set),C=o.useRef(null),p=Je(n),Q=Fe(e)?.metadata?.runtime?.selected==="deno",_=d=>{let S=v.current.get(d);return S||(S=new Xe,v.current.set(d,S)),S};o.useEffect(()=>{if(y(null),b({phase:"idle"}),U({state:"running"}),E({kind:"unknown"}),C.current=null,h(!1),q([]),R([]),v.current.clear(),!e||!t||!s)return;const d=Ne({orgSlug:c.slug,virtualMcpId:e,branch:t,threadId:V??null},"events");let S=!1,D=0,L=null,T=null,P=null,g=null,m=null,A=null;const I=r=>{try{const i=JSON.parse(r.data);y(i),i.kind!=="failed"&&(h(!1),D=0),i.kind==="ready"&&ae()}catch(i){console.warn("[vm-events] bad phase payload",i)}},B=()=>{h(!0),y(null),b({phase:"idle"}),U({state:"running"}),E({kind:"unknown"}),q([]),R([]),v.current.clear()},Y=r=>{try{const i=JSON.parse(r.data);if(typeof i.data!="string")return;D=0;const f=i.data.replace(/\r?\n/g,`\r
1
+ import{o as X,r as o,ds as Ce,dq as De,c as Pe,e as Ae,d3 as ee,X as ye,j as Ee,K as M,z as _e}from"./index-BiuSAlzd.js";import{u as Le}from"./use-mcp-client-5sJCC1_2.js";import{u as Ue}from"./use-session-runtime-Cosw4CCW.js";import{u as Re,b as Oe}from"./chat-context-DHGUafJ4.js";import{u as Be}from"./thread-intent-ags1XWir.js";import{e as ge}from"./backoff-8mStPHYB.js";import{b as Ne}from"./sandbox-url-D3mC8qhT.js";import{a as Fe}from"./repository-binding-CQsr_3Zk.js";import{d as $e}from"./sandbox-start-errors-BK_aDCyt.js";function Ke(e,t){const n=X(t);return Ve({filters:{...e,status:"pending"}},n).length}function fe(e,t){return e.findAll(t.filters).map(n=>t.select?t.select(n):n.state)}function Ve(e={},t){const n=X(t).getMutationCache(),s=o.useRef(e),u=o.useRef(null);return u.current===null&&(u.current=fe(n,e)),o.useEffect(()=>{s.current=e}),o.useSyncExternalStore(o.useCallback(c=>n.subscribe(()=>{const a=Ce(u.current,fe(n,s.current));u.current!==a&&(u.current=a,De.schedule(c))}),[n]),()=>u.current,()=>u.current)}async function qe(e,t,n){const s=await e.callTool({name:t,arguments:n});if(s.isError){const u=s.content?.[0]?.text??`Tool ${t} failed without a message`;throw new Error(u)}return s}const be=["SANDBOX_START"],W=new Map,He=e=>`${e.virtualMcpId}::${e.branch??""}`,Qe=e=>e.message.includes("retry shortly"),ie=new Set,le={mark:(e,t)=>ie.add(`${e}::${t}`),clear:(e,t)=>ie.delete(`${e}::${t}`),isStopped:(e,t)=>ie.has(`${e}::${t}`)};function Ye(e,t){const n=X();return Ae({mutationKey:be,retry:(s,u)=>Qe(u)&&s<6,retryDelay:s=>ge(5e3,500,s,2,0),mutationFn:async s=>{s.branch&&le.clear(s.virtualMcpId,s.branch);const u=He(s),c=W.get(u);if(c)return c;const a=(async()=>(await qe(e,"SANDBOX_START",s)).structuredContent)();W.set(u,a);try{return await a}finally{W.get(u)===a&&W.delete(u)}},onSuccess:()=>{ee(n),t?.onStarted?.()}})}function Rt(e,t){const n=Pe.c(3);let s;return n[0]!==t||n[1]!==e?(s={mutationKey:be,predicate:c=>{if(!e)return!1;const a=c.state.variables;return!a||a.virtualMcpId!==e?!1:(a.branch??"")===(t??"")}},n[0]=t,n[1]=e,n[2]=s):s=n[2],Ke(s)>0}function Se(e){return e==="installing"||e==="install-failed"||e==="starting"||e==="start-failed"||e==="running"||e==="crashed"}const Me={phase:null,lifecycle:{phase:"idle"},status:{state:"running"},branch:{kind:"unknown"},notFound:!1,scripts:[],activeProcesses:[],getBuffer:()=>"",hasData:()=>!1,subscribeChunks:()=>()=>{},subscribeReload:()=>()=>{}},ve=o.createContext(Me),me=16384;class Xe{data="";append(t){this.data+=t,this.data.length>me&&(this.data=this.data.slice(this.data.length-me))}get(){return this.data}clear(){this.data=""}}const je=1e3,Ge=3e4,Ie=3e3,he=["lifecycle","status","tasks","scripts","branch","reload","file-changed"],pe="log";function Je(e){if(!e)return null;try{return new URL("/_sandbox/events",e).href}catch{return null}}function We(e){return e===404}async function ze(e){try{const t=await fetch(e,{headers:{Accept:"text/event-stream"},cache:"no-store",signal:AbortSignal.timeout(Ie)});return await t.body?.cancel().catch(()=>{}),We(t.status)}catch{return!1}}function gt({virtualMcpId:e,branch:t,previewUrl:n=null,enabled:s=!0,children:u}){const{org:c}=ye(),a=X(),V=Re()?.taskId??null,[j,y]=o.useState(null),[te,b]=o.useState({phase:"idle"}),[ne,U]=o.useState({state:"running"}),[re,E]=o.useState({kind:"unknown"}),[G,h]=o.useState(!1),[k,q]=o.useState([]),[se,R]=o.useState([]),[,H]=o.useState(0),v=o.useRef(new Map),O=o.useRef(new Set),w=o.useRef(new Set),C=o.useRef(null),p=Je(n),Q=Fe(e)?.metadata?.runtime?.selected==="deno",_=d=>{let S=v.current.get(d);return S||(S=new Xe,v.current.set(d,S)),S};o.useEffect(()=>{if(y(null),b({phase:"idle"}),U({state:"running"}),E({kind:"unknown"}),C.current=null,h(!1),q([]),R([]),v.current.clear(),!e||!t||!s)return;const d=Ne({orgSlug:c.slug,virtualMcpId:e,branch:t,threadId:V??null},"events");let S=!1,D=0,L=null,T=null,P=null,g=null,m=null,A=null;const I=r=>{try{const i=JSON.parse(r.data);y(i),i.kind!=="failed"&&(h(!1),D=0),i.kind==="ready"&&ae()}catch(i){console.warn("[vm-events] bad phase payload",i)}},B=()=>{h(!0),y(null),b({phase:"idle"}),U({state:"running"}),E({kind:"unknown"}),q([]),R([]),v.current.clear()},Y=r=>{try{const i=JSON.parse(r.data);if(typeof i.data!="string")return;D=0;const f=i.data.replace(/\r?\n/g,`\r
2
2
  `);_(i.source).append(f);for(const l of O.current)try{l(i.source,f)}catch{}H(l=>l+1)}catch{}},J=r=>{const i=r.type;try{const f=JSON.parse(r.data);switch(D=0,i){case"lifecycle":{const l=f;b(l.state);const F=`${c.slug}/${e}/${t}`;if(Se(l.state.phase)&&!(A&&Se(A))){ee(a,c.id);const K=M.decofile(F);a.getQueryData(K)===void 0&&a.invalidateQueries({queryKey:K})}l.state.phase==="running"&&A!=="running"&&(ee(a,c.id),a.invalidateQueries({queryKey:M.decofile(F)}),a.invalidateQueries({queryKey:M.liveMeta(c.slug,e,t)})),A=l.state.phase;const $=l.state.phase==="running"?l.state.port:null,ce=C.current;if(C.current=$,ce!==null&&$!==null&&ce!==$)for(const K of w.current)try{K()}catch{}return}case"status":U(f);return;case"tasks":{const F=f.active.map($=>$.logName??"").filter(Boolean);R(F);return}case"scripts":q(f.scripts);return;case"branch":{const l=f.meta;E(l);return}case"reload":for(const l of w.current)try{l()}catch{}return;case"file-changed":{const{path:l}=f,F=`${c.slug}/${e}/${t}`;if(l.startsWith(".deco/")||l.includes("/.deco/")){if(!(A==="running"))return;P&&clearTimeout(P),P=setTimeout(()=>{if(P=null,a.invalidateQueries({queryKey:M.decofile(F)}),Q)for(const K of w.current)try{K()}catch{}},500)}else T&&clearTimeout(T),T=setTimeout(()=>{T=null,a.invalidateQueries({queryKey:M.liveMeta(c.slug,e,t)})},1e3);return}}}catch{}};function N(){if(S)return;const r=new EventSource(d);g=r,r.onopen=()=>{},r.onerror=()=>{g===r&&r.readyState===EventSource.CLOSED&&x("studio")},r.addEventListener("phase",I),r.addEventListener("gone",B),r.addEventListener(pe,Y);for(const i of he)r.addEventListener(i,J)}function ae(){if(S||!p||m)return;const r=new EventSource(p);m=r;let i=!1;r.onopen=()=>{if(S||m!==r)return;i=!0,D=0;const f=g;g=null,f?.close()},r.onerror=()=>{m===r&&r.readyState===EventSource.CLOSED&&ue(r,i)},r.addEventListener(pe,Y);for(const f of he)r.addEventListener(f,J)}async function ue(r,i){const f=p?await ze(p):!1;if(!(S||m!==r)){if(r.close(),m=null,f){B(),g||N();return}i&&x("direct")}}function x(r){if(S||L)return;const i=ge(Ge,je,D,2,0);D++,L=setTimeout(()=>{if(L=null,!S){if(r==="direct"){m?.close(),m=null,ae();return}g?.close(),g=null,N()}},i)}return N(),()=>{S=!0,g?.close(),m?.close(),L&&clearTimeout(L),T&&clearTimeout(T),P&&clearTimeout(P)}},[e,t,c.slug,c.id,s,V,p,a,Q]);const oe={phase:j,lifecycle:te,status:ne,branch:re,notFound:G,scripts:k,activeProcesses:se,getBuffer:d=>v.current.get(d)?.get()??"",hasData:d=>(v.current.get(d)?.get().length??0)>0,subscribeChunks:d=>(O.current.add(d),()=>{O.current.delete(d)}),subscribeReload:d=>(w.current.add(d),()=>{w.current.delete(d)})};return Ee.jsx(ve,{value:oe,children:u})}function de(){return o.use(ve)}function bt(e){const{subscribeChunks:t}=de(),n=o.useRef(e);n.current=e,o.useEffect(()=>t((c,a)=>{n.current?.(c,a)}),[t])}function vt(e){const{subscribeReload:t}=de(),n=o.useRef(e);n.current=e,o.useEffect(()=>t(()=>{n.current?.()}),[t])}function Ze(e){return e.appPaused||e.userStopped?{kind:"suspended"}:e.startError&&!e.previewUrl?{kind:"errored",error:e.startError}:e.previewUrl?{kind:"iframe",previewUrl:e.previewUrl}:{kind:"starting"}}function et(e){return e.executionEnabled&&e.sessionRuntime==="sandbox"&&e.hasActiveRepository&&!!e.userId&&!!e.branch&&!e.vmEntry&&!e.userStopped&&!e.isPending&&!e.attempted}function wt(e){return e.threadLoaded&&e.isOwner&&e.hasActiveRepository&&!e.branch&&!e.attempted}function tt(e){return e.executionEnabled&&e.notFound&&!!e.deadVmId&&!e.isPending&&!e.userStopped&&e.deadVmId!==e.lastDeadVmId}function Tt(e){const{agentSandboxMap:t,threadSandboxMap:n,userId:s,branch:u}=e,c=e.ownerId??s;if(!s||!c||!u)return t;const a=n?.[c]?.[u];return a?{...t??{},[s]:{...t?.[s]??{},[u]:a}}:t}function z(e,t,n){const s={virtualMcpId:e};return t&&(s.branch=t),n&&(s.threadId=n),s}const we=2,nt=new Set(["scheduling-timeout","reconciler-error","claim-never-created","unknown"]);function Te(e){return nt.has(e)}function rt(e){return e.executionEnabled&&e.failedReason!==null&&Te(e.failedReason)&&e.attempts<we&&!e.isPending&&!e.userStopped&&!e.alreadyHandled}const st={branch:null,count:0,handled:!1};function ot(e,t){return e.branch===t?e:{branch:t,count:0,handled:!1}}function at(e){return e.mutationError?e.mutationError:e.phase?.kind==="failed"&&!e.startPending&&e.claimRetryExhausted?{code:null,message:e.phase.message}:null}function ut(e){switch(e.kind){case"suspended":return"suspended";case"iframe":return"running";case"starting":return"starting";case"errored":return"errored"}}function xe(e,t){return`${e??""}::${t??""}`}function ct(e){const t=e.vmEntry?.previewUrl??null;return t||(e.seeded?.key===e.key?e.seeded.url:null)}function Z(e){const{data:t,virtualMcpId:n,branch:s}=e;t?.branch&&!s&&e.setCurrentTaskBranch(t.branch),t?.previewUrl&&e.setSeededPreviewUrl({key:xe(n,t.branch??s),url:t.previewUrl})}const it={branch:null,previewState:{kind:"starting"},status:"idle",vmEntry:null,previewUrl:null,userStopped:!1,start:()=>{},stop:async()=>{},restart:async()=>{},retry:()=>{},resume:()=>{}},ke=o.createContext(it);function xt(){return o.use(ke)}function kt({executionEnabled:e,virtualMcpId:t,branch:n,userId:s,hasActiveRepository:u,vmEntry:c,threadId:a,children:V}){const{org:j}=ye(),{setCurrentTaskBranch:y}=Oe(),te=Be(),b=de(),ne=X(),U=Ue(t),re=U.resolved?U.runtime:null,E=Re()?.taskId??null,G=Le({connectionId:_e,orgId:j.id,orgSlug:j.slug}),h=Ye(G,{onStarted:()=>{a&&te?.refreshThreadMetadata(a)}}),{mutate:k,reset:q}=h,[se,R]=o.useState(null),H=o.useRef(new Set),v=o.useRef(null),[O,w]=o.useState(st),C=ot(O,n);C!==O&&w(C);const p=b.phase?.kind==="failed"?b.phase:null,Q=ct({vmEntry:c,seeded:p?null:se,key:xe(t,n)}),_=!!t&&!!n&&le.isStopped(t,n),oe=b.status.state==="paused",d=!p||!Te(p.reason)||C.count>=we,S=at({mutationError:h.isError&&h.error?$e(h.error.message):null,phase:b.phase,startPending:h.isPending,claimRetryExhausted:d}),D=Ze({previewUrl:Q,appPaused:oe,userStopped:_,startError:S}),L=ut(D),T=n??"",P=H.current.has(T),g=et({executionEnabled:e,hasActiveRepository:u,userId:s,branch:n,vmEntry:c,userStopped:_,isPending:h.isPending,attempted:P,sessionRuntime:re});o.useEffect(()=>{if(!g||!t)return;H.current.add(T);const x=z(t,n,E);k(x,{onSuccess:r=>{Z({data:r,virtualMcpId:t,branch:n,setCurrentTaskBranch:y,setSeededPreviewUrl:R})},onError:r=>{console.error("[sandbox-lifecycle] auto-start failed:",r)}})},[g,T,n,t,E,k,y,R]);const m=b.notFound?c?.sandboxHandle??null:null,A=tt({executionEnabled:e,notFound:b.notFound,deadVmId:m,lastDeadVmId:v.current,isPending:h.isPending,userStopped:_});o.useEffect(()=>{if(!A||!m||!t)return;v.current=m;const x=z(t,n,E);k(x,{onSuccess:r=>{Z({data:r,virtualMcpId:t,branch:n,setCurrentTaskBranch:y,setSeededPreviewUrl:R})},onError:r=>{console.error("[sandbox-lifecycle] self-heal failed:",r)}})},[A,m,t,n,E,k,y,R]);const I=rt({executionEnabled:e,failedReason:p?.reason??null,attempts:C.count,isPending:h.isPending,userStopped:_,alreadyHandled:C.handled});o.useEffect(()=>{if(!p){w(r=>r.handled?{...r,handled:!1}:r);return}if(!I||!t)return;w(r=>({...r,handled:!0,count:r.count+1}));const x=z(t,n,E);k(x,{onSuccess:r=>{Z({data:r,virtualMcpId:t,branch:n,setCurrentTaskBranch:y,setSeededPreviewUrl:R})},onError:r=>{console.error("[sandbox-lifecycle] claim auto-retry failed:",r)}})},[p,I,t,n,E,k,y,R]);const B=()=>{if(!e||!t)return;const x=z(t,n,E);k(x,{onSuccess:r=>{Z({data:r,virtualMcpId:t,branch:n,setCurrentTaskBranch:y,setSeededPreviewUrl:R})},onError:r=>{console.error("[sandbox-lifecycle] user start failed:",r)}})},Y=async()=>{if(!(!e||!t||!n)&&c){le.mark(t,n);try{await G.callTool({name:"SANDBOX_DELETE",arguments:{virtualMcpId:t,branch:n}})}catch{}ee(ne)}},J=async()=>{await Y(),B()},N=()=>{H.current=new Set,v.current=null,w({branch:n,count:0,handled:!1}),q(),B()},ue={branch:n,previewState:D,status:L,vmEntry:c,previewUrl:Q,userStopped:_,start:B,stop:Y,restart:J,retry:N,resume:N};return Ee.jsx(ke,{value:ue,children:V})}export{gt as S,kt as a,Ye as b,de as c,xt as d,bt as e,vt as f,Ke as g,Tt as o,wt as s,Rt as u};
@@ -1 +1 @@
1
- import{au as n,bK as t,av as e,bL as p,bM as b,bN as c,bO as h}from"./index-C5LlvZFc.js";const s=500;n({title:e().max(s),url:e().max(s),icon:e().max(s)});const i=n({keyId:e().max(s),modelId:e().max(s),title:e().max(s).optional()}).nullable();p(["fast","smart","thinking","image","web_search","deep_research"]);p(["fast","smart","thinking"]);const y=n({tiers:n({fast:i,smart:i,thinking:i,image:i,web_search:i,deep_research:i})});n({tiers:n({fast:i.optional(),smart:i.optional(),thinking:i.optional()})});const v=50,m=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/;n({host:e().min(1).max(s).regex(m).describe("Git host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:e().min(1).max(s).describe("Vault secret id holding the PAT used to authenticate this host.")});n({ids:b(e().max(s)).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});const w=n({voice_mode:t().optional(),home_task_intake_enabled:t().optional().describe("Show Task mode on the Home composer and allow reports to start tasks."),demo_mode:t().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:t().optional().describe("Curated Deco Score look: hides agent navigation, the home Customize button, and the Settings/Automations tabs. Defaulted on for orgs created by commerce onboarding."),reviewer_enabled:t().optional().describe("Run the Reviewer on a task's pull request once it's In Review — it reviews the code with the repo's stack-appropriate skills, fixes what it finds on the PR's own branch, then exercises the change on the deploy preview and approves or hands the card to a human."),qa_agent_enabled:t().optional().describe("Deprecated: see reviewer_enabled."),code_reviewer_enabled:t().optional().describe("Deprecated: see reviewer_enabled."),auto_merge:t().optional().describe("When the Reviewer approves a task's pull request, merge it automatically instead of leaving the merge to a human."),auto_resolve_conflicts:t().optional().describe("When an approved pull request can't be merged because it conflicts with its base branch, hand it back to the Super Agent to resolve the conflict (check out the branch, merge the base, push). Unset, it follows `auto_merge`; set it explicitly to run one without the other."),cheap_reviewer_model:t().optional().describe("Run the Reviewer on a cheaper model than the Super Agent that wrote the code. On by default — turning it off trades cost for some review depth."),coding_agent_org_mcps:t().optional().describe("Give a coding-agent run (the claude-code harness in a sandbox) every MCP connection in the org as its own MCP server, on top of the narrow task-run surface it always gets. Off by default: each connection is one more server the agent connects to at session start, and all of their tools land in its context."),coding_agents_claude_code:t().optional().describe("Run chats on a Code Agent (an agent imported from a GitHub repo) with the claude-code harness inside its sandbox, instead of hosted Decopilot. Off by default: it changes the runtime of every such chat, and claude-code flushes whole turns rather than streaming tokens."),auto_assign_report_tasks_to_super_agent:t().optional().describe("When a Deco Score import creates a task board item without an assignee, delegate it to the Super Agent automatically instead of leaving it unassigned."),hosting_enabled:t().optional().describe("Per-site Hosting tab (deployments, domains, deploy outcomes). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. `HOSTING_CONTROL_PLANE_GA` opens it (and its peers) to every org at once."),deco_analytics_enabled:t().optional().describe("Per-site Deco Analytics tab (traffic, realtime, usage & limits). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. `HOSTING_CONTROL_PLANE_GA` opens it (and its peers) to every org at once."),e2e_enabled:t().optional().describe("Per-site E2E tab (end-to-end test runs). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. `HOSTING_CONTROL_PLANE_GA` opens it (and its peers) to every org at once."),experiments_enabled:t().optional().describe("Per-site Experiments tab (A/B tests + variant results). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org."),monitor_enabled:t().optional().describe("Per-site Monitor tab (CDN Performance + Audience from the stats-lake warehouse). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. Its own deployment-wide switch `MONITOR_GA` opens it to every org at once (independent of the control-plane trio)."),site_create_enabled:t().optional().describe('The "Create a new site" option under New project: generates a GitHub repository from a site template in an account the org connected, and opens it as a project. Off by default, for every org — deco.cx staff included.'),delivery_lanes_enabled:t().optional().describe("Board lanes for shipping: Approved, Merged and Post-deploy Validation sit between In Review and Done, and a merged pull request lands on Merged instead of Done. For teams whose release process continues after the merge. Off by default — with it off the board and the state machine behave exactly as if the lanes did not exist."),new_blocks_editor:t().optional().describe("Use the redesigned blocks editor for every member of the organization. Off by default — the classic editor stays until an admin opts the org in."),hide_default_blog_blocks:t().optional().describe("Hide the `deco-cms/blog` built-in post blocks everywhere a post is written — the inserter, the format briefs, and generated drafts — so only the site's own `site/sections/Blog/Post/*` blocks are eligible. Off by default. Blocks already present in a post keep rendering; this only governs what can be added.")}),f=new Set(["reviewer_enabled","cheap_reviewer_model"]);function x(a,r){const d=a?.[r];return f.has(r)?d!==!1:d===!0}function A(a){const r=a?.auto_resolve_conflicts;return typeof r=="boolean"?r:a?.auto_merge===!0}const l=256*1024,g=50,o=500,u=5e3;n({id:e().describe("Brand context ID"),name:e().max(o).describe("Company name"),domain:e().max(o).describe("Company domain (e.g. example.com)"),overview:e().max(u).describe("Company overview / description"),logo:e().max(o).nullable().optional().describe("Logo URL"),favicon:e().max(o).nullable().optional().describe("Favicon URL"),ogImage:e().max(o).nullable().optional().describe("OG image URL"),fonts:n({heading:e().max(o).optional().describe("Font family for headings"),body:e().max(o).optional().describe("Font family for body text"),code:e().max(o).optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:n({primary:e().max(o).optional().describe("Primary brand color (hex)"),secondary:e().max(o).optional().describe("Secondary brand color (hex)"),accent:e().max(o).optional().describe("Accent / highlight color (hex)"),background:e().max(o).optional().describe("Background color (hex)"),foreground:e().max(o).optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:b(c(e(),h())).max(g).nullable().optional().refine(a=>a==null||JSON.stringify(a).length<=l,{message:`images must serialize to at most ${l} bytes`}).describe("Brand images"),metadata:c(e(),h()).nullable().optional().refine(a=>a==null||JSON.stringify(a).length<=l,{message:`metadata must serialize to at most ${l} bytes`}).describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:e().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:t().optional().describe("Whether this is the default brand for the organization")});export{f as D,v as G,w as O,y as S,A as a,m as b,x as o};
1
+ import{au as n,bK as t,av as e,bL as p,bM as b,bN as c,bO as h}from"./index-BiuSAlzd.js";const s=500;n({title:e().max(s),url:e().max(s),icon:e().max(s)});const i=n({keyId:e().max(s),modelId:e().max(s),title:e().max(s).optional()}).nullable();p(["fast","smart","thinking","image","web_search","deep_research"]);p(["fast","smart","thinking"]);const y=n({tiers:n({fast:i,smart:i,thinking:i,image:i,web_search:i,deep_research:i})});n({tiers:n({fast:i.optional(),smart:i.optional(),thinking:i.optional()})});const v=50,m=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/;n({host:e().min(1).max(s).regex(m).describe("Git host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:e().min(1).max(s).describe("Vault secret id holding the PAT used to authenticate this host.")});n({ids:b(e().max(s)).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});const w=n({voice_mode:t().optional(),home_task_intake_enabled:t().optional().describe("Show Task mode on the Home composer and allow reports to start tasks."),demo_mode:t().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:t().optional().describe("Curated Deco Score look: hides agent navigation, the home Customize button, and the Settings/Automations tabs. Defaulted on for orgs created by commerce onboarding."),reviewer_enabled:t().optional().describe("Run the Reviewer on a task's pull request once it's In Review — it reviews the code with the repo's stack-appropriate skills, fixes what it finds on the PR's own branch, then exercises the change on the deploy preview and approves or hands the card to a human."),qa_agent_enabled:t().optional().describe("Deprecated: see reviewer_enabled."),code_reviewer_enabled:t().optional().describe("Deprecated: see reviewer_enabled."),auto_merge:t().optional().describe("When the Reviewer approves a task's pull request, merge it automatically instead of leaving the merge to a human."),auto_resolve_conflicts:t().optional().describe("When an approved pull request can't be merged because it conflicts with its base branch, hand it back to the Super Agent to resolve the conflict (check out the branch, merge the base, push). Unset, it follows `auto_merge`; set it explicitly to run one without the other."),cheap_reviewer_model:t().optional().describe("Run the Reviewer on a cheaper model than the Super Agent that wrote the code. On by default — turning it off trades cost for some review depth."),coding_agent_org_mcps:t().optional().describe("Give a coding-agent run (the claude-code harness in a sandbox) every MCP connection in the org as its own MCP server, on top of the narrow task-run surface it always gets. Off by default: each connection is one more server the agent connects to at session start, and all of their tools land in its context."),coding_agents_claude_code:t().optional().describe("Run chats on a Code Agent (an agent imported from a GitHub repo) with the claude-code harness inside its sandbox, instead of hosted Decopilot. Off by default: it changes the runtime of every such chat, and claude-code flushes whole turns rather than streaming tokens."),auto_assign_report_tasks_to_super_agent:t().optional().describe("When a Deco Score import creates a task board item without an assignee, delegate it to the Super Agent automatically instead of leaving it unassigned."),hosting_enabled:t().optional().describe("Per-site Hosting tab (deployments, domains, deploy outcomes). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. `HOSTING_CONTROL_PLANE_GA` opens it (and its peers) to every org at once."),deco_analytics_enabled:t().optional().describe("Per-site Deco Analytics tab (traffic, realtime, usage & limits). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. `HOSTING_CONTROL_PLANE_GA` opens it (and its peers) to every org at once."),e2e_enabled:t().optional().describe("Per-site E2E tab (end-to-end test runs). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. `HOSTING_CONTROL_PLANE_GA` opens it (and its peers) to every org at once."),experiments_enabled:t().optional().describe("Per-site Experiments tab (A/B tests + variant results). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org."),monitor_enabled:t().optional().describe("Per-site Monitor tab (CDN Performance + Audience from the stats-lake warehouse). Off by default. deco.cx staff and local dev always see it; this flag is the per-client lever to open it to one external org. Its own deployment-wide switch `MONITOR_GA` opens it to every org at once (independent of the control-plane trio)."),site_create_enabled:t().optional().describe('The "Create a new site" option under New project: generates a GitHub repository from a site template in an account the org connected, and opens it as a project. Off by default, for every org — deco.cx staff included.'),delivery_lanes_enabled:t().optional().describe("Board lanes for shipping: Approved, Merged and Post-deploy Validation sit between In Review and Done, and a merged pull request lands on Merged instead of Done. For teams whose release process continues after the merge. Off by default — with it off the board and the state machine behave exactly as if the lanes did not exist."),new_blocks_editor:t().optional().describe("Use the redesigned blocks editor for every member of the organization. Off by default — the classic editor stays until an admin opts the org in."),hide_default_blog_blocks:t().optional().describe("Hide the `deco-cms/blog` built-in post blocks everywhere a post is written — the inserter, the format briefs, and generated drafts — so only the site's own `site/sections/Blog/Post/*` blocks are eligible. Off by default. Blocks already present in a post keep rendering; this only governs what can be added.")}),f=new Set(["reviewer_enabled","cheap_reviewer_model"]);function x(a,r){const d=a?.[r];return f.has(r)?d!==!1:d===!0}function A(a){const r=a?.auto_resolve_conflicts;return typeof r=="boolean"?r:a?.auto_merge===!0}const l=256*1024,g=50,o=500,u=5e3;n({id:e().describe("Brand context ID"),name:e().max(o).describe("Company name"),domain:e().max(o).describe("Company domain (e.g. example.com)"),overview:e().max(u).describe("Company overview / description"),logo:e().max(o).nullable().optional().describe("Logo URL"),favicon:e().max(o).nullable().optional().describe("Favicon URL"),ogImage:e().max(o).nullable().optional().describe("OG image URL"),fonts:n({heading:e().max(o).optional().describe("Font family for headings"),body:e().max(o).optional().describe("Font family for body text"),code:e().max(o).optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:n({primary:e().max(o).optional().describe("Primary brand color (hex)"),secondary:e().max(o).optional().describe("Secondary brand color (hex)"),accent:e().max(o).optional().describe("Accent / highlight color (hex)"),background:e().max(o).optional().describe("Background color (hex)"),foreground:e().max(o).optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:b(c(e(),h())).max(g).nullable().optional().refine(a=>a==null||JSON.stringify(a).length<=l,{message:`images must serialize to at most ${l} bytes`}).describe("Brand images"),metadata:c(e(),h()).nullable().optional().refine(a=>a==null||JSON.stringify(a).length<=l,{message:`metadata must serialize to at most ${l} bytes`}).describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:e().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:t().optional().describe("Whether this is the default brand for the organization")});export{f as D,v as G,w as O,y as S,A as a,m as b,x as o};
@@ -1 +1 @@
1
- import{r as d,bm as T,bq as ce,j as b,bo as _,bF as ae,dc as O,bp as C,bz as P,bu as ie,c as F,l as $}from"./index-C5LlvZFc.js";import{e as de}from"./select-BlojSjop.js";function ue(r,e){return d.useReducer((o,l)=>e[o][l]??o,r)}var U="ScrollArea",[q]=ae(U),[fe,m]=q(U),G=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,type:l="hover",dir:t,scrollHideDelay:n=600,...s}=r,[a,c]=d.useState(null),[u,i]=d.useState(null),[h,f]=d.useState(null),[S,w]=d.useState(null),[A,Y]=d.useState(null),[x,L]=d.useState(0),[M,j]=d.useState(0),[D,y]=d.useState(!1),[N,W]=d.useState(!1),v=T(e,R=>c(R)),p=ce(t);return b.jsx(fe,{scope:o,type:l,dir:p,scrollHideDelay:n,scrollArea:a,viewport:u,onViewportChange:i,content:h,onContentChange:f,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:D,onScrollbarXEnabledChange:y,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:L,onCornerHeightChange:j,children:b.jsx(_.div,{dir:p,...s,ref:v,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...r.style}})})});G.displayName=U;var J="ScrollAreaViewport",K=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,children:l,nonce:t,...n}=r,s=m(J,o),a=d.useRef(null),c=T(e,a,s.onViewportChange);return b.jsxs(b.Fragment,{children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),b.jsx(_.div,{"data-radix-scroll-area-viewport":"",...n,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...r.style},children:b.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});K.displayName=J;var g="ScrollAreaScrollbar",Q=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:s}=t,a=r.orientation==="horizontal";return d.useEffect(()=>(a?n(!0):s(!0),()=>{a?n(!1):s(!1)}),[a,n,s]),t.type==="hover"?b.jsx(he,{...l,ref:e,forceMount:o}):t.type==="scroll"?b.jsx(be,{...l,ref:e,forceMount:o}):t.type==="auto"?b.jsx(Z,{...l,ref:e,forceMount:o}):t.type==="always"?b.jsx(V,{...l,ref:e}):null});Q.displayName=g;var he=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),[n,s]=d.useState(!1);return d.useEffect(()=>{const a=t.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},i=()=>{c=window.setTimeout(()=>s(!1),t.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",i),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",i)}}},[t.scrollArea,t.scrollHideDelay]),b.jsx(O,{present:o||n,children:b.jsx(Z,{"data-state":n?"visible":"hidden",...l,ref:e})})}),be=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),n=r.orientation==="horizontal",s=X(()=>c("SCROLL_END"),100),[a,c]=ue("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return d.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,t.scrollHideDelay,c]),d.useEffect(()=>{const u=t.viewport,i=n?"scrollLeft":"scrollTop";if(u){let h=u[i];const f=()=>{const S=u[i];h!==S&&(c("SCROLL"),s()),h=S};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[t.viewport,n,c,s]),b.jsx(O,{present:o||a!=="hidden",children:b.jsx(V,{"data-state":a==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:C(r.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:C(r.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Z=d.forwardRef((r,e)=>{const o=m(g,r.__scopeScrollArea),{forceMount:l,...t}=r,[n,s]=d.useState(!1),a=r.orientation==="horizontal",c=X(()=>{if(o.viewport){const u=o.viewport.offsetWidth<o.viewport.scrollWidth,i=o.viewport.offsetHeight<o.viewport.scrollHeight;s(a?u:i)}},10);return E(o.viewport,c),E(o.content,c),b.jsx(O,{present:l||n,children:b.jsx(V,{"data-state":n?"visible":"hidden",...t,ref:e})})}),V=d.forwardRef((r,e)=>{const{orientation:o="vertical",...l}=r,t=m(g,r.__scopeScrollArea),n=d.useRef(null),s=d.useRef(0),[a,c]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ne(a.viewport,a.content),i={...l,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>n.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function h(f,S){return ge(f,s.current,a,S)}return o==="horizontal"?b.jsx(Se,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollLeft,S=k(f,a,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollLeft=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollLeft=h(f,t.dir))}}):o==="vertical"?b.jsx(ve,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollTop,S=k(f,a);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollTop=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollTop=h(f))}}):null}),Se=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarXChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"horizontal",...t,ref:u,sizes:o,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.x),onDragScroll:i=>r.onDragScroll(i.x),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollLeft+i.deltaX;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:z(s.paddingLeft),paddingEnd:z(s.paddingRight)}})}})}),ve=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarYChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"vertical",...t,ref:u,sizes:o,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.y),onDragScroll:i=>r.onDragScroll(i.y),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollTop+i.deltaY;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:z(s.paddingTop),paddingEnd:z(s.paddingBottom)}})}})}),[me,ee]=q(g),re=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:i,onResize:h,...f}=r,S=m(g,o),[w,A]=d.useState(null),Y=T(e,v=>A(v)),x=d.useRef(null),L=d.useRef(""),M=S.viewport,j=l.content-l.viewport,D=P(i),y=P(c),N=X(h,10);function W(v){if(x.current){const p=v.clientX-x.current.left,R=v.clientY-x.current.top;u({x:p,y:R})}}return d.useEffect(()=>{const v=p=>{const R=p.target;w?.contains(R)&&D(p,j)};return document.addEventListener("wheel",v,{passive:!1}),()=>document.removeEventListener("wheel",v,{passive:!1})},[M,w,j,D]),d.useEffect(y,[l,y]),E(w,N),E(S.content,N),b.jsx(me,{scope:o,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(s),onThumbPositionChange:y,onThumbPointerDown:P(a),children:b.jsx(_.div,{...f,ref:Y,style:{position:"absolute",...f.style},onPointerDown:C(r.onPointerDown,v=>{v.button===0&&(v.target.setPointerCapture(v.pointerId),x.current=w.getBoundingClientRect(),L.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(v))}),onPointerMove:C(r.onPointerMove,W),onPointerUp:C(r.onPointerUp,v=>{const p=v.target;p.hasPointerCapture(v.pointerId)&&p.releasePointerCapture(v.pointerId),document.body.style.webkitUserSelect=L.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",oe=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=ee(H,r.__scopeScrollArea);return b.jsx(O,{present:o||t.hasThumb,children:b.jsx(pe,{ref:e,...l})})}),pe=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,style:l,...t}=r,n=m(H,o),s=ee(H,o),{onThumbPositionChange:a}=s,c=T(e,h=>s.onThumbChange(h)),u=d.useRef(void 0),i=X(()=>{u.current&&(u.current(),u.current=void 0)},100);return d.useEffect(()=>{const h=n.viewport;if(h){const f=()=>{if(i(),!u.current){const S=xe(h,a);u.current=S,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,i,a]),b.jsx(_.div,{"data-state":s.hasThumb?"visible":"hidden",...t,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(r.onPointerDownCapture,h=>{const S=h.target.getBoundingClientRect(),w=h.clientX-S.left,A=h.clientY-S.top;s.onThumbPointerDown({x:w,y:A})}),onPointerUp:C(r.onPointerUp,s.onThumbPointerUp)})});oe.displayName=H;var B="ScrollAreaCorner",te=d.forwardRef((r,e)=>{const o=m(B,r.__scopeScrollArea),l=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&l?b.jsx(we,{...r,ref:e}):null});te.displayName=B;var we=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,...l}=r,t=m(B,o),[n,s]=d.useState(0),[a,c]=d.useState(0),u=!!(n&&a);return E(t.scrollbarX,()=>{const i=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(i),c(i)}),E(t.scrollbarY,()=>{const i=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(i),s(i)}),u?b.jsx(_.div,{...l,ref:e,style:{width:n,height:a,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...r.style}}):null});function z(r){return r?parseInt(r,10):0}function ne(r,e){const o=r/e;return isNaN(o)?0:o}function I(r){const e=ne(r.viewport,r.content),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,l=(r.scrollbar.size-o)*e;return Math.max(l,18)}function ge(r,e,o,l="ltr"){const t=I(o),n=t/2,s=e||n,a=t-s,c=o.scrollbar.paddingStart+s,u=o.scrollbar.size-o.scrollbar.paddingEnd-a,i=o.content-o.viewport,h=l==="ltr"?[0,i]:[i*-1,0];return le([c,u],h)(r)}function k(r,e,o="ltr"){const l=I(e),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=e.scrollbar.size-t,s=e.content-e.viewport,a=n-l,c=o==="ltr"?[0,s]:[s*-1,0],u=de(r,c);return le([0,s],[0,a])(u)}function le(r,e){return o=>{if(r[0]===r[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(r[1]-r[0]);return e[0]+l*(o-r[0])}}function se(r,e){return r>0&&r<e}var xe=(r,e=()=>{})=>{let o={left:r.scrollLeft,top:r.scrollTop},l=0;return(function t(){const n={left:r.scrollLeft,top:r.scrollTop},s=o.left!==n.left,a=o.top!==n.top;(s||a)&&e(),o=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(r,e){const o=P(r),l=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(l.current),[]),d.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(o,e)},[o,e])}function E(r,e){const o=P(e);ie(()=>{let l=0;if(r){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(o)});return t.observe(r),()=>{window.cancelAnimationFrame(l),t.unobserve(r)}}},[r,o])}var Pe=G,Ce=K,Re=te;function _e(r){const e=F.c(21);let o,l,t,n,s;e[0]!==r?({className:l,children:o,hideScrollbar:n,viewportRef:s,...t}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n,e[5]=s):(o=e[1],l=e[2],t=e[3],n=e[4],s=e[5]);const a=n===void 0?!1:n;let c;e[6]!==l?(c=$("relative h-full w-full",l),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==o?(u=b.jsx("div",{className:"flex min-w-0 flex-col",children:o}),e[8]=o,e[9]=u):u=e[9];let i;e[10]!==u||e[11]!==s?(i=b.jsx(Ce,{ref:s,"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:u}),e[10]=u,e[11]=s,e[12]=i):i=e[12];let h;e[13]!==a?(h=b.jsx(Ee,{hideScrollbar:a}),e[13]=a,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(Re,{}),e[15]=f):f=e[15];let S;return e[16]!==t||e[17]!==c||e[18]!==i||e[19]!==h?(S=b.jsxs(Pe,{"data-slot":"scroll-area",className:c,...t,children:[i,h,f]}),e[16]=t,e[17]=c,e[18]=i,e[19]=h,e[20]=S):S=e[20],S}function Ee(r){const e=F.c(15);let o,l,t,n;e[0]!==r?({className:o,orientation:t,hideScrollbar:n,...l}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=t===void 0?"vertical":t,a=n===void 0?!1:n,c=s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",i=a&&"hidden";let h;e[5]!==o||e[6]!==c||e[7]!==u||e[8]!==i?(h=$("select-none touch-none p-px transition-colors",c,u,i,o),e[5]=o,e[6]=c,e[7]=u,e[8]=i,e[9]=h):h=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(oe,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let S;return e[11]!==s||e[12]!==l||e[13]!==h?(S=b.jsx(Q,{"data-slot":"scroll-area-scrollbar",orientation:s,className:h,...l,children:f}),e[11]=s,e[12]=l,e[13]=h,e[14]=S):S=e[14],S}export{_e as S};
1
+ import{r as d,bm as T,bq as ce,j as b,bo as _,bF as ae,dc as O,bp as C,bz as P,bu as ie,c as F,l as $}from"./index-BiuSAlzd.js";import{e as de}from"./select-QknS4jya.js";function ue(r,e){return d.useReducer((o,l)=>e[o][l]??o,r)}var U="ScrollArea",[q]=ae(U),[fe,m]=q(U),G=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,type:l="hover",dir:t,scrollHideDelay:n=600,...s}=r,[a,c]=d.useState(null),[u,i]=d.useState(null),[h,f]=d.useState(null),[S,w]=d.useState(null),[A,Y]=d.useState(null),[x,L]=d.useState(0),[M,j]=d.useState(0),[D,y]=d.useState(!1),[N,W]=d.useState(!1),v=T(e,R=>c(R)),p=ce(t);return b.jsx(fe,{scope:o,type:l,dir:p,scrollHideDelay:n,scrollArea:a,viewport:u,onViewportChange:i,content:h,onContentChange:f,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:D,onScrollbarXEnabledChange:y,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:L,onCornerHeightChange:j,children:b.jsx(_.div,{dir:p,...s,ref:v,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...r.style}})})});G.displayName=U;var J="ScrollAreaViewport",K=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,children:l,nonce:t,...n}=r,s=m(J,o),a=d.useRef(null),c=T(e,a,s.onViewportChange);return b.jsxs(b.Fragment,{children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),b.jsx(_.div,{"data-radix-scroll-area-viewport":"",...n,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...r.style},children:b.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});K.displayName=J;var g="ScrollAreaScrollbar",Q=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:s}=t,a=r.orientation==="horizontal";return d.useEffect(()=>(a?n(!0):s(!0),()=>{a?n(!1):s(!1)}),[a,n,s]),t.type==="hover"?b.jsx(he,{...l,ref:e,forceMount:o}):t.type==="scroll"?b.jsx(be,{...l,ref:e,forceMount:o}):t.type==="auto"?b.jsx(Z,{...l,ref:e,forceMount:o}):t.type==="always"?b.jsx(V,{...l,ref:e}):null});Q.displayName=g;var he=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),[n,s]=d.useState(!1);return d.useEffect(()=>{const a=t.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},i=()=>{c=window.setTimeout(()=>s(!1),t.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",i),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",i)}}},[t.scrollArea,t.scrollHideDelay]),b.jsx(O,{present:o||n,children:b.jsx(Z,{"data-state":n?"visible":"hidden",...l,ref:e})})}),be=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),n=r.orientation==="horizontal",s=X(()=>c("SCROLL_END"),100),[a,c]=ue("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return d.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,t.scrollHideDelay,c]),d.useEffect(()=>{const u=t.viewport,i=n?"scrollLeft":"scrollTop";if(u){let h=u[i];const f=()=>{const S=u[i];h!==S&&(c("SCROLL"),s()),h=S};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[t.viewport,n,c,s]),b.jsx(O,{present:o||a!=="hidden",children:b.jsx(V,{"data-state":a==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:C(r.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:C(r.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Z=d.forwardRef((r,e)=>{const o=m(g,r.__scopeScrollArea),{forceMount:l,...t}=r,[n,s]=d.useState(!1),a=r.orientation==="horizontal",c=X(()=>{if(o.viewport){const u=o.viewport.offsetWidth<o.viewport.scrollWidth,i=o.viewport.offsetHeight<o.viewport.scrollHeight;s(a?u:i)}},10);return E(o.viewport,c),E(o.content,c),b.jsx(O,{present:l||n,children:b.jsx(V,{"data-state":n?"visible":"hidden",...t,ref:e})})}),V=d.forwardRef((r,e)=>{const{orientation:o="vertical",...l}=r,t=m(g,r.__scopeScrollArea),n=d.useRef(null),s=d.useRef(0),[a,c]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ne(a.viewport,a.content),i={...l,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>n.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function h(f,S){return ge(f,s.current,a,S)}return o==="horizontal"?b.jsx(Se,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollLeft,S=k(f,a,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollLeft=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollLeft=h(f,t.dir))}}):o==="vertical"?b.jsx(ve,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollTop,S=k(f,a);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollTop=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollTop=h(f))}}):null}),Se=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarXChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"horizontal",...t,ref:u,sizes:o,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.x),onDragScroll:i=>r.onDragScroll(i.x),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollLeft+i.deltaX;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:z(s.paddingLeft),paddingEnd:z(s.paddingRight)}})}})}),ve=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarYChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"vertical",...t,ref:u,sizes:o,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.y),onDragScroll:i=>r.onDragScroll(i.y),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollTop+i.deltaY;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:z(s.paddingTop),paddingEnd:z(s.paddingBottom)}})}})}),[me,ee]=q(g),re=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:i,onResize:h,...f}=r,S=m(g,o),[w,A]=d.useState(null),Y=T(e,v=>A(v)),x=d.useRef(null),L=d.useRef(""),M=S.viewport,j=l.content-l.viewport,D=P(i),y=P(c),N=X(h,10);function W(v){if(x.current){const p=v.clientX-x.current.left,R=v.clientY-x.current.top;u({x:p,y:R})}}return d.useEffect(()=>{const v=p=>{const R=p.target;w?.contains(R)&&D(p,j)};return document.addEventListener("wheel",v,{passive:!1}),()=>document.removeEventListener("wheel",v,{passive:!1})},[M,w,j,D]),d.useEffect(y,[l,y]),E(w,N),E(S.content,N),b.jsx(me,{scope:o,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(s),onThumbPositionChange:y,onThumbPointerDown:P(a),children:b.jsx(_.div,{...f,ref:Y,style:{position:"absolute",...f.style},onPointerDown:C(r.onPointerDown,v=>{v.button===0&&(v.target.setPointerCapture(v.pointerId),x.current=w.getBoundingClientRect(),L.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(v))}),onPointerMove:C(r.onPointerMove,W),onPointerUp:C(r.onPointerUp,v=>{const p=v.target;p.hasPointerCapture(v.pointerId)&&p.releasePointerCapture(v.pointerId),document.body.style.webkitUserSelect=L.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",oe=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=ee(H,r.__scopeScrollArea);return b.jsx(O,{present:o||t.hasThumb,children:b.jsx(pe,{ref:e,...l})})}),pe=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,style:l,...t}=r,n=m(H,o),s=ee(H,o),{onThumbPositionChange:a}=s,c=T(e,h=>s.onThumbChange(h)),u=d.useRef(void 0),i=X(()=>{u.current&&(u.current(),u.current=void 0)},100);return d.useEffect(()=>{const h=n.viewport;if(h){const f=()=>{if(i(),!u.current){const S=xe(h,a);u.current=S,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,i,a]),b.jsx(_.div,{"data-state":s.hasThumb?"visible":"hidden",...t,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(r.onPointerDownCapture,h=>{const S=h.target.getBoundingClientRect(),w=h.clientX-S.left,A=h.clientY-S.top;s.onThumbPointerDown({x:w,y:A})}),onPointerUp:C(r.onPointerUp,s.onThumbPointerUp)})});oe.displayName=H;var B="ScrollAreaCorner",te=d.forwardRef((r,e)=>{const o=m(B,r.__scopeScrollArea),l=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&l?b.jsx(we,{...r,ref:e}):null});te.displayName=B;var we=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,...l}=r,t=m(B,o),[n,s]=d.useState(0),[a,c]=d.useState(0),u=!!(n&&a);return E(t.scrollbarX,()=>{const i=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(i),c(i)}),E(t.scrollbarY,()=>{const i=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(i),s(i)}),u?b.jsx(_.div,{...l,ref:e,style:{width:n,height:a,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...r.style}}):null});function z(r){return r?parseInt(r,10):0}function ne(r,e){const o=r/e;return isNaN(o)?0:o}function I(r){const e=ne(r.viewport,r.content),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,l=(r.scrollbar.size-o)*e;return Math.max(l,18)}function ge(r,e,o,l="ltr"){const t=I(o),n=t/2,s=e||n,a=t-s,c=o.scrollbar.paddingStart+s,u=o.scrollbar.size-o.scrollbar.paddingEnd-a,i=o.content-o.viewport,h=l==="ltr"?[0,i]:[i*-1,0];return le([c,u],h)(r)}function k(r,e,o="ltr"){const l=I(e),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=e.scrollbar.size-t,s=e.content-e.viewport,a=n-l,c=o==="ltr"?[0,s]:[s*-1,0],u=de(r,c);return le([0,s],[0,a])(u)}function le(r,e){return o=>{if(r[0]===r[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(r[1]-r[0]);return e[0]+l*(o-r[0])}}function se(r,e){return r>0&&r<e}var xe=(r,e=()=>{})=>{let o={left:r.scrollLeft,top:r.scrollTop},l=0;return(function t(){const n={left:r.scrollLeft,top:r.scrollTop},s=o.left!==n.left,a=o.top!==n.top;(s||a)&&e(),o=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(r,e){const o=P(r),l=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(l.current),[]),d.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(o,e)},[o,e])}function E(r,e){const o=P(e);ie(()=>{let l=0;if(r){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(o)});return t.observe(r),()=>{window.cancelAnimationFrame(l),t.unobserve(r)}}},[r,o])}var Pe=G,Ce=K,Re=te;function _e(r){const e=F.c(21);let o,l,t,n,s;e[0]!==r?({className:l,children:o,hideScrollbar:n,viewportRef:s,...t}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n,e[5]=s):(o=e[1],l=e[2],t=e[3],n=e[4],s=e[5]);const a=n===void 0?!1:n;let c;e[6]!==l?(c=$("relative h-full w-full",l),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==o?(u=b.jsx("div",{className:"flex min-w-0 flex-col",children:o}),e[8]=o,e[9]=u):u=e[9];let i;e[10]!==u||e[11]!==s?(i=b.jsx(Ce,{ref:s,"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:u}),e[10]=u,e[11]=s,e[12]=i):i=e[12];let h;e[13]!==a?(h=b.jsx(Ee,{hideScrollbar:a}),e[13]=a,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(Re,{}),e[15]=f):f=e[15];let S;return e[16]!==t||e[17]!==c||e[18]!==i||e[19]!==h?(S=b.jsxs(Pe,{"data-slot":"scroll-area",className:c,...t,children:[i,h,f]}),e[16]=t,e[17]=c,e[18]=i,e[19]=h,e[20]=S):S=e[20],S}function Ee(r){const e=F.c(15);let o,l,t,n;e[0]!==r?({className:o,orientation:t,hideScrollbar:n,...l}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=t===void 0?"vertical":t,a=n===void 0?!1:n,c=s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",i=a&&"hidden";let h;e[5]!==o||e[6]!==c||e[7]!==u||e[8]!==i?(h=$("select-none touch-none p-px transition-colors",c,u,i,o),e[5]=o,e[6]=c,e[7]=u,e[8]=i,e[9]=h):h=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(oe,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let S;return e[11]!==s||e[12]!==l||e[13]!==h?(S=b.jsx(Q,{"data-slot":"scroll-area-scrollbar",orientation:s,className:h,...l,children:f}),e[11]=s,e[12]=l,e[13]=h,e[14]=S):S=e[14],S}export{_e as S};
@@ -1 +1 @@
1
- import{c as b,l as w,j as a,h as j}from"./index-C5LlvZFc.js";import{i as v}from"./SearchMd-DeSQISfo.js";function k(f){const e=b.c(17),{value:l,onChange:c,placeholder:m,onKeyDown:u,className:d,isSearching:p,disabled:r}=f,x=m===void 0?"Search...":m,h=r&&"pointer-events-none opacity-50";let t;e[0]!==d||e[1]!==h?(t=w("flex items-center gap-4 rounded-lg bg-[var(--studio-input-background)] px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",h,d),e[0]=d,e[1]=h,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{className:"size-4 text-muted-foreground/75 shrink-0"}):a.jsx(v,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=g=>c(g.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==r||e[8]!==u||e[9]!==x||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:u,placeholder:x,disabled:r,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=r,e[8]=u,e[9]=x,e[10]=s,e[11]=l,e[12]=o):o=e[12];let i;return e[13]!==t||e[14]!==n||e[15]!==o?(i=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=i):i=e[16],i}export{k as S};
1
+ import{c as b,l as w,j as a,h as j}from"./index-BiuSAlzd.js";import{i as v}from"./SearchMd-oXON6Mge.js";function k(f){const e=b.c(17),{value:l,onChange:c,placeholder:m,onKeyDown:u,className:d,isSearching:p,disabled:r}=f,x=m===void 0?"Search...":m,h=r&&"pointer-events-none opacity-50";let t;e[0]!==d||e[1]!==h?(t=w("flex items-center gap-4 rounded-lg bg-[var(--studio-input-background)] px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",h,d),e[0]=d,e[1]=h,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{className:"size-4 text-muted-foreground/75 shrink-0"}):a.jsx(v,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=g=>c(g.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==r||e[8]!==u||e[9]!==x||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:u,placeholder:x,disabled:r,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=r,e[8]=u,e[9]=x,e[10]=s,e[11]=l,e[12]=o):o=e[12];let i;return e[13]!==t||e[14]!==n||e[15]!==o?(i=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=i):i=e[16],i}export{k as S};
@@ -1 +1 @@
1
- import{c as K,r as C,l as B,j as a}from"./index-C5LlvZFc.js";import{i as I}from"./SearchMd-DeSQISfo.js";import{i as M}from"./X-DvEbwZ22.js";import{I as O}from"./icon-button-Cpld4nrH.js";function H(S){const e=K.c(34),{value:t,onChange:s,label:E,placeholder:D,clearLabel:F,expanded:o,className:j}=S,w=E===void 0?"Search":E,d=D===void 0?"Search…":D,y=F===void 0?"Clear search":F,[L,p]=C.useState(t!==""),[R,z]=C.useState(!1),[V,$]=C.useState(t);if(t!==V&&($(t),t===""&&!R&&p(!1)),!L&&!o){let l,g;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>p(!0),g=a.jsx(I,{}),e[0]=l,e[1]=g):(l=e[0],g=e[1]);let v;return e[2]!==w?(v=a.jsx(O,{label:w,tooltipSide:"bottom",variant:"secondary",onClick:l,children:g}),e[2]=w,e[3]=v):v=e[3],v}const _=o?"h-10 w-full px-3":"h-7 w-32 animate-search-expand px-2.5 sm:w-44";let n;e[4]!==j||e[5]!==_?(n=B("inline-flex shrink-0 items-center gap-1.5 overflow-hidden rounded-full bg-card text-card-foreground card-shadow",_,j),e[4]=j,e[5]=_,e[6]=n):n=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(I,{className:"size-4 shrink-0 text-muted-foreground"}),e[7]=x):x=e[7];const k=!o;let r;e[8]!==s?(r=l=>s(l.target.value),e[8]=s,e[9]=r):r=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>z(!0),e[10]=h):h=e[10];let i;e[11]!==t?(i=()=>{z(!1),t===""&&p(!1)},e[11]=t,e[12]=i):i=e[12];let c;e[13]!==s?(c=l=>{l.key==="Escape"&&s("")},e[13]=s,e[14]=c):c=e[14];const N=o?"text-sm":"text-xs";let f;e[15]!==N?(f=B("w-full min-w-0 bg-transparent outline-none placeholder:text-muted-foreground",N),e[15]=N,e[16]=f):f=e[16];let u;e[17]!==d||e[18]!==i||e[19]!==c||e[20]!==f||e[21]!==k||e[22]!==r||e[23]!==t?(u=a.jsx("input",{autoFocus:k,value:t,onChange:r,onFocus:h,onBlur:i,onKeyDown:c,placeholder:d,"aria-label":d,className:f}),e[17]=d,e[18]=i,e[19]=c,e[20]=f,e[21]=k,e[22]=r,e[23]=t,e[24]=u):u=e[24];let m;e[25]!==y||e[26]!==o||e[27]!==s||e[28]!==t?(m=t!==""&&a.jsx("button",{type:"button","aria-label":y,onMouseDown:P,onClick:()=>{s(""),o||p(!1)},className:"shrink-0 text-muted-foreground hover:text-foreground",children:a.jsx(M,{className:"size-3.5"})}),e[25]=y,e[26]=o,e[27]=s,e[28]=t,e[29]=m):m=e[29];let b;return e[30]!==u||e[31]!==m||e[32]!==n?(b=a.jsxs("div",{className:n,children:[x,u,m]}),e[30]=u,e[31]=m,e[32]=n,e[33]=b):b=e[33],b}function P(S){return S.preventDefault()}export{H as S};
1
+ import{c as K,r as C,l as B,j as a}from"./index-BiuSAlzd.js";import{i as I}from"./SearchMd-oXON6Mge.js";import{i as M}from"./X-C52mq3mn.js";import{I as O}from"./icon-button-Cag62vyF.js";function H(S){const e=K.c(34),{value:t,onChange:s,label:E,placeholder:D,clearLabel:F,expanded:o,className:j}=S,w=E===void 0?"Search":E,d=D===void 0?"Search…":D,y=F===void 0?"Clear search":F,[L,p]=C.useState(t!==""),[R,z]=C.useState(!1),[V,$]=C.useState(t);if(t!==V&&($(t),t===""&&!R&&p(!1)),!L&&!o){let l,g;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>p(!0),g=a.jsx(I,{}),e[0]=l,e[1]=g):(l=e[0],g=e[1]);let v;return e[2]!==w?(v=a.jsx(O,{label:w,tooltipSide:"bottom",variant:"secondary",onClick:l,children:g}),e[2]=w,e[3]=v):v=e[3],v}const _=o?"h-10 w-full px-3":"h-7 w-32 animate-search-expand px-2.5 sm:w-44";let n;e[4]!==j||e[5]!==_?(n=B("inline-flex shrink-0 items-center gap-1.5 overflow-hidden rounded-full bg-card text-card-foreground card-shadow",_,j),e[4]=j,e[5]=_,e[6]=n):n=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(I,{className:"size-4 shrink-0 text-muted-foreground"}),e[7]=x):x=e[7];const k=!o;let r;e[8]!==s?(r=l=>s(l.target.value),e[8]=s,e[9]=r):r=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>z(!0),e[10]=h):h=e[10];let i;e[11]!==t?(i=()=>{z(!1),t===""&&p(!1)},e[11]=t,e[12]=i):i=e[12];let c;e[13]!==s?(c=l=>{l.key==="Escape"&&s("")},e[13]=s,e[14]=c):c=e[14];const N=o?"text-sm":"text-xs";let f;e[15]!==N?(f=B("w-full min-w-0 bg-transparent outline-none placeholder:text-muted-foreground",N),e[15]=N,e[16]=f):f=e[16];let u;e[17]!==d||e[18]!==i||e[19]!==c||e[20]!==f||e[21]!==k||e[22]!==r||e[23]!==t?(u=a.jsx("input",{autoFocus:k,value:t,onChange:r,onFocus:h,onBlur:i,onKeyDown:c,placeholder:d,"aria-label":d,className:f}),e[17]=d,e[18]=i,e[19]=c,e[20]=f,e[21]=k,e[22]=r,e[23]=t,e[24]=u):u=e[24];let m;e[25]!==y||e[26]!==o||e[27]!==s||e[28]!==t?(m=t!==""&&a.jsx("button",{type:"button","aria-label":y,onMouseDown:P,onClick:()=>{s(""),o||p(!1)},className:"shrink-0 text-muted-foreground hover:text-foreground",children:a.jsx(M,{className:"size-3.5"})}),e[25]=y,e[26]=o,e[27]=s,e[28]=t,e[29]=m):m=e[29];let b;return e[30]!==u||e[31]!==m||e[32]!==n?(b=a.jsxs("div",{className:n,children:[x,u,m]}),e[30]=u,e[31]=m,e[32]=n,e[33]=b):b=e[33],b}function P(S){return S.preventDefault()}export{H as S};
@@ -1 +1 @@
1
- import{c as x,b as d,j as l}from"./index-C5LlvZFc.js";import{s as j}from"./User01-CN7JcgS_.js";import{t as E}from"./Users01-B-RFC-RT.js";const b=/^[A-Za-z0-9_.-]+$/;function h(u){const e=x.c(15),{field:p,secretById:t}=u,s=d(),n=p.value||"";if(!n)return null;let a;e[0]!==n||e[1]!==t?(a=t.get(n),e[0]=n,e[1]=t,e[2]=a):a=e[2];const c=a;if(!c){let i;e[3]!==n||e[4]!==s?(i=s("sandbox.envVarsField.missingSecret",{id:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5];let f;return e[6]!==i?(f=l.jsx("span",{className:"text-destructive",children:i}),e[6]=i,e[7]=f):f=e[7],f}let o;e[8]!==c.scope?(o=l.jsx(N,{scope:c.scope}),e[8]=c.scope,e[9]=o):o=e[9];let r;e[10]!==c.name?(r=l.jsx("span",{className:"truncate font-mono",children:c.name}),e[10]=c.name,e[11]=r):r=e[11];let m;return e[12]!==o||e[13]!==r?(m=l.jsxs("span",{className:"inline-flex items-center gap-1.5 truncate",children:[o,r]}),e[12]=o,e[13]=r,e[14]=m):m=e[14],m}function N(u){const e=x.c(2),{scope:p}=u,t=p==="user"?j:E;let s;return e[0]!==t?(s=l.jsx(t,{className:"size-3 text-muted-foreground"}),e[0]=t,e[1]=s):s=e[1],s}export{h as S,b as a,N as b};
1
+ import{c as x,b as d,j as l}from"./index-BiuSAlzd.js";import{s as j}from"./User01-DXNh3TnB.js";import{t as E}from"./Users01-DAfCqIN7.js";const b=/^[A-Za-z0-9_.-]+$/;function h(u){const e=x.c(15),{field:p,secretById:t}=u,s=d(),n=p.value||"";if(!n)return null;let a;e[0]!==n||e[1]!==t?(a=t.get(n),e[0]=n,e[1]=t,e[2]=a):a=e[2];const c=a;if(!c){let i;e[3]!==n||e[4]!==s?(i=s("sandbox.envVarsField.missingSecret",{id:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5];let f;return e[6]!==i?(f=l.jsx("span",{className:"text-destructive",children:i}),e[6]=i,e[7]=f):f=e[7],f}let o;e[8]!==c.scope?(o=l.jsx(N,{scope:c.scope}),e[8]=c.scope,e[9]=o):o=e[9];let r;e[10]!==c.name?(r=l.jsx("span",{className:"truncate font-mono",children:c.name}),e[10]=c.name,e[11]=r):r=e[11];let m;return e[12]!==o||e[13]!==r?(m=l.jsxs("span",{className:"inline-flex items-center gap-1.5 truncate",children:[o,r]}),e[12]=o,e[13]=r,e[14]=m):m=e[14],m}function N(u){const e=x.c(2),{scope:p}=u,t=p==="user"?j:E;let s;return e[0]!==t?(s=l.jsx(t,{className:"size-3 text-muted-foreground"}),e[0]=t,e[1]=s):s=e[1],s}export{h as S,b as a,N as b};
@@ -1 +1 @@
1
- import{c as j,b as y,j as s,n as C,fn as $,E as F,r as N,aS as L,B as D,a7 as E,t as _}from"./index-C5LlvZFc.js";import{i as O}from"./AlertCircle-DrwoGJpd.js";import{s as B}from"./Plus-GNsqHUli.js";import{s as A}from"./User01-CN7JcgS_.js";import{t as R}from"./Users01-B-RFC-RT.js";import{D as I,b as q,c as V,d as H,h as G,e as J}from"./dialog-BJny2srB.js";import{I as z}from"./input-NPHEwu7D.js";import{L as w}from"./label-DFV1EjGx.js";import{S as K,b as M,a as Q,d as U,c as P}from"./select-BlojSjop.js";import{T as W}from"./textarea-CVYfh0wC.js";import{u as X,a as Y}from"./use-secrets-BD6_VEse.js";import{R as Z}from"./require-capability-ZVnNGQoT.js";import"./X-DvEbwZ22.js";import"./index-CMWyW-nP.js";import"./Check-BcGsLSsp.js";import"./ChevronUp-BAvbedXO.js";import"./access-gate-Cno0bRAg.js";import"./capability-load-error-B8JQAANB.js";function ee(t){const e=j.c(6),{error:r}=t,i=y();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(O,{size:16}),e[0]=c):c=e[0];let n;e[1]!==r.message||e[2]!==i?(n=i("settings.secrets.failedToLoadError",{error:r.message}),e[1]=r.message,e[2]=i,e[3]=n):n=e[3];let a;return e[4]!==n?(a=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,s.jsx("span",{className:"text-sm font-medium",children:n})]}),e[4]=n,e[5]=a):a=e[5],a}function te(t){const e=j.c(8),{scope:r}=t,i=y(),c=r==="user"?A:R;let n;e[0]!==r||e[1]!==i?(n=i(r==="user"?"settings.secrets.scopePrivate":"settings.secrets.scopeOrganization"),e[0]=r,e[1]=i,e[2]=n):n=e[2];const a=n;let l;e[3]!==c?(l=s.jsx(c,{size:12}),e[3]=c,e[4]=l):l=e[4];let o;return e[5]!==a||e[6]!==l?(o=s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[l,a]}),e[5]=a,e[6]=l,e[7]=o):o=e[7],o}function T(t){const e=j.c(20),{secret:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:s.jsx(E,{size:16,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let c;e[1]!==r.name?(c=s.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=c):c=e[2];let n;e[3]!==r.scope?(n=s.jsx(te,{scope:r.scope}),e[3]=r.scope,e[4]=n):n=e[4];let a;e[5]!==c||e[6]!==n?(a=s.jsxs("div",{className:"flex items-center gap-2",children:[c,n]}),e[5]=c,e[6]=n,e[7]=a):a=e[7];let l;e[8]!==r.description?(l=r.description?s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=l):l=e[9];let o;e[10]!==a||e[11]!==l?(o=s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[i,s.jsxs("div",{className:"min-w-0",children:[a,l]})]}),e[10]=a,e[11]=l,e[12]=o):o=e[12];let d;e[13]!==r.createdAt?(d=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=d):d=e[14];let m;e[15]!==d?(m=s.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:d}),e[15]=d,e[16]=m):m=e[16];let x;return e[17]!==o||e[18]!==m?(x=s.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[o,m]}),e[17]=o,e[18]=m,e[19]=x):x=e[19],x}function se(t){const e=j.c(15),{action:r}=t,i=y();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:s.jsx(E,{size:20,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==i?(n=i("settings.secrets.emptyTitle"),e[1]=i,e[2]=n):n=e[2];let a;e[3]!==n?(a=s.jsx("p",{className:"font-medium text-sm",children:n}),e[3]=n,e[4]=a):a=e[4];let l;e[5]!==i?(l=i("settings.secrets.emptyDescription"),e[5]=i,e[6]=l):l=e[6];let o;e[7]!==l?(o=s.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:l}),e[7]=l,e[8]=o):o=e[8];let d;e[9]!==a||e[10]!==o?(d=s.jsxs("div",{children:[a,o]}),e[9]=a,e[10]=o,e[11]=d):d=e[11];let m;return e[12]!==r||e[13]!==d?(m=s.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,d,r]}),e[12]=r,e[13]=d,e[14]=m):m=e[14],m}function k({open:t,onOpenChange:e}){const r=y(),[i,c]=N.useState("organization"),[n,a]=N.useState(""),[l,o]=N.useState(""),[d,m]=N.useState(""),x=Y();function g(){c("organization"),a(""),o(""),m("")}function p(){g(),e(!1)}async function b(u){if(u.preventDefault(),!(!n.trim()||!l))try{await x.mutateAsync({scope:i,name:n.trim(),value:l,description:d.trim()||void 0}),_.success(r("settings.secrets.secretCreated",{name:n.trim()})),p()}catch(f){_.error(f instanceof Error?f.message:r("settings.secrets.failedToCreateSecret"))}}return s.jsx(I,{open:t,onOpenChange:u=>{u?e(u):p()},children:s.jsxs(q,{className:"sm:max-w-lg",children:[s.jsxs(V,{children:[s.jsx(H,{children:r("settings.secrets.newSecretTitle")}),s.jsx(G,{children:r("settings.secrets.newSecretDescription")})]}),s.jsxs("form",{onSubmit:b,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-scope",children:r("settings.secrets.scopeLabel")}),s.jsxs(K,{value:i,onValueChange:u=>c(u),children:[s.jsx(M,{id:"secret-scope",children:s.jsx(Q,{})}),s.jsxs(U,{children:[s.jsx(P,{value:"organization",children:r("settings.secrets.scopeOrganizationDescription")}),s.jsx(P,{value:"user",children:r("settings.secrets.scopePrivateDescription")})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-name",children:r("settings.secrets.nameLabel")}),s.jsx(z,{id:"secret-name",value:n,onChange:u=>a(u.target.value),placeholder:r("settings.secrets.namePlaceholder"),autoComplete:"off",required:!0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:r("settings.secrets.nameHelp")})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-value",children:r("settings.secrets.valueLabel")}),s.jsx(z,{id:"secret-value",type:"password",value:l,onChange:u=>o(u.target.value),autoComplete:"new-password",required:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-description",children:r("settings.secrets.descriptionLabel")}),s.jsx(W,{id:"secret-description",value:d,onChange:u=>m(u.target.value),rows:2,placeholder:r("settings.secrets.descriptionPlaceholder")})]}),s.jsxs(J,{children:[s.jsx(D,{type:"button",variant:"outline",onClick:p,disabled:x.isPending,children:r("settings.secrets.cancelButton")}),s.jsx(D,{type:"submit",disabled:x.isPending||!n.trim()||!l,children:x.isPending?r("settings.secrets.creatingButton"):r("settings.secrets.createButton")})]})]})]})})}function re(){const t=j.c(34),e=y(),r=X(),[i,c]=N.useState(!1);let n,a;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>c(!0),a=s.jsx(B,{size:14}),t[0]=n,t[1]=a):(n=t[0],a=t[1]);let l;t[2]!==e?(l=e("settings.secrets.newSecret"),t[2]=e,t[3]=l):l=t[3];let o;t[4]!==l?(o=s.jsx(C.Actions,{children:s.jsxs(D,{size:"sm",onClick:n,children:[a,l]})}),t[4]=l,t[5]=o):o=t[5];const d=o;if(r.length===0){let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(se,{action:!1}),t[6]=u):u=t[6];let f;t[7]!==i?(f=s.jsx(k,{open:i,onOpenChange:c}),t[7]=i,t[8]=f):f=t[8];let h;return t[9]!==d||t[10]!==f?(h=s.jsxs(s.Fragment,{children:[d,u,f]}),t[9]=d,t[10]=f,t[11]=h):h=t[11],h}let m,x,g;if(t[12]!==d||t[13]!==r||t[14]!==e){const u=r.filter(le),f=r.filter(ce),h=r.length===1?"settings.secrets.secretsCountSingular":"settings.secrets.secretsCountPlural";let S;t[18]!==r.length||t[19]!==e||t[20]!==h?(S=e(h,{count:r.length}),t[18]=r.length,t[19]=e,t[20]=h,t[21]=S):S=t[21];let v;t[22]!==S?(v=s.jsx("p",{className:"text-sm text-muted-foreground",children:S}),t[22]=S,t[23]=v):v=t[23],t[24]!==d||t[25]!==v?(m=s.jsxs("div",{className:"flex items-center justify-between",children:[v,d]}),t[24]=d,t[25]=v,t[26]=m):m=t[26],x=u.length>0?s.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionOrganization")}),s.jsx("div",{children:u.map(ie)})]}):null,g=f.length>0?s.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionPrivate")}),s.jsx("div",{children:f.map(ne)})]}):null,t[12]=d,t[13]=r,t[14]=e,t[15]=m,t[16]=x,t[17]=g}else m=t[15],x=t[16],g=t[17];let p;t[27]!==i?(p=s.jsx(k,{open:i,onOpenChange:c}),t[27]=i,t[28]=p):p=t[28];let b;return t[29]!==m||t[30]!==x||t[31]!==g||t[32]!==p?(b=s.jsxs(s.Fragment,{children:[m,x,g,p]}),t[29]=m,t[30]=x,t[31]=g,t[32]=p,t[33]=b):b=t[33],b}function ne(t){return s.jsx(T,{secret:t},t.id)}function ie(t){return s.jsx(T,{secret:t},t.id)}function ce(t){return t.scope==="user"}function le(t){return t.scope==="organization"}function ae(){const t=j.c(7),e=y();let r;t[0]!==e?(r=e("settings.nav.secrets"),t[0]=e,t[1]=r):r=t[1];let i;t[2]!==r?(i=s.jsx(C.Title,{children:r}),t[2]=r,t[3]=i):i=t[3];let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(F,{fallback:oe,children:s.jsx(N.Suspense,{fallback:s.jsx(L,{className:"h-32 w-full"}),children:s.jsx(re,{})})}),t[4]=c):c=t[4];let n;return t[5]!==i?(n=s.jsx(C,{children:s.jsx(C.Content,{children:s.jsx(C.Container,{children:s.jsxs($,{children:[i,c]})})})}),t[5]=i,t[6]=n):n=t[6],n}function oe(t){const{error:e}=t;return s.jsx(ee,{error:e??new Error("Failed to load secrets")})}function ze(){const t=j.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Z,{capability:"secrets:manage",area:"secrets",children:s.jsx(ae,{})}),t[0]=e):e=t[0],e}export{ze as default};
1
+ import{c as j,b as y,j as s,n as C,fn as $,E as F,r as N,aS as L,B as D,a7 as E,t as _}from"./index-BiuSAlzd.js";import{i as O}from"./AlertCircle-DDHQi3fm.js";import{s as B}from"./Plus-DjsQQqpw.js";import{s as A}from"./User01-DXNh3TnB.js";import{t as R}from"./Users01-DAfCqIN7.js";import{D as I,b as q,c as V,d as H,h as G,e as J}from"./dialog-C9YQM7Rb.js";import{I as z}from"./input-B5d33h6X.js";import{L as w}from"./label-BmSaj4OS.js";import{S as K,b as M,a as Q,d as U,c as P}from"./select-QknS4jya.js";import{T as W}from"./textarea-IAy-ownU.js";import{u as X,a as Y}from"./use-secrets-DGDpC9hp.js";import{R as Z}from"./require-capability-B1clucXi.js";import"./X-C52mq3mn.js";import"./index-BGzd8qMa.js";import"./Check-Cf-cMW3t.js";import"./ChevronUp-B79uJeZN.js";import"./access-gate-DbBQLMiF.js";import"./capability-load-error-m8D5eiRW.js";function ee(t){const e=j.c(6),{error:r}=t,i=y();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(O,{size:16}),e[0]=c):c=e[0];let n;e[1]!==r.message||e[2]!==i?(n=i("settings.secrets.failedToLoadError",{error:r.message}),e[1]=r.message,e[2]=i,e[3]=n):n=e[3];let a;return e[4]!==n?(a=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,s.jsx("span",{className:"text-sm font-medium",children:n})]}),e[4]=n,e[5]=a):a=e[5],a}function te(t){const e=j.c(8),{scope:r}=t,i=y(),c=r==="user"?A:R;let n;e[0]!==r||e[1]!==i?(n=i(r==="user"?"settings.secrets.scopePrivate":"settings.secrets.scopeOrganization"),e[0]=r,e[1]=i,e[2]=n):n=e[2];const a=n;let l;e[3]!==c?(l=s.jsx(c,{size:12}),e[3]=c,e[4]=l):l=e[4];let o;return e[5]!==a||e[6]!==l?(o=s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[l,a]}),e[5]=a,e[6]=l,e[7]=o):o=e[7],o}function T(t){const e=j.c(20),{secret:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:s.jsx(E,{size:16,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let c;e[1]!==r.name?(c=s.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=c):c=e[2];let n;e[3]!==r.scope?(n=s.jsx(te,{scope:r.scope}),e[3]=r.scope,e[4]=n):n=e[4];let a;e[5]!==c||e[6]!==n?(a=s.jsxs("div",{className:"flex items-center gap-2",children:[c,n]}),e[5]=c,e[6]=n,e[7]=a):a=e[7];let l;e[8]!==r.description?(l=r.description?s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=l):l=e[9];let o;e[10]!==a||e[11]!==l?(o=s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[i,s.jsxs("div",{className:"min-w-0",children:[a,l]})]}),e[10]=a,e[11]=l,e[12]=o):o=e[12];let d;e[13]!==r.createdAt?(d=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=d):d=e[14];let m;e[15]!==d?(m=s.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:d}),e[15]=d,e[16]=m):m=e[16];let x;return e[17]!==o||e[18]!==m?(x=s.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[o,m]}),e[17]=o,e[18]=m,e[19]=x):x=e[19],x}function se(t){const e=j.c(15),{action:r}=t,i=y();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:s.jsx(E,{size:20,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==i?(n=i("settings.secrets.emptyTitle"),e[1]=i,e[2]=n):n=e[2];let a;e[3]!==n?(a=s.jsx("p",{className:"font-medium text-sm",children:n}),e[3]=n,e[4]=a):a=e[4];let l;e[5]!==i?(l=i("settings.secrets.emptyDescription"),e[5]=i,e[6]=l):l=e[6];let o;e[7]!==l?(o=s.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:l}),e[7]=l,e[8]=o):o=e[8];let d;e[9]!==a||e[10]!==o?(d=s.jsxs("div",{children:[a,o]}),e[9]=a,e[10]=o,e[11]=d):d=e[11];let m;return e[12]!==r||e[13]!==d?(m=s.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,d,r]}),e[12]=r,e[13]=d,e[14]=m):m=e[14],m}function k({open:t,onOpenChange:e}){const r=y(),[i,c]=N.useState("organization"),[n,a]=N.useState(""),[l,o]=N.useState(""),[d,m]=N.useState(""),x=Y();function g(){c("organization"),a(""),o(""),m("")}function p(){g(),e(!1)}async function b(u){if(u.preventDefault(),!(!n.trim()||!l))try{await x.mutateAsync({scope:i,name:n.trim(),value:l,description:d.trim()||void 0}),_.success(r("settings.secrets.secretCreated",{name:n.trim()})),p()}catch(f){_.error(f instanceof Error?f.message:r("settings.secrets.failedToCreateSecret"))}}return s.jsx(I,{open:t,onOpenChange:u=>{u?e(u):p()},children:s.jsxs(q,{className:"sm:max-w-lg",children:[s.jsxs(V,{children:[s.jsx(H,{children:r("settings.secrets.newSecretTitle")}),s.jsx(G,{children:r("settings.secrets.newSecretDescription")})]}),s.jsxs("form",{onSubmit:b,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-scope",children:r("settings.secrets.scopeLabel")}),s.jsxs(K,{value:i,onValueChange:u=>c(u),children:[s.jsx(M,{id:"secret-scope",children:s.jsx(Q,{})}),s.jsxs(U,{children:[s.jsx(P,{value:"organization",children:r("settings.secrets.scopeOrganizationDescription")}),s.jsx(P,{value:"user",children:r("settings.secrets.scopePrivateDescription")})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-name",children:r("settings.secrets.nameLabel")}),s.jsx(z,{id:"secret-name",value:n,onChange:u=>a(u.target.value),placeholder:r("settings.secrets.namePlaceholder"),autoComplete:"off",required:!0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:r("settings.secrets.nameHelp")})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-value",children:r("settings.secrets.valueLabel")}),s.jsx(z,{id:"secret-value",type:"password",value:l,onChange:u=>o(u.target.value),autoComplete:"new-password",required:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-description",children:r("settings.secrets.descriptionLabel")}),s.jsx(W,{id:"secret-description",value:d,onChange:u=>m(u.target.value),rows:2,placeholder:r("settings.secrets.descriptionPlaceholder")})]}),s.jsxs(J,{children:[s.jsx(D,{type:"button",variant:"outline",onClick:p,disabled:x.isPending,children:r("settings.secrets.cancelButton")}),s.jsx(D,{type:"submit",disabled:x.isPending||!n.trim()||!l,children:x.isPending?r("settings.secrets.creatingButton"):r("settings.secrets.createButton")})]})]})]})})}function re(){const t=j.c(34),e=y(),r=X(),[i,c]=N.useState(!1);let n,a;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>c(!0),a=s.jsx(B,{size:14}),t[0]=n,t[1]=a):(n=t[0],a=t[1]);let l;t[2]!==e?(l=e("settings.secrets.newSecret"),t[2]=e,t[3]=l):l=t[3];let o;t[4]!==l?(o=s.jsx(C.Actions,{children:s.jsxs(D,{size:"sm",onClick:n,children:[a,l]})}),t[4]=l,t[5]=o):o=t[5];const d=o;if(r.length===0){let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(se,{action:!1}),t[6]=u):u=t[6];let f;t[7]!==i?(f=s.jsx(k,{open:i,onOpenChange:c}),t[7]=i,t[8]=f):f=t[8];let h;return t[9]!==d||t[10]!==f?(h=s.jsxs(s.Fragment,{children:[d,u,f]}),t[9]=d,t[10]=f,t[11]=h):h=t[11],h}let m,x,g;if(t[12]!==d||t[13]!==r||t[14]!==e){const u=r.filter(le),f=r.filter(ce),h=r.length===1?"settings.secrets.secretsCountSingular":"settings.secrets.secretsCountPlural";let S;t[18]!==r.length||t[19]!==e||t[20]!==h?(S=e(h,{count:r.length}),t[18]=r.length,t[19]=e,t[20]=h,t[21]=S):S=t[21];let v;t[22]!==S?(v=s.jsx("p",{className:"text-sm text-muted-foreground",children:S}),t[22]=S,t[23]=v):v=t[23],t[24]!==d||t[25]!==v?(m=s.jsxs("div",{className:"flex items-center justify-between",children:[v,d]}),t[24]=d,t[25]=v,t[26]=m):m=t[26],x=u.length>0?s.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionOrganization")}),s.jsx("div",{children:u.map(ie)})]}):null,g=f.length>0?s.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionPrivate")}),s.jsx("div",{children:f.map(ne)})]}):null,t[12]=d,t[13]=r,t[14]=e,t[15]=m,t[16]=x,t[17]=g}else m=t[15],x=t[16],g=t[17];let p;t[27]!==i?(p=s.jsx(k,{open:i,onOpenChange:c}),t[27]=i,t[28]=p):p=t[28];let b;return t[29]!==m||t[30]!==x||t[31]!==g||t[32]!==p?(b=s.jsxs(s.Fragment,{children:[m,x,g,p]}),t[29]=m,t[30]=x,t[31]=g,t[32]=p,t[33]=b):b=t[33],b}function ne(t){return s.jsx(T,{secret:t},t.id)}function ie(t){return s.jsx(T,{secret:t},t.id)}function ce(t){return t.scope==="user"}function le(t){return t.scope==="organization"}function ae(){const t=j.c(7),e=y();let r;t[0]!==e?(r=e("settings.nav.secrets"),t[0]=e,t[1]=r):r=t[1];let i;t[2]!==r?(i=s.jsx(C.Title,{children:r}),t[2]=r,t[3]=i):i=t[3];let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(F,{fallback:oe,children:s.jsx(N.Suspense,{fallback:s.jsx(L,{className:"h-32 w-full"}),children:s.jsx(re,{})})}),t[4]=c):c=t[4];let n;return t[5]!==i?(n=s.jsx(C,{children:s.jsx(C.Content,{children:s.jsx(C.Container,{children:s.jsxs($,{children:[i,c]})})})}),t[5]=i,t[6]=n):n=t[6],n}function oe(t){const{error:e}=t;return s.jsx(ee,{error:e??new Error("Failed to load secrets")})}function ze(){const t=j.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Z,{capability:"secrets:manage",area:"secrets",children:s.jsx(ae,{})}),t[0]=e):e=t[0],e}export{ze as default};
@@ -1 +1 @@
1
- import{c as Jt,b as Yt,r as j,l as oe,j as n,aR as ho,B as Vt,G as Kt,al as go,I as vo,H as So,o as yo,h as bo,t as N,K as xo}from"./index-C5LlvZFc.js";import{u as _o}from"./chat-context-CbVc7tEo.js";import{u as fs}from"./use-new-blocks-editor-Bq5-foqH.js";import{E as jo,F as Eo,G as ko,H as wo,I as Ro,J as Vo,K as To,V as No,L as Ao,N as Bn,O as Mo,Q as Po,C as cs,y as us,e as Co,f as Do,j as Ko,u as Bo,T as Ln,U as Lo,W as Fo,X as Io,Y as Oo,Z as zo,p as rs,A as kt,_ as $o,$ as Ho,w as Fn,a0 as Go,a1 as qo,a2 as is,a3 as In,a4 as On,a5 as zn,a6 as As,a7 as Wo,a8 as Uo,z as Jo,a9 as $n,aa as Yo,ab as Hn,ac as Gn,M as Qo,ad as qn,ae as lt,d as Xo,af as qt,ag as Zo,ah as er,ai as Ms,aj as tr}from"./runnable-block-editor-246vsgYp.js";import{c as sr}from"./repository-binding-BzfYTDYg.js";import{n as nr,t as ar}from"./ChevronUp-BAvbedXO.js";import{a6 as oa,b as ms,aj as or,z as rr,$ as Wn,I as Un}from"./agent-icon-CfuzWIKW.js";import{S as Bt}from"./scroll-area-DaBuMKS9.js";import{b as ct,T as ut,a as dt}from"./tooltip-66nc6La-.js";import{m as ir,u as lr,P as cr}from"./mustache-BgbWTbKV.js";import{aq as ra,c as Is,ar as ia,G as ur,ag as Rt,a4 as Ds,as as Ks,ah as xt,a5 as Lt,j as dr,l as mr,g as fr,r as ls,ak as pr,af as Wt,at as tt,au as Jn,a6 as Ps,ae as bt,ad as Ut,av as hr,aw as gr,K as vr,ax as Sr,ai as Yn,_ as Qn,ay as yr,az as wt,aA as br,aB as xr,aC as _r,aD as Xn,aE as jr,aF as Er,aG as kr,ac as wr,aH as Rr,aI as Vr,aJ as Tr,aK as Nr,ab as Ar,aL as Mr}from"./claim-phase-copy-C42LUZgr.js";import{a as Pr}from"./Copy01-C_KnfAlj.js";import{a as Bs,e as la}from"./UserSquare-CEkD4_s5.js";import{b as Zn}from"./Tool01-CWjV8YTI.js";import{s as ea}from"./Image01-BVwA4uCp.js";import{s as Cr}from"./Plus-GNsqHUli.js";import{s as Dr}from"./Trash01-BJ_e57Kj.js";import{i as Ls}from"./ZoomOut-B5FfXkUf.js";import{a as Kr,b as ta,d as Br,K as Lr,P as Fr,u as Ir,C as Or,s as zr,e as ds,D as $r,c as Hr,S as Gr,v as qr}from"./rich-text-link-control-DGgBIkoQ.js";import{a as Wr,P as sa,b as Ur}from"./page-seo-form-syG_NsyC.js";import{u as Jr,A as Yr}from"./use-section-preview-base-BGOkvMCT.js";import{b as na,a as Qr}from"./variant-matcher-override-Dv_-MENJ.js";import"./use-panel-navigate-BVY-Wy0A.js";import"./thread-route-CmSAw42O.js";import"./use-project-scope-Cg6fEvSs.js";import"./autosend-CsHrH9Xo.js";import"./thread-intent-Cc5BAaIc.js";import"./use-mcp-client-B2Vh9Cd7.js";import"./auth-5kOh9gsa.js";import"./backoff-8mStPHYB.js";import"./task-board-DGnwsIns.js";import"./schema-DvFu1ToO.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-decopilot-events-DSjzPVBT.js";import"./use-ai-providers-M9Gfv9f8.js";import"./location-DPIrGNp7.js";import"./use-organization-settings-Bq69ux21.js";import"./use-session-runtime-XVdydjwY.js";import"./Sun-7PdNidQ5.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BXahrBJ-.js";import"./LinkBroken01-CYAPpruG.js";import"./Check-BcGsLSsp.js";import"./format-time-CjIPQhCN.js";import"./differenceInSeconds-C3x8sHUj.js";import"./collapsible-BouI-hE9.js";import"./use-copy-B1c_EBRx.js";import"./usage-stats-yiZ6SKAb.js";import"./markdown-BNkxJvOO.js";import"./dialog-BJny2srB.js";import"./X-DvEbwZ22.js";import"./org-file-open-context-C7-ltXbm.js";import"./use-mobile-Du3isCXQ.js";import"./use-clock-tick-Db61eAzB.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-BEPdGRWf.js";import"./types-Ch9SdRcv.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./gateway-client-DPQb-ray.js";import"./tool-namespace-DmnQIdtF.js";import"./utils-CVEq3hMx.js";import"./AlertCircle-DrwoGJpd.js";import"./XClose-eArhRgkd.js";import"./ShoppingBag01-P4dMHDVk.js";import"./SearchMd-DeSQISfo.js";import"./shell-layout-BCgx5xUt.js";import"./avatar-CrasAAzq.js";import"./User01-CN7JcgS_.js";import"./Building02-DlH3FV2M.js";import"./download-app-dialog-CYxTt_wl.js";import"./CheckCircle-iXm3h-fF.js";import"./Monitor01-R0RI8JD-.js";import"./command-DA3SiBwF.js";import"./index-BsSf6-Tp.js";import"./integration-icon-Db99lv2a.js";import"./project-icon-ss5TCI0R.js";import"./new-project-dialog-CJlermXp.js";import"./ArrowLeft-DKYwT7KB.js";import"./input-NPHEwu7D.js";import"./label-DFV1EjGx.js";import"./repository-import-picker-BZ4SbZxQ.js";import"./use-navigate-to-agent-DeIS5d_A.js";import"./repository-picker-Bzznh2XU.js";import"./LinkExternal01-D_cGFYPK.js";import"./useInfiniteQuery-DpDVtLXw.js";import"./infiniteQueryObserver-DS3r5RyQ.js";import"./collection-search-FRa3rbYr.js";import"./use-debounced-value-C3ROkLpe.js";import"./required-auth-layout-DanliwF9.js";import"./use-org-sso-CW6lGteH.js";import"./sheet-DhV5S-lN.js";import"./use-connection-aogXB8HT.js";import"./Palette-Bh_thK5-.js";import"./Link01-BezCCi1I.js";import"./use-mcp-prompts-BBIzvKJ-.js";import"./index-Dm8tF0P6.js";import"./form-BsbEXxEk.js";import"./use-thread-outputs-DqGdi_Az.js";import"./file-type-icon-CvWWoRAO.js";import"./popover-98ItoIiE.js";import"./utils-DWTn-3pm.js";import"./monaco-editor-D29Kd2Kr.js";import"./editor-BFX6ra4l.js";import"./calendar-DJbd_Mk0.js";import"./textarea-CVYfh0wC.js";import"./select-BlojSjop.js";import"./index-CMWyW-nP.js";import"./switch-CMfc7QV5.js";import"./combobox-BYzyVsfP.js";import"./alert-dialog-BbSmZoVi.js";import"./sandbox-url-D3mC8qhT.js";import"./Upload01-3jf5OQDv.js";import"./DotsVertical-wjfpXF6W.js";import"./search-input--Cs2kN0G.js";import"./tabs-BQf21wqw.js";import"./use-file-configs-CF1-8iPu.js";import"./asset-utils-CiYXoNyJ.js";import"./use-chat-layout-state-EbMrj1Yk.js";import"./site-slug-DebpOoQq.js";import"./toggle-group-D_XfPgvt.js";import"./sandbox-git-api-B1R0585s.js";import"./ArrowUp-NsPNRi9p.js";import"./CreditCard01-B7CL5INn.js";import"./Key01-C3aJH3VU.js";import"./Users01-B-RFC-RT.js";import"./section-preview-url-7zfngvgW.js";function Xr(v){return v.schema?.definitions??v.schema?.$defs??{}}function ca(v,e){const u=Xr(e),p=u[btoa(v)];if(!p)return[];const h=[p];if(Array.isArray(p.allOf)){const k=p.allOf.find(w=>typeof w.$ref=="string")?.$ref;if(typeof k=="string"){const w=u[k.replace("#/definitions/","")];w&&h.push(w)}}return h}function Zr(v,e){for(const u of ca(v,e)){const p=typeof u.image=="string"?u.image:void 0;if(p?.includes("{{{"))return p}}function ei(v,e){if(!e)return;const u=ra(v);if(!u)return;const p=Zr(u.resolveType,e);if(!p)return;const h=jo(p,u.data);if(h)return Eo(h)}const ti={escape:ko};function si(v,e){for(const u of ca(v,e)){const p=typeof u.title=="string"?u.title:void 0;if(p?.includes("{{"))return p}}function ni(v,e){if(!e)return;const u=ra(v);if(u)try{const p=si(u.resolveType,e);return p&&ir.render(p,u.data,{},ti).trim()||void 0}catch{return}}function ai(v){const e=Jt.c(13),{icon:u,label:p,className:h}=v;let k;e[0]!==h?(k=oe("size-3.5",h),e[0]=h,e[1]=k):k=e[1];let w;e[2]!==u||e[3]!==k?(w=n.jsx(u,{className:k}),e[2]=u,e[3]=k,e[4]=w):w=e[4];let y;e[5]!==p||e[6]!==w?(y=n.jsx(ut,{asChild:!0,children:n.jsx("span",{role:"img","aria-label":p,className:"shrink-0 cursor-help",children:w})}),e[5]=p,e[6]=w,e[7]=y):y=e[7];let T;e[8]!==p?(T=n.jsx(dt,{className:"max-w-56",children:p}),e[8]=p,e[9]=T):T=e[9];let b;return e[10]!==y||e[11]!==T?(b=n.jsxs(ct,{children:[y,T]}),e[10]=y,e[11]=T,e[12]=b):b=e[12],b}const oi="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function aa(v){return Array.from({length:v},(e,u)=>({id:crypto.randomUUID(),index:u}))}function ua(v){return v.map((e,u)=>({...e,index:u}))}function ri(v,e){if(e===v.length)return v;if(e<v.length)return ua(v.slice(0,e));const u=Array.from({length:e-v.length},(p,h)=>({id:crypto.randomUUID(),index:v.length+h}));return[...v,...u]}function da(v){const e=Jt.c(44),{section:u,raw:p,meta:h,decofile:k}=v,w=Yt(),y=fs(),T=u.isSavedBlock===!0,b=u.isMultivariate===!0;let X;e[0]!==h||e[1]!==p?(X=p&&h?ei(p,h):void 0,e[0]=h,e[1]=p,e[2]=X):X=e[2];const me=X;let Ke;e[3]!==h||e[4]!==b||e[5]!==p||e[6]!==T?(Ke=p&&h&&!T&&!b?ni(p,h):void 0,e[3]=h,e[4]=b,e[5]=p,e[6]=T,e[7]=Ke):Ke=e[7];const Be=Ke;let Te;e[8]!==k||e[9]!==h||e[10]!==p||e[11]!==u?(Te=Ao(p,u,k,h),e[8]=k,e[9]=h,e[10]=p,e[11]=u,e[12]=Te):Te=e[12];const re=Te;let r;e[13]!==b||e[14]!==p?.__resolveType?(r=!b&&Is(p?.__resolveType??""),e[13]=b,e[14]=p?.__resolveType,e[15]=r):r=e[15];const V=r,ge=T?ms:b?oa:la;let $;e[16]!==b||e[17]!==T?($=T?{color:ur}:b?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=b,e[17]=T,e[18]=$):$=e[18];const c=$;let O;e[19]!==ge||e[20]!==y?(O=y?n.jsxs("span",{className:"relative size-4 shrink-0",children:[n.jsx(ge,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),n.jsx(Po,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):n.jsx(or,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=ge,e[20]=y,e[21]=O):O=e[21];let l;e[22]!==me?(l=me&&n.jsx("img",{src:me,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=me,e[23]=l):l=e[23];let J;e[24]!==y||e[25]!==c?(J=!y&&n.jsx(Bs,{className:"h-4 w-4 shrink-0",style:c}),e[24]=y,e[25]=c,e[26]=J):J=e[26];const G=y?"shrink":"flex-1",ke=u.isHidden&&"line-through opacity-50";let Ne;e[27]!==ke||e[28]!==G?(Ne=oe("min-w-0 truncate text-sm font-medium",G,ke),e[27]=ke,e[28]=G,e[29]=Ne):Ne=e[29];const qe=Be??u.label;let _e;e[30]!==Ne||e[31]!==qe?(_e=n.jsx("span",{className:Ne,children:qe}),e[30]=Ne,e[31]=qe,e[32]=_e):_e=e[32];let d;e[33]!==V||e[34]!==y||e[35]!==re||e[36]!==w?(d=y?n.jsxs(n.Fragment,{children:[V&&n.jsx(ai,{icon:Ls,label:w("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),re&&n.jsx(Bn,{}),n.jsx("span",{className:"min-w-0 flex-1"})]}):re&&n.jsx(Bn,{className:"absolute -right-0.5 -top-0.5"}),e[33]=V,e[34]=y,e[35]=re,e[36]=w,e[37]=d):d=e[37];let M;return e[38]!==_e||e[39]!==d||e[40]!==O||e[41]!==l||e[42]!==J?(M=n.jsxs(n.Fragment,{children:[O,l,J,_e,d]}),e[38]=_e,e[39]=d,e[40]=O,e[41]=l,e[42]=J,e[43]=M):M=e[43],M}const ii="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",li="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function ma(v,e,u){if(u)return Mo({selected:e});const p=v.isSavedBlock===!0,h=v.isMultivariate===!0;return oe("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":p?ii:h?li:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Cs(v,e){return oe("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":v?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function ci(v){const e=Jt.c(90),{section:u,raw:p,meta:h,decofile:k,sortableId:w,selected:y,onSelect:T,onDelete:b,onDuplicate:X,onMakeReusable:me,onToggleHidden:Ke,onToggleLazy:Be,onAddVariant:Te,onDetach:re}=v,r=Yt(),V=fs(),ge=p?Is(p.__resolveType??""):!1,$=u.isHidden===!0,c=ge||$;let O;e[0]!==u?(O=ia(u),e[0]=u,e[1]=O):O=e[1];const l=O;let J;e[2]!==w?(J={id:w,animateLayoutChanges:mi},e[2]=w,e[3]=J):J=e[3];const{attributes:G,listeners:ke,setNodeRef:Ne,transform:qe,isDragging:_e}=Ir(J);let d;e[4]!==qe?(d=Or.Transform.toString(qe?{...qe,x:0}:null),e[4]=qe,e[5]=d):d=e[5];const M=_e?0:void 0;let We;e[6]!==d||e[7]!==M?(We={transform:d,opacity:M},e[6]=d,e[7]=M,e[8]=We):We=e[8];const C=We;let Ue;e[9]!==u?(Ue=Ro(u),e[9]=u,e[10]=Ue):Ue=e[10];const z=Ue,mt="button",fe=0;let ze;e[11]!==T?(ze=P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),T())},e[11]=T,e[12]=ze):ze=e[12];const _t=_e?"cursor-grabbing":"cursor-pointer";let Le;e[13]!==V||e[14]!==u||e[15]!==y||e[16]!==_t?(Le=oe("touch-none transition-colors",_t,ma(u,y,V)),e[13]=V,e[14]=u,e[15]=y,e[16]=_t,e[17]=Le):Le=e[17];let ie;e[18]!==k||e[19]!==h||e[20]!==p||e[21]!==u?(ie=n.jsx(da,{section:u,raw:p,meta:h,decofile:k}),e[18]=k,e[19]=h,e[20]=p,e[21]=u,e[22]=ie):ie=e[22];const le=!V&&!u.isMultivariate&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r(ge?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:oe(Cs(c,ge)),onClick:P=>{P.stopPropagation(),Be()},onPointerDown:di,children:n.jsx(Ls,{className:oe("h-3.5 w-3.5",ge&&"text-warning")})})}),n.jsx(dt,{side:"bottom",children:r(ge?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),Ae=V?n.jsx(Vo,{label:r($?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:$,onToggle:Ke,children:$?n.jsx(Zn,{className:"h-3.5 w-3.5"}):n.jsx(ea,{className:"h-3.5 w-3.5"})}):n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r($?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:oe(Cs(c,$)),onClick:P=>{P.stopPropagation(),Ke()},onPointerDown:ui,children:$?n.jsx(Zn,{className:"h-3.5 w-3.5"}):n.jsx(ea,{className:"h-3.5 w-3.5"})})}),n.jsx(dt,{side:"bottom",children:r($?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),B=vo,A=To;let ce;e[23]!==r?(ce=r("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=r,e[24]=ce):ce=e[24];const we=oe(Cs(c,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let Me;e[25]!==A||e[26]!==ce||e[27]!==we?(Me=n.jsx(A,{label:ce,classicClassName:we}),e[25]=A,e[26]=ce,e[27]=we,e[28]=Me):Me=e[28];let Re;e[29]!==V||e[30]!==ge||e[31]!==Be||e[32]!==u.isMultivariate||e[33]!==r?(Re=V&&!u.isMultivariate&&n.jsxs(n.Fragment,{children:[n.jsxs(Kt,{onClick:P=>{P.stopPropagation(),Be()},children:[n.jsx(Ls,{className:"h-4 w-4"}),r(ge?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),n.jsx(go,{})]}),e[29]=V,e[30]=ge,e[31]=Be,e[32]=u.isMultivariate,e[33]=r,e[34]=Re):Re=e[34];let H;e[35]!==X?(H=P=>{P.stopPropagation(),X()},e[35]=X,e[36]=H):H=e[36];let ue;e[37]===Symbol.for("react.memo_cache_sentinel")?(ue=n.jsx(Pr,{className:"h-4 w-4"}),e[37]=ue):ue=e[37];let je;e[38]!==r?(je=r("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=r,e[39]=je):je=e[39];let pe;e[40]!==H||e[41]!==je?(pe=n.jsxs(Kt,{onClick:H,children:[ue,je]}),e[40]=H,e[41]=je,e[42]=pe):pe=e[42];let ne;e[43]!==V||e[44]!==l||e[45]!==Te||e[46]!==r?(ne=l&&n.jsxs(Kt,{className:oe(!V&&No),onClick:P=>{P.stopPropagation(),Te()},children:[n.jsx(oa,{className:"h-4 w-4"}),r("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=V,e[44]=l,e[45]=Te,e[46]=r,e[47]=ne):ne=e[47];let he;e[48]!==V||e[49]!==z||e[50]!==me||e[51]!==r?(he=z&&n.jsxs(Kt,{className:oe(!V&&oi),onClick:P=>{P.stopPropagation(),me()},children:[V?n.jsx(ms,{className:"h-4 w-4"}):n.jsx(Bs,{className:"h-4 w-4"}),r("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=V,e[49]=z,e[50]=me,e[51]=r,e[52]=he):he=e[52];let ae;e[53]!==V||e[54]!==re||e[55]!==u.isMultivariate||e[56]!==u.isSavedBlock||e[57]!==r?(ae=u.isSavedBlock===!0&&!u.isMultivariate&&n.jsxs(Kt,{onClick:P=>{P.stopPropagation(),re()},children:[V?n.jsx(la,{className:"h-4 w-4"}):n.jsx(Bs,{className:"h-4 w-4"}),r("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=V,e[54]=re,e[55]=u.isMultivariate,e[56]=u.isSavedBlock,e[57]=r,e[58]=ae):ae=e[58];let Pe;e[59]!==b?(Pe=P=>{P.stopPropagation(),b()},e[59]=b,e[60]=Pe):Pe=e[60];let ve;e[61]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(Dr,{className:"h-4 w-4"}),e[61]=ve):ve=e[61];let Ve;e[62]!==r?(Ve=r("sectionsEditor.sectionList.deleteMenuItem"),e[62]=r,e[63]=Ve):Ve=e[63];let Ee;e[64]!==Pe||e[65]!==Ve?(Ee=n.jsxs(Kt,{variant:"destructive",onClick:Pe,children:[ve,Ve]}),e[64]=Pe,e[65]=Ve,e[66]=Ee):Ee=e[66];let Se;e[67]!==Re||e[68]!==pe||e[69]!==ne||e[70]!==he||e[71]!==ae||e[72]!==Ee?(Se=n.jsxs(So,{align:"end",className:"w-44",children:[Re,pe,ne,he,ae,Ee]}),e[67]=Re,e[68]=pe,e[69]=ne,e[70]=he,e[71]=ae,e[72]=Ee,e[73]=Se):Se=e[73];let ye;e[74]!==B||e[75]!==Me||e[76]!==Se?(ye=n.jsxs(B,{children:[Me,Se]}),e[74]=B,e[75]=Me,e[76]=Se,e[77]=ye):ye=e[77];let $e;return e[78]!==G||e[79]!==ke||e[80]!==T||e[81]!==Ne||e[82]!==C||e[83]!==Le||e[84]!==ie||e[85]!==le||e[86]!==Ae||e[87]!==ye||e[88]!==ze?($e=n.jsxs("div",{ref:Ne,style:C,...G,...ke,role:mt,tabIndex:fe,onClick:T,onKeyDown:ze,className:Le,children:[ie,le,Ae,ye]}),e[78]=G,e[79]=ke,e[80]=T,e[81]=Ne,e[82]=C,e[83]=Le,e[84]=ie,e[85]=le,e[86]=Ae,e[87]=ye,e[88]=ze,e[89]=$e):$e=e[89],$e}function ui(v){return v.stopPropagation()}function di(v){return v.stopPropagation()}function mi(){return!1}function Fs(v){const e=Jt.c(11),{canAddSection:u,onAddSection:p,className:h,size:k}=v,w=Yt();let y;e[0]!==h?(y=oe("w-full",h),e[0]=h,e[1]=y):y=e[1];const T=!u;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Cr,{size:14}),e[2]=b):b=e[2];let X;e[3]!==w?(X=w("sectionsEditor.sectionList.addSectionButton"),e[3]=w,e[4]=X):X=e[4];let me;return e[5]!==p||e[6]!==k||e[7]!==y||e[8]!==T||e[9]!==X?(me=n.jsxs(Vt,{type:"button",variant:"outline",size:k,className:y,disabled:T,onClick:p,children:[b,X]}),e[5]=p,e[6]=k,e[7]=y,e[8]=T,e[9]=X,e[10]=me):me=e[10],me}function fi(v){const e=Jt.c(101),{listKey:u,rawSections:p,sections:h,meta:k,decofile:w,selectedIndex:y,onSelect:T,onReorder:b,onDelete:X,onDuplicate:me,onMakeReusable:Ke,onToggleHidden:Be,onToggleLazy:Te,onAddVariant:re,onDetach:r,onAddSection:V,canAddSection:ge}=v,$=ge===void 0?!0:ge,c=Yt(),O=fs();let l;e[0]!==h.length?(l=()=>aa(h.length),e[0]=h.length,e[1]=l):l=e[1];const[J,G]=j.useState(l),[ke,Ne]=j.useState(null),[qe,_e]=j.useState(u),[d,M]=j.useState(h.length),We=j.useRef(!1);qe!==u?(_e(u),M(h.length),G(aa(h.length))):d!==h.length&&(M(h.length),G(Ce=>ri(Ce,h.length)));let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[2]=C):C=e[2];let Ue;e[3]===Symbol.for("react.memo_cache_sentinel")?(Ue={coordinateGetter:zr},e[3]=Ue):Ue=e[3];const z=Kr(ta(Fr,C),ta(Lr,Ue));let mt;e[4]!==J?(mt=J.map(pi),e[4]=J,e[5]=mt):mt=e[5];const fe=mt;let ze;e[6]===Symbol.for("react.memo_cache_sentinel")?(ze=Ce=>{Ne(String(Ce.active.id))},e[6]=ze):ze=e[6];const _t=ze;let Le;e[7]!==fe||e[8]!==b?(Le=Ce=>{Ne(null);const{active:L,over:D}=Ce;if(!D||L.id===D.id)return;const Fe=fe.indexOf(String(L.id)),Ze=fe.indexOf(String(D.id));Fe===-1||Ze===-1||(G(nt=>ua(ds([...nt],Fe,Ze))),We.current=!0,requestAnimationFrame(()=>{We.current=!1}),b?.(Fe,Ze))},e[7]=fe,e[8]=b,e[9]=Le):Le=e[9];const ie=Le;let le;e[10]===Symbol.for("react.memo_cache_sentinel")?(le=()=>{Ne(null)},e[10]=le):le=e[10];const Ae=le;let B,A,ce,we,Me,Re,H,ue,je,pe,ne,he,ae,Pe,ve;if(e[11]!==ke||e[12]!==$||e[13]!==O||e[14]!==w||e[15]!==J||e[16]!==fe||e[17]!==ie||e[18]!==k||e[19]!==V||e[20]!==re||e[21]!==X||e[22]!==r||e[23]!==me||e[24]!==Ke||e[25]!==T||e[26]!==Be||e[27]!==Te||e[28]!==p||e[29]!==h||e[30]!==y||e[31]!==z||e[32]!==c){Pe=Symbol.for("react.early_return_sentinel");e:{const Ce=L=>{We.current||T(L)};if(e[48]!==ke||e[49]!==$||e[50]!==O||e[51]!==J||e[52]!==V||e[53]!==p||e[54]!==h||e[55]!==c){const L=ke?J.find(D=>D.id===ke):null;if(we=L!=null?h[L.index]:null,ce=L!=null?p[L.index]:void 0,J.length===0){let D;e[59]!==c?(D=c("sectionsEditor.sectionList.noSections"),e[59]=c,e[60]=D):D=e[60];let Fe;e[61]!==D?(Fe=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:D}),e[61]=D,e[62]=Fe):Fe=e[62];const Ze=Fe;let nt;e[63]!==$||e[64]!==O||e[65]!==Ze||e[66]!==V?(nt=O?Ze:n.jsxs("div",{className:"space-y-2",children:[Ze,n.jsx(Fs,{canAddSection:$,onAddSection:V,size:"sm"})]}),e[63]=$,e[64]=O,e[65]=Ze,e[66]=V,e[67]=nt):nt=e[67],Pe=nt;break e}ae=oe(L&&"cursor-grabbing"),e[48]=ke,e[49]=$,e[50]=O,e[51]=J,e[52]=V,e[53]=p,e[54]=h,e[55]=c,e[56]=ce,e[57]=we,e[58]=ae}else ce=e[56],we=e[57],ae=e[58];A=$r,ue=z,je=Hr,pe=_t,ne=ie,he=Ae,B=Gr,Re=fe,H=qr,ve="space-y-1",Me=J.map(L=>{const D=h[L.index];return D?n.jsx(ci,{sortableId:L.id,section:D,raw:p[L.index],meta:k,decofile:w,selected:y===L.index,onSelect:()=>Ce(L.index),onDelete:()=>X(L.index),onDuplicate:()=>me(L.index),onMakeReusable:()=>Ke(L.index),onToggleHidden:()=>Be(L.index),onToggleLazy:()=>Te(L.index),onAddVariant:()=>re(L.index),onDetach:()=>r(L.index)},L.id):null})}e[11]=ke,e[12]=$,e[13]=O,e[14]=w,e[15]=J,e[16]=fe,e[17]=ie,e[18]=k,e[19]=V,e[20]=re,e[21]=X,e[22]=r,e[23]=me,e[24]=Ke,e[25]=T,e[26]=Be,e[27]=Te,e[28]=p,e[29]=h,e[30]=y,e[31]=z,e[32]=c,e[33]=B,e[34]=A,e[35]=ce,e[36]=we,e[37]=Me,e[38]=Re,e[39]=H,e[40]=ue,e[41]=je,e[42]=pe,e[43]=ne,e[44]=he,e[45]=ae,e[46]=Pe,e[47]=ve}else B=e[33],A=e[34],ce=e[35],we=e[36],Me=e[37],Re=e[38],H=e[39],ue=e[40],je=e[41],pe=e[42],ne=e[43],he=e[44],ae=e[45],Pe=e[46],ve=e[47];if(Pe!==Symbol.for("react.early_return_sentinel"))return Pe;let Ve;e[68]!==Me||e[69]!==ve?(Ve=n.jsx("div",{className:ve,children:Me}),e[68]=Me,e[69]=ve,e[70]=Ve):Ve=e[70];let Ee;e[71]!==B||e[72]!==Re||e[73]!==H||e[74]!==Ve?(Ee=n.jsx(B,{items:Re,strategy:H,children:Ve}),e[71]=B,e[72]=Re,e[73]=H,e[74]=Ve,e[75]=Ee):Ee=e[75];let Se;e[76]!==ce||e[77]!==we||e[78]!==O||e[79]!==w||e[80]!==k?(Se=we?n.jsx("div",{className:oe("cursor-grabbing shadow-lg ring-1 ring-border/60",ma(we,!1,O)),children:n.jsx(da,{section:we,raw:ce,meta:k,decofile:w})}):null,e[76]=ce,e[77]=we,e[78]=O,e[79]=w,e[80]=k,e[81]=Se):Se=e[81];let ye;e[82]!==Se?(ye=ho.createPortal(n.jsx(Br,{dropAnimation:wo,children:Se}),document.body),e[82]=Se,e[83]=ye):ye=e[83];let $e;e[84]!==A||e[85]!==ue||e[86]!==je||e[87]!==pe||e[88]!==ne||e[89]!==he||e[90]!==Ee||e[91]!==ye?($e=n.jsxs(A,{sensors:ue,collisionDetection:je,onDragStart:pe,onDragEnd:ne,onDragCancel:he,children:[Ee,ye]}),e[84]=A,e[85]=ue,e[86]=je,e[87]=pe,e[88]=ne,e[89]=he,e[90]=Ee,e[91]=ye,e[92]=$e):$e=e[92];let P;e[93]!==$||e[94]!==O||e[95]!==V?(P=!O&&n.jsx(Fs,{canAddSection:$,onAddSection:V,size:"sm",className:"mt-2"}),e[93]=$,e[94]=O,e[95]=V,e[96]=P):P=e[96];let st;return e[97]!==ae||e[98]!==$e||e[99]!==P?(st=n.jsxs("div",{className:ae,children:[$e,P]}),e[97]=ae,e[98]=$e,e[99]=P,e[100]=st):st=e[100],st}function pi(v){return v.id}function hi(v,e,u,p){if(!v||typeof v!="object")return{kind:"error",reason:"no-matcher-rule"};const h=e.trim();if(!h)return Rt(v,u,p)?{kind:"inline",blockKey:v.__resolveType??"",inlinedRule:Ds(v,u,p)}:{kind:"noop"};const k=Ks(v,u,p);if(!k)return{kind:"error",reason:"unreadable-rule"};if(k.blockKey)return{kind:"updateBlock",blockKey:k.blockKey,blockData:xt(k.resolveType,k.data,h)};const w=cs(h),y=us(w,u);return y?{kind:"error",reason:"invalid-block-id",message:y}:{kind:"createBlock",blockId:w,blockData:xt(k.resolveType,k.data,h),reference:Lt(w)}}function Bc({orgSlug:v,virtualMcpId:e,branch:u,previewReady:p=!0,previewUrl:h,currentPath:k,activePageBlockKey:w=null,activeGlobalBlockKey:y=null,externalSelection:T,onSaved:b,initialEditSeo:X=!1,onExitSeo:me,onSelectRoot:Ke,onViewJsonFile:Be,onFocusedBlockChange:Te,onVariantPreviewOverride:re}){const r=Yt(),V=_o(),ge=V?.taskId??null,$=p?{orgSlug:v,virtualMcpId:e,branch:u,threadId:ge,previewUrl:h}:null,{data:c,isLoading:O}=Co($),{data:l,isLoading:J}=Do($),G=fs(),ke=V?.virtualMcpId,qe=sr(ke===e?e:null)?.metadata?.siteSlug??null,_e=Jr({virtualMcpId:e,sandboxUrl:h}),[d,M]=j.useState(null),[We,C]=j.useState(null),[Ue,z]=j.useState(null),[mt,fe]=j.useState(0),[ze,_t]=j.useState(void 0),[Le,ie]=j.useState(null),[le,Ae]=j.useState(null),[B,A]=j.useState([]),ce=j.useRef(null),[we,Me]=j.useState(B.length);we!==B.length&&(Me(B.length),requestAnimationFrame(()=>{ce.current&&(ce.current.scrollTop=0)}));const[Re,H]=j.useState(0),[ue,je]=j.useState(null),[pe,ne]=j.useState(null),[he,ae]=j.useState(null),[Pe,ve]=j.useState(!1),[Ve,Ee]=j.useState(!1),Se=j.useRef(null),[ye,$e]=j.useState(!0),[P,st]=j.useState(!1),[Ce,L]=j.useState(!1),[D,Fe]=j.useState(X),[Ze,nt]=j.useState(X);X&&!Ze&&(nt(!0),Fe(!0),M(null),C(null),z(null),A([])),!X&&Ze&&nt(!1);const[fa,Qt]=j.useState(null),[Os,ps]=j.useState(void 0),[zs,jt]=j.useState([]),[$s,Ft]=j.useState(0),[Ie,Je]=j.useState(0),[pa,De]=j.useState(null),[Tt,Oe]=j.useState(null),[Hs,Gs]=j.useState(null),ha=yo(),ga=`${v}/${e}/${u}`,Xt=Ko({orgSlug:v,virtualMcpId:e,branch:u}),[va,Sa]=j.useState(k),[ya,ba]=j.useState(w),[xa,_a]=j.useState(y);(va!==k||ya!==w||xa!==y)&&(queueMicrotask(()=>Xt.flush()),Sa(k),ba(w),_a(y),M(null),C(null),z(null),fe(0),ie(null),Ae(null),Je(0),De(null),Oe(null),A([]),H(t=>t+1),Fe(!1),Qt(null),ps(void 0),jt([]),Ft(t=>t+1));const Y=Bo({orgSlug:v,virtualMcpId:e,branch:u}),It=Xo((t,s)=>{Y.mutate({blockKey:t,data:s},{onSuccess:()=>b?.(),onError:a=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),Zt=lr({orgSlug:v,virtualMcpId:e,branch:u}),[Nt,At]=j.useState(!1),q=j.useRef(null),qs=j.useRef(null),at=j.useRef(null),ot=j.useRef(null),hs=j.useRef({}),He=j.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[ja,Ea]=j.useState(null);if(!p||O||J)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(bo,{className:"size-5 text-muted-foreground"})});if(!c||!l)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const ka=dr(c),Q=!!y,te=Q?null:mr(ka,k,w),g=Q?y:te?.key??null,gs=Q&&y?c[y]:void 0,Ws=Q&&y&&gs?fr(y,gs):Q&&y?y:"",Ot=!Q&&g&&c[g]?c[g]:null,vs=D&&c&&l&&g&&te?Ln(c,{kind:"page",pageKey:g,pageName:String(te.name??""),path:String(te.path??"")},l):null,wa=D?Ot?.seo:void 0,es=Os!==void 0?Os:wa,Ra=D?Lo(es):void 0,Us=vs?.seoTypeOptions??[],Js=D&&l?Fo(l):"",Ss=fa??Ra??{},ts=D&&vs?Wr(Ss,vs):null,Ys=D&&ts&&Io(es)?ls(ts,l):null,Qs=D?Oo(c,l)?.seoData:void 0,de=Q?[{label:"Default",sections:[{__resolveType:y}]}]:zo(Ot?.sections,c??{}),et=de.length>1,se=Math.min(mt,de.length-1),Ge=de[se],K=Ge?.sections??[],be=rs(K,c),ys=!Q&&pr(Ot?.sections);if(Q&&y&&Hs!==y){Gs(y);const t=K[0],s=be[0];if(t&&s){M(0),Je(0),A([]);const a=kt(t,s,c);a&&(C(a.data),z(a.resolveType),Oe(null),De(null))}}!Q&&Hs!==null&&Gs(null),He.current={rawSections:K,parsedSections:be,decofile:c??{},activePageKey:g,pageVariants:de,variantIndex:se,sectionVariantIndex:Ie,selectedSectionIndex:d};const Va=()=>({multivariate:ys,index:se,variants:de.map(t=>({rule:t.rule}))}),bs=(t,s)=>{if(!re)return;if(!g||!ys||t.length<=1){re(null);return}const a=na(g,{multivariate:!0,index:s,variants:t},c,l);re(a.length>0?a:null)},xs=re&&g&&ys&&et&&!O&&!J?g:null;if(xs!==ja&&(Ea(xs),xs)){const t=de.map(a=>({rule:a.rule})),s=se;queueMicrotask(()=>bs(t,s))}const Mt=(t,s,a)=>{if(!re)return;if(!g){re(null);return}const o=Va(),i=na(g,o,c,l);if(!t||s<0){re(i.length>0?i:null);return}const m=Qr({pageKey:g,page:o,sectionIndex:s,sectionLazy:be[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:c,meta:l}),f=[...i,...m];re(f.length>0?f:null)},ft=(t,s,a,o=d??-1,i=!1)=>{const m=tt(t,s);if(!m){C(null),z(null),Oe(null),De(null),i&&Mt(null,o,a);return}const x=Jn(m,lt)[a];if(!x){C(null),z(null),Oe(null),De(null),i&&Mt(null,o,a);return}const R=hr(x.value,c);C(R?.data??null),z(R?.resolveType??null);const{resolveType:S,formValue:E}=Wt(x.rule,c,l??void 0);Oe(S),De(E),i&&Mt(m,o,a)},zt=T?.index;if(T!==void 0&&(T?.seq??null)!==ze&&(_t(T?.seq??null),typeof zt=="number")){const t=K[zt],s=be[zt];if(t&&s)if(M(zt),Je(0),A([]),H(a=>a+1),s.isMultivariate)ft(t,s,0,zt);else{const a=kt(t,s,c);a?(C(a.data),z(a.resolveType)):(C(null),z(null)),Oe(null),De(null)}}const $t={orgSlug:v,virtualMcpId:e,branch:u,threadId:ge,previewUrl:h??void 0,siteSlug:qe},_s=Ue&&l?ls(Ue,l):null,Ye=(t,s)=>{if(!g)return;q.current&&(clearTimeout(q.current),q.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null),at.current&&(clearTimeout(at.current),at.current=null);const a=qt(c,g,t,se,de);Y.mutate({blockKey:g,data:a},{onSuccess:()=>s?.onSuccess?.()??b?.(),onError:o=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:o.message}))})},Pt=()=>{Te?.(null),M(null),L(!1),C(null),z(null),Je(0),De(null),Oe(null),A([]),H(t=>t+1)},Ta=(t,s)=>{const a=He.current.sectionVariantIndex,o=qs.current;q.current&&(clearTimeout(q.current),q.current=null,o&&(o.sectionIndex!==s||o.sectionVariantIndex!==a)&&o.write());const i=()=>{const{rawSections:m,parsedSections:f,decofile:x,activePageKey:R,pageVariants:S,variantIndex:E}=He.current,_=m[s];if(!_)return;const W=f[s];if(!W)return;if(W.isSavedBlock){const F=tr(_,W);if(!F)return;Y.mutate({blockKey:F,data:t},{onSuccess:()=>b?.(),onError:U=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:U.message}))});return}if(!R)return;const Z={...x[R]},ee=[...m];if(W.isMultivariate){const F=tt(_,W);if(!F||!R)return;const U=Tr(F,a,t);ee[s]=wt(_,W,U)}else if(W.isHidden){const F=Is(_.__resolveType),U=F?{..._.section}:{..._},I=Array.isArray(U.variants)?[...U.variants]:[];I[0]&&(I[0]={...I[0],value:t}),U.variants=I,F?ee[s]={..._,section:U}:ee[s]=U}else W.isLazy?ee[s]={..._,section:t}:ee[s]=t;if(S.length>1){const F=Z.sections,U=[...F?.variants??[]];U[E]&&(U[E]={...U[E],value:ee}),Z.sections={...F,variants:U}}else Z.sections=ee;Y.mutate({blockKey:R,data:Z},{onSuccess:()=>b?.(),onError:F=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:F.message}))})};qs.current={sectionIndex:s,sectionVariantIndex:a,write:i},q.current=setTimeout(()=>{q.current=null,i()},Ms)},Na=t=>{M(t),Je(0),A([]),H(i=>i+1);const s=K[t],a=be[t];if(Te?.(a?.isSavedBlock?a.resolveType??null:null),!s||!a)return;if(a.isMultivariate){ft(s,a,0,t);return}const o=kt(s,a,c);if(!o){C(null),z(null),Oe(null),De(null),Mt(null,t,0);return}C(o.data),z(o.resolveType),Oe(null),De(null),Mt(null,t,0)},Xs=t=>{const s=t;C(s),d!==null&&Ta(s,d)},js=t=>{if(!g||!c||!l||!te)return;const s={kind:"page",pageKey:g,pageName:String(te.name??""),path:String(te.path??"")},a=Ln(c,s,l);a&&Xt.save(g,()=>{const o=ha.getQueryData(xo.decofile(ga))?.[g];if(!o||typeof o!="object"||o===null||Array.isArray(o))return null;const i={...o,...hs.current};return hs.current={},t?.raw!==void 0?{...i,seo:t.raw}:t?.inner!==void 0?Ur(s,a,i,t.inner):i})},Zs=(t,s)=>{g&&(hs.current[t]=s,js())},Aa=(t,s)=>{if(!g)return;const a=ds([...K],t,s);d!==null&&(d===t?M(s):t<d&&s>=d?M(d-1):t>d&&s<=d&&M(d+1)),Ye(a)},Ma=t=>{if(!g)return;const s=K.filter((a,o)=>o!==t);d===t?Pt():d!==null&&d>t&&M(d-1),Ye(s)},Pa=t=>{if(!g)return;const s=K[t];if(!s)return;const a=[...K];a.splice(t+1,0,Zo(s)),d!==null&&d>t&&M(d+1),Ye(a)},Ca=t=>{if(!g)return;const s=K[t],a=be[t];if(!s||!a)return;const o=a.isHidden?Er(s):kr(s);if(!o)return;const i=[...K];i[t]=o,d===t&&Pt(),Ye(i)},Da=t=>{if(!g)return;const s=K[t],a=be[t];if(!s||!a||a.isMultivariate)return;const o=jr(s);if(!o)return;const i=[...K];i[t]=o,d===t&&Pt(),Ye(i)},Ka=t=>{if(!g)return;const s=K[t],a=be[t];if(!s||!a?.isSavedBlock)return;const o=kt(s,a,c);if(!o?.data)return;const{name:i,...m}=o.data,f=[...K];a.isLazy?f[t]={...s,section:m}:f[t]=m,d===t&&Pt(),Ye(f)},Ba=t=>{if(!g)return;const s=[...K,{__resolveType:t.resolveType}],a=s.length-1;Ye(s,{onSuccess:()=>{ve(!1),M(a),Je(0),A([]),H(f=>f+1);const o=s[a],i=rs(s,c)[a];if(!o||!i)return;if(i.isMultivariate){ft(o,i,0);return}const m=kt(o,i,c);if(!m){C(null),z(null),Oe(null),De(null);return}C(m.data),z(m.resolveType),Oe(null),De(null)}})},en=t=>{Se.current=t.append,ve(!0)},La=t=>{const s=Se.current;if(!s){Ba(t);return}s({__resolveType:t.resolveType}),ve(!1),Se.current=null},tn=t=>{if(d===null)return;const s=K[d],a=be[d];!s||!a?.isMultivariate||(Je(t),A([]),H(o=>o+1),ft(s,a,t,d,!0))},Fa=t=>{if(d===null||!g)return;const s=K[d],a=be[d];if(!s||!a?.isMultivariate)return;const o=tt(s,a);if(!o)return;const i=xr(o,t);if(!i){N.error(r("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const m=[...K];m[d]=wt(s,a,i);const f=i.variants;let x=Ie;t===Ie?x=Math.min(t,f.length-1):t<Ie&&(x=Ie-1),Je(x),A([]),H(R=>R+1),ft(m[d],a,x),Ye(m)},Ia=t=>{if(d===null||!g)return;const s=K[d],a=be[d];if(!s||!a?.isMultivariate)return;const o=tt(s,a);if(!o)return;const i=_r(o,t),m=[...K];m[d]=wt(s,a,i);const f=t+1;Je(f),A([]),H(x=>x+1),ft(m[d],a,f),Ye(m)},Oa=(t,s)=>{if(d===null||!g||t===s)return;const a=K[d],o=be[d];if(!a||!o?.isMultivariate)return;const i=tt(a,o);if(!i)return;const m=yr(i,t,s),f=[...K];f[d]=wt(a,o,m);let x=Ie;Ie===t?x=s:t<Ie&&s>=Ie?x=Ie-1:t>Ie&&s<=Ie&&(x=Ie+1),Je(x),ft(f[d],o,x),Ye(f)},Ht=t=>{const s=t??d;if(s===null||!g)return;const a=K[s],o=be[s];if(!a||!o)return;const i=gr(a,o);if(!i){N.error(r("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const m=[...K];m[s]=i.section;const f=rs(m,c)[s];if(!f?.isMultivariate){N.error(r("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}M(s),Je(i.newVariantIndex),A([]),H(x=>x+1),ft(i.section,f,i.newVariantIndex,s),Ye(m)},sn=()=>{if(d===null||!g)return;const t=K[d],s=be[d];if(!t||!s?.isMultivariate)return;const a=tt(t,s);if(!a)return;const o=br(t,s,a);if(!o){N.error(r("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const i=[...K];i[d]=o;const m=rs(i,c)[d];if(!m)return;Je(0),Oe(null),De(null),A([]),H(x=>x+1);const f=kt(o,m,c);f?(C(f.data),z(f.resolveType)):(C(null),z(null)),Mt(null,d,0),Ye(i)},za=async t=>{if(ue===null||!g)return;const s=us(t,c);if(s){N.error(s);return}const a=K[ue],o=be[ue];if(!a||!o)return;const i=kt(a,o,c);if(!i){N.error(r("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const m={...i.data,name:t};try{await Y.mutateAsync({blockKey:t,data:m});const f=[...K];f[ue]={__resolveType:t},await Y.mutateAsync({blockKey:g,data:qt(c,g,f,se,de)}),d===ue&&Pt(),je(null),N.success(r("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),b?.()}catch(f){N.error(f instanceof Error?f.message:r("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},nn=Ge?.rule;if(et&&d===null&&le===null&&nn){const{resolveType:t,formValue:s}=Wt(nn,c??{},l??void 0);Ae(t),ie(s)}const Ct=l?$o(l):[],Es=l&&c?Ho(l,c):[],an=!Q&&!!(_e&&l&&c),on=le&&l?ls(le,l):null,pt=()=>{at.current&&(clearTimeout(at.current),at.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null)},Et=async(t,s)=>{if(!(Vr(s,t,l)>0))try{await Zt.mutateAsync({blockKey:t})}catch(a){N.error(a instanceof Error?a.message:r("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},rn=t=>{at.current&&clearTimeout(at.current),at.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:o}=He.current;if(!s)return;const i={...a[s]},m={...i.sections},f=[...m.variants??[]],x=f[o],R=x?.rule;if(Rt(R,a,l)){const S=R?.__resolveType??"",E=a[S],_=typeof E?.name=="string"?E.name:S,{__resolveType:W,...Z}=t;Y.mutate({blockKey:S,data:xt(W??"",Z,_)},{onSuccess:()=>b?.(),onError:ee=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:ee.message}))});return}x&&(f[o]={...x,rule:t}),i.sections={...m,variants:f},Y.mutate({blockKey:s,data:i},{onSuccess:()=>b?.(),onError:S=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:S.message}))})},Ms)},ln=t=>{Ae(t);const s=t?Yn(t,l):{__resolveType:Qn};ie(t?s:{}),rn(s)},cn=t=>{const s=t;ie(s);const a=le?{__resolveType:le,...s}:{...s};rn(a)},un=async t=>{pt();const{activePageKey:s,decofile:a,variantIndex:o}=He.current;if(!s)return;const i=a[s],m=i?.sections;if(!m||typeof m!="object"||Array.isArray(m))return;const f=m;if(!Array.isArray(f.variants))return;const x=[...f.variants],R=x[o];if(!R)return;const S=bt(R.rule,a,l),E=Lt(t);x[o]={...R,rule:E};const _={...a,[s]:{...i,sections:{...f,variants:x}}},{resolveType:W,formValue:Z}=Wt(E,_,l??void 0);Ae(W),ie(Z);try{await Y.mutateAsync({blockKey:s,data:_[s]}),S&&S!==t&&await Et(S,_),b?.()}catch(ee){N.error(ee instanceof Error?ee.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},dn=t=>{ot.current&&clearTimeout(ot.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=He.current;s!==null&&(ot.current=setTimeout(()=>{const{rawSections:o,parsedSections:i,decofile:m,activePageKey:f,pageVariants:x,variantIndex:R}=He.current;if(!f)return;const S=o[s],E=i[s];if(!S||!E?.isMultivariate)return;const _=tt(S,E);if(!_)return;const Z=(_.variants??[])[a]?.rule;if(Rt(Z,m,l)){const I=Z?.__resolveType??"",Xe=m[I],rt=typeof Xe?.name=="string"?Xe.name:I,{__resolveType:St,...it}=t;Y.mutate({blockKey:I,data:xt(St??"",it,rt)},{onSuccess:()=>b?.(),onError:yt=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:yt.message}))});return}const ee=Xn(_,a,t),F=[...o];F[s]=wt(S,E,ee);const U=qt(m,f,F,R,x);Y.mutate({blockKey:f,data:U},{onSuccess:()=>b?.(),onError:I=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:I.message}))})},Ms))},$a=t=>{Oe(t);const s=t?Yn(t,l):{__resolveType:Qn};De(t?s:{}),dn(s)},Ha=t=>{const s=t;De(s);const a=Tt?{__resolveType:Tt,...s}:{...s};dn(a)},Ga=async t=>{pt();const{selectedSectionIndex:s,sectionVariantIndex:a,rawSections:o,parsedSections:i,decofile:m,activePageKey:f,pageVariants:x,variantIndex:R}=He.current;if(s===null||!f)return;const S=o[s],E=i[s];if(!S||!E?.isMultivariate)return;const _=tt(S,E);if(!_)return;const W=_.variants??[],Z=bt(W[a]?.rule,m,l),ee=Lt(t),F=Xn(_,a,ee),U=[...o];U[s]=wt(S,E,F);const I=qt(m,f,U,R,x),Xe={...m,[f]:I},{resolveType:rt,formValue:St}=Wt(ee,Xe,l??void 0);Oe(rt),De(St);try{await Y.mutateAsync({blockKey:f,data:I}),Z&&Z!==t&&await Et(Z,Xe),b?.()}catch(it){N.error(it instanceof Error?it.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!Q&&!te)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.noPageFound",{currentPath:k})});if(Q&&!gs)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.globalBlockNotFound")});const xe=d!==null?be[d]??null:null,mn=d!==null?K[d]:null,fn=mn&&xe?.isMultivariate?tt(mn,xe):null,ht=fn?Jn(fn,lt):[],ss=Math.min(Ie,Math.max(ht.length-1,0)),Dt=ht[ss]??null,gt=xe?.isMultivariate===!0,ks=d!==null&&xe!==null,vt=ks&&(gt||!!(_s&&We)),qa=vt&&!Q&&xe?.isSavedBlock===!0,Qe=Q||qa,pn=Q?Ws:xe?.label??"",Wa=Tt&&l?ls(Tt,l):null,hn=(t,s)=>s&&G?`${t} · ${s}`:t,gn=xe?xe.variantOf??xe.label:"",Ua=(()=>{const t=gt&&Dt?Dt.label:null;return t?G?[hn(gn,t)]:[xe.label,t]:[xe?.label??""]})(),ws=hn(te?.name??"",et?Ge?.label:null),ns=vt&&(!Q||B.length>0)?Q?[Ws,...B]:[ws,...Ua,...B]:[],vn=D&&te?[te.name,"SEO",...zs]:[],Sn=r("sectionsEditor.pageVariantTabs.variantsLabel"),yn=P&&te?[te.name,Sn]:Ce&&te&&xe?[ws,gn,Sn]:[],as=yn.length>0?yn:vn.length>0?vn:Qe?ns.length>0?ns:[pn]:ns.length>0?ns:[ws],bn=ks&&!gt&&!xe?.isHidden&&!!g,Ja=Qe||!Q&&et&&!!Ge||bn,Ya=ks&&!gt&&!Q&&B.length===0&&!!xe&&ia(xe)&&!!g,Qa=G&&vt&&!Ce&&gt&&B.length===0&&!!Dt,xn=G&&B.length>0?Fn(B[B.length-1]):null,Xa=B.length>1?Fn(B[B.length-2]):null,_n=Qe?pn:vt?xe?.label??"":te?.name??"",Za=P||Ce?r("sectionsEditor.pageVariantTabs.variantsLabel"):D?r("sectionsEditor.panelSections.seo"):xn??_n,jn=Ce?xe?.variantOf??xe?.label??"":P||D?te?.name??"":xn?Xa??_n:Qe?r("sectionsEditor.sectionsEditor.globalSectionSubtitle"):vt?te?.name??"":te?.path??"",Rs=!P&&!Ce&&!D&&!vt&&!Qe,eo=!G&&!D&&!Q&&gt&&B.length===0,Gt=()=>{if(!g)return;pt(),q.current&&(clearTimeout(q.current),q.current=null);const t=c[g],s=vr(t.sections,K);if(!s)return;const a=Sr(s);Y.mutate({blockKey:g,data:{...t,sections:s}},{onSuccess:()=>{fe(a),M(null),C(null),z(null),A([]),ie(null),Ae(null)},onError:o=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:o.message}))})},os=(t,s,a)=>{if(!g)return;pt(),q.current&&(clearTimeout(q.current),q.current=null);const o=c[g],i=o.sections;if(!i||typeof i!="object"||Array.isArray(i))return;const m=i;if(!Array.isArray(m.variants))return;const f=t([...m.variants]);if(!f)return;const x=Rr(m,f),R={...c,[g]:{...o,sections:x}};Y.mutate({blockKey:g,data:R[g]},{onSuccess:()=>{s?.();const S=typeof a=="string"?[a]:a??[];(async()=>{for(const E of S)await Et(E,R)})()},onError:S=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:S.message}))})},Vs=t=>{ne(null),fe(t),M(null),C(null),z(null),A([]);const s=de[t]?.rule,{resolveType:a,formValue:o}=Wt(s,c??{},l??void 0);Ae(a),ie(o),bs(de.map(i=>({rule:i.rule})),t)},En=(t,s)=>{if(t===s)return;let a=se;se===t?a=s:t<se&&s>=se?a=se-1:t>se&&s<=se&&(a=se+1),fe(a);const o=ds(de.map(i=>({rule:i.rule})),t,s);bs(o,a),os(i=>ds(i,t,s))},kn=t=>{const s=de[t]?.rule,a=bt(s,c??{},l??void 0);os(o=>o.length<=1?null:(o.splice(t,1),o),()=>{de.length-1===1?fe(0):t<se?fe(se-1):t===se&&fe(Math.max(0,t-1)),M(null),C(null),z(null),A([]),ie(null),Ae(null)},a)},to=()=>{const t=de.map((s,a)=>({variant:s,index:a})).filter(({variant:s})=>!wr(s.rule)).map(({variant:s})=>bt(s.rule,c??{},l??void 0)).filter(s=>!!s);os(s=>{const a=Nr({variants:s}),o=s[a];return o?[{...o,rule:Ar()}]:null},()=>{fe(0),M(null),C(null),z(null),A([]),ie(null),Ae(null),st(!1)},t)},wn=t=>{os(s=>Mr(s,t),()=>{fe(t+1),M(null),C(null),z(null),A([]),ie(null),Ae(null)})},so=async(t,s)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const a=He.current.activePageKey,o=He.current.decofile;if(!a)return;const i=o[a],m=i.sections;if(!m||typeof m!="object"||Array.isArray(m))return;const f=m;if(!Array.isArray(f.variants))return;const x=[...f.variants],R=x[t];if(!R?.rule||typeof R.rule!="object"){N.error(r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const S=R.rule,E=s.trim();At(!0);try{if(!E){if(!Rt(S,o,l)){ne(null);return}const U=S.__resolveType??"";x[t]={...R,rule:Ds(S,o,l)};const I={...o,[a]:{...i,sections:{...f,variants:x}}};await Y.mutateAsync({blockKey:a,data:I[a]}),await Et(U,I),ne(null),b?.();return}const _=Ks(S,o,l);if(!_){N.error(r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(_.blockKey){await Y.mutateAsync({blockKey:_.blockKey,data:xt(_.resolveType,_.data,E)}),ne(null),b?.();return}const W=cs(E),Z=us(W,o);if(Z){N.error(Z);return}const ee=xt(_.resolveType,_.data,E);let F=null;try{await Y.mutateAsync({blockKey:W,data:ee}),F=W,x[t]={...R,rule:Lt(W)},await Y.mutateAsync({blockKey:a,data:{...i,sections:{...f,variants:x}}}),F=null}catch(U){throw F&&await Zt.mutateAsync({blockKey:F}).catch(()=>{}),U}ne(null),N.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:E})),b?.()}catch(_){N.error(_ instanceof Error?_.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{At(!1)}},no=async(t,s)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const{selectedSectionIndex:a,rawSections:o,parsedSections:i,decofile:m,activePageKey:f,pageVariants:x,variantIndex:R}=He.current;if(a===null||!f)return;const S=o[a],E=i[a];if(!S||!E?.isMultivariate)return;const _=tt(S,E);if(!_)return;const W=_.variants??[],Z=W[t];if(!Z?.rule||typeof Z.rule!="object"){N.error(r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const ee=Z.rule,F=s.trim();At(!0);const U=async I=>{const Xe={..._,variants:I},rt=[...o];rt[a]=wt(S,E,Xe);const St=qt(m,f,rt,R,x);return await Y.mutateAsync({blockKey:f,data:St}),{...m,[f]:St}};try{if(!F){if(!Rt(ee,m,l)){ae(null);return}const yt=ee.__resolveType??"",Kn=[...W];Kn[t]={...Z,rule:Ds(ee,m,l)};const po=await U(Kn);await Et(yt,po),ae(null),b?.();return}const I=Ks(ee,m,l);if(!I){N.error(r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(I.blockKey){await Y.mutateAsync({blockKey:I.blockKey,data:xt(I.resolveType,I.data,F)}),ae(null),b?.();return}const Xe=cs(F),rt=us(Xe,m);if(rt){N.error(rt);return}const St=xt(I.resolveType,I.data,F);let it=null;try{await Y.mutateAsync({blockKey:Xe,data:St}),it=Xe;const yt=[...W];yt[t]={...Z,rule:Lt(Xe)},await U(yt),it=null}catch(yt){throw it&&await Zt.mutateAsync({blockKey:it}).catch(()=>{}),yt}ae(null),N.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:F})),b?.()}catch(I){N.error(I instanceof Error?I.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{At(!1)}},Rn=async(t,s,a)=>{C(a);try{await Y.mutateAsync({blockKey:t,data:a})}catch(o){throw C(i=>i===a?s:i),o}},ao={rename:async(t,s,a)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const{activePageKey:o,decofile:i}=He.current;if(!o)return;const m=Array.isArray(t.variants)?[...t.variants]:[],f=m[s],x=f?.rule&&typeof f.rule=="object"?f.rule:void 0,R=async E=>{const _={...t,variants:E};return await Rn(o,t,_),{...i,[o]:_}},S=hi(x,a,i,l);if(S.kind!=="noop"){if(S.kind==="error"){N.error(S.reason==="no-matcher-rule"?r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):S.reason==="unreadable-rule"?r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):S.message??r("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}At(!0);try{if(S.kind==="inline"){const _=[...m];_[s]={...f,rule:S.inlinedRule};const W=await R(_);await Et(S.blockKey,W),b?.();return}if(S.kind==="updateBlock"){await Y.mutateAsync({blockKey:S.blockKey,data:S.blockData}),b?.();return}let E=null;try{await Y.mutateAsync({blockKey:S.blockId,data:S.blockData}),E=S.blockId;const _=[...m];_[s]={...f,rule:S.reference},await R(_),E=null}catch(_){throw E&&await Zt.mutateAsync({blockKey:E}).catch(()=>{}),_}N.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:a.trim()})),b?.()}catch(E){N.error(E instanceof Error?E.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{At(!1)}}},selectGlobal:async(t,s,a)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const{activePageKey:o,decofile:i}=He.current;if(!o)return;const m=Array.isArray(t.variants)?[...t.variants]:[],f=m[s];if(!f)return;const x=bt(f.rule,i,l);m[s]={...f,rule:Lt(a)};const R={...t,variants:m},S={...i,[o]:R};try{await Rn(o,t,R),x&&x!==a&&await Et(x,S),b?.()}catch(E){N.error(E instanceof Error?E.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}}},Vn=()=>{Pt()},Tn=t=>{Qt(t),js({inner:t})},Nn=t=>{ps(t),js({raw:t})},An=()=>{Qt(null),jt([])},Mn=()=>Ft(t=>t+1),Pn=()=>{Xt.flush(),Fe(!1),Qt(null),ps(void 0),jt([]),Ft(t=>t+1),me?.()},oo=()=>{st(!1),L(!1),M(null),Fe(!0)},ro=()=>{D&&Pn(),M(null),st(!0)},io=()=>L(!0),Ts=t=>{if(P&&t===0){st(!1);return}if(Ce&&t<2){L(!1),t===0&&M(null);return}if(D){if(t===0){Pn();return}if(t===1){jt([]),Ft(a=>a+1);return}jt(zs.slice(0,t-1)),Ft(a=>a+1);return}if(Q){A(B.slice(0,t)),H(a=>a+1);return}if(t===0){Vn();return}if(t===1){A([]),H(a=>a+1);return}const s=!G&&gt&&Dt?1:0;if(s===1&&t===2){A([]),H(a=>a+1);return}A(B.slice(0,t-1-s))},Ns=as.length>1?n.jsx("button",{type:"button",onClick:()=>Ts(er(as.length,{isMultivariateSectionTop:eo})),title:r("sectionsEditor.sectionsEditor.back"),"aria-label":r("sectionsEditor.sectionsEditor.back"),className:oe("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",Qe?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx(rr,{className:"size-4"})}):null,lo=Qe||vt||D?Ja&&n.jsxs("div",{className:oe("border-b px-3 py-2.5",Qe&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!Q&&et&&Ge&&n.jsxs("button",{type:"button",onClick:Vn,title:r("sectionsEditor.sectionsEditor.editingInVariant",{variant:Ge.label}),className:oe("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",qo),children:[n.jsx(Go,{rule:Ps(Ge.rule,c??{},l??void 0),matchers:Ct}),n.jsx("span",{className:"max-w-[160px] truncate",children:Ge.label})]}),n.jsx("div",{className:"flex-1"}),Qe&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(ms,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(dt,{side:"bottom",className:"max-w-[260px]",children:r("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),bn&&n.jsx(is,{onClick:()=>Ht()})]}),Qe&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:r("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(In,{pageKey:g,initialName:te.name,initialPath:te.path,onFieldChange:Zs,variant:"header"})}),n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>Fe(!0),children:n.jsx(Wn,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.editSeo")})]}),n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>Be&&g?Be():Ee(!0),children:n.jsx(Un,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.viewJson")})]}),n.jsx(is,{onClick:Gt})]}),co=n.jsxs(n.Fragment,{children:[et&&g&&n.jsx(On,{listKey:g,variants:de,activeIndex:se,decofile:c??{},meta:l,matchers:Ct,onSelect:Vs,onReorder:En,onRename:ne,onDuplicate:wn,onDelete:kn,onAdd:Gt}),et&&le!==null&&n.jsx(zn,{className:"mt-3",children:n.jsx("div",{className:oe("space-y-3",Nt&&"pointer-events-none opacity-50"),children:n.jsx(As,{currentRt:le,currentLabel:Ut(Ge?.rule,c??{},lt,l??void 0),currentGlobalKey:bt(Ge?.rule,c??{},l??void 0)??void 0,matchers:Ct,globals:Es,onSelect:ln,onSelectGlobal:un,schema:on,formValue:Le,onChange:cn,formKey:`${se}:${le??""}`,formWrapperClassName:"space-y-3",meta:l??void 0,decofile:c,onSaveReferencedBlock:It,sandbox:$t})})})]}),Cn=n.jsxs(n.Fragment,{children:[n.jsx(Wo,{listKey:`${g??""}:${d??""}`,variants:ht.map((t,s)=>({index:s,label:t.label})),selectedIndex:ss,onSelect:tn,onRename:ae,onDuplicate:Ia,onDelete:Fa,onRemoveAll:sn,onReorder:Oa,onAdd:()=>Ht()}),n.jsx(zn,{children:n.jsx(As,{currentRt:Tt??"",currentLabel:Ut(Dt?.rule,c??{},lt,l??void 0),currentGlobalKey:bt(Dt?.rule,c??{},l??void 0)??void 0,matchers:Ct,globals:Es,onSelect:$a,onSelectGlobal:Ga,schema:Wa,formValue:pa,onChange:Ha,formKey:`${d??"none"}:${ss}:${Tt??""}`,formWrapperClassName:"pt-1",meta:l??void 0,decofile:c,onSaveReferencedBlock:It,sandbox:$t})})]}),Dn=n.jsx("div",{className:oe(G?"px-2":"p-2 pt-3"),children:n.jsx(fi,{listKey:`${g??""}-${se}`,rawSections:K,sections:be,meta:l,decofile:c,selectedIndex:d,onSelect:Na,onReorder:Aa,onDelete:Ma,onDuplicate:Pa,onMakeReusable:je,onToggleHidden:Ca,onToggleLazy:Da,onAddVariant:Ht,onDetach:Ka,onAddSection:()=>ve(!0),canAddSection:an})}),uo=n.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[g&&te&&n.jsx(In,{pageKey:g,initialName:te.name,initialPath:te.path,onFieldChange:Zs}),Ot&&g?n.jsx(sa,{rawSeo:es,innerSeo:Ss,defaultResolveType:Js,seoSchema:Ys,activeResolveType:ts,seoTypeOptions:Us,formResetKey:$s,siteDefaultSeo:Qs,onBreadcrumbChange:jt,onPersistRaw:Nn,onInnerChange:Tn,onClearForm:An,onBumpFormKey:Mn}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),mo=n.jsx(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ot&&g?n.jsx(sa,{rawSeo:es,innerSeo:Ss,defaultResolveType:Js,seoSchema:Ys,activeResolveType:ts,seoTypeOptions:Us,formResetKey:$s,siteDefaultSeo:Qs,onBreadcrumbChange:jt,onPersistRaw:Nn,onInnerChange:Tn,onClearForm:An,onBumpFormKey:Mn}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),fo=n.jsxs(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[et&&g&&n.jsx(On,{listKey:g,variants:de,activeIndex:se,decofile:c??{},meta:l,matchers:Ct,onSelect:Vs,onReorder:En,onRename:ne,onDuplicate:wn,onDelete:kn,onAdd:Gt}),et&&le!==null&&n.jsxs("div",{className:oe("px-3 border-b",ye?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>$e(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":ye,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r("sectionsEditor.sectionsEditor.variantRule")}),ye?n.jsx(nr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(ar,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),ye&&n.jsx("div",{className:oe("space-y-3",Nt&&"pointer-events-none opacity-50"),children:n.jsx(As,{currentRt:le,currentLabel:Ut(Ge?.rule,c??{},lt,l??void 0),currentGlobalKey:bt(Ge?.rule,c??{},l??void 0)??void 0,matchers:Ct,globals:Es,onSelect:ln,onSelectGlobal:un,schema:on,formValue:Le,onChange:cn,formKey:`${se}:${le??""}`,formWrapperClassName:"space-y-3",meta:l??void 0,decofile:c,onSaveReferencedBlock:It,sandbox:$t})})]}),Dn]},"editor-section-list");return n.jsx(Uo,{children:n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!G&&Ns&&n.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:Ns}),(G||as.length>1)&&n.jsx(Jo,{crumbs:as,onSelect:Ts,onSelectRoot:()=>{Xt.flush(),Ke?Ke():Ts(0)}}),n.jsx("div",{className:"shrink-0",children:G?n.jsxs("div",{className:oe("flex items-center gap-2 border-b px-3 py-2.5",Qe&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[G&&Ns,Qe&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(ms,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(dt,{side:"bottom",className:"max-w-[260px]",children:r("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[n.jsx("span",{className:"truncate text-sm font-semibold",children:Za}),jn&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:jn})]}),Rs&&et&&Ge&&n.jsx($n,{variants:de,activeIndex:se,onSelect:Vs,onManage:ro,onRemoveAll:to}),Qa&&n.jsx($n,{variants:ht,activeIndex:ss,onSelect:tn,onManage:io,onRemoveAll:sn}),Rs&&!et&&n.jsx(is,{onClick:Gt}),Ya&&n.jsx(is,{onClick:()=>Ht()}),n.jsx(Yo,{}),Rs&&n.jsxs(n.Fragment,{children:[n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"outline",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:oo,children:n.jsx(Wn,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.editSeo")})]}),!Be&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"outline",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>Ee(!0),children:n.jsx(Un,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):lo}),Ce?n.jsx(Hn,{onAdd:()=>Ht(),children:Cn},"editor-section-variants"):vt?n.jsxs(Bt,{viewportRef:ce,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!G&&gt&&ht.length>0&&B.length===0&&Cn,n.jsx(Gn,{activeSchema:_s,formValue:We,formResetKey:Re,onFormChange:Xs,onBreadcrumbChange:A,breadcrumbPath:B,emptyMessage:r("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:l,decofile:c,onSaveReferencedBlock:It,sandbox:$t,previewBaseUrl:_e,onRequestAddSection:en,onVariantMatcherOp:Q?ao:void 0})]},"editor-section-form"):Q?n.jsx(Bt,{viewportRef:ce,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Gn,{activeSchema:_s,formValue:We,formResetKey:Re,onFormChange:Xs,onBreadcrumbChange:A,breadcrumbPath:B,emptyMessage:r("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:l,decofile:c,onSaveReferencedBlock:It,sandbox:$t,previewBaseUrl:_e,onRequestAddSection:en})},"editor-global-block"):D?G?n.jsx(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3",children:uo})},"editor-seo"):mo:P?n.jsx(Hn,{onAdd:Gt,children:co},"editor-variants"):G?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"py-2",children:Dn})}),n.jsx("div",{className:"shrink-0 border-t p-2",children:n.jsx(Fs,{canAddSection:an,onAddSection:()=>ve(!0)})})]},"editor-section-list"):fo,n.jsx(Qo,{open:ue!==null,onOpenChange:t=>{t||je(null)},defaultBlockId:ue!==null?cs(be[ue]?.label??""):"",isPending:Y.isPending,onSubmit:za}),_e&&n.jsx(Yr,{open:Pe,onOpenChange:t=>{ve(t),t||(Se.current=null)},meta:l,decofile:c,previewBaseUrl:_e,onSelect:La}),Ve&&g&&c&&n.jsx(cr,{open:Ve,onOpenChange:Ee,pageKey:g,decofile:c}),pe!==null&&n.jsx(qn,{open:!0,initialName:Rt(de[pe]?.rule,c??{},l??void 0)?Ut(de[pe]?.rule,c??{},lt,l??void 0):"",autoLabel:lt(Ps(de[pe]?.rule,c??{},l??void 0)),isPending:Nt,onSubmit:async t=>{await so(pe,t)},onOpenChange:t=>{!t&&!Nt&&ne(null)}}),he!==null&&n.jsx(qn,{open:!0,initialName:Rt(ht[he]?.rule,c??{},l??void 0)?Ut(ht[he]?.rule,c??{},lt,l??void 0):"",autoLabel:lt(Ps(ht[he]?.rule,c??{},l??void 0)),isPending:Nt,onSubmit:async t=>{await no(he,t)},onOpenChange:t=>{!t&&!Nt&&ae(null)}})]})})}export{Bc as SectionsEditor};
1
+ import{c as Jt,b as Yt,r as j,l as oe,j as n,aR as ho,B as Vt,G as Kt,al as go,I as vo,H as So,o as yo,h as bo,t as N,K as xo}from"./index-BiuSAlzd.js";import{u as _o}from"./chat-context-DHGUafJ4.js";import{u as fs}from"./use-new-blocks-editor-DxwEKp1u.js";import{E as jo,F as Eo,G as ko,H as wo,I as Ro,J as Vo,K as To,V as No,L as Ao,N as Bn,O as Mo,Q as Po,C as cs,y as us,e as Co,f as Do,j as Ko,u as Bo,T as Ln,U as Lo,W as Fo,X as Io,Y as Oo,Z as zo,p as rs,A as kt,_ as $o,$ as Ho,w as Fn,a0 as Go,a1 as qo,a2 as is,a3 as In,a4 as On,a5 as zn,a6 as As,a7 as Wo,a8 as Uo,z as Jo,a9 as $n,aa as Yo,ab as Hn,ac as Gn,M as Qo,ad as qn,ae as lt,d as Xo,af as qt,ag as Zo,ah as er,ai as Ms,aj as tr}from"./runnable-block-editor-BPu9lbHb.js";import{c as sr}from"./repository-binding-CQsr_3Zk.js";import{n as nr,t as ar}from"./ChevronUp-B79uJeZN.js";import{a6 as oa,b as ms,aj as or,z as rr,$ as Wn,I as Un}from"./agent-icon-DEoEcQYL.js";import{S as Bt}from"./scroll-area-BNMPUKzn.js";import{b as ct,T as ut,a as dt}from"./tooltip-rVl8jzih.js";import{m as ir,u as lr,P as cr}from"./mustache-Dy9IxQRw.js";import{aq as ra,c as Is,ar as ia,G as ur,ag as Rt,a4 as Ds,as as Ks,ah as xt,a5 as Lt,j as dr,l as mr,g as fr,r as ls,ak as pr,af as Wt,at as tt,au as Jn,a6 as Ps,ae as bt,ad as Ut,av as hr,aw as gr,K as vr,ax as Sr,ai as Yn,_ as Qn,ay as yr,az as wt,aA as br,aB as xr,aC as _r,aD as Xn,aE as jr,aF as Er,aG as kr,ac as wr,aH as Rr,aI as Vr,aJ as Tr,aK as Nr,ab as Ar,aL as Mr}from"./claim-phase-copy-BTrkr4bY.js";import{a as Pr}from"./Copy01-DluK-JtU.js";import{a as Bs,e as la}from"./UserSquare-DZJwwd71.js";import{b as Zn}from"./Tool01-BchdJG2X.js";import{s as ea}from"./Image01-DnRAAkhy.js";import{s as Cr}from"./Plus-DjsQQqpw.js";import{s as Dr}from"./Trash01-BfnCKCGB.js";import{i as Ls}from"./ZoomOut-BlDSjKri.js";import{a as Kr,b as ta,d as Br,K as Lr,P as Fr,u as Ir,C as Or,s as zr,e as ds,D as $r,c as Hr,S as Gr,v as qr}from"./rich-text-link-control-B3wmUrSm.js";import{a as Wr,P as sa,b as Ur}from"./page-seo-form-RJHH5jjR.js";import{u as Jr,A as Yr}from"./use-section-preview-base-DryOEAAN.js";import{b as na,a as Qr}from"./variant-matcher-override-CdOGya1b.js";import"./use-panel-navigate-DvFfVppm.js";import"./thread-route-SwwHxRrN.js";import"./use-project-scope-DJC0Rmd2.js";import"./autosend-CeDtnxlk.js";import"./thread-intent-ags1XWir.js";import"./use-mcp-client-5sJCC1_2.js";import"./auth-DDdLUET9.js";import"./backoff-8mStPHYB.js";import"./task-board-Cg5OuTdd.js";import"./schema-CepQKFSq.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-decopilot-events-B_Wj2FDs.js";import"./use-ai-providers-BBj3hH0A.js";import"./location-DPIrGNp7.js";import"./use-organization-settings-0Ql08vCb.js";import"./use-session-runtime-Cosw4CCW.js";import"./Sun-BWosC3Su.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-PmQIQCBI.js";import"./LinkBroken01-ChSpe7Cq.js";import"./Check-Cf-cMW3t.js";import"./format-time-CjIPQhCN.js";import"./differenceInSeconds-C3x8sHUj.js";import"./collapsible-DUefED3P.js";import"./use-copy-XLZP4Fnf.js";import"./usage-stats-B9NCjY7p.js";import"./markdown-D5RcIxaz.js";import"./dialog-C9YQM7Rb.js";import"./X-C52mq3mn.js";import"./org-file-open-context-CTyFwctz.js";import"./use-mobile-D06E6E9A.js";import"./use-clock-tick-WbPH8S5J.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-4bTrB0jF.js";import"./types-B77htmoi.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./gateway-client-DE4QITdV.js";import"./tool-namespace-DmnQIdtF.js";import"./utils-CVEq3hMx.js";import"./AlertCircle-DDHQi3fm.js";import"./XClose-BqRoe3QG.js";import"./ShoppingBag01-DktiI11o.js";import"./SearchMd-oXON6Mge.js";import"./shell-layout-DgCL-aOA.js";import"./avatar-BeFEVdWT.js";import"./User01-DXNh3TnB.js";import"./Building02-BVSXudo-.js";import"./download-app-dialog-D3HwAGf1.js";import"./CheckCircle-BemNEpVg.js";import"./Monitor01-BLZH5esy.js";import"./command-B-LkMxT6.js";import"./index-cj3FPIlo.js";import"./integration-icon-BcFb9WXn.js";import"./project-icon-C1TVO88N.js";import"./new-project-dialog-Dj5TFcCk.js";import"./ArrowLeft-CIsJnvjF.js";import"./input-B5d33h6X.js";import"./label-BmSaj4OS.js";import"./repository-import-picker-D6vKdpbU.js";import"./use-navigate-to-agent-2D1RSJEE.js";import"./repository-picker-DnfKLU2E.js";import"./LinkExternal01-BVDnNs6j.js";import"./useInfiniteQuery-BAMBgsXo.js";import"./infiniteQueryObserver-B7-m24Hr.js";import"./collection-search-CKxipBbw.js";import"./use-debounced-value-PqnB6cMC.js";import"./required-auth-layout-5x9XYN7k.js";import"./use-org-sso-C8LeExfy.js";import"./sheet-CuQcjl8J.js";import"./use-connection-BJVimXqv.js";import"./Palette-CaKXG6S_.js";import"./Link01-iwXPIeVc.js";import"./use-mcp-prompts-5OccjpiV.js";import"./index-DX971x0F.js";import"./form-CYA-1Wz9.js";import"./use-thread-outputs-DqnIgfuG.js";import"./file-type-icon-Zo3jfkM-.js";import"./popover-DwQhmYZx.js";import"./utils-BiBoFq--.js";import"./monaco-editor-DrtzucP0.js";import"./editor-DiFPb_7W.js";import"./calendar-BGvJ_APz.js";import"./textarea-IAy-ownU.js";import"./select-QknS4jya.js";import"./index-BGzd8qMa.js";import"./switch-WI6sluFx.js";import"./combobox-D_pkyBdU.js";import"./alert-dialog-D9wz_Poi.js";import"./sandbox-url-D3mC8qhT.js";import"./Upload01-CNtxqXvb.js";import"./DotsVertical-COzw8ydu.js";import"./search-input-DroJjkYC.js";import"./tabs-mZ2AJpie.js";import"./use-file-configs-BCUJhrSS.js";import"./asset-utils-WUpNFBXm.js";import"./use-chat-layout-state-CcLE4xPO.js";import"./site-slug-DebpOoQq.js";import"./toggle-group-C7J6hm1X.js";import"./sandbox-git-api-B1R0585s.js";import"./ArrowUp-CtvQk6Vg.js";import"./CreditCard01-BzBUMTax.js";import"./Key01-DXvy1NNO.js";import"./Users01-DAfCqIN7.js";import"./section-preview-url-7zfngvgW.js";function Xr(v){return v.schema?.definitions??v.schema?.$defs??{}}function ca(v,e){const u=Xr(e),p=u[btoa(v)];if(!p)return[];const h=[p];if(Array.isArray(p.allOf)){const k=p.allOf.find(w=>typeof w.$ref=="string")?.$ref;if(typeof k=="string"){const w=u[k.replace("#/definitions/","")];w&&h.push(w)}}return h}function Zr(v,e){for(const u of ca(v,e)){const p=typeof u.image=="string"?u.image:void 0;if(p?.includes("{{{"))return p}}function ei(v,e){if(!e)return;const u=ra(v);if(!u)return;const p=Zr(u.resolveType,e);if(!p)return;const h=jo(p,u.data);if(h)return Eo(h)}const ti={escape:ko};function si(v,e){for(const u of ca(v,e)){const p=typeof u.title=="string"?u.title:void 0;if(p?.includes("{{"))return p}}function ni(v,e){if(!e)return;const u=ra(v);if(u)try{const p=si(u.resolveType,e);return p&&ir.render(p,u.data,{},ti).trim()||void 0}catch{return}}function ai(v){const e=Jt.c(13),{icon:u,label:p,className:h}=v;let k;e[0]!==h?(k=oe("size-3.5",h),e[0]=h,e[1]=k):k=e[1];let w;e[2]!==u||e[3]!==k?(w=n.jsx(u,{className:k}),e[2]=u,e[3]=k,e[4]=w):w=e[4];let y;e[5]!==p||e[6]!==w?(y=n.jsx(ut,{asChild:!0,children:n.jsx("span",{role:"img","aria-label":p,className:"shrink-0 cursor-help",children:w})}),e[5]=p,e[6]=w,e[7]=y):y=e[7];let T;e[8]!==p?(T=n.jsx(dt,{className:"max-w-56",children:p}),e[8]=p,e[9]=T):T=e[9];let b;return e[10]!==y||e[11]!==T?(b=n.jsxs(ct,{children:[y,T]}),e[10]=y,e[11]=T,e[12]=b):b=e[12],b}const oi="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function aa(v){return Array.from({length:v},(e,u)=>({id:crypto.randomUUID(),index:u}))}function ua(v){return v.map((e,u)=>({...e,index:u}))}function ri(v,e){if(e===v.length)return v;if(e<v.length)return ua(v.slice(0,e));const u=Array.from({length:e-v.length},(p,h)=>({id:crypto.randomUUID(),index:v.length+h}));return[...v,...u]}function da(v){const e=Jt.c(44),{section:u,raw:p,meta:h,decofile:k}=v,w=Yt(),y=fs(),T=u.isSavedBlock===!0,b=u.isMultivariate===!0;let X;e[0]!==h||e[1]!==p?(X=p&&h?ei(p,h):void 0,e[0]=h,e[1]=p,e[2]=X):X=e[2];const me=X;let Ke;e[3]!==h||e[4]!==b||e[5]!==p||e[6]!==T?(Ke=p&&h&&!T&&!b?ni(p,h):void 0,e[3]=h,e[4]=b,e[5]=p,e[6]=T,e[7]=Ke):Ke=e[7];const Be=Ke;let Te;e[8]!==k||e[9]!==h||e[10]!==p||e[11]!==u?(Te=Ao(p,u,k,h),e[8]=k,e[9]=h,e[10]=p,e[11]=u,e[12]=Te):Te=e[12];const re=Te;let r;e[13]!==b||e[14]!==p?.__resolveType?(r=!b&&Is(p?.__resolveType??""),e[13]=b,e[14]=p?.__resolveType,e[15]=r):r=e[15];const V=r,ge=T?ms:b?oa:la;let $;e[16]!==b||e[17]!==T?($=T?{color:ur}:b?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=b,e[17]=T,e[18]=$):$=e[18];const c=$;let O;e[19]!==ge||e[20]!==y?(O=y?n.jsxs("span",{className:"relative size-4 shrink-0",children:[n.jsx(ge,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),n.jsx(Po,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):n.jsx(or,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=ge,e[20]=y,e[21]=O):O=e[21];let l;e[22]!==me?(l=me&&n.jsx("img",{src:me,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=me,e[23]=l):l=e[23];let J;e[24]!==y||e[25]!==c?(J=!y&&n.jsx(Bs,{className:"h-4 w-4 shrink-0",style:c}),e[24]=y,e[25]=c,e[26]=J):J=e[26];const G=y?"shrink":"flex-1",ke=u.isHidden&&"line-through opacity-50";let Ne;e[27]!==ke||e[28]!==G?(Ne=oe("min-w-0 truncate text-sm font-medium",G,ke),e[27]=ke,e[28]=G,e[29]=Ne):Ne=e[29];const qe=Be??u.label;let _e;e[30]!==Ne||e[31]!==qe?(_e=n.jsx("span",{className:Ne,children:qe}),e[30]=Ne,e[31]=qe,e[32]=_e):_e=e[32];let d;e[33]!==V||e[34]!==y||e[35]!==re||e[36]!==w?(d=y?n.jsxs(n.Fragment,{children:[V&&n.jsx(ai,{icon:Ls,label:w("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),re&&n.jsx(Bn,{}),n.jsx("span",{className:"min-w-0 flex-1"})]}):re&&n.jsx(Bn,{className:"absolute -right-0.5 -top-0.5"}),e[33]=V,e[34]=y,e[35]=re,e[36]=w,e[37]=d):d=e[37];let M;return e[38]!==_e||e[39]!==d||e[40]!==O||e[41]!==l||e[42]!==J?(M=n.jsxs(n.Fragment,{children:[O,l,J,_e,d]}),e[38]=_e,e[39]=d,e[40]=O,e[41]=l,e[42]=J,e[43]=M):M=e[43],M}const ii="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",li="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function ma(v,e,u){if(u)return Mo({selected:e});const p=v.isSavedBlock===!0,h=v.isMultivariate===!0;return oe("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":p?ii:h?li:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Cs(v,e){return oe("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":v?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function ci(v){const e=Jt.c(90),{section:u,raw:p,meta:h,decofile:k,sortableId:w,selected:y,onSelect:T,onDelete:b,onDuplicate:X,onMakeReusable:me,onToggleHidden:Ke,onToggleLazy:Be,onAddVariant:Te,onDetach:re}=v,r=Yt(),V=fs(),ge=p?Is(p.__resolveType??""):!1,$=u.isHidden===!0,c=ge||$;let O;e[0]!==u?(O=ia(u),e[0]=u,e[1]=O):O=e[1];const l=O;let J;e[2]!==w?(J={id:w,animateLayoutChanges:mi},e[2]=w,e[3]=J):J=e[3];const{attributes:G,listeners:ke,setNodeRef:Ne,transform:qe,isDragging:_e}=Ir(J);let d;e[4]!==qe?(d=Or.Transform.toString(qe?{...qe,x:0}:null),e[4]=qe,e[5]=d):d=e[5];const M=_e?0:void 0;let We;e[6]!==d||e[7]!==M?(We={transform:d,opacity:M},e[6]=d,e[7]=M,e[8]=We):We=e[8];const C=We;let Ue;e[9]!==u?(Ue=Ro(u),e[9]=u,e[10]=Ue):Ue=e[10];const z=Ue,mt="button",fe=0;let ze;e[11]!==T?(ze=P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),T())},e[11]=T,e[12]=ze):ze=e[12];const _t=_e?"cursor-grabbing":"cursor-pointer";let Le;e[13]!==V||e[14]!==u||e[15]!==y||e[16]!==_t?(Le=oe("touch-none transition-colors",_t,ma(u,y,V)),e[13]=V,e[14]=u,e[15]=y,e[16]=_t,e[17]=Le):Le=e[17];let ie;e[18]!==k||e[19]!==h||e[20]!==p||e[21]!==u?(ie=n.jsx(da,{section:u,raw:p,meta:h,decofile:k}),e[18]=k,e[19]=h,e[20]=p,e[21]=u,e[22]=ie):ie=e[22];const le=!V&&!u.isMultivariate&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r(ge?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:oe(Cs(c,ge)),onClick:P=>{P.stopPropagation(),Be()},onPointerDown:di,children:n.jsx(Ls,{className:oe("h-3.5 w-3.5",ge&&"text-warning")})})}),n.jsx(dt,{side:"bottom",children:r(ge?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),Ae=V?n.jsx(Vo,{label:r($?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:$,onToggle:Ke,children:$?n.jsx(Zn,{className:"h-3.5 w-3.5"}):n.jsx(ea,{className:"h-3.5 w-3.5"})}):n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r($?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:oe(Cs(c,$)),onClick:P=>{P.stopPropagation(),Ke()},onPointerDown:ui,children:$?n.jsx(Zn,{className:"h-3.5 w-3.5"}):n.jsx(ea,{className:"h-3.5 w-3.5"})})}),n.jsx(dt,{side:"bottom",children:r($?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),B=vo,A=To;let ce;e[23]!==r?(ce=r("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=r,e[24]=ce):ce=e[24];const we=oe(Cs(c,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let Me;e[25]!==A||e[26]!==ce||e[27]!==we?(Me=n.jsx(A,{label:ce,classicClassName:we}),e[25]=A,e[26]=ce,e[27]=we,e[28]=Me):Me=e[28];let Re;e[29]!==V||e[30]!==ge||e[31]!==Be||e[32]!==u.isMultivariate||e[33]!==r?(Re=V&&!u.isMultivariate&&n.jsxs(n.Fragment,{children:[n.jsxs(Kt,{onClick:P=>{P.stopPropagation(),Be()},children:[n.jsx(Ls,{className:"h-4 w-4"}),r(ge?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),n.jsx(go,{})]}),e[29]=V,e[30]=ge,e[31]=Be,e[32]=u.isMultivariate,e[33]=r,e[34]=Re):Re=e[34];let H;e[35]!==X?(H=P=>{P.stopPropagation(),X()},e[35]=X,e[36]=H):H=e[36];let ue;e[37]===Symbol.for("react.memo_cache_sentinel")?(ue=n.jsx(Pr,{className:"h-4 w-4"}),e[37]=ue):ue=e[37];let je;e[38]!==r?(je=r("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=r,e[39]=je):je=e[39];let pe;e[40]!==H||e[41]!==je?(pe=n.jsxs(Kt,{onClick:H,children:[ue,je]}),e[40]=H,e[41]=je,e[42]=pe):pe=e[42];let ne;e[43]!==V||e[44]!==l||e[45]!==Te||e[46]!==r?(ne=l&&n.jsxs(Kt,{className:oe(!V&&No),onClick:P=>{P.stopPropagation(),Te()},children:[n.jsx(oa,{className:"h-4 w-4"}),r("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=V,e[44]=l,e[45]=Te,e[46]=r,e[47]=ne):ne=e[47];let he;e[48]!==V||e[49]!==z||e[50]!==me||e[51]!==r?(he=z&&n.jsxs(Kt,{className:oe(!V&&oi),onClick:P=>{P.stopPropagation(),me()},children:[V?n.jsx(ms,{className:"h-4 w-4"}):n.jsx(Bs,{className:"h-4 w-4"}),r("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=V,e[49]=z,e[50]=me,e[51]=r,e[52]=he):he=e[52];let ae;e[53]!==V||e[54]!==re||e[55]!==u.isMultivariate||e[56]!==u.isSavedBlock||e[57]!==r?(ae=u.isSavedBlock===!0&&!u.isMultivariate&&n.jsxs(Kt,{onClick:P=>{P.stopPropagation(),re()},children:[V?n.jsx(la,{className:"h-4 w-4"}):n.jsx(Bs,{className:"h-4 w-4"}),r("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=V,e[54]=re,e[55]=u.isMultivariate,e[56]=u.isSavedBlock,e[57]=r,e[58]=ae):ae=e[58];let Pe;e[59]!==b?(Pe=P=>{P.stopPropagation(),b()},e[59]=b,e[60]=Pe):Pe=e[60];let ve;e[61]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(Dr,{className:"h-4 w-4"}),e[61]=ve):ve=e[61];let Ve;e[62]!==r?(Ve=r("sectionsEditor.sectionList.deleteMenuItem"),e[62]=r,e[63]=Ve):Ve=e[63];let Ee;e[64]!==Pe||e[65]!==Ve?(Ee=n.jsxs(Kt,{variant:"destructive",onClick:Pe,children:[ve,Ve]}),e[64]=Pe,e[65]=Ve,e[66]=Ee):Ee=e[66];let Se;e[67]!==Re||e[68]!==pe||e[69]!==ne||e[70]!==he||e[71]!==ae||e[72]!==Ee?(Se=n.jsxs(So,{align:"end",className:"w-44",children:[Re,pe,ne,he,ae,Ee]}),e[67]=Re,e[68]=pe,e[69]=ne,e[70]=he,e[71]=ae,e[72]=Ee,e[73]=Se):Se=e[73];let ye;e[74]!==B||e[75]!==Me||e[76]!==Se?(ye=n.jsxs(B,{children:[Me,Se]}),e[74]=B,e[75]=Me,e[76]=Se,e[77]=ye):ye=e[77];let $e;return e[78]!==G||e[79]!==ke||e[80]!==T||e[81]!==Ne||e[82]!==C||e[83]!==Le||e[84]!==ie||e[85]!==le||e[86]!==Ae||e[87]!==ye||e[88]!==ze?($e=n.jsxs("div",{ref:Ne,style:C,...G,...ke,role:mt,tabIndex:fe,onClick:T,onKeyDown:ze,className:Le,children:[ie,le,Ae,ye]}),e[78]=G,e[79]=ke,e[80]=T,e[81]=Ne,e[82]=C,e[83]=Le,e[84]=ie,e[85]=le,e[86]=Ae,e[87]=ye,e[88]=ze,e[89]=$e):$e=e[89],$e}function ui(v){return v.stopPropagation()}function di(v){return v.stopPropagation()}function mi(){return!1}function Fs(v){const e=Jt.c(11),{canAddSection:u,onAddSection:p,className:h,size:k}=v,w=Yt();let y;e[0]!==h?(y=oe("w-full",h),e[0]=h,e[1]=y):y=e[1];const T=!u;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Cr,{size:14}),e[2]=b):b=e[2];let X;e[3]!==w?(X=w("sectionsEditor.sectionList.addSectionButton"),e[3]=w,e[4]=X):X=e[4];let me;return e[5]!==p||e[6]!==k||e[7]!==y||e[8]!==T||e[9]!==X?(me=n.jsxs(Vt,{type:"button",variant:"outline",size:k,className:y,disabled:T,onClick:p,children:[b,X]}),e[5]=p,e[6]=k,e[7]=y,e[8]=T,e[9]=X,e[10]=me):me=e[10],me}function fi(v){const e=Jt.c(101),{listKey:u,rawSections:p,sections:h,meta:k,decofile:w,selectedIndex:y,onSelect:T,onReorder:b,onDelete:X,onDuplicate:me,onMakeReusable:Ke,onToggleHidden:Be,onToggleLazy:Te,onAddVariant:re,onDetach:r,onAddSection:V,canAddSection:ge}=v,$=ge===void 0?!0:ge,c=Yt(),O=fs();let l;e[0]!==h.length?(l=()=>aa(h.length),e[0]=h.length,e[1]=l):l=e[1];const[J,G]=j.useState(l),[ke,Ne]=j.useState(null),[qe,_e]=j.useState(u),[d,M]=j.useState(h.length),We=j.useRef(!1);qe!==u?(_e(u),M(h.length),G(aa(h.length))):d!==h.length&&(M(h.length),G(Ce=>ri(Ce,h.length)));let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[2]=C):C=e[2];let Ue;e[3]===Symbol.for("react.memo_cache_sentinel")?(Ue={coordinateGetter:zr},e[3]=Ue):Ue=e[3];const z=Kr(ta(Fr,C),ta(Lr,Ue));let mt;e[4]!==J?(mt=J.map(pi),e[4]=J,e[5]=mt):mt=e[5];const fe=mt;let ze;e[6]===Symbol.for("react.memo_cache_sentinel")?(ze=Ce=>{Ne(String(Ce.active.id))},e[6]=ze):ze=e[6];const _t=ze;let Le;e[7]!==fe||e[8]!==b?(Le=Ce=>{Ne(null);const{active:L,over:D}=Ce;if(!D||L.id===D.id)return;const Fe=fe.indexOf(String(L.id)),Ze=fe.indexOf(String(D.id));Fe===-1||Ze===-1||(G(nt=>ua(ds([...nt],Fe,Ze))),We.current=!0,requestAnimationFrame(()=>{We.current=!1}),b?.(Fe,Ze))},e[7]=fe,e[8]=b,e[9]=Le):Le=e[9];const ie=Le;let le;e[10]===Symbol.for("react.memo_cache_sentinel")?(le=()=>{Ne(null)},e[10]=le):le=e[10];const Ae=le;let B,A,ce,we,Me,Re,H,ue,je,pe,ne,he,ae,Pe,ve;if(e[11]!==ke||e[12]!==$||e[13]!==O||e[14]!==w||e[15]!==J||e[16]!==fe||e[17]!==ie||e[18]!==k||e[19]!==V||e[20]!==re||e[21]!==X||e[22]!==r||e[23]!==me||e[24]!==Ke||e[25]!==T||e[26]!==Be||e[27]!==Te||e[28]!==p||e[29]!==h||e[30]!==y||e[31]!==z||e[32]!==c){Pe=Symbol.for("react.early_return_sentinel");e:{const Ce=L=>{We.current||T(L)};if(e[48]!==ke||e[49]!==$||e[50]!==O||e[51]!==J||e[52]!==V||e[53]!==p||e[54]!==h||e[55]!==c){const L=ke?J.find(D=>D.id===ke):null;if(we=L!=null?h[L.index]:null,ce=L!=null?p[L.index]:void 0,J.length===0){let D;e[59]!==c?(D=c("sectionsEditor.sectionList.noSections"),e[59]=c,e[60]=D):D=e[60];let Fe;e[61]!==D?(Fe=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:D}),e[61]=D,e[62]=Fe):Fe=e[62];const Ze=Fe;let nt;e[63]!==$||e[64]!==O||e[65]!==Ze||e[66]!==V?(nt=O?Ze:n.jsxs("div",{className:"space-y-2",children:[Ze,n.jsx(Fs,{canAddSection:$,onAddSection:V,size:"sm"})]}),e[63]=$,e[64]=O,e[65]=Ze,e[66]=V,e[67]=nt):nt=e[67],Pe=nt;break e}ae=oe(L&&"cursor-grabbing"),e[48]=ke,e[49]=$,e[50]=O,e[51]=J,e[52]=V,e[53]=p,e[54]=h,e[55]=c,e[56]=ce,e[57]=we,e[58]=ae}else ce=e[56],we=e[57],ae=e[58];A=$r,ue=z,je=Hr,pe=_t,ne=ie,he=Ae,B=Gr,Re=fe,H=qr,ve="space-y-1",Me=J.map(L=>{const D=h[L.index];return D?n.jsx(ci,{sortableId:L.id,section:D,raw:p[L.index],meta:k,decofile:w,selected:y===L.index,onSelect:()=>Ce(L.index),onDelete:()=>X(L.index),onDuplicate:()=>me(L.index),onMakeReusable:()=>Ke(L.index),onToggleHidden:()=>Be(L.index),onToggleLazy:()=>Te(L.index),onAddVariant:()=>re(L.index),onDetach:()=>r(L.index)},L.id):null})}e[11]=ke,e[12]=$,e[13]=O,e[14]=w,e[15]=J,e[16]=fe,e[17]=ie,e[18]=k,e[19]=V,e[20]=re,e[21]=X,e[22]=r,e[23]=me,e[24]=Ke,e[25]=T,e[26]=Be,e[27]=Te,e[28]=p,e[29]=h,e[30]=y,e[31]=z,e[32]=c,e[33]=B,e[34]=A,e[35]=ce,e[36]=we,e[37]=Me,e[38]=Re,e[39]=H,e[40]=ue,e[41]=je,e[42]=pe,e[43]=ne,e[44]=he,e[45]=ae,e[46]=Pe,e[47]=ve}else B=e[33],A=e[34],ce=e[35],we=e[36],Me=e[37],Re=e[38],H=e[39],ue=e[40],je=e[41],pe=e[42],ne=e[43],he=e[44],ae=e[45],Pe=e[46],ve=e[47];if(Pe!==Symbol.for("react.early_return_sentinel"))return Pe;let Ve;e[68]!==Me||e[69]!==ve?(Ve=n.jsx("div",{className:ve,children:Me}),e[68]=Me,e[69]=ve,e[70]=Ve):Ve=e[70];let Ee;e[71]!==B||e[72]!==Re||e[73]!==H||e[74]!==Ve?(Ee=n.jsx(B,{items:Re,strategy:H,children:Ve}),e[71]=B,e[72]=Re,e[73]=H,e[74]=Ve,e[75]=Ee):Ee=e[75];let Se;e[76]!==ce||e[77]!==we||e[78]!==O||e[79]!==w||e[80]!==k?(Se=we?n.jsx("div",{className:oe("cursor-grabbing shadow-lg ring-1 ring-border/60",ma(we,!1,O)),children:n.jsx(da,{section:we,raw:ce,meta:k,decofile:w})}):null,e[76]=ce,e[77]=we,e[78]=O,e[79]=w,e[80]=k,e[81]=Se):Se=e[81];let ye;e[82]!==Se?(ye=ho.createPortal(n.jsx(Br,{dropAnimation:wo,children:Se}),document.body),e[82]=Se,e[83]=ye):ye=e[83];let $e;e[84]!==A||e[85]!==ue||e[86]!==je||e[87]!==pe||e[88]!==ne||e[89]!==he||e[90]!==Ee||e[91]!==ye?($e=n.jsxs(A,{sensors:ue,collisionDetection:je,onDragStart:pe,onDragEnd:ne,onDragCancel:he,children:[Ee,ye]}),e[84]=A,e[85]=ue,e[86]=je,e[87]=pe,e[88]=ne,e[89]=he,e[90]=Ee,e[91]=ye,e[92]=$e):$e=e[92];let P;e[93]!==$||e[94]!==O||e[95]!==V?(P=!O&&n.jsx(Fs,{canAddSection:$,onAddSection:V,size:"sm",className:"mt-2"}),e[93]=$,e[94]=O,e[95]=V,e[96]=P):P=e[96];let st;return e[97]!==ae||e[98]!==$e||e[99]!==P?(st=n.jsxs("div",{className:ae,children:[$e,P]}),e[97]=ae,e[98]=$e,e[99]=P,e[100]=st):st=e[100],st}function pi(v){return v.id}function hi(v,e,u,p){if(!v||typeof v!="object")return{kind:"error",reason:"no-matcher-rule"};const h=e.trim();if(!h)return Rt(v,u,p)?{kind:"inline",blockKey:v.__resolveType??"",inlinedRule:Ds(v,u,p)}:{kind:"noop"};const k=Ks(v,u,p);if(!k)return{kind:"error",reason:"unreadable-rule"};if(k.blockKey)return{kind:"updateBlock",blockKey:k.blockKey,blockData:xt(k.resolveType,k.data,h)};const w=cs(h),y=us(w,u);return y?{kind:"error",reason:"invalid-block-id",message:y}:{kind:"createBlock",blockId:w,blockData:xt(k.resolveType,k.data,h),reference:Lt(w)}}function Bc({orgSlug:v,virtualMcpId:e,branch:u,previewReady:p=!0,previewUrl:h,currentPath:k,activePageBlockKey:w=null,activeGlobalBlockKey:y=null,externalSelection:T,onSaved:b,initialEditSeo:X=!1,onExitSeo:me,onSelectRoot:Ke,onViewJsonFile:Be,onFocusedBlockChange:Te,onVariantPreviewOverride:re}){const r=Yt(),V=_o(),ge=V?.taskId??null,$=p?{orgSlug:v,virtualMcpId:e,branch:u,threadId:ge,previewUrl:h}:null,{data:c,isLoading:O}=Co($),{data:l,isLoading:J}=Do($),G=fs(),ke=V?.virtualMcpId,qe=sr(ke===e?e:null)?.metadata?.siteSlug??null,_e=Jr({virtualMcpId:e,sandboxUrl:h}),[d,M]=j.useState(null),[We,C]=j.useState(null),[Ue,z]=j.useState(null),[mt,fe]=j.useState(0),[ze,_t]=j.useState(void 0),[Le,ie]=j.useState(null),[le,Ae]=j.useState(null),[B,A]=j.useState([]),ce=j.useRef(null),[we,Me]=j.useState(B.length);we!==B.length&&(Me(B.length),requestAnimationFrame(()=>{ce.current&&(ce.current.scrollTop=0)}));const[Re,H]=j.useState(0),[ue,je]=j.useState(null),[pe,ne]=j.useState(null),[he,ae]=j.useState(null),[Pe,ve]=j.useState(!1),[Ve,Ee]=j.useState(!1),Se=j.useRef(null),[ye,$e]=j.useState(!0),[P,st]=j.useState(!1),[Ce,L]=j.useState(!1),[D,Fe]=j.useState(X),[Ze,nt]=j.useState(X);X&&!Ze&&(nt(!0),Fe(!0),M(null),C(null),z(null),A([])),!X&&Ze&&nt(!1);const[fa,Qt]=j.useState(null),[Os,ps]=j.useState(void 0),[zs,jt]=j.useState([]),[$s,Ft]=j.useState(0),[Ie,Je]=j.useState(0),[pa,De]=j.useState(null),[Tt,Oe]=j.useState(null),[Hs,Gs]=j.useState(null),ha=yo(),ga=`${v}/${e}/${u}`,Xt=Ko({orgSlug:v,virtualMcpId:e,branch:u}),[va,Sa]=j.useState(k),[ya,ba]=j.useState(w),[xa,_a]=j.useState(y);(va!==k||ya!==w||xa!==y)&&(queueMicrotask(()=>Xt.flush()),Sa(k),ba(w),_a(y),M(null),C(null),z(null),fe(0),ie(null),Ae(null),Je(0),De(null),Oe(null),A([]),H(t=>t+1),Fe(!1),Qt(null),ps(void 0),jt([]),Ft(t=>t+1));const Y=Bo({orgSlug:v,virtualMcpId:e,branch:u}),It=Xo((t,s)=>{Y.mutate({blockKey:t,data:s},{onSuccess:()=>b?.(),onError:a=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),Zt=lr({orgSlug:v,virtualMcpId:e,branch:u}),[Nt,At]=j.useState(!1),q=j.useRef(null),qs=j.useRef(null),at=j.useRef(null),ot=j.useRef(null),hs=j.useRef({}),He=j.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[ja,Ea]=j.useState(null);if(!p||O||J)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(bo,{className:"size-5 text-muted-foreground"})});if(!c||!l)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const ka=dr(c),Q=!!y,te=Q?null:mr(ka,k,w),g=Q?y:te?.key??null,gs=Q&&y?c[y]:void 0,Ws=Q&&y&&gs?fr(y,gs):Q&&y?y:"",Ot=!Q&&g&&c[g]?c[g]:null,vs=D&&c&&l&&g&&te?Ln(c,{kind:"page",pageKey:g,pageName:String(te.name??""),path:String(te.path??"")},l):null,wa=D?Ot?.seo:void 0,es=Os!==void 0?Os:wa,Ra=D?Lo(es):void 0,Us=vs?.seoTypeOptions??[],Js=D&&l?Fo(l):"",Ss=fa??Ra??{},ts=D&&vs?Wr(Ss,vs):null,Ys=D&&ts&&Io(es)?ls(ts,l):null,Qs=D?Oo(c,l)?.seoData:void 0,de=Q?[{label:"Default",sections:[{__resolveType:y}]}]:zo(Ot?.sections,c??{}),et=de.length>1,se=Math.min(mt,de.length-1),Ge=de[se],K=Ge?.sections??[],be=rs(K,c),ys=!Q&&pr(Ot?.sections);if(Q&&y&&Hs!==y){Gs(y);const t=K[0],s=be[0];if(t&&s){M(0),Je(0),A([]);const a=kt(t,s,c);a&&(C(a.data),z(a.resolveType),Oe(null),De(null))}}!Q&&Hs!==null&&Gs(null),He.current={rawSections:K,parsedSections:be,decofile:c??{},activePageKey:g,pageVariants:de,variantIndex:se,sectionVariantIndex:Ie,selectedSectionIndex:d};const Va=()=>({multivariate:ys,index:se,variants:de.map(t=>({rule:t.rule}))}),bs=(t,s)=>{if(!re)return;if(!g||!ys||t.length<=1){re(null);return}const a=na(g,{multivariate:!0,index:s,variants:t},c,l);re(a.length>0?a:null)},xs=re&&g&&ys&&et&&!O&&!J?g:null;if(xs!==ja&&(Ea(xs),xs)){const t=de.map(a=>({rule:a.rule})),s=se;queueMicrotask(()=>bs(t,s))}const Mt=(t,s,a)=>{if(!re)return;if(!g){re(null);return}const o=Va(),i=na(g,o,c,l);if(!t||s<0){re(i.length>0?i:null);return}const m=Qr({pageKey:g,page:o,sectionIndex:s,sectionLazy:be[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:c,meta:l}),f=[...i,...m];re(f.length>0?f:null)},ft=(t,s,a,o=d??-1,i=!1)=>{const m=tt(t,s);if(!m){C(null),z(null),Oe(null),De(null),i&&Mt(null,o,a);return}const x=Jn(m,lt)[a];if(!x){C(null),z(null),Oe(null),De(null),i&&Mt(null,o,a);return}const R=hr(x.value,c);C(R?.data??null),z(R?.resolveType??null);const{resolveType:S,formValue:E}=Wt(x.rule,c,l??void 0);Oe(S),De(E),i&&Mt(m,o,a)},zt=T?.index;if(T!==void 0&&(T?.seq??null)!==ze&&(_t(T?.seq??null),typeof zt=="number")){const t=K[zt],s=be[zt];if(t&&s)if(M(zt),Je(0),A([]),H(a=>a+1),s.isMultivariate)ft(t,s,0,zt);else{const a=kt(t,s,c);a?(C(a.data),z(a.resolveType)):(C(null),z(null)),Oe(null),De(null)}}const $t={orgSlug:v,virtualMcpId:e,branch:u,threadId:ge,previewUrl:h??void 0,siteSlug:qe},_s=Ue&&l?ls(Ue,l):null,Ye=(t,s)=>{if(!g)return;q.current&&(clearTimeout(q.current),q.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null),at.current&&(clearTimeout(at.current),at.current=null);const a=qt(c,g,t,se,de);Y.mutate({blockKey:g,data:a},{onSuccess:()=>s?.onSuccess?.()??b?.(),onError:o=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:o.message}))})},Pt=()=>{Te?.(null),M(null),L(!1),C(null),z(null),Je(0),De(null),Oe(null),A([]),H(t=>t+1)},Ta=(t,s)=>{const a=He.current.sectionVariantIndex,o=qs.current;q.current&&(clearTimeout(q.current),q.current=null,o&&(o.sectionIndex!==s||o.sectionVariantIndex!==a)&&o.write());const i=()=>{const{rawSections:m,parsedSections:f,decofile:x,activePageKey:R,pageVariants:S,variantIndex:E}=He.current,_=m[s];if(!_)return;const W=f[s];if(!W)return;if(W.isSavedBlock){const F=tr(_,W);if(!F)return;Y.mutate({blockKey:F,data:t},{onSuccess:()=>b?.(),onError:U=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:U.message}))});return}if(!R)return;const Z={...x[R]},ee=[...m];if(W.isMultivariate){const F=tt(_,W);if(!F||!R)return;const U=Tr(F,a,t);ee[s]=wt(_,W,U)}else if(W.isHidden){const F=Is(_.__resolveType),U=F?{..._.section}:{..._},I=Array.isArray(U.variants)?[...U.variants]:[];I[0]&&(I[0]={...I[0],value:t}),U.variants=I,F?ee[s]={..._,section:U}:ee[s]=U}else W.isLazy?ee[s]={..._,section:t}:ee[s]=t;if(S.length>1){const F=Z.sections,U=[...F?.variants??[]];U[E]&&(U[E]={...U[E],value:ee}),Z.sections={...F,variants:U}}else Z.sections=ee;Y.mutate({blockKey:R,data:Z},{onSuccess:()=>b?.(),onError:F=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:F.message}))})};qs.current={sectionIndex:s,sectionVariantIndex:a,write:i},q.current=setTimeout(()=>{q.current=null,i()},Ms)},Na=t=>{M(t),Je(0),A([]),H(i=>i+1);const s=K[t],a=be[t];if(Te?.(a?.isSavedBlock?a.resolveType??null:null),!s||!a)return;if(a.isMultivariate){ft(s,a,0,t);return}const o=kt(s,a,c);if(!o){C(null),z(null),Oe(null),De(null),Mt(null,t,0);return}C(o.data),z(o.resolveType),Oe(null),De(null),Mt(null,t,0)},Xs=t=>{const s=t;C(s),d!==null&&Ta(s,d)},js=t=>{if(!g||!c||!l||!te)return;const s={kind:"page",pageKey:g,pageName:String(te.name??""),path:String(te.path??"")},a=Ln(c,s,l);a&&Xt.save(g,()=>{const o=ha.getQueryData(xo.decofile(ga))?.[g];if(!o||typeof o!="object"||o===null||Array.isArray(o))return null;const i={...o,...hs.current};return hs.current={},t?.raw!==void 0?{...i,seo:t.raw}:t?.inner!==void 0?Ur(s,a,i,t.inner):i})},Zs=(t,s)=>{g&&(hs.current[t]=s,js())},Aa=(t,s)=>{if(!g)return;const a=ds([...K],t,s);d!==null&&(d===t?M(s):t<d&&s>=d?M(d-1):t>d&&s<=d&&M(d+1)),Ye(a)},Ma=t=>{if(!g)return;const s=K.filter((a,o)=>o!==t);d===t?Pt():d!==null&&d>t&&M(d-1),Ye(s)},Pa=t=>{if(!g)return;const s=K[t];if(!s)return;const a=[...K];a.splice(t+1,0,Zo(s)),d!==null&&d>t&&M(d+1),Ye(a)},Ca=t=>{if(!g)return;const s=K[t],a=be[t];if(!s||!a)return;const o=a.isHidden?Er(s):kr(s);if(!o)return;const i=[...K];i[t]=o,d===t&&Pt(),Ye(i)},Da=t=>{if(!g)return;const s=K[t],a=be[t];if(!s||!a||a.isMultivariate)return;const o=jr(s);if(!o)return;const i=[...K];i[t]=o,d===t&&Pt(),Ye(i)},Ka=t=>{if(!g)return;const s=K[t],a=be[t];if(!s||!a?.isSavedBlock)return;const o=kt(s,a,c);if(!o?.data)return;const{name:i,...m}=o.data,f=[...K];a.isLazy?f[t]={...s,section:m}:f[t]=m,d===t&&Pt(),Ye(f)},Ba=t=>{if(!g)return;const s=[...K,{__resolveType:t.resolveType}],a=s.length-1;Ye(s,{onSuccess:()=>{ve(!1),M(a),Je(0),A([]),H(f=>f+1);const o=s[a],i=rs(s,c)[a];if(!o||!i)return;if(i.isMultivariate){ft(o,i,0);return}const m=kt(o,i,c);if(!m){C(null),z(null),Oe(null),De(null);return}C(m.data),z(m.resolveType),Oe(null),De(null)}})},en=t=>{Se.current=t.append,ve(!0)},La=t=>{const s=Se.current;if(!s){Ba(t);return}s({__resolveType:t.resolveType}),ve(!1),Se.current=null},tn=t=>{if(d===null)return;const s=K[d],a=be[d];!s||!a?.isMultivariate||(Je(t),A([]),H(o=>o+1),ft(s,a,t,d,!0))},Fa=t=>{if(d===null||!g)return;const s=K[d],a=be[d];if(!s||!a?.isMultivariate)return;const o=tt(s,a);if(!o)return;const i=xr(o,t);if(!i){N.error(r("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const m=[...K];m[d]=wt(s,a,i);const f=i.variants;let x=Ie;t===Ie?x=Math.min(t,f.length-1):t<Ie&&(x=Ie-1),Je(x),A([]),H(R=>R+1),ft(m[d],a,x),Ye(m)},Ia=t=>{if(d===null||!g)return;const s=K[d],a=be[d];if(!s||!a?.isMultivariate)return;const o=tt(s,a);if(!o)return;const i=_r(o,t),m=[...K];m[d]=wt(s,a,i);const f=t+1;Je(f),A([]),H(x=>x+1),ft(m[d],a,f),Ye(m)},Oa=(t,s)=>{if(d===null||!g||t===s)return;const a=K[d],o=be[d];if(!a||!o?.isMultivariate)return;const i=tt(a,o);if(!i)return;const m=yr(i,t,s),f=[...K];f[d]=wt(a,o,m);let x=Ie;Ie===t?x=s:t<Ie&&s>=Ie?x=Ie-1:t>Ie&&s<=Ie&&(x=Ie+1),Je(x),ft(f[d],o,x),Ye(f)},Ht=t=>{const s=t??d;if(s===null||!g)return;const a=K[s],o=be[s];if(!a||!o)return;const i=gr(a,o);if(!i){N.error(r("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const m=[...K];m[s]=i.section;const f=rs(m,c)[s];if(!f?.isMultivariate){N.error(r("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}M(s),Je(i.newVariantIndex),A([]),H(x=>x+1),ft(i.section,f,i.newVariantIndex,s),Ye(m)},sn=()=>{if(d===null||!g)return;const t=K[d],s=be[d];if(!t||!s?.isMultivariate)return;const a=tt(t,s);if(!a)return;const o=br(t,s,a);if(!o){N.error(r("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const i=[...K];i[d]=o;const m=rs(i,c)[d];if(!m)return;Je(0),Oe(null),De(null),A([]),H(x=>x+1);const f=kt(o,m,c);f?(C(f.data),z(f.resolveType)):(C(null),z(null)),Mt(null,d,0),Ye(i)},za=async t=>{if(ue===null||!g)return;const s=us(t,c);if(s){N.error(s);return}const a=K[ue],o=be[ue];if(!a||!o)return;const i=kt(a,o,c);if(!i){N.error(r("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const m={...i.data,name:t};try{await Y.mutateAsync({blockKey:t,data:m});const f=[...K];f[ue]={__resolveType:t},await Y.mutateAsync({blockKey:g,data:qt(c,g,f,se,de)}),d===ue&&Pt(),je(null),N.success(r("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),b?.()}catch(f){N.error(f instanceof Error?f.message:r("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},nn=Ge?.rule;if(et&&d===null&&le===null&&nn){const{resolveType:t,formValue:s}=Wt(nn,c??{},l??void 0);Ae(t),ie(s)}const Ct=l?$o(l):[],Es=l&&c?Ho(l,c):[],an=!Q&&!!(_e&&l&&c),on=le&&l?ls(le,l):null,pt=()=>{at.current&&(clearTimeout(at.current),at.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null)},Et=async(t,s)=>{if(!(Vr(s,t,l)>0))try{await Zt.mutateAsync({blockKey:t})}catch(a){N.error(a instanceof Error?a.message:r("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},rn=t=>{at.current&&clearTimeout(at.current),at.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:o}=He.current;if(!s)return;const i={...a[s]},m={...i.sections},f=[...m.variants??[]],x=f[o],R=x?.rule;if(Rt(R,a,l)){const S=R?.__resolveType??"",E=a[S],_=typeof E?.name=="string"?E.name:S,{__resolveType:W,...Z}=t;Y.mutate({blockKey:S,data:xt(W??"",Z,_)},{onSuccess:()=>b?.(),onError:ee=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:ee.message}))});return}x&&(f[o]={...x,rule:t}),i.sections={...m,variants:f},Y.mutate({blockKey:s,data:i},{onSuccess:()=>b?.(),onError:S=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:S.message}))})},Ms)},ln=t=>{Ae(t);const s=t?Yn(t,l):{__resolveType:Qn};ie(t?s:{}),rn(s)},cn=t=>{const s=t;ie(s);const a=le?{__resolveType:le,...s}:{...s};rn(a)},un=async t=>{pt();const{activePageKey:s,decofile:a,variantIndex:o}=He.current;if(!s)return;const i=a[s],m=i?.sections;if(!m||typeof m!="object"||Array.isArray(m))return;const f=m;if(!Array.isArray(f.variants))return;const x=[...f.variants],R=x[o];if(!R)return;const S=bt(R.rule,a,l),E=Lt(t);x[o]={...R,rule:E};const _={...a,[s]:{...i,sections:{...f,variants:x}}},{resolveType:W,formValue:Z}=Wt(E,_,l??void 0);Ae(W),ie(Z);try{await Y.mutateAsync({blockKey:s,data:_[s]}),S&&S!==t&&await Et(S,_),b?.()}catch(ee){N.error(ee instanceof Error?ee.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},dn=t=>{ot.current&&clearTimeout(ot.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=He.current;s!==null&&(ot.current=setTimeout(()=>{const{rawSections:o,parsedSections:i,decofile:m,activePageKey:f,pageVariants:x,variantIndex:R}=He.current;if(!f)return;const S=o[s],E=i[s];if(!S||!E?.isMultivariate)return;const _=tt(S,E);if(!_)return;const Z=(_.variants??[])[a]?.rule;if(Rt(Z,m,l)){const I=Z?.__resolveType??"",Xe=m[I],rt=typeof Xe?.name=="string"?Xe.name:I,{__resolveType:St,...it}=t;Y.mutate({blockKey:I,data:xt(St??"",it,rt)},{onSuccess:()=>b?.(),onError:yt=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:yt.message}))});return}const ee=Xn(_,a,t),F=[...o];F[s]=wt(S,E,ee);const U=qt(m,f,F,R,x);Y.mutate({blockKey:f,data:U},{onSuccess:()=>b?.(),onError:I=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:I.message}))})},Ms))},$a=t=>{Oe(t);const s=t?Yn(t,l):{__resolveType:Qn};De(t?s:{}),dn(s)},Ha=t=>{const s=t;De(s);const a=Tt?{__resolveType:Tt,...s}:{...s};dn(a)},Ga=async t=>{pt();const{selectedSectionIndex:s,sectionVariantIndex:a,rawSections:o,parsedSections:i,decofile:m,activePageKey:f,pageVariants:x,variantIndex:R}=He.current;if(s===null||!f)return;const S=o[s],E=i[s];if(!S||!E?.isMultivariate)return;const _=tt(S,E);if(!_)return;const W=_.variants??[],Z=bt(W[a]?.rule,m,l),ee=Lt(t),F=Xn(_,a,ee),U=[...o];U[s]=wt(S,E,F);const I=qt(m,f,U,R,x),Xe={...m,[f]:I},{resolveType:rt,formValue:St}=Wt(ee,Xe,l??void 0);Oe(rt),De(St);try{await Y.mutateAsync({blockKey:f,data:I}),Z&&Z!==t&&await Et(Z,Xe),b?.()}catch(it){N.error(it instanceof Error?it.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!Q&&!te)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.noPageFound",{currentPath:k})});if(Q&&!gs)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.globalBlockNotFound")});const xe=d!==null?be[d]??null:null,mn=d!==null?K[d]:null,fn=mn&&xe?.isMultivariate?tt(mn,xe):null,ht=fn?Jn(fn,lt):[],ss=Math.min(Ie,Math.max(ht.length-1,0)),Dt=ht[ss]??null,gt=xe?.isMultivariate===!0,ks=d!==null&&xe!==null,vt=ks&&(gt||!!(_s&&We)),qa=vt&&!Q&&xe?.isSavedBlock===!0,Qe=Q||qa,pn=Q?Ws:xe?.label??"",Wa=Tt&&l?ls(Tt,l):null,hn=(t,s)=>s&&G?`${t} · ${s}`:t,gn=xe?xe.variantOf??xe.label:"",Ua=(()=>{const t=gt&&Dt?Dt.label:null;return t?G?[hn(gn,t)]:[xe.label,t]:[xe?.label??""]})(),ws=hn(te?.name??"",et?Ge?.label:null),ns=vt&&(!Q||B.length>0)?Q?[Ws,...B]:[ws,...Ua,...B]:[],vn=D&&te?[te.name,"SEO",...zs]:[],Sn=r("sectionsEditor.pageVariantTabs.variantsLabel"),yn=P&&te?[te.name,Sn]:Ce&&te&&xe?[ws,gn,Sn]:[],as=yn.length>0?yn:vn.length>0?vn:Qe?ns.length>0?ns:[pn]:ns.length>0?ns:[ws],bn=ks&&!gt&&!xe?.isHidden&&!!g,Ja=Qe||!Q&&et&&!!Ge||bn,Ya=ks&&!gt&&!Q&&B.length===0&&!!xe&&ia(xe)&&!!g,Qa=G&&vt&&!Ce&&gt&&B.length===0&&!!Dt,xn=G&&B.length>0?Fn(B[B.length-1]):null,Xa=B.length>1?Fn(B[B.length-2]):null,_n=Qe?pn:vt?xe?.label??"":te?.name??"",Za=P||Ce?r("sectionsEditor.pageVariantTabs.variantsLabel"):D?r("sectionsEditor.panelSections.seo"):xn??_n,jn=Ce?xe?.variantOf??xe?.label??"":P||D?te?.name??"":xn?Xa??_n:Qe?r("sectionsEditor.sectionsEditor.globalSectionSubtitle"):vt?te?.name??"":te?.path??"",Rs=!P&&!Ce&&!D&&!vt&&!Qe,eo=!G&&!D&&!Q&&gt&&B.length===0,Gt=()=>{if(!g)return;pt(),q.current&&(clearTimeout(q.current),q.current=null);const t=c[g],s=vr(t.sections,K);if(!s)return;const a=Sr(s);Y.mutate({blockKey:g,data:{...t,sections:s}},{onSuccess:()=>{fe(a),M(null),C(null),z(null),A([]),ie(null),Ae(null)},onError:o=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:o.message}))})},os=(t,s,a)=>{if(!g)return;pt(),q.current&&(clearTimeout(q.current),q.current=null);const o=c[g],i=o.sections;if(!i||typeof i!="object"||Array.isArray(i))return;const m=i;if(!Array.isArray(m.variants))return;const f=t([...m.variants]);if(!f)return;const x=Rr(m,f),R={...c,[g]:{...o,sections:x}};Y.mutate({blockKey:g,data:R[g]},{onSuccess:()=>{s?.();const S=typeof a=="string"?[a]:a??[];(async()=>{for(const E of S)await Et(E,R)})()},onError:S=>N.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:S.message}))})},Vs=t=>{ne(null),fe(t),M(null),C(null),z(null),A([]);const s=de[t]?.rule,{resolveType:a,formValue:o}=Wt(s,c??{},l??void 0);Ae(a),ie(o),bs(de.map(i=>({rule:i.rule})),t)},En=(t,s)=>{if(t===s)return;let a=se;se===t?a=s:t<se&&s>=se?a=se-1:t>se&&s<=se&&(a=se+1),fe(a);const o=ds(de.map(i=>({rule:i.rule})),t,s);bs(o,a),os(i=>ds(i,t,s))},kn=t=>{const s=de[t]?.rule,a=bt(s,c??{},l??void 0);os(o=>o.length<=1?null:(o.splice(t,1),o),()=>{de.length-1===1?fe(0):t<se?fe(se-1):t===se&&fe(Math.max(0,t-1)),M(null),C(null),z(null),A([]),ie(null),Ae(null)},a)},to=()=>{const t=de.map((s,a)=>({variant:s,index:a})).filter(({variant:s})=>!wr(s.rule)).map(({variant:s})=>bt(s.rule,c??{},l??void 0)).filter(s=>!!s);os(s=>{const a=Nr({variants:s}),o=s[a];return o?[{...o,rule:Ar()}]:null},()=>{fe(0),M(null),C(null),z(null),A([]),ie(null),Ae(null),st(!1)},t)},wn=t=>{os(s=>Mr(s,t),()=>{fe(t+1),M(null),C(null),z(null),A([]),ie(null),Ae(null)})},so=async(t,s)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const a=He.current.activePageKey,o=He.current.decofile;if(!a)return;const i=o[a],m=i.sections;if(!m||typeof m!="object"||Array.isArray(m))return;const f=m;if(!Array.isArray(f.variants))return;const x=[...f.variants],R=x[t];if(!R?.rule||typeof R.rule!="object"){N.error(r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const S=R.rule,E=s.trim();At(!0);try{if(!E){if(!Rt(S,o,l)){ne(null);return}const U=S.__resolveType??"";x[t]={...R,rule:Ds(S,o,l)};const I={...o,[a]:{...i,sections:{...f,variants:x}}};await Y.mutateAsync({blockKey:a,data:I[a]}),await Et(U,I),ne(null),b?.();return}const _=Ks(S,o,l);if(!_){N.error(r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(_.blockKey){await Y.mutateAsync({blockKey:_.blockKey,data:xt(_.resolveType,_.data,E)}),ne(null),b?.();return}const W=cs(E),Z=us(W,o);if(Z){N.error(Z);return}const ee=xt(_.resolveType,_.data,E);let F=null;try{await Y.mutateAsync({blockKey:W,data:ee}),F=W,x[t]={...R,rule:Lt(W)},await Y.mutateAsync({blockKey:a,data:{...i,sections:{...f,variants:x}}}),F=null}catch(U){throw F&&await Zt.mutateAsync({blockKey:F}).catch(()=>{}),U}ne(null),N.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:E})),b?.()}catch(_){N.error(_ instanceof Error?_.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{At(!1)}},no=async(t,s)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const{selectedSectionIndex:a,rawSections:o,parsedSections:i,decofile:m,activePageKey:f,pageVariants:x,variantIndex:R}=He.current;if(a===null||!f)return;const S=o[a],E=i[a];if(!S||!E?.isMultivariate)return;const _=tt(S,E);if(!_)return;const W=_.variants??[],Z=W[t];if(!Z?.rule||typeof Z.rule!="object"){N.error(r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const ee=Z.rule,F=s.trim();At(!0);const U=async I=>{const Xe={..._,variants:I},rt=[...o];rt[a]=wt(S,E,Xe);const St=qt(m,f,rt,R,x);return await Y.mutateAsync({blockKey:f,data:St}),{...m,[f]:St}};try{if(!F){if(!Rt(ee,m,l)){ae(null);return}const yt=ee.__resolveType??"",Kn=[...W];Kn[t]={...Z,rule:Ds(ee,m,l)};const po=await U(Kn);await Et(yt,po),ae(null),b?.();return}const I=Ks(ee,m,l);if(!I){N.error(r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(I.blockKey){await Y.mutateAsync({blockKey:I.blockKey,data:xt(I.resolveType,I.data,F)}),ae(null),b?.();return}const Xe=cs(F),rt=us(Xe,m);if(rt){N.error(rt);return}const St=xt(I.resolveType,I.data,F);let it=null;try{await Y.mutateAsync({blockKey:Xe,data:St}),it=Xe;const yt=[...W];yt[t]={...Z,rule:Lt(Xe)},await U(yt),it=null}catch(yt){throw it&&await Zt.mutateAsync({blockKey:it}).catch(()=>{}),yt}ae(null),N.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:F})),b?.()}catch(I){N.error(I instanceof Error?I.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{At(!1)}},Rn=async(t,s,a)=>{C(a);try{await Y.mutateAsync({blockKey:t,data:a})}catch(o){throw C(i=>i===a?s:i),o}},ao={rename:async(t,s,a)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const{activePageKey:o,decofile:i}=He.current;if(!o)return;const m=Array.isArray(t.variants)?[...t.variants]:[],f=m[s],x=f?.rule&&typeof f.rule=="object"?f.rule:void 0,R=async E=>{const _={...t,variants:E};return await Rn(o,t,_),{...i,[o]:_}},S=hi(x,a,i,l);if(S.kind!=="noop"){if(S.kind==="error"){N.error(S.reason==="no-matcher-rule"?r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):S.reason==="unreadable-rule"?r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):S.message??r("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}At(!0);try{if(S.kind==="inline"){const _=[...m];_[s]={...f,rule:S.inlinedRule};const W=await R(_);await Et(S.blockKey,W),b?.();return}if(S.kind==="updateBlock"){await Y.mutateAsync({blockKey:S.blockKey,data:S.blockData}),b?.();return}let E=null;try{await Y.mutateAsync({blockKey:S.blockId,data:S.blockData}),E=S.blockId;const _=[...m];_[s]={...f,rule:S.reference},await R(_),E=null}catch(_){throw E&&await Zt.mutateAsync({blockKey:E}).catch(()=>{}),_}N.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:a.trim()})),b?.()}catch(E){N.error(E instanceof Error?E.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{At(!1)}}},selectGlobal:async(t,s,a)=>{pt(),q.current&&(clearTimeout(q.current),q.current=null);const{activePageKey:o,decofile:i}=He.current;if(!o)return;const m=Array.isArray(t.variants)?[...t.variants]:[],f=m[s];if(!f)return;const x=bt(f.rule,i,l);m[s]={...f,rule:Lt(a)};const R={...t,variants:m},S={...i,[o]:R};try{await Rn(o,t,R),x&&x!==a&&await Et(x,S),b?.()}catch(E){N.error(E instanceof Error?E.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}}},Vn=()=>{Pt()},Tn=t=>{Qt(t),js({inner:t})},Nn=t=>{ps(t),js({raw:t})},An=()=>{Qt(null),jt([])},Mn=()=>Ft(t=>t+1),Pn=()=>{Xt.flush(),Fe(!1),Qt(null),ps(void 0),jt([]),Ft(t=>t+1),me?.()},oo=()=>{st(!1),L(!1),M(null),Fe(!0)},ro=()=>{D&&Pn(),M(null),st(!0)},io=()=>L(!0),Ts=t=>{if(P&&t===0){st(!1);return}if(Ce&&t<2){L(!1),t===0&&M(null);return}if(D){if(t===0){Pn();return}if(t===1){jt([]),Ft(a=>a+1);return}jt(zs.slice(0,t-1)),Ft(a=>a+1);return}if(Q){A(B.slice(0,t)),H(a=>a+1);return}if(t===0){Vn();return}if(t===1){A([]),H(a=>a+1);return}const s=!G&&gt&&Dt?1:0;if(s===1&&t===2){A([]),H(a=>a+1);return}A(B.slice(0,t-1-s))},Ns=as.length>1?n.jsx("button",{type:"button",onClick:()=>Ts(er(as.length,{isMultivariateSectionTop:eo})),title:r("sectionsEditor.sectionsEditor.back"),"aria-label":r("sectionsEditor.sectionsEditor.back"),className:oe("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",Qe?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:n.jsx(rr,{className:"size-4"})}):null,lo=Qe||vt||D?Ja&&n.jsxs("div",{className:oe("border-b px-3 py-2.5",Qe&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!Q&&et&&Ge&&n.jsxs("button",{type:"button",onClick:Vn,title:r("sectionsEditor.sectionsEditor.editingInVariant",{variant:Ge.label}),className:oe("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",qo),children:[n.jsx(Go,{rule:Ps(Ge.rule,c??{},l??void 0),matchers:Ct}),n.jsx("span",{className:"max-w-[160px] truncate",children:Ge.label})]}),n.jsx("div",{className:"flex-1"}),Qe&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(ms,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(dt,{side:"bottom",className:"max-w-[260px]",children:r("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),bn&&n.jsx(is,{onClick:()=>Ht()})]}),Qe&&n.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:r("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(In,{pageKey:g,initialName:te.name,initialPath:te.path,onFieldChange:Zs,variant:"header"})}),n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>Fe(!0),children:n.jsx(Wn,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.editSeo")})]}),n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"ghost",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>Be&&g?Be():Ee(!0),children:n.jsx(Un,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.viewJson")})]}),n.jsx(is,{onClick:Gt})]}),co=n.jsxs(n.Fragment,{children:[et&&g&&n.jsx(On,{listKey:g,variants:de,activeIndex:se,decofile:c??{},meta:l,matchers:Ct,onSelect:Vs,onReorder:En,onRename:ne,onDuplicate:wn,onDelete:kn,onAdd:Gt}),et&&le!==null&&n.jsx(zn,{className:"mt-3",children:n.jsx("div",{className:oe("space-y-3",Nt&&"pointer-events-none opacity-50"),children:n.jsx(As,{currentRt:le,currentLabel:Ut(Ge?.rule,c??{},lt,l??void 0),currentGlobalKey:bt(Ge?.rule,c??{},l??void 0)??void 0,matchers:Ct,globals:Es,onSelect:ln,onSelectGlobal:un,schema:on,formValue:Le,onChange:cn,formKey:`${se}:${le??""}`,formWrapperClassName:"space-y-3",meta:l??void 0,decofile:c,onSaveReferencedBlock:It,sandbox:$t})})})]}),Cn=n.jsxs(n.Fragment,{children:[n.jsx(Wo,{listKey:`${g??""}:${d??""}`,variants:ht.map((t,s)=>({index:s,label:t.label})),selectedIndex:ss,onSelect:tn,onRename:ae,onDuplicate:Ia,onDelete:Fa,onRemoveAll:sn,onReorder:Oa,onAdd:()=>Ht()}),n.jsx(zn,{children:n.jsx(As,{currentRt:Tt??"",currentLabel:Ut(Dt?.rule,c??{},lt,l??void 0),currentGlobalKey:bt(Dt?.rule,c??{},l??void 0)??void 0,matchers:Ct,globals:Es,onSelect:$a,onSelectGlobal:Ga,schema:Wa,formValue:pa,onChange:Ha,formKey:`${d??"none"}:${ss}:${Tt??""}`,formWrapperClassName:"pt-1",meta:l??void 0,decofile:c,onSaveReferencedBlock:It,sandbox:$t})})]}),Dn=n.jsx("div",{className:oe(G?"px-2":"p-2 pt-3"),children:n.jsx(fi,{listKey:`${g??""}-${se}`,rawSections:K,sections:be,meta:l,decofile:c,selectedIndex:d,onSelect:Na,onReorder:Aa,onDelete:Ma,onDuplicate:Pa,onMakeReusable:je,onToggleHidden:Ca,onToggleLazy:Da,onAddVariant:Ht,onDetach:Ka,onAddSection:()=>ve(!0),canAddSection:an})}),uo=n.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[g&&te&&n.jsx(In,{pageKey:g,initialName:te.name,initialPath:te.path,onFieldChange:Zs}),Ot&&g?n.jsx(sa,{rawSeo:es,innerSeo:Ss,defaultResolveType:Js,seoSchema:Ys,activeResolveType:ts,seoTypeOptions:Us,formResetKey:$s,siteDefaultSeo:Qs,onBreadcrumbChange:jt,onPersistRaw:Nn,onInnerChange:Tn,onClearForm:An,onBumpFormKey:Mn}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),mo=n.jsx(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Ot&&g?n.jsx(sa,{rawSeo:es,innerSeo:Ss,defaultResolveType:Js,seoSchema:Ys,activeResolveType:ts,seoTypeOptions:Us,formResetKey:$s,siteDefaultSeo:Qs,onBreadcrumbChange:jt,onPersistRaw:Nn,onInnerChange:Tn,onClearForm:An,onBumpFormKey:Mn}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),fo=n.jsxs(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[et&&g&&n.jsx(On,{listKey:g,variants:de,activeIndex:se,decofile:c??{},meta:l,matchers:Ct,onSelect:Vs,onReorder:En,onRename:ne,onDuplicate:wn,onDelete:kn,onAdd:Gt}),et&&le!==null&&n.jsxs("div",{className:oe("px-3 border-b",ye?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>$e(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":ye,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r("sectionsEditor.sectionsEditor.variantRule")}),ye?n.jsx(nr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(ar,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),ye&&n.jsx("div",{className:oe("space-y-3",Nt&&"pointer-events-none opacity-50"),children:n.jsx(As,{currentRt:le,currentLabel:Ut(Ge?.rule,c??{},lt,l??void 0),currentGlobalKey:bt(Ge?.rule,c??{},l??void 0)??void 0,matchers:Ct,globals:Es,onSelect:ln,onSelectGlobal:un,schema:on,formValue:Le,onChange:cn,formKey:`${se}:${le??""}`,formWrapperClassName:"space-y-3",meta:l??void 0,decofile:c,onSaveReferencedBlock:It,sandbox:$t})})]}),Dn]},"editor-section-list");return n.jsx(Uo,{children:n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!G&&Ns&&n.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:Ns}),(G||as.length>1)&&n.jsx(Jo,{crumbs:as,onSelect:Ts,onSelectRoot:()=>{Xt.flush(),Ke?Ke():Ts(0)}}),n.jsx("div",{className:"shrink-0",children:G?n.jsxs("div",{className:oe("flex items-center gap-2 border-b px-3 py-2.5",Qe&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[G&&Ns,Qe&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(ms,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(dt,{side:"bottom",className:"max-w-[260px]",children:r("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[n.jsx("span",{className:"truncate text-sm font-semibold",children:Za}),jn&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:jn})]}),Rs&&et&&Ge&&n.jsx($n,{variants:de,activeIndex:se,onSelect:Vs,onManage:ro,onRemoveAll:to}),Qa&&n.jsx($n,{variants:ht,activeIndex:ss,onSelect:tn,onManage:io,onRemoveAll:sn}),Rs&&!et&&n.jsx(is,{onClick:Gt}),Ya&&n.jsx(is,{onClick:()=>Ht()}),n.jsx(Yo,{}),Rs&&n.jsxs(n.Fragment,{children:[n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"outline",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:oo,children:n.jsx(Wn,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.editSeo")})]}),!Be&&n.jsxs(ct,{children:[n.jsx(ut,{asChild:!0,children:n.jsx(Vt,{type:"button",variant:"outline",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>Ee(!0),children:n.jsx(Un,{size:14})})}),n.jsx(dt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):lo}),Ce?n.jsx(Hn,{onAdd:()=>Ht(),children:Cn},"editor-section-variants"):vt?n.jsxs(Bt,{viewportRef:ce,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!G&&gt&&ht.length>0&&B.length===0&&Cn,n.jsx(Gn,{activeSchema:_s,formValue:We,formResetKey:Re,onFormChange:Xs,onBreadcrumbChange:A,breadcrumbPath:B,emptyMessage:r("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:l,decofile:c,onSaveReferencedBlock:It,sandbox:$t,previewBaseUrl:_e,onRequestAddSection:en,onVariantMatcherOp:Q?ao:void 0})]},"editor-section-form"):Q?n.jsx(Bt,{viewportRef:ce,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(Gn,{activeSchema:_s,formValue:We,formResetKey:Re,onFormChange:Xs,onBreadcrumbChange:A,breadcrumbPath:B,emptyMessage:r("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:l,decofile:c,onSaveReferencedBlock:It,sandbox:$t,previewBaseUrl:_e,onRequestAddSection:en})},"editor-global-block"):D?G?n.jsx(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3",children:uo})},"editor-seo"):mo:P?n.jsx(Hn,{onAdd:Gt,children:co},"editor-variants"):G?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx(Bt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"py-2",children:Dn})}),n.jsx("div",{className:"shrink-0 border-t p-2",children:n.jsx(Fs,{canAddSection:an,onAddSection:()=>ve(!0)})})]},"editor-section-list"):fo,n.jsx(Qo,{open:ue!==null,onOpenChange:t=>{t||je(null)},defaultBlockId:ue!==null?cs(be[ue]?.label??""):"",isPending:Y.isPending,onSubmit:za}),_e&&n.jsx(Yr,{open:Pe,onOpenChange:t=>{ve(t),t||(Se.current=null)},meta:l,decofile:c,previewBaseUrl:_e,onSelect:La}),Ve&&g&&c&&n.jsx(cr,{open:Ve,onOpenChange:Ee,pageKey:g,decofile:c}),pe!==null&&n.jsx(qn,{open:!0,initialName:Rt(de[pe]?.rule,c??{},l??void 0)?Ut(de[pe]?.rule,c??{},lt,l??void 0):"",autoLabel:lt(Ps(de[pe]?.rule,c??{},l??void 0)),isPending:Nt,onSubmit:async t=>{await so(pe,t)},onOpenChange:t=>{!t&&!Nt&&ne(null)}}),he!==null&&n.jsx(qn,{open:!0,initialName:Rt(ht[he]?.rule,c??{},l??void 0)?Ut(ht[he]?.rule,c??{},lt,l??void 0):"",autoLabel:lt(Ps(ht[he]?.rule,c??{},l??void 0)),isPending:Nt,onSubmit:async t=>{await no(he,t)},onOpenChange:t=>{!t&&!Nt&&ae(null)}})]})})}export{Bc as SectionsEditor};