decocms 4.239.1 → 4.239.2

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 (233) hide show
  1. package/dist/client/assets/{AlertCircle-DYAl57lV.js → AlertCircle-CeleFBrs.js} +1 -1
  2. package/dist/client/assets/{AreaChart-B9EI3aBK.js → AreaChart-Cr68R9KD.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-Dfy0Yp_E.js → ArrowLeft-CwsJ1Sfc.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-ENID-3ee.js → ArrowUp-PM43ttWN.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-mn5NX7GY.js → ArrowUpRight-C0hTvHTE.js} +1 -1
  6. package/dist/client/assets/{Check-CD_HPCBx.js → Check-BdzjeMXF.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DWNHNG1o.js → CheckCircle-D-nlOrXB.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-CqUdGKVV.js → ChevronDown-BOc1-i9L.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-u3FbNTk0.js → ChevronRight-wqbYwiLF.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-D4LgNM8v.js → ChevronUp-IHCmvX3E.js} +1 -1
  11. package/dist/client/assets/{Copy01-QfC5SPfG.js → Copy01-DIJvVGQk.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-B4UfVd1J.js → CreditCard01-W4m_wy49.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-CeulxxKP.js → DotsVertical-Bohq38Q1.js} +1 -1
  14. package/dist/client/assets/{Eye-CPdXbQfF.js → Eye-C5vDWwaK.js} +1 -1
  15. package/dist/client/assets/{FilterLines-JiVU2yUs.js → FilterLines-C9pmu5SZ.js} +1 -1
  16. package/dist/client/assets/{Globe01-VLGVtuYJ.js → Globe01-DEX4B2yM.js} +1 -1
  17. package/dist/client/assets/{Globe04-BGVYDsJI.js → Globe04-CDJqKwdP.js} +1 -1
  18. package/dist/client/assets/{HardDrive-Ce2LdkoE.js → HardDrive-BicURFt0.js} +1 -1
  19. package/dist/client/assets/{Key01-yuFR7Zc2.js → Key01-CRQOB5O_.js} +1 -1
  20. package/dist/client/assets/{LayoutLeft-BigoYDzL.js → LayoutLeft-DZwVeKk1.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-Cz0Bxuuf.js → LinkExternal01-Do6tmctI.js} +1 -1
  22. package/dist/client/assets/{LockUnlocked01-BaYgaRTA.js → LockUnlocked01-BxK9l3CJ.js} +1 -1
  23. package/dist/client/assets/{LogOut01-CN6HVmSR.js → LogOut01-DhAdDNkV.js} +1 -1
  24. package/dist/client/assets/{Monitor01-C7CsXHL_.js → Monitor01-BKGGKBRj.js} +1 -1
  25. package/dist/client/assets/{Palette-BhjyvHxF.js → Palette-5WrpEUaC.js} +1 -1
  26. package/dist/client/assets/{Play-D8wAMR_7.js → Play-Yhg2bDxR.js} +1 -1
  27. package/dist/client/assets/{Plus-DvXL96zC.js → Plus-CgXuzVCT.js} +1 -1
  28. package/dist/client/assets/{SearchLg-OwN_oMpa.js → SearchLg-CYNvKytJ.js} +1 -1
  29. package/dist/client/assets/{SearchMd-XIPKYh6y.js → SearchMd-BOeEZKFu.js} +1 -1
  30. package/dist/client/assets/{Settings02-BTJDJLGv.js → Settings02-CpRid7rG.js} +1 -1
  31. package/dist/client/assets/{Share07-l6D4YvFM.js → Share07-B14EYmF_.js} +1 -1
  32. package/dist/client/assets/{Shield01-CfC9wtIX.js → Shield01-DS1CkOm5.js} +1 -1
  33. package/dist/client/assets/{Stars01-BeGbcSYe.js → Stars01-CPDNiFNQ.js} +1 -1
  34. package/dist/client/assets/{Stars02-OtrszfTu.js → Stars02-CH68Qhm_.js} +1 -1
  35. package/dist/client/assets/{Sun-CGGFYl4P.js → Sun-CjcZKPaq.js} +1 -1
  36. package/dist/client/assets/{SwitchHorizontal01-D9uXcUt0.js → SwitchHorizontal01-DOmwqeXB.js} +1 -1
  37. package/dist/client/assets/{Tool01-rJcbXB7f.js → Tool01-BLxK-7k7.js} +1 -1
  38. package/dist/client/assets/{Tool02-DhXkNCSS.js → Tool02-B8GwG_SX.js} +1 -1
  39. package/dist/client/assets/{Trash01-DLe-Zl7x.js → Trash01-COMthlp3.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-D_MPLCXf.js → TrendUp01-Pa_0KlRB.js} +1 -1
  41. package/dist/client/assets/{Upload01-CX8SkOAO.js → Upload01-DO7DRGUd.js} +1 -1
  42. package/dist/client/assets/{User01-1eQ7Ja6s.js → User01-C2rVZTl-.js} +1 -1
  43. package/dist/client/assets/{Users01-CA099C5J.js → Users01-ClsBMo4K.js} +1 -1
  44. package/dist/client/assets/{Users03-CIJbFhn1.js → Users03-DP3zwt6-.js} +1 -1
  45. package/dist/client/assets/{X-CV1bddgh.js → X-Bfx6rO6W.js} +1 -1
  46. package/dist/client/assets/{XCircle-DSAtX3aT.js → XCircle-jlAhwcDu.js} +1 -1
  47. package/dist/client/assets/{XClose-aVM2kaUD.js → XClose-DdXn46Em.js} +1 -1
  48. package/dist/client/assets/{YAxis-CpSUslVR.js → YAxis-C5lX8CaJ.js} +1 -1
  49. package/dist/client/assets/{Zap-DnHPswRb.js → Zap-li0rR-RI.js} +1 -1
  50. package/dist/client/assets/{ZapSquare-CmJDj8eM.js → ZapSquare-Gxca0Ylc.js} +1 -1
  51. package/dist/client/assets/{access-gate-0CQ_-rSt.js → access-gate-C8o_OE1N.js} +1 -1
  52. package/dist/client/assets/{agent-icon-O_gAUFbq.js → agent-icon-BnyLUh_P.js} +1 -1
  53. package/dist/client/assets/{agents-list-D04VGFSX.js → agents-list-WqvM4PBU.js} +1 -1
  54. package/dist/client/assets/{ai-providers-D1qlVJAE.js → ai-providers-Cm0Rm1KR.js} +1 -1
  55. package/dist/client/assets/{alert-Baosuo2d.js → alert-1MxwzRCP.js} +1 -1
  56. package/dist/client/assets/{alert-dialog-CS8t3mLK.js → alert-dialog-Cqq7FgQj.js} +1 -1
  57. package/dist/client/assets/{api-keys-8YeG9qPu.js → api-keys-BmVwKDo4.js} +1 -1
  58. package/dist/client/assets/{app-editor-CJ3D0S7b.js → app-editor-BDtjnvii.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-BgXmghcT.js → auth-catchall-CYO83hyU.js} +1 -1
  60. package/dist/client/assets/{auth-entry-DMCIMEpW.js → auth-entry-Dc1zlPtG.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-9rY5YwVp.js → auth-split-layout-C945ZTK3.js} +1 -1
  62. package/dist/client/assets/{auth-GiWlD6ej.js → auth-tEJ4bybR.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-DKrSMT6F.js → authenticate-and-persist-oauth-CqRX86RU.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-CQnK3Hce.js → automation-list-row-BN46j3bE.js} +1 -1
  65. package/dist/client/assets/{automation-runs-CrV2n6sE.js → automation-runs-nfuxnSim.js} +1 -1
  66. package/dist/client/assets/{automations-DcYB5pCy.js → automations-C9iJneF6.js} +1 -1
  67. package/dist/client/assets/{avatar-DvlGRcIA.js → avatar-BqAz0FLa.js} +1 -1
  68. package/dist/client/assets/{badge-Djdk_fXr.js → badge-D24p8Xxi.js} +1 -1
  69. package/dist/client/assets/{billing-B4pI3b7y.js → billing-DSz5ucLf.js} +1 -1
  70. package/dist/client/assets/{block-document-CcqsEOMC.js → block-document-ChYHEJUH.js} +1 -1
  71. package/dist/client/assets/{buckets-Du8vOw3a.js → buckets-DyBjeMFW.js} +1 -1
  72. package/dist/client/assets/{bulk-category-panel-BnZwkt5v.js → bulk-category-panel-tfM9zSbQ.js} +1 -1
  73. package/dist/client/assets/{capability-load-error-DgqscBaB.js → capability-load-error-CPQoG_lp.js} +1 -1
  74. package/dist/client/assets/{card-B5a9HF1k.js → card-CooN3E-v.js} +1 -1
  75. package/dist/client/assets/{cards-3QK30qKk.js → cards-CxCBBMfu.js} +1 -1
  76. package/dist/client/assets/{category-editor-n-svt53a.js → category-editor-CIZoMWm2.js} +1 -1
  77. package/dist/client/assets/{chart-CVKy-bBV.js → chart-Dtka3CXu.js} +1 -1
  78. package/dist/client/assets/{chat-context-CfAnE33C.js → chat-context--S2eGI2t.js} +1 -1
  79. package/dist/client/assets/{checkbox-Dk_MvqqG.js → checkbox-BqtDvsR1.js} +1 -1
  80. package/dist/client/assets/{cli-auth-success-BVPp-I7z.js → cli-auth-success-B6EGxQbP.js} +1 -1
  81. package/dist/client/assets/{collection-detail-JzFkXjG1.js → collection-detail-DGbcByEY.js} +1 -1
  82. package/dist/client/assets/{collection-display-button-GImVGhAk.js → collection-display-button-B1OCDGvC.js} +1 -1
  83. package/dist/client/assets/{collection-search-B89_Ilpm.js → collection-search-H6c7ia6t.js} +1 -1
  84. package/dist/client/assets/{collection-table-wrapper-CziwynR_.js → collection-table-wrapper-CksgkvG8.js} +1 -1
  85. package/dist/client/assets/{collection-tabs-KJeG58Dm.js → collection-tabs-BqnoVI6Y.js} +1 -1
  86. package/dist/client/assets/{command-DNj_l-zL.js → command-DhvOaMnH.js} +1 -1
  87. package/dist/client/assets/{commerce-onboarding-Cs_HB82_.js → commerce-onboarding-DO7FMttC.js} +1 -1
  88. package/dist/client/assets/{connect-8_ti4LJ-.js → connect-C-NmOGr7.js} +1 -1
  89. package/dist/client/assets/{connection-Dob8vzcr.js → connection-DJ2785KU.js} +1 -1
  90. package/dist/client/assets/{connection-card-DMWz8JTR.js → connection-card-DSX5zHxO.js} +1 -1
  91. package/dist/client/assets/{connection-detail-BXM6I5Hp.js → connection-detail-m014gzNI.js} +1 -1
  92. package/dist/client/assets/{connection-form-helpers-B8YhVpNn.js → connection-form-helpers-B07wLptq.js} +1 -1
  93. package/dist/client/assets/{connections-BvJMaJTd.js → connections-BNQ0Y0h7.js} +1 -1
  94. package/dist/client/assets/{decopilot-sse-pool--JEFoD5H.js → decopilot-sse-pool-U92pbu07.js} +1 -1
  95. package/dist/client/assets/{dialog-Ca2-C8U3.js → dialog-C2XtKj4W.js} +1 -1
  96. package/dist/client/assets/{domain-settings-8JwWQ6pk.js → domain-settings-D2fweBMx.js} +1 -1
  97. package/dist/client/assets/{drawer-CW-oGe3y.js → drawer-HtUPoolZ.js} +1 -1
  98. package/dist/client/assets/{dropdown-menu-Dv8O0xCG.js → dropdown-menu-Buaqq-Fn.js} +1 -1
  99. package/dist/client/assets/{empty-state-BcJ5KI2y.js → empty-state-Bd3g-2FH.js} +1 -1
  100. package/dist/client/assets/{extract-connection-data-Dsp4GBJ7.js → extract-connection-data-V948FMyj.js} +1 -1
  101. package/dist/client/assets/{file-explorer-BDWbiZK4.js → file-explorer-DKHfXuC4.js} +1 -1
  102. package/dist/client/assets/{file-type-icon-Ci56emXR.js → file-type-icon-BSAnhEu5.js} +1 -1
  103. package/dist/client/assets/{form-LXYAzhMu.js → form-CMuk1nXb.js} +1 -1
  104. package/dist/client/assets/{general-DEn3xeVW.js → general-BTyXC0VC.js} +1 -1
  105. package/dist/client/assets/{github-repo-picker-DSJNpsUL.js → github-repo-picker-DjVb6-0i.js} +1 -1
  106. package/dist/client/assets/{hooks-B1ZV9GPM.js → hooks-Cd2G3711.js} +1 -1
  107. package/dist/client/assets/{index-ByaZ25Ec.js → index-BKOwC_zz.js} +1 -1
  108. package/dist/client/assets/{index-kP7WqPoy.js → index-BRjr3L_N.js} +1 -1
  109. package/dist/client/assets/{index-To_8qHlt.js → index-BaWtU9eb.js} +5 -5
  110. package/dist/client/assets/{index-Vwm_Vm5z.js → index-BflbKT0u.js} +1 -1
  111. package/dist/client/assets/{index-BuNxapmj.js → index-BoSySxnu.js} +1 -1
  112. package/dist/client/assets/{index-jBhflmZo.js → index-BphIXXOp.js} +3 -3
  113. package/dist/client/assets/{index-8R8TLs1O.js → index-CPCOiQxX.js} +1 -1
  114. package/dist/client/assets/{index-CBlfXh8I.js → index-DNa-ZV66.js} +1 -1
  115. package/dist/client/assets/{index-BIStG2CN.js → index-Di0wCO9r.js} +1 -1
  116. package/dist/client/assets/{index-1vO0in-B.js → index-Dwrgaiv3.js} +1 -1
  117. package/dist/client/assets/{index-redirect-B7YUGcH_.js → index-redirect-CyqcxiJb.js} +1 -1
  118. package/dist/client/assets/{infra-billing-CkBBAm4g.js → infra-billing-B1fwJNOz.js} +1 -1
  119. package/dist/client/assets/{input-EKtBqITd.js → input-9TNY2G6W.js} +1 -1
  120. package/dist/client/assets/{integration-icon-CUTUBC8g.js → integration-icon-CGwCrGIc.js} +1 -1
  121. package/dist/client/assets/{invite-member-dialog-DLiSoPdC.js → invite-member-dialog-BIJfPXUf.js} +1 -1
  122. package/dist/client/assets/{label-D6_MljWD.js → label-DhJo3WjY.js} +1 -1
  123. package/dist/client/assets/{layout-ChZgrKlo.js → layout-CeWP0gEY.js} +1 -1
  124. package/dist/client/assets/{login-DQ6lj7zz.js → login-DxZTpOpk.js} +1 -1
  125. package/dist/client/assets/{mcp-oauth-CuPijHd6.js → mcp-oauth--A5K-xL8.js} +1 -1
  126. package/dist/client/assets/{members-DpDthhUp.js → members-B5PzIuUU.js} +1 -1
  127. package/dist/client/assets/{monaco-editor-eY_YmGMa.js → monaco-editor-BMLOnDLJ.js} +1 -1
  128. package/dist/client/assets/{monitoring-stats-row-Br-uRPhJ.js → monitoring-stats-row-Rpla78Nn.js} +1 -1
  129. package/dist/client/assets/{multi-select-CLnHZWej.js → multi-select-Duz2hJ29.js} +1 -1
  130. package/dist/client/assets/{oauth-callback-eW1vOHUF.js → oauth-callback-Cn0wl-wL.js} +1 -1
  131. package/dist/client/assets/{oauth-callback-ai-provider-DUQ79Qp-.js → oauth-callback-ai-provider-CvoqVCiX.js} +1 -1
  132. package/dist/client/assets/{onboarding-FvVf5VNP.js → onboarding-CTQgNbX8.js} +1 -1
  133. package/dist/client/assets/{org-layout-BHw-HGNe.js → org-layout-tUX-e_rZ.js} +1 -1
  134. package/dist/client/assets/{organization-choice-DL7WGXge.js → organization-choice-T8a5zIBy.js} +1 -1
  135. package/dist/client/assets/{orgs-aArzsuqi.js → orgs-CGkwFzZ6.js} +1 -1
  136. package/dist/client/assets/{page-seo-form-DlbxySRL.js → page-seo-form-C0yVvfZn.js} +1 -1
  137. package/dist/client/assets/{popover-DYgD9Op7.js → popover-BV2Ziop4.js} +1 -1
  138. package/dist/client/assets/{post-editor-BJrA-he1.js → post-editor-DnamQd0I.js} +1 -1
  139. package/dist/client/assets/{primitives-DW7hwcHm.js → primitives-QfIbZaez.js} +1 -1
  140. package/dist/client/assets/{profile-D255gjf9.js → profile-Bp26cqE6.js} +1 -1
  141. package/dist/client/assets/{project-app-view-C_PmZI6K.js → project-app-view-C-J9cu-l.js} +1 -1
  142. package/dist/client/assets/record-editor-CoztL6I2.js +1 -0
  143. package/dist/client/assets/{redirect-editor-C1e39ozw.js → redirect-editor-Bz1AUCqF.js} +1 -1
  144. package/dist/client/assets/registry-DQjw_3WH.js +2 -0
  145. package/dist/client/assets/{registry-layout-B9PoUc2e.js → registry-layout-DdRmZw6K.js} +1 -1
  146. package/dist/client/assets/{reports-C5YAIfse.js → reports-DMvf7MMo.js} +1 -1
  147. package/dist/client/assets/{require-capability-r7nkorK3.js → require-capability-ChdE_Nc5.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-CwIN94qu.js → required-auth-layout-DYO8_0ig.js} +1 -1
  149. package/dist/client/assets/{reset-password-CEsr9TBA.js → reset-password-C661myht.js} +1 -1
  150. package/dist/client/assets/{roles-DHLrTZ8g.js → roles-CYg93TjU.js} +1 -1
  151. package/dist/client/assets/{search-input-BXvPUwiA.js → search-input-ChJAF9CO.js} +1 -1
  152. package/dist/client/assets/{secrets-CXeD0t2l.js → secrets-CwgPWaoJ.js} +1 -1
  153. package/dist/client/assets/{sections-editor-uQ8V2tnO.js → sections-editor-D8xoci4G.js} +1 -1
  154. package/dist/client/assets/{select-DwC_Ob1f.js → select-COjQ5V-V.js} +1 -1
  155. package/dist/client/assets/{select-model-BI9hw9Dj.js → select-model-B5IdH_n6.js} +1 -1
  156. package/dist/client/assets/{self-tool-result-C96emTDf.js → self-tool-result-DA97K7F2.js} +1 -1
  157. package/dist/client/assets/{seo-editor-C2SV82Pa.js → seo-editor-Do7jjKRP.js} +1 -1
  158. package/dist/client/assets/{settings-layout-C7vOlX8G.js → settings-layout-C23Ga1Si.js} +1 -1
  159. package/dist/client/assets/{settings-section-B8tMg134.js → settings-section-BN0IrtYX.js} +1 -1
  160. package/dist/client/assets/{settings-subnav-C7rkeJ2X.js → settings-subnav-DlbWpD1A.js} +1 -1
  161. package/dist/client/assets/{shell-controls-D7vSoxeV.js → shell-controls-BBRNaPXa.js} +1 -1
  162. package/dist/client/assets/{shell-layout-Co4yfdeD.js → shell-layout-DIvwZhUJ.js} +1 -1
  163. package/dist/client/assets/{sidebar-CaMsnz1Y.js → sidebar-Dckv7Gxe.js} +1 -1
  164. package/dist/client/assets/{skeleton-BHGsxFDX.js → skeleton-C_J-aMdg.js} +1 -1
  165. package/dist/client/assets/{spinner-BIAdEQR_.js → spinner-Cbrhyipt.js} +1 -1
  166. package/dist/client/assets/{sso-CJT8bMyl.js → sso-DC7cMRPW.js} +1 -1
  167. package/dist/client/assets/{store-BjojdcBK.js → store-rWTYBa0y.js} +1 -1
  168. package/dist/client/assets/store-registry-Dz8WBmEa.js +2 -0
  169. package/dist/client/assets/{studio-tools-ieYMpp9b.js → studio-tools-BoD8kcA1.js} +1 -1
  170. package/dist/client/assets/{switch-Df7gOAWw.js → switch-b-8BZDWJ.js} +1 -1
  171. package/dist/client/assets/{synced-repos-BQ2NcjTk.js → synced-repos-Cuzl6scP.js} +1 -1
  172. package/dist/client/assets/{tab-id-mDSQQVYy.js → tab-id-BJUTVZdl.js} +1 -1
  173. package/dist/client/assets/{table-BRQqTEsA.js → table-CfpVPCrj.js} +1 -1
  174. package/dist/client/assets/{tabs-NlgtfD0v.js → tabs-D-7lRbur.js} +1 -1
  175. package/dist/client/assets/{tasks-Dmdn5jhB.js → tasks-EwwXPqCM.js} +1 -1
  176. package/dist/client/assets/{textarea-tVpvSCPs.js → textarea-CosQp1Ex.js} +1 -1
  177. package/dist/client/assets/{toggle-group-Dl6IAWtt.js → toggle-group-5LW11eFN.js} +1 -1
  178. package/dist/client/assets/{toolbar-BTKfNDxc.js → toolbar-Q0b8veSU.js} +1 -1
  179. package/dist/client/assets/{tooltip-08i1UCLL.js → tooltip-BfkRKScU.js} +1 -1
  180. package/dist/client/assets/{track-D3zz2QfU.js → track-CG8KgfQd.js} +1 -1
  181. package/dist/client/assets/{types-ClE5-0N3.js → types-BGHf5GHQ.js} +1 -1
  182. package/dist/client/assets/{use-ai-providers-BQKXaXli.js → use-ai-providers-BezO2qdd.js} +1 -1
  183. package/dist/client/assets/{use-api-keys-DO8DQGww.js → use-api-keys-BELfjQ6X.js} +1 -1
  184. package/dist/client/assets/{use-automations-Sn_wKjKW.js → use-automations-BB8THpxC.js} +1 -1
  185. package/dist/client/assets/{use-autosave-Dcf9TMr1.js → use-autosave-C7alUjY0.js} +1 -1
  186. package/dist/client/assets/{use-capability-D4lFxacj.js → use-capability-mz-0XBoJ.js} +1 -1
  187. package/dist/client/assets/{use-clock-tick-BmUfeM7U.js → use-clock-tick-BlWbr6nY.js} +1 -1
  188. package/dist/client/assets/{use-commerce-diagnostic-ClLCbGjZ.js → use-commerce-diagnostic-B54oYyoh.js} +1 -1
  189. package/dist/client/assets/{use-connection-DarS6cg8.js → use-connection-B5TzA1Ut.js} +1 -1
  190. package/dist/client/assets/{use-copy-D8CTx6bH.js → use-copy-BEi_L0rW.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-D2KkbpYv.js → use-create-virtual-mcp-BfQJXcoA.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-Bl62Nb86.js → use-debounced-autosave-BHPvlnZn.js} +1 -1
  193. package/dist/client/assets/{use-debounced-value-DTgRCuCq.js → use-debounced-value-D880nDlC.js} +1 -1
  194. package/dist/client/assets/{use-decopilot-events-Bunh3TgF.js → use-decopilot-events-D7YXko6B.js} +1 -1
  195. package/dist/client/assets/{use-delete-connection-B46xtxPM.js → use-delete-connection-urOdWe-_.js} +1 -1
  196. package/dist/client/assets/{use-deployment-admin-Dn0qW7Mm.js → use-deployment-admin-D_5KLYHI.js} +1 -1
  197. package/dist/client/assets/{use-file-configs-Bl7OTelP.js → use-file-configs-C4oqeXep.js} +1 -1
  198. package/dist/client/assets/{use-infinite-scroll-CjLm4F3w.js → use-infinite-scroll-A-tTatQb.js} +1 -1
  199. package/dist/client/assets/{use-join-requests-FnMyW5FQ.js → use-join-requests-Cvq2Nlxy.js} +1 -1
  200. package/dist/client/assets/{use-mcp-client-R2QQiv_i.js → use-mcp-client-DKcZ7v-W.js} +1 -1
  201. package/dist/client/assets/{use-mcp-tools-DcjimSLO.js → use-mcp-tools-B4aUfPof.js} +1 -1
  202. package/dist/client/assets/{use-members-Tx3Mm-bY.js → use-members-Dypq7HzL.js} +1 -1
  203. package/dist/client/assets/{use-mobile-BPF2X-J-.js → use-mobile-C0XoguQx.js} +1 -1
  204. package/dist/client/assets/{use-navigate-to-agent-C5c_zhXd.js → use-navigate-to-agent-Cxg9_mL_.js} +1 -1
  205. package/dist/client/assets/{use-open-billing-url-CXOWP_AB.js → use-open-billing-url-BwHZpmU9.js} +1 -1
  206. package/dist/client/assets/{use-org-auth-client-BrPrPcLI.js → use-org-auth-client-CEm0cNyU.js} +1 -1
  207. package/dist/client/assets/{use-org-repo-syncs-BzS2wt-x.js → use-org-repo-syncs-DCxfKVxi.js} +1 -1
  208. package/dist/client/assets/{use-org-sso-mEcMK8jw.js → use-org-sso-8p_mXDai.js} +1 -1
  209. package/dist/client/assets/{use-organization-roles-cZdKhiLF.js → use-organization-roles-EKX73RmE.js} +1 -1
  210. package/dist/client/assets/{use-organization-settings-fFMxOp9z.js → use-organization-settings-C62jhu_V.js} +1 -1
  211. package/dist/client/assets/{use-registry-connections-B2N5y00y.js → use-registry-connections-C82adOhA.js} +1 -1
  212. package/dist/client/assets/{use-secrets-D8f2xr4z.js → use-secrets-CXv4Or8y.js} +1 -1
  213. package/dist/client/assets/{use-section-preview-base-B9EmYA7V.js → use-section-preview-base-uursozx3.js} +1 -1
  214. package/dist/client/assets/{use-settings-tabs-B5Y93-mI.js → use-settings-tabs-BO1uyGPC.js} +1 -1
  215. package/dist/client/assets/{use-status-sounds-Dh4yB59Z.js → use-status-sounds-Df1zE4-g.js} +1 -1
  216. package/dist/client/assets/{use-tags-7yQjJFsy.js → use-tags-DBhn0x6Q.js} +1 -1
  217. package/dist/client/assets/{use-view-mode-BzZolHtd.js → use-view-mode-B8mZlQkB.js} +1 -1
  218. package/dist/client/assets/{use-virtual-mcp-CiOr7IuV.js → use-virtual-mcp-IokMTZJW.js} +1 -1
  219. package/dist/client/assets/useInfiniteQuery-ewuCizNF.js +1 -0
  220. package/dist/client/assets/{useRouterState-DpzZuAKw.js → useRouterState-BHrQRzTY.js} +1 -1
  221. package/dist/client/assets/useSuspenseInfiniteQuery-BvX-6eAF.js +1 -0
  222. package/dist/client/assets/{users-B4PYOEn4.js → users-B6MzMck4.js} +1 -1
  223. package/dist/client/assets/{variant-calendar-DYOlV0fw.js → variant-calendar-DrArrrSO.js} +1 -1
  224. package/dist/client/assets/{view-mode-toggle-CvO7l4e4.js → view-mode-toggle-waWn0PEd.js} +1 -1
  225. package/dist/client/index.html +1 -1
  226. package/dist/server/cli.js +205 -205
  227. package/dist/server/server.js +200 -200
  228. package/package.json +1 -1
  229. package/dist/client/assets/record-editor-kRNwNVeT.js +0 -1
  230. package/dist/client/assets/registry-CjJboSxg.js +0 -2
  231. package/dist/client/assets/store-registry-abfXH45e.js +0 -2
  232. package/dist/client/assets/useInfiniteQuery-BYDKA49C.js +0 -1
  233. package/dist/client/assets/useSuspenseInfiniteQuery-C4xORmC5.js +0 -1
