decocms 4.576.4 → 4.577.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 (503) hide show
  1. package/dist/client/assets/{AlertCircle-CsPTcN_S.js → AlertCircle-BdE1rZoJ.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CPcUCL9A.js → AreaChart-D0m3b7qG.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-BYhfnAa5.js → ArrowLeft-DIrnwv8l.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Cv1SmuzD.js → ArrowUp-km-Xmh__.js} +1 -1
  5. package/dist/client/assets/BookOpen01-BneB1q9z.js +1 -0
  6. package/dist/client/assets/{CartesianChart-1SsRQdZi.js → CartesianChart-BwsWHEdb.js} +1 -1
  7. package/dist/client/assets/{CategoricalChart-B9nv4p9e.js → CategoricalChart-Dxo_7xLg.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-LO8Q7KlB.js → CheckCircle-CiBUynzC.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-Bo1EsiyQ.js → ChevronSelectorVertical-CRWdnYCm.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-Dh24Sq_k.js → ChevronUp-B7dgqvYM.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-B0xYA-L3.js → CreditCard01-CcIddg9s.js} +1 -1
  12. package/dist/client/assets/{Globe04-ceJSWDa3.js → Globe04-DIBckqos.js} +1 -1
  13. package/dist/client/assets/{Key01-D9P3FMiY.js → Key01-BV5ckBOE.js} +1 -1
  14. package/dist/client/assets/{LinkBroken01-B3rPhu7D.js → LinkBroken01-Mv2kbzSM.js} +1 -1
  15. package/dist/client/assets/{Minus-BP4M5eUu.js → Minus-Bygm9L7w.js} +1 -1
  16. package/dist/client/assets/{Monitor01-BIy7Jnq0.js → Monitor01-HDGt-WwC.js} +1 -1
  17. package/dist/client/assets/{Play-C4cdDhC3.js → Play-DROL2O51.js} +1 -1
  18. package/dist/client/assets/{Plus-Bcl7avNA.js → Plus-C-Or0hIv.js} +1 -1
  19. package/dist/client/assets/ReferenceLine-BPmIH9b3.js +1 -0
  20. package/dist/client/assets/{SearchMd-DRs-Ld4Z.js → SearchMd-D88tiwag.js} +1 -1
  21. package/dist/client/assets/ShoppingBag01-Cdbqpanm.js +1 -0
  22. package/dist/client/assets/{Sun-oVWnfq_E.js → Sun-CgOyXDTW.js} +1 -1
  23. package/dist/client/assets/{SwitchHorizontal01-BTdsV_bI.js → SwitchHorizontal01-Dkkqg27i.js} +1 -1
  24. package/dist/client/assets/{Tool01-BWMOxR8v.js → Tool01-D4tVVqAj.js} +1 -1
  25. package/dist/client/assets/{Tooltip-DHjHeuys.js → Tooltip-cgLuNyXo.js} +1 -1
  26. package/dist/client/assets/{Trash01-CgWosjFE.js → Trash01-Cqkcp6ky.js} +1 -1
  27. package/dist/client/assets/{Upload01-DAMBCMxP.js → Upload01-CsOcxm5q.js} +1 -1
  28. package/dist/client/assets/{UserSquare-BjqAifU8.js → UserSquare-CK-bjijW.js} +1 -1
  29. package/dist/client/assets/{Users01-Bt0rcyOL.js → Users01-BpEuprvx.js} +1 -1
  30. package/dist/client/assets/{XClose-TMdj_yIm.js → XClose-D9taHFI1.js} +1 -1
  31. package/dist/client/assets/{Zap-BJ5eCR1y.js → Zap-BhxT34oC.js} +1 -1
  32. package/dist/client/assets/{access-gate-DbqD_EAv.js → access-gate-Bbt03qvc.js} +1 -1
  33. package/dist/client/assets/{add-connection-dialog-DigMA6Jw.js → add-connection-dialog-EzR6kkmo.js} +1 -1
  34. package/dist/client/assets/agent-app-xUigIkK8.js +1 -0
  35. package/dist/client/assets/agent-assets-DUoWUOFt.js +1 -0
  36. package/dist/client/assets/agent-automation-Cyb5qsWY.js +20 -0
  37. package/dist/client/assets/agent-automations-HcbM2XMD.js +1 -0
  38. package/dist/client/assets/agent-blog-BLi3oKLw.js +2 -0
  39. package/dist/client/assets/agent-blog-post-DXyE25Wg.js +2 -0
  40. package/dist/client/assets/agent-calendar-D7ih9de1.js +1 -0
  41. package/dist/client/assets/{agent-capabilities-DODsAfWG.js → agent-capabilities-CrqOfLmC.js} +1 -1
  42. package/dist/client/assets/agent-connect-sources-DtVo8JXM.js +1 -0
  43. package/dist/client/assets/agent-deck-Cs__MOn_.js +1 -0
  44. package/dist/client/assets/agent-e2e-CBM_w3qk.js +1 -0
  45. package/dist/client/assets/agent-experiments-CR3rcuNZ.js +1 -0
  46. package/dist/client/assets/agent-file-DjiNMKB3.js +1 -0
  47. package/dist/client/assets/agent-hosting-C70MC-PA.js +1 -0
  48. package/dist/client/assets/agent-icon-bK3wLPrb.js +1 -0
  49. package/dist/client/assets/agent-library-CeznhRs4.js +1 -0
  50. package/dist/client/assets/agent-library-file-B-Sx2y3P.js +1 -0
  51. package/dist/client/assets/agent-overview-CFue46Ll.js +1 -0
  52. package/dist/client/assets/agent-releases-BlbJtMk9.js +2 -0
  53. package/dist/client/assets/agent-settings-BljPRjiA.js +1 -0
  54. package/dist/client/assets/{agent-site-editor-Z6rBuS35.js → agent-site-editor-BeTpu1p8.js} +9 -9
  55. package/dist/client/assets/agent-site-editor-code-BAiYvGFH.js +2 -0
  56. package/dist/client/assets/agent-site-editor-content-Bl3XwQ5q.js +1 -0
  57. package/dist/client/assets/agent-site-editor-preview-Cys48HaE.js +1 -0
  58. package/dist/client/assets/agent-view-DlR04ups.js +1 -0
  59. package/dist/client/assets/agent-view-guard-CruOWgYs.js +1 -0
  60. package/dist/client/assets/ai-providers-C2yFfgyi.js +1 -0
  61. package/dist/client/assets/{alert-TFdEDT2O.js → alert-jF8tTR34.js} +1 -1
  62. package/dist/client/assets/{analytics-sections-CopwZcAF.js → analytics-sections-Qo8FMsPn.js} +1 -1
  63. package/dist/client/assets/{api-keys-BRzjuZvx.js → api-keys-15uqAkvj.js} +1 -1
  64. package/dist/client/assets/api-keys-BYU6jhvq.js +1 -0
  65. package/dist/client/assets/app-editor-B4pmL5qY.js +1 -0
  66. package/dist/client/assets/{asset-utils-B4QYhZxH.js → asset-utils-CwQVXoYw.js} +1 -1
  67. package/dist/client/assets/{auth-TL5_hJeY.js → auth-YGSVzhUG.js} +1 -1
  68. package/dist/client/assets/{auth-catchall-na7siRgx.js → auth-catchall-hWKWJU80.js} +1 -1
  69. package/dist/client/assets/{auth-entry-BGo8_cbu.js → auth-entry-DpL4vu4t.js} +1 -1
  70. package/dist/client/assets/{auth-split-layout-BISVCxy2.js → auth-split-layout-BFmr3RnK.js} +1 -1
  71. package/dist/client/assets/{authenticate-and-persist-oauth-CUE7ik09.js → authenticate-and-persist-oauth-DHgqzdUM.js} +1 -1
  72. package/dist/client/assets/{automation-list-row-DpSl9UM5.js → automation-list-row-BAeLE453.js} +1 -1
  73. package/dist/client/assets/{automation-runs-BfKHSay9.js → automation-runs-C7o6atC8.js} +1 -1
  74. package/dist/client/assets/automations-BvOuQD58.js +1 -0
  75. package/dist/client/assets/{badge-D7MkXlu5.js → badge-D9oJO89f.js} +1 -1
  76. package/dist/client/assets/block-document-Phc0b_hv.js +3 -0
  77. package/dist/client/assets/{blocks-preview-workspace-context-DFEoJmhw.js → blocks-preview-workspace-context-XztheX0p.js} +1 -1
  78. package/dist/client/assets/{blocks-tab-states-DASlUdvo.js → blocks-tab-states-CPXZUbSV.js} +1 -1
  79. package/dist/client/assets/blog-preview-url-BlQDNdnl.js +1 -0
  80. package/dist/client/assets/blog-schema-BY4m7Viq.js +1 -0
  81. package/dist/client/assets/blog-source-gate-CiOBhTPt.js +1 -0
  82. package/dist/client/assets/blog-view-gate-CCZFjbaz.js +1 -0
  83. package/dist/client/assets/{buckets-DWZ0uMIH.js → buckets-BkOGaNvk.js} +1 -1
  84. package/dist/client/assets/{build-improve-prompt-doc-Cp4dU57k.js → build-improve-prompt-doc-BvBG7PT7.js} +1 -1
  85. package/dist/client/assets/{calendar-J9rCuEM0.js → calendar-CNAmcpRM.js} +1 -1
  86. package/dist/client/assets/{capability-load-error-cDMC87PI.js → capability-load-error-BfsuWu82.js} +1 -1
  87. package/dist/client/assets/category-editor-DfKRUZ0M.js +1 -0
  88. package/dist/client/assets/category-tree-C0ZkCPxc.js +4 -0
  89. package/dist/client/assets/{chart-sO-wf7w_.js → chart-CjhZfLhJ.js} +1 -1
  90. package/dist/client/assets/chat-context-BXBBnsXM.js +39 -0
  91. package/dist/client/assets/{chat-draft-B_pQlOo7.js → chat-draft-BiNhHFHP.js} +1 -1
  92. package/dist/client/assets/{checkbox-CDdGUfxj.js → checkbox-BqeIWnOr.js} +1 -1
  93. package/dist/client/assets/choose-editor-C3lPTBrc.js +1 -0
  94. package/dist/client/assets/{cli-auth-success-BAsObd7a.js → cli-auth-success-DXTy0zTr.js} +1 -1
  95. package/dist/client/assets/{client-icons-Bp0n81sC.js → client-icons-bVQyh7Ui.js} +1 -1
  96. package/dist/client/assets/cms-settings-editor-BGhvXRA5.js +1 -0
  97. package/dist/client/assets/cms-store-drafts-C_2pJAHv.js +1 -0
  98. package/dist/client/assets/collapsible-M6EMuds1.js +1 -0
  99. package/dist/client/assets/collection-detail-DtpW8ulK.js +1 -0
  100. package/dist/client/assets/{collection-display-button-D3cSy-rU.js → collection-display-button-CLT_iQ9K.js} +1 -1
  101. package/dist/client/assets/{collection-search-DmyrNuWr.js → collection-search-d8_we7KS.js} +1 -1
  102. package/dist/client/assets/{collection-table-wrapper-BVBFYCyq.js → collection-table-wrapper-jjhzHxOC.js} +1 -1
  103. package/dist/client/assets/{collection-tabs-CzJgsFmP.js → collection-tabs-CDEZauaw.js} +1 -1
  104. package/dist/client/assets/{combobox-Cy1ac_Va.js → combobox-eXr44O4N.js} +1 -1
  105. package/dist/client/assets/{command-Bh995x5J.js → command-CL5fBjco.js} +1 -1
  106. package/dist/client/assets/{companion-mcps-section-DHnNnyh5.js → companion-mcps-section-ZhumvGkq.js} +1 -1
  107. package/dist/client/assets/config-DTkH3DlA.js +1 -0
  108. package/dist/client/assets/{connect-DN6GB1WI.js → connect-DTRBNGAJ.js} +3 -3
  109. package/dist/client/assets/{connect-layout-DllpY2qm.js → connect-layout-C9YZDE5a.js} +1 -1
  110. package/dist/client/assets/{connect-source-dialog-C4jdSJZP.js → connect-source-dialog-CtNzRZNm.js} +1 -1
  111. package/dist/client/assets/{connection-S1Y-z6Ze.js → connection-DQRUSri4.js} +1 -1
  112. package/dist/client/assets/{connection-card-GbDbFKHX.js → connection-card-DiXDtKCD.js} +1 -1
  113. package/dist/client/assets/connection-detail-A1N-eCPy.js +1 -0
  114. package/dist/client/assets/{connection-form-helpers-DwQM2AXJ.js → connection-form-helpers-DbQ-1SYg.js} +1 -1
  115. package/dist/client/assets/{connection-slug-CQeaB-ii.js → connection-slug-eNvNu5ns.js} +1 -1
  116. package/dist/client/assets/connections-F6Cb4hev.js +1 -0
  117. package/dist/client/assets/content-tab-zWTaVHTI.js +19 -0
  118. package/dist/client/assets/context-jjXucCze.js +1 -0
  119. package/dist/client/assets/{context-menu-_4SjkJP2.js → context-menu-C8EhSOHZ.js} +1 -1
  120. package/dist/client/assets/{context-shell-2FHUOtQh.js → context-shell-DAsZEr3G.js} +3 -3
  121. package/dist/client/assets/{core.esm-Cx2tI-v0.js → core.esm-q-GZRseF.js} +2 -2
  122. package/dist/client/assets/{create-organization-dialog-DztBZJfG.js → create-organization-dialog-B0fwudcl.js} +1 -1
  123. package/dist/client/assets/delete-copy-DewsXC-x.js +4 -0
  124. package/dist/client/assets/{device-hint-DiJItdVl.js → device-hint-DOHdIy74.js} +1 -1
  125. package/dist/client/assets/discover-Sgb2XR4X.js +1 -0
  126. package/dist/client/assets/{domain-settings-DEAsOpnU.js → domain-settings-CzQKvon-.js} +1 -1
  127. package/dist/client/assets/{drawer-BcaULeep.js → drawer-CT21cqiT.js} +1 -1
  128. package/dist/client/assets/{editor-DXF9rwVo.js → editor-DSTLBMSV.js} +2 -2
  129. package/dist/client/assets/{editor-classes-DEwbN0MI.js → editor-classes-DNgU6VQ_.js} +1 -1
  130. package/dist/client/assets/empty-message-0iKzEZgc.js +15 -0
  131. package/dist/client/assets/{empty-state-Ccl8OC-j.js → empty-state-C7mAM8aV.js} +1 -1
  132. package/dist/client/assets/{empty-state-Cfajk5TO.js → empty-state-De0GyKdS.js} +1 -1
  133. package/dist/client/assets/experiments-tab-choice-DwnKczQ0.js +1 -0
  134. package/dist/client/assets/{extract-connection-data-biKUq-5E.js → extract-connection-data-C9uUQyrf.js} +1 -1
  135. package/dist/client/assets/feature-gate-BekWNhM3.js +1 -0
  136. package/dist/client/assets/{feature-paywall-DasxziSs.js → feature-paywall-CzMsGR-v.js} +1 -1
  137. package/dist/client/assets/file-explorer-BA6AotC6.js +2 -0
  138. package/dist/client/assets/{file-preview-Dmy5YhII.js → file-preview-CK5Pkylz.js} +1 -1
  139. package/dist/client/assets/{file-share-button-Cl-IgS5x.js → file-share-button-qjRy5kh1.js} +1 -1
  140. package/dist/client/assets/{file-type-icon-D75nksOt.js → file-type-icon-DI74_rhH.js} +1 -1
  141. package/dist/client/assets/{folder-icon-C5I9OzDM.js → folder-icon-RhxrL37z.js} +1 -1
  142. package/dist/client/assets/{form-CIThj_T9.js → form-czY_WZeB.js} +1 -1
  143. package/dist/client/assets/frame-navigation-D3lcT6PQ.js +1 -0
  144. package/dist/client/assets/general-DyfkLFv0.js +1 -0
  145. package/dist/client/assets/{github-icon--dnMj3-y.js → github-icon-DbvGzNXg.js} +1 -1
  146. package/dist/client/assets/held-block-view-616AHRnA.js +3 -0
  147. package/dist/client/assets/home-CvjGQ8iY.js +1 -0
  148. package/dist/client/assets/{home-overview-g3rcNgW7.js → home-overview-BspPD0Qy.js} +1 -1
  149. package/dist/client/assets/hosted-reconcile-gX34y3hJ.js +1 -0
  150. package/dist/client/assets/{icon-button-CyNmKrzV.js → icon-button-Bek6uWU8.js} +1 -1
  151. package/dist/client/assets/{index-Dd5hidCj.js → index-5IFWC0PS.js} +47 -47
  152. package/dist/client/assets/index-BASUN16S.js +4 -0
  153. package/dist/client/assets/{index-BtqPZIqH.js → index-BFLUunGm.js} +1 -1
  154. package/dist/client/assets/index-BVaQtZpO.js +1 -0
  155. package/dist/client/assets/index-B_hHGrWo.js +1 -0
  156. package/dist/client/assets/{index-DjpHvK_4.js → index-BgGa_gEX.js} +1 -1
  157. package/dist/client/assets/{index-B_wKEr5f.js → index-CJqO_lXj.js} +1 -1
  158. package/dist/client/assets/{index-DrqsNFYR.js → index-CLog75-o.js} +1 -1
  159. package/dist/client/assets/{index-nO2S2V0T.js → index-CYAg_mZ5.js} +6 -6
  160. package/dist/client/assets/{index-_nd_1JQz.js → index-Cb-PI-oM.js} +1 -1
  161. package/dist/client/assets/{index-BF9ePDqU.js → index-Cn4blTB2.js} +2 -2
  162. package/dist/client/assets/{index-ozu548h3.js → index-Co1pEKoz.js} +1 -1
  163. package/dist/client/assets/{index-BrihqSoi.js → index-Cq3k2rBV.js} +1 -1
  164. package/dist/client/assets/index-D6lWWdm-.js +1 -0
  165. package/dist/client/assets/{index-BCZy-897.js → index-DI1WEe1Y.js} +1 -1
  166. package/dist/client/assets/index-DYPWHH-M.css +1 -0
  167. package/dist/client/assets/{index-DgYBSkMj.js → index-ZpYsIOky.js} +2 -2
  168. package/dist/client/assets/{index-B57dAAxD.js → index-e47kvUTQ.js} +1 -1
  169. package/dist/client/assets/{index-redirect-DUi7z5TL.js → index-redirect-B5LCK4UZ.js} +1 -1
  170. package/dist/client/assets/{infiniteQueryObserver-C1uWfhgO.js → infiniteQueryObserver-CgeE9MzI.js} +1 -1
  171. package/dist/client/assets/{infra-billing-DWMi-9eg.js → infra-billing-D_NOfbaI.js} +1 -1
  172. package/dist/client/assets/{input-B-TiyPUk.js → input-1bbcsHzM.js} +3 -3
  173. package/dist/client/assets/{input-DKlZJGf0.js → input-Cof38_0i.js} +1 -1
  174. package/dist/client/assets/{integration-icon-DHvbSqTM.js → integration-icon-ClorKiq5.js} +1 -1
  175. package/dist/client/assets/item-actions-pz3LKYdP.js +1 -0
  176. package/dist/client/assets/{jira-icon-CUlCkXDM.js → jira-icon-CSE5FXRa.js} +1 -1
  177. package/dist/client/assets/{label-BZoCdZa0.js → label-C1myK8cj.js} +1 -1
  178. package/dist/client/assets/{layout-C4bx239O.js → layout-B4vND3NH.js} +1 -1
  179. package/dist/client/assets/{legacy-admin-welcome-dialog-BgMnIQY9.js → legacy-admin-welcome-dialog-DtBTs-JZ.js} +1 -1
  180. package/dist/client/assets/{legacy-agents-deep-BELlTHpx.js → legacy-agents-deep-wdUtLgZd.js} +1 -1
  181. package/dist/client/assets/{legacy-main-redirect-CxAuaPrB.js → legacy-main-redirect-D0dw61Zg.js} +1 -1
  182. package/dist/client/assets/library-DmRa8bBp.js +1 -0
  183. package/dist/client/assets/{library-tab-CnjcP9yb.js → library-tab-3lHWVZnM.js} +4 -4
  184. package/dist/client/assets/{login-CA5_HXz3.js → login-OeBuTK5R.js} +1 -1
  185. package/dist/client/assets/{markdown-ZlzKtNkL.js → markdown-BhnPL5Bs.js} +1 -1
  186. package/dist/client/assets/{mcp-app-renderer-CRFiwN6n.js → mcp-app-renderer-DeImvVKz.js} +1 -1
  187. package/dist/client/assets/{mcp-oauth-Cq-Z82WC.js → mcp-oauth-D2St0yzi.js} +1 -1
  188. package/dist/client/assets/{mcp-oauth-VaMDOw7T.js → mcp-oauth-DAPLorIu.js} +1 -1
  189. package/dist/client/assets/{members-CHUd-Ol1.js → members-CRV8r-1W.js} +1 -1
  190. package/dist/client/assets/{memory-CltSbzPH.js → memory-C08OAgnC.js} +2 -2
  191. package/dist/client/assets/{mock-board-TQVQrJy0.js → mock-board-UupkdDTJ.js} +3 -3
  192. package/dist/client/assets/{monaco-editor-BZNPSifL.js → monaco-editor-DgmLjwMj.js} +1 -1
  193. package/dist/client/assets/{monitoring-D-eHzsjl.js → monitoring-C2AkJ1E2.js} +2 -2
  194. package/dist/client/assets/{monitoring-stats-row-C7sD_prp.js → monitoring-stats-row-BkupHr4w.js} +1 -1
  195. package/dist/client/assets/{multi-select-DL8hrKQv.js → multi-select-D_-o3Z5k.js} +1 -1
  196. package/dist/client/assets/mustache-D-pZ4GVh.js +4 -0
  197. package/dist/client/assets/named-rule-step-BqRLfozU.js +1 -0
  198. package/dist/client/assets/named-rule-view-Cjao8aHC.js +1 -0
  199. package/dist/client/assets/{new-project-dialog-BDUp1HsF.js → new-project-dialog-ly3jlxrO.js} +1 -1
  200. package/dist/client/assets/{oauth-callback-D-Igsrh7.js → oauth-callback-DGsbFvpE.js} +1 -1
  201. package/dist/client/assets/{oauth-callback-ai-provider-Yifk_dmU.js → oauth-callback-ai-provider-DH_kBA_S.js} +1 -1
  202. package/dist/client/assets/{oauth-consent-DlsvLpih.js → oauth-consent-DiV1G_a8.js} +1 -1
  203. package/dist/client/assets/{onboarding-CyvbU-47.js → onboarding-wSysb6DG.js} +1 -1
  204. package/dist/client/assets/openai-conversation-BnmAjQv3.js +3 -0
  205. package/dist/client/assets/{optimistic-project-sidebar-views-DMLee7lV.js → optimistic-project-sidebar-views-BddiZzQV.js} +1 -1
  206. package/dist/client/assets/{order-monitor-day-D_UJY8n7.js → order-monitor-day-vJd_rbss.js} +1 -1
  207. package/dist/client/assets/{organization-choice-11vPd3Oe.js → organization-choice-B_C6gRzc.js} +1 -1
  208. package/dist/client/assets/{orgs-CO5mj27b.js → orgs-Hd1POC7b.js} +1 -1
  209. package/dist/client/assets/{own-accounts-section-VOVPBP5x.js → own-accounts-section-DRAcUJQm.js} +1 -1
  210. package/dist/client/assets/{pair-D5jYRLOi.js → pair-DsQEIDjk.js} +7 -7
  211. package/dist/client/assets/parse-sections-DAMeYP46.js +4 -0
  212. package/dist/client/assets/plan-9F8q1LmB.js +1 -0
  213. package/dist/client/assets/{plan-ladder-42sSWoBs.js → plan-ladder-BVTNP5Xz.js} +1 -1
  214. package/dist/client/assets/{plan-usage-card-DawnbwSf.js → plan-usage-card-Du0lOF_J.js} +2 -2
  215. package/dist/client/assets/{popover-4z9eDM-9.js → popover-DP7XfF8t.js} +1 -1
  216. package/dist/client/assets/post-calendar-DDpUGeeB.js +1 -0
  217. package/dist/client/assets/post-editor-DtDeATFH.js +2 -0
  218. package/dist/client/assets/{preview-content-DAApomFo.js → preview-content-C5OVyGLr.js} +1 -1
  219. package/dist/client/assets/{preview-dialog-BYfDupos.js → preview-dialog-DuuWqEir.js} +1 -1
  220. package/dist/client/assets/{preview-panel-BnTSUu1W.js → preview-panel-BZ5HJll2.js} +1 -1
  221. package/dist/client/assets/preview-tab-P_107JPX.js +551 -0
  222. package/dist/client/assets/{product-picker-dialog-CtVVJBu_.js → product-picker-dialog-Dt7DCQ6n.js} +1 -1
  223. package/dist/client/assets/{profile-Cespz5EQ.js → profile-GhJox0Lx.js} +1 -1
  224. package/dist/client/assets/project-app-view-qeUPQ38h.js +1 -0
  225. package/dist/client/assets/project-apps-DfPcY68g.js +1 -0
  226. package/dist/client/assets/{project-icon-BC5BTHqT.js → project-icon-B90806PF.js} +1 -1
  227. package/dist/client/assets/{project-index-Cov2uCEL.js → project-index-Do6iewlo.js} +1 -1
  228. package/dist/client/assets/project-reports-CidF3Xyg.js +1 -0
  229. package/dist/client/assets/project-tasks-BYy46ISP.js +1 -0
  230. package/dist/client/assets/projects-CymMldT7.js +1 -0
  231. package/dist/client/assets/{projects-empty-state-BKHYkH3g.js → projects-empty-state-BTGd2cv1.js} +1 -1
  232. package/dist/client/assets/{prompts-Bf1h2RZu.js → prompts-Cd0qPZsx.js} +1 -1
  233. package/dist/client/assets/record-editor-BH3fKYC8.js +1 -0
  234. package/dist/client/assets/redirect-editor-xZO49sls.js +1 -0
  235. package/dist/client/assets/{reports-DRRYJcxd.js → reports-B9pEcRxn.js} +1 -1
  236. package/dist/client/assets/reports-DtEFVn9D.js +1 -0
  237. package/dist/client/assets/reports-onboarding-DxeuhIZr.js +1 -0
  238. package/dist/client/assets/reports-tab-YeP0tPeK.js +2 -0
  239. package/dist/client/assets/repositories-B0Temlg5.js +1 -0
  240. package/dist/client/assets/repositories-YEhOcvb2.js +1 -0
  241. package/dist/client/assets/{repository-binding-DV3kkbZ_.js → repository-binding-L4ChVpPs.js} +1 -1
  242. package/dist/client/assets/repository-picker-CCYsOJZQ.js +1 -0
  243. package/dist/client/assets/{require-capability-Dlaolf-u.js → require-capability-Cm5TFoc0.js} +1 -1
  244. package/dist/client/assets/{required-auth-layout-lVrZieBu.js → required-auth-layout-BUx3f5eg.js} +1 -1
  245. package/dist/client/assets/{reset-password-H302zhc9.js → reset-password-DWi7rqRm.js} +1 -1
  246. package/dist/client/assets/{resizable-D6Bvwzfl.js → resizable-Biivyzu2.js} +1 -1
  247. package/dist/client/assets/resolve-tab-icon-C_X-fR95.js +1 -0
  248. package/dist/client/assets/review-settings-DhlyLgn0.js +1 -0
  249. package/dist/client/assets/role-color-_0YSG8Dj.js +1 -0
  250. package/dist/client/assets/roles-akRjx2S4.js +1 -0
  251. package/dist/client/assets/route-CKHdrn7R.js +1 -0
  252. package/dist/client/assets/route-D1Gpwe4D.js +1 -0
  253. package/dist/client/assets/route-tQ0sT4aI.js +1 -0
  254. package/dist/client/assets/{sandbox-lifecycle-context-2RE5Jlvg.js → sandbox-lifecycle-context-BJx1JU2-.js} +1 -1
  255. package/dist/client/assets/save-status-T9dswXr1.js +1 -0
  256. package/dist/client/assets/{schema-paIXrOCY.js → schema-Dc_MkHkp.js} +1 -1
  257. package/dist/client/assets/{schema-CINYRcKK.js → schema-DjfjCUhq.js} +1 -1
  258. package/dist/client/assets/{scroll-area-BwaclrCR.js → scroll-area-cgfYHO2J.js} +1 -1
  259. package/dist/client/assets/search-input-CgAhBcAm.js +1 -0
  260. package/dist/client/assets/{search-toggle-CShA1wOK.js → search-toggle-BvL2EnQl.js} +1 -1
  261. package/dist/client/assets/{secret-picker-C6s_jvhV.js → secret-picker-pXy37N0W.js} +1 -1
  262. package/dist/client/assets/{secrets-Bz4L84Vo.js → secrets-DY2kpTfw.js} +1 -1
  263. package/dist/client/assets/section-array-field-Dqv2uZIX.js +1 -0
  264. package/dist/client/assets/{sections-CnLSarWD.js → sections-BYpfTFZT.js} +1 -1
  265. package/dist/client/assets/sections-editor-D7uS2U4v.js +1 -0
  266. package/dist/client/assets/{select-iwVnUZSM.js → select-Dj8hBfnd.js} +1 -1
  267. package/dist/client/assets/{select-model-DhxdeY5p.js → select-model-BCp0KUZW.js} +1 -1
  268. package/dist/client/assets/seo-editor-C6gHCSwh.js +1 -0
  269. package/dist/client/assets/{separator-C1bonuaY.js → separator-CD_4C4Y0.js} +1 -1
  270. package/dist/client/assets/settings-tab-DPVLqmJT.js +1 -0
  271. package/dist/client/assets/{sheet-DUtlbS4K.js → sheet-w42F36Fm.js} +1 -1
  272. package/dist/client/assets/shell-layout-SnEo2Z8s.js +1 -0
  273. package/dist/client/assets/site-draft-actions-X8qdJpR6.js +3 -0
  274. package/dist/client/assets/site-draft-view-DieOLT9Q.js +1 -0
  275. package/dist/client/assets/site-editor-D71enwO7.js +1 -0
  276. package/dist/client/assets/{site-editor-toast-DL4aC3pF.js → site-editor-toast-CAmfWZOg.js} +1 -1
  277. package/dist/client/assets/skills-BPDMMsh1.js +1 -0
  278. package/dist/client/assets/{slider-Cmkjh66S.js → slider-BUH8Dwgf.js} +1 -1
  279. package/dist/client/assets/{sortable.esm-C7rI9jHM.js → sortable.esm-BwyBVE7G.js} +1 -1
  280. package/dist/client/assets/{sso-BEfIFSWt.js → sso-Cf_QJD0l.js} +1 -1
  281. package/dist/client/assets/suggestion-EZp_1C2Z.js +2 -0
  282. package/dist/client/assets/{super-agent-icon-Dq4U-BQv.js → super-agent-icon-Cuh3vhpx.js} +1 -1
  283. package/dist/client/assets/{switch-BZMVD_xA.js → switch-CcIiziq_.js} +1 -1
  284. package/dist/client/assets/synced-repos-Cnb_uqs2.js +1 -0
  285. package/dist/client/assets/{tab-icon-glyph-CeBm3H92.js → tab-icon-glyph-DvOK9lLO.js} +1 -1
  286. package/dist/client/assets/{table-C9boQ5tZ.js → table-CX_Xjv5_.js} +1 -1
  287. package/dist/client/assets/{tabs-CFdE2LmD.js → tabs-BVFow_A3.js} +1 -1
  288. package/dist/client/assets/{task-board-BZ6FZl9j.js → task-board-DVtARw_U.js} +1 -1
  289. package/dist/client/assets/{task-route-WWLMyAp6.js → task-route-Ck3RXNt1.js} +1 -1
  290. package/dist/client/assets/{task-status-CLkNYnsS.js → task-status-DFMg9mu2.js} +1 -1
  291. package/dist/client/assets/taskboard-analytics-BUGnnj7V.js +1 -0
  292. package/dist/client/assets/{tasks-DOLkXzI6.js → tasks-B3OOn3U2.js} +3 -3
  293. package/dist/client/assets/tasks-DHWz5CTo.js +1 -0
  294. package/dist/client/assets/{textarea-hEv7rKyL.js → textarea-BxqysnAf.js} +1 -1
  295. package/dist/client/assets/thread-analytics-dnNDwV70.js +1 -0
  296. package/dist/client/assets/{thread-intent-DMhB2sy4.js → thread-intent-BujELieJ.js} +6 -6
  297. package/dist/client/assets/thread-route-BAkMWoFr.js +1 -0
  298. package/dist/client/assets/{thread-route-B_swkleJ.js → thread-route-CG4NoBnV.js} +1 -1
  299. package/dist/client/assets/{thread-sheet-body-DTCZxxw9.js → thread-sheet-body-iPIMT5tX.js} +1 -1
  300. package/dist/client/assets/{time-range-picker-VzZM-nq4.js → time-range-picker-DXMtxhmu.js} +1 -1
  301. package/dist/client/assets/{toggle-group-DDk8xPXe.js → toggle-group-CFCrTuTF.js} +1 -1
  302. package/dist/client/assets/{tool-namespace-EVeG8Fs5.js → tool-namespace-C9gQSjv3.js} +1 -1
  303. package/dist/client/assets/{tool-set-selector-DuVmSXqq.js → tool-set-selector-Dpj_1lJt.js} +1 -1
  304. package/dist/client/assets/{toolbar-icon-button-99r2aG4V.js → toolbar-icon-button-Bk7F5Fex.js} +1 -1
  305. package/dist/client/assets/{tooltip-Dyh2h0NV.js → tooltip-Bj0ggRLV.js} +1 -1
  306. package/dist/client/assets/{tooltipContext-CQdoW9wa.js → tooltipContext-BSiIa8-6.js} +1 -1
  307. package/dist/client/assets/{track-B5m4mxJj.js → track-uewKzN4A.js} +1 -1
  308. package/dist/client/assets/{types-Mb9DEKKQ.js → types-BuSDoCm5.js} +3 -3
  309. package/dist/client/assets/{url-slug-Cli-NAkj.js → url-slug-BFZflu8h.js} +1 -1
  310. package/dist/client/assets/{usage-stats-iRJ2oM0y.js → usage-stats-FTjlrZsR.js} +2 -2
  311. package/dist/client/assets/{use-ai-providers-DQAzIwY2.js → use-ai-providers-hOyNnU7s.js} +1 -1
  312. package/dist/client/assets/use-apply-named-rule-JRuS8Fqz.js +1 -0
  313. package/dist/client/assets/use-ask-in-chat-BkWoc5AG.js +1 -0
  314. package/dist/client/assets/{use-automations-akR-tcRi.js → use-automations-BW9n1XZu.js} +1 -1
  315. package/dist/client/assets/use-autosave-CFQpxLa7.js +1 -0
  316. package/dist/client/assets/use-blocks-v8-project-B4vRqcEf.js +1 -0
  317. package/dist/client/assets/use-chat-layout-state-Bib3kRoh.js +1 -0
  318. package/dist/client/assets/{use-cms-publish-actions-CntIxbra.js → use-cms-publish-actions-BanOYWkB.js} +5 -5
  319. package/dist/client/assets/{use-connect-companion-FU7Yjyv3.js → use-connect-companion-hxxGTIoI.js} +1 -1
  320. package/dist/client/assets/use-connection-CKudd0UO.js +1 -0
  321. package/dist/client/assets/use-content-sync-DVFphaEf.js +1 -0
  322. package/dist/client/assets/{use-copy-DJs5balG.js → use-copy-s7vshP5o.js} +1 -1
  323. package/dist/client/assets/{use-date-fns-locale-DytcjJ4v.js → use-date-fns-locale-BcLGuFCX.js} +1 -1
  324. package/dist/client/assets/{use-debounced-autosave-CY6fvvGj.js → use-debounced-autosave-DF7xOcC9.js} +1 -1
  325. package/dist/client/assets/{use-debounced-value-CezJqVSj.js → use-debounced-value-B0C48w17.js} +1 -1
  326. package/dist/client/assets/{use-deco-credits-CHRRrI8G.js → use-deco-credits-Cc7w_fUS.js} +1 -1
  327. package/dist/client/assets/use-decopilot-events-Ctfpdj_z.js +1 -0
  328. package/dist/client/assets/use-delete-block-CMQm89VB.js +1 -0
  329. package/dist/client/assets/use-delete-connection-BM0YKMsI.js +1 -0
  330. package/dist/client/assets/{use-deployment-admin-mLJFncG4.js → use-deployment-admin-CJOxofw6.js} +1 -1
  331. package/dist/client/assets/{use-entitlements-mX8bg5XG.js → use-entitlements-BPjzEs4p.js} +1 -1
  332. package/dist/client/assets/use-fast-preview-draft-url-BwHAw0OT.js +1 -0
  333. package/dist/client/assets/{use-file-configs-z22DUi0c.js → use-file-configs-DA74H1hE.js} +1 -1
  334. package/dist/client/assets/{use-id-selection-Bg3vd8Ma.js → use-id-selection-CMNzhPoi.js} +1 -1
  335. package/dist/client/assets/{use-inbox-feed-r_crN8AB.js → use-inbox-feed-C-HQ6EgP.js} +1 -1
  336. package/dist/client/assets/{use-infinite-scroll-CvgjtV8K.js → use-infinite-scroll-M12K1Dpn.js} +1 -1
  337. package/dist/client/assets/{use-join-requests-DQ56VmKG.js → use-join-requests-ntiStw2Q.js} +1 -1
  338. package/dist/client/assets/use-main-panel-tabs-DLlaHA4v.js +1 -0
  339. package/dist/client/assets/{use-mcp-auth-status-D0LzrG1g.js → use-mcp-auth-status-B2OMY_Tu.js} +1 -1
  340. package/dist/client/assets/{use-mcp-client-CNXpOf52.js → use-mcp-client-D_jTz-1i.js} +10 -10
  341. package/dist/client/assets/{use-mcp-prompts-COb2l8gW.js → use-mcp-prompts-CFPSpaeI.js} +1 -1
  342. package/dist/client/assets/{use-mcp-tools-fDABrIOV.js → use-mcp-tools-BMGCtRJK.js} +1 -1
  343. package/dist/client/assets/{use-mobile-DDy9Znlf.js → use-mobile-M7B5YJR_.js} +1 -1
  344. package/dist/client/assets/use-move-blocks-B5DoaBOm.js +1 -0
  345. package/dist/client/assets/use-navigate-to-agent-BoWId4qC.js +1 -0
  346. package/dist/client/assets/use-never-published-8p9ySrBa.js +1 -0
  347. package/dist/client/assets/{use-org-fs-8086pm93.js → use-org-fs-Dpr5-hHp.js} +1 -1
  348. package/dist/client/assets/{use-org-repo-syncs-BqoQhBbI.js → use-org-repo-syncs-DOKrzBXU.js} +1 -1
  349. package/dist/client/assets/{use-org-sso-DNEWwtoA.js → use-org-sso-zsNytoCe.js} +1 -1
  350. package/dist/client/assets/{use-organization-settings-488vpN0c.js → use-organization-settings-CIEI8bNF.js} +1 -1
  351. package/dist/client/assets/use-project-native-view-presence-tu_PxC_K.js +1 -0
  352. package/dist/client/assets/use-project-scope-D1EeIJG0.js +1 -0
  353. package/dist/client/assets/use-recent-apps-DSYeKmJU.js +1 -0
  354. package/dist/client/assets/{use-reports-diagnostic-JXB8tUrM.js → use-reports-diagnostic-ChnnkK6V.js} +1 -1
  355. package/dist/client/assets/use-sandbox-events-bxyyBbR-.js +2 -0
  356. package/dist/client/assets/{use-secrets-Bj9oVJrr.js → use-secrets-NY7H3OwI.js} +1 -1
  357. package/dist/client/assets/use-section-preview-base-Beu0iQz9.js +1 -0
  358. package/dist/client/assets/{use-sidebar-collapsed-CSXlwHC3.js → use-sidebar-collapsed-D0GS7hdN.js} +1 -1
  359. package/dist/client/assets/{use-tags-CZ8FU88Q.js → use-tags-NAzrZ60o.js} +1 -1
  360. package/dist/client/assets/{use-task-board-analytics-S9D-SUGj.js → use-task-board-analytics-DdzuizDS.js} +1 -1
  361. package/dist/client/assets/{use-task-board-events-CuH-inlF.js → use-task-board-events-iA0mSg2Q.js} +1 -1
  362. package/dist/client/assets/{use-task-board-item-prs-DuTkhVPp.js → use-task-board-item-prs-Dw8_2urj.js} +1 -1
  363. package/dist/client/assets/{use-task-board-items-BNRTDOsU.js → use-task-board-items-DQYVvsFC.js} +1 -1
  364. package/dist/client/assets/{use-task-board-prompts-CTcrXcvj.js → use-task-board-prompts-DaZyR7M-.js} +1 -1
  365. package/dist/client/assets/{use-task-metadata-BvTVrzAT.js → use-task-metadata-c0FPnJ80.js} +1 -1
  366. package/dist/client/assets/{use-thread-outputs-COaP8znq.js → use-thread-outputs-nmtU5Zq-.js} +1 -1
  367. package/dist/client/assets/use-view-draft-kind-Cu0aFeKZ.js +1 -0
  368. package/dist/client/assets/{use-voice-input-miWnQR-2.js → use-voice-input-DPQbRCzt.js} +1 -1
  369. package/dist/client/assets/useInfiniteQuery-CfdlXnOy.js +1 -0
  370. package/dist/client/assets/{useQueries-BYTcJkC-.js → useQueries-BncTnCJs.js} +1 -1
  371. package/dist/client/assets/useSuspenseInfiniteQuery-QQvh5ycV.js +1 -0
  372. package/dist/client/assets/{users-CkCjBxij.js → users-DnLbGcVd.js} +1 -1
  373. package/dist/client/assets/{utils-Cugj1NVM.js → utils-yu1cqe5g.js} +2 -2
  374. package/dist/client/assets/variant-calendar-B9yPwKNQ.js +1 -0
  375. package/dist/client/assets/{variant-matcher-override-CA2qg3Y9.js → variant-matcher-override-DUz7pA6N.js} +1 -1
  376. package/dist/client/assets/{view-header-CNnF9Sbv.js → view-header-DYVjdF9_.js} +1 -1
  377. package/dist/client/assets/virtual-mcp-B46xFMzN.js +1 -0
  378. package/dist/client/assets/{watch-sse-pool-2U2aYEEI.js → watch-sse-pool-Cgkbp7EA.js} +1 -1
  379. package/dist/client/index.html +2 -2
  380. package/dist/server/server.js +584 -584
  381. package/package.json +1 -1
  382. package/dist/client/assets/ReferenceLine-CZfceFos.js +0 -1
  383. package/dist/client/assets/ShoppingBag01-BcBJW8Ry.js +0 -1
  384. package/dist/client/assets/agent-app-z2dEAE0c.js +0 -1
  385. package/dist/client/assets/agent-assets-B50PlEch.js +0 -1
  386. package/dist/client/assets/agent-automation-ZC5pUe0X.js +0 -20
  387. package/dist/client/assets/agent-automations-BqJwcAQY.js +0 -1
  388. package/dist/client/assets/agent-calendar-6cFcqsTq.js +0 -1
  389. package/dist/client/assets/agent-connect-sources-BMcGkScg.js +0 -1
  390. package/dist/client/assets/agent-deck-oSNNh6Oq.js +0 -1
  391. package/dist/client/assets/agent-e2e-qon8RqKT.js +0 -1
  392. package/dist/client/assets/agent-experiments-DSDO0e_Q.js +0 -1
  393. package/dist/client/assets/agent-file-BDrgchCG.js +0 -1
  394. package/dist/client/assets/agent-hosting-lyen0G2R.js +0 -1
  395. package/dist/client/assets/agent-icon-CMiKlX_f.js +0 -1
  396. package/dist/client/assets/agent-library-BL3gqRVT.js +0 -1
  397. package/dist/client/assets/agent-library-file-qyRRAu7t.js +0 -1
  398. package/dist/client/assets/agent-overview-D-M__QCC.js +0 -1
  399. package/dist/client/assets/agent-releases-CDlgQRKx.js +0 -2
  400. package/dist/client/assets/agent-settings-J3n5UPp_.js +0 -1
  401. package/dist/client/assets/agent-site-editor-code-BaufV44m.js +0 -2
  402. package/dist/client/assets/agent-site-editor-content-BZesN91A.js +0 -1
  403. package/dist/client/assets/agent-site-editor-preview-n4h_ozj2.js +0 -1
  404. package/dist/client/assets/agent-view-guard-DGsM3j-h.js +0 -1
  405. package/dist/client/assets/agent-view-xa9IiygI.js +0 -1
  406. package/dist/client/assets/ai-providers-CAe-vRzr.js +0 -1
  407. package/dist/client/assets/api-keys-B7PbIf1K.js +0 -1
  408. package/dist/client/assets/app-editor-CUySEecw.js +0 -1
  409. package/dist/client/assets/automations-Dg2lSOc5.js +0 -1
  410. package/dist/client/assets/autosend-CGJPJD3U.js +0 -1
  411. package/dist/client/assets/block-document-BAvIRwEs.js +0 -3
  412. package/dist/client/assets/blog-schema-D7LUSvhR.js +0 -1
  413. package/dist/client/assets/category-editor-B6mXBz4W.js +0 -1
  414. package/dist/client/assets/chat-context-DgCR75CY.js +0 -39
  415. package/dist/client/assets/choose-editor-DOwdvoLE.js +0 -1
  416. package/dist/client/assets/cms-settings-editor-B6ALhYaf.js +0 -1
  417. package/dist/client/assets/cms-store-drafts-CZfXb7jx.js +0 -1
  418. package/dist/client/assets/collapsible-BF7fiKEY.js +0 -1
  419. package/dist/client/assets/collection-detail-DHIJx408.js +0 -1
  420. package/dist/client/assets/config-C1KKnNPa.js +0 -1
  421. package/dist/client/assets/connection-detail-Bt9fqrdv.js +0 -1
  422. package/dist/client/assets/connections-023t3K8C.js +0 -1
  423. package/dist/client/assets/content-tab-DnZUk0R_.js +0 -25
  424. package/dist/client/assets/context-BviRKxpu.js +0 -1
  425. package/dist/client/assets/discover-CZ-mJztz.js +0 -1
  426. package/dist/client/assets/experiments-tab-choice-BVL1j6B7.js +0 -1
  427. package/dist/client/assets/feature-gate-TKaLsYFc.js +0 -1
  428. package/dist/client/assets/file-explorer-DgzFCGgU.js +0 -2
  429. package/dist/client/assets/general-Cz8UZeQh.js +0 -1
  430. package/dist/client/assets/home-Dxjl17s5.js +0 -1
  431. package/dist/client/assets/hosted-reconcile-D236FadC.js +0 -1
  432. package/dist/client/assets/index-BVHbGN5c.js +0 -1
  433. package/dist/client/assets/index-CRog5tFp.js +0 -1
  434. package/dist/client/assets/index-CXMGhRs4.js +0 -4
  435. package/dist/client/assets/index-DJZmV4c9.js +0 -1
  436. package/dist/client/assets/index-DO-A5xCQ.css +0 -1
  437. package/dist/client/assets/library-D_ryD5pc.js +0 -1
  438. package/dist/client/assets/mustache-DZix8TV9.js +0 -4
  439. package/dist/client/assets/named-rule-view-xs5Ukf19.js +0 -1
  440. package/dist/client/assets/openai-conversation-CKtOG2f6.js +0 -3
  441. package/dist/client/assets/parse-sections-BqIle9mt.js +0 -20
  442. package/dist/client/assets/plan-BkqYlxrI.js +0 -1
  443. package/dist/client/assets/post-calendar-DXSJQozg.js +0 -1
  444. package/dist/client/assets/post-editor-BOGWSxB3.js +0 -2
  445. package/dist/client/assets/preview-tab-DoF3705n.js +0 -551
  446. package/dist/client/assets/project-app-view-BZhEHrBD.js +0 -1
  447. package/dist/client/assets/project-apps-C1L1P3Il.js +0 -1
  448. package/dist/client/assets/project-reports-C2rrdScO.js +0 -1
  449. package/dist/client/assets/project-tasks-BIUh6BbU.js +0 -1
  450. package/dist/client/assets/projects-Dp44Mtfj.js +0 -1
  451. package/dist/client/assets/record-editor-Du-SgLkC.js +0 -1
  452. package/dist/client/assets/redirect-editor-Diqw7Nkh.js +0 -1
  453. package/dist/client/assets/reports-onboarding-C4BoLN-j.js +0 -1
  454. package/dist/client/assets/reports-qs02DwnV.js +0 -1
  455. package/dist/client/assets/reports-tab-Cr_0nAF2.js +0 -2
  456. package/dist/client/assets/repositories-B4lUSmlm.js +0 -1
  457. package/dist/client/assets/repositories-CHJClbl6.js +0 -1
  458. package/dist/client/assets/repository-picker-DhcwcPzc.js +0 -1
  459. package/dist/client/assets/resolve-tab-icon-JhqhoNvw.js +0 -1
  460. package/dist/client/assets/review-settings-D1OJYsDt.js +0 -1
  461. package/dist/client/assets/role-color-CxM5Kzh7.js +0 -1
  462. package/dist/client/assets/roles-C3sEk6Ey.js +0 -1
  463. package/dist/client/assets/route-AzUNCIcU.js +0 -1
  464. package/dist/client/assets/route-CKIi5OR7.js +0 -1
  465. package/dist/client/assets/route-xJV1Kwll.js +0 -1
  466. package/dist/client/assets/search-input-BG8rdrCe.js +0 -1
  467. package/dist/client/assets/section-array-field-B8BsNXRT.js +0 -1
  468. package/dist/client/assets/sections-editor-2QTriBkM.js +0 -1
  469. package/dist/client/assets/seo-editor-BPqT6KgW.js +0 -1
  470. package/dist/client/assets/settings-tab-S0xeJTM-.js +0 -1
  471. package/dist/client/assets/shell-layout-Dcfsytx-.js +0 -1
  472. package/dist/client/assets/site-draft-actions-B5A2QjjI.js +0 -3
  473. package/dist/client/assets/site-draft-view-DsHq6hEs.js +0 -1
  474. package/dist/client/assets/site-editor-BUp_Zz62.js +0 -1
  475. package/dist/client/assets/skills-5rkbKVfD.js +0 -1
  476. package/dist/client/assets/suggestion-DGz7gtzE.js +0 -2
  477. package/dist/client/assets/synced-repos-MBV_b16M.js +0 -1
  478. package/dist/client/assets/taskboard-analytics-WayyDOd5.js +0 -1
  479. package/dist/client/assets/tasks-B6kmgmmz.js +0 -1
  480. package/dist/client/assets/thread-analytics-CM8gvu0V.js +0 -1
  481. package/dist/client/assets/thread-route-Ce3yplCj.js +0 -1
  482. package/dist/client/assets/use-apply-named-rule-qGNe9B-Q.js +0 -1
  483. package/dist/client/assets/use-ask-in-chat-4DqUxBJG.js +0 -1
  484. package/dist/client/assets/use-autosave-ClND9MZU.js +0 -1
  485. package/dist/client/assets/use-blocks-v8-project-DHH8umJ9.js +0 -1
  486. package/dist/client/assets/use-chat-layout-state-BsOGOEOo.js +0 -1
  487. package/dist/client/assets/use-connection-e-hq9vT7.js +0 -1
  488. package/dist/client/assets/use-content-sync-tJgGPJpi.js +0 -1
  489. package/dist/client/assets/use-decopilot-events-CtnAXgLl.js +0 -1
  490. package/dist/client/assets/use-delete-connection-Cbnv8IDj.js +0 -1
  491. package/dist/client/assets/use-fast-preview-draft-url-DrTS3dt5.js +0 -1
  492. package/dist/client/assets/use-main-panel-tabs-BzQUBql-.js +0 -1
  493. package/dist/client/assets/use-move-blocks-D7WfYgve.js +0 -1
  494. package/dist/client/assets/use-navigate-to-agent-B-iTaYhm.js +0 -1
  495. package/dist/client/assets/use-project-native-view-presence-C27ltBxd.js +0 -1
  496. package/dist/client/assets/use-project-scope-Dqnjf5Fg.js +0 -1
  497. package/dist/client/assets/use-recent-apps-2cMLzs_u.js +0 -1
  498. package/dist/client/assets/use-sandbox-events-D9uSNLH2.js +0 -2
  499. package/dist/client/assets/use-section-preview-base-DoOLobhv.js +0 -1
  500. package/dist/client/assets/useInfiniteQuery-DqQNqcJl.js +0 -1
  501. package/dist/client/assets/useSuspenseInfiniteQuery-0A6saVT8.js +0 -1
  502. package/dist/client/assets/variant-calendar-CumR4poM.js +0 -1
  503. package/dist/client/assets/virtual-mcp-NII7Lu6q.js +0 -1
