decocms 4.584.16 → 4.586.0

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 (447) hide show
  1. package/dist/client/assets/{AlertCircle-ee1sjQGr.js → AlertCircle-CGZfuvxJ.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CNSKfZ8O.js → AreaChart-DXqVsicd.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-BhV4BHrM.js → ArrowLeft-XURGfwpG.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-3kziivNC.js → ArrowRight-ZoKxZa45.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DgFMMMBQ.js → ArrowUp-DJZ55cl-.js} +1 -1
  6. package/dist/client/assets/{BookOpen01-C9X5S-cQ.js → BookOpen01-gO5hgFUK.js} +1 -1
  7. package/dist/client/assets/{CartesianChart-DuA35Ksh.js → CartesianChart-B0LNjIyx.js} +1 -1
  8. package/dist/client/assets/{CategoricalChart-cy5wvzih.js → CategoricalChart-CmAKQrAh.js} +1 -1
  9. package/dist/client/assets/{CheckCircle-CGqAjggj.js → CheckCircle-CmN8U1V5.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-CGJhfuSb.js → ChevronDown-ClblfTVV.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-5-TBPpUz.js → ChevronSelectorVertical-YxAp9GGa.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-BO9DemUb.js → ChevronUp-0ZCAxpBW.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-BLkqiDJW.js → CreditCard01-CcTQ1h3_.js} +1 -1
  14. package/dist/client/assets/{Eye-CO_nPZKQ.js → Eye-D5j_svLn.js} +1 -1
  15. package/dist/client/assets/{File02-DclovfNb.js → File02-Cs751Kds.js} +1 -1
  16. package/dist/client/assets/{Globe04-Cx-w92u5.js → Globe04-DO1uUwfE.js} +1 -1
  17. package/dist/client/assets/{Image01-CeQMNu9o.js → Image01-CJL4B_rR.js} +1 -1
  18. package/dist/client/assets/{Key01-DMjKHzPy.js → Key01-fuHivqLl.js} +1 -1
  19. package/dist/client/assets/{LayoutLeft-BPF5UUkD.js → LayoutLeft-CCeum9wV.js} +1 -1
  20. package/dist/client/assets/{LinkBroken01-BN3icH6a.js → LinkBroken01-cq4srxHs.js} +1 -1
  21. package/dist/client/assets/{MessageCircle01-jm5EAYEs.js → MessageCircle01-Bf6dD94_.js} +1 -1
  22. package/dist/client/assets/{Minus-DoUm1n95.js → Minus-Cc21R1KY.js} +1 -1
  23. package/dist/client/assets/{Monitor01-CM0DIJ9E.js → Monitor01-DGdgEYxG.js} +1 -1
  24. package/dist/client/assets/{Play-I05hjYId.js → Play-zYFs_vGL.js} +1 -1
  25. package/dist/client/assets/{Plus-B_KK3A4P.js → Plus--DcN-eh1.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-DxKvZdt8.js → ReferenceLine-D6M1JZR1.js} +1 -1
  27. package/dist/client/assets/{SearchMd-BlPJmXQo.js → SearchMd-BwYuN52e.js} +1 -1
  28. package/dist/client/assets/{ShoppingBag01-XH61oInk.js → ShoppingBag01-D-gmqcz7.js} +1 -1
  29. package/dist/client/assets/{Sun-CYr05wwt.js → Sun-D9ql5ZlI.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-CGFn_psg.js → SwitchHorizontal01-BQF84Li3.js} +1 -1
  31. package/dist/client/assets/{Tool01-Cnkd4pP7.js → Tool01-BeDQSGiN.js} +1 -1
  32. package/dist/client/assets/{Tooltip-CwwzGu8p.js → Tooltip-C_RHysFo.js} +1 -1
  33. package/dist/client/assets/{Trash01-CnPGIwZe.js → Trash01-BmQrADz0.js} +1 -1
  34. package/dist/client/assets/{TrendUp01-BlwMDcra.js → TrendUp01-_SFSHjzO.js} +1 -1
  35. package/dist/client/assets/{Upload01-Bfre-QV-.js → Upload01-DOfZqxci.js} +1 -1
  36. package/dist/client/assets/{UserCheck01-CcIH7s2N.js → UserCheck01-BMoOFYIZ.js} +1 -1
  37. package/dist/client/assets/{UserSquare-CUb4s2-c.js → UserSquare-Dn1UPzSD.js} +1 -1
  38. package/dist/client/assets/{Users01-BaPkNO1v.js → Users01-B_yoWxPn.js} +1 -1
  39. package/dist/client/assets/{XClose-CtxnajtG.js → XClose-C4MsAn9v.js} +1 -1
  40. package/dist/client/assets/{Zap-D4dSEKpa.js → Zap-DoxB0q6B.js} +1 -1
  41. package/dist/client/assets/{access-gate-BcSivdgh.js → access-gate-DQ55JjgP.js} +1 -1
  42. package/dist/client/assets/{add-connection-dialog-BqEJyMSP.js → add-connection-dialog-D0PlxcOk.js} +1 -1
  43. package/dist/client/assets/agent-app-Ch0m8w-u.js +1 -0
  44. package/dist/client/assets/agent-assets-COp9WevM.js +1 -0
  45. package/dist/client/assets/{agent-automation-CJwwEuNT.js → agent-automation-DRfIHgf4.js} +3 -3
  46. package/dist/client/assets/{agent-automations-CQfQpku1.js → agent-automations-C02SU72h.js} +1 -1
  47. package/dist/client/assets/{agent-blog-post-B9pgUtDH.js → agent-blog-post-BOz0k9l4.js} +2 -2
  48. package/dist/client/assets/agent-blog-yxvdX-jE.js +2 -0
  49. package/dist/client/assets/{agent-calendar-JLP2GBTa.js → agent-calendar-BrjcVSaH.js} +1 -1
  50. package/dist/client/assets/{agent-capabilities-CYFGwKOQ.js → agent-capabilities-Dh06TMfs.js} +1 -1
  51. package/dist/client/assets/{agent-connect-sources-DDUrjmJD.js → agent-connect-sources-DhRc2-S_.js} +1 -1
  52. package/dist/client/assets/agent-deck-BEYLEOzY.js +1 -0
  53. package/dist/client/assets/{agent-e2e-R2Brb1AY.js → agent-e2e-w331hEXE.js} +1 -1
  54. package/dist/client/assets/agent-experiments-CIRveYjB.js +1 -0
  55. package/dist/client/assets/agent-file-CRD-Yf8v.js +1 -0
  56. package/dist/client/assets/{agent-hosting-ZtddB8HN.js → agent-hosting-Cf_5DVCs.js} +1 -1
  57. package/dist/client/assets/{agent-icon-DFyNTmmD.js → agent-icon-DwJHakBB.js} +1 -1
  58. package/dist/client/assets/agent-library-BDbVLVqf.js +1 -0
  59. package/dist/client/assets/agent-library-file-FdEtCyvQ.js +1 -0
  60. package/dist/client/assets/agent-overview-90jCAnhT.js +1 -0
  61. package/dist/client/assets/agent-releases-CQDLHf-9.js +2 -0
  62. package/dist/client/assets/agent-settings-DazJIQdd.js +1 -0
  63. package/dist/client/assets/{agent-site-editor-Du4ljJT4.js → agent-site-editor-Bn_zysVp.js} +1 -1
  64. package/dist/client/assets/agent-site-editor-code-AxRnYsCW.js +2 -0
  65. package/dist/client/assets/agent-site-editor-content-Css28lBT.js +1 -0
  66. package/dist/client/assets/agent-site-editor-preview-rUOwwi2z.js +1 -0
  67. package/dist/client/assets/agent-view-BwA2SWmb.js +1 -0
  68. package/dist/client/assets/{agent-view-guard-BkW43e8G.js → agent-view-guard-_UB25wdA.js} +1 -1
  69. package/dist/client/assets/{ai-providers-B2F4VTfq.js → ai-providers-BZmTFJ6J.js} +1 -1
  70. package/dist/client/assets/{alert-DaQbIayT.js → alert-Dl9RecsO.js} +1 -1
  71. package/dist/client/assets/{analytics-sections-CDIiyHbJ.js → analytics-sections-ChR-yKgZ.js} +1 -1
  72. package/dist/client/assets/api-keys-7ijHuhZV.js +1 -0
  73. package/dist/client/assets/{api-keys-DV2qjs1c.js → api-keys-BAKKjcCM.js} +1 -1
  74. package/dist/client/assets/{app-editor-CsjRVENv.js → app-editor-aGjbireC.js} +1 -1
  75. package/dist/client/assets/asset-utils-C40qdOgS.js +1 -0
  76. package/dist/client/assets/{auth-sBxX13D1.js → auth-DuSLyK-k.js} +1 -1
  77. package/dist/client/assets/{auth-catchall-C4NbHq82.js → auth-catchall-CwzGmsez.js} +1 -1
  78. package/dist/client/assets/auth-entry-QpiCG8Kt.js +1 -0
  79. package/dist/client/assets/{auth-split-layout-DFVyplfm.js → auth-split-layout-D0SngsR5.js} +1 -1
  80. package/dist/client/assets/{authenticate-and-persist-oauth-Cd-20mVj.js → authenticate-and-persist-oauth-BrPxKw11.js} +1 -1
  81. package/dist/client/assets/{automation-list-row-DIz_7uV6.js → automation-list-row-C_0woHJW.js} +1 -1
  82. package/dist/client/assets/{automation-runs-U9DXMN_I.js → automation-runs-DwwK7nJ3.js} +1 -1
  83. package/dist/client/assets/{automations-DLrTFxh8.js → automations-Dc36NZHt.js} +1 -1
  84. package/dist/client/assets/{badge-Ba_DCLD5.js → badge-BvHOfdxU.js} +1 -1
  85. package/dist/client/assets/{block-document-Aq3OAP33.js → block-document-CGK32I9G.js} +1 -1
  86. package/dist/client/assets/{blocks-preview-workspace-context-1Hmusp23.js → blocks-preview-workspace-context-CN-ldvuU.js} +1 -1
  87. package/dist/client/assets/{blocks-tab-states-0NdQhV1f.js → blocks-tab-states-DxLq1BL5.js} +1 -1
  88. package/dist/client/assets/{blog-preview-url-Dih-dMCw.js → blog-preview-url-cX5z_9aO.js} +1 -1
  89. package/dist/client/assets/{blog-schema-CYnX2CMq.js → blog-schema-CTE9utzf.js} +1 -1
  90. package/dist/client/assets/{blog-source-gate-CWWyUoRi.js → blog-source-gate-DWHD3Df5.js} +1 -1
  91. package/dist/client/assets/{blog-view-gate-oE1gHZMz.js → blog-view-gate-DT-8hHxE.js} +1 -1
  92. package/dist/client/assets/{buckets-Bh4QpekX.js → buckets-DMt9Xchk.js} +1 -1
  93. package/dist/client/assets/{build-improve-prompt-doc-CPww4N3Z.js → build-improve-prompt-doc-D0Nbi1s7.js} +1 -1
  94. package/dist/client/assets/{calendar-i6vH9oRA.js → calendar-BUgmhSfk.js} +1 -1
  95. package/dist/client/assets/{capability-load-error-LShIU80A.js → capability-load-error-DCoklIp8.js} +1 -1
  96. package/dist/client/assets/{category-editor-BLagxgQw.js → category-editor-B7D8BVkO.js} +1 -1
  97. package/dist/client/assets/{category-tree-CO_9m-hw.js → category-tree-BeXLYa5S.js} +1 -1
  98. package/dist/client/assets/{chart-C99PxQ8i.js → chart-DfTUTOGH.js} +1 -1
  99. package/dist/client/assets/{chat-context-ZeSpVj2j.js → chat-context-DG5tQFfU.js} +1 -1
  100. package/dist/client/assets/{chat-draft-DixXhuAl.js → chat-draft-Bv2iw9Fr.js} +1 -1
  101. package/dist/client/assets/{checkbox-yHZpOTt9.js → checkbox-DAnVkT6Q.js} +1 -1
  102. package/dist/client/assets/{choose-editor-Ow8vFSp1.js → choose-editor-DX9vd71s.js} +1 -1
  103. package/dist/client/assets/{cli-auth-success-DRGrIbSu.js → cli-auth-success-CY4cK7Ok.js} +1 -1
  104. package/dist/client/assets/{cms-settings-editor-D6qGypvL.js → cms-settings-editor-Cj7WfazE.js} +1 -1
  105. package/dist/client/assets/{cms-store-drafts-CLXsr0b9.js → cms-store-drafts-BDhAH5vV.js} +1 -1
  106. package/dist/client/assets/{collapsible-Dc4ca33I.js → collapsible-DifRD2Ww.js} +1 -1
  107. package/dist/client/assets/{collection-detail-D2do5Te9.js → collection-detail-Bq38QGfT.js} +1 -1
  108. package/dist/client/assets/{collection-display-button-R9esRwsq.js → collection-display-button-nfEDIRuH.js} +1 -1
  109. package/dist/client/assets/{collection-search-CWJ6AHHK.js → collection-search-RWM-9f07.js} +1 -1
  110. package/dist/client/assets/{collection-table-wrapper-D1qYH_Vr.js → collection-table-wrapper-DVjGjn7R.js} +1 -1
  111. package/dist/client/assets/{collection-tabs-CCJoVQ-t.js → collection-tabs-BkmY1xp_.js} +1 -1
  112. package/dist/client/assets/{combobox-Cc5RijV8.js → combobox-D7DiHBHL.js} +1 -1
  113. package/dist/client/assets/{command-Dg1M4JCf.js → command-DHGFzOhP.js} +1 -1
  114. package/dist/client/assets/{companion-mcps-section-DWH_OPav.js → companion-mcps-section-D7d32LFm.js} +1 -1
  115. package/dist/client/assets/{config-CMcG5aXE.js → config-dB-x76iz.js} +1 -1
  116. package/dist/client/assets/{connect-DTJ8Lb0Z.js → connect-D-G-5Mck.js} +3 -3
  117. package/dist/client/assets/{connect-key-DwcLwXDe.js → connect-key-DYxzA5cq.js} +1 -1
  118. package/dist/client/assets/{connect-layout-B9Ri51_N.js → connect-layout-vX9TenPs.js} +1 -1
  119. package/dist/client/assets/{connect-source-dialog-DFoGY0c6.js → connect-source-dialog-hJXgVRU-.js} +1 -1
  120. package/dist/client/assets/{connection-D2P4B1Vm.js → connection-CeuJqjaI.js} +1 -1
  121. package/dist/client/assets/{connection-card-CTimlD0g.js → connection-card-bC9jkQR3.js} +1 -1
  122. package/dist/client/assets/{connection-detail-CLq96SZi.js → connection-detail-BZxu1Il4.js} +1 -1
  123. package/dist/client/assets/{connection-form-helpers-C0MTL33k.js → connection-form-helpers-BVK3iXej.js} +1 -1
  124. package/dist/client/assets/{connection-slug-CGQkx9BD.js → connection-slug-BofuMVWL.js} +1 -1
  125. package/dist/client/assets/{connections-Blix3sTM.js → connections-_2oGT26C.js} +1 -1
  126. package/dist/client/assets/{content-tab-DksWOtkz.js → content-tab-B2YwxmJz.js} +3 -3
  127. package/dist/client/assets/{context-UEmVvZBl.js → context-RVZVsnak.js} +1 -1
  128. package/dist/client/assets/{context-menu-77Z4mScR.js → context-menu-BgKzmvfA.js} +1 -1
  129. package/dist/client/assets/{context-shell-n2LQX250.js → context-shell-Bnnp_FlP.js} +5 -5
  130. package/dist/client/assets/{create-organization-dialog-5XUNCI8z.js → create-organization-dialog-BeGGdtfc.js} +1 -1
  131. package/dist/client/assets/{daily-pulse-B11Ng0jZ.js → daily-pulse-D8S4f077.js} +1 -1
  132. package/dist/client/assets/{delete-copy-B5PbKStF.js → delete-copy-C7-0DCkQ.js} +1 -1
  133. package/dist/client/assets/{device-hint-BlkEtJOD.js → device-hint-B6fw2qhI.js} +1 -1
  134. package/dist/client/assets/{discover-76bH9Npb.js → discover-BhyJuEKB.js} +1 -1
  135. package/dist/client/assets/{domain-settings-DMjKDVZw.js → domain-settings-DWaq5CPi.js} +1 -1
  136. package/dist/client/assets/{drawer-DVCuatiz.js → drawer-BXd80xtd.js} +1 -1
  137. package/dist/client/assets/{editor-DKlObXWN.js → editor-DNZ-WgCS.js} +1 -1
  138. package/dist/client/assets/{editor-classes-DlTZqfff.js → editor-classes-CzejjvgI.js} +1 -1
  139. package/dist/client/assets/{empty-message-BydjGtkz.js → empty-message-DVICFi26.js} +2 -2
  140. package/dist/client/assets/{empty-state-B87jIRUF.js → empty-state-BK8GboWz.js} +1 -1
  141. package/dist/client/assets/{empty-state-DrDY2Uvy.js → empty-state-LbEOn0Mj.js} +1 -1
  142. package/dist/client/assets/{experiments-tab-choice-B92_kGiq.js → experiments-tab-choice-DYGF6IS1.js} +1 -1
  143. package/dist/client/assets/{extract-connection-data-BBZ3NAYt.js → extract-connection-data-B1FMXoXK.js} +1 -1
  144. package/dist/client/assets/{feature-gate-BldXfjSV.js → feature-gate-XyzkzO9l.js} +1 -1
  145. package/dist/client/assets/{feature-paywall-CYTrb2Hp.js → feature-paywall-DQF2iJDP.js} +1 -1
  146. package/dist/client/assets/{file-explorer-BMmUp2yA.js → file-explorer-DbKxpql5.js} +1 -1
  147. package/dist/client/assets/{file-preview-DGOqiP3N.js → file-preview-A0GfMNED.js} +1 -1
  148. package/dist/client/assets/{file-share-button-BAKT8NFv.js → file-share-button-pVEpOvSY.js} +2 -2
  149. package/dist/client/assets/{file-type-icon-sj_ejObJ.js → file-type-icon-CSrE_noX.js} +1 -1
  150. package/dist/client/assets/{folder-icon-B9awY_eB.js → folder-icon-CA298KqN.js} +1 -1
  151. package/dist/client/assets/{form-FAPXIq7O.js → form-Cxhh0mxt.js} +1 -1
  152. package/dist/client/assets/{frame-navigation-CoYMhBUE.js → frame-navigation--4kFXAAS.js} +1 -1
  153. package/dist/client/assets/{gateway-client-BVWghiMF.js → gateway-client-PdaGLWBA.js} +1 -1
  154. package/dist/client/assets/{general-DMcbEh6R.js → general-CuKnI3HJ.js} +1 -1
  155. package/dist/client/assets/{github-icon-KEAtk4MX.js → github-icon-h_xg-qFR.js} +1 -1
  156. package/dist/client/assets/{held-block-view-DDQtd2bN.js → held-block-view-zi4CM-KX.js} +1 -1
  157. package/dist/client/assets/{home-overview-DJ3gY2Dz.js → home-overview-DrWyW-2I.js} +1 -1
  158. package/dist/client/assets/{home-BemwUTPY.js → home-w1KhoL46.js} +1 -1
  159. package/dist/client/assets/{hosted-reconcile-DVbA9MCD.js → hosted-reconcile-uX15ZUhb.js} +1 -1
  160. package/dist/client/assets/{icon-button-DmJB3HO5.js → icon-button-DzpdeaSs.js} +1 -1
  161. package/dist/client/assets/{index-CSZLbM2Z.js → index-3e8V4Do_.js} +1 -1
  162. package/dist/client/assets/{index-Bjhw4G6x.js → index-5KkkYmJi.js} +1 -1
  163. package/dist/client/assets/{index-CsHIpbTc.js → index-BK93qS26.js} +1 -1
  164. package/dist/client/assets/index-BYaF8G7R.js +1 -0
  165. package/dist/client/assets/{index-0S6WDYoC.js → index-Bld02Tnb.js} +1 -1
  166. package/dist/client/assets/{index-CER3O-Er.js → index-BpNyzjaQ.js} +1 -1
  167. package/dist/client/assets/{index-BRgWMc-5.js → index-BuZqAz74.js} +12 -12
  168. package/dist/client/assets/{index-779PVYGV.js → index-BwBEUlXI.js} +1 -1
  169. package/dist/client/assets/{index-DAQFQP6X.js → index-CZTrNcsP.js} +1 -1
  170. package/dist/client/assets/{index-YHYnj2N1.js → index-C_n-5x2E.js} +1 -1
  171. package/dist/client/assets/{index-3k_nlNc7.js → index-DNuvhcDO.js} +1 -1
  172. package/dist/client/assets/{index-CV9lAciS.js → index-DUn-LHzT.js} +2 -2
  173. package/dist/client/assets/{index-BiVCuU3V.js → index-DsWqYG3w.js} +1 -1
  174. package/dist/client/assets/{index-EBRxzWbP.js → index-SIZschZt.js} +1 -1
  175. package/dist/client/assets/{index-CEBVkeBV.js → index-SPj0mL-J.js} +1 -1
  176. package/dist/client/assets/index-_-faNWQZ.css +1 -0
  177. package/dist/client/assets/index-ba5Vf9vt.js +1 -0
  178. package/dist/client/assets/{index-redirect-DLAKhZQB.js → index-redirect-DlIbuGOg.js} +1 -1
  179. package/dist/client/assets/{index-CH8HRuHa.js → index-rt88hTRg.js} +1 -1
  180. package/dist/client/assets/{infiniteQueryObserver-DXDiLGwX.js → infiniteQueryObserver-CHN_AvWa.js} +1 -1
  181. package/dist/client/assets/{infra-billing-Ch38HLtg.js → infra-billing-DHY4EnRE.js} +1 -1
  182. package/dist/client/assets/{input-CCPCHy_J.js → input--XeG2v6T.js} +1 -1
  183. package/dist/client/assets/{input-Do8NvE59.js → input-c6Cx2liY.js} +4 -4
  184. package/dist/client/assets/{integration-icon-Cu3N1muw.js → integration-icon-D7fga3kk.js} +1 -1
  185. package/dist/client/assets/{item-actions-C0r-FbzQ.js → item-actions-Dld5lBtQ.js} +1 -1
  186. package/dist/client/assets/{jira-icon-D0RV1z5x.js → jira-icon-_W0tffOR.js} +1 -1
  187. package/dist/client/assets/{label-DJG2lJG2.js → label-Dm_T3WyF.js} +1 -1
  188. package/dist/client/assets/{layout-ChdcSvGo.js → layout-DhN3YXX3.js} +1 -1
  189. package/dist/client/assets/{legacy-admin-welcome-dialog-BY_2I8tZ.js → legacy-admin-welcome-dialog-C0w-pw6s.js} +1 -1
  190. package/dist/client/assets/legacy-agents-deep-ab_jOs-e.js +1 -0
  191. package/dist/client/assets/{legacy-main-redirect-D850qNA8.js → legacy-main-redirect-ByIcJoSw.js} +1 -1
  192. package/dist/client/assets/library-LpeL-fNK.js +1 -0
  193. package/dist/client/assets/{library-tab-D8k_wDzC.js → library-tab-Cui4e0pM.js} +1 -1
  194. package/dist/client/assets/{login-C5GNgjpJ.js → login-COwI3GAk.js} +1 -1
  195. package/dist/client/assets/{markdown-DPpPArEp.js → markdown-CwYBGb1B.js} +1 -1
  196. package/dist/client/assets/{mcp-app-renderer-D-1Hpjx-.js → mcp-app-renderer-CLuYD3rD.js} +2 -2
  197. package/dist/client/assets/{mcp-oauth-DMi3oCsH.js → mcp-oauth-DZ8B5A_7.js} +1 -1
  198. package/dist/client/assets/{mcp-oauth-DAw9xmxO.js → mcp-oauth-i1ZYjV6U.js} +1 -1
  199. package/dist/client/assets/{members-laM8OLrZ.js → members-CvbIQPwh.js} +1 -1
  200. package/dist/client/assets/{memory-DAAWauU_.js → memory-BhMXHewc.js} +2 -2
  201. package/dist/client/assets/{mock-board-DVLeWzDj.js → mock-board-DN7OLcTA.js} +3 -3
  202. package/dist/client/assets/{monaco-editor-BHpOPihN.js → monaco-editor-CTONBla7.js} +1 -1
  203. package/dist/client/assets/{monitoring-D3l_Jm2m.js → monitoring-DPSQDGbL.js} +1 -1
  204. package/dist/client/assets/{monitoring-stats-row-Ri6ispwa.js → monitoring-stats-row-BUZplGDl.js} +1 -1
  205. package/dist/client/assets/{multi-select-8e4MeokI.js → multi-select-BSuPEET4.js} +1 -1
  206. package/dist/client/assets/{mustache-DnvmVEAI.js → mustache-C50JF2sQ.js} +1 -1
  207. package/dist/client/assets/{named-rule-step-WtjJX5Mv.js → named-rule-step-D8j_NuRK.js} +1 -1
  208. package/dist/client/assets/{named-rule-view-DZ8Gl6w8.js → named-rule-view-D9U19iHq.js} +1 -1
  209. package/dist/client/assets/{new-project-dialog-DEBFbTK4.js → new-project-dialog-Bq2YhVDS.js} +1 -1
  210. package/dist/client/assets/{new-project-store-CgLzwcjn.js → new-project-store-C82itd6a.js} +1 -1
  211. package/dist/client/assets/{oauth-callback-ai-provider-CcAwHHuH.js → oauth-callback-ai-provider-Dph1UX9E.js} +1 -1
  212. package/dist/client/assets/{oauth-callback--6BD_yzu.js → oauth-callback-xH1_0Q9p.js} +1 -1
  213. package/dist/client/assets/{oauth-consent-DU2TXlly.js → oauth-consent-BJ9Jn7G7.js} +1 -1
  214. package/dist/client/assets/{onboarding-CA0lTQst.js → onboarding-tM_LYdg0.js} +1 -1
  215. package/dist/client/assets/{openai-conversation-kPp7_oUZ.js → openai-conversation-DoQ_2Seq.js} +2 -2
  216. package/dist/client/assets/{optimistic-project-sidebar-views-C9pyPAzF.js → optimistic-project-sidebar-views-TOzwQjCp.js} +1 -1
  217. package/dist/client/assets/{order-monitor-day-xeVDnHLL.js → order-monitor-day-BqegE0N0.js} +1 -1
  218. package/dist/client/assets/{organization-choice-CKU82eUy.js → organization-choice-BzjQ0aL1.js} +1 -1
  219. package/dist/client/assets/{orgs-a8ldZbiZ.js → orgs-WruSV9A-.js} +1 -1
  220. package/dist/client/assets/{own-accounts-section-DhFCn8gz.js → own-accounts-section-TMVLN8mQ.js} +1 -1
  221. package/dist/client/assets/{pair-C-KXBar9.js → pair-BYbJa99U.js} +10 -10
  222. package/dist/client/assets/{parse-sections-DPGRvqbM.js → parse-sections-CVDx-uBN.js} +3 -3
  223. package/dist/client/assets/{plan-D6JDzYbv.js → plan-DDx2VxJ0.js} +1 -1
  224. package/dist/client/assets/{plan-ladder-DuXPk4c4.js → plan-ladder-Ce2vSjaL.js} +1 -1
  225. package/dist/client/assets/{plan-usage-card-BdC1KTye.js → plan-usage-card-CvxOK5ad.js} +2 -2
  226. package/dist/client/assets/{popover-DGvrj6fy.js → popover-D6EIL5sL.js} +1 -1
  227. package/dist/client/assets/{post-calendar-DKGqFmih.js → post-calendar-J6Cs6vQ8.js} +1 -1
  228. package/dist/client/assets/{post-editor-7oUWGzCY.js → post-editor-v1jKXm9-.js} +2 -2
  229. package/dist/client/assets/{preview-content-abo2ryKK.js → preview-content-9gQGJiFY.js} +1 -1
  230. package/dist/client/assets/{preview-dialog-CQi5mIZh.js → preview-dialog-J4DJmy9P.js} +1 -1
  231. package/dist/client/assets/{preview-panel-CjmJmEqS.js → preview-panel-DLe0RaXg.js} +1 -1
  232. package/dist/client/assets/{preview-tab-DA1SyRp5.js → preview-tab-BxZksZBr.js} +5 -5
  233. package/dist/client/assets/{product-picker-dialog-BXRcAQat.js → product-picker-dialog-DCC_2JmD.js} +1 -1
  234. package/dist/client/assets/{profile-DUghMPNx.js → profile-CU5pOHcx.js} +1 -1
  235. package/dist/client/assets/project-app-view-Chii7rIX.js +1 -0
  236. package/dist/client/assets/{project-apps-DiSx-TBF.js → project-apps-Dezyz6_N.js} +1 -1
  237. package/dist/client/assets/{project-icon-D6jtLreJ.js → project-icon-BHn6Xq54.js} +1 -1
  238. package/dist/client/assets/{project-index-pgEW44Q9.js → project-index-5c8GGatg.js} +1 -1
  239. package/dist/client/assets/project-reports-BhJG82JT.js +1 -0
  240. package/dist/client/assets/project-tasks-AXDig_Zb.js +1 -0
  241. package/dist/client/assets/{projects-CoL2Czss.js → projects-C19Wu8MK.js} +1 -1
  242. package/dist/client/assets/{projects-empty-state-dMAfSAvA.js → projects-empty-state-Dh0sHuPd.js} +1 -1
  243. package/dist/client/assets/{prompts-C1nJJ4vm.js → prompts-CYFmsiS6.js} +1 -1
  244. package/dist/client/assets/record-editor-D2NFDCNZ.js +1 -0
  245. package/dist/client/assets/{redirect-editor-v_Pws7YC.js → redirect-editor-D9WJKRVv.js} +1 -1
  246. package/dist/client/assets/reports-C-kEainI.js +1 -0
  247. package/dist/client/assets/{reports-DeRFKvgR.js → reports-Cj91Mylc.js} +2 -2
  248. package/dist/client/assets/reports-onboarding-gB4My80z.js +1 -0
  249. package/dist/client/assets/{reports-tab-DNq4qxR5.js → reports-tab-CsHbv07d.js} +2 -2
  250. package/dist/client/assets/{repositories-CshiRVJO.js → repositories-C_7l-hzO.js} +1 -1
  251. package/dist/client/assets/repositories-L_Jm13il.js +1 -0
  252. package/dist/client/assets/{repository-binding-Drae9jEJ.js → repository-binding-VVfcdUiy.js} +1 -1
  253. package/dist/client/assets/{repository-picker-DcoNDHNX.js → repository-picker-By75IHJa.js} +1 -1
  254. package/dist/client/assets/require-capability-DEShAaY8.js +1 -0
  255. package/dist/client/assets/{required-auth-layout-coJLhqjq.js → required-auth-layout-GSSn-bTA.js} +1 -1
  256. package/dist/client/assets/{reset-password-DmNJhZP_.js → reset-password-eGGPXuZQ.js} +1 -1
  257. package/dist/client/assets/{resizable-a5ed0aFn.js → resizable-XeFzd9pk.js} +1 -1
  258. package/dist/client/assets/{resolve-tab-icon-aSYnYRbW.js → resolve-tab-icon-DQMxOocF.js} +1 -1
  259. package/dist/client/assets/{review-settings-M_0Lgvos.js → review-settings-BOoUlwEx.js} +1 -1
  260. package/dist/client/assets/{role-color-B1bQbhLW.js → role-color-D-S7Ra1A.js} +1 -1
  261. package/dist/client/assets/{roles-Cfs4KbFC.js → roles-C8YQ1Aw2.js} +1 -1
  262. package/dist/client/assets/route-DjlZ9cbf.js +1 -0
  263. package/dist/client/assets/route-lr7i-nM3.js +1 -0
  264. package/dist/client/assets/{route-ln57uUdJ.js → route-ojZJTNbW.js} +1 -1
  265. package/dist/client/assets/{route-page-header-Dm04mhuj.js → route-page-header-BqA32d57.js} +1 -1
  266. package/dist/client/assets/{sandbox-git-api-CPqBqV0G.js → sandbox-git-api-CkSQDoxX.js} +1 -1
  267. package/dist/client/assets/{sandbox-lifecycle-context-PaxLnfD4.js → sandbox-lifecycle-context-BBz4IKVo.js} +1 -1
  268. package/dist/client/assets/{save-status-BXFvRkAL.js → save-status-CmYiPWXE.js} +1 -1
  269. package/dist/client/assets/{schema-DgI3qSqy.js → schema-B0biNpls.js} +1 -1
  270. package/dist/client/assets/{schema-BSbCYY9y.js → schema-CCpL_LVZ.js} +1 -1
  271. package/dist/client/assets/{scroll-area-B2d6jFzS.js → scroll-area-bkCFS0v8.js} +1 -1
  272. package/dist/client/assets/{search-input-XDrQYhil.js → search-input-C4sd-kKh.js} +1 -1
  273. package/dist/client/assets/{search-toggle-CBe-B-W_.js → search-toggle-rjC0c-Iy.js} +1 -1
  274. package/dist/client/assets/{secret-picker-6lDKLE0I.js → secret-picker-ujhqmuU6.js} +1 -1
  275. package/dist/client/assets/{secrets-mRfQ2zYn.js → secrets-CUx_W408.js} +1 -1
  276. package/dist/client/assets/{section-array-field-DRYut2dk.js → section-array-field-DOngDm8U.js} +1 -1
  277. package/dist/client/assets/{sections-2LOxZNGC.js → sections-DmtYqnPM.js} +1 -1
  278. package/dist/client/assets/{sections-editor-DSw0gf5K.js → sections-editor-DsX6y72K.js} +1 -1
  279. package/dist/client/assets/{select-B282Slsg.js → select-BkYZ4NYA.js} +1 -1
  280. package/dist/client/assets/{select-model-YSEeD0Az.js → select-model-BNVZsPuq.js} +1 -1
  281. package/dist/client/assets/{seo-editor-SlMH3Ndc.js → seo-editor-D-DOTzeP.js} +1 -1
  282. package/dist/client/assets/{separator-C2ELigwU.js → separator-DTKXzVmt.js} +1 -1
  283. package/dist/client/assets/{session-runtime-BH3ADRqu.js → session-runtime-HHtypsTM.js} +1 -1
  284. package/dist/client/assets/settings-tab-B50Sia1R.js +1 -0
  285. package/dist/client/assets/sheet-Lq2qXLx8.js +1 -0
  286. package/dist/client/assets/{shell-layout-2a3HocEU.js → shell-layout-rYoN4RTk.js} +1 -1
  287. package/dist/client/assets/{site-draft-actions-BNgtZ_kM.js → site-draft-actions-D72ZWrGI.js} +5 -5
  288. package/dist/client/assets/{site-draft-view-59J3TeYY.js → site-draft-view-DdS4HrBp.js} +1 -1
  289. package/dist/client/assets/site-editor-B6Bvzk4_.js +1 -0
  290. package/dist/client/assets/{site-editor-toast-CkAw1Cwp.js → site-editor-toast-aupfR4Aq.js} +1 -1
  291. package/dist/client/assets/{skills-BzPEtrNZ.js → skills-Cyx-LBzb.js} +1 -1
  292. package/dist/client/assets/{slider-wN_aQalr.js → slider-B4bXP1H_.js} +1 -1
  293. package/dist/client/assets/{sortable.esm-DPJjIjEU.js → sortable.esm-n9zdQXyB.js} +1 -1
  294. package/dist/client/assets/{sso-Bs5CI3h8.js → sso-DIU8j1zk.js} +1 -1
  295. package/dist/client/assets/{suggestion-DWkqugbN.js → suggestion-Nntdxi5T.js} +2 -2
  296. package/dist/client/assets/{super-agent-icon-D0WeAH15.js → super-agent-icon-DHSnZQuw.js} +1 -1
  297. package/dist/client/assets/switch-COjzxQ39.js +1 -0
  298. package/dist/client/assets/synced-repos-s5ovH7Qr.js +1 -0
  299. package/dist/client/assets/{tab-icon-glyph-CNySjp_I.js → tab-icon-glyph-CvvfUXQl.js} +1 -1
  300. package/dist/client/assets/{table-C9du40XO.js → table-DQIAY6r-.js} +1 -1
  301. package/dist/client/assets/{tabs-D6Pnw7es.js → tabs-CbfCGlFS.js} +1 -1
  302. package/dist/client/assets/{task-board-CZErK_3f.js → task-board-DEUSGytR.js} +1 -1
  303. package/dist/client/assets/{task-key-BWUT6sLU.js → task-key-DaPOId6s.js} +1 -1
  304. package/dist/client/assets/{task-route-CGCjMBBZ.js → task-route-BJj40Yza.js} +1 -1
  305. package/dist/client/assets/{task-status-DdY5hqAG.js → task-status-B6WfZxUN.js} +1 -1
  306. package/dist/client/assets/{taskboard-analytics-BUGSR3Oh.js → taskboard-analytics-UnAzvxoh.js} +1 -1
  307. package/dist/client/assets/tasks-BtIOVSMQ.js +1 -0
  308. package/dist/client/assets/{tasks-Cn9XhG4H.js → tasks-vny6IFm0.js} +3 -3
  309. package/dist/client/assets/{textarea-shjcg83Q.js → textarea-CcO-rfag.js} +1 -1
  310. package/dist/client/assets/{thread-analytics-nP1khI2z.js → thread-analytics-BUAtXNjP.js} +1 -1
  311. package/dist/client/assets/{thread-button-BT5IYGed.js → thread-button-DbVaWztE.js} +1 -1
  312. package/dist/client/assets/{thread-intent-MQDkwS2K.js → thread-intent-CyH0Z8_7.js} +4 -4
  313. package/dist/client/assets/{thread-route-CwpmRNHh.js → thread-route-BjDCYf6b.js} +1 -1
  314. package/dist/client/assets/{thread-route-C18glt36.js → thread-route-Dw1cQjON.js} +1 -1
  315. package/dist/client/assets/{thread-sheet-body-BY8zn-2X.js → thread-sheet-body-C6XCaB8H.js} +1 -1
  316. package/dist/client/assets/{time-range-picker-BcBC6ty0.js → time-range-picker-C45MZ0gR.js} +1 -1
  317. package/dist/client/assets/{toggle-group-BnrXGKKY.js → toggle-group-DFyE84bx.js} +1 -1
  318. package/dist/client/assets/{tool-set-selector-DUOMDF3r.js → tool-set-selector-BgHdncVU.js} +1 -1
  319. package/dist/client/assets/{toolbar-icon-button-2ueMvkvI.js → toolbar-icon-button-BroRQfDx.js} +1 -1
  320. package/dist/client/assets/{tooltip-DgFM5mQB.js → tooltip-DnGqcvtu.js} +1 -1
  321. package/dist/client/assets/{tooltipContext-BvjdDC28.js → tooltipContext-BVc6eTu_.js} +1 -1
  322. package/dist/client/assets/{track-CDbXIh-t.js → track-ENeykFhY.js} +1 -1
  323. package/dist/client/assets/{types-Bca8rqtc.js → types-B4ln4I1a.js} +6 -6
  324. package/dist/client/assets/{url-slug-0nYVauKi.js → url-slug-BCxEu7m_.js} +1 -1
  325. package/dist/client/assets/{usage-stats-DyR6Kq74.js → usage-stats-C5Wj6kIy.js} +1 -1
  326. package/dist/client/assets/{use-ai-providers-BM99Jk3f.js → use-ai-providers-BG5EDM0R.js} +1 -1
  327. package/dist/client/assets/{use-api-keys-CwsBcAgd.js → use-api-keys-CjwRm6n8.js} +1 -1
  328. package/dist/client/assets/{use-apply-named-rule-D90SDfPC.js → use-apply-named-rule-BH9tV1RN.js} +1 -1
  329. package/dist/client/assets/use-ask-in-chat-C6eCNqgR.js +1 -0
  330. package/dist/client/assets/{use-automations-Co69mrXt.js → use-automations-D4bJmUmE.js} +1 -1
  331. package/dist/client/assets/{use-autosave-BoR4WbwP.js → use-autosave-Dq8gUNzN.js} +1 -1
  332. package/dist/client/assets/use-blocks-v8-project-Dh0QtV4J.js +1 -0
  333. package/dist/client/assets/use-blog-view-w4rEUATy.js +1 -0
  334. package/dist/client/assets/{use-chat-layout-state-v3ZvRKOT.js → use-chat-layout-state-D38zRykR.js} +1 -1
  335. package/dist/client/assets/{use-cms-publish-actions-tt3YVYFN.js → use-cms-publish-actions-Bf5Y1rJL.js} +5 -5
  336. package/dist/client/assets/{use-connect-companion-isIbV5OV.js → use-connect-companion-leNqQRzW.js} +1 -1
  337. package/dist/client/assets/{use-connection-wSXmVdCY.js → use-connection-C4G0ZMoe.js} +1 -1
  338. package/dist/client/assets/{use-content-sync-BDeJ_Jgu.js → use-content-sync-CeYI53r8.js} +1 -1
  339. package/dist/client/assets/{use-copy-CQS-1CPQ.js → use-copy-BFeXylk9.js} +1 -1
  340. package/dist/client/assets/{use-current-view-C8Qn7lu6.js → use-current-view-swKX6Bc6.js} +1 -1
  341. package/dist/client/assets/{use-date-fns-locale-rXGxQCgx.js → use-date-fns-locale-DX45EO9I.js} +1 -1
  342. package/dist/client/assets/{use-debounced-autosave-C2p5-3yn.js → use-debounced-autosave-BVXsg1Of.js} +1 -1
  343. package/dist/client/assets/{use-debounced-value-sPPLBdJe.js → use-debounced-value-CPl0Wyl6.js} +1 -1
  344. package/dist/client/assets/{use-deco-credits-Cd6Vxe2k.js → use-deco-credits-C4mVYU5r.js} +1 -1
  345. package/dist/client/assets/{use-decopilot-events-Dn0Dm68W.js → use-decopilot-events-SRdggwTs.js} +1 -1
  346. package/dist/client/assets/{use-delete-block-MPbaqrna.js → use-delete-block-CRyG6Do-.js} +1 -1
  347. package/dist/client/assets/{use-delete-connection-EcnpG53Z.js → use-delete-connection-C-kXdkQA.js} +1 -1
  348. package/dist/client/assets/{use-deployment-admin-CTEsKWeV.js → use-deployment-admin-Dwt-RYsg.js} +1 -1
  349. package/dist/client/assets/{use-entitlements-BXMPYOBS.js → use-entitlements-DgXhk8I6.js} +1 -1
  350. package/dist/client/assets/{use-fast-preview-draft-url-BpA0y2aq.js → use-fast-preview-draft-url-DtikvUh-.js} +1 -1
  351. package/dist/client/assets/{use-file-configs-Df-dqKVI.js → use-file-configs-BlRaUlfc.js} +1 -1
  352. package/dist/client/assets/{use-id-selection-3iTAqvRR.js → use-id-selection-CJdNm4ZY.js} +1 -1
  353. package/dist/client/assets/{use-in-settings-D_BySurP.js → use-in-settings-cNZb_oio.js} +1 -1
  354. package/dist/client/assets/{use-inbox-feed-B-8Gmjeu.js → use-inbox-feed-BKl_0o2v.js} +1 -1
  355. package/dist/client/assets/{use-infinite-scroll-C-t0_BGl.js → use-infinite-scroll-DgSz0aNh.js} +1 -1
  356. package/dist/client/assets/{use-join-requests-B0limBIJ.js → use-join-requests-pUhubFwu.js} +1 -1
  357. package/dist/client/assets/{use-main-panel-tabs-N1__ahB3.js → use-main-panel-tabs-B0lMlgyK.js} +1 -1
  358. package/dist/client/assets/{use-mcp-auth-status-Buwa7u45.js → use-mcp-auth-status-BLLNsVrE.js} +1 -1
  359. package/dist/client/assets/{use-mcp-client-OYKYr7Zc.js → use-mcp-client-UWOU8UbZ.js} +2 -2
  360. package/dist/client/assets/{use-mcp-prompts-XeLNsblN.js → use-mcp-prompts-CjwiiUTx.js} +1 -1
  361. package/dist/client/assets/{use-mcp-tools-Ben5ajiJ.js → use-mcp-tools-C7Kg2Nto.js} +1 -1
  362. package/dist/client/assets/{use-mobile-MVZR2Lhp.js → use-mobile-Cq1k3-Gk.js} +1 -1
  363. package/dist/client/assets/{use-move-blocks-DNt_Qh-7.js → use-move-blocks-DH3gSdil.js} +1 -1
  364. package/dist/client/assets/{use-navigate-to-agent-0LtKWlxa.js → use-navigate-to-agent-vJOwimSb.js} +1 -1
  365. package/dist/client/assets/{use-never-published-DCVDrsUC.js → use-never-published-BB5kYeS3.js} +1 -1
  366. package/dist/client/assets/{use-org-fs-Dj5ea7Pp.js → use-org-fs-CAHuTLc_.js} +1 -1
  367. package/dist/client/assets/{use-org-notice-Csddyapx.js → use-org-notice-D_lLzWXp.js} +1 -1
  368. package/dist/client/assets/{use-org-repo-syncs-8CH2dV_u.js → use-org-repo-syncs-BxGs1Gi_.js} +1 -1
  369. package/dist/client/assets/{use-org-sso-DXCHIqdV.js → use-org-sso-fZ2uDAIp.js} +1 -1
  370. package/dist/client/assets/{use-organization-settings-BTioDTeC.js → use-organization-settings-D8JbZGlQ.js} +1 -1
  371. package/dist/client/assets/{use-panel-navigate-B_099k7i.js → use-panel-navigate-B3thngCs.js} +1 -1
  372. package/dist/client/assets/{use-project-native-view-presence-BCWndDk0.js → use-project-native-view-presence-BKZJ0lpX.js} +1 -1
  373. package/dist/client/assets/{use-project-scope-BaNhjjkU.js → use-project-scope-CD-cb4-V.js} +1 -1
  374. package/dist/client/assets/use-recent-apps-Co5DoIGT.js +1 -0
  375. package/dist/client/assets/{use-reports-diagnostic-tqk6GkvN.js → use-reports-diagnostic-lGxrsSfr.js} +1 -1
  376. package/dist/client/assets/{use-sandbox-events-DkGz3U_g.js → use-sandbox-events-BcrE-YTF.js} +2 -2
  377. package/dist/client/assets/{use-secrets-DsTJ_f5f.js → use-secrets-yIZbpwIn.js} +1 -1
  378. package/dist/client/assets/{use-section-preview-base-BFP7PpkG.js → use-section-preview-base-C2vE3o4z.js} +1 -1
  379. package/dist/client/assets/{use-sidebar-collapsed-Cyq98Qgp.js → use-sidebar-collapsed-Bo3tE9bK.js} +1 -1
  380. package/dist/client/assets/{use-tags-D58r0dtz.js → use-tags-BQcMuDty.js} +1 -1
  381. package/dist/client/assets/use-task-board-analytics-CIahrWuX.js +1 -0
  382. package/dist/client/assets/{use-task-board-item-prs-Y4mOP7Qi.js → use-task-board-item-prs-W9kboyPg.js} +1 -1
  383. package/dist/client/assets/{use-task-board-items-DHvwjetN.js → use-task-board-items-DP6ZFnrN.js} +1 -1
  384. package/dist/client/assets/{use-task-board-prompts-Ds3v5gjb.js → use-task-board-prompts-qQB1KZ8p.js} +1 -1
  385. package/dist/client/assets/{use-task-metadata-bPw-hNrv.js → use-task-metadata-C2UpEUk-.js} +1 -1
  386. package/dist/client/assets/{use-thread-outputs-I2kuvS72.js → use-thread-outputs-A3ms5KEO.js} +1 -1
  387. package/dist/client/assets/{use-view-draft-kind-DcHRrUPD.js → use-view-draft-kind-CXMOqIBD.js} +1 -1
  388. package/dist/client/assets/{use-voice-input-ClQF7v9Y.js → use-voice-input-poVZeRVs.js} +1 -1
  389. package/dist/client/assets/useInfiniteQuery-CNxlkxws.js +1 -0
  390. package/dist/client/assets/{useQueries-Q6q16yJQ.js → useQueries-DhONZGBj.js} +1 -1
  391. package/dist/client/assets/useSuspenseInfiniteQuery-FHN2hj19.js +1 -0
  392. package/dist/client/assets/{users-BBdssw6s.js → users-B_cNHXhu.js} +1 -1
  393. package/dist/client/assets/{utils-BaccrSLZ.js → utils-BdAsQahL.js} +1 -1
  394. package/dist/client/assets/{variant-calendar-DLupNn-U.js → variant-calendar-DkWaMyhm.js} +1 -1
  395. package/dist/client/assets/{variant-matcher-override-3ayykvcg.js → variant-matcher-override-CxSxAvsY.js} +1 -1
  396. package/dist/client/assets/{view-header-BIqV3RdZ.js → view-header-CZchRX7c.js} +1 -1
  397. package/dist/client/assets/{virtual-mcp-DyF6IEhr.js → virtual-mcp-4VHtoaO4.js} +1 -1
  398. package/dist/client/assets/{watch-sse-pool-DTFf-OSe.js → watch-sse-pool-C7kLS2GY.js} +1 -1
  399. package/dist/client/index.html +2 -2
  400. package/dist/server/server.js +705 -705
  401. package/package.json +1 -1
  402. package/dist/client/assets/agent-app--sGlyuqH.js +0 -1
  403. package/dist/client/assets/agent-assets-D9OfQf2S.js +0 -1
  404. package/dist/client/assets/agent-blog-BdGPQ8_2.js +0 -2
  405. package/dist/client/assets/agent-deck-BFHNNp62.js +0 -1
  406. package/dist/client/assets/agent-experiments-Bv_v3TAO.js +0 -1
  407. package/dist/client/assets/agent-file-BXKcmB2N.js +0 -1
  408. package/dist/client/assets/agent-library-Czsy6k8l.js +0 -1
  409. package/dist/client/assets/agent-library-file-BbS3HgpC.js +0 -1
  410. package/dist/client/assets/agent-overview-DM_uEEtA.js +0 -1
  411. package/dist/client/assets/agent-releases-CSV4AdrC.js +0 -2
  412. package/dist/client/assets/agent-settings-BnZZ1J30.js +0 -1
  413. package/dist/client/assets/agent-site-editor-code-DalNbqMF.js +0 -2
  414. package/dist/client/assets/agent-site-editor-content-C86oatUw.js +0 -1
  415. package/dist/client/assets/agent-site-editor-preview-CNy-hy9W.js +0 -1
  416. package/dist/client/assets/agent-view-BnzkhKY4.js +0 -1
  417. package/dist/client/assets/api-keys-BWtdycqJ.js +0 -1
  418. package/dist/client/assets/asset-utils-545UDhWA.js +0 -1
  419. package/dist/client/assets/auth-entry-CeA6avaA.js +0 -1
  420. package/dist/client/assets/index-DBsxQlkE.js +0 -1
  421. package/dist/client/assets/index-g6kNIQoA.js +0 -1
  422. package/dist/client/assets/index-pbgcO64n.css +0 -1
  423. package/dist/client/assets/legacy-agents-deep-DDm5GBaQ.js +0 -1
  424. package/dist/client/assets/library-UhxMQ0oL.js +0 -1
  425. package/dist/client/assets/project-app-view-DVY_pI8M.js +0 -1
  426. package/dist/client/assets/project-reports-CvZYitaI.js +0 -1
  427. package/dist/client/assets/project-tasks-Cm1BxQuv.js +0 -1
  428. package/dist/client/assets/record-editor-DUtpG1M4.js +0 -1
  429. package/dist/client/assets/reports-CRpT9Jvs.js +0 -1
  430. package/dist/client/assets/reports-onboarding-ByH6wjdu.js +0 -1
  431. package/dist/client/assets/repositories-BimQNbUT.js +0 -1
  432. package/dist/client/assets/require-capability-58lj_sLx.js +0 -1
  433. package/dist/client/assets/route-BIUN__VF.js +0 -1
  434. package/dist/client/assets/route-CKUHS8mK.js +0 -1
  435. package/dist/client/assets/settings-tab-CtAuHkvY.js +0 -1
  436. package/dist/client/assets/sheet-BqPaRS1I.js +0 -1
  437. package/dist/client/assets/site-editor-DwanunsO.js +0 -1
  438. package/dist/client/assets/switch-CfemO1do.js +0 -1
  439. package/dist/client/assets/synced-repos-BKKcIPbN.js +0 -1
  440. package/dist/client/assets/tasks-qN1qstWv.js +0 -1
  441. package/dist/client/assets/use-ask-in-chat-B4aJKUoO.js +0 -1
  442. package/dist/client/assets/use-blocks-v8-project-Dq4zh0zX.js +0 -1
  443. package/dist/client/assets/use-blog-view-DuKgZxsq.js +0 -1
  444. package/dist/client/assets/use-recent-apps-DKTzlYg2.js +0 -1
  445. package/dist/client/assets/use-task-board-analytics-Q05GDgAf.js +0 -1
  446. package/dist/client/assets/useInfiniteQuery-CoeKNdsU.js +0 -1
  447. package/dist/client/assets/useSuspenseInfiniteQuery-hY0KLY7U.js +0 -1
