decocms 4.213.2 → 4.213.4

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 (228) hide show
  1. package/dist/client/assets/{AlertCircle-BtaPB3r3.js → AlertCircle-DkkZBUv4.js} +1 -1
  2. package/dist/client/assets/{AreaChart-D5z3kdQF.js → AreaChart-xdDbU-OL.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-CWRzKYG7.js → ArrowLeft-CCjm2zjh.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-BQptHrCQ.js → ArrowUp-DyVbcDzm.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-CrVt_V-y.js → ArrowUpRight-BFkKFN7l.js} +1 -1
  6. package/dist/client/assets/{Check-C9YirVC4.js → Check-ByJrpIbu.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-BNrL_lWP.js → CheckCircle-BJAfVhBt.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-CK4ZVZU5.js → ChevronDown-eBlATgdA.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-DRaQJ8sH.js → ChevronRight-Sb_ED2ND.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-_4Y6lyxd.js → ChevronUp-Clue5bVs.js} +1 -1
  11. package/dist/client/assets/{Copy01-CLX1AbOl.js → Copy01-DEYrMFvd.js} +1 -1
  12. package/dist/client/assets/{CpuChip01-BDJy1J19.js → CpuChip01-CRCFBLGb.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-Dn0eZmYP.js → CreditCard01-DVQ_trwj.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-DrdjZfrd.js → DotsVertical-z4B9-mwO.js} +1 -1
  15. package/dist/client/assets/{Eye-BzFG1M0K.js → Eye-Dq74RklM.js} +1 -1
  16. package/dist/client/assets/{FilterLines-DAnm9bXM.js → FilterLines-G1RXinzK.js} +1 -1
  17. package/dist/client/assets/{Globe01-T4l6-g3P.js → Globe01-CQ3JXEsp.js} +1 -1
  18. package/dist/client/assets/{Globe04-8mu0fUFk.js → Globe04-CylAlwCT.js} +1 -1
  19. package/dist/client/assets/{HardDrive-qcwOZA_m.js → HardDrive-CvmfsJwK.js} +1 -1
  20. package/dist/client/assets/{Key01-DoHyECqo.js → Key01-CHPlABNw.js} +1 -1
  21. package/dist/client/assets/{LayoutLeft-BwNnkGLE.js → LayoutLeft-DLCVgAHc.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-4giR9ii8.js → LinkExternal01-B1uxY5X5.js} +1 -1
  23. package/dist/client/assets/{LogOut01-Bd09T8FP.js → LogOut01-DHePzq8i.js} +1 -1
  24. package/dist/client/assets/{Monitor01-B5dFm4gD.js → Monitor01-BirbpTGo.js} +1 -1
  25. package/dist/client/assets/{Palette-D2vpD9pq.js → Palette-jiE2ucje.js} +1 -1
  26. package/dist/client/assets/{Play-DhkCqwFM.js → Play-CBlCbXyC.js} +1 -1
  27. package/dist/client/assets/{Plus-Dm4WmNSG.js → Plus-C6vzlDQe.js} +1 -1
  28. package/dist/client/assets/{SearchLg-Ck20GG--.js → SearchLg-DdLr3Wv2.js} +1 -1
  29. package/dist/client/assets/{SearchMd-CfFkukig.js → SearchMd-BHNbvSu5.js} +1 -1
  30. package/dist/client/assets/{Settings02-CVAq2JK_.js → Settings02-3x6bXQZc.js} +1 -1
  31. package/dist/client/assets/{Share07-D22bkXr_.js → Share07-5vmoQMtW.js} +1 -1
  32. package/dist/client/assets/{Shield01-AckE4Fkx.js → Shield01-Bu4PHSC-.js} +1 -1
  33. package/dist/client/assets/{Star01-CxRj8IxJ.js → Star01-B5OO0GPG.js} +1 -1
  34. package/dist/client/assets/{Stars01-Sd1pfysM.js → Stars01-D4rY_Ku0.js} +1 -1
  35. package/dist/client/assets/{Stars02-B1BVyXRS.js → Stars02-BMvpgy8d.js} +1 -1
  36. package/dist/client/assets/{Sun-C10MgYGY.js → Sun-DwWGxpiu.js} +1 -1
  37. package/dist/client/assets/{SwitchHorizontal01-BQiSEYjX.js → SwitchHorizontal01-CqvJZY4d.js} +1 -1
  38. package/dist/client/assets/{Tool01-DLaPhB7V.js → Tool01--sCIVxHi.js} +1 -1
  39. package/dist/client/assets/{Tool02-DrvkBQ68.js → Tool02-BEn9yaLs.js} +1 -1
  40. package/dist/client/assets/{Trash01-BVokhopT.js → Trash01-BEKXpRo8.js} +1 -1
  41. package/dist/client/assets/{TrendUp01-BhfBb2kU.js → TrendUp01-Btyd3vJT.js} +1 -1
  42. package/dist/client/assets/{Upload01-DbpOiMD9.js → Upload01-BDYtsE0t.js} +1 -1
  43. package/dist/client/assets/{User01-xEWYNlJX.js → User01-Dyqyv5XT.js} +1 -1
  44. package/dist/client/assets/{Users01-CJZJiXpK.js → Users01-DZiTZbeH.js} +1 -1
  45. package/dist/client/assets/{Users03-aGMnn7GC.js → Users03-BVzZ7I4i.js} +1 -1
  46. package/dist/client/assets/{X-CPPWzFGv.js → X-NFs01Z9e.js} +1 -1
  47. package/dist/client/assets/{XCircle-DiqaNpK5.js → XCircle-Iin33a2j.js} +1 -1
  48. package/dist/client/assets/{XClose-DmdEfX7d.js → XClose-CBND9vXo.js} +1 -1
  49. package/dist/client/assets/{Zap-BrN9iJhf.js → Zap-DLWTPE22.js} +1 -1
  50. package/dist/client/assets/{ZapSquare-D3etv_p8.js → ZapSquare-EIutPaVP.js} +1 -1
  51. package/dist/client/assets/{access-gate-C6VLyHTX.js → access-gate-DQEWD7a7.js} +1 -1
  52. package/dist/client/assets/{agent-icon-Bvh_dN2q.js → agent-icon-tYsl9rf9.js} +1 -1
  53. package/dist/client/assets/{agents-list-5yWNyWYm.js → agents-list-Xtfa9ez4.js} +1 -1
  54. package/dist/client/assets/{ai-providers-D-iMsrLU.js → ai-providers-DuDjK6Bk.js} +1 -1
  55. package/dist/client/assets/{alert-DX1Ywn4R.js → alert-BnpcDCDP.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-N5y_pt8L.js → alert-dialog-BFD6K547.js} +1 -1
  57. package/dist/client/assets/{app-editor-C_aXlWBV.js → app-editor-EIq-bCrd.js} +1 -1
  58. package/dist/client/assets/{auth-CVA5G64j.js → auth-BGSdURbR.js} +1 -1
  59. package/dist/client/assets/{auth-catchall--u2uHz-l.js → auth-catchall-C8f9eF9S.js} +1 -1
  60. package/dist/client/assets/{auth-entry-BajIlMdm.js → auth-entry-CKVJXpSu.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-D6WedxZg.js → auth-split-layout-CB9_ikKJ.js} +1 -1
  62. package/dist/client/assets/{authenticate-and-persist-oauth-m-asDg6n.js → authenticate-and-persist-oauth-DRysEq3W.js} +1 -1
  63. package/dist/client/assets/{automation-list-row-DJMycimP.js → automation-list-row-D5DPHf5D.js} +1 -1
  64. package/dist/client/assets/{automation-runs-CqHPmpxv.js → automation-runs-DU_KsyNQ.js} +1 -1
  65. package/dist/client/assets/{automations-C2Lr7QaY.js → automations-Byuf2kXN.js} +1 -1
  66. package/dist/client/assets/{avatar-BWQUoICI.js → avatar-QqLodXpB.js} +1 -1
  67. package/dist/client/assets/{badge-BD99e01N.js → badge-CV_cBugA.js} +1 -1
  68. package/dist/client/assets/{billing-DVQqzRq6.js → billing-BBk_oQIv.js} +2 -2
  69. package/dist/client/assets/{block-document-Dv7Gc42u.js → block-document-CrtLohNk.js} +1 -1
  70. package/dist/client/assets/{brand-context-C0OLaukl.js → brand-context-ykBmS_kH.js} +1 -1
  71. package/dist/client/assets/{buckets-9Z92uR8k.js → buckets-Bj6zhdyA.js} +1 -1
  72. package/dist/client/assets/{bulk-category-panel-BBWt46dQ.js → bulk-category-panel-lUvcURHE.js} +1 -1
  73. package/dist/client/assets/{capability-load-error-aoMpKIlH.js → capability-load-error-D9qH2fQu.js} +1 -1
  74. package/dist/client/assets/{card-Q8NTBpN6.js → card-Dt7bFpWW.js} +1 -1
  75. package/dist/client/assets/{cards-CPa_UBVS.js → cards-B1tevlIV.js} +1 -1
  76. package/dist/client/assets/{category-editor-DJlTri60.js → category-editor-CxSnVNQr.js} +1 -1
  77. package/dist/client/assets/{chat-context-CoLr-7Td.js → chat-context-MWk3JEWX.js} +1 -1
  78. package/dist/client/assets/{checkbox-BASIfudC.js → checkbox-CpUzTkne.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-BGb-r5QN.js → cli-auth-success-BLFl3FAv.js} +1 -1
  80. package/dist/client/assets/{collection-detail-D-wnO3ND.js → collection-detail-abvuSy_2.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-DqZ6npbm.js → collection-display-button-CNEESLLh.js} +1 -1
  82. package/dist/client/assets/{collection-search-DcjOoVI2.js → collection-search-CrIgHi7T.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-Dk-tpqRQ.js → collection-table-wrapper-CKJCl95k.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-B3mYYxtz.js → collection-tabs-BLnznnX1.js} +1 -1
  85. package/dist/client/assets/{command-Ceu-kj97.js → command-Dlp_QE-Q.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-DUJNwI7O.js → commerce-onboarding-C_XUmTqa.js} +1 -1
  87. package/dist/client/assets/{connect-BEPfCsr6.js → connect-D6jF1ctb.js} +1 -1
  88. package/dist/client/assets/{connection-card-Deg3-TR-.js → connection-card-BdPIWlbb.js} +1 -1
  89. package/dist/client/assets/{connection-detail-Bk5VXyWe.js → connection-detail-C0PZNg8B.js} +1 -1
  90. package/dist/client/assets/{connection-form-helpers-CFUSjuXx.js → connection-form-helpers-B1hPYVMc.js} +1 -1
  91. package/dist/client/assets/{connection-DOaeV_kP.js → connection-k1-3F31a.js} +1 -1
  92. package/dist/client/assets/connections-Dl9R3iGS.js +1 -0
  93. package/dist/client/assets/{decopilot-sse-pool-Bq7TSvHG.js → decopilot-sse-pool-CfTcpBf8.js} +1 -1
  94. package/dist/client/assets/{dialog-BZBN7yPR.js → dialog-BRkQoppc.js} +1 -1
  95. package/dist/client/assets/{domain-settings-DrtoaW-K.js → domain-settings-BjaAnyL5.js} +1 -1
  96. package/dist/client/assets/{drawer-Dj5L09kg.js → drawer-DuYF-nKz.js} +1 -1
  97. package/dist/client/assets/{dropdown-menu-DHH3iD92.js → dropdown-menu-CeC_XINV.js} +1 -1
  98. package/dist/client/assets/{empty-state-CMN5pa17.js → empty-state-B6bvpPYK.js} +1 -1
  99. package/dist/client/assets/{extract-connection-data-DAqv-qPI.js → extract-connection-data-kLsSKsGM.js} +1 -1
  100. package/dist/client/assets/{file-explorer-C557qhnE.js → file-explorer-qHvvQbH4.js} +2 -2
  101. package/dist/client/assets/{file-type-icon-DmvBRayd.js → file-type-icon-CWLS5ci_.js} +1 -1
  102. package/dist/client/assets/{form-gddDxci6.js → form-BjD860k4.js} +1 -1
  103. package/dist/client/assets/{general-NAmVMCQn.js → general-Bn-PIynX.js} +1 -1
  104. package/dist/client/assets/{github-repo-picker-DoldcKAI.js → github-repo-picker-CJSaq-iT.js} +1 -1
  105. package/dist/client/assets/{hooks-BivAORDM.js → hooks-DeqnuCHC.js} +1 -1
  106. package/dist/client/assets/{index-D6wAeEnj.js → index-15Gp4vyN.js} +1 -1
  107. package/dist/client/assets/{index-C3e4oIeI.js → index-BXhXCExd.js} +1 -1
  108. package/dist/client/assets/{index-BXVYW9oP.js → index-Ce7wzSlG.js} +36 -36
  109. package/dist/client/assets/{index-BLUB_qjx.js → index-CqxQikd0.js} +1 -1
  110. package/dist/client/assets/{index-vqCvC9eJ.js → index-CrwluOcd.js} +1 -1
  111. package/dist/client/assets/{index-BI8RlZy1.js → index-D5CA2hs9.js} +6 -6
  112. package/dist/client/assets/{index-BZh9-lzE.js → index-DaxZehX5.js} +4 -4
  113. package/dist/client/assets/{index-DGR7yvKF.js → index-DsmxQAeO.js} +1 -1
  114. package/dist/client/assets/{index-DdGA8161.js → index-DugPB3K1.js} +1 -1
  115. package/dist/client/assets/{index-redirect-CTbbS_hA.js → index-redirect-Bhw89FOF.js} +1 -1
  116. package/dist/client/assets/{index-CZBiyydb.js → index-wkaqGAxQ.js} +1 -1
  117. package/dist/client/assets/{input-DtyDjASp.js → input-DLBQv69K.js} +1 -1
  118. package/dist/client/assets/{integration-icon-C9RLqPaZ.js → integration-icon-DDsS_Lrd.js} +1 -1
  119. package/dist/client/assets/{invite-member-dialog-Br5PsR4J.js → invite-member-dialog-DbrCssdm.js} +1 -1
  120. package/dist/client/assets/{label-D2Kr2ps4.js → label-Bu3ltt0f.js} +1 -1
  121. package/dist/client/assets/{layout-_DSy7bld.js → layout-Ct7-0zrn.js} +1 -1
  122. package/dist/client/assets/{login-B-vpJ6Sv.js → login-CJmVZn4S.js} +1 -1
  123. package/dist/client/assets/{mcp-oauth-D6VatWgr.js → mcp-oauth-CwQVc4wK.js} +1 -1
  124. package/dist/client/assets/{members-CqY-mSvl.js → members-DUx6fvD_.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-D6W9Jn6M.js → monaco-editor-CrcOoYiL.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-BYYAmZwq.js → monitoring-stats-row-BHwg0PBY.js} +3 -3
  127. package/dist/client/assets/{multi-select-F0tvBxHe.js → multi-select-BOz_jhvD.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-Duy_WTtg.js → oauth-callback-Dyz1CVAe.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-ai-provider-BbYdrMki.js → oauth-callback-ai-provider-BiquI4HU.js} +1 -1
  130. package/dist/client/assets/{onboarding-D8vUdXJm.js → onboarding-5ZzyqAdD.js} +1 -1
  131. package/dist/client/assets/{org-layout-PT-cdJq6.js → org-layout-CkYgjwRU.js} +1 -1
  132. package/dist/client/assets/{organization-choice-B4oxFfFi.js → organization-choice-rJQ9Q3J9.js} +1 -1
  133. package/dist/client/assets/{orgs-B72jiP78.js → orgs-Bid9NFiW.js} +1 -1
  134. package/dist/client/assets/{page-seo-form-D9BIlNMP.js → page-seo-form-t_07N54I.js} +1 -1
  135. package/dist/client/assets/{popover-f75RcDnM.js → popover-PwNxRDTf.js} +1 -1
  136. package/dist/client/assets/{post-editor-aKLsNoxQ.js → post-editor-BzSHIlM4.js} +1 -1
  137. package/dist/client/assets/{primitives-BulEqTk5.js → primitives-CM4Mgah8.js} +1 -1
  138. package/dist/client/assets/{profile-Bz5nmZG8.js → profile-DdQOCW-W.js} +1 -1
  139. package/dist/client/assets/{project-app-view-CrLLWzk_.js → project-app-view-DmXmZ-N6.js} +1 -1
  140. package/dist/client/assets/record-editor-J_gnlcq5.js +1 -0
  141. package/dist/client/assets/redirect-editor-DA_xg2De.js +1 -0
  142. package/dist/client/assets/registry-BQUckycR.js +2 -0
  143. package/dist/client/assets/{registry-layout-L13Wfh9O.js → registry-layout-DvtMYXSQ.js} +1 -1
  144. package/dist/client/assets/{reports-CQfwgHi2.js → reports-BREB4Uzx.js} +1 -1
  145. package/dist/client/assets/{require-capability-DQT0lYQq.js → require-capability-I_xvxUX8.js} +1 -1
  146. package/dist/client/assets/{required-auth-layout-D7c0rFdn.js → required-auth-layout-Du_oyovS.js} +1 -1
  147. package/dist/client/assets/{reset-password-BMk18Luc.js → reset-password-DI_jehz0.js} +1 -1
  148. package/dist/client/assets/{roles-wTfozYTs.js → roles-FaShxS3j.js} +1 -1
  149. package/dist/client/assets/{search-input-Cf-LChTS.js → search-input-WW1nmYiH.js} +1 -1
  150. package/dist/client/assets/{secrets-OFSQumDS.js → secrets-CEIhIt9L.js} +1 -1
  151. package/dist/client/assets/{sections-editor-Bwa2gdDU.js → sections-editor-DvdcOepw.js} +1 -1
  152. package/dist/client/assets/{select-aJ268xVp.js → select-D3VWqZ6O.js} +1 -1
  153. package/dist/client/assets/{select-model-CPsRo-oU.js → select-model-B12SxmPa.js} +2 -2
  154. package/dist/client/assets/self-tool-result-P4srATyh.js +1 -0
  155. package/dist/client/assets/{seo-editor-B9rgHeRD.js → seo-editor-Cxi1K5DF.js} +1 -1
  156. package/dist/client/assets/{settings-layout-B6Iq9TWm.js → settings-layout-DaOYARaR.js} +1 -1
  157. package/dist/client/assets/{settings-section-LwQq77KG.js → settings-section-DOF-L-RB.js} +1 -1
  158. package/dist/client/assets/{shell-controls-BX1rmK9p.js → shell-controls-Cn61lFh_.js} +1 -1
  159. package/dist/client/assets/{shell-layout-CPkbkQME.js → shell-layout-DCPnq29F.js} +1 -1
  160. package/dist/client/assets/{sidebar-D0z5Cxuk.js → sidebar-CHd6y1Ct.js} +1 -1
  161. package/dist/client/assets/{skeleton-SjlBCcjX.js → skeleton-BVGrCPJ-.js} +1 -1
  162. package/dist/client/assets/{spinner-CQMfz22E.js → spinner-BCLwugRZ.js} +1 -1
  163. package/dist/client/assets/{sso-C_4KT5op.js → sso-DXo55OWQ.js} +1 -1
  164. package/dist/client/assets/{store-kZT1zfks.js → store-CrrE4BOr.js} +1 -1
  165. package/dist/client/assets/store-registry-Cp3S6oOP.js +2 -0
  166. package/dist/client/assets/{studio-tools-B0_AcSKZ.js → studio-tools-9EYu19Cv.js} +1 -1
  167. package/dist/client/assets/{switch-CIB0IRpT.js → switch-Ce9_wN_9.js} +1 -1
  168. package/dist/client/assets/{synced-repos-DMVeJBA2.js → synced-repos-CGS_HKPX.js} +1 -1
  169. package/dist/client/assets/{tab-id-Byz2SGQX.js → tab-id-BJBaiO6k.js} +1 -1
  170. package/dist/client/assets/{table-DfBXbFhT.js → table-BazdsZQr.js} +1 -1
  171. package/dist/client/assets/{tabs-CI8QRrap.js → tabs-B_UfMbu-.js} +1 -1
  172. package/dist/client/assets/{textarea-BUW4RF90.js → textarea-DP4wAcHO.js} +1 -1
  173. package/dist/client/assets/{toggle-group-toV2h8do.js → toggle-group-Dr-b0W6O.js} +1 -1
  174. package/dist/client/assets/{toolbar-xM6JfAiK.js → toolbar-aj087TVf.js} +1 -1
  175. package/dist/client/assets/{tooltip-CB-3W3BK.js → tooltip-Ddk2UF0M.js} +1 -1
  176. package/dist/client/assets/{track-AKOKRozN.js → track-BG0UIYkX.js} +1 -1
  177. package/dist/client/assets/{use-ai-providers-0mfYVNtG.js → use-ai-providers-_AriHZw0.js} +1 -1
  178. package/dist/client/assets/{use-automations-zV3k_hCm.js → use-automations-CyYE_hVV.js} +1 -1
  179. package/dist/client/assets/{use-autosave-CCaPm49b.js → use-autosave-DQVq2EmC.js} +1 -1
  180. package/dist/client/assets/{use-capability-Bx72zdZ_.js → use-capability-BCL58O59.js} +1 -1
  181. package/dist/client/assets/{use-clock-tick-C6Dl4_Ba.js → use-clock-tick-i-HFZ1a_.js} +1 -1
  182. package/dist/client/assets/{use-connection-CU1SASjJ.js → use-connection-3LK27F94.js} +1 -1
  183. package/dist/client/assets/{use-copy-Ba8GdO7e.js → use-copy-DOXoQchn.js} +1 -1
  184. package/dist/client/assets/{use-create-virtual-mcp-CyajPsvg.js → use-create-virtual-mcp-CGm_4d0e.js} +1 -1
  185. package/dist/client/assets/{use-debounced-autosave-XWEF6ylb.js → use-debounced-autosave-B1d6oEqY.js} +1 -1
  186. package/dist/client/assets/{use-debounced-value-DaP2Vfp5.js → use-debounced-value-CNx8tv1w.js} +1 -1
  187. package/dist/client/assets/{use-deco-credits-D5amWKZw.js → use-deco-credits-Dp0W-Hpc.js} +1 -1
  188. package/dist/client/assets/{use-decopilot-events-DT8RjZZF.js → use-decopilot-events-DMN09RA1.js} +1 -1
  189. package/dist/client/assets/{use-delete-connection-DWapIKyB.js → use-delete-connection-BsLfePq4.js} +1 -1
  190. package/dist/client/assets/{use-deployment-admin-CQ19naZH.js → use-deployment-admin-D6EwkhC6.js} +1 -1
  191. package/dist/client/assets/{use-file-configs-we2-KED_.js → use-file-configs-lXfU4jxU.js} +1 -1
  192. package/dist/client/assets/{use-infinite-scroll-f_QDwgM2.js → use-infinite-scroll-BrpE3bFb.js} +1 -1
  193. package/dist/client/assets/{use-join-requests-CM9otB1q.js → use-join-requests-BjkJksC_.js} +1 -1
  194. package/dist/client/assets/{use-mcp-client-B3Khr26S.js → use-mcp-client-Bd6XHVt1.js} +4 -4
  195. package/dist/client/assets/{use-mcp-tools-DWI2d4P3.js → use-mcp-tools-DB8B57k0.js} +1 -1
  196. package/dist/client/assets/{use-members-nTp0kq-0.js → use-members-Dho3_Q8z.js} +1 -1
  197. package/dist/client/assets/{use-mobile-BY2sIYXP.js → use-mobile-DM0DUpr3.js} +1 -1
  198. package/dist/client/assets/{use-navigate-to-agent-BHUKMXo3.js → use-navigate-to-agent-DOrZy0up.js} +1 -1
  199. package/dist/client/assets/{use-open-billing-url-95NAs9uM.js → use-open-billing-url-CfkRZNP3.js} +1 -1
  200. package/dist/client/assets/{use-org-auth-client-DNlUjzOt.js → use-org-auth-client-2AF9YuHH.js} +1 -1
  201. package/dist/client/assets/{use-org-sso-BnAzSLsE.js → use-org-sso-KldGzQMx.js} +1 -1
  202. package/dist/client/assets/{use-organization-roles-ISpyLphz.js → use-organization-roles-9Dg6SJdN.js} +1 -1
  203. package/dist/client/assets/{use-organization-settings-DfmtKg6Y.js → use-organization-settings-DebQZ72D.js} +1 -1
  204. package/dist/client/assets/{use-registry-connections-CDv9RFLk.js → use-registry-connections-DMtB0M_t.js} +1 -1
  205. package/dist/client/assets/{use-secrets-C_hE5_Ph.js → use-secrets-DvfKEove.js} +1 -1
  206. package/dist/client/assets/{use-section-preview-base-DtbFyFHR.js → use-section-preview-base-Cpg3CUDp.js} +1 -1
  207. package/dist/client/assets/{use-status-sounds-Bhnnb3cr.js → use-status-sounds-Dcpo4Ugg.js} +1 -1
  208. package/dist/client/assets/{use-tags-BDvedplZ.js → use-tags-BkfXT29z.js} +1 -1
  209. package/dist/client/assets/{use-view-mode-D9uXQ7e4.js → use-view-mode-Du9tSFNk.js} +1 -1
  210. package/dist/client/assets/{use-virtual-mcp-C-5DJUHP.js → use-virtual-mcp-CWHDMpbS.js} +1 -1
  211. package/dist/client/assets/useInfiniteQuery-D3bS8I-l.js +1 -0
  212. package/dist/client/assets/{useRouterState-Cv8oHX_r.js → useRouterState-CizG-ZOX.js} +1 -1
  213. package/dist/client/assets/useSuspenseInfiniteQuery-CvmxgTX4.js +1 -0
  214. package/dist/client/assets/{users-BHiQlXv0.js → users-nmR-M5b6.js} +1 -1
  215. package/dist/client/assets/{variant-calendar-6Gxt9aCh.js → variant-calendar-E5Hn2ZNx.js} +1 -1
  216. package/dist/client/assets/{view-mode-toggle-bHA445xz.js → view-mode-toggle-BM7KOgO6.js} +1 -1
  217. package/dist/client/index.html +1 -1
  218. package/dist/server/cli.js +437 -437
  219. package/dist/server/server.js +300 -300
  220. package/package.json +1 -1
  221. package/dist/client/assets/connections-LSfHgCu1.js +0 -1
  222. package/dist/client/assets/record-editor-Ex3YfX4K.js +0 -1
  223. package/dist/client/assets/redirect-editor-BoPWn8Ri.js +0 -1
  224. package/dist/client/assets/registry-DpLBrpGJ.js +0 -2
  225. package/dist/client/assets/self-tool-result-DXhPzl10.js +0 -1
  226. package/dist/client/assets/store-registry-Jb0qyTz9.js +0 -2
  227. package/dist/client/assets/useInfiniteQuery-BhIEZ0f1.js +0 -1
  228. package/dist/client/assets/useSuspenseInfiniteQuery-Dlc1Th2H.js +0 -1