@@ -1 +1 @@
1
- import{c as N,q as W,i as C,K as g,eW as Ue,d2 as Fn,aE as Lt,aF as K,b9 as Qe,ba as Bn,e8 as De,e6 as Vn,bV as we,eX as Hn,eY as Jn,r as L,eZ as Wn,e_ as G,e$ as X,bA as Gn,a as Yn,as as _e,a4 as zn,bz as Ut,f0 as Xn,f1 as Qt,aq as Zn,bh as F,bo as Ct,f2 as qn,f3 as Kn,f4 as eo,t as ne,j as z}from"./index-Dd5hidCj.js";import{u as Ce}from"./repository-binding-DV3kkbZ_.js";import{e as Ft}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context-DgCR75CY.js";import{i as no,u as oo}from"./use-sandbox-events-D9uSNLH2.js";import{u as Fe}from"./use-blocks-v8-project-DHH8umJ9.js";import{u as Bt}from"./use-voice-input-miWnQR-2.js";import{s as ft}from"./thread-intent-DMhB2sy4.js";import{s as so}from"./utils-Cugj1NVM.js";import{a as ro}from"./sandbox-git-api-DcqI6XE4.js";const w={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class S extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new S(t.code,t.message,t.data)}}const te="deco-content",Te={major:1},Vt=1;async function io(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const Re={major:Te.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${Re.major}.${Re.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ae(e,t,n){const o={reason:t,required:{...Re}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const s=n.server;typeof s?.name=="string"&&typeof s.version=="string"&&(o.server={name:s.name,version:s.version})}return new S(w.Unsupported,e,o)}function Jt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==te)throw ae(`the endpoint speaks ${JSON.stringify(n)}, not ${te}`,"protocol",t);if(o?.major!==Te.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Te.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Vt)throw ae(Ht,"outdated",t);return e}function dt(e,t){return t.code===w.MethodNotFound&&e.startsWith("changes.")?ae(Ht,"outdated"):S.from(t)}function Be(e){const t=e.fetch??(r=>fetch(r));let n=1;async function o(r){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(r)}));let c;try{c=await io(a)}catch{throw new S(w.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?S.from(l):new S(w.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const s=async(r,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:r,params:i??{}});if(c.error)throw dt(r,c.error);return c.result};return{call:s,describe:async()=>Jt(await s("describe")),schemaGet:r=>s("schema.get",r),blocksList:r=>s("blocks.list",r),blocksApply:r=>s("blocks.apply",r),changesList:r=>s("changes.list",r),changesGet:r=>s("changes.get",r),changesDiscard:r=>s("changes.discard",r),async batch(r){const i=r.map(()=>n++),a=await o(r.map((l,u)=>({jsonrpc:"2.0",id:i[u],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,u)=>{const d=c.get(l);return d?d.error?{ok:!1,error:dt(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Ve(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function He(e){return e instanceof S?e.code===w.MethodNotFound?!0:e.code===w.Unsupported&&e.data?.reason==="outdated":!1}function de(e,t,n=e){return n&&n!==e?n:t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function ao(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(Ve(s)),i=de(s,r,e.getQueryData(o));if(i)return i;const a=await t.changesList({}),c=de(void 0,a,e.getQueryData(o));if(!c)throw new S(w.InternalError,"changes.list returned notModified without a cached list");return c}async function Wt(e,t){const n=[];for(let r=0;r<t.length;r+=ht)n.push(t.slice(r,r+ht));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=gt){const i=await e.batch(n.slice(r,r+gt).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),s.push(...c.diagnostics)}}return{entries:o,diagnostics:s}}async function Ar(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=vt){const s=t.slice(o,o+vt),r=await e.changesDiscard({names:s.map(i=>i.name),ifMatch:Object.fromEntries(s.map(i=>[i.name,i.version]))});n={revision:r.revision,versions:{...n.versions,...r.versions}}}return n}function Mr(e){return e instanceof S&&e.code===w.Conflict}function Je(e){return e?.kind==="protocol"?e:null}function Lr(e,t,n){const o=N.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=W();let a;o[2]!==e?(a=Je(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&r.enabled!==!1;let u;o[4]!==t?(u=g.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(d=l?()=>ao(i,c.client,t):Ue,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=d):d=o[10];let f;return o[11]!==u||o[12]!==d?(f={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=f):f=o[13],C(f)}function co(e){if(!e)return"";const t=Object.entries(e.changes).sort(([n],[o])=>n<o?-1:n>o?1:0).map(([n,o])=>[n,o.kind,o.version,o.baseVersion]);return JSON.stringify([e.revision,e.base.revision,e.base.resolvedRef,t])}function Ur(e,t,n){const o=N.c(14);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!r&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?(l=g.contentChangeSides(t??"",co(n)),o[4]=t,o[5]=n,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==r?(u=c?()=>Wt(r.client,a):Ue,o[7]=c,o[8]=a,o[9]=r,o[10]=u):u=o[10];let d;return o[11]!==l||o[12]!==u?(d={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=d):d=o[13],C(d)}function Qr(e,t,n){const o=N.c(16);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==r){const f=Object.entries(n?.changes??{}).filter(go).map(ho).sort(fo);a=f.map(uo);const h=JSON.stringify(f.map(lo));i=!!r&&!!t&&a.length>0,l=C,c=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=r,o[5]=i,o[6]=a,o[7]=c,o[8]=l}else i=o[5],a=o[6],c=o[7],l=o[8];let u;o[9]!==i||o[10]!==a||o[11]!==r?(u=i?async()=>{const f=await Wt(r.client,a),h=Object.create(null);for(const[v,b]of Object.entries(f.entries))h[v]=b.before&&typeof b.before=="object"?b.before:null;return h}:Ue,o[9]=i,o[10]=a,o[11]=r,o[12]=u):u=o[12];let d;return o[13]!==c||o[14]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Fn},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function lo(e){return[e.name,e.base]}function uo(e){return e.name}function fo(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function ho(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function go(e){const[,t]=e;return t.kind==="delete"}function Gt(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 he(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 Yt=Lt({endpoint:K().max(2048).refine(e=>Gt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Cr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Yt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function zt(e){const t=Yt.safeParse(e);return t.success?t.data:null}const Xt="studio:deco-serve-last";function Fr(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Br(){try{const e=localStorage.getItem(Xt);return e?zt(JSON.parse(e)):null}catch{return null}}function Vr(e){try{return new URL(he(e)).host}catch{return e}}function vo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const bo="http://localhost:4545/rpc";class We extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function mo(e){if(e instanceof We)return{reason:"not-deco-serve"};if(!(e instanceof S))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return He(e)?{reason:"outdated"}:{reason:"version-mismatch"};case w.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 Hr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,bo].filter(o=>!!o).map(he);return[...new Set(n)]}const po=Lt({blocks:De(K(),De(K(),Vn()).refine(Qe)),versions:De(K(),K().min(1)),missing:Bn(K())});function wo(e,t){const n=po.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 oe(e,t){const n=e.index?.entries[t];return!!n&&Qe(e.blocks[t])&&e.versions[t]===n.version}function So(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 yo(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?oe(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const bt=50,mt=10;function ko(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((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new S(w.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(c=>[c.id,c]));return s.map(c=>{const l=a.get(c);return l?l.error?{ok:!1,error:S.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Oo(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]={[Jn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Hn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function Eo(e,t){return e?.entries[t]?.meta?.refs??[]}function Do(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ge(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xe(e,t){if(Array.isArray(e)){for(const n of e)xe(n,t);return}if(Ge(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):xe(o,t)}function Zt(e,t){if(!Ge(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;xe(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){G(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[c,l]of Object.entries(n)){const u=i[c]?.editor??null;if(l===null||l===X){delete r[c],i[c]={operation:"delete",version:X,editor:u};continue}const d=Zt(o[c],a);r[c]={version:l,...d?{meta:d}:{}},i[c]={operation:"set",version:l,editor:u}}return{...s,entries:r,draft:i}})}function Io(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]),c=Zt(o.block,a);i[n]={version:o.version,...c?{meta:c}:{}}}return{...s,entries:i,draft:r}})}const pt=new WeakMap;async function Ye(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new S(w.Unavailable,"The CMS index is not loaded yet");let i=pt.get(e);i||(i=new Map,pt.set(e,i));const a=e.getQueryData(g.decofile(n))??{},c=e.getQueryData(g.contentVersions(n))??{},l=[],u=[];for(const f of new Set(o)){const h=r.entries[f];if(!h||s.has(f)||Qe(a[f])&&c[f]===h.version)continue;const v=i.get(`${n}\0${f}`);v?l.push(v):u.push(f)}if(u.length>0){const f=To(e,t,n,u);for(const h of u){const v=`${n}\0${h}`;i.set(v,f),f.catch(()=>{}).finally(()=>{i.get(v)===f&&i.delete(v)})}l.push(f)}await Promise.all(l);const d=ge(e,n);if(o.some(f=>d.index?.entries[f]&&!s.has(f)&&!oe(d,f)))throw new S(w.Unavailable,"A CMS block changed while loading; try again")}async function _o(e,t,n,o,s){if(!t){const i=o?.[s];return Ge(i)&&!Gn(i)?i:void 0}await Ye(e,t,n,[s]);const r=ge(e,n);return r.index?.entries[s]&&oe(r,s)?r.blocks[s]:void 0}function ge(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function To(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=bt)r.push(o.slice(i,i+bt));for(let i=0;i<r.length;i+=mt){const a=r.slice(i,i+mt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new S(w.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=wo(u.result,a[l]),f=ge(e,n),h=So(s,f,d);if(G(e),h.blocks!==f.blocks&&e.setQueryData(g.decofile(n),h.blocks),h.versions!==f.versions&&e.setQueryData(g.contentVersions(n),h.versions),h.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new S(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function ze(e){const t=N.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:Ro,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Ro(){throw new Error("the content index is set by the poll")}function wt(e,t){const n=N.c(8);let o;n[0]!==t?(o=Wn(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(c=>{c.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 St=3e4;function xo(e){if(!(e instanceof S))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function Po(e,t,n,o){const s=N.c(15),r=W(),i=ze(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=wt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=wt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const p of n)for(const E of Eo(i,p))f.add(E);const h=[...f].filter(p=>!!i?.entries[p]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(p=>!oe(v,p)),m=JSON.stringify(h.map(p=>[p,i?.entries[p]?.version,oe(v,p)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===m?R:null;L.useEffect(()=>{if(!e||!m)return;let p=!0;const E=JSON.parse(m).map($o);return Ye(r,e,t,E).then(()=>{p&&k(j=>j?.key===m?null:j)},j=>{p&&k(U=>({key:m,count:(U?.key===m?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{p=!1}},[e,r,t,m,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const p=Math.min(St,_.retryAfterMs??Ft(St,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),p);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let y;s[7]!==_?(y=[_],s[7]=_,s[8]=y):y=s[8],L.useEffect(T,y);const O=!e||yo(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(No),s[9]=I,s[10]=x):x=s[10];let A;return s[11]!==O||s[12]!==D||s[13]!==x?(A={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=A):A=s[14],A}function No(e){return e+1}function jo(e){return e+1}function $o(e){const[t]=e;return t}const Kt=L.createContext(null);function Ao(e){const t=N.c(24),n=L.useContext(Kt),o=Fe(n?null:e),{data:s}=Yn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?_e.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=kt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?_e.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=kt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?zt(c):null,t[8]=c,t[9]=i,t[10]=o,t[11]=h):h=t[11];const v=h,b=i&&o&&typeof d=="string"?d:null;let m;t[12]!==f||t[13]!==l||t[14]!==i?(m=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=m):m=t[15];let R;t[16]!==l||t[17]!==i?(R=()=>{i&&l(null)},t[16]=l,t[17]=i,t[18]=R):R=t[18];let k;return t[19]!==v||t[20]!==b||t[21]!==m||t[22]!==R?(k={connection:v,lastEndpoint:b,set:m,clear:R},t[19]=v,t[20]=b,t[21]=m,t[22]=R,t[23]=k):k=t[23],k}function yt(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function kt(e){const t=N.c(17),n=W(),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?yt(e):null,a=()=>e?yt(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:r,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=C(l);let d;t[10]!==e||t[11]!==n||t[12]!==r?(d=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]=d):d=t[13];const f=d,h=e?u??null:null;let v;return t[14]!==f||t[15]!==h?(v=[h,f],t[14]=f,t[15]=h,t[16]=v):v=t[16],v}function en(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function Mo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Jr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Wr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Gr(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 Yr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Gt(t)?t:null}function zr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function tn(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Lo(e){if(!e.hasProject)return"legacy";const t=tn(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 Uo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function Ot(e){return e.isError||e.errorUpdateCount>0}function Qo(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 Co(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 nn="__noSchema";function on(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[nn]:!0}}function Xr(e){return!!e&&e[nn]===!0}function Xe(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Fo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Bo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Zr(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:Fo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Bo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Et(n.resolveType).localeCompare(Et(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Et(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Dt(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]=Dt(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?Dt(r[a],s,n):r[a];return i}return e}function qr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class It extends Error{}const Ze="site-not-owned";async function Vo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Ho(e,t=n=>fetch(n)){const n=Be({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:we(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await Ke(n)}catch(o){if(o instanceof It)return Ze;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===Ze?o:{...o,hosted:ko(e,n)}}const qe=5e3;function Wo(e){if(!e.site)throw new Error("this project names no site");return Xn(e.site,e.branch)}function Go(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function Ke(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!==te)throw new We;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Xe(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Yo(e,t=n=>fetch(n)){return Ke(Be({endpoint:e,fetch:n=>t(new Request(n,{signal:we(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Bt(e),i=L.useContext(Kt),a=Fe(e),c=Ut(Ce(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=W(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,m=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Jo(Wo({orgSlug:o.slug,site:c,branch:t}),()=>Qt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,..._t}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Yo(Go({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=k):k=n[4];const $=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,..._t}),I=!!s;let _;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(_=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=_):_=n[8];let T;n[9]!==s?(T=()=>ts(s.endpoint),n[9]=s,n[10]=T):T=n[10];let y;n[11]!==I||n[12]!==_||n[13]!==T?(y={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Zo,retryDelay:Xo,refetchInterval:zo},n[11]=I,n[12]=_,n[13]=T,n[14]=y):y=n[14];const O=C(y);let D;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=D):D=n[18];const x=D;let A;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(A=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=A):A=n[22];let p;n[23]!==O.data||n[24]!==x||n[25]!==h?(p=async()=>{try{return await O.data.client.describe()}catch(q){const Cn=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Cn}},n[23]=O.data,n[24]=x,n[25]=h,n[26]=p):p=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==p||n[29]!==E?(j={queryKey:A,queryFn:p,enabled:E,refetchInterval:qe,retry:!1},n[27]=A,n[28]=p,n[29]=E,n[30]=j):j=n[30];const M=C(j).data??O.data?.describe,Q=Lo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:m.data===Ze?"not-owned":m.data?"ready":Ot(m)?"error":"loading",sandboxSite:qo({data:$.data,isError:Ot($),workingTreeReady:f})});if(Q==="pending")return{kind:"pending",...u};if(Q==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...u};if(Q==="legacy")return{kind:"legacy"};if(Q==="protocol-github")return{...Pe(u,m.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Pe(u,$.data);if(Q==="unavailable-github"){let q;return n[31]!==u?(q={kind:"unavailable",...u},n[31]=u,n[32]=q):q=n[32],q}const P=O.error??O.failureReason,V=s?.endpoint??"";let H;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==V||n[38]!==P?(H=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:V}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=V,n[38]=P,n[39]=H):H=n[39],H}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?qe:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof S)&&!(t instanceof We)}function qo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Ko=3;function es(e){const t=en("local",e.endpoint),n=e.probed?Pe(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Ko?n:{kind:"unavailable",...t,problem:mo(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?qe:!1};function Pe(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function ts(e,t){return Ke(Be({endpoint:e,fetch:n=>fetch(n,{signal:we(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function Ne(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ns(e,t){return Ne({...e,protocolSuffix:t.cacheKeySuffix})}function os(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ss(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,Mo(t)])}function rs(e,t,n){const o=N.c(21),s=W(),r=re(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?ns(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=Po(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=os(l,r.kind,c),o[3]=r.kind,o[4]=c,o[5]=l,o[6]=u):u=o[6];const d=u,f=r.kind!=="legacy";let h;o[7]!==r||o[8]!==e?(h=ss(e,r),o[7]=r,o[8]=e,o[9]=h):h=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==c||o[13]!==s||o[14]!==e?(v=()=>{if(c.retry(),!e||r.kind!=="unavailable")return;const m=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...m==="local"?["local"]:[e.branch,m])})},o[10]=r.kind,o[11]=r.source,o[12]=c,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==d||o[17]!==f||o[18]!==h||o[19]!==v?(b={...d,v8:f,scopeKey:h,retry:v},o[16]=d,o[17]=f,o[18]=h,o[19]=v,o[20]=b):b=o[20],b}function sn(e){const t=N.c(12);let n;t[0]!==e?(n=_e.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Zn(o,null),i=Fe(e);let a;t[2]!==s||t[3]!==e?(a=e?ft(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const l=i?null:a;let u,d;t[5]!==r?(u=h=>r(ft(h)),d=()=>r(null),t[5]=r,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f={url:l,setUrl:u,clear:d},t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}const Tt=6e4,is=2147483647;function as(e,t){if(e===null||e.trim()==="")return Tt;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<=is?o:Tt}class rn extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+as(o,s):null}status;retryAt}function cs(e,t,n=Date.now()){const o=Ft(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function et(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 rn(o,e.status,e.headers.get("retry-after"))}function ls(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ye(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ye(e,t,n).join(":")}}class tt 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 nt(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function ot(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return et(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(nt(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(nt(t)))??null}async function gs(e,t){return(await fetch(ot(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Kr(e){const t=N.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?nt(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:vs,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s??null}async function vs(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function bs(e,t){const n=await fetch(ot(t),{cache:"no-store"});if(!n.ok)return et(n,"Read decofile");const o=await n.json();return o.token&&ds(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function ei(e,t){const n=await fetch(ot(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 tt(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return fs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const an=3e3,ms=15e3,ps=2*6e4,cn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function ws(e){return e<ps?an:ms}function Ss(e,t=cn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,ws(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:c,skip:l}=e();if(s||t.hidden()||l?.()){i();return}s=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const xt=()=>0;function ys(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>Ss(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,xt,xt)}function ln(e,t){return Se(e,t)}function ks(e,t){return Se(e,"preview-fetch",{path:t})}function ti(e){return ln(e,"preview-invoke")}function ni(e){return ln(e,"catalog-invoke")}function un(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 Os(){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&&un(n))return n}return null}function Es(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Os();return n&&un(n)?new URL(t,n).toString():ks(e,t)}function Ds(e){return Es(e,"/.decofile")}function Is(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Pt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function _s(e,t){const n=Se(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=Is(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:so(r.content)}}async function Ts(e,t){const n=await _s(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function oi(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 et(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Ce(e)?.metadata?.runtime?.path??null}function je(e,t,n,o){const s=F(e),r=Object.keys(n?.changes??{}).find(a=>F(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>F(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>F(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class fn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function si(e){return e instanceof S&&e.code===w.Conflict}function dn(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 st extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class rt extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof st||t instanceof rt)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof st)return e("siteEditor.save.draftUnread");if(t instanceof rt)return e("siteEditor.save.keptChanging");if(t instanceof tt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof S)switch(t.code){case w.Conflict:return e("siteEditor.save.conflict");case w.ReadOnly:return e("siteEditor.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("siteEditor.save.invalid");case w.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function xs(e,t){if(t==="local"||e instanceof tt||e instanceof st||e instanceof rt)return null;if(e instanceof S){const n=e.code===w.InvalidBlock||e.code===w.InvalidParams?dn(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ps(e,t){if(t instanceof fn)return e("decoServe.save.serverGone");if(t instanceof S)switch(t.code){case w.Conflict:return e("decoServe.save.conflict");case w.ReadOnly:return e("decoServe.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("decoServe.save.invalid",{detail:dn(t)});case w.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Ns(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function js(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=Ns(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const $s="decocms:content-writes",$e=new Set;let Y;function gn(){if(Y!==void 0)return Y;Y=null;try{typeof BroadcastChannel=="function"&&(Y=new BroadcastChannel($s),Y.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...$e])n(t)}))}catch{Y=null}return Y}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),$e.add(e),()=>{$e.delete(e)}}const vn="__at=",bn="__test=",Ls=/^[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 Us(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ls.test(e)}function Nt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Qs(e){const t=e.tests??{};return[...e.at!==void 0?[vn+Nt(e.at)]:[],...Object.keys(t).map(n=>bn+Nt(`${n}=${t[n]?"on":"off"}`))]}function jt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(vn)&&!s.startsWith(bn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=Qs(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+jt(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("?"),c=a===-1?i:i.slice(0,a),l=a===-1?"":i.slice(a+1);return`${c}${jt(l,n)}${e.slice(r)}`}function ii(e,t,n){if(!Us(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",ve(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",ve(n,t)),o.toString()):e}catch{return e}}function ai(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 mn(e){return btoa(encodeURIComponent(e))}function ci(e,t,n){const o=Cs(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Cs(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",mn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Fs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Bs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Fs,t),n.toString()}function ui(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 fi(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",mn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function pn(e,t,n){return`${e}@${t}=${n}`}function hi(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[pn(e,"sections",t.index)]}function gi(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[pn(e.pageKey,o,e.selectedVariantIndex)]}function vi(e,t){return[...t,...e]}function Hs(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function it(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(l=>l&&!l.startsWith($t)),...t.map(l=>$t+Hs(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function bi(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 it(`${s}${o.pathname}@local`,t)}catch{return null}}function mi(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",it(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Bs)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?ve(e.heldRevision,e.previewOptions):ve(it(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function pi(e,t,n){if(!e||!n)return null;try{return Ws(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Ae=new Map;function wn(e){for(const t of Ae.get(e)??[])t()}function Sn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),wn(e))}function Gs(e){return le.get(e)??null}function Ys(e,t){return JSON.stringify(e)===JSON.stringify(t)}function wi(e,t){const n=ce.get(e)??be,o=t??be;Ys(n,o)||(t?ce.set(e,o):ce.delete(e),wn(e))}function zs(e){return ce.get(e)??be}function yn(e,t){let n=Ae.get(e);return n||(n=new Set,Ae.set(e,n)),n.add(t),()=>{n.delete(t)}}function Xs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>yn(e,s),o=()=>zs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Zs)}function Zs(){return be}function qs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>e?yn(e,s):er,o=()=>e?Gs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ks)}function Ks(){return null}function er(){}function Si(e,t){const n=N.c(4),o=Xs(e),s=qs(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Js({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const kn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},tr=15e3,me=new Map;function Z(e,t){return`${e}/${t}`}function B(e){let t=me.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},me.set(e,t)),t}function J(e,t){const n=B(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function ke(e){e.timer&&clearTimeout(e.timer),e.timer=null}function at(e){return me.get(e)?.state??kn}function nr(e,t){const n=B(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function yi(e){const t=B(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(ke(t),J(e,{phase:"idle"}))}}function ki(e){const t=me.get(e);!t||t.state.phase!=="reloading"||(ke(t),J(e,{phase:"idle"}))}function On(e){const t=B(e);ke(t),J(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=B(e),o=Math.max(0,n.state.inFlight-1);if(o>0){J(e,{inFlight:o});return}if(!t.ok||n.previews===0){J(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=B(e);ke(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&J(e,{phase:"idle"})},tr),J(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function or(e){return e?.kind==="protocol"&&e.source==="github"}async function fe(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=r?g.protocolDraftRead(o,s,r):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,d=c?[c]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:ro(o,s,r)})),or(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=Z(o,s);J(v,{epoch:at(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ct.schedule(v)),{navigates:h}}async function sr(e,t){return On(Z(e.orgSlug,e.virtualMcpId)),Dn(e,t)}function At(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Dn(e,t){const n=Z(e.orgSlug,e.virtualMcpId),o=t.adopted?At(e):null;let s;try{s=await t.write()}catch(i){throw ue(n,{ok:!1,navigates:!1}),t.refreshOnError&&fe(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&As(e.cacheKey),Sn(n,t.shownRevision?.(s)??null),t.adopted){const i=At(e)!==o;return i&&await new Promise(a=>Ct.schedule(a)),ue(n,{ok:!0,navigates:i}),t.reread&&fe(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await fe(e,t))}catch{}finally{ue(n,{ok:!0,navigates:r})}return s}function Oi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=Z(o,s),a=new Set(t.blockKeys);for(const u of[...B(i).discardListeners])u(a);On(i);let c=!1;const l=()=>(c=!0,Dn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ye(o,s,r),scope:us(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function Ei(e,t,n){const o=N.c(8);let s;o[0]!==e||o[1]!==t?(s=Z(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 c=B(r).discardListeners;return c.add(n),()=>{c.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 In(e){const t=Z(e.orgSlug,e.virtualMcpId);at(t).inFlight>0||(Sn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=B(t);o.previews>0&&o.state.inFlight===0&&En(t,n)}).catch(()=>{}))}function rr(e,t){const n=N.c(7);let o;n[0]!==e||n[1]!==t?(o=Z(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=l=>nr(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>at(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const ir=500;function Di(e,t){const{phase:n}=rr(e,t);return js(n!=="idle",ir)}function ar(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function _n(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Ii(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Do(i,n):cr(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 Tn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(s=>F(s)===n);return o===void 0?void 0:e.changes[o]}function cr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return Rn(o,Oe(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(F(n))?X:null}function _i(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Tn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Oe(e,t).has(F(n))}function Ti(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Oe(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Oe(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function pe(e,t,n,o){const s=F(n),r=Oe(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),G(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function xn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===X?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>je(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[F(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const m=je(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:m}:m!==null?h[v]={kind:"delete",version:null,baseVersion:m}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?pe(e,n,f,!1):!u.has(F(f))&&l.has(f)&&pe(e,n,f,!0);const d=o.revision;return d&&d!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:d}),s}function Ee(e,t,n){G(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 Pn(e,t){const n=e.getMutationCache().findAll({mutationKey:ye(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Me(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function se(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof S);throw t.source==="local"&&r?(Me(e,n),new fn(s)):(t.source==="local"&&He(s)&&Me(e,n),s)}}const Mt=new WeakMap;function ct(e){let t=Mt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Mt.set(e,t)),t}function Nn(e,t,n,o){const{inFlight:s}=ct(e),r=s.get(o);if(r)return r;const i=lt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function lr(e,t,n){const o=N.c(8),s=W(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(c=()=>{if(!e||!r||!i||!a)return;const u={orgSlug:r,virtualMcpId:i,branch:a},{rereading:d}=ct(s);return Ms(f=>{f===n&&(d.has(n)||(d.add(n),fr(s,e,u,n).catch(ur).finally(()=>d.delete(n))))})},l=[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]=c,o[7]=l):(c=o[6],l=o[7]),L.useEffect(c,l)}function ur(){}async function fr(e,t,n,o){const s=ct(e).inFlight.get(o);return s&&await s.catch(()=>{}),Nn(e,t,n,o)}async function lt(e,t,n,o,s){G(e);const r=g.decofile(o),i=_n(n,t),a=g.contentRevision(o),c=g.contentVersions(o),l=e.getQueryData(r),u=e.getQueryData(c),f=e.getQueryData(i),h=e.getQueryData(a)??void 0,v=s&&l&&u?h?.revision:void 0,b=s&&f?h?.schemaVersion:void 0,m=g.contentChanges(o),R=e.getQueryData(m);if(t.source==="github"&&t.hosted)return dr(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,$,I]=await se(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:Ve(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(m,E)}else I&&t.source==="local"&&He(I.error)&&Me(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const y=k.result,O=Xe($),D=$.ok&&!O?$.result:null;if(y.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=y.notModified?new Set:Pn(e,n),A=y.notModified?l:Qo(y.blocks,l,x),p=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:y.notModified?h?.revision:y.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!y.notModified){const E=e.getQueryData(c),j={...y.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return p instanceof S||e.setQueryData(i,p),!T&&!y.notModified&&l&&h?.revision&&y.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:p}}async function dr(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=_n(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,m]=await se(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:Ve(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(m?.ok&&!$){const P=de(r.seenChanges,m.result);P&&e.setQueryData(d,P)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const I=v.result,_=Xe(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const y=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;y instanceof S||e.setQueryData(u,y);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||$)return e.setQueryData(c,{revision:$?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:y};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const A=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&jn(f.draft,x.draft));A&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),P=>P&&{...P,version:x.revision}),e.setQueryData(c,{revision:x.revision,schemaVersion:O});const p=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,V]of Object.entries(D)){const H=x.entries[P];!H&&!p.has(P)||(j[P]=V,E[P]!==void 0&&(U[P]=E[P]),H&&!p.has(P)&&E[P]!==H.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await Ye(e,n,s,M,p),R&&A&&hr(R,x)&&In({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:y}}function hr(e,t){if(jn(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 jn(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 gr(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 Ie(e){if(!(e instanceof S)||e.code!==w.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 vr(e,t){if(!(e instanceof S)||e.code!==w.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,c]of o){const l=c?.actual;if(typeof l!="string"||(Object.hasOwn(s,a)?await eo(s[a]):r.has(a)?X:void 0)!==l)return;i[a]=l}return i}function br(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 ie(e,t,n,o,s){G(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),Ee(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),qt(e,n,s,o.set??{})}async function Ri(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(l=>!r||!Object.hasOwn(r,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const c=qn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return sr({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=(u,d=r)=>se(e,t,n,()=>t.client.blocksApply({set:u.set,delete:u.delete,...d?{ifMatch:gr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?Ie(u):void 0;if(!d)throw u;const f=br(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=Ie(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const m=await vr(v,f);if(!m)throw v;ie(e,n,o,f,m);try{h=await i(f,{...r,...m})}catch(R){const k=Ie(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}G(e);const c=t.source==="github"?xn(e,n,o,a):a.revision;t.source==="github"&&qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return Ee(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof S))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 An(e,t,n){if(!(n instanceof S))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&pe(e,t,s,!1)}function Mn(e,t,n,o){G(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=je(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=F(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>F(u)!==c));s?a!==null&&(l[n]={kind:"delete",version:null,baseVersion:a}):l[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:l,edited:!0})}pe(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),c=>{const l={...c};return s?delete l[n]:l[n]=o.block,l}),Ee(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof S))return!1;An(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>$n(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{Mn(e,n,a,i[c])}),!0)}async function Pi(e,t,n,o,s,r){t.source==="github"&&An(e,o,r);const i=t.source==="github"?$n(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),Mn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const l=(await se(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return l?.kind?d[s]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete d[s],{...u,changes:d,edited:!0}})}catch{const c=await se(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[s]??null,version:c.versions[s]??null}}return e.setQueryData(g.decofile(o),c=>{const l={...c};return a.value===null?delete l[s]:l[s]=a.value,l}),Ee(e,o,{[s]:a.version}),!1}function mr(e){const t=N.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=Ut(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 Qt(s,e.branch),m=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&m>0?b.pointer.slice(0,m):null,version:b.pointer&&m>0?b.pointer.slice(m+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let c;t[9]!==r||t[10]!==i||t[11]!==a?(c={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=c):c=t[12];const{data:l,isPending:u,isError:d}=C(c),f=!!e&&!!s&&u&&!d;if(!e||!l?.draft||!l.version){let b;return t[13]!==f?(b={pointer:null,pending:f},t[13]=f,t[14]=b):b=t[14],b}const h=`${l.draft}@${l.version}`;let v;return t[15]!==h?(v={pointer:h,pending:!1},t[15]=h,t[16]=v):v=t[16],v}function Ni(e){return mr(e).pointer}function ji(e){const t=N.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:pr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function pr(){throw new Error("content revisions are set by reads and writes")}function ut(e,t){const n=N.c(6),{url:o}=sn(e?.virtualMcpId),s=re(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?Ne({...e,protocolSuffix:s.cacheKeySuffix}):Ne({...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 $i(e,t){const n=N.c(46),{url:o}=sn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=ut(e),c=t?.fetchEnabled??!0,l=Rs(e?.virtualMcpId),u=Bt(e?.virtualMcpId).runtime==="cms",d=W();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;lr(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ye(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<an/2},n[2]=e,n[3]=d,n[4]=h,n[5]=v):v=n[5];let b;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==d||n[11]!==h?(b=async()=>{if(e){if(!i&&u&&!s){const E=hs(d,e)?.version;if(E&&!await gs(e,E))return}await d.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=i,n[10]=d,n[11]=h,n[12]=b):b=n[12];let m;n[13]!==v||n[14]!==b?(m={skip:v,read:b},n[13]=v,n[14]=b,n[15]=m):m=n[15],ys(!!t?.pollWhile&&!!e,m);const R=ze(i?.hosted?a:"");let k;n[16]!==r.kind||n[17]!==u||n[18]!==c||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==l||n[23]!==e||n[24]!==i||n[25]!==d?(k=async()=>{if(i)return(await Nn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw ar("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Sr),Q=M?.ok?Rt(await M.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return bs(d,e);const E=()=>Ts(e,ls(l,".deco/blocks.gen.json"));if(c){const M=await fetch(Ds(e),{cache:"no-store"}).catch(wr);if(M?.ok){const V=Rt(await M.text());if(V)return V}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw P.status=Pt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:Q.kind==="absent"}),P}const j=await E();if(j.kind==="data")return j.data;const U=new Error("decofile unavailable (preview down, no committed snapshot)");throw U.status=Pt({liveOk:!1,committedAbsent:j.kind==="absent"}),U},n[16]=r.kind,n[17]=u,n[18]=c,n[19]=a,n[20]=s,n[21]=o,n[22]=l,n[23]=e,n[24]=i,n[25]=d,n[26]=k):k=n[26];const $=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==i?(y=(E,j)=>{if(i||u||s)return E<3;const U=j.status;return U!==502&&U!==404&&E<2},n[27]=u,n[28]=s,n[29]=i,n[30]=y):y=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==y?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:y,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=y,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?Oo(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const A=x;let p;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(p=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=p):p=n[45],p}function wr(){return null}function Sr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=W(),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>_o(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function Li(e,t){const n=N.c(3),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=ze(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,c]=a;return t(c.meta?.type??"")}).map(yr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function yr(e){const[t]=e;return t}const kr="site-editor-save",Ln={id:kr,description:void 0,action:void 0,cancel:void 0},Ui="site-editor-undo",Le="site-editor-publish";function Or(e){const t=N.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 Un(e,t){return t?z.jsx(Or,{label:e("siteEditor.details"),detail:t}):void 0}function Qi(e,t,n){ne.error(hn(e,t,n),{...Ln,description:Un(e,xs(t,n))})}function Ci(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Ln,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Qn={action:void 0,duration:void 0};function Fi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Le,description:void 0})}function Bi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Le,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...Qn,id:Le,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Vi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Mo as $,Yr as A,di as B,Mi as C,Di as D,Gr as E,mr as F,Z as G,qs as H,wi as I,bi as J,ve as K,Bs as L,Vs as M,ii as N,mi as O,ci as P,ki as Q,yi as R,rr as S,Kt as T,ji as U,ui as V,us as W,ye as X,sr as Y,_s as Z,fs as _,Hr as a,fi as a$,ns as a0,Lr as a1,Qr as a2,Li as a3,rs as a4,Ci as a5,_i as a6,ri as a7,tt as a8,si as a9,Si as aA,pi as aB,rt as aC,xi as aD,Nn as aE,cs as aF,oi as aG,Le as aH,Qn as aI,Fi as aJ,Oi as aK,Ar as aL,Mr as aM,He as aN,Kr as aO,Ni as aP,li as aQ,ee as aR,ai as aS,Bi as aT,Ui as aU,Ln as aV,S as aW,w as aX,Ye as aY,Pn as aZ,Oo as a_,ar as aa,fr as ab,st as ac,Ri as ad,Pi as ae,Qi as af,Ii as ag,_n as ah,ds as ai,ei as aj,Ei as ak,Ti as al,Wr as am,Zr as an,Et as ao,Dt as ap,qr as aq,Es as ar,zr as as,bo as at,Un as au,Vi as av,Cs as aw,Ur as ax,ao as ay,Or as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,vo as d,Vr as e,mo as f,ts as g,ti as h,Gt as i,ks as j,$i as k,ut as l,Jr as m,Xr as n,Rs as o,Cr as p,ls as q,Br as r,Fr as s,Ai as t,re as u,Js as v,Ws as w,Us as x,Ts as y,tn as z};
1
+ import{c as N,q as W,i as C,K as g,er as Ue,cs as Bn,aF as Lt,aG as K,bl as Qe,bt as Fn,dA as De,dy as Vn,es as we,et as Hn,eu as Jn,r as L,ev as Wn,ew as G,ex as X,bz as Gn,a as Yn,at as _e,a4 as zn,bv as Ut,ey as Xn,ez as Qt,ar as Zn,bp as B,ea as Ct,eA as qn,eB as Kn,eC as eo,t as ne,j as z}from"./index-5IFWC0PS.js";import{u as Ce}from"./repository-binding-L4ChVpPs.js";import{e as Bt}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context-BXBBnsXM.js";import{i as no,u as oo}from"./use-sandbox-events-bxyyBbR-.js";import{u as Be}from"./use-blocks-v8-project-B4vRqcEf.js";import{u as Ft}from"./use-voice-input-DPQbRCzt.js";import{s as ft}from"./thread-intent-BujELieJ.js";import{s as so}from"./utils-yu1cqe5g.js";import{a as ro}from"./sandbox-git-api-DcqI6XE4.js";const w={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class S extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new S(t.code,t.message,t.data)}}const te="deco-content",Te={major:1},Vt=1;async function io(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const Re={major:Te.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${Re.major}.${Re.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ae(e,t,n){const o={reason:t,required:{...Re}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const s=n.server;typeof s?.name=="string"&&typeof s.version=="string"&&(o.server={name:s.name,version:s.version})}return new S(w.Unsupported,e,o)}function Jt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==te)throw ae(`the endpoint speaks ${JSON.stringify(n)}, not ${te}`,"protocol",t);if(o?.major!==Te.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Te.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Vt)throw ae(Ht,"outdated",t);return e}function dt(e,t){return t.code===w.MethodNotFound&&e.startsWith("changes.")?ae(Ht,"outdated"):S.from(t)}function Fe(e){const t=e.fetch??(r=>fetch(r));let n=1;async function o(r){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(r)}));let c;try{c=await io(a)}catch{throw new S(w.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?S.from(l):new S(w.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const s=async(r,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:r,params:i??{}});if(c.error)throw dt(r,c.error);return c.result};return{call:s,describe:async()=>Jt(await s("describe")),schemaGet:r=>s("schema.get",r),blocksList:r=>s("blocks.list",r),blocksApply:r=>s("blocks.apply",r),changesList:r=>s("changes.list",r),changesGet:r=>s("changes.get",r),changesDiscard:r=>s("changes.discard",r),async batch(r){const i=r.map(()=>n++),a=await o(r.map((l,u)=>({jsonrpc:"2.0",id:i[u],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,u)=>{const d=c.get(l);return d?d.error?{ok:!1,error:dt(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Ve(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function He(e){return e instanceof S?e.code===w.MethodNotFound?!0:e.code===w.Unsupported&&e.data?.reason==="outdated":!1}function de(e,t,n=e){return n&&n!==e?n:t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function ao(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(Ve(s)),i=de(s,r,e.getQueryData(o));if(i)return i;const a=await t.changesList({}),c=de(void 0,a,e.getQueryData(o));if(!c)throw new S(w.InternalError,"changes.list returned notModified without a cached list");return c}async function Wt(e,t){const n=[];for(let r=0;r<t.length;r+=ht)n.push(t.slice(r,r+ht));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=gt){const i=await e.batch(n.slice(r,r+gt).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),s.push(...c.diagnostics)}}return{entries:o,diagnostics:s}}async function Ar(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=vt){const s=t.slice(o,o+vt),r=await e.changesDiscard({names:s.map(i=>i.name),ifMatch:Object.fromEntries(s.map(i=>[i.name,i.version]))});n={revision:r.revision,versions:{...n.versions,...r.versions}}}return n}function Mr(e){return e instanceof S&&e.code===w.Conflict}function Je(e){return e?.kind==="protocol"?e:null}function Lr(e,t,n){const o=N.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=W();let a;o[2]!==e?(a=Je(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&r.enabled!==!1;let u;o[4]!==t?(u=g.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(d=l?()=>ao(i,c.client,t):Ue,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=d):d=o[10];let f;return o[11]!==u||o[12]!==d?(f={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=f):f=o[13],C(f)}function co(e){if(!e)return"";const t=Object.entries(e.changes).sort(([n],[o])=>n<o?-1:n>o?1:0).map(([n,o])=>[n,o.kind,o.version,o.baseVersion]);return JSON.stringify([e.revision,e.base.revision,e.base.resolvedRef,t])}function Ur(e,t,n){const o=N.c(14);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!r&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?(l=g.contentChangeSides(t??"",co(n)),o[4]=t,o[5]=n,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==r?(u=c?()=>Wt(r.client,a):Ue,o[7]=c,o[8]=a,o[9]=r,o[10]=u):u=o[10];let d;return o[11]!==l||o[12]!==u?(d={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=d):d=o[13],C(d)}function Qr(e,t,n){const o=N.c(16);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==r){const f=Object.entries(n?.changes??{}).filter(go).map(ho).sort(fo);a=f.map(uo);const h=JSON.stringify(f.map(lo));i=!!r&&!!t&&a.length>0,l=C,c=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=r,o[5]=i,o[6]=a,o[7]=c,o[8]=l}else i=o[5],a=o[6],c=o[7],l=o[8];let u;o[9]!==i||o[10]!==a||o[11]!==r?(u=i?async()=>{const f=await Wt(r.client,a),h=Object.create(null);for(const[v,b]of Object.entries(f.entries))h[v]=b.before&&typeof b.before=="object"?b.before:null;return h}:Ue,o[9]=i,o[10]=a,o[11]=r,o[12]=u):u=o[12];let d;return o[13]!==c||o[14]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Bn},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function lo(e){return[e.name,e.base]}function uo(e){return e.name}function fo(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function ho(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function go(e){const[,t]=e;return t.kind==="delete"}function Gt(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 he(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 Yt=Lt({endpoint:K().max(2048).refine(e=>Gt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Cr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Yt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function zt(e){const t=Yt.safeParse(e);return t.success?t.data:null}const Xt="studio:deco-serve-last";function Br(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Fr(){try{const e=localStorage.getItem(Xt);return e?zt(JSON.parse(e)):null}catch{return null}}function Vr(e){try{return new URL(he(e)).host}catch{return e}}function vo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const bo="http://localhost:4545/rpc";class We extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function mo(e){if(e instanceof We)return{reason:"not-deco-serve"};if(!(e instanceof S))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return He(e)?{reason:"outdated"}:{reason:"version-mismatch"};case w.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 Hr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,bo].filter(o=>!!o).map(he);return[...new Set(n)]}const po=Lt({blocks:De(K(),De(K(),Vn()).refine(Qe)),versions:De(K(),K().min(1)),missing:Fn(K())});function wo(e,t){const n=po.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 oe(e,t){const n=e.index?.entries[t];return!!n&&Qe(e.blocks[t])&&e.versions[t]===n.version}function So(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 yo(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?oe(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const bt=50,mt=10;function ko(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((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new S(w.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(c=>[c.id,c]));return s.map(c=>{const l=a.get(c);return l?l.error?{ok:!1,error:S.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Oo(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]={[Jn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Hn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function Eo(e,t){return e?.entries[t]?.meta?.refs??[]}function Do(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ge(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xe(e,t){if(Array.isArray(e)){for(const n of e)xe(n,t);return}if(Ge(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):xe(o,t)}function Zt(e,t){if(!Ge(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;xe(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){G(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[c,l]of Object.entries(n)){const u=i[c]?.editor??null;if(l===null||l===X){delete r[c],i[c]={operation:"delete",version:X,editor:u};continue}const d=Zt(o[c],a);r[c]={version:l,...d?{meta:d}:{}},i[c]={operation:"set",version:l,editor:u}}return{...s,entries:r,draft:i}})}function Io(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]),c=Zt(o.block,a);i[n]={version:o.version,...c?{meta:c}:{}}}return{...s,entries:i,draft:r}})}const pt=new WeakMap;async function Ye(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new S(w.Unavailable,"The CMS index is not loaded yet");let i=pt.get(e);i||(i=new Map,pt.set(e,i));const a=e.getQueryData(g.decofile(n))??{},c=e.getQueryData(g.contentVersions(n))??{},l=[],u=[];for(const f of new Set(o)){const h=r.entries[f];if(!h||s.has(f)||Qe(a[f])&&c[f]===h.version)continue;const v=i.get(`${n}\0${f}`);v?l.push(v):u.push(f)}if(u.length>0){const f=To(e,t,n,u);for(const h of u){const v=`${n}\0${h}`;i.set(v,f),f.catch(()=>{}).finally(()=>{i.get(v)===f&&i.delete(v)})}l.push(f)}await Promise.all(l);const d=ge(e,n);if(o.some(f=>d.index?.entries[f]&&!s.has(f)&&!oe(d,f)))throw new S(w.Unavailable,"A CMS block changed while loading; try again")}async function _o(e,t,n,o,s){if(!t){const i=o?.[s];return Ge(i)&&!Gn(i)?i:void 0}await Ye(e,t,n,[s]);const r=ge(e,n);return r.index?.entries[s]&&oe(r,s)?r.blocks[s]:void 0}function ge(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function To(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=bt)r.push(o.slice(i,i+bt));for(let i=0;i<r.length;i+=mt){const a=r.slice(i,i+mt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new S(w.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=wo(u.result,a[l]),f=ge(e,n),h=So(s,f,d);if(G(e),h.blocks!==f.blocks&&e.setQueryData(g.decofile(n),h.blocks),h.versions!==f.versions&&e.setQueryData(g.contentVersions(n),h.versions),h.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new S(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function ze(e){const t=N.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:Ro,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Ro(){throw new Error("the content index is set by the poll")}function wt(e,t){const n=N.c(8);let o;n[0]!==t?(o=Wn(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(c=>{c.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 St=3e4;function xo(e){if(!(e instanceof S))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function Po(e,t,n,o){const s=N.c(15),r=W(),i=ze(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=wt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=wt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const p of n)for(const E of Eo(i,p))f.add(E);const h=[...f].filter(p=>!!i?.entries[p]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(p=>!oe(v,p)),m=JSON.stringify(h.map(p=>[p,i?.entries[p]?.version,oe(v,p)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===m?R:null;L.useEffect(()=>{if(!e||!m)return;let p=!0;const E=JSON.parse(m).map($o);return Ye(r,e,t,E).then(()=>{p&&k(j=>j?.key===m?null:j)},j=>{p&&k(U=>({key:m,count:(U?.key===m?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{p=!1}},[e,r,t,m,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const p=Math.min(St,_.retryAfterMs??Bt(St,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),p);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let y;s[7]!==_?(y=[_],s[7]=_,s[8]=y):y=s[8],L.useEffect(T,y);const O=!e||yo(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(No),s[9]=I,s[10]=x):x=s[10];let A;return s[11]!==O||s[12]!==D||s[13]!==x?(A={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=A):A=s[14],A}function No(e){return e+1}function jo(e){return e+1}function $o(e){const[t]=e;return t}const Kt=L.createContext(null);function Ao(e){const t=N.c(24),n=L.useContext(Kt),o=Be(n?null:e),{data:s}=Yn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?_e.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=kt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?_e.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=kt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?zt(c):null,t[8]=c,t[9]=i,t[10]=o,t[11]=h):h=t[11];const v=h,b=i&&o&&typeof d=="string"?d:null;let m;t[12]!==f||t[13]!==l||t[14]!==i?(m=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=m):m=t[15];let R;t[16]!==l||t[17]!==i?(R=()=>{i&&l(null)},t[16]=l,t[17]=i,t[18]=R):R=t[18];let k;return t[19]!==v||t[20]!==b||t[21]!==m||t[22]!==R?(k={connection:v,lastEndpoint:b,set:m,clear:R},t[19]=v,t[20]=b,t[21]=m,t[22]=R,t[23]=k):k=t[23],k}function yt(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function kt(e){const t=N.c(17),n=W(),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?yt(e):null,a=()=>e?yt(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:r,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=C(l);let d;t[10]!==e||t[11]!==n||t[12]!==r?(d=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]=d):d=t[13];const f=d,h=e?u??null:null;let v;return t[14]!==f||t[15]!==h?(v=[h,f],t[14]=f,t[15]=h,t[16]=v):v=t[16],v}function en(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function Mo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Jr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Wr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Gr(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 Yr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Gt(t)?t:null}function zr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function tn(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Lo(e){if(!e.hasProject)return"legacy";const t=tn(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 Uo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function Ot(e){return e.isError||e.errorUpdateCount>0}function Qo(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 Co(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 nn="__noSchema";function on(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[nn]:!0}}function Xr(e){return!!e&&e[nn]===!0}function Xe(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Bo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Fo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Zr(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:Bo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Fo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Et(n.resolveType).localeCompare(Et(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Et(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Dt(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]=Dt(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?Dt(r[a],s,n):r[a];return i}return e}function qr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class It extends Error{}const Ze="site-not-owned";async function Vo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Ho(e,t=n=>fetch(n)){const n=Fe({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:we(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await Ke(n)}catch(o){if(o instanceof It)return Ze;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===Ze?o:{...o,hosted:ko(e,n)}}const qe=5e3;function Wo(e){if(!e.site)throw new Error("this project names no site");return Xn(e.site,e.branch)}function Go(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function Ke(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!==te)throw new We;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Xe(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Yo(e,t=n=>fetch(n)){return Ke(Fe({endpoint:e,fetch:n=>t(new Request(n,{signal:we(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Ft(e),i=L.useContext(Kt),a=Be(e),c=Ut(Ce(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=W(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,m=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Jo(Wo({orgSlug:o.slug,site:c,branch:t}),()=>Qt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,..._t}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Yo(Go({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=k):k=n[4];const $=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,..._t}),I=!!s;let _;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(_=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=_):_=n[8];let T;n[9]!==s?(T=()=>ts(s.endpoint),n[9]=s,n[10]=T):T=n[10];let y;n[11]!==I||n[12]!==_||n[13]!==T?(y={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Zo,retryDelay:Xo,refetchInterval:zo},n[11]=I,n[12]=_,n[13]=T,n[14]=y):y=n[14];const O=C(y);let D;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=D):D=n[18];const x=D;let A;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(A=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=A):A=n[22];let p;n[23]!==O.data||n[24]!==x||n[25]!==h?(p=async()=>{try{return await O.data.client.describe()}catch(q){const Cn=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Cn}},n[23]=O.data,n[24]=x,n[25]=h,n[26]=p):p=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==p||n[29]!==E?(j={queryKey:A,queryFn:p,enabled:E,refetchInterval:qe,retry:!1},n[27]=A,n[28]=p,n[29]=E,n[30]=j):j=n[30];const M=C(j).data??O.data?.describe,Q=Lo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:m.data===Ze?"not-owned":m.data?"ready":Ot(m)?"error":"loading",sandboxSite:qo({data:$.data,isError:Ot($),workingTreeReady:f})});if(Q==="pending")return{kind:"pending",...u};if(Q==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...u};if(Q==="legacy")return{kind:"legacy"};if(Q==="protocol-github")return{...Pe(u,m.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Pe(u,$.data);if(Q==="unavailable-github"){let q;return n[31]!==u?(q={kind:"unavailable",...u},n[31]=u,n[32]=q):q=n[32],q}const P=O.error??O.failureReason,V=s?.endpoint??"";let H;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==V||n[38]!==P?(H=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:V}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=V,n[38]=P,n[39]=H):H=n[39],H}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?qe:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof S)&&!(t instanceof We)}function qo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Ko=3;function es(e){const t=en("local",e.endpoint),n=e.probed?Pe(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Ko?n:{kind:"unavailable",...t,problem:mo(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?qe:!1};function Pe(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function ts(e,t){return Ke(Fe({endpoint:e,fetch:n=>fetch(n,{signal:we(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function Ne(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ns(e,t){return Ne({...e,protocolSuffix:t.cacheKeySuffix})}function os(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ss(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,Mo(t)])}function rs(e,t,n){const o=N.c(21),s=W(),r=re(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?ns(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=Po(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=os(l,r.kind,c),o[3]=r.kind,o[4]=c,o[5]=l,o[6]=u):u=o[6];const d=u,f=r.kind!=="legacy";let h;o[7]!==r||o[8]!==e?(h=ss(e,r),o[7]=r,o[8]=e,o[9]=h):h=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==c||o[13]!==s||o[14]!==e?(v=()=>{if(c.retry(),!e||r.kind!=="unavailable")return;const m=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...m==="local"?["local"]:[e.branch,m])})},o[10]=r.kind,o[11]=r.source,o[12]=c,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==d||o[17]!==f||o[18]!==h||o[19]!==v?(b={...d,v8:f,scopeKey:h,retry:v},o[16]=d,o[17]=f,o[18]=h,o[19]=v,o[20]=b):b=o[20],b}function sn(e){const t=N.c(12);let n;t[0]!==e?(n=_e.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Zn(o,null),i=Be(e);let a;t[2]!==s||t[3]!==e?(a=e?ft(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const l=i?null:a;let u,d;t[5]!==r?(u=h=>r(ft(h)),d=()=>r(null),t[5]=r,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f={url:l,setUrl:u,clear:d},t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}const Tt=6e4,is=2147483647;function as(e,t){if(e===null||e.trim()==="")return Tt;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<=is?o:Tt}class rn extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+as(o,s):null}status;retryAt}function cs(e,t,n=Date.now()){const o=Bt(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function et(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 rn(o,e.status,e.headers.get("retry-after"))}function ls(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ye(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ye(e,t,n).join(":")}}class tt 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 nt(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function ot(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return et(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(nt(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(nt(t)))??null}async function gs(e,t){return(await fetch(ot(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Kr(e){const t=N.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?nt(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:vs,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s??null}async function vs(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function bs(e,t){const n=await fetch(ot(t),{cache:"no-store"});if(!n.ok)return et(n,"Read decofile");const o=await n.json();return o.token&&ds(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function ei(e,t){const n=await fetch(ot(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 tt(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return fs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const an=3e3,ms=15e3,ps=2*6e4,cn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function ws(e){return e<ps?an:ms}function Ss(e,t=cn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,ws(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:c,skip:l}=e();if(s||t.hidden()||l?.()){i();return}s=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const xt=()=>0;function ys(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>Ss(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,xt,xt)}function ln(e,t){return Se(e,t)}function ks(e,t){return Se(e,"preview-fetch",{path:t})}function ti(e){return ln(e,"preview-invoke")}function ni(e){return ln(e,"catalog-invoke")}function un(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 Os(){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&&un(n))return n}return null}function Es(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Os();return n&&un(n)?new URL(t,n).toString():ks(e,t)}function Ds(e){return Es(e,"/.decofile")}function Is(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Pt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function _s(e,t){const n=Se(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=Is(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:so(r.content)}}async function Ts(e,t){const n=await _s(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function oi(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 et(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Ce(e)?.metadata?.runtime?.path??null}function je(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(c=>B(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class fn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function si(e){return e instanceof S&&e.code===w.Conflict}function dn(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 st extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class rt extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof st||t instanceof rt)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof st)return e("siteEditor.save.draftUnread");if(t instanceof rt)return e("siteEditor.save.keptChanging");if(t instanceof tt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof S)switch(t.code){case w.Conflict:return e("siteEditor.save.conflict");case w.ReadOnly:return e("siteEditor.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("siteEditor.save.invalid");case w.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function xs(e,t){if(t==="local"||e instanceof tt||e instanceof st||e instanceof rt)return null;if(e instanceof S){const n=e.code===w.InvalidBlock||e.code===w.InvalidParams?dn(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ps(e,t){if(t instanceof fn)return e("decoServe.save.serverGone");if(t instanceof S)switch(t.code){case w.Conflict:return e("decoServe.save.conflict");case w.ReadOnly:return e("decoServe.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("decoServe.save.invalid",{detail:dn(t)});case w.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Ns(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function js(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=Ns(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const $s="decocms:content-writes",$e=new Set;let Y;function gn(){if(Y!==void 0)return Y;Y=null;try{typeof BroadcastChannel=="function"&&(Y=new BroadcastChannel($s),Y.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...$e])n(t)}))}catch{Y=null}return Y}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),$e.add(e),()=>{$e.delete(e)}}const vn="__at=",bn="__test=",Ls=/^[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 Us(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ls.test(e)}function Nt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Qs(e){const t=e.tests??{};return[...e.at!==void 0?[vn+Nt(e.at)]:[],...Object.keys(t).map(n=>bn+Nt(`${n}=${t[n]?"on":"off"}`))]}function jt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(vn)&&!s.startsWith(bn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=Qs(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+jt(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("?"),c=a===-1?i:i.slice(0,a),l=a===-1?"":i.slice(a+1);return`${c}${jt(l,n)}${e.slice(r)}`}function ii(e,t,n){if(!Us(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",ve(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",ve(n,t)),o.toString()):e}catch{return e}}function ai(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 mn(e){return btoa(encodeURIComponent(e))}function ci(e,t,n){const o=Cs(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Cs(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",mn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Bs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Fs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Bs,t),n.toString()}function ui(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 fi(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",mn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function pn(e,t,n){return`${e}@${t}=${n}`}function hi(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[pn(e,"sections",t.index)]}function gi(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[pn(e.pageKey,o,e.selectedVariantIndex)]}function vi(e,t){return[...t,...e]}function Hs(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function it(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(l=>l&&!l.startsWith($t)),...t.map(l=>$t+Hs(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function bi(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 it(`${s}${o.pathname}@local`,t)}catch{return null}}function mi(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",it(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Fs)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?ve(e.heldRevision,e.previewOptions):ve(it(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function pi(e,t,n){if(!e||!n)return null;try{return Ws(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Ae=new Map;function wn(e){for(const t of Ae.get(e)??[])t()}function Sn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),wn(e))}function Gs(e){return le.get(e)??null}function Ys(e,t){return JSON.stringify(e)===JSON.stringify(t)}function wi(e,t){const n=ce.get(e)??be,o=t??be;Ys(n,o)||(t?ce.set(e,o):ce.delete(e),wn(e))}function zs(e){return ce.get(e)??be}function yn(e,t){let n=Ae.get(e);return n||(n=new Set,Ae.set(e,n)),n.add(t),()=>{n.delete(t)}}function Xs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>yn(e,s),o=()=>zs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Zs)}function Zs(){return be}function qs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>e?yn(e,s):er,o=()=>e?Gs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ks)}function Ks(){return null}function er(){}function Si(e,t){const n=N.c(4),o=Xs(e),s=qs(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Js({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const kn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},tr=15e3,me=new Map;function Z(e,t){return`${e}/${t}`}function F(e){let t=me.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},me.set(e,t)),t}function J(e,t){const n=F(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function ke(e){e.timer&&clearTimeout(e.timer),e.timer=null}function at(e){return me.get(e)?.state??kn}function nr(e,t){const n=F(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function yi(e){const t=F(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(ke(t),J(e,{phase:"idle"}))}}function ki(e){const t=me.get(e);!t||t.state.phase!=="reloading"||(ke(t),J(e,{phase:"idle"}))}function On(e){const t=F(e);ke(t),J(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=F(e),o=Math.max(0,n.state.inFlight-1);if(o>0){J(e,{inFlight:o});return}if(!t.ok||n.previews===0){J(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=F(e);ke(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&J(e,{phase:"idle"})},tr),J(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function or(e){return e?.kind==="protocol"&&e.source==="github"}async function fe(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=r?g.protocolDraftRead(o,s,r):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,d=c?[c]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:ro(o,s,r)})),or(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=Z(o,s);J(v,{epoch:at(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ct.schedule(v)),{navigates:h}}async function sr(e,t){return On(Z(e.orgSlug,e.virtualMcpId)),Dn(e,t)}function At(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Dn(e,t){const n=Z(e.orgSlug,e.virtualMcpId),o=t.adopted?At(e):null;let s;try{s=await t.write()}catch(i){throw ue(n,{ok:!1,navigates:!1}),t.refreshOnError&&fe(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&As(e.cacheKey),Sn(n,t.shownRevision?.(s)??null),t.adopted){const i=At(e)!==o;return i&&await new Promise(a=>Ct.schedule(a)),ue(n,{ok:!0,navigates:i}),t.reread&&fe(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await fe(e,t))}catch{}finally{ue(n,{ok:!0,navigates:r})}return s}function Oi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=Z(o,s),a=new Set(t.blockKeys);for(const u of[...F(i).discardListeners])u(a);On(i);let c=!1;const l=()=>(c=!0,Dn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ye(o,s,r),scope:us(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function Ei(e,t,n){const o=N.c(8);let s;o[0]!==e||o[1]!==t?(s=Z(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 c=F(r).discardListeners;return c.add(n),()=>{c.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 In(e){const t=Z(e.orgSlug,e.virtualMcpId);at(t).inFlight>0||(Sn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=F(t);o.previews>0&&o.state.inFlight===0&&En(t,n)}).catch(()=>{}))}function rr(e,t){const n=N.c(7);let o;n[0]!==e||n[1]!==t?(o=Z(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const s=o;let r;n[3]!==s?(r=l=>nr(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>at(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const ir=500;function Di(e,t){const{phase:n}=rr(e,t);return js(n!=="idle",ir)}function ar(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function _n(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Ii(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Do(i,n):cr(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 Tn(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 cr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return Rn(o,Oe(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(B(n))?X:null}function _i(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Tn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Oe(e,t).has(B(n))}function Ti(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Oe(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Oe(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function pe(e,t,n,o){const s=B(n),r=Oe(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),G(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function xn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===X?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>je(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[B(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const m=je(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:m}:m!==null?h[v]={kind:"delete",version:null,baseVersion:m}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?pe(e,n,f,!1):!u.has(B(f))&&l.has(f)&&pe(e,n,f,!0);const d=o.revision;return d&&d!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:d}),s}function Ee(e,t,n){G(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 Pn(e,t){const n=e.getMutationCache().findAll({mutationKey:ye(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Me(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function se(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof S);throw t.source==="local"&&r?(Me(e,n),new fn(s)):(t.source==="local"&&He(s)&&Me(e,n),s)}}const Mt=new WeakMap;function ct(e){let t=Mt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Mt.set(e,t)),t}function Nn(e,t,n,o){const{inFlight:s}=ct(e),r=s.get(o);if(r)return r;const i=lt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function lr(e,t,n){const o=N.c(8),s=W(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(c=()=>{if(!e||!r||!i||!a)return;const u={orgSlug:r,virtualMcpId:i,branch:a},{rereading:d}=ct(s);return Ms(f=>{f===n&&(d.has(n)||(d.add(n),fr(s,e,u,n).catch(ur).finally(()=>d.delete(n))))})},l=[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]=c,o[7]=l):(c=o[6],l=o[7]),L.useEffect(c,l)}function ur(){}async function fr(e,t,n,o){const s=ct(e).inFlight.get(o);return s&&await s.catch(()=>{}),Nn(e,t,n,o)}async function lt(e,t,n,o,s){G(e);const r=g.decofile(o),i=_n(n,t),a=g.contentRevision(o),c=g.contentVersions(o),l=e.getQueryData(r),u=e.getQueryData(c),f=e.getQueryData(i),h=e.getQueryData(a)??void 0,v=s&&l&&u?h?.revision:void 0,b=s&&f?h?.schemaVersion:void 0,m=g.contentChanges(o),R=e.getQueryData(m);if(t.source==="github"&&t.hosted)return dr(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,$,I]=await se(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:Ve(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(m,E)}else I&&t.source==="local"&&He(I.error)&&Me(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const y=k.result,O=Xe($),D=$.ok&&!O?$.result:null;if(y.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=y.notModified?new Set:Pn(e,n),A=y.notModified?l:Qo(y.blocks,l,x),p=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:y.notModified?h?.revision:y.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!y.notModified){const E=e.getQueryData(c),j={...y.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return p instanceof S||e.setQueryData(i,p),!T&&!y.notModified&&l&&h?.revision&&y.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:p}}async function dr(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=_n(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,m]=await se(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:Ve(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(m?.ok&&!$){const P=de(r.seenChanges,m.result);P&&e.setQueryData(d,P)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const I=v.result,_=Xe(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const y=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;y instanceof S||e.setQueryData(u,y);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||$)return e.setQueryData(c,{revision:$?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:y};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const A=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&jn(f.draft,x.draft));A&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),P=>P&&{...P,version:x.revision}),e.setQueryData(c,{revision:x.revision,schemaVersion:O});const p=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,V]of Object.entries(D)){const H=x.entries[P];!H&&!p.has(P)||(j[P]=V,E[P]!==void 0&&(U[P]=E[P]),H&&!p.has(P)&&E[P]!==H.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await Ye(e,n,s,M,p),R&&A&&hr(R,x)&&In({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:y}}function hr(e,t){if(jn(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 jn(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 gr(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 Ie(e){if(!(e instanceof S)||e.code!==w.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 vr(e,t){if(!(e instanceof S)||e.code!==w.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,c]of o){const l=c?.actual;if(typeof l!="string"||(Object.hasOwn(s,a)?await eo(s[a]):r.has(a)?X:void 0)!==l)return;i[a]=l}return i}function br(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 ie(e,t,n,o,s){G(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),Ee(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),qt(e,n,s,o.set??{})}async function Ri(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(l=>!r||!Object.hasOwn(r,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const c=qn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return sr({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=(u,d=r)=>se(e,t,n,()=>t.client.blocksApply({set:u.set,delete:u.delete,...d?{ifMatch:gr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?Ie(u):void 0;if(!d)throw u;const f=br(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=Ie(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const m=await vr(v,f);if(!m)throw v;ie(e,n,o,f,m);try{h=await i(f,{...r,...m})}catch(R){const k=Ie(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}G(e);const c=t.source==="github"?xn(e,n,o,a):a.revision;t.source==="github"&&qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return Ee(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof S))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 An(e,t,n){if(!(n instanceof S))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&pe(e,t,s,!1)}function Mn(e,t,n,o){G(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=je(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=B(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(u)!==c));s?a!==null&&(l[n]={kind:"delete",version:null,baseVersion:a}):l[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:l,edited:!0})}pe(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),c=>{const l={...c};return s?delete l[n]:l[n]=o.block,l}),Ee(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof S))return!1;An(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>$n(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{Mn(e,n,a,i[c])}),!0)}async function Pi(e,t,n,o,s,r){t.source==="github"&&An(e,o,r);const i=t.source==="github"?$n(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),Mn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const l=(await se(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return l?.kind?d[s]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete d[s],{...u,changes:d,edited:!0}})}catch{const c=await se(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[s]??null,version:c.versions[s]??null}}return e.setQueryData(g.decofile(o),c=>{const l={...c};return a.value===null?delete l[s]:l[s]=a.value,l}),Ee(e,o,{[s]:a.version}),!1}function mr(e){const t=N.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=Ut(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 Qt(s,e.branch),m=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&m>0?b.pointer.slice(0,m):null,version:b.pointer&&m>0?b.pointer.slice(m+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let c;t[9]!==r||t[10]!==i||t[11]!==a?(c={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=c):c=t[12];const{data:l,isPending:u,isError:d}=C(c),f=!!e&&!!s&&u&&!d;if(!e||!l?.draft||!l.version){let b;return t[13]!==f?(b={pointer:null,pending:f},t[13]=f,t[14]=b):b=t[14],b}const h=`${l.draft}@${l.version}`;let v;return t[15]!==h?(v={pointer:h,pending:!1},t[15]=h,t[16]=v):v=t[16],v}function Ni(e){return mr(e).pointer}function ji(e){const t=N.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:pr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function pr(){throw new Error("content revisions are set by reads and writes")}function ut(e,t){const n=N.c(6),{url:o}=sn(e?.virtualMcpId),s=re(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?Ne({...e,protocolSuffix:s.cacheKeySuffix}):Ne({...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 $i(e,t){const n=N.c(46),{url:o}=sn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=ut(e),c=t?.fetchEnabled??!0,l=Rs(e?.virtualMcpId),u=Ft(e?.virtualMcpId).runtime==="cms",d=W();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;lr(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ye(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<an/2},n[2]=e,n[3]=d,n[4]=h,n[5]=v):v=n[5];let b;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==d||n[11]!==h?(b=async()=>{if(e){if(!i&&u&&!s){const E=hs(d,e)?.version;if(E&&!await gs(e,E))return}await d.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=i,n[10]=d,n[11]=h,n[12]=b):b=n[12];let m;n[13]!==v||n[14]!==b?(m={skip:v,read:b},n[13]=v,n[14]=b,n[15]=m):m=n[15],ys(!!t?.pollWhile&&!!e,m);const R=ze(i?.hosted?a:"");let k;n[16]!==r.kind||n[17]!==u||n[18]!==c||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==l||n[23]!==e||n[24]!==i||n[25]!==d?(k=async()=>{if(i)return(await Nn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw ar("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Sr),Q=M?.ok?Rt(await M.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return bs(d,e);const E=()=>Ts(e,ls(l,".deco/blocks.gen.json"));if(c){const M=await fetch(Ds(e),{cache:"no-store"}).catch(wr);if(M?.ok){const V=Rt(await M.text());if(V)return V}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw P.status=Pt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:Q.kind==="absent"}),P}const j=await E();if(j.kind==="data")return j.data;const U=new Error("decofile unavailable (preview down, no committed snapshot)");throw U.status=Pt({liveOk:!1,committedAbsent:j.kind==="absent"}),U},n[16]=r.kind,n[17]=u,n[18]=c,n[19]=a,n[20]=s,n[21]=o,n[22]=l,n[23]=e,n[24]=i,n[25]=d,n[26]=k):k=n[26];const $=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==i?(y=(E,j)=>{if(i||u||s)return E<3;const U=j.status;return U!==502&&U!==404&&E<2},n[27]=u,n[28]=s,n[29]=i,n[30]=y):y=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==y?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:y,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=y,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?Oo(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const A=x;let p;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(p=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=p):p=n[45],p}function wr(){return null}function Sr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=W(),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>_o(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function Li(e,t){const n=N.c(3),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=ze(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,c]=a;return t(c.meta?.type??"")}).map(yr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function yr(e){const[t]=e;return t}const kr="site-editor-save",Ln={id:kr,description:void 0,action:void 0,cancel:void 0},Ui="site-editor-undo",Le="site-editor-publish";function Or(e){const t=N.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 Un(e,t){return t?z.jsx(Or,{label:e("siteEditor.details"),detail:t}):void 0}function Qi(e,t,n){ne.error(hn(e,t,n),{...Ln,description:Un(e,xs(t,n))})}function Ci(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Ln,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Qn={action:void 0,duration:void 0};function Bi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Le,description:void 0})}function Fi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Le,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...Qn,id:Le,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Vi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{fs as $,Ws as A,Us as B,Ts as C,tn as D,di as E,Gr as F,mr as G,Z as H,qs as I,wi as J,bi as K,ve as L,Fs as M,Vs as N,ii as O,mi as P,ci as Q,ki as R,yi as S,Kt as T,rr as U,ji as V,ui as W,us as X,ye as Y,sr as Z,_s as _,Hr as a,fi as a$,Mo as a0,ns as a1,Lr as a2,Qr as a3,Zr as a4,Et as a5,Dt as a6,qr as a7,Wr as a8,zr as a9,tt as aA,si as aB,fr as aC,st as aD,Ri as aE,Pi as aF,Qi as aG,Ii as aH,ds as aI,ei as aJ,Ei as aK,Ti as aL,rt as aM,Kr as aN,Ni as aO,li as aP,xi as aQ,ee as aR,ai as aS,Fi as aT,Ui as aU,Ln as aV,S as aW,w as aX,Ye as aY,Pn as aZ,Oo as a_,bo as aa,Un as ab,Vi as ac,Cs as ad,Ur as ae,_n as af,ao as ag,Or as ah,Si as ai,pi as aj,rs as ak,Es as al,Nn as am,ar as an,cs as ao,oi as ap,Le as aq,Qn as ar,Bi as as,Oi as at,Ar as au,Mr as av,He as aw,Ci as ax,_i as ay,ri as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,Mi as d,Vr as e,Li as f,Di as g,Yr as h,Jr as i,$i as j,Ai as k,vo as l,mo as m,Gt as n,ts as o,Cr as p,ti as q,Fr as r,Br as s,ks as t,re as u,ut as v,Xr as w,Rs as x,ls as y,Js as z};
@@ -0,0 +1 @@
1
+ import{b as ee,a4 as te,q as ne,r as E,j as t,B as Q,n as _,dY 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,b5 as xe,t as C,dL as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gD as Ce}from"./index-5IFWC0PS.js";import{a as De}from"./SwitchHorizontal01-Dkkqg27i.js";import{N as we}from"./agent-icon-bK3wLPrb.js";import{s as Ne}from"./Trash01-Cqkcp6ky.js";import{i as Pe}from"./Upload01-CsOcxm5q.js";import{i as ie}from"./Zap-BhxT34oC.js";import{S as Ae}from"./search-toggle-BvL2EnQl.js";import{E as W}from"./empty-state-De0GyKdS.js";import{C as Ee}from"./collection-tabs-CDEZauaw.js";import{S as Me,F as Oe}from"./folder-icon-RhxrL37z.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-Dpr5-hHp.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-BXBBnsXM.js";import{c as Le}from"./context-shell-DAsZEr3G.js";import"./AlertCircle-BdE1rZoJ.js";import"./Tool01-D4tVVqAj.js";import"./ArrowUp-km-Xmh__.js";import"./ArrowLeft-DIrnwv8l.js";import"./LinkBroken01-Mv2kbzSM.js";import"./BookOpen01-BneB1q9z.js";import"./Globe04-DIBckqos.js";import"./CheckCircle-CiBUynzC.js";import"./ChevronUp-B7dgqvYM.js";import"./ChevronSelectorVertical-CRWdnYCm.js";import"./UserSquare-CK-bjijW.js";import"./CreditCard01-CcIddg9s.js";import"./Key01-BV5ckBOE.js";import"./Minus-Bygm9L7w.js";import"./Monitor01-HDGt-WwC.js";import"./Sun-CgOyXDTW.js";import"./Play-DROL2O51.js";import"./Plus-C-Or0hIv.js";import"./SearchMd-D88tiwag.js";import"./ShoppingBag01-Cdbqpanm.js";import"./Users01-BpEuprvx.js";import"./XClose-D9taHFI1.js";import"./icon-button-Bek6uWU8.js";import"./tooltip-Bj0ggRLV.js";import"./index-e47kvUTQ.js";import"./badge-D9oJO89f.js";import"./markdown-BhnPL5Bs.js";import"./use-copy-s7vshP5o.js";import"./use-mobile-M7B5YJR_.js";import"./use-view-draft-kind-Cu0aFeKZ.js";import"./thread-route-CG4NoBnV.js";import"./use-project-scope-D1EeIJG0.js";import"./repository-binding-L4ChVpPs.js";import"./use-mcp-client-D_jTz-1i.js";import"./auth-YGSVzhUG.js";import"./use-organization-settings-CIEI8bNF.js";import"./schema-Dc_MkHkp.js";import"./task-board-DVtARw_U.js";import"./thread-intent-BujELieJ.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-Cgkbp7EA.js";import"./file-preview-CK5Pkylz.js";import"./utils-yu1cqe5g.js";import"./editor-DSTLBMSV.js";import"./file-type-icon-DI74_rhH.js";import"./useInfiniteQuery-CfdlXnOy.js";import"./infiniteQueryObserver-CgeE9MzI.js";import"./use-entitlements-BPjzEs4p.js";import"./use-ai-providers-hOyNnU7s.js";import"./use-decopilot-events-Ctfpdj_z.js";import"./require-capability-Cm5TFoc0.js";import"./access-gate-Bbt03qvc.js";import"./capability-load-error-BfsuWu82.js";import"./sections-BYpfTFZT.js";import"./textarea-BxqysnAf.js";import"./use-ask-in-chat-BkWoc5AG.js";import"./shell-layout-SnEo2Z8s.js";import"./use-deployment-admin-CJOxofw6.js";import"./admin-fetch-BhTJlAsX.js";import"./command-CL5fBjco.js";import"./index-BgGa_gEX.js";import"./integration-icon-ClorKiq5.js";import"./project-icon-B90806PF.js";import"./use-navigate-to-agent-BoWId4qC.js";import"./use-debounced-value-B0C48w17.js";import"./new-project-dialog-ly3jlxrO.js";import"./label-C1myK8cj.js";import"./repository-picker-CCYsOJZQ.js";import"./github-icon-DbvGzNXg.js";import"./collection-search-d8_we7KS.js";import"./legacy-admin-welcome-dialog-DtBTs-JZ.js";import"./drawer-CT21cqiT.js";import"./required-auth-layout-BUx3f5eg.js";import"./use-org-sso-zsNytoCe.js";const J=200,_e=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Fe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!_e.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=Le(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 F="*";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 ws(){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(F),[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=l.filter(Fe),U=L.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(L.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(L.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let Y=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}Y=!0;const A=He($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(L,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){Y&&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:F,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:F,S=u===F?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(_,{children:[t.jsx(_.Content,{children:t.jsx(_.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(_.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(W,{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(W,{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{ws as default};
@@ -1 +1 @@
1
- import{c as _,m as N,j}from"./index-Dd5hidCj.js";import{T as k,R as z,a as D,b as S}from"./index-ozu548h3.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-5IFWC0PS.js";import{T as k,R as z,a as D,b as S}from"./index-Co1pEKoz.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,fh as K}from"./index-Dd5hidCj.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-Cx2tI-v0.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},Xe=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=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(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 K.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 je(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:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(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,G=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:!G,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:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))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],Fe=(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{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
1
+ import{r as v,eQ as G}from"./index-5IFWC0PS.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"./core.esm-q-GZRseF.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"},Q="transform",Ee=Y.Transition.toString({property:Q,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:Q})}}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=J(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 J(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)||!J(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,hi as k,gL as b,g6 as y,g7 as a,h$ as D,B as m,I as g,aM as z,aL as T,aI as O,aG as R,aK as F,aJ as M,bj as q,E as C,t as c,c as U}from"./index-Dd5hidCj.js";import{D as $}from"./domain-settings-DEAsOpnU.js";import{S as G}from"./switch-BZMVD_xA.js";import{a as H,b as J,c as K,d as Q}from"./use-org-sso-DNEWwtoA.js";import{s as V}from"./Trash01-CgWosjFE.js";import{R as W}from"./require-capability-Dlaolf-u.js";import"./badge-D7MkXlu5.js";import"./select-iwVnUZSM.js";import"./index-BdQq_4o_.js";import"./index-B57dAAxD.js";import"./ChevronUp-Dh24Sq_k.js";import"./access-gate-DbqD_EAv.js";import"./capability-load-error-cDMC87PI.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=H(o.id,o.slug),f=J(o.id,o.slug),S=K(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,L=()=>{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"))}},N=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($,{}),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(G,{checked:n.enforced,onCheckedChange:N,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:L,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(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 de(){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{de as default};
1
+ import{b as A,a4 as B,r as v,j as e,n as x,hr as k,gT as b,ge as y,gf 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 F,aK as M,b5 as q,E as C,t as c,c as U}from"./index-5IFWC0PS.js";import{D as H}from"./domain-settings-CzQKvon-.js";import{S as $}from"./switch-CcIiziq_.js";import{a as J,b as K,c as G,d as Q}from"./use-org-sso-zsNytoCe.js";import{s as V}from"./Trash01-Cqkcp6ky.js";import{R as W}from"./require-capability-Cm5TFoc0.js";import"./badge-D9oJO89f.js";import"./select-Dj8hBfnd.js";import"./index-BdQq_4o_.js";import"./index-e47kvUTQ.js";import"./ChevronUp-B7dgqvYM.js";import"./access-gate-Bbt03qvc.js";import"./capability-load-error-BfsuWu82.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(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 de(){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{de as default};
@@ -0,0 +1,2 @@
1
+ import{U as Ye,t as ie,A as ze,V as Ge,W as Qe,X as Ze}from"./usage-stats-FTjlrZsR.js";import{r as p,gm as Je,gh as we,gn as et,go as j,gp as te,j as I,c7 as tt,gq as nt,gr as ne,gs as ot,gt as rt,gu as st,gv as it,gw as at,gx as lt,gy as Ce,gz as ct,c as X,V as ut,K as dt,gA as ft,gB as gt,gC as mt,b as pt,m as vt,h as ht}from"./index-5IFWC0PS.js";import{g as bt,d as xt}from"./tool-namespace-C9gQSjv3.js";import{A as yt}from"./agent-icon-bK3wLPrb.js";var Xn=Ye;var Rt=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ae=Rt.join(","),Ie=typeof Element>"u",G=Ie?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=!Ie&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n?.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return i},St=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},Et=function(e,t,o){if(ee(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&G.call(e,ae)&&r.unshift(e),r=r.filter(o),r},le=function(e,t,o){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ee(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=le(l,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var d=G.call(i,ae);d&&o.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),g=!ee(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&g){var h=le(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return r},Te=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Pe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||St(e))&&!Te(e)?0:e.tabIndex},wt=function(e,t){var o=Pe(e);return o<0&&t&&!Te(e)?0:o},Ct=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ae=function(e){return e.tagName==="INPUT"},It=function(e){return Ae(e)&&e.type==="hidden"},Tt=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pt=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},At=function(e){if(!e.name)return!0;var t=e.form||J(e),o=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Pt(r,e.form);return!s||s===e},Nt=function(e){return Ae(e)&&e.type==="radio"},Dt=function(e){return Nt(e)&&!At(e)},Mt=function(e){var t,o=e&&J(e),r=(t=o)===null||t===void 0?void 0:t.host,s=!1;if(o&&o!==e){var i,a,l;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var c,d,u;o=J(r),r=(c=o)===null||c===void 0?void 0:c.host,s=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return s},ge=function(e){var t=e.getBoundingClientRect(),o=t.width,r=t.height;return o===0&&r===0},Ot=function(e,t){var o=t.displayCheck,r=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=G.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(G.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var c=e.parentElement,d=J(e);if(c&&!c.shadowRoot&&r(c)===!0)return ge(e);e.assignedSlot?e=e.assignedSlot:!c&&d!==e.ownerDocument?e=d.host:e=c}e=l}if(Mt(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return ge(e);return!1},Ft=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var r=t.children.item(o);if(r.tagName==="LEGEND")return G.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},qt=function(e,t){return!(t.disabled||It(t)||Ot(t,e)||Tt(t)||Ft(t))},me=function(e,t){return!(Dt(t)||Pe(t)<0||!qt(e,t))},$t=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ne=function(e){var t=[],o=[];return e.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=wt(a,i),c=i?Ne(r.candidates):a;l===0?i?t.push.apply(t,c):t.push(a):o.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:c})}),o.sort(Ct).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},De=function(e,t){t=t||{};var o;return t.getShadowRoot?o=le([e],t.includeContainer,{filter:me.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$t}):o=Et(e,t.includeContainer,me.bind(null,t)),Ne(o)};function kt(){return/apple/i.test(navigator.vendor)}const pe="data-floating-ui-focusable";function _t(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function ce(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&Je(t)){let o=e;for(;o;){if(n===o)return!0;o=o.parentNode||o.host}}return!1}function z(n){return"composedPath"in n?n.composedPath()[0]:n.target}function oe(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function Lt(n){return n.matches("html,body")}function Q(n){return n?.ownerDocument||document}function jt(n){return n?n.hasAttribute(pe)?n:n.querySelector("["+pe+"]")||n:null}function Z(n,e,t){return t===void 0&&(t=!0),n.filter(r=>{var s;return r.parentId===e&&(!t||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Z(n,r.id,t)])}function Kt(n){return"nativeEvent"in n}var Bt=typeof document<"u",Ut=function(){},V=Bt?p.useLayoutEffect:Ut;const Vt={...we},Wt=Vt.useInsertionEffect,Xt=Wt||(n=>n());function W(n){const e=p.useRef(()=>{});return Xt(()=>{e.current=n}),p.useCallback(function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const Me=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(n,e){const t=De(n,Me()),o=t.length;if(o===0)return;const r=_t(Q(n)),s=t.indexOf(r),i=s===-1?e===1?0:o-1:s+e;return t[i]}function Ht(n){return Oe(Q(n).body,1)||n}function Yt(n){return Oe(Q(n).body,-1)||n}function re(n,e){const t=e||n.currentTarget,o=n.relatedTarget;return!o||!ce(t,o)}function zt(n){De(n,Me()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function ve(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const o=t.dataset.tabindex;delete t.dataset.tabindex,o?t.setAttribute("tabindex",o):t.removeAttribute("tabindex")})}const Gt="data-floating-ui-focusable",he="active",be="selected",Qt={...we};let xe=!1,Zt=0;const ye=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zt++;function Jt(){const[n,e]=p.useState(()=>xe?ye():void 0);return V(()=>{n==null&&e(ye())},[]),p.useEffect(()=>{xe=!0},[]),n}const en=Qt.useId,ue=en||Jt;function tn(){const n=new Map;return{emit(e,t){var o;(o=n.get(e))==null||o.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var o;(o=n.get(e))==null||o.delete(t)}}}const nn=p.createContext(null),on=p.createContext(null),Fe=()=>{var n;return((n=p.useContext(nn))==null?void 0:n.id)||null},qe=()=>p.useContext(on);function de(n){return"data-floating-ui-"+n}const rn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Re=p.forwardRef(function(e,t){const[o,r]=p.useState();V(()=>{kt()&&r("button")},[]);const s={ref:t,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[de("focus-guard")]:"",style:rn};return I.jsx("span",{...e,...s})}),sn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$e=p.createContext(null),Se=de("portal");function an(n){n===void 0&&(n={});const{id:e,root:t}=n,o=ue(),r=cn(),[s,i]=p.useState(null),a=p.useRef(null);return V(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),V(()=>{if(!o||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=o,c.setAttribute(Se,""),l.appendChild(c),a.current=c,i(c)},[e,o]),V(()=>{if(t===null||!o||a.current)return;let l=t||r?.portalNode;l&&!it(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=o,d.setAttribute(Se,""),l=c||l,l.appendChild(d),a.current=d,i(d)},[e,t,o,r]),s}function ln(n){const{children:e,id:t,root:o,preserveTabOrder:r=!0}=n,s=an({id:t,root:o}),[i,a]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),g=i?.modal,h=i?.open,y=!!i&&!i.modal&&i.open&&r&&!!(o||s);return p.useEffect(()=>{if(!s||!r||g)return;function m(f){s&&re(f)&&(f.type==="focusin"?ve:zt)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,r,g]),p.useEffect(()=>{s&&(h||ve(s))},[h,s]),I.jsxs($e.Provider,{value:p.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:s,setFocusManagerState:a}),[r,s]),children:[y&&s&&I.jsx(Re,{"data-type":"outside",ref:l,onFocus:m=>{if(re(m,s)){var f;(f=d.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Yt(x);b?.focus()}}}),y&&s&&I.jsx("span",{"aria-owns":s.id,style:sn}),s&&tt.createPortal(e,s),y&&s&&I.jsx(Re,{"data-type":"outside",ref:c,onFocus:m=>{if(re(m,s)){var f;(f=u.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Ht(x);b?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const cn=()=>p.useContext($e),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ee=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n?.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n?.outsidePress)!=null?t:!0}};function fn(n,e){e===void 0&&(e={});const{open:t,onOpenChange:o,elements:r,dataRef:s}=n,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:u="pointerdown",ancestorScroll:g=!1,bubbles:h,capture:y}=e,m=qe(),f=W(typeof l=="function"?l:()=>!1),x=typeof l=="function"?f:l,b=p.useRef(!1),{escapeKey:R,outsidePress:v}=Ee(h),{escapeKey:D,outsidePress:C}=Ee(y),O=p.useRef(!1),A=W(S=>{var E;if(!t||!i||!a||S.key!=="Escape"||O.current)return;const P=(E=s.current.floatingContext)==null?void 0:E.nodeId,M=m?Z(m.nodesRef.current,P):[];if(!R&&(S.stopPropagation(),M.length>0)){let w=!0;if(M.forEach(N=>{var q;if((q=N.context)!=null&&q.open&&!N.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}o(!1,Kt(S)?S.nativeEvent:S,"escape-key")}),F=W(S=>{var E;const P=()=>{var M;A(S),(M=z(S))==null||M.removeEventListener("keydown",P)};(E=z(S))==null||E.addEventListener("keydown",P)}),T=W(S=>{var E;const P=s.current.insideReactTree;s.current.insideReactTree=!1;const M=b.current;if(b.current=!1,c==="click"&&M||P||typeof x=="function"&&!x(S))return;const w=z(S),N="["+de("inert")+"]",q=Q(r.floating).querySelectorAll(N);let L=j(w)?w:null;for(;L&&!ne(L);){const k=ot(L);if(ne(k)||!j(k))break;L=k}if(q.length&&j(w)&&!Lt(w)&&!ce(w,r.floating)&&Array.from(q).every(k=>!ce(L,k)))return;if(rt(w)&&K){const k=ne(w),B=st(w),Y=/auto|scroll/,Ke=k||Y.test(B.overflowX),Be=k||Y.test(B.overflowY),Ue=Ke&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=Be&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,We=B.direction==="rtl",Xe=Ve&&(We?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),He=Ue&&S.offsetY>w.clientHeight;if(Xe||He)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,H=m&&Z(m.nodesRef.current,U).some(k=>{var B;return oe(S,(B=k.context)==null?void 0:B.elements.floating)});if(oe(S,r.floating)||oe(S,r.domReference)||H)return;const fe=m?Z(m.nodesRef.current,U):[];if(fe.length>0){let k=!0;if(fe.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){k=!1;return}}),!k)return}o(!1,S,"outside-press")}),$=W(S=>{var E;const P=()=>{var M;T(S),(M=z(S))==null||M.removeEventListener(c,P)};(E=z(S))==null||E.addEventListener(c,P)});p.useEffect(()=>{if(!t||!i)return;s.current.__escapeKeyBubbles=R,s.current.__outsidePressBubbles=v;let S=-1;function E(q){o(!1,q,"ancestor-scroll")}function P(){window.clearTimeout(S),O.current=!0}function M(){S=window.setTimeout(()=>{O.current=!1},nt()?5:0)}const w=Q(r.floating);a&&(w.addEventListener("keydown",D?F:A,D),w.addEventListener("compositionstart",P),w.addEventListener("compositionend",M)),x&&w.addEventListener(c,C?$:T,C);let N=[];return g&&(j(r.domReference)&&(N=te(r.domReference)),j(r.floating)&&(N=N.concat(te(r.floating))),!j(r.reference)&&r.reference&&r.reference.contextElement&&(N=N.concat(te(r.reference.contextElement)))),N=N.filter(q=>{var L;return q!==((L=w.defaultView)==null?void 0:L.visualViewport)}),N.forEach(q=>{q.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(w.removeEventListener("keydown",D?F:A,D),w.removeEventListener("compositionstart",P),w.removeEventListener("compositionend",M)),x&&w.removeEventListener(c,C?$:T,C),N.forEach(q=>{q.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,r,a,x,c,t,o,g,i,R,v,A,D,F,T,C,$]),p.useEffect(()=>{s.current.insideReactTree=!1},[s,x,c]);const _=p.useMemo(()=>({onKeyDown:A,...d&&{[un[u]]:S=>{o(!1,S.nativeEvent,"reference-press")},...u!=="click"&&{onClick(S){o(!1,S.nativeEvent,"reference-press")}}}}),[A,o,d,u]),K=p.useMemo(()=>{function S(E){E.button===0&&(b.current=!0)}return{onKeyDown:A,onMouseDown:S,onMouseUp:S,[dn[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return p.useMemo(()=>i?{reference:_,floating:K}:{},[i,_,K])}function gn(n){const{open:e=!1,onOpenChange:t,elements:o}=n,r=ue(),s=p.useRef({}),[i]=p.useState(()=>tn()),a=Fe()!=null,[l,c]=p.useState(o.reference),d=W((h,y,m)=>{s.current.openEvent=h?y:void 0,i.emit("openchange",{open:h,event:y,reason:m,nested:a}),t?.(h,y,m)}),u=p.useMemo(()=>({setPositionReference:c}),[]),g=p.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return p.useMemo(()=>({dataRef:s,open:e,onOpenChange:d,elements:g,events:i,floatingId:r,refs:u}),[e,d,g,i,r,u])}function mn(n){n===void 0&&(n={});const{nodeId:e}=n,t=gn({...n,elements:{reference:null,floating:null,...n.elements}}),o=n.rootContext||t,r=o.elements,[s,i]=p.useState(null),[a,l]=p.useState(null),d=r?.domReference||s,u=p.useRef(null),g=qe();V(()=>{d&&(u.current=d)},[d]);const h=et({...n,elements:{...r,...a&&{reference:a}}}),y=p.useCallback(R=>{const v=j(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(v),h.refs.setReference(v)},[h.refs]),m=p.useCallback(R=>{(j(R)||R===null)&&(u.current=R,i(R)),(j(h.refs.reference.current)||h.refs.reference.current===null||R!==null&&!j(R))&&h.refs.setReference(R)},[h.refs]),f=p.useMemo(()=>({...h.refs,setReference:m,setPositionReference:y,domReference:u}),[h.refs,m,y]),x=p.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=p.useMemo(()=>({...h,...o,refs:f,elements:x,nodeId:e}),[h,f,x,e,o]);return V(()=>{o.dataRef.current.floatingContext=b;const R=g?.nodesRef.current.find(v=>v.id===e);R&&(R.context=b)}),p.useMemo(()=>({...h,context:b,refs:f,elements:x}),[h,f,x,b])}function se(n,e,t){const o=new Map,r=t==="item";let s=n;if(r&&n){const{[he]:i,[be]:a,...l}=n;s=l}return{...t==="floating"&&{tabIndex:-1,[Gt]:""},...s,...e.map(i=>{const a=i?i[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(r&&[he,be].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof d=="function"){var u;(u=o.get(c))==null||u.push(d),i[c]=function(){for(var g,h=arguments.length,y=new Array(h),m=0;m<h;m++)y[m]=arguments[m];return(g=o.get(c))==null?void 0:g.map(f=>f(...y)).find(f=>f!==void 0)}}}else i[c]=d}),i),{})}}function pn(n){n===void 0&&(n=[]);const e=n.map(a=>a?.reference),t=n.map(a=>a?.floating),o=n.map(a=>a?.item),r=p.useCallback(a=>se(a,n,"reference"),e),s=p.useCallback(a=>se(a,n,"floating"),t),i=p.useCallback(a=>se(a,n,"item"),o);return p.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(n,e){var t,o;e===void 0&&(e={});const{open:r,elements:s,floatingId:i}=n,{enabled:a=!0,role:l="dialog"}=e,c=ue(),d=((t=s.domReference)==null?void 0:t.id)||c,u=p.useMemo(()=>{var b;return((b=jt(s.floating))==null?void 0:b.id)||i},[s.floating,i]),g=(o=vn.get(l))!=null?o:l,y=Fe()!=null,m=p.useMemo(()=>g==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":g==="alertdialog"?"dialog":g,"aria-controls":r?u:void 0,...g==="listbox"&&{role:"combobox"},...g==="menu"&&{id:d},...g==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,u,y,r,d,l]),f=p.useMemo(()=>{const b={id:u,...g&&{role:g}};return g==="tooltip"||l==="label"?b:{...b,...g==="menu"&&{"aria-labelledby":d}}},[g,u,d,l]),x=p.useCallback(b=>{let{active:R,selected:v}=b;const D={role:"option",...R&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...D,"aria-selected":v}}return{}},[u,l]);return p.useMemo(()=>a?{reference:m,floating:f,item:x}:{},[a,m,f,x])}function bn(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:a}=n,l=o&&!r,c=Ze(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",g=r?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const m=a.pos-y.length,f=Array.from(y.matchAll(h)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const x=f.input.slice(Math.max(0,f.index-1),f.index),b=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!b)return null;const R=m+f.index;let v=R+f[0].length;return l&&d.test(y.slice(v-1,v+1))&&(f[0]+=" ",v+=1),R<a.pos&&v>=a.pos?{range:{from:R,to:v},query:f[0].slice(t.length),text:f[0]}:null}function xn(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const o=t.content.textBetween(0,t.content.size,`
2
+ `);return/\s/.test(o)}):!1}function yn(n){return()=>{const e=n.state.selection.$anchor.pos,{top:t,right:o,bottom:r,left:s}=n.view.coordsAtPos(e);try{return new DOMRect(s,t,o-s,r-t)}catch{return null}}}function Rn(n,e,t,o){return t?()=>{const r=o.getState(n.state),s=r?.decorationId,i=e.dom.querySelector(`[data-decoration-id="${s}"]`);return i?.getBoundingClientRect()||null}:yn(n)}function Sn({match:n,dismissedRange:e,state:t,transaction:o,editor:r,shouldResetDismissed:s,effectiveAllowSpaces:i}){return s?.({editor:r,state:t,range:e,match:n,transaction:o,allowSpaces:i})?!1:i?n.range.from===e.from:n.range.from===e.from&&!xn(o)}function En({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function wn({pluginKey:n,decorationTag:e,decorationClass:t,decorationContent:o,decorationEmptyClass:r,renderer:s,dispatchExit:i}){return{handleKeyDown(a,l){var c;const d=n.getState(a.state);if(!d.active)return!1;if(l.key==="Escape"||l.key==="Esc"){var u;return s==null||(u=s.onKeyDown)===null||u===void 0||u.call(s,{view:a,event:l,range:d.range}),i(a),!0}return(s==null||(c=s.onKeyDown)===null||c===void 0?void 0:c.call(s,{view:a,event:l,range:d.range}))||!1},decorations(a){const{active:l,range:c,decorationId:d,query:u}=n.getState(a);if(!l)return null;const g=!u?.length,h=[t];return g&&h.push(r),Ge.create(a.doc,[Qe.inline(c.from,c.to,{nodeName:e,class:h.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":o})])}}}function Cn({editor:n,char:e,effectiveAllowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,findSuggestionMatch:i,allow:a,shouldShow:l,shouldKeepDismissed:c,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(u,g,h,y){const{isEditable:m}=n,{composing:f}=n.view,{selection:x}=u,{empty:b,from:R}=x,v={...g},D=u.getMeta(d);if(D&&D.exit)return v.active=!1,v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null,v.dismissedRange=g.active?{...g.range}:g.dismissedRange,v;if(v.composing=f,u.docChanged&&v.dismissedRange!==null&&(v.dismissedRange={from:u.mapping.map(v.dismissedRange.from),to:u.mapping.map(v.dismissedRange.to)}),m&&(b||n.view.composing)){(R<g.range.from||R>g.range.to)&&!f&&!g.composing&&(v.active=!1);const C=i({char:e,allowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,$position:x.$from}),O=`id_${Math.floor(Math.random()*4294967295)}`;C&&a({editor:n,state:y,range:C.range,isActive:g.active})&&(!l||l({editor:n,range:C.range,query:C.query,text:C.text,transaction:u}))?(v.dismissedRange!==null&&!c({match:C,dismissedRange:v.dismissedRange,state:y,transaction:u})&&(v.dismissedRange=null),v.dismissedRange===null?(v.active=!0,v.decorationId=g.decorationId||O,v.range=C.range,v.query=C.query,v.text=C.text):v.active=!1):(C||(v.dismissedRange=null),v.active=!1)}else v.active=!1;return v.active||(v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null),v}}}function In({editor:n,items:e}){let t=null,o=null,r=null;const s=()=>{o!==null&&(clearTimeout(o),o=null),r?.(),r=null},i=c=>new Promise(d=>{r=d,o=setTimeout(()=>{o=null;const u=r;r=null,u?.()},c)}),a=()=>{t?.abort(),s(),t=null};return{abort:a,fetch:async(c,d)=>{a(),t=new AbortController;const u=t;if(d>0&&await i(d),t!==u||u.signal.aborted)return{status:"aborted"};try{const g=await e({editor:n,query:c,signal:u.signal});return t!==u||u.signal.aborted?{status:"aborted"}:{status:"resolved",items:g}}catch{return t!==u||u.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function Tn({placement:n,offset:e,flip:t,floatingUi:o}){var r,s,i,a;const l=[at({mainAxis:(r=e.mainAxis)!==null&&r!==void 0?r:4,crossAxis:(s=e.crossAxis)!==null&&s!==void 0?s:0})];return t&&l.push(lt()),!(o==null||(i=o.middleware)===null||i===void 0)&&i.length&&l.push(...o.middleware),{placement:n,strategy:(a=o?.strategy)!==null&&a!==void 0?a:"absolute",middleware:l}}function Pn(n){if(n instanceof HTMLElement)return n;if(typeof n=="string")try{const e=document.querySelector(n);if(e)return e}catch{return document.body}return document.body}function An({getReferenceRect:n,contextElement:e,config:t,container:o,dismissOnOutsideClick:r,dismiss:s}){return(i,a={})=>{const l={getBoundingClientRect:()=>{var y;return(y=n())!==null&&y!==void 0?y:new DOMRect},contextElement:e};let c=!1;const d=!i.isConnected;d&&Pn(o).appendChild(i),a.onPosition||(i.style.visibility="hidden",i.style.width="max-content");const g=Ce(l,i,()=>{ct(l,i,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:y,y:m,placement:f,strategy:x})=>{if(a.onPosition){a.onPosition({x:y,y:m,placement:f,strategy:x});return}Object.assign(i.style,{position:x,left:`${y}px`,top:`${m}px`}),c||(c=!0,i.style.visibility="")})},a.autoUpdate);let h;return r&&(h=y=>{const m=y.target;!(m instanceof Node)||i.contains(m)||e.contains(m)||s()},document.addEventListener("pointerdown",h,!0)),()=>{g(),h&&document.removeEventListener("pointerdown",h,!0),d&&i.remove()}}}function Nn({editor:n,pluginKey:e,items:t,renderer:o,minQueryLength:r,debounce:s,initialItems:i,placement:a,offset:l,container:c,flip:d,floatingUi:u,dismissOnOutsideClick:g,command:h,clientRectFor:y,dispatchExit:m}){let f;const x=In({editor:n,items:t}),b=Tn({placement:a,offset:l,flip:d,floatingUi:u});function R(v,D){switch(v){case"started":var C;o==null||(C=o.onStart)===null||C===void 0||C.call(o,D);break;case"updated":var O;o==null||(O=o.onUpdate)===null||O===void 0||O.call(o,D);break;case"stopped":var A;o==null||(A=o.onExit)===null||A===void 0||A.call(o,D)}}return{update:async(v,D)=>{var C,O;const A=e.getState(D),F=e.getState(v.state);if(!A||!F)return;let T=null;const $=A.query!==F.query,_=A.text!==F.text,K=A.range.from!==F.range.from||A.range.to!==F.range.to,S=$||_||K;if(!A.active&&F.active)T="started";else if(A.active&&!F.active)T="stopped";else if(F.active&&S)T="updated";else return;const E=T==="stopped"?A:F,P=v.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`),M=y(v,P),w=r===0||(E.query?E.query.length>=r:!1),N=(T==="started"||T==="updated")&&w;if(f={editor:n,range:E.range,query:E.query||"",text:E.text||"",items:i??[],command:U=>h({editor:n,range:E.range,props:U}),decorationNode:P,clientRect:M,loading:N,placement:a,offset:{mainAxis:(C=l.mainAxis)!==null&&C!==void 0?C:4,crossAxis:(O=l.crossAxis)!==null&&O!==void 0?O:0},container:c,flip:d,floatingUi:b,mount:An({getReferenceRect:M,contextElement:v.dom,config:b,container:c,dismissOnOutsideClick:g,dismiss:()=>m(n.view)})},T==="started"){var q;o==null||(q=o.onBeforeStart)===null||q===void 0||q.call(o,f)}if(T==="updated"){var L;o==null||(L=o.onBeforeUpdate)===null||L===void 0||L.call(o,f)}if(T==="started"&&R(T,f),T==="started"||T==="updated")if(!N)x.abort(),f={...f,items:i??[],loading:!1};else{f={...f,items:i??[],loading:!0},T="updated",R(T,f);const U=await x.fetch(E.query||"",s);if(U.status==="aborted")return;const H=e.getState(v.state);if(!H?.active){x.abort();return}f=U.status==="resolved"?{...f,items:U.items,loading:!1}:{...f,loading:!1}}if(T==="stopped"){x.abort(),R(T,f),f=void 0;return}T==="updated"&&R(T,f)},destroy:()=>{var v;x.abort(),f&&(o==null||(v=o.onExit)===null||v===void 0||v.call(o,f))}}}const ke=new ie("suggestion");function _e({pluginKey:n=ke,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:g=()=>[],minQueryLength:h=0,debounce:y=0,initialItems:m,placement:f="bottom-start",offset:x={},container:b,flip:R=!0,floatingUi:v,dismissOnOutsideClick:D=!0,render:C=()=>({}),allow:O=()=>!0,findSuggestionMatch:A=bn,shouldShow:F,shouldResetDismissed:T}){const $=C?.(),_=o&&!r,K=(P,M)=>Rn(e,P,M,n);function S(P){return Sn({...P,editor:e,shouldResetDismissed:T,effectiveAllowSpaces:_})}const E=P=>En({view:P,pluginKeyRef:n});return new ze({key:n,view:()=>Nn({editor:e,pluginKey:n,items:g,renderer:$,minQueryLength:h,debounce:y,initialItems:m,placement:f,offset:x,container:b,flip:R,floatingUi:v,dismissOnOutsideClick:D,command:u,clientRectFor:K,dispatchExit:E}),state:Cn({editor:e,char:t,effectiveAllowSpaces:_,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,findSuggestionMatch:A,allow:O,shouldShow:F,shouldKeepDismissed:S,pluginKey:n}),props:wn({pluginKey:n,decorationTag:a,decorationClass:l,decorationContent:c,decorationEmptyClass:d,renderer:$,dispatchExit:E})})}function Hn(n,e=ke){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}var Yn=_e;function Dn(n){const e=X.c(17),{editor:t,query:o,items:r,onSelect:s,onClose:i}=n,[a,l]=p.useState(0),c=p.useRef(r),d=p.useRef(a),u=p.useRef(s),g=p.useRef(i),h=p.useDeferredValue(o),[y,m]=p.useState(h);y!==h&&(m(h),l(0)),a>=r.length&&r.length>0&&l(0);let f,x;e[0]!==r?(f=()=>{c.current=r},x=[r],e[0]=r,e[1]=f,e[2]=x):(f=e[1],x=e[2]),p.useEffect(f,x);let b,R;e[3]!==a?(b=()=>{d.current=a},R=[a],e[3]=a,e[4]=b,e[5]=R):(b=e[4],R=e[5]),p.useEffect(b,R);let v,D;e[6]!==s?(v=()=>{u.current=s},D=[s],e[6]=s,e[7]=v,e[8]=D):(v=e[7],D=e[8]),p.useEffect(v,D);let C,O;e[9]!==i?(C=()=>{g.current=i},O=[i],e[9]=i,e[10]=C,e[11]=O):(C=e[10],O=e[11]),p.useEffect(C,O);let A,F;e[12]!==t?(F=()=>{if(t?.isDestroyed)return;let _;try{_=t.view.dom}catch{return}if(!_)return;const K=E=>{const P=c.current;if(!P.length)return!1;const M=()=>l(N=>(N+1)%P.length),w=()=>l(N=>(N-1+P.length)%P.length);switch(E.key){case"ArrowUp":return E.preventDefault(),w(),!0;case"ArrowDown":return E.preventDefault(),M(),!0;case"Tab":return E.preventDefault(),E.shiftKey?w():M(),!0;case"Home":return E.preventDefault(),l(0),!0;case"End":return E.preventDefault(),l(P.length-1),!0;case"Enter":{if(E.isComposing)return!1;E.preventDefault();const N=d.current;return N!==-1&&P[N]&&u.current?.(P[N],N),!0}case"Escape":return E.preventDefault(),g.current?.(),!0;default:return!1}},S=E=>{K(E)};return _.addEventListener("keydown",S,!0),()=>{_?.removeEventListener("keydown",S,!0)}},A=[t],e[12]=t,e[13]=A,e[14]=F):(A=e[13],F=e[14]),p.useEffect(F,A);const T=r.length?a:void 0;let $;return e[15]!==T?($={selectedIndex:T,setSelectedIndex:l},e[15]=T,e[16]=$):$=e[16],$}function Mn(n,e){switch(e.type){case"SET_SELECTED_ITEM":return{...n,selectedItem:e.payload};case"ON_START":return{...n,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...n,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return n}}const Le=p.createContext(void 0);function je(){const n=p.useContext(Le);if(!n)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return n}function On(n){const e=X.c(16),{editor:t,char:o,pluginKey:r,allow:s,onOpenChange:i}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[l,c]=p.useReducer(Mn,a);let d;e[1]!==i?(d=m=>{i?.(m)},e[1]=i,e[2]=d):d=e[2];const u=p.useEffectEvent(d);let g;e[3]!==o||e[4]!==s||e[5]!==t||e[6]!==u||e[7]!==r?(g=()=>{if(t?.isDestroyed)return;const m=r instanceof ie?r:new ie(r);t.state.plugins.find(b=>b.spec.key===m)&&t.unregisterPlugin(m);const x=_e({pluginKey:m,editor:t,char:o,allow(b){const R=t.state.doc.resolve(b.range.from);for(let v=R.depth;v>0;v--)if(R.node(v).type.name==="image")return!1;return!(s&&!s(b))},command(){},render:()=>({onStart:b=>{c({type:"ON_START",payload:{element:b.decorationNode??null,query:b.query,range:b.range}}),u(!0)},onUpdate:b=>{c({type:"ON_UPDATE",payload:{element:b.decorationNode??null,query:b.query,range:b.range}})},onKeyDown:b=>b.event.key==="Escape"?(c({type:"ON_EXIT"}),!0):!1,onExit:()=>{c({type:"ON_EXIT"}),u(!1)}}),items:Fn});return t.registerPlugin(x),()=>{t?.isDestroyed||t.unregisterPlugin(m)}},e[3]=o,e[4]=s,e[5]=t,e[6]=u,e[7]=r,e[8]=g):g=e[8];let h;e[9]!==o||e[10]!==s||e[11]!==t||e[12]!==r?(h=[t,r,o,c,s],e[9]=o,e[10]=s,e[11]=t,e[12]=r,e[13]=h):h=e[13],p.useEffect(g,h);let y;return e[14]!==l?(y={state:l,dispatch:c},e[14]=l,e[15]=y):y=e[15],y}function Fn(){return[]}function qn({editor:n,queryKey:e,queryFn:t,onSelect:o}){const{state:r,dispatch:s}=je(),i=p.useDeferredValue(r.query),{data:a}=ut({queryKey:dt.suggestionItems(e,r.open,i),queryFn:()=>r.open?t({query:i}):[]}),l=()=>{s({type:"ON_EXIT"})},c=async(u,g)=>{if(!(r.selectedItem!==null||!r.range)){s({type:"SET_SELECTED_ITEM",payload:u});try{const{view:h}=n,m=h.state.selection.$to.nodeAfter?.text?.startsWith(" "),f=r.range?{...r.range}:{from:0,to:0};m&&r.range&&(f.to+=1),await o({range:f,item:u})===!1?s({type:"SET_SELECTED_ITEM",payload:null}):l()}catch{l()}}},{selectedIndex:d}=Dn({editor:n,query:i,items:a,onSelect:c,onClose:l});return{selectedItem:r.selectedItem,items:a,selectedIndex:d,close:l,onSelect:c}}function $n({children:n}){const{state:e,dispatch:t}=je(),{open:o,element:r}=e,s=()=>{t({type:"ON_EXIT"})},{refs:i,floatingStyles:a,context:l}=mn({placement:"bottom-start",open:o,onOpenChange:g=>{g||s()},elements:{reference:r},middleware:[ft(10),gt(),mt()],whileElementsMounted:Ce}),c=fn(l,{outsidePress:g=>!(g.target instanceof Element&&g.target.closest(".ProseMirror"))}),d=hn(l,{role:"listbox"}),{getFloatingProps:u}=pn([c,d]);return o?I.jsx(ln,{children:I.jsx("div",{ref:i.setFloating,style:a,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-soft outline-hidden overflow-hidden",children:n})}):null}const kn=n=>{const e=X.c(17),{item:t,isSelected:o,onSelect:r,isLoading:s,ref:i,renderItem:a}=n;let l;if(e[0]!==t){const x=bt(t._meta);l=t.title||xt(t.name,x),e[0]=t,e[1]=l}else l=e[1];const c=l,d=t.description||null,u=t.icon,g=o&&"bg-accent text-accent-foreground",h=s&&"pointer-events-none opacity-50";let y;e[2]!==g||e[3]!==h?(y=vt("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",g,h),e[2]=g,e[3]=h,e[4]=y):y=e[4];let m;e[5]!==d||e[6]!==u||e[7]!==s||e[8]!==t||e[9]!==c||e[10]!==a?(m=a?a(t):I.jsxs(I.Fragment,{children:[u!==void 0&&I.jsx(yt,{icon:u,name:c,size:"xs",className:"mr-2"}),I.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[I.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),s&&I.jsx(ht,{size:"xs"})]}),d&&I.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d})]}),t.drillable&&I.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-2xs font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"})]}),e[5]=d,e[6]=u,e[7]=s,e[8]=t,e[9]=c,e[10]=a,e[11]=m):m=e[11];let f;return e[12]!==r||e[13]!==i||e[14]!==y||e[15]!==m?(f=I.jsx("div",{ref:i,onClick:r,className:y,children:m}),e[12]=r,e[13]=i,e[14]=y,e[15]=m,e[16]=f):f=e[16],f},_n=n=>{const e=X.c(24),{editor:t,queryKey:o,queryFn:r,onSelect:s,renderItem:i,emptyLabel:a}=n,l=pt();let c;e[0]!==t||e[1]!==s||e[2]!==r||e[3]!==o?(c={editor:t,queryKey:o,queryFn:r,onSelect:s},e[0]=t,e[1]=s,e[2]=r,e[3]=o,e[4]=c):c=e[4];const{items:d,selectedIndex:u,onSelect:g,selectedItem:h}=qn(c);if(!d.length){let x;e[5]!==a||e[6]!==l?(x=a??l("chat.mention.noItemsFound"),e[5]=a,e[6]=l,e[7]=x):x=e[7];let b;return e[8]!==x?(b=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-soft p-3 text-sm",children:x}),e[8]=x,e[9]=b):b=e[9],b}let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[10]=y):y=e[10];let m;if(e[11]!==g||e[12]!==d||e[13]!==i||e[14]!==u||e[15]!==h?.name){let x;e[17]!==g||e[18]!==i||e[19]!==u||e[20]!==h?.name?(x=(b,R)=>I.jsx(kn,{item:b,isSelected:R===u,ref:R===u?Kn:void 0,onSelect:()=>g(b,R),isLoading:h?.name===b.name,renderItem:i},`${b.kind??"item"}:${b.name}`),e[17]=g,e[18]=i,e[19]=u,e[20]=h?.name,e[21]=x):x=e[21],m=d.map(x),e[11]=g,e[12]=d,e[13]=i,e[14]=u,e[15]=h?.name,e[16]=m}else m=e[16];let f;return e[22]!==m?(f=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:y,children:I.jsx("div",{className:"p-1",children:m})}),e[22]=m,e[23]=f):f=e[23],f};function Ln(){const n=X.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=I.jsx("div",{className:"p-1",children:[...Array(3)].map(jn)}),n[0]=e):e=n[0],e}function jn(n,e){return I.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[I.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),I.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function zn(n){const e=X.c(20),{editor:t,char:o,pluginKey:r,queryKey:s,queryFn:i,onSelect:a,allow:l,onOpenChange:c,renderItem:d,emptyLabel:u}=n;let g;e[0]!==l||e[1]!==o||e[2]!==t||e[3]!==c||e[4]!==r?(g={editor:t,char:o,pluginKey:r,allow:l,onOpenChange:c},e[0]=l,e[1]=o,e[2]=t,e[3]=c,e[4]=r,e[5]=g):g=e[5];const{state:h,dispatch:y}=On(g);let m;e[6]!==y||e[7]!==h?(m={state:h,dispatch:y},e[6]=y,e[7]=h,e[8]=m):m=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=I.jsx(Ln,{}),e[9]=f):f=e[9];let x;e[10]!==t||e[11]!==u||e[12]!==a||e[13]!==i||e[14]!==s||e[15]!==d?(x=I.jsx($n,{children:I.jsx(p.Suspense,{fallback:f,children:I.jsx(_n,{editor:t,queryKey:s,queryFn:i,onSelect:a,renderItem:d,emptyLabel:u})})}),e[10]=t,e[11]=u,e[12]=a,e[13]=i,e[14]=s,e[15]=d,e[16]=x):x=e[16];let b;return e[17]!==m||e[18]!==x?(b=I.jsx(Le.Provider,{value:m,children:x}),e[17]=m,e[18]=x,e[19]=b):b=e[19],b}function Kn(n){n&&n.scrollIntoView({block:"center",behavior:"smooth"})}export{zn as S,Yn as a,Hn as e,Xn as s};
@@ -1 +1 @@
1
- import{c as l,m as a,j as m,gM as u}from"./index-Dd5hidCj.js";function p(r){const e=l.c(8),{size:n,className:c}=r,t=n===void 0?16:n;let s;e[0]!==t?(s={width:t,height:t},e[0]=t,e[1]=s):s=e[1];let i;e[2]!==c?(i=a("shrink-0 rounded-full object-cover",c),e[2]=c,e[3]=i):i=e[3];let o;return e[4]!==t||e[5]!==s||e[6]!==i?(o=m.jsx("img",{src:u,alt:"Super Agent",width:t,height:t,style:s,className:i}),e[4]=t,e[5]=s,e[6]=i,e[7]=o):o=e[7],o}export{p as S};
1
+ import{c as l,m as a,j as m,gU as u}from"./index-5IFWC0PS.js";function p(r){const e=l.c(8),{size:n,className:c}=r,t=n===void 0?16:n;let s;e[0]!==t?(s={width:t,height:t},e[0]=t,e[1]=s):s=e[1];let i;e[2]!==c?(i=a("shrink-0 rounded-full object-cover",c),e[2]=c,e[3]=i):i=e[3];let o;return e[4]!==t||e[5]!==s||e[6]!==i?(o=m.jsx("img",{src:u,alt:"Super Agent",width:t,height:t,style:s,className:i}),e[4]=t,e[5]=s,e[6]=i,e[7]=o):o=e[7],o}export{p as S};