@@ -1 +1 @@
1
- import{c as $,b as G,j as t,y as xn,B as ye,r as V,aS as vn,d as rt,s as bn,m as Q,a as Te,t as X,w as jn,k as Ve,p as K,F as le,f as at,u as lt,L as yn,D as Cn,$ as _n,a0 as wn,I as Ct,G as Nn,K as Ue,o as Sn,n as He,aQ as kn,av as In}from"./index-jBhflmZo.js";import{i as Vt}from"./ChevronRight-u3FbNTk0.js";import{i as Dn}from"./X-CV1bddgh.js";import{aK as An,T as Tn,A as qe,f as Mn,s as gt,aC as Pn,aL as On,aM as Fn}from"./agent-icon-O_gAUFbq.js";import{t as _t}from"./ChevronDown-CqUdGKVV.js";import{T as Me,a as Pe,c as Oe}from"./tooltip-08i1UCLL.js";import{u as Ut,d as qt,c as Kt}from"./sidebar-CaMsnz1Y.js";import{a as ct,i as $n,f as zn,S as Wt,u as Ln,W as Bn,m as Pt,C as Qt,g as En}from"./use-mcp-client-R2QQiv_i.js";import{u as Rn,a as wt}from"./use-virtual-mcp-CiOr7IuV.js";import{a as Xe,b as Nt,P as St}from"./popover-DYgD9Op7.js";import{i as st}from"./Check-CD_HPCBx.js";import{s as Ke}from"./Plus-DvXL96zC.js";import{i as Xt}from"./SearchMd-XIPKYh6y.js";import{s as Yt}from"./XClose-aVM2kaUD.js";import{C as Gn,d as Ot}from"./self-tool-result-C96emTDf.js";import{T as kt}from"./toolbar-BTKfNDxc.js";import{S as Hn}from"./skeleton-BHGsxFDX.js";import{D as Jt,a as Zt,b as en,c as Vn,g as Un,e as qn,f as Kn}from"./drawer-CW-oGe3y.js";import{u as tn}from"./use-mobile-BPF2X-J-.js";import{a as Wn,G as Qn}from"./github-repo-picker-DSJNpsUL.js";import{g as Xn,a as nn,u as dt,c as Yn}from"./hooks-B1ZV9GPM.js";import{u as Jn,g as Zn,a as es,b as ts}from"./use-navigate-to-agent-C5c_zhXd.js";import{b as ns,a as sn,g as ss}from"./agent-capabilities-C4tLW0Za.js";import{u as ut,f as os}from"./shell-layout-Co4yfdeD.js";import{f as is}from"./reusable-new-chat-CouMjkYR.js";import{C as rs}from"./collection-search-B89_Ilpm.js";import{g as as,a as ls,b as cs,e as ds}from"./extract-connection-data-Dsp4GBJ7.js";import{u as on,a as rn,g as us,C as ht}from"./connection-card-DMWz8JTR.js";import{e as It,d as Dt,a as At,b as Tt,h as an,c as fs}from"./dialog-Ca2-C8U3.js";import{d as pe,a as xe,e as ve,b as be,c as je,F as Ft}from"./form-LXYAzhMu.js";import{I as Le}from"./input-EKtBqITd.js";import{S as ms,a as gs,b as hs,c as ps,d as Qe}from"./select-DwC_Ob1f.js";import{T as xs}from"./textarea-tVpvSCPs.js";import{b as ln}from"./use-connection-DarS6cg8.js";import{n as tt,i as pt}from"./Tool02-DhXkNCSS.js";import{c as vs,i as Je,a as $t,E as bs,p as js,b as ys,d as Cs}from"./connection-form-helpers-B8YhVpNn.js";import{a as xt}from"./authenticate-and-persist-oauth-DKrSMT6F.js";import{g as _s}from"./connection-slug-eyAPH6o3.js";import{C as ws}from"./collection-tabs-KJeG58Dm.js";import{u as zt}from"./use-infinite-scroll-CjLm4F3w.js";import{B as Ze}from"./badge-Djdk_fXr.js";import{u as Ns}from"./useSuspenseInfiniteQuery-C4xORmC5.js";import{g as ot}from"./metadata-dUsYcpuu.js";import{u as ft}from"./studio-tools-ieYMpp9b.js";import{u as Ss}from"./use-ai-providers-BQKXaXli.js";import{i as ks}from"./FilterLines-JiVU2yUs.js";import{a as Is,T as Ds}from"./toggle-group-Dl6IAWtt.js";import{d as As,a as Ts,c as Ms,b as Ps,C as Os,e as Fs}from"./command-DNj_l-zL.js";import{i as cn}from"./Zap-DnHPswRb.js";import{c as $s,d as zs,b as Ls,f as Bs,g as Es,e as Rs,a as Gs,A as Hs}from"./alert-dialog-CS8t3mLK.js";import{n as Vs}from"./Stars02-OtrszfTu.js";import{g as Us,u as qs,S as Ks}from"./use-clock-tick-BmUfeM7U.js";import{a as Ws}from"./format-time-BnbuEtat.js";import{f as Qs}from"./tab-id-mDSQQVYy.js";const Xs="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Ys(){const n=$.c(13),e=G();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("img",{src:"/logos/summit/monte-carlo.svg",alt:"Monte Carlo",className:"h-14 w-[112px] shrink-0 self-start object-contain object-left brightness-0 invert"}),n[0]=s):s=n[0];let i;n[1]!==e?(i=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=i):i=n[2];let r;n[3]!==i?(r=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",i,"”"]}),n[3]=i,n[4]=r):r=n[4];let o;n[5]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("img",{src:Xs,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=o):o=n[5];let a;n[6]!==e?(a=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=a):a=n[7];let l;n[8]!==a?(l=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[o,t.jsx("span",{className:"text-base font-medium",children:a})]}),n[8]=a,n[9]=l):l=n[9];let c;return n[10]!==r||n[11]!==l?(c=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,r,l]}),n[10]=r,n[11]=l,n[12]=c):c=n[12],c}function Js(){const n=$.c(19),e=G();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let i;n[2]!==s?(i={Icon:An,label:s},n[2]=s,n[3]=i):i=n[3];let r;n[4]!==e?(r=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=r):r=n[5];let o;n[6]!==r?(o={Icon:xn,label:r},n[6]=r,n[7]=o):o=n[7];let a;n[8]!==e?(a=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=a):a=n[9];let l;n[10]!==a?(l={Icon:Tn,label:a},n[10]=a,n[11]=l):l=n[11];let c;n[12]!==i||n[13]!==o||n[14]!==l?(c=[i,o,l],n[12]=i,n[13]=o,n[14]=l,n[15]=c):c=n[15];const d=c;let f;n[16]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=f):f=n[16];let m;return n[17]!==d?(m=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[f,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:d.map(Zs)})]}),n[17]=d,n[18]=m):m=n[18],m}function Zs(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 _r(n){const e=$.c(22),{siteHost:s,footer:i,onClose:r,children:o}=n,a=G(),l=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let c;e[0]!==r||e[1]!==a?(c=r&&t.jsx("button",{type:"button",onClick:r,"aria-label":a("routes.commerceOnboarding.connectModal.close"),className:"absolute right-3 top-3 z-10 flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-black/10 hover:text-foreground lg:text-white/80 lg:hover:bg-white/15 lg:hover:text-white",children:t.jsx(Dn,{size:18})}),e[0]=r,e[1]=a,e[2]=c):c=e[2];let d,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),f=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=d,e[4]=f):(d=e[3],f=e[4]);let m;e[5]!==l||e[6]!==s?(m=s&&t.jsxs(t.Fragment,{children:[t.jsx(Vt,{size:16,className:"shrink-0 text-foreground/25"}),l&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:l,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=l,e[6]=s,e[7]=m):m=e[7];let u;e[8]!==m?(u=t.jsxs("div",{className:"flex items-center gap-2",children:[d,f,m]}),e[8]=m,e[9]=u):u=e[9];let p;e[10]!==i?(p=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:i}),e[10]=i,e[11]=p):p=e[11];let y;e[12]!==o||e[13]!==u||e[14]!==p?(y=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[u,o,p]}),e[12]=o,e[13]=u,e[14]=p,e[15]=y):y=e[15];let x,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=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]=x,e[17]=g):(x=e[16],g=e[17]);let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[x,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Ys,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Js,{})]})]}),e[18]=h):h=e[18];let v;return e[19]!==c||e[20]!==y?(v=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[c,y,h]}),e[19]=c,e[20]=y,e[21]=v):v=e[21],v}function wr(n){const e=$.c(5),{ready:s,pending:i,label:r,onClick:o,children:a}=n,l=i||!s,c=s&&!i?a:null;let d;return e[0]!==r||e[1]!==o||e[2]!==l||e[3]!==c?(d=t.jsxs(ye,{type:"button",size:"lg",className:"h-auto min-h-12 w-full whitespace-normal rounded-lg py-3 text-center text-base font-medium leading-tight",onClick:o,disabled:l,children:[r,c]}),e[0]=r,e[1]=o,e[2]=l,e[3]=c,e[4]=d):d=e[4],d}function dn(){const n=V.useContext(vn),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(r=>r.status==="pending"&&new Date(r.expiresAt)>new Date),refetch:()=>s?.()}}function eo(n){let e=0;for(let i=0;i<n.length;i++)e=n.charCodeAt(i)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function Mt(n){const e=$.c(13),{org:s,size:i}=n,r=i===void 0?"sm":i,o=r==="xs"?"size-5":"size-6",a=r==="xs"?"text-[9px]":"text-xs";let l;e[0]!==o?(l=Q(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:eo(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.logo||e[6]!==s.name||e[7]!==a?(d=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:Q("font-semibold leading-none",a),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=a,e[8]=d):d=e[8];let f;return e[9]!==l||e[10]!==c||e[11]!==d?(f=t.jsx("div",{className:l,style:c,children:d}),e[9]=l,e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function to({invitation:n,onChanged:e}){const s=G(),[i,r]=V.useState(!1),o=n.organizationName??s("header.orgSwitcher.unknownOrganization"),a=async()=>{r(!0);try{const d=await Te.organization.acceptInvitation({invitationId:n.id});if(d.error){X.error(d.error.message),r(!1);return}}catch{X.error(s("header.orgSwitcher.failedToAcceptInvitation")),r(!1);return}X.success(s("header.orgSwitcher.joined",{name:o})),jn();let c;try{c=(await Te.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},l=async()=>{r(!0);try{const c=await Te.organization.rejectInvitation({invitationId:n.id});if(c.error){X.error(c.error.message),r(!1);return}X.success(s("header.orgSwitcher.invitationDeclined")),r(!1),e()}catch{X.error(s("header.orgSwitcher.failedToDeclineInvitation")),r(!1)}};return t.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[t.jsx(Mt,{org:{name:o},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:o}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx(ye,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:a,disabled:i,children:s("header.orgSwitcher.accept")}),t.jsx(ye,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:l,disabled:i,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:o}),children:t.jsx(Yt,{size:14})})]})]})}function no(n){const e=$.c(32),{orgParam:s,onSelectOrg:i,onCreateOrg:r}=n,o=G(),{data:a}=bn(),{invitations:l,refetch:c}=dn();let d;e[0]!==s?(d=(P,D)=>P.slug===s?-1:D.slug===s?1:P.name.localeCompare(D.name),e[0]=s,e[1]=d):d=e[1];const f=[...a??[]].sort(d),[m,u]=V.useState(""),p=m.toLowerCase(),y=p?f.filter(P=>P.name.toLowerCase().includes(p)||P.slug.toLowerCase().includes(p)):f;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(Xt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=x):x=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=P=>u(P.target.value),e[3]=g):g=e[3];let h;e[4]!==m?(h=P=>P.key==="Escape"&&m&&u(""),e[4]=m,e[5]=h):h=e[5];let v;e[6]!==o?(v=o("header.orgSwitcher.searchOrganizations"),e[6]=o,e[7]=v):v=e[7];let j;e[8]!==m||e[9]!==h||e[10]!==v?(j=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:m,onChange:g,onKeyDown:h,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=m,e[9]=h,e[10]=v,e[11]=j):j=e[11];let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ke,{size:16}),e[12]=C):C=e[12];let w;e[13]!==r?(w=t.jsx("button",{type:"button",onClick:r,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:C}),e[13]=r,e[14]=w):w=e[14];let I;e[15]!==j||e[16]!==w?(I=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[x,j,w]}),e[15]=j,e[16]=w,e[17]=I):I=e[17];const M="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let b;e[18]!==l||e[19]!==m||e[20]!==c?(b=!m&&l.map(P=>t.jsx(to,{invitation:P,onChanged:c},P.id)),e[18]=l,e[19]=m,e[20]=c,e[21]=b):b=e[21];const N=y.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:m?o("header.orgSwitcher.noOrganizationsMatch",{query:m}):o("header.orgSwitcher.noOrganizationsAvailable")});let A;e[22]!==i||e[23]!==s?(A=P=>t.jsxs("button",{type:"button",onClick:()=>i(P.slug),className:Q("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",P.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(Mt,{org:P,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:P.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:P.slug})]}),P.slug===s&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},P.id),e[22]=i,e[23]=s,e[24]=A):A=e[24];const S=y.map(A);let _;e[25]!==b||e[26]!==N||e[27]!==S?(_=t.jsxs("div",{className:M,children:[b,N,S]}),e[25]=b,e[26]=N,e[27]=S,e[28]=_):_=e[28];let T;return e[29]!==_||e[30]!==I?(T=t.jsxs(t.Fragment,{children:[I,_]}),e[29]=_,e[30]=I,e[31]=T):T=e[31],T}function so(n){const e=$.c(22),{trigger:s,orgParam:i,align:r,side:o}=n,a=r===void 0?"start":r,l=o===void 0?"bottom":o,c=rt(),[d,f]=V.useState(!1),[m,u]=V.useState(!1);let p;e[0]!==s?(p=t.jsx(Xe,{asChild:!0,children:s}),e[0]=s,e[1]=p):p=e[1];const y=String(d);let x;e[2]!==c?(x=I=>{f(!1),c({to:"/$org",params:{org:I}})},e[2]=c,e[3]=x):x=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{f(!1),u(!0)},e[4]=g):g=e[4];let h;e[5]!==i||e[6]!==y||e[7]!==x?(h=t.jsx(no,{orgParam:i,onSelectOrg:x,onCreateOrg:g},y),e[5]=i,e[6]=y,e[7]=x,e[8]=h):h=e[8];let v;e[9]!==a||e[10]!==l||e[11]!==h?(v=t.jsx(Nt,{side:l,align:a,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:io,onCloseAutoFocus:oo,children:h}),e[9]=a,e[10]=l,e[11]=h,e[12]=v):v=e[12];let j;e[13]!==d||e[14]!==p||e[15]!==v?(j=t.jsxs(St,{open:d,onOpenChange:f,children:[p,v]}),e[13]=d,e[14]=p,e[15]=v,e[16]=j):j=e[16];let C;e[17]!==m?(C=t.jsx(Gn,{open:m,onOpenChange:u}),e[17]=m,e[18]=C):C=e[18];let w;return e[19]!==C||e[20]!==j?(w=t.jsxs(t.Fragment,{children:[j,C]}),e[19]=C,e[20]=j,e[21]=w):w=e[21],w}function oo(n){return n.preventDefault()}function io(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ro(n){const e=$.c(21),{value:s,onChange:i,placeholder:r,onKeyDown:o,className:a,isSearching:l,disabled:c}=n,d=r===void 0?"Search...":r;let f;e[0]!==a?(f=Q("shrink-0 w-full border-b border-border h-12",a),e[0]=a,e[1]=f):f=e[1];const m=c?"cursor-not-allowed opacity-50":"cursor-text";let u;e[2]!==m?(u=Q("flex items-center gap-2.5 h-12 px-4",m),e[2]=m,e[3]=u):u=e[3];let p;e[4]!==l?(p=l?t.jsx(Ve,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Xt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=l,e[5]=p):p=e[5];let y;e[6]!==i?(y=v=>i(v.target.value),e[6]=i,e[7]=y):y=e[7];let x;e[8]!==c||e[9]!==o||e[10]!==d||e[11]!==y||e[12]!==s?(x=t.jsx("input",{type:"text",value:s,onChange:y,onKeyDown:o,placeholder:d,disabled:c,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=c,e[9]=o,e[10]=d,e[11]=y,e[12]=s,e[13]=x):x=e[13];let g;e[14]!==u||e[15]!==p||e[16]!==x?(g=t.jsxs("label",{className:u,children:[p,x]}),e[14]=u,e[15]=p,e[16]=x,e[17]=g):g=e[17];let h;return e[18]!==f||e[19]!==g?(h=t.jsx("div",{className:f,children:g}),e[18]=f,e[19]=g,e[20]=h):h=e[20],h}function ao(n,e,s){if(!s)return null;const i=Xn(n,e);return i?i.threads.get().find(o=>o.id===s)?.branch??null:null}function lo(n){const e=$.c(6),{value:s,onChange:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.searchAgents"),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==i||e[3]!==o||e[4]!==s?(a=t.jsx(ro,{value:s,onChange:i,placeholder:o}),e[2]=i,e[3]=o,e[4]=s,e[5]=a):a=e[5],a}function co(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=i):i=n[3],i}function uo(n){const e=$.c(10),{org:s,onClose:i}=n,r=G();let o;e[0]!==s.slug?(o={org:s.slug},e[0]=s.slug,e[1]=o):o=e[1];let a;e[2]!==i?(a=()=>i(),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r("sidebar.agentsSection.seeAllAgents"),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==a||e[8]!==l?(c=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(yn,{to:"/$org/settings/agents",params:o,onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:l})}),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}function fo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(un,{children:s}),n[2]=s,n[3]=i):i=n[3],i}function mo(n){const e=$.c(11),{onImportFromGithub:s}=n,i=G();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qn,{className:"size-3.5"}),e[0]=r):r=e[0];let o;e[1]!==i?(o=i("sidebar.agentsSection.import"),e[1]=i,e[2]=o):o=e[2];let a;e[3]!==s||e[4]!==o?(a=t.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[r,o]}),e[3]=s,e[4]=o,e[5]=a):a=e[5];let l;e[6]!==i?(l=i("sidebar.agentsSection.codeAgents"),e[6]=i,e[7]=l):l=e[7];let c;return e[8]!==a||e[9]!==l?(c=t.jsx(un,{action:a,children:l}),e[8]=a,e[9]=l,e[10]=c):c=e[10],c}function go(n){const e=$.c(11),{setOpen:s,emptyCtaClass:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.browseAgents"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i?(a=Q(i),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==s?(l=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=l):l=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{className:"size-4"}),e[6]=c):c=e[6];let d;return e[7]!==o||e[8]!==a||e[9]!==l?(d=t.jsx(kt,{"aria-label":o,className:a,onClick:l,children:c}),e[7]=o,e[8]=a,e[9]=l,e[10]=d):d=e[10],d}function ho(n){const e=$.c(17),{setOpen:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=Q(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]!==s?(c=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ke,{}),e[7]=d):d=e[7];let f;e[8]!==o?(f=o("sidebar.agentsSection.newAgent"),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=t.jsx("span",{children:f}),e[10]=f,e[11]=m):m=e[11];let u;return e[12]!==a||e[13]!==l||e[14]!==c||e[15]!==m?(u=t.jsx(qt,{children:t.jsxs(Kt,{tooltip:a,className:l,onClick:c,children:[d,m]})}),e[12]=a,e[13]=l,e[14]=c,e[15]=m,e[16]=u):u=e[16],u}function po(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(en,{className:"sr-only",children:s}),n[2]=s,n[3]=i):i=n[3],i}function xo(n){const e=$.c(8),{emptyCtaClass:s}=n,i=G();let r;e[0]!==i?(r=i("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=r):r=e[1];let o;e[2]!==s?(o=Q(s),e[2]=s,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Ke,{className:"size-4"}),e[4]=a):a=e[4];let l;return e[5]!==r||e[6]!==o?(l=t.jsx(kt,{"aria-label":r,className:o,children:a}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function vo(n){const e=$.c(19),{wrapEmptyHint:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=Q(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{}),e[5]=c):c=e[5];let d;e[6]!==o?(d=o("sidebar.agentsSection.newAgent"),e[6]=o,e[7]=d):d=e[7];let f;e[8]!==d?(f=t.jsx("span",{children:d}),e[8]=d,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==l||e[12]!==f?(m=t.jsx(Xe,{asChild:!0,children:t.jsxs(Kt,{tooltip:a,className:l,children:[c,f]})}),e[10]=a,e[11]=l,e[12]=f,e[13]=m):m=e[13];let u;e[14]!==m||e[15]!==s?(u=s(m),e[14]=m,e[15]=s,e[16]=u):u=e[16];let p;return e[17]!==u?(p=t.jsx(qt,{children:u}),e[17]=u,e[18]=p):p=e[18],p}function bo(n){const e=$.c(9),{children:s}=n,i=G();let r;e[0]!==s?(r=t.jsx(Me,{asChild:!0,children:s}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==i?(o=i("sidebar.agentsSection.selectAnExistingAgent"),e[2]=i,e[3]=o):o=e[3];let a;e[4]!==o?(a=t.jsx(Pe,{side:"right",sideOffset:8,children:o}),e[4]=o,e[5]=a):a=e[5];let l;return e[6]!==r||e[7]!==a?(l=t.jsxs(Oe,{defaultOpen:!0,delayDuration:0,children:[r,a]}),e[6]=r,e[7]=a,e[8]=l):l=e[8],l}function jo(n){const e=rt(),{create:s}=nn(),{locator:i}=le(),r=at({strict:!1}),o=lt({strict:!1});return async a=>{const l=crypto.randomUUID(),c=a===o.virtualmcpid?ao(n,i,r.taskId??""):null;try{await s({id:l,virtual_mcp_id:a,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:l},search:{virtualmcpid:a}})}}function vt(n){const e=$.c(20),{agent:s,selected:i,onClick:r}=n,o=i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let a;e[0]!==o?(a=Q("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",o),e[0]=o,e[1]=a):a=e[1];let l;e[2]!==s.icon||e[3]!==s.title?(l=t.jsx(qe,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=l):l=e[4];let c;e[5]!==s.title?(c=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=c):c=e[6];let d;e[7]!==s.description?(d=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=d):d=e[8];let f;e[9]!==c||e[10]!==d?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,d]}),e[9]=c,e[10]=d,e[11]=f):f=e[11];let m;e[12]!==i?(m=i&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=i,e[13]=m):m=e[13];let u;return e[14]!==r||e[15]!==a||e[16]!==l||e[17]!==f||e[18]!==m?(u=t.jsxs("button",{type:"button",onClick:r,className:a,children:[l,f,m]}),e[14]=r,e[15]=a,e[16]=l,e[17]=f,e[18]=m,e[19]=u):u=e[19],u}function un(n){const e=$.c(5),{children:s,action:i}=n;let r;e[0]!==s?(r=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let o;return e[2]!==i||e[3]!==r?(o=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[r,i]}),e[2]=i,e[3]=r,e[4]=o):o=e[4],o}function yo(n){const e=$.c(23),{onClose:s,onSelectAgent:i,selectedAgentId:r,onImportFromGithub:o}=n,[a,l]=V.useState(""),c=Rn(),d=c??[],{org:f}=le(),{data:m}=Te.useSession(),u=m?.user?.id??"anon",p=Zn(c),y=es(),x=jo(f.slug),g=ns(c),h=a.toLowerCase(),v=d.filter(No).filter(E=>!g.has(E.id)).filter(wo).filter(E=>!a||E.title.toLowerCase().includes(h)),j=v.filter(_o),C=v.filter(Co),w=ct(f.id),I=!a||w.title.toLowerCase().includes(h),M=!!(i&&I);let b;e[0]!==s||e[1]!==i?(b=()=>{i?.(null),s(),l("")},e[0]=s,e[1]=i,e[2]=b):b=e[2];const N=b,A=E=>{if(i){i(E.id),s(),l("");return}ts({orgId:f.id,userId:u},E.id,p),y(),s(),l(""),x(E.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let _;e[3]!==a?(_=t.jsx(lo,{value:a,onChange:l}),e[3]=a,e[4]=_):_=e[4];const T="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",P=i&&I&&w&&t.jsx(vt,{agent:w,selected:!r||r===w.id,onClick:N}),D=(j.length>0||!a)&&t.jsx(mo,{onImportFromGithub:o}),F=j.map(E=>t.jsx(vt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>A(E)},E.id)),L=C.length>0&&t.jsx(fo,{}),O=C.map(E=>t.jsx(vt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>A(E)},E.id));let z;e[5]!==M||e[6]!==a||e[7]!==v.length?(z=v.length===0&&!M&&a&&t.jsx(co,{}),e[5]=M,e[6]=a,e[7]=v.length,e[8]=z):z=e[8];let U;e[9]!==z||e[10]!==P||e[11]!==D||e[12]!==F||e[13]!==L||e[14]!==O?(U=t.jsxs("div",{className:T,children:[P,D,F,L,O,z]}),e[9]=z,e[10]=P,e[11]=D,e[12]=F,e[13]=L,e[14]=O,e[15]=U):U=e[15];let R;e[16]!==s||e[17]!==f?(R=t.jsx(uo,{org:f,onClose:s}),e[16]=s,e[17]=f,e[18]=R):R=e[18];let q;return e[19]!==U||e[20]!==R||e[21]!==_?(q=t.jsxs("div",{className:S,children:[_,U,R]}),e[19]=U,e[20]=R,e[21]=_,e[22]=q):q=e[22],q}function Co(n){return!sn(n.metadata)}function _o(n){return sn(n.metadata)}function wo(n){return!zn(n.id)}function No(n){return!$n(n.id)}function So(n){const e=$.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:i,trigger:r,onSelectAgent:o,selectedAgentId:a,side:l,align:c}=s,d=i===void 0?!1:i,f=l===void 0?"right":l,m=c===void 0?"start":c,[u,p]=V.useState(!1),[y,x]=V.useState(!1),g=tn(),{setOpenMobile:h}=Ut(),v=Jn(),j=v?"border border-border":void 0;let C;e[2]!==v?(C=D=>v?t.jsx(bo,{children:D}):D,e[2]=v,e[3]=C):C=e[3];const w=C;let I;e[4]!==g||e[5]!==h?(I=()=>{p(!1),g&&h(!1)},e[4]=g,e[5]=h,e[6]=I):I=e[6];const M=I;let b;e[7]!==M?(b=()=>{M(),x(!0)},e[7]=M,e[8]=b):b=e[8];const N=b;let A;e[9]!==M||e[10]!==N||e[11]!==o||e[12]!==u||e[13]!==a?(A=u&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(Hn,{className:"h-4 w-24"})}),children:t.jsx(yo,{onClose:M,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:N})}),e[9]=M,e[10]=N,e[11]=o,e[12]=u,e[13]=a,e[14]=A):A=e[14];const S=A;let _;e[15]!==m||e[16]!==d||e[17]!==j||e[18]!==v||e[19]!==g||e[20]!==u||e[21]!==S||e[22]!==f||e[23]!==r||e[24]!==w?(_=g?t.jsxs(t.Fragment,{children:[r?t.jsx("button",{type:"button",onClick:()=>p(!0),className:"contents",children:r}):d?w(t.jsx(go,{setOpen:p,emptyCtaClass:j})):t.jsx(ho,{setOpen:p,highlightEmpty:v,emptyCtaClass:j}),t.jsx(Jt,{open:u,onOpenChange:p,direction:"bottom",children:t.jsxs(Zt,{className:"max-h-[85dvh] p-0",children:[t.jsx(po,{}),S]})})]}):t.jsxs(St,{open:u,onOpenChange:D=>{D&&!u&&K("agent_browser_opened",{surface:"desktop_popover"}),p(D)},children:[r?t.jsx(Xe,{asChild:!0,children:r}):d?w(t.jsx(Xe,{asChild:!0,children:t.jsx(xo,{emptyCtaClass:j})})):t.jsx(vo,{wrapEmptyHint:w,highlightEmpty:v,emptyCtaClass:j}),t.jsx(Nt,{className:"w-[380px] p-0 overflow-hidden",side:f,align:m,children:S})]}),e[15]=m,e[16]=d,e[17]=j,e[18]=v,e[19]=g,e[20]=u,e[21]=S,e[22]=f,e[23]=r,e[24]=w,e[25]=_):_=e[25];let T;e[26]!==y?(T=t.jsx(Wn,{open:y,onOpenChange:x,mode:"agent"}),e[26]=y,e[27]=T):T=e[27];let P;return e[28]!==T||e[29]!==_?(P=t.jsxs(t.Fragment,{children:[_,T]}),e[28]=T,e[29]=_,e[30]=P):P=e[30],P}const ko="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 Io(n){const e=$.c(29),{agentId:s,fallback:i,onOpenHome:r,onPick:o}=n,a=G(),l=wt(s)??i??null;let c,d,f,m,u;e[0]!==l?.title||e[1]!==r||e[2]!==a?(u=l?.title??a("header.shellBreadcrumb.superAgentDefaultName"),m="flex min-w-0 items-center gap-0",c="button",d=r,f=a("header.shellBreadcrumb.openAgentHome",{name:u}),e[0]=l?.title,e[1]=r,e[2]=a,e[3]=c,e[4]=d,e[5]=f,e[6]=m,e[7]=u):(c=e[3],d=e[4],f=e[5],m=e[6],u=e[7]);const p=l?.icon??null;let y;e[8]!==p||e[9]!==u?(y=t.jsx(qe,{icon:p,name:u,size:"xs"}),e[8]=p,e[9]=u,e[10]=y):y=e[10];let x;e[11]!==c||e[12]!==d||e[13]!==f||e[14]!==y?(x=t.jsx("button",{type:c,onClick:d,"aria-label":f,className:"flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:y}),e[11]=c,e[12]=d,e[13]=f,e[14]=y,e[15]=x):x=e[15];let g;e[16]!==u?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:u}),e[16]=u,e[17]=g):g=e[17];let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=h):h=e[18];let v;e[19]!==g?(v=t.jsxs("button",{type:"button",className:ko,children:[g,h]}),e[19]=g,e[20]=v):v=e[20];let j;e[21]!==s||e[22]!==o||e[23]!==v?(j=t.jsx(So,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:o,trigger:v}),e[21]=s,e[22]=o,e[23]=v,e[24]=j):j=e[24];let C;return e[25]!==j||e[26]!==m||e[27]!==x?(C=t.jsxs("div",{className:m,children:[x,j]}),e[25]=j,e[26]=m,e[27]=x,e[28]=C):C=e[28],C}function Nr(n){const e=$.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:i}=s,r=G(),{org:o}=le(),{state:a,isMobile:l}=Ut(),c=dn().invitations.length>0,d=a==="collapsed"||l;let f;e[2]!==c||e[3]!==o.name||e[4]!==r?(f=c?r("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:o.name}):r("header.shellBreadcrumb.switchOrganization",{name:o.name}),e[2]=c,e[3]=o.name,e[4]=r,e[5]=f):f=e[5];let m;e[6]!==o?(m=t.jsx(Mt,{org:o,size:"sm"}),e[6]=o,e[7]=m):m=e[7];let u;e[8]!==c||e[9]!==d?(u=c&&t.jsx("span",{className:Q("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",d?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=c,e[9]=d,e[10]=u):u=e[10];let p;e[11]!==m||e[12]!==u?(p=t.jsxs("span",{className:"relative inline-flex",children:[m,u]}),e[11]=m,e[12]=u,e[13]=p):p=e[13];let y;e[14]!==o.name||e[15]!==i?(y=i&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:o.name}),e[14]=o.name,e[15]=i,e[16]=y):y=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=x):x=e[17];let g;e[18]!==f||e[19]!==p||e[20]!==y?(g=t.jsx(Me,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":f,className:"flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[p,y,x]})}),e[18]=f,e[19]=p,e[20]=y,e[21]=g):g=e[21];let h;e[22]!==o.slug||e[23]!==g?(h=t.jsx(so,{orgParam:o.slug,trigger:g}),e[22]=o.slug,e[23]=g,e[24]=h):h=e[24];let v;e[25]!==o.name?(v=t.jsx(Pe,{side:"bottom",children:o.name}),e[25]=o.name,e[26]=v):v=e[26];let j;return e[27]!==v||e[28]!==h?(j=t.jsxs(Oe,{children:[h,v]}),e[27]=v,e[28]=h,e[29]=j):j=e[29],j}function Sr(n){const e=$.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,{org:r}=le();let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[2]=o):o=e[2];const a=at(o);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[3]=l):l=e[3];const c=lt(l),{threads:d}=dt(),{data:f}=Te.useSession(),{setTaskId:m,createNewTask:u}=ut();let p;e[4]!==r.id?(p=ct(r.id),e[4]=r.id,e[5]=p):p=e[5];const y=p,x=y.id,g=a.taskId?c.virtualmcpid??x:x;let h;e[6]!==u||e[7]!==x||e[8]!==i||e[9]!==f?.user?.id||e[10]!==m||e[11]!==d?(h=M=>{const b=M??x,N=is(d,b,f?.user?.id);N?m(N.id,b):u(b),i?.()},e[6]=u,e[7]=x,e[8]=i,e[9]=f?.user?.id,e[10]=m,e[11]=d,e[12]=h):h=e[12];const v=h;let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=j):j=e[13];const C=g===x?y:void 0;let w;e[14]!==g||e[15]!==v?(w=()=>v(g),e[14]=g,e[15]=v,e[16]=w):w=e[16];let I;return e[17]!==g||e[18]!==v||e[19]!==C||e[20]!==w?(I=t.jsx(V.Suspense,{fallback:j,children:t.jsx(Io,{agentId:g,fallback:C,onOpenHome:w,onPick:v})}),e[17]=g,e[18]=v,e[19]=C,e[20]=w,e[21]=I):I=e[21],I}function kr(){const n=$.c(24),e=G(),{org:s}=le();let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[0]=i):i=n[0];const r=at(i);let o;n[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[1]=o):o=n[1];const a=lt(o),{threads:l}=dt(),{createNewTask:c}=ut();let d;n[2]!==s.id?(d=ct(s.id),n[2]=s.id,n[3]=d):d=n[3];const f=d.id,m=r.taskId?a.virtualmcpid??f:f;let u;n[4]!==r.taskId||n[5]!==l?(u=(r.taskId?l.find(I=>I.id===r.taskId)?.branch:null)??null,n[4]=r.taskId,n[5]=l,n[6]=u):u=n[6];const p=u;let y;n[7]!==m||n[8]!==c||n[9]!==p?(y=()=>{c(m,p)},n[7]=m,n[8]=c,n[9]=p,n[10]=y):y=n[10];const x=y;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let h;n[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Mn,{size:16}),n[13]=h):h=n[13];let v;n[14]!==x||n[15]!==g?(v=t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button",onClick:x,"aria-label":g,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:h})}),n[14]=x,n[15]=g,n[16]=v):v=n[16];let j;n[17]!==e?(j=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=j):j=n[18];let C;n[19]!==j?(C=t.jsx(Pe,{side:"bottom",children:j}),n[19]=j,n[20]=C):C=n[20];let w;return n[21]!==v||n[22]!==C?(w=t.jsxs(Oe,{children:[v,C]}),n[21]=v,n[22]=C,n[23]=w):w=n[23],w}function Do({open:n,onOpenChange:e,onCreated:s}){const i=G(),{org:r}=le(),{data:o}=Te.useSession(),{stdioEnabled:a}=Cn(),l=tn(),c=ln(),d=on(),m=rn(d,"").items,u=_n({resolver:wn(vs),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=u.watch("ui_type"),y=u.watch("connection_url"),x=u.watch("npx_package"),g=Je({uiType:p,connectionUrl:y??"",npxPackage:x??""})??$t({uiType:p,connectionUrl:y??"",registryItems:m}),h=b=>{const N=b.trim();if(!N)return;const A=!!u.formState.dirtyFields.title,S=!!u.formState.dirtyFields.description,_=!!u.formState.dirtyFields.env_vars,T=D=>{if(D&&(!A&&!u.getValues("title").trim()&&D.title&&u.setValue("title",D.title,{shouldDirty:!1}),!S&&!(u.getValues("description")??"").trim()&&D.description&&u.setValue("description",D.description,{shouldDirty:!1}),!_&&D.envVarKeys?.length)){const F=u.getValues("env_vars")??[],L=new Set(F.map(z=>z.key)),O=D.envVarKeys.filter(z=>!L.has(z));O.length>0&&u.setValue("env_vars",[...F,...O.map(z=>({key:z,value:""}))],{shouldDirty:!0})}},P=js(N);if(P&&a){u.setValue("ui_type","NPX",{shouldDirty:!0}),u.setValue("npx_package",P.packageName,{shouldDirty:!0}),u.setValue("connection_url","",{shouldDirty:!0}),u.setValue("connection_token",null,{shouldDirty:!0}),T(Je({uiType:"NPX",npxPackage:P.packageName}));return}if(N.startsWith("http://")||N.startsWith("https://")){const D=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";u.setValue("ui_type",D,{shouldDirty:!0}),u.setValue("connection_url",N,{shouldDirty:!0}),T(Je({uiType:D,connectionUrl:N})??$t({uiType:D,connectionUrl:N,registryItems:m}));return}p==="NPX"&&T(Je({uiType:"NPX",npxPackage:N}))},v=b=>{b||u.reset(),e(b)},j=async b=>{let N,A=null,S=null,_=null;b.ui_type==="NPX"?(N="STDIO",A="",_=ys(b.npx_package||"",b.env_vars||[])):b.ui_type==="STDIO"?(N="STDIO",A="",_=Cs(b.stdio_command||"",b.stdio_args||"",b.stdio_cwd,b.env_vars||[])):(N=b.ui_type,A=b.connection_url||"",S=b.connection_token||null);const T=as("conn");try{await c.create.mutateAsync({id:T,title:b.title,description:b.description||null,connection_type:N,connection_url:A,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:o?.user?.id||"system",organization_id:r.id,icon:b.icon??null,app_name:null,app_id:null,connection_headers:_,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),u.reset(),e(!1),s?.(T)}catch{X.error(i("connections.createConnectionDialog.failedToCreateConnection"))}},C=i("connections.createConnectionDialog.title"),w=i("connections.createConnectionDialog.description"),I=u.formState.isSubmitting?i("connections.createConnectionDialog.saving"):i("connections.createConnectionDialog.createButton"),M=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(pe,{control:u.control,name:"ui_type",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.typeLabel")}),t.jsxs(ms,{value:b.value,onValueChange:b.onChange,children:[t.jsx(be,{children:t.jsx(gs,{children:t.jsx(hs,{})})}),t.jsxs(ps,{children:[t.jsx(Qe,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.httpType")]})}),t.jsx(Qe,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.sseType")]})}),t.jsx(Qe,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.websocketType")]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(Qe,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(tt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(Qe,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Pn,{className:"w-4 h-4"}),i("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(je,{})]})}),p==="NPX"&&t.jsx(pe,{control:u.control,name:"npx_package",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.npmPackagePlaceholder"),...b,value:b.value??"",onPaste:N=>{const A=N.clipboardData.getData("text");A&&(N.preventDefault(),u.setValue("npx_package",A.trim(),{shouldDirty:!0}),h(A))},onBlur:N=>{h(N.target.value),b.onBlur()}})}),t.jsx(je,{})]})}),p==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(pe,{control:u.control,name:"stdio_command",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.commandLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.commandPlaceholder"),...b,value:b.value??""})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"stdio_args",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.argumentsLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.argumentsPlaceholder"),...b,value:b.value??""})}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"stdio_cwd",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.workingDirectoryPlaceholder"),...b,value:b.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(je,{})]})})]}),(p==="NPX"||p==="STDIO")&&t.jsx(pe,{control:u.control,name:"env_vars",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(be,{children:t.jsx(bs,{value:b.value??[],onChange:b.onChange})}),t.jsx(je,{})]})}),p!=="NPX"&&p!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(pe,{control:u.control,name:"connection_url",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.urlLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.urlPlaceholder"),...b,value:b.value??"",onPaste:N=>{const A=N.clipboardData.getData("text");A&&(N.preventDefault(),u.setValue("connection_url",A.trim(),{shouldDirty:!0}),h(A))},onBlur:N=>{h(N.target.value),b.onBlur()}})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"connection_token",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:g?.token?.label??i("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(be,{children:t.jsx(Le,{type:"password",placeholder:g?.token?.placeholder??i("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...b,value:b.value??""})}),g?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:i("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"title",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.nameLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.namePlaceholder"),...b})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"description",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.descriptionLabel")}),t.jsx(be,{children:t.jsx(xs,{placeholder:i("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...b,value:b.value??""})}),t.jsx(je,{})]})})]});return l?t.jsx(Jt,{open:n,onOpenChange:v,children:t.jsxs(Zt,{className:"max-h-[90vh]",children:[t.jsx(Vn,{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(en,{children:C}),t.jsx(Un,{className:"mt-1",children:w})]}),t.jsx(qn,{asChild:!0,children:t.jsx(ye,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Yt,{size:16})})})]})}),t.jsx(Ft,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:M}),t.jsx(Kn,{children:t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"w-full",children:I})})]})})]})}):t.jsx(It,{open:n,onOpenChange:v,children:t.jsxs(Dt,{className:"sm:max-w-[525px]",children:[t.jsxs(At,{children:[t.jsx(Tt,{children:C}),t.jsx(an,{children:w})]}),t.jsx(Ft,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"py-4",children:M}),t.jsxs(fs,{children:[t.jsx(ye,{type:"button",variant:"outline",onClick:()=>v(!1),children:i("connections.createConnectionDialog.cancelButton")}),t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"min-w-40",children:I})]})]})})]})})}function Ao(n){const e=$.c(72),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:l,connectingItemId:c,search:d,onCreateConnection:f,onBrowseNavigate:m,defaultTab:u}=n,p=s===void 0?"add":s,y=u===void 0?"connected":u,x=G(),{org:g}=le(),h=V.useDeferredValue(d),v=d!==h;let j;e[0]!==h?(j=h.trim().toLowerCase(),e[0]=h,e[1]=j):j=e[1];const C=j;let w;e[2]!==y?(w=k=>k??y,e[2]=y,e[3]=w):w=e[3];const[I,M]=Ct(Nn.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),w);let b;e[4]!==I||e[5]!==M?(b=k=>{k!==I&&K("connections_dialog_tab_changed",{to_tab:k}),M(k)},e[4]=I,e[5]=M,e[6]=b):b=e[6];const N=b;let A;e[7]!==g.id||e[8]!==g.slug?(A={connectionId:Wt,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=A):A=e[9];const S=Ln(A),_=h?.trim().split(/\s+/).filter(Boolean)??[],T=_.length>0?{operator:"or",conditions:_.flatMap(Lo)}:void 0,P={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},D=JSON.stringify(P),{data:F,fetchNextPage:L,hasNextPage:O,isFetchingNextPage:z}=Ns({queryKey:Ue.collectionListInfinite(S,g.id,"","CONNECTIONS",D),queryFn:async k=>{const{pageParam:B}=k,Z=B===void 0?0:B;return(await S.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Z}})).structuredContent},initialPageParam:0,getNextPageParam:$o,staleTime:3e4}),U=F?.pages.flatMap(Fo)??[],R=us(U),q=new Set(U.filter(Oo).map(Po)),E=on(),Y=rn(E,h),ee=zt(Y.loadMore,Y.hasMore,Y.isLoadingMore),te=zt(L,O??!1,z),H=I==="all"||!!C,J=H?Y.items.filter(k=>{const B=ls(k);if(B&&q.has(B))return!1;if(!C)return!0;const Z=ot(k._meta),ue=[k.title,k.description,k.name,k.server?.title,k.server?.description,k.server?.name,Z?.friendly_name,Z?.friendlyName].filter(Boolean).join(" ").toLowerCase();return _.some(he=>ue.includes(he.toLowerCase()))}):[],ne=J.filter(Mo),W=J.filter(To);let Ne;e[10]!==r?(Ne=k=>k.some(B=>r.has(B.id)),e[10]=r,e[11]=Ne):Ne=e[11];const Be=Ne;let Ce;e[12]!==r||e[13]!==i||e[14]!==c||e[15]!==Be||e[16]!==p||e[17]!==o||e[18]!==m||e[19]!==a||e[20]!==x?(Ce=(k,B,Z,ue,he)=>{const Ye=Be(he),Ge=he.find(ze=>!r.has(ze.id)),ce=he[0];if(p==="browse"){const ze=_s(ce);return t.jsx(ht,{connection:{title:B,icon:Z,description:he.length>1?`${he.length} instances`:ue??void 0},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",x("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{K("connection_browse_clicked",{app_name:ce.app_name??null,connection_id:ce.id,instances_count:he.length}),m?.(ze)}},k)}return t.jsx(ht,{connection:{title:B,icon:Z,description:ue},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Ye&&t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",x("virtualMcp.connectionDialogContent.added")]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),Ge?(K("connection_add_clicked",{action:"use_existing",app_name:ce.app_name??null,connection_id:Ge.id}),i&&K("agent_connection_attached",{agent_id:i,connection_id:Ge.id,app_name:ce.app_name??null,mode:"existing"}),o(Ge.id)):(K("connection_add_clicked",{action:"clone",app_name:ce.app_name??null,base_connection_id:ce.id}),a(ce))},children:x("virtualMcp.connectionDialogContent.add")})]})},k)},e[12]=r,e[13]=i,e[14]=c,e[15]=Be,e[16]=p,e[17]=o,e[18]=m,e[19]=a,e[20]=x,e[21]=Ce):Ce=e[21];const Ee=Ce;let _e;e[22]!==c||e[23]!==p||e[24]!==l||e[25]!==x?(_e=k=>{const B=ot(k._meta),Z=B?.friendlyName||B?.friendly_name||k.server?.title||k.title||k.server?.name||k.name||k.id||"",ue=k.server?.description||k.description||null,he=k.server?.icons?.[0]?.src||cs(k.server?.repository)||null,Ye=B?.official===!0,Ge=B?.verified===!0,ce=B?.owner==="deco";return t.jsx(ht,{connection:{title:Z,description:ue,icon:he},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[ce&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:t.jsx("img",{src:"/logos/deco logo.svg",alt:x("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(Pe,{children:x("virtualMcp.connectionDialogContent.builtByDeco")})]}),!ce&&Ye&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:x("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!ce&&!Ye&&Ge&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:x("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),K("connection_add_clicked",{action:"connect_new",registry_item_id:k.id,app_name:B?.friendlyName||k.server?.name||k.name||null}),l(k)},children:c===k.id?t.jsx(Ve,{size:14,className:"animate-spin"}):x(p==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${k.id}`)},e[22]=c,e[23]=p,e[24]=l,e[25]=x,e[26]=_e):_e=e[26];const We=_e;let se;e[27]!==I||e[28]!==N||e[29]!==f||e[30]!==C||e[31]!==x?(se=!C&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(ws,{tabs:[{id:"all",label:x("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:x("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:I,onTabChange:k=>N(k)}),t.jsxs(ye,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{K("connections_dialog_custom_clicked"),f()},children:[t.jsx(Ke,{size:12}),x("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=I,e[28]=N,e[29]=f,e[30]=C,e[31]=x,e[32]=se):se=e[32];const Se=v&&"opacity-50 pointer-events-none";let oe;e[33]!==Se?(oe=Q("flex-1 overflow-auto p-5 transition-opacity duration-150",Se),e[33]=Se,e[34]=oe):oe=e[34];const Re="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ke;e[35]!==Ee?(ke=k=>{if(k.type==="group")return Ee(k.key,k.title,k.icon,null,k.connections);const B=k.connection;return Ee(B.id,B.title,B.icon,B.description??null,[B])},e[35]=Ee,e[36]=ke):ke=e[36];const Ie=R.map(ke);let fe;e[37]!==te?(fe=t.jsx("div",{ref:te,className:"col-span-full h-1"}),e[37]=te,e[38]=fe):fe=e[38];let de;e[39]!==z?(de=z&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=z,e[40]=de):de=e[40];const Fe=H&&ne.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(pt,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:x("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),De=H&&ne.map(We),$e=H&&W.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:x("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ae=H&&W.map(We);let me;e[41]!==ee||e[42]!==E||e[43]!==H?(me=H&&E.length>0&&t.jsx("div",{ref:ee,className:"col-span-full h-1"}),e[41]=ee,e[42]=E,e[43]=H,e[44]=me):me=e[44];let ie;e[45]!==Y.isLoadingMore||e[46]!==H?(ie=H&&Y.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=Y.isLoadingMore,e[46]=H,e[47]=ie):ie=e[47];let ge;e[48]!==Ie||e[49]!==fe||e[50]!==de||e[51]!==Fe||e[52]!==De||e[53]!==$e||e[54]!==Ae||e[55]!==me||e[56]!==ie?(ge=t.jsxs("div",{className:Re,children:[Ie,fe,de,Fe,De,$e,Ae,me,ie]}),e[48]=Ie,e[49]=fe,e[50]=de,e[51]=Fe,e[52]=De,e[53]=$e,e[54]=Ae,e[55]=me,e[56]=ie,e[57]=ge):ge=e[57];let re;e[58]!==I||e[59]!==R.length||e[60]!==W||e[61]!==d||e[62]!==x||e[63]!==ne?(re=R.length===0&&ne.length===0&&W.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:d?x("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:d}):x(I==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=I,e[59]=R.length,e[60]=W,e[61]=d,e[62]=x,e[63]=ne,e[64]=re):re=e[64];let ae;e[65]!==oe||e[66]!==ge||e[67]!==re?(ae=t.jsxs("div",{className:oe,children:[ge,re]}),e[65]=oe,e[66]=ge,e[67]=re,e[68]=ae):ae=e[68];let we;return e[69]!==se||e[70]!==ae?(we=t.jsxs(t.Fragment,{children:[se,ae]}),e[69]=se,e[70]=ae,e[71]=we):we=e[71],we}function To(n){return!n.verified&&!ot(n._meta)?.verified&&!n.meta?.verified}function Mo(n){return n.verified||ot(n._meta)?.verified||n.meta?.verified}function Po(n){return n.app_name}function Oo(n){return n.app_name}function Fo(n){return n?.items??[]}function $o(n,e){if(n?.hasMore)return e.reduce(zo,0)}function zo(n,e){return n+(e?.items?.length??0)}function Lo(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Ir({open:n,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=G(),a=r.mode??"add",l="agentId"in r?r.agentId:void 0,c="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,d="onAdd"in r&&r.onAdd?r.onAdd:S=>{},f=(S,_,T)=>{l&&K("agent_connection_attached",{agent_id:l,connection_id:S,app_name:_,mode:T})},[m,u]=V.useState(null),[p,y]=V.useState(i),[x,g]=V.useState(!1),{org:h}=le(),{data:v}=Te.useSession(),j=ln(),C=Sn(),w=rt(),I=S=>{e(!1),w({to:"/$org/settings/connections/$appSlug",params:{org:h.slug,appSlug:S}})},M=()=>{C.invalidateQueries({predicate:S=>{const _=S.queryKey;return _[1]===h.id&&_[3]==="collection"&&_[4]==="CONNECTIONS"}})},b=async(S,_)=>{K("connection_oauth_succeeded",{connection_id:S,flow:_});const T=new URL(`/api/${h.slug}/mcp/${S}`,window.location.origin);await C.invalidateQueries({queryKey:Ue.isMCPAuthenticated(T.href,null)}),M()},N=async S=>{u(S.app_name??S.id);try{const T=`${S.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,D=(await j.create.mutateAsync({title:T,description:S.description??null,connection_type:S.connection_type,connection_url:S.connection_url??null,connection_token:null,icon:S.icon??null,app_name:S.app_name??null,app_id:S.app_id??null,connection_headers:S.connection_headers??null})).id,F=await xt({connectionId:D,orgId:h.id,orgSlug:h.slug,persistFallback:L=>j.update.mutateAsync({id:D,data:{connection_token:L}}).then(()=>{})});if(F.ran&&!F.ok){K("connection_oauth_failed",{connection_id:D,flow:"clone",error:F.error??"no_token"}),X.error(o("virtualMcp.addConnectionDialog.authenticationFailedError",{error:F.error??"no token received"})),await j.delete.mutateAsync(D);return}F.ran&&await b(D,"clone"),f(D,S.app_name??null,"clone"),d(D)}catch(_){console.error("Failed to add connection:",_),X.error(o("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{u(null)}},A=async S=>{if(!(!h||!v?.user?.id)){u(S.id);try{const _=ds(S,h.id,v.user.id,{remoteIndex:0}),T=_.connection_type==="STDIO",P=!!_.connection_url,D=T&&_.connection_headers&&typeof _.connection_headers=="object"&&"command"in _.connection_headers;if(!P&&!D){X.error(o("virtualMcp.addConnectionDialog.mcpServerConnectionError")),u(null);return}const{id:F}=await j.create.mutateAsync(_),L=await xt({connectionId:F,orgId:h.id,orgSlug:h.slug,persistFallback:O=>j.update.mutateAsync({id:F,data:{connection_token:O}}).then(()=>{})});if(L.ran&&!L.ok){K("connection_oauth_failed",{connection_id:F,flow:"connect_new",error:L.error??"no_token"}),X.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:L.error??"no token received"})}),f(F,_.app_name??null,"new"),d(F);return}L.ran?(await b(F,"connect_new"),X.success(o("virtualMcp.addConnectionDialog.connectedAuthenticated"))):X.success(o("virtualMcp.addConnectionDialog.connected")),f(F,_.app_name??null,"new"),d(F)}catch(_){console.error("Failed to connect:",_),X.error(o("virtualMcp.addConnectionDialog.failedToConnect"))}finally{u(null)}}};return t.jsxs(It,{open:n,onOpenChange:e,children:[t.jsxs(Dt,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(At,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx(Tt,{className:"text-base font-semibold",children:o(a==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(rs,{value:p,onChange:y,placeholder:o("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ao,{mode:a,agentId:l,addedConnectionIds:c,onAdd:d,onCloneAndAdd:N,onConnectAndAdd:A,connectingItemId:m,search:p,onCreateConnection:()=>g(!0),onBrowseNavigate:I,defaultTab:s})})]}),t.jsx(Do,{open:x,onOpenChange:g,onCreated:async S=>{g(!1);const _=await xt({connectionId:S,orgId:h.id,orgSlug:h.slug,persistFallback:T=>j.update.mutateAsync({id:S,data:{connection_token:T}}).then(()=>{})});if(_.ran&&!_.ok){K("connection_oauth_failed",{connection_id:S,flow:"custom_create",error:_.error??"no_token"}),X.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:_.error??"no token received"})}),f(S,null,"custom"),d(S),e(!1);return}_.ran&&await b(S,"custom_create"),f(S,null,"custom"),d(S),e(!1)}})]})}const Lt=new Map;function Dr(){const{org:n}=le(),e=ft(),s=Ss(),i=s.find(g=>g.providerId==="deco"),{data:r,isLoading:o,refetch:a,isFetching:l}=He({queryKey:Ue.aiProviderCredits(n.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),c=r?.balanceCents??null,d=c!=null?c/100:null,f=V.useRef(new Map);if(c!=null){const g=Lt.get(n.id);f.current.get(n.id)&&g!=null&&c>g&&K("credits_topped_up_detected",{organization_id:n.id,delta_cents:c-g,previous_balance_cents:g,new_balance_cents:c}),Lt.set(n.id,c),f.current.set(n.id,!0)}const m=!!i,u=c!=null&&c>0,p=c!=null&&c===0,y=c!=null&&c===200,x=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:m,decoKeyId:i?.id??null,balanceCents:c,balanceDollars:d,hasCredits:u,isZeroBalance:p,isInitialFreeCredit:y,hasOnlyDecoProvider:x,isLoading:o,isFetching:l,refetch:a}}function bt(n){const e=$.c(13),{label:s,value:i,onChange:r,options:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==r?(l=m=>m&&r(m),e[2]=r,e[3]=l):l=e[3];let c;e[4]!==o?(c=o.map(Bo),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==c||e[8]!==i?(d=t.jsx(Ds,{type:"single",size:"sm",value:i,onValueChange:l,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=l,e[7]=c,e[8]=i,e[9]=d):d=e[9];let f;return e[10]!==a||e[11]!==d?(f=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,d]}),e[10]=a,e[11]=d,e[12]=f):f=e[12],f}function Bo(n){return t.jsxs(Is,{value:n.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[n.icon,n.label]},n.value)}function Ar(n){const e=$.c(91),{panel:s,className:i}=n,r=i===void 0?"md:size-[34px] rounded-lg":i,o=G();let a;e[0]!==o?(a=o("sidebar.taskGroupsList.filterChats"),e[0]=o,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(ks,{size:16}),e[2]=l):l=e[2];let c;e[3]!==s.filtersActive?(c=s.filtersActive&&t.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"}),e[3]=s.filtersActive,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==s.filtersActive||e[7]!==a||e[8]!==c?(d=t.jsx(Me,{asChild:!0,children:t.jsx(Xe,{asChild:!0,children:t.jsxs(kt,{"aria-label":a,active:s.filtersActive,className:r,children:[l,c]})})}),e[5]=r,e[6]=s.filtersActive,e[7]=a,e[8]=c,e[9]=d):d=e[9];let f;e[10]!==o?(f=o("sidebar.taskGroupsList.filterChats"),e[10]=o,e[11]=f):f=e[11];let m;e[12]!==f?(m=t.jsx(Pe,{side:"bottom",children:f}),e[12]=f,e[13]=m):m=e[13];let u;e[14]!==d||e[15]!==m?(u=t.jsxs(Oe,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=u):u=e[16];let p;e[17]!==o?(p=o("sidebar.taskGroupsList.filterView"),e[17]=o,e[18]=p):p=e[18];const y=s.groupBy;let x;e[19]!==s?(x=W=>{K("tasks_panel_group_by_changed",{to_value:W}),s.setGroupBy(W)},e[19]=s,e[20]=x):x=e[20];let g;e[21]!==o?(g=o("sidebar.taskGroupsList.viewList"),e[21]=o,e[22]=g):g=e[22];let h;e[23]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(On,{size:13}),e[23]=h):h=e[23];let v;e[24]!==g?(v={value:"flat",label:g,icon:h},e[24]=g,e[25]=v):v=e[25];let j;e[26]!==o?(j=o("sidebar.taskGroupsList.viewStatus"),e[26]=o,e[27]=j):j=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Fn,{size:13}),e[28]=C):C=e[28];let w;e[29]!==j?(w={value:"status",label:j,icon:C},e[29]=j,e[30]=w):w=e[30];let I;e[31]!==v||e[32]!==w?(I=[v,w],e[31]=v,e[32]=w,e[33]=I):I=e[33];let M;e[34]!==s.groupBy||e[35]!==x||e[36]!==I||e[37]!==p?(M=t.jsx(bt,{label:p,value:y,onChange:x,options:I}),e[34]=s.groupBy,e[35]=x,e[36]=I,e[37]=p,e[38]=M):M=e[38];let b;e[39]!==o?(b=o("sidebar.taskGroupsList.filterType"),e[39]=o,e[40]=b):b=e[40];const N=s.typeFilter;let A;e[41]!==s?(A=W=>{K("tasks_panel_filter_changed",{to_value:W}),s.setTypeFilter(W)},e[41]=s,e[42]=A):A=e[42];let S;e[43]!==o?(S=o("sidebar.taskGroupsList.typeAll"),e[43]=o,e[44]=S):S=e[44];let _;e[45]!==S?(_={value:"all",label:S},e[45]=S,e[46]=_):_=e[46];let T;e[47]!==o?(T=o("sidebar.taskGroupsList.typeChats"),e[47]=o,e[48]=T):T=e[48];let P;e[49]!==T?(P={value:"manual",label:T},e[49]=T,e[50]=P):P=e[50];let D;e[51]!==o?(D=o("sidebar.taskGroupsList.typeAuto"),e[51]=o,e[52]=D):D=e[52];let F;e[53]!==D?(F={value:"automation",label:D},e[53]=D,e[54]=F):F=e[54];let L;e[55]!==_||e[56]!==P||e[57]!==F?(L=[_,P,F],e[55]=_,e[56]=P,e[57]=F,e[58]=L):L=e[58];let O;e[59]!==s.typeFilter||e[60]!==b||e[61]!==A||e[62]!==L?(O=t.jsx(bt,{label:b,value:N,onChange:A,options:L}),e[59]=s.typeFilter,e[60]=b,e[61]=A,e[62]=L,e[63]=O):O=e[63];let z;e[64]!==o?(z=o("sidebar.taskGroupsList.filterScope"),e[64]=o,e[65]=z):z=e[65];const U=s.showAll?"team":"mine";let R;e[66]!==s?(R=W=>s.setShowAll(W==="team"),e[66]=s,e[67]=R):R=e[67];let q;e[68]!==o?(q=o("sidebar.taskGroupsList.scopeMine"),e[68]=o,e[69]=q):q=e[69];let E;e[70]!==q?(E={value:"mine",label:q},e[70]=q,e[71]=E):E=e[71];let Y;e[72]!==o?(Y=o("sidebar.taskGroupsList.scopeTeam"),e[72]=o,e[73]=Y):Y=e[73];let ee;e[74]!==Y?(ee={value:"team",label:Y},e[74]=Y,e[75]=ee):ee=e[75];let te;e[76]!==E||e[77]!==ee?(te=[E,ee],e[76]=E,e[77]=ee,e[78]=te):te=e[78];let H;e[79]!==z||e[80]!==U||e[81]!==R||e[82]!==te?(H=t.jsx(bt,{label:z,value:U,onChange:R,options:te}),e[79]=z,e[80]=U,e[81]=R,e[82]=te,e[83]=H):H=e[83];let J;e[84]!==M||e[85]!==O||e[86]!==H?(J=t.jsxs(Nt,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[M,O,H]}),e[84]=M,e[85]=O,e[86]=H,e[87]=J):J=e[87];let ne;return e[88]!==J||e[89]!==u?(ne=t.jsxs(St,{children:[u,J]}),e[88]=J,e[89]=u,e[90]=ne):ne=e[90],ne}function Eo(n){const e=$.c(9),{virtualMcpId:s,size:i,showAutomationBadge:r}=n,o=i===void 0?"sm":i,a=G();let l;e[0]!==o||e[1]!==s?(l=s?t.jsx(Ro,{virtualMcpId:s,size:o}):t.jsx(qe,{icon:null,name:"?",size:o}),e[0]=o,e[1]=s,e[2]=l):l=e[2];let c;e[3]!==r||e[4]!==a?(c=r&&t.jsx("span",{"aria-label":a("tasksPanel.mcpAvatar.automationTriggered"),className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:t.jsx(cn,{size:10,className:"text-white"})}),e[3]=r,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=t.jsxs("div",{className:"relative shrink-0",children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function Ro(n){const e=$.c(6),{virtualMcpId:s,size:i}=n,r=wt(s);if(!r){let l;return e[0]!==i?(l=t.jsx(qe,{icon:null,name:"?",size:i}),e[0]=i,e[1]=l):l=e[1],l}const o=r.icon??null;let a;return e[2]!==r.title||e[3]!==i||e[4]!==o?(a=t.jsx(qe,{icon:o,name:r.title,size:i}),e[2]=r.title,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function Go(n){const e=$.c(51),{open:s,onOpenChange:i}=n,[r,o]=V.useState(""),{org:a}=le(),{setTaskId:l}=ut(),c=ft(),d=G();let f,m,u;e[0]!==a.id||e[1]!==r?(u=r.trim(),m=He,f=Ue.globalSearch(a.id,u),e[0]=a.id,e[1]=r,e[2]=f,e[3]=m,e[4]=u):(f=e[2],m=e[3],u=e[4]);let p;e[5]!==c||e[6]!==u?(p=async()=>await c.call("GLOBAL_SEARCH",{query:u,limit:u?20:10}),e[5]=c,e[6]=u,e[7]=p):p=e[7];let y;e[8]!==s||e[9]!==f||e[10]!==p?(y={queryKey:f,enabled:s,queryFn:p,staleTime:1e4},e[8]=s,e[9]=f,e[10]=p,e[11]=y):y=e[11];const{data:x,isFetching:g}=m(y);let h;e[12]!==x?.items?(h=x?.items??[],e[12]=x?.items,e[13]=h):h=e[13];const v=h;let j;e[14]!==i?(j=O=>{O||o(""),i(O)},e[14]=i,e[15]=j):j=e[15];const C=j;let w;e[16]!==C||e[17]!==l?(w=O=>{C(!1),l(O.id,O.virtual_mcp_id??void 0)},e[16]=C,e[17]=l,e[18]=w):w=e[18];const I=w;let M;e[19]!==d?(M=d("tasksPanel.globalSearchDialog.title"),e[19]=d,e[20]=M):M=e[20];let b;e[21]!==M?(b=t.jsx(Tt,{children:M}),e[21]=M,e[22]=b):b=e[22];let N;e[23]!==d?(N=d("tasksPanel.globalSearchDialog.description"),e[23]=d,e[24]=N):N=e[24];let A;e[25]!==N?(A=t.jsx(an,{children:N}),e[25]=N,e[26]=A):A=e[26];let S;e[27]!==A||e[28]!==b?(S=t.jsxs(At,{className:"sr-only",children:[b,A]}),e[27]=A,e[28]=b,e[29]=S):S=e[29];let _;e[30]!==d?(_=d("tasksPanel.globalSearchDialog.placeholder"),e[30]=d,e[31]=_):_=e[31];let T;e[32]!==r||e[33]!==_?(T=t.jsx(Os,{value:r,onValueChange:o,placeholder:_}),e[32]=r,e[33]=_,e[34]=T):T=e[34];let P;e[35]!==I||e[36]!==g||e[37]!==v||e[38]!==d||e[39]!==u?(P=t.jsx(As,{children:g&&v.length===0?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):v.length===0?t.jsx(Ts,{children:d("tasksPanel.globalSearchDialog.noResults")}):t.jsx(Ms,{heading:u?void 0:d("tasksPanel.globalSearchDialog.recent"),children:v.map(O=>O.type==="thread"?t.jsxs(Ps,{value:`thread:${O.id}:${O.title}`,onSelect:()=>I(O),className:"gap-2.5",children:[t.jsx(Eo,{virtualMcpId:O.virtual_mcp_id,size:"xs"}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("div",{className:"text-sm text-foreground truncate",children:O.title||d("tasksPanel.globalSearchDialog.untitledChat")})}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(O.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${O.id}`):null)})}),e[35]=I,e[36]=g,e[37]=v,e[38]=d,e[39]=u,e[40]=P):P=e[40];let D;e[41]!==T||e[42]!==P?(D=t.jsxs(Fs,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[T,P]}),e[41]=T,e[42]=P,e[43]=D):D=e[43];let F;e[44]!==S||e[45]!==D?(F=t.jsxs(Dt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[S,D]}),e[44]=S,e[45]=D,e[46]=F):F=e[46];let L;return e[47]!==C||e[48]!==s||e[49]!==F?(L=t.jsx(It,{open:s,onOpenChange:C,children:F}),e[47]=C,e[48]=s,e[49]=F,e[50]=L):L=e[50],L}function Ho(n){const e=$.c(43),{branch:s,onOutcome:i}=n,r=G();let o;e[0]!==i?(o=M=>{M||i("cancel")},e[0]=i,e[1]=o):o=e[1];let a;e[2]!==r?(a=r("sidebar.archiveWorktreeDialog.title"),e[2]=r,e[3]=a):a=e[3];let l;e[4]!==a?(l=t.jsx($s,{children:a}),e[4]=a,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("sidebar.archiveWorktreeDialog.stopsAndDeletesBefore"),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==s?(d=t.jsx("span",{className:"font-mono",children:s}),e[8]=s,e[9]=d):d=e[9];let f;e[10]!==r?(f=r("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=r,e[11]=f):f=e[11];let m;e[12]!==c||e[13]!==d||e[14]!==f?(m=t.jsxs(zs,{children:[c," ",d," ",f]}),e[12]=c,e[13]=d,e[14]=f,e[15]=m):m=e[15];let u;e[16]!==l||e[17]!==m?(u=t.jsxs(Ls,{children:[l,m]}),e[16]=l,e[17]=m,e[18]=u):u=e[18];let p;e[19]!==i?(p=()=>i("cancel"),e[19]=i,e[20]=p):p=e[20];let y;e[21]!==r?(y=r("sidebar.archiveWorktreeDialog.cancel"),e[21]=r,e[22]=y):y=e[22];let x;e[23]!==y||e[24]!==p?(x=t.jsx(Bs,{onClick:p,children:y}),e[23]=y,e[24]=p,e[25]=x):x=e[25];let g;e[26]===Symbol.for("react.memo_cache_sentinel")?(g=Q(kn({variant:"destructive"})),e[26]=g):g=e[26];let h;e[27]!==i?(h=()=>i("confirm"),e[27]=i,e[28]=h):h=e[28];let v;e[29]!==r?(v=r("sidebar.archiveWorktreeDialog.confirm"),e[29]=r,e[30]=v):v=e[30];let j;e[31]!==h||e[32]!==v?(j=t.jsx(Es,{className:g,onClick:h,children:v}),e[31]=h,e[32]=v,e[33]=j):j=e[33];let C;e[34]!==x||e[35]!==j?(C=t.jsxs(Rs,{children:[x,j]}),e[34]=x,e[35]=j,e[36]=C):C=e[36];let w;e[37]!==C||e[38]!==u?(w=t.jsxs(Gs,{children:[u,C]}),e[37]=C,e[38]=u,e[39]=w):w=e[39];let I;return e[40]!==o||e[41]!==w?(I=t.jsx(Hs,{open:!0,onOpenChange:o,children:w}),e[40]=o,e[41]=w,e[42]=I):I=e[42],I}function Vo(n,e,s){if(!s)return;const i=n.findIndex(r=>r.id===e);if(i!==-1){for(let r=i+1;r<n.length;r++){const o=n[r];if(o?.created_by===s)return o}for(let r=i-1;r>=0;r--){const o=n[r];if(o?.created_by===s)return o}}}function Uo(n){return n==="ephemeral"||n.startsWith("thread:")}function fn(n){const e=$.c(45),{task:s,isActive:i,onClick:r,onArchive:o,showAutomationBadge:a,showAgentIcon:l,hideStatusIdle:c,indented:d}=n,f=G(),m=Us(s.status),u=m.icon,p=s.metadata?.kind==="tool_call_run",y=wt(p?void 0:s.virtual_mcp_id);let x;e[0]!==y?(x=ss(y),e[0]=y,e[1]=x):x=e[1];const g=x;qs(6e4);const h=a||!!s.trigger_id,v=s.id,j="button",C=0;let w;e[2]!==r?(w=R=>{R.target===R.currentTarget&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),r())},e[2]=r,e[3]=w):w=e[3];const I=d?"-ml-4 pl-6":"pl-[7px]",M=i?"bg-accent text-accent-foreground":"hover:bg-accent/60";let b;e[4]!==I||e[5]!==M?(b=Q("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",I,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",M),e[4]=I,e[5]=M,e[6]=b):b=e[6];let N;e[7]!==p||e[8]!==l||e[9]!==y?.icon||e[10]!==y?.title?(N=l&&!p&&t.jsx(qe,{icon:y?.icon??null,name:y?.title??"?",size:"2xs"}),e[7]=p,e[8]=l,e[9]=y?.icon,e[10]=y?.title,e[11]=N):N=e[11];let A;e[12]!==h||e[13]!==f?(A=h&&t.jsx(cn,{size:12,"aria-label":f("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=h,e[13]=f,e[14]=A):A=e[14];let S;e[15]!==f||e[16]!==s.title?(S=s.title||f("tasksPanel.taskRow.untitledTask"),e[15]=f,e[16]=s.title,e[17]=S):S=e[17];let _;e[18]!==S?(_=t.jsx("div",{className:"text-sm text-foreground truncate",children:S}),e[18]=S,e[19]=_):_=e[19];let T;e[20]!==A||e[21]!==_?(T=t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[A,_]}),e[20]=A,e[21]=_,e[22]=T):T=e[22];let P;e[23]!==g||e[24]!==i||e[25]!==s.branch||e[26]!==s.updated_at?(P=s.updated_at&&t.jsxs("div",{className:Q("flex items-center gap-1 text-[11px] min-w-0",i?"text-accent-foreground/70":"text-muted-foreground/60"),children:[s.branch&&!Uo(s.branch)?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate font-mono",children:s.branch}),t.jsx("span",{className:"shrink-0",children:"·"})]}):g?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"truncate",children:[g.owner,"/",g.name]}),t.jsx("span",{className:"shrink-0",children:"·"})]}):null,t.jsx("span",{className:"shrink-0",children:Ws(new Date(s.updated_at))})]}),e[23]=g,e[24]=i,e[25]=s.branch,e[26]=s.updated_at,e[27]=P):P=e[27];let D;e[28]!==T||e[29]!==P?(D=t.jsxs("div",{className:"flex-1 min-w-0",children:[T,P]}),e[28]=T,e[29]=P,e[30]=D):D=e[30];const F="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",L=!c&&t.jsx("span",{className:Q("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",o&&"group-hover/row:opacity-0"),"aria-label":f("tasksPanel.taskRow.statusLabel",{status:m.label}),children:t.jsx(u,{size:14,className:Q(m.iconClassName,s.status==="in_progress"&&"animate-spin")})});let O;e[31]!==o||e[32]!==f?(O=o&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":f("tasksPanel.taskRow.archiveTask"),onClick:R=>{R.stopPropagation(),o()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:t.jsx(In,{size:14})})}),t.jsx(Pe,{side:"right",children:f("tasksPanel.taskRow.archive")})]}),e[31]=o,e[32]=f,e[33]=O):O=e[33];let z;e[34]!==L||e[35]!==O?(z=t.jsxs("div",{className:F,children:[L,O]}),e[34]=L,e[35]=O,e[36]=z):z=e[36];let U;return e[37]!==r||e[38]!==D||e[39]!==z||e[40]!==w||e[41]!==b||e[42]!==N||e[43]!==s.id?(U=t.jsxs("div",{"data-task-id":v,role:j,tabIndex:C,onClick:r,onKeyDown:w,className:b,children:[N,D,z]}),e[37]=r,e[38]=D,e[39]=z,e[40]=w,e[41]=b,e[42]=N,e[43]=s.id,e[44]=U):U=e[44],U}const Bt=["requires_action","in_progress","failed","expired","completed"];function qo(n){const e=new Map(Bt.map(s=>[s,[]]));for(const s of n){const i=s.status??"completed";(e.get(i)??e.get("completed")).push(s)}return Bt.map(s=>({status:s,threads:e.get(s)}))}const Ko="sidebar.group.expanded.";function Wo(n,e){const s=$.c(3),[i,r]=Ct(`${Ko}${n}`,e);let o;return s[0]!==i||s[1]!==r?(o=[i,r],s[0]=i,s[1]=r,s[2]=o):o=s[2],o}function mn(n){const e=$.c(18),{onClick:s,isFetching:i,indented:r}=n,o=G();let a;e[0]!==o?(a=o("sidebar.showMoreButton.ariaLabel"),e[0]=o,e[1]=a):a=e[1];const l=r?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==l?(c=Q("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==i?(d=i&&t.jsx(Ve,{size:14,className:"animate-spin"}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==i||e[7]!==o?(f=o(i?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=i,e[7]=o,e[8]=f):f=e[8];let m;e[9]!==f?(m=t.jsx("span",{children:f}),e[9]=f,e[10]=m):m=e[10];let u;return e[11]!==i||e[12]!==s||e[13]!==a||e[14]!==c||e[15]!==d||e[16]!==m?(u=t.jsxs("button",{type:"button","aria-label":a,onClick:s,disabled:i,className:c,children:[d,m]}),e[11]=i,e[12]=s,e[13]=a,e[14]=c,e[15]=d,e[16]=m,e[17]=u):u=e[17],u}function Qo(n,e,s,i){return[n,e,s,i.type,i.member,i.currentUserId??""].join("|")}function Xo(n){return n.member==="mine"&&!n.currentUserId}const gn=4;let nt=0;const yt=[];function Yo(){for(;nt<gn&&yt.length>0;){const n=yt.shift();n&&n()}}function hn(n){return new Promise((e,s)=>{const i=()=>{nt++,n().then(e,s).finally(()=>{nt--,Yo()})};nt<gn?i():yt.push(i)})}const mt=10;function Et(n,e,s,i,r){const o={hidden:!1};i.member==="mine"&&i.currentUserId&&(o.created_by=i.currentUserId),i.type==="automation"&&(o.has_trigger=!0),i.type==="manual"&&(o.has_trigger=!1);const a={where:o,limit:r,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function Jo(n,e,s,i){let r=0;for(const o of n)pn(o,e,s,i)&&r++;return r}function jt(n,e,s,i){return Jo(n,e,s,i)}function Zo(n,e){return!!(n>=mt||n===0&&e)}function Rt(n,e){return n<e}function ei(n,e){return e===!1?!1:e===!0?!0:n}function pn(n,e,s,i){return!(n.hidden||(n.status??"completed")!==s||i.member==="mine"&&i.currentUserId&&n.created_by!==i.currentUserId||i.type==="automation"&&!n.trigger_id||i.type==="manual"&&n.trigger_id)}const it=new Map,et=new Map;function ti(n,e){return e?n>=mt?!0:null:!1}function Gt(n){return it.get(n)}function ni(n,e){it.set(n,e)}function si(n,e,s){const i=it.get(n);if(i!==void 0){s(i);return}let r=et.get(n);r||(r=hn(e).then(o=>(it.set(n,o),et.delete(n),o)).catch(()=>(et.delete(n),Promise.reject(new Error("group probe failed")))),et.set(n,r)),r.then(s,()=>s(!1))}function Ht(n){const e=n,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===mt,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function oi(n,e,s,i,r){let o=0;for(const a of n)e.has(a.id)||pn(a,s,i,r)&&o++;return o}function ii(n,e,s,i){const r=$.c(8),{org:o}=le(),a=Qo(o.id,n,e,s);let l;r[0]!==s?(l=Xo(s),r[0]=s,r[1]=l):l=r[1];const c=l,[d,f]=V.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==a&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const m=Yn(),{threads:u,hasMore:p}=dt(),y=jt(u,n,e,s),x=Zo(y,p),g=ti(y,p),h=ft();if(d.identity===a&&d.serverHasMore===null){const M=g??Gt(a);M!==void 0&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:M})}!c&&d.identity===a&&d.serverHasMore===null&&g===null&&Gt(a)===void 0&&d.probeSubscribedIdentity!==a&&(f(M=>M.identity===a?{...M,isProbing:!0,probeSubscribedIdentity:a}:M),si(a,async()=>{const M=Et(n,e,0,s,1),b=await h.call("COLLECTION_THREADS_LIST",M),{totalCount:N}=Ht(b),A=jt(m.threads.get(),n,e,s);return N===void 0?!1:Rt(A,N)},M=>{f(b=>b.identity!==a?b:{...b,isProbing:!1,serverHasMore:M})}));const j=async function(){if(d.isFetching||d.isProbing||c)return;const b=a;f(N=>N.identity===b?{...N,isFetching:!0}:N);try{const N=jt(u,n,e,s),A=Et(n,e,N,s,mt),S=await hn(()=>h.call("COLLECTION_THREADS_LIST",A)),{items:_,hasMore:T,totalCount:P}=Ht(S),D=new Set(u.map(ri)),F=oi(_,D,n,e,s),L=N;m.mergeThreads(_),f(O=>{if(O.identity!==b)return O;let z;return P!==void 0?z=Rt(L+F,P):z=_.length===0||F===0?!1:T,ni(b,z),{...O,isFetching:!1,serverHasMore:z}})}catch(N){const A=N,S=A instanceof Error?A.message:String(A);X.error(`Could not load more tasks: ${S}`),f(_=>_.identity===b?{..._,isFetching:!1}:_)}},C=d.isFetching||d.isProbing,w=!c&&!C&&ei(x,d.serverHasMore);let I;return r[2]!==C||r[3]!==j||r[4]!==w||r[5]!==d.isProbing||r[6]!==d.serverHasMore?(I={hasMore:w,isFetching:C,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:j},r[2]=C,r[3]=j,r[4]=w,r[5]=d.isProbing,r[6]=d.serverHasMore,r[7]=I):I=r[7],I}function ri(n){return n.id}function ai(n){const e=$.c(20),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,{isFetching:d,isProbing:f,loadMore:m,hasMore:u,serverHasMore:p}=ii("status",s,c),[y,x]=V.useState(!1);!y&&i.length===0&&p===!0&&!d&&!f&&(x(!0),queueMicrotask(()=>{m()}));let g;if(e[0]!==r||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==o||e[5]!==i){let j;e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==o?(j=C=>t.jsx(fn,{task:C,isActive:r===C.id,onClick:()=>o(C),onArchive:l&&C.created_by===c.currentUserId?()=>a(C):void 0,showAutomationBadge:!!C.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},C.id),e[7]=r,e[8]=l,e[9]=c,e[10]=a,e[11]=o,e[12]=j):j=e[12],g=i.map(j),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=o,e[5]=i,e[6]=g}else g=e[6];let h;e[13]!==u||e[14]!==d||e[15]!==m?(h=(u||d)&&t.jsx(mn,{onClick:()=>{m()},isFetching:d,indented:!0}),e[13]=u,e[14]=d,e[15]=m,e[16]=h):h=e[16];let v;return e[17]!==g||e[18]!==h?(v=t.jsxs(t.Fragment,{children:[g,h]}),e[17]=g,e[18]=h,e[19]=v):v=e[19],v}function li(n){const e=$.c(36),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,d=Ks[s],f=d.icon,[m,u]=Wo(`status-${s}`,!1);let p;e[0]!==m||e[1]!==u?(p=function(){u(!m)},e[0]=m,e[1]=u,e[2]=p):p=e[2];const y=p;let x;e[3]!==y?(x=b=>{b.target===b.currentTarget&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),y())},e[3]=y,e[4]=x):x=e[4];let g;e[5]!==f||e[6]!==d.iconClassName?(g=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:t.jsx(f,{size:12,className:d.iconClassName})}),e[5]=f,e[6]=d.iconClassName,e[7]=g):g=e[7];let h;e[8]!==m?(h=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:m?t.jsx(_t,{size:14}):t.jsx(Vt,{size:14})}),e[8]=m,e[9]=h):h=e[9];let v;e[10]!==g||e[11]!==h?(v=t.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[g,h]}),e[10]=g,e[11]=h,e[12]=v):v=e[12];let j;e[13]!==d.label?(j=t.jsx("span",{className:"flex-1 truncate",children:d.label}),e[13]=d.label,e[14]=j):j=e[14];let C;e[15]!==i.length?(C=t.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:i.length})}),e[15]=i.length,e[16]=C):C=e[16];let w;e[17]!==m||e[18]!==y||e[19]!==x||e[20]!==v||e[21]!==j||e[22]!==C?(w=t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":m,onClick:y,onKeyDown:x,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[v,j,C]}),e[17]=m,e[18]=y,e[19]=x,e[20]=v,e[21]=j,e[22]=C,e[23]=w):w=e[23];let I;e[24]!==r||e[25]!==l||e[26]!==m||e[27]!==c||e[28]!==a||e[29]!==o||e[30]!==s||e[31]!==i?(I=m&&t.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:t.jsx(ai,{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c})}),e[24]=r,e[25]=l,e[26]=m,e[27]=c,e[28]=a,e[29]=o,e[30]=s,e[31]=i,e[32]=I):I=e[32];let M;return e[33]!==w||e[34]!==I?(M=t.jsxs("div",{className:"flex flex-col gap-0.5",children:[w,I]}),e[33]=w,e[34]=I,e[35]=M):M=e[35],M}function ci(n){const e=$.c(38),{threads:s,groupBy:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,filters:l,hasMore:c,isFetchingMore:d,onLoadMore:f,filtersActive:m}=n;if(s.length===0&&!c&&!d){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Vs,{className:"size-6 opacity-60"}),e[0]=g):g=e[0];const h=m?"No chats match your filters":"No chats yet";let v;return e[1]!==h?(v=t.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[g,t.jsx("p",{className:"text-sm",children:h})]}),e[1]=h,e[2]=v):v=e[2],v}const u=s.length>1||c;if(i==="status"){let g;if(e[3]!==r||e[4]!==u||e[5]!==l||e[6]!==a||e[7]!==o||e[8]!==s){let v;e[10]!==r||e[11]!==u||e[12]!==l||e[13]!==a||e[14]!==o?(v=j=>t.jsx(li,{status:j.status,threads:j.threads,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:u,filters:l},j.status),e[10]=r,e[11]=u,e[12]=l,e[13]=a,e[14]=o,e[15]=v):v=e[15],g=qo(s).map(v),e[3]=r,e[4]=u,e[5]=l,e[6]=a,e[7]=o,e[8]=s,e[9]=g}else g=e[9];let h;return e[16]!==g?(h=t.jsx(t.Fragment,{children:g}),e[16]=g,e[17]=h):h=e[17],h}let p;if(e[18]!==r||e[19]!==u||e[20]!==l||e[21]!==a||e[22]!==o||e[23]!==s){let g;e[25]!==r||e[26]!==u||e[27]!==l||e[28]!==a||e[29]!==o?(g=h=>t.jsx(fn,{task:h,isActive:r===h.id,onClick:()=>o(h),onArchive:u&&h.created_by===l.currentUserId?()=>a(h):void 0,showAutomationBadge:!!h.trigger_id,showAgentIcon:!0},h.id),e[25]=r,e[26]=u,e[27]=l,e[28]=a,e[29]=o,e[30]=g):g=e[30],p=s.map(g),e[18]=r,e[19]=u,e[20]=l,e[21]=a,e[22]=o,e[23]=s,e[24]=p}else p=e[24];let y;e[31]!==c||e[32]!==d||e[33]!==f?(y=(c||d)&&t.jsx(mn,{onClick:f,isFetching:d}),e[31]=c,e[32]=d,e[33]=f,e[34]=y):y=e[34];let x;return e[35]!==p||e[36]!==y?(x=t.jsxs(t.Fragment,{children:[p,y]}),e[35]=p,e[36]=y,e[37]=x):x=e[37],x}function di(n,e){return null}function ui(n,e){return n.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const fi=["archive","reclaim-worktree"],mi=[];function gi(n){return n==="confirm"?fi:mi}function Tr(n){const e=$.c(11),{panel:s}=n;let i;return e[0]!==s.activeTaskId||e[1]!==s.archiveTask||e[2]!==s.filters||e[3]!==s.filtersActive||e[4]!==s.groupBy||e[5]!==s.hasMore||e[6]!==s.isFetchingMore||e[7]!==s.loadMore||e[8]!==s.selectTask||e[9]!==s.threads?(i=t.jsx(ci,{threads:s.threads,groupBy:s.groupBy,activeTaskId:s.activeTaskId,onSelectTask:s.selectTask,onArchiveTask:s.archiveTask,filters:s.filters,hasMore:s.hasMore,isFetchingMore:s.isFetchingMore,onLoadMore:s.loadMore,filtersActive:s.filtersActive}),e[0]=s.activeTaskId,e[1]=s.archiveTask,e[2]=s.filters,e[3]=s.filtersActive,e[4]=s.groupBy,e[5]=s.hasMore,e[6]=s.isFetchingMore,e[7]=s.loadMore,e[8]=s.selectTask,e[9]=s.threads,e[10]=i):i=e[10],i}function Mr(n){const e=$.c(82);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,r=G(),{data:o}=Te.useSession(),a=o?.user?.id,{org:l}=le();let c;e[2]!==l.id?(c=ct(l.id),e[2]=l.id,e[3]=c):c=e[3];const d=c.id,{threads:f,hasMore:m,isFetchingMore:u,fetchNextPage:p}=dt(),y=f.filter(vi),{hide:x,setScope:g}=nn(),h=rt(),v=ft(),{setTaskId:j,createNewTask:C}=ut();let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w={strict:!1},e[4]=w):w=e[4];const I=at(w);let M;e[5]===Symbol.for("react.memo_cache_sentinel")?(M={strict:!1},e[5]=M):M=e[5];const b=lt(M),N=I.taskId??null;let A;e[6]!==N||e[7]!==f||e[8]!==b.virtualmcpid?(A=b.virtualmcpid??f.find(k=>k.id===N)?.virtual_mcp_id??null,e[6]=N,e[7]=f,e[8]=b.virtualmcpid,e[9]=A):A=e[9];const S=A;let _;e[10]!==i?(_=()=>{i?.()},e[10]=i,e[11]=_):_=e[11];const T=_,P=[...y].sort(xi),[D,F]=V.useState("all"),[L,O]=V.useState("flat"),[z,U]=Ct("sidebar-threads-scope-all",!1),[R,q]=V.useState(!1),[E,Y]=V.useState(!1);let ee;e[12]!==q?(ee=()=>{K("tasks_panel_search_opened"),Y(!0),q(!0)},e[12]=q,e[13]=ee):ee=e[13];const te=ee,[H,J]=V.useState(null),ne=a??null;let W;e[14]!==ne||e[15]!==D?(W={type:D,member:"mine",currentUserId:ne},e[14]=ne,e[15]=D,e[16]=W):W=e[16];const Ne=W,Be={};z||(Be.created_by="me"),g(Be);let Ce;e[17]!==a?(Ce=k=>a?k.filter(B=>B.created_by===a):[],e[17]=a,e[18]=Ce):Ce=e[18];const Ee=Ce;let _e;e[19]!==D?(_e=k=>D==="automation"?k.filter(pi):D==="manual"?k.filter(hi):k,e[19]=D,e[20]=_e):_e=e[20];const We=_e,se=We(z?P:Ee(P));let Se;e[21]!==N||e[22]!==T||e[23]!==a||e[24]!==x||e[25]!==h||e[26]!==l.slug||e[27]!==j||e[28]!==se?(Se=k=>{const B=k.id===N,Z=x(k.id);if(os(k.id),!B)return Z;const ue=Vo(se,k.id,a);return T(),ue?j(ue.id,ue.virtual_mcp_id):h({to:"/$org",params:{org:l.slug}}),Z},e[21]=N,e[22]=T,e[23]=a,e[24]=x,e[25]=h,e[26]=l.slug,e[27]=j,e[28]=se,e[29]=Se):Se=e[29];const oe=Se;let Re;e[30]!==v||e[31]!==r?(Re=async k=>{try{await v.call("SANDBOX_DELETE",{virtualMcpId:k.virtualMcpId,branch:k.branch,sandboxProviderKind:"user-desktop",removeWorktree:!0})}catch{X.error(r("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:k.branch}))}},e[30]=v,e[31]=r,e[32]=Re):Re=e[32];const ke=Re;let Ie;e[33]!==f||e[34]!==oe||e[35]!==a||e[36]!==J?(Ie=k=>{if(a&&k.created_by&&k.created_by!==a)return;const B=di();if(!B||ui(f,B)){oe(k);return}J({task:k,target:B})},e[33]=f,e[34]=oe,e[35]=a,e[36]=J,e[37]=Ie):Ie=e[37];const fe=Ie;let de;e[38]!==oe||e[39]!==H||e[40]!==ke||e[41]!==J?(de=k=>{const B=H;B&&(J(null),(async()=>{for(const Z of gi(k))if(Z==="archive")try{await oe(B.task)}catch{return}else await ke(B.target)})())},e[38]=oe,e[39]=H,e[40]=ke,e[41]=J,e[42]=de):de=e[42];const Fe=de;let De;e[43]!==T||e[44]!==j?(De=k=>{T(),j(k.id,k.virtual_mcp_id)},e[43]=T,e[44]=j,e[45]=De):De=e[45];const $e=De;let Ae;e[46]!==S||e[47]!==N||e[48]!==f||e[49]!==T||e[50]!==C||e[51]!==d?(Ae=()=>{const k=S??d,B=f.find(Z=>Z.id===N)?.branch??null;K("sidebar_new_thread_clicked",{virtual_mcp_id:k}),T(),C(k,B)},e[46]=S,e[47]=N,e[48]=f,e[49]=T,e[50]=C,e[51]=d,e[52]=Ae):Ae=e[52];const me=Ae;let ie;e[53]!==p?(ie=()=>{p()},e[53]=p,e[54]=ie):ie=e[54];const ge=L!=="flat"||D!=="all"||z;let re;e[55]!==Fe||e[56]!==H?(re=H?t.jsx(Ho,{branch:H.target.branch,onOutcome:Fe}):null,e[55]=Fe,e[56]=H,e[57]=re):re=e[57];let ae;e[58]!==E||e[59]!==R||e[60]!==q?(ae=E?t.jsx(Go,{open:R,onOpenChange:q}):null,e[58]=E,e[59]=R,e[60]=q,e[61]=ae):ae=e[61];let we;return e[62]!==N||e[63]!==fe||e[64]!==Ne||e[65]!==L||e[66]!==m||e[67]!==u||e[68]!==me||e[69]!==te||e[70]!==$e||e[71]!==O||e[72]!==U||e[73]!==F||e[74]!==z||e[75]!==ie||e[76]!==ge||e[77]!==re||e[78]!==ae||e[79]!==D||e[80]!==se?(we={threads:se,activeTaskId:N,filters:Ne,hasMore:m,isFetchingMore:u,loadMore:ie,groupBy:L,setGroupBy:O,typeFilter:D,setTypeFilter:F,showAll:z,setShowAll:U,filtersActive:ge,selectTask:$e,archiveTask:fe,newThread:me,openSearch:te,reclaimDialog:re,searchDialog:ae},e[62]=N,e[63]=fe,e[64]=Ne,e[65]=L,e[66]=m,e[67]=u,e[68]=me,e[69]=te,e[70]=$e,e[71]=O,e[72]=U,e[73]=F,e[74]=z,e[75]=ie,e[76]=ge,e[77]=re,e[78]=ae,e[79]=D,e[80]=se,e[81]=we):we=e[81],we}function hi(n){return!n.trigger_id}function pi(n){return!!n.trigger_id}function xi(n,e){return(e.updated_at??"").localeCompare(n.updated_at??"")}function vi(n){return!n.hidden}function bi(n){return n?n.run_in_progress?"generating":n.scanned_at?"ready":"none":"none"}const ji=2e4;function yi(n){if(typeof n!="string"||!n)return null;try{return new URL(n).hostname||null}catch{return null}}function Pr(){const n=$.c(17),{org:e}=le(),s=Bn.COMMERCE_DISCOVERY(e.id);let i;n[0]!==e.id||n[1]!==e.slug?(i=Pt({connectionId:Wt,orgId:e.id,orgSlug:e.slug}),n[0]=e.id,n[1]=e.slug,n[2]=i):i=n[2];const{data:r}=He(i),a=He({queryKey:Ue.commerceDiscoveryConnection(e.id,s),enabled:!!r,retry:!1,staleTime:6e4,queryFn:async()=>{if(!r)throw new Error("selfClient not ready");const j=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}});return Ot(j)}}).data?.item??null,{data:l}=He({...Pt({connectionId:s,orgId:e.id,orgSlug:e.slug}),enabled:!!a}),c=Ue.commerceDiscoveryDiagnostic(e.id,s),d=!!l;let f;n[3]!==l?(f=async()=>{if(!l)throw new Error("cdClient not ready");const j=await l.callTool({name:Qt,arguments:{}});return Ot(j).diagnostic??null},n[3]=l,n[4]=f):f=n[4];let m;n[5]!==c||n[6]!==d||n[7]!==f?(m={queryKey:c,enabled:d,retry:1,refetchInterval:Ci,queryFn:f},n[5]=c,n[6]=d,n[7]=f,n[8]=m):m=n[8];const u=He(m),p=u.data??null,y=u.isSuccess,x=a?.metadata?.siteUrl;let g;n[9]!==x?(g=yi(x),n[9]=x,n[10]=g):g=n[10];const h=l??null;let v;return n[11]!==s||n[12]!==u.isSuccess||n[13]!==p||n[14]!==g||n[15]!==h?(v={diagnostic:p,isSuccess:y,host:g,connectionId:s,cdClient:h},n[11]=s,n[12]=u.isSuccess,n[13]=p,n[14]=g,n[15]=h,n[16]=v):v=n[16],v}function Ci(n){return n.state.status!=="error"&&bi(n.state.data)==="generating"?ji:!1}function Or(n,e){return{to:"/$org/$taskId",params:{org:n.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:En(n.id),main:Qs(e,Qt)}}}export{Sr as A,_r as C,kr as N,Nr as O,Ar as T,wr as a,Ir as b,Mr as c,so as d,Mt as e,Tr as f,Pr as g,bi as h,Or as i,Dr as u};
1
+ import{c as $,b as G,j as t,y as xn,B as ye,r as V,aS as vn,d as rt,s as bn,m as Q,a as Te,t as X,w as jn,k as Ve,p as K,F as le,f as at,u as lt,L as yn,D as Cn,$ as _n,a0 as wn,I as Ct,G as Nn,K as Ue,o as Sn,n as He,aQ as kn,av as In}from"./index-BphIXXOp.js";import{i as Vt}from"./ChevronRight-wqbYwiLF.js";import{i as Dn}from"./X-Bfx6rO6W.js";import{aK as An,T as Tn,A as qe,f as Mn,s as gt,aC as Pn,aL as On,aM as Fn}from"./agent-icon-BnyLUh_P.js";import{t as _t}from"./ChevronDown-BOc1-i9L.js";import{T as Me,a as Pe,c as Oe}from"./tooltip-BfkRKScU.js";import{u as Ut,d as qt,c as Kt}from"./sidebar-Dckv7Gxe.js";import{a as ct,i as $n,f as zn,S as Wt,u as Ln,W as Bn,m as Pt,C as Qt,g as En}from"./use-mcp-client-DKcZ7v-W.js";import{u as Rn,a as wt}from"./use-virtual-mcp-IokMTZJW.js";import{a as Xe,b as Nt,P as St}from"./popover-BV2Ziop4.js";import{i as st}from"./Check-BdzjeMXF.js";import{s as Ke}from"./Plus-CgXuzVCT.js";import{i as Xt}from"./SearchMd-BOeEZKFu.js";import{s as Yt}from"./XClose-DdXn46Em.js";import{C as Gn,d as Ot}from"./self-tool-result-DA97K7F2.js";import{T as kt}from"./toolbar-Q0b8veSU.js";import{S as Hn}from"./skeleton-C_J-aMdg.js";import{D as Jt,a as Zt,b as en,c as Vn,g as Un,e as qn,f as Kn}from"./drawer-HtUPoolZ.js";import{u as tn}from"./use-mobile-C0XoguQx.js";import{a as Wn,G as Qn}from"./github-repo-picker-DjVb6-0i.js";import{g as Xn,a as nn,u as dt,c as Yn}from"./hooks-Cd2G3711.js";import{u as Jn,g as Zn,a as es,b as ts}from"./use-navigate-to-agent-Cxg9_mL_.js";import{b as ns,a as sn,g as ss}from"./agent-capabilities-C4tLW0Za.js";import{u as ut,f as os}from"./shell-layout-DIvwZhUJ.js";import{f as is}from"./reusable-new-chat-CouMjkYR.js";import{C as rs}from"./collection-search-H6c7ia6t.js";import{g as as,a as ls,b as cs,e as ds}from"./extract-connection-data-V948FMyj.js";import{u as on,a as rn,g as us,C as ht}from"./connection-card-DSX5zHxO.js";import{e as It,d as Dt,a as At,b as Tt,h as an,c as fs}from"./dialog-C2XtKj4W.js";import{d as pe,a as xe,e as ve,b as be,c as je,F as Ft}from"./form-CMuk1nXb.js";import{I as Le}from"./input-9TNY2G6W.js";import{S as ms,a as gs,b as hs,c as ps,d as Qe}from"./select-COjQ5V-V.js";import{T as xs}from"./textarea-CosQp1Ex.js";import{b as ln}from"./use-connection-B5TzA1Ut.js";import{n as tt,i as pt}from"./Tool02-B8GwG_SX.js";import{c as vs,i as Je,a as $t,E as bs,p as js,b as ys,d as Cs}from"./connection-form-helpers-B07wLptq.js";import{a as xt}from"./authenticate-and-persist-oauth-CqRX86RU.js";import{g as _s}from"./connection-slug-eyAPH6o3.js";import{C as ws}from"./collection-tabs-BqnoVI6Y.js";import{u as zt}from"./use-infinite-scroll-A-tTatQb.js";import{B as Ze}from"./badge-D24p8Xxi.js";import{u as Ns}from"./useSuspenseInfiniteQuery-BvX-6eAF.js";import{g as ot}from"./metadata-dUsYcpuu.js";import{u as ft}from"./studio-tools-BoD8kcA1.js";import{u as Ss}from"./use-ai-providers-BezO2qdd.js";import{i as ks}from"./FilterLines-C9pmu5SZ.js";import{a as Is,T as Ds}from"./toggle-group-5LW11eFN.js";import{d as As,a as Ts,c as Ms,b as Ps,C as Os,e as Fs}from"./command-DhvOaMnH.js";import{i as cn}from"./Zap-li0rR-RI.js";import{c as $s,d as zs,b as Ls,f as Bs,g as Es,e as Rs,a as Gs,A as Hs}from"./alert-dialog-Cqq7FgQj.js";import{n as Vs}from"./Stars02-CH68Qhm_.js";import{g as Us,u as qs,S as Ks}from"./use-clock-tick-BlWbr6nY.js";import{a as Ws}from"./format-time-BnbuEtat.js";import{f as Qs}from"./tab-id-BJUTVZdl.js";const Xs="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Ys(){const n=$.c(13),e=G();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("img",{src:"/logos/summit/monte-carlo.svg",alt:"Monte Carlo",className:"h-14 w-[112px] shrink-0 self-start object-contain object-left brightness-0 invert"}),n[0]=s):s=n[0];let i;n[1]!==e?(i=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=i):i=n[2];let r;n[3]!==i?(r=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",i,"”"]}),n[3]=i,n[4]=r):r=n[4];let o;n[5]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("img",{src:Xs,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=o):o=n[5];let a;n[6]!==e?(a=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=a):a=n[7];let l;n[8]!==a?(l=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[o,t.jsx("span",{className:"text-base font-medium",children:a})]}),n[8]=a,n[9]=l):l=n[9];let c;return n[10]!==r||n[11]!==l?(c=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,r,l]}),n[10]=r,n[11]=l,n[12]=c):c=n[12],c}function Js(){const n=$.c(19),e=G();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let i;n[2]!==s?(i={Icon:An,label:s},n[2]=s,n[3]=i):i=n[3];let r;n[4]!==e?(r=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=r):r=n[5];let o;n[6]!==r?(o={Icon:xn,label:r},n[6]=r,n[7]=o):o=n[7];let a;n[8]!==e?(a=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=a):a=n[9];let l;n[10]!==a?(l={Icon:Tn,label:a},n[10]=a,n[11]=l):l=n[11];let c;n[12]!==i||n[13]!==o||n[14]!==l?(c=[i,o,l],n[12]=i,n[13]=o,n[14]=l,n[15]=c):c=n[15];const d=c;let f;n[16]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=f):f=n[16];let m;return n[17]!==d?(m=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[f,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:d.map(Zs)})]}),n[17]=d,n[18]=m):m=n[18],m}function Zs(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 _r(n){const e=$.c(22),{siteHost:s,footer:i,onClose:r,children:o}=n,a=G(),l=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let c;e[0]!==r||e[1]!==a?(c=r&&t.jsx("button",{type:"button",onClick:r,"aria-label":a("routes.commerceOnboarding.connectModal.close"),className:"absolute right-3 top-3 z-10 flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-black/10 hover:text-foreground lg:text-white/80 lg:hover:bg-white/15 lg:hover:text-white",children:t.jsx(Dn,{size:18})}),e[0]=r,e[1]=a,e[2]=c):c=e[2];let d,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),f=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=d,e[4]=f):(d=e[3],f=e[4]);let m;e[5]!==l||e[6]!==s?(m=s&&t.jsxs(t.Fragment,{children:[t.jsx(Vt,{size:16,className:"shrink-0 text-foreground/25"}),l&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:l,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=l,e[6]=s,e[7]=m):m=e[7];let u;e[8]!==m?(u=t.jsxs("div",{className:"flex items-center gap-2",children:[d,f,m]}),e[8]=m,e[9]=u):u=e[9];let p;e[10]!==i?(p=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:i}),e[10]=i,e[11]=p):p=e[11];let y;e[12]!==o||e[13]!==u||e[14]!==p?(y=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[u,o,p]}),e[12]=o,e[13]=u,e[14]=p,e[15]=y):y=e[15];let x,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=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]=x,e[17]=g):(x=e[16],g=e[17]);let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[x,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Ys,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Js,{})]})]}),e[18]=h):h=e[18];let v;return e[19]!==c||e[20]!==y?(v=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[c,y,h]}),e[19]=c,e[20]=y,e[21]=v):v=e[21],v}function wr(n){const e=$.c(5),{ready:s,pending:i,label:r,onClick:o,children:a}=n,l=i||!s,c=s&&!i?a:null;let d;return e[0]!==r||e[1]!==o||e[2]!==l||e[3]!==c?(d=t.jsxs(ye,{type:"button",size:"lg",className:"h-auto min-h-12 w-full whitespace-normal rounded-lg py-3 text-center text-base font-medium leading-tight",onClick:o,disabled:l,children:[r,c]}),e[0]=r,e[1]=o,e[2]=l,e[3]=c,e[4]=d):d=e[4],d}function dn(){const n=V.useContext(vn),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(r=>r.status==="pending"&&new Date(r.expiresAt)>new Date),refetch:()=>s?.()}}function eo(n){let e=0;for(let i=0;i<n.length;i++)e=n.charCodeAt(i)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function Mt(n){const e=$.c(13),{org:s,size:i}=n,r=i===void 0?"sm":i,o=r==="xs"?"size-5":"size-6",a=r==="xs"?"text-[9px]":"text-xs";let l;e[0]!==o?(l=Q(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:eo(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.logo||e[6]!==s.name||e[7]!==a?(d=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:Q("font-semibold leading-none",a),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=a,e[8]=d):d=e[8];let f;return e[9]!==l||e[10]!==c||e[11]!==d?(f=t.jsx("div",{className:l,style:c,children:d}),e[9]=l,e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function to({invitation:n,onChanged:e}){const s=G(),[i,r]=V.useState(!1),o=n.organizationName??s("header.orgSwitcher.unknownOrganization"),a=async()=>{r(!0);try{const d=await Te.organization.acceptInvitation({invitationId:n.id});if(d.error){X.error(d.error.message),r(!1);return}}catch{X.error(s("header.orgSwitcher.failedToAcceptInvitation")),r(!1);return}X.success(s("header.orgSwitcher.joined",{name:o})),jn();let c;try{c=(await Te.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},l=async()=>{r(!0);try{const c=await Te.organization.rejectInvitation({invitationId:n.id});if(c.error){X.error(c.error.message),r(!1);return}X.success(s("header.orgSwitcher.invitationDeclined")),r(!1),e()}catch{X.error(s("header.orgSwitcher.failedToDeclineInvitation")),r(!1)}};return t.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[t.jsx(Mt,{org:{name:o},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:o}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx(ye,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:a,disabled:i,children:s("header.orgSwitcher.accept")}),t.jsx(ye,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:l,disabled:i,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:o}),children:t.jsx(Yt,{size:14})})]})]})}function no(n){const e=$.c(32),{orgParam:s,onSelectOrg:i,onCreateOrg:r}=n,o=G(),{data:a}=bn(),{invitations:l,refetch:c}=dn();let d;e[0]!==s?(d=(P,D)=>P.slug===s?-1:D.slug===s?1:P.name.localeCompare(D.name),e[0]=s,e[1]=d):d=e[1];const f=[...a??[]].sort(d),[m,u]=V.useState(""),p=m.toLowerCase(),y=p?f.filter(P=>P.name.toLowerCase().includes(p)||P.slug.toLowerCase().includes(p)):f;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(Xt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=x):x=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=P=>u(P.target.value),e[3]=g):g=e[3];let h;e[4]!==m?(h=P=>P.key==="Escape"&&m&&u(""),e[4]=m,e[5]=h):h=e[5];let v;e[6]!==o?(v=o("header.orgSwitcher.searchOrganizations"),e[6]=o,e[7]=v):v=e[7];let j;e[8]!==m||e[9]!==h||e[10]!==v?(j=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:m,onChange:g,onKeyDown:h,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=m,e[9]=h,e[10]=v,e[11]=j):j=e[11];let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ke,{size:16}),e[12]=C):C=e[12];let w;e[13]!==r?(w=t.jsx("button",{type:"button",onClick:r,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:C}),e[13]=r,e[14]=w):w=e[14];let I;e[15]!==j||e[16]!==w?(I=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[x,j,w]}),e[15]=j,e[16]=w,e[17]=I):I=e[17];const M="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let b;e[18]!==l||e[19]!==m||e[20]!==c?(b=!m&&l.map(P=>t.jsx(to,{invitation:P,onChanged:c},P.id)),e[18]=l,e[19]=m,e[20]=c,e[21]=b):b=e[21];const N=y.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:m?o("header.orgSwitcher.noOrganizationsMatch",{query:m}):o("header.orgSwitcher.noOrganizationsAvailable")});let A;e[22]!==i||e[23]!==s?(A=P=>t.jsxs("button",{type:"button",onClick:()=>i(P.slug),className:Q("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",P.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(Mt,{org:P,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:P.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:P.slug})]}),P.slug===s&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},P.id),e[22]=i,e[23]=s,e[24]=A):A=e[24];const S=y.map(A);let _;e[25]!==b||e[26]!==N||e[27]!==S?(_=t.jsxs("div",{className:M,children:[b,N,S]}),e[25]=b,e[26]=N,e[27]=S,e[28]=_):_=e[28];let T;return e[29]!==_||e[30]!==I?(T=t.jsxs(t.Fragment,{children:[I,_]}),e[29]=_,e[30]=I,e[31]=T):T=e[31],T}function so(n){const e=$.c(22),{trigger:s,orgParam:i,align:r,side:o}=n,a=r===void 0?"start":r,l=o===void 0?"bottom":o,c=rt(),[d,f]=V.useState(!1),[m,u]=V.useState(!1);let p;e[0]!==s?(p=t.jsx(Xe,{asChild:!0,children:s}),e[0]=s,e[1]=p):p=e[1];const y=String(d);let x;e[2]!==c?(x=I=>{f(!1),c({to:"/$org",params:{org:I}})},e[2]=c,e[3]=x):x=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{f(!1),u(!0)},e[4]=g):g=e[4];let h;e[5]!==i||e[6]!==y||e[7]!==x?(h=t.jsx(no,{orgParam:i,onSelectOrg:x,onCreateOrg:g},y),e[5]=i,e[6]=y,e[7]=x,e[8]=h):h=e[8];let v;e[9]!==a||e[10]!==l||e[11]!==h?(v=t.jsx(Nt,{side:l,align:a,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:io,onCloseAutoFocus:oo,children:h}),e[9]=a,e[10]=l,e[11]=h,e[12]=v):v=e[12];let j;e[13]!==d||e[14]!==p||e[15]!==v?(j=t.jsxs(St,{open:d,onOpenChange:f,children:[p,v]}),e[13]=d,e[14]=p,e[15]=v,e[16]=j):j=e[16];let C;e[17]!==m?(C=t.jsx(Gn,{open:m,onOpenChange:u}),e[17]=m,e[18]=C):C=e[18];let w;return e[19]!==C||e[20]!==j?(w=t.jsxs(t.Fragment,{children:[j,C]}),e[19]=C,e[20]=j,e[21]=w):w=e[21],w}function oo(n){return n.preventDefault()}function io(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ro(n){const e=$.c(21),{value:s,onChange:i,placeholder:r,onKeyDown:o,className:a,isSearching:l,disabled:c}=n,d=r===void 0?"Search...":r;let f;e[0]!==a?(f=Q("shrink-0 w-full border-b border-border h-12",a),e[0]=a,e[1]=f):f=e[1];const m=c?"cursor-not-allowed opacity-50":"cursor-text";let u;e[2]!==m?(u=Q("flex items-center gap-2.5 h-12 px-4",m),e[2]=m,e[3]=u):u=e[3];let p;e[4]!==l?(p=l?t.jsx(Ve,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Xt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=l,e[5]=p):p=e[5];let y;e[6]!==i?(y=v=>i(v.target.value),e[6]=i,e[7]=y):y=e[7];let x;e[8]!==c||e[9]!==o||e[10]!==d||e[11]!==y||e[12]!==s?(x=t.jsx("input",{type:"text",value:s,onChange:y,onKeyDown:o,placeholder:d,disabled:c,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=c,e[9]=o,e[10]=d,e[11]=y,e[12]=s,e[13]=x):x=e[13];let g;e[14]!==u||e[15]!==p||e[16]!==x?(g=t.jsxs("label",{className:u,children:[p,x]}),e[14]=u,e[15]=p,e[16]=x,e[17]=g):g=e[17];let h;return e[18]!==f||e[19]!==g?(h=t.jsx("div",{className:f,children:g}),e[18]=f,e[19]=g,e[20]=h):h=e[20],h}function ao(n,e,s){if(!s)return null;const i=Xn(n,e);return i?i.threads.get().find(o=>o.id===s)?.branch??null:null}function lo(n){const e=$.c(6),{value:s,onChange:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.searchAgents"),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==i||e[3]!==o||e[4]!==s?(a=t.jsx(ro,{value:s,onChange:i,placeholder:o}),e[2]=i,e[3]=o,e[4]=s,e[5]=a):a=e[5],a}function co(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=i):i=n[3],i}function uo(n){const e=$.c(10),{org:s,onClose:i}=n,r=G();let o;e[0]!==s.slug?(o={org:s.slug},e[0]=s.slug,e[1]=o):o=e[1];let a;e[2]!==i?(a=()=>i(),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r("sidebar.agentsSection.seeAllAgents"),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==a||e[8]!==l?(c=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(yn,{to:"/$org/settings/agents",params:o,onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:l})}),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}function fo(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(un,{children:s}),n[2]=s,n[3]=i):i=n[3],i}function mo(n){const e=$.c(11),{onImportFromGithub:s}=n,i=G();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qn,{className:"size-3.5"}),e[0]=r):r=e[0];let o;e[1]!==i?(o=i("sidebar.agentsSection.import"),e[1]=i,e[2]=o):o=e[2];let a;e[3]!==s||e[4]!==o?(a=t.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[r,o]}),e[3]=s,e[4]=o,e[5]=a):a=e[5];let l;e[6]!==i?(l=i("sidebar.agentsSection.codeAgents"),e[6]=i,e[7]=l):l=e[7];let c;return e[8]!==a||e[9]!==l?(c=t.jsx(un,{action:a,children:l}),e[8]=a,e[9]=l,e[10]=c):c=e[10],c}function go(n){const e=$.c(11),{setOpen:s,emptyCtaClass:i}=n,r=G();let o;e[0]!==r?(o=r("sidebar.agentsSection.browseAgents"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i?(a=Q(i),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==s?(l=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=l):l=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{className:"size-4"}),e[6]=c):c=e[6];let d;return e[7]!==o||e[8]!==a||e[9]!==l?(d=t.jsx(kt,{"aria-label":o,className:a,onClick:l,children:c}),e[7]=o,e[8]=a,e[9]=l,e[10]=d):d=e[10],d}function ho(n){const e=$.c(17),{setOpen:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=Q(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]!==s?(c=()=>{K("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ke,{}),e[7]=d):d=e[7];let f;e[8]!==o?(f=o("sidebar.agentsSection.newAgent"),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=t.jsx("span",{children:f}),e[10]=f,e[11]=m):m=e[11];let u;return e[12]!==a||e[13]!==l||e[14]!==c||e[15]!==m?(u=t.jsx(qt,{children:t.jsxs(Kt,{tooltip:a,className:l,onClick:c,children:[d,m]})}),e[12]=a,e[13]=l,e[14]=c,e[15]=m,e[16]=u):u=e[16],u}function po(){const n=$.c(4),e=G();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(en,{className:"sr-only",children:s}),n[2]=s,n[3]=i):i=n[3],i}function xo(n){const e=$.c(8),{emptyCtaClass:s}=n,i=G();let r;e[0]!==i?(r=i("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=r):r=e[1];let o;e[2]!==s?(o=Q(s),e[2]=s,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Ke,{className:"size-4"}),e[4]=a):a=e[4];let l;return e[5]!==r||e[6]!==o?(l=t.jsx(kt,{"aria-label":r,className:o,children:a}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function vo(n){const e=$.c(19),{wrapEmptyHint:s,highlightEmpty:i,emptyCtaClass:r}=n,o=G();let a;e[0]!==i||e[1]!==o?(a=i?void 0:o("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o,e[2]=a):a=e[2];let l;e[3]!==r?(l=Q(r),e[3]=r,e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ke,{}),e[5]=c):c=e[5];let d;e[6]!==o?(d=o("sidebar.agentsSection.newAgent"),e[6]=o,e[7]=d):d=e[7];let f;e[8]!==d?(f=t.jsx("span",{children:d}),e[8]=d,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==l||e[12]!==f?(m=t.jsx(Xe,{asChild:!0,children:t.jsxs(Kt,{tooltip:a,className:l,children:[c,f]})}),e[10]=a,e[11]=l,e[12]=f,e[13]=m):m=e[13];let u;e[14]!==m||e[15]!==s?(u=s(m),e[14]=m,e[15]=s,e[16]=u):u=e[16];let p;return e[17]!==u?(p=t.jsx(qt,{children:u}),e[17]=u,e[18]=p):p=e[18],p}function bo(n){const e=$.c(9),{children:s}=n,i=G();let r;e[0]!==s?(r=t.jsx(Me,{asChild:!0,children:s}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==i?(o=i("sidebar.agentsSection.selectAnExistingAgent"),e[2]=i,e[3]=o):o=e[3];let a;e[4]!==o?(a=t.jsx(Pe,{side:"right",sideOffset:8,children:o}),e[4]=o,e[5]=a):a=e[5];let l;return e[6]!==r||e[7]!==a?(l=t.jsxs(Oe,{defaultOpen:!0,delayDuration:0,children:[r,a]}),e[6]=r,e[7]=a,e[8]=l):l=e[8],l}function jo(n){const e=rt(),{create:s}=nn(),{locator:i}=le(),r=at({strict:!1}),o=lt({strict:!1});return async a=>{const l=crypto.randomUUID(),c=a===o.virtualmcpid?ao(n,i,r.taskId??""):null;try{await s({id:l,virtual_mcp_id:a,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:l},search:{virtualmcpid:a}})}}function vt(n){const e=$.c(20),{agent:s,selected:i,onClick:r}=n,o=i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let a;e[0]!==o?(a=Q("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",o),e[0]=o,e[1]=a):a=e[1];let l;e[2]!==s.icon||e[3]!==s.title?(l=t.jsx(qe,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=l):l=e[4];let c;e[5]!==s.title?(c=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=c):c=e[6];let d;e[7]!==s.description?(d=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=d):d=e[8];let f;e[9]!==c||e[10]!==d?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,d]}),e[9]=c,e[10]=d,e[11]=f):f=e[11];let m;e[12]!==i?(m=i&&t.jsx(st,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=i,e[13]=m):m=e[13];let u;return e[14]!==r||e[15]!==a||e[16]!==l||e[17]!==f||e[18]!==m?(u=t.jsxs("button",{type:"button",onClick:r,className:a,children:[l,f,m]}),e[14]=r,e[15]=a,e[16]=l,e[17]=f,e[18]=m,e[19]=u):u=e[19],u}function un(n){const e=$.c(5),{children:s,action:i}=n;let r;e[0]!==s?(r=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let o;return e[2]!==i||e[3]!==r?(o=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[r,i]}),e[2]=i,e[3]=r,e[4]=o):o=e[4],o}function yo(n){const e=$.c(23),{onClose:s,onSelectAgent:i,selectedAgentId:r,onImportFromGithub:o}=n,[a,l]=V.useState(""),c=Rn(),d=c??[],{org:f}=le(),{data:m}=Te.useSession(),u=m?.user?.id??"anon",p=Zn(c),y=es(),x=jo(f.slug),g=ns(c),h=a.toLowerCase(),v=d.filter(No).filter(E=>!g.has(E.id)).filter(wo).filter(E=>!a||E.title.toLowerCase().includes(h)),j=v.filter(_o),C=v.filter(Co),w=ct(f.id),I=!a||w.title.toLowerCase().includes(h),M=!!(i&&I);let b;e[0]!==s||e[1]!==i?(b=()=>{i?.(null),s(),l("")},e[0]=s,e[1]=i,e[2]=b):b=e[2];const N=b,A=E=>{if(i){i(E.id),s(),l("");return}ts({orgId:f.id,userId:u},E.id,p),y(),s(),l(""),x(E.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let _;e[3]!==a?(_=t.jsx(lo,{value:a,onChange:l}),e[3]=a,e[4]=_):_=e[4];const T="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",P=i&&I&&w&&t.jsx(vt,{agent:w,selected:!r||r===w.id,onClick:N}),D=(j.length>0||!a)&&t.jsx(mo,{onImportFromGithub:o}),F=j.map(E=>t.jsx(vt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>A(E)},E.id)),L=C.length>0&&t.jsx(fo,{}),O=C.map(E=>t.jsx(vt,{agent:E,selected:i?r===E.id:void 0,onClick:()=>A(E)},E.id));let z;e[5]!==M||e[6]!==a||e[7]!==v.length?(z=v.length===0&&!M&&a&&t.jsx(co,{}),e[5]=M,e[6]=a,e[7]=v.length,e[8]=z):z=e[8];let U;e[9]!==z||e[10]!==P||e[11]!==D||e[12]!==F||e[13]!==L||e[14]!==O?(U=t.jsxs("div",{className:T,children:[P,D,F,L,O,z]}),e[9]=z,e[10]=P,e[11]=D,e[12]=F,e[13]=L,e[14]=O,e[15]=U):U=e[15];let R;e[16]!==s||e[17]!==f?(R=t.jsx(uo,{org:f,onClose:s}),e[16]=s,e[17]=f,e[18]=R):R=e[18];let q;return e[19]!==U||e[20]!==R||e[21]!==_?(q=t.jsxs("div",{className:S,children:[_,U,R]}),e[19]=U,e[20]=R,e[21]=_,e[22]=q):q=e[22],q}function Co(n){return!sn(n.metadata)}function _o(n){return sn(n.metadata)}function wo(n){return!zn(n.id)}function No(n){return!$n(n.id)}function So(n){const e=$.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:i,trigger:r,onSelectAgent:o,selectedAgentId:a,side:l,align:c}=s,d=i===void 0?!1:i,f=l===void 0?"right":l,m=c===void 0?"start":c,[u,p]=V.useState(!1),[y,x]=V.useState(!1),g=tn(),{setOpenMobile:h}=Ut(),v=Jn(),j=v?"border border-border":void 0;let C;e[2]!==v?(C=D=>v?t.jsx(bo,{children:D}):D,e[2]=v,e[3]=C):C=e[3];const w=C;let I;e[4]!==g||e[5]!==h?(I=()=>{p(!1),g&&h(!1)},e[4]=g,e[5]=h,e[6]=I):I=e[6];const M=I;let b;e[7]!==M?(b=()=>{M(),x(!0)},e[7]=M,e[8]=b):b=e[8];const N=b;let A;e[9]!==M||e[10]!==N||e[11]!==o||e[12]!==u||e[13]!==a?(A=u&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(Hn,{className:"h-4 w-24"})}),children:t.jsx(yo,{onClose:M,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:N})}),e[9]=M,e[10]=N,e[11]=o,e[12]=u,e[13]=a,e[14]=A):A=e[14];const S=A;let _;e[15]!==m||e[16]!==d||e[17]!==j||e[18]!==v||e[19]!==g||e[20]!==u||e[21]!==S||e[22]!==f||e[23]!==r||e[24]!==w?(_=g?t.jsxs(t.Fragment,{children:[r?t.jsx("button",{type:"button",onClick:()=>p(!0),className:"contents",children:r}):d?w(t.jsx(go,{setOpen:p,emptyCtaClass:j})):t.jsx(ho,{setOpen:p,highlightEmpty:v,emptyCtaClass:j}),t.jsx(Jt,{open:u,onOpenChange:p,direction:"bottom",children:t.jsxs(Zt,{className:"max-h-[85dvh] p-0",children:[t.jsx(po,{}),S]})})]}):t.jsxs(St,{open:u,onOpenChange:D=>{D&&!u&&K("agent_browser_opened",{surface:"desktop_popover"}),p(D)},children:[r?t.jsx(Xe,{asChild:!0,children:r}):d?w(t.jsx(Xe,{asChild:!0,children:t.jsx(xo,{emptyCtaClass:j})})):t.jsx(vo,{wrapEmptyHint:w,highlightEmpty:v,emptyCtaClass:j}),t.jsx(Nt,{className:"w-[380px] p-0 overflow-hidden",side:f,align:m,children:S})]}),e[15]=m,e[16]=d,e[17]=j,e[18]=v,e[19]=g,e[20]=u,e[21]=S,e[22]=f,e[23]=r,e[24]=w,e[25]=_):_=e[25];let T;e[26]!==y?(T=t.jsx(Wn,{open:y,onOpenChange:x,mode:"agent"}),e[26]=y,e[27]=T):T=e[27];let P;return e[28]!==T||e[29]!==_?(P=t.jsxs(t.Fragment,{children:[_,T]}),e[28]=T,e[29]=_,e[30]=P):P=e[30],P}const ko="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 Io(n){const e=$.c(29),{agentId:s,fallback:i,onOpenHome:r,onPick:o}=n,a=G(),l=wt(s)??i??null;let c,d,f,m,u;e[0]!==l?.title||e[1]!==r||e[2]!==a?(u=l?.title??a("header.shellBreadcrumb.superAgentDefaultName"),m="flex min-w-0 items-center gap-0",c="button",d=r,f=a("header.shellBreadcrumb.openAgentHome",{name:u}),e[0]=l?.title,e[1]=r,e[2]=a,e[3]=c,e[4]=d,e[5]=f,e[6]=m,e[7]=u):(c=e[3],d=e[4],f=e[5],m=e[6],u=e[7]);const p=l?.icon??null;let y;e[8]!==p||e[9]!==u?(y=t.jsx(qe,{icon:p,name:u,size:"xs"}),e[8]=p,e[9]=u,e[10]=y):y=e[10];let x;e[11]!==c||e[12]!==d||e[13]!==f||e[14]!==y?(x=t.jsx("button",{type:c,onClick:d,"aria-label":f,className:"flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:y}),e[11]=c,e[12]=d,e[13]=f,e[14]=y,e[15]=x):x=e[15];let g;e[16]!==u?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:u}),e[16]=u,e[17]=g):g=e[17];let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=h):h=e[18];let v;e[19]!==g?(v=t.jsxs("button",{type:"button",className:ko,children:[g,h]}),e[19]=g,e[20]=v):v=e[20];let j;e[21]!==s||e[22]!==o||e[23]!==v?(j=t.jsx(So,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:o,trigger:v}),e[21]=s,e[22]=o,e[23]=v,e[24]=j):j=e[24];let C;return e[25]!==j||e[26]!==m||e[27]!==x?(C=t.jsxs("div",{className:m,children:[x,j]}),e[25]=j,e[26]=m,e[27]=x,e[28]=C):C=e[28],C}function Nr(n){const e=$.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:i}=s,r=G(),{org:o}=le(),{state:a,isMobile:l}=Ut(),c=dn().invitations.length>0,d=a==="collapsed"||l;let f;e[2]!==c||e[3]!==o.name||e[4]!==r?(f=c?r("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:o.name}):r("header.shellBreadcrumb.switchOrganization",{name:o.name}),e[2]=c,e[3]=o.name,e[4]=r,e[5]=f):f=e[5];let m;e[6]!==o?(m=t.jsx(Mt,{org:o,size:"sm"}),e[6]=o,e[7]=m):m=e[7];let u;e[8]!==c||e[9]!==d?(u=c&&t.jsx("span",{className:Q("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",d?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=c,e[9]=d,e[10]=u):u=e[10];let p;e[11]!==m||e[12]!==u?(p=t.jsxs("span",{className:"relative inline-flex",children:[m,u]}),e[11]=m,e[12]=u,e[13]=p):p=e[13];let y;e[14]!==o.name||e[15]!==i?(y=i&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:o.name}),e[14]=o.name,e[15]=i,e[16]=y):y=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(_t,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=x):x=e[17];let g;e[18]!==f||e[19]!==p||e[20]!==y?(g=t.jsx(Me,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":f,className:"flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[p,y,x]})}),e[18]=f,e[19]=p,e[20]=y,e[21]=g):g=e[21];let h;e[22]!==o.slug||e[23]!==g?(h=t.jsx(so,{orgParam:o.slug,trigger:g}),e[22]=o.slug,e[23]=g,e[24]=h):h=e[24];let v;e[25]!==o.name?(v=t.jsx(Pe,{side:"bottom",children:o.name}),e[25]=o.name,e[26]=v):v=e[26];let j;return e[27]!==v||e[28]!==h?(j=t.jsxs(Oe,{children:[h,v]}),e[27]=v,e[28]=h,e[29]=j):j=e[29],j}function Sr(n){const e=$.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,{org:r}=le();let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[2]=o):o=e[2];const a=at(o);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[3]=l):l=e[3];const c=lt(l),{threads:d}=dt(),{data:f}=Te.useSession(),{setTaskId:m,createNewTask:u}=ut();let p;e[4]!==r.id?(p=ct(r.id),e[4]=r.id,e[5]=p):p=e[5];const y=p,x=y.id,g=a.taskId?c.virtualmcpid??x:x;let h;e[6]!==u||e[7]!==x||e[8]!==i||e[9]!==f?.user?.id||e[10]!==m||e[11]!==d?(h=M=>{const b=M??x,N=is(d,b,f?.user?.id);N?m(N.id,b):u(b),i?.()},e[6]=u,e[7]=x,e[8]=i,e[9]=f?.user?.id,e[10]=m,e[11]=d,e[12]=h):h=e[12];const v=h;let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=j):j=e[13];const C=g===x?y:void 0;let w;e[14]!==g||e[15]!==v?(w=()=>v(g),e[14]=g,e[15]=v,e[16]=w):w=e[16];let I;return e[17]!==g||e[18]!==v||e[19]!==C||e[20]!==w?(I=t.jsx(V.Suspense,{fallback:j,children:t.jsx(Io,{agentId:g,fallback:C,onOpenHome:w,onPick:v})}),e[17]=g,e[18]=v,e[19]=C,e[20]=w,e[21]=I):I=e[21],I}function kr(){const n=$.c(24),e=G(),{org:s}=le();let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[0]=i):i=n[0];const r=at(i);let o;n[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[1]=o):o=n[1];const a=lt(o),{threads:l}=dt(),{createNewTask:c}=ut();let d;n[2]!==s.id?(d=ct(s.id),n[2]=s.id,n[3]=d):d=n[3];const f=d.id,m=r.taskId?a.virtualmcpid??f:f;let u;n[4]!==r.taskId||n[5]!==l?(u=(r.taskId?l.find(I=>I.id===r.taskId)?.branch:null)??null,n[4]=r.taskId,n[5]=l,n[6]=u):u=n[6];const p=u;let y;n[7]!==m||n[8]!==c||n[9]!==p?(y=()=>{c(m,p)},n[7]=m,n[8]=c,n[9]=p,n[10]=y):y=n[10];const x=y;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let h;n[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Mn,{size:16}),n[13]=h):h=n[13];let v;n[14]!==x||n[15]!==g?(v=t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button",onClick:x,"aria-label":g,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:h})}),n[14]=x,n[15]=g,n[16]=v):v=n[16];let j;n[17]!==e?(j=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=j):j=n[18];let C;n[19]!==j?(C=t.jsx(Pe,{side:"bottom",children:j}),n[19]=j,n[20]=C):C=n[20];let w;return n[21]!==v||n[22]!==C?(w=t.jsxs(Oe,{children:[v,C]}),n[21]=v,n[22]=C,n[23]=w):w=n[23],w}function Do({open:n,onOpenChange:e,onCreated:s}){const i=G(),{org:r}=le(),{data:o}=Te.useSession(),{stdioEnabled:a}=Cn(),l=tn(),c=ln(),d=on(),m=rn(d,"").items,u=_n({resolver:wn(vs),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=u.watch("ui_type"),y=u.watch("connection_url"),x=u.watch("npx_package"),g=Je({uiType:p,connectionUrl:y??"",npxPackage:x??""})??$t({uiType:p,connectionUrl:y??"",registryItems:m}),h=b=>{const N=b.trim();if(!N)return;const A=!!u.formState.dirtyFields.title,S=!!u.formState.dirtyFields.description,_=!!u.formState.dirtyFields.env_vars,T=D=>{if(D&&(!A&&!u.getValues("title").trim()&&D.title&&u.setValue("title",D.title,{shouldDirty:!1}),!S&&!(u.getValues("description")??"").trim()&&D.description&&u.setValue("description",D.description,{shouldDirty:!1}),!_&&D.envVarKeys?.length)){const F=u.getValues("env_vars")??[],L=new Set(F.map(z=>z.key)),O=D.envVarKeys.filter(z=>!L.has(z));O.length>0&&u.setValue("env_vars",[...F,...O.map(z=>({key:z,value:""}))],{shouldDirty:!0})}},P=js(N);if(P&&a){u.setValue("ui_type","NPX",{shouldDirty:!0}),u.setValue("npx_package",P.packageName,{shouldDirty:!0}),u.setValue("connection_url","",{shouldDirty:!0}),u.setValue("connection_token",null,{shouldDirty:!0}),T(Je({uiType:"NPX",npxPackage:P.packageName}));return}if(N.startsWith("http://")||N.startsWith("https://")){const D=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";u.setValue("ui_type",D,{shouldDirty:!0}),u.setValue("connection_url",N,{shouldDirty:!0}),T(Je({uiType:D,connectionUrl:N})??$t({uiType:D,connectionUrl:N,registryItems:m}));return}p==="NPX"&&T(Je({uiType:"NPX",npxPackage:N}))},v=b=>{b||u.reset(),e(b)},j=async b=>{let N,A=null,S=null,_=null;b.ui_type==="NPX"?(N="STDIO",A="",_=ys(b.npx_package||"",b.env_vars||[])):b.ui_type==="STDIO"?(N="STDIO",A="",_=Cs(b.stdio_command||"",b.stdio_args||"",b.stdio_cwd,b.env_vars||[])):(N=b.ui_type,A=b.connection_url||"",S=b.connection_token||null);const T=as("conn");try{await c.create.mutateAsync({id:T,title:b.title,description:b.description||null,connection_type:N,connection_url:A,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:o?.user?.id||"system",organization_id:r.id,icon:b.icon??null,app_name:null,app_id:null,connection_headers:_,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),u.reset(),e(!1),s?.(T)}catch{X.error(i("connections.createConnectionDialog.failedToCreateConnection"))}},C=i("connections.createConnectionDialog.title"),w=i("connections.createConnectionDialog.description"),I=u.formState.isSubmitting?i("connections.createConnectionDialog.saving"):i("connections.createConnectionDialog.createButton"),M=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(pe,{control:u.control,name:"ui_type",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.typeLabel")}),t.jsxs(ms,{value:b.value,onValueChange:b.onChange,children:[t.jsx(be,{children:t.jsx(gs,{children:t.jsx(hs,{})})}),t.jsxs(ps,{children:[t.jsx(Qe,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.httpType")]})}),t.jsx(Qe,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.sseType")]})}),t.jsx(Qe,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.websocketType")]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(Qe,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(tt,{className:"w-4 h-4"}),i("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(Qe,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Pn,{className:"w-4 h-4"}),i("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(je,{})]})}),p==="NPX"&&t.jsx(pe,{control:u.control,name:"npx_package",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.npmPackagePlaceholder"),...b,value:b.value??"",onPaste:N=>{const A=N.clipboardData.getData("text");A&&(N.preventDefault(),u.setValue("npx_package",A.trim(),{shouldDirty:!0}),h(A))},onBlur:N=>{h(N.target.value),b.onBlur()}})}),t.jsx(je,{})]})}),p==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(pe,{control:u.control,name:"stdio_command",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.commandLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.commandPlaceholder"),...b,value:b.value??""})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"stdio_args",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.argumentsLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.argumentsPlaceholder"),...b,value:b.value??""})}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"stdio_cwd",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.workingDirectoryPlaceholder"),...b,value:b.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(je,{})]})})]}),(p==="NPX"||p==="STDIO")&&t.jsx(pe,{control:u.control,name:"env_vars",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(be,{children:t.jsx(bs,{value:b.value??[],onChange:b.onChange})}),t.jsx(je,{})]})}),p!=="NPX"&&p!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(pe,{control:u.control,name:"connection_url",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.urlLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.urlPlaceholder"),...b,value:b.value??"",onPaste:N=>{const A=N.clipboardData.getData("text");A&&(N.preventDefault(),u.setValue("connection_url",A.trim(),{shouldDirty:!0}),h(A))},onBlur:N=>{h(N.target.value),b.onBlur()}})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"connection_token",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:g?.token?.label??i("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(be,{children:t.jsx(Le,{type:"password",placeholder:g?.token?.placeholder??i("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...b,value:b.value??""})}),g?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:i("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(je,{})]})})]}),t.jsx(pe,{control:u.control,name:"title",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.nameLabel")}),t.jsx(be,{children:t.jsx(Le,{placeholder:i("connections.createConnectionDialog.namePlaceholder"),...b})}),t.jsx(je,{})]})}),t.jsx(pe,{control:u.control,name:"description",render:({field:b})=>t.jsxs(xe,{children:[t.jsx(ve,{children:i("connections.createConnectionDialog.descriptionLabel")}),t.jsx(be,{children:t.jsx(xs,{placeholder:i("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...b,value:b.value??""})}),t.jsx(je,{})]})})]});return l?t.jsx(Jt,{open:n,onOpenChange:v,children:t.jsxs(Zt,{className:"max-h-[90vh]",children:[t.jsx(Vn,{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(en,{children:C}),t.jsx(Un,{className:"mt-1",children:w})]}),t.jsx(qn,{asChild:!0,children:t.jsx(ye,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Yt,{size:16})})})]})}),t.jsx(Ft,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:M}),t.jsx(Kn,{children:t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"w-full",children:I})})]})})]})}):t.jsx(It,{open:n,onOpenChange:v,children:t.jsxs(Dt,{className:"sm:max-w-[525px]",children:[t.jsxs(At,{children:[t.jsx(Tt,{children:C}),t.jsx(an,{children:w})]}),t.jsx(Ft,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit(j),children:[t.jsx("div",{className:"py-4",children:M}),t.jsxs(fs,{children:[t.jsx(ye,{type:"button",variant:"outline",onClick:()=>v(!1),children:i("connections.createConnectionDialog.cancelButton")}),t.jsx(ye,{type:"submit",disabled:u.formState.isSubmitting,className:"min-w-40",children:I})]})]})})]})})}function Ao(n){const e=$.c(72),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:l,connectingItemId:c,search:d,onCreateConnection:f,onBrowseNavigate:m,defaultTab:u}=n,p=s===void 0?"add":s,y=u===void 0?"connected":u,x=G(),{org:g}=le(),h=V.useDeferredValue(d),v=d!==h;let j;e[0]!==h?(j=h.trim().toLowerCase(),e[0]=h,e[1]=j):j=e[1];const C=j;let w;e[2]!==y?(w=k=>k??y,e[2]=y,e[3]=w):w=e[3];const[I,M]=Ct(Nn.connectionsTab(g.slug)+(y==="all"?":home-modal":":agent-modal"),w);let b;e[4]!==I||e[5]!==M?(b=k=>{k!==I&&K("connections_dialog_tab_changed",{to_tab:k}),M(k)},e[4]=I,e[5]=M,e[6]=b):b=e[6];const N=b;let A;e[7]!==g.id||e[8]!==g.slug?(A={connectionId:Wt,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=A):A=e[9];const S=Ln(A),_=h?.trim().split(/\s+/).filter(Boolean)??[],T=_.length>0?{operator:"or",conditions:_.flatMap(Lo)}:void 0,P={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},D=JSON.stringify(P),{data:F,fetchNextPage:L,hasNextPage:O,isFetchingNextPage:z}=Ns({queryKey:Ue.collectionListInfinite(S,g.id,"","CONNECTIONS",D),queryFn:async k=>{const{pageParam:B}=k,Z=B===void 0?0:B;return(await S.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Z}})).structuredContent},initialPageParam:0,getNextPageParam:$o,staleTime:3e4}),U=F?.pages.flatMap(Fo)??[],R=us(U),q=new Set(U.filter(Oo).map(Po)),E=on(),Y=rn(E,h),ee=zt(Y.loadMore,Y.hasMore,Y.isLoadingMore),te=zt(L,O??!1,z),H=I==="all"||!!C,J=H?Y.items.filter(k=>{const B=ls(k);if(B&&q.has(B))return!1;if(!C)return!0;const Z=ot(k._meta),ue=[k.title,k.description,k.name,k.server?.title,k.server?.description,k.server?.name,Z?.friendly_name,Z?.friendlyName].filter(Boolean).join(" ").toLowerCase();return _.some(he=>ue.includes(he.toLowerCase()))}):[],ne=J.filter(Mo),W=J.filter(To);let Ne;e[10]!==r?(Ne=k=>k.some(B=>r.has(B.id)),e[10]=r,e[11]=Ne):Ne=e[11];const Be=Ne;let Ce;e[12]!==r||e[13]!==i||e[14]!==c||e[15]!==Be||e[16]!==p||e[17]!==o||e[18]!==m||e[19]!==a||e[20]!==x?(Ce=(k,B,Z,ue,he)=>{const Ye=Be(he),Ge=he.find(ze=>!r.has(ze.id)),ce=he[0];if(p==="browse"){const ze=_s(ce);return t.jsx(ht,{connection:{title:B,icon:Z,description:he.length>1?`${he.length} instances`:ue??void 0},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",x("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{K("connection_browse_clicked",{app_name:ce.app_name??null,connection_id:ce.id,instances_count:he.length}),m?.(ze)}},k)}return t.jsx(ht,{connection:{title:B,icon:Z,description:ue},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Ye&&t.jsxs(Ze,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(st,{size:11})," ",x("virtualMcp.connectionDialogContent.added")]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),Ge?(K("connection_add_clicked",{action:"use_existing",app_name:ce.app_name??null,connection_id:Ge.id}),i&&K("agent_connection_attached",{agent_id:i,connection_id:Ge.id,app_name:ce.app_name??null,mode:"existing"}),o(Ge.id)):(K("connection_add_clicked",{action:"clone",app_name:ce.app_name??null,base_connection_id:ce.id}),a(ce))},children:x("virtualMcp.connectionDialogContent.add")})]})},k)},e[12]=r,e[13]=i,e[14]=c,e[15]=Be,e[16]=p,e[17]=o,e[18]=m,e[19]=a,e[20]=x,e[21]=Ce):Ce=e[21];const Ee=Ce;let _e;e[22]!==c||e[23]!==p||e[24]!==l||e[25]!==x?(_e=k=>{const B=ot(k._meta),Z=B?.friendlyName||B?.friendly_name||k.server?.title||k.title||k.server?.name||k.name||k.id||"",ue=k.server?.description||k.description||null,he=k.server?.icons?.[0]?.src||cs(k.server?.repository)||null,Ye=B?.official===!0,Ge=B?.verified===!0,ce=B?.owner==="deco";return t.jsx(ht,{connection:{title:Z,description:ue,icon:he},fallbackIcon:t.jsx(tt,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[ce&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:t.jsx("img",{src:"/logos/deco logo.svg",alt:x("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(Pe,{children:x("virtualMcp.connectionDialogContent.builtByDeco")})]}),!ce&&Ye&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:x("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!ce&&!Ye&&Ge&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx(Ze,{variant:"outline",size:"icon",children:t.jsx(pt,{})})}),t.jsx(Pe,{children:x("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(ye,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:ze=>{ze.stopPropagation(),K("connection_add_clicked",{action:"connect_new",registry_item_id:k.id,app_name:B?.friendlyName||k.server?.name||k.name||null}),l(k)},children:c===k.id?t.jsx(Ve,{size:14,className:"animate-spin"}):x(p==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${k.id}`)},e[22]=c,e[23]=p,e[24]=l,e[25]=x,e[26]=_e):_e=e[26];const We=_e;let se;e[27]!==I||e[28]!==N||e[29]!==f||e[30]!==C||e[31]!==x?(se=!C&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(ws,{tabs:[{id:"all",label:x("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:x("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:I,onTabChange:k=>N(k)}),t.jsxs(ye,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{K("connections_dialog_custom_clicked"),f()},children:[t.jsx(Ke,{size:12}),x("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=I,e[28]=N,e[29]=f,e[30]=C,e[31]=x,e[32]=se):se=e[32];const Se=v&&"opacity-50 pointer-events-none";let oe;e[33]!==Se?(oe=Q("flex-1 overflow-auto p-5 transition-opacity duration-150",Se),e[33]=Se,e[34]=oe):oe=e[34];const Re="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ke;e[35]!==Ee?(ke=k=>{if(k.type==="group")return Ee(k.key,k.title,k.icon,null,k.connections);const B=k.connection;return Ee(B.id,B.title,B.icon,B.description??null,[B])},e[35]=Ee,e[36]=ke):ke=e[36];const Ie=R.map(ke);let fe;e[37]!==te?(fe=t.jsx("div",{ref:te,className:"col-span-full h-1"}),e[37]=te,e[38]=fe):fe=e[38];let de;e[39]!==z?(de=z&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=z,e[40]=de):de=e[40];const Fe=H&&ne.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(pt,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:x("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),De=H&&ne.map(We),$e=H&&W.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:x("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ae=H&&W.map(We);let me;e[41]!==ee||e[42]!==E||e[43]!==H?(me=H&&E.length>0&&t.jsx("div",{ref:ee,className:"col-span-full h-1"}),e[41]=ee,e[42]=E,e[43]=H,e[44]=me):me=e[44];let ie;e[45]!==Y.isLoadingMore||e[46]!==H?(ie=H&&Y.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=Y.isLoadingMore,e[46]=H,e[47]=ie):ie=e[47];let ge;e[48]!==Ie||e[49]!==fe||e[50]!==de||e[51]!==Fe||e[52]!==De||e[53]!==$e||e[54]!==Ae||e[55]!==me||e[56]!==ie?(ge=t.jsxs("div",{className:Re,children:[Ie,fe,de,Fe,De,$e,Ae,me,ie]}),e[48]=Ie,e[49]=fe,e[50]=de,e[51]=Fe,e[52]=De,e[53]=$e,e[54]=Ae,e[55]=me,e[56]=ie,e[57]=ge):ge=e[57];let re;e[58]!==I||e[59]!==R.length||e[60]!==W||e[61]!==d||e[62]!==x||e[63]!==ne?(re=R.length===0&&ne.length===0&&W.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:d?x("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:d}):x(I==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=I,e[59]=R.length,e[60]=W,e[61]=d,e[62]=x,e[63]=ne,e[64]=re):re=e[64];let ae;e[65]!==oe||e[66]!==ge||e[67]!==re?(ae=t.jsxs("div",{className:oe,children:[ge,re]}),e[65]=oe,e[66]=ge,e[67]=re,e[68]=ae):ae=e[68];let we;return e[69]!==se||e[70]!==ae?(we=t.jsxs(t.Fragment,{children:[se,ae]}),e[69]=se,e[70]=ae,e[71]=we):we=e[71],we}function To(n){return!n.verified&&!ot(n._meta)?.verified&&!n.meta?.verified}function Mo(n){return n.verified||ot(n._meta)?.verified||n.meta?.verified}function Po(n){return n.app_name}function Oo(n){return n.app_name}function Fo(n){return n?.items??[]}function $o(n,e){if(n?.hasMore)return e.reduce(zo,0)}function zo(n,e){return n+(e?.items?.length??0)}function Lo(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Ir({open:n,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=G(),a=r.mode??"add",l="agentId"in r?r.agentId:void 0,c="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,d="onAdd"in r&&r.onAdd?r.onAdd:S=>{},f=(S,_,T)=>{l&&K("agent_connection_attached",{agent_id:l,connection_id:S,app_name:_,mode:T})},[m,u]=V.useState(null),[p,y]=V.useState(i),[x,g]=V.useState(!1),{org:h}=le(),{data:v}=Te.useSession(),j=ln(),C=Sn(),w=rt(),I=S=>{e(!1),w({to:"/$org/settings/connections/$appSlug",params:{org:h.slug,appSlug:S}})},M=()=>{C.invalidateQueries({predicate:S=>{const _=S.queryKey;return _[1]===h.id&&_[3]==="collection"&&_[4]==="CONNECTIONS"}})},b=async(S,_)=>{K("connection_oauth_succeeded",{connection_id:S,flow:_});const T=new URL(`/api/${h.slug}/mcp/${S}`,window.location.origin);await C.invalidateQueries({queryKey:Ue.isMCPAuthenticated(T.href,null)}),M()},N=async S=>{u(S.app_name??S.id);try{const T=`${S.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,D=(await j.create.mutateAsync({title:T,description:S.description??null,connection_type:S.connection_type,connection_url:S.connection_url??null,connection_token:null,icon:S.icon??null,app_name:S.app_name??null,app_id:S.app_id??null,connection_headers:S.connection_headers??null})).id,F=await xt({connectionId:D,orgId:h.id,orgSlug:h.slug,persistFallback:L=>j.update.mutateAsync({id:D,data:{connection_token:L}}).then(()=>{})});if(F.ran&&!F.ok){K("connection_oauth_failed",{connection_id:D,flow:"clone",error:F.error??"no_token"}),X.error(o("virtualMcp.addConnectionDialog.authenticationFailedError",{error:F.error??"no token received"})),await j.delete.mutateAsync(D);return}F.ran&&await b(D,"clone"),f(D,S.app_name??null,"clone"),d(D)}catch(_){console.error("Failed to add connection:",_),X.error(o("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{u(null)}},A=async S=>{if(!(!h||!v?.user?.id)){u(S.id);try{const _=ds(S,h.id,v.user.id,{remoteIndex:0}),T=_.connection_type==="STDIO",P=!!_.connection_url,D=T&&_.connection_headers&&typeof _.connection_headers=="object"&&"command"in _.connection_headers;if(!P&&!D){X.error(o("virtualMcp.addConnectionDialog.mcpServerConnectionError")),u(null);return}const{id:F}=await j.create.mutateAsync(_),L=await xt({connectionId:F,orgId:h.id,orgSlug:h.slug,persistFallback:O=>j.update.mutateAsync({id:F,data:{connection_token:O}}).then(()=>{})});if(L.ran&&!L.ok){K("connection_oauth_failed",{connection_id:F,flow:"connect_new",error:L.error??"no_token"}),X.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:L.error??"no token received"})}),f(F,_.app_name??null,"new"),d(F);return}L.ran?(await b(F,"connect_new"),X.success(o("virtualMcp.addConnectionDialog.connectedAuthenticated"))):X.success(o("virtualMcp.addConnectionDialog.connected")),f(F,_.app_name??null,"new"),d(F)}catch(_){console.error("Failed to connect:",_),X.error(o("virtualMcp.addConnectionDialog.failedToConnect"))}finally{u(null)}}};return t.jsxs(It,{open:n,onOpenChange:e,children:[t.jsxs(Dt,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(At,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx(Tt,{className:"text-base font-semibold",children:o(a==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(rs,{value:p,onChange:y,placeholder:o("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ve,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ao,{mode:a,agentId:l,addedConnectionIds:c,onAdd:d,onCloneAndAdd:N,onConnectAndAdd:A,connectingItemId:m,search:p,onCreateConnection:()=>g(!0),onBrowseNavigate:I,defaultTab:s})})]}),t.jsx(Do,{open:x,onOpenChange:g,onCreated:async S=>{g(!1);const _=await xt({connectionId:S,orgId:h.id,orgSlug:h.slug,persistFallback:T=>j.update.mutateAsync({id:S,data:{connection_token:T}}).then(()=>{})});if(_.ran&&!_.ok){K("connection_oauth_failed",{connection_id:S,flow:"custom_create",error:_.error??"no_token"}),X.warning(o("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:o("virtualMcp.addConnectionDialog.signInFailedDescription",{error:_.error??"no token received"})}),f(S,null,"custom"),d(S),e(!1);return}_.ran&&await b(S,"custom_create"),f(S,null,"custom"),d(S),e(!1)}})]})}const Lt=new Map;function Dr(){const{org:n}=le(),e=ft(),s=Ss(),i=s.find(g=>g.providerId==="deco"),{data:r,isLoading:o,refetch:a,isFetching:l}=He({queryKey:Ue.aiProviderCredits(n.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),c=r?.balanceCents??null,d=c!=null?c/100:null,f=V.useRef(new Map);if(c!=null){const g=Lt.get(n.id);f.current.get(n.id)&&g!=null&&c>g&&K("credits_topped_up_detected",{organization_id:n.id,delta_cents:c-g,previous_balance_cents:g,new_balance_cents:c}),Lt.set(n.id,c),f.current.set(n.id,!0)}const m=!!i,u=c!=null&&c>0,p=c!=null&&c===0,y=c!=null&&c===200,x=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:m,decoKeyId:i?.id??null,balanceCents:c,balanceDollars:d,hasCredits:u,isZeroBalance:p,isInitialFreeCredit:y,hasOnlyDecoProvider:x,isLoading:o,isFetching:l,refetch:a}}function bt(n){const e=$.c(13),{label:s,value:i,onChange:r,options:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==r?(l=m=>m&&r(m),e[2]=r,e[3]=l):l=e[3];let c;e[4]!==o?(c=o.map(Bo),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==c||e[8]!==i?(d=t.jsx(Ds,{type:"single",size:"sm",value:i,onValueChange:l,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=l,e[7]=c,e[8]=i,e[9]=d):d=e[9];let f;return e[10]!==a||e[11]!==d?(f=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,d]}),e[10]=a,e[11]=d,e[12]=f):f=e[12],f}function Bo(n){return t.jsxs(Is,{value:n.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[n.icon,n.label]},n.value)}function Ar(n){const e=$.c(91),{panel:s,className:i}=n,r=i===void 0?"md:size-[34px] rounded-lg":i,o=G();let a;e[0]!==o?(a=o("sidebar.taskGroupsList.filterChats"),e[0]=o,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(ks,{size:16}),e[2]=l):l=e[2];let c;e[3]!==s.filtersActive?(c=s.filtersActive&&t.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"}),e[3]=s.filtersActive,e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==s.filtersActive||e[7]!==a||e[8]!==c?(d=t.jsx(Me,{asChild:!0,children:t.jsx(Xe,{asChild:!0,children:t.jsxs(kt,{"aria-label":a,active:s.filtersActive,className:r,children:[l,c]})})}),e[5]=r,e[6]=s.filtersActive,e[7]=a,e[8]=c,e[9]=d):d=e[9];let f;e[10]!==o?(f=o("sidebar.taskGroupsList.filterChats"),e[10]=o,e[11]=f):f=e[11];let m;e[12]!==f?(m=t.jsx(Pe,{side:"bottom",children:f}),e[12]=f,e[13]=m):m=e[13];let u;e[14]!==d||e[15]!==m?(u=t.jsxs(Oe,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=u):u=e[16];let p;e[17]!==o?(p=o("sidebar.taskGroupsList.filterView"),e[17]=o,e[18]=p):p=e[18];const y=s.groupBy;let x;e[19]!==s?(x=W=>{K("tasks_panel_group_by_changed",{to_value:W}),s.setGroupBy(W)},e[19]=s,e[20]=x):x=e[20];let g;e[21]!==o?(g=o("sidebar.taskGroupsList.viewList"),e[21]=o,e[22]=g):g=e[22];let h;e[23]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(On,{size:13}),e[23]=h):h=e[23];let v;e[24]!==g?(v={value:"flat",label:g,icon:h},e[24]=g,e[25]=v):v=e[25];let j;e[26]!==o?(j=o("sidebar.taskGroupsList.viewStatus"),e[26]=o,e[27]=j):j=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Fn,{size:13}),e[28]=C):C=e[28];let w;e[29]!==j?(w={value:"status",label:j,icon:C},e[29]=j,e[30]=w):w=e[30];let I;e[31]!==v||e[32]!==w?(I=[v,w],e[31]=v,e[32]=w,e[33]=I):I=e[33];let M;e[34]!==s.groupBy||e[35]!==x||e[36]!==I||e[37]!==p?(M=t.jsx(bt,{label:p,value:y,onChange:x,options:I}),e[34]=s.groupBy,e[35]=x,e[36]=I,e[37]=p,e[38]=M):M=e[38];let b;e[39]!==o?(b=o("sidebar.taskGroupsList.filterType"),e[39]=o,e[40]=b):b=e[40];const N=s.typeFilter;let A;e[41]!==s?(A=W=>{K("tasks_panel_filter_changed",{to_value:W}),s.setTypeFilter(W)},e[41]=s,e[42]=A):A=e[42];let S;e[43]!==o?(S=o("sidebar.taskGroupsList.typeAll"),e[43]=o,e[44]=S):S=e[44];let _;e[45]!==S?(_={value:"all",label:S},e[45]=S,e[46]=_):_=e[46];let T;e[47]!==o?(T=o("sidebar.taskGroupsList.typeChats"),e[47]=o,e[48]=T):T=e[48];let P;e[49]!==T?(P={value:"manual",label:T},e[49]=T,e[50]=P):P=e[50];let D;e[51]!==o?(D=o("sidebar.taskGroupsList.typeAuto"),e[51]=o,e[52]=D):D=e[52];let F;e[53]!==D?(F={value:"automation",label:D},e[53]=D,e[54]=F):F=e[54];let L;e[55]!==_||e[56]!==P||e[57]!==F?(L=[_,P,F],e[55]=_,e[56]=P,e[57]=F,e[58]=L):L=e[58];let O;e[59]!==s.typeFilter||e[60]!==b||e[61]!==A||e[62]!==L?(O=t.jsx(bt,{label:b,value:N,onChange:A,options:L}),e[59]=s.typeFilter,e[60]=b,e[61]=A,e[62]=L,e[63]=O):O=e[63];let z;e[64]!==o?(z=o("sidebar.taskGroupsList.filterScope"),e[64]=o,e[65]=z):z=e[65];const U=s.showAll?"team":"mine";let R;e[66]!==s?(R=W=>s.setShowAll(W==="team"),e[66]=s,e[67]=R):R=e[67];let q;e[68]!==o?(q=o("sidebar.taskGroupsList.scopeMine"),e[68]=o,e[69]=q):q=e[69];let E;e[70]!==q?(E={value:"mine",label:q},e[70]=q,e[71]=E):E=e[71];let Y;e[72]!==o?(Y=o("sidebar.taskGroupsList.scopeTeam"),e[72]=o,e[73]=Y):Y=e[73];let ee;e[74]!==Y?(ee={value:"team",label:Y},e[74]=Y,e[75]=ee):ee=e[75];let te;e[76]!==E||e[77]!==ee?(te=[E,ee],e[76]=E,e[77]=ee,e[78]=te):te=e[78];let H;e[79]!==z||e[80]!==U||e[81]!==R||e[82]!==te?(H=t.jsx(bt,{label:z,value:U,onChange:R,options:te}),e[79]=z,e[80]=U,e[81]=R,e[82]=te,e[83]=H):H=e[83];let J;e[84]!==M||e[85]!==O||e[86]!==H?(J=t.jsxs(Nt,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[M,O,H]}),e[84]=M,e[85]=O,e[86]=H,e[87]=J):J=e[87];let ne;return e[88]!==J||e[89]!==u?(ne=t.jsxs(St,{children:[u,J]}),e[88]=J,e[89]=u,e[90]=ne):ne=e[90],ne}function Eo(n){const e=$.c(9),{virtualMcpId:s,size:i,showAutomationBadge:r}=n,o=i===void 0?"sm":i,a=G();let l;e[0]!==o||e[1]!==s?(l=s?t.jsx(Ro,{virtualMcpId:s,size:o}):t.jsx(qe,{icon:null,name:"?",size:o}),e[0]=o,e[1]=s,e[2]=l):l=e[2];let c;e[3]!==r||e[4]!==a?(c=r&&t.jsx("span",{"aria-label":a("tasksPanel.mcpAvatar.automationTriggered"),className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:t.jsx(cn,{size:10,className:"text-white"})}),e[3]=r,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=t.jsxs("div",{className:"relative shrink-0",children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function Ro(n){const e=$.c(6),{virtualMcpId:s,size:i}=n,r=wt(s);if(!r){let l;return e[0]!==i?(l=t.jsx(qe,{icon:null,name:"?",size:i}),e[0]=i,e[1]=l):l=e[1],l}const o=r.icon??null;let a;return e[2]!==r.title||e[3]!==i||e[4]!==o?(a=t.jsx(qe,{icon:o,name:r.title,size:i}),e[2]=r.title,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function Go(n){const e=$.c(51),{open:s,onOpenChange:i}=n,[r,o]=V.useState(""),{org:a}=le(),{setTaskId:l}=ut(),c=ft(),d=G();let f,m,u;e[0]!==a.id||e[1]!==r?(u=r.trim(),m=He,f=Ue.globalSearch(a.id,u),e[0]=a.id,e[1]=r,e[2]=f,e[3]=m,e[4]=u):(f=e[2],m=e[3],u=e[4]);let p;e[5]!==c||e[6]!==u?(p=async()=>await c.call("GLOBAL_SEARCH",{query:u,limit:u?20:10}),e[5]=c,e[6]=u,e[7]=p):p=e[7];let y;e[8]!==s||e[9]!==f||e[10]!==p?(y={queryKey:f,enabled:s,queryFn:p,staleTime:1e4},e[8]=s,e[9]=f,e[10]=p,e[11]=y):y=e[11];const{data:x,isFetching:g}=m(y);let h;e[12]!==x?.items?(h=x?.items??[],e[12]=x?.items,e[13]=h):h=e[13];const v=h;let j;e[14]!==i?(j=O=>{O||o(""),i(O)},e[14]=i,e[15]=j):j=e[15];const C=j;let w;e[16]!==C||e[17]!==l?(w=O=>{C(!1),l(O.id,O.virtual_mcp_id??void 0)},e[16]=C,e[17]=l,e[18]=w):w=e[18];const I=w;let M;e[19]!==d?(M=d("tasksPanel.globalSearchDialog.title"),e[19]=d,e[20]=M):M=e[20];let b;e[21]!==M?(b=t.jsx(Tt,{children:M}),e[21]=M,e[22]=b):b=e[22];let N;e[23]!==d?(N=d("tasksPanel.globalSearchDialog.description"),e[23]=d,e[24]=N):N=e[24];let A;e[25]!==N?(A=t.jsx(an,{children:N}),e[25]=N,e[26]=A):A=e[26];let S;e[27]!==A||e[28]!==b?(S=t.jsxs(At,{className:"sr-only",children:[b,A]}),e[27]=A,e[28]=b,e[29]=S):S=e[29];let _;e[30]!==d?(_=d("tasksPanel.globalSearchDialog.placeholder"),e[30]=d,e[31]=_):_=e[31];let T;e[32]!==r||e[33]!==_?(T=t.jsx(Os,{value:r,onValueChange:o,placeholder:_}),e[32]=r,e[33]=_,e[34]=T):T=e[34];let P;e[35]!==I||e[36]!==g||e[37]!==v||e[38]!==d||e[39]!==u?(P=t.jsx(As,{children:g&&v.length===0?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):v.length===0?t.jsx(Ts,{children:d("tasksPanel.globalSearchDialog.noResults")}):t.jsx(Ms,{heading:u?void 0:d("tasksPanel.globalSearchDialog.recent"),children:v.map(O=>O.type==="thread"?t.jsxs(Ps,{value:`thread:${O.id}:${O.title}`,onSelect:()=>I(O),className:"gap-2.5",children:[t.jsx(Eo,{virtualMcpId:O.virtual_mcp_id,size:"xs"}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("div",{className:"text-sm text-foreground truncate",children:O.title||d("tasksPanel.globalSearchDialog.untitledChat")})}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(O.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${O.id}`):null)})}),e[35]=I,e[36]=g,e[37]=v,e[38]=d,e[39]=u,e[40]=P):P=e[40];let D;e[41]!==T||e[42]!==P?(D=t.jsxs(Fs,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[T,P]}),e[41]=T,e[42]=P,e[43]=D):D=e[43];let F;e[44]!==S||e[45]!==D?(F=t.jsxs(Dt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[S,D]}),e[44]=S,e[45]=D,e[46]=F):F=e[46];let L;return e[47]!==C||e[48]!==s||e[49]!==F?(L=t.jsx(It,{open:s,onOpenChange:C,children:F}),e[47]=C,e[48]=s,e[49]=F,e[50]=L):L=e[50],L}function Ho(n){const e=$.c(43),{branch:s,onOutcome:i}=n,r=G();let o;e[0]!==i?(o=M=>{M||i("cancel")},e[0]=i,e[1]=o):o=e[1];let a;e[2]!==r?(a=r("sidebar.archiveWorktreeDialog.title"),e[2]=r,e[3]=a):a=e[3];let l;e[4]!==a?(l=t.jsx($s,{children:a}),e[4]=a,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("sidebar.archiveWorktreeDialog.stopsAndDeletesBefore"),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==s?(d=t.jsx("span",{className:"font-mono",children:s}),e[8]=s,e[9]=d):d=e[9];let f;e[10]!==r?(f=r("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=r,e[11]=f):f=e[11];let m;e[12]!==c||e[13]!==d||e[14]!==f?(m=t.jsxs(zs,{children:[c," ",d," ",f]}),e[12]=c,e[13]=d,e[14]=f,e[15]=m):m=e[15];let u;e[16]!==l||e[17]!==m?(u=t.jsxs(Ls,{children:[l,m]}),e[16]=l,e[17]=m,e[18]=u):u=e[18];let p;e[19]!==i?(p=()=>i("cancel"),e[19]=i,e[20]=p):p=e[20];let y;e[21]!==r?(y=r("sidebar.archiveWorktreeDialog.cancel"),e[21]=r,e[22]=y):y=e[22];let x;e[23]!==y||e[24]!==p?(x=t.jsx(Bs,{onClick:p,children:y}),e[23]=y,e[24]=p,e[25]=x):x=e[25];let g;e[26]===Symbol.for("react.memo_cache_sentinel")?(g=Q(kn({variant:"destructive"})),e[26]=g):g=e[26];let h;e[27]!==i?(h=()=>i("confirm"),e[27]=i,e[28]=h):h=e[28];let v;e[29]!==r?(v=r("sidebar.archiveWorktreeDialog.confirm"),e[29]=r,e[30]=v):v=e[30];let j;e[31]!==h||e[32]!==v?(j=t.jsx(Es,{className:g,onClick:h,children:v}),e[31]=h,e[32]=v,e[33]=j):j=e[33];let C;e[34]!==x||e[35]!==j?(C=t.jsxs(Rs,{children:[x,j]}),e[34]=x,e[35]=j,e[36]=C):C=e[36];let w;e[37]!==C||e[38]!==u?(w=t.jsxs(Gs,{children:[u,C]}),e[37]=C,e[38]=u,e[39]=w):w=e[39];let I;return e[40]!==o||e[41]!==w?(I=t.jsx(Hs,{open:!0,onOpenChange:o,children:w}),e[40]=o,e[41]=w,e[42]=I):I=e[42],I}function Vo(n,e,s){if(!s)return;const i=n.findIndex(r=>r.id===e);if(i!==-1){for(let r=i+1;r<n.length;r++){const o=n[r];if(o?.created_by===s)return o}for(let r=i-1;r>=0;r--){const o=n[r];if(o?.created_by===s)return o}}}function Uo(n){return n==="ephemeral"||n.startsWith("thread:")}function fn(n){const e=$.c(45),{task:s,isActive:i,onClick:r,onArchive:o,showAutomationBadge:a,showAgentIcon:l,hideStatusIdle:c,indented:d}=n,f=G(),m=Us(s.status),u=m.icon,p=s.metadata?.kind==="tool_call_run",y=wt(p?void 0:s.virtual_mcp_id);let x;e[0]!==y?(x=ss(y),e[0]=y,e[1]=x):x=e[1];const g=x;qs(6e4);const h=a||!!s.trigger_id,v=s.id,j="button",C=0;let w;e[2]!==r?(w=R=>{R.target===R.currentTarget&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),r())},e[2]=r,e[3]=w):w=e[3];const I=d?"-ml-4 pl-6":"pl-[7px]",M=i?"bg-accent text-accent-foreground":"hover:bg-accent/60";let b;e[4]!==I||e[5]!==M?(b=Q("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",I,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",M),e[4]=I,e[5]=M,e[6]=b):b=e[6];let N;e[7]!==p||e[8]!==l||e[9]!==y?.icon||e[10]!==y?.title?(N=l&&!p&&t.jsx(qe,{icon:y?.icon??null,name:y?.title??"?",size:"2xs"}),e[7]=p,e[8]=l,e[9]=y?.icon,e[10]=y?.title,e[11]=N):N=e[11];let A;e[12]!==h||e[13]!==f?(A=h&&t.jsx(cn,{size:12,"aria-label":f("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=h,e[13]=f,e[14]=A):A=e[14];let S;e[15]!==f||e[16]!==s.title?(S=s.title||f("tasksPanel.taskRow.untitledTask"),e[15]=f,e[16]=s.title,e[17]=S):S=e[17];let _;e[18]!==S?(_=t.jsx("div",{className:"text-sm text-foreground truncate",children:S}),e[18]=S,e[19]=_):_=e[19];let T;e[20]!==A||e[21]!==_?(T=t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[A,_]}),e[20]=A,e[21]=_,e[22]=T):T=e[22];let P;e[23]!==g||e[24]!==i||e[25]!==s.branch||e[26]!==s.updated_at?(P=s.updated_at&&t.jsxs("div",{className:Q("flex items-center gap-1 text-[11px] min-w-0",i?"text-accent-foreground/70":"text-muted-foreground/60"),children:[s.branch&&!Uo(s.branch)?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate font-mono",children:s.branch}),t.jsx("span",{className:"shrink-0",children:"·"})]}):g?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"truncate",children:[g.owner,"/",g.name]}),t.jsx("span",{className:"shrink-0",children:"·"})]}):null,t.jsx("span",{className:"shrink-0",children:Ws(new Date(s.updated_at))})]}),e[23]=g,e[24]=i,e[25]=s.branch,e[26]=s.updated_at,e[27]=P):P=e[27];let D;e[28]!==T||e[29]!==P?(D=t.jsxs("div",{className:"flex-1 min-w-0",children:[T,P]}),e[28]=T,e[29]=P,e[30]=D):D=e[30];const F="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",L=!c&&t.jsx("span",{className:Q("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",o&&"group-hover/row:opacity-0"),"aria-label":f("tasksPanel.taskRow.statusLabel",{status:m.label}),children:t.jsx(u,{size:14,className:Q(m.iconClassName,s.status==="in_progress"&&"animate-spin")})});let O;e[31]!==o||e[32]!==f?(O=o&&t.jsxs(Oe,{children:[t.jsx(Me,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":f("tasksPanel.taskRow.archiveTask"),onClick:R=>{R.stopPropagation(),o()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:t.jsx(In,{size:14})})}),t.jsx(Pe,{side:"right",children:f("tasksPanel.taskRow.archive")})]}),e[31]=o,e[32]=f,e[33]=O):O=e[33];let z;e[34]!==L||e[35]!==O?(z=t.jsxs("div",{className:F,children:[L,O]}),e[34]=L,e[35]=O,e[36]=z):z=e[36];let U;return e[37]!==r||e[38]!==D||e[39]!==z||e[40]!==w||e[41]!==b||e[42]!==N||e[43]!==s.id?(U=t.jsxs("div",{"data-task-id":v,role:j,tabIndex:C,onClick:r,onKeyDown:w,className:b,children:[N,D,z]}),e[37]=r,e[38]=D,e[39]=z,e[40]=w,e[41]=b,e[42]=N,e[43]=s.id,e[44]=U):U=e[44],U}const Bt=["requires_action","in_progress","failed","expired","completed"];function qo(n){const e=new Map(Bt.map(s=>[s,[]]));for(const s of n){const i=s.status??"completed";(e.get(i)??e.get("completed")).push(s)}return Bt.map(s=>({status:s,threads:e.get(s)}))}const Ko="sidebar.group.expanded.";function Wo(n,e){const s=$.c(3),[i,r]=Ct(`${Ko}${n}`,e);let o;return s[0]!==i||s[1]!==r?(o=[i,r],s[0]=i,s[1]=r,s[2]=o):o=s[2],o}function mn(n){const e=$.c(18),{onClick:s,isFetching:i,indented:r}=n,o=G();let a;e[0]!==o?(a=o("sidebar.showMoreButton.ariaLabel"),e[0]=o,e[1]=a):a=e[1];const l=r?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==l?(c=Q("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==i?(d=i&&t.jsx(Ve,{size:14,className:"animate-spin"}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==i||e[7]!==o?(f=o(i?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=i,e[7]=o,e[8]=f):f=e[8];let m;e[9]!==f?(m=t.jsx("span",{children:f}),e[9]=f,e[10]=m):m=e[10];let u;return e[11]!==i||e[12]!==s||e[13]!==a||e[14]!==c||e[15]!==d||e[16]!==m?(u=t.jsxs("button",{type:"button","aria-label":a,onClick:s,disabled:i,className:c,children:[d,m]}),e[11]=i,e[12]=s,e[13]=a,e[14]=c,e[15]=d,e[16]=m,e[17]=u):u=e[17],u}function Qo(n,e,s,i){return[n,e,s,i.type,i.member,i.currentUserId??""].join("|")}function Xo(n){return n.member==="mine"&&!n.currentUserId}const gn=4;let nt=0;const yt=[];function Yo(){for(;nt<gn&&yt.length>0;){const n=yt.shift();n&&n()}}function hn(n){return new Promise((e,s)=>{const i=()=>{nt++,n().then(e,s).finally(()=>{nt--,Yo()})};nt<gn?i():yt.push(i)})}const mt=10;function Et(n,e,s,i,r){const o={hidden:!1};i.member==="mine"&&i.currentUserId&&(o.created_by=i.currentUserId),i.type==="automation"&&(o.has_trigger=!0),i.type==="manual"&&(o.has_trigger=!1);const a={where:o,limit:r,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function Jo(n,e,s,i){let r=0;for(const o of n)pn(o,e,s,i)&&r++;return r}function jt(n,e,s,i){return Jo(n,e,s,i)}function Zo(n,e){return!!(n>=mt||n===0&&e)}function Rt(n,e){return n<e}function ei(n,e){return e===!1?!1:e===!0?!0:n}function pn(n,e,s,i){return!(n.hidden||(n.status??"completed")!==s||i.member==="mine"&&i.currentUserId&&n.created_by!==i.currentUserId||i.type==="automation"&&!n.trigger_id||i.type==="manual"&&n.trigger_id)}const it=new Map,et=new Map;function ti(n,e){return e?n>=mt?!0:null:!1}function Gt(n){return it.get(n)}function ni(n,e){it.set(n,e)}function si(n,e,s){const i=it.get(n);if(i!==void 0){s(i);return}let r=et.get(n);r||(r=hn(e).then(o=>(it.set(n,o),et.delete(n),o)).catch(()=>(et.delete(n),Promise.reject(new Error("group probe failed")))),et.set(n,r)),r.then(s,()=>s(!1))}function Ht(n){const e=n,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===mt,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function oi(n,e,s,i,r){let o=0;for(const a of n)e.has(a.id)||pn(a,s,i,r)&&o++;return o}function ii(n,e,s,i){const r=$.c(8),{org:o}=le(),a=Qo(o.id,n,e,s);let l;r[0]!==s?(l=Xo(s),r[0]=s,r[1]=l):l=r[1];const c=l,[d,f]=V.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==a&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const m=Yn(),{threads:u,hasMore:p}=dt(),y=jt(u,n,e,s),x=Zo(y,p),g=ti(y,p),h=ft();if(d.identity===a&&d.serverHasMore===null){const M=g??Gt(a);M!==void 0&&f({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:M})}!c&&d.identity===a&&d.serverHasMore===null&&g===null&&Gt(a)===void 0&&d.probeSubscribedIdentity!==a&&(f(M=>M.identity===a?{...M,isProbing:!0,probeSubscribedIdentity:a}:M),si(a,async()=>{const M=Et(n,e,0,s,1),b=await h.call("COLLECTION_THREADS_LIST",M),{totalCount:N}=Ht(b),A=jt(m.threads.get(),n,e,s);return N===void 0?!1:Rt(A,N)},M=>{f(b=>b.identity!==a?b:{...b,isProbing:!1,serverHasMore:M})}));const j=async function(){if(d.isFetching||d.isProbing||c)return;const b=a;f(N=>N.identity===b?{...N,isFetching:!0}:N);try{const N=jt(u,n,e,s),A=Et(n,e,N,s,mt),S=await hn(()=>h.call("COLLECTION_THREADS_LIST",A)),{items:_,hasMore:T,totalCount:P}=Ht(S),D=new Set(u.map(ri)),F=oi(_,D,n,e,s),L=N;m.mergeThreads(_),f(O=>{if(O.identity!==b)return O;let z;return P!==void 0?z=Rt(L+F,P):z=_.length===0||F===0?!1:T,ni(b,z),{...O,isFetching:!1,serverHasMore:z}})}catch(N){const A=N,S=A instanceof Error?A.message:String(A);X.error(`Could not load more tasks: ${S}`),f(_=>_.identity===b?{..._,isFetching:!1}:_)}},C=d.isFetching||d.isProbing,w=!c&&!C&&ei(x,d.serverHasMore);let I;return r[2]!==C||r[3]!==j||r[4]!==w||r[5]!==d.isProbing||r[6]!==d.serverHasMore?(I={hasMore:w,isFetching:C,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:j},r[2]=C,r[3]=j,r[4]=w,r[5]=d.isProbing,r[6]=d.serverHasMore,r[7]=I):I=r[7],I}function ri(n){return n.id}function ai(n){const e=$.c(20),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,{isFetching:d,isProbing:f,loadMore:m,hasMore:u,serverHasMore:p}=ii("status",s,c),[y,x]=V.useState(!1);!y&&i.length===0&&p===!0&&!d&&!f&&(x(!0),queueMicrotask(()=>{m()}));let g;if(e[0]!==r||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==o||e[5]!==i){let j;e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==o?(j=C=>t.jsx(fn,{task:C,isActive:r===C.id,onClick:()=>o(C),onArchive:l&&C.created_by===c.currentUserId?()=>a(C):void 0,showAutomationBadge:!!C.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},C.id),e[7]=r,e[8]=l,e[9]=c,e[10]=a,e[11]=o,e[12]=j):j=e[12],g=i.map(j),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=o,e[5]=i,e[6]=g}else g=e[6];let h;e[13]!==u||e[14]!==d||e[15]!==m?(h=(u||d)&&t.jsx(mn,{onClick:()=>{m()},isFetching:d,indented:!0}),e[13]=u,e[14]=d,e[15]=m,e[16]=h):h=e[16];let v;return e[17]!==g||e[18]!==h?(v=t.jsxs(t.Fragment,{children:[g,h]}),e[17]=g,e[18]=h,e[19]=v):v=e[19],v}function li(n){const e=$.c(36),{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c}=n,d=Ks[s],f=d.icon,[m,u]=Wo(`status-${s}`,!1);let p;e[0]!==m||e[1]!==u?(p=function(){u(!m)},e[0]=m,e[1]=u,e[2]=p):p=e[2];const y=p;let x;e[3]!==y?(x=b=>{b.target===b.currentTarget&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),y())},e[3]=y,e[4]=x):x=e[4];let g;e[5]!==f||e[6]!==d.iconClassName?(g=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:t.jsx(f,{size:12,className:d.iconClassName})}),e[5]=f,e[6]=d.iconClassName,e[7]=g):g=e[7];let h;e[8]!==m?(h=t.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:m?t.jsx(_t,{size:14}):t.jsx(Vt,{size:14})}),e[8]=m,e[9]=h):h=e[9];let v;e[10]!==g||e[11]!==h?(v=t.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[g,h]}),e[10]=g,e[11]=h,e[12]=v):v=e[12];let j;e[13]!==d.label?(j=t.jsx("span",{className:"flex-1 truncate",children:d.label}),e[13]=d.label,e[14]=j):j=e[14];let C;e[15]!==i.length?(C=t.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:i.length})}),e[15]=i.length,e[16]=C):C=e[16];let w;e[17]!==m||e[18]!==y||e[19]!==x||e[20]!==v||e[21]!==j||e[22]!==C?(w=t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":m,onClick:y,onKeyDown:x,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[v,j,C]}),e[17]=m,e[18]=y,e[19]=x,e[20]=v,e[21]=j,e[22]=C,e[23]=w):w=e[23];let I;e[24]!==r||e[25]!==l||e[26]!==m||e[27]!==c||e[28]!==a||e[29]!==o||e[30]!==s||e[31]!==i?(I=m&&t.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:t.jsx(ai,{status:s,threads:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:l,filters:c})}),e[24]=r,e[25]=l,e[26]=m,e[27]=c,e[28]=a,e[29]=o,e[30]=s,e[31]=i,e[32]=I):I=e[32];let M;return e[33]!==w||e[34]!==I?(M=t.jsxs("div",{className:"flex flex-col gap-0.5",children:[w,I]}),e[33]=w,e[34]=I,e[35]=M):M=e[35],M}function ci(n){const e=$.c(38),{threads:s,groupBy:i,activeTaskId:r,onSelectTask:o,onArchiveTask:a,filters:l,hasMore:c,isFetchingMore:d,onLoadMore:f,filtersActive:m}=n;if(s.length===0&&!c&&!d){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Vs,{className:"size-6 opacity-60"}),e[0]=g):g=e[0];const h=m?"No chats match your filters":"No chats yet";let v;return e[1]!==h?(v=t.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[g,t.jsx("p",{className:"text-sm",children:h})]}),e[1]=h,e[2]=v):v=e[2],v}const u=s.length>1||c;if(i==="status"){let g;if(e[3]!==r||e[4]!==u||e[5]!==l||e[6]!==a||e[7]!==o||e[8]!==s){let v;e[10]!==r||e[11]!==u||e[12]!==l||e[13]!==a||e[14]!==o?(v=j=>t.jsx(li,{status:j.status,threads:j.threads,activeTaskId:r,onSelectTask:o,onArchiveTask:a,canArchive:u,filters:l},j.status),e[10]=r,e[11]=u,e[12]=l,e[13]=a,e[14]=o,e[15]=v):v=e[15],g=qo(s).map(v),e[3]=r,e[4]=u,e[5]=l,e[6]=a,e[7]=o,e[8]=s,e[9]=g}else g=e[9];let h;return e[16]!==g?(h=t.jsx(t.Fragment,{children:g}),e[16]=g,e[17]=h):h=e[17],h}let p;if(e[18]!==r||e[19]!==u||e[20]!==l||e[21]!==a||e[22]!==o||e[23]!==s){let g;e[25]!==r||e[26]!==u||e[27]!==l||e[28]!==a||e[29]!==o?(g=h=>t.jsx(fn,{task:h,isActive:r===h.id,onClick:()=>o(h),onArchive:u&&h.created_by===l.currentUserId?()=>a(h):void 0,showAutomationBadge:!!h.trigger_id,showAgentIcon:!0},h.id),e[25]=r,e[26]=u,e[27]=l,e[28]=a,e[29]=o,e[30]=g):g=e[30],p=s.map(g),e[18]=r,e[19]=u,e[20]=l,e[21]=a,e[22]=o,e[23]=s,e[24]=p}else p=e[24];let y;e[31]!==c||e[32]!==d||e[33]!==f?(y=(c||d)&&t.jsx(mn,{onClick:f,isFetching:d}),e[31]=c,e[32]=d,e[33]=f,e[34]=y):y=e[34];let x;return e[35]!==p||e[36]!==y?(x=t.jsxs(t.Fragment,{children:[p,y]}),e[35]=p,e[36]=y,e[37]=x):x=e[37],x}function di(n,e){return null}function ui(n,e){return n.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const fi=["archive","reclaim-worktree"],mi=[];function gi(n){return n==="confirm"?fi:mi}function Tr(n){const e=$.c(11),{panel:s}=n;let i;return e[0]!==s.activeTaskId||e[1]!==s.archiveTask||e[2]!==s.filters||e[3]!==s.filtersActive||e[4]!==s.groupBy||e[5]!==s.hasMore||e[6]!==s.isFetchingMore||e[7]!==s.loadMore||e[8]!==s.selectTask||e[9]!==s.threads?(i=t.jsx(ci,{threads:s.threads,groupBy:s.groupBy,activeTaskId:s.activeTaskId,onSelectTask:s.selectTask,onArchiveTask:s.archiveTask,filters:s.filters,hasMore:s.hasMore,isFetchingMore:s.isFetchingMore,onLoadMore:s.loadMore,filtersActive:s.filtersActive}),e[0]=s.activeTaskId,e[1]=s.archiveTask,e[2]=s.filters,e[3]=s.filtersActive,e[4]=s.groupBy,e[5]=s.hasMore,e[6]=s.isFetchingMore,e[7]=s.loadMore,e[8]=s.selectTask,e[9]=s.threads,e[10]=i):i=e[10],i}function Mr(n){const e=$.c(82);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,r=G(),{data:o}=Te.useSession(),a=o?.user?.id,{org:l}=le();let c;e[2]!==l.id?(c=ct(l.id),e[2]=l.id,e[3]=c):c=e[3];const d=c.id,{threads:f,hasMore:m,isFetchingMore:u,fetchNextPage:p}=dt(),y=f.filter(vi),{hide:x,setScope:g}=nn(),h=rt(),v=ft(),{setTaskId:j,createNewTask:C}=ut();let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w={strict:!1},e[4]=w):w=e[4];const I=at(w);let M;e[5]===Symbol.for("react.memo_cache_sentinel")?(M={strict:!1},e[5]=M):M=e[5];const b=lt(M),N=I.taskId??null;let A;e[6]!==N||e[7]!==f||e[8]!==b.virtualmcpid?(A=b.virtualmcpid??f.find(k=>k.id===N)?.virtual_mcp_id??null,e[6]=N,e[7]=f,e[8]=b.virtualmcpid,e[9]=A):A=e[9];const S=A;let _;e[10]!==i?(_=()=>{i?.()},e[10]=i,e[11]=_):_=e[11];const T=_,P=[...y].sort(xi),[D,F]=V.useState("all"),[L,O]=V.useState("flat"),[z,U]=Ct("sidebar-threads-scope-all",!1),[R,q]=V.useState(!1),[E,Y]=V.useState(!1);let ee;e[12]!==q?(ee=()=>{K("tasks_panel_search_opened"),Y(!0),q(!0)},e[12]=q,e[13]=ee):ee=e[13];const te=ee,[H,J]=V.useState(null),ne=a??null;let W;e[14]!==ne||e[15]!==D?(W={type:D,member:"mine",currentUserId:ne},e[14]=ne,e[15]=D,e[16]=W):W=e[16];const Ne=W,Be={};z||(Be.created_by="me"),g(Be);let Ce;e[17]!==a?(Ce=k=>a?k.filter(B=>B.created_by===a):[],e[17]=a,e[18]=Ce):Ce=e[18];const Ee=Ce;let _e;e[19]!==D?(_e=k=>D==="automation"?k.filter(pi):D==="manual"?k.filter(hi):k,e[19]=D,e[20]=_e):_e=e[20];const We=_e,se=We(z?P:Ee(P));let Se;e[21]!==N||e[22]!==T||e[23]!==a||e[24]!==x||e[25]!==h||e[26]!==l.slug||e[27]!==j||e[28]!==se?(Se=k=>{const B=k.id===N,Z=x(k.id);if(os(k.id),!B)return Z;const ue=Vo(se,k.id,a);return T(),ue?j(ue.id,ue.virtual_mcp_id):h({to:"/$org",params:{org:l.slug}}),Z},e[21]=N,e[22]=T,e[23]=a,e[24]=x,e[25]=h,e[26]=l.slug,e[27]=j,e[28]=se,e[29]=Se):Se=e[29];const oe=Se;let Re;e[30]!==v||e[31]!==r?(Re=async k=>{try{await v.call("SANDBOX_DELETE",{virtualMcpId:k.virtualMcpId,branch:k.branch,sandboxProviderKind:"user-desktop",removeWorktree:!0})}catch{X.error(r("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:k.branch}))}},e[30]=v,e[31]=r,e[32]=Re):Re=e[32];const ke=Re;let Ie;e[33]!==f||e[34]!==oe||e[35]!==a||e[36]!==J?(Ie=k=>{if(a&&k.created_by&&k.created_by!==a)return;const B=di();if(!B||ui(f,B)){oe(k);return}J({task:k,target:B})},e[33]=f,e[34]=oe,e[35]=a,e[36]=J,e[37]=Ie):Ie=e[37];const fe=Ie;let de;e[38]!==oe||e[39]!==H||e[40]!==ke||e[41]!==J?(de=k=>{const B=H;B&&(J(null),(async()=>{for(const Z of gi(k))if(Z==="archive")try{await oe(B.task)}catch{return}else await ke(B.target)})())},e[38]=oe,e[39]=H,e[40]=ke,e[41]=J,e[42]=de):de=e[42];const Fe=de;let De;e[43]!==T||e[44]!==j?(De=k=>{T(),j(k.id,k.virtual_mcp_id)},e[43]=T,e[44]=j,e[45]=De):De=e[45];const $e=De;let Ae;e[46]!==S||e[47]!==N||e[48]!==f||e[49]!==T||e[50]!==C||e[51]!==d?(Ae=()=>{const k=S??d,B=f.find(Z=>Z.id===N)?.branch??null;K("sidebar_new_thread_clicked",{virtual_mcp_id:k}),T(),C(k,B)},e[46]=S,e[47]=N,e[48]=f,e[49]=T,e[50]=C,e[51]=d,e[52]=Ae):Ae=e[52];const me=Ae;let ie;e[53]!==p?(ie=()=>{p()},e[53]=p,e[54]=ie):ie=e[54];const ge=L!=="flat"||D!=="all"||z;let re;e[55]!==Fe||e[56]!==H?(re=H?t.jsx(Ho,{branch:H.target.branch,onOutcome:Fe}):null,e[55]=Fe,e[56]=H,e[57]=re):re=e[57];let ae;e[58]!==E||e[59]!==R||e[60]!==q?(ae=E?t.jsx(Go,{open:R,onOpenChange:q}):null,e[58]=E,e[59]=R,e[60]=q,e[61]=ae):ae=e[61];let we;return e[62]!==N||e[63]!==fe||e[64]!==Ne||e[65]!==L||e[66]!==m||e[67]!==u||e[68]!==me||e[69]!==te||e[70]!==$e||e[71]!==O||e[72]!==U||e[73]!==F||e[74]!==z||e[75]!==ie||e[76]!==ge||e[77]!==re||e[78]!==ae||e[79]!==D||e[80]!==se?(we={threads:se,activeTaskId:N,filters:Ne,hasMore:m,isFetchingMore:u,loadMore:ie,groupBy:L,setGroupBy:O,typeFilter:D,setTypeFilter:F,showAll:z,setShowAll:U,filtersActive:ge,selectTask:$e,archiveTask:fe,newThread:me,openSearch:te,reclaimDialog:re,searchDialog:ae},e[62]=N,e[63]=fe,e[64]=Ne,e[65]=L,e[66]=m,e[67]=u,e[68]=me,e[69]=te,e[70]=$e,e[71]=O,e[72]=U,e[73]=F,e[74]=z,e[75]=ie,e[76]=ge,e[77]=re,e[78]=ae,e[79]=D,e[80]=se,e[81]=we):we=e[81],we}function hi(n){return!n.trigger_id}function pi(n){return!!n.trigger_id}function xi(n,e){return(e.updated_at??"").localeCompare(n.updated_at??"")}function vi(n){return!n.hidden}function bi(n){return n?n.run_in_progress?"generating":n.scanned_at?"ready":"none":"none"}const ji=2e4;function yi(n){if(typeof n!="string"||!n)return null;try{return new URL(n).hostname||null}catch{return null}}function Pr(){const n=$.c(17),{org:e}=le(),s=Bn.COMMERCE_DISCOVERY(e.id);let i;n[0]!==e.id||n[1]!==e.slug?(i=Pt({connectionId:Wt,orgId:e.id,orgSlug:e.slug}),n[0]=e.id,n[1]=e.slug,n[2]=i):i=n[2];const{data:r}=He(i),a=He({queryKey:Ue.commerceDiscoveryConnection(e.id,s),enabled:!!r,retry:!1,staleTime:6e4,queryFn:async()=>{if(!r)throw new Error("selfClient not ready");const j=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}});return Ot(j)}}).data?.item??null,{data:l}=He({...Pt({connectionId:s,orgId:e.id,orgSlug:e.slug}),enabled:!!a}),c=Ue.commerceDiscoveryDiagnostic(e.id,s),d=!!l;let f;n[3]!==l?(f=async()=>{if(!l)throw new Error("cdClient not ready");const j=await l.callTool({name:Qt,arguments:{}});return Ot(j).diagnostic??null},n[3]=l,n[4]=f):f=n[4];let m;n[5]!==c||n[6]!==d||n[7]!==f?(m={queryKey:c,enabled:d,retry:1,refetchInterval:Ci,queryFn:f},n[5]=c,n[6]=d,n[7]=f,n[8]=m):m=n[8];const u=He(m),p=u.data??null,y=u.isSuccess,x=a?.metadata?.siteUrl;let g;n[9]!==x?(g=yi(x),n[9]=x,n[10]=g):g=n[10];const h=l??null;let v;return n[11]!==s||n[12]!==u.isSuccess||n[13]!==p||n[14]!==g||n[15]!==h?(v={diagnostic:p,isSuccess:y,host:g,connectionId:s,cdClient:h},n[11]=s,n[12]=u.isSuccess,n[13]=p,n[14]=g,n[15]=h,n[16]=v):v=n[16],v}function Ci(n){return n.state.status!=="error"&&bi(n.state.data)==="generating"?ji:!1}function Or(n,e){return{to:"/$org/$taskId",params:{org:n.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:En(n.id),main:Qs(e,Qt)}}}export{Sr as A,_r as C,kr as N,Nr as O,Ar as T,wr as a,Ir as b,Mr as c,so as d,Mt as e,Tr as f,Pr as g,bi as h,Or as i,Dr as u};
@@ -1 +1 @@
1
- import{c as f,F as C,bc as S,e2 as p,bb as T}from"./index-jBhflmZo.js";import{S as I,u as A}from"./use-mcp-client-R2QQiv_i.js";function v(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let g;o[12]!==e?(g=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=g):g=o[13];let r;o[14]!==s||o[15]!==g?(r={...s,additionalToolArgs:g},o[14]=s,o[15]=g,o[16]=r):r=o[16];const N=r,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:I,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const O=A(a);return p(u.id,"CONNECTIONS",O,N)}function E(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:I,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=A(n);return T(i.id,"CONNECTIONS",t,l)}function _(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:I,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=A(i);return S(o.id,"CONNECTIONS",n)}export{E as a,_ as b,v as u};
1
+ import{c as f,F as C,bc as S,e2 as p,bb as T}from"./index-BphIXXOp.js";import{S as I,u as A}from"./use-mcp-client-DKcZ7v-W.js";function v(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let g;o[12]!==e?(g=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=g):g=o[13];let r;o[14]!==s||o[15]!==g?(r={...s,additionalToolArgs:g},o[14]=s,o[15]=g,o[16]=r):r=o[16];const N=r,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:I,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const O=A(a);return p(u.id,"CONNECTIONS",O,N)}function E(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:I,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=A(n);return T(i.id,"CONNECTIONS",t,l)}function _(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:I,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=A(i);return S(o.id,"CONNECTIONS",n)}export{E as a,_ as b,v as u};
@@ -1 +1 @@
1
- import{c as i,r as n}from"./index-jBhflmZo.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
1
+ import{c as i,r as n}from"./index-BphIXXOp.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
@@ -1 +1 @@
1
- import{c as g}from"./index-jBhflmZo.js";import{b as f}from"./use-virtual-mcp-CiOr7IuV.js";import{c as p}from"./use-navigate-to-agent-C5c_zhXd.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
1
+ import{c as g}from"./index-BphIXXOp.js";import{b as f}from"./use-virtual-mcp-IokMTZJW.js";import{c as p}from"./use-navigate-to-agent-Cxg9_mL_.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
@@ -1 +1 @@
1
- import{r as u}from"./index-jBhflmZo.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
1
+ import{r as u}from"./index-BphIXXOp.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
@@ -1 +1 @@
1
- import{c as m,r as n}from"./index-jBhflmZo.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
1
+ import{c as m,r as n}from"./index-BphIXXOp.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-jBhflmZo.js";import{d as R,c as u}from"./decopilot-sse-pool--JEFoD5H.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-BphIXXOp.js";import{d as R,c as u}from"./decopilot-sse-pool-U92pbu07.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,b9 as re,ba as ae}from"./index-jBhflmZo.js";import{c as z,d as G,b as V,f as X,g as Z,e as ee,a as te,A as ne}from"./alert-dialog-CS8t3mLK.js";import{u as de}from"./studio-tools-ieYMpp9b.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 F;e[56]!==_?(F=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=F):F=e[57];let b;e[58]!==A||e[59]!==F?(b=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,F]})}),e[58]=A,e[59]=F,e[60]=b):b=e[60];let I;e[61]!==y||e[62]!==b?(I=n.jsxs(V,{children:[y,b]}),e[61]=y,e[62]=b,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,b9 as re,ba as ae}from"./index-BphIXXOp.js";import{c as z,d as G,b as V,f as X,g as Z,e as ee,a as te,A as ne}from"./alert-dialog-Cqq7FgQj.js";import{u as de}from"./studio-tools-BoD8kcA1.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 F;e[56]!==_?(F=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=F):F=e[57];let b;e[58]!==A||e[59]!==F?(b=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,F]})}),e[58]=A,e[59]=F,e[60]=b):b=e[60];let I;e[61]!==y||e[62]!==b?(I=n.jsxs(V,{children:[y,b]}),e[61]=y,e[62]=b,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-jBhflmZo.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-BphIXXOp.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-jBhflmZo.js";import{u as f}from"./studio-tools-ieYMpp9b.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{m as a,q as b,_ as c,I 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-BphIXXOp.js";import{u as f}from"./studio-tools-BoD8kcA1.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{m as a,q as b,_ as c,I as u};
@@ -1 +1 @@
1
- import{aV as l,e4 as d,e5 as v,r as i}from"./index-jBhflmZo.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{aV as l,e4 as d,e5 as v,r as i}from"./index-BphIXXOp.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-jBhflmZo.js";import{a as S}from"./use-capability-D4lFxacj.js";import{u as O}from"./studio-tools-ieYMpp9b.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-BphIXXOp.js";import{a as S}from"./use-capability-mz-0XBoJ.js";import{u as O}from"./studio-tools-BoD8kcA1.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};