@@ -1 +1 @@
1
- import{c as z,b as B,j as t,y as Vt,B as te,r as V,aR as Rt,d as nt,s as Ht,m as K,a as re,t as H,w as Ut,k as De,p as E,F as oe,f as st,u as ot,L as Kt,D as qt,a1 as Gt,a2 as Xt,I as Qt,G as Wt,K as it,o as Yt,n as Jt}from"./index-BXVYW9oP.js";import{i as Zt}from"./ChevronRight-DRaQJ8sH.js";import{i as en}from"./X-CPPWzFGv.js";import{aD as tn,Q as nn,A as gt,g as sn,ae as on}from"./agent-icon-Bvh_dN2q.js";import{t as ht}from"./ChevronDown-CK4ZVZU5.js";import{T as Ce,a as ye,c as Ne}from"./tooltip-CB-3W3BK.js";import{u as pt,d as xt,c as jt}from"./sidebar-D0z5Cxuk.js";import{a as at,i as an,f as ln,S as cn,u as rn}from"./use-mcp-client-B3Khr26S.js";import{a as dn,u as un}from"./use-virtual-mcp-C-5DJUHP.js";import{a as Le,b as vt,P as bt}from"./popover-f75RcDnM.js";import{i as Ee}from"./Check-C9YirVC4.js";import{s as we}from"./Plus-Dm4WmNSG.js";import{i as Ct}from"./SearchMd-CfFkukig.js";import{s as yt}from"./XClose-DmdEfX7d.js";import{C as mn}from"./self-tool-result-DXhPzl10.js";import{T as Nt}from"./toolbar-xM6JfAiK.js";import{S as fn}from"./skeleton-SjlBCcjX.js";import{D as wt,a as _t,b as St,c as gn,g as hn,e as pn,f as xn}from"./drawer-Dj5L09kg.js";import{u as kt}from"./use-mobile-BY2sIYXP.js";import{a as jn,G as vn}from"./github-repo-picker-DoldcKAI.js";import{g as bn,b as Cn,a as Dt}from"./hooks-BivAORDM.js";import{u as yn,g as Nn,a as wn,b as _n}from"./use-navigate-to-agent-BHUKMXo3.js";import{a as Sn,c as It}from"./agent-capabilities-cXfbMfjV.js";import{u as At}from"./shell-layout-CPkbkQME.js";import{f as kn}from"./reusable-new-chat-CouMjkYR.js";import{C as Dn}from"./collection-search-DcjOoVI2.js";import{g as In,a as An,b as Pn,e as Tn}from"./extract-connection-data-DAqv-qPI.js";import{u as Pt,a as Tt,g as zn,C as Ye}from"./connection-card-Deg3-TR-.js";import{e as zt,d as Ot,a as Mt,b as $t,h as On,c as Mn}from"./dialog-BZBN7yPR.js";import{d as W,a as Y,e as J,b as Z,c as ee,F as dt}from"./form-gddDxci6.js";import{I as ce}from"./input-DtyDjASp.js";import{S as $n,a as Fn,b as Bn,c as Ln,d as ke}from"./select-aJ268xVp.js";import{T as En}from"./textarea-BUW4RF90.js";import{b as Ft}from"./use-connection-CU1SASjJ.js";import{n as Be,i as Je}from"./Tool02-DrvkBQ68.js";import{s as Ze}from"./Star01-CxRj8IxJ.js";import{c as Vn,i as $e,a as ut,E as Rn,p as Hn,b as Un,d as Kn}from"./connection-form-helpers-CFUSjuXx.js";import{a as et}from"./authenticate-and-persist-oauth-m-asDg6n.js";import{g as qn}from"./connection-slug-eyAPH6o3.js";import{C as Gn}from"./collection-tabs-B3mYYxtz.js";import{u as mt}from"./use-infinite-scroll-f_QDwgM2.js";import{B as Fe}from"./badge-BD99e01N.js";import{u as Xn}from"./useSuspenseInfiniteQuery-Dlc1Th2H.js";import{g as Ve}from"./metadata-dUsYcpuu.js";import{u as Qn}from"./studio-tools-B0_AcSKZ.js";import{u as Wn}from"./use-ai-providers-0mfYVNtG.js";const Yn="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Jn(){const n=z.c(13),e=B();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 o;n[1]!==e?(o=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=o):o=n[2];let a;n[3]!==o?(a=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",o,"”"]}),n[3]=o,n[4]=a):a=n[4];let i;n[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("img",{src:Yn,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=i):i=n[5];let c;n[6]!==e?(c=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=c):c=n[7];let r;n[8]!==c?(r=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[i,t.jsx("span",{className:"text-base font-medium",children:c})]}),n[8]=c,n[9]=r):r=n[9];let l;return n[10]!==a||n[11]!==r?(l=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,a,r]}),n[10]=a,n[11]=r,n[12]=l):l=n[12],l}function Zn(){const n=z.c(19),e=B();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let o;n[2]!==s?(o={Icon:tn,label:s},n[2]=s,n[3]=o):o=n[3];let a;n[4]!==e?(a=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=a):a=n[5];let i;n[6]!==a?(i={Icon:Vt,label:a},n[6]=a,n[7]=i):i=n[7];let c;n[8]!==e?(c=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=c):c=n[9];let r;n[10]!==c?(r={Icon:nn,label:c},n[10]=c,n[11]=r):r=n[11];let l;n[12]!==o||n[13]!==i||n[14]!==r?(l=[o,i,r],n[12]=o,n[13]=i,n[14]=r,n[15]=l):l=n[15];const u=l;let m;n[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=m):m=n[16];let f;return n[17]!==u?(f=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[m,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:u.map(es)})]}),n[17]=u,n[18]=f):f=n[18],f}function es(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 To(n){const e=z.c(22),{siteHost:s,footer:o,onClose:a,children:i}=n,c=B(),r=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let l;e[0]!==a||e[1]!==c?(l=a&&t.jsx("button",{type:"button",onClick:a,"aria-label":c("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(en,{size:18})}),e[0]=a,e[1]=c,e[2]=l):l=e[2];let u,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),m=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=u,e[4]=m):(u=e[3],m=e[4]);let f;e[5]!==r||e[6]!==s?(f=s&&t.jsxs(t.Fragment,{children:[t.jsx(Zt,{size:16,className:"shrink-0 text-foreground/25"}),r&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:r,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=r,e[6]=s,e[7]=f):f=e[7];let d;e[8]!==f?(d=t.jsxs("div",{className:"flex items-center gap-2",children:[u,m,f]}),e[8]=f,e[9]=d):d=e[9];let h;e[10]!==o?(h=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:o}),e[10]=o,e[11]=h):h=e[11];let C;e[12]!==i||e[13]!==d||e[14]!==h?(C=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[d,i,h]}),e[12]=i,e[13]=d,e[14]=h,e[15]=C):C=e[15];let p,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=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]=p,e[17]=g):(p=e[16],g=e[17]);let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[p,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Jn,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Zn,{})]})]}),e[18]=j):j=e[18];let v;return e[19]!==l||e[20]!==C?(v=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[l,C,j]}),e[19]=l,e[20]=C,e[21]=v):v=e[21],v}function zo(n){const e=z.c(5),{ready:s,pending:o,label:a,onClick:i,children:c}=n,r=o||!s,l=s&&!o?c:null;let u;return e[0]!==a||e[1]!==i||e[2]!==r||e[3]!==l?(u=t.jsxs(te,{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:i,disabled:r,children:[a,l]}),e[0]=a,e[1]=i,e[2]=r,e[3]=l,e[4]=u):u=e[4],u}function Bt(){const n=V.useContext(Rt),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(a=>a.status==="pending"&&new Date(a.expiresAt)>new Date),refetch:()=>s?.()}}function ts(n){let e=0;for(let o=0;o<n.length;o++)e=n.charCodeAt(o)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function lt(n){const e=z.c(13),{org:s,size:o}=n,a=o===void 0?"sm":o,i=a==="xs"?"size-5":"size-6",c=a==="xs"?"text-[9px]":"text-xs";let r;e[0]!==i?(r=K(i,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s.logo||e[3]!==s.name?(l=s.logo?void 0:ts(s.name),e[2]=s.logo,e[3]=s.name,e[4]=l):l=e[4];let u;e[5]!==s.logo||e[6]!==s.name||e[7]!==c?(u=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:K("font-semibold leading-none",c),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=c,e[8]=u):u=e[8];let m;return e[9]!==r||e[10]!==l||e[11]!==u?(m=t.jsx("div",{className:r,style:l,children:u}),e[9]=r,e[10]=l,e[11]=u,e[12]=m):m=e[12],m}function ns({invitation:n,onChanged:e}){const s=B(),[o,a]=V.useState(!1),i=n.organizationName??s("header.orgSwitcher.unknownOrganization"),c=async()=>{a(!0);try{const u=await re.organization.acceptInvitation({invitationId:n.id});if(u.error){H.error(u.error.message),a(!1);return}}catch{H.error(s("header.orgSwitcher.failedToAcceptInvitation")),a(!1);return}H.success(s("header.orgSwitcher.joined",{name:i})),Ut();let l;try{l=(await re.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=l?`/${l}`:"/"},r=async()=>{a(!0);try{const l=await re.organization.rejectInvitation({invitationId:n.id});if(l.error){H.error(l.error.message),a(!1);return}H.success(s("header.orgSwitcher.invitationDeclined")),a(!1),e()}catch{H.error(s("header.orgSwitcher.failedToDeclineInvitation")),a(!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(lt,{org:{name:i},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:i}),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(te,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:c,disabled:o,children:s("header.orgSwitcher.accept")}),t.jsx(te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:r,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:i}),children:t.jsx(yt,{size:14})})]})]})}function ss(n){const e=z.c(32),{orgParam:s,onSelectOrg:o,onCreateOrg:a}=n,i=B(),{data:c}=Ht(),{invitations:r,refetch:l}=Bt();let u;e[0]!==s?(u=(I,A)=>I.slug===s?-1:A.slug===s?1:I.name.localeCompare(A.name),e[0]=s,e[1]=u):u=e[1];const m=[...c??[]].sort(u),[f,d]=V.useState(""),h=f.toLowerCase(),C=h?m.filter(I=>I.name.toLowerCase().includes(h)||I.slug.toLowerCase().includes(h)):m;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ct,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=p):p=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=I=>d(I.target.value),e[3]=g):g=e[3];let j;e[4]!==f?(j=I=>I.key==="Escape"&&f&&d(""),e[4]=f,e[5]=j):j=e[5];let v;e[6]!==i?(v=i("header.orgSwitcher.searchOrganizations"),e[6]=i,e[7]=v):v=e[7];let b;e[8]!==f||e[9]!==j||e[10]!==v?(b=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:f,onChange:g,onKeyDown:j,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=f,e[9]=j,e[10]=v,e[11]=b):b=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(we,{size:16}),e[12]=w):w=e[12];let S;e[13]!==a?(S=t.jsx("button",{type:"button",onClick:a,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:w}),e[13]=a,e[14]=S):S=e[14];let D;e[15]!==b||e[16]!==S?(D=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[p,b,S]}),e[15]=b,e[16]=S,e[17]=D):D=e[17];const O="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let x;e[18]!==r||e[19]!==f||e[20]!==l?(x=!f&&r.map(I=>t.jsx(ns,{invitation:I,onChanged:l},I.id)),e[18]=r,e[19]=f,e[20]=l,e[21]=x):x=e[21];const k=C.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:f?i("header.orgSwitcher.noOrganizationsMatch",{query:f}):i("header.orgSwitcher.noOrganizationsAvailable")});let T;e[22]!==o||e[23]!==s?(T=I=>t.jsxs("button",{type:"button",onClick:()=>o(I.slug),className:K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",I.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(lt,{org:I,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:I.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.slug})]}),I.slug===s&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},I.id),e[22]=o,e[23]=s,e[24]=T):T=e[24];const N=C.map(T);let y;e[25]!==x||e[26]!==k||e[27]!==N?(y=t.jsxs("div",{className:O,children:[x,k,N]}),e[25]=x,e[26]=k,e[27]=N,e[28]=y):y=e[28];let P;return e[29]!==y||e[30]!==D?(P=t.jsxs(t.Fragment,{children:[D,y]}),e[29]=y,e[30]=D,e[31]=P):P=e[31],P}function os(n){const e=z.c(22),{trigger:s,orgParam:o,align:a,side:i}=n,c=a===void 0?"start":a,r=i===void 0?"bottom":i,l=nt(),[u,m]=V.useState(!1),[f,d]=V.useState(!1);let h;e[0]!==s?(h=t.jsx(Le,{asChild:!0,children:s}),e[0]=s,e[1]=h):h=e[1];const C=String(u);let p;e[2]!==l?(p=D=>{m(!1),l({to:"/$org",params:{org:D}})},e[2]=l,e[3]=p):p=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{m(!1),d(!0)},e[4]=g):g=e[4];let j;e[5]!==o||e[6]!==C||e[7]!==p?(j=t.jsx(ss,{orgParam:o,onSelectOrg:p,onCreateOrg:g},C),e[5]=o,e[6]=C,e[7]=p,e[8]=j):j=e[8];let v;e[9]!==c||e[10]!==r||e[11]!==j?(v=t.jsx(vt,{side:r,align:c,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:as,onCloseAutoFocus:is,children:j}),e[9]=c,e[10]=r,e[11]=j,e[12]=v):v=e[12];let b;e[13]!==u||e[14]!==h||e[15]!==v?(b=t.jsxs(bt,{open:u,onOpenChange:m,children:[h,v]}),e[13]=u,e[14]=h,e[15]=v,e[16]=b):b=e[16];let w;e[17]!==f?(w=t.jsx(mn,{open:f,onOpenChange:d}),e[17]=f,e[18]=w):w=e[18];let S;return e[19]!==w||e[20]!==b?(S=t.jsxs(t.Fragment,{children:[b,w]}),e[19]=w,e[20]=b,e[21]=S):S=e[21],S}function is(n){return n.preventDefault()}function as(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ls(n){const e=z.c(21),{value:s,onChange:o,placeholder:a,onKeyDown:i,className:c,isSearching:r,disabled:l}=n,u=a===void 0?"Search...":a;let m;e[0]!==c?(m=K("shrink-0 w-full border-b border-border h-12",c),e[0]=c,e[1]=m):m=e[1];const f=l?"cursor-not-allowed opacity-50":"cursor-text";let d;e[2]!==f?(d=K("flex items-center gap-2.5 h-12 px-4",f),e[2]=f,e[3]=d):d=e[3];let h;e[4]!==r?(h=r?t.jsx(De,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Ct,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=r,e[5]=h):h=e[5];let C;e[6]!==o?(C=v=>o(v.target.value),e[6]=o,e[7]=C):C=e[7];let p;e[8]!==l||e[9]!==i||e[10]!==u||e[11]!==C||e[12]!==s?(p=t.jsx("input",{type:"text",value:s,onChange:C,onKeyDown:i,placeholder:u,disabled:l,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=l,e[9]=i,e[10]=u,e[11]=C,e[12]=s,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==h||e[16]!==p?(g=t.jsxs("label",{className:d,children:[h,p]}),e[14]=d,e[15]=h,e[16]=p,e[17]=g):g=e[17];let j;return e[18]!==m||e[19]!==g?(j=t.jsx("div",{className:m,children:g}),e[18]=m,e[19]=g,e[20]=j):j=e[20],j}function cs(n,e,s){if(!s)return null;const o=bn(n,e);return o?o.threads.get().find(i=>i.id===s)?.branch??null:null}function rs(n){const e=z.c(6),{value:s,onChange:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.searchAgents"),e[0]=a,e[1]=i):i=e[1];let c;return e[2]!==o||e[3]!==i||e[4]!==s?(c=t.jsx(ls,{value:s,onChange:o,placeholder:i}),e[2]=o,e[3]=i,e[4]=s,e[5]=c):c=e[5],c}function ds(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=o):o=n[3],o}function us(n){const e=z.c(10),{org:s,onClose:o}=n,a=B();let i;e[0]!==s.slug?(i={org:s.slug},e[0]=s.slug,e[1]=i):i=e[1];let c;e[2]!==o?(c=()=>o(),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==a?(r=a("sidebar.agentsSection.seeAllAgents"),e[4]=a,e[5]=r):r=e[5];let l;return e[6]!==i||e[7]!==c||e[8]!==r?(l=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(Kt,{to:"/$org/settings/agents",params:i,onClick:c,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:r})}),e[6]=i,e[7]=c,e[8]=r,e[9]=l):l=e[9],l}function ms(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(Lt,{children:s}),n[2]=s,n[3]=o):o=n[3],o}function fs(n){const e=z.c(11),{onImportFromGithub:s}=n,o=B();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(vn,{className:"size-3.5"}),e[0]=a):a=e[0];let i;e[1]!==o?(i=o("sidebar.agentsSection.import"),e[1]=o,e[2]=i):i=e[2];let c;e[3]!==s||e[4]!==i?(c=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:[a,i]}),e[3]=s,e[4]=i,e[5]=c):c=e[5];let r;e[6]!==o?(r=o("sidebar.agentsSection.codeAgents"),e[6]=o,e[7]=r):r=e[7];let l;return e[8]!==c||e[9]!==r?(l=t.jsx(Lt,{action:c,children:r}),e[8]=c,e[9]=r,e[10]=l):l=e[10],l}function gs(n){const e=z.c(11),{setOpen:s,emptyCtaClass:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.browseAgents"),e[0]=a,e[1]=i):i=e[1];let c;e[2]!==o?(c=K(o),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==s?(r=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{className:"size-4"}),e[6]=l):l=e[6];let u;return e[7]!==i||e[8]!==c||e[9]!==r?(u=t.jsx(Nt,{"aria-label":i,className:c,onClick:r,children:l}),e[7]=i,e[8]=c,e[9]=r,e[10]=u):u=e[10],u}function hs(n){const e=z.c(17),{setOpen:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]!==s?(l=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=l):l=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(we,{}),e[7]=u):u=e[7];let m;e[8]!==i?(m=i("sidebar.agentsSection.newAgent"),e[8]=i,e[9]=m):m=e[9];let f;e[10]!==m?(f=t.jsx("span",{children:m}),e[10]=m,e[11]=f):f=e[11];let d;return e[12]!==c||e[13]!==r||e[14]!==l||e[15]!==f?(d=t.jsx(xt,{children:t.jsxs(jt,{tooltip:c,className:r,onClick:l,children:[u,f]})}),e[12]=c,e[13]=r,e[14]=l,e[15]=f,e[16]=d):d=e[16],d}function ps(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(St,{className:"sr-only",children:s}),n[2]=s,n[3]=o):o=n[3],o}function xs(n){const e=z.c(8),{emptyCtaClass:s}=n,o=B();let a;e[0]!==o?(a=o("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a):a=e[1];let i;e[2]!==s?(i=K(s),e[2]=s,e[3]=i):i=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{className:"size-4"}),e[4]=c):c=e[4];let r;return e[5]!==a||e[6]!==i?(r=t.jsx(Nt,{"aria-label":a,className:i,children:c}),e[5]=a,e[6]=i,e[7]=r):r=e[7],r}function js(n){const e=z.c(19),{wrapEmptyHint:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{}),e[5]=l):l=e[5];let u;e[6]!==i?(u=i("sidebar.agentsSection.newAgent"),e[6]=i,e[7]=u):u=e[7];let m;e[8]!==u?(m=t.jsx("span",{children:u}),e[8]=u,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==r||e[12]!==m?(f=t.jsx(Le,{asChild:!0,children:t.jsxs(jt,{tooltip:c,className:r,children:[l,m]})}),e[10]=c,e[11]=r,e[12]=m,e[13]=f):f=e[13];let d;e[14]!==f||e[15]!==s?(d=s(f),e[14]=f,e[15]=s,e[16]=d):d=e[16];let h;return e[17]!==d?(h=t.jsx(xt,{children:d}),e[17]=d,e[18]=h):h=e[18],h}function vs(n){const e=z.c(9),{children:s}=n,o=B();let a;e[0]!==s?(a=t.jsx(Ce,{asChild:!0,children:s}),e[0]=s,e[1]=a):a=e[1];let i;e[2]!==o?(i=o("sidebar.agentsSection.selectAnExistingAgent"),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==i?(c=t.jsx(ye,{side:"right",sideOffset:8,children:i}),e[4]=i,e[5]=c):c=e[5];let r;return e[6]!==a||e[7]!==c?(r=t.jsxs(Ne,{defaultOpen:!0,delayDuration:0,children:[a,c]}),e[6]=a,e[7]=c,e[8]=r):r=e[8],r}function bs(n){const e=nt(),{create:s}=Cn(),{locator:o}=oe(),a=st({strict:!1}),i=ot({strict:!1});return async c=>{const r=crypto.randomUUID(),l=c===i.virtualmcpid?cs(n,o,a.taskId??""):null;try{await s({id:r,virtual_mcp_id:c,...l?{branch:l}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:r},search:{virtualmcpid:c}})}}function tt(n){const e=z.c(20),{agent:s,selected:o,onClick:a}=n,i=o?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let c;e[0]!==i?(c=K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==s.icon||e[3]!==s.title?(r=t.jsx(gt,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=r):r=e[4];let l;e[5]!==s.title?(l=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=l):l=e[6];let u;e[7]!==s.description?(u=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=u):u=e[8];let m;e[9]!==l||e[10]!==u?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,u]}),e[9]=l,e[10]=u,e[11]=m):m=e[11];let f;e[12]!==o?(f=o&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=o,e[13]=f):f=e[13];let d;return e[14]!==a||e[15]!==c||e[16]!==r||e[17]!==m||e[18]!==f?(d=t.jsxs("button",{type:"button",onClick:a,className:c,children:[r,m,f]}),e[14]=a,e[15]=c,e[16]=r,e[17]=m,e[18]=f,e[19]=d):d=e[19],d}function Lt(n){const e=z.c(5),{children:s,action:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let i;return e[2]!==o||e[3]!==a?(i=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[a,o]}),e[2]=o,e[3]=a,e[4]=i):i=e[4],i}function Cs(n){const e=z.c(23),{onClose:s,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:i}=n,[c,r]=V.useState(""),l=dn(),u=l??[],{org:m}=oe(),{data:f}=re.useSession(),d=f?.user?.id??"anon",h=Nn(l),C=wn(),p=bs(m.slug),g=Sn(l),j=c.toLowerCase(),v=u.filter(_s).filter(F=>!g.has(F.id)).filter(ws).filter(F=>!c||F.title.toLowerCase().includes(j)),b=v.filter(Ns),w=v.filter(ys),S=at(m.id),D=!c||S.title.toLowerCase().includes(j),O=!!(o&&D);let x;e[0]!==s||e[1]!==o?(x=()=>{o?.(null),s(),r("")},e[0]=s,e[1]=o,e[2]=x):x=e[2];const k=x,T=F=>{if(o){o(F.id),s(),r("");return}_n({orgId:m.id,userId:d},F.id,h),C(),s(),r(""),p(F.id)},N="flex flex-col max-h-[min(640px,80dvh)]";let y;e[3]!==c?(y=t.jsx(rs,{value:c,onChange:r}),e[3]=c,e[4]=y):y=e[4];const P="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",I=o&&D&&S&&t.jsx(tt,{agent:S,selected:!a||a===S.id,onClick:k}),A=(b.length>0||!c)&&t.jsx(fs,{onImportFromGithub:i}),M=b.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id)),R=w.length>0&&t.jsx(ms,{}),X=w.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id));let L;e[5]!==O||e[6]!==c||e[7]!==v.length?(L=v.length===0&&!O&&c&&t.jsx(ds,{}),e[5]=O,e[6]=c,e[7]=v.length,e[8]=L):L=e[8];let ne;e[9]!==L||e[10]!==I||e[11]!==A||e[12]!==M||e[13]!==R||e[14]!==X?(ne=t.jsxs("div",{className:P,children:[I,A,M,R,X,L]}),e[9]=L,e[10]=I,e[11]=A,e[12]=M,e[13]=R,e[14]=X,e[15]=ne):ne=e[15];let q;e[16]!==s||e[17]!==m?(q=t.jsx(us,{org:m,onClose:s}),e[16]=s,e[17]=m,e[18]=q):q=e[18];let de;return e[19]!==ne||e[20]!==q||e[21]!==y?(de=t.jsxs("div",{className:N,children:[y,ne,q]}),e[19]=ne,e[20]=q,e[21]=y,e[22]=de):de=e[22],de}function ys(n){return!It(n.metadata)}function Ns(n){return It(n.metadata)}function ws(n){return!ln(n.id)}function _s(n){return!an(n.id)}function Ss(n){const e=z.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:o,trigger:a,onSelectAgent:i,selectedAgentId:c,side:r,align:l}=s,u=o===void 0?!1:o,m=r===void 0?"right":r,f=l===void 0?"start":l,[d,h]=V.useState(!1),[C,p]=V.useState(!1),g=kt(),{setOpenMobile:j}=pt(),v=yn(),b=v?"border border-border":void 0;let w;e[2]!==v?(w=A=>v?t.jsx(vs,{children:A}):A,e[2]=v,e[3]=w):w=e[3];const S=w;let D;e[4]!==g||e[5]!==j?(D=()=>{h(!1),g&&j(!1)},e[4]=g,e[5]=j,e[6]=D):D=e[6];const O=D;let x;e[7]!==O?(x=()=>{O(),p(!0)},e[7]=O,e[8]=x):x=e[8];const k=x;let T;e[9]!==O||e[10]!==k||e[11]!==i||e[12]!==d||e[13]!==c?(T=d&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(fn,{className:"h-4 w-24"})}),children:t.jsx(Cs,{onClose:O,onSelectAgent:i,selectedAgentId:c,onImportFromGithub:k})}),e[9]=O,e[10]=k,e[11]=i,e[12]=d,e[13]=c,e[14]=T):T=e[14];const N=T;let y;e[15]!==f||e[16]!==u||e[17]!==b||e[18]!==v||e[19]!==g||e[20]!==d||e[21]!==N||e[22]!==m||e[23]!==a||e[24]!==S?(y=g?t.jsxs(t.Fragment,{children:[a?t.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:a}):u?S(t.jsx(gs,{setOpen:h,emptyCtaClass:b})):t.jsx(hs,{setOpen:h,highlightEmpty:v,emptyCtaClass:b}),t.jsx(wt,{open:d,onOpenChange:h,direction:"bottom",children:t.jsxs(_t,{className:"max-h-[85dvh] p-0",children:[t.jsx(ps,{}),N]})})]}):t.jsxs(bt,{open:d,onOpenChange:A=>{A&&!d&&E("agent_browser_opened",{surface:"desktop_popover"}),h(A)},children:[a?t.jsx(Le,{asChild:!0,children:a}):u?S(t.jsx(Le,{asChild:!0,children:t.jsx(xs,{emptyCtaClass:b})})):t.jsx(js,{wrapEmptyHint:S,highlightEmpty:v,emptyCtaClass:b}),t.jsx(vt,{className:"w-[380px] p-0 overflow-hidden",side:m,align:f,children:N})]}),e[15]=f,e[16]=u,e[17]=b,e[18]=v,e[19]=g,e[20]=d,e[21]=N,e[22]=m,e[23]=a,e[24]=S,e[25]=y):y=e[25];let P;e[26]!==C?(P=t.jsx(jn,{open:C,onOpenChange:p,mode:"agent"}),e[26]=C,e[27]=P):P=e[27];let I;return e[28]!==P||e[29]!==y?(I=t.jsxs(t.Fragment,{children:[y,P]}),e[28]=P,e[29]=y,e[30]=I):I=e[30],I}const ks="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 Ds(n){const e=z.c(29),{agentId:s,fallback:o,onOpenHome:a,onPick:i}=n,c=B(),r=un(s)??o??null;let l,u,m,f,d;e[0]!==r?.title||e[1]!==a||e[2]!==c?(d=r?.title??c("header.shellBreadcrumb.superAgentDefaultName"),f="flex min-w-0 items-center gap-0",l="button",u=a,m=c("header.shellBreadcrumb.openAgentHome",{name:d}),e[0]=r?.title,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=m,e[6]=f,e[7]=d):(l=e[3],u=e[4],m=e[5],f=e[6],d=e[7]);const h=r?.icon??null;let C;e[8]!==h||e[9]!==d?(C=t.jsx(gt,{icon:h,name:d,size:"xs"}),e[8]=h,e[9]=d,e[10]=C):C=e[10];let p;e[11]!==l||e[12]!==u||e[13]!==m||e[14]!==C?(p=t.jsx("button",{type:l,onClick:u,"aria-label":m,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:C}),e[11]=l,e[12]=u,e[13]=m,e[14]=C,e[15]=p):p=e[15];let g;e[16]!==d?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:d}),e[16]=d,e[17]=g):g=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=j):j=e[18];let v;e[19]!==g?(v=t.jsxs("button",{type:"button",className:ks,children:[g,j]}),e[19]=g,e[20]=v):v=e[20];let b;e[21]!==s||e[22]!==i||e[23]!==v?(b=t.jsx(Ss,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:i,trigger:v}),e[21]=s,e[22]=i,e[23]=v,e[24]=b):b=e[24];let w;return e[25]!==b||e[26]!==f||e[27]!==p?(w=t.jsxs("div",{className:f,children:[p,b]}),e[25]=b,e[26]=f,e[27]=p,e[28]=w):w=e[28],w}function Oo(n){const e=z.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:o}=s,a=B(),{org:i}=oe(),{state:c,isMobile:r}=pt(),l=Bt().invitations.length>0,u=c==="collapsed"||r;let m;e[2]!==l||e[3]!==i.name||e[4]!==a?(m=l?a("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:i.name}):a("header.shellBreadcrumb.switchOrganization",{name:i.name}),e[2]=l,e[3]=i.name,e[4]=a,e[5]=m):m=e[5];let f;e[6]!==i?(f=t.jsx(lt,{org:i,size:"sm"}),e[6]=i,e[7]=f):f=e[7];let d;e[8]!==l||e[9]!==u?(d=l&&t.jsx("span",{className:K("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",u?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=l,e[9]=u,e[10]=d):d=e[10];let h;e[11]!==f||e[12]!==d?(h=t.jsxs("span",{className:"relative inline-flex",children:[f,d]}),e[11]=f,e[12]=d,e[13]=h):h=e[13];let C;e[14]!==i.name||e[15]!==o?(C=o&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:i.name}),e[14]=i.name,e[15]=o,e[16]=C):C=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==h||e[20]!==C?(g=t.jsx(Ce,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":m,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:[h,C,p]})}),e[18]=m,e[19]=h,e[20]=C,e[21]=g):g=e[21];let j;e[22]!==i.slug||e[23]!==g?(j=t.jsx(os,{orgParam:i.slug,trigger:g}),e[22]=i.slug,e[23]=g,e[24]=j):j=e[24];let v;e[25]!==i.name?(v=t.jsx(ye,{side:"bottom",children:i.name}),e[25]=i.name,e[26]=v):v=e[26];let b;return e[27]!==v||e[28]!==j?(b=t.jsxs(Ne,{children:[j,v]}),e[27]=v,e[28]=j,e[29]=b):b=e[29],b}function Mo(n){const e=z.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:o}=s,{org:a}=oe();let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[2]=i):i=e[2];const c=st(i);let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[3]=r):r=e[3];const l=ot(r),{threads:u}=Dt(),{data:m}=re.useSession(),{setTaskId:f,createNewTask:d}=At();let h;e[4]!==a.id?(h=at(a.id),e[4]=a.id,e[5]=h):h=e[5];const C=h,p=C.id,g=c.taskId?l.virtualmcpid??p:p;let j;e[6]!==d||e[7]!==p||e[8]!==o||e[9]!==m?.user?.id||e[10]!==f||e[11]!==u?(j=O=>{const x=O??p,k=kn(u,x,m?.user?.id);k?f(k.id,x):d(x),o?.()},e[6]=d,e[7]=p,e[8]=o,e[9]=m?.user?.id,e[10]=f,e[11]=u,e[12]=j):j=e[12];const v=j;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=b):b=e[13];const w=g===p?C:void 0;let S;e[14]!==g||e[15]!==v?(S=()=>v(g),e[14]=g,e[15]=v,e[16]=S):S=e[16];let D;return e[17]!==g||e[18]!==v||e[19]!==w||e[20]!==S?(D=t.jsx(V.Suspense,{fallback:b,children:t.jsx(Ds,{agentId:g,fallback:w,onOpenHome:S,onPick:v})}),e[17]=g,e[18]=v,e[19]=w,e[20]=S,e[21]=D):D=e[21],D}function $o(){const n=z.c(24),e=B(),{org:s}=oe();let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[0]=o):o=n[0];const a=st(o);let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[1]=i):i=n[1];const c=ot(i),{threads:r}=Dt(),{createNewTask:l}=At();let u;n[2]!==s.id?(u=at(s.id),n[2]=s.id,n[3]=u):u=n[3];const m=u.id,f=a.taskId?c.virtualmcpid??m:m;let d;n[4]!==a.taskId||n[5]!==r?(d=(a.taskId?r.find(D=>D.id===a.taskId)?.branch:null)??null,n[4]=a.taskId,n[5]=r,n[6]=d):d=n[6];const h=d;let C;n[7]!==f||n[8]!==l||n[9]!==h?(C=()=>{l(f,h)},n[7]=f,n[8]=l,n[9]=h,n[10]=C):C=n[10];const p=C;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let j;n[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(sn,{size:16}),n[13]=j):j=n[13];let v;n[14]!==p||n[15]!==g?(v=t.jsx(Ce,{asChild:!0,children:t.jsx("button",{type:"button",onClick:p,"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:j})}),n[14]=p,n[15]=g,n[16]=v):v=n[16];let b;n[17]!==e?(b=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=b):b=n[18];let w;n[19]!==b?(w=t.jsx(ye,{side:"bottom",children:b}),n[19]=b,n[20]=w):w=n[20];let S;return n[21]!==v||n[22]!==w?(S=t.jsxs(Ne,{children:[v,w]}),n[21]=v,n[22]=w,n[23]=S):S=n[23],S}function Is({open:n,onOpenChange:e,onCreated:s}){const o=B(),{org:a}=oe(),{data:i}=re.useSession(),{stdioEnabled:c}=qt(),r=kt(),l=Ft(),u=Pt(),f=Tt(u,"").items,d=Gt({resolver:Xt(Vn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),h=d.watch("ui_type"),C=d.watch("connection_url"),p=d.watch("npx_package"),g=$e({uiType:h,connectionUrl:C??"",npxPackage:p??""})??ut({uiType:h,connectionUrl:C??"",registryItems:f}),j=x=>{const k=x.trim();if(!k)return;const T=!!d.formState.dirtyFields.title,N=!!d.formState.dirtyFields.description,y=!!d.formState.dirtyFields.env_vars,P=A=>{if(A&&(!T&&!d.getValues("title").trim()&&A.title&&d.setValue("title",A.title,{shouldDirty:!1}),!N&&!(d.getValues("description")??"").trim()&&A.description&&d.setValue("description",A.description,{shouldDirty:!1}),!y&&A.envVarKeys?.length)){const M=d.getValues("env_vars")??[],R=new Set(M.map(L=>L.key)),X=A.envVarKeys.filter(L=>!R.has(L));X.length>0&&d.setValue("env_vars",[...M,...X.map(L=>({key:L,value:""}))],{shouldDirty:!0})}},I=Hn(k);if(I&&c){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",I.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),P($e({uiType:"NPX",npxPackage:I.packageName}));return}if(k.startsWith("http://")||k.startsWith("https://")){const A=h==="HTTP"||h==="SSE"||h==="Websocket"?h:"HTTP";d.setValue("ui_type",A,{shouldDirty:!0}),d.setValue("connection_url",k,{shouldDirty:!0}),P($e({uiType:A,connectionUrl:k})??ut({uiType:A,connectionUrl:k,registryItems:f}));return}h==="NPX"&&P($e({uiType:"NPX",npxPackage:k}))},v=x=>{x||d.reset(),e(x)},b=async x=>{let k,T=null,N=null,y=null;x.ui_type==="NPX"?(k="STDIO",T="",y=Un(x.npx_package||"",x.env_vars||[])):x.ui_type==="STDIO"?(k="STDIO",T="",y=Kn(x.stdio_command||"",x.stdio_args||"",x.stdio_cwd,x.env_vars||[])):(k=x.ui_type,T=x.connection_url||"",N=x.connection_token||null);const P=In("conn");try{await l.create.mutateAsync({id:P,title:x.title,description:x.description||null,connection_type:k,connection_url:T,connection_token:N,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:i?.user?.id||"system",organization_id:a.id,icon:x.icon??null,app_name:null,app_id:null,connection_headers:y,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),s?.(P)}catch{H.error(o("connections.createConnectionDialog.failedToCreateConnection"))}},w=o("connections.createConnectionDialog.title"),S=o("connections.createConnectionDialog.description"),D=d.formState.isSubmitting?o("connections.createConnectionDialog.saving"):o("connections.createConnectionDialog.createButton"),O=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(W,{control:d.control,name:"ui_type",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.typeLabel")}),t.jsxs($n,{value:x.value,onValueChange:x.onChange,children:[t.jsx(Z,{children:t.jsx(Fn,{children:t.jsx(Bn,{})})}),t.jsxs(Ln,{children:[t.jsx(ke,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.httpType")]})}),t.jsx(ke,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.sseType")]})}),t.jsx(ke,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.websocketType")]})}),c&&t.jsxs(t.Fragment,{children:[t.jsx(ke,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Be,{className:"w-4 h-4"}),o("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(ke,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(on,{className:"w-4 h-4"}),o("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(ee,{})]})}),h==="NPX"&&t.jsx(W,{control:d.control,name:"npx_package",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.npmPackagePlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("npx_package",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),h==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(W,{control:d.control,name:"stdio_command",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.commandLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.commandPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"stdio_args",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.argumentsLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.argumentsPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"stdio_cwd",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.workingDirectoryPlaceholder"),...x,value:x.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(ee,{})]})})]}),(h==="NPX"||h==="STDIO")&&t.jsx(W,{control:d.control,name:"env_vars",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(Z,{children:t.jsx(Rn,{value:x.value??[],onChange:x.onChange})}),t.jsx(ee,{})]})}),h!=="NPX"&&h!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(W,{control:d.control,name:"connection_url",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.urlLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.urlPlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("connection_url",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"connection_token",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:g?.token?.label??o("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(Z,{children:t.jsx(ce,{type:"password",placeholder:g?.token?.placeholder??o("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...x,value:x.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:o("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"title",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.namePlaceholder"),...x})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"description",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.descriptionLabel")}),t.jsx(Z,{children:t.jsx(En,{placeholder:o("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...x,value:x.value??""})}),t.jsx(ee,{})]})})]});return r?t.jsx(wt,{open:n,onOpenChange:v,children:t.jsxs(_t,{className:"max-h-[90vh]",children:[t.jsx(gn,{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(St,{children:w}),t.jsx(hn,{className:"mt-1",children:S})]}),t.jsx(pn,{asChild:!0,children:t.jsx(te,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(yt,{size:16})})})]})}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:O}),t.jsx(xn,{children:t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:D})})]})})]})}):t.jsx(zt,{open:n,onOpenChange:v,children:t.jsxs(Ot,{className:"sm:max-w-[525px]",children:[t.jsxs(Mt,{children:[t.jsx($t,{children:w}),t.jsx(On,{children:S})]}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"py-4",children:O}),t.jsxs(Mn,{children:[t.jsx(te,{type:"button",variant:"outline",onClick:()=>v(!1),children:o("connections.createConnectionDialog.cancelButton")}),t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:D})]})]})})]})})}function As(n){const e=z.c(72),{mode:s,agentId:o,addedConnectionIds:a,onAdd:i,onCloneAndAdd:c,onConnectAndAdd:r,connectingItemId:l,search:u,onCreateConnection:m,onBrowseNavigate:f,defaultTab:d}=n,h=s===void 0?"add":s,C=d===void 0?"connected":d,p=B(),{org:g}=oe(),j=V.useDeferredValue(u),v=u!==j;let b;e[0]!==j?(b=j.trim().toLowerCase(),e[0]=j,e[1]=b):b=e[1];const w=b;let S;e[2]!==C?(S=_=>_??C,e[2]=C,e[3]=S):S=e[3];const[D,O]=Qt(Wt.connectionsTab(g.slug)+(C==="all"?":home-modal":":agent-modal"),S);let x;e[4]!==D||e[5]!==O?(x=_=>{_!==D&&E("connections_dialog_tab_changed",{to_tab:_}),O(_)},e[4]=D,e[5]=O,e[6]=x):x=e[6];const k=x;let T;e[7]!==g.id||e[8]!==g.slug?(T={connectionId:cn,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=T):T=e[9];const N=rn(T),y=j?.trim().split(/\s+/).filter(Boolean)??[],P=y.length>0?{operator:"or",conditions:y.flatMap(Bs)}:void 0,I={...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(I),{data:M,fetchNextPage:R,hasNextPage:X,isFetchingNextPage:L}=Xn({queryKey:it.collectionListInfinite(N,g.id,"","CONNECTIONS",A),queryFn:async _=>{const{pageParam:$}=_,se=$===void 0?0:$;return(await N.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:se}})).structuredContent},initialPageParam:0,getNextPageParam:$s,staleTime:3e4}),ne=M?.pages.flatMap(Ms)??[],q=zn(ne),de=new Set(ne.filter(Os).map(zs)),F=Pt(),ie=Tt(F,j),Re=mt(ie.loadMore,ie.hasMore,ie.isLoadingMore),He=mt(R,X??!1,L),G=D==="all"||!!w,ct=G?ie.items.filter(_=>{const $=An(_);if($&&de.has($))return!1;if(!w)return!0;const se=Ve(_._meta),ae=[_.title,_.description,_.name,_.server?.title,_.server?.description,_.server?.name,se?.friendly_name,se?.friendlyName].filter(Boolean).join(" ").toLowerCase();return y.some(Q=>ae.includes(Q.toLowerCase()))}):[],_e=ct.filter(Ts),Se=ct.filter(Ps);let Ie;e[10]!==a?(Ie=_=>_.some($=>a.has($.id)),e[10]=a,e[11]=Ie):Ie=e[11];const Ue=Ie;let Ae;e[12]!==a||e[13]!==o||e[14]!==l||e[15]!==Ue||e[16]!==h||e[17]!==i||e[18]!==f||e[19]!==c||e[20]!==p?(Ae=(_,$,se,ae,Q)=>{const Me=Ue(Q),be=Q.find(le=>!a.has(le.id)),U=Q[0];if(h==="browse"){const le=qn(U);return t.jsx(Ye,{connection:{title:$,icon:se,description:Q.length>1?`${Q.length} instances`:ae??void 0},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",p("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{E("connection_browse_clicked",{app_name:U.app_name??null,connection_id:U.id,instances_count:Q.length}),f?.(le)}},_)}return t.jsx(Ye,{connection:{title:$,icon:se,description:ae},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Me&&t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",p("virtualMcp.connectionDialogContent.added")]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),be?(E("connection_add_clicked",{action:"use_existing",app_name:U.app_name??null,connection_id:be.id}),o&&E("agent_connection_attached",{agent_id:o,connection_id:be.id,app_name:U.app_name??null,mode:"existing"}),i(be.id)):(E("connection_add_clicked",{action:"clone",app_name:U.app_name??null,base_connection_id:U.id}),c(U))},children:p("virtualMcp.connectionDialogContent.add")})]})},_)},e[12]=a,e[13]=o,e[14]=l,e[15]=Ue,e[16]=h,e[17]=i,e[18]=f,e[19]=c,e[20]=p,e[21]=Ae):Ae=e[21];const Pe=Ae;let Te;e[22]!==l||e[23]!==h||e[24]!==r||e[25]!==p?(Te=_=>{const $=Ve(_._meta),se=$?.friendlyName||$?.friendly_name||_.server?.title||_.title||_.server?.name||_.name||_.id||"",ae=_.server?.description||_.description||null,Q=_.server?.icons?.[0]?.src||Pn(_.server?.repository)||null,Me=$?.official===!0,be=$?.verified===!0,U=$?.owner==="deco";return t.jsx(Ye,{connection:{title:se,description:ae,icon:Q},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[U&&t.jsxs(Ne,{children:[t.jsx(Ce,{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:p("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByDeco")})]}),!U&&Me&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!U&&!Me&&be&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),E("connection_add_clicked",{action:"connect_new",registry_item_id:_.id,app_name:$?.friendlyName||_.server?.name||_.name||null}),r(_)},children:l===_.id?t.jsx(De,{size:14,className:"animate-spin"}):p(h==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${_.id}`)},e[22]=l,e[23]=h,e[24]=r,e[25]=p,e[26]=Te):Te=e[26];const rt=Te;let ue;e[27]!==D||e[28]!==k||e[29]!==m||e[30]!==w||e[31]!==p?(ue=!w&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(Gn,{tabs:[{id:"all",label:p("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:p("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:D,onTabChange:_=>k(_)}),t.jsxs(te,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{E("connections_dialog_custom_clicked"),m()},children:[t.jsx(we,{size:12}),p("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=D,e[28]=k,e[29]=m,e[30]=w,e[31]=p,e[32]=ue):ue=e[32];const Ke=v&&"opacity-50 pointer-events-none";let me;e[33]!==Ke?(me=K("flex-1 overflow-auto p-5 transition-opacity duration-150",Ke),e[33]=Ke,e[34]=me):me=e[34];const Et="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ze;e[35]!==Pe?(ze=_=>{if(_.type==="group")return Pe(_.key,_.title,_.icon,null,_.connections);const $=_.connection;return Pe($.id,$.title,$.icon,$.description??null,[$])},e[35]=Pe,e[36]=ze):ze=e[36];const qe=q.map(ze);let fe;e[37]!==He?(fe=t.jsx("div",{ref:He,className:"col-span-full h-1"}),e[37]=He,e[38]=fe):fe=e[38];let ge;e[39]!==L?(ge=L&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=L,e[40]=ge):ge=e[40];const Ge=G&&_e.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(Je,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:p("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Xe=G&&_e.map(rt),Qe=G&&Se.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:p("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),We=G&&Se.map(rt);let he;e[41]!==Re||e[42]!==F||e[43]!==G?(he=G&&F.length>0&&t.jsx("div",{ref:Re,className:"col-span-full h-1"}),e[41]=Re,e[42]=F,e[43]=G,e[44]=he):he=e[44];let pe;e[45]!==ie.isLoadingMore||e[46]!==G?(pe=G&&ie.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=ie.isLoadingMore,e[46]=G,e[47]=pe):pe=e[47];let xe;e[48]!==qe||e[49]!==fe||e[50]!==ge||e[51]!==Ge||e[52]!==Xe||e[53]!==Qe||e[54]!==We||e[55]!==he||e[56]!==pe?(xe=t.jsxs("div",{className:Et,children:[qe,fe,ge,Ge,Xe,Qe,We,he,pe]}),e[48]=qe,e[49]=fe,e[50]=ge,e[51]=Ge,e[52]=Xe,e[53]=Qe,e[54]=We,e[55]=he,e[56]=pe,e[57]=xe):xe=e[57];let je;e[58]!==D||e[59]!==q.length||e[60]!==Se||e[61]!==u||e[62]!==p||e[63]!==_e?(je=q.length===0&&_e.length===0&&Se.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?p("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:u}):p(D==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=D,e[59]=q.length,e[60]=Se,e[61]=u,e[62]=p,e[63]=_e,e[64]=je):je=e[64];let ve;e[65]!==me||e[66]!==xe||e[67]!==je?(ve=t.jsxs("div",{className:me,children:[xe,je]}),e[65]=me,e[66]=xe,e[67]=je,e[68]=ve):ve=e[68];let Oe;return e[69]!==ue||e[70]!==ve?(Oe=t.jsxs(t.Fragment,{children:[ue,ve]}),e[69]=ue,e[70]=ve,e[71]=Oe):Oe=e[71],Oe}function Ps(n){return!n.verified&&!Ve(n._meta)?.verified&&!n.meta?.verified}function Ts(n){return n.verified||Ve(n._meta)?.verified||n.meta?.verified}function zs(n){return n.app_name}function Os(n){return n.app_name}function Ms(n){return n?.items??[]}function $s(n,e){if(n?.hasMore)return e.reduce(Fs,0)}function Fs(n,e){return n+(e?.items?.length??0)}function Bs(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Fo({open:n,onOpenChange:e,defaultTab:s,initialSearch:o="",...a}){const i=B(),c=a.mode??"add",r="agentId"in a?a.agentId:void 0,l="addedConnectionIds"in a?a.addedConnectionIds??new Set:new Set,u="onAdd"in a&&a.onAdd?a.onAdd:N=>{},m=(N,y,P)=>{r&&E("agent_connection_attached",{agent_id:r,connection_id:N,app_name:y,mode:P})},[f,d]=V.useState(null),[h,C]=V.useState(o),[p,g]=V.useState(!1),{org:j}=oe(),{data:v}=re.useSession(),b=Ft(),w=Yt(),S=nt(),D=N=>{e(!1),S({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:N}})},O=()=>{w.invalidateQueries({predicate:N=>{const y=N.queryKey;return y[1]===j.id&&y[3]==="collection"&&y[4]==="CONNECTIONS"}})},x=async(N,y)=>{E("connection_oauth_succeeded",{connection_id:N,flow:y});const P=new URL(`/api/${j.slug}/mcp/${N}`,window.location.origin);await w.invalidateQueries({queryKey:it.isMCPAuthenticated(P.href,null)}),O()},k=async N=>{d(N.app_name??N.id);try{const P=`${N.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await b.create.mutateAsync({title:P,description:N.description??null,connection_type:N.connection_type,connection_url:N.connection_url??null,connection_token:null,icon:N.icon??null,app_name:N.app_name??null,app_id:N.app_id??null,connection_headers:N.connection_headers??null})).id,M=await et({connectionId:A,orgId:j.id,orgSlug:j.slug,persistFallback:R=>b.update.mutateAsync({id:A,data:{connection_token:R}}).then(()=>{})});if(M.ran&&!M.ok){E("connection_oauth_failed",{connection_id:A,flow:"clone",error:M.error??"no_token"}),H.error(i("virtualMcp.addConnectionDialog.authenticationFailedError",{error:M.error??"no token received"})),await b.delete.mutateAsync(A);return}M.ran&&await x(A,"clone"),m(A,N.app_name??null,"clone"),u(A)}catch(y){console.error("Failed to add connection:",y),H.error(i("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{d(null)}},T=async N=>{if(!(!j||!v?.user?.id)){d(N.id);try{const y=Tn(N,j.id,v.user.id,{remoteIndex:0}),P=y.connection_type==="STDIO",I=!!y.connection_url,A=P&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!I&&!A){H.error(i("virtualMcp.addConnectionDialog.mcpServerConnectionError")),d(null);return}const{id:M}=await b.create.mutateAsync(y),R=await et({connectionId:M,orgId:j.id,orgSlug:j.slug,persistFallback:X=>b.update.mutateAsync({id:M,data:{connection_token:X}}).then(()=>{})});if(R.ran&&!R.ok){E("connection_oauth_failed",{connection_id:M,flow:"connect_new",error:R.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:R.error??"no token received"})}),m(M,y.app_name??null,"new"),u(M);return}R.ran?(await x(M,"connect_new"),H.success(i("virtualMcp.addConnectionDialog.connectedAuthenticated"))):H.success(i("virtualMcp.addConnectionDialog.connected")),m(M,y.app_name??null,"new"),u(M)}catch(y){console.error("Failed to connect:",y),H.error(i("virtualMcp.addConnectionDialog.failedToConnect"))}finally{d(null)}}};return t.jsxs(zt,{open:n,onOpenChange:e,children:[t.jsxs(Ot,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(Mt,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx($t,{className:"text-base font-semibold",children:i(c==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(Dn,{value:h,onChange:C,placeholder:i("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(As,{mode:c,agentId:r,addedConnectionIds:l,onAdd:u,onCloneAndAdd:k,onConnectAndAdd:T,connectingItemId:f,search:h,onCreateConnection:()=>g(!0),onBrowseNavigate:D,defaultTab:s})})]}),t.jsx(Is,{open:p,onOpenChange:g,onCreated:async N=>{g(!1);const y=await et({connectionId:N,orgId:j.id,orgSlug:j.slug,persistFallback:P=>b.update.mutateAsync({id:N,data:{connection_token:P}}).then(()=>{})});if(y.ran&&!y.ok){E("connection_oauth_failed",{connection_id:N,flow:"custom_create",error:y.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:y.error??"no token received"})}),m(N,null,"custom"),u(N),e(!1);return}y.ran&&await x(N,"custom_create"),m(N,null,"custom"),u(N),e(!1)}})]})}const ft=new Map;function Bo(){const{org:n}=oe(),e=Qn(),s=Wn(),o=s.find(g=>g.providerId==="deco"),{data:a,isLoading:i,refetch:c,isFetching:r}=Jt({queryKey:it.aiProviderCredits(n.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),l=a?.balanceCents??null,u=l!=null?l/100:null,m=V.useRef(new Map);if(l!=null){const g=ft.get(n.id);m.current.get(n.id)&&g!=null&&l>g&&E("credits_topped_up_detected",{organization_id:n.id,delta_cents:l-g,previous_balance_cents:g,new_balance_cents:l}),ft.set(n.id,l),m.current.set(n.id,!0)}const f=!!o,d=l!=null&&l>0,h=l!=null&&l===0,C=l!=null&&l===200,p=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:f,decoKeyId:o?.id??null,balanceCents:l,balanceDollars:u,hasCredits:d,isZeroBalance:h,isInitialFreeCredit:C,hasOnlyDecoProvider:p,isLoading:i,isFetching:r,refetch:c}}export{Mo as A,To as C,$o as N,Oo as O,zo as a,Fo as b,os as c,lt as d,Bo as u};
1
+ import{c as z,b as B,j as t,y as Vt,B as te,r as V,aR as Rt,d as nt,s as Ht,m as K,a as re,t as H,w as Ut,k as De,p as E,F as oe,f as st,u as ot,L as Kt,D as qt,a1 as Gt,a2 as Xt,I as Qt,G as Wt,K as it,o as Yt,n as Jt}from"./index-Ce7wzSlG.js";import{i as Zt}from"./ChevronRight-Sb_ED2ND.js";import{i as en}from"./X-NFs01Z9e.js";import{aD as tn,Q as nn,A as gt,g as sn,ae as on}from"./agent-icon-tYsl9rf9.js";import{t as ht}from"./ChevronDown-eBlATgdA.js";import{T as Ce,a as ye,c as Ne}from"./tooltip-Ddk2UF0M.js";import{u as pt,d as xt,c as jt}from"./sidebar-CHd6y1Ct.js";import{a as at,i as an,f as ln,S as cn,u as rn}from"./use-mcp-client-Bd6XHVt1.js";import{a as dn,u as un}from"./use-virtual-mcp-CWHDMpbS.js";import{a as Le,b as vt,P as bt}from"./popover-PwNxRDTf.js";import{i as Ee}from"./Check-ByJrpIbu.js";import{s as we}from"./Plus-C6vzlDQe.js";import{i as Ct}from"./SearchMd-BHNbvSu5.js";import{s as yt}from"./XClose-CBND9vXo.js";import{C as mn}from"./self-tool-result-P4srATyh.js";import{T as Nt}from"./toolbar-aj087TVf.js";import{S as fn}from"./skeleton-BVGrCPJ-.js";import{D as wt,a as _t,b as St,c as gn,g as hn,e as pn,f as xn}from"./drawer-DuYF-nKz.js";import{u as kt}from"./use-mobile-DM0DUpr3.js";import{a as jn,G as vn}from"./github-repo-picker-CJSaq-iT.js";import{g as bn,b as Cn,a as Dt}from"./hooks-DeqnuCHC.js";import{u as yn,g as Nn,a as wn,b as _n}from"./use-navigate-to-agent-DOrZy0up.js";import{a as Sn,c as It}from"./agent-capabilities-cXfbMfjV.js";import{u as At}from"./shell-layout-DCPnq29F.js";import{f as kn}from"./reusable-new-chat-CouMjkYR.js";import{C as Dn}from"./collection-search-CrIgHi7T.js";import{g as In,a as An,b as Pn,e as Tn}from"./extract-connection-data-kLsSKsGM.js";import{u as Pt,a as Tt,g as zn,C as Ye}from"./connection-card-BdPIWlbb.js";import{e as zt,d as Ot,a as Mt,b as $t,h as On,c as Mn}from"./dialog-BRkQoppc.js";import{d as W,a as Y,e as J,b as Z,c as ee,F as dt}from"./form-BjD860k4.js";import{I as ce}from"./input-DLBQv69K.js";import{S as $n,a as Fn,b as Bn,c as Ln,d as ke}from"./select-D3VWqZ6O.js";import{T as En}from"./textarea-DP4wAcHO.js";import{b as Ft}from"./use-connection-3LK27F94.js";import{n as Be,i as Je}from"./Tool02-BEn9yaLs.js";import{s as Ze}from"./Star01-B5OO0GPG.js";import{c as Vn,i as $e,a as ut,E as Rn,p as Hn,b as Un,d as Kn}from"./connection-form-helpers-B1hPYVMc.js";import{a as et}from"./authenticate-and-persist-oauth-DRysEq3W.js";import{g as qn}from"./connection-slug-eyAPH6o3.js";import{C as Gn}from"./collection-tabs-BLnznnX1.js";import{u as mt}from"./use-infinite-scroll-BrpE3bFb.js";import{B as Fe}from"./badge-CV_cBugA.js";import{u as Xn}from"./useSuspenseInfiniteQuery-CvmxgTX4.js";import{g as Ve}from"./metadata-dUsYcpuu.js";import{u as Qn}from"./studio-tools-9EYu19Cv.js";import{u as Wn}from"./use-ai-providers-_AriHZw0.js";const Yn="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Jn(){const n=z.c(13),e=B();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 o;n[1]!==e?(o=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=o):o=n[2];let a;n[3]!==o?(a=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",o,"”"]}),n[3]=o,n[4]=a):a=n[4];let i;n[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("img",{src:Yn,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=i):i=n[5];let c;n[6]!==e?(c=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=c):c=n[7];let r;n[8]!==c?(r=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[i,t.jsx("span",{className:"text-base font-medium",children:c})]}),n[8]=c,n[9]=r):r=n[9];let l;return n[10]!==a||n[11]!==r?(l=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,a,r]}),n[10]=a,n[11]=r,n[12]=l):l=n[12],l}function Zn(){const n=z.c(19),e=B();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let o;n[2]!==s?(o={Icon:tn,label:s},n[2]=s,n[3]=o):o=n[3];let a;n[4]!==e?(a=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=a):a=n[5];let i;n[6]!==a?(i={Icon:Vt,label:a},n[6]=a,n[7]=i):i=n[7];let c;n[8]!==e?(c=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=c):c=n[9];let r;n[10]!==c?(r={Icon:nn,label:c},n[10]=c,n[11]=r):r=n[11];let l;n[12]!==o||n[13]!==i||n[14]!==r?(l=[o,i,r],n[12]=o,n[13]=i,n[14]=r,n[15]=l):l=n[15];const u=l;let m;n[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=m):m=n[16];let f;return n[17]!==u?(f=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[m,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:u.map(es)})]}),n[17]=u,n[18]=f):f=n[18],f}function es(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 To(n){const e=z.c(22),{siteHost:s,footer:o,onClose:a,children:i}=n,c=B(),r=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let l;e[0]!==a||e[1]!==c?(l=a&&t.jsx("button",{type:"button",onClick:a,"aria-label":c("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(en,{size:18})}),e[0]=a,e[1]=c,e[2]=l):l=e[2];let u,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),m=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=u,e[4]=m):(u=e[3],m=e[4]);let f;e[5]!==r||e[6]!==s?(f=s&&t.jsxs(t.Fragment,{children:[t.jsx(Zt,{size:16,className:"shrink-0 text-foreground/25"}),r&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:r,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=r,e[6]=s,e[7]=f):f=e[7];let d;e[8]!==f?(d=t.jsxs("div",{className:"flex items-center gap-2",children:[u,m,f]}),e[8]=f,e[9]=d):d=e[9];let h;e[10]!==o?(h=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:o}),e[10]=o,e[11]=h):h=e[11];let C;e[12]!==i||e[13]!==d||e[14]!==h?(C=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[d,i,h]}),e[12]=i,e[13]=d,e[14]=h,e[15]=C):C=e[15];let p,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=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]=p,e[17]=g):(p=e[16],g=e[17]);let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[p,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Jn,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Zn,{})]})]}),e[18]=j):j=e[18];let v;return e[19]!==l||e[20]!==C?(v=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[l,C,j]}),e[19]=l,e[20]=C,e[21]=v):v=e[21],v}function zo(n){const e=z.c(5),{ready:s,pending:o,label:a,onClick:i,children:c}=n,r=o||!s,l=s&&!o?c:null;let u;return e[0]!==a||e[1]!==i||e[2]!==r||e[3]!==l?(u=t.jsxs(te,{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:i,disabled:r,children:[a,l]}),e[0]=a,e[1]=i,e[2]=r,e[3]=l,e[4]=u):u=e[4],u}function Bt(){const n=V.useContext(Rt),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(a=>a.status==="pending"&&new Date(a.expiresAt)>new Date),refetch:()=>s?.()}}function ts(n){let e=0;for(let o=0;o<n.length;o++)e=n.charCodeAt(o)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function lt(n){const e=z.c(13),{org:s,size:o}=n,a=o===void 0?"sm":o,i=a==="xs"?"size-5":"size-6",c=a==="xs"?"text-[9px]":"text-xs";let r;e[0]!==i?(r=K(i,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s.logo||e[3]!==s.name?(l=s.logo?void 0:ts(s.name),e[2]=s.logo,e[3]=s.name,e[4]=l):l=e[4];let u;e[5]!==s.logo||e[6]!==s.name||e[7]!==c?(u=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:K("font-semibold leading-none",c),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=c,e[8]=u):u=e[8];let m;return e[9]!==r||e[10]!==l||e[11]!==u?(m=t.jsx("div",{className:r,style:l,children:u}),e[9]=r,e[10]=l,e[11]=u,e[12]=m):m=e[12],m}function ns({invitation:n,onChanged:e}){const s=B(),[o,a]=V.useState(!1),i=n.organizationName??s("header.orgSwitcher.unknownOrganization"),c=async()=>{a(!0);try{const u=await re.organization.acceptInvitation({invitationId:n.id});if(u.error){H.error(u.error.message),a(!1);return}}catch{H.error(s("header.orgSwitcher.failedToAcceptInvitation")),a(!1);return}H.success(s("header.orgSwitcher.joined",{name:i})),Ut();let l;try{l=(await re.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=l?`/${l}`:"/"},r=async()=>{a(!0);try{const l=await re.organization.rejectInvitation({invitationId:n.id});if(l.error){H.error(l.error.message),a(!1);return}H.success(s("header.orgSwitcher.invitationDeclined")),a(!1),e()}catch{H.error(s("header.orgSwitcher.failedToDeclineInvitation")),a(!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(lt,{org:{name:i},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:i}),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(te,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:c,disabled:o,children:s("header.orgSwitcher.accept")}),t.jsx(te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:r,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:i}),children:t.jsx(yt,{size:14})})]})]})}function ss(n){const e=z.c(32),{orgParam:s,onSelectOrg:o,onCreateOrg:a}=n,i=B(),{data:c}=Ht(),{invitations:r,refetch:l}=Bt();let u;e[0]!==s?(u=(I,A)=>I.slug===s?-1:A.slug===s?1:I.name.localeCompare(A.name),e[0]=s,e[1]=u):u=e[1];const m=[...c??[]].sort(u),[f,d]=V.useState(""),h=f.toLowerCase(),C=h?m.filter(I=>I.name.toLowerCase().includes(h)||I.slug.toLowerCase().includes(h)):m;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ct,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=p):p=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=I=>d(I.target.value),e[3]=g):g=e[3];let j;e[4]!==f?(j=I=>I.key==="Escape"&&f&&d(""),e[4]=f,e[5]=j):j=e[5];let v;e[6]!==i?(v=i("header.orgSwitcher.searchOrganizations"),e[6]=i,e[7]=v):v=e[7];let b;e[8]!==f||e[9]!==j||e[10]!==v?(b=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:f,onChange:g,onKeyDown:j,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=f,e[9]=j,e[10]=v,e[11]=b):b=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(we,{size:16}),e[12]=w):w=e[12];let S;e[13]!==a?(S=t.jsx("button",{type:"button",onClick:a,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:w}),e[13]=a,e[14]=S):S=e[14];let D;e[15]!==b||e[16]!==S?(D=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[p,b,S]}),e[15]=b,e[16]=S,e[17]=D):D=e[17];const O="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let x;e[18]!==r||e[19]!==f||e[20]!==l?(x=!f&&r.map(I=>t.jsx(ns,{invitation:I,onChanged:l},I.id)),e[18]=r,e[19]=f,e[20]=l,e[21]=x):x=e[21];const k=C.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:f?i("header.orgSwitcher.noOrganizationsMatch",{query:f}):i("header.orgSwitcher.noOrganizationsAvailable")});let T;e[22]!==o||e[23]!==s?(T=I=>t.jsxs("button",{type:"button",onClick:()=>o(I.slug),className:K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",I.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(lt,{org:I,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:I.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.slug})]}),I.slug===s&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},I.id),e[22]=o,e[23]=s,e[24]=T):T=e[24];const N=C.map(T);let y;e[25]!==x||e[26]!==k||e[27]!==N?(y=t.jsxs("div",{className:O,children:[x,k,N]}),e[25]=x,e[26]=k,e[27]=N,e[28]=y):y=e[28];let P;return e[29]!==y||e[30]!==D?(P=t.jsxs(t.Fragment,{children:[D,y]}),e[29]=y,e[30]=D,e[31]=P):P=e[31],P}function os(n){const e=z.c(22),{trigger:s,orgParam:o,align:a,side:i}=n,c=a===void 0?"start":a,r=i===void 0?"bottom":i,l=nt(),[u,m]=V.useState(!1),[f,d]=V.useState(!1);let h;e[0]!==s?(h=t.jsx(Le,{asChild:!0,children:s}),e[0]=s,e[1]=h):h=e[1];const C=String(u);let p;e[2]!==l?(p=D=>{m(!1),l({to:"/$org",params:{org:D}})},e[2]=l,e[3]=p):p=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{m(!1),d(!0)},e[4]=g):g=e[4];let j;e[5]!==o||e[6]!==C||e[7]!==p?(j=t.jsx(ss,{orgParam:o,onSelectOrg:p,onCreateOrg:g},C),e[5]=o,e[6]=C,e[7]=p,e[8]=j):j=e[8];let v;e[9]!==c||e[10]!==r||e[11]!==j?(v=t.jsx(vt,{side:r,align:c,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:as,onCloseAutoFocus:is,children:j}),e[9]=c,e[10]=r,e[11]=j,e[12]=v):v=e[12];let b;e[13]!==u||e[14]!==h||e[15]!==v?(b=t.jsxs(bt,{open:u,onOpenChange:m,children:[h,v]}),e[13]=u,e[14]=h,e[15]=v,e[16]=b):b=e[16];let w;e[17]!==f?(w=t.jsx(mn,{open:f,onOpenChange:d}),e[17]=f,e[18]=w):w=e[18];let S;return e[19]!==w||e[20]!==b?(S=t.jsxs(t.Fragment,{children:[b,w]}),e[19]=w,e[20]=b,e[21]=S):S=e[21],S}function is(n){return n.preventDefault()}function as(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ls(n){const e=z.c(21),{value:s,onChange:o,placeholder:a,onKeyDown:i,className:c,isSearching:r,disabled:l}=n,u=a===void 0?"Search...":a;let m;e[0]!==c?(m=K("shrink-0 w-full border-b border-border h-12",c),e[0]=c,e[1]=m):m=e[1];const f=l?"cursor-not-allowed opacity-50":"cursor-text";let d;e[2]!==f?(d=K("flex items-center gap-2.5 h-12 px-4",f),e[2]=f,e[3]=d):d=e[3];let h;e[4]!==r?(h=r?t.jsx(De,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Ct,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=r,e[5]=h):h=e[5];let C;e[6]!==o?(C=v=>o(v.target.value),e[6]=o,e[7]=C):C=e[7];let p;e[8]!==l||e[9]!==i||e[10]!==u||e[11]!==C||e[12]!==s?(p=t.jsx("input",{type:"text",value:s,onChange:C,onKeyDown:i,placeholder:u,disabled:l,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=l,e[9]=i,e[10]=u,e[11]=C,e[12]=s,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==h||e[16]!==p?(g=t.jsxs("label",{className:d,children:[h,p]}),e[14]=d,e[15]=h,e[16]=p,e[17]=g):g=e[17];let j;return e[18]!==m||e[19]!==g?(j=t.jsx("div",{className:m,children:g}),e[18]=m,e[19]=g,e[20]=j):j=e[20],j}function cs(n,e,s){if(!s)return null;const o=bn(n,e);return o?o.threads.get().find(i=>i.id===s)?.branch??null:null}function rs(n){const e=z.c(6),{value:s,onChange:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.searchAgents"),e[0]=a,e[1]=i):i=e[1];let c;return e[2]!==o||e[3]!==i||e[4]!==s?(c=t.jsx(ls,{value:s,onChange:o,placeholder:i}),e[2]=o,e[3]=i,e[4]=s,e[5]=c):c=e[5],c}function ds(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=o):o=n[3],o}function us(n){const e=z.c(10),{org:s,onClose:o}=n,a=B();let i;e[0]!==s.slug?(i={org:s.slug},e[0]=s.slug,e[1]=i):i=e[1];let c;e[2]!==o?(c=()=>o(),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==a?(r=a("sidebar.agentsSection.seeAllAgents"),e[4]=a,e[5]=r):r=e[5];let l;return e[6]!==i||e[7]!==c||e[8]!==r?(l=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(Kt,{to:"/$org/settings/agents",params:i,onClick:c,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:r})}),e[6]=i,e[7]=c,e[8]=r,e[9]=l):l=e[9],l}function ms(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(Lt,{children:s}),n[2]=s,n[3]=o):o=n[3],o}function fs(n){const e=z.c(11),{onImportFromGithub:s}=n,o=B();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(vn,{className:"size-3.5"}),e[0]=a):a=e[0];let i;e[1]!==o?(i=o("sidebar.agentsSection.import"),e[1]=o,e[2]=i):i=e[2];let c;e[3]!==s||e[4]!==i?(c=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:[a,i]}),e[3]=s,e[4]=i,e[5]=c):c=e[5];let r;e[6]!==o?(r=o("sidebar.agentsSection.codeAgents"),e[6]=o,e[7]=r):r=e[7];let l;return e[8]!==c||e[9]!==r?(l=t.jsx(Lt,{action:c,children:r}),e[8]=c,e[9]=r,e[10]=l):l=e[10],l}function gs(n){const e=z.c(11),{setOpen:s,emptyCtaClass:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.browseAgents"),e[0]=a,e[1]=i):i=e[1];let c;e[2]!==o?(c=K(o),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==s?(r=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{className:"size-4"}),e[6]=l):l=e[6];let u;return e[7]!==i||e[8]!==c||e[9]!==r?(u=t.jsx(Nt,{"aria-label":i,className:c,onClick:r,children:l}),e[7]=i,e[8]=c,e[9]=r,e[10]=u):u=e[10],u}function hs(n){const e=z.c(17),{setOpen:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]!==s?(l=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=l):l=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(we,{}),e[7]=u):u=e[7];let m;e[8]!==i?(m=i("sidebar.agentsSection.newAgent"),e[8]=i,e[9]=m):m=e[9];let f;e[10]!==m?(f=t.jsx("span",{children:m}),e[10]=m,e[11]=f):f=e[11];let d;return e[12]!==c||e[13]!==r||e[14]!==l||e[15]!==f?(d=t.jsx(xt,{children:t.jsxs(jt,{tooltip:c,className:r,onClick:l,children:[u,f]})}),e[12]=c,e[13]=r,e[14]=l,e[15]=f,e[16]=d):d=e[16],d}function ps(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(St,{className:"sr-only",children:s}),n[2]=s,n[3]=o):o=n[3],o}function xs(n){const e=z.c(8),{emptyCtaClass:s}=n,o=B();let a;e[0]!==o?(a=o("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a):a=e[1];let i;e[2]!==s?(i=K(s),e[2]=s,e[3]=i):i=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{className:"size-4"}),e[4]=c):c=e[4];let r;return e[5]!==a||e[6]!==i?(r=t.jsx(Nt,{"aria-label":a,className:i,children:c}),e[5]=a,e[6]=i,e[7]=r):r=e[7],r}function js(n){const e=z.c(19),{wrapEmptyHint:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{}),e[5]=l):l=e[5];let u;e[6]!==i?(u=i("sidebar.agentsSection.newAgent"),e[6]=i,e[7]=u):u=e[7];let m;e[8]!==u?(m=t.jsx("span",{children:u}),e[8]=u,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==r||e[12]!==m?(f=t.jsx(Le,{asChild:!0,children:t.jsxs(jt,{tooltip:c,className:r,children:[l,m]})}),e[10]=c,e[11]=r,e[12]=m,e[13]=f):f=e[13];let d;e[14]!==f||e[15]!==s?(d=s(f),e[14]=f,e[15]=s,e[16]=d):d=e[16];let h;return e[17]!==d?(h=t.jsx(xt,{children:d}),e[17]=d,e[18]=h):h=e[18],h}function vs(n){const e=z.c(9),{children:s}=n,o=B();let a;e[0]!==s?(a=t.jsx(Ce,{asChild:!0,children:s}),e[0]=s,e[1]=a):a=e[1];let i;e[2]!==o?(i=o("sidebar.agentsSection.selectAnExistingAgent"),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==i?(c=t.jsx(ye,{side:"right",sideOffset:8,children:i}),e[4]=i,e[5]=c):c=e[5];let r;return e[6]!==a||e[7]!==c?(r=t.jsxs(Ne,{defaultOpen:!0,delayDuration:0,children:[a,c]}),e[6]=a,e[7]=c,e[8]=r):r=e[8],r}function bs(n){const e=nt(),{create:s}=Cn(),{locator:o}=oe(),a=st({strict:!1}),i=ot({strict:!1});return async c=>{const r=crypto.randomUUID(),l=c===i.virtualmcpid?cs(n,o,a.taskId??""):null;try{await s({id:r,virtual_mcp_id:c,...l?{branch:l}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:r},search:{virtualmcpid:c}})}}function tt(n){const e=z.c(20),{agent:s,selected:o,onClick:a}=n,i=o?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let c;e[0]!==i?(c=K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==s.icon||e[3]!==s.title?(r=t.jsx(gt,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=r):r=e[4];let l;e[5]!==s.title?(l=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=l):l=e[6];let u;e[7]!==s.description?(u=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=u):u=e[8];let m;e[9]!==l||e[10]!==u?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,u]}),e[9]=l,e[10]=u,e[11]=m):m=e[11];let f;e[12]!==o?(f=o&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=o,e[13]=f):f=e[13];let d;return e[14]!==a||e[15]!==c||e[16]!==r||e[17]!==m||e[18]!==f?(d=t.jsxs("button",{type:"button",onClick:a,className:c,children:[r,m,f]}),e[14]=a,e[15]=c,e[16]=r,e[17]=m,e[18]=f,e[19]=d):d=e[19],d}function Lt(n){const e=z.c(5),{children:s,action:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let i;return e[2]!==o||e[3]!==a?(i=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[a,o]}),e[2]=o,e[3]=a,e[4]=i):i=e[4],i}function Cs(n){const e=z.c(23),{onClose:s,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:i}=n,[c,r]=V.useState(""),l=dn(),u=l??[],{org:m}=oe(),{data:f}=re.useSession(),d=f?.user?.id??"anon",h=Nn(l),C=wn(),p=bs(m.slug),g=Sn(l),j=c.toLowerCase(),v=u.filter(_s).filter(F=>!g.has(F.id)).filter(ws).filter(F=>!c||F.title.toLowerCase().includes(j)),b=v.filter(Ns),w=v.filter(ys),S=at(m.id),D=!c||S.title.toLowerCase().includes(j),O=!!(o&&D);let x;e[0]!==s||e[1]!==o?(x=()=>{o?.(null),s(),r("")},e[0]=s,e[1]=o,e[2]=x):x=e[2];const k=x,T=F=>{if(o){o(F.id),s(),r("");return}_n({orgId:m.id,userId:d},F.id,h),C(),s(),r(""),p(F.id)},N="flex flex-col max-h-[min(640px,80dvh)]";let y;e[3]!==c?(y=t.jsx(rs,{value:c,onChange:r}),e[3]=c,e[4]=y):y=e[4];const P="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",I=o&&D&&S&&t.jsx(tt,{agent:S,selected:!a||a===S.id,onClick:k}),A=(b.length>0||!c)&&t.jsx(fs,{onImportFromGithub:i}),M=b.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id)),R=w.length>0&&t.jsx(ms,{}),X=w.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id));let L;e[5]!==O||e[6]!==c||e[7]!==v.length?(L=v.length===0&&!O&&c&&t.jsx(ds,{}),e[5]=O,e[6]=c,e[7]=v.length,e[8]=L):L=e[8];let ne;e[9]!==L||e[10]!==I||e[11]!==A||e[12]!==M||e[13]!==R||e[14]!==X?(ne=t.jsxs("div",{className:P,children:[I,A,M,R,X,L]}),e[9]=L,e[10]=I,e[11]=A,e[12]=M,e[13]=R,e[14]=X,e[15]=ne):ne=e[15];let q;e[16]!==s||e[17]!==m?(q=t.jsx(us,{org:m,onClose:s}),e[16]=s,e[17]=m,e[18]=q):q=e[18];let de;return e[19]!==ne||e[20]!==q||e[21]!==y?(de=t.jsxs("div",{className:N,children:[y,ne,q]}),e[19]=ne,e[20]=q,e[21]=y,e[22]=de):de=e[22],de}function ys(n){return!It(n.metadata)}function Ns(n){return It(n.metadata)}function ws(n){return!ln(n.id)}function _s(n){return!an(n.id)}function Ss(n){const e=z.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:o,trigger:a,onSelectAgent:i,selectedAgentId:c,side:r,align:l}=s,u=o===void 0?!1:o,m=r===void 0?"right":r,f=l===void 0?"start":l,[d,h]=V.useState(!1),[C,p]=V.useState(!1),g=kt(),{setOpenMobile:j}=pt(),v=yn(),b=v?"border border-border":void 0;let w;e[2]!==v?(w=A=>v?t.jsx(vs,{children:A}):A,e[2]=v,e[3]=w):w=e[3];const S=w;let D;e[4]!==g||e[5]!==j?(D=()=>{h(!1),g&&j(!1)},e[4]=g,e[5]=j,e[6]=D):D=e[6];const O=D;let x;e[7]!==O?(x=()=>{O(),p(!0)},e[7]=O,e[8]=x):x=e[8];const k=x;let T;e[9]!==O||e[10]!==k||e[11]!==i||e[12]!==d||e[13]!==c?(T=d&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(fn,{className:"h-4 w-24"})}),children:t.jsx(Cs,{onClose:O,onSelectAgent:i,selectedAgentId:c,onImportFromGithub:k})}),e[9]=O,e[10]=k,e[11]=i,e[12]=d,e[13]=c,e[14]=T):T=e[14];const N=T;let y;e[15]!==f||e[16]!==u||e[17]!==b||e[18]!==v||e[19]!==g||e[20]!==d||e[21]!==N||e[22]!==m||e[23]!==a||e[24]!==S?(y=g?t.jsxs(t.Fragment,{children:[a?t.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:a}):u?S(t.jsx(gs,{setOpen:h,emptyCtaClass:b})):t.jsx(hs,{setOpen:h,highlightEmpty:v,emptyCtaClass:b}),t.jsx(wt,{open:d,onOpenChange:h,direction:"bottom",children:t.jsxs(_t,{className:"max-h-[85dvh] p-0",children:[t.jsx(ps,{}),N]})})]}):t.jsxs(bt,{open:d,onOpenChange:A=>{A&&!d&&E("agent_browser_opened",{surface:"desktop_popover"}),h(A)},children:[a?t.jsx(Le,{asChild:!0,children:a}):u?S(t.jsx(Le,{asChild:!0,children:t.jsx(xs,{emptyCtaClass:b})})):t.jsx(js,{wrapEmptyHint:S,highlightEmpty:v,emptyCtaClass:b}),t.jsx(vt,{className:"w-[380px] p-0 overflow-hidden",side:m,align:f,children:N})]}),e[15]=f,e[16]=u,e[17]=b,e[18]=v,e[19]=g,e[20]=d,e[21]=N,e[22]=m,e[23]=a,e[24]=S,e[25]=y):y=e[25];let P;e[26]!==C?(P=t.jsx(jn,{open:C,onOpenChange:p,mode:"agent"}),e[26]=C,e[27]=P):P=e[27];let I;return e[28]!==P||e[29]!==y?(I=t.jsxs(t.Fragment,{children:[y,P]}),e[28]=P,e[29]=y,e[30]=I):I=e[30],I}const ks="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 Ds(n){const e=z.c(29),{agentId:s,fallback:o,onOpenHome:a,onPick:i}=n,c=B(),r=un(s)??o??null;let l,u,m,f,d;e[0]!==r?.title||e[1]!==a||e[2]!==c?(d=r?.title??c("header.shellBreadcrumb.superAgentDefaultName"),f="flex min-w-0 items-center gap-0",l="button",u=a,m=c("header.shellBreadcrumb.openAgentHome",{name:d}),e[0]=r?.title,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=m,e[6]=f,e[7]=d):(l=e[3],u=e[4],m=e[5],f=e[6],d=e[7]);const h=r?.icon??null;let C;e[8]!==h||e[9]!==d?(C=t.jsx(gt,{icon:h,name:d,size:"xs"}),e[8]=h,e[9]=d,e[10]=C):C=e[10];let p;e[11]!==l||e[12]!==u||e[13]!==m||e[14]!==C?(p=t.jsx("button",{type:l,onClick:u,"aria-label":m,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:C}),e[11]=l,e[12]=u,e[13]=m,e[14]=C,e[15]=p):p=e[15];let g;e[16]!==d?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:d}),e[16]=d,e[17]=g):g=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=j):j=e[18];let v;e[19]!==g?(v=t.jsxs("button",{type:"button",className:ks,children:[g,j]}),e[19]=g,e[20]=v):v=e[20];let b;e[21]!==s||e[22]!==i||e[23]!==v?(b=t.jsx(Ss,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:i,trigger:v}),e[21]=s,e[22]=i,e[23]=v,e[24]=b):b=e[24];let w;return e[25]!==b||e[26]!==f||e[27]!==p?(w=t.jsxs("div",{className:f,children:[p,b]}),e[25]=b,e[26]=f,e[27]=p,e[28]=w):w=e[28],w}function Oo(n){const e=z.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:o}=s,a=B(),{org:i}=oe(),{state:c,isMobile:r}=pt(),l=Bt().invitations.length>0,u=c==="collapsed"||r;let m;e[2]!==l||e[3]!==i.name||e[4]!==a?(m=l?a("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:i.name}):a("header.shellBreadcrumb.switchOrganization",{name:i.name}),e[2]=l,e[3]=i.name,e[4]=a,e[5]=m):m=e[5];let f;e[6]!==i?(f=t.jsx(lt,{org:i,size:"sm"}),e[6]=i,e[7]=f):f=e[7];let d;e[8]!==l||e[9]!==u?(d=l&&t.jsx("span",{className:K("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",u?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=l,e[9]=u,e[10]=d):d=e[10];let h;e[11]!==f||e[12]!==d?(h=t.jsxs("span",{className:"relative inline-flex",children:[f,d]}),e[11]=f,e[12]=d,e[13]=h):h=e[13];let C;e[14]!==i.name||e[15]!==o?(C=o&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:i.name}),e[14]=i.name,e[15]=o,e[16]=C):C=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==h||e[20]!==C?(g=t.jsx(Ce,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":m,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:[h,C,p]})}),e[18]=m,e[19]=h,e[20]=C,e[21]=g):g=e[21];let j;e[22]!==i.slug||e[23]!==g?(j=t.jsx(os,{orgParam:i.slug,trigger:g}),e[22]=i.slug,e[23]=g,e[24]=j):j=e[24];let v;e[25]!==i.name?(v=t.jsx(ye,{side:"bottom",children:i.name}),e[25]=i.name,e[26]=v):v=e[26];let b;return e[27]!==v||e[28]!==j?(b=t.jsxs(Ne,{children:[j,v]}),e[27]=v,e[28]=j,e[29]=b):b=e[29],b}function Mo(n){const e=z.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:o}=s,{org:a}=oe();let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[2]=i):i=e[2];const c=st(i);let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[3]=r):r=e[3];const l=ot(r),{threads:u}=Dt(),{data:m}=re.useSession(),{setTaskId:f,createNewTask:d}=At();let h;e[4]!==a.id?(h=at(a.id),e[4]=a.id,e[5]=h):h=e[5];const C=h,p=C.id,g=c.taskId?l.virtualmcpid??p:p;let j;e[6]!==d||e[7]!==p||e[8]!==o||e[9]!==m?.user?.id||e[10]!==f||e[11]!==u?(j=O=>{const x=O??p,k=kn(u,x,m?.user?.id);k?f(k.id,x):d(x),o?.()},e[6]=d,e[7]=p,e[8]=o,e[9]=m?.user?.id,e[10]=f,e[11]=u,e[12]=j):j=e[12];const v=j;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=b):b=e[13];const w=g===p?C:void 0;let S;e[14]!==g||e[15]!==v?(S=()=>v(g),e[14]=g,e[15]=v,e[16]=S):S=e[16];let D;return e[17]!==g||e[18]!==v||e[19]!==w||e[20]!==S?(D=t.jsx(V.Suspense,{fallback:b,children:t.jsx(Ds,{agentId:g,fallback:w,onOpenHome:S,onPick:v})}),e[17]=g,e[18]=v,e[19]=w,e[20]=S,e[21]=D):D=e[21],D}function $o(){const n=z.c(24),e=B(),{org:s}=oe();let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[0]=o):o=n[0];const a=st(o);let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[1]=i):i=n[1];const c=ot(i),{threads:r}=Dt(),{createNewTask:l}=At();let u;n[2]!==s.id?(u=at(s.id),n[2]=s.id,n[3]=u):u=n[3];const m=u.id,f=a.taskId?c.virtualmcpid??m:m;let d;n[4]!==a.taskId||n[5]!==r?(d=(a.taskId?r.find(D=>D.id===a.taskId)?.branch:null)??null,n[4]=a.taskId,n[5]=r,n[6]=d):d=n[6];const h=d;let C;n[7]!==f||n[8]!==l||n[9]!==h?(C=()=>{l(f,h)},n[7]=f,n[8]=l,n[9]=h,n[10]=C):C=n[10];const p=C;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let j;n[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(sn,{size:16}),n[13]=j):j=n[13];let v;n[14]!==p||n[15]!==g?(v=t.jsx(Ce,{asChild:!0,children:t.jsx("button",{type:"button",onClick:p,"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:j})}),n[14]=p,n[15]=g,n[16]=v):v=n[16];let b;n[17]!==e?(b=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=b):b=n[18];let w;n[19]!==b?(w=t.jsx(ye,{side:"bottom",children:b}),n[19]=b,n[20]=w):w=n[20];let S;return n[21]!==v||n[22]!==w?(S=t.jsxs(Ne,{children:[v,w]}),n[21]=v,n[22]=w,n[23]=S):S=n[23],S}function Is({open:n,onOpenChange:e,onCreated:s}){const o=B(),{org:a}=oe(),{data:i}=re.useSession(),{stdioEnabled:c}=qt(),r=kt(),l=Ft(),u=Pt(),f=Tt(u,"").items,d=Gt({resolver:Xt(Vn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),h=d.watch("ui_type"),C=d.watch("connection_url"),p=d.watch("npx_package"),g=$e({uiType:h,connectionUrl:C??"",npxPackage:p??""})??ut({uiType:h,connectionUrl:C??"",registryItems:f}),j=x=>{const k=x.trim();if(!k)return;const T=!!d.formState.dirtyFields.title,N=!!d.formState.dirtyFields.description,y=!!d.formState.dirtyFields.env_vars,P=A=>{if(A&&(!T&&!d.getValues("title").trim()&&A.title&&d.setValue("title",A.title,{shouldDirty:!1}),!N&&!(d.getValues("description")??"").trim()&&A.description&&d.setValue("description",A.description,{shouldDirty:!1}),!y&&A.envVarKeys?.length)){const M=d.getValues("env_vars")??[],R=new Set(M.map(L=>L.key)),X=A.envVarKeys.filter(L=>!R.has(L));X.length>0&&d.setValue("env_vars",[...M,...X.map(L=>({key:L,value:""}))],{shouldDirty:!0})}},I=Hn(k);if(I&&c){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",I.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),P($e({uiType:"NPX",npxPackage:I.packageName}));return}if(k.startsWith("http://")||k.startsWith("https://")){const A=h==="HTTP"||h==="SSE"||h==="Websocket"?h:"HTTP";d.setValue("ui_type",A,{shouldDirty:!0}),d.setValue("connection_url",k,{shouldDirty:!0}),P($e({uiType:A,connectionUrl:k})??ut({uiType:A,connectionUrl:k,registryItems:f}));return}h==="NPX"&&P($e({uiType:"NPX",npxPackage:k}))},v=x=>{x||d.reset(),e(x)},b=async x=>{let k,T=null,N=null,y=null;x.ui_type==="NPX"?(k="STDIO",T="",y=Un(x.npx_package||"",x.env_vars||[])):x.ui_type==="STDIO"?(k="STDIO",T="",y=Kn(x.stdio_command||"",x.stdio_args||"",x.stdio_cwd,x.env_vars||[])):(k=x.ui_type,T=x.connection_url||"",N=x.connection_token||null);const P=In("conn");try{await l.create.mutateAsync({id:P,title:x.title,description:x.description||null,connection_type:k,connection_url:T,connection_token:N,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:i?.user?.id||"system",organization_id:a.id,icon:x.icon??null,app_name:null,app_id:null,connection_headers:y,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),s?.(P)}catch{H.error(o("connections.createConnectionDialog.failedToCreateConnection"))}},w=o("connections.createConnectionDialog.title"),S=o("connections.createConnectionDialog.description"),D=d.formState.isSubmitting?o("connections.createConnectionDialog.saving"):o("connections.createConnectionDialog.createButton"),O=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(W,{control:d.control,name:"ui_type",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.typeLabel")}),t.jsxs($n,{value:x.value,onValueChange:x.onChange,children:[t.jsx(Z,{children:t.jsx(Fn,{children:t.jsx(Bn,{})})}),t.jsxs(Ln,{children:[t.jsx(ke,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.httpType")]})}),t.jsx(ke,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.sseType")]})}),t.jsx(ke,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.websocketType")]})}),c&&t.jsxs(t.Fragment,{children:[t.jsx(ke,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Be,{className:"w-4 h-4"}),o("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(ke,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(on,{className:"w-4 h-4"}),o("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(ee,{})]})}),h==="NPX"&&t.jsx(W,{control:d.control,name:"npx_package",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.npmPackagePlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("npx_package",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),h==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(W,{control:d.control,name:"stdio_command",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.commandLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.commandPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"stdio_args",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.argumentsLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.argumentsPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"stdio_cwd",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.workingDirectoryPlaceholder"),...x,value:x.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(ee,{})]})})]}),(h==="NPX"||h==="STDIO")&&t.jsx(W,{control:d.control,name:"env_vars",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(Z,{children:t.jsx(Rn,{value:x.value??[],onChange:x.onChange})}),t.jsx(ee,{})]})}),h!=="NPX"&&h!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(W,{control:d.control,name:"connection_url",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.urlLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.urlPlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("connection_url",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"connection_token",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:g?.token?.label??o("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(Z,{children:t.jsx(ce,{type:"password",placeholder:g?.token?.placeholder??o("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...x,value:x.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:o("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"title",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.namePlaceholder"),...x})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"description",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.descriptionLabel")}),t.jsx(Z,{children:t.jsx(En,{placeholder:o("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...x,value:x.value??""})}),t.jsx(ee,{})]})})]});return r?t.jsx(wt,{open:n,onOpenChange:v,children:t.jsxs(_t,{className:"max-h-[90vh]",children:[t.jsx(gn,{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(St,{children:w}),t.jsx(hn,{className:"mt-1",children:S})]}),t.jsx(pn,{asChild:!0,children:t.jsx(te,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(yt,{size:16})})})]})}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:O}),t.jsx(xn,{children:t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:D})})]})})]})}):t.jsx(zt,{open:n,onOpenChange:v,children:t.jsxs(Ot,{className:"sm:max-w-[525px]",children:[t.jsxs(Mt,{children:[t.jsx($t,{children:w}),t.jsx(On,{children:S})]}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"py-4",children:O}),t.jsxs(Mn,{children:[t.jsx(te,{type:"button",variant:"outline",onClick:()=>v(!1),children:o("connections.createConnectionDialog.cancelButton")}),t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:D})]})]})})]})})}function As(n){const e=z.c(72),{mode:s,agentId:o,addedConnectionIds:a,onAdd:i,onCloneAndAdd:c,onConnectAndAdd:r,connectingItemId:l,search:u,onCreateConnection:m,onBrowseNavigate:f,defaultTab:d}=n,h=s===void 0?"add":s,C=d===void 0?"connected":d,p=B(),{org:g}=oe(),j=V.useDeferredValue(u),v=u!==j;let b;e[0]!==j?(b=j.trim().toLowerCase(),e[0]=j,e[1]=b):b=e[1];const w=b;let S;e[2]!==C?(S=_=>_??C,e[2]=C,e[3]=S):S=e[3];const[D,O]=Qt(Wt.connectionsTab(g.slug)+(C==="all"?":home-modal":":agent-modal"),S);let x;e[4]!==D||e[5]!==O?(x=_=>{_!==D&&E("connections_dialog_tab_changed",{to_tab:_}),O(_)},e[4]=D,e[5]=O,e[6]=x):x=e[6];const k=x;let T;e[7]!==g.id||e[8]!==g.slug?(T={connectionId:cn,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=T):T=e[9];const N=rn(T),y=j?.trim().split(/\s+/).filter(Boolean)??[],P=y.length>0?{operator:"or",conditions:y.flatMap(Bs)}:void 0,I={...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(I),{data:M,fetchNextPage:R,hasNextPage:X,isFetchingNextPage:L}=Xn({queryKey:it.collectionListInfinite(N,g.id,"","CONNECTIONS",A),queryFn:async _=>{const{pageParam:$}=_,se=$===void 0?0:$;return(await N.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:se}})).structuredContent},initialPageParam:0,getNextPageParam:$s,staleTime:3e4}),ne=M?.pages.flatMap(Ms)??[],q=zn(ne),de=new Set(ne.filter(Os).map(zs)),F=Pt(),ie=Tt(F,j),Re=mt(ie.loadMore,ie.hasMore,ie.isLoadingMore),He=mt(R,X??!1,L),G=D==="all"||!!w,ct=G?ie.items.filter(_=>{const $=An(_);if($&&de.has($))return!1;if(!w)return!0;const se=Ve(_._meta),ae=[_.title,_.description,_.name,_.server?.title,_.server?.description,_.server?.name,se?.friendly_name,se?.friendlyName].filter(Boolean).join(" ").toLowerCase();return y.some(Q=>ae.includes(Q.toLowerCase()))}):[],_e=ct.filter(Ts),Se=ct.filter(Ps);let Ie;e[10]!==a?(Ie=_=>_.some($=>a.has($.id)),e[10]=a,e[11]=Ie):Ie=e[11];const Ue=Ie;let Ae;e[12]!==a||e[13]!==o||e[14]!==l||e[15]!==Ue||e[16]!==h||e[17]!==i||e[18]!==f||e[19]!==c||e[20]!==p?(Ae=(_,$,se,ae,Q)=>{const Me=Ue(Q),be=Q.find(le=>!a.has(le.id)),U=Q[0];if(h==="browse"){const le=qn(U);return t.jsx(Ye,{connection:{title:$,icon:se,description:Q.length>1?`${Q.length} instances`:ae??void 0},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",p("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{E("connection_browse_clicked",{app_name:U.app_name??null,connection_id:U.id,instances_count:Q.length}),f?.(le)}},_)}return t.jsx(Ye,{connection:{title:$,icon:se,description:ae},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Me&&t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",p("virtualMcp.connectionDialogContent.added")]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),be?(E("connection_add_clicked",{action:"use_existing",app_name:U.app_name??null,connection_id:be.id}),o&&E("agent_connection_attached",{agent_id:o,connection_id:be.id,app_name:U.app_name??null,mode:"existing"}),i(be.id)):(E("connection_add_clicked",{action:"clone",app_name:U.app_name??null,base_connection_id:U.id}),c(U))},children:p("virtualMcp.connectionDialogContent.add")})]})},_)},e[12]=a,e[13]=o,e[14]=l,e[15]=Ue,e[16]=h,e[17]=i,e[18]=f,e[19]=c,e[20]=p,e[21]=Ae):Ae=e[21];const Pe=Ae;let Te;e[22]!==l||e[23]!==h||e[24]!==r||e[25]!==p?(Te=_=>{const $=Ve(_._meta),se=$?.friendlyName||$?.friendly_name||_.server?.title||_.title||_.server?.name||_.name||_.id||"",ae=_.server?.description||_.description||null,Q=_.server?.icons?.[0]?.src||Pn(_.server?.repository)||null,Me=$?.official===!0,be=$?.verified===!0,U=$?.owner==="deco";return t.jsx(Ye,{connection:{title:se,description:ae,icon:Q},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[U&&t.jsxs(Ne,{children:[t.jsx(Ce,{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:p("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByDeco")})]}),!U&&Me&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!U&&!Me&&be&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),E("connection_add_clicked",{action:"connect_new",registry_item_id:_.id,app_name:$?.friendlyName||_.server?.name||_.name||null}),r(_)},children:l===_.id?t.jsx(De,{size:14,className:"animate-spin"}):p(h==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${_.id}`)},e[22]=l,e[23]=h,e[24]=r,e[25]=p,e[26]=Te):Te=e[26];const rt=Te;let ue;e[27]!==D||e[28]!==k||e[29]!==m||e[30]!==w||e[31]!==p?(ue=!w&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(Gn,{tabs:[{id:"all",label:p("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:p("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:D,onTabChange:_=>k(_)}),t.jsxs(te,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{E("connections_dialog_custom_clicked"),m()},children:[t.jsx(we,{size:12}),p("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=D,e[28]=k,e[29]=m,e[30]=w,e[31]=p,e[32]=ue):ue=e[32];const Ke=v&&"opacity-50 pointer-events-none";let me;e[33]!==Ke?(me=K("flex-1 overflow-auto p-5 transition-opacity duration-150",Ke),e[33]=Ke,e[34]=me):me=e[34];const Et="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ze;e[35]!==Pe?(ze=_=>{if(_.type==="group")return Pe(_.key,_.title,_.icon,null,_.connections);const $=_.connection;return Pe($.id,$.title,$.icon,$.description??null,[$])},e[35]=Pe,e[36]=ze):ze=e[36];const qe=q.map(ze);let fe;e[37]!==He?(fe=t.jsx("div",{ref:He,className:"col-span-full h-1"}),e[37]=He,e[38]=fe):fe=e[38];let ge;e[39]!==L?(ge=L&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=L,e[40]=ge):ge=e[40];const Ge=G&&_e.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(Je,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:p("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Xe=G&&_e.map(rt),Qe=G&&Se.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:p("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),We=G&&Se.map(rt);let he;e[41]!==Re||e[42]!==F||e[43]!==G?(he=G&&F.length>0&&t.jsx("div",{ref:Re,className:"col-span-full h-1"}),e[41]=Re,e[42]=F,e[43]=G,e[44]=he):he=e[44];let pe;e[45]!==ie.isLoadingMore||e[46]!==G?(pe=G&&ie.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=ie.isLoadingMore,e[46]=G,e[47]=pe):pe=e[47];let xe;e[48]!==qe||e[49]!==fe||e[50]!==ge||e[51]!==Ge||e[52]!==Xe||e[53]!==Qe||e[54]!==We||e[55]!==he||e[56]!==pe?(xe=t.jsxs("div",{className:Et,children:[qe,fe,ge,Ge,Xe,Qe,We,he,pe]}),e[48]=qe,e[49]=fe,e[50]=ge,e[51]=Ge,e[52]=Xe,e[53]=Qe,e[54]=We,e[55]=he,e[56]=pe,e[57]=xe):xe=e[57];let je;e[58]!==D||e[59]!==q.length||e[60]!==Se||e[61]!==u||e[62]!==p||e[63]!==_e?(je=q.length===0&&_e.length===0&&Se.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?p("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:u}):p(D==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=D,e[59]=q.length,e[60]=Se,e[61]=u,e[62]=p,e[63]=_e,e[64]=je):je=e[64];let ve;e[65]!==me||e[66]!==xe||e[67]!==je?(ve=t.jsxs("div",{className:me,children:[xe,je]}),e[65]=me,e[66]=xe,e[67]=je,e[68]=ve):ve=e[68];let Oe;return e[69]!==ue||e[70]!==ve?(Oe=t.jsxs(t.Fragment,{children:[ue,ve]}),e[69]=ue,e[70]=ve,e[71]=Oe):Oe=e[71],Oe}function Ps(n){return!n.verified&&!Ve(n._meta)?.verified&&!n.meta?.verified}function Ts(n){return n.verified||Ve(n._meta)?.verified||n.meta?.verified}function zs(n){return n.app_name}function Os(n){return n.app_name}function Ms(n){return n?.items??[]}function $s(n,e){if(n?.hasMore)return e.reduce(Fs,0)}function Fs(n,e){return n+(e?.items?.length??0)}function Bs(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Fo({open:n,onOpenChange:e,defaultTab:s,initialSearch:o="",...a}){const i=B(),c=a.mode??"add",r="agentId"in a?a.agentId:void 0,l="addedConnectionIds"in a?a.addedConnectionIds??new Set:new Set,u="onAdd"in a&&a.onAdd?a.onAdd:N=>{},m=(N,y,P)=>{r&&E("agent_connection_attached",{agent_id:r,connection_id:N,app_name:y,mode:P})},[f,d]=V.useState(null),[h,C]=V.useState(o),[p,g]=V.useState(!1),{org:j}=oe(),{data:v}=re.useSession(),b=Ft(),w=Yt(),S=nt(),D=N=>{e(!1),S({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:N}})},O=()=>{w.invalidateQueries({predicate:N=>{const y=N.queryKey;return y[1]===j.id&&y[3]==="collection"&&y[4]==="CONNECTIONS"}})},x=async(N,y)=>{E("connection_oauth_succeeded",{connection_id:N,flow:y});const P=new URL(`/api/${j.slug}/mcp/${N}`,window.location.origin);await w.invalidateQueries({queryKey:it.isMCPAuthenticated(P.href,null)}),O()},k=async N=>{d(N.app_name??N.id);try{const P=`${N.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await b.create.mutateAsync({title:P,description:N.description??null,connection_type:N.connection_type,connection_url:N.connection_url??null,connection_token:null,icon:N.icon??null,app_name:N.app_name??null,app_id:N.app_id??null,connection_headers:N.connection_headers??null})).id,M=await et({connectionId:A,orgId:j.id,orgSlug:j.slug,persistFallback:R=>b.update.mutateAsync({id:A,data:{connection_token:R}}).then(()=>{})});if(M.ran&&!M.ok){E("connection_oauth_failed",{connection_id:A,flow:"clone",error:M.error??"no_token"}),H.error(i("virtualMcp.addConnectionDialog.authenticationFailedError",{error:M.error??"no token received"})),await b.delete.mutateAsync(A);return}M.ran&&await x(A,"clone"),m(A,N.app_name??null,"clone"),u(A)}catch(y){console.error("Failed to add connection:",y),H.error(i("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{d(null)}},T=async N=>{if(!(!j||!v?.user?.id)){d(N.id);try{const y=Tn(N,j.id,v.user.id,{remoteIndex:0}),P=y.connection_type==="STDIO",I=!!y.connection_url,A=P&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!I&&!A){H.error(i("virtualMcp.addConnectionDialog.mcpServerConnectionError")),d(null);return}const{id:M}=await b.create.mutateAsync(y),R=await et({connectionId:M,orgId:j.id,orgSlug:j.slug,persistFallback:X=>b.update.mutateAsync({id:M,data:{connection_token:X}}).then(()=>{})});if(R.ran&&!R.ok){E("connection_oauth_failed",{connection_id:M,flow:"connect_new",error:R.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:R.error??"no token received"})}),m(M,y.app_name??null,"new"),u(M);return}R.ran?(await x(M,"connect_new"),H.success(i("virtualMcp.addConnectionDialog.connectedAuthenticated"))):H.success(i("virtualMcp.addConnectionDialog.connected")),m(M,y.app_name??null,"new"),u(M)}catch(y){console.error("Failed to connect:",y),H.error(i("virtualMcp.addConnectionDialog.failedToConnect"))}finally{d(null)}}};return t.jsxs(zt,{open:n,onOpenChange:e,children:[t.jsxs(Ot,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(Mt,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx($t,{className:"text-base font-semibold",children:i(c==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(Dn,{value:h,onChange:C,placeholder:i("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(As,{mode:c,agentId:r,addedConnectionIds:l,onAdd:u,onCloneAndAdd:k,onConnectAndAdd:T,connectingItemId:f,search:h,onCreateConnection:()=>g(!0),onBrowseNavigate:D,defaultTab:s})})]}),t.jsx(Is,{open:p,onOpenChange:g,onCreated:async N=>{g(!1);const y=await et({connectionId:N,orgId:j.id,orgSlug:j.slug,persistFallback:P=>b.update.mutateAsync({id:N,data:{connection_token:P}}).then(()=>{})});if(y.ran&&!y.ok){E("connection_oauth_failed",{connection_id:N,flow:"custom_create",error:y.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:y.error??"no token received"})}),m(N,null,"custom"),u(N),e(!1);return}y.ran&&await x(N,"custom_create"),m(N,null,"custom"),u(N),e(!1)}})]})}const ft=new Map;function Bo(){const{org:n}=oe(),e=Qn(),s=Wn(),o=s.find(g=>g.providerId==="deco"),{data:a,isLoading:i,refetch:c,isFetching:r}=Jt({queryKey:it.aiProviderCredits(n.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),l=a?.balanceCents??null,u=l!=null?l/100:null,m=V.useRef(new Map);if(l!=null){const g=ft.get(n.id);m.current.get(n.id)&&g!=null&&l>g&&E("credits_topped_up_detected",{organization_id:n.id,delta_cents:l-g,previous_balance_cents:g,new_balance_cents:l}),ft.set(n.id,l),m.current.set(n.id,!0)}const f=!!o,d=l!=null&&l>0,h=l!=null&&l===0,C=l!=null&&l===200,p=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:f,decoKeyId:o?.id??null,balanceCents:l,balanceDollars:u,hasCredits:d,isZeroBalance:h,isInitialFreeCredit:C,hasOnlyDecoProvider:p,isLoading:i,isFetching:r,refetch:c}}export{Mo as A,To as C,$o as N,Oo as O,zo as a,Fo as b,os as c,lt as d,Bo as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-BXVYW9oP.js";import{d as R,c as u}from"./decopilot-sse-pool-Bq7TSvHG.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-Ce7wzSlG.js";import{d as R,c as u}from"./decopilot-sse-pool-CfTcpBf8.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,F as se,o as ie,r as ce,t as Y,ba as re,bb as ae}from"./index-BXVYW9oP.js";import{A as z,a as G,b as V,c as X,d as Z,e as ee,f as te,g as ne}from"./alert-dialog-N5y_pt8L.js";import{u as de}from"./studio-tools-B0_AcSKZ.js";function ue(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),w=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 H=s.mode==="deleting"&&s.connection.title;let o;e[8]!==H?(o=n.jsx("span",{className:"font-medium text-foreground",children:H}),e[8]=H,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 p;e[31]!==w||e[32]!==j||e[33]!==m?(p=n.jsx(ne,{open:w,onOpenChange:m,children:j}),e[31]=w,e[32]=j,e[33]=m,e[34]=p):p=e[34];const J=s.mode==="force-deleting";let N;e[35]!==a?(N=W=>{W||a()},e[35]=a,e[36]=N):N=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 K;e[73]!==R||e[74]!==U?(K=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=K):K=e[75];let $;e[76]!==I||e[77]!==K?($=n.jsxs(te,{children:[I,K]}),e[76]=I,e[77]=K,e[78]=$):$=e[78];let k;e[79]!==J||e[80]!==N||e[81]!==$?(k=n.jsx(ne,{open:J,onOpenChange:N,children:$}),e[79]=J,e[80]=N,e[81]=$,e[82]=k):k=e[82];let Q;return e[83]!==p||e[84]!==k?(Q=n.jsxs(n.Fragment,{children:[p,k]}),e[83]=p,e[84]=k,e[85]=Q):Q=e[85],Q}function De({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=de(),[d,c]=ce.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},w=o=>{re(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===ae&&l.queryKey[3]===o})},m=o=>{t(),w(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{ue as D,De as u};
1
+ import{c as oe,b as le,j as n,F as se,o as ie,r as ce,t as Y,bb as re,bc as ae}from"./index-Ce7wzSlG.js";import{A as z,a as G,b as V,c as X,d as Z,e as ee,f as te,g as ne}from"./alert-dialog-BFD6K547.js";import{u as de}from"./studio-tools-9EYu19Cv.js";function ue(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),w=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 H=s.mode==="deleting"&&s.connection.title;let o;e[8]!==H?(o=n.jsx("span",{className:"font-medium text-foreground",children:H}),e[8]=H,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 p;e[31]!==w||e[32]!==j||e[33]!==m?(p=n.jsx(ne,{open:w,onOpenChange:m,children:j}),e[31]=w,e[32]=j,e[33]=m,e[34]=p):p=e[34];const J=s.mode==="force-deleting";let N;e[35]!==a?(N=W=>{W||a()},e[35]=a,e[36]=N):N=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 K;e[73]!==R||e[74]!==U?(K=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=K):K=e[75];let $;e[76]!==I||e[77]!==K?($=n.jsxs(te,{children:[I,K]}),e[76]=I,e[77]=K,e[78]=$):$=e[78];let k;e[79]!==J||e[80]!==N||e[81]!==$?(k=n.jsx(ne,{open:J,onOpenChange:N,children:$}),e[79]=J,e[80]=N,e[81]=$,e[82]=k):k=e[82];let Q;return e[83]!==p||e[84]!==k?(Q=n.jsxs(n.Fragment,{children:[p,k]}),e[83]=p,e[84]=k,e[85]=Q):Q=e[85],Q}function De({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=de(),[d,c]=ce.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},w=o=>{re(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===ae&&l.queryKey[3]===o})},m=o=>{t(),w(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{ue as D,De as u};
@@ -1 +1 @@
1
- import{c as s,n as m,K as c}from"./index-BXVYW9oP.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,n as m,K as c}from"./index-Ce7wzSlG.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,F as c,K as r,n as d,x as y,o as C,e as F}from"./index-BXVYW9oP.js";import{u as f}from"./studio-tools-B0_AcSKZ.js";function m(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.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}=y(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.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],d(s)}function q(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_CREATE",{...a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.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],F(l)}function _(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_DELETE",{id:a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.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],F(l)}export{I as a,q as b,_ as c,m as u};
1
+ import{c as u,F as c,K as r,n as d,x as y,o as C,e as F}from"./index-Ce7wzSlG.js";import{u as f}from"./studio-tools-9EYu19Cv.js";function m(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.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}=y(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.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],d(s)}function q(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_CREATE",{...a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.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],F(l)}function _(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_DELETE",{id:a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.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],F(l)}export{I as a,q as b,_ as c,m as u};
@@ -1 +1 @@
1
- import{aU as l,e3 as d,e4 as v,r as i}from"./index-BXVYW9oP.js";var p=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:g}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",P=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:P,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:g&&!o&&!c,isRefetching:h&&!P&&!f}}};function b(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),g=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,g.current=t,s.current=n,o.current=u;const[P]=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&&g.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return P}export{p as I,b as u};
1
+ import{aU as l,e4 as d,e5 as v,r as i}from"./index-Ce7wzSlG.js";var p=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:g}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",P=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:P,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:g&&!o&&!c,isRefetching:h&&!P&&!f}}};function b(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),g=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,g.current=t,s.current=n,o.current=u;const[P]=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&&g.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return P}export{p as I,b as u};
@@ -1 +1 @@
1
- import{c as g,F as N,K as y,n as _,o as A,e as I,t as q}from"./index-BXVYW9oP.js";import{a as S}from"./use-capability-Bx72zdZ_.js";import{u as O}from"./studio-tools-B0_AcSKZ.js";function b(){const e=g.c(10),{org:r}=N(),u=O(),{capabilities:a,isPrivileged:c}=S(),d=c||!!a["members:manage"];let t;e[0]!==r.id?(t=y.organizationJoinRequests(r.id),e[0]=r.id,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=u,e[3]=s):s=e[3];const i=!!r.id&&d;let n;e[4]!==t||e[5]!==s||e[6]!==i?(n={queryKey:t,queryFn:s,enabled:i},e[4]=t,e[5]=s,e[6]=i,e[7]=n):n=e[7];const{data:l}=_(n);let o;return e[8]!==l?.requests?(o=l?.requests??[],e[8]=l?.requests,e[9]=o):o=e[9],o}function K(){const e=g.c(21),{org:r,locator:u}=N(),a=O(),c=A();let d;e[0]!==u||e[1]!==r||e[2]!==c?(d=()=>{c.invalidateQueries({queryKey:y.organizationJoinRequests(r.id)}),c.invalidateQueries({queryKey:y.members(u)})},e[0]=u,e[1]=r,e[2]=c,e[3]=d):d=e[3];const t=d;let s;e[4]!==a?(s=R=>a.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:R}),e[4]=a,e[5]=s):s=e[5];let i;e[6]!==t?(i=()=>{t(),q.success("Request approved")},e[6]=t,e[7]=i):i=e[7];let n;e[8]!==s||e[9]!==i?(n={mutationFn:s,onSuccess:i,onError:v},e[8]=s,e[9]=i,e[10]=n):n=e[10];const l=I(n);let o;e[11]!==a?(o=R=>a.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:R}),e[11]=a,e[12]=o):o=e[12];let f;e[13]!==t?(f=()=>{t(),q.success("Request denied")},e[13]=t,e[14]=f):f=e[14];let m;e[15]!==o||e[16]!==f?(m={mutationFn:o,onSuccess:f,onError:T},e[15]=o,e[16]=f,e[17]=m):m=e[17];const E=I(m);let p;return e[18]!==l||e[19]!==E?(p={approve:l,deny:E},e[18]=l,e[19]=E,e[20]=p):p=e[20],p}function T(e){return q.error(e instanceof Error?e.message:"Failed to deny")}function v(e){return q.error(e instanceof Error?e.message:"Failed to approve")}export{K as a,b as u};
1
+ import{c as g,F as N,K as y,n as _,o as A,e as I,t as q}from"./index-Ce7wzSlG.js";import{a as S}from"./use-capability-BCL58O59.js";import{u as O}from"./studio-tools-9EYu19Cv.js";function b(){const e=g.c(10),{org:r}=N(),u=O(),{capabilities:a,isPrivileged:c}=S(),d=c||!!a["members:manage"];let t;e[0]!==r.id?(t=y.organizationJoinRequests(r.id),e[0]=r.id,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=u,e[3]=s):s=e[3];const i=!!r.id&&d;let n;e[4]!==t||e[5]!==s||e[6]!==i?(n={queryKey:t,queryFn:s,enabled:i},e[4]=t,e[5]=s,e[6]=i,e[7]=n):n=e[7];const{data:l}=_(n);let o;return e[8]!==l?.requests?(o=l?.requests??[],e[8]=l?.requests,e[9]=o):o=e[9],o}function K(){const e=g.c(21),{org:r,locator:u}=N(),a=O(),c=A();let d;e[0]!==u||e[1]!==r||e[2]!==c?(d=()=>{c.invalidateQueries({queryKey:y.organizationJoinRequests(r.id)}),c.invalidateQueries({queryKey:y.members(u)})},e[0]=u,e[1]=r,e[2]=c,e[3]=d):d=e[3];const t=d;let s;e[4]!==a?(s=R=>a.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:R}),e[4]=a,e[5]=s):s=e[5];let i;e[6]!==t?(i=()=>{t(),q.success("Request approved")},e[6]=t,e[7]=i):i=e[7];let n;e[8]!==s||e[9]!==i?(n={mutationFn:s,onSuccess:i,onError:v},e[8]=s,e[9]=i,e[10]=n):n=e[10];const l=I(n);let o;e[11]!==a?(o=R=>a.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:R}),e[11]=a,e[12]=o):o=e[12];let f;e[13]!==t?(f=()=>{t(),q.success("Request denied")},e[13]=t,e[14]=f):f=e[14];let m;e[15]!==o||e[16]!==f?(m={mutationFn:o,onSuccess:f,onError:T},e[15]=o,e[16]=f,e[17]=m):m=e[17];const E=I(m);let p;return e[18]!==l||e[19]!==E?(p={approve:l,deny:E},e[18]=l,e[19]=E,e[20]=p):p=e[20],p}function T(e){return q.error(e instanceof Error?e.message:"Failed to deny")}function v(e){return q.error(e instanceof Error?e.message:"Failed to approve")}export{K as a,b as u};