decocms 4.562.0 → 4.563.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (432) hide show
  1. package/dist/client/assets/{AlertCircle-BMgOinVw.js → AlertCircle-2LbzMVC9.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BcZi16Vr.js → AreaChart-qBz2MFzD.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-BJMjlG4g.js → ArrowLeft-BeuQwyHa.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-DcJMRdNb.js → ArrowUp-DmxAfWhF.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-C8LrSJIS.js → CartesianChart-BSwxZ1ZU.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-CUR_9ZiJ.js → CategoricalChart-DVdTZlRq.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-By2z0uOx.js → CheckCircle-BzNTGMCW.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-BTg7xsL3.js → ChevronSelectorVertical-XdbRnSsi.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-BCfBdjs4.js → ChevronUp-aYmfXYet.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-kxqKIkVq.js → CreditCard01-yFcUZGe-.js} +1 -1
  11. package/dist/client/assets/{Globe04-ri2PR4JW.js → Globe04-RPMmcIuy.js} +1 -1
  12. package/dist/client/assets/{Key01-By4BziN_.js → Key01-jvDltRrN.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-znJYLaVP.js → LinkBroken01-Jybptj_M.js} +1 -1
  14. package/dist/client/assets/{Minus-Biy1YWEX.js → Minus-BqtyYKKc.js} +1 -1
  15. package/dist/client/assets/{Monitor01-DcAryzmn.js → Monitor01-As0zpJLy.js} +1 -1
  16. package/dist/client/assets/{Play-BkYxzt1r.js → Play-CdlorRHF.js} +1 -1
  17. package/dist/client/assets/{Plus-BhRQRaas.js → Plus-CzoopYlU.js} +1 -1
  18. package/dist/client/assets/ReferenceLine-CJng4Q0_.js +1 -0
  19. package/dist/client/assets/{SearchMd-DqnvtcaB.js → SearchMd-By2dNUiw.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-DYcJDT4V.js → ShoppingBag01-DhegylE0.js} +1 -1
  21. package/dist/client/assets/{Sun-tnCpymBL.js → Sun-Hd0LHTxB.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-D2vRhNhF.js → SwitchHorizontal01-Czrqzt6f.js} +1 -1
  23. package/dist/client/assets/{Tool01-B8q2F7hW.js → Tool01-D38zOT0h.js} +1 -1
  24. package/dist/client/assets/{Tooltip-B6aZIxiB.js → Tooltip-Dxjn-_yM.js} +1 -1
  25. package/dist/client/assets/{Trash01-Ccl1EX2p.js → Trash01-BxSWir9J.js} +1 -1
  26. package/dist/client/assets/{Upload01-DOAyGyLP.js → Upload01-C8sapTWh.js} +1 -1
  27. package/dist/client/assets/{UserSquare-Cbfe91aH.js → UserSquare-CEg-eLCw.js} +1 -1
  28. package/dist/client/assets/{Users01-C1OYrFY1.js → Users01-CMreTMtq.js} +1 -1
  29. package/dist/client/assets/{XClose-p8-Q8v8l.js → XClose-DGifUqyQ.js} +1 -1
  30. package/dist/client/assets/{Zap-DyRXLCnm.js → Zap-BLaVFWQx.js} +1 -1
  31. package/dist/client/assets/{access-gate-BAXdhF61.js → access-gate-BJSZ7nU5.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-I3R6bOX6.js → add-connection-dialog-Dpu5ecJP.js} +1 -1
  33. package/dist/client/assets/agent-app-CHKycGm0.js +1 -0
  34. package/dist/client/assets/agent-assets-7nArEuts.js +1 -0
  35. package/dist/client/assets/{agent-automation-TykMN0zp.js → agent-automation-Dq1UMpQM.js} +3 -3
  36. package/dist/client/assets/{agent-automations-axy_S6Px.js → agent-automations-DF3vcb3-.js} +1 -1
  37. package/dist/client/assets/agent-calendar-CsvxRBRw.js +1 -0
  38. package/dist/client/assets/agent-capabilities-CaXbVMop.js +1 -0
  39. package/dist/client/assets/{agent-connect-sources-YnQ0oiMQ.js → agent-connect-sources-84FLUgzX.js} +1 -1
  40. package/dist/client/assets/agent-deck-DEx4qeYv.js +1 -0
  41. package/dist/client/assets/agent-e2e-CfTkWgUa.js +1 -0
  42. package/dist/client/assets/agent-experiments-BMy2QOPP.js +1 -0
  43. package/dist/client/assets/agent-file-C7mhhKFK.js +1 -0
  44. package/dist/client/assets/agent-hosting-BmtgVBqV.js +1 -0
  45. package/dist/client/assets/{agent-icon-FkFyvRCX.js → agent-icon-U2nlXoBG.js} +1 -1
  46. package/dist/client/assets/agent-library-DIxeSWXa.js +1 -0
  47. package/dist/client/assets/agent-library-file-DQB6i5_0.js +1 -0
  48. package/dist/client/assets/agent-overview-D8ZTdoEM.js +1 -0
  49. package/dist/client/assets/agent-releases-DOPovy0S.js +2 -0
  50. package/dist/client/assets/agent-settings-x3yUV6x9.js +1 -0
  51. package/dist/client/assets/{agent-site-editor-iOr_R9Ca.js → agent-site-editor-Pg_WHlnv.js} +2 -2
  52. package/dist/client/assets/agent-site-editor-code-DDscaXHP.js +2 -0
  53. package/dist/client/assets/agent-site-editor-content-CBj6Azpl.js +1 -0
  54. package/dist/client/assets/agent-site-editor-preview-Doqukvwz.js +1 -0
  55. package/dist/client/assets/agent-view-CvpQlU18.js +1 -0
  56. package/dist/client/assets/{agent-view-guard-CTg_3K6Q.js → agent-view-guard-BFnkZyhp.js} +1 -1
  57. package/dist/client/assets/{ai-providers-SquUsRRR.js → ai-providers-tFJSU00y.js} +1 -1
  58. package/dist/client/assets/{alert-BcGEYE9G.js → alert-B52lXsYB.js} +1 -1
  59. package/dist/client/assets/{analytics-sections-C3xfRdmO.js → analytics-sections-DgZGw207.js} +1 -1
  60. package/dist/client/assets/api-keys-BEFmsf3L.js +1 -0
  61. package/dist/client/assets/{api-keys-6xNcEC8t.js → api-keys-Bc1E8umo.js} +1 -1
  62. package/dist/client/assets/app-editor-a13s_yZZ.js +1 -0
  63. package/dist/client/assets/{asset-utils-Bq_dJbYP.js → asset-utils-DxOK6Cj3.js} +1 -1
  64. package/dist/client/assets/{auth-BsX6ur7b.js → auth-D991fBKg.js} +1 -1
  65. package/dist/client/assets/{auth-catchall-BwwwkN3O.js → auth-catchall-CO4eQSBG.js} +1 -1
  66. package/dist/client/assets/{auth-entry-D3WJl0FC.js → auth-entry-IOobChfY.js} +1 -1
  67. package/dist/client/assets/{auth-split-layout-J4KMjvhP.js → auth-split-layout-Dn_4EroD.js} +1 -1
  68. package/dist/client/assets/{authenticate-and-persist-oauth-Cu0VrSF5.js → authenticate-and-persist-oauth-CM3iiCDW.js} +1 -1
  69. package/dist/client/assets/{automation-list-row-QpXtin0Q.js → automation-list-row-sEGCpgiC.js} +1 -1
  70. package/dist/client/assets/{automation-runs-aImufYAH.js → automation-runs-DnhCJL7r.js} +1 -1
  71. package/dist/client/assets/{automations-DLgpPcdB.js → automations-BopJHgke.js} +1 -1
  72. package/dist/client/assets/{autosend-ce5-FRC2.js → autosend-D6GGYoeu.js} +1 -1
  73. package/dist/client/assets/{badge-2xhZ-r-l.js → badge-C9w1KAGQ.js} +1 -1
  74. package/dist/client/assets/{block-document-DI7cHMPV.js → block-document-ExA3sDvi.js} +2 -2
  75. package/dist/client/assets/{blocks-preview-workspace-context-DbUsPnrw.js → blocks-preview-workspace-context-Gbv7_zq8.js} +1 -1
  76. package/dist/client/assets/blocks-tab-states-oXZbJa9b.js +1 -0
  77. package/dist/client/assets/{blog-schema-CHW5Pxv_.js → blog-schema-4OEvCOpU.js} +1 -1
  78. package/dist/client/assets/{buckets-BDCTPQpG.js → buckets-DsGf5D8D.js} +1 -1
  79. package/dist/client/assets/{build-improve-prompt-doc-5IZRp812.js → build-improve-prompt-doc-BpZBupFA.js} +1 -1
  80. package/dist/client/assets/{calendar-D-rfd7JY.js → calendar-ahGH-Iwe.js} +1 -1
  81. package/dist/client/assets/{capability-load-error-BKCZfLTa.js → capability-load-error-BG7LprlO.js} +1 -1
  82. package/dist/client/assets/category-editor-Ctbp0oQy.js +1 -0
  83. package/dist/client/assets/{chart-wyCy3WJz.js → chart-DnblhNHq.js} +1 -1
  84. package/dist/client/assets/{chat-context-GsXpI-Rk.js → chat-context-CCj5lauv.js} +2 -2
  85. package/dist/client/assets/{chat-draft-CnA31cek.js → chat-draft-BtMWyLm7.js} +1 -1
  86. package/dist/client/assets/{checkbox-LWvsDQWZ.js → checkbox-DB14k3TQ.js} +1 -1
  87. package/dist/client/assets/{choose-editor-oX8cTiL9.js → choose-editor-D4zx1UJt.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-Dal5M4-w.js → cli-auth-success-DeaH4VUx.js} +1 -1
  89. package/dist/client/assets/{client-icons-BUnl0ZXy.js → client-icons-C4W9Kqhd.js} +1 -1
  90. package/dist/client/assets/cms-settings-editor-CcuLaEnU.js +1 -0
  91. package/dist/client/assets/cms-store-drafts-BumH78UY.js +1 -0
  92. package/dist/client/assets/{collapsible-DwneXnWl.js → collapsible-BPEhSNLz.js} +1 -1
  93. package/dist/client/assets/{collection-detail-DWuKEvHr.js → collection-detail-ralZDDkv.js} +1 -1
  94. package/dist/client/assets/{collection-display-button-BcvxnzA7.js → collection-display-button-CigTGx80.js} +1 -1
  95. package/dist/client/assets/{collection-search-BXhJDy4i.js → collection-search-D_oD-yY0.js} +1 -1
  96. package/dist/client/assets/{collection-table-wrapper-CsjezWAk.js → collection-table-wrapper-C2dK4p_4.js} +1 -1
  97. package/dist/client/assets/{collection-tabs-R5zZyWuQ.js → collection-tabs-SAUXvS4g.js} +1 -1
  98. package/dist/client/assets/{combobox-M_E9pRSg.js → combobox-hVgdYGtQ.js} +1 -1
  99. package/dist/client/assets/{command-D1ggU7uN.js → command-DiccrIM8.js} +1 -1
  100. package/dist/client/assets/{companion-mcps-section-5tiqlnPW.js → companion-mcps-section-BUEyDlWy.js} +1 -1
  101. package/dist/client/assets/{config-BwOe4khb.js → config-DgUlbPLE.js} +1 -1
  102. package/dist/client/assets/{connect-CZDT3prT.js → connect-DhpQ_i5Y.js} +3 -3
  103. package/dist/client/assets/{connect-layout-BlfzEMXx.js → connect-layout-Dgb_j_Nn.js} +1 -1
  104. package/dist/client/assets/{connect-source-dialog-Bu2QM8b1.js → connect-source-dialog-Dga8Dh15.js} +1 -1
  105. package/dist/client/assets/{connection-BWg4pBgr.js → connection-DF20RpK_.js} +1 -1
  106. package/dist/client/assets/{connection-card-D8rA98h7.js → connection-card-DeCnJCAi.js} +1 -1
  107. package/dist/client/assets/{connection-detail-DSD-1Pdd.js → connection-detail-Dn5XmXHk.js} +1 -1
  108. package/dist/client/assets/{connection-form-helpers-CTdld_FZ.js → connection-form-helpers-B4MG2Fy2.js} +1 -1
  109. package/dist/client/assets/{connection-slug-xnxqKZgT.js → connection-slug-tS8GnOSc.js} +1 -1
  110. package/dist/client/assets/{connections-CZPMCaga.js → connections-DREB4U2P.js} +1 -1
  111. package/dist/client/assets/{content-tab-B2fyj6Jh.js → content-tab-kF-GtTU9.js} +8 -8
  112. package/dist/client/assets/context-Gpy7m9cw.js +1 -0
  113. package/dist/client/assets/{context-menu-DPGth7tq.js → context-menu-vUs3I8Wh.js} +1 -1
  114. package/dist/client/assets/{context-shell-tkTYv2bR.js → context-shell-vU2YMH1K.js} +3 -3
  115. package/dist/client/assets/{core.esm-DnEwZVMw.js → core.esm-CWyzckxm.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-UgMN3Pp1.js → create-organization-dialog-qsB5dfrW.js} +1 -1
  117. package/dist/client/assets/device-hint-DMMaEP-p.js +1 -0
  118. package/dist/client/assets/{discover-Cpqi_nZO.js → discover-DN-I6i-O.js} +1 -1
  119. package/dist/client/assets/{domain-settings-DJSixqz2.js → domain-settings-FZeIPnhT.js} +1 -1
  120. package/dist/client/assets/{drawer-BnPszJPZ.js → drawer-CMTReHxa.js} +1 -1
  121. package/dist/client/assets/{editor-zE4VnGLI.js → editor-C6CE2FNQ.js} +1 -1
  122. package/dist/client/assets/{editor-classes-BnzpZOY5.js → editor-classes-DbMPYB4Z.js} +1 -1
  123. package/dist/client/assets/{empty-state-BFLQtSFV.js → empty-state-DF9St1T6.js} +1 -1
  124. package/dist/client/assets/{empty-state-DLrHPsXZ.js → empty-state-ovRL7NEK.js} +1 -1
  125. package/dist/client/assets/experiments-tab-choice-BXlwzycK.js +1 -0
  126. package/dist/client/assets/{extract-connection-data-KiTWYSx4.js → extract-connection-data-Q1k0ncm3.js} +1 -1
  127. package/dist/client/assets/{feature-gate-C27q-aIj.js → feature-gate-DKF86Lcy.js} +1 -1
  128. package/dist/client/assets/{feature-paywall-CJwXTzME.js → feature-paywall-BoU9TII8.js} +1 -1
  129. package/dist/client/assets/{feedback-zQMybfa1.js → feedback-f3MT17uD.js} +1 -1
  130. package/dist/client/assets/{file-explorer-C_MMeMcX.js → file-explorer-DmvPCizi.js} +2 -2
  131. package/dist/client/assets/{file-preview-F9XVmctL.js → file-preview-aD0sVwV5.js} +1 -1
  132. package/dist/client/assets/{file-share-button-A6RgU4RK.js → file-share-button-agT85qGG.js} +2 -2
  133. package/dist/client/assets/{file-type-icon-DoyEf2kQ.js → file-type-icon-CflTIvHJ.js} +1 -1
  134. package/dist/client/assets/{folder-icon-CsH9NIDq.js → folder-icon-BKhbsJwX.js} +1 -1
  135. package/dist/client/assets/{form-cx1UDyF2.js → form-B_3ZthF3.js} +1 -1
  136. package/dist/client/assets/{general-YmXk3hPt.js → general-BdjsCK2j.js} +1 -1
  137. package/dist/client/assets/{github-icon-DNe7j1PY.js → github-icon-M-2WiP3Y.js} +1 -1
  138. package/dist/client/assets/home-dTYjLEfm.js +1 -0
  139. package/dist/client/assets/{home-overview-CFwm7iMO.js → home-overview-BAVfF6qS.js} +1 -1
  140. package/dist/client/assets/hosted-reconcile-B3o4dv7j.js +1 -0
  141. package/dist/client/assets/{icon-button-CmFwjZ_m.js → icon-button-DQuPTgIB.js} +1 -1
  142. package/dist/client/assets/{index-BmYeIRlv.js → index-0kopV6YP.js} +2 -2
  143. package/dist/client/assets/{index-DM3inxPC.js → index-2bmOBUEF.js} +1 -1
  144. package/dist/client/assets/{index-C9A_N0M0.js → index-BM0DSfBG.js} +1 -1
  145. package/dist/client/assets/{index-DGn-FPge.js → index-BZX-7ipZ.js} +45 -45
  146. package/dist/client/assets/index-BlTJ0I-U.js +4 -0
  147. package/dist/client/assets/{index-BCXxtUlh.js → index-BvJNHE6H.js} +6 -6
  148. package/dist/client/assets/{index-ffdfMTh-.js → index-C2-s3ia2.js} +1 -1
  149. package/dist/client/assets/{index-CN8uFy5p.js → index-C81DBcO6.js} +1 -1
  150. package/dist/client/assets/{index-DisXhcWe.js → index-Cjc_aSrk.js} +1 -1
  151. package/dist/client/assets/{index-B5lnCLuB.js → index-D7Mi9FGh.js} +1 -1
  152. package/dist/client/assets/{index-qMWmRmW0.js → index-DHMhIfTt.js} +1 -1
  153. package/dist/client/assets/{index-WwIqmvy-.js → index-DT3lYd1R.js} +1 -1
  154. package/dist/client/assets/{index-hZylT09v.js → index-DzmcFP3y.js} +1 -1
  155. package/dist/client/assets/index-SmuiYnIl.css +1 -0
  156. package/dist/client/assets/{index-DuD6FLZ3.js → index-cmF_qGuq.js} +1 -1
  157. package/dist/client/assets/{index-CmGLs6T5.js → index-iezPx7cK.js} +1 -1
  158. package/dist/client/assets/index-mtR249ru.js +1 -0
  159. package/dist/client/assets/{index-redirect-eX7nEWSl.js → index-redirect-ay83YA5a.js} +1 -1
  160. package/dist/client/assets/{infiniteQueryObserver-B_P9W4Zx.js → infiniteQueryObserver-CQGSlzKO.js} +1 -1
  161. package/dist/client/assets/{infra-billing-BatrrG1f.js → infra-billing-DUjivW_p.js} +1 -1
  162. package/dist/client/assets/{input-BEManHLB.js → input-3OyhKW_c.js} +1 -1
  163. package/dist/client/assets/input-CcFFY__7.js +17 -0
  164. package/dist/client/assets/{integration-icon-BHx1ytyX.js → integration-icon-Btk7lWbK.js} +1 -1
  165. package/dist/client/assets/{jira-icon-DQhFl4az.js → jira-icon-TeK8CaRV.js} +1 -1
  166. package/dist/client/assets/{label-CHRzCbuP.js → label-BGCn7A0y.js} +1 -1
  167. package/dist/client/assets/{layout-CvFeIpHB.js → layout-XVKa9Y6f.js} +1 -1
  168. package/dist/client/assets/{legacy-agents-deep-B-RkQsR1.js → legacy-agents-deep-DksTbOzF.js} +1 -1
  169. package/dist/client/assets/{legacy-main-redirect-f_YEwDUU.js → legacy-main-redirect-8kA2UC85.js} +1 -1
  170. package/dist/client/assets/library-O1-Gs4qz.js +1 -0
  171. package/dist/client/assets/{library-tab-DrpEkybg.js → library-tab-DJKD7rUC.js} +3 -3
  172. package/dist/client/assets/{login-DtH52R3F.js → login-CH5yud2M.js} +1 -1
  173. package/dist/client/assets/{markdown-C7Kie5ev.js → markdown-B6eeRWQb.js} +1 -1
  174. package/dist/client/assets/{mcp-app-renderer-CO8LOFxq.js → mcp-app-renderer-DwuRGgZk.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-iB4K_uoY.js → mcp-oauth-BvqIKSqR.js} +1 -1
  176. package/dist/client/assets/{mcp-oauth-C-mc4e6m.js → mcp-oauth-Bz1Lo9Pk.js} +1 -1
  177. package/dist/client/assets/{members-yfLvIIIT.js → members-FYjquUkN.js} +1 -1
  178. package/dist/client/assets/{memory-aeBofHaH.js → memory-CoUl94G3.js} +1 -1
  179. package/dist/client/assets/{mock-board-B5SFWfb2.js → mock-board-DvOE8ZQh.js} +4 -4
  180. package/dist/client/assets/{monaco-editor-BRY87vsh.js → monaco-editor-vUgphdkE.js} +1 -1
  181. package/dist/client/assets/monitoring-UUQquQf7.js +2 -0
  182. package/dist/client/assets/{monitoring-stats-row-DZcqSbnv.js → monitoring-stats-row-BY92i-Bt.js} +1 -1
  183. package/dist/client/assets/{multi-select-C-iHSsuJ.js → multi-select-9ieJQPsD.js} +1 -1
  184. package/dist/client/assets/mustache-CgF6ozKS.js +4 -0
  185. package/dist/client/assets/named-rule-view-CdhLqAy7.js +1 -0
  186. package/dist/client/assets/{new-project-dialog-UvI58my0.js → new-project-dialog-EK9WMEhp.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-Bg-Twulk.js → oauth-callback-Cuv6PAYs.js} +1 -1
  188. package/dist/client/assets/{oauth-callback-ai-provider-CuXrUeR4.js → oauth-callback-ai-provider-BGc97raN.js} +1 -1
  189. package/dist/client/assets/{oauth-consent-BdD4CLIL.js → oauth-consent-fGbsmdGY.js} +1 -1
  190. package/dist/client/assets/{onboarding-DAlZ_ijb.js → onboarding-DF5AGUdi.js} +1 -1
  191. package/dist/client/assets/openai-conversation-CMIme_Ur.js +3 -0
  192. package/dist/client/assets/{optimistic-project-sidebar-views-uJohOkF6.js → optimistic-project-sidebar-views-mQ0HUqGi.js} +1 -1
  193. package/dist/client/assets/{order-monitor-day-BIbj8jXM.js → order-monitor-day-BPx4Aihv.js} +1 -1
  194. package/dist/client/assets/{organization-choice-9Sf7qdAX.js → organization-choice-KNGQur5O.js} +1 -1
  195. package/dist/client/assets/{orgs-DuQRavym.js → orgs-C5Zlwg3I.js} +1 -1
  196. package/dist/client/assets/{own-accounts-section-n50adHNX.js → own-accounts-section-C_F0-lzr.js} +1 -1
  197. package/dist/client/assets/{pair-1hov1KDD.js → pair-C5KKQk8r.js} +7 -7
  198. package/dist/client/assets/{parse-sections-BNf6_EjY.js → parse-sections-DE2O_vev.js} +7 -7
  199. package/dist/client/assets/{plan-Dq5q5bsx.js → plan-DdvgvWt2.js} +1 -1
  200. package/dist/client/assets/{plan-ladder-DJg9yABt.js → plan-ladder-BQ0gcfdF.js} +1 -1
  201. package/dist/client/assets/{plan-usage-card-D4SynKK4.js → plan-usage-card-8-3zMqsW.js} +2 -2
  202. package/dist/client/assets/{popover-CE0A3Qit.js → popover-CkuSZicN.js} +1 -1
  203. package/dist/client/assets/post-calendar-DVrcXuZq.js +1 -0
  204. package/dist/client/assets/{post-editor-CeOdXCzo.js → post-editor-CG6NXsGN.js} +2 -2
  205. package/dist/client/assets/{preview-content-CyH9JuG-.js → preview-content-xRBU7B3O.js} +1 -1
  206. package/dist/client/assets/{preview-dialog-FVFjchHr.js → preview-dialog-D36kXBk6.js} +1 -1
  207. package/dist/client/assets/{preview-panel-eL-KdUlb.js → preview-panel-Cp7F1lqp.js} +1 -1
  208. package/dist/client/assets/preview-tab-Dn0RGnhj.js +551 -0
  209. package/dist/client/assets/{product-picker-dialog-oaL2Geio.js → product-picker-dialog-C2KLekZA.js} +1 -1
  210. package/dist/client/assets/{profile-DhXoBixo.js → profile-BfDfzRPA.js} +1 -1
  211. package/dist/client/assets/project-app-view-DVhAuH9N.js +1 -0
  212. package/dist/client/assets/project-apps-D47w7eJj.js +1 -0
  213. package/dist/client/assets/{project-icon-reyc_nNY.js → project-icon-ofE-LDok.js} +1 -1
  214. package/dist/client/assets/{project-index-CeS8PQv7.js → project-index-PpuyCKHe.js} +1 -1
  215. package/dist/client/assets/project-reports-BuJS86vH.js +1 -0
  216. package/dist/client/assets/project-sidebar-views-Dew_3OKS.js +1 -0
  217. package/dist/client/assets/project-tasks-CZtVWSYo.js +1 -0
  218. package/dist/client/assets/{projects-QRnnQxmB.js → projects-Be7d593_.js} +1 -1
  219. package/dist/client/assets/{projects-empty-state-B2R3HC7E.js → projects-empty-state-DpmH0sch.js} +1 -1
  220. package/dist/client/assets/{prompts-Cp6YboL1.js → prompts-ClmMS_OK.js} +1 -1
  221. package/dist/client/assets/record-editor-OoLxSu9R.js +1 -0
  222. package/dist/client/assets/redirect-editor-W9B4A_h8.js +1 -0
  223. package/dist/client/assets/{reports-BtW4mY0K.js → reports-DCsJlho1.js} +1 -1
  224. package/dist/client/assets/{reports-onboarding-CtEi6opy.js → reports-onboarding-CMTzWUTp.js} +1 -1
  225. package/dist/client/assets/reports-s2E9cwFc.js +1 -0
  226. package/dist/client/assets/{reports-tab-DhrTVeTc.js → reports-tab-BKnG1JmX.js} +2 -2
  227. package/dist/client/assets/repositories-Dj2kaTIN.js +1 -0
  228. package/dist/client/assets/{repositories-CGGnfQiR.js → repositories-KlUH4dUR.js} +1 -1
  229. package/dist/client/assets/{repository-binding-DHN5ihZA.js → repository-binding-CqOunspI.js} +1 -1
  230. package/dist/client/assets/{repository-picker-BVa6TfGc.js → repository-picker-DNdEQtlZ.js} +1 -1
  231. package/dist/client/assets/{require-capability-CVoJcu7H.js → require-capability-RYn3iksk.js} +1 -1
  232. package/dist/client/assets/{required-auth-layout-BQmhUScr.js → required-auth-layout-Dfyc4Zas.js} +1 -1
  233. package/dist/client/assets/{reset-password-BLOlZYb5.js → reset-password-CTGJ7V-t.js} +1 -1
  234. package/dist/client/assets/{resizable-CdFCM71r.js → resizable-BCGqPRic.js} +1 -1
  235. package/dist/client/assets/resolve-tab-icon-BnqDq-fY.js +1 -0
  236. package/dist/client/assets/{review-settings-Deyxg2o8.js → review-settings-DvoYyrmi.js} +1 -1
  237. package/dist/client/assets/{role-color-DfmSCdD1.js → role-color-cUMHSMVi.js} +1 -1
  238. package/dist/client/assets/{roles-DGxZsr14.js → roles-x3B4vLKU.js} +1 -1
  239. package/dist/client/assets/route-PbputQp9.js +1 -0
  240. package/dist/client/assets/route-h-Fc_oVe.js +1 -0
  241. package/dist/client/assets/route-wINBwrny.js +1 -0
  242. package/dist/client/assets/sandbox-lifecycle-context-CXwLCWvJ.js +1 -0
  243. package/dist/client/assets/{schema-C2e4bOOh.js → schema-C1bLOk3P.js} +1 -1
  244. package/dist/client/assets/{schema-77LyfVRl.js → schema-DHLwjAWR.js} +1 -1
  245. package/dist/client/assets/{scroll-area-DOPuQKg_.js → scroll-area-rELMi4e6.js} +1 -1
  246. package/dist/client/assets/{search-input-Bo9D0b2l.js → search-input-Crult1Qo.js} +1 -1
  247. package/dist/client/assets/{search-toggle-D227Ek9d.js → search-toggle-DzMf9QP4.js} +1 -1
  248. package/dist/client/assets/{secret-picker-ChOT2LaB.js → secret-picker-CimF9dsx.js} +1 -1
  249. package/dist/client/assets/{secrets-TvEnuoeS.js → secrets-CZCnF6s4.js} +1 -1
  250. package/dist/client/assets/section-array-field-C3Tpx16b.js +1 -0
  251. package/dist/client/assets/{sections-tdmo3LjO.js → sections-346PcP2T.js} +1 -1
  252. package/dist/client/assets/sections-editor-DwV32_3f.js +1 -0
  253. package/dist/client/assets/{select-Di2sLm_-.js → select-CwDmbwEv.js} +1 -1
  254. package/dist/client/assets/{select-model-Do4joh93.js → select-model-B1ocDBwF.js} +1 -1
  255. package/dist/client/assets/seo-editor-D1gGpMMF.js +1 -0
  256. package/dist/client/assets/{separator-Bu1wQRuA.js → separator-C05SxAdn.js} +1 -1
  257. package/dist/client/assets/settings-tab-BImv5HgS.js +1 -0
  258. package/dist/client/assets/{sheet-pl7zdRHn.js → sheet-BYgfxL9i.js} +1 -1
  259. package/dist/client/assets/{shell-layout-DzQA4K-b.js → shell-layout-BvJfyzsq.js} +1 -1
  260. package/dist/client/assets/site-draft-actions-CgeV78uL.js +3 -0
  261. package/dist/client/assets/site-draft-view-Dkq2XweK.js +1 -0
  262. package/dist/client/assets/site-editor-B9ARkCiN.js +1 -0
  263. package/dist/client/assets/site-editor-toast-D83gMpdg.js +1 -0
  264. package/dist/client/assets/{skills-Bh5rPXC6.js → skills-OVV2oEwU.js} +1 -1
  265. package/dist/client/assets/{slider-CwE675ao.js → slider-Ipy9G5jv.js} +1 -1
  266. package/dist/client/assets/{sortable.esm-CIP-w8Te.js → sortable.esm-DgwAq-fn.js} +1 -1
  267. package/dist/client/assets/{sso-DpryG3cU.js → sso-C9cutlah.js} +1 -1
  268. package/dist/client/assets/{suggestion-Dr321Cmr.js → suggestion-Dwy6qysF.js} +1 -1
  269. package/dist/client/assets/{switch-D-6AqAnT.js → switch-BLkpF22m.js} +1 -1
  270. package/dist/client/assets/{synced-repos-CwCJZfKG.js → synced-repos-orJHnVxs.js} +1 -1
  271. package/dist/client/assets/{tab-icon-glyph-CMWJQvgX.js → tab-icon-glyph-Co1M723I.js} +1 -1
  272. package/dist/client/assets/{table-DpJo1vAx.js → table-DPFxRA7S.js} +1 -1
  273. package/dist/client/assets/{tabs-DNziA2dZ.js → tabs--wmPR0cZ.js} +1 -1
  274. package/dist/client/assets/{task-board-BuKyXp11.js → task-board-DJtwkz3O.js} +1 -1
  275. package/dist/client/assets/{task-route-DlvmNWcQ.js → task-route-vCMrJPp9.js} +1 -1
  276. package/dist/client/assets/{task-status-B4eBo5Md.js → task-status-msgu5x2s.js} +1 -1
  277. package/dist/client/assets/{taskboard-analytics-C-zvSFMs.js → taskboard-analytics-5nxg7YXN.js} +1 -1
  278. package/dist/client/assets/{tasks-BHN9oqEC.js → tasks-DpWVcTLT.js} +1 -1
  279. package/dist/client/assets/tasks-hbXv3hSd.js +1 -0
  280. package/dist/client/assets/{textarea-HAezEU3R.js → textarea-D5OF_Tld.js} +1 -1
  281. package/dist/client/assets/{thread-analytics-DWnZrs9k.js → thread-analytics-CVsji2MZ.js} +1 -1
  282. package/dist/client/assets/{thread-intent-C084ju5m.js → thread-intent-DIce2mks.js} +2 -2
  283. package/dist/client/assets/{thread-route-C-GRt_yL.js → thread-route-CGqDFJ1K.js} +1 -1
  284. package/dist/client/assets/{thread-route-Dt42HUQv.js → thread-route-CP2TR6nw.js} +1 -1
  285. package/dist/client/assets/{thread-sheet-body-Ck1Bv0_3.js → thread-sheet-body-Cba15kJF.js} +1 -1
  286. package/dist/client/assets/{time-range-picker-CS9tika7.js → time-range-picker-OdWLHy9U.js} +1 -1
  287. package/dist/client/assets/{toggle-group-CFojpTQB.js → toggle-group-DbLOGwe7.js} +1 -1
  288. package/dist/client/assets/{tool-namespace-Fc2c0QC4.js → tool-namespace-BQhkJpu9.js} +1 -1
  289. package/dist/client/assets/{tool-set-selector-B8ePlhyl.js → tool-set-selector-BmAnaEsw.js} +1 -1
  290. package/dist/client/assets/{toolbar-icon-button-GjI5vOKF.js → toolbar-icon-button-BzIcnxXk.js} +1 -1
  291. package/dist/client/assets/{tooltip-BojzNY2M.js → tooltip--uPFG1gb.js} +1 -1
  292. package/dist/client/assets/{tooltipContext-m-9QMOrS.js → tooltipContext-C8ArdkXW.js} +1 -1
  293. package/dist/client/assets/{track-Bclp3q8c.js → track-Bb4064-s.js} +1 -1
  294. package/dist/client/assets/{types-CdXMwNZg.js → types-EjHtXl5u.js} +1 -1
  295. package/dist/client/assets/{url-slug-BkV5QJiU.js → url-slug-rCJqhuIp.js} +1 -1
  296. package/dist/client/assets/{usage-stats-B39QZ3Cn.js → usage-stats-DaOtdhEm.js} +2 -2
  297. package/dist/client/assets/{use-ai-providers-hjEpjXQ2.js → use-ai-providers-C5rCFpU_.js} +1 -1
  298. package/dist/client/assets/{use-apply-named-rule-vuCkiknA.js → use-apply-named-rule-zZmpVvRd.js} +1 -1
  299. package/dist/client/assets/use-ask-in-chat-BaG9i0zc.js +1 -0
  300. package/dist/client/assets/{use-automations-DJWCjg8T.js → use-automations-CI7vvUzE.js} +1 -1
  301. package/dist/client/assets/{use-autosave-DzjuxKy7.js → use-autosave-DUBcsRSH.js} +1 -1
  302. package/dist/client/assets/use-blocks-v8-project-CXrKL60y.js +1 -0
  303. package/dist/client/assets/{use-chat-layout-state-DGf4-J1Z.js → use-chat-layout-state-CZaSk8YF.js} +1 -1
  304. package/dist/client/assets/{use-cms-publish-actions-JZTNoXFa.js → use-cms-publish-actions-BV2nwL3g.js} +5 -5
  305. package/dist/client/assets/{use-connect-companion-DZPybU6m.js → use-connect-companion-DC6UOpxV.js} +1 -1
  306. package/dist/client/assets/{use-connection-BonBiP4H.js → use-connection-BEb786wf.js} +1 -1
  307. package/dist/client/assets/{use-content-sync-C-LYfyy7.js → use-content-sync-CtHfpBJp.js} +1 -1
  308. package/dist/client/assets/{use-copy-1IxNCkh9.js → use-copy-DccRTYvG.js} +1 -1
  309. package/dist/client/assets/{use-date-fns-locale-KQxxLRHa.js → use-date-fns-locale-DD1YxYKP.js} +1 -1
  310. package/dist/client/assets/{use-debounced-autosave-Eo1C-w5U.js → use-debounced-autosave-clO2CzWE.js} +1 -1
  311. package/dist/client/assets/{use-debounced-value-CzxhSP8l.js → use-debounced-value-CJpdUTvG.js} +1 -1
  312. package/dist/client/assets/{use-deco-credits-CEMj3JGY.js → use-deco-credits-DtE2LNZs.js} +1 -1
  313. package/dist/client/assets/{use-decopilot-events-CTD6ZdaA.js → use-decopilot-events-DxBT3zOC.js} +1 -1
  314. package/dist/client/assets/{use-delete-connection-CKqCkN-k.js → use-delete-connection-COvFjvtJ.js} +1 -1
  315. package/dist/client/assets/{use-deployment-admin-BCIDPeyj.js → use-deployment-admin-BSEuekHe.js} +1 -1
  316. package/dist/client/assets/{use-entitlements-DxVD_uCH.js → use-entitlements-CWXMyUT0.js} +1 -1
  317. package/dist/client/assets/use-fast-preview-draft-url-BCmBxVQg.js +1 -0
  318. package/dist/client/assets/{use-file-configs-D87qhE2e.js → use-file-configs-DsyBYIJw.js} +1 -1
  319. package/dist/client/assets/{use-id-selection-FN7gA0OQ.js → use-id-selection-6CmUdc1s.js} +1 -1
  320. package/dist/client/assets/{use-inbox-feed-DglRSmH4.js → use-inbox-feed-okLCp4Pp.js} +1 -1
  321. package/dist/client/assets/{use-infinite-scroll-4LyFv3hi.js → use-infinite-scroll-4e7tB3Vz.js} +1 -1
  322. package/dist/client/assets/{use-join-requests-czJryNA9.js → use-join-requests-muPMmn0O.js} +1 -1
  323. package/dist/client/assets/use-main-panel-tabs-BcP_qZl8.js +1 -0
  324. package/dist/client/assets/use-mcp-auth-status-D_TqnxnH.js +1 -0
  325. package/dist/client/assets/{use-mcp-client-BeYM-3mp.js → use-mcp-client-CrdyqnFt.js} +1 -1
  326. package/dist/client/assets/{use-mcp-prompts-IjFHP0w8.js → use-mcp-prompts-C3SHzM_d.js} +1 -1
  327. package/dist/client/assets/{use-mcp-tools-Bi0gClZp.js → use-mcp-tools-DQIJMlw-.js} +1 -1
  328. package/dist/client/assets/{use-mobile-D6y1UaCv.js → use-mobile-BDWitdax.js} +1 -1
  329. package/dist/client/assets/use-move-blocks-B48xFUbp.js +1 -0
  330. package/dist/client/assets/{use-navigate-to-agent-DP0a6y9z.js → use-navigate-to-agent-C3sX18jI.js} +1 -1
  331. package/dist/client/assets/{use-org-fs-CfPaWD_N.js → use-org-fs-BRERSVus.js} +1 -1
  332. package/dist/client/assets/{use-org-repo-syncs-TOw0XlBk.js → use-org-repo-syncs-BFFdo3jR.js} +1 -1
  333. package/dist/client/assets/{use-org-sso-BK0CtdSD.js → use-org-sso-BHDTii7j.js} +1 -1
  334. package/dist/client/assets/{use-organization-settings--v2ov5jL.js → use-organization-settings-DPCrcu8e.js} +1 -1
  335. package/dist/client/assets/{use-project-scope-BJA0ds2S.js → use-project-scope-k7OaKjIm.js} +1 -1
  336. package/dist/client/assets/{use-recent-apps--67lnzqC.js → use-recent-apps-Buo9cWvj.js} +1 -1
  337. package/dist/client/assets/{use-reports-diagnostic-81WxcUY9.js → use-reports-diagnostic-B1lbI319.js} +1 -1
  338. package/dist/client/assets/use-sandbox-events-BRJYKM54.js +2 -0
  339. package/dist/client/assets/{use-secrets-DEeK7thW.js → use-secrets-DlNiP0j4.js} +1 -1
  340. package/dist/client/assets/use-section-preview-base-CL9U3MEc.js +1 -0
  341. package/dist/client/assets/use-sidebar-collapsed-ByMTBVZc.js +1 -0
  342. package/dist/client/assets/{use-tags-DEr2TlgW.js → use-tags-CcJayzHf.js} +1 -1
  343. package/dist/client/assets/{use-task-board-analytics-DxH9-ih7.js → use-task-board-analytics-0-6_3j_2.js} +1 -1
  344. package/dist/client/assets/{use-task-board-events-BZToXVGj.js → use-task-board-events-CzDIUBok.js} +1 -1
  345. package/dist/client/assets/{use-task-board-item-prs-B2japofE.js → use-task-board-item-prs-DbHC-4Ry.js} +1 -1
  346. package/dist/client/assets/{use-task-board-items-Puwxrpek.js → use-task-board-items-COxHF7_K.js} +1 -1
  347. package/dist/client/assets/{use-task-board-prompts-C5iC-R_g.js → use-task-board-prompts-CKi9j8wF.js} +1 -1
  348. package/dist/client/assets/{use-task-metadata-jDPe6d5C.js → use-task-metadata-BxcNhivS.js} +1 -1
  349. package/dist/client/assets/{use-thread-outputs-DnX9RgWT.js → use-thread-outputs-lMVF4bT2.js} +1 -1
  350. package/dist/client/assets/use-voice-input-DsJxHyTh.js +1 -0
  351. package/dist/client/assets/useInfiniteQuery-B313haH3.js +1 -0
  352. package/dist/client/assets/{useQueries-BbqzFtkh.js → useQueries-BO8pZ9q-.js} +1 -1
  353. package/dist/client/assets/useSuspenseInfiniteQuery-07GrICuv.js +1 -0
  354. package/dist/client/assets/{users-DFMP_wOE.js → users-DCPPe9Uo.js} +1 -1
  355. package/dist/client/assets/{utils-BU-nucb-.js → utils-D0xixM8q.js} +3 -3
  356. package/dist/client/assets/{variant-calendar-DKhL8Mk2.js → variant-calendar-C5r0ak32.js} +1 -1
  357. package/dist/client/assets/{variant-matcher-override-CgElSjwL.js → variant-matcher-override-QQd3tA7f.js} +1 -1
  358. package/dist/client/assets/{view-header-i70JKW9C.js → view-header-BPAnt0vh.js} +1 -1
  359. package/dist/client/assets/{virtual-mcp-CsY6ukOa.js → virtual-mcp-Dzr3mFmO.js} +1 -1
  360. package/dist/client/assets/{watch-sse-pool-D3b7K3Uo.js → watch-sse-pool-j0K-nQ0i.js} +1 -1
  361. package/dist/client/index.html +2 -2
  362. package/dist/server/server.js +464 -464
  363. package/package.json +1 -1
  364. package/dist/client/assets/ReferenceLine-DfxOOnGv.js +0 -1
  365. package/dist/client/assets/agent-app-Djt3nisA.js +0 -1
  366. package/dist/client/assets/agent-assets-BytEk-0l.js +0 -1
  367. package/dist/client/assets/agent-calendar-BaUCHDte.js +0 -1
  368. package/dist/client/assets/agent-capabilities-DUEnZmC-.js +0 -1
  369. package/dist/client/assets/agent-deck-BZptRfb2.js +0 -1
  370. package/dist/client/assets/agent-e2e-CN8oCbtP.js +0 -1
  371. package/dist/client/assets/agent-file-C58LYJBC.js +0 -1
  372. package/dist/client/assets/agent-hosting-C-Xgv5CR.js +0 -1
  373. package/dist/client/assets/agent-library-CxsAEqgy.js +0 -1
  374. package/dist/client/assets/agent-library-file-BfEsr2cm.js +0 -1
  375. package/dist/client/assets/agent-overview-yBV3P4Kd.js +0 -1
  376. package/dist/client/assets/agent-releases-DXvHySgn.js +0 -2
  377. package/dist/client/assets/agent-settings-C7JVa4hp.js +0 -1
  378. package/dist/client/assets/agent-site-editor-code-0Rkb_Rlf.js +0 -2
  379. package/dist/client/assets/agent-site-editor-content-CKdTDsIv.js +0 -1
  380. package/dist/client/assets/agent-site-editor-preview-DY2uCsMf.js +0 -1
  381. package/dist/client/assets/agent-view-CMZiQIOU.js +0 -1
  382. package/dist/client/assets/api-keys-DzWt-NPK.js +0 -1
  383. package/dist/client/assets/app-editor-CoHcQkjL.js +0 -1
  384. package/dist/client/assets/blocks-tab-states-Oy4QesXy.js +0 -1
  385. package/dist/client/assets/category-editor-BuIyetQS.js +0 -1
  386. package/dist/client/assets/cms-settings-editor-T8KTji6O.js +0 -1
  387. package/dist/client/assets/cms-store-drafts-49wrBNXT.js +0 -1
  388. package/dist/client/assets/context-CUmhz6yH.js +0 -1
  389. package/dist/client/assets/device-hint-DHQmntIa.js +0 -1
  390. package/dist/client/assets/home-DgapTseA.js +0 -1
  391. package/dist/client/assets/hosted-reconcile-BJXH2g7a.js +0 -1
  392. package/dist/client/assets/index-CxEOaGFH.js +0 -2
  393. package/dist/client/assets/index-D5uF1VH5.js +0 -4
  394. package/dist/client/assets/index-ug7KC70Z.css +0 -1
  395. package/dist/client/assets/input-Di6BJ4Zo.js +0 -17
  396. package/dist/client/assets/library-DQMyWPTm.js +0 -1
  397. package/dist/client/assets/monitoring-WRX4s2Md.js +0 -2
  398. package/dist/client/assets/mustache-WHgo2S29.js +0 -4
  399. package/dist/client/assets/named-rule-view-ChTlMWf5.js +0 -1
  400. package/dist/client/assets/openai-conversation-DChbcEJV.js +0 -3
  401. package/dist/client/assets/post-calendar-EtCAYSiT.js +0 -1
  402. package/dist/client/assets/preview-tab-Cuhy4gb6.js +0 -551
  403. package/dist/client/assets/project-app-view-CFDNRbPF.js +0 -1
  404. package/dist/client/assets/project-apps-B-5TAX2o.js +0 -1
  405. package/dist/client/assets/project-reports-DxSY0pyo.js +0 -1
  406. package/dist/client/assets/project-sidebar-views-DYKp64W4.js +0 -1
  407. package/dist/client/assets/project-tasks-joh7axEQ.js +0 -1
  408. package/dist/client/assets/record-editor-DzEJNlA8.js +0 -1
  409. package/dist/client/assets/redirect-editor-Bf8VmZQx.js +0 -1
  410. package/dist/client/assets/reports-5kgLKYGo.js +0 -1
  411. package/dist/client/assets/repositories-D0xZPdow.js +0 -1
  412. package/dist/client/assets/resolve-tab-icon-DJ5Ncrbw.js +0 -1
  413. package/dist/client/assets/route-C6jiJ2GR.js +0 -1
  414. package/dist/client/assets/route-Cf6qLb88.js +0 -1
  415. package/dist/client/assets/route-Dq3q8mSL.js +0 -1
  416. package/dist/client/assets/sandbox-lifecycle-context-Dp2Dt1TA.js +0 -1
  417. package/dist/client/assets/sections-editor-C7sTzFTf.js +0 -1
  418. package/dist/client/assets/seo-editor-BK7SzGFy.js +0 -1
  419. package/dist/client/assets/settings-tab-B2_rrm2f.js +0 -1
  420. package/dist/client/assets/site-draft-view-Ca1ao55E.js +0 -3
  421. package/dist/client/assets/site-editor-DR8x2KPW.js +0 -1
  422. package/dist/client/assets/site-editor-toast-BUVxT4JG.js +0 -1
  423. package/dist/client/assets/tasks-DqD-0E5O.js +0 -1
  424. package/dist/client/assets/use-ask-in-chat-oQGHyTZE.js +0 -1
  425. package/dist/client/assets/use-fast-preview-draft-url-o_WDZuY-.js +0 -1
  426. package/dist/client/assets/use-main-panel-tabs-BeQ-NkWh.js +0 -1
  427. package/dist/client/assets/use-mcp-auth-status-_QM-6kc-.js +0 -1
  428. package/dist/client/assets/use-move-blocks-DItjAQsv.js +0 -1
  429. package/dist/client/assets/use-section-preview-base-BO-qsUKf.js +0 -1
  430. package/dist/client/assets/use-sidebar-collapsed-DuLHdlSz.js +0 -1
  431. package/dist/client/assets/useInfiniteQuery-CCkoNUSG.js +0 -1
  432. package/dist/client/assets/useSuspenseInfiniteQuery-CDBL11js.js +0 -1
