decocms 4.492.0 → 4.493.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 (371) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-QC-80JaD.js → ActiveShapeUtils-5xWWHSL1.js} +1 -1
  2. package/dist/client/assets/{AlertCircle--xQnBD7d.js → AlertCircle-B5gBB9h_.js} +1 -1
  3. package/dist/client/assets/{AreaChart-DcLcpJwq.js → AreaChart-BTyzss2a.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-CYC7J9yW.js → ArrowLeft-B7455tPl.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-U1ggjjLO.js → ArrowUp-CP6XCJnB.js} +1 -1
  6. package/dist/client/assets/{BarChart-C6ZU6W4p.js → BarChart-Ch51NWPz.js} +1 -1
  7. package/dist/client/assets/{Building02-HV2PP9yH.js → Building02-BZItaEYx.js} +1 -1
  8. package/dist/client/assets/{CategoricalChart-BlJZ99ma.js → CategoricalChart-DqN5Jy74.js} +1 -1
  9. package/dist/client/assets/{CheckCircle-drYdikgt.js → CheckCircle-C3CiaCW4.js} +1 -1
  10. package/dist/client/assets/{ChevronSelectorVertical-DFKb4uq6.js → ChevronSelectorVertical-DIPs2sw-.js} +1 -1
  11. package/dist/client/assets/{ChevronUp-DZuLpYB1.js → ChevronUp-nynZHATg.js} +1 -1
  12. package/dist/client/assets/{Copy01-D4AqaFnb.js → Copy01-CdRMK9o7.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-BsSJIpnP.js → CreditCard01-DVQTLvKO.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-BRQyK86q.js → DotsVertical-3XBYz4yU.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-Du4zoKdZ.js → ErrorBarContext-Csmpy3UX.js} +1 -1
  16. package/dist/client/assets/{Globe04-CHyEXekU.js → Globe04-DoxNod_i.js} +1 -1
  17. package/dist/client/assets/{Image01-iHUacVtP.js → Image01-DdBetDCI.js} +1 -1
  18. package/dist/client/assets/{Key01-CZzgEM3b.js → Key01-DcSonP-G.js} +1 -1
  19. package/dist/client/assets/{Link01-CLZO7iiX.js → Link01-3BacRGrf.js} +1 -1
  20. package/dist/client/assets/{LinkBroken01-B1PEGLti.js → LinkBroken01-BZFZ6N-h.js} +1 -1
  21. package/dist/client/assets/{Monitor01-Cp_HdXFf.js → Monitor01-DU19-CHk.js} +1 -1
  22. package/dist/client/assets/{Play-CFzbBn-6.js → Play-B7i_-ibU.js} +1 -1
  23. package/dist/client/assets/{Plus-BjGOOPj6.js → Plus-XYNDZJ4s.js} +1 -1
  24. package/dist/client/assets/{SearchMd-8jxREbgM.js → SearchMd-BFitEH5z.js} +1 -1
  25. package/dist/client/assets/{Sector-AZp03vzg.js → Sector-CYOl8Efm.js} +1 -1
  26. package/dist/client/assets/{ShoppingBag01-C_Zwelnq.js → ShoppingBag01-Ci8H67G0.js} +1 -1
  27. package/dist/client/assets/{Sun-VfgIFUUc.js → Sun-D1Mdg8Cq.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-f_6gEt2c.js → SwitchHorizontal01-BHr8jCjb.js} +1 -1
  29. package/dist/client/assets/{Tool01-BD6R-D4L.js → Tool01-DQnW-zjg.js} +1 -1
  30. package/dist/client/assets/{Trash01-BuqURrgl.js → Trash01-DZ8laRwu.js} +1 -1
  31. package/dist/client/assets/{Upload01-CbIQEt1I.js → Upload01-CrRTpeMX.js} +1 -1
  32. package/dist/client/assets/{User01-CHX0WSlv.js → User01-9bZ-cKa7.js} +1 -1
  33. package/dist/client/assets/{UserSquare-v2Vi63lF.js → UserSquare-CuRnLJZ6.js} +1 -1
  34. package/dist/client/assets/{Users01-WUyPxnjn.js → Users01-cUGZjxDe.js} +1 -1
  35. package/dist/client/assets/{XAxis-DnYEgdBg.js → XAxis-DDG3qYHW.js} +1 -1
  36. package/dist/client/assets/{XClose-Dz5Xu4ap.js → XClose-DjFCAP5F.js} +1 -1
  37. package/dist/client/assets/{ZoomOut-BMJlPGPs.js → ZoomOut-BggitXDv.js} +1 -1
  38. package/dist/client/assets/{access-gate-t5XdpP7o.js → access-gate-Cu8JZecz.js} +1 -1
  39. package/dist/client/assets/{add-connection-dialog-DRVvTqsY.js → add-connection-dialog-DBnkMFp9.js} +1 -1
  40. package/dist/client/assets/{agent-analytics-CcVnAkkt.js → agent-analytics-B1wni80p.js} +1 -1
  41. package/dist/client/assets/agent-app-DY95_zYY.js +1 -0
  42. package/dist/client/assets/{agent-assets-Czl2J78n.js → agent-assets-B18leh3z.js} +1 -1
  43. package/dist/client/assets/{agent-automation-Ci4UFwzb.js → agent-automation-CWXHzvtY.js} +1 -1
  44. package/dist/client/assets/{agent-automations-Bz7d9DBh.js → agent-automations-C0tbQ1R9.js} +1 -1
  45. package/dist/client/assets/{agent-connect-sources-DIyj1Rir.js → agent-connect-sources-CKiU44XZ.js} +1 -1
  46. package/dist/client/assets/agent-deck-C8T7Jj3o.js +1 -0
  47. package/dist/client/assets/{agent-e2e-DIxhjk62.js → agent-e2e-LdVq-drf.js} +1 -1
  48. package/dist/client/assets/{agent-experiments-Dn8tNUUB.js → agent-experiments-ClDYYnWj.js} +1 -1
  49. package/dist/client/assets/{agent-file-CZOQf9Yc.js → agent-file-CjZFekiU.js} +1 -1
  50. package/dist/client/assets/{agent-hosting-BsE9QUz1.js → agent-hosting-zrg11_-A.js} +1 -1
  51. package/dist/client/assets/{agent-icon-V8lPNv7A.js → agent-icon-BewGjsar.js} +1 -1
  52. package/dist/client/assets/agent-library-BAUPDsyD.js +1 -0
  53. package/dist/client/assets/agent-library-file-CHlnBg90.js +1 -0
  54. package/dist/client/assets/{agent-monitor-pph3rxpK.js → agent-monitor-CKpvG_Lm.js} +1 -1
  55. package/dist/client/assets/{agent-overview-DW2iu_qJ.js → agent-overview-Di3y0uXp.js} +1 -1
  56. package/dist/client/assets/agent-settings-C-kNuurj.js +1 -0
  57. package/dist/client/assets/{agent-site-editor--h_d0ri-.js → agent-site-editor-16duoEZY.js} +4 -4
  58. package/dist/client/assets/agent-site-editor-code-BUJylH9_.js +2 -0
  59. package/dist/client/assets/{agent-site-editor-content-B0U6dbmd.js → agent-site-editor-content-B64VGP55.js} +3 -3
  60. package/dist/client/assets/agent-site-editor-preview-DIihiuj0.js +518 -0
  61. package/dist/client/assets/agent-view-SjLiGW-o.js +1 -0
  62. package/dist/client/assets/{agent-view-guard-CiQwzIBH.js → agent-view-guard-CoiTTfLB.js} +1 -1
  63. package/dist/client/assets/{agents-list-D6RNu5TG.js → agents-list-CFQQdh1t.js} +1 -1
  64. package/dist/client/assets/{ai-providers-CmqZsPDb.js → ai-providers-CTzk8MgQ.js} +1 -1
  65. package/dist/client/assets/{alert-BsNaBF81.js → alert-Dyx5I-Y3.js} +1 -1
  66. package/dist/client/assets/{alert-dialog-BTzKubzN.js → alert-dialog-BXEG2ySJ.js} +1 -1
  67. package/dist/client/assets/{analytics-sections-s9PmHD7K.js → analytics-sections-BeEYJnmv.js} +1 -1
  68. package/dist/client/assets/api-keys-CH5G5_Qp.js +1 -0
  69. package/dist/client/assets/{api-keys-CplXRVbk.js → api-keys-JMxYvHms.js} +1 -1
  70. package/dist/client/assets/app-editor-DqEmpUhy.js +1 -0
  71. package/dist/client/assets/{asset-utils-Cba9XUPE.js → asset-utils-Euq8y8zU.js} +1 -1
  72. package/dist/client/assets/{auth-C364y6MM.js → auth-Dwu4WH32.js} +1 -1
  73. package/dist/client/assets/{auth-catchall-Fu5UnD3F.js → auth-catchall-D9Xe8fii.js} +1 -1
  74. package/dist/client/assets/{auth-entry-TtvThk9b.js → auth-entry-CCIy-Mhs.js} +1 -1
  75. package/dist/client/assets/{auth-split-layout-DSLQPMD9.js → auth-split-layout-DXUbMgnq.js} +1 -1
  76. package/dist/client/assets/{authenticate-and-persist-oauth-BKg7tWBc.js → authenticate-and-persist-oauth-BEdNWkUl.js} +1 -1
  77. package/dist/client/assets/{automation-list-row-DlIRdIvL.js → automation-list-row-Du4blVfm.js} +1 -1
  78. package/dist/client/assets/{automation-runs-D7YzXLl4.js → automation-runs-BsFnE3d4.js} +1 -1
  79. package/dist/client/assets/{automations-nTgDp9lT.js → automations-Cpff9O08.js} +1 -1
  80. package/dist/client/assets/{autosend-CezXEQCq.js → autosend-BaKgBZDQ.js} +1 -1
  81. package/dist/client/assets/{avatar-DbpOZfYL.js → avatar-BEl6nltF.js} +1 -1
  82. package/dist/client/assets/{badge-BgcNCpYt.js → badge-DFdotQFQ.js} +1 -1
  83. package/dist/client/assets/{block-document-iTsyUX-a.js → block-document-BlUE8Eks.js} +1 -1
  84. package/dist/client/assets/{blocks-preview-workspace-context-BXKULFqX.js → blocks-preview-workspace-context-DSOKao_H.js} +1 -1
  85. package/dist/client/assets/{blog-schema-DD23vovf.js → blog-schema-B_yGbArL.js} +1 -1
  86. package/dist/client/assets/{board-analytics-Cwy2ZAGo.js → board-analytics-UmA2i-Sq.js} +1 -1
  87. package/dist/client/assets/{buckets-BSK6ehlm.js → buckets-CJ11qX_5.js} +1 -1
  88. package/dist/client/assets/{build-improve-prompt-doc-Y3OzCwPY.js → build-improve-prompt-doc-QS7b7hRr.js} +1 -1
  89. package/dist/client/assets/{calendar-CEOFJdzz.js → calendar-CT7cVD7N.js} +1 -1
  90. package/dist/client/assets/{capability-load-error-BCbiiwNK.js → capability-load-error-yZzl8b80.js} +1 -1
  91. package/dist/client/assets/{category-editor-CVM9Agvl.js → category-editor-CTdWf8oW.js} +1 -1
  92. package/dist/client/assets/{chart-BirAG0oj.js → chart-C-785ZEj.js} +1 -1
  93. package/dist/client/assets/chat-context-DJGYyGlB.js +39 -0
  94. package/dist/client/assets/{chat-draft-CjxNTkoz.js → chat-draft-DbBgaLY_.js} +1 -1
  95. package/dist/client/assets/{checkbox-C1PTdkvC.js → checkbox-DmaIcPoL.js} +1 -1
  96. package/dist/client/assets/{choose-editor-D5Z-yVXB.js → choose-editor-CirVpDXw.js} +1 -1
  97. package/dist/client/assets/{claim-phase-copy-DjK7-Dlj.js → claim-phase-copy-BnoHLlrM.js} +1 -1
  98. package/dist/client/assets/{cli-auth-success-DPNe5AnC.js → cli-auth-success-XcMuETZQ.js} +1 -1
  99. package/dist/client/assets/{client-icons-gmrQyeik.js → client-icons-DLhjrwzL.js} +1 -1
  100. package/dist/client/assets/{collapsible-B4tt-A-a.js → collapsible-CgZ4-XuF.js} +1 -1
  101. package/dist/client/assets/{collection-detail-CRZTOFcZ.js → collection-detail-gYU6aRKx.js} +1 -1
  102. package/dist/client/assets/{collection-display-button-iFLNUDt5.js → collection-display-button-YyNX5Efp.js} +1 -1
  103. package/dist/client/assets/{collection-search-6N7Rez-8.js → collection-search-BC0JMMNp.js} +1 -1
  104. package/dist/client/assets/{collection-table-wrapper-CfCYWslA.js → collection-table-wrapper-DFn43mg0.js} +1 -1
  105. package/dist/client/assets/{collection-tabs-CKHgPBCn.js → collection-tabs-DeQ7zbGh.js} +1 -1
  106. package/dist/client/assets/{column-rules-2VSan5Bc.js → column-rules-b8eo73o4.js} +1 -1
  107. package/dist/client/assets/{combobox-DaqRmpnO.js → combobox-DeXU4vSR.js} +1 -1
  108. package/dist/client/assets/{command-Y5_oacWW.js → command-D2QlwSrW.js} +1 -1
  109. package/dist/client/assets/{companion-mcps-section-B-ijJ6Yp.js → companion-mcps-section-DtzaYg0J.js} +1 -1
  110. package/dist/client/assets/{config-BokZbmON.js → config-DP6xvcYW.js} +1 -1
  111. package/dist/client/assets/{connect-CRGqUZ7U.js → connect-ClKIaF8K.js} +1 -1
  112. package/dist/client/assets/{connect-layout-D4PD9y64.js → connect-layout-CyyX0xPx.js} +1 -1
  113. package/dist/client/assets/{connection-CRPvojqI.js → connection-BjzBHJVc.js} +1 -1
  114. package/dist/client/assets/{connection-card-KyCZsDMq.js → connection-card-BVD8Ppl9.js} +1 -1
  115. package/dist/client/assets/{connection-detail-BcuPo63c.js → connection-detail-DfYF7TR9.js} +1 -1
  116. package/dist/client/assets/{connection-form-helpers-DHRB6y9q.js → connection-form-helpers-5EXuPZ4G.js} +1 -1
  117. package/dist/client/assets/{connections-BsYVOIWF.js → connections-D1tC1_hB.js} +1 -1
  118. package/dist/client/assets/{context-TgkInbqd.js → context-DzTTGbcd.js} +1 -1
  119. package/dist/client/assets/{context-menu-BcvT-xNL.js → context-menu-Can7-rLt.js} +1 -1
  120. package/dist/client/assets/{core.esm-BCt5zzlL.js → core.esm-Cvui6jds.js} +1 -1
  121. package/dist/client/assets/{create-organization-dialog-DA_Cpcir.js → create-organization-dialog-CD66iA3E.js} +1 -1
  122. package/dist/client/assets/{daily-pulse-DL2RQNPh.js → daily-pulse-Bz92WYIP.js} +1 -1
  123. package/dist/client/assets/device-hint-DZcinuip.js +1 -0
  124. package/dist/client/assets/{discover-DMYUdkQJ.js → discover-BRALl0mU.js} +1 -1
  125. package/dist/client/assets/{domain-settings-Bw-4hQ9O.js → domain-settings-DiitZO4z.js} +1 -1
  126. package/dist/client/assets/{drawer-Mq2IQ1xB.js → drawer-BPz4t5dt.js} +1 -1
  127. package/dist/client/assets/{editor-4gGGw1LX.js → editor-2jNHgdUN.js} +1 -1
  128. package/dist/client/assets/{empty-state-Z7KZaCgr.js → empty-state-D8iC8fkc.js} +1 -1
  129. package/dist/client/assets/{empty-state-pDkjxQ9v.js → empty-state-Zf0MeIMv.js} +1 -1
  130. package/dist/client/assets/{extract-connection-data-DmRZ30Aj.js → extract-connection-data-BTBLhbEe.js} +1 -1
  131. package/dist/client/assets/{feature-gate-Dejbstp-.js → feature-gate-Dhf-LwS1.js} +1 -1
  132. package/dist/client/assets/{feature-paywall-BatvuaQK.js → feature-paywall-CHcwEHRJ.js} +1 -1
  133. package/dist/client/assets/{file-explorer-DoxI5WYH.js → file-explorer-BhYSdjXu.js} +1 -1
  134. package/dist/client/assets/{file-preview-BKQ9z_Zk.js → file-preview-DvxQuX3P.js} +1 -1
  135. package/dist/client/assets/{file-share-button-E78-t03V.js → file-share-button-C1EB3dOc.js} +1 -1
  136. package/dist/client/assets/{file-type-icon-BIQRdF9B.js → file-type-icon-DzYK4NqY.js} +1 -1
  137. package/dist/client/assets/flat-project-D2zrr-4_.js +1 -0
  138. package/dist/client/assets/{folder-icon-BeWIM1Mh.js → folder-icon-C_Jv4E7N.js} +1 -1
  139. package/dist/client/assets/{form-ClLZmF-x.js → form-BCYpCYIL.js} +1 -1
  140. package/dist/client/assets/{general-CQandLDD.js → general-D8kDc8NB.js} +1 -1
  141. package/dist/client/assets/{home-DVyZY-sa.js → home-CiV29kW5.js} +1 -1
  142. package/dist/client/assets/{icon-button-BflDTZbH.js → icon-button-sHj7Q6Fp.js} +1 -1
  143. package/dist/client/assets/{index-CkPHS5Dh.js → index-6UUldwCZ.js} +1 -1
  144. package/dist/client/assets/{index-DAmEDD4z.js → index-BVmIdqXu.js} +1 -1
  145. package/dist/client/assets/{index-BhOWNPjr.js → index-BhyQWjoM.js} +1 -1
  146. package/dist/client/assets/{index-P5CXrVFm.js → index-Bm9FTdjr.js} +2 -2
  147. package/dist/client/assets/{index-BRB9eRek.js → index-CspW_Aw1.js} +1 -1
  148. package/dist/client/assets/{index-CbgPEOCa.js → index-CuOTEpMz.js} +1 -1
  149. package/dist/client/assets/{index-BRHoVQcU.js → index-D2iZ6syL.js} +1 -1
  150. package/dist/client/assets/{index-C8DfgSPy.js → index-DmfwrRER.js} +3 -3
  151. package/dist/client/assets/{index-DHrUbuPD.js → index-GgiP6YIr.js} +1 -1
  152. package/dist/client/assets/{index-DQmyVRcq.js → index-KCu_K9eF.js} +1 -1
  153. package/dist/client/assets/{index-BgOyhevJ.js → index-YEKHk89C.js} +1 -1
  154. package/dist/client/assets/{index-redirect-CG5FAh2K.js → index-redirect-C_FoZNOn.js} +1 -1
  155. package/dist/client/assets/{index-0YmFgk-4.js → index-s6P2p4h7.js} +1 -1
  156. package/dist/client/assets/{index-D7iHvf3D.js → index-wABYnbOM.js} +1 -1
  157. package/dist/client/assets/{infiniteQueryObserver-DozMisCD.js → infiniteQueryObserver-zxl9Rj5F.js} +1 -1
  158. package/dist/client/assets/{infra-billing-DfiPMKeD.js → infra-billing-heizZxEC.js} +1 -1
  159. package/dist/client/assets/{input-ykei6Cwl.js → input-BkQDO0Ef.js} +3 -3
  160. package/dist/client/assets/{input-CeiEotQg.js → input-Bvc3OT4I.js} +1 -1
  161. package/dist/client/assets/{integration-icon-67Xzvyfa.js → integration-icon-DoYtKqdf.js} +1 -1
  162. package/dist/client/assets/{jira-icon-B2BuyBB4.js → jira-icon-BeORJXLw.js} +1 -1
  163. package/dist/client/assets/{label-BFTsWxRX.js → label-BL2W0Pcn.js} +1 -1
  164. package/dist/client/assets/{layout-C1lXfV0M.js → layout-vy24lHLj.js} +1 -1
  165. package/dist/client/assets/{legacy-agents-deep-biwbtqII.js → legacy-agents-deep-B5L4MOtR.js} +1 -1
  166. package/dist/client/assets/{legacy-main-redirect-DddC7e1C.js → legacy-main-redirect-Pp-THt9D.js} +1 -1
  167. package/dist/client/assets/library-DZte0T9-.js +1 -0
  168. package/dist/client/assets/{library-tab-NRFXm3NX.js → library-tab-2usQWRYi.js} +1 -1
  169. package/dist/client/assets/{login-DgVB-KHS.js → login-CwsPhEpC.js} +1 -1
  170. package/dist/client/assets/{markdown-DsXUd5ra.js → markdown-B3PJYX-4.js} +1 -1
  171. package/dist/client/assets/{mcp-app-renderer-Cbidp8HH.js → mcp-app-renderer-BLT3VM-G.js} +1 -1
  172. package/dist/client/assets/{mcp-oauth-Bvbum4TV.js → mcp-oauth-4gmyTyah.js} +1 -1
  173. package/dist/client/assets/{mcp-oauth-Em69Rf1Z.js → mcp-oauth-BTa4N28L.js} +1 -1
  174. package/dist/client/assets/{members-D8MOsQpb.js → members-Dba6HROK.js} +1 -1
  175. package/dist/client/assets/{memory-KM-sFXxK.js → memory-DAV2Pmj2.js} +1 -1
  176. package/dist/client/assets/{mini-report-page-D6-Sz9FL.js → mini-report-page-B9WE5YW-.js} +1 -1
  177. package/dist/client/assets/{mock-board-CjxyB2zF.js → mock-board-D9i0Vi9l.js} +1 -1
  178. package/dist/client/assets/{monaco-editor-dzebtzJe.js → monaco-editor-DANiMmsL.js} +1 -1
  179. package/dist/client/assets/{monitoring-stats-row-Br92KCz7.js → monitoring-stats-row-B1hQA0Lu.js} +1 -1
  180. package/dist/client/assets/{multi-select-OMY7Ad0D.js → multi-select-BJgtMlC2.js} +1 -1
  181. package/dist/client/assets/{mustache-mZQO-vIe.js → mustache-GMlXm0yl.js} +1 -1
  182. package/dist/client/assets/{new-project-dialog-c2qIcucJ.js → new-project-dialog-C-thpPQ-.js} +1 -1
  183. package/dist/client/assets/{oauth-callback-CbK8qs_l.js → oauth-callback-DZwrYGu7.js} +1 -1
  184. package/dist/client/assets/{oauth-callback-ai-provider-DeX6N2Kr.js → oauth-callback-ai-provider-B7d3QWP4.js} +1 -1
  185. package/dist/client/assets/{onboarding-BW2HKXvH.js → onboarding-DK0DTXli.js} +1 -1
  186. package/dist/client/assets/{openai-conversation-D8EGaB-O.js → openai-conversation-BMdPtMrp.js} +1 -1
  187. package/dist/client/assets/{optimistic-project-sidebar-views-BfSXwHy1.js → optimistic-project-sidebar-views-B4v48qUS.js} +1 -1
  188. package/dist/client/assets/{organization-choice-D26FpHn1.js → organization-choice-BIWVNvRP.js} +1 -1
  189. package/dist/client/assets/{orgs-DOgJxZAX.js → orgs-D5AZUxP6.js} +1 -1
  190. package/dist/client/assets/{page-seo-form-DKPmGeGi.js → page-seo-form-gaHyPBMV.js} +1 -1
  191. package/dist/client/assets/{pair-tkynKLUn.js → pair-DXTFiJNl.js} +1 -1
  192. package/dist/client/assets/{plan-ladder-DK8XbnR2.js → plan-ladder-BUDRjzbj.js} +1 -1
  193. package/dist/client/assets/{popover-BEaGTFER.js → popover-jNB4XciF.js} +1 -1
  194. package/dist/client/assets/{post-calendar-BNSAMYq7.js → post-calendar-D8EAMZvz.js} +1 -1
  195. package/dist/client/assets/{post-editor-COrT_mtL.js → post-editor-BQa57f7n.js} +1 -1
  196. package/dist/client/assets/{preview-content-BDIAdwAe.js → preview-content-B6K8Jkd_.js} +1 -1
  197. package/dist/client/assets/{preview-dialog-lyZyRYbk.js → preview-dialog-Dl22mWwN.js} +1 -1
  198. package/dist/client/assets/{preview-panel-CAmSZPFR.js → preview-panel-LWLVsrdx.js} +1 -1
  199. package/dist/client/assets/{product-picker-dialog-DsW2hIqG.js → product-picker-dialog-RglVwX1Q.js} +1 -1
  200. package/dist/client/assets/{profile-8rq0jv1t.js → profile-BWcfZQ7V.js} +1 -1
  201. package/dist/client/assets/{project-app-view-BATWfA47.js → project-app-view-qeunpPC-.js} +1 -1
  202. package/dist/client/assets/{project-feed-D-Njb4Fa.js → project-feed-Dm758F3_.js} +1 -1
  203. package/dist/client/assets/{project-icon-CVjxspby.js → project-icon-D2vCEWQy.js} +1 -1
  204. package/dist/client/assets/project-reports-6TMbK6-4.js +1 -0
  205. package/dist/client/assets/project-tasks-3mU9NrZf.js +1 -0
  206. package/dist/client/assets/{projects-Ci0VMAti.js → projects-DyGysCyv.js} +1 -1
  207. package/dist/client/assets/{projects-empty-state-DqLxqHkr.js → projects-empty-state-BuMMPopD.js} +1 -1
  208. package/dist/client/assets/{prompts-CcDUo4xE.js → prompts-BrbpQc3X.js} +1 -1
  209. package/dist/client/assets/record-editor-hwH5zZn-.js +1 -0
  210. package/dist/client/assets/redirect-editor-Dc4HBQwl.js +1 -0
  211. package/dist/client/assets/{reports-BKEK9PjO.js → reports-D7gOlgZm.js} +1 -1
  212. package/dist/client/assets/reports-DPHZG4Rx.js +1 -0
  213. package/dist/client/assets/{reports-onboarding-BWPW_861.js → reports-onboarding-DGmwN9iV.js} +1 -1
  214. package/dist/client/assets/{reports-tab-MTJjgnyg.js → reports-tab-Bb7ApLUW.js} +2 -2
  215. package/dist/client/assets/{repositories-COdTxGIM.js → repositories-GlkzQQVy.js} +1 -1
  216. package/dist/client/assets/{repository-binding-DgstszW0.js → repository-binding-D2wL-4Vr.js} +1 -1
  217. package/dist/client/assets/{repository-import-picker-C4LOW7uq.js → repository-import-picker-DtM7QfYh.js} +1 -1
  218. package/dist/client/assets/{repository-picker-iVChzqUi.js → repository-picker-28zwGBgK.js} +1 -1
  219. package/dist/client/assets/{require-capability-CIonrRSM.js → require-capability-Dm4XTD9Y.js} +1 -1
  220. package/dist/client/assets/{required-auth-layout-Docb5mc1.js → required-auth-layout-CbgA2xIU.js} +1 -1
  221. package/dist/client/assets/{reset-password-D-Uff2pm.js → reset-password-15IQ61HR.js} +1 -1
  222. package/dist/client/assets/{resizable-DQkQHFqP.js → resizable-CGWosOTw.js} +1 -1
  223. package/dist/client/assets/{resolve-tab-icon-BJCQiMAG.js → resolve-tab-icon-BEIojUgL.js} +1 -1
  224. package/dist/client/assets/{review-settings-CQUW-c0y.js → review-settings-BAqWAPVV.js} +1 -1
  225. package/dist/client/assets/{rich-text-link-control-BtAN4nTK.js → rich-text-link-control-CE4nCWAz.js} +1 -1
  226. package/dist/client/assets/roles-etRZjRQM.js +1 -0
  227. package/dist/client/assets/route-BCQ2a7UE.js +1 -0
  228. package/dist/client/assets/{route-CV820oik.js → route-CdaJ86mX.js} +1 -1
  229. package/dist/client/assets/{route-B3BzuLT3.js → route-DCLsEeq7.js} +1 -1
  230. package/dist/client/assets/{runnable-block-editor-COF6SwRV.js → runnable-block-editor-xVvcrNA2.js} +1 -1
  231. package/dist/client/assets/{sandbox-lifecycle-context-CZJ_j0np.js → sandbox-lifecycle-context-BKjyczlw.js} +1 -1
  232. package/dist/client/assets/{schema-DPby9xN_.js → schema-C_wSANSe.js} +1 -1
  233. package/dist/client/assets/{scroll-area-BaXoWTc0.js → scroll-area-BT00diUA.js} +1 -1
  234. package/dist/client/assets/{search-input-zIdNkZIZ.js → search-input-D-uP0R3f.js} +1 -1
  235. package/dist/client/assets/{search-toggle-Dd74zbFD.js → search-toggle-Hgq_Klme.js} +1 -1
  236. package/dist/client/assets/{secret-picker-BNQiMdJy.js → secret-picker-BitsdCaD.js} +1 -1
  237. package/dist/client/assets/{secrets-DYrvzDcq.js → secrets-C_yZKBHs.js} +1 -1
  238. package/dist/client/assets/{sections-editor-CWdxzvx_.js → sections-editor-DrNkE-5_.js} +1 -1
  239. package/dist/client/assets/{select-BTTyWh-3.js → select-BVEgIanS.js} +1 -1
  240. package/dist/client/assets/{select-model-_gJCiq6c.js → select-model-CTmCsZzT.js} +1 -1
  241. package/dist/client/assets/{seo-editor-D2aPe-YC.js → seo-editor-Cr-VPdNi.js} +1 -1
  242. package/dist/client/assets/{separator-DjDQYMtn.js → separator-CJOPtNz-.js} +1 -1
  243. package/dist/client/assets/{settings-tab-B0TsEFTt.js → settings-tab-zoRR23UC.js} +1 -1
  244. package/dist/client/assets/{sheet-eZJW88LV.js → sheet-D-h-caij.js} +1 -1
  245. package/dist/client/assets/{shell-layout-OtP14C-y.js → shell-layout-Ckss0QqA.js} +1 -1
  246. package/dist/client/assets/{skills-CyhJcNik.js → skills-Dx8G-x-T.js} +1 -1
  247. package/dist/client/assets/{slider-C2iod3T6.js → slider-DtTzb8JT.js} +1 -1
  248. package/dist/client/assets/{sortable.esm-B2cNTSsr.js → sortable.esm-DCsYtWcb.js} +1 -1
  249. package/dist/client/assets/{sso-BSD5EMNY.js → sso-DDpjWaoO.js} +1 -1
  250. package/dist/client/assets/{suggestion-CEZpMvzO.js → suggestion-Bso4uBRF.js} +1 -1
  251. package/dist/client/assets/{switch-BJJ-2yIv.js → switch-DZo6rAtc.js} +1 -1
  252. package/dist/client/assets/{symbol-DQiTO71i.js → symbol-Co3D-iSE.js} +1 -1
  253. package/dist/client/assets/{synced-repos-19fjd8br.js → synced-repos-B1f0culo.js} +1 -1
  254. package/dist/client/assets/{tab-icon-glyph-B8UDsLej.js → tab-icon-glyph-ClCao4gx.js} +1 -1
  255. package/dist/client/assets/{table-B9C_mOX3.js → table-Gm-jWCpy.js} +1 -1
  256. package/dist/client/assets/{tabs-9di2Neit.js → tabs-CXsAC8nO.js} +1 -1
  257. package/dist/client/assets/{task-board-DsgdOWHQ.js → task-board-Bgw_xVJW.js} +1 -1
  258. package/dist/client/assets/{task-route-_EeI73mv.js → task-route-BxRkc6kt.js} +1 -1
  259. package/dist/client/assets/{task-status-B--cbdkz.js → task-status-B92ESgef.js} +1 -1
  260. package/dist/client/assets/taskboard-analytics-BEBBYmzN.js +1 -0
  261. package/dist/client/assets/{tasks-Bd7TbgaV.js → tasks-BS9sXVdl.js} +1 -1
  262. package/dist/client/assets/tasks-DckB4c8m.js +1 -0
  263. package/dist/client/assets/{textarea-BqIcQ24a.js → textarea-bcNEcwC6.js} +1 -1
  264. package/dist/client/assets/{thread-analytics-CsSdT5az.js → thread-analytics-BE8EaB4a.js} +1 -1
  265. package/dist/client/assets/{thread-button-CycuvBQ2.js → thread-button-BdyWFdme.js} +1 -1
  266. package/dist/client/assets/{thread-intent-Dkew51FR.js → thread-intent-DzHkd78g.js} +1 -1
  267. package/dist/client/assets/{thread-route-BhC2i0VX.js → thread-route-CIiqv6HG.js} +1 -1
  268. package/dist/client/assets/{thread-route-VDZP73-c.js → thread-route-mhniW_q8.js} +1 -1
  269. package/dist/client/assets/{thread-sheet-body-D66PmCTc.js → thread-sheet-body-C1CJm0mZ.js} +1 -1
  270. package/dist/client/assets/{time-range-picker-PWsm0WiC.js → time-range-picker-BUGifbSV.js} +1 -1
  271. package/dist/client/assets/{toggle-group-DlaKauZK.js → toggle-group-5iPAspL-.js} +1 -1
  272. package/dist/client/assets/{tool-namespace-BqgKCylT.js → tool-namespace-CYa7zzrf.js} +1 -1
  273. package/dist/client/assets/{toolbar-icon-button-uADDhC14.js → toolbar-icon-button-CZBCq2Ko.js} +1 -1
  274. package/dist/client/assets/{tooltip-K3E8D0ro.js → tooltip-XZmQWwgB.js} +1 -1
  275. package/dist/client/assets/{tooltipContext-BRcqEDXN.js → tooltipContext-BpyR0oly.js} +1 -1
  276. package/dist/client/assets/{track-CP2DG_55.js → track-Ba2I9E5t.js} +1 -1
  277. package/dist/client/assets/{types-DcgxOiad.js → types-2TlDAuAc.js} +1 -1
  278. package/dist/client/assets/{url-slug-DhfDl2ps.js → url-slug-B-L2Z8me.js} +1 -1
  279. package/dist/client/assets/{usage-stats-BxwGMEO8.js → usage-stats-BihPbkIg.js} +1 -1
  280. package/dist/client/assets/{use-ai-providers-RQRNdq_e.js → use-ai-providers-BP69qr77.js} +1 -1
  281. package/dist/client/assets/{use-automations-Ca5X-jRM.js → use-automations-Biu6cV7d.js} +1 -1
  282. package/dist/client/assets/{use-autosave-CJc5IdX2.js → use-autosave-9jHQ-y1f.js} +1 -1
  283. package/dist/client/assets/{use-chat-layout-state-DtHzBS8D.js → use-chat-layout-state-J-94EUwt.js} +1 -1
  284. package/dist/client/assets/{use-chat-navigation-CVp0n3Im.js → use-chat-navigation-BXZpM5MQ.js} +1 -1
  285. package/dist/client/assets/{use-clock-tick-DpFEAg9e.js → use-clock-tick-rPXqIJP8.js} +1 -1
  286. package/dist/client/assets/{use-connect-companion-CtkvmHzJ.js → use-connect-companion-BupOmQ7x.js} +1 -1
  287. package/dist/client/assets/{use-connection-Bt-E6mI8.js → use-connection-DUF3XC9E.js} +1 -1
  288. package/dist/client/assets/{use-copy-CnGdfZZq.js → use-copy-B01v9eRq.js} +1 -1
  289. package/dist/client/assets/{use-create-virtual-mcp-DSPEp1ij.js → use-create-virtual-mcp-BxoXyDoq.js} +1 -1
  290. package/dist/client/assets/{use-date-fns-locale-CoQZHHDk.js → use-date-fns-locale-CPtrEugx.js} +1 -1
  291. package/dist/client/assets/{use-debounced-autosave-D9QlyCIh.js → use-debounced-autosave-C__Xzre-.js} +1 -1
  292. package/dist/client/assets/{use-debounced-value-BUXOxoNR.js → use-debounced-value-D5_QO1dT.js} +1 -1
  293. package/dist/client/assets/{use-deco-credits-D1Zzfqcx.js → use-deco-credits-DkZSWK0d.js} +1 -1
  294. package/dist/client/assets/{use-decopilot-events-BlbrCauc.js → use-decopilot-events-1iPDcTcf.js} +1 -1
  295. package/dist/client/assets/{use-delete-connection-BHcEA-CR.js → use-delete-connection-DUG0172F.js} +1 -1
  296. package/dist/client/assets/{use-deployment-admin-Bep6HJdp.js → use-deployment-admin-COeWRtXj.js} +1 -1
  297. package/dist/client/assets/{use-ensure-project-folder-CqnXJXRD.js → use-ensure-project-folder-A0But3O1.js} +1 -1
  298. package/dist/client/assets/{use-fast-preview-draft-url-CGzNCC1A.js → use-fast-preview-draft-url-BRdebqFC.js} +1 -1
  299. package/dist/client/assets/{use-file-configs-BPwg0FRs.js → use-file-configs-B8mqylSR.js} +1 -1
  300. package/dist/client/assets/{use-infinite-scroll-DGijCA4m.js → use-infinite-scroll-DewChEmc.js} +1 -1
  301. package/dist/client/assets/{use-join-requests-DSEFov6n.js → use-join-requests-CDGwHERc.js} +1 -1
  302. package/dist/client/assets/{use-main-panel-tabs-OrkHtB0p.js → use-main-panel-tabs-D7q-AygO.js} +1 -1
  303. package/dist/client/assets/{use-mcp-auth-status-DQxUdxan.js → use-mcp-auth-status-CUurQWMq.js} +1 -1
  304. package/dist/client/assets/{use-mcp-client-BzoSbdXu.js → use-mcp-client-Dh_4AZgb.js} +1 -1
  305. package/dist/client/assets/{use-mcp-prompts-C6OXhadi.js → use-mcp-prompts-LJf01t7x.js} +1 -1
  306. package/dist/client/assets/{use-mcp-tools-D_8Ajj_N.js → use-mcp-tools-p8MJKmfB.js} +1 -1
  307. package/dist/client/assets/{use-members-BuywckX1.js → use-members-DQe3FYGy.js} +1 -1
  308. package/dist/client/assets/{use-mobile-C8-RuCPF.js → use-mobile-UYmsi-dp.js} +1 -1
  309. package/dist/client/assets/{use-navigate-to-agent-DLNrFLDT.js → use-navigate-to-agent-DDZo26Jw.js} +1 -1
  310. package/dist/client/assets/use-new-blocks-editor-nCMzaJ9Q.js +1 -0
  311. package/dist/client/assets/{use-open-billing-url-xKTM1AUW.js → use-open-billing-url-C0JU6CzN.js} +1 -1
  312. package/dist/client/assets/{use-org-auth-client-B6LnSeUd.js → use-org-auth-client-CPbs0OVW.js} +1 -1
  313. package/dist/client/assets/{use-org-fs-DErltq5P.js → use-org-fs-gQ0RuIPK.js} +1 -1
  314. package/dist/client/assets/{use-org-repo-syncs-DMFEDOzK.js → use-org-repo-syncs-KkmagwRy.js} +1 -1
  315. package/dist/client/assets/{use-org-sso-sw3on3hq.js → use-org-sso-DWtbATGD.js} +1 -1
  316. package/dist/client/assets/{use-organization-roles-DjUuzQZu.js → use-organization-roles-BKQWBZmO.js} +1 -1
  317. package/dist/client/assets/{use-organization-settings-BHelWCQF.js → use-organization-settings-xcc5-6DS.js} +1 -1
  318. package/dist/client/assets/{use-panel-navigate-BLjJq7A_.js → use-panel-navigate-A1obvdVI.js} +1 -1
  319. package/dist/client/assets/{use-project-scope-B9l8p85i.js → use-project-scope-BxCbtcTE.js} +1 -1
  320. package/dist/client/assets/{use-releases-CsZsJd__.js → use-releases-G79MSxhR.js} +1 -1
  321. package/dist/client/assets/{use-reports-diagnostic-CA8bVs4C.js → use-reports-diagnostic-a7ERyr_7.js} +1 -1
  322. package/dist/client/assets/{use-sandbox-events-C41kLIF6.js → use-sandbox-events-CSN74_aC.js} +1 -1
  323. package/dist/client/assets/{use-secrets-Od0f7P_4.js → use-secrets-CmTpPaF9.js} +1 -1
  324. package/dist/client/assets/{use-section-preview-base-CtsulJXk.js → use-section-preview-base-DbQlCGNR.js} +1 -1
  325. package/dist/client/assets/{use-tags-Df3tX30j.js → use-tags-Ch6_1it4.js} +1 -1
  326. package/dist/client/assets/{use-task-board-analytics-D3QeGKDt.js → use-task-board-analytics-v7nFgyEB.js} +1 -1
  327. package/dist/client/assets/{use-task-board-events-DgHn2yeU.js → use-task-board-events-DHjlo-9e.js} +1 -1
  328. package/dist/client/assets/{use-task-board-item-prs-C9TWjRE5.js → use-task-board-item-prs-CoXnP9ys.js} +1 -1
  329. package/dist/client/assets/{use-task-board-items-DqDMBUiA.js → use-task-board-items-erbHwxMh.js} +1 -1
  330. package/dist/client/assets/{use-task-metadata-BGZgwqEP.js → use-task-metadata-DmWCG43J.js} +1 -1
  331. package/dist/client/assets/{use-thread-analytics-DpRLYYMv.js → use-thread-analytics-DJfFmK1j.js} +1 -1
  332. package/dist/client/assets/{use-thread-outputs-Bd93hD9n.js → use-thread-outputs-7J4Ek_Zs.js} +1 -1
  333. package/dist/client/assets/useInfiniteQuery-vZqvTY4f.js +1 -0
  334. package/dist/client/assets/{useQueries-FiLem-Cr.js → useQueries-DoURbZYb.js} +1 -1
  335. package/dist/client/assets/useSuspenseInfiniteQuery-DdGuWYX3.js +1 -0
  336. package/dist/client/assets/{users-DDcsQE52.js → users-BfQBxfCk.js} +1 -1
  337. package/dist/client/assets/{utils-D-s8UffD.js → utils-DAEMarMy.js} +1 -1
  338. package/dist/client/assets/{variant-calendar-A2za84Mi.js → variant-calendar-DNADqO99.js} +1 -1
  339. package/dist/client/assets/{variant-matcher-override-BQT0OBiv.js → variant-matcher-override-BDRgB-Pq.js} +1 -1
  340. package/dist/client/assets/{view-mode-toggle-CLajaG70.js → view-mode-toggle-DPJfZa3C.js} +1 -1
  341. package/dist/client/assets/{virtual-mcp-BsaYLZxR.js → virtual-mcp-C54PVPPw.js} +1 -1
  342. package/dist/client/assets/{watch-sse-pool-Ckvo_uxI.js → watch-sse-pool-DmOqvBBq.js} +1 -1
  343. package/dist/client/index.html +1 -1
  344. package/dist/server/server.js +514 -514
  345. package/package.json +1 -1
  346. package/dist/client/assets/agent-app-BkQm9oem.js +0 -1
  347. package/dist/client/assets/agent-deck-3-EO6Xhr.js +0 -1
  348. package/dist/client/assets/agent-library-DkCo-Ode.js +0 -1
  349. package/dist/client/assets/agent-library-file-D3g_rHVL.js +0 -1
  350. package/dist/client/assets/agent-settings-DW_a2Oeo.js +0 -1
  351. package/dist/client/assets/agent-site-editor-code-DTMSEaFy.js +0 -2
  352. package/dist/client/assets/agent-site-editor-preview-DHCTEFq_.js +0 -518
  353. package/dist/client/assets/agent-view-BVT0tnMS.js +0 -1
  354. package/dist/client/assets/api-keys-BNHCLXyO.js +0 -1
  355. package/dist/client/assets/app-editor-C2lg73cH.js +0 -1
  356. package/dist/client/assets/chat-context-By_4gW6u.js +0 -39
  357. package/dist/client/assets/device-hint-C-6GVgyh.js +0 -1
  358. package/dist/client/assets/flat-project-DcECHGX3.js +0 -1
  359. package/dist/client/assets/library-Cof5sIHl.js +0 -1
  360. package/dist/client/assets/project-reports-BkzVwq7y.js +0 -1
  361. package/dist/client/assets/project-tasks-B54X-ADA.js +0 -1
  362. package/dist/client/assets/record-editor-CsrZJ7eU.js +0 -1
  363. package/dist/client/assets/redirect-editor-CeRRUF_Y.js +0 -1
  364. package/dist/client/assets/reports-TUXU0eWQ.js +0 -1
  365. package/dist/client/assets/roles-B5x0qKiF.js +0 -1
  366. package/dist/client/assets/route-DkvQrfxW.js +0 -1
  367. package/dist/client/assets/taskboard-analytics-C8fUYGcQ.js +0 -1
  368. package/dist/client/assets/tasks-RI02vBG9.js +0 -1
  369. package/dist/client/assets/use-new-blocks-editor-Jqd7-2D9.js +0 -1
  370. package/dist/client/assets/useInfiniteQuery-DCtX1Z2b.js +0 -1
  371. package/dist/client/assets/useSuspenseInfiniteQuery-BY9PV9K3.js +0 -1
@@ -1,13 +1,13 @@
1
- import{c as U,K as An,ao as Tn,b as Be,r as X,l as le,j as c,at as Ea,ax as Nh,B as pe,U as Ai,t as Xe,T as cs,V as ds,X as us,a as sr,a2 as rr,aS as Oh,h as rs,ap as Ih,I as jh,a6 as Hh,R as Fh,m as zi,aT as zh,F as Wh,D as $h,v as Uh,q as Kh,Q as qh,H as Vh,a4 as Pa,aU as ns,o as Yh,e as io,y as Gh,J as Xh,aV as Jh,O as Zh}from"./index-P5CXrVFm.js";import{S as Qh}from"./separator-DjDQYMtn.js";import{e as ec,u as Wi,b as Ra,a as tc}from"./chat-context-By_4gW6u.js";import{L as ic,a as sc}from"./shell-layout-OtP14C-y.js";import{I as Ba}from"./toolbar-icon-button-uADDhC14.js";import{P as Da,a as Aa,b as Ta}from"./popover-BEaGTFER.js";import{b as bt,T as St,a as wt,c as nr}from"./tooltip-K3E8D0ro.js";import{A as Ma,a as La,b as Na,c as Oa,g as Ia,d as ja,e as Ha,f as Fa}from"./alert-dialog-BTzKubzN.js";import{f as rc,C as nc,c as oc,a as so,e as ro,b as no}from"./command-Y5_oacWW.js";import{T as Pi,a as za,b as Wa}from"./tabs-9di2Neit.js";import{t as or,n as ac}from"./ChevronUp-DZuLpYB1.js";import{O as ar,C as lc,b as $a,P as hc,d as cc,Q as Ua,L as dc}from"./agent-icon-V8lPNv7A.js";import{i as Ka}from"./DotsVertical-BRQyK86q.js";import{b as qa}from"./Tool01-BD6R-D4L.js";import{s as Mn}from"./Plus-BjGOOPj6.js";import{s as lr}from"./Trash01-BuqURrgl.js";import{u as Ln,r as br,a as oo,n as Sr,g as Nn,b as On}from"./use-releases-CsZsJd__.js";import{p as uc,d as fc,r as _c}from"./thread-intent-Dkew51FR.js";import{u as pc}from"./use-members-BuywckX1.js";import{u as In,p as Hr,a as mc,g as Fr,i as Va,e as os,f as Ya,b as gc,D as vc,C as bc}from"./claim-phase-copy-DjK7-Dlj.js";import{h as Ga,r as Xa,g as Sc,d as Bt,a as hr,e as Ja}from"./repository-binding-DgstszW0.js";import{u as wc}from"./use-debounced-value-BUXOxoNR.js";import{u as yc}from"./use-clock-tick-DpFEAg9e.js";import{u as xc}from"./useInfiniteQuery-DCtX1Z2b.js";import{d as Cc,b as kc,p as Ec,e as Za,g as Qa,h as el}from"./use-navigate-to-agent-DLNrFLDT.js";import{R as ao}from"./virtual-mcp-BsaYLZxR.js";import{G as tl}from"./repository-picker-iVChzqUi.js";import{a as cr}from"./input-ykei6Cwl.js";import{w as Pc,r as il,l as sl,u as rl}from"./device-hint-C-6GVgyh.js";import{u as Rc,a as Bc}from"./use-fast-preview-draft-url-CGzNCC1A.js";import{u as dr,a as nl}from"./use-sandbox-events-C41kLIF6.js";import{T as Dc}from"./textarea-BqIcQ24a.js";import{i as ol}from"./CheckCircle-drYdikgt.js";import{s as al}from"./Image01-iHUacVtP.js";import{a as Ac}from"./format-time-CjIPQhCN.js";import{a as Tc,b as Mc,c as Lc}from"./UserSquare-v2Vi63lF.js";import{f as jn,a as ll,r as Hn,p as Nc,b as hl,i as cl,d as Oc,s as dl,m as Ic,h as jc,c as ul,e as Hc,n as Fc,g as zc,j as Wc,k as $c,l as fl,o as Uc,q as _l,t as pl,u as wr}from"./sandbox-git-api-C7JbVL7R.js";import{d as Kc,g as qc}from"./utils-D-s8UffD.js";import{i as Vc}from"./Monitor01-Cp_HdXFf.js";import{g as Yc,w as ml,D as Gc}from"./section-preview-url-7zfngvgW.js";import{w as lo}from"./editor-4gGGw1LX.js";import{s as gl}from"./save-changes-debug-nBi-n9eV.js";import{u as Xc}from"./use-mcp-client-BzoSbdXu.js";import{a as Jc,b as vl}from"./sandbox-lifecycle-context-CZJ_j0np.js";import{a as ho,c as Zc}from"./use-chat-layout-state-DtHzBS8D.js";import{u as Qc}from"./use-panel-navigate-BLjJq7A_.js";import{b as co}from"./sandbox-url-D3mC8qhT.js";import{i as Ks}from"./Play-CFzbBn-6.js";import{C as ed}from"./index-DAmEDD4z.js";import"./autosend-CezXEQCq.js";import"./use-decopilot-events-BlbrCauc.js";import"./watch-sse-pool-Ckvo_uxI.js";import"./task-board-DsgdOWHQ.js";import"./schema-DPby9xN_.js";import"./backoff-CrEUbyZT.js";import"./use-ai-providers-RQRNdq_e.js";import"./use-chat-navigation-CVp0n3Im.js";import"./thread-route-VDZP73-c.js";import"./location-BjlyegC2.js";import"./use-organization-settings-BHelWCQF.js";import"./avatar-DbpOZfYL.js";import"./User01-CHX0WSlv.js";import"./Building02-HV2PP9yH.js";import"./XClose-Dz5Xu4ap.js";import"./use-project-scope-B9l8p85i.js";import"./ZoomOut-BMJlPGPs.js";import"./integration-icon-67Xzvyfa.js";import"./LinkBroken01-B1PEGLti.js";import"./project-icon-CVjxspby.js";import"./new-project-dialog-c2qIcucJ.js";import"./ArrowLeft-CYC7J9yW.js";import"./label-BFTsWxRX.js";import"./repository-import-picker-C4LOW7uq.js";import"./required-auth-layout-Docb5mc1.js";import"./use-org-sso-sw3on3hq.js";import"./index-BRHoVQcU.js";import"./index-0YmFgk-4.js";import"./SearchMd-8jxREbgM.js";import"./AlertCircle--xQnBD7d.js";import"./ArrowUp-U1ggjjLO.js";import"./ShoppingBag01-C_Zwelnq.js";import"./ChevronSelectorVertical-DFKb4uq6.js";import"./Copy01-D4AqaFnb.js";import"./CreditCard01-BsSJIpnP.js";import"./Globe04-CHyEXekU.js";import"./SwitchHorizontal01-f_6gEt2c.js";import"./Key01-CZzgEM3b.js";import"./Link01-CLZO7iiX.js";import"./Sun-VfgIFUUc.js";import"./Upload01-CbIQEt1I.js";import"./Users01-WUyPxnjn.js";import"./serial-task-queue-CGOeQgpr.js";import"./delay-CnY5UFtP.js";import"./slugify-CEUa2lfQ.js";import"./use-org-auth-client-B6LnSeUd.js";import"./infiniteQueryObserver-DozMisCD.js";import"./url-slug-DhfDl2ps.js";import"./collection-search-6N7Rez-8.js";import"./usage-stats-BxwGMEO8.js";import"./tool-namespace-BqgKCylT.js";import"./form-ClLZmF-x.js";import"./utils-CVEq3hMx.js";import"./markdown-DsXUd5ra.js";import"./use-copy-CnGdfZZq.js";import"./use-mobile-C8-RuCPF.js";import"./icon-button-BflDTZbH.js";import"./file-type-icon-BIQRdF9B.js";import"./chat-draft-CjxNTkoz.js";import"./select-BTTyWh-3.js";import"./index-BdQq_4o_.js";import"./use-deco-credits-D1Zzfqcx.js";import"./toggle-group-DlaKauZK.js";import"./use-open-billing-url-xKTM1AUW.js";import"./index-CbgPEOCa.js";import"./checkbox-C1PTdkvC.js";import"./ai-providers-logos-DD3qZ33J.js";import"./drawer-Mq2IQ1xB.js";import"./input-CeiEotQg.js";import"./suggestion-CEZpMvzO.js";import"./use-mcp-prompts-C6OXhadi.js";import"./use-org-fs-DErltq5P.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-BatvuaQK.js";import"./plan-ladder-DK8XbnR2.js";import"./add-connection-dialog-DRVvTqsY.js";import"./extract-connection-data-DmRZ30Aj.js";import"./metadata-D72DunRR.js";import"./connection-CRPvojqI.js";import"./connection-card-KyCZsDMq.js";import"./connection-slug-CITJ0kGN.js";import"./use-connection-Bt-E6mI8.js";import"./connection-form-helpers-DHRB6y9q.js";import"./authenticate-and-persist-oauth-BKg7tWBc.js";import"./mcp-oauth-Bvbum4TV.js";import"./mcp-oauth-Em69Rf1Z.js";import"./auth-C364y6MM.js";import"./collection-tabs-CKHgPBCn.js";import"./badge-BgcNCpYt.js";import"./use-infinite-scroll-DGijCA4m.js";import"./useSuspenseInfiniteQuery-BY9PV9K3.js";import"./use-task-board-events-DgHn2yeU.js";import"./pair-tkynKLUn.js";import"./collapsible-B4tt-A-a.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-Cbidp8HH.js";import"./types-DcgxOiad.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-eZJW88LV.js";import"./use-thread-outputs-Bd93hD9n.js";import"./differenceInSeconds-C3x8sHUj.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./use-file-configs-BPwg0FRs.js";import"./site-slug-DebpOoQq.js";import"./thread-button-CycuvBQ2.js";import"./resizable-DQkQHFqP.js";const uo=/[\r\n<>]/,td=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function ur(t){const e=t?.userName?.trim();if(!e||uo.test(e))return null;const i=t?.userEmail?.trim();return!i||uo.test(i)?{userName:e}:td.test(i)?{userName:e,userEmail:i}:{userName:e}}function id(t){return t.split(`
1
+ import{c as U,K as An,ao as Tn,b as Be,r as X,l as le,j as c,at as Ea,ax as Nh,B as pe,U as Ai,t as Xe,T as cs,V as ds,X as us,a as sr,a2 as rr,aS as Oh,h as rs,ap as Ih,I as jh,a6 as Hh,R as Fh,m as zi,aT as zh,F as Wh,D as $h,v as Uh,q as Kh,Q as qh,H as Vh,a4 as Pa,aU as ns,o as Yh,e as io,y as Gh,J as Xh,aV as Jh,O as Zh}from"./index-Bm9FTdjr.js";import{S as Qh}from"./separator-CJOPtNz-.js";import{e as ec,u as Wi,r as Ra,l as Ba,b as Da,a as tc}from"./chat-context-DJGYyGlB.js";import{L as ic,a as sc}from"./shell-layout-Ckss0QqA.js";import{I as Aa}from"./toolbar-icon-button-CZBCq2Ko.js";import{P as Ta,a as Ma,b as La}from"./popover-jNB4XciF.js";import{b as bt,T as St,a as wt,c as nr}from"./tooltip-XZmQWwgB.js";import{A as Na,a as Oa,b as Ia,c as ja,g as Ha,d as Fa,e as za,f as Wa}from"./alert-dialog-BXEG2ySJ.js";import{f as rc,C as nc,c as oc,a as so,e as ro,b as no}from"./command-D2QlwSrW.js";import{T as Pi,a as $a,b as Ua}from"./tabs-CXsAC8nO.js";import{t as or,n as ac}from"./ChevronUp-nynZHATg.js";import{O as ar,C as lc,b as Ka,P as hc,d as cc,Q as qa,L as dc}from"./agent-icon-BewGjsar.js";import{i as Va}from"./DotsVertical-3XBYz4yU.js";import{b as Ya}from"./Tool01-DQnW-zjg.js";import{s as Mn}from"./Plus-XYNDZJ4s.js";import{s as lr}from"./Trash01-DZ8laRwu.js";import{u as Ln,r as br,a as oo,n as Sr,g as Nn,b as On}from"./use-releases-G79MSxhR.js";import{p as uc,d as fc,r as _c}from"./thread-intent-DzHkd78g.js";import{u as pc}from"./use-members-DQe3FYGy.js";import{u as In,p as Hr,a as mc,g as Fr,i as Ga,e as os,f as Xa,b as gc,D as vc,C as bc}from"./claim-phase-copy-BnoHLlrM.js";import{h as Ja,r as Za,g as Sc,d as Bt,a as hr,e as Qa}from"./repository-binding-D2wL-4Vr.js";import{u as wc}from"./use-debounced-value-D5_QO1dT.js";import{u as yc}from"./use-clock-tick-rPXqIJP8.js";import{u as xc}from"./useInfiniteQuery-vZqvTY4f.js";import{d as Cc,b as kc,p as Ec,e as el,g as tl,h as il}from"./use-navigate-to-agent-DDZo26Jw.js";import{R as ao}from"./virtual-mcp-C54PVPPw.js";import{G as sl}from"./repository-picker-28zwGBgK.js";import{a as cr}from"./input-BkQDO0Ef.js";import{w as Pc,u as rl}from"./device-hint-DZcinuip.js";import{u as Rc,a as Bc}from"./use-fast-preview-draft-url-BRdebqFC.js";import{u as dr,a as nl}from"./use-sandbox-events-CSN74_aC.js";import{T as Dc}from"./textarea-bcNEcwC6.js";import{i as ol}from"./CheckCircle-C3CiaCW4.js";import{s as al}from"./Image01-DdBetDCI.js";import{a as Ac}from"./format-time-CjIPQhCN.js";import{a as Tc,b as Mc,c as Lc}from"./UserSquare-CuRnLJZ6.js";import{f as jn,a as ll,r as Hn,p as Nc,b as hl,i as cl,d as Oc,s as dl,m as Ic,h as jc,c as ul,e as Hc,n as Fc,g as zc,j as Wc,k as $c,l as fl,o as Uc,q as _l,t as pl,u as wr}from"./sandbox-git-api-C7JbVL7R.js";import{d as Kc,g as qc}from"./utils-DAEMarMy.js";import{i as Vc}from"./Monitor01-DU19-CHk.js";import{g as Yc,w as ml,D as Gc}from"./section-preview-url-7zfngvgW.js";import{w as lo}from"./editor-2jNHgdUN.js";import{s as gl}from"./save-changes-debug-nBi-n9eV.js";import{u as Xc}from"./use-mcp-client-Dh_4AZgb.js";import{a as Jc,b as vl}from"./sandbox-lifecycle-context-BKjyczlw.js";import{a as ho,c as Zc}from"./use-chat-layout-state-J-94EUwt.js";import{u as Qc}from"./use-panel-navigate-A1obvdVI.js";import{b as co}from"./sandbox-url-D3mC8qhT.js";import{i as Ks}from"./Play-B7i_-ibU.js";import{C as ed}from"./index-BVmIdqXu.js";import"./autosend-BaKgBZDQ.js";import"./use-decopilot-events-1iPDcTcf.js";import"./watch-sse-pool-DmOqvBBq.js";import"./task-board-Bgw_xVJW.js";import"./schema-C_wSANSe.js";import"./backoff-CrEUbyZT.js";import"./use-ai-providers-BP69qr77.js";import"./use-chat-navigation-BXZpM5MQ.js";import"./thread-route-mhniW_q8.js";import"./location-BjlyegC2.js";import"./use-organization-settings-xcc5-6DS.js";import"./avatar-BEl6nltF.js";import"./User01-9bZ-cKa7.js";import"./Building02-BZItaEYx.js";import"./XClose-DjFCAP5F.js";import"./use-project-scope-BxCbtcTE.js";import"./ZoomOut-BggitXDv.js";import"./integration-icon-DoYtKqdf.js";import"./LinkBroken01-BZFZ6N-h.js";import"./project-icon-D2vCEWQy.js";import"./new-project-dialog-C-thpPQ-.js";import"./ArrowLeft-B7455tPl.js";import"./label-BL2W0Pcn.js";import"./repository-import-picker-DtM7QfYh.js";import"./required-auth-layout-CbgA2xIU.js";import"./use-org-sso-DWtbATGD.js";import"./index-D2iZ6syL.js";import"./index-s6P2p4h7.js";import"./SearchMd-BFitEH5z.js";import"./AlertCircle-B5gBB9h_.js";import"./ArrowUp-CP6XCJnB.js";import"./ShoppingBag01-Ci8H67G0.js";import"./ChevronSelectorVertical-DIPs2sw-.js";import"./Copy01-CdRMK9o7.js";import"./CreditCard01-DVQTLvKO.js";import"./Globe04-DoxNod_i.js";import"./SwitchHorizontal01-BHr8jCjb.js";import"./Key01-DcSonP-G.js";import"./Link01-3BacRGrf.js";import"./Sun-D1Mdg8Cq.js";import"./Upload01-CrRTpeMX.js";import"./Users01-cUGZjxDe.js";import"./serial-task-queue-CGOeQgpr.js";import"./delay-CnY5UFtP.js";import"./slugify-CEUa2lfQ.js";import"./use-org-auth-client-CPbs0OVW.js";import"./infiniteQueryObserver-zxl9Rj5F.js";import"./url-slug-B-L2Z8me.js";import"./collection-search-BC0JMMNp.js";import"./usage-stats-BihPbkIg.js";import"./tool-namespace-CYa7zzrf.js";import"./form-BCYpCYIL.js";import"./utils-CVEq3hMx.js";import"./markdown-B3PJYX-4.js";import"./use-copy-B01v9eRq.js";import"./use-mobile-UYmsi-dp.js";import"./icon-button-sHj7Q6Fp.js";import"./file-type-icon-DzYK4NqY.js";import"./chat-draft-DbBgaLY_.js";import"./select-BVEgIanS.js";import"./index-BdQq_4o_.js";import"./use-deco-credits-DkZSWK0d.js";import"./toggle-group-5iPAspL-.js";import"./use-open-billing-url-C0JU6CzN.js";import"./index-CuOTEpMz.js";import"./checkbox-DmaIcPoL.js";import"./ai-providers-logos-DD3qZ33J.js";import"./drawer-BPz4t5dt.js";import"./input-Bvc3OT4I.js";import"./suggestion-Bso4uBRF.js";import"./use-mcp-prompts-LJf01t7x.js";import"./use-org-fs-gQ0RuIPK.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-CHcwEHRJ.js";import"./plan-ladder-BUDRjzbj.js";import"./add-connection-dialog-DBnkMFp9.js";import"./extract-connection-data-BTBLhbEe.js";import"./metadata-D72DunRR.js";import"./connection-BjzBHJVc.js";import"./connection-card-BVD8Ppl9.js";import"./connection-slug-CITJ0kGN.js";import"./use-connection-DUF3XC9E.js";import"./connection-form-helpers-5EXuPZ4G.js";import"./authenticate-and-persist-oauth-BEdNWkUl.js";import"./mcp-oauth-4gmyTyah.js";import"./mcp-oauth-BTa4N28L.js";import"./auth-Dwu4WH32.js";import"./collection-tabs-DeQ7zbGh.js";import"./badge-DFdotQFQ.js";import"./use-infinite-scroll-DewChEmc.js";import"./useSuspenseInfiniteQuery-DdGuWYX3.js";import"./use-task-board-events-DHjlo-9e.js";import"./pair-DXTFiJNl.js";import"./collapsible-CgZ4-XuF.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-BLT3VM-G.js";import"./types-2TlDAuAc.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-D-h-caij.js";import"./use-thread-outputs-7J4Ek_Zs.js";import"./differenceInSeconds-C3x8sHUj.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./use-file-configs-B8mqylSR.js";import"./site-slug-DebpOoQq.js";import"./thread-button-BdyWFdme.js";import"./resizable-CGWosOTw.js";const uo=/[\r\n<>]/,td=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function ur(t){const e=t?.userName?.trim();if(!e||uo.test(e))return null;const i=t?.userEmail?.trim();return!i||uo.test(i)?{userName:e}:td.test(i)?{userName:e,userEmail:i}:{userName:e}}function id(t){return t.split(`
2
2
  `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
3
3
  `).trimEnd()}function sd(t){const e=t.userName.trim(),i=t.userEmail?.trim();return i?`Co-authored-by: ${e} <${i}>`:`Co-authored-by: ${e}`}function bl(t,e){const i=ur(e);if(!i)return t;const s=id(t),r=sd(i);if(s.includes(r))return s;const n=s.trimEnd();return n.length>0?`${n}
4
4
 
5
- ${r}`:r}function rd(t,e){const i=t?.trim();return i?bl(i,e):i||void 0}const nd=["dev","start"],od={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},fo=1114111;function _o(t){return t?t.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,(e,i)=>{if(i.startsWith("#x")||i.startsWith("#X")){const s=Number.parseInt(i.slice(2),16);return!Number.isFinite(s)||s>fo?e:String.fromCodePoint(s)}if(i.startsWith("#")){const s=Number.parseInt(i.slice(1),10);return!Number.isFinite(s)||s>fo?e:String.fromCodePoint(s)}return od[i]??e}):""}const ad=10080*60*1e3;function ld({sandboxMap:t,userId:e,rawBranches:i,now:s}){const r=new Map;for(const[d,f]of Object.entries(t??{}))for(const[_,p]of Object.entries(f??{})){let m=r.get(_);m||(m={userIds:new Set,lastActiveAt:0},r.set(_,m)),m.userIds.add(d);for(const g of Object.values(p??{})){const v=g?.createdAt??0;v>m.lastActiveAt&&(m.lastActiveAt=v)}}const n=s-ad,o=[...r.entries()].filter(([,d])=>d.lastActiveAt>=n).sort((d,f)=>f[1].lastActiveAt-d[1].lastActiveAt).map(([d,f])=>({name:d,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),a=new Set(o.map(d=>d.name)),h=new Set(Object.keys(t?.[e]??{})),l=[...h].filter(d=>!a.has(d)).sort().map(d=>({name:d,source:"yours"})),u=i.filter(d=>!h.has(d.name)&&!a.has(d.name)).map(d=>({name:d.name,source:"other",author:d.author??null}));return{recent:o,yours:l,others:u}}const hd=100,cd=50,dd=300;function zr(t,e){const i=e.trim().toLowerCase();return i?t.toLowerCase().includes(i):!0}function ud(t){const e=U.c(39),{orgId:i,orgSlug:s,userId:r,target:n,sandboxMap:o,owner:a,repo:h,search:l,enabled:u}=t,d=l===void 0?"":l,f=u===void 0?!0:u;let _;e[0]!==d?(_=d.trim(),e[0]=d,e[1]=_):_=e[1];const p=_,m=wc(p,dd);let g;e[2]!==n?(g=Ga(n),e[2]=n,e[3]=g):g=e[3];const v=g,k=p.length>0;let b;e[4]!==m||e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==h||e[9]!==n?(b=An.githubBranchSearch(i,s,Xa(n),a,h,m),e[4]=m,e[5]=i,e[6]=s,e[7]=a,e[8]=h,e[9]=n,e[10]=b):b=e[10];const w=f&&v;let C;e[11]!==m||e[12]!==s||e[13]!==n?(C=ee=>{const{pageParam:ue}=ee;return Tn(s,"REPOSITORY_SEARCH_BRANCHES",{...n,query:m,limit:m?cd:hd,cursor:ue})},e[11]=m,e[12]=s,e[13]=n,e[14]=C):C=e[14];let S;e[15]!==m?(S=ee=>m?void 0:ee.nextCursor??void 0,e[15]=m,e[16]=S):S=e[16];let R;e[17]!==b||e[18]!==w||e[19]!==C||e[20]!==S?(R={queryKey:b,enabled:w,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:C,getNextPageParam:S},e[17]=b,e[18]=w,e[19]=C,e[20]=S,e[21]=R):R=e[21];const{data:N,isLoading:I,isError:L,isFetching:y,hasNextPage:E,isFetchingNextPage:x,fetchNextPage:A}=xc(R),D=k&&(m!==p||y),P=(N?.pages??[]).flatMap(fd),B=yc(6e4),M=ld({sandboxMap:o,userId:r,rawBranches:P,now:B});let K;e[22]!==p?(K=ee=>zr(ee.name,p),e[22]=p,e[23]=K):K=e[23];const F=M.recent.filter(K);let H;e[24]!==p?(H=ee=>zr(ee.name,p),e[24]=p,e[25]=H):H=e[25];const Y=M.yours.filter(H),q=M.others,te=N?.pages[0],J=k&&te&&!D?Math.max(0,te.totalCount-te.branches.length):0,Q=!k&&E;let W;e[26]!==A?(W=()=>{A()},e[26]=A,e[27]=W):W=e[27];let G;return e[28]!==J||e[29]!==L||e[30]!==x||e[31]!==I||e[32]!==D||e[33]!==q||e[34]!==F||e[35]!==Q||e[36]!==W||e[37]!==Y?(G={recent:F,yours:Y,others:q,isLoading:I,isError:L,isSearching:D,hiddenMatchCount:J,hasMore:Q,isFetchingMore:x,fetchMore:W},e[28]=J,e[29]=L,e[30]=x,e[31]=I,e[32]=D,e[33]=q,e[34]=F,e[35]=Q,e[36]=W,e[37]=Y,e[38]=G):G=e[38],G}function fd(t){return t.branches}function _d(t){const e=U.c(231),{virtualMcpId:i,userLabel:s,value:r,baseBranch:n,orgId:o,orgSlug:a,userId:h,target:l,owner:u,repo:d,sandboxMap:f,onChange:_,onCreateBranch:p,onAdoptBranch:m,disabled:g,spawnsNewChat:v,placement:k}=t,b=g===void 0?!1:g,w=v===void 0?!1:v,C=k===void 0?"chat":k,S=Be(),R=C==="header",[N,I]=X.useState(!1),[L,y]=X.useState(!1),[E,x]=X.useState("branches"),[A,D]=X.useState(null),[P,B]=X.useState(""),[M,K]=X.useState(null),F=X.useRef(null),{releases:H,createRelease:Y,renameRelease:q,deleteRelease:te}=Ln(i),{url:J,setUrl:Q,clear:W}=In(i),G=!!J;let ee;e[0]!==N?(ee={enabled:N},e[0]=N,e[1]=ee):ee=e[1];const{data:ue}=pc(ee);let ie;e[2]!==ue?.data?.members?(ie=se=>se?ue?.data?.members?.find(st=>st.userId===se)?.user?.name??void 0:void 0,e[2]=ue?.data?.members,e[3]=ie):ie=e[3];const de=ie,z=H.length>=ao;let ge;e[4]!==S?(ge=S("thread.branchPicker.capReached",{max:ao}),e[4]=S,e[5]=ge):ge=e[5];const fe=ge,Le=!!r&&r===n;let oe,$,De,At,Ye,He,it,Ne,yt,Wt,ce,Ke,qe,V,_e,Ae,ye,Je,nt,xt,ot,Tt,$t,Mt,ke,Ct,Lt,Ut,ni;if(e[6]!==z||e[7]!==n||e[8]!==fe||e[9]!==W||e[10]!==Y||e[11]!==te||e[12]!==b||e[13]!==P||e[14]!==Le||e[15]!==R||e[16]!==G||e[17]!==m||e[18]!==_||e[19]!==p||e[20]!==N||e[21]!==M||e[22]!==H||e[23]!==q||e[24]!==Q||e[25]!==S||e[26]!==h||e[27]!==s||e[28]!==r){let se;e[58]!==r?(se=he=>he.branch===r,e[58]=r,e[59]=se):se=e[59];const st=H.find(se);ni=!Le&&!st&&!!r;const Oi=Le?S("thread.branchPicker.live"):st?.name??S("thread.branchPicker.defaultVersionName");ce=G?S("thread.branchPicker.localLabel"):r?Oi:S("thread.branchPicker.selectVersion");const Mh=G?"bg-special":Le?"bg-success":br(st?.color??"orange");let gs;e[60]!==W||e[61]!==_?(gs=he=>{W(),_(he),I(!1)},e[60]=W,e[61]=_,e[62]=gs):gs=e[62],qe=gs;let vs;e[63]!==S?(vs=he=>{Xe.error(he instanceof Error?he.message:S("thread.branchPicker.saveError"))},e[63]=S,e[64]=vs):vs=e[64];const Ze=vs;let bs;e[65]!==Q?(bs=he=>{Q(he),y(!1),I(!1)},e[65]=Q,e[66]=bs):bs=e[66],He=bs;let Ss;e[67]!==z||e[68]!==fe||e[69]!==W||e[70]!==Y||e[71]!==m||e[72]!==_||e[73]!==H||e[74]!==Ze||e[75]!==h?(Ss=(he,xi)=>{if(W(),m){m(he),y(!1),I(!1);return}if(!H.some(vr=>vr.branch===he)){if(z){Xe.error(fe);return}Y({branch:he,name:xi.trim()||he,color:Sr(H.length),createdBy:h,createdAt:new Date().toISOString()}).catch(Ze)}_(he),y(!1),I(!1)},e[67]=z,e[68]=fe,e[69]=W,e[70]=Y,e[71]=m,e[72]=_,e[73]=H,e[74]=Ze,e[75]=h,e[76]=Ss):Ss=e[76],it=Ss;let ws;e[77]!==z||e[78]!==fe||e[79]!==W||e[80]!==Y||e[81]!==_||e[82]!==p||e[83]!==H||e[84]!==Ze||e[85]!==S||e[86]!==h||e[87]!==s?(ws=()=>{if(z){Xe.error(fe);return}W();const he=Nn(s);Y({branch:he,name:oo(H,S("thread.branchPicker.defaultVersionName")),color:Sr(H.length),createdBy:h,createdAt:new Date().toISOString()}).catch(Ze),(p??_)(he),I(!1)},e[77]=z,e[78]=fe,e[79]=W,e[80]=Y,e[81]=_,e[82]=p,e[83]=H,e[84]=Ze,e[85]=S,e[86]=h,e[87]=s,e[88]=ws):ws=e[88],Wt=ws;let ys;e[89]===Symbol.for("react.memo_cache_sentinel")?(ys=()=>{D(null),B(""),y(!1),x("branches")},e[89]=ys):ys=e[89];const Lh=ys;let xs;e[90]===Symbol.for("react.memo_cache_sentinel")?(xs=he=>{x(he),y(!0)},e[90]=xs):xs=e[90],Ke=xs;let Cs;e[91]===Symbol.for("react.memo_cache_sentinel")?(Cs=he=>{D(he.branch),B(he.name)},e[91]=Cs):Cs=e[91],Ae=Cs;let ks;e[92]!==P||e[93]!==q||e[94]!==Ze?(ks=he=>{const xi=P.trim();xi&&q(he,xi).catch(Ze),D(null),B("")},e[92]=P,e[93]=q,e[94]=Ze,e[95]=ks):ks=e[95],V=ks;let Es;e[96]!==z||e[97]!==fe||e[98]!==Y||e[99]!==P||e[100]!==H.length||e[101]!==Ze||e[102]!==h||e[103]!==r?(Es=()=>{const he=P.trim();if(he&&r){if(z){Xe.error(fe),D(null),B("");return}Y({branch:r,name:he,color:Sr(H.length),createdBy:h,createdAt:new Date().toISOString()}).catch(Ze)}D(null),B("")},e[96]=z,e[97]=fe,e[98]=Y,e[99]=P,e[100]=H.length,e[101]=Ze,e[102]=h,e[103]=r,e[104]=Es):Es=e[104],_e=Es;let Ps;e[105]===Symbol.for("react.memo_cache_sentinel")?(Ps=()=>{D(null),B("")},e[105]=Ps):Ps=e[105],Ne=Ps;let Rs;e[106]!==n||e[107]!==te||e[108]!==M||e[109]!==qe||e[110]!==H||e[111]!==Ze||e[112]!==r?(Rs=()=>{const he=M;if(K(null),!!he){if(he.branch===r){const xi=H.find(vr=>vr.branch!==he.branch);xi?qe(xi.branch):n?qe(n):I(!1)}else I(!1);te(he.branch).catch(Ze)}},e[106]=n,e[107]=te,e[108]=M,e[109]=qe,e[110]=H,e[111]=Ze,e[112]=r,e[113]=Rs):Rs=e[113],yt=Rs,Ye=Da,Mt=N,e[114]!==b?(ke=b?void 0:he=>{he||Lh(),I(he)},e[114]=b,e[115]=ke):ke=e[115],At=bt,De=St,$t=!0,Tt="inline-flex min-w-0 shrink",$=Aa,ot=!0,oe=pe,Lt=ic.branchPicker,Ut=R?"outline":"ghost",ye=R?"sm":"default",Je=ce,nt=b;const gr=R?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[116]!==gr?(xt=le("shrink min-w-0 max-w-[220px] gap-2",gr,Ba),e[116]=gr,e[117]=xt):xt=e[117],Ct=le("h-2 w-2 shrink-0 rounded-full",r||G?Mh:"bg-muted-foreground"),e[6]=z,e[7]=n,e[8]=fe,e[9]=W,e[10]=Y,e[11]=te,e[12]=b,e[13]=P,e[14]=Le,e[15]=R,e[16]=G,e[17]=m,e[18]=_,e[19]=p,e[20]=N,e[21]=M,e[22]=H,e[23]=q,e[24]=Q,e[25]=S,e[26]=h,e[27]=s,e[28]=r,e[29]=oe,e[30]=$,e[31]=De,e[32]=At,e[33]=Ye,e[34]=He,e[35]=it,e[36]=Ne,e[37]=yt,e[38]=Wt,e[39]=ce,e[40]=Ke,e[41]=qe,e[42]=V,e[43]=_e,e[44]=Ae,e[45]=ye,e[46]=Je,e[47]=nt,e[48]=xt,e[49]=ot,e[50]=Tt,e[51]=$t,e[52]=Mt,e[53]=ke,e[54]=Ct,e[55]=Lt,e[56]=Ut,e[57]=ni}else oe=e[29],$=e[30],De=e[31],At=e[32],Ye=e[33],He=e[34],it=e[35],Ne=e[36],yt=e[37],Wt=e[38],ce=e[39],Ke=e[40],qe=e[41],V=e[42],_e=e[43],Ae=e[44],ye=e[45],Je=e[46],nt=e[47],xt=e[48],ot=e[49],Tt=e[50],$t=e[51],Mt=e[52],ke=e[53],Ct=e[54],Lt=e[55],Ut=e[56],ni=e[57];let Kt;e[118]!==Ct?(Kt=c.jsx("span",{className:Ct}),e[118]=Ct,e[119]=Kt):Kt=e[119];let Nt;e[120]!==ce?(Nt=c.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:ce}),e[120]=ce,e[121]=Nt):Nt=e[121];let Ot;e[122]!==b?(Ot=!b&&c.jsx(or,{size:12,className:"opacity-60 shrink-0"}),e[122]=b,e[123]=Ot):Ot=e[123];let qt;e[124]!==oe||e[125]!==ye||e[126]!==Je||e[127]!==nt||e[128]!==xt||e[129]!==Kt||e[130]!==Nt||e[131]!==Ot||e[132]!==Lt||e[133]!==Ut?(qt=c.jsxs(oe,{"data-tour":Lt,variant:Ut,size:ye,"aria-label":Je,disabled:nt,className:xt,children:[Kt,Nt,Ot]}),e[124]=oe,e[125]=ye,e[126]=Je,e[127]=nt,e[128]=xt,e[129]=Kt,e[130]=Nt,e[131]=Ot,e[132]=Lt,e[133]=Ut,e[134]=qt):qt=e[134];let It;e[135]!==$||e[136]!==ot||e[137]!==qt?(It=c.jsx($,{asChild:ot,children:qt}),e[135]=$,e[136]=ot,e[137]=qt,e[138]=It):It=e[138];let Vt;e[139]!==Tt||e[140]!==It?(Vt=c.jsx("span",{className:Tt,children:It}),e[139]=Tt,e[140]=It,e[141]=Vt):Vt=e[141];let jt;e[142]!==De||e[143]!==$t||e[144]!==Vt?(jt=c.jsx(De,{asChild:$t,children:Vt}),e[142]=De,e[143]=$t,e[144]=Vt,e[145]=jt):jt=e[145];let Yt;e[146]!==ce?(Yt=c.jsx(wt,{children:ce}),e[146]=ce,e[147]=Yt):Yt=e[147];let Ht;e[148]!==At||e[149]!==jt||e[150]!==Yt?(Ht=c.jsxs(At,{children:[jt,Yt]}),e[148]=At,e[149]=jt,e[150]=Yt,e[151]=Ht):Ht=e[151];let fi;e[152]===Symbol.for("react.memo_cache_sentinel")?(fi=se=>{se.preventDefault(),F.current?.scrollIntoView({block:"nearest"})},e[152]=fi):fi=e[152];let Gt;e[153]!==w||e[154]!==S?(Gt=w&&c.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:S("thread.branchPicker.newChatHint")}),e[153]=w,e[154]=S,e[155]=Gt):Gt=e[155];let kt;e[156]!==He||e[157]!==it||e[158]!==L||e[159]!==E||e[160]!==z||e[161]!==Ne||e[162]!==fe||e[163]!==W||e[164]!==Wt||e[165]!==de||e[166]!==P||e[167]!==A||e[168]!==G||e[169]!==J||e[170]!==N||e[171]!==Ke||e[172]!==o||e[173]!==a||e[174]!==u||e[175]!==qe||e[176]!==H||e[177]!==d||e[178]!==f||e[179]!==V||e[180]!==_e||e[181]!==Ae||e[182]!==S||e[183]!==l||e[184]!==ni||e[185]!==h||e[186]!==r?(kt=L?c.jsx(md,{orgId:o,orgSlug:a,userId:h,target:l,owner:u,repo:d,sandboxMap:f,enabled:N,tab:E,onTabChange:x,localUrl:J,onSaveLocal:He,onBack:()=>y(!1),onAdopt:it}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"always-scrollbar flex max-h-[min(50vh,20rem)] flex-col overflow-y-auto",children:[G&&J&&c.jsx(pd,{rowRef:F,url:J,onSelect:()=>Ke("local"),onEdit:()=>Ke("local"),onTurnOff:()=>W()}),ni&&r&&(A===r?c.jsx(po,{value:P,onChange:B,onSave:_e,onCancel:Ne}):c.jsx(mo,{rowRef:G?void 0:F,dot:br("orange"),label:S("thread.branchPicker.defaultVersionName"),branch:r,selected:!G,onSelect:()=>qe(r),onRename:()=>{D(r),B(oo(H,S("thread.branchPicker.defaultVersionName")))}})),H.map(se=>A===se.branch?c.jsx(po,{value:P,onChange:B,onSave:()=>V(se.branch),onCancel:Ne},se.branch):c.jsx(mo,{rowRef:!G&&se.branch===r?F:void 0,dot:br(se.color),label:se.name,creator:de(se.createdBy),branch:se.branch,selected:!G&&se.branch===r,onSelect:()=>qe(se.branch),onRename:()=>Ae(se),onDelete:()=>K(se)},se.branch))]}),(ni||H.length>0)&&c.jsx("div",{className:"my-1 border-t"}),c.jsxs("button",{type:"button",onClick:()=>{Wt()},disabled:z,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:[c.jsx(Mn,{className:"h-4 w-4 shrink-0"}),S("thread.branchPicker.newVersion")]}),z&&c.jsx("p",{className:"px-2 pb-1 pt-0.5 text-xs text-warning",children:fe}),c.jsxs("button",{type:"button",onClick:()=>Ke("branches"),className:"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",children:[S("thread.branchPicker.advanced"),c.jsx(Ea,{className:"h-4 w-4 shrink-0"})]})]}),e[156]=He,e[157]=it,e[158]=L,e[159]=E,e[160]=z,e[161]=Ne,e[162]=fe,e[163]=W,e[164]=Wt,e[165]=de,e[166]=P,e[167]=A,e[168]=G,e[169]=J,e[170]=N,e[171]=Ke,e[172]=o,e[173]=a,e[174]=u,e[175]=qe,e[176]=H,e[177]=d,e[178]=f,e[179]=V,e[180]=_e,e[181]=Ae,e[182]=S,e[183]=l,e[184]=ni,e[185]=h,e[186]=r,e[187]=kt):kt=e[187];let Xt;e[188]!==Gt||e[189]!==kt?(Xt=c.jsxs(Ta,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:fi,children:[Gt,kt]}),e[188]=Gt,e[189]=kt,e[190]=Xt):Xt=e[190];let oi;e[191]!==Ye||e[192]!==Mt||e[193]!==ke||e[194]!==Ht||e[195]!==Xt?(oi=c.jsxs(Ye,{open:Mt,onOpenChange:ke,children:[Ht,Xt]}),e[191]=Ye,e[192]=Mt,e[193]=ke,e[194]=Ht,e[195]=Xt,e[196]=oi):oi=e[196];const wi=oi,yi=M!==null;let _i;e[197]===Symbol.for("react.memo_cache_sentinel")?(_i=se=>{se||K(null)},e[197]=_i):_i=e[197];let at;e[198]!==S?(at=S("thread.branchPicker.deleteTitle"),e[198]=S,e[199]=at):at=e[199];let lt;e[200]!==at?(lt=c.jsx(Ma,{children:at}),e[200]=at,e[201]=lt):lt=e[201];let ht;e[202]!==M||e[203]!==S?(ht=M&&S("thread.branchPicker.deleteConfirm",{name:M.name}),e[202]=M,e[203]=S,e[204]=ht):ht=e[204];let ct;e[205]!==ht?(ct=c.jsx(La,{children:ht}),e[205]=ht,e[206]=ct):ct=e[206];let dt;e[207]!==lt||e[208]!==ct?(dt=c.jsxs(Na,{children:[lt,ct]}),e[207]=lt,e[208]=ct,e[209]=dt):dt=e[209];let ut;e[210]!==S?(ut=S("thread.branchPicker.cancel"),e[210]=S,e[211]=ut):ut=e[211];let ft;e[212]!==ut?(ft=c.jsx(Oa,{children:ut}),e[212]=ut,e[213]=ft):ft=e[213];let _t;e[214]!==S?(_t=S("thread.branchPicker.delete"),e[214]=S,e[215]=_t):_t=e[215];let pt;e[216]!==yt||e[217]!==_t?(pt=c.jsx(Ia,{onClick:yt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:_t}),e[216]=yt,e[217]=_t,e[218]=pt):pt=e[218];let Ft;e[219]!==ft||e[220]!==pt?(Ft=c.jsxs(ja,{children:[ft,pt]}),e[219]=ft,e[220]=pt,e[221]=Ft):Ft=e[221];let ae;e[222]!==dt||e[223]!==Ft?(ae=c.jsxs(Ha,{children:[dt,Ft]}),e[222]=dt,e[223]=Ft,e[224]=ae):ae=e[224];let ve;e[225]!==yi||e[226]!==ae?(ve=c.jsx(Fa,{open:yi,onOpenChange:_i,children:ae}),e[225]=yi,e[226]=ae,e[227]=ve):ve=e[227];let Se;return e[228]!==wi||e[229]!==ve?(Se=c.jsxs(c.Fragment,{children:[wi,ve]}),e[228]=wi,e[229]=ve,e[230]=Se):Se=e[230],Se}function po(t){const e=U.c(20),{value:i,onChange:s,onSave:r,onCancel:n}=t,o=Be();let a;e[0]!==o?(a=o("thread.branchPicker.rename"),e[0]=o,e[1]=a):a=e[1];let h;e[2]!==s?(h=p=>s(p.target.value),e[2]=s,e[3]=h):h=e[3];let l;e[4]!==n||e[5]!==r?(l=p=>{p.key==="Enter"&&r(),p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),n())},e[4]=n,e[5]=r,e[6]=l):l=e[6];let u;e[7]!==a||e[8]!==h||e[9]!==l||e[10]!==i?(u=c.jsx("input",{autoFocus:!0,"aria-label":a,value:i,onChange:h,onKeyDown:l,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),e[7]=a,e[8]=h,e[9]=l,e[10]=i,e[11]=u):u=e[11];let d;e[12]!==o?(d=o("thread.branchPicker.save"),e[12]=o,e[13]=d):d=e[13];let f;e[14]!==r||e[15]!==d?(f=c.jsx(pe,{size:"sm",onClick:r,children:d}),e[14]=r,e[15]=d,e[16]=f):f=e[16];let _;return e[17]!==u||e[18]!==f?(_=c.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[u,f]}),e[17]=u,e[18]=f,e[19]=_):_=e[19],_}function mo(t){const e=U.c(49),{rowRef:i,dot:s,label:r,creator:n,branch:o,selected:a,onSelect:h,onRename:l,onDelete:u}=t,d=Be(),f=a?"bg-accent":"hover:bg-accent/60";let _;e[0]!==f?(_=le("group flex items-center rounded-lg",f),e[0]=f,e[1]=_):_=e[1];let p;e[2]!==s?(p=le("h-2 w-2 shrink-0 rounded-full",s),e[2]=s,e[3]=p):p=e[3];let m;e[4]!==p?(m=c.jsx("span",{className:p}),e[4]=p,e[5]=m):m=e[5];let g;e[6]!==n?(g=n&&c.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:n}),e[6]=n,e[7]=g):g=e[7];let v;e[8]!==r||e[9]!==g?(v=c.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[r,g]}),e[8]=r,e[9]=g,e[10]=v):v=e[10];let k;e[11]!==h||e[12]!==a||e[13]!==m||e[14]!==v?(k=c.jsx(St,{asChild:!0,children:c.jsxs("button",{type:"button","aria-pressed":a,onClick:h,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[m,v]})}),e[11]=h,e[12]=a,e[13]=m,e[14]=v,e[15]=k):k=e[15];let b;e[16]!==o||e[17]!==d?(b=d("thread.branchPicker.branchTooltip",{branch:o}),e[16]=o,e[17]=d,e[18]=b):b=e[18];let w;e[19]!==b?(w=c.jsx(wt,{side:"bottom",className:"font-mono text-xs",children:b}),e[19]=b,e[20]=w):w=e[20];let C;e[21]!==k||e[22]!==w?(C=c.jsxs(bt,{children:[k,w]}),e[21]=k,e[22]=w,e[23]=C):C=e[23];let S;e[24]!==d?(S=d("thread.branchPicker.moreActions"),e[24]=d,e[25]=S):S=e[25];let R;e[26]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(Ka,{className:"h-4 w-4"}),e[26]=R):R=e[26];let N;e[27]!==S?(N=c.jsx(cs,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"icon","aria-label":S,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:R})}),e[27]=S,e[28]=N):N=e[28];let I;e[29]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsx(qa,{className:"h-4 w-4"}),e[29]=I):I=e[29];let L;e[30]!==d?(L=d("thread.branchPicker.rename"),e[30]=d,e[31]=L):L=e[31];let y;e[32]!==l||e[33]!==L?(y=c.jsxs(Ai,{onSelect:l,children:[I,L]}),e[32]=l,e[33]=L,e[34]=y):y=e[34];let E;e[35]!==u||e[36]!==d?(E=u&&c.jsxs(Ai,{onSelect:u,className:"text-destructive focus:text-destructive",children:[c.jsx(lr,{className:"h-4 w-4"}),d("thread.branchPicker.delete")]}),e[35]=u,e[36]=d,e[37]=E):E=e[37];let x;e[38]!==y||e[39]!==E?(x=c.jsxs(ds,{align:"end",children:[y,E]}),e[38]=y,e[39]=E,e[40]=x):x=e[40];let A;e[41]!==N||e[42]!==x?(A=c.jsxs(us,{children:[N,x]}),e[41]=N,e[42]=x,e[43]=A):A=e[43];let D;return e[44]!==i||e[45]!==C||e[46]!==A||e[47]!==_?(D=c.jsxs("div",{ref:i,className:_,children:[C,A]}),e[44]=i,e[45]=C,e[46]=A,e[47]=_,e[48]=D):D=e[48],D}function pd(t){const e=U.c(40),{rowRef:i,url:s,onSelect:r,onEdit:n,onTurnOff:o}=t,a=Be();let h;try{let y;e[0]!==s?(y=new URL(s),e[0]=s,e[1]=y):y=e[1],h=y.host}catch{h=s}const l=h;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-special"}),e[2]=u):u=e[2];let d;e[3]!==a?(d=a("thread.branchPicker.localLabel"),e[3]=a,e[4]=d):d=e[4];let f;e[5]!==l?(f=c.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:l}),e[5]=l,e[6]=f):f=e[6];let _;e[7]!==d||e[8]!==f?(_=c.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[d,f]}),e[7]=d,e[8]=f,e[9]=_):_=e[9];let p;e[10]!==r||e[11]!==_?(p=c.jsxs("button",{type:"button","aria-pressed":!0,onClick:r,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[u,_]}),e[10]=r,e[11]=_,e[12]=p):p=e[12];let m;e[13]!==a?(m=a("thread.branchPicker.moreActions"),e[13]=a,e[14]=m):m=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx(Ka,{className:"h-4 w-4"}),e[15]=g):g=e[15];let v;e[16]!==m?(v=c.jsx(cs,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"icon","aria-label":m,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:g})}),e[16]=m,e[17]=v):v=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(qa,{className:"h-4 w-4"}),e[18]=k):k=e[18];let b;e[19]!==a?(b=a("thread.branchPicker.rename"),e[19]=a,e[20]=b):b=e[20];let w;e[21]!==n||e[22]!==b?(w=c.jsxs(Ai,{onSelect:n,children:[k,b]}),e[21]=n,e[22]=b,e[23]=w):w=e[23];let C;e[24]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(lr,{className:"h-4 w-4"}),e[24]=C):C=e[24];let S;e[25]!==a?(S=a("thread.branchPicker.localTurnOff"),e[25]=a,e[26]=S):S=e[26];let R;e[27]!==o||e[28]!==S?(R=c.jsxs(Ai,{onSelect:o,className:"text-destructive focus:text-destructive",children:[C,S]}),e[27]=o,e[28]=S,e[29]=R):R=e[29];let N;e[30]!==w||e[31]!==R?(N=c.jsxs(ds,{align:"end",children:[w,R]}),e[30]=w,e[31]=R,e[32]=N):N=e[32];let I;e[33]!==N||e[34]!==v?(I=c.jsxs(us,{children:[v,N]}),e[33]=N,e[34]=v,e[35]=I):I=e[35];let L;return e[36]!==i||e[37]!==I||e[38]!==p?(L=c.jsxs("div",{ref:i,className:"group flex items-center rounded-lg bg-accent",children:[p,I]}),e[36]=i,e[37]=I,e[38]=p,e[39]=L):L=e[39],L}function md(t){const e=U.c(73),{orgId:i,orgSlug:s,userId:r,target:n,owner:o,repo:a,sandboxMap:h,enabled:l,tab:u,onTabChange:d,localUrl:f,onSaveLocal:_,onBack:p,onAdopt:m}=t,g=Be(),[v,k]=X.useState(""),b=u==="branches"?v:"",w=l&&u==="branches";let C;e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==h||e[5]!==b||e[6]!==w||e[7]!==n||e[8]!==r?(C={orgId:i,orgSlug:s,userId:r,target:n,sandboxMap:h,owner:o,repo:a,search:b,enabled:w},e[0]=i,e[1]=s,e[2]=o,e[3]=a,e[4]=h,e[5]=b,e[6]=w,e[7]=n,e[8]=r,e[9]=C):C=e[9];const{recent:S,yours:R,others:N,isLoading:I,hasMore:L,isFetchingMore:y,fetchMore:E}=ud(C),x=l&&u==="prs";let A;e[10]!==i||e[11]!==s||e[12]!==o||e[13]!==a||e[14]!==x||e[15]!==n?(A={orgId:i,orgSlug:s,target:n,owner:o,repo:a,enabled:x},e[10]=i,e[11]=s,e[12]=o,e[13]=a,e[14]=x,e[15]=n,e[16]=A):A=e[16];const{data:D,isLoading:P}=Cc(A);let B;if(e[17]!==E||e[18]!==L||e[19]!==y||e[20]!==I||e[21]!==f||e[22]!==m||e[23]!==p||e[24]!==_||e[25]!==d||e[26]!==N||e[27]!==o||e[28]!==P||e[29]!==S||e[30]!==a||e[31]!==v||e[32]!==g||e[33]!==D||e[34]!==u||e[35]!==R){const M=D===void 0?[]:D,K=`${o}/${a}`;let F;e[37]!==K?(F=K.toLowerCase(),e[37]=K,e[38]=F):F=e[38];const H=F;let Y;e[39]!==H?(Y=$=>$.headRepoFullName?.toLowerCase()===H,e[39]=H,e[40]=Y):Y=e[40];const q=M.filter(Y);let te;if(e[41]!==N||e[42]!==S||e[43]!==R){const $=new Set;te=[...S,...R,...N].filter(De=>$.has(De.name)?!1:($.add(De.name),!0)),e[41]=N,e[42]=S,e[43]=R,e[44]=te}else te=e[44];const J=te;let Q;e[45]===Symbol.for("react.memo_cache_sentinel")?(Q=c.jsx(lc,{className:"h-4 w-4 shrink-0"}),e[45]=Q):Q=e[45];let W;e[46]!==g?(W=g("thread.branchPicker.advancedBack"),e[46]=g,e[47]=W):W=e[47];let G;e[48]!==p||e[49]!==W?(G=c.jsxs("button",{type:"button",onClick:p,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[Q,W]}),e[48]=p,e[49]=W,e[50]=G):G=e[50];let ee;e[51]!==d?(ee=$=>{d($),k("")},e[51]=d,e[52]=ee):ee=e[52];let ue;e[53]!==g?(ue=g("thread.branchPicker.branchesTab"),e[53]=g,e[54]=ue):ue=e[54];let ie;e[55]!==ue?(ie=c.jsx(Pi,{value:"branches",className:"h-6 px-2.5 text-xs",children:ue}),e[55]=ue,e[56]=ie):ie=e[56];let de;e[57]!==g?(de=g("thread.branchPicker.prsTab"),e[57]=g,e[58]=de):de=e[58];let z;e[59]!==de?(z=c.jsx(Pi,{value:"prs",className:"h-6 px-2.5 text-xs",children:de}),e[59]=de,e[60]=z):z=e[60];let ge;e[61]!==g?(ge=g("thread.branchPicker.localTab"),e[61]=g,e[62]=ge):ge=e[62];let fe;e[63]!==ge?(fe=c.jsx(Pi,{value:"local",className:"h-6 px-2.5 text-xs",children:ge}),e[63]=ge,e[64]=fe):fe=e[64];let Le;e[65]!==ie||e[66]!==z||e[67]!==fe?(Le=c.jsxs(za,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[ie,z,fe]}),e[65]=ie,e[66]=z,e[67]=fe,e[68]=Le):Le=e[68];let oe;e[69]!==ee||e[70]!==Le||e[71]!==u?(oe=c.jsx(Wa,{className:"px-2 pt-2 pb-1",value:u,onValueChange:ee,children:Le}),e[69]=ee,e[70]=Le,e[71]=u,e[72]=oe):oe=e[72],B=c.jsxs("div",{className:"flex flex-col",children:[G,oe,u==="local"?c.jsx(vd,{url:f,onSave:_}):c.jsxs(rc,{filter:u==="branches"?gd:void 0,children:[c.jsx(nc,{placeholder:g(u==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),value:v,onValueChange:k}),c.jsx(oc,{onScroll:$=>{const De=$.currentTarget;u==="branches"&&De.scrollHeight-De.scrollTop-De.clientHeight<48&&E()},children:u==="branches"?c.jsxs(c.Fragment,{children:[I&&c.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:g("thread.branchPicker.loadingMore")}),!I&&J.length===0&&c.jsx(so,{children:g("thread.branchPicker.noBranchesFound")}),J.length>0&&c.jsx(ro,{children:J.map($=>c.jsxs(no,{value:$.name,className:"cursor-pointer",onSelect:()=>m($.name,$.name),children:[c.jsx(Nh,{className:"mr-2 h-4 w-4 shrink-0"}),c.jsx("span",{className:"flex-1 truncate",children:$.name})]},$.name))}),L&&c.jsx("div",{className:"p-2",children:c.jsx(pe,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:y,onClick:E,children:g(y?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):c.jsxs(c.Fragment,{children:[P&&c.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:g("thread.branchPicker.loadingPullRequests")}),!P&&q.length===0&&c.jsx(so,{children:g("thread.branchPicker.noOpenPullRequests")}),q.length>0&&c.jsx(ro,{children:q.map($=>c.jsxs(no,{value:`#${$.number} ${$.title} ${$.head}`,className:"cursor-pointer",onSelect:()=>m($.head,_o($.title)),children:[c.jsx(ar,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsx("span",{className:"truncate",children:_o($.title)}),c.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",$.number," · ",$.head]})]})]},$.number))})]})})]})]}),e[17]=E,e[18]=L,e[19]=y,e[20]=I,e[21]=f,e[22]=m,e[23]=p,e[24]=_,e[25]=d,e[26]=N,e[27]=o,e[28]=P,e[29]=S,e[30]=a,e[31]=v,e[32]=g,e[33]=D,e[34]=u,e[35]=R,e[36]=B}else B=e[36];return B}function gd(t,e){return zr(t,e)?1:0}function vd(t){const e=U.c(39),{url:i,onSave:s}=t,r=Be(),[n,o]=X.useState(i??"");let a;e[0]!==n?(a=n.trim(),e[0]=n,e[1]=a):a=e[1];const h=a;let l;e[2]!==s||e[3]!==h?(l=()=>s(h?uc(h):null),e[2]=s,e[3]=h,e[4]=l):l=e[4];const u=l;let d;e[5]!==r?(d=r("thread.branchPicker.localHint"),e[5]=r,e[6]=d):d=e[6];let f;e[7]!==d?(f=c.jsx("p",{className:"text-xs text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let _;e[9]!==r?(_=r("thread.branchPicker.localUrlLabel"),e[9]=r,e[10]=_):_=e[10];let p;e[11]!==r?(p=r("thread.branchPicker.localUrlPlaceholder"),e[11]=r,e[12]=p):p=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=N=>o(N.target.value),e[13]=m):m=e[13];let g;e[14]!==u||e[15]!==h?(g=N=>{N.key==="Enter"&&h&&u()},e[14]=u,e[15]=h,e[16]=g):g=e[16];let v;e[17]!==_||e[18]!==p||e[19]!==g||e[20]!==n?(v=c.jsx("input",{type:"url",inputMode:"url","aria-label":_,placeholder:p,value:n,onChange:m,onKeyDown:g,className:"h-8 w-full rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),e[17]=_,e[18]=p,e[19]=g,e[20]=n,e[21]=v):v=e[21];let k;e[22]!==s||e[23]!==r||e[24]!==i?(k=i?c.jsx(pe,{variant:"ghost",size:"sm",className:"text-xs text-destructive hover:text-destructive",onClick:()=>s(null),children:r("thread.branchPicker.localTurnOff")}):c.jsx("span",{}),e[22]=s,e[23]=r,e[24]=i,e[25]=k):k=e[25];const b=!h;let w;e[26]!==r?(w=r("thread.branchPicker.save"),e[26]=r,e[27]=w):w=e[27];let C;e[28]!==u||e[29]!==b||e[30]!==w?(C=c.jsx(pe,{size:"sm",disabled:b,onClick:u,children:w}),e[28]=u,e[29]=b,e[30]=w,e[31]=C):C=e[31];let S;e[32]!==k||e[33]!==C?(S=c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[k,C]}),e[32]=k,e[33]=C,e[34]=S):S=e[34];let R;return e[35]!==S||e[36]!==f||e[37]!==v?(R=c.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[f,v,S]}),e[35]=S,e[36]=f,e[37]=v,e[38]=R):R=e[38],R}function bd(t){const e=U.c(17),{locked:i,placement:s,value:r,virtualMcpId:n,userLabel:o,baseBranch:a,onChange:h,onCreateBranch:l,onAdoptBranch:u,orgId:d,orgSlug:f,userId:_,target:p,owner:m,repo:g,sandboxMap:v}=t;let k;return e[0]!==a||e[1]!==i||e[2]!==u||e[3]!==h||e[4]!==l||e[5]!==d||e[6]!==f||e[7]!==m||e[8]!==s||e[9]!==g||e[10]!==v||e[11]!==p||e[12]!==_||e[13]!==o||e[14]!==r||e[15]!==n?(k=c.jsx(_d,{virtualMcpId:n,userLabel:o,value:r,baseBranch:a,orgId:d,orgSlug:f,userId:_,target:p,owner:m,repo:g,sandboxMap:v,onChange:h,onCreateBranch:l,onAdoptBranch:u,spawnsNewChat:i,placement:s}),e[0]=a,e[1]=i,e[2]=u,e[3]=h,e[4]=l,e[5]=d,e[6]=f,e[7]=m,e[8]=s,e[9]=g,e[10]=v,e[11]=p,e[12]=_,e[13]=o,e[14]=r,e[15]=n,e[16]=k):k=e[16],k}function Sd(t){const e=U.c(2),{branchPill:i}=t;if(!i)return null;let s;return e[0]!==i?(s=c.jsx(c.Fragment,{children:i}),e[0]=i,e[1]=s):s=e[1],s}function wd(t){const e=U.c(21),{virtualMcp:i,currentBranch:s}=t,r=ec(),n=Wi();let o;e[0]!==r?.messages||e[1]!==n?.isThreadLocked?(o=(r?.messages??[]).length>0||(n?.isThreadLocked??!1),e[0]=r?.messages,e[1]=n?.isThreadLocked,e[2]=o):o=e[2];const a=o,h=n?.setCurrentTaskBranch,l=n?.createTask;let u;e[3]!==n?.activeTask?.metadata||e[4]!==i?.metadata?(u=fc(i?.metadata)==="cms"&&_c(n?.activeTask?.metadata,i?.metadata)==="sandbox",e[3]=n?.activeTask?.metadata,e[4]=i?.metadata,e[5]=u):u=e[5];const d=u,f=Sc(i),_=Bt(f),{data:p}=sr.useSession(),m=p?.user;let g;e[6]!==m?(g=On(m),e[6]=m,e[7]=g):g=e[7];const v=g,k=p?.user?.id??"",{org:b}=rr(),w=kc(i,s);let C;e[8]!==l||e[9]!==a||e[10]!==h?(C=x=>{a&&l?l({branch:x}):h&&h(x)},e[8]=l,e[9]=a,e[10]=h,e[11]=C):C=e[11];const S=C;let R;e[12]!==d||e[13]!==l||e[14]!==a||e[15]!==h?(R=x=>{(a||d)&&l?l({branch:x}):h&&h(x)},e[12]=d,e[13]=l,e[14]=a,e[15]=h,e[16]=R):R=e[16];const N=R;let I;e[17]!==l?(I=l?x=>l({runtime:"sandbox",branch:x}):void 0,e[17]=l,e[18]=I):I=e[18];const L=I,y=f&&Ga(_)?c.jsx(bd,{userLabel:v,virtualMcpId:i?.id??"",value:s,baseBranch:w,orgId:b.id,orgSlug:b.slug,userId:k,target:_,owner:f.owner,repo:f.name,sandboxMap:i?.metadata?.sandboxMap,onChange:S,onCreateBranch:N,onAdoptBranch:L,locked:a,placement:"chat"},`${Xa(_)}:${f.owner}/${f.name}`):null;let E;return e[19]!==y?(E=c.jsx(Sd,{branchPill:y}),e[19]=y,e[20]=E):E=e[20],E}const yd=Oh("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 xd(t){const e=U.c(11);let i,s,r;e[0]!==t?({className:i,orientation:s,...r}=t,e[0]=t,e[1]=i,e[2]=s,e[3]=r):(i=e[1],s=e[2],r=e[3]);let n;e[4]!==i||e[5]!==s?(n=le(yd({orientation:s}),i),e[4]=i,e[5]=s,e[6]=n):n=e[6];let o;return e[7]!==s||e[8]!==r||e[9]!==n?(o=c.jsx("div",{role:"group","data-slot":"button-group","data-orientation":s,className:n,...r}),e[7]=s,e[8]=r,e[9]=n,e[10]=o):o=e[10],o}function Cd(t){const e=U.c(14),{item:i}=t;let s;e[0]!==i?(s=()=>{i.onSelect()},e[0]=i,e[1]=s):s=e[1];let r;e[2]!==i.disabled||e[3]!==i.icon||e[4]!==i.label||e[5]!==s?(r=c.jsxs(Ai,{disabled:i.disabled,onSelect:s,children:[i.icon,i.label]}),e[2]=i.disabled,e[3]=i.icon,e[4]=i.label,e[5]=s,e[6]=r):r=e[6];const n=r;if(!i.tooltip)return n;let o;e[7]!==n?(o=c.jsx(St,{asChild:!0,children:n}),e[7]=n,e[8]=o):o=e[8];let a;e[9]!==i.tooltip?(a=c.jsx(wt,{side:"right",children:i.tooltip}),e[9]=i.tooltip,e[10]=a):a=e[10];let h;return e[11]!==o||e[12]!==a?(h=c.jsxs(bt,{children:[o,a]}),e[11]=o,e[12]=a,e[13]=h):h=e[13],h}function Sl(t){const e=U.c(20),{label:i,onClick:s,variant:r,size:n,disabled:o,loading:a,pulse:h,tooltip:l,icon:u,items:d,menuAriaLabel:f,className:_}=t,p=r===void 0?"default":r,m=n===void 0?"default":n,g=o===void 0?!1:o,v=a===void 0?!1:a,k=h===void 0?!1:h,b=(d?.length??0)>0;let w;if(e[0]!==_||e[1]!==g||e[2]!==b||e[3]!==u||e[4]!==d||e[5]!==i||e[6]!==v||e[7]!==f||e[8]!==s||e[9]!==k||e[10]!==m||e[11]!==l||e[12]!==p){const C=le(Ba,p==="default"&&"focus-visible:inset-ring-current");let S;e[14]!==u||e[15]!==v?(S=v?c.jsx(rs,{size:"xs"}):u,e[14]=u,e[15]=v,e[16]=S):S=e[16];const R=c.jsxs(pe,{type:"button",variant:p,size:m,disabled:g,"aria-busy":v||void 0,onClick:v?void 0:s,className:le(C,b&&"rounded-r-none border-r border-current/20"),children:[S,i]}),N=k&&"animate-pulse-brightness motion-reduce:animate-none motion-reduce:opacity-80";let I;e[17]!==_||e[18]!==N?(I=le(N,_),e[17]=_,e[18]=N,e[19]=I):I=e[19],w=c.jsxs(xd,{className:I,children:[l?c.jsxs(bt,{children:[c.jsx(St,{asChild:!0,children:c.jsx("span",{className:le("inline-flex rounded-lg outline-none",C,g&&"cursor-not-allowed"),tabIndex:g?0:void 0,role:g?"button":void 0,"aria-disabled":g||void 0,children:R})}),c.jsx(wt,{children:l})]}):R,b?c.jsxs(us,{children:[c.jsx(cs,{asChild:!0,children:c.jsx(pe,{type:"button",variant:p,size:m,"aria-label":f,className:le("has-[>svg]:px-2",C),children:c.jsx(or,{className:"size-3.5"})})}),c.jsx(ds,{align:"end",children:d?.map(kd)})]}):null]}),e[0]=_,e[1]=g,e[2]=b,e[3]=u,e[4]=d,e[5]=i,e[6]=v,e[7]=f,e[8]=s,e[9]=k,e[10]=m,e[11]=l,e[12]=p,e[13]=w}else w=e[13];return w}function kd(t){return c.jsx(Cd,{item:t},t.key)}function wl(t){return ur({userName:t?.name,userEmail:t?.email})??void 0}function Fn(t){const e=U.c(18),{state:i,header:s,body:r,note:n,gate:o,footer:a}=t,h=i!=="ready";let l;e[0]!==s?(l=c.jsx("div",{className:"space-y-0.5 px-4 py-3",children:s}),e[0]=s,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("div",{className:"border-t"}),e[2]=u):u=e[2];let d;e[3]!==n?(d=n?c.jsx("div",{className:"space-y-1.5 border-t px-4 py-3",children:n}):null,e[3]=n,e[4]=d):d=e[4];let f;e[5]!==r||e[6]!==d?(f=c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r,d]}),e[5]=r,e[6]=d,e[7]=f):f=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx("div",{className:"border-t"}),e[8]=_):_=e[8];let p;e[9]!==a?(p=c.jsx("div",{className:"space-y-2 px-4 py-3",children:a}),e[9]=a,e[10]=p):p=e[10];let m;return e[11]!==o||e[12]!==i||e[13]!==h||e[14]!==l||e[15]!==f||e[16]!==p?(m=c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-publish-state":i,"aria-busy":h,children:[l,u,f,o,_,p]}),e[11]=o,e[12]=i,e[13]=h,e[14]=l,e[15]=f,e[16]=p,e[17]=m):m=e[17],m}function Wr(t){const e=U.c(2),{children:i}=t;let s;return e[0]!==i?(s=c.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:i}),e[0]=i,e[1]=s):s=e[1],s}function yl(t){const e=U.c(10);let i,s,r;e[0]!==t?({className:s,children:i,...r}=t,e[0]=t,e[1]=i,e[2]=s,e[3]=r):(i=e[1],s=e[2],r=e[3]);let n;e[4]!==s?(n=le("rounded-lg border bg-card px-3 py-2.5",s),e[4]=s,e[5]=n):n=e[5];let o;return e[6]!==i||e[7]!==r||e[8]!==n?(o=c.jsx("div",{className:n,...r,children:i}),e[6]=i,e[7]=r,e[8]=n,e[9]=o):o=e[9],o}function ti(t){const e=U.c(4),{className:i}=t;let s;e[0]!==i?(s=le("animate-pulse rounded bg-muted motion-reduce:animate-none",i),e[0]=i,e[1]=s):s=e[1];let r;return e[2]!==s?(r=c.jsx("div",{className:s}),e[2]=s,e[3]=r):r=e[3],r}function is(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(yl,{children:c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(ti,{className:"size-4 rounded-md"}),c.jsx(ti,{className:"h-3 w-24"}),c.jsx(ti,{className:"h-2.5 w-16"}),c.jsx(ti,{className:"ml-auto size-6 rounded"})]})}),t[0]=e):e=t[0],e}async function Ed(t,e,i){const s=ur(i.coAuthor),{changeRequest:r}=await Tn(t,"CHANGE_REQUEST_OPEN",{...e,head:i.branch,base:i.base,title:i.title,body:rd(i.body,s)||void 0});return{number:r.number,htmlUrl:r.url}}class xl extends Error{reason;detail;constructor(e,i){super(i||`Merge refused: ${e}`),this.name="ChangeRequestMergeRefused",this.reason=e,this.detail=i}}async function Cl(t,e,i){const s=ur(i.coAuthor),r=s?bl(i.commitMessage?.trim()??"",s):i.commitMessage?.trim()||void 0,n=await Tn(t,"CHANGE_REQUEST_MERGE",{...e,number:i.number,strategy:"squash",commitTitle:i.commitTitle,commitMessage:r});if(!n.merged)throw new xl(n.reason??"error",n.detail)}function Pd(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 $r extends Error{constructor(){super("The branch changed since these changes were shown"),this.name="PublishHeadMovedError"}}class zn extends Error{constructor(e,i,s){super(e),this.step=i,this.pr=s,this.name="PublishStepError"}step;pr}const qs=255;function kl(t){if(t.length<=qs)return t;const e=t.slice(0,qs-1),i=e.lastIndexOf(" ");return`${(i>0?e.slice(0,i):e).trimEnd()}…`}function Rd(t){const e=t.title.trim(),i=t.body.trim(),s=[e,i].filter(Boolean).join(`
5
+ ${r}`:r}function rd(t,e){const i=t?.trim();return i?bl(i,e):i||void 0}const nd=["dev","start"],od={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},fo=1114111;function _o(t){return t?t.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,(e,i)=>{if(i.startsWith("#x")||i.startsWith("#X")){const s=Number.parseInt(i.slice(2),16);return!Number.isFinite(s)||s>fo?e:String.fromCodePoint(s)}if(i.startsWith("#")){const s=Number.parseInt(i.slice(1),10);return!Number.isFinite(s)||s>fo?e:String.fromCodePoint(s)}return od[i]??e}):""}const ad=10080*60*1e3;function ld({sandboxMap:t,userId:e,rawBranches:i,now:s}){const r=new Map;for(const[d,f]of Object.entries(t??{}))for(const[_,p]of Object.entries(f??{})){let m=r.get(_);m||(m={userIds:new Set,lastActiveAt:0},r.set(_,m)),m.userIds.add(d);for(const g of Object.values(p??{})){const v=g?.createdAt??0;v>m.lastActiveAt&&(m.lastActiveAt=v)}}const n=s-ad,o=[...r.entries()].filter(([,d])=>d.lastActiveAt>=n).sort((d,f)=>f[1].lastActiveAt-d[1].lastActiveAt).map(([d,f])=>({name:d,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),a=new Set(o.map(d=>d.name)),h=new Set(Object.keys(t?.[e]??{})),l=[...h].filter(d=>!a.has(d)).sort().map(d=>({name:d,source:"yours"})),u=i.filter(d=>!h.has(d.name)&&!a.has(d.name)).map(d=>({name:d.name,source:"other",author:d.author??null}));return{recent:o,yours:l,others:u}}const hd=100,cd=50,dd=300;function zr(t,e){const i=e.trim().toLowerCase();return i?t.toLowerCase().includes(i):!0}function ud(t){const e=U.c(39),{orgId:i,orgSlug:s,userId:r,target:n,sandboxMap:o,owner:a,repo:h,search:l,enabled:u}=t,d=l===void 0?"":l,f=u===void 0?!0:u;let _;e[0]!==d?(_=d.trim(),e[0]=d,e[1]=_):_=e[1];const p=_,m=wc(p,dd);let g;e[2]!==n?(g=Ja(n),e[2]=n,e[3]=g):g=e[3];const v=g,k=p.length>0;let b;e[4]!==m||e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==h||e[9]!==n?(b=An.githubBranchSearch(i,s,Za(n),a,h,m),e[4]=m,e[5]=i,e[6]=s,e[7]=a,e[8]=h,e[9]=n,e[10]=b):b=e[10];const w=f&&v;let C;e[11]!==m||e[12]!==s||e[13]!==n?(C=ee=>{const{pageParam:ue}=ee;return Tn(s,"REPOSITORY_SEARCH_BRANCHES",{...n,query:m,limit:m?cd:hd,cursor:ue})},e[11]=m,e[12]=s,e[13]=n,e[14]=C):C=e[14];let S;e[15]!==m?(S=ee=>m?void 0:ee.nextCursor??void 0,e[15]=m,e[16]=S):S=e[16];let R;e[17]!==b||e[18]!==w||e[19]!==C||e[20]!==S?(R={queryKey:b,enabled:w,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:C,getNextPageParam:S},e[17]=b,e[18]=w,e[19]=C,e[20]=S,e[21]=R):R=e[21];const{data:N,isLoading:I,isError:L,isFetching:y,hasNextPage:E,isFetchingNextPage:x,fetchNextPage:A}=xc(R),D=k&&(m!==p||y),P=(N?.pages??[]).flatMap(fd),B=yc(6e4),M=ld({sandboxMap:o,userId:r,rawBranches:P,now:B});let K;e[22]!==p?(K=ee=>zr(ee.name,p),e[22]=p,e[23]=K):K=e[23];const F=M.recent.filter(K);let H;e[24]!==p?(H=ee=>zr(ee.name,p),e[24]=p,e[25]=H):H=e[25];const Y=M.yours.filter(H),q=M.others,te=N?.pages[0],J=k&&te&&!D?Math.max(0,te.totalCount-te.branches.length):0,Q=!k&&E;let W;e[26]!==A?(W=()=>{A()},e[26]=A,e[27]=W):W=e[27];let G;return e[28]!==J||e[29]!==L||e[30]!==x||e[31]!==I||e[32]!==D||e[33]!==q||e[34]!==F||e[35]!==Q||e[36]!==W||e[37]!==Y?(G={recent:F,yours:Y,others:q,isLoading:I,isError:L,isSearching:D,hiddenMatchCount:J,hasMore:Q,isFetchingMore:x,fetchMore:W},e[28]=J,e[29]=L,e[30]=x,e[31]=I,e[32]=D,e[33]=q,e[34]=F,e[35]=Q,e[36]=W,e[37]=Y,e[38]=G):G=e[38],G}function fd(t){return t.branches}function _d(t){const e=U.c(231),{virtualMcpId:i,userLabel:s,value:r,baseBranch:n,orgId:o,orgSlug:a,userId:h,target:l,owner:u,repo:d,sandboxMap:f,onChange:_,onCreateBranch:p,onAdoptBranch:m,disabled:g,spawnsNewChat:v,placement:k}=t,b=g===void 0?!1:g,w=v===void 0?!1:v,C=k===void 0?"chat":k,S=Be(),R=C==="header",[N,I]=X.useState(!1),[L,y]=X.useState(!1),[E,x]=X.useState("branches"),[A,D]=X.useState(null),[P,B]=X.useState(""),[M,K]=X.useState(null),F=X.useRef(null),{releases:H,createRelease:Y,renameRelease:q,deleteRelease:te}=Ln(i),{url:J,setUrl:Q,clear:W}=In(i),G=!!J;let ee;e[0]!==N?(ee={enabled:N},e[0]=N,e[1]=ee):ee=e[1];const{data:ue}=pc(ee);let ie;e[2]!==ue?.data?.members?(ie=se=>se?ue?.data?.members?.find(st=>st.userId===se)?.user?.name??void 0:void 0,e[2]=ue?.data?.members,e[3]=ie):ie=e[3];const de=ie,z=H.length>=ao;let ge;e[4]!==S?(ge=S("thread.branchPicker.capReached",{max:ao}),e[4]=S,e[5]=ge):ge=e[5];const fe=ge,Le=!!r&&r===n;let oe,$,De,At,Ye,He,it,Ne,yt,Wt,ce,Ke,qe,V,_e,Ae,ye,Je,nt,xt,ot,Tt,$t,Mt,ke,Ct,Lt,Ut,ni;if(e[6]!==z||e[7]!==n||e[8]!==fe||e[9]!==W||e[10]!==Y||e[11]!==te||e[12]!==b||e[13]!==P||e[14]!==Le||e[15]!==R||e[16]!==G||e[17]!==m||e[18]!==_||e[19]!==p||e[20]!==N||e[21]!==M||e[22]!==H||e[23]!==q||e[24]!==Q||e[25]!==S||e[26]!==h||e[27]!==s||e[28]!==r){let se;e[58]!==r?(se=he=>he.branch===r,e[58]=r,e[59]=se):se=e[59];const st=H.find(se);ni=!Le&&!st&&!!r;const Oi=Le?S("thread.branchPicker.live"):st?.name??S("thread.branchPicker.defaultVersionName");ce=G?S("thread.branchPicker.localLabel"):r?Oi:S("thread.branchPicker.selectVersion");const Mh=G?"bg-special":Le?"bg-success":br(st?.color??"orange");let gs;e[60]!==W||e[61]!==_?(gs=he=>{W(),_(he),I(!1)},e[60]=W,e[61]=_,e[62]=gs):gs=e[62],qe=gs;let vs;e[63]!==S?(vs=he=>{Xe.error(he instanceof Error?he.message:S("thread.branchPicker.saveError"))},e[63]=S,e[64]=vs):vs=e[64];const Ze=vs;let bs;e[65]!==Q?(bs=he=>{Q(he),y(!1),I(!1)},e[65]=Q,e[66]=bs):bs=e[66],He=bs;let Ss;e[67]!==z||e[68]!==fe||e[69]!==W||e[70]!==Y||e[71]!==m||e[72]!==_||e[73]!==H||e[74]!==Ze||e[75]!==h?(Ss=(he,xi)=>{if(W(),m){m(he),y(!1),I(!1);return}if(!H.some(vr=>vr.branch===he)){if(z){Xe.error(fe);return}Y({branch:he,name:xi.trim()||he,color:Sr(H.length),createdBy:h,createdAt:new Date().toISOString()}).catch(Ze)}_(he),y(!1),I(!1)},e[67]=z,e[68]=fe,e[69]=W,e[70]=Y,e[71]=m,e[72]=_,e[73]=H,e[74]=Ze,e[75]=h,e[76]=Ss):Ss=e[76],it=Ss;let ws;e[77]!==z||e[78]!==fe||e[79]!==W||e[80]!==Y||e[81]!==_||e[82]!==p||e[83]!==H||e[84]!==Ze||e[85]!==S||e[86]!==h||e[87]!==s?(ws=()=>{if(z){Xe.error(fe);return}W();const he=Nn(s);Y({branch:he,name:oo(H,S("thread.branchPicker.defaultVersionName")),color:Sr(H.length),createdBy:h,createdAt:new Date().toISOString()}).catch(Ze),(p??_)(he),I(!1)},e[77]=z,e[78]=fe,e[79]=W,e[80]=Y,e[81]=_,e[82]=p,e[83]=H,e[84]=Ze,e[85]=S,e[86]=h,e[87]=s,e[88]=ws):ws=e[88],Wt=ws;let ys;e[89]===Symbol.for("react.memo_cache_sentinel")?(ys=()=>{D(null),B(""),y(!1),x("branches")},e[89]=ys):ys=e[89];const Lh=ys;let xs;e[90]===Symbol.for("react.memo_cache_sentinel")?(xs=he=>{x(he),y(!0)},e[90]=xs):xs=e[90],Ke=xs;let Cs;e[91]===Symbol.for("react.memo_cache_sentinel")?(Cs=he=>{D(he.branch),B(he.name)},e[91]=Cs):Cs=e[91],Ae=Cs;let ks;e[92]!==P||e[93]!==q||e[94]!==Ze?(ks=he=>{const xi=P.trim();xi&&q(he,xi).catch(Ze),D(null),B("")},e[92]=P,e[93]=q,e[94]=Ze,e[95]=ks):ks=e[95],V=ks;let Es;e[96]!==z||e[97]!==fe||e[98]!==Y||e[99]!==P||e[100]!==H.length||e[101]!==Ze||e[102]!==h||e[103]!==r?(Es=()=>{const he=P.trim();if(he&&r){if(z){Xe.error(fe),D(null),B("");return}Y({branch:r,name:he,color:Sr(H.length),createdBy:h,createdAt:new Date().toISOString()}).catch(Ze)}D(null),B("")},e[96]=z,e[97]=fe,e[98]=Y,e[99]=P,e[100]=H.length,e[101]=Ze,e[102]=h,e[103]=r,e[104]=Es):Es=e[104],_e=Es;let Ps;e[105]===Symbol.for("react.memo_cache_sentinel")?(Ps=()=>{D(null),B("")},e[105]=Ps):Ps=e[105],Ne=Ps;let Rs;e[106]!==n||e[107]!==te||e[108]!==M||e[109]!==qe||e[110]!==H||e[111]!==Ze||e[112]!==r?(Rs=()=>{const he=M;if(K(null),!!he){if(he.branch===r){const xi=H.find(vr=>vr.branch!==he.branch);xi?qe(xi.branch):n?qe(n):I(!1)}else I(!1);te(he.branch).catch(Ze)}},e[106]=n,e[107]=te,e[108]=M,e[109]=qe,e[110]=H,e[111]=Ze,e[112]=r,e[113]=Rs):Rs=e[113],yt=Rs,Ye=Ta,Mt=N,e[114]!==b?(ke=b?void 0:he=>{he||Lh(),I(he)},e[114]=b,e[115]=ke):ke=e[115],At=bt,De=St,$t=!0,Tt="inline-flex min-w-0 shrink",$=Ma,ot=!0,oe=pe,Lt=ic.branchPicker,Ut=R?"outline":"ghost",ye=R?"sm":"default",Je=ce,nt=b;const gr=R?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[116]!==gr?(xt=le("shrink min-w-0 max-w-[220px] gap-2",gr,Aa),e[116]=gr,e[117]=xt):xt=e[117],Ct=le("h-2 w-2 shrink-0 rounded-full",r||G?Mh:"bg-muted-foreground"),e[6]=z,e[7]=n,e[8]=fe,e[9]=W,e[10]=Y,e[11]=te,e[12]=b,e[13]=P,e[14]=Le,e[15]=R,e[16]=G,e[17]=m,e[18]=_,e[19]=p,e[20]=N,e[21]=M,e[22]=H,e[23]=q,e[24]=Q,e[25]=S,e[26]=h,e[27]=s,e[28]=r,e[29]=oe,e[30]=$,e[31]=De,e[32]=At,e[33]=Ye,e[34]=He,e[35]=it,e[36]=Ne,e[37]=yt,e[38]=Wt,e[39]=ce,e[40]=Ke,e[41]=qe,e[42]=V,e[43]=_e,e[44]=Ae,e[45]=ye,e[46]=Je,e[47]=nt,e[48]=xt,e[49]=ot,e[50]=Tt,e[51]=$t,e[52]=Mt,e[53]=ke,e[54]=Ct,e[55]=Lt,e[56]=Ut,e[57]=ni}else oe=e[29],$=e[30],De=e[31],At=e[32],Ye=e[33],He=e[34],it=e[35],Ne=e[36],yt=e[37],Wt=e[38],ce=e[39],Ke=e[40],qe=e[41],V=e[42],_e=e[43],Ae=e[44],ye=e[45],Je=e[46],nt=e[47],xt=e[48],ot=e[49],Tt=e[50],$t=e[51],Mt=e[52],ke=e[53],Ct=e[54],Lt=e[55],Ut=e[56],ni=e[57];let Kt;e[118]!==Ct?(Kt=c.jsx("span",{className:Ct}),e[118]=Ct,e[119]=Kt):Kt=e[119];let Nt;e[120]!==ce?(Nt=c.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:ce}),e[120]=ce,e[121]=Nt):Nt=e[121];let Ot;e[122]!==b?(Ot=!b&&c.jsx(or,{size:12,className:"opacity-60 shrink-0"}),e[122]=b,e[123]=Ot):Ot=e[123];let qt;e[124]!==oe||e[125]!==ye||e[126]!==Je||e[127]!==nt||e[128]!==xt||e[129]!==Kt||e[130]!==Nt||e[131]!==Ot||e[132]!==Lt||e[133]!==Ut?(qt=c.jsxs(oe,{"data-tour":Lt,variant:Ut,size:ye,"aria-label":Je,disabled:nt,className:xt,children:[Kt,Nt,Ot]}),e[124]=oe,e[125]=ye,e[126]=Je,e[127]=nt,e[128]=xt,e[129]=Kt,e[130]=Nt,e[131]=Ot,e[132]=Lt,e[133]=Ut,e[134]=qt):qt=e[134];let It;e[135]!==$||e[136]!==ot||e[137]!==qt?(It=c.jsx($,{asChild:ot,children:qt}),e[135]=$,e[136]=ot,e[137]=qt,e[138]=It):It=e[138];let Vt;e[139]!==Tt||e[140]!==It?(Vt=c.jsx("span",{className:Tt,children:It}),e[139]=Tt,e[140]=It,e[141]=Vt):Vt=e[141];let jt;e[142]!==De||e[143]!==$t||e[144]!==Vt?(jt=c.jsx(De,{asChild:$t,children:Vt}),e[142]=De,e[143]=$t,e[144]=Vt,e[145]=jt):jt=e[145];let Yt;e[146]!==ce?(Yt=c.jsx(wt,{children:ce}),e[146]=ce,e[147]=Yt):Yt=e[147];let Ht;e[148]!==At||e[149]!==jt||e[150]!==Yt?(Ht=c.jsxs(At,{children:[jt,Yt]}),e[148]=At,e[149]=jt,e[150]=Yt,e[151]=Ht):Ht=e[151];let fi;e[152]===Symbol.for("react.memo_cache_sentinel")?(fi=se=>{se.preventDefault(),F.current?.scrollIntoView({block:"nearest"})},e[152]=fi):fi=e[152];let Gt;e[153]!==w||e[154]!==S?(Gt=w&&c.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:S("thread.branchPicker.newChatHint")}),e[153]=w,e[154]=S,e[155]=Gt):Gt=e[155];let kt;e[156]!==He||e[157]!==it||e[158]!==L||e[159]!==E||e[160]!==z||e[161]!==Ne||e[162]!==fe||e[163]!==W||e[164]!==Wt||e[165]!==de||e[166]!==P||e[167]!==A||e[168]!==G||e[169]!==J||e[170]!==N||e[171]!==Ke||e[172]!==o||e[173]!==a||e[174]!==u||e[175]!==qe||e[176]!==H||e[177]!==d||e[178]!==f||e[179]!==V||e[180]!==_e||e[181]!==Ae||e[182]!==S||e[183]!==l||e[184]!==ni||e[185]!==h||e[186]!==r?(kt=L?c.jsx(md,{orgId:o,orgSlug:a,userId:h,target:l,owner:u,repo:d,sandboxMap:f,enabled:N,tab:E,onTabChange:x,localUrl:J,onSaveLocal:He,onBack:()=>y(!1),onAdopt:it}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"always-scrollbar flex max-h-[min(50vh,20rem)] flex-col overflow-y-auto",children:[G&&J&&c.jsx(pd,{rowRef:F,url:J,onSelect:()=>Ke("local"),onEdit:()=>Ke("local"),onTurnOff:()=>W()}),ni&&r&&(A===r?c.jsx(po,{value:P,onChange:B,onSave:_e,onCancel:Ne}):c.jsx(mo,{rowRef:G?void 0:F,dot:br("orange"),label:S("thread.branchPicker.defaultVersionName"),branch:r,selected:!G,onSelect:()=>qe(r),onRename:()=>{D(r),B(oo(H,S("thread.branchPicker.defaultVersionName")))}})),H.map(se=>A===se.branch?c.jsx(po,{value:P,onChange:B,onSave:()=>V(se.branch),onCancel:Ne},se.branch):c.jsx(mo,{rowRef:!G&&se.branch===r?F:void 0,dot:br(se.color),label:se.name,creator:de(se.createdBy),branch:se.branch,selected:!G&&se.branch===r,onSelect:()=>qe(se.branch),onRename:()=>Ae(se),onDelete:()=>K(se)},se.branch))]}),(ni||H.length>0)&&c.jsx("div",{className:"my-1 border-t"}),c.jsxs("button",{type:"button",onClick:()=>{Wt()},disabled:z,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:[c.jsx(Mn,{className:"h-4 w-4 shrink-0"}),S("thread.branchPicker.newVersion")]}),z&&c.jsx("p",{className:"px-2 pb-1 pt-0.5 text-xs text-warning",children:fe}),c.jsxs("button",{type:"button",onClick:()=>Ke("branches"),className:"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",children:[S("thread.branchPicker.advanced"),c.jsx(Ea,{className:"h-4 w-4 shrink-0"})]})]}),e[156]=He,e[157]=it,e[158]=L,e[159]=E,e[160]=z,e[161]=Ne,e[162]=fe,e[163]=W,e[164]=Wt,e[165]=de,e[166]=P,e[167]=A,e[168]=G,e[169]=J,e[170]=N,e[171]=Ke,e[172]=o,e[173]=a,e[174]=u,e[175]=qe,e[176]=H,e[177]=d,e[178]=f,e[179]=V,e[180]=_e,e[181]=Ae,e[182]=S,e[183]=l,e[184]=ni,e[185]=h,e[186]=r,e[187]=kt):kt=e[187];let Xt;e[188]!==Gt||e[189]!==kt?(Xt=c.jsxs(La,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:fi,children:[Gt,kt]}),e[188]=Gt,e[189]=kt,e[190]=Xt):Xt=e[190];let oi;e[191]!==Ye||e[192]!==Mt||e[193]!==ke||e[194]!==Ht||e[195]!==Xt?(oi=c.jsxs(Ye,{open:Mt,onOpenChange:ke,children:[Ht,Xt]}),e[191]=Ye,e[192]=Mt,e[193]=ke,e[194]=Ht,e[195]=Xt,e[196]=oi):oi=e[196];const wi=oi,yi=M!==null;let _i;e[197]===Symbol.for("react.memo_cache_sentinel")?(_i=se=>{se||K(null)},e[197]=_i):_i=e[197];let at;e[198]!==S?(at=S("thread.branchPicker.deleteTitle"),e[198]=S,e[199]=at):at=e[199];let lt;e[200]!==at?(lt=c.jsx(Na,{children:at}),e[200]=at,e[201]=lt):lt=e[201];let ht;e[202]!==M||e[203]!==S?(ht=M&&S("thread.branchPicker.deleteConfirm",{name:M.name}),e[202]=M,e[203]=S,e[204]=ht):ht=e[204];let ct;e[205]!==ht?(ct=c.jsx(Oa,{children:ht}),e[205]=ht,e[206]=ct):ct=e[206];let dt;e[207]!==lt||e[208]!==ct?(dt=c.jsxs(Ia,{children:[lt,ct]}),e[207]=lt,e[208]=ct,e[209]=dt):dt=e[209];let ut;e[210]!==S?(ut=S("thread.branchPicker.cancel"),e[210]=S,e[211]=ut):ut=e[211];let ft;e[212]!==ut?(ft=c.jsx(ja,{children:ut}),e[212]=ut,e[213]=ft):ft=e[213];let _t;e[214]!==S?(_t=S("thread.branchPicker.delete"),e[214]=S,e[215]=_t):_t=e[215];let pt;e[216]!==yt||e[217]!==_t?(pt=c.jsx(Ha,{onClick:yt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:_t}),e[216]=yt,e[217]=_t,e[218]=pt):pt=e[218];let Ft;e[219]!==ft||e[220]!==pt?(Ft=c.jsxs(Fa,{children:[ft,pt]}),e[219]=ft,e[220]=pt,e[221]=Ft):Ft=e[221];let ae;e[222]!==dt||e[223]!==Ft?(ae=c.jsxs(za,{children:[dt,Ft]}),e[222]=dt,e[223]=Ft,e[224]=ae):ae=e[224];let ve;e[225]!==yi||e[226]!==ae?(ve=c.jsx(Wa,{open:yi,onOpenChange:_i,children:ae}),e[225]=yi,e[226]=ae,e[227]=ve):ve=e[227];let Se;return e[228]!==wi||e[229]!==ve?(Se=c.jsxs(c.Fragment,{children:[wi,ve]}),e[228]=wi,e[229]=ve,e[230]=Se):Se=e[230],Se}function po(t){const e=U.c(20),{value:i,onChange:s,onSave:r,onCancel:n}=t,o=Be();let a;e[0]!==o?(a=o("thread.branchPicker.rename"),e[0]=o,e[1]=a):a=e[1];let h;e[2]!==s?(h=p=>s(p.target.value),e[2]=s,e[3]=h):h=e[3];let l;e[4]!==n||e[5]!==r?(l=p=>{p.key==="Enter"&&r(),p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),n())},e[4]=n,e[5]=r,e[6]=l):l=e[6];let u;e[7]!==a||e[8]!==h||e[9]!==l||e[10]!==i?(u=c.jsx("input",{autoFocus:!0,"aria-label":a,value:i,onChange:h,onKeyDown:l,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),e[7]=a,e[8]=h,e[9]=l,e[10]=i,e[11]=u):u=e[11];let d;e[12]!==o?(d=o("thread.branchPicker.save"),e[12]=o,e[13]=d):d=e[13];let f;e[14]!==r||e[15]!==d?(f=c.jsx(pe,{size:"sm",onClick:r,children:d}),e[14]=r,e[15]=d,e[16]=f):f=e[16];let _;return e[17]!==u||e[18]!==f?(_=c.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[u,f]}),e[17]=u,e[18]=f,e[19]=_):_=e[19],_}function mo(t){const e=U.c(49),{rowRef:i,dot:s,label:r,creator:n,branch:o,selected:a,onSelect:h,onRename:l,onDelete:u}=t,d=Be(),f=a?"bg-accent":"hover:bg-accent/60";let _;e[0]!==f?(_=le("group flex items-center rounded-lg",f),e[0]=f,e[1]=_):_=e[1];let p;e[2]!==s?(p=le("h-2 w-2 shrink-0 rounded-full",s),e[2]=s,e[3]=p):p=e[3];let m;e[4]!==p?(m=c.jsx("span",{className:p}),e[4]=p,e[5]=m):m=e[5];let g;e[6]!==n?(g=n&&c.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:n}),e[6]=n,e[7]=g):g=e[7];let v;e[8]!==r||e[9]!==g?(v=c.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[r,g]}),e[8]=r,e[9]=g,e[10]=v):v=e[10];let k;e[11]!==h||e[12]!==a||e[13]!==m||e[14]!==v?(k=c.jsx(St,{asChild:!0,children:c.jsxs("button",{type:"button","aria-pressed":a,onClick:h,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[m,v]})}),e[11]=h,e[12]=a,e[13]=m,e[14]=v,e[15]=k):k=e[15];let b;e[16]!==o||e[17]!==d?(b=d("thread.branchPicker.branchTooltip",{branch:o}),e[16]=o,e[17]=d,e[18]=b):b=e[18];let w;e[19]!==b?(w=c.jsx(wt,{side:"bottom",className:"font-mono text-xs",children:b}),e[19]=b,e[20]=w):w=e[20];let C;e[21]!==k||e[22]!==w?(C=c.jsxs(bt,{children:[k,w]}),e[21]=k,e[22]=w,e[23]=C):C=e[23];let S;e[24]!==d?(S=d("thread.branchPicker.moreActions"),e[24]=d,e[25]=S):S=e[25];let R;e[26]===Symbol.for("react.memo_cache_sentinel")?(R=c.jsx(Va,{className:"h-4 w-4"}),e[26]=R):R=e[26];let N;e[27]!==S?(N=c.jsx(cs,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"icon","aria-label":S,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:R})}),e[27]=S,e[28]=N):N=e[28];let I;e[29]===Symbol.for("react.memo_cache_sentinel")?(I=c.jsx(Ya,{className:"h-4 w-4"}),e[29]=I):I=e[29];let L;e[30]!==d?(L=d("thread.branchPicker.rename"),e[30]=d,e[31]=L):L=e[31];let y;e[32]!==l||e[33]!==L?(y=c.jsxs(Ai,{onSelect:l,children:[I,L]}),e[32]=l,e[33]=L,e[34]=y):y=e[34];let E;e[35]!==u||e[36]!==d?(E=u&&c.jsxs(Ai,{onSelect:u,className:"text-destructive focus:text-destructive",children:[c.jsx(lr,{className:"h-4 w-4"}),d("thread.branchPicker.delete")]}),e[35]=u,e[36]=d,e[37]=E):E=e[37];let x;e[38]!==y||e[39]!==E?(x=c.jsxs(ds,{align:"end",children:[y,E]}),e[38]=y,e[39]=E,e[40]=x):x=e[40];let A;e[41]!==N||e[42]!==x?(A=c.jsxs(us,{children:[N,x]}),e[41]=N,e[42]=x,e[43]=A):A=e[43];let D;return e[44]!==i||e[45]!==C||e[46]!==A||e[47]!==_?(D=c.jsxs("div",{ref:i,className:_,children:[C,A]}),e[44]=i,e[45]=C,e[46]=A,e[47]=_,e[48]=D):D=e[48],D}function pd(t){const e=U.c(40),{rowRef:i,url:s,onSelect:r,onEdit:n,onTurnOff:o}=t,a=Be();let h;try{let y;e[0]!==s?(y=new URL(s),e[0]=s,e[1]=y):y=e[1],h=y.host}catch{h=s}const l=h;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-special"}),e[2]=u):u=e[2];let d;e[3]!==a?(d=a("thread.branchPicker.localLabel"),e[3]=a,e[4]=d):d=e[4];let f;e[5]!==l?(f=c.jsx("span",{className:"ml-1.5 text-xs font-normal text-muted-foreground/70",children:l}),e[5]=l,e[6]=f):f=e[6];let _;e[7]!==d||e[8]!==f?(_=c.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[d,f]}),e[7]=d,e[8]=f,e[9]=_):_=e[9];let p;e[10]!==r||e[11]!==_?(p=c.jsxs("button",{type:"button","aria-pressed":!0,onClick:r,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[u,_]}),e[10]=r,e[11]=_,e[12]=p):p=e[12];let m;e[13]!==a?(m=a("thread.branchPicker.moreActions"),e[13]=a,e[14]=m):m=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c.jsx(Va,{className:"h-4 w-4"}),e[15]=g):g=e[15];let v;e[16]!==m?(v=c.jsx(cs,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"icon","aria-label":m,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:g})}),e[16]=m,e[17]=v):v=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=c.jsx(Ya,{className:"h-4 w-4"}),e[18]=k):k=e[18];let b;e[19]!==a?(b=a("thread.branchPicker.rename"),e[19]=a,e[20]=b):b=e[20];let w;e[21]!==n||e[22]!==b?(w=c.jsxs(Ai,{onSelect:n,children:[k,b]}),e[21]=n,e[22]=b,e[23]=w):w=e[23];let C;e[24]===Symbol.for("react.memo_cache_sentinel")?(C=c.jsx(lr,{className:"h-4 w-4"}),e[24]=C):C=e[24];let S;e[25]!==a?(S=a("thread.branchPicker.localTurnOff"),e[25]=a,e[26]=S):S=e[26];let R;e[27]!==o||e[28]!==S?(R=c.jsxs(Ai,{onSelect:o,className:"text-destructive focus:text-destructive",children:[C,S]}),e[27]=o,e[28]=S,e[29]=R):R=e[29];let N;e[30]!==w||e[31]!==R?(N=c.jsxs(ds,{align:"end",children:[w,R]}),e[30]=w,e[31]=R,e[32]=N):N=e[32];let I;e[33]!==N||e[34]!==v?(I=c.jsxs(us,{children:[v,N]}),e[33]=N,e[34]=v,e[35]=I):I=e[35];let L;return e[36]!==i||e[37]!==I||e[38]!==p?(L=c.jsxs("div",{ref:i,className:"group flex items-center rounded-lg bg-accent",children:[p,I]}),e[36]=i,e[37]=I,e[38]=p,e[39]=L):L=e[39],L}function md(t){const e=U.c(73),{orgId:i,orgSlug:s,userId:r,target:n,owner:o,repo:a,sandboxMap:h,enabled:l,tab:u,onTabChange:d,localUrl:f,onSaveLocal:_,onBack:p,onAdopt:m}=t,g=Be(),[v,k]=X.useState(""),b=u==="branches"?v:"",w=l&&u==="branches";let C;e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==h||e[5]!==b||e[6]!==w||e[7]!==n||e[8]!==r?(C={orgId:i,orgSlug:s,userId:r,target:n,sandboxMap:h,owner:o,repo:a,search:b,enabled:w},e[0]=i,e[1]=s,e[2]=o,e[3]=a,e[4]=h,e[5]=b,e[6]=w,e[7]=n,e[8]=r,e[9]=C):C=e[9];const{recent:S,yours:R,others:N,isLoading:I,hasMore:L,isFetchingMore:y,fetchMore:E}=ud(C),x=l&&u==="prs";let A;e[10]!==i||e[11]!==s||e[12]!==o||e[13]!==a||e[14]!==x||e[15]!==n?(A={orgId:i,orgSlug:s,target:n,owner:o,repo:a,enabled:x},e[10]=i,e[11]=s,e[12]=o,e[13]=a,e[14]=x,e[15]=n,e[16]=A):A=e[16];const{data:D,isLoading:P}=Cc(A);let B;if(e[17]!==E||e[18]!==L||e[19]!==y||e[20]!==I||e[21]!==f||e[22]!==m||e[23]!==p||e[24]!==_||e[25]!==d||e[26]!==N||e[27]!==o||e[28]!==P||e[29]!==S||e[30]!==a||e[31]!==v||e[32]!==g||e[33]!==D||e[34]!==u||e[35]!==R){const M=D===void 0?[]:D,K=`${o}/${a}`;let F;e[37]!==K?(F=K.toLowerCase(),e[37]=K,e[38]=F):F=e[38];const H=F;let Y;e[39]!==H?(Y=$=>$.headRepoFullName?.toLowerCase()===H,e[39]=H,e[40]=Y):Y=e[40];const q=M.filter(Y);let te;if(e[41]!==N||e[42]!==S||e[43]!==R){const $=new Set;te=[...S,...R,...N].filter(De=>$.has(De.name)?!1:($.add(De.name),!0)),e[41]=N,e[42]=S,e[43]=R,e[44]=te}else te=e[44];const J=te;let Q;e[45]===Symbol.for("react.memo_cache_sentinel")?(Q=c.jsx(lc,{className:"h-4 w-4 shrink-0"}),e[45]=Q):Q=e[45];let W;e[46]!==g?(W=g("thread.branchPicker.advancedBack"),e[46]=g,e[47]=W):W=e[47];let G;e[48]!==p||e[49]!==W?(G=c.jsxs("button",{type:"button",onClick:p,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[Q,W]}),e[48]=p,e[49]=W,e[50]=G):G=e[50];let ee;e[51]!==d?(ee=$=>{d($),k("")},e[51]=d,e[52]=ee):ee=e[52];let ue;e[53]!==g?(ue=g("thread.branchPicker.branchesTab"),e[53]=g,e[54]=ue):ue=e[54];let ie;e[55]!==ue?(ie=c.jsx(Pi,{value:"branches",className:"h-6 px-2.5 text-xs",children:ue}),e[55]=ue,e[56]=ie):ie=e[56];let de;e[57]!==g?(de=g("thread.branchPicker.prsTab"),e[57]=g,e[58]=de):de=e[58];let z;e[59]!==de?(z=c.jsx(Pi,{value:"prs",className:"h-6 px-2.5 text-xs",children:de}),e[59]=de,e[60]=z):z=e[60];let ge;e[61]!==g?(ge=g("thread.branchPicker.localTab"),e[61]=g,e[62]=ge):ge=e[62];let fe;e[63]!==ge?(fe=c.jsx(Pi,{value:"local",className:"h-6 px-2.5 text-xs",children:ge}),e[63]=ge,e[64]=fe):fe=e[64];let Le;e[65]!==ie||e[66]!==z||e[67]!==fe?(Le=c.jsxs($a,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[ie,z,fe]}),e[65]=ie,e[66]=z,e[67]=fe,e[68]=Le):Le=e[68];let oe;e[69]!==ee||e[70]!==Le||e[71]!==u?(oe=c.jsx(Ua,{className:"px-2 pt-2 pb-1",value:u,onValueChange:ee,children:Le}),e[69]=ee,e[70]=Le,e[71]=u,e[72]=oe):oe=e[72],B=c.jsxs("div",{className:"flex flex-col",children:[G,oe,u==="local"?c.jsx(vd,{url:f,onSave:_}):c.jsxs(rc,{filter:u==="branches"?gd:void 0,children:[c.jsx(nc,{placeholder:g(u==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),value:v,onValueChange:k}),c.jsx(oc,{onScroll:$=>{const De=$.currentTarget;u==="branches"&&De.scrollHeight-De.scrollTop-De.clientHeight<48&&E()},children:u==="branches"?c.jsxs(c.Fragment,{children:[I&&c.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:g("thread.branchPicker.loadingMore")}),!I&&J.length===0&&c.jsx(so,{children:g("thread.branchPicker.noBranchesFound")}),J.length>0&&c.jsx(ro,{children:J.map($=>c.jsxs(no,{value:$.name,className:"cursor-pointer",onSelect:()=>m($.name,$.name),children:[c.jsx(Nh,{className:"mr-2 h-4 w-4 shrink-0"}),c.jsx("span",{className:"flex-1 truncate",children:$.name})]},$.name))}),L&&c.jsx("div",{className:"p-2",children:c.jsx(pe,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:y,onClick:E,children:g(y?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):c.jsxs(c.Fragment,{children:[P&&c.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:g("thread.branchPicker.loadingPullRequests")}),!P&&q.length===0&&c.jsx(so,{children:g("thread.branchPicker.noOpenPullRequests")}),q.length>0&&c.jsx(ro,{children:q.map($=>c.jsxs(no,{value:`#${$.number} ${$.title} ${$.head}`,className:"cursor-pointer",onSelect:()=>m($.head,_o($.title)),children:[c.jsx(ar,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsx("span",{className:"truncate",children:_o($.title)}),c.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",$.number," · ",$.head]})]})]},$.number))})]})})]})]}),e[17]=E,e[18]=L,e[19]=y,e[20]=I,e[21]=f,e[22]=m,e[23]=p,e[24]=_,e[25]=d,e[26]=N,e[27]=o,e[28]=P,e[29]=S,e[30]=a,e[31]=v,e[32]=g,e[33]=D,e[34]=u,e[35]=R,e[36]=B}else B=e[36];return B}function gd(t,e){return zr(t,e)?1:0}function vd(t){const e=U.c(39),{url:i,onSave:s}=t,r=Be(),[n,o]=X.useState(i??"");let a;e[0]!==n?(a=n.trim(),e[0]=n,e[1]=a):a=e[1];const h=a;let l;e[2]!==s||e[3]!==h?(l=()=>s(h?uc(h):null),e[2]=s,e[3]=h,e[4]=l):l=e[4];const u=l;let d;e[5]!==r?(d=r("thread.branchPicker.localHint"),e[5]=r,e[6]=d):d=e[6];let f;e[7]!==d?(f=c.jsx("p",{className:"text-xs text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let _;e[9]!==r?(_=r("thread.branchPicker.localUrlLabel"),e[9]=r,e[10]=_):_=e[10];let p;e[11]!==r?(p=r("thread.branchPicker.localUrlPlaceholder"),e[11]=r,e[12]=p):p=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=N=>o(N.target.value),e[13]=m):m=e[13];let g;e[14]!==u||e[15]!==h?(g=N=>{N.key==="Enter"&&h&&u()},e[14]=u,e[15]=h,e[16]=g):g=e[16];let v;e[17]!==_||e[18]!==p||e[19]!==g||e[20]!==n?(v=c.jsx("input",{type:"url",inputMode:"url","aria-label":_,placeholder:p,value:n,onChange:m,onKeyDown:g,className:"h-8 w-full rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),e[17]=_,e[18]=p,e[19]=g,e[20]=n,e[21]=v):v=e[21];let k;e[22]!==s||e[23]!==r||e[24]!==i?(k=i?c.jsx(pe,{variant:"ghost",size:"sm",className:"text-xs text-destructive hover:text-destructive",onClick:()=>s(null),children:r("thread.branchPicker.localTurnOff")}):c.jsx("span",{}),e[22]=s,e[23]=r,e[24]=i,e[25]=k):k=e[25];const b=!h;let w;e[26]!==r?(w=r("thread.branchPicker.save"),e[26]=r,e[27]=w):w=e[27];let C;e[28]!==u||e[29]!==b||e[30]!==w?(C=c.jsx(pe,{size:"sm",disabled:b,onClick:u,children:w}),e[28]=u,e[29]=b,e[30]=w,e[31]=C):C=e[31];let S;e[32]!==k||e[33]!==C?(S=c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[k,C]}),e[32]=k,e[33]=C,e[34]=S):S=e[34];let R;return e[35]!==S||e[36]!==f||e[37]!==v?(R=c.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[f,v,S]}),e[35]=S,e[36]=f,e[37]=v,e[38]=R):R=e[38],R}function bd(t){const e=U.c(17),{locked:i,placement:s,value:r,virtualMcpId:n,userLabel:o,baseBranch:a,onChange:h,onCreateBranch:l,onAdoptBranch:u,orgId:d,orgSlug:f,userId:_,target:p,owner:m,repo:g,sandboxMap:v}=t;let k;return e[0]!==a||e[1]!==i||e[2]!==u||e[3]!==h||e[4]!==l||e[5]!==d||e[6]!==f||e[7]!==m||e[8]!==s||e[9]!==g||e[10]!==v||e[11]!==p||e[12]!==_||e[13]!==o||e[14]!==r||e[15]!==n?(k=c.jsx(_d,{virtualMcpId:n,userLabel:o,value:r,baseBranch:a,orgId:d,orgSlug:f,userId:_,target:p,owner:m,repo:g,sandboxMap:v,onChange:h,onCreateBranch:l,onAdoptBranch:u,spawnsNewChat:i,placement:s}),e[0]=a,e[1]=i,e[2]=u,e[3]=h,e[4]=l,e[5]=d,e[6]=f,e[7]=m,e[8]=s,e[9]=g,e[10]=v,e[11]=p,e[12]=_,e[13]=o,e[14]=r,e[15]=n,e[16]=k):k=e[16],k}function Sd(t){const e=U.c(2),{branchPill:i}=t;if(!i)return null;let s;return e[0]!==i?(s=c.jsx(c.Fragment,{children:i}),e[0]=i,e[1]=s):s=e[1],s}function wd(t){const e=U.c(21),{virtualMcp:i,currentBranch:s}=t,r=ec(),n=Wi();let o;e[0]!==r?.messages||e[1]!==n?.isThreadLocked?(o=(r?.messages??[]).length>0||(n?.isThreadLocked??!1),e[0]=r?.messages,e[1]=n?.isThreadLocked,e[2]=o):o=e[2];const a=o,h=n?.setCurrentTaskBranch,l=n?.createTask;let u;e[3]!==n?.activeTask?.metadata||e[4]!==i?.metadata?(u=fc(i?.metadata)==="cms"&&_c(n?.activeTask?.metadata,i?.metadata)==="sandbox",e[3]=n?.activeTask?.metadata,e[4]=i?.metadata,e[5]=u):u=e[5];const d=u,f=Sc(i),_=Bt(f),{data:p}=sr.useSession(),m=p?.user;let g;e[6]!==m?(g=On(m),e[6]=m,e[7]=g):g=e[7];const v=g,k=p?.user?.id??"",{org:b}=rr(),w=kc(i,s);let C;e[8]!==l||e[9]!==a||e[10]!==h?(C=x=>{a&&l?l({branch:x}):h&&h(x)},e[8]=l,e[9]=a,e[10]=h,e[11]=C):C=e[11];const S=C;let R;e[12]!==d||e[13]!==l||e[14]!==a||e[15]!==h?(R=x=>{(a||d)&&l?l({branch:x}):h&&h(x)},e[12]=d,e[13]=l,e[14]=a,e[15]=h,e[16]=R):R=e[16];const N=R;let I;e[17]!==l?(I=l?x=>l({runtime:"sandbox",branch:x}):void 0,e[17]=l,e[18]=I):I=e[18];const L=I,y=f&&Ja(_)?c.jsx(bd,{userLabel:v,virtualMcpId:i?.id??"",value:s,baseBranch:w,orgId:b.id,orgSlug:b.slug,userId:k,target:_,owner:f.owner,repo:f.name,sandboxMap:i?.metadata?.sandboxMap,onChange:S,onCreateBranch:N,onAdoptBranch:L,locked:a,placement:"chat"},`${Za(_)}:${f.owner}/${f.name}`):null;let E;return e[19]!==y?(E=c.jsx(Sd,{branchPill:y}),e[19]=y,e[20]=E):E=e[20],E}const yd=Oh("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 xd(t){const e=U.c(11);let i,s,r;e[0]!==t?({className:i,orientation:s,...r}=t,e[0]=t,e[1]=i,e[2]=s,e[3]=r):(i=e[1],s=e[2],r=e[3]);let n;e[4]!==i||e[5]!==s?(n=le(yd({orientation:s}),i),e[4]=i,e[5]=s,e[6]=n):n=e[6];let o;return e[7]!==s||e[8]!==r||e[9]!==n?(o=c.jsx("div",{role:"group","data-slot":"button-group","data-orientation":s,className:n,...r}),e[7]=s,e[8]=r,e[9]=n,e[10]=o):o=e[10],o}function Cd(t){const e=U.c(14),{item:i}=t;let s;e[0]!==i?(s=()=>{i.onSelect()},e[0]=i,e[1]=s):s=e[1];let r;e[2]!==i.disabled||e[3]!==i.icon||e[4]!==i.label||e[5]!==s?(r=c.jsxs(Ai,{disabled:i.disabled,onSelect:s,children:[i.icon,i.label]}),e[2]=i.disabled,e[3]=i.icon,e[4]=i.label,e[5]=s,e[6]=r):r=e[6];const n=r;if(!i.tooltip)return n;let o;e[7]!==n?(o=c.jsx(St,{asChild:!0,children:n}),e[7]=n,e[8]=o):o=e[8];let a;e[9]!==i.tooltip?(a=c.jsx(wt,{side:"right",children:i.tooltip}),e[9]=i.tooltip,e[10]=a):a=e[10];let h;return e[11]!==o||e[12]!==a?(h=c.jsxs(bt,{children:[o,a]}),e[11]=o,e[12]=a,e[13]=h):h=e[13],h}function Sl(t){const e=U.c(20),{label:i,onClick:s,variant:r,size:n,disabled:o,loading:a,pulse:h,tooltip:l,icon:u,items:d,menuAriaLabel:f,className:_}=t,p=r===void 0?"default":r,m=n===void 0?"default":n,g=o===void 0?!1:o,v=a===void 0?!1:a,k=h===void 0?!1:h,b=(d?.length??0)>0;let w;if(e[0]!==_||e[1]!==g||e[2]!==b||e[3]!==u||e[4]!==d||e[5]!==i||e[6]!==v||e[7]!==f||e[8]!==s||e[9]!==k||e[10]!==m||e[11]!==l||e[12]!==p){const C=le(Aa,p==="default"&&"focus-visible:inset-ring-current");let S;e[14]!==u||e[15]!==v?(S=v?c.jsx(rs,{size:"xs"}):u,e[14]=u,e[15]=v,e[16]=S):S=e[16];const R=c.jsxs(pe,{type:"button",variant:p,size:m,disabled:g,"aria-busy":v||void 0,onClick:v?void 0:s,className:le(C,b&&"rounded-r-none border-r border-current/20"),children:[S,i]}),N=k&&"animate-pulse-brightness motion-reduce:animate-none motion-reduce:opacity-80";let I;e[17]!==_||e[18]!==N?(I=le(N,_),e[17]=_,e[18]=N,e[19]=I):I=e[19],w=c.jsxs(xd,{className:I,children:[l?c.jsxs(bt,{children:[c.jsx(St,{asChild:!0,children:c.jsx("span",{className:le("inline-flex rounded-lg outline-none",C,g&&"cursor-not-allowed"),tabIndex:g?0:void 0,role:g?"button":void 0,"aria-disabled":g||void 0,children:R})}),c.jsx(wt,{children:l})]}):R,b?c.jsxs(us,{children:[c.jsx(cs,{asChild:!0,children:c.jsx(pe,{type:"button",variant:p,size:m,"aria-label":f,className:le("has-[>svg]:px-2",C),children:c.jsx(or,{className:"size-3.5"})})}),c.jsx(ds,{align:"end",children:d?.map(kd)})]}):null]}),e[0]=_,e[1]=g,e[2]=b,e[3]=u,e[4]=d,e[5]=i,e[6]=v,e[7]=f,e[8]=s,e[9]=k,e[10]=m,e[11]=l,e[12]=p,e[13]=w}else w=e[13];return w}function kd(t){return c.jsx(Cd,{item:t},t.key)}function wl(t){return ur({userName:t?.name,userEmail:t?.email})??void 0}function Fn(t){const e=U.c(18),{state:i,header:s,body:r,note:n,gate:o,footer:a}=t,h=i!=="ready";let l;e[0]!==s?(l=c.jsx("div",{className:"space-y-0.5 px-4 py-3",children:s}),e[0]=s,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx("div",{className:"border-t"}),e[2]=u):u=e[2];let d;e[3]!==n?(d=n?c.jsx("div",{className:"space-y-1.5 border-t px-4 py-3",children:n}):null,e[3]=n,e[4]=d):d=e[4];let f;e[5]!==r||e[6]!==d?(f=c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r,d]}),e[5]=r,e[6]=d,e[7]=f):f=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx("div",{className:"border-t"}),e[8]=_):_=e[8];let p;e[9]!==a?(p=c.jsx("div",{className:"space-y-2 px-4 py-3",children:a}),e[9]=a,e[10]=p):p=e[10];let m;return e[11]!==o||e[12]!==i||e[13]!==h||e[14]!==l||e[15]!==f||e[16]!==p?(m=c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-publish-state":i,"aria-busy":h,children:[l,u,f,o,_,p]}),e[11]=o,e[12]=i,e[13]=h,e[14]=l,e[15]=f,e[16]=p,e[17]=m):m=e[17],m}function Wr(t){const e=U.c(2),{children:i}=t;let s;return e[0]!==i?(s=c.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:i}),e[0]=i,e[1]=s):s=e[1],s}function yl(t){const e=U.c(10);let i,s,r;e[0]!==t?({className:s,children:i,...r}=t,e[0]=t,e[1]=i,e[2]=s,e[3]=r):(i=e[1],s=e[2],r=e[3]);let n;e[4]!==s?(n=le("rounded-lg border bg-card px-3 py-2.5",s),e[4]=s,e[5]=n):n=e[5];let o;return e[6]!==i||e[7]!==r||e[8]!==n?(o=c.jsx("div",{className:n,...r,children:i}),e[6]=i,e[7]=r,e[8]=n,e[9]=o):o=e[9],o}function ti(t){const e=U.c(4),{className:i}=t;let s;e[0]!==i?(s=le("animate-pulse rounded bg-muted motion-reduce:animate-none",i),e[0]=i,e[1]=s):s=e[1];let r;return e[2]!==s?(r=c.jsx("div",{className:s}),e[2]=s,e[3]=r):r=e[3],r}function is(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx(yl,{children:c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(ti,{className:"size-4 rounded-md"}),c.jsx(ti,{className:"h-3 w-24"}),c.jsx(ti,{className:"h-2.5 w-16"}),c.jsx(ti,{className:"ml-auto size-6 rounded"})]})}),t[0]=e):e=t[0],e}async function Ed(t,e,i){const s=ur(i.coAuthor),{changeRequest:r}=await Tn(t,"CHANGE_REQUEST_OPEN",{...e,head:i.branch,base:i.base,title:i.title,body:rd(i.body,s)||void 0});return{number:r.number,htmlUrl:r.url}}class xl extends Error{reason;detail;constructor(e,i){super(i||`Merge refused: ${e}`),this.name="ChangeRequestMergeRefused",this.reason=e,this.detail=i}}async function Cl(t,e,i){const s=ur(i.coAuthor),r=s?bl(i.commitMessage?.trim()??"",s):i.commitMessage?.trim()||void 0,n=await Tn(t,"CHANGE_REQUEST_MERGE",{...e,number:i.number,strategy:"squash",commitTitle:i.commitTitle,commitMessage:r});if(!n.merged)throw new xl(n.reason??"error",n.detail)}function Pd(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 $r extends Error{constructor(){super("The branch changed since these changes were shown"),this.name="PublishHeadMovedError"}}class zn extends Error{constructor(e,i,s){super(e),this.step=i,this.pr=s,this.name="PublishStepError"}step;pr}const qs=255;function kl(t){if(t.length<=qs)return t;const e=t.slice(0,qs-1),i=e.lastIndexOf(" ");return`${(i>0?e.slice(0,i):e).trimEnd()}…`}function Rd(t){const e=t.title.trim(),i=t.body.trim(),s=[e,i].filter(Boolean).join(`
6
6
 
7
7
  `);if(e.length>qs)return{title:kl(e),body:s,message:s};const r=e||t.fallbackTitle;return{title:r,body:i||void 0,message:s||r}}function Bd(t,e){const i=t.trim().split(`
8
8
  `);return Rd({title:i[0]??"",body:i.slice(1).join(`
9
- `),fallbackTitle:e})}function Vs(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function Dd(t){return t.fastPreview?{fastPreview:!0}:void 0}async function yr(t,e,i){try{return await i()}catch(s){throw new zn(s instanceof Error?s.message:e,t)}}async function El(t){const{expectedHeadSha:e,expectedDiffSignature:i}=t;if(!e&&!i)return;const s=await jn(Vs(t)).catch(()=>null);if(!s)return;if(e&&s.headSha&&s.headSha!==e)throw new $r;if(!i)return;const r=await ll(Vs(t),s,t.baseBranch,Dd(t)).catch(()=>null);if(r&&Hn(r)!==i)throw new $r}function Pl(t,e){return Nc(Vs(t),e)}function Rl(t,e){return Ed(t.orgSlug,t.target,{branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor})}async function Ad(t,e,i){await El(t),await yr("push",i("thread.publishDialog.failedPushChanges"),()=>Pl(t,e.message)),await yr("sync",i("thread.publishDialog.failedRebase"),()=>hl(Vs(t),t.baseBranch));const s=await yr("open-pr",i("thread.publishDialog.failedOpenPullRequest"),()=>Rl(t,e));try{await Cl(t.orgSlug,t.target,{number:s.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(r){throw new zn(r instanceof Error?r.message:i("thread.publishDialog.failedMergePullRequest"),"merge",s)}return s}async function Td(t,e){return await El(t),await Pl(t,e.message),Rl(t,e)}function Md(t,e){return t instanceof $r?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof zn&&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){const i=Md(t,e),s=i.pullRequest;return s&&Xe.error(i.message,{action:{label:e("thread.publishDialog.viewPr"),onClick:()=>window.open(s.htmlUrl,"_blank","noopener,noreferrer")}}),{message:i.message,pullRequestOpened:s!==null,headMoved:i.headMoved}}function Ld(t,e){Xe.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnProvider"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}const Nd=/(?:^|\/)\.deco\/blocks\/([^/]+)\.json$/;function Bl(t){const e=Nd.exec(t)?.[1];return e?Kc(e):null}function Ys(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 Od(t,e){return t===null?"new":e===null?"removed":"edited"}function Dl(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,i=>i.toLowerCase()):t}function xr(t,e){if(t&&typeof t=="object"&&!Array.isArray(t)){const i=t.__resolveType;if(typeof i=="string"&&i.trim()){const r=(i.split("/").pop()??i).replace(/\.[jt]sx?$/,"");return Dl(r)||r}}return`Section ${e+1}`}function Ur(t){const e=t.sections;if(Array.isArray(e))return e.flatMap((i,s)=>i&&typeof i=="object"&&!Array.isArray(i)?[{section:i,basePath:["sections",s]}]:[]);if(e&&typeof e=="object"){const i=e.variants;if(Array.isArray(i))return i.flatMap((s,r)=>{const n=s&&typeof s=="object"&&!Array.isArray(s)?s.value:null;return Array.isArray(n)?n.flatMap((o,a)=>o&&typeof o=="object"&&!Array.isArray(o)?[{section:o,basePath:["sections","variants",r,"value",a]}]:[]):[]})}return[]}function vo(t){return JSON.stringify(t,(e,i)=>{if(i&&typeof i=="object"&&!Array.isArray(i)){const s=i;return Object.keys(s).sort().reduce((r,n)=>(r[n]=s[n],r),{})}return i})}function Al(t,e){return t===void 0&&e===void 0?!0:vo(t)===vo(e)}function Gs(t,e,i,s=new Set){const r=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),n=[];for(const o of r){if(o.startsWith("__")||s.has(o))continue;const a=t?t[o]:void 0,h=e?e[o]:void 0;Al(a,h)||n.push({label:Dl(o),path:[...i,o],from:a,to:h})}return n}const Id=new Set(["sections"]);function Tl(t,e){const i=t?Ur(t):[],s=e?Ur(e):[],r=[],n=Math.max(i.length,s.length);for(let a=0;a<n;a++){const h=i[a],l=s[a];if(h&&l){if(Al(h.section,l.section))continue;r.push({name:xr(l.section,a),kind:"section",status:"edited",fields:Gs(h.section,l.section,l.basePath)})}else l?r.push({name:xr(l.section,a),kind:"section",status:"new",fields:[]}):h&&r.push({name:xr(h.section,a),kind:"section",status:"removed",fields:[]})}const o=Gs(t,e,[],Id);return o.length>0&&r.push({name:"Page settings",kind:"settings",status:"edited",fields:o}),r}function Kr(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 jd(t){const e=[],i=[],s=[],r=[];for(const[n,o]of Object.entries(t?.diffs??{})){if(cl(n)){r.push(n);continue}const a=Od(o.from,o.to),h=Bl(n);if(!h){s.push(Kr(n,a));continue}const l=Ys(o.from),u=Ys(o.to),d=u??l;if(!d){s.push(Kr(n,a));continue}const f=Hr(h,d);if(f){e.push({kind:"page",blockKey:h,name:f.name,pagePath:f.path,isSiteApp:!1,status:a,filepaths:[n],sections:a==="edited"?Tl(l,u):[],fromJson:l,toJson:u});continue}const _=Va(h,d);i.push({kind:"block",blockKey:h,name:Fr(h,d),pagePath:null,isSiteApp:_,status:a,filepaths:[n],sections:a==="edited"?[{name:Fr(h,d),kind:"section",status:"edited",fields:Gs(l,u,[])}].filter(p=>p.fields.length>0):[],fromJson:l,toJson:u})}return Ml({pages:e,blocks:i,other:s,generated:r})}function Cr(t,e){return(t.filepaths[0]??"").localeCompare(e.filepaths[0]??"")}function Ml(t){const{pages:e,blocks:i,other:s,generated:r}=t;return e.sort(Cr),i.sort(Cr),s.sort(Cr),{pages:e,blocks:i,other:s,generated:r,count:e.length+i.length+s.length}}function Hd(t){return t==="added"?"new":t==="removed"?"removed":"edited"}function Fd(t){return t.startsWith("pages-")}function Ll(t){const{files:e,lookup:i,diff:s}=t,r=[],n=[],o=[],a=[];for(const h of e){const l=h.path;if(cl(l)){a.push(l);continue}const u=Hd(h.status),d=Bl(l);if(!d){o.push(Kr(l,u));continue}const f=s?.diffs[l],_=Ys(f?.from??null),p=Ys(f?.to??null),m=zd(i,d),g=m??p??_;if((m?Hr(d,m):null)??(!m&&Fd(d))){const b=g?Hr(d,g):null;r.push({kind:"page",blockKey:d,name:b?.name??mc(d),pagePath:b?.path??null,isSiteApp:!1,status:u,filepaths:[l],sections:u==="edited"?Tl(_,p):[],fromJson:_,toJson:p??(u==="new"?m:null)});continue}const k=Fr(d,g??{});n.push({kind:"block",blockKey:d,name:k,pagePath:null,isSiteApp:Va(d,m??{}),status:u,filepaths:[l],sections:u==="edited"?[{name:k,kind:"section",status:"edited",fields:Gs(_,p,[])}].filter(b=>b.fields.length>0):[],fromJson:_,toJson:p})}return Ml({pages:r,blocks:n,other:o,generated:a})}function zd(t,e){const i=t?.[e];return i&&typeof i=="object"&&!Array.isArray(i)?i:null}function Wd(t,e){return t??e}function Nl(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const kr=3;function Bs(t){if(t.length<=kr)return Nl(t);const e=t.length-kr;return`${t.slice(0,kr).join(", ")} and ${e} more`}function $d(t){const e=t.sections.filter(i=>i.kind==="section").map(i=>i.name).slice(0,3);return e.length>0?`${t.name} (${e.join(", ")})`:t.name}function Ud(t){const e=[],i=t.pages.filter(a=>a.status==="edited"),s=t.pages.filter(a=>a.status==="new"),r=t.pages.filter(a=>a.status==="removed");if(i.length>0&&e.push(`updated ${Bs(i.map($d))}`),s.length>0){const a=s.length===1?"page":"pages";e.push(`added the ${Bs(s.map(h=>h.name))} ${a}`)}if(r.length>0){const a=r.length===1?"page":"pages";e.push(`removed the ${Bs(r.map(h=>h.name))} ${a}`)}const n=t.blocks.map(a=>a.name);if(n.length>0&&e.push(`changed ${Bs(n)}`),t.other.length>0){const a=t.other.length===1?"file":"files";e.push(`changed ${t.other.length} ${a}`)}if(e.length===0)return"";const o=Nl(e);return kl(o.charAt(0).toUpperCase()+o.slice(1))}function Kd(t){return t?Ur(t).length:0}function qd(t){const e={newPageSections:t.kind==="page"&&t.status==="new"?Kd(t.toJson):null,sections:0,settings:!1,fields:0};if(e.newPageSections!==null)return e;for(const i of t.sections){if(i.kind==="settings"){e.settings=!0;continue}t.kind==="page"?e.sections+=1:e.fields+=i.fields.length}return e}function Qt(t){return t.filepaths[0]??t.blockKey??t.name}function Vd(t,e){return e(t==="new"?"thread.publishPopover.chipNew":t==="removed"?"thread.publishPopover.chipRemoved":"thread.publishPopover.chipEdited")}function Yd(t,e){const i=t.kind==="block"?Tc:$a;return c.jsx("span",{title:Vd(t.status,e),className:"flex shrink-0",children:c.jsx(i,{className:le("size-4",t.status==="new"&&"text-brand",t.status==="edited"&&"text-warning",t.status==="removed"&&"text-destructive")})})}function Gd(t,e){return t.kind==="page"?t.pagePath:t.kind!=="block"?null:t.isSiteApp?e("thread.publishPopover.siteConfiguration"):e("thread.publishPopover.globalSection")}function Xd(t,e){const i=qd(t);if(i.newPageSections!==null)return[i.newPageSections===1?e("thread.publishPopover.newPageSectionOne"):e("thread.publishPopover.newPageSections",{count:i.newPageSections})];const s=[];return i.sections===1?s.push(e("thread.publishPopover.sectionChangedOne")):i.sections>1&&s.push(e("thread.publishPopover.sectionsChanged",{count:i.sections})),i.fields===1?s.push(e("thread.publishPopover.fieldChangedOne")):i.fields>1&&s.push(e("thread.publishPopover.fieldsChanged",{count:i.fields})),i.settings&&s.push(e("thread.publishPopover.pageSettingsChanged")),s}function Jd(t){const e=U.c(41),{change:i,bodyPending:s,selected:r,onSelect:n,confirming:o,onConfirmingChange:a,onDiscard:h,isPublishing:l,isDiscarding:u}=t,d=s===void 0?!1:s,f=Be();let _;e[0]!==i||e[1]!==f?(_=Gd(i,f),e[0]=i,e[1]=f,e[2]=_):_=e[2];const p=_;let m;if(e[3]!==d||e[4]!==i||e[5]!==o||e[6]!==p||e[7]!==u||e[8]!==l||e[9]!==a||e[10]!==h||e[11]!==n||e[12]!==r||e[13]!==f){const g=Xd(i,f),v=d&&g.length===0&&i.status==="edited",k=r&&"border-foreground/30 bg-accent hover:bg-accent";let b;e[15]!==k?(b=le("cursor-pointer transition-colors hover:bg-accent/50",k),e[15]=k,e[16]=b):b=e[16];let w;e[17]!==i?(w=Qt(i),e[17]=i,e[18]=w):w=e[18];let C;e[19]!==i||e[20]!==f?(C=Yd(i,f),e[19]=i,e[20]=f,e[21]=C):C=e[21];let S;e[22]!==i.name?(S=c.jsx("span",{className:"truncate text-sm font-medium",children:i.name}),e[22]=i.name,e[23]=S):S=e[23];let R;e[24]!==p?(R=p?c.jsx("span",{className:"truncate text-xs text-muted-foreground",children:p}):null,e[24]=p,e[25]=R):R=e[25];let N;e[26]!==r||e[27]!==S||e[28]!==R?(N=c.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left","aria-pressed":r,children:[S,R]}),e[26]=r,e[27]=S,e[28]=R,e[29]=N):N=e[29];let I;e[30]!==o||e[31]!==u||e[32]!==l||e[33]!==a||e[34]!==h||e[35]!==f?(I=o?c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[c.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:y=>{y.stopPropagation(),a(!1)},children:f("thread.publishDialog.cancel")}),c.jsx("button",{type:"button",className:"text-xs font-medium text-destructive disabled:opacity-50",onClick:y=>{y.stopPropagation(),a(!1),h?.()},disabled:u,children:f("thread.publishPopover.discard")})]}):h?c.jsx(nr,{children:c.jsxs(bt,{children:[c.jsx(St,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":f("thread.publishPopover.discard"),className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-destructive disabled:opacity-50 rounded-lg",onClick:y=>{y.stopPropagation(),a(!0)},disabled:l||u,children:c.jsx(lr,{className:"size-3.5"})})}),c.jsx(wt,{children:f("thread.publishPopover.discard")})]})}):null,e[30]=o,e[31]=u,e[32]=l,e[33]=a,e[34]=h,e[35]=f,e[36]=I):I=e[36];let L;e[37]!==N||e[38]!==I||e[39]!==C?(L=c.jsxs("div",{className:"flex items-center gap-2.5",children:[C,N,I]}),e[37]=N,e[38]=I,e[39]=C,e[40]=L):L=e[40],m=c.jsxs(yl,{className:b,"data-change-id":w,onClick:n,children:[L,g.length>0?c.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-muted-foreground",children:g.map(Zd)}):v?c.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px]",children:c.jsx(ti,{className:"h-4 w-2/3"})}):null]}),e[3]=d,e[4]=i,e[5]=o,e[6]=p,e[7]=u,e[8]=l,e[9]=a,e[10]=h,e[11]=n,e[12]=r,e[13]=f,e[14]=m}else m=e[14];return m}function Zd(t,e){return c.jsx("div",{className:"truncate",children:t},`${e}-${t}`)}function Qd(){const t=U.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={width:-1,height:-1},t[0]=e):e=t[0];const[i,s]=X.useState(e);let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=a=>{if(!a)return;const h=()=>s(u=>u.width===a.clientWidth&&u.height===a.clientHeight?u:{width:a.clientWidth,height:a.clientHeight});h();const l=new ResizeObserver(h);return l.observe(a),()=>l.disconnect()},t[1]=r):r=t[1];const n=r;let o;return t[2]!==i?(o=[i,n],t[2]=i,t[3]=o):o=t[3],o}function eu(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}const tu=[{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 bo(t){const e=U.c(10),{height:i}=t,s=Be();let r;e[0]!==i?(r={height:i},e[0]=i,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=tu.map(iu),e[2]=n):n=e[2];let o;e[3]!==s?(o=s("thread.publishDialog.openingComparison"),e[3]=s,e[4]=o):o=e[4];let a;e[5]!==o?(a=c.jsx("div",{className:"flex items-center justify-center pt-1 text-[11px] text-muted-foreground",children:o}),e[5]=o,e[6]=a):a=e[6];let h;return e[7]!==r||e[8]!==a?(h=c.jsxs("div",{style:r,className:"flex w-full flex-col gap-1.5 overflow-hidden px-3 py-2",children:[n,a]}),e[7]=r,e[8]=a,e[9]=h):h=e[9],h}function iu(t,e){return c.jsxs("div",{className:le("flex items-center gap-2 rounded px-1 py-0.5",t.tone==="del"&&"bg-destructive/5",t.tone==="add"&&"bg-success/5"),children:[c.jsx("div",{className:le("h-2 w-4 shrink-0 animate-pulse rounded-sm bg-muted",t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")}),c.jsx("div",{className:le("h-2 animate-pulse rounded-sm bg-muted",t.width,t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")})]},e)}const Ol={readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12},su={...Ol,lineNumbersMinChars:3,lineDecorationsWidth:4,folding:!1,glyphMargin:!1,renderOverviewRuler:!1};function ru(t){const e=U.c(11),{diff:i,emptyMessage:s,rowClassName:r,onDiscardFile:n,hideFileRows:o,editorHeight:a}=t,h=s===void 0?"No file changes in the working tree":s,l=r===void 0?"px-6":r,u=o===void 0?!1:o,d=a===void 0?"380px":a,[f,_]=X.useState(null),[p,m]=X.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=eu(),e[0]=g):g=e[0];const v=g;if(!i||Object.keys(i.diffs).length===0){let b;return e[1]!==h?(b=c.jsx("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:h}),e[1]=h,e[2]=b):b=e[2],b}let k;return e[3]!==i.diffs||e[4]!==p||e[5]!==d||e[6]!==f||e[7]!==u||e[8]!==n||e[9]!==l?(k=c.jsx("div",{className:"divide-y",children:Object.entries(i.diffs).map(b=>{const[w,C]=b,{from:S,to:R}=C,N=f===w,I=S===null,L=R===null,y=w.startsWith("/")?w.slice(1):w,E=y.lastIndexOf("/"),x=E>=0?y.slice(E+1):y,A=E>=0?y.slice(0,E):null,D=qc(w),P=I?"bg-success":L?"bg-destructive":"bg-warning";return u?c.jsx("div",{children:c.jsx(lo,{original:S??"",modified:R??"",language:D,theme:v,height:d,loading:c.jsx(bo,{height:d}),options:su})},w):c.jsxs("div",{children:[c.jsxs("div",{className:le("flex items-center gap-3 py-3 hover:bg-muted/30",l),children:[c.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:()=>_(N?null:w),children:c.jsx(Ea,{className:le("h-3.5 w-3.5 transition-transform",N&&"rotate-90")})}),c.jsx("div",{className:le("h-2.5 w-2.5 shrink-0 rounded-full",P)}),c.jsx($a,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:x}),A&&c.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:A}),n?c.jsxs(us,{children:[c.jsx(cs,{asChild:!0,children:c.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:c.jsx(Ih,{className:"h-3.5 w-3.5"})})}),c.jsx(ds,{align:"end",children:c.jsx(Ai,{className:"text-destructive focus:text-destructive",onSelect:()=>m(w),children:"Discard changes"})})]}):null]}),p===w&&n?c.jsxs("div",{className:le("flex items-center justify-between gap-3 border-t bg-destructive/5 py-2.5",l),children:[c.jsxs("span",{className:"text-xs text-destructive",children:["Discard all changes to"," ",c.jsx("span",{className:"font-medium",children:x}),"? This cannot be undone."]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(pe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>m(null),children:"Cancel"}),c.jsx(pe,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m(null),n(w)},children:"Discard"})]})]}):null,N&&c.jsx("div",{className:"border-t",children:c.jsx(lo,{original:S??"",modified:R??"",language:D,theme:v,height:d,loading:c.jsx(bo,{height:d}),options:Ol})})]},w)})}),e[3]=i.diffs,e[4]=p,e[5]=d,e[6]=f,e[7]=u,e[8]=n,e[9]=l,e[10]=k):k=e[10],k}function nu(t){if(t.kind!=="block"||t.isSiteApp||!t.blockKey)return null;const e=(t.toJson??t.fromJson)?.__resolveType;return typeof e=="string"&&gc(e)?t.blockKey:null}function ou(t){return t.kind!=="page"?!0:!t.pagePath||os(t.pagePath).length>0}function au(t,e){try{return Yc(t,vc,e)}catch{return null}}function lu(t,e){if(t.kind!=="page")return"/";const i=t.pagePath;if(!i)return"";if(os(i).length===0)return i;if(e?.path!==i)return"";const s=Ya(i,e.params);return os(s).length===0?s:""}function hu(t,e){const i=e.trim();if(!i||os(i).length>0)return null;try{const s=new URL(t),r=new URL(i.startsWith("/")?i:`/${i}`,s);return r.origin===s.origin?r:null}catch{return null}}function cu(t,e){if(!e)return null;if(e.kind==="pointer")return ml(t.toString(),e.pointer);try{return new URL(`${t.pathname}${t.search}`,e.previewUrl).href}catch{return null}}function du(t,e,i){return e===null?!1:t!=="other"||i?.kind==="sandbox"}const uu=["split","before","after","code"];function fu(t){return uu.includes(t)}const _u={desktop:1280,mobile:412};function pu(t){const e=U.c(90),{change:i,diff:s,bodyPending:r,previewServerUrl:n,draft:o,lastPage:a}=t,h=Be();let l;e[0]!==i.kind||e[1]!==o||e[2]!==n?(l=du(i.kind,n,o),e[0]=i.kind,e[1]=o,e[2]=n,e[3]=l):l=e[3];const u=l,[d,f]=X.useState(null),_=u?d??"split":"code",[p,m]=X.useState("desktop"),[g,v]=X.useState(null);let k,b,w,C,S,R;if(e[4]!==i||e[5]!==o||e[6]!==a||e[7]!==n||e[8]!==g){b=g??lu(i,a),C=nu(i);let ie;e[15]!==i?(ie=ou(i),e[15]=i,e[16]=ie):ie=e[16],w=ie,R=n?C?au(n,C):hu(n,b):null,k=R?ml(R.toString(),Gc):null,S=R?cu(R,o):null,e[4]=i,e[5]=o,e[6]=a,e[7]=n,e[8]=g,e[9]=k,e[10]=b,e[11]=w,e[12]=C,e[13]=S,e[14]=R}else k=e[9],b=e[10],w=e[11],C=e[12],S=e[13],R=e[14];const N=S;let I;if(e[17]!==i.filepaths||e[18]!==s?.diffs){let ie;e[20]!==s?.diffs?(ie=de=>{const z=s?.diffs[de];return z?[[de,z]]:[]},e[20]=s?.diffs,e[21]=ie):ie=e[21],I={diffs:Object.fromEntries(i.filepaths.flatMap(ie))},e[17]=i.filepaths,e[18]=s?.diffs,e[19]=I}else I=e[19];const L=I;let y;e[22]!==L.diffs?(y=Object.keys(L.diffs),e[22]=L.diffs,e[23]=y):y=e[23];const E=y.length>0;let x;e[24]!==i.kind||e[25]!==i.pagePath||e[26]!==C||e[27]!==h?(x=C!==null?null:i.kind!=="page"?h("thread.publishCompare.globalHint"):i.pagePath&&os(i.pagePath).length>0?h("thread.publishCompare.dynamicHint",{template:i.pagePath}):null,e[24]=i.kind,e[25]=i.pagePath,e[26]=C,e[27]=h,e[28]=x):x=e[28];const A=x;let D;e[29]!==k||e[30]!==i.kind||e[31]!==i.status||e[32]!==p||e[33]!==h?(D=i.status==="new"&&i.kind!=="other"?c.jsx(yo,{icon:c.jsx(Mn,{className:"size-5 text-brand"}),title:h("thread.publishCompare.newTitle"),description:h("thread.publishCompare.newDescription")}):c.jsx(xo,{url:k,device:p,title:h("thread.publishCompare.before"),missing:h("thread.publishCompare.enterPath")}),e[29]=k,e[30]=i.kind,e[31]=i.status,e[32]=p,e[33]=h,e[34]=D):D=e[34];const P=D;let B;e[35]!==N||e[36]!==i.kind||e[37]!==i.status||e[38]!==p||e[39]!==h||e[40]!==R?(B=i.status==="removed"&&i.kind!=="other"?c.jsx(yo,{icon:c.jsx(lr,{className:"size-5 text-destructive"}),title:h("thread.publishCompare.removedTitle"),description:h("thread.publishCompare.removedDescription")}):c.jsx(xo,{url:N,device:p,title:h("thread.publishCompare.after"),missing:h(R?"thread.publishCompare.draftUnavailable":"thread.publishCompare.enterPath")}),e[35]=N,e[36]=i.kind,e[37]=i.status,e[38]=p,e[39]=h,e[40]=R,e[41]=B):B=e[41];const M=B;let K;e[42]===Symbol.for("react.memo_cache_sentinel")?(K=ie=>{fu(ie)&&f(ie)},e[42]=K):K=e[42];let F;e[43]!==u||e[44]!==h?(F=u?c.jsxs(c.Fragment,{children:[c.jsx(Pi,{value:"split",className:"px-3 text-xs",children:h("thread.publishCompare.sideBySide")}),c.jsx(Pi,{value:"before",className:"px-3 text-xs",children:h("thread.publishCompare.before")}),c.jsx(Pi,{value:"after",className:"px-3 text-xs",children:h("thread.publishCompare.after")})]}):null,e[43]=u,e[44]=h,e[45]=F):F=e[45];let H;e[46]!==h?(H=h("thread.publishCompare.code"),e[46]=h,e[47]=H):H=e[47];let Y;e[48]!==H?(Y=c.jsx(Pi,{value:"code",className:"px-3 text-xs",children:H}),e[48]=H,e[49]=Y):Y=e[49];let q;e[50]!==Y||e[51]!==F?(q=c.jsxs(za,{className:"h-8 w-auto",variant:"pill",children:[F,Y]}),e[50]=Y,e[51]=F,e[52]=q):q=e[52];let te;e[53]!==q||e[54]!==_?(te=c.jsx(Wa,{value:_,onValueChange:K,children:q}),e[53]=q,e[54]=_,e[55]=te):te=e[55];let J;e[56]!==N||e[57]!==u||e[58]!==i.pagePath||e[59]!==p||e[60]!==b||e[61]!==w||e[62]!==C||e[63]!==h||e[64]!==_?(J=u&&_!=="code"?c.jsxs(c.Fragment,{children:[C?null:w?c.jsx(jh,{value:b,onChange:ie=>v(ie.target.value),placeholder:i.pagePath??"/","aria-label":h("thread.publishCompare.pathLabel"),className:"h-8 w-56 font-mono text-xs"}):c.jsx("span",{className:"max-w-56 truncate px-1 font-mono text-xs text-muted-foreground",children:b}),c.jsxs("div",{className:"flex items-center rounded-lg border p-0.5",children:[c.jsx(So,{active:p==="desktop",label:h("thread.publishCompare.desktop"),onClick:()=>m("desktop"),children:c.jsx(Vc,{className:"size-3.5"})}),c.jsx(So,{active:p==="mobile",label:h("thread.publishCompare.mobile"),onClick:()=>m("mobile"),children:c.jsx(hc,{className:"size-3.5"})})]}),N?c.jsxs("a",{href:N,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:[c.jsx(Hh,{className:"size-3.5"}),h("thread.publishCompare.openDraft")]}):null]}):null,e[56]=N,e[57]=u,e[58]=i.pagePath,e[59]=p,e[60]=b,e[61]=w,e[62]=C,e[63]=h,e[64]=_,e[65]=J):J=e[65];let Q;e[66]!==te||e[67]!==J?(Q=c.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b bg-background px-4 py-2.5 max-md:pr-12",children:[te,J]}),e[66]=te,e[67]=J,e[68]=Q):Q=e[68];let W;e[69]!==u||e[70]!==A||e[71]!==_?(W=A&&u&&_!=="code"?c.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-[11px] text-muted-foreground",children:A}):null,e[69]=u,e[70]=A,e[71]=_,e[72]=W):W=e[72];let G;e[73]!==r||e[74]!==E||e[75]!==L||e[76]!==h||e[77]!==_?(G=_==="code"?c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background [scrollbar-width:thin]",children:E?c.jsx(ru,{diff:L,hideFileRows:!0,editorHeight:"70vh"}):r?c.jsx(ti,{className:"m-4 h-64 rounded"}):c.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:h("thread.publishPopover.detailsUnavailable")})}):null,e[73]=r,e[74]=E,e[75]=L,e[76]=h,e[77]=_,e[78]=G):G=e[78];let ee;e[79]!==M||e[80]!==P||e[81]!==u||e[82]!==h||e[83]!==_?(ee=u?c.jsxs("div",{className:le("flex min-h-0 flex-1 gap-3 p-3",_==="code"&&"hidden"),children:[c.jsx(wo,{label:h("thread.publishCompare.before"),hidden:_==="after",children:P}),c.jsx(wo,{label:h("thread.publishCompare.after"),highlight:!0,hidden:_==="before",children:M})]}):null,e[79]=M,e[80]=P,e[81]=u,e[82]=h,e[83]=_,e[84]=ee):ee=e[84];let ue;return e[85]!==Q||e[86]!==W||e[87]!==G||e[88]!==ee?(ue=c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/40",children:[Q,W,G,ee]}),e[85]=Q,e[86]=W,e[87]=G,e[88]=ee,e[89]=ue):ue=e[89],ue}function So(t){const e=U.c(8),{active:i,label:s,onClick:r,children:n}=t,o=i&&"bg-accent text-foreground";let a;e[0]!==o?(a=le("flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground",o),e[0]=o,e[1]=a):a=e[1];let h;return e[2]!==i||e[3]!==n||e[4]!==s||e[5]!==r||e[6]!==a?(h=c.jsx("button",{type:"button","aria-label":s,"aria-pressed":i,title:s,onClick:r,className:a,children:n}),e[2]=i,e[3]=n,e[4]=s,e[5]=r,e[6]=a,e[7]=h):h=e[7],h}function wo(t){const e=U.c(18),{label:i,highlight:s,hidden:r,children:n}=t,o=s===void 0?!1:s,h=(r===void 0?!1:r)&&"hidden";let l;e[0]!==h?(l=le("flex min-h-0 min-w-0 flex-1 flex-col gap-1.5",h),e[0]=h,e[1]=l):l=e[1];const u=o&&"bg-brand";let d;e[2]!==u?(d=le("size-1.5 rounded-full bg-muted-foreground/50",u),e[2]=u,e[3]=d):d=e[3];let f;e[4]!==d?(f=c.jsx("span",{className:d}),e[4]=d,e[5]=f):f=e[5];let _;e[6]!==i||e[7]!==f?(_=c.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:[f,i]}),e[6]=i,e[7]=f,e[8]=_):_=e[8];const p=o&&"border-brand/60";let m;e[9]!==p?(m=le("relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-background",p),e[9]=p,e[10]=m):m=e[10];let g;e[11]!==n||e[12]!==m?(g=c.jsx("div",{className:m,children:n}),e[11]=n,e[12]=m,e[13]=g):g=e[13];let v;return e[14]!==g||e[15]!==l||e[16]!==_?(v=c.jsxs("div",{className:l,children:[_,g]}),e[14]=g,e[15]=l,e[16]=_,e[17]=v):v=e[17],v}function yo(t){const e=U.c(10),{icon:i,title:s,description:r}=t;let n;e[0]!==i?(n=c.jsx("div",{className:"mb-1",children:i}),e[0]=i,e[1]=n):n=e[1];let o;e[2]!==s?(o=c.jsx("p",{className:"text-sm font-medium",children:s}),e[2]=s,e[3]=o):o=e[3];let a;e[4]!==r?(a=c.jsx("p",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=a):a=e[5];let h;return e[6]!==n||e[7]!==o||e[8]!==a?(h=c.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 px-6 text-center",children:[n,o,a]}),e[6]=n,e[7]=o,e[8]=a,e[9]=h):h=e[9],h}function xo(t){const e=U.c(24),{url:i,device:s,title:r,missing:n}=t,[o,a]=Qd(),[h,l]=X.useState(null);if(!i){let S;return e[0]!==n?(S=c.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:n}),e[0]=n,e[1]=S):S=e[1],S}let u;e[2]!==s||e[3]!==i?(u=Pc(i,s),e[2]=s,e[3]=i,e[4]=u):u=e[4];const d=u,f=_u[s],_=o.width>0?Math.min(o.width/f,1):1,p=o.width>0?Math.max((o.width-f*_)/2,0):0;let m;e[5]!==d?(m=()=>l(d),e[5]=d,e[6]=m):m=e[6];const g=o.height>0?o.height/_:"100%",v=`scale(${_})`;let k;e[7]!==f||e[8]!==p||e[9]!==g||e[10]!==v?(k={left:p,width:f,height:g,transform:v,transformOrigin:"top left"},e[7]=f,e[8]=p,e[9]=g,e[10]=v,e[11]=k):k=e[11];let b;e[12]!==d||e[13]!==m||e[14]!==k||e[15]!==r?(b=c.jsx("iframe",{src:d,title:r,sandbox:"allow-scripts allow-same-origin",onLoad:m,className:"absolute top-0 border-0 bg-white",style:k},d),e[12]=d,e[13]=m,e[14]=k,e[15]=r,e[16]=b):b=e[16];let w;e[17]!==h||e[18]!==d?(w=h!==d?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:c.jsx(rs,{className:"size-5 motion-reduce:animate-none"})}):null,e[17]=h,e[18]=d,e[19]=w):w=e[19];let C;return e[20]!==a||e[21]!==b||e[22]!==w?(C=c.jsxs("div",{ref:a,className:"absolute inset-0",children:[b,w]}),e[20]=a,e[21]=b,e[22]=w,e[23]=C):C=e[23],C}const mu=/^Co-authored-by:\s*([^<\r\n]+?)(?:\s*<[^>\r\n]*>)?\s*$/im;function gu(t){if(!t)return null;const e=mu.exec(t)?.[1]?.trim();return e||null}function vu(t){return/\[bot\]$/i.test(t)||/-bot$/i.test(t)}function bu(t){const e=gu(t.body);if(e)return e;const i=t.author.trim();return!i||vu(i)?null:i}function Su(t){const{mode:e,target:i,note:s,allPaths:r,destinationHost:n,publishLockRef:o,onOpenChange:a,refresh:h,onPullRequestChanged:l,onPublished:u}=t,d=Be(),[f,_]=X.useState(!1),[p,m]=X.useState(!1),[g,v]=X.useState(),k=()=>Bd(s,d("thread.publishDialog.changesFrom",{branch:i.headBranch})),b=async()=>{o.current=!0,_(!0),v(void 0);try{await Ad(i,k(),d),Xe.success(n?d("thread.publishPopover.publishedTo",{host:n}):d("thread.publishDialog.publishedTo",{baseBranch:i.baseBranch})),a(!1),await Promise.all([l?.(),u?.()])}catch(S){const R=go(S,d);v(R.message),R.pullRequestOpened&&await l?.(),R.headMoved&&await h()}finally{o.current=!1,_(!1)}},w=async()=>{o.current=!0,_(!0),v(void 0);try{const S=await Td(i,k());Ld(S,d),a(!1),await l?.()}catch(S){const R=go(S,d);v(R.message||d("thread.publishDialog.failedSubmitForReview")),R.headMoved&&await h()}finally{o.current=!1,_(!1)}},C=async(S,R)=>{m(!0);try{await Oc({orgSlug:i.orgSlug,virtualMcpId:i.virtualMcpId,branch:i.branch,threadId:i.threadId},S),Xe.success(R),await h()}catch(N){Xe.error(N instanceof Error?N.message:d("thread.publishPopover.failedDiscard"))}finally{m(!1)}};return{isPublishing:f,isDiscarding:p,publishError:g,submit:e==="review"?w:b,discardChange:S=>C(S.filepaths,d("thread.publishPopover.discarded",{name:S.name})),discardAll:async()=>{r.length!==0&&await C(r,d("thread.publishDialog.allChangesDiscarded"))}}}function wu(t,e,i,s,r,n){return["cms-publish-bodies",t,e,i,s,r,n]}const yu=6e4;function xu(t,e){return e?null:t.files.map(i=>`${i.index}${i.working_dir} ${i.path}`).sort().join(`
10
- `)}function Cu(t,e,i){const s=U.c(6);let r;s[0]!==i||s[1]!==t||s[2]!==e?(r=An.decofile(`${t}/${e}/${i}`),s[0]=i,s[1]=t,s[2]=e,s[3]=r):r=s[3];let n;s[4]!==r?(n={queryKey:r,queryFn:zh},s[4]=r,s[5]=n):n=s[5];const{data:o}=zi(n);return o}function ku(t){const{orgSlug:e,virtualMcpId:i,branch:s,threadId:r,baseBranch:n,fastPreview:o,recoverSandbox:a}=t,h={orgSlug:e,virtualMcpId:i,branch:s,threadId:r},l=o?{fastPreview:!0}:void 0,u=X.useRef(null),d=async C=>{try{return await C()}catch(S){if(!a||!ul(S))throw S;return u.current??=a(),await u.current,C()}},f=Fh({...dl(h),queryFn:()=>d(()=>jn(h))}),_=f.data,p=_.changedFiles??null,m=_.headSha??null,g=p?p.length>0:Ic(_)||jc(_),v=zi({queryKey:wu(e,i,s,n,m,xu(_,o)),queryFn:()=>d(()=>ll(h,_,n,l)),enabled:g,staleTime:o?yu:0,gcTime:o?void 0:0,throwOnError:(C,S)=>!p&&S.state.data===void 0}),k=Cu(e,i,s),b=v.data??null,w=p?Ll({files:p,lookup:k,diff:b}):jd(b);return{status:_,summary:w,allPaths:p?p.map(C=>C.path):Object.keys(b?.diffs??{}),discardablePaths:o?null:new Set(_.files.map(C=>C.path)),changedFilesTotal:_.changedFilesTotal??w.count,changedFilesTruncated:_.changedFilesTruncated??!1,headSha:m,diff:b,bodiesPending:g&&v.isPending,bodiesFailed:v.isError,cardsPending:!p&&g&&v.isPending,refresh:()=>Promise.all([f.refetch(),o?null:v.refetch()])}}function Eu(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Pu(t){const e=U.c(27),{orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,status:a,diff:h,enabled:l}=t,[u]=Wh(),{language:d}=u;let f,_,p;if(e[0]!==r||e[1]!==h||e[2]!==l||e[3]!==o||e[4]!==d||e[5]!==i||e[6]!==a||e[7]!==n||e[8]!==s){const C=h?Hn(h):"";f=l&&!!r&&!!a&&!!h&&C!=="",p=zi,_=Eu({orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,signature:C,language:d}),e[0]=r,e[1]=h,e[2]=l,e[3]=o,e[4]=d,e[5]=i,e[6]=a,e[7]=n,e[8]=s,e[9]=f,e[10]=_,e[11]=p}else f=e[9],_=e[10],p=e[11];let m;e[12]!==r||e[13]!==h||e[14]!==d||e[15]!==i||e[16]!==a||e[17]!==n||e[18]!==s?(m=()=>Hc({orgSlug:i,virtualMcpId:s,branch:r,threadId:n},{status:a,diff:h,language:d}),e[12]=r,e[13]=h,e[14]=d,e[15]=i,e[16]=a,e[17]=n,e[18]=s,e[19]=m):m=e[19];let g;e[20]!==f||e[21]!==_||e[22]!==m?(g={queryKey:_,queryFn:m,enabled:f,staleTime:1/0,gcTime:6e5,retry:Ru},e[20]=f,e[21]=_,e[22]=m,e[23]=g):g=e[23];const v=p(g),k=v.data??null,b=f&&v.isFetching&&!v.data;let w;return e[24]!==k||e[25]!==b?(w={verdict:k,loading:b},e[24]=k,e[25]=b,e[26]=w):w=e[26],w}function Ru(t,e){return!ul(e)&&t<1}function Bu(t){const e=U.c(30),{orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,status:a,diff:h,policy:l,judgeEnabled:u,paths:d}=t,f=u===void 0?!0:u,_=d===void 0?null:d;let p;e[0]!==h||e[1]!==f||e[2]!==l?(p=f&&Fc(h,l),e[0]=h,e[1]=f,e[2]=l,e[3]=p):p=e[3];const m=p;let g;e[4]!==r||e[5]!==h||e[6]!==o||e[7]!==m||e[8]!==i||e[9]!==a||e[10]!==n||e[11]!==s?(g={orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,status:a,diff:h,enabled:m},e[4]=r,e[5]=h,e[6]=o,e[7]=m,e[8]=i,e[9]=a,e[10]=n,e[11]=s,e[12]=g):g=e[12];const{verdict:v,loading:k}=Pu(g);if(!h&&_){let S;e[13]!==_||e[14]!==l?(S=zc(_,l),e[13]=_,e[14]=l,e[15]=S):S=e[15];let R;return e[16]!==S?(R={gate:S,ready:!1},e[16]=S,e[17]=R):R=e[17],R}if(!h){let S;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S={gate:{allowed:!0,reason:null},ready:!1},e[18]=S):S=e[18],S}if(!m){let S;e[19]!==h||e[20]!==l?(S=Wc(h,l),e[19]=h,e[20]=l,e[21]=S):S=e[21];let R;return e[22]!==S?(R={gate:S,ready:!0},e[22]=S,e[23]=R):R=e[23],R}let b;e[24]!==k||e[25]!==v?(b=$c(v,k),e[24]=k,e[25]=v,e[26]=b):b=e[26];const w=!k;let C;return e[27]!==b||e[28]!==w?(C={gate:b,ready:w},e[27]=b,e[28]=w,e[29]=C):C=e[29],C}function Il(t){const e=U.c(16),i=X.useRef(!1),s=Be();let r;e[0]!==t?(r=d=>{!d&&i.current||t.onOpenChange(d)},e[0]=t,e[1]=r):r=e[1];const n=r;let o;e[2]!==t.mode||e[3]!==s?(o=t.mode==="review"?s("thread.publishPopover.submitForReview"):s("thread.publishPopover.publish"),e[2]=t.mode,e[3]=s,e[4]=o):o=e[4];let a;e[5]!==o?(a=c.jsx(Uh,{className:"sr-only",children:o}),e[5]=o,e[6]=a):a=e[6];let h;e[7]!==t?(h=t.open?c.jsx(Lu,{...t,publishLockRef:i}):null,e[7]=t,e[8]=h):h=e[8];let l;e[9]!==a||e[10]!==h?(l=c.jsxs(Kh,{"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:[a,h]}),e[9]=a,e[10]=h,e[11]=l):l=e[11];let u;return e[12]!==n||e[13]!==t.open||e[14]!==l?(u=c.jsx($h,{open:t.open,onOpenChange:n,children:l}),e[12]=n,e[13]=t.open,e[14]=l,e[15]=u):u=e[15],u}function Du(t){return["main","master"].includes(t.trim().toLowerCase())}const Au=4,Xs="flex h-[45%] min-h-0 min-w-0 shrink-0 md:h-auto md:flex-1";function Wn(t){const e=U.c(5),{list:i,pane:s}=t;let r;e[0]!==i?(r=c.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:i}),e[0]=i,e[1]=r):r=e[1];let n;return e[2]!==s||e[3]!==r?(n=c.jsxs(c.Fragment,{children:[s,r]}),e[2]=s,e[3]=r,e[4]=n):n=e[4],n}function jl(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:le(Xs,"bg-muted/40 p-3"),children:c.jsx(ti,{className:"h-full w-full rounded-lg"})}),t[0]=e):e=t[0],e}function $n(t){const e=U.c(11),{mode:i,title:s,subLine:r,trailing:n}=t,o=i==="review"?ar:cc;let a;e[0]!==o?(a=c.jsx(o,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=o,e[1]=a):a=e[1];let h;e[2]!==a||e[3]!==s||e[4]!==n?(h=c.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a,s,n]}),e[2]=a,e[3]=s,e[4]=n,e[5]=h):h=e[5];let l;e[6]!==r?(l=r?c.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:r}):null,e[6]=r,e[7]=l):l=e[7];let u;return e[8]!==h||e[9]!==l?(u=c.jsxs(c.Fragment,{children:[h,l]}),e[8]=h,e[9]=l,e[10]=u):u=e[10],u}function Un(t){const e=U.c(9),{draftPreviewUrl:i,t:s}=t;let r;e[0]!==i?(r=()=>{i&&window.open(i,"_blank","noopener,noreferrer")},e[0]=i,e[1]=r):r=e[1];const n=!i;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(al,{className:"size-4"}),e[2]=o):o=e[2];let a;e[3]!==s?(a=s("thread.publishPopover.preview"),e[3]=s,e[4]=a):a=e[4];let h;return e[5]!==r||e[6]!==n||e[7]!==a?(h=c.jsxs(pe,{type:"button",variant:"outline",onClick:r,disabled:n,children:[o,a]}),e[5]=r,e[6]=n,e[7]=a,e[8]=h):h=e[8],h}function Tu(t){const e=U.c(21),{mode:i,draftPreviewUrl:s}=t,r=Be();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx(jl,{}),e[0]=n):n=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(ti,{className:"h-3.5 w-48"}),e[1]=o):o=e[1];let a;e[2]!==i?(a=c.jsx($n,{mode:i,title:o}),e[2]=i,e[3]=a):a=e[3];let h,l;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Wr,{children:c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(is,{}),c.jsx(is,{}),c.jsx(is,{})]})}),l=c.jsxs(c.Fragment,{children:[c.jsx(ti,{className:"h-3 w-20"}),c.jsx(ti,{className:"h-14 w-full rounded-lg"})]}),e[4]=h,e[5]=l):(h=e[4],l=e[5]);let u;e[6]!==s||e[7]!==r?(u=c.jsx(Un,{draftPreviewUrl:s,t:r}),e[6]=s,e[7]=r,e[8]=u):u=e[8];const d=i==="review"?"default":"brand";let f;e[9]!==i||e[10]!==r?(f=r(i==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[9]=i,e[10]=r,e[11]=f):f=e[11];let _;e[12]!==d||e[13]!==f?(_=c.jsx(pe,{type:"button",variant:d,className:"flex-1",disabled:!0,children:f}),e[12]=d,e[13]=f,e[14]=_):_=e[14];let p;e[15]!==u||e[16]!==_?(p=c.jsxs("div",{className:"flex gap-2",children:[u,_]}),e[15]=u,e[16]=_,e[17]=p):p=e[17];let m;return e[18]!==p||e[19]!==a?(m=c.jsx(Wn,{pane:n,list:c.jsx(Fn,{state:"loading",header:a,body:h,note:l,footer:p})}),e[18]=p,e[19]=a,e[20]=m):m=e[20],m}function Mu(t){const e=U.c(26),{mode:i,draftPreviewUrl:s,message:r,onRetry:n}=t,o=Be();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("div",{className:le(Xs,"bg-muted/40")}),e[0]=a):a=e[0];let h;e[1]!==o?(h=o("thread.publishPopover.loadFailed"),e[1]=o,e[2]=h):h=e[2];let l;e[3]!==h?(l=c.jsx("span",{className:"truncate",children:h}),e[3]=h,e[4]=l):l=e[4];let u;e[5]!==i||e[6]!==l?(u=c.jsx($n,{mode:i,title:l}),e[5]=i,e[6]=l,e[7]=u):u=e[7];let d;e[8]!==r?(d=c.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:r}),e[8]=r,e[9]=d):d=e[9];let f;e[10]!==s||e[11]!==o?(f=c.jsx(Un,{draftPreviewUrl:s,t:o}),e[10]=s,e[11]=o,e[12]=f):f=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(ns,{className:"size-4"}),e[13]=_):_=e[13];let p;e[14]!==o?(p=o("thread.publishPopover.retry"),e[14]=o,e[15]=p):p=e[15];let m;e[16]!==n||e[17]!==p?(m=c.jsxs(pe,{type:"button",variant:"outline",className:"flex-1",onClick:n,children:[_,p]}),e[16]=n,e[17]=p,e[18]=m):m=e[18];let g;e[19]!==f||e[20]!==m?(g=c.jsxs("div",{className:"flex gap-2",children:[f,m]}),e[19]=f,e[20]=m,e[21]=g):g=e[21];let v;return e[22]!==g||e[23]!==u||e[24]!==d?(v=c.jsx(Wn,{pane:a,list:c.jsx(Fn,{state:"ready",header:u,body:d,footer:g})}),e[22]=g,e[23]=u,e[24]=d,e[25]=v):v=e[25],v}function Lu(t){const e=U.c(3),i=t.mode??"publish";let s;return e[0]!==i||e[1]!==t?(s=c.jsx(qh,{children:r=>{const{reset:n}=r;return c.jsx(Vh,{fallback:o=>{const{error:a,resetError:h}=o;return c.jsx(Mu,{mode:i,draftPreviewUrl:t.draftPreviewUrl,message:a?.message??"",onRetry:()=>{n(),h()}})},children:c.jsx(X.Suspense,{fallback:c.jsx(Tu,{mode:i,draftPreviewUrl:t.draftPreviewUrl}),children:c.jsx(Nu,{...t})})})}}),e[0]=i,e[1]=t,e[2]=s):s=e[2],s}function Nu(t){const e=U.c(139),{publishLockRef:i,onOpenChange:s,mode:r,fastPreview:n,recoverSandbox:o,orgSlug:a,virtualMcpId:h,branch:l,baseBranch:u,repoTarget:d,owner:f,repo:_,publishPolicy:p,draftPreviewUrl:m,destinationHost:g,previewServerUrl:v,compareDraft:k,lastPublishedPr:b,onRequestApproval:w,openPullRequest:C,onPullRequestChanged:S,onPublished:R}=t,N=r===void 0?"publish":r,I=b===void 0?null:b,L=C===void 0?null:C,y=Be(),E=Wi()?.taskId??null,{data:x}=sr.useSession(),A=il(sl(a,h,l));let D;e[0]!==u||e[1]!==l||e[2]!==n||e[3]!==a||e[4]!==o||e[5]!==E||e[6]!==h?(D={orgSlug:a,virtualMcpId:h,branch:l,threadId:E,baseBranch:u,fastPreview:n,recoverSandbox:o},e[0]=u,e[1]=l,e[2]=n,e[3]=a,e[4]=o,e[5]=E,e[6]=h,e[7]=D):D=e[7];const{status:P,summary:B,allPaths:M,discardablePaths:K,changedFilesTotal:F,changedFilesTruncated:H,headSha:Y,diff:q,bodiesPending:te,bodiesFailed:J,cardsPending:Q,refresh:W}=ku(D),[G,ee]=X.useState(null),[ue,ie]=X.useState(!1),[de,z]=X.useState(null);let ge;e[8]===Symbol.for("react.memo_cache_sentinel")?(ge=[],e[8]=ge):ge=e[8];const[fe,Le]=X.useState(ge);let oe;e[9]===Symbol.for("react.memo_cache_sentinel")?(oe=ae=>{z(ae),Le(ve=>[ae,...ve.filter(Se=>Se!==ae)])},e[9]=oe):oe=e[9];const $=oe,[De,At]=X.useState(null);let Ye;e[10]!==G||e[11]!==B?(Ye=Wd(G,Ud(B)),e[10]=G,e[11]=B,e[12]=Ye):Ye=e[12];const He=Ye,it=[...B.pages,...B.blocks,...B.other],Ne=it.find(ae=>Qt(ae)===de)??it[0]??null,yt=Ne?Qt(Ne):null,Wt=[...new Set([...yt?[yt]:[],...fe,...it.map(Qt)])].filter(ae=>it.some(ve=>Qt(ve)===ae)).slice(0,Au),ce=N==="review",Ke=Q?"loading":te?"manifest":"ready",qe=!ce;let V;e[13]!==M||e[14]!==l||e[15]!==n||e[16]!==q||e[17]!==P||e[18]!==a||e[19]!==p||e[20]!==qe||e[21]!==E||e[22]!==h?(V={orgSlug:a,virtualMcpId:h,branch:l,threadId:E,fastPreview:n,status:P,diff:q,paths:M,policy:p,judgeEnabled:qe},e[13]=M,e[14]=l,e[15]=n,e[16]=q,e[17]=P,e[18]=a,e[19]=p,e[20]=qe,e[21]=E,e[22]=h,e[23]=V):V=e[23];const{gate:_e}=Bu(V),Ae=L?.state==="open";let ye;e[24]!==l||e[25]!==P?(ye=fl(P)??l,e[24]=l,e[25]=P,e[26]=ye):ye=e[26];const Je=x?.user;let nt;e[27]!==Je?(nt=wl(Je),e[27]=Je,e[28]=nt):nt=e[28];const xt=Y??void 0;let ot;e[29]!==n||e[30]!==q?(ot=!n&&q?{expectedDiffSignature:Hn(q)}:{},e[29]=n,e[30]=q,e[31]=ot):ot=e[31];let Tt;e[32]!==u||e[33]!==l||e[34]!==n||e[35]!==a||e[36]!==f||e[37]!==_||e[38]!==d||e[39]!==ye||e[40]!==nt||e[41]!==xt||e[42]!==ot||e[43]!==E||e[44]!==h?(Tt={orgSlug:a,virtualMcpId:h,branch:l,threadId:E,fastPreview:n,baseBranch:u,target:d,owner:f,repo:_,headBranch:ye,coAuthor:nt,expectedHeadSha:xt,...ot},e[32]=u,e[33]=l,e[34]=n,e[35]=a,e[36]=f,e[37]=_,e[38]=d,e[39]=ye,e[40]=nt,e[41]=xt,e[42]=ot,e[43]=E,e[44]=h,e[45]=Tt):Tt=e[45];const $t=Tt;let Mt;e[46]!==M||e[47]!==g||e[48]!==N||e[49]!==He||e[50]!==s||e[51]!==R||e[52]!==S||e[53]!==i||e[54]!==W||e[55]!==$t?(Mt={mode:N,target:$t,note:He,allPaths:M,destinationHost:g,publishLockRef:i,onOpenChange:s,refresh:W,onPullRequestChanged:S,onPublished:R},e[46]=M,e[47]=g,e[48]=N,e[49]=He,e[50]=s,e[51]=R,e[52]=S,e[53]=i,e[54]=W,e[55]=$t,e[56]=Mt):Mt=e[56];const{isPublishing:ke,isDiscarding:Ct,publishError:Lt,submit:Ut,discardChange:ni,discardAll:Kt}=Su(Mt);let Nt;e[57]!==K?(Nt=ae=>K===null||ae.every(ve=>K.has(ve)),e[57]=K,e[58]=Nt):Nt=e[58];const Ot=Nt,qt=!ke&&B.count>0&&(ce||_e.allowed);let It;e[59]!==u||e[60]!==ce||e[61]!==B.count||e[62]!==y?(It=ce?B.count===0?y("thread.publishPopover.submitForReview"):B.count===1?y("thread.publishPopover.submitOneForReview"):y("thread.publishPopover.submitCountForReview",{count:B.count}):B.count===0?y("thread.publishPopover.publish"):Du(u)?B.count===1?y("thread.publishPopover.publishOneInProduction"):y("thread.publishPopover.publishCountInProduction",{count:B.count}):B.count===1?y("thread.publishPopover.publishOne"):y("thread.publishPopover.publishCount",{count:B.count}),e[59]=u,e[60]=ce,e[61]=B.count,e[62]=y,e[63]=It):It=e[63];const Vt=It;let jt;e:{if(ce&&Ae){let Se;e[64]!==L.number||e[65]!==y?(Se=y("thread.publishPopover.updatesPullRequest",{number:L.number}),e[64]=L.number,e[65]=y,e[66]=Se):Se=e[66],jt=Se;break e}const ae=I;if(!ae?.mergedAt){jt=null;break e}let ve;if(e[67]!==ae||e[68]!==y){const Se=Ac(new Date(ae.mergedAt)),se=bu(ae);ve=se?y("thread.publishPopover.lastPublishedBy",{when:Se,name:se}):y("thread.publishPopover.lastPublished",{when:Se}),e[67]=ae,e[68]=y,e[69]=ve}else ve=e[69];jt=ve}const Yt=jt;let Ht;e[70]!==ce||e[71]!==B.count||e[72]!==y?(Ht=ce?y("thread.publishPopover.submitForReview"):B.count===1?y("thread.publishPopover.publishOne"):B.count>1?y("thread.publishPopover.publishCount",{count:B.count}):y("thread.publishPopover.publish"),e[70]=ce,e[71]=B.count,e[72]=y,e[73]=Ht):Ht=e[73];const fi=Ht,Gt=(ae,ve)=>ve.length===0?null:c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("div",{className:"px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:ae}),ve.map(Se=>{const se=Qt(Se);return c.jsx(Jd,{change:Se,bodyPending:te,selected:Ne!==null&&Qt(Ne)===se,onSelect:()=>$(se),confirming:De===se,onConfirmingChange:st=>At(st?se:null),onDiscard:Ot(Se.filepaths)?()=>{ni(Se)}:void 0,isPublishing:ke,isDiscarding:Ct},se)})]});let kt;e:{if(ce||B.count===0){kt=null;break e}if(_e.pending){let se;e[74]===Symbol.for("react.memo_cache_sentinel")?(se=c.jsx(rs,{className:"size-3.5 motion-reduce:animate-none"}),e[74]=se):se=e[74];let st;e[75]!==y?(st=y("thread.publishPopover.reviewing"),e[75]=y,e[76]=st):st=e[76];let Oi;e[77]!==st?(Oi=c.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[se,st]}),e[77]=st,e[78]=Oi):Oi=e[78],kt=Oi;break e}if(_e.allowed){kt=null;break e}let ae;e[79]===Symbol.for("react.memo_cache_sentinel")?(ae=c.jsx(Pa,{className:"mt-0.5 size-3.5 shrink-0"}),e[79]=ae):ae=e[79];let ve;e[80]!==_e.reason||e[81]!==y?(ve=_e.reason??y("thread.publishPopover.needsReviewGeneric"),e[80]=_e.reason,e[81]=y,e[82]=ve):ve=e[82];let Se;e[83]!==ve?(Se=c.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[ae,c.jsx("span",{children:ve})]}),e[83]=ve,e[84]=Se):Se=e[84],kt=Se}const Xt=kt;let oi;e[85]!==M||e[86]!==Ot||e[87]!==H||e[88]!==Kt||e[89]!==ue||e[90]!==Ct||e[91]!==ke||e[92]!==B.count||e[93]!==y?(oi=B.count<=1||H||!Ot(M)?null:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"ml-auto shrink-0 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>ie(!0),disabled:ke||Ct,children:y("thread.publishPopover.discardAll")}),c.jsx(Fa,{open:ue,onOpenChange:ie,children:c.jsxs(Ha,{children:[c.jsxs(Na,{children:[c.jsx(Ma,{children:y("thread.publishPopover.discardAllTitle")}),c.jsx(La,{children:y("thread.publishPopover.discardAllConfirm")})]}),c.jsxs(ja,{children:[c.jsx(Oa,{children:y("thread.publishDialog.cancel")}),c.jsx(Ia,{onClick:()=>{Kt()},disabled:Ct,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:y("thread.publishPopover.discardAll")})]})]})})]}),e[85]=M,e[86]=Ot,e[87]=H,e[88]=Kt,e[89]=ue,e[90]=Ct,e[91]=ke,e[92]=B.count,e[93]=y,e[94]=oi):oi=e[94];const wi=oi,yi=Q?c.jsx(Wr,{children:c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(is,{}),c.jsx(is,{})]})}):B.count===0?c.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[c.jsx(ol,{className:"mb-1 size-5 text-success"}),c.jsx("p",{className:"text-sm font-medium",children:y(ce?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),c.jsx("p",{className:"text-xs text-muted-foreground",children:y(ce?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):c.jsxs(Wr,{children:[H?c.jsx("p",{className:"text-[11px] text-muted-foreground",children:y("thread.publishPopover.showingFirst",{shown:B.count,total:F})}):null,Gt(y("thread.publishPopover.pagesGroup"),B.pages),Gt(y("thread.publishPopover.blocksGroup"),B.blocks),Gt(y("thread.publishPopover.otherGroup"),B.other),J?c.jsx("p",{className:"text-[11px] text-muted-foreground",children:y("thread.publishPopover.detailsUnavailable")}):null]}),_i=Q?c.jsx(jl,{}):Ne?c.jsx("div",{className:le(Xs,"relative"),children:it.filter(ae=>Wt.includes(Qt(ae))).map(ae=>c.jsx("div",{className:le("absolute inset-0 flex",Qt(ae)!==yt&&"hidden"),children:c.jsx(pu,{change:ae,diff:q,bodyPending:te,previewServerUrl:v,draft:k,lastPage:A})},Qt(ae)))}):c.jsx("div",{className:le(Xs,"bg-muted/40")});let at;e[95]!==Vt?(at=c.jsx("span",{className:"truncate",children:Vt}),e[95]=Vt,e[96]=at):at=e[96];let lt;e[97]!==wi||e[98]!==N||e[99]!==Yt||e[100]!==at?(lt=c.jsx($n,{mode:N,title:at,subLine:Yt,trailing:wi}),e[97]=wi,e[98]=N,e[99]=Yt,e[100]=at,e[101]=lt):lt=e[101];let ht;e[102]!==ke||e[103]!==ce||e[104]!==He||e[105]!==B.count||e[106]!==y?(ht=B.count===0?null:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[13px] font-medium",children:y(ce?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),c.jsx(Dc,{value:He,onChange:ae=>ee(ae.target.value),placeholder:y(ce?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,maxLength:qs,className:"resize-none text-[13px]",disabled:ke})]}),e[102]=ke,e[103]=ce,e[104]=He,e[105]=B.count,e[106]=y,e[107]=ht):ht=e[107];let ct;e[108]!==m||e[109]!==y?(ct=c.jsx(Un,{draftPreviewUrl:m,t:y}),e[108]=m,e[109]=y,e[110]=ct):ct=e[110];let dt;e[111]!==qt||e[112]!==_e||e[113]!==ke||e[114]!==ce||e[115]!==w||e[116]!==fi||e[117]!==Ut||e[118]!==B.count||e[119]!==y?(dt=!ce&&B.count>0&&!_e.allowed&&!_e.pending?c.jsx(pe,{type:"button",className:"flex-1",onClick:w,disabled:ke,children:y("thread.publishPopover.requestApproval")}):c.jsxs(pe,{type:"button",variant:ce?"default":"brand",className:"flex-1",onClick:()=>{Ut()},disabled:!qt,children:[ke?c.jsx(rs,{className:"size-4 motion-reduce:animate-none"}):null,ke?y(ce?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):fi]}),e[111]=qt,e[112]=_e,e[113]=ke,e[114]=ce,e[115]=w,e[116]=fi,e[117]=Ut,e[118]=B.count,e[119]=y,e[120]=dt):dt=e[120];let ut;e[121]!==ct||e[122]!==dt?(ut=c.jsxs("div",{className:"flex gap-2",children:[ct,dt]}),e[121]=ct,e[122]=dt,e[123]=ut):ut=e[123];let ft;e[124]!==Lt?(ft=Lt?c.jsx("p",{className:"text-xs text-destructive",children:Lt}):null,e[124]=Lt,e[125]=ft):ft=e[125];let _t;e[126]!==ut||e[127]!==ft?(_t=c.jsxs(c.Fragment,{children:[ut,ft]}),e[126]=ut,e[127]=ft,e[128]=_t):_t=e[128];let pt;e[129]!==yi||e[130]!==Xt||e[131]!==Ke||e[132]!==lt||e[133]!==ht||e[134]!==_t?(pt=c.jsx(Fn,{state:Ke,header:lt,body:yi,note:ht,gate:Xt,footer:_t}),e[129]=yi,e[130]=Xt,e[131]=Ke,e[132]=lt,e[133]=ht,e[134]=_t,e[135]=pt):pt=e[135];let Ft;return e[136]!==_i||e[137]!==pt?(Ft=c.jsx(Wn,{pane:_i,list:pt}),e[136]=_i,e[137]=pt,e[138]=Ft):Ft=e[138],Ft}function Ou(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return bc[t].short}const Iu=new Set(["failure","timed_out","cancelled","action_required"]);function Hl(t){return t.status==="completed"&&Iu.has(t.conclusion)}function Kn(t){return t.status==="queued"||t.status==="in_progress"}function js(t){return t.isPending&&t.fetchStatus!=="idle"}function ju(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr-page"}}function ai(t,e,i){return e?[...t,ju(i)]:t}function zt(t,e,i){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:i("thread.cmsActions.getLatest"),action:"sync",tooltip:i("thread.cmsActions.getLatestTooltip")}]}function Co(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function Ds(t,e,i){if(e.filter(Kn).length===0)return t;const r=e.filter(n=>n.status==="completed").length;return{...t,tooltip:i("thread.cmsActions.checksRunning",{done:r,total:e.length})}}function Hu(t){const{lifecycle:e,branch:i,pr:s,checks:r,reviews:n,loading:o,t:a}=t;if(o)return{label:a("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&Ou(t.claimPhase.kind)||a("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:a("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:a("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||a("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:a("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:a("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(i.kind==="ready"&&(i.workingTreeDirty||i.aheadOfBase>0||i.unpushed>0))&&!t.noReviewableDiff)return{label:a("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(i.kind!=="ready")return{label:a("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForBranchTooltip"),menu:[]};const h=i,l=h.unpushed>0&&!(s&&h.headSha&&s.headSha&&h.headSha===s.headSha);if(t.noReviewableDiff&&!s)return{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:h.base}),menu:zt([],h,a)};if(h.workingTreeDirty||l)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:zt(ai([Co(a)],s,a),h,a)};if(gl("no local work — checking PR/sync state",{workingTreeDirty:h.workingTreeDirty,unpushed:h.unpushed,aheadOfBase:h.aheadOfBase,behindBase:h.behindBase,branch:h.branch,base:h.base,prMerged:s?.merged??null,prState:s?.state??null}),s?.merged)return!!h.headSha&&!!s.headSha&&h.headSha!==s.headSha?{label:a("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:a("thread.headerActions.openNewPrTooltip"),menu:zt(ai([],s,a),h,a)}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.prMergedTooltip",{prNumber:String(s.number),base:s.base}),menu:zt(ai([],s,a),h,a)};if(h.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:a("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:a("thread.headerActions.reopenPrTooltip",{prNumber:String(s.number)}),menu:zt(ai([],s,a),h,a)};if(!s)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:zt([Co(a)],h,a)};if((n?.mergeableState??"unknown")==="dirty")return{label:a("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:a("thread.cmsActions.resolveOnProvider"),action:"open-pr-page"}]};const d=r.filter(Kn).length,f=r.filter(Hl).map(p=>p.name);if(d===0&&f.length>0)return{label:a("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:a("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:zt(ai([{key:"publish-anyway",label:a("thread.headerActions.publishAnyway"),action:"merge",tooltip:a("thread.headerActions.squashMergeTooltip",{prNumber:String(s.number),base:s.base})}],s,a),h,a)};if(n?.draft)return Ds({label:a("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:a("thread.headerActions.markDraftReadyTooltip"),menu:zt(ai([],s,a),h,a)},r,a);const _=n?.unresolvedConversations??0;return _>0?Ds({label:a("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:a("thread.headerActions.unresolvedConversationsTooltip",{count:String(_)}),menu:zt(ai([],s,a),h,a)},r,a):n?.missingRequiredApprovals?Ds({label:a("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:a("thread.headerActions.waitingForApprovalsTooltip"),menu:zt(ai([],s,a),h,a)},r,a):Ds({label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:zt(ai([{key:"review",label:a("thread.headerActions.review"),action:"review"}],s,a),h,a)},r,a)}return h.behindBase>0?{label:a("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:h.base}),menu:[]}}function ko(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr"}}function As(t,e,i){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:i("thread.cmsActions.getLatest"),action:"get-latest",tooltip:i("thread.cmsActions.getLatestTooltip")}]}function Eo(t,e,i,s){const r=e.length;if(r===0)return t;if(e.filter(Kn).length>0){const a=e.filter(l=>l.status==="completed").length,h=s("thread.cmsActions.checksRunning",{done:a,total:r});return i==="loading"?{...t,loading:!0,tooltip:h}:{...t,tooltip:h}}const o=e.filter(Hl).length;return o>0?{...t,variant:"warning",tooltip:s("thread.cmsActions.checksFailing",{failed:o,total:r})}:t}function Fu(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function zu(t){return js(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:js(t.checksQuery)||js(t.reviewsQuery)}function Wu(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function $u(t){const{branch:e,pr:i,checks:s,reviews:r,publishing:n,saving:o,loading:a,publishableChangeCount:h,t:l}=t;if(e.kind!=="ready"&&t.statusError)return{label:l("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(a||e.kind!=="ready")return{label:l("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(n)return{label:l("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:l("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:l("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(i&&i.state==="open"&&!i.merged?i:null){const d=r?.mergeableState??"unknown";return d==="dirty"?{label:l("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:l("thread.cmsActions.resolveOnProvider"),action:"open-pr"}]}:d==="blocked"||r?.draft?Eo({label:l("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:As([ko(l)],e,l)},s,"loading",l):Eo({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:As([ko(l)],e,l)},s,"none",l)}return Fu(i,e)?{label:l("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:As([],e,l)}:Wu(e,h)?{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:As([{key:"request-approval",label:l("thread.headerActions.submitForReview"),action:"request-approval"}],e,l)}:e.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[],autoRun:e.aheadOfBase===0}:{label:l("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function Uu(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function Fl(t){const e=U.c(4);let i;e[0]!==t?(i=Ec(t),e[0]=t,e[1]=i):i=e[1];let s;return e[2]!==i?(s={...i,select:Ku},e[2]=i,e[3]=s):s=e[3],zi(s)}function Ku(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:Uu(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function Po(t,e){return t==="open-pr"||e==="resolve-on-provider"?c.jsx(tl,{size:16}):t==="publish"?c.jsx(Ua,{className:"size-4"}):t==="get-latest"||t==="retry-status"?c.jsx(ns,{className:"size-4"}):c.jsx(ar,{className:"size-4"})}function qu(t){const e=U.c(66),{virtualMcpId:i}=t,s=Be(),{org:r}=rr(),n=Yh(),o=hr(i),{data:a}=sr.useSession(),{deleteRelease:h}=Ln(i),{currentBranch:l,setCurrentTaskBranch:u,taskId:d,createTask:f}=Ra();let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_={open:!1,mode:"publish"},e[0]=_):_=e[0];const[p,m]=X.useState(_);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=V=>m({open:!0,mode:V}),e[1]=g):g=e[1];const v=g,k=Ja(o),b=k.status==="attached"||k.status==="public-clone"?k.repo:null,{previewServerUrl:w}=cr(i);let C;if(e[2]!==l||e[3]!==r.slug||e[4]!==i){const V=l?il(sl(r.slug,i,l)):null;C=V?Ya(V.path,V.params):"/",e[2]=l,e[3]=r.slug,e[4]=i,e[5]=C}else C=e[5];const S=C;let R;e[6]!==l||e[7]!==S||e[8]!==r.slug||e[9]!==w||e[10]!==i?(R=l?{orgSlug:r.slug,virtualMcpId:i,branch:l,previewServerUrl:w,path:S}:null,e[6]=l,e[7]=S,e[8]=r.slug,e[9]=w,e[10]=i,e[11]=R):R=e[11];const N=Rc(R);let I;e[12]!==l||e[13]!==r.slug||e[14]!==i?(I=l?{orgSlug:r.slug,virtualMcpId:i,branch:l}:null,e[12]=l,e[13]=r.slug,e[14]=i,e[15]=I):I=e[15];const L=Bc(I),y=l??"",E=d??null;let x;e[16]!==r.slug||e[17]!==y||e[18]!==E||e[19]!==i?(x=dl({orgSlug:r.slug,virtualMcpId:i,branch:y,threadId:E}),e[16]=r.slug,e[17]=y,e[18]=E,e[19]=i,e[20]=x):x=e[20];const A=!!l;let D;e[21]!==x||e[22]!==A?(D={...x,enabled:A},e[21]=x,e[22]=A,e[23]=D):D=e[23];const P=zi(D),B=P.data??null,M=B?{kind:"ready",branch:fl(B)??l??"",base:B.base??"main",workingTreeDirty:Uc(B),unpushed:B.unpushed??0,aheadOfBase:B.aheadOfBase??0,behindBase:B.behindBase??0,headSha:B.headSha??""}:{kind:"unknown"},K=B?.changedFiles?Ll({files:B.changedFiles}).count:null,F=(M.kind==="ready"?M.branch:null)??l??null,H=M.kind==="ready"?M.base:"main",Y=Za({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:F}),q=Y.data??null,te=Qa({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",base:H}),J=el({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:F}),Q=Fl({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:F});let W;e[24]!==J||e[25]!==q||e[26]!==Y||e[27]!==Q?(W=zu({pr:q,prQuery:Y,checksQuery:J,reviewsQuery:Q}),e[24]=J,e[25]=q,e[26]=Y,e[27]=Q,e[28]=W):W=e[28];const G=W;let ee;e[29]!==Y?(ee=async()=>{await Y.refetch()},e[29]=Y,e[30]=ee):ee=e[30];const ue=ee,ie=io({mutationFn:async()=>{const V=l;await u(Nn(On(a?.user))),V&&V!==H&&await h(V)},onError:Gu});let de;e[31]!==r.slug||e[32]!==d||e[33]!==i?(de=async V=>(await hl({orgSlug:r.slug,virtualMcpId:i,branch:V.branch,threadId:d??null},V.base),V),e[31]=r.slug,e[32]=d,e[33]=i,e[34]=de):de=e[34];let z;e[35]!==l||e[36]!==r.slug||e[37]!==n||e[38]!==s||e[39]!==d||e[40]!==i?(z=async V=>{Xe.success(s("thread.headerActions.syncedWithBase",{base:V.base})),await Promise.all([n.invalidateQueries({queryKey:pl({orgSlug:r.slug,virtualMcpId:i,branch:l??V.branch,threadId:d??null})}),n.invalidateQueries({queryKey:An.decofile(`${r.slug}/${i}/${V.branch}`)})])},e[35]=l,e[36]=r.slug,e[37]=n,e[38]=s,e[39]=d,e[40]=i,e[41]=z):z=e[41];let ge;e[42]!==de||e[43]!==z?(ge={mutationFn:de,onSuccess:z,onError:Yu},e[42]=de,e[43]=z,e[44]=ge):ge=e[44];const fe=io(ge),Le=rl(r.slug,i,l??""),oe=ie.isPending,$=$u({branch:M,pr:q,checks:J.data??[],reviews:Q.data??null,publishing:oe,saving:Le,syncing:fe.isPending,statusRetrying:P.isFetching&&!!P.error,statusError:P.error instanceof Error?P.error.message:P.error?String(P.error):null,loading:!!G,publishableChangeCount:K,t:s}),De=$.autoRun&&M.kind==="ready"&&b&&w?`${F}@${M.headSha}`:null,At=X.useRef(null);if(X.useEffect(()=>{!De||!F||At.current!==De&&(At.current=De,fe.mutate({branch:F,base:H}))},[De,F,H,fe]),k.status==="detached"){let V;e[45]!==s?(V=s("thread.headerActions.reconnectGithub"),e[45]=s,e[46]=V):V=e[46];let _e;e[47]!==V?(_e=c.jsx(St,{asChild:!0,children:c.jsx("span",{children:c.jsx(pe,{size:"sm",variant:"outline",disabled:!0,children:V})})}),e[47]=V,e[48]=_e):_e=e[48];let Ae;e[49]!==s?(Ae=s("thread.headerActions.githubConnectionRemoved"),e[49]=s,e[50]=Ae):Ae=e[50];let ye;e[51]!==Ae?(ye=c.jsx(wt,{children:Ae}),e[51]=Ae,e[52]=ye):ye=e[52];let Je;return e[53]!==_e||e[54]!==ye?(Je=c.jsx(nr,{children:c.jsxs(bt,{children:[_e,ye]})}),e[53]=_e,e[54]=ye,e[55]=Je):Je=e[55],Je}if(!o)return null;if(!b||!w){const V=b?"noPreviewServer":"noRepo";let _e;e[56]!==l||e[57]!==f?(_e=l?()=>{const ye=f?.({runtime:"sandbox",branch:l});ye&&Gh("coding_session_started",{thread_id:ye})}:void 0,e[56]=l,e[57]=f,e[58]=_e):_e=e[58];let Ae;return e[59]!==V||e[60]!==_e?(Ae=c.jsx(Xu,{reason:V,onStartCodingSession:_e}),e[59]=V,e[60]=_e,e[61]=Ae):Ae=e[61],Ae}if(!l)return null;const Ye=V=>{switch(V){case"publish":{v("publish");return}case"request-approval":{v("review");return}case"get-latest":{if(!F||fe.isPending)return;fe.mutate({branch:F,base:H});return}case"retry-status":{P.refetch();return}case"open-pr":{q?.htmlUrl&&window.open(q.htmlUrl,"_blank","noopener,noreferrer");return}}};let He;e[62]!==Ye?(He=V=>({key:V.key,label:V.label,icon:Po(V.action,V.key),...V.tooltip?{tooltip:V.tooltip}:{},onSelect:()=>Ye(V.action)}),e[62]=Ye,e[63]=He):He=e[63];const it=$.menu.map(He),Ne=$.action,yt=$.label,Wt=$.variant,ce=!!$.loading;let Ke;e[64]!==s?(Ke=s("thread.cmsActions.moreActionsAriaLabel"),e[64]=s,e[65]=Ke):Ke=e[65];const qe=c.jsx(Sl,{size:"sm",label:yt,variant:Wt,disabled:!!$.disabled||!Ne,loading:ce,...Ne&&!$.loading?{icon:Po(Ne)}:{},...$.tooltip?{tooltip:$.tooltip}:{},items:it,menuAriaLabel:Ke,onClick:Ne?()=>Ye(Ne):void 0});return c.jsxs(c.Fragment,{children:[qe,l?c.jsx(Il,{open:p.open,mode:p.mode,fastPreview:!0,onOpenChange:V=>{V||m(Vu)},orgSlug:r.slug,virtualMcpId:i,branch:l,baseBranch:H,repoTarget:Bt(b),owner:b.owner,repo:b.name,publishPolicy:_l(o?.metadata?.publishPolicy),draftPreviewUrl:N.url,destinationHost:N.host,previewServerUrl:w,compareDraft:L?{kind:"pointer",pointer:L}:null,lastPublishedPr:te.data??null,onRequestApproval:()=>v("review"),openPullRequest:q?.state==="open"?q:null,onPullRequestChanged:ue,onPublished:()=>ie.mutateAsync()}):null]})}function Vu(t){return{...t,open:!1}}function Yu(t){Xe.error(t instanceof Error?t.message:String(t))}function Gu(t){Xe.error(t instanceof Error?t.message:String(t))}function Xu(t){const e=U.c(14),{reason:i,onStartCodingSession:s}=t,r=Be(),n=!s;let o;e[0]!==r?(o=r("sandbox.cmsUnavailable.startCodingSession"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==s||e[3]!==n||e[4]!==o?(a=c.jsx(St,{asChild:!0,children:c.jsx("span",{children:c.jsx(pe,{size:"sm",variant:"outline",disabled:n,onClick:s,children:o})})}),e[2]=s,e[3]=n,e[4]=o,e[5]=a):a=e[5];let h;e[6]!==i||e[7]!==r?(h=r(i==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=i,e[7]=r,e[8]=h):h=e[8];let l;e[9]!==h?(l=c.jsx(wt,{children:h}),e[9]=h,e[10]=l):l=e[10];let u;return e[11]!==a||e[12]!==l?(u=c.jsx(nr,{children:c.jsxs(bt,{children:[a,l]})}),e[11]=a,e[12]=l,e[13]=u):u=e[13],u}const Li="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 Ju(t){return`Reopen PR #${t.prNumber}. ${Li}`}function Zu(t){return`Rebase \`${t.branch}\` on the latest base and force-push with --force-with-lease. ${Li}`}function Qu(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). ${Li}`}function ef(t){const e=(t.failingChecks??[]).map(i=>`\`${i}\``).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. ${Li}`}function tf(t){return`Mark PR #${t.prNumber} ready for review. ${Li}`}function sf(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. ${Li}`}function rf(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. ${Li}`}function Ro(t){switch(t){case"publish":return c.jsx(Ua,{className:"size-4"});case"create-pr":case"reopen":return c.jsx(ar,{className:"size-4"});case"rebase":case"sync":return c.jsx(ns,{className:"size-4"});case"fix-checks":return c.jsx(Pa,{className:"size-4"});case"mark-ready":return c.jsx(ol,{className:"size-4"});case"resolve-comments":return c.jsx(dc,{className:"size-4"});case"merge":return c.jsx(Mc,{className:"size-4"});case"review":return c.jsx(al,{className:"size-4"});case"open-pr-page":return c.jsx(tl,{size:16})}}const Bo=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),Do=new Set(["publish","create-pr"]);function nf(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function of({virtualMcpId:t}){const e=Be(),{org:i}=rr(),{data:s}=sr.useSession(),r=hr(t),{deleteRelease:n}=Ln(t),{currentBranch:o,setCurrentTaskBranch:a,taskId:h}=Ra(),l=tc(),{openSidePanel:u}=sc(),[d,f]=X.useState({open:!1,mode:"publish",policyOverride:null}),_=Xc({connectionId:Xh,orgId:i.id,orgSlug:i.slug}),p=Jc(_),[m,g]=X.useState(!1),v=X.useRef(""),k=Ja(r),b=k.status==="attached"||k.status==="public-clone"?k.repo:null,{lifecycle:w,branch:C,phase:S}=dr(),R={orgSlug:i.slug,virtualMcpId:t,branch:o??"",threadId:h??null},I=zi({queryKey:pl(R),queryFn:()=>jn(R),enabled:!!o,staleTime:15e3,refetchInterval:oe=>wr(oe.state.data)?5e3:!1}).data??null,L=C,y=w,E=L.kind==="ready"?L.branch:null,x=o??E??void 0,A=(L.kind==="ready"?L.branch:null)??x??null,D=Za({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:A}),P=D.data??null,B=el({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:A}),M=Fl({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:A}),K=Qa({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",base:L.kind==="ready"?L.base:null}),F=L,H=_l(r?.metadata?.publishPolicy),Y=rl(i.slug,t,o??x??""),{previewUrl:q}=vl(),{previewServerUrl:te}=cr(t);if(k.status==="detached")return c.jsx(lf,{label:e("thread.headerActions.githubConnectionRemoved"),children:c.jsx(pe,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!b)return null;const J=A?Hu({lifecycle:y,branch:F,claimPhase:S,pr:P,checks:B.data??[],reviews:M.data??null,noReviewableDiff:wr(I),loading:js(D),t:e}):nf(e),Q=JSON.stringify({label:J.label,branchKind:F.kind,workingTreeDirty:F.kind==="ready"?F.workingTreeDirty:null,unpushed:F.kind==="ready"?F.unpushed:null,aheadOfBase:F.kind==="ready"?F.aheadOfBase:null,lifecycle:y.phase,headBranch:A,noReviewableDiff:wr(I)});v.current!==Q&&(v.current=Q,gl("header button",{label:J.label,tooltip:J.tooltip,action:J.action,chatBranch:o,sandboxBranch:E,sandboxRouteBranch:x,headBranch:A,branchMeta:L,effectiveBranchMeta:F,lifecyclePhase:y.phase,prNumber:P?.number??null,prState:P?.state??null}));const W=oe=>(u(),l.sendMessage({parts:[{type:"text",text:oe}]})),G=l.isStreaming,ee=F.kind==="ready"?F.base:"main",ue=async()=>{await D.refetch()},ie=async()=>{const oe=o,$=Nn(On(s?.user));await a($),oe&&oe!==ee&&await n(oe)},de=async oe=>{if(!(!b||m)){g(!0);try{const $=wl(s?.user);await Cl(i.slug,Bt(b),{number:oe,coAuthor:$}),Xe.success(e("thread.headerActions.publishedPr",{prNumber:String(oe)})),await ue(),await ie()}catch($){Xe.error($ instanceof xl?$.detail??Pd($.reason,e):$ instanceof Error?$.message:e("thread.headerActions.failedToMergePullRequest"))}finally{g(!1)}}},z=(oe,$)=>f({open:!0,mode:oe,policyOverride:$}),ge=oe=>{if(A)switch(oe){case"publish":z("publish",J.meta?.publishPolicyOverride??null);return;case"create-pr":z("review",null);return;case"merge":P&&de(P.number);return;case"sync":if(G)return;W(Qu({branch:A,base:ee}));return;case"open-pr-page":P?.htmlUrl&&window.open(P.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(G)return;P&&W(rf({prNumber:P.number}));return;case"reopen":if(G)return;P&&W(Ju({prNumber:P.number}));return;case"rebase":if(G)return;W(Zu({branch:A}));return;case"fix-checks":if(G)return;P&&W(ef({prNumber:P.number,failingChecks:J.meta?.failingChecks??[]}));return;case"mark-ready":if(G)return;P&&W(tf({prNumber:P.number}));return;case"resolve-comments":if(G)return;P&&W(sf({prNumber:P.number}));return}},fe=m||G,Le=c.jsx(af,{t:e,button:J,actionBusy:fe,changeRequestPending:m,savePending:Y,onAction:ge});return x?c.jsxs(c.Fragment,{children:[Le,c.jsx(Il,{open:d.open,mode:d.mode,fastPreview:!1,recoverSandbox:()=>p.mutateAsync({virtualMcpId:t,branch:x,...h?{threadId:h}:{}}),onOpenChange:oe=>{oe||f($=>({...$,open:!1}))},orgSlug:i.slug,virtualMcpId:t,branch:x,baseBranch:ee,repoTarget:Bt(b),owner:b.owner,repo:b.name,publishPolicy:d.policyOverride??H,draftPreviewUrl:q,destinationHost:null,previewServerUrl:te,compareDraft:q?{kind:"sandbox",previewUrl:q}:null,lastPublishedPr:K.data??null,onRequestApproval:()=>f(oe=>({...oe,open:!0,mode:"review"})),openPullRequest:P?.state==="open"?P:null,onPullRequestChanged:ue,onPublished:ie})]}):Le}function af(t){const e=U.c(44),{t:i,button:s,actionBusy:r,changeRequestPending:n,savePending:o,onAction:a}=t,h=s.action;let l;e[0]!==h||e[1]!==r?(l=r&&h!==void 0&&Bo.has(h),e[0]=h,e[1]=r,e[2]=l):l=e[2];const u=l,d=n&&h==="merge";let f;e[3]!==h||e[4]!==o?(f=o&&h!==void 0&&Do.has(h),e[3]=h,e[4]=o,e[5]=f):f=e[5];const _=f,p=!!s.disabled||u||d||_||!h,m=!!s.loading||d;let g;e[6]!==s.tooltip||e[7]!==u||e[8]!==_||e[9]!==i?(g=u?i("thread.headerActions.chatIsRunning"):_?i("thread.headerActions.saving"):s.tooltip,e[6]=s.tooltip,e[7]=u,e[8]=_,e[9]=i,e[10]=g):g=e[10];const v=g;let k;if(e[11]!==r||e[12]!==s.menu||e[13]!==n||e[14]!==a||e[15]!==o||e[16]!==i){let y;e[18]!==r||e[19]!==n||e[20]!==a||e[21]!==o||e[22]!==i?(y=E=>{const x=r&&Bo.has(E.action),A=o&&Do.has(E.action),D=E.action==="merge"&&n,P=A?i("thread.headerActions.saving"):x?i("thread.headerActions.chatIsRunning"):E.tooltip;return{key:E.key,label:E.label,icon:Ro(E.action),disabled:!!(x||A||D),...P?{tooltip:P}:{},onSelect:()=>a(E.action)}},e[18]=r,e[19]=n,e[20]=a,e[21]=o,e[22]=i,e[23]=y):y=e[23],k=s.menu.map(y),e[11]=r,e[12]=s.menu,e[13]=n,e[14]=a,e[15]=o,e[16]=i,e[17]=k}else k=e[17];const b=k,w=s.label,C=s.variant;let S;e[24]!==h||e[25]!==m?(S=h&&!m?{icon:Ro(h)}:{},e[24]=h,e[25]=m,e[26]=S):S=e[26];let R;e[27]!==v?(R=v?{tooltip:v}:{},e[27]=v,e[28]=R):R=e[28];let N;e[29]!==i?(N=i("thread.headerActions.moreActionsAriaLabel"),e[29]=i,e[30]=N):N=e[30];let I;e[31]!==h||e[32]!==a?(I=h?()=>a(h):void 0,e[31]=h,e[32]=a,e[33]=I):I=e[33];let L;return e[34]!==s.label||e[35]!==s.variant||e[36]!==p||e[37]!==b||e[38]!==m||e[39]!==S||e[40]!==R||e[41]!==N||e[42]!==I?(L=c.jsx(Sl,{size:"sm",label:w,variant:C,disabled:p,loading:m,...S,...R,items:b,menuAriaLabel:N,onClick:I}),e[34]=s.label,e[35]=s.variant,e[36]=p,e[37]=b,e[38]=m,e[39]=S,e[40]=R,e[41]=N,e[42]=I,e[43]=L):L=e[43],L}function lf(t){const e=U.c(9),{label:i,children:s}=t;if(!i){let a;return e[0]!==s?(a=c.jsx(c.Fragment,{children:s}),e[0]=s,e[1]=a):a=e[1],a}let r;e[2]!==s?(r=c.jsx(St,{asChild:!0,children:c.jsx("span",{children:s})}),e[2]=s,e[3]=r):r=e[3];let n;e[4]!==i?(n=c.jsx(wt,{children:i}),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n?(o=c.jsx(nr,{children:c.jsxs(bt,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=o):o=e[8],o}const hf=new Set(["site-editor","content"]);function cf(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&hf.has(t.mainTab)}const Bi="setup";function df(t){const e=U.c(57),i=Be();let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let w;e[3]!==t.scriptTabs?(w=C=>!t.scriptTabs.includes(C),e[3]=t.scriptTabs,e[4]=w):w=e[4],s=t.scripts.filter(w),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const r=s;let n;e[5]!==t?(n=()=>{t.active===Bi?t.onToggle():t.onSelectTab(Bi)},e[5]=t,e[6]=n):n=e[6];const o=n;let a;e[7]!==t.open||e[8]!==i?(a=t.open?i("sandbox.preview.collapseTerminal"):i("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=i,e[9]=a):a=e[9];let h;e[10]!==t.open?(h=t.open?c.jsx(or,{className:"size-4"}):c.jsx(ac,{className:"size-4"}),e[10]=t.open,e[11]=h):h=e[11];let l;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==h?(l=c.jsx(St,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:h})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=h,e[16]=l):l=e[16];let u;e[17]!==t.open||e[18]!==i?(u=t.open?i("sandbox.preview.collapseTerminal"):i("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=i,e[19]=u):u=e[19];let d;e[20]!==u?(d=c.jsx(wt,{children:u}),e[20]=u,e[21]=d):d=e[21];let f;e[22]!==l||e[23]!==d?(f=c.jsxs(bt,{children:[l,d]}),e[22]=l,e[23]=d,e[24]=f):f=e[24];const _=t.active===Bi;let p;e[25]!==o||e[26]!==t.open||e[27]!==i||e[28]!==_?(p=c.jsx(uf,{active:_,open:t.open,onClick:o,t:i}),e[25]=o,e[26]=t.open,e[27]=i,e[28]=_,e[29]=p):p=e[29];let m;e[30]!==t||e[31]!==i?(m=t.scriptTabs.map(w=>c.jsx(_f,{active:t.active===w,onClick:()=>{t.active===w?t.onToggle():t.onSelectTab(w)},onClose:()=>t.onCloseScript(w),t:i,children:w},w)),e[30]=t,e[31]=i,e[32]=m):m=e[32];let g;e[33]!==r||e[34]!==t.onAddScript?(g=c.jsx(pf,{scripts:r,onRun:t.onAddScript}),e[33]=r,e[34]=t.onAddScript,e[35]=g):g=e[35];let v;e[36]!==m||e[37]!==g||e[38]!==p?(v=c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,m,g]}),e[36]=m,e[37]=g,e[38]=p,e[39]=v):v=e[39];let k;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==i?(k=t.showScriptControls?c.jsx(mf,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:i}):c.jsx(ff,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:i}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=i,e[52]=k):k=e[52];let b;return e[53]!==v||e[54]!==k||e[55]!==f?(b=c.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,v,k]}),e[53]=v,e[54]=k,e[55]=f,e[56]=b):b=e[56],b}function uf(t){const e=U.c(11),{active:i,open:s,onClick:r,t:n}=t,o=i&&s,a=i&&s,h=i?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let l;e[0]!==h?(l=le("flex h-6 items-center gap-1.5 rounded-lg border px-2 text-xs",h),e[0]=h,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(Lc,{className:"size-4"}),e[2]=u):u=e[2];let d;e[3]!==n?(d=n("sandbox.toolbar.setupTab"),e[3]=n,e[4]=d):d=e[4];let f;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l||e[9]!==d?(f=c.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:l,children:[u,d]}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=d,e[10]=f):f=e[10],f}function ff(t){const e=U.c(40),{status:i,onStart:s,onStop:r,onRestart:n,onResume:o,onRetry:a,t:h}=t;if(i==="idle"&&s){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Ks,{className:"size-3.5"}),e[0]=l):l=e[0];let u;e[1]!==h?(u=h("sandbox.toolbar.start"),e[1]=h,e[2]=u):u=e[2];let d;return e[3]!==s||e[4]!==u?(d=c.jsxs(pe,{variant:"outline",size:"xs",onClick:s,children:[l," ",u]}),e[3]=s,e[4]=u,e[5]=d):d=e[5],d}if(i==="suspended"&&o){let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Ks,{className:"size-3.5"}),e[6]=l):l=e[6];let u;e[7]!==h?(u=h("sandbox.toolbar.resume"),e[7]=h,e[8]=u):u=e[8];let d;return e[9]!==o||e[10]!==u?(d=c.jsxs(pe,{variant:"outline",size:"xs",onClick:o,children:[l," ",u]}),e[9]=o,e[10]=u,e[11]=d):d=e[11],d}if(i==="errored"&&a){let l;e[12]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ns,{className:"size-3.5"}),e[12]=l):l=e[12];let u;e[13]!==h?(u=h("sandbox.toolbar.retry"),e[13]=h,e[14]=u):u=e[14];let d;return e[15]!==a||e[16]!==u?(d=c.jsxs(pe,{variant:"outline",size:"xs",onClick:a,children:[l," ",u]}),e[15]=a,e[16]=u,e[17]=d):d=e[17],d}if(i==="starting"||i==="running"){const l=i==="running"&&!!n,u=l?"rounded-r-none border-r-0":void 0;let d;e[18]!==u?(d=le(u),e[18]=u,e[19]=d):d=e[19];let f;e[20]!==h?(f=h("sandbox.toolbar.stop"),e[20]=h,e[21]=f):f=e[21];let _;e[22]!==r||e[23]!==d||e[24]!==f?(_=c.jsx(St,{asChild:!0,children:c.jsx(pe,{variant:"outline",size:"xs",onClick:r,className:d,children:f})}),e[22]=r,e[23]=d,e[24]=f,e[25]=_):_=e[25];let p;e[26]!==h?(p=h("sandbox.toolbar.stopSandboxTooltip"),e[26]=h,e[27]=p):p=e[27];let m;e[28]!==p?(m=c.jsx(wt,{children:p}),e[28]=p,e[29]=m):m=e[29];let g;e[30]!==_||e[31]!==m?(g=c.jsxs(bt,{children:[_,m]}),e[30]=_,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==n||e[34]!==l||e[35]!==h?(v=l&&c.jsxs(us,{children:[c.jsx(cs,{asChild:!0,children:c.jsx(pe,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":h("sandbox.toolbar.moreActions"),children:c.jsx(or,{className:"size-3"})})}),c.jsx(ds,{align:"end",children:c.jsxs(Ai,{onClick:n,children:[c.jsx(ns,{className:"size-3.5"})," ",h("sandbox.toolbar.restart")]})})]}),e[33]=n,e[34]=l,e[35]=h,e[36]=v):v=e[36];let k;return e[37]!==g||e[38]!==v?(k=c.jsxs("div",{className:"flex items-center",children:[g,v]}),e[37]=g,e[38]=v,e[39]=k):k=e[39],k}return null}function _f(t){const e=U.c(17),{active:i,onClick:s,onClose:r,children:n,t:o}=t,a=i?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let h;e[0]!==a?(h=le("flex h-6 items-center rounded-lg border text-xs",a),e[0]=a,e[1]=h):h=e[1];const l=r?"pl-2 pr-1":"px-2",u=i?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==l||e[3]!==u?(d=le("flex h-full items-center",l,u),e[2]=l,e[3]=u,e[4]=d):d=e[4];let f;e[5]!==n||e[6]!==s||e[7]!==d?(f=c.jsx("button",{type:"button",onClick:s,className:d,children:n}),e[5]=n,e[6]=s,e[7]=d,e[8]=f):f=e[8];let _;e[9]!==n||e[10]!==r||e[11]!==o?(_=r&&c.jsx("button",{type:"button","aria-label":o("sandbox.toolbar.closeTab",{tab:String(n)}),onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:c.jsx(Jh,{className:"size-3.5"})}),e[9]=n,e[10]=r,e[11]=o,e[12]=_):_=e[12];let p;return e[13]!==h||e[14]!==f||e[15]!==_?(p=c.jsxs("div",{className:h,children:[f,_]}),e[13]=h,e[14]=f,e[15]=_,e[16]=p):p=e[16],p}function pf(t){const e=U.c(27),{scripts:i,onRun:s}=t,r=Be(),[n,o]=X.useState(!1);let a;e[0]!==r?(a=r("sandbox.toolbar.runScript"),e[0]=r,e[1]=a):a=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Mn,{className:"size-4"}),e[2]=h):h=e[2];let l;e[3]!==a?(l=c.jsx(St,{asChild:!0,children:c.jsx(Aa,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"xs","aria-label":a,children:h})})}),e[3]=a,e[4]=l):l=e[4];let u;e[5]!==r?(u=r("sandbox.toolbar.runScript"),e[5]=r,e[6]=u):u=e[6];let d;e[7]!==u?(d=c.jsx(wt,{children:u}),e[7]=u,e[8]=d):d=e[8];let f;e[9]!==l||e[10]!==d?(f=c.jsxs(bt,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=f):f=e[11];let _;e[12]!==r?(_=r("sandbox.toolbar.runAScript"),e[12]=r,e[13]=_):_=e[13];let p;e[14]!==_?(p=c.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:_}),e[14]=_,e[15]=p):p=e[15];let m;e[16]!==s||e[17]!==i||e[18]!==r?(m=i.length===0?c.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:r("sandbox.toolbar.noScriptsFound")}):i.map(k=>c.jsxs("button",{type:"button",onClick:()=>{o(!1),s(k)},className:"w-full rounded-lg px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",k]},k)),e[16]=s,e[17]=i,e[18]=r,e[19]=m):m=e[19];let g;e[20]!==p||e[21]!==m?(g=c.jsxs(Ta,{align:"start",className:"p-1 w-56",children:[p,m]}),e[20]=p,e[21]=m,e[22]=g):g=e[22];let v;return e[23]!==n||e[24]!==g||e[25]!==f?(v=c.jsxs(Da,{open:n,onOpenChange:o,children:[f,g]}),e[23]=n,e[24]=g,e[25]=f,e[26]=v):v=e[26],v}function mf(t){const e=U.c(30),{isRunning:i,isKilling:s,onRun:r,onStop:n,t:o}=t;if(s){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(rs,{className:"size-3.5"}),e[0]=f):f=e[0];let _;e[1]!==o?(_=o("sandbox.toolbar.stopping"),e[1]=o,e[2]=_):_=e[2];let p;return e[3]!==_?(p=c.jsxs(pe,{variant:"outline",size:"xs",disabled:!0,children:[f," ",_]}),e[3]=_,e[4]=p):p=e[4],p}if(!i){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Ks,{className:"size-3.5"}),e[5]=f):f=e[5];let _;e[6]!==o?(_=o("sandbox.toolbar.run"),e[6]=o,e[7]=_):_=e[7];let p;e[8]!==r||e[9]!==_?(p=c.jsx(St,{asChild:!0,children:c.jsxs(pe,{variant:"outline",size:"xs",onClick:r,children:[f," ",_]})}),e[8]=r,e[9]=_,e[10]=p):p=e[10];let m;e[11]!==o?(m=o("sandbox.toolbar.startProcess"),e[11]=o,e[12]=m):m=e[12];let g;e[13]!==m?(g=c.jsx(wt,{children:m}),e[13]=m,e[14]=g):g=e[14];let v;return e[15]!==p||e[16]!==g?(v=c.jsxs(bt,{children:[p,g]}),e[15]=p,e[16]=g,e[17]=v):v=e[17],v}let a;e[18]!==o?(a=o("sandbox.toolbar.stop"),e[18]=o,e[19]=a):a=e[19];let h;e[20]!==n||e[21]!==a?(h=c.jsx(St,{asChild:!0,children:c.jsx(pe,{variant:"outline",size:"xs",onClick:n,children:a})}),e[20]=n,e[21]=a,e[22]=h):h=e[22];let l;e[23]!==o?(l=o("sandbox.toolbar.stopProcess"),e[23]=o,e[24]=l):l=e[24];let u;e[25]!==l?(u=c.jsx(wt,{children:l}),e[25]=l,e[26]=u):u=e[26];let d;return e[27]!==h||e[28]!==u?(d=c.jsxs(bt,{children:[h,u]}),e[27]=h,e[28]=u,e[29]=d):d=e[29],d}var zl=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,vf=(t,e)=>{for(var i in e)zl(t,i,{get:e[i],enumerable:!0})},Pe=(t,e,i,s)=>{for(var r=s>1?void 0:s?gf(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&zl(e,i,r),r},j=(t,e)=>(i,s)=>e(i,s,t),Ao="Terminal input",qr={get:()=>Ao,set:t=>Ao=t},To="Too much output to announce, navigate to rows manually to read",Vr={get:()=>To,set:t=>To=t};function bf(t){return t.replace(/\r?\n/g,"\r")}function Sf(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function wf(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function yf(t,e,i,s){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Wl(r,e,i,s)}}function Wl(t,e,i,s){t=bf(t),t=Sf(t,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function $l(t,e,i){let s=i.getBoundingClientRect(),r=t.clientX-s.left-10,n=t.clientY-s.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function Mo(t,e,i,s,r){$l(t,e,i),r&&s.rightClickSelect(t),e.value=s.selectionText,e.select()}function vi(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function fr(t,e=0,i=t.length){let s="";for(let r=e;r<i;++r){let n=t[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var xf=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let i=t.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=t.charCodeAt(r++);56320<=n&&n<=57343?e[s++]=(this._interim-55296)*1024+n-56320+65536:(e[s++]=this._interim,e[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=t.charCodeAt(n);56320<=a&&a<=57343?e[s++]=(o-55296)*1024+a-56320+65536:(e[s++]=o,e[s++]=a);continue}o!==65279&&(e[s++]=o)}return s}},Cf=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let i=t.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let f=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let p=0,m;for(;(m=this.interim[++p]&63)&&p<4;)_<<=6,_|=m;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=g-p;for(;l<v;){if(l>=i)return 0;if(m=t[l++],(m&192)!==128){l--,f=!0;break}else this.interim[p++]=m,_<<=6,_|=m&63}f||(g===2?_<128?l--:e[s++]=_:g===3?_<2048||_>=55296&&_<=57343||_===65279||(e[s++]=_):_<65536||_>1114111||(e[s++]=_)),this.interim.fill(0)}let u=i-4,d=l;for(;d<i;){for(;d<u&&!((r=t[d])&128)&&!((n=t[d+1])&128)&&!((o=t[d+2])&128)&&!((a=t[d+3])&128);)e[s++]=r,e[s++]=n,e[s++]=o,e[s++]=a,d+=4;if(r=t[d++],r<128)e[s++]=r;else if((r&224)===192){if(d>=i)return this.interim[0]=r,s;if(n=t[d++],(n&192)!==128){d--;continue}if(h=(r&31)<<6|n&63,h<128){d--;continue}e[s++]=h}else if((r&240)===224){if(d>=i)return this.interim[0]=r,s;if(n=t[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=t[d++],(o&192)!==128){d--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[s++]=h}else if((r&248)===240){if(d>=i)return this.interim[0]=r,s;if(n=t[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=t[d++],(a&192)!==128){d--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;e[s++]=h}}return s}},Ul="",bi=" ",fs=class Kl{constructor(){this.fg=0,this.bg=0,this.extended=new Js}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Kl;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Js=class ql{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new ql(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Dt=class Vl extends fs{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Js,this.combinedData=""}static fromCharData(e){let i=new Vl;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?vi(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Lo="di$target",Yr="di$dependencies",Er=new Map;function kf(t){return t[Yr]||[]}function Ue(t){if(Er.has(t))return Er.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ef(e,i,r)};return e._id=t,Er.set(t,e),e}function Ef(t,e,i){e[Lo]===e?e[Yr].push({id:t,index:i}):(e[Yr]=[{id:t,index:i}],e[Lo]=e)}var et=Ue("BufferService"),Yl=Ue("CoreMouseService"),Ni=Ue("CoreService"),Pf=Ue("CharsetService"),qn=Ue("InstantiationService"),Gl=Ue("LogService"),tt=Ue("OptionsService"),Xl=Ue("OscLinkService"),Rf=Ue("UnicodeService"),_s=Ue("DecorationService"),Gr=class{constructor(t,e,i){this._bufferService=t,this._optionsService=e,this._oscLinkService=i}provideLinks(t,e){let i=this._bufferService.buffer.lines.get(t-1);if(!i){e(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Dt,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let u=0;u<o;u++)if(!(h===-1&&!i.hasContent(u))){if(i.loadCell(u,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=u,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&u===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let f={start:{x:h+1,y:t},end:{x:u+(!l&&u===o-1?1:0),y:t}},_=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(d);["http:","https:"].includes(p.protocol)||(_=!0)}catch{_=!0}_||s.push({text:d,range:f,activate:(p,m)=>r?r.activate(p,m,f):Bf(p,m),hover:(p,m)=>r?.hover?.(p,m,f),leave:(p,m)=>r?.leave?.(p,m,f)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=u,a=n.extended.urlId):(h=-1,a=-1)}}e(s)}};Gr=Pe([j(0,et),j(1,tt),j(2,Xl)],Gr);function Bf(t,e){if(confirm(`Do you want to navigate to ${e}?
9
+ `),fallbackTitle:e})}function Vs(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function Dd(t){return t.fastPreview?{fastPreview:!0}:void 0}async function yr(t,e,i){try{return await i()}catch(s){throw new zn(s instanceof Error?s.message:e,t)}}async function El(t){const{expectedHeadSha:e,expectedDiffSignature:i}=t;if(!e&&!i)return;const s=await jn(Vs(t)).catch(()=>null);if(!s)return;if(e&&s.headSha&&s.headSha!==e)throw new $r;if(!i)return;const r=await ll(Vs(t),s,t.baseBranch,Dd(t)).catch(()=>null);if(r&&Hn(r)!==i)throw new $r}function Pl(t,e){return Nc(Vs(t),e)}function Rl(t,e){return Ed(t.orgSlug,t.target,{branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor})}async function Ad(t,e,i){await El(t),await yr("push",i("thread.publishDialog.failedPushChanges"),()=>Pl(t,e.message)),await yr("sync",i("thread.publishDialog.failedRebase"),()=>hl(Vs(t),t.baseBranch));const s=await yr("open-pr",i("thread.publishDialog.failedOpenPullRequest"),()=>Rl(t,e));try{await Cl(t.orgSlug,t.target,{number:s.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(r){throw new zn(r instanceof Error?r.message:i("thread.publishDialog.failedMergePullRequest"),"merge",s)}return s}async function Td(t,e){return await El(t),await Pl(t,e.message),Rl(t,e)}function Md(t,e){return t instanceof $r?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof zn&&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){const i=Md(t,e),s=i.pullRequest;return s&&Xe.error(i.message,{action:{label:e("thread.publishDialog.viewPr"),onClick:()=>window.open(s.htmlUrl,"_blank","noopener,noreferrer")}}),{message:i.message,pullRequestOpened:s!==null,headMoved:i.headMoved}}function Ld(t,e){Xe.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnProvider"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}const Nd=/(?:^|\/)\.deco\/blocks\/([^/]+)\.json$/;function Bl(t){const e=Nd.exec(t)?.[1];return e?Kc(e):null}function Ys(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 Od(t,e){return t===null?"new":e===null?"removed":"edited"}function Dl(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,i=>i.toLowerCase()):t}function xr(t,e){if(t&&typeof t=="object"&&!Array.isArray(t)){const i=t.__resolveType;if(typeof i=="string"&&i.trim()){const r=(i.split("/").pop()??i).replace(/\.[jt]sx?$/,"");return Dl(r)||r}}return`Section ${e+1}`}function Ur(t){const e=t.sections;if(Array.isArray(e))return e.flatMap((i,s)=>i&&typeof i=="object"&&!Array.isArray(i)?[{section:i,basePath:["sections",s]}]:[]);if(e&&typeof e=="object"){const i=e.variants;if(Array.isArray(i))return i.flatMap((s,r)=>{const n=s&&typeof s=="object"&&!Array.isArray(s)?s.value:null;return Array.isArray(n)?n.flatMap((o,a)=>o&&typeof o=="object"&&!Array.isArray(o)?[{section:o,basePath:["sections","variants",r,"value",a]}]:[]):[]})}return[]}function vo(t){return JSON.stringify(t,(e,i)=>{if(i&&typeof i=="object"&&!Array.isArray(i)){const s=i;return Object.keys(s).sort().reduce((r,n)=>(r[n]=s[n],r),{})}return i})}function Al(t,e){return t===void 0&&e===void 0?!0:vo(t)===vo(e)}function Gs(t,e,i,s=new Set){const r=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),n=[];for(const o of r){if(o.startsWith("__")||s.has(o))continue;const a=t?t[o]:void 0,h=e?e[o]:void 0;Al(a,h)||n.push({label:Dl(o),path:[...i,o],from:a,to:h})}return n}const Id=new Set(["sections"]);function Tl(t,e){const i=t?Ur(t):[],s=e?Ur(e):[],r=[],n=Math.max(i.length,s.length);for(let a=0;a<n;a++){const h=i[a],l=s[a];if(h&&l){if(Al(h.section,l.section))continue;r.push({name:xr(l.section,a),kind:"section",status:"edited",fields:Gs(h.section,l.section,l.basePath)})}else l?r.push({name:xr(l.section,a),kind:"section",status:"new",fields:[]}):h&&r.push({name:xr(h.section,a),kind:"section",status:"removed",fields:[]})}const o=Gs(t,e,[],Id);return o.length>0&&r.push({name:"Page settings",kind:"settings",status:"edited",fields:o}),r}function Kr(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 jd(t){const e=[],i=[],s=[],r=[];for(const[n,o]of Object.entries(t?.diffs??{})){if(cl(n)){r.push(n);continue}const a=Od(o.from,o.to),h=Bl(n);if(!h){s.push(Kr(n,a));continue}const l=Ys(o.from),u=Ys(o.to),d=u??l;if(!d){s.push(Kr(n,a));continue}const f=Hr(h,d);if(f){e.push({kind:"page",blockKey:h,name:f.name,pagePath:f.path,isSiteApp:!1,status:a,filepaths:[n],sections:a==="edited"?Tl(l,u):[],fromJson:l,toJson:u});continue}const _=Ga(h,d);i.push({kind:"block",blockKey:h,name:Fr(h,d),pagePath:null,isSiteApp:_,status:a,filepaths:[n],sections:a==="edited"?[{name:Fr(h,d),kind:"section",status:"edited",fields:Gs(l,u,[])}].filter(p=>p.fields.length>0):[],fromJson:l,toJson:u})}return Ml({pages:e,blocks:i,other:s,generated:r})}function Cr(t,e){return(t.filepaths[0]??"").localeCompare(e.filepaths[0]??"")}function Ml(t){const{pages:e,blocks:i,other:s,generated:r}=t;return e.sort(Cr),i.sort(Cr),s.sort(Cr),{pages:e,blocks:i,other:s,generated:r,count:e.length+i.length+s.length}}function Hd(t){return t==="added"?"new":t==="removed"?"removed":"edited"}function Fd(t){return t.startsWith("pages-")}function Ll(t){const{files:e,lookup:i,diff:s}=t,r=[],n=[],o=[],a=[];for(const h of e){const l=h.path;if(cl(l)){a.push(l);continue}const u=Hd(h.status),d=Bl(l);if(!d){o.push(Kr(l,u));continue}const f=s?.diffs[l],_=Ys(f?.from??null),p=Ys(f?.to??null),m=zd(i,d),g=m??p??_;if((m?Hr(d,m):null)??(!m&&Fd(d))){const b=g?Hr(d,g):null;r.push({kind:"page",blockKey:d,name:b?.name??mc(d),pagePath:b?.path??null,isSiteApp:!1,status:u,filepaths:[l],sections:u==="edited"?Tl(_,p):[],fromJson:_,toJson:p??(u==="new"?m:null)});continue}const k=Fr(d,g??{});n.push({kind:"block",blockKey:d,name:k,pagePath:null,isSiteApp:Ga(d,m??{}),status:u,filepaths:[l],sections:u==="edited"?[{name:k,kind:"section",status:"edited",fields:Gs(_,p,[])}].filter(b=>b.fields.length>0):[],fromJson:_,toJson:p})}return Ml({pages:r,blocks:n,other:o,generated:a})}function zd(t,e){const i=t?.[e];return i&&typeof i=="object"&&!Array.isArray(i)?i:null}function Wd(t,e){return t??e}function Nl(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const kr=3;function Bs(t){if(t.length<=kr)return Nl(t);const e=t.length-kr;return`${t.slice(0,kr).join(", ")} and ${e} more`}function $d(t){const e=t.sections.filter(i=>i.kind==="section").map(i=>i.name).slice(0,3);return e.length>0?`${t.name} (${e.join(", ")})`:t.name}function Ud(t){const e=[],i=t.pages.filter(a=>a.status==="edited"),s=t.pages.filter(a=>a.status==="new"),r=t.pages.filter(a=>a.status==="removed");if(i.length>0&&e.push(`updated ${Bs(i.map($d))}`),s.length>0){const a=s.length===1?"page":"pages";e.push(`added the ${Bs(s.map(h=>h.name))} ${a}`)}if(r.length>0){const a=r.length===1?"page":"pages";e.push(`removed the ${Bs(r.map(h=>h.name))} ${a}`)}const n=t.blocks.map(a=>a.name);if(n.length>0&&e.push(`changed ${Bs(n)}`),t.other.length>0){const a=t.other.length===1?"file":"files";e.push(`changed ${t.other.length} ${a}`)}if(e.length===0)return"";const o=Nl(e);return kl(o.charAt(0).toUpperCase()+o.slice(1))}function Kd(t){return t?Ur(t).length:0}function qd(t){const e={newPageSections:t.kind==="page"&&t.status==="new"?Kd(t.toJson):null,sections:0,settings:!1,fields:0};if(e.newPageSections!==null)return e;for(const i of t.sections){if(i.kind==="settings"){e.settings=!0;continue}t.kind==="page"?e.sections+=1:e.fields+=i.fields.length}return e}function Qt(t){return t.filepaths[0]??t.blockKey??t.name}function Vd(t,e){return e(t==="new"?"thread.publishPopover.chipNew":t==="removed"?"thread.publishPopover.chipRemoved":"thread.publishPopover.chipEdited")}function Yd(t,e){const i=t.kind==="block"?Tc:Ka;return c.jsx("span",{title:Vd(t.status,e),className:"flex shrink-0",children:c.jsx(i,{className:le("size-4",t.status==="new"&&"text-brand",t.status==="edited"&&"text-warning",t.status==="removed"&&"text-destructive")})})}function Gd(t,e){return t.kind==="page"?t.pagePath:t.kind!=="block"?null:t.isSiteApp?e("thread.publishPopover.siteConfiguration"):e("thread.publishPopover.globalSection")}function Xd(t,e){const i=qd(t);if(i.newPageSections!==null)return[i.newPageSections===1?e("thread.publishPopover.newPageSectionOne"):e("thread.publishPopover.newPageSections",{count:i.newPageSections})];const s=[];return i.sections===1?s.push(e("thread.publishPopover.sectionChangedOne")):i.sections>1&&s.push(e("thread.publishPopover.sectionsChanged",{count:i.sections})),i.fields===1?s.push(e("thread.publishPopover.fieldChangedOne")):i.fields>1&&s.push(e("thread.publishPopover.fieldsChanged",{count:i.fields})),i.settings&&s.push(e("thread.publishPopover.pageSettingsChanged")),s}function Jd(t){const e=U.c(41),{change:i,bodyPending:s,selected:r,onSelect:n,confirming:o,onConfirmingChange:a,onDiscard:h,isPublishing:l,isDiscarding:u}=t,d=s===void 0?!1:s,f=Be();let _;e[0]!==i||e[1]!==f?(_=Gd(i,f),e[0]=i,e[1]=f,e[2]=_):_=e[2];const p=_;let m;if(e[3]!==d||e[4]!==i||e[5]!==o||e[6]!==p||e[7]!==u||e[8]!==l||e[9]!==a||e[10]!==h||e[11]!==n||e[12]!==r||e[13]!==f){const g=Xd(i,f),v=d&&g.length===0&&i.status==="edited",k=r&&"border-foreground/30 bg-accent hover:bg-accent";let b;e[15]!==k?(b=le("cursor-pointer transition-colors hover:bg-accent/50",k),e[15]=k,e[16]=b):b=e[16];let w;e[17]!==i?(w=Qt(i),e[17]=i,e[18]=w):w=e[18];let C;e[19]!==i||e[20]!==f?(C=Yd(i,f),e[19]=i,e[20]=f,e[21]=C):C=e[21];let S;e[22]!==i.name?(S=c.jsx("span",{className:"truncate text-sm font-medium",children:i.name}),e[22]=i.name,e[23]=S):S=e[23];let R;e[24]!==p?(R=p?c.jsx("span",{className:"truncate text-xs text-muted-foreground",children:p}):null,e[24]=p,e[25]=R):R=e[25];let N;e[26]!==r||e[27]!==S||e[28]!==R?(N=c.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left","aria-pressed":r,children:[S,R]}),e[26]=r,e[27]=S,e[28]=R,e[29]=N):N=e[29];let I;e[30]!==o||e[31]!==u||e[32]!==l||e[33]!==a||e[34]!==h||e[35]!==f?(I=o?c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[c.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:y=>{y.stopPropagation(),a(!1)},children:f("thread.publishDialog.cancel")}),c.jsx("button",{type:"button",className:"text-xs font-medium text-destructive disabled:opacity-50",onClick:y=>{y.stopPropagation(),a(!1),h?.()},disabled:u,children:f("thread.publishPopover.discard")})]}):h?c.jsx(nr,{children:c.jsxs(bt,{children:[c.jsx(St,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":f("thread.publishPopover.discard"),className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-destructive disabled:opacity-50 rounded-lg",onClick:y=>{y.stopPropagation(),a(!0)},disabled:l||u,children:c.jsx(lr,{className:"size-3.5"})})}),c.jsx(wt,{children:f("thread.publishPopover.discard")})]})}):null,e[30]=o,e[31]=u,e[32]=l,e[33]=a,e[34]=h,e[35]=f,e[36]=I):I=e[36];let L;e[37]!==N||e[38]!==I||e[39]!==C?(L=c.jsxs("div",{className:"flex items-center gap-2.5",children:[C,N,I]}),e[37]=N,e[38]=I,e[39]=C,e[40]=L):L=e[40],m=c.jsxs(yl,{className:b,"data-change-id":w,onClick:n,children:[L,g.length>0?c.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-muted-foreground",children:g.map(Zd)}):v?c.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px]",children:c.jsx(ti,{className:"h-4 w-2/3"})}):null]}),e[3]=d,e[4]=i,e[5]=o,e[6]=p,e[7]=u,e[8]=l,e[9]=a,e[10]=h,e[11]=n,e[12]=r,e[13]=f,e[14]=m}else m=e[14];return m}function Zd(t,e){return c.jsx("div",{className:"truncate",children:t},`${e}-${t}`)}function Qd(){const t=U.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={width:-1,height:-1},t[0]=e):e=t[0];const[i,s]=X.useState(e);let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=a=>{if(!a)return;const h=()=>s(u=>u.width===a.clientWidth&&u.height===a.clientHeight?u:{width:a.clientWidth,height:a.clientHeight});h();const l=new ResizeObserver(h);return l.observe(a),()=>l.disconnect()},t[1]=r):r=t[1];const n=r;let o;return t[2]!==i?(o=[i,n],t[2]=i,t[3]=o):o=t[3],o}function eu(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}const tu=[{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 bo(t){const e=U.c(10),{height:i}=t,s=Be();let r;e[0]!==i?(r={height:i},e[0]=i,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=tu.map(iu),e[2]=n):n=e[2];let o;e[3]!==s?(o=s("thread.publishDialog.openingComparison"),e[3]=s,e[4]=o):o=e[4];let a;e[5]!==o?(a=c.jsx("div",{className:"flex items-center justify-center pt-1 text-[11px] text-muted-foreground",children:o}),e[5]=o,e[6]=a):a=e[6];let h;return e[7]!==r||e[8]!==a?(h=c.jsxs("div",{style:r,className:"flex w-full flex-col gap-1.5 overflow-hidden px-3 py-2",children:[n,a]}),e[7]=r,e[8]=a,e[9]=h):h=e[9],h}function iu(t,e){return c.jsxs("div",{className:le("flex items-center gap-2 rounded px-1 py-0.5",t.tone==="del"&&"bg-destructive/5",t.tone==="add"&&"bg-success/5"),children:[c.jsx("div",{className:le("h-2 w-4 shrink-0 animate-pulse rounded-sm bg-muted",t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")}),c.jsx("div",{className:le("h-2 animate-pulse rounded-sm bg-muted",t.width,t.tone==="del"&&"bg-destructive/20",t.tone==="add"&&"bg-success/25")})]},e)}const Ol={readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12},su={...Ol,lineNumbersMinChars:3,lineDecorationsWidth:4,folding:!1,glyphMargin:!1,renderOverviewRuler:!1};function ru(t){const e=U.c(11),{diff:i,emptyMessage:s,rowClassName:r,onDiscardFile:n,hideFileRows:o,editorHeight:a}=t,h=s===void 0?"No file changes in the working tree":s,l=r===void 0?"px-6":r,u=o===void 0?!1:o,d=a===void 0?"380px":a,[f,_]=X.useState(null),[p,m]=X.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=eu(),e[0]=g):g=e[0];const v=g;if(!i||Object.keys(i.diffs).length===0){let b;return e[1]!==h?(b=c.jsx("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:h}),e[1]=h,e[2]=b):b=e[2],b}let k;return e[3]!==i.diffs||e[4]!==p||e[5]!==d||e[6]!==f||e[7]!==u||e[8]!==n||e[9]!==l?(k=c.jsx("div",{className:"divide-y",children:Object.entries(i.diffs).map(b=>{const[w,C]=b,{from:S,to:R}=C,N=f===w,I=S===null,L=R===null,y=w.startsWith("/")?w.slice(1):w,E=y.lastIndexOf("/"),x=E>=0?y.slice(E+1):y,A=E>=0?y.slice(0,E):null,D=qc(w),P=I?"bg-success":L?"bg-destructive":"bg-warning";return u?c.jsx("div",{children:c.jsx(lo,{original:S??"",modified:R??"",language:D,theme:v,height:d,loading:c.jsx(bo,{height:d}),options:su})},w):c.jsxs("div",{children:[c.jsxs("div",{className:le("flex items-center gap-3 py-3 hover:bg-muted/30",l),children:[c.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:()=>_(N?null:w),children:c.jsx(Ea,{className:le("h-3.5 w-3.5 transition-transform",N&&"rotate-90")})}),c.jsx("div",{className:le("h-2.5 w-2.5 shrink-0 rounded-full",P)}),c.jsx(Ka,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:x}),A&&c.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:A}),n?c.jsxs(us,{children:[c.jsx(cs,{asChild:!0,children:c.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:c.jsx(Ih,{className:"h-3.5 w-3.5"})})}),c.jsx(ds,{align:"end",children:c.jsx(Ai,{className:"text-destructive focus:text-destructive",onSelect:()=>m(w),children:"Discard changes"})})]}):null]}),p===w&&n?c.jsxs("div",{className:le("flex items-center justify-between gap-3 border-t bg-destructive/5 py-2.5",l),children:[c.jsxs("span",{className:"text-xs text-destructive",children:["Discard all changes to"," ",c.jsx("span",{className:"font-medium",children:x}),"? This cannot be undone."]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(pe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>m(null),children:"Cancel"}),c.jsx(pe,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m(null),n(w)},children:"Discard"})]})]}):null,N&&c.jsx("div",{className:"border-t",children:c.jsx(lo,{original:S??"",modified:R??"",language:D,theme:v,height:d,loading:c.jsx(bo,{height:d}),options:Ol})})]},w)})}),e[3]=i.diffs,e[4]=p,e[5]=d,e[6]=f,e[7]=u,e[8]=n,e[9]=l,e[10]=k):k=e[10],k}function nu(t){if(t.kind!=="block"||t.isSiteApp||!t.blockKey)return null;const e=(t.toJson??t.fromJson)?.__resolveType;return typeof e=="string"&&gc(e)?t.blockKey:null}function ou(t){return t.kind!=="page"?!0:!t.pagePath||os(t.pagePath).length>0}function au(t,e){try{return Yc(t,vc,e)}catch{return null}}function lu(t,e){if(t.kind!=="page")return"/";const i=t.pagePath;if(!i)return"";if(os(i).length===0)return i;if(e?.path!==i)return"";const s=Xa(i,e.params);return os(s).length===0?s:""}function hu(t,e){const i=e.trim();if(!i||os(i).length>0)return null;try{const s=new URL(t),r=new URL(i.startsWith("/")?i:`/${i}`,s);return r.origin===s.origin?r:null}catch{return null}}function cu(t,e){if(!e)return null;if(e.kind==="pointer")return ml(t.toString(),e.pointer);try{return new URL(`${t.pathname}${t.search}`,e.previewUrl).href}catch{return null}}function du(t,e,i){return e===null?!1:t!=="other"||i?.kind==="sandbox"}const uu=["split","before","after","code"];function fu(t){return uu.includes(t)}const _u={desktop:1280,mobile:412};function pu(t){const e=U.c(90),{change:i,diff:s,bodyPending:r,previewServerUrl:n,draft:o,lastPage:a}=t,h=Be();let l;e[0]!==i.kind||e[1]!==o||e[2]!==n?(l=du(i.kind,n,o),e[0]=i.kind,e[1]=o,e[2]=n,e[3]=l):l=e[3];const u=l,[d,f]=X.useState(null),_=u?d??"split":"code",[p,m]=X.useState("desktop"),[g,v]=X.useState(null);let k,b,w,C,S,R;if(e[4]!==i||e[5]!==o||e[6]!==a||e[7]!==n||e[8]!==g){b=g??lu(i,a),C=nu(i);let ie;e[15]!==i?(ie=ou(i),e[15]=i,e[16]=ie):ie=e[16],w=ie,R=n?C?au(n,C):hu(n,b):null,k=R?ml(R.toString(),Gc):null,S=R?cu(R,o):null,e[4]=i,e[5]=o,e[6]=a,e[7]=n,e[8]=g,e[9]=k,e[10]=b,e[11]=w,e[12]=C,e[13]=S,e[14]=R}else k=e[9],b=e[10],w=e[11],C=e[12],S=e[13],R=e[14];const N=S;let I;if(e[17]!==i.filepaths||e[18]!==s?.diffs){let ie;e[20]!==s?.diffs?(ie=de=>{const z=s?.diffs[de];return z?[[de,z]]:[]},e[20]=s?.diffs,e[21]=ie):ie=e[21],I={diffs:Object.fromEntries(i.filepaths.flatMap(ie))},e[17]=i.filepaths,e[18]=s?.diffs,e[19]=I}else I=e[19];const L=I;let y;e[22]!==L.diffs?(y=Object.keys(L.diffs),e[22]=L.diffs,e[23]=y):y=e[23];const E=y.length>0;let x;e[24]!==i.kind||e[25]!==i.pagePath||e[26]!==C||e[27]!==h?(x=C!==null?null:i.kind!=="page"?h("thread.publishCompare.globalHint"):i.pagePath&&os(i.pagePath).length>0?h("thread.publishCompare.dynamicHint",{template:i.pagePath}):null,e[24]=i.kind,e[25]=i.pagePath,e[26]=C,e[27]=h,e[28]=x):x=e[28];const A=x;let D;e[29]!==k||e[30]!==i.kind||e[31]!==i.status||e[32]!==p||e[33]!==h?(D=i.status==="new"&&i.kind!=="other"?c.jsx(yo,{icon:c.jsx(Mn,{className:"size-5 text-brand"}),title:h("thread.publishCompare.newTitle"),description:h("thread.publishCompare.newDescription")}):c.jsx(xo,{url:k,device:p,title:h("thread.publishCompare.before"),missing:h("thread.publishCompare.enterPath")}),e[29]=k,e[30]=i.kind,e[31]=i.status,e[32]=p,e[33]=h,e[34]=D):D=e[34];const P=D;let B;e[35]!==N||e[36]!==i.kind||e[37]!==i.status||e[38]!==p||e[39]!==h||e[40]!==R?(B=i.status==="removed"&&i.kind!=="other"?c.jsx(yo,{icon:c.jsx(lr,{className:"size-5 text-destructive"}),title:h("thread.publishCompare.removedTitle"),description:h("thread.publishCompare.removedDescription")}):c.jsx(xo,{url:N,device:p,title:h("thread.publishCompare.after"),missing:h(R?"thread.publishCompare.draftUnavailable":"thread.publishCompare.enterPath")}),e[35]=N,e[36]=i.kind,e[37]=i.status,e[38]=p,e[39]=h,e[40]=R,e[41]=B):B=e[41];const M=B;let K;e[42]===Symbol.for("react.memo_cache_sentinel")?(K=ie=>{fu(ie)&&f(ie)},e[42]=K):K=e[42];let F;e[43]!==u||e[44]!==h?(F=u?c.jsxs(c.Fragment,{children:[c.jsx(Pi,{value:"split",className:"px-3 text-xs",children:h("thread.publishCompare.sideBySide")}),c.jsx(Pi,{value:"before",className:"px-3 text-xs",children:h("thread.publishCompare.before")}),c.jsx(Pi,{value:"after",className:"px-3 text-xs",children:h("thread.publishCompare.after")})]}):null,e[43]=u,e[44]=h,e[45]=F):F=e[45];let H;e[46]!==h?(H=h("thread.publishCompare.code"),e[46]=h,e[47]=H):H=e[47];let Y;e[48]!==H?(Y=c.jsx(Pi,{value:"code",className:"px-3 text-xs",children:H}),e[48]=H,e[49]=Y):Y=e[49];let q;e[50]!==Y||e[51]!==F?(q=c.jsxs($a,{className:"h-8 w-auto",variant:"pill",children:[F,Y]}),e[50]=Y,e[51]=F,e[52]=q):q=e[52];let te;e[53]!==q||e[54]!==_?(te=c.jsx(Ua,{value:_,onValueChange:K,children:q}),e[53]=q,e[54]=_,e[55]=te):te=e[55];let J;e[56]!==N||e[57]!==u||e[58]!==i.pagePath||e[59]!==p||e[60]!==b||e[61]!==w||e[62]!==C||e[63]!==h||e[64]!==_?(J=u&&_!=="code"?c.jsxs(c.Fragment,{children:[C?null:w?c.jsx(jh,{value:b,onChange:ie=>v(ie.target.value),placeholder:i.pagePath??"/","aria-label":h("thread.publishCompare.pathLabel"),className:"h-8 w-56 font-mono text-xs"}):c.jsx("span",{className:"max-w-56 truncate px-1 font-mono text-xs text-muted-foreground",children:b}),c.jsxs("div",{className:"flex items-center rounded-lg border p-0.5",children:[c.jsx(So,{active:p==="desktop",label:h("thread.publishCompare.desktop"),onClick:()=>m("desktop"),children:c.jsx(Vc,{className:"size-3.5"})}),c.jsx(So,{active:p==="mobile",label:h("thread.publishCompare.mobile"),onClick:()=>m("mobile"),children:c.jsx(hc,{className:"size-3.5"})})]}),N?c.jsxs("a",{href:N,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:[c.jsx(Hh,{className:"size-3.5"}),h("thread.publishCompare.openDraft")]}):null]}):null,e[56]=N,e[57]=u,e[58]=i.pagePath,e[59]=p,e[60]=b,e[61]=w,e[62]=C,e[63]=h,e[64]=_,e[65]=J):J=e[65];let Q;e[66]!==te||e[67]!==J?(Q=c.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b bg-background px-4 py-2.5 max-md:pr-12",children:[te,J]}),e[66]=te,e[67]=J,e[68]=Q):Q=e[68];let W;e[69]!==u||e[70]!==A||e[71]!==_?(W=A&&u&&_!=="code"?c.jsx("p",{className:"border-b bg-background px-4 py-1.5 text-[11px] text-muted-foreground",children:A}):null,e[69]=u,e[70]=A,e[71]=_,e[72]=W):W=e[72];let G;e[73]!==r||e[74]!==E||e[75]!==L||e[76]!==h||e[77]!==_?(G=_==="code"?c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background [scrollbar-width:thin]",children:E?c.jsx(ru,{diff:L,hideFileRows:!0,editorHeight:"70vh"}):r?c.jsx(ti,{className:"m-4 h-64 rounded"}):c.jsx("p",{className:"px-4 py-6 text-xs text-muted-foreground",children:h("thread.publishPopover.detailsUnavailable")})}):null,e[73]=r,e[74]=E,e[75]=L,e[76]=h,e[77]=_,e[78]=G):G=e[78];let ee;e[79]!==M||e[80]!==P||e[81]!==u||e[82]!==h||e[83]!==_?(ee=u?c.jsxs("div",{className:le("flex min-h-0 flex-1 gap-3 p-3",_==="code"&&"hidden"),children:[c.jsx(wo,{label:h("thread.publishCompare.before"),hidden:_==="after",children:P}),c.jsx(wo,{label:h("thread.publishCompare.after"),highlight:!0,hidden:_==="before",children:M})]}):null,e[79]=M,e[80]=P,e[81]=u,e[82]=h,e[83]=_,e[84]=ee):ee=e[84];let ue;return e[85]!==Q||e[86]!==W||e[87]!==G||e[88]!==ee?(ue=c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/40",children:[Q,W,G,ee]}),e[85]=Q,e[86]=W,e[87]=G,e[88]=ee,e[89]=ue):ue=e[89],ue}function So(t){const e=U.c(8),{active:i,label:s,onClick:r,children:n}=t,o=i&&"bg-accent text-foreground";let a;e[0]!==o?(a=le("flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground",o),e[0]=o,e[1]=a):a=e[1];let h;return e[2]!==i||e[3]!==n||e[4]!==s||e[5]!==r||e[6]!==a?(h=c.jsx("button",{type:"button","aria-label":s,"aria-pressed":i,title:s,onClick:r,className:a,children:n}),e[2]=i,e[3]=n,e[4]=s,e[5]=r,e[6]=a,e[7]=h):h=e[7],h}function wo(t){const e=U.c(18),{label:i,highlight:s,hidden:r,children:n}=t,o=s===void 0?!1:s,h=(r===void 0?!1:r)&&"hidden";let l;e[0]!==h?(l=le("flex min-h-0 min-w-0 flex-1 flex-col gap-1.5",h),e[0]=h,e[1]=l):l=e[1];const u=o&&"bg-brand";let d;e[2]!==u?(d=le("size-1.5 rounded-full bg-muted-foreground/50",u),e[2]=u,e[3]=d):d=e[3];let f;e[4]!==d?(f=c.jsx("span",{className:d}),e[4]=d,e[5]=f):f=e[5];let _;e[6]!==i||e[7]!==f?(_=c.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:[f,i]}),e[6]=i,e[7]=f,e[8]=_):_=e[8];const p=o&&"border-brand/60";let m;e[9]!==p?(m=le("relative min-h-0 flex-1 overflow-hidden rounded-lg border bg-background",p),e[9]=p,e[10]=m):m=e[10];let g;e[11]!==n||e[12]!==m?(g=c.jsx("div",{className:m,children:n}),e[11]=n,e[12]=m,e[13]=g):g=e[13];let v;return e[14]!==g||e[15]!==l||e[16]!==_?(v=c.jsxs("div",{className:l,children:[_,g]}),e[14]=g,e[15]=l,e[16]=_,e[17]=v):v=e[17],v}function yo(t){const e=U.c(10),{icon:i,title:s,description:r}=t;let n;e[0]!==i?(n=c.jsx("div",{className:"mb-1",children:i}),e[0]=i,e[1]=n):n=e[1];let o;e[2]!==s?(o=c.jsx("p",{className:"text-sm font-medium",children:s}),e[2]=s,e[3]=o):o=e[3];let a;e[4]!==r?(a=c.jsx("p",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=a):a=e[5];let h;return e[6]!==n||e[7]!==o||e[8]!==a?(h=c.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 px-6 text-center",children:[n,o,a]}),e[6]=n,e[7]=o,e[8]=a,e[9]=h):h=e[9],h}function xo(t){const e=U.c(24),{url:i,device:s,title:r,missing:n}=t,[o,a]=Qd(),[h,l]=X.useState(null);if(!i){let S;return e[0]!==n?(S=c.jsx("p",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-muted-foreground",children:n}),e[0]=n,e[1]=S):S=e[1],S}let u;e[2]!==s||e[3]!==i?(u=Pc(i,s),e[2]=s,e[3]=i,e[4]=u):u=e[4];const d=u,f=_u[s],_=o.width>0?Math.min(o.width/f,1):1,p=o.width>0?Math.max((o.width-f*_)/2,0):0;let m;e[5]!==d?(m=()=>l(d),e[5]=d,e[6]=m):m=e[6];const g=o.height>0?o.height/_:"100%",v=`scale(${_})`;let k;e[7]!==f||e[8]!==p||e[9]!==g||e[10]!==v?(k={left:p,width:f,height:g,transform:v,transformOrigin:"top left"},e[7]=f,e[8]=p,e[9]=g,e[10]=v,e[11]=k):k=e[11];let b;e[12]!==d||e[13]!==m||e[14]!==k||e[15]!==r?(b=c.jsx("iframe",{src:d,title:r,sandbox:"allow-scripts allow-same-origin",onLoad:m,className:"absolute top-0 border-0 bg-white",style:k},d),e[12]=d,e[13]=m,e[14]=k,e[15]=r,e[16]=b):b=e[16];let w;e[17]!==h||e[18]!==d?(w=h!==d?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60",children:c.jsx(rs,{className:"size-5 motion-reduce:animate-none"})}):null,e[17]=h,e[18]=d,e[19]=w):w=e[19];let C;return e[20]!==a||e[21]!==b||e[22]!==w?(C=c.jsxs("div",{ref:a,className:"absolute inset-0",children:[b,w]}),e[20]=a,e[21]=b,e[22]=w,e[23]=C):C=e[23],C}const mu=/^Co-authored-by:\s*([^<\r\n]+?)(?:\s*<[^>\r\n]*>)?\s*$/im;function gu(t){if(!t)return null;const e=mu.exec(t)?.[1]?.trim();return e||null}function vu(t){return/\[bot\]$/i.test(t)||/-bot$/i.test(t)}function bu(t){const e=gu(t.body);if(e)return e;const i=t.author.trim();return!i||vu(i)?null:i}function Su(t){const{mode:e,target:i,note:s,allPaths:r,destinationHost:n,publishLockRef:o,onOpenChange:a,refresh:h,onPullRequestChanged:l,onPublished:u}=t,d=Be(),[f,_]=X.useState(!1),[p,m]=X.useState(!1),[g,v]=X.useState(),k=()=>Bd(s,d("thread.publishDialog.changesFrom",{branch:i.headBranch})),b=async()=>{o.current=!0,_(!0),v(void 0);try{await Ad(i,k(),d),Xe.success(n?d("thread.publishPopover.publishedTo",{host:n}):d("thread.publishDialog.publishedTo",{baseBranch:i.baseBranch})),a(!1),await Promise.all([l?.(),u?.()])}catch(S){const R=go(S,d);v(R.message),R.pullRequestOpened&&await l?.(),R.headMoved&&await h()}finally{o.current=!1,_(!1)}},w=async()=>{o.current=!0,_(!0),v(void 0);try{const S=await Td(i,k());Ld(S,d),a(!1),await l?.()}catch(S){const R=go(S,d);v(R.message||d("thread.publishDialog.failedSubmitForReview")),R.headMoved&&await h()}finally{o.current=!1,_(!1)}},C=async(S,R)=>{m(!0);try{await Oc({orgSlug:i.orgSlug,virtualMcpId:i.virtualMcpId,branch:i.branch,threadId:i.threadId},S),Xe.success(R),await h()}catch(N){Xe.error(N instanceof Error?N.message:d("thread.publishPopover.failedDiscard"))}finally{m(!1)}};return{isPublishing:f,isDiscarding:p,publishError:g,submit:e==="review"?w:b,discardChange:S=>C(S.filepaths,d("thread.publishPopover.discarded",{name:S.name})),discardAll:async()=>{r.length!==0&&await C(r,d("thread.publishDialog.allChangesDiscarded"))}}}function wu(t,e,i,s,r,n){return["cms-publish-bodies",t,e,i,s,r,n]}const yu=6e4;function xu(t,e){return e?null:t.files.map(i=>`${i.index}${i.working_dir} ${i.path}`).sort().join(`
10
+ `)}function Cu(t,e,i){const s=U.c(6);let r;s[0]!==i||s[1]!==t||s[2]!==e?(r=An.decofile(`${t}/${e}/${i}`),s[0]=i,s[1]=t,s[2]=e,s[3]=r):r=s[3];let n;s[4]!==r?(n={queryKey:r,queryFn:zh},s[4]=r,s[5]=n):n=s[5];const{data:o}=zi(n);return o}function ku(t){const{orgSlug:e,virtualMcpId:i,branch:s,threadId:r,baseBranch:n,fastPreview:o,recoverSandbox:a}=t,h={orgSlug:e,virtualMcpId:i,branch:s,threadId:r},l=o?{fastPreview:!0}:void 0,u=X.useRef(null),d=async C=>{try{return await C()}catch(S){if(!a||!ul(S))throw S;return u.current??=a(),await u.current,C()}},f=Fh({...dl(h),queryFn:()=>d(()=>jn(h))}),_=f.data,p=_.changedFiles??null,m=_.headSha??null,g=p?p.length>0:Ic(_)||jc(_),v=zi({queryKey:wu(e,i,s,n,m,xu(_,o)),queryFn:()=>d(()=>ll(h,_,n,l)),enabled:g,staleTime:o?yu:0,gcTime:o?void 0:0,throwOnError:(C,S)=>!p&&S.state.data===void 0}),k=Cu(e,i,s),b=v.data??null,w=p?Ll({files:p,lookup:k,diff:b}):jd(b);return{status:_,summary:w,allPaths:p?p.map(C=>C.path):Object.keys(b?.diffs??{}),discardablePaths:o?null:new Set(_.files.map(C=>C.path)),changedFilesTotal:_.changedFilesTotal??w.count,changedFilesTruncated:_.changedFilesTruncated??!1,headSha:m,diff:b,bodiesPending:g&&v.isPending,bodiesFailed:v.isError,cardsPending:!p&&g&&v.isPending,refresh:()=>Promise.all([f.refetch(),o?null:v.refetch()])}}function Eu(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Pu(t){const e=U.c(27),{orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,status:a,diff:h,enabled:l}=t,[u]=Wh(),{language:d}=u;let f,_,p;if(e[0]!==r||e[1]!==h||e[2]!==l||e[3]!==o||e[4]!==d||e[5]!==i||e[6]!==a||e[7]!==n||e[8]!==s){const C=h?Hn(h):"";f=l&&!!r&&!!a&&!!h&&C!=="",p=zi,_=Eu({orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,signature:C,language:d}),e[0]=r,e[1]=h,e[2]=l,e[3]=o,e[4]=d,e[5]=i,e[6]=a,e[7]=n,e[8]=s,e[9]=f,e[10]=_,e[11]=p}else f=e[9],_=e[10],p=e[11];let m;e[12]!==r||e[13]!==h||e[14]!==d||e[15]!==i||e[16]!==a||e[17]!==n||e[18]!==s?(m=()=>Hc({orgSlug:i,virtualMcpId:s,branch:r,threadId:n},{status:a,diff:h,language:d}),e[12]=r,e[13]=h,e[14]=d,e[15]=i,e[16]=a,e[17]=n,e[18]=s,e[19]=m):m=e[19];let g;e[20]!==f||e[21]!==_||e[22]!==m?(g={queryKey:_,queryFn:m,enabled:f,staleTime:1/0,gcTime:6e5,retry:Ru},e[20]=f,e[21]=_,e[22]=m,e[23]=g):g=e[23];const v=p(g),k=v.data??null,b=f&&v.isFetching&&!v.data;let w;return e[24]!==k||e[25]!==b?(w={verdict:k,loading:b},e[24]=k,e[25]=b,e[26]=w):w=e[26],w}function Ru(t,e){return!ul(e)&&t<1}function Bu(t){const e=U.c(30),{orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,status:a,diff:h,policy:l,judgeEnabled:u,paths:d}=t,f=u===void 0?!0:u,_=d===void 0?null:d;let p;e[0]!==h||e[1]!==f||e[2]!==l?(p=f&&Fc(h,l),e[0]=h,e[1]=f,e[2]=l,e[3]=p):p=e[3];const m=p;let g;e[4]!==r||e[5]!==h||e[6]!==o||e[7]!==m||e[8]!==i||e[9]!==a||e[10]!==n||e[11]!==s?(g={orgSlug:i,virtualMcpId:s,branch:r,threadId:n,fastPreview:o,status:a,diff:h,enabled:m},e[4]=r,e[5]=h,e[6]=o,e[7]=m,e[8]=i,e[9]=a,e[10]=n,e[11]=s,e[12]=g):g=e[12];const{verdict:v,loading:k}=Pu(g);if(!h&&_){let S;e[13]!==_||e[14]!==l?(S=zc(_,l),e[13]=_,e[14]=l,e[15]=S):S=e[15];let R;return e[16]!==S?(R={gate:S,ready:!1},e[16]=S,e[17]=R):R=e[17],R}if(!h){let S;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S={gate:{allowed:!0,reason:null},ready:!1},e[18]=S):S=e[18],S}if(!m){let S;e[19]!==h||e[20]!==l?(S=Wc(h,l),e[19]=h,e[20]=l,e[21]=S):S=e[21];let R;return e[22]!==S?(R={gate:S,ready:!0},e[22]=S,e[23]=R):R=e[23],R}let b;e[24]!==k||e[25]!==v?(b=$c(v,k),e[24]=k,e[25]=v,e[26]=b):b=e[26];const w=!k;let C;return e[27]!==b||e[28]!==w?(C={gate:b,ready:w},e[27]=b,e[28]=w,e[29]=C):C=e[29],C}function Il(t){const e=U.c(16),i=X.useRef(!1),s=Be();let r;e[0]!==t?(r=d=>{!d&&i.current||t.onOpenChange(d)},e[0]=t,e[1]=r):r=e[1];const n=r;let o;e[2]!==t.mode||e[3]!==s?(o=t.mode==="review"?s("thread.publishPopover.submitForReview"):s("thread.publishPopover.publish"),e[2]=t.mode,e[3]=s,e[4]=o):o=e[4];let a;e[5]!==o?(a=c.jsx(Uh,{className:"sr-only",children:o}),e[5]=o,e[6]=a):a=e[6];let h;e[7]!==t?(h=t.open?c.jsx(Lu,{...t,publishLockRef:i}):null,e[7]=t,e[8]=h):h=e[8];let l;e[9]!==a||e[10]!==h?(l=c.jsxs(Kh,{"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:[a,h]}),e[9]=a,e[10]=h,e[11]=l):l=e[11];let u;return e[12]!==n||e[13]!==t.open||e[14]!==l?(u=c.jsx($h,{open:t.open,onOpenChange:n,children:l}),e[12]=n,e[13]=t.open,e[14]=l,e[15]=u):u=e[15],u}function Du(t){return["main","master"].includes(t.trim().toLowerCase())}const Au=4,Xs="flex h-[45%] min-h-0 min-w-0 shrink-0 md:h-auto md:flex-1";function Wn(t){const e=U.c(5),{list:i,pane:s}=t;let r;e[0]!==i?(r=c.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:i}),e[0]=i,e[1]=r):r=e[1];let n;return e[2]!==s||e[3]!==r?(n=c.jsxs(c.Fragment,{children:[s,r]}),e[2]=s,e[3]=r,e[4]=n):n=e[4],n}function jl(){const t=U.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=c.jsx("div",{className:le(Xs,"bg-muted/40 p-3"),children:c.jsx(ti,{className:"h-full w-full rounded-lg"})}),t[0]=e):e=t[0],e}function $n(t){const e=U.c(11),{mode:i,title:s,subLine:r,trailing:n}=t,o=i==="review"?ar:cc;let a;e[0]!==o?(a=c.jsx(o,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=o,e[1]=a):a=e[1];let h;e[2]!==a||e[3]!==s||e[4]!==n?(h=c.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a,s,n]}),e[2]=a,e[3]=s,e[4]=n,e[5]=h):h=e[5];let l;e[6]!==r?(l=r?c.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:r}):null,e[6]=r,e[7]=l):l=e[7];let u;return e[8]!==h||e[9]!==l?(u=c.jsxs(c.Fragment,{children:[h,l]}),e[8]=h,e[9]=l,e[10]=u):u=e[10],u}function Un(t){const e=U.c(9),{draftPreviewUrl:i,t:s}=t;let r;e[0]!==i?(r=()=>{i&&window.open(i,"_blank","noopener,noreferrer")},e[0]=i,e[1]=r):r=e[1];const n=!i;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(al,{className:"size-4"}),e[2]=o):o=e[2];let a;e[3]!==s?(a=s("thread.publishPopover.preview"),e[3]=s,e[4]=a):a=e[4];let h;return e[5]!==r||e[6]!==n||e[7]!==a?(h=c.jsxs(pe,{type:"button",variant:"outline",onClick:r,disabled:n,children:[o,a]}),e[5]=r,e[6]=n,e[7]=a,e[8]=h):h=e[8],h}function Tu(t){const e=U.c(21),{mode:i,draftPreviewUrl:s}=t,r=Be();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=c.jsx(jl,{}),e[0]=n):n=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=c.jsx(ti,{className:"h-3.5 w-48"}),e[1]=o):o=e[1];let a;e[2]!==i?(a=c.jsx($n,{mode:i,title:o}),e[2]=i,e[3]=a):a=e[3];let h,l;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Wr,{children:c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(is,{}),c.jsx(is,{}),c.jsx(is,{})]})}),l=c.jsxs(c.Fragment,{children:[c.jsx(ti,{className:"h-3 w-20"}),c.jsx(ti,{className:"h-14 w-full rounded-lg"})]}),e[4]=h,e[5]=l):(h=e[4],l=e[5]);let u;e[6]!==s||e[7]!==r?(u=c.jsx(Un,{draftPreviewUrl:s,t:r}),e[6]=s,e[7]=r,e[8]=u):u=e[8];const d=i==="review"?"default":"brand";let f;e[9]!==i||e[10]!==r?(f=r(i==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[9]=i,e[10]=r,e[11]=f):f=e[11];let _;e[12]!==d||e[13]!==f?(_=c.jsx(pe,{type:"button",variant:d,className:"flex-1",disabled:!0,children:f}),e[12]=d,e[13]=f,e[14]=_):_=e[14];let p;e[15]!==u||e[16]!==_?(p=c.jsxs("div",{className:"flex gap-2",children:[u,_]}),e[15]=u,e[16]=_,e[17]=p):p=e[17];let m;return e[18]!==p||e[19]!==a?(m=c.jsx(Wn,{pane:n,list:c.jsx(Fn,{state:"loading",header:a,body:h,note:l,footer:p})}),e[18]=p,e[19]=a,e[20]=m):m=e[20],m}function Mu(t){const e=U.c(26),{mode:i,draftPreviewUrl:s,message:r,onRetry:n}=t,o=Be();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx("div",{className:le(Xs,"bg-muted/40")}),e[0]=a):a=e[0];let h;e[1]!==o?(h=o("thread.publishPopover.loadFailed"),e[1]=o,e[2]=h):h=e[2];let l;e[3]!==h?(l=c.jsx("span",{className:"truncate",children:h}),e[3]=h,e[4]=l):l=e[4];let u;e[5]!==i||e[6]!==l?(u=c.jsx($n,{mode:i,title:l}),e[5]=i,e[6]=l,e[7]=u):u=e[7];let d;e[8]!==r?(d=c.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:r}),e[8]=r,e[9]=d):d=e[9];let f;e[10]!==s||e[11]!==o?(f=c.jsx(Un,{draftPreviewUrl:s,t:o}),e[10]=s,e[11]=o,e[12]=f):f=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=c.jsx(ns,{className:"size-4"}),e[13]=_):_=e[13];let p;e[14]!==o?(p=o("thread.publishPopover.retry"),e[14]=o,e[15]=p):p=e[15];let m;e[16]!==n||e[17]!==p?(m=c.jsxs(pe,{type:"button",variant:"outline",className:"flex-1",onClick:n,children:[_,p]}),e[16]=n,e[17]=p,e[18]=m):m=e[18];let g;e[19]!==f||e[20]!==m?(g=c.jsxs("div",{className:"flex gap-2",children:[f,m]}),e[19]=f,e[20]=m,e[21]=g):g=e[21];let v;return e[22]!==g||e[23]!==u||e[24]!==d?(v=c.jsx(Wn,{pane:a,list:c.jsx(Fn,{state:"ready",header:u,body:d,footer:g})}),e[22]=g,e[23]=u,e[24]=d,e[25]=v):v=e[25],v}function Lu(t){const e=U.c(3),i=t.mode??"publish";let s;return e[0]!==i||e[1]!==t?(s=c.jsx(qh,{children:r=>{const{reset:n}=r;return c.jsx(Vh,{fallback:o=>{const{error:a,resetError:h}=o;return c.jsx(Mu,{mode:i,draftPreviewUrl:t.draftPreviewUrl,message:a?.message??"",onRetry:()=>{n(),h()}})},children:c.jsx(X.Suspense,{fallback:c.jsx(Tu,{mode:i,draftPreviewUrl:t.draftPreviewUrl}),children:c.jsx(Nu,{...t})})})}}),e[0]=i,e[1]=t,e[2]=s):s=e[2],s}function Nu(t){const e=U.c(139),{publishLockRef:i,onOpenChange:s,mode:r,fastPreview:n,recoverSandbox:o,orgSlug:a,virtualMcpId:h,branch:l,baseBranch:u,repoTarget:d,owner:f,repo:_,publishPolicy:p,draftPreviewUrl:m,destinationHost:g,previewServerUrl:v,compareDraft:k,lastPublishedPr:b,onRequestApproval:w,openPullRequest:C,onPullRequestChanged:S,onPublished:R}=t,N=r===void 0?"publish":r,I=b===void 0?null:b,L=C===void 0?null:C,y=Be(),E=Wi()?.taskId??null,{data:x}=sr.useSession(),A=Ra(Ba(a,h,l));let D;e[0]!==u||e[1]!==l||e[2]!==n||e[3]!==a||e[4]!==o||e[5]!==E||e[6]!==h?(D={orgSlug:a,virtualMcpId:h,branch:l,threadId:E,baseBranch:u,fastPreview:n,recoverSandbox:o},e[0]=u,e[1]=l,e[2]=n,e[3]=a,e[4]=o,e[5]=E,e[6]=h,e[7]=D):D=e[7];const{status:P,summary:B,allPaths:M,discardablePaths:K,changedFilesTotal:F,changedFilesTruncated:H,headSha:Y,diff:q,bodiesPending:te,bodiesFailed:J,cardsPending:Q,refresh:W}=ku(D),[G,ee]=X.useState(null),[ue,ie]=X.useState(!1),[de,z]=X.useState(null);let ge;e[8]===Symbol.for("react.memo_cache_sentinel")?(ge=[],e[8]=ge):ge=e[8];const[fe,Le]=X.useState(ge);let oe;e[9]===Symbol.for("react.memo_cache_sentinel")?(oe=ae=>{z(ae),Le(ve=>[ae,...ve.filter(Se=>Se!==ae)])},e[9]=oe):oe=e[9];const $=oe,[De,At]=X.useState(null);let Ye;e[10]!==G||e[11]!==B?(Ye=Wd(G,Ud(B)),e[10]=G,e[11]=B,e[12]=Ye):Ye=e[12];const He=Ye,it=[...B.pages,...B.blocks,...B.other],Ne=it.find(ae=>Qt(ae)===de)??it[0]??null,yt=Ne?Qt(Ne):null,Wt=[...new Set([...yt?[yt]:[],...fe,...it.map(Qt)])].filter(ae=>it.some(ve=>Qt(ve)===ae)).slice(0,Au),ce=N==="review",Ke=Q?"loading":te?"manifest":"ready",qe=!ce;let V;e[13]!==M||e[14]!==l||e[15]!==n||e[16]!==q||e[17]!==P||e[18]!==a||e[19]!==p||e[20]!==qe||e[21]!==E||e[22]!==h?(V={orgSlug:a,virtualMcpId:h,branch:l,threadId:E,fastPreview:n,status:P,diff:q,paths:M,policy:p,judgeEnabled:qe},e[13]=M,e[14]=l,e[15]=n,e[16]=q,e[17]=P,e[18]=a,e[19]=p,e[20]=qe,e[21]=E,e[22]=h,e[23]=V):V=e[23];const{gate:_e}=Bu(V),Ae=L?.state==="open";let ye;e[24]!==l||e[25]!==P?(ye=fl(P)??l,e[24]=l,e[25]=P,e[26]=ye):ye=e[26];const Je=x?.user;let nt;e[27]!==Je?(nt=wl(Je),e[27]=Je,e[28]=nt):nt=e[28];const xt=Y??void 0;let ot;e[29]!==n||e[30]!==q?(ot=!n&&q?{expectedDiffSignature:Hn(q)}:{},e[29]=n,e[30]=q,e[31]=ot):ot=e[31];let Tt;e[32]!==u||e[33]!==l||e[34]!==n||e[35]!==a||e[36]!==f||e[37]!==_||e[38]!==d||e[39]!==ye||e[40]!==nt||e[41]!==xt||e[42]!==ot||e[43]!==E||e[44]!==h?(Tt={orgSlug:a,virtualMcpId:h,branch:l,threadId:E,fastPreview:n,baseBranch:u,target:d,owner:f,repo:_,headBranch:ye,coAuthor:nt,expectedHeadSha:xt,...ot},e[32]=u,e[33]=l,e[34]=n,e[35]=a,e[36]=f,e[37]=_,e[38]=d,e[39]=ye,e[40]=nt,e[41]=xt,e[42]=ot,e[43]=E,e[44]=h,e[45]=Tt):Tt=e[45];const $t=Tt;let Mt;e[46]!==M||e[47]!==g||e[48]!==N||e[49]!==He||e[50]!==s||e[51]!==R||e[52]!==S||e[53]!==i||e[54]!==W||e[55]!==$t?(Mt={mode:N,target:$t,note:He,allPaths:M,destinationHost:g,publishLockRef:i,onOpenChange:s,refresh:W,onPullRequestChanged:S,onPublished:R},e[46]=M,e[47]=g,e[48]=N,e[49]=He,e[50]=s,e[51]=R,e[52]=S,e[53]=i,e[54]=W,e[55]=$t,e[56]=Mt):Mt=e[56];const{isPublishing:ke,isDiscarding:Ct,publishError:Lt,submit:Ut,discardChange:ni,discardAll:Kt}=Su(Mt);let Nt;e[57]!==K?(Nt=ae=>K===null||ae.every(ve=>K.has(ve)),e[57]=K,e[58]=Nt):Nt=e[58];const Ot=Nt,qt=!ke&&B.count>0&&(ce||_e.allowed);let It;e[59]!==u||e[60]!==ce||e[61]!==B.count||e[62]!==y?(It=ce?B.count===0?y("thread.publishPopover.submitForReview"):B.count===1?y("thread.publishPopover.submitOneForReview"):y("thread.publishPopover.submitCountForReview",{count:B.count}):B.count===0?y("thread.publishPopover.publish"):Du(u)?B.count===1?y("thread.publishPopover.publishOneInProduction"):y("thread.publishPopover.publishCountInProduction",{count:B.count}):B.count===1?y("thread.publishPopover.publishOne"):y("thread.publishPopover.publishCount",{count:B.count}),e[59]=u,e[60]=ce,e[61]=B.count,e[62]=y,e[63]=It):It=e[63];const Vt=It;let jt;e:{if(ce&&Ae){let Se;e[64]!==L.number||e[65]!==y?(Se=y("thread.publishPopover.updatesPullRequest",{number:L.number}),e[64]=L.number,e[65]=y,e[66]=Se):Se=e[66],jt=Se;break e}const ae=I;if(!ae?.mergedAt){jt=null;break e}let ve;if(e[67]!==ae||e[68]!==y){const Se=Ac(new Date(ae.mergedAt)),se=bu(ae);ve=se?y("thread.publishPopover.lastPublishedBy",{when:Se,name:se}):y("thread.publishPopover.lastPublished",{when:Se}),e[67]=ae,e[68]=y,e[69]=ve}else ve=e[69];jt=ve}const Yt=jt;let Ht;e[70]!==ce||e[71]!==B.count||e[72]!==y?(Ht=ce?y("thread.publishPopover.submitForReview"):B.count===1?y("thread.publishPopover.publishOne"):B.count>1?y("thread.publishPopover.publishCount",{count:B.count}):y("thread.publishPopover.publish"),e[70]=ce,e[71]=B.count,e[72]=y,e[73]=Ht):Ht=e[73];const fi=Ht,Gt=(ae,ve)=>ve.length===0?null:c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("div",{className:"px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:ae}),ve.map(Se=>{const se=Qt(Se);return c.jsx(Jd,{change:Se,bodyPending:te,selected:Ne!==null&&Qt(Ne)===se,onSelect:()=>$(se),confirming:De===se,onConfirmingChange:st=>At(st?se:null),onDiscard:Ot(Se.filepaths)?()=>{ni(Se)}:void 0,isPublishing:ke,isDiscarding:Ct},se)})]});let kt;e:{if(ce||B.count===0){kt=null;break e}if(_e.pending){let se;e[74]===Symbol.for("react.memo_cache_sentinel")?(se=c.jsx(rs,{className:"size-3.5 motion-reduce:animate-none"}),e[74]=se):se=e[74];let st;e[75]!==y?(st=y("thread.publishPopover.reviewing"),e[75]=y,e[76]=st):st=e[76];let Oi;e[77]!==st?(Oi=c.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[se,st]}),e[77]=st,e[78]=Oi):Oi=e[78],kt=Oi;break e}if(_e.allowed){kt=null;break e}let ae;e[79]===Symbol.for("react.memo_cache_sentinel")?(ae=c.jsx(Pa,{className:"mt-0.5 size-3.5 shrink-0"}),e[79]=ae):ae=e[79];let ve;e[80]!==_e.reason||e[81]!==y?(ve=_e.reason??y("thread.publishPopover.needsReviewGeneric"),e[80]=_e.reason,e[81]=y,e[82]=ve):ve=e[82];let Se;e[83]!==ve?(Se=c.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[ae,c.jsx("span",{children:ve})]}),e[83]=ve,e[84]=Se):Se=e[84],kt=Se}const Xt=kt;let oi;e[85]!==M||e[86]!==Ot||e[87]!==H||e[88]!==Kt||e[89]!==ue||e[90]!==Ct||e[91]!==ke||e[92]!==B.count||e[93]!==y?(oi=B.count<=1||H||!Ot(M)?null:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"ml-auto shrink-0 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>ie(!0),disabled:ke||Ct,children:y("thread.publishPopover.discardAll")}),c.jsx(Wa,{open:ue,onOpenChange:ie,children:c.jsxs(za,{children:[c.jsxs(Ia,{children:[c.jsx(Na,{children:y("thread.publishPopover.discardAllTitle")}),c.jsx(Oa,{children:y("thread.publishPopover.discardAllConfirm")})]}),c.jsxs(Fa,{children:[c.jsx(ja,{children:y("thread.publishDialog.cancel")}),c.jsx(Ha,{onClick:()=>{Kt()},disabled:Ct,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:y("thread.publishPopover.discardAll")})]})]})})]}),e[85]=M,e[86]=Ot,e[87]=H,e[88]=Kt,e[89]=ue,e[90]=Ct,e[91]=ke,e[92]=B.count,e[93]=y,e[94]=oi):oi=e[94];const wi=oi,yi=Q?c.jsx(Wr,{children:c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(is,{}),c.jsx(is,{})]})}):B.count===0?c.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[c.jsx(ol,{className:"mb-1 size-5 text-success"}),c.jsx("p",{className:"text-sm font-medium",children:y(ce?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),c.jsx("p",{className:"text-xs text-muted-foreground",children:y(ce?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):c.jsxs(Wr,{children:[H?c.jsx("p",{className:"text-[11px] text-muted-foreground",children:y("thread.publishPopover.showingFirst",{shown:B.count,total:F})}):null,Gt(y("thread.publishPopover.pagesGroup"),B.pages),Gt(y("thread.publishPopover.blocksGroup"),B.blocks),Gt(y("thread.publishPopover.otherGroup"),B.other),J?c.jsx("p",{className:"text-[11px] text-muted-foreground",children:y("thread.publishPopover.detailsUnavailable")}):null]}),_i=Q?c.jsx(jl,{}):Ne?c.jsx("div",{className:le(Xs,"relative"),children:it.filter(ae=>Wt.includes(Qt(ae))).map(ae=>c.jsx("div",{className:le("absolute inset-0 flex",Qt(ae)!==yt&&"hidden"),children:c.jsx(pu,{change:ae,diff:q,bodyPending:te,previewServerUrl:v,draft:k,lastPage:A})},Qt(ae)))}):c.jsx("div",{className:le(Xs,"bg-muted/40")});let at;e[95]!==Vt?(at=c.jsx("span",{className:"truncate",children:Vt}),e[95]=Vt,e[96]=at):at=e[96];let lt;e[97]!==wi||e[98]!==N||e[99]!==Yt||e[100]!==at?(lt=c.jsx($n,{mode:N,title:at,subLine:Yt,trailing:wi}),e[97]=wi,e[98]=N,e[99]=Yt,e[100]=at,e[101]=lt):lt=e[101];let ht;e[102]!==ke||e[103]!==ce||e[104]!==He||e[105]!==B.count||e[106]!==y?(ht=B.count===0?null:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[13px] font-medium",children:y(ce?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),c.jsx(Dc,{value:He,onChange:ae=>ee(ae.target.value),placeholder:y(ce?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,maxLength:qs,className:"resize-none text-[13px]",disabled:ke})]}),e[102]=ke,e[103]=ce,e[104]=He,e[105]=B.count,e[106]=y,e[107]=ht):ht=e[107];let ct;e[108]!==m||e[109]!==y?(ct=c.jsx(Un,{draftPreviewUrl:m,t:y}),e[108]=m,e[109]=y,e[110]=ct):ct=e[110];let dt;e[111]!==qt||e[112]!==_e||e[113]!==ke||e[114]!==ce||e[115]!==w||e[116]!==fi||e[117]!==Ut||e[118]!==B.count||e[119]!==y?(dt=!ce&&B.count>0&&!_e.allowed&&!_e.pending?c.jsx(pe,{type:"button",className:"flex-1",onClick:w,disabled:ke,children:y("thread.publishPopover.requestApproval")}):c.jsxs(pe,{type:"button",variant:ce?"default":"brand",className:"flex-1",onClick:()=>{Ut()},disabled:!qt,children:[ke?c.jsx(rs,{className:"size-4 motion-reduce:animate-none"}):null,ke?y(ce?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):fi]}),e[111]=qt,e[112]=_e,e[113]=ke,e[114]=ce,e[115]=w,e[116]=fi,e[117]=Ut,e[118]=B.count,e[119]=y,e[120]=dt):dt=e[120];let ut;e[121]!==ct||e[122]!==dt?(ut=c.jsxs("div",{className:"flex gap-2",children:[ct,dt]}),e[121]=ct,e[122]=dt,e[123]=ut):ut=e[123];let ft;e[124]!==Lt?(ft=Lt?c.jsx("p",{className:"text-xs text-destructive",children:Lt}):null,e[124]=Lt,e[125]=ft):ft=e[125];let _t;e[126]!==ut||e[127]!==ft?(_t=c.jsxs(c.Fragment,{children:[ut,ft]}),e[126]=ut,e[127]=ft,e[128]=_t):_t=e[128];let pt;e[129]!==yi||e[130]!==Xt||e[131]!==Ke||e[132]!==lt||e[133]!==ht||e[134]!==_t?(pt=c.jsx(Fn,{state:Ke,header:lt,body:yi,note:ht,gate:Xt,footer:_t}),e[129]=yi,e[130]=Xt,e[131]=Ke,e[132]=lt,e[133]=ht,e[134]=_t,e[135]=pt):pt=e[135];let Ft;return e[136]!==_i||e[137]!==pt?(Ft=c.jsx(Wn,{pane:_i,list:pt}),e[136]=_i,e[137]=pt,e[138]=Ft):Ft=e[138],Ft}function Ou(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return bc[t].short}const Iu=new Set(["failure","timed_out","cancelled","action_required"]);function Hl(t){return t.status==="completed"&&Iu.has(t.conclusion)}function Kn(t){return t.status==="queued"||t.status==="in_progress"}function js(t){return t.isPending&&t.fetchStatus!=="idle"}function ju(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr-page"}}function ai(t,e,i){return e?[...t,ju(i)]:t}function zt(t,e,i){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:i("thread.cmsActions.getLatest"),action:"sync",tooltip:i("thread.cmsActions.getLatestTooltip")}]}function Co(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function Ds(t,e,i){if(e.filter(Kn).length===0)return t;const r=e.filter(n=>n.status==="completed").length;return{...t,tooltip:i("thread.cmsActions.checksRunning",{done:r,total:e.length})}}function Hu(t){const{lifecycle:e,branch:i,pr:s,checks:r,reviews:n,loading:o,t:a}=t;if(o)return{label:a("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&Ou(t.claimPhase.kind)||a("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:a("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:a("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||a("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:a("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:a("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(i.kind==="ready"&&(i.workingTreeDirty||i.aheadOfBase>0||i.unpushed>0))&&!t.noReviewableDiff)return{label:a("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(i.kind!=="ready")return{label:a("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForBranchTooltip"),menu:[]};const h=i,l=h.unpushed>0&&!(s&&h.headSha&&s.headSha&&h.headSha===s.headSha);if(t.noReviewableDiff&&!s)return{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:h.base}),menu:zt([],h,a)};if(h.workingTreeDirty||l)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:zt(ai([Co(a)],s,a),h,a)};if(gl("no local work — checking PR/sync state",{workingTreeDirty:h.workingTreeDirty,unpushed:h.unpushed,aheadOfBase:h.aheadOfBase,behindBase:h.behindBase,branch:h.branch,base:h.base,prMerged:s?.merged??null,prState:s?.state??null}),s?.merged)return!!h.headSha&&!!s.headSha&&h.headSha!==s.headSha?{label:a("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:a("thread.headerActions.openNewPrTooltip"),menu:zt(ai([],s,a),h,a)}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.prMergedTooltip",{prNumber:String(s.number),base:s.base}),menu:zt(ai([],s,a),h,a)};if(h.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:a("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:a("thread.headerActions.reopenPrTooltip",{prNumber:String(s.number)}),menu:zt(ai([],s,a),h,a)};if(!s)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:zt([Co(a)],h,a)};if((n?.mergeableState??"unknown")==="dirty")return{label:a("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:a("thread.cmsActions.resolveOnProvider"),action:"open-pr-page"}]};const d=r.filter(Kn).length,f=r.filter(Hl).map(p=>p.name);if(d===0&&f.length>0)return{label:a("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:a("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:zt(ai([{key:"publish-anyway",label:a("thread.headerActions.publishAnyway"),action:"merge",tooltip:a("thread.headerActions.squashMergeTooltip",{prNumber:String(s.number),base:s.base})}],s,a),h,a)};if(n?.draft)return Ds({label:a("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:a("thread.headerActions.markDraftReadyTooltip"),menu:zt(ai([],s,a),h,a)},r,a);const _=n?.unresolvedConversations??0;return _>0?Ds({label:a("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:a("thread.headerActions.unresolvedConversationsTooltip",{count:String(_)}),menu:zt(ai([],s,a),h,a)},r,a):n?.missingRequiredApprovals?Ds({label:a("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:a("thread.headerActions.waitingForApprovalsTooltip"),menu:zt(ai([],s,a),h,a)},r,a):Ds({label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:zt(ai([{key:"review",label:a("thread.headerActions.review"),action:"review"}],s,a),h,a)},r,a)}return h.behindBase>0?{label:a("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:h.base}),menu:[]}}function ko(t){return{key:"view-change-request",label:t("thread.cmsActions.viewOnProvider"),action:"open-pr"}}function As(t,e,i){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:i("thread.cmsActions.getLatest"),action:"get-latest",tooltip:i("thread.cmsActions.getLatestTooltip")}]}function Eo(t,e,i,s){const r=e.length;if(r===0)return t;if(e.filter(Kn).length>0){const a=e.filter(l=>l.status==="completed").length,h=s("thread.cmsActions.checksRunning",{done:a,total:r});return i==="loading"?{...t,loading:!0,tooltip:h}:{...t,tooltip:h}}const o=e.filter(Hl).length;return o>0?{...t,variant:"warning",tooltip:s("thread.cmsActions.checksFailing",{failed:o,total:r})}:t}function Fu(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function zu(t){return js(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:js(t.checksQuery)||js(t.reviewsQuery)}function Wu(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function $u(t){const{branch:e,pr:i,checks:s,reviews:r,publishing:n,saving:o,loading:a,publishableChangeCount:h,t:l}=t;if(e.kind!=="ready"&&t.statusError)return{label:l("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(a||e.kind!=="ready")return{label:l("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(n)return{label:l("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:l("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:l("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(i&&i.state==="open"&&!i.merged?i:null){const d=r?.mergeableState??"unknown";return d==="dirty"?{label:l("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-provider",label:l("thread.cmsActions.resolveOnProvider"),action:"open-pr"}]}:d==="blocked"||r?.draft?Eo({label:l("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:As([ko(l)],e,l)},s,"loading",l):Eo({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:As([ko(l)],e,l)},s,"none",l)}return Fu(i,e)?{label:l("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:As([],e,l)}:Wu(e,h)?{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:As([{key:"request-approval",label:l("thread.headerActions.submitForReview"),action:"request-approval"}],e,l)}:e.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[],autoRun:e.aheadOfBase===0}:{label:l("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function Uu(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function Fl(t){const e=U.c(4);let i;e[0]!==t?(i=Ec(t),e[0]=t,e[1]=i):i=e[1];let s;return e[2]!==i?(s={...i,select:Ku},e[2]=i,e[3]=s):s=e[3],zi(s)}function Ku(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:Uu(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function Po(t,e){return t==="open-pr"||e==="resolve-on-provider"?c.jsx(sl,{size:16}):t==="publish"?c.jsx(qa,{className:"size-4"}):t==="get-latest"||t==="retry-status"?c.jsx(ns,{className:"size-4"}):c.jsx(ar,{className:"size-4"})}function qu(t){const e=U.c(66),{virtualMcpId:i}=t,s=Be(),{org:r}=rr(),n=Yh(),o=hr(i),{data:a}=sr.useSession(),{deleteRelease:h}=Ln(i),{currentBranch:l,setCurrentTaskBranch:u,taskId:d,createTask:f}=Da();let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_={open:!1,mode:"publish"},e[0]=_):_=e[0];const[p,m]=X.useState(_);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=V=>m({open:!0,mode:V}),e[1]=g):g=e[1];const v=g,k=Qa(o),b=k.status==="attached"||k.status==="public-clone"?k.repo:null,{previewServerUrl:w}=cr(i);let C;if(e[2]!==l||e[3]!==r.slug||e[4]!==i){const V=l?Ra(Ba(r.slug,i,l)):null;C=V?Xa(V.path,V.params):"/",e[2]=l,e[3]=r.slug,e[4]=i,e[5]=C}else C=e[5];const S=C;let R;e[6]!==l||e[7]!==S||e[8]!==r.slug||e[9]!==w||e[10]!==i?(R=l?{orgSlug:r.slug,virtualMcpId:i,branch:l,previewServerUrl:w,path:S}:null,e[6]=l,e[7]=S,e[8]=r.slug,e[9]=w,e[10]=i,e[11]=R):R=e[11];const N=Rc(R);let I;e[12]!==l||e[13]!==r.slug||e[14]!==i?(I=l?{orgSlug:r.slug,virtualMcpId:i,branch:l}:null,e[12]=l,e[13]=r.slug,e[14]=i,e[15]=I):I=e[15];const L=Bc(I),y=l??"",E=d??null;let x;e[16]!==r.slug||e[17]!==y||e[18]!==E||e[19]!==i?(x=dl({orgSlug:r.slug,virtualMcpId:i,branch:y,threadId:E}),e[16]=r.slug,e[17]=y,e[18]=E,e[19]=i,e[20]=x):x=e[20];const A=!!l;let D;e[21]!==x||e[22]!==A?(D={...x,enabled:A},e[21]=x,e[22]=A,e[23]=D):D=e[23];const P=zi(D),B=P.data??null,M=B?{kind:"ready",branch:fl(B)??l??"",base:B.base??"main",workingTreeDirty:Uc(B),unpushed:B.unpushed??0,aheadOfBase:B.aheadOfBase??0,behindBase:B.behindBase??0,headSha:B.headSha??""}:{kind:"unknown"},K=B?.changedFiles?Ll({files:B.changedFiles}).count:null,F=(M.kind==="ready"?M.branch:null)??l??null,H=M.kind==="ready"?M.base:"main",Y=el({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:F}),q=Y.data??null,te=tl({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",base:H}),J=il({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:F}),Q=Fl({orgId:r.id,orgSlug:r.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:F});let W;e[24]!==J||e[25]!==q||e[26]!==Y||e[27]!==Q?(W=zu({pr:q,prQuery:Y,checksQuery:J,reviewsQuery:Q}),e[24]=J,e[25]=q,e[26]=Y,e[27]=Q,e[28]=W):W=e[28];const G=W;let ee;e[29]!==Y?(ee=async()=>{await Y.refetch()},e[29]=Y,e[30]=ee):ee=e[30];const ue=ee,ie=io({mutationFn:async()=>{const V=l;await u(Nn(On(a?.user))),V&&V!==H&&await h(V)},onError:Gu});let de;e[31]!==r.slug||e[32]!==d||e[33]!==i?(de=async V=>(await hl({orgSlug:r.slug,virtualMcpId:i,branch:V.branch,threadId:d??null},V.base),V),e[31]=r.slug,e[32]=d,e[33]=i,e[34]=de):de=e[34];let z;e[35]!==l||e[36]!==r.slug||e[37]!==n||e[38]!==s||e[39]!==d||e[40]!==i?(z=async V=>{Xe.success(s("thread.headerActions.syncedWithBase",{base:V.base})),await Promise.all([n.invalidateQueries({queryKey:pl({orgSlug:r.slug,virtualMcpId:i,branch:l??V.branch,threadId:d??null})}),n.invalidateQueries({queryKey:An.decofile(`${r.slug}/${i}/${V.branch}`)})])},e[35]=l,e[36]=r.slug,e[37]=n,e[38]=s,e[39]=d,e[40]=i,e[41]=z):z=e[41];let ge;e[42]!==de||e[43]!==z?(ge={mutationFn:de,onSuccess:z,onError:Yu},e[42]=de,e[43]=z,e[44]=ge):ge=e[44];const fe=io(ge),Le=rl(r.slug,i,l??""),oe=ie.isPending,$=$u({branch:M,pr:q,checks:J.data??[],reviews:Q.data??null,publishing:oe,saving:Le,syncing:fe.isPending,statusRetrying:P.isFetching&&!!P.error,statusError:P.error instanceof Error?P.error.message:P.error?String(P.error):null,loading:!!G,publishableChangeCount:K,t:s}),De=$.autoRun&&M.kind==="ready"&&b&&w?`${F}@${M.headSha}`:null,At=X.useRef(null);if(X.useEffect(()=>{!De||!F||At.current!==De&&(At.current=De,fe.mutate({branch:F,base:H}))},[De,F,H,fe]),k.status==="detached"){let V;e[45]!==s?(V=s("thread.headerActions.reconnectGithub"),e[45]=s,e[46]=V):V=e[46];let _e;e[47]!==V?(_e=c.jsx(St,{asChild:!0,children:c.jsx("span",{children:c.jsx(pe,{size:"sm",variant:"outline",disabled:!0,children:V})})}),e[47]=V,e[48]=_e):_e=e[48];let Ae;e[49]!==s?(Ae=s("thread.headerActions.githubConnectionRemoved"),e[49]=s,e[50]=Ae):Ae=e[50];let ye;e[51]!==Ae?(ye=c.jsx(wt,{children:Ae}),e[51]=Ae,e[52]=ye):ye=e[52];let Je;return e[53]!==_e||e[54]!==ye?(Je=c.jsx(nr,{children:c.jsxs(bt,{children:[_e,ye]})}),e[53]=_e,e[54]=ye,e[55]=Je):Je=e[55],Je}if(!o)return null;if(!b||!w){const V=b?"noPreviewServer":"noRepo";let _e;e[56]!==l||e[57]!==f?(_e=l?()=>{const ye=f?.({runtime:"sandbox",branch:l});ye&&Gh("coding_session_started",{thread_id:ye})}:void 0,e[56]=l,e[57]=f,e[58]=_e):_e=e[58];let Ae;return e[59]!==V||e[60]!==_e?(Ae=c.jsx(Xu,{reason:V,onStartCodingSession:_e}),e[59]=V,e[60]=_e,e[61]=Ae):Ae=e[61],Ae}if(!l)return null;const Ye=V=>{switch(V){case"publish":{v("publish");return}case"request-approval":{v("review");return}case"get-latest":{if(!F||fe.isPending)return;fe.mutate({branch:F,base:H});return}case"retry-status":{P.refetch();return}case"open-pr":{q?.htmlUrl&&window.open(q.htmlUrl,"_blank","noopener,noreferrer");return}}};let He;e[62]!==Ye?(He=V=>({key:V.key,label:V.label,icon:Po(V.action,V.key),...V.tooltip?{tooltip:V.tooltip}:{},onSelect:()=>Ye(V.action)}),e[62]=Ye,e[63]=He):He=e[63];const it=$.menu.map(He),Ne=$.action,yt=$.label,Wt=$.variant,ce=!!$.loading;let Ke;e[64]!==s?(Ke=s("thread.cmsActions.moreActionsAriaLabel"),e[64]=s,e[65]=Ke):Ke=e[65];const qe=c.jsx(Sl,{size:"sm",label:yt,variant:Wt,disabled:!!$.disabled||!Ne,loading:ce,...Ne&&!$.loading?{icon:Po(Ne)}:{},...$.tooltip?{tooltip:$.tooltip}:{},items:it,menuAriaLabel:Ke,onClick:Ne?()=>Ye(Ne):void 0});return c.jsxs(c.Fragment,{children:[qe,l?c.jsx(Il,{open:p.open,mode:p.mode,fastPreview:!0,onOpenChange:V=>{V||m(Vu)},orgSlug:r.slug,virtualMcpId:i,branch:l,baseBranch:H,repoTarget:Bt(b),owner:b.owner,repo:b.name,publishPolicy:_l(o?.metadata?.publishPolicy),draftPreviewUrl:N.url,destinationHost:N.host,previewServerUrl:w,compareDraft:L?{kind:"pointer",pointer:L}:null,lastPublishedPr:te.data??null,onRequestApproval:()=>v("review"),openPullRequest:q?.state==="open"?q:null,onPullRequestChanged:ue,onPublished:()=>ie.mutateAsync()}):null]})}function Vu(t){return{...t,open:!1}}function Yu(t){Xe.error(t instanceof Error?t.message:String(t))}function Gu(t){Xe.error(t instanceof Error?t.message:String(t))}function Xu(t){const e=U.c(14),{reason:i,onStartCodingSession:s}=t,r=Be(),n=!s;let o;e[0]!==r?(o=r("sandbox.cmsUnavailable.startCodingSession"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==s||e[3]!==n||e[4]!==o?(a=c.jsx(St,{asChild:!0,children:c.jsx("span",{children:c.jsx(pe,{size:"sm",variant:"outline",disabled:n,onClick:s,children:o})})}),e[2]=s,e[3]=n,e[4]=o,e[5]=a):a=e[5];let h;e[6]!==i||e[7]!==r?(h=r(i==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=i,e[7]=r,e[8]=h):h=e[8];let l;e[9]!==h?(l=c.jsx(wt,{children:h}),e[9]=h,e[10]=l):l=e[10];let u;return e[11]!==a||e[12]!==l?(u=c.jsx(nr,{children:c.jsxs(bt,{children:[a,l]})}),e[11]=a,e[12]=l,e[13]=u):u=e[13],u}const Li="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 Ju(t){return`Reopen PR #${t.prNumber}. ${Li}`}function Zu(t){return`Rebase \`${t.branch}\` on the latest base and force-push with --force-with-lease. ${Li}`}function Qu(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). ${Li}`}function ef(t){const e=(t.failingChecks??[]).map(i=>`\`${i}\``).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. ${Li}`}function tf(t){return`Mark PR #${t.prNumber} ready for review. ${Li}`}function sf(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. ${Li}`}function rf(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. ${Li}`}function Ro(t){switch(t){case"publish":return c.jsx(qa,{className:"size-4"});case"create-pr":case"reopen":return c.jsx(ar,{className:"size-4"});case"rebase":case"sync":return c.jsx(ns,{className:"size-4"});case"fix-checks":return c.jsx(Pa,{className:"size-4"});case"mark-ready":return c.jsx(ol,{className:"size-4"});case"resolve-comments":return c.jsx(dc,{className:"size-4"});case"merge":return c.jsx(Mc,{className:"size-4"});case"review":return c.jsx(al,{className:"size-4"});case"open-pr-page":return c.jsx(sl,{size:16})}}const Bo=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),Do=new Set(["publish","create-pr"]);function nf(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function of({virtualMcpId:t}){const e=Be(),{org:i}=rr(),{data:s}=sr.useSession(),r=hr(t),{deleteRelease:n}=Ln(t),{currentBranch:o,setCurrentTaskBranch:a,taskId:h}=Da(),l=tc(),{openSidePanel:u}=sc(),[d,f]=X.useState({open:!1,mode:"publish",policyOverride:null}),_=Xc({connectionId:Xh,orgId:i.id,orgSlug:i.slug}),p=Jc(_),[m,g]=X.useState(!1),v=X.useRef(""),k=Qa(r),b=k.status==="attached"||k.status==="public-clone"?k.repo:null,{lifecycle:w,branch:C,phase:S}=dr(),R={orgSlug:i.slug,virtualMcpId:t,branch:o??"",threadId:h??null},I=zi({queryKey:pl(R),queryFn:()=>jn(R),enabled:!!o,staleTime:15e3,refetchInterval:oe=>wr(oe.state.data)?5e3:!1}).data??null,L=C,y=w,E=L.kind==="ready"?L.branch:null,x=o??E??void 0,A=(L.kind==="ready"?L.branch:null)??x??null,D=el({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:A}),P=D.data??null,B=il({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:A}),M=Fl({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",branch:A}),K=tl({orgId:i.id,orgSlug:i.slug,target:Bt(b),owner:b?.owner??"",repo:b?.name??"",base:L.kind==="ready"?L.base:null}),F=L,H=_l(r?.metadata?.publishPolicy),Y=rl(i.slug,t,o??x??""),{previewUrl:q}=vl(),{previewServerUrl:te}=cr(t);if(k.status==="detached")return c.jsx(lf,{label:e("thread.headerActions.githubConnectionRemoved"),children:c.jsx(pe,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!b)return null;const J=A?Hu({lifecycle:y,branch:F,claimPhase:S,pr:P,checks:B.data??[],reviews:M.data??null,noReviewableDiff:wr(I),loading:js(D),t:e}):nf(e),Q=JSON.stringify({label:J.label,branchKind:F.kind,workingTreeDirty:F.kind==="ready"?F.workingTreeDirty:null,unpushed:F.kind==="ready"?F.unpushed:null,aheadOfBase:F.kind==="ready"?F.aheadOfBase:null,lifecycle:y.phase,headBranch:A,noReviewableDiff:wr(I)});v.current!==Q&&(v.current=Q,gl("header button",{label:J.label,tooltip:J.tooltip,action:J.action,chatBranch:o,sandboxBranch:E,sandboxRouteBranch:x,headBranch:A,branchMeta:L,effectiveBranchMeta:F,lifecyclePhase:y.phase,prNumber:P?.number??null,prState:P?.state??null}));const W=oe=>(u(),l.sendMessage({parts:[{type:"text",text:oe}]})),G=l.isStreaming,ee=F.kind==="ready"?F.base:"main",ue=async()=>{await D.refetch()},ie=async()=>{const oe=o,$=Nn(On(s?.user));await a($),oe&&oe!==ee&&await n(oe)},de=async oe=>{if(!(!b||m)){g(!0);try{const $=wl(s?.user);await Cl(i.slug,Bt(b),{number:oe,coAuthor:$}),Xe.success(e("thread.headerActions.publishedPr",{prNumber:String(oe)})),await ue(),await ie()}catch($){Xe.error($ instanceof xl?$.detail??Pd($.reason,e):$ instanceof Error?$.message:e("thread.headerActions.failedToMergePullRequest"))}finally{g(!1)}}},z=(oe,$)=>f({open:!0,mode:oe,policyOverride:$}),ge=oe=>{if(A)switch(oe){case"publish":z("publish",J.meta?.publishPolicyOverride??null);return;case"create-pr":z("review",null);return;case"merge":P&&de(P.number);return;case"sync":if(G)return;W(Qu({branch:A,base:ee}));return;case"open-pr-page":P?.htmlUrl&&window.open(P.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(G)return;P&&W(rf({prNumber:P.number}));return;case"reopen":if(G)return;P&&W(Ju({prNumber:P.number}));return;case"rebase":if(G)return;W(Zu({branch:A}));return;case"fix-checks":if(G)return;P&&W(ef({prNumber:P.number,failingChecks:J.meta?.failingChecks??[]}));return;case"mark-ready":if(G)return;P&&W(tf({prNumber:P.number}));return;case"resolve-comments":if(G)return;P&&W(sf({prNumber:P.number}));return}},fe=m||G,Le=c.jsx(af,{t:e,button:J,actionBusy:fe,changeRequestPending:m,savePending:Y,onAction:ge});return x?c.jsxs(c.Fragment,{children:[Le,c.jsx(Il,{open:d.open,mode:d.mode,fastPreview:!1,recoverSandbox:()=>p.mutateAsync({virtualMcpId:t,branch:x,...h?{threadId:h}:{}}),onOpenChange:oe=>{oe||f($=>({...$,open:!1}))},orgSlug:i.slug,virtualMcpId:t,branch:x,baseBranch:ee,repoTarget:Bt(b),owner:b.owner,repo:b.name,publishPolicy:d.policyOverride??H,draftPreviewUrl:q,destinationHost:null,previewServerUrl:te,compareDraft:q?{kind:"sandbox",previewUrl:q}:null,lastPublishedPr:K.data??null,onRequestApproval:()=>f(oe=>({...oe,open:!0,mode:"review"})),openPullRequest:P?.state==="open"?P:null,onPullRequestChanged:ue,onPublished:ie})]}):Le}function af(t){const e=U.c(44),{t:i,button:s,actionBusy:r,changeRequestPending:n,savePending:o,onAction:a}=t,h=s.action;let l;e[0]!==h||e[1]!==r?(l=r&&h!==void 0&&Bo.has(h),e[0]=h,e[1]=r,e[2]=l):l=e[2];const u=l,d=n&&h==="merge";let f;e[3]!==h||e[4]!==o?(f=o&&h!==void 0&&Do.has(h),e[3]=h,e[4]=o,e[5]=f):f=e[5];const _=f,p=!!s.disabled||u||d||_||!h,m=!!s.loading||d;let g;e[6]!==s.tooltip||e[7]!==u||e[8]!==_||e[9]!==i?(g=u?i("thread.headerActions.chatIsRunning"):_?i("thread.headerActions.saving"):s.tooltip,e[6]=s.tooltip,e[7]=u,e[8]=_,e[9]=i,e[10]=g):g=e[10];const v=g;let k;if(e[11]!==r||e[12]!==s.menu||e[13]!==n||e[14]!==a||e[15]!==o||e[16]!==i){let y;e[18]!==r||e[19]!==n||e[20]!==a||e[21]!==o||e[22]!==i?(y=E=>{const x=r&&Bo.has(E.action),A=o&&Do.has(E.action),D=E.action==="merge"&&n,P=A?i("thread.headerActions.saving"):x?i("thread.headerActions.chatIsRunning"):E.tooltip;return{key:E.key,label:E.label,icon:Ro(E.action),disabled:!!(x||A||D),...P?{tooltip:P}:{},onSelect:()=>a(E.action)}},e[18]=r,e[19]=n,e[20]=a,e[21]=o,e[22]=i,e[23]=y):y=e[23],k=s.menu.map(y),e[11]=r,e[12]=s.menu,e[13]=n,e[14]=a,e[15]=o,e[16]=i,e[17]=k}else k=e[17];const b=k,w=s.label,C=s.variant;let S;e[24]!==h||e[25]!==m?(S=h&&!m?{icon:Ro(h)}:{},e[24]=h,e[25]=m,e[26]=S):S=e[26];let R;e[27]!==v?(R=v?{tooltip:v}:{},e[27]=v,e[28]=R):R=e[28];let N;e[29]!==i?(N=i("thread.headerActions.moreActionsAriaLabel"),e[29]=i,e[30]=N):N=e[30];let I;e[31]!==h||e[32]!==a?(I=h?()=>a(h):void 0,e[31]=h,e[32]=a,e[33]=I):I=e[33];let L;return e[34]!==s.label||e[35]!==s.variant||e[36]!==p||e[37]!==b||e[38]!==m||e[39]!==S||e[40]!==R||e[41]!==N||e[42]!==I?(L=c.jsx(Sl,{size:"sm",label:w,variant:C,disabled:p,loading:m,...S,...R,items:b,menuAriaLabel:N,onClick:I}),e[34]=s.label,e[35]=s.variant,e[36]=p,e[37]=b,e[38]=m,e[39]=S,e[40]=R,e[41]=N,e[42]=I,e[43]=L):L=e[43],L}function lf(t){const e=U.c(9),{label:i,children:s}=t;if(!i){let a;return e[0]!==s?(a=c.jsx(c.Fragment,{children:s}),e[0]=s,e[1]=a):a=e[1],a}let r;e[2]!==s?(r=c.jsx(St,{asChild:!0,children:c.jsx("span",{children:s})}),e[2]=s,e[3]=r):r=e[3];let n;e[4]!==i?(n=c.jsx(wt,{children:i}),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n?(o=c.jsx(nr,{children:c.jsxs(bt,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=o):o=e[8],o}const hf=new Set(["site-editor","content"]);function cf(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&hf.has(t.mainTab)}const Bi="setup";function df(t){const e=U.c(57),i=Be();let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let w;e[3]!==t.scriptTabs?(w=C=>!t.scriptTabs.includes(C),e[3]=t.scriptTabs,e[4]=w):w=e[4],s=t.scripts.filter(w),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const r=s;let n;e[5]!==t?(n=()=>{t.active===Bi?t.onToggle():t.onSelectTab(Bi)},e[5]=t,e[6]=n):n=e[6];const o=n;let a;e[7]!==t.open||e[8]!==i?(a=t.open?i("sandbox.preview.collapseTerminal"):i("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=i,e[9]=a):a=e[9];let h;e[10]!==t.open?(h=t.open?c.jsx(or,{className:"size-4"}):c.jsx(ac,{className:"size-4"}),e[10]=t.open,e[11]=h):h=e[11];let l;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==h?(l=c.jsx(St,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:h})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=h,e[16]=l):l=e[16];let u;e[17]!==t.open||e[18]!==i?(u=t.open?i("sandbox.preview.collapseTerminal"):i("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=i,e[19]=u):u=e[19];let d;e[20]!==u?(d=c.jsx(wt,{children:u}),e[20]=u,e[21]=d):d=e[21];let f;e[22]!==l||e[23]!==d?(f=c.jsxs(bt,{children:[l,d]}),e[22]=l,e[23]=d,e[24]=f):f=e[24];const _=t.active===Bi;let p;e[25]!==o||e[26]!==t.open||e[27]!==i||e[28]!==_?(p=c.jsx(uf,{active:_,open:t.open,onClick:o,t:i}),e[25]=o,e[26]=t.open,e[27]=i,e[28]=_,e[29]=p):p=e[29];let m;e[30]!==t||e[31]!==i?(m=t.scriptTabs.map(w=>c.jsx(_f,{active:t.active===w,onClick:()=>{t.active===w?t.onToggle():t.onSelectTab(w)},onClose:()=>t.onCloseScript(w),t:i,children:w},w)),e[30]=t,e[31]=i,e[32]=m):m=e[32];let g;e[33]!==r||e[34]!==t.onAddScript?(g=c.jsx(pf,{scripts:r,onRun:t.onAddScript}),e[33]=r,e[34]=t.onAddScript,e[35]=g):g=e[35];let v;e[36]!==m||e[37]!==g||e[38]!==p?(v=c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,m,g]}),e[36]=m,e[37]=g,e[38]=p,e[39]=v):v=e[39];let k;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==i?(k=t.showScriptControls?c.jsx(mf,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:i}):c.jsx(ff,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:i}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=i,e[52]=k):k=e[52];let b;return e[53]!==v||e[54]!==k||e[55]!==f?(b=c.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,v,k]}),e[53]=v,e[54]=k,e[55]=f,e[56]=b):b=e[56],b}function uf(t){const e=U.c(11),{active:i,open:s,onClick:r,t:n}=t,o=i&&s,a=i&&s,h=i?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let l;e[0]!==h?(l=le("flex h-6 items-center gap-1.5 rounded-lg border px-2 text-xs",h),e[0]=h,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=c.jsx(Lc,{className:"size-4"}),e[2]=u):u=e[2];let d;e[3]!==n?(d=n("sandbox.toolbar.setupTab"),e[3]=n,e[4]=d):d=e[4];let f;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l||e[9]!==d?(f=c.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:l,children:[u,d]}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=d,e[10]=f):f=e[10],f}function ff(t){const e=U.c(40),{status:i,onStart:s,onStop:r,onRestart:n,onResume:o,onRetry:a,t:h}=t;if(i==="idle"&&s){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Ks,{className:"size-3.5"}),e[0]=l):l=e[0];let u;e[1]!==h?(u=h("sandbox.toolbar.start"),e[1]=h,e[2]=u):u=e[2];let d;return e[3]!==s||e[4]!==u?(d=c.jsxs(pe,{variant:"outline",size:"xs",onClick:s,children:[l," ",u]}),e[3]=s,e[4]=u,e[5]=d):d=e[5],d}if(i==="suspended"&&o){let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Ks,{className:"size-3.5"}),e[6]=l):l=e[6];let u;e[7]!==h?(u=h("sandbox.toolbar.resume"),e[7]=h,e[8]=u):u=e[8];let d;return e[9]!==o||e[10]!==u?(d=c.jsxs(pe,{variant:"outline",size:"xs",onClick:o,children:[l," ",u]}),e[9]=o,e[10]=u,e[11]=d):d=e[11],d}if(i==="errored"&&a){let l;e[12]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(ns,{className:"size-3.5"}),e[12]=l):l=e[12];let u;e[13]!==h?(u=h("sandbox.toolbar.retry"),e[13]=h,e[14]=u):u=e[14];let d;return e[15]!==a||e[16]!==u?(d=c.jsxs(pe,{variant:"outline",size:"xs",onClick:a,children:[l," ",u]}),e[15]=a,e[16]=u,e[17]=d):d=e[17],d}if(i==="starting"||i==="running"){const l=i==="running"&&!!n,u=l?"rounded-r-none border-r-0":void 0;let d;e[18]!==u?(d=le(u),e[18]=u,e[19]=d):d=e[19];let f;e[20]!==h?(f=h("sandbox.toolbar.stop"),e[20]=h,e[21]=f):f=e[21];let _;e[22]!==r||e[23]!==d||e[24]!==f?(_=c.jsx(St,{asChild:!0,children:c.jsx(pe,{variant:"outline",size:"xs",onClick:r,className:d,children:f})}),e[22]=r,e[23]=d,e[24]=f,e[25]=_):_=e[25];let p;e[26]!==h?(p=h("sandbox.toolbar.stopSandboxTooltip"),e[26]=h,e[27]=p):p=e[27];let m;e[28]!==p?(m=c.jsx(wt,{children:p}),e[28]=p,e[29]=m):m=e[29];let g;e[30]!==_||e[31]!==m?(g=c.jsxs(bt,{children:[_,m]}),e[30]=_,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==n||e[34]!==l||e[35]!==h?(v=l&&c.jsxs(us,{children:[c.jsx(cs,{asChild:!0,children:c.jsx(pe,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":h("sandbox.toolbar.moreActions"),children:c.jsx(or,{className:"size-3"})})}),c.jsx(ds,{align:"end",children:c.jsxs(Ai,{onClick:n,children:[c.jsx(ns,{className:"size-3.5"})," ",h("sandbox.toolbar.restart")]})})]}),e[33]=n,e[34]=l,e[35]=h,e[36]=v):v=e[36];let k;return e[37]!==g||e[38]!==v?(k=c.jsxs("div",{className:"flex items-center",children:[g,v]}),e[37]=g,e[38]=v,e[39]=k):k=e[39],k}return null}function _f(t){const e=U.c(17),{active:i,onClick:s,onClose:r,children:n,t:o}=t,a=i?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let h;e[0]!==a?(h=le("flex h-6 items-center rounded-lg border text-xs",a),e[0]=a,e[1]=h):h=e[1];const l=r?"pl-2 pr-1":"px-2",u=i?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==l||e[3]!==u?(d=le("flex h-full items-center",l,u),e[2]=l,e[3]=u,e[4]=d):d=e[4];let f;e[5]!==n||e[6]!==s||e[7]!==d?(f=c.jsx("button",{type:"button",onClick:s,className:d,children:n}),e[5]=n,e[6]=s,e[7]=d,e[8]=f):f=e[8];let _;e[9]!==n||e[10]!==r||e[11]!==o?(_=r&&c.jsx("button",{type:"button","aria-label":o("sandbox.toolbar.closeTab",{tab:String(n)}),onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:c.jsx(Jh,{className:"size-3.5"})}),e[9]=n,e[10]=r,e[11]=o,e[12]=_):_=e[12];let p;return e[13]!==h||e[14]!==f||e[15]!==_?(p=c.jsxs("div",{className:h,children:[f,_]}),e[13]=h,e[14]=f,e[15]=_,e[16]=p):p=e[16],p}function pf(t){const e=U.c(27),{scripts:i,onRun:s}=t,r=Be(),[n,o]=X.useState(!1);let a;e[0]!==r?(a=r("sandbox.toolbar.runScript"),e[0]=r,e[1]=a):a=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=c.jsx(Mn,{className:"size-4"}),e[2]=h):h=e[2];let l;e[3]!==a?(l=c.jsx(St,{asChild:!0,children:c.jsx(Ma,{asChild:!0,children:c.jsx(pe,{variant:"ghost",size:"xs","aria-label":a,children:h})})}),e[3]=a,e[4]=l):l=e[4];let u;e[5]!==r?(u=r("sandbox.toolbar.runScript"),e[5]=r,e[6]=u):u=e[6];let d;e[7]!==u?(d=c.jsx(wt,{children:u}),e[7]=u,e[8]=d):d=e[8];let f;e[9]!==l||e[10]!==d?(f=c.jsxs(bt,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=f):f=e[11];let _;e[12]!==r?(_=r("sandbox.toolbar.runAScript"),e[12]=r,e[13]=_):_=e[13];let p;e[14]!==_?(p=c.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:_}),e[14]=_,e[15]=p):p=e[15];let m;e[16]!==s||e[17]!==i||e[18]!==r?(m=i.length===0?c.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:r("sandbox.toolbar.noScriptsFound")}):i.map(k=>c.jsxs("button",{type:"button",onClick:()=>{o(!1),s(k)},className:"w-full rounded-lg px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",k]},k)),e[16]=s,e[17]=i,e[18]=r,e[19]=m):m=e[19];let g;e[20]!==p||e[21]!==m?(g=c.jsxs(La,{align:"start",className:"p-1 w-56",children:[p,m]}),e[20]=p,e[21]=m,e[22]=g):g=e[22];let v;return e[23]!==n||e[24]!==g||e[25]!==f?(v=c.jsxs(Ta,{open:n,onOpenChange:o,children:[f,g]}),e[23]=n,e[24]=g,e[25]=f,e[26]=v):v=e[26],v}function mf(t){const e=U.c(30),{isRunning:i,isKilling:s,onRun:r,onStop:n,t:o}=t;if(s){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(rs,{className:"size-3.5"}),e[0]=f):f=e[0];let _;e[1]!==o?(_=o("sandbox.toolbar.stopping"),e[1]=o,e[2]=_):_=e[2];let p;return e[3]!==_?(p=c.jsxs(pe,{variant:"outline",size:"xs",disabled:!0,children:[f," ",_]}),e[3]=_,e[4]=p):p=e[4],p}if(!i){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=c.jsx(Ks,{className:"size-3.5"}),e[5]=f):f=e[5];let _;e[6]!==o?(_=o("sandbox.toolbar.run"),e[6]=o,e[7]=_):_=e[7];let p;e[8]!==r||e[9]!==_?(p=c.jsx(St,{asChild:!0,children:c.jsxs(pe,{variant:"outline",size:"xs",onClick:r,children:[f," ",_]})}),e[8]=r,e[9]=_,e[10]=p):p=e[10];let m;e[11]!==o?(m=o("sandbox.toolbar.startProcess"),e[11]=o,e[12]=m):m=e[12];let g;e[13]!==m?(g=c.jsx(wt,{children:m}),e[13]=m,e[14]=g):g=e[14];let v;return e[15]!==p||e[16]!==g?(v=c.jsxs(bt,{children:[p,g]}),e[15]=p,e[16]=g,e[17]=v):v=e[17],v}let a;e[18]!==o?(a=o("sandbox.toolbar.stop"),e[18]=o,e[19]=a):a=e[19];let h;e[20]!==n||e[21]!==a?(h=c.jsx(St,{asChild:!0,children:c.jsx(pe,{variant:"outline",size:"xs",onClick:n,children:a})}),e[20]=n,e[21]=a,e[22]=h):h=e[22];let l;e[23]!==o?(l=o("sandbox.toolbar.stopProcess"),e[23]=o,e[24]=l):l=e[24];let u;e[25]!==l?(u=c.jsx(wt,{children:l}),e[25]=l,e[26]=u):u=e[26];let d;return e[27]!==h||e[28]!==u?(d=c.jsxs(bt,{children:[h,u]}),e[27]=h,e[28]=u,e[29]=d):d=e[29],d}var zl=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,vf=(t,e)=>{for(var i in e)zl(t,i,{get:e[i],enumerable:!0})},Pe=(t,e,i,s)=>{for(var r=s>1?void 0:s?gf(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&zl(e,i,r),r},j=(t,e)=>(i,s)=>e(i,s,t),Ao="Terminal input",qr={get:()=>Ao,set:t=>Ao=t},To="Too much output to announce, navigate to rows manually to read",Vr={get:()=>To,set:t=>To=t};function bf(t){return t.replace(/\r?\n/g,"\r")}function Sf(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function wf(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function yf(t,e,i,s){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Wl(r,e,i,s)}}function Wl(t,e,i,s){t=bf(t),t=Sf(t,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function $l(t,e,i){let s=i.getBoundingClientRect(),r=t.clientX-s.left-10,n=t.clientY-s.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function Mo(t,e,i,s,r){$l(t,e,i),r&&s.rightClickSelect(t),e.value=s.selectionText,e.select()}function vi(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function fr(t,e=0,i=t.length){let s="";for(let r=e;r<i;++r){let n=t[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var xf=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let i=t.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=t.charCodeAt(r++);56320<=n&&n<=57343?e[s++]=(this._interim-55296)*1024+n-56320+65536:(e[s++]=this._interim,e[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=t.charCodeAt(n);56320<=a&&a<=57343?e[s++]=(o-55296)*1024+a-56320+65536:(e[s++]=o,e[s++]=a);continue}o!==65279&&(e[s++]=o)}return s}},Cf=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let i=t.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let f=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let p=0,m;for(;(m=this.interim[++p]&63)&&p<4;)_<<=6,_|=m;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=g-p;for(;l<v;){if(l>=i)return 0;if(m=t[l++],(m&192)!==128){l--,f=!0;break}else this.interim[p++]=m,_<<=6,_|=m&63}f||(g===2?_<128?l--:e[s++]=_:g===3?_<2048||_>=55296&&_<=57343||_===65279||(e[s++]=_):_<65536||_>1114111||(e[s++]=_)),this.interim.fill(0)}let u=i-4,d=l;for(;d<i;){for(;d<u&&!((r=t[d])&128)&&!((n=t[d+1])&128)&&!((o=t[d+2])&128)&&!((a=t[d+3])&128);)e[s++]=r,e[s++]=n,e[s++]=o,e[s++]=a,d+=4;if(r=t[d++],r<128)e[s++]=r;else if((r&224)===192){if(d>=i)return this.interim[0]=r,s;if(n=t[d++],(n&192)!==128){d--;continue}if(h=(r&31)<<6|n&63,h<128){d--;continue}e[s++]=h}else if((r&240)===224){if(d>=i)return this.interim[0]=r,s;if(n=t[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=t[d++],(o&192)!==128){d--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[s++]=h}else if((r&248)===240){if(d>=i)return this.interim[0]=r,s;if(n=t[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=t[d++],(a&192)!==128){d--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;e[s++]=h}}return s}},Ul="",bi=" ",fs=class Kl{constructor(){this.fg=0,this.bg=0,this.extended=new Js}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Kl;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Js=class ql{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new ql(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Dt=class Vl extends fs{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Js,this.combinedData=""}static fromCharData(e){let i=new Vl;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?vi(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Lo="di$target",Yr="di$dependencies",Er=new Map;function kf(t){return t[Yr]||[]}function Ue(t){if(Er.has(t))return Er.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ef(e,i,r)};return e._id=t,Er.set(t,e),e}function Ef(t,e,i){e[Lo]===e?e[Yr].push({id:t,index:i}):(e[Yr]=[{id:t,index:i}],e[Lo]=e)}var et=Ue("BufferService"),Yl=Ue("CoreMouseService"),Ni=Ue("CoreService"),Pf=Ue("CharsetService"),qn=Ue("InstantiationService"),Gl=Ue("LogService"),tt=Ue("OptionsService"),Xl=Ue("OscLinkService"),Rf=Ue("UnicodeService"),_s=Ue("DecorationService"),Gr=class{constructor(t,e,i){this._bufferService=t,this._optionsService=e,this._oscLinkService=i}provideLinks(t,e){let i=this._bufferService.buffer.lines.get(t-1);if(!i){e(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Dt,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let u=0;u<o;u++)if(!(h===-1&&!i.hasContent(u))){if(i.loadCell(u,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=u,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&u===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let f={start:{x:h+1,y:t},end:{x:u+(!l&&u===o-1?1:0),y:t}},_=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(d);["http:","https:"].includes(p.protocol)||(_=!0)}catch{_=!0}_||s.push({text:d,range:f,activate:(p,m)=>r?r.activate(p,m,f):Bf(p,m),hover:(p,m)=>r?.hover?.(p,m,f),leave:(p,m)=>r?.leave?.(p,m,f)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=u,a=n.extended.urlId):(h=-1,a=-1)}}e(s)}};Gr=Pe([j(0,et),j(1,tt),j(2,Xl)],Gr);function Bf(t,e){if(confirm(`Do you want to navigate to ${e}?
11
11
 
12
12
  WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var _r=Ue("CharSizeService"),di=Ue("CoreBrowserService"),Vn=Ue("MouseService"),ui=Ue("RenderService"),Df=Ue("SelectionService"),Jl=Ue("CharacterJoinerService"),$i=Ue("ThemeService"),Zl=Ue("LinkProviderService"),Af=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?No.isErrorNoTelemetry(t)?new No(t.message+`
13
13