@@ -1 +1 @@
1
- import{c as I,j as r,n as v,b as M,a4 as P,bf as R}from"./index-BRgWMc-5.js";import{E as T}from"./empty-state-DrDY2Uvy.js";import{u as w}from"./chat-context-ZeSpVj2j.js";import{u as B,j as L,k as _}from"./site-editor-toast-CkAw1Cwp.js";import{i as $,u as A,j as Q,S as U}from"./blocks-tab-states-0NdQhV1f.js";import{a as G}from"./use-panel-navigate-B_099k7i.js";function H(C){const e=I.c(7),{icon:l,title:i,description:t,action:n}=C;let a;e[0]!==n?(a=n?{children:n.label,onClick:n.onClick,disabled:n.disabled}:void 0,e[0]=n,e[1]=a):a=e[1];let o;return e[2]!==t||e[3]!==l||e[4]!==a||e[5]!==i?(o=r.jsx(v,{children:r.jsx(v.Content,{children:r.jsx(v.Container,{children:r.jsx(T,{icon:l,title:i,description:t,buttonProps:a})})})}),e[2]=t,e[3]=l,e[4]=a,e[5]=i,e[6]=o):o=e[6],o}function Y(C){const e=I.c(33),{virtualMcpId:l,icon:i,copy:t,skeleton:n,children:a}=C,o=M(),{org:p}=P(),k=w(),u=k?.currentBranch??null,g=B(l,u);R(g.kind==="protocol"&&g.source==="github");const{openPanel:D}=G();if(!u){const s=t.noDraftTitle,F=t.noDraftDesc;let d;e[0]!==o?(d=o("sectionsEditor.namedRules.openEditor"),e[0]=o,e[1]=d):d=e[1];let f;e[2]!==D?(f=()=>D("content"),e[2]=D,e[3]=f):f=e[3];let m;e[4]!==d||e[5]!==f?(m={label:d,onClick:f},e[4]=d,e[5]=f,e[6]=m):m=e[6];let x;return e[7]!==t.noDraftDesc||e[8]!==t.noDraftTitle||e[9]!==i||e[10]!==m?(x=r.jsx(H,{icon:i,title:s,description:F,action:m}),e[7]=t.noDraftDesc,e[8]=t.noDraftTitle,e[9]=i,e[10]=m,e[11]=x):x=e[11],x}if($(g)){let s;return e[12]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(U,{}),e[12]=s):s=e[12],s}if(g.kind==="pending"){let s;return e[13]!==n?(s=r.jsx(r.Fragment,{children:n}),e[13]=n,e[14]=s):s=e[14],s}if(g.kind!=="protocol"){let s;return e[15]!==t.loadFailed||e[16]!==t.loadFailedHint||e[17]!==i?(s=r.jsx(H,{icon:i,title:t.loadFailed,description:t.loadFailedHint}),e[15]=t.loadFailed,e[16]=t.loadFailedHint,e[17]=i,e[18]=s):s=e[18],s}let c;e[19]!==u||e[20]!==p.slug||e[21]!==l?(c=JSON.stringify([p.slug,l,u]),e[19]=u,e[20]=p.slug,e[21]=l,e[22]=c):c=e[22];const h=k?.taskId??null;let j;return e[23]!==u||e[24]!==a||e[25]!==t||e[26]!==i||e[27]!==p.slug||e[28]!==n||e[29]!==c||e[30]!==h||e[31]!==l?(j=r.jsx(J,{orgSlug:p.slug,virtualMcpId:l,branch:u,threadId:h,icon:i,copy:t,skeleton:n,children:a},c),e[23]=u,e[24]=a,e[25]=t,e[26]=i,e[27]=p.slug,e[28]=n,e[29]=c,e[30]=h,e[31]=l,e[32]=j):j=e[32],j}function J(C){const e=I.c(35),{orgSlug:l,virtualMcpId:i,branch:t,threadId:n,icon:a,copy:o,skeleton:p,children:k}=C,u=M();let g;e[0]!==t||e[1]!==l||e[2]!==n||e[3]!==i?(g={orgSlug:l,virtualMcpId:i,branch:t,threadId:n,previewUrl:null},e[0]=t,e[1]=l,e[2]=n,e[3]=i,e[4]=g):g=e[4];const D=g,c=L(D),h=A(D),j=c.data,s=h.data;let F;e[5]!==t||e[6]!==l||e[7]!==i?(F={orgSlug:l,virtualMcpId:i,branch:t},e[5]=t,e[6]=l,e[7]=i,e[8]=F):F=e[8];const d=_(F,Q);if(!j||!s||!d.ready){if(c.isError||h.isError||d.failed){const N=o.loadFailed,O=o.loadFailedHint;let b;e[9]!==u?(b=u("sectionsEditor.namedRules.tryAgain"),e[9]=u,e[10]=b):b=e[10];let E;e[11]!==c||e[12]!==d||e[13]!==h?(E=()=>{c.isError&&c.refetch(),h.isError&&h.refetch(),d.failed&&d.retry()},e[11]=c,e[12]=d,e[13]=h,e[14]=E):E=e[14];let S;e[15]!==b||e[16]!==E?(S={label:b,onClick:E},e[15]=b,e[16]=E,e[17]=S):S=e[17];let y;return e[18]!==o.loadFailed||e[19]!==o.loadFailedHint||e[20]!==a||e[21]!==S?(y=r.jsx(H,{icon:a,title:N,description:O,action:S}),e[18]=o.loadFailed,e[19]=o.loadFailedHint,e[20]=a,e[21]=S,e[22]=y):y=e[22],y}let x;return e[23]!==p?(x=r.jsx(r.Fragment,{children:p}),e[23]=p,e[24]=x):x=e[24],x}let f;e[25]!==t||e[26]!==k||e[27]!==j||e[28]!==s||e[29]!==l||e[30]!==n||e[31]!==i?(f=k({orgSlug:l,virtualMcpId:i,branch:t,threadId:n,decofile:j,meta:s}),e[25]=t,e[26]=k,e[27]=j,e[28]=s,e[29]=l,e[30]=n,e[31]=i,e[32]=f):f=e[32];let m;return e[33]!==f?(m=r.jsx(r.Fragment,{children:f}),e[33]=f,e[34]=m):m=e[34],m}export{H as S,Y as a};
1
+ import{c as I,j as r,n as v,b as M,a6 as P,bh as R}from"./index-BuZqAz74.js";import{E as T}from"./empty-state-LbEOn0Mj.js";import{u as w}from"./chat-context-DG5tQFfU.js";import{u as B,j as L,k as _}from"./site-editor-toast-aupfR4Aq.js";import{i as $,u as A,j as Q,S as U}from"./blocks-tab-states-DxLq1BL5.js";import{a as G}from"./use-panel-navigate-B3thngCs.js";function H(C){const e=I.c(7),{icon:l,title:i,description:t,action:n}=C;let a;e[0]!==n?(a=n?{children:n.label,onClick:n.onClick,disabled:n.disabled}:void 0,e[0]=n,e[1]=a):a=e[1];let o;return e[2]!==t||e[3]!==l||e[4]!==a||e[5]!==i?(o=r.jsx(v,{children:r.jsx(v.Content,{children:r.jsx(v.Container,{children:r.jsx(T,{icon:l,title:i,description:t,buttonProps:a})})})}),e[2]=t,e[3]=l,e[4]=a,e[5]=i,e[6]=o):o=e[6],o}function Y(C){const e=I.c(33),{virtualMcpId:l,icon:i,copy:t,skeleton:n,children:a}=C,o=M(),{org:p}=P(),k=w(),u=k?.currentBranch??null,g=B(l,u);R(g.kind==="protocol"&&g.source==="github");const{openPanel:D}=G();if(!u){const s=t.noDraftTitle,F=t.noDraftDesc;let d;e[0]!==o?(d=o("sectionsEditor.namedRules.openEditor"),e[0]=o,e[1]=d):d=e[1];let f;e[2]!==D?(f=()=>D("content"),e[2]=D,e[3]=f):f=e[3];let m;e[4]!==d||e[5]!==f?(m={label:d,onClick:f},e[4]=d,e[5]=f,e[6]=m):m=e[6];let x;return e[7]!==t.noDraftDesc||e[8]!==t.noDraftTitle||e[9]!==i||e[10]!==m?(x=r.jsx(H,{icon:i,title:s,description:F,action:m}),e[7]=t.noDraftDesc,e[8]=t.noDraftTitle,e[9]=i,e[10]=m,e[11]=x):x=e[11],x}if($(g)){let s;return e[12]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(U,{}),e[12]=s):s=e[12],s}if(g.kind==="pending"){let s;return e[13]!==n?(s=r.jsx(r.Fragment,{children:n}),e[13]=n,e[14]=s):s=e[14],s}if(g.kind!=="protocol"){let s;return e[15]!==t.loadFailed||e[16]!==t.loadFailedHint||e[17]!==i?(s=r.jsx(H,{icon:i,title:t.loadFailed,description:t.loadFailedHint}),e[15]=t.loadFailed,e[16]=t.loadFailedHint,e[17]=i,e[18]=s):s=e[18],s}let c;e[19]!==u||e[20]!==p.slug||e[21]!==l?(c=JSON.stringify([p.slug,l,u]),e[19]=u,e[20]=p.slug,e[21]=l,e[22]=c):c=e[22];const h=k?.taskId??null;let j;return e[23]!==u||e[24]!==a||e[25]!==t||e[26]!==i||e[27]!==p.slug||e[28]!==n||e[29]!==c||e[30]!==h||e[31]!==l?(j=r.jsx(J,{orgSlug:p.slug,virtualMcpId:l,branch:u,threadId:h,icon:i,copy:t,skeleton:n,children:a},c),e[23]=u,e[24]=a,e[25]=t,e[26]=i,e[27]=p.slug,e[28]=n,e[29]=c,e[30]=h,e[31]=l,e[32]=j):j=e[32],j}function J(C){const e=I.c(35),{orgSlug:l,virtualMcpId:i,branch:t,threadId:n,icon:a,copy:o,skeleton:p,children:k}=C,u=M();let g;e[0]!==t||e[1]!==l||e[2]!==n||e[3]!==i?(g={orgSlug:l,virtualMcpId:i,branch:t,threadId:n,previewUrl:null},e[0]=t,e[1]=l,e[2]=n,e[3]=i,e[4]=g):g=e[4];const D=g,c=L(D),h=A(D),j=c.data,s=h.data;let F;e[5]!==t||e[6]!==l||e[7]!==i?(F={orgSlug:l,virtualMcpId:i,branch:t},e[5]=t,e[6]=l,e[7]=i,e[8]=F):F=e[8];const d=_(F,Q);if(!j||!s||!d.ready){if(c.isError||h.isError||d.failed){const N=o.loadFailed,O=o.loadFailedHint;let b;e[9]!==u?(b=u("sectionsEditor.namedRules.tryAgain"),e[9]=u,e[10]=b):b=e[10];let E;e[11]!==c||e[12]!==d||e[13]!==h?(E=()=>{c.isError&&c.refetch(),h.isError&&h.refetch(),d.failed&&d.retry()},e[11]=c,e[12]=d,e[13]=h,e[14]=E):E=e[14];let S;e[15]!==b||e[16]!==E?(S={label:b,onClick:E},e[15]=b,e[16]=E,e[17]=S):S=e[17];let y;return e[18]!==o.loadFailed||e[19]!==o.loadFailedHint||e[20]!==a||e[21]!==S?(y=r.jsx(H,{icon:a,title:N,description:O,action:S}),e[18]=o.loadFailed,e[19]=o.loadFailedHint,e[20]=a,e[21]=S,e[22]=y):y=e[22],y}let x;return e[23]!==p?(x=r.jsx(r.Fragment,{children:p}),e[23]=p,e[24]=x):x=e[24],x}let f;e[25]!==t||e[26]!==k||e[27]!==j||e[28]!==s||e[29]!==l||e[30]!==n||e[31]!==i?(f=k({orgSlug:l,virtualMcpId:i,branch:t,threadId:n,decofile:j,meta:s}),e[25]=t,e[26]=k,e[27]=j,e[28]=s,e[29]=l,e[30]=n,e[31]=i,e[32]=f):f=e[32];let m;return e[33]!==f?(m=r.jsx(r.Fragment,{children:f}),e[33]=f,e[34]=m):m=e[34],m}export{H as S,Y as a};
@@ -0,0 +1 @@
1
+ import{c as u,r as g,j as n,J as G,a0 as F,a as E,l as O,b as P,n as y,L as H}from"./index-BuZqAz74.js";import{C as M}from"./chat-context-DG5tQFfU.js";import{ChatLayout as x}from"./index-5KkkYmJi.js";import{L}from"./index-SPj0mL-J.js";import{B as J}from"./blocks-preview-workspace-context-CN-ldvuU.js";import{e as T,p as K,s as V,a as W,r as U,T as $,u as R,b as z}from"./site-editor-toast-aupfR4Aq.js";import{u as q,L as B,P as Q,S as X}from"./preview-tab-BxZksZBr.js";import{C as Y}from"./content-tab-B2YwxmJz.js";import{T as Z}from"./tab-icon-glyph-CvvfUXQl.js";import{r as tt}from"./resolve-tab-icon-DQMxOocF.js";import ot from"./agent-site-editor-Bn_zysVp.js";import"./use-panel-navigate-B3thngCs.js";import"./thread-route-Dw1cQjON.js";import"./use-project-scope-CD-cb4-V.js";import"./repository-binding-VVfcdUiy.js";import"./use-mcp-client-UWOU8UbZ.js";import"./auth-DuSLyK-k.js";import"./use-view-draft-kind-CXMOqIBD.js";import"./use-blog-view-w4rEUATy.js";import"./use-organization-settings-D8JbZGlQ.js";import"./schema-CCpL_LVZ.js";import"./task-board-DEUSGytR.js";import"./thread-intent-CyH0Z8_7.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-C7kLS2GY.js";import"./session-runtime-HHtypsTM.js";import"./use-entitlements-DgXhk8I6.js";import"./use-ai-providers-BG5EDM0R.js";import"./use-current-view-swKX6Bc6.js";import"./use-in-settings-cNZb_oio.js";import"./use-decopilot-events-SRdggwTs.js";import"./use-mobile-Cq1k3-Gk.js";import"./tooltip-DnGqcvtu.js";import"./index-DNuvhcDO.js";import"./MessageCircle01-Bf6dD94_.js";import"./XClose-C4MsAn9v.js";import"./thread-button-DbVaWztE.js";import"./use-sidebar-collapsed-Bo3tE9bK.js";import"./sheet-Lq2qXLx8.js";import"./use-chat-layout-state-D38zRykR.js";import"./toolbar-icon-button-BroRQfDx.js";import"./resizable-XeFzd9pk.js";import"./route-page-header-BqA32d57.js";import"./LayoutLeft-CCeum9wV.js";import"./task-key-DaPOId6s.js";import"./sortable.esm-n9zdQXyB.js";import"./Tool01-BeDQSGiN.js";import"./agent-icon-DwJHakBB.js";import"./AlertCircle-CGZfuvxJ.js";import"./UserCheck01-BMoOFYIZ.js";import"./ArrowUp-DJZ55cl-.js";import"./ArrowLeft-XURGfwpG.js";import"./ArrowRight-ZoKxZa45.js";import"./BookOpen01-gO5hgFUK.js";import"./Globe04-DO1uUwfE.js";import"./CheckCircle-CmN8U1V5.js";import"./TrendUp01-_SFSHjzO.js";import"./ChevronDown-ClblfTVV.js";import"./ChevronSelectorVertical-YxAp9GGa.js";import"./ChevronUp-0ZCAxpBW.js";import"./UserSquare-Dn1UPzSD.js";import"./LinkBroken01-cq4srxHs.js";import"./CreditCard01-CcTQ1h3_.js";import"./File02-Cs751Kds.js";import"./SwitchHorizontal01-BQF84Li3.js";import"./Eye-D5j_svLn.js";import"./Image01-CJL4B_rR.js";import"./Key01-fuHivqLl.js";import"./Minus-Cc21R1KY.js";import"./Monitor01-DGdgEYxG.js";import"./Sun-D9ql5ZlI.js";import"./Play-zYFs_vGL.js";import"./Plus--DcN-eh1.js";import"./SearchMd-BwYuN52e.js";import"./ShoppingBag01-D-gmqcz7.js";import"./Trash01-BmQrADz0.js";import"./Upload01-DOfZqxci.js";import"./Users01-B_yoWxPn.js";import"./Zap-DoxB0q6B.js";import"./context-menu-BgKzmvfA.js";import"./use-org-notice-D_lLzWXp.js";import"./create-organization-dialog-BeGGdtfc.js";import"./form-Cxhh0mxt.js";import"./label-Dm_T3WyF.js";import"./project-apps-Dezyz6_N.js";import"./use-recent-apps-Co5DoIGT.js";import"./use-navigate-to-agent-vJOwimSb.js";import"./command-DHGFzOhP.js";import"./index-DsWqYG3w.js";import"./use-debounced-value-CPl0Wyl6.js";import"./feedback-BqoIMOg7.js";import"./textarea-CcO-rfag.js";import"./use-sandbox-events-BcrE-YTF.js";import"./sandbox-url-D3mC8qhT.js";import"./use-blocks-v8-project-Dh0QtV4J.js";import"./use-voice-input-poVZeRVs.js";import"./popover-D6EIL5sL.js";import"./drawer-BXd80xtd.js";import"./index-Bld02Tnb.js";import"./checkbox-DAnVkT6Q.js";import"./select-BkYZ4NYA.js";import"./index-BdQq_4o_.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./utils-BdAsQahL.js";import"./sandbox-git-api-CkSQDoxX.js";import"./save-status-CmYiPWXE.js";import"./use-never-published-BB5kYeS3.js";import"./hosted-reconcile-uX15ZUhb.js";import"./blocks-tab-states-DxLq1BL5.js";import"./empty-state-BK8GboWz.js";import"./search-input-C4sd-kKh.js";import"./tabs-CbfCGlFS.js";import"./active-indicator-CCMhAsc_.js";import"./use-file-configs-BlRaUlfc.js";import"./asset-utils-C40qdOgS.js";import"./useInfiniteQuery-CNxlkxws.js";import"./infiniteQueryObserver-CHN_AvWa.js";import"./usage-stats-C5Wj6kIy.js";import"./utils-CVEq3hMx.js";import"./markdown-CwYBGb1B.js";import"./use-copy-BFeXylk9.js";import"./gateway-client-PdaGLWBA.js";import"./switch-COjzxQ39.js";import"./toggle-group-DFyE84bx.js";import"./match-site-slug-config-B47_xZCi.js";import"./sandbox-lifecycle-context-BBz4IKVo.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./frame-navigation--4kFXAAS.js";import"./variant-matcher-override-CxSxAvsY.js";import"./section-array-field-DOngDm8U.js";import"./use-fast-preview-draft-url-DtikvUh-.js";import"./parse-sections-CVDx-uBN.js";import"./held-block-view-zi4CM-KX.js";import"./calendar-BUgmhSfk.js";import"./editor-classes-CzejjvgI.js";import"./empty-message-DVICFi26.js";import"./pair-BYbJa99U.js";import"./collapsible-DifRD2Ww.js";import"./use-task-board-items-DP6ZFnrN.js";import"./config-dB-x76iz.js";import"./task-route-BJj40Yza.js";import"./project-index-5c8GGatg.js";import"./shell-layout-rYoN4RTk.js";import"./use-deployment-admin-Dwt-RYsg.js";import"./admin-fetch-BhTJlAsX.js";import"./integration-icon-D7fga3kk.js";import"./project-icon-BHn6Xq54.js";import"./new-project-dialog-Bq2YhVDS.js";import"./repository-picker-By75IHJa.js";import"./github-icon-h_xg-qFR.js";import"./collection-search-RWM-9f07.js";import"./new-project-store-C82itd6a.js";import"./legacy-admin-welcome-dialog-C0w-pw6s.js";import"./required-auth-layout-GSSn-bTA.js";import"./use-org-sso-fZ2uDAIp.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-CLuYD3rD.js";import"./types-B4ln4I1a.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./use-connection-C4G0ZMoe.js";import"./use-mcp-prompts-CjwiiUTx.js";import"./use-thread-outputs-A3ms5KEO.js";import"./file-type-icon-CSrE_noX.js";import"./named-rule-step-D8j_NuRK.js";import"./slider-B4bXP1H_.js";import"./index-rt88hTRg.js";import"./tooltipContext-BVc6eTu_.js";import"./CategoricalChart-CmAKQrAh.js";import"./index-BwBEUlXI.js";import"./combobox-D7DiHBHL.js";import"./scroll-area-bkCFS0v8.js";import"./monaco-editor-CTONBla7.js";import"./editor-DNZ-WgCS.js";import"./useQueries-DhONZGBj.js";import"./device-hint-B6fw2qhI.js";import"./alert-Dl9RecsO.js";import"./virtual-mcp-4VHtoaO4.js";import"./url-slug-BCxEu7m_.js";import"./app-preview-url-9Od4s8Sz.js";import"./agent-capabilities-Dh06TMfs.js";import"./preview-source-BsRLGWUP.js";import"./use-task-metadata-C2UpEUk-.js";import"./delete-copy-C7-0DCkQ.js";import"./category-tree-BeXLYa5S.js";import"./use-move-blocks-DH3gSdil.js";import"./index-CZTrNcsP.js";import"./view-header-CZchRX7c.js";import"./use-cms-publish-actions-Bf5Y1rJL.js";import"./use-content-sync-CeYI53r8.js";import"./use-delete-block-CRyG6Do-.js";import"./item-actions-Dld5lBtQ.js";import"./date-utils-CrvIKg-s.js";import"./badge-BvHOfdxU.js";import"./empty-state-LbEOn0Mj.js";import"./mustache-C50JF2sQ.js";import"./collection-table-wrapper-DVjGjn7R.js";import"./table-DQIAY6r-.js";import"./site-draft-actions-D72ZWrGI.js";import"./separator-DTKXzVmt.js";import"./cms-store-drafts-BDhAH5vV.js";import"./serial-task-queue-CGOeQgpr.js";import"./index-BpNyzjaQ.js";import"./input-c6Cx2liY.js";import"./icon-button-DzpdeaSs.js";import"./chat-draft-Bv2iw9Fr.js";import"./use-deco-credits-C4mVYU5r.js";import"./input--XeG2v6T.js";import"./suggestion-Nntdxi5T.js";import"./use-org-fs-CAHuTLc_.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-DQF2iJDP.js";import"./plan-ladder-Ce2vSjaL.js";import"./add-connection-dialog-D0PlxcOk.js";import"./extract-connection-data-B1FMXoXK.js";import"./metadata-D72DunRR.js";import"./connection-CeuJqjaI.js";import"./connection-card-bC9jkQR3.js";import"./connection-slug-BofuMVWL.js";import"./schema-B0biNpls.js";import"./connection-form-helpers-BVK3iXej.js";import"./authenticate-and-persist-oauth-BrPxKw11.js";import"./mcp-oauth-i1ZYjV6U.js";import"./mcp-oauth-DZ8B5A_7.js";import"./collection-tabs-BkmY1xp_.js";import"./use-infinite-scroll-DgSz0aNh.js";import"./useSuspenseInfiniteQuery-FHN2hj19.js";import"./save-changes-debug-nBi-n9eV.js";import"./site-draft-view-DdS4HrBp.js";import"./blog-view-gate-DT-8hHxE.js";function I(o){return o.kind==="unavailable"&&o.source==="local"&&(o.problem?.reason??"not-answering")==="not-answering"}const it=o=>o;function et(o){const t=u.c(10),{candidates:i,invalidLink:c,shell:s,editor:e}=o,r=c===void 0?!1:c,m=s===void 0?it:s,[p,a]=g.useState(null);if(p){let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>a(null),t[0]=f):f=t[0];let h;return t[1]!==p||t[2]!==e?(h=e(p,f),t[1]=p,t[2]=e,t[3]=h):h=t[3],h}let l;t[4]!==i||t[5]!==r?(l=n.jsx(rt,{candidates:i,invalidLink:r,onConnect:a}),t[4]=i,t[5]=r,t[6]=l):l=t[6];let d;return t[7]!==m||t[8]!==l?(d=m(l),t[7]=m,t[8]=l,t[9]=d):d=t[9],d}function rt(o){const t=u.c(17),{candidates:i,invalidLink:c,onConnect:s}=o,e=c===void 0?!1:c,[r]=G(),{language:m}=r;let p;t[0]!==s?(p=N=>s({endpoint:N}),t[0]=s,t[1]=p):p=t[1];let a;t[2]!==i||t[3]!==p?(a={candidates:i,onFound:p},t[2]=i,t[3]=p,t[4]=a):a=t[4];const l=q(a),{state:d,access:f,needsGesture:h}=l;let k;t[5]!==i||t[6]!==m?(k=new Intl.ListFormat(m,{style:"long",type:"conjunction"}).format(i.map(T)),t[5]=i,t[6]=m,t[7]=k):k=t[7];const C=k;let S;t[8]!==f||t[9]!==l.start||t[10]!==h||t[11]!==d?(S=f==="denied"?{kind:"denied"}:h?{kind:"needs-gesture",onStart:l.start}:d.problem?{kind:"problem",problem:d.problem,host:T(d.problem.endpoint)}:{kind:"looking",paused:d.status==="paused"},t[8]=f,t[9]=l.start,t[10]=h,t[11]=d,t[12]=S):S=t[12];const _=S;let j;return t[13]!==C||t[14]!==e||t[15]!==_?(j=n.jsx(B,{wait:_,hosts:C,invalidLink:e}),t[13]=C,t[14]=e,t[15]=_,t[16]=j):j=t[16],j}const v="deco-serve",w="working-tree",nt={id:"",slug:"",name:"",logo:null},st={id:v,slug:v},mt={virtualMcpId:v,taskId:null,openTask:()=>{},createTask:()=>"",createTaskWithMessage:()=>{},activeTask:null,isThreadLocked:!1,lockedHarness:null,lockedBranch:null,currentBranch:w,setCurrentTaskBranch:()=>{}};function pt(){const o=window.location.hash,t=new URLSearchParams(o.replace(/^#/,"")).has("endpoint"),i=t?K(o):null;return t&&window.history.replaceState(null,"",window.location.pathname+window.location.search),i&&V(i),{candidates:W(i,U()),invalidLink:t&&!i}}const at=[{id:"site-editor",to:"/site-editor",label:"preview"},{id:"content",to:"/site-editor/content",label:"content"}];function lt(){const o=u.c(6),t=P();let i;o[0]===Symbol.for("react.memo_cache_sentinel")?(i={select:ct},o[0]=i):i=o[0];const c=O(i);let s;o[1]!==t||o[2]!==c?(s=at.map(r=>n.jsx(y.Tab,{asChild:!0,active:c==="content"==(r.id==="content"),children:n.jsxs(H,{to:r.to,activeOptions:{exact:!0},children:[n.jsx("span",{"aria-hidden":"true",className:"flex size-4 shrink-0 items-center justify-center",children:n.jsx(Z,{icon:tt({tabId:r.id,kind:"system",connections:[]})})}),t(`common.mainPanelTabs.${r.label}`)]})},r.id)),o[1]=t,o[2]=c,o[3]=s):s=o[3];let e;return o[4]!==s?(e=n.jsx(y.Tabs,{children:s}),o[4]=s,o[5]=e):e=o[5],e}function ct(o){return o.matches.at(-1)?.staticData.siteEditorView}function A(o){const t=u.c(14),{children:i}=o,c=P(),{connection:s}=z(v),e=R(v,w);let r,m;if(t[0]!==e||t[1]!==i||t[2]!==s||t[3]!==c){m=Symbol.for("react.early_return_sentinel");t:{if(r=s?T(s.endpoint):"",e.kind==="protocol"){m=i;break t}if(e.kind!=="unavailable"||I(e)){m=n.jsx(X,{headingLevel:2,waiting:!0,title:c("decoServe.connect.reaching",{host:r})});break t}}t[0]=e,t[1]=i,t[2]=s,t[3]=c,t[4]=r,t[5]=m}else r=t[4],m=t[5];if(m!==Symbol.for("react.early_return_sentinel"))return m;let p;t[6]!==e.problem?(p=e.problem??{reason:"not-answering"},t[6]=e.problem,t[7]=p):p=t[7];let a;t[8]!==r||t[9]!==p?(a={kind:"problem",problem:p,host:r},t[8]=r,t[9]=p,t[10]=a):a=t[10];let l;return t[11]!==r||t[12]!==a?(l=n.jsx(B,{wait:a,hosts:r}),t[11]=r,t[12]=a,t[13]=l):l=t[13],l}function dt(o){const t=u.c(6),{onLost:i}=o,c=R(v,w);let s;t[0]!==c?(s=I(c),t[0]=c,t[1]=s):s=t[1];const e=s;let r,m;return t[2]!==e||t[3]!==i?(r=()=>{e&&i()},m=[e,i],t[2]=e,t[3]=i,t[4]=r,t[5]=m):(r=t[4],m=t[5]),g.useEffect(r,m),null}const D={threadOpen:!1,contentOpen:!0,toggleFullscreen:()=>{},toggleContent:()=>{}};function ut(){const o=u.c(11),{data:t}=E.useSession();let i;o[0]===Symbol.for("react.memo_cache_sentinel")?(i={select:ft},o[0]=i):i=o[0];const c=O(i),s=!!t?.user;let e;o[1]!==s?(e={rail:s},o[1]=s,o[2]=e):e=o[2];const r=c??"preview";let m,p,a;o[3]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(lt,{}),p=n.jsx(ot,{}),a=n.jsx(x.Thread,{children:null}),o[3]=m,o[4]=p,o[5]=a):(m=o[3],p=o[4],a=o[5]);let l;o[6]!==r?(l=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:r,contentNavigation:m,children:[p,a]})}),o[6]=r,o[7]=l):l=o[7];let d;return o[8]!==e||o[9]!==l?(d=n.jsx(L,{outsideOrg:e,children:l}),o[8]=e,o[9]=l,o[10]=d):d=o[10],d}function ft(o){return o.matches.at(-1)?.staticData.siteEditorView}function ht(o){const t=u.c(10),{children:i}=o,{data:c}=E.useSession(),s=!!c?.user;let e;t[0]!==s?(e={rail:s},t[0]=s,t[1]=e):e=t[1];let r;t[2]!==i?(r=n.jsx(x.Content,{children:i}),t[2]=i,t[3]=r):r=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(x.Thread,{children:null}),t[4]=m):m=t[4];let p;t[5]!==r?(p=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:"guide",children:[r,m]})}),t[5]=r,t[6]=p):p=t[6];let a;return t[7]!==e||t[8]!==p?(a=n.jsx(L,{outsideOrg:e,children:p}),t[7]=e,t[8]=p,t[9]=a):a=t[9],a}const b=()=>{},vt={connection:null,set:b,clear:b};function Ir(){const o=u.c(3),[t]=g.useState(pt);let i;return o[0]!==t.candidates||o[1]!==t.invalidLink?(i=n.jsx(F,{org:nt,project:st,children:n.jsx(et,{candidates:t.candidates,invalidLink:t.invalidLink,shell:kt,editor:xt})}),o[0]=t.candidates,o[1]=t.invalidLink,o[2]=i):i=o[2],i}function xt(o,t){return n.jsxs($.Provider,{value:{connection:o,set:b,clear:b},children:[n.jsx(dt,{onLost:t}),n.jsx(M,{value:mt,children:n.jsx(J,{children:n.jsx(ut,{})})})]})}function kt(o){return n.jsx($.Provider,{value:vt,children:n.jsx(ht,{children:o})})}function Ar(){const o=u.c(1);let t;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Q,{virtualMcpId:v})}),o[0]=t):t=o[0],t}function Dr(){const o=u.c(1);let t;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Y,{virtualMcpId:v})}),o[0]=t):t=o[0],t}export{Dr as SiteEditorContent,Ar as SiteEditorPreview,Ir as default};
@@ -1 +1 @@
1
- import{aF as Dt,aG as q,bn as je,bv as _n,dy as Oe,dw as xn,et as we,c as A,i as F,eu as Rn,ev as Tn,q as Z,r as L,ew as Pn,K as g,ex as Y,ey as X,bA as $n,a as Nn,at as De,a4 as jn,bw as It,ez as An,eA as _t,ar as Mn,br as B,ec as xt,eB as Ln,eC as Qn,eD as Un,t as te,j as z}from"./index-BRgWMc-5.js";import{C as j,E as T,i as Ae,e as Bn,u as Fn,P as Cn,f as Vn,g as Me,h as Rt,j as Tt}from"./use-sandbox-events-DkGz3U_g.js";import{b as Le}from"./repository-binding-Drae9jEJ.js";import{e as Pt}from"./backoff-CrEUbyZT.js";import{b as pe}from"./sandbox-url-D3mC8qhT.js";import{u as Hn}from"./chat-context-ZeSpVj2j.js";import{u as Qe}from"./use-blocks-v8-project-Dq4zh0zX.js";import{u as $t}from"./use-voice-input-ClQF7v9Y.js";import{s as ot}from"./session-runtime-BH3ADRqu.js";import{s as Jn}from"./utils-BaccrSLZ.js";import{a as Wn}from"./sandbox-git-api-CPqBqV0G.js";function Nt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function ue(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const jt=Dt({endpoint:q().max(2048).refine(e=>Nt(e)&&new URL(e).pathname==="/rpc").transform(ue)});function gr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=jt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function At(e){const t=jt.safeParse(e);return t.success?t.data:null}const Mt="studio:deco-serve-last";function vr(e){try{localStorage.setItem(Mt,JSON.stringify(e))}catch{}}function br(){try{const e=localStorage.getItem(Mt);return e?At(JSON.parse(e)):null}catch{return null}}function wr(e){try{return new URL(ue(e)).host}catch{return e}}function Yn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Gn="http://localhost:4545/rpc";class Ue extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zn(e){if(e instanceof Ue)return{reason:"not-deco-serve"};if(!(e instanceof j))return{reason:"not-answering"};switch(e.code){case T.Unauthorized:case T.MethodNotFound:return{reason:"outdated"};case T.Unsupported:return Ae(e)?{reason:"outdated"}:{reason:"version-mismatch"};case T.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function pr(e,t){if(e)return[ue(e.endpoint)];const n=[t?.endpoint,Gn].filter(o=>!!o).map(ue);return[...new Set(n)]}const Xn=Dt({blocks:Oe(q(),Oe(q(),xn()).refine(je)),versions:Oe(q(),q().min(1)),missing:_n(q())});function Zn(e,t){const n=Xn.parse(e),o=Object.keys(n.blocks),s=Object.keys(n.versions),r=[...o,...n.missing],i=new Set(t);if(s.length!==o.length||o.some(a=>!Object.hasOwn(n.versions,a))||r.length!==i.size||new Set(r).size!==r.length||r.some(a=>!i.has(a)))throw new Error("The CMS block response did not account for the requested names");return n}function ne(e,t){const n=e.index?.entries[t];return!!n&&je(e.blocks[t])&&e.versions[t]===n.version}function Kn(e,t,n){const o=new Map;let s=!1;for(const[r,i]of Object.entries(n.blocks)){const a=t.index?.entries[r];if(a){if(n.versions[r]!==a.version){s||=a.version===e.index?.entries[r]?.version;continue}t.blocks[r]!==e.blocks[r]||t.versions[r]!==e.versions[r]||o.set(r,i)}}return s||=n.missing.some(r=>!!t.index?.entries[r]),{blocks:o.size?{...t.blocks,...Object.fromEntries(o)}:t.blocks,versions:o.size?{...t.versions,...Object.fromEntries([...o.keys()].map(r=>[r,n.versions[r]]))}:t.versions,refreshIndex:s}}function qn(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?ne(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const st=50,rt=10;function eo(e,t=n=>fetch(n)){let n=1;return{async batch(o){const s=o.map(()=>n++),r=await t(new Request(e,{method:"POST",headers:{"content-type":"application/json"},credentials:"include",signal:we(),body:JSON.stringify(o.map((l,c)=>({jsonrpc:"2.0",id:s[c],method:l.method,params:l.params??{}})))}));if(!r.ok)throw new j(T.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(l=>[l.id,l]));return s.map(l=>{const c=a.get(l);return c?c.error?{ok:!1,error:j.from(c.error)}:{ok:!0,result:c.result}:{ok:!1,error:new j(T.InternalError,"no response for this call")}})}}}function to(e,t){if(!e)return t??{};const n={};for(const[o,s]of Object.entries(e.entries)){if(t&&Object.hasOwn(t,o)){n[o]=t[o];continue}n[o]={[Tn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Rn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function no(e,t){return e?.entries[t]?.meta?.refs??[]}function oo(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Be(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ie(e,t){if(Array.isArray(e)){for(const n of e)Ie(n,t);return}if(Be(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):Ie(o,t)}function Lt(e,t){if(!Be(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;Ie(e,o);const s=[...o].filter(r=>t.has(r)).sort();return s.length>0&&(n.refs=s),Object.keys(n).length>0?n:void 0}function Qt(e,t,n,o){Y(e),e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.entries},i={...s.draft},a=new Set([...Object.keys(r),...Object.keys(o)]);for(const[l,c]of Object.entries(n)){const f=i[l]?.editor??null;if(c===null||c===X){delete r[l],i[l]={operation:"delete",version:X,editor:f};continue}const h=Lt(o[l],a);r[l]={version:c,...h?{meta:h}:{}},i[l]={operation:"set",version:c,editor:f}}return{...s,entries:r,draft:i}})}function so(e,t,n,o){e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.draft},i={...s.entries};if(o===null)delete r[n];else if(r[n]={operation:o.block===null?"delete":"set",version:o.version,editor:r[n]?.editor??null},o.block===null)delete i[n];else{const a=new Set([...Object.keys(i),n]),l=Lt(o.block,a);i[n]={version:o.version,...l?{meta:l}:{}}}return{...s,entries:i,draft:r}})}const it=new WeakMap;async function Fe(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new j(T.Unavailable,"The CMS index is not loaded yet");let i=it.get(e);i||(i=new Map,it.set(e,i));const a=e.getQueryData(g.decofile(n))??{},l=e.getQueryData(g.contentVersions(n))??{},c=[],f=[];for(const u of new Set(o)){const d=r.entries[u];if(!d||s.has(u)||je(a[u])&&l[u]===d.version)continue;const v=i.get(`${n}\0${u}`);v?c.push(v):f.push(u)}if(f.length>0){const u=io(e,t,n,f);for(const d of f){const v=`${n}\0${d}`;i.set(v,u),u.catch(()=>{}).finally(()=>{i.get(v)===u&&i.delete(v)})}c.push(u)}await Promise.all(c);const h=fe(e,n);if(o.some(u=>h.index?.entries[u]&&!s.has(u)&&!ne(h,u)))throw new j(T.Unavailable,"A CMS block changed while loading; try again")}async function ro(e,t,n,o,s){if(!t){const i=o?.[s];return Be(i)&&!$n(i)?i:void 0}await Fe(e,t,n,[s]);const r=fe(e,n);return r.index?.entries[s]&&ne(r,s)?r.blocks[s]:void 0}function fe(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function io(e,t,n,o){const s=fe(e,n),r=[];for(let i=0;i<o.length;i+=st)r.push(o.slice(i,i+st));for(let i=0;i<r.length;i+=rt){const a=r.slice(i,i+rt),l=await t.batch(a.map(c=>({method:"cms.blocks",params:{names:c}})));if(l.length!==a.length)throw new j(T.InternalError,"Incomplete CMS batch response");for(const[c,f]of l.entries()){if(!f.ok)throw f.error;const h=Zn(f.result,a[c]),u=fe(e,n),d=Kn(s,u,h);if(Y(e),d.blocks!==u.blocks&&e.setQueryData(g.decofile(n),d.blocks),d.versions!==u.versions&&e.setQueryData(g.contentVersions(n),d.versions),d.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new j(T.Unavailable,"The CMS index changed while loading blocks; try again")}}}function Ce(e){const t=A.c(4);let n;t[0]!==e?(n=g.contentIndex(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:ao,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=F(o);return s}async function ao(){throw new Error("the content index is set by the poll")}function at(e,t){const n=A.c(8);let o;n[0]!==t?(o=Pn(t),n[0]=t,n[1]=o):o=n[1];const s=o;let r;n[2]!==e||n[3]!==s?(r=a=>e.getQueryCache().subscribe(l=>{l.query.queryHash===s&&a()}),n[2]=e,n[3]=s,n[4]=r):r=n[4];let i;return n[5]!==e||n[6]!==t?(i=()=>e.getQueryData(t),n[5]=e,n[6]=t,n[7]=i):i=n[7],L.useSyncExternalStore(r,i)}const ct=3e4;function co(e){if(!(e instanceof j))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function lo(e,t,n,o){const s=A.c(15),r=Z(),i=Ce(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const l=at(r,a);let c;s[2]!==t?(c=g.contentVersions(t),s[2]=t,s[3]=c):c=s[3];const f=at(r,c),h=o?.withRefs??!1,u=new Set(n);if(h)for(const p of n)for(const k of no(i,p))u.add(k);const d=[...u].filter(p=>!!i?.entries[p]).sort(),v={index:i,blocks:l??{},versions:f??{}},b=d.some(p=>!ne(v,p)),w=JSON.stringify(d.map(p=>[p,i?.entries[p]?.version,ne(v,p)])),[_,S]=L.useState(null),[$,E]=L.useState(0),D=_?.key===w?_:null;L.useEffect(()=>{if(!e||!w)return;let p=!0;const k=JSON.parse(w).map(ho);return Fe(r,e,t,k).then(()=>{p&&S(P=>P?.key===w?null:P)},P=>{p&&S(Q=>({key:w,count:(Q?.key===w?Q.count:0)+1,retryAfterMs:co(P)}))}),()=>{p=!1}},[e,r,t,w,$]);let I;s[4]!==D||s[5]!==E?(I=()=>{if(!D)return;const p=Math.min(ct,D.retryAfterMs??Pt(ct,1e3,D.count-1,2,.5)),k=setTimeout(()=>E(fo),p);return()=>clearTimeout(k)},s[4]=D,s[5]=E,s[6]=I):I=s[6];let m;s[7]!==D?(m=[D],s[7]=D,s[8]=m):m=s[8],L.useEffect(I,m);const y=!e||qn(v,[...u],o?.listing),O=!!e&&b&&D!==null;let x;s[9]!==E?(x=()=>E(uo),s[9]=E,s[10]=x):x=s[10];let N;return s[11]!==y||s[12]!==O||s[13]!==x?(N={ready:y,failed:O,retry:x},s[11]=y,s[12]=O,s[13]=x,s[14]=N):N=s[14],N}function uo(e){return e+1}function fo(e){return e+1}function ho(e){const[t]=e;return t}const Ut=L.createContext(null);function go(e){const t=A.c(24),n=L.useContext(Ut),o=Qe(n?null:e),{data:s}=Nn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?De.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[l,c]=ut(a);let f;t[4]!==i||t[5]!==r||t[6]!==e?(f=i?De.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=f):f=t[7];const[h,u]=ut(f);if(n)return n;let d;t[8]!==l||t[9]!==i||t[10]!==o?(d=i&&o?At(l):null,t[8]=l,t[9]=i,t[10]=o,t[11]=d):d=t[11];const v=d,b=i&&o&&typeof h=="string"?h:null;let w;t[12]!==u||t[13]!==c||t[14]!==i?(w=$=>{i&&(c($),u($.endpoint))},t[12]=u,t[13]=c,t[14]=i,t[15]=w):w=t[15];let _;t[16]!==c||t[17]!==i?(_=()=>{i&&c(null)},t[16]=c,t[17]=i,t[18]=_):_=t[18];let S;return t[19]!==v||t[20]!==b||t[21]!==w||t[22]!==_?(S={connection:v,lastEndpoint:b,set:w,clear:_},t[19]=v,t[20]=b,t[21]=w,t[22]=_,t[23]=S):S=t[23],S}function lt(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function ut(e){const t=A.c(17),n=Z(),o=e??"";let s;t[0]!==o?(s=["localStorage",o],t[0]=o,t[1]=s):s=t[1];const r=s;let i,a;t[2]!==e?(i=()=>e?lt(e):null,a=()=>e?lt(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const l=!!e;let c;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==l?(c={queryKey:r,queryFn:i,initialData:a,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=l,t[9]=c):c=t[9];const{data:f}=F(c);let h;t[10]!==e||t[11]!==n||t[12]!==r?(h=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(r,b)}},t[10]=e,t[11]=n,t[12]=r,t[13]=h):h=t[13];const u=h,d=e?f??null:null;let v;return t[14]!==u||t[15]!==d?(v=[d,u],t[14]=u,t[15]=d,t[16]=v):v=t[16],v}function Bt(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function vo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function mr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Sr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function yr(e,t,n){return t!=="github"||!n?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function kr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Nt(t)?t:null}function Or(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function Ft(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function bo(e){if(!e.hasProject)return"legacy";const t=Ft(e);if(t==="local")return"protocol-local";if(!e.v8)return"legacy";if(t==="sandbox"){const o=e.sandboxSite;return o==="ready"?"protocol-sandbox":o==="error"?"retrying-sandbox":"pending"}const n=e.githubSite;return n==="ready"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":"pending"}function wo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function ft(e){return e.isError||e.errorUpdateCount>0}function po(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const s of n)Object.hasOwn(t,s)?o[s]=t[s]:delete o[s];return o}function mo(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const Ct="__noSchema";function Vt(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[Ct]:!0}}function Er(e){return!!e&&e[Ct]===!0}function Ve(e){if(!e.ok)return e.error.code===T.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function So(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const yo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Dr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},r=typeof s.__resolveType=="string"?s.__resolveType:null,i=t.get(r)??[];i.push({key:n,label:So(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(yo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:dt(n.resolveType).localeCompare(dt(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function dt(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function ht(e,t,n){if(t.length===0)return n;const[o,...s]=t;if(Array.isArray(e)&&typeof o=="number"){const r=e.slice();return r[o]=ht(e[o],s,n),r}if(e&&typeof e=="object"&&typeof o=="string"){const r=e,i={};for(const a of Object.keys(r))i[a]=a===o?ht(r[a],s,n):r[a];return i}return e}function Ir(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class gt extends Error{}const He="site-not-owned";async function ko(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Oo(e,t=n=>fetch(n)){const n=Me({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:we(o.signal)}));if(await ko(s))throw new gt;return s}});try{return await We(n)}catch(o){if(o instanceof gt)return He;throw o}}async function Eo(e,t,n){await t();const o=await Oo(e,n);return o===He?o:{...o,hosted:eo(e,n)}}const Je=5e3;function Do(e){if(!e.site)throw new Error("this project names no site");return An(e.site,e.branch)}function Io(e){return new URL(pe(e,"rpc"),window.location.origin).href}async function We(e){const[t,n]=await e.batch([{method:"describe"},{method:"schema.get"}]);if(!t?.ok)throw t?.error??new Error("no describe");if(t.result?.protocol!==Cn)throw new Ue;const s=Vn(t.result);if(!n)throw new Error("no schema.get");if(Ve(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function _o(e,t=n=>fetch(n)){return We(Me({endpoint:e,fetch:n=>t(new Request(n,{signal:we(n.signal)}))}))}function se(e,t){const n=A.c(40),{org:o}=jn(),{connection:s}=go(e),{runtime:r}=$t(e),i=L.useContext(Ut),a=Qe(e),l=It(Le(e)?.metadata),c=Ft({hasServeConnection:!!s,runtime:r}),f=Bt(c,s?.endpoint??""),h=Hn()?.taskId??null,u=Bn(Fn().lifecycle.phase),d=Z(),v=wo({mode:c,v8:a,workingTreeReady:u}),b=v.github&&!!o.slug&&!!e&&!!t,w=F({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Eo(Do({orgSlug:o.slug,site:l,branch:t}),()=>_t(l,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,...vt}),_=v.sandbox&&!!o.slug&&!!e&&!!t;let S;n[0]!==t||n[1]!==o.slug||n[2]!==h||n[3]!==e?(S=()=>_o(Io({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:h})),n[0]=t,n[1]=o.slug,n[2]=h,n[3]=e,n[4]=S):S=n[4];const $=F({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",h??""),queryFn:S,enabled:_,staleTime:Number.POSITIVE_INFINITY,...vt}),E=!!s;let D;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=D):D=n[8];let I;n[9]!==s?(I=()=>jo(s.endpoint),n[9]=s,n[10]=I):I=n[10];let m;n[11]!==E||n[12]!==D||n[13]!==I?(m={queryKey:D,queryFn:I,enabled:E,staleTime:Number.POSITIVE_INFINITY,retry:To,retryDelay:Ro,refetchInterval:xo},n[11]=E,n[12]=D,n[13]=I,n[14]=m):m=n[14];const y=F(m);let O;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(O=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=O):O=n[18];const x=O;let N;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(N=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=N):N=n[22];let p;n[23]!==y.data||n[24]!==x||n[25]!==d?(p=async()=>{try{return await y.data.client.describe()}catch(K){const In=K;throw d.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),In}},n[23]=y.data,n[24]=x,n[25]=d,n[26]=p):p=n[26];const k=!!y.data&&!i;let P;n[27]!==N||n[28]!==p||n[29]!==k?(P={queryKey:N,queryFn:p,enabled:k,refetchInterval:Je,retry:!1},n[27]=N,n[28]=p,n[29]=k,n[30]=P):P=n[30];const M=F(P).data??y.data?.describe,U=bo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:w.data===He?"not-owned":w.data?"ready":ft(w)?"error":"loading",sandboxSite:Po({data:$.data,isError:ft($),workingTreeReady:u})});if(U==="pending")return{kind:"pending",...f};if(U==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...f};if(U==="legacy")return{kind:"legacy"};if(U==="protocol-github")return{..._e(f,w.data),site:l};if(U==="site-not-owned-github")return{kind:"unavailable",...f,siteNotOwned:!0};if(U==="protocol-sandbox")return _e(f,$.data);if(U==="unavailable-github"){let K;return n[31]!==f?(K={kind:"unavailable",...f},n[31]=f,n[32]=K):K=n[32],K}const R=y.error??y.failureReason,H=s?.endpoint??"";let J;return n[33]!==M||n[34]!==y.data||n[35]!==y.failureCount||n[36]!==y.isError||n[37]!==H||n[38]!==R?(J=No({probed:y.data,isError:y.isError,failureCount:y.failureCount,failure:R,describe:M,endpoint:H}),n[33]=M,n[34]=y.data,n[35]=y.failureCount,n[36]=y.isError,n[37]=H,n[38]=R,n[39]=J):J=n[39],J}function xo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Je:!1}function Ro(e){return Yn(e+1)}function To(e,t){return!(t instanceof j)&&!(t instanceof Ue)}function Po(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const $o=3;function No(e){const t=Bt("local",e.endpoint),n=e.probed?_e(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<$o?n:{kind:"unavailable",...t,problem:zn(e.failure)}:n??{kind:"pending",...t}}const vt={retry:2,refetchInterval:e=>e.state.status==="error"?Je:!1};function _e(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function jo(e,t){return We(Me({endpoint:e,fetch:n=>fetch(n,{signal:we(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function xe(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Ao(e,t){return xe({...e,protocolSuffix:t.cacheKeySuffix})}function Mo(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function Lo(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,vo(t)])}function Qo(e,t,n){const o=A.c(21),s=Z(),r=se(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?Ao(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const l=lo(i?.hosted,a,t,n),c=e!==null;let f;o[3]!==r.kind||o[4]!==l||o[5]!==c?(f=Mo(c,r.kind,l),o[3]=r.kind,o[4]=l,o[5]=c,o[6]=f):f=o[6];const h=f,u=r.kind!=="legacy";let d;o[7]!==r||o[8]!==e?(d=Lo(e,r),o[7]=r,o[8]=e,o[9]=d):d=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==l||o[13]!==s||o[14]!==e?(v=()=>{if(l.retry(),!e||r.kind!=="unavailable")return;const w=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...w==="local"?["local"]:[e.branch,w])})},o[10]=r.kind,o[11]=r.source,o[12]=l,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==h||o[17]!==u||o[18]!==d||o[19]!==v?(b={...h,v8:u,scopeKey:d,retry:v},o[16]=h,o[17]=u,o[18]=d,o[19]=v,o[20]=b):b=o[20],b}function Ht(e){const t=A.c(12);let n;t[0]!==e?(n=De.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Mn(o,null),i=Qe(e);let a;t[2]!==s||t[3]!==e?(a=e?ot(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const c=i?null:a;let f,h;t[5]!==r?(f=d=>r(ot(d)),h=()=>r(null),t[5]=r,t[6]=f,t[7]=h):(f=t[6],h=t[7]);let u;return t[8]!==c||t[9]!==f||t[10]!==h?(u={url:c,setUrl:f,clear:h},t[8]=c,t[9]=f,t[10]=h,t[11]=u):u=t[11],u}const bt=6e4,Uo=2147483647;function Bo(e,t){if(e===null||e.trim()==="")return bt;const n=e.trim(),o=/^\d+(?:\.\d+)?$/.test(n)?Number(n)*1e3:/^[A-Za-z]{3}, /.test(n)?Math.max(0,Date.parse(n)-t):Number.NaN;return Number.isFinite(o)&&o>=0&&o<=Uo?o:bt}class Jt extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+Bo(o,s):null}status;retryAt}function Fo(e,t,n=Date.now()){const o=Pt(5e3,1e3,e,2,0);return t instanceof Jt&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function Ye(e,t){const n=await e.json().catch(()=>null),o=n!==null&&typeof n=="object"&&"error"in n&&typeof n.error=="string"?n.error:`${t} failed (${e.status})`;throw new Jt(o,e.status,e.headers.get("retry-after"))}function Co(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function wt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function me(e,t,n){return["decofile-write",e,t,n]}function Vo(e,t,n){return{id:me(e,t,n).join(":")}}class Ge extends Error{constructor(t,n,o=[],s=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=s,this.name="BlockConflictError"}blocks;fields;carriedStored}function ze(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function Xe(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function Ho(e,t){return Ye(e,t)}function Jo(e,t,n){e.setQueryData(g.decofileDraft(ze(t)),n)}function Wo(e,t){return e.getQueryData(g.decofileDraft(ze(t)))??null}async function Yo(e,t){return(await fetch(Xe(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function _r(e){const t=A.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?ze(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Go,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=F(o);return s??null}async function Go(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function zo(e,t){const n=await fetch(Xe(t),{cache:"no-store"});if(!n.ok)return Ye(n,"Read decofile");const o=await n.json();return o.token&&Jo(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function xr(e,t){const n=await fetch(Xe(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const s=await n.json().catch(()=>({}));throw s.code==="block-conflict"?new Ge(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return Ho(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Wt=3e3,Xo=15e3,Zo=2*6e4,Yt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Ko(e){return e<Zo?Wt:Xo}function qo(e,t=Yt){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,Ko(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:l,skip:c}=e();if(s||t.hidden()||c?.()){i();return}s=!0;let f;try{f=l()}catch{f=void 0}Promise.resolve(f).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const pt=()=>0;function es(e,t,n=Yt){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>qo(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,pt,pt)}function Gt(e,t){return pe(e,t)}function ts(e,t){return pe(e,"preview-fetch",{path:t})}function Rr(e){return Gt(e,"preview-invoke")}function Tr(e){return Gt(e,"catalog-invoke")}function zt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function ns(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&zt(n))return n}return null}function os(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??ns();return n&&zt(n)?new URL(t,n).toString():ts(e,t)}function ss(e){return os(e,"/.decofile")}function rs(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function mt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function is(e,t){const n=pe(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=rs(o.status);if(s==="absent")return{kind:"absent"};if(s==="unavailable")return{kind:"unavailable"};if(s==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const r=await o.json();return typeof r.content!="string"?{kind:"unavailable"}:{kind:"data",data:Jn(r.content)}}async function as(e,t){const n=await is(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function Pr(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok)return Ye(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function cs(e){return Le(e)?.metadata?.runtime?.path??null}function Re(e,t,n,o){const s=B(e),r=Object.keys(n?.changes??{}).find(a=>B(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>B(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(l=>B(l)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class Xt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function $r(e){return e instanceof j&&e.code===T.Conflict}function Zt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Ze extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class Ke extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function Nr(e,t){return(t instanceof Ze||t instanceof Ke)&&(t.message=Kt(e,t,"github")),t}function Kt(e,t,n){if(t instanceof Ze)return e("siteEditor.save.draftUnread");if(t instanceof Ke)return e("siteEditor.save.keptChanging");if(t instanceof Ge)return t.message;if(n==="local")return us(e,t);if(t instanceof j)switch(t.code){case T.Conflict:return e("siteEditor.save.conflict");case T.ReadOnly:return e("siteEditor.save.readOnly");case T.InvalidBlock:case T.InvalidParams:return e("siteEditor.save.invalid");case T.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function ls(e,t){if(t==="local"||e instanceof Ge||e instanceof Ze||e instanceof Ke)return null;if(e instanceof j){const n=e.code===T.InvalidBlock||e.code===T.InvalidParams?Zt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function us(e,t){if(t instanceof Xt)return e("decoServe.save.serverGone");if(t instanceof j)switch(t.code){case T.Conflict:return e("decoServe.save.conflict");case T.ReadOnly:return e("decoServe.save.readOnly");case T.InvalidBlock:case T.InvalidParams:return e("decoServe.save.invalid",{detail:Zt(t)});case T.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function fs(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function ds(e,t){const[n,o]=L.useState(e),s=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){s.current??=Date.now();return}if(!n)return;const r=()=>{s.current=null,o(!1)},i=fs(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const hs="decocms:content-writes",Te=new Set;let G;function qt(){if(G!==void 0)return G;G=null;try{typeof BroadcastChannel=="function"&&(G=new BroadcastChannel(hs),G.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Te])n(t)}))}catch{G=null}return G}function gs(e){try{qt()?.postMessage({cacheKey:e})}catch{}}function vs(e){return qt(),Te.add(e),()=>{Te.delete(e)}}const en="__at=",tn="__test=",bs=/^[0-9a-f]{12}-[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function ws(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&bs.test(e)}function St(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function ps(e){const t=e.tests??{};return[...e.at!==void 0?[en+St(e.at)]:[],...Object.keys(t).map(n=>tn+St(`${n}=${t[n]?"on":"off"}`))]}function yt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(en)&&!s.startsWith(tn)),...t];return o.length>0?`?${o.join("&")}`:""}function de(e,t){const n=ps(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+yt(o===-1?"":e.slice(o+1),n);const r=e.lastIndexOf("@");if(r<=0)return e;const i=e.slice(0,r),a=i.indexOf("?"),l=a===-1?i:i.slice(0,a),c=a===-1?"":i.slice(a+1);return`${l}${yt(c,n)}${e.slice(r)}`}function jr(e,t,n){if(!ws(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",de(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",de(n,t)),o.toString()):e}catch{return e}}function Ar(e,t,n="/"){if(!e||!ee(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function nn(e){return btoa(encodeURIComponent(e))}function Mr(e,t,n){const o=ms(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function ms(e,t,n){const o=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return s.searchParams.set("path","/"),s.searchParams.set("pathTemplate","/"),s.searchParams.set("props",nn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Ss="__draft";function Lr(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const ys="off";function ks(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Ss,t),n.toString()}function Qr(e){const t=e.pageBlock.__resolveType;if(typeof t!="string"||!t)return null;const n=new URL(e.previewBaseUrl).origin,o=new URL(`/live/previews/${encodeURIComponent(t)}`,n);o.searchParams.set("__decoFBT","0"),o.searchParams.set("__d",""),o.searchParams.set("path",e.path),o.searchParams.set("pathTemplate",e.pathTemplate);const{__resolveType:s,...r}=e.pageBlock,i=JSON.stringify({__props:r,__decofile:e.decofile});return{src:o.toString(),body:i}}function Ur(e,t,n,o){const s=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,s);r.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),r.searchParams.set("props",nn(JSON.stringify({sections:i}))),r.toString()}function Br(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const kt="__variant=";function on(e,t,n){return`${e}@${t}=${n}`}function Fr(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[on(e,"sections",t.index)]}function Cr(e){const t=Array.isArray(e.mvObj.variants)?e.mvObj.variants:[];if(!e.pageKey||e.sectionIndex<0)return[];if(e.selectedVariantIndex<0||e.selectedVariantIndex>=t.length)return[];const o=`${e.page.multivariate?`sections.variants.${e.page.index}.value${e.page.lazyValues?".value":""}`:"sections"}.${e.sectionIndex}${e.sectionLazy?".section":""}`;return[on(e.pageKey,o,e.selectedVariantIndex)]}function Vr(e,t){return[...t,...e]}function Os(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function qe(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),s=o.indexOf("?"),r=s===-1?o:o.slice(0,s),a=[...s===-1?[]:o.slice(s+1).split("&").filter(c=>c&&!c.startsWith(kt)),...t.map(c=>kt+Os(c))],l=a.length>0?`?${a.join("&")}`:"";return`${r}${l}${e.slice(n)}`}function Hr(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),s=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return qe(`${s}${o.pathname}@local`,t)}catch{return null}}function Jr(e,t){if(t.length===0)return e;try{const n=new URL(e),o=n.searchParams.get("__draft");return!o||o==="off"?e:(n.searchParams.set("__draft",qe(o,t)),n.toString())}catch{return e}}function Es(e){const{pointer:t}=e;if(!t||t===ys)return null;const n=t.indexOf("?");return ee(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:ee(e.heldRevision)&&e.forcedVariants.length===0?de(e.heldRevision,e.previewOptions):de(qe(t,e.forcedVariants),e.previewOptions)}function Ds(e,t){if(!e||!t)return null;try{return ks(e,t)}catch{return null}}function Wr(e,t,n){if(!e||!n)return null;try{return Ds(new URL(t,e).toString(),n)}catch{return null}}const he={forcedVariants:[],previewOptions:{}},ie=new Map,ae=new Map,Pe=new Map;function sn(e){for(const t of Pe.get(e)??[])t()}function rn(e,t){const n=ee(t)?t:null;(ae.get(e)??null)!==n&&(n?ae.set(e,n):ae.delete(e),sn(e))}function Is(e){return ae.get(e)??null}function _s(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Yr(e,t){const n=ie.get(e)??he,o=t??he;_s(n,o)||(t?ie.set(e,o):ie.delete(e),sn(e))}function xs(e){return ie.get(e)??he}function an(e,t){let n=Pe.get(e);return n||(n=new Set,Pe.set(e,n)),n.add(t),()=>{n.delete(t)}}function Rs(e){const t=A.c(3);let n,o;return t[0]!==e?(n=s=>an(e,s),o=()=>xs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ts)}function Ts(){return he}function Ps(e){const t=A.c(3);let n,o;return t[0]!==e?(n=s=>e?an(e,s):Ns,o=()=>e?Is(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,$s)}function $s(){return null}function Ns(){}function Gr(e,t){const n=A.c(4),o=Rs(e),s=Ps(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Es({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const cn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},js=15e3,ge=new Map;function W(e,t){return`${e}/${t}`}function V(e){let t=ge.get(e);return t||(t={state:cn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ge.set(e,t)),t}function C(e,t){const n=V(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Se(e){e.timer&&clearTimeout(e.timer),e.timer=null}function ve(e){return ge.get(e)?.state??cn}function As(e,t){const n=V(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function zr(e){const t=V(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Se(t),C(e,{phase:"idle"}))}}function Xr(e){const t=ge.get(e);!t||t.state.phase!=="reloading"||(Se(t),C(e,{phase:"idle"}))}function ln(e){const t=V(e);Se(t),C(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ce(e,t){const n=V(e),o=Math.max(0,n.state.inFlight-1);if(o>0){C(e,{inFlight:o});return}if(!t.ok||n.previews===0){C(e,{phase:"idle",inFlight:o});return}un(e,t.navigates,o)}function un(e,t,n=0){const o=V(e);Se(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&C(e,{phase:"idle"})},js),C(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Ms(e){return e?.kind==="protocol"&&e.source==="github"}async function le(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,l=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol"){const v=a&&t.reread?n.invalidateQueries({queryKey:g.decofile(a)}):null;if(await Promise.all([l,v]),v&&t.kind!=="edit"){const b=W(o,s);C(b,{epoch:ve(b).epoch+1})}return{navigates:!1}}const c=r?g.protocolDraftRead(o,s,r):null,f=c?JSON.stringify(n.getQueryData(c)??null):null,h=l?[l]:[];if(a&&t.reread&&h.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&h.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&h.push(n.invalidateQueries({queryKey:Wn(o,s,r)})),Ms(i)&&c&&!t.adopted&&h.push(n.invalidateQueries({queryKey:c})),await Promise.all(h),t.kind!=="edit"){const v=W(o,s);C(v,{epoch:ve(v).epoch+1})}const u=c?JSON.stringify(n.getQueryData(c)??null):null,d=f!==u;return d&&await new Promise(v=>xt.schedule(v)),{navigates:d}}async function Ls(e,t){return ln(W(e.orgSlug,e.virtualMcpId)),fn(e,t)}function Ot(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function fn(e,t){const n=W(e.orgSlug,e.virtualMcpId),o=t.adopted?Ot(e):null;let s;try{s=await t.write()}catch(i){throw ce(n,{ok:!1,navigates:!1}),t.refreshOnError&&le(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&gs(e.cacheKey),rn(n,t.shownRevision?.(s)??null),t.adopted){const i=Ot(e)!==o;return i&&await new Promise(a=>xt.schedule(a)),ce(n,{ok:!0,navigates:i}),t.reread&&le(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await le(e,t))}catch{}finally{ce(n,{ok:!0,navigates:r})}return s}function Zr(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=W(o,s),a=new Set(t.blockKeys);for(const f of[...V(i).discardListeners])f(a);ln(i);let l=!1;const c=()=>(l=!0,fn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:me(o,s,r),scope:Vo(o,s,r),mutationFn:c}).execute(void 0).catch(f=>{throw l||ce(i,{ok:!1,navigates:!1}),f}):c()}function Kr(e,t,n){const o=A.c(8);let s;o[0]!==e||o[1]!==t?(s=W(e,t),o[0]=e,o[1]=t,o[2]=s):s=o[2];const r=s;let i;o[3]!==n||o[4]!==r?(i=()=>{const l=V(r).discardListeners;return l.add(n),()=>{l.delete(n)}},o[3]=n,o[4]=r,o[5]=i):i=o[5];let a;o[6]!==r?(a=[r],o[6]=r,o[7]=a):a=o[7],L.useEffect(i,a)}function dn(e){const t=W(e.orgSlug,e.virtualMcpId);ve(t).inFlight>0||(rn(t,null),le(e,{kind:"external"}).then(({navigates:n})=>{const o=V(t);o.previews>0&&o.state.inFlight===0&&un(t,n)}).catch(()=>{}))}function Qs(e,t){const n=A.c(7);let o;n[0]!==e||n[1]!==t?(o=W(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=c=>As(s,c),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>ve(s),n[5]=s,n[6]=a):a=n[6];const l=a;return L.useSyncExternalStore(i,l,l)}const Us=500;function qr(e,t){const{phase:n}=Qs(e,t);return ds(n!=="idle",Us)}function Bs(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function hn(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function ei(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?oo(i,n):Fs(e,t,n)}const s=e.getQueryData(g.contentVersions(t));if(!s)return;if(Object.hasOwn(s,n))return s[n];const r=e.getQueryData(g.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function gn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=B(t),o=Object.keys(e.changes).find(s=>B(s)===n);return o===void 0?void 0:e.changes[o]}function Fs(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return vn(o,ye(e,t),n)}function vn(e,t,n){const o=gn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(B(n))?X:null}function ti(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=gn(o,n);return s?s.kind==="set"&&s.baseVersion===null:ye(e,t).has(B(n))}function ni(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=ye(e,t);return{blocks:n,versionOf:r=>vn(o,s,r)}}function ye(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function be(e,t,n,o){const s=B(n),r=ye(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),Y(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function bn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([u,d])=>[u,d===X?null:d]),a=e.getQueryData(g.contentChanges(n)),l=e.getQueryData(g.contentIndex(n)),c=new Set(i.flatMap(([u])=>Re(u,l,a,r)===null?[u]:[])),f=new Set(i.flatMap(([u,d])=>d===null?[]:[B(u)]));e.setQueryData(g.contentChanges(n),u=>{if(!u)return u;const d={...u.changes};for(const[v,b]of i){const w=Re(v,l,u,r);b!==null?d[v]={kind:"set",version:b,baseVersion:w}:w!==null?d[v]={kind:"delete",version:null,baseVersion:w}:delete d[v]}return{...u,changes:d,edited:!0}});for(const[u,d]of i)d!==null?be(e,n,u,!1):!f.has(B(u))&&c.has(u)&&be(e,n,u,!0);const h=o.revision;return h&&h!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),u=>u&&{...u,version:h}),s}function ke(e,t,n){Y(e),e.setQueryData(g.contentVersions(t),o=>{const s={...o};for(const[r,i]of Object.entries(n))i===null?delete s[r]:s[r]=i;return s})}function wn(e,t){const n=e.getMutationCache().findAll({mutationKey:me(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>mo(o.state.variables)))}function $e(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function oe(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof j);throw t.source==="local"&&r?($e(e,n),new Xt(s)):(t.source==="local"&&Ae(s)&&$e(e,n),s)}}const Et=new WeakMap;function et(e){let t=Et.get(e);return t||(t={inFlight:new Map,rereading:new Set},Et.set(e,t)),t}function pn(e,t,n,o){const{inFlight:s}=et(e),r=s.get(o);if(r)return r;const i=tt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function Cs(e,t,n){const o=A.c(8),s=Z(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let l,c;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(l=()=>{if(!e||!r||!i||!a)return;const f={orgSlug:r,virtualMcpId:i,branch:a},{rereading:h}=et(s);return vs(u=>{u===n&&(h.has(n)||(h.add(n),Hs(s,e,f,n).catch(Vs).finally(()=>h.delete(n))))})},c=[s,e,r,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=r,o[4]=s,o[5]=i,o[6]=l,o[7]=c):(l=o[6],c=o[7]),L.useEffect(l,c)}function Vs(){}async function Hs(e,t,n,o){const s=et(e).inFlight.get(o);return s&&await s.catch(()=>{}),pn(e,t,n,o)}async function tt(e,t,n,o,s){Y(e);const r=g.decofile(o),i=hn(n,t),a=g.contentRevision(o),l=g.contentVersions(o),c=e.getQueryData(r),f=e.getQueryData(l),u=e.getQueryData(i),d=e.getQueryData(a)??void 0,v=s&&c&&f?d?.revision:void 0,b=s&&u?d?.schemaVersion:void 0,w=g.contentChanges(o),_=e.getQueryData(w);if(t.source==="github"&&t.hosted)return Js(e,t,t.hosted,n,o,{conditional:s,seen:d,currentMeta:u,schemaIfNoneMatch:b,seenChanges:_});const[S,$,E]=await oe(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:Rt(_)}])),D=e.getQueryData(a)?.revision,I=D!==void 0&&D!==d?.revision;if(E?.ok){const k=I?null:Tt(_,E.result);k&&e.setQueryData(w,k)}else E&&t.source==="local"&&Ae(E.error)&&$e(e,n);if(!S?.ok)throw S?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const m=S.result,y=Ve($),O=$.ok&&!y?$.result:null;if(m.notModified&&(!c||!f)||O?.notModified&&!u)return tt(e,t,n,o,!1);const x=m.notModified?new Set:wn(e,n),N=m.notModified?c:po(m.blocks,c,x),p=y?Vt():O?O.notModified?u:O.schema:$.error;if(e.setQueryData(a,{revision:I?D:m.notModified?d?.revision:m.revision,schemaVersion:O?O.notModified?d?.schemaVersion:O.version??void 0:void 0}),e.setQueryData(r,N),!m.notModified){const k=e.getQueryData(l),P={...m.versions};for(const Q of x){const M=k?.[Q];M!==void 0?P[Q]=M:delete P[Q]}e.setQueryData(l,P)}return p instanceof j||e.setQueryData(i,p),!I&&!m.notModified&&c&&d?.revision&&m.revision!==d.revision&&dn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:N,meta:p}}async function Js(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),l=g.contentRevision(s),c=g.contentVersions(s),f=hn(o,t),h=g.contentChanges(s),u=e.getQueryData(a),d=r.conditional&&u?r.seen?.revision:void 0,[v,b,w]=await oe(e,t,o,()=>n.batch([{method:"cms.index",params:d?{ifNoneMatch:d}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:Rt(r.seenChanges)}])),_=e.getQueryData(a)??u,S=e.getQueryData(l)?.revision,$=S!==void 0&&S!==r.seen?.revision;if(w?.ok&&!$){const R=Tt(r.seenChanges,w.result);R&&e.setQueryData(h,R)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const E=v.result,D=Ve(b),I=b.ok&&!D?b.result:null;if(E.notModified&&!u||I?.notModified&&!r.currentMeta)return tt(e,t,o,s,!1);const m=D?Vt():I?I.notModified?r.currentMeta:I.schema:b.error;m instanceof j||e.setQueryData(f,m);const y=I?I.notModified?r.seen?.schemaVersion:I.version??void 0:void 0,O=e.getQueryData(i)??{};if(E.notModified||$)return e.setQueryData(l,{revision:$?S:r.seen?.revision,schemaVersion:y}),e.setQueryData(i,O),{blocks:O,meta:m};const x={revision:E.revision,resolvedRef:E.resolvedRef,sequence:E.sequence,entries:E.entries,draft:E.draft};e.setQueryData(a,x);const N=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!u&&mn(u.draft,x.draft));N&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),R=>R&&{...R,version:x.revision}),e.setQueryData(l,{revision:x.revision,schemaVersion:y});const p=wn(e,o),k=e.getQueryData(c)??{},P={},Q={},M=[];for(const[R,H]of Object.entries(O)){const J=x.entries[R];!J&&!p.has(R)||(P[R]=H,k[R]!==void 0&&(Q[R]=k[R]),J&&!p.has(R)&&k[R]!==J.version&&M.push(R))}return e.setQueryData(i,P),e.setQueryData(c,Q),M.length>0&&await Fe(e,n,s,M,p),_&&N&&Ws(_,x)&&dn({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??P,meta:m}}function Ws(e,t){if(mn(e.draft,t.draft))return!0;const n=Object.keys(t.entries);return n.length!==Object.keys(e.entries).length?!0:n.some(o=>!Object.hasOwn(e.entries,o)||e.entries[o]?.version!==t.entries[o]?.version)}function mn(e,t){const n=Object.keys(t);return n.length!==Object.keys(e).length?!0:n.some(o=>!Object.hasOwn(e,o)||e[o]?.version!==t[o]?.version)}function Ys(e,t){const n=[...Object.keys(t.set??{}),...t.delete??[]];return Object.fromEntries(n.filter(o=>Object.hasOwn(e,o)).map(o=>[o,e[o]]))}function Ee(e){if(!(e instanceof j)||e.code!==T.Unavailable)return;const t=e.data?.landed;if(!(!t||typeof t!="object"||Array.isArray(t)))return Object.fromEntries(Object.entries(t).filter(n=>typeof n[1]=="string"))}async function Gs(e,t){if(!(e instanceof j)||e.code!==T.Conflict)return;const n=e.data?.entries;if(!n||typeof n!="object")return;const o=Object.entries(n);if(o.length===0)return;const s=t.set??{},r=new Set(t.delete??[]),i={};for(const[a,l]of o){const c=l?.actual;if(typeof c!="string"||(Object.hasOwn(s,a)?await Un(s[a]):r.has(a)?X:void 0)!==c)return;i[a]=c}return i}function zs(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([s])=>!Object.hasOwn(t,s))),o=(e.delete??[]).filter(s=>!Object.hasOwn(t,s));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function re(e,t,n,o,s){Y(e),bn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),ke(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),Qt(e,n,s,o.set??{})}async function oi(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(c=>!r||!Object.hasOwn(r,c));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const l=Ln(s.set);if(l.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${l.join(", ")})`)}return Ls({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=(f,h=r)=>oe(e,t,n,()=>t.client.blocksApply({set:f.set,delete:f.delete,...h?{ifMatch:Ys(h,f)}:{}}));let a;try{a=await i(s)}catch(f){const h=t.source==="github"?Ee(f):void 0;if(!h)throw f;const u=zs(s,h);Object.keys(h).length>0&&re(e,n,o,s,h);let d;try{d=await i(u)}catch(v){const b=Ee(v);b&&Object.keys(b).length>0&&re(e,n,o,u,b);const w=await Gs(v,u);if(!w)throw v;re(e,n,o,u,w);try{d=await i(u,{...r,...w})}catch(_){const S=Ee(_);throw S&&Object.keys(S).length>0&&re(e,n,o,u,S),_}}a={...d,versions:{...h,...d.versions}}}Y(e);const l=t.source==="github"?bn(e,n,o,a):a.revision;t.source==="github"&&Qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),f=>({...f,revision:l}));const c=a.versions??{};return ke(e,o,c),{revision:l,versions:c}}})}function Sn(e,t){if(!(e instanceof j))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function yn(e,t,n){if(!(n instanceof j))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&be(e,t,s,!1)}function kn(e,t,n,o){Y(e),Qn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=Re(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const l=B(n),c=Object.fromEntries(Object.entries(i.changes).filter(([f])=>B(f)!==l));s?a!==null&&(c[n]={kind:"delete",version:null,baseVersion:a}):c[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:c,edited:!0})}be(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),l=>{const c={...l};return s?delete c[n]:c[n]=o.block,c}),ke(e,t,{[n]:s?null:o.version}),so(e,t,n,o)}function si(e,t,n,o){if(t.source!=="github"||!(o instanceof j))return!1;yn(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>Sn(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,l)=>{kn(e,n,a,i[l])}),!0)}async function ri(e,t,n,o,s,r){t.source==="github"&&yn(e,o,r);const i=t.source==="github"?Sn(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),kn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const c=(await oe(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(c&&c.after===null&&c.version!==null)return!1;a={value:c?.after??null,version:c?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),f=>{if(!f)return f;const h={...f.changes};return c?.kind?h[s]={kind:c.kind,version:c.version,baseVersion:c.baseVersion}:delete h[s],{...f,changes:h,edited:!0}})}catch{const l=await oe(e,t,n,()=>t.client.blocksList({}));if(l.notModified)return!1;a={value:l.blocks[s]??null,version:l.versions[s]??null}}return e.setQueryData(g.decofile(o),l=>{const c={...l};return a.value===null?delete c[s]:c[s]=a.value,c}),ke(e,o,{[s]:a.version}),!1}function Xs(e){const t=A.c(17),n=Le(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=It(n),t[0]=n,t[1]=o):o=t[1];const s=o;let r;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(r=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=r):r=t[5];let i;t[6]!==e||t[7]!==s?(i=async()=>{const b=await _t(s,e.branch),w=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&w>0?b.pointer.slice(0,w):null,version:b.pointer&&w>0?b.pointer.slice(w+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let l;t[9]!==r||t[10]!==i||t[11]!==a?(l={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=l):l=t[12];const{data:c,isPending:f,isError:h}=F(l),u=!!e&&!!s&&f&&!h;if(!e||!c?.draft||!c.version){let b;return t[13]!==u?(b={pointer:null,pending:u},t[13]=u,t[14]=b):b=t[14],b}const d=`${c.draft}@${c.version}`;let v;return t[15]!==d?(v={pointer:d,pending:!1},t[15]=d,t[16]=v):v=t[16],v}function ii(e){return Xs(e).pointer}function ai(e){const t=A.c(4);let n;t[0]!==e?(n=g.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Zs,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=F(o);return s?.revision}async function Zs(){throw new Error("content revisions are set by reads and writes")}function nt(e,t){const n=A.c(6),{url:o}=Ht(e?.virtualMcpId),s=se(e?.virtualMcpId,e?.branch);if(!e)return"";let r;return n[0]!==s.cacheKeySuffix||n[1]!==s.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(r=s.kind!=="legacy"&&s.cacheKeySuffix!==void 0?xe({...e,protocolSuffix:s.cacheKeySuffix}):xe({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=s.cacheKeySuffix,n[1]=s.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=r):r=n[5],r}function ci(e,t){const n=A.c(46),{url:o}=Ht(e?.virtualMcpId),s=!!o,r=se(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=nt(e),l=t?.fetchEnabled??!0,c=cs(e?.virtualMcpId),f=$t(e?.virtualMcpId).runtime==="cms",h=Z();let u;n[0]!==a?(u=g.decofile(a),n[0]=a,n[1]=u):u=n[1];const d=u;Cs(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==h||n[4]!==d?(v=()=>{if(!e||h.isMutating({mutationKey:me(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const k=h.getQueryState(d);return k?.fetchStatus==="fetching"||Date.now()-(k?.dataUpdatedAt??0)<Wt/2},n[2]=e,n[3]=h,n[4]=d,n[5]=v):v=n[5];let b;n[6]!==f||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==h||n[11]!==d?(b=async()=>{if(e){if(!i&&f&&!s){const k=Wo(h,e)?.version;if(k&&!await Yo(e,k))return}await h.refetchQueries({queryKey:d,exact:!0},{cancelRefetch:!1})}},n[6]=f,n[7]=s,n[8]=e,n[9]=i,n[10]=h,n[11]=d,n[12]=b):b=n[12];let w;n[13]!==v||n[14]!==b?(w={skip:v,read:b},n[13]=v,n[14]=b,n[15]=w):w=n[15],es(!!t?.pollWhile&&!!e,w);const _=Ce(i?.hosted?a:"");let S;n[16]!==r.kind||n[17]!==f||n[18]!==l||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==c||n[23]!==e||n[24]!==i||n[25]!==h?(S=async()=>{if(i)return(await pn(h,i,e,a)).blocks;if(r.kind==="unavailable")throw Bs("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(qs),U=M?.ok?wt(await M.text()):null;if(U)return U;const R=new Error("decofile unavailable (local tunnel unreachable)");throw R.status=502,R}if(f)return zo(h,e);const k=()=>as(e,Co(c,".deco/blocks.gen.json"));if(l){const M=await fetch(ss(e),{cache:"no-store"}).catch(Ks);if(M?.ok){const H=wt(await M.text());if(H)return H}const U=await k();if(U.kind==="data")return U.data;const R=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw R.status=mt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:U.kind==="absent"}),R}const P=await k();if(P.kind==="data")return P.data;const Q=new Error("decofile unavailable (preview down, no committed snapshot)");throw Q.status=mt({liveOk:!1,committedAbsent:P.kind==="absent"}),Q},n[16]=r.kind,n[17]=f,n[18]=l,n[19]=a,n[20]=s,n[21]=o,n[22]=c,n[23]=e,n[24]=i,n[25]=h,n[26]=S):S=n[26];const $=!!e&&r.kind!=="pending",E=i?0:3e4,D=i?.describe.pollIntervalMs,I=i?"always":void 0;let m;n[27]!==f||n[28]!==s||n[29]!==i?(m=(k,P)=>{if(i||f||s)return k<3;const Q=P.status;return Q!==502&&Q!==404&&k<2},n[27]=f,n[28]=s,n[29]=i,n[30]=m):m=n[30];let y;n[31]!==d||n[32]!==S||n[33]!==$||n[34]!==E||n[35]!==D||n[36]!==I||n[37]!==m?(y={queryKey:d,queryFn:S,enabled:$,staleTime:E,refetchInterval:D,refetchIntervalInBackground:!1,refetchOnWindowFocus:I,retry:m,retryDelay:Fo},n[31]=d,n[32]=S,n[33]=$,n[34]=E,n[35]=D,n[36]=I,n[37]=m,n[38]=y):y=n[38];const O=F(y);let x;n[39]!==_||n[40]!==O?(x=_&&O.data?to(_,O.data):void 0,n[39]=_,n[40]=O,n[41]=x):x=n[41];const N=x;let p;return n[42]!==N||n[43]!==i?.hosted||n[44]!==O?(p=i?.hosted&&N?{...O,data:N}:O,n[42]=N,n[43]=i?.hosted,n[44]=O,n[45]=p):p=n[45],p}function Ks(){return null}function qs(){return null}function li(e,t,n){return Qo(e,t,n)}function ui(e){const t=A.c(4),n=Z(),o=se(e?.virtualMcpId,e?.branch),s=nt(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,l)=>ro(n,r,s,a,l),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function fi(e,t){const n=A.c(3),o=se(e?.virtualMcpId,e?.branch),s=nt(e),r=Ce(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,l]=a;return t(l.meta?.type??"")}).map(er),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function er(e){const[t]=e;return t}const tr="site-editor-save",On={id:tr,description:void 0,action:void 0,cancel:void 0},di="site-editor-undo",Ne="site-editor-publish";function nr(e){const t=A.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=z.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=s):s=t[1];let r;t[2]!==o?(r=z.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=r):r=t[3];let i;return t[4]!==s||t[5]!==r?(i=z.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function En(e,t){return t?z.jsx(nr,{label:e("siteEditor.details"),detail:t}):void 0}function hi(e,t,n){te.error(Kt(e,t,n),{...On,description:En(e,ls(t,n))})}function gi(e,t,n=!1){te.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...On,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Dn={action:void 0,duration:void 0};function vi(e,t){te.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Dn,id:Ne,description:void 0})}function bi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=En(e,o??null);te[i](t,{id:Ne,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:l=>{l.preventDefault(),te.loading(r??e("thread.publishPopover.publishing"),{...Dn,id:Ne,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function wi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Ho as $,Ds as A,ws as B,as as C,Ft as D,Br as E,yr as F,Xs as G,W as H,Ps as I,Yr as J,Hr as K,de as L,ys as M,ks as N,jr as O,Jr as P,Mr as Q,Xr as R,zr as S,Ut as T,Qs as U,ai as V,Qr as W,Vo as X,me as Y,Ls as Z,is as _,pr as a,vo as a0,Ao as a1,Dr as a2,dt as a3,ht as a4,Ir as a5,Sr as a6,Or as a7,Gn as a8,En as a9,ei as aA,Kr as aB,ni as aC,Jo as aD,xr as aE,Ke as aF,_r as aG,ii as aH,Lr as aI,si as aJ,ee as aK,Ar as aL,bi as aM,di as aN,On as aO,Fe as aP,wn as aQ,to as aR,Ur as aS,Tr as aT,Fr as aU,Cr as aV,Vr as aW,wi as aa,ms as ab,hn as ac,nr as ad,Gr as ae,Wr as af,Qo as ag,os as ah,pn as ai,Bs as aj,Fo as ak,Pr as al,Ne as am,Dn as an,vi as ao,Zr as ap,gi as aq,ti as ar,Nr as as,Ge as at,$r as au,Hs as av,Ze as aw,oi as ax,ri as ay,hi as az,go as b,Ht as c,ui as d,wr as e,fi as f,qr as g,kr as h,mr as i,ci as j,li as k,Yn as l,zn as m,Nt as n,jo as o,gr as p,Rr as q,br as r,vr as s,ts as t,se as u,nt as v,Er as w,cs as x,Co as y,Es as z};
1
+ import{aH as Dt,aI as q,bp as je,bx as _n,dA as Oe,dy as xn,ev as we,c as A,i as F,ew as Rn,ex as Tn,q as Z,r as L,ey as Pn,K as g,ez as Y,eA as X,bC as $n,a as Nn,av as De,a6 as jn,by as It,eB as An,eC as _t,at as Mn,bt as B,ee as xt,eD as Ln,eE as Qn,eF as Un,t as te,j as z}from"./index-BuZqAz74.js";import{C as j,E as T,i as Ae,e as Bn,u as Fn,P as Cn,f as Vn,g as Me,h as Rt,j as Tt}from"./use-sandbox-events-BcrE-YTF.js";import{b as Le}from"./repository-binding-VVfcdUiy.js";import{e as Pt}from"./backoff-CrEUbyZT.js";import{b as pe}from"./sandbox-url-D3mC8qhT.js";import{u as Hn}from"./chat-context-DG5tQFfU.js";import{u as Qe}from"./use-blocks-v8-project-Dh0QtV4J.js";import{u as $t}from"./use-voice-input-poVZeRVs.js";import{s as ot}from"./session-runtime-HHtypsTM.js";import{s as Jn}from"./utils-BdAsQahL.js";import{a as Wn}from"./sandbox-git-api-CkSQDoxX.js";function Nt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function ue(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const jt=Dt({endpoint:q().max(2048).refine(e=>Nt(e)&&new URL(e).pathname==="/rpc").transform(ue)});function gr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=jt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function At(e){const t=jt.safeParse(e);return t.success?t.data:null}const Mt="studio:deco-serve-last";function vr(e){try{localStorage.setItem(Mt,JSON.stringify(e))}catch{}}function br(){try{const e=localStorage.getItem(Mt);return e?At(JSON.parse(e)):null}catch{return null}}function wr(e){try{return new URL(ue(e)).host}catch{return e}}function Yn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Gn="http://localhost:4545/rpc";class Ue extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zn(e){if(e instanceof Ue)return{reason:"not-deco-serve"};if(!(e instanceof j))return{reason:"not-answering"};switch(e.code){case T.Unauthorized:case T.MethodNotFound:return{reason:"outdated"};case T.Unsupported:return Ae(e)?{reason:"outdated"}:{reason:"version-mismatch"};case T.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function pr(e,t){if(e)return[ue(e.endpoint)];const n=[t?.endpoint,Gn].filter(o=>!!o).map(ue);return[...new Set(n)]}const Xn=Dt({blocks:Oe(q(),Oe(q(),xn()).refine(je)),versions:Oe(q(),q().min(1)),missing:_n(q())});function Zn(e,t){const n=Xn.parse(e),o=Object.keys(n.blocks),s=Object.keys(n.versions),r=[...o,...n.missing],i=new Set(t);if(s.length!==o.length||o.some(a=>!Object.hasOwn(n.versions,a))||r.length!==i.size||new Set(r).size!==r.length||r.some(a=>!i.has(a)))throw new Error("The CMS block response did not account for the requested names");return n}function ne(e,t){const n=e.index?.entries[t];return!!n&&je(e.blocks[t])&&e.versions[t]===n.version}function Kn(e,t,n){const o=new Map;let s=!1;for(const[r,i]of Object.entries(n.blocks)){const a=t.index?.entries[r];if(a){if(n.versions[r]!==a.version){s||=a.version===e.index?.entries[r]?.version;continue}t.blocks[r]!==e.blocks[r]||t.versions[r]!==e.versions[r]||o.set(r,i)}}return s||=n.missing.some(r=>!!t.index?.entries[r]),{blocks:o.size?{...t.blocks,...Object.fromEntries(o)}:t.blocks,versions:o.size?{...t.versions,...Object.fromEntries([...o.keys()].map(r=>[r,n.versions[r]]))}:t.versions,refreshIndex:s}}function qn(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?ne(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const st=50,rt=10;function eo(e,t=n=>fetch(n)){let n=1;return{async batch(o){const s=o.map(()=>n++),r=await t(new Request(e,{method:"POST",headers:{"content-type":"application/json"},credentials:"include",signal:we(),body:JSON.stringify(o.map((l,c)=>({jsonrpc:"2.0",id:s[c],method:l.method,params:l.params??{}})))}));if(!r.ok)throw new j(T.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(l=>[l.id,l]));return s.map(l=>{const c=a.get(l);return c?c.error?{ok:!1,error:j.from(c.error)}:{ok:!0,result:c.result}:{ok:!1,error:new j(T.InternalError,"no response for this call")}})}}}function to(e,t){if(!e)return t??{};const n={};for(const[o,s]of Object.entries(e.entries)){if(t&&Object.hasOwn(t,o)){n[o]=t[o];continue}n[o]={[Tn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Rn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function no(e,t){return e?.entries[t]?.meta?.refs??[]}function oo(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Be(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ie(e,t){if(Array.isArray(e)){for(const n of e)Ie(n,t);return}if(Be(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):Ie(o,t)}function Lt(e,t){if(!Be(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;Ie(e,o);const s=[...o].filter(r=>t.has(r)).sort();return s.length>0&&(n.refs=s),Object.keys(n).length>0?n:void 0}function Qt(e,t,n,o){Y(e),e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.entries},i={...s.draft},a=new Set([...Object.keys(r),...Object.keys(o)]);for(const[l,c]of Object.entries(n)){const f=i[l]?.editor??null;if(c===null||c===X){delete r[l],i[l]={operation:"delete",version:X,editor:f};continue}const h=Lt(o[l],a);r[l]={version:c,...h?{meta:h}:{}},i[l]={operation:"set",version:c,editor:f}}return{...s,entries:r,draft:i}})}function so(e,t,n,o){e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.draft},i={...s.entries};if(o===null)delete r[n];else if(r[n]={operation:o.block===null?"delete":"set",version:o.version,editor:r[n]?.editor??null},o.block===null)delete i[n];else{const a=new Set([...Object.keys(i),n]),l=Lt(o.block,a);i[n]={version:o.version,...l?{meta:l}:{}}}return{...s,entries:i,draft:r}})}const it=new WeakMap;async function Fe(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new j(T.Unavailable,"The CMS index is not loaded yet");let i=it.get(e);i||(i=new Map,it.set(e,i));const a=e.getQueryData(g.decofile(n))??{},l=e.getQueryData(g.contentVersions(n))??{},c=[],f=[];for(const u of new Set(o)){const d=r.entries[u];if(!d||s.has(u)||je(a[u])&&l[u]===d.version)continue;const v=i.get(`${n}\0${u}`);v?c.push(v):f.push(u)}if(f.length>0){const u=io(e,t,n,f);for(const d of f){const v=`${n}\0${d}`;i.set(v,u),u.catch(()=>{}).finally(()=>{i.get(v)===u&&i.delete(v)})}c.push(u)}await Promise.all(c);const h=fe(e,n);if(o.some(u=>h.index?.entries[u]&&!s.has(u)&&!ne(h,u)))throw new j(T.Unavailable,"A CMS block changed while loading; try again")}async function ro(e,t,n,o,s){if(!t){const i=o?.[s];return Be(i)&&!$n(i)?i:void 0}await Fe(e,t,n,[s]);const r=fe(e,n);return r.index?.entries[s]&&ne(r,s)?r.blocks[s]:void 0}function fe(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function io(e,t,n,o){const s=fe(e,n),r=[];for(let i=0;i<o.length;i+=st)r.push(o.slice(i,i+st));for(let i=0;i<r.length;i+=rt){const a=r.slice(i,i+rt),l=await t.batch(a.map(c=>({method:"cms.blocks",params:{names:c}})));if(l.length!==a.length)throw new j(T.InternalError,"Incomplete CMS batch response");for(const[c,f]of l.entries()){if(!f.ok)throw f.error;const h=Zn(f.result,a[c]),u=fe(e,n),d=Kn(s,u,h);if(Y(e),d.blocks!==u.blocks&&e.setQueryData(g.decofile(n),d.blocks),d.versions!==u.versions&&e.setQueryData(g.contentVersions(n),d.versions),d.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new j(T.Unavailable,"The CMS index changed while loading blocks; try again")}}}function Ce(e){const t=A.c(4);let n;t[0]!==e?(n=g.contentIndex(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:ao,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=F(o);return s}async function ao(){throw new Error("the content index is set by the poll")}function at(e,t){const n=A.c(8);let o;n[0]!==t?(o=Pn(t),n[0]=t,n[1]=o):o=n[1];const s=o;let r;n[2]!==e||n[3]!==s?(r=a=>e.getQueryCache().subscribe(l=>{l.query.queryHash===s&&a()}),n[2]=e,n[3]=s,n[4]=r):r=n[4];let i;return n[5]!==e||n[6]!==t?(i=()=>e.getQueryData(t),n[5]=e,n[6]=t,n[7]=i):i=n[7],L.useSyncExternalStore(r,i)}const ct=3e4;function co(e){if(!(e instanceof j))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function lo(e,t,n,o){const s=A.c(15),r=Z(),i=Ce(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const l=at(r,a);let c;s[2]!==t?(c=g.contentVersions(t),s[2]=t,s[3]=c):c=s[3];const f=at(r,c),h=o?.withRefs??!1,u=new Set(n);if(h)for(const p of n)for(const k of no(i,p))u.add(k);const d=[...u].filter(p=>!!i?.entries[p]).sort(),v={index:i,blocks:l??{},versions:f??{}},b=d.some(p=>!ne(v,p)),w=JSON.stringify(d.map(p=>[p,i?.entries[p]?.version,ne(v,p)])),[_,S]=L.useState(null),[$,E]=L.useState(0),D=_?.key===w?_:null;L.useEffect(()=>{if(!e||!w)return;let p=!0;const k=JSON.parse(w).map(ho);return Fe(r,e,t,k).then(()=>{p&&S(P=>P?.key===w?null:P)},P=>{p&&S(Q=>({key:w,count:(Q?.key===w?Q.count:0)+1,retryAfterMs:co(P)}))}),()=>{p=!1}},[e,r,t,w,$]);let I;s[4]!==D||s[5]!==E?(I=()=>{if(!D)return;const p=Math.min(ct,D.retryAfterMs??Pt(ct,1e3,D.count-1,2,.5)),k=setTimeout(()=>E(fo),p);return()=>clearTimeout(k)},s[4]=D,s[5]=E,s[6]=I):I=s[6];let m;s[7]!==D?(m=[D],s[7]=D,s[8]=m):m=s[8],L.useEffect(I,m);const y=!e||qn(v,[...u],o?.listing),O=!!e&&b&&D!==null;let x;s[9]!==E?(x=()=>E(uo),s[9]=E,s[10]=x):x=s[10];let N;return s[11]!==y||s[12]!==O||s[13]!==x?(N={ready:y,failed:O,retry:x},s[11]=y,s[12]=O,s[13]=x,s[14]=N):N=s[14],N}function uo(e){return e+1}function fo(e){return e+1}function ho(e){const[t]=e;return t}const Ut=L.createContext(null);function go(e){const t=A.c(24),n=L.useContext(Ut),o=Qe(n?null:e),{data:s}=Nn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?De.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[l,c]=ut(a);let f;t[4]!==i||t[5]!==r||t[6]!==e?(f=i?De.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=f):f=t[7];const[h,u]=ut(f);if(n)return n;let d;t[8]!==l||t[9]!==i||t[10]!==o?(d=i&&o?At(l):null,t[8]=l,t[9]=i,t[10]=o,t[11]=d):d=t[11];const v=d,b=i&&o&&typeof h=="string"?h:null;let w;t[12]!==u||t[13]!==c||t[14]!==i?(w=$=>{i&&(c($),u($.endpoint))},t[12]=u,t[13]=c,t[14]=i,t[15]=w):w=t[15];let _;t[16]!==c||t[17]!==i?(_=()=>{i&&c(null)},t[16]=c,t[17]=i,t[18]=_):_=t[18];let S;return t[19]!==v||t[20]!==b||t[21]!==w||t[22]!==_?(S={connection:v,lastEndpoint:b,set:w,clear:_},t[19]=v,t[20]=b,t[21]=w,t[22]=_,t[23]=S):S=t[23],S}function lt(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function ut(e){const t=A.c(17),n=Z(),o=e??"";let s;t[0]!==o?(s=["localStorage",o],t[0]=o,t[1]=s):s=t[1];const r=s;let i,a;t[2]!==e?(i=()=>e?lt(e):null,a=()=>e?lt(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const l=!!e;let c;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==l?(c={queryKey:r,queryFn:i,initialData:a,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=l,t[9]=c):c=t[9];const{data:f}=F(c);let h;t[10]!==e||t[11]!==n||t[12]!==r?(h=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(r,b)}},t[10]=e,t[11]=n,t[12]=r,t[13]=h):h=t[13];const u=h,d=e?f??null:null;let v;return t[14]!==u||t[15]!==d?(v=[d,u],t[14]=u,t[15]=d,t[16]=v):v=t[16],v}function Bt(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function vo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function mr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Sr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function yr(e,t,n){return t!=="github"||!n?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function kr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Nt(t)?t:null}function Or(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function Ft(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function bo(e){if(!e.hasProject)return"legacy";const t=Ft(e);if(t==="local")return"protocol-local";if(!e.v8)return"legacy";if(t==="sandbox"){const o=e.sandboxSite;return o==="ready"?"protocol-sandbox":o==="error"?"retrying-sandbox":"pending"}const n=e.githubSite;return n==="ready"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":"pending"}function wo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function ft(e){return e.isError||e.errorUpdateCount>0}function po(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const s of n)Object.hasOwn(t,s)?o[s]=t[s]:delete o[s];return o}function mo(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const Ct="__noSchema";function Vt(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[Ct]:!0}}function Er(e){return!!e&&e[Ct]===!0}function Ve(e){if(!e.ok)return e.error.code===T.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function So(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const yo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Dr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},r=typeof s.__resolveType=="string"?s.__resolveType:null,i=t.get(r)??[];i.push({key:n,label:So(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(yo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:dt(n.resolveType).localeCompare(dt(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function dt(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function ht(e,t,n){if(t.length===0)return n;const[o,...s]=t;if(Array.isArray(e)&&typeof o=="number"){const r=e.slice();return r[o]=ht(e[o],s,n),r}if(e&&typeof e=="object"&&typeof o=="string"){const r=e,i={};for(const a of Object.keys(r))i[a]=a===o?ht(r[a],s,n):r[a];return i}return e}function Ir(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class gt extends Error{}const He="site-not-owned";async function ko(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Oo(e,t=n=>fetch(n)){const n=Me({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:we(o.signal)}));if(await ko(s))throw new gt;return s}});try{return await We(n)}catch(o){if(o instanceof gt)return He;throw o}}async function Eo(e,t,n){await t();const o=await Oo(e,n);return o===He?o:{...o,hosted:eo(e,n)}}const Je=5e3;function Do(e){if(!e.site)throw new Error("this project names no site");return An(e.site,e.branch)}function Io(e){return new URL(pe(e,"rpc"),window.location.origin).href}async function We(e){const[t,n]=await e.batch([{method:"describe"},{method:"schema.get"}]);if(!t?.ok)throw t?.error??new Error("no describe");if(t.result?.protocol!==Cn)throw new Ue;const s=Vn(t.result);if(!n)throw new Error("no schema.get");if(Ve(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function _o(e,t=n=>fetch(n)){return We(Me({endpoint:e,fetch:n=>t(new Request(n,{signal:we(n.signal)}))}))}function se(e,t){const n=A.c(40),{org:o}=jn(),{connection:s}=go(e),{runtime:r}=$t(e),i=L.useContext(Ut),a=Qe(e),l=It(Le(e)?.metadata),c=Ft({hasServeConnection:!!s,runtime:r}),f=Bt(c,s?.endpoint??""),h=Hn()?.taskId??null,u=Bn(Fn().lifecycle.phase),d=Z(),v=wo({mode:c,v8:a,workingTreeReady:u}),b=v.github&&!!o.slug&&!!e&&!!t,w=F({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Eo(Do({orgSlug:o.slug,site:l,branch:t}),()=>_t(l,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,...vt}),_=v.sandbox&&!!o.slug&&!!e&&!!t;let S;n[0]!==t||n[1]!==o.slug||n[2]!==h||n[3]!==e?(S=()=>_o(Io({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:h})),n[0]=t,n[1]=o.slug,n[2]=h,n[3]=e,n[4]=S):S=n[4];const $=F({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",h??""),queryFn:S,enabled:_,staleTime:Number.POSITIVE_INFINITY,...vt}),E=!!s;let D;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=D):D=n[8];let I;n[9]!==s?(I=()=>jo(s.endpoint),n[9]=s,n[10]=I):I=n[10];let m;n[11]!==E||n[12]!==D||n[13]!==I?(m={queryKey:D,queryFn:I,enabled:E,staleTime:Number.POSITIVE_INFINITY,retry:To,retryDelay:Ro,refetchInterval:xo},n[11]=E,n[12]=D,n[13]=I,n[14]=m):m=n[14];const y=F(m);let O;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(O=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=O):O=n[18];const x=O;let N;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(N=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=N):N=n[22];let p;n[23]!==y.data||n[24]!==x||n[25]!==d?(p=async()=>{try{return await y.data.client.describe()}catch(K){const In=K;throw d.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),In}},n[23]=y.data,n[24]=x,n[25]=d,n[26]=p):p=n[26];const k=!!y.data&&!i;let P;n[27]!==N||n[28]!==p||n[29]!==k?(P={queryKey:N,queryFn:p,enabled:k,refetchInterval:Je,retry:!1},n[27]=N,n[28]=p,n[29]=k,n[30]=P):P=n[30];const M=F(P).data??y.data?.describe,U=bo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:w.data===He?"not-owned":w.data?"ready":ft(w)?"error":"loading",sandboxSite:Po({data:$.data,isError:ft($),workingTreeReady:u})});if(U==="pending")return{kind:"pending",...f};if(U==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...f};if(U==="legacy")return{kind:"legacy"};if(U==="protocol-github")return{..._e(f,w.data),site:l};if(U==="site-not-owned-github")return{kind:"unavailable",...f,siteNotOwned:!0};if(U==="protocol-sandbox")return _e(f,$.data);if(U==="unavailable-github"){let K;return n[31]!==f?(K={kind:"unavailable",...f},n[31]=f,n[32]=K):K=n[32],K}const R=y.error??y.failureReason,H=s?.endpoint??"";let J;return n[33]!==M||n[34]!==y.data||n[35]!==y.failureCount||n[36]!==y.isError||n[37]!==H||n[38]!==R?(J=No({probed:y.data,isError:y.isError,failureCount:y.failureCount,failure:R,describe:M,endpoint:H}),n[33]=M,n[34]=y.data,n[35]=y.failureCount,n[36]=y.isError,n[37]=H,n[38]=R,n[39]=J):J=n[39],J}function xo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Je:!1}function Ro(e){return Yn(e+1)}function To(e,t){return!(t instanceof j)&&!(t instanceof Ue)}function Po(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const $o=3;function No(e){const t=Bt("local",e.endpoint),n=e.probed?_e(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<$o?n:{kind:"unavailable",...t,problem:zn(e.failure)}:n??{kind:"pending",...t}}const vt={retry:2,refetchInterval:e=>e.state.status==="error"?Je:!1};function _e(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function jo(e,t){return We(Me({endpoint:e,fetch:n=>fetch(n,{signal:we(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function xe(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Ao(e,t){return xe({...e,protocolSuffix:t.cacheKeySuffix})}function Mo(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function Lo(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,vo(t)])}function Qo(e,t,n){const o=A.c(21),s=Z(),r=se(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?Ao(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const l=lo(i?.hosted,a,t,n),c=e!==null;let f;o[3]!==r.kind||o[4]!==l||o[5]!==c?(f=Mo(c,r.kind,l),o[3]=r.kind,o[4]=l,o[5]=c,o[6]=f):f=o[6];const h=f,u=r.kind!=="legacy";let d;o[7]!==r||o[8]!==e?(d=Lo(e,r),o[7]=r,o[8]=e,o[9]=d):d=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==l||o[13]!==s||o[14]!==e?(v=()=>{if(l.retry(),!e||r.kind!=="unavailable")return;const w=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...w==="local"?["local"]:[e.branch,w])})},o[10]=r.kind,o[11]=r.source,o[12]=l,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==h||o[17]!==u||o[18]!==d||o[19]!==v?(b={...h,v8:u,scopeKey:d,retry:v},o[16]=h,o[17]=u,o[18]=d,o[19]=v,o[20]=b):b=o[20],b}function Ht(e){const t=A.c(12);let n;t[0]!==e?(n=De.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Mn(o,null),i=Qe(e);let a;t[2]!==s||t[3]!==e?(a=e?ot(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const c=i?null:a;let f,h;t[5]!==r?(f=d=>r(ot(d)),h=()=>r(null),t[5]=r,t[6]=f,t[7]=h):(f=t[6],h=t[7]);let u;return t[8]!==c||t[9]!==f||t[10]!==h?(u={url:c,setUrl:f,clear:h},t[8]=c,t[9]=f,t[10]=h,t[11]=u):u=t[11],u}const bt=6e4,Uo=2147483647;function Bo(e,t){if(e===null||e.trim()==="")return bt;const n=e.trim(),o=/^\d+(?:\.\d+)?$/.test(n)?Number(n)*1e3:/^[A-Za-z]{3}, /.test(n)?Math.max(0,Date.parse(n)-t):Number.NaN;return Number.isFinite(o)&&o>=0&&o<=Uo?o:bt}class Jt extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+Bo(o,s):null}status;retryAt}function Fo(e,t,n=Date.now()){const o=Pt(5e3,1e3,e,2,0);return t instanceof Jt&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function Ye(e,t){const n=await e.json().catch(()=>null),o=n!==null&&typeof n=="object"&&"error"in n&&typeof n.error=="string"?n.error:`${t} failed (${e.status})`;throw new Jt(o,e.status,e.headers.get("retry-after"))}function Co(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function wt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function me(e,t,n){return["decofile-write",e,t,n]}function Vo(e,t,n){return{id:me(e,t,n).join(":")}}class Ge extends Error{constructor(t,n,o=[],s=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=s,this.name="BlockConflictError"}blocks;fields;carriedStored}function ze(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function Xe(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function Ho(e,t){return Ye(e,t)}function Jo(e,t,n){e.setQueryData(g.decofileDraft(ze(t)),n)}function Wo(e,t){return e.getQueryData(g.decofileDraft(ze(t)))??null}async function Yo(e,t){return(await fetch(Xe(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function _r(e){const t=A.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?ze(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Go,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=F(o);return s??null}async function Go(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function zo(e,t){const n=await fetch(Xe(t),{cache:"no-store"});if(!n.ok)return Ye(n,"Read decofile");const o=await n.json();return o.token&&Jo(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function xr(e,t){const n=await fetch(Xe(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const s=await n.json().catch(()=>({}));throw s.code==="block-conflict"?new Ge(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return Ho(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Wt=3e3,Xo=15e3,Zo=2*6e4,Yt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Ko(e){return e<Zo?Wt:Xo}function qo(e,t=Yt){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,Ko(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:l,skip:c}=e();if(s||t.hidden()||c?.()){i();return}s=!0;let f;try{f=l()}catch{f=void 0}Promise.resolve(f).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const pt=()=>0;function es(e,t,n=Yt){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>qo(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,pt,pt)}function Gt(e,t){return pe(e,t)}function ts(e,t){return pe(e,"preview-fetch",{path:t})}function Rr(e){return Gt(e,"preview-invoke")}function Tr(e){return Gt(e,"catalog-invoke")}function zt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function ns(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&zt(n))return n}return null}function os(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??ns();return n&&zt(n)?new URL(t,n).toString():ts(e,t)}function ss(e){return os(e,"/.decofile")}function rs(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function mt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function is(e,t){const n=pe(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=rs(o.status);if(s==="absent")return{kind:"absent"};if(s==="unavailable")return{kind:"unavailable"};if(s==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const r=await o.json();return typeof r.content!="string"?{kind:"unavailable"}:{kind:"data",data:Jn(r.content)}}async function as(e,t){const n=await is(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function Pr(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok)return Ye(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function cs(e){return Le(e)?.metadata?.runtime?.path??null}function Re(e,t,n,o){const s=B(e),r=Object.keys(n?.changes??{}).find(a=>B(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>B(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(l=>B(l)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class Xt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function $r(e){return e instanceof j&&e.code===T.Conflict}function Zt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Ze extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class Ke extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function Nr(e,t){return(t instanceof Ze||t instanceof Ke)&&(t.message=Kt(e,t,"github")),t}function Kt(e,t,n){if(t instanceof Ze)return e("siteEditor.save.draftUnread");if(t instanceof Ke)return e("siteEditor.save.keptChanging");if(t instanceof Ge)return t.message;if(n==="local")return us(e,t);if(t instanceof j)switch(t.code){case T.Conflict:return e("siteEditor.save.conflict");case T.ReadOnly:return e("siteEditor.save.readOnly");case T.InvalidBlock:case T.InvalidParams:return e("siteEditor.save.invalid");case T.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function ls(e,t){if(t==="local"||e instanceof Ge||e instanceof Ze||e instanceof Ke)return null;if(e instanceof j){const n=e.code===T.InvalidBlock||e.code===T.InvalidParams?Zt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function us(e,t){if(t instanceof Xt)return e("decoServe.save.serverGone");if(t instanceof j)switch(t.code){case T.Conflict:return e("decoServe.save.conflict");case T.ReadOnly:return e("decoServe.save.readOnly");case T.InvalidBlock:case T.InvalidParams:return e("decoServe.save.invalid",{detail:Zt(t)});case T.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function fs(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function ds(e,t){const[n,o]=L.useState(e),s=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){s.current??=Date.now();return}if(!n)return;const r=()=>{s.current=null,o(!1)},i=fs(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const hs="decocms:content-writes",Te=new Set;let G;function qt(){if(G!==void 0)return G;G=null;try{typeof BroadcastChannel=="function"&&(G=new BroadcastChannel(hs),G.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Te])n(t)}))}catch{G=null}return G}function gs(e){try{qt()?.postMessage({cacheKey:e})}catch{}}function vs(e){return qt(),Te.add(e),()=>{Te.delete(e)}}const en="__at=",tn="__test=",bs=/^[0-9a-f]{12}-[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function ws(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&bs.test(e)}function St(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function ps(e){const t=e.tests??{};return[...e.at!==void 0?[en+St(e.at)]:[],...Object.keys(t).map(n=>tn+St(`${n}=${t[n]?"on":"off"}`))]}function yt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(en)&&!s.startsWith(tn)),...t];return o.length>0?`?${o.join("&")}`:""}function de(e,t){const n=ps(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+yt(o===-1?"":e.slice(o+1),n);const r=e.lastIndexOf("@");if(r<=0)return e;const i=e.slice(0,r),a=i.indexOf("?"),l=a===-1?i:i.slice(0,a),c=a===-1?"":i.slice(a+1);return`${l}${yt(c,n)}${e.slice(r)}`}function jr(e,t,n){if(!ws(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",de(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",de(n,t)),o.toString()):e}catch{return e}}function Ar(e,t,n="/"){if(!e||!ee(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function nn(e){return btoa(encodeURIComponent(e))}function Mr(e,t,n){const o=ms(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function ms(e,t,n){const o=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return s.searchParams.set("path","/"),s.searchParams.set("pathTemplate","/"),s.searchParams.set("props",nn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Ss="__draft";function Lr(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const ys="off";function ks(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Ss,t),n.toString()}function Qr(e){const t=e.pageBlock.__resolveType;if(typeof t!="string"||!t)return null;const n=new URL(e.previewBaseUrl).origin,o=new URL(`/live/previews/${encodeURIComponent(t)}`,n);o.searchParams.set("__decoFBT","0"),o.searchParams.set("__d",""),o.searchParams.set("path",e.path),o.searchParams.set("pathTemplate",e.pathTemplate);const{__resolveType:s,...r}=e.pageBlock,i=JSON.stringify({__props:r,__decofile:e.decofile});return{src:o.toString(),body:i}}function Ur(e,t,n,o){const s=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,s);r.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),r.searchParams.set("props",nn(JSON.stringify({sections:i}))),r.toString()}function Br(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const kt="__variant=";function on(e,t,n){return`${e}@${t}=${n}`}function Fr(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[on(e,"sections",t.index)]}function Cr(e){const t=Array.isArray(e.mvObj.variants)?e.mvObj.variants:[];if(!e.pageKey||e.sectionIndex<0)return[];if(e.selectedVariantIndex<0||e.selectedVariantIndex>=t.length)return[];const o=`${e.page.multivariate?`sections.variants.${e.page.index}.value${e.page.lazyValues?".value":""}`:"sections"}.${e.sectionIndex}${e.sectionLazy?".section":""}`;return[on(e.pageKey,o,e.selectedVariantIndex)]}function Vr(e,t){return[...t,...e]}function Os(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function qe(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),s=o.indexOf("?"),r=s===-1?o:o.slice(0,s),a=[...s===-1?[]:o.slice(s+1).split("&").filter(c=>c&&!c.startsWith(kt)),...t.map(c=>kt+Os(c))],l=a.length>0?`?${a.join("&")}`:"";return`${r}${l}${e.slice(n)}`}function Hr(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),s=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return qe(`${s}${o.pathname}@local`,t)}catch{return null}}function Jr(e,t){if(t.length===0)return e;try{const n=new URL(e),o=n.searchParams.get("__draft");return!o||o==="off"?e:(n.searchParams.set("__draft",qe(o,t)),n.toString())}catch{return e}}function Es(e){const{pointer:t}=e;if(!t||t===ys)return null;const n=t.indexOf("?");return ee(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:ee(e.heldRevision)&&e.forcedVariants.length===0?de(e.heldRevision,e.previewOptions):de(qe(t,e.forcedVariants),e.previewOptions)}function Ds(e,t){if(!e||!t)return null;try{return ks(e,t)}catch{return null}}function Wr(e,t,n){if(!e||!n)return null;try{return Ds(new URL(t,e).toString(),n)}catch{return null}}const he={forcedVariants:[],previewOptions:{}},ie=new Map,ae=new Map,Pe=new Map;function sn(e){for(const t of Pe.get(e)??[])t()}function rn(e,t){const n=ee(t)?t:null;(ae.get(e)??null)!==n&&(n?ae.set(e,n):ae.delete(e),sn(e))}function Is(e){return ae.get(e)??null}function _s(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Yr(e,t){const n=ie.get(e)??he,o=t??he;_s(n,o)||(t?ie.set(e,o):ie.delete(e),sn(e))}function xs(e){return ie.get(e)??he}function an(e,t){let n=Pe.get(e);return n||(n=new Set,Pe.set(e,n)),n.add(t),()=>{n.delete(t)}}function Rs(e){const t=A.c(3);let n,o;return t[0]!==e?(n=s=>an(e,s),o=()=>xs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ts)}function Ts(){return he}function Ps(e){const t=A.c(3);let n,o;return t[0]!==e?(n=s=>e?an(e,s):Ns,o=()=>e?Is(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,$s)}function $s(){return null}function Ns(){}function Gr(e,t){const n=A.c(4),o=Rs(e),s=Ps(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Es({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const cn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},js=15e3,ge=new Map;function W(e,t){return`${e}/${t}`}function V(e){let t=ge.get(e);return t||(t={state:cn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ge.set(e,t)),t}function C(e,t){const n=V(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Se(e){e.timer&&clearTimeout(e.timer),e.timer=null}function ve(e){return ge.get(e)?.state??cn}function As(e,t){const n=V(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function zr(e){const t=V(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Se(t),C(e,{phase:"idle"}))}}function Xr(e){const t=ge.get(e);!t||t.state.phase!=="reloading"||(Se(t),C(e,{phase:"idle"}))}function ln(e){const t=V(e);Se(t),C(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ce(e,t){const n=V(e),o=Math.max(0,n.state.inFlight-1);if(o>0){C(e,{inFlight:o});return}if(!t.ok||n.previews===0){C(e,{phase:"idle",inFlight:o});return}un(e,t.navigates,o)}function un(e,t,n=0){const o=V(e);Se(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&C(e,{phase:"idle"})},js),C(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Ms(e){return e?.kind==="protocol"&&e.source==="github"}async function le(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,l=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol"){const v=a&&t.reread?n.invalidateQueries({queryKey:g.decofile(a)}):null;if(await Promise.all([l,v]),v&&t.kind!=="edit"){const b=W(o,s);C(b,{epoch:ve(b).epoch+1})}return{navigates:!1}}const c=r?g.protocolDraftRead(o,s,r):null,f=c?JSON.stringify(n.getQueryData(c)??null):null,h=l?[l]:[];if(a&&t.reread&&h.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&h.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&h.push(n.invalidateQueries({queryKey:Wn(o,s,r)})),Ms(i)&&c&&!t.adopted&&h.push(n.invalidateQueries({queryKey:c})),await Promise.all(h),t.kind!=="edit"){const v=W(o,s);C(v,{epoch:ve(v).epoch+1})}const u=c?JSON.stringify(n.getQueryData(c)??null):null,d=f!==u;return d&&await new Promise(v=>xt.schedule(v)),{navigates:d}}async function Ls(e,t){return ln(W(e.orgSlug,e.virtualMcpId)),fn(e,t)}function Ot(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function fn(e,t){const n=W(e.orgSlug,e.virtualMcpId),o=t.adopted?Ot(e):null;let s;try{s=await t.write()}catch(i){throw ce(n,{ok:!1,navigates:!1}),t.refreshOnError&&le(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&gs(e.cacheKey),rn(n,t.shownRevision?.(s)??null),t.adopted){const i=Ot(e)!==o;return i&&await new Promise(a=>xt.schedule(a)),ce(n,{ok:!0,navigates:i}),t.reread&&le(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await le(e,t))}catch{}finally{ce(n,{ok:!0,navigates:r})}return s}function Zr(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=W(o,s),a=new Set(t.blockKeys);for(const f of[...V(i).discardListeners])f(a);ln(i);let l=!1;const c=()=>(l=!0,fn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:me(o,s,r),scope:Vo(o,s,r),mutationFn:c}).execute(void 0).catch(f=>{throw l||ce(i,{ok:!1,navigates:!1}),f}):c()}function Kr(e,t,n){const o=A.c(8);let s;o[0]!==e||o[1]!==t?(s=W(e,t),o[0]=e,o[1]=t,o[2]=s):s=o[2];const r=s;let i;o[3]!==n||o[4]!==r?(i=()=>{const l=V(r).discardListeners;return l.add(n),()=>{l.delete(n)}},o[3]=n,o[4]=r,o[5]=i):i=o[5];let a;o[6]!==r?(a=[r],o[6]=r,o[7]=a):a=o[7],L.useEffect(i,a)}function dn(e){const t=W(e.orgSlug,e.virtualMcpId);ve(t).inFlight>0||(rn(t,null),le(e,{kind:"external"}).then(({navigates:n})=>{const o=V(t);o.previews>0&&o.state.inFlight===0&&un(t,n)}).catch(()=>{}))}function Qs(e,t){const n=A.c(7);let o;n[0]!==e||n[1]!==t?(o=W(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=c=>As(s,c),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>ve(s),n[5]=s,n[6]=a):a=n[6];const l=a;return L.useSyncExternalStore(i,l,l)}const Us=500;function qr(e,t){const{phase:n}=Qs(e,t);return ds(n!=="idle",Us)}function Bs(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function hn(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function ei(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?oo(i,n):Fs(e,t,n)}const s=e.getQueryData(g.contentVersions(t));if(!s)return;if(Object.hasOwn(s,n))return s[n];const r=e.getQueryData(g.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function gn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=B(t),o=Object.keys(e.changes).find(s=>B(s)===n);return o===void 0?void 0:e.changes[o]}function Fs(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return vn(o,ye(e,t),n)}function vn(e,t,n){const o=gn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(B(n))?X:null}function ti(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=gn(o,n);return s?s.kind==="set"&&s.baseVersion===null:ye(e,t).has(B(n))}function ni(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=ye(e,t);return{blocks:n,versionOf:r=>vn(o,s,r)}}function ye(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function be(e,t,n,o){const s=B(n),r=ye(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),Y(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function bn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([u,d])=>[u,d===X?null:d]),a=e.getQueryData(g.contentChanges(n)),l=e.getQueryData(g.contentIndex(n)),c=new Set(i.flatMap(([u])=>Re(u,l,a,r)===null?[u]:[])),f=new Set(i.flatMap(([u,d])=>d===null?[]:[B(u)]));e.setQueryData(g.contentChanges(n),u=>{if(!u)return u;const d={...u.changes};for(const[v,b]of i){const w=Re(v,l,u,r);b!==null?d[v]={kind:"set",version:b,baseVersion:w}:w!==null?d[v]={kind:"delete",version:null,baseVersion:w}:delete d[v]}return{...u,changes:d,edited:!0}});for(const[u,d]of i)d!==null?be(e,n,u,!1):!f.has(B(u))&&c.has(u)&&be(e,n,u,!0);const h=o.revision;return h&&h!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),u=>u&&{...u,version:h}),s}function ke(e,t,n){Y(e),e.setQueryData(g.contentVersions(t),o=>{const s={...o};for(const[r,i]of Object.entries(n))i===null?delete s[r]:s[r]=i;return s})}function wn(e,t){const n=e.getMutationCache().findAll({mutationKey:me(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>mo(o.state.variables)))}function $e(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function oe(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof j);throw t.source==="local"&&r?($e(e,n),new Xt(s)):(t.source==="local"&&Ae(s)&&$e(e,n),s)}}const Et=new WeakMap;function et(e){let t=Et.get(e);return t||(t={inFlight:new Map,rereading:new Set},Et.set(e,t)),t}function pn(e,t,n,o){const{inFlight:s}=et(e),r=s.get(o);if(r)return r;const i=tt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function Cs(e,t,n){const o=A.c(8),s=Z(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let l,c;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(l=()=>{if(!e||!r||!i||!a)return;const f={orgSlug:r,virtualMcpId:i,branch:a},{rereading:h}=et(s);return vs(u=>{u===n&&(h.has(n)||(h.add(n),Hs(s,e,f,n).catch(Vs).finally(()=>h.delete(n))))})},c=[s,e,r,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=r,o[4]=s,o[5]=i,o[6]=l,o[7]=c):(l=o[6],c=o[7]),L.useEffect(l,c)}function Vs(){}async function Hs(e,t,n,o){const s=et(e).inFlight.get(o);return s&&await s.catch(()=>{}),pn(e,t,n,o)}async function tt(e,t,n,o,s){Y(e);const r=g.decofile(o),i=hn(n,t),a=g.contentRevision(o),l=g.contentVersions(o),c=e.getQueryData(r),f=e.getQueryData(l),u=e.getQueryData(i),d=e.getQueryData(a)??void 0,v=s&&c&&f?d?.revision:void 0,b=s&&u?d?.schemaVersion:void 0,w=g.contentChanges(o),_=e.getQueryData(w);if(t.source==="github"&&t.hosted)return Js(e,t,t.hosted,n,o,{conditional:s,seen:d,currentMeta:u,schemaIfNoneMatch:b,seenChanges:_});const[S,$,E]=await oe(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:Rt(_)}])),D=e.getQueryData(a)?.revision,I=D!==void 0&&D!==d?.revision;if(E?.ok){const k=I?null:Tt(_,E.result);k&&e.setQueryData(w,k)}else E&&t.source==="local"&&Ae(E.error)&&$e(e,n);if(!S?.ok)throw S?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const m=S.result,y=Ve($),O=$.ok&&!y?$.result:null;if(m.notModified&&(!c||!f)||O?.notModified&&!u)return tt(e,t,n,o,!1);const x=m.notModified?new Set:wn(e,n),N=m.notModified?c:po(m.blocks,c,x),p=y?Vt():O?O.notModified?u:O.schema:$.error;if(e.setQueryData(a,{revision:I?D:m.notModified?d?.revision:m.revision,schemaVersion:O?O.notModified?d?.schemaVersion:O.version??void 0:void 0}),e.setQueryData(r,N),!m.notModified){const k=e.getQueryData(l),P={...m.versions};for(const Q of x){const M=k?.[Q];M!==void 0?P[Q]=M:delete P[Q]}e.setQueryData(l,P)}return p instanceof j||e.setQueryData(i,p),!I&&!m.notModified&&c&&d?.revision&&m.revision!==d.revision&&dn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:N,meta:p}}async function Js(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),l=g.contentRevision(s),c=g.contentVersions(s),f=hn(o,t),h=g.contentChanges(s),u=e.getQueryData(a),d=r.conditional&&u?r.seen?.revision:void 0,[v,b,w]=await oe(e,t,o,()=>n.batch([{method:"cms.index",params:d?{ifNoneMatch:d}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:Rt(r.seenChanges)}])),_=e.getQueryData(a)??u,S=e.getQueryData(l)?.revision,$=S!==void 0&&S!==r.seen?.revision;if(w?.ok&&!$){const R=Tt(r.seenChanges,w.result);R&&e.setQueryData(h,R)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const E=v.result,D=Ve(b),I=b.ok&&!D?b.result:null;if(E.notModified&&!u||I?.notModified&&!r.currentMeta)return tt(e,t,o,s,!1);const m=D?Vt():I?I.notModified?r.currentMeta:I.schema:b.error;m instanceof j||e.setQueryData(f,m);const y=I?I.notModified?r.seen?.schemaVersion:I.version??void 0:void 0,O=e.getQueryData(i)??{};if(E.notModified||$)return e.setQueryData(l,{revision:$?S:r.seen?.revision,schemaVersion:y}),e.setQueryData(i,O),{blocks:O,meta:m};const x={revision:E.revision,resolvedRef:E.resolvedRef,sequence:E.sequence,entries:E.entries,draft:E.draft};e.setQueryData(a,x);const N=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!u&&mn(u.draft,x.draft));N&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),R=>R&&{...R,version:x.revision}),e.setQueryData(l,{revision:x.revision,schemaVersion:y});const p=wn(e,o),k=e.getQueryData(c)??{},P={},Q={},M=[];for(const[R,H]of Object.entries(O)){const J=x.entries[R];!J&&!p.has(R)||(P[R]=H,k[R]!==void 0&&(Q[R]=k[R]),J&&!p.has(R)&&k[R]!==J.version&&M.push(R))}return e.setQueryData(i,P),e.setQueryData(c,Q),M.length>0&&await Fe(e,n,s,M,p),_&&N&&Ws(_,x)&&dn({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??P,meta:m}}function Ws(e,t){if(mn(e.draft,t.draft))return!0;const n=Object.keys(t.entries);return n.length!==Object.keys(e.entries).length?!0:n.some(o=>!Object.hasOwn(e.entries,o)||e.entries[o]?.version!==t.entries[o]?.version)}function mn(e,t){const n=Object.keys(t);return n.length!==Object.keys(e).length?!0:n.some(o=>!Object.hasOwn(e,o)||e[o]?.version!==t[o]?.version)}function Ys(e,t){const n=[...Object.keys(t.set??{}),...t.delete??[]];return Object.fromEntries(n.filter(o=>Object.hasOwn(e,o)).map(o=>[o,e[o]]))}function Ee(e){if(!(e instanceof j)||e.code!==T.Unavailable)return;const t=e.data?.landed;if(!(!t||typeof t!="object"||Array.isArray(t)))return Object.fromEntries(Object.entries(t).filter(n=>typeof n[1]=="string"))}async function Gs(e,t){if(!(e instanceof j)||e.code!==T.Conflict)return;const n=e.data?.entries;if(!n||typeof n!="object")return;const o=Object.entries(n);if(o.length===0)return;const s=t.set??{},r=new Set(t.delete??[]),i={};for(const[a,l]of o){const c=l?.actual;if(typeof c!="string"||(Object.hasOwn(s,a)?await Un(s[a]):r.has(a)?X:void 0)!==c)return;i[a]=c}return i}function zs(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([s])=>!Object.hasOwn(t,s))),o=(e.delete??[]).filter(s=>!Object.hasOwn(t,s));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function re(e,t,n,o,s){Y(e),bn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),ke(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),Qt(e,n,s,o.set??{})}async function oi(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(c=>!r||!Object.hasOwn(r,c));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const l=Ln(s.set);if(l.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${l.join(", ")})`)}return Ls({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=(f,h=r)=>oe(e,t,n,()=>t.client.blocksApply({set:f.set,delete:f.delete,...h?{ifMatch:Ys(h,f)}:{}}));let a;try{a=await i(s)}catch(f){const h=t.source==="github"?Ee(f):void 0;if(!h)throw f;const u=zs(s,h);Object.keys(h).length>0&&re(e,n,o,s,h);let d;try{d=await i(u)}catch(v){const b=Ee(v);b&&Object.keys(b).length>0&&re(e,n,o,u,b);const w=await Gs(v,u);if(!w)throw v;re(e,n,o,u,w);try{d=await i(u,{...r,...w})}catch(_){const S=Ee(_);throw S&&Object.keys(S).length>0&&re(e,n,o,u,S),_}}a={...d,versions:{...h,...d.versions}}}Y(e);const l=t.source==="github"?bn(e,n,o,a):a.revision;t.source==="github"&&Qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),f=>({...f,revision:l}));const c=a.versions??{};return ke(e,o,c),{revision:l,versions:c}}})}function Sn(e,t){if(!(e instanceof j))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function yn(e,t,n){if(!(n instanceof j))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&be(e,t,s,!1)}function kn(e,t,n,o){Y(e),Qn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=Re(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const l=B(n),c=Object.fromEntries(Object.entries(i.changes).filter(([f])=>B(f)!==l));s?a!==null&&(c[n]={kind:"delete",version:null,baseVersion:a}):c[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:c,edited:!0})}be(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),l=>{const c={...l};return s?delete c[n]:c[n]=o.block,c}),ke(e,t,{[n]:s?null:o.version}),so(e,t,n,o)}function si(e,t,n,o){if(t.source!=="github"||!(o instanceof j))return!1;yn(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>Sn(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,l)=>{kn(e,n,a,i[l])}),!0)}async function ri(e,t,n,o,s,r){t.source==="github"&&yn(e,o,r);const i=t.source==="github"?Sn(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),kn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const c=(await oe(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(c&&c.after===null&&c.version!==null)return!1;a={value:c?.after??null,version:c?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),f=>{if(!f)return f;const h={...f.changes};return c?.kind?h[s]={kind:c.kind,version:c.version,baseVersion:c.baseVersion}:delete h[s],{...f,changes:h,edited:!0}})}catch{const l=await oe(e,t,n,()=>t.client.blocksList({}));if(l.notModified)return!1;a={value:l.blocks[s]??null,version:l.versions[s]??null}}return e.setQueryData(g.decofile(o),l=>{const c={...l};return a.value===null?delete c[s]:c[s]=a.value,c}),ke(e,o,{[s]:a.version}),!1}function Xs(e){const t=A.c(17),n=Le(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=It(n),t[0]=n,t[1]=o):o=t[1];const s=o;let r;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(r=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=r):r=t[5];let i;t[6]!==e||t[7]!==s?(i=async()=>{const b=await _t(s,e.branch),w=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&w>0?b.pointer.slice(0,w):null,version:b.pointer&&w>0?b.pointer.slice(w+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let l;t[9]!==r||t[10]!==i||t[11]!==a?(l={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=l):l=t[12];const{data:c,isPending:f,isError:h}=F(l),u=!!e&&!!s&&f&&!h;if(!e||!c?.draft||!c.version){let b;return t[13]!==u?(b={pointer:null,pending:u},t[13]=u,t[14]=b):b=t[14],b}const d=`${c.draft}@${c.version}`;let v;return t[15]!==d?(v={pointer:d,pending:!1},t[15]=d,t[16]=v):v=t[16],v}function ii(e){return Xs(e).pointer}function ai(e){const t=A.c(4);let n;t[0]!==e?(n=g.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Zs,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=F(o);return s?.revision}async function Zs(){throw new Error("content revisions are set by reads and writes")}function nt(e,t){const n=A.c(6),{url:o}=Ht(e?.virtualMcpId),s=se(e?.virtualMcpId,e?.branch);if(!e)return"";let r;return n[0]!==s.cacheKeySuffix||n[1]!==s.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(r=s.kind!=="legacy"&&s.cacheKeySuffix!==void 0?xe({...e,protocolSuffix:s.cacheKeySuffix}):xe({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=s.cacheKeySuffix,n[1]=s.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=r):r=n[5],r}function ci(e,t){const n=A.c(46),{url:o}=Ht(e?.virtualMcpId),s=!!o,r=se(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=nt(e),l=t?.fetchEnabled??!0,c=cs(e?.virtualMcpId),f=$t(e?.virtualMcpId).runtime==="cms",h=Z();let u;n[0]!==a?(u=g.decofile(a),n[0]=a,n[1]=u):u=n[1];const d=u;Cs(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==h||n[4]!==d?(v=()=>{if(!e||h.isMutating({mutationKey:me(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const k=h.getQueryState(d);return k?.fetchStatus==="fetching"||Date.now()-(k?.dataUpdatedAt??0)<Wt/2},n[2]=e,n[3]=h,n[4]=d,n[5]=v):v=n[5];let b;n[6]!==f||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==h||n[11]!==d?(b=async()=>{if(e){if(!i&&f&&!s){const k=Wo(h,e)?.version;if(k&&!await Yo(e,k))return}await h.refetchQueries({queryKey:d,exact:!0},{cancelRefetch:!1})}},n[6]=f,n[7]=s,n[8]=e,n[9]=i,n[10]=h,n[11]=d,n[12]=b):b=n[12];let w;n[13]!==v||n[14]!==b?(w={skip:v,read:b},n[13]=v,n[14]=b,n[15]=w):w=n[15],es(!!t?.pollWhile&&!!e,w);const _=Ce(i?.hosted?a:"");let S;n[16]!==r.kind||n[17]!==f||n[18]!==l||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==c||n[23]!==e||n[24]!==i||n[25]!==h?(S=async()=>{if(i)return(await pn(h,i,e,a)).blocks;if(r.kind==="unavailable")throw Bs("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(qs),U=M?.ok?wt(await M.text()):null;if(U)return U;const R=new Error("decofile unavailable (local tunnel unreachable)");throw R.status=502,R}if(f)return zo(h,e);const k=()=>as(e,Co(c,".deco/blocks.gen.json"));if(l){const M=await fetch(ss(e),{cache:"no-store"}).catch(Ks);if(M?.ok){const H=wt(await M.text());if(H)return H}const U=await k();if(U.kind==="data")return U.data;const R=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw R.status=mt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:U.kind==="absent"}),R}const P=await k();if(P.kind==="data")return P.data;const Q=new Error("decofile unavailable (preview down, no committed snapshot)");throw Q.status=mt({liveOk:!1,committedAbsent:P.kind==="absent"}),Q},n[16]=r.kind,n[17]=f,n[18]=l,n[19]=a,n[20]=s,n[21]=o,n[22]=c,n[23]=e,n[24]=i,n[25]=h,n[26]=S):S=n[26];const $=!!e&&r.kind!=="pending",E=i?0:3e4,D=i?.describe.pollIntervalMs,I=i?"always":void 0;let m;n[27]!==f||n[28]!==s||n[29]!==i?(m=(k,P)=>{if(i||f||s)return k<3;const Q=P.status;return Q!==502&&Q!==404&&k<2},n[27]=f,n[28]=s,n[29]=i,n[30]=m):m=n[30];let y;n[31]!==d||n[32]!==S||n[33]!==$||n[34]!==E||n[35]!==D||n[36]!==I||n[37]!==m?(y={queryKey:d,queryFn:S,enabled:$,staleTime:E,refetchInterval:D,refetchIntervalInBackground:!1,refetchOnWindowFocus:I,retry:m,retryDelay:Fo},n[31]=d,n[32]=S,n[33]=$,n[34]=E,n[35]=D,n[36]=I,n[37]=m,n[38]=y):y=n[38];const O=F(y);let x;n[39]!==_||n[40]!==O?(x=_&&O.data?to(_,O.data):void 0,n[39]=_,n[40]=O,n[41]=x):x=n[41];const N=x;let p;return n[42]!==N||n[43]!==i?.hosted||n[44]!==O?(p=i?.hosted&&N?{...O,data:N}:O,n[42]=N,n[43]=i?.hosted,n[44]=O,n[45]=p):p=n[45],p}function Ks(){return null}function qs(){return null}function li(e,t,n){return Qo(e,t,n)}function ui(e){const t=A.c(4),n=Z(),o=se(e?.virtualMcpId,e?.branch),s=nt(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,l)=>ro(n,r,s,a,l),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function fi(e,t){const n=A.c(3),o=se(e?.virtualMcpId,e?.branch),s=nt(e),r=Ce(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,l]=a;return t(l.meta?.type??"")}).map(er),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function er(e){const[t]=e;return t}const tr="site-editor-save",On={id:tr,description:void 0,action:void 0,cancel:void 0},di="site-editor-undo",Ne="site-editor-publish";function nr(e){const t=A.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=z.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=s):s=t[1];let r;t[2]!==o?(r=z.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=r):r=t[3];let i;return t[4]!==s||t[5]!==r?(i=z.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function En(e,t){return t?z.jsx(nr,{label:e("siteEditor.details"),detail:t}):void 0}function hi(e,t,n){te.error(Kt(e,t,n),{...On,description:En(e,ls(t,n))})}function gi(e,t,n=!1){te.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...On,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Dn={action:void 0,duration:void 0};function vi(e,t){te.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Dn,id:Ne,description:void 0})}function bi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=En(e,o??null);te[i](t,{id:Ne,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:l=>{l.preventDefault(),te.loading(r??e("thread.publishPopover.publishing"),{...Dn,id:Ne,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function wi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Ho as $,Ds as A,ws as B,as as C,Ft as D,Br as E,yr as F,Xs as G,W as H,Ps as I,Yr as J,Hr as K,de as L,ys as M,ks as N,jr as O,Jr as P,Mr as Q,Xr as R,zr as S,Ut as T,Qs as U,ai as V,Qr as W,Vo as X,me as Y,Ls as Z,is as _,pr as a,vo as a0,Ao as a1,Dr as a2,dt as a3,ht as a4,Ir as a5,Sr as a6,Or as a7,Gn as a8,En as a9,ei as aA,Kr as aB,ni as aC,Jo as aD,xr as aE,Ke as aF,_r as aG,ii as aH,Lr as aI,si as aJ,ee as aK,Ar as aL,bi as aM,di as aN,On as aO,Fe as aP,wn as aQ,to as aR,Ur as aS,Tr as aT,Fr as aU,Cr as aV,Vr as aW,wi as aa,ms as ab,hn as ac,nr as ad,Gr as ae,Wr as af,Qo as ag,os as ah,pn as ai,Bs as aj,Fo as ak,Pr as al,Ne as am,Dn as an,vi as ao,Zr as ap,gi as aq,ti as ar,Nr as as,Ge as at,$r as au,Hs as av,Ze as aw,oi as ax,ri as ay,hi as az,go as b,Ht as c,ui as d,wr as e,fi as f,qr as g,kr as h,mr as i,ci as j,li as k,Yn as l,zn as m,Nt as n,jo as o,gr as p,Rr as q,br as r,vr as s,ts as t,se as u,nt as v,Er as w,cs as x,Co as y,Es as z};
@@ -1 +1 @@
1
- import{b as ee,a4 as te,q as ne,r as E,j as t,B as Q,n as F,d_ as ae,a5 as ce,aN as me,aM as pe,aJ as de,aH as ue,aI as ge,aL as fe,aK as he,b7 as xe,t as C,dM as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gE as Ce}from"./index-BRgWMc-5.js";import{a as De}from"./SwitchHorizontal01-CGFn_psg.js";import{D as we}from"./agent-icon-DFyNTmmD.js";import{s as Ne}from"./Trash01-CnPGIwZe.js";import{i as Pe}from"./Upload01-Bfre-QV-.js";import{i as ie}from"./Zap-D4dSEKpa.js";import{S as Ae}from"./search-toggle-CBe-B-W_.js";import{E as Y}from"./empty-state-B87jIRUF.js";import{C as Ee}from"./collection-tabs-CCJoVQ-t.js";import{S as Me,F as Oe}from"./folder-icon-B9awY_eB.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-Dj5ea7Pp.js";import{a7 as ze,R as Z,Z as _e}from"./chat-context-ZeSpVj2j.js";import{c as $e}from"./context-shell-n2LQX250.js";import"./AlertCircle-ee1sjQGr.js";import"./UserCheck01-CcIH7s2N.js";import"./Tool01-Cnkd4pP7.js";import"./ArrowUp-DgFMMMBQ.js";import"./ArrowLeft-BhV4BHrM.js";import"./ArrowRight-3kziivNC.js";import"./BookOpen01-C9X5S-cQ.js";import"./Globe04-Cx-w92u5.js";import"./CheckCircle-CGqAjggj.js";import"./TrendUp01-BlwMDcra.js";import"./ChevronDown-CGJhfuSb.js";import"./ChevronSelectorVertical-5-TBPpUz.js";import"./ChevronUp-BO9DemUb.js";import"./UserSquare-CUb4s2-c.js";import"./LinkBroken01-BN3icH6a.js";import"./CreditCard01-BLkqiDJW.js";import"./File02-DclovfNb.js";import"./MessageCircle01-jm5EAYEs.js";import"./Eye-CO_nPZKQ.js";import"./Image01-CeQMNu9o.js";import"./Key01-DMjKHzPy.js";import"./LayoutLeft-BPF5UUkD.js";import"./Minus-DoUm1n95.js";import"./Monitor01-CM0DIJ9E.js";import"./Sun-CYr05wwt.js";import"./Play-I05hjYId.js";import"./Plus-B_KK3A4P.js";import"./SearchMd-BlPJmXQo.js";import"./ShoppingBag01-XH61oInk.js";import"./Users01-BaPkNO1v.js";import"./XClose-CtxnajtG.js";import"./icon-button-DmJB3HO5.js";import"./tooltip-DgFM5mQB.js";import"./index-3k_nlNc7.js";import"./badge-Ba_DCLD5.js";import"./markdown-DPpPArEp.js";import"./use-copy-CQS-1CPQ.js";import"./use-mobile-MVZR2Lhp.js";import"./use-panel-navigate-B_099k7i.js";import"./thread-route-C18glt36.js";import"./use-project-scope-BaNhjjkU.js";import"./repository-binding-Drae9jEJ.js";import"./use-mcp-client-OYKYr7Zc.js";import"./auth-sBxX13D1.js";import"./task-board-CZErK_3f.js";import"./schema-BSbCYY9y.js";import"./file-preview-DGOqiP3N.js";import"./utils-BaccrSLZ.js";import"./editor-DKlObXWN.js";import"./file-type-icon-sj_ejObJ.js";import"./useInfiniteQuery-CoeKNdsU.js";import"./infiniteQueryObserver-DXDiLGwX.js";import"./use-view-draft-kind-DcHRrUPD.js";import"./use-blog-view-DuKgZxsq.js";import"./use-organization-settings-BTioDTeC.js";import"./thread-intent-MQDkwS2K.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-DTFf-OSe.js";import"./session-runtime-BH3ADRqu.js";import"./use-entitlements-BXMPYOBS.js";import"./use-ai-providers-BM99Jk3f.js";import"./use-current-view-C8Qn7lu6.js";import"./use-in-settings-D_BySurP.js";import"./use-decopilot-events-Dn0Dm68W.js";import"./require-capability-58lj_sLx.js";import"./access-gate-BcSivdgh.js";import"./capability-load-error-LShIU80A.js";import"./sections-2LOxZNGC.js";import"./textarea-shjcg83Q.js";import"./use-ask-in-chat-B4aJKUoO.js";import"./shell-layout-2a3HocEU.js";import"./use-deployment-admin-CTEsKWeV.js";import"./admin-fetch-BhTJlAsX.js";import"./use-org-notice-Csddyapx.js";import"./command-Dg1M4JCf.js";import"./index-BiVCuU3V.js";import"./integration-icon-Cu3N1muw.js";import"./project-icon-D6jtLreJ.js";import"./use-navigate-to-agent-0LtKWlxa.js";import"./use-debounced-value-sPPLBdJe.js";import"./new-project-dialog-DEBFbTK4.js";import"./label-DJG2lJG2.js";import"./repository-picker-DcoNDHNX.js";import"./github-icon-KEAtk4MX.js";import"./collection-search-CWJ6AHHK.js";import"./new-project-store-CgLzwcjn.js";import"./legacy-admin-welcome-dialog-BY_2I8tZ.js";import"./drawer-DVCuatiz.js";import"./required-auth-layout-coJLhqjq.js";import"./use-org-sso-DXCHIqdV.js";const J=200,Fe=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Le(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!Fe.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=G(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function He(s,e){const i=$e(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:we}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let D;e[3]!==i?(D=B(i),e[3]=i,e[4]=D):D=e[4];const R=D,w=o?"opacity-60":"hover:bg-accent";let f;e[5]!==w?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",w),e[5]=w,e[6]=f):f=e[6];let m;e[7]!==i.name||e[8]!==c||e[9]!==o?(m=!o&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":i.name}),e[7]=i.name,e[8]=c,e[9]=o,e[10]=m):m=e[10];const N=R?"default":"system",z=!R;let h;e[11]!==I||e[12]!==N||e[13]!==z?(h=t.jsx(Oe,{glyph:I,tone:N,readOnly:z,className:"size-8 shrink-0"}),e[11]=I,e[12]=N,e[13]=z,e[14]=h):h=e[14];let x;e[15]!==a||e[16]!==n?(x=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ve,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"icon",children:t.jsx(De,{size:16})})}),t.jsx(Se,{align:"end",children:t.jsxs(be,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ne,{size:16}),n("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=n,e[17]=x):x=e[17];let j;e[18]!==h||e[19]!==x?(j=t.jsxs("div",{className:"flex items-start justify-between",children:[h,x]}),e[18]=h,e[19]=x,e[20]=j):j=e[20];let b;e[21]!==i.name?(b=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.name}),e[21]=i.name,e[22]=b):b=e[22];let k;e[23]!==i.description||e[24]!==n?(k=i.description||n("settings.skills.noDescription"),e[23]=i.description,e[24]=n,e[25]=k):k=e[25];let p;e[26]!==k?(p=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:k}),e[26]=k,e[27]=p):p=e[27];let v;e[28]!==b||e[29]!==p?(v=t.jsxs("div",{className:"flex flex-col gap-1",children:[b,p]}),e[28]=b,e[29]=p,e[30]=v):v=e[30];let d;e[31]!==j||e[32]!==v?(d=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[j,v]}),e[31]=j,e[32]=v,e[33]=d):d=e[33];let y;e[34]!==O||e[35]!==o||e[36]!==n?(y=o?n("settings.skills.importing"):O,e[34]=O,e[35]=o,e[36]=n,e[37]=y):y=e[37];let u;e[38]!==y?(u=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y})})}),e[38]=y,e[39]=u):u=e[39];let S;e[40]!==d||e[41]!==u?(S=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[d,u]}),e[40]=d,e[41]=u,e[42]=S):S=e[42];let T;return e[43]!==o||e[44]!==S||e[45]!==f||e[46]!==m?(T=t.jsxs(Ce,{size:"flush","aria-busy":o,className:f,children:[m,S]}),e[43]=o,e[44]=S,e[45]=f,e[46]=m,e[47]=T):T=e[47],T}function V(s){const e=se.c(2),{children:i}=s;let o;return e[0]!==i?(o=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:i}),e[0]=i,e[1]=o):o=e[1],o}function Ks(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(L),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:H.slashSkills(e.id)}),a.invalidateQueries({queryKey:H.orgFsSkills(e.id)})},j=r=>a.setQueryData(H.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",$=l.filter(Le),U=$.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if($.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String($.length),max:String(J)}));return}const _=Be(q),X=`skills/${_}`;let W=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:_}));return}W=!0;const A=He(_,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke($,_),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:_}))}catch(A){W&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:L,S=u===L?p:p.filter(r=>r.source===u),T=r=>f(_e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(F,{children:[t.jsx(F.Content,{children:t.jsx(F.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(F.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),w&&t.jsx(Me,{skillPath:w,onClose:()=>f(null)},w),t.jsx(me,{open:m!==null,onOpenChange:r=>!r&&N(null),children:t.jsxs(pe,{children:[t.jsxs(de,{children:[t.jsx(ue,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(ge,{children:s("settings.skills.deleteDialogDescription",{name:m?.name??""})})]}),t.jsxs(fe,{children:[t.jsx(he,{children:s("settings.skills.cancel")}),t.jsx(xe,{onClick:K,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{Ks as default};
1
+ import{b as ee,a6 as te,q as ne,r as E,j as t,B as Q,n as F,e0 as ae,a7 as ce,aP as me,aO as pe,aL as de,aJ as ue,aK as ge,aN as fe,aM as he,b9 as xe,t as C,dO as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as G,gG as Ce}from"./index-BuZqAz74.js";import{a as De}from"./SwitchHorizontal01-BQF84Li3.js";import{D as we}from"./agent-icon-DwJHakBB.js";import{s as Ne}from"./Trash01-BmQrADz0.js";import{i as Pe}from"./Upload01-DOfZqxci.js";import{i as ie}from"./Zap-DoxB0q6B.js";import{S as Ae}from"./search-toggle-rjC0c-Iy.js";import{E as Y}from"./empty-state-BK8GboWz.js";import{C as Ee}from"./collection-tabs-BkmY1xp_.js";import{S as Me,F as Oe}from"./folder-icon-CA298KqN.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-CAHuTLc_.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-DG5tQFfU.js";import{c as _e}from"./context-shell-Bnnp_FlP.js";import"./AlertCircle-CGZfuvxJ.js";import"./UserCheck01-BMoOFYIZ.js";import"./Tool01-BeDQSGiN.js";import"./ArrowUp-DJZ55cl-.js";import"./ArrowLeft-XURGfwpG.js";import"./ArrowRight-ZoKxZa45.js";import"./BookOpen01-gO5hgFUK.js";import"./Globe04-DO1uUwfE.js";import"./CheckCircle-CmN8U1V5.js";import"./TrendUp01-_SFSHjzO.js";import"./ChevronDown-ClblfTVV.js";import"./ChevronSelectorVertical-YxAp9GGa.js";import"./ChevronUp-0ZCAxpBW.js";import"./UserSquare-Dn1UPzSD.js";import"./LinkBroken01-cq4srxHs.js";import"./CreditCard01-CcTQ1h3_.js";import"./File02-Cs751Kds.js";import"./MessageCircle01-Bf6dD94_.js";import"./Eye-D5j_svLn.js";import"./Image01-CJL4B_rR.js";import"./Key01-fuHivqLl.js";import"./LayoutLeft-CCeum9wV.js";import"./Minus-Cc21R1KY.js";import"./Monitor01-DGdgEYxG.js";import"./Sun-D9ql5ZlI.js";import"./Play-zYFs_vGL.js";import"./Plus--DcN-eh1.js";import"./SearchMd-BwYuN52e.js";import"./ShoppingBag01-D-gmqcz7.js";import"./Users01-B_yoWxPn.js";import"./XClose-C4MsAn9v.js";import"./icon-button-DzpdeaSs.js";import"./tooltip-DnGqcvtu.js";import"./index-DNuvhcDO.js";import"./badge-BvHOfdxU.js";import"./markdown-CwYBGb1B.js";import"./use-copy-BFeXylk9.js";import"./use-mobile-Cq1k3-Gk.js";import"./use-panel-navigate-B3thngCs.js";import"./thread-route-Dw1cQjON.js";import"./use-project-scope-CD-cb4-V.js";import"./repository-binding-VVfcdUiy.js";import"./use-mcp-client-UWOU8UbZ.js";import"./auth-DuSLyK-k.js";import"./task-board-DEUSGytR.js";import"./schema-CCpL_LVZ.js";import"./file-preview-A0GfMNED.js";import"./utils-BdAsQahL.js";import"./editor-DNZ-WgCS.js";import"./file-type-icon-CSrE_noX.js";import"./useInfiniteQuery-CNxlkxws.js";import"./infiniteQueryObserver-CHN_AvWa.js";import"./use-view-draft-kind-CXMOqIBD.js";import"./use-blog-view-w4rEUATy.js";import"./use-organization-settings-D8JbZGlQ.js";import"./thread-intent-CyH0Z8_7.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-C7kLS2GY.js";import"./session-runtime-HHtypsTM.js";import"./use-entitlements-DgXhk8I6.js";import"./use-ai-providers-BG5EDM0R.js";import"./use-current-view-swKX6Bc6.js";import"./use-in-settings-cNZb_oio.js";import"./use-decopilot-events-SRdggwTs.js";import"./require-capability-DEShAaY8.js";import"./access-gate-DQ55JjgP.js";import"./capability-load-error-DCoklIp8.js";import"./sections-DmtYqnPM.js";import"./textarea-CcO-rfag.js";import"./use-ask-in-chat-C6eCNqgR.js";import"./shell-layout-rYoN4RTk.js";import"./use-deployment-admin-Dwt-RYsg.js";import"./admin-fetch-BhTJlAsX.js";import"./use-org-notice-D_lLzWXp.js";import"./command-DHGFzOhP.js";import"./index-DsWqYG3w.js";import"./integration-icon-D7fga3kk.js";import"./project-icon-BHn6Xq54.js";import"./use-navigate-to-agent-vJOwimSb.js";import"./use-debounced-value-CPl0Wyl6.js";import"./new-project-dialog-Bq2YhVDS.js";import"./label-Dm_T3WyF.js";import"./repository-picker-By75IHJa.js";import"./github-icon-h_xg-qFR.js";import"./collection-search-RWM-9f07.js";import"./new-project-store-C82itd6a.js";import"./legacy-admin-welcome-dialog-C0w-pw6s.js";import"./drawer-BXd80xtd.js";import"./required-auth-layout-GSSn-bTA.js";import"./use-org-sso-fZ2uDAIp.js";const J=200,Fe=new Set(["node_modules","__pycache__"]);function H(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Le(s){return H(s).split("/").every(e=>!e.startsWith(".")&&!Fe.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=H(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function Ge(s,e){const i=_e(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:we}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let D;e[3]!==i?(D=B(i),e[3]=i,e[4]=D):D=e[4];const R=D,w=o?"opacity-60":"hover:bg-accent";let f;e[5]!==w?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",w),e[5]=w,e[6]=f):f=e[6];let m;e[7]!==i.name||e[8]!==c||e[9]!==o?(m=!o&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":i.name}),e[7]=i.name,e[8]=c,e[9]=o,e[10]=m):m=e[10];const N=R?"default":"system",z=!R;let h;e[11]!==I||e[12]!==N||e[13]!==z?(h=t.jsx(Oe,{glyph:I,tone:N,readOnly:z,className:"size-8 shrink-0"}),e[11]=I,e[12]=N,e[13]=z,e[14]=h):h=e[14];let x;e[15]!==a||e[16]!==n?(x=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ve,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"icon",children:t.jsx(De,{size:16})})}),t.jsx(Se,{align:"end",children:t.jsxs(be,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ne,{size:16}),n("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=n,e[17]=x):x=e[17];let j;e[18]!==h||e[19]!==x?(j=t.jsxs("div",{className:"flex items-start justify-between",children:[h,x]}),e[18]=h,e[19]=x,e[20]=j):j=e[20];let b;e[21]!==i.name?(b=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.name}),e[21]=i.name,e[22]=b):b=e[22];let k;e[23]!==i.description||e[24]!==n?(k=i.description||n("settings.skills.noDescription"),e[23]=i.description,e[24]=n,e[25]=k):k=e[25];let p;e[26]!==k?(p=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:k}),e[26]=k,e[27]=p):p=e[27];let v;e[28]!==b||e[29]!==p?(v=t.jsxs("div",{className:"flex flex-col gap-1",children:[b,p]}),e[28]=b,e[29]=p,e[30]=v):v=e[30];let d;e[31]!==j||e[32]!==v?(d=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[j,v]}),e[31]=j,e[32]=v,e[33]=d):d=e[33];let y;e[34]!==O||e[35]!==o||e[36]!==n?(y=o?n("settings.skills.importing"):O,e[34]=O,e[35]=o,e[36]=n,e[37]=y):y=e[37];let u;e[38]!==y?(u=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y})})}),e[38]=y,e[39]=u):u=e[39];let S;e[40]!==d||e[41]!==u?(S=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[d,u]}),e[40]=d,e[41]=u,e[42]=S):S=e[42];let T;return e[43]!==o||e[44]!==S||e[45]!==f||e[46]!==m?(T=t.jsxs(Ce,{size:"flush","aria-busy":o,className:f,children:[m,S]}),e[43]=o,e[44]=S,e[45]=f,e[46]=m,e[47]=T):T=e[47],T}function V(s){const e=se.c(2),{children:i}=s;let o;return e[0]!==i?(o=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:i}),e[0]=i,e[1]=o):o=e[1],o}function Ks(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(L),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:G.slashSkills(e.id)}),a.invalidateQueries({queryKey:G.orgFsSkills(e.id)})},j=r=>a.setQueryData(G.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",_=l.filter(Le),U=_.find(A=>H(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let W=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}W=!0;const A=Ge($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(_,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){W&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:L,S=u===L?p:p.filter(r=>r.source===u),T=r=>f($e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(F,{children:[t.jsx(F.Content,{children:t.jsx(F.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(F.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),w&&t.jsx(Me,{skillPath:w,onClose:()=>f(null)},w),t.jsx(me,{open:m!==null,onOpenChange:r=>!r&&N(null),children:t.jsxs(pe,{children:[t.jsxs(de,{children:[t.jsx(ue,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(ge,{children:s("settings.skills.deleteDialogDescription",{name:m?.name??""})})]}),t.jsxs(fe,{children:[t.jsx(he,{children:s("settings.skills.cancel")}),t.jsx(xe,{onClick:K,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{Ks as default};
@@ -1 +1 @@
1
- import{c as _,m as N,j}from"./index-BRgWMc-5.js";import{T as k,R as z,a as D,b as S}from"./index-CH8HRuHa.js";function V(T){const e=_.c(41);let i,t,n,s,c,b,g,o,r,a;e[0]!==T?({className:i,defaultValue:t,value:a,min:b,max:g,onPointerDown:s,onKeyDown:n,thumbLabel:o,thumbValueText:r,...c}=T,e[0]=T,e[1]=i,e[2]=t,e[3]=n,e[4]=s,e[5]=c,e[6]=b,e[7]=g,e[8]=o,e[9]=r,e[10]=a):(i=e[1],t=e[2],n=e[3],s=e[4],c=e[5],b=e[6],g=e[7],o=e[8],r=e[9],a=e[10]);const d=b===void 0?0:b,u=g===void 0?100:g;let p;e[11]!==t||e[12]!==u||e[13]!==d||e[14]!==a?(p=Array.isArray(a)?a:Array.isArray(t)?t:[d,u],e[11]=t,e[12]=u,e[13]=d,e[14]=a,e[15]=p):p=e[15];const A=p;let f;e[16]!==i?(f=N("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",i),e[16]=i,e[17]=f):f=e[17];let m;e[18]!==s?(m=l=>{l.currentTarget.dataset.pointer="",s?.(l)},e[18]=s,e[19]=m):m=e[19];let h;e[20]!==n?(h=l=>{delete l.currentTarget.dataset.pointer,n?.(l)},e[20]=n,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=N("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[22]=x):x=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=j.jsx(k,{"data-slot":"slider-track",className:x,children:j.jsx(z,{"data-slot":"slider-range",className:N("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[23]=w):w=e[23];let v;if(e[24]!==A.length||e[25]!==o||e[26]!==r){let l;e[28]!==o||e[29]!==r?(l=(E,R)=>j.jsx(S,{"data-slot":"slider-thumb",...o!==void 0?{"aria-label":o}:{},...r!==void 0?{"aria-valuetext":r}:{},className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},R),e[28]=o,e[29]=r,e[30]=l):l=e[30],v=Array.from({length:A.length},l),e[24]=A.length,e[25]=o,e[26]=r,e[27]=v}else v=e[27];let y;return e[31]!==t||e[32]!==u||e[33]!==d||e[34]!==c||e[35]!==f||e[36]!==m||e[37]!==h||e[38]!==v||e[39]!==a?(y=j.jsxs(D,{"data-slot":"slider",defaultValue:t,value:a,min:d,max:u,className:f,...c,onPointerDown:m,onKeyDown:h,children:[w,v]}),e[31]=t,e[32]=u,e[33]=d,e[34]=c,e[35]=f,e[36]=m,e[37]=h,e[38]=v,e[39]=a,e[40]=y):y=e[40],y}export{V as S};
1
+ import{c as _,m as N,j}from"./index-BuZqAz74.js";import{T as k,R as z,a as D,b as S}from"./index-rt88hTRg.js";function V(T){const e=_.c(41);let i,t,n,s,c,b,g,o,r,a;e[0]!==T?({className:i,defaultValue:t,value:a,min:b,max:g,onPointerDown:s,onKeyDown:n,thumbLabel:o,thumbValueText:r,...c}=T,e[0]=T,e[1]=i,e[2]=t,e[3]=n,e[4]=s,e[5]=c,e[6]=b,e[7]=g,e[8]=o,e[9]=r,e[10]=a):(i=e[1],t=e[2],n=e[3],s=e[4],c=e[5],b=e[6],g=e[7],o=e[8],r=e[9],a=e[10]);const d=b===void 0?0:b,u=g===void 0?100:g;let p;e[11]!==t||e[12]!==u||e[13]!==d||e[14]!==a?(p=Array.isArray(a)?a:Array.isArray(t)?t:[d,u],e[11]=t,e[12]=u,e[13]=d,e[14]=a,e[15]=p):p=e[15];const A=p;let f;e[16]!==i?(f=N("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",i),e[16]=i,e[17]=f):f=e[17];let m;e[18]!==s?(m=l=>{l.currentTarget.dataset.pointer="",s?.(l)},e[18]=s,e[19]=m):m=e[19];let h;e[20]!==n?(h=l=>{delete l.currentTarget.dataset.pointer,n?.(l)},e[20]=n,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=N("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[22]=x):x=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=j.jsx(k,{"data-slot":"slider-track",className:x,children:j.jsx(z,{"data-slot":"slider-range",className:N("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[23]=w):w=e[23];let v;if(e[24]!==A.length||e[25]!==o||e[26]!==r){let l;e[28]!==o||e[29]!==r?(l=(E,R)=>j.jsx(S,{"data-slot":"slider-thumb",...o!==void 0?{"aria-label":o}:{},...r!==void 0?{"aria-valuetext":r}:{},className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},R),e[28]=o,e[29]=r,e[30]=l):l=e[30],v=Array.from({length:A.length},l),e[24]=A.length,e[25]=o,e[26]=r,e[27]=v}else v=e[27];let y;return e[31]!==t||e[32]!==u||e[33]!==d||e[34]!==c||e[35]!==f||e[36]!==m||e[37]!==h||e[38]!==v||e[39]!==a?(y=j.jsxs(D,{"data-slot":"slider",defaultValue:t,value:a,min:d,max:u,className:f,...c,onPointerDown:m,onKeyDown:h,children:[w,v]}),e[31]=t,e[32]=u,e[33]=d,e[34]=c,e[35]=f,e[36]=m,e[37]=h,e[38]=v,e[39]=a,e[40]=y):y=e[40],y}export{V as S};
@@ -1 +1 @@
1
- import{r as v,eR as G}from"./index-BRgWMc-5.js";import{b as de,d as fe,e as U,f as ge,g as pe,h as be,i as ve,C as Y,j as he,K as R,k as me,l as xe,m as Ie,s as Re}from"./task-key-BWUT6sLU.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ye(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Pe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=G.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function Xe(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),y=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&y&&i(g)},[x,g,y,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:ye(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return G.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function _e(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:y,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:K}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:P,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(K,P),S=!!T,X=S&&!y&&O(d)&&O(h),_=!w&&M,j=_&&X?oe:null,ie=X?j??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,F=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!F,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:K,setDraggableNodeRef:P,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(_&&!ve(Z)||!u)&&(S||F))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[R.Down,R.Right,R.Up,R.Left],je=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case R.Down:r.top<d.top&&f.push(l);break;case R.Up:r.top>d.top&&f.push(l);break;case R.Left:r.left>d.left&&f.push(l);break;case R.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,y=d?.node.current;if(y&&g&&l&&d){const h=Ie(y).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:Re(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Xe as S,q as a,B as r,je as s,_e as u,Pe as v};
1
+ import{r as v,eT as G}from"./index-BuZqAz74.js";import{b as de,d as fe,e as U,f as ge,g as pe,h as be,i as ve,C as Y,j as he,K as y,k as me,l as xe,m as Ie,s as ye}from"./task-key-DaPOId6s.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Pe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=G.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function Xe(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return G.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function _e(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:K}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:P,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(K,P),S=!!T,X=S&&!R&&O(d)&&O(h),_=!w&&M,j=_&&X?oe:null,ie=X?j??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,F=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!F,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:K,setDraggableNodeRef:P,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(_&&!ve(Z)||!u)&&(S||F))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],je=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Xe as S,q as a,B as r,je as s,_e as u,Pe as v};
@@ -1 +1 @@
1
- import{b as A,a4 as B,r as v,j as e,n as x,hq as k,gT as b,gf as y,gg as a,i7 as D,B as m,I as g,aN as z,aM as T,aJ as O,aH as R,aL as q,aK as F,b7 as M,E as C,t as c,c as U}from"./index-BRgWMc-5.js";import{D as H}from"./domain-settings-DMjKDVZw.js";import{S as $}from"./switch-CfemO1do.js";import{a as J,b as K,c as G,d as Q}from"./use-org-sso-DXCHIqdV.js";import{s as V}from"./Trash01-CnPGIwZe.js";import{R as W}from"./require-capability-58lj_sLx.js";import"./badge-Ba_DCLD5.js";import"./select-B282Slsg.js";import"./index-BdQq_4o_.js";import"./index-3k_nlNc7.js";import"./ChevronDown-CGJhfuSb.js";import"./ChevronUp-BO9DemUb.js";import"./access-gate-BcSivdgh.js";import"./capability-load-error-LShIU80A.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=J(o.id,o.slug),f=K(o.id,o.slug),S=G(o.id,o.slug),E=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[d,p]=v.useState(!1),[P,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,N=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},_=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},w=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},L=async t=>{try{await E.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx(H,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!d&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx($,{checked:n.enforced,onCheckedChange:L,disabled:E.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:N,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||d)&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(g,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(g,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:d&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(g,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(g,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(g,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(g,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[d&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:_,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(d?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(z,{open:P,onOpenChange:j,children:e.jsxs(T,{children:[e.jsx(O,{children:e.jsx(R,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(q,{children:[e.jsx(F,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(M,{onClick:w,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function ue(){const s=U.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{ue as default};
1
+ import{b as A,a6 as B,r as v,j as e,n as x,hs as k,gV as b,gh as y,gi as a,i9 as D,B as m,I as g,aP as z,aO as O,aL as T,aJ as R,aN as F,aM as M,b9 as q,E as C,t as c,c as U}from"./index-BuZqAz74.js";import{D as $}from"./domain-settings-DWaq5CPi.js";import{S as H}from"./switch-COjzxQ39.js";import{a as J,b as V,c as G,d as K}from"./use-org-sso-fZ2uDAIp.js";import{s as Q}from"./Trash01-BmQrADz0.js";import{R as W}from"./require-capability-DEShAaY8.js";import"./badge-BvHOfdxU.js";import"./select-BkYZ4NYA.js";import"./index-BdQq_4o_.js";import"./index-DNuvhcDO.js";import"./ChevronDown-ClblfTVV.js";import"./ChevronUp-0ZCAxpBW.js";import"./access-gate-DQ55JjgP.js";import"./capability-load-error-DCoklIp8.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:P}=J(o.id,o.slug),f=V(o.id,o.slug),S=G(o.id,o.slug),E=K(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[d,p]=v.useState(!1),[I,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,N=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},_=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},w=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},L=async t=>{try{await E.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx($,{}),P?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!d&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx(H,{checked:n.enforced,onCheckedChange:L,disabled:E.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(Q,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:N,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||d)&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(g,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(g,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:d&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(g,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(g,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(g,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(g,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[d&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:_,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(d?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(z,{open:I,onOpenChange:j,children:e.jsxs(O,{children:[e.jsx(T,{children:e.jsx(R,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(F,{children:[e.jsx(M,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(q,{onClick:w,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function ue(){const s=U.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{ue as default};