@@ -1,3 +0,0 @@
1
- import{c as T,b as me,r as H,j as a,B as ve,m as q,K as ns,al as Ca,t as Ze,fd as Aa,as as dr,ed as ur,Y as Zt,c6 as Ra,aH as ks,aI as Ns,aJ as Cs,aK as As,bj as Rs,aL as Ds,aM as Ts,aN as Bs,X as Os,Z as Ms,_ as _s,a as zs,a5 as rs,ct as Da,h as es,ff as hr,fg as un,bJ as Ta,b8 as Ba,bh as _n,fh as Ia,c0 as Fa,am as $a,I as La,a8 as Ea,fi as Oa,V as fr,i as ht,eR as hn,q as mr,J as pr,D as br,x as gr,v as xr,Q as vr,R as yr,fj as Ma,bk as jr,a6 as fn,b3 as mn,e as zn,E as _a,T as za,n as Xs,bi as Ua}from"./index-DGn-FPge.js";import{S as Ha}from"./separator-Bu1wQRuA.js";import{f as qa,u as It,r as wr,l as Pr,c as Sr,b as Ka}from"./chat-context-GsXpI-Rk.js";import{u as St,aq as Va,ar as kr,as as Nr,c as pn,b as bn,L as gn,at as Ga,K as Wa,au as Qa,ae as Ja,av as Xa,S as xn,R as Cr,aw as Ya,a0 as Ar,F as Za,ax as el,ay as tl,B as Rr,l as sl,E as nl}from"./site-editor-toast-BUVxT4JG.js";import{b as rl,L as al,a as ll}from"./shell-layout-DzQA4K-b.js";import{I as Dr}from"./toolbar-icon-button-GjI5vOKF.js";import{b as il,P as ol,a as cl}from"./popover-CE0A3Qit.js";import{c as et,T as tt,a as st,b as Us}from"./tooltip-BojzNY2M.js";import{f as dl,a as ul,c as hl,C as Un,e as Hn,b as qn}from"./command-D1ggU7uN.js";import{T as Tt,a as Tr,c as Br}from"./tabs-DNziA2dZ.js";import{t as Ir}from"./ChevronUp-BCfBdjs4.js";import{X as Fr,aL as Hs,D as fl,a as $r,aM as ml,b as pl,aN as Lr,K as bl}from"./agent-icon-FkFyvRCX.js";import{a as Er}from"./SwitchHorizontal01-D2vRhNhF.js";import{c as Or,s as Is}from"./Tool01-B8q2F7hW.js";import{s as Mr}from"./Plus-BhRQRaas.js";import{s as qs}from"./Trash01-Ccl1EX2p.js";import{m as gl,d as xl}from"./thread-intent-C084ju5m.js";import{h as _r,r as zr,g as vl,e as Oe,u as Ks,f as Ur}from"./repository-binding-DHN5ihZA.js";import{u as yl}from"./use-debounced-value-CzxhSP8l.js";import{u as jl}from"./useInfiniteQuery-CCkoNUSG.js";import{d as wl,b as Pl,p as Sl,e as Hr,g as qr,h as Kr}from"./use-navigate-to-agent-DP0a6y9z.js";import{u as Vs,g as vn,n as us,b as Vr,a as kl,d as Nl,e as Cl,r as ds,f as Al,s as Rl,h as xs,c as yn}from"./cms-store-drafts-49wrBNXT.js";import{a as Fs}from"./virtual-mcp-CsY6ukOa.js";import{a as fs}from"./input-Di6BJ4Zo.js";import{u as jn,c as Dl}from"./agent-capabilities-DUEnZmC-.js";import{G as Gr}from"./github-icon-DNe7j1PY.js";import{u as Tl,a as Bl}from"./use-fast-preview-draft-url-o_WDZuY-.js";import{av as Xt,aw as Wr,E as $s,q as wn,ax as Il,ay as Fl,H as $l,az as Ll,aA as El,aB as Ol,p as Ml,z as wt,f as Pn,aC as _l,$ as zl,i as Ul,u as Hl,k as ql,S as Kl}from"./blocks-tab-states-Oy4QesXy.js";import{u as Vl}from"./index-CxEOaGFH.js";import{T as Gl}from"./textarea-HAezEU3R.js";import{i as Sn}from"./CheckCircle-By2z0uOx.js";import{n as Wl,s as Ql,C as Jl,a as Xl,b as Yl,M as Zl,c as ei,d as ti,m as si,u as ni}from"./use-cms-publish-actions-JZTNoXFa.js";import{a as ri,g as ai}from"./UserSquare-Cbfe91aH.js";import{i as kn,b as Nn,m as li,h as ii,c as Qr,f as Jr,d as oi,r as Cn,e as ci,n as di,g as ui,j as hi,k as fi,l as An,o as mi,p as Xr,q as pi,s as Rn,t as Ys}from"./sandbox-git-api-DcqI6XE4.js";import{b as bi,g as gi}from"./utils-BU-nucb-.js";import{i as xi}from"./Monitor01-DcAryzmn.js";import{w as Dn,R as Yr}from"./device-hint-DHQmntIa.js";import{w as Kn}from"./editor-zE4VnGLI.js";import{s as Zr}from"./save-changes-debug-nBi-n9eV.js";import{u as vi}from"./use-mcp-client-BeYM-3mp.js";import{b as yi,a as ji}from"./sandbox-lifecycle-context-Dp2Dt1TA.js";import{b as wi}from"./thread-route-Dt42HUQv.js";import{E as Pi}from"./empty-state-DLrHPsXZ.js";import{a as Si}from"./autosend-ce5-FRC2.js";function ki(t){const{value:e,baseBranch:s,releases:r,baseIsDraft:n=!1,storeDrafts:i=[]}=t,d=!n&&!!e&&e===s,l=r.find(c=>c.branch===e),o=d||l?void 0:i.find(c=>c.name===e),u=!d&&!l&&!o&&!!e;return o?{isBase:d,current:l,storeDraft:o,unlisted:u}:{isBase:d,current:l,unlisted:u}}const Ni={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},Vn=1114111;function Gn(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>Vn?e:String.fromCodePoint(r)}if(s.startsWith("#")){const r=Number.parseInt(s.slice(1),10);return!Number.isFinite(r)||r>Vn?e:String.fromCodePoint(r)}return Ni[s]??e}):""}function Ci(t){const e=T.c(39),{url:s,onSave:r}=t,n=me(),[i,d]=H.useState(s??"");let l;e[0]!==i?(l=i.trim(),e[0]=i,e[1]=l):l=e[1];const o=l;let u;e[2]!==r||e[3]!==o?(u=()=>r(o?gl(o):null),e[2]=r,e[3]=o,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 x;e[14]!==c||e[15]!==o?(x=N=>{N.key==="Enter"&&o&&c()},e[14]=c,e[15]=o,e[16]=x):x=e[16];let g;e[17]!==b||e[18]!==f||e[19]!==x||e[20]!==i?(g=a.jsx("input",{type:"url",inputMode:"url","aria-label":b,placeholder:f,value:i,onChange:m,onKeyDown:x,className:"h-8 w-full rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[17]=b,e[18]=f,e[19]=x,e[20]=i,e[21]=g):g=e[21];let w;e[22]!==r||e[23]!==n||e[24]!==s?(w=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]=w):w=e[25];const j=!o;let y;e[26]!==n?(y=n("thread.branchPicker.save"),e[26]=n,e[27]=y):y=e[27];let P;e[28]!==c||e[29]!==j||e[30]!==y?(P=a.jsx(ve,{size:"sm",disabled:j,onClick:c,children:y}),e[28]=c,e[29]=j,e[30]=y,e[31]=P):P=e[31];let S;e[32]!==w||e[33]!==P?(S=a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[w,P]}),e[32]=w,e[33]=P,e[34]=S):S=e[34];let k;return e[35]!==S||e[36]!==p||e[37]!==g?(k=a.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[p,g,S]}),e[35]=S,e[36]=p,e[37]=g,e[38]=k):k=e[38],k}function Ai(t){const e=T.c(8),{virtualMcpId:s,branch:r,serve:n,rowRef:i,onPicked:d}=t,l=St(s,r),o=!!n.connection,u=o&&l.kind==="protocol"&&l.source==="local";let c;e[0]!==d||e[1]!==n?(c=()=>Ri(n,d),e[0]=d,e[1]=n,e[2]=c):c=e[2];let h;return e[3]!==i||e[4]!==o||e[5]!==u||e[6]!==c?(h=a.jsx(Di,{rowRef:i,selected:o,connected:u,onSelect:c}),e[3]=i,e[4]=o,e[5]=u,e[6]=c,e[7]=h):h=e[7],h}function Ri(t,e){e?.(),!t.connection&&t.set({endpoint:t.lastEndpoint??Va})}function Di(t){const e=T.c(19),{rowRef:s,selected:r,connected:n,onSelect:i}=t,d=me(),l=r?"bg-accent":"hover:bg-accent";let o;e[0]!==l?(o=q("flex rounded-lg",l),e[0]=l,e[1]=o):o=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]!==i||e[11]!==r||e[12]!==h||e[13]!==p?(b=a.jsxs("button",{type:"button","aria-pressed":r,onClick:i,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]=i,e[11]=r,e[12]=h,e[13]=p,e[14]=b):b=e[14];let f;return e[15]!==s||e[16]!==o||e[17]!==b?(f=a.jsx("div",{ref:s,className:o,children:b}),e[15]=s,e[16]=o,e[17]=b,e[18]=f):f=e[18],f}const Ti=10080*60*1e3;function Bi({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 x of Object.values(f??{})){const g=x?.createdAt??0;g>m.lastActiveAt&&(m.lastActiveAt=g)}}const i=r-Ti,d=[...n.entries()].filter(([,h])=>h.lastActiveAt>=i).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)),o=new Set(Object.keys(t?.[e]??{})),u=[...o].filter(h=>!l.has(h)).sort().map(h=>({name:h,source:"yours"})),c=s.filter(h=>!o.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 Ii=100,Fi=50,$i=300;function rn(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function Li(t){const e=T.c(39),{orgId:s,orgSlug:r,userId:n,target:i,sandboxMap:d,owner:l,repo:o,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=yl(f,$i);let x;e[2]!==i?(x=_r(i),e[2]=i,e[3]=x):x=e[3];const g=x,w=f.length>0;let j;e[4]!==m||e[5]!==s||e[6]!==r||e[7]!==l||e[8]!==o||e[9]!==i?(j=ns.githubBranchSearch(s,r,zr(i),l,o,m),e[4]=m,e[5]=s,e[6]=r,e[7]=l,e[8]=o,e[9]=i,e[10]=j):j=e[10];const y=p&&g;let P;e[11]!==m||e[12]!==r||e[13]!==i?(P=B=>{const{pageParam:Z}=B;return Ca(r,"REPOSITORY_SEARCH_BRANCHES",{...i,query:m,limit:m?Fi:Ii,cursor:Z})},e[11]=m,e[12]=r,e[13]=i,e[14]=P):P=e[14];let S;e[15]!==m?(S=B=>m?void 0:B.nextCursor??void 0,e[15]=m,e[16]=S):S=e[16];let k;e[17]!==j||e[18]!==y||e[19]!==P||e[20]!==S?(k={queryKey:j,enabled:y,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:P,getNextPageParam:S},e[17]=j,e[18]=y,e[19]=P,e[20]=S,e[21]=k):k=e[21];const{data:N,isLoading:C,isError:v,isFetching:A,hasNextPage:D,isFetchingNextPage:I,fetchNextPage:O}=jl(k),F=w&&(m!==f||A),_=(N?.pages??[]).flatMap(Ei),$=rl(6e4),G=Bi({sandboxMap:d,userId:n,rawBranches:_,now:$});let V;e[22]!==f?(V=B=>rn(B.name,f),e[22]=f,e[23]=V):V=e[23];const J=G.recent.filter(V);let L;e[24]!==f?(L=B=>rn(B.name,f),e[24]=f,e[25]=L):L=e[25];const K=G.yours.filter(L),te=G.others,X=N?.pages[0],ne=w&&X&&!F?Math.max(0,X.totalCount-X.branches.length):0,le=!w&&D;let M;e[26]!==O?(M=()=>{O()},e[26]=O,e[27]=M):M=e[27];let Y;return e[28]!==ne||e[29]!==v||e[30]!==I||e[31]!==C||e[32]!==F||e[33]!==te||e[34]!==J||e[35]!==le||e[36]!==M||e[37]!==K?(Y={recent:J,yours:K,others:te,isLoading:C,isError:v,isSearching:F,hiddenMatchCount:ne,hasMore:le,isFetchingMore:I,fetchMore:M},e[28]=ne,e[29]=v,e[30]=I,e[31]=C,e[32]=F,e[33]=te,e[34]=J,e[35]=le,e[36]=M,e[37]=K,e[38]=Y):Y=e[38],Y}function Ei(t){return t.branches}function Oi(t){const e=T.c(6),s=me(),{releases:r,createRelease:n}=Vs(t.virtualMcpId);let i;return e[0]!==n||e[1]!==t.userId||e[2]!==t.userLabel||e[3]!==r||e[4]!==s?(i=()=>{if(r.length>=Fs)return Ze.error(s("thread.branchPicker.capReached",{max:Fs})),null;const d=vn(t.userLabel);return n({branch:d,name:Vr(r,s("thread.branchPicker.defaultVersionName")),color:us(r.length),createdBy:t.userId,createdAt:new Date().toISOString()}).catch(l=>{Ze.error(s("thread.branchPicker.saveError"),{description:kr(s,Nr(l))})}),d},e[0]=n,e[1]=t.userId,e[2]=t.userLabel,e[3]=r,e[4]=s,e[5]=i):i=e[5],i}const Ls="-mx-[3px] h-3.5 w-3.5 shrink-0";function Mi(t){const e=T.c(110),{virtualMcpId:s,isV8:r,userLabel:n,value:i,baseBranch:d,baseIsDraft:l,orgId:o,orgSlug:u,userId:c,target:h,owner:p,repo:b,sandboxMap:f,onChange:m,onCreateBranch:x,onAdoptBranch:g,disabled:w,spawnsNewChat:j,placement:y}=t,P=r===void 0?!1:r,S=l===void 0?!1:l,k=w===void 0?!1:w,N=j===void 0?!1:j,C=y===void 0?"chat":y,v=me(),A=C==="header",[D,I]=H.useState(!1),[O,F]=H.useState(!1),[_,$]=H.useState("branches"),[G,V]=H.useState(null),[J,L]=H.useState(""),[K,te]=H.useState(null),[X,ne]=H.useState(null),le=H.useRef(null),{releases:M,createRelease:Y,renameRelease:B,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=Oi(se),ge=kl(s,P),ue=P?Nl(M,ge.data):[],re=ge.refetch,fe=Cl(s),{url:ye,setUrl:z,clear:oe}=pn(s),xe=bn(s),W=P&&!!xe.connection,ee=P?xe.connection?.endpoint??null:ye,ce=!!ee;let Q;e[4]!==oe||e[5]!==P||e[6]!==xe?(Q=()=>{oe(),P&&xe.clear()},e[4]=oe,e[5]=P,e[6]=xe,e[7]=Q):Q=e[7];const de=Q;let Me;e[8]!==D?(Me={enabled:D},e[8]=D,e[9]=Me):Me=e[9];const{data:ft}=Aa(Me);let we;e[10]!==ft?.data?.members?(we=R=>R?ft?.data?.members?.find(pe=>pe.userId===R)?.user?.name??void 0:void 0,e[10]=ft?.data?.members,e[11]=we):we=e[11];const nt=we,Le=M.length>=Fs,Re=M.length>1,De=v("thread.branchPicker.capReached",{max:Fs}),{isBase:_e,current:Ne,storeDraft:rt,unlisted:ze}=ki({value:i,baseBranch:d,releases:M,baseIsDraft:S,storeDrafts:ue}),$t=_e?v("thread.branchPicker.live"):Ne?.name??rt?.name??v("thread.branchPicker.defaultVersionName"),Ee=W?v("thread.branchPicker.localhost.label"):ce?v("thread.branchPicker.localLabel"):i?$t:v("thread.branchPicker.selectVersion"),We=W?"bg-foreground":ce?"bg-special":_e?"bg-success":rt?ds(void 0):ds(Ne?.color??"orange"),E=!W&&!ce&&!_e&&Ne?.runtime==="sandbox",be=R=>{de(),m(R,ue.some(pe=>pe.name===R)?"cms":M.find(pe=>pe.branch===R)?.runtime),I(!1)};let Pe;e[12]!==v?(Pe=R=>{Ze.error(v("thread.branchPicker.saveError"),{description:kr(v,Nr(R))})},e[12]=v,e[13]=Pe):Pe=e[13];const Se=Pe;let Te;e[14]!==z?(Te=R=>{z(R),F(!1),I(!1)},e[14]=z,e[15]=Te):Te=e[15];const mt=Te,pt=(R,pe)=>{if(de(),g){g(R),F(!1),I(!1);return}if(!M.some(Dt=>Dt.branch===R)){if(Le){Ze.error(De);return}Y({branch:R,name:pe.trim()||R,color:us(M.length),createdBy:c,createdAt:new Date().toISOString()}).catch(Se)}m(R),F(!1),I(!1)};let at;e[16]!==de||e[17]!==m||e[18]!==x||e[19]!==ie?(at=()=>{const R=ie();R&&(de(),(x??m)(R),I(!1))},e[16]=de,e[17]=m,e[18]=x,e[19]=ie,e[20]=at):at=e[20];const as=at;let bt;e[21]===Symbol.for("react.memo_cache_sentinel")?(bt=()=>{V(null),L(""),F(!1),$("branches")},e[21]=bt):bt=e[21];const ls=bt;let lt;e[22]===Symbol.for("react.memo_cache_sentinel")?(lt=R=>{$(R),F(!0)},e[22]=lt):lt=e[22];const Ce=lt;let it;e[23]===Symbol.for("react.memo_cache_sentinel")?(it=R=>{V(R.branch),L(R.name)},e[23]=it):it=e[23];const Lt=it;let gt;e[24]!==J||e[25]!==B||e[26]!==Se?(gt=R=>{const pe=J.trim();pe&&B(R,pe).catch(Se),V(null),L("")},e[24]=J,e[25]=B,e[26]=Se,e[27]=gt):gt=e[27];const Qs=gt,Et=R=>{const pe=R===void 0?i:R,Dt=J.trim();if(Dt&&pe){if(Le){Ze.error(De),V(null),L("");return}Y({branch:pe,name:Dt,color:us(M.length),createdBy:c,createdAt:new Date().toISOString()}).catch(Se)}V(null),L("")};let Qe;e[28]===Symbol.for("react.memo_cache_sentinel")?(Qe=()=>{V(null),L("")},e[28]=Qe):Qe=e[28];const ot=Qe,kt=()=>{const R=K;if(te(null),!(!R||!Re)){if(R.branch===i){const pe=M.filter(Na=>Na.branch!==R.branch),Dt=pe.find(_i)??pe[0];Dt?be(Dt.branch):I(!1)}else I(!1);Z(R.branch).catch(Se)}},ct=Al(M),is=(ct.content.length>0||ue.length>0)&&ct.code.length>0,xt=R=>G===R.branch?a.jsx(Zs,{value:J,onChange:L,onSave:()=>Qs(R.branch),onCancel:ot},R.branch):a.jsx(en,{rowRef:!ce&&R.branch===i?le:void 0,dot:ds(R.color),codeIcon:R.runtime==="sandbox"?xs(R.color):void 0,label:R.name,creator:nt(R.createdBy),originTooltip:P?v("thread.branchPicker.viaStudioUi"):void 0,branch:!P||R.runtime==="sandbox"?R.branch:void 0,selected:!ce&&R.branch===i,onSelect:()=>be(R.branch),onRename:()=>Lt(R),onDelete:()=>te(R),deleteBlocked:!Re},R.branch),Nt=()=>{const R=X;if(ne(null),!(!R||R.name===i&&M.length===0)){if(R.name===i){const pe=M[0];pe?be(pe.branch):I(!1)}fe.mutateAsync(R.name).catch(pe=>{Ze.error(v("thread.branchPicker.discardStoreDraftError"),{description:pe instanceof Error?pe.message:void 0})})}},Ct=ue.map((R,pe)=>G===R.name?a.jsx(Zs,{value:J,onChange:L,onSave:()=>Et(R.name),onCancel:ot},`store:${R.name}`):a.jsx(en,{rowRef:!ce&&R.name===i?le:void 0,dot:ds(void 0),label:R.name,creator:nt(R.createdBy),agentIcon:xs(us(pe)),originTooltip:v("thread.branchPicker.storeDraftVia",{via:Rl(R.via)}),selected:!ce&&R.name===i,onSelect:()=>be(R.name),onRename:()=>{V(R.name),L(R.name)},onDelete:()=>ne(R),deleteBlocked:R.name===i&&M.length===0},`store:${R.name}`));let vt;e[29]!==k||e[30]!==P||e[31]!==re?(vt=k?void 0:R=>{R?P&&re():ls(),I(R)},e[29]=k,e[30]=P,e[31]=re,e[32]=vt):vt=e[32];const At=A?"text-xs":"text-xs text-muted-foreground hover:text-foreground";let Je;e[33]!==At?(Je=q("shrink min-w-0 max-w-[220px] gap-2",At,Dr),e[33]=At,e[34]=Je):Je=e[34];let yt;e[35]!==k?(yt=!k&&a.jsx(Ir,{size:12,className:"opacity-60 shrink-0"}),e[35]=k,e[36]=yt):yt=e[36];let dt;e[37]!==Ee?(dt=a.jsx(st,{children:Ee}),e[37]=Ee,e[38]=dt):dt=e[38];const Rt=il,os="w-[min(300px,calc(100vw-2rem))] p-1.5",cs="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=O?a.jsx(Ui,{orgId:o,orgSlug:u,userId:c,target:h,owner:p,repo:b,sandboxMap:f,enabled:D,tab:_,onTabChange:$,isV8:P,localUrl:ye,onSaveLocal:mt,onBack:()=>F(!1),onAdopt:pt}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:q("always-scrollbar flex max-h-[min(50vh,20rem)] flex-col overflow-y-auto",P&&"gap-1"),children:[!P&&ce&&ee&&a.jsx(zi,{rowRef:le,url:ee,onSelect:()=>Ce("local"),onEdit:()=>Ce("local"),onTurnOff:()=>de()}),ze&&i&&(G===i?a.jsx(Zs,{value:J,onChange:L,onSave:()=>Et(),onCancel:ot}):a.jsx(en,{rowRef:ce?void 0:le,dot:ds("orange"),label:v("thread.branchPicker.defaultVersionName"),branch:P?void 0:i,originTooltip:P?v("thread.branchPicker.viaStudioUi"):void 0,selected:!ce,onSelect:()=>be(i),onRename:()=>{V(i),L(Vr(M,v("thread.branchPicker.defaultVersionName")))}})),is?a.jsxs(a.Fragment,{children:[a.jsx(Wn,{children:v("thread.branchPicker.groupContent")}),ct.content.map(xt),Ct,a.jsx(Wn,{divided:!0,children:v("thread.branchPicker.groupCode")}),ct.code.map(xt)]}):a.jsxs(a.Fragment,{children:[M.map(xt),Ct]}),P&&a.jsx(Ai,{virtualMcpId:s,branch:i,serve:xe,rowRef:W?le:void 0,onPicked:()=>I(!1)})]}),(ze||M.length>0||ue.length>0||P)&&a.jsx("div",{className:"my-1 border-t"}),a.jsxs("button",{type:"button",onClick:()=>{as()},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(Mr,{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:De}),a.jsxs("button",{type:"button",onClick:()=>Ce("branches"),className:q("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",P&&"mt-1"),children:[v("thread.branchPicker.advanced"),a.jsx(dr,{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:os,align:cs,onOpenAutoFocus:Be,children:[Ie,Xe]}),e[43]=Rt,e[44]=Be,e[45]=Ie,e[46]=Xe,e[47]=Ue):Ue=e[47];const jt=a.jsxs(ol,{open:D,onOpenChange:vt,children:[a.jsxs(et,{children:[a.jsx(tt,{asChild:!0,children:a.jsx("span",{className:"inline-flex min-w-0 shrink",children:a.jsx(cl,{asChild:!0,children:a.jsxs(ve,{"data-tour":al.branchPicker,variant:A?"outline":"ghost",size:A?"sm":"default","aria-label":Ee,disabled:k,className:Je,children:[E?a.jsx(Fr,{className:q(Ls,xs(Ne?.color))}):rt&&!ce?a.jsx(ur,{className:q(Ls,xs(us(ue.indexOf(rt))))}):a.jsx("span",{className:q("h-2 w-2 shrink-0 rounded-full",i||ce?We:"bg-muted-foreground")}),a.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:Ee}),yt]})})})}),dt]}),Ue]}),Ye=K!==null;let He;e[48]===Symbol.for("react.memo_cache_sentinel")?(He=R=>{R||te(null)},e[48]=He):He=e[48];let Fe;e[49]!==v?(Fe=v("thread.branchPicker.deleteTitle"),e[49]=v,e[50]=Fe):Fe=e[50];let $e;e[51]!==Fe?($e=a.jsx(ks,{children:Fe}),e[51]=Fe,e[52]=$e):$e=e[52];let qe;e[53]!==K||e[54]!==v?(qe=K&&v("thread.branchPicker.deleteConfirm",{name:K.name}),e[53]=K,e[54]=v,e[55]=qe):qe=e[55];let U;e[56]!==qe?(U=a.jsx(Ns,{children:qe}),e[56]=qe,e[57]=U):U=e[57];let ae;e[58]!==$e||e[59]!==U?(ae=a.jsxs(Cs,{children:[$e,U]}),e[58]=$e,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(Ds,{children:[je,Ke]}),e[70]=je,e[71]=Ke,e[72]=Ot):Ot=e[72];let Mt;e[73]!==ae||e[74]!==Ot?(Mt=a.jsxs(Ts,{children:[ae,Ot]}),e[73]=ae,e[74]=Ot,e[75]=Mt):Mt=e[75];let ps;e[76]!==Ye||e[77]!==Mt?(ps=a.jsx(Bs,{open:Ye,onOpenChange:He,children:Mt}),e[76]=Ye,e[77]=Mt,e[78]=ps):ps=e[78];const Js=X!==null;let bs;e[79]===Symbol.for("react.memo_cache_sentinel")?(bs=R=>{R||ne(null)},e[79]=bs):bs=e[79];let _t;e[80]!==v?(_t=v("thread.branchPicker.deleteTitle"),e[80]=v,e[81]=_t):_t=e[81];let zt;e[82]!==_t?(zt=a.jsx(ks,{children:_t}),e[82]=_t,e[83]=zt):zt=e[83];let Ut;e[84]!==X||e[85]!==v?(Ut=X&&v("thread.branchPicker.discardStoreDraftConfirm",{name:X.name}),e[84]=X,e[85]=v,e[86]=Ut):Ut=e[86];let Ht;e[87]!==Ut?(Ht=a.jsx(Ns,{children:Ut}),e[87]=Ut,e[88]=Ht):Ht=e[88];let qt;e[89]!==zt||e[90]!==Ht?(qt=a.jsxs(Cs,{children:[zt,Ht]}),e[89]=zt,e[90]=Ht,e[91]=qt):qt=e[91];let Kt;e[92]!==v?(Kt=v("thread.branchPicker.cancel"),e[92]=v,e[93]=Kt):Kt=e[93];let Vt;e[94]!==Kt?(Vt=a.jsx(As,{children:Kt}),e[94]=Kt,e[95]=Vt):Vt=e[95];let Gt;e[96]!==v?(Gt=v("thread.branchPicker.delete"),e[96]=v,e[97]=Gt):Gt=e[97];let Wt;e[98]!==Nt||e[99]!==Gt?(Wt=a.jsx(Rs,{onClick:Nt,variant:"destructive",children:Gt}),e[98]=Nt,e[99]=Gt,e[100]=Wt):Wt=e[100];let Qt;e[101]!==Vt||e[102]!==Wt?(Qt=a.jsxs(Ds,{children:[Vt,Wt]}),e[101]=Vt,e[102]=Wt,e[103]=Qt):Qt=e[103];let Jt;e[104]!==qt||e[105]!==Qt?(Jt=a.jsxs(Ts,{children:[qt,Qt]}),e[104]=qt,e[105]=Qt,e[106]=Jt):Jt=e[106];let gs;return e[107]!==Js||e[108]!==Jt?(gs=a.jsx(Bs,{open:Js,onOpenChange:bs,children:Jt}),e[107]=Js,e[108]=Jt,e[109]=gs):gs=e[109],a.jsxs(a.Fragment,{children:[jt,ps,gs]})}function _i(t){return t.runtime!=="sandbox"}function Zs(t){const e=T.c(20),{value:s,onChange:r,onSave:n,onCancel:i}=t,d=me();let l;e[0]!==d?(l=d("thread.branchPicker.rename"),e[0]=d,e[1]=l):l=e[1];let o;e[2]!==r?(o=f=>r(f.target.value),e[2]=r,e[3]=o):o=e[3];let u;e[4]!==i||e[5]!==n?(u=f=>{f.key==="Enter"&&n(),f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),i())},e[4]=i,e[5]=n,e[6]=u):u=e[6];let c;e[7]!==l||e[8]!==o||e[9]!==u||e[10]!==s?(c=a.jsx("input",{autoFocus:!0,"aria-label":l,value:s,onChange:o,onKeyDown:u,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[7]=l,e[8]=o,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 Wn(t){const e=T.c(5),{divided:s,children:r}=t,i=(s===void 0?!1:s)&&"mt-1 border-t";let d;e[0]!==i?(d=q("px-2 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",i),e[0]=i,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 en(t){const e=T.c(53),{rowRef:s,dot:r,codeIcon:n,agentIcon:i,originTooltip:d,label:l,creator:o,branch:u,selected:c,onSelect:h,onRename:p,onDelete:b,deleteBlocked:f}=t,m=f===void 0?!1:f,x=me();let g;e[0]!==i||e[1]!==n||e[2]!==r?(g=n?a.jsx(Fr,{className:q(Ls,n)}):i?a.jsx(ur,{className:q(Ls,i)}):a.jsx("span",{className:q("h-2 w-2 shrink-0 rounded-full",r)}),e[0]=i,e[1]=n,e[2]=r,e[3]=g):g=e[3];let w;e[4]!==o?(w=o&&a.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:o}),e[4]=o,e[5]=w):w=e[5];let j;e[6]!==l||e[7]!==w?(j=a.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[l,w]}),e[6]=l,e[7]=w,e[8]=j):j=e[8];let y;e[9]!==h||e[10]!==c||e[11]!==g||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:[g,j]}),e[9]=h,e[10]=c,e[11]=g,e[12]=j,e[13]=y):y=e[13];const P=y,S=c?"bg-accent":"hover:bg-accent";let k;e[14]!==S?(k=q("group flex items-center rounded-lg",S),e[14]=S,e[15]=k):k=e[15];let N;e[16]!==u||e[17]!==n||e[18]!==d||e[19]!==P||e[20]!==x?(N=u||d?a.jsxs(et,{children:[a.jsx(tt,{asChild:!0,children:P}),a.jsxs(st,{side:"bottom",className:"text-xs",children:[n&&a.jsx("p",{className:"font-medium",children:x("thread.branchPicker.codeDraftTooltip")}),d&&a.jsx("p",{children:d}),u&&a.jsx("p",{className:"font-mono",children:x("thread.branchPicker.branchTooltip",{branch:u})})]})]}):P,e[16]=u,e[17]=n,e[18]=d,e[19]=P,e[20]=x,e[21]=N):N=e[21];let C;e[22]!==x?(C=x("thread.branchPicker.moreActions"),e[22]=x,e[23]=C):C=e[23];let v;e[24]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(Er,{className:"h-4 w-4"}),e[24]=v):v=e[24];let A;e[25]!==C?(A=a.jsx(Os,{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 D;e[27]===Symbol.for("react.memo_cache_sentinel")?(D=a.jsx(Or,{className:"h-4 w-4"}),e[27]=D):D=e[27];let I;e[28]!==x?(I=x("thread.branchPicker.rename"),e[28]=x,e[29]=I):I=e[29];let O;e[30]!==p||e[31]!==I?(O=a.jsxs(Zt,{onSelect:p,children:[D,I]}),e[30]=p,e[31]=I,e[32]=O):O=e[32];let F;e[33]!==m||e[34]!==b||e[35]!==x?(F=b&&a.jsxs(Zt,{onSelect:b,disabled:m,className:"text-destructive focus:text-destructive",children:[a.jsx(qs,{className:"h-4 w-4"}),x("thread.branchPicker.delete")]}),e[33]=m,e[34]=b,e[35]=x,e[36]=F):F=e[36];let _;e[37]!==m||e[38]!==b||e[39]!==x?(_=b&&m&&a.jsx("p",{className:"max-w-48 px-2 pb-1.5 text-xs text-muted-foreground",children:x("thread.branchPicker.keepOneDraft")}),e[37]=m,e[38]=b,e[39]=x,e[40]=_):_=e[40];let $;e[41]!==O||e[42]!==F||e[43]!==_?($=a.jsxs(Ms,{align:"end",children:[O,F,_]}),e[41]=O,e[42]=F,e[43]=_,e[44]=$):$=e[44];let G;e[45]!==A||e[46]!==$?(G=a.jsxs(_s,{children:[A,$]}),e[45]=A,e[46]=$,e[47]=G):G=e[47];let V;return e[48]!==s||e[49]!==G||e[50]!==k||e[51]!==N?(V=a.jsxs("div",{ref:s,className:k,children:[N,G]}),e[48]=s,e[49]=G,e[50]=k,e[51]=N,e[52]=V):V=e[52],V}function zi(t){const e=T.c(40),{rowRef:s,url:r,onSelect:n,onEdit:i,onTurnOff:d}=t,l=me();let o;try{let A;e[0]!==r?(A=new URL(r),e[0]=r,e[1]=A):A=e[1],o=A.host}catch{o=r}const u=o;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 x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(Er,{className:"h-4 w-4"}),e[15]=x):x=e[15];let g;e[16]!==m?(g=a.jsx(Os,{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:x})}),e[16]=m,e[17]=g):g=e[17];let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w=a.jsx(Or,{className:"h-4 w-4"}),e[18]=w):w=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]!==i||e[22]!==j?(y=a.jsxs(Zt,{onSelect:i,children:[w,j]}),e[21]=i,e[22]=j,e[23]=y):y=e[23];let P;e[24]===Symbol.for("react.memo_cache_sentinel")?(P=a.jsx(qs,{className:"h-4 w-4"}),e[24]=P):P=e[24];let S;e[25]!==l?(S=l("thread.branchPicker.localTurnOff"),e[25]=l,e[26]=S):S=e[26];let k;e[27]!==d||e[28]!==S?(k=a.jsxs(Zt,{onSelect:d,className:"text-destructive focus:text-destructive",children:[P,S]}),e[27]=d,e[28]=S,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]!==g?(C=a.jsxs(_s,{children:[g,N]}),e[33]=N,e[34]=g,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 Ui(t){const e=T.c(73),{orgId:s,orgSlug:r,userId:n,target:i,owner:d,repo:l,sandboxMap:o,enabled:u,tab:c,onTabChange:h,isV8:p,localUrl:b,onSaveLocal:f,onBack:m,onAdopt:x}=t,g=me(),[w,j]=H.useState(""),y=c==="branches"?w:"",P=u&&c==="branches";let S;e[0]!==s||e[1]!==r||e[2]!==d||e[3]!==l||e[4]!==o||e[5]!==y||e[6]!==P||e[7]!==i||e[8]!==n?(S={orgId:s,orgSlug:r,userId:n,target:i,sandboxMap:o,owner:d,repo:l,search:y,enabled:P},e[0]=s,e[1]=r,e[2]=d,e[3]=l,e[4]=o,e[5]=y,e[6]=P,e[7]=i,e[8]=n,e[9]=S):S=e[9];const{recent:k,yours:N,others:C,isLoading:v,hasMore:A,isFetchingMore:D,fetchMore:I}=Li(S),O=u&&c==="prs";let F;e[10]!==s||e[11]!==r||e[12]!==d||e[13]!==l||e[14]!==O||e[15]!==i?(F={orgId:s,orgSlug:r,target:i,owner:d,repo:l,enabled:O},e[10]=s,e[11]=r,e[12]=d,e[13]=l,e[14]=O,e[15]=i,e[16]=F):F=e[16];const{data:_,isLoading:$}=wl(F);let G;if(e[17]!==I||e[18]!==A||e[19]!==D||e[20]!==v||e[21]!==p||e[22]!==b||e[23]!==x||e[24]!==m||e[25]!==f||e[26]!==h||e[27]!==C||e[28]!==d||e[29]!==$||e[30]!==k||e[31]!==l||e[32]!==w||e[33]!==g||e[34]!==_||e[35]!==c||e[36]!==N){const V=_===void 0?[]:_,J=`${d}/${l}`;let L;e[38]!==J?(L=J.toLowerCase(),e[38]=J,e[39]=L):L=e[39];const K=L;let te;e[40]!==K?(te=z=>z.headRepoFullName?.toLowerCase()===K,e[40]=K,e[41]=te):te=e[41];const X=V.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(fl,{className:"h-4 w-4 shrink-0"}),e[46]=M):M=e[46];let Y;e[47]!==g?(Y=g("thread.branchPicker.advancedBack"),e[47]=g,e[48]=Y):Y=e[48];let B;e[49]!==m||e[50]!==Y?(B=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,Y]}),e[49]=m,e[50]=Y,e[51]=B):B=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]!==g?(se=g("thread.branchPicker.branchesTab"),e[54]=g,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]!==g?(ge=g("thread.branchPicker.prsTab"),e[58]=g,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]!==g?(re=!p&&a.jsx(Tt,{value:"local",className:"h-6 px-2.5 text-xs",children:g("thread.branchPicker.localTab")}),e[62]=p,e[63]=g,e[64]=re):re=e[64];let fe;e[65]!==ie||e[66]!==ue||e[67]!==re?(fe=a.jsxs(Tr,{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(Br,{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:[B,ye,c==="local"&&!p?a.jsx(Ci,{url:b,onSave:f}):a.jsxs(dl,{filter:c==="branches"?Hi:void 0,children:[a.jsx(ul,{placeholder:g(c==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),value:w,onValueChange:j}),a.jsx(hl,{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:g("thread.branchPicker.loadingMore")}),!v&&le.length===0&&a.jsx(Un,{children:g("thread.branchPicker.noBranchesFound")}),le.length>0&&a.jsx(Hn,{children:le.map(z=>a.jsxs(qn,{value:z.name,className:"cursor-pointer",onSelect:()=>x(z.name,z.name),children:[a.jsx(Ra,{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:D,onClick:I,children:g(D?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):a.jsxs(a.Fragment,{children:[$&&a.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:g("thread.branchPicker.loadingPullRequests")}),!$&&X.length===0&&a.jsx(Un,{children:g("thread.branchPicker.noOpenPullRequests")}),X.length>0&&a.jsx(Hn,{children:X.map(z=>a.jsxs(qn,{value:`#${z.number} ${z.title} ${z.head}`,className:"cursor-pointer",onSelect:()=>x(z.head,Gn(z.title)),children:[a.jsx(Hs,{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:Gn(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]=D,e[20]=v,e[21]=p,e[22]=b,e[23]=x,e[24]=m,e[25]=f,e[26]=h,e[27]=C,e[28]=d,e[29]=$,e[30]=k,e[31]=l,e[32]=w,e[33]=g,e[34]=_,e[35]=c,e[36]=N,e[37]=G}else G=e[37];return G}function Hi(t,e){return rn(t,e)?1:0}function qi(t){const e=T.c(19),{locked:s,placement:r,value:n,virtualMcpId:i,isV8:d,userLabel:l,baseBranch:o,baseIsDraft:u,onChange:c,onCreateBranch:h,onAdoptBranch:p,orgId:b,orgSlug:f,userId:m,target:x,owner:g,repo:w,sandboxMap:j}=t;let y;return e[0]!==o||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]!==g||e[10]!==r||e[11]!==w||e[12]!==j||e[13]!==x||e[14]!==m||e[15]!==l||e[16]!==n||e[17]!==i?(y=a.jsx(Mi,{virtualMcpId:i,isV8:d,userLabel:l,value:n,baseBranch:o,baseIsDraft:u,orgId:b,orgSlug:f,userId:m,target:x,owner:g,repo:w,sandboxMap:j,onChange:c,onCreateBranch:h,onAdoptBranch:p,spawnsNewChat:s,placement:r}),e[0]=o,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]=g,e[10]=r,e[11]=w,e[12]=j,e[13]=x,e[14]=m,e[15]=l,e[16]=n,e[17]=i,e[18]=y):y=e[18],y}function Ki(t){const e=T.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 Vi(t){const{locked:e,sessionRuntime:s,draftRuntime:r}=t;return t.contentOnly&&r==="cms"?s==="cms"&&!e?{kind:"switch"}:{kind:"new-chat",runtime:"cms"}:!e&&!(r==="sandbox"&&s!=="sandbox")?{kind:"switch"}:r==="sandbox"||s==="sandbox"?{kind:"new-chat",runtime:"sandbox"}:{kind:"new-chat"}}function Gi(t){const e=T.c(24),{virtualMcp:s,currentBranch:r}=t,n=qa(),i=It();let d;e[0]!==n?.messages||e[1]!==i?.isThreadLocked?(d=(n?.messages??[]).length>0||(i?.isThreadLocked??!1),e[0]=n?.messages,e[1]=i?.isThreadLocked,e[2]=d):d=e[2];const l=d,o=i?.setCurrentTaskBranch,u=i?.createTask,c=fs(s?.id),h=c.runtime;let p;e[3]!==h||e[4]!==s?.metadata?(p=xl(s?.metadata)==="cms"&&h==="sandbox",e[3]=h,e[4]=s?.metadata,e[5]=p):p=e[5];const b=p,f=vl(s),m=Oe(f),{data:x}=zs.useSession(),g=x?.user;let w;e[6]!==g?(w=yn(g),e[6]=g,e[7]=w):w=e[7];const j=w,y=x?.user?.id??"",{org:P}=rs(),S=Pl(s,r),k=jn(s?.id),N=k&&h==="cms";let C;e[8]!==u||e[9]!==l||e[10]!==h||e[11]!==c.resolved||e[12]!==o||e[13]!==k?(C=($,G)=>{const V=Vi({locked:l,sessionRuntime:c.resolved?h:null,draftRuntime:G,contentOnly:k});V.kind==="new-chat"&&u?u({branch:$,...V.runtime?{runtime:V.runtime}:{}}):o&&o($)},e[8]=u,e[9]=l,e[10]=h,e[11]=c.resolved,e[12]=o,e[13]=k,e[14]=C):C=e[14];const v=C;let A;e[15]!==b||e[16]!==u||e[17]!==l||e[18]!==o?(A=$=>{(l||b)&&u?u({branch:$}):o&&o($)},e[15]=b,e[16]=u,e[17]=l,e[18]=o,e[19]=A):A=e[19];const D=A;let I;e[20]!==u?(I=u?$=>u({runtime:"sandbox",branch:$}):void 0,e[20]=u,e[21]=I):I=e[21];const O=I,F=f&&_r(m)?a.jsx(qi,{userLabel:j,virtualMcpId:s?.id??"",isV8:k,value:r,baseBranch:S,baseIsDraft:N,orgId:P.id,orgSlug:P.slug,userId:y,target:m,owner:f.owner,repo:f.name,sandboxMap:s?.metadata?.sandboxMap,onChange:v,onCreateBranch:D,onAdoptBranch:O,locked:l,placement:"chat"},`${zr(m)}:${f.owner}/${f.name}`):null;let _;return e[22]!==F?(_=a.jsx(Ki,{branchPill:F}),e[22]=F,e[23]=_):_=e[23],_}const Wi=Da("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 Qi(t){const e=T.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 i;e[4]!==s||e[5]!==r?(i=q(Wi({orientation:r}),s),e[4]=s,e[5]=r,e[6]=i):i=e[6];let d;return e[7]!==r||e[8]!==n||e[9]!==i?(d=a.jsx("div",{role:"group","data-slot":"button-group","data-orientation":r,className:i,...n}),e[7]=r,e[8]=n,e[9]=i,e[10]=d):d=e[10],d}function Ji(t){const e=T.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(Zt,{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 i=n;if(!s.tooltip)return i;let d;e[7]!==i?(d=a.jsx(tt,{asChild:!0,children:i}),e[7]=i,e[8]=d):d=e[8];let l;e[9]!==s.tooltip?(l=a.jsx(st,{side:"right",children:s.tooltip}),e[9]=s.tooltip,e[10]=l):l=e[10];let o;return e[11]!==d||e[12]!==l?(o=a.jsxs(et,{children:[d,l]}),e[11]=d,e[12]=l,e[13]=o):o=e[13],o}function ea(t){const e=T.c(20),{label:s,onClick:r,variant:n,size:i,disabled:d,loading:l,pulse:o,tooltip:u,icon:c,items:h,menuAriaLabel:p,className:b}=t,f=n===void 0?"default":n,m=i===void 0?"default":i,x=d===void 0?!1:d,g=l===void 0?!1:l,w=o===void 0?!1:o,j=(h?.length??0)>0;let y;if(e[0]!==b||e[1]!==x||e[2]!==j||e[3]!==c||e[4]!==h||e[5]!==s||e[6]!==g||e[7]!==p||e[8]!==r||e[9]!==w||e[10]!==m||e[11]!==u||e[12]!==f){const P=q(Dr,f==="default"&&"focus-visible:inset-ring-current");let S;e[14]!==c||e[15]!==g?(S=g?a.jsx(es,{size:"xs"}):c,e[14]=c,e[15]=g,e[16]=S):S=e[16];const k=a.jsxs(ve,{type:"button",variant:f,size:m,disabled:x,"aria-busy":g||void 0,onClick:g?void 0:r,className:q(P,j&&"rounded-r-none border-r border-current/20"),children:[S,s]}),N=w&&"animate-pulse-brightness motion-reduce:animate-none motion-reduce:opacity-80";let C;e[17]!==b||e[18]!==N?(C=q(N,b),e[17]=b,e[18]=N,e[19]=C):C=e[19],y=a.jsxs(Qi,{className:C,children:[u?a.jsxs(et,{children:[a.jsx(tt,{asChild:!0,children:a.jsx("span",{className:q("inline-flex rounded-lg outline-none",P,x&&"cursor-not-allowed"),tabIndex:x?0:void 0,role:x?"button":void 0,"aria-disabled":x||void 0,children:k})}),a.jsx(st,{children:u})]}):k,j?a.jsxs(_s,{children:[a.jsx(Os,{asChild:!0,children:a.jsx(ve,{type:"button",variant:f,size:m,"aria-label":p,className:q("has-[>svg]:px-2",P),children:a.jsx(Ir,{className:"size-3.5"})})}),a.jsx(Ms,{align:"end",children:h?.map(Xi)})]}):null]}),e[0]=b,e[1]=x,e[2]=j,e[3]=c,e[4]=h,e[5]=s,e[6]=g,e[7]=p,e[8]=r,e[9]=w,e[10]=m,e[11]=u,e[12]=f,e[13]=y}else y=e[13];return y}function Xi(t){return a.jsx(Ji,{item:t},t.key)}async function Yi(t){if(t.hosted)return;const e=t.branch;await t.setCurrentTaskBranch(t.nextBranch()),e&&e!==t.baseBranch&&await t.deleteRelease(e)}function Zi(t,e,{hosted:s}){return s&&t!==null?t:e}function eo(t,e){const s=T.c(11),[r,n]=H.useState(null);let i;s[0]!==r||s[1]!==t||s[2]!==e?(i=Zi(r,t,e),s[0]=r,s[1]=t,s[2]=e,s[3]=i):i=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 o;return s[8]!==i||s[9]!==d?(o={shown:i,hold:d,release:l},s[8]=i,s[9]=d,s[10]=o):o=s[10],o}function to({open:t,hosted:e}){return t||e}function ta(t){return Wl({userName:t?.name,userEmail:t?.email})??void 0}function Gs(t){const e=T.c(18),{state:s,header:r,body:n,note:i,gate:d,footer:l}=t,o=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]!==i?(h=i?a.jsx("div",{className:"space-y-1.5 border-t px-4 py-3",children:i}):null,e[3]=i,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]!==o||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":o,children:[u,c,p,d,b,f]}),e[11]=d,e[12]=s,e[13]=o,e[14]=u,e[15]=p,e[16]=f,e[17]=m):m=e[17],m}function hs(t){const e=T.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 sa(t){const e=T.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 i;e[4]!==r?(i=q("rounded-lg border bg-card px-3 py-2.5",r),e[4]=r,e[5]=i):i=e[5];let d;return e[6]!==s||e[7]!==n||e[8]!==i?(d=a.jsx("div",{className:i,...n,children:s}),e[6]=s,e[7]=n,e[8]=i,e[9]=d):d=e[9],d}function Ge(t){const e=T.c(4),{className:s}=t;let r;e[0]!==s?(r=q("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 Bt(){const t=T.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx(sa,{children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx(Ge,{className:"size-4 rounded-md"}),a.jsx(Ge,{className:"h-3 w-24"}),a.jsx(Ge,{className:"h-2.5 w-16"}),a.jsx(Ge,{className:"ml-auto size-6 rounded"})]})}),t[0]=e):e=t[0],e}const so="secret";function na(t){return t.kind!=="block"?null:t.namedRule??null}function no(t,e){const s=e.find(r=>r&&typeof r=="object");return s?$l(s.__resolveType):Ll(t)}const ro=/(?:^|\/)\.deco\/blocks\/([^/]+)\.json$/;function Tn(t){const e=ro.exec(t)?.[1];return e?bi(e):null}function Es(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 ao(t,e){return t===null?"new":e===null?"removed":"edited"}function ra(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 Ta(r);const i=(r.split("/").pop()??r).replace(/\.[jt]sx?$/,"");return ra(i)||i}}return`Section ${e+1}`}function Bn(t){if(hr(t))return t.value??null;const e=t.__resolveType;return typeof e=="string"&&Ba(e)?t.section??null:null}const aa=6;function Ps(t,e=0){if(e>aa||!t||typeof t!="object")return[];if(Array.isArray(t))return t.flatMap(n=>Ps(n,e+1));const s=t;if(un(s.__resolveType))return an(s).flatMap(n=>Ps(n?.value,e+1));const r=Bn(s);return r!==null?Ps(r,e+1):[s]}function an(t){const e=t?.variants;return Array.isArray(e)?e.map(s=>s&&typeof s=="object"&&!Array.isArray(s)?s:null):[]}function Qn(t){let e=t;for(let s=0;s<aa;s++){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e;if(un(r.__resolveType))return r;const n=Bn(r);if(n===null)return null;e=n}return null}function lo(t,e,s){const r=an(Qn(t)),n=e?an(Qn(e)):[],i=e?Array.from({length:Math.max(r.length,n.length)},(o,u)=>u).filter(o=>!Ws(r[o],n[o])):[],l=[...i.map(o=>r[o]??n[o]),...r.filter((o,u)=>!i.includes(u))].flatMap(o=>Ps(o?.value)).map(o=>Yt(o,s,!0));return[...new Set(l)]}function tn(t,e,s,r,n){let i=t,d=!1;for(let o=0;o<4;o++){if(!i||typeof i!="object"||Array.isArray(i)){d=!0;break}const u=i;if(un(u.__resolveType)){d=!0;break}const c=Bn(u);if(c===null)break;i=c}const l=d?lo(t,n,e):[];return{name:Yt(d?t:i,e,!0),kind:"section",status:s,fields:r,...d?{wrapper:!0}:{},...l.length>0?{held:l}:{}}}function ln(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,i)=>{const d=n&&typeof n=="object"&&!Array.isArray(n)?n.value:null,l=e&&hr(d),o=l?d.value:d;if(!Array.isArray(o))return[];const u=l?["sections","variants",i,"value","value"]:["sections","variants",i,"value"];return o.flatMap((c,h)=>c&&typeof c=="object"&&!Array.isArray(c)?[{section:c,basePath:[...u,h]}]:[])})}return[]}function Jn(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,i)=>(n[i]=r[i],n),{})}return s})}function Ws(t,e){return t===void 0&&e===void 0?!0:Jn(t)===Jn(e)}function Pt(t,e,s,r=new Set){const n=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),i=[];for(const d of n){if(d.startsWith("__")||r.has(d))continue;const l=t?t[d]:void 0,o=e?e[d]:void 0;Ws(l,o)||i.push({label:ra(d),path:[...s,d],from:l,to:o})}return i}function io(t,e){const s=e.find(r=>r&&typeof r=="object");return s?s.__resolveType===Jl:t===Xl}function oo(t,e){const s=n=>n===void 0||!!n&&typeof n=="object"&&!Array.isArray(n)&&!("__resolveType"in n),r=[];for(const n of Pt(t,e,[])){const i=String(n.path[0]);s(n.from)&&s(n.to)?r.push(...Pt(n.from??{},n.to??{},[i])):r.push(n)}return r}const co=new Set(["sections"]);function In(t,e,s=!1){const r=t?ln(t,s):[],n=e?ln(e,s):[],i=[],d=Math.max(r.length,n.length);for(let o=0;o<d;o++){const u=r[o],c=n[o];if(!s){const h=uo(u,c,o);h&&i.push(h);continue}if(u&&c){if(Ws(u.section,c.section))continue;i.push(tn(c.section,o,"edited",Pt(u.section,c.section,c.basePath),u.section))}else c?i.push(tn(c.section,o,"new",[])):u&&i.push(tn(u.section,o,"removed",[]))}const l=Pt(t,e,[],co);return l.length>0&&i.push({name:"Page settings",kind:"settings",status:"edited",fields:l}),i}function uo(t,e,s){return t&&e?Ws(t.section,e.section)?null:{name:Yt(e.section,s),kind:"section",status:"edited",fields:Pt(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 on(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 ho(t){const e=[],s=[],r=[],n=[];for(const[i,d]of Object.entries(t?.diffs??{})){if(kn(i)){n.push(i);continue}const l=ao(d.from,d.to),o=Tn(i);if(!o){r.push(on(i,l));continue}const u=Es(d.from),c=Es(d.to),h=c??u;if(!h){r.push(on(i,l));continue}const p=Xt(o,h);if(p){e.push({kind:"page",blockKey:o,name:p.name,pagePath:p.path,isSiteApp:!1,status:l,filepaths:[i],sections:l==="edited"?In(u,c):[],fromJson:u,toJson:c});continue}const b=wn(o,h);s.push({kind:"block",blockKey:o,name:$s(o,h),pagePath:null,isSiteApp:b,status:l,filepaths:[i],sections:l==="edited"?[{name:$s(o,h),kind:"section",status:"edited",fields:Pt(u,c,[])}].filter(f=>f.fields.length>0):[],fromJson:u,toJson:c})}return la({pages:e,blocks:s,other:r,generated:n})}function sn(t,e){return(t.filepaths[0]??"").localeCompare(e.filepaths[0]??"")}function la(t){const{pages:e,blocks:s,other:r,generated:n}=t;return e.sort(sn),s.sort(sn),r.sort(sn),{pages:e,blocks:s,other:r,generated:n,count:e.length+s.length+r.length}}function fo(t){return t==="added"?"new":t==="removed"?"removed":"edited"}function ia(t){return t.startsWith("pages-")}function oa(t){const{files:e,lookup:s,diff:r}=t,n=[],i=[],d=[],l=[];for(const o of e){const u=o.path;if(kn(u)){l.push(u);continue}const c=fo(o.status),h=Tn(u);if(!h){d.push(on(u,c));continue}const p=r?.diffs[u],b=Es(p?.from??null),f=Es(p?.to??null),m=ca(s,h),x=m??f??b;if((m?Xt(h,m):null)??(!m&&ia(h))){const j=x?Xt(h,x):null;n.push({kind:"page",blockKey:h,name:j?.name??Wr(h),pagePath:j?.path??null,isSiteApp:!1,status:c,filepaths:[u],sections:c==="edited"?In(b,f):[],fromJson:b,toJson:f??(c==="new"?m:null)});continue}const w=$s(h,x??{});i.push({kind:"block",blockKey:h,name:w,pagePath:null,isSiteApp:wn(h,m??{}),status:c,filepaths:[u],sections:c==="edited"?[{name:w,kind:"section",status:"edited",fields:Pt(b,f,[])}].filter(j=>j.fields.length>0):[],fromJson:b,toJson:f})}return la({pages:n,blocks:i,other:d,generated:l})}function ca(t,e){const s=t?.[e];return s&&typeof s=="object"&&!Array.isArray(s)?s:null}function mo(t,e){return t??e}function da(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const nn=3;function vs(t){if(t.length<=nn)return da(t);const e=t.length-nn;return`${t.slice(0,nn).join(", ")} and ${e} more`}function po(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 bo(t){const e=na(t);return e==="experiments"?"A/B tests":e==="campaigns"?"Campaign dates":t.name}function go(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=>po(l,!!t.v8)))}`),r.length>0){const l=r.length===1?"page":"pages";e.push(`added the ${vs(r.map(o=>o.name))} ${l}`)}if(n.length>0){const l=n.length===1?"page":"pages";e.push(`removed the ${vs(n.map(o=>o.name))} ${l}`)}const i=t.blocks.map(bo);if(i.length>0&&e.push(`changed ${vs(i)}`),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=da(e);return Ql(d.charAt(0).toUpperCase()+d.slice(1))}function xo(t,e){return t?ln(t,e).length:0}function vo(t,e=!1){const s={newPageSections:t.kind==="page"&&t.status==="new"?xo(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 Xn="••••••";function ts(t){if(Array.isArray(t))return t.map(ts);if(!t||typeof t!="object")return t;const e=t,s={};for(const[r,n]of Object.entries(e))s[r]=ts(n);return e.__resolveType===so&&"ciphertext"in e&&(s.ciphertext=Xn),Fa(e)&&"encrypted"in e&&(s.encrypted=Xn),s}function Yn(t){return t.map(e=>({...e,from:ts(e.from),to:ts(e.to)}))}function yo(t){const{changes:e,sides:s,lookup:r,meta:n,hosted:i}=t,d=[],l=[],o=c=>[...new Set((s?.diagnostics??[]).filter(h=>_n(Ia(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,x=ca(r,c),g=x??m??f,w=o(c),j={blockKey:c,status:p,filepaths:[],entry:{name:c,version:h.version},...w.length>0?{unreadable:w}:{},fromJson:ts(f),toJson:ts(m??(p==="new"?x:null))},y=x?Xt(c,x,n):null,P=!x&&g?Xt(c,g,n):null;if(y??P??(!g&&ia(c))){const v=g?Xt(c,g,n):null;d.push({...j,kind:"page",name:v?.name??Wr(c),pagePath:v?.path??null,isSiteApp:!1,sections:p==="edited"?In(f,m,!0).map(A=>({...A,fields:Yn(A.fields)})):[]});continue}const S=i?Il(c,g,x,m,f):null,k=S?Fl(S,[g,x,m,f]):$s(c,g??{}),N=no(c,[x,m,f]),C=io(c,[x,m,f]);l.push({...j,kind:"block",name:C?"Settings":k,...C?{cmsSettings:!0}:{},...S?{blogKind:S}:{},...N?{namedRule:N}:{},pagePath:null,isSiteApp:wn(c,x??g??{}),sections:p==="edited"?[{name:C?"Settings":k,kind:"section",status:"edited",fields:Yn(C?oo(f,m):Pt(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 jo(t,e){return e(t==="new"?"thread.publishPopover.chipNew":t==="removed"?"thread.publishPopover.chipRemoved":"thread.publishPopover.chipEdited")}function wo(t,e){const s=t.kind==="block"?ri:$r;return a.jsx("span",{title:jo(t.status,e),className:"flex shrink-0",children:a.jsx(s,{className:q("size-4",t.status==="new"&&"text-brand",t.status==="edited"&&"text-warning",t.status==="removed"&&"text-destructive")})})}function Po(t,e){if(t.kind==="page")return t.pagePath;if(t.kind!=="block")return null;if(t.blogKind)return El(t.blogKind,e);if(t.cmsSettings)return e("thread.publishPopover.settingsDetail");const s=na(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 So(t,e,s){const r=vo(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 ua(t){const e=T.c(46),{change:s,bodyPending:r,selected:n,onSelect:i,confirming:d,onConfirmingChange:l,onDiscard:o,isPublishing:u,isDiscarding:c,v8:h}=t,p=r===void 0?!1:r,b=h===void 0?!1:h,f=me();let m;e[0]!==s||e[1]!==f?(m=Po(s,f),e[0]=s,e[1]=f,e[2]=m):m=e[2];const x=m;let g;if(e[3]!==p||e[4]!==s||e[5]!==d||e[6]!==x||e[7]!==c||e[8]!==u||e[9]!==l||e[10]!==o||e[11]!==i||e[12]!==n||e[13]!==f||e[14]!==b){const w=So(s,f,b),j=p&&w.length===0&&s.status==="edited",y=n&&"border-foreground/30 bg-accent hover:bg-secondary-hover";let P;e[16]!==y?(P=q("cursor-pointer transition-colors hover:bg-accent",y),e[16]=y,e[17]=P):P=e[17];let S;e[18]!==s?(S=ke(s),e[18]=s,e[19]=S):S=e[19];let k;e[20]!==s||e[21]!==f?(k=wo(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]!==x?(v=x?a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:x}):null,e[29]=x,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 D;e[35]!==d||e[36]!==c||e[37]!==u||e[38]!==l||e[39]!==o||e[40]!==f?(D=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:O=>{O.stopPropagation(),l(!1)},children:f("thread.publishDialog.cancel")}),a.jsx("button",{type:"button",className:"text-xs font-medium text-destructive disabled:opacity-50",onClick:O=>{O.stopPropagation(),l(!1),o?.()},disabled:c,children:f("thread.publishPopover.discard")})]}):o?a.jsx(Us,{children:a.jsxs(et,{children:[a.jsx(tt,{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:O=>{O.stopPropagation(),l(!0)},disabled:u||c,children:a.jsx(qs,{className:"size-3.5"})})}),a.jsx(st,{children:f("thread.publishPopover.discard")})]})}):null,e[35]=d,e[36]=c,e[37]=u,e[38]=l,e[39]=o,e[40]=f,e[41]=D):D=e[41];let I;e[42]!==A||e[43]!==D||e[44]!==k?(I=a.jsxs("div",{className:"flex items-center gap-2.5",children:[k,A,D]}),e[42]=A,e[43]=D,e[44]=k,e[45]=I):I=e[45],g=a.jsxs(sa,{className:P,"data-change-id":S,onClick:i,children:[I,w.length>0?a.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-muted-foreground",children:w.map(ko)}):j?a.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px]",children:a.jsx(Ge,{className:"h-4 w-2/3"})}):null]}),e[3]=p,e[4]=s,e[5]=d,e[6]=x,e[7]=c,e[8]=u,e[9]=l,e[10]=o,e[11]=i,e[12]=n,e[13]=f,e[14]=b,e[15]=g}else g=e[15];return g}function ko(t,e){return a.jsx("div",{className:"truncate",children:t},`${e}-${t}`)}function ha(){const t=T.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]=H.useState(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const o=()=>r(c=>c.width===l.clientWidth&&c.height===l.clientHeight?c:{width:l.clientWidth,height:l.clientHeight});o();const u=new ResizeObserver(o);return u.observe(l),()=>u.disconnect()},t[1]=n):n=t[1];const i=n;let d;return t[2]!==s?(d=[s,i],t[2]=s,t[3]=d):d=t[3],d}function No(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}const Co=[{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 Zn(t){const e=T.c(10),{height:s}=t,r=me();let n;e[0]!==s?(n={height:s},e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=Co.map(Ao),e[2]=i):i=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 o;return e[7]!==n||e[8]!==l?(o=a.jsxs("div",{style:n,className:"flex w-full flex-col gap-1.5 overflow-hidden px-3 py-2",children:[i,l]}),e[7]=n,e[8]=l,e[9]=o):o=e[9],o}function Ao(t,e){return a.jsxs("div",{className:q("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:q("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:q("h-2 animate-pulse rounded-sm bg-muted",t.width,t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")})]},e)}const fa={readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12},Ro={...fa,lineNumbersMinChars:3,lineDecorationsWidth:4,folding:!1,glyphMargin:!1,renderOverviewRuler:!1};function Do(t){const e=T.c(11),{diff:s,emptyMessage:r,rowClassName:n,onDiscardFile:i,hideFileRows:d,editorHeight:l}=t,o=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]=H.useState(null),[f,m]=H.useState(null);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=No(),e[0]=x):x=e[0];const g=x;if(!s||Object.keys(s.diffs).length===0){let j;return e[1]!==o?(j=a.jsx("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=j):j=e[2],j}let w;return e[3]!==s.diffs||e[4]!==f||e[5]!==h||e[6]!==p||e[7]!==c||e[8]!==i||e[9]!==u?(w=a.jsx("div",{className:"divide-y",children:Object.entries(s.diffs).map(j=>{const[y,P]=j,{from:S,to:k}=P,N=p===y,C=S===null,v=k===null,A=y.startsWith("/")?y.slice(1):y,D=A.lastIndexOf("/"),I=D>=0?A.slice(D+1):A,O=D>=0?A.slice(0,D):null,F=gi(y),_=C?"bg-success":v?"bg-destructive":"bg-warning";return c?a.jsx("div",{children:a.jsx(Kn,{original:S??"",modified:k??"",language:F,theme:g,height:h,loading:a.jsx(Zn,{height:h}),options:Ro})},y):a.jsxs("div",{children:[a.jsxs("div",{className:q("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(dr,{className:q("h-3.5 w-3.5 transition-transform",N&&"rotate-90")})}),a.jsx("div",{className:q("h-2.5 w-2.5 shrink-0 rounded-full",_)}),a.jsx($r,{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}),O&&a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:O}),i?a.jsxs(_s,{children:[a.jsx(Os,{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($a,{className:"h-3.5 w-3.5"})})}),a.jsx(Ms,{align:"end",children:a.jsx(Zt,{className:"text-destructive focus:text-destructive",onSelect:()=>m(y),children:"Discard changes"})})]}):null]}),f===y&&i?a.jsxs("div",{className:q("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),i(y)},children:"Discard"})]})]}):null,N&&a.jsx("div",{className:"border-t",children:a.jsx(Kn,{original:S??"",modified:k??"",language:F,theme:g,height:h,loading:a.jsx(Zn,{height:h}),options:fa})})]},y)})}),e[3]=s.diffs,e[4]=f,e[5]=h,e[6]=p,e[7]=c,e[8]=i,e[9]=u,e[10]=w):w=e[10],w}function To(t){if(t.kind!=="block"||t.isSiteApp||!t.blockKey)return null;const e=(t.toJson??t.fromJson)?.__resolveType;return typeof e=="string"&&Ol(e)?t.blockKey:null}function Bo(t){return t.kind!=="page"?!0:!t.pagePath||wt(t.pagePath).length>0}function Io(t,e){try{return Ga(t,_l,e)}catch{return null}}function Fo(t,e,s){if(!e)return;const r=Ml(e,t);if(!r)return null;if(wt(r.path).length===0||s?.path!==r.path)return r.path;const n=Pn(r.path,s.params);return wt(n).length===0?n:r.path}function $o(t){return t.sectionKey&&!t.v8?Io(t.previewServerUrl,t.sectionKey):Eo(t.previewServerUrl,t.path)}function Lo(t,e){if(t.kind!=="page")return"/";const s=t.pagePath;if(!s)return"";if(wt(s).length===0)return s;if(e?.path!==s)return"";const r=Pn(s,e.params);return wt(r).length===0?r:""}function Eo(t,e){const s=e.trim();if(!s||wt(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 Oo(t,e){return e?.kind==="pointer"&&e.link?gn(t.toString(),e.link):ma(t,e)}function ma(t,e){if(!e)return null;if(e.kind==="pointer")return gn(t.toString(),e.pointer);try{return new URL(`${t.pathname}${t.search}`,e.previewUrl).href}catch{return null}}function Mo(t,e,s){return e===null?!1:t!=="other"||s?.kind==="sandbox"}function _o(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 pa=H.createContext(!0),zo=["split","before","after","code"];function Uo(t){return zo.includes(t)}const ba={desktop:1280,mobile:412};function Ho(t,e){const s=(i,d)=>t.unreadable?.includes(d)?e:i?`${JSON.stringify(i,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:{[Oa(t.entry.name)]:{from:r,to:n}}}}function ga(t){const e=T.c(76),{change:s,diff:r,bodyPending:n,previewServerUrl:i,draft:d,lastPage:l,v8:o,onReady:u}=t,c=me(),h=H.use(pa),p=To(s),b=o?null:p,f=o?p:null,m=f?Fo(f,o?.blocks,l):void 0,x=f!==null&&m===null,g=Mo(s.kind,i,d)&&(f===null||typeof m=="string"),[w,j]=H.useState(null),y=g?w??"split":"code",[P,S]=H.useState("desktop"),[k,N]=H.useState(null),C=k??(f?m??"":Lo(s,l));let v;e[0]!==s?(v=Bo(s),e[0]=s,e[1]=v):v=e[1];const A=v,D=i?$o({previewServerUrl:i,sectionKey:p,path:C,v8:!!o}):null,I=D?gn(D.toString(),Wa):null,O=D?ma(D,d):null,F=D?Oo(D,d):null;let _;e[2]!==s||e[3]!==r?.diffs||e[4]!==c?(_=s.entry?Ho(s,c("thread.publishCompare.sideUnreadable")):{diffs:Object.fromEntries(s.filepaths.flatMap(Q=>{const de=r?.diffs[Q];return de?[[Q,de]]:[]}))},e[2]=s,e[3]=r?.diffs,e[4]=c,e[5]=_):_=e[5];const $=_;let G;e[6]!==$.diffs?(G=Object.keys($.diffs),e[6]=$.diffs,e[7]=G):G=e[7];const V=G.length>0;let J;e:{if(b!==null){J=null;break e}if(f!==null){const de=C.trim();if(!de){J=null;break e}J=wt(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],J=de;break e}let Q;e[10]!==s.pagePath||e[11]!==c?(Q=s.pagePath&&wt(s.pagePath).length>0?c("thread.publishCompare.dynamicHint",{template:s.pagePath}):null,e[10]=s.pagePath,e[11]=c,e[12]=Q):Q=e[12],J=Q}const L=J,K=_o(s,!!o),[te,X]=H.useState(qo);let ne;e[13]===Symbol.for("react.memo_cache_sentinel")?(ne=Q=>X(de=>de.has(Q)?de:new Set(de).add(Q)),e[13]=ne):ne=e[13];const le=ne;let M;e[14]!==o?(M=Q=>o?a.jsx(Go,{...Q,onLoaded:le}):a.jsx(Vo,{...Q}),e[14]=o,e[15]=M):M=e[15];const Y=M,Z=(g?[K.before==="new"?null:I,K.after==="removed"?null:O].flatMap(Q=>Q?[Dn(Q,P)]:[]):[]).every(Q=>te.has(Q));let se;e[16]!==u||e[17]!==Z?(se=Z&&u?Q=>{Q&&u()}:void 0,e[16]=u,e[17]=Z,e[18]=se):se=e[18];const ie=se,ge=K.before==="new"?a.jsx(ys,{icon:a.jsx(Mr,{className:"size-5 text-brand"}),title:c("thread.publishCompare.newTitle"),description:c("thread.publishCompare.newDescription")}):Y({url:I,device:P,title:c("thread.publishCompare.before"),missing:c("thread.publishCompare.enterPath")}),ue=K.after==="removed"?a.jsx(ys,{icon:a.jsx(qs,{className:"size-5 text-destructive"}),title:c("thread.publishCompare.removedTitle"),description:c("thread.publishCompare.removedDescription")}):Y({url:O,device:P,title:c("thread.publishCompare.after"),missing:c(D?"thread.publishCompare.draftUnavailable":"thread.publishCompare.enterPath")});let re;e[19]!==g||e[20]!==j||e[21]!==h||e[22]!==c||e[23]!==y?(re=g||h?a.jsx(Br,{value:y,onValueChange:Q=>{Uo(Q)&&j(Q)},children:a.jsxs(Tr,{className:"h-8 w-auto",variant:"pill",children:[g?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]=g,e[20]=j,e[21]=h,e[22]=c,e[23]=y,e[24]=re):re=e[24];let fe;e[25]!==F||e[26]!==g||e[27]!==s.pagePath||e[28]!==P||e[29]!==C||e[30]!==A||e[31]!==b||e[32]!==S||e[33]!==N||e[34]!==c||e[35]!==y?(fe=g&&y!=="code"?a.jsxs(a.Fragment,{children:[b?null:A?a.jsx(La,{value:C,onChange:Q=>N(Q.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(er,{active:P==="desktop",label:c("thread.publishCompare.desktop"),onClick:()=>S("desktop"),children:a.jsx(xi,{className:"size-3.5"})}),a.jsx(er,{active:P==="mobile",label:c("thread.publishCompare.mobile"),onClick:()=>S("mobile"),children:a.jsx(ml,{className:"size-3.5"})})]}),F?a.jsxs("a",{href:F,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(Ea,{className:"size-3.5"}),c("thread.publishCompare.openDraft")]}):null]}):null,e[25]=F,e[26]=g,e[27]=s.pagePath,e[28]=P,e[29]=C,e[30]=A,e[31]=b,e[32]=S,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]!==g||e[41]!==L||e[42]!==y?(z=L&&g&&y!=="code"?a.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-2xs text-muted-foreground",children:L}):null,e[40]=g,e[41]=L,e[42]=y,e[43]=z):z=e[43];let oe;e[44]!==x||e[45]!==h||e[46]!==c?(oe=x&&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]=x,e[45]=h,e[46]=c,e[47]=oe):oe=e[47];let xe;e[48]!==i||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(Ge,{className:"m-4 h-64 rounded"}):i===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]=i,e[49]=h,e[50]=c,e[51]=f,e[52]=m,e[53]=y,e[54]=xe):xe=e[54];let W;e[55]!==n||e[56]!==V||e[57]!==$||e[58]!==h||e[59]!==c||e[60]!==y?(W=y==="code"&&h?a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background [scrollbar-width:thin]",children:V?a.jsx(Do,{diff:$,hideFileRows:!0,editorHeight:"70vh"}):n?a.jsx(Ge,{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]=V,e[57]=$,e[58]=h,e[59]=c,e[60]=y,e[61]=W):W=e[61];let ee;e[62]!==ue||e[63]!==ge||e[64]!==g||e[65]!==c||e[66]!==y?(ee=g?a.jsxs("div",{className:q("flex min-h-0 flex-1 gap-3 p-3",y==="code"&&"hidden"),children:[a.jsx(tr,{label:c("thread.publishCompare.before"),hidden:y==="after",children:ge}),a.jsx(tr,{label:c("thread.publishCompare.after"),highlight:!0,hidden:y==="before",children:ue})]}):null,e[62]=ue,e[63]=ge,e[64]=g,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]!==W||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,W,ee]}),e[68]=ie,e[69]=ye,e[70]=z,e[71]=oe,e[72]=xe,e[73]=W,e[74]=ee,e[75]=ce):ce=e[75],ce}function qo(){return new Set}function er(t){const e=T.c(8),{active:s,label:r,onClick:n,children:i}=t,d=s&&"bg-accent text-foreground";let l;e[0]!==d?(l=q("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 o;return e[2]!==s||e[3]!==i||e[4]!==r||e[5]!==n||e[6]!==l?(o=a.jsx("button",{type:"button","aria-label":r,"aria-pressed":s,title:r,onClick:n,className:l,children:i}),e[2]=s,e[3]=i,e[4]=r,e[5]=n,e[6]=l,e[7]=o):o=e[7],o}function tr(t){const e=T.c(18),{label:s,highlight:r,hidden:n,children:i}=t,d=r===void 0?!1:r,o=(n===void 0?!1:n)&&"hidden";let u;e[0]!==o?(u=q("flex min-h-0 min-w-0 flex-1 flex-col gap-1.5",o),e[0]=o,e[1]=u):u=e[1];const c=d&&"bg-brand";let h;e[2]!==c?(h=q("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=q("relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-background",f),e[9]=f,e[10]=m):m=e[10];let x;e[11]!==i||e[12]!==m?(x=a.jsx("div",{className:m,children:i}),e[11]=i,e[12]=m,e[13]=x):x=e[13];let g;return e[14]!==x||e[15]!==u||e[16]!==b?(g=a.jsxs("div",{className:u,children:[b,x]}),e[14]=x,e[15]=u,e[16]=b,e[17]=g):g=e[17],g}function ys(t){const e=T.c(10),{icon:s,title:r,description:n}=t;let i;e[0]!==s?(i=a.jsx("div",{className:"mb-1",children:s}),e[0]=s,e[1]=i):i=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 o;return e[6]!==i||e[7]!==d||e[8]!==l?(o=a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 px-6 text-center",children:[i,d,l]}),e[6]=i,e[7]=d,e[8]=l,e[9]=o):o=e[9],o}function Ko(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 Vo(t){const e=T.c(24),{url:s,device:r,title:n,missing:i}=t,[d,l]=ha(),[o,u]=H.useState(null);if(!s){let S;return e[0]!==i?(S=a.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=S):S=e[1],S}let c;e[2]!==r||e[3]!==s?(c=Dn(s,r),e[2]=r,e[3]=s,e[4]=c):c=e[4];const h=c,p=ba[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 x=d.height>0?d.height/b:"100%",g=`scale(${b})`;let w;e[7]!==p||e[8]!==f||e[9]!==x||e[10]!==g?(w={left:f,width:p,height:x,transform:g,transformOrigin:"top left"},e[7]=p,e[8]=f,e[9]=x,e[10]=g,e[11]=w):w=e[11];let j;e[12]!==h||e[13]!==m||e[14]!==w||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:w},h),e[12]=h,e[13]=m,e[14]=w,e[15]=n,e[16]=j):j=e[16];let y;e[17]!==o||e[18]!==h?(y=o!==h?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:a.jsx(es,{className:"size-5 motion-reduce:animate-none"})}):null,e[17]=o,e[18]=h,e[19]=y):y=e[19];let P;return e[20]!==l||e[21]!==j||e[22]!==y?(P=a.jsxs("div",{ref:l,className:"absolute inset-0",children:[j,y]}),e[20]=l,e[21]=j,e[22]=y,e[23]=P):P=e[23],P}function Go(t){const e=T.c(21),{url:s,device:r,title:n,missing:i,onLoaded:d}=t,[l,o]=ha(),[u,c]=H.useState(null),[h,p]=H.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 P;return e[0]!==i?(P=a.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=P):P=e[1],P}let m,x,g,w;if(e[2]!==f||e[3]!==r||e[4]!==d||e[5]!==o||e[6]!==h||e[7]!==n||e[8]!==s){const P=Dn(s,r),S=ba[r];m=h?.src!==P;const k=[...h&&m?[h]:[],{src:P,logicalWidth:S}];x=o,g="absolute inset-0",w=k.map(N=>{const C=N.src===P&&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===P&&(p(N),d?.(N.src))},className:q("absolute top-0 border-0 bg-white",C&&"pointer-events-none opacity-0"),style:Ko(f,N.logicalWidth)},N.src)}),e[2]=f,e[3]=r,e[4]=d,e[5]=o,e[6]=h,e[7]=n,e[8]=s,e[9]=m,e[10]=x,e[11]=g,e[12]=w}else m=e[9],x=e[10],g=e[11],w=e[12];let j;e[13]!==m||e[14]!==h?(j=m?h?a.jsx(es,{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(es,{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]!==x||e[17]!==g||e[18]!==w||e[19]!==j?(y=a.jsxs("div",{ref:x,className:g,children:[w,j]}),e[16]=x,e[17]=g,e[18]=w,e[19]=j,e[20]=y):y=e[20],y}const Wo=/^Co-authored-by:\s*([^<\r\n]+?)(?:\s*<[^>\r\n]*>)?\s*$/im;function Qo(t){if(!t)return null;const e=Wo.exec(t)?.[1]?.trim();return e||null}function Jo(t){return/\[bot\]$/i.test(t)||/-bot$/i.test(t)}function Xo(t){const e=Qo(t.body);if(e)return e;const s=t.author.trim();return!s||Jo(s)?null:s}function Yo(t,e,s,r,n,i){return["cms-publish-bodies",t,e,s,r,n,i]}const Zo=6e4;function ec(t,e){return e?null:t.files.map(s=>`${s.index}${s.working_dir} ${s.path}`).sort().join(`
3
- `)}function tc(t,e,s){const r=T.c(6);let n;r[0]!==s||r[1]!==t||r[2]!==e?(n=ns.decofile(`${t}/${e}/${s}`),r[0]=s,r[1]=t,r[2]=e,r[3]=n):n=r[3];let i;r[4]!==n?(i={queryKey:n,queryFn:hn},r[4]=n,r[5]=i):i=r[5];const{data:d}=ht(i);return d}function xa(t){const{orgSlug:e,virtualMcpId:s,branch:r,threadId:n,baseBranch:i,fastPreview:d,recoverSandbox:l}=t,o={orgSlug:e,virtualMcpId:s,branch:r,threadId:n},u=d?{fastPreview:!0}:void 0,c=H.useRef(null),h=async P=>{try{return await P()}catch(S){if(!l||!Qr(S))throw S;return c.current??=l(),await c.current,P()}},p=fr({...Nn(o),queryFn:()=>h(()=>Jr(o))}),b=p.data,f=b.changedFiles??null,m=b.headSha??null,x=f?f.length>0:li(b)||ii(b),g=ht({queryKey:Yo(e,s,r,i,m,ec(b,d)),queryFn:()=>h(()=>oi(o,b,i,u)),enabled:x,staleTime:d?Zo:0,gcTime:d?void 0:0,throwOnError:(P,S)=>!f&&S.state.data===void 0}),w=tc(e,s,r),j=g.data??null,y=f?oa({files:f,lookup:w,diff:j}):ho(j);return{status:b,summary:y,allPaths:f?f.map(P=>P.path):Object.keys(j?.diffs??{}),discardablePaths:d?null:new Set(b.files.map(P=>P.path)),changedFilesTotal:b.changedFilesTotal??y.count,changedFilesTruncated:b.changedFilesTruncated??!1,headSha:m,diff:j,bodiesPending:x&&g.isPending,bodiesFailed:g.isError,cardsPending:!f&&x&&g.isPending,refresh:()=>Promise.all([p.refetch(),d?null:g.refetch()])}}function sc(t){const e=T.c(4);let s;e[0]!==t?(s=ns.decofile(t),e[0]=t,e[1]=s):s=e[1];let r;e[2]!==s?(r={queryKey:s,queryFn:hn},e[2]=s,e[3]=r):r=e[3];const{data:n}=ht(r);return n}function nc(t,e){const s=T.c(5);let r;s[0]!==t||s[1]!==e?(r=e?Ja(e,t):ns.liveMeta("","no-scope"),s[0]=t,s[1]=e,s[2]=r):r=s[2];let n;s[3]!==r?(n={queryKey:r,queryFn:hn},s[3]=r,s[4]=n):n=s[4];const{data:i}=ht(n);return i}function Fn(t){const e=T.c(27),{backend:s,cacheKey:r,scope:n}=t,i=mr();let d;e[0]!==r?(d=ns.contentChanges(r),e[0]=r,e[1]=d):d=e[1];let l;e[2]!==s.client||e[3]!==r||e[4]!==i?(l=()=>Xa(i,s.client,r),e[2]=s.client,e[3]=r,e[4]=i,e[5]=l):l=e[5];let o;e[6]!==d||e[7]!==l?(o={queryKey:d,queryFn:l,staleTime:0},e[6]=d,e[7]=l,e[8]=o):o=e[8];const u=fr(o),c=u.data,h=Qa(s,r,c),p=sc(r),b=nc(s,n),f=h.data??null,m=s.source==="github";let x;e[9]!==c.changes||e[10]!==p||e[11]!==b||e[12]!==f||e[13]!==m?(x=yo({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]=x):x=e[14];const g=x;let w;e[15]!==c.changes?(w=Object.entries(c.changes).map(rc),e[15]=c.changes,e[16]=w):w=e[16];const j=g.count>0&&h.isPending,y=p??null;let P;e[17]!==u?(P=()=>u.refetch(),e[17]=u,e[18]=P):P=e[18];let S;return e[19]!==c||e[20]!==h.isError||e[21]!==g||e[22]!==w||e[23]!==j||e[24]!==y||e[25]!==P?(S={changes:c,summary:g,entries:w,sidesPending:j,sidesFailed:h.isError,blocks:y,refresh:P},e[19]=c,e[20]=h.isError,e[21]=g,e[22]=w,e[23]=j,e[24]=y,e[25]=P,e[26]=S):S=e[26],S}function rc(t){const[e,s]=t;return{name:e,version:s.version}}function ac(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function lc(t){const e=T.c(27),{orgSlug:s,virtualMcpId:r,branch:n,threadId:i,fastPreview:d,status:l,diff:o,enabled:u}=t,[c]=pr(),{language:h}=c;let p,b,f;if(e[0]!==n||e[1]!==o||e[2]!==u||e[3]!==d||e[4]!==h||e[5]!==s||e[6]!==l||e[7]!==i||e[8]!==r){const P=o?Cn(o):"";p=u&&!!n&&!!l&&!!o&&P!=="",f=ht,b=ac({orgSlug:s,virtualMcpId:r,branch:n,threadId:i,fastPreview:d,signature:P,language:h}),e[0]=n,e[1]=o,e[2]=u,e[3]=d,e[4]=h,e[5]=s,e[6]=l,e[7]=i,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]!==o||e[14]!==h||e[15]!==s||e[16]!==l||e[17]!==i||e[18]!==r?(m=()=>ci({orgSlug:s,virtualMcpId:r,branch:n,threadId:i},{status:l,diff:o,language:h}),e[12]=n,e[13]=o,e[14]=h,e[15]=s,e[16]=l,e[17]=i,e[18]=r,e[19]=m):m=e[19];let x;e[20]!==p||e[21]!==b||e[22]!==m?(x={queryKey:b,queryFn:m,enabled:p,staleTime:1/0,gcTime:6e5,retry:ic},e[20]=p,e[21]=b,e[22]=m,e[23]=x):x=e[23];const g=f(x),w=g.data??null,j=p&&g.isFetching&&!g.data;let y;return e[24]!==w||e[25]!==j?(y={verdict:w,loading:j},e[24]=w,e[25]=j,e[26]=y):y=e[26],y}function ic(t,e){return!Qr(e)&&t<1}function va(t){const e=T.c(30),{orgSlug:s,virtualMcpId:r,branch:n,threadId:i,fastPreview:d,status:l,diff:o,policy:u,judgeEnabled:c,paths:h}=t,p=c===void 0?!0:c,b=h===void 0?null:h;let f;e[0]!==o||e[1]!==p||e[2]!==u?(f=p&&di(o,u),e[0]=o,e[1]=p,e[2]=u,e[3]=f):f=e[3];const m=f;let x;e[4]!==n||e[5]!==o||e[6]!==d||e[7]!==m||e[8]!==s||e[9]!==l||e[10]!==i||e[11]!==r?(x={orgSlug:s,virtualMcpId:r,branch:n,threadId:i,fastPreview:d,status:l,diff:o,enabled:m},e[4]=n,e[5]=o,e[6]=d,e[7]=m,e[8]=s,e[9]=l,e[10]=i,e[11]=r,e[12]=x):x=e[12];const{verdict:g,loading:w}=lc(x);if(!o&&b){let S;e[13]!==b||e[14]!==u?(S=ui(b,u),e[13]=b,e[14]=u,e[15]=S):S=e[15];let k;return e[16]!==S?(k={gate:S,ready:!1},e[16]=S,e[17]=k):k=e[17],k}if(!o){let S;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S={gate:{allowed:!0,reason:null},ready:!1},e[18]=S):S=e[18],S}if(!m){let S;e[19]!==o||e[20]!==u?(S=hi(o,u),e[19]=o,e[20]=u,e[21]=S):S=e[21];let k;return e[22]!==S?(k={gate:S,ready:!0},e[22]=S,e[23]=k):k=e[23],k}let j;e[24]!==w||e[25]!==g?(j=fi(g,w),e[24]=w,e[25]=g,e[26]=j):j=e[26];const y=!w;let P;return e[27]!==j||e[28]!==y?(P={gate:j,ready:y},e[27]=j,e[28]=y,e[29]=P):P=e[29],P}function oc(t){return["main","master"].includes(t.trim().toLowerCase())}function cc(t,e,s,r){return t===0?r("thread.publishPopover.publish"):s||!oc(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 dc=2500;function uc(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 ya(t){const e=T.c(16),s=H.useRef(!1),r=me();let n;e[0]!==t?(n=h=>{!h&&s.current||t.onOpenChange(h)},e[0]=t,e[1]=n):n=e[1];const i=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(gr,{className:"sr-only",children:d}),e[5]=d,e[6]=l):l=e[6];let o;e[7]!==t?(o=a.jsx(hc,{...t,publishLockRef:s}),e[7]=t,e[8]=o):o=e[8];let u;e[9]!==l||e[10]!==o?(u=a.jsxs(xr,{"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,o]}),e[9]=l,e[10]=o,e[11]=u):u=e[11];let c;return e[12]!==i||e[13]!==t.open||e[14]!==u?(c=a.jsx(br,{open:t.open,onOpenChange:i,children:u}),e[12]=i,e[13]=t.open,e[14]=u,e[15]=c):c=e[15],c}function hc(t){const e=T.c(3),s=St(t.virtualMcpId,t.branch),r=s.kind==="protocol"&&s.source==="github";let n;return e[0]!==r||e[1]!==t?(n=to({open:t.open,hosted:r})?a.jsx(pc,{...t}):null,e[0]=r,e[1]=t,e[2]=n):n=e[2],n}const fc=4,ss="flex h-[45%] min-h-0 min-w-0 shrink-0 md:h-auto md:flex-1";function ms(t){const e=T.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 i;return e[2]!==r||e[3]!==n?(i=a.jsxs(a.Fragment,{children:[r,n]}),e[2]=r,e[3]=n,e[4]=i):i=e[4],i}function $n(){const t=T.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a.jsx("div",{className:q(ss,"bg-muted/40 p-3"),children:a.jsx(Ge,{className:"h-full w-full rounded-lg"})}),t[0]=e):e=t[0],e}function Ln(t){const e=T.c(11),{mode:s,title:r,subLine:n,trailing:i}=t,d=s==="review"?Hs:pl;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 o;e[2]!==l||e[3]!==r||e[4]!==i?(o=a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[l,r,i]}),e[2]=l,e[3]=r,e[4]=i,e[5]=o):o=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]!==o||e[9]!==u?(c=a.jsxs(a.Fragment,{children:[o,u]}),e[8]=o,e[9]=u,e[10]=c):c=e[10],c}function En(t){const e=T.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 i=!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 o;return e[5]!==n||e[6]!==i||e[7]!==l?(o=a.jsxs(ve,{type:"button",variant:"outline",onClick:n,disabled:i,children:[d,l]}),e[5]=n,e[6]=i,e[7]=l,e[8]=o):o=e[8],o}function ja(t){const e=T.c(21),{mode:s,draftPreviewUrl:r}=t,n=me();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx($n,{}),e[0]=i):i=e[0];let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(Ge,{className:"h-3.5 w-48"}),e[1]=d):d=e[1];let l;e[2]!==s?(l=a.jsx(Ln,{mode:s,title:d}),e[2]=s,e[3]=l):l=e[3];let o,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=a.jsx(hs,{children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Bt,{}),a.jsx(Bt,{}),a.jsx(Bt,{})]})}),u=a.jsxs(a.Fragment,{children:[a.jsx(Ge,{className:"h-3 w-20"}),a.jsx(Ge,{className:"h-14 w-full rounded-lg"})]}),e[4]=o,e[5]=u):(o=e[4],u=e[5]);let c;e[6]!==r||e[7]!==n?(c=a.jsx(En,{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:i,list:a.jsx(Gs,{state:"loading",header:l,body:o,note:u,footer:f})}),e[18]=f,e[19]=l,e[20]=m):m=e[20],m}function mc(t){const e=T.c(26),{mode:s,draftPreviewUrl:r,message:n,onRetry:i}=t,d=me();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx("div",{className:q(ss,"bg-muted/40")}),e[0]=l):l=e[0];let o;e[1]!==d?(o=d("thread.publishPopover.loadFailed"),e[1]=d,e[2]=o):o=e[2];let u;e[3]!==o?(u=a.jsx("span",{className:"truncate",children:o}),e[3]=o,e[4]=u):u=e[4];let c;e[5]!==s||e[6]!==u?(c=a.jsx(Ln,{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(En,{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(mn,{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]!==i||e[17]!==f?(m=a.jsxs(ve,{type:"button",variant:"outline",className:"flex-1",onClick:i,children:[b,f]}),e[16]=i,e[17]=f,e[18]=m):m=e[18];let x;e[19]!==p||e[20]!==m?(x=a.jsxs("div",{className:"flex gap-2",children:[p,m]}),e[19]=p,e[20]=m,e[21]=x):x=e[21];let g;return e[22]!==x||e[23]!==c||e[24]!==h?(g=a.jsx(ms,{pane:l,list:a.jsx(Gs,{state:"ready",header:c,body:h,footer:x})}),e[22]=x,e[23]=c,e[24]=h,e[25]=g):g=e[25],g}function pc(t){const e=T.c(3),s=t.mode??"publish";let r;return e[0]!==s||e[1]!==t?(r=a.jsx(vr,{children:n=>{const{reset:i}=n;return a.jsx(yr,{fallback:d=>{const{error:l,resetError:o}=d;return a.jsx(mc,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:l?.message??"",onRetry:()=>{i(),o()}})},children:a.jsx(H.Suspense,{fallback:a.jsx(ja,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),children:a.jsx(bc,{...t})})})}}),e[0]=s,e[1]=t,e[2]=r):r=e[2],r}function bc(t){const e=T.c(13),s=St(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=xn(r);if(s.kind==="protocol"&&n){let d;return e[4]!==s||e[5]!==n||e[6]!==t?(d=s.source==="sandbox"?a.jsx(vc,{...t,backend:s,cacheKey:n}):a.jsx(xc,{...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(ja,{mode:d,draftPreviewUrl:t.draftPreviewUrl}),e[8]=t.draftPreviewUrl,e[9]=d,e[10]=l):l=e[10],l}let i;return e[11]!==t?(i=a.jsx(gc,{...t}),e[11]=t,e[12]=i):i=e[12],i}function gc(t){const e=T.c(52),s=It()?.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=xa(r),i=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]!==i||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:i},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]=i,e[17]=s,e[18]=d):d=e[18];const{gate:l}=va(d),o=n.discardablePaths;let u;e[19]!==o?(u=w=>o===null||w.every(j=>o.has(j)),e[19]=o,e[20]=u):u=e[20];const c=u;let h;e[21]!==c?(h=w=>c(w.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=An(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:Cn(n.diff)}:{},e[30]=t.fastPreview,e[31]=n.diff,e[32]=m):m=e[32];let x;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?(x={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]=x):x=e[48];let g;return e[49]!==t||e[50]!==x?(g=a.jsx(On,{...t,source:x}),e[49]=t,e[50]=x,e[51]=g):g=e[51],g}function wa(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 xc(t){const e=T.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 i;e[4]!==n.branch||e[5]!==n.orgSlug||e[6]!==n.virtualMcpId?(i={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch},e[4]=n.branch,e[5]=n.orgSlug,e[6]=n.virtualMcpId,e[7]=i):i=e[7];let d;e[8]!==s||e[9]!==r||e[10]!==i?(d={backend:s,cacheKey:r,scope:i},e[8]=s,e[9]=r,e[10]=i,e[11]=d):d=e[11];const l=Fn(d),o=s.source==="github";let u;e[12]!==s||e[13]!==l?(u=wa(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]!==o||e[17]!==n.branch||e[18]!==u?(h={...u,gate:c,headBranch:n.branch,hosted:o,otherWork:!1},e[16]=o,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(On,{...n,source:h}),e[20]=n,e[21]=h,e[22]=p):p=e[22],p}function vc(t){const e=T.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 i=It()?.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 o=Fn(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]!==i?(u={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:i,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]=i,e[19]=u):u=e[19];const c=xa(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]!==i?(p={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:i,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]=i,e[30]=p):p=e[30];const{gate:b}=va(p);let f;if(e[31]!==c.allPaths||e[32]!==o){let k;e[34]!==o?(k=N=>{const C=Tn(N);return C===null?!kn(N):!Object.hasOwn(o.changes.changes,C)},e[34]=o,e[35]=k):k=e[35],f=c.allPaths.some(k),e[31]=c.allPaths,e[32]=o,e[33]=f}else f=e[33];const m=f;let x;e[36]!==s||e[37]!==o?(x=wa(o,s),e[36]=s,e[37]=o,e[38]=x):x=e[38];let g;e[39]!==c||e[40]!==o?(g=()=>Promise.all([o.refresh(),c.refresh()]),e[39]=c,e[40]=o,e[41]=g):g=e[41];let w;e[42]!==c.status||e[43]!==n.branch?(w=An(c.status)??n.branch,e[42]=c.status,e[43]=n.branch,e[44]=w):w=e[44];const j=c.headSha??void 0;let y;e[45]!==c.diff?(y=c.diff?{expectedDiffSignature:Cn(c.diff)}:{},e[45]=c.diff,e[46]=y):y=e[46];let P;e[47]!==b||e[48]!==m||e[49]!==j||e[50]!==y||e[51]!==x||e[52]!==g||e[53]!==w?(P={...x,refresh:g,gate:b,headBranch:w,expectedHeadSha:j,...y,hosted:!1,otherWork:m},e[47]=b,e[48]=m,e[49]=j,e[50]=y,e[51]=x,e[52]=g,e[53]=w,e[54]=P):P=e[54];let S;return e[55]!==n||e[56]!==P?(S=a.jsx(On,{...n,source:P}),e[55]=n,e[56]=P,e[57]=S):S=e[57],S}function On(t){const e=T.c(130),{source:s,publishLockRef:r,onOpenChange:n,mode:i,fastPreview:d,orgSlug:l,virtualMcpId:o,branch:u,baseBranch:c,repoTarget:h,owner:p,repo:b,draftPreviewUrl:f,destinationHost:m,previewServerUrl:x,compareDraft:g,lastPublishedPr:w,onRequestApproval:j,openPullRequest:y,onPullRequestChanged:P,onPublished:S}=t,k=i===void 0?"publish":i,N=w===void 0?null:w,C=y===void 0?null:y,v=me(),[A]=pr(),{language:D}=A,I=It()?.taskId??null,{data:O}=zs.useSession(),F=wr(Pr(l,o,u)),{allPaths:_,changedFilesTotal:$,changedFilesTruncated:G,diff:V,bodiesFailed:J,refresh:L,gate:K,hosted:te,otherWork:X}=s;let ne;e[0]!==g||e[1]!==s.bodiesPending||e[2]!==s.cardsPending||e[3]!==s.summary?(ne={summary:s.summary,cardsPending:s.cardsPending,bodiesPending:s.bodiesPending,compareDraft:g},e[0]=g,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 Y=eo(le,M),{summary:B,cardsPending:Z,bodiesPending:se,compareDraft:ie}=Y.shown,[ge,ue]=H.useState(null),[re,fe]=H.useState(!1),[ye,z]=H.useState(yc);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,[W,ee]=H.useState(null);let ce;e[8]===Symbol.for("react.memo_cache_sentinel")?(ce=[],e[8]=ce):ce=e[8];const[Q,de]=H.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),dc)},e[9]=s.v8,e[10]=Me):Me=e[10];const ft=Me,[we,nt]=H.useState(null);let Le;e[11]!==ge||e[12]!==B?(Le=mo(ge,go(B)),e[11]=ge,e[12]=B,e[13]=Le):Le=e[13];const Re=Le,De=[...B.pages,...B.blocks,...B.other],_e=De.find(U=>ke(U)===W)??De[0]??null,Ne=_e?ke(_e):null,rt=[...new Set([...Ne?[Ne]:[],...Q,...De.map(ke)])].filter(U=>De.some(ae=>ke(ae)===U)).slice(0,fc),ze=!!s.v8,[$t,Ee]=H.useState(null),We=ze?uc({selectedId:Ne,readyIds:ye,lastShownId:$t,liveIds:rt}):Ne;ze&&We===Ne&&We!==$t&&Ee(We);const E=k==="review"&&!te,be=Z?"loading":se?"manifest":"ready",Pe=C?.state==="open",Se=s.headBranch,Te=O?.user;let mt;e[14]!==Te?(mt=ta(Te),e[14]=Te,e[15]=mt):mt=e[15];let pt;e[16]!==s.expectedDiffSignature?(pt=s.expectedDiffSignature?{expectedDiffSignature:s.expectedDiffSignature}:{},e[16]=s.expectedDiffSignature,e[17]=pt):pt=e[17];let at;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]!==mt||e[28]!==pt||e[29]!==I||e[30]!==o?(at={orgSlug:l,virtualMcpId:o,branch:u,threadId:I,fastPreview:d,baseBranch:c,target:h,owner:p,repo:b,headBranch:Se,coAuthor:mt,expectedHeadSha:s.expectedHeadSha,...pt},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]=mt,e[28]=pt,e[29]=I,e[30]=o,e[31]=at):at=e[31];const as=at,bt=E?"review":"publish",ls=O?.user?.name;let lt;e[32]!==_||e[33]!==m||e[34]!==te||e[35]!==Re||e[36]!==n||e[37]!==S||e[38]!==P||e[39]!==r||e[40]!==L||e[41]!==s.protocol||e[42]!==bt||e[43]!==ls||e[44]!==as?(lt={mode:bt,target:as,note:Re,allPaths:_,destinationHost:m,publishLockRef:r,onOpenChange:n,refresh:L,onPullRequestChanged:P,onPublished:S,hosted:te,authorName:ls,protocol:s.protocol},e[32]=_,e[33]=m,e[34]=te,e[35]=Re,e[36]=n,e[37]=S,e[38]=P,e[39]=r,e[40]=L,e[41]=s.protocol,e[42]=bt,e[43]=ls,e[44]=as,e[45]=lt):lt=e[45];const{isPublishing:Ce,publishError:it,publishErrorDetail:Lt,submit:gt,discardChange:Qs,discardAll:Et}=Yl(lt),Qe=Cr(l,o).phase==="saving",ot=B.count>0||X,kt=!Ce&&ot&&(E||K.allowed);let ct;e[46]!==c||e[47]!==E||e[48]!==s.v8||e[49]!==B.count||e[50]!==v?(ct=E?B.count===0?v("thread.publishPopover.submitForReview"):B.count===1?v("thread.publishPopover.submitOneForReview"):v("thread.publishPopover.submitCountForReview",{count:B.count}):cc(B.count,c,!!s.v8,v),e[46]=c,e[47]=E,e[48]=s.v8,e[49]=B.count,e[50]=v,e[51]=ct):ct=e[51];const is=ct;let xt;e:{if(E&&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],xt=he;break e}const U=N;if(!U?.mergedAt){xt=null;break e}let ae;if(e[55]!==D||e[56]!==U||e[57]!==v){const he=Ma(new Date(U.mergedAt),D),je=Xo(U);ae=je?v("thread.publishPopover.lastPublishedBy",{when:he,name:je}):v("thread.publishPopover.lastPublished",{when:he}),e[55]=D,e[56]=U,e[57]=v,e[58]=ae}else ae=e[58];xt=ae}const Nt=xt;let Ct;e[59]!==E||e[60]!==B.count||e[61]!==v?(Ct=E?v("thread.publishPopover.submitForReview"):B.count===1?v("thread.publishPopover.publishOne"):B.count>1?v("thread.publishPopover.publishCount",{count:B.count}):v("thread.publishPopover.publish"),e[59]=E,e[60]=B.count,e[61]=v,e[62]=Ct):Ct=e[62];const vt=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(ua,{change:he,bodyPending:se,selected:_e!==null&&ke(_e)===je,onSelect:()=>ft(je),confirming:we===je,onConfirmingChange:Ae=>nt(Ae?je:null),onDiscard:s.canDiscard(he)?()=>{Qs(he)}:void 0,isPublishing:Ce,isDiscarding:Qe,v8:!!s.v8},je)})]});let Je;e:{if(E||!ot){Je=null;break e}if(K.pending){let je;e[63]===Symbol.for("react.memo_cache_sentinel")?(je=a.jsx(es,{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],Je=Ke;break e}if(K.allowed){Je=null;break e}let U;e[68]===Symbol.for("react.memo_cache_sentinel")?(U=a.jsx(fn,{className:"mt-0.5 size-3.5 shrink-0"}),e[68]=U):U=e[68];let ae;e[69]!==K.reason||e[70]!==v?(ae=K.reason??v("thread.publishPopover.needsReviewGeneric"),e[69]=K.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],Je=he}const yt=Je;let dt;e[74]!==Et||e[75]!==re||e[76]!==Qe||e[77]!==Ce||e[78]!==s.canDiscardAll||e[79]!==B.count||e[80]!==v?(dt=B.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||Qe,children:v("thread.publishPopover.discardAll")}),a.jsx(Bs,{open:re,onOpenChange:fe,children:a.jsxs(Ts,{children:[a.jsxs(Cs,{children:[a.jsx(ks,{children:v("thread.publishPopover.discardAllTitle")}),a.jsx(Ns,{children:v("thread.publishPopover.discardAllConfirm")})]}),a.jsxs(Ds,{children:[a.jsx(As,{children:v("thread.publishDialog.cancel")}),a.jsx(Rs,{onClick:()=>{Et()},disabled:Qe,className:q(jr({variant:"destructive"})),children:v("thread.publishPopover.discardAll")})]})]})})]}),e[74]=Et,e[75]=re,e[76]=Qe,e[77]=Ce,e[78]=s.canDiscardAll,e[79]=B.count,e[80]=v,e[81]=dt):dt=e[81];const Rt=dt,os=Z?a.jsx(hs,{children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Bt,{}),a.jsx(Bt,{})]})}):B.count===0&&X?a.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:v("thread.publishPopover.onlyOtherWork")}):B.count===0?a.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[a.jsx(Sn,{className:"mb-1 size-5 text-success"}),a.jsx("p",{className:"text-sm font-medium",children:v(E?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:v(E?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):a.jsxs(hs,{children:[G?a.jsx("p",{className:"text-2xs text-muted-foreground",children:v("thread.publishPopover.showingFirst",{shown:B.count,total:$})}):null,At(v("thread.publishPopover.pagesGroup"),B.pages),At(v("thread.publishPopover.blocksGroup"),B.blocks),At(v("thread.publishPopover.otherGroup"),B.other),J?a.jsx("p",{className:"text-2xs text-muted-foreground",children:v("thread.publishPopover.detailsUnavailable")}):null,X?a.jsx("p",{className:"text-2xs text-muted-foreground",children:v("thread.publishPopover.alsoOtherWork")}):null]}),cs=Z?a.jsx($n,{}):_e?a.jsx("div",{className:q(ss,"relative"),children:De.filter(U=>rt.includes(ke(U))).map(U=>a.jsx("div",{className:q("absolute inset-0 flex",ze?ke(U)===We?"z-10":"pointer-events-none opacity-0":ke(U)!==Ne&&"hidden"),inert:ze&&ke(U)!==We,"aria-hidden":ze&&ke(U)!==We?!0:void 0,children:a.jsx(ga,{change:U,diff:V,bodyPending:se,previewServerUrl:x,draft:ie,lastPage:F,v8:s.v8,onReady:ze?()=>xe(ke(U)):void 0})},ke(U)))}):a.jsx("div",{className:q(ss,"bg-muted/40")});let Be;e[82]!==is?(Be=a.jsx("span",{className:"truncate",children:is}),e[82]=is,e[83]=Be):Be=e[83];let Ie;e[84]!==Rt||e[85]!==k||e[86]!==Nt||e[87]!==Be?(Ie=a.jsx(Ln,{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]!==E||e[91]!==Re||e[92]!==B.count||e[93]!==v?(Xe=B.count===0?null:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm font-medium",children:v(E?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),a.jsx(Gl,{value:Re,onChange:U=>ue(U.target.value),placeholder:v(E?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,maxLength:Zl,className:"resize-none text-sm",disabled:Ce})]}),e[89]=Ce,e[90]=E,e[91]=Re,e[92]=B.count,e[93]=v,e[94]=Xe):Xe=e[94];let Ue;e[95]!==f||e[96]!==v?(Ue=a.jsx(En,{draftPreviewUrl:f,t:v}),e[95]=f,e[96]=v,e[97]=Ue):Ue=e[97];let jt;e[98]!==kt||e[99]!==K||e[100]!==ot||e[101]!==te||e[102]!==Ce||e[103]!==E||e[104]!==j||e[105]!==vt||e[106]!==Y||e[107]!==gt||e[108]!==v?(jt=!E&&!te&&ot&&!K.allowed&&!K.pending?a.jsx(ve,{type:"button",className:"flex-1",onClick:j,disabled:Ce,children:v("thread.publishPopover.requestApproval")}):a.jsxs(ve,{type:"button",variant:E?"default":"brand",className:"flex-1",onClick:()=>{Y.hold(),gt().then(U=>{U===!1&&Y.release()})},disabled:!kt,children:[Ce?a.jsx(es,{className:"size-4 motion-reduce:animate-none"}):null,Ce?v(E?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):vt]}),e[98]=kt,e[99]=K,e[100]=ot,e[101]=te,e[102]=Ce,e[103]=E,e[104]=j,e[105]=vt,e[106]=Y,e[107]=gt,e[108]=v,e[109]=jt):jt=e[109];let Ye;e[110]!==Ue||e[111]!==jt?(Ye=a.jsxs("div",{className:"flex gap-2",children:[Ue,jt]}),e[110]=Ue,e[111]=jt,e[112]=Ye):Ye=e[112];let He;e[113]!==it||e[114]!==Lt||e[115]!==v?(He=it?a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-destructive",children:it}),Lt?a.jsx(Ya,{label:v("siteEditor.details"),detail:Lt}):null]}):null,e[113]=it,e[114]=Lt,e[115]=v,e[116]=He):He=e[116];let Fe;e[117]!==Ye||e[118]!==He?(Fe=a.jsxs(a.Fragment,{children:[Ye,He]}),e[117]=Ye,e[118]=He,e[119]=Fe):Fe=e[119];let $e;e[120]!==os||e[121]!==yt||e[122]!==be||e[123]!==Ie||e[124]!==Xe||e[125]!==Fe?($e=a.jsx(Gs,{state:be,header:Ie,body:os,note:Xe,gate:yt,footer:Fe}),e[120]=os,e[121]=yt,e[122]=be,e[123]=Ie,e[124]=Xe,e[125]=Fe,e[126]=$e):$e=e[126];let qe;return e[127]!==cs||e[128]!==$e?(qe=a.jsx(ms,{pane:cs,list:$e}),e[127]=cs,e[128]=$e,e[129]=qe):qe=e[129],qe}function yc(){return new Set}function jc(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return zl[t].short}const wc=new Set(["failure","timed_out","cancelled","action_required"]);function Pa(t){return t.status==="completed"&&wc.has(t.conclusion)}function Mn(t){return t.status==="queued"||t.status==="in_progress"}function Ss(t){return t.isPending&&t.fetchStatus!=="idle"}function Pc(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr-page"}}function ut(t,e,s){return e?[...t,Pc(s)]:t}function Ve(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 sr(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function js(t,e,s){if(e.filter(Mn).length===0)return t;const n=e.filter(i=>i.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:n,total:e.length})}}function Sc(t){const{lifecycle:e,branch:s,pr:r,checks:n,reviews:i,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&&jc(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 o=s,u=o.unpushed>0&&!(r&&o.headSha&&r.headSha&&o.headSha===r.headSha);if(t.noReviewableDiff&&!r)return{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:o.base}),menu:Ve([],o,l)};if(o.workingTreeDirty||u)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ve(ut([sr(l)],r,l),o,l)};if(Zr("no local work — checking PR/sync state",{workingTreeDirty:o.workingTreeDirty,unpushed:o.unpushed,aheadOfBase:o.aheadOfBase,behindBase:o.behindBase,branch:o.branch,base:o.base,prMerged:r?.merged??null,prState:r?.state??null}),r?.merged)return!!o.headSha&&!!r.headSha&&o.headSha!==r.headSha?{label:l("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:l("thread.headerActions.openNewPrTooltip"),menu:Ve(ut([],r,l),o,l)}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.prMergedTooltip",{prNumber:String(r.number),base:r.base}),menu:Ve(ut([],r,l),o,l)};if(o.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:Ve(ut([],r,l),o,l)};if(!r)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ve([sr(l)],o,l)};if((i?.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(Mn).length,p=n.filter(Pa).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:Ve(ut([{key:"publish-anyway",label:l("thread.headerActions.publishAnyway"),action:"merge",tooltip:l("thread.headerActions.squashMergeTooltip",{prNumber:String(r.number),base:r.base})}],r,l),o,l)};if(i?.draft)return js({label:l("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:l("thread.headerActions.markDraftReadyTooltip"),menu:Ve(ut([],r,l),o,l)},n,l);const b=i?.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:Ve(ut([],r,l),o,l)},n,l):i?.missingRequiredApprovals?js({label:l("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:l("thread.headerActions.waitingForApprovalsTooltip"),menu:Ve(ut([],r,l),o,l)},n,l):js({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:Ve(ut([{key:"review",label:l("thread.headerActions.review"),action:"review"}],r,l),o,l)},n,l)}return o.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:o.base}),menu:[]}}function nr(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 rr(t,e,s,r){const n=e.length;if(n===0)return t;if(e.filter(Mn).length>0){const l=e.filter(u=>u.status==="completed").length,o=r("thread.cmsActions.checksRunning",{done:l,total:n});return s==="loading"?{...t,loading:!0,tooltip:o}:{...t,tooltip:o}}const d=e.filter(Pa).length;return d>0?{...t,variant:"warning",tooltip:r("thread.cmsActions.checksFailing",{failed:d,total:n})}:t}function kc(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function Nc(t){return Ss(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:Ss(t.checksQuery)||Ss(t.reviewsQuery)}function Cc(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function Ac(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 Rc(t){return{...t,menu:[]}}function Dc(t){const{branch:e,pr:s,checks:r,reviews:n,publishing:i,saving:d,loading:l,publishableChangeCount:o,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(i)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?rr({label:u("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:ws([nr(u)],e,u)},r,"loading",u):rr({label:u("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ws([nr(u)],e,u)},r,"none",u)}return kc(s,e)?{label:u("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:ws([],e,u)}:Cc(e,o)?{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 Tc(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function Sa(t){const e=T.c(4);let s;e[0]!==t?(s=Sl(t),e[0]=t,e[1]=s):s=e[1];let r;return e[2]!==s?(r={...s,select:Bc},e[2]=s,e[3]=r):r=e[3],ht(r)}function Bc(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:Tc(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function ar(t,e){return t==="open-pr"||e==="resolve-on-provider"?a.jsx(Gr,{size:16}):t==="publish"?a.jsx(Lr,{className:"size-4"}):t==="get-latest"||t==="retry-status"?a.jsx(mn,{className:"size-4"}):a.jsx(Hs,{className:"size-4"})}function Ic(t){const e=T.c(63),{virtualMcpId:s}=t,r=me(),{org:n}=rs(),i=mr(),d=Ks(s),{data:l}=zs.useSession(),{deleteRelease:o}=Vs(s),{currentBranch:u,setCurrentTaskBranch:c,taskId:h,createTask:p}=Sr();let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={open:!1,mode:"publish"},e[0]=b):b=e[0];const[f,m]=H.useState(b);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=E=>m({open:!0,mode:E}),e[1]=x):x=e[1];const g=x,w=Ur(d),j=w.status==="attached"||w.status==="public-clone"?w.repo:null,{previewServerUrl:y}=fs(s),P=u?wr(Pr(n.slug,s,u)):null,S=P?Pn(P.path,P.params):"/",k=Tl(u?{orgSlug:n.slug,virtualMcpId:s,branch:u,previewServerUrl:y,path:S}: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=Bl(N),v=St(s,u),A=v.kind==="protocol"&&v.source==="github";let D;e[6]!==u||e[7]!==n.slug||e[8]!==s?(D=u?{orgSlug:n.slug,virtualMcpId:s,branch:u}:null,e[6]=u,e[7]=n.slug,e[8]=s,e[9]=D):D=e[9];const I=xn(D),O=Ar(A?v:null,I);let F;e[10]!==n.slug||e[11]!==s?(F=Za(n.slug,s),e[10]=n.slug,e[11]=s,e[12]=F):F=e[12];const _=el(F,A?C:null),$=A?tl(y,S,_):k.url,G=u??"",V=h??null;let J;e[13]!==n.slug||e[14]!==G||e[15]!==V||e[16]!==s?(J=Nn({orgSlug:n.slug,virtualMcpId:s,branch:G,threadId:V}),e[13]=n.slug,e[14]=G,e[15]=V,e[16]=s,e[17]=J):J=e[17];const L=!!u&&v.kind!=="pending"&&!A;let K;e[18]!==J||e[19]!==L?(K={...J,enabled:L},e[18]=J,e[19]=L,e[20]=K):K=e[20];const te=ht(K),X=A?null:te.data??null,ne=A?Ac(O.data,u??""):null,le=ne?ne.branchMeta:X?{kind:"ready",branch:An(X)??u??"",base:X.base??"main",workingTreeDirty:mi(X),unpushed:X.unpushed??0,aheadOfBase:X.aheadOfBase??0,behindBase:X.behindBase??0,headSha:X.headSha??""}:{kind:"unknown"},M=ne?ne.publishableChangeCount:X?.changedFiles?oa({files:X.changedFiles}).count:null,Y=A?O:te,B=(le.kind==="ready"?le.branch:null)??u??null,Z=le.kind==="ready"?le.base:"main",se=Hr({orgId:n.id,orgSlug:n.slug,target:Oe(j),owner:j?.owner??"",repo:j?.name??"",branch:B}),ie=se.data??null,ge=qr({orgId:n.id,orgSlug:n.slug,target:Oe(j),owner:j?.owner??"",repo:j?.name??"",base:Z}),ue=Kr({orgId:n.id,orgSlug:n.slug,target:Oe(j),owner:j?.owner??"",repo:j?.name??"",branch:B}),re=Sa({orgId:n.id,orgSlug:n.slug,target:Oe(j),owner:j?.owner??"",repo:j?.name??"",branch:B});let fe;e[21]!==ue||e[22]!==ie||e[23]!==se||e[24]!==re?(fe=Nc({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=zn({mutationFn:()=>Yi({hosted:A,branch:u,baseBranch:Z,nextBranch:()=>vn(yn(l?.user)),setCurrentTaskBranch:c,deleteRelease:o}),onError:Lc});let W;e[28]!==n.slug||e[29]!==h||e[30]!==s?(W=async E=>(await pi({orgSlug:n.slug,virtualMcpId:s,branch:E.branch,threadId:h??null},E.base),E),e[28]=n.slug,e[29]=h,e[30]=s,e[31]=W):W=e[31];let ee;e[32]!==u||e[33]!==n.slug||e[34]!==i||e[35]!==r||e[36]!==h||e[37]!==s?(ee=async E=>{Ze.success(r("thread.headerActions.syncedWithBase",{base:E.base})),await Promise.all([i.invalidateQueries({queryKey:Rn({orgSlug:n.slug,virtualMcpId:s,branch:u??E.branch,threadId:h??null})}),i.invalidateQueries({queryKey:ns.decofile(`${n.slug}/${s}/${E.branch}`)})])},e[32]=u,e[33]=n.slug,e[34]=i,e[35]=r,e[36]=h,e[37]=s,e[38]=ee):ee=e[38];let ce;e[39]!==W||e[40]!==ee?(ce={mutationFn:W,onSuccess:ee,onError:$c},e[39]=W,e[40]=ee,e[41]=ce):ce=e[41];const Q=zn(ce),de=Rr(n.slug,s),Me=xe.isPending,ft=Dc({branch:le,pr:ie,checks:ue.data??[],reviews:re.data??null,publishing:Me,saving:de,syncing:Q.isPending,statusRetrying:Y.isFetching&&!!Y.error,statusError:Y.error instanceof Error?Y.error.message:Y.error?String(Y.error):null,loading:!!ye,publishableChangeCount:M,t:r}),we=A?Rc(ft):ft,nt=we.autoRun&&le.kind==="ready"&&j&&y?`${B}@${le.headSha}`:null,Le=H.useRef(null);if(H.useEffect(()=>{!nt||!B||Le.current!==nt&&(Le.current=nt,Q.mutate({branch:B,base:Z}))},[nt,B,Z,Q]),w.status==="detached"){let E;e[42]!==r?(E=r("thread.headerActions.reconnectGithub"),e[42]=r,e[43]=E):E=e[43];let be;e[44]!==E?(be=a.jsx(tt,{asChild:!0,children:a.jsx("span",{children:a.jsx(ve,{size:"sm",variant:"outline",disabled:!0,children:E})})}),e[44]=E,e[45]=be):be=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(st,{children:Pe}),e[48]=Pe,e[49]=Se):Se=e[49];let Te;return e[50]!==be||e[51]!==Se?(Te=a.jsx(Us,{children:a.jsxs(et,{children:[be,Se]})}),e[50]=be,e[51]=Se,e[52]=Te):Te=e[52],Te}if(!d)return null;if(!j||!y){const E=j?"noPreviewServer":"noRepo";let be;e[53]!==u||e[54]!==p?(be=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]=be):be=e[55];let Pe;return e[56]!==E||e[57]!==be?(Pe=a.jsx(Ec,{reason:E,onStartCodingSession:be}),e[56]=E,e[57]=be,e[58]=Pe):Pe=e[58],Pe}if(!u)return null;const Re=E=>{switch(E){case"publish":{g("publish");return}case"request-approval":{g("review");return}case"get-latest":{if(!B||Q.isPending)return;Q.mutate({branch:B,base:Z});return}case"retry-status":{Y.refetch();return}case"open-pr":{ie?.htmlUrl&&window.open(ie.htmlUrl,"_blank","noopener,noreferrer");return}}};let De;e[59]!==Re?(De=E=>({key:E.key,label:E.label,icon:ar(E.action,E.key),...E.tooltip?{tooltip:E.tooltip}:{},onSelect:()=>Re(E.action)}),e[59]=Re,e[60]=De):De=e[60];const _e=we.menu.map(De),Ne=we.action,rt=we.label,ze=we.variant,$t=!!we.loading;let Ee;e[61]!==r?(Ee=r("thread.cmsActions.moreActionsAriaLabel"),e[61]=r,e[62]=Ee):Ee=e[62];const We=a.jsx(ea,{size:"sm",label:rt,variant:ze,disabled:!!we.disabled||!Ne,loading:$t,...Ne&&!we.loading?{icon:ar(Ne)}:{},...we.tooltip?{tooltip:we.tooltip}:{},items:_e,menuAriaLabel:Ee,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,We,u?a.jsx(ya,{open:f.open,mode:f.mode,fastPreview:!0,onOpenChange:E=>{E||m(Fc)},orgSlug:n.slug,virtualMcpId:s,branch:u,baseBranch:Z,repoTarget:Oe(j),owner:j.owner,repo:j.name,publishPolicy:Xr(d?.metadata?.publishPolicy),draftPreviewUrl:$,destinationHost:k.host,previewServerUrl:y,compareDraft:C?{kind:"pointer",pointer:C,..._?{link:_}:{}}:null,lastPublishedPr:ge.data??null,onRequestApproval:()=>g("review"),openPullRequest:ie?.state==="open"?ie:null,onPullRequestChanged:oe,onPublished:()=>xe.mutateAsync()}):null]})}function Fc(t){return{...t,open:!1}}function $c(t){Ze.error(t instanceof Error?t.message:String(t))}function Lc(t){console.error("site editor: settling after publish failed",t)}function Ec(t){const e=T.c(14),{reason:s,onStartCodingSession:r}=t,n=me(),i=!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]!==i||e[4]!==d?(l=a.jsx(tt,{asChild:!0,children:a.jsx("span",{children:a.jsx(ve,{size:"sm",variant:"outline",disabled:i,onClick:r,children:d})})}),e[2]=r,e[3]=i,e[4]=d,e[5]=l):l=e[5];let o;e[6]!==s||e[7]!==n?(o=n(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=n,e[8]=o):o=e[8];let u;e[9]!==o?(u=a.jsx(st,{children:o}),e[9]=o,e[10]=u):u=e[10];let c;return e[11]!==l||e[12]!==u?(c=a.jsx(Us,{children:a.jsxs(et,{children:[l,u]})}),e[11]=l,e[12]=u,e[13]=c):c=e[13],c}const Ft="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 Oc(t){return`Reopen PR #${t.prNumber}. ${Ft}`}function Mc(t){return`Rebase \`${t.branch}\` on the latest base and force-push with --force-with-lease. ${Ft}`}function _c(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). ${Ft}`}function zc(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. ${Ft}`}function Uc(t){return`Mark PR #${t.prNumber} ready for review. ${Ft}`}function Hc(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. ${Ft}`}function qc(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. ${Ft}`}function lr(t){switch(t){case"publish":return a.jsx(Lr,{className:"size-4"});case"create-pr":case"reopen":return a.jsx(Hs,{className:"size-4"});case"rebase":case"sync":return a.jsx(mn,{className:"size-4"});case"fix-checks":return a.jsx(fn,{className:"size-4"});case"mark-ready":return a.jsx(Sn,{className:"size-4"});case"resolve-comments":return a.jsx(bl,{className:"size-4"});case"merge":return a.jsx(ai,{className:"size-4"});case"review":return a.jsx(Is,{className:"size-4"});case"open-pr-page":return a.jsx(Gr,{size:16})}}const ir=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),or=new Set(["publish","create-pr"]);function Kc(t){const e=T.c(44),{t:s,button:r,actionBusy:n,changeRequestPending:i,savePending:d,onAction:l}=t,o=r.action;let u;e[0]!==o||e[1]!==n?(u=n&&o!==void 0&&ir.has(o),e[0]=o,e[1]=n,e[2]=u):u=e[2];const c=u,h=i&&o==="merge";let p;e[3]!==o||e[4]!==d?(p=d&&o!==void 0&&or.has(o),e[3]=o,e[4]=d,e[5]=p):p=e[5];const b=p,f=!!r.disabled||c||h||b||!o,m=!!r.loading||h;let x;e[6]!==r.tooltip||e[7]!==c||e[8]!==b||e[9]!==s?(x=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]=x):x=e[10];const g=x;let w;if(e[11]!==n||e[12]!==r.menu||e[13]!==i||e[14]!==l||e[15]!==d||e[16]!==s){let A;e[18]!==n||e[19]!==i||e[20]!==l||e[21]!==d||e[22]!==s?(A=D=>{const I=n&&ir.has(D.action),O=d&&or.has(D.action),F=D.action==="merge"&&i,_=O?s("thread.headerActions.saving"):I?s("thread.headerActions.chatIsRunning"):D.tooltip;return{key:D.key,label:D.label,icon:lr(D.action),disabled:!!(I||O||F),..._?{tooltip:_}:{},onSelect:()=>l(D.action)}},e[18]=n,e[19]=i,e[20]=l,e[21]=d,e[22]=s,e[23]=A):A=e[23],w=r.menu.map(A),e[11]=n,e[12]=r.menu,e[13]=i,e[14]=l,e[15]=d,e[16]=s,e[17]=w}else w=e[17];const j=w,y=r.label,P=r.variant;let S;e[24]!==o||e[25]!==m?(S=o&&!m?{icon:lr(o)}:{},e[24]=o,e[25]=m,e[26]=S):S=e[26];let k;e[27]!==g?(k=g?{tooltip:g}:{},e[27]=g,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]!==o||e[32]!==l?(C=o?()=>l(o):void 0,e[31]=o,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]!==S||e[40]!==k||e[41]!==N||e[42]!==C?(v=a.jsx(ea,{size:"sm",label:y,variant:P,disabled:f,loading:m,...S,...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]=S,e[40]=k,e[41]=N,e[42]=C,e[43]=v):v=e[43],v}function cr(t){const e=T.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(tt,{asChild:!0,children:a.jsx("span",{children:r})}),e[2]=r,e[3]=n):n=e[3];let i;e[4]!==s?(i=a.jsx(st,{children:s}),e[4]=s,e[5]=i):i=e[5];let d;return e[6]!==n||e[7]!==i?(d=a.jsx(Us,{children:a.jsxs(et,{children:[n,i]})}),e[6]=n,e[7]=i,e[8]=d):d=e[8],d}function Vc(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function Gc({virtualMcpId:t}){const e=me(),{org:s}=rs(),{data:r}=zs.useSession(),n=Ks(t),{deleteRelease:i}=Vs(t),{currentBranch:d,setCurrentTaskBranch:l,createTask:o,taskId:u}=Sr(),c=Ka(),{openSidePanel:h}=ll(),[p,b]=H.useState({open:!1,mode:"publish",policyOverride:null}),f=vi({connectionId:za,orgId:s.id,orgSlug:s.slug}),m=yi(f),[x,g]=H.useState(!1),w=H.useRef(""),j=Ur(n),y=j.status==="attached"||j.status==="public-clone"?j.repo:null,{lifecycle:P,branch:S,phase:k}=Vl(),N={orgSlug:s.slug,virtualMcpId:t,branch:d??"",threadId:u??null},v=ht({queryKey:Rn(N),queryFn:()=>Jr(N),enabled:!!d,staleTime:15e3,refetchInterval:W=>Ys(W.state.data)?5e3:!1}).data??null,A=S,D=P,I=A.kind==="ready"?A.branch:null,O=d??I??void 0,F=(A.kind==="ready"?A.branch:null)??O??null,_=Hr({orgId:s.id,orgSlug:s.slug,target:Oe(y),owner:y?.owner??"",repo:y?.name??"",branch:F}),$=_.data??null,G=Kr({orgId:s.id,orgSlug:s.slug,target:Oe(y),owner:y?.owner??"",repo:y?.name??"",branch:F}),V=Sa({orgId:s.id,orgSlug:s.slug,target:Oe(y),owner:y?.owner??"",repo:y?.name??"",branch:F}),J=qr({orgId:s.id,orgSlug:s.slug,target:Oe(y),owner:y?.owner??"",repo:y?.name??"",base:A.kind==="ready"?A.base:null}),L=A,K=Xr(n?.metadata?.publishPolicy),te=Rr(s.slug,t),{previewUrl:X}=ji(),{previewServerUrl:ne,projectDefault:le}=fs(t);if(j.status==="detached")return a.jsx(cr,{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=F?Sc({lifecycle:D,branch:L,claimPhase:k,pr:$,checks:G.data??[],reviews:V.data??null,noReviewableDiff:Ys(v),loading:Ss(_),t:e}):Vc(e),Y=JSON.stringify({label:M.label,branchKind:L.kind,workingTreeDirty:L.kind==="ready"?L.workingTreeDirty:null,unpushed:L.kind==="ready"?L.unpushed:null,aheadOfBase:L.kind==="ready"?L.aheadOfBase:null,lifecycle:D.phase,headBranch:F,noReviewableDiff:Ys(v)});w.current!==Y&&(w.current=Y,Zr("header button",{label:M.label,tooltip:M.tooltip,action:M.action,chatBranch:d,sandboxBranch:I,sandboxRouteBranch:O,headBranch:F,branchMeta:A,effectiveBranchMeta:L,lifecyclePhase:D.phase,prNumber:$?.number??null,prState:$?.state??null}));const B=W=>(h(),c.sendMessage({parts:[{type:"text",text:W}]})),Z=c.isStreaming,se=L.kind==="ready"?L.base:"main",ie=async()=>{await _.refetch()},ge=async()=>{const W=d,ee=vn(yn(r?.user));le==="cms"?o({runtime:"cms",branch:ee}):await l(ee),W&&W!==se&&await i(W)},ue=async W=>{if(!(!y||x)){g(!0);try{const ee=ta(r?.user);await ei(s.slug,Oe(y),{number:W,coAuthor:ee}),Ze.success(e("thread.headerActions.publishedPr",{prNumber:String(W)})),await ie(),await ge()}catch(ee){Ze.error(ee instanceof ti?ee.detail??si(ee.reason,e):ee instanceof Error?ee.message:e("thread.headerActions.failedToMergePullRequest"))}finally{g(!1)}}},re=(W,ee)=>b({open:!0,mode:W,policyOverride:ee}),fe=W=>{if(F)switch(W){case"publish":re("publish",M.meta?.publishPolicyOverride??null);return;case"create-pr":re("review",null);return;case"merge":$&&ue($.number);return;case"sync":if(Z)return;B(_c({branch:F,base:se}));return;case"open-pr-page":$?.htmlUrl&&window.open($.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(Z)return;$&&B(qc({prNumber:$.number}));return;case"reopen":if(Z)return;$&&B(Oc({prNumber:$.number}));return;case"rebase":if(Z)return;B(Mc({branch:F}));return;case"fix-checks":if(Z)return;$&&B(zc({prNumber:$.number,failingChecks:M.meta?.failingChecks??[]}));return;case"mark-ready":if(Z)return;$&&B(Uc({prNumber:$.number}));return;case"resolve-comments":if(Z)return;$&&B(Hc({prNumber:$.number}));return}},ye=x||Z,z=a.jsx(Kc,{t:e,button:M,actionBusy:ye,changeRequestPending:x,savePending:te,onAction:fe}),oe=L.kind==="ready"&&L.pushError&&L.pushFailingSince?e("thread.headerActions.pushFailing",{since:new Date(L.pushFailingSince).toLocaleString(),error:L.pushError}):null,xe=oe?a.jsx(cr,{label:oe,children:a.jsx(fn,{role:"img","aria-label":oe,className:"size-4 text-warning"})}):null;return O?a.jsxs(a.Fragment,{children:[xe,z,a.jsx(ya,{open:p.open,mode:p.mode,fastPreview:!1,recoverSandbox:()=>m.mutateAsync({virtualMcpId:t,branch:O,...u?{threadId:u}:{}}),onOpenChange:W=>{W||b(ee=>({...ee,open:!1}))},orgSlug:s.slug,virtualMcpId:t,branch:O,baseBranch:se,repoTarget:Oe(y),owner:y.owner,repo:y.name,publishPolicy:p.policyOverride??K,draftPreviewUrl:X,destinationHost:null,previewServerUrl:ne,compareDraft:X?{kind:"sandbox",previewUrl:X}:null,lastPublishedPr:J.data??null,onRequestApproval:()=>b(W=>({...W,open:!0,mode:"review"})),openPullRequest:$?.state==="open"?$:null,onPullRequestChanged:ie,onPublished:ge})]}):a.jsxs(a.Fragment,{children:[xe,z]})}function Wc(t){const e=T.c(33),{orgSlug:s,virtualMcpId:r,branch:n}=t,i=me(),[d,l]=H.useState(!1),o=St(r,n),u=o.kind==="protocol"&&o.source==="local"?o: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=xn(c),{data:p}=Ar(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 x;e[7]!==f||e[8]!==i?(x=f>0?i("decoServe.changes.buttonCount",{count:f}):i("decoServe.changes.button"),e[7]=f,e[8]=i,e[9]=x):x=e[9];let g;e[10]!==x?(g=a.jsx(ve,{size:"sm",variant:"outline","data-testid":"local-changes-button",onClick:m,children:x}),e[10]=x,e[11]=g):g=e[11];let w;e[12]!==i?(w=i("decoServe.changes.title"),e[12]=i,e[13]=w):w=e[13];let j;e[14]!==w?(j=a.jsx(gr,{className:"sr-only",children:w}),e[14]=w,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]!==i||e[22]!==r?(y=d?a.jsx(vr,{children:N=>{const{reset:C}=N;return a.jsx(yr,{fallback:v=>{const{resetError:A}=v;return a.jsx(cn,{title:i("decoServe.changes.title"),body:a.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:i("decoServe.changes.loadFailed")}),onClose:()=>{C(),A(),l(!1)}})},children:a.jsx(H.Suspense,{fallback:a.jsx(ms,{pane:a.jsx($n,{}),list:a.jsx(cn,{title:i("decoServe.changes.title"),loading:!0,body:a.jsx(hs,{children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Bt,{}),a.jsx(Bt,{})]})}),onClose:()=>l(!1)})}),children:a.jsx(Qc,{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]=i,e[22]=r,e[23]=y):y=e[23];let P;e[24]!==j||e[25]!==y?(P=a.jsxs(xr,{"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]=P):P=e[26];let S;e[27]!==d||e[28]!==P?(S=a.jsx(br,{open:d,onOpenChange:l,children:P}),e[27]=d,e[28]=P,e[29]=S):S=e[29];let k;return e[30]!==S||e[31]!==g?(k=a.jsxs(a.Fragment,{children:[g,S]}),e[30]=S,e[31]=g,e[32]=k):k=e[32],k}function cn(t){const e=T.c(22),{title:s,trailing:r,body:n,loading:i,onClose:d}=t,l=i===void 0?!1:i,o=me(),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]!==o?(p=o("decoServe.changes.hint"),e[5]=o,e[6]=p):p=e[6];let b;e[7]!==p?(b=a.jsx("p",{className:"text-2xs text-muted-foreground",children:a.jsx(Yr,{text:p})}),e[7]=p,e[8]=b):b=e[8];let f;e[9]!==o?(f=o("decoServe.changes.close"),e[9]=o,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 x;e[14]!==b||e[15]!==m?(x=a.jsxs(a.Fragment,{children:[b,m]}),e[14]=b,e[15]=m,e[16]=x):x=e[16];let g;return e[17]!==n||e[18]!==u||e[19]!==h||e[20]!==x?(g=a.jsx(Gs,{state:u,header:h,body:n,footer:x}),e[17]=n,e[18]=u,e[19]=h,e[20]=x,e[21]=g):g=e[21],g}function Qc(t){const e=T.c(54),{orgSlug:s,virtualMcpId:r,branch:n,backend:i,cacheKey:d,onClose:l}=t,o=me();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]!==i||e[5]!==d||e[6]!==u?(c={backend:i,cacheKey:d,scope:u},e[4]=i,e[5]=d,e[6]=u,e[7]=c):c=e[7];const h=Fn(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=ni(p),f=Cr(s,r).phase==="saving",m=i.describe.readOnly,[x,g]=H.useState(null),[w,j]=H.useState(null),[y,P]=H.useState(!1),{summary:S}=h;let k,N,C,v,A;if(e[13]!==x||e[14]!==i||e[15]!==w||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]!==S.blocks||e[25]!==S.count||e[26]!==S.pages||e[27]!==o){const O=[...S.pages,...S.blocks],F=O.find(V=>ke(V)===x)??O[0]??null;let _;e[33]!==S.count||e[34]!==o?(_=S.count===0?o("decoServe.changes.title"):S.count===1?o("decoServe.changes.titleOne"):o("decoServe.changes.titleCount",{count:S.count}),e[33]=S.count,e[34]=o,e[35]=_):_=e[35],A=_;const $=(V,J)=>J.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:V}),J.map(L=>{const K=ke(L);return a.jsx(ua,{change:L,bodyPending:h.sidesPending,v8:!0,selected:F!==null&&ke(F)===K,onSelect:()=>g(K),confirming:w===K,onConfirmingChange:te=>j(te?K:null),onDiscard:m||!L.entry?void 0:()=>{b(i,[L.entry],o("thread.publishPopover.discarded",{name:L.name}))},isPublishing:!1,isDiscarding:f},K)})]});let G;e[36]!==i||e[37]!==b||e[38]!==y||e[39]!==f||e[40]!==m||e[41]!==h.entries||e[42]!==S.count||e[43]!==o?(G=m||S.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:()=>P(!0),disabled:f,children:o("thread.publishPopover.discardAll")}),a.jsx(Bs,{open:y,onOpenChange:P,children:a.jsxs(Ts,{children:[a.jsxs(Cs,{children:[a.jsx(ks,{children:o("thread.publishPopover.discardAllTitle")}),a.jsx(Ns,{children:o("thread.publishPopover.discardAllConfirm")})]}),a.jsxs(Ds,{children:[a.jsx(As,{children:o("thread.publishDialog.cancel")}),a.jsx(Rs,{onClick:()=>{b(i,h.entries,o("thread.publishDialog.allChangesDiscarded"))},disabled:f,className:q(jr({variant:"destructive"})),children:o("thread.publishPopover.discardAll")})]})]})})]}),e[36]=i,e[37]=b,e[38]=y,e[39]=f,e[40]=m,e[41]=h.entries,e[42]=S.count,e[43]=o,e[44]=G):G=e[44],C=G,N=S.count===0?a.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[a.jsx(Sn,{className:"mb-1 size-5 text-success"}),a.jsx("p",{className:"text-sm font-medium",children:o("decoServe.changes.empty")})]}):a.jsxs(hs,{children:[$(o("thread.publishPopover.pagesGroup"),S.pages),$(o("thread.publishPopover.blocksGroup"),S.blocks),h.sidesFailed?a.jsx("p",{className:"text-2xs text-muted-foreground",children:o("thread.publishPopover.detailsUnavailable")}):null]}),k=ms,v=F?a.jsx("div",{className:q(ss,"relative flex"),children:a.jsx(ga,{change:F,diff:null,bodyPending:h.sidesPending,previewServerUrl:null,draft:null,lastPage:null,v8:{blocks:h.blocks}},ke(F))}):a.jsx("div",{className:q(ss,"bg-muted/40")}),e[13]=x,e[14]=i,e[15]=w,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]=S.blocks,e[25]=S.count,e[26]=S.pages,e[27]=o,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 D;e[45]!==N||e[46]!==C||e[47]!==l||e[48]!==A?(D=a.jsx(cn,{title:A,trailing:C,body:N,onClose:l}),e[45]=N,e[46]=C,e[47]=l,e[48]=A,e[49]=D):D=e[49];let I;return e[50]!==k||e[51]!==v||e[52]!==D?(I=a.jsx(k,{pane:v,list:D}),e[50]=k,e[51]=v,e[52]=D,e[53]=I):I=e[53],I}function Jc(t){const e=T.c(5),{virtualMcpId:s,branch:r}=t,n=me(),i=St(s,r);if(!Xc(i))return null;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx(tt,{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 o;return e[3]!==l?(o=a.jsxs(et,{children:[d,a.jsx(st,{side:"bottom",className:"max-w-xs",children:l})]}),e[3]=l,e[4]=o):o=e[4],o}function Xc(t){return t.kind==="protocol"?t.hasSchema!==!1:t.kind==="unavailable"&&t.source!=="local"}function Yc(t){const e=T.c(11),{virtualMcpId:s,branch:r}=t,n=me(),i=St(s,r);if(!(i.kind==="protocol"&&i.source==="local"&&i.describe.readOnly))return null;let l;e[0]!==n?(l=n("decoServe.readOnly.label"),e[0]=n,e[1]=l):l=e[1];let o;e[2]!==l?(o=a.jsx(tt,{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]=o):o=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(st,{side:"bottom",className:"max-w-xs",children:a.jsx(Yr,{text:u})}),e[6]=u,e[7]=c):c=e[7];let h;return e[8]!==o||e[9]!==c?(h=a.jsxs(et,{children:[o,c]}),e[8]=o,e[9]=c,e[10]=h):h=e[10],h}function Zc(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 ed(){const t=T.c(27),e=It(),{org:s}=rs(),r=Ks(e?.virtualMcpId),n=r?.id??e?.virtualMcpId??"",i=e?.currentBranch??null,{runtime:d,resolved:l}=fs(r?.id),o=jn(r?.id),{url:u}=pn(r?.id),{connection:c}=bn(n||null),h=!!r&&!!i&&l&&d==="cms"&&!o&&!u,p=i??"",b=e?.taskId??null;let f,m,x,g;t[0]!==s.slug||t[1]!==p||t[2]!==b||t[3]!==n?(m={orgSlug:s.slug,virtualMcpId:n,branch:p,threadId:b},f=td,g=ht,x=Nn(m),t[0]=s.slug,t[1]=p,t[2]=b,t[3]=n,t[4]=f,t[5]=m,t[6]=x,t[7]=g):(f=t[4],m=t[5],x=t[6],g=t[7]);let w;t[8]!==f||t[9]!==m?(w=(D,I)=>f(I?.queryKey)===f(Rn(m))?D:void 0,t[8]=f,t[9]=m,t[10]=w):w=t[10];let j;t[11]!==h||t[12]!==x||t[13]!==w?(j={...x,enabled:h,placeholderData:w},t[11]=h,t[12]=x,t[13]=w,t[14]=j):j=t[14];const y=g(j),P=!!u,S=!!c;let k;if(t[15]!==o||t[16]!==i||t[17]!==r?.metadata?.releases||t[18]!==l||t[19]!==d||t[20]!==y.data||t[21]!==y.isError||t[22]!==P||t[23]!==S){let D;t[25]!==i?(D=I=>I.branch===i,t[25]=i,t[26]=D):D=t[26],k=Zc({runtime:d,runtimeResolved:l,blocksV8:o,localPreview:P,servingLocally:S,branch:i,listedDraft:(r?.metadata?.releases??[]).some(D),defaultBranch:y.data?y.data.base??null:y.isError?null:void 0}),t[15]=o,t[16]=i,t[17]=r?.metadata?.releases,t[18]=l,t[19]=d,t[20]=y.data,t[21]=y.isError,t[22]=P,t[23]=S,t[24]=k}else k=t[24];const N=k,C=`${n}:${i??""}`,[v,A]=H.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 td(t){return t?.[2]}function sd(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 Qd(t){const e=T.c(2),{blocksOnly:s}=t;let r;return e[0]!==s?(r=s?a.jsx(nd,{}):a.jsx(ka,{}),e[0]=s,e[1]=r):r=e[1],r}function nd(){return jn(wi())?a.jsx(pa,{value:!1,children:a.jsx(ka,{})}):null}function ka(){const t=T.c(32),e=It(),{org:s}=rs(),r=Ks(e?.virtualMcpId),n=e?.currentBranch??null,i=fs(r?.id).runtime,{url:d}=pn(r?.id),{connection:l}=bn(r?.id??e?.virtualMcpId),o=r?.id??e?.virtualMcpId,u=ed()!=="open",c=!!r,h=!!l,p=!!d;let b;t[0]!==r||t[1]!==u||t[2]!==i||t[3]!==c||t[4]!==h||t[5]!==p?(b=sd({hasEntity:c,servingLocally:h,localPreview:p,showsRepositoryActions:!!r&&Dl(r),runtime:i,onProduction:u}),t[0]=r,t[1]=u,t[2]=i,t[3]=c,t[4]=h,t[5]=p,t[6]=b):b=t[6];const f=b;if(!o||f.hidden)return null;let m;t[7]!==n||t[8]!==o?(m=a.jsx(Jc,{virtualMcpId:o,branch:n}),t[7]=n,t[8]=o,t[9]=m):m=t[9];let x;t[10]!==n||t[11]!==f.localFiles||t[12]!==o?(x=f.localFiles&&a.jsx(Yc,{virtualMcpId:o,branch:n}),t[10]=n,t[11]=f.localFiles,t[12]=o,t[13]=x):x=t[13];let g;t[14]!==n||t[15]!==s||t[16]!==f.localFiles||t[17]!==o?(g=f.localFiles&&a.jsx(Wc,{orgSlug:s.slug,virtualMcpId:o,branch:n}),t[14]=n,t[15]=s,t[16]=f.localFiles,t[17]=o,t[18]=g):g=t[18];let w;t[19]!==n||t[20]!==r||t[21]!==f.draftSelect?(w=r&&f.draftSelect&&a.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:a.jsx(Gi,{virtualMcp:r,currentBranch:n})}),t[19]=n,t[20]=r,t[21]=f.draftSelect,t[22]=w):w=t[22];let j;t[23]!==r||t[24]!==f.publish?(j=r&&f.publish&&a.jsxs(a.Fragment,{children:[a.jsx(Ha,{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(Ic,{virtualMcpId:r.id}):a.jsx(Gc,{virtualMcpId:r.id})})]}),t[23]=r,t[24]=f.publish,t[25]=j):j=t[25];let y;return t[26]!==m||t[27]!==x||t[28]!==g||t[29]!==w||t[30]!==j?(y=a.jsxs(a.Fragment,{children:[m,x,g,w,j]}),t[26]=m,t[27]=x,t[28]=g,t[29]=w,t[30]=j,t[31]=y):y=t[31],y}function dn(t){const e=T.c(7),{icon:s,title:r,description:n,action:i}=t;let d;e[0]!==i?(d=i?{children:i.label,onClick:i.onClick,disabled:i.disabled}:void 0,e[0]=i,e[1]=d):d=e[1];let l;return e[2]!==n||e[3]!==s||e[4]!==d||e[5]!==r?(l=a.jsx(Xs,{children:a.jsx(Xs.Content,{children:a.jsx(Xs.Container,{children:a.jsx(Pi,{icon:s,title:r,description:n,buttonProps:d})})})}),e[2]=n,e[3]=s,e[4]=d,e[5]=r,e[6]=l):l=e[6],l}function Jd(t){const e=T.c(28),{virtualMcpId:s,icon:r,copy:n,skeleton:i,children:d}=t,l=me(),{org:o}=rs(),u=It(),c=u?.currentBranch??null,h=St(s,c);Ua(h.kind==="protocol"&&h.source==="github");const{openPanel:p}=Si();if(!c){const m=n.noDraftTitle,x=n.noDraftDesc;let g;e[0]!==l?(g=l("sectionsEditor.namedRules.openEditor"),e[0]=l,e[1]=g):g=e[1];let w;e[2]!==p?(w=()=>p("content"),e[2]=p,e[3]=w):w=e[3];let j;e[4]!==g||e[5]!==w?(j={label:g,onClick:w},e[4]=g,e[5]=w,e[6]=j):j=e[6];let y;return e[7]!==n.noDraftDesc||e[8]!==n.noDraftTitle||e[9]!==r||e[10]!==j?(y=a.jsx(dn,{icon:r,title:m,description:x,action:j}),e[7]=n.noDraftDesc,e[8]=n.noDraftTitle,e[9]=r,e[10]=j,e[11]=y):y=e[11],y}if(Ul(h)){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(Kl,{}),e[12]=m):m=e[12],m}if(h.kind==="pending"){let m;return e[13]!==i?(m=a.jsx(a.Fragment,{children:i}),e[13]=i,e[14]=m):m=e[14],m}if(h.kind!=="protocol"){let m;return e[15]!==n.loadFailed||e[16]!==n.loadFailedHint||e[17]!==r?(m=a.jsx(dn,{icon:r,title:n.loadFailed,description:n.loadFailedHint}),e[15]=n.loadFailed,e[16]=n.loadFailedHint,e[17]=r,e[18]=m):m=e[18],m}const b=u?.taskId??null;let f;return e[19]!==c||e[20]!==d||e[21]!==n||e[22]!==r||e[23]!==o.slug||e[24]!==i||e[25]!==b||e[26]!==s?(f=a.jsx(rd,{orgSlug:o.slug,virtualMcpId:s,branch:c,threadId:b,icon:r,copy:n,skeleton:i,children:d},c),e[19]=c,e[20]=d,e[21]=n,e[22]=r,e[23]=o.slug,e[24]=i,e[25]=b,e[26]=s,e[27]=f):f=e[27],f}function rd(t){const e=T.c(35),{orgSlug:s,virtualMcpId:r,branch:n,threadId:i,icon:d,copy:l,skeleton:o,children:u}=t,c=me();let h;e[0]!==n||e[1]!==s||e[2]!==i||e[3]!==r?(h={orgSlug:s,virtualMcpId:r,branch:n,threadId:i,previewUrl:null},e[0]=n,e[1]=s,e[2]=i,e[3]=r,e[4]=h):h=e[4];const p=h,b=sl(p),f=Hl(p),m=b.data,x=f.data;let g;e[5]!==n||e[6]!==s||e[7]!==r?(g={orgSlug:s,virtualMcpId:r,branch:n},e[5]=n,e[6]=s,e[7]=r,e[8]=g):g=e[8];const w=nl(g,ql);if(!m||!x||!w.ready){if(b.isError||f.isError||w.failed){const S=l.loadFailed,k=l.loadFailedHint;let N;e[9]!==c?(N=c("sectionsEditor.namedRules.tryAgain"),e[9]=c,e[10]=N):N=e[10];let C;e[11]!==b||e[12]!==w||e[13]!==f?(C=()=>{b.isError&&b.refetch(),f.isError&&f.refetch(),w.failed&&w.retry()},e[11]=b,e[12]=w,e[13]=f,e[14]=C):C=e[14];let v;e[15]!==N||e[16]!==C?(v={label:N,onClick:C},e[15]=N,e[16]=C,e[17]=v):v=e[17];let A;return e[18]!==l.loadFailed||e[19]!==l.loadFailedHint||e[20]!==d||e[21]!==v?(A=a.jsx(dn,{icon:d,title:S,description:k,action:v}),e[18]=l.loadFailed,e[19]=l.loadFailedHint,e[20]=d,e[21]=v,e[22]=A):A=e[22],A}let P;return e[23]!==o?(P=a.jsx(a.Fragment,{children:o}),e[23]=o,e[24]=P):P=e[24],P}let j;e[25]!==n||e[26]!==u||e[27]!==m||e[28]!==x||e[29]!==s||e[30]!==i||e[31]!==r?(j=u({orgSlug:s,virtualMcpId:r,branch:n,threadId:i,decofile:m,meta:x}),e[25]=n,e[26]=u,e[27]=m,e[28]=x,e[29]=s,e[30]=i,e[31]=r,e[32]=j):j=e[32];let y;return e[33]!==j?(y=a.jsx(a.Fragment,{children:j}),e[33]=j,e[34]=y):y=e[34],y}export{dn as S,Qd as a,ed as b,Jd as c,Oi as u};
@@ -1 +0,0 @@
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-DGn-FPge.js";import{C as M}from"./chat-context-GsXpI-Rk.js";import{C as x}from"./index-DisXhcWe.js";import{L}from"./index-DM3inxPC.js";import{B as V}from"./blocks-preview-workspace-context-DbUsPnrw.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-BUVxT4JG.js";import{u as q,L as B,P as Q,S as X}from"./preview-tab-Cuhy4gb6.js";import{C as Y}from"./content-tab-B2fyj6Jh.js";import{T as Z}from"./tab-icon-glyph-CMWJQvgX.js";import{r as tt}from"./resolve-tab-icon-DJ5Ncrbw.js";import et from"./agent-site-editor-iOr_R9Ca.js";import"./autosend-ce5-FRC2.js";import"./thread-route-Dt42HUQv.js";import"./use-project-scope-BJA0ds2S.js";import"./repository-binding-DHN5ihZA.js";import"./use-mcp-client-BeYM-3mp.js";import"./auth-BsX6ur7b.js";import"./thread-intent-C084ju5m.js";import"./delay-CnY5UFtP.js";import"./watch-sse-pool-D3b7K3Uo.js";import"./task-board-BuKyXp11.js";import"./schema-C2e4bOOh.js";import"./use-entitlements-DxVD_uCH.js";import"./use-ai-providers-hjEpjXQ2.js";import"./use-decopilot-events-CTD6ZdaA.js";import"./use-organization-settings--v2ov5jL.js";import"./use-mobile-D6y1UaCv.js";import"./use-sidebar-collapsed-DuLHdlSz.js";import"./use-chat-layout-state-DGf4-J1Z.js";import"./agent-icon-FkFyvRCX.js";import"./AlertCircle-BMgOinVw.js";import"./Tool01-B8q2F7hW.js";import"./ArrowUp-DcJMRdNb.js";import"./ArrowLeft-BJMjlG4g.js";import"./LinkBroken01-znJYLaVP.js";import"./ShoppingBag01-DYcJDT4V.js";import"./Globe04-ri2PR4JW.js";import"./CheckCircle-By2z0uOx.js";import"./ChevronUp-BCfBdjs4.js";import"./ChevronSelectorVertical-BTg7xsL3.js";import"./UserSquare-Cbfe91aH.js";import"./CreditCard01-kxqKIkVq.js";import"./SwitchHorizontal01-D2vRhNhF.js";import"./Key01-By4BziN_.js";import"./Minus-Biy1YWEX.js";import"./Monitor01-DcAryzmn.js";import"./Sun-tnCpymBL.js";import"./Play-BkYxzt1r.js";import"./Plus-BhRQRaas.js";import"./SearchMd-DqnvtcaB.js";import"./Trash01-Ccl1EX2p.js";import"./Upload01-DOAyGyLP.js";import"./Users01-C1OYrFY1.js";import"./XClose-p8-Q8v8l.js";import"./Zap-DyRXLCnm.js";import"./tooltip-BojzNY2M.js";import"./index-C9A_N0M0.js";import"./toolbar-icon-button-GjI5vOKF.js";import"./shell-layout-DzQA4K-b.js";import"./use-deployment-admin-BCIDPeyj.js";import"./admin-fetch-BhTJlAsX.js";import"./command-D1ggU7uN.js";import"./index-DuD6FLZ3.js";import"./integration-icon-BHx1ytyX.js";import"./project-icon-reyc_nNY.js";import"./use-navigate-to-agent-DP0a6y9z.js";import"./new-project-dialog-UvI58my0.js";import"./label-CHRzCbuP.js";import"./repository-picker-BVa6TfGc.js";import"./github-icon-DNe7j1PY.js";import"./useInfiniteQuery-CCkoNUSG.js";import"./infiniteQueryObserver-B_P9W4Zx.js";import"./collection-search-BXhJDy4i.js";import"./use-debounced-value-CzxhSP8l.js";import"./required-auth-layout-BQmhUScr.js";import"./use-org-sso-BK0CtdSD.js";import"./sheet-pl7zdRHn.js";import"./resizable-CdFCM71r.js";import"./core.esm-DnEwZVMw.js";import"./sortable.esm-CIP-w8Te.js";import"./context-menu-DPGth7tq.js";import"./create-organization-dialog-UgMN3Pp1.js";import"./form-cx1UDyF2.js";import"./project-apps-B-5TAX2o.js";import"./use-recent-apps--67lnzqC.js";import"./input-Di6BJ4Zo.js";import"./usage-stats-B39QZ3Cn.js";import"./tool-namespace-Fc2c0QC4.js";import"./utils-CVEq3hMx.js";import"./markdown-C7Kie5ev.js";import"./use-copy-1IxNCkh9.js";import"./icon-button-CmFwjZ_m.js";import"./file-type-icon-DoyEf2kQ.js";import"./chat-draft-CnA31cek.js";import"./select-Di2sLm_-.js";import"./index-BdQq_4o_.js";import"./tabs-DNziA2dZ.js";import"./active-indicator-CCMhAsc_.js";import"./use-deco-credits-CEMj3JGY.js";import"./toggle-group-CFojpTQB.js";import"./index-WwIqmvy-.js";import"./checkbox-LWvsDQWZ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./popover-CE0A3Qit.js";import"./drawer-BnPszJPZ.js";import"./input-BEManHLB.js";import"./suggestion-Dr321Cmr.js";import"./use-mcp-prompts-IjFHP0w8.js";import"./use-org-fs-CfPaWD_N.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-CJwXTzME.js";import"./plan-ladder-DJg9yABt.js";import"./add-connection-dialog-I3R6bOX6.js";import"./extract-connection-data-KiTWYSx4.js";import"./metadata-D72DunRR.js";import"./connection-BWg4pBgr.js";import"./url-slug-BkV5QJiU.js";import"./connection-card-D8rA98h7.js";import"./connection-slug-xnxqKZgT.js";import"./textarea-HAezEU3R.js";import"./use-connection-BonBiP4H.js";import"./schema-77LyfVRl.js";import"./connection-form-helpers-CTdld_FZ.js";import"./authenticate-and-persist-oauth-Cu0VrSF5.js";import"./mcp-oauth-iB4K_uoY.js";import"./mcp-oauth-C-mc4e6m.js";import"./collection-tabs-R5zZyWuQ.js";import"./badge-2xhZ-r-l.js";import"./use-infinite-scroll-4LyFv3hi.js";import"./useSuspenseInfiniteQuery-CDBL11js.js";import"./use-task-board-events-BZToXVGj.js";import"./agent-capabilities-DUEnZmC-.js";import"./sandbox-url-D3mC8qhT.js";import"./utils-BU-nucb-.js";import"./index-CxEOaGFH.js";import"./pair-1hov1KDD.js";import"./collapsible-DwneXnWl.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-CO8LOFxq.js";import"./types-CdXMwNZg.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./use-thread-outputs-DnX9RgWT.js";import"./sandbox-git-api-DcqI6XE4.js";import"./parse-sections-BNf6_EjY.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./blocks-tab-states-Oy4QesXy.js";import"./empty-state-BFLQtSFV.js";import"./hosted-reconcile-BJXH2g7a.js";import"./slider-CwE675ao.js";import"./index-CmGLs6T5.js";import"./tooltipContext-m-9QMOrS.js";import"./CategoricalChart-CUR_9ZiJ.js";import"./index-B5lnCLuB.js";import"./switch-D-6AqAnT.js";import"./scroll-area-DOPuQKg_.js";import"./monaco-editor-BRY87vsh.js";import"./editor-zE4VnGLI.js";import"./calendar-D-rfd7JY.js";import"./editor-classes-BnzpZOY5.js";import"./combobox-M_E9pRSg.js";import"./search-input-Bo9D0b2l.js";import"./use-file-configs-D87qhE2e.js";import"./asset-utils-Bq_dJbYP.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./sandbox-lifecycle-context-Dp2Dt1TA.js";import"./variant-matcher-override-CgElSjwL.js";import"./use-fast-preview-draft-url-o_WDZuY-.js";import"./useQueries-BbqzFtkh.js";import"./device-hint-DHQmntIa.js";import"./alert-BcGEYE9G.js";import"./virtual-mcp-CsY6ukOa.js";import"./app-preview-url-9Od4s8Sz.js";import"./preview-source-BsRLGWUP.js";import"./use-task-metadata-jDPe6d5C.js";import"./view-header-i70JKW9C.js";import"./use-cms-publish-actions-JZTNoXFa.js";import"./use-content-sync-C-LYfyy7.js";import"./mustache-WHgo2S29.js";import"./date-utils-CrvIKg-s.js";import"./use-move-blocks-DItjAQsv.js";import"./empty-state-DLrHPsXZ.js";import"./collection-table-wrapper-CsjezWAk.js";import"./table-DpJo1vAx.js";import"./site-draft-view-Ca1ao55E.js";import"./separator-Bu1wQRuA.js";import"./cms-store-drafts-49wrBNXT.js";import"./serial-task-queue-CGOeQgpr.js";import"./save-changes-debug-nBi-n9eV.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 Ui(){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 qi(){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{qi as SiteEditorContent,zi as SiteEditorPreview,Ui as default};
@@ -1 +0,0 @@
1
- import{eP as P,eQ as S,c as $,q as ne,i as F,K as g,eR as Ne,aB as wn,aF as Sn,aG as yn,r as L,a as En,at as De,a5 as On,by as yt,eS as Dn,eT as kn,eU as Et,ar as _n,bo as Ot,bh as B,eV as In,eW as Tn,eX as Z,eY as Pn,eZ as Rn,e_ as ue,e$ as xn,f0 as Dt,f1 as kt,f2 as $n,f3 as Nn,a3 as jn,t as K,j as Y}from"./index-DGn-FPge.js";import{a as _t}from"./input-Di6BJ4Zo.js";import{s as et}from"./thread-intent-C084ju5m.js";import{u as je}from"./agent-capabilities-DUEnZmC-.js";import{b as be}from"./sandbox-url-D3mC8qhT.js";import{s as Cn}from"./utils-BU-nucb-.js";import{u as Ce}from"./repository-binding-DHN5ihZA.js";import{u as An}from"./chat-context-GsXpI-Rk.js";import{i as Un,u as Mn}from"./index-CxEOaGFH.js";import{a as Ln}from"./sandbox-git-api-DcqI6XE4.js";const q="deco-content",ke={major:1},It=1;async function Fn(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:ke.major,minor:It},Tt=`the endpoint speaks an older ${q} 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 re(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!==q)throw re(`the endpoint speaks ${JSON.stringify(n)}, not ${q}`,"protocol",t);if(o?.major!==ke.major)throw re(`the endpoint speaks ${q} ${String(o?.major)}.x; this client speaks ${ke.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<It)throw re(Tt,"outdated",t);return e}function tt(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?re(Tt,"outdated"):P.from(t)}function Ae(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 l;try{l=await Fn(a)}catch{throw new P(S.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(l)&&l?.id===null){const c=l?.error;throw c?P.from(c):new P(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return l}const r=async(s,i)=>{const a=n++,l=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(l.error)throw tt(s,l.error);return l.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((c,f)=>({jsonrpc:"2.0",id:i[f],method:c.method,params:c.params??{}}))),l=new Map(a.map(c=>[c.id,c]));return i.map((c,f)=>{const u=l.get(c);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 Ue(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const nt=20,ot=5,rt=500;function Me(e){return e instanceof P?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function fe(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function Qn(e,t,n){const o=g.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(Ue(r)),i=fe(r,s);if(i)return i;const a=await t.changesList({});return fe(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 l=a.result;Object.assign(o,l.entries),r.push(...l.diagnostics)}}return{entries:o,diagnostics:r}}async function Qr(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 Vr(e){return e instanceof P&&e.code===S.Conflict}function Le(e){return e?.kind==="protocol"?e:null}function Br(e,t,n){const o=$.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=ne();let a;o[2]!==e?(a=Le(e),o[2]=e,o[3]=a):a=o[3];const l=a,c=!!l&&!!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]!==c||o[8]!==l||o[9]!==i?(u=c?()=>Qn(i,l.client,t):Ne,o[6]=t,o[7]=c,o[8]=l,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 Hr(e,t,n){const o=$.c(14);let r;o[0]!==e?(r=Le(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,l=!!s&&!!t&&!!n&&a.length>0;let c;o[4]!==t||o[5]!==n?.revision?(c=g.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=c):c=o[6];let f;o[7]!==l||o[8]!==a||o[9]!==s?(f=l?()=>Rt(s.client,a):Ne,o[7]=l,o[8]=a,o[9]=s,o[10]=f):f=o[10];let u;return o[11]!==c||o[12]!==f?(u={queryKey:c,queryFn:f,staleTime:Number.POSITIVE_INFINITY},o[11]=c,o[12]=f,o[13]=u):u=o[13],F(u)}function Jr(e,t,n){const o=$.c(16);let r;o[0]!==e?(r=Le(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i,a,l,c;if(o[2]!==t||o[3]!==n?.changes||o[4]!==s){const d=Object.entries(n?.changes??{}).filter(Wn).map(Jn).sort(Hn);a=d.map(Bn);const h=JSON.stringify(d.map(Vn));i=!!s&&!!t&&a.length>0,c=F,l=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=s,o[5]=i,o[6]=a,o[7]=l,o[8]=c}else i=o[5],a=o[6],l=o[7],c=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[p,v]of Object.entries(d.entries))h[p]=v.before&&typeof v.before=="object"?v.before:null;return h}:Ne,o[9]=i,o[10]=a,o[11]=s,o[12]=f):f=o[12];let u;return o[13]!==l||o[14]!==f?(u={queryKey:l,queryFn:f,staleTime:Number.POSITIVE_INFINITY,placeholderData:wn},o[13]=l,o[14]=f,o[15]=u):u=o[15],c(u)}function Vn(e){return[e.name,e.base]}function Bn(e){return e.name}function Hn(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function Jn(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function Wn(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 de(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(de)});function Wr(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 Gr(e){try{localStorage.setItem(jt,JSON.stringify(e))}catch{}}function Yr(){try{const e=localStorage.getItem(jt);return e?Nt(JSON.parse(e)):null}catch{return null}}function zr(e){try{return new URL(de(e)).host}catch{return e}}function Gn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Yn="http://localhost:4545/rpc";class Fe extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zn(e){if(e instanceof Fe)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 Me(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 Xr(e,t){if(e)return[de(e.endpoint)];const n=[t?.endpoint,Yn].filter(o=>!!o).map(de);return[...new Set(n)]}const Ct=L.createContext(null);function Xn(e){const t=$.c(24),n=L.useContext(Ct),o=je(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?De.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[l,c]=it(a);let f;t[4]!==i||t[5]!==s||t[6]!==e?(f=i?De.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]!==l||t[9]!==i||t[10]!==o?(h=i&&o?Nt(l):null,t[8]=l,t[9]=i,t[10]=o,t[11]=h):h=t[11];const p=h,v=i&&o&&typeof u=="string"?u:null;let w;t[12]!==d||t[13]!==c||t[14]!==i?(w=R=>{i&&(c(R),d(R.endpoint))},t[12]=d,t[13]=c,t[14]=i,t[15]=w):w=t[15];let _;t[16]!==c||t[17]!==i?(_=()=>{i&&c(null)},t[16]=c,t[17]=i,t[18]=_):_=t[18];let E;return t[19]!==p||t[20]!==v||t[21]!==w||t[22]!==_?(E={connection:p,lastEndpoint:v,set:w,clear:_},t[19]=p,t[20]=v,t[21]=w,t[22]=_,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=$.c(17),n=ne(),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 l=!!e;let c;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==l?(c={queryKey:s,queryFn:i,initialData:a,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=l,t[9]=c):c=t[9];const{data:f}=F(c);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 p;return t[14]!==d||t[15]!==h?(p=[h,d],t[14]=d,t[15]=h,t[16]=p):p=t[16],p}function Zr(e){return e.kind==="protocol"||e.kind==="unavailable"}function qr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Kr(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 es(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&xt(t)?t:null}function ts(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 Zn(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 qn(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 Kn(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 eo(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 ns(e){return!!e&&e[Ut]===!0}function Qe(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function to(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const no=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function os(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:to(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(no)})).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 rs(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class ut extends Error{}const Ve="site-not-owned";async function oo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function ro(e,t=n=>fetch(n)){const n=Ae({endpoint:e,fetch:async o=>{const r=await t(o);if(await oo(r))throw new ut;return r}});try{return await He(n)}catch(o){if(o instanceof ut)return Ve;throw o}}async function so(e,t,n){await t();const o=await ro(e,n);return o===Ve?o:{...o,hosted:Dn(e,n)}}const Be=5e3;function io(e){if(!e.site)throw new Error("this project names no site");return kn(e.site,e.branch)}function ao(e){return new URL(be(e,"rpc"),window.location.origin).href}async function He(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!==q)throw new Fe;const r=Pt(t.result);if(!n)throw new Error("no schema.get");if(Qe(n))return{client:e,describe:r,hasSchema:!1};if(n.ok)return{client:e,describe:r,hasSchema:!0};throw n.error}function co(e,t=n=>fetch(n)){return He(Ae({endpoint:e,fetch:t}))}function me(e,t){const n=$.c(50),{org:o}=On(),{connection:r}=Xn(e),{runtime:s}=_t(e),i=L.useContext(Ct),a=je(e),l=yt(Ce(e)?.metadata),c=At({hasServeConnection:!!r,runtime:s}),f=An()?.taskId??null,u=Un(Mn().lifecycle.phase),d=ne(),h=qn({mode:c,v8:a,workingTreeReady:u}),p=h.github&&!!o.slug&&!!e&&!!t,v=F({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>so(io({orgSlug:o.slug,site:l,branch:t}),()=>Et(l,t)),enabled:p,staleTime:Number.POSITIVE_INFINITY,...ft}),w=h.sandbox&&!!o.slug&&!!e&&!!t;let _;n[0]!==t||n[1]!==o.slug||n[2]!==f||n[3]!==e?(_=()=>co(ao({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:f})),n[0]=t,n[1]=o.slug,n[2]=f,n[3]=e,n[4]=_):_=n[4];const E=F({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",f??""),queryFn:_,enabled:w,staleTime:Number.POSITIVE_INFINITY,...ft}),R=!!r;let I;n[5]!==r?.endpoint||n[6]!==o.slug||n[7]!==e?(I=g.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[5]=r?.endpoint,n[6]=o.slug,n[7]=e,n[8]=I):I=n[8];let N;n[9]!==r?(N=()=>He(Ae({endpoint:r.endpoint})),n[9]=r,n[10]=N):N=n[10];let x;n[11]!==R||n[12]!==I||n[13]!==N?(x={queryKey:I,queryFn:N,enabled:R,staleTime:Number.POSITIVE_INFINITY,retry:fo,retryDelay:uo,refetchInterval:lo},n[11]=R,n[12]=I,n[13]=N,n[14]=x):x=n[14];const b=F(x);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]!==b.data||n[24]!==D||n[25]!==d?(j=async()=>{try{return await b.data.client.describe()}catch(m){const J=m;throw d.invalidateQueries({queryKey:D,exact:!0},{cancelRefetch:!1}),J}},n[23]=b.data,n[24]=D,n[25]=d,n[26]=j):j=n[26];const C=!!b.data&&!i;let O;n[27]!==T||n[28]!==j||n[29]!==C?(O={queryKey:T,queryFn:j,enabled:C,refetchInterval:Be,retry:!1},n[27]=T,n[28]=j,n[29]=C,n[30]=O):O=n[30];const A=F(O).data??b.data?.describe,k=Zn({hasProject:!!e,hasServeConnection:!!r,runtime:s,v8:a,githubSite:v.data===Ve?"not-owned":v.data?"ready":at(v)?"error":"loading",sandboxSite:ho({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=Ie("github",m,""),n[34]=m,n[35]=J):J=n[35];let oe;return n[36]!==l||n[37]!==J?(oe={...J,site:l},n[36]=l,n[37]=J,n[38]=oe):oe=n[38],oe}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=Ie("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=b.error??b.failureReason,y=r?.endpoint??"";let V;return n[43]!==A||n[44]!==b.data||n[45]!==b.failureCount||n[46]!==b.isError||n[47]!==y||n[48]!==Q?(V=vo({probed:b.data,isError:b.isError,failureCount:b.failureCount,failure:Q,describe:A,endpoint:y}),n[43]=A,n[44]=b.data,n[45]=b.failureCount,n[46]=b.isError,n[47]=y,n[48]=Q,n[49]=V):V=n[49],V}function lo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Be:!1}function uo(e){return Gn(e+1)}function fo(e,t){return!(t instanceof P)&&!(t instanceof Fe)}function ho(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const go=3;function vo(e){const t=e.probed?Ie("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<go?t:{kind:"unavailable",source:"local",problem:zn(e.failure)}:t??{kind:"pending"}}const ft={retry:2,refetchInterval:e=>e.state.status==="error"?Be:!1};function Ie(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=$.c(12);let n;t[0]!==e?(n=De.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=_n(o,null),i=je(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 c=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]!==c||t[9]!==f||t[10]!==u?(d={url:c,setUrl:f,clear:u},t[8]=c,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 bo(e,t,n){return{id:we(e,t,n).join(":")}}class Je 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 We(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function Ge(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function mo(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function wo(e,t,n){e.setQueryData(g.decofileDraft(We(t)),n)}function So(e,t){return e.getQueryData(g.decofileDraft(We(t)))??null}async function yo(e,t){return(await fetch(Ge(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function ss(e){const t=$.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?We(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Eo,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 Eo(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Oo(e,t){const n=await fetch(Ge(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&&wo(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function is(e,t){const n=await fetch(Ge(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 Je(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return mo(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ft=3e3,Do=15e3,ko=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<ko?Ft:Do}function Io(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:l,skip:c}=e();if(r||t.hidden()||c?.()){i();return}r=!0;let f;try{f=l()}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 To(e,t,n=Qt){const o=L.useRef(t);o.current=t;const[r]=L.useState(()=>({polling:()=>Io(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?r.polling:r.idle,ht,ht)}function Vt(e,t){return be(e,t)}function Po(e,t){return be(e,"preview-fetch",{path:t})}function as(e){return Vt(e,"preview-invoke")}function cs(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 Ro(){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 xo(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Ro();return n&&Bt(n)?new URL(t,n).toString():Po(e,t)}function $o(e){return xo(e,"/.decofile")}function No(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 jo(e,t){const n=be(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=No(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:Cn(s.content)}}async function Co(e,t){const n=await jo(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function ls(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 Ao(e){return Ce(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 us(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 Ye extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class ze extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function fs(e,t){return(t instanceof Ye||t instanceof ze)&&(t.message=Wt(e,t,"github")),t}function Wt(e,t,n){if(t instanceof Ye)return e("siteEditor.save.draftUnread");if(t instanceof ze)return e("siteEditor.save.keptChanging");if(t instanceof Je)return t.message;if(n==="local")return Mo(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 Uo(e,t){if(t==="local"||e instanceof Je||e instanceof Ye||e instanceof ze)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 Mo(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 Lo(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Fo(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=Lo(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const Qo="decocms:content-writes",Te=new Set;let G;function Gt(){if(G!==void 0)return G;G=null;try{typeof BroadcastChannel=="function"&&(G=new BroadcastChannel(Qo),G.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Te])n(t)}))}catch{G=null}return G}function Vo(e){try{Gt()?.postMessage({cacheKey:e})}catch{}}function Bo(e){return Gt(),Te.add(e),()=>{Te.delete(e)}}const Yt="__at=",zt="__test=",Ho=/^[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 Jo(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function X(e){return typeof e=="string"&&Ho.test(e)}function vt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Wo(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 pt(e,t){const o=[...e.split("&").filter(r=>r&&!r.startsWith(Yt)&&!r.startsWith(zt)),...t];return o.length>0?`?${o.join("&")}`:""}function he(e,t){const n=Wo(t),o=e.indexOf("?"),r=o===-1?e:e.slice(0,o);if(X(r))return r+pt(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("?"),l=a===-1?i:i.slice(0,a),c=a===-1?"":i.slice(a+1);return`${l}${pt(c,n)}${e.slice(s)}`}function ds(e,t,n){if(!Jo(t))return e;try{const o=new URL(e),r=o.searchParams.get("__draft");return r&&r!=="off"?(o.searchParams.set("__draft",he(r,t)),o.toString()):X(n)?(o.searchParams.set("__draft",he(n,t)),o.toString()):e}catch{return e}}function hs(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 gs(e,t,n){const o=Go(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Go(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 Yo="__draft";function vs(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const zo="off";function Xo(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Yo,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 bs(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 ms(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const bt="__variant=";function Zt(e,t,n){return`${e}@${t}=${n}`}function ws(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[Zt(e,"sections",t.index)]}function Ss(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 ys(e,t){return[...t,...e]}function Zo(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Xe(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(c=>c&&!c.startsWith(bt)),...t.map(c=>bt+Zo(c))],l=a.length>0?`?${a.join("&")}`:"";return`${s}${l}${e.slice(n)}`}function Es(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 Xe(`${r}${o.pathname}@local`,t)}catch{return null}}function Os(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",Xe(o,t)),n.toString())}catch{return e}}function qo(e){const{pointer:t}=e;if(!t||t===zo)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?he(e.heldRevision,e.previewOptions):he(Xe(t,e.forcedVariants),e.previewOptions)}function Ko(e,t){if(!e||!t)return null;try{return Xo(e,t)}catch{return null}}function Ds(e,t,n){if(!e||!n)return null;try{return Ko(new URL(t,e).toString(),n)}catch{return null}}const ge={forcedVariants:[],previewOptions:{}},se=new Map,ie=new Map,Pe=new Map;function qt(e){for(const t of Pe.get(e)??[])t()}function Kt(e,t){const n=X(t)?t:null;(ie.get(e)??null)!==n&&(n?ie.set(e,n):ie.delete(e),qt(e))}function er(e){return ie.get(e)??null}function tr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ks(e,t){const n=se.get(e)??ge,o=t??ge;tr(n,o)||(t?se.set(e,o):se.delete(e),qt(e))}function nr(e){return se.get(e)??ge}function en(e,t){let n=Pe.get(e);return n||(n=new Set,Pe.set(e,n)),n.add(t),()=>{n.delete(t)}}function or(e){const t=$.c(3);let n,o;return t[0]!==e?(n=r=>en(e,r),o=()=>nr(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,rr)}function rr(){return ge}function sr(e){const t=$.c(3);let n,o;return t[0]!==e?(n=r=>e?en(e,r):ar,o=()=>e?er(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,ir)}function ir(){return null}function ar(){}function _s(e,t){const n=$.c(4),o=or(e),r=sr(e);let s;return n[0]!==o||n[1]!==r||n[2]!==t?(s=qo({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},cr=15e3,ve=new Map;function z(e,t){return`${e}/${t}`}function H(e){let t=ve.get(e);return t||(t={state:tn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ve.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 Ze(e){return ve.get(e)?.state??tn}function lr(e,t){const n=H(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Is(e){const t=H(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Se(t),W(e,{phase:"idle"}))}}function Ts(e){const t=ve.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 ae(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"})},cr),W(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function ur(e){return e?.kind==="protocol"&&e.source==="github"}async function ce(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,l=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await l,{navigates:!1};const c=s?g.protocolDraftRead(o,r,s):null,f=c?JSON.stringify(n.getQueryData(c)??null):null,u=l?[l]:[];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:Ln(o,r,s)})),ur(i)&&c&&!t.adopted&&u.push(n.invalidateQueries({queryKey:c})),await Promise.all(u),t.kind!=="edit"){const p=z(o,r);W(p,{epoch:Ze(p).epoch+1})}const d=c?JSON.stringify(n.getQueryData(c)??null):null,h=f!==d;return h&&await new Promise(p=>Ot.schedule(p)),{navigates:h}}async function fr(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 ae(n,{ok:!1,navigates:!1}),t.refreshOnError&&ce(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&Vo(e.cacheKey),Kt(n,t.shownRevision?.(r)??null),t.adopted){const i=mt(e)!==o;return i&&await new Promise(a=>Ot.schedule(a)),ae(n,{ok:!0,navigates:i}),t.reread&&ce(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await ce(e,t))}catch{}finally{ae(n,{ok:!0,navigates:s})}return r}function Ps(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 l=!1;const c=()=>(l=!0,rn(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:we(o,r,s),scope:bo(o,r,s),mutationFn:c}).execute(void 0).catch(f=>{throw l||ae(i,{ok:!1,navigates:!1}),f}):c()}function Rs(e,t,n){const o=$.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 l=H(s).discardListeners;return l.add(n),()=>{l.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);Ze(t).inFlight>0||(Kt(t,null),ce(e,{kind:"external"}).then(({navigates:n})=>{const o=H(t);o.previews>0&&o.state.inFlight===0&&on(t,n)}).catch(()=>{}))}function dr(e,t){const n=$.c(7);let o;n[0]!==e||n[1]!==t?(o=z(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=c=>lr(r,c),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>Ze(r),n[5]=r,n[6]=a):a=n[6];const l=a;return L.useSyncExternalStore(i,l,l)}const hr=500;function xs(e,t){const{phase:n}=dr(e,t);return Fo(n!=="idle",hr)}function gr(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 $s(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Tn(i,n):vr(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 ee(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 vr(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=ee(e,n);return o?.kind==="delete"?o.version??ue:o?o.version:t.has(B(n))?ue:null}function Ns(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const r=ee(o,n);return r?r.kind==="set"&&r.baseVersion===null:ye(e,t).has(B(n))}function js(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),Z(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===ue?null:d]),a=e.getQueryData(g.contentChanges(n)),l=new Set(i.flatMap(([u])=>{const d=a?ee(a,u):void 0;return(d?d.baseVersion:s?.[u]??null)===null?[u]:[]})),c=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,p]of i){const v=ee(u,h),w=v?v.baseVersion:s?.[h]??null;p!==null?d[h]={kind:"set",version:p,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):!c.has(B(u))&&l.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){Z(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=>eo(o.state.variables)))}function Re(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function te(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof P);throw t.source==="local"&&s?(Re(e,n),new Ht(r)):(t.source==="local"&&Me(r)&&Re(e,n),r)}}const le=new Map;function fn(e,t,n,o){const r=le.get(o);if(r)return r;const s=qe(e,t,n,o,!0);return le.set(o,s),s.finally(()=>le.delete(o))}const Oe=new Set;function pr(e,t,n){const o=$.c(8),r=ne(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let l,c;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(l=()=>{if(!e||!s||!i||!a)return;const f={orgSlug:s,virtualMcpId:i,branch:a};return Bo(u=>{u===n&&(Oe.has(n)||(Oe.add(n),mr(r,e,f,n).catch(br).finally(()=>Oe.delete(n))))})},c=[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]=l,o[7]=c):(l=o[6],c=o[7]),L.useEffect(l,c)}function br(){}async function mr(e,t,n,o){const r=le.get(o);return r&&await r.catch(()=>{}),fn(e,t,n,o)}async function qe(e,t,n,o,r){Z(e);const s=g.decofile(o),i=an(n,t),a=g.contentRevision(o),l=g.contentVersions(o),c=e.getQueryData(s),f=e.getQueryData(l),d=e.getQueryData(i),h=e.getQueryData(a)??void 0,p=r&&c&&f?h?.revision:void 0,v=r&&d?h?.schemaVersion:void 0,w=g.contentChanges(o),_=e.getQueryData(w);if(t.source==="github"&&t.hosted)return wr(e,t,t.hosted,n,o,{conditional:r,seen:h,currentMeta:d,schemaIfNoneMatch:v,seenChanges:_});const[E,R,I]=await te(e,t,n,()=>t.client.batch([{method:"blocks.list",params:p?{ifNoneMatch:p}:{}},{method:"schema.get",params:v?{ifNoneMatch:v}:{}},{method:"changes.list",params:Ue(_)}])),N=e.getQueryData(a)?.revision,x=N!==void 0&&N!==h?.revision;if(I?.ok){const O=x?null:fe(_,I.result);O&&e.setQueryData(w,O)}else I&&t.source==="local"&&Me(I.error)&&Re(e,n);if(!E?.ok)throw E?.error??new Error("no blocks.list");if(!R)throw new Error("no schema.get");const b=E.result,U=Qe(R),D=R.ok&&!U?R.result:null;if(b.notModified&&(!c||!f)||D?.notModified&&!d)return qe(e,t,n,o,!1);const T=b.notModified?new Set:un(e,n),j=b.notModified?c:Kn(b.blocks,c,T),C=U?Mt():D?D.notModified?d:D.schema:R.error;if(e.setQueryData(a,{revision:x?N:b.notModified?h?.revision:b.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(s,j),!b.notModified){const O=e.getQueryData(l),M={...b.versions};for(const A of T){const k=O?.[A];k!==void 0?M[A]=k:delete M[A]}e.setQueryData(l,M)}return C instanceof P||e.setQueryData(i,C),!x&&!b.notModified&&c&&h?.revision&&b.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 wr(e,t,n,o,r,s){const i=g.decofile(r),a=g.contentIndex(r),l=g.contentRevision(r),c=g.contentVersions(r),f=an(o,t),u=g.contentChanges(r),d=e.getQueryData(a),h=s.conditional&&d?s.seen?.revision:void 0,[p,v,w]=await te(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:Ue(s.seenChanges)}])),_=e.getQueryData(a)??d,E=e.getQueryData(l)?.revision,R=E!==void 0&&E!==s.seen?.revision;if(w?.ok&&!R){const y=fe(s.seenChanges,w.result);y&&e.setQueryData(u,y)}if(!p?.ok)throw p?.error??new Error("no cms.index");if(!v)throw new Error("no schema.get");const I=p.result,N=Qe(v),x=v.ok&&!N?v.result:null;if(I.notModified&&!d||x?.notModified&&!s.currentMeta)return qe(e,t,o,r,!1);const b=N?Mt():x?x.notModified?s.currentMeta:x.schema:v.error;b instanceof P||e.setQueryData(f,b);const U=x?x.notModified?s.seen?.schemaVersion:x.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||R)return e.setQueryData(l,{revision:R?E:s.seen?.revision,schemaVersion:U}),e.setQueryData(i,D),{blocks:D,meta:b};const T={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.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(l,{revision:T.revision,schemaVersion:U});const C=un(e,o),O=e.getQueryData(c)??{},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(c,A),k.length>0&&await xn(e,n,r,k,C),_&&j&&Sr(_,T)&&sn({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:r}),{blocks:e.getQueryData(i)??M,meta:b}}function Sr(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 yr(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 Er(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){Z(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===ue?null:i]))),Dt(e,n,r,o.set??{})}async function Cs(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(c=>!s||!Object.hasOwn(s,c));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const l=In(r.set);if(l.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${l.join(", ")})`)}return fr({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=>te(e,t,n,()=>t.client.blocksApply({set:f.set,delete:f.delete,...s?{ifMatch:yr(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=Er(r,u);Object.keys(u).length>0&&St(e,n,o,r,u);let h;try{h=await i(d)}catch(p){const v=wt(p);throw v&&Object.keys(v).length>0&&St(e,n,o,d,v),p}a={...h,versions:{...u,...h.versions}}}Z(e);const l=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:l}));const c=a.versions??{};return Ee(e,o,c),{revision:l,versions:c}}})}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){Z(e),Pn(e,n,o);const r=o.block===null,s=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=i?ee(i,n):void 0,l=a?a.baseVersion:s?.[n]??null;if(i){const c=B(n),f=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(u)!==c));r?l!==null&&(f[n]={kind:"delete",version:null,baseVersion:l}):f[n]={kind:"set",version:o.version,baseVersion:l},e.setQueryData(g.contentChanges(t),{...i,changes:f,edited:!0})}pe(e,t,n,r&&l===null),e.setQueryData(g.decofile(t),c=>{const f={...c};return r?delete f[n]:f[n]=o.block,f}),Ee(e,t,{[n]:r?null:o.version}),Rn(e,t,n,o)}function As(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,l)=>{vn(e,n,a,i[l])}),!0)}async function Us(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 c=(await te(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(c&&c.after===null&&c.version!==null)return!1;a={value:c?.after??null,version:c?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),f=>{if(!f)return f;const u={...f.changes};return c?.kind?u[r]={kind:c.kind,version:c.version,baseVersion:c.baseVersion}:delete u[r],{...f,changes:u,edited:!0}})}catch{const l=await te(e,t,n,()=>t.client.blocksList({}));if(l.notModified)return!1;a={value:l.blocks[r]??null,version:l.versions[r]??null}}return e.setQueryData(g.decofile(o),l=>{const c={...l};return a.value===null?delete c[r]:c[r]=a.value,c}),Ee(e,o,{[r]:a.version}),!1}function Or(e){const t=$.c(17),n=Ce(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 l;t[9]!==s||t[10]!==i||t[11]!==a?(l={queryKey:s,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=s,t[10]=i,t[11]=a,t[12]=l):l=t[12];const{data:c,isPending:f,isError:u}=F(l),d=!!e&&!!r&&f&&!u;if(!e||!c?.draft||!c.version){let v;return t[13]!==d?(v={pointer:null,pending:d},t[13]=d,t[14]=v):v=t[14],v}const h=`${c.draft}@${c.version}`;let p;return t[15]!==h?(p={pointer:h,pending:!1},t[15]=h,t[16]=p):p=t[16],p}function Ms(e){return Or(e).pointer}function Ls(e){const t=$.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:Dr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function Dr(){throw new Error("content revisions are set by reads and writes")}function xe(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Fs(e,t){return xe({...e,protocolSuffix:t.cacheKeySuffix})}function Ke(e,t){const n=$.c(6),{url:o}=Lt(e?.virtualMcpId),r=me(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"?xe({...e,protocolSuffix:r.cacheKeySuffix}):xe({...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 Qs(e,t){const n=$.c(46),{url:o}=Lt(e?.virtualMcpId),r=!!o,s=me(e?.virtualMcpId,e?.branch),i=s.kind==="protocol"?s:null,a=Ke(e),l=t?.fetchEnabled??!0,c=Ao(e?.virtualMcpId),f=_t(e?.virtualMcpId).runtime==="cms",u=ne();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 p;n[2]!==e||n[3]!==u||n[4]!==h?(p=()=>{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]=p):p=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=So(u,e)?.version;if(O&&!await yo(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]!==p||n[14]!==v?(w={skip:p,read:v},n[13]=p,n[14]=v,n[15]=w):w=n[15],To(!!t?.pollWhile&&!!e,w);const _=kt(i?.hosted?a:"");let E;n[16]!==s.kind||n[17]!==f||n[18]!==l||n[19]!==a||n[20]!==r||n[21]!==o||n[22]!==c||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 gr("decofile");if(r){const k=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Ir),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 Oo(u,e);const O=()=>Co(e,po(c,".deco/blocks.gen.json"));if(l){const k=await fetch($o(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]=l,n[19]=a,n[20]=r,n[21]=o,n[22]=c,n[23]=e,n[24]=i,n[25]=u,n[26]=E):E=n[26];const R=!!e&&s.kind!=="pending",I=i?0:3e4,N=i?.describe.pollIntervalMs,x=i?"always":void 0;let b;n[27]!==f||n[28]!==r||n[29]!==i?(b=(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]=b):b=n[30];let U;n[31]!==h||n[32]!==E||n[33]!==R||n[34]!==I||n[35]!==N||n[36]!==x||n[37]!==b?(U={queryKey:h,queryFn:E,enabled:R,staleTime:I,refetchInterval:N,refetchIntervalInBackground:!1,refetchOnWindowFocus:x,retry:b,retryDelay:kr},n[31]=h,n[32]=E,n[33]=R,n[34]=I,n[35]=N,n[36]=x,n[37]=b,n[38]=U):U=n[38];const D=F(U);let T;n[39]!==_||n[40]!==D?(T=_&&D.data?$n(_,D.data):void 0,n[39]=_,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 kr(e){return jn(5e3,1e3,e,2,0)}function _r(){return null}function Ir(){return null}function Vs(e,t,n){const o=me(e?.virtualMcpId,e?.branch),r=Ke(e),s=o.kind==="protocol"?o.hosted:void 0;return Nn(s,r,t,n)}function Bs(e,t){const n=$.c(3),o=me(e?.virtualMcpId,e?.branch),r=Ke(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[,l]=a;return t(l.meta?.type??"")}).map(Tr),n[0]=s?.entries,n[1]=t,n[2]=i):i=n[2],i}function Tr(e){const[t]=e;return t}const Pr="site-editor-save",pn={id:Pr,description:void 0,action:void 0,cancel:void 0},Hs="site-editor-undo",$e="site-editor-publish";function Rr(e){const t=$.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 bn(e,t){return t?Y.jsx(Rr,{label:e("siteEditor.details"),detail:t}):void 0}function Js(e,t,n){K.error(Wt(e,t,n),{...pn,description:bn(e,Uo(t,n))})}function Ws(e,t,n=!1){K.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...pn,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const mn={action:void 0,duration:void 0};function Gs(e,t){K.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...mn,id:$e,description:void 0})}function Ys(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=bn(e,o??null);K[i](t,{id:$e,description:n&&a?Y.jsxs(Y.Fragment,{children:[Y.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:l=>{l.preventDefault(),K.loading(s??e("thread.publishPopover.publishing"),{...mn,id:$e,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{Fs as $,ms as A,xs as B,Kr as C,Or as D,Vs as E,z as F,sr as G,ks as H,Es as I,he as J,zo as K,Xo as L,ds as M,Os as N,gs as O,Ts as P,Is as Q,dr as R,Ke as S,Ct as T,Ls as U,ps as V,bo as W,we as X,fr as Y,jo as Z,mo as _,Xr as a,Br as a0,Jr as a1,Bs as a2,Ws as a3,Ns as a4,fs as a5,Je as a6,us as a7,mr as a8,Ye as a9,gr as aA,ls as aB,ze as aC,As as aD,$e as aE,mn as aF,Gs as aG,Ps as aH,Qr as aI,Vr as aJ,Me as aK,ss as aL,Ms as aM,vs as aN,X as aO,hs as aP,Ys as aQ,Hs as aR,pn as aS,un as aT,bs as aU,cs as aV,ws as aW,Ss as aX,ys as aY,Cs as aa,Us as ab,Js as ac,$s as ad,an as ae,wo as af,is as ag,Rs as ah,js as ai,qr as aj,os as ak,ct as al,lt as am,rs as an,xo as ao,ts as ap,Yn as aq,bn as ar,zs as as,Go as at,Hr as au,Qn as av,Rr as aw,_s as ax,Ds as ay,fn as az,Xn as b,Lt as c,Gn as d,zr as e,zn as f,He as g,Ae as h,xt as i,as as j,Po as k,Qs as l,Zr as m,ns as n,Ao as o,Wr as p,po as q,Yr as r,Gr as s,qo as t,me as u,Ko as v,Jo as w,Co as x,At as y,es as z};