decocms 4.562.2 → 4.563.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (437) hide show
  1. package/dist/client/assets/{AlertCircle-BPGyk76P.js → AlertCircle-CzNhPAKr.js} +1 -1
  2. package/dist/client/assets/{AreaChart-Dwi8bZZ1.js → AreaChart-jXN8ob1W.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DRdw9Nza.js → ArrowLeft-BZrvcUxe.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-BJTv4ddc.js → ArrowUp-BmvC0gDN.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-DHyrpR7F.js → CartesianChart-Dr9bA6s0.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-CVu6TY4_.js → CategoricalChart-Db8BeNXp.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-y3P873c6.js → CheckCircle-BfgWRJx4.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-TIONA5Zl.js → ChevronSelectorVertical-Dk3Ic8_G.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CDe5Gfov.js → ChevronUp-CslLufEI.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-abk_vBBR.js → CreditCard01-DKR27XQP.js} +1 -1
  11. package/dist/client/assets/{Globe04-Dr1jk8eS.js → Globe04-DD-_PtpP.js} +1 -1
  12. package/dist/client/assets/{Key01-DzZgIVqE.js → Key01-CNesFlbK.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-4j6Z2AOF.js → LinkBroken01-K7vV_sRk.js} +1 -1
  14. package/dist/client/assets/{Minus-B2u_zm0f.js → Minus-DeqVl1Xe.js} +1 -1
  15. package/dist/client/assets/{Monitor01-DWylBoOJ.js → Monitor01-Bx36gCte.js} +1 -1
  16. package/dist/client/assets/{Play-CV8_Sy8a.js → Play-CkRBFbju.js} +1 -1
  17. package/dist/client/assets/{Plus-BtfY7EHX.js → Plus-DtM4w8bA.js} +1 -1
  18. package/dist/client/assets/ReferenceLine-38pFjaQt.js +1 -0
  19. package/dist/client/assets/{SearchMd-DD6kw-fs.js → SearchMd-Bbg1gFfR.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-CY137tVP.js → ShoppingBag01-DW9ACSlI.js} +1 -1
  21. package/dist/client/assets/{Sun-CyYLfv8E.js → Sun-DUSHragw.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-C3qdjyVX.js → SwitchHorizontal01-BCe-gFOc.js} +1 -1
  23. package/dist/client/assets/{Tool01-CyX9Nllj.js → Tool01-snML4pPn.js} +1 -1
  24. package/dist/client/assets/{Tooltip-DVBICxdG.js → Tooltip-CNZGI5Tv.js} +1 -1
  25. package/dist/client/assets/{Trash01-DSJ1LUhI.js → Trash01-DPGVoVI0.js} +1 -1
  26. package/dist/client/assets/{Upload01-DC0joCKG.js → Upload01-B1K1jpRL.js} +1 -1
  27. package/dist/client/assets/{UserSquare-DmeGszKa.js → UserSquare-DgIYcYhA.js} +1 -1
  28. package/dist/client/assets/{Users01-B-OacssU.js → Users01-DeK6IcUy.js} +1 -1
  29. package/dist/client/assets/{XClose-avSrIpAi.js → XClose-B40NOWtA.js} +1 -1
  30. package/dist/client/assets/{Zap--C2rij07.js → Zap-PrQtyQ4u.js} +1 -1
  31. package/dist/client/assets/{access-gate-Bd3vMxaX.js → access-gate-Czwg28Aa.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-uIVnUFji.js → add-connection-dialog-CvoK8CuD.js} +1 -1
  33. package/dist/client/assets/agent-app-CIdQoDEi.js +1 -0
  34. package/dist/client/assets/agent-assets-BJMuyqMN.js +1 -0
  35. package/dist/client/assets/{agent-automation-BgD0bRSV.js → agent-automation-CC8RZvdz.js} +3 -3
  36. package/dist/client/assets/{agent-automations-DfordlM0.js → agent-automations-Cv89ZDoQ.js} +1 -1
  37. package/dist/client/assets/agent-calendar-DWLtrh5a.js +1 -0
  38. package/dist/client/assets/agent-capabilities-DYSIvwwC.js +1 -0
  39. package/dist/client/assets/{agent-connect-sources-C33PwxBc.js → agent-connect-sources-dcz4ghlO.js} +1 -1
  40. package/dist/client/assets/agent-deck-79ukGlaD.js +1 -0
  41. package/dist/client/assets/agent-e2e-BecV8iK7.js +1 -0
  42. package/dist/client/assets/agent-experiments-0rDHUtoa.js +1 -0
  43. package/dist/client/assets/agent-file-CcRMmQIR.js +1 -0
  44. package/dist/client/assets/agent-hosting-Bp7-sUtV.js +1 -0
  45. package/dist/client/assets/{agent-icon-Nkid6y9z.js → agent-icon-_Y5eusMw.js} +1 -1
  46. package/dist/client/assets/agent-library-CGgf7yTT.js +1 -0
  47. package/dist/client/assets/agent-library-file-A_6ZSStB.js +1 -0
  48. package/dist/client/assets/agent-overview-CcczGeFG.js +1 -0
  49. package/dist/client/assets/agent-releases-Kc5s36Dn.js +2 -0
  50. package/dist/client/assets/agent-settings-BrQ-Mnfr.js +1 -0
  51. package/dist/client/assets/{agent-site-editor-CVSVIfgT.js → agent-site-editor-DcjkqLR_.js} +2 -2
  52. package/dist/client/assets/agent-site-editor-code-C9Vac5kP.js +2 -0
  53. package/dist/client/assets/agent-site-editor-content-BK40eFw4.js +1 -0
  54. package/dist/client/assets/agent-site-editor-preview-BmrJe1z-.js +1 -0
  55. package/dist/client/assets/agent-view-CwNNidpp.js +1 -0
  56. package/dist/client/assets/{agent-view-guard-BkTiwrL7.js → agent-view-guard-coqrNjXy.js} +1 -1
  57. package/dist/client/assets/{ai-providers-C77po6hX.js → ai-providers-D_h0GcaP.js} +1 -1
  58. package/dist/client/assets/{alert-8ZKgnOi9.js → alert-h8V4X8Ql.js} +1 -1
  59. package/dist/client/assets/{analytics-sections-D2pjEazH.js → analytics-sections-BBSHBKo9.js} +1 -1
  60. package/dist/client/assets/{api-keys-CalFVYGL.js → api-keys-BZ1sBCY5.js} +1 -1
  61. package/dist/client/assets/api-keys-Clz5-Ffr.js +1 -0
  62. package/dist/client/assets/app-editor-CYkeSh8v.js +1 -0
  63. package/dist/client/assets/{asset-utils-CwwYcMA6.js → asset-utils-0I7CXwnB.js} +1 -1
  64. package/dist/client/assets/{auth-xvjttF9D.js → auth-BFbUp7Gk.js} +1 -1
  65. package/dist/client/assets/{auth-catchall--6gbNuLd.js → auth-catchall-Ciz3QLIw.js} +1 -1
  66. package/dist/client/assets/{auth-entry-CsdiTapN.js → auth-entry-CIbESaRU.js} +1 -1
  67. package/dist/client/assets/{auth-split-layout-BqtGBv-Q.js → auth-split-layout-DXGPO57q.js} +1 -1
  68. package/dist/client/assets/{authenticate-and-persist-oauth-DdntocF2.js → authenticate-and-persist-oauth-CDOOyhvF.js} +1 -1
  69. package/dist/client/assets/{automation-list-row-DtkMgEsK.js → automation-list-row-cqG8j4NI.js} +1 -1
  70. package/dist/client/assets/{automation-runs-DxsRwY7z.js → automation-runs-CJPBgcyt.js} +1 -1
  71. package/dist/client/assets/automations-CUnI1LGP.js +1 -0
  72. package/dist/client/assets/{autosend-DbfDzqlB.js → autosend-hIWj1gzu.js} +1 -1
  73. package/dist/client/assets/{badge-BLk85LCv.js → badge-DccxBHlR.js} +1 -1
  74. package/dist/client/assets/{block-document-CSsqtozZ.js → block-document-DQqooS8Z.js} +2 -2
  75. package/dist/client/assets/{blocks-preview-workspace-context-C59bKt9w.js → blocks-preview-workspace-context-DHaN_ngV.js} +1 -1
  76. package/dist/client/assets/blocks-tab-states-CXVOpcLP.js +1 -0
  77. package/dist/client/assets/{blog-schema-B65cUy5G.js → blog-schema-DZRuLzaf.js} +1 -1
  78. package/dist/client/assets/{buckets-CNCQh0A_.js → buckets-CF13tBzF.js} +1 -1
  79. package/dist/client/assets/{build-improve-prompt-doc-DUmEW7kR.js → build-improve-prompt-doc-Csewa1WB.js} +1 -1
  80. package/dist/client/assets/{calendar-CDcnOKeY.js → calendar-CUq9MxZD.js} +1 -1
  81. package/dist/client/assets/{capability-load-error-BZMPli2s.js → capability-load-error-PMRTSYzm.js} +1 -1
  82. package/dist/client/assets/category-editor-f0PbIiVt.js +1 -0
  83. package/dist/client/assets/chart-DHsiNcHK.js +13 -0
  84. package/dist/client/assets/{chat-context-yHOaM07v.js → chat-context-zQ-qHQlQ.js} +2 -2
  85. package/dist/client/assets/{chat-draft-BKLG-IxC.js → chat-draft-DnX_-WHk.js} +1 -1
  86. package/dist/client/assets/{checkbox-Dv6iFznu.js → checkbox-DNUaBZYX.js} +1 -1
  87. package/dist/client/assets/{choose-editor-BbaXuEWm.js → choose-editor-Bre429IU.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-CINmtrn-.js → cli-auth-success-xdbDz12_.js} +1 -1
  89. package/dist/client/assets/{client-icons-CRCSqe4B.js → client-icons-DbvjRooY.js} +1 -1
  90. package/dist/client/assets/cms-settings-editor-B3_YVdwE.js +1 -0
  91. package/dist/client/assets/cms-store-drafts-BL8-fLzg.js +1 -0
  92. package/dist/client/assets/{collapsible-WPiOb2df.js → collapsible-DEQoVVA9.js} +1 -1
  93. package/dist/client/assets/{collection-detail-DeLh0iGu.js → collection-detail-Dl6n3nUb.js} +1 -1
  94. package/dist/client/assets/{collection-display-button-X03nm1ka.js → collection-display-button-BgO5nlf5.js} +1 -1
  95. package/dist/client/assets/{collection-search-CPadQqKp.js → collection-search-BKCnDfDh.js} +1 -1
  96. package/dist/client/assets/{collection-table-wrapper-DbE8PRZm.js → collection-table-wrapper-BiwEx8lf.js} +1 -1
  97. package/dist/client/assets/{collection-tabs-B05-I-04.js → collection-tabs-CLJwpk3w.js} +1 -1
  98. package/dist/client/assets/{combobox-AFeNX90_.js → combobox-BLt_NngQ.js} +1 -1
  99. package/dist/client/assets/{command-CSFENWMV.js → command-CnM6TkoO.js} +1 -1
  100. package/dist/client/assets/{companion-mcps-section-DByl9EP4.js → companion-mcps-section-DDgSYTAO.js} +1 -1
  101. package/dist/client/assets/{config-BuNaSsQb.js → config-CTbwXMPm.js} +1 -1
  102. package/dist/client/assets/{connect-B5ODvCMk.js → connect-BzaGqaBY.js} +3 -3
  103. package/dist/client/assets/{connect-layout-CrQKfs54.js → connect-layout-BZ1xoFNF.js} +1 -1
  104. package/dist/client/assets/{connect-source-dialog-dT9CEaaL.js → connect-source-dialog-BPQ5BKOR.js} +1 -1
  105. package/dist/client/assets/{connection-9Wtillpb.js → connection-BWV5QLFO.js} +1 -1
  106. package/dist/client/assets/{connection-card-B7mEOoWU.js → connection-card-xMr1YFzW.js} +1 -1
  107. package/dist/client/assets/{connection-detail-CVkLDsqd.js → connection-detail-CGUXC9hw.js} +1 -1
  108. package/dist/client/assets/{connection-form-helpers-ZOfZ5xVa.js → connection-form-helpers-CaRBbMf9.js} +1 -1
  109. package/dist/client/assets/{connection-slug-BCjSI_lE.js → connection-slug-Ygf3Xiz0.js} +1 -1
  110. package/dist/client/assets/{connections-B2Pjgwb4.js → connections-wIdj6C4c.js} +1 -1
  111. package/dist/client/assets/content-tab-D6UWTBDG.js +25 -0
  112. package/dist/client/assets/context-B_HaMwVa.js +1 -0
  113. package/dist/client/assets/{context-menu-Cgl4PGwR.js → context-menu-BOlWz_az.js} +1 -1
  114. package/dist/client/assets/{context-shell-xJwj29nG.js → context-shell-Cdw9KYb9.js} +3 -3
  115. package/dist/client/assets/{core.esm-C3kzKmQL.js → core.esm-BbSbwofB.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-C6jgiT68.js → create-organization-dialog-Dzeh0MX0.js} +1 -1
  117. package/dist/client/assets/device-hint-D3M6OFi8.js +1 -0
  118. package/dist/client/assets/discover-DCcWfC01.js +1 -0
  119. package/dist/client/assets/{domain-settings-CUR5XLBa.js → domain-settings-Ce2bhWej.js} +1 -1
  120. package/dist/client/assets/{drawer-1kqkgpFK.js → drawer-D4DxFGqN.js} +1 -1
  121. package/dist/client/assets/{editor-CrG4V3zO.js → editor-DKoVU6S3.js} +1 -1
  122. package/dist/client/assets/{editor-classes-LBX4QjrW.js → editor-classes-DEInI3IT.js} +1 -1
  123. package/dist/client/assets/{empty-state-CbRq3C3n.js → empty-state-CiXq08R1.js} +1 -1
  124. package/dist/client/assets/{empty-state-CVOGmYU9.js → empty-state-DMIzfRid.js} +1 -1
  125. package/dist/client/assets/experiments-tab-choice-DtHr55-O.js +1 -0
  126. package/dist/client/assets/{extract-connection-data-C6MDLhDM.js → extract-connection-data-m9qRk70G.js} +1 -1
  127. package/dist/client/assets/{feature-gate-Uh4gtHbP.js → feature-gate-CbZSFCGe.js} +1 -1
  128. package/dist/client/assets/{feature-paywall-BVXAF3Vl.js → feature-paywall-BorE2qu6.js} +1 -1
  129. package/dist/client/assets/{feedback-Bx6uae5t.js → feedback-DM7ibKhA.js} +1 -1
  130. package/dist/client/assets/{file-explorer-B33pnQXI.js → file-explorer-DgsYJwlc.js} +2 -2
  131. package/dist/client/assets/{file-preview-DifPTXD4.js → file-preview-ClFQiMsH.js} +1 -1
  132. package/dist/client/assets/{file-share-button-OD6j_Xmo.js → file-share-button-oASYWaTp.js} +2 -2
  133. package/dist/client/assets/{file-type-icon-jLU7FJUL.js → file-type-icon-BgsOvG37.js} +1 -1
  134. package/dist/client/assets/{folder-icon-Bk-fEOJa.js → folder-icon-CjXRQ1u4.js} +1 -1
  135. package/dist/client/assets/{form-DE5X7SPR.js → form-BV9LGfdZ.js} +1 -1
  136. package/dist/client/assets/{general-DxPCrqDE.js → general-BOq7h34V.js} +1 -1
  137. package/dist/client/assets/{github-icon-Bvc_Uep-.js → github-icon-BoZFAAoR.js} +1 -1
  138. package/dist/client/assets/home-Y-BAzROz.js +1 -0
  139. package/dist/client/assets/{home-overview-3LLMJPVW.js → home-overview-ztctpGGy.js} +1 -1
  140. package/dist/client/assets/hosted-reconcile-DgpDwrI2.js +1 -0
  141. package/dist/client/assets/{icon-button-1xC_JQLB.js → icon-button-DeiyuWHW.js} +1 -1
  142. package/dist/client/assets/{index-KGPpyCdi.js → index-2dSYni92.js} +1 -1
  143. package/dist/client/assets/{index-eKAZ8rFQ.js → index-5iKTkoGz.js} +2 -2
  144. package/dist/client/assets/{index-BJKjGJrF.js → index-BEm4jG3I.js} +1 -1
  145. package/dist/client/assets/{index-xAQMjVHe.js → index-BFUInOpF.js} +1 -1
  146. package/dist/client/assets/{index-Czm9RrRY.js → index-CDlOTJSg.js} +1 -1
  147. package/dist/client/assets/index-CK6jFdOD.js +4 -0
  148. package/dist/client/assets/index-CKcY9sA2.js +1 -0
  149. package/dist/client/assets/{index-pqEXXiDC.js → index-CxYhsN0K.js} +1 -1
  150. package/dist/client/assets/{index-J6dVRDZu.js → index-DFF-_wih.js} +1 -1
  151. package/dist/client/assets/{index-DOaDUx72.js → index-DHdEN2_u.js} +1 -1
  152. package/dist/client/assets/{index-Wodin-tK.js → index-DSp2YJxk.js} +1 -1
  153. package/dist/client/assets/{index-DyoVCnKR.js → index-DYiWplV5.js} +1 -1
  154. package/dist/client/assets/{index-C1iaIX-s.js → index-DbAn_rcU.js} +6 -6
  155. package/dist/client/assets/{index-BHtZ5LOo.js → index-Dh9YHhq0.js} +1 -1
  156. package/dist/client/assets/{index-DWvRfTwV.js → index-DxGCPS5f.js} +53 -53
  157. package/dist/client/assets/{index-L3rSytXD.js → index-DzoENFz8.js} +1 -1
  158. package/dist/client/assets/index-SmuiYnIl.css +1 -0
  159. package/dist/client/assets/{index-redirect-D52J_8O4.js → index-redirect-rsQ177qk.js} +1 -1
  160. package/dist/client/assets/{infiniteQueryObserver-O1nZgTsK.js → infiniteQueryObserver-BRbF_8wg.js} +1 -1
  161. package/dist/client/assets/{infra-billing-CsrcHH3z.js → infra-billing-CskAuVtU.js} +1 -1
  162. package/dist/client/assets/input-BznJkJE1.js +17 -0
  163. package/dist/client/assets/{input-Z4x7UYYS.js → input-CYN8nGNA.js} +1 -1
  164. package/dist/client/assets/{integration-icon-BCp7DD7C.js → integration-icon-CivNYrxB.js} +1 -1
  165. package/dist/client/assets/{jira-icon-Cgp_nHIG.js → jira-icon-EhOwRLcu.js} +1 -1
  166. package/dist/client/assets/{label-BkzEUDUr.js → label-Co3RnKjI.js} +1 -1
  167. package/dist/client/assets/{layout-pqxzJsxG.js → layout-ChuRSl3A.js} +1 -1
  168. package/dist/client/assets/{legacy-agents-deep-C88GLYmw.js → legacy-agents-deep-D0c9eotJ.js} +1 -1
  169. package/dist/client/assets/{legacy-main-redirect-DcmC8SjE.js → legacy-main-redirect-B6HagH9j.js} +1 -1
  170. package/dist/client/assets/library-P47bCY92.js +1 -0
  171. package/dist/client/assets/{library-tab-DI44ELWs.js → library-tab-QNwTrF2z.js} +3 -3
  172. package/dist/client/assets/{login-DQICOGIE.js → login-G4MQMu-X.js} +1 -1
  173. package/dist/client/assets/{markdown-DkmjrNqn.js → markdown-BkKuf5yA.js} +1 -1
  174. package/dist/client/assets/{mcp-app-renderer-CIky1nBi.js → mcp-app-renderer-AZxi3AlX.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-CNMWqwMp.js → mcp-oauth-C-lvxcK7.js} +1 -1
  176. package/dist/client/assets/{mcp-oauth-SAUpfbwO.js → mcp-oauth-C3sBEl47.js} +1 -1
  177. package/dist/client/assets/{members-BT1BIG15.js → members-fyMprese.js} +1 -1
  178. package/dist/client/assets/{memory-BDRH6Og0.js → memory-0qhTiXOS.js} +1 -1
  179. package/dist/client/assets/{mock-board-BF-mAr4y.js → mock-board-B5Lo4WRg.js} +4 -4
  180. package/dist/client/assets/{monaco-editor-Dff4ZjU3.js → monaco-editor-03CuhEOx.js} +1 -1
  181. package/dist/client/assets/monitoring-BWMV-UnG.js +2 -0
  182. package/dist/client/assets/{monitoring-stats-row-ZCTbL6bH.js → monitoring-stats-row-BHB7ML9p.js} +1 -1
  183. package/dist/client/assets/{multi-select-B4WkKxx8.js → multi-select-BvRkhFxR.js} +1 -1
  184. package/dist/client/assets/mustache-BRZEXzlS.js +4 -0
  185. package/dist/client/assets/named-rule-view-NWkI621l.js +1 -0
  186. package/dist/client/assets/{new-project-dialog-Kvs8XyHN.js → new-project-dialog-B_Izhfc6.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-CIFexUJN.js → oauth-callback-C3qf7NWs.js} +1 -1
  188. package/dist/client/assets/{oauth-callback-ai-provider-3-_RChJi.js → oauth-callback-ai-provider-BOCoomMC.js} +1 -1
  189. package/dist/client/assets/{oauth-consent-vlJReqsl.js → oauth-consent-kRuFuPRq.js} +1 -1
  190. package/dist/client/assets/{onboarding-CC0xFJ-5.js → onboarding-C9TuarYv.js} +1 -1
  191. package/dist/client/assets/openai-conversation-C1V_CQca.js +3 -0
  192. package/dist/client/assets/{optimistic-project-sidebar-views-BmsZ-Me-.js → optimistic-project-sidebar-views-Ms5q90dF.js} +1 -1
  193. package/dist/client/assets/{order-monitor-day-Cxsz6w2q.js → order-monitor-day-B8IwQXNk.js} +1 -1
  194. package/dist/client/assets/{organization-choice-4fOAxXZj.js → organization-choice-IdTamlIL.js} +1 -1
  195. package/dist/client/assets/{orgs-nKU8niHO.js → orgs-D6Y9NZAy.js} +1 -1
  196. package/dist/client/assets/{own-accounts-section-B2chKMQ0.js → own-accounts-section-CX4xOba8.js} +1 -1
  197. package/dist/client/assets/{pair-BwCxrq_f.js → pair-BzWauPYd.js} +7 -7
  198. package/dist/client/assets/{parse-sections-CK6AHU3E.js → parse-sections-DE8GWmV_.js} +7 -7
  199. package/dist/client/assets/{plan-C4kJq3a0.js → plan-CANZ8MES.js} +1 -1
  200. package/dist/client/assets/{plan-ladder-wSfhs4No.js → plan-ladder-CAL4h1RI.js} +1 -1
  201. package/dist/client/assets/{plan-usage-card-CBlBUX6I.js → plan-usage-card-B0E1Mqx-.js} +2 -2
  202. package/dist/client/assets/{popover-CpDRMXBS.js → popover-cnXo99rU.js} +1 -1
  203. package/dist/client/assets/post-calendar-CR_baRyF.js +1 -0
  204. package/dist/client/assets/{post-editor-BHEvn_Zz.js → post-editor-DuGV7g7L.js} +2 -2
  205. package/dist/client/assets/{preview-content-C4WlFzcj.js → preview-content-Cspo-rar.js} +1 -1
  206. package/dist/client/assets/{preview-dialog-CSGQDL5A.js → preview-dialog-sM6fzUlE.js} +1 -1
  207. package/dist/client/assets/{preview-panel-BMN_Ysm9.js → preview-panel-vDb65VC_.js} +1 -1
  208. package/dist/client/assets/preview-tab-BjhtYZTR.js +551 -0
  209. package/dist/client/assets/{product-picker-dialog-DzFQlf9n.js → product-picker-dialog-DL4criSm.js} +1 -1
  210. package/dist/client/assets/{profile-DGzRd8vX.js → profile-D0f8KwpQ.js} +1 -1
  211. package/dist/client/assets/project-app-view-BAfcj1IV.js +1 -0
  212. package/dist/client/assets/project-apps-DoVt9kS_.js +1 -0
  213. package/dist/client/assets/{project-icon-DTA6ZXhl.js → project-icon-BnHxv46u.js} +1 -1
  214. package/dist/client/assets/{project-index-BmalKoU9.js → project-index-WJ4tXHCM.js} +1 -1
  215. package/dist/client/assets/project-reports-DYL24PFI.js +1 -0
  216. package/dist/client/assets/project-sidebar-views-CLVZ96mT.js +1 -0
  217. package/dist/client/assets/project-tasks-C0N1MlNa.js +1 -0
  218. package/dist/client/assets/{projects-BIj_kuAC.js → projects-LpPdlGF4.js} +1 -1
  219. package/dist/client/assets/{projects-empty-state-DVir8yX9.js → projects-empty-state-iR6Zz5-N.js} +1 -1
  220. package/dist/client/assets/{prompts-BmgauEg8.js → prompts-XgZrzKUE.js} +1 -1
  221. package/dist/client/assets/record-editor-B9sjj4Iw.js +1 -0
  222. package/dist/client/assets/redirect-editor-D2q-6Lz4.js +1 -0
  223. package/dist/client/assets/{reports-7rmI992n.js → reports-5E4FVu6v.js} +1 -1
  224. package/dist/client/assets/reports-D1yzySzc.js +1 -0
  225. package/dist/client/assets/{reports-onboarding-DPzdd7qa.js → reports-onboarding-DC_5ahpO.js} +1 -1
  226. package/dist/client/assets/{reports-tab-C_NZHfzv.js → reports-tab-CJb3-7vP.js} +2 -2
  227. package/dist/client/assets/{repositories-D3yxw4y-.js → repositories-7NE-Y-fP.js} +1 -1
  228. package/dist/client/assets/repositories-B2vK4Cqr.js +1 -0
  229. package/dist/client/assets/{repository-binding-CeErFm4l.js → repository-binding-C4_xIShf.js} +1 -1
  230. package/dist/client/assets/{repository-picker-C3C3_E5g.js → repository-picker-CX0VOapR.js} +1 -1
  231. package/dist/client/assets/{require-capability-BOrIzed0.js → require-capability-1AcS0xbn.js} +1 -1
  232. package/dist/client/assets/{required-auth-layout-nGThcCwM.js → required-auth-layout-lwAsP7t-.js} +1 -1
  233. package/dist/client/assets/{reset-password-xu4Q0lXY.js → reset-password-DRB8IWFN.js} +1 -1
  234. package/dist/client/assets/{resizable-gNSqe3KZ.js → resizable-CZ6UntWr.js} +1 -1
  235. package/dist/client/assets/resolve-tab-icon-JlFD9Ttu.js +1 -0
  236. package/dist/client/assets/{review-settings-CjrtYBLa.js → review-settings-DpoAEk87.js} +1 -1
  237. package/dist/client/assets/{role-color-DQHx1mqZ.js → role-color-CAgewKmr.js} +1 -1
  238. package/dist/client/assets/{roles-C_hPZ63M.js → roles-D-1qXwgE.js} +1 -1
  239. package/dist/client/assets/route-BM3UxPQb.js +1 -0
  240. package/dist/client/assets/route-CAQmwL3B.js +1 -0
  241. package/dist/client/assets/route-DVYYyJNN.js +1 -0
  242. package/dist/client/assets/sandbox-lifecycle-context-ByyfF0kL.js +1 -0
  243. package/dist/client/assets/{schema-DvxWNZKz.js → schema-DyY5h7Rx.js} +1 -1
  244. package/dist/client/assets/{schema-DiUKA_SL.js → schema-STdjEbAK.js} +1 -1
  245. package/dist/client/assets/{scroll-area-CUevVS4T.js → scroll-area-DJvIk_1i.js} +1 -1
  246. package/dist/client/assets/{search-input-DWWqDlal.js → search-input-BRZEiJxt.js} +1 -1
  247. package/dist/client/assets/{search-toggle-Z6tLdJtz.js → search-toggle-BW-nCNIt.js} +1 -1
  248. package/dist/client/assets/{secret-picker-BK4dq3ip.js → secret-picker-DvJbV8kU.js} +1 -1
  249. package/dist/client/assets/{secrets-DrGLagdz.js → secrets-CQ4fmQqK.js} +1 -1
  250. package/dist/client/assets/section-array-field-CzG_jptj.js +1 -0
  251. package/dist/client/assets/{sections-CC9QneUq.js → sections-CHxeuMKy.js} +1 -1
  252. package/dist/client/assets/sections-editor-B_kNIbOe.js +1 -0
  253. package/dist/client/assets/{select-gJgQvQZg.js → select-C30nxii2.js} +1 -1
  254. package/dist/client/assets/{select-model-ivosxEc9.js → select-model-DRBYpCaL.js} +1 -1
  255. package/dist/client/assets/seo-editor-DazAHwbK.js +1 -0
  256. package/dist/client/assets/{separator-PY5RFBB-.js → separator-vR8karC8.js} +1 -1
  257. package/dist/client/assets/settings-tab-Bvb5mnr2.js +1 -0
  258. package/dist/client/assets/{sheet-BKUVqko3.js → sheet-ClaqVLRv.js} +1 -1
  259. package/dist/client/assets/{shell-layout-Bx4AZ_YV.js → shell-layout-dHGD2tyJ.js} +1 -1
  260. package/dist/client/assets/site-draft-actions-BIA6lR1g.js +3 -0
  261. package/dist/client/assets/site-draft-view-Ci2I7i9g.js +1 -0
  262. package/dist/client/assets/site-editor-CmjAnts6.js +1 -0
  263. package/dist/client/assets/site-editor-toast-CgoUJTSW.js +1 -0
  264. package/dist/client/assets/{skills-CZlPyCDI.js → skills-D1-DQBAA.js} +1 -1
  265. package/dist/client/assets/{slider-CnnTZZH8.js → slider-B_ZUvu11.js} +1 -1
  266. package/dist/client/assets/{sortable.esm-YReNzob1.js → sortable.esm-BqKBxgnm.js} +1 -1
  267. package/dist/client/assets/{sso-B0Izx2rk.js → sso-DFYqPjQF.js} +1 -1
  268. package/dist/client/assets/{suggestion-D-YZpsQl.js → suggestion-B-tT_3Ba.js} +1 -1
  269. package/dist/client/assets/{switch-UpbwlQtZ.js → switch-BhYC-gsU.js} +1 -1
  270. package/dist/client/assets/{synced-repos-DJZhlM-5.js → synced-repos-CNpviR6w.js} +1 -1
  271. package/dist/client/assets/{tab-icon-glyph-BA8eumIA.js → tab-icon-glyph-BrdbQUjH.js} +1 -1
  272. package/dist/client/assets/{table-D9nZzqmf.js → table-Dioc_TQV.js} +1 -1
  273. package/dist/client/assets/{tabs-BFXzZPNk.js → tabs-t_453qON.js} +1 -1
  274. package/dist/client/assets/{task-board-CzrPT-OZ.js → task-board-T7oS4tjE.js} +1 -1
  275. package/dist/client/assets/{task-route-DrqrKj8M.js → task-route-BABnfdht.js} +1 -1
  276. package/dist/client/assets/{task-status-B5fYlW4s.js → task-status-B5yaN2e9.js} +1 -1
  277. package/dist/client/assets/{taskboard-analytics-Bo8Bxm9q.js → taskboard-analytics-CEOCzjed.js} +1 -1
  278. package/dist/client/assets/{tasks-BFPPo49C.js → tasks-CPtiTkqv.js} +3 -3
  279. package/dist/client/assets/tasks-DmeEepcP.js +1 -0
  280. package/dist/client/assets/{textarea-BVq0fBVJ.js → textarea-CHZQytvO.js} +1 -1
  281. package/dist/client/assets/{thread-analytics-j4C-4XbM.js → thread-analytics-w3Kn_9QO.js} +1 -1
  282. package/dist/client/assets/{thread-intent-BONVdhUb.js → thread-intent-DckhqhKt.js} +2 -2
  283. package/dist/client/assets/{thread-route-DMWye38f.js → thread-route-CIVmQ-Bx.js} +1 -1
  284. package/dist/client/assets/{thread-route-CDlnAMQ3.js → thread-route-DyG_eSJM.js} +1 -1
  285. package/dist/client/assets/{thread-sheet-body-C1Yi4Tsp.js → thread-sheet-body-C7OutFPd.js} +1 -1
  286. package/dist/client/assets/{time-range-picker-DuQ-XfqJ.js → time-range-picker-Dg1tvNlk.js} +1 -1
  287. package/dist/client/assets/{toggle-group-Bw4R79dp.js → toggle-group-CC2qDSue.js} +1 -1
  288. package/dist/client/assets/{tool-namespace-CmEhPnkj.js → tool-namespace-WdIPTHBa.js} +1 -1
  289. package/dist/client/assets/{tool-set-selector-DAvZ69Ky.js → tool-set-selector-By0-LDtv.js} +1 -1
  290. package/dist/client/assets/{toolbar-icon-button-CRZySHtx.js → toolbar-icon-button-CjbxTTYr.js} +1 -1
  291. package/dist/client/assets/{tooltip-BVv5wAeF.js → tooltip-xj6ZnC0s.js} +1 -1
  292. package/dist/client/assets/{tooltipContext-DwFHeBjZ.js → tooltipContext-BPLu0XDW.js} +1 -1
  293. package/dist/client/assets/{track-CHjUqURA.js → track-Ba7_Ntbn.js} +1 -1
  294. package/dist/client/assets/{types-7R44AYrk.js → types-B8snWcBI.js} +1 -1
  295. package/dist/client/assets/{url-slug-CoT8zovb.js → url-slug-Dv3zxns9.js} +1 -1
  296. package/dist/client/assets/{usage-stats-qZh3WQDj.js → usage-stats-hNAp_EX0.js} +2 -2
  297. package/dist/client/assets/{use-ai-providers-CCcuLCZt.js → use-ai-providers-8QFj-dPT.js} +1 -1
  298. package/dist/client/assets/{use-apply-named-rule-BRjLBznN.js → use-apply-named-rule-BKcXT1e9.js} +1 -1
  299. package/dist/client/assets/use-ask-in-chat-C5fM3Bv6.js +1 -0
  300. package/dist/client/assets/{use-automations-jhigzQzP.js → use-automations-CTbTqBX7.js} +1 -1
  301. package/dist/client/assets/{use-autosave--xoi8yhU.js → use-autosave-CiyRV4I8.js} +1 -1
  302. package/dist/client/assets/use-blocks-v8-project-Oxne65-_.js +1 -0
  303. package/dist/client/assets/{use-chat-layout-state-Dnl_7DMo.js → use-chat-layout-state-D-U8t0kV.js} +1 -1
  304. package/dist/client/assets/{use-cms-publish-actions-CgLBJwXN.js → use-cms-publish-actions-DmkL-hz5.js} +5 -5
  305. package/dist/client/assets/{use-connect-companion-BVtzi_36.js → use-connect-companion-Bwtrfh-M.js} +1 -1
  306. package/dist/client/assets/{use-connection-BQpfU6u4.js → use-connection-B3EvPXuJ.js} +1 -1
  307. package/dist/client/assets/{use-content-sync-DjDHeqFk.js → use-content-sync-C8Ux_RZ8.js} +1 -1
  308. package/dist/client/assets/{use-copy-CMfnyhoo.js → use-copy-O-MML7rC.js} +1 -1
  309. package/dist/client/assets/{use-date-fns-locale-CRoKnCN9.js → use-date-fns-locale-CP8lOmDn.js} +1 -1
  310. package/dist/client/assets/{use-debounced-autosave-D1fE_-TK.js → use-debounced-autosave-BXwcTWeY.js} +1 -1
  311. package/dist/client/assets/{use-debounced-value-DiJ2aJN8.js → use-debounced-value-DDir1rWd.js} +1 -1
  312. package/dist/client/assets/{use-deco-credits-D1bpdE32.js → use-deco-credits-Dy_Hg4i-.js} +1 -1
  313. package/dist/client/assets/{use-decopilot-events-CZSx1Itd.js → use-decopilot-events-BAXWzGGN.js} +1 -1
  314. package/dist/client/assets/{use-delete-connection-BFOvb9ed.js → use-delete-connection-ZbJPfKIZ.js} +1 -1
  315. package/dist/client/assets/{use-deployment-admin-DQ5wNSYp.js → use-deployment-admin-DNwohGK9.js} +1 -1
  316. package/dist/client/assets/{use-entitlements-BChYmsyZ.js → use-entitlements-SlWYl1h3.js} +1 -1
  317. package/dist/client/assets/use-fast-preview-draft-url-DB6fawwn.js +1 -0
  318. package/dist/client/assets/{use-file-configs-DRzFKzj4.js → use-file-configs-BiPsjSp0.js} +1 -1
  319. package/dist/client/assets/{use-id-selection-DexUoI58.js → use-id-selection-CQGXhZf9.js} +1 -1
  320. package/dist/client/assets/{use-inbox-feed-BvqULLI3.js → use-inbox-feed-G78cFBlF.js} +1 -1
  321. package/dist/client/assets/{use-infinite-scroll-C7IQ9e5j.js → use-infinite-scroll-CuJmRWs3.js} +1 -1
  322. package/dist/client/assets/{use-join-requests-Dr_qAJ4N.js → use-join-requests-BtFDzITE.js} +1 -1
  323. package/dist/client/assets/use-main-panel-tabs-D_s_t2hY.js +1 -0
  324. package/dist/client/assets/use-mcp-auth-status-C4Vaxyeo.js +1 -0
  325. package/dist/client/assets/{use-mcp-client-Z8a6jg-w.js → use-mcp-client-BFuEikBh.js} +1 -1
  326. package/dist/client/assets/{use-mcp-prompts-KWx0e75o.js → use-mcp-prompts-W7_z0mx2.js} +1 -1
  327. package/dist/client/assets/{use-mcp-tools-C4Fqpw4S.js → use-mcp-tools-Fkw183dy.js} +1 -1
  328. package/dist/client/assets/{use-mobile-B7UqukPG.js → use-mobile-COmq9TQM.js} +1 -1
  329. package/dist/client/assets/use-move-blocks-DtAEvUrz.js +1 -0
  330. package/dist/client/assets/{use-navigate-to-agent-9BOtBFjV.js → use-navigate-to-agent-RGucqDuO.js} +1 -1
  331. package/dist/client/assets/{use-org-fs-DU8c86TB.js → use-org-fs-B1VEI_Er.js} +1 -1
  332. package/dist/client/assets/{use-org-repo-syncs-DGuZeud_.js → use-org-repo-syncs-DE87oI9s.js} +1 -1
  333. package/dist/client/assets/{use-org-sso-nKgxHjqa.js → use-org-sso-RIE_JSyT.js} +1 -1
  334. package/dist/client/assets/{use-organization-settings-DqaBVcmT.js → use-organization-settings-DqmiRW0D.js} +1 -1
  335. package/dist/client/assets/{use-project-scope-B4B7p1mj.js → use-project-scope-CYZ0mCfQ.js} +1 -1
  336. package/dist/client/assets/{use-recent-apps-CQ2MLxK5.js → use-recent-apps-D1NSRmBo.js} +1 -1
  337. package/dist/client/assets/use-reports-diagnostic-DGd4jOlT.js +1 -0
  338. package/dist/client/assets/use-sandbox-events-nFpLHv9o.js +2 -0
  339. package/dist/client/assets/{use-secrets-DP80TxaK.js → use-secrets-B3RSCdMi.js} +1 -1
  340. package/dist/client/assets/use-section-preview-base-CvJ34UxX.js +1 -0
  341. package/dist/client/assets/use-sidebar-collapsed-DXX9If3C.js +1 -0
  342. package/dist/client/assets/{use-tags-BMj-zonr.js → use-tags-BjaNX9ld.js} +1 -1
  343. package/dist/client/assets/{use-task-board-analytics-Bxag-9wC.js → use-task-board-analytics--QCcKCkA.js} +1 -1
  344. package/dist/client/assets/{use-task-board-events-B8bEY6A0.js → use-task-board-events-p-Cj7F6A.js} +1 -1
  345. package/dist/client/assets/{use-task-board-item-prs-JXA8OC5C.js → use-task-board-item-prs-DRcN9Nsr.js} +1 -1
  346. package/dist/client/assets/{use-task-board-items-DFDnaPnO.js → use-task-board-items-tdp7palw.js} +1 -1
  347. package/dist/client/assets/{use-task-board-prompts-CeCaGQl-.js → use-task-board-prompts-CPvlYwGk.js} +1 -1
  348. package/dist/client/assets/{use-task-metadata-D6_-qyJw.js → use-task-metadata-D1snlV6w.js} +1 -1
  349. package/dist/client/assets/{use-thread-outputs-DIlmUcwz.js → use-thread-outputs-bD7oL4Tg.js} +1 -1
  350. package/dist/client/assets/use-voice-input-CZ-OU5Nk.js +1 -0
  351. package/dist/client/assets/useInfiniteQuery-ByQLYXMe.js +1 -0
  352. package/dist/client/assets/{useQueries-DlmzJSx8.js → useQueries-DSvnP38O.js} +1 -1
  353. package/dist/client/assets/useSuspenseInfiniteQuery-ClUlWmLx.js +1 -0
  354. package/dist/client/assets/{users-BIMbDMRH.js → users-Bqa3Dwe4.js} +1 -1
  355. package/dist/client/assets/{utils-B-ZZ1C4f.js → utils-Dk3SKS5y.js} +3 -3
  356. package/dist/client/assets/{variant-calendar-CPbvwCiJ.js → variant-calendar-CD4VQuq0.js} +1 -1
  357. package/dist/client/assets/{variant-matcher-override-BDeSqmx4.js → variant-matcher-override-NriuY-7n.js} +1 -1
  358. package/dist/client/assets/{view-header-BTUnAkrc.js → view-header-B6CnFcfB.js} +1 -1
  359. package/dist/client/assets/{virtual-mcp-D-xL-K_P.js → virtual-mcp-D5NkkvKn.js} +1 -1
  360. package/dist/client/assets/{watch-sse-pool-B6ObjuCT.js → watch-sse-pool-BKRouklE.js} +1 -1
  361. package/dist/client/index.html +2 -2
  362. package/dist/server/server.js +1 -1
  363. package/package.json +1 -1
  364. package/dist/client/assets/ReferenceLine-DN9gAkkU.js +0 -1
  365. package/dist/client/assets/agent-app-BkJxaBM5.js +0 -1
  366. package/dist/client/assets/agent-assets-CWN2kTtA.js +0 -1
  367. package/dist/client/assets/agent-calendar-z2j3yA6d.js +0 -1
  368. package/dist/client/assets/agent-capabilities-4Kae1N0E.js +0 -1
  369. package/dist/client/assets/agent-deck-Lf3f7IO8.js +0 -1
  370. package/dist/client/assets/agent-e2e-C44IfVz9.js +0 -1
  371. package/dist/client/assets/agent-file-D8S6ohDB.js +0 -1
  372. package/dist/client/assets/agent-hosting-D6CnE5uR.js +0 -1
  373. package/dist/client/assets/agent-library-Co5WQMIF.js +0 -1
  374. package/dist/client/assets/agent-library-file-BPJi6RfX.js +0 -1
  375. package/dist/client/assets/agent-overview-D73rnnSU.js +0 -1
  376. package/dist/client/assets/agent-releases-WO1DzowK.js +0 -2
  377. package/dist/client/assets/agent-settings-DK2xDr1_.js +0 -1
  378. package/dist/client/assets/agent-site-editor-code-21UDx-VP.js +0 -2
  379. package/dist/client/assets/agent-site-editor-content-ycS9Pz-a.js +0 -1
  380. package/dist/client/assets/agent-site-editor-preview-CM8uT3ZM.js +0 -1
  381. package/dist/client/assets/agent-view-CnIONLQC.js +0 -1
  382. package/dist/client/assets/api-keys-CJdXbN4c.js +0 -1
  383. package/dist/client/assets/app-editor--cZ0paPb.js +0 -1
  384. package/dist/client/assets/automations-DXGl5rDB.js +0 -1
  385. package/dist/client/assets/blocks-tab-states-DP3rjaHt.js +0 -1
  386. package/dist/client/assets/category-editor-BFW4v6Zt.js +0 -1
  387. package/dist/client/assets/chart-W6WUctG8.js +0 -13
  388. package/dist/client/assets/cms-settings-editor-BKSzHFaJ.js +0 -1
  389. package/dist/client/assets/cms-store-drafts-BRph2qKQ.js +0 -1
  390. package/dist/client/assets/content-tab-D6POg5eV.js +0 -25
  391. package/dist/client/assets/context-D9Jnu7vN.js +0 -1
  392. package/dist/client/assets/device-hint-B0gKGTHi.js +0 -1
  393. package/dist/client/assets/discover-hzv5-quf.js +0 -1
  394. package/dist/client/assets/home-z2EXALAZ.js +0 -1
  395. package/dist/client/assets/hosted-reconcile-gHkwH1BF.js +0 -1
  396. package/dist/client/assets/index-BtlZo3IV.js +0 -2
  397. package/dist/client/assets/index-Chg--78J.js +0 -4
  398. package/dist/client/assets/index-ug7KC70Z.css +0 -1
  399. package/dist/client/assets/input-Lv9puCyJ.js +0 -17
  400. package/dist/client/assets/library-D4o0AtWq.js +0 -1
  401. package/dist/client/assets/monitoring-BPV_CuUX.js +0 -2
  402. package/dist/client/assets/mustache-DCgM4RQC.js +0 -4
  403. package/dist/client/assets/named-rule-view-D8WSLrw8.js +0 -1
  404. package/dist/client/assets/openai-conversation-D9tyQTXT.js +0 -3
  405. package/dist/client/assets/post-calendar-C4WCdLXl.js +0 -1
  406. package/dist/client/assets/preview-tab-sRIuk4Ej.js +0 -551
  407. package/dist/client/assets/project-app-view-ByacUDvM.js +0 -1
  408. package/dist/client/assets/project-apps-DzbYoXyd.js +0 -1
  409. package/dist/client/assets/project-reports-DPgVezio.js +0 -1
  410. package/dist/client/assets/project-sidebar-views-BxNR4pgO.js +0 -1
  411. package/dist/client/assets/project-tasks-C8oeh0BH.js +0 -1
  412. package/dist/client/assets/record-editor-BZSwvkut.js +0 -1
  413. package/dist/client/assets/redirect-editor-BxlqORGw.js +0 -1
  414. package/dist/client/assets/reports-Be7TvXFw.js +0 -1
  415. package/dist/client/assets/repositories-DFHveJlo.js +0 -1
  416. package/dist/client/assets/resolve-tab-icon-D4I4sh6v.js +0 -1
  417. package/dist/client/assets/route-04y-cUhL.js +0 -1
  418. package/dist/client/assets/route-CijJVC7q.js +0 -1
  419. package/dist/client/assets/route-D7Ke7Nww.js +0 -1
  420. package/dist/client/assets/sandbox-lifecycle-context-CuiD9fGV.js +0 -1
  421. package/dist/client/assets/sections-editor-CEHFL2VN.js +0 -1
  422. package/dist/client/assets/seo-editor-CaLY6KkG.js +0 -1
  423. package/dist/client/assets/settings-tab-DeCOk8kh.js +0 -1
  424. package/dist/client/assets/site-draft-view-B8TmuovZ.js +0 -3
  425. package/dist/client/assets/site-editor-BeO4XfO2.js +0 -1
  426. package/dist/client/assets/site-editor-toast-B-FxlfJP.js +0 -1
  427. package/dist/client/assets/tasks-CI7wGKXW.js +0 -1
  428. package/dist/client/assets/use-ask-in-chat-DQs0YHUB.js +0 -1
  429. package/dist/client/assets/use-fast-preview-draft-url-CO3Nwa6o.js +0 -1
  430. package/dist/client/assets/use-main-panel-tabs-DZKpYMQg.js +0 -1
  431. package/dist/client/assets/use-mcp-auth-status-D0-JLgq9.js +0 -1
  432. package/dist/client/assets/use-move-blocks-DqXCo5PB.js +0 -1
  433. package/dist/client/assets/use-reports-diagnostic-MABLwKiU.js +0 -1
  434. package/dist/client/assets/use-section-preview-base-C7kw5vsr.js +0 -1
  435. package/dist/client/assets/use-sidebar-collapsed-Dz5RfxtZ.js +0 -1
  436. package/dist/client/assets/useInfiniteQuery-DAm-dYuC.js +0 -1
  437. package/dist/client/assets/useSuspenseInfiniteQuery-BTqieOpO.js +0 -1
