decocms 4.524.3 → 4.526.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 (409) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-CZUL4aQf.js → ActiveShapeUtils-DC_uFkfj.js} +1 -1
  2. package/dist/client/assets/{AlertCircle-CHPvy_VM.js → AlertCircle-BD_uk8jv.js} +1 -1
  3. package/dist/client/assets/{AreaChart-DXZAxruT.js → AreaChart-T5mjvoB9.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-D_5CBumM.js → ArrowLeft-BW4hi-fE.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DhHGL7HY.js → ArrowUp-D7In3NHD.js} +1 -1
  6. package/dist/client/assets/{BarChart-D1RHjiDU.js → BarChart-D0_iZiOj.js} +1 -1
  7. package/dist/client/assets/{Building02-Cs-fRF4C.js → Building02-Dw5n9775.js} +1 -1
  8. package/dist/client/assets/{CartesianChart-B6XqwP69.js → CartesianChart-NHrVliZJ.js} +1 -1
  9. package/dist/client/assets/{CategoricalChart-CiyWbCkx.js → CategoricalChart-Dup_V6G1.js} +1 -1
  10. package/dist/client/assets/{CheckCircle-DFdmK-T2.js → CheckCircle-BnPGwhwQ.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-B7yaofOD.js → ChevronSelectorVertical-Bc1L64FX.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-PedQ2gd6.js → ChevronUp-B_2ftJO2.js} +1 -1
  13. package/dist/client/assets/{Copy01-B6cJ_ygs.js → Copy01-sA0-K7LG.js} +1 -1
  14. package/dist/client/assets/{CreditCard01-bH_MgXhH.js → CreditCard01-lyKg_Ohv.js} +1 -1
  15. package/dist/client/assets/{DotsVertical-B50qkKfK.js → DotsVertical-BK4Fy8Nl.js} +1 -1
  16. package/dist/client/assets/{ErrorBarContext-D3MOF1QH.js → ErrorBarContext-BZpAcgpU.js} +1 -1
  17. package/dist/client/assets/{Globe04-BvSQLcQH.js → Globe04-BAEL3SMQ.js} +1 -1
  18. package/dist/client/assets/{Image01-D6z5fxVv.js → Image01-DDkvI5Nm.js} +1 -1
  19. package/dist/client/assets/{Key01-DIVY2Gpo.js → Key01-BX6BY9_T.js} +1 -1
  20. package/dist/client/assets/{Link01-D806UI0V.js → Link01-xEj9KoHs.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-Be879sLY.js → LinkBroken01-DQGhuKN9.js} +1 -1
  22. package/dist/client/assets/{Minus-DVOE0qZc.js → Minus-Czq0iKR1.js} +1 -1
  23. package/dist/client/assets/{Monitor01-CP0zz7rW.js → Monitor01-D31PU3Iy.js} +1 -1
  24. package/dist/client/assets/{Play-DG-gbp_U.js → Play-AHwZFZb2.js} +1 -1
  25. package/dist/client/assets/{Plus-feGO5xhL.js → Plus-Dl2sBaoj.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-oNnV1mWS.js → ReferenceLine-DbFJQbfX.js} +1 -1
  27. package/dist/client/assets/{SearchMd-OqihyBBE.js → SearchMd-CPTG-cGa.js} +1 -1
  28. package/dist/client/assets/{Sector-BH34m5G1.js → Sector-DoDCEu0-.js} +1 -1
  29. package/dist/client/assets/{ShoppingBag01-ZgB-qLs9.js → ShoppingBag01-Bnl1luer.js} +1 -1
  30. package/dist/client/assets/{Sun-DQ0xzUJx.js → Sun-DaQ4UYay.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-Dsf5zpNu.js → SwitchHorizontal01-DDdcI_Kz.js} +1 -1
  32. package/dist/client/assets/{Tool01-PlDxztWD.js → Tool01-lXzjYHgk.js} +1 -1
  33. package/dist/client/assets/{Trash01-BqnutNRJ.js → Trash01-DuRmK_Vz.js} +1 -1
  34. package/dist/client/assets/{Upload01-CyyevXMg.js → Upload01-C0iYEe1U.js} +1 -1
  35. package/dist/client/assets/{UserSquare-Csbu2VpZ.js → UserSquare-CVuHc6NN.js} +1 -1
  36. package/dist/client/assets/{Users01-BSztUOd5.js → Users01-BZCA5rox.js} +1 -1
  37. package/dist/client/assets/{XClose-CGLyFs-P.js → XClose-D_c5VtJ7.js} +1 -1
  38. package/dist/client/assets/{ZoomOut-DTBYck8o.js → ZoomOut-6mAbwFTL.js} +1 -1
  39. package/dist/client/assets/{access-gate-CQo9WEtv.js → access-gate-emovLjaE.js} +1 -1
  40. package/dist/client/assets/{add-connection-dialog-BXhPQM8W.js → add-connection-dialog-BlF-9HgF.js} +1 -1
  41. package/dist/client/assets/agent-analytics-eg0FLES8.js +1 -0
  42. package/dist/client/assets/agent-app-C2u1s2rV.js +1 -0
  43. package/dist/client/assets/{agent-assets-DPXKGmqE.js → agent-assets-BAd1z_dv.js} +1 -1
  44. package/dist/client/assets/{agent-automation-68EhX00q.js → agent-automation-D0aT1OFy.js} +3 -3
  45. package/dist/client/assets/{agent-automations-XvbfNN1P.js → agent-automations-BlwkZbIc.js} +1 -1
  46. package/dist/client/assets/agent-calendar-C8huSLtG.js +1 -0
  47. package/dist/client/assets/{agent-connect-sources-D3zK6Sae.js → agent-connect-sources-B67Xzkom.js} +1 -1
  48. package/dist/client/assets/agent-deck-CsY1IJMK.js +1 -0
  49. package/dist/client/assets/{agent-e2e-DQcmFy3H.js → agent-e2e-R48p6SJ6.js} +1 -1
  50. package/dist/client/assets/agent-experiments-d1mGB0I-.js +1 -0
  51. package/dist/client/assets/{agent-file-JtT0MyWr.js → agent-file-C6-oAsv5.js} +1 -1
  52. package/dist/client/assets/{agent-hosting-BxPrxIfg.js → agent-hosting-J3iEXzR-.js} +1 -1
  53. package/dist/client/assets/{agent-icon-CTGtlw1z.js → agent-icon-DMtM72Tt.js} +1 -1
  54. package/dist/client/assets/agent-library-Co6OcioD.js +1 -0
  55. package/dist/client/assets/agent-library-file-s3V9TMH_.js +1 -0
  56. package/dist/client/assets/agent-monitor-DR59rgyn.js +1 -0
  57. package/dist/client/assets/{agent-overview-B9lC95oC.js → agent-overview-BwLxQOC8.js} +1 -1
  58. package/dist/client/assets/{agent-releases-OHw-HILT.js → agent-releases-Bv_Fj-fG.js} +1 -1
  59. package/dist/client/assets/agent-settings-DN6t98hS.js +1 -0
  60. package/dist/client/assets/{agent-site-editor-DL4MgFcw.js → agent-site-editor-DUzu_bGf.js} +1 -1
  61. package/dist/client/assets/agent-site-editor-code-BizWsdC8.js +2 -0
  62. package/dist/client/assets/agent-site-editor-content-bHNeasNi.js +1 -0
  63. package/dist/client/assets/agent-site-editor-preview-CTJyzsCD.js +1 -0
  64. package/dist/client/assets/agent-view-CwVHf1dh.js +1 -0
  65. package/dist/client/assets/{agent-view-guard-BrroWBJx.js → agent-view-guard-C33ioBBA.js} +1 -1
  66. package/dist/client/assets/{agents-list-DIpYtUlJ.js → agents-list-B_dpoV9N.js} +1 -1
  67. package/dist/client/assets/{ai-providers-DJSUQnD1.js → ai-providers-Bge9epIB.js} +1 -1
  68. package/dist/client/assets/{alert-GbAkes7m.js → alert-BagxECyU.js} +1 -1
  69. package/dist/client/assets/{analytics-sections-Bb2X2x1n.js → analytics-sections-D-M6iYAs.js} +1 -1
  70. package/dist/client/assets/analytics-tab-B1VZR-c0.js +2 -0
  71. package/dist/client/assets/api-keys-DRagwPnq.js +1 -0
  72. package/dist/client/assets/{api-keys-CUAWVknr.js → api-keys-mLcadUeH.js} +1 -1
  73. package/dist/client/assets/{app-editor-CyjHGv_R.js → app-editor-B39dLTjO.js} +1 -1
  74. package/dist/client/assets/{asset-utils-cXz86Lc9.js → asset-utils-Qf3MBvDM.js} +1 -1
  75. package/dist/client/assets/{auth-Dfomi5JO.js → auth-CODe_IGw.js} +1 -1
  76. package/dist/client/assets/{auth-catchall-CQPN8xxO.js → auth-catchall-Bq6t3RQb.js} +1 -1
  77. package/dist/client/assets/{auth-entry-CopJeOJe.js → auth-entry-CWQ1DjR2.js} +1 -1
  78. package/dist/client/assets/{auth-split-layout-DlqDAzsj.js → auth-split-layout-N_F8g5or.js} +1 -1
  79. package/dist/client/assets/{authenticate-and-persist-oauth-CIjqyOtu.js → authenticate-and-persist-oauth-miETlukP.js} +1 -1
  80. package/dist/client/assets/{automation-list-row-DjtEQ2qE.js → automation-list-row-D5XF29Op.js} +1 -1
  81. package/dist/client/assets/{automation-runs-Fh82uxKP.js → automation-runs-DJ07XO-E.js} +1 -1
  82. package/dist/client/assets/{automations-v0vsa1w4.js → automations-B1NIl2V1.js} +1 -1
  83. package/dist/client/assets/{autosend-1kVbs2RQ.js → autosend-3uc8bTVc.js} +1 -1
  84. package/dist/client/assets/{badge-Cd6N93gT.js → badge-DlHCn1A-.js} +1 -1
  85. package/dist/client/assets/{block-document-Eqc7jC1E.js → block-document-CU0om3ul.js} +1 -1
  86. package/dist/client/assets/{blocks-preview-workspace-context-DmNovEJ2.js → blocks-preview-workspace-context-Bs9hknsf.js} +1 -1
  87. package/dist/client/assets/{blocks-tab-states-EZ53-FeU.js → blocks-tab-states-CgmkhE5b.js} +1 -1
  88. package/dist/client/assets/{blog-schema-BIlyKinw.js → blog-schema-Cf2Q45ow.js} +1 -1
  89. package/dist/client/assets/{buckets-DeThgb1z.js → buckets-C8wYCyB4.js} +1 -1
  90. package/dist/client/assets/{build-improve-prompt-doc-BhOi567C.js → build-improve-prompt-doc-CieiO0m9.js} +1 -1
  91. package/dist/client/assets/{calendar-CZnHQIdE.js → calendar-Bkrc3Tn3.js} +1 -1
  92. package/dist/client/assets/{capability-load-error-BoUVRT1s.js → capability-load-error-ByfliPkI.js} +1 -1
  93. package/dist/client/assets/{category-editor-CRQwImqd.js → category-editor-BnfSIHWl.js} +1 -1
  94. package/dist/client/assets/{cdn-tab-DGJOOmwS.js → cdn-tab-Bia8Lu-O.js} +1 -1
  95. package/dist/client/assets/{chart-DIxDpRCA.js → chart-CgNZZhP9.js} +1 -1
  96. package/dist/client/assets/{chat-context-2letHrEJ.js → chat-context-BvGd3d4B.js} +1 -1
  97. package/dist/client/assets/{chat-draft-BamZUeXG.js → chat-draft-CxBIV5gW.js} +1 -1
  98. package/dist/client/assets/{checkbox-vkygLbK1.js → checkbox-DYPRxtdw.js} +1 -1
  99. package/dist/client/assets/{choose-editor-CvBlgOf7.js → choose-editor-lzUALJ0J.js} +1 -1
  100. package/dist/client/assets/{cli-auth-success-DbYRVqF9.js → cli-auth-success-DCEv0dGc.js} +1 -1
  101. package/dist/client/assets/{client-icons-Byj2LmW_.js → client-icons-BGlfNbZa.js} +1 -1
  102. package/dist/client/assets/cms-settings-editor-Dq-4a_kO.js +1 -0
  103. package/dist/client/assets/{collapsible-DsyQMORE.js → collapsible-CQW9roHO.js} +1 -1
  104. package/dist/client/assets/{collection-detail-DWStyXoZ.js → collection-detail-BuEzbz9Y.js} +1 -1
  105. package/dist/client/assets/{collection-display-button-DxqDuoDs.js → collection-display-button-DWql8bbv.js} +1 -1
  106. package/dist/client/assets/{collection-search-BT_p6pKF.js → collection-search-C4Wx-QCL.js} +1 -1
  107. package/dist/client/assets/{collection-table-wrapper-Bu9UKC3v.js → collection-table-wrapper-C78BbtoQ.js} +1 -1
  108. package/dist/client/assets/{collection-tabs-D6nWmqmK.js → collection-tabs--jJp2ESY.js} +1 -1
  109. package/dist/client/assets/{column-rules-1_e0Bdla.js → column-rules-CVWJNCag.js} +1 -1
  110. package/dist/client/assets/{combobox-C05HI-BC.js → combobox-CQVbSSH0.js} +1 -1
  111. package/dist/client/assets/{command-CPzIRDl7.js → command-BCnC3TbE.js} +1 -1
  112. package/dist/client/assets/{companion-mcps-section-8bJuflHh.js → companion-mcps-section-BvoDqJGx.js} +1 -1
  113. package/dist/client/assets/{config-g4_iXJef.js → config-DA0hECT3.js} +1 -1
  114. package/dist/client/assets/{connect-layout-B0kvJrgY.js → connect-layout-DRegpYUF.js} +1 -1
  115. package/dist/client/assets/{connect-source-dialog-Drua8oaC.js → connect-source-dialog-CgwCkNcq.js} +1 -1
  116. package/dist/client/assets/{connect-uOeiI1CS.js → connect-symmmDTG.js} +1 -1
  117. package/dist/client/assets/{connection-BHsOzStk.js → connection-D9ij5W2w.js} +1 -1
  118. package/dist/client/assets/{connection-card-CYaVyCqL.js → connection-card-Ds4cDjLL.js} +1 -1
  119. package/dist/client/assets/{connection-detail-C6xJbNuX.js → connection-detail-DrlA1Ahp.js} +1 -1
  120. package/dist/client/assets/{connection-form-helpers-D-t8mb0f.js → connection-form-helpers-BPCfMFZi.js} +1 -1
  121. package/dist/client/assets/{connections-D-CMEpMd.js → connections-B9flO4yA.js} +1 -1
  122. package/dist/client/assets/content-tab-BVTaK5gN.js +22 -0
  123. package/dist/client/assets/{context-TIPHj43k.js → context-CTNoGJP0.js} +1 -1
  124. package/dist/client/assets/{context-menu-7c-Y-PHB.js → context-menu-DVvUVMuo.js} +1 -1
  125. package/dist/client/assets/{context-shell-n8IEtxwr.js → context-shell-B6eX4miz.js} +3 -3
  126. package/dist/client/assets/{core.esm-Bp5Q1Stg.js → core.esm-7J0R8lPd.js} +1 -1
  127. package/dist/client/assets/{create-organization-dialog-mPrO9oSa.js → create-organization-dialog-Clkjs9zG.js} +1 -1
  128. package/dist/client/assets/{daily-pulse-C7I4Uxdj.js → daily-pulse-DTX6fglY.js} +1 -1
  129. package/dist/client/assets/{discover-7t1pJX8W.js → discover-BMP5MmHd.js} +1 -1
  130. package/dist/client/assets/{domain-settings-CXb5s0he.js → domain-settings-CA0QhXOB.js} +1 -1
  131. package/dist/client/assets/{drawer-CtTfZzW7.js → drawer-D2Rnb_2A.js} +1 -1
  132. package/dist/client/assets/{editor-BDmCsl05.js → editor-CFcE0Q6O.js} +1 -1
  133. package/dist/client/assets/{editor-classes-BJAtiMt8.js → editor-classes-C8l2uWj9.js} +1 -1
  134. package/dist/client/assets/{empty-state-BFtVVtPz.js → empty-state-B7gwb6En.js} +1 -1
  135. package/dist/client/assets/{empty-state-BpneGtoe.js → empty-state-BWR7Jy-d.js} +1 -1
  136. package/dist/client/assets/experiments-tab-BEtrD30X.js +1 -0
  137. package/dist/client/assets/{experiments-tab-choice-vFGVi3bn.js → experiments-tab-choice-BPWZ6-EI.js} +1 -1
  138. package/dist/client/assets/{extract-connection-data-CF7y2wEt.js → extract-connection-data-TNmbX43n.js} +1 -1
  139. package/dist/client/assets/{feature-gate-CM-Nk9xN.js → feature-gate-DvDHZ9Mm.js} +1 -1
  140. package/dist/client/assets/{feature-paywall-CjqBZ6L8.js → feature-paywall-CF5xE385.js} +1 -1
  141. package/dist/client/assets/{file-explorer-BboVEb8_.js → file-explorer-CS8ncEOg.js} +2 -2
  142. package/dist/client/assets/{file-preview-Bvo7zdtc.js → file-preview-Duo4jala.js} +1 -1
  143. package/dist/client/assets/{file-share-button-CXYkYNE_.js → file-share-button-T0wDAb3T.js} +1 -1
  144. package/dist/client/assets/{file-type-icon-CjiJpbk5.js → file-type-icon-C3nhEJVa.js} +1 -1
  145. package/dist/client/assets/{folder-icon-BZUD34gC.js → folder-icon-nOlxOX5D.js} +1 -1
  146. package/dist/client/assets/{form-DrzlJwQH.js → form-DiOJGRXq.js} +1 -1
  147. package/dist/client/assets/{general-Cd6mSkL_.js → general-CfuztBKa.js} +1 -1
  148. package/dist/client/assets/{held-block-view-R3GhxO1l.js → held-block-view-BX5kI9L6.js} +3 -3
  149. package/dist/client/assets/{home-CrEXzaHC.js → home-CIp4mcn9.js} +1 -1
  150. package/dist/client/assets/{icon-button-j3Ikexya.js → icon-button-DBRjX149.js} +1 -1
  151. package/dist/client/assets/{index-BZXHvOuQ.js → index-8m5i8k8L.js} +1 -1
  152. package/dist/client/assets/{index-CPP16Pqo.js → index-BKbYYz_9.js} +1 -1
  153. package/dist/client/assets/{index-BjON6Ore.js → index-BwcojXtb.js} +1 -1
  154. package/dist/client/assets/{index-6M_m-_Us.js → index-C4TQ1HxV.js} +1 -1
  155. package/dist/client/assets/{index-BJ9m9LNK.js → index-C5hxtG-B.js} +48 -48
  156. package/dist/client/assets/{index-DyS4s94t.js → index-CEQNEhri.js} +1 -1
  157. package/dist/client/assets/{index-Da5shA_7.js → index-CKIGEOaR.js} +1 -1
  158. package/dist/client/assets/{index-Cs2qsEhb.js → index-CSFBWEpH.js} +1 -1
  159. package/dist/client/assets/{index-DT3sLrgG.js → index-CjgyzS_N.js} +1 -1
  160. package/dist/client/assets/{index-BhEe0I5z.js → index-CtP2SeqS.js} +1 -1
  161. package/dist/client/assets/index-DfpwvZQG.css +1 -0
  162. package/dist/client/assets/{index-B7a1uePd.js → index-S0DELbp3.js} +1 -1
  163. package/dist/client/assets/{index-Dj2ac1Ct.js → index-WbBBGlvR.js} +1 -1
  164. package/dist/client/assets/{index-DEhrG7UG.js → index-h0OzTGt5.js} +1 -1
  165. package/dist/client/assets/{index-redirect-Ch_11yeO.js → index-redirect-CVRDzXhR.js} +1 -1
  166. package/dist/client/assets/{index-DO1wPTie.js → index-rpRRVwY4.js} +1 -1
  167. package/dist/client/assets/{index-Zaz397OF.js → index-xUcGx-v6.js} +1 -1
  168. package/dist/client/assets/{infiniteQueryObserver-CM3ITLPo.js → infiniteQueryObserver-cbOSzSkb.js} +1 -1
  169. package/dist/client/assets/{infra-billing-D_W3RIFV.js → infra-billing-XSCNwrQM.js} +1 -1
  170. package/dist/client/assets/{input-DipMvobq.js → input-D2PyfPad.js} +1 -1
  171. package/dist/client/assets/{input-DTDcy6hY.js → input-Dt5Q4j50.js} +4 -4
  172. package/dist/client/assets/{integration-icon-gBiw8y2C.js → integration-icon-tGNPaW9N.js} +1 -1
  173. package/dist/client/assets/{jira-icon-Cus3NRDL.js → jira-icon-CFz7Llru.js} +1 -1
  174. package/dist/client/assets/{label-BWO7BDzN.js → label-BOjT8VGh.js} +1 -1
  175. package/dist/client/assets/{layout-C4eU6U_z.js → layout-DhRsFafF.js} +1 -1
  176. package/dist/client/assets/{legacy-agents-deep-CDxdVAmP.js → legacy-agents-deep-B49sqXaq.js} +1 -1
  177. package/dist/client/assets/{legacy-main-redirect-BTqRcXg6.js → legacy-main-redirect-COxrUPZf.js} +1 -1
  178. package/dist/client/assets/library-SvGtiu-I.js +1 -0
  179. package/dist/client/assets/{login-UOHS7fQN.js → login-CoLmyN-v.js} +1 -1
  180. package/dist/client/assets/{markdown-BG06zpZJ.js → markdown-B-00ZOm1.js} +1 -1
  181. package/dist/client/assets/{mcp-app-renderer-CxONPSoj.js → mcp-app-renderer-CCB0FZaP.js} +1 -1
  182. package/dist/client/assets/{mcp-oauth-C_vXn_zS.js → mcp-oauth-DVsOtQR9.js} +1 -1
  183. package/dist/client/assets/{mcp-oauth-hbfUsWSk.js → mcp-oauth-KanvJCH4.js} +1 -1
  184. package/dist/client/assets/{members-DiPd0w69.js → members-DHTdA9CE.js} +1 -1
  185. package/dist/client/assets/{memory-D7_gYCf3.js → memory-BYBvW9AV.js} +1 -1
  186. package/dist/client/assets/{mini-report-page-DudoCNBc.js → mini-report-page-NW8WIoT5.js} +1 -1
  187. package/dist/client/assets/{mock-board-COFBA38P.js → mock-board-CIopg7St.js} +3 -3
  188. package/dist/client/assets/{monaco-editor-Bp87HTy0.js → monaco-editor-zjNnLgmQ.js} +1 -1
  189. package/dist/client/assets/monitoring-cAdHMyPk.js +1 -0
  190. package/dist/client/assets/{monitoring-stats-row-DZiWF0MT.js → monitoring-stats-row-1Q8Z2Hv-.js} +1 -1
  191. package/dist/client/assets/{multi-select-ClUvymCl.js → multi-select-CdYbSc0c.js} +1 -1
  192. package/dist/client/assets/{mustache-SEzsgR-s.js → mustache-Kyny1r3W.js} +1 -1
  193. package/dist/client/assets/{named-rule-uses-DBpP8kZW.js → named-rule-uses-Bf97NaES.js} +1 -1
  194. package/dist/client/assets/{new-project-dialog-BIxGYry7.js → new-project-dialog-CLihIY3l.js} +1 -1
  195. package/dist/client/assets/{oauth-callback-CgnzMW_h.js → oauth-callback-Bxa5qlpI.js} +1 -1
  196. package/dist/client/assets/{oauth-callback-ai-provider-CrNuoNuA.js → oauth-callback-ai-provider-DO2-ZScF.js} +1 -1
  197. package/dist/client/assets/{onboarding-CPcIJ7Kl.js → onboarding-2ZGmpM3l.js} +1 -1
  198. package/dist/client/assets/{openai-conversation-BVVfXB0S.js → openai-conversation-Dq-_t63g.js} +1 -1
  199. package/dist/client/assets/{optimistic-project-sidebar-views-CGrVGbzf.js → optimistic-project-sidebar-views-BWPyOzxV.js} +1 -1
  200. package/dist/client/assets/{order-monitor-day-_COSpI9X.js → order-monitor-day-B6I3Kbql.js} +1 -1
  201. package/dist/client/assets/{organization-choice-DM-i-ste.js → organization-choice-Dfm2FKp6.js} +1 -1
  202. package/dist/client/assets/{orgs-DBGdo2ep.js → orgs-DTG6JzmV.js} +1 -1
  203. package/dist/client/assets/{page-seo-form-B-bTZXwI.js → page-seo-form-DiHazFky.js} +1 -1
  204. package/dist/client/assets/{pair-CeWIXyL1.js → pair-BkPRQRG3.js} +1 -1
  205. package/dist/client/assets/{parse-sections-CzJo2WgK.js → parse-sections-BDlriD2E.js} +1 -1
  206. package/dist/client/assets/{plan-6sf6fzbJ.js → plan-DcVKW3BC.js} +1 -1
  207. package/dist/client/assets/{plan-ladder-Co29049V.js → plan-ladder-Bk5SqgcV.js} +1 -1
  208. package/dist/client/assets/{popover-C5Dt3qOY.js → popover-C4qbExP3.js} +1 -1
  209. package/dist/client/assets/{post-calendar-DOKKScLr.js → post-calendar-DJZU4OZ1.js} +1 -1
  210. package/dist/client/assets/{post-editor-L6XkKTbk.js → post-editor-DQF_MOM6.js} +1 -1
  211. package/dist/client/assets/{preview-content-CY8QtGeB.js → preview-content-rF8fTTNl.js} +1 -1
  212. package/dist/client/assets/{preview-dialog-SFPfuPhe.js → preview-dialog-BfrEK7on.js} +1 -1
  213. package/dist/client/assets/{preview-panel-DG1XweCF.js → preview-panel-BrzMCTys.js} +1 -1
  214. package/dist/client/assets/{preview-tab-CppK1K1V.js → preview-tab-C3RlH6Tl.js} +3 -3
  215. package/dist/client/assets/{product-picker-dialog-B-qJRXdq.js → product-picker-dialog-B5P5BBv6.js} +1 -1
  216. package/dist/client/assets/{profile-CogKW0ml.js → profile-DdZmTj-x.js} +1 -1
  217. package/dist/client/assets/{project-app-view-Bg0IXTwt.js → project-app-view-C3Wvj6A2.js} +1 -1
  218. package/dist/client/assets/project-apps-DHXOO_qz.js +1 -0
  219. package/dist/client/assets/{project-feed-BbnYaqgF.js → project-feed-BSHbWBLq.js} +1 -1
  220. package/dist/client/assets/{project-icon-OmAeiXOI.js → project-icon-CWNjOgyc.js} +1 -1
  221. package/dist/client/assets/project-reports-CgrGrcrP.js +1 -0
  222. package/dist/client/assets/project-tasks-boHD8FJZ.js +1 -0
  223. package/dist/client/assets/{projects-ScLrP0Sq.js → projects-BI8XIBgz.js} +1 -1
  224. package/dist/client/assets/{projects-empty-state-DySkSTbO.js → projects-empty-state-DFF28xbv.js} +1 -1
  225. package/dist/client/assets/{prompts-fqxplS8t.js → prompts-CQX3vudX.js} +1 -1
  226. package/dist/client/assets/record-editor-D49e-me9.js +1 -0
  227. package/dist/client/assets/{redirect-editor-CiqrxPXo.js → redirect-editor-D8btign0.js} +1 -1
  228. package/dist/client/assets/{releases-api-CughGviB.js → releases-api-BP4D_7BV.js} +1 -1
  229. package/dist/client/assets/reports-DDAjO-Mz.js +1 -0
  230. package/dist/client/assets/{reports-onboarding-CvtUysYm.js → reports-onboarding-BdX-I6in.js} +1 -1
  231. package/dist/client/assets/{reports-tab-DGGd_cJc.js → reports-tab-Ct6jl3M_.js} +2 -2
  232. package/dist/client/assets/{reports-DoXSUp0p.js → reports-yM866Rl-.js} +1 -1
  233. package/dist/client/assets/repositories-D4SUyeOs.js +1 -0
  234. package/dist/client/assets/{repositories-DiF_6MDk.js → repositories-DBqhhKXX.js} +1 -1
  235. package/dist/client/assets/{repository-binding-5kMOX4dj.js → repository-binding-WDk-SmGV.js} +1 -1
  236. package/dist/client/assets/{repository-import-picker-Cf-mDDmo.js → repository-import-picker-xZyEfZFE.js} +1 -1
  237. package/dist/client/assets/{repository-picker-BN84wENn.js → repository-picker-JSRbKdl_.js} +1 -1
  238. package/dist/client/assets/{require-capability-d9R-dYdO.js → require-capability-B54JdYhJ.js} +1 -1
  239. package/dist/client/assets/{required-auth-layout-DojZ1KGX.js → required-auth-layout-CgpSpm9w.js} +1 -1
  240. package/dist/client/assets/{reset-password-DSQJZEJs.js → reset-password-BRnZ_BQL.js} +1 -1
  241. package/dist/client/assets/{resizable-DaKs1eh5.js → resizable-RRgAphZx.js} +1 -1
  242. package/dist/client/assets/{resolve-tab-icon-E0pJTGSy.js → resolve-tab-icon-C-lgKCi8.js} +1 -1
  243. package/dist/client/assets/{review-settings-B7m9uNKt.js → review-settings-1RLKDmF4.js} +1 -1
  244. package/dist/client/assets/{roles-sT7X7xzB.js → roles-Cu5BcmE_.js} +1 -1
  245. package/dist/client/assets/{route-BiPjYs2Q.js → route-CEjLqtoe.js} +1 -1
  246. package/dist/client/assets/route-CUdHqqnN.js +1 -0
  247. package/dist/client/assets/route-DPvDU9AN.js +1 -0
  248. package/dist/client/assets/{sandbox-lifecycle-context-BdO8UXfQ.js → sandbox-lifecycle-context-BCrUk0wr.js} +1 -1
  249. package/dist/client/assets/{schema-HyTKqr-p.js → schema-BXNU8wK3.js} +1 -1
  250. package/dist/client/assets/{schema-Bp5lazAd.js → schema-Br-RkdlQ.js} +1 -1
  251. package/dist/client/assets/{scroll-area-ButOmQch.js → scroll-area-EUJaQXLw.js} +1 -1
  252. package/dist/client/assets/{search-input-N6CaOC_1.js → search-input-VUL2ibQB.js} +1 -1
  253. package/dist/client/assets/{search-toggle-hVjf6-kQ.js → search-toggle-zvtLuz6H.js} +1 -1
  254. package/dist/client/assets/{secret-picker-DbQaPqx6.js → secret-picker-BUFFs_xD.js} +1 -1
  255. package/dist/client/assets/{secrets-CkR4uy6Z.js → secrets-CoXvVOZp.js} +1 -1
  256. package/dist/client/assets/{section-array-field-Lr-feKpQ.js → section-array-field-WuEC2hxv.js} +1 -1
  257. package/dist/client/assets/{sections-BM3hOdfC.js → sections-DiD18Znn.js} +1 -1
  258. package/dist/client/assets/sections-editor-Dn-HxEPO.js +1 -0
  259. package/dist/client/assets/{select-BwZ3fxwy.js → select-B8yvCqU-.js} +1 -1
  260. package/dist/client/assets/{select-model-B5VqF5aQ.js → select-model-Cjv3FBhJ.js} +1 -1
  261. package/dist/client/assets/{seo-editor-Bpy9Dzdq.js → seo-editor-DbEirwnW.js} +1 -1
  262. package/dist/client/assets/{separator-BJ59N-4S.js → separator-DRkT8HMb.js} +1 -1
  263. package/dist/client/assets/settings-tab-CAfdMYa9.js +1 -0
  264. package/dist/client/assets/{sheet-CFaQrFou.js → sheet-DDwhHigu.js} +1 -1
  265. package/dist/client/assets/{shell-layout-BmOtysoG.js → shell-layout-B7qkgzXU.js} +1 -1
  266. package/dist/client/assets/{site-draft-actions-DQSFILpp.js → site-draft-actions--anq5Oyn.js} +6 -6
  267. package/dist/client/assets/site-draft-view-BPqN3aH-.js +2 -0
  268. package/dist/client/assets/site-editor-DW0aLxmo.js +1 -0
  269. package/dist/client/assets/{site-editor-toast-Drt9__vU.js → site-editor-toast-Cyc0S6jd.js} +1 -1
  270. package/dist/client/assets/{skills-CuAtdce2.js → skills-D4BOyICd.js} +1 -1
  271. package/dist/client/assets/{slider-9xLURN_x.js → slider-DM-iwDAN.js} +1 -1
  272. package/dist/client/assets/{sortable.esm-DKvN4I2-.js → sortable.esm-CgWx-74N.js} +1 -1
  273. package/dist/client/assets/{sso-Bt0VIDB0.js → sso-CSG6lIvj.js} +1 -1
  274. package/dist/client/assets/{suggestion-B65JiyPM.js → suggestion-DtPrQaPS.js} +1 -1
  275. package/dist/client/assets/{switch-DAskixZA.js → switch-BI5z5Ju7.js} +1 -1
  276. package/dist/client/assets/{symbol-DHBzZbeR.js → symbol-COdkYi-n.js} +1 -1
  277. package/dist/client/assets/{synced-repos-CE8wN2_N.js → synced-repos-B1IVjrrq.js} +1 -1
  278. package/dist/client/assets/{tab-icon-glyph-CpaZMvdV.js → tab-icon-glyph-CIKU8YGE.js} +1 -1
  279. package/dist/client/assets/{table-gy7RNGr-.js → table-CjjNOaN4.js} +1 -1
  280. package/dist/client/assets/{tabs-BIh8PZDT.js → tabs-ZzbSttVx.js} +1 -1
  281. package/dist/client/assets/{task-assignee-avatar-T0yhZapD.js → task-assignee-avatar-C-hr4u9B.js} +1 -1
  282. package/dist/client/assets/{task-board-DDJJrv54.js → task-board-J8Vo2lzV.js} +1 -1
  283. package/dist/client/assets/{task-route-BuxqCGZd.js → task-route-t4uPoiKF.js} +1 -1
  284. package/dist/client/assets/{task-status-B-hiqAeK.js → task-status-OIhRo9y9.js} +1 -1
  285. package/dist/client/assets/{taskboard-analytics-CACHd6vk.js → taskboard-analytics-D0rm1hjK.js} +1 -1
  286. package/dist/client/assets/{tasks-CPyoTCOO.js → tasks-BEWx2mVo.js} +1 -1
  287. package/dist/client/assets/tasks-DBLzQm7P.js +1 -0
  288. package/dist/client/assets/{textarea-B-cDk_e9.js → textarea-BLncutjk.js} +1 -1
  289. package/dist/client/assets/{thread-analytics-DKFvK1DN.js → thread-analytics-CK_sghas.js} +1 -1
  290. package/dist/client/assets/{thread-intent-DXpv35UG.js → thread-intent-DigI0g4t.js} +1 -1
  291. package/dist/client/assets/{thread-route-BZKbOQYe.js → thread-route-CYFdAsxP.js} +1 -1
  292. package/dist/client/assets/{thread-route-Dp-aglxM.js → thread-route-Dq4msobR.js} +1 -1
  293. package/dist/client/assets/{thread-sheet-body-CRJRoIwG.js → thread-sheet-body-Di4oWDCC.js} +1 -1
  294. package/dist/client/assets/{time-range-picker-B1ueoxPR.js → time-range-picker-B6ilVQdd.js} +1 -1
  295. package/dist/client/assets/{toggle-group-B4WOnAP4.js → toggle-group-DJHavtFz.js} +1 -1
  296. package/dist/client/assets/{tool-namespace-BDVFYO2h.js → tool-namespace-Db1FE8-P.js} +1 -1
  297. package/dist/client/assets/{toolbar-icon-button-CsFCKDkl.js → toolbar-icon-button-w6OpN7Jk.js} +1 -1
  298. package/dist/client/assets/{tooltip-BP50pkvP.js → tooltip-C9PLptTv.js} +1 -1
  299. package/dist/client/assets/{tooltipContext-C8XbU8o0.js → tooltipContext-DT0TA2xa.js} +1 -1
  300. package/dist/client/assets/{track-CDPTw9ZB.js → track-AB-V11dT.js} +1 -1
  301. package/dist/client/assets/{types-G5N7kkmB.js → types-DfI6bP71.js} +1 -1
  302. package/dist/client/assets/{url-slug-D6AdbSqw.js → url-slug-bePBUEDA.js} +1 -1
  303. package/dist/client/assets/{usage-stats-n069Pf6u.js → usage-stats-CgVbjgnU.js} +1 -1
  304. package/dist/client/assets/{use-ai-providers-BCXdfWt4.js → use-ai-providers-Bc7K6JyD.js} +1 -1
  305. package/dist/client/assets/{use-apply-named-rule-2pgSelD5.js → use-apply-named-rule-BrUBMfGy.js} +1 -1
  306. package/dist/client/assets/{use-automations-Ch5lNT3Y.js → use-automations-DEVyZ6g0.js} +1 -1
  307. package/dist/client/assets/{use-autosave-DnUFhq5-.js → use-autosave-BvC5wGjm.js} +1 -1
  308. package/dist/client/assets/{use-chat-layout-state-Boq7M7MG.js → use-chat-layout-state-D10wfd91.js} +1 -1
  309. package/dist/client/assets/{use-clock-tick-C7RLnGnY.js → use-clock-tick-DtkR8iHs.js} +1 -1
  310. package/dist/client/assets/{use-connect-companion-w3O3zQJZ.js → use-connect-companion-BBA1nWqg.js} +1 -1
  311. package/dist/client/assets/{use-connection-SBf1IMNR.js → use-connection--nQEudkr.js} +1 -1
  312. package/dist/client/assets/{use-content-sync-BL9rGIyO.js → use-content-sync-BpAr_qkU.js} +1 -1
  313. package/dist/client/assets/{use-copy-Dgppamoo.js → use-copy-BYfqkrcX.js} +1 -1
  314. package/dist/client/assets/{use-create-virtual-mcp-DE2rukKQ.js → use-create-virtual-mcp-kVxi7rbb.js} +1 -1
  315. package/dist/client/assets/{use-date-fns-locale-MUGqYczL.js → use-date-fns-locale-Qd9ZKJ-f.js} +1 -1
  316. package/dist/client/assets/{use-debounced-autosave-C_xNyGJY.js → use-debounced-autosave-_WnUD2A1.js} +1 -1
  317. package/dist/client/assets/{use-debounced-value-Cf0I7A9v.js → use-debounced-value-o8_kTKtk.js} +1 -1
  318. package/dist/client/assets/{use-deco-credits-Dna90E4X.js → use-deco-credits-ChCk-7Ic.js} +1 -1
  319. package/dist/client/assets/{use-decopilot-events-8w_hmlMJ.js → use-decopilot-events-DuiNHzOc.js} +1 -1
  320. package/dist/client/assets/{use-delete-connection-ClNsS7Ho.js → use-delete-connection-2dBbm2UZ.js} +1 -1
  321. package/dist/client/assets/{use-deployment-admin-4YEWaFep.js → use-deployment-admin-DK09uyUD.js} +1 -1
  322. package/dist/client/assets/{use-fast-preview-draft-url-Bc3gs7gV.js → use-fast-preview-draft-url-DUx_v0ir.js} +1 -1
  323. package/dist/client/assets/{use-file-configs-B-wH52y_.js → use-file-configs-emNeeY81.js} +1 -1
  324. package/dist/client/assets/{use-inbox-feed-Ci3vPrJA.js → use-inbox-feed-gQNczY0E.js} +1 -1
  325. package/dist/client/assets/{use-infinite-scroll-BIzBYJCu.js → use-infinite-scroll-tiBiQUrG.js} +1 -1
  326. package/dist/client/assets/{use-join-requests-DP8Apzuq.js → use-join-requests-DEdRn9mT.js} +1 -1
  327. package/dist/client/assets/{use-main-panel-tabs-CYcYIai-.js → use-main-panel-tabs-zguLtTFu.js} +1 -1
  328. package/dist/client/assets/{use-mcp-auth-status-CNLX3LBK.js → use-mcp-auth-status-CzBbJJxr.js} +1 -1
  329. package/dist/client/assets/{use-mcp-client-Do4_ndrI.js → use-mcp-client-Dehh-QD8.js} +1 -1
  330. package/dist/client/assets/{use-mcp-prompts-BtZywK26.js → use-mcp-prompts-6zv9IXeR.js} +1 -1
  331. package/dist/client/assets/{use-mcp-tools-D588moK7.js → use-mcp-tools-RlvKHjUU.js} +1 -1
  332. package/dist/client/assets/{use-mobile-CMu6UtqS.js → use-mobile-Bht8wONL.js} +1 -1
  333. package/dist/client/assets/{use-move-blocks-0Xns2gtz.js → use-move-blocks-DEI5xTJ9.js} +1 -1
  334. package/dist/client/assets/{use-navigate-to-agent-BhR34hZR.js → use-navigate-to-agent-R2geNLzm.js} +1 -1
  335. package/dist/client/assets/{use-open-billing-url-C2ZKl_OJ.js → use-open-billing-url-BhHBrwI4.js} +1 -1
  336. package/dist/client/assets/{use-org-fs-Bmjx4Cik.js → use-org-fs-CPqLHgiA.js} +1 -1
  337. package/dist/client/assets/{use-org-repo-syncs-BSAcLSvr.js → use-org-repo-syncs-B-jZVfS_.js} +1 -1
  338. package/dist/client/assets/{use-org-sso-C2CyZRUp.js → use-org-sso-COqujkwo.js} +1 -1
  339. package/dist/client/assets/{use-organization-roles-DSCc1iIP.js → use-organization-roles-CAeTGvi6.js} +1 -1
  340. package/dist/client/assets/{use-organization-settings-DMgbBKf8.js → use-organization-settings-c2KJ-rhg.js} +1 -1
  341. package/dist/client/assets/{use-panel-navigate-o6edpcRi.js → use-panel-navigate-DlKiU4ru.js} +1 -1
  342. package/dist/client/assets/use-project-native-view-presence-CifUjYF7.js +1 -0
  343. package/dist/client/assets/{use-project-scope-2Tdoer5a.js → use-project-scope-Lvryvv_x.js} +1 -1
  344. package/dist/client/assets/{use-recent-apps-D4vko3CW.js → use-recent-apps-C9vG5TR3.js} +1 -1
  345. package/dist/client/assets/{use-releases-CZIw49MO.js → use-releases-CzZzLiYc.js} +1 -1
  346. package/dist/client/assets/{use-reports-diagnostic-D1hUsQ-k.js → use-reports-diagnostic-Bf-lUYQW.js} +1 -1
  347. package/dist/client/assets/{use-sandbox-events-BGso5ik2.js → use-sandbox-events-PM3dvDwL.js} +1 -1
  348. package/dist/client/assets/{use-secrets-B4A-mk96.js → use-secrets-A7DHlNXm.js} +1 -1
  349. package/dist/client/assets/{use-section-preview-base-7CyzrhDh.js → use-section-preview-base-LBz28XAj.js} +1 -1
  350. package/dist/client/assets/{use-session-runtime-CbMaO8p7.js → use-session-runtime-Dlgl4ufa.js} +1 -1
  351. package/dist/client/assets/{use-sidebar-collapsed-CI6KBWLr.js → use-sidebar-collapsed-VHTBmB5o.js} +1 -1
  352. package/dist/client/assets/{use-tags-lzJX123E.js → use-tags-CUQEvOLk.js} +1 -1
  353. package/dist/client/assets/{use-task-board-analytics-BzMGYkMt.js → use-task-board-analytics-DVyt-Yqg.js} +1 -1
  354. package/dist/client/assets/{use-task-board-events-DoQeMblf.js → use-task-board-events-Cjw4-qyi.js} +1 -1
  355. package/dist/client/assets/{use-task-board-item-prs-C1DrMHVS.js → use-task-board-item-prs-B5KO5oDj.js} +1 -1
  356. package/dist/client/assets/{use-task-metadata-DKj0uikU.js → use-task-metadata-WYOfWDrq.js} +1 -1
  357. package/dist/client/assets/{use-thread-analytics-C147IXlL.js → use-thread-analytics-CpHE9wpn.js} +1 -1
  358. package/dist/client/assets/{use-thread-outputs-sdt1CHHh.js → use-thread-outputs-uAgeAbTT.js} +1 -1
  359. package/dist/client/assets/useInfiniteQuery-wSSEyg4B.js +1 -0
  360. package/dist/client/assets/{useQueries-B2KTxxDE.js → useQueries-gBucEmF_.js} +1 -1
  361. package/dist/client/assets/useSuspenseInfiniteQuery-Bj1LgSIL.js +1 -0
  362. package/dist/client/assets/{users-B-OmSt3n.js → users-AQXsmt0e.js} +1 -1
  363. package/dist/client/assets/{utils-muk7Isuo.js → utils-B8OWeF28.js} +1 -1
  364. package/dist/client/assets/{variant-calendar-DE-GxRhT.js → variant-calendar-BVmrQa_2.js} +1 -1
  365. package/dist/client/assets/{variant-matcher-override-CDXRGILn.js → variant-matcher-override-CdLkXK72.js} +1 -1
  366. package/dist/client/assets/{virtual-mcp-C5K9GZ-3.js → virtual-mcp-CtaYyY8_.js} +1 -1
  367. package/dist/client/assets/{watch-sse-pool-BzTIkVFy.js → watch-sse-pool-CTyhEpc6.js} +1 -1
  368. package/dist/client/index.html +2 -2
  369. package/dist/server/server.js +81 -81
  370. package/package.json +1 -1
  371. package/dist/client/assets/agent-analytics-C4isBTY7.js +0 -1
  372. package/dist/client/assets/agent-app-BakS5Mpg.js +0 -1
  373. package/dist/client/assets/agent-calendar-rlwx6fiZ.js +0 -1
  374. package/dist/client/assets/agent-deck-uq6T-H5n.js +0 -1
  375. package/dist/client/assets/agent-experiments-D3cQ-WP1.js +0 -1
  376. package/dist/client/assets/agent-library-C3l8PEn-.js +0 -1
  377. package/dist/client/assets/agent-library-file-CjRMeR9i.js +0 -1
  378. package/dist/client/assets/agent-monitor-BfPm0PfR.js +0 -1
  379. package/dist/client/assets/agent-settings-C3PrzQdK.js +0 -1
  380. package/dist/client/assets/agent-site-editor-code-CrwcPx-x.js +0 -2
  381. package/dist/client/assets/agent-site-editor-content-DOS83K5A.js +0 -1
  382. package/dist/client/assets/agent-site-editor-preview-Cuy-72sw.js +0 -1
  383. package/dist/client/assets/agent-view-DIoRN3S4.js +0 -1
  384. package/dist/client/assets/analytics-tab-BmRbRV7j.js +0 -2
  385. package/dist/client/assets/api-keys-CYNApwkv.js +0 -1
  386. package/dist/client/assets/campaigns-view-keHuDNLa.js +0 -1
  387. package/dist/client/assets/cms-settings-editor-2-st_NGk.js +0 -1
  388. package/dist/client/assets/content-tab-BplT8Wwk.js +0 -22
  389. package/dist/client/assets/experiments-tab-CLMcteix.js +0 -1
  390. package/dist/client/assets/index-BQfNeaI1.css +0 -1
  391. package/dist/client/assets/library-CRTbwohf.js +0 -1
  392. package/dist/client/assets/monitoring-KjkBz5Hy.js +0 -1
  393. package/dist/client/assets/named-rule-view-CIxMNPIR.js +0 -1
  394. package/dist/client/assets/project-apps-BWyBTcjU.js +0 -1
  395. package/dist/client/assets/project-reports-C4fNYK5h.js +0 -1
  396. package/dist/client/assets/project-tasks-CiUIlBvj.js +0 -1
  397. package/dist/client/assets/record-editor-Cd5kCJv3.js +0 -1
  398. package/dist/client/assets/reports-D4nL6cfo.js +0 -1
  399. package/dist/client/assets/repositories-CX881Zmd.js +0 -1
  400. package/dist/client/assets/route-CO4TvlsY.js +0 -1
  401. package/dist/client/assets/route-qbvcUo1A.js +0 -1
  402. package/dist/client/assets/sections-editor-DLgM9lBb.js +0 -1
  403. package/dist/client/assets/settings-tab-CA-W7UU2.js +0 -1
  404. package/dist/client/assets/site-draft-view-FIwQQWqm.js +0 -2
  405. package/dist/client/assets/site-editor-pGVB_SVm.js +0 -1
  406. package/dist/client/assets/tasks-CyRF0ujk.js +0 -1
  407. package/dist/client/assets/use-project-native-view-presence-CiNgXr_r.js +0 -1
  408. package/dist/client/assets/useInfiniteQuery-Cq3QQD7o.js +0 -1
  409. package/dist/client/assets/useSuspenseInfiniteQuery-jjzI6K-a.js +0 -1
@@ -1,12 +1,12 @@
1
- import{c as M,b as xe,r as q,j as r,B as ye,l as X,K as Et,as as Xs,b4 as Lr,ay as ua,aD as Ur,X as Gt,t as Oe,aM as Ys,aN as Zs,aO as en,aP as tn,bl as sn,aQ as nn,aR as an,aS as rn,V as Ps,Y as js,Z as Ss,a as ks,a4 as Cs,cr as qr,h as Qt,f7 as ha,f8 as ln,bI as zr,bd as Hr,eV as $n,f9 as Kr,b$ as Vr,at as Gr,I as Qr,a7 as Wr,fa as Jr,q as Ns,fb as Xr,eR as Yr,U as fa,m as Tt,eP as on,H as ma,D as pa,x as ba,v as ga,Q as xa,M as va,fc as Zr,bm as ya,a5 as wa,b8 as cn,e as Fn,C as el,R as tl}from"./index-BJ9m9LNK.js";import{S as sl}from"./separator-BJ59N-4S.js";import{f as nl,u as Zt,r as Pa,l as ja,c as Sa,b as al}from"./chat-context-2letHrEJ.js";import{u as qt,a9 as rl,c as ka,b as Ca,aa as dn,ab as bs,H as Es,ac as En,ad as ll,ae as il,af as ol,ag as cl,ah as dl,X as ul,ai as hl,D as un,B as Na,aj as fl,ak as Aa,z as ml,w as Ra}from"./site-editor-toast-Drt9__vU.js";import{L as pl,a as bl}from"./shell-layout-BmOtysoG.js";import{I as Ta}from"./toolbar-icon-button-CsFCKDkl.js";import{P as gl,a as xl,b as vl}from"./popover-C5Dt3qOY.js";import{c as kt,T as Ct,a as Nt,b as As}from"./tooltip-BP50pkvP.js";import{d as yl,e as wl,c as Pl,C as _n,a as On,b as Ln}from"./command-CPzIRDl7.js";import{T as Lt,a as Ia,c as Da}from"./tabs-BIh8PZDT.js";import{t as Ba}from"./ChevronUp-PedQ2gd6.js";import{aH as Rs,H as jl,a as Ma,aI as Sl,b as $a,aJ as Fa,O as kl}from"./agent-icon-CTGtlw1z.js";import{i as Ea}from"./DotsVertical-B50qkKfK.js";import{b as _a}from"./Tool01-PlDxztWD.js";import{s as Oa}from"./Plus-feGO5xhL.js";import{s as Ts}from"./Trash01-BqnutNRJ.js";import{u as hn,r as _s,a as Un,n as Os,g as fn,b as mn}from"./use-releases-CZIw49MO.js";import{k as Cl,d as Nl,j as qn}from"./thread-intent-DXpv35UG.js";import{h as La,r as Ua,g as Al,f as tt,a as pn,j as qa}from"./repository-binding-5kMOX4dj.js";import{u as Rl}from"./use-debounced-value-Cf0I7A9v.js";import{u as Tl}from"./use-clock-tick-C7RLnGnY.js";import{u as Il}from"./useInfiniteQuery-Cq3QQD7o.js";import{e as Dl,c as Bl,p as Ml,g as za,h as Ha,i as Ka}from"./use-navigate-to-agent-BhR34hZR.js";import{a as zn}from"./virtual-mcp-C5K9GZ-3.js";import{u as Va,c as $l,e as Fl}from"./experiments-tab-choice-vFGVi3bn.js";import{G as Ga}from"./repository-picker-BN84wENn.js";import{u as bn}from"./use-session-runtime-CbMaO8p7.js";import{u as El,c as _l,d as Ol,e as Ll}from"./use-fast-preview-draft-url-Bc3gs7gV.js";import{a8 as Kt,a9 as Qa,w as gs,l as gn,aa as Wa,ab as Ul,ac as ql,ad as zl,ae as Hl,j as Kl,u as Ft,f as xn,af as Vl}from"./parse-sections-CzJo2WgK.js";import"./index-DyS4s94t.js";import{T as Gl}from"./textarea-B-cDk_e9.js";import{i as vn}from"./CheckCircle-DFdmK-T2.js";import{s as xs}from"./Image01-D6z5fxVv.js";import{p as Ql,H as Wl,h as Jl,k as Xl,n as Yl,r as Zl,a as ei,b as ti,u as si}from"./releases-api-CughGviB.js";import{a as ni,g as ai}from"./UserSquare-Csbu2VpZ.js";import{n as ri,b as li,m as ii}from"./named-rule-uses-DBpP8kZW.js";import{f as yn,b as Ja,r as Is,p as oi,c as Xa,i as wn,d as ci,e as Ya,m as di,h as ui,g as Za,j as hi,n as fi,k as mi,l as pi,o as bi,q as Pn,t as gi,u as er,s as tr,v as Ls}from"./sandbox-git-api-CH_-QFpD.js";import{b as xi,g as vi}from"./utils-muk7Isuo.js";import{i as yi}from"./Monitor01-CP0zz7rW.js";import{w as jn,g as wi,D as Pi}from"./section-preview-url-7zfngvgW.js";import{w as Sn}from"./device-hint-SeLRi17j.js";import{w as Hn}from"./editor-BDmCsl05.js";import{d as ji,a as Si,R as sr}from"./section-array-field-Lr-feKpQ.js";import{u as nr}from"./use-content-sync-BL9rGIyO.js";import{s as ar}from"./save-changes-debug-nBi-n9eV.js";import{u as ki}from"./use-mcp-client-Do4_ndrI.js";import{u as Ci}from"./use-sandbox-events-BGso5ik2.js";import{b as Ni,a as Ai}from"./sandbox-lifecycle-context-BdO8UXfQ.js";import{b as Ri}from"./thread-route-Dp-aglxM.js";const Kn=/[\r\n<>]/,Ti=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ds(t){const e=t?.userName?.trim();if(!e||Kn.test(e))return null;const s=t?.userEmail?.trim();return!s||Kn.test(s)?{userName:e}:Ti.test(s)?{userName:e,userEmail:s}:{userName:e}}function Ii(t){return t.split(`
1
+ import{c as M,b as xe,r as q,j as r,B as ye,l as X,K as Et,as as Xs,b4 as Lr,ay as ua,aD as Ur,X as Gt,t as Oe,aM as Ys,aN as Zs,aO as en,aP as tn,bl as sn,aQ as nn,aR as an,aS as rn,V as Ps,Y as js,Z as Ss,a as ks,a4 as Cs,cr as qr,h as Qt,f7 as ha,f8 as ln,bI as zr,bd as Hr,eV as Fn,f9 as Kr,b$ as Vr,at as Gr,I as Qr,a7 as Wr,fa as Jr,q as Ns,fb as Xr,eR as Yr,U as fa,m as Tt,eP as on,H as ma,D as pa,x as ba,v as ga,Q as xa,M as va,fc as Zr,bm as ya,a5 as wa,b8 as cn,e as $n,C as el,R as tl}from"./index-C5hxtG-B.js";import{S as sl}from"./separator-DRkT8HMb.js";import{f as nl,u as Zt,r as Pa,l as ja,c as Sa,b as al}from"./chat-context-BvGd3d4B.js";import{u as qt,a9 as rl,c as ka,b as Ca,aa as dn,ab as bs,H as Es,ac as En,ad as ll,ae as il,af as ol,ag as cl,ah as dl,X as ul,ai as hl,D as un,B as Na,aj as fl,ak as Aa,z as ml,w as Ra}from"./site-editor-toast-Cyc0S6jd.js";import{L as pl,a as bl}from"./shell-layout-B7qkgzXU.js";import{I as Ta}from"./toolbar-icon-button-w6OpN7Jk.js";import{P as gl,a as xl,b as vl}from"./popover-C4qbExP3.js";import{c as kt,T as Ct,a as Nt,b as As}from"./tooltip-C9PLptTv.js";import{d as yl,e as wl,c as Pl,C as _n,a as On,b as Ln}from"./command-BCnC3TbE.js";import{T as Lt,a as Ia,c as Da}from"./tabs-ZzbSttVx.js";import{t as Ba}from"./ChevronUp-B_2ftJO2.js";import{aF as Rs,H as jl,a as Ma,aG as Sl,b as Fa,aH as $a,O as kl}from"./agent-icon-DMtM72Tt.js";import{i as Ea}from"./DotsVertical-BK4Fy8Nl.js";import{b as _a}from"./Tool01-lXzjYHgk.js";import{s as Oa}from"./Plus-Dl2sBaoj.js";import{s as Ts}from"./Trash01-DuRmK_Vz.js";import{u as hn,r as _s,a as Un,n as Os,g as fn,b as mn}from"./use-releases-CzZzLiYc.js";import{k as Cl,d as Nl,j as qn}from"./thread-intent-DigI0g4t.js";import{h as La,r as Ua,g as Al,f as tt,a as pn,j as qa}from"./repository-binding-WDk-SmGV.js";import{u as Rl}from"./use-debounced-value-o8_kTKtk.js";import{u as Tl}from"./use-clock-tick-DtkR8iHs.js";import{u as Il}from"./useInfiniteQuery-wSSEyg4B.js";import{e as Dl,c as Bl,p as Ml,g as za,h as Ha,i as Ka}from"./use-navigate-to-agent-R2geNLzm.js";import{a as zn}from"./virtual-mcp-CtaYyY8_.js";import{u as Va,c as Fl,e as $l}from"./experiments-tab-choice-BPWZ6-EI.js";import{G as Ga}from"./repository-picker-JSRbKdl_.js";import{u as bn}from"./use-session-runtime-Dlgl4ufa.js";import{u as El,c as _l,d as Ol,e as Ll}from"./use-fast-preview-draft-url-DUx_v0ir.js";import{a8 as Kt,a9 as Qa,w as gs,l as gn,aa as Wa,ab as Ul,ac as ql,ad as zl,ae as Hl,j as Kl,u as $t,f as xn,af as Vl}from"./parse-sections-BDlriD2E.js";import"./index-CEQNEhri.js";import{T as Gl}from"./textarea-BLncutjk.js";import{i as vn}from"./CheckCircle-BnPGwhwQ.js";import{s as xs}from"./Image01-DDkvI5Nm.js";import{p as Ql,H as Wl,h as Jl,k as Xl,n as Yl,r as Zl,a as ei,b as ti,u as si}from"./releases-api-BP4D_7BV.js";import{a as ni,g as ai}from"./UserSquare-CVuHc6NN.js";import{n as ri,b as li,m as ii}from"./named-rule-uses-Bf97NaES.js";import{f as yn,b as Ja,r as Is,p as oi,c as Xa,i as wn,d as ci,e as Ya,m as di,h as ui,g as Za,j as hi,n as fi,k as mi,l as pi,o as bi,q as Pn,t as gi,u as er,s as tr,v as Ls}from"./sandbox-git-api-CH_-QFpD.js";import{b as xi,g as vi}from"./utils-B8OWeF28.js";import{i as yi}from"./Monitor01-D31PU3Iy.js";import{w as jn,g as wi,D as Pi}from"./section-preview-url-7zfngvgW.js";import{w as Sn}from"./device-hint-SeLRi17j.js";import{w as Hn}from"./editor-CFcE0Q6O.js";import{d as ji,a as Si,R as sr}from"./section-array-field-WuEC2hxv.js";import{u as nr}from"./use-content-sync-BpAr_qkU.js";import{s as ar}from"./save-changes-debug-nBi-n9eV.js";import{u as ki}from"./use-mcp-client-Dehh-QD8.js";import{u as Ci}from"./use-sandbox-events-PM3dvDwL.js";import{b as Ni,a as Ai}from"./sandbox-lifecycle-context-BCrUk0wr.js";import{b as Ri}from"./thread-route-Dq4msobR.js";const Kn=/[\r\n<>]/,Ti=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ds(t){const e=t?.userName?.trim();if(!e||Kn.test(e))return null;const s=t?.userEmail?.trim();return!s||Kn.test(s)?{userName:e}:Ti.test(s)?{userName:e,userEmail:s}:{userName:e}}function Ii(t){return t.split(`
2
2
  `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
3
3
  `).trimEnd()}function Di(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function rr(t,e){const s=Ds(e);if(!s)return t;const a=Ii(t),n=Di(s);if(a.includes(n))return a;const o=a.trimEnd();return o.length>0?`${o}
4
4
 
5
- ${n}`:n}function Bi(t,e){const s=t?.trim();return s?rr(s,e):s||void 0}function Mi(t){const{value:e,baseBranch:s,releases:a,baseIsDraft:n=!1}=t,o=!n&&!!e&&e===s,c=a.find(i=>i.branch===e);return{isBase:o,current:c,unlisted:!o&&!c&&!!e}}const $i={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 a=Number.parseInt(s.slice(2),16);return!Number.isFinite(a)||a>Vn?e:String.fromCodePoint(a)}if(s.startsWith("#")){const a=Number.parseInt(s.slice(1),10);return!Number.isFinite(a)||a>Vn?e:String.fromCodePoint(a)}return $i[s]??e}):""}function Fi(t){const e=M.c(39),{url:s,onSave:a}=t,n=xe(),[o,c]=q.useState(s??"");let l;e[0]!==o?(l=o.trim(),e[0]=o,e[1]=l):l=e[1];const i=l;let u;e[2]!==a||e[3]!==i?(u=()=>a(i?Cl(i):null),e[2]=a,e[3]=i,e[4]=u):u=e[4];const d=u;let h;e[5]!==n?(h=n("thread.branchPicker.localHint"),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[7]=h,e[8]=f):f=e[8];let p;e[9]!==n?(p=n("thread.branchPicker.localUrlLabel"),e[9]=n,e[10]=p):p=e[10];let m;e[11]!==n?(m=n("thread.branchPicker.localUrlPlaceholder"),e[11]=n,e[12]=m):m=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=N=>c(N.target.value),e[13]=b):b=e[13];let g;e[14]!==d||e[15]!==i?(g=N=>{N.key==="Enter"&&i&&d()},e[14]=d,e[15]=i,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==m||e[19]!==g||e[20]!==o?(x=r.jsx("input",{type:"url",inputMode:"url","aria-label":p,placeholder:m,value:o,onChange:b,onKeyDown:g,className:"h-8 w-full rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[17]=p,e[18]=m,e[19]=g,e[20]=o,e[21]=x):x=e[21];let j;e[22]!==a||e[23]!==n||e[24]!==s?(j=s?r.jsx(ye,{variant:"ghost",size:"sm",className:"text-xs text-destructive hover:text-destructive",onClick:()=>a(null),children:n("thread.branchPicker.localTurnOff")}):r.jsx("span",{}),e[22]=a,e[23]=n,e[24]=s,e[25]=j):j=e[25];const y=!i;let v;e[26]!==n?(v=n("thread.branchPicker.save"),e[26]=n,e[27]=v):v=e[27];let P;e[28]!==d||e[29]!==y||e[30]!==v?(P=r.jsx(ye,{size:"sm",disabled:y,onClick:d,children:v}),e[28]=d,e[29]=y,e[30]=v,e[31]=P):P=e[31];let w;e[32]!==j||e[33]!==P?(w=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[j,P]}),e[32]=j,e[33]=P,e[34]=w):w=e[34];let k;return e[35]!==w||e[36]!==f||e[37]!==x?(k=r.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[f,x,w]}),e[35]=w,e[36]=f,e[37]=x,e[38]=k):k=e[38],k}function Ei(t){const e=M.c(8),{virtualMcpId:s,branch:a,serve:n,rowRef:o,onPicked:c}=t,l=qt(s,a),i=!!n.connection,u=i&&l.kind==="protocol"&&l.source==="local";let d;e[0]!==c||e[1]!==n?(d=()=>_i(n,c),e[0]=c,e[1]=n,e[2]=d):d=e[2];let h;return e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==d?(h=r.jsx(Oi,{rowRef:o,selected:i,connected:u,onSelect:d}),e[3]=o,e[4]=i,e[5]=u,e[6]=d,e[7]=h):h=e[7],h}function _i(t,e){e?.(),!t.connection&&t.set({endpoint:t.lastEndpoint??rl})}function Oi(t){const e=M.c(19),{rowRef:s,selected:a,connected:n,onSelect:o}=t,c=xe(),l=a?"bg-accent":"hover:bg-accent";let i;e[0]!==l?(i=X("flex rounded-lg",l),e[0]=l,e[1]=i):i=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("span",{"data-testid":"localhost-dot",className:"h-2 w-2 shrink-0 rounded-full bg-foreground"}),e[2]=u):u=e[2];let d;e[3]!==c?(d=c("thread.branchPicker.localhost.label"),e[3]=c,e[4]=d):d=e[4];let h;e[5]!==d?(h=r.jsx("span",{className:"min-w-0 flex-1 truncate",children:d}),e[5]=d,e[6]=h):h=e[6];let f;e[7]!==n||e[8]!==c?(f=n&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:c("thread.branchPicker.localhost.connected")}),e[7]=n,e[8]=c,e[9]=f):f=e[9];let p;e[10]!==o||e[11]!==a||e[12]!==h||e[13]!==f?(p=r.jsxs("button",{type:"button","aria-pressed":a,onClick:o,className:"flex w-full min-w-0 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[u,h,f]}),e[10]=o,e[11]=a,e[12]=h,e[13]=f,e[14]=p):p=e[14];let m;return e[15]!==s||e[16]!==i||e[17]!==p?(m=r.jsx("div",{ref:s,className:i,children:p}),e[15]=s,e[16]=i,e[17]=p,e[18]=m):m=e[18],m}const Li=10080*60*1e3;function Ui({sandboxMap:t,userId:e,rawBranches:s,now:a}){const n=new Map;for(const[h,f]of Object.entries(t??{}))for(const[p,m]of Object.entries(f??{})){let b=n.get(p);b||(b={userIds:new Set,lastActiveAt:0},n.set(p,b)),b.userIds.add(h);for(const g of Object.values(m??{})){const x=g?.createdAt??0;x>b.lastActiveAt&&(b.lastActiveAt=x)}}const o=a-Li,c=[...n.entries()].filter(([,h])=>h.lastActiveAt>=o).sort((h,f)=>f[1].lastActiveAt-h[1].lastActiveAt).map(([h,f])=>({name:h,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),l=new Set(c.map(h=>h.name)),i=new Set(Object.keys(t?.[e]??{})),u=[...i].filter(h=>!l.has(h)).sort().map(h=>({name:h,source:"yours"})),d=s.filter(h=>!i.has(h.name)&&!l.has(h.name)).map(h=>({name:h.name,source:"other",author:h.author??null}));return{recent:c,yours:u,others:d}}const qi=100,zi=50,Hi=300;function Ks(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function Ki(t){const e=M.c(39),{orgId:s,orgSlug:a,userId:n,target:o,sandboxMap:c,owner:l,repo:i,search:u,enabled:d}=t,h=u===void 0?"":u,f=d===void 0?!0:d;let p;e[0]!==h?(p=h.trim(),e[0]=h,e[1]=p):p=e[1];const m=p,b=Rl(m,Hi);let g;e[2]!==o?(g=La(o),e[2]=o,e[3]=g):g=e[3];const x=g,j=m.length>0;let y;e[4]!==b||e[5]!==s||e[6]!==a||e[7]!==l||e[8]!==i||e[9]!==o?(y=Et.githubBranchSearch(s,a,Ua(o),l,i,b),e[4]=b,e[5]=s,e[6]=a,e[7]=l,e[8]=i,e[9]=o,e[10]=y):y=e[10];const v=f&&x;let P;e[11]!==b||e[12]!==a||e[13]!==o?(P=J=>{const{pageParam:se}=J;return Xs(a,"REPOSITORY_SEARCH_BRANCHES",{...o,query:b,limit:b?zi:qi,cursor:se})},e[11]=b,e[12]=a,e[13]=o,e[14]=P):P=e[14];let w;e[15]!==b?(w=J=>b?void 0:J.nextCursor??void 0,e[15]=b,e[16]=w):w=e[16];let k;e[17]!==y||e[18]!==v||e[19]!==P||e[20]!==w?(k={queryKey:y,enabled:v,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:P,getNextPageParam:w},e[17]=y,e[18]=v,e[19]=P,e[20]=w,e[21]=k):k=e[21];const{data:N,isLoading:R,isError:C,isFetching:A,hasNextPage:S,isFetchingNextPage:E,fetchNextPage:$}=Il(k),I=j&&(b!==m||A),T=(N?.pages??[]).flatMap(Vi),D=Tl(6e4),Y=Ui({sandboxMap:c,userId:n,rawBranches:T,now:D});let ae;e[22]!==m?(ae=J=>Ks(J.name,m),e[22]=m,e[23]=ae):ae=e[23];const H=Y.recent.filter(ae);let _;e[24]!==m?(_=J=>Ks(J.name,m),e[24]=m,e[25]=_):_=e[25];const z=Y.yours.filter(_),ee=Y.others,Q=N?.pages[0],B=j&&Q&&!I?Math.max(0,Q.totalCount-Q.branches.length):0,ie=!j&&S;let U;e[26]!==$?(U=()=>{$()},e[26]=$,e[27]=U):U=e[27];let oe;return e[28]!==B||e[29]!==C||e[30]!==E||e[31]!==R||e[32]!==I||e[33]!==ee||e[34]!==H||e[35]!==ie||e[36]!==U||e[37]!==z?(oe={recent:H,yours:z,others:ee,isLoading:R,isError:C,isSearching:I,hiddenMatchCount:B,hasMore:ie,isFetchingMore:E,fetchMore:U},e[28]=B,e[29]=C,e[30]=E,e[31]=R,e[32]=I,e[33]=ee,e[34]=H,e[35]=ie,e[36]=U,e[37]=z,e[38]=oe):oe=e[38],oe}function Vi(t){return t.branches}function Gi(t){const e=M.c(239),{virtualMcpId:s,isV8:a,userLabel:n,value:o,baseBranch:c,baseIsDraft:l,orgId:i,orgSlug:u,userId:d,target:h,owner:f,repo:p,sandboxMap:m,onChange:b,onCreateBranch:g,onAdoptBranch:x,disabled:j,spawnsNewChat:y,placement:v}=t,P=a===void 0?!1:a,w=l===void 0?!1:l,k=j===void 0?!1:j,N=y===void 0?!1:y,R=v===void 0?"chat":v,C=xe(),A=R==="header",[S,E]=q.useState(!1),[$,I]=q.useState(!1),[T,D]=q.useState("branches"),[Y,ae]=q.useState(null),[H,_]=q.useState(""),[z,ee]=q.useState(null),Q=q.useRef(null),{releases:B,createRelease:ie,renameRelease:U,deleteRelease:oe}=hn(s),{url:J,setUrl:se,clear:F}=ka(s),te=Ca(s),re=P&&!!te.connection,he=P?te.connection?.endpoint??null:J,G=!!he;let pe;e[0]!==F||e[1]!==P||e[2]!==te?(pe=()=>{F(),P&&te.clear()},e[0]=F,e[1]=P,e[2]=te,e[3]=pe):pe=e[3];const Z=pe;let L;e[4]!==S?(L={enabled:S},e[4]=S,e[5]=L):L=e[5];const{data:K}=Lr(L);let ce;e[6]!==K?.data?.members?(ce=ue=>ue?K?.data?.members?.find(ut=>ut.userId===ue)?.user?.name??void 0:void 0,e[6]=K?.data?.members,e[7]=ce):ce=e[7];const je=ce,fe=B.length>=zn;let Ee;e[8]!==C?(Ee=C("thread.branchPicker.capReached",{max:zn}),e[8]=C,e[9]=Ee):Ee=e[9];const O=Ee;let ne,Le,_e,Ue,mt,st,we,De,$e,Be,Pe,Me,Se,Fe,nt,pt,Re,de,V,ve,ke,Ce,Ne,qe,at,bt,gt,We,Je;if(e[10]!==fe||e[11]!==c||e[12]!==w||e[13]!==O||e[14]!==Z||e[15]!==ie||e[16]!==oe||e[17]!==k||e[18]!==H||e[19]!==A||e[20]!==G||e[21]!==re||e[22]!==x||e[23]!==b||e[24]!==g||e[25]!==S||e[26]!==z||e[27]!==B||e[28]!==U||e[29]!==se||e[30]!==C||e[31]!==d||e[32]!==n||e[33]!==o){const{isBase:ue,current:ut,unlisted:Ht}=Mi({value:o,baseBranch:c,releases:B,baseIsDraft:w});Je=Ht;const W=ue?C("thread.branchPicker.live"):ut?.name??C("thread.branchPicker.defaultVersionName");Pe=re?C("thread.branchPicker.localhost.label"):G?C("thread.branchPicker.localLabel"):o?W:C("thread.branchPicker.selectVersion");const be=re?"bg-foreground":G?"bg-special":ue?"bg-success":_s(ut?.color??"orange");let me;e[63]!==Z||e[64]!==b?(me=le=>{Z(),b(le),E(!1)},e[63]=Z,e[64]=b,e[65]=me):me=e[65],Se=me;let Te;e[66]!==C?(Te=le=>{Oe.error(C("thread.branchPicker.saveError"),{description:dn(C,bs(le))})},e[66]=C,e[67]=Te):Te=e[67];const ge=Te;let At;e[68]!==se?(At=le=>{se(le),I(!1),E(!1)},e[68]=se,e[69]=At):At=e[69],st=At;let ts;e[70]!==fe||e[71]!==O||e[72]!==Z||e[73]!==ie||e[74]!==x||e[75]!==b||e[76]!==B||e[77]!==ge||e[78]!==d?(ts=(le,Ot)=>{if(Z(),x){x(le),I(!1),E(!1);return}if(!B.some(Fs=>Fs.branch===le)){if(fe){Oe.error(O);return}ie({branch:le,name:Ot.trim()||le,color:Os(B.length),createdBy:d,createdAt:new Date().toISOString()}).catch(ge)}b(le),I(!1),E(!1)},e[70]=fe,e[71]=O,e[72]=Z,e[73]=ie,e[74]=x,e[75]=b,e[76]=B,e[77]=ge,e[78]=d,e[79]=ts):ts=e[79],we=ts;let ss;e[80]!==fe||e[81]!==O||e[82]!==Z||e[83]!==ie||e[84]!==b||e[85]!==g||e[86]!==B||e[87]!==ge||e[88]!==C||e[89]!==d||e[90]!==n?(ss=()=>{if(fe){Oe.error(O);return}Z();const le=fn(n);ie({branch:le,name:Un(B,C("thread.branchPicker.defaultVersionName")),color:Os(B.length),createdBy:d,createdAt:new Date().toISOString()}).catch(ge),(g??b)(le),E(!1)},e[80]=fe,e[81]=O,e[82]=Z,e[83]=ie,e[84]=b,e[85]=g,e[86]=B,e[87]=ge,e[88]=C,e[89]=d,e[90]=n,e[91]=ss):ss=e[91],Be=ss;let ns;e[92]===Symbol.for("react.memo_cache_sentinel")?(ns=()=>{ae(null),_(""),I(!1),D("branches")},e[92]=ns):ns=e[92];const Or=ns;let as;e[93]===Symbol.for("react.memo_cache_sentinel")?(as=le=>{D(le),I(!0)},e[93]=as):as=e[93],Me=as;let rs;e[94]===Symbol.for("react.memo_cache_sentinel")?(rs=le=>{ae(le.branch),_(le.name)},e[94]=rs):rs=e[94],pt=rs;let ls;e[95]!==H||e[96]!==U||e[97]!==ge?(ls=le=>{const Ot=H.trim();Ot&&U(le,Ot).catch(ge),ae(null),_("")},e[95]=H,e[96]=U,e[97]=ge,e[98]=ls):ls=e[98],Fe=ls;let is;e[99]!==fe||e[100]!==O||e[101]!==ie||e[102]!==H||e[103]!==B.length||e[104]!==ge||e[105]!==d||e[106]!==o?(is=()=>{const le=H.trim();if(le&&o){if(fe){Oe.error(O),ae(null),_("");return}ie({branch:o,name:le,color:Os(B.length),createdBy:d,createdAt:new Date().toISOString()}).catch(ge)}ae(null),_("")},e[99]=fe,e[100]=O,e[101]=ie,e[102]=H,e[103]=B.length,e[104]=ge,e[105]=d,e[106]=o,e[107]=is):is=e[107],nt=is;let os;e[108]===Symbol.for("react.memo_cache_sentinel")?(os=()=>{ae(null),_("")},e[108]=os):os=e[108],De=os;let cs;e[109]!==c||e[110]!==oe||e[111]!==z||e[112]!==Se||e[113]!==B||e[114]!==ge||e[115]!==o?(cs=()=>{const le=z;if(ee(null),!!le){if(le.branch===o){const Ot=B.find(Fs=>Fs.branch!==le.branch);Ot?Se(Ot.branch):c?Se(c):E(!1)}else E(!1);oe(le.branch).catch(ge)}},e[109]=c,e[110]=oe,e[111]=z,e[112]=Se,e[113]=B,e[114]=ge,e[115]=o,e[116]=cs):cs=e[116],$e=cs,mt=gl,gt=S,e[117]!==k?(We=k?void 0:le=>{le||Or(),E(le)},e[117]=k,e[118]=We):We=e[118],Ue=kt,_e=Ct,bt=!0,at="inline-flex min-w-0 shrink",Le=xl,qe=!0,ne=ye,de=pl.branchPicker,V=A?"outline":"ghost",ve=A?"sm":"default",ke=Pe,Ce=k;const $s=A?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[119]!==$s?(Ne=X("shrink min-w-0 max-w-[220px] gap-2",$s,Ta),e[119]=$s,e[120]=Ne):Ne=e[120],Re=X("h-2 w-2 shrink-0 rounded-full",o||G?be:"bg-muted-foreground"),e[10]=fe,e[11]=c,e[12]=w,e[13]=O,e[14]=Z,e[15]=ie,e[16]=oe,e[17]=k,e[18]=H,e[19]=A,e[20]=G,e[21]=re,e[22]=x,e[23]=b,e[24]=g,e[25]=S,e[26]=z,e[27]=B,e[28]=U,e[29]=se,e[30]=C,e[31]=d,e[32]=n,e[33]=o,e[34]=ne,e[35]=Le,e[36]=_e,e[37]=Ue,e[38]=mt,e[39]=st,e[40]=we,e[41]=De,e[42]=$e,e[43]=Be,e[44]=Pe,e[45]=Me,e[46]=Se,e[47]=Fe,e[48]=nt,e[49]=pt,e[50]=Re,e[51]=de,e[52]=V,e[53]=ve,e[54]=ke,e[55]=Ce,e[56]=Ne,e[57]=qe,e[58]=at,e[59]=bt,e[60]=gt,e[61]=We,e[62]=Je}else ne=e[34],Le=e[35],_e=e[36],Ue=e[37],mt=e[38],st=e[39],we=e[40],De=e[41],$e=e[42],Be=e[43],Pe=e[44],Me=e[45],Se=e[46],Fe=e[47],nt=e[48],pt=e[49],Re=e[50],de=e[51],V=e[52],ve=e[53],ke=e[54],Ce=e[55],Ne=e[56],qe=e[57],at=e[58],bt=e[59],gt=e[60],We=e[61],Je=e[62];let Ae;e[121]!==Re?(Ae=r.jsx("span",{className:Re}),e[121]=Re,e[122]=Ae):Ae=e[122];let rt;e[123]!==Pe?(rt=r.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:Pe}),e[123]=Pe,e[124]=rt):rt=e[124];let lt;e[125]!==k?(lt=!k&&r.jsx(Ba,{size:12,className:"opacity-60 shrink-0"}),e[125]=k,e[126]=lt):lt=e[126];let xt;e[127]!==ne||e[128]!==de||e[129]!==V||e[130]!==ve||e[131]!==ke||e[132]!==Ce||e[133]!==Ne||e[134]!==Ae||e[135]!==rt||e[136]!==lt?(xt=r.jsxs(ne,{"data-tour":de,variant:V,size:ve,"aria-label":ke,disabled:Ce,className:Ne,children:[Ae,rt,lt]}),e[127]=ne,e[128]=de,e[129]=V,e[130]=ve,e[131]=ke,e[132]=Ce,e[133]=Ne,e[134]=Ae,e[135]=rt,e[136]=lt,e[137]=xt):xt=e[137];let It;e[138]!==Le||e[139]!==qe||e[140]!==xt?(It=r.jsx(Le,{asChild:qe,children:xt}),e[138]=Le,e[139]=qe,e[140]=xt,e[141]=It):It=e[141];let vt;e[142]!==at||e[143]!==It?(vt=r.jsx("span",{className:at,children:It}),e[142]=at,e[143]=It,e[144]=vt):vt=e[144];let Xe;e[145]!==_e||e[146]!==bt||e[147]!==vt?(Xe=r.jsx(_e,{asChild:bt,children:vt}),e[145]=_e,e[146]=bt,e[147]=vt,e[148]=Xe):Xe=e[148];let Ye;e[149]!==Pe?(Ye=r.jsx(Nt,{children:Pe}),e[149]=Pe,e[150]=Ye):Ye=e[150];let Ze;e[151]!==Ue||e[152]!==Xe||e[153]!==Ye?(Ze=r.jsxs(Ue,{children:[Xe,Ye]}),e[151]=Ue,e[152]=Xe,e[153]=Ye,e[154]=Ze):Ze=e[154];let Dt;e[155]===Symbol.for("react.memo_cache_sentinel")?(Dt=ue=>{ue.preventDefault(),Q.current?.scrollIntoView({block:"nearest"})},e[155]=Dt):Dt=e[155];let it;e[156]!==N||e[157]!==C?(it=N&&r.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:C("thread.branchPicker.newChatHint")}),e[156]=N,e[157]=C,e[158]=it):it=e[158];let yt;e[159]!==st||e[160]!==we||e[161]!==$||e[162]!==T||e[163]!==fe||e[164]!==De||e[165]!==O||e[166]!==Z||e[167]!==Be||e[168]!==je||e[169]!==H||e[170]!==Y||e[171]!==P||e[172]!==G||e[173]!==he||e[174]!==re||e[175]!==S||e[176]!==Me||e[177]!==i||e[178]!==u||e[179]!==f||e[180]!==Se||e[181]!==B||e[182]!==p||e[183]!==m||e[184]!==Fe||e[185]!==nt||e[186]!==te||e[187]!==pt||e[188]!==C||e[189]!==h||e[190]!==J||e[191]!==Je||e[192]!==d||e[193]!==o||e[194]!==s?(yt=$?r.jsx(Wi,{orgId:i,orgSlug:u,userId:d,target:h,owner:f,repo:p,sandboxMap:m,enabled:S,tab:T,onTabChange:D,isV8:P,localUrl:J,onSaveLocal:st,onBack:()=>I(!1),onAdopt:we}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:X("always-scrollbar flex max-h-[min(50vh,20rem)] flex-col overflow-y-auto",P&&"gap-1"),children:[!P&&G&&he&&r.jsx(Qi,{rowRef:Q,url:he,onSelect:()=>Me("local"),onEdit:()=>Me("local"),onTurnOff:()=>Z()}),Je&&o&&(Y===o?r.jsx(Qn,{value:H,onChange:_,onSave:nt,onCancel:De}):r.jsx(Wn,{rowRef:G?void 0:Q,dot:_s("orange"),label:C("thread.branchPicker.defaultVersionName"),branch:o,selected:!G,onSelect:()=>Se(o),onRename:()=>{ae(o),_(Un(B,C("thread.branchPicker.defaultVersionName")))}})),B.map(ue=>Y===ue.branch?r.jsx(Qn,{value:H,onChange:_,onSave:()=>Fe(ue.branch),onCancel:De},ue.branch):r.jsx(Wn,{rowRef:!G&&ue.branch===o?Q:void 0,dot:_s(ue.color),label:ue.name,creator:je(ue.createdBy),branch:ue.branch,selected:!G&&ue.branch===o,onSelect:()=>Se(ue.branch),onRename:()=>pt(ue),onDelete:()=>ee(ue)},ue.branch)),P&&r.jsx(Ei,{virtualMcpId:s,branch:o,serve:te,rowRef:re?Q:void 0,onPicked:()=>E(!1)})]}),(Je||B.length>0||P)&&r.jsx("div",{className:"my-1 border-t"}),r.jsxs("button",{type:"button",onClick:()=>{Be()},disabled:fe,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:[r.jsx(Oa,{className:"h-4 w-4 shrink-0"}),C("thread.branchPicker.newVersion")]}),fe&&r.jsx("p",{className:"px-2 pb-1 pt-0.5 text-xs text-warning",children:O}),r.jsxs("button",{type:"button",onClick:()=>Me("branches"),className:X("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:[C("thread.branchPicker.advanced"),r.jsx(ua,{className:"h-4 w-4 shrink-0"})]})]}),e[159]=st,e[160]=we,e[161]=$,e[162]=T,e[163]=fe,e[164]=De,e[165]=O,e[166]=Z,e[167]=Be,e[168]=je,e[169]=H,e[170]=Y,e[171]=P,e[172]=G,e[173]=he,e[174]=re,e[175]=S,e[176]=Me,e[177]=i,e[178]=u,e[179]=f,e[180]=Se,e[181]=B,e[182]=p,e[183]=m,e[184]=Fe,e[185]=nt,e[186]=te,e[187]=pt,e[188]=C,e[189]=h,e[190]=J,e[191]=Je,e[192]=d,e[193]=o,e[194]=s,e[195]=yt):yt=e[195];let ot;e[196]!==it||e[197]!==yt?(ot=r.jsxs(vl,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:Dt,children:[it,yt]}),e[196]=it,e[197]=yt,e[198]=ot):ot=e[198];let Bt;e[199]!==mt||e[200]!==gt||e[201]!==We||e[202]!==Ze||e[203]!==ot?(Bt=r.jsxs(mt,{open:gt,onOpenChange:We,children:[Ze,ot]}),e[199]=mt,e[200]=gt,e[201]=We,e[202]=Ze,e[203]=ot,e[204]=Bt):Bt=e[204];const Mt=Bt,_t=z!==null;let $t;e[205]===Symbol.for("react.memo_cache_sentinel")?($t=ue=>{ue||ee(null)},e[205]=$t):$t=e[205];let et;e[206]!==C?(et=C("thread.branchPicker.deleteTitle"),e[206]=C,e[207]=et):et=e[207];let wt;e[208]!==et?(wt=r.jsx(Ys,{children:et}),e[208]=et,e[209]=wt):wt=e[209];let ct;e[210]!==z||e[211]!==C?(ct=z&&C("thread.branchPicker.deleteConfirm",{name:z.name}),e[210]=z,e[211]=C,e[212]=ct):ct=e[212];let Pt;e[213]!==ct?(Pt=r.jsx(Zs,{children:ct}),e[213]=ct,e[214]=Pt):Pt=e[214];let jt;e[215]!==wt||e[216]!==Pt?(jt=r.jsxs(en,{children:[wt,Pt]}),e[215]=wt,e[216]=Pt,e[217]=jt):jt=e[217];let St;e[218]!==C?(St=C("thread.branchPicker.cancel"),e[218]=C,e[219]=St):St=e[219];let ze;e[220]!==St?(ze=r.jsx(tn,{children:St}),e[220]=St,e[221]=ze):ze=e[221];let He;e[222]!==C?(He=C("thread.branchPicker.delete"),e[222]=C,e[223]=He):He=e[223];let Ke;e[224]!==$e||e[225]!==He?(Ke=r.jsx(sn,{onClick:$e,variant:"destructive",children:He}),e[224]=$e,e[225]=He,e[226]=Ke):Ke=e[226];let Ve;e[227]!==ze||e[228]!==Ke?(Ve=r.jsxs(nn,{children:[ze,Ke]}),e[227]=ze,e[228]=Ke,e[229]=Ve):Ve=e[229];let Ge;e[230]!==jt||e[231]!==Ve?(Ge=r.jsxs(an,{children:[jt,Ve]}),e[230]=jt,e[231]=Ve,e[232]=Ge):Ge=e[232];let Qe;e[233]!==_t||e[234]!==Ge?(Qe=r.jsx(rn,{open:_t,onOpenChange:$t,children:Ge}),e[233]=_t,e[234]=Ge,e[235]=Qe):Qe=e[235];let dt;return e[236]!==Mt||e[237]!==Qe?(dt=r.jsxs(r.Fragment,{children:[Mt,Qe]}),e[236]=Mt,e[237]=Qe,e[238]=dt):dt=e[238],dt}function Qn(t){const e=M.c(20),{value:s,onChange:a,onSave:n,onCancel:o}=t,c=xe();let l;e[0]!==c?(l=c("thread.branchPicker.rename"),e[0]=c,e[1]=l):l=e[1];let i;e[2]!==a?(i=m=>a(m.target.value),e[2]=a,e[3]=i):i=e[3];let u;e[4]!==o||e[5]!==n?(u=m=>{m.key==="Enter"&&n(),m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),o())},e[4]=o,e[5]=n,e[6]=u):u=e[6];let d;e[7]!==l||e[8]!==i||e[9]!==u||e[10]!==s?(d=r.jsx("input",{autoFocus:!0,"aria-label":l,value:s,onChange:i,onKeyDown:u,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[7]=l,e[8]=i,e[9]=u,e[10]=s,e[11]=d):d=e[11];let h;e[12]!==c?(h=c("thread.branchPicker.save"),e[12]=c,e[13]=h):h=e[13];let f;e[14]!==n||e[15]!==h?(f=r.jsx(ye,{size:"sm",onClick:n,children:h}),e[14]=n,e[15]=h,e[16]=f):f=e[16];let p;return e[17]!==d||e[18]!==f?(p=r.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[d,f]}),e[17]=d,e[18]=f,e[19]=p):p=e[19],p}function Wn(t){const e=M.c(49),{rowRef:s,dot:a,label:n,creator:o,branch:c,selected:l,onSelect:i,onRename:u,onDelete:d}=t,h=xe(),f=l?"bg-accent":"hover:bg-accent";let p;e[0]!==f?(p=X("group flex items-center rounded-lg",f),e[0]=f,e[1]=p):p=e[1];let m;e[2]!==a?(m=X("h-2 w-2 shrink-0 rounded-full",a),e[2]=a,e[3]=m):m=e[3];let b;e[4]!==m?(b=r.jsx("span",{className:m}),e[4]=m,e[5]=b):b=e[5];let g;e[6]!==o?(g=o&&r.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:o}),e[6]=o,e[7]=g):g=e[7];let x;e[8]!==n||e[9]!==g?(x=r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[n,g]}),e[8]=n,e[9]=g,e[10]=x):x=e[10];let j;e[11]!==i||e[12]!==l||e[13]!==b||e[14]!==x?(j=r.jsx(Ct,{asChild:!0,children:r.jsxs("button",{type:"button","aria-pressed":l,onClick:i,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[b,x]})}),e[11]=i,e[12]=l,e[13]=b,e[14]=x,e[15]=j):j=e[15];let y;e[16]!==c||e[17]!==h?(y=h("thread.branchPicker.branchTooltip",{branch:c}),e[16]=c,e[17]=h,e[18]=y):y=e[18];let v;e[19]!==y?(v=r.jsx(Nt,{side:"bottom",className:"font-mono text-xs",children:y}),e[19]=y,e[20]=v):v=e[20];let P;e[21]!==j||e[22]!==v?(P=r.jsxs(kt,{children:[j,v]}),e[21]=j,e[22]=v,e[23]=P):P=e[23];let w;e[24]!==h?(w=h("thread.branchPicker.moreActions"),e[24]=h,e[25]=w):w=e[25];let k;e[26]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Ea,{className:"h-4 w-4"}),e[26]=k):k=e[26];let N;e[27]!==w?(N=r.jsx(Ps,{asChild:!0,children:r.jsx(ye,{variant:"ghost",size:"icon","aria-label":w,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:k})}),e[27]=w,e[28]=N):N=e[28];let R;e[29]===Symbol.for("react.memo_cache_sentinel")?(R=r.jsx(_a,{className:"h-4 w-4"}),e[29]=R):R=e[29];let C;e[30]!==h?(C=h("thread.branchPicker.rename"),e[30]=h,e[31]=C):C=e[31];let A;e[32]!==u||e[33]!==C?(A=r.jsxs(Gt,{onSelect:u,children:[R,C]}),e[32]=u,e[33]=C,e[34]=A):A=e[34];let S;e[35]!==d||e[36]!==h?(S=d&&r.jsxs(Gt,{onSelect:d,className:"text-destructive focus:text-destructive",children:[r.jsx(Ts,{className:"h-4 w-4"}),h("thread.branchPicker.delete")]}),e[35]=d,e[36]=h,e[37]=S):S=e[37];let E;e[38]!==A||e[39]!==S?(E=r.jsxs(js,{align:"end",children:[A,S]}),e[38]=A,e[39]=S,e[40]=E):E=e[40];let $;e[41]!==N||e[42]!==E?($=r.jsxs(Ss,{children:[N,E]}),e[41]=N,e[42]=E,e[43]=$):$=e[43];let I;return e[44]!==s||e[45]!==P||e[46]!==$||e[47]!==p?(I=r.jsxs("div",{ref:s,className:p,children:[P,$]}),e[44]=s,e[45]=P,e[46]=$,e[47]=p,e[48]=I):I=e[48],I}function Qi(t){const e=M.c(40),{rowRef:s,url:a,onSelect:n,onEdit:o,onTurnOff:c}=t,l=xe();let i;try{let A;e[0]!==a?(A=new URL(a),e[0]=a,e[1]=A):A=e[1],i=A.host}catch{i=a}const u=i;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-special"}),e[2]=d):d=e[2];let h;e[3]!==l?(h=l("thread.branchPicker.localLabel"),e[3]=l,e[4]=h):h=e[4];let f;e[5]!==u?(f=r.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:u}),e[5]=u,e[6]=f):f=e[6];let p;e[7]!==h||e[8]!==f?(p=r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[h,f]}),e[7]=h,e[8]=f,e[9]=p):p=e[9];let m;e[10]!==n||e[11]!==p?(m=r.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:[d,p]}),e[10]=n,e[11]=p,e[12]=m):m=e[12];let b;e[13]!==l?(b=l("thread.branchPicker.moreActions"),e[13]=l,e[14]=b):b=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(Ea,{className:"h-4 w-4"}),e[15]=g):g=e[15];let x;e[16]!==b?(x=r.jsx(Ps,{asChild:!0,children:r.jsx(ye,{variant:"ghost",size:"icon","aria-label":b,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:g})}),e[16]=b,e[17]=x):x=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(_a,{className:"h-4 w-4"}),e[18]=j):j=e[18];let y;e[19]!==l?(y=l("thread.branchPicker.rename"),e[19]=l,e[20]=y):y=e[20];let v;e[21]!==o||e[22]!==y?(v=r.jsxs(Gt,{onSelect:o,children:[j,y]}),e[21]=o,e[22]=y,e[23]=v):v=e[23];let P;e[24]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(Ts,{className:"h-4 w-4"}),e[24]=P):P=e[24];let w;e[25]!==l?(w=l("thread.branchPicker.localTurnOff"),e[25]=l,e[26]=w):w=e[26];let k;e[27]!==c||e[28]!==w?(k=r.jsxs(Gt,{onSelect:c,className:"text-destructive focus:text-destructive",children:[P,w]}),e[27]=c,e[28]=w,e[29]=k):k=e[29];let N;e[30]!==v||e[31]!==k?(N=r.jsxs(js,{align:"end",children:[v,k]}),e[30]=v,e[31]=k,e[32]=N):N=e[32];let R;e[33]!==N||e[34]!==x?(R=r.jsxs(Ss,{children:[x,N]}),e[33]=N,e[34]=x,e[35]=R):R=e[35];let C;return e[36]!==s||e[37]!==R||e[38]!==m?(C=r.jsxs("div",{ref:s,className:"group flex items-center rounded-lg bg-accent",children:[m,R]}),e[36]=s,e[37]=R,e[38]=m,e[39]=C):C=e[39],C}function Wi(t){const e=M.c(73),{orgId:s,orgSlug:a,userId:n,target:o,owner:c,repo:l,sandboxMap:i,enabled:u,tab:d,onTabChange:h,isV8:f,localUrl:p,onSaveLocal:m,onBack:b,onAdopt:g}=t,x=xe(),[j,y]=q.useState(""),v=d==="branches"?j:"",P=u&&d==="branches";let w;e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==i||e[5]!==v||e[6]!==P||e[7]!==o||e[8]!==n?(w={orgId:s,orgSlug:a,userId:n,target:o,sandboxMap:i,owner:c,repo:l,search:v,enabled:P},e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=i,e[5]=v,e[6]=P,e[7]=o,e[8]=n,e[9]=w):w=e[9];const{recent:k,yours:N,others:R,isLoading:C,hasMore:A,isFetchingMore:S,fetchMore:E}=Ki(w),$=u&&d==="prs";let I;e[10]!==s||e[11]!==a||e[12]!==c||e[13]!==l||e[14]!==$||e[15]!==o?(I={orgId:s,orgSlug:a,target:o,owner:c,repo:l,enabled:$},e[10]=s,e[11]=a,e[12]=c,e[13]=l,e[14]=$,e[15]=o,e[16]=I):I=e[16];const{data:T,isLoading:D}=Dl(I);let Y;if(e[17]!==E||e[18]!==A||e[19]!==S||e[20]!==C||e[21]!==f||e[22]!==p||e[23]!==g||e[24]!==b||e[25]!==m||e[26]!==h||e[27]!==R||e[28]!==c||e[29]!==D||e[30]!==k||e[31]!==l||e[32]!==j||e[33]!==x||e[34]!==T||e[35]!==d||e[36]!==N){const ae=T===void 0?[]:T,H=`${c}/${l}`;let _;e[38]!==H?(_=H.toLowerCase(),e[38]=H,e[39]=_):_=e[39];const z=_;let ee;e[40]!==z?(ee=L=>L.headRepoFullName?.toLowerCase()===z,e[40]=z,e[41]=ee):ee=e[41];const Q=ae.filter(ee);let B;if(e[42]!==R||e[43]!==k||e[44]!==N){const L=new Set;B=[...k,...N,...R].filter(K=>L.has(K.name)?!1:(L.add(K.name),!0)),e[42]=R,e[43]=k,e[44]=N,e[45]=B}else B=e[45];const ie=B;let U;e[46]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(jl,{className:"h-4 w-4 shrink-0"}),e[46]=U):U=e[46];let oe;e[47]!==x?(oe=x("thread.branchPicker.advancedBack"),e[47]=x,e[48]=oe):oe=e[48];let J;e[49]!==b||e[50]!==oe?(J=r.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[U,oe]}),e[49]=b,e[50]=oe,e[51]=J):J=e[51];let se;e[52]!==h?(se=L=>{h(L),y("")},e[52]=h,e[53]=se):se=e[53];let F;e[54]!==x?(F=x("thread.branchPicker.branchesTab"),e[54]=x,e[55]=F):F=e[55];let te;e[56]!==F?(te=r.jsx(Lt,{value:"branches",className:"h-6 px-2.5 text-xs",children:F}),e[56]=F,e[57]=te):te=e[57];let re;e[58]!==x?(re=x("thread.branchPicker.prsTab"),e[58]=x,e[59]=re):re=e[59];let he;e[60]!==re?(he=r.jsx(Lt,{value:"prs",className:"h-6 px-2.5 text-xs",children:re}),e[60]=re,e[61]=he):he=e[61];let G;e[62]!==f||e[63]!==x?(G=!f&&r.jsx(Lt,{value:"local",className:"h-6 px-2.5 text-xs",children:x("thread.branchPicker.localTab")}),e[62]=f,e[63]=x,e[64]=G):G=e[64];let pe;e[65]!==te||e[66]!==he||e[67]!==G?(pe=r.jsxs(Ia,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[te,he,G]}),e[65]=te,e[66]=he,e[67]=G,e[68]=pe):pe=e[68];let Z;e[69]!==se||e[70]!==pe||e[71]!==d?(Z=r.jsx(Da,{className:"px-2 pt-2 pb-1",value:d,onValueChange:se,children:pe}),e[69]=se,e[70]=pe,e[71]=d,e[72]=Z):Z=e[72],Y=r.jsxs("div",{className:"flex flex-col",children:[J,Z,d==="local"&&!f?r.jsx(Fi,{url:p,onSave:m}):r.jsxs(yl,{filter:d==="branches"?Ji:void 0,children:[r.jsx(wl,{placeholder:x(d==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),value:j,onValueChange:y}),r.jsx(Pl,{onScroll:L=>{const K=L.currentTarget;d==="branches"&&K.scrollHeight-K.scrollTop-K.clientHeight<48&&E()},children:d==="branches"?r.jsxs(r.Fragment,{children:[C&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:x("thread.branchPicker.loadingMore")}),!C&&ie.length===0&&r.jsx(_n,{children:x("thread.branchPicker.noBranchesFound")}),ie.length>0&&r.jsx(On,{children:ie.map(L=>r.jsxs(Ln,{value:L.name,className:"cursor-pointer",onSelect:()=>g(L.name,L.name),children:[r.jsx(Ur,{className:"mr-2 h-4 w-4 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:L.name})]},L.name))}),A&&r.jsx("div",{className:"p-2",children:r.jsx(ye,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:S,onClick:E,children:x(S?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):r.jsxs(r.Fragment,{children:[D&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:x("thread.branchPicker.loadingPullRequests")}),!D&&Q.length===0&&r.jsx(_n,{children:x("thread.branchPicker.noOpenPullRequests")}),Q.length>0&&r.jsx(On,{children:Q.map(L=>r.jsxs(Ln,{value:`#${L.number} ${L.title} ${L.head}`,className:"cursor-pointer",onSelect:()=>g(L.head,Gn(L.title)),children:[r.jsx(Rs,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate",children:Gn(L.title)}),r.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",L.number," · ",L.head]})]})]},L.number))})]})})]})]}),e[17]=E,e[18]=A,e[19]=S,e[20]=C,e[21]=f,e[22]=p,e[23]=g,e[24]=b,e[25]=m,e[26]=h,e[27]=R,e[28]=c,e[29]=D,e[30]=k,e[31]=l,e[32]=j,e[33]=x,e[34]=T,e[35]=d,e[36]=N,e[37]=Y}else Y=e[37];return Y}function Ji(t,e){return Ks(t,e)?1:0}function Xi(t){const e=M.c(19),{locked:s,placement:a,value:n,virtualMcpId:o,isV8:c,userLabel:l,baseBranch:i,baseIsDraft:u,onChange:d,onCreateBranch:h,onAdoptBranch:f,orgId:p,orgSlug:m,userId:b,target:g,owner:x,repo:j,sandboxMap:y}=t;let v;return e[0]!==i||e[1]!==u||e[2]!==c||e[3]!==s||e[4]!==f||e[5]!==d||e[6]!==h||e[7]!==p||e[8]!==m||e[9]!==x||e[10]!==a||e[11]!==j||e[12]!==y||e[13]!==g||e[14]!==b||e[15]!==l||e[16]!==n||e[17]!==o?(v=r.jsx(Gi,{virtualMcpId:o,isV8:c,userLabel:l,value:n,baseBranch:i,baseIsDraft:u,orgId:p,orgSlug:m,userId:b,target:g,owner:x,repo:j,sandboxMap:y,onChange:d,onCreateBranch:h,onAdoptBranch:f,spawnsNewChat:s,placement:a}),e[0]=i,e[1]=u,e[2]=c,e[3]=s,e[4]=f,e[5]=d,e[6]=h,e[7]=p,e[8]=m,e[9]=x,e[10]=a,e[11]=j,e[12]=y,e[13]=g,e[14]=b,e[15]=l,e[16]=n,e[17]=o,e[18]=v):v=e[18],v}function Yi(t){const e=M.c(2),{branchPill:s}=t;if(!s)return null;let a;return e[0]!==s?(a=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=a):a=e[1],a}function Zi(t){const e=M.c(25),{virtualMcp:s,currentBranch:a}=t,n=nl(),o=Zt();let c;e[0]!==n?.messages||e[1]!==o?.isThreadLocked?(c=(n?.messages??[]).length>0||(o?.isThreadLocked??!1),e[0]=n?.messages,e[1]=o?.isThreadLocked,e[2]=c):c=e[2];const l=c,i=o?.setCurrentTaskBranch,u=o?.createTask;let d;e[3]!==o?.activeTask?.metadata||e[4]!==s?.metadata?(d=Nl(s?.metadata)==="cms"&&qn(o?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=o?.activeTask?.metadata,e[4]=s?.metadata,e[5]=d):d=e[5];const h=d,f=Al(s),p=tt(f),{data:m}=ks.useSession(),b=m?.user;let g;e[6]!==b?(g=mn(b),e[6]=b,e[7]=g):g=e[7];const x=g,j=m?.user?.id??"",{org:y}=Cs(),v=Bl(s,a),P=Va(s?.id);let w;e[8]!==P||e[9]!==o?.activeTask?.metadata||e[10]!==s?.metadata?(w=P==="v8"&&qn(o?.activeTask?.metadata,s?.metadata)==="cms",e[8]=P,e[9]=o?.activeTask?.metadata,e[10]=s?.metadata,e[11]=w):w=e[11];const k=w;let N;e[12]!==u||e[13]!==l||e[14]!==i?(N=T=>{l&&u?u({branch:T}):i&&i(T)},e[12]=u,e[13]=l,e[14]=i,e[15]=N):N=e[15];const R=N;let C;e[16]!==h||e[17]!==u||e[18]!==l||e[19]!==i?(C=T=>{(l||h)&&u?u({branch:T}):i&&i(T)},e[16]=h,e[17]=u,e[18]=l,e[19]=i,e[20]=C):C=e[20];const A=C;let S;e[21]!==u?(S=u?T=>u({runtime:"sandbox",branch:T}):void 0,e[21]=u,e[22]=S):S=e[22];const E=S,$=f&&La(p)?r.jsx(Xi,{userLabel:x,virtualMcpId:s?.id??"",isV8:P==="v8",value:a,baseBranch:v,baseIsDraft:k,orgId:y.id,orgSlug:y.slug,userId:j,target:p,owner:f.owner,repo:f.name,sandboxMap:s?.metadata?.sandboxMap,onChange:R,onCreateBranch:A,onAdoptBranch:E,locked:l,placement:"chat"},`${Ua(p)}:${f.owner}/${f.name}`):null;let I;return e[23]!==$?(I=r.jsx(Yi,{branchPill:$}),e[23]=$,e[24]=I):I=e[24],I}const eo=qr("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 to(t){const e=M.c(11);let s,a,n;e[0]!==t?({className:s,orientation:a,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n):(s=e[1],a=e[2],n=e[3]);let o;e[4]!==s||e[5]!==a?(o=X(eo({orientation:a}),s),e[4]=s,e[5]=a,e[6]=o):o=e[6];let c;return e[7]!==a||e[8]!==n||e[9]!==o?(c=r.jsx("div",{role:"group","data-slot":"button-group","data-orientation":a,className:o,...n}),e[7]=a,e[8]=n,e[9]=o,e[10]=c):c=e[10],c}function so(t){const e=M.c(14),{item:s}=t;let a;e[0]!==s?(a=()=>{s.onSelect()},e[0]=s,e[1]=a):a=e[1];let n;e[2]!==s.disabled||e[3]!==s.icon||e[4]!==s.label||e[5]!==a?(n=r.jsxs(Gt,{disabled:s.disabled,onSelect:a,children:[s.icon,s.label]}),e[2]=s.disabled,e[3]=s.icon,e[4]=s.label,e[5]=a,e[6]=n):n=e[6];const o=n;if(!s.tooltip)return o;let c;e[7]!==o?(c=r.jsx(Ct,{asChild:!0,children:o}),e[7]=o,e[8]=c):c=e[8];let l;e[9]!==s.tooltip?(l=r.jsx(Nt,{side:"right",children:s.tooltip}),e[9]=s.tooltip,e[10]=l):l=e[10];let i;return e[11]!==c||e[12]!==l?(i=r.jsxs(kt,{children:[c,l]}),e[11]=c,e[12]=l,e[13]=i):i=e[13],i}function lr(t){const e=M.c(20),{label:s,onClick:a,variant:n,size:o,disabled:c,loading:l,pulse:i,tooltip:u,icon:d,items:h,menuAriaLabel:f,className:p}=t,m=n===void 0?"default":n,b=o===void 0?"default":o,g=c===void 0?!1:c,x=l===void 0?!1:l,j=i===void 0?!1:i,y=(h?.length??0)>0;let v;if(e[0]!==p||e[1]!==g||e[2]!==y||e[3]!==d||e[4]!==h||e[5]!==s||e[6]!==x||e[7]!==f||e[8]!==a||e[9]!==j||e[10]!==b||e[11]!==u||e[12]!==m){const P=X(Ta,m==="default"&&"focus-visible:inset-ring-current");let w;e[14]!==d||e[15]!==x?(w=x?r.jsx(Qt,{size:"xs"}):d,e[14]=d,e[15]=x,e[16]=w):w=e[16];const k=r.jsxs(ye,{type:"button",variant:m,size:b,disabled:g,"aria-busy":x||void 0,onClick:x?void 0:a,className:X(P,y&&"rounded-r-none border-r border-current/20"),children:[w,s]}),N=j&&"animate-pulse-brightness motion-reduce:animate-none motion-reduce:opacity-80";let R;e[17]!==p||e[18]!==N?(R=X(N,p),e[17]=p,e[18]=N,e[19]=R):R=e[19],v=r.jsxs(to,{className:R,children:[u?r.jsxs(kt,{children:[r.jsx(Ct,{asChild:!0,children:r.jsx("span",{className:X("inline-flex rounded-lg outline-none",P,g&&"cursor-not-allowed"),tabIndex:g?0:void 0,role:g?"button":void 0,"aria-disabled":g||void 0,children:k})}),r.jsx(Nt,{children:u})]}):k,y?r.jsxs(Ss,{children:[r.jsx(Ps,{asChild:!0,children:r.jsx(ye,{type:"button",variant:m,size:b,"aria-label":f,className:X("has-[>svg]:px-2",P),children:r.jsx(Ba,{className:"size-3.5"})})}),r.jsx(js,{align:"end",children:h?.map(no)})]}):null]}),e[0]=p,e[1]=g,e[2]=y,e[3]=d,e[4]=h,e[5]=s,e[6]=x,e[7]=f,e[8]=a,e[9]=j,e[10]=b,e[11]=u,e[12]=m,e[13]=v}else v=e[13];return v}function no(t){return r.jsx(so,{item:t},t.key)}async function ao(t){if(t.hosted)return;const e=t.branch;await t.setCurrentTaskBranch(t.nextBranch()),e&&e!==t.baseBranch&&await t.deleteRelease(e)}function ro(t,e,{hosted:s}){return s&&t!==null?t:e}function lo(t,e){const s=M.c(11),[a,n]=q.useState(null);let o;s[0]!==a||s[1]!==t||s[2]!==e?(o=ro(a,t,e),s[0]=a,s[1]=t,s[2]=e,s[3]=o):o=s[3];let c;s[4]!==t||s[5]!==e?(c=()=>n(e.hosted?t:null),s[4]=t,s[5]=e,s[6]=c):c=s[6];let l;s[7]===Symbol.for("react.memo_cache_sentinel")?(l=()=>n(null),s[7]=l):l=s[7];let i;return s[8]!==o||s[9]!==c?(i={shown:o,hold:c,release:l},s[8]=o,s[9]=c,s[10]=i):i=s[10],i}function io({open:t,hosted:e}){return t||e}function ir(t){return Ds({userName:t?.name,userEmail:t?.email})??void 0}function Bs(t){const e=M.c(18),{state:s,header:a,body:n,note:o,gate:c,footer:l}=t,i=s!=="ready";let u;e[0]!==a?(u=r.jsx("div",{className:"space-y-0.5 px-4 py-3",children:a}),e[0]=a,e[1]=u):u=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"border-t"}),e[2]=d):d=e[2];let h;e[3]!==o?(h=o?r.jsx("div",{className:"space-y-1.5 border-t px-4 py-3",children:o}):null,e[3]=o,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==h?(f=r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n,h]}),e[5]=n,e[6]=h,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("div",{className:"border-t"}),e[8]=p):p=e[8];let m;e[9]!==l?(m=r.jsx("div",{className:"space-y-2 px-4 py-3",children:l}),e[9]=l,e[10]=m):m=e[10];let b;return e[11]!==c||e[12]!==s||e[13]!==i||e[14]!==u||e[15]!==f||e[16]!==m?(b=r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-publish-state":s,"aria-busy":i,children:[u,d,f,c,p,m]}),e[11]=c,e[12]=s,e[13]=i,e[14]=u,e[15]=f,e[16]=m,e[17]=b):b=e[17],b}function Yt(t){const e=M.c(2),{children:s}=t;let a;return e[0]!==s?(a=r.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]=a):a=e[1],a}function or(t){const e=M.c(10);let s,a,n;e[0]!==t?({className:a,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n):(s=e[1],a=e[2],n=e[3]);let o;e[4]!==a?(o=X("rounded-lg border bg-card px-3 py-2.5",a),e[4]=a,e[5]=o):o=e[5];let c;return e[6]!==s||e[7]!==n||e[8]!==o?(c=r.jsx("div",{className:o,...n,children:s}),e[6]=s,e[7]=n,e[8]=o,e[9]=c):c=e[9],c}function ft(t){const e=M.c(4),{className:s}=t;let a;e[0]!==s?(a=X("animate-pulse rounded bg-muted motion-reduce:animate-none",s),e[0]=s,e[1]=a):a=e[1];let n;return e[2]!==a?(n=r.jsx("div",{className:a}),e[2]=a,e[3]=n):n=e[3],n}function Ut(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(or,{children:r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx(ft,{className:"size-4 rounded-md"}),r.jsx(ft,{className:"h-3 w-24"}),r.jsx(ft,{className:"h-2.5 w-16"}),r.jsx(ft,{className:"ml-auto size-6 rounded"})]})}),t[0]=e):e=t[0],e}const oo="secret";async function co(t,e,s){const a=Ds(s.coAuthor),{changeRequest:n}=await Xs(t,"CHANGE_REQUEST_OPEN",{...e,head:s.branch,base:s.base,title:s.title,body:Bi(s.body,a)||void 0});return{number:n.number,htmlUrl:n.url}}class cr extends Error{reason;detail;constructor(e,s){super(s||`Merge refused: ${e}`),this.name="ChangeRequestMergeRefused",this.reason=e,this.detail=s}}async function dr(t,e,s){const a=Ds(s.coAuthor),n=a?rr(s.commitMessage?.trim()??"",a):s.commitMessage?.trim()||void 0,o=await Xs(t,"CHANGE_REQUEST_MERGE",{...e,number:s.number,strategy:"squash",commitTitle:s.commitTitle,commitMessage:n});if(!o.merged)throw new cr(o.reason??"error",o.detail)}function uo(t,e){switch(t){case"conflict":return e("thread.mergeRefused.conflict");case"blocked":return e("thread.mergeRefused.blocked");case"rate_limited":return e("thread.mergeRefused.rateLimited");case"not_found":return e("thread.mergeRefused.notFound");default:return e("thread.mergeRefused.error")}}class Vs extends Error{constructor(){super("The branch changed since these changes were shown"),this.name="PublishHeadMovedError"}}class kn extends Error{constructor(e,s,a){super(e),this.step=s,this.pr=a,this.name="PublishStepError"}step;pr}const vs=255;function ur(t){if(t.length<=vs)return t;const e=t.slice(0,vs-1),s=e.lastIndexOf(" ");return`${(s>0?e.slice(0,s):e).trimEnd()}…`}function ho(t){const e=t.title.trim(),s=t.body.trim(),a=[e,s].filter(Boolean).join(`
5
+ ${n}`:n}function Bi(t,e){const s=t?.trim();return s?rr(s,e):s||void 0}function Mi(t){const{value:e,baseBranch:s,releases:a,baseIsDraft:n=!1}=t,o=!n&&!!e&&e===s,c=a.find(i=>i.branch===e);return{isBase:o,current:c,unlisted:!o&&!c&&!!e}}const Fi={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 a=Number.parseInt(s.slice(2),16);return!Number.isFinite(a)||a>Vn?e:String.fromCodePoint(a)}if(s.startsWith("#")){const a=Number.parseInt(s.slice(1),10);return!Number.isFinite(a)||a>Vn?e:String.fromCodePoint(a)}return Fi[s]??e}):""}function $i(t){const e=M.c(39),{url:s,onSave:a}=t,n=xe(),[o,c]=q.useState(s??"");let l;e[0]!==o?(l=o.trim(),e[0]=o,e[1]=l):l=e[1];const i=l;let u;e[2]!==a||e[3]!==i?(u=()=>a(i?Cl(i):null),e[2]=a,e[3]=i,e[4]=u):u=e[4];const d=u;let h;e[5]!==n?(h=n("thread.branchPicker.localHint"),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[7]=h,e[8]=f):f=e[8];let p;e[9]!==n?(p=n("thread.branchPicker.localUrlLabel"),e[9]=n,e[10]=p):p=e[10];let m;e[11]!==n?(m=n("thread.branchPicker.localUrlPlaceholder"),e[11]=n,e[12]=m):m=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=N=>c(N.target.value),e[13]=b):b=e[13];let g;e[14]!==d||e[15]!==i?(g=N=>{N.key==="Enter"&&i&&d()},e[14]=d,e[15]=i,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==m||e[19]!==g||e[20]!==o?(x=r.jsx("input",{type:"url",inputMode:"url","aria-label":p,placeholder:m,value:o,onChange:b,onKeyDown:g,className:"h-8 w-full rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[17]=p,e[18]=m,e[19]=g,e[20]=o,e[21]=x):x=e[21];let j;e[22]!==a||e[23]!==n||e[24]!==s?(j=s?r.jsx(ye,{variant:"ghost",size:"sm",className:"text-xs text-destructive hover:text-destructive",onClick:()=>a(null),children:n("thread.branchPicker.localTurnOff")}):r.jsx("span",{}),e[22]=a,e[23]=n,e[24]=s,e[25]=j):j=e[25];const y=!i;let v;e[26]!==n?(v=n("thread.branchPicker.save"),e[26]=n,e[27]=v):v=e[27];let P;e[28]!==d||e[29]!==y||e[30]!==v?(P=r.jsx(ye,{size:"sm",disabled:y,onClick:d,children:v}),e[28]=d,e[29]=y,e[30]=v,e[31]=P):P=e[31];let w;e[32]!==j||e[33]!==P?(w=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[j,P]}),e[32]=j,e[33]=P,e[34]=w):w=e[34];let k;return e[35]!==w||e[36]!==f||e[37]!==x?(k=r.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[f,x,w]}),e[35]=w,e[36]=f,e[37]=x,e[38]=k):k=e[38],k}function Ei(t){const e=M.c(8),{virtualMcpId:s,branch:a,serve:n,rowRef:o,onPicked:c}=t,l=qt(s,a),i=!!n.connection,u=i&&l.kind==="protocol"&&l.source==="local";let d;e[0]!==c||e[1]!==n?(d=()=>_i(n,c),e[0]=c,e[1]=n,e[2]=d):d=e[2];let h;return e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==d?(h=r.jsx(Oi,{rowRef:o,selected:i,connected:u,onSelect:d}),e[3]=o,e[4]=i,e[5]=u,e[6]=d,e[7]=h):h=e[7],h}function _i(t,e){e?.(),!t.connection&&t.set({endpoint:t.lastEndpoint??rl})}function Oi(t){const e=M.c(19),{rowRef:s,selected:a,connected:n,onSelect:o}=t,c=xe(),l=a?"bg-accent":"hover:bg-accent";let i;e[0]!==l?(i=X("flex rounded-lg",l),e[0]=l,e[1]=i):i=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("span",{"data-testid":"localhost-dot",className:"h-2 w-2 shrink-0 rounded-full bg-foreground"}),e[2]=u):u=e[2];let d;e[3]!==c?(d=c("thread.branchPicker.localhost.label"),e[3]=c,e[4]=d):d=e[4];let h;e[5]!==d?(h=r.jsx("span",{className:"min-w-0 flex-1 truncate",children:d}),e[5]=d,e[6]=h):h=e[6];let f;e[7]!==n||e[8]!==c?(f=n&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:c("thread.branchPicker.localhost.connected")}),e[7]=n,e[8]=c,e[9]=f):f=e[9];let p;e[10]!==o||e[11]!==a||e[12]!==h||e[13]!==f?(p=r.jsxs("button",{type:"button","aria-pressed":a,onClick:o,className:"flex w-full min-w-0 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[u,h,f]}),e[10]=o,e[11]=a,e[12]=h,e[13]=f,e[14]=p):p=e[14];let m;return e[15]!==s||e[16]!==i||e[17]!==p?(m=r.jsx("div",{ref:s,className:i,children:p}),e[15]=s,e[16]=i,e[17]=p,e[18]=m):m=e[18],m}const Li=10080*60*1e3;function Ui({sandboxMap:t,userId:e,rawBranches:s,now:a}){const n=new Map;for(const[h,f]of Object.entries(t??{}))for(const[p,m]of Object.entries(f??{})){let b=n.get(p);b||(b={userIds:new Set,lastActiveAt:0},n.set(p,b)),b.userIds.add(h);for(const g of Object.values(m??{})){const x=g?.createdAt??0;x>b.lastActiveAt&&(b.lastActiveAt=x)}}const o=a-Li,c=[...n.entries()].filter(([,h])=>h.lastActiveAt>=o).sort((h,f)=>f[1].lastActiveAt-h[1].lastActiveAt).map(([h,f])=>({name:h,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),l=new Set(c.map(h=>h.name)),i=new Set(Object.keys(t?.[e]??{})),u=[...i].filter(h=>!l.has(h)).sort().map(h=>({name:h,source:"yours"})),d=s.filter(h=>!i.has(h.name)&&!l.has(h.name)).map(h=>({name:h.name,source:"other",author:h.author??null}));return{recent:c,yours:u,others:d}}const qi=100,zi=50,Hi=300;function Ks(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function Ki(t){const e=M.c(39),{orgId:s,orgSlug:a,userId:n,target:o,sandboxMap:c,owner:l,repo:i,search:u,enabled:d}=t,h=u===void 0?"":u,f=d===void 0?!0:d;let p;e[0]!==h?(p=h.trim(),e[0]=h,e[1]=p):p=e[1];const m=p,b=Rl(m,Hi);let g;e[2]!==o?(g=La(o),e[2]=o,e[3]=g):g=e[3];const x=g,j=m.length>0;let y;e[4]!==b||e[5]!==s||e[6]!==a||e[7]!==l||e[8]!==i||e[9]!==o?(y=Et.githubBranchSearch(s,a,Ua(o),l,i,b),e[4]=b,e[5]=s,e[6]=a,e[7]=l,e[8]=i,e[9]=o,e[10]=y):y=e[10];const v=f&&x;let P;e[11]!==b||e[12]!==a||e[13]!==o?(P=J=>{const{pageParam:se}=J;return Xs(a,"REPOSITORY_SEARCH_BRANCHES",{...o,query:b,limit:b?zi:qi,cursor:se})},e[11]=b,e[12]=a,e[13]=o,e[14]=P):P=e[14];let w;e[15]!==b?(w=J=>b?void 0:J.nextCursor??void 0,e[15]=b,e[16]=w):w=e[16];let k;e[17]!==y||e[18]!==v||e[19]!==P||e[20]!==w?(k={queryKey:y,enabled:v,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:P,getNextPageParam:w},e[17]=y,e[18]=v,e[19]=P,e[20]=w,e[21]=k):k=e[21];const{data:N,isLoading:R,isError:C,isFetching:A,hasNextPage:S,isFetchingNextPage:E,fetchNextPage:F}=Il(k),I=j&&(b!==m||A),T=(N?.pages??[]).flatMap(Vi),D=Tl(6e4),Y=Ui({sandboxMap:c,userId:n,rawBranches:T,now:D});let ae;e[22]!==m?(ae=J=>Ks(J.name,m),e[22]=m,e[23]=ae):ae=e[23];const H=Y.recent.filter(ae);let _;e[24]!==m?(_=J=>Ks(J.name,m),e[24]=m,e[25]=_):_=e[25];const z=Y.yours.filter(_),ee=Y.others,Q=N?.pages[0],B=j&&Q&&!I?Math.max(0,Q.totalCount-Q.branches.length):0,ie=!j&&S;let U;e[26]!==F?(U=()=>{F()},e[26]=F,e[27]=U):U=e[27];let oe;return e[28]!==B||e[29]!==C||e[30]!==E||e[31]!==R||e[32]!==I||e[33]!==ee||e[34]!==H||e[35]!==ie||e[36]!==U||e[37]!==z?(oe={recent:H,yours:z,others:ee,isLoading:R,isError:C,isSearching:I,hiddenMatchCount:B,hasMore:ie,isFetchingMore:E,fetchMore:U},e[28]=B,e[29]=C,e[30]=E,e[31]=R,e[32]=I,e[33]=ee,e[34]=H,e[35]=ie,e[36]=U,e[37]=z,e[38]=oe):oe=e[38],oe}function Vi(t){return t.branches}function Gi(t){const e=M.c(239),{virtualMcpId:s,isV8:a,userLabel:n,value:o,baseBranch:c,baseIsDraft:l,orgId:i,orgSlug:u,userId:d,target:h,owner:f,repo:p,sandboxMap:m,onChange:b,onCreateBranch:g,onAdoptBranch:x,disabled:j,spawnsNewChat:y,placement:v}=t,P=a===void 0?!1:a,w=l===void 0?!1:l,k=j===void 0?!1:j,N=y===void 0?!1:y,R=v===void 0?"chat":v,C=xe(),A=R==="header",[S,E]=q.useState(!1),[F,I]=q.useState(!1),[T,D]=q.useState("branches"),[Y,ae]=q.useState(null),[H,_]=q.useState(""),[z,ee]=q.useState(null),Q=q.useRef(null),{releases:B,createRelease:ie,renameRelease:U,deleteRelease:oe}=hn(s),{url:J,setUrl:se,clear:$}=ka(s),te=Ca(s),re=P&&!!te.connection,he=P?te.connection?.endpoint??null:J,G=!!he;let pe;e[0]!==$||e[1]!==P||e[2]!==te?(pe=()=>{$(),P&&te.clear()},e[0]=$,e[1]=P,e[2]=te,e[3]=pe):pe=e[3];const Z=pe;let L;e[4]!==S?(L={enabled:S},e[4]=S,e[5]=L):L=e[5];const{data:K}=Lr(L);let ce;e[6]!==K?.data?.members?(ce=ue=>ue?K?.data?.members?.find(ut=>ut.userId===ue)?.user?.name??void 0:void 0,e[6]=K?.data?.members,e[7]=ce):ce=e[7];const je=ce,fe=B.length>=zn;let Ee;e[8]!==C?(Ee=C("thread.branchPicker.capReached",{max:zn}),e[8]=C,e[9]=Ee):Ee=e[9];const O=Ee;let ne,Le,_e,Ue,mt,st,we,De,Fe,Be,Pe,Me,Se,$e,nt,pt,Re,de,V,ve,ke,Ce,Ne,qe,at,bt,gt,We,Je;if(e[10]!==fe||e[11]!==c||e[12]!==w||e[13]!==O||e[14]!==Z||e[15]!==ie||e[16]!==oe||e[17]!==k||e[18]!==H||e[19]!==A||e[20]!==G||e[21]!==re||e[22]!==x||e[23]!==b||e[24]!==g||e[25]!==S||e[26]!==z||e[27]!==B||e[28]!==U||e[29]!==se||e[30]!==C||e[31]!==d||e[32]!==n||e[33]!==o){const{isBase:ue,current:ut,unlisted:Ht}=Mi({value:o,baseBranch:c,releases:B,baseIsDraft:w});Je=Ht;const W=ue?C("thread.branchPicker.live"):ut?.name??C("thread.branchPicker.defaultVersionName");Pe=re?C("thread.branchPicker.localhost.label"):G?C("thread.branchPicker.localLabel"):o?W:C("thread.branchPicker.selectVersion");const be=re?"bg-foreground":G?"bg-special":ue?"bg-success":_s(ut?.color??"orange");let me;e[63]!==Z||e[64]!==b?(me=le=>{Z(),b(le),E(!1)},e[63]=Z,e[64]=b,e[65]=me):me=e[65],Se=me;let Te;e[66]!==C?(Te=le=>{Oe.error(C("thread.branchPicker.saveError"),{description:dn(C,bs(le))})},e[66]=C,e[67]=Te):Te=e[67];const ge=Te;let At;e[68]!==se?(At=le=>{se(le),I(!1),E(!1)},e[68]=se,e[69]=At):At=e[69],st=At;let ts;e[70]!==fe||e[71]!==O||e[72]!==Z||e[73]!==ie||e[74]!==x||e[75]!==b||e[76]!==B||e[77]!==ge||e[78]!==d?(ts=(le,Ot)=>{if(Z(),x){x(le),I(!1),E(!1);return}if(!B.some($s=>$s.branch===le)){if(fe){Oe.error(O);return}ie({branch:le,name:Ot.trim()||le,color:Os(B.length),createdBy:d,createdAt:new Date().toISOString()}).catch(ge)}b(le),I(!1),E(!1)},e[70]=fe,e[71]=O,e[72]=Z,e[73]=ie,e[74]=x,e[75]=b,e[76]=B,e[77]=ge,e[78]=d,e[79]=ts):ts=e[79],we=ts;let ss;e[80]!==fe||e[81]!==O||e[82]!==Z||e[83]!==ie||e[84]!==b||e[85]!==g||e[86]!==B||e[87]!==ge||e[88]!==C||e[89]!==d||e[90]!==n?(ss=()=>{if(fe){Oe.error(O);return}Z();const le=fn(n);ie({branch:le,name:Un(B,C("thread.branchPicker.defaultVersionName")),color:Os(B.length),createdBy:d,createdAt:new Date().toISOString()}).catch(ge),(g??b)(le),E(!1)},e[80]=fe,e[81]=O,e[82]=Z,e[83]=ie,e[84]=b,e[85]=g,e[86]=B,e[87]=ge,e[88]=C,e[89]=d,e[90]=n,e[91]=ss):ss=e[91],Be=ss;let ns;e[92]===Symbol.for("react.memo_cache_sentinel")?(ns=()=>{ae(null),_(""),I(!1),D("branches")},e[92]=ns):ns=e[92];const Or=ns;let as;e[93]===Symbol.for("react.memo_cache_sentinel")?(as=le=>{D(le),I(!0)},e[93]=as):as=e[93],Me=as;let rs;e[94]===Symbol.for("react.memo_cache_sentinel")?(rs=le=>{ae(le.branch),_(le.name)},e[94]=rs):rs=e[94],pt=rs;let ls;e[95]!==H||e[96]!==U||e[97]!==ge?(ls=le=>{const Ot=H.trim();Ot&&U(le,Ot).catch(ge),ae(null),_("")},e[95]=H,e[96]=U,e[97]=ge,e[98]=ls):ls=e[98],$e=ls;let is;e[99]!==fe||e[100]!==O||e[101]!==ie||e[102]!==H||e[103]!==B.length||e[104]!==ge||e[105]!==d||e[106]!==o?(is=()=>{const le=H.trim();if(le&&o){if(fe){Oe.error(O),ae(null),_("");return}ie({branch:o,name:le,color:Os(B.length),createdBy:d,createdAt:new Date().toISOString()}).catch(ge)}ae(null),_("")},e[99]=fe,e[100]=O,e[101]=ie,e[102]=H,e[103]=B.length,e[104]=ge,e[105]=d,e[106]=o,e[107]=is):is=e[107],nt=is;let os;e[108]===Symbol.for("react.memo_cache_sentinel")?(os=()=>{ae(null),_("")},e[108]=os):os=e[108],De=os;let cs;e[109]!==c||e[110]!==oe||e[111]!==z||e[112]!==Se||e[113]!==B||e[114]!==ge||e[115]!==o?(cs=()=>{const le=z;if(ee(null),!!le){if(le.branch===o){const Ot=B.find($s=>$s.branch!==le.branch);Ot?Se(Ot.branch):c?Se(c):E(!1)}else E(!1);oe(le.branch).catch(ge)}},e[109]=c,e[110]=oe,e[111]=z,e[112]=Se,e[113]=B,e[114]=ge,e[115]=o,e[116]=cs):cs=e[116],Fe=cs,mt=gl,gt=S,e[117]!==k?(We=k?void 0:le=>{le||Or(),E(le)},e[117]=k,e[118]=We):We=e[118],Ue=kt,_e=Ct,bt=!0,at="inline-flex min-w-0 shrink",Le=xl,qe=!0,ne=ye,de=pl.branchPicker,V=A?"outline":"ghost",ve=A?"sm":"default",ke=Pe,Ce=k;const Fs=A?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[119]!==Fs?(Ne=X("shrink min-w-0 max-w-[220px] gap-2",Fs,Ta),e[119]=Fs,e[120]=Ne):Ne=e[120],Re=X("h-2 w-2 shrink-0 rounded-full",o||G?be:"bg-muted-foreground"),e[10]=fe,e[11]=c,e[12]=w,e[13]=O,e[14]=Z,e[15]=ie,e[16]=oe,e[17]=k,e[18]=H,e[19]=A,e[20]=G,e[21]=re,e[22]=x,e[23]=b,e[24]=g,e[25]=S,e[26]=z,e[27]=B,e[28]=U,e[29]=se,e[30]=C,e[31]=d,e[32]=n,e[33]=o,e[34]=ne,e[35]=Le,e[36]=_e,e[37]=Ue,e[38]=mt,e[39]=st,e[40]=we,e[41]=De,e[42]=Fe,e[43]=Be,e[44]=Pe,e[45]=Me,e[46]=Se,e[47]=$e,e[48]=nt,e[49]=pt,e[50]=Re,e[51]=de,e[52]=V,e[53]=ve,e[54]=ke,e[55]=Ce,e[56]=Ne,e[57]=qe,e[58]=at,e[59]=bt,e[60]=gt,e[61]=We,e[62]=Je}else ne=e[34],Le=e[35],_e=e[36],Ue=e[37],mt=e[38],st=e[39],we=e[40],De=e[41],Fe=e[42],Be=e[43],Pe=e[44],Me=e[45],Se=e[46],$e=e[47],nt=e[48],pt=e[49],Re=e[50],de=e[51],V=e[52],ve=e[53],ke=e[54],Ce=e[55],Ne=e[56],qe=e[57],at=e[58],bt=e[59],gt=e[60],We=e[61],Je=e[62];let Ae;e[121]!==Re?(Ae=r.jsx("span",{className:Re}),e[121]=Re,e[122]=Ae):Ae=e[122];let rt;e[123]!==Pe?(rt=r.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:Pe}),e[123]=Pe,e[124]=rt):rt=e[124];let lt;e[125]!==k?(lt=!k&&r.jsx(Ba,{size:12,className:"opacity-60 shrink-0"}),e[125]=k,e[126]=lt):lt=e[126];let xt;e[127]!==ne||e[128]!==de||e[129]!==V||e[130]!==ve||e[131]!==ke||e[132]!==Ce||e[133]!==Ne||e[134]!==Ae||e[135]!==rt||e[136]!==lt?(xt=r.jsxs(ne,{"data-tour":de,variant:V,size:ve,"aria-label":ke,disabled:Ce,className:Ne,children:[Ae,rt,lt]}),e[127]=ne,e[128]=de,e[129]=V,e[130]=ve,e[131]=ke,e[132]=Ce,e[133]=Ne,e[134]=Ae,e[135]=rt,e[136]=lt,e[137]=xt):xt=e[137];let It;e[138]!==Le||e[139]!==qe||e[140]!==xt?(It=r.jsx(Le,{asChild:qe,children:xt}),e[138]=Le,e[139]=qe,e[140]=xt,e[141]=It):It=e[141];let vt;e[142]!==at||e[143]!==It?(vt=r.jsx("span",{className:at,children:It}),e[142]=at,e[143]=It,e[144]=vt):vt=e[144];let Xe;e[145]!==_e||e[146]!==bt||e[147]!==vt?(Xe=r.jsx(_e,{asChild:bt,children:vt}),e[145]=_e,e[146]=bt,e[147]=vt,e[148]=Xe):Xe=e[148];let Ye;e[149]!==Pe?(Ye=r.jsx(Nt,{children:Pe}),e[149]=Pe,e[150]=Ye):Ye=e[150];let Ze;e[151]!==Ue||e[152]!==Xe||e[153]!==Ye?(Ze=r.jsxs(Ue,{children:[Xe,Ye]}),e[151]=Ue,e[152]=Xe,e[153]=Ye,e[154]=Ze):Ze=e[154];let Dt;e[155]===Symbol.for("react.memo_cache_sentinel")?(Dt=ue=>{ue.preventDefault(),Q.current?.scrollIntoView({block:"nearest"})},e[155]=Dt):Dt=e[155];let it;e[156]!==N||e[157]!==C?(it=N&&r.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:C("thread.branchPicker.newChatHint")}),e[156]=N,e[157]=C,e[158]=it):it=e[158];let yt;e[159]!==st||e[160]!==we||e[161]!==F||e[162]!==T||e[163]!==fe||e[164]!==De||e[165]!==O||e[166]!==Z||e[167]!==Be||e[168]!==je||e[169]!==H||e[170]!==Y||e[171]!==P||e[172]!==G||e[173]!==he||e[174]!==re||e[175]!==S||e[176]!==Me||e[177]!==i||e[178]!==u||e[179]!==f||e[180]!==Se||e[181]!==B||e[182]!==p||e[183]!==m||e[184]!==$e||e[185]!==nt||e[186]!==te||e[187]!==pt||e[188]!==C||e[189]!==h||e[190]!==J||e[191]!==Je||e[192]!==d||e[193]!==o||e[194]!==s?(yt=F?r.jsx(Wi,{orgId:i,orgSlug:u,userId:d,target:h,owner:f,repo:p,sandboxMap:m,enabled:S,tab:T,onTabChange:D,isV8:P,localUrl:J,onSaveLocal:st,onBack:()=>I(!1),onAdopt:we}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:X("always-scrollbar flex max-h-[min(50vh,20rem)] flex-col overflow-y-auto",P&&"gap-1"),children:[!P&&G&&he&&r.jsx(Qi,{rowRef:Q,url:he,onSelect:()=>Me("local"),onEdit:()=>Me("local"),onTurnOff:()=>Z()}),Je&&o&&(Y===o?r.jsx(Qn,{value:H,onChange:_,onSave:nt,onCancel:De}):r.jsx(Wn,{rowRef:G?void 0:Q,dot:_s("orange"),label:C("thread.branchPicker.defaultVersionName"),branch:o,selected:!G,onSelect:()=>Se(o),onRename:()=>{ae(o),_(Un(B,C("thread.branchPicker.defaultVersionName")))}})),B.map(ue=>Y===ue.branch?r.jsx(Qn,{value:H,onChange:_,onSave:()=>$e(ue.branch),onCancel:De},ue.branch):r.jsx(Wn,{rowRef:!G&&ue.branch===o?Q:void 0,dot:_s(ue.color),label:ue.name,creator:je(ue.createdBy),branch:ue.branch,selected:!G&&ue.branch===o,onSelect:()=>Se(ue.branch),onRename:()=>pt(ue),onDelete:()=>ee(ue)},ue.branch)),P&&r.jsx(Ei,{virtualMcpId:s,branch:o,serve:te,rowRef:re?Q:void 0,onPicked:()=>E(!1)})]}),(Je||B.length>0||P)&&r.jsx("div",{className:"my-1 border-t"}),r.jsxs("button",{type:"button",onClick:()=>{Be()},disabled:fe,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:[r.jsx(Oa,{className:"h-4 w-4 shrink-0"}),C("thread.branchPicker.newVersion")]}),fe&&r.jsx("p",{className:"px-2 pb-1 pt-0.5 text-xs text-warning",children:O}),r.jsxs("button",{type:"button",onClick:()=>Me("branches"),className:X("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:[C("thread.branchPicker.advanced"),r.jsx(ua,{className:"h-4 w-4 shrink-0"})]})]}),e[159]=st,e[160]=we,e[161]=F,e[162]=T,e[163]=fe,e[164]=De,e[165]=O,e[166]=Z,e[167]=Be,e[168]=je,e[169]=H,e[170]=Y,e[171]=P,e[172]=G,e[173]=he,e[174]=re,e[175]=S,e[176]=Me,e[177]=i,e[178]=u,e[179]=f,e[180]=Se,e[181]=B,e[182]=p,e[183]=m,e[184]=$e,e[185]=nt,e[186]=te,e[187]=pt,e[188]=C,e[189]=h,e[190]=J,e[191]=Je,e[192]=d,e[193]=o,e[194]=s,e[195]=yt):yt=e[195];let ot;e[196]!==it||e[197]!==yt?(ot=r.jsxs(vl,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:Dt,children:[it,yt]}),e[196]=it,e[197]=yt,e[198]=ot):ot=e[198];let Bt;e[199]!==mt||e[200]!==gt||e[201]!==We||e[202]!==Ze||e[203]!==ot?(Bt=r.jsxs(mt,{open:gt,onOpenChange:We,children:[Ze,ot]}),e[199]=mt,e[200]=gt,e[201]=We,e[202]=Ze,e[203]=ot,e[204]=Bt):Bt=e[204];const Mt=Bt,_t=z!==null;let Ft;e[205]===Symbol.for("react.memo_cache_sentinel")?(Ft=ue=>{ue||ee(null)},e[205]=Ft):Ft=e[205];let et;e[206]!==C?(et=C("thread.branchPicker.deleteTitle"),e[206]=C,e[207]=et):et=e[207];let wt;e[208]!==et?(wt=r.jsx(Ys,{children:et}),e[208]=et,e[209]=wt):wt=e[209];let ct;e[210]!==z||e[211]!==C?(ct=z&&C("thread.branchPicker.deleteConfirm",{name:z.name}),e[210]=z,e[211]=C,e[212]=ct):ct=e[212];let Pt;e[213]!==ct?(Pt=r.jsx(Zs,{children:ct}),e[213]=ct,e[214]=Pt):Pt=e[214];let jt;e[215]!==wt||e[216]!==Pt?(jt=r.jsxs(en,{children:[wt,Pt]}),e[215]=wt,e[216]=Pt,e[217]=jt):jt=e[217];let St;e[218]!==C?(St=C("thread.branchPicker.cancel"),e[218]=C,e[219]=St):St=e[219];let ze;e[220]!==St?(ze=r.jsx(tn,{children:St}),e[220]=St,e[221]=ze):ze=e[221];let He;e[222]!==C?(He=C("thread.branchPicker.delete"),e[222]=C,e[223]=He):He=e[223];let Ke;e[224]!==Fe||e[225]!==He?(Ke=r.jsx(sn,{onClick:Fe,variant:"destructive",children:He}),e[224]=Fe,e[225]=He,e[226]=Ke):Ke=e[226];let Ve;e[227]!==ze||e[228]!==Ke?(Ve=r.jsxs(nn,{children:[ze,Ke]}),e[227]=ze,e[228]=Ke,e[229]=Ve):Ve=e[229];let Ge;e[230]!==jt||e[231]!==Ve?(Ge=r.jsxs(an,{children:[jt,Ve]}),e[230]=jt,e[231]=Ve,e[232]=Ge):Ge=e[232];let Qe;e[233]!==_t||e[234]!==Ge?(Qe=r.jsx(rn,{open:_t,onOpenChange:Ft,children:Ge}),e[233]=_t,e[234]=Ge,e[235]=Qe):Qe=e[235];let dt;return e[236]!==Mt||e[237]!==Qe?(dt=r.jsxs(r.Fragment,{children:[Mt,Qe]}),e[236]=Mt,e[237]=Qe,e[238]=dt):dt=e[238],dt}function Qn(t){const e=M.c(20),{value:s,onChange:a,onSave:n,onCancel:o}=t,c=xe();let l;e[0]!==c?(l=c("thread.branchPicker.rename"),e[0]=c,e[1]=l):l=e[1];let i;e[2]!==a?(i=m=>a(m.target.value),e[2]=a,e[3]=i):i=e[3];let u;e[4]!==o||e[5]!==n?(u=m=>{m.key==="Enter"&&n(),m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),o())},e[4]=o,e[5]=n,e[6]=u):u=e[6];let d;e[7]!==l||e[8]!==i||e[9]!==u||e[10]!==s?(d=r.jsx("input",{autoFocus:!0,"aria-label":l,value:s,onChange:i,onKeyDown:u,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm focus-ring"}),e[7]=l,e[8]=i,e[9]=u,e[10]=s,e[11]=d):d=e[11];let h;e[12]!==c?(h=c("thread.branchPicker.save"),e[12]=c,e[13]=h):h=e[13];let f;e[14]!==n||e[15]!==h?(f=r.jsx(ye,{size:"sm",onClick:n,children:h}),e[14]=n,e[15]=h,e[16]=f):f=e[16];let p;return e[17]!==d||e[18]!==f?(p=r.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[d,f]}),e[17]=d,e[18]=f,e[19]=p):p=e[19],p}function Wn(t){const e=M.c(49),{rowRef:s,dot:a,label:n,creator:o,branch:c,selected:l,onSelect:i,onRename:u,onDelete:d}=t,h=xe(),f=l?"bg-accent":"hover:bg-accent";let p;e[0]!==f?(p=X("group flex items-center rounded-lg",f),e[0]=f,e[1]=p):p=e[1];let m;e[2]!==a?(m=X("h-2 w-2 shrink-0 rounded-full",a),e[2]=a,e[3]=m):m=e[3];let b;e[4]!==m?(b=r.jsx("span",{className:m}),e[4]=m,e[5]=b):b=e[5];let g;e[6]!==o?(g=o&&r.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:o}),e[6]=o,e[7]=g):g=e[7];let x;e[8]!==n||e[9]!==g?(x=r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[n,g]}),e[8]=n,e[9]=g,e[10]=x):x=e[10];let j;e[11]!==i||e[12]!==l||e[13]!==b||e[14]!==x?(j=r.jsx(Ct,{asChild:!0,children:r.jsxs("button",{type:"button","aria-pressed":l,onClick:i,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[b,x]})}),e[11]=i,e[12]=l,e[13]=b,e[14]=x,e[15]=j):j=e[15];let y;e[16]!==c||e[17]!==h?(y=h("thread.branchPicker.branchTooltip",{branch:c}),e[16]=c,e[17]=h,e[18]=y):y=e[18];let v;e[19]!==y?(v=r.jsx(Nt,{side:"bottom",className:"font-mono text-xs",children:y}),e[19]=y,e[20]=v):v=e[20];let P;e[21]!==j||e[22]!==v?(P=r.jsxs(kt,{children:[j,v]}),e[21]=j,e[22]=v,e[23]=P):P=e[23];let w;e[24]!==h?(w=h("thread.branchPicker.moreActions"),e[24]=h,e[25]=w):w=e[25];let k;e[26]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Ea,{className:"h-4 w-4"}),e[26]=k):k=e[26];let N;e[27]!==w?(N=r.jsx(Ps,{asChild:!0,children:r.jsx(ye,{variant:"ghost",size:"icon","aria-label":w,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:k})}),e[27]=w,e[28]=N):N=e[28];let R;e[29]===Symbol.for("react.memo_cache_sentinel")?(R=r.jsx(_a,{className:"h-4 w-4"}),e[29]=R):R=e[29];let C;e[30]!==h?(C=h("thread.branchPicker.rename"),e[30]=h,e[31]=C):C=e[31];let A;e[32]!==u||e[33]!==C?(A=r.jsxs(Gt,{onSelect:u,children:[R,C]}),e[32]=u,e[33]=C,e[34]=A):A=e[34];let S;e[35]!==d||e[36]!==h?(S=d&&r.jsxs(Gt,{onSelect:d,className:"text-destructive focus:text-destructive",children:[r.jsx(Ts,{className:"h-4 w-4"}),h("thread.branchPicker.delete")]}),e[35]=d,e[36]=h,e[37]=S):S=e[37];let E;e[38]!==A||e[39]!==S?(E=r.jsxs(js,{align:"end",children:[A,S]}),e[38]=A,e[39]=S,e[40]=E):E=e[40];let F;e[41]!==N||e[42]!==E?(F=r.jsxs(Ss,{children:[N,E]}),e[41]=N,e[42]=E,e[43]=F):F=e[43];let I;return e[44]!==s||e[45]!==P||e[46]!==F||e[47]!==p?(I=r.jsxs("div",{ref:s,className:p,children:[P,F]}),e[44]=s,e[45]=P,e[46]=F,e[47]=p,e[48]=I):I=e[48],I}function Qi(t){const e=M.c(40),{rowRef:s,url:a,onSelect:n,onEdit:o,onTurnOff:c}=t,l=xe();let i;try{let A;e[0]!==a?(A=new URL(a),e[0]=a,e[1]=A):A=e[1],i=A.host}catch{i=a}const u=i;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-special"}),e[2]=d):d=e[2];let h;e[3]!==l?(h=l("thread.branchPicker.localLabel"),e[3]=l,e[4]=h):h=e[4];let f;e[5]!==u?(f=r.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:u}),e[5]=u,e[6]=f):f=e[6];let p;e[7]!==h||e[8]!==f?(p=r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[h,f]}),e[7]=h,e[8]=f,e[9]=p):p=e[9];let m;e[10]!==n||e[11]!==p?(m=r.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:[d,p]}),e[10]=n,e[11]=p,e[12]=m):m=e[12];let b;e[13]!==l?(b=l("thread.branchPicker.moreActions"),e[13]=l,e[14]=b):b=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(Ea,{className:"h-4 w-4"}),e[15]=g):g=e[15];let x;e[16]!==b?(x=r.jsx(Ps,{asChild:!0,children:r.jsx(ye,{variant:"ghost",size:"icon","aria-label":b,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:g})}),e[16]=b,e[17]=x):x=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(_a,{className:"h-4 w-4"}),e[18]=j):j=e[18];let y;e[19]!==l?(y=l("thread.branchPicker.rename"),e[19]=l,e[20]=y):y=e[20];let v;e[21]!==o||e[22]!==y?(v=r.jsxs(Gt,{onSelect:o,children:[j,y]}),e[21]=o,e[22]=y,e[23]=v):v=e[23];let P;e[24]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(Ts,{className:"h-4 w-4"}),e[24]=P):P=e[24];let w;e[25]!==l?(w=l("thread.branchPicker.localTurnOff"),e[25]=l,e[26]=w):w=e[26];let k;e[27]!==c||e[28]!==w?(k=r.jsxs(Gt,{onSelect:c,className:"text-destructive focus:text-destructive",children:[P,w]}),e[27]=c,e[28]=w,e[29]=k):k=e[29];let N;e[30]!==v||e[31]!==k?(N=r.jsxs(js,{align:"end",children:[v,k]}),e[30]=v,e[31]=k,e[32]=N):N=e[32];let R;e[33]!==N||e[34]!==x?(R=r.jsxs(Ss,{children:[x,N]}),e[33]=N,e[34]=x,e[35]=R):R=e[35];let C;return e[36]!==s||e[37]!==R||e[38]!==m?(C=r.jsxs("div",{ref:s,className:"group flex items-center rounded-lg bg-accent",children:[m,R]}),e[36]=s,e[37]=R,e[38]=m,e[39]=C):C=e[39],C}function Wi(t){const e=M.c(73),{orgId:s,orgSlug:a,userId:n,target:o,owner:c,repo:l,sandboxMap:i,enabled:u,tab:d,onTabChange:h,isV8:f,localUrl:p,onSaveLocal:m,onBack:b,onAdopt:g}=t,x=xe(),[j,y]=q.useState(""),v=d==="branches"?j:"",P=u&&d==="branches";let w;e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==i||e[5]!==v||e[6]!==P||e[7]!==o||e[8]!==n?(w={orgId:s,orgSlug:a,userId:n,target:o,sandboxMap:i,owner:c,repo:l,search:v,enabled:P},e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=i,e[5]=v,e[6]=P,e[7]=o,e[8]=n,e[9]=w):w=e[9];const{recent:k,yours:N,others:R,isLoading:C,hasMore:A,isFetchingMore:S,fetchMore:E}=Ki(w),F=u&&d==="prs";let I;e[10]!==s||e[11]!==a||e[12]!==c||e[13]!==l||e[14]!==F||e[15]!==o?(I={orgId:s,orgSlug:a,target:o,owner:c,repo:l,enabled:F},e[10]=s,e[11]=a,e[12]=c,e[13]=l,e[14]=F,e[15]=o,e[16]=I):I=e[16];const{data:T,isLoading:D}=Dl(I);let Y;if(e[17]!==E||e[18]!==A||e[19]!==S||e[20]!==C||e[21]!==f||e[22]!==p||e[23]!==g||e[24]!==b||e[25]!==m||e[26]!==h||e[27]!==R||e[28]!==c||e[29]!==D||e[30]!==k||e[31]!==l||e[32]!==j||e[33]!==x||e[34]!==T||e[35]!==d||e[36]!==N){const ae=T===void 0?[]:T,H=`${c}/${l}`;let _;e[38]!==H?(_=H.toLowerCase(),e[38]=H,e[39]=_):_=e[39];const z=_;let ee;e[40]!==z?(ee=L=>L.headRepoFullName?.toLowerCase()===z,e[40]=z,e[41]=ee):ee=e[41];const Q=ae.filter(ee);let B;if(e[42]!==R||e[43]!==k||e[44]!==N){const L=new Set;B=[...k,...N,...R].filter(K=>L.has(K.name)?!1:(L.add(K.name),!0)),e[42]=R,e[43]=k,e[44]=N,e[45]=B}else B=e[45];const ie=B;let U;e[46]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(jl,{className:"h-4 w-4 shrink-0"}),e[46]=U):U=e[46];let oe;e[47]!==x?(oe=x("thread.branchPicker.advancedBack"),e[47]=x,e[48]=oe):oe=e[48];let J;e[49]!==b||e[50]!==oe?(J=r.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[U,oe]}),e[49]=b,e[50]=oe,e[51]=J):J=e[51];let se;e[52]!==h?(se=L=>{h(L),y("")},e[52]=h,e[53]=se):se=e[53];let $;e[54]!==x?($=x("thread.branchPicker.branchesTab"),e[54]=x,e[55]=$):$=e[55];let te;e[56]!==$?(te=r.jsx(Lt,{value:"branches",className:"h-6 px-2.5 text-xs",children:$}),e[56]=$,e[57]=te):te=e[57];let re;e[58]!==x?(re=x("thread.branchPicker.prsTab"),e[58]=x,e[59]=re):re=e[59];let he;e[60]!==re?(he=r.jsx(Lt,{value:"prs",className:"h-6 px-2.5 text-xs",children:re}),e[60]=re,e[61]=he):he=e[61];let G;e[62]!==f||e[63]!==x?(G=!f&&r.jsx(Lt,{value:"local",className:"h-6 px-2.5 text-xs",children:x("thread.branchPicker.localTab")}),e[62]=f,e[63]=x,e[64]=G):G=e[64];let pe;e[65]!==te||e[66]!==he||e[67]!==G?(pe=r.jsxs(Ia,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[te,he,G]}),e[65]=te,e[66]=he,e[67]=G,e[68]=pe):pe=e[68];let Z;e[69]!==se||e[70]!==pe||e[71]!==d?(Z=r.jsx(Da,{className:"px-2 pt-2 pb-1",value:d,onValueChange:se,children:pe}),e[69]=se,e[70]=pe,e[71]=d,e[72]=Z):Z=e[72],Y=r.jsxs("div",{className:"flex flex-col",children:[J,Z,d==="local"&&!f?r.jsx($i,{url:p,onSave:m}):r.jsxs(yl,{filter:d==="branches"?Ji:void 0,children:[r.jsx(wl,{placeholder:x(d==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),value:j,onValueChange:y}),r.jsx(Pl,{onScroll:L=>{const K=L.currentTarget;d==="branches"&&K.scrollHeight-K.scrollTop-K.clientHeight<48&&E()},children:d==="branches"?r.jsxs(r.Fragment,{children:[C&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:x("thread.branchPicker.loadingMore")}),!C&&ie.length===0&&r.jsx(_n,{children:x("thread.branchPicker.noBranchesFound")}),ie.length>0&&r.jsx(On,{children:ie.map(L=>r.jsxs(Ln,{value:L.name,className:"cursor-pointer",onSelect:()=>g(L.name,L.name),children:[r.jsx(Ur,{className:"mr-2 h-4 w-4 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:L.name})]},L.name))}),A&&r.jsx("div",{className:"p-2",children:r.jsx(ye,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:S,onClick:E,children:x(S?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):r.jsxs(r.Fragment,{children:[D&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:x("thread.branchPicker.loadingPullRequests")}),!D&&Q.length===0&&r.jsx(_n,{children:x("thread.branchPicker.noOpenPullRequests")}),Q.length>0&&r.jsx(On,{children:Q.map(L=>r.jsxs(Ln,{value:`#${L.number} ${L.title} ${L.head}`,className:"cursor-pointer",onSelect:()=>g(L.head,Gn(L.title)),children:[r.jsx(Rs,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate",children:Gn(L.title)}),r.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",L.number," · ",L.head]})]})]},L.number))})]})})]})]}),e[17]=E,e[18]=A,e[19]=S,e[20]=C,e[21]=f,e[22]=p,e[23]=g,e[24]=b,e[25]=m,e[26]=h,e[27]=R,e[28]=c,e[29]=D,e[30]=k,e[31]=l,e[32]=j,e[33]=x,e[34]=T,e[35]=d,e[36]=N,e[37]=Y}else Y=e[37];return Y}function Ji(t,e){return Ks(t,e)?1:0}function Xi(t){const e=M.c(19),{locked:s,placement:a,value:n,virtualMcpId:o,isV8:c,userLabel:l,baseBranch:i,baseIsDraft:u,onChange:d,onCreateBranch:h,onAdoptBranch:f,orgId:p,orgSlug:m,userId:b,target:g,owner:x,repo:j,sandboxMap:y}=t;let v;return e[0]!==i||e[1]!==u||e[2]!==c||e[3]!==s||e[4]!==f||e[5]!==d||e[6]!==h||e[7]!==p||e[8]!==m||e[9]!==x||e[10]!==a||e[11]!==j||e[12]!==y||e[13]!==g||e[14]!==b||e[15]!==l||e[16]!==n||e[17]!==o?(v=r.jsx(Gi,{virtualMcpId:o,isV8:c,userLabel:l,value:n,baseBranch:i,baseIsDraft:u,orgId:p,orgSlug:m,userId:b,target:g,owner:x,repo:j,sandboxMap:y,onChange:d,onCreateBranch:h,onAdoptBranch:f,spawnsNewChat:s,placement:a}),e[0]=i,e[1]=u,e[2]=c,e[3]=s,e[4]=f,e[5]=d,e[6]=h,e[7]=p,e[8]=m,e[9]=x,e[10]=a,e[11]=j,e[12]=y,e[13]=g,e[14]=b,e[15]=l,e[16]=n,e[17]=o,e[18]=v):v=e[18],v}function Yi(t){const e=M.c(2),{branchPill:s}=t;if(!s)return null;let a;return e[0]!==s?(a=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=a):a=e[1],a}function Zi(t){const e=M.c(25),{virtualMcp:s,currentBranch:a}=t,n=nl(),o=Zt();let c;e[0]!==n?.messages||e[1]!==o?.isThreadLocked?(c=(n?.messages??[]).length>0||(o?.isThreadLocked??!1),e[0]=n?.messages,e[1]=o?.isThreadLocked,e[2]=c):c=e[2];const l=c,i=o?.setCurrentTaskBranch,u=o?.createTask;let d;e[3]!==o?.activeTask?.metadata||e[4]!==s?.metadata?(d=Nl(s?.metadata)==="cms"&&qn(o?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=o?.activeTask?.metadata,e[4]=s?.metadata,e[5]=d):d=e[5];const h=d,f=Al(s),p=tt(f),{data:m}=ks.useSession(),b=m?.user;let g;e[6]!==b?(g=mn(b),e[6]=b,e[7]=g):g=e[7];const x=g,j=m?.user?.id??"",{org:y}=Cs(),v=Bl(s,a),P=Va(s?.id);let w;e[8]!==P||e[9]!==o?.activeTask?.metadata||e[10]!==s?.metadata?(w=P==="v8"&&qn(o?.activeTask?.metadata,s?.metadata)==="cms",e[8]=P,e[9]=o?.activeTask?.metadata,e[10]=s?.metadata,e[11]=w):w=e[11];const k=w;let N;e[12]!==u||e[13]!==l||e[14]!==i?(N=T=>{l&&u?u({branch:T}):i&&i(T)},e[12]=u,e[13]=l,e[14]=i,e[15]=N):N=e[15];const R=N;let C;e[16]!==h||e[17]!==u||e[18]!==l||e[19]!==i?(C=T=>{(l||h)&&u?u({branch:T}):i&&i(T)},e[16]=h,e[17]=u,e[18]=l,e[19]=i,e[20]=C):C=e[20];const A=C;let S;e[21]!==u?(S=u?T=>u({runtime:"sandbox",branch:T}):void 0,e[21]=u,e[22]=S):S=e[22];const E=S,F=f&&La(p)?r.jsx(Xi,{userLabel:x,virtualMcpId:s?.id??"",isV8:P==="v8",value:a,baseBranch:v,baseIsDraft:k,orgId:y.id,orgSlug:y.slug,userId:j,target:p,owner:f.owner,repo:f.name,sandboxMap:s?.metadata?.sandboxMap,onChange:R,onCreateBranch:A,onAdoptBranch:E,locked:l,placement:"chat"},`${Ua(p)}:${f.owner}/${f.name}`):null;let I;return e[23]!==F?(I=r.jsx(Yi,{branchPill:F}),e[23]=F,e[24]=I):I=e[24],I}const eo=qr("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 to(t){const e=M.c(11);let s,a,n;e[0]!==t?({className:s,orientation:a,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n):(s=e[1],a=e[2],n=e[3]);let o;e[4]!==s||e[5]!==a?(o=X(eo({orientation:a}),s),e[4]=s,e[5]=a,e[6]=o):o=e[6];let c;return e[7]!==a||e[8]!==n||e[9]!==o?(c=r.jsx("div",{role:"group","data-slot":"button-group","data-orientation":a,className:o,...n}),e[7]=a,e[8]=n,e[9]=o,e[10]=c):c=e[10],c}function so(t){const e=M.c(14),{item:s}=t;let a;e[0]!==s?(a=()=>{s.onSelect()},e[0]=s,e[1]=a):a=e[1];let n;e[2]!==s.disabled||e[3]!==s.icon||e[4]!==s.label||e[5]!==a?(n=r.jsxs(Gt,{disabled:s.disabled,onSelect:a,children:[s.icon,s.label]}),e[2]=s.disabled,e[3]=s.icon,e[4]=s.label,e[5]=a,e[6]=n):n=e[6];const o=n;if(!s.tooltip)return o;let c;e[7]!==o?(c=r.jsx(Ct,{asChild:!0,children:o}),e[7]=o,e[8]=c):c=e[8];let l;e[9]!==s.tooltip?(l=r.jsx(Nt,{side:"right",children:s.tooltip}),e[9]=s.tooltip,e[10]=l):l=e[10];let i;return e[11]!==c||e[12]!==l?(i=r.jsxs(kt,{children:[c,l]}),e[11]=c,e[12]=l,e[13]=i):i=e[13],i}function lr(t){const e=M.c(20),{label:s,onClick:a,variant:n,size:o,disabled:c,loading:l,pulse:i,tooltip:u,icon:d,items:h,menuAriaLabel:f,className:p}=t,m=n===void 0?"default":n,b=o===void 0?"default":o,g=c===void 0?!1:c,x=l===void 0?!1:l,j=i===void 0?!1:i,y=(h?.length??0)>0;let v;if(e[0]!==p||e[1]!==g||e[2]!==y||e[3]!==d||e[4]!==h||e[5]!==s||e[6]!==x||e[7]!==f||e[8]!==a||e[9]!==j||e[10]!==b||e[11]!==u||e[12]!==m){const P=X(Ta,m==="default"&&"focus-visible:inset-ring-current");let w;e[14]!==d||e[15]!==x?(w=x?r.jsx(Qt,{size:"xs"}):d,e[14]=d,e[15]=x,e[16]=w):w=e[16];const k=r.jsxs(ye,{type:"button",variant:m,size:b,disabled:g,"aria-busy":x||void 0,onClick:x?void 0:a,className:X(P,y&&"rounded-r-none border-r border-current/20"),children:[w,s]}),N=j&&"animate-pulse-brightness motion-reduce:animate-none motion-reduce:opacity-80";let R;e[17]!==p||e[18]!==N?(R=X(N,p),e[17]=p,e[18]=N,e[19]=R):R=e[19],v=r.jsxs(to,{className:R,children:[u?r.jsxs(kt,{children:[r.jsx(Ct,{asChild:!0,children:r.jsx("span",{className:X("inline-flex rounded-lg outline-none",P,g&&"cursor-not-allowed"),tabIndex:g?0:void 0,role:g?"button":void 0,"aria-disabled":g||void 0,children:k})}),r.jsx(Nt,{children:u})]}):k,y?r.jsxs(Ss,{children:[r.jsx(Ps,{asChild:!0,children:r.jsx(ye,{type:"button",variant:m,size:b,"aria-label":f,className:X("has-[>svg]:px-2",P),children:r.jsx(Ba,{className:"size-3.5"})})}),r.jsx(js,{align:"end",children:h?.map(no)})]}):null]}),e[0]=p,e[1]=g,e[2]=y,e[3]=d,e[4]=h,e[5]=s,e[6]=x,e[7]=f,e[8]=a,e[9]=j,e[10]=b,e[11]=u,e[12]=m,e[13]=v}else v=e[13];return v}function no(t){return r.jsx(so,{item:t},t.key)}async function ao(t){if(t.hosted)return;const e=t.branch;await t.setCurrentTaskBranch(t.nextBranch()),e&&e!==t.baseBranch&&await t.deleteRelease(e)}function ro(t,e,{hosted:s}){return s&&t!==null?t:e}function lo(t,e){const s=M.c(11),[a,n]=q.useState(null);let o;s[0]!==a||s[1]!==t||s[2]!==e?(o=ro(a,t,e),s[0]=a,s[1]=t,s[2]=e,s[3]=o):o=s[3];let c;s[4]!==t||s[5]!==e?(c=()=>n(e.hosted?t:null),s[4]=t,s[5]=e,s[6]=c):c=s[6];let l;s[7]===Symbol.for("react.memo_cache_sentinel")?(l=()=>n(null),s[7]=l):l=s[7];let i;return s[8]!==o||s[9]!==c?(i={shown:o,hold:c,release:l},s[8]=o,s[9]=c,s[10]=i):i=s[10],i}function io({open:t,hosted:e}){return t||e}function ir(t){return Ds({userName:t?.name,userEmail:t?.email})??void 0}function Bs(t){const e=M.c(18),{state:s,header:a,body:n,note:o,gate:c,footer:l}=t,i=s!=="ready";let u;e[0]!==a?(u=r.jsx("div",{className:"space-y-0.5 px-4 py-3",children:a}),e[0]=a,e[1]=u):u=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"border-t"}),e[2]=d):d=e[2];let h;e[3]!==o?(h=o?r.jsx("div",{className:"space-y-1.5 border-t px-4 py-3",children:o}):null,e[3]=o,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==h?(f=r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n,h]}),e[5]=n,e[6]=h,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("div",{className:"border-t"}),e[8]=p):p=e[8];let m;e[9]!==l?(m=r.jsx("div",{className:"space-y-2 px-4 py-3",children:l}),e[9]=l,e[10]=m):m=e[10];let b;return e[11]!==c||e[12]!==s||e[13]!==i||e[14]!==u||e[15]!==f||e[16]!==m?(b=r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-publish-state":s,"aria-busy":i,children:[u,d,f,c,p,m]}),e[11]=c,e[12]=s,e[13]=i,e[14]=u,e[15]=f,e[16]=m,e[17]=b):b=e[17],b}function Yt(t){const e=M.c(2),{children:s}=t;let a;return e[0]!==s?(a=r.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]=a):a=e[1],a}function or(t){const e=M.c(10);let s,a,n;e[0]!==t?({className:a,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n):(s=e[1],a=e[2],n=e[3]);let o;e[4]!==a?(o=X("rounded-lg border bg-card px-3 py-2.5",a),e[4]=a,e[5]=o):o=e[5];let c;return e[6]!==s||e[7]!==n||e[8]!==o?(c=r.jsx("div",{className:o,...n,children:s}),e[6]=s,e[7]=n,e[8]=o,e[9]=c):c=e[9],c}function ft(t){const e=M.c(4),{className:s}=t;let a;e[0]!==s?(a=X("animate-pulse rounded bg-muted motion-reduce:animate-none",s),e[0]=s,e[1]=a):a=e[1];let n;return e[2]!==a?(n=r.jsx("div",{className:a}),e[2]=a,e[3]=n):n=e[3],n}function Ut(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(or,{children:r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx(ft,{className:"size-4 rounded-md"}),r.jsx(ft,{className:"h-3 w-24"}),r.jsx(ft,{className:"h-2.5 w-16"}),r.jsx(ft,{className:"ml-auto size-6 rounded"})]})}),t[0]=e):e=t[0],e}const oo="secret";async function co(t,e,s){const a=Ds(s.coAuthor),{changeRequest:n}=await Xs(t,"CHANGE_REQUEST_OPEN",{...e,head:s.branch,base:s.base,title:s.title,body:Bi(s.body,a)||void 0});return{number:n.number,htmlUrl:n.url}}class cr extends Error{reason;detail;constructor(e,s){super(s||`Merge refused: ${e}`),this.name="ChangeRequestMergeRefused",this.reason=e,this.detail=s}}async function dr(t,e,s){const a=Ds(s.coAuthor),n=a?rr(s.commitMessage?.trim()??"",a):s.commitMessage?.trim()||void 0,o=await Xs(t,"CHANGE_REQUEST_MERGE",{...e,number:s.number,strategy:"squash",commitTitle:s.commitTitle,commitMessage:n});if(!o.merged)throw new cr(o.reason??"error",o.detail)}function uo(t,e){switch(t){case"conflict":return e("thread.mergeRefused.conflict");case"blocked":return e("thread.mergeRefused.blocked");case"rate_limited":return e("thread.mergeRefused.rateLimited");case"not_found":return e("thread.mergeRefused.notFound");default:return e("thread.mergeRefused.error")}}class Vs extends Error{constructor(){super("The branch changed since these changes were shown"),this.name="PublishHeadMovedError"}}class kn extends Error{constructor(e,s,a){super(e),this.step=s,this.pr=a,this.name="PublishStepError"}step;pr}const vs=255;function ur(t){if(t.length<=vs)return t;const e=t.slice(0,vs-1),s=e.lastIndexOf(" ");return`${(s>0?e.slice(0,s):e).trimEnd()}…`}function ho(t){const e=t.title.trim(),s=t.body.trim(),a=[e,s].filter(Boolean).join(`
6
6
 
7
7
  `);if(e.length>vs)return{title:ur(e),body:a,message:a};const n=e||t.fallbackTitle;return{title:n,body:s||void 0,message:a||n}}function fo(t,e){const s=t.trim().split(`
8
8
  `);return ho({title:s[0]??"",body:s.slice(1).join(`
9
- `),fallbackTitle:e})}function ys(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function mo(t){return t.fastPreview?{fastPreview:!0}:void 0}async function Us(t,e,s){try{return await s()}catch(a){throw new kn(a instanceof Error?a.message:e,t)}}async function hr(t){const{expectedHeadSha:e,expectedDiffSignature:s}=t;if(!e&&!s)return;const a=await yn(ys(t)).catch(()=>null);if(!a)return;if(e&&a.headSha&&a.headSha!==e)throw new Vs;if(!s)return;const n=await Ja(ys(t),a,t.baseBranch,mo(t)).catch(()=>null);if(n&&Is(n)!==s)throw new Vs}function fr(t,e){return oi(ys(t),e)}function mr(t,e){return co(t.orgSlug,t.target,{branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor})}async function po(t,e,s){await hr(t),await Us("push",s("thread.publishDialog.failedPushChanges"),()=>fr(t,e.message)),await Us("sync",s("thread.publishDialog.failedRebase"),()=>Xa(ys(t),t.baseBranch));const a=await Us("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>mr(t,e));try{await dr(t.orgSlug,t.target,{number:a.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(n){throw new kn(n instanceof Error?n.message:s("thread.publishDialog.failedMergePullRequest"),"merge",a)}return a}async function bo(t,e){return await hr(t),await fr(t,e.message),mr(t,e)}function Jn(t,e){return t instanceof Vs?{message:e("siteEditor.publish.changedMeanwhile"),pullRequest:null,headMoved:!0}:t instanceof kn&&t.step==="merge"&&t.pr?{message:e("thread.publishDialog.mergeFailed",{prNumber:t.pr.number,message:t.message}),pullRequest:t.pr,headMoved:!1}:{message:t instanceof Error?t.message:e("thread.publishDialog.failedPublish"),pullRequest:null,headMoved:!1}}function go(t,e){Oe.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnProvider"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function pr(t){return t.kind!=="block"?null:t.namedRule??null}function xo(t,e){const s=e.find(a=>a&&typeof a=="object");return s?zl(s.__resolveType):Wa(t)}const vo=/(?:^|\/)\.deco\/blocks\/([^/]+)\.json$/;function Cn(t){const e=vo.exec(t)?.[1];return e?xi(e):null}function ws(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 yo(t,e){return t===null?"new":e===null?"removed":"edited"}function br(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 Vt(t,e,s=!1){if(t&&typeof t=="object"&&!Array.isArray(t)){const a=t.__resolveType;if(typeof a=="string"&&a.trim()){if(s)return zr(a);const o=(a.split("/").pop()??a).replace(/\.[jt]sx?$/,"");return br(o)||o}}return`Section ${e+1}`}function Nn(t){if(ha(t))return t.value??null;const e=t.__resolveType;return typeof e=="string"&&Hr(e)?t.section??null:null}const gr=6;function ms(t,e=0){if(e>gr||!t||typeof t!="object")return[];if(Array.isArray(t))return t.flatMap(n=>ms(n,e+1));const s=t;if(ln(s.__resolveType))return Gs(s).flatMap(n=>ms(n?.value,e+1));const a=Nn(s);return a!==null?ms(a,e+1):[s]}function Gs(t){const e=t?.variants;return Array.isArray(e)?e.map(s=>s&&typeof s=="object"&&!Array.isArray(s)?s:null):[]}function Xn(t){let e=t;for(let s=0;s<gr;s++){if(!e||typeof e!="object"||Array.isArray(e))return null;const a=e;if(ln(a.__resolveType))return a;const n=Nn(a);if(n===null)return null;e=n}return null}function wo(t,e,s){const a=Gs(Xn(t)),n=e?Gs(Xn(e)):[],o=e?Array.from({length:Math.max(a.length,n.length)},(i,u)=>u).filter(i=>!Ms(a[i],n[i])):[],l=[...o.map(i=>a[i]??n[i]),...a.filter((i,u)=>!o.includes(u))].flatMap(i=>ms(i?.value)).map(i=>Vt(i,s,!0));return[...new Set(l)]}function qs(t,e,s,a,n){let o=t,c=!1;for(let i=0;i<4;i++){if(!o||typeof o!="object"||Array.isArray(o)){c=!0;break}const u=o;if(ln(u.__resolveType)){c=!0;break}const d=Nn(u);if(d===null)break;o=d}const l=c?wo(t,n,e):[];return{name:Vt(c?t:o,e,!0),kind:"section",status:s,fields:a,...c?{wrapper:!0}:{},...l.length>0?{held:l}:{}}}function Qs(t,e){const s=t.sections;if(Array.isArray(s))return s.flatMap((a,n)=>a&&typeof a=="object"&&!Array.isArray(a)?[{section:a,basePath:["sections",n]}]:[]);if(s&&typeof s=="object"){const a=s.variants;if(Array.isArray(a))return a.flatMap((n,o)=>{const c=n&&typeof n=="object"&&!Array.isArray(n)?n.value:null,l=e&&ha(c),i=l?c.value:c;if(!Array.isArray(i))return[];const u=l?["sections","variants",o,"value","value"]:["sections","variants",o,"value"];return i.flatMap((d,h)=>d&&typeof d=="object"&&!Array.isArray(d)?[{section:d,basePath:[...u,h]}]:[])})}return[]}function Yn(t){return JSON.stringify(t,(e,s)=>{if(s&&typeof s=="object"&&!Array.isArray(s)){const a=s;return Object.keys(a).sort().reduce((n,o)=>(n[o]=a[o],n),{})}return s})}function Ms(t,e){return t===void 0&&e===void 0?!0:Yn(t)===Yn(e)}function Wt(t,e,s,a=new Set){const n=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),o=[];for(const c of n){if(c.startsWith("__")||a.has(c))continue;const l=t?t[c]:void 0,i=e?e[c]:void 0;Ms(l,i)||o.push({label:br(c),path:[...s,c],from:l,to:i})}return o}const Po=new Set(["sections"]);function An(t,e,s=!1){const a=t?Qs(t,s):[],n=e?Qs(e,s):[],o=[],c=Math.max(a.length,n.length);for(let i=0;i<c;i++){const u=a[i],d=n[i];if(!s){const h=jo(u,d,i);h&&o.push(h);continue}if(u&&d){if(Ms(u.section,d.section))continue;o.push(qs(d.section,i,"edited",Wt(u.section,d.section,d.basePath),u.section))}else d?o.push(qs(d.section,i,"new",[])):u&&o.push(qs(u.section,i,"removed",[]))}const l=Wt(t,e,[],Po);return l.length>0&&o.push({name:"Page settings",kind:"settings",status:"edited",fields:l}),o}function jo(t,e,s){return t&&e?Ms(t.section,e.section)?null:{name:Vt(e.section,s),kind:"section",status:"edited",fields:Wt(t.section,e.section,e.basePath)}:e?{name:Vt(e.section,s),kind:"section",status:"new",fields:[]}:t?{name:Vt(t.section,s),kind:"section",status:"removed",fields:[]}:null}function Ws(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 So(t){const e=[],s=[],a=[],n=[];for(const[o,c]of Object.entries(t?.diffs??{})){if(wn(o)){n.push(o);continue}const l=yo(c.from,c.to),i=Cn(o);if(!i){a.push(Ws(o,l));continue}const u=ws(c.from),d=ws(c.to),h=d??u;if(!h){a.push(Ws(o,l));continue}const f=Kt(i,h);if(f){e.push({kind:"page",blockKey:i,name:f.name,pagePath:f.path,isSiteApp:!1,status:l,filepaths:[o],sections:l==="edited"?An(u,d):[],fromJson:u,toJson:d});continue}const p=gn(i,h);s.push({kind:"block",blockKey:i,name:gs(i,h),pagePath:null,isSiteApp:p,status:l,filepaths:[o],sections:l==="edited"?[{name:gs(i,h),kind:"section",status:"edited",fields:Wt(u,d,[])}].filter(m=>m.fields.length>0):[],fromJson:u,toJson:d})}return xr({pages:e,blocks:s,other:a,generated:n})}function zs(t,e){return(t.filepaths[0]??"").localeCompare(e.filepaths[0]??"")}function xr(t){const{pages:e,blocks:s,other:a,generated:n}=t;return e.sort(zs),s.sort(zs),a.sort(zs),{pages:e,blocks:s,other:a,generated:n,count:e.length+s.length+a.length}}function ko(t){return t==="added"?"new":t==="removed"?"removed":"edited"}function vr(t){return t.startsWith("pages-")}function yr(t){const{files:e,lookup:s,diff:a}=t,n=[],o=[],c=[],l=[];for(const i of e){const u=i.path;if(wn(u)){l.push(u);continue}const d=ko(i.status),h=Cn(u);if(!h){c.push(Ws(u,d));continue}const f=a?.diffs[u],p=ws(f?.from??null),m=ws(f?.to??null),b=wr(s,h),g=b??m??p;if((b?Kt(h,b):null)??(!b&&vr(h))){const y=g?Kt(h,g):null;n.push({kind:"page",blockKey:h,name:y?.name??Qa(h),pagePath:y?.path??null,isSiteApp:!1,status:d,filepaths:[u],sections:d==="edited"?An(p,m):[],fromJson:p,toJson:m??(d==="new"?b:null)});continue}const j=gs(h,g??{});o.push({kind:"block",blockKey:h,name:j,pagePath:null,isSiteApp:gn(h,b??{}),status:d,filepaths:[u],sections:d==="edited"?[{name:j,kind:"section",status:"edited",fields:Wt(p,m,[])}].filter(y=>y.fields.length>0):[],fromJson:p,toJson:m})}return xr({pages:n,blocks:o,other:c,generated:l})}function wr(t,e){const s=t?.[e];return s&&typeof s=="object"&&!Array.isArray(s)?s:null}function Co(t,e){return t??e}function Pr(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const Hs=3;function ds(t){if(t.length<=Hs)return Pr(t);const e=t.length-Hs;return`${t.slice(0,Hs).join(", ")} and ${e} more`}function No(t,e){if(!e){const a=t.sections.filter(n=>n.kind==="section").map(n=>n.name).slice(0,3);return a.length>0?`${t.name} (${a.join(", ")})`:t.name}const s=[...new Set(t.sections.filter(a=>a.kind==="section").flatMap(a=>a.wrapper?a.held??[]:[a.name]))].slice(0,3);return s.length>0?`${t.name} (${s.join(", ")})`:t.name}function Ao(t){const e=pr(t);return e==="experiments"?"A/B tests":e==="campaigns"?"Campaign dates":t.name}function Ro(t){const e=[],s=t.pages.filter(l=>l.status==="edited"),a=t.pages.filter(l=>l.status==="new"),n=t.pages.filter(l=>l.status==="removed");if(s.length>0&&e.push(`updated ${ds(s.map(l=>No(l,!!t.v8)))}`),a.length>0){const l=a.length===1?"page":"pages";e.push(`added the ${ds(a.map(i=>i.name))} ${l}`)}if(n.length>0){const l=n.length===1?"page":"pages";e.push(`removed the ${ds(n.map(i=>i.name))} ${l}`)}const o=t.blocks.map(Ao);if(o.length>0&&e.push(`changed ${ds(o)}`),t.other.length>0){const l=t.other.length===1?"file":"files";e.push(`changed ${t.other.length} ${l}`)}if(e.length===0)return"";const c=Pr(e);return ur(c.charAt(0).toUpperCase()+c.slice(1))}function To(t,e){return t?Qs(t,e).length:0}function Io(t,e=!1){const s={newPageSections:t.kind==="page"&&t.status==="new"?To(t.toJson,e):null,sections:0,settings:!1,fields:0};if(s.newPageSections!==null)return s;for(const a of t.sections){if(a.kind==="settings"){s.settings=!0;continue}t.kind==="page"?s.sections+=1:s.fields+=a.fields.length}return s}const Zn="••••••";function Jt(t){if(Array.isArray(t))return t.map(Jt);if(!t||typeof t!="object")return t;const e=t,s={};for(const[a,n]of Object.entries(e))s[a]=Jt(n);return e.__resolveType===oo&&"ciphertext"in e&&(s.ciphertext=Zn),Vr(e)&&"encrypted"in e&&(s.encrypted=Zn),s}function ea(t){return t.map(e=>({...e,from:Jt(e.from),to:Jt(e.to)}))}function Do(t){const{changes:e,sides:s,lookup:a,meta:n,missingRules:o,missingRuleUses:c,hosted:l}=t,i=[],u=[],d=f=>[...new Set((s?.diagnostics??[]).filter(p=>$n(Kr(p.file))===$n(f)).map(p=>p.side))],h=Object.keys(e).sort((f,p)=>f<p?-1:f>p?1:0);for(const f of h){const p=e[f],m=p.kind==="delete"?"removed":p.baseVersion===null?"new":"edited",b=s?.entries[f],g=b?.before??null,x=b?.after??null,j=wr(a,f),y=j??x??g,v=d(f),P=o?.get(f),w=Wa(f),k=w?c?.get(w):void 0,N={blockKey:f,status:m,filepaths:[],entry:{name:f,version:p.version},...v.length>0?{unreadable:v}:{},...P&&P.length>0?{missingRules:P}:{},...w&&k&&k.pages+k.sections>0?{missingRuleUses:{kind:w,...k}}:{},fromJson:Jt(g),toJson:Jt(x??(m==="new"?j:null))},R=j?Kt(f,j,n):null,C=!j&&y?Kt(f,y,n):null;if(R??C??(!y&&vr(f))){const $=y?Kt(f,y,n):null;i.push({...N,kind:"page",name:$?.name??Qa(f),pagePath:$?.path??null,isSiteApp:!1,sections:m==="edited"?An(g,x,!0).map(I=>({...I,fields:ea(I.fields)})):[]});continue}const A=l?Ul(f,y,j,x,g):null,S=A?ql(A,[y,j,x,g]):gs(f,y??{}),E=xo(f,[j,x,g]);u.push({...N,kind:"block",name:S,...A?{blogKind:A}:{},...E?{namedRule:E}:{},pagePath:null,isSiteApp:gn(f,j??y??{}),sections:m==="edited"?[{name:S,kind:"section",status:"edited",fields:ea(Wt(g,x,[]))}].filter($=>$.fields.length>0):[]})}return{pages:i,blocks:u,other:[],generated:[],count:i.length+u.length,v8:!0}}function Ie(t){return t.filepaths[0]??t.blockKey??t.name}function Bo(t){const e=t.pages+t.sections===1,s=t.names===1;return t.kind==="experiments"?s?e?"thread.publishPopover.missingTestUsesOne":"thread.publishPopover.missingTestUses":e?"thread.publishPopover.missingTestsUsesOne":"thread.publishPopover.missingTestsUses":s?e?"thread.publishPopover.missingCampaignUsesOne":"thread.publishPopover.missingCampaignUses":e?"thread.publishPopover.missingCampaignsUsesOne":"thread.publishPopover.missingCampaignsUses"}function Mo(t,e){return e(t==="new"?"thread.publishPopover.chipNew":t==="removed"?"thread.publishPopover.chipRemoved":"thread.publishPopover.chipEdited")}function $o(t,e){const s=t.kind==="block"?ni:Ma;return r.jsx("span",{title:Mo(t.status,e),className:"flex shrink-0",children:r.jsx(s,{className:X("size-4",t.status==="new"&&"text-brand",t.status==="edited"&&"text-warning",t.status==="removed"&&"text-destructive")})})}function Fo(t,e){if(t.kind==="page")return t.pagePath;if(t.kind!=="block")return null;if(t.blogKind)return Hl(t.blogKind,e);const s=pr(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 Eo(t,e,s){const a=Io(t,s);if(a.newPageSections!==null)return[a.newPageSections===1?e("thread.publishPopover.newPageSectionOne"):e("thread.publishPopover.newPageSections",{count:a.newPageSections})];const n=[];return a.sections===1?n.push(e("thread.publishPopover.sectionChangedOne")):a.sections>1&&n.push(e("thread.publishPopover.sectionsChanged",{count:a.sections})),a.fields===1?n.push(e("thread.publishPopover.fieldChangedOne")):a.fields>1&&n.push(e("thread.publishPopover.fieldsChanged",{count:a.fields})),a.settings&&n.push(e("thread.publishPopover.pageSettingsChanged")),n}function jr(t){const e=M.c(68),{change:s,bodyPending:a,selected:n,onSelect:o,confirming:c,onConfirmingChange:l,onDiscard:i,isPublishing:u,isDiscarding:d,v8:h,alsoChangedOnMain:f}=t,p=a===void 0?!1:a,m=h===void 0?!1:h,b=f===void 0?!1:f,g=xe();let x;e[0]!==s||e[1]!==g?(x=Fo(s,g),e[0]=s,e[1]=g,e[2]=x):x=e[2];const j=x;let y,v,P,w,k,N,R,C;if(e[3]!==p||e[4]!==s||e[5]!==c||e[6]!==j||e[7]!==d||e[8]!==u||e[9]!==l||e[10]!==i||e[11]!==o||e[12]!==n||e[13]!==g||e[14]!==m){const E=Eo(s,g,m);let $;e[23]!==s.missingRules?($=s.missingRules??[],e[23]=s.missingRules,e[24]=$):$=e[24];const I=$,T=s.missingRuleUses,D=T?ri(g,T):null,Y=p&&E.length===0&&s.status==="edited";y=or;const ae=n&&"border-foreground/30 bg-accent hover:bg-secondary-hover";e[25]!==ae?(w=X("cursor-pointer transition-colors hover:bg-accent",ae),e[25]=ae,e[26]=w):w=e[26],e[27]!==s?(k=Ie(s),e[27]=s,e[28]=k):k=e[28],N=o;let H;e[29]!==s||e[30]!==g?(H=$o(s,g),e[29]=s,e[30]=g,e[31]=H):H=e[31];let _;e[32]!==s.name?(_=r.jsx("span",{className:"truncate text-sm font-medium",children:s.name}),e[32]=s.name,e[33]=_):_=e[33];let z;e[34]!==j?(z=j?r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:j}):null,e[34]=j,e[35]=z):z=e[35];let ee;e[36]!==n||e[37]!==_||e[38]!==z?(ee=r.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left","aria-pressed":n,children:[_,z]}),e[36]=n,e[37]=_,e[38]=z,e[39]=ee):ee=e[39];let Q;e[40]!==c||e[41]!==d||e[42]!==u||e[43]!==l||e[44]!==i||e[45]!==g?(Q=c?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:B=>{B.stopPropagation(),l(!1)},children:g("thread.publishDialog.cancel")}),r.jsx("button",{type:"button",className:"text-xs font-medium text-destructive disabled:opacity-50",onClick:B=>{B.stopPropagation(),l(!1),i?.()},disabled:d,children:g("thread.publishPopover.discard")})]}):i?r.jsx(As,{children:r.jsxs(kt,{children:[r.jsx(Ct,{asChild:!0,children:r.jsx(ye,{type:"button",variant:"ghost-destructive",size:"icon-xs","aria-label":g("thread.publishPopover.discard"),className:"shrink-0 disabled:pointer-events-auto",onClick:B=>{B.stopPropagation(),l(!0)},disabled:u||d,children:r.jsx(Ts,{className:"size-3.5"})})}),r.jsx(Nt,{children:g("thread.publishPopover.discard")})]})}):null,e[40]=c,e[41]=d,e[42]=u,e[43]=l,e[44]=i,e[45]=g,e[46]=Q):Q=e[46],e[47]!==H||e[48]!==ee||e[49]!==Q?(R=r.jsxs("div",{className:"flex items-center gap-2.5",children:[H,ee,Q]}),e[47]=H,e[48]=ee,e[49]=Q,e[50]=R):R=e[50],C=E.length>0?r.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-muted-foreground",children:E.map(_o)}):Y?r.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px]",children:r.jsx(ft,{className:"h-4 w-2/3"})}):null,e[51]!==I||e[52]!==g?(v=I.length>0?r.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-foreground","data-testid":"publish-change-missing-rule",children:I.map(B=>r.jsx("div",{className:"truncate",children:g(B==="experiments"?"thread.publishPopover.missingTest":"thread.publishPopover.missingCampaign")},B))}):null,e[51]=I,e[52]=g,e[53]=v):v=e[53],P=T&&D?r.jsx("div",{className:"mt-1 truncate pl-[26px] text-xs text-foreground","data-testid":"publish-change-missing-rule-uses",children:g(Bo(T),{places:D.places})}):null,e[3]=p,e[4]=s,e[5]=c,e[6]=j,e[7]=d,e[8]=u,e[9]=l,e[10]=i,e[11]=o,e[12]=n,e[13]=g,e[14]=m,e[15]=y,e[16]=v,e[17]=P,e[18]=w,e[19]=k,e[20]=N,e[21]=R,e[22]=C}else y=e[15],v=e[16],P=e[17],w=e[18],k=e[19],N=e[20],R=e[21],C=e[22];let A;e[54]!==b||e[55]!==s.name||e[56]!==g?(A=b?r.jsx("div",{className:"mt-1 pl-[26px] text-xs text-muted-foreground","data-testid":"publish-change-also-changed",children:g("thread.publishPopover.alsoChangedOnMain",{name:s.name})}):null,e[54]=b,e[55]=s.name,e[56]=g,e[57]=A):A=e[57];let S;return e[58]!==y||e[59]!==v||e[60]!==P||e[61]!==A||e[62]!==w||e[63]!==k||e[64]!==N||e[65]!==R||e[66]!==C?(S=r.jsxs(y,{className:w,"data-change-id":k,onClick:N,children:[R,C,v,P,A]}),e[58]=y,e[59]=v,e[60]=P,e[61]=A,e[62]=w,e[63]=k,e[64]=N,e[65]=R,e[66]=C,e[67]=S):S=e[67],S}function _o(t,e){return r.jsx("div",{className:"truncate",children:t},`${e}-${t}`)}function Sr(){const t=M.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,a]=q.useState(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const i=()=>a(d=>d.width===l.clientWidth&&d.height===l.clientHeight?d:{width:l.clientWidth,height:l.clientHeight});i();const u=new ResizeObserver(i);return u.observe(l),()=>u.disconnect()},t[1]=n):n=t[1];const o=n;let c;return t[2]!==s?(c=[s,o],t[2]=s,t[3]=c):c=t[3],c}function Oo(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}const Lo=[{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 ta(t){const e=M.c(10),{height:s}=t,a=xe();let n;e[0]!==s?(n={height:s},e[0]=s,e[1]=n):n=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=Lo.map(Uo),e[2]=o):o=e[2];let c;e[3]!==a?(c=a("thread.publishDialog.openingComparison"),e[3]=a,e[4]=c):c=e[4];let l;e[5]!==c?(l=r.jsx("div",{className:"flex items-center justify-center pt-1 text-2xs text-muted-foreground",children:c}),e[5]=c,e[6]=l):l=e[6];let i;return e[7]!==n||e[8]!==l?(i=r.jsxs("div",{style:n,className:"flex w-full flex-col gap-1.5 overflow-hidden px-3 py-2",children:[o,l]}),e[7]=n,e[8]=l,e[9]=i):i=e[9],i}function Uo(t,e){return r.jsxs("div",{className:X("flex items-center gap-2 rounded px-1 py-0.5",t.tone==="del"&&"bg-destructive/5",t.tone==="add"&&"bg-success/5"),children:[r.jsx("div",{className:X("h-2 w-4 shrink-0 animate-pulse rounded-sm bg-muted",t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")}),r.jsx("div",{className:X("h-2 animate-pulse rounded-sm bg-muted",t.width,t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")})]},e)}const kr={readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12},qo={...kr,lineNumbersMinChars:3,lineDecorationsWidth:4,folding:!1,glyphMargin:!1,renderOverviewRuler:!1};function zo(t){const e=M.c(11),{diff:s,emptyMessage:a,rowClassName:n,onDiscardFile:o,hideFileRows:c,editorHeight:l}=t,i=a===void 0?"No file changes in the working tree":a,u=n===void 0?"px-6":n,d=c===void 0?!1:c,h=l===void 0?"380px":l,[f,p]=q.useState(null),[m,b]=q.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=Oo(),e[0]=g):g=e[0];const x=g;if(!s||Object.keys(s.diffs).length===0){let y;return e[1]!==i?(y=r.jsx("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:i}),e[1]=i,e[2]=y):y=e[2],y}let j;return e[3]!==s.diffs||e[4]!==m||e[5]!==h||e[6]!==f||e[7]!==d||e[8]!==o||e[9]!==u?(j=r.jsx("div",{className:"divide-y",children:Object.entries(s.diffs).map(y=>{const[v,P]=y,{from:w,to:k}=P,N=f===v,R=w===null,C=k===null,A=v.startsWith("/")?v.slice(1):v,S=A.lastIndexOf("/"),E=S>=0?A.slice(S+1):A,$=S>=0?A.slice(0,S):null,I=vi(v),T=R?"bg-success":C?"bg-destructive":"bg-warning";return d?r.jsx("div",{children:r.jsx(Hn,{original:w??"",modified:k??"",language:I,theme:x,height:h,loading:r.jsx(ta,{height:h}),options:qo})},v):r.jsxs("div",{children:[r.jsxs("div",{className:X("flex items-center gap-3 py-3 hover:bg-accent",u),children:[r.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:()=>p(N?null:v),children:r.jsx(ua,{className:X("h-3.5 w-3.5 transition-transform",N&&"rotate-90")})}),r.jsx("div",{className:X("h-2.5 w-2.5 shrink-0 rounded-full",T)}),r.jsx(Ma,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:E}),$&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:$}),o?r.jsxs(Ss,{children:[r.jsx(Ps,{asChild:!0,children:r.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:r.jsx(Gr,{className:"h-3.5 w-3.5"})})}),r.jsx(js,{align:"end",children:r.jsx(Gt,{className:"text-destructive focus:text-destructive",onSelect:()=>b(v),children:"Discard changes"})})]}):null]}),m===v&&o?r.jsxs("div",{className:X("flex items-center justify-between gap-3 border-t bg-destructive/5 py-2.5",u),children:[r.jsxs("span",{className:"text-xs text-destructive",children:["Discard all changes to"," ",r.jsx("span",{className:"font-medium",children:E}),"? This cannot be undone."]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(ye,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(null),children:"Cancel"}),r.jsx(ye,{type:"button",variant:"destructive",size:"sm",onClick:()=>{b(null),o(v)},children:"Discard"})]})]}):null,N&&r.jsx("div",{className:"border-t",children:r.jsx(Hn,{original:w??"",modified:k??"",language:I,theme:x,height:h,loading:r.jsx(ta,{height:h}),options:kr})})]},v)})}),e[3]=s.diffs,e[4]=m,e[5]=h,e[6]=f,e[7]=d,e[8]=o,e[9]=u,e[10]=j):j=e[10],j}function Ho(t){if(t.kind!=="block"||t.isSiteApp||!t.blockKey)return null;const e=(t.toJson??t.fromJson)?.__resolveType;return typeof e=="string"&&ji(e)?t.blockKey:null}function Ko(t){return t.kind!=="page"?!0:!t.pagePath||Ft(t.pagePath).length>0}function Vo(t,e){try{return wi(t,Vl,e)}catch{return null}}function Go(t,e,s){if(!e)return;const a=Kl(e,t);if(!a)return null;if(Ft(a.path).length===0||s?.path!==a.path)return a.path;const n=xn(a.path,s.params);return Ft(n).length===0?n:a.path}function Qo(t){return t.sectionKey&&!t.v8?Vo(t.previewServerUrl,t.sectionKey):Jo(t.previewServerUrl,t.path)}function Wo(t,e){if(t.kind!=="page")return"/";const s=t.pagePath;if(!s)return"";if(Ft(s).length===0)return s;if(e?.path!==s)return"";const a=xn(s,e.params);return Ft(a).length===0?a:""}function Jo(t,e){const s=e.trim();if(!s||Ft(s).length>0)return null;try{const a=new URL(t),n=new URL(s.startsWith("/")?s:`/${s}`,a);return n.origin===a.origin?n:null}catch{return null}}function Xo(t,e){return e?.kind==="pointer"&&e.link?jn(t.toString(),e.link):Cr(t,e)}function Cr(t,e){if(!e)return null;if(e.kind==="pointer")return jn(t.toString(),e.pointer);try{return new URL(`${t.pathname}${t.search}`,e.previewUrl).href}catch{return null}}function Yo(t,e,s){return e===null?!1:t!=="other"||s?.kind==="sandbox"}function Zo(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 Nr=q.createContext(!0),ec=["split","before","after","code"];function tc(t){return ec.includes(t)}const Ar={desktop:1280,mobile:412};function sc(t,e){const s=(o,c)=>t.unreadable?.includes(c)?e:o?`${JSON.stringify(o,null,2)}
10
- `:null,a=t.status==="new"?null:s(t.fromJson,"before"),n=t.status==="removed"?null:s(t.toJson,"after");return a===null&&n===null?{diffs:{}}:t.status==="edited"&&(a===null||n===null)?{diffs:{}}:{diffs:{[Jr(t.entry.name)]:{from:a,to:n}}}}function Rr(t){const e=M.c(76),{change:s,diff:a,bodyPending:n,previewServerUrl:o,draft:c,lastPage:l,v8:i,onReady:u}=t,d=xe(),h=q.use(Nr),f=Ho(s),p=i?null:f,m=i?f:null,b=m?Go(m,i?.blocks,l):void 0,g=m!==null&&b===null,x=Yo(s.kind,o,c)&&(m===null||typeof b=="string"),[j,y]=q.useState(null),v=x?j??"split":"code",[P,w]=q.useState("desktop"),[k,N]=q.useState(null),R=k??(m?b??"":Wo(s,l));let C;e[0]!==s?(C=Ko(s),e[0]=s,e[1]=C):C=e[1];const A=C,S=o?Qo({previewServerUrl:o,sectionKey:f,path:R,v8:!!i}):null,E=S?jn(S.toString(),Pi):null,$=S?Cr(S,c):null,I=S?Xo(S,c):null;let T;e[2]!==s||e[3]!==a?.diffs||e[4]!==d?(T=s.entry?sc(s,d("thread.publishCompare.sideUnreadable")):{diffs:Object.fromEntries(s.filepaths.flatMap(O=>{const ne=a?.diffs[O];return ne?[[O,ne]]:[]}))},e[2]=s,e[3]=a?.diffs,e[4]=d,e[5]=T):T=e[5];const D=T;let Y;e[6]!==D.diffs?(Y=Object.keys(D.diffs),e[6]=D.diffs,e[7]=Y):Y=e[7];const ae=Y.length>0;let H;e:{if(p!==null){H=null;break e}if(m!==null){const ne=R.trim();if(!ne){H=null;break e}H=Ft(ne).length>0?d("thread.publishCompare.dynamicHint",{template:ne}):d("thread.publishCompare.blockHint",{path:ne});break e}if(s.kind!=="page"){let ne;e[8]!==d?(ne=d("thread.publishCompare.globalHint"),e[8]=d,e[9]=ne):ne=e[9],H=ne;break e}let O;e[10]!==s.pagePath||e[11]!==d?(O=s.pagePath&&Ft(s.pagePath).length>0?d("thread.publishCompare.dynamicHint",{template:s.pagePath}):null,e[10]=s.pagePath,e[11]=d,e[12]=O):O=e[12],H=O}const _=H,z=Zo(s,!!i),[ee,Q]=q.useState(nc);let B;e[13]===Symbol.for("react.memo_cache_sentinel")?(B=O=>Q(ne=>ne.has(O)?ne:new Set(ne).add(O)),e[13]=B):B=e[13];const ie=B;let U;e[14]!==i?(U=O=>i?r.jsx(lc,{...O,onLoaded:ie}):r.jsx(rc,{...O}),e[14]=i,e[15]=U):U=e[15];const oe=U,se=(x?[z.before==="new"?null:E,z.after==="removed"?null:$].flatMap(O=>O?[Sn(O,P)]:[]):[]).every(O=>ee.has(O));let F;e[16]!==u||e[17]!==se?(F=se&&u?O=>{O&&u()}:void 0,e[16]=u,e[17]=se,e[18]=F):F=e[18];const te=F,re=z.before==="new"?r.jsx(us,{icon:r.jsx(Oa,{className:"size-5 text-brand"}),title:d("thread.publishCompare.newTitle"),description:d("thread.publishCompare.newDescription")}):oe({url:E,device:P,title:d("thread.publishCompare.before"),missing:d("thread.publishCompare.enterPath")}),he=z.after==="removed"?r.jsx(us,{icon:r.jsx(Ts,{className:"size-5 text-destructive"}),title:d("thread.publishCompare.removedTitle"),description:d("thread.publishCompare.removedDescription")}):oe({url:$,device:P,title:d("thread.publishCompare.after"),missing:d(S?"thread.publishCompare.draftUnavailable":"thread.publishCompare.enterPath")});let G;e[19]!==x||e[20]!==y||e[21]!==h||e[22]!==d||e[23]!==v?(G=x||h?r.jsx(Da,{value:v,onValueChange:O=>{tc(O)&&y(O)},children:r.jsxs(Ia,{className:"h-8 w-auto",variant:"pill",children:[x?r.jsxs(r.Fragment,{children:[r.jsx(Lt,{value:"split",className:"px-3 text-xs",children:d("thread.publishCompare.sideBySide")}),r.jsx(Lt,{value:"before",className:"px-3 text-xs",children:d("thread.publishCompare.before")}),r.jsx(Lt,{value:"after",className:"px-3 text-xs",children:d("thread.publishCompare.after")})]}):null,h?r.jsx(Lt,{value:"code",className:"px-3 text-xs",children:d("thread.publishCompare.code")}):null]})}):null,e[19]=x,e[20]=y,e[21]=h,e[22]=d,e[23]=v,e[24]=G):G=e[24];let pe;e[25]!==I||e[26]!==x||e[27]!==s.pagePath||e[28]!==P||e[29]!==R||e[30]!==A||e[31]!==p||e[32]!==w||e[33]!==N||e[34]!==d||e[35]!==v?(pe=x&&v!=="code"?r.jsxs(r.Fragment,{children:[p?null:A?r.jsx(Qr,{value:R,onChange:O=>N(O.target.value),placeholder:s.pagePath??"/","aria-label":d("thread.publishCompare.pathLabel"),className:"h-8 w-56 font-mono text-xs"}):r.jsx("span",{className:"max-w-56 truncate px-1 font-mono text-xs text-muted-foreground",children:R}),r.jsxs("div",{className:"flex items-center rounded-lg border p-0.5",children:[r.jsx(sa,{active:P==="desktop",label:d("thread.publishCompare.desktop"),onClick:()=>w("desktop"),children:r.jsx(yi,{className:"size-3.5"})}),r.jsx(sa,{active:P==="mobile",label:d("thread.publishCompare.mobile"),onClick:()=>w("mobile"),children:r.jsx(Sl,{className:"size-3.5"})})]}),I?r.jsxs("a",{href:I,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:[r.jsx(Wr,{className:"size-3.5"}),d("thread.publishCompare.openDraft")]}):null]}):null,e[25]=I,e[26]=x,e[27]=s.pagePath,e[28]=P,e[29]=R,e[30]=A,e[31]=p,e[32]=w,e[33]=N,e[34]=d,e[35]=v,e[36]=pe):pe=e[36];let Z;e[37]!==G||e[38]!==pe?(Z=r.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b bg-background px-4 py-2.5 max-md:pr-12",children:[G,pe]}),e[37]=G,e[38]=pe,e[39]=Z):Z=e[39];let L;e[40]!==x||e[41]!==_||e[42]!==v?(L=_&&x&&v!=="code"?r.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-2xs text-muted-foreground",children:_}):null,e[40]=x,e[41]=_,e[42]=v,e[43]=L):L=e[43];let K;e[44]!==g||e[45]!==h||e[46]!==d?(K=g&&h?r.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-2xs text-muted-foreground",children:d("thread.publishCompare.notOnAnyPage")}):null,e[44]=g,e[45]=h,e[46]=d,e[47]=K):K=e[47];let ce;e[48]!==o||e[49]!==h||e[50]!==d||e[51]!==m||e[52]!==b||e[53]!==v?(ce=v==="code"&&!h?m!==null&&b===void 0?r.jsx(ft,{className:"m-4 h-64 rounded"}):o===null?r.jsx(us,{icon:r.jsx(xs,{className:"size-5 text-muted-foreground"}),title:d("thread.publishCompare.previewNotReadyTitle"),description:d("thread.publishCompare.draftUnavailable")}):r.jsx(us,{icon:r.jsx(xs,{className:"size-5 text-muted-foreground"}),title:d("thread.publishCompare.noPreviewTitle"),description:d("thread.publishCompare.noPreviewDescription")}):null,e[48]=o,e[49]=h,e[50]=d,e[51]=m,e[52]=b,e[53]=v,e[54]=ce):ce=e[54];let je;e[55]!==n||e[56]!==ae||e[57]!==D||e[58]!==h||e[59]!==d||e[60]!==v?(je=v==="code"&&h?r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background [scrollbar-width:thin]",children:ae?r.jsx(zo,{diff:D,hideFileRows:!0,editorHeight:"70vh"}):n?r.jsx(ft,{className:"m-4 h-64 rounded"}):r.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:d("thread.publishPopover.detailsUnavailable")})}):null,e[55]=n,e[56]=ae,e[57]=D,e[58]=h,e[59]=d,e[60]=v,e[61]=je):je=e[61];let fe;e[62]!==he||e[63]!==re||e[64]!==x||e[65]!==d||e[66]!==v?(fe=x?r.jsxs("div",{className:X("flex min-h-0 flex-1 gap-3 p-3",v==="code"&&"hidden"),children:[r.jsx(na,{label:d("thread.publishCompare.before"),hidden:v==="after",children:re}),r.jsx(na,{label:d("thread.publishCompare.after"),highlight:!0,hidden:v==="before",children:he})]}):null,e[62]=he,e[63]=re,e[64]=x,e[65]=d,e[66]=v,e[67]=fe):fe=e[67];let Ee;return e[68]!==te||e[69]!==Z||e[70]!==L||e[71]!==K||e[72]!==ce||e[73]!==je||e[74]!==fe?(Ee=r.jsxs("div",{ref:te,className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/40",children:[Z,L,K,ce,je,fe]}),e[68]=te,e[69]=Z,e[70]=L,e[71]=K,e[72]=ce,e[73]=je,e[74]=fe,e[75]=Ee):Ee=e[75],Ee}function nc(){return new Set}function sa(t){const e=M.c(8),{active:s,label:a,onClick:n,children:o}=t,c=s&&"bg-accent text-foreground";let l;e[0]!==c?(l=X("flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground",c),e[0]=c,e[1]=l):l=e[1];let i;return e[2]!==s||e[3]!==o||e[4]!==a||e[5]!==n||e[6]!==l?(i=r.jsx("button",{type:"button","aria-label":a,"aria-pressed":s,title:a,onClick:n,className:l,children:o}),e[2]=s,e[3]=o,e[4]=a,e[5]=n,e[6]=l,e[7]=i):i=e[7],i}function na(t){const e=M.c(18),{label:s,highlight:a,hidden:n,children:o}=t,c=a===void 0?!1:a,i=(n===void 0?!1:n)&&"hidden";let u;e[0]!==i?(u=X("flex min-h-0 min-w-0 flex-1 flex-col gap-1.5",i),e[0]=i,e[1]=u):u=e[1];const d=c&&"bg-brand";let h;e[2]!==d?(h=X("size-1.5 rounded-full bg-muted-foreground/50",d),e[2]=d,e[3]=h):h=e[3];let f;e[4]!==h?(f=r.jsx("span",{className:h}),e[4]=h,e[5]=f):f=e[5];let p;e[6]!==s||e[7]!==f?(p=r.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 text-2xs font-medium text-muted-foreground",children:[f,s]}),e[6]=s,e[7]=f,e[8]=p):p=e[8];const m=c&&"border-brand/60";let b;e[9]!==m?(b=X("relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-background",m),e[9]=m,e[10]=b):b=e[10];let g;e[11]!==o||e[12]!==b?(g=r.jsx("div",{className:b,children:o}),e[11]=o,e[12]=b,e[13]=g):g=e[13];let x;return e[14]!==g||e[15]!==u||e[16]!==p?(x=r.jsxs("div",{className:u,children:[p,g]}),e[14]=g,e[15]=u,e[16]=p,e[17]=x):x=e[17],x}function us(t){const e=M.c(10),{icon:s,title:a,description:n}=t;let o;e[0]!==s?(o=r.jsx("div",{className:"mb-1",children:s}),e[0]=s,e[1]=o):o=e[1];let c;e[2]!==a?(c=r.jsx("p",{className:"text-sm font-medium",children:a}),e[2]=a,e[3]=c):c=e[3];let l;e[4]!==n?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[4]=n,e[5]=l):l=e[5];let i;return e[6]!==o||e[7]!==c||e[8]!==l?(i=r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 px-6 text-center",children:[o,c,l]}),e[6]=o,e[7]=c,e[8]=l,e[9]=i):i=e[9],i}function ac(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 rc(t){const e=M.c(24),{url:s,device:a,title:n,missing:o}=t,[c,l]=Sr(),[i,u]=q.useState(null);if(!s){let w;return e[0]!==o?(w=r.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=w):w=e[1],w}let d;e[2]!==a||e[3]!==s?(d=Sn(s,a),e[2]=a,e[3]=s,e[4]=d):d=e[4];const h=d,f=Ar[a],p=c.width>0?Math.min(c.width/f,1):1,m=c.width>0?Math.max((c.width-f*p)/2,0):0;let b;e[5]!==h?(b=()=>u(h),e[5]=h,e[6]=b):b=e[6];const g=c.height>0?c.height/p:"100%",x=`scale(${p})`;let j;e[7]!==f||e[8]!==m||e[9]!==g||e[10]!==x?(j={left:m,width:f,height:g,transform:x,transformOrigin:"top left"},e[7]=f,e[8]=m,e[9]=g,e[10]=x,e[11]=j):j=e[11];let y;e[12]!==h||e[13]!==b||e[14]!==j||e[15]!==n?(y=r.jsx("iframe",{src:h,title:n,sandbox:"allow-scripts allow-same-origin",onLoad:b,className:"absolute top-0 border-0 bg-white",style:j},h),e[12]=h,e[13]=b,e[14]=j,e[15]=n,e[16]=y):y=e[16];let v;e[17]!==i||e[18]!==h?(v=i!==h?r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:r.jsx(Qt,{className:"size-5 motion-reduce:animate-none"})}):null,e[17]=i,e[18]=h,e[19]=v):v=e[19];let P;return e[20]!==l||e[21]!==y||e[22]!==v?(P=r.jsxs("div",{ref:l,className:"absolute inset-0",children:[y,v]}),e[20]=l,e[21]=y,e[22]=v,e[23]=P):P=e[23],P}function lc(t){const e=M.c(21),{url:s,device:a,title:n,missing:o,onLoaded:c}=t,[l,i]=Sr(),[u,d]=q.useState(null),[h,f]=q.useState(null),p=l.width>0&&l.height>0;p&&(u?.width!==l.width||u?.height!==l.height)&&d(l);const m=p?l:u;if(!s){let P;return e[0]!==o?(P=r.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=P):P=e[1],P}let b,g,x,j;if(e[2]!==m||e[3]!==a||e[4]!==c||e[5]!==i||e[6]!==h||e[7]!==n||e[8]!==s){const P=Sn(s,a),w=Ar[a];b=h?.src!==P;const k=[...h&&b?[h]:[],{src:P,logicalWidth:w}];g=i,x="absolute inset-0",j=k.map(N=>{const R=N.src===P&&b;return r.jsx("iframe",{src:N.src,title:n,"aria-hidden":R&&h?!0:void 0,sandbox:"allow-scripts allow-same-origin",onLoad:()=>{N.src===P&&(f(N),c?.(N.src))},className:X("absolute top-0 border-0 bg-white",R&&"pointer-events-none opacity-0"),style:ac(m,N.logicalWidth)},N.src)}),e[2]=m,e[3]=a,e[4]=c,e[5]=i,e[6]=h,e[7]=n,e[8]=s,e[9]=b,e[10]=g,e[11]=x,e[12]=j}else b=e[9],g=e[10],x=e[11],j=e[12];let y;e[13]!==b||e[14]!==h?(y=b?h?r.jsx(Qt,{className:"absolute right-2 top-2 size-4 text-muted-foreground motion-reduce:animate-none"}):r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:r.jsx(Qt,{className:"size-5 motion-reduce:animate-none"})}):null,e[13]=b,e[14]=h,e[15]=y):y=e[15];let v;return e[16]!==g||e[17]!==x||e[18]!==j||e[19]!==y?(v=r.jsxs("div",{ref:g,className:x,children:[j,y]}),e[16]=g,e[17]=x,e[18]=j,e[19]=y,e[20]=v):v=e[20],v}const ic=/^Co-authored-by:\s*([^<\r\n]+?)(?:\s*<[^>\r\n]*>)?\s*$/im;function oc(t){if(!t)return null;const e=ic.exec(t)?.[1]?.trim();return e||null}function cc(t){return/\[bot\]$/i.test(t)||/-bot$/i.test(t)}function dc(t){const e=oc(t.body);if(e)return e;const s=t.author.trim();return!s||cc(s)?null:s}function Tr(t){const e=M.c(9),s=xe(),a=Ns();let n;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(n={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch},e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=n):n=e[3];const o=nr(n);let c;return e[4]!==t||e[5]!==o||e[6]!==a||e[7]!==s?(c=async(l,i,u)=>{try{await ll(o,{blockKeys:i.map(hc),write:()=>il(l.client,i)}),Oe.success(u)}catch(d){const h=d;if(ol(h)){Oe.info(s("siteEditor.discard.changedMeanwhile")),await t.refresh().catch(uc);return}l.source==="local"&&cl(h)&&a.resetQueries({queryKey:Et.contentBackend(t.orgSlug,t.virtualMcpId,"local")}),Oe.error(s("siteEditor.discard.failed"),{description:dn(s,bs(h))})}},e[4]=t,e[5]=o,e[6]=a,e[7]=s,e[8]=c):c=e[8],c}function uc(){}function hc(t){return t.name}function fc(t){const{mode:e,target:s,note:a,allPaths:n,destinationHost:o,publishLockRef:c,onOpenChange:l,refresh:i,onPullRequestChanged:u,onPublished:d,hosted:h=!1,authorName:f,protocol:p}=t,m=xe(),b=Ns(),[g,x]=q.useState(!1),[j,y]=q.useState(),[v,P]=q.useState(null),w=()=>fo(a,h?f?m("siteEditor.publish.defaultNote",{name:f}):m("siteEditor.publish.defaultNoteAnonymous"):m("thread.publishDialog.changesFrom",{branch:s.headBranch})),k=async T=>{try{await T?.()}catch{}},N=nr({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch}),R=async T=>{try{await Es(N,{kind:"publish",reread:!!T,refreshOnError:!0,write:()=>Zl(s,T)}),En(m)}catch(D){ei(m,D,()=>{R(T)})}},C=async T=>{const D=Xl(T,s.branch);Yl(m,T,()=>{R(D)}),l(!1),await k(d)},A=async()=>{c.current=!0,x(!0),y(void 0),P(null);try{const T=await Es(N,{kind:"publish",reread:!0,refreshOnError:!0,write:()=>Ql(s,w().message)});return await C(T),!0}catch(T){T instanceof Wl&&T.code===Xr&&Yr(b,s.orgSlug,s.virtualMcpId);const D=Jl(m,T);return y(D.message),P(D.detail),!1}finally{c.current=!1,x(!1)}},S=async()=>{c.current=!0,x(!0),y(void 0),P(null);try{await po(s,w(),m),En(m,o),l(!1),await Promise.all([k(u),k(d)])}catch(T){const D=Jn(T,m);y(D.headMoved?D.message:m("siteEditor.publish.failed")),P(D.headMoved?null:[D.pullRequest?`#${D.pullRequest.number} ${D.pullRequest.htmlUrl}`:null,bs(T)].filter(Boolean).join(`
11
- `)||null),D.pullRequest&&await k(u),D.headMoved&&await i()}finally{c.current=!1,x(!1)}},E=async()=>{c.current=!0,x(!0),y(void 0),P(null);try{const T=await bo(s,w());go(T,m),l(!1),await u?.()}catch(T){const D=Jn(T,m);y(D.message||m("thread.publishDialog.failedSubmitForReview")),D.headMoved&&await i()}finally{c.current=!1,x(!1)}},$=Tr({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,refresh:i}),I=async(T,D)=>{try{await Es(N,{kind:"discard",reread:!0,write:()=>ci({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},T)}),Oe.success(D),await i()}catch(Y){Oe.error(m("siteEditor.discard.failed"),{description:dn(m,bs(Y))})}};return{isPublishing:g,publishError:j,publishErrorDetail:v,submit:e==="review"?E:h?A:S,discardChange:T=>{const D=m("thread.publishPopover.discarded",{name:T.name});return p&&T.entry?$(p.backend,[T.entry],D):I(T.filepaths,D)},discardAll:async()=>{const T=m("thread.publishDialog.allChangesDiscarded");if(p){if(p.entries.length===0)return;await $(p.backend,p.entries,T);return}n.length!==0&&await I(n,T)}}}function mc(t,e,s,a,n,o){return["cms-publish-bodies",t,e,s,a,n,o]}const pc=6e4;function bc(t,e){return e?null:t.files.map(s=>`${s.index}${s.working_dir} ${s.path}`).sort().join(`
12
- `)}function gc(t,e,s){const a=M.c(6);let n;a[0]!==s||a[1]!==t||a[2]!==e?(n=Et.decofile(`${t}/${e}/${s}`),a[0]=s,a[1]=t,a[2]=e,a[3]=n):n=a[3];let o;a[4]!==n?(o={queryKey:n,queryFn:on},a[4]=n,a[5]=o):o=a[5];const{data:c}=Tt(o);return c}function Ir(t){const{orgSlug:e,virtualMcpId:s,branch:a,threadId:n,baseBranch:o,fastPreview:c,recoverSandbox:l}=t,i={orgSlug:e,virtualMcpId:s,branch:a,threadId:n},u=c?{fastPreview:!0}:void 0,d=q.useRef(null),h=async P=>{try{return await P()}catch(w){if(!l||!Za(w))throw w;return d.current??=l(),await d.current,P()}},f=fa({...Ya(i),queryFn:()=>h(()=>yn(i))}),p=f.data,m=p.changedFiles??null,b=p.headSha??null,g=m?m.length>0:di(p)||ui(p),x=Tt({queryKey:mc(e,s,a,o,b,bc(p,c)),queryFn:()=>h(()=>Ja(i,p,o,u)),enabled:g,staleTime:c?pc:0,gcTime:c?void 0:0,throwOnError:(P,w)=>!m&&w.state.data===void 0}),j=gc(e,s,a),y=x.data??null,v=m?yr({files:m,lookup:j,diff:y}):So(y);return{status:p,summary:v,allPaths:m?m.map(P=>P.path):Object.keys(y?.diffs??{}),discardablePaths:c?null:new Set(p.files.map(P=>P.path)),changedFilesTotal:p.changedFilesTotal??v.count,changedFilesTruncated:p.changedFilesTruncated??!1,headSha:b,diff:y,bodiesPending:g&&x.isPending,bodiesFailed:x.isError,cardsPending:!m&&g&&x.isPending,refresh:()=>Promise.all([f.refetch(),c?null:x.refetch()])}}function xc(t){const e=M.c(4);let s;e[0]!==t?(s=Et.decofile(t),e[0]=t,e[1]=s):s=e[1];let a;e[2]!==s?(a={queryKey:s,queryFn:on},e[2]=s,e[3]=a):a=e[3];const{data:n}=Tt(a);return n}function vc(t,e){const s=M.c(5);let a;s[0]!==t||s[1]!==e?(a=e?ul(e,t):Et.liveMeta("","no-scope"),s[0]=t,s[1]=e,s[2]=a):a=s[2];let n;s[3]!==a?(n={queryKey:a,queryFn:on},s[3]=a,s[4]=n):n=s[4];const{data:o}=Tt(n);return o}function Rn(t){const e=M.c(27),{backend:s,cacheKey:a,scope:n}=t,o=Ns();let c;e[0]!==a?(c=Et.contentChanges(a),e[0]=a,e[1]=c):c=e[1];let l;e[2]!==s.client||e[3]!==a||e[4]!==o?(l=()=>hl(o,s.client,a),e[2]=s.client,e[3]=a,e[4]=o,e[5]=l):l=e[5];let i;e[6]!==c||e[7]!==l?(i={queryKey:c,queryFn:l,staleTime:0},e[6]=c,e[7]=l,e[8]=i):i=e[8];const u=fa(i),d=u.data,h=dl(s,a,d),f=xc(a),p=vc(s,n);let m;if(e[9]!==s.source||e[10]!==d.changes||e[11]!==f||e[12]!==p||e[13]!==h.data){const P=f&&p?li(f,p):null,w=f&&p?ii(f,p):null;m=Do({changes:d.changes,sides:h.data??null,lookup:f,meta:p,hosted:s.source==="github",...P?{missingRules:P}:{},...w?{missingRuleUses:w}:{}}),e[9]=s.source,e[10]=d.changes,e[11]=f,e[12]=p,e[13]=h.data,e[14]=m}else m=e[14];const b=m;let g;e[15]!==d.changes?(g=Object.entries(d.changes).map(yc),e[15]=d.changes,e[16]=g):g=e[16];const x=b.count>0&&h.isPending,j=f??null;let y;e[17]!==u?(y=()=>u.refetch(),e[17]=u,e[18]=y):y=e[18];let v;return e[19]!==d||e[20]!==h.isError||e[21]!==b||e[22]!==g||e[23]!==x||e[24]!==j||e[25]!==y?(v={changes:d,summary:b,entries:g,sidesPending:x,sidesFailed:h.isError,blocks:j,refresh:y},e[19]=d,e[20]=h.isError,e[21]=b,e[22]=g,e[23]=x,e[24]=j,e[25]=y,e[26]=v):v=e[26],v}function yc(t){const[e,s]=t;return{name:e,version:s.version}}function wc(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Pc(t){const e=M.c(27),{orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,status:l,diff:i,enabled:u}=t,[d]=ma(),{language:h}=d;let f,p,m;if(e[0]!==n||e[1]!==i||e[2]!==u||e[3]!==c||e[4]!==h||e[5]!==s||e[6]!==l||e[7]!==o||e[8]!==a){const P=i?Is(i):"";f=u&&!!n&&!!l&&!!i&&P!=="",m=Tt,p=wc({orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,signature:P,language:h}),e[0]=n,e[1]=i,e[2]=u,e[3]=c,e[4]=h,e[5]=s,e[6]=l,e[7]=o,e[8]=a,e[9]=f,e[10]=p,e[11]=m}else f=e[9],p=e[10],m=e[11];let b;e[12]!==n||e[13]!==i||e[14]!==h||e[15]!==s||e[16]!==l||e[17]!==o||e[18]!==a?(b=()=>hi({orgSlug:s,virtualMcpId:a,branch:n,threadId:o},{status:l,diff:i,language:h}),e[12]=n,e[13]=i,e[14]=h,e[15]=s,e[16]=l,e[17]=o,e[18]=a,e[19]=b):b=e[19];let g;e[20]!==f||e[21]!==p||e[22]!==b?(g={queryKey:p,queryFn:b,enabled:f,staleTime:1/0,gcTime:6e5,retry:jc},e[20]=f,e[21]=p,e[22]=b,e[23]=g):g=e[23];const x=m(g),j=x.data??null,y=f&&x.isFetching&&!x.data;let v;return e[24]!==j||e[25]!==y?(v={verdict:j,loading:y},e[24]=j,e[25]=y,e[26]=v):v=e[26],v}function jc(t,e){return!Za(e)&&t<1}function Dr(t){const e=M.c(30),{orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,status:l,diff:i,policy:u,judgeEnabled:d,paths:h}=t,f=d===void 0?!0:d,p=h===void 0?null:h;let m;e[0]!==i||e[1]!==f||e[2]!==u?(m=f&&fi(i,u),e[0]=i,e[1]=f,e[2]=u,e[3]=m):m=e[3];const b=m;let g;e[4]!==n||e[5]!==i||e[6]!==c||e[7]!==b||e[8]!==s||e[9]!==l||e[10]!==o||e[11]!==a?(g={orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,status:l,diff:i,enabled:b},e[4]=n,e[5]=i,e[6]=c,e[7]=b,e[8]=s,e[9]=l,e[10]=o,e[11]=a,e[12]=g):g=e[12];const{verdict:x,loading:j}=Pc(g);if(!i&&p){let w;e[13]!==p||e[14]!==u?(w=mi(p,u),e[13]=p,e[14]=u,e[15]=w):w=e[15];let k;return e[16]!==w?(k={gate:w,ready:!1},e[16]=w,e[17]=k):k=e[17],k}if(!i){let w;return e[18]===Symbol.for("react.memo_cache_sentinel")?(w={gate:{allowed:!0,reason:null},ready:!1},e[18]=w):w=e[18],w}if(!b){let w;e[19]!==i||e[20]!==u?(w=pi(i,u),e[19]=i,e[20]=u,e[21]=w):w=e[21];let k;return e[22]!==w?(k={gate:w,ready:!0},e[22]=w,e[23]=k):k=e[23],k}let y;e[24]!==j||e[25]!==x?(y=bi(x,j),e[24]=j,e[25]=x,e[26]=y):y=e[26];const v=!j;let P;return e[27]!==y||e[28]!==v?(P={gate:y,ready:v},e[27]=y,e[28]=v,e[29]=P):P=e[29],P}function Sc(t){return["main","master"].includes(t.trim().toLowerCase())}function kc(t,e,s,a){return t===0?a("thread.publishPopover.publish"):s||!Sc(e)?t===1?a("thread.publishPopover.publishOne"):a("thread.publishPopover.publishCount",{count:t}):t===1?a("thread.publishPopover.publishOneInProduction"):a("thread.publishPopover.publishCountInProduction",{count:t})}const Cc=2500;function Nc(t){const{selectedId:e,readyIds:s,lastShownId:a,liveIds:n}=t;return e===null||s.has(e)?e:a!==null&&a!==e&&n.includes(a)?a:e}function Br(t){const e=M.c(16),s=q.useRef(!1),a=xe();let n;e[0]!==t?(n=h=>{!h&&s.current||t.onOpenChange(h)},e[0]=t,e[1]=n):n=e[1];const o=n;let c;e[2]!==t.mode||e[3]!==a?(c=t.mode==="review"?a("thread.publishPopover.submitForReview"):a("thread.publishPopover.publish"),e[2]=t.mode,e[3]=a,e[4]=c):c=e[4];let l;e[5]!==c?(l=r.jsx(ba,{className:"sr-only",children:c}),e[5]=c,e[6]=l):l=e[6];let i;e[7]!==t?(i=r.jsx(Ac,{...t,publishLockRef:s}),e[7]=t,e[8]=i):i=e[8];let u;e[9]!==l||e[10]!==i?(u=r.jsxs(ga,{"aria-describedby":void 0,className:"flex h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-none flex-col md:flex-row md:h-[calc(100dvh-6rem)] md:w-[calc(100vw-6rem)] gap-0 overflow-hidden p-0 sm:max-w-none",closeButtonClassName:"top-3.5 right-3.5",children:[l,i]}),e[9]=l,e[10]=i,e[11]=u):u=e[11];let d;return e[12]!==o||e[13]!==t.open||e[14]!==u?(d=r.jsx(pa,{open:t.open,onOpenChange:o,children:u}),e[12]=o,e[13]=t.open,e[14]=u,e[15]=d):d=e[15],d}function Ac(t){const e=M.c(3),s=qt(t.virtualMcpId,t.branch),a=s.kind==="protocol"&&s.source==="github";let n;return e[0]!==a||e[1]!==t?(n=io({open:t.open,hosted:a})?r.jsx(Ic,{...t}):null,e[0]=a,e[1]=t,e[2]=n):n=e[2],n}const Rc=4,Xt="flex h-[45%] min-h-0 min-w-0 shrink-0 md:h-auto md:flex-1";function es(t){const e=M.c(5),{list:s,pane:a}=t;let n;e[0]!==s?(n=r.jsx("div",{className:"flex min-h-0 w-full flex-1 flex-col max-md:border-t md:w-[380px] md:flex-none md:shrink-0 md:border-l md:[&>[data-publish-state]>:first-child]:pr-12",children:s}),e[0]=s,e[1]=n):n=e[1];let o;return e[2]!==a||e[3]!==n?(o=r.jsxs(r.Fragment,{children:[a,n]}),e[2]=a,e[3]=n,e[4]=o):o=e[4],o}function Tn(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:X(Xt,"bg-muted/40 p-3"),children:r.jsx(ft,{className:"h-full w-full rounded-lg"})}),t[0]=e):e=t[0],e}function In(t){const e=M.c(11),{mode:s,title:a,subLine:n,trailing:o}=t,c=s==="review"?Rs:$a;let l;e[0]!==c?(l=r.jsx(c,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=c,e[1]=l):l=e[1];let i;e[2]!==l||e[3]!==a||e[4]!==o?(i=r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[l,a,o]}),e[2]=l,e[3]=a,e[4]=o,e[5]=i):i=e[5];let u;e[6]!==n?(u=n?r.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:n}):null,e[6]=n,e[7]=u):u=e[7];let d;return e[8]!==i||e[9]!==u?(d=r.jsxs(r.Fragment,{children:[i,u]}),e[8]=i,e[9]=u,e[10]=d):d=e[10],d}function Dn(t){const e=M.c(9),{draftPreviewUrl:s,t:a}=t;let n;e[0]!==s?(n=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=n):n=e[1];const o=!s;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(xs,{className:"size-4"}),e[2]=c):c=e[2];let l;e[3]!==a?(l=a("thread.publishPopover.preview"),e[3]=a,e[4]=l):l=e[4];let i;return e[5]!==n||e[6]!==o||e[7]!==l?(i=r.jsxs(ye,{type:"button",variant:"outline",onClick:n,disabled:o,children:[c,l]}),e[5]=n,e[6]=o,e[7]=l,e[8]=i):i=e[8],i}function Mr(t){const e=M.c(21),{mode:s,draftPreviewUrl:a}=t,n=xe();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(Tn,{}),e[0]=o):o=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(ft,{className:"h-3.5 w-48"}),e[1]=c):c=e[1];let l;e[2]!==s?(l=r.jsx(In,{mode:s,title:c}),e[2]=s,e[3]=l):l=e[3];let i,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Yt,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{}),r.jsx(Ut,{}),r.jsx(Ut,{})]})}),u=r.jsxs(r.Fragment,{children:[r.jsx(ft,{className:"h-3 w-20"}),r.jsx(ft,{className:"h-14 w-full rounded-lg"})]}),e[4]=i,e[5]=u):(i=e[4],u=e[5]);let d;e[6]!==a||e[7]!==n?(d=r.jsx(Dn,{draftPreviewUrl:a,t:n}),e[6]=a,e[7]=n,e[8]=d):d=e[8];const h=s==="review"?"default":"brand";let f;e[9]!==s||e[10]!==n?(f=n(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[9]=s,e[10]=n,e[11]=f):f=e[11];let p;e[12]!==h||e[13]!==f?(p=r.jsx(ye,{type:"button",variant:h,className:"flex-1",disabled:!0,children:f}),e[12]=h,e[13]=f,e[14]=p):p=e[14];let m;e[15]!==d||e[16]!==p?(m=r.jsxs("div",{className:"flex gap-2",children:[d,p]}),e[15]=d,e[16]=p,e[17]=m):m=e[17];let b;return e[18]!==m||e[19]!==l?(b=r.jsx(es,{pane:o,list:r.jsx(Bs,{state:"loading",header:l,body:i,note:u,footer:m})}),e[18]=m,e[19]=l,e[20]=b):b=e[20],b}function Tc(t){const e=M.c(26),{mode:s,draftPreviewUrl:a,message:n,onRetry:o}=t,c=xe();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:X(Xt,"bg-muted/40")}),e[0]=l):l=e[0];let i;e[1]!==c?(i=c("thread.publishPopover.loadFailed"),e[1]=c,e[2]=i):i=e[2];let u;e[3]!==i?(u=r.jsx("span",{className:"truncate",children:i}),e[3]=i,e[4]=u):u=e[4];let d;e[5]!==s||e[6]!==u?(d=r.jsx(In,{mode:s,title:u}),e[5]=s,e[6]=u,e[7]=d):d=e[7];let h;e[8]!==n?(h=r.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:n}),e[8]=n,e[9]=h):h=e[9];let f;e[10]!==a||e[11]!==c?(f=r.jsx(Dn,{draftPreviewUrl:a,t:c}),e[10]=a,e[11]=c,e[12]=f):f=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(cn,{className:"size-4"}),e[13]=p):p=e[13];let m;e[14]!==c?(m=c("thread.publishPopover.retry"),e[14]=c,e[15]=m):m=e[15];let b;e[16]!==o||e[17]!==m?(b=r.jsxs(ye,{type:"button",variant:"outline",className:"flex-1",onClick:o,children:[p,m]}),e[16]=o,e[17]=m,e[18]=b):b=e[18];let g;e[19]!==f||e[20]!==b?(g=r.jsxs("div",{className:"flex gap-2",children:[f,b]}),e[19]=f,e[20]=b,e[21]=g):g=e[21];let x;return e[22]!==g||e[23]!==d||e[24]!==h?(x=r.jsx(es,{pane:l,list:r.jsx(Bs,{state:"ready",header:d,body:h,footer:g})}),e[22]=g,e[23]=d,e[24]=h,e[25]=x):x=e[25],x}function Ic(t){const e=M.c(3),s=t.mode??"publish";let a;return e[0]!==s||e[1]!==t?(a=r.jsx(xa,{children:n=>{const{reset:o}=n;return r.jsx(va,{fallback:c=>{const{error:l,resetError:i}=c;return r.jsx(Tc,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:l?.message??"",onRetry:()=>{o(),i()}})},children:r.jsx(q.Suspense,{fallback:r.jsx(Mr,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),children:r.jsx(Dc,{...t})})})}}),e[0]=s,e[1]=t,e[2]=a):a=e[2],a}function Dc(t){const e=M.c(13),s=qt(t.virtualMcpId,t.branch);let a;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(a={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch},e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=a):a=e[3];const n=un(a);if(s.kind==="protocol"&&n){let c;return e[4]!==s||e[5]!==n||e[6]!==t?(c=s.source==="sandbox"?r.jsx($c,{...t,backend:s,cacheKey:n}):r.jsx(Mc,{...t,backend:s,cacheKey:n}),e[4]=s,e[5]=n,e[6]=t,e[7]=c):c=e[7],c}if(s.kind!=="legacy"){const c=t.mode??"publish";let l;return e[8]!==t.draftPreviewUrl||e[9]!==c?(l=r.jsx(Mr,{mode:c,draftPreviewUrl:t.draftPreviewUrl}),e[8]=t.draftPreviewUrl,e[9]=c,e[10]=l):l=e[10],l}let o;return e[11]!==t?(o=r.jsx(Bc,{...t}),e[11]=t,e[12]=o):o=e[12],o}function Bc(t){const e=M.c(52),s=Zt()?.taskId??null;let a;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?(a={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]=a):a=e[7];const n=Ir(a),o=t.mode!=="review";let c;e[8]!==t.branch||e[9]!==t.fastPreview||e[10]!==t.orgSlug||e[11]!==t.publishPolicy||e[12]!==t.virtualMcpId||e[13]!==n.allPaths||e[14]!==n.diff||e[15]!==n.status||e[16]!==o||e[17]!==s?(c={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:s,fastPreview:t.fastPreview,status:n.status,diff:n.diff,paths:n.allPaths,policy:t.publishPolicy,judgeEnabled:o},e[8]=t.branch,e[9]=t.fastPreview,e[10]=t.orgSlug,e[11]=t.publishPolicy,e[12]=t.virtualMcpId,e[13]=n.allPaths,e[14]=n.diff,e[15]=n.status,e[16]=o,e[17]=s,e[18]=c):c=e[18];const{gate:l}=Dr(c),i=n.discardablePaths;let u;e[19]!==i?(u=j=>i===null||j.every(y=>i.has(y)),e[19]=i,e[20]=u):u=e[20];const d=u;let h;e[21]!==d?(h=j=>d(j.filepaths),e[21]=d,e[22]=h):h=e[22];let f;e[23]!==d||e[24]!==n.allPaths||e[25]!==n.changedFilesTruncated?(f=!n.changedFilesTruncated&&d(n.allPaths),e[23]=d,e[24]=n.allPaths,e[25]=n.changedFilesTruncated,e[26]=f):f=e[26];let p;e[27]!==t.branch||e[28]!==n.status?(p=Pn(n.status)??t.branch,e[27]=t.branch,e[28]=n.status,e[29]=p):p=e[29];const m=n.headSha??void 0;let b;e[30]!==t.fastPreview||e[31]!==n.diff?(b=!t.fastPreview&&n.diff?{expectedDiffSignature:Is(n.diff)}:{},e[30]=t.fastPreview,e[31]=n.diff,e[32]=b):b=e[32];let g;e[33]!==l||e[34]!==n.allPaths||e[35]!==n.bodiesFailed||e[36]!==n.bodiesPending||e[37]!==n.cardsPending||e[38]!==n.changedFilesTotal||e[39]!==n.changedFilesTruncated||e[40]!==n.diff||e[41]!==n.refresh||e[42]!==n.summary||e[43]!==h||e[44]!==f||e[45]!==p||e[46]!==m||e[47]!==b?(g={summary:n.summary,allPaths:n.allPaths,canDiscard:h,canDiscardAll:f,changedFilesTotal:n.changedFilesTotal,changedFilesTruncated:n.changedFilesTruncated,diff:n.diff,bodiesPending:n.bodiesPending,bodiesFailed:n.bodiesFailed,cardsPending:n.cardsPending,refresh:n.refresh,gate:l,headBranch:p,expectedHeadSha:m,...b,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]=f,e[45]=p,e[46]=m,e[47]=b,e[48]=g):g=e[48];let x;return e[49]!==t||e[50]!==g?(x=r.jsx(Bn,{...t,source:g}),e[49]=t,e[50]=g,e[51]=x):x=e[51],x}function $r(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 Mc(t){const e=M.c(24),{backend:s,cacheKey:a,...n}=t,o=Rn({backend:s,cacheKey:a,scope:{orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch}}),c=s.source==="github",l=Et.hostedPublishReview(n.orgSlug,n.virtualMcpId,n.branch);let i;e[0]!==n.branch||e[1]!==n.orgSlug||e[2]!==n.virtualMcpId?(i=()=>ti({orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch}),e[0]=n.branch,e[1]=n.orgSlug,e[2]=n.virtualMcpId,e[3]=i):i=e[3];let u;e[4]!==c||e[5]!==l||e[6]!==i?(u={queryKey:l,queryFn:i,enabled:c,staleTime:0},e[4]=c,e[5]=l,e[6]=i,e[7]=u):u=e[7];const d=Tt(u);let h;e[8]!==s||e[9]!==o?(h=$r(o,s),e[8]=s,e[9]=o,e[10]=h):h=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f={allowed:!0,reason:null},e[11]=f):f=e[11];let p;e[12]!==d.data?.alsoChanged?(p=d.data?.alsoChanged??[],e[12]=d.data?.alsoChanged,e[13]=p):p=e[13];let m;e[14]!==p?(m=new Set(p),e[14]=p,e[15]=m):m=e[15];let b;e[16]!==c||e[17]!==n.branch||e[18]!==h||e[19]!==m?(b={...h,gate:f,headBranch:n.branch,hosted:c,alsoChanged:m,otherWork:!1},e[16]=c,e[17]=n.branch,e[18]=h,e[19]=m,e[20]=b):b=e[20];let g;return e[21]!==n||e[22]!==b?(g=r.jsx(Bn,{...n,source:b}),e[21]=n,e[22]=b,e[23]=g):g=e[23],g}function $c(t){const e=M.c(58);let s,a,n;e[0]!==t?({backend:s,cacheKey:a,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n):(s=e[1],a=e[2],n=e[3]);const o=Zt()?.taskId??null;let c;e[4]!==n.branch||e[5]!==n.orgSlug||e[6]!==n.virtualMcpId?(c={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch},e[4]=n.branch,e[5]=n.orgSlug,e[6]=n.virtualMcpId,e[7]=c):c=e[7];let l;e[8]!==s||e[9]!==a||e[10]!==c?(l={backend:s,cacheKey:a,scope:c},e[8]=s,e[9]=a,e[10]=c,e[11]=l):l=e[11];const i=Rn(l);let u;e[12]!==n.baseBranch||e[13]!==n.branch||e[14]!==n.fastPreview||e[15]!==n.orgSlug||e[16]!==n.recoverSandbox||e[17]!==n.virtualMcpId||e[18]!==o?(u={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:o,baseBranch:n.baseBranch,fastPreview:n.fastPreview,recoverSandbox:n.recoverSandbox},e[12]=n.baseBranch,e[13]=n.branch,e[14]=n.fastPreview,e[15]=n.orgSlug,e[16]=n.recoverSandbox,e[17]=n.virtualMcpId,e[18]=o,e[19]=u):u=e[19];const d=Ir(u),h=n.mode!=="review";let f;e[20]!==d.allPaths||e[21]!==d.diff||e[22]!==d.status||e[23]!==n.branch||e[24]!==n.fastPreview||e[25]!==n.orgSlug||e[26]!==n.publishPolicy||e[27]!==n.virtualMcpId||e[28]!==h||e[29]!==o?(f={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:o,fastPreview:n.fastPreview,status:d.status,diff:d.diff,paths:d.allPaths,policy:n.publishPolicy,judgeEnabled:h},e[20]=d.allPaths,e[21]=d.diff,e[22]=d.status,e[23]=n.branch,e[24]=n.fastPreview,e[25]=n.orgSlug,e[26]=n.publishPolicy,e[27]=n.virtualMcpId,e[28]=h,e[29]=o,e[30]=f):f=e[30];const{gate:p}=Dr(f);let m;if(e[31]!==d.allPaths||e[32]!==i){let k;e[34]!==i?(k=N=>{const R=Cn(N);return R===null?!wn(N):!Object.hasOwn(i.changes.changes,R)},e[34]=i,e[35]=k):k=e[35],m=d.allPaths.some(k),e[31]=d.allPaths,e[32]=i,e[33]=m}else m=e[33];const b=m;let g;e[36]!==s||e[37]!==i?(g=$r(i,s),e[36]=s,e[37]=i,e[38]=g):g=e[38];let x;e[39]!==d||e[40]!==i?(x=()=>Promise.all([i.refresh(),d.refresh()]),e[39]=d,e[40]=i,e[41]=x):x=e[41];let j;e[42]!==d.status||e[43]!==n.branch?(j=Pn(d.status)??n.branch,e[42]=d.status,e[43]=n.branch,e[44]=j):j=e[44];const y=d.headSha??void 0;let v;e[45]!==d.diff?(v=d.diff?{expectedDiffSignature:Is(d.diff)}:{},e[45]=d.diff,e[46]=v):v=e[46];let P;e[47]!==p||e[48]!==b||e[49]!==y||e[50]!==v||e[51]!==g||e[52]!==x||e[53]!==j?(P={...g,refresh:x,gate:p,headBranch:j,expectedHeadSha:y,...v,hosted:!1,otherWork:b},e[47]=p,e[48]=b,e[49]=y,e[50]=v,e[51]=g,e[52]=x,e[53]=j,e[54]=P):P=e[54];let w;return e[55]!==n||e[56]!==P?(w=r.jsx(Bn,{...n,source:P}),e[55]=n,e[56]=P,e[57]=w):w=e[57],w}function Bn(t){const e=M.c(131),{source:s,publishLockRef:a,onOpenChange:n,mode:o,fastPreview:c,orgSlug:l,virtualMcpId:i,branch:u,baseBranch:d,repoTarget:h,owner:f,repo:p,draftPreviewUrl:m,destinationHost:b,previewServerUrl:g,compareDraft:x,lastPublishedPr:j,onRequestApproval:y,openPullRequest:v,onPullRequestChanged:P,onPublished:w,notLive:k}=t,N=o===void 0?"publish":o,R=j===void 0?null:j,C=v===void 0?null:v,A=k===void 0?!1:k,S=xe(),[E]=ma(),{language:$}=E,I=Zt()?.taskId??null,{data:T}=ks.useSession(),D=Pa(ja(l,i,u)),{allPaths:Y,changedFilesTotal:ae,changedFilesTruncated:H,diff:_,bodiesFailed:z,refresh:ee,gate:Q,hosted:B,otherWork:ie}=s;let U;e[0]!==x||e[1]!==s.bodiesPending||e[2]!==s.cardsPending||e[3]!==s.summary?(U={summary:s.summary,cardsPending:s.cardsPending,bodiesPending:s.bodiesPending,compareDraft:x},e[0]=x,e[1]=s.bodiesPending,e[2]=s.cardsPending,e[3]=s.summary,e[4]=U):U=e[4];const oe=U;let J;e[5]!==B?(J={hosted:B},e[5]=B,e[6]=J):J=e[6];const se=lo(oe,J),{summary:F,cardsPending:te,bodiesPending:re,compareDraft:he}=se.shown,[G,pe]=q.useState(null),[Z,L]=q.useState(!1),[K,ce]=q.useState(Fc);let je;e[7]===Symbol.for("react.memo_cache_sentinel")?(je=W=>ce(be=>be.has(W)?be:new Set(be).add(W)),e[7]=je):je=e[7];const fe=je,[Ee,O]=q.useState(null);let ne;e[8]===Symbol.for("react.memo_cache_sentinel")?(ne=[],e[8]=ne):ne=e[8];const[Le,_e]=q.useState(ne);let Ue;e[9]!==s.v8?(Ue=W=>{O(W),_e(be=>[W,...be.filter(me=>me!==W)]),s.v8&&setTimeout(()=>fe(W),Cc)},e[9]=s.v8,e[10]=Ue):Ue=e[10];const mt=Ue,[st,we]=q.useState(null);let De;e[11]!==G||e[12]!==F?(De=Co(G,Ro(F)),e[11]=G,e[12]=F,e[13]=De):De=e[13];const $e=De,Be=[...F.pages,...F.blocks,...F.other],Pe=Be.find(W=>Ie(W)===Ee)??Be[0]??null,Me=Pe?Ie(Pe):null,Se=[...new Set([...Me?[Me]:[],...Le,...Be.map(Ie)])].filter(W=>Be.some(be=>Ie(be)===W)).slice(0,Rc),Fe=!!s.v8,[nt,pt]=q.useState(null),Re=Fe?Nc({selectedId:Me,readyIds:K,lastShownId:nt,liveIds:Se}):Me;Fe&&Re===Me&&Re!==nt&&pt(Re);const de=N==="review"&&!B,V=te?"loading":re?"manifest":"ready",ve=C?.state==="open",ke=s.headBranch,Ce=T?.user;let Ne;e[14]!==Ce?(Ne=ir(Ce),e[14]=Ce,e[15]=Ne):Ne=e[15];let qe;e[16]!==s.expectedDiffSignature?(qe=s.expectedDiffSignature?{expectedDiffSignature:s.expectedDiffSignature}:{},e[16]=s.expectedDiffSignature,e[17]=qe):qe=e[17];let at;e[18]!==d||e[19]!==u||e[20]!==c||e[21]!==l||e[22]!==f||e[23]!==p||e[24]!==h||e[25]!==s.expectedHeadSha||e[26]!==s.headBranch||e[27]!==Ne||e[28]!==qe||e[29]!==I||e[30]!==i?(at={orgSlug:l,virtualMcpId:i,branch:u,threadId:I,fastPreview:c,baseBranch:d,target:h,owner:f,repo:p,headBranch:ke,coAuthor:Ne,expectedHeadSha:s.expectedHeadSha,...qe},e[18]=d,e[19]=u,e[20]=c,e[21]=l,e[22]=f,e[23]=p,e[24]=h,e[25]=s.expectedHeadSha,e[26]=s.headBranch,e[27]=Ne,e[28]=qe,e[29]=I,e[30]=i,e[31]=at):at=e[31];const bt=at,gt=de?"review":"publish",We=T?.user?.name;let Je;e[32]!==Y||e[33]!==b||e[34]!==B||e[35]!==$e||e[36]!==n||e[37]!==w||e[38]!==P||e[39]!==a||e[40]!==ee||e[41]!==s.protocol||e[42]!==gt||e[43]!==We||e[44]!==bt?(Je={mode:gt,target:bt,note:$e,allPaths:Y,destinationHost:b,publishLockRef:a,onOpenChange:n,refresh:ee,onPullRequestChanged:P,onPublished:w,hosted:B,authorName:We,protocol:s.protocol},e[32]=Y,e[33]=b,e[34]=B,e[35]=$e,e[36]=n,e[37]=w,e[38]=P,e[39]=a,e[40]=ee,e[41]=s.protocol,e[42]=gt,e[43]=We,e[44]=bt,e[45]=Je):Je=e[45];const{isPublishing:Ae,publishError:rt,publishErrorDetail:lt,submit:xt,discardChange:It,discardAll:vt}=fc(Je),Xe=Na(l,i).phase==="saving",Ye=B&&A&&F.count===0,Ze=F.count>0||ie||Ye,Dt=!Ae&&Ze&&(de||Q.allowed);let it;e[46]!==d||e[47]!==de||e[48]!==Ye||e[49]!==s.v8||e[50]!==F.count||e[51]!==S?(it=de?F.count===0?S("thread.publishPopover.submitForReview"):F.count===1?S("thread.publishPopover.submitOneForReview"):S("thread.publishPopover.submitCountForReview",{count:F.count}):Ye?S("thread.publishPopover.notLive"):kc(F.count,d,!!s.v8,S),e[46]=d,e[47]=de,e[48]=Ye,e[49]=s.v8,e[50]=F.count,e[51]=S,e[52]=it):it=e[52];const yt=it;let ot;e:{if(de&&ve){let me;e[53]!==C.number||e[54]!==S?(me=S("thread.publishPopover.updatesPullRequest",{number:C.number}),e[53]=C.number,e[54]=S,e[55]=me):me=e[55],ot=me;break e}const W=R;if(!W?.mergedAt){ot=null;break e}let be;if(e[56]!==$||e[57]!==W||e[58]!==S){const me=Zr(new Date(W.mergedAt),$),Te=dc(W);be=Te?S("thread.publishPopover.lastPublishedBy",{when:me,name:Te}):S("thread.publishPopover.lastPublished",{when:me}),e[56]=$,e[57]=W,e[58]=S,e[59]=be}else be=e[59];ot=be}const Bt=ot;let Mt;e[60]!==de||e[61]!==F.count||e[62]!==S?(Mt=de?S("thread.publishPopover.submitForReview"):F.count===1?S("thread.publishPopover.publishOne"):F.count>1?S("thread.publishPopover.publishCount",{count:F.count}):S("thread.publishPopover.publish"),e[60]=de,e[61]=F.count,e[62]=S,e[63]=Mt):Mt=e[63];const _t=Mt,$t=(W,be)=>be.length===0?null:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"px-0.5 text-2xs font-medium text-muted-foreground",children:W}),be.map(me=>{const Te=Ie(me);return r.jsx(jr,{change:me,bodyPending:re,selected:Pe!==null&&Ie(Pe)===Te,onSelect:()=>mt(Te),confirming:st===Te,onConfirmingChange:ge=>we(ge?Te:null),onDiscard:s.canDiscard(me)?()=>{It(me)}:void 0,isPublishing:Ae,isDiscarding:Xe,v8:!!s.v8,alsoChangedOnMain:!!s.alsoChanged&&s.alsoChanged.has(me.entry?.name??me.blockKey??"")},Te)})]});let et;e:{if(de||!Ze){et=null;break e}if(Q.pending){let Te;e[64]===Symbol.for("react.memo_cache_sentinel")?(Te=r.jsx(Qt,{className:"size-3.5 motion-reduce:animate-none"}),e[64]=Te):Te=e[64];let ge;e[65]!==S?(ge=S("thread.publishPopover.reviewing"),e[65]=S,e[66]=ge):ge=e[66];let At;e[67]!==ge?(At=r.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[Te,ge]}),e[67]=ge,e[68]=At):At=e[68],et=At;break e}if(Q.allowed){et=null;break e}let W;e[69]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsx(wa,{className:"mt-0.5 size-3.5 shrink-0"}),e[69]=W):W=e[69];let be;e[70]!==Q.reason||e[71]!==S?(be=Q.reason??S("thread.publishPopover.needsReviewGeneric"),e[70]=Q.reason,e[71]=S,e[72]=be):be=e[72];let me;e[73]!==be?(me=r.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[W,r.jsx("span",{children:be})]}),e[73]=be,e[74]=me):me=e[74],et=me}const wt=et;let ct;e[75]!==vt||e[76]!==Z||e[77]!==Xe||e[78]!==Ae||e[79]!==s.canDiscardAll||e[80]!==F.count||e[81]!==S?(ct=F.count<=1||!s.canDiscardAll?null:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"ml-auto shrink-0 text-2xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>L(!0),disabled:Ae||Xe,children:S("thread.publishPopover.discardAll")}),r.jsx(rn,{open:Z,onOpenChange:L,children:r.jsxs(an,{children:[r.jsxs(en,{children:[r.jsx(Ys,{children:S("thread.publishPopover.discardAllTitle")}),r.jsx(Zs,{children:S("thread.publishPopover.discardAllConfirm")})]}),r.jsxs(nn,{children:[r.jsx(tn,{children:S("thread.publishDialog.cancel")}),r.jsx(sn,{onClick:()=>{vt()},disabled:Xe,className:X(ya({variant:"destructive"})),children:S("thread.publishPopover.discardAll")})]})]})})]}),e[75]=vt,e[76]=Z,e[77]=Xe,e[78]=Ae,e[79]=s.canDiscardAll,e[80]=F.count,e[81]=S,e[82]=ct):ct=e[82];const Pt=ct,jt=te?r.jsx(Yt,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{}),r.jsx(Ut,{})]})}):F.count===0&&ie?r.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:S("thread.publishPopover.onlyOtherWork")}):Ye?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx($a,{className:"mb-1 size-5 text-muted-foreground"}),r.jsx("p",{className:"text-sm font-medium",children:S("thread.publishPopover.notLiveBody")}),r.jsx("p",{className:"text-xs text-muted-foreground",children:S("thread.publishPopover.notLiveHint")})]}):F.count===0?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx(vn,{className:"mb-1 size-5 text-success"}),r.jsx("p",{className:"text-sm font-medium",children:S(de?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),r.jsx("p",{className:"text-xs text-muted-foreground",children:S(de?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):r.jsxs(Yt,{children:[H?r.jsx("p",{className:"text-2xs text-muted-foreground",children:S("thread.publishPopover.showingFirst",{shown:F.count,total:ae})}):null,$t(S("thread.publishPopover.pagesGroup"),F.pages),$t(S("thread.publishPopover.blocksGroup"),F.blocks),$t(S("thread.publishPopover.otherGroup"),F.other),z?r.jsx("p",{className:"text-2xs text-muted-foreground",children:S("thread.publishPopover.detailsUnavailable")}):null,ie?r.jsx("p",{className:"text-2xs text-muted-foreground",children:S("thread.publishPopover.alsoOtherWork")}):null]}),St=te?r.jsx(Tn,{}):Pe?r.jsx("div",{className:X(Xt,"relative"),children:Be.filter(W=>Se.includes(Ie(W))).map(W=>r.jsx("div",{className:X("absolute inset-0 flex",Fe?Ie(W)===Re?"z-10":"pointer-events-none opacity-0":Ie(W)!==Me&&"hidden"),inert:Fe&&Ie(W)!==Re,"aria-hidden":Fe&&Ie(W)!==Re?!0:void 0,children:r.jsx(Rr,{change:W,diff:_,bodyPending:re,previewServerUrl:g,draft:he,lastPage:D,v8:s.v8,onReady:Fe?()=>fe(Ie(W)):void 0})},Ie(W)))}):r.jsx("div",{className:X(Xt,"bg-muted/40")});let ze;e[83]!==yt?(ze=r.jsx("span",{className:"truncate",children:yt}),e[83]=yt,e[84]=ze):ze=e[84];let He;e[85]!==Pt||e[86]!==N||e[87]!==Bt||e[88]!==ze?(He=r.jsx(In,{mode:N,title:ze,subLine:Bt,trailing:Pt}),e[85]=Pt,e[86]=N,e[87]=Bt,e[88]=ze,e[89]=He):He=e[89];let Ke;e[90]!==Ae||e[91]!==de||e[92]!==$e||e[93]!==F.count||e[94]!==S?(Ke=F.count===0?null:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-sm font-medium",children:S(de?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),r.jsx(Gl,{value:$e,onChange:W=>pe(W.target.value),placeholder:S(de?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,maxLength:vs,className:"resize-none text-sm",disabled:Ae})]}),e[90]=Ae,e[91]=de,e[92]=$e,e[93]=F.count,e[94]=S,e[95]=Ke):Ke=e[95];let Ve;e[96]!==m||e[97]!==S?(Ve=r.jsx(Dn,{draftPreviewUrl:m,t:S}),e[96]=m,e[97]=S,e[98]=Ve):Ve=e[98];let Ge;e[99]!==Dt||e[100]!==Q||e[101]!==Ze||e[102]!==B||e[103]!==Ae||e[104]!==de||e[105]!==y||e[106]!==_t||e[107]!==se||e[108]!==xt||e[109]!==S?(Ge=!de&&!B&&Ze&&!Q.allowed&&!Q.pending?r.jsx(ye,{type:"button",className:"flex-1",onClick:y,disabled:Ae,children:S("thread.publishPopover.requestApproval")}):r.jsxs(ye,{type:"button",variant:de?"default":"brand",className:"flex-1",onClick:()=>{se.hold(),xt().then(W=>{W===!1&&se.release()})},disabled:!Dt,children:[Ae?r.jsx(Qt,{className:"size-4 motion-reduce:animate-none"}):null,Ae?S(de?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):_t]}),e[99]=Dt,e[100]=Q,e[101]=Ze,e[102]=B,e[103]=Ae,e[104]=de,e[105]=y,e[106]=_t,e[107]=se,e[108]=xt,e[109]=S,e[110]=Ge):Ge=e[110];let Qe;e[111]!==Ve||e[112]!==Ge?(Qe=r.jsxs("div",{className:"flex gap-2",children:[Ve,Ge]}),e[111]=Ve,e[112]=Ge,e[113]=Qe):Qe=e[113];let dt;e[114]!==rt||e[115]!==lt||e[116]!==S?(dt=rt?r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-destructive",children:rt}),lt?r.jsx(fl,{label:S("siteEditor.details"),detail:lt}):null]}):null,e[114]=rt,e[115]=lt,e[116]=S,e[117]=dt):dt=e[117];let ue;e[118]!==Qe||e[119]!==dt?(ue=r.jsxs(r.Fragment,{children:[Qe,dt]}),e[118]=Qe,e[119]=dt,e[120]=ue):ue=e[120];let ut;e[121]!==jt||e[122]!==wt||e[123]!==V||e[124]!==He||e[125]!==Ke||e[126]!==ue?(ut=r.jsx(Bs,{state:V,header:He,body:jt,note:Ke,gate:wt,footer:ue}),e[121]=jt,e[122]=wt,e[123]=V,e[124]=He,e[125]=Ke,e[126]=ue,e[127]=ut):ut=e[127];let Ht;return e[128]!==St||e[129]!==ut?(Ht=r.jsx(es,{pane:St,list:ut}),e[128]=St,e[129]=ut,e[130]=Ht):Ht=e[130],Ht}function Fc(){return new Set}function Ec(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return Si[t].short}const _c=new Set(["failure","timed_out","cancelled","action_required"]);function Fr(t){return t.status==="completed"&&_c.has(t.conclusion)}function Mn(t){return t.status==="queued"||t.status==="in_progress"}function ps(t){return t.isPending&&t.fetchStatus!=="idle"}function Oc(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr-page"}}function Rt(t,e,s){return e?[...t,Oc(s)]:t}function ht(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 aa(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function hs(t,e,s){if(e.filter(Mn).length===0)return t;const n=e.filter(o=>o.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:n,total:e.length})}}function Lc(t){const{lifecycle:e,branch:s,pr:a,checks:n,reviews:o,loading:c,t:l}=t;if(c)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&&Ec(t.claimPhase.kind)||l("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:l("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:l("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||l("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:l("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:l("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:l("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:l("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForBranchTooltip"),menu:[]};const i=s,u=i.unpushed>0&&!(a&&i.headSha&&a.headSha&&i.headSha===a.headSha);if(t.noReviewableDiff&&!a)return{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:i.base}),menu:ht([],i,l)};if(i.workingTreeDirty||u)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ht(Rt([aa(l)],a,l),i,l)};if(ar("no local work — checking PR/sync state",{workingTreeDirty:i.workingTreeDirty,unpushed:i.unpushed,aheadOfBase:i.aheadOfBase,behindBase:i.behindBase,branch:i.branch,base:i.base,prMerged:a?.merged??null,prState:a?.state??null}),a?.merged)return!!i.headSha&&!!a.headSha&&i.headSha!==a.headSha?{label:l("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:l("thread.headerActions.openNewPrTooltip"),menu:ht(Rt([],a,l),i,l)}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.prMergedTooltip",{prNumber:String(a.number),base:a.base}),menu:ht(Rt([],a,l),i,l)};if(i.aheadOfBase>0){if(a&&a.state==="closed"&&!a.merged)return{label:l("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:l("thread.headerActions.reopenPrTooltip",{prNumber:String(a.number)}),menu:ht(Rt([],a,l),i,l)};if(!a)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ht([aa(l)],i,l)};if((o?.mergeableState??"unknown")==="dirty")return{label:l("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:l("thread.cmsActions.resolveOnProvider"),action:"open-pr-page"}]};const h=n.filter(Mn).length,f=n.filter(Fr).map(m=>m.name);if(h===0&&f.length>0)return{label:l("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:l("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:ht(Rt([{key:"publish-anyway",label:l("thread.headerActions.publishAnyway"),action:"merge",tooltip:l("thread.headerActions.squashMergeTooltip",{prNumber:String(a.number),base:a.base})}],a,l),i,l)};if(o?.draft)return hs({label:l("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:l("thread.headerActions.markDraftReadyTooltip"),menu:ht(Rt([],a,l),i,l)},n,l);const p=o?.unresolvedConversations??0;return p>0?hs({label:l("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:l("thread.headerActions.unresolvedConversationsTooltip",{count:String(p)}),menu:ht(Rt([],a,l),i,l)},n,l):o?.missingRequiredApprovals?hs({label:l("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:l("thread.headerActions.waitingForApprovalsTooltip"),menu:ht(Rt([],a,l),i,l)},n,l):hs({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:ht(Rt([{key:"review",label:l("thread.headerActions.review"),action:"review"}],a,l),i,l)},n,l)}return i.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:i.base}),menu:[]}}function ra(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr"}}function fs(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 la(t,e,s,a){const n=e.length;if(n===0)return t;if(e.filter(Mn).length>0){const l=e.filter(u=>u.status==="completed").length,i=a("thread.cmsActions.checksRunning",{done:l,total:n});return s==="loading"?{...t,loading:!0,tooltip:i}:{...t,tooltip:i}}const c=e.filter(Fr).length;return c>0?{...t,variant:"warning",tooltip:a("thread.cmsActions.checksFailing",{failed:c,total:n})}:t}function Uc(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function qc(t){return ps(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:ps(t.checksQuery)||ps(t.reviewsQuery)}function zc(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function Hc(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 Kc(t,e){return e?.notLive&&!t.action&&!t.loading?{label:e.t("thread.publishPopover.publish"),action:"publish",variant:"brand",tooltip:e.t("thread.cmsActions.notLiveTooltip"),status:e.t("thread.cmsActions.notLive"),menu:[]}:{...t,menu:[]}}function Vc(t){if(!t)return!1;const{current:e,commits:s}=t;return e?s.findIndex(a=>a.sha===e.revision)>0:!1}function Gc(t){const{branch:e,pr:s,checks:a,reviews:n,publishing:o,saving:c,loading:l,publishableChangeCount:i,t:u}=t;if(e.kind!=="ready"&&t.statusError)return{label:u("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(l||e.kind!=="ready")return{label:u("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:u("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:u("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(c)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?la({label:u("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:fs([ra(u)],e,u)},a,"loading",u):la({label:u("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:fs([ra(u)],e,u)},a,"none",u)}return Uc(s,e)?{label:u("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:fs([],e,u)}:zc(e,i)?{label:u("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:fs([{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 Qc(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function Er(t){const e=M.c(4);let s;e[0]!==t?(s=Ml(t),e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a={...s,select:Wc},e[2]=s,e[3]=a):a=e[3],Tt(a)}function Wc(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:Qc(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function ia(t,e){return t==="open-pr"||e==="resolve-on-provider"?r.jsx(Ga,{size:16}):t==="publish"?r.jsx(Fa,{className:"size-4"}):t==="get-latest"||t==="retry-status"?r.jsx(cn,{className:"size-4"}):r.jsx(Rs,{className:"size-4"})}function Jc(t){const e=M.c(65),{virtualMcpId:s}=t,a=xe(),{org:n}=Cs(),o=Ns(),c=pn(s),{data:l}=ks.useSession(),{deleteRelease:i}=hn(s),{currentBranch:u,setCurrentTaskBranch:d,taskId:h,createTask:f}=Sa();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={open:!1,mode:"publish"},e[0]=p):p=e[0];const[m,b]=q.useState(p);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=V=>b({open:!0,mode:V}),e[1]=g):g=e[1];const x=g,j=qa(c),y=j.status==="attached"||j.status==="public-clone"?j.repo:null,{previewServerUrl:v}=bn(s),P=u?Pa(ja(n.slug,s,u)):null,w=P?xn(P.path,P.params):"/",k=El(u?{orgSlug:n.slug,virtualMcpId:s,branch:u,previewServerUrl:v,path:w}:null);let N;e[2]!==u||e[3]!==n.slug||e[4]!==s?(N=u?{orgSlug:n.slug,virtualMcpId:s,branch:u}:null,e[2]=u,e[3]=n.slug,e[4]=s,e[5]=N):N=e[5];const R=_l(N),C=qt(s,u),A=C.kind==="protocol"&&C.source==="github";let S;e[6]!==u||e[7]!==n.slug||e[8]!==s?(S=u?{orgSlug:n.slug,virtualMcpId:s,branch:u}:null,e[6]=u,e[7]=n.slug,e[8]=s,e[9]=S):S=e[9];const E=un(S),$=Aa(A?C:null,E);let I;e[10]!==A?(I={enabled:A},e[10]=A,e[11]=I):I=e[11];const T=si(n.slug,s,I),D=A&&Vc(T.data?.pages[0]);let Y;e[12]!==n.slug||e[13]!==s?(Y=ml(n.slug,s),e[12]=n.slug,e[13]=s,e[14]=Y):Y=e[14];const ae=Ol(Y,A?R:null),H=A?Ll(v,w,ae):k.url,_=u??"",z=h??null;let ee;e[15]!==n.slug||e[16]!==_||e[17]!==z||e[18]!==s?(ee=Ya({orgSlug:n.slug,virtualMcpId:s,branch:_,threadId:z}),e[15]=n.slug,e[16]=_,e[17]=z,e[18]=s,e[19]=ee):ee=e[19];const Q=!!u&&C.kind!=="pending"&&!A;let B;e[20]!==Q||e[21]!==ee?(B={...ee,enabled:Q},e[20]=Q,e[21]=ee,e[22]=B):B=e[22];const ie=Tt(B),U=A?null:ie.data??null,oe=A?Hc($.data,u??""):null,J=oe?oe.branchMeta:U?{kind:"ready",branch:Pn(U)??u??"",base:U.base??"main",workingTreeDirty:gi(U),unpushed:U.unpushed??0,aheadOfBase:U.aheadOfBase??0,behindBase:U.behindBase??0,headSha:U.headSha??""}:{kind:"unknown"},se=oe?oe.publishableChangeCount:U?.changedFiles?yr({files:U.changedFiles}).count:null,F=A?$:ie,te=(J.kind==="ready"?J.branch:null)??u??null,re=J.kind==="ready"?J.base:"main",he=za({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",branch:te}),G=he.data??null,pe=Ha({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",base:re}),Z=Ka({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",branch:te}),L=Er({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",branch:te});let K;e[23]!==Z||e[24]!==G||e[25]!==he||e[26]!==L?(K=qc({pr:G,prQuery:he,checksQuery:Z,reviewsQuery:L}),e[23]=Z,e[24]=G,e[25]=he,e[26]=L,e[27]=K):K=e[27];const ce=K;let je;e[28]!==he?(je=async()=>{await he.refetch()},e[28]=he,e[29]=je):je=e[29];const fe=je,Ee=Fn({mutationFn:()=>ao({hosted:A,branch:u,baseBranch:re,nextBranch:()=>fn(mn(l?.user)),setCurrentTaskBranch:d,deleteRelease:i}),onError:Zc});let O;e[30]!==n.slug||e[31]!==h||e[32]!==s?(O=async V=>(await Xa({orgSlug:n.slug,virtualMcpId:s,branch:V.branch,threadId:h??null},V.base),V),e[30]=n.slug,e[31]=h,e[32]=s,e[33]=O):O=e[33];let ne;e[34]!==u||e[35]!==n.slug||e[36]!==o||e[37]!==a||e[38]!==h||e[39]!==s?(ne=async V=>{Oe.success(a("thread.headerActions.syncedWithBase",{base:V.base})),await Promise.all([o.invalidateQueries({queryKey:tr({orgSlug:n.slug,virtualMcpId:s,branch:u??V.branch,threadId:h??null})}),o.invalidateQueries({queryKey:Et.decofile(`${n.slug}/${s}/${V.branch}`)})])},e[34]=u,e[35]=n.slug,e[36]=o,e[37]=a,e[38]=h,e[39]=s,e[40]=ne):ne=e[40];let Le;e[41]!==O||e[42]!==ne?(Le={mutationFn:O,onSuccess:ne,onError:Yc},e[41]=O,e[42]=ne,e[43]=Le):Le=e[43];const _e=Fn(Le),Ue=Ra(n.slug,s),mt=Ee.isPending,st=Gc({branch:J,pr:G,checks:Z.data??[],reviews:L.data??null,publishing:mt,saving:Ue,syncing:_e.isPending,statusRetrying:F.isFetching&&!!F.error,statusError:F.error instanceof Error?F.error.message:F.error?String(F.error):null,loading:!!ce,publishableChangeCount:se,t:a}),we=A?Kc(st,{notLive:D,t:a}):st,De=we.autoRun&&J.kind==="ready"&&y&&v?`${te}@${J.headSha}`:null,$e=q.useRef(null);if(q.useEffect(()=>{!De||!te||$e.current!==De&&($e.current=De,_e.mutate({branch:te,base:re}))},[De,te,re,_e]),j.status==="detached"){let V;e[44]!==a?(V=a("thread.headerActions.reconnectGithub"),e[44]=a,e[45]=V):V=e[45];let ve;e[46]!==V?(ve=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{children:r.jsx(ye,{size:"sm",variant:"outline",disabled:!0,children:V})})}),e[46]=V,e[47]=ve):ve=e[47];let ke;e[48]!==a?(ke=a("thread.headerActions.githubConnectionRemoved"),e[48]=a,e[49]=ke):ke=e[49];let Ce;e[50]!==ke?(Ce=r.jsx(Nt,{children:ke}),e[50]=ke,e[51]=Ce):Ce=e[51];let Ne;return e[52]!==ve||e[53]!==Ce?(Ne=r.jsx(As,{children:r.jsxs(kt,{children:[ve,Ce]})}),e[52]=ve,e[53]=Ce,e[54]=Ne):Ne=e[54],Ne}if(!c)return null;if(!y||!v){const V=y?"noPreviewServer":"noRepo";let ve;e[55]!==u||e[56]!==f?(ve=u?()=>{const Ce=f?.({runtime:"sandbox",branch:u});Ce&&el("coding_session_started",{thread_id:Ce})}:void 0,e[55]=u,e[56]=f,e[57]=ve):ve=e[57];let ke;return e[58]!==V||e[59]!==ve?(ke=r.jsx(ed,{reason:V,onStartCodingSession:ve}),e[58]=V,e[59]=ve,e[60]=ke):ke=e[60],ke}if(!u)return null;const Be=V=>{switch(V){case"publish":{x("publish");return}case"request-approval":{x("review");return}case"get-latest":{if(!te||_e.isPending)return;_e.mutate({branch:te,base:re});return}case"retry-status":{F.refetch();return}case"open-pr":{G?.htmlUrl&&window.open(G.htmlUrl,"_blank","noopener,noreferrer");return}}};let Pe;e[61]!==Be?(Pe=V=>({key:V.key,label:V.label,icon:ia(V.action,V.key),...V.tooltip?{tooltip:V.tooltip}:{},onSelect:()=>Be(V.action)}),e[61]=Be,e[62]=Pe):Pe=e[62];const Me=we.menu.map(Pe),Se=we.action,Fe=we.label,nt=we.variant,pt=!!we.loading;let Re;e[63]!==a?(Re=a("thread.cmsActions.moreActionsAriaLabel"),e[63]=a,e[64]=Re):Re=e[64];const de=r.jsx(lr,{size:"sm",label:Fe,variant:nt,disabled:!!we.disabled||!Se,loading:pt,...Se&&!we.loading?{icon:ia(Se)}:{},...we.tooltip?{tooltip:we.tooltip}:{},items:Me,menuAriaLabel:Re,onClick:Se?()=>Be(Se):void 0});return r.jsxs(r.Fragment,{children:[we.status?r.jsx("span",{className:"mr-1 hidden shrink-0 text-xs text-muted-foreground sm:inline",children:we.status}):null,de,u?r.jsx(Br,{open:m.open,mode:m.mode,fastPreview:!0,notLive:D,onOpenChange:V=>{V||b(Xc)},orgSlug:n.slug,virtualMcpId:s,branch:u,baseBranch:re,repoTarget:tt(y),owner:y.owner,repo:y.name,publishPolicy:er(c?.metadata?.publishPolicy),draftPreviewUrl:H,destinationHost:k.host,previewServerUrl:v,compareDraft:R?{kind:"pointer",pointer:R,...ae?{link:ae}:{}}:null,lastPublishedPr:pe.data??null,onRequestApproval:()=>x("review"),openPullRequest:G?.state==="open"?G:null,onPullRequestChanged:fe,onPublished:()=>Ee.mutateAsync()}):null]})}function Xc(t){return{...t,open:!1}}function Yc(t){Oe.error(t instanceof Error?t.message:String(t))}function Zc(t){console.error("site editor: settling after publish failed",t)}function ed(t){const e=M.c(14),{reason:s,onStartCodingSession:a}=t,n=xe(),o=!a;let c;e[0]!==n?(c=n("sandbox.cmsUnavailable.startCodingSession"),e[0]=n,e[1]=c):c=e[1];let l;e[2]!==a||e[3]!==o||e[4]!==c?(l=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{children:r.jsx(ye,{size:"sm",variant:"outline",disabled:o,onClick:a,children:c})})}),e[2]=a,e[3]=o,e[4]=c,e[5]=l):l=e[5];let i;e[6]!==s||e[7]!==n?(i=n(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=n,e[8]=i):i=e[8];let u;e[9]!==i?(u=r.jsx(Nt,{children:i}),e[9]=i,e[10]=u):u=e[10];let d;return e[11]!==l||e[12]!==u?(d=r.jsx(As,{children:r.jsxs(kt,{children:[l,u]})}),e[11]=l,e[12]=u,e[13]=d):d=e[13],d}const zt="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 td(t){return`Reopen PR #${t.prNumber}. ${zt}`}function sd(t){return`Rebase \`${t.branch}\` on the latest base and force-push with --force-with-lease. ${zt}`}function nd(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). ${zt}`}function ad(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. ${zt}`}function rd(t){return`Mark PR #${t.prNumber} ready for review. ${zt}`}function ld(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. ${zt}`}function id(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. ${zt}`}function oa(t){switch(t){case"publish":return r.jsx(Fa,{className:"size-4"});case"create-pr":case"reopen":return r.jsx(Rs,{className:"size-4"});case"rebase":case"sync":return r.jsx(cn,{className:"size-4"});case"fix-checks":return r.jsx(wa,{className:"size-4"});case"mark-ready":return r.jsx(vn,{className:"size-4"});case"resolve-comments":return r.jsx(kl,{className:"size-4"});case"merge":return r.jsx(ai,{className:"size-4"});case"review":return r.jsx(xs,{className:"size-4"});case"open-pr-page":return r.jsx(Ga,{size:16})}}const ca=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),da=new Set(["publish","create-pr"]);function od(t){const e=M.c(44),{t:s,button:a,actionBusy:n,changeRequestPending:o,savePending:c,onAction:l}=t,i=a.action;let u;e[0]!==i||e[1]!==n?(u=n&&i!==void 0&&ca.has(i),e[0]=i,e[1]=n,e[2]=u):u=e[2];const d=u,h=o&&i==="merge";let f;e[3]!==i||e[4]!==c?(f=c&&i!==void 0&&da.has(i),e[3]=i,e[4]=c,e[5]=f):f=e[5];const p=f,m=!!a.disabled||d||h||p||!i,b=!!a.loading||h;let g;e[6]!==a.tooltip||e[7]!==d||e[8]!==p||e[9]!==s?(g=d?s("thread.headerActions.chatIsRunning"):p?s("thread.headerActions.saving"):a.tooltip,e[6]=a.tooltip,e[7]=d,e[8]=p,e[9]=s,e[10]=g):g=e[10];const x=g;let j;if(e[11]!==n||e[12]!==a.menu||e[13]!==o||e[14]!==l||e[15]!==c||e[16]!==s){let A;e[18]!==n||e[19]!==o||e[20]!==l||e[21]!==c||e[22]!==s?(A=S=>{const E=n&&ca.has(S.action),$=c&&da.has(S.action),I=S.action==="merge"&&o,T=$?s("thread.headerActions.saving"):E?s("thread.headerActions.chatIsRunning"):S.tooltip;return{key:S.key,label:S.label,icon:oa(S.action),disabled:!!(E||$||I),...T?{tooltip:T}:{},onSelect:()=>l(S.action)}},e[18]=n,e[19]=o,e[20]=l,e[21]=c,e[22]=s,e[23]=A):A=e[23],j=a.menu.map(A),e[11]=n,e[12]=a.menu,e[13]=o,e[14]=l,e[15]=c,e[16]=s,e[17]=j}else j=e[17];const y=j,v=a.label,P=a.variant;let w;e[24]!==i||e[25]!==b?(w=i&&!b?{icon:oa(i)}:{},e[24]=i,e[25]=b,e[26]=w):w=e[26];let k;e[27]!==x?(k=x?{tooltip:x}:{},e[27]=x,e[28]=k):k=e[28];let N;e[29]!==s?(N=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=N):N=e[30];let R;e[31]!==i||e[32]!==l?(R=i?()=>l(i):void 0,e[31]=i,e[32]=l,e[33]=R):R=e[33];let C;return e[34]!==a.label||e[35]!==a.variant||e[36]!==m||e[37]!==y||e[38]!==b||e[39]!==w||e[40]!==k||e[41]!==N||e[42]!==R?(C=r.jsx(lr,{size:"sm",label:v,variant:P,disabled:m,loading:b,...w,...k,items:y,menuAriaLabel:N,onClick:R}),e[34]=a.label,e[35]=a.variant,e[36]=m,e[37]=y,e[38]=b,e[39]=w,e[40]=k,e[41]=N,e[42]=R,e[43]=C):C=e[43],C}function cd(t){const e=M.c(9),{label:s,children:a}=t;if(!s){let l;return e[0]!==a?(l=r.jsx(r.Fragment,{children:a}),e[0]=a,e[1]=l):l=e[1],l}let n;e[2]!==a?(n=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{children:a})}),e[2]=a,e[3]=n):n=e[3];let o;e[4]!==s?(o=r.jsx(Nt,{children:s}),e[4]=s,e[5]=o):o=e[5];let c;return e[6]!==n||e[7]!==o?(c=r.jsx(As,{children:r.jsxs(kt,{children:[n,o]})}),e[6]=n,e[7]=o,e[8]=c):c=e[8],c}function dd(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function ud({virtualMcpId:t}){const e=xe(),{org:s}=Cs(),{data:a}=ks.useSession(),n=pn(t),{deleteRelease:o}=hn(t),{currentBranch:c,setCurrentTaskBranch:l,createTask:i,taskId:u}=Sa(),d=al(),{openSidePanel:h}=bl(),[f,p]=q.useState({open:!1,mode:"publish",policyOverride:null}),m=ki({connectionId:tl,orgId:s.id,orgSlug:s.slug}),b=Ni(m),[g,x]=q.useState(!1),j=q.useRef(""),y=qa(n),v=y.status==="attached"||y.status==="public-clone"?y.repo:null,{lifecycle:P,branch:w,phase:k}=Ci(),N={orgSlug:s.slug,virtualMcpId:t,branch:c??"",threadId:u??null},C=Tt({queryKey:tr(N),queryFn:()=>yn(N),enabled:!!c,staleTime:15e3,refetchInterval:K=>Ls(K.state.data)?5e3:!1}).data??null,A=w,S=P,E=A.kind==="ready"?A.branch:null,$=c??E??void 0,I=(A.kind==="ready"?A.branch:null)??$??null,T=za({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",branch:I}),D=T.data??null,Y=Ka({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",branch:I}),ae=Er({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",branch:I}),H=Ha({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",base:A.kind==="ready"?A.base:null}),_=A,z=er(n?.metadata?.publishPolicy),ee=Ra(s.slug,t),{previewUrl:Q}=Ai(),{previewServerUrl:B,projectDefault:ie}=bn(t);if(y.status==="detached")return r.jsx(cd,{label:e("thread.headerActions.githubConnectionRemoved"),children:r.jsx(ye,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!v)return null;const U=I?Lc({lifecycle:S,branch:_,claimPhase:k,pr:D,checks:Y.data??[],reviews:ae.data??null,noReviewableDiff:Ls(C),loading:ps(T),t:e}):dd(e),oe=JSON.stringify({label:U.label,branchKind:_.kind,workingTreeDirty:_.kind==="ready"?_.workingTreeDirty:null,unpushed:_.kind==="ready"?_.unpushed:null,aheadOfBase:_.kind==="ready"?_.aheadOfBase:null,lifecycle:S.phase,headBranch:I,noReviewableDiff:Ls(C)});j.current!==oe&&(j.current=oe,ar("header button",{label:U.label,tooltip:U.tooltip,action:U.action,chatBranch:c,sandboxBranch:E,sandboxRouteBranch:$,headBranch:I,branchMeta:A,effectiveBranchMeta:_,lifecyclePhase:S.phase,prNumber:D?.number??null,prState:D?.state??null}));const J=K=>(h(),d.sendMessage({parts:[{type:"text",text:K}]})),se=d.isStreaming,F=_.kind==="ready"?_.base:"main",te=async()=>{await T.refetch()},re=async()=>{const K=c,ce=fn(mn(a?.user));ie==="cms"?i({runtime:"cms",branch:ce}):await l(ce),K&&K!==F&&await o(K)},he=async K=>{if(!(!v||g)){x(!0);try{const ce=ir(a?.user);await dr(s.slug,tt(v),{number:K,coAuthor:ce}),Oe.success(e("thread.headerActions.publishedPr",{prNumber:String(K)})),await te(),await re()}catch(ce){Oe.error(ce instanceof cr?ce.detail??uo(ce.reason,e):ce instanceof Error?ce.message:e("thread.headerActions.failedToMergePullRequest"))}finally{x(!1)}}},G=(K,ce)=>p({open:!0,mode:K,policyOverride:ce}),pe=K=>{if(I)switch(K){case"publish":G("publish",U.meta?.publishPolicyOverride??null);return;case"create-pr":G("review",null);return;case"merge":D&&he(D.number);return;case"sync":if(se)return;J(nd({branch:I,base:F}));return;case"open-pr-page":D?.htmlUrl&&window.open(D.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(se)return;D&&J(id({prNumber:D.number}));return;case"reopen":if(se)return;D&&J(td({prNumber:D.number}));return;case"rebase":if(se)return;J(sd({branch:I}));return;case"fix-checks":if(se)return;D&&J(ad({prNumber:D.number,failingChecks:U.meta?.failingChecks??[]}));return;case"mark-ready":if(se)return;D&&J(rd({prNumber:D.number}));return;case"resolve-comments":if(se)return;D&&J(ld({prNumber:D.number}));return}},Z=g||se,L=r.jsx(od,{t:e,button:U,actionBusy:Z,changeRequestPending:g,savePending:ee,onAction:pe});return $?r.jsxs(r.Fragment,{children:[L,r.jsx(Br,{open:f.open,mode:f.mode,fastPreview:!1,recoverSandbox:()=>b.mutateAsync({virtualMcpId:t,branch:$,...u?{threadId:u}:{}}),onOpenChange:K=>{K||p(ce=>({...ce,open:!1}))},orgSlug:s.slug,virtualMcpId:t,branch:$,baseBranch:F,repoTarget:tt(v),owner:v.owner,repo:v.name,publishPolicy:f.policyOverride??z,draftPreviewUrl:Q,destinationHost:null,previewServerUrl:B,compareDraft:Q?{kind:"sandbox",previewUrl:Q}:null,lastPublishedPr:H.data??null,onRequestApproval:()=>p(K=>({...K,open:!0,mode:"review"})),openPullRequest:D?.state==="open"?D:null,onPullRequestChanged:te,onPublished:re})]}):L}function hd(t){const e=M.c(33),{orgSlug:s,virtualMcpId:a,branch:n}=t,o=xe(),[c,l]=q.useState(!1),i=qt(a,n),u=i.kind==="protocol"&&i.source==="local"?i:null;let d;e[0]!==n||e[1]!==s||e[2]!==a?(d=n?{orgSlug:s,virtualMcpId:a,branch:n}:null,e[0]=n,e[1]=s,e[2]=a,e[3]=d):d=e[3];const h=un(d),{data:f}=Aa(u,h);if(!u||!h||!n)return null;let p;e[4]!==f?(p=f?Object.keys(f.changes).length:0,e[4]=f,e[5]=p):p=e[5];const m=p;let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=()=>l(!0),e[6]=b):b=e[6];let g;e[7]!==m||e[8]!==o?(g=m>0?o("decoServe.changes.buttonCount",{count:m}):o("decoServe.changes.button"),e[7]=m,e[8]=o,e[9]=g):g=e[9];let x;e[10]!==g?(x=r.jsx(ye,{size:"sm",variant:"outline","data-testid":"local-changes-button",onClick:b,children:g}),e[10]=g,e[11]=x):x=e[11];let j;e[12]!==o?(j=o("decoServe.changes.title"),e[12]=o,e[13]=j):j=e[13];let y;e[14]!==j?(y=r.jsx(ba,{className:"sr-only",children:j}),e[14]=j,e[15]=y):y=e[15];let v;e[16]!==n||e[17]!==h||e[18]!==u||e[19]!==c||e[20]!==s||e[21]!==o||e[22]!==a?(v=c?r.jsx(xa,{children:N=>{const{reset:R}=N;return r.jsx(va,{fallback:C=>{const{resetError:A}=C;return r.jsx(Js,{title:o("decoServe.changes.title"),body:r.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:o("decoServe.changes.loadFailed")}),onClose:()=>{R(),A(),l(!1)}})},children:r.jsx(q.Suspense,{fallback:r.jsx(es,{pane:r.jsx(Tn,{}),list:r.jsx(Js,{title:o("decoServe.changes.title"),loading:!0,body:r.jsx(Yt,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{}),r.jsx(Ut,{})]})}),onClose:()=>l(!1)})}),children:r.jsx(fd,{orgSlug:s,virtualMcpId:a,branch:n,backend:u,cacheKey:h,onClose:()=>l(!1)})})})}}):null,e[16]=n,e[17]=h,e[18]=u,e[19]=c,e[20]=s,e[21]=o,e[22]=a,e[23]=v):v=e[23];let P;e[24]!==y||e[25]!==v?(P=r.jsxs(ga,{"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:[y,v]}),e[24]=y,e[25]=v,e[26]=P):P=e[26];let w;e[27]!==c||e[28]!==P?(w=r.jsx(pa,{open:c,onOpenChange:l,children:P}),e[27]=c,e[28]=P,e[29]=w):w=e[29];let k;return e[30]!==w||e[31]!==x?(k=r.jsxs(r.Fragment,{children:[x,w]}),e[30]=w,e[31]=x,e[32]=k):k=e[32],k}function Js(t){const e=M.c(22),{title:s,trailing:a,body:n,loading:o,onClose:c}=t,l=o===void 0?!1:o,i=xe(),u=l?"loading":"ready";let d;e[0]!==s?(d=r.jsx("span",{className:"truncate",children:s}),e[0]=s,e[1]=d):d=e[1];let h;e[2]!==d||e[3]!==a?(h=r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[d,a]}),e[2]=d,e[3]=a,e[4]=h):h=e[4];let f;e[5]!==i?(f=i("decoServe.changes.hint"),e[5]=i,e[6]=f):f=e[6];let p;e[7]!==f?(p=r.jsx("p",{className:"text-2xs text-muted-foreground",children:r.jsx(sr,{text:f})}),e[7]=f,e[8]=p):p=e[8];let m;e[9]!==i?(m=i("decoServe.changes.close"),e[9]=i,e[10]=m):m=e[10];let b;e[11]!==c||e[12]!==m?(b=r.jsx(ye,{type:"button",variant:"outline",className:"w-full",onClick:c,children:m}),e[11]=c,e[12]=m,e[13]=b):b=e[13];let g;e[14]!==p||e[15]!==b?(g=r.jsxs(r.Fragment,{children:[p,b]}),e[14]=p,e[15]=b,e[16]=g):g=e[16];let x;return e[17]!==n||e[18]!==u||e[19]!==h||e[20]!==g?(x=r.jsx(Bs,{state:u,header:h,body:n,footer:g}),e[17]=n,e[18]=u,e[19]=h,e[20]=g,e[21]=x):x=e[21],x}function fd(t){const e=M.c(54),{orgSlug:s,virtualMcpId:a,branch:n,backend:o,cacheKey:c,onClose:l}=t,i=xe();let u;e[0]!==n||e[1]!==s||e[2]!==a?(u={orgSlug:s,virtualMcpId:a,branch:n},e[0]=n,e[1]=s,e[2]=a,e[3]=u):u=e[3];let d;e[4]!==o||e[5]!==c||e[6]!==u?(d={backend:o,cacheKey:c,scope:u},e[4]=o,e[5]=c,e[6]=u,e[7]=d):d=e[7];const h=Rn(d);let f;e[8]!==n||e[9]!==s||e[10]!==h.refresh||e[11]!==a?(f={orgSlug:s,virtualMcpId:a,branch:n,refresh:h.refresh},e[8]=n,e[9]=s,e[10]=h.refresh,e[11]=a,e[12]=f):f=e[12];const p=Tr(f),m=Na(s,a).phase==="saving",b=o.describe.readOnly,[g,x]=q.useState(null),[j,y]=q.useState(null),[v,P]=q.useState(!1),{summary:w}=h;let k,N,R,C,A;if(e[13]!==g||e[14]!==o||e[15]!==j||e[16]!==p||e[17]!==v||e[18]!==m||e[19]!==b||e[20]!==h.blocks||e[21]!==h.entries||e[22]!==h.sidesFailed||e[23]!==h.sidesPending||e[24]!==w.blocks||e[25]!==w.count||e[26]!==w.pages||e[27]!==i){const $=[...w.pages,...w.blocks],I=$.find(ae=>Ie(ae)===g)??$[0]??null;let T;e[33]!==w.count||e[34]!==i?(T=w.count===0?i("decoServe.changes.title"):w.count===1?i("decoServe.changes.titleOne"):i("decoServe.changes.titleCount",{count:w.count}),e[33]=w.count,e[34]=i,e[35]=T):T=e[35],A=T;const D=(ae,H)=>H.length===0?null:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"px-0.5 text-2xs font-medium text-muted-foreground",children:ae}),H.map(_=>{const z=Ie(_);return r.jsx(jr,{change:_,bodyPending:h.sidesPending,v8:!0,selected:I!==null&&Ie(I)===z,onSelect:()=>x(z),confirming:j===z,onConfirmingChange:ee=>y(ee?z:null),onDiscard:b||!_.entry?void 0:()=>{p(o,[_.entry],i("thread.publishPopover.discarded",{name:_.name}))},isPublishing:!1,isDiscarding:m},z)})]});let Y;e[36]!==o||e[37]!==p||e[38]!==v||e[39]!==m||e[40]!==b||e[41]!==h.entries||e[42]!==w.count||e[43]!==i?(Y=b||w.count<=1?null:r.jsxs(r.Fragment,{children:[r.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:m,children:i("thread.publishPopover.discardAll")}),r.jsx(rn,{open:v,onOpenChange:P,children:r.jsxs(an,{children:[r.jsxs(en,{children:[r.jsx(Ys,{children:i("thread.publishPopover.discardAllTitle")}),r.jsx(Zs,{children:i("thread.publishPopover.discardAllConfirm")})]}),r.jsxs(nn,{children:[r.jsx(tn,{children:i("thread.publishDialog.cancel")}),r.jsx(sn,{onClick:()=>{p(o,h.entries,i("thread.publishDialog.allChangesDiscarded"))},disabled:m,className:X(ya({variant:"destructive"})),children:i("thread.publishPopover.discardAll")})]})]})})]}),e[36]=o,e[37]=p,e[38]=v,e[39]=m,e[40]=b,e[41]=h.entries,e[42]=w.count,e[43]=i,e[44]=Y):Y=e[44],R=Y,N=w.count===0?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx(vn,{className:"mb-1 size-5 text-success"}),r.jsx("p",{className:"text-sm font-medium",children:i("decoServe.changes.empty")})]}):r.jsxs(Yt,{children:[D(i("thread.publishPopover.pagesGroup"),w.pages),D(i("thread.publishPopover.blocksGroup"),w.blocks),h.sidesFailed?r.jsx("p",{className:"text-2xs text-muted-foreground",children:i("thread.publishPopover.detailsUnavailable")}):null]}),k=es,C=I?r.jsx("div",{className:X(Xt,"relative flex"),children:r.jsx(Rr,{change:I,diff:null,bodyPending:h.sidesPending,previewServerUrl:null,draft:null,lastPage:null,v8:{blocks:h.blocks}},Ie(I))}):r.jsx("div",{className:X(Xt,"bg-muted/40")}),e[13]=g,e[14]=o,e[15]=j,e[16]=p,e[17]=v,e[18]=m,e[19]=b,e[20]=h.blocks,e[21]=h.entries,e[22]=h.sidesFailed,e[23]=h.sidesPending,e[24]=w.blocks,e[25]=w.count,e[26]=w.pages,e[27]=i,e[28]=k,e[29]=N,e[30]=R,e[31]=C,e[32]=A}else k=e[28],N=e[29],R=e[30],C=e[31],A=e[32];let S;e[45]!==N||e[46]!==R||e[47]!==l||e[48]!==A?(S=r.jsx(Js,{title:A,trailing:R,body:N,onClose:l}),e[45]=N,e[46]=R,e[47]=l,e[48]=A,e[49]=S):S=e[49];let E;return e[50]!==k||e[51]!==C||e[52]!==S?(E=r.jsx(k,{pane:C,list:S}),e[50]=k,e[51]=C,e[52]=S,e[53]=E):E=e[53],E}function md(t){const e=M.c(5),{virtualMcpId:s,branch:a}=t,n=xe(),o=qt(s,a);if(!pd(o))return null;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ct,{asChild:!0,children:r.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]=c):c=e[0];let l;e[1]!==n?(l=n("decoServe.version.v8"),e[1]=n,e[2]=l):l=e[2];let i;return e[3]!==l?(i=r.jsxs(kt,{children:[c,r.jsx(Nt,{side:"bottom",className:"max-w-xs",children:l})]}),e[3]=l,e[4]=i):i=e[4],i}function pd(t){return t.kind==="protocol"?t.hasSchema!==!1:t.kind==="unavailable"&&t.source!=="local"}function bd(t){const e=M.c(11),{virtualMcpId:s,branch:a}=t,n=xe(),o=qt(s,a);if(!(o.kind==="protocol"&&o.source==="local"&&o.describe.readOnly))return null;let l;e[0]!==n?(l=n("decoServe.readOnly.label"),e[0]=n,e[1]=l):l=e[1];let i;e[2]!==l?(i=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{tabIndex:0,"data-testid":"deco-serve-read-only",className:"shrink-0 rounded-full bg-warning/10 px-2 py-0.5 text-xs font-medium text-foreground",children:l})}),e[2]=l,e[3]=i):i=e[3];let u;e[4]!==n?(u=n("decoServe.readOnly.tooltip"),e[4]=n,e[5]=u):u=e[5];let d;e[6]!==u?(d=r.jsx(Nt,{side:"bottom",className:"max-w-xs",children:r.jsx(sr,{text:u})}),e[6]=u,e[7]=d):d=e[7];let h;return e[8]!==i||e[9]!==d?(h=r.jsxs(kt,{children:[i,d]}),e[8]=i,e[9]=d,e[10]=h):h=e[10],h}function gd(t){const e=!t.hasEntity&&!t.servingLocally,s=t.hasEntity&&!t.localPreview&&!t.tunnelUndecided&&!t.servingLocally&&t.showsRepositoryActions;return{hidden:e,localFiles:!e&&t.servingLocally,draftSelect:!e&&t.hasEntity,publish:e||!s?null:t.runtime==="cms"?"cms":"code"}}function mu(t){const e=M.c(2),{blocksOnly:s}=t;let a;return e[0]!==s?(a=s?r.jsx(xd,{}):r.jsx(_r,{}),e[0]=s,e[1]=a):a=e[1],a}function xd(){const t=M.c(2),e=Va(Ri());let s;return t[0]!==e?(s=Fl(e)?r.jsx(Nr,{value:!1,children:r.jsx(_r,{})}):null,t[0]=e,t[1]=s):s=t[1],s}function _r(){const t=M.c(32),e=Zt(),{org:s}=Cs(),a=pn(e?.virtualMcpId),n=e?.currentBranch??null,o=bn(a?.id).runtime,{url:c,undecided:l}=ka(a?.id),{connection:i}=Ca(a?.id??e?.virtualMcpId),u=a?.id??e?.virtualMcpId,d=!!a,h=!!i,f=!!c,p=!!l;let m;t[0]!==a||t[1]!==o||t[2]!==d||t[3]!==h||t[4]!==f||t[5]!==p?(m=gd({hasEntity:d,servingLocally:h,localPreview:f,tunnelUndecided:p,showsRepositoryActions:!!a&&$l(a),runtime:o}),t[0]=a,t[1]=o,t[2]=d,t[3]=h,t[4]=f,t[5]=p,t[6]=m):m=t[6];const b=m;if(!u||b.hidden)return null;let g;t[7]!==n||t[8]!==u?(g=r.jsx(md,{virtualMcpId:u,branch:n}),t[7]=n,t[8]=u,t[9]=g):g=t[9];let x;t[10]!==n||t[11]!==b.localFiles||t[12]!==u?(x=b.localFiles&&r.jsx(bd,{virtualMcpId:u,branch:n}),t[10]=n,t[11]=b.localFiles,t[12]=u,t[13]=x):x=t[13];let j;t[14]!==n||t[15]!==s||t[16]!==b.localFiles||t[17]!==u?(j=b.localFiles&&r.jsx(hd,{orgSlug:s.slug,virtualMcpId:u,branch:n}),t[14]=n,t[15]=s,t[16]=b.localFiles,t[17]=u,t[18]=j):j=t[18];let y;t[19]!==n||t[20]!==a||t[21]!==b.draftSelect?(y=a&&b.draftSelect&&r.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:r.jsx(Zi,{virtualMcp:a,currentBranch:n})}),t[19]=n,t[20]=a,t[21]=b.draftSelect,t[22]=y):y=t[22];let v;t[23]!==a||t[24]!==b.publish?(v=a&&b.publish&&r.jsxs(r.Fragment,{children:[r.jsx(sl,{orientation:"vertical",className:"mx-1 data-[orientation=vertical]:h-4"}),r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-1",children:b.publish==="cms"?r.jsx(Jc,{virtualMcpId:a.id}):r.jsx(ud,{virtualMcpId:a.id})})]}),t[23]=a,t[24]=b.publish,t[25]=v):v=t[25];let P;return t[26]!==g||t[27]!==x||t[28]!==j||t[29]!==y||t[30]!==v?(P=r.jsxs(r.Fragment,{children:[g,x,j,y,v]}),t[26]=g,t[27]=x,t[28]=j,t[29]=y,t[30]=v,t[31]=P):P=t[31],P}export{mu as S};
9
+ `),fallbackTitle:e})}function ys(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function mo(t){return t.fastPreview?{fastPreview:!0}:void 0}async function Us(t,e,s){try{return await s()}catch(a){throw new kn(a instanceof Error?a.message:e,t)}}async function hr(t){const{expectedHeadSha:e,expectedDiffSignature:s}=t;if(!e&&!s)return;const a=await yn(ys(t)).catch(()=>null);if(!a)return;if(e&&a.headSha&&a.headSha!==e)throw new Vs;if(!s)return;const n=await Ja(ys(t),a,t.baseBranch,mo(t)).catch(()=>null);if(n&&Is(n)!==s)throw new Vs}function fr(t,e){return oi(ys(t),e)}function mr(t,e){return co(t.orgSlug,t.target,{branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor})}async function po(t,e,s){await hr(t),await Us("push",s("thread.publishDialog.failedPushChanges"),()=>fr(t,e.message)),await Us("sync",s("thread.publishDialog.failedRebase"),()=>Xa(ys(t),t.baseBranch));const a=await Us("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>mr(t,e));try{await dr(t.orgSlug,t.target,{number:a.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(n){throw new kn(n instanceof Error?n.message:s("thread.publishDialog.failedMergePullRequest"),"merge",a)}return a}async function bo(t,e){return await hr(t),await fr(t,e.message),mr(t,e)}function Jn(t,e){return t instanceof Vs?{message:e("siteEditor.publish.changedMeanwhile"),pullRequest:null,headMoved:!0}:t instanceof kn&&t.step==="merge"&&t.pr?{message:e("thread.publishDialog.mergeFailed",{prNumber:t.pr.number,message:t.message}),pullRequest:t.pr,headMoved:!1}:{message:t instanceof Error?t.message:e("thread.publishDialog.failedPublish"),pullRequest:null,headMoved:!1}}function go(t,e){Oe.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnProvider"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function pr(t){return t.kind!=="block"?null:t.namedRule??null}function xo(t,e){const s=e.find(a=>a&&typeof a=="object");return s?zl(s.__resolveType):Wa(t)}const vo=/(?:^|\/)\.deco\/blocks\/([^/]+)\.json$/;function Cn(t){const e=vo.exec(t)?.[1];return e?xi(e):null}function ws(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 yo(t,e){return t===null?"new":e===null?"removed":"edited"}function br(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 Vt(t,e,s=!1){if(t&&typeof t=="object"&&!Array.isArray(t)){const a=t.__resolveType;if(typeof a=="string"&&a.trim()){if(s)return zr(a);const o=(a.split("/").pop()??a).replace(/\.[jt]sx?$/,"");return br(o)||o}}return`Section ${e+1}`}function Nn(t){if(ha(t))return t.value??null;const e=t.__resolveType;return typeof e=="string"&&Hr(e)?t.section??null:null}const gr=6;function ms(t,e=0){if(e>gr||!t||typeof t!="object")return[];if(Array.isArray(t))return t.flatMap(n=>ms(n,e+1));const s=t;if(ln(s.__resolveType))return Gs(s).flatMap(n=>ms(n?.value,e+1));const a=Nn(s);return a!==null?ms(a,e+1):[s]}function Gs(t){const e=t?.variants;return Array.isArray(e)?e.map(s=>s&&typeof s=="object"&&!Array.isArray(s)?s:null):[]}function Xn(t){let e=t;for(let s=0;s<gr;s++){if(!e||typeof e!="object"||Array.isArray(e))return null;const a=e;if(ln(a.__resolveType))return a;const n=Nn(a);if(n===null)return null;e=n}return null}function wo(t,e,s){const a=Gs(Xn(t)),n=e?Gs(Xn(e)):[],o=e?Array.from({length:Math.max(a.length,n.length)},(i,u)=>u).filter(i=>!Ms(a[i],n[i])):[],l=[...o.map(i=>a[i]??n[i]),...a.filter((i,u)=>!o.includes(u))].flatMap(i=>ms(i?.value)).map(i=>Vt(i,s,!0));return[...new Set(l)]}function qs(t,e,s,a,n){let o=t,c=!1;for(let i=0;i<4;i++){if(!o||typeof o!="object"||Array.isArray(o)){c=!0;break}const u=o;if(ln(u.__resolveType)){c=!0;break}const d=Nn(u);if(d===null)break;o=d}const l=c?wo(t,n,e):[];return{name:Vt(c?t:o,e,!0),kind:"section",status:s,fields:a,...c?{wrapper:!0}:{},...l.length>0?{held:l}:{}}}function Qs(t,e){const s=t.sections;if(Array.isArray(s))return s.flatMap((a,n)=>a&&typeof a=="object"&&!Array.isArray(a)?[{section:a,basePath:["sections",n]}]:[]);if(s&&typeof s=="object"){const a=s.variants;if(Array.isArray(a))return a.flatMap((n,o)=>{const c=n&&typeof n=="object"&&!Array.isArray(n)?n.value:null,l=e&&ha(c),i=l?c.value:c;if(!Array.isArray(i))return[];const u=l?["sections","variants",o,"value","value"]:["sections","variants",o,"value"];return i.flatMap((d,h)=>d&&typeof d=="object"&&!Array.isArray(d)?[{section:d,basePath:[...u,h]}]:[])})}return[]}function Yn(t){return JSON.stringify(t,(e,s)=>{if(s&&typeof s=="object"&&!Array.isArray(s)){const a=s;return Object.keys(a).sort().reduce((n,o)=>(n[o]=a[o],n),{})}return s})}function Ms(t,e){return t===void 0&&e===void 0?!0:Yn(t)===Yn(e)}function Wt(t,e,s,a=new Set){const n=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),o=[];for(const c of n){if(c.startsWith("__")||a.has(c))continue;const l=t?t[c]:void 0,i=e?e[c]:void 0;Ms(l,i)||o.push({label:br(c),path:[...s,c],from:l,to:i})}return o}const Po=new Set(["sections"]);function An(t,e,s=!1){const a=t?Qs(t,s):[],n=e?Qs(e,s):[],o=[],c=Math.max(a.length,n.length);for(let i=0;i<c;i++){const u=a[i],d=n[i];if(!s){const h=jo(u,d,i);h&&o.push(h);continue}if(u&&d){if(Ms(u.section,d.section))continue;o.push(qs(d.section,i,"edited",Wt(u.section,d.section,d.basePath),u.section))}else d?o.push(qs(d.section,i,"new",[])):u&&o.push(qs(u.section,i,"removed",[]))}const l=Wt(t,e,[],Po);return l.length>0&&o.push({name:"Page settings",kind:"settings",status:"edited",fields:l}),o}function jo(t,e,s){return t&&e?Ms(t.section,e.section)?null:{name:Vt(e.section,s),kind:"section",status:"edited",fields:Wt(t.section,e.section,e.basePath)}:e?{name:Vt(e.section,s),kind:"section",status:"new",fields:[]}:t?{name:Vt(t.section,s),kind:"section",status:"removed",fields:[]}:null}function Ws(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 So(t){const e=[],s=[],a=[],n=[];for(const[o,c]of Object.entries(t?.diffs??{})){if(wn(o)){n.push(o);continue}const l=yo(c.from,c.to),i=Cn(o);if(!i){a.push(Ws(o,l));continue}const u=ws(c.from),d=ws(c.to),h=d??u;if(!h){a.push(Ws(o,l));continue}const f=Kt(i,h);if(f){e.push({kind:"page",blockKey:i,name:f.name,pagePath:f.path,isSiteApp:!1,status:l,filepaths:[o],sections:l==="edited"?An(u,d):[],fromJson:u,toJson:d});continue}const p=gn(i,h);s.push({kind:"block",blockKey:i,name:gs(i,h),pagePath:null,isSiteApp:p,status:l,filepaths:[o],sections:l==="edited"?[{name:gs(i,h),kind:"section",status:"edited",fields:Wt(u,d,[])}].filter(m=>m.fields.length>0):[],fromJson:u,toJson:d})}return xr({pages:e,blocks:s,other:a,generated:n})}function zs(t,e){return(t.filepaths[0]??"").localeCompare(e.filepaths[0]??"")}function xr(t){const{pages:e,blocks:s,other:a,generated:n}=t;return e.sort(zs),s.sort(zs),a.sort(zs),{pages:e,blocks:s,other:a,generated:n,count:e.length+s.length+a.length}}function ko(t){return t==="added"?"new":t==="removed"?"removed":"edited"}function vr(t){return t.startsWith("pages-")}function yr(t){const{files:e,lookup:s,diff:a}=t,n=[],o=[],c=[],l=[];for(const i of e){const u=i.path;if(wn(u)){l.push(u);continue}const d=ko(i.status),h=Cn(u);if(!h){c.push(Ws(u,d));continue}const f=a?.diffs[u],p=ws(f?.from??null),m=ws(f?.to??null),b=wr(s,h),g=b??m??p;if((b?Kt(h,b):null)??(!b&&vr(h))){const y=g?Kt(h,g):null;n.push({kind:"page",blockKey:h,name:y?.name??Qa(h),pagePath:y?.path??null,isSiteApp:!1,status:d,filepaths:[u],sections:d==="edited"?An(p,m):[],fromJson:p,toJson:m??(d==="new"?b:null)});continue}const j=gs(h,g??{});o.push({kind:"block",blockKey:h,name:j,pagePath:null,isSiteApp:gn(h,b??{}),status:d,filepaths:[u],sections:d==="edited"?[{name:j,kind:"section",status:"edited",fields:Wt(p,m,[])}].filter(y=>y.fields.length>0):[],fromJson:p,toJson:m})}return xr({pages:n,blocks:o,other:c,generated:l})}function wr(t,e){const s=t?.[e];return s&&typeof s=="object"&&!Array.isArray(s)?s:null}function Co(t,e){return t??e}function Pr(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const Hs=3;function ds(t){if(t.length<=Hs)return Pr(t);const e=t.length-Hs;return`${t.slice(0,Hs).join(", ")} and ${e} more`}function No(t,e){if(!e){const a=t.sections.filter(n=>n.kind==="section").map(n=>n.name).slice(0,3);return a.length>0?`${t.name} (${a.join(", ")})`:t.name}const s=[...new Set(t.sections.filter(a=>a.kind==="section").flatMap(a=>a.wrapper?a.held??[]:[a.name]))].slice(0,3);return s.length>0?`${t.name} (${s.join(", ")})`:t.name}function Ao(t){const e=pr(t);return e==="experiments"?"A/B tests":e==="campaigns"?"Campaign dates":t.name}function Ro(t){const e=[],s=t.pages.filter(l=>l.status==="edited"),a=t.pages.filter(l=>l.status==="new"),n=t.pages.filter(l=>l.status==="removed");if(s.length>0&&e.push(`updated ${ds(s.map(l=>No(l,!!t.v8)))}`),a.length>0){const l=a.length===1?"page":"pages";e.push(`added the ${ds(a.map(i=>i.name))} ${l}`)}if(n.length>0){const l=n.length===1?"page":"pages";e.push(`removed the ${ds(n.map(i=>i.name))} ${l}`)}const o=t.blocks.map(Ao);if(o.length>0&&e.push(`changed ${ds(o)}`),t.other.length>0){const l=t.other.length===1?"file":"files";e.push(`changed ${t.other.length} ${l}`)}if(e.length===0)return"";const c=Pr(e);return ur(c.charAt(0).toUpperCase()+c.slice(1))}function To(t,e){return t?Qs(t,e).length:0}function Io(t,e=!1){const s={newPageSections:t.kind==="page"&&t.status==="new"?To(t.toJson,e):null,sections:0,settings:!1,fields:0};if(s.newPageSections!==null)return s;for(const a of t.sections){if(a.kind==="settings"){s.settings=!0;continue}t.kind==="page"?s.sections+=1:s.fields+=a.fields.length}return s}const Zn="••••••";function Jt(t){if(Array.isArray(t))return t.map(Jt);if(!t||typeof t!="object")return t;const e=t,s={};for(const[a,n]of Object.entries(e))s[a]=Jt(n);return e.__resolveType===oo&&"ciphertext"in e&&(s.ciphertext=Zn),Vr(e)&&"encrypted"in e&&(s.encrypted=Zn),s}function ea(t){return t.map(e=>({...e,from:Jt(e.from),to:Jt(e.to)}))}function Do(t){const{changes:e,sides:s,lookup:a,meta:n,missingRules:o,missingRuleUses:c,hosted:l}=t,i=[],u=[],d=f=>[...new Set((s?.diagnostics??[]).filter(p=>Fn(Kr(p.file))===Fn(f)).map(p=>p.side))],h=Object.keys(e).sort((f,p)=>f<p?-1:f>p?1:0);for(const f of h){const p=e[f],m=p.kind==="delete"?"removed":p.baseVersion===null?"new":"edited",b=s?.entries[f],g=b?.before??null,x=b?.after??null,j=wr(a,f),y=j??x??g,v=d(f),P=o?.get(f),w=Wa(f),k=w?c?.get(w):void 0,N={blockKey:f,status:m,filepaths:[],entry:{name:f,version:p.version},...v.length>0?{unreadable:v}:{},...P&&P.length>0?{missingRules:P}:{},...w&&k&&k.pages+k.sections>0?{missingRuleUses:{kind:w,...k}}:{},fromJson:Jt(g),toJson:Jt(x??(m==="new"?j:null))},R=j?Kt(f,j,n):null,C=!j&&y?Kt(f,y,n):null;if(R??C??(!y&&vr(f))){const F=y?Kt(f,y,n):null;i.push({...N,kind:"page",name:F?.name??Qa(f),pagePath:F?.path??null,isSiteApp:!1,sections:m==="edited"?An(g,x,!0).map(I=>({...I,fields:ea(I.fields)})):[]});continue}const A=l?Ul(f,y,j,x,g):null,S=A?ql(A,[y,j,x,g]):gs(f,y??{}),E=xo(f,[j,x,g]);u.push({...N,kind:"block",name:S,...A?{blogKind:A}:{},...E?{namedRule:E}:{},pagePath:null,isSiteApp:gn(f,j??y??{}),sections:m==="edited"?[{name:S,kind:"section",status:"edited",fields:ea(Wt(g,x,[]))}].filter(F=>F.fields.length>0):[]})}return{pages:i,blocks:u,other:[],generated:[],count:i.length+u.length,v8:!0}}function Ie(t){return t.filepaths[0]??t.blockKey??t.name}function Bo(t){const e=t.pages+t.sections===1,s=t.names===1;return t.kind==="experiments"?s?e?"thread.publishPopover.missingTestUsesOne":"thread.publishPopover.missingTestUses":e?"thread.publishPopover.missingTestsUsesOne":"thread.publishPopover.missingTestsUses":s?e?"thread.publishPopover.missingCampaignUsesOne":"thread.publishPopover.missingCampaignUses":e?"thread.publishPopover.missingCampaignsUsesOne":"thread.publishPopover.missingCampaignsUses"}function Mo(t,e){return e(t==="new"?"thread.publishPopover.chipNew":t==="removed"?"thread.publishPopover.chipRemoved":"thread.publishPopover.chipEdited")}function Fo(t,e){const s=t.kind==="block"?ni:Ma;return r.jsx("span",{title:Mo(t.status,e),className:"flex shrink-0",children:r.jsx(s,{className:X("size-4",t.status==="new"&&"text-brand",t.status==="edited"&&"text-warning",t.status==="removed"&&"text-destructive")})})}function $o(t,e){if(t.kind==="page")return t.pagePath;if(t.kind!=="block")return null;if(t.blogKind)return Hl(t.blogKind,e);const s=pr(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 Eo(t,e,s){const a=Io(t,s);if(a.newPageSections!==null)return[a.newPageSections===1?e("thread.publishPopover.newPageSectionOne"):e("thread.publishPopover.newPageSections",{count:a.newPageSections})];const n=[];return a.sections===1?n.push(e("thread.publishPopover.sectionChangedOne")):a.sections>1&&n.push(e("thread.publishPopover.sectionsChanged",{count:a.sections})),a.fields===1?n.push(e("thread.publishPopover.fieldChangedOne")):a.fields>1&&n.push(e("thread.publishPopover.fieldsChanged",{count:a.fields})),a.settings&&n.push(e("thread.publishPopover.pageSettingsChanged")),n}function jr(t){const e=M.c(68),{change:s,bodyPending:a,selected:n,onSelect:o,confirming:c,onConfirmingChange:l,onDiscard:i,isPublishing:u,isDiscarding:d,v8:h,alsoChangedOnMain:f}=t,p=a===void 0?!1:a,m=h===void 0?!1:h,b=f===void 0?!1:f,g=xe();let x;e[0]!==s||e[1]!==g?(x=$o(s,g),e[0]=s,e[1]=g,e[2]=x):x=e[2];const j=x;let y,v,P,w,k,N,R,C;if(e[3]!==p||e[4]!==s||e[5]!==c||e[6]!==j||e[7]!==d||e[8]!==u||e[9]!==l||e[10]!==i||e[11]!==o||e[12]!==n||e[13]!==g||e[14]!==m){const E=Eo(s,g,m);let F;e[23]!==s.missingRules?(F=s.missingRules??[],e[23]=s.missingRules,e[24]=F):F=e[24];const I=F,T=s.missingRuleUses,D=T?ri(g,T):null,Y=p&&E.length===0&&s.status==="edited";y=or;const ae=n&&"border-foreground/30 bg-accent hover:bg-secondary-hover";e[25]!==ae?(w=X("cursor-pointer transition-colors hover:bg-accent",ae),e[25]=ae,e[26]=w):w=e[26],e[27]!==s?(k=Ie(s),e[27]=s,e[28]=k):k=e[28],N=o;let H;e[29]!==s||e[30]!==g?(H=Fo(s,g),e[29]=s,e[30]=g,e[31]=H):H=e[31];let _;e[32]!==s.name?(_=r.jsx("span",{className:"truncate text-sm font-medium",children:s.name}),e[32]=s.name,e[33]=_):_=e[33];let z;e[34]!==j?(z=j?r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:j}):null,e[34]=j,e[35]=z):z=e[35];let ee;e[36]!==n||e[37]!==_||e[38]!==z?(ee=r.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left","aria-pressed":n,children:[_,z]}),e[36]=n,e[37]=_,e[38]=z,e[39]=ee):ee=e[39];let Q;e[40]!==c||e[41]!==d||e[42]!==u||e[43]!==l||e[44]!==i||e[45]!==g?(Q=c?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:B=>{B.stopPropagation(),l(!1)},children:g("thread.publishDialog.cancel")}),r.jsx("button",{type:"button",className:"text-xs font-medium text-destructive disabled:opacity-50",onClick:B=>{B.stopPropagation(),l(!1),i?.()},disabled:d,children:g("thread.publishPopover.discard")})]}):i?r.jsx(As,{children:r.jsxs(kt,{children:[r.jsx(Ct,{asChild:!0,children:r.jsx(ye,{type:"button",variant:"ghost-destructive",size:"icon-xs","aria-label":g("thread.publishPopover.discard"),className:"shrink-0 disabled:pointer-events-auto",onClick:B=>{B.stopPropagation(),l(!0)},disabled:u||d,children:r.jsx(Ts,{className:"size-3.5"})})}),r.jsx(Nt,{children:g("thread.publishPopover.discard")})]})}):null,e[40]=c,e[41]=d,e[42]=u,e[43]=l,e[44]=i,e[45]=g,e[46]=Q):Q=e[46],e[47]!==H||e[48]!==ee||e[49]!==Q?(R=r.jsxs("div",{className:"flex items-center gap-2.5",children:[H,ee,Q]}),e[47]=H,e[48]=ee,e[49]=Q,e[50]=R):R=e[50],C=E.length>0?r.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-muted-foreground",children:E.map(_o)}):Y?r.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px]",children:r.jsx(ft,{className:"h-4 w-2/3"})}):null,e[51]!==I||e[52]!==g?(v=I.length>0?r.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-foreground","data-testid":"publish-change-missing-rule",children:I.map(B=>r.jsx("div",{className:"truncate",children:g(B==="experiments"?"thread.publishPopover.missingTest":"thread.publishPopover.missingCampaign")},B))}):null,e[51]=I,e[52]=g,e[53]=v):v=e[53],P=T&&D?r.jsx("div",{className:"mt-1 truncate pl-[26px] text-xs text-foreground","data-testid":"publish-change-missing-rule-uses",children:g(Bo(T),{places:D.places})}):null,e[3]=p,e[4]=s,e[5]=c,e[6]=j,e[7]=d,e[8]=u,e[9]=l,e[10]=i,e[11]=o,e[12]=n,e[13]=g,e[14]=m,e[15]=y,e[16]=v,e[17]=P,e[18]=w,e[19]=k,e[20]=N,e[21]=R,e[22]=C}else y=e[15],v=e[16],P=e[17],w=e[18],k=e[19],N=e[20],R=e[21],C=e[22];let A;e[54]!==b||e[55]!==s.name||e[56]!==g?(A=b?r.jsx("div",{className:"mt-1 pl-[26px] text-xs text-muted-foreground","data-testid":"publish-change-also-changed",children:g("thread.publishPopover.alsoChangedOnMain",{name:s.name})}):null,e[54]=b,e[55]=s.name,e[56]=g,e[57]=A):A=e[57];let S;return e[58]!==y||e[59]!==v||e[60]!==P||e[61]!==A||e[62]!==w||e[63]!==k||e[64]!==N||e[65]!==R||e[66]!==C?(S=r.jsxs(y,{className:w,"data-change-id":k,onClick:N,children:[R,C,v,P,A]}),e[58]=y,e[59]=v,e[60]=P,e[61]=A,e[62]=w,e[63]=k,e[64]=N,e[65]=R,e[66]=C,e[67]=S):S=e[67],S}function _o(t,e){return r.jsx("div",{className:"truncate",children:t},`${e}-${t}`)}function Sr(){const t=M.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,a]=q.useState(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const i=()=>a(d=>d.width===l.clientWidth&&d.height===l.clientHeight?d:{width:l.clientWidth,height:l.clientHeight});i();const u=new ResizeObserver(i);return u.observe(l),()=>u.disconnect()},t[1]=n):n=t[1];const o=n;let c;return t[2]!==s?(c=[s,o],t[2]=s,t[3]=c):c=t[3],c}function Oo(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}const Lo=[{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 ta(t){const e=M.c(10),{height:s}=t,a=xe();let n;e[0]!==s?(n={height:s},e[0]=s,e[1]=n):n=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=Lo.map(Uo),e[2]=o):o=e[2];let c;e[3]!==a?(c=a("thread.publishDialog.openingComparison"),e[3]=a,e[4]=c):c=e[4];let l;e[5]!==c?(l=r.jsx("div",{className:"flex items-center justify-center pt-1 text-2xs text-muted-foreground",children:c}),e[5]=c,e[6]=l):l=e[6];let i;return e[7]!==n||e[8]!==l?(i=r.jsxs("div",{style:n,className:"flex w-full flex-col gap-1.5 overflow-hidden px-3 py-2",children:[o,l]}),e[7]=n,e[8]=l,e[9]=i):i=e[9],i}function Uo(t,e){return r.jsxs("div",{className:X("flex items-center gap-2 rounded px-1 py-0.5",t.tone==="del"&&"bg-destructive/5",t.tone==="add"&&"bg-success/5"),children:[r.jsx("div",{className:X("h-2 w-4 shrink-0 animate-pulse rounded-sm bg-muted",t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")}),r.jsx("div",{className:X("h-2 animate-pulse rounded-sm bg-muted",t.width,t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")})]},e)}const kr={readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12},qo={...kr,lineNumbersMinChars:3,lineDecorationsWidth:4,folding:!1,glyphMargin:!1,renderOverviewRuler:!1};function zo(t){const e=M.c(11),{diff:s,emptyMessage:a,rowClassName:n,onDiscardFile:o,hideFileRows:c,editorHeight:l}=t,i=a===void 0?"No file changes in the working tree":a,u=n===void 0?"px-6":n,d=c===void 0?!1:c,h=l===void 0?"380px":l,[f,p]=q.useState(null),[m,b]=q.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=Oo(),e[0]=g):g=e[0];const x=g;if(!s||Object.keys(s.diffs).length===0){let y;return e[1]!==i?(y=r.jsx("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:i}),e[1]=i,e[2]=y):y=e[2],y}let j;return e[3]!==s.diffs||e[4]!==m||e[5]!==h||e[6]!==f||e[7]!==d||e[8]!==o||e[9]!==u?(j=r.jsx("div",{className:"divide-y",children:Object.entries(s.diffs).map(y=>{const[v,P]=y,{from:w,to:k}=P,N=f===v,R=w===null,C=k===null,A=v.startsWith("/")?v.slice(1):v,S=A.lastIndexOf("/"),E=S>=0?A.slice(S+1):A,F=S>=0?A.slice(0,S):null,I=vi(v),T=R?"bg-success":C?"bg-destructive":"bg-warning";return d?r.jsx("div",{children:r.jsx(Hn,{original:w??"",modified:k??"",language:I,theme:x,height:h,loading:r.jsx(ta,{height:h}),options:qo})},v):r.jsxs("div",{children:[r.jsxs("div",{className:X("flex items-center gap-3 py-3 hover:bg-accent",u),children:[r.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:()=>p(N?null:v),children:r.jsx(ua,{className:X("h-3.5 w-3.5 transition-transform",N&&"rotate-90")})}),r.jsx("div",{className:X("h-2.5 w-2.5 shrink-0 rounded-full",T)}),r.jsx(Ma,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:E}),F&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:F}),o?r.jsxs(Ss,{children:[r.jsx(Ps,{asChild:!0,children:r.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:r.jsx(Gr,{className:"h-3.5 w-3.5"})})}),r.jsx(js,{align:"end",children:r.jsx(Gt,{className:"text-destructive focus:text-destructive",onSelect:()=>b(v),children:"Discard changes"})})]}):null]}),m===v&&o?r.jsxs("div",{className:X("flex items-center justify-between gap-3 border-t bg-destructive/5 py-2.5",u),children:[r.jsxs("span",{className:"text-xs text-destructive",children:["Discard all changes to"," ",r.jsx("span",{className:"font-medium",children:E}),"? This cannot be undone."]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(ye,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(null),children:"Cancel"}),r.jsx(ye,{type:"button",variant:"destructive",size:"sm",onClick:()=>{b(null),o(v)},children:"Discard"})]})]}):null,N&&r.jsx("div",{className:"border-t",children:r.jsx(Hn,{original:w??"",modified:k??"",language:I,theme:x,height:h,loading:r.jsx(ta,{height:h}),options:kr})})]},v)})}),e[3]=s.diffs,e[4]=m,e[5]=h,e[6]=f,e[7]=d,e[8]=o,e[9]=u,e[10]=j):j=e[10],j}function Ho(t){if(t.kind!=="block"||t.isSiteApp||!t.blockKey)return null;const e=(t.toJson??t.fromJson)?.__resolveType;return typeof e=="string"&&ji(e)?t.blockKey:null}function Ko(t){return t.kind!=="page"?!0:!t.pagePath||$t(t.pagePath).length>0}function Vo(t,e){try{return wi(t,Vl,e)}catch{return null}}function Go(t,e,s){if(!e)return;const a=Kl(e,t);if(!a)return null;if($t(a.path).length===0||s?.path!==a.path)return a.path;const n=xn(a.path,s.params);return $t(n).length===0?n:a.path}function Qo(t){return t.sectionKey&&!t.v8?Vo(t.previewServerUrl,t.sectionKey):Jo(t.previewServerUrl,t.path)}function Wo(t,e){if(t.kind!=="page")return"/";const s=t.pagePath;if(!s)return"";if($t(s).length===0)return s;if(e?.path!==s)return"";const a=xn(s,e.params);return $t(a).length===0?a:""}function Jo(t,e){const s=e.trim();if(!s||$t(s).length>0)return null;try{const a=new URL(t),n=new URL(s.startsWith("/")?s:`/${s}`,a);return n.origin===a.origin?n:null}catch{return null}}function Xo(t,e){return e?.kind==="pointer"&&e.link?jn(t.toString(),e.link):Cr(t,e)}function Cr(t,e){if(!e)return null;if(e.kind==="pointer")return jn(t.toString(),e.pointer);try{return new URL(`${t.pathname}${t.search}`,e.previewUrl).href}catch{return null}}function Yo(t,e,s){return e===null?!1:t!=="other"||s?.kind==="sandbox"}function Zo(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 Nr=q.createContext(!0),ec=["split","before","after","code"];function tc(t){return ec.includes(t)}const Ar={desktop:1280,mobile:412};function sc(t,e){const s=(o,c)=>t.unreadable?.includes(c)?e:o?`${JSON.stringify(o,null,2)}
10
+ `:null,a=t.status==="new"?null:s(t.fromJson,"before"),n=t.status==="removed"?null:s(t.toJson,"after");return a===null&&n===null?{diffs:{}}:t.status==="edited"&&(a===null||n===null)?{diffs:{}}:{diffs:{[Jr(t.entry.name)]:{from:a,to:n}}}}function Rr(t){const e=M.c(76),{change:s,diff:a,bodyPending:n,previewServerUrl:o,draft:c,lastPage:l,v8:i,onReady:u}=t,d=xe(),h=q.use(Nr),f=Ho(s),p=i?null:f,m=i?f:null,b=m?Go(m,i?.blocks,l):void 0,g=m!==null&&b===null,x=Yo(s.kind,o,c)&&(m===null||typeof b=="string"),[j,y]=q.useState(null),v=x?j??"split":"code",[P,w]=q.useState("desktop"),[k,N]=q.useState(null),R=k??(m?b??"":Wo(s,l));let C;e[0]!==s?(C=Ko(s),e[0]=s,e[1]=C):C=e[1];const A=C,S=o?Qo({previewServerUrl:o,sectionKey:f,path:R,v8:!!i}):null,E=S?jn(S.toString(),Pi):null,F=S?Cr(S,c):null,I=S?Xo(S,c):null;let T;e[2]!==s||e[3]!==a?.diffs||e[4]!==d?(T=s.entry?sc(s,d("thread.publishCompare.sideUnreadable")):{diffs:Object.fromEntries(s.filepaths.flatMap(O=>{const ne=a?.diffs[O];return ne?[[O,ne]]:[]}))},e[2]=s,e[3]=a?.diffs,e[4]=d,e[5]=T):T=e[5];const D=T;let Y;e[6]!==D.diffs?(Y=Object.keys(D.diffs),e[6]=D.diffs,e[7]=Y):Y=e[7];const ae=Y.length>0;let H;e:{if(p!==null){H=null;break e}if(m!==null){const ne=R.trim();if(!ne){H=null;break e}H=$t(ne).length>0?d("thread.publishCompare.dynamicHint",{template:ne}):d("thread.publishCompare.blockHint",{path:ne});break e}if(s.kind!=="page"){let ne;e[8]!==d?(ne=d("thread.publishCompare.globalHint"),e[8]=d,e[9]=ne):ne=e[9],H=ne;break e}let O;e[10]!==s.pagePath||e[11]!==d?(O=s.pagePath&&$t(s.pagePath).length>0?d("thread.publishCompare.dynamicHint",{template:s.pagePath}):null,e[10]=s.pagePath,e[11]=d,e[12]=O):O=e[12],H=O}const _=H,z=Zo(s,!!i),[ee,Q]=q.useState(nc);let B;e[13]===Symbol.for("react.memo_cache_sentinel")?(B=O=>Q(ne=>ne.has(O)?ne:new Set(ne).add(O)),e[13]=B):B=e[13];const ie=B;let U;e[14]!==i?(U=O=>i?r.jsx(lc,{...O,onLoaded:ie}):r.jsx(rc,{...O}),e[14]=i,e[15]=U):U=e[15];const oe=U,se=(x?[z.before==="new"?null:E,z.after==="removed"?null:F].flatMap(O=>O?[Sn(O,P)]:[]):[]).every(O=>ee.has(O));let $;e[16]!==u||e[17]!==se?($=se&&u?O=>{O&&u()}:void 0,e[16]=u,e[17]=se,e[18]=$):$=e[18];const te=$,re=z.before==="new"?r.jsx(us,{icon:r.jsx(Oa,{className:"size-5 text-brand"}),title:d("thread.publishCompare.newTitle"),description:d("thread.publishCompare.newDescription")}):oe({url:E,device:P,title:d("thread.publishCompare.before"),missing:d("thread.publishCompare.enterPath")}),he=z.after==="removed"?r.jsx(us,{icon:r.jsx(Ts,{className:"size-5 text-destructive"}),title:d("thread.publishCompare.removedTitle"),description:d("thread.publishCompare.removedDescription")}):oe({url:F,device:P,title:d("thread.publishCompare.after"),missing:d(S?"thread.publishCompare.draftUnavailable":"thread.publishCompare.enterPath")});let G;e[19]!==x||e[20]!==y||e[21]!==h||e[22]!==d||e[23]!==v?(G=x||h?r.jsx(Da,{value:v,onValueChange:O=>{tc(O)&&y(O)},children:r.jsxs(Ia,{className:"h-8 w-auto",variant:"pill",children:[x?r.jsxs(r.Fragment,{children:[r.jsx(Lt,{value:"split",className:"px-3 text-xs",children:d("thread.publishCompare.sideBySide")}),r.jsx(Lt,{value:"before",className:"px-3 text-xs",children:d("thread.publishCompare.before")}),r.jsx(Lt,{value:"after",className:"px-3 text-xs",children:d("thread.publishCompare.after")})]}):null,h?r.jsx(Lt,{value:"code",className:"px-3 text-xs",children:d("thread.publishCompare.code")}):null]})}):null,e[19]=x,e[20]=y,e[21]=h,e[22]=d,e[23]=v,e[24]=G):G=e[24];let pe;e[25]!==I||e[26]!==x||e[27]!==s.pagePath||e[28]!==P||e[29]!==R||e[30]!==A||e[31]!==p||e[32]!==w||e[33]!==N||e[34]!==d||e[35]!==v?(pe=x&&v!=="code"?r.jsxs(r.Fragment,{children:[p?null:A?r.jsx(Qr,{value:R,onChange:O=>N(O.target.value),placeholder:s.pagePath??"/","aria-label":d("thread.publishCompare.pathLabel"),className:"h-8 w-56 font-mono text-xs"}):r.jsx("span",{className:"max-w-56 truncate px-1 font-mono text-xs text-muted-foreground",children:R}),r.jsxs("div",{className:"flex items-center rounded-lg border p-0.5",children:[r.jsx(sa,{active:P==="desktop",label:d("thread.publishCompare.desktop"),onClick:()=>w("desktop"),children:r.jsx(yi,{className:"size-3.5"})}),r.jsx(sa,{active:P==="mobile",label:d("thread.publishCompare.mobile"),onClick:()=>w("mobile"),children:r.jsx(Sl,{className:"size-3.5"})})]}),I?r.jsxs("a",{href:I,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:[r.jsx(Wr,{className:"size-3.5"}),d("thread.publishCompare.openDraft")]}):null]}):null,e[25]=I,e[26]=x,e[27]=s.pagePath,e[28]=P,e[29]=R,e[30]=A,e[31]=p,e[32]=w,e[33]=N,e[34]=d,e[35]=v,e[36]=pe):pe=e[36];let Z;e[37]!==G||e[38]!==pe?(Z=r.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b bg-background px-4 py-2.5 max-md:pr-12",children:[G,pe]}),e[37]=G,e[38]=pe,e[39]=Z):Z=e[39];let L;e[40]!==x||e[41]!==_||e[42]!==v?(L=_&&x&&v!=="code"?r.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-2xs text-muted-foreground",children:_}):null,e[40]=x,e[41]=_,e[42]=v,e[43]=L):L=e[43];let K;e[44]!==g||e[45]!==h||e[46]!==d?(K=g&&h?r.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-2xs text-muted-foreground",children:d("thread.publishCompare.notOnAnyPage")}):null,e[44]=g,e[45]=h,e[46]=d,e[47]=K):K=e[47];let ce;e[48]!==o||e[49]!==h||e[50]!==d||e[51]!==m||e[52]!==b||e[53]!==v?(ce=v==="code"&&!h?m!==null&&b===void 0?r.jsx(ft,{className:"m-4 h-64 rounded"}):o===null?r.jsx(us,{icon:r.jsx(xs,{className:"size-5 text-muted-foreground"}),title:d("thread.publishCompare.previewNotReadyTitle"),description:d("thread.publishCompare.draftUnavailable")}):r.jsx(us,{icon:r.jsx(xs,{className:"size-5 text-muted-foreground"}),title:d("thread.publishCompare.noPreviewTitle"),description:d("thread.publishCompare.noPreviewDescription")}):null,e[48]=o,e[49]=h,e[50]=d,e[51]=m,e[52]=b,e[53]=v,e[54]=ce):ce=e[54];let je;e[55]!==n||e[56]!==ae||e[57]!==D||e[58]!==h||e[59]!==d||e[60]!==v?(je=v==="code"&&h?r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background [scrollbar-width:thin]",children:ae?r.jsx(zo,{diff:D,hideFileRows:!0,editorHeight:"70vh"}):n?r.jsx(ft,{className:"m-4 h-64 rounded"}):r.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:d("thread.publishPopover.detailsUnavailable")})}):null,e[55]=n,e[56]=ae,e[57]=D,e[58]=h,e[59]=d,e[60]=v,e[61]=je):je=e[61];let fe;e[62]!==he||e[63]!==re||e[64]!==x||e[65]!==d||e[66]!==v?(fe=x?r.jsxs("div",{className:X("flex min-h-0 flex-1 gap-3 p-3",v==="code"&&"hidden"),children:[r.jsx(na,{label:d("thread.publishCompare.before"),hidden:v==="after",children:re}),r.jsx(na,{label:d("thread.publishCompare.after"),highlight:!0,hidden:v==="before",children:he})]}):null,e[62]=he,e[63]=re,e[64]=x,e[65]=d,e[66]=v,e[67]=fe):fe=e[67];let Ee;return e[68]!==te||e[69]!==Z||e[70]!==L||e[71]!==K||e[72]!==ce||e[73]!==je||e[74]!==fe?(Ee=r.jsxs("div",{ref:te,className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/40",children:[Z,L,K,ce,je,fe]}),e[68]=te,e[69]=Z,e[70]=L,e[71]=K,e[72]=ce,e[73]=je,e[74]=fe,e[75]=Ee):Ee=e[75],Ee}function nc(){return new Set}function sa(t){const e=M.c(8),{active:s,label:a,onClick:n,children:o}=t,c=s&&"bg-accent text-foreground";let l;e[0]!==c?(l=X("flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground",c),e[0]=c,e[1]=l):l=e[1];let i;return e[2]!==s||e[3]!==o||e[4]!==a||e[5]!==n||e[6]!==l?(i=r.jsx("button",{type:"button","aria-label":a,"aria-pressed":s,title:a,onClick:n,className:l,children:o}),e[2]=s,e[3]=o,e[4]=a,e[5]=n,e[6]=l,e[7]=i):i=e[7],i}function na(t){const e=M.c(18),{label:s,highlight:a,hidden:n,children:o}=t,c=a===void 0?!1:a,i=(n===void 0?!1:n)&&"hidden";let u;e[0]!==i?(u=X("flex min-h-0 min-w-0 flex-1 flex-col gap-1.5",i),e[0]=i,e[1]=u):u=e[1];const d=c&&"bg-brand";let h;e[2]!==d?(h=X("size-1.5 rounded-full bg-muted-foreground/50",d),e[2]=d,e[3]=h):h=e[3];let f;e[4]!==h?(f=r.jsx("span",{className:h}),e[4]=h,e[5]=f):f=e[5];let p;e[6]!==s||e[7]!==f?(p=r.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 text-2xs font-medium text-muted-foreground",children:[f,s]}),e[6]=s,e[7]=f,e[8]=p):p=e[8];const m=c&&"border-brand/60";let b;e[9]!==m?(b=X("relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-background",m),e[9]=m,e[10]=b):b=e[10];let g;e[11]!==o||e[12]!==b?(g=r.jsx("div",{className:b,children:o}),e[11]=o,e[12]=b,e[13]=g):g=e[13];let x;return e[14]!==g||e[15]!==u||e[16]!==p?(x=r.jsxs("div",{className:u,children:[p,g]}),e[14]=g,e[15]=u,e[16]=p,e[17]=x):x=e[17],x}function us(t){const e=M.c(10),{icon:s,title:a,description:n}=t;let o;e[0]!==s?(o=r.jsx("div",{className:"mb-1",children:s}),e[0]=s,e[1]=o):o=e[1];let c;e[2]!==a?(c=r.jsx("p",{className:"text-sm font-medium",children:a}),e[2]=a,e[3]=c):c=e[3];let l;e[4]!==n?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[4]=n,e[5]=l):l=e[5];let i;return e[6]!==o||e[7]!==c||e[8]!==l?(i=r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 px-6 text-center",children:[o,c,l]}),e[6]=o,e[7]=c,e[8]=l,e[9]=i):i=e[9],i}function ac(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 rc(t){const e=M.c(24),{url:s,device:a,title:n,missing:o}=t,[c,l]=Sr(),[i,u]=q.useState(null);if(!s){let w;return e[0]!==o?(w=r.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=w):w=e[1],w}let d;e[2]!==a||e[3]!==s?(d=Sn(s,a),e[2]=a,e[3]=s,e[4]=d):d=e[4];const h=d,f=Ar[a],p=c.width>0?Math.min(c.width/f,1):1,m=c.width>0?Math.max((c.width-f*p)/2,0):0;let b;e[5]!==h?(b=()=>u(h),e[5]=h,e[6]=b):b=e[6];const g=c.height>0?c.height/p:"100%",x=`scale(${p})`;let j;e[7]!==f||e[8]!==m||e[9]!==g||e[10]!==x?(j={left:m,width:f,height:g,transform:x,transformOrigin:"top left"},e[7]=f,e[8]=m,e[9]=g,e[10]=x,e[11]=j):j=e[11];let y;e[12]!==h||e[13]!==b||e[14]!==j||e[15]!==n?(y=r.jsx("iframe",{src:h,title:n,sandbox:"allow-scripts allow-same-origin",onLoad:b,className:"absolute top-0 border-0 bg-white",style:j},h),e[12]=h,e[13]=b,e[14]=j,e[15]=n,e[16]=y):y=e[16];let v;e[17]!==i||e[18]!==h?(v=i!==h?r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:r.jsx(Qt,{className:"size-5 motion-reduce:animate-none"})}):null,e[17]=i,e[18]=h,e[19]=v):v=e[19];let P;return e[20]!==l||e[21]!==y||e[22]!==v?(P=r.jsxs("div",{ref:l,className:"absolute inset-0",children:[y,v]}),e[20]=l,e[21]=y,e[22]=v,e[23]=P):P=e[23],P}function lc(t){const e=M.c(21),{url:s,device:a,title:n,missing:o,onLoaded:c}=t,[l,i]=Sr(),[u,d]=q.useState(null),[h,f]=q.useState(null),p=l.width>0&&l.height>0;p&&(u?.width!==l.width||u?.height!==l.height)&&d(l);const m=p?l:u;if(!s){let P;return e[0]!==o?(P=r.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=P):P=e[1],P}let b,g,x,j;if(e[2]!==m||e[3]!==a||e[4]!==c||e[5]!==i||e[6]!==h||e[7]!==n||e[8]!==s){const P=Sn(s,a),w=Ar[a];b=h?.src!==P;const k=[...h&&b?[h]:[],{src:P,logicalWidth:w}];g=i,x="absolute inset-0",j=k.map(N=>{const R=N.src===P&&b;return r.jsx("iframe",{src:N.src,title:n,"aria-hidden":R&&h?!0:void 0,sandbox:"allow-scripts allow-same-origin",onLoad:()=>{N.src===P&&(f(N),c?.(N.src))},className:X("absolute top-0 border-0 bg-white",R&&"pointer-events-none opacity-0"),style:ac(m,N.logicalWidth)},N.src)}),e[2]=m,e[3]=a,e[4]=c,e[5]=i,e[6]=h,e[7]=n,e[8]=s,e[9]=b,e[10]=g,e[11]=x,e[12]=j}else b=e[9],g=e[10],x=e[11],j=e[12];let y;e[13]!==b||e[14]!==h?(y=b?h?r.jsx(Qt,{className:"absolute right-2 top-2 size-4 text-muted-foreground motion-reduce:animate-none"}):r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:r.jsx(Qt,{className:"size-5 motion-reduce:animate-none"})}):null,e[13]=b,e[14]=h,e[15]=y):y=e[15];let v;return e[16]!==g||e[17]!==x||e[18]!==j||e[19]!==y?(v=r.jsxs("div",{ref:g,className:x,children:[j,y]}),e[16]=g,e[17]=x,e[18]=j,e[19]=y,e[20]=v):v=e[20],v}const ic=/^Co-authored-by:\s*([^<\r\n]+?)(?:\s*<[^>\r\n]*>)?\s*$/im;function oc(t){if(!t)return null;const e=ic.exec(t)?.[1]?.trim();return e||null}function cc(t){return/\[bot\]$/i.test(t)||/-bot$/i.test(t)}function dc(t){const e=oc(t.body);if(e)return e;const s=t.author.trim();return!s||cc(s)?null:s}function Tr(t){const e=M.c(9),s=xe(),a=Ns();let n;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(n={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch},e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=n):n=e[3];const o=nr(n);let c;return e[4]!==t||e[5]!==o||e[6]!==a||e[7]!==s?(c=async(l,i,u)=>{try{await ll(o,{blockKeys:i.map(hc),write:()=>il(l.client,i)}),Oe.success(u)}catch(d){const h=d;if(ol(h)){Oe.info(s("siteEditor.discard.changedMeanwhile")),await t.refresh().catch(uc);return}l.source==="local"&&cl(h)&&a.resetQueries({queryKey:Et.contentBackend(t.orgSlug,t.virtualMcpId,"local")}),Oe.error(s("siteEditor.discard.failed"),{description:dn(s,bs(h))})}},e[4]=t,e[5]=o,e[6]=a,e[7]=s,e[8]=c):c=e[8],c}function uc(){}function hc(t){return t.name}function fc(t){const{mode:e,target:s,note:a,allPaths:n,destinationHost:o,publishLockRef:c,onOpenChange:l,refresh:i,onPullRequestChanged:u,onPublished:d,hosted:h=!1,authorName:f,protocol:p}=t,m=xe(),b=Ns(),[g,x]=q.useState(!1),[j,y]=q.useState(),[v,P]=q.useState(null),w=()=>fo(a,h?f?m("siteEditor.publish.defaultNote",{name:f}):m("siteEditor.publish.defaultNoteAnonymous"):m("thread.publishDialog.changesFrom",{branch:s.headBranch})),k=async T=>{try{await T?.()}catch{}},N=nr({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch}),R=async T=>{try{await Es(N,{kind:"publish",reread:!!T,refreshOnError:!0,write:()=>Zl(s,T)}),En(m)}catch(D){ei(m,D,()=>{R(T)})}},C=async T=>{const D=Xl(T,s.branch);Yl(m,T,()=>{R(D)}),l(!1),await k(d)},A=async()=>{c.current=!0,x(!0),y(void 0),P(null);try{const T=await Es(N,{kind:"publish",reread:!0,refreshOnError:!0,write:()=>Ql(s,w().message)});return await C(T),!0}catch(T){T instanceof Wl&&T.code===Xr&&Yr(b,s.orgSlug,s.virtualMcpId);const D=Jl(m,T);return y(D.message),P(D.detail),!1}finally{c.current=!1,x(!1)}},S=async()=>{c.current=!0,x(!0),y(void 0),P(null);try{await po(s,w(),m),En(m,o),l(!1),await Promise.all([k(u),k(d)])}catch(T){const D=Jn(T,m);y(D.headMoved?D.message:m("siteEditor.publish.failed")),P(D.headMoved?null:[D.pullRequest?`#${D.pullRequest.number} ${D.pullRequest.htmlUrl}`:null,bs(T)].filter(Boolean).join(`
11
+ `)||null),D.pullRequest&&await k(u),D.headMoved&&await i()}finally{c.current=!1,x(!1)}},E=async()=>{c.current=!0,x(!0),y(void 0),P(null);try{const T=await bo(s,w());go(T,m),l(!1),await u?.()}catch(T){const D=Jn(T,m);y(D.message||m("thread.publishDialog.failedSubmitForReview")),D.headMoved&&await i()}finally{c.current=!1,x(!1)}},F=Tr({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,refresh:i}),I=async(T,D)=>{try{await Es(N,{kind:"discard",reread:!0,write:()=>ci({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},T)}),Oe.success(D),await i()}catch(Y){Oe.error(m("siteEditor.discard.failed"),{description:dn(m,bs(Y))})}};return{isPublishing:g,publishError:j,publishErrorDetail:v,submit:e==="review"?E:h?A:S,discardChange:T=>{const D=m("thread.publishPopover.discarded",{name:T.name});return p&&T.entry?F(p.backend,[T.entry],D):I(T.filepaths,D)},discardAll:async()=>{const T=m("thread.publishDialog.allChangesDiscarded");if(p){if(p.entries.length===0)return;await F(p.backend,p.entries,T);return}n.length!==0&&await I(n,T)}}}function mc(t,e,s,a,n,o){return["cms-publish-bodies",t,e,s,a,n,o]}const pc=6e4;function bc(t,e){return e?null:t.files.map(s=>`${s.index}${s.working_dir} ${s.path}`).sort().join(`
12
+ `)}function gc(t,e,s){const a=M.c(6);let n;a[0]!==s||a[1]!==t||a[2]!==e?(n=Et.decofile(`${t}/${e}/${s}`),a[0]=s,a[1]=t,a[2]=e,a[3]=n):n=a[3];let o;a[4]!==n?(o={queryKey:n,queryFn:on},a[4]=n,a[5]=o):o=a[5];const{data:c}=Tt(o);return c}function Ir(t){const{orgSlug:e,virtualMcpId:s,branch:a,threadId:n,baseBranch:o,fastPreview:c,recoverSandbox:l}=t,i={orgSlug:e,virtualMcpId:s,branch:a,threadId:n},u=c?{fastPreview:!0}:void 0,d=q.useRef(null),h=async P=>{try{return await P()}catch(w){if(!l||!Za(w))throw w;return d.current??=l(),await d.current,P()}},f=fa({...Ya(i),queryFn:()=>h(()=>yn(i))}),p=f.data,m=p.changedFiles??null,b=p.headSha??null,g=m?m.length>0:di(p)||ui(p),x=Tt({queryKey:mc(e,s,a,o,b,bc(p,c)),queryFn:()=>h(()=>Ja(i,p,o,u)),enabled:g,staleTime:c?pc:0,gcTime:c?void 0:0,throwOnError:(P,w)=>!m&&w.state.data===void 0}),j=gc(e,s,a),y=x.data??null,v=m?yr({files:m,lookup:j,diff:y}):So(y);return{status:p,summary:v,allPaths:m?m.map(P=>P.path):Object.keys(y?.diffs??{}),discardablePaths:c?null:new Set(p.files.map(P=>P.path)),changedFilesTotal:p.changedFilesTotal??v.count,changedFilesTruncated:p.changedFilesTruncated??!1,headSha:b,diff:y,bodiesPending:g&&x.isPending,bodiesFailed:x.isError,cardsPending:!m&&g&&x.isPending,refresh:()=>Promise.all([f.refetch(),c?null:x.refetch()])}}function xc(t){const e=M.c(4);let s;e[0]!==t?(s=Et.decofile(t),e[0]=t,e[1]=s):s=e[1];let a;e[2]!==s?(a={queryKey:s,queryFn:on},e[2]=s,e[3]=a):a=e[3];const{data:n}=Tt(a);return n}function vc(t,e){const s=M.c(5);let a;s[0]!==t||s[1]!==e?(a=e?ul(e,t):Et.liveMeta("","no-scope"),s[0]=t,s[1]=e,s[2]=a):a=s[2];let n;s[3]!==a?(n={queryKey:a,queryFn:on},s[3]=a,s[4]=n):n=s[4];const{data:o}=Tt(n);return o}function Rn(t){const e=M.c(27),{backend:s,cacheKey:a,scope:n}=t,o=Ns();let c;e[0]!==a?(c=Et.contentChanges(a),e[0]=a,e[1]=c):c=e[1];let l;e[2]!==s.client||e[3]!==a||e[4]!==o?(l=()=>hl(o,s.client,a),e[2]=s.client,e[3]=a,e[4]=o,e[5]=l):l=e[5];let i;e[6]!==c||e[7]!==l?(i={queryKey:c,queryFn:l,staleTime:0},e[6]=c,e[7]=l,e[8]=i):i=e[8];const u=fa(i),d=u.data,h=dl(s,a,d),f=xc(a),p=vc(s,n);let m;if(e[9]!==s.source||e[10]!==d.changes||e[11]!==f||e[12]!==p||e[13]!==h.data){const P=f&&p?li(f,p):null,w=f&&p?ii(f,p):null;m=Do({changes:d.changes,sides:h.data??null,lookup:f,meta:p,hosted:s.source==="github",...P?{missingRules:P}:{},...w?{missingRuleUses:w}:{}}),e[9]=s.source,e[10]=d.changes,e[11]=f,e[12]=p,e[13]=h.data,e[14]=m}else m=e[14];const b=m;let g;e[15]!==d.changes?(g=Object.entries(d.changes).map(yc),e[15]=d.changes,e[16]=g):g=e[16];const x=b.count>0&&h.isPending,j=f??null;let y;e[17]!==u?(y=()=>u.refetch(),e[17]=u,e[18]=y):y=e[18];let v;return e[19]!==d||e[20]!==h.isError||e[21]!==b||e[22]!==g||e[23]!==x||e[24]!==j||e[25]!==y?(v={changes:d,summary:b,entries:g,sidesPending:x,sidesFailed:h.isError,blocks:j,refresh:y},e[19]=d,e[20]=h.isError,e[21]=b,e[22]=g,e[23]=x,e[24]=j,e[25]=y,e[26]=v):v=e[26],v}function yc(t){const[e,s]=t;return{name:e,version:s.version}}function wc(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Pc(t){const e=M.c(27),{orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,status:l,diff:i,enabled:u}=t,[d]=ma(),{language:h}=d;let f,p,m;if(e[0]!==n||e[1]!==i||e[2]!==u||e[3]!==c||e[4]!==h||e[5]!==s||e[6]!==l||e[7]!==o||e[8]!==a){const P=i?Is(i):"";f=u&&!!n&&!!l&&!!i&&P!=="",m=Tt,p=wc({orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,signature:P,language:h}),e[0]=n,e[1]=i,e[2]=u,e[3]=c,e[4]=h,e[5]=s,e[6]=l,e[7]=o,e[8]=a,e[9]=f,e[10]=p,e[11]=m}else f=e[9],p=e[10],m=e[11];let b;e[12]!==n||e[13]!==i||e[14]!==h||e[15]!==s||e[16]!==l||e[17]!==o||e[18]!==a?(b=()=>hi({orgSlug:s,virtualMcpId:a,branch:n,threadId:o},{status:l,diff:i,language:h}),e[12]=n,e[13]=i,e[14]=h,e[15]=s,e[16]=l,e[17]=o,e[18]=a,e[19]=b):b=e[19];let g;e[20]!==f||e[21]!==p||e[22]!==b?(g={queryKey:p,queryFn:b,enabled:f,staleTime:1/0,gcTime:6e5,retry:jc},e[20]=f,e[21]=p,e[22]=b,e[23]=g):g=e[23];const x=m(g),j=x.data??null,y=f&&x.isFetching&&!x.data;let v;return e[24]!==j||e[25]!==y?(v={verdict:j,loading:y},e[24]=j,e[25]=y,e[26]=v):v=e[26],v}function jc(t,e){return!Za(e)&&t<1}function Dr(t){const e=M.c(30),{orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,status:l,diff:i,policy:u,judgeEnabled:d,paths:h}=t,f=d===void 0?!0:d,p=h===void 0?null:h;let m;e[0]!==i||e[1]!==f||e[2]!==u?(m=f&&fi(i,u),e[0]=i,e[1]=f,e[2]=u,e[3]=m):m=e[3];const b=m;let g;e[4]!==n||e[5]!==i||e[6]!==c||e[7]!==b||e[8]!==s||e[9]!==l||e[10]!==o||e[11]!==a?(g={orgSlug:s,virtualMcpId:a,branch:n,threadId:o,fastPreview:c,status:l,diff:i,enabled:b},e[4]=n,e[5]=i,e[6]=c,e[7]=b,e[8]=s,e[9]=l,e[10]=o,e[11]=a,e[12]=g):g=e[12];const{verdict:x,loading:j}=Pc(g);if(!i&&p){let w;e[13]!==p||e[14]!==u?(w=mi(p,u),e[13]=p,e[14]=u,e[15]=w):w=e[15];let k;return e[16]!==w?(k={gate:w,ready:!1},e[16]=w,e[17]=k):k=e[17],k}if(!i){let w;return e[18]===Symbol.for("react.memo_cache_sentinel")?(w={gate:{allowed:!0,reason:null},ready:!1},e[18]=w):w=e[18],w}if(!b){let w;e[19]!==i||e[20]!==u?(w=pi(i,u),e[19]=i,e[20]=u,e[21]=w):w=e[21];let k;return e[22]!==w?(k={gate:w,ready:!0},e[22]=w,e[23]=k):k=e[23],k}let y;e[24]!==j||e[25]!==x?(y=bi(x,j),e[24]=j,e[25]=x,e[26]=y):y=e[26];const v=!j;let P;return e[27]!==y||e[28]!==v?(P={gate:y,ready:v},e[27]=y,e[28]=v,e[29]=P):P=e[29],P}function Sc(t){return["main","master"].includes(t.trim().toLowerCase())}function kc(t,e,s,a){return t===0?a("thread.publishPopover.publish"):s||!Sc(e)?t===1?a("thread.publishPopover.publishOne"):a("thread.publishPopover.publishCount",{count:t}):t===1?a("thread.publishPopover.publishOneInProduction"):a("thread.publishPopover.publishCountInProduction",{count:t})}const Cc=2500;function Nc(t){const{selectedId:e,readyIds:s,lastShownId:a,liveIds:n}=t;return e===null||s.has(e)?e:a!==null&&a!==e&&n.includes(a)?a:e}function Br(t){const e=M.c(16),s=q.useRef(!1),a=xe();let n;e[0]!==t?(n=h=>{!h&&s.current||t.onOpenChange(h)},e[0]=t,e[1]=n):n=e[1];const o=n;let c;e[2]!==t.mode||e[3]!==a?(c=t.mode==="review"?a("thread.publishPopover.submitForReview"):a("thread.publishPopover.publish"),e[2]=t.mode,e[3]=a,e[4]=c):c=e[4];let l;e[5]!==c?(l=r.jsx(ba,{className:"sr-only",children:c}),e[5]=c,e[6]=l):l=e[6];let i;e[7]!==t?(i=r.jsx(Ac,{...t,publishLockRef:s}),e[7]=t,e[8]=i):i=e[8];let u;e[9]!==l||e[10]!==i?(u=r.jsxs(ga,{"aria-describedby":void 0,className:"flex h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-none flex-col md:flex-row md:h-[calc(100dvh-6rem)] md:w-[calc(100vw-6rem)] gap-0 overflow-hidden p-0 sm:max-w-none",closeButtonClassName:"top-3.5 right-3.5",children:[l,i]}),e[9]=l,e[10]=i,e[11]=u):u=e[11];let d;return e[12]!==o||e[13]!==t.open||e[14]!==u?(d=r.jsx(pa,{open:t.open,onOpenChange:o,children:u}),e[12]=o,e[13]=t.open,e[14]=u,e[15]=d):d=e[15],d}function Ac(t){const e=M.c(3),s=qt(t.virtualMcpId,t.branch),a=s.kind==="protocol"&&s.source==="github";let n;return e[0]!==a||e[1]!==t?(n=io({open:t.open,hosted:a})?r.jsx(Ic,{...t}):null,e[0]=a,e[1]=t,e[2]=n):n=e[2],n}const Rc=4,Xt="flex h-[45%] min-h-0 min-w-0 shrink-0 md:h-auto md:flex-1";function es(t){const e=M.c(5),{list:s,pane:a}=t;let n;e[0]!==s?(n=r.jsx("div",{className:"flex min-h-0 w-full flex-1 flex-col max-md:border-t md:w-[380px] md:flex-none md:shrink-0 md:border-l md:[&>[data-publish-state]>:first-child]:pr-12",children:s}),e[0]=s,e[1]=n):n=e[1];let o;return e[2]!==a||e[3]!==n?(o=r.jsxs(r.Fragment,{children:[a,n]}),e[2]=a,e[3]=n,e[4]=o):o=e[4],o}function Tn(){const t=M.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:X(Xt,"bg-muted/40 p-3"),children:r.jsx(ft,{className:"h-full w-full rounded-lg"})}),t[0]=e):e=t[0],e}function In(t){const e=M.c(11),{mode:s,title:a,subLine:n,trailing:o}=t,c=s==="review"?Rs:Fa;let l;e[0]!==c?(l=r.jsx(c,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=c,e[1]=l):l=e[1];let i;e[2]!==l||e[3]!==a||e[4]!==o?(i=r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[l,a,o]}),e[2]=l,e[3]=a,e[4]=o,e[5]=i):i=e[5];let u;e[6]!==n?(u=n?r.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:n}):null,e[6]=n,e[7]=u):u=e[7];let d;return e[8]!==i||e[9]!==u?(d=r.jsxs(r.Fragment,{children:[i,u]}),e[8]=i,e[9]=u,e[10]=d):d=e[10],d}function Dn(t){const e=M.c(9),{draftPreviewUrl:s,t:a}=t;let n;e[0]!==s?(n=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=n):n=e[1];const o=!s;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(xs,{className:"size-4"}),e[2]=c):c=e[2];let l;e[3]!==a?(l=a("thread.publishPopover.preview"),e[3]=a,e[4]=l):l=e[4];let i;return e[5]!==n||e[6]!==o||e[7]!==l?(i=r.jsxs(ye,{type:"button",variant:"outline",onClick:n,disabled:o,children:[c,l]}),e[5]=n,e[6]=o,e[7]=l,e[8]=i):i=e[8],i}function Mr(t){const e=M.c(21),{mode:s,draftPreviewUrl:a}=t,n=xe();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(Tn,{}),e[0]=o):o=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(ft,{className:"h-3.5 w-48"}),e[1]=c):c=e[1];let l;e[2]!==s?(l=r.jsx(In,{mode:s,title:c}),e[2]=s,e[3]=l):l=e[3];let i,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Yt,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{}),r.jsx(Ut,{}),r.jsx(Ut,{})]})}),u=r.jsxs(r.Fragment,{children:[r.jsx(ft,{className:"h-3 w-20"}),r.jsx(ft,{className:"h-14 w-full rounded-lg"})]}),e[4]=i,e[5]=u):(i=e[4],u=e[5]);let d;e[6]!==a||e[7]!==n?(d=r.jsx(Dn,{draftPreviewUrl:a,t:n}),e[6]=a,e[7]=n,e[8]=d):d=e[8];const h=s==="review"?"default":"brand";let f;e[9]!==s||e[10]!==n?(f=n(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[9]=s,e[10]=n,e[11]=f):f=e[11];let p;e[12]!==h||e[13]!==f?(p=r.jsx(ye,{type:"button",variant:h,className:"flex-1",disabled:!0,children:f}),e[12]=h,e[13]=f,e[14]=p):p=e[14];let m;e[15]!==d||e[16]!==p?(m=r.jsxs("div",{className:"flex gap-2",children:[d,p]}),e[15]=d,e[16]=p,e[17]=m):m=e[17];let b;return e[18]!==m||e[19]!==l?(b=r.jsx(es,{pane:o,list:r.jsx(Bs,{state:"loading",header:l,body:i,note:u,footer:m})}),e[18]=m,e[19]=l,e[20]=b):b=e[20],b}function Tc(t){const e=M.c(26),{mode:s,draftPreviewUrl:a,message:n,onRetry:o}=t,c=xe();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:X(Xt,"bg-muted/40")}),e[0]=l):l=e[0];let i;e[1]!==c?(i=c("thread.publishPopover.loadFailed"),e[1]=c,e[2]=i):i=e[2];let u;e[3]!==i?(u=r.jsx("span",{className:"truncate",children:i}),e[3]=i,e[4]=u):u=e[4];let d;e[5]!==s||e[6]!==u?(d=r.jsx(In,{mode:s,title:u}),e[5]=s,e[6]=u,e[7]=d):d=e[7];let h;e[8]!==n?(h=r.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:n}),e[8]=n,e[9]=h):h=e[9];let f;e[10]!==a||e[11]!==c?(f=r.jsx(Dn,{draftPreviewUrl:a,t:c}),e[10]=a,e[11]=c,e[12]=f):f=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(cn,{className:"size-4"}),e[13]=p):p=e[13];let m;e[14]!==c?(m=c("thread.publishPopover.retry"),e[14]=c,e[15]=m):m=e[15];let b;e[16]!==o||e[17]!==m?(b=r.jsxs(ye,{type:"button",variant:"outline",className:"flex-1",onClick:o,children:[p,m]}),e[16]=o,e[17]=m,e[18]=b):b=e[18];let g;e[19]!==f||e[20]!==b?(g=r.jsxs("div",{className:"flex gap-2",children:[f,b]}),e[19]=f,e[20]=b,e[21]=g):g=e[21];let x;return e[22]!==g||e[23]!==d||e[24]!==h?(x=r.jsx(es,{pane:l,list:r.jsx(Bs,{state:"ready",header:d,body:h,footer:g})}),e[22]=g,e[23]=d,e[24]=h,e[25]=x):x=e[25],x}function Ic(t){const e=M.c(3),s=t.mode??"publish";let a;return e[0]!==s||e[1]!==t?(a=r.jsx(xa,{children:n=>{const{reset:o}=n;return r.jsx(va,{fallback:c=>{const{error:l,resetError:i}=c;return r.jsx(Tc,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:l?.message??"",onRetry:()=>{o(),i()}})},children:r.jsx(q.Suspense,{fallback:r.jsx(Mr,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),children:r.jsx(Dc,{...t})})})}}),e[0]=s,e[1]=t,e[2]=a):a=e[2],a}function Dc(t){const e=M.c(13),s=qt(t.virtualMcpId,t.branch);let a;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(a={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch},e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=a):a=e[3];const n=un(a);if(s.kind==="protocol"&&n){let c;return e[4]!==s||e[5]!==n||e[6]!==t?(c=s.source==="sandbox"?r.jsx(Fc,{...t,backend:s,cacheKey:n}):r.jsx(Mc,{...t,backend:s,cacheKey:n}),e[4]=s,e[5]=n,e[6]=t,e[7]=c):c=e[7],c}if(s.kind!=="legacy"){const c=t.mode??"publish";let l;return e[8]!==t.draftPreviewUrl||e[9]!==c?(l=r.jsx(Mr,{mode:c,draftPreviewUrl:t.draftPreviewUrl}),e[8]=t.draftPreviewUrl,e[9]=c,e[10]=l):l=e[10],l}let o;return e[11]!==t?(o=r.jsx(Bc,{...t}),e[11]=t,e[12]=o):o=e[12],o}function Bc(t){const e=M.c(52),s=Zt()?.taskId??null;let a;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?(a={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]=a):a=e[7];const n=Ir(a),o=t.mode!=="review";let c;e[8]!==t.branch||e[9]!==t.fastPreview||e[10]!==t.orgSlug||e[11]!==t.publishPolicy||e[12]!==t.virtualMcpId||e[13]!==n.allPaths||e[14]!==n.diff||e[15]!==n.status||e[16]!==o||e[17]!==s?(c={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:s,fastPreview:t.fastPreview,status:n.status,diff:n.diff,paths:n.allPaths,policy:t.publishPolicy,judgeEnabled:o},e[8]=t.branch,e[9]=t.fastPreview,e[10]=t.orgSlug,e[11]=t.publishPolicy,e[12]=t.virtualMcpId,e[13]=n.allPaths,e[14]=n.diff,e[15]=n.status,e[16]=o,e[17]=s,e[18]=c):c=e[18];const{gate:l}=Dr(c),i=n.discardablePaths;let u;e[19]!==i?(u=j=>i===null||j.every(y=>i.has(y)),e[19]=i,e[20]=u):u=e[20];const d=u;let h;e[21]!==d?(h=j=>d(j.filepaths),e[21]=d,e[22]=h):h=e[22];let f;e[23]!==d||e[24]!==n.allPaths||e[25]!==n.changedFilesTruncated?(f=!n.changedFilesTruncated&&d(n.allPaths),e[23]=d,e[24]=n.allPaths,e[25]=n.changedFilesTruncated,e[26]=f):f=e[26];let p;e[27]!==t.branch||e[28]!==n.status?(p=Pn(n.status)??t.branch,e[27]=t.branch,e[28]=n.status,e[29]=p):p=e[29];const m=n.headSha??void 0;let b;e[30]!==t.fastPreview||e[31]!==n.diff?(b=!t.fastPreview&&n.diff?{expectedDiffSignature:Is(n.diff)}:{},e[30]=t.fastPreview,e[31]=n.diff,e[32]=b):b=e[32];let g;e[33]!==l||e[34]!==n.allPaths||e[35]!==n.bodiesFailed||e[36]!==n.bodiesPending||e[37]!==n.cardsPending||e[38]!==n.changedFilesTotal||e[39]!==n.changedFilesTruncated||e[40]!==n.diff||e[41]!==n.refresh||e[42]!==n.summary||e[43]!==h||e[44]!==f||e[45]!==p||e[46]!==m||e[47]!==b?(g={summary:n.summary,allPaths:n.allPaths,canDiscard:h,canDiscardAll:f,changedFilesTotal:n.changedFilesTotal,changedFilesTruncated:n.changedFilesTruncated,diff:n.diff,bodiesPending:n.bodiesPending,bodiesFailed:n.bodiesFailed,cardsPending:n.cardsPending,refresh:n.refresh,gate:l,headBranch:p,expectedHeadSha:m,...b,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]=f,e[45]=p,e[46]=m,e[47]=b,e[48]=g):g=e[48];let x;return e[49]!==t||e[50]!==g?(x=r.jsx(Bn,{...t,source:g}),e[49]=t,e[50]=g,e[51]=x):x=e[51],x}function Fr(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 Mc(t){const e=M.c(24),{backend:s,cacheKey:a,...n}=t,o=Rn({backend:s,cacheKey:a,scope:{orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch}}),c=s.source==="github",l=Et.hostedPublishReview(n.orgSlug,n.virtualMcpId,n.branch);let i;e[0]!==n.branch||e[1]!==n.orgSlug||e[2]!==n.virtualMcpId?(i=()=>ti({orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch}),e[0]=n.branch,e[1]=n.orgSlug,e[2]=n.virtualMcpId,e[3]=i):i=e[3];let u;e[4]!==c||e[5]!==l||e[6]!==i?(u={queryKey:l,queryFn:i,enabled:c,staleTime:0},e[4]=c,e[5]=l,e[6]=i,e[7]=u):u=e[7];const d=Tt(u);let h;e[8]!==s||e[9]!==o?(h=Fr(o,s),e[8]=s,e[9]=o,e[10]=h):h=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f={allowed:!0,reason:null},e[11]=f):f=e[11];let p;e[12]!==d.data?.alsoChanged?(p=d.data?.alsoChanged??[],e[12]=d.data?.alsoChanged,e[13]=p):p=e[13];let m;e[14]!==p?(m=new Set(p),e[14]=p,e[15]=m):m=e[15];let b;e[16]!==c||e[17]!==n.branch||e[18]!==h||e[19]!==m?(b={...h,gate:f,headBranch:n.branch,hosted:c,alsoChanged:m,otherWork:!1},e[16]=c,e[17]=n.branch,e[18]=h,e[19]=m,e[20]=b):b=e[20];let g;return e[21]!==n||e[22]!==b?(g=r.jsx(Bn,{...n,source:b}),e[21]=n,e[22]=b,e[23]=g):g=e[23],g}function Fc(t){const e=M.c(58);let s,a,n;e[0]!==t?({backend:s,cacheKey:a,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n):(s=e[1],a=e[2],n=e[3]);const o=Zt()?.taskId??null;let c;e[4]!==n.branch||e[5]!==n.orgSlug||e[6]!==n.virtualMcpId?(c={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch},e[4]=n.branch,e[5]=n.orgSlug,e[6]=n.virtualMcpId,e[7]=c):c=e[7];let l;e[8]!==s||e[9]!==a||e[10]!==c?(l={backend:s,cacheKey:a,scope:c},e[8]=s,e[9]=a,e[10]=c,e[11]=l):l=e[11];const i=Rn(l);let u;e[12]!==n.baseBranch||e[13]!==n.branch||e[14]!==n.fastPreview||e[15]!==n.orgSlug||e[16]!==n.recoverSandbox||e[17]!==n.virtualMcpId||e[18]!==o?(u={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:o,baseBranch:n.baseBranch,fastPreview:n.fastPreview,recoverSandbox:n.recoverSandbox},e[12]=n.baseBranch,e[13]=n.branch,e[14]=n.fastPreview,e[15]=n.orgSlug,e[16]=n.recoverSandbox,e[17]=n.virtualMcpId,e[18]=o,e[19]=u):u=e[19];const d=Ir(u),h=n.mode!=="review";let f;e[20]!==d.allPaths||e[21]!==d.diff||e[22]!==d.status||e[23]!==n.branch||e[24]!==n.fastPreview||e[25]!==n.orgSlug||e[26]!==n.publishPolicy||e[27]!==n.virtualMcpId||e[28]!==h||e[29]!==o?(f={orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,threadId:o,fastPreview:n.fastPreview,status:d.status,diff:d.diff,paths:d.allPaths,policy:n.publishPolicy,judgeEnabled:h},e[20]=d.allPaths,e[21]=d.diff,e[22]=d.status,e[23]=n.branch,e[24]=n.fastPreview,e[25]=n.orgSlug,e[26]=n.publishPolicy,e[27]=n.virtualMcpId,e[28]=h,e[29]=o,e[30]=f):f=e[30];const{gate:p}=Dr(f);let m;if(e[31]!==d.allPaths||e[32]!==i){let k;e[34]!==i?(k=N=>{const R=Cn(N);return R===null?!wn(N):!Object.hasOwn(i.changes.changes,R)},e[34]=i,e[35]=k):k=e[35],m=d.allPaths.some(k),e[31]=d.allPaths,e[32]=i,e[33]=m}else m=e[33];const b=m;let g;e[36]!==s||e[37]!==i?(g=Fr(i,s),e[36]=s,e[37]=i,e[38]=g):g=e[38];let x;e[39]!==d||e[40]!==i?(x=()=>Promise.all([i.refresh(),d.refresh()]),e[39]=d,e[40]=i,e[41]=x):x=e[41];let j;e[42]!==d.status||e[43]!==n.branch?(j=Pn(d.status)??n.branch,e[42]=d.status,e[43]=n.branch,e[44]=j):j=e[44];const y=d.headSha??void 0;let v;e[45]!==d.diff?(v=d.diff?{expectedDiffSignature:Is(d.diff)}:{},e[45]=d.diff,e[46]=v):v=e[46];let P;e[47]!==p||e[48]!==b||e[49]!==y||e[50]!==v||e[51]!==g||e[52]!==x||e[53]!==j?(P={...g,refresh:x,gate:p,headBranch:j,expectedHeadSha:y,...v,hosted:!1,otherWork:b},e[47]=p,e[48]=b,e[49]=y,e[50]=v,e[51]=g,e[52]=x,e[53]=j,e[54]=P):P=e[54];let w;return e[55]!==n||e[56]!==P?(w=r.jsx(Bn,{...n,source:P}),e[55]=n,e[56]=P,e[57]=w):w=e[57],w}function Bn(t){const e=M.c(131),{source:s,publishLockRef:a,onOpenChange:n,mode:o,fastPreview:c,orgSlug:l,virtualMcpId:i,branch:u,baseBranch:d,repoTarget:h,owner:f,repo:p,draftPreviewUrl:m,destinationHost:b,previewServerUrl:g,compareDraft:x,lastPublishedPr:j,onRequestApproval:y,openPullRequest:v,onPullRequestChanged:P,onPublished:w,notLive:k}=t,N=o===void 0?"publish":o,R=j===void 0?null:j,C=v===void 0?null:v,A=k===void 0?!1:k,S=xe(),[E]=ma(),{language:F}=E,I=Zt()?.taskId??null,{data:T}=ks.useSession(),D=Pa(ja(l,i,u)),{allPaths:Y,changedFilesTotal:ae,changedFilesTruncated:H,diff:_,bodiesFailed:z,refresh:ee,gate:Q,hosted:B,otherWork:ie}=s;let U;e[0]!==x||e[1]!==s.bodiesPending||e[2]!==s.cardsPending||e[3]!==s.summary?(U={summary:s.summary,cardsPending:s.cardsPending,bodiesPending:s.bodiesPending,compareDraft:x},e[0]=x,e[1]=s.bodiesPending,e[2]=s.cardsPending,e[3]=s.summary,e[4]=U):U=e[4];const oe=U;let J;e[5]!==B?(J={hosted:B},e[5]=B,e[6]=J):J=e[6];const se=lo(oe,J),{summary:$,cardsPending:te,bodiesPending:re,compareDraft:he}=se.shown,[G,pe]=q.useState(null),[Z,L]=q.useState(!1),[K,ce]=q.useState($c);let je;e[7]===Symbol.for("react.memo_cache_sentinel")?(je=W=>ce(be=>be.has(W)?be:new Set(be).add(W)),e[7]=je):je=e[7];const fe=je,[Ee,O]=q.useState(null);let ne;e[8]===Symbol.for("react.memo_cache_sentinel")?(ne=[],e[8]=ne):ne=e[8];const[Le,_e]=q.useState(ne);let Ue;e[9]!==s.v8?(Ue=W=>{O(W),_e(be=>[W,...be.filter(me=>me!==W)]),s.v8&&setTimeout(()=>fe(W),Cc)},e[9]=s.v8,e[10]=Ue):Ue=e[10];const mt=Ue,[st,we]=q.useState(null);let De;e[11]!==G||e[12]!==$?(De=Co(G,Ro($)),e[11]=G,e[12]=$,e[13]=De):De=e[13];const Fe=De,Be=[...$.pages,...$.blocks,...$.other],Pe=Be.find(W=>Ie(W)===Ee)??Be[0]??null,Me=Pe?Ie(Pe):null,Se=[...new Set([...Me?[Me]:[],...Le,...Be.map(Ie)])].filter(W=>Be.some(be=>Ie(be)===W)).slice(0,Rc),$e=!!s.v8,[nt,pt]=q.useState(null),Re=$e?Nc({selectedId:Me,readyIds:K,lastShownId:nt,liveIds:Se}):Me;$e&&Re===Me&&Re!==nt&&pt(Re);const de=N==="review"&&!B,V=te?"loading":re?"manifest":"ready",ve=C?.state==="open",ke=s.headBranch,Ce=T?.user;let Ne;e[14]!==Ce?(Ne=ir(Ce),e[14]=Ce,e[15]=Ne):Ne=e[15];let qe;e[16]!==s.expectedDiffSignature?(qe=s.expectedDiffSignature?{expectedDiffSignature:s.expectedDiffSignature}:{},e[16]=s.expectedDiffSignature,e[17]=qe):qe=e[17];let at;e[18]!==d||e[19]!==u||e[20]!==c||e[21]!==l||e[22]!==f||e[23]!==p||e[24]!==h||e[25]!==s.expectedHeadSha||e[26]!==s.headBranch||e[27]!==Ne||e[28]!==qe||e[29]!==I||e[30]!==i?(at={orgSlug:l,virtualMcpId:i,branch:u,threadId:I,fastPreview:c,baseBranch:d,target:h,owner:f,repo:p,headBranch:ke,coAuthor:Ne,expectedHeadSha:s.expectedHeadSha,...qe},e[18]=d,e[19]=u,e[20]=c,e[21]=l,e[22]=f,e[23]=p,e[24]=h,e[25]=s.expectedHeadSha,e[26]=s.headBranch,e[27]=Ne,e[28]=qe,e[29]=I,e[30]=i,e[31]=at):at=e[31];const bt=at,gt=de?"review":"publish",We=T?.user?.name;let Je;e[32]!==Y||e[33]!==b||e[34]!==B||e[35]!==Fe||e[36]!==n||e[37]!==w||e[38]!==P||e[39]!==a||e[40]!==ee||e[41]!==s.protocol||e[42]!==gt||e[43]!==We||e[44]!==bt?(Je={mode:gt,target:bt,note:Fe,allPaths:Y,destinationHost:b,publishLockRef:a,onOpenChange:n,refresh:ee,onPullRequestChanged:P,onPublished:w,hosted:B,authorName:We,protocol:s.protocol},e[32]=Y,e[33]=b,e[34]=B,e[35]=Fe,e[36]=n,e[37]=w,e[38]=P,e[39]=a,e[40]=ee,e[41]=s.protocol,e[42]=gt,e[43]=We,e[44]=bt,e[45]=Je):Je=e[45];const{isPublishing:Ae,publishError:rt,publishErrorDetail:lt,submit:xt,discardChange:It,discardAll:vt}=fc(Je),Xe=Na(l,i).phase==="saving",Ye=B&&A&&$.count===0,Ze=$.count>0||ie||Ye,Dt=!Ae&&Ze&&(de||Q.allowed);let it;e[46]!==d||e[47]!==de||e[48]!==Ye||e[49]!==s.v8||e[50]!==$.count||e[51]!==S?(it=de?$.count===0?S("thread.publishPopover.submitForReview"):$.count===1?S("thread.publishPopover.submitOneForReview"):S("thread.publishPopover.submitCountForReview",{count:$.count}):Ye?S("thread.publishPopover.notLive"):kc($.count,d,!!s.v8,S),e[46]=d,e[47]=de,e[48]=Ye,e[49]=s.v8,e[50]=$.count,e[51]=S,e[52]=it):it=e[52];const yt=it;let ot;e:{if(de&&ve){let me;e[53]!==C.number||e[54]!==S?(me=S("thread.publishPopover.updatesPullRequest",{number:C.number}),e[53]=C.number,e[54]=S,e[55]=me):me=e[55],ot=me;break e}const W=R;if(!W?.mergedAt){ot=null;break e}let be;if(e[56]!==F||e[57]!==W||e[58]!==S){const me=Zr(new Date(W.mergedAt),F),Te=dc(W);be=Te?S("thread.publishPopover.lastPublishedBy",{when:me,name:Te}):S("thread.publishPopover.lastPublished",{when:me}),e[56]=F,e[57]=W,e[58]=S,e[59]=be}else be=e[59];ot=be}const Bt=ot;let Mt;e[60]!==de||e[61]!==$.count||e[62]!==S?(Mt=de?S("thread.publishPopover.submitForReview"):$.count===1?S("thread.publishPopover.publishOne"):$.count>1?S("thread.publishPopover.publishCount",{count:$.count}):S("thread.publishPopover.publish"),e[60]=de,e[61]=$.count,e[62]=S,e[63]=Mt):Mt=e[63];const _t=Mt,Ft=(W,be)=>be.length===0?null:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"px-0.5 text-2xs font-medium text-muted-foreground",children:W}),be.map(me=>{const Te=Ie(me);return r.jsx(jr,{change:me,bodyPending:re,selected:Pe!==null&&Ie(Pe)===Te,onSelect:()=>mt(Te),confirming:st===Te,onConfirmingChange:ge=>we(ge?Te:null),onDiscard:s.canDiscard(me)?()=>{It(me)}:void 0,isPublishing:Ae,isDiscarding:Xe,v8:!!s.v8,alsoChangedOnMain:!!s.alsoChanged&&s.alsoChanged.has(me.entry?.name??me.blockKey??"")},Te)})]});let et;e:{if(de||!Ze){et=null;break e}if(Q.pending){let Te;e[64]===Symbol.for("react.memo_cache_sentinel")?(Te=r.jsx(Qt,{className:"size-3.5 motion-reduce:animate-none"}),e[64]=Te):Te=e[64];let ge;e[65]!==S?(ge=S("thread.publishPopover.reviewing"),e[65]=S,e[66]=ge):ge=e[66];let At;e[67]!==ge?(At=r.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[Te,ge]}),e[67]=ge,e[68]=At):At=e[68],et=At;break e}if(Q.allowed){et=null;break e}let W;e[69]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsx(wa,{className:"mt-0.5 size-3.5 shrink-0"}),e[69]=W):W=e[69];let be;e[70]!==Q.reason||e[71]!==S?(be=Q.reason??S("thread.publishPopover.needsReviewGeneric"),e[70]=Q.reason,e[71]=S,e[72]=be):be=e[72];let me;e[73]!==be?(me=r.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[W,r.jsx("span",{children:be})]}),e[73]=be,e[74]=me):me=e[74],et=me}const wt=et;let ct;e[75]!==vt||e[76]!==Z||e[77]!==Xe||e[78]!==Ae||e[79]!==s.canDiscardAll||e[80]!==$.count||e[81]!==S?(ct=$.count<=1||!s.canDiscardAll?null:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"ml-auto shrink-0 text-2xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>L(!0),disabled:Ae||Xe,children:S("thread.publishPopover.discardAll")}),r.jsx(rn,{open:Z,onOpenChange:L,children:r.jsxs(an,{children:[r.jsxs(en,{children:[r.jsx(Ys,{children:S("thread.publishPopover.discardAllTitle")}),r.jsx(Zs,{children:S("thread.publishPopover.discardAllConfirm")})]}),r.jsxs(nn,{children:[r.jsx(tn,{children:S("thread.publishDialog.cancel")}),r.jsx(sn,{onClick:()=>{vt()},disabled:Xe,className:X(ya({variant:"destructive"})),children:S("thread.publishPopover.discardAll")})]})]})})]}),e[75]=vt,e[76]=Z,e[77]=Xe,e[78]=Ae,e[79]=s.canDiscardAll,e[80]=$.count,e[81]=S,e[82]=ct):ct=e[82];const Pt=ct,jt=te?r.jsx(Yt,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{}),r.jsx(Ut,{})]})}):$.count===0&&ie?r.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:S("thread.publishPopover.onlyOtherWork")}):Ye?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx(Fa,{className:"mb-1 size-5 text-muted-foreground"}),r.jsx("p",{className:"text-sm font-medium",children:S("thread.publishPopover.notLiveBody")}),r.jsx("p",{className:"text-xs text-muted-foreground",children:S("thread.publishPopover.notLiveHint")})]}):$.count===0?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx(vn,{className:"mb-1 size-5 text-success"}),r.jsx("p",{className:"text-sm font-medium",children:S(de?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),r.jsx("p",{className:"text-xs text-muted-foreground",children:S(de?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):r.jsxs(Yt,{children:[H?r.jsx("p",{className:"text-2xs text-muted-foreground",children:S("thread.publishPopover.showingFirst",{shown:$.count,total:ae})}):null,Ft(S("thread.publishPopover.pagesGroup"),$.pages),Ft(S("thread.publishPopover.blocksGroup"),$.blocks),Ft(S("thread.publishPopover.otherGroup"),$.other),z?r.jsx("p",{className:"text-2xs text-muted-foreground",children:S("thread.publishPopover.detailsUnavailable")}):null,ie?r.jsx("p",{className:"text-2xs text-muted-foreground",children:S("thread.publishPopover.alsoOtherWork")}):null]}),St=te?r.jsx(Tn,{}):Pe?r.jsx("div",{className:X(Xt,"relative"),children:Be.filter(W=>Se.includes(Ie(W))).map(W=>r.jsx("div",{className:X("absolute inset-0 flex",$e?Ie(W)===Re?"z-10":"pointer-events-none opacity-0":Ie(W)!==Me&&"hidden"),inert:$e&&Ie(W)!==Re,"aria-hidden":$e&&Ie(W)!==Re?!0:void 0,children:r.jsx(Rr,{change:W,diff:_,bodyPending:re,previewServerUrl:g,draft:he,lastPage:D,v8:s.v8,onReady:$e?()=>fe(Ie(W)):void 0})},Ie(W)))}):r.jsx("div",{className:X(Xt,"bg-muted/40")});let ze;e[83]!==yt?(ze=r.jsx("span",{className:"truncate",children:yt}),e[83]=yt,e[84]=ze):ze=e[84];let He;e[85]!==Pt||e[86]!==N||e[87]!==Bt||e[88]!==ze?(He=r.jsx(In,{mode:N,title:ze,subLine:Bt,trailing:Pt}),e[85]=Pt,e[86]=N,e[87]=Bt,e[88]=ze,e[89]=He):He=e[89];let Ke;e[90]!==Ae||e[91]!==de||e[92]!==Fe||e[93]!==$.count||e[94]!==S?(Ke=$.count===0?null:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-sm font-medium",children:S(de?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),r.jsx(Gl,{value:Fe,onChange:W=>pe(W.target.value),placeholder:S(de?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,maxLength:vs,className:"resize-none text-sm",disabled:Ae})]}),e[90]=Ae,e[91]=de,e[92]=Fe,e[93]=$.count,e[94]=S,e[95]=Ke):Ke=e[95];let Ve;e[96]!==m||e[97]!==S?(Ve=r.jsx(Dn,{draftPreviewUrl:m,t:S}),e[96]=m,e[97]=S,e[98]=Ve):Ve=e[98];let Ge;e[99]!==Dt||e[100]!==Q||e[101]!==Ze||e[102]!==B||e[103]!==Ae||e[104]!==de||e[105]!==y||e[106]!==_t||e[107]!==se||e[108]!==xt||e[109]!==S?(Ge=!de&&!B&&Ze&&!Q.allowed&&!Q.pending?r.jsx(ye,{type:"button",className:"flex-1",onClick:y,disabled:Ae,children:S("thread.publishPopover.requestApproval")}):r.jsxs(ye,{type:"button",variant:de?"default":"brand",className:"flex-1",onClick:()=>{se.hold(),xt().then(W=>{W===!1&&se.release()})},disabled:!Dt,children:[Ae?r.jsx(Qt,{className:"size-4 motion-reduce:animate-none"}):null,Ae?S(de?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):_t]}),e[99]=Dt,e[100]=Q,e[101]=Ze,e[102]=B,e[103]=Ae,e[104]=de,e[105]=y,e[106]=_t,e[107]=se,e[108]=xt,e[109]=S,e[110]=Ge):Ge=e[110];let Qe;e[111]!==Ve||e[112]!==Ge?(Qe=r.jsxs("div",{className:"flex gap-2",children:[Ve,Ge]}),e[111]=Ve,e[112]=Ge,e[113]=Qe):Qe=e[113];let dt;e[114]!==rt||e[115]!==lt||e[116]!==S?(dt=rt?r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-destructive",children:rt}),lt?r.jsx(fl,{label:S("siteEditor.details"),detail:lt}):null]}):null,e[114]=rt,e[115]=lt,e[116]=S,e[117]=dt):dt=e[117];let ue;e[118]!==Qe||e[119]!==dt?(ue=r.jsxs(r.Fragment,{children:[Qe,dt]}),e[118]=Qe,e[119]=dt,e[120]=ue):ue=e[120];let ut;e[121]!==jt||e[122]!==wt||e[123]!==V||e[124]!==He||e[125]!==Ke||e[126]!==ue?(ut=r.jsx(Bs,{state:V,header:He,body:jt,note:Ke,gate:wt,footer:ue}),e[121]=jt,e[122]=wt,e[123]=V,e[124]=He,e[125]=Ke,e[126]=ue,e[127]=ut):ut=e[127];let Ht;return e[128]!==St||e[129]!==ut?(Ht=r.jsx(es,{pane:St,list:ut}),e[128]=St,e[129]=ut,e[130]=Ht):Ht=e[130],Ht}function $c(){return new Set}function Ec(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return Si[t].short}const _c=new Set(["failure","timed_out","cancelled","action_required"]);function $r(t){return t.status==="completed"&&_c.has(t.conclusion)}function Mn(t){return t.status==="queued"||t.status==="in_progress"}function ps(t){return t.isPending&&t.fetchStatus!=="idle"}function Oc(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr-page"}}function Rt(t,e,s){return e?[...t,Oc(s)]:t}function ht(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 aa(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function hs(t,e,s){if(e.filter(Mn).length===0)return t;const n=e.filter(o=>o.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:n,total:e.length})}}function Lc(t){const{lifecycle:e,branch:s,pr:a,checks:n,reviews:o,loading:c,t:l}=t;if(c)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&&Ec(t.claimPhase.kind)||l("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:l("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:l("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||l("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:l("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:l("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:l("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:l("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForBranchTooltip"),menu:[]};const i=s,u=i.unpushed>0&&!(a&&i.headSha&&a.headSha&&i.headSha===a.headSha);if(t.noReviewableDiff&&!a)return{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:i.base}),menu:ht([],i,l)};if(i.workingTreeDirty||u)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ht(Rt([aa(l)],a,l),i,l)};if(ar("no local work — checking PR/sync state",{workingTreeDirty:i.workingTreeDirty,unpushed:i.unpushed,aheadOfBase:i.aheadOfBase,behindBase:i.behindBase,branch:i.branch,base:i.base,prMerged:a?.merged??null,prState:a?.state??null}),a?.merged)return!!i.headSha&&!!a.headSha&&i.headSha!==a.headSha?{label:l("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:l("thread.headerActions.openNewPrTooltip"),menu:ht(Rt([],a,l),i,l)}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.prMergedTooltip",{prNumber:String(a.number),base:a.base}),menu:ht(Rt([],a,l),i,l)};if(i.aheadOfBase>0){if(a&&a.state==="closed"&&!a.merged)return{label:l("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:l("thread.headerActions.reopenPrTooltip",{prNumber:String(a.number)}),menu:ht(Rt([],a,l),i,l)};if(!a)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ht([aa(l)],i,l)};if((o?.mergeableState??"unknown")==="dirty")return{label:l("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:l("thread.cmsActions.resolveOnProvider"),action:"open-pr-page"}]};const h=n.filter(Mn).length,f=n.filter($r).map(m=>m.name);if(h===0&&f.length>0)return{label:l("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:l("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:ht(Rt([{key:"publish-anyway",label:l("thread.headerActions.publishAnyway"),action:"merge",tooltip:l("thread.headerActions.squashMergeTooltip",{prNumber:String(a.number),base:a.base})}],a,l),i,l)};if(o?.draft)return hs({label:l("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:l("thread.headerActions.markDraftReadyTooltip"),menu:ht(Rt([],a,l),i,l)},n,l);const p=o?.unresolvedConversations??0;return p>0?hs({label:l("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:l("thread.headerActions.unresolvedConversationsTooltip",{count:String(p)}),menu:ht(Rt([],a,l),i,l)},n,l):o?.missingRequiredApprovals?hs({label:l("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:l("thread.headerActions.waitingForApprovalsTooltip"),menu:ht(Rt([],a,l),i,l)},n,l):hs({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:ht(Rt([{key:"review",label:l("thread.headerActions.review"),action:"review"}],a,l),i,l)},n,l)}return i.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:i.base}),menu:[]}}function ra(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr"}}function fs(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 la(t,e,s,a){const n=e.length;if(n===0)return t;if(e.filter(Mn).length>0){const l=e.filter(u=>u.status==="completed").length,i=a("thread.cmsActions.checksRunning",{done:l,total:n});return s==="loading"?{...t,loading:!0,tooltip:i}:{...t,tooltip:i}}const c=e.filter($r).length;return c>0?{...t,variant:"warning",tooltip:a("thread.cmsActions.checksFailing",{failed:c,total:n})}:t}function Uc(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function qc(t){return ps(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:ps(t.checksQuery)||ps(t.reviewsQuery)}function zc(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function Hc(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 Kc(t,e){return e?.notLive&&!t.action&&!t.loading?{label:e.t("thread.publishPopover.publish"),action:"publish",variant:"brand",tooltip:e.t("thread.cmsActions.notLiveTooltip"),status:e.t("thread.cmsActions.notLive"),menu:[]}:{...t,menu:[]}}function Vc(t){if(!t)return!1;const{current:e,commits:s}=t;return e?s.findIndex(a=>a.sha===e.revision)>0:!1}function Gc(t){const{branch:e,pr:s,checks:a,reviews:n,publishing:o,saving:c,loading:l,publishableChangeCount:i,t:u}=t;if(e.kind!=="ready"&&t.statusError)return{label:u("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(l||e.kind!=="ready")return{label:u("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:u("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:u("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(c)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?la({label:u("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:fs([ra(u)],e,u)},a,"loading",u):la({label:u("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:fs([ra(u)],e,u)},a,"none",u)}return Uc(s,e)?{label:u("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:fs([],e,u)}:zc(e,i)?{label:u("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:fs([{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 Qc(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function Er(t){const e=M.c(4);let s;e[0]!==t?(s=Ml(t),e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a={...s,select:Wc},e[2]=s,e[3]=a):a=e[3],Tt(a)}function Wc(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:Qc(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function ia(t,e){return t==="open-pr"||e==="resolve-on-provider"?r.jsx(Ga,{size:16}):t==="publish"?r.jsx($a,{className:"size-4"}):t==="get-latest"||t==="retry-status"?r.jsx(cn,{className:"size-4"}):r.jsx(Rs,{className:"size-4"})}function Jc(t){const e=M.c(65),{virtualMcpId:s}=t,a=xe(),{org:n}=Cs(),o=Ns(),c=pn(s),{data:l}=ks.useSession(),{deleteRelease:i}=hn(s),{currentBranch:u,setCurrentTaskBranch:d,taskId:h,createTask:f}=Sa();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={open:!1,mode:"publish"},e[0]=p):p=e[0];const[m,b]=q.useState(p);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=V=>b({open:!0,mode:V}),e[1]=g):g=e[1];const x=g,j=qa(c),y=j.status==="attached"||j.status==="public-clone"?j.repo:null,{previewServerUrl:v}=bn(s),P=u?Pa(ja(n.slug,s,u)):null,w=P?xn(P.path,P.params):"/",k=El(u?{orgSlug:n.slug,virtualMcpId:s,branch:u,previewServerUrl:v,path:w}:null);let N;e[2]!==u||e[3]!==n.slug||e[4]!==s?(N=u?{orgSlug:n.slug,virtualMcpId:s,branch:u}:null,e[2]=u,e[3]=n.slug,e[4]=s,e[5]=N):N=e[5];const R=_l(N),C=qt(s,u),A=C.kind==="protocol"&&C.source==="github";let S;e[6]!==u||e[7]!==n.slug||e[8]!==s?(S=u?{orgSlug:n.slug,virtualMcpId:s,branch:u}:null,e[6]=u,e[7]=n.slug,e[8]=s,e[9]=S):S=e[9];const E=un(S),F=Aa(A?C:null,E);let I;e[10]!==A?(I={enabled:A},e[10]=A,e[11]=I):I=e[11];const T=si(n.slug,s,I),D=A&&Vc(T.data?.pages[0]);let Y;e[12]!==n.slug||e[13]!==s?(Y=ml(n.slug,s),e[12]=n.slug,e[13]=s,e[14]=Y):Y=e[14];const ae=Ol(Y,A?R:null),H=A?Ll(v,w,ae):k.url,_=u??"",z=h??null;let ee;e[15]!==n.slug||e[16]!==_||e[17]!==z||e[18]!==s?(ee=Ya({orgSlug:n.slug,virtualMcpId:s,branch:_,threadId:z}),e[15]=n.slug,e[16]=_,e[17]=z,e[18]=s,e[19]=ee):ee=e[19];const Q=!!u&&C.kind!=="pending"&&!A;let B;e[20]!==Q||e[21]!==ee?(B={...ee,enabled:Q},e[20]=Q,e[21]=ee,e[22]=B):B=e[22];const ie=Tt(B),U=A?null:ie.data??null,oe=A?Hc(F.data,u??""):null,J=oe?oe.branchMeta:U?{kind:"ready",branch:Pn(U)??u??"",base:U.base??"main",workingTreeDirty:gi(U),unpushed:U.unpushed??0,aheadOfBase:U.aheadOfBase??0,behindBase:U.behindBase??0,headSha:U.headSha??""}:{kind:"unknown"},se=oe?oe.publishableChangeCount:U?.changedFiles?yr({files:U.changedFiles}).count:null,$=A?F:ie,te=(J.kind==="ready"?J.branch:null)??u??null,re=J.kind==="ready"?J.base:"main",he=za({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",branch:te}),G=he.data??null,pe=Ha({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",base:re}),Z=Ka({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",branch:te}),L=Er({orgId:n.id,orgSlug:n.slug,target:tt(y),owner:y?.owner??"",repo:y?.name??"",branch:te});let K;e[23]!==Z||e[24]!==G||e[25]!==he||e[26]!==L?(K=qc({pr:G,prQuery:he,checksQuery:Z,reviewsQuery:L}),e[23]=Z,e[24]=G,e[25]=he,e[26]=L,e[27]=K):K=e[27];const ce=K;let je;e[28]!==he?(je=async()=>{await he.refetch()},e[28]=he,e[29]=je):je=e[29];const fe=je,Ee=$n({mutationFn:()=>ao({hosted:A,branch:u,baseBranch:re,nextBranch:()=>fn(mn(l?.user)),setCurrentTaskBranch:d,deleteRelease:i}),onError:Zc});let O;e[30]!==n.slug||e[31]!==h||e[32]!==s?(O=async V=>(await Xa({orgSlug:n.slug,virtualMcpId:s,branch:V.branch,threadId:h??null},V.base),V),e[30]=n.slug,e[31]=h,e[32]=s,e[33]=O):O=e[33];let ne;e[34]!==u||e[35]!==n.slug||e[36]!==o||e[37]!==a||e[38]!==h||e[39]!==s?(ne=async V=>{Oe.success(a("thread.headerActions.syncedWithBase",{base:V.base})),await Promise.all([o.invalidateQueries({queryKey:tr({orgSlug:n.slug,virtualMcpId:s,branch:u??V.branch,threadId:h??null})}),o.invalidateQueries({queryKey:Et.decofile(`${n.slug}/${s}/${V.branch}`)})])},e[34]=u,e[35]=n.slug,e[36]=o,e[37]=a,e[38]=h,e[39]=s,e[40]=ne):ne=e[40];let Le;e[41]!==O||e[42]!==ne?(Le={mutationFn:O,onSuccess:ne,onError:Yc},e[41]=O,e[42]=ne,e[43]=Le):Le=e[43];const _e=$n(Le),Ue=Ra(n.slug,s),mt=Ee.isPending,st=Gc({branch:J,pr:G,checks:Z.data??[],reviews:L.data??null,publishing:mt,saving:Ue,syncing:_e.isPending,statusRetrying:$.isFetching&&!!$.error,statusError:$.error instanceof Error?$.error.message:$.error?String($.error):null,loading:!!ce,publishableChangeCount:se,t:a}),we=A?Kc(st,{notLive:D,t:a}):st,De=we.autoRun&&J.kind==="ready"&&y&&v?`${te}@${J.headSha}`:null,Fe=q.useRef(null);if(q.useEffect(()=>{!De||!te||Fe.current!==De&&(Fe.current=De,_e.mutate({branch:te,base:re}))},[De,te,re,_e]),j.status==="detached"){let V;e[44]!==a?(V=a("thread.headerActions.reconnectGithub"),e[44]=a,e[45]=V):V=e[45];let ve;e[46]!==V?(ve=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{children:r.jsx(ye,{size:"sm",variant:"outline",disabled:!0,children:V})})}),e[46]=V,e[47]=ve):ve=e[47];let ke;e[48]!==a?(ke=a("thread.headerActions.githubConnectionRemoved"),e[48]=a,e[49]=ke):ke=e[49];let Ce;e[50]!==ke?(Ce=r.jsx(Nt,{children:ke}),e[50]=ke,e[51]=Ce):Ce=e[51];let Ne;return e[52]!==ve||e[53]!==Ce?(Ne=r.jsx(As,{children:r.jsxs(kt,{children:[ve,Ce]})}),e[52]=ve,e[53]=Ce,e[54]=Ne):Ne=e[54],Ne}if(!c)return null;if(!y||!v){const V=y?"noPreviewServer":"noRepo";let ve;e[55]!==u||e[56]!==f?(ve=u?()=>{const Ce=f?.({runtime:"sandbox",branch:u});Ce&&el("coding_session_started",{thread_id:Ce})}:void 0,e[55]=u,e[56]=f,e[57]=ve):ve=e[57];let ke;return e[58]!==V||e[59]!==ve?(ke=r.jsx(ed,{reason:V,onStartCodingSession:ve}),e[58]=V,e[59]=ve,e[60]=ke):ke=e[60],ke}if(!u)return null;const Be=V=>{switch(V){case"publish":{x("publish");return}case"request-approval":{x("review");return}case"get-latest":{if(!te||_e.isPending)return;_e.mutate({branch:te,base:re});return}case"retry-status":{$.refetch();return}case"open-pr":{G?.htmlUrl&&window.open(G.htmlUrl,"_blank","noopener,noreferrer");return}}};let Pe;e[61]!==Be?(Pe=V=>({key:V.key,label:V.label,icon:ia(V.action,V.key),...V.tooltip?{tooltip:V.tooltip}:{},onSelect:()=>Be(V.action)}),e[61]=Be,e[62]=Pe):Pe=e[62];const Me=we.menu.map(Pe),Se=we.action,$e=we.label,nt=we.variant,pt=!!we.loading;let Re;e[63]!==a?(Re=a("thread.cmsActions.moreActionsAriaLabel"),e[63]=a,e[64]=Re):Re=e[64];const de=r.jsx(lr,{size:"sm",label:$e,variant:nt,disabled:!!we.disabled||!Se,loading:pt,...Se&&!we.loading?{icon:ia(Se)}:{},...we.tooltip?{tooltip:we.tooltip}:{},items:Me,menuAriaLabel:Re,onClick:Se?()=>Be(Se):void 0});return r.jsxs(r.Fragment,{children:[we.status?r.jsx("span",{className:"mr-1 hidden shrink-0 text-xs text-muted-foreground sm:inline",children:we.status}):null,de,u?r.jsx(Br,{open:m.open,mode:m.mode,fastPreview:!0,notLive:D,onOpenChange:V=>{V||b(Xc)},orgSlug:n.slug,virtualMcpId:s,branch:u,baseBranch:re,repoTarget:tt(y),owner:y.owner,repo:y.name,publishPolicy:er(c?.metadata?.publishPolicy),draftPreviewUrl:H,destinationHost:k.host,previewServerUrl:v,compareDraft:R?{kind:"pointer",pointer:R,...ae?{link:ae}:{}}:null,lastPublishedPr:pe.data??null,onRequestApproval:()=>x("review"),openPullRequest:G?.state==="open"?G:null,onPullRequestChanged:fe,onPublished:()=>Ee.mutateAsync()}):null]})}function Xc(t){return{...t,open:!1}}function Yc(t){Oe.error(t instanceof Error?t.message:String(t))}function Zc(t){console.error("site editor: settling after publish failed",t)}function ed(t){const e=M.c(14),{reason:s,onStartCodingSession:a}=t,n=xe(),o=!a;let c;e[0]!==n?(c=n("sandbox.cmsUnavailable.startCodingSession"),e[0]=n,e[1]=c):c=e[1];let l;e[2]!==a||e[3]!==o||e[4]!==c?(l=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{children:r.jsx(ye,{size:"sm",variant:"outline",disabled:o,onClick:a,children:c})})}),e[2]=a,e[3]=o,e[4]=c,e[5]=l):l=e[5];let i;e[6]!==s||e[7]!==n?(i=n(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=n,e[8]=i):i=e[8];let u;e[9]!==i?(u=r.jsx(Nt,{children:i}),e[9]=i,e[10]=u):u=e[10];let d;return e[11]!==l||e[12]!==u?(d=r.jsx(As,{children:r.jsxs(kt,{children:[l,u]})}),e[11]=l,e[12]=u,e[13]=d):d=e[13],d}const zt="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 td(t){return`Reopen PR #${t.prNumber}. ${zt}`}function sd(t){return`Rebase \`${t.branch}\` on the latest base and force-push with --force-with-lease. ${zt}`}function nd(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). ${zt}`}function ad(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. ${zt}`}function rd(t){return`Mark PR #${t.prNumber} ready for review. ${zt}`}function ld(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. ${zt}`}function id(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. ${zt}`}function oa(t){switch(t){case"publish":return r.jsx($a,{className:"size-4"});case"create-pr":case"reopen":return r.jsx(Rs,{className:"size-4"});case"rebase":case"sync":return r.jsx(cn,{className:"size-4"});case"fix-checks":return r.jsx(wa,{className:"size-4"});case"mark-ready":return r.jsx(vn,{className:"size-4"});case"resolve-comments":return r.jsx(kl,{className:"size-4"});case"merge":return r.jsx(ai,{className:"size-4"});case"review":return r.jsx(xs,{className:"size-4"});case"open-pr-page":return r.jsx(Ga,{size:16})}}const ca=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),da=new Set(["publish","create-pr"]);function od(t){const e=M.c(44),{t:s,button:a,actionBusy:n,changeRequestPending:o,savePending:c,onAction:l}=t,i=a.action;let u;e[0]!==i||e[1]!==n?(u=n&&i!==void 0&&ca.has(i),e[0]=i,e[1]=n,e[2]=u):u=e[2];const d=u,h=o&&i==="merge";let f;e[3]!==i||e[4]!==c?(f=c&&i!==void 0&&da.has(i),e[3]=i,e[4]=c,e[5]=f):f=e[5];const p=f,m=!!a.disabled||d||h||p||!i,b=!!a.loading||h;let g;e[6]!==a.tooltip||e[7]!==d||e[8]!==p||e[9]!==s?(g=d?s("thread.headerActions.chatIsRunning"):p?s("thread.headerActions.saving"):a.tooltip,e[6]=a.tooltip,e[7]=d,e[8]=p,e[9]=s,e[10]=g):g=e[10];const x=g;let j;if(e[11]!==n||e[12]!==a.menu||e[13]!==o||e[14]!==l||e[15]!==c||e[16]!==s){let A;e[18]!==n||e[19]!==o||e[20]!==l||e[21]!==c||e[22]!==s?(A=S=>{const E=n&&ca.has(S.action),F=c&&da.has(S.action),I=S.action==="merge"&&o,T=F?s("thread.headerActions.saving"):E?s("thread.headerActions.chatIsRunning"):S.tooltip;return{key:S.key,label:S.label,icon:oa(S.action),disabled:!!(E||F||I),...T?{tooltip:T}:{},onSelect:()=>l(S.action)}},e[18]=n,e[19]=o,e[20]=l,e[21]=c,e[22]=s,e[23]=A):A=e[23],j=a.menu.map(A),e[11]=n,e[12]=a.menu,e[13]=o,e[14]=l,e[15]=c,e[16]=s,e[17]=j}else j=e[17];const y=j,v=a.label,P=a.variant;let w;e[24]!==i||e[25]!==b?(w=i&&!b?{icon:oa(i)}:{},e[24]=i,e[25]=b,e[26]=w):w=e[26];let k;e[27]!==x?(k=x?{tooltip:x}:{},e[27]=x,e[28]=k):k=e[28];let N;e[29]!==s?(N=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=N):N=e[30];let R;e[31]!==i||e[32]!==l?(R=i?()=>l(i):void 0,e[31]=i,e[32]=l,e[33]=R):R=e[33];let C;return e[34]!==a.label||e[35]!==a.variant||e[36]!==m||e[37]!==y||e[38]!==b||e[39]!==w||e[40]!==k||e[41]!==N||e[42]!==R?(C=r.jsx(lr,{size:"sm",label:v,variant:P,disabled:m,loading:b,...w,...k,items:y,menuAriaLabel:N,onClick:R}),e[34]=a.label,e[35]=a.variant,e[36]=m,e[37]=y,e[38]=b,e[39]=w,e[40]=k,e[41]=N,e[42]=R,e[43]=C):C=e[43],C}function cd(t){const e=M.c(9),{label:s,children:a}=t;if(!s){let l;return e[0]!==a?(l=r.jsx(r.Fragment,{children:a}),e[0]=a,e[1]=l):l=e[1],l}let n;e[2]!==a?(n=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{children:a})}),e[2]=a,e[3]=n):n=e[3];let o;e[4]!==s?(o=r.jsx(Nt,{children:s}),e[4]=s,e[5]=o):o=e[5];let c;return e[6]!==n||e[7]!==o?(c=r.jsx(As,{children:r.jsxs(kt,{children:[n,o]})}),e[6]=n,e[7]=o,e[8]=c):c=e[8],c}function dd(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function ud({virtualMcpId:t}){const e=xe(),{org:s}=Cs(),{data:a}=ks.useSession(),n=pn(t),{deleteRelease:o}=hn(t),{currentBranch:c,setCurrentTaskBranch:l,createTask:i,taskId:u}=Sa(),d=al(),{openSidePanel:h}=bl(),[f,p]=q.useState({open:!1,mode:"publish",policyOverride:null}),m=ki({connectionId:tl,orgId:s.id,orgSlug:s.slug}),b=Ni(m),[g,x]=q.useState(!1),j=q.useRef(""),y=qa(n),v=y.status==="attached"||y.status==="public-clone"?y.repo:null,{lifecycle:P,branch:w,phase:k}=Ci(),N={orgSlug:s.slug,virtualMcpId:t,branch:c??"",threadId:u??null},C=Tt({queryKey:tr(N),queryFn:()=>yn(N),enabled:!!c,staleTime:15e3,refetchInterval:K=>Ls(K.state.data)?5e3:!1}).data??null,A=w,S=P,E=A.kind==="ready"?A.branch:null,F=c??E??void 0,I=(A.kind==="ready"?A.branch:null)??F??null,T=za({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",branch:I}),D=T.data??null,Y=Ka({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",branch:I}),ae=Er({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",branch:I}),H=Ha({orgId:s.id,orgSlug:s.slug,target:tt(v),owner:v?.owner??"",repo:v?.name??"",base:A.kind==="ready"?A.base:null}),_=A,z=er(n?.metadata?.publishPolicy),ee=Ra(s.slug,t),{previewUrl:Q}=Ai(),{previewServerUrl:B,projectDefault:ie}=bn(t);if(y.status==="detached")return r.jsx(cd,{label:e("thread.headerActions.githubConnectionRemoved"),children:r.jsx(ye,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!v)return null;const U=I?Lc({lifecycle:S,branch:_,claimPhase:k,pr:D,checks:Y.data??[],reviews:ae.data??null,noReviewableDiff:Ls(C),loading:ps(T),t:e}):dd(e),oe=JSON.stringify({label:U.label,branchKind:_.kind,workingTreeDirty:_.kind==="ready"?_.workingTreeDirty:null,unpushed:_.kind==="ready"?_.unpushed:null,aheadOfBase:_.kind==="ready"?_.aheadOfBase:null,lifecycle:S.phase,headBranch:I,noReviewableDiff:Ls(C)});j.current!==oe&&(j.current=oe,ar("header button",{label:U.label,tooltip:U.tooltip,action:U.action,chatBranch:c,sandboxBranch:E,sandboxRouteBranch:F,headBranch:I,branchMeta:A,effectiveBranchMeta:_,lifecyclePhase:S.phase,prNumber:D?.number??null,prState:D?.state??null}));const J=K=>(h(),d.sendMessage({parts:[{type:"text",text:K}]})),se=d.isStreaming,$=_.kind==="ready"?_.base:"main",te=async()=>{await T.refetch()},re=async()=>{const K=c,ce=fn(mn(a?.user));ie==="cms"?i({runtime:"cms",branch:ce}):await l(ce),K&&K!==$&&await o(K)},he=async K=>{if(!(!v||g)){x(!0);try{const ce=ir(a?.user);await dr(s.slug,tt(v),{number:K,coAuthor:ce}),Oe.success(e("thread.headerActions.publishedPr",{prNumber:String(K)})),await te(),await re()}catch(ce){Oe.error(ce instanceof cr?ce.detail??uo(ce.reason,e):ce instanceof Error?ce.message:e("thread.headerActions.failedToMergePullRequest"))}finally{x(!1)}}},G=(K,ce)=>p({open:!0,mode:K,policyOverride:ce}),pe=K=>{if(I)switch(K){case"publish":G("publish",U.meta?.publishPolicyOverride??null);return;case"create-pr":G("review",null);return;case"merge":D&&he(D.number);return;case"sync":if(se)return;J(nd({branch:I,base:$}));return;case"open-pr-page":D?.htmlUrl&&window.open(D.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(se)return;D&&J(id({prNumber:D.number}));return;case"reopen":if(se)return;D&&J(td({prNumber:D.number}));return;case"rebase":if(se)return;J(sd({branch:I}));return;case"fix-checks":if(se)return;D&&J(ad({prNumber:D.number,failingChecks:U.meta?.failingChecks??[]}));return;case"mark-ready":if(se)return;D&&J(rd({prNumber:D.number}));return;case"resolve-comments":if(se)return;D&&J(ld({prNumber:D.number}));return}},Z=g||se,L=r.jsx(od,{t:e,button:U,actionBusy:Z,changeRequestPending:g,savePending:ee,onAction:pe});return F?r.jsxs(r.Fragment,{children:[L,r.jsx(Br,{open:f.open,mode:f.mode,fastPreview:!1,recoverSandbox:()=>b.mutateAsync({virtualMcpId:t,branch:F,...u?{threadId:u}:{}}),onOpenChange:K=>{K||p(ce=>({...ce,open:!1}))},orgSlug:s.slug,virtualMcpId:t,branch:F,baseBranch:$,repoTarget:tt(v),owner:v.owner,repo:v.name,publishPolicy:f.policyOverride??z,draftPreviewUrl:Q,destinationHost:null,previewServerUrl:B,compareDraft:Q?{kind:"sandbox",previewUrl:Q}:null,lastPublishedPr:H.data??null,onRequestApproval:()=>p(K=>({...K,open:!0,mode:"review"})),openPullRequest:D?.state==="open"?D:null,onPullRequestChanged:te,onPublished:re})]}):L}function hd(t){const e=M.c(33),{orgSlug:s,virtualMcpId:a,branch:n}=t,o=xe(),[c,l]=q.useState(!1),i=qt(a,n),u=i.kind==="protocol"&&i.source==="local"?i:null;let d;e[0]!==n||e[1]!==s||e[2]!==a?(d=n?{orgSlug:s,virtualMcpId:a,branch:n}:null,e[0]=n,e[1]=s,e[2]=a,e[3]=d):d=e[3];const h=un(d),{data:f}=Aa(u,h);if(!u||!h||!n)return null;let p;e[4]!==f?(p=f?Object.keys(f.changes).length:0,e[4]=f,e[5]=p):p=e[5];const m=p;let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=()=>l(!0),e[6]=b):b=e[6];let g;e[7]!==m||e[8]!==o?(g=m>0?o("decoServe.changes.buttonCount",{count:m}):o("decoServe.changes.button"),e[7]=m,e[8]=o,e[9]=g):g=e[9];let x;e[10]!==g?(x=r.jsx(ye,{size:"sm",variant:"outline","data-testid":"local-changes-button",onClick:b,children:g}),e[10]=g,e[11]=x):x=e[11];let j;e[12]!==o?(j=o("decoServe.changes.title"),e[12]=o,e[13]=j):j=e[13];let y;e[14]!==j?(y=r.jsx(ba,{className:"sr-only",children:j}),e[14]=j,e[15]=y):y=e[15];let v;e[16]!==n||e[17]!==h||e[18]!==u||e[19]!==c||e[20]!==s||e[21]!==o||e[22]!==a?(v=c?r.jsx(xa,{children:N=>{const{reset:R}=N;return r.jsx(va,{fallback:C=>{const{resetError:A}=C;return r.jsx(Js,{title:o("decoServe.changes.title"),body:r.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:o("decoServe.changes.loadFailed")}),onClose:()=>{R(),A(),l(!1)}})},children:r.jsx(q.Suspense,{fallback:r.jsx(es,{pane:r.jsx(Tn,{}),list:r.jsx(Js,{title:o("decoServe.changes.title"),loading:!0,body:r.jsx(Yt,{children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{}),r.jsx(Ut,{})]})}),onClose:()=>l(!1)})}),children:r.jsx(fd,{orgSlug:s,virtualMcpId:a,branch:n,backend:u,cacheKey:h,onClose:()=>l(!1)})})})}}):null,e[16]=n,e[17]=h,e[18]=u,e[19]=c,e[20]=s,e[21]=o,e[22]=a,e[23]=v):v=e[23];let P;e[24]!==y||e[25]!==v?(P=r.jsxs(ga,{"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:[y,v]}),e[24]=y,e[25]=v,e[26]=P):P=e[26];let w;e[27]!==c||e[28]!==P?(w=r.jsx(pa,{open:c,onOpenChange:l,children:P}),e[27]=c,e[28]=P,e[29]=w):w=e[29];let k;return e[30]!==w||e[31]!==x?(k=r.jsxs(r.Fragment,{children:[x,w]}),e[30]=w,e[31]=x,e[32]=k):k=e[32],k}function Js(t){const e=M.c(22),{title:s,trailing:a,body:n,loading:o,onClose:c}=t,l=o===void 0?!1:o,i=xe(),u=l?"loading":"ready";let d;e[0]!==s?(d=r.jsx("span",{className:"truncate",children:s}),e[0]=s,e[1]=d):d=e[1];let h;e[2]!==d||e[3]!==a?(h=r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[d,a]}),e[2]=d,e[3]=a,e[4]=h):h=e[4];let f;e[5]!==i?(f=i("decoServe.changes.hint"),e[5]=i,e[6]=f):f=e[6];let p;e[7]!==f?(p=r.jsx("p",{className:"text-2xs text-muted-foreground",children:r.jsx(sr,{text:f})}),e[7]=f,e[8]=p):p=e[8];let m;e[9]!==i?(m=i("decoServe.changes.close"),e[9]=i,e[10]=m):m=e[10];let b;e[11]!==c||e[12]!==m?(b=r.jsx(ye,{type:"button",variant:"outline",className:"w-full",onClick:c,children:m}),e[11]=c,e[12]=m,e[13]=b):b=e[13];let g;e[14]!==p||e[15]!==b?(g=r.jsxs(r.Fragment,{children:[p,b]}),e[14]=p,e[15]=b,e[16]=g):g=e[16];let x;return e[17]!==n||e[18]!==u||e[19]!==h||e[20]!==g?(x=r.jsx(Bs,{state:u,header:h,body:n,footer:g}),e[17]=n,e[18]=u,e[19]=h,e[20]=g,e[21]=x):x=e[21],x}function fd(t){const e=M.c(54),{orgSlug:s,virtualMcpId:a,branch:n,backend:o,cacheKey:c,onClose:l}=t,i=xe();let u;e[0]!==n||e[1]!==s||e[2]!==a?(u={orgSlug:s,virtualMcpId:a,branch:n},e[0]=n,e[1]=s,e[2]=a,e[3]=u):u=e[3];let d;e[4]!==o||e[5]!==c||e[6]!==u?(d={backend:o,cacheKey:c,scope:u},e[4]=o,e[5]=c,e[6]=u,e[7]=d):d=e[7];const h=Rn(d);let f;e[8]!==n||e[9]!==s||e[10]!==h.refresh||e[11]!==a?(f={orgSlug:s,virtualMcpId:a,branch:n,refresh:h.refresh},e[8]=n,e[9]=s,e[10]=h.refresh,e[11]=a,e[12]=f):f=e[12];const p=Tr(f),m=Na(s,a).phase==="saving",b=o.describe.readOnly,[g,x]=q.useState(null),[j,y]=q.useState(null),[v,P]=q.useState(!1),{summary:w}=h;let k,N,R,C,A;if(e[13]!==g||e[14]!==o||e[15]!==j||e[16]!==p||e[17]!==v||e[18]!==m||e[19]!==b||e[20]!==h.blocks||e[21]!==h.entries||e[22]!==h.sidesFailed||e[23]!==h.sidesPending||e[24]!==w.blocks||e[25]!==w.count||e[26]!==w.pages||e[27]!==i){const F=[...w.pages,...w.blocks],I=F.find(ae=>Ie(ae)===g)??F[0]??null;let T;e[33]!==w.count||e[34]!==i?(T=w.count===0?i("decoServe.changes.title"):w.count===1?i("decoServe.changes.titleOne"):i("decoServe.changes.titleCount",{count:w.count}),e[33]=w.count,e[34]=i,e[35]=T):T=e[35],A=T;const D=(ae,H)=>H.length===0?null:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"px-0.5 text-2xs font-medium text-muted-foreground",children:ae}),H.map(_=>{const z=Ie(_);return r.jsx(jr,{change:_,bodyPending:h.sidesPending,v8:!0,selected:I!==null&&Ie(I)===z,onSelect:()=>x(z),confirming:j===z,onConfirmingChange:ee=>y(ee?z:null),onDiscard:b||!_.entry?void 0:()=>{p(o,[_.entry],i("thread.publishPopover.discarded",{name:_.name}))},isPublishing:!1,isDiscarding:m},z)})]});let Y;e[36]!==o||e[37]!==p||e[38]!==v||e[39]!==m||e[40]!==b||e[41]!==h.entries||e[42]!==w.count||e[43]!==i?(Y=b||w.count<=1?null:r.jsxs(r.Fragment,{children:[r.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:m,children:i("thread.publishPopover.discardAll")}),r.jsx(rn,{open:v,onOpenChange:P,children:r.jsxs(an,{children:[r.jsxs(en,{children:[r.jsx(Ys,{children:i("thread.publishPopover.discardAllTitle")}),r.jsx(Zs,{children:i("thread.publishPopover.discardAllConfirm")})]}),r.jsxs(nn,{children:[r.jsx(tn,{children:i("thread.publishDialog.cancel")}),r.jsx(sn,{onClick:()=>{p(o,h.entries,i("thread.publishDialog.allChangesDiscarded"))},disabled:m,className:X(ya({variant:"destructive"})),children:i("thread.publishPopover.discardAll")})]})]})})]}),e[36]=o,e[37]=p,e[38]=v,e[39]=m,e[40]=b,e[41]=h.entries,e[42]=w.count,e[43]=i,e[44]=Y):Y=e[44],R=Y,N=w.count===0?r.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[r.jsx(vn,{className:"mb-1 size-5 text-success"}),r.jsx("p",{className:"text-sm font-medium",children:i("decoServe.changes.empty")})]}):r.jsxs(Yt,{children:[D(i("thread.publishPopover.pagesGroup"),w.pages),D(i("thread.publishPopover.blocksGroup"),w.blocks),h.sidesFailed?r.jsx("p",{className:"text-2xs text-muted-foreground",children:i("thread.publishPopover.detailsUnavailable")}):null]}),k=es,C=I?r.jsx("div",{className:X(Xt,"relative flex"),children:r.jsx(Rr,{change:I,diff:null,bodyPending:h.sidesPending,previewServerUrl:null,draft:null,lastPage:null,v8:{blocks:h.blocks}},Ie(I))}):r.jsx("div",{className:X(Xt,"bg-muted/40")}),e[13]=g,e[14]=o,e[15]=j,e[16]=p,e[17]=v,e[18]=m,e[19]=b,e[20]=h.blocks,e[21]=h.entries,e[22]=h.sidesFailed,e[23]=h.sidesPending,e[24]=w.blocks,e[25]=w.count,e[26]=w.pages,e[27]=i,e[28]=k,e[29]=N,e[30]=R,e[31]=C,e[32]=A}else k=e[28],N=e[29],R=e[30],C=e[31],A=e[32];let S;e[45]!==N||e[46]!==R||e[47]!==l||e[48]!==A?(S=r.jsx(Js,{title:A,trailing:R,body:N,onClose:l}),e[45]=N,e[46]=R,e[47]=l,e[48]=A,e[49]=S):S=e[49];let E;return e[50]!==k||e[51]!==C||e[52]!==S?(E=r.jsx(k,{pane:C,list:S}),e[50]=k,e[51]=C,e[52]=S,e[53]=E):E=e[53],E}function md(t){const e=M.c(5),{virtualMcpId:s,branch:a}=t,n=xe(),o=qt(s,a);if(!pd(o))return null;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ct,{asChild:!0,children:r.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]=c):c=e[0];let l;e[1]!==n?(l=n("decoServe.version.v8"),e[1]=n,e[2]=l):l=e[2];let i;return e[3]!==l?(i=r.jsxs(kt,{children:[c,r.jsx(Nt,{side:"bottom",className:"max-w-xs",children:l})]}),e[3]=l,e[4]=i):i=e[4],i}function pd(t){return t.kind==="protocol"?t.hasSchema!==!1:t.kind==="unavailable"&&t.source!=="local"}function bd(t){const e=M.c(11),{virtualMcpId:s,branch:a}=t,n=xe(),o=qt(s,a);if(!(o.kind==="protocol"&&o.source==="local"&&o.describe.readOnly))return null;let l;e[0]!==n?(l=n("decoServe.readOnly.label"),e[0]=n,e[1]=l):l=e[1];let i;e[2]!==l?(i=r.jsx(Ct,{asChild:!0,children:r.jsx("span",{tabIndex:0,"data-testid":"deco-serve-read-only",className:"shrink-0 rounded-full bg-warning/10 px-2 py-0.5 text-xs font-medium text-foreground",children:l})}),e[2]=l,e[3]=i):i=e[3];let u;e[4]!==n?(u=n("decoServe.readOnly.tooltip"),e[4]=n,e[5]=u):u=e[5];let d;e[6]!==u?(d=r.jsx(Nt,{side:"bottom",className:"max-w-xs",children:r.jsx(sr,{text:u})}),e[6]=u,e[7]=d):d=e[7];let h;return e[8]!==i||e[9]!==d?(h=r.jsxs(kt,{children:[i,d]}),e[8]=i,e[9]=d,e[10]=h):h=e[10],h}function gd(t){const e=!t.hasEntity&&!t.servingLocally,s=t.hasEntity&&!t.localPreview&&!t.tunnelUndecided&&!t.servingLocally&&t.showsRepositoryActions;return{hidden:e,localFiles:!e&&t.servingLocally,draftSelect:!e&&t.hasEntity,publish:e||!s?null:t.runtime==="cms"?"cms":"code"}}function mu(t){const e=M.c(2),{blocksOnly:s}=t;let a;return e[0]!==s?(a=s?r.jsx(xd,{}):r.jsx(_r,{}),e[0]=s,e[1]=a):a=e[1],a}function xd(){const t=M.c(2),e=Va(Ri());let s;return t[0]!==e?(s=$l(e)?r.jsx(Nr,{value:!1,children:r.jsx(_r,{})}):null,t[0]=e,t[1]=s):s=t[1],s}function _r(){const t=M.c(32),e=Zt(),{org:s}=Cs(),a=pn(e?.virtualMcpId),n=e?.currentBranch??null,o=bn(a?.id).runtime,{url:c,undecided:l}=ka(a?.id),{connection:i}=Ca(a?.id??e?.virtualMcpId),u=a?.id??e?.virtualMcpId,d=!!a,h=!!i,f=!!c,p=!!l;let m;t[0]!==a||t[1]!==o||t[2]!==d||t[3]!==h||t[4]!==f||t[5]!==p?(m=gd({hasEntity:d,servingLocally:h,localPreview:f,tunnelUndecided:p,showsRepositoryActions:!!a&&Fl(a),runtime:o}),t[0]=a,t[1]=o,t[2]=d,t[3]=h,t[4]=f,t[5]=p,t[6]=m):m=t[6];const b=m;if(!u||b.hidden)return null;let g;t[7]!==n||t[8]!==u?(g=r.jsx(md,{virtualMcpId:u,branch:n}),t[7]=n,t[8]=u,t[9]=g):g=t[9];let x;t[10]!==n||t[11]!==b.localFiles||t[12]!==u?(x=b.localFiles&&r.jsx(bd,{virtualMcpId:u,branch:n}),t[10]=n,t[11]=b.localFiles,t[12]=u,t[13]=x):x=t[13];let j;t[14]!==n||t[15]!==s||t[16]!==b.localFiles||t[17]!==u?(j=b.localFiles&&r.jsx(hd,{orgSlug:s.slug,virtualMcpId:u,branch:n}),t[14]=n,t[15]=s,t[16]=b.localFiles,t[17]=u,t[18]=j):j=t[18];let y;t[19]!==n||t[20]!==a||t[21]!==b.draftSelect?(y=a&&b.draftSelect&&r.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:r.jsx(Zi,{virtualMcp:a,currentBranch:n})}),t[19]=n,t[20]=a,t[21]=b.draftSelect,t[22]=y):y=t[22];let v;t[23]!==a||t[24]!==b.publish?(v=a&&b.publish&&r.jsxs(r.Fragment,{children:[r.jsx(sl,{orientation:"vertical",className:"mx-1 data-[orientation=vertical]:h-4"}),r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-1",children:b.publish==="cms"?r.jsx(Jc,{virtualMcpId:a.id}):r.jsx(ud,{virtualMcpId:a.id})})]}),t[23]=a,t[24]=b.publish,t[25]=v):v=t[25];let P;return t[26]!==g||t[27]!==x||t[28]!==j||t[29]!==y||t[30]!==v?(P=r.jsxs(r.Fragment,{children:[g,x,j,y,v]}),t[26]=g,t[27]=x,t[28]=j,t[29]=y,t[30]=v,t[31]=P):P=t[31],P}export{mu as S};