decocms 4.263.2 → 4.263.3

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 (226) hide show
  1. package/dist/client/assets/{AlertCircle-DL3U1yq7.js → AlertCircle-C8ZNKM0T.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DTwkuP_y.js → AreaChart-BYK2gWYF.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-BDtQVDZJ.js → ArrowLeft-C4S3t4gh.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-DUua93WQ.js → ArrowUp-BjteiNgF.js} +1 -1
  5. package/dist/client/assets/{Check-CFdAuLVR.js → Check-7fxTQqwV.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-Ccs86bUg.js → CheckCircle-Ds0VlJAl.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-Bh9AZv82.js → ChevronDown-DC3VmpPs.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-Bt0Ps5hy.js → ChevronRight-DB1jERJP.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-CbP69kXl.js → ChevronSelectorVertical-B9rG_ZYr.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-CYbM4ZwP.js → ChevronUp-DklUcnpq.js} +1 -1
  11. package/dist/client/assets/{Copy01-CKmyRUyl.js → Copy01-0rsYyxBd.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-DXJKk1Wt.js → CreditCard01-C02kJIQ-.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-C5qhPHKZ.js → DotsVertical-CtEAbV8O.js} +1 -1
  14. package/dist/client/assets/{Download01-DZdiDQUS.js → Download01-B_W2m-uX.js} +1 -1
  15. package/dist/client/assets/{Eye-DFHNhYtx.js → Eye-CCl0QwVV.js} +1 -1
  16. package/dist/client/assets/{FilterLines-C01-F8gV.js → FilterLines-v44MczT5.js} +1 -1
  17. package/dist/client/assets/{Globe01-qBOiIpcJ.js → Globe01-Dr2wIPy6.js} +1 -1
  18. package/dist/client/assets/{Globe04-DyPo8R4R.js → Globe04-BlbLK8Qh.js} +1 -1
  19. package/dist/client/assets/{HardDrive-DMA6WwJi.js → HardDrive-DKQRwLSP.js} +1 -1
  20. package/dist/client/assets/{Key01-CQ2Pckpa.js → Key01-kpUUZaqy.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-CDWxDAhW.js → LinkExternal01-NyjdMVf7.js} +1 -1
  22. package/dist/client/assets/{LockUnlocked01-BJDlnHNP.js → LockUnlocked01-DsKz0Xl2.js} +1 -1
  23. package/dist/client/assets/{LogOut01-DYTwrIyB.js → LogOut01-Dd8QdhEu.js} +1 -1
  24. package/dist/client/assets/{Monitor01-CW9D8oQR.js → Monitor01-CCXNZQlH.js} +1 -1
  25. package/dist/client/assets/{Palette-CYMwYnzJ.js → Palette-BffjPXio.js} +1 -1
  26. package/dist/client/assets/{Play-D5VBgg81.js → Play-D8AheaUt.js} +1 -1
  27. package/dist/client/assets/{Plus-DJBOKCXM.js → Plus-DfL6u6I_.js} +1 -1
  28. package/dist/client/assets/{SearchLg-D05XfMH4.js → SearchLg-D1p_gJI8.js} +1 -1
  29. package/dist/client/assets/{SearchMd-Bvk6cmtM.js → SearchMd-DVItXoZb.js} +1 -1
  30. package/dist/client/assets/{Settings02-BXfVk1mb.js → Settings02-Bvo1tVwA.js} +1 -1
  31. package/dist/client/assets/{Share07-DRhhhSu7.js → Share07-3Y0P_W3_.js} +1 -1
  32. package/dist/client/assets/{Shield01--vYJckXn.js → Shield01-C4putjAN.js} +1 -1
  33. package/dist/client/assets/{Stars01-Cfn7XpKF.js → Stars01-ClK-g0zk.js} +1 -1
  34. package/dist/client/assets/{Stars02-BEZaBHTc.js → Stars02-DTCJxH0_.js} +1 -1
  35. package/dist/client/assets/{Sun-CxlEqCDi.js → Sun-DBnfC6xb.js} +1 -1
  36. package/dist/client/assets/{SwitchHorizontal01-BPoIdNhd.js → SwitchHorizontal01-CQZ9t4Uh.js} +1 -1
  37. package/dist/client/assets/{Tool01-D15DzDIB.js → Tool01-K1KtrUp3.js} +1 -1
  38. package/dist/client/assets/{Tool02-DcVuymPV.js → Tool02-CaMOVLUq.js} +1 -1
  39. package/dist/client/assets/{Trash01-rd-vb1MA.js → Trash01-Hh3vb-pV.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-BBA3UF71.js → TrendUp01-Cpu4_O9X.js} +1 -1
  41. package/dist/client/assets/{Upload01-CURnTiOx.js → Upload01-PO1Z12J3.js} +1 -1
  42. package/dist/client/assets/{User01-CGWss5jM.js → User01-ClQH_5NK.js} +1 -1
  43. package/dist/client/assets/{UserSquare-DNzPXyDT.js → UserSquare-DtGKXF0N.js} +1 -1
  44. package/dist/client/assets/{Users01-B043Q3B_.js → Users01-Bvqsn2Z0.js} +1 -1
  45. package/dist/client/assets/{Users03-CeFJXyBc.js → Users03-C1f0X_bD.js} +1 -1
  46. package/dist/client/assets/{XCircle-vpb-OIYV.js → XCircle-qXvFFF3a.js} +1 -1
  47. package/dist/client/assets/{XClose-Ca1B07wN.js → XClose-F4_KA-E6.js} +1 -1
  48. package/dist/client/assets/{YAxis-CEmbkD2K.js → YAxis-Bwjlsmrn.js} +1 -1
  49. package/dist/client/assets/{Zap-DoBPpnDg.js → Zap-DK06ViId.js} +1 -1
  50. package/dist/client/assets/{ZapSquare-B52zBMI0.js → ZapSquare-B8eYKtXE.js} +1 -1
  51. package/dist/client/assets/{access-gate-BT3_V_pA.js → access-gate-C5Y4THSz.js} +1 -1
  52. package/dist/client/assets/{agent-icon-Dt8TTBNR.js → agent-icon-BRsJ64Gp.js} +1 -1
  53. package/dist/client/assets/{agents-list-BVmLhzQp.js → agents-list-Cb5QyV0J.js} +1 -1
  54. package/dist/client/assets/{ai-providers-nCIA03hu.js → ai-providers-F9sUAX3N.js} +1 -1
  55. package/dist/client/assets/{alert-CVrfLuO_.js → alert-DjabJJJC.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-COKsRPdB.js → alert-dialog-C6uvTNV5.js} +1 -1
  57. package/dist/client/assets/{api-keys-B2kzULLm.js → api-keys-DmdCnjmd.js} +1 -1
  58. package/dist/client/assets/{app-editor-Bq3jQAI6.js → app-editor-CCEPa5_q.js} +1 -1
  59. package/dist/client/assets/{auth-Dff1xvcy.js → auth-BjDvWFq6.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-BXu-XwcE.js → auth-catchall-CpusPL_F.js} +1 -1
  61. package/dist/client/assets/{auth-entry-BjUIXBC9.js → auth-entry-DhkykqHc.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-DyTFtZvs.js → auth-split-layout-BvVQruwK.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-BpXFlbw1.js → authenticate-and-persist-oauth-CfcfVqDI.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-BcptvIDe.js → automation-list-row-BO2X7Ov7.js} +1 -1
  65. package/dist/client/assets/{automation-runs-l52V2CDe.js → automation-runs-BQpimZeU.js} +1 -1
  66. package/dist/client/assets/{automations-A1r9cPLm.js → automations-CYoHIEOo.js} +1 -1
  67. package/dist/client/assets/{avatar-CKLVepem.js → avatar-CiQyTRfd.js} +1 -1
  68. package/dist/client/assets/{badge-B2mtA9Oj.js → badge-Dp3mR27V.js} +1 -1
  69. package/dist/client/assets/{block-document-CTUlzaXj.js → block-document-By6966PS.js} +1 -1
  70. package/dist/client/assets/{buckets-CqwW0fPK.js → buckets-BtAjuTXp.js} +1 -1
  71. package/dist/client/assets/{bulk-category-panel-DOf0qDJu.js → bulk-category-panel-Crj0FXFd.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-Bu1DMqyM.js → capability-load-error-DcN5DOFH.js} +1 -1
  73. package/dist/client/assets/{cards-CnXEidEU.js → cards-BKUYovMU.js} +1 -1
  74. package/dist/client/assets/{category-editor-C2Penmxb.js → category-editor-BrklTiAF.js} +1 -1
  75. package/dist/client/assets/{chart-mQfq8dm_.js → chart-56471C1Y.js} +1 -1
  76. package/dist/client/assets/{chat-context-IctGRlpl.js → chat-context-_CA_JeeY.js} +1 -1
  77. package/dist/client/assets/{checkbox-DjvUsSry.js → checkbox-C1bUrPvW.js} +1 -1
  78. package/dist/client/assets/{choose-editor-D2hlr7Vq.js → choose-editor-nese6qE5.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-odBhJDfC.js → cli-auth-success-CCmWyNoP.js} +1 -1
  80. package/dist/client/assets/{collection-detail-EdlXGuH5.js → collection-detail-B90a00NV.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-BeWwcB8v.js → collection-display-button-FKEWPN7M.js} +1 -1
  82. package/dist/client/assets/{collection-search-BcNT9wqV.js → collection-search-Bd6xu3h9.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-DEX-95qA.js → collection-table-wrapper-15zlEhjP.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-QBx9fiO8.js → collection-tabs-3ta98PDW.js} +1 -1
  85. package/dist/client/assets/{command-Bciip2fK.js → command-pFth6-af.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-BrgV_E6e.js → commerce-onboarding-BQlfD3LU.js} +1 -1
  87. package/dist/client/assets/{connect-CJeRXYpO.js → connect-DMudoU2M.js} +1 -1
  88. package/dist/client/assets/{connection-CIVlVP4z.js → connection-QHosBlKh.js} +1 -1
  89. package/dist/client/assets/{connection-card-DLmi_xFL.js → connection-card-DXUN0HbG.js} +1 -1
  90. package/dist/client/assets/{connection-detail-DLHrsg7S.js → connection-detail-BQZMFHWj.js} +1 -1
  91. package/dist/client/assets/{connection-form-helpers-Bd1zJpcE.js → connection-form-helpers-Dw_uRR_o.js} +1 -1
  92. package/dist/client/assets/{connections-CaZTNlzO.js → connections-Cdozilw9.js} +1 -1
  93. package/dist/client/assets/{decopilot-sse-pool-0EWVughz.js → decopilot-sse-pool-B2gldwFf.js} +1 -1
  94. package/dist/client/assets/{dialog-BVOhf6JL.js → dialog-CLVbCjMu.js} +1 -1
  95. package/dist/client/assets/{domain-settings-1pFiPcDs.js → domain-settings-DoR6E0N1.js} +1 -1
  96. package/dist/client/assets/{drawer-ygpURzdE.js → drawer-Ckbm2CWJ.js} +1 -1
  97. package/dist/client/assets/{dropdown-menu-BpdWhSA7.js → dropdown-menu-D2aUCLYk.js} +1 -1
  98. package/dist/client/assets/{empty-state-CMCoRH7w.js → empty-state-BF41trPY.js} +1 -1
  99. package/dist/client/assets/{extract-connection-data-BRWpOoZu.js → extract-connection-data-A9qAyYQA.js} +1 -1
  100. package/dist/client/assets/{file-explorer-DLBtkOjU.js → file-explorer-ws1ucCZl.js} +1 -1
  101. package/dist/client/assets/{file-type-icon-DQDAdTqu.js → file-type-icon-wuRfMh_5.js} +1 -1
  102. package/dist/client/assets/{form-DJoSkHk7.js → form-BI3-Eb2L.js} +1 -1
  103. package/dist/client/assets/{general-CBRT6s1c.js → general-Dkq5x-QZ.js} +1 -1
  104. package/dist/client/assets/{github-repo-picker-CPPjWOCA.js → github-repo-picker-BMkV5srU.js} +1 -1
  105. package/dist/client/assets/{hooks-CtnSCLIe.js → hooks-DlPXzzl8.js} +1 -1
  106. package/dist/client/assets/{index-BJiFP4oP.js → index-B1veCTx1.js} +1 -1
  107. package/dist/client/assets/{index-DTM9lZbn.js → index-B_Ad5QPQ.js} +1 -1
  108. package/dist/client/assets/{index-CVkGlHYs.js → index-C2XLHMiw.js} +1 -1
  109. package/dist/client/assets/{index-D9nsJyXn.js → index-CV8Bfh5R.js} +43 -43
  110. package/dist/client/assets/{index-BeW-gOXM.js → index-Cssg9t23.js} +1 -1
  111. package/dist/client/assets/{index-Bks1FS3f.js → index-DAPcjavx.js} +1 -1
  112. package/dist/client/assets/{index-xXm-vpSs.js → index-DJM5ojUf.js} +1 -1
  113. package/dist/client/assets/{index-fZpMDfe6.js → index-DS_PtpmP.js} +3 -3
  114. package/dist/client/assets/{index-DZsKkAKU.js → index-Dh9w3kQB.js} +1 -1
  115. package/dist/client/assets/{index-AZvP0lkz.js → index-Dl5uUBVr.js} +1 -1
  116. package/dist/client/assets/{index-redirect-iRkpwVGO.js → index-redirect-DO74fkKf.js} +1 -1
  117. package/dist/client/assets/{infra-billing-DFpE7R9j.js → infra-billing-DLGhuOLw.js} +1 -1
  118. package/dist/client/assets/{input-v4c8p5Ob.js → input-Dsyfk4jo.js} +1 -1
  119. package/dist/client/assets/{integration-icon-DKqG-Mpx.js → integration-icon-DQzHhbi_.js} +1 -1
  120. package/dist/client/assets/{invite-member-dialog-3-Aihs7O.js → invite-member-dialog-6MS0bODt.js} +1 -1
  121. package/dist/client/assets/{label-DOL_dkX5.js → label-AZH9h-dP.js} +1 -1
  122. package/dist/client/assets/{layout-DHLrZup9.js → layout-jQzTnGd2.js} +1 -1
  123. package/dist/client/assets/login-B5ShBVQi.js +1 -0
  124. package/dist/client/assets/{mcp-oauth-MtFdjicX.js → mcp-oauth-CV7iuGWl.js} +1 -1
  125. package/dist/client/assets/{members-jHzwIadJ.js → members-DyI3pT9y.js} +1 -1
  126. package/dist/client/assets/{monaco-editor-DOnHAZIR.js → monaco-editor-CEXQCwfP.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-8XgEvO3D.js → monitoring-stats-row-C3Te4mdv.js} +1 -1
  128. package/dist/client/assets/{multi-select-DxScFuSI.js → multi-select-DPBlx32W.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-DTWHq_Fr.js → oauth-callback-CrdVqleB.js} +1 -1
  130. package/dist/client/assets/{oauth-callback-ai-provider-DjoClVq8.js → oauth-callback-ai-provider-KyQ1PZrQ.js} +1 -1
  131. package/dist/client/assets/{onboarding-CyYYA_IO.js → onboarding-BslW1pcP.js} +1 -1
  132. package/dist/client/assets/{org-layout-DsGm5b87.js → org-layout-CO6jG1v2.js} +1 -1
  133. package/dist/client/assets/{organization-choice-WY-H2NEY.js → organization-choice-CoM8gu7M.js} +1 -1
  134. package/dist/client/assets/{orgs-DggiyP30.js → orgs-CwehcPGm.js} +1 -1
  135. package/dist/client/assets/{page-seo-form-BoZrAFLO.js → page-seo-form-9OJihF4x.js} +1 -1
  136. package/dist/client/assets/{popover-DSZP75un.js → popover-BRZicoZW.js} +1 -1
  137. package/dist/client/assets/{post-calendar-BTuD64kJ.js → post-calendar-hEguUc5o.js} +1 -1
  138. package/dist/client/assets/{post-editor-Dwh3Mrlh.js → post-editor-pLSbc6mp.js} +1 -1
  139. package/dist/client/assets/{primitives-aZbwao0Z.js → primitives-CtBKfa_X.js} +1 -1
  140. package/dist/client/assets/{profile-B_6pDwzu.js → profile-n9hx6gY-.js} +1 -1
  141. package/dist/client/assets/{project-app-view-LijoL6le.js → project-app-view-DoK4zGoF.js} +1 -1
  142. package/dist/client/assets/record-editor-BiTWcS2C.js +1 -0
  143. package/dist/client/assets/{redirect-editor-bt0UR5sd.js → redirect-editor-feQIS-ih.js} +1 -1
  144. package/dist/client/assets/{registry-layout-Da3tVRcY.js → registry-layout-DaMCQA8V.js} +1 -1
  145. package/dist/client/assets/registry-zK072Ecp.js +2 -0
  146. package/dist/client/assets/{reports-DjBTZdT2.js → reports-DGCK2_12.js} +1 -1
  147. package/dist/client/assets/{require-capability-CF9r_mzF.js → require-capability-BuB0VaIt.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-XqEbPK8M.js → required-auth-layout-C8K6T2Dl.js} +1 -1
  149. package/dist/client/assets/{reset-password-DEL_G7hS.js → reset-password-Bv3lK8g1.js} +1 -1
  150. package/dist/client/assets/{roles-DDOKq874.js → roles-04svMQ-w.js} +1 -1
  151. package/dist/client/assets/{search-input-4SLm_iMt.js → search-input-BMFjaZW8.js} +1 -1
  152. package/dist/client/assets/{secrets-CJLKcRa3.js → secrets-CAom0Pas.js} +1 -1
  153. package/dist/client/assets/{sections-editor-CLwG1W2k.js → sections-editor-DYATNkxM.js} +1 -1
  154. package/dist/client/assets/{select-model-pYcHYqNY.js → select-model-DbrnwWTj.js} +1 -1
  155. package/dist/client/assets/{select-D9OtHuoQ.js → select-v0HyS5wV.js} +1 -1
  156. package/dist/client/assets/{self-tool-result-C2SaSBOS.js → self-tool-result-r1jsmu7J.js} +1 -1
  157. package/dist/client/assets/{seo-editor-DGd5xF_D.js → seo-editor-BqjKMW9L.js} +1 -1
  158. package/dist/client/assets/{settings-layout-UMPp-PK8.js → settings-layout-D3s-EDDq.js} +1 -1
  159. package/dist/client/assets/{shell-controls-CEjTnZRA.js → shell-controls-BH090Ymi.js} +1 -1
  160. package/dist/client/assets/{shell-layout-0_Y9WTC5.js → shell-layout-Ca7ET_6R.js} +1 -1
  161. package/dist/client/assets/{spinner-DnK6LAO-.js → spinner-Dzoa8exR.js} +1 -1
  162. package/dist/client/assets/{sprints-DTKQS9tP.js → sprints-BDnw_QJc.js} +1 -1
  163. package/dist/client/assets/{sso-Bj9k9yp_.js → sso-Br3gVbj4.js} +1 -1
  164. package/dist/client/assets/{store-DofhpRf4.js → store-TksVzK51.js} +1 -1
  165. package/dist/client/assets/store-registry-CH-meU9J.js +2 -0
  166. package/dist/client/assets/{switch-Dd8SWBtK.js → switch-CPOt6c8D.js} +1 -1
  167. package/dist/client/assets/{synced-repos-0UH9NuJE.js → synced-repos-DMsM8gK7.js} +1 -1
  168. package/dist/client/assets/{tab-id-W4sfonX1.js → tab-id-BOj9dZWT.js} +1 -1
  169. package/dist/client/assets/{table-B28U6WCV.js → table-yXN-B6JM.js} +1 -1
  170. package/dist/client/assets/{tabs-CNvz9wkq.js → tabs-DMoGi1te.js} +1 -1
  171. package/dist/client/assets/{task-key-CTiJU5_h.js → task-key-C2W_oYAM.js} +1 -1
  172. package/dist/client/assets/{tasks-BsRXKJkD.js → tasks-BrWj9zEH.js} +1 -1
  173. package/dist/client/assets/{textarea-BmWik9O5.js → textarea-CegtzxU_.js} +1 -1
  174. package/dist/client/assets/{toggle-group-B1ujv-Tj.js → toggle-group-5omFh11U.js} +1 -1
  175. package/dist/client/assets/{toolbar-Cos-gS1a.js → toolbar-DORhO8If.js} +1 -1
  176. package/dist/client/assets/{track-Cth4u5b_.js → track-B8qKGWO9.js} +1 -1
  177. package/dist/client/assets/{types-Da-6shE5.js → types-CE4AuZSY.js} +1 -1
  178. package/dist/client/assets/{use-ai-providers-bDkOAByr.js → use-ai-providers-DAYMp9NI.js} +1 -1
  179. package/dist/client/assets/{use-api-keys-Bi2l36nz.js → use-api-keys-DnFSxnvy.js} +1 -1
  180. package/dist/client/assets/{use-automations-BeKjYp7F.js → use-automations-DWv6iLeU.js} +1 -1
  181. package/dist/client/assets/{use-autosave-ImljMikW.js → use-autosave-iV8J_MuB.js} +1 -1
  182. package/dist/client/assets/{use-clock-tick-BIn9fxJl.js → use-clock-tick-BuVoJTdT.js} +1 -1
  183. package/dist/client/assets/{use-commerce-diagnostic-UqRl5JGR.js → use-commerce-diagnostic-KLE4UXiE.js} +1 -1
  184. package/dist/client/assets/{use-connection-DJ5BvXkS.js → use-connection-BJir_wda.js} +1 -1
  185. package/dist/client/assets/{use-copy-BHeXFKUG.js → use-copy-Ddcpb0Jm.js} +1 -1
  186. package/dist/client/assets/{use-create-virtual-mcp-CTghZh27.js → use-create-virtual-mcp-D0oAOlYC.js} +1 -1
  187. package/dist/client/assets/{use-debounced-autosave-BEoE5zu3.js → use-debounced-autosave-DYJOZB4t.js} +1 -1
  188. package/dist/client/assets/{use-debounced-value-d2xvAJAf.js → use-debounced-value-DXPF8RW0.js} +1 -1
  189. package/dist/client/assets/{use-decopilot-events-U00f_DNo.js → use-decopilot-events-CUYP3xa6.js} +1 -1
  190. package/dist/client/assets/{use-delete-connection-KttG6pDD.js → use-delete-connection-CaYWV75o.js} +1 -1
  191. package/dist/client/assets/{use-deployment-admin-BxGtVq0R.js → use-deployment-admin-DiSPyrP4.js} +1 -1
  192. package/dist/client/assets/{use-file-configs-ivKLtwVT.js → use-file-configs-BZNx7FRl.js} +1 -1
  193. package/dist/client/assets/{use-infinite-scroll-C3woVgJJ.js → use-infinite-scroll-DGa9MpTS.js} +1 -1
  194. package/dist/client/assets/{use-join-requests-Ce2D10xE.js → use-join-requests-_j9mGSpf.js} +1 -1
  195. package/dist/client/assets/{use-mcp-client-BixLZLmc.js → use-mcp-client-Zz1TwEAh.js} +1 -1
  196. package/dist/client/assets/{use-mcp-tools-DhYUR3cu.js → use-mcp-tools-CXwtpaPy.js} +1 -1
  197. package/dist/client/assets/{use-members-DqBCB9wB.js → use-members--D0gY-Nz.js} +1 -1
  198. package/dist/client/assets/{use-navigate-to-agent-COcz3Nee.js → use-navigate-to-agent-BTDz1KOs.js} +1 -1
  199. package/dist/client/assets/{use-org-auth-client-Bm7ydyvS.js → use-org-auth-client-C8dt2CEh.js} +1 -1
  200. package/dist/client/assets/{use-org-repo-syncs-B_4SIVWY.js → use-org-repo-syncs-BMPkdDGr.js} +1 -1
  201. package/dist/client/assets/{use-org-sso-9a_THghN.js → use-org-sso-DAANUxzR.js} +1 -1
  202. package/dist/client/assets/{use-organization-roles-CNEl3NFe.js → use-organization-roles-C4JrUmJs.js} +1 -1
  203. package/dist/client/assets/{use-organization-settings-B4nKr0f2.js → use-organization-settings-BZyz9Mop.js} +1 -1
  204. package/dist/client/assets/{use-registry-connections-C7LyRS1M.js → use-registry-connections-DrNpncD0.js} +1 -1
  205. package/dist/client/assets/{use-secrets-Chh3ojOY.js → use-secrets-XCXR_vh8.js} +1 -1
  206. package/dist/client/assets/{use-section-preview-base-Db24sM6t.js → use-section-preview-base-BuCg0_G0.js} +1 -1
  207. package/dist/client/assets/{use-status-sounds-DFis4MWx.js → use-status-sounds-CjE1Nwyt.js} +1 -1
  208. package/dist/client/assets/{use-tags-DSiXReOW.js → use-tags-CtHBcu1c.js} +1 -1
  209. package/dist/client/assets/{use-view-mode-5S7L8whl.js → use-view-mode-D2QnCor3.js} +1 -1
  210. package/dist/client/assets/{use-virtual-mcp-CxECG99q.js → use-virtual-mcp-BHOLpD1P.js} +1 -1
  211. package/dist/client/assets/useInfiniteQuery-DrLMltTg.js +1 -0
  212. package/dist/client/assets/useSuspenseInfiniteQuery-bgdhkmFx.js +1 -0
  213. package/dist/client/assets/{users-DegqgBxw.js → users-BdTetp54.js} +1 -1
  214. package/dist/client/assets/{variant-calendar-Ca_JbtN7.js → variant-calendar-OvwXqvaE.js} +1 -1
  215. package/dist/client/assets/{view-mode-toggle-rkJlH4vl.js → view-mode-toggle-DYMYSHNc.js} +1 -1
  216. package/dist/client/index.html +1 -1
  217. package/dist/server/cli.js +456 -452
  218. package/dist/server/migrate.js +113 -109
  219. package/dist/server/server.js +4 -4
  220. package/package.json +1 -1
  221. package/dist/client/assets/login-BAB1aLje.js +0 -1
  222. package/dist/client/assets/record-editor-BJycqOk0.js +0 -1
  223. package/dist/client/assets/registry-D7lhOlQc.js +0 -2
  224. package/dist/client/assets/store-registry-Cuo4Kfxl.js +0 -2
  225. package/dist/client/assets/useInfiniteQuery-D6nR9UJf.js +0 -1
  226. package/dist/client/assets/useSuspenseInfiniteQuery-BfIWoPo8.js +0 -1