@@ -0,0 +1,3 @@
1
+ import{c as B,b as be,r as q,j as a,B as ve,m as K,K as ss,al as ka,t as et,fb as Na,as as or,ed as cr,Y as Xt,c6 as Ca,aH as ks,aI as Ns,aJ as Cs,aK as As,bj as Rs,aL as Ts,aM as Ds,aN as Bs,X as _s,Z as Ms,_ as Es,a as zs,a5 as hs,ct as Aa,h as Zt,fc as dr,fd as cn,bJ as Ra,b8 as Ta,bh as _n,fe as Da,c0 as Ba,am as Ia,I as $a,a8 as Fa,ff as La,V as ur,i as ft,eR as dn,q as hr,J as fr,D as mr,x as pr,v as br,Q as gr,R as xr,fg as Oa,bk as vr,a6 as un,b3 as hn,e as Mn,E as _a,T as Ma}from"./index-DxGCPS5f.js";import{S as Ea}from"./separator-vR8karC8.js";import{f as za,u as ns,r as yr,l as jr,c as wr,b as Ua}from"./chat-context-zQ-qHQlQ.js";import{u as Bt,ar as qa,as as Pr,at as Sr,c as fn,b as mn,M as pn,au as Ha,L as Ka,av as Va,af as Ga,aw as Wa,U as bn,S as kr,ax as Qa,a1 as Nr,G as Ja,ay as Ya,az as Xa,C as Cr}from"./site-editor-toast-CgoUJTSW.js";import{b as Za,L as el,a as tl}from"./shell-layout-dHGD2tyJ.js";import{I as Ar}from"./toolbar-icon-button-CjbxTTYr.js";import{b as sl,P as nl,a as rl}from"./popover-cnXo99rU.js";import{c as tt,T as st,a as nt,b as Us}from"./tooltip-xj6ZnC0s.js";import{f as al,a as ll,c as il,C as En,e as zn,b as Un}from"./command-CnM6TkoO.js";import{T as Tt,a as Rr,c as Tr}from"./tabs-t_453qON.js";import{t as Dr}from"./ChevronUp-CslLufEI.js";import{Y as Br,aG as qs,E as ol,a as Ir,aH as cl,b as dl,aI as $r,L as ul}from"./agent-icon-_Y5eusMw.js";import{a as Fr}from"./SwitchHorizontal01-BCe-gFOc.js";import{c as Lr,s as Is}from"./Tool01-snML4pPn.js";import{s as Or}from"./Plus-DtM4w8bA.js";import{s as Hs}from"./Trash01-DPGVoVI0.js";import{l as hl,d as fl}from"./thread-intent-DckhqhKt.js";import{h as _r,r as Mr,g as ml,e as _e,u as Ks,f as Er}from"./repository-binding-C4_xIShf.js";import{u as pl}from"./use-debounced-value-DDir1rWd.js";import{u as bl}from"./useInfiniteQuery-ByQLYXMe.js";import{d as gl,b as xl,p as vl,e as zr,g as Ur,h as qr}from"./use-navigate-to-agent-RGucqDuO.js";import{u as Vs,g as gn,n as ds,b as Hr,a as yl,d as jl,e as wl,r as cs,f as Pl,s as Sl,h as xs,c as xn}from"./cms-store-drafts-BL8-fLzg.js";import{a as $s}from"./virtual-mcp-D5NkkvKn.js";import{u as fs}from"./use-voice-input-CZ-OU5Nk.js";import{u as vn}from"./use-blocks-v8-project-Oxne65-_.js";import{G as Kr}from"./github-icon-BoZFAAoR.js";import{u as kl,a as Nl}from"./use-fast-preview-draft-url-DB6fawwn.js";import{a6 as Jt,a7 as Vr,D as Fs,o as yn,a8 as Cl,a9 as Al,G as Rl,aa as Tl,ab as Dl,p as Bl,y as Pt,f as jn,ac as Il}from"./blocks-tab-states-CXVOpcLP.js";import"./index-CKcY9sA2.js";import{T as $l}from"./textarea-CHZQytvO.js";import{i as wn}from"./CheckCircle-BfgWRJx4.js";import{n as Fl,s as Ll,C as Ol,a as _l,b as Ml,M as El,c as zl,d as Ul,m as ql,u as Hl}from"./use-cms-publish-actions-DmkL-hz5.js";import{a as Kl,g as Vl}from"./UserSquare-DgIYcYhA.js";import{i as Pn,b as Sn,m as Gl,h as Wl,c as Gr,f as Wr,d as Ql,r as kn,e as Jl,n as Yl,g as Xl,j as Zl,k as ei,l as Nn,o as ti,p as Qr,q as si,s as Cn,t as Ys}from"./sandbox-git-api-DcqI6XE4.js";import{b as ni,g as ri}from"./utils-Dk3SKS5y.js";import{i as ai}from"./Monitor01-Bx36gCte.js";import{w as An,R as Jr}from"./device-hint-D3M6OFi8.js";import{w as qn}from"./editor-DKoVU6S3.js";import{x as li,C as ii}from"./section-array-field-CzG_jptj.js";import{s as Yr}from"./save-changes-debug-nBi-n9eV.js";import{u as oi}from"./use-mcp-client-BFuEikBh.js";import{u as ci}from"./use-sandbox-events-nFpLHv9o.js";import{b as di,a as ui}from"./sandbox-lifecycle-context-ByyfF0kL.js";import{b as hi}from"./agent-capabilities-DYSIvwwC.js";import{b as fi}from"./thread-route-CIVmQ-Bx.js";function mi(t){const{value:e,baseBranch:s,releases:r,baseIsDraft:n=!1,storeDrafts:o=[]}=t,d=!n&&!!e&&e===s,l=r.find(c=>c.branch===e),i=d||l?void 0:o.find(c=>c.name===e),u=!d&&!l&&!i&&!!e;return i?{isBase:d,current:l,storeDraft:i,unlisted:u}:{isBase:d,current:l,unlisted:u}}const pi={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},Hn=1114111;function Kn(t){return t?t.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,(e,s)=>{if(s.startsWith("#x")||s.startsWith("#X")){const r=Number.parseInt(s.slice(2),16);return!Number.isFinite(r)||r>Hn?e:String.fromCodePoint(r)}if(s.startsWith("#")){const r=Number.parseInt(s.slice(1),10);return!Number.isFinite(r)||r>Hn?e:String.fromCodePoint(r)}return pi[s]??e}):""}function bi(t){const e=B.c(39),{url:s,onSave:r}=t,n=be(),[o,d]=q.useState(s??"");let l;e[0]!==o?(l=o.trim(),e[0]=o,e[1]=l):l=e[1];const i=l;let u;e[2]!==r||e[3]!==i?(u=()=>r(i?hl(i):null),e[2]=r,e[3]=i,e[4]=u):u=e[4];const c=u;let h;e[5]!==n?(h=n("thread.branchPicker.localHint"),e[5]=n,e[6]=h):h=e[6];let p;e[7]!==h?(p=a.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[7]=h,e[8]=p):p=e[8];let b;e[9]!==n?(b=n("thread.branchPicker.localUrlLabel"),e[9]=n,e[10]=b):b=e[10];let f;e[11]!==n?(f=n("thread.branchPicker.localUrlPlaceholder"),e[11]=n,e[12]=f):f=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=N=>d(N.target.value),e[13]=m):m=e[13];let g;e[14]!==c||e[15]!==i?(g=N=>{N.key==="Enter"&&i&&c()},e[14]=c,e[15]=i,e[16]=g):g=e[16];let x;e[17]!==b||e[18]!==f||e[19]!==g||e[20]!==o?(x=a.jsx("input",{type:"url",inputMode:"url","aria-label":b,placeholder:f,value:o,onChange:m,onKeyDown:g,className:"h-8 w-full rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[17]=b,e[18]=f,e[19]=g,e[20]=o,e[21]=x):x=e[21];let P;e[22]!==r||e[23]!==n||e[24]!==s?(P=s?a.jsx(ve,{variant:"ghost",size:"sm",className:"text-xs text-destructive hover:text-destructive",onClick:()=>r(null),children:n("thread.branchPicker.localTurnOff")}):a.jsx("span",{}),e[22]=r,e[23]=n,e[24]=s,e[25]=P):P=e[25];const j=!i;let y;e[26]!==n?(y=n("thread.branchPicker.save"),e[26]=n,e[27]=y):y=e[27];let S;e[28]!==c||e[29]!==j||e[30]!==y?(S=a.jsx(ve,{size:"sm",disabled:j,onClick:c,children:y}),e[28]=c,e[29]=j,e[30]=y,e[31]=S):S=e[31];let w;e[32]!==P||e[33]!==S?(w=a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[P,S]}),e[32]=P,e[33]=S,e[34]=w):w=e[34];let k;return e[35]!==w||e[36]!==p||e[37]!==x?(k=a.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[p,x,w]}),e[35]=w,e[36]=p,e[37]=x,e[38]=k):k=e[38],k}function gi(t){const e=B.c(8),{virtualMcpId:s,branch:r,serve:n,rowRef:o,onPicked:d}=t,l=Bt(s,r),i=!!n.connection,u=i&&l.kind==="protocol"&&l.source==="local";let c;e[0]!==d||e[1]!==n?(c=()=>xi(n,d),e[0]=d,e[1]=n,e[2]=c):c=e[2];let h;return e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==c?(h=a.jsx(vi,{rowRef:o,selected:i,connected:u,onSelect:c}),e[3]=o,e[4]=i,e[5]=u,e[6]=c,e[7]=h):h=e[7],h}function xi(t,e){e?.(),!t.connection&&t.set({endpoint:t.lastEndpoint??qa})}function vi(t){const e=B.c(19),{rowRef:s,selected:r,connected:n,onSelect:o}=t,d=be(),l=r?"bg-accent":"hover:bg-accent";let i;e[0]!==l?(i=K("flex rounded-lg",l),e[0]=l,e[1]=i):i=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx("span",{"data-testid":"localhost-dot",className:"h-2 w-2 shrink-0 rounded-full bg-foreground"}),e[2]=u):u=e[2];let c;e[3]!==d?(c=d("thread.branchPicker.localhost.label"),e[3]=d,e[4]=c):c=e[4];let h;e[5]!==c?(h=a.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),e[5]=c,e[6]=h):h=e[6];let p;e[7]!==n||e[8]!==d?(p=n&&a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:d("thread.branchPicker.localhost.connected")}),e[7]=n,e[8]=d,e[9]=p):p=e[9];let b;e[10]!==o||e[11]!==r||e[12]!==h||e[13]!==p?(b=a.jsxs("button",{type:"button","aria-pressed":r,onClick:o,className:"flex w-full min-w-0 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[u,h,p]}),e[10]=o,e[11]=r,e[12]=h,e[13]=p,e[14]=b):b=e[14];let f;return e[15]!==s||e[16]!==i||e[17]!==b?(f=a.jsx("div",{ref:s,className:i,children:b}),e[15]=s,e[16]=i,e[17]=b,e[18]=f):f=e[18],f}const yi=10080*60*1e3;function ji({sandboxMap:t,userId:e,rawBranches:s,now:r}){const n=new Map;for(const[h,p]of Object.entries(t??{}))for(const[b,f]of Object.entries(p??{})){let m=n.get(b);m||(m={userIds:new Set,lastActiveAt:0},n.set(b,m)),m.userIds.add(h);for(const g of Object.values(f??{})){const x=g?.createdAt??0;x>m.lastActiveAt&&(m.lastActiveAt=x)}}const o=r-yi,d=[...n.entries()].filter(([,h])=>h.lastActiveAt>=o).sort((h,p)=>p[1].lastActiveAt-h[1].lastActiveAt).map(([h,p])=>({name:h,source:"recent",contributors:[...p.userIds],lastActiveAt:p.lastActiveAt})),l=new Set(d.map(h=>h.name)),i=new Set(Object.keys(t?.[e]??{})),u=[...i].filter(h=>!l.has(h)).sort().map(h=>({name:h,source:"yours"})),c=s.filter(h=>!i.has(h.name)&&!l.has(h.name)).map(h=>({name:h.name,source:"other",author:h.author??null}));return{recent:d,yours:u,others:c}}const wi=100,Pi=50,Si=300;function nn(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function ki(t){const e=B.c(39),{orgId:s,orgSlug:r,userId:n,target:o,sandboxMap:d,owner:l,repo:i,search:u,enabled:c}=t,h=u===void 0?"":u,p=c===void 0?!0:c;let b;e[0]!==h?(b=h.trim(),e[0]=h,e[1]=b):b=e[1];const f=b,m=pl(f,Si);let g;e[2]!==o?(g=_r(o),e[2]=o,e[3]=g):g=e[3];const x=g,P=f.length>0;let j;e[4]!==m||e[5]!==s||e[6]!==r||e[7]!==l||e[8]!==i||e[9]!==o?(j=ss.githubBranchSearch(s,r,Mr(o),l,i,m),e[4]=m,e[5]=s,e[6]=r,e[7]=l,e[8]=i,e[9]=o,e[10]=j):j=e[10];const y=p&&x;let S;e[11]!==m||e[12]!==r||e[13]!==o?(S=D=>{const{pageParam:Z}=D;return ka(r,"REPOSITORY_SEARCH_BRANCHES",{...o,query:m,limit:m?Pi:wi,cursor:Z})},e[11]=m,e[12]=r,e[13]=o,e[14]=S):S=e[14];let w;e[15]!==m?(w=D=>m?void 0:D.nextCursor??void 0,e[15]=m,e[16]=w):w=e[16];let k;e[17]!==j||e[18]!==y||e[19]!==S||e[20]!==w?(k={queryKey:j,enabled:y,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:S,getNextPageParam:w},e[17]=j,e[18]=y,e[19]=S,e[20]=w,e[21]=k):k=e[21];const{data:N,isLoading:C,isError:v,isFetching:A,hasNextPage:T,isFetchingNextPage:I,fetchNextPage:_}=bl(k),$=P&&(m!==f||A),H=(N?.pages??[]).flatMap(Ni),O=Za(6e4),G=ji({sandboxMap:d,userId:n,rawBranches:H,now:O});let E;e[22]!==f?(E=D=>nn(D.name,f),e[22]=f,e[23]=E):E=e[23];const W=G.recent.filter(E);let F;e[24]!==f?(F=D=>nn(D.name,f),e[24]=f,e[25]=F):F=e[25];const V=G.yours.filter(F),te=G.others,Y=N?.pages[0],ne=P&&Y&&!$?Math.max(0,Y.totalCount-Y.branches.length):0,le=!P&&T;let M;e[26]!==_?(M=()=>{_()},e[26]=_,e[27]=M):M=e[27];let X;return e[28]!==ne||e[29]!==v||e[30]!==I||e[31]!==C||e[32]!==$||e[33]!==te||e[34]!==W||e[35]!==le||e[36]!==M||e[37]!==V?(X={recent:W,yours:V,others:te,isLoading:C,isError:v,isSearching:$,hiddenMatchCount:ne,hasMore:le,isFetchingMore:I,fetchMore:M},e[28]=ne,e[29]=v,e[30]=I,e[31]=C,e[32]=$,e[33]=te,e[34]=W,e[35]=le,e[36]=M,e[37]=V,e[38]=X):X=e[38],X}function Ni(t){return t.branches}function Ci(t){const e=B.c(6),s=be(),{releases:r,createRelease:n}=Vs(t.virtualMcpId);let o;return e[0]!==n||e[1]!==t.userId||e[2]!==t.userLabel||e[3]!==r||e[4]!==s?(o=()=>{if(r.length>=$s)return et.error(s("thread.branchPicker.capReached",{max:$s})),null;const d=gn(t.userLabel);return n({branch:d,name:Hr(r,s("thread.branchPicker.defaultVersionName")),color:ds(r.length),createdBy:t.userId,createdAt:new Date().toISOString()}).catch(l=>{et.error(s("thread.branchPicker.saveError"),{description:Pr(s,Sr(l))})}),d},e[0]=n,e[1]=t.userId,e[2]=t.userLabel,e[3]=r,e[4]=s,e[5]=o):o=e[5],o}const Ls="-mx-[3px] h-3.5 w-3.5 shrink-0";function Ai(t){const e=B.c(110),{virtualMcpId:s,isV8:r,userLabel:n,value:o,baseBranch:d,baseIsDraft:l,orgId:i,orgSlug:u,userId:c,target:h,owner:p,repo:b,sandboxMap:f,onChange:m,onCreateBranch:g,onAdoptBranch:x,disabled:P,spawnsNewChat:j,placement:y}=t,S=r===void 0?!1:r,w=l===void 0?!1:l,k=P===void 0?!1:P,N=j===void 0?!1:j,C=y===void 0?"chat":y,v=be(),A=C==="header",[T,I]=q.useState(!1),[_,$]=q.useState(!1),[H,O]=q.useState("branches"),[G,E]=q.useState(null),[W,F]=q.useState(""),[V,te]=q.useState(null),[Y,ne]=q.useState(null),le=q.useRef(null),{releases:M,createRelease:X,renameRelease:D,deleteRelease:Z}=Vs(s);let se;e[0]!==c||e[1]!==n||e[2]!==s?(se={virtualMcpId:s,userLabel:n,userId:c},e[0]=c,e[1]=n,e[2]=s,e[3]=se):se=e[3];const ie=Ci(se),ge=yl(s,S),ue=S?jl(M,ge.data):[],re=ge.refetch,fe=wl(s),{url:ye,setUrl:z,clear:oe}=fn(s),xe=mn(s),Q=S&&!!xe.connection,ee=S?xe.connection?.endpoint??null:ye,ce=!!ee;let J;e[4]!==oe||e[5]!==S||e[6]!==xe?(J=()=>{oe(),S&&xe.clear()},e[4]=oe,e[5]=S,e[6]=xe,e[7]=J):J=e[7];const de=J;let Me;e[8]!==T?(Me={enabled:T},e[8]=T,e[9]=Me):Me=e[9];const{data:mt}=Na(Me);let we;e[10]!==mt?.data?.members?(we=R=>R?mt?.data?.members?.find(pe=>pe.userId===R)?.user?.name??void 0:void 0,e[10]=mt?.data?.members,e[11]=we):we=e[11];const rt=we,Le=M.length>=$s,Re=M.length>1,Te=v("thread.branchPicker.capReached",{max:$s}),{isBase:Ee,current:Ne,storeDraft:at,unlisted:ze}=mi({value:o,baseBranch:d,releases:M,baseIsDraft:w,storeDrafts:ue}),$t=Ee?v("thread.branchPicker.live"):Ne?.name??at?.name??v("thread.branchPicker.defaultVersionName"),Oe=Q?v("thread.branchPicker.localhost.label"):ce?v("thread.branchPicker.localLabel"):o?$t:v("thread.branchPicker.selectVersion"),Qe=Q?"bg-foreground":ce?"bg-special":Ee?"bg-success":at?cs(void 0):cs(Ne?.color??"orange"),L=!Q&&!ce&&!Ee&&Ne?.runtime==="sandbox",me=R=>{de();const pe=ue.some(Ve=>Ve.name===R)?{runtime:"cms"}:M.find(Ve=>Ve.branch===R);m(R,pe&&{runtime:pe.runtime}),I(!1)};let Pe;e[12]!==v?(Pe=R=>{et.error(v("thread.branchPicker.saveError"),{description:Pr(v,Sr(R))})},e[12]=v,e[13]=Pe):Pe=e[13];const Se=Pe;let De;e[14]!==z?(De=R=>{z(R),$(!1),I(!1)},e[14]=z,e[15]=De):De=e[15];const pt=De,bt=(R,pe)=>{if(de(),x){x(R),$(!1),I(!1);return}if(!M.some(Ve=>Ve.branch===R)){if(Le){et.error(Te);return}X({branch:R,name:pe.trim()||R,color:ds(M.length),createdBy:c,createdAt:new Date().toISOString()}).catch(Se)}m(R),$(!1),I(!1)};let lt;e[16]!==de||e[17]!==m||e[18]!==g||e[19]!==ie?(lt=()=>{const R=ie();R&&(de(),(g??m)(R),I(!1))},e[16]=de,e[17]=m,e[18]=g,e[19]=ie,e[20]=lt):lt=e[20];const rs=lt;let gt;e[21]===Symbol.for("react.memo_cache_sentinel")?(gt=()=>{E(null),F(""),$(!1),O("branches")},e[21]=gt):gt=e[21];const as=gt;let it;e[22]===Symbol.for("react.memo_cache_sentinel")?(it=R=>{O(R),$(!0)},e[22]=it):it=e[22];const Ce=it;let ot;e[23]===Symbol.for("react.memo_cache_sentinel")?(ot=R=>{E(R.branch),F(R.name)},e[23]=ot):ot=e[23];const Ft=ot;let xt;e[24]!==W||e[25]!==D||e[26]!==Se?(xt=R=>{const pe=W.trim();pe&&D(R,pe).catch(Se),E(null),F("")},e[24]=W,e[25]=D,e[26]=Se,e[27]=xt):xt=e[27];const Qs=xt,Lt=R=>{const pe=R===void 0?o:R,Ve=W.trim();if(Ve&&pe){if(Le){et.error(Te),E(null),F("");return}X({branch:pe,name:Ve,color:ds(M.length),createdBy:c,createdAt:new Date().toISOString()}).catch(Se)}E(null),F("")};let Je;e[28]===Symbol.for("react.memo_cache_sentinel")?(Je=()=>{E(null),F("")},e[28]=Je):Je=e[28];const ct=Je,kt=()=>{const R=V;if(te(null),!(!R||!Re)){if(R.branch===o){const pe=M.filter(Sa=>Sa.branch!==R.branch),Ve=pe.find(Ri)??pe[0];Ve?me(Ve.branch):I(!1)}else I(!1);Z(R.branch).catch(Se)}},dt=Pl(M),ls=(dt.content.length>0||ue.length>0)&&dt.code.length>0,vt=R=>G===R.branch?a.jsx(Xs,{value:W,onChange:F,onSave:()=>Qs(R.branch),onCancel:ct},R.branch):a.jsx(Zs,{rowRef:!ce&&R.branch===o?le:void 0,dot:cs(R.color),codeIcon:R.runtime==="sandbox"?xs(R.color):void 0,label:R.name,creator:rt(R.createdBy),originTooltip:S?v("thread.branchPicker.viaStudioUi"):void 0,branch:!S||R.runtime==="sandbox"?R.branch:void 0,selected:!ce&&R.branch===o,onSelect:()=>me(R.branch),onRename:()=>Ft(R),onDelete:()=>te(R),deleteBlocked:!Re},R.branch),Nt=()=>{const R=Y;if(ne(null),!(!R||R.name===o&&M.length===0)){if(R.name===o){const pe=M[0];pe?me(pe.branch):I(!1)}fe.mutateAsync(R.name).catch(pe=>{et.error(v("thread.branchPicker.discardStoreDraftError"),{description:pe instanceof Error?pe.message:void 0})})}},Ct=ue.map((R,pe)=>G===R.name?a.jsx(Xs,{value:W,onChange:F,onSave:()=>Lt(R.name),onCancel:ct},`store:${R.name}`):a.jsx(Zs,{rowRef:!ce&&R.name===o?le:void 0,dot:cs(void 0),label:R.name,creator:rt(R.createdBy),agentIcon:xs(ds(pe)),originTooltip:v("thread.branchPicker.storeDraftVia",{via:Sl(R.via)}),selected:!ce&&R.name===o,onSelect:()=>me(R.name),onRename:()=>{E(R.name),F(R.name)},onDelete:()=>ne(R),deleteBlocked:R.name===o&&M.length===0},`store:${R.name}`));let yt;e[29]!==k||e[30]!==S||e[31]!==re?(yt=k?void 0:R=>{R?S&&re():as(),I(R)},e[29]=k,e[30]=S,e[31]=re,e[32]=yt):yt=e[32];const At=A?"text-xs":"text-xs text-muted-foreground hover:text-foreground";let Ye;e[33]!==At?(Ye=K("shrink min-w-0 max-w-[220px] gap-2",At,Ar),e[33]=At,e[34]=Ye):Ye=e[34];let jt;e[35]!==k?(jt=!k&&a.jsx(Dr,{size:12,className:"opacity-60 shrink-0"}),e[35]=k,e[36]=jt):jt=e[36];let ut;e[37]!==Oe?(ut=a.jsx(nt,{children:Oe}),e[37]=Oe,e[38]=ut):ut=e[38];const Rt=sl,is="w-[min(300px,calc(100vw-2rem))] p-1.5",os="start";let Be;e[39]===Symbol.for("react.memo_cache_sentinel")?(Be=R=>{R.preventDefault(),le.current?.scrollIntoView({block:"nearest"})},e[39]=Be):Be=e[39];let Ie;e[40]!==N||e[41]!==v?(Ie=N&&a.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:v("thread.branchPicker.newChatHint")}),e[40]=N,e[41]=v,e[42]=Ie):Ie=e[42];const Xe=_?a.jsx(Di,{orgId:i,orgSlug:u,userId:c,target:h,owner:p,repo:b,sandboxMap:f,enabled:T,tab:H,onTabChange:O,isV8:S,localUrl:ye,onSaveLocal:pt,onBack:()=>$(!1),onAdopt:bt}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:K("always-scrollbar flex max-h-[min(50vh,20rem)] flex-col overflow-y-auto",S&&"gap-1"),children:[!S&&ce&&ee&&a.jsx(Ti,{rowRef:le,url:ee,onSelect:()=>Ce("local"),onEdit:()=>Ce("local"),onTurnOff:()=>de()}),ze&&o&&(G===o?a.jsx(Xs,{value:W,onChange:F,onSave:()=>Lt(),onCancel:ct}):a.jsx(Zs,{rowRef:ce?void 0:le,dot:cs("orange"),label:v("thread.branchPicker.defaultVersionName"),branch:S?void 0:o,originTooltip:S?v("thread.branchPicker.viaStudioUi"):void 0,selected:!ce,onSelect:()=>me(o),onRename:()=>{E(o),F(Hr(M,v("thread.branchPicker.defaultVersionName")))}})),ls?a.jsxs(a.Fragment,{children:[a.jsx(Vn,{children:v("thread.branchPicker.groupContent")}),dt.content.map(vt),Ct,a.jsx(Vn,{divided:!0,children:v("thread.branchPicker.groupCode")}),dt.code.map(vt)]}):a.jsxs(a.Fragment,{children:[M.map(vt),Ct]}),S&&a.jsx(gi,{virtualMcpId:s,branch:o,serve:xe,rowRef:Q?le:void 0,onPicked:()=>I(!1)})]}),(ze||M.length>0||ue.length>0||S)&&a.jsx("div",{className:"my-1 border-t"}),a.jsxs("button",{type:"button",onClick:()=>{rs()},disabled:Le,className:"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground disabled:pointer-events-none disabled:opacity-50",children:[a.jsx(Or,{className:"h-4 w-4 shrink-0"}),v("thread.branchPicker.newVersion")]}),Le&&a.jsx("p",{className:"px-2 pb-1 pt-0.5 text-xs text-warning",children:Te}),a.jsxs("button",{type:"button",onClick:()=>Ce("branches"),className:K("flex w-full items-center justify-between gap-2 rounded-lg px-2 py-2 text-left text-xs text-muted-foreground hover:bg-accent hover:text-foreground",S&&"mt-1"),children:[v("thread.branchPicker.advanced"),a.jsx(or,{className:"h-4 w-4 shrink-0"})]})]});let Ue;e[43]!==Rt||e[44]!==Be||e[45]!==Ie||e[46]!==Xe?(Ue=a.jsxs(Rt,{className:is,align:os,onOpenAutoFocus:Be,children:[Ie,Xe]}),e[43]=Rt,e[44]=Be,e[45]=Ie,e[46]=Xe,e[47]=Ue):Ue=e[47];const wt=a.jsxs(nl,{open:T,onOpenChange:yt,children:[a.jsxs(tt,{children:[a.jsx(st,{asChild:!0,children:a.jsx("span",{className:"inline-flex min-w-0 shrink",children:a.jsx(rl,{asChild:!0,children:a.jsxs(ve,{"data-tour":el.branchPicker,variant:A?"outline":"ghost",size:A?"sm":"default","aria-label":Oe,disabled:k,className:Ye,children:[L?a.jsx(Br,{className:K(Ls,xs(Ne?.color))}):at&&!ce?a.jsx(cr,{className:K(Ls,xs(ds(ue.indexOf(at))))}):a.jsx("span",{className:K("h-2 w-2 shrink-0 rounded-full",o||ce?Qe:"bg-muted-foreground")}),a.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:Oe}),jt]})})})}),ut]}),Ue]}),Ze=V!==null;let qe;e[48]===Symbol.for("react.memo_cache_sentinel")?(qe=R=>{R||te(null)},e[48]=qe):qe=e[48];let $e;e[49]!==v?($e=v("thread.branchPicker.deleteTitle"),e[49]=v,e[50]=$e):$e=e[50];let Fe;e[51]!==$e?(Fe=a.jsx(ks,{children:$e}),e[51]=$e,e[52]=Fe):Fe=e[52];let He;e[53]!==V||e[54]!==v?(He=V&&v("thread.branchPicker.deleteConfirm",{name:V.name}),e[53]=V,e[54]=v,e[55]=He):He=e[55];let U;e[56]!==He?(U=a.jsx(Ns,{children:He}),e[56]=He,e[57]=U):U=e[57];let ae;e[58]!==Fe||e[59]!==U?(ae=a.jsxs(Cs,{children:[Fe,U]}),e[58]=Fe,e[59]=U,e[60]=ae):ae=e[60];let he;e[61]!==v?(he=v("thread.branchPicker.cancel"),e[61]=v,e[62]=he):he=e[62];let je;e[63]!==he?(je=a.jsx(As,{children:he}),e[63]=he,e[64]=je):je=e[64];let Ae;e[65]!==v?(Ae=v("thread.branchPicker.delete"),e[65]=v,e[66]=Ae):Ae=e[66];let Ke;e[67]!==kt||e[68]!==Ae?(Ke=a.jsx(Rs,{onClick:kt,variant:"destructive",children:Ae}),e[67]=kt,e[68]=Ae,e[69]=Ke):Ke=e[69];let Ot;e[70]!==je||e[71]!==Ke?(Ot=a.jsxs(Ts,{children:[je,Ke]}),e[70]=je,e[71]=Ke,e[72]=Ot):Ot=e[72];let _t;e[73]!==ae||e[74]!==Ot?(_t=a.jsxs(Ds,{children:[ae,Ot]}),e[73]=ae,e[74]=Ot,e[75]=_t):_t=e[75];let ps;e[76]!==Ze||e[77]!==_t?(ps=a.jsx(Bs,{open:Ze,onOpenChange:qe,children:_t}),e[76]=Ze,e[77]=_t,e[78]=ps):ps=e[78];const Js=Y!==null;let bs;e[79]===Symbol.for("react.memo_cache_sentinel")?(bs=R=>{R||ne(null)},e[79]=bs):bs=e[79];let Mt;e[80]!==v?(Mt=v("thread.branchPicker.deleteTitle"),e[80]=v,e[81]=Mt):Mt=e[81];let Et;e[82]!==Mt?(Et=a.jsx(ks,{children:Mt}),e[82]=Mt,e[83]=Et):Et=e[83];let zt;e[84]!==Y||e[85]!==v?(zt=Y&&v("thread.branchPicker.discardStoreDraftConfirm",{name:Y.name}),e[84]=Y,e[85]=v,e[86]=zt):zt=e[86];let Ut;e[87]!==zt?(Ut=a.jsx(Ns,{children:zt}),e[87]=zt,e[88]=Ut):Ut=e[88];let qt;e[89]!==Et||e[90]!==Ut?(qt=a.jsxs(Cs,{children:[Et,Ut]}),e[89]=Et,e[90]=Ut,e[91]=qt):qt=e[91];let Ht;e[92]!==v?(Ht=v("thread.branchPicker.cancel"),e[92]=v,e[93]=Ht):Ht=e[93];let Kt;e[94]!==Ht?(Kt=a.jsx(As,{children:Ht}),e[94]=Ht,e[95]=Kt):Kt=e[95];let Vt;e[96]!==v?(Vt=v("thread.branchPicker.delete"),e[96]=v,e[97]=Vt):Vt=e[97];let Gt;e[98]!==Nt||e[99]!==Vt?(Gt=a.jsx(Rs,{onClick:Nt,variant:"destructive",children:Vt}),e[98]=Nt,e[99]=Vt,e[100]=Gt):Gt=e[100];let Wt;e[101]!==Kt||e[102]!==Gt?(Wt=a.jsxs(Ts,{children:[Kt,Gt]}),e[101]=Kt,e[102]=Gt,e[103]=Wt):Wt=e[103];let Qt;e[104]!==qt||e[105]!==Wt?(Qt=a.jsxs(Ds,{children:[qt,Wt]}),e[104]=qt,e[105]=Wt,e[106]=Qt):Qt=e[106];let gs;return e[107]!==Js||e[108]!==Qt?(gs=a.jsx(Bs,{open:Js,onOpenChange:bs,children:Qt}),e[107]=Js,e[108]=Qt,e[109]=gs):gs=e[109],a.jsxs(a.Fragment,{children:[wt,ps,gs]})}function Ri(t){return t.runtime!=="sandbox"}function Xs(t){const e=B.c(20),{value:s,onChange:r,onSave:n,onCancel:o}=t,d=be();let l;e[0]!==d?(l=d("thread.branchPicker.rename"),e[0]=d,e[1]=l):l=e[1];let i;e[2]!==r?(i=f=>r(f.target.value),e[2]=r,e[3]=i):i=e[3];let u;e[4]!==o||e[5]!==n?(u=f=>{f.key==="Enter"&&n(),f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),o())},e[4]=o,e[5]=n,e[6]=u):u=e[6];let c;e[7]!==l||e[8]!==i||e[9]!==u||e[10]!==s?(c=a.jsx("input",{autoFocus:!0,"aria-label":l,value:s,onChange:i,onKeyDown:u,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[7]=l,e[8]=i,e[9]=u,e[10]=s,e[11]=c):c=e[11];let h;e[12]!==d?(h=d("thread.branchPicker.save"),e[12]=d,e[13]=h):h=e[13];let p;e[14]!==n||e[15]!==h?(p=a.jsx(ve,{size:"sm",onClick:n,children:h}),e[14]=n,e[15]=h,e[16]=p):p=e[16];let b;return e[17]!==c||e[18]!==p?(b=a.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[c,p]}),e[17]=c,e[18]=p,e[19]=b):b=e[19],b}function Vn(t){const e=B.c(5),{divided:s,children:r}=t,o=(s===void 0?!1:s)&&"mt-1 border-t";let d;e[0]!==o?(d=K("px-2 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",o),e[0]=o,e[1]=d):d=e[1];let l;return e[2]!==r||e[3]!==d?(l=a.jsx("p",{className:d,children:r}),e[2]=r,e[3]=d,e[4]=l):l=e[4],l}function Zs(t){const e=B.c(53),{rowRef:s,dot:r,codeIcon:n,agentIcon:o,originTooltip:d,label:l,creator:i,branch:u,selected:c,onSelect:h,onRename:p,onDelete:b,deleteBlocked:f}=t,m=f===void 0?!1:f,g=be();let x;e[0]!==o||e[1]!==n||e[2]!==r?(x=n?a.jsx(Br,{className:K(Ls,n)}):o?a.jsx(cr,{className:K(Ls,o)}):a.jsx("span",{className:K("h-2 w-2 shrink-0 rounded-full",r)}),e[0]=o,e[1]=n,e[2]=r,e[3]=x):x=e[3];let P;e[4]!==i?(P=i&&a.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:i}),e[4]=i,e[5]=P):P=e[5];let j;e[6]!==l||e[7]!==P?(j=a.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[l,P]}),e[6]=l,e[7]=P,e[8]=j):j=e[8];let y;e[9]!==h||e[10]!==c||e[11]!==x||e[12]!==j?(y=a.jsxs("button",{type:"button","aria-pressed":c,onClick:h,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[x,j]}),e[9]=h,e[10]=c,e[11]=x,e[12]=j,e[13]=y):y=e[13];const S=y,w=c?"bg-accent":"hover:bg-accent";let k;e[14]!==w?(k=K("group flex items-center rounded-lg",w),e[14]=w,e[15]=k):k=e[15];let N;e[16]!==u||e[17]!==n||e[18]!==d||e[19]!==S||e[20]!==g?(N=u||d?a.jsxs(tt,{children:[a.jsx(st,{asChild:!0,children:S}),a.jsxs(nt,{side:"bottom",className:"text-xs",children:[n&&a.jsx("p",{className:"font-medium",children:g("thread.branchPicker.codeDraftTooltip")}),d&&a.jsx("p",{children:d}),u&&a.jsx("p",{className:"font-mono",children:g("thread.branchPicker.branchTooltip",{branch:u})})]})]}):S,e[16]=u,e[17]=n,e[18]=d,e[19]=S,e[20]=g,e[21]=N):N=e[21];let C;e[22]!==g?(C=g("thread.branchPicker.moreActions"),e[22]=g,e[23]=C):C=e[23];let v;e[24]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(Fr,{className:"h-4 w-4"}),e[24]=v):v=e[24];let A;e[25]!==C?(A=a.jsx(_s,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"icon","aria-label":C,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:v})}),e[25]=C,e[26]=A):A=e[26];let T;e[27]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(Lr,{className:"h-4 w-4"}),e[27]=T):T=e[27];let I;e[28]!==g?(I=g("thread.branchPicker.rename"),e[28]=g,e[29]=I):I=e[29];let _;e[30]!==p||e[31]!==I?(_=a.jsxs(Xt,{onSelect:p,children:[T,I]}),e[30]=p,e[31]=I,e[32]=_):_=e[32];let $;e[33]!==m||e[34]!==b||e[35]!==g?($=b&&a.jsxs(Xt,{onSelect:b,disabled:m,className:"text-destructive focus:text-destructive",children:[a.jsx(Hs,{className:"h-4 w-4"}),g("thread.branchPicker.delete")]}),e[33]=m,e[34]=b,e[35]=g,e[36]=$):$=e[36];let H;e[37]!==m||e[38]!==b||e[39]!==g?(H=b&&m&&a.jsx("p",{className:"max-w-48 px-2 pb-1.5 text-xs text-muted-foreground",children:g("thread.branchPicker.keepOneDraft")}),e[37]=m,e[38]=b,e[39]=g,e[40]=H):H=e[40];let O;e[41]!==_||e[42]!==$||e[43]!==H?(O=a.jsxs(Ms,{align:"end",children:[_,$,H]}),e[41]=_,e[42]=$,e[43]=H,e[44]=O):O=e[44];let G;e[45]!==A||e[46]!==O?(G=a.jsxs(Es,{children:[A,O]}),e[45]=A,e[46]=O,e[47]=G):G=e[47];let E;return e[48]!==s||e[49]!==G||e[50]!==k||e[51]!==N?(E=a.jsxs("div",{ref:s,className:k,children:[N,G]}),e[48]=s,e[49]=G,e[50]=k,e[51]=N,e[52]=E):E=e[52],E}function Ti(t){const e=B.c(40),{rowRef:s,url:r,onSelect:n,onEdit:o,onTurnOff:d}=t,l=be();let i;try{let A;e[0]!==r?(A=new URL(r),e[0]=r,e[1]=A):A=e[1],i=A.host}catch{i=r}const u=i;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=a.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-special"}),e[2]=c):c=e[2];let h;e[3]!==l?(h=l("thread.branchPicker.localLabel"),e[3]=l,e[4]=h):h=e[4];let p;e[5]!==u?(p=a.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:u}),e[5]=u,e[6]=p):p=e[6];let b;e[7]!==h||e[8]!==p?(b=a.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[h,p]}),e[7]=h,e[8]=p,e[9]=b):b=e[9];let f;e[10]!==n||e[11]!==b?(f=a.jsxs("button",{type:"button","aria-pressed":!0,onClick:n,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[c,b]}),e[10]=n,e[11]=b,e[12]=f):f=e[12];let m;e[13]!==l?(m=l("thread.branchPicker.moreActions"),e[13]=l,e[14]=m):m=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(Fr,{className:"h-4 w-4"}),e[15]=g):g=e[15];let x;e[16]!==m?(x=a.jsx(_s,{asChild:!0,children:a.jsx(ve,{variant:"ghost",size:"icon","aria-label":m,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:g})}),e[16]=m,e[17]=x):x=e[17];let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=a.jsx(Lr,{className:"h-4 w-4"}),e[18]=P):P=e[18];let j;e[19]!==l?(j=l("thread.branchPicker.rename"),e[19]=l,e[20]=j):j=e[20];let y;e[21]!==o||e[22]!==j?(y=a.jsxs(Xt,{onSelect:o,children:[P,j]}),e[21]=o,e[22]=j,e[23]=y):y=e[23];let S;e[24]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsx(Hs,{className:"h-4 w-4"}),e[24]=S):S=e[24];let w;e[25]!==l?(w=l("thread.branchPicker.localTurnOff"),e[25]=l,e[26]=w):w=e[26];let k;e[27]!==d||e[28]!==w?(k=a.jsxs(Xt,{onSelect:d,className:"text-destructive focus:text-destructive",children:[S,w]}),e[27]=d,e[28]=w,e[29]=k):k=e[29];let N;e[30]!==y||e[31]!==k?(N=a.jsxs(Ms,{align:"end",children:[y,k]}),e[30]=y,e[31]=k,e[32]=N):N=e[32];let C;e[33]!==N||e[34]!==x?(C=a.jsxs(Es,{children:[x,N]}),e[33]=N,e[34]=x,e[35]=C):C=e[35];let v;return e[36]!==s||e[37]!==C||e[38]!==f?(v=a.jsxs("div",{ref:s,className:"group flex items-center rounded-lg bg-accent",children:[f,C]}),e[36]=s,e[37]=C,e[38]=f,e[39]=v):v=e[39],v}function Di(t){const e=B.c(73),{orgId:s,orgSlug:r,userId:n,target:o,owner:d,repo:l,sandboxMap:i,enabled:u,tab:c,onTabChange:h,isV8:p,localUrl:b,onSaveLocal:f,onBack:m,onAdopt:g}=t,x=be(),[P,j]=q.useState(""),y=c==="branches"?P:"",S=u&&c==="branches";let w;e[0]!==s||e[1]!==r||e[2]!==d||e[3]!==l||e[4]!==i||e[5]!==y||e[6]!==S||e[7]!==o||e[8]!==n?(w={orgId:s,orgSlug:r,userId:n,target:o,sandboxMap:i,owner:d,repo:l,search:y,enabled:S},e[0]=s,e[1]=r,e[2]=d,e[3]=l,e[4]=i,e[5]=y,e[6]=S,e[7]=o,e[8]=n,e[9]=w):w=e[9];const{recent:k,yours:N,others:C,isLoading:v,hasMore:A,isFetchingMore:T,fetchMore:I}=ki(w),_=u&&c==="prs";let $;e[10]!==s||e[11]!==r||e[12]!==d||e[13]!==l||e[14]!==_||e[15]!==o?($={orgId:s,orgSlug:r,target:o,owner:d,repo:l,enabled:_},e[10]=s,e[11]=r,e[12]=d,e[13]=l,e[14]=_,e[15]=o,e[16]=$):$=e[16];const{data:H,isLoading:O}=gl($);let G;if(e[17]!==I||e[18]!==A||e[19]!==T||e[20]!==v||e[21]!==p||e[22]!==b||e[23]!==g||e[24]!==m||e[25]!==f||e[26]!==h||e[27]!==C||e[28]!==d||e[29]!==O||e[30]!==k||e[31]!==l||e[32]!==P||e[33]!==x||e[34]!==H||e[35]!==c||e[36]!==N){const E=H===void 0?[]:H,W=`${d}/${l}`;let F;e[38]!==W?(F=W.toLowerCase(),e[38]=W,e[39]=F):F=e[39];const V=F;let te;e[40]!==V?(te=z=>z.headRepoFullName?.toLowerCase()===V,e[40]=V,e[41]=te):te=e[41];const Y=E.filter(te);let ne;if(e[42]!==C||e[43]!==k||e[44]!==N){const z=new Set;ne=[...k,...N,...C].filter(oe=>z.has(oe.name)?!1:(z.add(oe.name),!0)),e[42]=C,e[43]=k,e[44]=N,e[45]=ne}else ne=e[45];const le=ne;let M;e[46]===Symbol.for("react.memo_cache_sentinel")?(M=a.jsx(ol,{className:"h-4 w-4 shrink-0"}),e[46]=M):M=e[46];let X;e[47]!==x?(X=x("thread.branchPicker.advancedBack"),e[47]=x,e[48]=X):X=e[48];let D;e[49]!==m||e[50]!==X?(D=a.jsxs("button",{type:"button",onClick:m,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[M,X]}),e[49]=m,e[50]=X,e[51]=D):D=e[51];let Z;e[52]!==h?(Z=z=>{h(z),j("")},e[52]=h,e[53]=Z):Z=e[53];let se;e[54]!==x?(se=x("thread.branchPicker.branchesTab"),e[54]=x,e[55]=se):se=e[55];let ie;e[56]!==se?(ie=a.jsx(Tt,{value:"branches",className:"h-6 px-2.5 text-xs",children:se}),e[56]=se,e[57]=ie):ie=e[57];let ge;e[58]!==x?(ge=x("thread.branchPicker.prsTab"),e[58]=x,e[59]=ge):ge=e[59];let ue;e[60]!==ge?(ue=a.jsx(Tt,{value:"prs",className:"h-6 px-2.5 text-xs",children:ge}),e[60]=ge,e[61]=ue):ue=e[61];let re;e[62]!==p||e[63]!==x?(re=!p&&a.jsx(Tt,{value:"local",className:"h-6 px-2.5 text-xs",children:x("thread.branchPicker.localTab")}),e[62]=p,e[63]=x,e[64]=re):re=e[64];let fe;e[65]!==ie||e[66]!==ue||e[67]!==re?(fe=a.jsxs(Rr,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[ie,ue,re]}),e[65]=ie,e[66]=ue,e[67]=re,e[68]=fe):fe=e[68];let ye;e[69]!==Z||e[70]!==fe||e[71]!==c?(ye=a.jsx(Tr,{className:"px-2 pt-2 pb-1",value:c,onValueChange:Z,children:fe}),e[69]=Z,e[70]=fe,e[71]=c,e[72]=ye):ye=e[72],G=a.jsxs("div",{className:"flex flex-col",children:[D,ye,c==="local"&&!p?a.jsx(bi,{url:b,onSave:f}):a.jsxs(al,{filter:c==="branches"?Bi:void 0,children:[a.jsx(ll,{placeholder:x(c==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),value:P,onValueChange:j}),a.jsx(il,{onScroll:z=>{const oe=z.currentTarget;c==="branches"&&oe.scrollHeight-oe.scrollTop-oe.clientHeight<48&&I()},children:c==="branches"?a.jsxs(a.Fragment,{children:[v&&a.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:x("thread.branchPicker.loadingMore")}),!v&&le.length===0&&a.jsx(En,{children:x("thread.branchPicker.noBranchesFound")}),le.length>0&&a.jsx(zn,{children:le.map(z=>a.jsxs(Un,{value:z.name,className:"cursor-pointer",onSelect:()=>g(z.name,z.name),children:[a.jsx(Ca,{className:"mr-2 h-4 w-4 shrink-0"}),a.jsx("span",{className:"flex-1 truncate",children:z.name})]},z.name))}),A&&a.jsx("div",{className:"p-2",children:a.jsx(ve,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:T,onClick:I,children:x(T?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):a.jsxs(a.Fragment,{children:[O&&a.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:x("thread.branchPicker.loadingPullRequests")}),!O&&Y.length===0&&a.jsx(En,{children:x("thread.branchPicker.noOpenPullRequests")}),Y.length>0&&a.jsx(zn,{children:Y.map(z=>a.jsxs(Un,{value:`#${z.number} ${z.title} ${z.head}`,className:"cursor-pointer",onSelect:()=>g(z.head,Kn(z.title)),children:[a.jsx(qs,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[a.jsx("span",{className:"truncate",children:Kn(z.title)}),a.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",z.number," · ",z.head]})]})]},z.number))})]})})]})]}),e[17]=I,e[18]=A,e[19]=T,e[20]=v,e[21]=p,e[22]=b,e[23]=g,e[24]=m,e[25]=f,e[26]=h,e[27]=C,e[28]=d,e[29]=O,e[30]=k,e[31]=l,e[32]=P,e[33]=x,e[34]=H,e[35]=c,e[36]=N,e[37]=G}else G=e[37];return G}function Bi(t,e){return nn(t,e)?1:0}function Ii(t){const e=B.c(19),{locked:s,placement:r,value:n,virtualMcpId:o,isV8:d,userLabel:l,baseBranch:i,baseIsDraft:u,onChange:c,onCreateBranch:h,onAdoptBranch:p,orgId:b,orgSlug:f,userId:m,target:g,owner:x,repo:P,sandboxMap:j}=t;let y;return e[0]!==i||e[1]!==u||e[2]!==d||e[3]!==s||e[4]!==p||e[5]!==c||e[6]!==h||e[7]!==b||e[8]!==f||e[9]!==x||e[10]!==r||e[11]!==P||e[12]!==j||e[13]!==g||e[14]!==m||e[15]!==l||e[16]!==n||e[17]!==o?(y=a.jsx(Ai,{virtualMcpId:o,isV8:d,userLabel:l,value:n,baseBranch:i,baseIsDraft:u,orgId:b,orgSlug:f,userId:m,target:g,owner:x,repo:P,sandboxMap:j,onChange:c,onCreateBranch:h,onAdoptBranch:p,spawnsNewChat:s,placement:r}),e[0]=i,e[1]=u,e[2]=d,e[3]=s,e[4]=p,e[5]=c,e[6]=h,e[7]=b,e[8]=f,e[9]=x,e[10]=r,e[11]=P,e[12]=j,e[13]=g,e[14]=m,e[15]=l,e[16]=n,e[17]=o,e[18]=y):y=e[18],y}function $i(t){const e=B.c(2),{branchPill:s}=t;if(!s)return null;let r;return e[0]!==s?(r=a.jsx(a.Fragment,{children:s}),e[0]=s,e[1]=r):r=e[1],r}function Fi(t){const{locked:e,sessionRuntime:s,projectRuntime:r,draftRuntime:n,current:o}=t;return t.contentOnly&&n==="cms"?s==="cms"&&!e?{kind:"switch"}:{kind:"new-chat",runtime:"cms"}:n==="sandbox"&&s!=="sandbox"?{kind:"new-chat",runtime:"sandbox"}:n==="cms"&&s==="sandbox"&&r==="cms"&&!o?{kind:"new-chat"}:e?s==="sandbox"?{kind:"new-chat",runtime:"sandbox"}:{kind:"new-chat"}:{kind:"switch"}}function Li(t){const e=B.c(25),{virtualMcp:s,currentBranch:r}=t,n=za(),o=ns();let d;e[0]!==n?.messages||e[1]!==o?.isThreadLocked?(d=(n?.messages??[]).length>0||(o?.isThreadLocked??!1),e[0]=n?.messages,e[1]=o?.isThreadLocked,e[2]=d):d=e[2];const l=d,i=o?.setCurrentTaskBranch,u=o?.createTask,c=fs(s?.id),h=c.runtime,p=s?.metadata;let b;e[3]!==p?(b=fl(p),e[3]=p,e[4]=b):b=e[4];const f=b,m=f==="cms"&&h==="sandbox",g=ml(s),x=_e(g),{data:P}=zs.useSession(),j=P?.user;let y;e[5]!==j?(y=xn(j),e[5]=j,e[6]=y):y=e[6];const S=y,w=P?.user?.id??"",{org:k}=hs(),N=xl(s,r),C=vn(s?.id),v=C&&h==="cms";let A;e[7]!==u||e[8]!==r||e[9]!==l||e[10]!==f||e[11]!==h||e[12]!==c.resolved||e[13]!==i||e[14]!==C?(A=(E,W)=>{const F=Fi({locked:l,sessionRuntime:c.resolved?h:null,projectRuntime:f,draftRuntime:W&&(W.runtime??f),current:E===r,contentOnly:C});F.kind==="new-chat"&&u?u({branch:E,...F.runtime?{runtime:F.runtime}:{}}):i&&i(E)},e[7]=u,e[8]=r,e[9]=l,e[10]=f,e[11]=h,e[12]=c.resolved,e[13]=i,e[14]=C,e[15]=A):A=e[15];const T=A;let I;e[16]!==m||e[17]!==u||e[18]!==l||e[19]!==i?(I=E=>{(l||m)&&u?u({branch:E}):i&&i(E)},e[16]=m,e[17]=u,e[18]=l,e[19]=i,e[20]=I):I=e[20];const _=I;let $;e[21]!==u?($=u?E=>u({runtime:"sandbox",branch:E}):void 0,e[21]=u,e[22]=$):$=e[22];const H=$,O=g&&_r(x)?a.jsx(Ii,{userLabel:S,virtualMcpId:s?.id??"",isV8:C,value:r,baseBranch:N,baseIsDraft:v,orgId:k.id,orgSlug:k.slug,userId:w,target:x,owner:g.owner,repo:g.name,sandboxMap:s?.metadata?.sandboxMap,onChange:T,onCreateBranch:_,onAdoptBranch:H,locked:l,placement:"chat"},`${Mr(x)}:${g.owner}/${g.name}`):null;let G;return e[23]!==O?(G=a.jsx($i,{branchPill:O}),e[23]=O,e[24]=G):G=e[24],G}const Oi=Aa("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function _i(t){const e=B.c(11);let s,r,n;e[0]!==t?({className:s,orientation:r,...n}=t,e[0]=t,e[1]=s,e[2]=r,e[3]=n):(s=e[1],r=e[2],n=e[3]);let o;e[4]!==s||e[5]!==r?(o=K(Oi({orientation:r}),s),e[4]=s,e[5]=r,e[6]=o):o=e[6];let d;return e[7]!==r||e[8]!==n||e[9]!==o?(d=a.jsx("div",{role:"group","data-slot":"button-group","data-orientation":r,className:o,...n}),e[7]=r,e[8]=n,e[9]=o,e[10]=d):d=e[10],d}function Mi(t){const e=B.c(14),{item:s}=t;let r;e[0]!==s?(r=()=>{s.onSelect()},e[0]=s,e[1]=r):r=e[1];let n;e[2]!==s.disabled||e[3]!==s.icon||e[4]!==s.label||e[5]!==r?(n=a.jsxs(Xt,{disabled:s.disabled,onSelect:r,children:[s.icon,s.label]}),e[2]=s.disabled,e[3]=s.icon,e[4]=s.label,e[5]=r,e[6]=n):n=e[6];const o=n;if(!s.tooltip)return o;let d;e[7]!==o?(d=a.jsx(st,{asChild:!0,children:o}),e[7]=o,e[8]=d):d=e[8];let l;e[9]!==s.tooltip?(l=a.jsx(nt,{side:"right",children:s.tooltip}),e[9]=s.tooltip,e[10]=l):l=e[10];let i;return e[11]!==d||e[12]!==l?(i=a.jsxs(tt,{children:[d,l]}),e[11]=d,e[12]=l,e[13]=i):i=e[13],i}function Xr(t){const e=B.c(20),{label:s,onClick:r,variant:n,size:o,disabled:d,loading:l,pulse:i,tooltip:u,icon:c,items:h,menuAriaLabel:p,className:b}=t,f=n===void 0?"default":n,m=o===void 0?"default":o,g=d===void 0?!1:d,x=l===void 0?!1:l,P=i===void 0?!1:i,j=(h?.length??0)>0;let y;if(e[0]!==b||e[1]!==g||e[2]!==j||e[3]!==c||e[4]!==h||e[5]!==s||e[6]!==x||e[7]!==p||e[8]!==r||e[9]!==P||e[10]!==m||e[11]!==u||e[12]!==f){const S=K(Ar,f==="default"&&"focus-visible:inset-ring-current");let w;e[14]!==c||e[15]!==x?(w=x?a.jsx(Zt,{size:"xs"}):c,e[14]=c,e[15]=x,e[16]=w):w=e[16];const k=a.jsxs(ve,{type:"button",variant:f,size:m,disabled:g,"aria-busy":x||void 0,onClick:x?void 0:r,className:K(S,j&&"rounded-r-none border-r border-current/20"),children:[w,s]}),N=P&&"animate-pulse-brightness motion-reduce:animate-none motion-reduce:opacity-80";let C;e[17]!==b||e[18]!==N?(C=K(N,b),e[17]=b,e[18]=N,e[19]=C):C=e[19],y=a.jsxs(_i,{className:C,children:[u?a.jsxs(tt,{children:[a.jsx(st,{asChild:!0,children:a.jsx("span",{className:K("inline-flex rounded-lg outline-none",S,g&&"cursor-not-allowed"),tabIndex:g?0:void 0,role:g?"button":void 0,"aria-disabled":g||void 0,children:k})}),a.jsx(nt,{children:u})]}):k,j?a.jsxs(Es,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(ve,{type:"button",variant:f,size:m,"aria-label":p,className:K("has-[>svg]:px-2",S),children:a.jsx(Dr,{className:"size-3.5"})})}),a.jsx(Ms,{align:"end",children:h?.map(Ei)})]}):null]}),e[0]=b,e[1]=g,e[2]=j,e[3]=c,e[4]=h,e[5]=s,e[6]=x,e[7]=p,e[8]=r,e[9]=P,e[10]=m,e[11]=u,e[12]=f,e[13]=y}else y=e[13];return y}function Ei(t){return a.jsx(Mi,{item:t},t.key)}async function zi(t){if(t.hosted)return;const e=t.branch;await t.setCurrentTaskBranch(t.nextBranch()),e&&e!==t.baseBranch&&await t.deleteRelease(e)}function Ui(t,e,{hosted:s}){return s&&t!==null?t:e}function qi(t,e){const s=B.c(11),[r,n]=q.useState(null);let o;s[0]!==r||s[1]!==t||s[2]!==e?(o=Ui(r,t,e),s[0]=r,s[1]=t,s[2]=e,s[3]=o):o=s[3];let d;s[4]!==t||s[5]!==e?(d=()=>n(e.hosted?t:null),s[4]=t,s[5]=e,s[6]=d):d=s[6];let l;s[7]===Symbol.for("react.memo_cache_sentinel")?(l=()=>n(null),s[7]=l):l=s[7];let i;return s[8]!==o||s[9]!==d?(i={shown:o,hold:d,release:l},s[8]=o,s[9]=d,s[10]=i):i=s[10],i}function Hi({open:t,hosted:e}){return t||e}function Zr(t){return Fl({userName:t?.name,userEmail:t?.email})??void 0}function Gs(t){const e=B.c(18),{state:s,header:r,body:n,note:o,gate:d,footer:l}=t,i=s!=="ready";let u;e[0]!==r?(u=a.jsx("div",{className:"space-y-0.5 px-4 py-3",children:r}),e[0]=r,e[1]=u):u=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=a.jsx("div",{className:"border-t"}),e[2]=c):c=e[2];let h;e[3]!==o?(h=o?a.jsx("div",{className:"space-y-1.5 border-t px-4 py-3",children:o}):null,e[3]=o,e[4]=h):h=e[4];let p;e[5]!==n||e[6]!==h?(p=a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n,h]}),e[5]=n,e[6]=h,e[7]=p):p=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx("div",{className:"border-t"}),e[8]=b):b=e[8];let f;e[9]!==l?(f=a.jsx("div",{className:"space-y-2 px-4 py-3",children:l}),e[9]=l,e[10]=f):f=e[10];let m;return e[11]!==d||e[12]!==s||e[13]!==i||e[14]!==u||e[15]!==p||e[16]!==f?(m=a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-publish-state":s,"aria-busy":i,children:[u,c,p,d,b,f]}),e[11]=d,e[12]=s,e[13]=i,e[14]=u,e[15]=p,e[16]=f,e[17]=m):m=e[17],m}function us(t){const e=B.c(2),{children:s}=t;let r;return e[0]!==s?(r=a.jsx("div",{className:"scroll-fade min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 pt-3 pb-2 [scrollbar-width:thin]",children:s}),e[0]=s,e[1]=r):r=e[1],r}function ea(t){const e=B.c(10);let s,r,n;e[0]!==t?({className:r,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=r,e[3]=n):(s=e[1],r=e[2],n=e[3]);let o;e[4]!==r?(o=K("rounded-lg border bg-card px-3 py-2.5",r),e[4]=r,e[5]=o):o=e[5];let d;return e[6]!==s||e[7]!==n||e[8]!==o?(d=a.jsx("div",{className:o,...n,children:s}),e[6]=s,e[7]=n,e[8]=o,e[9]=d):d=e[9],d}function We(t){const e=B.c(4),{className:s}=t;let r;e[0]!==s?(r=K("animate-pulse rounded bg-muted motion-reduce:animate-none",s),e[0]=s,e[1]=r):r=e[1];let n;return e[2]!==r?(n=a.jsx("div",{className:r}),e[2]=r,e[3]=n):n=e[3],n}function Dt(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(ea,{children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx(We,{className:"size-4 rounded-md"}),a.jsx(We,{className:"h-3 w-24"}),a.jsx(We,{className:"h-2.5 w-16"}),a.jsx(We,{className:"ml-auto size-6 rounded"})]})}),t[0]=e):e=t[0],e}const Ki="secret";function ta(t){return t.kind!=="block"?null:t.namedRule??null}function Vi(t,e){const s=e.find(r=>r&&typeof r=="object");return s?Rl(s.__resolveType):Tl(t)}const Gi=/(?:^|\/)\.deco\/blocks\/([^/]+)\.json$/;function Rn(t){const e=Gi.exec(t)?.[1];return e?ni(e):null}function Os(t){if(!t)return null;try{const e=JSON.parse(t);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return null}function Wi(t,e){return t===null?"new":e===null?"removed":"edited"}function sa(t){const e=t.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim();return e?(e.charAt(0).toUpperCase()+e.slice(1)).replace(/\s+[A-Z](?=[a-z])/g,s=>s.toLowerCase()):t}function Yt(t,e,s=!1){if(t&&typeof t=="object"&&!Array.isArray(t)){const r=t.__resolveType;if(typeof r=="string"&&r.trim()){if(s)return Ra(r);const o=(r.split("/").pop()??r).replace(/\.[jt]sx?$/,"");return sa(o)||o}}return`Section ${e+1}`}function Tn(t){if(dr(t))return t.value??null;const e=t.__resolveType;return typeof e=="string"&&Ta(e)?t.section??null:null}const na=6;function Ps(t,e=0){if(e>na||!t||typeof t!="object")return[];if(Array.isArray(t))return t.flatMap(n=>Ps(n,e+1));const s=t;if(cn(s.__resolveType))return rn(s).flatMap(n=>Ps(n?.value,e+1));const r=Tn(s);return r!==null?Ps(r,e+1):[s]}function rn(t){const e=t?.variants;return Array.isArray(e)?e.map(s=>s&&typeof s=="object"&&!Array.isArray(s)?s:null):[]}function Gn(t){let e=t;for(let s=0;s<na;s++){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e;if(cn(r.__resolveType))return r;const n=Tn(r);if(n===null)return null;e=n}return null}function Qi(t,e,s){const r=rn(Gn(t)),n=e?rn(Gn(e)):[],o=e?Array.from({length:Math.max(r.length,n.length)},(i,u)=>u).filter(i=>!Ws(r[i],n[i])):[],l=[...o.map(i=>r[i]??n[i]),...r.filter((i,u)=>!o.includes(u))].flatMap(i=>Ps(i?.value)).map(i=>Yt(i,s,!0));return[...new Set(l)]}function en(t,e,s,r,n){let o=t,d=!1;for(let i=0;i<4;i++){if(!o||typeof o!="object"||Array.isArray(o)){d=!0;break}const u=o;if(cn(u.__resolveType)){d=!0;break}const c=Tn(u);if(c===null)break;o=c}const l=d?Qi(t,n,e):[];return{name:Yt(d?t:o,e,!0),kind:"section",status:s,fields:r,...d?{wrapper:!0}:{},...l.length>0?{held:l}:{}}}function an(t,e){const s=t.sections;if(Array.isArray(s))return s.flatMap((r,n)=>r&&typeof r=="object"&&!Array.isArray(r)?[{section:r,basePath:["sections",n]}]:[]);if(s&&typeof s=="object"){const r=s.variants;if(Array.isArray(r))return r.flatMap((n,o)=>{const d=n&&typeof n=="object"&&!Array.isArray(n)?n.value:null,l=e&&dr(d),i=l?d.value:d;if(!Array.isArray(i))return[];const u=l?["sections","variants",o,"value","value"]:["sections","variants",o,"value"];return i.flatMap((c,h)=>c&&typeof c=="object"&&!Array.isArray(c)?[{section:c,basePath:[...u,h]}]:[])})}return[]}function Wn(t){return JSON.stringify(t,(e,s)=>{if(s&&typeof s=="object"&&!Array.isArray(s)){const r=s;return Object.keys(r).sort().reduce((n,o)=>(n[o]=r[o],n),{})}return s})}function Ws(t,e){return t===void 0&&e===void 0?!0:Wn(t)===Wn(e)}function St(t,e,s,r=new Set){const n=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),o=[];for(const d of n){if(d.startsWith("__")||r.has(d))continue;const l=t?t[d]:void 0,i=e?e[d]:void 0;Ws(l,i)||o.push({label:sa(d),path:[...s,d],from:l,to:i})}return o}function Ji(t,e){const s=e.find(r=>r&&typeof r=="object");return s?s.__resolveType===Ol:t===_l}function Yi(t,e){const s=n=>n===void 0||!!n&&typeof n=="object"&&!Array.isArray(n)&&!("__resolveType"in n),r=[];for(const n of St(t,e,[])){const o=String(n.path[0]);s(n.from)&&s(n.to)?r.push(...St(n.from??{},n.to??{},[o])):r.push(n)}return r}const Xi=new Set(["sections"]);function Dn(t,e,s=!1){const r=t?an(t,s):[],n=e?an(e,s):[],o=[],d=Math.max(r.length,n.length);for(let i=0;i<d;i++){const u=r[i],c=n[i];if(!s){const h=Zi(u,c,i);h&&o.push(h);continue}if(u&&c){if(Ws(u.section,c.section))continue;o.push(en(c.section,i,"edited",St(u.section,c.section,c.basePath),u.section))}else c?o.push(en(c.section,i,"new",[])):u&&o.push(en(u.section,i,"removed",[]))}const l=St(t,e,[],Xi);return l.length>0&&o.push({name:"Page settings",kind:"settings",status:"edited",fields:l}),o}function Zi(t,e,s){return t&&e?Ws(t.section,e.section)?null:{name:Yt(e.section,s),kind:"section",status:"edited",fields:St(t.section,e.section,e.basePath)}:e?{name:Yt(e.section,s),kind:"section",status:"new",fields:[]}:t?{name:Yt(t.section,s),kind:"section",status:"removed",fields:[]}:null}function ln(t,e){return{kind:"other",blockKey:null,name:t.split("/").pop()??t,pagePath:null,isSiteApp:!1,status:e,filepaths:[t],sections:[],fromJson:null,toJson:null}}function eo(t){const e=[],s=[],r=[],n=[];for(const[o,d]of Object.entries(t?.diffs??{})){if(Pn(o)){n.push(o);continue}const l=Wi(d.from,d.to),i=Rn(o);if(!i){r.push(ln(o,l));continue}const u=Os(d.from),c=Os(d.to),h=c??u;if(!h){r.push(ln(o,l));continue}const p=Jt(i,h);if(p){e.push({kind:"page",blockKey:i,name:p.name,pagePath:p.path,isSiteApp:!1,status:l,filepaths:[o],sections:l==="edited"?Dn(u,c):[],fromJson:u,toJson:c});continue}const b=yn(i,h);s.push({kind:"block",blockKey:i,name:Fs(i,h),pagePath:null,isSiteApp:b,status:l,filepaths:[o],sections:l==="edited"?[{name:Fs(i,h),kind:"section",status:"edited",fields:St(u,c,[])}].filter(f=>f.fields.length>0):[],fromJson:u,toJson:c})}return ra({pages:e,blocks:s,other:r,generated:n})}function tn(t,e){return(t.filepaths[0]??"").localeCompare(e.filepaths[0]??"")}function ra(t){const{pages:e,blocks:s,other:r,generated:n}=t;return e.sort(tn),s.sort(tn),r.sort(tn),{pages:e,blocks:s,other:r,generated:n,count:e.length+s.length+r.length}}function to(t){return t==="added"?"new":t==="removed"?"removed":"edited"}function aa(t){return t.startsWith("pages-")}function la(t){const{files:e,lookup:s,diff:r}=t,n=[],o=[],d=[],l=[];for(const i of e){const u=i.path;if(Pn(u)){l.push(u);continue}const c=to(i.status),h=Rn(u);if(!h){d.push(ln(u,c));continue}const p=r?.diffs[u],b=Os(p?.from??null),f=Os(p?.to??null),m=ia(s,h),g=m??f??b;if((m?Jt(h,m):null)??(!m&&aa(h))){const j=g?Jt(h,g):null;n.push({kind:"page",blockKey:h,name:j?.name??Vr(h),pagePath:j?.path??null,isSiteApp:!1,status:c,filepaths:[u],sections:c==="edited"?Dn(b,f):[],fromJson:b,toJson:f??(c==="new"?m:null)});continue}const P=Fs(h,g??{});o.push({kind:"block",blockKey:h,name:P,pagePath:null,isSiteApp:yn(h,m??{}),status:c,filepaths:[u],sections:c==="edited"?[{name:P,kind:"section",status:"edited",fields:St(b,f,[])}].filter(j=>j.fields.length>0):[],fromJson:b,toJson:f})}return ra({pages:n,blocks:o,other:d,generated:l})}function ia(t,e){const s=t?.[e];return s&&typeof s=="object"&&!Array.isArray(s)?s:null}function so(t,e){return t??e}function oa(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const sn=3;function vs(t){if(t.length<=sn)return oa(t);const e=t.length-sn;return`${t.slice(0,sn).join(", ")} and ${e} more`}function no(t,e){if(!e){const r=t.sections.filter(n=>n.kind==="section").map(n=>n.name).slice(0,3);return r.length>0?`${t.name} (${r.join(", ")})`:t.name}const s=[...new Set(t.sections.filter(r=>r.kind==="section").flatMap(r=>r.wrapper?r.held??[]:[r.name]))].slice(0,3);return s.length>0?`${t.name} (${s.join(", ")})`:t.name}function ro(t){const e=ta(t);return e==="experiments"?"A/B tests":e==="campaigns"?"Campaign dates":t.name}function ao(t){const e=[],s=t.pages.filter(l=>l.status==="edited"),r=t.pages.filter(l=>l.status==="new"),n=t.pages.filter(l=>l.status==="removed");if(s.length>0&&e.push(`updated ${vs(s.map(l=>no(l,!!t.v8)))}`),r.length>0){const l=r.length===1?"page":"pages";e.push(`added the ${vs(r.map(i=>i.name))} ${l}`)}if(n.length>0){const l=n.length===1?"page":"pages";e.push(`removed the ${vs(n.map(i=>i.name))} ${l}`)}const o=t.blocks.map(ro);if(o.length>0&&e.push(`changed ${vs(o)}`),t.other.length>0){const l=t.other.length===1?"file":"files";e.push(`changed ${t.other.length} ${l}`)}if(e.length===0)return"";const d=oa(e);return Ll(d.charAt(0).toUpperCase()+d.slice(1))}function lo(t,e){return t?an(t,e).length:0}function io(t,e=!1){const s={newPageSections:t.kind==="page"&&t.status==="new"?lo(t.toJson,e):null,sections:0,settings:!1,fields:0};if(s.newPageSections!==null)return s;for(const r of t.sections){if(r.kind==="settings"){s.settings=!0;continue}t.kind==="page"?s.sections+=1:s.fields+=r.fields.length}return s}const Qn="••••••";function es(t){if(Array.isArray(t))return t.map(es);if(!t||typeof t!="object")return t;const e=t,s={};for(const[r,n]of Object.entries(e))s[r]=es(n);return e.__resolveType===Ki&&"ciphertext"in e&&(s.ciphertext=Qn),Ba(e)&&"encrypted"in e&&(s.encrypted=Qn),s}function Jn(t){return t.map(e=>({...e,from:es(e.from),to:es(e.to)}))}function oo(t){const{changes:e,sides:s,lookup:r,meta:n,hosted:o}=t,d=[],l=[],i=c=>[...new Set((s?.diagnostics??[]).filter(h=>_n(Da(h.file))===_n(c)).map(h=>h.side))],u=Object.keys(e).sort((c,h)=>c<h?-1:c>h?1:0);for(const c of u){const h=e[c],p=h.kind==="delete"?"removed":h.baseVersion===null?"new":"edited",b=s?.entries[c],f=b?.before??null,m=b?.after??null,g=ia(r,c),x=g??m??f,P=i(c),j={blockKey:c,status:p,filepaths:[],entry:{name:c,version:h.version},...P.length>0?{unreadable:P}:{},fromJson:es(f),toJson:es(m??(p==="new"?g:null))},y=g?Jt(c,g,n):null,S=!g&&x?Jt(c,x,n):null;if(y??S??(!x&&aa(c))){const v=x?Jt(c,x,n):null;d.push({...j,kind:"page",name:v?.name??Vr(c),pagePath:v?.path??null,isSiteApp:!1,sections:p==="edited"?Dn(f,m,!0).map(A=>({...A,fields:Jn(A.fields)})):[]});continue}const w=o?Cl(c,x,g,m,f):null,k=w?Al(w,[x,g,m,f]):Fs(c,x??{}),N=Vi(c,[g,m,f]),C=Ji(c,[g,m,f]);l.push({...j,kind:"block",name:C?"Settings":k,...C?{cmsSettings:!0}:{},...w?{blogKind:w}:{},...N?{namedRule:N}:{},pagePath:null,isSiteApp:yn(c,g??x??{}),sections:p==="edited"?[{name:C?"Settings":k,kind:"section",status:"edited",fields:Jn(C?Yi(f,m):St(f,m,[]))}].filter(v=>v.fields.length>0):[]})}return{pages:d,blocks:l,other:[],generated:[],count:d.length+l.length,v8:!0}}function ke(t){return t.filepaths[0]??t.blockKey??t.name}function co(t,e){return e(t==="new"?"thread.publishPopover.chipNew":t==="removed"?"thread.publishPopover.chipRemoved":"thread.publishPopover.chipEdited")}function uo(t,e){const s=t.kind==="block"?Kl:Ir;return a.jsx("span",{title:co(t.status,e),className:"flex shrink-0",children:a.jsx(s,{className:K("size-4",t.status==="new"&&"text-brand",t.status==="edited"&&"text-warning",t.status==="removed"&&"text-destructive")})})}function ho(t,e){if(t.kind==="page")return t.pagePath;if(t.kind!=="block")return null;if(t.blogKind)return Dl(t.blogKind,e);if(t.cmsSettings)return e("thread.publishPopover.settingsDetail");const s=ta(t);return s==="experiments"?e("thread.publishPopover.abTests"):s==="campaigns"?e("thread.publishPopover.campaignDates"):t.isSiteApp?e("thread.publishPopover.siteConfiguration"):e("thread.publishPopover.globalSection")}function fo(t,e,s){const r=io(t,s);if(r.newPageSections!==null)return[r.newPageSections===1?e("thread.publishPopover.newPageSectionOne"):e("thread.publishPopover.newPageSections",{count:r.newPageSections})];const n=[];return r.sections===1?n.push(e("thread.publishPopover.sectionChangedOne")):r.sections>1&&n.push(e("thread.publishPopover.sectionsChanged",{count:r.sections})),r.fields===1?n.push(e("thread.publishPopover.fieldChangedOne")):r.fields>1&&n.push(e("thread.publishPopover.fieldsChanged",{count:r.fields})),r.settings&&n.push(e("thread.publishPopover.pageSettingsChanged")),n}function ca(t){const e=B.c(46),{change:s,bodyPending:r,selected:n,onSelect:o,confirming:d,onConfirmingChange:l,onDiscard:i,isPublishing:u,isDiscarding:c,v8:h}=t,p=r===void 0?!1:r,b=h===void 0?!1:h,f=be();let m;e[0]!==s||e[1]!==f?(m=ho(s,f),e[0]=s,e[1]=f,e[2]=m):m=e[2];const g=m;let x;if(e[3]!==p||e[4]!==s||e[5]!==d||e[6]!==g||e[7]!==c||e[8]!==u||e[9]!==l||e[10]!==i||e[11]!==o||e[12]!==n||e[13]!==f||e[14]!==b){const P=fo(s,f,b),j=p&&P.length===0&&s.status==="edited",y=n&&"border-foreground/30 bg-accent hover:bg-secondary-hover";let S;e[16]!==y?(S=K("cursor-pointer transition-colors hover:bg-accent",y),e[16]=y,e[17]=S):S=e[17];let w;e[18]!==s?(w=ke(s),e[18]=s,e[19]=w):w=e[19];let k;e[20]!==s||e[21]!==f?(k=uo(s,f),e[20]=s,e[21]=f,e[22]=k):k=e[22];let N;e[23]!==s.cmsSettings||e[24]!==s.name||e[25]!==f?(N=s.cmsSettings?f("thread.publishPopover.settings"):s.name,e[23]=s.cmsSettings,e[24]=s.name,e[25]=f,e[26]=N):N=e[26];let C;e[27]!==N?(C=a.jsx("span",{className:"truncate text-sm font-medium",children:N}),e[27]=N,e[28]=C):C=e[28];let v;e[29]!==g?(v=g?a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:g}):null,e[29]=g,e[30]=v):v=e[30];let A;e[31]!==n||e[32]!==C||e[33]!==v?(A=a.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left","aria-pressed":n,children:[C,v]}),e[31]=n,e[32]=C,e[33]=v,e[34]=A):A=e[34];let T;e[35]!==d||e[36]!==c||e[37]!==u||e[38]!==l||e[39]!==i||e[40]!==f?(T=d?a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[a.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:_=>{_.stopPropagation(),l(!1)},children:f("thread.publishDialog.cancel")}),a.jsx("button",{type:"button",className:"text-xs font-medium text-destructive disabled:opacity-50",onClick:_=>{_.stopPropagation(),l(!1),i?.()},disabled:c,children:f("thread.publishPopover.discard")})]}):i?a.jsx(Us,{children:a.jsxs(tt,{children:[a.jsx(st,{asChild:!0,children:a.jsx(ve,{type:"button",variant:"ghost-destructive",size:"icon-xs","aria-label":f("thread.publishPopover.discard"),className:"shrink-0 disabled:pointer-events-auto",onClick:_=>{_.stopPropagation(),l(!0)},disabled:u||c,children:a.jsx(Hs,{className:"size-3.5"})})}),a.jsx(nt,{children:f("thread.publishPopover.discard")})]})}):null,e[35]=d,e[36]=c,e[37]=u,e[38]=l,e[39]=i,e[40]=f,e[41]=T):T=e[41];let I;e[42]!==A||e[43]!==T||e[44]!==k?(I=a.jsxs("div",{className:"flex items-center gap-2.5",children:[k,A,T]}),e[42]=A,e[43]=T,e[44]=k,e[45]=I):I=e[45],x=a.jsxs(ea,{className:S,"data-change-id":w,onClick:o,children:[I,P.length>0?a.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-muted-foreground",children:P.map(mo)}):j?a.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px]",children:a.jsx(We,{className:"h-4 w-2/3"})}):null]}),e[3]=p,e[4]=s,e[5]=d,e[6]=g,e[7]=c,e[8]=u,e[9]=l,e[10]=i,e[11]=o,e[12]=n,e[13]=f,e[14]=b,e[15]=x}else x=e[15];return x}function mo(t,e){return a.jsx("div",{className:"truncate",children:t},`${e}-${t}`)}function da(){const t=B.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={width:-1,height:-1},t[0]=e):e=t[0];const[s,r]=q.useState(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const i=()=>r(c=>c.width===l.clientWidth&&c.height===l.clientHeight?c:{width:l.clientWidth,height:l.clientHeight});i();const u=new ResizeObserver(i);return u.observe(l),()=>u.disconnect()},t[1]=n):n=t[1];const o=n;let d;return t[2]!==s?(d=[s,o],t[2]=s,t[3]=d):d=t[3],d}function po(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}const bo=[{width:"w-3/4",tone:"ctx"},{width:"w-1/2",tone:"del"},{width:"w-3/5",tone:"add"},{width:"w-2/5",tone:"ctx"},{width:"w-4/5",tone:"add"},{width:"w-1/2",tone:"ctx"}];function Yn(t){const e=B.c(10),{height:s}=t,r=be();let n;e[0]!==s?(n={height:s},e[0]=s,e[1]=n):n=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=bo.map(go),e[2]=o):o=e[2];let d;e[3]!==r?(d=r("thread.publishDialog.openingComparison"),e[3]=r,e[4]=d):d=e[4];let l;e[5]!==d?(l=a.jsx("div",{className:"flex items-center justify-center pt-1 text-2xs text-muted-foreground",children:d}),e[5]=d,e[6]=l):l=e[6];let i;return e[7]!==n||e[8]!==l?(i=a.jsxs("div",{style:n,className:"flex w-full flex-col gap-1.5 overflow-hidden px-3 py-2",children:[o,l]}),e[7]=n,e[8]=l,e[9]=i):i=e[9],i}function go(t,e){return a.jsxs("div",{className:K("flex items-center gap-2 rounded px-1 py-0.5",t.tone==="del"&&"bg-destructive/5",t.tone==="add"&&"bg-success/5"),children:[a.jsx("div",{className:K("h-2 w-4 shrink-0 animate-pulse rounded-sm bg-muted",t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")}),a.jsx("div",{className:K("h-2 animate-pulse rounded-sm bg-muted",t.width,t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")})]},e)}const ua={readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12},xo={...ua,lineNumbersMinChars:3,lineDecorationsWidth:4,folding:!1,glyphMargin:!1,renderOverviewRuler:!1};function vo(t){const e=B.c(11),{diff:s,emptyMessage:r,rowClassName:n,onDiscardFile:o,hideFileRows:d,editorHeight:l}=t,i=r===void 0?"No file changes in the working tree":r,u=n===void 0?"px-6":n,c=d===void 0?!1:d,h=l===void 0?"380px":l,[p,b]=q.useState(null),[f,m]=q.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=po(),e[0]=g):g=e[0];const x=g;if(!s||Object.keys(s.diffs).length===0){let j;return e[1]!==i?(j=a.jsx("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:i}),e[1]=i,e[2]=j):j=e[2],j}let P;return e[3]!==s.diffs||e[4]!==f||e[5]!==h||e[6]!==p||e[7]!==c||e[8]!==o||e[9]!==u?(P=a.jsx("div",{className:"divide-y",children:Object.entries(s.diffs).map(j=>{const[y,S]=j,{from:w,to:k}=S,N=p===y,C=w===null,v=k===null,A=y.startsWith("/")?y.slice(1):y,T=A.lastIndexOf("/"),I=T>=0?A.slice(T+1):A,_=T>=0?A.slice(0,T):null,$=ri(y),H=C?"bg-success":v?"bg-destructive":"bg-warning";return c?a.jsx("div",{children:a.jsx(qn,{original:w??"",modified:k??"",language:$,theme:x,height:h,loading:a.jsx(Yn,{height:h}),options:xo})},y):a.jsxs("div",{children:[a.jsxs("div",{className:K("flex items-center gap-3 py-3 hover:bg-accent",u),children:[a.jsx("button",{type:"button",className:"flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground transition-transform hover:text-foreground",onClick:()=>b(N?null:y),children:a.jsx(or,{className:K("h-3.5 w-3.5 transition-transform",N&&"rotate-90")})}),a.jsx("div",{className:K("h-2.5 w-2.5 shrink-0 rounded-full",H)}),a.jsx(Ir,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:I}),_&&a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:_}),o?a.jsxs(Es,{children:[a.jsx(_s,{asChild:!0,children:a.jsx("button",{type:"button",className:"flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground hover:bg-accent hover:text-foreground rounded-lg",children:a.jsx(Ia,{className:"h-3.5 w-3.5"})})}),a.jsx(Ms,{align:"end",children:a.jsx(Xt,{className:"text-destructive focus:text-destructive",onSelect:()=>m(y),children:"Discard changes"})})]}):null]}),f===y&&o?a.jsxs("div",{className:K("flex items-center justify-between gap-3 border-t bg-destructive/5 py-2.5",u),children:[a.jsxs("span",{className:"text-xs text-destructive",children:["Discard all changes to"," ",a.jsx("span",{className:"font-medium",children:I}),"? This cannot be undone."]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsx(ve,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),children:"Cancel"}),a.jsx(ve,{type:"button",variant:"destructive",size:"sm",onClick:()=>{m(null),o(y)},children:"Discard"})]})]}):null,N&&a.jsx("div",{className:"border-t",children:a.jsx(qn,{original:w??"",modified:k??"",language:$,theme:x,height:h,loading:a.jsx(Yn,{height:h}),options:ua})})]},y)})}),e[3]=s.diffs,e[4]=f,e[5]=h,e[6]=p,e[7]=c,e[8]=o,e[9]=u,e[10]=P):P=e[10],P}function yo(t){if(t.kind!=="block"||t.isSiteApp||!t.blockKey)return null;const e=(t.toJson??t.fromJson)?.__resolveType;return typeof e=="string"&&li(e)?t.blockKey:null}function jo(t){return t.kind!=="page"?!0:!t.pagePath||Pt(t.pagePath).length>0}function wo(t,e){try{return Ha(t,Il,e)}catch{return null}}function Po(t,e,s){if(!e)return;const r=Bl(e,t);if(!r)return null;if(Pt(r.path).length===0||s?.path!==r.path)return r.path;const n=jn(r.path,s.params);return Pt(n).length===0?n:r.path}function So(t){return t.sectionKey&&!t.v8?wo(t.previewServerUrl,t.sectionKey):No(t.previewServerUrl,t.path)}function ko(t,e){if(t.kind!=="page")return"/";const s=t.pagePath;if(!s)return"";if(Pt(s).length===0)return s;if(e?.path!==s)return"";const r=jn(s,e.params);return Pt(r).length===0?r:""}function No(t,e){const s=e.trim();if(!s||Pt(s).length>0)return null;try{const r=new URL(t),n=new URL(s.startsWith("/")?s:`/${s}`,r);return n.origin===r.origin?n:null}catch{return null}}function Co(t,e){return e?.kind==="pointer"&&e.link?pn(t.toString(),e.link):ha(t,e)}function ha(t,e){if(!e)return null;if(e.kind==="pointer")return pn(t.toString(),e.pointer);try{return new URL(`${t.pathname}${t.search}`,e.previewUrl).href}catch{return null}}function Ao(t,e,s){return e===null?!1:t!=="other"||s?.kind==="sandbox"}function Ro(t,e){const s=e?t.kind==="page":t.kind!=="other";return{before:s&&t.status==="new"?"new":null,after:s&&t.status==="removed"?"removed":null}}const fa=q.createContext(!0),To=["split","before","after","code"];function Do(t){return To.includes(t)}const ma={desktop:1280,mobile:412};function Bo(t,e){const s=(o,d)=>t.unreadable?.includes(d)?e:o?`${JSON.stringify(o,null,2)}
2
+ `:null,r=t.status==="new"?null:s(t.fromJson,"before"),n=t.status==="removed"?null:s(t.toJson,"after");return r===null&&n===null?{diffs:{}}:t.status==="edited"&&(r===null||n===null)?{diffs:{}}:{diffs:{[La(t.entry.name)]:{from:r,to:n}}}}function pa(t){const e=B.c(76),{change:s,diff:r,bodyPending:n,previewServerUrl:o,draft:d,lastPage:l,v8:i,onReady:u}=t,c=be(),h=q.use(fa),p=yo(s),b=i?null:p,f=i?p:null,m=f?Po(f,i?.blocks,l):void 0,g=f!==null&&m===null,x=Ao(s.kind,o,d)&&(f===null||typeof m=="string"),[P,j]=q.useState(null),y=x?P??"split":"code",[S,w]=q.useState("desktop"),[k,N]=q.useState(null),C=k??(f?m??"":ko(s,l));let v;e[0]!==s?(v=jo(s),e[0]=s,e[1]=v):v=e[1];const A=v,T=o?So({previewServerUrl:o,sectionKey:p,path:C,v8:!!i}):null,I=T?pn(T.toString(),Ka):null,_=T?ha(T,d):null,$=T?Co(T,d):null;let H;e[2]!==s||e[3]!==r?.diffs||e[4]!==c?(H=s.entry?Bo(s,c("thread.publishCompare.sideUnreadable")):{diffs:Object.fromEntries(s.filepaths.flatMap(J=>{const de=r?.diffs[J];return de?[[J,de]]:[]}))},e[2]=s,e[3]=r?.diffs,e[4]=c,e[5]=H):H=e[5];const O=H;let G;e[6]!==O.diffs?(G=Object.keys(O.diffs),e[6]=O.diffs,e[7]=G):G=e[7];const E=G.length>0;let W;e:{if(b!==null){W=null;break e}if(f!==null){const de=C.trim();if(!de){W=null;break e}W=Pt(de).length>0?c("thread.publishCompare.dynamicHint",{template:de}):c("thread.publishCompare.blockHint",{path:de});break e}if(s.kind!=="page"){let de;e[8]!==c?(de=c("thread.publishCompare.globalHint"),e[8]=c,e[9]=de):de=e[9],W=de;break e}let J;e[10]!==s.pagePath||e[11]!==c?(J=s.pagePath&&Pt(s.pagePath).length>0?c("thread.publishCompare.dynamicHint",{template:s.pagePath}):null,e[10]=s.pagePath,e[11]=c,e[12]=J):J=e[12],W=J}const F=W,V=Ro(s,!!i),[te,Y]=q.useState(Io);let ne;e[13]===Symbol.for("react.memo_cache_sentinel")?(ne=J=>Y(de=>de.has(J)?de:new Set(de).add(J)),e[13]=ne):ne=e[13];const le=ne;let M;e[14]!==i?(M=J=>i?a.jsx(Lo,{...J,onLoaded:le}):a.jsx(Fo,{...J}),e[14]=i,e[15]=M):M=e[15];const X=M,Z=(x?[V.before==="new"?null:I,V.after==="removed"?null:_].flatMap(J=>J?[An(J,S)]:[]):[]).every(J=>te.has(J));let se;e[16]!==u||e[17]!==Z?(se=Z&&u?J=>{J&&u()}:void 0,e[16]=u,e[17]=Z,e[18]=se):se=e[18];const ie=se,ge=V.before==="new"?a.jsx(ys,{icon:a.jsx(Or,{className:"size-5 text-brand"}),title:c("thread.publishCompare.newTitle"),description:c("thread.publishCompare.newDescription")}):X({url:I,device:S,title:c("thread.publishCompare.before"),missing:c("thread.publishCompare.enterPath")}),ue=V.after==="removed"?a.jsx(ys,{icon:a.jsx(Hs,{className:"size-5 text-destructive"}),title:c("thread.publishCompare.removedTitle"),description:c("thread.publishCompare.removedDescription")}):X({url:_,device:S,title:c("thread.publishCompare.after"),missing:c(T?"thread.publishCompare.draftUnavailable":"thread.publishCompare.enterPath")});let re;e[19]!==x||e[20]!==j||e[21]!==h||e[22]!==c||e[23]!==y?(re=x||h?a.jsx(Tr,{value:y,onValueChange:J=>{Do(J)&&j(J)},children:a.jsxs(Rr,{className:"h-8 w-auto",variant:"pill",children:[x?a.jsxs(a.Fragment,{children:[a.jsx(Tt,{value:"split",className:"px-3 text-xs",children:c("thread.publishCompare.sideBySide")}),a.jsx(Tt,{value:"before",className:"px-3 text-xs",children:c("thread.publishCompare.before")}),a.jsx(Tt,{value:"after",className:"px-3 text-xs",children:c("thread.publishCompare.after")})]}):null,h?a.jsx(Tt,{value:"code",className:"px-3 text-xs",children:c("thread.publishCompare.code")}):null]})}):null,e[19]=x,e[20]=j,e[21]=h,e[22]=c,e[23]=y,e[24]=re):re=e[24];let fe;e[25]!==$||e[26]!==x||e[27]!==s.pagePath||e[28]!==S||e[29]!==C||e[30]!==A||e[31]!==b||e[32]!==w||e[33]!==N||e[34]!==c||e[35]!==y?(fe=x&&y!=="code"?a.jsxs(a.Fragment,{children:[b?null:A?a.jsx($a,{value:C,onChange:J=>N(J.target.value),placeholder:s.pagePath??"/","aria-label":c("thread.publishCompare.pathLabel"),className:"h-8 w-56 font-mono text-xs"}):a.jsx("span",{className:"max-w-56 truncate px-1 font-mono text-xs text-muted-foreground",children:C}),a.jsxs("div",{className:"flex items-center rounded-lg border p-0.5",children:[a.jsx(Xn,{active:S==="desktop",label:c("thread.publishCompare.desktop"),onClick:()=>w("desktop"),children:a.jsx(ai,{className:"size-3.5"})}),a.jsx(Xn,{active:S==="mobile",label:c("thread.publishCompare.mobile"),onClick:()=>w("mobile"),children:a.jsx(cl,{className:"size-3.5"})})]}),$?a.jsxs("a",{href:$,target:"_blank",rel:"noopener noreferrer",className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[a.jsx(Fa,{className:"size-3.5"}),c("thread.publishCompare.openDraft")]}):null]}):null,e[25]=$,e[26]=x,e[27]=s.pagePath,e[28]=S,e[29]=C,e[30]=A,e[31]=b,e[32]=w,e[33]=N,e[34]=c,e[35]=y,e[36]=fe):fe=e[36];let ye;e[37]!==re||e[38]!==fe?(ye=a.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b bg-background px-4 py-2.5 max-md:pr-12",children:[re,fe]}),e[37]=re,e[38]=fe,e[39]=ye):ye=e[39];let z;e[40]!==x||e[41]!==F||e[42]!==y?(z=F&&x&&y!=="code"?a.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-2xs text-muted-foreground",children:F}):null,e[40]=x,e[41]=F,e[42]=y,e[43]=z):z=e[43];let oe;e[44]!==g||e[45]!==h||e[46]!==c?(oe=g&&h?a.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-2xs text-muted-foreground",children:c("thread.publishCompare.notOnAnyPage")}):null,e[44]=g,e[45]=h,e[46]=c,e[47]=oe):oe=e[47];let xe;e[48]!==o||e[49]!==h||e[50]!==c||e[51]!==f||e[52]!==m||e[53]!==y?(xe=y==="code"&&!h?f!==null&&m===void 0?a.jsx(We,{className:"m-4 h-64 rounded"}):o===null?a.jsx(ys,{icon:a.jsx(Is,{className:"size-5 text-muted-foreground"}),title:c("thread.publishCompare.previewNotReadyTitle"),description:c("thread.publishCompare.draftUnavailable")}):a.jsx(ys,{icon:a.jsx(Is,{className:"size-5 text-muted-foreground"}),title:c("thread.publishCompare.noPreviewTitle"),description:c("thread.publishCompare.noPreviewDescription")}):null,e[48]=o,e[49]=h,e[50]=c,e[51]=f,e[52]=m,e[53]=y,e[54]=xe):xe=e[54];let Q;e[55]!==n||e[56]!==E||e[57]!==O||e[58]!==h||e[59]!==c||e[60]!==y?(Q=y==="code"&&h?a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background [scrollbar-width:thin]",children:E?a.jsx(vo,{diff:O,hideFileRows:!0,editorHeight:"70vh"}):n?a.jsx(We,{className:"m-4 h-64 rounded"}):a.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:c("thread.publishPopover.detailsUnavailable")})}):null,e[55]=n,e[56]=E,e[57]=O,e[58]=h,e[59]=c,e[60]=y,e[61]=Q):Q=e[61];let ee;e[62]!==ue||e[63]!==ge||e[64]!==x||e[65]!==c||e[66]!==y?(ee=x?a.jsxs("div",{className:K("flex min-h-0 flex-1 gap-3 p-3",y==="code"&&"hidden"),children:[a.jsx(Zn,{label:c("thread.publishCompare.before"),hidden:y==="after",children:ge}),a.jsx(Zn,{label:c("thread.publishCompare.after"),highlight:!0,hidden:y==="before",children:ue})]}):null,e[62]=ue,e[63]=ge,e[64]=x,e[65]=c,e[66]=y,e[67]=ee):ee=e[67];let ce;return e[68]!==ie||e[69]!==ye||e[70]!==z||e[71]!==oe||e[72]!==xe||e[73]!==Q||e[74]!==ee?(ce=a.jsxs("div",{ref:ie,className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/40",children:[ye,z,oe,xe,Q,ee]}),e[68]=ie,e[69]=ye,e[70]=z,e[71]=oe,e[72]=xe,e[73]=Q,e[74]=ee,e[75]=ce):ce=e[75],ce}function Io(){return new Set}function Xn(t){const e=B.c(8),{active:s,label:r,onClick:n,children:o}=t,d=s&&"bg-accent text-foreground";let l;e[0]!==d?(l=K("flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground",d),e[0]=d,e[1]=l):l=e[1];let i;return e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==l?(i=a.jsx("button",{type:"button","aria-label":r,"aria-pressed":s,title:r,onClick:n,className:l,children:o}),e[2]=s,e[3]=o,e[4]=r,e[5]=n,e[6]=l,e[7]=i):i=e[7],i}function Zn(t){const e=B.c(18),{label:s,highlight:r,hidden:n,children:o}=t,d=r===void 0?!1:r,i=(n===void 0?!1:n)&&"hidden";let u;e[0]!==i?(u=K("flex min-h-0 min-w-0 flex-1 flex-col gap-1.5",i),e[0]=i,e[1]=u):u=e[1];const c=d&&"bg-brand";let h;e[2]!==c?(h=K("size-1.5 rounded-full bg-muted-foreground/50",c),e[2]=c,e[3]=h):h=e[3];let p;e[4]!==h?(p=a.jsx("span",{className:h}),e[4]=h,e[5]=p):p=e[5];let b;e[6]!==s||e[7]!==p?(b=a.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 text-2xs font-medium text-muted-foreground",children:[p,s]}),e[6]=s,e[7]=p,e[8]=b):b=e[8];const f=d&&"border-brand/60";let m;e[9]!==f?(m=K("relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-background",f),e[9]=f,e[10]=m):m=e[10];let g;e[11]!==o||e[12]!==m?(g=a.jsx("div",{className:m,children:o}),e[11]=o,e[12]=m,e[13]=g):g=e[13];let x;return e[14]!==g||e[15]!==u||e[16]!==b?(x=a.jsxs("div",{className:u,children:[b,g]}),e[14]=g,e[15]=u,e[16]=b,e[17]=x):x=e[17],x}function ys(t){const e=B.c(10),{icon:s,title:r,description:n}=t;let o;e[0]!==s?(o=a.jsx("div",{className:"mb-1",children:s}),e[0]=s,e[1]=o):o=e[1];let d;e[2]!==r?(d=a.jsx("p",{className:"text-sm font-medium",children:r}),e[2]=r,e[3]=d):d=e[3];let l;e[4]!==n?(l=a.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[4]=n,e[5]=l):l=e[5];let i;return e[6]!==o||e[7]!==d||e[8]!==l?(i=a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 px-6 text-center",children:[o,d,l]}),e[6]=o,e[7]=d,e[8]=l,e[9]=i):i=e[9],i}function $o(t,e){if(!t)return{visibility:"hidden",width:e};const s=Math.min(t.width/e,1);return{left:Math.max((t.width-e*s)/2,0),width:e,height:t.height/s,transform:`scale(${s})`,transformOrigin:"top left"}}function Fo(t){const e=B.c(24),{url:s,device:r,title:n,missing:o}=t,[d,l]=da(),[i,u]=q.useState(null);if(!s){let w;return e[0]!==o?(w=a.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=w):w=e[1],w}let c;e[2]!==r||e[3]!==s?(c=An(s,r),e[2]=r,e[3]=s,e[4]=c):c=e[4];const h=c,p=ma[r],b=d.width>0?Math.min(d.width/p,1):1,f=d.width>0?Math.max((d.width-p*b)/2,0):0;let m;e[5]!==h?(m=()=>u(h),e[5]=h,e[6]=m):m=e[6];const g=d.height>0?d.height/b:"100%",x=`scale(${b})`;let P;e[7]!==p||e[8]!==f||e[9]!==g||e[10]!==x?(P={left:f,width:p,height:g,transform:x,transformOrigin:"top left"},e[7]=p,e[8]=f,e[9]=g,e[10]=x,e[11]=P):P=e[11];let j;e[12]!==h||e[13]!==m||e[14]!==P||e[15]!==n?(j=a.jsx("iframe",{src:h,title:n,sandbox:"allow-scripts allow-same-origin",onLoad:m,className:"absolute top-0 border-0 bg-white",style:P},h),e[12]=h,e[13]=m,e[14]=P,e[15]=n,e[16]=j):j=e[16];let y;e[17]!==i||e[18]!==h?(y=i!==h?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:a.jsx(Zt,{className:"size-5 motion-reduce:animate-none"})}):null,e[17]=i,e[18]=h,e[19]=y):y=e[19];let S;return e[20]!==l||e[21]!==j||e[22]!==y?(S=a.jsxs("div",{ref:l,className:"absolute inset-0",children:[j,y]}),e[20]=l,e[21]=j,e[22]=y,e[23]=S):S=e[23],S}function Lo(t){const e=B.c(21),{url:s,device:r,title:n,missing:o,onLoaded:d}=t,[l,i]=da(),[u,c]=q.useState(null),[h,p]=q.useState(null),b=l.width>0&&l.height>0;b&&(u?.width!==l.width||u?.height!==l.height)&&c(l);const f=b?l:u;if(!s){let S;return e[0]!==o?(S=a.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=S):S=e[1],S}let m,g,x,P;if(e[2]!==f||e[3]!==r||e[4]!==d||e[5]!==i||e[6]!==h||e[7]!==n||e[8]!==s){const S=An(s,r),w=ma[r];m=h?.src!==S;const k=[...h&&m?[h]:[],{src:S,logicalWidth:w}];g=i,x="absolute inset-0",P=k.map(N=>{const C=N.src===S&&m;return a.jsx("iframe",{src:N.src,title:n,"aria-hidden":C&&h?!0:void 0,sandbox:"allow-scripts allow-same-origin",onLoad:()=>{N.src===S&&(p(N),d?.(N.src))},className:K("absolute top-0 border-0 bg-white",C&&"pointer-events-none opacity-0"),style:$o(f,N.logicalWidth)},N.src)}),e[2]=f,e[3]=r,e[4]=d,e[5]=i,e[6]=h,e[7]=n,e[8]=s,e[9]=m,e[10]=g,e[11]=x,e[12]=P}else m=e[9],g=e[10],x=e[11],P=e[12];let j;e[13]!==m||e[14]!==h?(j=m?h?a.jsx(Zt,{className:"absolute right-2 top-2 size-4 text-muted-foreground motion-reduce:animate-none"}):a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:a.jsx(Zt,{className:"size-5 motion-reduce:animate-none"})}):null,e[13]=m,e[14]=h,e[15]=j):j=e[15];let y;return e[16]!==g||e[17]!==x||e[18]!==P||e[19]!==j?(y=a.jsxs("div",{ref:g,className:x,children:[P,j]}),e[16]=g,e[17]=x,e[18]=P,e[19]=j,e[20]=y):y=e[20],y}const Oo=/^Co-authored-by:\s*([^<\r\n]+?)(?:\s*<[^>\r\n]*>)?\s*$/im;function _o(t){if(!t)return null;const e=Oo.exec(t)?.[1]?.trim();return e||null}function Mo(t){return/\[bot\]$/i.test(t)||/-bot$/i.test(t)}function Eo(t){const e=_o(t.body);if(e)return e;const s=t.author.trim();return!s||Mo(s)?null:s}function zo(t,e,s,r,n,o){return["cms-publish-bodies",t,e,s,r,n,o]}const Uo=6e4;function qo(t,e){return e?null:t.files.map(s=>`${s.index}${s.working_dir} ${s.path}`).sort().join(`
3
+ `)}function Ho(t,e,s){const r=B.c(6);let n;r[0]!==s||r[1]!==t||r[2]!==e?(n=ss.decofile(`${t}/${e}/${s}`),r[0]=s,r[1]=t,r[2]=e,r[3]=n):n=r[3];let o;r[4]!==n?(o={queryKey:n,queryFn:dn},r[4]=n,r[5]=o):o=r[5];const{data:d}=ft(o);return d}function ba(t){const{orgSlug:e,virtualMcpId:s,branch:r,threadId:n,baseBranch:o,fastPreview:d,recoverSandbox:l}=t,i={orgSlug:e,virtualMcpId:s,branch:r,threadId:n},u=d?{fastPreview:!0}:void 0,c=q.useRef(null),h=async S=>{try{return await S()}catch(w){if(!l||!Gr(w))throw w;return c.current??=l(),await c.current,S()}},p=ur({...Sn(i),queryFn:()=>h(()=>Wr(i))}),b=p.data,f=b.changedFiles??null,m=b.headSha??null,g=f?f.length>0:Gl(b)||Wl(b),x=ft({queryKey:zo(e,s,r,o,m,qo(b,d)),queryFn:()=>h(()=>Ql(i,b,o,u)),enabled:g,staleTime:d?Uo:0,gcTime:d?void 0:0,throwOnError:(S,w)=>!f&&w.state.data===void 0}),P=Ho(e,s,r),j=x.data??null,y=f?la({files:f,lookup:P,diff:j}):eo(j);return{status:b,summary:y,allPaths:f?f.map(S=>S.path):Object.keys(j?.diffs??{}),discardablePaths:d?null:new Set(b.files.map(S=>S.path)),changedFilesTotal:b.changedFilesTotal??y.count,changedFilesTruncated:b.changedFilesTruncated??!1,headSha:m,diff:j,bodiesPending:g&&x.isPending,bodiesFailed:x.isError,cardsPending:!f&&g&&x.isPending,refresh:()=>Promise.all([p.refetch(),d?null:x.refetch()])}}function Ko(t){const e=B.c(4);let s;e[0]!==t?(s=ss.decofile(t),e[0]=t,e[1]=s):s=e[1];let r;e[2]!==s?(r={queryKey:s,queryFn:dn},e[2]=s,e[3]=r):r=e[3];const{data:n}=ft(r);return n}function Vo(t,e){const s=B.c(5);let r;s[0]!==t||s[1]!==e?(r=e?Ga(e,t):ss.liveMeta("","no-scope"),s[0]=t,s[1]=e,s[2]=r):r=s[2];let n;s[3]!==r?(n={queryKey:r,queryFn:dn},s[3]=r,s[4]=n):n=s[4];const{data:o}=ft(n);return o}function Bn(t){const e=B.c(27),{backend:s,cacheKey:r,scope:n}=t,o=hr();let d;e[0]!==r?(d=ss.contentChanges(r),e[0]=r,e[1]=d):d=e[1];let l;e[2]!==s.client||e[3]!==r||e[4]!==o?(l=()=>Wa(o,s.client,r),e[2]=s.client,e[3]=r,e[4]=o,e[5]=l):l=e[5];let i;e[6]!==d||e[7]!==l?(i={queryKey:d,queryFn:l,staleTime:0},e[6]=d,e[7]=l,e[8]=i):i=e[8];const u=ur(i),c=u.data,h=Va(s,r,c),p=Ko(r),b=Vo(s,n),f=h.data??null,m=s.source==="github";let g;e[9]!==c.changes||e[10]!==p||e[11]!==b||e[12]!==f||e[13]!==m?(g=oo({changes:c.changes,sides:f,lookup:p,meta:b,hosted:m}),e[9]=c.changes,e[10]=p,e[11]=b,e[12]=f,e[13]=m,e[14]=g):g=e[14];const x=g;let P;e[15]!==c.changes?(P=Object.entries(c.changes).map(Go),e[15]=c.changes,e[16]=P):P=e[16];const j=x.count>0&&h.isPending,y=p??null;let S;e[17]!==u?(S=()=>u.refetch(),e[17]=u,e[18]=S):S=e[18];let w;return e[19]!==c||e[20]!==h.isError||e[21]!==x||e[22]!==P||e[23]!==j||e[24]!==y||e[25]!==S?(w={changes:c,summary:x,entries:P,sidesPending:j,sidesFailed:h.isError,blocks:y,refresh:S},e[19]=c,e[20]=h.isError,e[21]=x,e[22]=P,e[23]=j,e[24]=y,e[25]=S,e[26]=w):w=e[26],w}function Go(t){const[e,s]=t;return{name:e,version:s.version}}function Wo(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Qo(t){const e=B.c(27),{orgSlug:s,virtualMcpId:r,branch:n,threadId:o,fastPreview:d,status:l,diff:i,enabled:u}=t,[c]=fr(),{language:h}=c;let p,b,f;if(e[0]!==n||e[1]!==i||e[2]!==u||e[3]!==d||e[4]!==h||e[5]!==s||e[6]!==l||e[7]!==o||e[8]!==r){const S=i?kn(i):"";p=u&&!!n&&!!l&&!!i&&S!=="",f=ft,b=Wo({orgSlug:s,virtualMcpId:r,branch:n,threadId:o,fastPreview:d,signature:S,language:h}),e[0]=n,e[1]=i,e[2]=u,e[3]=d,e[4]=h,e[5]=s,e[6]=l,e[7]=o,e[8]=r,e[9]=p,e[10]=b,e[11]=f}else p=e[9],b=e[10],f=e[11];let m;e[12]!==n||e[13]!==i||e[14]!==h||e[15]!==s||e[16]!==l||e[17]!==o||e[18]!==r?(m=()=>Jl({orgSlug:s,virtualMcpId:r,branch:n,threadId:o},{status:l,diff:i,language:h}),e[12]=n,e[13]=i,e[14]=h,e[15]=s,e[16]=l,e[17]=o,e[18]=r,e[19]=m):m=e[19];let g;e[20]!==p||e[21]!==b||e[22]!==m?(g={queryKey:b,queryFn:m,enabled:p,staleTime:1/0,gcTime:6e5,retry:Jo},e[20]=p,e[21]=b,e[22]=m,e[23]=g):g=e[23];const x=f(g),P=x.data??null,j=p&&x.isFetching&&!x.data;let y;return e[24]!==P||e[25]!==j?(y={verdict:P,loading:j},e[24]=P,e[25]=j,e[26]=y):y=e[26],y}function Jo(t,e){return!Gr(e)&&t<1}function ga(t){const e=B.c(30),{orgSlug:s,virtualMcpId:r,branch:n,threadId:o,fastPreview:d,status:l,diff:i,policy:u,judgeEnabled:c,paths:h}=t,p=c===void 0?!0:c,b=h===void 0?null:h;let f;e[0]!==i||e[1]!==p||e[2]!==u?(f=p&&Yl(i,u),e[0]=i,e[1]=p,e[2]=u,e[3]=f):f=e[3];const m=f;let g;e[4]!==n||e[5]!==i||e[6]!==d||e[7]!==m||e[8]!==s||e[9]!==l||e[10]!==o||e[11]!==r?(g={orgSlug:s,virtualMcpId:r,branch:n,threadId:o,fastPreview:d,status:l,diff:i,enabled:m},e[4]=n,e[5]=i,e[6]=d,e[7]=m,e[8]=s,e[9]=l,e[10]=o,e[11]=r,e[12]=g):g=e[12];const{verdict:x,loading:P}=Qo(g);if(!i&&b){let w;e[13]!==b||e[14]!==u?(w=Xl(b,u),e[13]=b,e[14]=u,e[15]=w):w=e[15];let k;return e[16]!==w?(k={gate:w,ready:!1},e[16]=w,e[17]=k):k=e[17],k}if(!i){let w;return e[18]===Symbol.for("react.memo_cache_sentinel")?(w={gate:{allowed:!0,reason:null},ready:!1},e[18]=w):w=e[18],w}if(!m){let w;e[19]!==i||e[20]!==u?(w=Zl(i,u),e[19]=i,e[20]=u,e[21]=w):w=e[21];let k;return e[22]!==w?(k={gate:w,ready:!0},e[22]=w,e[23]=k):k=e[23],k}let j;e[24]!==P||e[25]!==x?(j=ei(x,P),e[24]=P,e[25]=x,e[26]=j):j=e[26];const y=!P;let S;return e[27]!==j||e[28]!==y?(S={gate:j,ready:y},e[27]=j,e[28]=y,e[29]=S):S=e[29],S}function Yo(t){return["main","master"].includes(t.trim().toLowerCase())}function Xo(t,e,s,r){return t===0?r("thread.publishPopover.publish"):s||!Yo(e)?t===1?r("thread.publishPopover.publishOne"):r("thread.publishPopover.publishCount",{count:t}):t===1?r("thread.publishPopover.publishOneInProduction"):r("thread.publishPopover.publishCountInProduction",{count:t})}const Zo=2500;function ec(t){const{selectedId:e,readyIds:s,lastShownId:r,liveIds:n}=t;return e===null||s.has(e)?e:r!==null&&r!==e&&n.includes(r)?r:e}function xa(t){const e=B.c(16),s=q.useRef(!1),r=be();let n;e[0]!==t?(n=h=>{!h&&s.current||t.onOpenChange(h)},e[0]=t,e[1]=n):n=e[1];const o=n;let d;e[2]!==t.mode||e[3]!==r?(d=t.mode==="review"?r("thread.publishPopover.submitForReview"):r("thread.publishPopover.publish"),e[2]=t.mode,e[3]=r,e[4]=d):d=e[4];let l;e[5]!==d?(l=a.jsx(pr,{className:"sr-only",children:d}),e[5]=d,e[6]=l):l=e[6];let i;e[7]!==t?(i=a.jsx(tc,{...t,publishLockRef:s}),e[7]=t,e[8]=i):i=e[8];let u;e[9]!==l||e[10]!==i?(u=a.jsxs(br,{"aria-describedby":void 0,className:"flex h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-none flex-col md:flex-row md:h-[calc(100dvh-6rem)] md:w-[calc(100vw-6rem)] gap-0 overflow-hidden p-0 sm:max-w-none",closeButtonClassName:"top-3.5 right-3.5",children:[l,i]}),e[9]=l,e[10]=i,e[11]=u):u=e[11];let c;return e[12]!==o||e[13]!==t.open||e[14]!==u?(c=a.jsx(mr,{open:t.open,onOpenChange:o,children:u}),e[12]=o,e[13]=t.open,e[14]=u,e[15]=c):c=e[15],c}function tc(t){const e=B.c(3),s=Bt(t.virtualMcpId,t.branch),r=s.kind==="protocol"&&s.source==="github";let n;return e[0]!==r||e[1]!==t?(n=Hi({open:t.open,hosted:r})?a.jsx(rc,{...t}):null,e[0]=r,e[1]=t,e[2]=n):n=e[2],n}const sc=4,ts="flex h-[45%] min-h-0 min-w-0 shrink-0 md:h-auto md:flex-1";function ms(t){const e=B.c(5),{list:s,pane:r}=t;let n;e[0]!==s?(n=a.jsx("div",{className:"flex min-h-0 w-full flex-1 flex-col max-md:border-t md:w-[380px] md:flex-none md:shrink-0 md:border-l md:[&>[data-publish-state]>:first-child]:pr-12",children:s}),e[0]=s,e[1]=n):n=e[1];let o;return e[2]!==r||e[3]!==n?(o=a.jsxs(a.Fragment,{children:[r,n]}),e[2]=r,e[3]=n,e[4]=o):o=e[4],o}function In(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:K(ts,"bg-muted/40 p-3"),children:a.jsx(We,{className:"h-full w-full rounded-lg"})}),t[0]=e):e=t[0],e}function $n(t){const e=B.c(11),{mode:s,title:r,subLine:n,trailing:o}=t,d=s==="review"?qs:dl;let l;e[0]!==d?(l=a.jsx(d,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=d,e[1]=l):l=e[1];let i;e[2]!==l||e[3]!==r||e[4]!==o?(i=a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[l,r,o]}),e[2]=l,e[3]=r,e[4]=o,e[5]=i):i=e[5];let u;e[6]!==n?(u=n?a.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:n}):null,e[6]=n,e[7]=u):u=e[7];let c;return e[8]!==i||e[9]!==u?(c=a.jsxs(a.Fragment,{children:[i,u]}),e[8]=i,e[9]=u,e[10]=c):c=e[10],c}function Fn(t){const e=B.c(9),{draftPreviewUrl:s,t:r}=t;let n;e[0]!==s?(n=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=n):n=e[1];const o=!s;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(Is,{className:"size-4"}),e[2]=d):d=e[2];let l;e[3]!==r?(l=r("thread.publishPopover.preview"),e[3]=r,e[4]=l):l=e[4];let i;return e[5]!==n||e[6]!==o||e[7]!==l?(i=a.jsxs(ve,{type:"button",variant:"outline",onClick:n,disabled:o,children:[d,l]}),e[5]=n,e[6]=o,e[7]=l,e[8]=i):i=e[8],i}function va(t){const e=B.c(21),{mode:s,draftPreviewUrl:r}=t,n=be();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=a.jsx(In,{}),e[0]=o):o=e[0];let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(We,{className:"h-3.5 w-48"}),e[1]=d):d=e[1];let l;e[2]!==s?(l=a.jsx($n,{mode:s,title:d}),e[2]=s,e[3]=l):l=e[3];let i,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx(us,{children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Dt,{}),a.jsx(Dt,{}),a.jsx(Dt,{})]})}),u=a.jsxs(a.Fragment,{children:[a.jsx(We,{className:"h-3 w-20"}),a.jsx(We,{className:"h-14 w-full rounded-lg"})]}),e[4]=i,e[5]=u):(i=e[4],u=e[5]);let c;e[6]!==r||e[7]!==n?(c=a.jsx(Fn,{draftPreviewUrl:r,t:n}),e[6]=r,e[7]=n,e[8]=c):c=e[8];const h=s==="review"?"default":"brand";let p;e[9]!==s||e[10]!==n?(p=n(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[9]=s,e[10]=n,e[11]=p):p=e[11];let b;e[12]!==h||e[13]!==p?(b=a.jsx(ve,{type:"button",variant:h,className:"flex-1",disabled:!0,children:p}),e[12]=h,e[13]=p,e[14]=b):b=e[14];let f;e[15]!==c||e[16]!==b?(f=a.jsxs("div",{className:"flex gap-2",children:[c,b]}),e[15]=c,e[16]=b,e[17]=f):f=e[17];let m;return e[18]!==f||e[19]!==l?(m=a.jsx(ms,{pane:o,list:a.jsx(Gs,{state:"loading",header:l,body:i,note:u,footer:f})}),e[18]=f,e[19]=l,e[20]=m):m=e[20],m}function nc(t){const e=B.c(26),{mode:s,draftPreviewUrl:r,message:n,onRetry:o}=t,d=be();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx("div",{className:K(ts,"bg-muted/40")}),e[0]=l):l=e[0];let i;e[1]!==d?(i=d("thread.publishPopover.loadFailed"),e[1]=d,e[2]=i):i=e[2];let u;e[3]!==i?(u=a.jsx("span",{className:"truncate",children:i}),e[3]=i,e[4]=u):u=e[4];let c;e[5]!==s||e[6]!==u?(c=a.jsx($n,{mode:s,title:u}),e[5]=s,e[6]=u,e[7]=c):c=e[7];let h;e[8]!==n?(h=a.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:n}),e[8]=n,e[9]=h):h=e[9];let p;e[10]!==r||e[11]!==d?(p=a.jsx(Fn,{draftPreviewUrl:r,t:d}),e[10]=r,e[11]=d,e[12]=p):p=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(hn,{className:"size-4"}),e[13]=b):b=e[13];let f;e[14]!==d?(f=d("thread.publishPopover.retry"),e[14]=d,e[15]=f):f=e[15];let m;e[16]!==o||e[17]!==f?(m=a.jsxs(ve,{type:"button",variant:"outline",className:"flex-1",onClick:o,children:[b,f]}),e[16]=o,e[17]=f,e[18]=m):m=e[18];let g;e[19]!==p||e[20]!==m?(g=a.jsxs("div",{className:"flex gap-2",children:[p,m]}),e[19]=p,e[20]=m,e[21]=g):g=e[21];let x;return e[22]!==g||e[23]!==c||e[24]!==h?(x=a.jsx(ms,{pane:l,list:a.jsx(Gs,{state:"ready",header:c,body:h,footer:g})}),e[22]=g,e[23]=c,e[24]=h,e[25]=x):x=e[25],x}function rc(t){const e=B.c(3),s=t.mode??"publish";let r;return e[0]!==s||e[1]!==t?(r=a.jsx(gr,{children:n=>{const{reset:o}=n;return a.jsx(xr,{fallback:d=>{const{error:l,resetError:i}=d;return a.jsx(nc,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:l?.message??"",onRetry:()=>{o(),i()}})},children:a.jsx(q.Suspense,{fallback:a.jsx(va,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),children:a.jsx(ac,{...t})})})}}),e[0]=s,e[1]=t,e[2]=r):r=e[2],r}function ac(t){const e=B.c(13),s=Bt(t.virtualMcpId,t.branch);let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch},e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=r):r=e[3];const n=bn(r);if(s.kind==="protocol"&&n){let d;return e[4]!==s||e[5]!==n||e[6]!==t?(d=s.source==="sandbox"?a.jsx(oc,{...t,backend:s,cacheKey:n}):a.jsx(ic,{...t,backend:s,cacheKey:n}),e[4]=s,e[5]=n,e[6]=t,e[7]=d):d=e[7],d}if(s.kind!=="legacy"){const d=t.mode??"publish";let l;return e[8]!==t.draftPreviewUrl||e[9]!==d?(l=a.jsx(va,{mode:d,draftPreviewUrl:t.draftPreviewUrl}),e[8]=t.draftPreviewUrl,e[9]=d,e[10]=l):l=e[10],l}let o;return e[11]!==t?(o=a.jsx(lc,{...t}),e[11]=t,e[12]=o):o=e[12],o}function lc(t){const e=B.c(52),s=ns()?.taskId??null;let r;e[0]!==t.baseBranch||e[1]!==t.branch||e[2]!==t.fastPreview||e[3]!==t.orgSlug||e[4]!==t.recoverSandbox||e[5]!==t.virtualMcpId||e[6]!==s?(r={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:s,baseBranch:t.baseBranch,fastPreview:t.fastPreview,recoverSandbox:t.recoverSandbox},e[0]=t.baseBranch,e[1]=t.branch,e[2]=t.fastPreview,e[3]=t.orgSlug,e[4]=t.recoverSandbox,e[5]=t.virtualMcpId,e[6]=s,e[7]=r):r=e[7];const n=ba(r),o=t.mode!=="review";let d;e[8]!==t.branch||e[9]!==t.fastPreview||e[10]!==t.orgSlug||e[11]!==t.publishPolicy||e[12]!==t.virtualMcpId||e[13]!==n.allPaths||e[14]!==n.diff||e[15]!==n.status||e[16]!==o||e[17]!==s?(d={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:s,fastPreview:t.fastPreview,status:n.status,diff:n.diff,paths:n.allPaths,policy:t.publishPolicy,judgeEnabled:o},e[8]=t.branch,e[9]=t.fastPreview,e[10]=t.orgSlug,e[11]=t.publishPolicy,e[12]=t.virtualMcpId,e[13]=n.allPaths,e[14]=n.diff,e[15]=n.status,e[16]=o,e[17]=s,e[18]=d):d=e[18];const{gate:l}=ga(d),i=n.discardablePaths;let u;e[19]!==i?(u=P=>i===null||P.every(j=>i.has(j)),e[19]=i,e[20]=u):u=e[20];const c=u;let h;e[21]!==c?(h=P=>c(P.filepaths),e[21]=c,e[22]=h):h=e[22];let p;e[23]!==c||e[24]!==n.allPaths||e[25]!==n.changedFilesTruncated?(p=!n.changedFilesTruncated&&c(n.allPaths),e[23]=c,e[24]=n.allPaths,e[25]=n.changedFilesTruncated,e[26]=p):p=e[26];let b;e[27]!==t.branch||e[28]!==n.status?(b=Nn(n.status)??t.branch,e[27]=t.branch,e[28]=n.status,e[29]=b):b=e[29];const f=n.headSha??void 0;let m;e[30]!==t.fastPreview||e[31]!==n.diff?(m=!t.fastPreview&&n.diff?{expectedDiffSignature:kn(n.diff)}:{},e[30]=t.fastPreview,e[31]=n.diff,e[32]=m):m=e[32];let g;e[33]!==l||e[34]!==n.allPaths||e[35]!==n.bodiesFailed||e[36]!==n.bodiesPending||e[37]!==n.cardsPending||e[38]!==n.changedFilesTotal||e[39]!==n.changedFilesTruncated||e[40]!==n.diff||e[41]!==n.refresh||e[42]!==n.summary||e[43]!==h||e[44]!==p||e[45]!==b||e[46]!==f||e[47]!==m?(g={summary:n.summary,allPaths:n.allPaths,canDiscard:h,canDiscardAll:p,changedFilesTotal:n.changedFilesTotal,changedFilesTruncated:n.changedFilesTruncated,diff:n.diff,bodiesPending:n.bodiesPending,bodiesFailed:n.bodiesFailed,cardsPending:n.cardsPending,refresh:n.refresh,gate:l,headBranch:b,expectedHeadSha:f,...m,hosted:!1,otherWork:!1},e[33]=l,e[34]=n.allPaths,e[35]=n.bodiesFailed,e[36]=n.bodiesPending,e[37]=n.cardsPending,e[38]=n.changedFilesTotal,e[39]=n.changedFilesTruncated,e[40]=n.diff,e[41]=n.refresh,e[42]=n.summary,e[43]=h,e[44]=p,e[45]=b,e[46]=f,e[47]=m,e[48]=g):g=e[48];let x;return e[49]!==t||e[50]!==g?(x=a.jsx(Ln,{...t,source:g}),e[49]=t,e[50]=g,e[51]=x):x=e[51],x}function ya(t,e){return{summary:t.summary,allPaths:[],canDiscard:()=>!0,canDiscardAll:!0,changedFilesTotal:t.summary.count,changedFilesTruncated:!1,diff:null,bodiesPending:t.sidesPending,bodiesFailed:t.sidesFailed,cardsPending:!1,refresh:t.refresh,protocol:{backend:e,entries:t.entries},v8:{blocks:t.blocks}}}function ic(t){const e=B.c(23);let s,r,n;e[0]!==t?({backend:s,cacheKey:r,...n}=t,e[0]=t,e[1]=s,e[2]=r,e[3]=n):(s=e[1],r=e[2],n=e[3]);let o;e[4]!==n.branch||e[5]!==n.orgSlug||e[6]!==n.virtualMcpId?(o={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch},e[4]=n.branch,e[5]=n.orgSlug,e[6]=n.virtualMcpId,e[7]=o):o=e[7];let d;e[8]!==s||e[9]!==r||e[10]!==o?(d={backend:s,cacheKey:r,scope:o},e[8]=s,e[9]=r,e[10]=o,e[11]=d):d=e[11];const l=Bn(d),i=s.source==="github";let u;e[12]!==s||e[13]!==l?(u=ya(l,s),e[12]=s,e[13]=l,e[14]=u):u=e[14];let c;e[15]===Symbol.for("react.memo_cache_sentinel")?(c={allowed:!0,reason:null},e[15]=c):c=e[15];let h;e[16]!==i||e[17]!==n.branch||e[18]!==u?(h={...u,gate:c,headBranch:n.branch,hosted:i,otherWork:!1},e[16]=i,e[17]=n.branch,e[18]=u,e[19]=h):h=e[19];let p;return e[20]!==n||e[21]!==h?(p=a.jsx(Ln,{...n,source:h}),e[20]=n,e[21]=h,e[22]=p):p=e[22],p}function oc(t){const e=B.c(58);let s,r,n;e[0]!==t?({backend:s,cacheKey:r,...n}=t,e[0]=t,e[1]=s,e[2]=r,e[3]=n):(s=e[1],r=e[2],n=e[3]);const o=ns()?.taskId??null;let d;e[4]!==n.branch||e[5]!==n.orgSlug||e[6]!==n.virtualMcpId?(d={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch},e[4]=n.branch,e[5]=n.orgSlug,e[6]=n.virtualMcpId,e[7]=d):d=e[7];let l;e[8]!==s||e[9]!==r||e[10]!==d?(l={backend:s,cacheKey:r,scope:d},e[8]=s,e[9]=r,e[10]=d,e[11]=l):l=e[11];const i=Bn(l);let u;e[12]!==n.baseBranch||e[13]!==n.branch||e[14]!==n.fastPreview||e[15]!==n.orgSlug||e[16]!==n.recoverSandbox||e[17]!==n.virtualMcpId||e[18]!==o?(u={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:o,baseBranch:n.baseBranch,fastPreview:n.fastPreview,recoverSandbox:n.recoverSandbox},e[12]=n.baseBranch,e[13]=n.branch,e[14]=n.fastPreview,e[15]=n.orgSlug,e[16]=n.recoverSandbox,e[17]=n.virtualMcpId,e[18]=o,e[19]=u):u=e[19];const c=ba(u),h=n.mode!=="review";let p;e[20]!==c.allPaths||e[21]!==c.diff||e[22]!==c.status||e[23]!==n.branch||e[24]!==n.fastPreview||e[25]!==n.orgSlug||e[26]!==n.publishPolicy||e[27]!==n.virtualMcpId||e[28]!==h||e[29]!==o?(p={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:o,fastPreview:n.fastPreview,status:c.status,diff:c.diff,paths:c.allPaths,policy:n.publishPolicy,judgeEnabled:h},e[20]=c.allPaths,e[21]=c.diff,e[22]=c.status,e[23]=n.branch,e[24]=n.fastPreview,e[25]=n.orgSlug,e[26]=n.publishPolicy,e[27]=n.virtualMcpId,e[28]=h,e[29]=o,e[30]=p):p=e[30];const{gate:b}=ga(p);let f;if(e[31]!==c.allPaths||e[32]!==i){let k;e[34]!==i?(k=N=>{const C=Rn(N);return C===null?!Pn(N):!Object.hasOwn(i.changes.changes,C)},e[34]=i,e[35]=k):k=e[35],f=c.allPaths.some(k),e[31]=c.allPaths,e[32]=i,e[33]=f}else f=e[33];const m=f;let g;e[36]!==s||e[37]!==i?(g=ya(i,s),e[36]=s,e[37]=i,e[38]=g):g=e[38];let x;e[39]!==c||e[40]!==i?(x=()=>Promise.all([i.refresh(),c.refresh()]),e[39]=c,e[40]=i,e[41]=x):x=e[41];let P;e[42]!==c.status||e[43]!==n.branch?(P=Nn(c.status)??n.branch,e[42]=c.status,e[43]=n.branch,e[44]=P):P=e[44];const j=c.headSha??void 0;let y;e[45]!==c.diff?(y=c.diff?{expectedDiffSignature:kn(c.diff)}:{},e[45]=c.diff,e[46]=y):y=e[46];let S;e[47]!==b||e[48]!==m||e[49]!==j||e[50]!==y||e[51]!==g||e[52]!==x||e[53]!==P?(S={...g,refresh:x,gate:b,headBranch:P,expectedHeadSha:j,...y,hosted:!1,otherWork:m},e[47]=b,e[48]=m,e[49]=j,e[50]=y,e[51]=g,e[52]=x,e[53]=P,e[54]=S):S=e[54];let w;return e[55]!==n||e[56]!==S?(w=a.jsx(Ln,{...n,source:S}),e[55]=n,e[56]=S,e[57]=w):w=e[57],w}function Ln(t){const e=B.c(130),{source:s,publishLockRef:r,onOpenChange:n,mode:o,fastPreview:d,orgSlug:l,virtualMcpId:i,branch:u,baseBranch:c,repoTarget:h,owner:p,repo:b,draftPreviewUrl:f,destinationHost:m,previewServerUrl:g,compareDraft:x,lastPublishedPr:P,onRequestApproval:j,openPullRequest:y,onPullRequestChanged:S,onPublished:w}=t,k=o===void 0?"publish":o,N=P===void 0?null:P,C=y===void 0?null:y,v=be(),[A]=fr(),{language:T}=A,I=ns()?.taskId??null,{data:_}=zs.useSession(),$=yr(jr(l,i,u)),{allPaths:H,changedFilesTotal:O,changedFilesTruncated:G,diff:E,bodiesFailed:W,refresh:F,gate:V,hosted:te,otherWork:Y}=s;let ne;e[0]!==x||e[1]!==s.bodiesPending||e[2]!==s.cardsPending||e[3]!==s.summary?(ne={summary:s.summary,cardsPending:s.cardsPending,bodiesPending:s.bodiesPending,compareDraft:x},e[0]=x,e[1]=s.bodiesPending,e[2]=s.cardsPending,e[3]=s.summary,e[4]=ne):ne=e[4];const le=ne;let M;e[5]!==te?(M={hosted:te},e[5]=te,e[6]=M):M=e[6];const X=qi(le,M),{summary:D,cardsPending:Z,bodiesPending:se,compareDraft:ie}=X.shown,[ge,ue]=q.useState(null),[re,fe]=q.useState(!1),[ye,z]=q.useState(cc);let oe;e[7]===Symbol.for("react.memo_cache_sentinel")?(oe=U=>z(ae=>ae.has(U)?ae:new Set(ae).add(U)),e[7]=oe):oe=e[7];const xe=oe,[Q,ee]=q.useState(null);let ce;e[8]===Symbol.for("react.memo_cache_sentinel")?(ce=[],e[8]=ce):ce=e[8];const[J,de]=q.useState(ce);let Me;e[9]!==s.v8?(Me=U=>{ee(U),de(ae=>[U,...ae.filter(he=>he!==U)]),s.v8&&setTimeout(()=>xe(U),Zo)},e[9]=s.v8,e[10]=Me):Me=e[10];const mt=Me,[we,rt]=q.useState(null);let Le;e[11]!==ge||e[12]!==D?(Le=so(ge,ao(D)),e[11]=ge,e[12]=D,e[13]=Le):Le=e[13];const Re=Le,Te=[...D.pages,...D.blocks,...D.other],Ee=Te.find(U=>ke(U)===Q)??Te[0]??null,Ne=Ee?ke(Ee):null,at=[...new Set([...Ne?[Ne]:[],...J,...Te.map(ke)])].filter(U=>Te.some(ae=>ke(ae)===U)).slice(0,sc),ze=!!s.v8,[$t,Oe]=q.useState(null),Qe=ze?ec({selectedId:Ne,readyIds:ye,lastShownId:$t,liveIds:at}):Ne;ze&&Qe===Ne&&Qe!==$t&&Oe(Qe);const L=k==="review"&&!te,me=Z?"loading":se?"manifest":"ready",Pe=C?.state==="open",Se=s.headBranch,De=_?.user;let pt;e[14]!==De?(pt=Zr(De),e[14]=De,e[15]=pt):pt=e[15];let bt;e[16]!==s.expectedDiffSignature?(bt=s.expectedDiffSignature?{expectedDiffSignature:s.expectedDiffSignature}:{},e[16]=s.expectedDiffSignature,e[17]=bt):bt=e[17];let lt;e[18]!==c||e[19]!==u||e[20]!==d||e[21]!==l||e[22]!==p||e[23]!==b||e[24]!==h||e[25]!==s.expectedHeadSha||e[26]!==s.headBranch||e[27]!==pt||e[28]!==bt||e[29]!==I||e[30]!==i?(lt={orgSlug:l,virtualMcpId:i,branch:u,threadId:I,fastPreview:d,baseBranch:c,target:h,owner:p,repo:b,headBranch:Se,coAuthor:pt,expectedHeadSha:s.expectedHeadSha,...bt},e[18]=c,e[19]=u,e[20]=d,e[21]=l,e[22]=p,e[23]=b,e[24]=h,e[25]=s.expectedHeadSha,e[26]=s.headBranch,e[27]=pt,e[28]=bt,e[29]=I,e[30]=i,e[31]=lt):lt=e[31];const rs=lt,gt=L?"review":"publish",as=_?.user?.name;let it;e[32]!==H||e[33]!==m||e[34]!==te||e[35]!==Re||e[36]!==n||e[37]!==w||e[38]!==S||e[39]!==r||e[40]!==F||e[41]!==s.protocol||e[42]!==gt||e[43]!==as||e[44]!==rs?(it={mode:gt,target:rs,note:Re,allPaths:H,destinationHost:m,publishLockRef:r,onOpenChange:n,refresh:F,onPullRequestChanged:S,onPublished:w,hosted:te,authorName:as,protocol:s.protocol},e[32]=H,e[33]=m,e[34]=te,e[35]=Re,e[36]=n,e[37]=w,e[38]=S,e[39]=r,e[40]=F,e[41]=s.protocol,e[42]=gt,e[43]=as,e[44]=rs,e[45]=it):it=e[45];const{isPublishing:Ce,publishError:ot,publishErrorDetail:Ft,submit:xt,discardChange:Qs,discardAll:Lt}=Ml(it),Je=kr(l,i).phase==="saving",ct=D.count>0||Y,kt=!Ce&&ct&&(L||V.allowed);let dt;e[46]!==c||e[47]!==L||e[48]!==s.v8||e[49]!==D.count||e[50]!==v?(dt=L?D.count===0?v("thread.publishPopover.submitForReview"):D.count===1?v("thread.publishPopover.submitOneForReview"):v("thread.publishPopover.submitCountForReview",{count:D.count}):Xo(D.count,c,!!s.v8,v),e[46]=c,e[47]=L,e[48]=s.v8,e[49]=D.count,e[50]=v,e[51]=dt):dt=e[51];const ls=dt;let vt;e:{if(L&&Pe){let he;e[52]!==C.number||e[53]!==v?(he=v("thread.publishPopover.updatesPullRequest",{number:C.number}),e[52]=C.number,e[53]=v,e[54]=he):he=e[54],vt=he;break e}const U=N;if(!U?.mergedAt){vt=null;break e}let ae;if(e[55]!==T||e[56]!==U||e[57]!==v){const he=Oa(new Date(U.mergedAt),T),je=Eo(U);ae=je?v("thread.publishPopover.lastPublishedBy",{when:he,name:je}):v("thread.publishPopover.lastPublished",{when:he}),e[55]=T,e[56]=U,e[57]=v,e[58]=ae}else ae=e[58];vt=ae}const Nt=vt;let Ct;e[59]!==L||e[60]!==D.count||e[61]!==v?(Ct=L?v("thread.publishPopover.submitForReview"):D.count===1?v("thread.publishPopover.publishOne"):D.count>1?v("thread.publishPopover.publishCount",{count:D.count}):v("thread.publishPopover.publish"),e[59]=L,e[60]=D.count,e[61]=v,e[62]=Ct):Ct=e[62];const yt=Ct,At=(U,ae)=>ae.length===0?null:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("div",{className:"px-0.5 text-2xs font-medium text-muted-foreground",children:U}),ae.map(he=>{const je=ke(he);return a.jsx(ca,{change:he,bodyPending:se,selected:Ee!==null&&ke(Ee)===je,onSelect:()=>mt(je),confirming:we===je,onConfirmingChange:Ae=>rt(Ae?je:null),onDiscard:s.canDiscard(he)?()=>{Qs(he)}:void 0,isPublishing:Ce,isDiscarding:Je,v8:!!s.v8},je)})]});let Ye;e:{if(L||!ct){Ye=null;break e}if(V.pending){let je;e[63]===Symbol.for("react.memo_cache_sentinel")?(je=a.jsx(Zt,{className:"size-3.5 motion-reduce:animate-none"}),e[63]=je):je=e[63];let Ae;e[64]!==v?(Ae=v("thread.publishPopover.reviewing"),e[64]=v,e[65]=Ae):Ae=e[65];let Ke;e[66]!==Ae?(Ke=a.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[je,Ae]}),e[66]=Ae,e[67]=Ke):Ke=e[67],Ye=Ke;break e}if(V.allowed){Ye=null;break e}let U;e[68]===Symbol.for("react.memo_cache_sentinel")?(U=a.jsx(un,{className:"mt-0.5 size-3.5 shrink-0"}),e[68]=U):U=e[68];let ae;e[69]!==V.reason||e[70]!==v?(ae=V.reason??v("thread.publishPopover.needsReviewGeneric"),e[69]=V.reason,e[70]=v,e[71]=ae):ae=e[71];let he;e[72]!==ae?(he=a.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[U,a.jsx("span",{children:ae})]}),e[72]=ae,e[73]=he):he=e[73],Ye=he}const jt=Ye;let ut;e[74]!==Lt||e[75]!==re||e[76]!==Je||e[77]!==Ce||e[78]!==s.canDiscardAll||e[79]!==D.count||e[80]!==v?(ut=D.count<=1||!s.canDiscardAll?null:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"ml-auto shrink-0 text-2xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>fe(!0),disabled:Ce||Je,children:v("thread.publishPopover.discardAll")}),a.jsx(Bs,{open:re,onOpenChange:fe,children:a.jsxs(Ds,{children:[a.jsxs(Cs,{children:[a.jsx(ks,{children:v("thread.publishPopover.discardAllTitle")}),a.jsx(Ns,{children:v("thread.publishPopover.discardAllConfirm")})]}),a.jsxs(Ts,{children:[a.jsx(As,{children:v("thread.publishDialog.cancel")}),a.jsx(Rs,{onClick:()=>{Lt()},disabled:Je,className:K(vr({variant:"destructive"})),children:v("thread.publishPopover.discardAll")})]})]})})]}),e[74]=Lt,e[75]=re,e[76]=Je,e[77]=Ce,e[78]=s.canDiscardAll,e[79]=D.count,e[80]=v,e[81]=ut):ut=e[81];const Rt=ut,is=Z?a.jsx(us,{children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Dt,{}),a.jsx(Dt,{})]})}):D.count===0&&Y?a.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:v("thread.publishPopover.onlyOtherWork")}):D.count===0?a.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[a.jsx(wn,{className:"mb-1 size-5 text-success"}),a.jsx("p",{className:"text-sm font-medium",children:v(L?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:v(L?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):a.jsxs(us,{children:[G?a.jsx("p",{className:"text-2xs text-muted-foreground",children:v("thread.publishPopover.showingFirst",{shown:D.count,total:O})}):null,At(v("thread.publishPopover.pagesGroup"),D.pages),At(v("thread.publishPopover.blocksGroup"),D.blocks),At(v("thread.publishPopover.otherGroup"),D.other),W?a.jsx("p",{className:"text-2xs text-muted-foreground",children:v("thread.publishPopover.detailsUnavailable")}):null,Y?a.jsx("p",{className:"text-2xs text-muted-foreground",children:v("thread.publishPopover.alsoOtherWork")}):null]}),os=Z?a.jsx(In,{}):Ee?a.jsx("div",{className:K(ts,"relative"),children:Te.filter(U=>at.includes(ke(U))).map(U=>a.jsx("div",{className:K("absolute inset-0 flex",ze?ke(U)===Qe?"z-10":"pointer-events-none opacity-0":ke(U)!==Ne&&"hidden"),inert:ze&&ke(U)!==Qe,"aria-hidden":ze&&ke(U)!==Qe?!0:void 0,children:a.jsx(pa,{change:U,diff:E,bodyPending:se,previewServerUrl:g,draft:ie,lastPage:$,v8:s.v8,onReady:ze?()=>xe(ke(U)):void 0})},ke(U)))}):a.jsx("div",{className:K(ts,"bg-muted/40")});let Be;e[82]!==ls?(Be=a.jsx("span",{className:"truncate",children:ls}),e[82]=ls,e[83]=Be):Be=e[83];let Ie;e[84]!==Rt||e[85]!==k||e[86]!==Nt||e[87]!==Be?(Ie=a.jsx($n,{mode:k,title:Be,subLine:Nt,trailing:Rt}),e[84]=Rt,e[85]=k,e[86]=Nt,e[87]=Be,e[88]=Ie):Ie=e[88];let Xe;e[89]!==Ce||e[90]!==L||e[91]!==Re||e[92]!==D.count||e[93]!==v?(Xe=D.count===0?null:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm font-medium",children:v(L?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),a.jsx($l,{value:Re,onChange:U=>ue(U.target.value),placeholder:v(L?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,maxLength:El,className:"resize-none text-sm",disabled:Ce})]}),e[89]=Ce,e[90]=L,e[91]=Re,e[92]=D.count,e[93]=v,e[94]=Xe):Xe=e[94];let Ue;e[95]!==f||e[96]!==v?(Ue=a.jsx(Fn,{draftPreviewUrl:f,t:v}),e[95]=f,e[96]=v,e[97]=Ue):Ue=e[97];let wt;e[98]!==kt||e[99]!==V||e[100]!==ct||e[101]!==te||e[102]!==Ce||e[103]!==L||e[104]!==j||e[105]!==yt||e[106]!==X||e[107]!==xt||e[108]!==v?(wt=!L&&!te&&ct&&!V.allowed&&!V.pending?a.jsx(ve,{type:"button",className:"flex-1",onClick:j,disabled:Ce,children:v("thread.publishPopover.requestApproval")}):a.jsxs(ve,{type:"button",variant:L?"default":"brand",className:"flex-1",onClick:()=>{X.hold(),xt().then(U=>{U===!1&&X.release()})},disabled:!kt,children:[Ce?a.jsx(Zt,{className:"size-4 motion-reduce:animate-none"}):null,Ce?v(L?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):yt]}),e[98]=kt,e[99]=V,e[100]=ct,e[101]=te,e[102]=Ce,e[103]=L,e[104]=j,e[105]=yt,e[106]=X,e[107]=xt,e[108]=v,e[109]=wt):wt=e[109];let Ze;e[110]!==Ue||e[111]!==wt?(Ze=a.jsxs("div",{className:"flex gap-2",children:[Ue,wt]}),e[110]=Ue,e[111]=wt,e[112]=Ze):Ze=e[112];let qe;e[113]!==ot||e[114]!==Ft||e[115]!==v?(qe=ot?a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-destructive",children:ot}),Ft?a.jsx(Qa,{label:v("siteEditor.details"),detail:Ft}):null]}):null,e[113]=ot,e[114]=Ft,e[115]=v,e[116]=qe):qe=e[116];let $e;e[117]!==Ze||e[118]!==qe?($e=a.jsxs(a.Fragment,{children:[Ze,qe]}),e[117]=Ze,e[118]=qe,e[119]=$e):$e=e[119];let Fe;e[120]!==is||e[121]!==jt||e[122]!==me||e[123]!==Ie||e[124]!==Xe||e[125]!==$e?(Fe=a.jsx(Gs,{state:me,header:Ie,body:is,note:Xe,gate:jt,footer:$e}),e[120]=is,e[121]=jt,e[122]=me,e[123]=Ie,e[124]=Xe,e[125]=$e,e[126]=Fe):Fe=e[126];let He;return e[127]!==os||e[128]!==Fe?(He=a.jsx(ms,{pane:os,list:Fe}),e[127]=os,e[128]=Fe,e[129]=He):He=e[129],He}function cc(){return new Set}function dc(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return ii[t].short}const uc=new Set(["failure","timed_out","cancelled","action_required"]);function ja(t){return t.status==="completed"&&uc.has(t.conclusion)}function On(t){return t.status==="queued"||t.status==="in_progress"}function Ss(t){return t.isPending&&t.fetchStatus!=="idle"}function hc(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr-page"}}function ht(t,e,s){return e?[...t,hc(s)]:t}function Ge(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"sync",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function er(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function js(t,e,s){if(e.filter(On).length===0)return t;const n=e.filter(o=>o.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:n,total:e.length})}}function fc(t){const{lifecycle:e,branch:s,pr:r,checks:n,reviews:o,loading:d,t:l}=t;if(d)return{label:l("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&dc(t.claimPhase.kind)||l("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:l("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:l("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||l("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:l("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:l("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:l("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:l("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForBranchTooltip"),menu:[]};const i=s,u=i.unpushed>0&&!(r&&i.headSha&&r.headSha&&i.headSha===r.headSha);if(t.noReviewableDiff&&!r)return{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:i.base}),menu:Ge([],i,l)};if(i.workingTreeDirty||u)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ge(ht([er(l)],r,l),i,l)};if(Yr("no local work — checking PR/sync state",{workingTreeDirty:i.workingTreeDirty,unpushed:i.unpushed,aheadOfBase:i.aheadOfBase,behindBase:i.behindBase,branch:i.branch,base:i.base,prMerged:r?.merged??null,prState:r?.state??null}),r?.merged)return!!i.headSha&&!!r.headSha&&i.headSha!==r.headSha?{label:l("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:l("thread.headerActions.openNewPrTooltip"),menu:Ge(ht([],r,l),i,l)}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.prMergedTooltip",{prNumber:String(r.number),base:r.base}),menu:Ge(ht([],r,l),i,l)};if(i.aheadOfBase>0){if(r&&r.state==="closed"&&!r.merged)return{label:l("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:l("thread.headerActions.reopenPrTooltip",{prNumber:String(r.number)}),menu:Ge(ht([],r,l),i,l)};if(!r)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ge([er(l)],i,l)};if((o?.mergeableState??"unknown")==="dirty")return{label:l("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:l("thread.cmsActions.resolveOnProvider"),action:"open-pr-page"}]};const h=n.filter(On).length,p=n.filter(ja).map(f=>f.name);if(h===0&&p.length>0)return{label:l("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:l("thread.headerActions.failingChecksTooltip",{checks:p.join(", ")}),meta:{failingChecks:p},menu:Ge(ht([{key:"publish-anyway",label:l("thread.headerActions.publishAnyway"),action:"merge",tooltip:l("thread.headerActions.squashMergeTooltip",{prNumber:String(r.number),base:r.base})}],r,l),i,l)};if(o?.draft)return js({label:l("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:l("thread.headerActions.markDraftReadyTooltip"),menu:Ge(ht([],r,l),i,l)},n,l);const b=o?.unresolvedConversations??0;return b>0?js({label:l("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:l("thread.headerActions.unresolvedConversationsTooltip",{count:String(b)}),menu:Ge(ht([],r,l),i,l)},n,l):o?.missingRequiredApprovals?js({label:l("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:l("thread.headerActions.waitingForApprovalsTooltip"),menu:Ge(ht([],r,l),i,l)},n,l):js({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:Ge(ht([{key:"review",label:l("thread.headerActions.review"),action:"review"}],r,l),i,l)},n,l)}return i.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:i.base}),menu:[]}}function tr(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr"}}function ws(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"get-latest",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function sr(t,e,s,r){const n=e.length;if(n===0)return t;if(e.filter(On).length>0){const l=e.filter(u=>u.status==="completed").length,i=r("thread.cmsActions.checksRunning",{done:l,total:n});return s==="loading"?{...t,loading:!0,tooltip:i}:{...t,tooltip:i}}const d=e.filter(ja).length;return d>0?{...t,variant:"warning",tooltip:r("thread.cmsActions.checksFailing",{failed:d,total:n})}:t}function mc(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function pc(t){return Ss(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:Ss(t.checksQuery)||Ss(t.reviewsQuery)}function bc(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function gc(t,e){if(!t)return{branchMeta:{kind:"unknown"},publishableChangeCount:null};const s=Object.keys(t.changes).length;return{branchMeta:{kind:"ready",branch:e,base:t.base.resolvedRef??"main",workingTreeDirty:!1,unpushed:0,aheadOfBase:s,behindBase:0,headSha:t.revision},publishableChangeCount:s}}function xc(t){return{...t,menu:[]}}function vc(t){const{branch:e,pr:s,checks:r,reviews:n,publishing:o,saving:d,loading:l,publishableChangeCount:i,t:u}=t;if(e.kind!=="ready"&&t.statusError)return{label:u("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(l||e.kind!=="ready")return{label:u("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:u("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:u("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(d)return{label:u("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const h=n?.mergeableState??"unknown";return h==="dirty"?{label:u("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:u("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:u("thread.cmsActions.resolveOnProvider"),action:"open-pr"}]}:h==="blocked"||n?.draft?sr({label:u("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:ws([tr(u)],e,u)},r,"loading",u):sr({label:u("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ws([tr(u)],e,u)},r,"none",u)}return mc(s,e)?{label:u("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:ws([],e,u)}:bc(e,i)?{label:u("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ws([{key:"request-approval",label:u("thread.headerActions.submitForReview"),action:"request-approval"}],e,u)}:e.behindBase>0?{label:u("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:u("thread.cmsActions.getLatestTooltip"),menu:[],autoRun:e.aheadOfBase===0}:{label:u("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function yc(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function wa(t){const e=B.c(4);let s;e[0]!==t?(s=vl(t),e[0]=t,e[1]=s):s=e[1];let r;return e[2]!==s?(r={...s,select:jc},e[2]=s,e[3]=r):r=e[3],ft(r)}function jc(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:yc(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function nr(t,e){return t==="open-pr"||e==="resolve-on-provider"?a.jsx(Kr,{size:16}):t==="publish"?a.jsx($r,{className:"size-4"}):t==="get-latest"||t==="retry-status"?a.jsx(hn,{className:"size-4"}):a.jsx(qs,{className:"size-4"})}function wc(t){const e=B.c(63),{virtualMcpId:s}=t,r=be(),{org:n}=hs(),o=hr(),d=Ks(s),{data:l}=zs.useSession(),{deleteRelease:i}=Vs(s),{currentBranch:u,setCurrentTaskBranch:c,taskId:h,createTask:p}=wr();let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={open:!1,mode:"publish"},e[0]=b):b=e[0];const[f,m]=q.useState(b);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=L=>m({open:!0,mode:L}),e[1]=g):g=e[1];const x=g,P=Er(d),j=P.status==="attached"||P.status==="public-clone"?P.repo:null,{previewServerUrl:y}=fs(s),S=u?yr(jr(n.slug,s,u)):null,w=S?jn(S.path,S.params):"/",k=kl(u?{orgSlug:n.slug,virtualMcpId:s,branch:u,previewServerUrl:y,path:w}:null);let N;e[2]!==u||e[3]!==n.slug||e[4]!==s?(N=u?{orgSlug:n.slug,virtualMcpId:s,branch:u}:null,e[2]=u,e[3]=n.slug,e[4]=s,e[5]=N):N=e[5];const C=Nl(N),v=Bt(s,u),A=v.kind==="protocol"&&v.source==="github";let T;e[6]!==u||e[7]!==n.slug||e[8]!==s?(T=u?{orgSlug:n.slug,virtualMcpId:s,branch:u}:null,e[6]=u,e[7]=n.slug,e[8]=s,e[9]=T):T=e[9];const I=bn(T),_=Nr(A?v:null,I);let $;e[10]!==n.slug||e[11]!==s?($=Ja(n.slug,s),e[10]=n.slug,e[11]=s,e[12]=$):$=e[12];const H=Ya($,A?C:null),O=A?Xa(y,w,H):k.url,G=u??"",E=h??null;let W;e[13]!==n.slug||e[14]!==G||e[15]!==E||e[16]!==s?(W=Sn({orgSlug:n.slug,virtualMcpId:s,branch:G,threadId:E}),e[13]=n.slug,e[14]=G,e[15]=E,e[16]=s,e[17]=W):W=e[17];const F=!!u&&v.kind!=="pending"&&!A;let V;e[18]!==W||e[19]!==F?(V={...W,enabled:F},e[18]=W,e[19]=F,e[20]=V):V=e[20];const te=ft(V),Y=A?null:te.data??null,ne=A?gc(_.data,u??""):null,le=ne?ne.branchMeta:Y?{kind:"ready",branch:Nn(Y)??u??"",base:Y.base??"main",workingTreeDirty:ti(Y),unpushed:Y.unpushed??0,aheadOfBase:Y.aheadOfBase??0,behindBase:Y.behindBase??0,headSha:Y.headSha??""}:{kind:"unknown"},M=ne?ne.publishableChangeCount:Y?.changedFiles?la({files:Y.changedFiles}).count:null,X=A?_:te,D=(le.kind==="ready"?le.branch:null)??u??null,Z=le.kind==="ready"?le.base:"main",se=zr({orgId:n.id,orgSlug:n.slug,target:_e(j),owner:j?.owner??"",repo:j?.name??"",branch:D}),ie=se.data??null,ge=Ur({orgId:n.id,orgSlug:n.slug,target:_e(j),owner:j?.owner??"",repo:j?.name??"",base:Z}),ue=qr({orgId:n.id,orgSlug:n.slug,target:_e(j),owner:j?.owner??"",repo:j?.name??"",branch:D}),re=wa({orgId:n.id,orgSlug:n.slug,target:_e(j),owner:j?.owner??"",repo:j?.name??"",branch:D});let fe;e[21]!==ue||e[22]!==ie||e[23]!==se||e[24]!==re?(fe=pc({pr:ie,prQuery:se,checksQuery:ue,reviewsQuery:re}),e[21]=ue,e[22]=ie,e[23]=se,e[24]=re,e[25]=fe):fe=e[25];const ye=fe;let z;e[26]!==se?(z=async()=>{await se.refetch()},e[26]=se,e[27]=z):z=e[27];const oe=z,xe=Mn({mutationFn:()=>zi({hosted:A,branch:u,baseBranch:Z,nextBranch:()=>gn(xn(l?.user)),setCurrentTaskBranch:c,deleteRelease:i}),onError:kc});let Q;e[28]!==n.slug||e[29]!==h||e[30]!==s?(Q=async L=>(await si({orgSlug:n.slug,virtualMcpId:s,branch:L.branch,threadId:h??null},L.base),L),e[28]=n.slug,e[29]=h,e[30]=s,e[31]=Q):Q=e[31];let ee;e[32]!==u||e[33]!==n.slug||e[34]!==o||e[35]!==r||e[36]!==h||e[37]!==s?(ee=async L=>{et.success(r("thread.headerActions.syncedWithBase",{base:L.base})),await Promise.all([o.invalidateQueries({queryKey:Cn({orgSlug:n.slug,virtualMcpId:s,branch:u??L.branch,threadId:h??null})}),o.invalidateQueries({queryKey:ss.decofile(`${n.slug}/${s}/${L.branch}`)})])},e[32]=u,e[33]=n.slug,e[34]=o,e[35]=r,e[36]=h,e[37]=s,e[38]=ee):ee=e[38];let ce;e[39]!==Q||e[40]!==ee?(ce={mutationFn:Q,onSuccess:ee,onError:Sc},e[39]=Q,e[40]=ee,e[41]=ce):ce=e[41];const J=Mn(ce),de=Cr(n.slug,s),Me=xe.isPending,mt=vc({branch:le,pr:ie,checks:ue.data??[],reviews:re.data??null,publishing:Me,saving:de,syncing:J.isPending,statusRetrying:X.isFetching&&!!X.error,statusError:X.error instanceof Error?X.error.message:X.error?String(X.error):null,loading:!!ye,publishableChangeCount:M,t:r}),we=A?xc(mt):mt,rt=we.autoRun&&le.kind==="ready"&&j&&y?`${D}@${le.headSha}`:null,Le=q.useRef(null);if(q.useEffect(()=>{!rt||!D||Le.current!==rt&&(Le.current=rt,J.mutate({branch:D,base:Z}))},[rt,D,Z,J]),P.status==="detached"){let L;e[42]!==r?(L=r("thread.headerActions.reconnectGithub"),e[42]=r,e[43]=L):L=e[43];let me;e[44]!==L?(me=a.jsx(st,{asChild:!0,children:a.jsx("span",{children:a.jsx(ve,{size:"sm",variant:"outline",disabled:!0,children:L})})}),e[44]=L,e[45]=me):me=e[45];let Pe;e[46]!==r?(Pe=r("thread.headerActions.githubConnectionRemoved"),e[46]=r,e[47]=Pe):Pe=e[47];let Se;e[48]!==Pe?(Se=a.jsx(nt,{children:Pe}),e[48]=Pe,e[49]=Se):Se=e[49];let De;return e[50]!==me||e[51]!==Se?(De=a.jsx(Us,{children:a.jsxs(tt,{children:[me,Se]})}),e[50]=me,e[51]=Se,e[52]=De):De=e[52],De}if(!d)return null;if(!j||!y){const L=j?"noPreviewServer":"noRepo";let me;e[53]!==u||e[54]!==p?(me=u?()=>{const Se=p?.({runtime:"sandbox",branch:u});Se&&_a("coding_session_started",{thread_id:Se})}:void 0,e[53]=u,e[54]=p,e[55]=me):me=e[55];let Pe;return e[56]!==L||e[57]!==me?(Pe=a.jsx(Nc,{reason:L,onStartCodingSession:me}),e[56]=L,e[57]=me,e[58]=Pe):Pe=e[58],Pe}if(!u)return null;const Re=L=>{switch(L){case"publish":{x("publish");return}case"request-approval":{x("review");return}case"get-latest":{if(!D||J.isPending)return;J.mutate({branch:D,base:Z});return}case"retry-status":{X.refetch();return}case"open-pr":{ie?.htmlUrl&&window.open(ie.htmlUrl,"_blank","noopener,noreferrer");return}}};let Te;e[59]!==Re?(Te=L=>({key:L.key,label:L.label,icon:nr(L.action,L.key),...L.tooltip?{tooltip:L.tooltip}:{},onSelect:()=>Re(L.action)}),e[59]=Re,e[60]=Te):Te=e[60];const Ee=we.menu.map(Te),Ne=we.action,at=we.label,ze=we.variant,$t=!!we.loading;let Oe;e[61]!==r?(Oe=r("thread.cmsActions.moreActionsAriaLabel"),e[61]=r,e[62]=Oe):Oe=e[62];const Qe=a.jsx(Xr,{size:"sm",label:at,variant:ze,disabled:!!we.disabled||!Ne,loading:$t,...Ne&&!we.loading?{icon:nr(Ne)}:{},...we.tooltip?{tooltip:we.tooltip}:{},items:Ee,menuAriaLabel:Oe,onClick:Ne?()=>Re(Ne):void 0});return a.jsxs(a.Fragment,{children:[we.status?a.jsx("span",{className:"mr-1 hidden shrink-0 text-xs text-muted-foreground sm:inline",children:we.status}):null,Qe,u?a.jsx(xa,{open:f.open,mode:f.mode,fastPreview:!0,onOpenChange:L=>{L||m(Pc)},orgSlug:n.slug,virtualMcpId:s,branch:u,baseBranch:Z,repoTarget:_e(j),owner:j.owner,repo:j.name,publishPolicy:Qr(d?.metadata?.publishPolicy),draftPreviewUrl:O,destinationHost:k.host,previewServerUrl:y,compareDraft:C?{kind:"pointer",pointer:C,...H?{link:H}:{}}:null,lastPublishedPr:ge.data??null,onRequestApproval:()=>x("review"),openPullRequest:ie?.state==="open"?ie:null,onPullRequestChanged:oe,onPublished:()=>xe.mutateAsync()}):null]})}function Pc(t){return{...t,open:!1}}function Sc(t){et.error(t instanceof Error?t.message:String(t))}function kc(t){console.error("site editor: settling after publish failed",t)}function Nc(t){const e=B.c(14),{reason:s,onStartCodingSession:r}=t,n=be(),o=!r;let d;e[0]!==n?(d=n("sandbox.cmsUnavailable.startCodingSession"),e[0]=n,e[1]=d):d=e[1];let l;e[2]!==r||e[3]!==o||e[4]!==d?(l=a.jsx(st,{asChild:!0,children:a.jsx("span",{children:a.jsx(ve,{size:"sm",variant:"outline",disabled:o,onClick:r,children:d})})}),e[2]=r,e[3]=o,e[4]=d,e[5]=l):l=e[5];let i;e[6]!==s||e[7]!==n?(i=n(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=n,e[8]=i):i=e[8];let u;e[9]!==i?(u=a.jsx(nt,{children:i}),e[9]=i,e[10]=u):u=e[10];let c;return e[11]!==l||e[12]!==u?(c=a.jsx(Us,{children:a.jsxs(tt,{children:[l,u]})}),e[11]=l,e[12]=u,e[13]=c):c=e[13],c}const It="The user clicked this action deliberately — execute directly. Do not call user_ask unless you hit an actual problem outside the scope of this intent (missing auth, unresolvable conflict, a check with multiple plausible fixes).";function Cc(t){return`Reopen PR #${t.prNumber}. ${It}`}function Ac(t){return`Rebase \`${t.branch}\` on the latest base and force-push with --force-with-lease. ${It}`}function Rc(t){return`Sync \`${t.branch}\` with everyone else's work: \`git add -A\`, commit any pending local changes with a concise conventional-commit message (skip if the working tree is clean), \`git pull --rebase\` to bring in anything pushed directly to \`origin/${t.branch}\`, then \`git rebase origin/${t.base}\` to catch up with the base branch. Resolve any conflicts that come up, then push the result (force-with-lease only if the rebase rewrote commits already on the remote). ${It}`}function Tc(t){const e=(t.failingChecks??[]).map(s=>`\`${s}\``).join(", ");return`PR #${t.prNumber} has failing checks: ${e}. For each: read the logs, diagnose the root cause, apply the smallest fix that makes it pass, commit, and push. ${It}`}function Dc(t){return`Mark PR #${t.prNumber} ready for review. ${It}`}function Bc(t){return`Read the unresolved review threads on PR #${t.prNumber}. For each thread: understand the reviewer's ask, apply the needed changes, commit, push, reply explaining what changed, and resolve the thread. If a comment is a question that doesn't need a code change, reply with the answer and resolve. ${It}`}function Ic(t){return`Review PR #${t.prNumber}. Read the full diff, analyze every changed file for correctness, security, code quality, and alignment with the repo's patterns. Post specific line-level review comments on concerns, then submit an overall review (approve / request changes / comment) with a concise summary. Do not modify the code — this is a read-and-comment pass. ${It}`}function rr(t){switch(t){case"publish":return a.jsx($r,{className:"size-4"});case"create-pr":case"reopen":return a.jsx(qs,{className:"size-4"});case"rebase":case"sync":return a.jsx(hn,{className:"size-4"});case"fix-checks":return a.jsx(un,{className:"size-4"});case"mark-ready":return a.jsx(wn,{className:"size-4"});case"resolve-comments":return a.jsx(ul,{className:"size-4"});case"merge":return a.jsx(Vl,{className:"size-4"});case"review":return a.jsx(Is,{className:"size-4"});case"open-pr-page":return a.jsx(Kr,{size:16})}}const ar=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),lr=new Set(["publish","create-pr"]);function $c(t){const e=B.c(44),{t:s,button:r,actionBusy:n,changeRequestPending:o,savePending:d,onAction:l}=t,i=r.action;let u;e[0]!==i||e[1]!==n?(u=n&&i!==void 0&&ar.has(i),e[0]=i,e[1]=n,e[2]=u):u=e[2];const c=u,h=o&&i==="merge";let p;e[3]!==i||e[4]!==d?(p=d&&i!==void 0&&lr.has(i),e[3]=i,e[4]=d,e[5]=p):p=e[5];const b=p,f=!!r.disabled||c||h||b||!i,m=!!r.loading||h;let g;e[6]!==r.tooltip||e[7]!==c||e[8]!==b||e[9]!==s?(g=c?s("thread.headerActions.chatIsRunning"):b?s("thread.headerActions.saving"):r.tooltip,e[6]=r.tooltip,e[7]=c,e[8]=b,e[9]=s,e[10]=g):g=e[10];const x=g;let P;if(e[11]!==n||e[12]!==r.menu||e[13]!==o||e[14]!==l||e[15]!==d||e[16]!==s){let A;e[18]!==n||e[19]!==o||e[20]!==l||e[21]!==d||e[22]!==s?(A=T=>{const I=n&&ar.has(T.action),_=d&&lr.has(T.action),$=T.action==="merge"&&o,H=_?s("thread.headerActions.saving"):I?s("thread.headerActions.chatIsRunning"):T.tooltip;return{key:T.key,label:T.label,icon:rr(T.action),disabled:!!(I||_||$),...H?{tooltip:H}:{},onSelect:()=>l(T.action)}},e[18]=n,e[19]=o,e[20]=l,e[21]=d,e[22]=s,e[23]=A):A=e[23],P=r.menu.map(A),e[11]=n,e[12]=r.menu,e[13]=o,e[14]=l,e[15]=d,e[16]=s,e[17]=P}else P=e[17];const j=P,y=r.label,S=r.variant;let w;e[24]!==i||e[25]!==m?(w=i&&!m?{icon:rr(i)}:{},e[24]=i,e[25]=m,e[26]=w):w=e[26];let k;e[27]!==x?(k=x?{tooltip:x}:{},e[27]=x,e[28]=k):k=e[28];let N;e[29]!==s?(N=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=N):N=e[30];let C;e[31]!==i||e[32]!==l?(C=i?()=>l(i):void 0,e[31]=i,e[32]=l,e[33]=C):C=e[33];let v;return e[34]!==r.label||e[35]!==r.variant||e[36]!==f||e[37]!==j||e[38]!==m||e[39]!==w||e[40]!==k||e[41]!==N||e[42]!==C?(v=a.jsx(Xr,{size:"sm",label:y,variant:S,disabled:f,loading:m,...w,...k,items:j,menuAriaLabel:N,onClick:C}),e[34]=r.label,e[35]=r.variant,e[36]=f,e[37]=j,e[38]=m,e[39]=w,e[40]=k,e[41]=N,e[42]=C,e[43]=v):v=e[43],v}function ir(t){const e=B.c(9),{label:s,children:r}=t;if(!s){let l;return e[0]!==r?(l=a.jsx(a.Fragment,{children:r}),e[0]=r,e[1]=l):l=e[1],l}let n;e[2]!==r?(n=a.jsx(st,{asChild:!0,children:a.jsx("span",{children:r})}),e[2]=r,e[3]=n):n=e[3];let o;e[4]!==s?(o=a.jsx(nt,{children:s}),e[4]=s,e[5]=o):o=e[5];let d;return e[6]!==n||e[7]!==o?(d=a.jsx(Us,{children:a.jsxs(tt,{children:[n,o]})}),e[6]=n,e[7]=o,e[8]=d):d=e[8],d}function Fc(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function Lc({virtualMcpId:t}){const e=be(),{org:s}=hs(),{data:r}=zs.useSession(),n=Ks(t),{deleteRelease:o}=Vs(t),{currentBranch:d,setCurrentTaskBranch:l,createTask:i,taskId:u}=wr(),c=Ua(),{openSidePanel:h}=tl(),[p,b]=q.useState({open:!1,mode:"publish",policyOverride:null}),f=oi({connectionId:Ma,orgId:s.id,orgSlug:s.slug}),m=di(f),[g,x]=q.useState(!1),P=q.useRef(""),j=Er(n),y=j.status==="attached"||j.status==="public-clone"?j.repo:null,{lifecycle:S,branch:w,phase:k}=ci(),N={orgSlug:s.slug,virtualMcpId:t,branch:d??"",threadId:u??null},v=ft({queryKey:Cn(N),queryFn:()=>Wr(N),enabled:!!d,staleTime:15e3,refetchInterval:Q=>Ys(Q.state.data)?5e3:!1}).data??null,A=w,T=S,I=A.kind==="ready"?A.branch:null,_=d??I??void 0,$=(A.kind==="ready"?A.branch:null)??_??null,H=zr({orgId:s.id,orgSlug:s.slug,target:_e(y),owner:y?.owner??"",repo:y?.name??"",branch:$}),O=H.data??null,G=qr({orgId:s.id,orgSlug:s.slug,target:_e(y),owner:y?.owner??"",repo:y?.name??"",branch:$}),E=wa({orgId:s.id,orgSlug:s.slug,target:_e(y),owner:y?.owner??"",repo:y?.name??"",branch:$}),W=Ur({orgId:s.id,orgSlug:s.slug,target:_e(y),owner:y?.owner??"",repo:y?.name??"",base:A.kind==="ready"?A.base:null}),F=A,V=Qr(n?.metadata?.publishPolicy),te=Cr(s.slug,t),{previewUrl:Y}=ui(),{previewServerUrl:ne,projectDefault:le}=fs(t);if(j.status==="detached")return a.jsx(ir,{label:e("thread.headerActions.githubConnectionRemoved"),children:a.jsx(ve,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!y)return null;const M=$?fc({lifecycle:T,branch:F,claimPhase:k,pr:O,checks:G.data??[],reviews:E.data??null,noReviewableDiff:Ys(v),loading:Ss(H),t:e}):Fc(e),X=JSON.stringify({label:M.label,branchKind:F.kind,workingTreeDirty:F.kind==="ready"?F.workingTreeDirty:null,unpushed:F.kind==="ready"?F.unpushed:null,aheadOfBase:F.kind==="ready"?F.aheadOfBase:null,lifecycle:T.phase,headBranch:$,noReviewableDiff:Ys(v)});P.current!==X&&(P.current=X,Yr("header button",{label:M.label,tooltip:M.tooltip,action:M.action,chatBranch:d,sandboxBranch:I,sandboxRouteBranch:_,headBranch:$,branchMeta:A,effectiveBranchMeta:F,lifecyclePhase:T.phase,prNumber:O?.number??null,prState:O?.state??null}));const D=Q=>(h(),c.sendMessage({parts:[{type:"text",text:Q}]})),Z=c.isStreaming,se=F.kind==="ready"?F.base:"main",ie=async()=>{await H.refetch()},ge=async()=>{const Q=d,ee=gn(xn(r?.user));le==="cms"?i({runtime:"cms",branch:ee}):await l(ee),Q&&Q!==se&&await o(Q)},ue=async Q=>{if(!(!y||g)){x(!0);try{const ee=Zr(r?.user);await zl(s.slug,_e(y),{number:Q,coAuthor:ee}),et.success(e("thread.headerActions.publishedPr",{prNumber:String(Q)})),await ie(),await ge()}catch(ee){et.error(ee instanceof Ul?ee.detail??ql(ee.reason,e):ee instanceof Error?ee.message:e("thread.headerActions.failedToMergePullRequest"))}finally{x(!1)}}},re=(Q,ee)=>b({open:!0,mode:Q,policyOverride:ee}),fe=Q=>{if($)switch(Q){case"publish":re("publish",M.meta?.publishPolicyOverride??null);return;case"create-pr":re("review",null);return;case"merge":O&&ue(O.number);return;case"sync":if(Z)return;D(Rc({branch:$,base:se}));return;case"open-pr-page":O?.htmlUrl&&window.open(O.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(Z)return;O&&D(Ic({prNumber:O.number}));return;case"reopen":if(Z)return;O&&D(Cc({prNumber:O.number}));return;case"rebase":if(Z)return;D(Ac({branch:$}));return;case"fix-checks":if(Z)return;O&&D(Tc({prNumber:O.number,failingChecks:M.meta?.failingChecks??[]}));return;case"mark-ready":if(Z)return;O&&D(Dc({prNumber:O.number}));return;case"resolve-comments":if(Z)return;O&&D(Bc({prNumber:O.number}));return}},ye=g||Z,z=a.jsx($c,{t:e,button:M,actionBusy:ye,changeRequestPending:g,savePending:te,onAction:fe}),oe=F.kind==="ready"&&F.pushError&&F.pushFailingSince?e("thread.headerActions.pushFailing",{since:new Date(F.pushFailingSince).toLocaleString(),error:F.pushError}):null,xe=oe?a.jsx(ir,{label:oe,children:a.jsx(un,{role:"img","aria-label":oe,className:"size-4 text-warning"})}):null;return _?a.jsxs(a.Fragment,{children:[xe,z,a.jsx(xa,{open:p.open,mode:p.mode,fastPreview:!1,recoverSandbox:()=>m.mutateAsync({virtualMcpId:t,branch:_,...u?{threadId:u}:{}}),onOpenChange:Q=>{Q||b(ee=>({...ee,open:!1}))},orgSlug:s.slug,virtualMcpId:t,branch:_,baseBranch:se,repoTarget:_e(y),owner:y.owner,repo:y.name,publishPolicy:p.policyOverride??V,draftPreviewUrl:Y,destinationHost:null,previewServerUrl:ne,compareDraft:Y?{kind:"sandbox",previewUrl:Y}:null,lastPublishedPr:W.data??null,onRequestApproval:()=>b(Q=>({...Q,open:!0,mode:"review"})),openPullRequest:O?.state==="open"?O:null,onPullRequestChanged:ie,onPublished:ge})]}):a.jsxs(a.Fragment,{children:[xe,z]})}function Oc(t){const e=B.c(33),{orgSlug:s,virtualMcpId:r,branch:n}=t,o=be(),[d,l]=q.useState(!1),i=Bt(r,n),u=i.kind==="protocol"&&i.source==="local"?i:null;let c;e[0]!==n||e[1]!==s||e[2]!==r?(c=n?{orgSlug:s,virtualMcpId:r,branch:n}:null,e[0]=n,e[1]=s,e[2]=r,e[3]=c):c=e[3];const h=bn(c),{data:p}=Nr(u,h);if(!u||!h||!n)return null;let b;e[4]!==p?(b=p?Object.keys(p.changes).length:0,e[4]=p,e[5]=b):b=e[5];const f=b;let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=()=>l(!0),e[6]=m):m=e[6];let g;e[7]!==f||e[8]!==o?(g=f>0?o("decoServe.changes.buttonCount",{count:f}):o("decoServe.changes.button"),e[7]=f,e[8]=o,e[9]=g):g=e[9];let x;e[10]!==g?(x=a.jsx(ve,{size:"sm",variant:"outline","data-testid":"local-changes-button",onClick:m,children:g}),e[10]=g,e[11]=x):x=e[11];let P;e[12]!==o?(P=o("decoServe.changes.title"),e[12]=o,e[13]=P):P=e[13];let j;e[14]!==P?(j=a.jsx(pr,{className:"sr-only",children:P}),e[14]=P,e[15]=j):j=e[15];let y;e[16]!==n||e[17]!==h||e[18]!==u||e[19]!==d||e[20]!==s||e[21]!==o||e[22]!==r?(y=d?a.jsx(gr,{children:N=>{const{reset:C}=N;return a.jsx(xr,{fallback:v=>{const{resetError:A}=v;return a.jsx(on,{title:o("decoServe.changes.title"),body:a.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:o("decoServe.changes.loadFailed")}),onClose:()=>{C(),A(),l(!1)}})},children:a.jsx(q.Suspense,{fallback:a.jsx(ms,{pane:a.jsx(In,{}),list:a.jsx(on,{title:o("decoServe.changes.title"),loading:!0,body:a.jsx(us,{children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Dt,{}),a.jsx(Dt,{})]})}),onClose:()=>l(!1)})}),children:a.jsx(_c,{orgSlug:s,virtualMcpId:r,branch:n,backend:u,cacheKey:h,onClose:()=>l(!1)})})})}}):null,e[16]=n,e[17]=h,e[18]=u,e[19]=d,e[20]=s,e[21]=o,e[22]=r,e[23]=y):y=e[23];let S;e[24]!==j||e[25]!==y?(S=a.jsxs(br,{"aria-describedby":void 0,className:"flex h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-none flex-col md:flex-row md:h-[calc(100dvh-6rem)] md:w-[calc(100vw-6rem)] gap-0 overflow-hidden p-0 sm:max-w-none",closeButtonClassName:"top-3.5 right-3.5",children:[j,y]}),e[24]=j,e[25]=y,e[26]=S):S=e[26];let w;e[27]!==d||e[28]!==S?(w=a.jsx(mr,{open:d,onOpenChange:l,children:S}),e[27]=d,e[28]=S,e[29]=w):w=e[29];let k;return e[30]!==w||e[31]!==x?(k=a.jsxs(a.Fragment,{children:[x,w]}),e[30]=w,e[31]=x,e[32]=k):k=e[32],k}function on(t){const e=B.c(22),{title:s,trailing:r,body:n,loading:o,onClose:d}=t,l=o===void 0?!1:o,i=be(),u=l?"loading":"ready";let c;e[0]!==s?(c=a.jsx("span",{className:"truncate",children:s}),e[0]=s,e[1]=c):c=e[1];let h;e[2]!==c||e[3]!==r?(h=a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[c,r]}),e[2]=c,e[3]=r,e[4]=h):h=e[4];let p;e[5]!==i?(p=i("decoServe.changes.hint"),e[5]=i,e[6]=p):p=e[6];let b;e[7]!==p?(b=a.jsx("p",{className:"text-2xs text-muted-foreground",children:a.jsx(Jr,{text:p})}),e[7]=p,e[8]=b):b=e[8];let f;e[9]!==i?(f=i("decoServe.changes.close"),e[9]=i,e[10]=f):f=e[10];let m;e[11]!==d||e[12]!==f?(m=a.jsx(ve,{type:"button",variant:"outline",className:"w-full",onClick:d,children:f}),e[11]=d,e[12]=f,e[13]=m):m=e[13];let g;e[14]!==b||e[15]!==m?(g=a.jsxs(a.Fragment,{children:[b,m]}),e[14]=b,e[15]=m,e[16]=g):g=e[16];let x;return e[17]!==n||e[18]!==u||e[19]!==h||e[20]!==g?(x=a.jsx(Gs,{state:u,header:h,body:n,footer:g}),e[17]=n,e[18]=u,e[19]=h,e[20]=g,e[21]=x):x=e[21],x}function _c(t){const e=B.c(54),{orgSlug:s,virtualMcpId:r,branch:n,backend:o,cacheKey:d,onClose:l}=t,i=be();let u;e[0]!==n||e[1]!==s||e[2]!==r?(u={orgSlug:s,virtualMcpId:r,branch:n},e[0]=n,e[1]=s,e[2]=r,e[3]=u):u=e[3];let c;e[4]!==o||e[5]!==d||e[6]!==u?(c={backend:o,cacheKey:d,scope:u},e[4]=o,e[5]=d,e[6]=u,e[7]=c):c=e[7];const h=Bn(c);let p;e[8]!==n||e[9]!==s||e[10]!==h.refresh||e[11]!==r?(p={orgSlug:s,virtualMcpId:r,branch:n,refresh:h.refresh},e[8]=n,e[9]=s,e[10]=h.refresh,e[11]=r,e[12]=p):p=e[12];const b=Hl(p),f=kr(s,r).phase==="saving",m=o.describe.readOnly,[g,x]=q.useState(null),[P,j]=q.useState(null),[y,S]=q.useState(!1),{summary:w}=h;let k,N,C,v,A;if(e[13]!==g||e[14]!==o||e[15]!==P||e[16]!==b||e[17]!==y||e[18]!==f||e[19]!==m||e[20]!==h.blocks||e[21]!==h.entries||e[22]!==h.sidesFailed||e[23]!==h.sidesPending||e[24]!==w.blocks||e[25]!==w.count||e[26]!==w.pages||e[27]!==i){const _=[...w.pages,...w.blocks],$=_.find(E=>ke(E)===g)??_[0]??null;let H;e[33]!==w.count||e[34]!==i?(H=w.count===0?i("decoServe.changes.title"):w.count===1?i("decoServe.changes.titleOne"):i("decoServe.changes.titleCount",{count:w.count}),e[33]=w.count,e[34]=i,e[35]=H):H=e[35],A=H;const O=(E,W)=>W.length===0?null:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("div",{className:"px-0.5 text-2xs font-medium text-muted-foreground",children:E}),W.map(F=>{const V=ke(F);return a.jsx(ca,{change:F,bodyPending:h.sidesPending,v8:!0,selected:$!==null&&ke($)===V,onSelect:()=>x(V),confirming:P===V,onConfirmingChange:te=>j(te?V:null),onDiscard:m||!F.entry?void 0:()=>{b(o,[F.entry],i("thread.publishPopover.discarded",{name:F.name}))},isPublishing:!1,isDiscarding:f},V)})]});let G;e[36]!==o||e[37]!==b||e[38]!==y||e[39]!==f||e[40]!==m||e[41]!==h.entries||e[42]!==w.count||e[43]!==i?(G=m||w.count<=1?null:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"ml-auto shrink-0 text-2xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>S(!0),disabled:f,children:i("thread.publishPopover.discardAll")}),a.jsx(Bs,{open:y,onOpenChange:S,children:a.jsxs(Ds,{children:[a.jsxs(Cs,{children:[a.jsx(ks,{children:i("thread.publishPopover.discardAllTitle")}),a.jsx(Ns,{children:i("thread.publishPopover.discardAllConfirm")})]}),a.jsxs(Ts,{children:[a.jsx(As,{children:i("thread.publishDialog.cancel")}),a.jsx(Rs,{onClick:()=>{b(o,h.entries,i("thread.publishDialog.allChangesDiscarded"))},disabled:f,className:K(vr({variant:"destructive"})),children:i("thread.publishPopover.discardAll")})]})]})})]}),e[36]=o,e[37]=b,e[38]=y,e[39]=f,e[40]=m,e[41]=h.entries,e[42]=w.count,e[43]=i,e[44]=G):G=e[44],C=G,N=w.count===0?a.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[a.jsx(wn,{className:"mb-1 size-5 text-success"}),a.jsx("p",{className:"text-sm font-medium",children:i("decoServe.changes.empty")})]}):a.jsxs(us,{children:[O(i("thread.publishPopover.pagesGroup"),w.pages),O(i("thread.publishPopover.blocksGroup"),w.blocks),h.sidesFailed?a.jsx("p",{className:"text-2xs text-muted-foreground",children:i("thread.publishPopover.detailsUnavailable")}):null]}),k=ms,v=$?a.jsx("div",{className:K(ts,"relative flex"),children:a.jsx(pa,{change:$,diff:null,bodyPending:h.sidesPending,previewServerUrl:null,draft:null,lastPage:null,v8:{blocks:h.blocks}},ke($))}):a.jsx("div",{className:K(ts,"bg-muted/40")}),e[13]=g,e[14]=o,e[15]=P,e[16]=b,e[17]=y,e[18]=f,e[19]=m,e[20]=h.blocks,e[21]=h.entries,e[22]=h.sidesFailed,e[23]=h.sidesPending,e[24]=w.blocks,e[25]=w.count,e[26]=w.pages,e[27]=i,e[28]=k,e[29]=N,e[30]=C,e[31]=v,e[32]=A}else k=e[28],N=e[29],C=e[30],v=e[31],A=e[32];let T;e[45]!==N||e[46]!==C||e[47]!==l||e[48]!==A?(T=a.jsx(on,{title:A,trailing:C,body:N,onClose:l}),e[45]=N,e[46]=C,e[47]=l,e[48]=A,e[49]=T):T=e[49];let I;return e[50]!==k||e[51]!==v||e[52]!==T?(I=a.jsx(k,{pane:v,list:T}),e[50]=k,e[51]=v,e[52]=T,e[53]=I):I=e[53],I}function Mc(t){const e=B.c(5),{virtualMcpId:s,branch:r}=t,n=be(),o=Bt(s,r);if(!Ec(o))return null;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(st,{asChild:!0,children:a.jsx("span",{"data-testid":"content-version-badge",className:"shrink-0 rounded border border-border px-1.5 py-px font-mono text-2xs leading-4 text-muted-foreground",children:"v8"})}),e[0]=d):d=e[0];let l;e[1]!==n?(l=n("decoServe.version.v8"),e[1]=n,e[2]=l):l=e[2];let i;return e[3]!==l?(i=a.jsxs(tt,{children:[d,a.jsx(nt,{side:"bottom",className:"max-w-xs",children:l})]}),e[3]=l,e[4]=i):i=e[4],i}function Ec(t){return t.kind==="protocol"?t.hasSchema!==!1:t.kind==="unavailable"&&t.source!=="local"}function zc(t){const e=B.c(11),{virtualMcpId:s,branch:r}=t,n=be(),o=Bt(s,r);if(!(o.kind==="protocol"&&o.source==="local"&&o.describe.readOnly))return null;let l;e[0]!==n?(l=n("decoServe.readOnly.label"),e[0]=n,e[1]=l):l=e[1];let i;e[2]!==l?(i=a.jsx(st,{asChild:!0,children:a.jsx("span",{tabIndex:0,"data-testid":"deco-serve-read-only",className:"shrink-0 rounded-full bg-warning/10 px-2 py-0.5 text-xs font-medium text-foreground",children:l})}),e[2]=l,e[3]=i):i=e[3];let u;e[4]!==n?(u=n("decoServe.readOnly.tooltip"),e[4]=n,e[5]=u):u=e[5];let c;e[6]!==u?(c=a.jsx(nt,{side:"bottom",className:"max-w-xs",children:a.jsx(Jr,{text:u})}),e[6]=u,e[7]=c):c=e[7];let h;return e[8]!==i||e[9]!==c?(h=a.jsxs(tt,{children:[i,c]}),e[8]=i,e[9]=c,e[10]=h):h=e[10],h}function Uc(t){return t.servingLocally||t.localPreview?"open":t.runtimeResolved?t.runtime!=="cms"?"open":t.branch?t.blocksV8?"open":t.defaultBranch?t.defaultBranch===t.branch?"blocked":"open":t.listedDraft||t.defaultBranch===null?"open":"pending":"pending":"pending"}function qc(){const t=B.c(27),e=ns(),{org:s}=hs(),r=Ks(e?.virtualMcpId),n=r?.id??e?.virtualMcpId??"",o=e?.currentBranch??null,{runtime:d,resolved:l}=fs(r?.id),i=vn(r?.id),{url:u}=fn(r?.id),{connection:c}=mn(n||null),h=!!r&&!!o&&l&&d==="cms"&&!i&&!u,p=o??"",b=e?.taskId??null;let f,m,g,x;t[0]!==s.slug||t[1]!==p||t[2]!==b||t[3]!==n?(m={orgSlug:s.slug,virtualMcpId:n,branch:p,threadId:b},f=Hc,x=ft,g=Sn(m),t[0]=s.slug,t[1]=p,t[2]=b,t[3]=n,t[4]=f,t[5]=m,t[6]=g,t[7]=x):(f=t[4],m=t[5],g=t[6],x=t[7]);let P;t[8]!==f||t[9]!==m?(P=(T,I)=>f(I?.queryKey)===f(Cn(m))?T:void 0,t[8]=f,t[9]=m,t[10]=P):P=t[10];let j;t[11]!==h||t[12]!==g||t[13]!==P?(j={...g,enabled:h,placeholderData:P},t[11]=h,t[12]=g,t[13]=P,t[14]=j):j=t[14];const y=x(j),S=!!u,w=!!c;let k;if(t[15]!==i||t[16]!==o||t[17]!==r?.metadata?.releases||t[18]!==l||t[19]!==d||t[20]!==y.data||t[21]!==y.isError||t[22]!==S||t[23]!==w){let T;t[25]!==o?(T=I=>I.branch===o,t[25]=o,t[26]=T):T=t[26],k=Uc({runtime:d,runtimeResolved:l,blocksV8:i,localPreview:S,servingLocally:w,branch:o,listedDraft:(r?.metadata?.releases??[]).some(T),defaultBranch:y.data?y.data.base??null:y.isError?null:void 0}),t[15]=i,t[16]=o,t[17]=r?.metadata?.releases,t[18]=l,t[19]=d,t[20]=y.data,t[21]=y.isError,t[22]=S,t[23]=w,t[24]=k}else k=t[24];const N=k,C=`${n}:${o??""}`,[v,A]=q.useState(null);return N!=="pending"&&(v?.key!==C||v.gate!==N)&&A({key:C,gate:N}),N==="pending"&&v?.key===C?v.gate:N}function Hc(t){return t?.[2]}function Kc(t){const e=!t.hasEntity&&!t.servingLocally,s=t.hasEntity&&!t.localPreview&&!t.servingLocally&&!t.onProduction&&t.showsRepositoryActions;return{hidden:e,localFiles:!e&&t.servingLocally,draftSelect:!e&&t.hasEntity,publish:e||!s?null:t.runtime==="cms"?"cms":"code"}}function _d(t){const e=B.c(2),{blocksOnly:s}=t;let r;return e[0]!==s?(r=s?a.jsx(Vc,{}):a.jsx(Pa,{}),e[0]=s,e[1]=r):r=e[1],r}function Vc(){return vn(fi())?a.jsx(fa,{value:!1,children:a.jsx(Pa,{})}):null}function Pa(){const t=B.c(32),e=ns(),{org:s}=hs(),r=Ks(e?.virtualMcpId),n=e?.currentBranch??null,o=fs(r?.id).runtime,{url:d}=fn(r?.id),{connection:l}=mn(r?.id??e?.virtualMcpId),i=r?.id??e?.virtualMcpId,u=qc()!=="open",c=!!r,h=!!l,p=!!d;let b;t[0]!==r||t[1]!==u||t[2]!==o||t[3]!==c||t[4]!==h||t[5]!==p?(b=Kc({hasEntity:c,servingLocally:h,localPreview:p,showsRepositoryActions:!!r&&hi(r),runtime:o,onProduction:u}),t[0]=r,t[1]=u,t[2]=o,t[3]=c,t[4]=h,t[5]=p,t[6]=b):b=t[6];const f=b;if(!i||f.hidden)return null;let m;t[7]!==n||t[8]!==i?(m=a.jsx(Mc,{virtualMcpId:i,branch:n}),t[7]=n,t[8]=i,t[9]=m):m=t[9];let g;t[10]!==n||t[11]!==f.localFiles||t[12]!==i?(g=f.localFiles&&a.jsx(zc,{virtualMcpId:i,branch:n}),t[10]=n,t[11]=f.localFiles,t[12]=i,t[13]=g):g=t[13];let x;t[14]!==n||t[15]!==s||t[16]!==f.localFiles||t[17]!==i?(x=f.localFiles&&a.jsx(Oc,{orgSlug:s.slug,virtualMcpId:i,branch:n}),t[14]=n,t[15]=s,t[16]=f.localFiles,t[17]=i,t[18]=x):x=t[18];let P;t[19]!==n||t[20]!==r||t[21]!==f.draftSelect?(P=r&&f.draftSelect&&a.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:a.jsx(Li,{virtualMcp:r,currentBranch:n})}),t[19]=n,t[20]=r,t[21]=f.draftSelect,t[22]=P):P=t[22];let j;t[23]!==r||t[24]!==f.publish?(j=r&&f.publish&&a.jsxs(a.Fragment,{children:[a.jsx(Ea,{orientation:"vertical",className:"mx-1 data-[orientation=vertical]:h-4"}),a.jsx("div",{className:"flex shrink-0 items-center justify-end gap-1",children:f.publish==="cms"?a.jsx(wc,{virtualMcpId:r.id}):a.jsx(Lc,{virtualMcpId:r.id})})]}),t[23]=r,t[24]=f.publish,t[25]=j):j=t[25];let y;return t[26]!==m||t[27]!==g||t[28]!==x||t[29]!==P||t[30]!==j?(y=a.jsxs(a.Fragment,{children:[m,g,x,P,j]}),t[26]=m,t[27]=g,t[28]=x,t[29]=P,t[30]=j,t[31]=y):y=t[31],y}export{_d as S,qc as a,Ci as u};
@@ -0,0 +1 @@
1
+ import{c as I,j as r,n as v,b as M,a5 as T,bi as w}from"./index-DxGCPS5f.js";import{E as B}from"./empty-state-DMIzfRid.js";import{u as L}from"./chat-context-zQ-qHQlQ.js";import{u as N,l as O,F as _}from"./site-editor-toast-CgoUJTSW.js";import{i as $,u as A,j as Q,S as U}from"./blocks-tab-states-CXVOpcLP.js";import{a as G}from"./autosend-hIWj1gzu.js";function H(S){const e=I.c(7),{icon:n,title:i,description:t,action:o}=S;let a;e[0]!==o?(a=o?{children:o.label,onClick:o.onClick,disabled:o.disabled}:void 0,e[0]=o,e[1]=a):a=e[1];let s;return e[2]!==t||e[3]!==n||e[4]!==a||e[5]!==i?(s=r.jsx(v,{children:r.jsx(v.Content,{children:r.jsx(v.Container,{children:r.jsx(B,{icon:n,title:i,description:t,buttonProps:a})})})}),e[2]=t,e[3]=n,e[4]=a,e[5]=i,e[6]=s):s=e[6],s}function Y(S){const e=I.c(28),{virtualMcpId:n,icon:i,copy:t,skeleton:o,children:a}=S,s=M(),{org:g}=T(),j=L(),m=j?.currentBranch??null,p=N(n,m);w(p.kind==="protocol"&&p.source==="github");const{openPanel:F}=G();if(!m){const l=t.noDraftTitle,k=t.noDraftDesc;let u;e[0]!==s?(u=s("sectionsEditor.namedRules.openEditor"),e[0]=s,e[1]=u):u=e[1];let c;e[2]!==F?(c=()=>F("content"),e[2]=F,e[3]=c):c=e[3];let d;e[4]!==u||e[5]!==c?(d={label:u,onClick:c},e[4]=u,e[5]=c,e[6]=d):d=e[6];let x;return e[7]!==t.noDraftDesc||e[8]!==t.noDraftTitle||e[9]!==i||e[10]!==d?(x=r.jsx(H,{icon:i,title:l,description:k,action:d}),e[7]=t.noDraftDesc,e[8]=t.noDraftTitle,e[9]=i,e[10]=d,e[11]=x):x=e[11],x}if($(p)){let l;return e[12]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(U,{}),e[12]=l):l=e[12],l}if(p.kind==="pending"){let l;return e[13]!==o?(l=r.jsx(r.Fragment,{children:o}),e[13]=o,e[14]=l):l=e[14],l}if(p.kind!=="protocol"){let l;return e[15]!==t.loadFailed||e[16]!==t.loadFailedHint||e[17]!==i?(l=r.jsx(H,{icon:i,title:t.loadFailed,description:t.loadFailedHint}),e[15]=t.loadFailed,e[16]=t.loadFailedHint,e[17]=i,e[18]=l):l=e[18],l}const h=j?.taskId??null;let f;return e[19]!==m||e[20]!==a||e[21]!==t||e[22]!==i||e[23]!==g.slug||e[24]!==o||e[25]!==h||e[26]!==n?(f=r.jsx(K,{orgSlug:g.slug,virtualMcpId:n,branch:m,threadId:h,icon:i,copy:t,skeleton:o,children:a},m),e[19]=m,e[20]=a,e[21]=t,e[22]=i,e[23]=g.slug,e[24]=o,e[25]=h,e[26]=n,e[27]=f):f=e[27],f}function K(S){const e=I.c(35),{orgSlug:n,virtualMcpId:i,branch:t,threadId:o,icon:a,copy:s,skeleton:g,children:j}=S,m=M();let p;e[0]!==t||e[1]!==n||e[2]!==o||e[3]!==i?(p={orgSlug:n,virtualMcpId:i,branch:t,threadId:o,previewUrl:null},e[0]=t,e[1]=n,e[2]=o,e[3]=i,e[4]=p):p=e[4];const F=p,h=O(F),f=A(F),l=h.data,k=f.data;let u;e[5]!==t||e[6]!==n||e[7]!==i?(u={orgSlug:n,virtualMcpId:i,branch:t},e[5]=t,e[6]=n,e[7]=i,e[8]=u):u=e[8];const c=_(u,Q);if(!l||!k||!c.ready){if(h.isError||f.isError||c.failed){const P=s.loadFailed,R=s.loadFailedHint;let D;e[9]!==m?(D=m("sectionsEditor.namedRules.tryAgain"),e[9]=m,e[10]=D):D=e[10];let b;e[11]!==h||e[12]!==c||e[13]!==f?(b=()=>{h.isError&&h.refetch(),f.isError&&f.refetch(),c.failed&&c.retry()},e[11]=h,e[12]=c,e[13]=f,e[14]=b):b=e[14];let E;e[15]!==D||e[16]!==b?(E={label:D,onClick:b},e[15]=D,e[16]=b,e[17]=E):E=e[17];let y;return e[18]!==s.loadFailed||e[19]!==s.loadFailedHint||e[20]!==a||e[21]!==E?(y=r.jsx(H,{icon:a,title:P,description:R,action:E}),e[18]=s.loadFailed,e[19]=s.loadFailedHint,e[20]=a,e[21]=E,e[22]=y):y=e[22],y}let C;return e[23]!==g?(C=r.jsx(r.Fragment,{children:g}),e[23]=g,e[24]=C):C=e[24],C}let d;e[25]!==t||e[26]!==j||e[27]!==l||e[28]!==k||e[29]!==n||e[30]!==o||e[31]!==i?(d=j({orgSlug:n,virtualMcpId:i,branch:t,threadId:o,decofile:l,meta:k}),e[25]=t,e[26]=j,e[27]=l,e[28]=k,e[29]=n,e[30]=o,e[31]=i,e[32]=d):d=e[32];let x;return e[33]!==d?(x=r.jsx(r.Fragment,{children:d}),e[33]=d,e[34]=x):x=e[34],x}export{H as S,Y as a};
@@ -0,0 +1 @@
1
+ import{c as u,r as g,j as n,J as G,a0 as F,a as E,l as O,b as P,n as y,L as H}from"./index-DxGCPS5f.js";import{C as M}from"./chat-context-zQ-qHQlQ.js";import{C as x}from"./index-DYiWplV5.js";import{L}from"./index-DHdEN2_u.js";import{B as V}from"./blocks-preview-workspace-context-DHaN_ngV.js";import{e as T,p as J,s as K,a as W,r as U,T as $,u as R,b as z}from"./site-editor-toast-CgoUJTSW.js";import{u as q,L as B,P as Q,S as X}from"./preview-tab-BjhtYZTR.js";import{C as Y}from"./content-tab-D6UWTBDG.js";import{T as Z}from"./tab-icon-glyph-BrdbQUjH.js";import{r as tt}from"./resolve-tab-icon-JlFD9Ttu.js";import et from"./agent-site-editor-DcjkqLR_.js";import"./autosend-hIWj1gzu.js";import"./thread-route-CIVmQ-Bx.js";import"./use-project-scope-CYZ0mCfQ.js";import"./repository-binding-C4_xIShf.js";import"./use-mcp-client-BFuEikBh.js";import"./auth-BFbUp7Gk.js";import"./thread-intent-DckhqhKt.js";import"./delay-CnY5UFtP.js";import"./watch-sse-pool-BKRouklE.js";import"./task-board-T7oS4tjE.js";import"./schema-DyY5h7Rx.js";import"./use-entitlements-SlWYl1h3.js";import"./use-ai-providers-8QFj-dPT.js";import"./use-decopilot-events-BAXWzGGN.js";import"./use-organization-settings-DqmiRW0D.js";import"./use-mobile-COmq9TQM.js";import"./use-sidebar-collapsed-DXX9If3C.js";import"./use-chat-layout-state-D-U8t0kV.js";import"./agent-icon-_Y5eusMw.js";import"./AlertCircle-CzNhPAKr.js";import"./Tool01-snML4pPn.js";import"./ArrowUp-BmvC0gDN.js";import"./ArrowLeft-BZrvcUxe.js";import"./LinkBroken01-K7vV_sRk.js";import"./ShoppingBag01-DW9ACSlI.js";import"./Globe04-DD-_PtpP.js";import"./CheckCircle-BfgWRJx4.js";import"./ChevronUp-CslLufEI.js";import"./ChevronSelectorVertical-Dk3Ic8_G.js";import"./UserSquare-DgIYcYhA.js";import"./CreditCard01-DKR27XQP.js";import"./SwitchHorizontal01-BCe-gFOc.js";import"./Key01-CNesFlbK.js";import"./Minus-DeqVl1Xe.js";import"./Monitor01-Bx36gCte.js";import"./Sun-DUSHragw.js";import"./Play-CkRBFbju.js";import"./Plus-DtM4w8bA.js";import"./SearchMd-Bbg1gFfR.js";import"./Trash01-DPGVoVI0.js";import"./Upload01-B1K1jpRL.js";import"./Users01-DeK6IcUy.js";import"./XClose-B40NOWtA.js";import"./Zap-PrQtyQ4u.js";import"./tooltip-xj6ZnC0s.js";import"./index-DFF-_wih.js";import"./toolbar-icon-button-CjbxTTYr.js";import"./shell-layout-dHGD2tyJ.js";import"./use-deployment-admin-DNwohGK9.js";import"./admin-fetch-BhTJlAsX.js";import"./command-CnM6TkoO.js";import"./index-CDlOTJSg.js";import"./integration-icon-CivNYrxB.js";import"./project-icon-BnHxv46u.js";import"./use-navigate-to-agent-RGucqDuO.js";import"./new-project-dialog-B_Izhfc6.js";import"./label-Co3RnKjI.js";import"./repository-picker-CX0VOapR.js";import"./github-icon-BoZFAAoR.js";import"./useInfiniteQuery-ByQLYXMe.js";import"./infiniteQueryObserver-BRbF_8wg.js";import"./collection-search-BKCnDfDh.js";import"./use-debounced-value-DDir1rWd.js";import"./required-auth-layout-lwAsP7t-.js";import"./use-org-sso-RIE_JSyT.js";import"./sheet-ClaqVLRv.js";import"./resizable-CZ6UntWr.js";import"./core.esm-BbSbwofB.js";import"./sortable.esm-BqKBxgnm.js";import"./context-menu-BOlWz_az.js";import"./create-organization-dialog-Dzeh0MX0.js";import"./form-BV9LGfdZ.js";import"./project-apps-DoVt9kS_.js";import"./use-recent-apps-D1NSRmBo.js";import"./use-voice-input-CZ-OU5Nk.js";import"./popover-cnXo99rU.js";import"./drawer-D4DxFGqN.js";import"./index-2dSYni92.js";import"./checkbox-DNUaBZYX.js";import"./select-C30nxii2.js";import"./index-BdQq_4o_.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./use-blocks-v8-project-Oxne65-_.js";import"./sandbox-url-D3mC8qhT.js";import"./utils-Dk3SKS5y.js";import"./use-sandbox-events-nFpLHv9o.js";import"./sandbox-git-api-DcqI6XE4.js";import"./parse-sections-DE8GWmV_.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BzWauPYd.js";import"./collapsible-DEQoVVA9.js";import"./use-copy-O-MML7rC.js";import"./usage-stats-hNAp_EX0.js";import"./tool-namespace-WdIPTHBa.js";import"./utils-CVEq3hMx.js";import"./markdown-BkKuf5yA.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-AZxi3AlX.js";import"./types-B8snWcBI.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./use-connection-B3EvPXuJ.js";import"./use-mcp-prompts-W7_z0mx2.js";import"./use-thread-outputs-bD7oL4Tg.js";import"./file-type-icon-BgsOvG37.js";import"./section-array-field-CzG_jptj.js";import"./blocks-tab-states-CXVOpcLP.js";import"./empty-state-CiXq08R1.js";import"./hosted-reconcile-DgpDwrI2.js";import"./slider-B_ZUvu11.js";import"./index-BEm4jG3I.js";import"./tooltipContext-BPLu0XDW.js";import"./CategoricalChart-Db8BeNXp.js";import"./index-DzoENFz8.js";import"./switch-BhYC-gsU.js";import"./textarea-CHZQytvO.js";import"./scroll-area-DJvIk_1i.js";import"./monaco-editor-03CuhEOx.js";import"./editor-DKoVU6S3.js";import"./calendar-CUq9MxZD.js";import"./editor-classes-DEInI3IT.js";import"./toggle-group-CC2qDSue.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-BLt_NngQ.js";import"./search-input-BRZEiJxt.js";import"./tabs-t_453qON.js";import"./use-file-configs-BiPsjSp0.js";import"./asset-utils-0I7CXwnB.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./sandbox-lifecycle-context-ByyfF0kL.js";import"./variant-matcher-override-NriuY-7n.js";import"./use-fast-preview-draft-url-DB6fawwn.js";import"./useQueries-DSvnP38O.js";import"./device-hint-D3M6OFi8.js";import"./alert-h8V4X8Ql.js";import"./virtual-mcp-D5NkkvKn.js";import"./url-slug-Dv3zxns9.js";import"./app-preview-url-9Od4s8Sz.js";import"./agent-capabilities-DYSIvwwC.js";import"./preview-source-BsRLGWUP.js";import"./use-task-metadata-D1snlV6w.js";import"./view-header-B6CnFcfB.js";import"./use-cms-publish-actions-DmkL-hz5.js";import"./use-content-sync-C8Ux_RZ8.js";import"./mustache-BRZEXzlS.js";import"./date-utils-CrvIKg-s.js";import"./use-move-blocks-DtAEvUrz.js";import"./badge-DccxBHlR.js";import"./empty-state-DMIzfRid.js";import"./collection-table-wrapper-BiwEx8lf.js";import"./table-Dioc_TQV.js";import"./site-draft-actions-BIA6lR1g.js";import"./separator-vR8karC8.js";import"./cms-store-drafts-BL8-fLzg.js";import"./serial-task-queue-CGOeQgpr.js";import"./index-CKcY9sA2.js";import"./input-BznJkJE1.js";import"./icon-button-DeiyuWHW.js";import"./chat-draft-DnX_-WHk.js";import"./use-deco-credits-Dy_Hg4i-.js";import"./input-CYN8nGNA.js";import"./suggestion-B-tT_3Ba.js";import"./use-org-fs-B1VEI_Er.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-BorE2qu6.js";import"./plan-ladder-CAL4h1RI.js";import"./add-connection-dialog-CvoK8CuD.js";import"./extract-connection-data-m9qRk70G.js";import"./metadata-D72DunRR.js";import"./connection-BWV5QLFO.js";import"./connection-card-xMr1YFzW.js";import"./connection-slug-Ygf3Xiz0.js";import"./schema-STdjEbAK.js";import"./connection-form-helpers-CaRBbMf9.js";import"./authenticate-and-persist-oauth-CDOOyhvF.js";import"./mcp-oauth-C3sBEl47.js";import"./mcp-oauth-C-lvxcK7.js";import"./collection-tabs-CLJwpk3w.js";import"./use-infinite-scroll-CuJmRWs3.js";import"./useSuspenseInfiniteQuery-ClUlWmLx.js";import"./use-task-board-events-p-Cj7F6A.js";import"./save-changes-debug-nBi-n9eV.js";import"./site-draft-view-Ci2I7i9g.js";function I(e){return e.kind==="unavailable"&&e.source==="local"&&(e.problem?.reason??"not-answering")==="not-answering"}const ot=e=>e;function it(e){const t=u.c(10),{candidates:o,invalidLink:c,shell:m,editor:i}=e,r=c===void 0?!1:c,s=m===void 0?ot:m,[p,l]=g.useState(null);if(p){let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>l(null),t[0]=f):f=t[0];let h;return t[1]!==p||t[2]!==i?(h=i(p,f),t[1]=p,t[2]=i,t[3]=h):h=t[3],h}let a;t[4]!==o||t[5]!==r?(a=n.jsx(rt,{candidates:o,invalidLink:r,onConnect:l}),t[4]=o,t[5]=r,t[6]=a):a=t[6];let d;return t[7]!==s||t[8]!==a?(d=s(a),t[7]=s,t[8]=a,t[9]=d):d=t[9],d}function rt(e){const t=u.c(17),{candidates:o,invalidLink:c,onConnect:m}=e,i=c===void 0?!1:c,[r]=G(),{language:s}=r;let p;t[0]!==m?(p=N=>m({endpoint:N}),t[0]=m,t[1]=p):p=t[1];let l;t[2]!==o||t[3]!==p?(l={candidates:o,onFound:p},t[2]=o,t[3]=p,t[4]=l):l=t[4];const a=q(l),{state:d,access:f,needsGesture:h}=a;let k;t[5]!==o||t[6]!==s?(k=new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(o.map(T)),t[5]=o,t[6]=s,t[7]=k):k=t[7];const C=k;let S;t[8]!==f||t[9]!==a.start||t[10]!==h||t[11]!==d?(S=f==="denied"?{kind:"denied"}:h?{kind:"needs-gesture",onStart:a.start}:d.problem?{kind:"problem",problem:d.problem,host:T(d.problem.endpoint)}:{kind:"looking",paused:d.status==="paused"},t[8]=f,t[9]=a.start,t[10]=h,t[11]=d,t[12]=S):S=t[12];const _=S;let j;return t[13]!==C||t[14]!==i||t[15]!==_?(j=n.jsx(B,{wait:_,hosts:C,invalidLink:i}),t[13]=C,t[14]=i,t[15]=_,t[16]=j):j=t[16],j}const v="deco-serve",w="working-tree",nt={id:"",slug:"",name:"",logo:null},st={id:v,slug:v},mt={virtualMcpId:v,taskId:null,openTask:()=>{},createTask:()=>"",createTaskWithMessage:()=>{},activeTask:null,isThreadLocked:!1,lockedHarness:null,lockedBranch:null,currentBranch:w,setCurrentTaskBranch:()=>{}};function pt(){const e=window.location.hash,t=new URLSearchParams(e.replace(/^#/,"")).has("endpoint"),o=t?J(e):null;return t&&window.history.replaceState(null,"",window.location.pathname+window.location.search),o&&K(o),{candidates:W(o,U()),invalidLink:t&&!o}}const at=[{id:"site-editor",to:"/site-editor",label:"preview"},{id:"content",to:"/site-editor/content",label:"content"}];function ct(){const e=u.c(6),t=P();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={select:lt},e[0]=o):o=e[0];const c=O(o);let m;e[1]!==t||e[2]!==c?(m=at.map(r=>n.jsx(y.Tab,{asChild:!0,active:c==="content"==(r.id==="content"),children:n.jsxs(H,{to:r.to,activeOptions:{exact:!0},children:[n.jsx("span",{"aria-hidden":"true",className:"flex size-4 shrink-0 items-center justify-center",children:n.jsx(Z,{icon:tt({tabId:r.id,kind:"system",connections:[]})})}),t(`common.mainPanelTabs.${r.label}`)]})},r.id)),e[1]=t,e[2]=c,e[3]=m):m=e[3];let i;return e[4]!==m?(i=n.jsx(y.Tabs,{children:m}),e[4]=m,e[5]=i):i=e[5],i}function lt(e){return e.matches.at(-1)?.staticData.siteEditorView}function A(e){const t=u.c(14),{children:o}=e,c=P(),{connection:m}=z(v),i=R(v,w);let r,s;if(t[0]!==i||t[1]!==o||t[2]!==m||t[3]!==c){s=Symbol.for("react.early_return_sentinel");t:{if(r=m?T(m.endpoint):"",i.kind==="protocol"){s=o;break t}if(i.kind!=="unavailable"||I(i)){s=n.jsx(X,{headingLevel:2,waiting:!0,title:c("decoServe.connect.reaching",{host:r})});break t}}t[0]=i,t[1]=o,t[2]=m,t[3]=c,t[4]=r,t[5]=s}else r=t[4],s=t[5];if(s!==Symbol.for("react.early_return_sentinel"))return s;let p;t[6]!==i.problem?(p=i.problem??{reason:"not-answering"},t[6]=i.problem,t[7]=p):p=t[7];let l;t[8]!==r||t[9]!==p?(l={kind:"problem",problem:p,host:r},t[8]=r,t[9]=p,t[10]=l):l=t[10];let a;return t[11]!==r||t[12]!==l?(a=n.jsx(B,{wait:l,hosts:r}),t[11]=r,t[12]=l,t[13]=a):a=t[13],a}function dt(e){const t=u.c(6),{onLost:o}=e,c=R(v,w);let m;t[0]!==c?(m=I(c),t[0]=c,t[1]=m):m=t[1];const i=m;let r,s;return t[2]!==i||t[3]!==o?(r=()=>{i&&o()},s=[i,o],t[2]=i,t[3]=o,t[4]=r,t[5]=s):(r=t[4],s=t[5]),g.useEffect(r,s),null}const D={threadOpen:!1,contentOpen:!0,threadVisibilityExplicit:!1,toggleThread:()=>{},toggleContent:()=>{}};function ut(){const e=u.c(11),{data:t}=E.useSession();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={select:ft},e[0]=o):o=e[0];const c=O(o),m=!!t?.user;let i;e[1]!==m?(i={rail:m},e[1]=m,e[2]=i):i=e[2];const r=c??"preview";let s,p,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(ct,{}),p=n.jsx(x.Thread,{children:null}),l=n.jsx(et,{}),e[3]=s,e[4]=p,e[5]=l):(s=e[3],p=e[4],l=e[5]);let a;e[6]!==r?(a=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:r,contentNavigation:s,children:[p,l]})}),e[6]=r,e[7]=a):a=e[7];let d;return e[8]!==i||e[9]!==a?(d=n.jsx(L,{outsideOrg:i,children:a}),e[8]=i,e[9]=a,e[10]=d):d=e[10],d}function ft(e){return e.matches.at(-1)?.staticData.siteEditorView}function ht(e){const t=u.c(8),{children:o}=e,{data:c}=E.useSession(),m=!!c?.user;let i;t[0]!==m?(i={rail:m},t[0]=m,t[1]=i):i=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(x.Thread,{children:null}),t[2]=r):r=t[2];let s;t[3]!==o?(s=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:"guide",children:[r,n.jsx(x.Content,{children:o})]})}),t[3]=o,t[4]=s):s=t[4];let p;return t[5]!==i||t[6]!==s?(p=n.jsx(L,{outsideOrg:i,children:s}),t[5]=i,t[6]=s,t[7]=p):p=t[7],p}const b=()=>{},vt={connection:null,set:b,clear:b};function Yi(){const e=u.c(3),[t]=g.useState(pt);let o;return e[0]!==t.candidates||e[1]!==t.invalidLink?(o=n.jsx(F,{org:nt,project:st,children:n.jsx(it,{candidates:t.candidates,invalidLink:t.invalidLink,shell:kt,editor:xt})}),e[0]=t.candidates,e[1]=t.invalidLink,e[2]=o):o=e[2],o}function xt(e,t){return n.jsxs($.Provider,{value:{connection:e,set:b,clear:b},children:[n.jsx(dt,{onLost:t}),n.jsx(M,{value:mt,children:n.jsx(V,{children:n.jsx(ut,{})})})]})}function kt(e){return n.jsx($.Provider,{value:vt,children:n.jsx(ht,{children:e})})}function Zi(){const e=u.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Q,{virtualMcpId:v})}),e[0]=t):t=e[0],t}function tr(){const e=u.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Y,{virtualMcpId:v})}),e[0]=t):t=e[0],t}export{tr as SiteEditorContent,Zi as SiteEditorPreview,Yi as default};
@@ -0,0 +1 @@
1
+ import{eP as P,eQ as S,c as R,q as Z,i as F,K as g,eR as je,aB as wn,aF as Sn,aG as yn,r as L,a as En,at as ke,a5 as On,by as yt,eS as Dn,eT as kn,eU as Et,ar as In,bo as Ot,bh as B,eV as _n,eW as Tn,eX as q,eY as Pn,eZ as Rn,e_ as fe,e$ as xn,f0 as Dt,f1 as kt,f2 as $n,f3 as Nn,a3 as jn,f4 as Cn,t as ee,j as Y}from"./index-DxGCPS5f.js";import{u as It}from"./use-voice-input-CZ-OU5Nk.js";import{s as et}from"./thread-intent-DckhqhKt.js";import{u as Ce}from"./use-blocks-v8-project-Oxne65-_.js";import{b as me}from"./sandbox-url-D3mC8qhT.js";import{s as An}from"./utils-Dk3SKS5y.js";import{u as Ae}from"./repository-binding-C4_xIShf.js";import{u as Un}from"./chat-context-zQ-qHQlQ.js";import{i as Mn,u as Ln}from"./use-sandbox-events-nFpLHv9o.js";import{a as Fn}from"./sandbox-git-api-DcqI6XE4.js";const K="deco-content",Ie={major:1},_t=1;async function Qn(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 _e={major:Ie.major,minor:_t},Tt=`the endpoint speaks an older ${K} than this client needs (${_e.major}.${_e.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function se(e,t,n){const o={reason:t,required:{..._e}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new P(S.Unsupported,e,o)}function Pt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==K)throw se(`the endpoint speaks ${JSON.stringify(n)}, not ${K}`,"protocol",t);if(o?.major!==Ie.major)throw se(`the endpoint speaks ${K} ${String(o?.major)}.x; this client speaks ${Ie.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<_t)throw se(Tt,"outdated",t);return e}function tt(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?se(Tt,"outdated"):P.from(t)}function Ue(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){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(s)}));let c;try{c=await Qn(a)}catch{throw new P(S.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?P.from(l):new P(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const r=async(s,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(c.error)throw tt(s,c.error);return c.result};return{call:r,describe:async()=>Pt(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((l,f)=>({jsonrpc:"2.0",id:i[f],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,f)=>{const u=c.get(l);return u?u.error?{ok:!1,error:tt(s[f].method,u.error)}:{ok:!0,result:u.result}:{ok:!1,error:new P(S.InternalError,"no response for this call")}})}}}function Me(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const nt=20,ot=5,rt=500;function Le(e){return e instanceof P?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function de(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function Vn(e,t,n){const o=g.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(Me(r)),i=de(r,s);if(i)return i;const a=await t.changesList({});return de(void 0,a)}async function Rt(e,t){const n=[];for(let s=0;s<t.length;s+=nt)n.push(t.slice(s,s+nt));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=ot){const i=await e.batch(n.slice(s,s+ot).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),r.push(...c.diagnostics)}}return{entries:o,diagnostics:r}}async function Vr(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=rt){const r=t.slice(o,o+rt),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Br(e){return e instanceof P&&e.code===S.Conflict}function Fe(e){return e?.kind==="protocol"?e:null}function Hr(e,t,n){const o=R.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=Z();let a;o[2]!==e?(a=Fe(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&s.enabled!==!1;let f;o[4]!==t?(f=g.contentChanges(t??""),o[4]=t,o[5]=f):f=o[5];let u;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(u=l?()=>Vn(i,c.client,t):je,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=u):u=o[10];let d;return o[11]!==f||o[12]!==u?(d={queryKey:f,queryFn:u,staleTime:0},o[11]=f,o[12]=u,o[13]=d):d=o[13],F(d)}function Jr(e,t,n){const o=R.c(14);let r;o[0]!==e?(r=Fe(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!s&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?.revision?(l=g.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=l):l=o[6];let f;o[7]!==c||o[8]!==a||o[9]!==s?(f=c?()=>Rt(s.client,a):je,o[7]=c,o[8]=a,o[9]=s,o[10]=f):f=o[10];let u;return o[11]!==l||o[12]!==f?(u={queryKey:l,queryFn:f,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=f,o[13]=u):u=o[13],F(u)}function Wr(e,t,n){const o=R.c(16);let r;o[0]!==e?(r=Fe(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==s){const d=Object.entries(n?.changes??{}).filter(Gn).map(Wn).sort(Jn);a=d.map(Hn);const h=JSON.stringify(d.map(Bn));i=!!s&&!!t&&a.length>0,l=F,c=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=s,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 f;o[9]!==i||o[10]!==a||o[11]!==s?(f=i?async()=>{const d=await Rt(s.client,a),h=Object.create(null);for(const[b,v]of Object.entries(d.entries))h[b]=v.before&&typeof v.before=="object"?v.before:null;return h}:je,o[9]=i,o[10]=a,o[11]=s,o[12]=f):f=o[12];let u;return o[13]!==c||o[14]!==f?(u={queryKey:c,queryFn:f,staleTime:Number.POSITIVE_INFINITY,placeholderData:wn},o[13]=c,o[14]=f,o[15]=u):u=o[15],l(u)}function Bn(e){return[e.name,e.base]}function Hn(e){return e.name}function Jn(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function Wn(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function Gn(e){const[,t]=e;return t.kind==="delete"}function xt(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 $t=Sn({endpoint:yn().max(2048).refine(e=>xt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Gr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=$t.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function Nt(e){const t=$t.safeParse(e);return t.success?t.data:null}const jt="studio:deco-serve-last";function Yr(e){try{localStorage.setItem(jt,JSON.stringify(e))}catch{}}function zr(){try{const e=localStorage.getItem(jt);return e?Nt(JSON.parse(e)):null}catch{return null}}function Xr(e){try{return new URL(he(e)).host}catch{return e}}function Yn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const zn="http://localhost:4545/rpc";class Qe extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function Xn(e){if(e instanceof Qe)return{reason:"not-deco-serve"};if(!(e instanceof P))return{reason:"not-answering"};switch(e.code){case S.Unauthorized:case S.MethodNotFound:return{reason:"outdated"};case S.Unsupported:return Le(e)?{reason:"outdated"}:{reason:"version-mismatch"};case S.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 Zr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,zn].filter(o=>!!o).map(he);return[...new Set(n)]}const Ct=L.createContext(null);function Zn(e){const t=R.c(24),n=L.useContext(Ct),o=Ce(n?null:e),{data:r}=En.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?ke.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[c,l]=it(a);let f;t[4]!==i||t[5]!==s||t[6]!==e?(f=i?ke.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=f):f=t[7];const[u,d]=it(f);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?Nt(c):null,t[8]=c,t[9]=i,t[10]=o,t[11]=h):h=t[11];const b=h,v=i&&o&&typeof u=="string"?u:null;let w;t[12]!==d||t[13]!==l||t[14]!==i?(w=x=>{i&&(l(x),d(x.endpoint))},t[12]=d,t[13]=l,t[14]=i,t[15]=w):w=t[15];let I;t[16]!==l||t[17]!==i?(I=()=>{i&&l(null)},t[16]=l,t[17]=i,t[18]=I):I=t[18];let E;return t[19]!==b||t[20]!==v||t[21]!==w||t[22]!==I?(E={connection:b,lastEndpoint:v,set:w,clear:I},t[19]=b,t[20]=v,t[21]=w,t[22]=I,t[23]=E):E=t[23],E}function st(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function it(e){const t=R.c(17),n=Z(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?st(e):null,a=()=>e?st(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:s,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:f}=F(l);let u;t[10]!==e||t[11]!==n||t[12]!==s?(u=v=>{if(e){try{v===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(v))}catch{}n.setQueryData(s,v)}},t[10]=e,t[11]=n,t[12]=s,t[13]=u):u=t[13];const d=u,h=e?f??null:null;let b;return t[14]!==d||t[15]!==h?(b=[h,d],t[14]=d,t[15]=h,t[16]=b):b=t[16],b}function qr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Kr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function es(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 ts(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&xt(t)?t:null}function ns(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function At(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function qn(e){if(!e.hasProject)return"legacy";const t=At(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 Kn(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function at(e){return e.isError||e.errorUpdateCount>0}function eo(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function to(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 Ut="__noSchema";function Mt(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[Ut]:!0}}function os(e){return!!e&&e[Ut]===!0}function Ve(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function no(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const oo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function rs(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:no(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(oo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:ct(n.resolveType).localeCompare(ct(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function ct(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function lt(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=lt(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?lt(s[a],r,n):s[a];return i}return e}function ss(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class ut extends Error{}const Be="site-not-owned";async function ro(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function so(e,t=n=>fetch(n)){const n=Ue({endpoint:e,fetch:async o=>{const r=await t(o);if(await ro(r))throw new ut;return r}});try{return await Je(n)}catch(o){if(o instanceof ut)return Be;throw o}}async function io(e,t,n){await t();const o=await so(e,n);return o===Be?o:{...o,hosted:Dn(e,n)}}const He=5e3;function ao(e){if(!e.site)throw new Error("this project names no site");return kn(e.site,e.branch)}function co(e){return new URL(me(e,"rpc"),window.location.origin).href}async function Je(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!==K)throw new Qe;const r=Pt(t.result);if(!n)throw new Error("no schema.get");if(Ve(n))return{client:e,describe:r,hasSchema:!1};if(n.ok)return{client:e,describe:r,hasSchema:!0};throw n.error}function lo(e,t=n=>fetch(n)){return Je(Ue({endpoint:e,fetch:t}))}function oe(e,t){const n=R.c(50),{org:o}=On(),{connection:r}=Zn(e),{runtime:s}=It(e),i=L.useContext(Ct),a=Ce(e),c=yt(Ae(e)?.metadata),l=At({hasServeConnection:!!r,runtime:s}),f=Un()?.taskId??null,u=Mn(Ln().lifecycle.phase),d=Z(),h=Kn({mode:l,v8:a,workingTreeReady:u}),b=h.github&&!!o.slug&&!!e&&!!t,v=F({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>io(ao({orgSlug:o.slug,site:c,branch:t}),()=>Et(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,...ft}),w=h.sandbox&&!!o.slug&&!!e&&!!t;let I;n[0]!==t||n[1]!==o.slug||n[2]!==f||n[3]!==e?(I=()=>lo(co({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:f})),n[0]=t,n[1]=o.slug,n[2]=f,n[3]=e,n[4]=I):I=n[4];const E=F({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",f??""),queryFn:I,enabled:w,staleTime:Number.POSITIVE_INFINITY,...ft}),x=!!r;let _;n[5]!==r?.endpoint||n[6]!==o.slug||n[7]!==e?(_=g.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[5]=r?.endpoint,n[6]=o.slug,n[7]=e,n[8]=_):_=n[8];let N;n[9]!==r?(N=()=>Je(Ue({endpoint:r.endpoint})),n[9]=r,n[10]=N):N=n[10];let $;n[11]!==x||n[12]!==_||n[13]!==N?($={queryKey:_,queryFn:N,enabled:x,staleTime:Number.POSITIVE_INFINITY,retry:ho,retryDelay:fo,refetchInterval:uo},n[11]=x,n[12]=_,n[13]=N,n[14]=$):$=n[14];const p=F($);let U;n[15]!==r?.endpoint||n[16]!==o.slug||n[17]!==e?(U=g.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[15]=r?.endpoint,n[16]=o.slug,n[17]=e,n[18]=U):U=n[18];const D=U;let T;n[19]!==r?.endpoint||n[20]!==o.slug||n[21]!==e?(T=g.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[19]=r?.endpoint,n[20]=o.slug,n[21]=e,n[22]=T):T=n[22];let j;n[23]!==p.data||n[24]!==D||n[25]!==d?(j=async()=>{try{return await p.data.client.describe()}catch(m){const J=m;throw d.invalidateQueries({queryKey:D,exact:!0},{cancelRefetch:!1}),J}},n[23]=p.data,n[24]=D,n[25]=d,n[26]=j):j=n[26];const C=!!p.data&&!i;let O;n[27]!==T||n[28]!==j||n[29]!==C?(O={queryKey:T,queryFn:j,enabled:C,refetchInterval:He,retry:!1},n[27]=T,n[28]=j,n[29]=C,n[30]=O):O=n[30];const A=F(O).data??p.data?.describe,k=qn({hasProject:!!e,hasServeConnection:!!r,runtime:s,v8:a,githubSite:v.data===Be?"not-owned":v.data?"ready":at(v)?"error":"loading",sandboxSite:go({data:E.data,isError:at(E),workingTreeReady:u})});if(k==="pending"){let m;return n[31]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending"},n[31]=m):m=n[31],m}if(k==="retrying-sandbox"){let m;return n[32]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"sandbox"},n[32]=m):m=n[32],m}if(k==="legacy"){let m;return n[33]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"legacy"},n[33]=m):m=n[33],m}if(k==="protocol-github"){const m=v.data;let J;n[34]!==m?(J=Te("github",m,""),n[34]=m,n[35]=J):J=n[35];let re;return n[36]!==c||n[37]!==J?(re={...J,site:c},n[36]=c,n[37]=J,n[38]=re):re=n[38],re}if(k==="site-not-owned-github"){let m;return n[39]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github",siteNotOwned:!0},n[39]=m):m=n[39],m}if(k==="protocol-sandbox"){let m;return n[40]!==E.data?(m=Te("sandbox",E.data,":sandbox"),n[40]=E.data,n[41]=m):m=n[41],m}if(k==="unavailable-github"){let m;return n[42]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github"},n[42]=m):m=n[42],m}const Q=p.error??p.failureReason,y=r?.endpoint??"";let V;return n[43]!==A||n[44]!==p.data||n[45]!==p.failureCount||n[46]!==p.isError||n[47]!==y||n[48]!==Q?(V=bo({probed:p.data,isError:p.isError,failureCount:p.failureCount,failure:Q,describe:A,endpoint:y}),n[43]=A,n[44]=p.data,n[45]=p.failureCount,n[46]=p.isError,n[47]=y,n[48]=Q,n[49]=V):V=n[49],V}function uo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?He:!1}function fo(e){return Yn(e+1)}function ho(e,t){return!(t instanceof P)&&!(t instanceof Qe)}function go(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const vo=3;function bo(e){const t=e.probed?Te("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<vo?t:{kind:"unavailable",source:"local",problem:Xn(e.failure)}:t??{kind:"pending"}}const ft={retry:2,refetchInterval:e=>e.state.status==="error"?He:!1};function Te(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function Lt(e){const t=R.c(12);let n;t[0]!==e?(n=ke.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=In(o,null),i=Ce(e);let a;t[2]!==r||t[3]!==e?(a=e?et(r):null,t[2]=r,t[3]=e,t[4]=a):a=t[4];const l=i?null:a;let f,u;t[5]!==s?(f=h=>s(et(h)),u=()=>s(null),t[5]=s,t[6]=f,t[7]=u):(f=t[6],u=t[7]);let d;return t[8]!==l||t[9]!==f||t[10]!==u?(d={url:l,setUrl:f,clear:u},t[8]=l,t[9]=f,t[10]=u,t[11]=d):d=t[11],d}function po(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function dt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function we(e,t,n){return["decofile-write",e,t,n]}function mo(e,t,n){return{id:we(e,t,n).join(":")}}class We extends Error{constructor(t,n,o=[],r=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=r,this.name="BlockConflictError"}blocks;fields;carriedStored}function Ge(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function Ye(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function wo(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function So(e,t,n){e.setQueryData(g.decofileDraft(Ge(t)),n)}function yo(e,t){return e.getQueryData(g.decofileDraft(Ge(t)))??null}async function Eo(e,t){return(await fetch(Ye(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function is(e){const t=R.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?Ge(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Oo,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r??null}async function Oo(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Do(e,t){const n=await fetch(Ye(t),{cache:"no-store"});if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&So(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function as(e,t){const n=await fetch(Ye(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new We(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return wo(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ft=3e3,ko=15e3,Io=2*6e4,Qt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function _o(e){return e<Io?Ft:ko}function To(e,t=Qt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,_o(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:c,skip:l}=e();if(r||t.hidden()||l?.()){i();return}r=!0;let f;try{f=c()}catch{f=void 0}Promise.resolve(f).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const ht=()=>0;function Po(e,t,n=Qt){const o=L.useRef(t);o.current=t;const[r]=L.useState(()=>({polling:()=>To(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?r.polling:r.idle,ht,ht)}function Vt(e,t){return me(e,t)}function Ro(e,t){return me(e,"preview-fetch",{path:t})}function cs(e){return Vt(e,"preview-invoke")}function ls(e){return Vt(e,"catalog-invoke")}function Bt(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 xo(){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&&Bt(n))return n}return null}function $o(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??xo();return n&&Bt(n)?new URL(t,n).toString():Ro(e,t)}function No(e){return $o(e,"/.decofile")}function jo(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function gt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function Co(e,t){const n=me(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=jo(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:An(s.content)}}async function Ao(e,t){const n=await Co(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function us(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){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Uo(e){return Ae(e)?.metadata?.runtime?.path??null}class Ht extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function fs(e){return e instanceof P&&e.code===S.Conflict}function Jt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class ze extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class Xe extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ds(e,t){return(t instanceof ze||t instanceof Xe)&&(t.message=Wt(e,t,"github")),t}function Wt(e,t,n){if(t instanceof ze)return e("siteEditor.save.draftUnread");if(t instanceof Xe)return e("siteEditor.save.keptChanging");if(t instanceof We)return t.message;if(n==="local")return Lo(e,t);if(t instanceof P)switch(t.code){case S.Conflict:return e("siteEditor.save.conflict");case S.ReadOnly:return e("siteEditor.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("siteEditor.save.invalid");case S.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function Mo(e,t){if(t==="local"||e instanceof We||e instanceof ze||e instanceof Xe)return null;if(e instanceof P){const n=e.code===S.InvalidBlock||e.code===S.InvalidParams?Jt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Lo(e,t){if(t instanceof Ht)return e("decoServe.save.serverGone");if(t instanceof P)switch(t.code){case S.Conflict:return e("decoServe.save.conflict");case S.ReadOnly:return e("decoServe.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("decoServe.save.invalid",{detail:Jt(t)});case S.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Fo(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Qo(e,t){const[n,o]=L.useState(e),r=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=Fo(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const Vo="decocms:content-writes",Pe=new Set;let G;function Gt(){if(G!==void 0)return G;G=null;try{typeof BroadcastChannel=="function"&&(G=new BroadcastChannel(Vo),G.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Pe])n(t)}))}catch{G=null}return G}function Bo(e){try{Gt()?.postMessage({cacheKey:e})}catch{}}function Ho(e){return Gt(),Pe.add(e),()=>{Pe.delete(e)}}const Yt="__at=",zt="__test=",Jo=/^[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 Wo(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function X(e){return typeof e=="string"&&Jo.test(e)}function vt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Go(e){const t=e.tests??{};return[...e.at!==void 0?[Yt+vt(e.at)]:[],...Object.keys(t).map(n=>zt+vt(`${n}=${t[n]?"on":"off"}`))]}function bt(e,t){const o=[...e.split("&").filter(r=>r&&!r.startsWith(Yt)&&!r.startsWith(zt)),...t];return o.length>0?`?${o.join("&")}`:""}function ge(e,t){const n=Go(t),o=e.indexOf("?"),r=o===-1?e:e.slice(0,o);if(X(r))return r+bt(o===-1?"":e.slice(o+1),n);const s=e.lastIndexOf("@");if(s<=0)return e;const i=e.slice(0,s),a=i.indexOf("?"),c=a===-1?i:i.slice(0,a),l=a===-1?"":i.slice(a+1);return`${c}${bt(l,n)}${e.slice(s)}`}function hs(e,t,n){if(!Wo(t))return e;try{const o=new URL(e),r=o.searchParams.get("__draft");return r&&r!=="off"?(o.searchParams.set("__draft",ge(r,t)),o.toString()):X(n)?(o.searchParams.set("__draft",ge(n,t)),o.toString()):e}catch{return e}}function gs(e,t,n="/"){if(!e||!X(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function Xt(e){return btoa(encodeURIComponent(e))}function vs(e,t,n){const o=Yo(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Yo(e,t,n){const o=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return r.searchParams.set("path","/"),r.searchParams.set("pathTemplate","/"),r.searchParams.set("props",Xt(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),r}const zo="__draft";function bs(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Xo="off";function Zo(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(zo,t),n.toString()}function ps(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:r,...s}=e.pageBlock,i=JSON.stringify({__props:s,__decofile:e.decofile});return{src:o.toString(),body:i}}function ms(e,t,n,o){const r=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,r);s.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),s.searchParams.set("props",Xt(JSON.stringify({sections:i}))),s.toString()}function ws(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const pt="__variant=";function Zt(e,t,n){return`${e}@${t}=${n}`}function Ss(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[Zt(e,"sections",t.index)]}function ys(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[Zt(e.pageKey,o,e.selectedVariantIndex)]}function Es(e,t){return[...t,...e]}function qo(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Ze(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),r=o.indexOf("?"),s=r===-1?o:o.slice(0,r),a=[...r===-1?[]:o.slice(r+1).split("&").filter(l=>l&&!l.startsWith(pt)),...t.map(l=>pt+qo(l))],c=a.length>0?`?${a.join("&")}`:"";return`${s}${c}${e.slice(n)}`}function Os(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),r=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return Ze(`${r}${o.pathname}@local`,t)}catch{return null}}function Ds(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",Ze(o,t)),n.toString())}catch{return e}}function Ko(e){const{pointer:t}=e;if(!t||t===Xo)return null;const n=t.indexOf("?");return X(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:X(e.heldRevision)&&e.forcedVariants.length===0?ge(e.heldRevision,e.previewOptions):ge(Ze(t,e.forcedVariants),e.previewOptions)}function er(e,t){if(!e||!t)return null;try{return Zo(e,t)}catch{return null}}function ks(e,t,n){if(!e||!n)return null;try{return er(new URL(t,e).toString(),n)}catch{return null}}const ve={forcedVariants:[],previewOptions:{}},ie=new Map,ae=new Map,Re=new Map;function qt(e){for(const t of Re.get(e)??[])t()}function Kt(e,t){const n=X(t)?t:null;(ae.get(e)??null)!==n&&(n?ae.set(e,n):ae.delete(e),qt(e))}function tr(e){return ae.get(e)??null}function nr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Is(e,t){const n=ie.get(e)??ve,o=t??ve;nr(n,o)||(t?ie.set(e,o):ie.delete(e),qt(e))}function or(e){return ie.get(e)??ve}function en(e,t){let n=Re.get(e);return n||(n=new Set,Re.set(e,n)),n.add(t),()=>{n.delete(t)}}function rr(e){const t=R.c(3);let n,o;return t[0]!==e?(n=r=>en(e,r),o=()=>or(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,sr)}function sr(){return ve}function ir(e){const t=R.c(3);let n,o;return t[0]!==e?(n=r=>e?en(e,r):cr,o=()=>e?tr(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,ar)}function ar(){return null}function cr(){}function _s(e,t){const n=R.c(4),o=rr(e),r=ir(e);let s;return n[0]!==o||n[1]!==r||n[2]!==t?(s=Ko({pointer:t,heldRevision:r,...o}),n[0]=o,n[1]=r,n[2]=t,n[3]=s):s=n[3],s}const tn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},lr=15e3,be=new Map;function z(e,t){return`${e}/${t}`}function H(e){let t=be.get(e);return t||(t={state:tn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},be.set(e,t)),t}function W(e,t){const n=H(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Se(e){e.timer&&clearTimeout(e.timer),e.timer=null}function qe(e){return be.get(e)?.state??tn}function ur(e,t){const n=H(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Ts(e){const t=H(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Se(t),W(e,{phase:"idle"}))}}function Ps(e){const t=be.get(e);!t||t.state.phase!=="reloading"||(Se(t),W(e,{phase:"idle"}))}function nn(e){const t=H(e);Se(t),W(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ce(e,t){const n=H(e),o=Math.max(0,n.state.inFlight-1);if(o>0){W(e,{inFlight:o});return}if(!t.ok||n.previews===0){W(e,{phase:"idle",inFlight:o});return}on(e,t.navigates,o)}function on(e,t,n=0){const o=H(e);Se(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&W(e,{phase:"idle"})},lr),W(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function fr(e){return e?.kind==="protocol"&&e.source==="github"}async function le(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=s?g.protocolDraftRead(o,r,s):null,f=l?JSON.stringify(n.getQueryData(l)??null):null,u=c?[c]:[];if(a&&t.reread&&u.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&u.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),s&&i.source==="sandbox"&&u.push(n.invalidateQueries({queryKey:Fn(o,r,s)})),fr(i)&&l&&!t.adopted&&u.push(n.invalidateQueries({queryKey:l})),await Promise.all(u),t.kind!=="edit"){const b=z(o,r);W(b,{epoch:qe(b).epoch+1})}const d=l?JSON.stringify(n.getQueryData(l)??null):null,h=f!==d;return h&&await new Promise(b=>Ot.schedule(b)),{navigates:h}}async function dr(e,t){return nn(z(e.orgSlug,e.virtualMcpId)),rn(e,t)}function mt(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function rn(e,t){const n=z(e.orgSlug,e.virtualMcpId),o=t.adopted?mt(e):null;let r;try{r=await t.write()}catch(i){throw ce(n,{ok:!1,navigates:!1}),t.refreshOnError&&le(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&Bo(e.cacheKey),Kt(n,t.shownRevision?.(r)??null),t.adopted){const i=mt(e)!==o;return i&&await new Promise(a=>Ot.schedule(a)),ce(n,{ok:!0,navigates:i}),t.reread&&le(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await le(e,t))}catch{}finally{ce(n,{ok:!0,navigates:s})}return r}function Rs(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=z(o,r),a=new Set(t.blockKeys);for(const f of[...H(i).discardListeners])f(a);nn(i);let c=!1;const l=()=>(c=!0,rn(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:we(o,r,s),scope:mo(o,r,s),mutationFn:l}).execute(void 0).catch(f=>{throw c||ce(i,{ok:!1,navigates:!1}),f}):l()}function xs(e,t,n){const o=R.c(8);let r;o[0]!==e||o[1]!==t?(r=z(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const c=H(s).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],L.useEffect(i,a)}function sn(e){const t=z(e.orgSlug,e.virtualMcpId);qe(t).inFlight>0||(Kt(t,null),le(e,{kind:"external"}).then(({navigates:n})=>{const o=H(t);o.previews>0&&o.state.inFlight===0&&on(t,n)}).catch(()=>{}))}function hr(e,t){const n=R.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 r=o;let s;n[3]!==r?(s=l=>ur(r,l),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>qe(r),n[5]=r,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const gr=500;function $s(e,t){const{phase:n}=hr(e,t);return Qo(n!=="idle",gr)}function vr(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function an(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Ns(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Tn(i,n):br(e,t,n)}const r=e.getQueryData(g.contentVersions(t));if(!r)return;if(Object.hasOwn(r,n))return r[n];const s=e.getQueryData(g.decofile(t));return s&&Object.hasOwn(s,n)?void 0:null}function te(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=B(t),o=Object.keys(e.changes).find(r=>B(r)===n);return o===void 0?void 0:e.changes[o]}function br(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return cn(o,ye(e,t),n)}function cn(e,t,n){const o=te(e,n);return o?.kind==="delete"?o.version??fe:o?o.version:t.has(B(n))?fe:null}function js(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const r=te(o,n);return r?r.kind==="set"&&r.baseVersion===null:ye(e,t).has(B(n))}function Cs(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const r=ye(e,t);return{blocks:n,versionOf:s=>cn(o,r,s)}}function ye(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function pe(e,t,n,o){const r=B(n),s=ye(e,t);s.has(r)!==o&&(o?s.add(r):s.delete(r),q(e),e.setQueryData(g.contentDraftTombstones(t),[...s]))}function ln(e,t,n,o){const r=o.revision,s=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([u,d])=>[u,d===fe?null:d]),a=e.getQueryData(g.contentChanges(n)),c=new Set(i.flatMap(([u])=>{const d=a?te(a,u):void 0;return(d?d.baseVersion:s?.[u]??null)===null?[u]:[]})),l=new Set(i.flatMap(([u,d])=>d===null?[]:[B(u)]));e.setQueryData(g.contentChanges(n),u=>{if(!u)return u;const d={...u.changes};for(const[h,b]of i){const v=te(u,h),w=v?v.baseVersion:s?.[h]??null;b!==null?d[h]={kind:"set",version:b,baseVersion:w}:w!==null?d[h]={kind:"delete",version:null,baseVersion:w}:delete d[h]}return{...u,changes:d,edited:!0}});for(const[u,d]of i)d!==null?pe(e,n,u,!1):!l.has(B(u))&&c.has(u)&&pe(e,n,u,!0);const f=o.revision;return f&&f!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),u=>u&&{...u,version:f}),r}function Ee(e,t,n){q(e),e.setQueryData(g.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function un(e,t){const n=e.getMutationCache().findAll({mutationKey:we(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>to(o.state.variables)))}function xe(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function ne(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof P);throw t.source==="local"&&s?(xe(e,n),new Ht(r)):(t.source==="local"&&Le(r)&&xe(e,n),r)}}const ue=new Map;function fn(e,t,n,o){const r=ue.get(o);if(r)return r;const s=Ke(e,t,n,o,!0);return ue.set(o,s),s.finally(()=>ue.delete(o))}const De=new Set;function pr(e,t,n){const o=R.c(8),r=Z(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(c=()=>{if(!e||!s||!i||!a)return;const f={orgSlug:s,virtualMcpId:i,branch:a};return Ho(u=>{u===n&&(De.has(n)||(De.add(n),wr(r,e,f,n).catch(mr).finally(()=>De.delete(n))))})},l=[r,e,s,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=s,o[4]=r,o[5]=i,o[6]=c,o[7]=l):(c=o[6],l=o[7]),L.useEffect(c,l)}function mr(){}async function wr(e,t,n,o){const r=ue.get(o);return r&&await r.catch(()=>{}),fn(e,t,n,o)}async function Ke(e,t,n,o,r){q(e);const s=g.decofile(o),i=an(n,t),a=g.contentRevision(o),c=g.contentVersions(o),l=e.getQueryData(s),f=e.getQueryData(c),d=e.getQueryData(i),h=e.getQueryData(a)??void 0,b=r&&l&&f?h?.revision:void 0,v=r&&d?h?.schemaVersion:void 0,w=g.contentChanges(o),I=e.getQueryData(w);if(t.source==="github"&&t.hosted)return Sr(e,t,t.hosted,n,o,{conditional:r,seen:h,currentMeta:d,schemaIfNoneMatch:v,seenChanges:I});const[E,x,_]=await ne(e,t,n,()=>t.client.batch([{method:"blocks.list",params:b?{ifNoneMatch:b}:{}},{method:"schema.get",params:v?{ifNoneMatch:v}:{}},{method:"changes.list",params:Me(I)}])),N=e.getQueryData(a)?.revision,$=N!==void 0&&N!==h?.revision;if(_?.ok){const O=$?null:de(I,_.result);O&&e.setQueryData(w,O)}else _&&t.source==="local"&&Le(_.error)&&xe(e,n);if(!E?.ok)throw E?.error??new Error("no blocks.list");if(!x)throw new Error("no schema.get");const p=E.result,U=Ve(x),D=x.ok&&!U?x.result:null;if(p.notModified&&(!l||!f)||D?.notModified&&!d)return Ke(e,t,n,o,!1);const T=p.notModified?new Set:un(e,n),j=p.notModified?l:eo(p.blocks,l,T),C=U?Mt():D?D.notModified?d:D.schema:x.error;if(e.setQueryData(a,{revision:$?N:p.notModified?h?.revision:p.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(s,j),!p.notModified){const O=e.getQueryData(c),M={...p.versions};for(const A of T){const k=O?.[A];k!==void 0?M[A]=k:delete M[A]}e.setQueryData(c,M)}return C instanceof P||e.setQueryData(i,C),!$&&!p.notModified&&l&&h?.revision&&p.revision!==h.revision&&sn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:j,meta:C}}async function Sr(e,t,n,o,r,s){const i=g.decofile(r),a=g.contentIndex(r),c=g.contentRevision(r),l=g.contentVersions(r),f=an(o,t),u=g.contentChanges(r),d=e.getQueryData(a),h=s.conditional&&d?s.seen?.revision:void 0,[b,v,w]=await ne(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:s.schemaIfNoneMatch?{ifNoneMatch:s.schemaIfNoneMatch}:{}},{method:"changes.list",params:Me(s.seenChanges)}])),I=e.getQueryData(a)??d,E=e.getQueryData(c)?.revision,x=E!==void 0&&E!==s.seen?.revision;if(w?.ok&&!x){const y=de(s.seenChanges,w.result);y&&e.setQueryData(u,y)}if(!b?.ok)throw b?.error??new Error("no cms.index");if(!v)throw new Error("no schema.get");const _=b.result,N=Ve(v),$=v.ok&&!N?v.result:null;if(_.notModified&&!d||$?.notModified&&!s.currentMeta)return Ke(e,t,o,r,!1);const p=N?Mt():$?$.notModified?s.currentMeta:$.schema:v.error;p instanceof P||e.setQueryData(f,p);const U=$?$.notModified?s.seen?.schemaVersion:$.version??void 0:void 0,D=e.getQueryData(i)??{};if(_.notModified||x)return e.setQueryData(c,{revision:x?E:s.seen?.revision,schemaVersion:U}),e.setQueryData(i,D),{blocks:D,meta:p};const T={revision:_.revision,resolvedRef:_.resolvedRef,sequence:_.sequence,entries:_.entries,draft:_.draft};e.setQueryData(a,T);const j=!!s.seen?.revision&&T.revision!==s.seen.revision&&(!s.seen.revision.startsWith("s-")||!!d&&dn(d.draft,T.draft));j&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),y=>y&&{...y,version:T.revision}),e.setQueryData(c,{revision:T.revision,schemaVersion:U});const C=un(e,o),O=e.getQueryData(l)??{},M={},A={},k=[];for(const[y,V]of Object.entries(D)){const m=T.entries[y];!m&&!C.has(y)||(M[y]=V,O[y]!==void 0&&(A[y]=O[y]),m&&!C.has(y)&&O[y]!==m.version&&k.push(y))}return e.setQueryData(i,M),e.setQueryData(l,A),k.length>0&&await xn(e,n,r,k,C),I&&j&&yr(I,T)&&sn({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:r}),{blocks:e.getQueryData(i)??M,meta:p}}function yr(e,t){if(dn(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 dn(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 Er(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 wt(e){if(!(e instanceof P)||e.code!==S.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"))}function Or(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([r])=>!Object.hasOwn(t,r))),o=(e.delete??[]).filter(r=>!Object.hasOwn(t,r));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function St(e,t,n,o,r){q(e),ln(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:r}),Ee(e,n,Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i===fe?null:i]))),Dt(e,n,r,o.set??{})}async function As(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(l=>!s||!Object.hasOwn(s,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const c=_n(r.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return dr({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=f=>ne(e,t,n,()=>t.client.blocksApply({set:f.set,delete:f.delete,...s?{ifMatch:Er(s,f)}:{}}));let a;try{a=await i(r)}catch(f){const u=t.source==="github"?wt(f):void 0;if(!u)throw f;const d=Or(r,u);Object.keys(u).length>0&&St(e,n,o,r,u);let h;try{h=await i(d)}catch(b){const v=wt(b);throw v&&Object.keys(v).length>0&&St(e,n,o,d,v),b}a={...h,versions:{...u,...h.versions}}}q(e);const c=t.source==="github"?ln(e,n,o,a):a.revision;t.source==="github"&&Dt(e,o,a.versions??{},r.set??{}),e.setQueryData(g.contentRevision(o),f=>({...f,revision:c}));const l=a.versions??{};return Ee(e,o,l),{revision:c,versions:l}}})}function hn(e,t){if(!(e instanceof P))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 gn(e,t,n){if(!(n instanceof P))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[r,s]of Object.entries(o))s===null&&pe(e,t,r,!1)}function vn(e,t,n,o){q(e),Pn(e,n,o);const r=o.block===null,s=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=i?te(i,n):void 0,c=a?a.baseVersion:s?.[n]??null;if(i){const l=B(n),f=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(u)!==l));r?c!==null&&(f[n]={kind:"delete",version:null,baseVersion:c}):f[n]={kind:"set",version:o.version,baseVersion:c},e.setQueryData(g.contentChanges(t),{...i,changes:f,edited:!0})}pe(e,t,n,r&&c===null),e.setQueryData(g.decofile(t),l=>{const f={...l};return r?delete f[n]:f[n]=o.block,f}),Ee(e,t,{[n]:r?null:o.version}),Rn(e,t,n,o)}function Us(e,t,n,o){if(t.source!=="github"||!(o instanceof P))return!1;gn(e,n,o);const r=o.data?.draft;if(!r||typeof r!="object")return!1;const s=Object.keys(r),i=s.map(a=>hn(o,a));return s.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),s.forEach((a,c)=>{vn(e,n,a,i[c])}),!0)}async function Ms(e,t,n,o,r,s){t.source==="github"&&gn(e,o,s);const i=t.source==="github"?hn(s,r):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),vn(e,o,r,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const l=(await ne(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];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),f=>{if(!f)return f;const u={...f.changes};return l?.kind?u[r]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete u[r],{...f,changes:u,edited:!0}})}catch{const c=await ne(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[r]??null,version:c.versions[r]??null}}return e.setQueryData(g.decofile(o),c=>{const l={...c};return a.value===null?delete l[r]:l[r]=a.value,l}),Ee(e,o,{[r]:a.version}),!1}function Dr(e){const t=R.c(17),n=Ae(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=yt(n),t[0]=n,t[1]=o):o=t[1];const r=o;let s;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(s=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=s):s=t[5];let i;t[6]!==e||t[7]!==r?(i=async()=>{const v=await Et(r,e.branch),w=v.pointer?.lastIndexOf("@")??-1;return{draft:v.pointer&&w>0?v.pointer.slice(0,w):null,version:v.pointer&&w>0?v.pointer.slice(w+1):v.etag}},t[6]=e,t[7]=r,t[8]=i):i=t[8];const a=!!e&&!!r;let c;t[9]!==s||t[10]!==i||t[11]!==a?(c={queryKey:s,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=s,t[10]=i,t[11]=a,t[12]=c):c=t[12];const{data:l,isPending:f,isError:u}=F(c),d=!!e&&!!r&&f&&!u;if(!e||!l?.draft||!l.version){let v;return t[13]!==d?(v={pointer:null,pending:d},t[13]=d,t[14]=v):v=t[14],v}const h=`${l.draft}@${l.version}`;let b;return t[15]!==h?(b={pointer:h,pending:!1},t[15]=h,t[16]=b):b=t[16],b}function Ls(e){return Dr(e).pointer}function Fs(e){const t=R.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:kr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function kr(){throw new Error("content revisions are set by reads and writes")}function $e(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Qs(e,t){return $e({...e,protocolSuffix:t.cacheKeySuffix})}function Oe(e,t){const n=R.c(6),{url:o}=Lt(e?.virtualMcpId),r=oe(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?$e({...e,protocolSuffix:r.cacheKeySuffix}):$e({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function Vs(e,t){const n=R.c(46),{url:o}=Lt(e?.virtualMcpId),r=!!o,s=oe(e?.virtualMcpId,e?.branch),i=s.kind==="protocol"?s:null,a=Oe(e),c=t?.fetchEnabled??!0,l=Uo(e?.virtualMcpId),f=It(e?.virtualMcpId).runtime==="cms",u=Z();let d;n[0]!==a?(d=g.decofile(a),n[0]=a,n[1]=d):d=n[1];const h=d;pr(i,i&&e?e:null,a);let b;n[2]!==e||n[3]!==u||n[4]!==h?(b=()=>{if(!e||u.isMutating({mutationKey:we(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const O=u.getQueryState(h);return O?.fetchStatus==="fetching"||Date.now()-(O?.dataUpdatedAt??0)<Ft/2},n[2]=e,n[3]=u,n[4]=h,n[5]=b):b=n[5];let v;n[6]!==f||n[7]!==r||n[8]!==e||n[9]!==i||n[10]!==u||n[11]!==h?(v=async()=>{if(e){if(!i&&f&&!r){const O=yo(u,e)?.version;if(O&&!await Eo(e,O))return}await u.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=f,n[7]=r,n[8]=e,n[9]=i,n[10]=u,n[11]=h,n[12]=v):v=n[12];let w;n[13]!==b||n[14]!==v?(w={skip:b,read:v},n[13]=b,n[14]=v,n[15]=w):w=n[15],Po(!!t?.pollWhile&&!!e,w);const I=kt(i?.hosted?a:"");let E;n[16]!==s.kind||n[17]!==f||n[18]!==c||n[19]!==a||n[20]!==r||n[21]!==o||n[22]!==l||n[23]!==e||n[24]!==i||n[25]!==u?(E=async()=>{if(i)return(await fn(u,i,e,a)).blocks;if(s.kind==="unavailable")throw vr("decofile");if(r){const k=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Tr),Q=k?.ok?dt(await k.text()):null;if(Q)return Q;const y=new Error("decofile unavailable (local tunnel unreachable)");throw y.status=502,y}if(f)return Do(u,e);const O=()=>Ao(e,po(l,".deco/blocks.gen.json"));if(c){const k=await fetch(No(e),{cache:"no-store"}).catch(_r);if(k?.ok){const V=dt(await k.text());if(V)return V}const Q=await O();if(Q.kind==="data")return Q.data;const y=new Error(`Failed to fetch decofile: ${k?.status??"network error"}`);throw y.status=gt({liveOk:!!k?.ok,liveStatus:k?.status,committedAbsent:Q.kind==="absent"}),y}const M=await O();if(M.kind==="data")return M.data;const A=new Error("decofile unavailable (preview down, no committed snapshot)");throw A.status=gt({liveOk:!1,committedAbsent:M.kind==="absent"}),A},n[16]=s.kind,n[17]=f,n[18]=c,n[19]=a,n[20]=r,n[21]=o,n[22]=l,n[23]=e,n[24]=i,n[25]=u,n[26]=E):E=n[26];const x=!!e&&s.kind!=="pending",_=i?0:3e4,N=i?.describe.pollIntervalMs,$=i?"always":void 0;let p;n[27]!==f||n[28]!==r||n[29]!==i?(p=(O,M)=>{if(i||f||r)return O<3;const A=M.status;return A!==502&&A!==404&&O<2},n[27]=f,n[28]=r,n[29]=i,n[30]=p):p=n[30];let U;n[31]!==h||n[32]!==E||n[33]!==x||n[34]!==_||n[35]!==N||n[36]!==$||n[37]!==p?(U={queryKey:h,queryFn:E,enabled:x,staleTime:_,refetchInterval:N,refetchIntervalInBackground:!1,refetchOnWindowFocus:$,retry:p,retryDelay:Ir},n[31]=h,n[32]=E,n[33]=x,n[34]=_,n[35]=N,n[36]=$,n[37]=p,n[38]=U):U=n[38];const D=F(U);let T;n[39]!==I||n[40]!==D?(T=I&&D.data?$n(I,D.data):void 0,n[39]=I,n[40]=D,n[41]=T):T=n[41];const j=T;let C;return n[42]!==j||n[43]!==i?.hosted||n[44]!==D?(C=i?.hosted&&j?{...D,data:j}:D,n[42]=j,n[43]=i?.hosted,n[44]=D,n[45]=C):C=n[45],C}function Ir(e){return jn(5e3,1e3,e,2,0)}function _r(){return null}function Tr(){return null}function Bs(e,t,n){const o=oe(e?.virtualMcpId,e?.branch),r=Oe(e),s=o.kind==="protocol"?o.hosted:void 0;return Nn(s,r,t,n)}function Hs(e){const t=R.c(4),n=Z(),o=oe(e?.virtualMcpId,e?.branch),r=Oe(e),s=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==r||t[1]!==n||t[2]!==s?(i=(a,c)=>Cn(n,s,r,a,c),t[0]=r,t[1]=n,t[2]=s,t[3]=i):i=t[3],i}function Js(e,t){const n=R.c(3),o=oe(e?.virtualMcpId,e?.branch),r=Oe(e),s=kt(o.kind==="protocol"&&o.hosted?r:"");let i;return n[0]!==s?.entries||n[1]!==t?(i=Object.entries(s?.entries??{}).filter(a=>{const[,c]=a;return t(c.meta?.type??"")}).map(Pr),n[0]=s?.entries,n[1]=t,n[2]=i):i=n[2],i}function Pr(e){const[t]=e;return t}const Rr="site-editor-save",bn={id:Rr,description:void 0,action:void 0,cancel:void 0},Ws="site-editor-undo",Ne="site-editor-publish";function xr(e){const t=R.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=Y.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=Y.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=Y.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function pn(e,t){return t?Y.jsx(xr,{label:e("siteEditor.details"),detail:t}):void 0}function Gs(e,t,n){ee.error(Wt(e,t,n),{...bn,description:pn(e,Mo(t,n))})}function Ys(e,t,n=!1){ee.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...bn,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const mn={action:void 0,duration:void 0};function zs(e,t){ee.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...mn,id:Ne,description:void 0})}function Xs(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=pn(e,o??null);ee[i](t,{id:Ne,description:n&&a?Y.jsxs(Y.Fragment,{children:[Y.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ee.loading(s??e("thread.publishPopover.publishing"),{...mn,id:Ne,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function Zs(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{wo as $,ws as A,Hs as B,$s as C,es as D,Dr as E,Bs as F,z as G,ir as H,Is as I,Os as J,ge as K,Xo as L,Zo as M,hs as N,Ds as O,vs as P,Ps as Q,Ts as R,hr as S,Ct as T,Oe as U,Fs as V,ps as W,mo as X,we as Y,dr as Z,Co as _,Zr as a,Qs as a0,Hr as a1,Wr as a2,Js as a3,Ys as a4,js as a5,ds as a6,We as a7,fs as a8,wr as a9,Xe as aA,Us as aB,fn as aC,vr as aD,us as aE,Ne as aF,mn as aG,zs as aH,Rs as aI,Vr as aJ,Br as aK,Le as aL,is as aM,Ls as aN,bs as aO,X as aP,gs as aQ,Xs as aR,Ws as aS,bn as aT,un as aU,ms as aV,ls as aW,Ss as aX,ys as aY,Es as aZ,ze as aa,As as ab,Ms as ac,Gs as ad,Ns as ae,an as af,So as ag,as as ah,xs as ai,Cs as aj,Kr as ak,rs as al,ct as am,lt as an,ss as ao,$o as ap,ns as aq,zn as ar,pn as as,Zs as at,Yo as au,Jr as av,Vn as aw,xr as ax,_s as ay,ks as az,Zn as b,Lt as c,Yn as d,Xr as e,Xn as f,Je as g,Ue as h,xt as i,cs as j,Ro as k,Vs as l,qr as m,os as n,Uo as o,Gr as p,po as q,zr as r,Yr as s,Ko as t,oe as u,er as v,Wo as w,Ao as x,At as y,ts as z};