@@ -1 +1 @@
1
- import{c as $,b as G,j as t,C as bn,aj as vn,B as ye,r as V,bq as jn,d as rt,w as yn,n as X,a as Te,t as Q,y as Cn,k as Ve,a5 as Vt,M as Ut,q as K,_ as qt,Z as Kt,Y as _n,H as le,f as at,u as lt,a8 as Me,a9 as Pe,ab as Oe,L as wn,G as Nn,ao as Sn,ap as kn,R as Ct,I as In,K as Ue,p as Dn,av as ct,o as He,bn as An,b2 as Tn}from"./index-fZpMDfe6.js";import{i as Wt}from"./ChevronRight-Bt0Ps5hy.js";import{aJ as Mn,S as Pn,A as qe,e as On,s as gt,aB as Fn,aK as $n,aL as zn}from"./agent-icon-Dt8TTBNR.js";import{t as _t}from"./ChevronDown-Bh9AZv82.js";import{a as dt,i as Ln,e as Bn,S as Xt,W as En,C as Qt,g as Rn}from"./constants-_08zpzmT.js";import{u as Yt,a as wt}from"./use-virtual-mcp-CxECG99q.js";import{a as Qe,b as Nt,P as St}from"./popover-DSZP75un.js";import{i as st}from"./Check-CFdAuLVR.js";import{s as Ke}from"./Plus-DJBOKCXM.js";import{i as Jt}from"./SearchMd-Bvk6cmtM.js";import{s as Zt}from"./XClose-Ca1B07wN.js";import{C as Gn,d as Pt}from"./self-tool-result-C2SaSBOS.js";import{T as kt}from"./toolbar-Cos-gS1a.js";import{D as en,a as tn,b as nn,c as Hn,g as Vn,e as Un,f as qn}from"./drawer-ygpURzdE.js";import{a as Kn,G as Wn}from"./github-repo-picker-CPPjWOCA.js";import{g as Xn,a as sn,u as ut,c as Qn}from"./hooks-CtnSCLIe.js";import{u as Yn,g as Jn,a as Zn,b as es}from"./use-navigate-to-agent-COcz3Nee.js";import{b as ts,a as on,g as ns}from"./agent-capabilities-C4tLW0Za.js";import{u as ft,f as ss}from"./shell-layout-0_Y9WTC5.js";import{f as os}from"./reusable-new-chat-CzvRy4Pe.js";import{d as is}from"./session-runtime-wVXsCwcJ.js";import{C as rs}from"./collection-search-BcNT9wqV.js";import{g as as,a as ls,b as cs,e as ds}from"./extract-connection-data-BRWpOoZu.js";import{u as rn,a as an,g as us,C as ht}from"./connection-card-DLmi_xFL.js";import{e as It,d as Dt,a as At,b as Tt,h as ln,c as fs}from"./dialog-BVOhf6JL.js";import{d as pe,a as xe,e as be,b as ve,c as je,F as Ot}from"./form-DJoSkHk7.js";import{I as Le}from"./input-v4c8p5Ob.js";import{S as ms,a as gs,b as hs,c as ps,d as Xe}from"./select-D9OtHuoQ.js";import{T as xs}from"./textarea-BmWik9O5.js";import{b as cn}from"./use-connection-DJ5BvXkS.js";import{n as tt,i as pt}from"./Tool02-DcVuymPV.js";import{c as bs,i as Je,a as Ft,E as vs,p as js,b as ys,d as Cs}from"./connection-form-helpers-Bd1zJpcE.js";import{a as xt}from"./authenticate-and-persist-oauth-BpXFlbw1.js";import{g as _s}from"./connection-slug-eyAPH6o3.js";import{C as ws}from"./collection-tabs-QBx9fiO8.js";import{u as $t}from"./use-infinite-scroll-C3woVgJJ.js";import{B as Ze}from"./badge-B2mtA9Oj.js";import{u as Ns}from"./useSuspenseInfiniteQuery-BfIWoPo8.js";import{u as Ss,m as zt}from"./use-mcp-client-BixLZLmc.js";import{g as ot}from"./metadata-dUsYcpuu.js";import{u as ks}from"./use-ai-providers-bDkOAByr.js";import{i as Is}from"./FilterLines-C01-F8gV.js";import{a as Ds,T as As}from"./toggle-group-B1ujv-Tj.js";import{d as Ts,a as Ms,c as Ps,b as Os,C as Fs,e as $s}from"./command-Bciip2fK.js";import{i as dn}from"./Zap-DoBPpnDg.js";import{c as zs,d as Ls,b as Bs,f as Es,g as Rs,e as Gs,a as Hs,A as Vs}from"./alert-dialog-COKsRPdB.js";import{n as Us}from"./Stars02-BEZaBHTc.js";import{g as qs,u as Ks,S as Ws}from"./use-clock-tick-BIn9fxJl.js";import{a as Xs}from"./format-time-BnbuEtat.js";import{f as Qs}from"./tab-id-W4sfonX1.js";const Ys="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Js(){const n=$.c(13),e=G();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("img",{src:"/logos/summit/monte-carlo.svg",alt:"Monte Carlo",className:"h-14 w-[112px] shrink-0 self-start object-contain object-left brightness-0 invert"}),n[0]=s):s=n[0];let i;n[1]!==e?(i=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=i):i=n[2];let r;n[3]!==i?(r=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",i,"”"]}),n[3]=i,n[4]=r):r=n[4];let o;n[5]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("img",{src:Ys,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=o):o=n[5];let a;n[6]!==e?(a=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=a):a=n[7];let l;n[8]!==a?(l=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[o,t.jsx("span",{className:"text-base font-medium",children:a})]}),n[8]=a,n[9]=l):l=n[9];let c;return n[10]!==r||n[11]!==l?(c=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,r,l]}),n[10]=r,n[11]=l,n[12]=c):c=n[12],c}function Zs(){const n=$.c(19),e=G();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let i;n[2]!==s?(i={Icon:Mn,label:s},n[2]=s,n[3]=i):i=n[3];let r;n[4]!==e?(r=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=r):r=n[5];let o;n[6]!==r?(o={Icon:bn,label:r},n[6]=r,n[7]=o):o=n[7];let a;n[8]!==e?(a=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=a):a=n[9];let l;n[10]!==a?(l={Icon:Pn,label:a},n[10]=a,n[11]=l):l=n[11];let c;n[12]!==i||n[13]!==o||n[14]!==l?(c=[i,o,l],n[12]=i,n[13]=o,n[14]=l,n[15]=c):c=n[15];const d=c;let f;n[16]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=f):f=n[16];let m;return n[17]!==d?(m=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[f,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:d.map(eo)})]}),n[17]=d,n[18]=m):m=n[18],m}function eo(n){const{Icon:e,label:s}=n;return t.jsxs("li",{className:"flex items-center gap-2.5 text-[13px] leading-tight text-white/70",children:[t.jsx(e,{className:"size-4 shrink-0 opacity-85"}),s]},s)}function yr(n){const e=$.c(22),{siteHost:s,footer:i,onClose:r,children:o}=n,a=G(),l=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let c;e[0]!==r||e[1]!==a?(c=r&&t.jsx("button",{type:"button",onClick:r,"aria-label":a("routes.commerceOnboarding.connectModal.close"),className:"absolute right-3 top-3 z-10 flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-black/10 hover:text-foreground lg:text-white/80 lg:hover:bg-white/15 lg:hover:text-white",children:t.jsx(vn,{size:18})}),e[0]=r,e[1]=a,e[2]=c):c=e[2];let d,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),f=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=d,e[4]=f):(d=e[3],f=e[4]);let m;e[5]!==l||e[6]!==s?(m=s&&t.jsxs(t.Fragment,{children:[t.jsx(Wt,{size:16,className:"shrink-0 text-foreground/25"}),l&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:l,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=l,e[6]=s,e[7]=m):m=e[7];let u;e[8]!==m?(u=t.jsxs("div",{className:"flex items-center gap-2",children:[d,f,m]}),e[8]=m,e[9]=u):u=e[9];let p;e[10]!==i?(p=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:i}),e[10]=i,e[11]=p):p=e[11];let y;e[12]!==o||e[13]!==u||e[14]!==p?(y=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[u,o,p]}),e[12]=o,e[13]=u,e[14]=p,e[15]=y):y=e[15];let b,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("img",{src:"https://decoims.com/image?src=decocms%2F8191643a-1947-4c30-afb4-36b8073c90fb%2Fbg-quote.png&quality=original&fit=cover&width=880",alt:"",className:"absolute inset-0 size-full object-cover"}),g=t.jsx("div",{className:"absolute inset-0 bg-black/20"}),e[16]=b,e[17]=g):(b=e[16],g=e[17]);let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[b,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Js,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Zs,{})]})]}),e[18]=h):h=e[18];let x;return e[19]!==c||e[20]!==y?(x=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[c,y,h]}),e[19]=c,e[20]=y,e[21]=x):x=e[21],x}function Cr(n){const e=$.c(5),{ready:s,pending:i,label:r,onClick:o,children:a}=n,l=i||!s,c=s&&!i?a:null;let d;return e[0]!==r||e[1]!==o||e[2]!==l||e[3]!==c?(d=t.jsxs(ye,{type:"button",size:"lg",className:"h-auto min-h-12 w-full whitespace-normal rounded-lg py-3 text-center text-base font-medium leading-tight",onClick:o,disabled:l,children:[r,c]}),e[0]=r,e[1]=o,e[2]=l,e[3]=c,e[4]=d):d=e[4],d}function un(){const n=V.useContext(jn),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(r=>r.status==="pending"&&new Date(r.expiresAt)>new Date),refetch:()=>s?.()}}function to(n){let e=0;for(let i=0;i<n.length;i++)e=n.charCodeAt(i)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function Mt(n){const e=$.c(13),{org:s,size:i}=n,r=i===void 0?"sm":i,o=r==="xs"?"size-5":"size-6",a=r==="xs"?"text-[9px]":"text-xs";let l;e[0]!==o?(l=X(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:to(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.logo||e[6]!==s.name||e[7]!==a?(d=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:X("font-semibold leading-none",a),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=a,e[8]=d):d=e[8];let f;return e[9]!==l||e[10]!==c||e[11]!==d?(f=t.jsx("div",{className:l,style:c,children:d}),e[9]=l,e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function no({invitation:n,onChanged:e}){const s=G(),[i,r]=V.useState(!1),o=n.organizationName??s("header.orgSwitcher.unknownOrganization"),a=async()=>{r(!0);try{const d=await Te.organization.acceptInvitation({invitationId:n.id});if(d.error){Q.error(d.error.message),r(!1);return}}catch{Q.error(s("header.orgSwitcher.failedToAcceptInvitation")),r(!1);return}Q.success(s("header.orgSwitcher.joined",{name:o})),Cn();let c;try{c=(await Te.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},l=async()=>{r(!0);try{const c=await Te.organization.rejectInvitation({invitationId:n.id});if(c.error){Q.error(c.error.message),r(!1);return}Q.success(s("header.orgSwitcher.invitationDeclined")),r(!1),e()}catch{Q.error(s("header.orgSwitcher.failedToDeclineInvitation")),r(!1)}};return t.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[t.jsx(Mt,{org:{name:o},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:o}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx(ye,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:a,disabled:i,children:s("header.orgSwitcher.accept")}),t.jsx(ye,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:l,disabled:i,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:o}),children:t.jsx(Zt,{size:14})})]})]})}function so(n){const e=$.c(32),{orgParam:s,onSelectOrg:i,onCreateOrg:r}=n,o=G(),{data:a}=yn(),{invitations:l,refetch:c}=un();let d;e[0]!==s?(d=(P,A)=>P.slug===s?-1:A.slug===s?1:P.name.localeCompare(A.name),e[0]=s,e[1]=d):d=e[1];const f=[...a??[]].sort(d),[m,u]=V.useState(""),p=m.toLowerCase(),y=p?f.filter(P=>P.name.toLowerCase().includes(p)||P.slug.toLowerCase().includes(p)):f;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Jt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=b):b=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=P=>u(P.target.value),e[3]=g):g=e[3];let h;e[4]!==m?(h=P=>P.key==="Escape"&&m&&u(""),e[4]=m,e[5]=h):h=e[5];let x;e[6]!==o?(x=o("header.orgSwitcher.searchOrganizations"),e[6]=o,e[7]=x):x=e[7];let j;e[8]!==m||e[9]!==h||e[10]!==x?(j=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:m,onChange:g,onKeyDown:h,placeholder:x,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=m,e[9]=h,e[10]=x,e[11]=j):j=e[11];let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ke,{size:16}),e[12]=C):C=e[12];let w;e[13]!==r?(w=t.jsx("button",{type:"button",onClick:r,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:C}),e[13]=r,e[14]=w):w=e[14];let I;e[15]!==j||e[16]!==w?(I=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[b,j,w]}),e[15]=j,e[16]=w,e[17]=I):I=e[17];const T="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let v;e[18]!==l||e[19]!==m||e[20]!==c?(v=!m&&l.map(P=>t.jsx(no,{invitation:P,onChanged:c},P.id)),e[18]=l,e[19]=m,e[20]=c,e[21]=v):v=e[21];const N=y.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:m?o("header.orgSwitcher.noOrganizationsMatch",{query:m}):o("header.orgSwitcher.noOrganizationsAvailable")});let D;e[22]!==i||e[23]!==s?(D=P=>t.jsxs("button",{type:"button",onClick:()=>i(P.slug),className:X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",P.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(Mt,{org:P,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:P.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:P.slug})]}),P.slug===s&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},P.id),e[22]=i,e[23]=s,e[24]=D):D=e[24];const S=y.map(D);let _;e[25]!==v||e[26]!==N||e[27]!==S?(_=t.jsxs("div",{className:T,children:[v,N,S]}),e[25]=v,e[26]=N,e[27]=S,e[28]=_):_=e[28];let M;return e[29]!==_||e[30]!==I?(M=t.jsxs(t.Fragment,{children:[I,_]}),e[29]=_,e[30]=I,e[31]=M):M=e[31],M}function oo(n){const e=$.c(22),{trigger:s,orgParam:i,align:r,side:o}=n,a=r===void 0?"start":r,l=o===void 0?"bottom":o,c=rt(),[d,f]=V.useState(!1),[m,u]=V.useState(!1);let p;e[0]!==s?(p=t.jsx(Qe,{asChild:!0,children:s}),e[0]=s,e[1]=p):p=e[1];const y=String(d);let b;e[2]!==c?(b=I=>{f(!1),c({to:"/$org",params:{org:I}})},e[2]=c,e[3]=b):b=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{f(!1),u(!0)},e[4]=g):g=e[4];let h;e[5]!==i||e[6]!==y||e[7]!==b?(h=t.jsx(so,{orgParam:i,onSelectOrg:b,onCreateOrg:g},y),e[5]=i,e[6]=y,e[7]=b,e[8]=h):h=e[8];let x;e[9]!==a||e[10]!==l||e[11]!==h?(x=t.jsx(Nt,{side:l,align:a,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:ro,onCloseAutoFocus:io,children:h}),e[9]=a,e[10]=l,e[11]=h,e[12]=x):x=e[12];let j;e[13]!==d||e[14]!==p||e[15]!==x?(j=t.jsxs(St,{open:d,onOpenChange:f,children:[p,x]}),e[13]=d,e[14]=p,e[15]=x,e[16]=j):j=e[16];let C;e[17]!==m?(C=t.jsx(Gn,{open:m,onOpenChange:u}),e[17]=m,e[18]=C):C=e[18];let w;return e[19]!==C||e[20]!==j?(w=t.jsxs(t.Fragment,{children:[j,C]}),e[19]=C,e[20]=j,e[21]=w):w=e[21],w}function io(n){return n.preventDefault()}function ro(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ao(n){const e=$.c(21),{value:s,onChange:i,placeholder:r,onKeyDown:o,className:a,isSearching:l,disabled:c}=n,d=r===void 0?"Search...":r;let f;e[0]!==a?(f=X("shrink-0 w-full border-b border-border h-12",a),e[0]=a,e[1]=f):f=e[1];const m=c?"cursor-not-allowed opacity-50":"cursor-text";let u;e[2]!==m?(u=X("flex items-center gap-2.5 h-12 px-4",m),e[2]=m,e[3]=u):u=e[3];let p;e[4]!==l?(p=l?t.jsx(Ve,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Jt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=l,e[5]=p):p=e[5];let y;e[6]!==i?(y=x=>i(x.target.value),e[6]=i,e[7]=y):y=e[7];let b;e[8]!==c||e[9]!==o||e[10]!==d||e[11]!==y||e[12]!==s?(b=t.jsx("input",{type:"text",value:s,onChange:y,onKeyDown:o,placeholder:d,disabled:c,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=c,e[9]=o,e[10]=d,e[11]=y,e[12]=s,e[13]=b):b=e[13];let g;e[14]!==u||e[15]!==p||e[16]!==b?(g=t.jsxs("label",{className:u,children:[p,b]}),e[14]=u,e[15]=p,e[16]=b,e[17]=g):g=e[17];let h;return e[18]!==f||e[19]!==g?(h=t.jsx("div",{className:f,children:g}),e[18]=f,e[19]=g,e[20]=h):h=e[20],h}function lo(n,e,s){if(!s)return null;const i=Xn(n,e);return i?i.threads.get().find(o=>o.id===s)?.branch??null:null}function co(n){const e=$.c(6),{value:s,onChange:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.searchAgents"),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==i||e[3]!==o||e[4]!==s?(a=t.jsx(ao,{value:s,onChange:i,placeholder:o}),e[2]=i,e[3]=o,e[4]=s,e[5]=a):a=e[5],a}function uo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=i):i=n[3],i}function fo(n){const e=$.c(10),{org:s,onClose:i}=n,r=G();let o;e[0]!==s.slug?(o={org:s.slug},e[0]=s.slug,e[1]=o):o=e[1];let a;e[2]!==i?(a=()=>i(),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r("sidebar.agentsSection.seeAllAgents"),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==a||e[8]!==l?(c=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(wn,{to:"/$org/settings/agents",params:o,onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:l})}),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}function mo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(fn,{children:s}),n[2]=s,n[3]=i):i=n[3],i}function go(n){const e=$.c(11),{onImportFromGithub:s}=n,i=G();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Wn,{className:"size-3.5"}),e[0]=r):r=e[0];let o;e[1]!==i?(o=i("sidebar.agentsSection.import"),e[1]=i,e[2]=o):o=e[2];let a;e[3]!==s||e[4]!==o?(a=t.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[r,o]}),e[3]=s,e[4]=o,e[5]=a):a=e[5];let l;e[6]!==i?(l=i("sidebar.agentsSection.codeAgents"),e[6]=i,e[7]=l):l=e[7];let c;return e[8]!==a||e[9]!==l?(c=t.jsx(fn,{action:a,children:l}),e[8]=a,e[9]=l,e[10]=c):c=e[10],c}function ho(n){const e=$.c(11),{setOpen:s,emptyCtaClass:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.browseAgents"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i?(a=X(i),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==s?(l=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=l):l=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{className:"size-4"}),e[6]=c):c=e[6];let d;return e[7]!==o||e[8]!==a||e[9]!==l?(d=t.jsx(kt,{"aria-label":o,className:a,onClick:l,children:c}),e[7]=o,e[8]=a,e[9]=l,e[10]=d):d=e[10],d}function po(n){const e=$.c(17),{setOpen:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=X(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]!==s?(c=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ke,{}),e[7]=d):d=e[7];let f;e[8]!==o?(f=o("sidebar.agentsSection.newAgent"),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=t.jsx("span",{children:f}),e[10]=f,e[11]=m):m=e[11];let u;return e[12]!==a||e[13]!==l||e[14]!==c||e[15]!==m?(u=t.jsx(qt,{children:t.jsxs(Kt,{tooltip:a,className:l,onClick:c,children:[d,m]})}),e[12]=a,e[13]=l,e[14]=c,e[15]=m,e[16]=u):u=e[16],u}function xo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(nn,{className:"sr-only",children:s}),n[2]=s,n[3]=i):i=n[3],i}function bo(n){const e=$.c(8),{emptyCtaClass:s}=n,i=G();let r;e[0]!==i?(r=i("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=r):r=e[1];let o;e[2]!==s?(o=X(s),e[2]=s,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Ke,{className:"size-4"}),e[4]=a):a=e[4];let l;return e[5]!==r||e[6]!==o?(l=t.jsx(kt,{"aria-label":r,className:o,children:a}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function vo(n){const e=$.c(19),{wrapEmptyHint:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=X(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{}),e[5]=c):c=e[5];let d;e[6]!==o?(d=o("sidebar.agentsSection.newAgent"),e[6]=o,e[7]=d):d=e[7];let f;e[8]!==d?(f=t.jsx("span",{children:d}),e[8]=d,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==l||e[12]!==f?(m=t.jsx(Qe,{asChild:!0,children:t.jsxs(Kt,{tooltip:a,className:l,children:[c,f]})}),e[10]=a,e[11]=l,e[12]=f,e[13]=m):m=e[13];let u;e[14]!==m||e[15]!==s?(u=s(m),e[14]=m,e[15]=s,e[16]=u):u=e[16];let p;return e[17]!==u?(p=t.jsx(qt,{children:u}),e[17]=u,e[18]=p):p=e[18],p}function jo(n){const e=$.c(9),{children:s}=n,i=G();let r;e[0]!==s?(r=t.jsx(Me,{asChild:!0,children:s}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==i?(o=i("sidebar.agentsSection.selectAnExistingAgent"),e[2]=i,e[3]=o):o=e[3];let a;e[4]!==o?(a=t.jsx(Pe,{side:"right",sideOffset:8,children:o}),e[4]=o,e[5]=a):a=e[5];let l;return e[6]!==r||e[7]!==a?(l=t.jsxs(Oe,{defaultOpen:!0,delayDuration:0,children:[r,a]}),e[6]=r,e[7]=a,e[8]=l):l=e[8],l}function yo(n){const e=rt(),{create:s}=sn(),{locator:i}=le(),r=at({strict:!1}),o=lt({strict:!1});return async a=>{const l=crypto.randomUUID(),c=a===o.virtualmcpid?lo(n,i,r.taskId??""):null;try{await s({id:l,virtual_mcp_id:a,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:l},search:{virtualmcpid:a}})}}function bt(n){const e=$.c(20),{agent:s,selected:i,onClick:r}=n,o=i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let a;e[0]!==o?(a=X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",o),e[0]=o,e[1]=a):a=e[1];let l;e[2]!==s.icon||e[3]!==s.title?(l=t.jsx(qe,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=l):l=e[4];let c;e[5]!==s.title?(c=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=c):c=e[6];let d;e[7]!==s.description?(d=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=d):d=e[8];let f;e[9]!==c||e[10]!==d?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,d]}),e[9]=c,e[10]=d,e[11]=f):f=e[11];let m;e[12]!==i?(m=i&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=i,e[13]=m):m=e[13];let u;return e[14]!==r||e[15]!==a||e[16]!==l||e[17]!==f||e[18]!==m?(u=t.jsxs("button",{type:"button",onClick:r,className:a,children:[l,f,m]}),e[14]=r,e[15]=a,e[16]=l,e[17]=f,e[18]=m,e[19]=u):u=e[19],u}function fn(n){const e=$.c(5),{children:s,action:i}=n;let r;e[0]!==s?(r=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let o;return e[2]!==i||e[3]!==r?(o=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[r,i]}),e[2]=i,e[3]=r,e[4]=o):o=e[4],o}function Co(n){const e=$.c(23),{onClose:s,onSelectAgent:i,selectedAgentId:r,onImportFromGithub:o}=n,[a,l]=V.useState(""),c=Yt(),d=c??[],{org:f}=le(),{data:m}=Te.useSession(),u=m?.user?.id??"anon",p=Jn(c),y=Zn(),b=yo(f.slug),g=ts(c),h=a.toLowerCase(),x=d.filter(So).filter(E=>!g.has(E.id)).filter(No).filter(E=>!a||E.title.toLowerCase().includes(h)),j=x.filter(wo),C=x.filter(_o),w=dt(f.id),I=!a||w.title.toLowerCase().includes(h),T=!!(i&&I);let v;e[0]!==s||e[1]!==i?(v=()=>{i?.(null),s(),l("")},e[0]=s,e[1]=i,e[2]=v):v=e[2];const N=v,D=E=>{if(i){i(E.id),s(),l("");return}es({orgId:f.id,userId:u},E.id,p),y(),s(),l(""),b(E.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let _;e[3]!==a?(_=t.jsx(co,{value:a,onChange:l}),e[3]=a,e[4]=_):_=e[4];const M="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",P=i&&I&&w&&t.jsx(bt,{agent:w,selected:!r||r===w.id,onClick:N}),A=(j.length>0||!a)&&t.jsx(go,{onImportFromGithub:o}),F=j.map(E=>t.jsx(bt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>D(E)},E.id)),L=C.length>0&&t.jsx(mo,{}),O=C.map(E=>t.jsx(bt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>D(E)},E.id));let z;e[5]!==T||e[6]!==a||e[7]!==x.length?(z=x.length===0&&!T&&a&&t.jsx(uo,{}),e[5]=T,e[6]=a,e[7]=x.length,e[8]=z):z=e[8];let U;e[9]!==z||e[10]!==P||e[11]!==A||e[12]!==F||e[13]!==L||e[14]!==O?(U=t.jsxs("div",{className:M,children:[P,A,F,L,O,z]}),e[9]=z,e[10]=P,e[11]=A,e[12]=F,e[13]=L,e[14]=O,e[15]=U):U=e[15];let R;e[16]!==s||e[17]!==f?(R=t.jsx(fo,{org:f,onClose:s}),e[16]=s,e[17]=f,e[18]=R):R=e[18];let q;return e[19]!==U||e[20]!==R||e[21]!==_?(q=t.jsxs("div",{className:S,children:[_,U,R]}),e[19]=U,e[20]=R,e[21]=_,e[22]=q):q=e[22],q}function _o(n){return!on(n.metadata)}function wo(n){return on(n.metadata)}function No(n){return!Bn(n.id)}function So(n){return!Ln(n.id)}function ko(n){const e=$.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:i,trigger:r,onSelectAgent:o,selectedAgentId:a,side:l,align:c}=s,d=i===void 0?!1:i,f=l===void 0?"right":l,m=c===void 0?"start":c,[u,p]=V.useState(!1),[y,b]=V.useState(!1),g=Vt(),{setOpenMobile:h}=Ut(),x=Yn(),j=x?"border border-border":void 0;let C;e[2]!==x?(C=A=>x?t.jsx(jo,{children:A}):A,e[2]=x,e[3]=C):C=e[3];const w=C;let I;e[4]!==g||e[5]!==h?(I=()=>{p(!1),g&&h(!1)},e[4]=g,e[5]=h,e[6]=I):I=e[6];const T=I;let v;e[7]!==T?(v=()=>{T(),b(!0)},e[7]=T,e[8]=v):v=e[8];const N=v;let D;e[9]!==T||e[10]!==N||e[11]!==o||e[12]!==u||e[13]!==a?(D=u&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(_n,{className:"h-4 w-24"})}),children:t.jsx(Co,{onClose:T,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:N})}),e[9]=T,e[10]=N,e[11]=o,e[12]=u,e[13]=a,e[14]=D):D=e[14];const S=D;let _;e[15]!==m||e[16]!==d||e[17]!==j||e[18]!==x||e[19]!==g||e[20]!==u||e[21]!==S||e[22]!==f||e[23]!==r||e[24]!==w?(_=g?t.jsxs(t.Fragment,{children:[r?t.jsx("button",{type:"button",onClick:()=>p(!0),className:"contents",children:r}):d?w(t.jsx(ho,{setOpen:p,emptyCtaClass:j})):t.jsx(po,{setOpen:p,highlightEmpty:x,emptyCtaClass:j}),t.jsx(en,{open:u,onOpenChange:p,direction:"bottom",children:t.jsxs(tn,{className:"max-h-[85dvh] p-0",children:[t.jsx(xo,{}),S]})})]}):t.jsxs(St,{open:u,onOpenChange:A=>{A&&!u&&K("agent_browser_opened",{surface:"desktop_popover"}),p(A)},children:[r?t.jsx(Qe,{asChild:!0,children:r}):d?w(t.jsx(Qe,{asChild:!0,children:t.jsx(bo,{emptyCtaClass:j})})):t.jsx(vo,{wrapEmptyHint:w,highlightEmpty:x,emptyCtaClass:j}),t.jsx(Nt,{className:"w-[380px] p-0 overflow-hidden",side:f,align:m,children:S})]}),e[15]=m,e[16]=d,e[17]=j,e[18]=x,e[19]=g,e[20]=u,e[21]=S,e[22]=f,e[23]=r,e[24]=w,e[25]=_):_=e[25];let M;e[26]!==y?(M=t.jsx(Kn,{open:y,onOpenChange:b,mode:"agent"}),e[26]=y,e[27]=M):M=e[27];let P;return e[28]!==M||e[29]!==_?(P=t.jsxs(t.Fragment,{children:[_,M]}),e[28]=M,e[29]=_,e[30]=P):P=e[30],P}function Io(){const n=$.c(2),e=Yt()??[];let s;return n[0]!==e?(s=i=>{if(!i)return;const r=e.find(o=>o.id===i);return r?is(r.metadata):void 0},n[0]=e,n[1]=s):s=n[1],s}const Do="inline-flex items-center gap-1.5 min-w-0 rounded-md pl-1 pr-2 py-1.5 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function Ao(n){const e=$.c(29),{agentId:s,fallback:i,onOpenHome:r,onPick:o}=n,a=G(),l=wt(s)??i??null;let c,d,f,m,u;e[0]!==l?.title||e[1]!==r||e[2]!==a?(u=l?.title??a("header.shellBreadcrumb.superAgentDefaultName"),m="flex min-w-0 items-center gap-0",c="button",d=r,f=a("header.shellBreadcrumb.openAgentHome",{name:u}),e[0]=l?.title,e[1]=r,e[2]=a,e[3]=c,e[4]=d,e[5]=f,e[6]=m,e[7]=u):(c=e[3],d=e[4],f=e[5],m=e[6],u=e[7]);const p=l?.icon??null;let y;e[8]!==p||e[9]!==u?(y=t.jsx(qe,{icon:p,name:u,size:"xs"}),e[8]=p,e[9]=u,e[10]=y):y=e[10];let b;e[11]!==c||e[12]!==d||e[13]!==f||e[14]!==y?(b=t.jsx("button",{type:c,onClick:d,"aria-label":f,className:"flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:y}),e[11]=c,e[12]=d,e[13]=f,e[14]=y,e[15]=b):b=e[15];let g;e[16]!==u?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:u}),e[16]=u,e[17]=g):g=e[17];let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=h):h=e[18];let x;e[19]!==g?(x=t.jsxs("button",{type:"button",className:Do,children:[g,h]}),e[19]=g,e[20]=x):x=e[20];let j;e[21]!==s||e[22]!==o||e[23]!==x?(j=t.jsx(ko,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:o,trigger:x}),e[21]=s,e[22]=o,e[23]=x,e[24]=j):j=e[24];let C;return e[25]!==j||e[26]!==m||e[27]!==b?(C=t.jsxs("div",{className:m,children:[b,j]}),e[25]=j,e[26]=m,e[27]=b,e[28]=C):C=e[28],C}function _r(n){const e=$.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:i}=s,r=G(),{org:o}=le(),{state:a,isMobile:l}=Ut(),c=un().invitations.length>0,d=a==="collapsed"||l;let f;e[2]!==c||e[3]!==o.name||e[4]!==r?(f=c?r("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:o.name}):r("header.shellBreadcrumb.switchOrganization",{name:o.name}),e[2]=c,e[3]=o.name,e[4]=r,e[5]=f):f=e[5];let m;e[6]!==o?(m=t.jsx(Mt,{org:o,size:"sm"}),e[6]=o,e[7]=m):m=e[7];let u;e[8]!==c||e[9]!==d?(u=c&&t.jsx("span",{className:X("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",d?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=c,e[9]=d,e[10]=u):u=e[10];let p;e[11]!==m||e[12]!==u?(p=t.jsxs("span",{className:"relative inline-flex",children:[m,u]}),e[11]=m,e[12]=u,e[13]=p):p=e[13];let y;e[14]!==o.name||e[15]!==i?(y=i&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:o.name}),e[14]=o.name,e[15]=i,e[16]=y):y=e[16];let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=b):b=e[17];let g;e[18]!==f||e[19]!==p||e[20]!==y?(g=t.jsx(Me,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":f,className:"flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[p,y,b]})}),e[18]=f,e[19]=p,e[20]=y,e[21]=g):g=e[21];let h;e[22]!==o.slug||e[23]!==g?(h=t.jsx(oo,{orgParam:o.slug,trigger:g}),e[22]=o.slug,e[23]=g,e[24]=h):h=e[24];let x;e[25]!==o.name?(x=t.jsx(Pe,{side:"bottom",children:o.name}),e[25]=o.name,e[26]=x):x=e[26];let j;return e[27]!==x||e[28]!==h?(j=t.jsxs(Oe,{children:[h,x]}),e[27]=x,e[28]=h,e[29]=j):j=e[29],j}function wr(n){const e=$.c(23);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,{org:r}=le();let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[2]=o):o=e[2];const a=at(o);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[3]=l):l=e[3];const c=lt(l),{threads:d}=ut(),{data:f}=Te.useSession(),{setTaskId:m,createNewTask:u}=ft(),p=Io();let y;e[4]!==r.id?(y=dt(r.id),e[4]=r.id,e[5]=y):y=e[5];const b=y,g=b.id,h=a.taskId?c.virtualmcpid??g:g;let x;e[6]!==u||e[7]!==g||e[8]!==i||e[9]!==p||e[10]!==f?.user?.id||e[11]!==m||e[12]!==d?(x=v=>{const N=v??g,D=os(d,N,f?.user?.id,p(N));D?m(D.id,N):u(N),i?.()},e[6]=u,e[7]=g,e[8]=i,e[9]=p,e[10]=f?.user?.id,e[11]=m,e[12]=d,e[13]=x):x=e[13];const j=x;let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[14]=C):C=e[14];const w=h===g?b:void 0;let I;e[15]!==h||e[16]!==j?(I=()=>j(h),e[15]=h,e[16]=j,e[17]=I):I=e[17];let T;return e[18]!==h||e[19]!==j||e[20]!==w||e[21]!==I?(T=t.jsx(V.Suspense,{fallback:C,children:t.jsx(Ao,{agentId:h,fallback:w,onOpenHome:I,onPick:j})}),e[18]=h,e[19]=j,e[20]=w,e[21]=I,e[22]=T):T=e[22],T}function Nr(){const n=$.c(24),e=G(),{org:s}=le();let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[0]=i):i=n[0];const r=at(i);let o;n[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[1]=o):o=n[1];const a=lt(o),{threads:l}=ut(),{createNewTask:c}=ft();let d;n[2]!==s.id?(d=dt(s.id),n[2]=s.id,n[3]=d):d=n[3];const f=d.id,m=r.taskId?a.virtualmcpid??f:f;let u;n[4]!==r.taskId||n[5]!==l?(u=(r.taskId?l.find(I=>I.id===r.taskId)?.branch:null)??null,n[4]=r.taskId,n[5]=l,n[6]=u):u=n[6];const p=u;let y;n[7]!==m||n[8]!==c||n[9]!==p?(y=()=>{c(m,p)},n[7]=m,n[8]=c,n[9]=p,n[10]=y):y=n[10];const b=y;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let h;n[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(On,{size:16}),n[13]=h):h=n[13];let x;n[14]!==b||n[15]!==g?(x=t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button",onClick:b,"aria-label":g,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:h})}),n[14]=b,n[15]=g,n[16]=x):x=n[16];let j;n[17]!==e?(j=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=j):j=n[18];let C;n[19]!==j?(C=t.jsx(Pe,{side:"bottom",children:j}),n[19]=j,n[20]=C):C=n[20];let w;return n[21]!==x||n[22]!==C?(w=t.jsxs(Oe,{children:[x,C]}),n[21]=x,n[22]=C,n[23]=w):w=n[23],w}function To({open:n,onOpenChange:e,onCreated:s}){const i=G(),{org:r}=le(),{data:o}=Te.useSession(),{stdioEnabled:a}=Nn(),l=Vt(),c=cn(),d=rn(),m=an(d,"").items,u=Sn({resolver:kn(bs),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=u.watch("ui_type"),y=u.watch("connection_url"),b=u.watch("npx_package"),g=Je({uiType:p,connectionUrl:y??"",npxPackage:b??""})??Ft({uiType:p,connectionUrl:y??"",registryItems:m}),h=v=>{const N=v.trim();if(!N)return;const D=!!u.formState.dirtyFields.title,S=!!u.formState.dirtyFields.description,_=!!u.formState.dirtyFields.env_vars,M=A=>{if(A&&(!D&&!u.getValues("title").trim()&&A.title&&u.setValue("title",A.title,{shouldDirty:!1}),!S&&!(u.getValues("description")??"").trim()&&A.description&&u.setValue("description",A.description,{shouldDirty:!1}),!_&&A.envVarKeys?.length)){const F=u.getValues("env_vars")??[],L=new Set(F.map(z=>z.key)),O=A.envVarKeys.filter(z=>!L.has(z));O.length>0&&u.setValue("env_vars",[...F,...O.map(z=>({key:z,value:""}))],{shouldDirty:!0})}},P=js(N);if(P&&a){u.setValue("ui_type","NPX",{shouldDirty:!0}),u.setValue("npx_package",P.packageName,{shouldDirty:!0}),u.setValue("connection_url","",{shouldDirty:!0}),u.setValue("connection_token",null,{shouldDirty:!0}),M(Je({uiType:"NPX",npxPackage:P.packageName}));return}if(N.startsWith("http://")||N.startsWith("https://")){const A=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";u.setValue("ui_type",A,{shouldDirty:!0}),u.setValue("connection_url",N,{shouldDirty:!0}),M(Je({uiType:A,connectionUrl:N})??Ft({uiType:A,connectionUrl:N,registryItems:m}));return}p==="NPX"&&M(Je({uiType:"NPX",npxPackage:N}))},x=v=>{v||u.reset(),e(v)},j=async v=>{let N,D=null,S=null,_=null;v.ui_type==="NPX"?(N="STDIO",D="",_=ys(v.npx_package||"",v.env_vars||[])):v.ui_type==="STDIO"?(N="STDIO",D="",_=Cs(v.stdio_command||"",v.stdio_args||"",v.stdio_cwd,v.env_vars||[])):(N=v.ui_type,D=v.connection_url||"",S=v.connection_token||null);const M=as("conn");try{await c.create.mutateAsync({id:M,title:v.title,description:v.description||null,connection_type:N,connection_url:D,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:o?.user?.id||"system",organization_id:r.id,icon:v.icon??null,app_name:null,app_id:null,connection_headers:_,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),u.reset(),e(!1),s?.(M)}catch{Q.error(i("connections.createConnectionDialog.failedToCreateConnection"))}},C=i("connections.createConnectionDialog.title"),w=i("connections.createConnectionDialog.description"),I=u.formState.isSubmitting?i("connections.createConnectionDialog.saving"):i("connections.createConnectionDialog.createButton"),T=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(pe,{control:u.control,name:"ui_type",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.typeLabel")}),t.jsxs(ms,{value:v.value,onValueChange:v.onChange,children:[t.jsx(ve,{children:t.jsx(gs,{children:t.jsx(hs,{})})}),t.jsxs(ps,{children:[t.jsx(Xe,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.httpType")]})}),t.jsx(Xe,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.sseType")]})}),t.jsx(Xe,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.websocketType")]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(Xe,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(tt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(Xe,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Fn,{className:"w-4 h-4"}),i("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(je,{})]})}),p==="NPX"&&t.jsx(pe,{control:u.control,name:"npx_package",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.npmPackagePlaceholder"),...v,value:v.value??"",onPaste:N=>{const D=N.clipboardData.getData("text");D&&(N.preventDefault(),u.setValue("npx_package",D.trim(),{shouldDirty:!0}),h(D))},onBlur:N=>{h(N.target.value),v.onBlur()}})}),t.jsx(je,{})]})}),p==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(pe,{control:u.control,name:"stdio_command",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.commandLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.commandPlaceholder"),...v,value:v.value??""})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"stdio_args",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.argumentsLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.argumentsPlaceholder"),...v,value:v.value??""})}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"stdio_cwd",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.workingDirectoryPlaceholder"),...v,value:v.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(je,{})]})})]}),(p==="NPX"||p==="STDIO")&&t.jsx(pe,{control:u.control,name:"env_vars",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(ve,{children:t.jsx(vs,{value:v.value??[],onChange:v.onChange})}),t.jsx(je,{})]})}),p!=="NPX"&&p!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(pe,{control:u.control,name:"connection_url",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.urlLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.urlPlaceholder"),...v,value:v.value??"",onPaste:N=>{const D=N.clipboardData.getData("text");D&&(N.preventDefault(),u.setValue("connection_url",D.trim(),{shouldDirty:!0}),h(D))},onBlur:N=>{h(N.target.value),v.onBlur()}})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"connection_token",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:g?.token?.label??i("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(ve,{children:t.jsx(Le,{type:"password",placeholder:g?.token?.placeholder??i("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...v,value:v.value??""})}),g?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:i("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"title",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.nameLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.namePlaceholder"),...v})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"description",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.descriptionLabel")}),t.jsx(ve,{children:t.jsx(xs,{placeholder:i("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...v,value:v.value??""})}),t.jsx(je,{})]})})]});return l?t.jsx(en,{open:n,onOpenChange:x,children:t.jsxs(tn,{className:"max-h-[90vh]",children:[t.jsx(Hn,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(nn,{children:C}),t.jsx(Vn,{className:"mt-1",children:w})]}),t.jsx(Un,{asChild:!0,children:t.jsx(ye,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Zt,{size:16})})})]})}),t.jsx(Ot,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:T}),t.jsx(qn,{children:t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"w-full",children:I})})]})})]})}):t.jsx(It,{open:n,onOpenChange:x,children:t.jsxs(Dt,{className:"sm:max-w-[525px]",children:[t.jsxs(At,{children:[t.jsx(Tt,{children:C}),t.jsx(ln,{children:w})]}),t.jsx(Ot,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"py-4",children:T}),t.jsxs(fs,{children:[t.jsx(ye,{type:"button",variant:"outline",onClick:()=>x(!1),children:i("connections.createConnectionDialog.cancelButton")}),t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"min-w-40",children:I})]})]})})]})})}function Mo(n){const e=$.c(72),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:l,connectingItemId:c,search:d,onCreateConnection:f,onBrowseNavigate:m,defaultTab:u}=n,p=s===void 0?"add":s,y=u===void 0?"connected":u,b=G(),{org:g}=le(),h=V.useDeferredValue(d),x=d!==h;let j;e[0]!==h?(j=h.trim().toLowerCase(),e[0]=h,e[1]=j):j=e[1];const C=j;let w;e[2]!==y?(w=k=>k??y,e[2]=y,e[3]=w):w=e[3];const[I,T]=Ct(In.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),w);let v;e[4]!==I||e[5]!==T?(v=k=>{k!==I&&K("connections_dialog_tab_changed",{to_tab:k}),T(k)},e[4]=I,e[5]=T,e[6]=v):v=e[6];const N=v;let D;e[7]!==g.id||e[8]!==g.slug?(D={connectionId:Xt,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=D):D=e[9];const S=Ss(D),_=h?.trim().split(/\s+/).filter(Boolean)??[],M=_.length>0?{operator:"or",conditions:_.flatMap(Eo)}:void 0,P={...M&&{where:M},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(P),{data:F,fetchNextPage:L,hasNextPage:O,isFetchingNextPage:z}=Ns({queryKey:Ue.collectionListInfinite(S,g.id,"","CONNECTIONS",A),queryFn:async k=>{const{pageParam:B}=k,Z=B===void 0?0:B;return(await S.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...M&&{where:M},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Z}})).structuredContent},initialPageParam:0,getNextPageParam:Lo,staleTime:3e4}),U=F?.pages.flatMap(zo)??[],R=us(U),q=new Set(U.filter($o).map(Fo)),E=rn(),Y=an(E,h),ee=$t(Y.loadMore,Y.hasMore,Y.isLoadingMore),te=$t(L,O??!1,z),H=I==="all"||!!C,J=H?Y.items.filter(k=>{const B=ls(k);if(B&&q.has(B))return!1;if(!C)return!0;const Z=ot(k._meta),ue=[k.title,k.description,k.name,k.server?.title,k.server?.description,k.server?.name,Z?.friendly_name,Z?.friendlyName].filter(Boolean).join(" ").toLowerCase();return _.some(he=>ue.includes(he.toLowerCase()))}):[],ne=J.filter(Oo),W=J.filter(Po);let Ne;e[10]!==r?(Ne=k=>k.some(B=>r.has(B.id)),e[10]=r,e[11]=Ne):Ne=e[11];const Be=Ne;let Ce;e[12]!==r||e[13]!==i||e[14]!==c||e[15]!==Be||e[16]!==p||e[17]!==o||e[18]!==m||e[19]!==a||e[20]!==b?(Ce=(k,B,Z,ue,he)=>{const Ye=Be(he),Ge=he.find(ze=>!r.has(ze.id)),ce=he[0];if(p==="browse"){const ze=_s(ce);return t.jsx(ht,{connection:{title:B,icon:Z,description:he.length>1?`${he.length} instances`:ue??void 0},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",b("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{K("connection_browse_clicked",{app_name:ce.app_name??null,connection_id:ce.id,instances_count:he.length}),m?.(ze)}},k)}return t.jsx(ht,{connection:{title:B,icon:Z,description:ue},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Ye&&t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",b("virtualMcp.connectionDialogContent.added")]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),Ge?(K("connection_add_clicked",{action:"use_existing",app_name:ce.app_name??null,connection_id:Ge.id}),i&&K("agent_connection_attached",{agent_id:i,connection_id:Ge.id,app_name:ce.app_name??null,mode:"existing"}),o(Ge.id)):(K("connection_add_clicked",{action:"clone",app_name:ce.app_name??null,base_connection_id:ce.id}),a(ce))},children:b("virtualMcp.connectionDialogContent.add")})]})},k)},e[12]=r,e[13]=i,e[14]=c,e[15]=Be,e[16]=p,e[17]=o,e[18]=m,e[19]=a,e[20]=b,e[21]=Ce):Ce=e[21];const Ee=Ce;let _e;e[22]!==c||e[23]!==p||e[24]!==l||e[25]!==b?(_e=k=>{const B=ot(k._meta),Z=B?.friendlyName||B?.friendly_name||k.server?.title||k.title||k.server?.name||k.name||k.id||"",ue=k.server?.description||k.description||null,he=k.server?.icons?.[0]?.src||cs(k.server?.repository)||null,Ye=B?.official===!0,Ge=B?.verified===!0,ce=B?.owner==="deco";return t.jsx(ht,{connection:{title:Z,description:ue,icon:he},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[ce&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:t.jsx("img",{src:"/logos/deco logo.svg",alt:b("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(Pe,{children:b("virtualMcp.connectionDialogContent.builtByDeco")})]}),!ce&&Ye&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:b("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!ce&&!Ye&&Ge&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:b("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),K("connection_add_clicked",{action:"connect_new",registry_item_id:k.id,app_name:B?.friendlyName||k.server?.name||k.name||null}),l(k)},children:c===k.id?t.jsx(Ve,{size:14,className:"animate-spin"}):b(p==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${k.id}`)},e[22]=c,e[23]=p,e[24]=l,e[25]=b,e[26]=_e):_e=e[26];const We=_e;let se;e[27]!==I||e[28]!==N||e[29]!==f||e[30]!==C||e[31]!==b?(se=!C&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(ws,{tabs:[{id:"all",label:b("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:b("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:I,onTabChange:k=>N(k)}),t.jsxs(ye,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{K("connections_dialog_custom_clicked"),f()},children:[t.jsx(Ke,{size:12}),b("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=I,e[28]=N,e[29]=f,e[30]=C,e[31]=b,e[32]=se):se=e[32];const Se=x&&"opacity-50 pointer-events-none";let oe;e[33]!==Se?(oe=X("flex-1 overflow-auto p-5 transition-opacity duration-150",Se),e[33]=Se,e[34]=oe):oe=e[34];const Re="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ke;e[35]!==Ee?(ke=k=>{if(k.type==="group")return Ee(k.key,k.title,k.icon,null,k.connections);const B=k.connection;return Ee(B.id,B.title,B.icon,B.description??null,[B])},e[35]=Ee,e[36]=ke):ke=e[36];const Ie=R.map(ke);let fe;e[37]!==te?(fe=t.jsx("div",{ref:te,className:"col-span-full h-1"}),e[37]=te,e[38]=fe):fe=e[38];let de;e[39]!==z?(de=z&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=z,e[40]=de):de=e[40];const Fe=H&&ne.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(pt,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:b("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),De=H&&ne.map(We),$e=H&&W.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:b("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ae=H&&W.map(We);let me;e[41]!==ee||e[42]!==E||e[43]!==H?(me=H&&E.length>0&&t.jsx("div",{ref:ee,className:"col-span-full h-1"}),e[41]=ee,e[42]=E,e[43]=H,e[44]=me):me=e[44];let ie;e[45]!==Y.isLoadingMore||e[46]!==H?(ie=H&&Y.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=Y.isLoadingMore,e[46]=H,e[47]=ie):ie=e[47];let ge;e[48]!==Ie||e[49]!==fe||e[50]!==de||e[51]!==Fe||e[52]!==De||e[53]!==$e||e[54]!==Ae||e[55]!==me||e[56]!==ie?(ge=t.jsxs("div",{className:Re,children:[Ie,fe,de,Fe,De,$e,Ae,me,ie]}),e[48]=Ie,e[49]=fe,e[50]=de,e[51]=Fe,e[52]=De,e[53]=$e,e[54]=Ae,e[55]=me,e[56]=ie,e[57]=ge):ge=e[57];let re;e[58]!==I||e[59]!==R.length||e[60]!==W||e[61]!==d||e[62]!==b||e[63]!==ne?(re=R.length===0&&ne.length===0&&W.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:d?b("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:d}):b(I==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=I,e[59]=R.length,e[60]=W,e[61]=d,e[62]=b,e[63]=ne,e[64]=re):re=e[64];let ae;e[65]!==oe||e[66]!==ge||e[67]!==re?(ae=t.jsxs("div",{className:oe,children:[ge,re]}),e[65]=oe,e[66]=ge,e[67]=re,e[68]=ae):ae=e[68];let we;return e[69]!==se||e[70]!==ae?(we=t.jsxs(t.Fragment,{children:[se,ae]}),e[69]=se,e[70]=ae,e[71]=we):we=e[71],we}function Po(n){return!n.verified&&!ot(n._meta)?.verified&&!n.meta?.verified}function Oo(n){return n.verified||ot(n._meta)?.verified||n.meta?.verified}function Fo(n){return n.app_name}function $o(n){return n.app_name}function zo(n){return n?.items??[]}function Lo(n,e){if(n?.hasMore)return e.reduce(Bo,0)}function Bo(n,e){return n+(e?.items?.length??0)}function Eo(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Sr({open:n,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=G(),a=r.mode??"add",l="agentId"in r?r.agentId:void 0,c="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,d="onAdd"in r&&r.onAdd?r.onAdd:S=>{},f=(S,_,M)=>{l&&K("agent_connection_attached",{agent_id:l,connection_id:S,app_name:_,mode:M})},[m,u]=V.useState(null),[p,y]=V.useState(i),[b,g]=V.useState(!1),{org:h}=le(),{data:x}=Te.useSession(),j=cn(),C=Dn(),w=rt(),I=S=>{e(!1),w({to:"/$org/settings/connections/$appSlug",params:{org:h.slug,appSlug:S}})},T=()=>{C.invalidateQueries({predicate:S=>{const _=S.queryKey;return _[1]===h.id&&_[3]==="collection"&&_[4]==="CONNECTIONS"}})},v=async(S,_)=>{K("connection_oauth_succeeded",{connection_id:S,flow:_});const M=new URL(`/api/${h.slug}/mcp/${S}`,window.location.origin);await C.invalidateQueries({queryKey:Ue.isMCPAuthenticated(M.href,null)}),T()},N=async S=>{u(S.app_name??S.id);try{const M=`${S.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await j.create.mutateAsync({title:M,description:S.description??null,connection_type:S.connection_type,connection_url:S.connection_url??null,connection_token:null,icon:S.icon??null,app_name:S.app_name??null,app_id:S.app_id??null,connection_headers:S.connection_headers??null})).id,F=await xt({connectionId:A,orgId:h.id,orgSlug:h.slug,persistFallback:L=>j.update.mutateAsync({id:A,data:{connection_token:L}}).then(()=>{})});if(F.ran&&!F.ok){K("connection_oauth_failed",{connection_id:A,flow:"clone",error:F.error??"no_token"}),Q.error(o("virtualMcp.addConnectionDialog.authenticationFailedError",{error:F.error??"no token received"})),await j.delete.mutateAsync(A);return}F.ran&&await v(A,"clone"),f(A,S.app_name??null,"clone"),d(A)}catch(_){console.error("Failed to add connection:",_),Q.error(o("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{u(null)}},D=async S=>{if(!(!h||!x?.user?.id)){u(S.id);try{const _=ds(S,h.id,x.user.id,{remoteIndex:0}),M=_.connection_type==="STDIO",P=!!_.connection_url,A=M&&_.connection_headers&&typeof _.connection_headers=="object"&&"command"in _.connection_headers;if(!P&&!A){Q.error(o("virtualMcp.addConnectionDialog.mcpServerConnectionError")),u(null);return}const{id:F}=await j.create.mutateAsync(_),L=await xt({connectionId:F,orgId:h.id,orgSlug:h.slug,persistFallback:O=>j.update.mutateAsync({id:F,data:{connection_token:O}}).then(()=>{})});if(L.ran&&!L.ok){K("connection_oauth_failed",{connection_id:F,flow:"connect_new",error:L.error??"no_token"}),Q.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:L.error??"no token received"})}),f(F,_.app_name??null,"new"),d(F);return}L.ran?(await v(F,"connect_new"),Q.success(o("virtualMcp.addConnectionDialog.connectedAuthenticated"))):Q.success(o("virtualMcp.addConnectionDialog.connected")),f(F,_.app_name??null,"new"),d(F)}catch(_){console.error("Failed to connect:",_),Q.error(o("virtualMcp.addConnectionDialog.failedToConnect"))}finally{u(null)}}};return t.jsxs(It,{open:n,onOpenChange:e,children:[t.jsxs(Dt,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(At,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx(Tt,{className:"text-base font-semibold",children:o(a==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(rs,{value:p,onChange:y,placeholder:o("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Mo,{mode:a,agentId:l,addedConnectionIds:c,onAdd:d,onCloneAndAdd:N,onConnectAndAdd:D,connectingItemId:m,search:p,onCreateConnection:()=>g(!0),onBrowseNavigate:I,defaultTab:s})})]}),t.jsx(To,{open:b,onOpenChange:g,onCreated:async S=>{g(!1);const _=await xt({connectionId:S,orgId:h.id,orgSlug:h.slug,persistFallback:M=>j.update.mutateAsync({id:S,data:{connection_token:M}}).then(()=>{})});if(_.ran&&!_.ok){K("connection_oauth_failed",{connection_id:S,flow:"custom_create",error:_.error??"no_token"}),Q.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:_.error??"no token received"})}),f(S,null,"custom"),d(S),e(!1);return}_.ran&&await v(S,"custom_create"),f(S,null,"custom"),d(S),e(!1)}})]})}const Lt=new Map;function kr(){const{org:n}=le(),e=ct(),s=ks(),i=s.find(g=>g.providerId==="deco"),{data:r,isLoading:o,refetch:a,isFetching:l}=He({queryKey:Ue.aiProviderCredits(n.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),c=r?.balanceCents??null,d=c!=null?c/100:null,f=V.useRef(new Map);if(c!=null){const g=Lt.get(n.id);f.current.get(n.id)&&g!=null&&c>g&&K("credits_topped_up_detected",{organization_id:n.id,delta_cents:c-g,previous_balance_cents:g,new_balance_cents:c}),Lt.set(n.id,c),f.current.set(n.id,!0)}const m=!!i,u=c!=null&&c>0,p=c!=null&&c===0,y=c!=null&&c===200,b=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:m,decoKeyId:i?.id??null,balanceCents:c,balanceDollars:d,hasCredits:u,isZeroBalance:p,isInitialFreeCredit:y,hasOnlyDecoProvider:b,isLoading:o,isFetching:l,refetch:a}}function vt(n){const e=$.c(13),{label:s,value:i,onChange:r,options:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==r?(l=m=>m&&r(m),e[2]=r,e[3]=l):l=e[3];let c;e[4]!==o?(c=o.map(Ro),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==c||e[8]!==i?(d=t.jsx(As,{type:"single",size:"sm",value:i,onValueChange:l,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=l,e[7]=c,e[8]=i,e[9]=d):d=e[9];let f;return e[10]!==a||e[11]!==d?(f=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,d]}),e[10]=a,e[11]=d,e[12]=f):f=e[12],f}function Ro(n){return t.jsxs(Ds,{value:n.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[n.icon,n.label]},n.value)}function Ir(n){const e=$.c(91),{panel:s,className:i}=n,r=i===void 0?"md:size-[34px] rounded-lg":i,o=G();let a;e[0]!==o?(a=o("sidebar.taskGroupsList.filterChats"),e[0]=o,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Is,{size:16}),e[2]=l):l=e[2];let c;e[3]!==s.filtersActive?(c=s.filtersActive&&t.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"}),e[3]=s.filtersActive,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==s.filtersActive||e[7]!==a||e[8]!==c?(d=t.jsx(Me,{asChild:!0,children:t.jsx(Qe,{asChild:!0,children:t.jsxs(kt,{"aria-label":a,active:s.filtersActive,className:r,children:[l,c]})})}),e[5]=r,e[6]=s.filtersActive,e[7]=a,e[8]=c,e[9]=d):d=e[9];let f;e[10]!==o?(f=o("sidebar.taskGroupsList.filterChats"),e[10]=o,e[11]=f):f=e[11];let m;e[12]!==f?(m=t.jsx(Pe,{side:"bottom",children:f}),e[12]=f,e[13]=m):m=e[13];let u;e[14]!==d||e[15]!==m?(u=t.jsxs(Oe,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=u):u=e[16];let p;e[17]!==o?(p=o("sidebar.taskGroupsList.filterView"),e[17]=o,e[18]=p):p=e[18];const y=s.groupBy;let b;e[19]!==s?(b=W=>{K("tasks_panel_group_by_changed",{to_value:W}),s.setGroupBy(W)},e[19]=s,e[20]=b):b=e[20];let g;e[21]!==o?(g=o("sidebar.taskGroupsList.viewList"),e[21]=o,e[22]=g):g=e[22];let h;e[23]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx($n,{size:13}),e[23]=h):h=e[23];let x;e[24]!==g?(x={value:"flat",label:g,icon:h},e[24]=g,e[25]=x):x=e[25];let j;e[26]!==o?(j=o("sidebar.taskGroupsList.viewStatus"),e[26]=o,e[27]=j):j=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(zn,{size:13}),e[28]=C):C=e[28];let w;e[29]!==j?(w={value:"status",label:j,icon:C},e[29]=j,e[30]=w):w=e[30];let I;e[31]!==x||e[32]!==w?(I=[x,w],e[31]=x,e[32]=w,e[33]=I):I=e[33];let T;e[34]!==s.groupBy||e[35]!==b||e[36]!==I||e[37]!==p?(T=t.jsx(vt,{label:p,value:y,onChange:b,options:I}),e[34]=s.groupBy,e[35]=b,e[36]=I,e[37]=p,e[38]=T):T=e[38];let v;e[39]!==o?(v=o("sidebar.taskGroupsList.filterType"),e[39]=o,e[40]=v):v=e[40];const N=s.typeFilter;let D;e[41]!==s?(D=W=>{K("tasks_panel_filter_changed",{to_value:W}),s.setTypeFilter(W)},e[41]=s,e[42]=D):D=e[42];let S;e[43]!==o?(S=o("sidebar.taskGroupsList.typeAll"),e[43]=o,e[44]=S):S=e[44];let _;e[45]!==S?(_={value:"all",label:S},e[45]=S,e[46]=_):_=e[46];let M;e[47]!==o?(M=o("sidebar.taskGroupsList.typeChats"),e[47]=o,e[48]=M):M=e[48];let P;e[49]!==M?(P={value:"manual",label:M},e[49]=M,e[50]=P):P=e[50];let A;e[51]!==o?(A=o("sidebar.taskGroupsList.typeAuto"),e[51]=o,e[52]=A):A=e[52];let F;e[53]!==A?(F={value:"automation",label:A},e[53]=A,e[54]=F):F=e[54];let L;e[55]!==_||e[56]!==P||e[57]!==F?(L=[_,P,F],e[55]=_,e[56]=P,e[57]=F,e[58]=L):L=e[58];let O;e[59]!==s.typeFilter||e[60]!==v||e[61]!==D||e[62]!==L?(O=t.jsx(vt,{label:v,value:N,onChange:D,options:L}),e[59]=s.typeFilter,e[60]=v,e[61]=D,e[62]=L,e[63]=O):O=e[63];let z;e[64]!==o?(z=o("sidebar.taskGroupsList.filterScope"),e[64]=o,e[65]=z):z=e[65];const U=s.showAll?"team":"mine";let R;e[66]!==s?(R=W=>s.setShowAll(W==="team"),e[66]=s,e[67]=R):R=e[67];let q;e[68]!==o?(q=o("sidebar.taskGroupsList.scopeMine"),e[68]=o,e[69]=q):q=e[69];let E;e[70]!==q?(E={value:"mine",label:q},e[70]=q,e[71]=E):E=e[71];let Y;e[72]!==o?(Y=o("sidebar.taskGroupsList.scopeTeam"),e[72]=o,e[73]=Y):Y=e[73];let ee;e[74]!==Y?(ee={value:"team",label:Y},e[74]=Y,e[75]=ee):ee=e[75];let te;e[76]!==E||e[77]!==ee?(te=[E,ee],e[76]=E,e[77]=ee,e[78]=te):te=e[78];let H;e[79]!==z||e[80]!==U||e[81]!==R||e[82]!==te?(H=t.jsx(vt,{label:z,value:U,onChange:R,options:te}),e[79]=z,e[80]=U,e[81]=R,e[82]=te,e[83]=H):H=e[83];let J;e[84]!==T||e[85]!==O||e[86]!==H?(J=t.jsxs(Nt,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[T,O,H]}),e[84]=T,e[85]=O,e[86]=H,e[87]=J):J=e[87];let ne;return e[88]!==J||e[89]!==u?(ne=t.jsxs(St,{children:[u,J]}),e[88]=J,e[89]=u,e[90]=ne):ne=e[90],ne}function Go(n){const e=$.c(9),{virtualMcpId:s,size:i,showAutomationBadge:r}=n,o=i===void 0?"sm":i,a=G();let l;e[0]!==o||e[1]!==s?(l=s?t.jsx(Ho,{virtualMcpId:s,size:o}):t.jsx(qe,{icon:null,name:"?",size:o}),e[0]=o,e[1]=s,e[2]=l):l=e[2];let c;e[3]!==r||e[4]!==a?(c=r&&t.jsx("span",{"aria-label":a("tasksPanel.mcpAvatar.automationTriggered"),className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:t.jsx(dn,{size:10,className:"text-white"})}),e[3]=r,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=t.jsxs("div",{className:"relative shrink-0",children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function Ho(n){const e=$.c(6),{virtualMcpId:s,size:i}=n,r=wt(s);if(!r){let l;return e[0]!==i?(l=t.jsx(qe,{icon:null,name:"?",size:i}),e[0]=i,e[1]=l):l=e[1],l}const o=r.icon??null;let a;return e[2]!==r.title||e[3]!==i||e[4]!==o?(a=t.jsx(qe,{icon:o,name:r.title,size:i}),e[2]=r.title,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function Vo(n){const e=$.c(51),{open:s,onOpenChange:i}=n,[r,o]=V.useState(""),{org:a}=le(),{setTaskId:l}=ft(),c=ct(),d=G();let f,m,u;e[0]!==a.id||e[1]!==r?(u=r.trim(),m=He,f=Ue.globalSearch(a.id,u),e[0]=a.id,e[1]=r,e[2]=f,e[3]=m,e[4]=u):(f=e[2],m=e[3],u=e[4]);let p;e[5]!==c||e[6]!==u?(p=async()=>await c.call("GLOBAL_SEARCH",{query:u,limit:u?20:10}),e[5]=c,e[6]=u,e[7]=p):p=e[7];let y;e[8]!==s||e[9]!==f||e[10]!==p?(y={queryKey:f,enabled:s,queryFn:p,staleTime:1e4},e[8]=s,e[9]=f,e[10]=p,e[11]=y):y=e[11];const{data:b,isFetching:g}=m(y);let h;e[12]!==b?.items?(h=b?.items??[],e[12]=b?.items,e[13]=h):h=e[13];const x=h;let j;e[14]!==i?(j=O=>{O||o(""),i(O)},e[14]=i,e[15]=j):j=e[15];const C=j;let w;e[16]!==C||e[17]!==l?(w=O=>{C(!1),l(O.id,O.virtual_mcp_id??void 0)},e[16]=C,e[17]=l,e[18]=w):w=e[18];const I=w;let T;e[19]!==d?(T=d("tasksPanel.globalSearchDialog.title"),e[19]=d,e[20]=T):T=e[20];let v;e[21]!==T?(v=t.jsx(Tt,{children:T}),e[21]=T,e[22]=v):v=e[22];let N;e[23]!==d?(N=d("tasksPanel.globalSearchDialog.description"),e[23]=d,e[24]=N):N=e[24];let D;e[25]!==N?(D=t.jsx(ln,{children:N}),e[25]=N,e[26]=D):D=e[26];let S;e[27]!==D||e[28]!==v?(S=t.jsxs(At,{className:"sr-only",children:[v,D]}),e[27]=D,e[28]=v,e[29]=S):S=e[29];let _;e[30]!==d?(_=d("tasksPanel.globalSearchDialog.placeholder"),e[30]=d,e[31]=_):_=e[31];let M;e[32]!==r||e[33]!==_?(M=t.jsx(Fs,{value:r,onValueChange:o,placeholder:_}),e[32]=r,e[33]=_,e[34]=M):M=e[34];let P;e[35]!==I||e[36]!==g||e[37]!==x||e[38]!==d||e[39]!==u?(P=t.jsx(Ts,{children:g&&x.length===0?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):x.length===0?t.jsx(Ms,{children:d("tasksPanel.globalSearchDialog.noResults")}):t.jsx(Ps,{heading:u?void 0:d("tasksPanel.globalSearchDialog.recent"),children:x.map(O=>O.type==="thread"?t.jsxs(Os,{value:`thread:${O.id}:${O.title}`,onSelect:()=>I(O),className:"gap-2.5",children:[t.jsx(Go,{virtualMcpId:O.virtual_mcp_id,size:"xs"}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("div",{className:"text-sm text-foreground truncate",children:O.title||d("tasksPanel.globalSearchDialog.untitledChat")})}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(O.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${O.id}`):null)})}),e[35]=I,e[36]=g,e[37]=x,e[38]=d,e[39]=u,e[40]=P):P=e[40];let A;e[41]!==M||e[42]!==P?(A=t.jsxs($s,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[M,P]}),e[41]=M,e[42]=P,e[43]=A):A=e[43];let F;e[44]!==S||e[45]!==A?(F=t.jsxs(Dt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[S,A]}),e[44]=S,e[45]=A,e[46]=F):F=e[46];let L;return e[47]!==C||e[48]!==s||e[49]!==F?(L=t.jsx(It,{open:s,onOpenChange:C,children:F}),e[47]=C,e[48]=s,e[49]=F,e[50]=L):L=e[50],L}function Uo(n){const e=$.c(43),{branch:s,onOutcome:i}=n,r=G();let o;e[0]!==i?(o=T=>{T||i("cancel")},e[0]=i,e[1]=o):o=e[1];let a;e[2]!==r?(a=r("sidebar.archiveWorktreeDialog.title"),e[2]=r,e[3]=a):a=e[3];let l;e[4]!==a?(l=t.jsx(zs,{children:a}),e[4]=a,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("sidebar.archiveWorktreeDialog.stopsAndDeletesBefore"),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==s?(d=t.jsx("span",{className:"font-mono",children:s}),e[8]=s,e[9]=d):d=e[9];let f;e[10]!==r?(f=r("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=r,e[11]=f):f=e[11];let m;e[12]!==c||e[13]!==d||e[14]!==f?(m=t.jsxs(Ls,{children:[c," ",d," ",f]}),e[12]=c,e[13]=d,e[14]=f,e[15]=m):m=e[15];let u;e[16]!==l||e[17]!==m?(u=t.jsxs(Bs,{children:[l,m]}),e[16]=l,e[17]=m,e[18]=u):u=e[18];let p;e[19]!==i?(p=()=>i("cancel"),e[19]=i,e[20]=p):p=e[20];let y;e[21]!==r?(y=r("sidebar.archiveWorktreeDialog.cancel"),e[21]=r,e[22]=y):y=e[22];let b;e[23]!==y||e[24]!==p?(b=t.jsx(Es,{onClick:p,children:y}),e[23]=y,e[24]=p,e[25]=b):b=e[25];let g;e[26]===Symbol.for("react.memo_cache_sentinel")?(g=X(An({variant:"destructive"})),e[26]=g):g=e[26];let h;e[27]!==i?(h=()=>i("confirm"),e[27]=i,e[28]=h):h=e[28];let x;e[29]!==r?(x=r("sidebar.archiveWorktreeDialog.confirm"),e[29]=r,e[30]=x):x=e[30];let j;e[31]!==h||e[32]!==x?(j=t.jsx(Rs,{className:g,onClick:h,children:x}),e[31]=h,e[32]=x,e[33]=j):j=e[33];let C;e[34]!==b||e[35]!==j?(C=t.jsxs(Gs,{children:[b,j]}),e[34]=b,e[35]=j,e[36]=C):C=e[36];let w;e[37]!==C||e[38]!==u?(w=t.jsxs(Hs,{children:[u,C]}),e[37]=C,e[38]=u,e[39]=w):w=e[39];let I;return e[40]!==o||e[41]!==w?(I=t.jsx(Vs,{open:!0,onOpenChange:o,children:w}),e[40]=o,e[41]=w,e[42]=I):I=e[42],I}function qo(n,e,s){if(!s)return;const i=n.findIndex(r=>r.id===e);if(i!==-1){for(let r=i+1;r<n.length;r++){const o=n[r];if(o?.created_by===s)return o}for(let r=i-1;r>=0;r--){const o=n[r];if(o?.created_by===s)return o}}}function Ko(n){return n==="ephemeral"||n.startsWith("thread:")}function mn(n){const e=$.c(45),{task:s,isActive:i,onClick:r,onArchive:o,showAutomationBadge:a,showAgentIcon:l,hideStatusIdle:c,indented:d}=n,f=G(),m=qs(s.status),u=m.icon,p=s.metadata?.kind==="tool_call_run",y=wt(p?void 0:s.virtual_mcp_id);let b;e[0]!==y?(b=ns(y),e[0]=y,e[1]=b):b=e[1];const g=b;Ks(6e4);const h=a||!!s.trigger_id,x=s.id,j="button",C=0;let w;e[2]!==r?(w=R=>{R.target===R.currentTarget&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),r())},e[2]=r,e[3]=w):w=e[3];const I=d?"-ml-4 pl-6":"pl-[7px]",T=i?"bg-accent text-accent-foreground":"hover:bg-accent/60";let v;e[4]!==I||e[5]!==T?(v=X("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",I,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",T),e[4]=I,e[5]=T,e[6]=v):v=e[6];let N;e[7]!==p||e[8]!==l||e[9]!==y?.icon||e[10]!==y?.title?(N=l&&!p&&t.jsx(qe,{icon:y?.icon??null,name:y?.title??"?",size:"2xs"}),e[7]=p,e[8]=l,e[9]=y?.icon,e[10]=y?.title,e[11]=N):N=e[11];let D;e[12]!==h||e[13]!==f?(D=h&&t.jsx(dn,{size:12,"aria-label":f("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=h,e[13]=f,e[14]=D):D=e[14];let S;e[15]!==f||e[16]!==s.title?(S=s.title||f("tasksPanel.taskRow.untitledTask"),e[15]=f,e[16]=s.title,e[17]=S):S=e[17];let _;e[18]!==S?(_=t.jsx("div",{className:"text-sm text-foreground truncate",children:S}),e[18]=S,e[19]=_):_=e[19];let M;e[20]!==D||e[21]!==_?(M=t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[D,_]}),e[20]=D,e[21]=_,e[22]=M):M=e[22];let P;e[23]!==g||e[24]!==i||e[25]!==s.branch||e[26]!==s.updated_at?(P=s.updated_at&&t.jsxs("div",{className:X("flex items-center gap-1 text-[11px] min-w-0",i?"text-accent-foreground/70":"text-muted-foreground/60"),children:[s.branch&&!Ko(s.branch)?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate font-mono",children:s.branch}),t.jsx("span",{className:"shrink-0",children:"·"})]}):g?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"truncate",children:[g.owner,"/",g.name]}),t.jsx("span",{className:"shrink-0",children:"·"})]}):null,t.jsx("span",{className:"shrink-0",children:Xs(new Date(s.updated_at))})]}),e[23]=g,e[24]=i,e[25]=s.branch,e[26]=s.updated_at,e[27]=P):P=e[27];let A;e[28]!==M||e[29]!==P?(A=t.jsxs("div",{className:"flex-1 min-w-0",children:[M,P]}),e[28]=M,e[29]=P,e[30]=A):A=e[30];const F="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",L=!c&&t.jsx("span",{className:X("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",o&&"group-hover/row:opacity-0"),"aria-label":f("tasksPanel.taskRow.statusLabel",{status:m.label}),children:t.jsx(u,{size:14,className:X(m.iconClassName,s.status==="in_progress"&&"animate-spin")})});let O;e[31]!==o||e[32]!==f?(O=o&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":f("tasksPanel.taskRow.archiveTask"),onClick:R=>{R.stopPropagation(),o()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:t.jsx(Tn,{size:14})})}),t.jsx(Pe,{side:"right",children:f("tasksPanel.taskRow.archive")})]}),e[31]=o,e[32]=f,e[33]=O):O=e[33];let z;e[34]!==L||e[35]!==O?(z=t.jsxs("div",{className:F,children:[L,O]}),e[34]=L,e[35]=O,e[36]=z):z=e[36];let U;return e[37]!==r||e[38]!==A||e[39]!==z||e[40]!==w||e[41]!==v||e[42]!==N||e[43]!==s.id?(U=t.jsxs("div",{"data-task-id":x,role:j,tabIndex:C,onClick:r,onKeyDown:w,className:v,children:[N,A,z]}),e[37]=r,e[38]=A,e[39]=z,e[40]=w,e[41]=v,e[42]=N,e[43]=s.id,e[44]=U):U=e[44],U}const Bt=["requires_action","in_progress","failed","expired","completed"];function Wo(n){const e=new Map(Bt.map(s=>[s,[]]));for(const s of n){const i=s.status??"completed";(e.get(i)??e.get("completed")).push(s)}return Bt.map(s=>({status:s,threads:e.get(s)}))}const Xo="sidebar.group.expanded.";function Qo(n,e){const s=$.c(3),[i,r]=Ct(`${Xo}${n}`,e);let o;return s[0]!==i||s[1]!==r?(o=[i,r],s[0]=i,s[1]=r,s[2]=o):o=s[2],o}function gn(n){const e=$.c(18),{onClick:s,isFetching:i,indented:r}=n,o=G();let a;e[0]!==o?(a=o("sidebar.showMoreButton.ariaLabel"),e[0]=o,e[1]=a):a=e[1];const l=r?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==l?(c=X("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==i?(d=i&&t.jsx(Ve,{size:14,className:"animate-spin"}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==i||e[7]!==o?(f=o(i?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=i,e[7]=o,e[8]=f):f=e[8];let m;e[9]!==f?(m=t.jsx("span",{children:f}),e[9]=f,e[10]=m):m=e[10];let u;return e[11]!==i||e[12]!==s||e[13]!==a||e[14]!==c||e[15]!==d||e[16]!==m?(u=t.jsxs("button",{type:"button","aria-label":a,onClick:s,disabled:i,className:c,children:[d,m]}),e[11]=i,e[12]=s,e[13]=a,e[14]=c,e[15]=d,e[16]=m,e[17]=u):u=e[17],u}function Yo(n,e,s,i){return[n,e,s,i.type,i.member,i.currentUserId??""].join("|")}function Jo(n){return n.member==="mine"&&!n.currentUserId}const hn=4;let nt=0;const yt=[];function Zo(){for(;nt<hn&&yt.length>0;){const n=yt.shift();n&&n()}}function pn(n){return new Promise((e,s)=>{const i=()=>{nt++,n().then(e,s).finally(()=>{nt--,Zo()})};nt<hn?i():yt.push(i)})}const mt=10;function Et(n,e,s,i,r){const o={hidden:!1};i.member==="mine"&&i.currentUserId&&(o.created_by=i.currentUserId),i.type==="automation"&&(o.has_trigger=!0),i.type==="manual"&&(o.has_trigger=!1);const a={where:o,limit:r,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function ei(n,e,s,i){let r=0;for(const o of n)xn(o,e,s,i)&&r++;return r}function jt(n,e,s,i){return ei(n,e,s,i)}function ti(n,e){return!!(n>=mt||n===0&&e)}function Rt(n,e){return n<e}function ni(n,e){return e===!1?!1:e===!0?!0:n}function xn(n,e,s,i){return!(n.hidden||(n.status??"completed")!==s||i.member==="mine"&&i.currentUserId&&n.created_by!==i.currentUserId||i.type==="automation"&&!n.trigger_id||i.type==="manual"&&n.trigger_id)}const it=new Map,et=new Map;function si(n,e){return e?n>=mt?!0:null:!1}function Gt(n){return it.get(n)}function oi(n,e){it.set(n,e)}function ii(n,e,s){const i=it.get(n);if(i!==void 0){s(i);return}let r=et.get(n);r||(r=pn(e).then(o=>(it.set(n,o),et.delete(n),o)).catch(()=>(et.delete(n),Promise.reject(new Error("group probe failed")))),et.set(n,r)),r.then(s,()=>s(!1))}function Ht(n){const e=n,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===mt,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function ri(n,e,s,i,r){let o=0;for(const a of n)e.has(a.id)||xn(a,s,i,r)&&o++;return o}function ai(n,e,s,i){const r=$.c(8),{org:o}=le(),a=Yo(o.id,n,e,s);let l;r[0]!==s?(l=Jo(s),r[0]=s,r[1]=l):l=r[1];const c=l,[d,f]=V.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==a&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const m=Qn(),{threads:u,hasMore:p}=ut(),y=jt(u,n,e,s),b=ti(y,p),g=si(y,p),h=ct();if(d.identity===a&&d.serverHasMore===null){const T=g??Gt(a);T!==void 0&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:T})}!c&&d.identity===a&&d.serverHasMore===null&&g===null&&Gt(a)===void 0&&d.probeSubscribedIdentity!==a&&(f(T=>T.identity===a?{...T,isProbing:!0,probeSubscribedIdentity:a}:T),ii(a,async()=>{const T=Et(n,e,0,s,1),v=await h.call("COLLECTION_THREADS_LIST",T),{totalCount:N}=Ht(v),D=jt(m.threads.get(),n,e,s);return N===void 0?!1:Rt(D,N)},T=>{f(v=>v.identity!==a?v:{...v,isProbing:!1,serverHasMore:T})}));const j=async function(){if(d.isFetching||d.isProbing||c)return;const v=a;f(N=>N.identity===v?{...N,isFetching:!0}:N);try{const N=jt(u,n,e,s),D=Et(n,e,N,s,mt),S=await pn(()=>h.call("COLLECTION_THREADS_LIST",D)),{items:_,hasMore:M,totalCount:P}=Ht(S),A=new Set(u.map(li)),F=ri(_,A,n,e,s),L=N;m.mergeThreads(_),f(O=>{if(O.identity!==v)return O;let z;return P!==void 0?z=Rt(L+F,P):z=_.length===0||F===0?!1:M,oi(v,z),{...O,isFetching:!1,serverHasMore:z}})}catch(N){const D=N,S=D instanceof Error?D.message:String(D);Q.error(`Could not load more tasks: ${S}`),f(_=>_.identity===v?{..._,isFetching:!1}:_)}},C=d.isFetching||d.isProbing,w=!c&&!C&&ni(b,d.serverHasMore);let I;return r[2]!==C||r[3]!==j||r[4]!==w||r[5]!==d.isProbing||r[6]!==d.serverHasMore?(I={hasMore:w,isFetching:C,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:j},r[2]=C,r[3]=j,r[4]=w,r[5]=d.isProbing,r[6]=d.serverHasMore,r[7]=I):I=r[7],I}function li(n){return n.id}function ci(n){const e=$.c(20),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,{isFetching:d,isProbing:f,loadMore:m,hasMore:u,serverHasMore:p}=ai("status",s,c),[y,b]=V.useState(!1);!y&&i.length===0&&p===!0&&!d&&!f&&(b(!0),queueMicrotask(()=>{m()}));let g;if(e[0]!==r||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==o||e[5]!==i){let j;e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==o?(j=C=>t.jsx(mn,{task:C,isActive:r===C.id,onClick:()=>o(C),onArchive:l&&C.created_by===c.currentUserId?()=>a(C):void 0,showAutomationBadge:!!C.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},C.id),e[7]=r,e[8]=l,e[9]=c,e[10]=a,e[11]=o,e[12]=j):j=e[12],g=i.map(j),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=o,e[5]=i,e[6]=g}else g=e[6];let h;e[13]!==u||e[14]!==d||e[15]!==m?(h=(u||d)&&t.jsx(gn,{onClick:()=>{m()},isFetching:d,indented:!0}),e[13]=u,e[14]=d,e[15]=m,e[16]=h):h=e[16];let x;return e[17]!==g||e[18]!==h?(x=t.jsxs(t.Fragment,{children:[g,h]}),e[17]=g,e[18]=h,e[19]=x):x=e[19],x}function di(n){const e=$.c(36),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,d=Ws[s],f=d.icon,[m,u]=Qo(`status-${s}`,!1);let p;e[0]!==m||e[1]!==u?(p=function(){u(!m)},e[0]=m,e[1]=u,e[2]=p):p=e[2];const y=p;let b;e[3]!==y?(b=v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},e[3]=y,e[4]=b):b=e[4];let g;e[5]!==f||e[6]!==d.iconClassName?(g=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:t.jsx(f,{size:12,className:d.iconClassName})}),e[5]=f,e[6]=d.iconClassName,e[7]=g):g=e[7];let h;e[8]!==m?(h=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:m?t.jsx(_t,{size:14}):t.jsx(Wt,{size:14})}),e[8]=m,e[9]=h):h=e[9];let x;e[10]!==g||e[11]!==h?(x=t.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[g,h]}),e[10]=g,e[11]=h,e[12]=x):x=e[12];let j;e[13]!==d.label?(j=t.jsx("span",{className:"flex-1 truncate",children:d.label}),e[13]=d.label,e[14]=j):j=e[14];let C;e[15]!==i.length?(C=t.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:i.length})}),e[15]=i.length,e[16]=C):C=e[16];let w;e[17]!==m||e[18]!==y||e[19]!==b||e[20]!==x||e[21]!==j||e[22]!==C?(w=t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":m,onClick:y,onKeyDown:b,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[x,j,C]}),e[17]=m,e[18]=y,e[19]=b,e[20]=x,e[21]=j,e[22]=C,e[23]=w):w=e[23];let I;e[24]!==r||e[25]!==l||e[26]!==m||e[27]!==c||e[28]!==a||e[29]!==o||e[30]!==s||e[31]!==i?(I=m&&t.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:t.jsx(ci,{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c})}),e[24]=r,e[25]=l,e[26]=m,e[27]=c,e[28]=a,e[29]=o,e[30]=s,e[31]=i,e[32]=I):I=e[32];let T;return e[33]!==w||e[34]!==I?(T=t.jsxs("div",{className:"flex flex-col gap-0.5",children:[w,I]}),e[33]=w,e[34]=I,e[35]=T):T=e[35],T}function ui(n){const e=$.c(38),{threads:s,groupBy:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,filters:l,hasMore:c,isFetchingMore:d,onLoadMore:f,filtersActive:m}=n;if(s.length===0&&!c&&!d){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Us,{className:"size-6 opacity-60"}),e[0]=g):g=e[0];const h=m?"No chats match your filters":"No chats yet";let x;return e[1]!==h?(x=t.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[g,t.jsx("p",{className:"text-sm",children:h})]}),e[1]=h,e[2]=x):x=e[2],x}const u=s.length>1||c;if(i==="status"){let g;if(e[3]!==r||e[4]!==u||e[5]!==l||e[6]!==a||e[7]!==o||e[8]!==s){let x;e[10]!==r||e[11]!==u||e[12]!==l||e[13]!==a||e[14]!==o?(x=j=>t.jsx(di,{status:j.status,threads:j.threads,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:u,filters:l},j.status),e[10]=r,e[11]=u,e[12]=l,e[13]=a,e[14]=o,e[15]=x):x=e[15],g=Wo(s).map(x),e[3]=r,e[4]=u,e[5]=l,e[6]=a,e[7]=o,e[8]=s,e[9]=g}else g=e[9];let h;return e[16]!==g?(h=t.jsx(t.Fragment,{children:g}),e[16]=g,e[17]=h):h=e[17],h}let p;if(e[18]!==r||e[19]!==u||e[20]!==l||e[21]!==a||e[22]!==o||e[23]!==s){let g;e[25]!==r||e[26]!==u||e[27]!==l||e[28]!==a||e[29]!==o?(g=h=>t.jsx(mn,{task:h,isActive:r===h.id,onClick:()=>o(h),onArchive:u&&h.created_by===l.currentUserId?()=>a(h):void 0,showAutomationBadge:!!h.trigger_id,showAgentIcon:!0},h.id),e[25]=r,e[26]=u,e[27]=l,e[28]=a,e[29]=o,e[30]=g):g=e[30],p=s.map(g),e[18]=r,e[19]=u,e[20]=l,e[21]=a,e[22]=o,e[23]=s,e[24]=p}else p=e[24];let y;e[31]!==c||e[32]!==d||e[33]!==f?(y=(c||d)&&t.jsx(gn,{onClick:f,isFetching:d}),e[31]=c,e[32]=d,e[33]=f,e[34]=y):y=e[34];let b;return e[35]!==p||e[36]!==y?(b=t.jsxs(t.Fragment,{children:[p,y]}),e[35]=p,e[36]=y,e[37]=b):b=e[37],b}function fi(n,e){return null}function mi(n,e){return n.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const gi=["archive","reclaim-worktree"],hi=[];function pi(n){return n==="confirm"?gi:hi}function Dr(n){const e=$.c(11),{panel:s}=n;let i;return e[0]!==s.activeTaskId||e[1]!==s.archiveTask||e[2]!==s.filters||e[3]!==s.filtersActive||e[4]!==s.groupBy||e[5]!==s.hasMore||e[6]!==s.isFetchingMore||e[7]!==s.loadMore||e[8]!==s.selectTask||e[9]!==s.threads?(i=t.jsx(ui,{threads:s.threads,groupBy:s.groupBy,activeTaskId:s.activeTaskId,onSelectTask:s.selectTask,onArchiveTask:s.archiveTask,filters:s.filters,hasMore:s.hasMore,isFetchingMore:s.isFetchingMore,onLoadMore:s.loadMore,filtersActive:s.filtersActive}),e[0]=s.activeTaskId,e[1]=s.archiveTask,e[2]=s.filters,e[3]=s.filtersActive,e[4]=s.groupBy,e[5]=s.hasMore,e[6]=s.isFetchingMore,e[7]=s.loadMore,e[8]=s.selectTask,e[9]=s.threads,e[10]=i):i=e[10],i}function Ar(n){const e=$.c(82);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,r=G(),{data:o}=Te.useSession(),a=o?.user?.id,{org:l}=le();let c;e[2]!==l.id?(c=dt(l.id),e[2]=l.id,e[3]=c):c=e[3];const d=c.id,{threads:f,hasMore:m,isFetchingMore:u,fetchNextPage:p}=ut(),y=f.filter(ji),{hide:b,setScope:g}=sn(),h=rt(),x=ct(),{setTaskId:j,createNewTask:C}=ft();let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w={strict:!1},e[4]=w):w=e[4];const I=at(w);let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={strict:!1},e[5]=T):T=e[5];const v=lt(T),N=I.taskId??null;let D;e[6]!==N||e[7]!==f||e[8]!==v.virtualmcpid?(D=v.virtualmcpid??f.find(k=>k.id===N)?.virtual_mcp_id??null,e[6]=N,e[7]=f,e[8]=v.virtualmcpid,e[9]=D):D=e[9];const S=D;let _;e[10]!==i?(_=()=>{i?.()},e[10]=i,e[11]=_):_=e[11];const M=_,P=[...y].sort(vi),[A,F]=V.useState("all"),[L,O]=V.useState("flat"),[z,U]=Ct("sidebar-threads-scope-all",!1),[R,q]=V.useState(!1),[E,Y]=V.useState(!1);let ee;e[12]!==q?(ee=()=>{K("tasks_panel_search_opened"),Y(!0),q(!0)},e[12]=q,e[13]=ee):ee=e[13];const te=ee,[H,J]=V.useState(null),ne=a??null;let W;e[14]!==ne||e[15]!==A?(W={type:A,member:"mine",currentUserId:ne},e[14]=ne,e[15]=A,e[16]=W):W=e[16];const Ne=W,Be={};z||(Be.created_by="me"),g(Be);let Ce;e[17]!==a?(Ce=k=>a?k.filter(B=>B.created_by===a):[],e[17]=a,e[18]=Ce):Ce=e[18];const Ee=Ce;let _e;e[19]!==A?(_e=k=>A==="automation"?k.filter(bi):A==="manual"?k.filter(xi):k,e[19]=A,e[20]=_e):_e=e[20];const We=_e,se=We(z?P:Ee(P));let Se;e[21]!==N||e[22]!==M||e[23]!==a||e[24]!==b||e[25]!==h||e[26]!==l.slug||e[27]!==j||e[28]!==se?(Se=k=>{const B=k.id===N,Z=b(k.id);if(ss(k.id),!B)return Z;const ue=qo(se,k.id,a);return M(),ue?j(ue.id,ue.virtual_mcp_id):h({to:"/$org",params:{org:l.slug}}),Z},e[21]=N,e[22]=M,e[23]=a,e[24]=b,e[25]=h,e[26]=l.slug,e[27]=j,e[28]=se,e[29]=Se):Se=e[29];const oe=Se;let Re;e[30]!==x||e[31]!==r?(Re=async k=>{try{await x.call("SANDBOX_DELETE",{virtualMcpId:k.virtualMcpId,branch:k.branch,sandboxProviderKind:"user-desktop",removeWorktree:!0})}catch{Q.error(r("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:k.branch}))}},e[30]=x,e[31]=r,e[32]=Re):Re=e[32];const ke=Re;let Ie;e[33]!==f||e[34]!==oe||e[35]!==a||e[36]!==J?(Ie=k=>{if(a&&k.created_by&&k.created_by!==a)return;const B=fi();if(!B||mi(f,B)){oe(k);return}J({task:k,target:B})},e[33]=f,e[34]=oe,e[35]=a,e[36]=J,e[37]=Ie):Ie=e[37];const fe=Ie;let de;e[38]!==oe||e[39]!==H||e[40]!==ke||e[41]!==J?(de=k=>{const B=H;B&&(J(null),(async()=>{for(const Z of pi(k))if(Z==="archive")try{await oe(B.task)}catch{return}else await ke(B.target)})())},e[38]=oe,e[39]=H,e[40]=ke,e[41]=J,e[42]=de):de=e[42];const Fe=de;let De;e[43]!==M||e[44]!==j?(De=k=>{M(),j(k.id,k.virtual_mcp_id)},e[43]=M,e[44]=j,e[45]=De):De=e[45];const $e=De;let Ae;e[46]!==S||e[47]!==N||e[48]!==f||e[49]!==M||e[50]!==C||e[51]!==d?(Ae=()=>{const k=S??d,B=f.find(Z=>Z.id===N)?.branch??null;K("sidebar_new_thread_clicked",{virtual_mcp_id:k}),M(),C(k,B)},e[46]=S,e[47]=N,e[48]=f,e[49]=M,e[50]=C,e[51]=d,e[52]=Ae):Ae=e[52];const me=Ae;let ie;e[53]!==p?(ie=()=>{p()},e[53]=p,e[54]=ie):ie=e[54];const ge=L!=="flat"||A!=="all"||z;let re;e[55]!==Fe||e[56]!==H?(re=H?t.jsx(Uo,{branch:H.target.branch,onOutcome:Fe}):null,e[55]=Fe,e[56]=H,e[57]=re):re=e[57];let ae;e[58]!==E||e[59]!==R||e[60]!==q?(ae=E?t.jsx(Vo,{open:R,onOpenChange:q}):null,e[58]=E,e[59]=R,e[60]=q,e[61]=ae):ae=e[61];let we;return e[62]!==N||e[63]!==fe||e[64]!==Ne||e[65]!==L||e[66]!==m||e[67]!==u||e[68]!==me||e[69]!==te||e[70]!==$e||e[71]!==O||e[72]!==U||e[73]!==F||e[74]!==z||e[75]!==ie||e[76]!==ge||e[77]!==re||e[78]!==ae||e[79]!==A||e[80]!==se?(we={threads:se,activeTaskId:N,filters:Ne,hasMore:m,isFetchingMore:u,loadMore:ie,groupBy:L,setGroupBy:O,typeFilter:A,setTypeFilter:F,showAll:z,setShowAll:U,filtersActive:ge,selectTask:$e,archiveTask:fe,newThread:me,openSearch:te,reclaimDialog:re,searchDialog:ae},e[62]=N,e[63]=fe,e[64]=Ne,e[65]=L,e[66]=m,e[67]=u,e[68]=me,e[69]=te,e[70]=$e,e[71]=O,e[72]=U,e[73]=F,e[74]=z,e[75]=ie,e[76]=ge,e[77]=re,e[78]=ae,e[79]=A,e[80]=se,e[81]=we):we=e[81],we}function xi(n){return!n.trigger_id}function bi(n){return!!n.trigger_id}function vi(n,e){return(e.updated_at??"").localeCompare(n.updated_at??"")}function ji(n){return!n.hidden}function yi(n){return n?n.run_in_progress?"generating":n.scanned_at?"ready":"none":"none"}const Ci=2e4;function _i(n){if(typeof n!="string"||!n)return null;try{return new URL(n).hostname||null}catch{return null}}function Tr(){const n=$.c(19),{org:e}=le(),s=En.COMMERCE_DISCOVERY(e.id);let i;n[0]!==e.id||n[1]!==e.slug?(i=zt({connectionId:Xt,orgId:e.id,orgSlug:e.slug}),n[0]=e.id,n[1]=e.slug,n[2]=i):i=n[2];const{data:r}=He(i),o=He({queryKey:Ue.commerceDiscoveryConnection(e.id,s),enabled:!!r,retry:!1,staleTime:6e4,queryFn:async()=>{if(!r)throw new Error("selfClient not ready");const w=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}});return Pt(w)}}),a=o.data?.item??null,{data:l}=He({...zt({connectionId:s,orgId:e.id,orgSlug:e.slug}),enabled:!!a}),c=Ue.commerceDiscoveryDiagnostic(e.id,s),d=!!l;let f;n[3]!==l?(f=async()=>{if(!l)throw new Error("cdClient not ready");const w=await l.callTool({name:Qt,arguments:{}});return Pt(w).diagnostic??null},n[3]=l,n[4]=f):f=n[4];let m;n[5]!==c||n[6]!==d||n[7]!==f?(m={queryKey:c,enabled:d,retry:1,refetchInterval:wi,queryFn:f},n[5]=c,n[6]=d,n[7]=f,n[8]=m):m=n[8];const u=He(m),p=a?.metadata?.siteUrl,y=u.data??null,b=u.isSuccess,g=o.isPending||!!a&&u.isPending,h=typeof p=="string"&&p?p:null;let x;n[9]!==p?(x=_i(p),n[9]=p,n[10]=x):x=n[10];const j=l??null;let C;return n[11]!==s||n[12]!==u.isSuccess||n[13]!==j||n[14]!==y||n[15]!==g||n[16]!==h||n[17]!==x?(C={diagnostic:y,isSuccess:b,isLoading:g,siteUrl:h,host:x,connectionId:s,cdClient:j},n[11]=s,n[12]=u.isSuccess,n[13]=j,n[14]=y,n[15]=g,n[16]=h,n[17]=x,n[18]=C):C=n[18],C}function wi(n){return n.state.status!=="error"&&yi(n.state.data)==="generating"?Ci:!1}function Mr(n,e){return{to:"/$org/$taskId",params:{org:n.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:Rn(n.id),main:Qs(e,Qt)}}}export{wr as A,yr as C,Nr as N,_r as O,Ir as T,Cr as a,Sr as b,Ar as c,oo as d,Mt as e,Dr as f,Tr as g,Io as h,yi as i,Mr as j,kr as u};
1
+ import{c as $,b as G,j as t,C as bn,aj as vn,B as ye,r as V,bq as jn,d as rt,w as yn,n as X,a as Te,t as Q,y as Cn,k as Ve,a5 as Vt,M as Ut,q as K,_ as qt,Z as Kt,Y as _n,H as le,f as at,u as lt,a8 as Me,a9 as Pe,ab as Oe,L as wn,G as Nn,ao as Sn,ap as kn,R as Ct,I as In,K as Ue,p as Dn,av as ct,o as He,bn as An,b2 as Tn}from"./index-DS_PtpmP.js";import{i as Wt}from"./ChevronRight-DB1jERJP.js";import{aJ as Mn,S as Pn,A as qe,e as On,s as gt,aB as Fn,aK as $n,aL as zn}from"./agent-icon-BRsJ64Gp.js";import{t as _t}from"./ChevronDown-DC3VmpPs.js";import{a as dt,i as Ln,e as Bn,S as Xt,W as En,C as Qt,g as Rn}from"./constants-_08zpzmT.js";import{u as Yt,a as wt}from"./use-virtual-mcp-BHOLpD1P.js";import{a as Qe,b as Nt,P as St}from"./popover-BRZicoZW.js";import{i as st}from"./Check-7fxTQqwV.js";import{s as Ke}from"./Plus-DfL6u6I_.js";import{i as Jt}from"./SearchMd-DVItXoZb.js";import{s as Zt}from"./XClose-F4_KA-E6.js";import{C as Gn,d as Pt}from"./self-tool-result-r1jsmu7J.js";import{T as kt}from"./toolbar-DORhO8If.js";import{D as en,a as tn,b as nn,c as Hn,g as Vn,e as Un,f as qn}from"./drawer-Ckbm2CWJ.js";import{a as Kn,G as Wn}from"./github-repo-picker-BMkV5srU.js";import{g as Xn,a as sn,u as ut,c as Qn}from"./hooks-DlPXzzl8.js";import{u as Yn,g as Jn,a as Zn,b as es}from"./use-navigate-to-agent-BTDz1KOs.js";import{b as ts,a as on,g as ns}from"./agent-capabilities-C4tLW0Za.js";import{u as ft,f as ss}from"./shell-layout-Ca7ET_6R.js";import{f as os}from"./reusable-new-chat-CzvRy4Pe.js";import{d as is}from"./session-runtime-wVXsCwcJ.js";import{C as rs}from"./collection-search-Bd6xu3h9.js";import{g as as,a as ls,b as cs,e as ds}from"./extract-connection-data-A9qAyYQA.js";import{u as rn,a as an,g as us,C as ht}from"./connection-card-DXUN0HbG.js";import{e as It,d as Dt,a as At,b as Tt,h as ln,c as fs}from"./dialog-CLVbCjMu.js";import{d as pe,a as xe,e as be,b as ve,c as je,F as Ot}from"./form-BI3-Eb2L.js";import{I as Le}from"./input-Dsyfk4jo.js";import{S as ms,a as gs,b as hs,c as ps,d as Xe}from"./select-v0HyS5wV.js";import{T as xs}from"./textarea-CegtzxU_.js";import{b as cn}from"./use-connection-BJir_wda.js";import{n as tt,i as pt}from"./Tool02-CaMOVLUq.js";import{c as bs,i as Je,a as Ft,E as vs,p as js,b as ys,d as Cs}from"./connection-form-helpers-Dw_uRR_o.js";import{a as xt}from"./authenticate-and-persist-oauth-CfcfVqDI.js";import{g as _s}from"./connection-slug-eyAPH6o3.js";import{C as ws}from"./collection-tabs-3ta98PDW.js";import{u as $t}from"./use-infinite-scroll-DGa9MpTS.js";import{B as Ze}from"./badge-Dp3mR27V.js";import{u as Ns}from"./useSuspenseInfiniteQuery-bgdhkmFx.js";import{u as Ss,m as zt}from"./use-mcp-client-Zz1TwEAh.js";import{g as ot}from"./metadata-dUsYcpuu.js";import{u as ks}from"./use-ai-providers-DAYMp9NI.js";import{i as Is}from"./FilterLines-v44MczT5.js";import{a as Ds,T as As}from"./toggle-group-5omFh11U.js";import{d as Ts,a as Ms,c as Ps,b as Os,C as Fs,e as $s}from"./command-pFth6-af.js";import{i as dn}from"./Zap-DK06ViId.js";import{c as zs,d as Ls,b as Bs,f as Es,g as Rs,e as Gs,a as Hs,A as Vs}from"./alert-dialog-C6uvTNV5.js";import{n as Us}from"./Stars02-DTCJxH0_.js";import{g as qs,u as Ks,S as Ws}from"./use-clock-tick-BuVoJTdT.js";import{a as Xs}from"./format-time-BnbuEtat.js";import{f as Qs}from"./tab-id-BOj9dZWT.js";const Ys="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Js(){const n=$.c(13),e=G();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("img",{src:"/logos/summit/monte-carlo.svg",alt:"Monte Carlo",className:"h-14 w-[112px] shrink-0 self-start object-contain object-left brightness-0 invert"}),n[0]=s):s=n[0];let i;n[1]!==e?(i=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=i):i=n[2];let r;n[3]!==i?(r=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",i,"”"]}),n[3]=i,n[4]=r):r=n[4];let o;n[5]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("img",{src:Ys,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=o):o=n[5];let a;n[6]!==e?(a=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=a):a=n[7];let l;n[8]!==a?(l=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[o,t.jsx("span",{className:"text-base font-medium",children:a})]}),n[8]=a,n[9]=l):l=n[9];let c;return n[10]!==r||n[11]!==l?(c=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,r,l]}),n[10]=r,n[11]=l,n[12]=c):c=n[12],c}function Zs(){const n=$.c(19),e=G();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let i;n[2]!==s?(i={Icon:Mn,label:s},n[2]=s,n[3]=i):i=n[3];let r;n[4]!==e?(r=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=r):r=n[5];let o;n[6]!==r?(o={Icon:bn,label:r},n[6]=r,n[7]=o):o=n[7];let a;n[8]!==e?(a=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=a):a=n[9];let l;n[10]!==a?(l={Icon:Pn,label:a},n[10]=a,n[11]=l):l=n[11];let c;n[12]!==i||n[13]!==o||n[14]!==l?(c=[i,o,l],n[12]=i,n[13]=o,n[14]=l,n[15]=c):c=n[15];const d=c;let f;n[16]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=f):f=n[16];let m;return n[17]!==d?(m=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[f,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:d.map(eo)})]}),n[17]=d,n[18]=m):m=n[18],m}function eo(n){const{Icon:e,label:s}=n;return t.jsxs("li",{className:"flex items-center gap-2.5 text-[13px] leading-tight text-white/70",children:[t.jsx(e,{className:"size-4 shrink-0 opacity-85"}),s]},s)}function yr(n){const e=$.c(22),{siteHost:s,footer:i,onClose:r,children:o}=n,a=G(),l=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let c;e[0]!==r||e[1]!==a?(c=r&&t.jsx("button",{type:"button",onClick:r,"aria-label":a("routes.commerceOnboarding.connectModal.close"),className:"absolute right-3 top-3 z-10 flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-black/10 hover:text-foreground lg:text-white/80 lg:hover:bg-white/15 lg:hover:text-white",children:t.jsx(vn,{size:18})}),e[0]=r,e[1]=a,e[2]=c):c=e[2];let d,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),f=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=d,e[4]=f):(d=e[3],f=e[4]);let m;e[5]!==l||e[6]!==s?(m=s&&t.jsxs(t.Fragment,{children:[t.jsx(Wt,{size:16,className:"shrink-0 text-foreground/25"}),l&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:l,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=l,e[6]=s,e[7]=m):m=e[7];let u;e[8]!==m?(u=t.jsxs("div",{className:"flex items-center gap-2",children:[d,f,m]}),e[8]=m,e[9]=u):u=e[9];let p;e[10]!==i?(p=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:i}),e[10]=i,e[11]=p):p=e[11];let y;e[12]!==o||e[13]!==u||e[14]!==p?(y=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[u,o,p]}),e[12]=o,e[13]=u,e[14]=p,e[15]=y):y=e[15];let b,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("img",{src:"https://decoims.com/image?src=decocms%2F8191643a-1947-4c30-afb4-36b8073c90fb%2Fbg-quote.png&quality=original&fit=cover&width=880",alt:"",className:"absolute inset-0 size-full object-cover"}),g=t.jsx("div",{className:"absolute inset-0 bg-black/20"}),e[16]=b,e[17]=g):(b=e[16],g=e[17]);let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[b,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Js,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Zs,{})]})]}),e[18]=h):h=e[18];let x;return e[19]!==c||e[20]!==y?(x=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[c,y,h]}),e[19]=c,e[20]=y,e[21]=x):x=e[21],x}function Cr(n){const e=$.c(5),{ready:s,pending:i,label:r,onClick:o,children:a}=n,l=i||!s,c=s&&!i?a:null;let d;return e[0]!==r||e[1]!==o||e[2]!==l||e[3]!==c?(d=t.jsxs(ye,{type:"button",size:"lg",className:"h-auto min-h-12 w-full whitespace-normal rounded-lg py-3 text-center text-base font-medium leading-tight",onClick:o,disabled:l,children:[r,c]}),e[0]=r,e[1]=o,e[2]=l,e[3]=c,e[4]=d):d=e[4],d}function un(){const n=V.useContext(jn),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(r=>r.status==="pending"&&new Date(r.expiresAt)>new Date),refetch:()=>s?.()}}function to(n){let e=0;for(let i=0;i<n.length;i++)e=n.charCodeAt(i)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function Mt(n){const e=$.c(13),{org:s,size:i}=n,r=i===void 0?"sm":i,o=r==="xs"?"size-5":"size-6",a=r==="xs"?"text-[9px]":"text-xs";let l;e[0]!==o?(l=X(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:to(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.logo||e[6]!==s.name||e[7]!==a?(d=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:X("font-semibold leading-none",a),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=a,e[8]=d):d=e[8];let f;return e[9]!==l||e[10]!==c||e[11]!==d?(f=t.jsx("div",{className:l,style:c,children:d}),e[9]=l,e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function no({invitation:n,onChanged:e}){const s=G(),[i,r]=V.useState(!1),o=n.organizationName??s("header.orgSwitcher.unknownOrganization"),a=async()=>{r(!0);try{const d=await Te.organization.acceptInvitation({invitationId:n.id});if(d.error){Q.error(d.error.message),r(!1);return}}catch{Q.error(s("header.orgSwitcher.failedToAcceptInvitation")),r(!1);return}Q.success(s("header.orgSwitcher.joined",{name:o})),Cn();let c;try{c=(await Te.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},l=async()=>{r(!0);try{const c=await Te.organization.rejectInvitation({invitationId:n.id});if(c.error){Q.error(c.error.message),r(!1);return}Q.success(s("header.orgSwitcher.invitationDeclined")),r(!1),e()}catch{Q.error(s("header.orgSwitcher.failedToDeclineInvitation")),r(!1)}};return t.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[t.jsx(Mt,{org:{name:o},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:o}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx(ye,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:a,disabled:i,children:s("header.orgSwitcher.accept")}),t.jsx(ye,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:l,disabled:i,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:o}),children:t.jsx(Zt,{size:14})})]})]})}function so(n){const e=$.c(32),{orgParam:s,onSelectOrg:i,onCreateOrg:r}=n,o=G(),{data:a}=yn(),{invitations:l,refetch:c}=un();let d;e[0]!==s?(d=(P,A)=>P.slug===s?-1:A.slug===s?1:P.name.localeCompare(A.name),e[0]=s,e[1]=d):d=e[1];const f=[...a??[]].sort(d),[m,u]=V.useState(""),p=m.toLowerCase(),y=p?f.filter(P=>P.name.toLowerCase().includes(p)||P.slug.toLowerCase().includes(p)):f;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Jt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=b):b=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=P=>u(P.target.value),e[3]=g):g=e[3];let h;e[4]!==m?(h=P=>P.key==="Escape"&&m&&u(""),e[4]=m,e[5]=h):h=e[5];let x;e[6]!==o?(x=o("header.orgSwitcher.searchOrganizations"),e[6]=o,e[7]=x):x=e[7];let j;e[8]!==m||e[9]!==h||e[10]!==x?(j=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:m,onChange:g,onKeyDown:h,placeholder:x,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=m,e[9]=h,e[10]=x,e[11]=j):j=e[11];let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ke,{size:16}),e[12]=C):C=e[12];let w;e[13]!==r?(w=t.jsx("button",{type:"button",onClick:r,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:C}),e[13]=r,e[14]=w):w=e[14];let I;e[15]!==j||e[16]!==w?(I=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[b,j,w]}),e[15]=j,e[16]=w,e[17]=I):I=e[17];const T="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let v;e[18]!==l||e[19]!==m||e[20]!==c?(v=!m&&l.map(P=>t.jsx(no,{invitation:P,onChanged:c},P.id)),e[18]=l,e[19]=m,e[20]=c,e[21]=v):v=e[21];const N=y.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:m?o("header.orgSwitcher.noOrganizationsMatch",{query:m}):o("header.orgSwitcher.noOrganizationsAvailable")});let D;e[22]!==i||e[23]!==s?(D=P=>t.jsxs("button",{type:"button",onClick:()=>i(P.slug),className:X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",P.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(Mt,{org:P,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:P.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:P.slug})]}),P.slug===s&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},P.id),e[22]=i,e[23]=s,e[24]=D):D=e[24];const S=y.map(D);let _;e[25]!==v||e[26]!==N||e[27]!==S?(_=t.jsxs("div",{className:T,children:[v,N,S]}),e[25]=v,e[26]=N,e[27]=S,e[28]=_):_=e[28];let M;return e[29]!==_||e[30]!==I?(M=t.jsxs(t.Fragment,{children:[I,_]}),e[29]=_,e[30]=I,e[31]=M):M=e[31],M}function oo(n){const e=$.c(22),{trigger:s,orgParam:i,align:r,side:o}=n,a=r===void 0?"start":r,l=o===void 0?"bottom":o,c=rt(),[d,f]=V.useState(!1),[m,u]=V.useState(!1);let p;e[0]!==s?(p=t.jsx(Qe,{asChild:!0,children:s}),e[0]=s,e[1]=p):p=e[1];const y=String(d);let b;e[2]!==c?(b=I=>{f(!1),c({to:"/$org",params:{org:I}})},e[2]=c,e[3]=b):b=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{f(!1),u(!0)},e[4]=g):g=e[4];let h;e[5]!==i||e[6]!==y||e[7]!==b?(h=t.jsx(so,{orgParam:i,onSelectOrg:b,onCreateOrg:g},y),e[5]=i,e[6]=y,e[7]=b,e[8]=h):h=e[8];let x;e[9]!==a||e[10]!==l||e[11]!==h?(x=t.jsx(Nt,{side:l,align:a,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:ro,onCloseAutoFocus:io,children:h}),e[9]=a,e[10]=l,e[11]=h,e[12]=x):x=e[12];let j;e[13]!==d||e[14]!==p||e[15]!==x?(j=t.jsxs(St,{open:d,onOpenChange:f,children:[p,x]}),e[13]=d,e[14]=p,e[15]=x,e[16]=j):j=e[16];let C;e[17]!==m?(C=t.jsx(Gn,{open:m,onOpenChange:u}),e[17]=m,e[18]=C):C=e[18];let w;return e[19]!==C||e[20]!==j?(w=t.jsxs(t.Fragment,{children:[j,C]}),e[19]=C,e[20]=j,e[21]=w):w=e[21],w}function io(n){return n.preventDefault()}function ro(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ao(n){const e=$.c(21),{value:s,onChange:i,placeholder:r,onKeyDown:o,className:a,isSearching:l,disabled:c}=n,d=r===void 0?"Search...":r;let f;e[0]!==a?(f=X("shrink-0 w-full border-b border-border h-12",a),e[0]=a,e[1]=f):f=e[1];const m=c?"cursor-not-allowed opacity-50":"cursor-text";let u;e[2]!==m?(u=X("flex items-center gap-2.5 h-12 px-4",m),e[2]=m,e[3]=u):u=e[3];let p;e[4]!==l?(p=l?t.jsx(Ve,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Jt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=l,e[5]=p):p=e[5];let y;e[6]!==i?(y=x=>i(x.target.value),e[6]=i,e[7]=y):y=e[7];let b;e[8]!==c||e[9]!==o||e[10]!==d||e[11]!==y||e[12]!==s?(b=t.jsx("input",{type:"text",value:s,onChange:y,onKeyDown:o,placeholder:d,disabled:c,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=c,e[9]=o,e[10]=d,e[11]=y,e[12]=s,e[13]=b):b=e[13];let g;e[14]!==u||e[15]!==p||e[16]!==b?(g=t.jsxs("label",{className:u,children:[p,b]}),e[14]=u,e[15]=p,e[16]=b,e[17]=g):g=e[17];let h;return e[18]!==f||e[19]!==g?(h=t.jsx("div",{className:f,children:g}),e[18]=f,e[19]=g,e[20]=h):h=e[20],h}function lo(n,e,s){if(!s)return null;const i=Xn(n,e);return i?i.threads.get().find(o=>o.id===s)?.branch??null:null}function co(n){const e=$.c(6),{value:s,onChange:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.searchAgents"),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==i||e[3]!==o||e[4]!==s?(a=t.jsx(ao,{value:s,onChange:i,placeholder:o}),e[2]=i,e[3]=o,e[4]=s,e[5]=a):a=e[5],a}function uo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=i):i=n[3],i}function fo(n){const e=$.c(10),{org:s,onClose:i}=n,r=G();let o;e[0]!==s.slug?(o={org:s.slug},e[0]=s.slug,e[1]=o):o=e[1];let a;e[2]!==i?(a=()=>i(),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r("sidebar.agentsSection.seeAllAgents"),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==a||e[8]!==l?(c=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(wn,{to:"/$org/settings/agents",params:o,onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:l})}),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}function mo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(fn,{children:s}),n[2]=s,n[3]=i):i=n[3],i}function go(n){const e=$.c(11),{onImportFromGithub:s}=n,i=G();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Wn,{className:"size-3.5"}),e[0]=r):r=e[0];let o;e[1]!==i?(o=i("sidebar.agentsSection.import"),e[1]=i,e[2]=o):o=e[2];let a;e[3]!==s||e[4]!==o?(a=t.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[r,o]}),e[3]=s,e[4]=o,e[5]=a):a=e[5];let l;e[6]!==i?(l=i("sidebar.agentsSection.codeAgents"),e[6]=i,e[7]=l):l=e[7];let c;return e[8]!==a||e[9]!==l?(c=t.jsx(fn,{action:a,children:l}),e[8]=a,e[9]=l,e[10]=c):c=e[10],c}function ho(n){const e=$.c(11),{setOpen:s,emptyCtaClass:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.browseAgents"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i?(a=X(i),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==s?(l=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=l):l=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{className:"size-4"}),e[6]=c):c=e[6];let d;return e[7]!==o||e[8]!==a||e[9]!==l?(d=t.jsx(kt,{"aria-label":o,className:a,onClick:l,children:c}),e[7]=o,e[8]=a,e[9]=l,e[10]=d):d=e[10],d}function po(n){const e=$.c(17),{setOpen:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=X(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]!==s?(c=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ke,{}),e[7]=d):d=e[7];let f;e[8]!==o?(f=o("sidebar.agentsSection.newAgent"),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=t.jsx("span",{children:f}),e[10]=f,e[11]=m):m=e[11];let u;return e[12]!==a||e[13]!==l||e[14]!==c||e[15]!==m?(u=t.jsx(qt,{children:t.jsxs(Kt,{tooltip:a,className:l,onClick:c,children:[d,m]})}),e[12]=a,e[13]=l,e[14]=c,e[15]=m,e[16]=u):u=e[16],u}function xo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(nn,{className:"sr-only",children:s}),n[2]=s,n[3]=i):i=n[3],i}function bo(n){const e=$.c(8),{emptyCtaClass:s}=n,i=G();let r;e[0]!==i?(r=i("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=r):r=e[1];let o;e[2]!==s?(o=X(s),e[2]=s,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Ke,{className:"size-4"}),e[4]=a):a=e[4];let l;return e[5]!==r||e[6]!==o?(l=t.jsx(kt,{"aria-label":r,className:o,children:a}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function vo(n){const e=$.c(19),{wrapEmptyHint:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=X(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{}),e[5]=c):c=e[5];let d;e[6]!==o?(d=o("sidebar.agentsSection.newAgent"),e[6]=o,e[7]=d):d=e[7];let f;e[8]!==d?(f=t.jsx("span",{children:d}),e[8]=d,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==l||e[12]!==f?(m=t.jsx(Qe,{asChild:!0,children:t.jsxs(Kt,{tooltip:a,className:l,children:[c,f]})}),e[10]=a,e[11]=l,e[12]=f,e[13]=m):m=e[13];let u;e[14]!==m||e[15]!==s?(u=s(m),e[14]=m,e[15]=s,e[16]=u):u=e[16];let p;return e[17]!==u?(p=t.jsx(qt,{children:u}),e[17]=u,e[18]=p):p=e[18],p}function jo(n){const e=$.c(9),{children:s}=n,i=G();let r;e[0]!==s?(r=t.jsx(Me,{asChild:!0,children:s}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==i?(o=i("sidebar.agentsSection.selectAnExistingAgent"),e[2]=i,e[3]=o):o=e[3];let a;e[4]!==o?(a=t.jsx(Pe,{side:"right",sideOffset:8,children:o}),e[4]=o,e[5]=a):a=e[5];let l;return e[6]!==r||e[7]!==a?(l=t.jsxs(Oe,{defaultOpen:!0,delayDuration:0,children:[r,a]}),e[6]=r,e[7]=a,e[8]=l):l=e[8],l}function yo(n){const e=rt(),{create:s}=sn(),{locator:i}=le(),r=at({strict:!1}),o=lt({strict:!1});return async a=>{const l=crypto.randomUUID(),c=a===o.virtualmcpid?lo(n,i,r.taskId??""):null;try{await s({id:l,virtual_mcp_id:a,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:l},search:{virtualmcpid:a}})}}function bt(n){const e=$.c(20),{agent:s,selected:i,onClick:r}=n,o=i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let a;e[0]!==o?(a=X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",o),e[0]=o,e[1]=a):a=e[1];let l;e[2]!==s.icon||e[3]!==s.title?(l=t.jsx(qe,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=l):l=e[4];let c;e[5]!==s.title?(c=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=c):c=e[6];let d;e[7]!==s.description?(d=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=d):d=e[8];let f;e[9]!==c||e[10]!==d?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,d]}),e[9]=c,e[10]=d,e[11]=f):f=e[11];let m;e[12]!==i?(m=i&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=i,e[13]=m):m=e[13];let u;return e[14]!==r||e[15]!==a||e[16]!==l||e[17]!==f||e[18]!==m?(u=t.jsxs("button",{type:"button",onClick:r,className:a,children:[l,f,m]}),e[14]=r,e[15]=a,e[16]=l,e[17]=f,e[18]=m,e[19]=u):u=e[19],u}function fn(n){const e=$.c(5),{children:s,action:i}=n;let r;e[0]!==s?(r=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let o;return e[2]!==i||e[3]!==r?(o=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[r,i]}),e[2]=i,e[3]=r,e[4]=o):o=e[4],o}function Co(n){const e=$.c(23),{onClose:s,onSelectAgent:i,selectedAgentId:r,onImportFromGithub:o}=n,[a,l]=V.useState(""),c=Yt(),d=c??[],{org:f}=le(),{data:m}=Te.useSession(),u=m?.user?.id??"anon",p=Jn(c),y=Zn(),b=yo(f.slug),g=ts(c),h=a.toLowerCase(),x=d.filter(So).filter(E=>!g.has(E.id)).filter(No).filter(E=>!a||E.title.toLowerCase().includes(h)),j=x.filter(wo),C=x.filter(_o),w=dt(f.id),I=!a||w.title.toLowerCase().includes(h),T=!!(i&&I);let v;e[0]!==s||e[1]!==i?(v=()=>{i?.(null),s(),l("")},e[0]=s,e[1]=i,e[2]=v):v=e[2];const N=v,D=E=>{if(i){i(E.id),s(),l("");return}es({orgId:f.id,userId:u},E.id,p),y(),s(),l(""),b(E.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let _;e[3]!==a?(_=t.jsx(co,{value:a,onChange:l}),e[3]=a,e[4]=_):_=e[4];const M="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",P=i&&I&&w&&t.jsx(bt,{agent:w,selected:!r||r===w.id,onClick:N}),A=(j.length>0||!a)&&t.jsx(go,{onImportFromGithub:o}),F=j.map(E=>t.jsx(bt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>D(E)},E.id)),L=C.length>0&&t.jsx(mo,{}),O=C.map(E=>t.jsx(bt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>D(E)},E.id));let z;e[5]!==T||e[6]!==a||e[7]!==x.length?(z=x.length===0&&!T&&a&&t.jsx(uo,{}),e[5]=T,e[6]=a,e[7]=x.length,e[8]=z):z=e[8];let U;e[9]!==z||e[10]!==P||e[11]!==A||e[12]!==F||e[13]!==L||e[14]!==O?(U=t.jsxs("div",{className:M,children:[P,A,F,L,O,z]}),e[9]=z,e[10]=P,e[11]=A,e[12]=F,e[13]=L,e[14]=O,e[15]=U):U=e[15];let R;e[16]!==s||e[17]!==f?(R=t.jsx(fo,{org:f,onClose:s}),e[16]=s,e[17]=f,e[18]=R):R=e[18];let q;return e[19]!==U||e[20]!==R||e[21]!==_?(q=t.jsxs("div",{className:S,children:[_,U,R]}),e[19]=U,e[20]=R,e[21]=_,e[22]=q):q=e[22],q}function _o(n){return!on(n.metadata)}function wo(n){return on(n.metadata)}function No(n){return!Bn(n.id)}function So(n){return!Ln(n.id)}function ko(n){const e=$.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:i,trigger:r,onSelectAgent:o,selectedAgentId:a,side:l,align:c}=s,d=i===void 0?!1:i,f=l===void 0?"right":l,m=c===void 0?"start":c,[u,p]=V.useState(!1),[y,b]=V.useState(!1),g=Vt(),{setOpenMobile:h}=Ut(),x=Yn(),j=x?"border border-border":void 0;let C;e[2]!==x?(C=A=>x?t.jsx(jo,{children:A}):A,e[2]=x,e[3]=C):C=e[3];const w=C;let I;e[4]!==g||e[5]!==h?(I=()=>{p(!1),g&&h(!1)},e[4]=g,e[5]=h,e[6]=I):I=e[6];const T=I;let v;e[7]!==T?(v=()=>{T(),b(!0)},e[7]=T,e[8]=v):v=e[8];const N=v;let D;e[9]!==T||e[10]!==N||e[11]!==o||e[12]!==u||e[13]!==a?(D=u&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(_n,{className:"h-4 w-24"})}),children:t.jsx(Co,{onClose:T,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:N})}),e[9]=T,e[10]=N,e[11]=o,e[12]=u,e[13]=a,e[14]=D):D=e[14];const S=D;let _;e[15]!==m||e[16]!==d||e[17]!==j||e[18]!==x||e[19]!==g||e[20]!==u||e[21]!==S||e[22]!==f||e[23]!==r||e[24]!==w?(_=g?t.jsxs(t.Fragment,{children:[r?t.jsx("button",{type:"button",onClick:()=>p(!0),className:"contents",children:r}):d?w(t.jsx(ho,{setOpen:p,emptyCtaClass:j})):t.jsx(po,{setOpen:p,highlightEmpty:x,emptyCtaClass:j}),t.jsx(en,{open:u,onOpenChange:p,direction:"bottom",children:t.jsxs(tn,{className:"max-h-[85dvh] p-0",children:[t.jsx(xo,{}),S]})})]}):t.jsxs(St,{open:u,onOpenChange:A=>{A&&!u&&K("agent_browser_opened",{surface:"desktop_popover"}),p(A)},children:[r?t.jsx(Qe,{asChild:!0,children:r}):d?w(t.jsx(Qe,{asChild:!0,children:t.jsx(bo,{emptyCtaClass:j})})):t.jsx(vo,{wrapEmptyHint:w,highlightEmpty:x,emptyCtaClass:j}),t.jsx(Nt,{className:"w-[380px] p-0 overflow-hidden",side:f,align:m,children:S})]}),e[15]=m,e[16]=d,e[17]=j,e[18]=x,e[19]=g,e[20]=u,e[21]=S,e[22]=f,e[23]=r,e[24]=w,e[25]=_):_=e[25];let M;e[26]!==y?(M=t.jsx(Kn,{open:y,onOpenChange:b,mode:"agent"}),e[26]=y,e[27]=M):M=e[27];let P;return e[28]!==M||e[29]!==_?(P=t.jsxs(t.Fragment,{children:[_,M]}),e[28]=M,e[29]=_,e[30]=P):P=e[30],P}function Io(){const n=$.c(2),e=Yt()??[];let s;return n[0]!==e?(s=i=>{if(!i)return;const r=e.find(o=>o.id===i);return r?is(r.metadata):void 0},n[0]=e,n[1]=s):s=n[1],s}const Do="inline-flex items-center gap-1.5 min-w-0 rounded-md pl-1 pr-2 py-1.5 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function Ao(n){const e=$.c(29),{agentId:s,fallback:i,onOpenHome:r,onPick:o}=n,a=G(),l=wt(s)??i??null;let c,d,f,m,u;e[0]!==l?.title||e[1]!==r||e[2]!==a?(u=l?.title??a("header.shellBreadcrumb.superAgentDefaultName"),m="flex min-w-0 items-center gap-0",c="button",d=r,f=a("header.shellBreadcrumb.openAgentHome",{name:u}),e[0]=l?.title,e[1]=r,e[2]=a,e[3]=c,e[4]=d,e[5]=f,e[6]=m,e[7]=u):(c=e[3],d=e[4],f=e[5],m=e[6],u=e[7]);const p=l?.icon??null;let y;e[8]!==p||e[9]!==u?(y=t.jsx(qe,{icon:p,name:u,size:"xs"}),e[8]=p,e[9]=u,e[10]=y):y=e[10];let b;e[11]!==c||e[12]!==d||e[13]!==f||e[14]!==y?(b=t.jsx("button",{type:c,onClick:d,"aria-label":f,className:"flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:y}),e[11]=c,e[12]=d,e[13]=f,e[14]=y,e[15]=b):b=e[15];let g;e[16]!==u?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:u}),e[16]=u,e[17]=g):g=e[17];let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=h):h=e[18];let x;e[19]!==g?(x=t.jsxs("button",{type:"button",className:Do,children:[g,h]}),e[19]=g,e[20]=x):x=e[20];let j;e[21]!==s||e[22]!==o||e[23]!==x?(j=t.jsx(ko,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:o,trigger:x}),e[21]=s,e[22]=o,e[23]=x,e[24]=j):j=e[24];let C;return e[25]!==j||e[26]!==m||e[27]!==b?(C=t.jsxs("div",{className:m,children:[b,j]}),e[25]=j,e[26]=m,e[27]=b,e[28]=C):C=e[28],C}function _r(n){const e=$.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:i}=s,r=G(),{org:o}=le(),{state:a,isMobile:l}=Ut(),c=un().invitations.length>0,d=a==="collapsed"||l;let f;e[2]!==c||e[3]!==o.name||e[4]!==r?(f=c?r("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:o.name}):r("header.shellBreadcrumb.switchOrganization",{name:o.name}),e[2]=c,e[3]=o.name,e[4]=r,e[5]=f):f=e[5];let m;e[6]!==o?(m=t.jsx(Mt,{org:o,size:"sm"}),e[6]=o,e[7]=m):m=e[7];let u;e[8]!==c||e[9]!==d?(u=c&&t.jsx("span",{className:X("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",d?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=c,e[9]=d,e[10]=u):u=e[10];let p;e[11]!==m||e[12]!==u?(p=t.jsxs("span",{className:"relative inline-flex",children:[m,u]}),e[11]=m,e[12]=u,e[13]=p):p=e[13];let y;e[14]!==o.name||e[15]!==i?(y=i&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:o.name}),e[14]=o.name,e[15]=i,e[16]=y):y=e[16];let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=b):b=e[17];let g;e[18]!==f||e[19]!==p||e[20]!==y?(g=t.jsx(Me,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":f,className:"flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[p,y,b]})}),e[18]=f,e[19]=p,e[20]=y,e[21]=g):g=e[21];let h;e[22]!==o.slug||e[23]!==g?(h=t.jsx(oo,{orgParam:o.slug,trigger:g}),e[22]=o.slug,e[23]=g,e[24]=h):h=e[24];let x;e[25]!==o.name?(x=t.jsx(Pe,{side:"bottom",children:o.name}),e[25]=o.name,e[26]=x):x=e[26];let j;return e[27]!==x||e[28]!==h?(j=t.jsxs(Oe,{children:[h,x]}),e[27]=x,e[28]=h,e[29]=j):j=e[29],j}function wr(n){const e=$.c(23);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,{org:r}=le();let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[2]=o):o=e[2];const a=at(o);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[3]=l):l=e[3];const c=lt(l),{threads:d}=ut(),{data:f}=Te.useSession(),{setTaskId:m,createNewTask:u}=ft(),p=Io();let y;e[4]!==r.id?(y=dt(r.id),e[4]=r.id,e[5]=y):y=e[5];const b=y,g=b.id,h=a.taskId?c.virtualmcpid??g:g;let x;e[6]!==u||e[7]!==g||e[8]!==i||e[9]!==p||e[10]!==f?.user?.id||e[11]!==m||e[12]!==d?(x=v=>{const N=v??g,D=os(d,N,f?.user?.id,p(N));D?m(D.id,N):u(N),i?.()},e[6]=u,e[7]=g,e[8]=i,e[9]=p,e[10]=f?.user?.id,e[11]=m,e[12]=d,e[13]=x):x=e[13];const j=x;let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[14]=C):C=e[14];const w=h===g?b:void 0;let I;e[15]!==h||e[16]!==j?(I=()=>j(h),e[15]=h,e[16]=j,e[17]=I):I=e[17];let T;return e[18]!==h||e[19]!==j||e[20]!==w||e[21]!==I?(T=t.jsx(V.Suspense,{fallback:C,children:t.jsx(Ao,{agentId:h,fallback:w,onOpenHome:I,onPick:j})}),e[18]=h,e[19]=j,e[20]=w,e[21]=I,e[22]=T):T=e[22],T}function Nr(){const n=$.c(24),e=G(),{org:s}=le();let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[0]=i):i=n[0];const r=at(i);let o;n[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[1]=o):o=n[1];const a=lt(o),{threads:l}=ut(),{createNewTask:c}=ft();let d;n[2]!==s.id?(d=dt(s.id),n[2]=s.id,n[3]=d):d=n[3];const f=d.id,m=r.taskId?a.virtualmcpid??f:f;let u;n[4]!==r.taskId||n[5]!==l?(u=(r.taskId?l.find(I=>I.id===r.taskId)?.branch:null)??null,n[4]=r.taskId,n[5]=l,n[6]=u):u=n[6];const p=u;let y;n[7]!==m||n[8]!==c||n[9]!==p?(y=()=>{c(m,p)},n[7]=m,n[8]=c,n[9]=p,n[10]=y):y=n[10];const b=y;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let h;n[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(On,{size:16}),n[13]=h):h=n[13];let x;n[14]!==b||n[15]!==g?(x=t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button",onClick:b,"aria-label":g,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:h})}),n[14]=b,n[15]=g,n[16]=x):x=n[16];let j;n[17]!==e?(j=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=j):j=n[18];let C;n[19]!==j?(C=t.jsx(Pe,{side:"bottom",children:j}),n[19]=j,n[20]=C):C=n[20];let w;return n[21]!==x||n[22]!==C?(w=t.jsxs(Oe,{children:[x,C]}),n[21]=x,n[22]=C,n[23]=w):w=n[23],w}function To({open:n,onOpenChange:e,onCreated:s}){const i=G(),{org:r}=le(),{data:o}=Te.useSession(),{stdioEnabled:a}=Nn(),l=Vt(),c=cn(),d=rn(),m=an(d,"").items,u=Sn({resolver:kn(bs),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=u.watch("ui_type"),y=u.watch("connection_url"),b=u.watch("npx_package"),g=Je({uiType:p,connectionUrl:y??"",npxPackage:b??""})??Ft({uiType:p,connectionUrl:y??"",registryItems:m}),h=v=>{const N=v.trim();if(!N)return;const D=!!u.formState.dirtyFields.title,S=!!u.formState.dirtyFields.description,_=!!u.formState.dirtyFields.env_vars,M=A=>{if(A&&(!D&&!u.getValues("title").trim()&&A.title&&u.setValue("title",A.title,{shouldDirty:!1}),!S&&!(u.getValues("description")??"").trim()&&A.description&&u.setValue("description",A.description,{shouldDirty:!1}),!_&&A.envVarKeys?.length)){const F=u.getValues("env_vars")??[],L=new Set(F.map(z=>z.key)),O=A.envVarKeys.filter(z=>!L.has(z));O.length>0&&u.setValue("env_vars",[...F,...O.map(z=>({key:z,value:""}))],{shouldDirty:!0})}},P=js(N);if(P&&a){u.setValue("ui_type","NPX",{shouldDirty:!0}),u.setValue("npx_package",P.packageName,{shouldDirty:!0}),u.setValue("connection_url","",{shouldDirty:!0}),u.setValue("connection_token",null,{shouldDirty:!0}),M(Je({uiType:"NPX",npxPackage:P.packageName}));return}if(N.startsWith("http://")||N.startsWith("https://")){const A=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";u.setValue("ui_type",A,{shouldDirty:!0}),u.setValue("connection_url",N,{shouldDirty:!0}),M(Je({uiType:A,connectionUrl:N})??Ft({uiType:A,connectionUrl:N,registryItems:m}));return}p==="NPX"&&M(Je({uiType:"NPX",npxPackage:N}))},x=v=>{v||u.reset(),e(v)},j=async v=>{let N,D=null,S=null,_=null;v.ui_type==="NPX"?(N="STDIO",D="",_=ys(v.npx_package||"",v.env_vars||[])):v.ui_type==="STDIO"?(N="STDIO",D="",_=Cs(v.stdio_command||"",v.stdio_args||"",v.stdio_cwd,v.env_vars||[])):(N=v.ui_type,D=v.connection_url||"",S=v.connection_token||null);const M=as("conn");try{await c.create.mutateAsync({id:M,title:v.title,description:v.description||null,connection_type:N,connection_url:D,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:o?.user?.id||"system",organization_id:r.id,icon:v.icon??null,app_name:null,app_id:null,connection_headers:_,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),u.reset(),e(!1),s?.(M)}catch{Q.error(i("connections.createConnectionDialog.failedToCreateConnection"))}},C=i("connections.createConnectionDialog.title"),w=i("connections.createConnectionDialog.description"),I=u.formState.isSubmitting?i("connections.createConnectionDialog.saving"):i("connections.createConnectionDialog.createButton"),T=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(pe,{control:u.control,name:"ui_type",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.typeLabel")}),t.jsxs(ms,{value:v.value,onValueChange:v.onChange,children:[t.jsx(ve,{children:t.jsx(gs,{children:t.jsx(hs,{})})}),t.jsxs(ps,{children:[t.jsx(Xe,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.httpType")]})}),t.jsx(Xe,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.sseType")]})}),t.jsx(Xe,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.websocketType")]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(Xe,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(tt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(Xe,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Fn,{className:"w-4 h-4"}),i("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(je,{})]})}),p==="NPX"&&t.jsx(pe,{control:u.control,name:"npx_package",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.npmPackagePlaceholder"),...v,value:v.value??"",onPaste:N=>{const D=N.clipboardData.getData("text");D&&(N.preventDefault(),u.setValue("npx_package",D.trim(),{shouldDirty:!0}),h(D))},onBlur:N=>{h(N.target.value),v.onBlur()}})}),t.jsx(je,{})]})}),p==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(pe,{control:u.control,name:"stdio_command",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.commandLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.commandPlaceholder"),...v,value:v.value??""})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"stdio_args",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.argumentsLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.argumentsPlaceholder"),...v,value:v.value??""})}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"stdio_cwd",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.workingDirectoryPlaceholder"),...v,value:v.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(je,{})]})})]}),(p==="NPX"||p==="STDIO")&&t.jsx(pe,{control:u.control,name:"env_vars",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(ve,{children:t.jsx(vs,{value:v.value??[],onChange:v.onChange})}),t.jsx(je,{})]})}),p!=="NPX"&&p!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(pe,{control:u.control,name:"connection_url",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.urlLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.urlPlaceholder"),...v,value:v.value??"",onPaste:N=>{const D=N.clipboardData.getData("text");D&&(N.preventDefault(),u.setValue("connection_url",D.trim(),{shouldDirty:!0}),h(D))},onBlur:N=>{h(N.target.value),v.onBlur()}})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"connection_token",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:g?.token?.label??i("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(ve,{children:t.jsx(Le,{type:"password",placeholder:g?.token?.placeholder??i("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...v,value:v.value??""})}),g?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:i("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"title",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.nameLabel")}),t.jsx(ve,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.namePlaceholder"),...v})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"description",render:({field:v})=>t.jsxs(xe,{children:[t.jsx(be,{children:i("connections.createConnectionDialog.descriptionLabel")}),t.jsx(ve,{children:t.jsx(xs,{placeholder:i("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...v,value:v.value??""})}),t.jsx(je,{})]})})]});return l?t.jsx(en,{open:n,onOpenChange:x,children:t.jsxs(tn,{className:"max-h-[90vh]",children:[t.jsx(Hn,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(nn,{children:C}),t.jsx(Vn,{className:"mt-1",children:w})]}),t.jsx(Un,{asChild:!0,children:t.jsx(ye,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Zt,{size:16})})})]})}),t.jsx(Ot,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:T}),t.jsx(qn,{children:t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"w-full",children:I})})]})})]})}):t.jsx(It,{open:n,onOpenChange:x,children:t.jsxs(Dt,{className:"sm:max-w-[525px]",children:[t.jsxs(At,{children:[t.jsx(Tt,{children:C}),t.jsx(ln,{children:w})]}),t.jsx(Ot,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"py-4",children:T}),t.jsxs(fs,{children:[t.jsx(ye,{type:"button",variant:"outline",onClick:()=>x(!1),children:i("connections.createConnectionDialog.cancelButton")}),t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"min-w-40",children:I})]})]})})]})})}function Mo(n){const e=$.c(72),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:l,connectingItemId:c,search:d,onCreateConnection:f,onBrowseNavigate:m,defaultTab:u}=n,p=s===void 0?"add":s,y=u===void 0?"connected":u,b=G(),{org:g}=le(),h=V.useDeferredValue(d),x=d!==h;let j;e[0]!==h?(j=h.trim().toLowerCase(),e[0]=h,e[1]=j):j=e[1];const C=j;let w;e[2]!==y?(w=k=>k??y,e[2]=y,e[3]=w):w=e[3];const[I,T]=Ct(In.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),w);let v;e[4]!==I||e[5]!==T?(v=k=>{k!==I&&K("connections_dialog_tab_changed",{to_tab:k}),T(k)},e[4]=I,e[5]=T,e[6]=v):v=e[6];const N=v;let D;e[7]!==g.id||e[8]!==g.slug?(D={connectionId:Xt,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=D):D=e[9];const S=Ss(D),_=h?.trim().split(/\s+/).filter(Boolean)??[],M=_.length>0?{operator:"or",conditions:_.flatMap(Eo)}:void 0,P={...M&&{where:M},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(P),{data:F,fetchNextPage:L,hasNextPage:O,isFetchingNextPage:z}=Ns({queryKey:Ue.collectionListInfinite(S,g.id,"","CONNECTIONS",A),queryFn:async k=>{const{pageParam:B}=k,Z=B===void 0?0:B;return(await S.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...M&&{where:M},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Z}})).structuredContent},initialPageParam:0,getNextPageParam:Lo,staleTime:3e4}),U=F?.pages.flatMap(zo)??[],R=us(U),q=new Set(U.filter($o).map(Fo)),E=rn(),Y=an(E,h),ee=$t(Y.loadMore,Y.hasMore,Y.isLoadingMore),te=$t(L,O??!1,z),H=I==="all"||!!C,J=H?Y.items.filter(k=>{const B=ls(k);if(B&&q.has(B))return!1;if(!C)return!0;const Z=ot(k._meta),ue=[k.title,k.description,k.name,k.server?.title,k.server?.description,k.server?.name,Z?.friendly_name,Z?.friendlyName].filter(Boolean).join(" ").toLowerCase();return _.some(he=>ue.includes(he.toLowerCase()))}):[],ne=J.filter(Oo),W=J.filter(Po);let Ne;e[10]!==r?(Ne=k=>k.some(B=>r.has(B.id)),e[10]=r,e[11]=Ne):Ne=e[11];const Be=Ne;let Ce;e[12]!==r||e[13]!==i||e[14]!==c||e[15]!==Be||e[16]!==p||e[17]!==o||e[18]!==m||e[19]!==a||e[20]!==b?(Ce=(k,B,Z,ue,he)=>{const Ye=Be(he),Ge=he.find(ze=>!r.has(ze.id)),ce=he[0];if(p==="browse"){const ze=_s(ce);return t.jsx(ht,{connection:{title:B,icon:Z,description:he.length>1?`${he.length} instances`:ue??void 0},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",b("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{K("connection_browse_clicked",{app_name:ce.app_name??null,connection_id:ce.id,instances_count:he.length}),m?.(ze)}},k)}return t.jsx(ht,{connection:{title:B,icon:Z,description:ue},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Ye&&t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",b("virtualMcp.connectionDialogContent.added")]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),Ge?(K("connection_add_clicked",{action:"use_existing",app_name:ce.app_name??null,connection_id:Ge.id}),i&&K("agent_connection_attached",{agent_id:i,connection_id:Ge.id,app_name:ce.app_name??null,mode:"existing"}),o(Ge.id)):(K("connection_add_clicked",{action:"clone",app_name:ce.app_name??null,base_connection_id:ce.id}),a(ce))},children:b("virtualMcp.connectionDialogContent.add")})]})},k)},e[12]=r,e[13]=i,e[14]=c,e[15]=Be,e[16]=p,e[17]=o,e[18]=m,e[19]=a,e[20]=b,e[21]=Ce):Ce=e[21];const Ee=Ce;let _e;e[22]!==c||e[23]!==p||e[24]!==l||e[25]!==b?(_e=k=>{const B=ot(k._meta),Z=B?.friendlyName||B?.friendly_name||k.server?.title||k.title||k.server?.name||k.name||k.id||"",ue=k.server?.description||k.description||null,he=k.server?.icons?.[0]?.src||cs(k.server?.repository)||null,Ye=B?.official===!0,Ge=B?.verified===!0,ce=B?.owner==="deco";return t.jsx(ht,{connection:{title:Z,description:ue,icon:he},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[ce&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:t.jsx("img",{src:"/logos/deco logo.svg",alt:b("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(Pe,{children:b("virtualMcp.connectionDialogContent.builtByDeco")})]}),!ce&&Ye&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:b("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!ce&&!Ye&&Ge&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:b("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),K("connection_add_clicked",{action:"connect_new",registry_item_id:k.id,app_name:B?.friendlyName||k.server?.name||k.name||null}),l(k)},children:c===k.id?t.jsx(Ve,{size:14,className:"animate-spin"}):b(p==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${k.id}`)},e[22]=c,e[23]=p,e[24]=l,e[25]=b,e[26]=_e):_e=e[26];const We=_e;let se;e[27]!==I||e[28]!==N||e[29]!==f||e[30]!==C||e[31]!==b?(se=!C&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(ws,{tabs:[{id:"all",label:b("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:b("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:I,onTabChange:k=>N(k)}),t.jsxs(ye,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{K("connections_dialog_custom_clicked"),f()},children:[t.jsx(Ke,{size:12}),b("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=I,e[28]=N,e[29]=f,e[30]=C,e[31]=b,e[32]=se):se=e[32];const Se=x&&"opacity-50 pointer-events-none";let oe;e[33]!==Se?(oe=X("flex-1 overflow-auto p-5 transition-opacity duration-150",Se),e[33]=Se,e[34]=oe):oe=e[34];const Re="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ke;e[35]!==Ee?(ke=k=>{if(k.type==="group")return Ee(k.key,k.title,k.icon,null,k.connections);const B=k.connection;return Ee(B.id,B.title,B.icon,B.description??null,[B])},e[35]=Ee,e[36]=ke):ke=e[36];const Ie=R.map(ke);let fe;e[37]!==te?(fe=t.jsx("div",{ref:te,className:"col-span-full h-1"}),e[37]=te,e[38]=fe):fe=e[38];let de;e[39]!==z?(de=z&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=z,e[40]=de):de=e[40];const Fe=H&&ne.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(pt,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:b("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),De=H&&ne.map(We),$e=H&&W.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:b("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ae=H&&W.map(We);let me;e[41]!==ee||e[42]!==E||e[43]!==H?(me=H&&E.length>0&&t.jsx("div",{ref:ee,className:"col-span-full h-1"}),e[41]=ee,e[42]=E,e[43]=H,e[44]=me):me=e[44];let ie;e[45]!==Y.isLoadingMore||e[46]!==H?(ie=H&&Y.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=Y.isLoadingMore,e[46]=H,e[47]=ie):ie=e[47];let ge;e[48]!==Ie||e[49]!==fe||e[50]!==de||e[51]!==Fe||e[52]!==De||e[53]!==$e||e[54]!==Ae||e[55]!==me||e[56]!==ie?(ge=t.jsxs("div",{className:Re,children:[Ie,fe,de,Fe,De,$e,Ae,me,ie]}),e[48]=Ie,e[49]=fe,e[50]=de,e[51]=Fe,e[52]=De,e[53]=$e,e[54]=Ae,e[55]=me,e[56]=ie,e[57]=ge):ge=e[57];let re;e[58]!==I||e[59]!==R.length||e[60]!==W||e[61]!==d||e[62]!==b||e[63]!==ne?(re=R.length===0&&ne.length===0&&W.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:d?b("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:d}):b(I==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=I,e[59]=R.length,e[60]=W,e[61]=d,e[62]=b,e[63]=ne,e[64]=re):re=e[64];let ae;e[65]!==oe||e[66]!==ge||e[67]!==re?(ae=t.jsxs("div",{className:oe,children:[ge,re]}),e[65]=oe,e[66]=ge,e[67]=re,e[68]=ae):ae=e[68];let we;return e[69]!==se||e[70]!==ae?(we=t.jsxs(t.Fragment,{children:[se,ae]}),e[69]=se,e[70]=ae,e[71]=we):we=e[71],we}function Po(n){return!n.verified&&!ot(n._meta)?.verified&&!n.meta?.verified}function Oo(n){return n.verified||ot(n._meta)?.verified||n.meta?.verified}function Fo(n){return n.app_name}function $o(n){return n.app_name}function zo(n){return n?.items??[]}function Lo(n,e){if(n?.hasMore)return e.reduce(Bo,0)}function Bo(n,e){return n+(e?.items?.length??0)}function Eo(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Sr({open:n,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=G(),a=r.mode??"add",l="agentId"in r?r.agentId:void 0,c="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,d="onAdd"in r&&r.onAdd?r.onAdd:S=>{},f=(S,_,M)=>{l&&K("agent_connection_attached",{agent_id:l,connection_id:S,app_name:_,mode:M})},[m,u]=V.useState(null),[p,y]=V.useState(i),[b,g]=V.useState(!1),{org:h}=le(),{data:x}=Te.useSession(),j=cn(),C=Dn(),w=rt(),I=S=>{e(!1),w({to:"/$org/settings/connections/$appSlug",params:{org:h.slug,appSlug:S}})},T=()=>{C.invalidateQueries({predicate:S=>{const _=S.queryKey;return _[1]===h.id&&_[3]==="collection"&&_[4]==="CONNECTIONS"}})},v=async(S,_)=>{K("connection_oauth_succeeded",{connection_id:S,flow:_});const M=new URL(`/api/${h.slug}/mcp/${S}`,window.location.origin);await C.invalidateQueries({queryKey:Ue.isMCPAuthenticated(M.href,null)}),T()},N=async S=>{u(S.app_name??S.id);try{const M=`${S.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await j.create.mutateAsync({title:M,description:S.description??null,connection_type:S.connection_type,connection_url:S.connection_url??null,connection_token:null,icon:S.icon??null,app_name:S.app_name??null,app_id:S.app_id??null,connection_headers:S.connection_headers??null})).id,F=await xt({connectionId:A,orgId:h.id,orgSlug:h.slug,persistFallback:L=>j.update.mutateAsync({id:A,data:{connection_token:L}}).then(()=>{})});if(F.ran&&!F.ok){K("connection_oauth_failed",{connection_id:A,flow:"clone",error:F.error??"no_token"}),Q.error(o("virtualMcp.addConnectionDialog.authenticationFailedError",{error:F.error??"no token received"})),await j.delete.mutateAsync(A);return}F.ran&&await v(A,"clone"),f(A,S.app_name??null,"clone"),d(A)}catch(_){console.error("Failed to add connection:",_),Q.error(o("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{u(null)}},D=async S=>{if(!(!h||!x?.user?.id)){u(S.id);try{const _=ds(S,h.id,x.user.id,{remoteIndex:0}),M=_.connection_type==="STDIO",P=!!_.connection_url,A=M&&_.connection_headers&&typeof _.connection_headers=="object"&&"command"in _.connection_headers;if(!P&&!A){Q.error(o("virtualMcp.addConnectionDialog.mcpServerConnectionError")),u(null);return}const{id:F}=await j.create.mutateAsync(_),L=await xt({connectionId:F,orgId:h.id,orgSlug:h.slug,persistFallback:O=>j.update.mutateAsync({id:F,data:{connection_token:O}}).then(()=>{})});if(L.ran&&!L.ok){K("connection_oauth_failed",{connection_id:F,flow:"connect_new",error:L.error??"no_token"}),Q.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:L.error??"no token received"})}),f(F,_.app_name??null,"new"),d(F);return}L.ran?(await v(F,"connect_new"),Q.success(o("virtualMcp.addConnectionDialog.connectedAuthenticated"))):Q.success(o("virtualMcp.addConnectionDialog.connected")),f(F,_.app_name??null,"new"),d(F)}catch(_){console.error("Failed to connect:",_),Q.error(o("virtualMcp.addConnectionDialog.failedToConnect"))}finally{u(null)}}};return t.jsxs(It,{open:n,onOpenChange:e,children:[t.jsxs(Dt,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(At,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx(Tt,{className:"text-base font-semibold",children:o(a==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(rs,{value:p,onChange:y,placeholder:o("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Mo,{mode:a,agentId:l,addedConnectionIds:c,onAdd:d,onCloneAndAdd:N,onConnectAndAdd:D,connectingItemId:m,search:p,onCreateConnection:()=>g(!0),onBrowseNavigate:I,defaultTab:s})})]}),t.jsx(To,{open:b,onOpenChange:g,onCreated:async S=>{g(!1);const _=await xt({connectionId:S,orgId:h.id,orgSlug:h.slug,persistFallback:M=>j.update.mutateAsync({id:S,data:{connection_token:M}}).then(()=>{})});if(_.ran&&!_.ok){K("connection_oauth_failed",{connection_id:S,flow:"custom_create",error:_.error??"no_token"}),Q.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:_.error??"no token received"})}),f(S,null,"custom"),d(S),e(!1);return}_.ran&&await v(S,"custom_create"),f(S,null,"custom"),d(S),e(!1)}})]})}const Lt=new Map;function kr(){const{org:n}=le(),e=ct(),s=ks(),i=s.find(g=>g.providerId==="deco"),{data:r,isLoading:o,refetch:a,isFetching:l}=He({queryKey:Ue.aiProviderCredits(n.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),c=r?.balanceCents??null,d=c!=null?c/100:null,f=V.useRef(new Map);if(c!=null){const g=Lt.get(n.id);f.current.get(n.id)&&g!=null&&c>g&&K("credits_topped_up_detected",{organization_id:n.id,delta_cents:c-g,previous_balance_cents:g,new_balance_cents:c}),Lt.set(n.id,c),f.current.set(n.id,!0)}const m=!!i,u=c!=null&&c>0,p=c!=null&&c===0,y=c!=null&&c===200,b=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:m,decoKeyId:i?.id??null,balanceCents:c,balanceDollars:d,hasCredits:u,isZeroBalance:p,isInitialFreeCredit:y,hasOnlyDecoProvider:b,isLoading:o,isFetching:l,refetch:a}}function vt(n){const e=$.c(13),{label:s,value:i,onChange:r,options:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==r?(l=m=>m&&r(m),e[2]=r,e[3]=l):l=e[3];let c;e[4]!==o?(c=o.map(Ro),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==c||e[8]!==i?(d=t.jsx(As,{type:"single",size:"sm",value:i,onValueChange:l,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=l,e[7]=c,e[8]=i,e[9]=d):d=e[9];let f;return e[10]!==a||e[11]!==d?(f=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,d]}),e[10]=a,e[11]=d,e[12]=f):f=e[12],f}function Ro(n){return t.jsxs(Ds,{value:n.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[n.icon,n.label]},n.value)}function Ir(n){const e=$.c(91),{panel:s,className:i}=n,r=i===void 0?"md:size-[34px] rounded-lg":i,o=G();let a;e[0]!==o?(a=o("sidebar.taskGroupsList.filterChats"),e[0]=o,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Is,{size:16}),e[2]=l):l=e[2];let c;e[3]!==s.filtersActive?(c=s.filtersActive&&t.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"}),e[3]=s.filtersActive,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==s.filtersActive||e[7]!==a||e[8]!==c?(d=t.jsx(Me,{asChild:!0,children:t.jsx(Qe,{asChild:!0,children:t.jsxs(kt,{"aria-label":a,active:s.filtersActive,className:r,children:[l,c]})})}),e[5]=r,e[6]=s.filtersActive,e[7]=a,e[8]=c,e[9]=d):d=e[9];let f;e[10]!==o?(f=o("sidebar.taskGroupsList.filterChats"),e[10]=o,e[11]=f):f=e[11];let m;e[12]!==f?(m=t.jsx(Pe,{side:"bottom",children:f}),e[12]=f,e[13]=m):m=e[13];let u;e[14]!==d||e[15]!==m?(u=t.jsxs(Oe,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=u):u=e[16];let p;e[17]!==o?(p=o("sidebar.taskGroupsList.filterView"),e[17]=o,e[18]=p):p=e[18];const y=s.groupBy;let b;e[19]!==s?(b=W=>{K("tasks_panel_group_by_changed",{to_value:W}),s.setGroupBy(W)},e[19]=s,e[20]=b):b=e[20];let g;e[21]!==o?(g=o("sidebar.taskGroupsList.viewList"),e[21]=o,e[22]=g):g=e[22];let h;e[23]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx($n,{size:13}),e[23]=h):h=e[23];let x;e[24]!==g?(x={value:"flat",label:g,icon:h},e[24]=g,e[25]=x):x=e[25];let j;e[26]!==o?(j=o("sidebar.taskGroupsList.viewStatus"),e[26]=o,e[27]=j):j=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(zn,{size:13}),e[28]=C):C=e[28];let w;e[29]!==j?(w={value:"status",label:j,icon:C},e[29]=j,e[30]=w):w=e[30];let I;e[31]!==x||e[32]!==w?(I=[x,w],e[31]=x,e[32]=w,e[33]=I):I=e[33];let T;e[34]!==s.groupBy||e[35]!==b||e[36]!==I||e[37]!==p?(T=t.jsx(vt,{label:p,value:y,onChange:b,options:I}),e[34]=s.groupBy,e[35]=b,e[36]=I,e[37]=p,e[38]=T):T=e[38];let v;e[39]!==o?(v=o("sidebar.taskGroupsList.filterType"),e[39]=o,e[40]=v):v=e[40];const N=s.typeFilter;let D;e[41]!==s?(D=W=>{K("tasks_panel_filter_changed",{to_value:W}),s.setTypeFilter(W)},e[41]=s,e[42]=D):D=e[42];let S;e[43]!==o?(S=o("sidebar.taskGroupsList.typeAll"),e[43]=o,e[44]=S):S=e[44];let _;e[45]!==S?(_={value:"all",label:S},e[45]=S,e[46]=_):_=e[46];let M;e[47]!==o?(M=o("sidebar.taskGroupsList.typeChats"),e[47]=o,e[48]=M):M=e[48];let P;e[49]!==M?(P={value:"manual",label:M},e[49]=M,e[50]=P):P=e[50];let A;e[51]!==o?(A=o("sidebar.taskGroupsList.typeAuto"),e[51]=o,e[52]=A):A=e[52];let F;e[53]!==A?(F={value:"automation",label:A},e[53]=A,e[54]=F):F=e[54];let L;e[55]!==_||e[56]!==P||e[57]!==F?(L=[_,P,F],e[55]=_,e[56]=P,e[57]=F,e[58]=L):L=e[58];let O;e[59]!==s.typeFilter||e[60]!==v||e[61]!==D||e[62]!==L?(O=t.jsx(vt,{label:v,value:N,onChange:D,options:L}),e[59]=s.typeFilter,e[60]=v,e[61]=D,e[62]=L,e[63]=O):O=e[63];let z;e[64]!==o?(z=o("sidebar.taskGroupsList.filterScope"),e[64]=o,e[65]=z):z=e[65];const U=s.showAll?"team":"mine";let R;e[66]!==s?(R=W=>s.setShowAll(W==="team"),e[66]=s,e[67]=R):R=e[67];let q;e[68]!==o?(q=o("sidebar.taskGroupsList.scopeMine"),e[68]=o,e[69]=q):q=e[69];let E;e[70]!==q?(E={value:"mine",label:q},e[70]=q,e[71]=E):E=e[71];let Y;e[72]!==o?(Y=o("sidebar.taskGroupsList.scopeTeam"),e[72]=o,e[73]=Y):Y=e[73];let ee;e[74]!==Y?(ee={value:"team",label:Y},e[74]=Y,e[75]=ee):ee=e[75];let te;e[76]!==E||e[77]!==ee?(te=[E,ee],e[76]=E,e[77]=ee,e[78]=te):te=e[78];let H;e[79]!==z||e[80]!==U||e[81]!==R||e[82]!==te?(H=t.jsx(vt,{label:z,value:U,onChange:R,options:te}),e[79]=z,e[80]=U,e[81]=R,e[82]=te,e[83]=H):H=e[83];let J;e[84]!==T||e[85]!==O||e[86]!==H?(J=t.jsxs(Nt,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[T,O,H]}),e[84]=T,e[85]=O,e[86]=H,e[87]=J):J=e[87];let ne;return e[88]!==J||e[89]!==u?(ne=t.jsxs(St,{children:[u,J]}),e[88]=J,e[89]=u,e[90]=ne):ne=e[90],ne}function Go(n){const e=$.c(9),{virtualMcpId:s,size:i,showAutomationBadge:r}=n,o=i===void 0?"sm":i,a=G();let l;e[0]!==o||e[1]!==s?(l=s?t.jsx(Ho,{virtualMcpId:s,size:o}):t.jsx(qe,{icon:null,name:"?",size:o}),e[0]=o,e[1]=s,e[2]=l):l=e[2];let c;e[3]!==r||e[4]!==a?(c=r&&t.jsx("span",{"aria-label":a("tasksPanel.mcpAvatar.automationTriggered"),className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:t.jsx(dn,{size:10,className:"text-white"})}),e[3]=r,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=t.jsxs("div",{className:"relative shrink-0",children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function Ho(n){const e=$.c(6),{virtualMcpId:s,size:i}=n,r=wt(s);if(!r){let l;return e[0]!==i?(l=t.jsx(qe,{icon:null,name:"?",size:i}),e[0]=i,e[1]=l):l=e[1],l}const o=r.icon??null;let a;return e[2]!==r.title||e[3]!==i||e[4]!==o?(a=t.jsx(qe,{icon:o,name:r.title,size:i}),e[2]=r.title,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function Vo(n){const e=$.c(51),{open:s,onOpenChange:i}=n,[r,o]=V.useState(""),{org:a}=le(),{setTaskId:l}=ft(),c=ct(),d=G();let f,m,u;e[0]!==a.id||e[1]!==r?(u=r.trim(),m=He,f=Ue.globalSearch(a.id,u),e[0]=a.id,e[1]=r,e[2]=f,e[3]=m,e[4]=u):(f=e[2],m=e[3],u=e[4]);let p;e[5]!==c||e[6]!==u?(p=async()=>await c.call("GLOBAL_SEARCH",{query:u,limit:u?20:10}),e[5]=c,e[6]=u,e[7]=p):p=e[7];let y;e[8]!==s||e[9]!==f||e[10]!==p?(y={queryKey:f,enabled:s,queryFn:p,staleTime:1e4},e[8]=s,e[9]=f,e[10]=p,e[11]=y):y=e[11];const{data:b,isFetching:g}=m(y);let h;e[12]!==b?.items?(h=b?.items??[],e[12]=b?.items,e[13]=h):h=e[13];const x=h;let j;e[14]!==i?(j=O=>{O||o(""),i(O)},e[14]=i,e[15]=j):j=e[15];const C=j;let w;e[16]!==C||e[17]!==l?(w=O=>{C(!1),l(O.id,O.virtual_mcp_id??void 0)},e[16]=C,e[17]=l,e[18]=w):w=e[18];const I=w;let T;e[19]!==d?(T=d("tasksPanel.globalSearchDialog.title"),e[19]=d,e[20]=T):T=e[20];let v;e[21]!==T?(v=t.jsx(Tt,{children:T}),e[21]=T,e[22]=v):v=e[22];let N;e[23]!==d?(N=d("tasksPanel.globalSearchDialog.description"),e[23]=d,e[24]=N):N=e[24];let D;e[25]!==N?(D=t.jsx(ln,{children:N}),e[25]=N,e[26]=D):D=e[26];let S;e[27]!==D||e[28]!==v?(S=t.jsxs(At,{className:"sr-only",children:[v,D]}),e[27]=D,e[28]=v,e[29]=S):S=e[29];let _;e[30]!==d?(_=d("tasksPanel.globalSearchDialog.placeholder"),e[30]=d,e[31]=_):_=e[31];let M;e[32]!==r||e[33]!==_?(M=t.jsx(Fs,{value:r,onValueChange:o,placeholder:_}),e[32]=r,e[33]=_,e[34]=M):M=e[34];let P;e[35]!==I||e[36]!==g||e[37]!==x||e[38]!==d||e[39]!==u?(P=t.jsx(Ts,{children:g&&x.length===0?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):x.length===0?t.jsx(Ms,{children:d("tasksPanel.globalSearchDialog.noResults")}):t.jsx(Ps,{heading:u?void 0:d("tasksPanel.globalSearchDialog.recent"),children:x.map(O=>O.type==="thread"?t.jsxs(Os,{value:`thread:${O.id}:${O.title}`,onSelect:()=>I(O),className:"gap-2.5",children:[t.jsx(Go,{virtualMcpId:O.virtual_mcp_id,size:"xs"}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("div",{className:"text-sm text-foreground truncate",children:O.title||d("tasksPanel.globalSearchDialog.untitledChat")})}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(O.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${O.id}`):null)})}),e[35]=I,e[36]=g,e[37]=x,e[38]=d,e[39]=u,e[40]=P):P=e[40];let A;e[41]!==M||e[42]!==P?(A=t.jsxs($s,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[M,P]}),e[41]=M,e[42]=P,e[43]=A):A=e[43];let F;e[44]!==S||e[45]!==A?(F=t.jsxs(Dt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[S,A]}),e[44]=S,e[45]=A,e[46]=F):F=e[46];let L;return e[47]!==C||e[48]!==s||e[49]!==F?(L=t.jsx(It,{open:s,onOpenChange:C,children:F}),e[47]=C,e[48]=s,e[49]=F,e[50]=L):L=e[50],L}function Uo(n){const e=$.c(43),{branch:s,onOutcome:i}=n,r=G();let o;e[0]!==i?(o=T=>{T||i("cancel")},e[0]=i,e[1]=o):o=e[1];let a;e[2]!==r?(a=r("sidebar.archiveWorktreeDialog.title"),e[2]=r,e[3]=a):a=e[3];let l;e[4]!==a?(l=t.jsx(zs,{children:a}),e[4]=a,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("sidebar.archiveWorktreeDialog.stopsAndDeletesBefore"),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==s?(d=t.jsx("span",{className:"font-mono",children:s}),e[8]=s,e[9]=d):d=e[9];let f;e[10]!==r?(f=r("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=r,e[11]=f):f=e[11];let m;e[12]!==c||e[13]!==d||e[14]!==f?(m=t.jsxs(Ls,{children:[c," ",d," ",f]}),e[12]=c,e[13]=d,e[14]=f,e[15]=m):m=e[15];let u;e[16]!==l||e[17]!==m?(u=t.jsxs(Bs,{children:[l,m]}),e[16]=l,e[17]=m,e[18]=u):u=e[18];let p;e[19]!==i?(p=()=>i("cancel"),e[19]=i,e[20]=p):p=e[20];let y;e[21]!==r?(y=r("sidebar.archiveWorktreeDialog.cancel"),e[21]=r,e[22]=y):y=e[22];let b;e[23]!==y||e[24]!==p?(b=t.jsx(Es,{onClick:p,children:y}),e[23]=y,e[24]=p,e[25]=b):b=e[25];let g;e[26]===Symbol.for("react.memo_cache_sentinel")?(g=X(An({variant:"destructive"})),e[26]=g):g=e[26];let h;e[27]!==i?(h=()=>i("confirm"),e[27]=i,e[28]=h):h=e[28];let x;e[29]!==r?(x=r("sidebar.archiveWorktreeDialog.confirm"),e[29]=r,e[30]=x):x=e[30];let j;e[31]!==h||e[32]!==x?(j=t.jsx(Rs,{className:g,onClick:h,children:x}),e[31]=h,e[32]=x,e[33]=j):j=e[33];let C;e[34]!==b||e[35]!==j?(C=t.jsxs(Gs,{children:[b,j]}),e[34]=b,e[35]=j,e[36]=C):C=e[36];let w;e[37]!==C||e[38]!==u?(w=t.jsxs(Hs,{children:[u,C]}),e[37]=C,e[38]=u,e[39]=w):w=e[39];let I;return e[40]!==o||e[41]!==w?(I=t.jsx(Vs,{open:!0,onOpenChange:o,children:w}),e[40]=o,e[41]=w,e[42]=I):I=e[42],I}function qo(n,e,s){if(!s)return;const i=n.findIndex(r=>r.id===e);if(i!==-1){for(let r=i+1;r<n.length;r++){const o=n[r];if(o?.created_by===s)return o}for(let r=i-1;r>=0;r--){const o=n[r];if(o?.created_by===s)return o}}}function Ko(n){return n==="ephemeral"||n.startsWith("thread:")}function mn(n){const e=$.c(45),{task:s,isActive:i,onClick:r,onArchive:o,showAutomationBadge:a,showAgentIcon:l,hideStatusIdle:c,indented:d}=n,f=G(),m=qs(s.status),u=m.icon,p=s.metadata?.kind==="tool_call_run",y=wt(p?void 0:s.virtual_mcp_id);let b;e[0]!==y?(b=ns(y),e[0]=y,e[1]=b):b=e[1];const g=b;Ks(6e4);const h=a||!!s.trigger_id,x=s.id,j="button",C=0;let w;e[2]!==r?(w=R=>{R.target===R.currentTarget&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),r())},e[2]=r,e[3]=w):w=e[3];const I=d?"-ml-4 pl-6":"pl-[7px]",T=i?"bg-accent text-accent-foreground":"hover:bg-accent/60";let v;e[4]!==I||e[5]!==T?(v=X("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",I,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",T),e[4]=I,e[5]=T,e[6]=v):v=e[6];let N;e[7]!==p||e[8]!==l||e[9]!==y?.icon||e[10]!==y?.title?(N=l&&!p&&t.jsx(qe,{icon:y?.icon??null,name:y?.title??"?",size:"2xs"}),e[7]=p,e[8]=l,e[9]=y?.icon,e[10]=y?.title,e[11]=N):N=e[11];let D;e[12]!==h||e[13]!==f?(D=h&&t.jsx(dn,{size:12,"aria-label":f("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=h,e[13]=f,e[14]=D):D=e[14];let S;e[15]!==f||e[16]!==s.title?(S=s.title||f("tasksPanel.taskRow.untitledTask"),e[15]=f,e[16]=s.title,e[17]=S):S=e[17];let _;e[18]!==S?(_=t.jsx("div",{className:"text-sm text-foreground truncate",children:S}),e[18]=S,e[19]=_):_=e[19];let M;e[20]!==D||e[21]!==_?(M=t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[D,_]}),e[20]=D,e[21]=_,e[22]=M):M=e[22];let P;e[23]!==g||e[24]!==i||e[25]!==s.branch||e[26]!==s.updated_at?(P=s.updated_at&&t.jsxs("div",{className:X("flex items-center gap-1 text-[11px] min-w-0",i?"text-accent-foreground/70":"text-muted-foreground/60"),children:[s.branch&&!Ko(s.branch)?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate font-mono",children:s.branch}),t.jsx("span",{className:"shrink-0",children:"·"})]}):g?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"truncate",children:[g.owner,"/",g.name]}),t.jsx("span",{className:"shrink-0",children:"·"})]}):null,t.jsx("span",{className:"shrink-0",children:Xs(new Date(s.updated_at))})]}),e[23]=g,e[24]=i,e[25]=s.branch,e[26]=s.updated_at,e[27]=P):P=e[27];let A;e[28]!==M||e[29]!==P?(A=t.jsxs("div",{className:"flex-1 min-w-0",children:[M,P]}),e[28]=M,e[29]=P,e[30]=A):A=e[30];const F="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",L=!c&&t.jsx("span",{className:X("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",o&&"group-hover/row:opacity-0"),"aria-label":f("tasksPanel.taskRow.statusLabel",{status:m.label}),children:t.jsx(u,{size:14,className:X(m.iconClassName,s.status==="in_progress"&&"animate-spin")})});let O;e[31]!==o||e[32]!==f?(O=o&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":f("tasksPanel.taskRow.archiveTask"),onClick:R=>{R.stopPropagation(),o()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:t.jsx(Tn,{size:14})})}),t.jsx(Pe,{side:"right",children:f("tasksPanel.taskRow.archive")})]}),e[31]=o,e[32]=f,e[33]=O):O=e[33];let z;e[34]!==L||e[35]!==O?(z=t.jsxs("div",{className:F,children:[L,O]}),e[34]=L,e[35]=O,e[36]=z):z=e[36];let U;return e[37]!==r||e[38]!==A||e[39]!==z||e[40]!==w||e[41]!==v||e[42]!==N||e[43]!==s.id?(U=t.jsxs("div",{"data-task-id":x,role:j,tabIndex:C,onClick:r,onKeyDown:w,className:v,children:[N,A,z]}),e[37]=r,e[38]=A,e[39]=z,e[40]=w,e[41]=v,e[42]=N,e[43]=s.id,e[44]=U):U=e[44],U}const Bt=["requires_action","in_progress","failed","expired","completed"];function Wo(n){const e=new Map(Bt.map(s=>[s,[]]));for(const s of n){const i=s.status??"completed";(e.get(i)??e.get("completed")).push(s)}return Bt.map(s=>({status:s,threads:e.get(s)}))}const Xo="sidebar.group.expanded.";function Qo(n,e){const s=$.c(3),[i,r]=Ct(`${Xo}${n}`,e);let o;return s[0]!==i||s[1]!==r?(o=[i,r],s[0]=i,s[1]=r,s[2]=o):o=s[2],o}function gn(n){const e=$.c(18),{onClick:s,isFetching:i,indented:r}=n,o=G();let a;e[0]!==o?(a=o("sidebar.showMoreButton.ariaLabel"),e[0]=o,e[1]=a):a=e[1];const l=r?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==l?(c=X("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==i?(d=i&&t.jsx(Ve,{size:14,className:"animate-spin"}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==i||e[7]!==o?(f=o(i?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=i,e[7]=o,e[8]=f):f=e[8];let m;e[9]!==f?(m=t.jsx("span",{children:f}),e[9]=f,e[10]=m):m=e[10];let u;return e[11]!==i||e[12]!==s||e[13]!==a||e[14]!==c||e[15]!==d||e[16]!==m?(u=t.jsxs("button",{type:"button","aria-label":a,onClick:s,disabled:i,className:c,children:[d,m]}),e[11]=i,e[12]=s,e[13]=a,e[14]=c,e[15]=d,e[16]=m,e[17]=u):u=e[17],u}function Yo(n,e,s,i){return[n,e,s,i.type,i.member,i.currentUserId??""].join("|")}function Jo(n){return n.member==="mine"&&!n.currentUserId}const hn=4;let nt=0;const yt=[];function Zo(){for(;nt<hn&&yt.length>0;){const n=yt.shift();n&&n()}}function pn(n){return new Promise((e,s)=>{const i=()=>{nt++,n().then(e,s).finally(()=>{nt--,Zo()})};nt<hn?i():yt.push(i)})}const mt=10;function Et(n,e,s,i,r){const o={hidden:!1};i.member==="mine"&&i.currentUserId&&(o.created_by=i.currentUserId),i.type==="automation"&&(o.has_trigger=!0),i.type==="manual"&&(o.has_trigger=!1);const a={where:o,limit:r,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function ei(n,e,s,i){let r=0;for(const o of n)xn(o,e,s,i)&&r++;return r}function jt(n,e,s,i){return ei(n,e,s,i)}function ti(n,e){return!!(n>=mt||n===0&&e)}function Rt(n,e){return n<e}function ni(n,e){return e===!1?!1:e===!0?!0:n}function xn(n,e,s,i){return!(n.hidden||(n.status??"completed")!==s||i.member==="mine"&&i.currentUserId&&n.created_by!==i.currentUserId||i.type==="automation"&&!n.trigger_id||i.type==="manual"&&n.trigger_id)}const it=new Map,et=new Map;function si(n,e){return e?n>=mt?!0:null:!1}function Gt(n){return it.get(n)}function oi(n,e){it.set(n,e)}function ii(n,e,s){const i=it.get(n);if(i!==void 0){s(i);return}let r=et.get(n);r||(r=pn(e).then(o=>(it.set(n,o),et.delete(n),o)).catch(()=>(et.delete(n),Promise.reject(new Error("group probe failed")))),et.set(n,r)),r.then(s,()=>s(!1))}function Ht(n){const e=n,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===mt,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function ri(n,e,s,i,r){let o=0;for(const a of n)e.has(a.id)||xn(a,s,i,r)&&o++;return o}function ai(n,e,s,i){const r=$.c(8),{org:o}=le(),a=Yo(o.id,n,e,s);let l;r[0]!==s?(l=Jo(s),r[0]=s,r[1]=l):l=r[1];const c=l,[d,f]=V.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==a&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const m=Qn(),{threads:u,hasMore:p}=ut(),y=jt(u,n,e,s),b=ti(y,p),g=si(y,p),h=ct();if(d.identity===a&&d.serverHasMore===null){const T=g??Gt(a);T!==void 0&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:T})}!c&&d.identity===a&&d.serverHasMore===null&&g===null&&Gt(a)===void 0&&d.probeSubscribedIdentity!==a&&(f(T=>T.identity===a?{...T,isProbing:!0,probeSubscribedIdentity:a}:T),ii(a,async()=>{const T=Et(n,e,0,s,1),v=await h.call("COLLECTION_THREADS_LIST",T),{totalCount:N}=Ht(v),D=jt(m.threads.get(),n,e,s);return N===void 0?!1:Rt(D,N)},T=>{f(v=>v.identity!==a?v:{...v,isProbing:!1,serverHasMore:T})}));const j=async function(){if(d.isFetching||d.isProbing||c)return;const v=a;f(N=>N.identity===v?{...N,isFetching:!0}:N);try{const N=jt(u,n,e,s),D=Et(n,e,N,s,mt),S=await pn(()=>h.call("COLLECTION_THREADS_LIST",D)),{items:_,hasMore:M,totalCount:P}=Ht(S),A=new Set(u.map(li)),F=ri(_,A,n,e,s),L=N;m.mergeThreads(_),f(O=>{if(O.identity!==v)return O;let z;return P!==void 0?z=Rt(L+F,P):z=_.length===0||F===0?!1:M,oi(v,z),{...O,isFetching:!1,serverHasMore:z}})}catch(N){const D=N,S=D instanceof Error?D.message:String(D);Q.error(`Could not load more tasks: ${S}`),f(_=>_.identity===v?{..._,isFetching:!1}:_)}},C=d.isFetching||d.isProbing,w=!c&&!C&&ni(b,d.serverHasMore);let I;return r[2]!==C||r[3]!==j||r[4]!==w||r[5]!==d.isProbing||r[6]!==d.serverHasMore?(I={hasMore:w,isFetching:C,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:j},r[2]=C,r[3]=j,r[4]=w,r[5]=d.isProbing,r[6]=d.serverHasMore,r[7]=I):I=r[7],I}function li(n){return n.id}function ci(n){const e=$.c(20),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,{isFetching:d,isProbing:f,loadMore:m,hasMore:u,serverHasMore:p}=ai("status",s,c),[y,b]=V.useState(!1);!y&&i.length===0&&p===!0&&!d&&!f&&(b(!0),queueMicrotask(()=>{m()}));let g;if(e[0]!==r||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==o||e[5]!==i){let j;e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==o?(j=C=>t.jsx(mn,{task:C,isActive:r===C.id,onClick:()=>o(C),onArchive:l&&C.created_by===c.currentUserId?()=>a(C):void 0,showAutomationBadge:!!C.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},C.id),e[7]=r,e[8]=l,e[9]=c,e[10]=a,e[11]=o,e[12]=j):j=e[12],g=i.map(j),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=o,e[5]=i,e[6]=g}else g=e[6];let h;e[13]!==u||e[14]!==d||e[15]!==m?(h=(u||d)&&t.jsx(gn,{onClick:()=>{m()},isFetching:d,indented:!0}),e[13]=u,e[14]=d,e[15]=m,e[16]=h):h=e[16];let x;return e[17]!==g||e[18]!==h?(x=t.jsxs(t.Fragment,{children:[g,h]}),e[17]=g,e[18]=h,e[19]=x):x=e[19],x}function di(n){const e=$.c(36),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,d=Ws[s],f=d.icon,[m,u]=Qo(`status-${s}`,!1);let p;e[0]!==m||e[1]!==u?(p=function(){u(!m)},e[0]=m,e[1]=u,e[2]=p):p=e[2];const y=p;let b;e[3]!==y?(b=v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},e[3]=y,e[4]=b):b=e[4];let g;e[5]!==f||e[6]!==d.iconClassName?(g=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:t.jsx(f,{size:12,className:d.iconClassName})}),e[5]=f,e[6]=d.iconClassName,e[7]=g):g=e[7];let h;e[8]!==m?(h=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:m?t.jsx(_t,{size:14}):t.jsx(Wt,{size:14})}),e[8]=m,e[9]=h):h=e[9];let x;e[10]!==g||e[11]!==h?(x=t.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[g,h]}),e[10]=g,e[11]=h,e[12]=x):x=e[12];let j;e[13]!==d.label?(j=t.jsx("span",{className:"flex-1 truncate",children:d.label}),e[13]=d.label,e[14]=j):j=e[14];let C;e[15]!==i.length?(C=t.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:i.length})}),e[15]=i.length,e[16]=C):C=e[16];let w;e[17]!==m||e[18]!==y||e[19]!==b||e[20]!==x||e[21]!==j||e[22]!==C?(w=t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":m,onClick:y,onKeyDown:b,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[x,j,C]}),e[17]=m,e[18]=y,e[19]=b,e[20]=x,e[21]=j,e[22]=C,e[23]=w):w=e[23];let I;e[24]!==r||e[25]!==l||e[26]!==m||e[27]!==c||e[28]!==a||e[29]!==o||e[30]!==s||e[31]!==i?(I=m&&t.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:t.jsx(ci,{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c})}),e[24]=r,e[25]=l,e[26]=m,e[27]=c,e[28]=a,e[29]=o,e[30]=s,e[31]=i,e[32]=I):I=e[32];let T;return e[33]!==w||e[34]!==I?(T=t.jsxs("div",{className:"flex flex-col gap-0.5",children:[w,I]}),e[33]=w,e[34]=I,e[35]=T):T=e[35],T}function ui(n){const e=$.c(38),{threads:s,groupBy:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,filters:l,hasMore:c,isFetchingMore:d,onLoadMore:f,filtersActive:m}=n;if(s.length===0&&!c&&!d){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Us,{className:"size-6 opacity-60"}),e[0]=g):g=e[0];const h=m?"No chats match your filters":"No chats yet";let x;return e[1]!==h?(x=t.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[g,t.jsx("p",{className:"text-sm",children:h})]}),e[1]=h,e[2]=x):x=e[2],x}const u=s.length>1||c;if(i==="status"){let g;if(e[3]!==r||e[4]!==u||e[5]!==l||e[6]!==a||e[7]!==o||e[8]!==s){let x;e[10]!==r||e[11]!==u||e[12]!==l||e[13]!==a||e[14]!==o?(x=j=>t.jsx(di,{status:j.status,threads:j.threads,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:u,filters:l},j.status),e[10]=r,e[11]=u,e[12]=l,e[13]=a,e[14]=o,e[15]=x):x=e[15],g=Wo(s).map(x),e[3]=r,e[4]=u,e[5]=l,e[6]=a,e[7]=o,e[8]=s,e[9]=g}else g=e[9];let h;return e[16]!==g?(h=t.jsx(t.Fragment,{children:g}),e[16]=g,e[17]=h):h=e[17],h}let p;if(e[18]!==r||e[19]!==u||e[20]!==l||e[21]!==a||e[22]!==o||e[23]!==s){let g;e[25]!==r||e[26]!==u||e[27]!==l||e[28]!==a||e[29]!==o?(g=h=>t.jsx(mn,{task:h,isActive:r===h.id,onClick:()=>o(h),onArchive:u&&h.created_by===l.currentUserId?()=>a(h):void 0,showAutomationBadge:!!h.trigger_id,showAgentIcon:!0},h.id),e[25]=r,e[26]=u,e[27]=l,e[28]=a,e[29]=o,e[30]=g):g=e[30],p=s.map(g),e[18]=r,e[19]=u,e[20]=l,e[21]=a,e[22]=o,e[23]=s,e[24]=p}else p=e[24];let y;e[31]!==c||e[32]!==d||e[33]!==f?(y=(c||d)&&t.jsx(gn,{onClick:f,isFetching:d}),e[31]=c,e[32]=d,e[33]=f,e[34]=y):y=e[34];let b;return e[35]!==p||e[36]!==y?(b=t.jsxs(t.Fragment,{children:[p,y]}),e[35]=p,e[36]=y,e[37]=b):b=e[37],b}function fi(n,e){return null}function mi(n,e){return n.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const gi=["archive","reclaim-worktree"],hi=[];function pi(n){return n==="confirm"?gi:hi}function Dr(n){const e=$.c(11),{panel:s}=n;let i;return e[0]!==s.activeTaskId||e[1]!==s.archiveTask||e[2]!==s.filters||e[3]!==s.filtersActive||e[4]!==s.groupBy||e[5]!==s.hasMore||e[6]!==s.isFetchingMore||e[7]!==s.loadMore||e[8]!==s.selectTask||e[9]!==s.threads?(i=t.jsx(ui,{threads:s.threads,groupBy:s.groupBy,activeTaskId:s.activeTaskId,onSelectTask:s.selectTask,onArchiveTask:s.archiveTask,filters:s.filters,hasMore:s.hasMore,isFetchingMore:s.isFetchingMore,onLoadMore:s.loadMore,filtersActive:s.filtersActive}),e[0]=s.activeTaskId,e[1]=s.archiveTask,e[2]=s.filters,e[3]=s.filtersActive,e[4]=s.groupBy,e[5]=s.hasMore,e[6]=s.isFetchingMore,e[7]=s.loadMore,e[8]=s.selectTask,e[9]=s.threads,e[10]=i):i=e[10],i}function Ar(n){const e=$.c(82);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,r=G(),{data:o}=Te.useSession(),a=o?.user?.id,{org:l}=le();let c;e[2]!==l.id?(c=dt(l.id),e[2]=l.id,e[3]=c):c=e[3];const d=c.id,{threads:f,hasMore:m,isFetchingMore:u,fetchNextPage:p}=ut(),y=f.filter(ji),{hide:b,setScope:g}=sn(),h=rt(),x=ct(),{setTaskId:j,createNewTask:C}=ft();let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w={strict:!1},e[4]=w):w=e[4];const I=at(w);let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T={strict:!1},e[5]=T):T=e[5];const v=lt(T),N=I.taskId??null;let D;e[6]!==N||e[7]!==f||e[8]!==v.virtualmcpid?(D=v.virtualmcpid??f.find(k=>k.id===N)?.virtual_mcp_id??null,e[6]=N,e[7]=f,e[8]=v.virtualmcpid,e[9]=D):D=e[9];const S=D;let _;e[10]!==i?(_=()=>{i?.()},e[10]=i,e[11]=_):_=e[11];const M=_,P=[...y].sort(vi),[A,F]=V.useState("all"),[L,O]=V.useState("flat"),[z,U]=Ct("sidebar-threads-scope-all",!1),[R,q]=V.useState(!1),[E,Y]=V.useState(!1);let ee;e[12]!==q?(ee=()=>{K("tasks_panel_search_opened"),Y(!0),q(!0)},e[12]=q,e[13]=ee):ee=e[13];const te=ee,[H,J]=V.useState(null),ne=a??null;let W;e[14]!==ne||e[15]!==A?(W={type:A,member:"mine",currentUserId:ne},e[14]=ne,e[15]=A,e[16]=W):W=e[16];const Ne=W,Be={};z||(Be.created_by="me"),g(Be);let Ce;e[17]!==a?(Ce=k=>a?k.filter(B=>B.created_by===a):[],e[17]=a,e[18]=Ce):Ce=e[18];const Ee=Ce;let _e;e[19]!==A?(_e=k=>A==="automation"?k.filter(bi):A==="manual"?k.filter(xi):k,e[19]=A,e[20]=_e):_e=e[20];const We=_e,se=We(z?P:Ee(P));let Se;e[21]!==N||e[22]!==M||e[23]!==a||e[24]!==b||e[25]!==h||e[26]!==l.slug||e[27]!==j||e[28]!==se?(Se=k=>{const B=k.id===N,Z=b(k.id);if(ss(k.id),!B)return Z;const ue=qo(se,k.id,a);return M(),ue?j(ue.id,ue.virtual_mcp_id):h({to:"/$org",params:{org:l.slug}}),Z},e[21]=N,e[22]=M,e[23]=a,e[24]=b,e[25]=h,e[26]=l.slug,e[27]=j,e[28]=se,e[29]=Se):Se=e[29];const oe=Se;let Re;e[30]!==x||e[31]!==r?(Re=async k=>{try{await x.call("SANDBOX_DELETE",{virtualMcpId:k.virtualMcpId,branch:k.branch,sandboxProviderKind:"user-desktop",removeWorktree:!0})}catch{Q.error(r("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:k.branch}))}},e[30]=x,e[31]=r,e[32]=Re):Re=e[32];const ke=Re;let Ie;e[33]!==f||e[34]!==oe||e[35]!==a||e[36]!==J?(Ie=k=>{if(a&&k.created_by&&k.created_by!==a)return;const B=fi();if(!B||mi(f,B)){oe(k);return}J({task:k,target:B})},e[33]=f,e[34]=oe,e[35]=a,e[36]=J,e[37]=Ie):Ie=e[37];const fe=Ie;let de;e[38]!==oe||e[39]!==H||e[40]!==ke||e[41]!==J?(de=k=>{const B=H;B&&(J(null),(async()=>{for(const Z of pi(k))if(Z==="archive")try{await oe(B.task)}catch{return}else await ke(B.target)})())},e[38]=oe,e[39]=H,e[40]=ke,e[41]=J,e[42]=de):de=e[42];const Fe=de;let De;e[43]!==M||e[44]!==j?(De=k=>{M(),j(k.id,k.virtual_mcp_id)},e[43]=M,e[44]=j,e[45]=De):De=e[45];const $e=De;let Ae;e[46]!==S||e[47]!==N||e[48]!==f||e[49]!==M||e[50]!==C||e[51]!==d?(Ae=()=>{const k=S??d,B=f.find(Z=>Z.id===N)?.branch??null;K("sidebar_new_thread_clicked",{virtual_mcp_id:k}),M(),C(k,B)},e[46]=S,e[47]=N,e[48]=f,e[49]=M,e[50]=C,e[51]=d,e[52]=Ae):Ae=e[52];const me=Ae;let ie;e[53]!==p?(ie=()=>{p()},e[53]=p,e[54]=ie):ie=e[54];const ge=L!=="flat"||A!=="all"||z;let re;e[55]!==Fe||e[56]!==H?(re=H?t.jsx(Uo,{branch:H.target.branch,onOutcome:Fe}):null,e[55]=Fe,e[56]=H,e[57]=re):re=e[57];let ae;e[58]!==E||e[59]!==R||e[60]!==q?(ae=E?t.jsx(Vo,{open:R,onOpenChange:q}):null,e[58]=E,e[59]=R,e[60]=q,e[61]=ae):ae=e[61];let we;return e[62]!==N||e[63]!==fe||e[64]!==Ne||e[65]!==L||e[66]!==m||e[67]!==u||e[68]!==me||e[69]!==te||e[70]!==$e||e[71]!==O||e[72]!==U||e[73]!==F||e[74]!==z||e[75]!==ie||e[76]!==ge||e[77]!==re||e[78]!==ae||e[79]!==A||e[80]!==se?(we={threads:se,activeTaskId:N,filters:Ne,hasMore:m,isFetchingMore:u,loadMore:ie,groupBy:L,setGroupBy:O,typeFilter:A,setTypeFilter:F,showAll:z,setShowAll:U,filtersActive:ge,selectTask:$e,archiveTask:fe,newThread:me,openSearch:te,reclaimDialog:re,searchDialog:ae},e[62]=N,e[63]=fe,e[64]=Ne,e[65]=L,e[66]=m,e[67]=u,e[68]=me,e[69]=te,e[70]=$e,e[71]=O,e[72]=U,e[73]=F,e[74]=z,e[75]=ie,e[76]=ge,e[77]=re,e[78]=ae,e[79]=A,e[80]=se,e[81]=we):we=e[81],we}function xi(n){return!n.trigger_id}function bi(n){return!!n.trigger_id}function vi(n,e){return(e.updated_at??"").localeCompare(n.updated_at??"")}function ji(n){return!n.hidden}function yi(n){return n?n.run_in_progress?"generating":n.scanned_at?"ready":"none":"none"}const Ci=2e4;function _i(n){if(typeof n!="string"||!n)return null;try{return new URL(n).hostname||null}catch{return null}}function Tr(){const n=$.c(19),{org:e}=le(),s=En.COMMERCE_DISCOVERY(e.id);let i;n[0]!==e.id||n[1]!==e.slug?(i=zt({connectionId:Xt,orgId:e.id,orgSlug:e.slug}),n[0]=e.id,n[1]=e.slug,n[2]=i):i=n[2];const{data:r}=He(i),o=He({queryKey:Ue.commerceDiscoveryConnection(e.id,s),enabled:!!r,retry:!1,staleTime:6e4,queryFn:async()=>{if(!r)throw new Error("selfClient not ready");const w=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}});return Pt(w)}}),a=o.data?.item??null,{data:l}=He({...zt({connectionId:s,orgId:e.id,orgSlug:e.slug}),enabled:!!a}),c=Ue.commerceDiscoveryDiagnostic(e.id,s),d=!!l;let f;n[3]!==l?(f=async()=>{if(!l)throw new Error("cdClient not ready");const w=await l.callTool({name:Qt,arguments:{}});return Pt(w).diagnostic??null},n[3]=l,n[4]=f):f=n[4];let m;n[5]!==c||n[6]!==d||n[7]!==f?(m={queryKey:c,enabled:d,retry:1,refetchInterval:wi,queryFn:f},n[5]=c,n[6]=d,n[7]=f,n[8]=m):m=n[8];const u=He(m),p=a?.metadata?.siteUrl,y=u.data??null,b=u.isSuccess,g=o.isPending||!!a&&u.isPending,h=typeof p=="string"&&p?p:null;let x;n[9]!==p?(x=_i(p),n[9]=p,n[10]=x):x=n[10];const j=l??null;let C;return n[11]!==s||n[12]!==u.isSuccess||n[13]!==j||n[14]!==y||n[15]!==g||n[16]!==h||n[17]!==x?(C={diagnostic:y,isSuccess:b,isLoading:g,siteUrl:h,host:x,connectionId:s,cdClient:j},n[11]=s,n[12]=u.isSuccess,n[13]=j,n[14]=y,n[15]=g,n[16]=h,n[17]=x,n[18]=C):C=n[18],C}function wi(n){return n.state.status!=="error"&&yi(n.state.data)==="generating"?Ci:!1}function Mr(n,e){return{to:"/$org/$taskId",params:{org:n.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:Rn(n.id),main:Qs(e,Qt)}}}export{wr as A,yr as C,Nr as N,_r as O,Ir as T,Cr as a,Sr as b,Ar as c,oo as d,Mt as e,Dr as f,Tr as g,Io as h,yi as i,Mr as j,kr as u};
@@ -1 +1 @@
1
- import{c as f,H as C,bQ as A,eN as O,bP as S}from"./index-fZpMDfe6.js";import{u as I}from"./use-mcp-client-BixLZLmc.js";import{S as N}from"./constants-_08zpzmT.js";function E(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let r;o[12]!==e?(r=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=r):r=o[13];let g;o[14]!==s||o[15]!==r?(g={...s,additionalToolArgs:r},o[14]=s,o[15]=r,o[16]=g):g=o[16];const m=g,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:N,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const p=I(a);return O(u.id,"CONNECTIONS",p,m)}function P(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:N,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=I(n);return S(i.id,"CONNECTIONS",t,l)}function _(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:N,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=I(i);return A(o.id,"CONNECTIONS",n)}export{P as a,_ as b,E as u};
1
+ import{c as f,H as C,bQ as A,eN as O,bP as S}from"./index-DS_PtpmP.js";import{u as I}from"./use-mcp-client-Zz1TwEAh.js";import{S as N}from"./constants-_08zpzmT.js";function E(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let r;o[12]!==e?(r=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=r):r=o[13];let g;o[14]!==s||o[15]!==r?(g={...s,additionalToolArgs:r},o[14]=s,o[15]=r,o[16]=g):g=o[16];const m=g,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:N,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const p=I(a);return O(u.id,"CONNECTIONS",p,m)}function P(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:N,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=I(n);return S(i.id,"CONNECTIONS",t,l)}function _(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:N,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=I(i);return A(o.id,"CONNECTIONS",n)}export{P as a,_ as b,E as u};
@@ -1 +1 @@
1
- import{c as i,r as n}from"./index-fZpMDfe6.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
1
+ import{c as i,r as n}from"./index-DS_PtpmP.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
@@ -1 +1 @@
1
- import{c as g}from"./index-fZpMDfe6.js";import{b as f}from"./use-virtual-mcp-CxECG99q.js";import{c as p}from"./use-navigate-to-agent-COcz3Nee.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
1
+ import{c as g}from"./index-DS_PtpmP.js";import{b as f}from"./use-virtual-mcp-BHOLpD1P.js";import{c as p}from"./use-navigate-to-agent-BTDz1KOs.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
@@ -1 +1 @@
1
- import{r as u}from"./index-fZpMDfe6.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
1
+ import{r as u}from"./index-DS_PtpmP.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
@@ -1 +1 @@
1
- import{c as m,r as n}from"./index-fZpMDfe6.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
1
+ import{c as m,r as n}from"./index-DS_PtpmP.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-fZpMDfe6.js";import{d as R,c as u}from"./decopilot-sse-pool-0EWVughz.js";const f=()=>0;function g(E){const{orgSlug:t,taskId:a,enabled:n=!0,onStep:o,onFinish:S,onTaskStatus:i}=E,l=s.useRef({taskId:a,onStep:o,onFinish:S,onTaskStatus:i});l.current={taskId:a,onStep:o,onFinish:S,onTaskStatus:i};const c=s.useRef(null),p=s.useRef(n),b=s.useRef(t);(!c.current||p.current!==n||b.current!==t)&&(p.current=n,b.current=t,c.current=d=>{if(!n||!t)return()=>{};const k=T=>{let e;try{e=JSON.parse(T.data)}catch{return}const r=l.current;if(!(r.taskId&&e.subject!==r.taskId)){switch(e.type){case u.STEP:r.onStep?.(e);break;case u.FINISH:r.onFinish?.(e);break;case u.THREAD_STATUS:r.onTaskStatus?.(e);break}d()}};return R.subscribe(t,k)}),s.useSyncExternalStore(c.current,f,f)}export{g as u};
1
+ import{r as s}from"./index-DS_PtpmP.js";import{d as R,c as u}from"./decopilot-sse-pool-B2gldwFf.js";const f=()=>0;function g(E){const{orgSlug:t,taskId:a,enabled:n=!0,onStep:o,onFinish:S,onTaskStatus:i}=E,l=s.useRef({taskId:a,onStep:o,onFinish:S,onTaskStatus:i});l.current={taskId:a,onStep:o,onFinish:S,onTaskStatus:i};const c=s.useRef(null),p=s.useRef(n),b=s.useRef(t);(!c.current||p.current!==n||b.current!==t)&&(p.current=n,b.current=t,c.current=d=>{if(!n||!t)return()=>{};const k=T=>{let e;try{e=JSON.parse(T.data)}catch{return}const r=l.current;if(!(r.taskId&&e.subject!==r.taskId)){switch(e.type){case u.STEP:r.onStep?.(e);break;case u.FINISH:r.onFinish?.(e);break;case u.THREAD_STATUS:r.onTaskStatus?.(e);break}d()}};return R.subscribe(t,k)}),s.useSyncExternalStore(c.current,f,f)}export{g as u};
@@ -1 +1 @@
1
- import{c as oe,b as le,j as n,H as se,p as ie,av as ce,r as re,t as Y,bN as ae,bO as de}from"./index-fZpMDfe6.js";import{c as z,d as G,b as V,f as X,g as Z,e as ee,a as te,A as ne}from"./alert-dialog-COKsRPdB.js";function ge(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),k=s.mode==="deleting";let m;e[0]!==a?(m=W=>{W||a()},e[0]=a,e[1]=m):m=e[1];let u;e[2]!==t?(u=t("common.deleteConnectionDialogs.title"),e[2]=t,e[3]=u):u=e[3];let D;e[4]!==u?(D=n.jsx(z,{children:u}),e[4]=u,e[5]=D):D=e[5];let C;e[6]!==t?(C=t("common.deleteConnectionDialogs.description"),e[6]=t,e[7]=C):C=e[7];const w=s.mode==="deleting"&&s.connection.title;let o;e[8]!==w?(o=n.jsx("span",{className:"font-medium text-foreground",children:w}),e[8]=w,e[9]=o):o=e[9];let l;e[10]!==C||e[11]!==o?(l=n.jsxs(G,{children:[C," ",o,"."]}),e[10]=C,e[11]=o,e[12]=l):l=e[12];let i;e[13]!==D||e[14]!==l?(i=n.jsxs(V,{children:[D,l]}),e[13]=D,e[14]=l,e[15]=i):i=e[15];let f;e[16]!==t?(f=t("common.deleteConnectionDialogs.cancel"),e[16]=t,e[17]=f):f=e[17];let r;e[18]!==f?(r=n.jsx(X,{children:f}),e[18]=f,e[19]=r):r=e[19];let g;e[20]!==t?(g=t("common.deleteConnectionDialogs.delete"),e[20]=t,e[21]=g):g=e[21];let x;e[22]!==d||e[23]!==g?(x=n.jsx(Z,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g}),e[22]=d,e[23]=g,e[24]=x):x=e[24];let h;e[25]!==r||e[26]!==x?(h=n.jsxs(ee,{children:[r,x]}),e[25]=r,e[26]=x,e[27]=h):h=e[27];let j;e[28]!==h||e[29]!==i?(j=n.jsxs(te,{children:[i,h]}),e[28]=h,e[29]=i,e[30]=j):j=e[30];let N;e[31]!==k||e[32]!==j||e[33]!==m?(N=n.jsx(ne,{open:k,onOpenChange:m,children:j}),e[31]=k,e[32]=j,e[33]=m,e[34]=N):N=e[34];const J=s.mode==="force-deleting";let p;e[35]!==a?(p=W=>{W||a()},e[35]=a,e[36]=p):p=e[36];let E;e[37]!==t?(E=t("common.deleteConnectionDialogs.forceDeleteTitle"),e[37]=t,e[38]=E):E=e[38];let y;e[39]!==E?(y=n.jsx(z,{children:E}),e[39]=E,e[40]=y):y=e[40];let O;e[41]!==t?(O=t("common.deleteConnectionDialogs.forceDeleteDescription"),e[41]=t,e[42]=O):O=e[42];const M=s.mode==="force-deleting"&&s.connection.title;let v;e[43]!==M?(v=n.jsx("span",{className:"font-medium text-foreground",children:M}),e[43]=M,e[44]=v):v=e[44];let S;e[45]!==t?(S=t("common.deleteConnectionDialogs.isUsedByAgents"),e[45]=t,e[46]=S):S=e[46];const P=s.mode==="force-deleting"&&s.agentNames;let T;e[47]!==P?(T=n.jsx("span",{className:"font-medium text-foreground",children:P}),e[47]=P,e[48]=T):T=e[48];let A;e[49]!==O||e[50]!==v||e[51]!==S||e[52]!==T?(A=n.jsxs("p",{children:[O," ",v," ",S," ",T,"."]}),e[49]=O,e[50]=v,e[51]=S,e[52]=T,e[53]=A):A=e[53];let _;e[54]!==t?(_=t("common.deleteConnectionDialogs.forceDeleteWarning"),e[54]=t,e[55]=_):_=e[55];let b;e[56]!==_?(b=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=b):b=e[57];let F;e[58]!==A||e[59]!==b?(F=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,b]})}),e[58]=A,e[59]=b,e[60]=F):F=e[60];let I;e[61]!==y||e[62]!==F?(I=n.jsxs(V,{children:[y,F]}),e[61]=y,e[62]=F,e[63]=I):I=e[63];let L;e[64]!==t?(L=t("common.deleteConnectionDialogs.cancel"),e[64]=t,e[65]=L):L=e[65];let R;e[66]!==L?(R=n.jsx(X,{children:L}),e[66]=L,e[67]=R):R=e[67];let q;e[68]!==t?(q=t("common.deleteConnectionDialogs.deleteAnyway"),e[68]=t,e[69]=q):q=e[69];let U;e[70]!==c||e[71]!==q?(U=n.jsx(Z,{onClick:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[70]=c,e[71]=q,e[72]=U):U=e[72];let H;e[73]!==R||e[74]!==U?(H=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=H):H=e[75];let K;e[76]!==I||e[77]!==H?(K=n.jsxs(te,{children:[I,H]}),e[76]=I,e[77]=H,e[78]=K):K=e[78];let $;e[79]!==J||e[80]!==p||e[81]!==K?($=n.jsx(ne,{open:J,onOpenChange:p,children:K}),e[79]=J,e[80]=p,e[81]=K,e[82]=$):$=e[82];let Q;return e[83]!==N||e[84]!==$?(Q=n.jsxs(n.Fragment,{children:[N,$]}),e[83]=N,e[84]=$,e[85]=Q):Q=e[85],Q}function ue({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=ce(),[d,c]=re.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},k=o=>{ae(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===de&&l.queryKey[3]===o})},m=o=>{t(),k(o),Y.success("Connection deleted successfully"),c({mode:"idle"}),B?.()};return{deleteState:d,requestDelete:o=>{c({mode:"deleting",connection:o})},cancelDelete:()=>{c({mode:"idle"})},confirmDelete:async()=>{if(d.mode!=="deleting")return;const o=d.connection;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o.id}),m(o.id)}catch(l){const i=l instanceof Error?l.message:String(l),f=i.replace(/^Error:\s*/,"");try{const r=JSON.parse(f);if(r.code==="CONNECTION_IN_USE"&&r.agentNames){c({mode:"force-deleting",connection:o,agentNames:r.agentNames.map(g=>`"${g}"`).join(", ")});return}}catch{}Y.error(`Failed to delete connection: ${i}`)}},confirmForceDelete:async()=>{if(d.mode!=="force-deleting")return;const o=d.connection.id;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o,force:!0}),m(o)}catch(l){const i=l instanceof Error?l.message:String(l);Y.error(`Failed to delete connection: ${i}`)}}}}export{ge as D,ue as u};
1
+ import{c as oe,b as le,j as n,H as se,p as ie,av as ce,r as re,t as Y,bN as ae,bO as de}from"./index-DS_PtpmP.js";import{c as z,d as G,b as V,f as X,g as Z,e as ee,a as te,A as ne}from"./alert-dialog-C6uvTNV5.js";function ge(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),k=s.mode==="deleting";let m;e[0]!==a?(m=W=>{W||a()},e[0]=a,e[1]=m):m=e[1];let u;e[2]!==t?(u=t("common.deleteConnectionDialogs.title"),e[2]=t,e[3]=u):u=e[3];let D;e[4]!==u?(D=n.jsx(z,{children:u}),e[4]=u,e[5]=D):D=e[5];let C;e[6]!==t?(C=t("common.deleteConnectionDialogs.description"),e[6]=t,e[7]=C):C=e[7];const w=s.mode==="deleting"&&s.connection.title;let o;e[8]!==w?(o=n.jsx("span",{className:"font-medium text-foreground",children:w}),e[8]=w,e[9]=o):o=e[9];let l;e[10]!==C||e[11]!==o?(l=n.jsxs(G,{children:[C," ",o,"."]}),e[10]=C,e[11]=o,e[12]=l):l=e[12];let i;e[13]!==D||e[14]!==l?(i=n.jsxs(V,{children:[D,l]}),e[13]=D,e[14]=l,e[15]=i):i=e[15];let f;e[16]!==t?(f=t("common.deleteConnectionDialogs.cancel"),e[16]=t,e[17]=f):f=e[17];let r;e[18]!==f?(r=n.jsx(X,{children:f}),e[18]=f,e[19]=r):r=e[19];let g;e[20]!==t?(g=t("common.deleteConnectionDialogs.delete"),e[20]=t,e[21]=g):g=e[21];let x;e[22]!==d||e[23]!==g?(x=n.jsx(Z,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g}),e[22]=d,e[23]=g,e[24]=x):x=e[24];let h;e[25]!==r||e[26]!==x?(h=n.jsxs(ee,{children:[r,x]}),e[25]=r,e[26]=x,e[27]=h):h=e[27];let j;e[28]!==h||e[29]!==i?(j=n.jsxs(te,{children:[i,h]}),e[28]=h,e[29]=i,e[30]=j):j=e[30];let N;e[31]!==k||e[32]!==j||e[33]!==m?(N=n.jsx(ne,{open:k,onOpenChange:m,children:j}),e[31]=k,e[32]=j,e[33]=m,e[34]=N):N=e[34];const J=s.mode==="force-deleting";let p;e[35]!==a?(p=W=>{W||a()},e[35]=a,e[36]=p):p=e[36];let E;e[37]!==t?(E=t("common.deleteConnectionDialogs.forceDeleteTitle"),e[37]=t,e[38]=E):E=e[38];let y;e[39]!==E?(y=n.jsx(z,{children:E}),e[39]=E,e[40]=y):y=e[40];let O;e[41]!==t?(O=t("common.deleteConnectionDialogs.forceDeleteDescription"),e[41]=t,e[42]=O):O=e[42];const M=s.mode==="force-deleting"&&s.connection.title;let v;e[43]!==M?(v=n.jsx("span",{className:"font-medium text-foreground",children:M}),e[43]=M,e[44]=v):v=e[44];let S;e[45]!==t?(S=t("common.deleteConnectionDialogs.isUsedByAgents"),e[45]=t,e[46]=S):S=e[46];const P=s.mode==="force-deleting"&&s.agentNames;let T;e[47]!==P?(T=n.jsx("span",{className:"font-medium text-foreground",children:P}),e[47]=P,e[48]=T):T=e[48];let A;e[49]!==O||e[50]!==v||e[51]!==S||e[52]!==T?(A=n.jsxs("p",{children:[O," ",v," ",S," ",T,"."]}),e[49]=O,e[50]=v,e[51]=S,e[52]=T,e[53]=A):A=e[53];let _;e[54]!==t?(_=t("common.deleteConnectionDialogs.forceDeleteWarning"),e[54]=t,e[55]=_):_=e[55];let b;e[56]!==_?(b=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=b):b=e[57];let F;e[58]!==A||e[59]!==b?(F=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,b]})}),e[58]=A,e[59]=b,e[60]=F):F=e[60];let I;e[61]!==y||e[62]!==F?(I=n.jsxs(V,{children:[y,F]}),e[61]=y,e[62]=F,e[63]=I):I=e[63];let L;e[64]!==t?(L=t("common.deleteConnectionDialogs.cancel"),e[64]=t,e[65]=L):L=e[65];let R;e[66]!==L?(R=n.jsx(X,{children:L}),e[66]=L,e[67]=R):R=e[67];let q;e[68]!==t?(q=t("common.deleteConnectionDialogs.deleteAnyway"),e[68]=t,e[69]=q):q=e[69];let U;e[70]!==c||e[71]!==q?(U=n.jsx(Z,{onClick:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[70]=c,e[71]=q,e[72]=U):U=e[72];let H;e[73]!==R||e[74]!==U?(H=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=H):H=e[75];let K;e[76]!==I||e[77]!==H?(K=n.jsxs(te,{children:[I,H]}),e[76]=I,e[77]=H,e[78]=K):K=e[78];let $;e[79]!==J||e[80]!==p||e[81]!==K?($=n.jsx(ne,{open:J,onOpenChange:p,children:K}),e[79]=J,e[80]=p,e[81]=K,e[82]=$):$=e[82];let Q;return e[83]!==N||e[84]!==$?(Q=n.jsxs(n.Fragment,{children:[N,$]}),e[83]=N,e[84]=$,e[85]=Q):Q=e[85],Q}function ue({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=ce(),[d,c]=re.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},k=o=>{ae(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===de&&l.queryKey[3]===o})},m=o=>{t(),k(o),Y.success("Connection deleted successfully"),c({mode:"idle"}),B?.()};return{deleteState:d,requestDelete:o=>{c({mode:"deleting",connection:o})},cancelDelete:()=>{c({mode:"idle"})},confirmDelete:async()=>{if(d.mode!=="deleting")return;const o=d.connection;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o.id}),m(o.id)}catch(l){const i=l instanceof Error?l.message:String(l),f=i.replace(/^Error:\s*/,"");try{const r=JSON.parse(f);if(r.code==="CONNECTION_IN_USE"&&r.agentNames){c({mode:"force-deleting",connection:o,agentNames:r.agentNames.map(g=>`"${g}"`).join(", ")});return}}catch{}Y.error(`Failed to delete connection: ${i}`)}},confirmForceDelete:async()=>{if(d.mode!=="force-deleting")return;const o=d.connection.id;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o,force:!0}),m(o)}catch(l){const i=l instanceof Error?l.message:String(l);Y.error(`Failed to delete connection: ${i}`)}}}}export{ge as D,ue as u};
@@ -1 +1 @@
1
- import{c as s,o as m,K as c}from"./index-fZpMDfe6.js";function l(){const e=s.c(5);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={queryKey:c.deploymentAdminMe(),queryFn:d,staleTime:1/0,retry:2},e[0]=t):t=e[0];const{data:a,isLoading:i}=m(t),r=a==="admin",o=a==="unverified";let n;return e[1]!==i||e[2]!==r||e[3]!==o?(n={isAdmin:r,loading:i,needsEmailVerification:o},e[1]=i,e[2]=r,e[3]=o,e[4]=n):n=e[4],n}async function d(){const e=await fetch("/api/_admin/me",{credentials:"include"});if(e.status>=500)throw new Error(`admin/me request failed: ${e.status}`);return e.ok?"admin":(await e.json().catch(u)).error==="email_not_verified"?"unverified":"denied"}function u(){return{}}export{l as u};
1
+ import{c as s,o as m,K as c}from"./index-DS_PtpmP.js";function l(){const e=s.c(5);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={queryKey:c.deploymentAdminMe(),queryFn:d,staleTime:1/0,retry:2},e[0]=t):t=e[0];const{data:a,isLoading:i}=m(t),r=a==="admin",o=a==="unverified";let n;return e[1]!==i||e[2]!==r||e[3]!==o?(n={isAdmin:r,loading:i,needsEmailVerification:o},e[1]=i,e[2]=r,e[3]=o,e[4]=n):n=e[4],n}async function d(){const e=await fetch("/api/_admin/me",{credentials:"include"});if(e.status>=500)throw new Error(`admin/me request failed: ${e.status}`);return e.ok?"admin":(await e.json().catch(u)).error==="email_not_verified"?"unverified":"denied"}function u(){return{}}export{l as u};
@@ -1 +1 @@
1
- import{c as u,H as c,av as r,K as a,o as y,z as F,p as C,e as d}from"./index-fZpMDfe6.js";function E(){const e=u.c(7),{org:n}=c(),o=r();let i;e[0]!==n.id?(i=a.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:l}=F(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=r();let i;e[0]!==n.id?(i=a.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;return e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6],y(s)}function m(){const e=u.c(8),{org:n}=c(),o=r(),i=C();let t;e[0]!==o?(t=f=>o.call("FILE_CONFIG_CREATE",{...f}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:a.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}function q(){const e=u.c(8),{org:n}=c(),o=r(),i=C();let t;e[0]!==o?(t=f=>o.call("FILE_CONFIG_DELETE",{id:f}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:a.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}export{E as a,m as b,q as c,I as u};
1
+ import{c as u,H as c,av as r,K as a,o as y,z as F,p as C,e as d}from"./index-DS_PtpmP.js";function E(){const e=u.c(7),{org:n}=c(),o=r();let i;e[0]!==n.id?(i=a.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:l}=F(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=r();let i;e[0]!==n.id?(i=a.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;return e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6],y(s)}function m(){const e=u.c(8),{org:n}=c(),o=r(),i=C();let t;e[0]!==o?(t=f=>o.call("FILE_CONFIG_CREATE",{...f}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:a.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}function q(){const e=u.c(8),{org:n}=c(),o=r(),i=C();let t;e[0]!==o?(t=f=>o.call("FILE_CONFIG_DELETE",{id:f}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:a.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}export{E as a,m as b,q as c,I as u};
@@ -1 +1 @@
1
- import{bt as l,eP as d,eQ as v,r as i}from"./index-fZpMDfe6.js";var b=class extends l{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:r,isRefetching:h,isError:a,isRefetchError:P}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",g=r&&s==="forward",c=a&&s==="backward",f=r&&s==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:d(t,n.data),isFetchNextPageError:o,isFetchingNextPage:g,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:P&&!o&&!c,isRefetching:h&&!g&&!f}}};function p(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),P=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,P.current=t,s.current=n,o.current=u;const[g]=i.useState(()=>c=>{h.current=c,r.current&&(r.current.disconnect(),r.current=null),c&&queueMicrotask(()=>{if(h.current!==c)return;const f=new IntersectionObserver(R=>{R[0]?.isIntersecting&&P.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return g}export{b as I,p as u};
1
+ import{bt as l,eP as d,eQ as v,r as i}from"./index-DS_PtpmP.js";var b=class extends l{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:r,isRefetching:h,isError:a,isRefetchError:P}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",g=r&&s==="forward",c=a&&s==="backward",f=r&&s==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:d(t,n.data),isFetchNextPageError:o,isFetchingNextPage:g,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:P&&!o&&!c,isRefetching:h&&!g&&!f}}};function p(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),P=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,P.current=t,s.current=n,o.current=u;const[g]=i.useState(()=>c=>{h.current=c,r.current&&(r.current.disconnect(),r.current=null),c&&queueMicrotask(()=>{if(h.current!==c)return;const f=new IntersectionObserver(R=>{R[0]?.isIntersecting&&P.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return g}export{b as I,p as u};