decocms 4.43.2 → 4.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/dist/client/assets/{AlertCircle-CeIhzN_l.js → AlertCircle-B4rVzjGb.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DfTCnzGD.js → ArrowUpRight-Dfyxpo1c.js} +1 -1
  3. package/dist/client/assets/{Check-WVQH5yxa.js → Check-B8jlzVAe.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-DSPF4aUN.js → CheckCircle-BGBFQ7TU.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BCfLIH5T.js → ChevronDown-spisuOMX.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-B-Oyy1K1.js → ChevronRight-ClO8KFuz.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BLdWjTR3.js → ChevronUp-CjW_m4ZD.js} +1 -1
  8. package/dist/client/assets/{Circle-DHcpjdb_.js → Circle-DbRXoiZZ.js} +1 -1
  9. package/dist/client/assets/{Copy01-CzY5zLtf.js → Copy01-B3rMPdnI.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-BLsfOrM4.js → DotsVertical-D6_pKTzA.js} +1 -1
  11. package/dist/client/assets/{Eye-gA6jVXAd.js → Eye-Bca7Lcn-.js} +1 -1
  12. package/dist/client/assets/{FilterLines-EBWqq7Xu.js → FilterLines-C_kuJjS_.js} +1 -1
  13. package/dist/client/assets/{Globe01-feY0nKh_.js → Globe01-t_Xn7EOD.js} +1 -1
  14. package/dist/client/assets/{Globe04-C7AAKLVZ.js → Globe04-C4us4GD8.js} +1 -1
  15. package/dist/client/assets/{HardDrive-B_0butHa.js → HardDrive-DPY2W1oq.js} +1 -1
  16. package/dist/client/assets/{Key01-DMqGym6L.js → Key01-C4NN9OUR.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-CCd2X9Ad.js → LayoutLeft-SufEyqlt.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-CcywGheJ.js → LinkExternal01-CarrE4qF.js} +1 -1
  19. package/dist/client/assets/{List-CVGAxKAX.js → List-DdFdW6qh.js} +1 -1
  20. package/dist/client/assets/{Loading02-CmiQu1pl.js → Loading02-DpP2ZUzL.js} +1 -1
  21. package/dist/client/assets/{Monitor01-DAch4x7c.js → Monitor01-Di2J1pIG.js} +1 -1
  22. package/dist/client/assets/{Palette-DFnIddyo.js → Palette-DfvsIzkI.js} +1 -1
  23. package/dist/client/assets/{Play-vqCUlmDD.js → Play-C4x8-9Mt.js} +1 -1
  24. package/dist/client/assets/{Plus-ZE1JxTF6.js → Plus-B0nun22d.js} +1 -1
  25. package/dist/client/assets/{SearchLg-D2N8R9Nk.js → SearchLg-DQbhUEwD.js} +1 -1
  26. package/dist/client/assets/{SearchMd-CaBT-6p_.js → SearchMd-ByGwfofO.js} +1 -1
  27. package/dist/client/assets/{Settings02-DdGp-K93.js → Settings02-DOBWjsq7.js} +1 -1
  28. package/dist/client/assets/{Shield01-FoHeAFEB.js → Shield01-Cbocz3h7.js} +1 -1
  29. package/dist/client/assets/{Star01-D4eDNr0F.js → Star01-DVZvfUNG.js} +1 -1
  30. package/dist/client/assets/{Stars01-BM9lgZA4.js → Stars01-BQBCKlQH.js} +1 -1
  31. package/dist/client/assets/{Stars02-DxqFtma3.js → Stars02-5EW8AGHQ.js} +1 -1
  32. package/dist/client/assets/{Sun-jMKWVpok.js → Sun-iQ9ZpSHi.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-DQYstVKd.js → SwitchHorizontal01-l385tnk6.js} +1 -1
  34. package/dist/client/assets/{Tool01-C8AkhemH.js → Tool01-DqOmVP7D.js} +1 -1
  35. package/dist/client/assets/{Trash01-CHOvnt78.js → Trash01-DUs3g8yj.js} +1 -1
  36. package/dist/client/assets/{Upload01-3eWew1xB.js → Upload01-pIKYD9iV.js} +1 -1
  37. package/dist/client/assets/{User01-BN69CLHJ.js → User01-B-D44sqE.js} +1 -1
  38. package/dist/client/assets/{Users01-Ci_ws_VC.js → Users01-DQ-Z1cTM.js} +1 -1
  39. package/dist/client/assets/{Users03-B59cocJE.js → Users03-DUE7duSR.js} +1 -1
  40. package/dist/client/assets/{X-A4bflze9.js → X-DXVAJV8x.js} +1 -1
  41. package/dist/client/assets/{XCircle-CVhc7f91.js → XCircle-DWSiH6uW.js} +1 -1
  42. package/dist/client/assets/{XClose-CT2qln5j.js → XClose-CiCDgOUG.js} +1 -1
  43. package/dist/client/assets/{Zap-BsBjWU3t.js → Zap-BnHiHTqy.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-DLhh9jUV.js → ZapSquare-6fv6OHRe.js} +1 -1
  45. package/dist/client/assets/{ZoomOut-Ba8by3et.js → ZoomOut-H4y0o0fz.js} +1 -1
  46. package/dist/client/assets/{access-gate-CX7dYbyt.js → access-gate-Ba3RACeg.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-B4RbvfBl.js → add-section-modal-AWqdUvsG.js} +1 -1
  48. package/dist/client/assets/{agent-capabilities-Cy_FyUQh.js → agent-capabilities-C8aAokhv.js} +1 -1
  49. package/dist/client/assets/{agent-icon-RfWwE9MD.js → agent-icon-CNKD9od7.js} +1 -1
  50. package/dist/client/assets/{agents-list-BzCcnsIz.js → agents-list-BTPTEMfn.js} +1 -1
  51. package/dist/client/assets/{ai-providers-ChDNRsKv.js → ai-providers-BLlVFynS.js} +1 -1
  52. package/dist/client/assets/{alert-CXIV50wi.js → alert-CDpGekNd.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-yqhgP4hj.js → alert-dialog-NIL7nG4k.js} +1 -1
  54. package/dist/client/assets/{app-editor-NgHZcWof.js → app-editor-wfvFpkuk.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-BKadDqF1.js → auth-catchall-B1PaA5ER.js} +1 -1
  56. package/dist/client/assets/{auth-entry-Cwowy8mG.js → auth-entry-CY4VryVo.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-CpAHZeyz.js → auth-split-layout-DfErsUKb.js} +1 -1
  58. package/dist/client/assets/{auth-2QEQeQe9.js → auth-stk4L42H.js} +1 -1
  59. package/dist/client/assets/{authenticate-and-persist-oauth-G879iPre.js → authenticate-and-persist-oauth-XK4s1c0p.js} +1 -1
  60. package/dist/client/assets/{automation-list-row-CpS2pwCu.js → automation-list-row-CY9TbBsv.js} +1 -1
  61. package/dist/client/assets/{automation-runs-qnj_dOPl.js → automation-runs-CZZ0My05.js} +45 -45
  62. package/dist/client/assets/{automations-9kOyweqT.js → automations-DCNHo59-.js} +1 -1
  63. package/dist/client/assets/{autosend-Ca67mpUq.js → autosend-CIRnSFlG.js} +1 -1
  64. package/dist/client/assets/{avatar-DNqtrvfI.js → avatar-DovY7muZ.js} +1 -1
  65. package/dist/client/assets/{badge-BprYFRtN.js → badge-D4pyOmCp.js} +1 -1
  66. package/dist/client/assets/{block-document-Urr2c0F_.js → block-document-BYDEsiJ_.js} +1 -1
  67. package/dist/client/assets/{brand-context-CNOSkfr0.js → brand-context-DvYi6-XP.js} +1 -1
  68. package/dist/client/assets/{breadcrumb-BQp3Ac7T.js → breadcrumb-pCkbw6OY.js} +1 -1
  69. package/dist/client/assets/{buckets-ZVDvkyWX.js → buckets-BsC8nyU2.js} +1 -1
  70. package/dist/client/assets/{bulk-category-panel-DZRvy3EL.js → bulk-category-panel-CoeA7JSk.js} +1 -1
  71. package/dist/client/assets/{calendar-Dxh-u67O.js → calendar-0_GqbDzm.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-Cv8z3yAp.js → capability-load-error-B60fSBlC.js} +1 -1
  73. package/dist/client/assets/{card-BM-m_xgk.js → card-dWlW4g_n.js} +1 -1
  74. package/dist/client/assets/{category-editor-CRA_C7ch.js → category-editor-DruE0BjC.js} +1 -1
  75. package/dist/client/assets/{chat-context-BIEy3GO6.js → chat-context-DHy9Wrla.js} +1 -1
  76. package/dist/client/assets/{checkbox-BvN2_X-L.js → checkbox-Y7mBxqC3.js} +1 -1
  77. package/dist/client/assets/{cli-auth-success-BRtHcFrZ.js → cli-auth-success-DiCbL1Er.js} +1 -1
  78. package/dist/client/assets/{collection-detail-CTekAu0w.js → collection-detail-l361o0RK.js} +1 -1
  79. package/dist/client/assets/{collection-display-button-DKCH885f.js → collection-display-button-Cf-bCK_T.js} +1 -1
  80. package/dist/client/assets/{collection-search-z1c-OIMq.js → collection-search-DI69OYkt.js} +1 -1
  81. package/dist/client/assets/{collection-table-wrapper-BvEPqoQz.js → collection-table-wrapper-B66nKUMI.js} +1 -1
  82. package/dist/client/assets/{collection-tabs-CwsBPM-c.js → collection-tabs-CQALAm3p.js} +1 -1
  83. package/dist/client/assets/{command-eUIMnfT_.js → command-COJkBM8v.js} +1 -1
  84. package/dist/client/assets/{commerce-onboarding-DEKvlmZy.js → commerce-onboarding-DXRmlM2N.js} +1 -1
  85. package/dist/client/assets/{connect-desktop-dialog-tWWNbof3.js → connect-desktop-dialog-D-rafo3k.js} +1 -1
  86. package/dist/client/assets/{connection-card-BAiqBQka.js → connection-card-ByKWgKNO.js} +1 -1
  87. package/dist/client/assets/{connection-detail-CdYi1qHz.js → connection-detail-Dg36mp8u.js} +1 -1
  88. package/dist/client/assets/{connection-form-helpers-D7avntPs.js → connection-form-helpers-BX_278as.js} +1 -1
  89. package/dist/client/assets/{connections-rM94yjHl.js → connections-CZHHO9KT.js} +1 -1
  90. package/dist/client/assets/{decopilot-sse-pool-Ddi9cv7p.js → decopilot-sse-pool-CEetn8QJ.js} +1 -1
  91. package/dist/client/assets/{dialog-DVfr6U1Q.js → dialog-DLuAdZWN.js} +1 -1
  92. package/dist/client/assets/{domain-settings-Ccomq6mi.js → domain-settings-2jpVqBax.js} +1 -1
  93. package/dist/client/assets/{drawer-DrJLyRrS.js → drawer-BT0nO7Gh.js} +1 -1
  94. package/dist/client/assets/{dropdown-menu-Y95r2cEN.js → dropdown-menu-DzMUoAiU.js} +1 -1
  95. package/dist/client/assets/{empty-state-BZYzMqQn.js → empty-state-3-SuFfhy.js} +1 -1
  96. package/dist/client/assets/{extract-connection-data-GBMA3Mly.js → extract-connection-data-89-kNEsj.js} +1 -1
  97. package/dist/client/assets/{file-explorer-BVkd5Orn.js → file-explorer-0aXwnpWs.js} +1 -1
  98. package/dist/client/assets/{file-type-icon-BMuZwTUw.js → file-type-icon-D3Rdi0rC.js} +1 -1
  99. package/dist/client/assets/{files-BDA5Iui2.js → files-B027snaR.js} +1 -1
  100. package/dist/client/assets/{form-Cr_F07qT.js → form-B7RrBOMB.js} +1 -1
  101. package/dist/client/assets/{general-Dzm5xAsA.js → general-MXo-eiCz.js} +1 -1
  102. package/dist/client/assets/{github-repo-picker-BeZYm6Y_.js → github-repo-picker-Dykj2qFx.js} +1 -1
  103. package/dist/client/assets/{hooks-airELZ_8.js → hooks-BmOjuM2y.js} +1 -1
  104. package/dist/client/assets/{index-D-SwvQEx.js → index-B6-R74kF.js} +1 -1
  105. package/dist/client/assets/{index-7DOewpHx.js → index-BHnyvT_3.js} +1 -1
  106. package/dist/client/assets/{index-XJyq3Z1f.js → index-BKUm7yV5.js} +1 -1
  107. package/dist/client/assets/{index-ClYtmMEi.js → index-C88R47Te.js} +1 -1
  108. package/dist/client/assets/{index-DbCdW3fQ.js → index-CHV2oFtV.js} +1 -1
  109. package/dist/client/assets/{index-DXQaR7BD.js → index-Co9s1ivM.js} +1 -1
  110. package/dist/client/assets/{index-BzDAMSl8.js → index-D4SvmBXn.js} +1 -1
  111. package/dist/client/assets/{index-BI1D40Bb.js → index-Dsd_iuEd.js} +3 -3
  112. package/dist/client/assets/{index-BKIAYB4q.js → index-HPYN2PdL.js} +28 -28
  113. package/dist/client/assets/{index-Bc33NLzg.js → index-RuoMzh-H.js} +1 -1
  114. package/dist/client/assets/{index-DXgMPhVD.js → index-Vjr9jkQV.js} +1 -1
  115. package/dist/client/assets/{index-D6lqM2He.js → index-Y-ZfkmZF.js} +1 -1
  116. package/dist/client/assets/{index-CpEjZ19A.js → index-aXWMNPUL.js} +1 -1
  117. package/dist/client/assets/{index-redirect-DXhzmGs_.js → index-redirect-Bd7v9-WJ.js} +1 -1
  118. package/dist/client/assets/{index-DT7Spi_3.js → index-v9USPf5e.js} +1 -1
  119. package/dist/client/assets/{input-CFV763iN.js → input-DVEzPKKj.js} +1 -1
  120. package/dist/client/assets/{integration-icon-BzRUrmhb.js → integration-icon-DqkK9Eex.js} +1 -1
  121. package/dist/client/assets/{invite-member-dialog-BdjfV4Pz.js → invite-member-dialog-aSyF--9v.js} +1 -1
  122. package/dist/client/assets/{label-D3fiZK_8.js → label-KpXEJk-h.js} +1 -1
  123. package/dist/client/assets/{login-BOVNSU48.js → login-BGtPU3zp.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-BmK9oSzX.js → mcp-oauth-5ck9cQwI.js} +1 -1
  125. package/dist/client/assets/{members-DuaXGl7e.js → members-idKzRDYv.js} +1 -1
  126. package/dist/client/assets/{monaco-editor-DJ2sFoTh.js → monaco-editor-Cnz_x1QX.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-CiaOXH84.js → monitoring-stats-row-T8_LT2mu.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-BtVF3x2r.js → oauth-callback-I9jTcfGb.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-ai-provider-B6tsvy2q.js → oauth-callback-ai-provider-CU_1ZVLh.js} +1 -1
  130. package/dist/client/assets/{onboarding-r6196vI_.js → onboarding-Bt8QKfCp.js} +1 -1
  131. package/dist/client/assets/{org-install-shtuxsdR.js → org-install-C2zin4AI.js} +1 -1
  132. package/dist/client/assets/{org-layout-CN9CDejf.js → org-layout-Bh3-XY86.js} +1 -1
  133. package/dist/client/assets/{organization-choice-DP81BQn8.js → organization-choice-JDEOL7JM.js} +1 -1
  134. package/dist/client/assets/{page-seo-form-rz6XACmv.js → page-seo-form-DeODCAhK.js} +1 -1
  135. package/dist/client/assets/page-seo-sheet-CVR9HjS8.js +1 -0
  136. package/dist/client/assets/{popover-C2A6_B6a.js → popover-3culmC-p.js} +1 -1
  137. package/dist/client/assets/{post-editor-CxYAqhcv.js → post-editor-DIJccDUr.js} +1 -1
  138. package/dist/client/assets/{primitives-B_LaT2mw.js → primitives-BbmSNqPJ.js} +1 -1
  139. package/dist/client/assets/{profile-Dwvov7La.js → profile-CuAydmDk.js} +1 -1
  140. package/dist/client/assets/project-app-view-DGhuLLKh.js +1 -0
  141. package/dist/client/assets/record-editor-BTu8np7Q.js +1 -0
  142. package/dist/client/assets/registry-B4WUAUlx.js +2 -0
  143. package/dist/client/assets/{registry-layout-BYYPG8AZ.js → registry-layout-CiCt5ymy.js} +1 -1
  144. package/dist/client/assets/{require-capability-CTiv9Z0m.js → require-capability-BSa2WA-C.js} +1 -1
  145. package/dist/client/assets/{required-auth-layout-yvVLN6Hm.js → required-auth-layout-Dpk92TPe.js} +1 -1
  146. package/dist/client/assets/{reset-password-rhtFYAvJ.js → reset-password-BEbPod4b.js} +1 -1
  147. package/dist/client/assets/{roles-1up0vpJR.js → roles-B9iwgL6L.js} +1 -1
  148. package/dist/client/assets/{search-input-z-SZ5xmX.js → search-input-Db1F0jx-.js} +1 -1
  149. package/dist/client/assets/{secrets-DXWs6lzR.js → secrets-ChiNNGn-.js} +1 -1
  150. package/dist/client/assets/{sections-editor-DvO7fC1v.js → sections-editor-B9Rsf1XY.js} +1 -1
  151. package/dist/client/assets/{select-DtepIC1g.js → select-BkgqDf7e.js} +1 -1
  152. package/dist/client/assets/{select-model-pOunWX2H.js → select-model-CwXaZaFK.js} +1 -1
  153. package/dist/client/assets/{seo-editor-D_Gd5FQ3.js → seo-editor-BIHoQK1Q.js} +1 -1
  154. package/dist/client/assets/{settings-layout-IdkMWTo4.js → settings-layout-GT95_RRP.js} +1 -1
  155. package/dist/client/assets/{settings-section-BxArx8B4.js → settings-section-B1yWeiiF.js} +1 -1
  156. package/dist/client/assets/{shell-controls-DIkDIVCH.js → shell-controls-Bi1SklEo.js} +1 -1
  157. package/dist/client/assets/{shell-layout-BG9xor_B.js → shell-layout-BIM9a05w.js} +1 -1
  158. package/dist/client/assets/{sidebar-CoQlGXUH.js → sidebar-BBuVIXs3.js} +1 -1
  159. package/dist/client/assets/{skeleton-Cpt27Mrt.js → skeleton-DSOwcq5l.js} +1 -1
  160. package/dist/client/assets/{sso-BlmthKGR.js → sso-Dcnx4HXH.js} +1 -1
  161. package/dist/client/assets/{store-C2evtg_N.js → store-Cqpx1B5k.js} +1 -1
  162. package/dist/client/assets/store-registry-C0Mlgj0K.js +2 -0
  163. package/dist/client/assets/{studio-tools-DEGpQ95m.js → studio-tools-CTXw_HGo.js} +1 -1
  164. package/dist/client/assets/{switch-B7feKVs7.js → switch-Dukm50CX.js} +1 -1
  165. package/dist/client/assets/{table-BbTBSKn5.js → table-1C1nYcaS.js} +1 -1
  166. package/dist/client/assets/{tabs-DjXPPUR2.js → tabs-E6RgSpIm.js} +1 -1
  167. package/dist/client/assets/{textarea-Dq7eH56b.js → textarea-Cq3eLWgU.js} +1 -1
  168. package/dist/client/assets/{toggle-group-2w_n_L5K.js → toggle-group-DSuixrOu.js} +1 -1
  169. package/dist/client/assets/{toolbar-CeFkCbVX.js → toolbar-BgxtbB8k.js} +1 -1
  170. package/dist/client/assets/{toolbar-icon-button-CLKQStf7.js → toolbar-icon-button-AVA73zGb.js} +1 -1
  171. package/dist/client/assets/{tools-list-uNF3PJAj.js → tools-list-C1X0VZfQ.js} +1 -1
  172. package/dist/client/assets/{tooltip-DYkdUcwK.js → tooltip-CQRmXLdK.js} +1 -1
  173. package/dist/client/assets/{types-qnoLRMPf.js → types-DkVBp3lw.js} +1 -1
  174. package/dist/client/assets/{use-ai-providers-CAsm11ID.js → use-ai-providers-BvN_YPeM.js} +1 -1
  175. package/dist/client/assets/{use-automations-AFDXGXPs.js → use-automations-C-qbYs9z.js} +1 -1
  176. package/dist/client/assets/{use-capability-DGt12O9N.js → use-capability-odB-d61W.js} +1 -1
  177. package/dist/client/assets/{use-clock-tick-DG2pLp-q.js → use-clock-tick-fro43T2v.js} +1 -1
  178. package/dist/client/assets/{use-collections-BpWFaBIs.js → use-collections-YymHP9DJ.js} +1 -1
  179. package/dist/client/assets/{use-connection-DPLDQYO_.js → use-connection-BjAQgmP6.js} +1 -1
  180. package/dist/client/assets/{use-copy-B_rqSo6t.js → use-copy-Bk6Ve8B3.js} +1 -1
  181. package/dist/client/assets/{use-create-virtual-mcp-BefguK-c.js → use-create-virtual-mcp-DLqqtGBm.js} +1 -1
  182. package/dist/client/assets/{use-debounced-autosave-4yffmoWA.js → use-debounced-autosave-CV4B4Gkf.js} +1 -1
  183. package/dist/client/assets/{use-debounced-value-DNKtJ7rs.js → use-debounced-value-BU9d5vE5.js} +1 -1
  184. package/dist/client/assets/{use-decopilot-events-C_VHZWO-.js → use-decopilot-events-TPOfwfqa.js} +1 -1
  185. package/dist/client/assets/{use-delete-connection-eSU40H6l.js → use-delete-connection-BhAWG9Xb.js} +1 -1
  186. package/dist/client/assets/{use-file-configs-Cq7kWeal.js → use-file-configs-DA4-SvXK.js} +1 -1
  187. package/dist/client/assets/{use-infinite-scroll-CSzTWLnA.js → use-infinite-scroll-BDJdA7B_.js} +1 -1
  188. package/dist/client/assets/{use-join-requests-DZ57jRcU.js → use-join-requests-C7vqcl8I.js} +1 -1
  189. package/dist/client/assets/{use-mcp-client-9lFASwC0.js → use-mcp-client-B6xEVCdZ.js} +1 -1
  190. package/dist/client/assets/{use-mcp-prompts-DTsMk0A1.js → use-mcp-prompts-C2qEigUb.js} +1 -1
  191. package/dist/client/assets/{use-mcp-tools-DUQ6pfgC.js → use-mcp-tools-CMNfuH8d.js} +1 -1
  192. package/dist/client/assets/{use-members-Dr-MIVal.js → use-members-DfknS5vp.js} +1 -1
  193. package/dist/client/assets/{use-mobile-CCpRJzNQ.js → use-mobile-zlseXNZw.js} +1 -1
  194. package/dist/client/assets/{use-navigate-to-agent-BLGuQu2W.js → use-navigate-to-agent-DukigbvT.js} +1 -1
  195. package/dist/client/assets/{use-org-auth-client-DXbKeKAB.js → use-org-auth-client-C-Z33Ztc.js} +1 -1
  196. package/dist/client/assets/{use-org-sso-DeEfR5na.js → use-org-sso-BxT29NsJ.js} +1 -1
  197. package/dist/client/assets/{use-organization-roles-6jciUWXs.js → use-organization-roles-CGYFQ6NZ.js} +1 -1
  198. package/dist/client/assets/{use-organization-settings-CG0jiKsK.js → use-organization-settings-DVhD0MdP.js} +1 -1
  199. package/dist/client/assets/{use-registry-connections-NeJTwcjk.js → use-registry-connections-vzpQSjWc.js} +1 -1
  200. package/dist/client/assets/{use-secrets-BPpuxuTF.js → use-secrets-B-_MN6-3.js} +1 -1
  201. package/dist/client/assets/{use-status-sounds-DwBuWAo_.js → use-status-sounds-BERlBf-i.js} +1 -1
  202. package/dist/client/assets/{use-view-mode-D0JomyIt.js → use-view-mode-FN-UaNtL.js} +1 -1
  203. package/dist/client/assets/{use-virtual-mcp-uIDmqhnP.js → use-virtual-mcp-CR8RESJp.js} +1 -1
  204. package/dist/client/assets/useInfiniteQuery-BZ1RPZ6t.js +1 -0
  205. package/dist/client/assets/useSuspenseInfiniteQuery-5igL8BlZ.js +1 -0
  206. package/dist/client/assets/{variant-calendar-AOQNJVM8.js → variant-calendar-qksd53wK.js} +1 -1
  207. package/dist/client/assets/{view-mode-toggle-8ZM9vm8_.js → view-mode-toggle-BNlr5OK8.js} +1 -1
  208. package/dist/client/index.html +1 -1
  209. package/dist/server/cli.js +426 -425
  210. package/dist/server/server.js +299 -298
  211. package/package.json +1 -1
  212. package/dist/client/assets/page-seo-sheet-BiiSKqR8.js +0 -1
  213. package/dist/client/assets/project-app-view-Clk59c4z.js +0 -1
  214. package/dist/client/assets/record-editor-NkNhuLct.js +0 -1
  215. package/dist/client/assets/registry-ChnwJUmp.js +0 -2
  216. package/dist/client/assets/store-registry-CedYa-Zn.js +0 -2
  217. package/dist/client/assets/useInfiniteQuery-DV3NRVjb.js +0 -1
  218. package/dist/client/assets/useSuspenseInfiniteQuery-xlgt9BjN.js +0 -1
@@ -1 +1 @@
1
- import{c as $,j as s,Y as He,r as E,l as F,M as oe,Z as bs,_ as js,a as he,$ as se,b as xe,a0 as vs,a1 as ys,t as re,a2 as Ss,a3 as Ns,K as _s,k as Cs,a4 as ws,i as Lt,e as lt,u as rt,P as Rt,G as ks,H as As,I as Is,J as zs,d as $s,B as Je,a5 as Ts,T as Ms,U as Os,a6 as Ps,X as Ds,a7 as Fs}from"./index-BI1D40Bb.js";import{u as pe,S as ot,a as at,b as ae,c as J,d as K,e as Bt,f as Ht,g as Es,h as Ls,i as Ze,j as Rs,k as Bs,l as Hs}from"./sidebar-CoQlGXUH.js";import{u as ct}from"./use-mobile-CCpRJzNQ.js";import{S as te}from"./skeleton-Cpt27Mrt.js";import{i as Gt}from"./LayoutLeft-CCd2X9Ad.js";import{T as ve}from"./toolbar-icon-button-CLKQStf7.js";import{P as Ge,a as ze,b as Ue}from"./popover-C2A6_B6a.js";import{D as Ut,a as Wt,b as qt}from"./drawer-DrJLyRrS.js";import{A as Le}from"./avatar-DNqtrvfI.js";import{a as ce,b as de,c as et,T as me}from"./tooltip-DYkdUcwK.js";import{a as gt}from"./Copy01-CzY5zLtf.js";import{n as Gs,i as Us}from"./Globe01-feY0nKh_.js";import{i as Ws}from"./ZoomOut-Ba8by3et.js";import{i as qs,a as Ks}from"./ZapSquare-DLhh9jUV.js";import{i as tt}from"./Monitor01-DAch4x7c.js";import{n as Xs,a as Vs}from"./Sun-jMKWVpok.js";import{a as dt}from"./Settings02-DdGp-K93.js";import{i as Ys}from"./Shield01-FoHeAFEB.js";import{a as Qs}from"./Users03-B59cocJE.js";import{a as bt,b as jt,c as Js,d as Zs,A as ye,e as vt,i as en,s as tn,f as sn}from"./agent-icon-RfWwE9MD.js";import"./index-Bc33NLzg.js";import{I as nn}from"./invite-member-dialog-BdjfV4Pz.js";import{u as ln,A as rn,g as on,a as an,b as Kt}from"./agent-capabilities-Cy_FyUQh.js";import{u as cn,v as dn,C as yt}from"./connect-desktop-dialog-tWWNbof3.js";import{i as mn}from"./FilterLines-EBWqq7Xu.js";import{T as un,a as fn}from"./toggle-group-2w_n_L5K.js";import{u as hn}from"./use-mcp-client-9lFASwC0.js";import{S as xn,a as Re,i as pn,b as gn}from"./constants-B72Xmt_K.js";import{u as mt,a as Xt}from"./use-virtual-mcp-uIDmqhnP.js";import{u as bn,a as ut,b as Vt,T as jn}from"./hooks-airELZ_8.js";import{u as ft,r as vn}from"./shell-layout-BG9xor_B.js";import{c as yn,a as Sn,b as Nn,d as _n,e as Cn}from"./dialog-DVfr6U1Q.js";import{C as wn,a as kn,b as An,c as In,d as zn}from"./command-eUIMnfT_.js";import{u as Yt}from"./studio-tools-DEGpQ95m.js";import{i as Qt}from"./Zap-BsBjWU3t.js";import{S as Jt,M as $n}from"./shell-controls-DIkDIVCH.js";import{n as Tn}from"./Stars02-DxqFtma3.js";import{g as Mn,u as On,S as Pn}from"./use-clock-tick-DG2pLp-q.js";import{f as Dn}from"./format-time-Cy7tTmZp.js";import{t as ht}from"./ChevronDown-BCfLIH5T.js";import{i as Fn}from"./ChevronRight-B-Oyy1K1.js";import{S as Zt,u as En,g as Ln,a as Rn,b as Bn}from"./use-navigate-to-agent-BLGuQu2W.js";import{S as Hn,C as Gn}from"./chat-context-BIEy3GO6.js";import{B as St,a as Un,b as Wn}from"./breadcrumb-BQp3Ac7T.js";import{i as es}from"./Check-WVQH5yxa.js";import{s as $e}from"./Plus-ZE1JxTF6.js";import{i as ts}from"./SearchMd-CaBT-6p_.js";import{s as qn}from"./XClose-CT2qln5j.js";import{A as Kn,a as Xn,b as Vn,c as Yn,d as Qn,e as Jn,f as Zn}from"./alert-dialog-yqhgP4hj.js";import{F as ei,a as ti,b as si,c as ni,d as ii,f as li,e as ri}from"./form-Cr_F07qT.js";import{I as oi}from"./input-CFV763iN.js";import{G as ai,a as ci}from"./github-repo-picker-BeZYm6Y_.js";import{f as di}from"./reusable-new-chat-qqWu133U.js";import{T as Q}from"./toolbar-CeFkCbVX.js";import{u as mi}from"./use-organization-settings-CG0jiKsK.js";import"./X-A4bflze9.js";import"./User01-BN69CLHJ.js";import"./AlertCircle-CeIhzN_l.js";import"./Tool01-C8AkhemH.js";import"./SwitchHorizontal01-DQYstVKd.js";import"./XCircle-CVhc7f91.js";import"./ArrowUpRight-DfTCnzGD.js";import"./Loading02-CmiQu1pl.js";import"./CheckCircle-DSPF4aUN.js";import"./ChevronUp-BLdWjTR3.js";import"./Circle-DHcpjdb_.js";import"./DotsVertical-BLsfOrM4.js";import"./Eye-gA6jVXAd.js";import"./Star01-D4eDNr0F.js";import"./Globe04-C7AAKLVZ.js";import"./HardDrive-B_0butHa.js";import"./Key01-DMqGym6L.js";import"./LinkExternal01-CcywGheJ.js";import"./List-CVGAxKAX.js";import"./Palette-DFnIddyo.js";import"./Play-vqCUlmDD.js";import"./SearchLg-D2N8R9Nk.js";import"./Stars01-BM9lgZA4.js";import"./Trash01-CHOvnt78.js";import"./Upload01-3eWew1xB.js";import"./Users01-Ci_ws_VC.js";import"./select-DtepIC1g.js";import"./textarea-Dq7eH56b.js";import"./use-org-auth-client-DXbKeKAB.js";import"./use-organization-roles-6jciUWXs.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-BAiqBQka.js";import"./use-registry-connections-NeJTwcjk.js";import"./use-connection-DPLDQYO_.js";import"./use-collections-BpWFaBIs.js";import"./useInfiniteQuery-DV3NRVjb.js";import"./use-infinite-scroll-CSzTWLnA.js";import"./extract-connection-data-GBMA3Mly.js";import"./card-BM-m_xgk.js";import"./integration-icon-BzRUrmhb.js";import"./collection-search-z1c-OIMq.js";import"./collection-tabs-CwsBPM-c.js";import"./badge-BprYFRtN.js";import"./connection-form-helpers-D7avntPs.js";import"./authenticate-and-persist-oauth-G879iPre.js";import"./mcp-oauth-BmK9oSzX.js";import"./auth-2QEQeQe9.js";import"./useSuspenseInfiniteQuery-xlgt9BjN.js";import"./use-ai-providers-CAsm11ID.js";import"./decopilot-sse-pool-Ddi9cv7p.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./required-auth-layout-yvVLN6Hm.js";import"./autosend-Ca67mpUq.js";import"./tab-id-DAJ8K7VA.js";import"./use-org-sso-DeEfR5na.js";import"./index-BzDAMSl8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-decopilot-events-C_VHZWO-.js";import"./label-D3fiZK_8.js";import"./use-debounced-value-DNKtJ7rs.js";import"./use-mcp-tools-DUQ6pfgC.js";import"./github-installations-DzN1UQ4x.js";function ui(t){const e=$.c(5),{onPointerDown:n,onDoubleClick:l}=t,{state:i,isMobile:r}=pe();if(r||i==="collapsed")return null;let a,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={left:"var(--sidebar-width)"},o=s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border"}),e[0]=a,e[1]=o):(a=e[0],o=e[1]);let d;return e[2]!==l||e[3]!==n?(d=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize, double-click to reset",onPointerDown:n,onDoubleClick:l,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize",style:a,children:o}),e[2]=l,e[3]=n,e[4]=d):d=e[4],d}const xt=240,fi=400,hi="sidebar.width";function Te(t){return Math.max(xt,Math.min(fi,t))}function xi(){const t=$.c(11),[e,n]=He(hi,pi),l=E.useRef(null);let i;t[0]!==n||t[1]!==e?(i=m=>{m.preventDefault();const u=m.clientX,f=Te(e),h=l.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),g=h?Array.from(h.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const p of g)p.style.transition="none";const j=p=>{const b=Te(f+(p.clientX-u));h?.style.setProperty("--sidebar-width",`${b}px`)},x=p=>{const b=Te(f+(p.clientX-u));n(b);for(const v of g)v.style.transition="";window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",x),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",j),window.addEventListener("pointerup",x)},t[0]=n,t[1]=e,t[2]=i):i=t[2];const r=i;let a;t[3]!==n?(a=()=>{n(xt)},t[3]=n,t[4]=a):a=t[4];const o=a;let d;t[5]!==e?(d=Te(e),t[5]=e,t[6]=d):d=t[6];let c;return t[7]!==r||t[8]!==o||t[9]!==d?(c={width:d,wrapperRef:l,onStartResize:r,resetWidth:o},t[7]=r,t[8]=o,t[9]=d,t[10]=c):c=t[10],c}function pi(t){return typeof t=="number"?Te(t):xt}function ss(){return[]}function ns(t){const e=$.c(3),{children:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=l):l=e[0];let i;return e[1]!==n?(i=s.jsxs(ot,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[l,s.jsx(at,{children:s.jsx(ae,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=i):i=e[2],i}function is(t){const e=$.c(18),{item:n}=t,{isMobile:l,setOpenMobile:i}=pe();let r;e[0]!==l||e[1]!==n||e[2]!==i?(r=()=>{oe("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:l}),n.onClick?.(),l&&i(!1)},e[0]=l,e[1]=n,e[2]=i,e[3]=r):r=e[3];const a=r,o=n.key,d=n.isActive&&"z-10";let c;e[4]!==d?(c=F(d),e[4]=d,e[5]=c):c=e[5];let m;e[6]!==n.label?(m=s.jsx("span",{children:n.label}),e[6]=n.label,e[7]=m):m=e[7];let u;e[8]!==a||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==m?(u=s.jsxs(J,{onClick:a,isActive:n.isActive,tooltip:n.label,children:[n.icon,m]}),e[8]=a,e[9]=n.icon,e[10]=n.isActive,e[11]=n.label,e[12]=m,e[13]=u):u=e[13];let f;return e[14]!==n.key||e[15]!==c||e[16]!==u?(f=s.jsx(K,{className:c,children:u},o),e[14]=n.key,e[15]=c,e[16]=u,e[17]=f):f=e[17],f}function gi(t){const e=$.c(12),{section:n}=t;switch(n.type){case"divider":{let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Bt,{className:"my-2"}),e[0]=l):l=e[0],l}case"spacer":{let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex-1"}),e[1]=l):l=e[1],l}case"group":{const l=n.group.label,i=n.group.defaultExpanded;let r;e[2]!==n.group.items?(r=n.group.items.map(ji),e[2]=n.group.items,e[3]=r):r=e[3];let a;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==r?(a=s.jsx(ns,{label:l,defaultExpanded:i,children:r}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=r,e[7]=a):a=e[7],a}case"items":{let l;e[8]!==n.items?(l=n.items.map(bi),e[8]=n.items,e[9]=l):l=e[9];let i;return e[10]!==l?(i=s.jsx(ot,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(at,{children:s.jsx(ae,{className:"gap-1.5",children:l})})}),e[10]=l,e[11]=i):i=e[11],i}case"custom":return n.content}}function bi(t){return s.jsx(is,{item:t},t.key)}function ji(t){return s.jsx(is,{item:t},t.key)}function vi(t){const e=$.c(14),{sections:n,footer:l,additionalContent:i,variant:r,contentClassName:a}=t,o=r===void 0?"sidebar":r;let d;e[0]!==a?(d=F("flex flex-col flex-1 px-2 pb-2 gap-0.5",a),e[0]=a,e[1]=d):d=e[1];let c;e[2]!==n?(c=n.map(yi),e[2]=n,e[3]=c):c=e[3];let m;e[4]!==i?(m=i&&s.jsx("div",{className:"flex flex-col flex-1 min-h-0 group-data-[state=collapsed]/sidebar:mt-1 group-data-[state=expanded]/sidebar:mt-2",children:i}),e[4]=i,e[5]=m):m=e[5];let u;e[6]!==d||e[7]!==c||e[8]!==m?(u=s.jsxs(Ht,{className:d,children:[c,m]}),e[6]=d,e[7]=c,e[8]=m,e[9]=u):u=e[9];let f;return e[10]!==l||e[11]!==u||e[12]!==o?(f=s.jsxs(Es,{variant:o,children:[u,l]}),e[10]=l,e[11]=u,e[12]=o,e[13]=f):f=e[13],f}function yi(t,e){return s.jsx(gi,{section:t},e)}function ls(t){const e=$.c(2);let n;return e[0]!==t?(n=s.jsx(vi,{...t}),e[0]=t,e[1]=n):n=e[1],n}ls.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,n)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(te,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function Si(t){const e=$.c(16),{onToggle:n,className:l}=t,r=bs().logo??js,a=typeof r=="string"?r:r.light,o=typeof r=="string"?r:r.dark;let d;e[0]!==l?(d=F("flex flex-row items-center gap-2 md:gap-0.5 shrink-0 h-12 pl-1 pr-2 pt-0.25 pb-0","group-data-[collapsible=icon]/sidebar:hidden",l),e[0]=l,e[1]=d):d=e[1];let c;e[2]!==a?(c=s.jsx("img",{src:a,alt:"Logo",className:"size-6 object-contain dark:hidden"}),e[2]=a,e[3]=c):c=e[3];let m;e[4]!==o?(m=s.jsx("img",{src:o,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),e[4]=o,e[5]=m):m=e[5];let u;e[6]!==c||e[7]!==m?(u=s.jsx("span",{className:"flex items-center shrink-0 pl-1",children:s.jsxs("span",{className:"flex items-center shrink-0 px-2",children:[c,m]})}),e[6]=c,e[7]=m,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Gt,{size:16}),e[9]=f):f=e[9];let h;e[10]!==n?(h=s.jsx(ve,{onClick:n,"aria-label":"Toggle sidebar",children:f}),e[10]=n,e[11]=h):h=e[11];let g;return e[12]!==d||e[13]!==u||e[14]!==h?(g=s.jsxs(Ls,{className:d,children:[u,h]}),e[12]=d,e[13]=u,e[14]=h,e[15]=g):g=e[15],g}function Nt(t){const e=$.c(18),{item:n,onClose:l}=t,i=n.isActive&&"z-10";let r;e[0]!==i?(r=F(i),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==n||e[3]!==l?(a=()=>{n.onClick?.(),l()},e[2]=n,e[3]=l,e[4]=a):a=e[4];let o;e[5]!==n.icon?(o=s.jsx("span",{className:"[&>svg]:size-5 shrink-0",children:n.icon}),e[5]=n.icon,e[6]=o):o=e[6];let d;e[7]!==n.label?(d=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=d):d=e[8];let c;e[9]!==n.isActive||e[10]!==n.label||e[11]!==a||e[12]!==o||e[13]!==d?(c=s.jsxs(J,{onClick:a,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[o,d]}),e[9]=n.isActive,e[10]=n.label,e[11]=a,e[12]=o,e[13]=d,e[14]=c):c=e[14];let m;return e[15]!==r||e[16]!==c?(m=s.jsx(K,{className:r,children:c}),e[15]=r,e[16]=c,e[17]=m):m=e[17],m}function Ni(t){const e=$.c(18),{section:n,onClose:l}=t;switch(n.type){case"divider":{let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Bt,{className:"my-2"}),e[0]=i):i=e[0],i}case"spacer":{let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex-1"}),e[1]=i):i=e[1],i}case"group":{const i=n.group.label,r=n.group.defaultExpanded;let a;if(e[2]!==l||e[3]!==n.group.items){let d;e[5]!==l?(d=c=>s.jsx(Nt,{item:c,onClose:l},c.key),e[5]=l,e[6]=d):d=e[6],a=n.group.items.map(d),e[2]=l,e[3]=n.group.items,e[4]=a}else a=e[4];let o;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==a?(o=s.jsx(ns,{label:i,defaultExpanded:r,children:a}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=a,e[10]=o):o=e[10],o}case"items":{let i;if(e[11]!==l||e[12]!==n.items){let a;e[14]!==l?(a=o=>s.jsx(Nt,{item:o,onClose:l},o.key),e[14]=l,e[15]=a):a=e[15],i=n.items.map(a),e[11]=l,e[12]=n.items,e[13]=i}else i=e[13];let r;return e[16]!==i?(r=s.jsx(ot,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(at,{children:s.jsx(ae,{className:"gap-1.5",children:i})})}),e[16]=i,e[17]=r):r=e[17],r}case"custom":return n.content}}function _i(t){const e=$.c(17),{sections:n,onClose:l,footer:i,additionalContent:r}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"h-12 shrink-0"}),e[0]=a):a=e[0];let o;e[1]!==l?(o=s.jsx(E.Suspense,{fallback:a,children:s.jsx(Si,{onToggle:l})}),e[1]=l,e[2]=o):o=e[2];let d;if(e[3]!==l||e[4]!==n){let f;e[6]!==l?(f=(h,g)=>s.jsx(Ni,{section:h,onClose:l},g),e[6]=l,e[7]=f):f=e[7],d=n.map(f),e[3]=l,e[4]=n,e[5]=d}else d=e[5];let c;e[8]!==r?(c=r&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:r}),e[8]=r,e[9]=c):c=e[9];let m;e[10]!==d||e[11]!==c?(m=s.jsxs(Ht,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[d,c]}),e[10]=d,e[11]=c,e[12]=m):m=e[12];let u;return e[13]!==i||e[14]!==o||e[15]!==m?(u=s.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[o,m,i]}),e[13]=i,e[14]=o,e[15]=m,e[16]=u):u=e[16],u}function De(t){const e=$.c(22),{item:n,onClose:l}=t;if(n.href){const d=n.external?"_blank":void 0,c=n.external?"noopener noreferrer":void 0;let m;e[0]!==n.icon?(m=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[0]=n.icon,e[1]=m):m=e[1];let u;e[2]!==n.label?(u=s.jsx("span",{className:"flex-1",children:n.label}),e[2]=n.label,e[3]=u):u=e[3];let f;return e[4]!==n.href||e[5]!==l||e[6]!==d||e[7]!==c||e[8]!==m||e[9]!==u?(f=s.jsxs("a",{href:n.href,target:d,rel:c,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",onClick:l,children:[m,u]}),e[4]=n.href,e[5]=l,e[6]=d,e[7]=c,e[8]=m,e[9]=u,e[10]=f):f=e[10],f}let i;e[11]!==n||e[12]!==l?(i=()=>{n.onClick?.(),l()},e[11]=n,e[12]=l,e[13]=i):i=e[13];let r;e[14]!==n.icon?(r=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[14]=n.icon,e[15]=r):r=e[15];let a;e[16]!==n.label?(a=s.jsx("span",{className:"flex-1",children:n.label}),e[16]=n.label,e[17]=a):a=e[17];let o;return e[18]!==i||e[19]!==r||e[20]!==a?(o=s.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",children:[r,a]}),e[18]=i,e[19]=r,e[20]=a,e[21]=o):o=e[21],o}function _t(t){const e=$.c(126),{user:n,userImage:l,menuItems:i,signOutItem:r,themeOptions:a,preferences:o,setPreferences:d,close:c,isMobile:m}=t;if(m){const U=n?.name??"U";let q;e[0]!==U||e[1]!==l?(q=s.jsx(Le,{url:l,fallback:U,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=U,e[1]=l,e[2]=q):q=e[2];const B=n?.name??"User";let Z;e[3]!==B?(Z=s.jsx("p",{className:"text-sm font-medium truncate",children:B}),e[3]=B,e[4]=Z):Z=e[4];const ge=n?.email;let ee;e[5]!==ge?(ee=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:ge}),e[5]=ge,e[6]=ee):ee=e[6];let ue;e[7]!==Z||e[8]!==ee?(ue=s.jsxs("div",{className:"flex-1 min-w-0",children:[Z,ee]}),e[7]=Z,e[8]=ee,e[9]=ue):ue=e[9];let be;e[10]!==n?(be=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(Ai)},e[10]=n,e[11]=be):be=e[11];let ne;e[12]===Symbol.for("react.memo_cache_sentinel")?(ne=s.jsx(gt,{size:14}),e[12]=ne):ne=e[12];let fe;e[13]!==be?(fe=s.jsx(ce,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:be,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:ne})}),e[13]=be,e[14]=fe):fe=e[14];let je;e[15]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx(de,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=je):je=e[15];let T;e[16]!==fe?(T=s.jsx(et,{delayDuration:300,children:s.jsxs(me,{children:[fe,je]})}),e[16]=fe,e[17]=T):T=e[17];let H;e[18]!==T||e[19]!==q||e[20]!==ue?(H=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[q,ue,T]}),e[18]=T,e[19]=q,e[20]=ue,e[21]=H):H=e[21];let X;if(e[22]!==c||e[23]!==i){let le;e[25]!==c?(le=Pe=>s.jsx(De,{item:Pe,onClose:c},Pe.key),e[25]=c,e[26]=le):le=e[26],X=i.map(le),e[22]=c,e[23]=i,e[24]=X}else X=e[24];let W;e[27]!==c||e[28]!==r?(W=s.jsx(De,{item:r,onClose:c}),e[27]=c,e[28]=r,e[29]=W):W=e[29];let ie;e[30]!==X||e[31]!==W?(ie=s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:s.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[X,W]})}),e[30]=X,e[31]=W,e[32]=ie):ie=e[32];let Se;if(e[33]!==o.theme||e[34]!==d||e[35]!==a){let le;e[37]!==o.theme||e[38]!==d?(le=Pe=>{const{value:Xe,icon:xs,label:ps}=Pe;return s.jsx("button",{type:"button","aria-label":ps,onClick:()=>d(gs=>({...gs,theme:Xe})),className:F("size-8 rounded-md flex items-center justify-center transition-colors",o.theme===Xe?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:xs},Xe)},e[37]=o.theme,e[38]=d,e[39]=le):le=e[39],Se=a.map(le),e[33]=o.theme,e[34]=d,e[35]=a,e[36]=Se}else Se=e[36];let Ne;e[40]!==Se?(Ne=s.jsx("div",{className:"flex items-center gap-0.5",children:Se}),e[40]=Se,e[41]=Ne):Ne=e[41];const qe=o.enableSounds?"Disable sounds":"Enable sounds";let _e;e[42]!==d?(_e=()=>d(ki),e[42]=d,e[43]=_e):_e=e[43];const Ke=o.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let Ce;e[44]!==Ke?(Ce=F("size-8 rounded-md flex items-center justify-center transition-colors",Ke),e[44]=Ke,e[45]=Ce):Ce=e[45];let we;e[46]!==o.enableSounds?(we=o.enableSounds?s.jsx(bt,{size:14}):s.jsx(jt,{size:14}),e[46]=o.enableSounds,e[47]=we):we=e[47];let ke;e[48]!==qe||e[49]!==_e||e[50]!==Ce||e[51]!==we?(ke=s.jsx("button",{type:"button","aria-label":qe,onClick:_e,className:Ce,children:we}),e[48]=qe,e[49]=_e,e[50]=Ce,e[51]=we,e[52]=ke):ke=e[52];let Me;e[53]===Symbol.for("react.memo_cache_sentinel")?(Me=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.43.2"]}),e[53]=Me):Me=e[53];let Ae;e[54]!==ke?(Ae=s.jsxs("div",{className:"flex items-center gap-2",children:[ke,Me]}),e[54]=ke,e[55]=Ae):Ae=e[55];let Ie;e[56]!==Ne||e[57]!==Ae?(Ie=s.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[Ne,Ae]}),e[56]=Ne,e[57]=Ae,e[58]=Ie):Ie=e[58];let Oe;return e[59]!==H||e[60]!==ie||e[61]!==Ie?(Oe=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[H,ie,Ie]}),e[59]=H,e[60]=ie,e[61]=Ie,e[62]=Oe):Oe=e[62],Oe}const u=n?.name??"U";let f;e[63]!==u||e[64]!==l?(f=s.jsx(Le,{url:l,fallback:u,shape:"circle",size:"sm",className:"shrink-0"}),e[63]=u,e[64]=l,e[65]=f):f=e[65];const h=n?.name??"User";let g;e[66]!==h?(g=s.jsx("p",{className:"text-sm font-medium truncate",children:h}),e[66]=h,e[67]=g):g=e[67];const j=n?.email;let x;e[68]!==j?(x=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:j}),e[68]=j,e[69]=x):x=e[69];let p;e[70]!==g||e[71]!==x?(p=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,x]}),e[70]=g,e[71]=x,e[72]=p):p=e[72];let b;e[73]!==n?(b=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(wi)},e[73]=n,e[74]=b):b=e[74];let v;e[75]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(gt,{size:14}),e[75]=v):v=e[75];let y;e[76]!==b?(y=s.jsx(ce,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:b,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:v})}),e[76]=b,e[77]=y):y=e[77];let w;e[78]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(de,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[78]=w):w=e[78];let C;e[79]!==y?(C=s.jsx(et,{delayDuration:300,children:s.jsxs(me,{children:[y,w]})}),e[79]=y,e[80]=C):C=e[80];let N;e[81]!==C||e[82]!==f||e[83]!==p?(N=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[f,p,C]}),e[81]=C,e[82]=f,e[83]=p,e[84]=N):N=e[84];let S;if(e[85]!==c||e[86]!==i){let U;e[88]!==c?(U=q=>s.jsx(De,{item:q,onClose:c},q.key),e[88]=c,e[89]=U):U=e[89],S=i.map(U),e[85]=c,e[86]=i,e[87]=S}else S=e[87];let A;e[90]!==c||e[91]!==r?(A=s.jsx(De,{item:r,onClose:c}),e[90]=c,e[91]=r,e[92]=A):A=e[92];let k;e[93]!==S||e[94]!==A?(k=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[S,A]}),e[93]=S,e[94]=A,e[95]=k):k=e[95];let z;if(e[96]!==o.theme||e[97]!==d||e[98]!==a){let U;e[100]!==o.theme||e[101]!==d?(U=q=>{const{value:B,icon:Z,label:ge}=q;return s.jsx("button",{type:"button","aria-label":ge,onClick:()=>d(ee=>({...ee,theme:B})),className:F("size-7 rounded-md flex items-center justify-center transition-colors",o.theme===B?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Z},B)},e[100]=o.theme,e[101]=d,e[102]=U):U=e[102],z=a.map(U),e[96]=o.theme,e[97]=d,e[98]=a,e[99]=z}else z=e[99];let _;e[103]!==z?(_=s.jsx("div",{className:"flex items-center gap-0.5",children:z}),e[103]=z,e[104]=_):_=e[104];const I=o.enableSounds?"Disable sounds":"Enable sounds";let M;e[105]!==d?(M=()=>d(Ci),e[105]=d,e[106]=M):M=e[106];const L=o.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let P;e[107]!==L?(P=F("size-7 rounded-md flex items-center justify-center transition-colors",L),e[107]=L,e[108]=P):P=e[108];let D;e[109]!==o.enableSounds?(D=o.enableSounds?s.jsx(bt,{size:14}):s.jsx(jt,{size:14}),e[109]=o.enableSounds,e[110]=D):D=e[110];let O;e[111]!==I||e[112]!==M||e[113]!==P||e[114]!==D?(O=s.jsx("button",{type:"button","aria-label":I,onClick:M,className:P,children:D}),e[111]=I,e[112]=M,e[113]=P,e[114]=D,e[115]=O):O=e[115];let R;e[116]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.43.2"]}),e[116]=R):R=e[116];let G;e[117]!==O?(G=s.jsxs("div",{className:"flex items-center gap-2",children:[O,R]}),e[117]=O,e[118]=G):G=e[118];let V;e[119]!==_||e[120]!==G?(V=s.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[_,G]}),e[119]=_,e[120]=G,e[121]=V):V=e[121];let Y;return e[122]!==N||e[123]!==k||e[124]!==V?(Y=s.jsx("div",{className:"flex w-full flex-col overflow-hidden",children:s.jsxs("div",{className:"flex flex-col",children:[N,k,V]})}),e[122]=N,e[123]=k,e[124]=V,e[125]=Y):Y=e[125],Y}function Ci(t){return{...t,enableSounds:!t.enableSounds}}function wi(){re.success("User ID copied")}function ki(t){return{...t,enableSounds:!t.enableSounds}}function Ai(){re.success("User ID copied")}function st(){const t=$.c(34),{data:e}=he.useSession(),{org:n}=se(),l=xe();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org",shouldThrow:!1},t[0]=i):i=t[0];const a=vs(i)?.params.org,[o,d]=ys(),c=ct(),[m,u]=E.useState(!1),f=e?.user,h=f?.image;let g;t[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>u(!1),t[1]=g):g=t[1];const j=g;let x;t[2]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(dt,{size:16}),t[2]=x):x=t[2];let p;t[3]!==l||t[4]!==a?(p={key:"preferences",label:"Preferences",icon:x,onClick:()=>{l({to:"/$org/settings/profile",params:{org:a??""}})}},t[3]=l,t[4]=a,t[5]=p):p=t[5];let b;t[6]!==n||t[7]!==l?(b=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(Gs,{size:16}),onClick:()=>{l({to:"/$org/install",params:{org:n.slug}})}}]:[],t[6]=n,t[7]=l,t[8]=b):b=t[8];let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v={key:"terms",label:"Terms of Use",icon:s.jsx(Ws,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[9]=v):v=t[9];let y;t[10]===Symbol.for("react.memo_cache_sentinel")?(y={key:"privacy",label:"Privacy Policy",icon:s.jsx(Ys,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[10]=y):y=t[10];let w;t[11]===Symbol.for("react.memo_cache_sentinel")?(w={key:"github",label:"decocms/studio",icon:s.jsx(Ss,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[11]=w):w=t[11];let C;t[12]===Symbol.for("react.memo_cache_sentinel")?(C={key:"community",label:"Community",icon:s.jsx(Qs,{size:16}),href:"https://decocms.com/discord",external:!0},t[12]=C):C=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N={key:"homepage",label:"Homepage",icon:s.jsx(Us,{size:16}),href:"https://decocms.com",external:!0},t[13]=N):N=t[13];let S;t[14]!==p||t[15]!==b?(S=[p,...b,v,y,w,C,N],t[14]=p,t[15]=b,t[16]=S):S=t[16];const A=S;let k;t[17]===Symbol.for("react.memo_cache_sentinel")?(k={key:"logout",label:"Sign out",icon:s.jsx(qs,{size:16}),onClick:zi},t[17]=k):k=t[17];const z=k;let _;t[18]===Symbol.for("react.memo_cache_sentinel")?(_={value:"light",icon:s.jsx(Xs,{size:14}),label:"Light theme"},t[18]=_):_=t[18];let I;t[19]===Symbol.for("react.memo_cache_sentinel")?(I={value:"dark",icon:s.jsx(Vs,{size:14}),label:"Dark theme"},t[19]=I):I=t[19];let M;t[20]===Symbol.for("react.memo_cache_sentinel")?(M=[_,I,{value:"system",icon:s.jsx(tt,{size:14}),label:"System theme"}],t[20]=M):M=t[20];const L=M;let P;t[21]!==c||t[22]!==A||t[23]!==o||t[24]!==d||t[25]!==f||t[26]!==h?(P={user:f,userImage:h,menuItems:A,signOutItem:z,themeOptions:L,preferences:o,setPreferences:d,close:j,isMobile:c},t[21]=c,t[22]=A,t[23]=o,t[24]=d,t[25]=f,t[26]=h,t[27]=P):P=t[27];const D=P;let O;return t[28]!==c||t[29]!==m||t[30]!==D||t[31]!==f?.name||t[32]!==h?(O=s.jsx(s.Fragment,{children:c?s.jsxs(Ut,{open:m,onOpenChange:u,direction:"bottom",children:[s.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx(Le,{url:h,fallback:f?.name??"U",shape:"circle",size:"2xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]}),s.jsxs(Wt,{className:"h-[80dvh] p-0",children:[s.jsx(qt,{className:"sr-only",children:"Account"}),s.jsx(_t,{...D})]})]}):s.jsxs(Ge,{open:m,onOpenChange:u,children:[s.jsx(ze,{asChild:!0,children:s.jsxs(J,{tooltip:f?.name??"Account",className:"rounded-md",children:[s.jsx(Le,{url:h,fallback:f?.name??"U",shape:"circle",size:"xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]})}),s.jsx(Ue,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[280px] p-0 flex flex-col max-h-[520px]",onCloseAutoFocus:Ii,children:s.jsx(_t,{...D})})]})}),t[28]=c,t[29]=m,t[30]=D,t[31]=f?.name,t[32]=h,t[33]=O):O=t[33],O}function Ii(t){return t.preventDefault()}function zi(){oe("signed_out",{source:"account_popover"}),Ns(),he.signOut()}function nt(t){const e=$.c(43),{variant:n}=t===void 0?{}:t,l=n===void 0?"icon":n,i=cn(),[r,a]=E.useState(!1);let o,d;if(e[0]!==i.capabilities||e[1]!==i.hostname||e[2]!==i.machineId||e[3]!==i.online){const v=dn(i.capabilities);o=i.online?"Desktop linked":"Connect desktop",d=i.online?s.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[s.jsx("span",{className:"font-medium",children:i.hostname??i.machineId??"Desktop linked"}),s.jsx("span",{className:"text-muted-foreground",children:v.length>0?`Available: ${v.join(", ")}`:"No CLI agents detected"})]}):s.jsx("span",{className:"text-xs",children:"Desktop disconnected"}),e[0]=i.capabilities,e[1]=i.hostname,e[2]=i.machineId,e[3]=i.online,e[4]=o,e[5]=d}else o=e[4],d=e[5];const c=d;if(l==="full"){let v,y;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=()=>a(!0),y=s.jsx(tt,{}),e[6]=v,e[7]=y):(v=e[6],y=e[7]);let w;e[8]!==o?(w=s.jsx("span",{children:o}),e[8]=o,e[9]=w):w=e[9];let C;e[10]!==i.online?(C=i.online&&s.jsx("span",{className:"ml-auto size-2 rounded-full bg-success animate-pulse"}),e[10]=i.online,e[11]=C):C=e[11];let N;e[12]!==o||e[13]!==w||e[14]!==C?(N=s.jsx(ce,{asChild:!0,children:s.jsxs(J,{tooltip:o,onClick:v,children:[y,w,C]})}),e[12]=o,e[13]=w,e[14]=C,e[15]=N):N=e[15];let S;e[16]!==c?(S=s.jsx(de,{side:"right",children:c}),e[16]=c,e[17]=S):S=e[17];let A;e[18]!==N||e[19]!==S?(A=s.jsxs(me,{children:[N,S]}),e[18]=N,e[19]=S,e[20]=A):A=e[20];let k;e[21]!==r?(k=s.jsx(yt,{open:r,onOpenChange:a}),e[21]=r,e[22]=k):k=e[22];let z;return e[23]!==k||e[24]!==A?(z=s.jsxs(s.Fragment,{children:[A,k]}),e[23]=k,e[24]=A,e[25]=z):z=e[25],z}let m;e[26]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),e[26]=m):m=e[26];const u=i.online?"Desktop linked":"Connect your desktop";let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(tt,{size:16}),e[27]=f):f=e[27];let h;e[28]!==i.online?(h=i.online&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-success ring-2 ring-background animate-pulse"}),e[28]=i.online,e[29]=h):h=e[29];let g;e[30]!==u||e[31]!==h?(g=s.jsx(ce,{asChild:!0,children:s.jsxs(ve,{onClick:m,"aria-label":u,children:[f,h]})}),e[30]=u,e[31]=h,e[32]=g):g=e[32];let j;e[33]!==c?(j=s.jsx(de,{side:"bottom",children:c}),e[33]=c,e[34]=j):j=e[34];let x;e[35]!==g||e[36]!==j?(x=s.jsxs(me,{children:[g,j]}),e[35]=g,e[36]=j,e[37]=x):x=e[37];let p;e[38]!==r?(p=s.jsx(yt,{open:r,onOpenChange:a}),e[38]=r,e[39]=p):p=e[39];let b;return e[40]!==p||e[41]!==x?(b=s.jsxs(s.Fragment,{children:[x,p]}),e[40]=p,e[41]=x,e[42]=b):b=e[42],b}class $i extends E.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?null:this.props.children}}function Ti(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Mi(){const t=$.c(17),e=xe(),{org:n}=se(),{hasDecoKey:l,balanceDollars:i}=ln();if(!l)return null;let r;t[0]!==i?(r=i!=null?`Credits: $${i.toFixed(2)}`:"Credits",t[0]=i,t[1]=r):r=t[1];let a;t[2]!==i?(a=F(i!=null&&Ti(i)),t[2]=i,t[3]=a):a=t[3];let o;t[4]!==e||t[5]!==n.slug?(o=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[4]=e,t[5]=n.slug,t[6]=o):o=t[6];let d;t[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Js,{}),t[7]=d):d=t[7];let c;t[8]!==i?(c=i!=null?`$${i.toFixed(2)}`:"Credits",t[8]=i,t[9]=c):c=t[9];let m;t[10]!==c?(m=s.jsx("span",{children:c}),t[10]=c,t[11]=m):m=t[11];let u;return t[12]!==r||t[13]!==a||t[14]!==o||t[15]!==m?(u=s.jsx(ae,{children:s.jsx(K,{children:s.jsxs(J,{tooltip:r,className:a,onClick:o,children:[d,m]})})}),t[12]=r,t[13]=a,t[14]=o,t[15]=m,t[16]=u):u=t[16],u}function Ct(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx($i,{children:s.jsx(E.Suspense,{fallback:null,children:s.jsx(Mi,{})})}),t[0]=e):e=t[0],e}function wt(){const t=$.c(7),e=xe(),{org:n}=se();let l;t[0]!==e||t[1]!==n.slug?(l=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=l):l=t[2];let i,r;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(dt,{}),r=s.jsx("span",{children:"Settings"}),t[3]=i,t[4]=r):(i=t[3],r=t[4]);let a;return t[5]!==l?(a=s.jsxs(J,{tooltip:"Settings",onClick:l,children:[i,r]}),t[5]=l,t[6]=a):a=t[6],a}function kt(){const t=$.c(4),[e,n]=E.useState(!1);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(K,{children:s.jsx(nn,{trigger:s.jsxs(J,{tooltip:"Invite members",children:[s.jsx(Zs,{}),s.jsx("span",{children:"Invite members"})]})})}),t[0]=l):l=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(ae,{className:"gap-0.5",children:[l,s.jsx(K,{children:s.jsxs(J,{tooltip:"Add connection",onClick:()=>n(!0),children:[s.jsx(Ks,{}),s.jsx("span",{children:"Add connection"})]})})]}),t[1]=i):i=t[1];let r;return t[2]!==e?(r=s.jsxs(s.Fragment,{children:[i,s.jsx(rn,{open:e,onOpenChange:n,mode:"browse"})]}),t[2]=e,t[3]=r):r=t[3],r}function Oi(){const t=$.c(10),{state:e}=pe();if(e==="collapsed"){let d,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(kt,{}),c=s.jsx(Ct,{}),t[0]=d,t[1]=c):(d=t[0],c=t[1]);let m;t[2]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(K,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(nt,{})})}),t[2]=m):m=t[2];let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(K,{children:s.jsx(wt,{})}),t[3]=u):u=t[3];let f;return t[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs(Ze,{className:"px-2 pb-3 gap-1",children:[d,c,s.jsxs(ae,{children:[m,u,s.jsx(K,{children:s.jsx(st,{})})]})]}),t[4]=f):f=t[4],f}let l,i;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(kt,{}),i=s.jsx(Ct,{}),t[5]=l,t[6]=i):(l=t[5],i=t[6]);let r;t[7]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(K,{children:s.jsx(nt,{variant:"full"})}),t[7]=r):r=t[7];let a;t[8]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(K,{children:s.jsx(wt,{})}),t[8]=a):a=t[8];let o;return t[9]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(Ze,{className:"px-2 pb-3 gap-0.5",children:[l,i,s.jsxs(ae,{className:"gap-0.5",children:[r,a,s.jsx(K,{children:s.jsx(st,{})})]})]}),t[9]=o):o=t[9],o}function Pi(){const t=$.c(8),e=xe(),{org:n}=se(),{setOpenMobile:l}=pe();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(ae,{children:s.jsx(K,{children:s.jsx(st,{})})})}),t[0]=i):i=t[0];let r;t[1]!==e||t[2]!==n.slug||t[3]!==l?(r=()=>{e({to:"/$org/settings",params:{org:n.slug}}),l(!1)},t[1]=e,t[2]=n.slug,t[3]=l,t[4]=r):r=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(dt,{className:"size-4"}),t[5]=a):a=t[5];let o;return t[6]!==r?(o=s.jsx(Ze,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[i,s.jsx(ve,{"aria-label":"Settings",onClick:r,children:a})]})}),t[6]=r,t[7]=o):o=t[7],o}function At(t){const e=$.c(15),{className:n,wrapperClassName:l,children:i}=t,[r,a]=E.useState(!1);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=p=>{p&&a(p.scrollHeight>p.clientHeight+1)},e[0]=o):o=e[0];const d=o;let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=p=>{const b=p.currentTarget;a(b.scrollHeight-b.scrollTop>b.clientHeight+1)},e[1]=c):c=e[1];const m=c;let u;e[2]!==l?(u=F("relative",l),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==i||e[5]!==n?(f=s.jsx("div",{ref:d,onScroll:m,className:n,children:i}),e[4]=i,e[5]=n,e[6]=f):f=e[6];const h=r?"opacity-100":"opacity-0";let g;e[7]!==h?(g=F("pointer-events-none absolute right-0 bottom-0 left-0 h-10 bg-gradient-to-t from-sidebar to-transparent transition-opacity duration-150",h),e[7]=h,e[8]=g):g=e[8];let j;e[9]!==g?(j=s.jsx("div",{"aria-hidden":!0,className:g}),e[9]=g,e[10]=j):j=e[10];let x;return e[11]!==u||e[12]!==f||e[13]!==j?(x=s.jsxs("div",{className:u,children:[f,j]}),e[11]=u,e[12]=f,e[13]=j,e[14]=x):x=e[14],x}function Di(t){const e=$.c(8),{virtualMcpId:n,size:l,showAutomationBadge:i}=t,r=l===void 0?"sm":l;let a;e[0]!==r||e[1]!==n?(a=n?s.jsx(Fi,{virtualMcpId:n,size:r}):s.jsx(ye,{icon:null,name:"?",size:r}),e[0]=r,e[1]=n,e[2]=a):a=e[2];let o;e[3]!==i?(o=i&&s.jsx("span",{"aria-label":"Automation-triggered",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:s.jsx(Qt,{size:10,className:"text-white"})}),e[3]=i,e[4]=o):o=e[4];let d;return e[5]!==a||e[6]!==o?(d=s.jsxs("div",{className:"relative shrink-0",children:[a,o]}),e[5]=a,e[6]=o,e[7]=d):d=e[7],d}function Fi(t){const e=$.c(6),{virtualMcpId:n,size:l}=t,i=mt(n);if(!i){let o;return e[0]!==l?(o=s.jsx(ye,{icon:null,name:"?",size:l}),e[0]=l,e[1]=o):o=e[1],o}const r=i.icon??null;let a;return e[2]!==i.title||e[3]!==l||e[4]!==r?(a=s.jsx(ye,{icon:r,name:i.title,size:l}),e[2]=i.title,e[3]=l,e[4]=r,e[5]=a):a=e[5],a}function It(t){const e=$.c(36),{open:n,onOpenChange:l}=t,[i,r]=E.useState(""),{org:a}=se(),{setTaskId:o}=ft(),d=Yt();let c,m,u;e[0]!==a.id||e[1]!==i?(u=i.trim(),m=Cs,c=_s.globalSearch(a.id,u),e[0]=a.id,e[1]=i,e[2]=c,e[3]=m,e[4]=u):(c=e[2],m=e[3],u=e[4]);const f=n&&u.length>0;let h;e[5]!==d||e[6]!==u?(h=async()=>await d.call("GLOBAL_SEARCH",{query:u,limit:20}),e[5]=d,e[6]=u,e[7]=h):h=e[7];let g;e[8]!==c||e[9]!==f||e[10]!==h?(g={queryKey:c,enabled:f,queryFn:h,staleTime:1e4},e[8]=c,e[9]=f,e[10]=h,e[11]=g):g=e[11];const{data:j,isFetching:x}=m(g);let p;e[12]!==j?.items?(p=j?.items??[],e[12]=j?.items,e[13]=p):p=e[13];const b=p;let v;e[14]!==l?(v=I=>{I||r(""),l(I)},e[14]=l,e[15]=v):v=e[15];const y=v;let w;e[16]!==y||e[17]!==o?(w=I=>{y(!1),o(I.id,I.virtual_mcp_id??void 0)},e[16]=y,e[17]=o,e[18]=w):w=e[18];const C=w;let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(yn,{className:"sr-only",children:[s.jsx(Sn,{children:"Search"}),s.jsx(Nn,{children:"Search across your organization's resources."})]}),e[19]=N):N=e[19];let S;e[20]!==i?(S=s.jsx(An,{value:i,onValueChange:r,placeholder:"Search..."}),e[20]=i,e[21]=S):S=e[21];let A;e[22]!==C||e[23]!==x||e[24]!==b||e[25]!==u?(A=u?x&&b.length===0?s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching…"}):b.length===0?s.jsx(wn,{children:"No results."}):b.map(I=>I.type==="thread"?s.jsxs(kn,{value:`thread:${I.id}:${I.title}`,onSelect:()=>C(I),className:"gap-2.5",children:[s.jsx(Di,{virtualMcpId:I.virtual_mcp_id,size:"xs"}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("div",{className:"text-sm text-foreground truncate",children:I.title||"Untitled thread"})}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(I.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${I.id}`):null):s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search."}),e[22]=C,e[23]=x,e[24]=b,e[25]=u,e[26]=A):A=e[26];let k;e[27]!==A?(k=s.jsx(In,{children:A}),e[27]=A,e[28]=k):k=e[28];let z;e[29]!==S||e[30]!==k?(z=s.jsxs(_n,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,s.jsxs(zn,{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:[S,k]})]}),e[29]=S,e[30]=k,e[31]=z):z=e[31];let _;return e[32]!==y||e[33]!==n||e[34]!==z?(_=s.jsx(Cn,{open:n,onOpenChange:y,children:z}),e[32]=y,e[33]=n,e[34]=z,e[35]=_):_=e[35],_}function Ei(t){return t==="ephemeral"||t.startsWith("thread:")}function rs(t){const e=$.c(40),{task:n,isActive:l,onClick:i,onArchive:r,showAutomationBadge:a,showAgentIcon:o,hideStatusIdle:d,indented:c}=t,m=Mn(n.status),u=m.icon,f=n.metadata?.kind==="tool_call_run",h=mt(f?void 0:n.virtual_mcp_id);let g;e[0]!==h?(g=on(h),e[0]=h,e[1]=g):g=e[1];const j=g;On(6e4);const x=a||!!n.trigger_id,p=n.id,b="button",v=0;let y;e[2]!==i?(y=G=>{G.target===G.currentTarget&&(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),i())},e[2]=i,e[3]=y):y=e[3];const w=c?"-ml-4 pl-6":"pl-2",C=l?"bg-accent text-accent-foreground":"hover:bg-accent/60";let N;e[4]!==w||e[5]!==C?(N=F("group/row flex items-center gap-2 py-1.5 pr-2 rounded-md cursor-pointer transition-colors",w,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",C),e[4]=w,e[5]=C,e[6]=N):N=e[6];let S;e[7]!==f||e[8]!==o||e[9]!==h?.icon||e[10]!==h?.title?(S=o&&!f&&s.jsx(ye,{icon:h?.icon??null,name:h?.title??"?",size:"2xs"}),e[7]=f,e[8]=o,e[9]=h?.icon,e[10]=h?.title,e[11]=S):S=e[11];let A;e[12]!==x?(A=x&&s.jsx(Qt,{size:12,"aria-label":"Automation-triggered",className:"shrink-0 text-blue-500"}),e[12]=x,e[13]=A):A=e[13];const k=n.title||"Untitled task";let z;e[14]!==k?(z=s.jsx("div",{className:"text-sm text-foreground truncate",children:k}),e[14]=k,e[15]=z):z=e[15];let _;e[16]!==A||e[17]!==z?(_=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[A,z]}),e[16]=A,e[17]=z,e[18]=_):_=e[18];let I;e[19]!==j||e[20]!==l||e[21]!==n.branch||e[22]!==n.updated_at?(I=n.updated_at&&s.jsxs("div",{className:F("flex items-center gap-1 text-[11px] min-w-0",l?"text-accent-foreground/70":"text-muted-foreground/60"),children:[n.branch&&!Ei(n.branch)?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-mono",children:n.branch}),s.jsx("span",{className:"shrink-0",children:"·"})]}):j?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"truncate",children:[j.owner,"/",j.name]}),s.jsx("span",{className:"shrink-0",children:"·"})]}):null,s.jsx("span",{className:"shrink-0",children:Dn(new Date(n.updated_at))})]}),e[19]=j,e[20]=l,e[21]=n.branch,e[22]=n.updated_at,e[23]=I):I=e[23];let M;e[24]!==_||e[25]!==I?(M=s.jsxs("div",{className:"flex-1 min-w-0",children:[_,I]}),e[24]=_,e[25]=I,e[26]=M):M=e[26];const L="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",P=!d&&s.jsx("span",{className:F("[grid-area:slot] flex size-7 items-center justify-center pointer-events-none transition-opacity",r&&"group-hover/row:opacity-0"),"aria-label":m.label,children:s.jsx(u,{size:14,className:F(m.iconClassName,n.status==="in_progress"&&"animate-spin")})});let D;e[27]!==r?(D=r&&s.jsxs(me,{children:[s.jsx(ce,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":"Archive task",onClick:G=>{G.stopPropagation(),r()},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-7 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:s.jsx(ws,{size:14})})}),s.jsx(de,{side:"right",children:"Archive"})]}),e[27]=r,e[28]=D):D=e[28];let O;e[29]!==P||e[30]!==D?(O=s.jsxs("div",{className:L,children:[P,D]}),e[29]=P,e[30]=D,e[31]=O):O=e[31];let R;return e[32]!==i||e[33]!==M||e[34]!==O||e[35]!==y||e[36]!==N||e[37]!==S||e[38]!==n.id?(R=s.jsxs("div",{"data-task-id":p,role:b,tabIndex:v,onClick:i,onKeyDown:y,className:N,children:[S,M,O]}),e[32]=i,e[33]=M,e[34]=O,e[35]=y,e[36]=N,e[37]=S,e[38]=n.id,e[39]=R):R=e[39],R}const zt=["requires_action","in_progress","failed","expired","completed"];function Li(t){const e=new Map(zt.map(n=>[n,[]]));for(const n of t){const l=n.status??"completed";(e.get(l)??e.get("completed")).push(n)}return zt.map(n=>({status:n,threads:e.get(n)}))}const Ri="sidebar.group.expanded.";function Bi(t,e){const n=$.c(3),[l,i]=He(`${Ri}${t}`,e);let r;return n[0]!==l||n[1]!==i?(r=[l,i],n[0]=l,n[1]=i,n[2]=r):r=n[2],r}function os(t){const e=$.c(12),{onClick:n,isFetching:l,indented:i}=t,r=i?"-ml-4 pl-6 pr-2":"px-2";let a;e[0]!==r?(a=F("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",r,"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[0]=r,e[1]=a):a=e[1];let o;e[2]!==l?(o=l&&s.jsx(Lt,{size:14,className:"animate-spin"}),e[2]=l,e[3]=o):o=e[3];const d=l?"Loading…":"Show more";let c;e[4]!==d?(c=s.jsx("span",{children:d}),e[4]=d,e[5]=c):c=e[5];let m;return e[6]!==l||e[7]!==n||e[8]!==a||e[9]!==o||e[10]!==c?(m=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:l,className:a,children:[o,c]}),e[6]=l,e[7]=n,e[8]=a,e[9]=o,e[10]=c,e[11]=m):m=e[11],m}function Hi(t,e,n,l){return[t,e,n,l.type,l.member,l.currentUserId??""].join("|")}function Gi(t){return t.member==="mine"&&!t.currentUserId}const as=4;let Ee=0;const it=[];function Ui(){for(;Ee<as&&it.length>0;){const t=it.shift();t&&t()}}function cs(t){return new Promise((e,n)=>{const l=()=>{Ee++,t().then(e,n).finally(()=>{Ee--,Ui()})};Ee<as?l():it.push(l)})}const We=10;function $t(t,e,n,l,i){const r={hidden:!1};l.member==="mine"&&l.currentUserId&&(r.created_by=l.currentUserId),l.type==="automation"&&(r.has_trigger=!0),l.type==="manual"&&(r.has_trigger=!1);const a={where:r,limit:i,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function Wi(t,e,n,l){let i=0;for(const r of t)ds(r,e,n,l)&&i++;return i}function Ve(t,e,n,l){return Wi(t,e,n,l)}function qi(t,e){return!!(t>=We||t===0&&e)}function Tt(t,e){return t<e}function Ki(t,e){return e===!1?!1:e===!0?!0:t}function ds(t,e,n,l){return!(t.hidden||(t.status??"completed")!==n||l.member==="mine"&&l.currentUserId&&t.created_by!==l.currentUserId||l.type==="automation"&&!t.trigger_id||l.type==="manual"&&t.trigger_id)}const Be=new Map,Fe=new Map;function Xi(t,e){return e?t>=We?!0:null:!1}function Mt(t){return Be.get(t)}function Vi(t,e){Be.set(t,e)}function Yi(t,e,n){const l=Be.get(t);if(l!==void 0){n(l);return}let i=Fe.get(t);i||(i=cs(e).then(r=>(Be.set(t,r),Fe.delete(t),r)).catch(()=>(Fe.delete(t),Promise.reject(new Error("group probe failed")))),Fe.set(t,i)),i.then(n,()=>n(!1))}function Ot(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===We,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function Qi(t,e,n,l,i){let r=0;for(const a of t)e.has(a.id)||ds(a,n,l,i)&&r++;return r}function Ji(t,e,n,l){const i=$.c(8),{org:r}=se(),a=Hi(r.id,t,e,n);let o;i[0]!==n?(o=Gi(n),i[0]=n,i[1]=o):o=i[1];const d=o,[c,m]=E.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});c.identity!==a&&m({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const u=bn(),{threads:f,hasMore:h}=ut(),g=Ve(f,t,e,n),j=qi(g,h),x=Xi(g,h),p=Yt();if(c.identity===a&&c.serverHasMore===null){const N=x??Mt(a);N!==void 0&&m({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:c.probeSubscribedIdentity,serverHasMore:N})}!d&&c.identity===a&&c.serverHasMore===null&&x===null&&Mt(a)===void 0&&c.probeSubscribedIdentity!==a&&(m(N=>N.identity===a?{...N,isProbing:!0,probeSubscribedIdentity:a}:N),Yi(a,async()=>{const N=$t(t,e,0,n,1),S=await p.call("COLLECTION_THREADS_LIST",N),{totalCount:A}=Ot(S),k=Ve(u.threads.get(),t,e,n);return A===void 0?!1:Tt(k,A)},N=>{m(S=>S.identity!==a?S:{...S,isProbing:!1,serverHasMore:N})}));const v=async function(){if(c.isFetching||c.isProbing||d)return;const S=a;m(A=>A.identity===S?{...A,isFetching:!0}:A);try{const A=Ve(f,t,e,n),k=$t(t,e,A,n,We),z=await cs(()=>p.call("COLLECTION_THREADS_LIST",k)),{items:_,hasMore:I,totalCount:M}=Ot(z),L=new Set(f.map(Zi)),P=Qi(_,L,t,e,n),D=A;u.mergeThreads(_),m(O=>{if(O.identity!==S)return O;let R;return M!==void 0?R=Tt(D+P,M):R=_.length===0||P===0?!1:I,Vi(S,R),{...O,isFetching:!1,serverHasMore:R}})}catch(A){const k=A,z=k instanceof Error?k.message:String(k);re.error(`Could not load more tasks: ${z}`),m(_=>_.identity===S?{..._,isFetching:!1}:_)}},y=c.isFetching||c.isProbing,w=!d&&!y&&Ki(j,c.serverHasMore);let C;return i[2]!==y||i[3]!==v||i[4]!==w||i[5]!==c.isProbing||i[6]!==c.serverHasMore?(C={hasMore:w,isFetching:y,isProbing:c.isProbing,serverHasMore:c.serverHasMore,loadMore:v},i[2]=y,i[3]=v,i[4]=w,i[5]=c.isProbing,i[6]=c.serverHasMore,i[7]=C):C=i[7],C}function Zi(t){return t.id}function el(t){const e=$.c(20),{status:n,threads:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:o,filters:d}=t,{isFetching:c,isProbing:m,loadMore:u,hasMore:f,serverHasMore:h}=Ji("status",n,d),[g,j]=E.useState(!1);!g&&l.length===0&&h===!0&&!c&&!m&&(j(!0),queueMicrotask(()=>{u()}));let x;if(e[0]!==i||e[1]!==o||e[2]!==d||e[3]!==a||e[4]!==r||e[5]!==l){let v;e[7]!==i||e[8]!==o||e[9]!==d||e[10]!==a||e[11]!==r?(v=y=>s.jsx(rs,{task:y,isActive:i===y.id,onClick:()=>r(y),onArchive:o&&y.created_by===d.currentUserId?()=>a(y):void 0,showAutomationBadge:!!y.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},y.id),e[7]=i,e[8]=o,e[9]=d,e[10]=a,e[11]=r,e[12]=v):v=e[12],x=l.map(v),e[0]=i,e[1]=o,e[2]=d,e[3]=a,e[4]=r,e[5]=l,e[6]=x}else x=e[6];let p;e[13]!==f||e[14]!==c||e[15]!==u?(p=(f||c)&&s.jsx(os,{onClick:()=>{u()},isFetching:c,indented:!0}),e[13]=f,e[14]=c,e[15]=u,e[16]=p):p=e[16];let b;return e[17]!==x||e[18]!==p?(b=s.jsxs(s.Fragment,{children:[x,p]}),e[17]=x,e[18]=p,e[19]=b):b=e[19],b}function tl(t){const e=$.c(36),{status:n,threads:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:o,filters:d}=t,c=Pn[n],m=c.icon,[u,f]=Bi(`status-${n}`,!1);let h;e[0]!==u||e[1]!==f?(h=function(){f(!u)},e[0]=u,e[1]=f,e[2]=h):h=e[2];const g=h;let j;e[3]!==g?(j=S=>{S.target===S.currentTarget&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),g())},e[3]=g,e[4]=j):j=e[4];let x;e[5]!==m||e[6]!==c.iconClassName?(x=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(m,{size:12,className:c.iconClassName})}),e[5]=m,e[6]=c.iconClassName,e[7]=x):x=e[7];let p;e[8]!==u?(p=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:u?s.jsx(ht,{size:14}):s.jsx(Fn,{size:14})}),e[8]=u,e[9]=p):p=e[9];let b;e[10]!==x||e[11]!==p?(b=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[x,p]}),e[10]=x,e[11]=p,e[12]=b):b=e[12];let v;e[13]!==c.label?(v=s.jsx("span",{className:"flex-1 truncate",children:c.label}),e[13]=c.label,e[14]=v):v=e[14];let y;e[15]!==l.length?(y=s.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:l.length})}),e[15]=l.length,e[16]=y):y=e[16];let w;e[17]!==u||e[18]!==g||e[19]!==j||e[20]!==b||e[21]!==v||e[22]!==y?(w=s.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":u,onClick:g,onKeyDown:j,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:[b,v,y]}),e[17]=u,e[18]=g,e[19]=j,e[20]=b,e[21]=v,e[22]=y,e[23]=w):w=e[23];let C;e[24]!==i||e[25]!==o||e[26]!==u||e[27]!==d||e[28]!==a||e[29]!==r||e[30]!==n||e[31]!==l?(C=u&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(el,{status:n,threads:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:o,filters:d})}),e[24]=i,e[25]=o,e[26]=u,e[27]=d,e[28]=a,e[29]=r,e[30]=n,e[31]=l,e[32]=C):C=e[32];let N;return e[33]!==w||e[34]!==C?(N=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[w,C]}),e[33]=w,e[34]=C,e[35]=N):N=e[35],N}function Pt(t){const e=$.c(38),{threads:n,groupBy:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,filters:o,hasMore:d,isFetchingMore:c,onLoadMore:m,filtersActive:u}=t;if(n.length===0&&!d&&!c){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Tn,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const p=u?"No threads match your filters":"No threads yet";let b;return e[1]!==p?(b=s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[x,s.jsx("p",{className:"text-sm",children:p})]}),e[1]=p,e[2]=b):b=e[2],b}const f=n.length>1||d;if(l==="status"){let x;if(e[3]!==i||e[4]!==f||e[5]!==o||e[6]!==a||e[7]!==r||e[8]!==n){let b;e[10]!==i||e[11]!==f||e[12]!==o||e[13]!==a||e[14]!==r?(b=v=>s.jsx(tl,{status:v.status,threads:v.threads,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:f,filters:o},v.status),e[10]=i,e[11]=f,e[12]=o,e[13]=a,e[14]=r,e[15]=b):b=e[15],x=Li(n).map(b),e[3]=i,e[4]=f,e[5]=o,e[6]=a,e[7]=r,e[8]=n,e[9]=x}else x=e[9];let p;return e[16]!==x?(p=s.jsx(s.Fragment,{children:x}),e[16]=x,e[17]=p):p=e[17],p}let h;if(e[18]!==i||e[19]!==f||e[20]!==o||e[21]!==a||e[22]!==r||e[23]!==n){let x;e[25]!==i||e[26]!==f||e[27]!==o||e[28]!==a||e[29]!==r?(x=p=>s.jsx(rs,{task:p,isActive:i===p.id,onClick:()=>r(p),onArchive:f&&p.created_by===o.currentUserId?()=>a(p):void 0,showAutomationBadge:!!p.trigger_id,showAgentIcon:!0},p.id),e[25]=i,e[26]=f,e[27]=o,e[28]=a,e[29]=r,e[30]=x):x=e[30],h=n.map(x),e[18]=i,e[19]=f,e[20]=o,e[21]=a,e[22]=r,e[23]=n,e[24]=h}else h=e[24];let g;e[31]!==d||e[32]!==c||e[33]!==m?(g=(d||c)&&s.jsx(os,{onClick:m,isFetching:c}),e[31]=d,e[32]=c,e[33]=m,e[34]=g):g=e[34];let j;return e[35]!==h||e[36]!==g?(j=s.jsxs(s.Fragment,{children:[h,g]}),e[35]=h,e[36]=g,e[37]=j):j=e[37],j}function Dt(t){const e=$.c(17),{label:n,onClick:l,active:i,children:r}=t,[a,o]=E.useState(!1);let d,c,m,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>o(!0),c=()=>o(!1),m=()=>o(!0),u=()=>o(!1),e[0]=d,e[1]=c,e[2]=m,e[3]=u):(d=e[0],c=e[1],m=e[2],u=e[3]);const f=i&&"bg-sidebar-accent text-foreground";let h;e[4]!==f?(h=F(f),e[4]=f,e[5]=h):h=e[5];let g;e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h?(g=s.jsx(ce,{asChild:!0,children:s.jsx(ve,{"aria-label":n,onClick:l,onPointerEnter:d,onPointerLeave:c,onFocus:m,onBlur:u,className:h,children:r})}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=g):g=e[10];let j;e[11]!==n?(j=s.jsx(de,{side:"bottom",children:n}),e[11]=n,e[12]=j):j=e[12];let x;return e[13]!==a||e[14]!==g||e[15]!==j?(x=s.jsxs(me,{open:a,children:[g,j]}),e[13]=a,e[14]=g,e[15]=j,e[16]=x):x=e[16],x}function Ye(t){const e=$.c(13),{label:n,value:l,onChange:i,options:r}=t;let a;e[0]!==n?(a=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=a):a=e[1];let o;e[2]!==i?(o=u=>u&&i(u),e[2]=i,e[3]=o):o=e[3];let d;e[4]!==r?(d=r.map(sl),e[4]=r,e[5]=d):d=e[5];let c;e[6]!==o||e[7]!==d||e[8]!==l?(c=s.jsx(fn,{type:"single",size:"sm",value:l,onValueChange:o,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:d}),e[6]=o,e[7]=d,e[8]=l,e[9]=c):c=e[9];let m;return e[10]!==a||e[11]!==c?(m=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,c]}),e[10]=a,e[11]=c,e[12]=m):m=e[12],m}function sl(t){return s.jsxs(un,{value:t.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:[t.icon,t.label]},t.value)}function ms({onNavigate:t}={}){const{data:e}=he.useSession(),n=e?.user?.id,{org:l}=se(),i=hn({connectionId:xn,orgId:l.id,orgSlug:l.slug}),r=Re(l.id).id,a=Xt(),{threads:o,hasMore:d,isFetchingMore:c,fetchNextPage:m}=ut(),u=o.filter(T=>!T.hidden),{hide:f}=Vt(),h=xe(),{setTaskId:g,createNewTask:j}=ft(),x=lt({strict:!1}),p=rt({strict:!1}),b=x.taskId??null,v=p.virtualmcpid??o.find(T=>T.id===b)?.virtual_mcp_id??null,y=()=>{t?.()},w=[...u].sort((T,H)=>(H.updated_at??"").localeCompare(T.updated_at??"")),[C,N]=E.useState("all"),[S,A]=E.useState("flat"),[k,z]=He("sidebar-threads-scope-all",!1),[_,I]=E.useState(!1),[M,L]=E.useState(!1),P={type:C,member:"mine",currentUserId:n??null},D=T=>n?T.filter(H=>H.created_by===n):[],O=T=>C==="automation"?T.filter(H=>!!H.trigger_id):C==="manual"?T.filter(H=>!H.trigger_id):T,R=D(w),G=O(R),V=O(w),Y=k?V:G,U=T=>{if(n&&T.created_by&&T.created_by!==n)return;const H=T.id===b;if(f(T.id),!H)return;const X=R.find(W=>W.id!==T.id&&W.virtual_mcp_id===T.virtual_mcp_id);y(),X?g(X.id,X.virtual_mcp_id):h({to:"/$org",params:{org:l.slug}})},q=T=>{y(),g(T.id,T.virtual_mcp_id)},B=async T=>{try{const H=await i.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:T,limit:1,offset:0}});return((H.structuredContent??H).items?.length??0)===0}catch{return!1}},Z=async()=>{const T=v??r;oe("sidebar_new_thread_clicked",{virtual_mcp_id:T});const H=R.find(X=>X.virtual_mcp_id===T&&X.title==="New chat");if(H&&await B(H.id)){y(),g(H.id,T);return}y(),j(T)},{state:ge,isMobile:ee,toggleSidebar:ue}=pe();if(ge==="collapsed"&&!ee){const T=Re(l.id),H=new Map((a??[]).map(W=>[W.id,W])),X=W=>(W?H.get(W):void 0)??(W===r?T:void 0);return s.jsxs(ae,{className:"min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx(K,{children:s.jsx(J,{"aria-label":"Toggle sidebar",tooltip:"Toggle sidebar",onClick:ue,children:s.jsx(Gt,{size:16})})}),s.jsx(K,{children:s.jsx(J,{tooltip:"New thread",onClick:()=>{Z()},children:s.jsx(vt,{size:16})})}),Y.map(W=>{const ie=X(W.virtual_mcp_id);return s.jsx(K,{children:s.jsx(J,{tooltip:W.title||"New chat",isActive:W.id===b,onClick:()=>q(W),children:s.jsx(ye,{icon:ie?.icon??null,name:ie?.title??"Agent",size:"2xs"})})},W.id)})]})}const ne=S!=="flat"||C!=="all"||k===!0,fe=s.jsxs(Ge,{children:[s.jsxs(me,{children:[s.jsx(ce,{asChild:!0,children:s.jsx(ze,{asChild:!0,children:s.jsxs(ve,{"aria-label":"Filter threads",active:ne,children:[s.jsx(mn,{size:16}),ne&&s.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"})]})})}),s.jsx(de,{side:"bottom",children:"Filter threads"})]}),s.jsxs(Ue,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[s.jsx(Ye,{label:"View",value:S,onChange:T=>{oe("tasks_panel_group_by_changed",{to_value:T}),A(T)},options:[{value:"flat",label:"List",icon:s.jsx(tn,{size:13})},{value:"status",label:"Status",icon:s.jsx(sn,{size:13})}]}),s.jsx(Ye,{label:"Type",value:C,onChange:T=>{oe("tasks_panel_filter_changed",{to_value:T}),N(T)},options:[{value:"all",label:"All"},{value:"manual",label:"Chats"},{value:"automation",label:"Auto"}]}),s.jsx(Ye,{label:"Scope",value:k?"team":"mine",onChange:T=>z(T==="team"),options:[{value:"mine",label:"Mine"},{value:"team",label:"Team"}]})]})]}),je=T=>s.jsx(et,{delayDuration:300,children:s.jsxs("div",{className:F("shrink-0 px-1 flex items-center justify-between",T?"h-10":"h-10 md:h-7 mb-2"),children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[!T&&s.jsx(Jt,{}),fe]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Dt,{label:"Search threads",onClick:()=>{oe("tasks_panel_search_opened"),L(!0),I(!0)},children:s.jsx(en,{size:16})}),s.jsx(Dt,{label:"New thread",onClick:()=>{Z()},children:s.jsx(vt,{size:16})})]})]})});return ee?s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[je(!0),s.jsx(At,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain px-1 h-full",children:s.jsx(Pt,{threads:Y,groupBy:S,activeTaskId:b,onSelectTask:q,onArchiveTask:U,filters:P,hasMore:d,isFetchingMore:c,onLoadMore:()=>{m()},filtersActive:ne})}),M&&s.jsx(It,{open:_,onOpenChange:I})]}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[je(!1),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 -mr-2 pr-2",children:s.jsx(At,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain h-full",children:s.jsx(Pt,{threads:Y,groupBy:S,activeTaskId:b,onSelectTask:q,onArchiveTask:U,filters:P,hasMore:d,isFetchingMore:c,onLoadMore:()=>{m()},filtersActive:ne})})}),M&&s.jsx(It,{open:_,onOpenChange:I})]})}const nl=5,il=[{nameWidth:"w-24",taskRows:2},{nameWidth:"w-28",taskRows:0},{nameWidth:"w-20",taskRows:1},{nameWidth:"w-32",taskRows:0},{nameWidth:"w-24",taskRows:0}];function us(){const t=$.c(3),{state:e}=pe();if(e==="collapsed"){let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:nl}).map(ol)}),t[0]=i):i=t[0],i}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(te,{className:"size-6 rounded-md"}),s.jsx(te,{className:"size-6 rounded-md"}),s.jsx(te,{className:"size-6 rounded-md"})]}),s.jsx(te,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n,s.jsx("div",{className:"flex flex-col gap-0.5",children:il.map(ll)})]}),t[2]=l):l=t[2],l}function ll(t,e){return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[s.jsx(te,{className:"size-5 rounded-full shrink-0"}),s.jsx(te,{className:F("h-3",t.nameWidth,"rounded-sm")})]}),t.taskRows>0&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:Array.from({length:t.taskRows}).map(rl)})]},e)}function rl(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(te,{className:"h-3 flex-1 rounded-sm"})},e)}function ol(t,e){return s.jsx(te,{className:"size-10 rounded-lg mx-auto"},e)}function al(){const t=$.c(4),e=ss();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Oi,{}),t[0]=n):n=t[0];let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Rt,{children:s.jsx(E.Suspense,{fallback:s.jsx(us,{}),children:s.jsx(ms,{})})}),t[1]=l):l=t[1];let i;return t[2]!==e?(i=s.jsx(Zt,{children:s.jsx(ls,{sections:e,footer:n,additionalContent:l})}),t[2]=e,t[3]=i):i=t[3],i}function cl(t){const e=$.c(8),{onClose:n}=t,l=ss();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Pi,{}),e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(us,{}),e[1]=r):r=e[1];let a;e[2]!==n?(a=s.jsx(Rt,{children:s.jsx(E.Suspense,{fallback:r,children:s.jsx(ms,{onNavigate:n})})}),e[2]=n,e[3]=a):a=e[3];let o;return e[4]!==n||e[5]!==l||e[6]!==a?(o=s.jsx(Zt,{children:s.jsx(_i,{sections:l,onClose:n,footer:i,additionalContent:a})}),e[4]=n,e[5]=l,e[6]=a,e[7]=o):o=e[7],o}function fs(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const dl=ks({name:As().min(2,"Organization name is required")});function ml(t){const e=$.c(41),{open:n,onOpenChange:l}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={resolver:Is(dl),defaultValues:{name:""}},e[0]=i):i=e[0];const r=zs(i);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={mutationFn:fl,onSuccess:ul},e[1]=a):a=e[1];const o=$s(a),d=o.error instanceof Error?o.error.message:o.error?"Failed to create organization.":null;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(Vn,{children:[s.jsx(Yn,{children:"Create a new organization"}),s.jsx(Qn,{children:"Set up a new organization to collaborate with others."})]}),e[2]=c):c=e[2];let m;if(e[3]!==o||e[4]!==r){let N;e[6]!==o?(N=S=>o.mutateAsync(S),e[6]=o,e[7]=N):N=e[7],m=r.handleSubmit(N),e[3]=o,e[4]=r,e[5]=m}else m=e[5];let u;e[8]!==r.formState.isSubmitting?(u=N=>{const{field:S}=N;return s.jsxs(si,{children:[s.jsx(ni,{children:"Organization Name"}),s.jsx(ii,{children:s.jsx(oi,{...S,placeholder:"Acme Inc.",disabled:r.formState.isSubmitting})}),s.jsx(li,{children:"The name of your company or organization"}),S.value&&s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",s.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",fs(S.value)]})]}),s.jsx(ri,{})]})},e[8]=r.formState.isSubmitting,e[9]=u):u=e[9];let f;e[10]!==r.control||e[11]!==u?(f=s.jsx(ei,{control:r.control,name:"name",render:u}),e[10]=r.control,e[11]=u,e[12]=f):f=e[12];let h;e[13]!==d?(h=d&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:d}),e[13]=d,e[14]=h):h=e[14];let g;e[15]!==o||e[16]!==r?(g=()=>{o.reset(),r.reset()},e[15]=o,e[16]=r,e[17]=g):g=e[17];let j;e[18]!==r.formState.isSubmitting||e[19]!==g?(j=s.jsx(Kn,{disabled:r.formState.isSubmitting,onClick:g,children:"Cancel"}),e[18]=r.formState.isSubmitting,e[19]=g,e[20]=j):j=e[20];const x=!r.formState.isValid||r.formState.isSubmitting;let p;e[21]!==r.formState.isSubmitting?(p=r.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Hn,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=r.formState.isSubmitting,e[22]=p):p=e[22];let b;e[23]!==x||e[24]!==p?(b=s.jsx(Je,{type:"submit",variant:"default",disabled:x,children:p}),e[23]=x,e[24]=p,e[25]=b):b=e[25];let v;e[26]!==b||e[27]!==j?(v=s.jsxs(Jn,{children:[j,b]}),e[26]=b,e[27]=j,e[28]=v):v=e[28];let y;e[29]!==v||e[30]!==m||e[31]!==f||e[32]!==h?(y=s.jsxs("form",{className:"space-y-6",onSubmit:m,autoComplete:"off",children:[f,h,v]}),e[29]=v,e[30]=m,e[31]=f,e[32]=h,e[33]=y):y=e[33];let w;e[34]!==r||e[35]!==y?(w=s.jsxs(Xn,{children:[c,s.jsx(ti,{...r,children:y})]}),e[34]=r,e[35]=y,e[36]=w):w=e[36];let C;return e[37]!==l||e[38]!==n||e[39]!==w?(C=s.jsx(Zn,{open:n,onOpenChange:l,children:w}),e[37]=l,e[38]=n,e[39]=w,e[40]=C):C=e[40],C}function ul(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function fl(t){const e=fs(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await he.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const l=n?.data?.slug??e;if(!l)throw new Error("Failed to create organization");return{orgSlug:l}}function hs(){const t=E.useContext(Ts),{data:e,refetch:n}=t.hooks.useListUserInvitations();return{invitations:(e??[]).filter(i=>i.status==="pending"&&new Date(i.expiresAt)>new Date),refetch:()=>n?.()}}function hl(t){let e=0;for(let l=0;l<t.length;l++)e=t.charCodeAt(l)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function pt(t){const e=$.c(13),{org:n,size:l}=t,i=l===void 0?"sm":l,r=i==="xs"?"size-5":"size-6",a=i==="xs"?"text-[9px]":"text-xs";let o;e[0]!==r?(o=F(r,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=r,e[1]=o):o=e[1];let d;e[2]!==n.logo||e[3]!==n.name?(d=n.logo?void 0:hl(n.name),e[2]=n.logo,e[3]=n.name,e[4]=d):d=e[4];let c;e[5]!==n.logo||e[6]!==n.name||e[7]!==a?(c=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:F("font-semibold leading-none",a),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=a,e[8]=c):c=e[8];let m;return e[9]!==o||e[10]!==d||e[11]!==c?(m=s.jsx("div",{className:o,style:d,children:c}),e[9]=o,e[10]=d,e[11]=c,e[12]=m):m=e[12],m}function xl({invitation:t,onChanged:e}){const[n,l]=E.useState(!1),i=t.organizationName??"Unknown organization",r=async()=>{l(!0);try{const d=await he.organization.acceptInvitation({invitationId:t.id});if(d.error){re.error(d.error.message),l(!1);return}}catch{re.error("Failed to accept invitation"),l(!1);return}re.success(`Joined ${i}`),Os();let o;try{o=(await he.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=o?`/${o}`:"/"},a=async()=>{l(!0);try{const o=await he.organization.rejectInvitation({invitationId:t.id});if(o.error){re.error(o.error.message),l(!1);return}re.success("Invitation declined"),l(!1),e()}catch{re.error("Failed to decline invitation"),l(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[s.jsx(pt,{org:{name:i},size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:i}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:"Invited to join"})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx(Je,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:r,disabled:n,children:"Accept"}),s.jsx(Je,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:a,disabled:n,"aria-label":`Decline invitation to ${i}`,children:s.jsx(qn,{size:14})})]})]})}function pl(t){const e=$.c(29),{orgParam:n,onSelectOrg:l,onCreateOrg:i}=t,{data:r}=Ms(),{invitations:a,refetch:o}=hs();let d;e[0]!==n?(d=(_,I)=>_.slug===n?-1:I.slug===n?1:_.name.localeCompare(I.name),e[0]=n,e[1]=d):d=e[1];const c=[...r??[]].sort(d),[m,u]=E.useState(""),f=m.toLowerCase(),h=f?c.filter(_=>_.name.toLowerCase().includes(f)||_.slug.toLowerCase().includes(f)):c;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ts,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=g):g=e[2];let j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=_=>u(_.target.value),e[3]=j):j=e[3];let x;e[4]!==m?(x=_=>_.key==="Escape"&&m&&u(""),e[4]=m,e[5]=x):x=e[5];let p;e[6]!==m||e[7]!==x?(p=s.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:m,onChange:j,onKeyDown:x,placeholder:"Search organizations...",className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[6]=m,e[7]=x,e[8]=p):p=e[8];let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx($e,{size:16}),e[9]=b):b=e[9];let v;e[10]!==i?(v=s.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:b}),e[10]=i,e[11]=v):v=e[11];let y;e[12]!==p||e[13]!==v?(y=s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[g,p,v]}),e[12]=p,e[13]=v,e[14]=y):y=e[14];const w="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let C;e[15]!==a||e[16]!==m||e[17]!==o?(C=!m&&a.map(_=>s.jsx(xl,{invitation:_,onChanged:o},_.id)),e[15]=a,e[16]=m,e[17]=o,e[18]=C):C=e[18];const N=h.length===0&&s.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:m?`No organizations match "${m}"`:"No organizations available"});let S;e[19]!==l||e[20]!==n?(S=_=>s.jsxs("button",{type:"button",onClick:()=>l(_.slug),className:F("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",_.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(pt,{org:_,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:_.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.slug})]}),_.slug===n&&s.jsx(es,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},_.id),e[19]=l,e[20]=n,e[21]=S):S=e[21];const A=h.map(S);let k;e[22]!==C||e[23]!==N||e[24]!==A?(k=s.jsxs("div",{className:w,children:[C,N,A]}),e[22]=C,e[23]=N,e[24]=A,e[25]=k):k=e[25];let z;return e[26]!==k||e[27]!==y?(z=s.jsxs(s.Fragment,{children:[y,k]}),e[26]=k,e[27]=y,e[28]=z):z=e[28],z}function gl(t){const e=$.c(22),{trigger:n,orgParam:l,align:i,side:r}=t,a=i===void 0?"start":i,o=r===void 0?"bottom":r,d=xe(),[c,m]=E.useState(!1),[u,f]=E.useState(!1);let h;e[0]!==n?(h=s.jsx(ze,{asChild:!0,children:n}),e[0]=n,e[1]=h):h=e[1];const g=String(c);let j;e[2]!==d?(j=C=>{m(!1),d({to:"/$org",params:{org:C}})},e[2]=d,e[3]=j):j=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{m(!1),f(!0)},e[4]=x):x=e[4];let p;e[5]!==l||e[6]!==g||e[7]!==j?(p=s.jsx(pl,{orgParam:l,onSelectOrg:j,onCreateOrg:x},g),e[5]=l,e[6]=g,e[7]=j,e[8]=p):p=e[8];let b;e[9]!==a||e[10]!==o||e[11]!==p?(b=s.jsx(Ue,{side:o,align:a,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:jl,onCloseAutoFocus:bl,children:p}),e[9]=a,e[10]=o,e[11]=p,e[12]=b):b=e[12];let v;e[13]!==c||e[14]!==h||e[15]!==b?(v=s.jsxs(Ge,{open:c,onOpenChange:m,children:[h,b]}),e[13]=c,e[14]=h,e[15]=b,e[16]=v):v=e[16];let y;e[17]!==u?(y=s.jsx(ml,{open:u,onOpenChange:f}),e[17]=u,e[18]=y):y=e[18];let w;return e[19]!==y||e[20]!==v?(w=s.jsxs(s.Fragment,{children:[v,y]}),e[19]=y,e[20]=v,e[21]=w):w=e[21],w}function bl(t){return t.preventDefault()}function jl(t){t.preventDefault(),t.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function vl(t){const e=$.c(21),{value:n,onChange:l,placeholder:i,onKeyDown:r,className:a,isSearching:o,disabled:d}=t,c=i===void 0?"Search...":i;let m;e[0]!==a?(m=F("shrink-0 w-full border-b border-border h-12",a),e[0]=a,e[1]=m):m=e[1];const u=d?"cursor-not-allowed opacity-50":"cursor-text";let f;e[2]!==u?(f=F("flex items-center gap-2.5 h-12 px-4",u),e[2]=u,e[3]=f):f=e[3];let h;e[4]!==o?(h=o?s.jsx(Lt,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(ts,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=o,e[5]=h):h=e[5];let g;e[6]!==l?(g=b=>l(b.target.value),e[6]=l,e[7]=g):g=e[7];let j;e[8]!==d||e[9]!==r||e[10]!==c||e[11]!==g||e[12]!==n?(j=s.jsx("input",{type:"text",value:n,onChange:g,onKeyDown:r,placeholder:c,disabled:d,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=d,e[9]=r,e[10]=c,e[11]=g,e[12]=n,e[13]=j):j=e[13];let x;e[14]!==f||e[15]!==h||e[16]!==j?(x=s.jsxs("label",{className:f,children:[h,j]}),e[14]=f,e[15]=h,e[16]=j,e[17]=x):x=e[17];let p;return e[18]!==m||e[19]!==x?(p=s.jsx("div",{className:m,children:x}),e[18]=m,e[19]=x,e[20]=p):p=e[20],p}const yl="Select an existing agent";function Sl(t){const e=$.c(5),{children:n}=t;let l;e[0]!==n?(l=s.jsx(ce,{asChild:!0,children:n}),e[0]=n,e[1]=l):l=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(de,{side:"right",sideOffset:8,children:yl}),e[2]=i):i=e[2];let r;return e[3]!==l?(r=s.jsxs(me,{defaultOpen:!0,delayDuration:0,children:[l,i]}),e[3]=l,e[4]=r):r=e[4],r}function Nl(t){const e=xe(),{create:n}=Vt(),{locator:l}=se(),i=lt({strict:!1}),r=rt({strict:!1});return async a=>{const o=crypto.randomUUID(),d=a===r.virtualmcpid?vn(t,l,i.taskId??""):null;try{await n({id:o,virtual_mcp_id:a,...d?{branch:d}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:o},search:{virtualmcpid:a}})}}function Qe(t){const e=$.c(20),{agent:n,selected:l,onClick:i}=t,r=l?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let a;e[0]!==r?(a=F("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",r),e[0]=r,e[1]=a):a=e[1];let o;e[2]!==n.icon||e[3]!==n.title?(o=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[2]=n.icon,e[3]=n.title,e[4]=o):o=e[4];let d;e[5]!==n.title?(d=s.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[5]=n.title,e[6]=d):d=e[6];let c;e[7]!==n.description?(c=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[7]=n.description,e[8]=c):c=e[8];let m;e[9]!==d||e[10]!==c?(m=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,c]}),e[9]=d,e[10]=c,e[11]=m):m=e[11];let u;e[12]!==l?(u=l&&s.jsx(es,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=l,e[13]=u):u=e[13];let f;return e[14]!==i||e[15]!==a||e[16]!==o||e[17]!==m||e[18]!==u?(f=s.jsxs("button",{type:"button",onClick:i,className:a,children:[o,m,u]}),e[14]=i,e[15]=a,e[16]=o,e[17]=m,e[18]=u,e[19]=f):f=e[19],f}function Ft(t){const e=$.c(5),{children:n,action:l}=t;let i;e[0]!==n?(i=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n}),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==l||e[3]!==i?(r=s.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[i,l]}),e[2]=l,e[3]=i,e[4]=r):r=e[4],r}function _l(t){const e=$.c(27),{onClose:n,onSelectAgent:l,selectedAgentId:i,onImportFromGithub:r}=t,[a,o]=E.useState(""),d=Xt(),c=d??[],{org:m}=se(),{data:u}=he.useSession(),f=u?.user?.id??"anon",h=Ln(d),g=Rn(),j=Nl(m.slug),x=an(d),p=a.toLowerCase(),b=c.filter(Al).filter(B=>!x.has(B.id)).filter(kl).filter(B=>!a||B.title.toLowerCase().includes(p)),v=b.filter(wl),y=b.filter(Cl),w=Re(m.id),C=!a||w.title.toLowerCase().includes(p),N=!!(l&&C);let S;e[0]!==n||e[1]!==l?(S=()=>{l?.(null),n(),o("")},e[0]=n,e[1]=l,e[2]=S):S=e[2];const A=S,k=B=>{if(l){l(B.id),n(),o("");return}Bn({orgId:m.id,userId:f},B.id,h),g(),n(),o(""),j(B.id)},z="flex flex-col max-h-[min(640px,80dvh)]";let _;e[3]!==a?(_=s.jsx(vl,{value:a,onChange:o,placeholder:"Search agents..."}),e[3]=a,e[4]=_):_=e[4];const I="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",M=l&&C&&w&&s.jsx(Qe,{agent:w,selected:!i||i===w.id,onClick:A}),L=y.length>0&&s.jsx(Ft,{children:"Agents"}),P=y.map(B=>s.jsx(Qe,{agent:B,selected:l?i===B.id:void 0,onClick:()=>k(B)},B.id)),D=(v.length>0||!a)&&s.jsx(Ft,{action:s.jsxs("button",{type:"button",onClick:r,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:[s.jsx(ci,{className:"size-3.5"}),"Import"]}),children:"Code Agents"}),O=v.map(B=>s.jsx(Qe,{agent:B,selected:l?i===B.id:void 0,onClick:()=>k(B)},B.id));let R;e[5]!==N||e[6]!==a||e[7]!==b.length?(R=b.length===0&&!N&&a&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No agents found"}),e[5]=N,e[6]=a,e[7]=b.length,e[8]=R):R=e[8];let G;e[9]!==R||e[10]!==M||e[11]!==L||e[12]!==P||e[13]!==D||e[14]!==O?(G=s.jsxs("div",{className:I,children:[M,L,P,D,O,R]}),e[9]=R,e[10]=M,e[11]=L,e[12]=P,e[13]=D,e[14]=O,e[15]=G):G=e[15];let V;e[16]!==m.slug?(V={org:m.slug},e[16]=m.slug,e[17]=V):V=e[17];let Y;e[18]!==n?(Y=()=>n(),e[18]=n,e[19]=Y):Y=e[19];let U;e[20]!==V||e[21]!==Y?(U=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(Ps,{to:"/$org/settings/agents",params:V,onClick:Y,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[20]=V,e[21]=Y,e[22]=U):U=e[22];let q;return e[23]!==G||e[24]!==U||e[25]!==_?(q=s.jsxs("div",{className:z,children:[_,G,U]}),e[23]=G,e[24]=U,e[25]=_,e[26]=q):q=e[26],q}function Cl(t){return!Kt(t.metadata)}function wl(t){return Kt(t.metadata)}function kl(t){return!gn(t.id)}function Al(t){return!pn(t.id)}function Il(t){const e=$.c(31);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:l,trigger:i,onSelectAgent:r,selectedAgentId:a,side:o,align:d}=n,c=l===void 0?!1:l,m=o===void 0?"right":o,u=d===void 0?"start":d,[f,h]=E.useState(!1),[g,j]=E.useState(!1),x=ct(),{setOpenMobile:p}=pe(),b=En(),v=b?"border border-border":void 0;let y;e[2]!==b?(y=L=>b?s.jsx(Sl,{children:L}):L,e[2]=b,e[3]=y):y=e[3];const w=y;let C;e[4]!==x||e[5]!==p?(C=()=>{h(!1),x&&p(!1)},e[4]=x,e[5]=p,e[6]=C):C=e[6];const N=C;let S;e[7]!==N?(S=()=>{N(),j(!0)},e[7]=N,e[8]=S):S=e[8];const A=S;let k;e[9]!==N||e[10]!==A||e[11]!==r||e[12]!==f||e[13]!==a?(k=f&&s.jsx(E.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(te,{className:"h-4 w-24"})}),children:s.jsx(_l,{onClose:N,onSelectAgent:r,selectedAgentId:a,onImportFromGithub:A})}),e[9]=N,e[10]=A,e[11]=r,e[12]=f,e[13]=a,e[14]=k):k=e[14];const z=k;let _;e[15]!==u||e[16]!==c||e[17]!==v||e[18]!==b||e[19]!==x||e[20]!==f||e[21]!==z||e[22]!==m||e[23]!==i||e[24]!==w?(_=x?s.jsxs(s.Fragment,{children:[i?s.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:i}):c?w(s.jsx(ve,{"aria-label":"Browse agents",className:F(v),onClick:()=>{oe("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:s.jsx($e,{className:"size-4"})})):s.jsx(K,{children:w(s.jsxs(J,{tooltip:b?void 0:"Browse agents",className:F(v),onClick:()=>{oe("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:[s.jsx($e,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(Ut,{open:f,onOpenChange:h,direction:"bottom",children:s.jsxs(Wt,{className:"max-h-[85dvh] p-0",children:[s.jsx(qt,{className:"sr-only",children:"Browse agents"}),z]})})]}):s.jsxs(Ge,{open:f,onOpenChange:L=>{L&&!f&&oe("agent_browser_opened",{surface:"desktop_popover"}),h(L)},children:[i?s.jsx(ze,{asChild:!0,children:i}):c?w(s.jsx(ze,{asChild:!0,children:s.jsx(ve,{"aria-label":"Browse agents",className:F(v),children:s.jsx($e,{className:"size-4"})})})):s.jsx(K,{children:w(s.jsx(ze,{asChild:!0,children:s.jsxs(J,{tooltip:b?void 0:"Browse agents",className:F(v),children:[s.jsx($e,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Ue,{className:"w-[380px] p-0 overflow-hidden",side:m,align:u,children:z})]}),e[15]=u,e[16]=c,e[17]=v,e[18]=b,e[19]=x,e[20]=f,e[21]=z,e[22]=m,e[23]=i,e[24]=w,e[25]=_):_=e[25];let I;e[26]!==g?(I=s.jsx(ai,{open:g,onOpenChange:j,mode:"agent"}),e[26]=g,e[27]=I):I=e[27];let M;return e[28]!==I||e[29]!==_?(M=s.jsxs(s.Fragment,{children:[_,I]}),e[28]=I,e[29]=_,e[30]=M):M=e[30],M}const zl="wco-no-drag inline-flex items-center gap-1.5 min-w-0 rounded-md px-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 $l(t){const e=$.c(19),{agentId:n,fallback:l,onOpenHome:i,onPick:r}=t,a=mt(n)??l??null,o=a?.title??"Super Agent",d=`Open ${o} home`,c=a?.icon??null;let m;e[0]!==c||e[1]!==o?(m=s.jsx(ye,{icon:c,name:o,size:"xs"}),e[0]=c,e[1]=o,e[2]=m):m=e[2];let u;e[3]!==i||e[4]!==d||e[5]!==m?(u=s.jsx("button",{type:"button",onClick:i,"aria-label":d,className:"wco-no-drag 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:m}),e[3]=i,e[4]=d,e[5]=m,e[6]=u):u=e[6];let f;e[7]!==o?(f=s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:o}),e[7]=o,e[8]=f):f=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[9]=h):h=e[9];let g;e[10]!==f?(g=s.jsxs("button",{type:"button",className:zl,children:[f,h]}),e[10]=f,e[11]=g):g=e[11];let j;e[12]!==n||e[13]!==r||e[14]!==g?(j=s.jsx(Il,{side:"bottom",align:"start",selectedAgentId:n,onSelectAgent:r,trigger:g}),e[12]=n,e[13]=r,e[14]=g,e[15]=j):j=e[15];let x;return e[16]!==u||e[17]!==j?(x=s.jsxs("div",{className:"flex items-center gap-1",children:[u,j]}),e[16]=u,e[17]=j,e[18]=x):x=e[18],x}function Et(){const t=$.c(43),{org:e}=se(),{state:n,isMobile:l}=pe(),i=xe();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const a=lt(r);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[1]=o):o=t[1];const d=rt(o),{threads:c}=ut(),{setTaskId:m,createNewTask:u}=ft(),f=hs().invitations.length>0,h=n==="collapsed"||l;let g;t[2]!==e.id?(g=Re(e.id),t[2]=e.id,t[3]=g):g=t[3];const j=g,x=j.id,p=a.taskId?d.virtualmcpid??x:x;let b;t[4]!==u||t[5]!==x||t[6]!==i||t[7]!==e.slug||t[8]!==m||t[9]!==c?(b=O=>{if(!O||O===x){i({to:"/$org",params:{org:e.slug}});return}const R=di(c,O);R?m(R.id,O):u(O)},t[4]=u,t[5]=x,t[6]=i,t[7]=e.slug,t[8]=m,t[9]=c,t[10]=b):b=t[10];const v=b,y=f?`${e.name} — switch organization (pending invitation)`:`${e.name} — switch organization`;let w;t[11]!==e?(w=s.jsx(pt,{org:e,size:"sm"}),t[11]=e,t[12]=w):w=t[12];let C;t[13]!==f||t[14]!==h?(C=f&&s.jsx("span",{className:F("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",h?"-top-1":"top-1/2 -translate-y-1/2")}),t[13]=f,t[14]=h,t[15]=C):C=t[15];let N;t[16]!==w||t[17]!==C?(N=s.jsxs("span",{className:"relative inline-flex",children:[w,C]}),t[16]=w,t[17]=C,t[18]=N):N=t[18];let S;t[19]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[19]=S):S=t[19];let A;t[20]!==y||t[21]!==N?(A=s.jsx(ce,{asChild:!0,children:s.jsxs("button",{type:"button","aria-label":y,className:"wco-no-drag flex items-center gap-1.5 shrink-0 rounded-md pl-3 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:[N,S]})}),t[20]=y,t[21]=N,t[22]=A):A=t[22];let k;t[23]!==e.slug||t[24]!==A?(k=s.jsx(gl,{orgParam:e.slug,trigger:A}),t[23]=e.slug,t[24]=A,t[25]=k):k=t[25];let z;t[26]!==e.name?(z=s.jsx(de,{side:"bottom",children:e.name}),t[26]=e.name,t[27]=z):z=t[27];let _;t[28]!==k||t[29]!==z?(_=s.jsx(St,{children:s.jsxs(me,{children:[k,z]})}),t[28]=k,t[29]=z,t[30]=_):_=t[30];let I;t[31]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),t[31]=I):I=t[31];const M=p===x?j:void 0;let L;t[32]!==p||t[33]!==v?(L=()=>v(p),t[32]=p,t[33]=v,t[34]=L):L=t[34];let P;t[35]!==p||t[36]!==v||t[37]!==M||t[38]!==L?(P=s.jsx(St,{children:s.jsx(E.Suspense,{fallback:I,children:s.jsx($l,{agentId:p,fallback:M,onOpenHome:L,onPick:v})})}),t[35]=p,t[36]=v,t[37]=M,t[38]=L,t[39]=P):P=t[39];let D;return t[40]!==_||t[41]!==P?(D=s.jsx(Un,{className:"wco-no-drag",children:s.jsxs(Wn,{className:"flex-nowrap gap-1.5 sm:gap-1.5",children:[_,P]})}),t[40]=_,t[41]=P,t[42]=D):D=t[42],D}const Tl="sidebar.open";function Ml(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Fs,{}),t[0]=e):e=t[0],e}function qo(){const t=$.c(27),e=ct(),n=mi(),[l,i]=He(Tl,!1),{width:r,wrapperRef:a,onStartResize:o,resetWidth:d}=xi();let c;t[0]!==e||t[1]!==n?(c=e?s.jsxs(Q.Header,{className:"grid-cols-1 px-1 pr-1",children:[s.jsxs("div",{className:"grid w-full grid-cols-[auto_auto_auto_1fr_auto_auto] items-center gap-2",children:[!n&&s.jsx(Jt,{}),!n&&s.jsx(Et,{}),!n&&s.jsx(nt,{}),s.jsx("div",{"aria-hidden":!0,className:"min-w-0"}),s.jsx(Q.TogglesSlot,{}),!n&&s.jsx(Q.TabsSlot,{className:"min-w-0 justify-self-end"})]}),!n&&s.jsx(Q.CenterSlot,{}),!n&&s.jsx(Q.RightSlot,{})]}):s.jsxs(Q.Header,{children:[s.jsxs(Q.LeftColumn,{children:[!n&&s.jsx(Et,{}),s.jsx(Q.TogglesSlot,{})]}),n?s.jsx("div",{"aria-hidden":!0}):s.jsx(Q.CenterSlot,{}),s.jsx(Q.RightColumn,{children:!n&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] flex justify-end items-center gap-0.5",children:s.jsx(Q.TabsSlot,{})}),s.jsx(Q.RightSlot,{})]})})]}),t[0]=e,t[1]=n,t[2]=c):c=t[2];const m=`${r}px`;let u;t[3]!==m?(u={"--sidebar-width":m,"--sidebar-width-icon":"3.5rem"},t[3]=m,t[4]=u):u=t[4];const f=u;let h;t[5]!==e||t[6]!==o||t[7]!==n||t[8]!==d?(h=!e&&!n&&s.jsxs(s.Fragment,{children:[s.jsx(al,{}),s.jsx(ui,{onPointerDown:o,onDoubleClick:d})]}),t[5]=e,t[6]=o,t[7]=n,t[8]=d,t[9]=h):h=t[9];let g;t[10]===Symbol.for("react.memo_cache_sentinel")?(g={background:"transparent",containerType:"inline-size"},t[10]=g):g=t[10];let j;t[11]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Rs,{className:"flex flex-col",style:g,children:s.jsx("div",{className:"flex flex-col h-full min-h-0",children:s.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s.jsx(E.Suspense,{fallback:s.jsx(Ml,{}),children:s.jsx(Ds,{})})})})}),t[11]=j):j=t[11];let x;t[12]!==f||t[13]!==h||t[14]!==a?(x=s.jsxs(Bs,{ref:a,className:"flex-1 bg-sidebar relative min-h-0",style:f,children:[h,j]}),t[12]=f,t[13]=h,t[14]=a,t[15]=x):x=t[15];let p;t[16]!==e||t[17]!==n?(p=e&&!n&&s.jsx($n,{renderSidebar:Ol}),t[16]=e,t[17]=n,t[18]=p):p=t[18];let b;t[19]!==c||t[20]!==x||t[21]!==p?(b=s.jsx(Gn,{children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[c,x,p]})}),t[19]=c,t[20]=x,t[21]=p,t[22]=b):b=t[22];let v;return t[23]!==i||t[24]!==l||t[25]!==b?(v=s.jsx(jn,{children:s.jsx(Q.Provider,{children:s.jsx(Hs,{open:l,onOpenChange:i,children:b})})}),t[23]=i,t[24]=l,t[25]=b,t[26]=v):v=t[26],v}function Ol(t){const{onClose:e}=t;return s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"w-full bg-sidebar flex flex-col overflow-y-auto group/sidebar","data-state":"expanded",children:s.jsx(cl,{onClose:e})})})}export{qo as default};
1
+ import{c as $,j as s,Y as He,r as E,l as F,M as oe,Z as bs,_ as js,a as he,$ as se,b as xe,a0 as vs,a1 as ys,t as re,a2 as Ss,a3 as Ns,K as _s,k as Cs,a4 as ws,i as Lt,e as lt,u as rt,P as Rt,G as ks,H as As,I as Is,J as zs,d as $s,B as Je,a5 as Ts,T as Ms,U as Os,a6 as Ps,X as Ds,a7 as Fs}from"./index-Dsd_iuEd.js";import{u as pe,S as ot,a as at,b as ae,c as J,d as K,e as Bt,f as Ht,g as Es,h as Ls,i as Ze,j as Rs,k as Bs,l as Hs}from"./sidebar-BBuVIXs3.js";import{u as ct}from"./use-mobile-zlseXNZw.js";import{S as te}from"./skeleton-DSOwcq5l.js";import{i as Gt}from"./LayoutLeft-SufEyqlt.js";import{T as ve}from"./toolbar-icon-button-AVA73zGb.js";import{P as Ge,a as ze,b as Ue}from"./popover-3culmC-p.js";import{D as Ut,a as Wt,b as qt}from"./drawer-BT0nO7Gh.js";import{A as Le}from"./avatar-DovY7muZ.js";import{a as ce,b as de,c as et,T as me}from"./tooltip-CQRmXLdK.js";import{a as gt}from"./Copy01-B3rMPdnI.js";import{n as Gs,i as Us}from"./Globe01-t_Xn7EOD.js";import{i as Ws}from"./ZoomOut-H4y0o0fz.js";import{i as qs,a as Ks}from"./ZapSquare-6fv6OHRe.js";import{i as tt}from"./Monitor01-Di2J1pIG.js";import{n as Xs,a as Vs}from"./Sun-iQ9ZpSHi.js";import{a as dt}from"./Settings02-DOBWjsq7.js";import{i as Ys}from"./Shield01-Cbocz3h7.js";import{a as Qs}from"./Users03-DUE7duSR.js";import{a as bt,b as jt,c as Js,d as Zs,A as ye,e as vt,i as en,s as tn,f as sn}from"./agent-icon-CNKD9od7.js";import"./index-RuoMzh-H.js";import{I as nn}from"./invite-member-dialog-aSyF--9v.js";import{u as ln,A as rn,g as on,a as an,b as Kt}from"./agent-capabilities-C8aAokhv.js";import{u as cn,v as dn,C as yt}from"./connect-desktop-dialog-D-rafo3k.js";import{i as mn}from"./FilterLines-C_kuJjS_.js";import{T as un,a as fn}from"./toggle-group-DSuixrOu.js";import{u as hn}from"./use-mcp-client-B6xEVCdZ.js";import{S as xn,a as Re,i as pn,b as gn}from"./constants-B72Xmt_K.js";import{u as mt,a as Xt}from"./use-virtual-mcp-CR8RESJp.js";import{u as bn,a as ut,b as Vt,T as jn}from"./hooks-BmOjuM2y.js";import{u as ft,r as vn}from"./shell-layout-BIM9a05w.js";import{c as yn,a as Sn,b as Nn,d as _n,e as Cn}from"./dialog-DLuAdZWN.js";import{C as wn,a as kn,b as An,c as In,d as zn}from"./command-COJkBM8v.js";import{u as Yt}from"./studio-tools-CTXw_HGo.js";import{i as Qt}from"./Zap-BnHiHTqy.js";import{S as Jt,M as $n}from"./shell-controls-Bi1SklEo.js";import{n as Tn}from"./Stars02-5EW8AGHQ.js";import{g as Mn,u as On,S as Pn}from"./use-clock-tick-fro43T2v.js";import{f as Dn}from"./format-time-Cy7tTmZp.js";import{t as ht}from"./ChevronDown-spisuOMX.js";import{i as Fn}from"./ChevronRight-ClO8KFuz.js";import{S as Zt,u as En,g as Ln,a as Rn,b as Bn}from"./use-navigate-to-agent-DukigbvT.js";import{S as Hn,C as Gn}from"./chat-context-DHy9Wrla.js";import{B as St,a as Un,b as Wn}from"./breadcrumb-pCkbw6OY.js";import{i as es}from"./Check-B8jlzVAe.js";import{s as $e}from"./Plus-B0nun22d.js";import{i as ts}from"./SearchMd-ByGwfofO.js";import{s as qn}from"./XClose-CiCDgOUG.js";import{A as Kn,a as Xn,b as Vn,c as Yn,d as Qn,e as Jn,f as Zn}from"./alert-dialog-NIL7nG4k.js";import{F as ei,a as ti,b as si,c as ni,d as ii,f as li,e as ri}from"./form-B7RrBOMB.js";import{I as oi}from"./input-DVEzPKKj.js";import{G as ai,a as ci}from"./github-repo-picker-Dykj2qFx.js";import{f as di}from"./reusable-new-chat-qqWu133U.js";import{T as Q}from"./toolbar-BgxtbB8k.js";import{u as mi}from"./use-organization-settings-DVhD0MdP.js";import"./X-DXVAJV8x.js";import"./User01-B-D44sqE.js";import"./AlertCircle-B4rVzjGb.js";import"./Tool01-DqOmVP7D.js";import"./SwitchHorizontal01-l385tnk6.js";import"./XCircle-DWSiH6uW.js";import"./ArrowUpRight-Dfyxpo1c.js";import"./Loading02-DpP2ZUzL.js";import"./CheckCircle-BGBFQ7TU.js";import"./ChevronUp-CjW_m4ZD.js";import"./Circle-DbRXoiZZ.js";import"./DotsVertical-D6_pKTzA.js";import"./Eye-Bca7Lcn-.js";import"./Star01-DVZvfUNG.js";import"./Globe04-C4us4GD8.js";import"./HardDrive-DPY2W1oq.js";import"./Key01-C4NN9OUR.js";import"./LinkExternal01-CarrE4qF.js";import"./List-DdFdW6qh.js";import"./Palette-DfvsIzkI.js";import"./Play-C4x8-9Mt.js";import"./SearchLg-DQbhUEwD.js";import"./Stars01-BQBCKlQH.js";import"./Trash01-DUs3g8yj.js";import"./Upload01-pIKYD9iV.js";import"./Users01-DQ-Z1cTM.js";import"./select-BkgqDf7e.js";import"./textarea-Cq3eLWgU.js";import"./use-org-auth-client-C-Z33Ztc.js";import"./use-organization-roles-CGYFQ6NZ.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-ByKWgKNO.js";import"./use-registry-connections-vzpQSjWc.js";import"./use-connection-BjAQgmP6.js";import"./use-collections-YymHP9DJ.js";import"./useInfiniteQuery-BZ1RPZ6t.js";import"./use-infinite-scroll-BDJdA7B_.js";import"./extract-connection-data-89-kNEsj.js";import"./card-dWlW4g_n.js";import"./integration-icon-DqkK9Eex.js";import"./collection-search-DI69OYkt.js";import"./collection-tabs-CQALAm3p.js";import"./badge-D4pyOmCp.js";import"./connection-form-helpers-BX_278as.js";import"./authenticate-and-persist-oauth-XK4s1c0p.js";import"./mcp-oauth-5ck9cQwI.js";import"./auth-stk4L42H.js";import"./useSuspenseInfiniteQuery-5igL8BlZ.js";import"./use-ai-providers-BvN_YPeM.js";import"./decopilot-sse-pool-CEetn8QJ.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./required-auth-layout-Dpk92TPe.js";import"./autosend-CIRnSFlG.js";import"./tab-id-DAJ8K7VA.js";import"./use-org-sso-BxT29NsJ.js";import"./index-D4SvmBXn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-decopilot-events-TPOfwfqa.js";import"./label-KpXEJk-h.js";import"./use-debounced-value-BU9d5vE5.js";import"./use-mcp-tools-CMNfuH8d.js";import"./github-installations-DzN1UQ4x.js";function ui(t){const e=$.c(5),{onPointerDown:n,onDoubleClick:l}=t,{state:i,isMobile:r}=pe();if(r||i==="collapsed")return null;let a,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={left:"var(--sidebar-width)"},o=s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border"}),e[0]=a,e[1]=o):(a=e[0],o=e[1]);let d;return e[2]!==l||e[3]!==n?(d=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize, double-click to reset",onPointerDown:n,onDoubleClick:l,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize",style:a,children:o}),e[2]=l,e[3]=n,e[4]=d):d=e[4],d}const xt=240,fi=400,hi="sidebar.width";function Te(t){return Math.max(xt,Math.min(fi,t))}function xi(){const t=$.c(11),[e,n]=He(hi,pi),l=E.useRef(null);let i;t[0]!==n||t[1]!==e?(i=m=>{m.preventDefault();const u=m.clientX,f=Te(e),h=l.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),g=h?Array.from(h.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const p of g)p.style.transition="none";const j=p=>{const b=Te(f+(p.clientX-u));h?.style.setProperty("--sidebar-width",`${b}px`)},x=p=>{const b=Te(f+(p.clientX-u));n(b);for(const v of g)v.style.transition="";window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",x),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",j),window.addEventListener("pointerup",x)},t[0]=n,t[1]=e,t[2]=i):i=t[2];const r=i;let a;t[3]!==n?(a=()=>{n(xt)},t[3]=n,t[4]=a):a=t[4];const o=a;let d;t[5]!==e?(d=Te(e),t[5]=e,t[6]=d):d=t[6];let c;return t[7]!==r||t[8]!==o||t[9]!==d?(c={width:d,wrapperRef:l,onStartResize:r,resetWidth:o},t[7]=r,t[8]=o,t[9]=d,t[10]=c):c=t[10],c}function pi(t){return typeof t=="number"?Te(t):xt}function ss(){return[]}function ns(t){const e=$.c(3),{children:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=l):l=e[0];let i;return e[1]!==n?(i=s.jsxs(ot,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[l,s.jsx(at,{children:s.jsx(ae,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=i):i=e[2],i}function is(t){const e=$.c(18),{item:n}=t,{isMobile:l,setOpenMobile:i}=pe();let r;e[0]!==l||e[1]!==n||e[2]!==i?(r=()=>{oe("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:l}),n.onClick?.(),l&&i(!1)},e[0]=l,e[1]=n,e[2]=i,e[3]=r):r=e[3];const a=r,o=n.key,d=n.isActive&&"z-10";let c;e[4]!==d?(c=F(d),e[4]=d,e[5]=c):c=e[5];let m;e[6]!==n.label?(m=s.jsx("span",{children:n.label}),e[6]=n.label,e[7]=m):m=e[7];let u;e[8]!==a||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==m?(u=s.jsxs(J,{onClick:a,isActive:n.isActive,tooltip:n.label,children:[n.icon,m]}),e[8]=a,e[9]=n.icon,e[10]=n.isActive,e[11]=n.label,e[12]=m,e[13]=u):u=e[13];let f;return e[14]!==n.key||e[15]!==c||e[16]!==u?(f=s.jsx(K,{className:c,children:u},o),e[14]=n.key,e[15]=c,e[16]=u,e[17]=f):f=e[17],f}function gi(t){const e=$.c(12),{section:n}=t;switch(n.type){case"divider":{let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Bt,{className:"my-2"}),e[0]=l):l=e[0],l}case"spacer":{let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex-1"}),e[1]=l):l=e[1],l}case"group":{const l=n.group.label,i=n.group.defaultExpanded;let r;e[2]!==n.group.items?(r=n.group.items.map(ji),e[2]=n.group.items,e[3]=r):r=e[3];let a;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==r?(a=s.jsx(ns,{label:l,defaultExpanded:i,children:r}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=r,e[7]=a):a=e[7],a}case"items":{let l;e[8]!==n.items?(l=n.items.map(bi),e[8]=n.items,e[9]=l):l=e[9];let i;return e[10]!==l?(i=s.jsx(ot,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(at,{children:s.jsx(ae,{className:"gap-1.5",children:l})})}),e[10]=l,e[11]=i):i=e[11],i}case"custom":return n.content}}function bi(t){return s.jsx(is,{item:t},t.key)}function ji(t){return s.jsx(is,{item:t},t.key)}function vi(t){const e=$.c(14),{sections:n,footer:l,additionalContent:i,variant:r,contentClassName:a}=t,o=r===void 0?"sidebar":r;let d;e[0]!==a?(d=F("flex flex-col flex-1 px-2 pb-2 gap-0.5",a),e[0]=a,e[1]=d):d=e[1];let c;e[2]!==n?(c=n.map(yi),e[2]=n,e[3]=c):c=e[3];let m;e[4]!==i?(m=i&&s.jsx("div",{className:"flex flex-col flex-1 min-h-0 group-data-[state=collapsed]/sidebar:mt-1 group-data-[state=expanded]/sidebar:mt-2",children:i}),e[4]=i,e[5]=m):m=e[5];let u;e[6]!==d||e[7]!==c||e[8]!==m?(u=s.jsxs(Ht,{className:d,children:[c,m]}),e[6]=d,e[7]=c,e[8]=m,e[9]=u):u=e[9];let f;return e[10]!==l||e[11]!==u||e[12]!==o?(f=s.jsxs(Es,{variant:o,children:[u,l]}),e[10]=l,e[11]=u,e[12]=o,e[13]=f):f=e[13],f}function yi(t,e){return s.jsx(gi,{section:t},e)}function ls(t){const e=$.c(2);let n;return e[0]!==t?(n=s.jsx(vi,{...t}),e[0]=t,e[1]=n):n=e[1],n}ls.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,n)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(te,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function Si(t){const e=$.c(16),{onToggle:n,className:l}=t,r=bs().logo??js,a=typeof r=="string"?r:r.light,o=typeof r=="string"?r:r.dark;let d;e[0]!==l?(d=F("flex flex-row items-center gap-2 md:gap-0.5 shrink-0 h-12 pl-1 pr-2 pt-0.25 pb-0","group-data-[collapsible=icon]/sidebar:hidden",l),e[0]=l,e[1]=d):d=e[1];let c;e[2]!==a?(c=s.jsx("img",{src:a,alt:"Logo",className:"size-6 object-contain dark:hidden"}),e[2]=a,e[3]=c):c=e[3];let m;e[4]!==o?(m=s.jsx("img",{src:o,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),e[4]=o,e[5]=m):m=e[5];let u;e[6]!==c||e[7]!==m?(u=s.jsx("span",{className:"flex items-center shrink-0 pl-1",children:s.jsxs("span",{className:"flex items-center shrink-0 px-2",children:[c,m]})}),e[6]=c,e[7]=m,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Gt,{size:16}),e[9]=f):f=e[9];let h;e[10]!==n?(h=s.jsx(ve,{onClick:n,"aria-label":"Toggle sidebar",children:f}),e[10]=n,e[11]=h):h=e[11];let g;return e[12]!==d||e[13]!==u||e[14]!==h?(g=s.jsxs(Ls,{className:d,children:[u,h]}),e[12]=d,e[13]=u,e[14]=h,e[15]=g):g=e[15],g}function Nt(t){const e=$.c(18),{item:n,onClose:l}=t,i=n.isActive&&"z-10";let r;e[0]!==i?(r=F(i),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==n||e[3]!==l?(a=()=>{n.onClick?.(),l()},e[2]=n,e[3]=l,e[4]=a):a=e[4];let o;e[5]!==n.icon?(o=s.jsx("span",{className:"[&>svg]:size-5 shrink-0",children:n.icon}),e[5]=n.icon,e[6]=o):o=e[6];let d;e[7]!==n.label?(d=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=d):d=e[8];let c;e[9]!==n.isActive||e[10]!==n.label||e[11]!==a||e[12]!==o||e[13]!==d?(c=s.jsxs(J,{onClick:a,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[o,d]}),e[9]=n.isActive,e[10]=n.label,e[11]=a,e[12]=o,e[13]=d,e[14]=c):c=e[14];let m;return e[15]!==r||e[16]!==c?(m=s.jsx(K,{className:r,children:c}),e[15]=r,e[16]=c,e[17]=m):m=e[17],m}function Ni(t){const e=$.c(18),{section:n,onClose:l}=t;switch(n.type){case"divider":{let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Bt,{className:"my-2"}),e[0]=i):i=e[0],i}case"spacer":{let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex-1"}),e[1]=i):i=e[1],i}case"group":{const i=n.group.label,r=n.group.defaultExpanded;let a;if(e[2]!==l||e[3]!==n.group.items){let d;e[5]!==l?(d=c=>s.jsx(Nt,{item:c,onClose:l},c.key),e[5]=l,e[6]=d):d=e[6],a=n.group.items.map(d),e[2]=l,e[3]=n.group.items,e[4]=a}else a=e[4];let o;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==a?(o=s.jsx(ns,{label:i,defaultExpanded:r,children:a}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=a,e[10]=o):o=e[10],o}case"items":{let i;if(e[11]!==l||e[12]!==n.items){let a;e[14]!==l?(a=o=>s.jsx(Nt,{item:o,onClose:l},o.key),e[14]=l,e[15]=a):a=e[15],i=n.items.map(a),e[11]=l,e[12]=n.items,e[13]=i}else i=e[13];let r;return e[16]!==i?(r=s.jsx(ot,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(at,{children:s.jsx(ae,{className:"gap-1.5",children:i})})}),e[16]=i,e[17]=r):r=e[17],r}case"custom":return n.content}}function _i(t){const e=$.c(17),{sections:n,onClose:l,footer:i,additionalContent:r}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"h-12 shrink-0"}),e[0]=a):a=e[0];let o;e[1]!==l?(o=s.jsx(E.Suspense,{fallback:a,children:s.jsx(Si,{onToggle:l})}),e[1]=l,e[2]=o):o=e[2];let d;if(e[3]!==l||e[4]!==n){let f;e[6]!==l?(f=(h,g)=>s.jsx(Ni,{section:h,onClose:l},g),e[6]=l,e[7]=f):f=e[7],d=n.map(f),e[3]=l,e[4]=n,e[5]=d}else d=e[5];let c;e[8]!==r?(c=r&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:r}),e[8]=r,e[9]=c):c=e[9];let m;e[10]!==d||e[11]!==c?(m=s.jsxs(Ht,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[d,c]}),e[10]=d,e[11]=c,e[12]=m):m=e[12];let u;return e[13]!==i||e[14]!==o||e[15]!==m?(u=s.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[o,m,i]}),e[13]=i,e[14]=o,e[15]=m,e[16]=u):u=e[16],u}function De(t){const e=$.c(22),{item:n,onClose:l}=t;if(n.href){const d=n.external?"_blank":void 0,c=n.external?"noopener noreferrer":void 0;let m;e[0]!==n.icon?(m=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[0]=n.icon,e[1]=m):m=e[1];let u;e[2]!==n.label?(u=s.jsx("span",{className:"flex-1",children:n.label}),e[2]=n.label,e[3]=u):u=e[3];let f;return e[4]!==n.href||e[5]!==l||e[6]!==d||e[7]!==c||e[8]!==m||e[9]!==u?(f=s.jsxs("a",{href:n.href,target:d,rel:c,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",onClick:l,children:[m,u]}),e[4]=n.href,e[5]=l,e[6]=d,e[7]=c,e[8]=m,e[9]=u,e[10]=f):f=e[10],f}let i;e[11]!==n||e[12]!==l?(i=()=>{n.onClick?.(),l()},e[11]=n,e[12]=l,e[13]=i):i=e[13];let r;e[14]!==n.icon?(r=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[14]=n.icon,e[15]=r):r=e[15];let a;e[16]!==n.label?(a=s.jsx("span",{className:"flex-1",children:n.label}),e[16]=n.label,e[17]=a):a=e[17];let o;return e[18]!==i||e[19]!==r||e[20]!==a?(o=s.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",children:[r,a]}),e[18]=i,e[19]=r,e[20]=a,e[21]=o):o=e[21],o}function _t(t){const e=$.c(126),{user:n,userImage:l,menuItems:i,signOutItem:r,themeOptions:a,preferences:o,setPreferences:d,close:c,isMobile:m}=t;if(m){const U=n?.name??"U";let q;e[0]!==U||e[1]!==l?(q=s.jsx(Le,{url:l,fallback:U,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=U,e[1]=l,e[2]=q):q=e[2];const B=n?.name??"User";let Z;e[3]!==B?(Z=s.jsx("p",{className:"text-sm font-medium truncate",children:B}),e[3]=B,e[4]=Z):Z=e[4];const ge=n?.email;let ee;e[5]!==ge?(ee=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:ge}),e[5]=ge,e[6]=ee):ee=e[6];let ue;e[7]!==Z||e[8]!==ee?(ue=s.jsxs("div",{className:"flex-1 min-w-0",children:[Z,ee]}),e[7]=Z,e[8]=ee,e[9]=ue):ue=e[9];let be;e[10]!==n?(be=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(Ai)},e[10]=n,e[11]=be):be=e[11];let ne;e[12]===Symbol.for("react.memo_cache_sentinel")?(ne=s.jsx(gt,{size:14}),e[12]=ne):ne=e[12];let fe;e[13]!==be?(fe=s.jsx(ce,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:be,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:ne})}),e[13]=be,e[14]=fe):fe=e[14];let je;e[15]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx(de,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=je):je=e[15];let T;e[16]!==fe?(T=s.jsx(et,{delayDuration:300,children:s.jsxs(me,{children:[fe,je]})}),e[16]=fe,e[17]=T):T=e[17];let H;e[18]!==T||e[19]!==q||e[20]!==ue?(H=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[q,ue,T]}),e[18]=T,e[19]=q,e[20]=ue,e[21]=H):H=e[21];let X;if(e[22]!==c||e[23]!==i){let le;e[25]!==c?(le=Pe=>s.jsx(De,{item:Pe,onClose:c},Pe.key),e[25]=c,e[26]=le):le=e[26],X=i.map(le),e[22]=c,e[23]=i,e[24]=X}else X=e[24];let W;e[27]!==c||e[28]!==r?(W=s.jsx(De,{item:r,onClose:c}),e[27]=c,e[28]=r,e[29]=W):W=e[29];let ie;e[30]!==X||e[31]!==W?(ie=s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:s.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[X,W]})}),e[30]=X,e[31]=W,e[32]=ie):ie=e[32];let Se;if(e[33]!==o.theme||e[34]!==d||e[35]!==a){let le;e[37]!==o.theme||e[38]!==d?(le=Pe=>{const{value:Xe,icon:xs,label:ps}=Pe;return s.jsx("button",{type:"button","aria-label":ps,onClick:()=>d(gs=>({...gs,theme:Xe})),className:F("size-8 rounded-md flex items-center justify-center transition-colors",o.theme===Xe?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:xs},Xe)},e[37]=o.theme,e[38]=d,e[39]=le):le=e[39],Se=a.map(le),e[33]=o.theme,e[34]=d,e[35]=a,e[36]=Se}else Se=e[36];let Ne;e[40]!==Se?(Ne=s.jsx("div",{className:"flex items-center gap-0.5",children:Se}),e[40]=Se,e[41]=Ne):Ne=e[41];const qe=o.enableSounds?"Disable sounds":"Enable sounds";let _e;e[42]!==d?(_e=()=>d(ki),e[42]=d,e[43]=_e):_e=e[43];const Ke=o.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let Ce;e[44]!==Ke?(Ce=F("size-8 rounded-md flex items-center justify-center transition-colors",Ke),e[44]=Ke,e[45]=Ce):Ce=e[45];let we;e[46]!==o.enableSounds?(we=o.enableSounds?s.jsx(bt,{size:14}):s.jsx(jt,{size:14}),e[46]=o.enableSounds,e[47]=we):we=e[47];let ke;e[48]!==qe||e[49]!==_e||e[50]!==Ce||e[51]!==we?(ke=s.jsx("button",{type:"button","aria-label":qe,onClick:_e,className:Ce,children:we}),e[48]=qe,e[49]=_e,e[50]=Ce,e[51]=we,e[52]=ke):ke=e[52];let Me;e[53]===Symbol.for("react.memo_cache_sentinel")?(Me=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.45.0"]}),e[53]=Me):Me=e[53];let Ae;e[54]!==ke?(Ae=s.jsxs("div",{className:"flex items-center gap-2",children:[ke,Me]}),e[54]=ke,e[55]=Ae):Ae=e[55];let Ie;e[56]!==Ne||e[57]!==Ae?(Ie=s.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[Ne,Ae]}),e[56]=Ne,e[57]=Ae,e[58]=Ie):Ie=e[58];let Oe;return e[59]!==H||e[60]!==ie||e[61]!==Ie?(Oe=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[H,ie,Ie]}),e[59]=H,e[60]=ie,e[61]=Ie,e[62]=Oe):Oe=e[62],Oe}const u=n?.name??"U";let f;e[63]!==u||e[64]!==l?(f=s.jsx(Le,{url:l,fallback:u,shape:"circle",size:"sm",className:"shrink-0"}),e[63]=u,e[64]=l,e[65]=f):f=e[65];const h=n?.name??"User";let g;e[66]!==h?(g=s.jsx("p",{className:"text-sm font-medium truncate",children:h}),e[66]=h,e[67]=g):g=e[67];const j=n?.email;let x;e[68]!==j?(x=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:j}),e[68]=j,e[69]=x):x=e[69];let p;e[70]!==g||e[71]!==x?(p=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,x]}),e[70]=g,e[71]=x,e[72]=p):p=e[72];let b;e[73]!==n?(b=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(wi)},e[73]=n,e[74]=b):b=e[74];let v;e[75]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(gt,{size:14}),e[75]=v):v=e[75];let y;e[76]!==b?(y=s.jsx(ce,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:b,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:v})}),e[76]=b,e[77]=y):y=e[77];let w;e[78]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(de,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[78]=w):w=e[78];let C;e[79]!==y?(C=s.jsx(et,{delayDuration:300,children:s.jsxs(me,{children:[y,w]})}),e[79]=y,e[80]=C):C=e[80];let N;e[81]!==C||e[82]!==f||e[83]!==p?(N=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[f,p,C]}),e[81]=C,e[82]=f,e[83]=p,e[84]=N):N=e[84];let S;if(e[85]!==c||e[86]!==i){let U;e[88]!==c?(U=q=>s.jsx(De,{item:q,onClose:c},q.key),e[88]=c,e[89]=U):U=e[89],S=i.map(U),e[85]=c,e[86]=i,e[87]=S}else S=e[87];let A;e[90]!==c||e[91]!==r?(A=s.jsx(De,{item:r,onClose:c}),e[90]=c,e[91]=r,e[92]=A):A=e[92];let k;e[93]!==S||e[94]!==A?(k=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[S,A]}),e[93]=S,e[94]=A,e[95]=k):k=e[95];let z;if(e[96]!==o.theme||e[97]!==d||e[98]!==a){let U;e[100]!==o.theme||e[101]!==d?(U=q=>{const{value:B,icon:Z,label:ge}=q;return s.jsx("button",{type:"button","aria-label":ge,onClick:()=>d(ee=>({...ee,theme:B})),className:F("size-7 rounded-md flex items-center justify-center transition-colors",o.theme===B?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Z},B)},e[100]=o.theme,e[101]=d,e[102]=U):U=e[102],z=a.map(U),e[96]=o.theme,e[97]=d,e[98]=a,e[99]=z}else z=e[99];let _;e[103]!==z?(_=s.jsx("div",{className:"flex items-center gap-0.5",children:z}),e[103]=z,e[104]=_):_=e[104];const I=o.enableSounds?"Disable sounds":"Enable sounds";let M;e[105]!==d?(M=()=>d(Ci),e[105]=d,e[106]=M):M=e[106];const L=o.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let P;e[107]!==L?(P=F("size-7 rounded-md flex items-center justify-center transition-colors",L),e[107]=L,e[108]=P):P=e[108];let D;e[109]!==o.enableSounds?(D=o.enableSounds?s.jsx(bt,{size:14}):s.jsx(jt,{size:14}),e[109]=o.enableSounds,e[110]=D):D=e[110];let O;e[111]!==I||e[112]!==M||e[113]!==P||e[114]!==D?(O=s.jsx("button",{type:"button","aria-label":I,onClick:M,className:P,children:D}),e[111]=I,e[112]=M,e[113]=P,e[114]=D,e[115]=O):O=e[115];let R;e[116]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.45.0"]}),e[116]=R):R=e[116];let G;e[117]!==O?(G=s.jsxs("div",{className:"flex items-center gap-2",children:[O,R]}),e[117]=O,e[118]=G):G=e[118];let V;e[119]!==_||e[120]!==G?(V=s.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[_,G]}),e[119]=_,e[120]=G,e[121]=V):V=e[121];let Y;return e[122]!==N||e[123]!==k||e[124]!==V?(Y=s.jsx("div",{className:"flex w-full flex-col overflow-hidden",children:s.jsxs("div",{className:"flex flex-col",children:[N,k,V]})}),e[122]=N,e[123]=k,e[124]=V,e[125]=Y):Y=e[125],Y}function Ci(t){return{...t,enableSounds:!t.enableSounds}}function wi(){re.success("User ID copied")}function ki(t){return{...t,enableSounds:!t.enableSounds}}function Ai(){re.success("User ID copied")}function st(){const t=$.c(34),{data:e}=he.useSession(),{org:n}=se(),l=xe();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org",shouldThrow:!1},t[0]=i):i=t[0];const a=vs(i)?.params.org,[o,d]=ys(),c=ct(),[m,u]=E.useState(!1),f=e?.user,h=f?.image;let g;t[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>u(!1),t[1]=g):g=t[1];const j=g;let x;t[2]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(dt,{size:16}),t[2]=x):x=t[2];let p;t[3]!==l||t[4]!==a?(p={key:"preferences",label:"Preferences",icon:x,onClick:()=>{l({to:"/$org/settings/profile",params:{org:a??""}})}},t[3]=l,t[4]=a,t[5]=p):p=t[5];let b;t[6]!==n||t[7]!==l?(b=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(Gs,{size:16}),onClick:()=>{l({to:"/$org/install",params:{org:n.slug}})}}]:[],t[6]=n,t[7]=l,t[8]=b):b=t[8];let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v={key:"terms",label:"Terms of Use",icon:s.jsx(Ws,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[9]=v):v=t[9];let y;t[10]===Symbol.for("react.memo_cache_sentinel")?(y={key:"privacy",label:"Privacy Policy",icon:s.jsx(Ys,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[10]=y):y=t[10];let w;t[11]===Symbol.for("react.memo_cache_sentinel")?(w={key:"github",label:"decocms/studio",icon:s.jsx(Ss,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[11]=w):w=t[11];let C;t[12]===Symbol.for("react.memo_cache_sentinel")?(C={key:"community",label:"Community",icon:s.jsx(Qs,{size:16}),href:"https://decocms.com/discord",external:!0},t[12]=C):C=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N={key:"homepage",label:"Homepage",icon:s.jsx(Us,{size:16}),href:"https://decocms.com",external:!0},t[13]=N):N=t[13];let S;t[14]!==p||t[15]!==b?(S=[p,...b,v,y,w,C,N],t[14]=p,t[15]=b,t[16]=S):S=t[16];const A=S;let k;t[17]===Symbol.for("react.memo_cache_sentinel")?(k={key:"logout",label:"Sign out",icon:s.jsx(qs,{size:16}),onClick:zi},t[17]=k):k=t[17];const z=k;let _;t[18]===Symbol.for("react.memo_cache_sentinel")?(_={value:"light",icon:s.jsx(Xs,{size:14}),label:"Light theme"},t[18]=_):_=t[18];let I;t[19]===Symbol.for("react.memo_cache_sentinel")?(I={value:"dark",icon:s.jsx(Vs,{size:14}),label:"Dark theme"},t[19]=I):I=t[19];let M;t[20]===Symbol.for("react.memo_cache_sentinel")?(M=[_,I,{value:"system",icon:s.jsx(tt,{size:14}),label:"System theme"}],t[20]=M):M=t[20];const L=M;let P;t[21]!==c||t[22]!==A||t[23]!==o||t[24]!==d||t[25]!==f||t[26]!==h?(P={user:f,userImage:h,menuItems:A,signOutItem:z,themeOptions:L,preferences:o,setPreferences:d,close:j,isMobile:c},t[21]=c,t[22]=A,t[23]=o,t[24]=d,t[25]=f,t[26]=h,t[27]=P):P=t[27];const D=P;let O;return t[28]!==c||t[29]!==m||t[30]!==D||t[31]!==f?.name||t[32]!==h?(O=s.jsx(s.Fragment,{children:c?s.jsxs(Ut,{open:m,onOpenChange:u,direction:"bottom",children:[s.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx(Le,{url:h,fallback:f?.name??"U",shape:"circle",size:"2xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]}),s.jsxs(Wt,{className:"h-[80dvh] p-0",children:[s.jsx(qt,{className:"sr-only",children:"Account"}),s.jsx(_t,{...D})]})]}):s.jsxs(Ge,{open:m,onOpenChange:u,children:[s.jsx(ze,{asChild:!0,children:s.jsxs(J,{tooltip:f?.name??"Account",className:"rounded-md",children:[s.jsx(Le,{url:h,fallback:f?.name??"U",shape:"circle",size:"xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]})}),s.jsx(Ue,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[280px] p-0 flex flex-col max-h-[520px]",onCloseAutoFocus:Ii,children:s.jsx(_t,{...D})})]})}),t[28]=c,t[29]=m,t[30]=D,t[31]=f?.name,t[32]=h,t[33]=O):O=t[33],O}function Ii(t){return t.preventDefault()}function zi(){oe("signed_out",{source:"account_popover"}),Ns(),he.signOut()}function nt(t){const e=$.c(43),{variant:n}=t===void 0?{}:t,l=n===void 0?"icon":n,i=cn(),[r,a]=E.useState(!1);let o,d;if(e[0]!==i.capabilities||e[1]!==i.hostname||e[2]!==i.machineId||e[3]!==i.online){const v=dn(i.capabilities);o=i.online?"Desktop linked":"Connect desktop",d=i.online?s.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[s.jsx("span",{className:"font-medium",children:i.hostname??i.machineId??"Desktop linked"}),s.jsx("span",{className:"text-muted-foreground",children:v.length>0?`Available: ${v.join(", ")}`:"No CLI agents detected"})]}):s.jsx("span",{className:"text-xs",children:"Desktop disconnected"}),e[0]=i.capabilities,e[1]=i.hostname,e[2]=i.machineId,e[3]=i.online,e[4]=o,e[5]=d}else o=e[4],d=e[5];const c=d;if(l==="full"){let v,y;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=()=>a(!0),y=s.jsx(tt,{}),e[6]=v,e[7]=y):(v=e[6],y=e[7]);let w;e[8]!==o?(w=s.jsx("span",{children:o}),e[8]=o,e[9]=w):w=e[9];let C;e[10]!==i.online?(C=i.online&&s.jsx("span",{className:"ml-auto size-2 rounded-full bg-success animate-pulse"}),e[10]=i.online,e[11]=C):C=e[11];let N;e[12]!==o||e[13]!==w||e[14]!==C?(N=s.jsx(ce,{asChild:!0,children:s.jsxs(J,{tooltip:o,onClick:v,children:[y,w,C]})}),e[12]=o,e[13]=w,e[14]=C,e[15]=N):N=e[15];let S;e[16]!==c?(S=s.jsx(de,{side:"right",children:c}),e[16]=c,e[17]=S):S=e[17];let A;e[18]!==N||e[19]!==S?(A=s.jsxs(me,{children:[N,S]}),e[18]=N,e[19]=S,e[20]=A):A=e[20];let k;e[21]!==r?(k=s.jsx(yt,{open:r,onOpenChange:a}),e[21]=r,e[22]=k):k=e[22];let z;return e[23]!==k||e[24]!==A?(z=s.jsxs(s.Fragment,{children:[A,k]}),e[23]=k,e[24]=A,e[25]=z):z=e[25],z}let m;e[26]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),e[26]=m):m=e[26];const u=i.online?"Desktop linked":"Connect your desktop";let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(tt,{size:16}),e[27]=f):f=e[27];let h;e[28]!==i.online?(h=i.online&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-success ring-2 ring-background animate-pulse"}),e[28]=i.online,e[29]=h):h=e[29];let g;e[30]!==u||e[31]!==h?(g=s.jsx(ce,{asChild:!0,children:s.jsxs(ve,{onClick:m,"aria-label":u,children:[f,h]})}),e[30]=u,e[31]=h,e[32]=g):g=e[32];let j;e[33]!==c?(j=s.jsx(de,{side:"bottom",children:c}),e[33]=c,e[34]=j):j=e[34];let x;e[35]!==g||e[36]!==j?(x=s.jsxs(me,{children:[g,j]}),e[35]=g,e[36]=j,e[37]=x):x=e[37];let p;e[38]!==r?(p=s.jsx(yt,{open:r,onOpenChange:a}),e[38]=r,e[39]=p):p=e[39];let b;return e[40]!==p||e[41]!==x?(b=s.jsxs(s.Fragment,{children:[x,p]}),e[40]=p,e[41]=x,e[42]=b):b=e[42],b}class $i extends E.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?null:this.props.children}}function Ti(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Mi(){const t=$.c(17),e=xe(),{org:n}=se(),{hasDecoKey:l,balanceDollars:i}=ln();if(!l)return null;let r;t[0]!==i?(r=i!=null?`Credits: $${i.toFixed(2)}`:"Credits",t[0]=i,t[1]=r):r=t[1];let a;t[2]!==i?(a=F(i!=null&&Ti(i)),t[2]=i,t[3]=a):a=t[3];let o;t[4]!==e||t[5]!==n.slug?(o=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[4]=e,t[5]=n.slug,t[6]=o):o=t[6];let d;t[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Js,{}),t[7]=d):d=t[7];let c;t[8]!==i?(c=i!=null?`$${i.toFixed(2)}`:"Credits",t[8]=i,t[9]=c):c=t[9];let m;t[10]!==c?(m=s.jsx("span",{children:c}),t[10]=c,t[11]=m):m=t[11];let u;return t[12]!==r||t[13]!==a||t[14]!==o||t[15]!==m?(u=s.jsx(ae,{children:s.jsx(K,{children:s.jsxs(J,{tooltip:r,className:a,onClick:o,children:[d,m]})})}),t[12]=r,t[13]=a,t[14]=o,t[15]=m,t[16]=u):u=t[16],u}function Ct(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx($i,{children:s.jsx(E.Suspense,{fallback:null,children:s.jsx(Mi,{})})}),t[0]=e):e=t[0],e}function wt(){const t=$.c(7),e=xe(),{org:n}=se();let l;t[0]!==e||t[1]!==n.slug?(l=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=l):l=t[2];let i,r;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(dt,{}),r=s.jsx("span",{children:"Settings"}),t[3]=i,t[4]=r):(i=t[3],r=t[4]);let a;return t[5]!==l?(a=s.jsxs(J,{tooltip:"Settings",onClick:l,children:[i,r]}),t[5]=l,t[6]=a):a=t[6],a}function kt(){const t=$.c(4),[e,n]=E.useState(!1);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(K,{children:s.jsx(nn,{trigger:s.jsxs(J,{tooltip:"Invite members",children:[s.jsx(Zs,{}),s.jsx("span",{children:"Invite members"})]})})}),t[0]=l):l=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(ae,{className:"gap-0.5",children:[l,s.jsx(K,{children:s.jsxs(J,{tooltip:"Add connection",onClick:()=>n(!0),children:[s.jsx(Ks,{}),s.jsx("span",{children:"Add connection"})]})})]}),t[1]=i):i=t[1];let r;return t[2]!==e?(r=s.jsxs(s.Fragment,{children:[i,s.jsx(rn,{open:e,onOpenChange:n,mode:"browse"})]}),t[2]=e,t[3]=r):r=t[3],r}function Oi(){const t=$.c(10),{state:e}=pe();if(e==="collapsed"){let d,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(kt,{}),c=s.jsx(Ct,{}),t[0]=d,t[1]=c):(d=t[0],c=t[1]);let m;t[2]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(K,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(nt,{})})}),t[2]=m):m=t[2];let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(K,{children:s.jsx(wt,{})}),t[3]=u):u=t[3];let f;return t[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs(Ze,{className:"px-2 pb-3 gap-1",children:[d,c,s.jsxs(ae,{children:[m,u,s.jsx(K,{children:s.jsx(st,{})})]})]}),t[4]=f):f=t[4],f}let l,i;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(kt,{}),i=s.jsx(Ct,{}),t[5]=l,t[6]=i):(l=t[5],i=t[6]);let r;t[7]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(K,{children:s.jsx(nt,{variant:"full"})}),t[7]=r):r=t[7];let a;t[8]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(K,{children:s.jsx(wt,{})}),t[8]=a):a=t[8];let o;return t[9]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(Ze,{className:"px-2 pb-3 gap-0.5",children:[l,i,s.jsxs(ae,{className:"gap-0.5",children:[r,a,s.jsx(K,{children:s.jsx(st,{})})]})]}),t[9]=o):o=t[9],o}function Pi(){const t=$.c(8),e=xe(),{org:n}=se(),{setOpenMobile:l}=pe();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(ae,{children:s.jsx(K,{children:s.jsx(st,{})})})}),t[0]=i):i=t[0];let r;t[1]!==e||t[2]!==n.slug||t[3]!==l?(r=()=>{e({to:"/$org/settings",params:{org:n.slug}}),l(!1)},t[1]=e,t[2]=n.slug,t[3]=l,t[4]=r):r=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(dt,{className:"size-4"}),t[5]=a):a=t[5];let o;return t[6]!==r?(o=s.jsx(Ze,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[i,s.jsx(ve,{"aria-label":"Settings",onClick:r,children:a})]})}),t[6]=r,t[7]=o):o=t[7],o}function At(t){const e=$.c(15),{className:n,wrapperClassName:l,children:i}=t,[r,a]=E.useState(!1);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=p=>{p&&a(p.scrollHeight>p.clientHeight+1)},e[0]=o):o=e[0];const d=o;let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=p=>{const b=p.currentTarget;a(b.scrollHeight-b.scrollTop>b.clientHeight+1)},e[1]=c):c=e[1];const m=c;let u;e[2]!==l?(u=F("relative",l),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==i||e[5]!==n?(f=s.jsx("div",{ref:d,onScroll:m,className:n,children:i}),e[4]=i,e[5]=n,e[6]=f):f=e[6];const h=r?"opacity-100":"opacity-0";let g;e[7]!==h?(g=F("pointer-events-none absolute right-0 bottom-0 left-0 h-10 bg-gradient-to-t from-sidebar to-transparent transition-opacity duration-150",h),e[7]=h,e[8]=g):g=e[8];let j;e[9]!==g?(j=s.jsx("div",{"aria-hidden":!0,className:g}),e[9]=g,e[10]=j):j=e[10];let x;return e[11]!==u||e[12]!==f||e[13]!==j?(x=s.jsxs("div",{className:u,children:[f,j]}),e[11]=u,e[12]=f,e[13]=j,e[14]=x):x=e[14],x}function Di(t){const e=$.c(8),{virtualMcpId:n,size:l,showAutomationBadge:i}=t,r=l===void 0?"sm":l;let a;e[0]!==r||e[1]!==n?(a=n?s.jsx(Fi,{virtualMcpId:n,size:r}):s.jsx(ye,{icon:null,name:"?",size:r}),e[0]=r,e[1]=n,e[2]=a):a=e[2];let o;e[3]!==i?(o=i&&s.jsx("span",{"aria-label":"Automation-triggered",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:s.jsx(Qt,{size:10,className:"text-white"})}),e[3]=i,e[4]=o):o=e[4];let d;return e[5]!==a||e[6]!==o?(d=s.jsxs("div",{className:"relative shrink-0",children:[a,o]}),e[5]=a,e[6]=o,e[7]=d):d=e[7],d}function Fi(t){const e=$.c(6),{virtualMcpId:n,size:l}=t,i=mt(n);if(!i){let o;return e[0]!==l?(o=s.jsx(ye,{icon:null,name:"?",size:l}),e[0]=l,e[1]=o):o=e[1],o}const r=i.icon??null;let a;return e[2]!==i.title||e[3]!==l||e[4]!==r?(a=s.jsx(ye,{icon:r,name:i.title,size:l}),e[2]=i.title,e[3]=l,e[4]=r,e[5]=a):a=e[5],a}function It(t){const e=$.c(36),{open:n,onOpenChange:l}=t,[i,r]=E.useState(""),{org:a}=se(),{setTaskId:o}=ft(),d=Yt();let c,m,u;e[0]!==a.id||e[1]!==i?(u=i.trim(),m=Cs,c=_s.globalSearch(a.id,u),e[0]=a.id,e[1]=i,e[2]=c,e[3]=m,e[4]=u):(c=e[2],m=e[3],u=e[4]);const f=n&&u.length>0;let h;e[5]!==d||e[6]!==u?(h=async()=>await d.call("GLOBAL_SEARCH",{query:u,limit:20}),e[5]=d,e[6]=u,e[7]=h):h=e[7];let g;e[8]!==c||e[9]!==f||e[10]!==h?(g={queryKey:c,enabled:f,queryFn:h,staleTime:1e4},e[8]=c,e[9]=f,e[10]=h,e[11]=g):g=e[11];const{data:j,isFetching:x}=m(g);let p;e[12]!==j?.items?(p=j?.items??[],e[12]=j?.items,e[13]=p):p=e[13];const b=p;let v;e[14]!==l?(v=I=>{I||r(""),l(I)},e[14]=l,e[15]=v):v=e[15];const y=v;let w;e[16]!==y||e[17]!==o?(w=I=>{y(!1),o(I.id,I.virtual_mcp_id??void 0)},e[16]=y,e[17]=o,e[18]=w):w=e[18];const C=w;let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(yn,{className:"sr-only",children:[s.jsx(Sn,{children:"Search"}),s.jsx(Nn,{children:"Search across your organization's resources."})]}),e[19]=N):N=e[19];let S;e[20]!==i?(S=s.jsx(An,{value:i,onValueChange:r,placeholder:"Search..."}),e[20]=i,e[21]=S):S=e[21];let A;e[22]!==C||e[23]!==x||e[24]!==b||e[25]!==u?(A=u?x&&b.length===0?s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching…"}):b.length===0?s.jsx(wn,{children:"No results."}):b.map(I=>I.type==="thread"?s.jsxs(kn,{value:`thread:${I.id}:${I.title}`,onSelect:()=>C(I),className:"gap-2.5",children:[s.jsx(Di,{virtualMcpId:I.virtual_mcp_id,size:"xs"}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("div",{className:"text-sm text-foreground truncate",children:I.title||"Untitled thread"})}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(I.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${I.id}`):null):s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search."}),e[22]=C,e[23]=x,e[24]=b,e[25]=u,e[26]=A):A=e[26];let k;e[27]!==A?(k=s.jsx(In,{children:A}),e[27]=A,e[28]=k):k=e[28];let z;e[29]!==S||e[30]!==k?(z=s.jsxs(_n,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,s.jsxs(zn,{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:[S,k]})]}),e[29]=S,e[30]=k,e[31]=z):z=e[31];let _;return e[32]!==y||e[33]!==n||e[34]!==z?(_=s.jsx(Cn,{open:n,onOpenChange:y,children:z}),e[32]=y,e[33]=n,e[34]=z,e[35]=_):_=e[35],_}function Ei(t){return t==="ephemeral"||t.startsWith("thread:")}function rs(t){const e=$.c(40),{task:n,isActive:l,onClick:i,onArchive:r,showAutomationBadge:a,showAgentIcon:o,hideStatusIdle:d,indented:c}=t,m=Mn(n.status),u=m.icon,f=n.metadata?.kind==="tool_call_run",h=mt(f?void 0:n.virtual_mcp_id);let g;e[0]!==h?(g=on(h),e[0]=h,e[1]=g):g=e[1];const j=g;On(6e4);const x=a||!!n.trigger_id,p=n.id,b="button",v=0;let y;e[2]!==i?(y=G=>{G.target===G.currentTarget&&(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),i())},e[2]=i,e[3]=y):y=e[3];const w=c?"-ml-4 pl-6":"pl-2",C=l?"bg-accent text-accent-foreground":"hover:bg-accent/60";let N;e[4]!==w||e[5]!==C?(N=F("group/row flex items-center gap-2 py-1.5 pr-2 rounded-md cursor-pointer transition-colors",w,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",C),e[4]=w,e[5]=C,e[6]=N):N=e[6];let S;e[7]!==f||e[8]!==o||e[9]!==h?.icon||e[10]!==h?.title?(S=o&&!f&&s.jsx(ye,{icon:h?.icon??null,name:h?.title??"?",size:"2xs"}),e[7]=f,e[8]=o,e[9]=h?.icon,e[10]=h?.title,e[11]=S):S=e[11];let A;e[12]!==x?(A=x&&s.jsx(Qt,{size:12,"aria-label":"Automation-triggered",className:"shrink-0 text-blue-500"}),e[12]=x,e[13]=A):A=e[13];const k=n.title||"Untitled task";let z;e[14]!==k?(z=s.jsx("div",{className:"text-sm text-foreground truncate",children:k}),e[14]=k,e[15]=z):z=e[15];let _;e[16]!==A||e[17]!==z?(_=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[A,z]}),e[16]=A,e[17]=z,e[18]=_):_=e[18];let I;e[19]!==j||e[20]!==l||e[21]!==n.branch||e[22]!==n.updated_at?(I=n.updated_at&&s.jsxs("div",{className:F("flex items-center gap-1 text-[11px] min-w-0",l?"text-accent-foreground/70":"text-muted-foreground/60"),children:[n.branch&&!Ei(n.branch)?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-mono",children:n.branch}),s.jsx("span",{className:"shrink-0",children:"·"})]}):j?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"truncate",children:[j.owner,"/",j.name]}),s.jsx("span",{className:"shrink-0",children:"·"})]}):null,s.jsx("span",{className:"shrink-0",children:Dn(new Date(n.updated_at))})]}),e[19]=j,e[20]=l,e[21]=n.branch,e[22]=n.updated_at,e[23]=I):I=e[23];let M;e[24]!==_||e[25]!==I?(M=s.jsxs("div",{className:"flex-1 min-w-0",children:[_,I]}),e[24]=_,e[25]=I,e[26]=M):M=e[26];const L="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",P=!d&&s.jsx("span",{className:F("[grid-area:slot] flex size-7 items-center justify-center pointer-events-none transition-opacity",r&&"group-hover/row:opacity-0"),"aria-label":m.label,children:s.jsx(u,{size:14,className:F(m.iconClassName,n.status==="in_progress"&&"animate-spin")})});let D;e[27]!==r?(D=r&&s.jsxs(me,{children:[s.jsx(ce,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":"Archive task",onClick:G=>{G.stopPropagation(),r()},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-7 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:s.jsx(ws,{size:14})})}),s.jsx(de,{side:"right",children:"Archive"})]}),e[27]=r,e[28]=D):D=e[28];let O;e[29]!==P||e[30]!==D?(O=s.jsxs("div",{className:L,children:[P,D]}),e[29]=P,e[30]=D,e[31]=O):O=e[31];let R;return e[32]!==i||e[33]!==M||e[34]!==O||e[35]!==y||e[36]!==N||e[37]!==S||e[38]!==n.id?(R=s.jsxs("div",{"data-task-id":p,role:b,tabIndex:v,onClick:i,onKeyDown:y,className:N,children:[S,M,O]}),e[32]=i,e[33]=M,e[34]=O,e[35]=y,e[36]=N,e[37]=S,e[38]=n.id,e[39]=R):R=e[39],R}const zt=["requires_action","in_progress","failed","expired","completed"];function Li(t){const e=new Map(zt.map(n=>[n,[]]));for(const n of t){const l=n.status??"completed";(e.get(l)??e.get("completed")).push(n)}return zt.map(n=>({status:n,threads:e.get(n)}))}const Ri="sidebar.group.expanded.";function Bi(t,e){const n=$.c(3),[l,i]=He(`${Ri}${t}`,e);let r;return n[0]!==l||n[1]!==i?(r=[l,i],n[0]=l,n[1]=i,n[2]=r):r=n[2],r}function os(t){const e=$.c(12),{onClick:n,isFetching:l,indented:i}=t,r=i?"-ml-4 pl-6 pr-2":"px-2";let a;e[0]!==r?(a=F("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",r,"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[0]=r,e[1]=a):a=e[1];let o;e[2]!==l?(o=l&&s.jsx(Lt,{size:14,className:"animate-spin"}),e[2]=l,e[3]=o):o=e[3];const d=l?"Loading…":"Show more";let c;e[4]!==d?(c=s.jsx("span",{children:d}),e[4]=d,e[5]=c):c=e[5];let m;return e[6]!==l||e[7]!==n||e[8]!==a||e[9]!==o||e[10]!==c?(m=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:l,className:a,children:[o,c]}),e[6]=l,e[7]=n,e[8]=a,e[9]=o,e[10]=c,e[11]=m):m=e[11],m}function Hi(t,e,n,l){return[t,e,n,l.type,l.member,l.currentUserId??""].join("|")}function Gi(t){return t.member==="mine"&&!t.currentUserId}const as=4;let Ee=0;const it=[];function Ui(){for(;Ee<as&&it.length>0;){const t=it.shift();t&&t()}}function cs(t){return new Promise((e,n)=>{const l=()=>{Ee++,t().then(e,n).finally(()=>{Ee--,Ui()})};Ee<as?l():it.push(l)})}const We=10;function $t(t,e,n,l,i){const r={hidden:!1};l.member==="mine"&&l.currentUserId&&(r.created_by=l.currentUserId),l.type==="automation"&&(r.has_trigger=!0),l.type==="manual"&&(r.has_trigger=!1);const a={where:r,limit:i,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function Wi(t,e,n,l){let i=0;for(const r of t)ds(r,e,n,l)&&i++;return i}function Ve(t,e,n,l){return Wi(t,e,n,l)}function qi(t,e){return!!(t>=We||t===0&&e)}function Tt(t,e){return t<e}function Ki(t,e){return e===!1?!1:e===!0?!0:t}function ds(t,e,n,l){return!(t.hidden||(t.status??"completed")!==n||l.member==="mine"&&l.currentUserId&&t.created_by!==l.currentUserId||l.type==="automation"&&!t.trigger_id||l.type==="manual"&&t.trigger_id)}const Be=new Map,Fe=new Map;function Xi(t,e){return e?t>=We?!0:null:!1}function Mt(t){return Be.get(t)}function Vi(t,e){Be.set(t,e)}function Yi(t,e,n){const l=Be.get(t);if(l!==void 0){n(l);return}let i=Fe.get(t);i||(i=cs(e).then(r=>(Be.set(t,r),Fe.delete(t),r)).catch(()=>(Fe.delete(t),Promise.reject(new Error("group probe failed")))),Fe.set(t,i)),i.then(n,()=>n(!1))}function Ot(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===We,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function Qi(t,e,n,l,i){let r=0;for(const a of t)e.has(a.id)||ds(a,n,l,i)&&r++;return r}function Ji(t,e,n,l){const i=$.c(8),{org:r}=se(),a=Hi(r.id,t,e,n);let o;i[0]!==n?(o=Gi(n),i[0]=n,i[1]=o):o=i[1];const d=o,[c,m]=E.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});c.identity!==a&&m({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const u=bn(),{threads:f,hasMore:h}=ut(),g=Ve(f,t,e,n),j=qi(g,h),x=Xi(g,h),p=Yt();if(c.identity===a&&c.serverHasMore===null){const N=x??Mt(a);N!==void 0&&m({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:c.probeSubscribedIdentity,serverHasMore:N})}!d&&c.identity===a&&c.serverHasMore===null&&x===null&&Mt(a)===void 0&&c.probeSubscribedIdentity!==a&&(m(N=>N.identity===a?{...N,isProbing:!0,probeSubscribedIdentity:a}:N),Yi(a,async()=>{const N=$t(t,e,0,n,1),S=await p.call("COLLECTION_THREADS_LIST",N),{totalCount:A}=Ot(S),k=Ve(u.threads.get(),t,e,n);return A===void 0?!1:Tt(k,A)},N=>{m(S=>S.identity!==a?S:{...S,isProbing:!1,serverHasMore:N})}));const v=async function(){if(c.isFetching||c.isProbing||d)return;const S=a;m(A=>A.identity===S?{...A,isFetching:!0}:A);try{const A=Ve(f,t,e,n),k=$t(t,e,A,n,We),z=await cs(()=>p.call("COLLECTION_THREADS_LIST",k)),{items:_,hasMore:I,totalCount:M}=Ot(z),L=new Set(f.map(Zi)),P=Qi(_,L,t,e,n),D=A;u.mergeThreads(_),m(O=>{if(O.identity!==S)return O;let R;return M!==void 0?R=Tt(D+P,M):R=_.length===0||P===0?!1:I,Vi(S,R),{...O,isFetching:!1,serverHasMore:R}})}catch(A){const k=A,z=k instanceof Error?k.message:String(k);re.error(`Could not load more tasks: ${z}`),m(_=>_.identity===S?{..._,isFetching:!1}:_)}},y=c.isFetching||c.isProbing,w=!d&&!y&&Ki(j,c.serverHasMore);let C;return i[2]!==y||i[3]!==v||i[4]!==w||i[5]!==c.isProbing||i[6]!==c.serverHasMore?(C={hasMore:w,isFetching:y,isProbing:c.isProbing,serverHasMore:c.serverHasMore,loadMore:v},i[2]=y,i[3]=v,i[4]=w,i[5]=c.isProbing,i[6]=c.serverHasMore,i[7]=C):C=i[7],C}function Zi(t){return t.id}function el(t){const e=$.c(20),{status:n,threads:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:o,filters:d}=t,{isFetching:c,isProbing:m,loadMore:u,hasMore:f,serverHasMore:h}=Ji("status",n,d),[g,j]=E.useState(!1);!g&&l.length===0&&h===!0&&!c&&!m&&(j(!0),queueMicrotask(()=>{u()}));let x;if(e[0]!==i||e[1]!==o||e[2]!==d||e[3]!==a||e[4]!==r||e[5]!==l){let v;e[7]!==i||e[8]!==o||e[9]!==d||e[10]!==a||e[11]!==r?(v=y=>s.jsx(rs,{task:y,isActive:i===y.id,onClick:()=>r(y),onArchive:o&&y.created_by===d.currentUserId?()=>a(y):void 0,showAutomationBadge:!!y.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},y.id),e[7]=i,e[8]=o,e[9]=d,e[10]=a,e[11]=r,e[12]=v):v=e[12],x=l.map(v),e[0]=i,e[1]=o,e[2]=d,e[3]=a,e[4]=r,e[5]=l,e[6]=x}else x=e[6];let p;e[13]!==f||e[14]!==c||e[15]!==u?(p=(f||c)&&s.jsx(os,{onClick:()=>{u()},isFetching:c,indented:!0}),e[13]=f,e[14]=c,e[15]=u,e[16]=p):p=e[16];let b;return e[17]!==x||e[18]!==p?(b=s.jsxs(s.Fragment,{children:[x,p]}),e[17]=x,e[18]=p,e[19]=b):b=e[19],b}function tl(t){const e=$.c(36),{status:n,threads:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:o,filters:d}=t,c=Pn[n],m=c.icon,[u,f]=Bi(`status-${n}`,!1);let h;e[0]!==u||e[1]!==f?(h=function(){f(!u)},e[0]=u,e[1]=f,e[2]=h):h=e[2];const g=h;let j;e[3]!==g?(j=S=>{S.target===S.currentTarget&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),g())},e[3]=g,e[4]=j):j=e[4];let x;e[5]!==m||e[6]!==c.iconClassName?(x=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(m,{size:12,className:c.iconClassName})}),e[5]=m,e[6]=c.iconClassName,e[7]=x):x=e[7];let p;e[8]!==u?(p=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:u?s.jsx(ht,{size:14}):s.jsx(Fn,{size:14})}),e[8]=u,e[9]=p):p=e[9];let b;e[10]!==x||e[11]!==p?(b=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[x,p]}),e[10]=x,e[11]=p,e[12]=b):b=e[12];let v;e[13]!==c.label?(v=s.jsx("span",{className:"flex-1 truncate",children:c.label}),e[13]=c.label,e[14]=v):v=e[14];let y;e[15]!==l.length?(y=s.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:l.length})}),e[15]=l.length,e[16]=y):y=e[16];let w;e[17]!==u||e[18]!==g||e[19]!==j||e[20]!==b||e[21]!==v||e[22]!==y?(w=s.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":u,onClick:g,onKeyDown:j,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:[b,v,y]}),e[17]=u,e[18]=g,e[19]=j,e[20]=b,e[21]=v,e[22]=y,e[23]=w):w=e[23];let C;e[24]!==i||e[25]!==o||e[26]!==u||e[27]!==d||e[28]!==a||e[29]!==r||e[30]!==n||e[31]!==l?(C=u&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(el,{status:n,threads:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:o,filters:d})}),e[24]=i,e[25]=o,e[26]=u,e[27]=d,e[28]=a,e[29]=r,e[30]=n,e[31]=l,e[32]=C):C=e[32];let N;return e[33]!==w||e[34]!==C?(N=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[w,C]}),e[33]=w,e[34]=C,e[35]=N):N=e[35],N}function Pt(t){const e=$.c(38),{threads:n,groupBy:l,activeTaskId:i,onSelectTask:r,onArchiveTask:a,filters:o,hasMore:d,isFetchingMore:c,onLoadMore:m,filtersActive:u}=t;if(n.length===0&&!d&&!c){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Tn,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const p=u?"No threads match your filters":"No threads yet";let b;return e[1]!==p?(b=s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[x,s.jsx("p",{className:"text-sm",children:p})]}),e[1]=p,e[2]=b):b=e[2],b}const f=n.length>1||d;if(l==="status"){let x;if(e[3]!==i||e[4]!==f||e[5]!==o||e[6]!==a||e[7]!==r||e[8]!==n){let b;e[10]!==i||e[11]!==f||e[12]!==o||e[13]!==a||e[14]!==r?(b=v=>s.jsx(tl,{status:v.status,threads:v.threads,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:f,filters:o},v.status),e[10]=i,e[11]=f,e[12]=o,e[13]=a,e[14]=r,e[15]=b):b=e[15],x=Li(n).map(b),e[3]=i,e[4]=f,e[5]=o,e[6]=a,e[7]=r,e[8]=n,e[9]=x}else x=e[9];let p;return e[16]!==x?(p=s.jsx(s.Fragment,{children:x}),e[16]=x,e[17]=p):p=e[17],p}let h;if(e[18]!==i||e[19]!==f||e[20]!==o||e[21]!==a||e[22]!==r||e[23]!==n){let x;e[25]!==i||e[26]!==f||e[27]!==o||e[28]!==a||e[29]!==r?(x=p=>s.jsx(rs,{task:p,isActive:i===p.id,onClick:()=>r(p),onArchive:f&&p.created_by===o.currentUserId?()=>a(p):void 0,showAutomationBadge:!!p.trigger_id,showAgentIcon:!0},p.id),e[25]=i,e[26]=f,e[27]=o,e[28]=a,e[29]=r,e[30]=x):x=e[30],h=n.map(x),e[18]=i,e[19]=f,e[20]=o,e[21]=a,e[22]=r,e[23]=n,e[24]=h}else h=e[24];let g;e[31]!==d||e[32]!==c||e[33]!==m?(g=(d||c)&&s.jsx(os,{onClick:m,isFetching:c}),e[31]=d,e[32]=c,e[33]=m,e[34]=g):g=e[34];let j;return e[35]!==h||e[36]!==g?(j=s.jsxs(s.Fragment,{children:[h,g]}),e[35]=h,e[36]=g,e[37]=j):j=e[37],j}function Dt(t){const e=$.c(17),{label:n,onClick:l,active:i,children:r}=t,[a,o]=E.useState(!1);let d,c,m,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>o(!0),c=()=>o(!1),m=()=>o(!0),u=()=>o(!1),e[0]=d,e[1]=c,e[2]=m,e[3]=u):(d=e[0],c=e[1],m=e[2],u=e[3]);const f=i&&"bg-sidebar-accent text-foreground";let h;e[4]!==f?(h=F(f),e[4]=f,e[5]=h):h=e[5];let g;e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h?(g=s.jsx(ce,{asChild:!0,children:s.jsx(ve,{"aria-label":n,onClick:l,onPointerEnter:d,onPointerLeave:c,onFocus:m,onBlur:u,className:h,children:r})}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=g):g=e[10];let j;e[11]!==n?(j=s.jsx(de,{side:"bottom",children:n}),e[11]=n,e[12]=j):j=e[12];let x;return e[13]!==a||e[14]!==g||e[15]!==j?(x=s.jsxs(me,{open:a,children:[g,j]}),e[13]=a,e[14]=g,e[15]=j,e[16]=x):x=e[16],x}function Ye(t){const e=$.c(13),{label:n,value:l,onChange:i,options:r}=t;let a;e[0]!==n?(a=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=a):a=e[1];let o;e[2]!==i?(o=u=>u&&i(u),e[2]=i,e[3]=o):o=e[3];let d;e[4]!==r?(d=r.map(sl),e[4]=r,e[5]=d):d=e[5];let c;e[6]!==o||e[7]!==d||e[8]!==l?(c=s.jsx(fn,{type:"single",size:"sm",value:l,onValueChange:o,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:d}),e[6]=o,e[7]=d,e[8]=l,e[9]=c):c=e[9];let m;return e[10]!==a||e[11]!==c?(m=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,c]}),e[10]=a,e[11]=c,e[12]=m):m=e[12],m}function sl(t){return s.jsxs(un,{value:t.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:[t.icon,t.label]},t.value)}function ms({onNavigate:t}={}){const{data:e}=he.useSession(),n=e?.user?.id,{org:l}=se(),i=hn({connectionId:xn,orgId:l.id,orgSlug:l.slug}),r=Re(l.id).id,a=Xt(),{threads:o,hasMore:d,isFetchingMore:c,fetchNextPage:m}=ut(),u=o.filter(T=>!T.hidden),{hide:f}=Vt(),h=xe(),{setTaskId:g,createNewTask:j}=ft(),x=lt({strict:!1}),p=rt({strict:!1}),b=x.taskId??null,v=p.virtualmcpid??o.find(T=>T.id===b)?.virtual_mcp_id??null,y=()=>{t?.()},w=[...u].sort((T,H)=>(H.updated_at??"").localeCompare(T.updated_at??"")),[C,N]=E.useState("all"),[S,A]=E.useState("flat"),[k,z]=He("sidebar-threads-scope-all",!1),[_,I]=E.useState(!1),[M,L]=E.useState(!1),P={type:C,member:"mine",currentUserId:n??null},D=T=>n?T.filter(H=>H.created_by===n):[],O=T=>C==="automation"?T.filter(H=>!!H.trigger_id):C==="manual"?T.filter(H=>!H.trigger_id):T,R=D(w),G=O(R),V=O(w),Y=k?V:G,U=T=>{if(n&&T.created_by&&T.created_by!==n)return;const H=T.id===b;if(f(T.id),!H)return;const X=R.find(W=>W.id!==T.id&&W.virtual_mcp_id===T.virtual_mcp_id);y(),X?g(X.id,X.virtual_mcp_id):h({to:"/$org",params:{org:l.slug}})},q=T=>{y(),g(T.id,T.virtual_mcp_id)},B=async T=>{try{const H=await i.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:T,limit:1,offset:0}});return((H.structuredContent??H).items?.length??0)===0}catch{return!1}},Z=async()=>{const T=v??r;oe("sidebar_new_thread_clicked",{virtual_mcp_id:T});const H=R.find(X=>X.virtual_mcp_id===T&&X.title==="New chat");if(H&&await B(H.id)){y(),g(H.id,T);return}y(),j(T)},{state:ge,isMobile:ee,toggleSidebar:ue}=pe();if(ge==="collapsed"&&!ee){const T=Re(l.id),H=new Map((a??[]).map(W=>[W.id,W])),X=W=>(W?H.get(W):void 0)??(W===r?T:void 0);return s.jsxs(ae,{className:"min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx(K,{children:s.jsx(J,{"aria-label":"Toggle sidebar",tooltip:"Toggle sidebar",onClick:ue,children:s.jsx(Gt,{size:16})})}),s.jsx(K,{children:s.jsx(J,{tooltip:"New thread",onClick:()=>{Z()},children:s.jsx(vt,{size:16})})}),Y.map(W=>{const ie=X(W.virtual_mcp_id);return s.jsx(K,{children:s.jsx(J,{tooltip:W.title||"New chat",isActive:W.id===b,onClick:()=>q(W),children:s.jsx(ye,{icon:ie?.icon??null,name:ie?.title??"Agent",size:"2xs"})})},W.id)})]})}const ne=S!=="flat"||C!=="all"||k===!0,fe=s.jsxs(Ge,{children:[s.jsxs(me,{children:[s.jsx(ce,{asChild:!0,children:s.jsx(ze,{asChild:!0,children:s.jsxs(ve,{"aria-label":"Filter threads",active:ne,children:[s.jsx(mn,{size:16}),ne&&s.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"})]})})}),s.jsx(de,{side:"bottom",children:"Filter threads"})]}),s.jsxs(Ue,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[s.jsx(Ye,{label:"View",value:S,onChange:T=>{oe("tasks_panel_group_by_changed",{to_value:T}),A(T)},options:[{value:"flat",label:"List",icon:s.jsx(tn,{size:13})},{value:"status",label:"Status",icon:s.jsx(sn,{size:13})}]}),s.jsx(Ye,{label:"Type",value:C,onChange:T=>{oe("tasks_panel_filter_changed",{to_value:T}),N(T)},options:[{value:"all",label:"All"},{value:"manual",label:"Chats"},{value:"automation",label:"Auto"}]}),s.jsx(Ye,{label:"Scope",value:k?"team":"mine",onChange:T=>z(T==="team"),options:[{value:"mine",label:"Mine"},{value:"team",label:"Team"}]})]})]}),je=T=>s.jsx(et,{delayDuration:300,children:s.jsxs("div",{className:F("shrink-0 px-1 flex items-center justify-between",T?"h-10":"h-10 md:h-7 mb-2"),children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[!T&&s.jsx(Jt,{}),fe]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Dt,{label:"Search threads",onClick:()=>{oe("tasks_panel_search_opened"),L(!0),I(!0)},children:s.jsx(en,{size:16})}),s.jsx(Dt,{label:"New thread",onClick:()=>{Z()},children:s.jsx(vt,{size:16})})]})]})});return ee?s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[je(!0),s.jsx(At,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain px-1 h-full",children:s.jsx(Pt,{threads:Y,groupBy:S,activeTaskId:b,onSelectTask:q,onArchiveTask:U,filters:P,hasMore:d,isFetchingMore:c,onLoadMore:()=>{m()},filtersActive:ne})}),M&&s.jsx(It,{open:_,onOpenChange:I})]}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[je(!1),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 -mr-2 pr-2",children:s.jsx(At,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain h-full",children:s.jsx(Pt,{threads:Y,groupBy:S,activeTaskId:b,onSelectTask:q,onArchiveTask:U,filters:P,hasMore:d,isFetchingMore:c,onLoadMore:()=>{m()},filtersActive:ne})})}),M&&s.jsx(It,{open:_,onOpenChange:I})]})}const nl=5,il=[{nameWidth:"w-24",taskRows:2},{nameWidth:"w-28",taskRows:0},{nameWidth:"w-20",taskRows:1},{nameWidth:"w-32",taskRows:0},{nameWidth:"w-24",taskRows:0}];function us(){const t=$.c(3),{state:e}=pe();if(e==="collapsed"){let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:nl}).map(ol)}),t[0]=i):i=t[0],i}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(te,{className:"size-6 rounded-md"}),s.jsx(te,{className:"size-6 rounded-md"}),s.jsx(te,{className:"size-6 rounded-md"})]}),s.jsx(te,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n,s.jsx("div",{className:"flex flex-col gap-0.5",children:il.map(ll)})]}),t[2]=l):l=t[2],l}function ll(t,e){return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[s.jsx(te,{className:"size-5 rounded-full shrink-0"}),s.jsx(te,{className:F("h-3",t.nameWidth,"rounded-sm")})]}),t.taskRows>0&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:Array.from({length:t.taskRows}).map(rl)})]},e)}function rl(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(te,{className:"h-3 flex-1 rounded-sm"})},e)}function ol(t,e){return s.jsx(te,{className:"size-10 rounded-lg mx-auto"},e)}function al(){const t=$.c(4),e=ss();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Oi,{}),t[0]=n):n=t[0];let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Rt,{children:s.jsx(E.Suspense,{fallback:s.jsx(us,{}),children:s.jsx(ms,{})})}),t[1]=l):l=t[1];let i;return t[2]!==e?(i=s.jsx(Zt,{children:s.jsx(ls,{sections:e,footer:n,additionalContent:l})}),t[2]=e,t[3]=i):i=t[3],i}function cl(t){const e=$.c(8),{onClose:n}=t,l=ss();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Pi,{}),e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(us,{}),e[1]=r):r=e[1];let a;e[2]!==n?(a=s.jsx(Rt,{children:s.jsx(E.Suspense,{fallback:r,children:s.jsx(ms,{onNavigate:n})})}),e[2]=n,e[3]=a):a=e[3];let o;return e[4]!==n||e[5]!==l||e[6]!==a?(o=s.jsx(Zt,{children:s.jsx(_i,{sections:l,onClose:n,footer:i,additionalContent:a})}),e[4]=n,e[5]=l,e[6]=a,e[7]=o):o=e[7],o}function fs(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const dl=ks({name:As().min(2,"Organization name is required")});function ml(t){const e=$.c(41),{open:n,onOpenChange:l}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={resolver:Is(dl),defaultValues:{name:""}},e[0]=i):i=e[0];const r=zs(i);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={mutationFn:fl,onSuccess:ul},e[1]=a):a=e[1];const o=$s(a),d=o.error instanceof Error?o.error.message:o.error?"Failed to create organization.":null;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(Vn,{children:[s.jsx(Yn,{children:"Create a new organization"}),s.jsx(Qn,{children:"Set up a new organization to collaborate with others."})]}),e[2]=c):c=e[2];let m;if(e[3]!==o||e[4]!==r){let N;e[6]!==o?(N=S=>o.mutateAsync(S),e[6]=o,e[7]=N):N=e[7],m=r.handleSubmit(N),e[3]=o,e[4]=r,e[5]=m}else m=e[5];let u;e[8]!==r.formState.isSubmitting?(u=N=>{const{field:S}=N;return s.jsxs(si,{children:[s.jsx(ni,{children:"Organization Name"}),s.jsx(ii,{children:s.jsx(oi,{...S,placeholder:"Acme Inc.",disabled:r.formState.isSubmitting})}),s.jsx(li,{children:"The name of your company or organization"}),S.value&&s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",s.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",fs(S.value)]})]}),s.jsx(ri,{})]})},e[8]=r.formState.isSubmitting,e[9]=u):u=e[9];let f;e[10]!==r.control||e[11]!==u?(f=s.jsx(ei,{control:r.control,name:"name",render:u}),e[10]=r.control,e[11]=u,e[12]=f):f=e[12];let h;e[13]!==d?(h=d&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:d}),e[13]=d,e[14]=h):h=e[14];let g;e[15]!==o||e[16]!==r?(g=()=>{o.reset(),r.reset()},e[15]=o,e[16]=r,e[17]=g):g=e[17];let j;e[18]!==r.formState.isSubmitting||e[19]!==g?(j=s.jsx(Kn,{disabled:r.formState.isSubmitting,onClick:g,children:"Cancel"}),e[18]=r.formState.isSubmitting,e[19]=g,e[20]=j):j=e[20];const x=!r.formState.isValid||r.formState.isSubmitting;let p;e[21]!==r.formState.isSubmitting?(p=r.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Hn,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=r.formState.isSubmitting,e[22]=p):p=e[22];let b;e[23]!==x||e[24]!==p?(b=s.jsx(Je,{type:"submit",variant:"default",disabled:x,children:p}),e[23]=x,e[24]=p,e[25]=b):b=e[25];let v;e[26]!==b||e[27]!==j?(v=s.jsxs(Jn,{children:[j,b]}),e[26]=b,e[27]=j,e[28]=v):v=e[28];let y;e[29]!==v||e[30]!==m||e[31]!==f||e[32]!==h?(y=s.jsxs("form",{className:"space-y-6",onSubmit:m,autoComplete:"off",children:[f,h,v]}),e[29]=v,e[30]=m,e[31]=f,e[32]=h,e[33]=y):y=e[33];let w;e[34]!==r||e[35]!==y?(w=s.jsxs(Xn,{children:[c,s.jsx(ti,{...r,children:y})]}),e[34]=r,e[35]=y,e[36]=w):w=e[36];let C;return e[37]!==l||e[38]!==n||e[39]!==w?(C=s.jsx(Zn,{open:n,onOpenChange:l,children:w}),e[37]=l,e[38]=n,e[39]=w,e[40]=C):C=e[40],C}function ul(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function fl(t){const e=fs(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await he.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const l=n?.data?.slug??e;if(!l)throw new Error("Failed to create organization");return{orgSlug:l}}function hs(){const t=E.useContext(Ts),{data:e,refetch:n}=t.hooks.useListUserInvitations();return{invitations:(e??[]).filter(i=>i.status==="pending"&&new Date(i.expiresAt)>new Date),refetch:()=>n?.()}}function hl(t){let e=0;for(let l=0;l<t.length;l++)e=t.charCodeAt(l)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function pt(t){const e=$.c(13),{org:n,size:l}=t,i=l===void 0?"sm":l,r=i==="xs"?"size-5":"size-6",a=i==="xs"?"text-[9px]":"text-xs";let o;e[0]!==r?(o=F(r,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=r,e[1]=o):o=e[1];let d;e[2]!==n.logo||e[3]!==n.name?(d=n.logo?void 0:hl(n.name),e[2]=n.logo,e[3]=n.name,e[4]=d):d=e[4];let c;e[5]!==n.logo||e[6]!==n.name||e[7]!==a?(c=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:F("font-semibold leading-none",a),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=a,e[8]=c):c=e[8];let m;return e[9]!==o||e[10]!==d||e[11]!==c?(m=s.jsx("div",{className:o,style:d,children:c}),e[9]=o,e[10]=d,e[11]=c,e[12]=m):m=e[12],m}function xl({invitation:t,onChanged:e}){const[n,l]=E.useState(!1),i=t.organizationName??"Unknown organization",r=async()=>{l(!0);try{const d=await he.organization.acceptInvitation({invitationId:t.id});if(d.error){re.error(d.error.message),l(!1);return}}catch{re.error("Failed to accept invitation"),l(!1);return}re.success(`Joined ${i}`),Os();let o;try{o=(await he.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=o?`/${o}`:"/"},a=async()=>{l(!0);try{const o=await he.organization.rejectInvitation({invitationId:t.id});if(o.error){re.error(o.error.message),l(!1);return}re.success("Invitation declined"),l(!1),e()}catch{re.error("Failed to decline invitation"),l(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[s.jsx(pt,{org:{name:i},size:"sm"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:i}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:"Invited to join"})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx(Je,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:r,disabled:n,children:"Accept"}),s.jsx(Je,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:a,disabled:n,"aria-label":`Decline invitation to ${i}`,children:s.jsx(qn,{size:14})})]})]})}function pl(t){const e=$.c(29),{orgParam:n,onSelectOrg:l,onCreateOrg:i}=t,{data:r}=Ms(),{invitations:a,refetch:o}=hs();let d;e[0]!==n?(d=(_,I)=>_.slug===n?-1:I.slug===n?1:_.name.localeCompare(I.name),e[0]=n,e[1]=d):d=e[1];const c=[...r??[]].sort(d),[m,u]=E.useState(""),f=m.toLowerCase(),h=f?c.filter(_=>_.name.toLowerCase().includes(f)||_.slug.toLowerCase().includes(f)):c;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ts,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=g):g=e[2];let j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=_=>u(_.target.value),e[3]=j):j=e[3];let x;e[4]!==m?(x=_=>_.key==="Escape"&&m&&u(""),e[4]=m,e[5]=x):x=e[5];let p;e[6]!==m||e[7]!==x?(p=s.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:m,onChange:j,onKeyDown:x,placeholder:"Search organizations...",className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[6]=m,e[7]=x,e[8]=p):p=e[8];let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx($e,{size:16}),e[9]=b):b=e[9];let v;e[10]!==i?(v=s.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:b}),e[10]=i,e[11]=v):v=e[11];let y;e[12]!==p||e[13]!==v?(y=s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[g,p,v]}),e[12]=p,e[13]=v,e[14]=y):y=e[14];const w="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let C;e[15]!==a||e[16]!==m||e[17]!==o?(C=!m&&a.map(_=>s.jsx(xl,{invitation:_,onChanged:o},_.id)),e[15]=a,e[16]=m,e[17]=o,e[18]=C):C=e[18];const N=h.length===0&&s.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:m?`No organizations match "${m}"`:"No organizations available"});let S;e[19]!==l||e[20]!==n?(S=_=>s.jsxs("button",{type:"button",onClick:()=>l(_.slug),className:F("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",_.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(pt,{org:_,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:_.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.slug})]}),_.slug===n&&s.jsx(es,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},_.id),e[19]=l,e[20]=n,e[21]=S):S=e[21];const A=h.map(S);let k;e[22]!==C||e[23]!==N||e[24]!==A?(k=s.jsxs("div",{className:w,children:[C,N,A]}),e[22]=C,e[23]=N,e[24]=A,e[25]=k):k=e[25];let z;return e[26]!==k||e[27]!==y?(z=s.jsxs(s.Fragment,{children:[y,k]}),e[26]=k,e[27]=y,e[28]=z):z=e[28],z}function gl(t){const e=$.c(22),{trigger:n,orgParam:l,align:i,side:r}=t,a=i===void 0?"start":i,o=r===void 0?"bottom":r,d=xe(),[c,m]=E.useState(!1),[u,f]=E.useState(!1);let h;e[0]!==n?(h=s.jsx(ze,{asChild:!0,children:n}),e[0]=n,e[1]=h):h=e[1];const g=String(c);let j;e[2]!==d?(j=C=>{m(!1),d({to:"/$org",params:{org:C}})},e[2]=d,e[3]=j):j=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{m(!1),f(!0)},e[4]=x):x=e[4];let p;e[5]!==l||e[6]!==g||e[7]!==j?(p=s.jsx(pl,{orgParam:l,onSelectOrg:j,onCreateOrg:x},g),e[5]=l,e[6]=g,e[7]=j,e[8]=p):p=e[8];let b;e[9]!==a||e[10]!==o||e[11]!==p?(b=s.jsx(Ue,{side:o,align:a,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:jl,onCloseAutoFocus:bl,children:p}),e[9]=a,e[10]=o,e[11]=p,e[12]=b):b=e[12];let v;e[13]!==c||e[14]!==h||e[15]!==b?(v=s.jsxs(Ge,{open:c,onOpenChange:m,children:[h,b]}),e[13]=c,e[14]=h,e[15]=b,e[16]=v):v=e[16];let y;e[17]!==u?(y=s.jsx(ml,{open:u,onOpenChange:f}),e[17]=u,e[18]=y):y=e[18];let w;return e[19]!==y||e[20]!==v?(w=s.jsxs(s.Fragment,{children:[v,y]}),e[19]=y,e[20]=v,e[21]=w):w=e[21],w}function bl(t){return t.preventDefault()}function jl(t){t.preventDefault(),t.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function vl(t){const e=$.c(21),{value:n,onChange:l,placeholder:i,onKeyDown:r,className:a,isSearching:o,disabled:d}=t,c=i===void 0?"Search...":i;let m;e[0]!==a?(m=F("shrink-0 w-full border-b border-border h-12",a),e[0]=a,e[1]=m):m=e[1];const u=d?"cursor-not-allowed opacity-50":"cursor-text";let f;e[2]!==u?(f=F("flex items-center gap-2.5 h-12 px-4",u),e[2]=u,e[3]=f):f=e[3];let h;e[4]!==o?(h=o?s.jsx(Lt,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(ts,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=o,e[5]=h):h=e[5];let g;e[6]!==l?(g=b=>l(b.target.value),e[6]=l,e[7]=g):g=e[7];let j;e[8]!==d||e[9]!==r||e[10]!==c||e[11]!==g||e[12]!==n?(j=s.jsx("input",{type:"text",value:n,onChange:g,onKeyDown:r,placeholder:c,disabled:d,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=d,e[9]=r,e[10]=c,e[11]=g,e[12]=n,e[13]=j):j=e[13];let x;e[14]!==f||e[15]!==h||e[16]!==j?(x=s.jsxs("label",{className:f,children:[h,j]}),e[14]=f,e[15]=h,e[16]=j,e[17]=x):x=e[17];let p;return e[18]!==m||e[19]!==x?(p=s.jsx("div",{className:m,children:x}),e[18]=m,e[19]=x,e[20]=p):p=e[20],p}const yl="Select an existing agent";function Sl(t){const e=$.c(5),{children:n}=t;let l;e[0]!==n?(l=s.jsx(ce,{asChild:!0,children:n}),e[0]=n,e[1]=l):l=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(de,{side:"right",sideOffset:8,children:yl}),e[2]=i):i=e[2];let r;return e[3]!==l?(r=s.jsxs(me,{defaultOpen:!0,delayDuration:0,children:[l,i]}),e[3]=l,e[4]=r):r=e[4],r}function Nl(t){const e=xe(),{create:n}=Vt(),{locator:l}=se(),i=lt({strict:!1}),r=rt({strict:!1});return async a=>{const o=crypto.randomUUID(),d=a===r.virtualmcpid?vn(t,l,i.taskId??""):null;try{await n({id:o,virtual_mcp_id:a,...d?{branch:d}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:o},search:{virtualmcpid:a}})}}function Qe(t){const e=$.c(20),{agent:n,selected:l,onClick:i}=t,r=l?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let a;e[0]!==r?(a=F("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",r),e[0]=r,e[1]=a):a=e[1];let o;e[2]!==n.icon||e[3]!==n.title?(o=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[2]=n.icon,e[3]=n.title,e[4]=o):o=e[4];let d;e[5]!==n.title?(d=s.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[5]=n.title,e[6]=d):d=e[6];let c;e[7]!==n.description?(c=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[7]=n.description,e[8]=c):c=e[8];let m;e[9]!==d||e[10]!==c?(m=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,c]}),e[9]=d,e[10]=c,e[11]=m):m=e[11];let u;e[12]!==l?(u=l&&s.jsx(es,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=l,e[13]=u):u=e[13];let f;return e[14]!==i||e[15]!==a||e[16]!==o||e[17]!==m||e[18]!==u?(f=s.jsxs("button",{type:"button",onClick:i,className:a,children:[o,m,u]}),e[14]=i,e[15]=a,e[16]=o,e[17]=m,e[18]=u,e[19]=f):f=e[19],f}function Ft(t){const e=$.c(5),{children:n,action:l}=t;let i;e[0]!==n?(i=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n}),e[0]=n,e[1]=i):i=e[1];let r;return e[2]!==l||e[3]!==i?(r=s.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[i,l]}),e[2]=l,e[3]=i,e[4]=r):r=e[4],r}function _l(t){const e=$.c(27),{onClose:n,onSelectAgent:l,selectedAgentId:i,onImportFromGithub:r}=t,[a,o]=E.useState(""),d=Xt(),c=d??[],{org:m}=se(),{data:u}=he.useSession(),f=u?.user?.id??"anon",h=Ln(d),g=Rn(),j=Nl(m.slug),x=an(d),p=a.toLowerCase(),b=c.filter(Al).filter(B=>!x.has(B.id)).filter(kl).filter(B=>!a||B.title.toLowerCase().includes(p)),v=b.filter(wl),y=b.filter(Cl),w=Re(m.id),C=!a||w.title.toLowerCase().includes(p),N=!!(l&&C);let S;e[0]!==n||e[1]!==l?(S=()=>{l?.(null),n(),o("")},e[0]=n,e[1]=l,e[2]=S):S=e[2];const A=S,k=B=>{if(l){l(B.id),n(),o("");return}Bn({orgId:m.id,userId:f},B.id,h),g(),n(),o(""),j(B.id)},z="flex flex-col max-h-[min(640px,80dvh)]";let _;e[3]!==a?(_=s.jsx(vl,{value:a,onChange:o,placeholder:"Search agents..."}),e[3]=a,e[4]=_):_=e[4];const I="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",M=l&&C&&w&&s.jsx(Qe,{agent:w,selected:!i||i===w.id,onClick:A}),L=y.length>0&&s.jsx(Ft,{children:"Agents"}),P=y.map(B=>s.jsx(Qe,{agent:B,selected:l?i===B.id:void 0,onClick:()=>k(B)},B.id)),D=(v.length>0||!a)&&s.jsx(Ft,{action:s.jsxs("button",{type:"button",onClick:r,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:[s.jsx(ci,{className:"size-3.5"}),"Import"]}),children:"Code Agents"}),O=v.map(B=>s.jsx(Qe,{agent:B,selected:l?i===B.id:void 0,onClick:()=>k(B)},B.id));let R;e[5]!==N||e[6]!==a||e[7]!==b.length?(R=b.length===0&&!N&&a&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No agents found"}),e[5]=N,e[6]=a,e[7]=b.length,e[8]=R):R=e[8];let G;e[9]!==R||e[10]!==M||e[11]!==L||e[12]!==P||e[13]!==D||e[14]!==O?(G=s.jsxs("div",{className:I,children:[M,L,P,D,O,R]}),e[9]=R,e[10]=M,e[11]=L,e[12]=P,e[13]=D,e[14]=O,e[15]=G):G=e[15];let V;e[16]!==m.slug?(V={org:m.slug},e[16]=m.slug,e[17]=V):V=e[17];let Y;e[18]!==n?(Y=()=>n(),e[18]=n,e[19]=Y):Y=e[19];let U;e[20]!==V||e[21]!==Y?(U=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(Ps,{to:"/$org/settings/agents",params:V,onClick:Y,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[20]=V,e[21]=Y,e[22]=U):U=e[22];let q;return e[23]!==G||e[24]!==U||e[25]!==_?(q=s.jsxs("div",{className:z,children:[_,G,U]}),e[23]=G,e[24]=U,e[25]=_,e[26]=q):q=e[26],q}function Cl(t){return!Kt(t.metadata)}function wl(t){return Kt(t.metadata)}function kl(t){return!gn(t.id)}function Al(t){return!pn(t.id)}function Il(t){const e=$.c(31);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:l,trigger:i,onSelectAgent:r,selectedAgentId:a,side:o,align:d}=n,c=l===void 0?!1:l,m=o===void 0?"right":o,u=d===void 0?"start":d,[f,h]=E.useState(!1),[g,j]=E.useState(!1),x=ct(),{setOpenMobile:p}=pe(),b=En(),v=b?"border border-border":void 0;let y;e[2]!==b?(y=L=>b?s.jsx(Sl,{children:L}):L,e[2]=b,e[3]=y):y=e[3];const w=y;let C;e[4]!==x||e[5]!==p?(C=()=>{h(!1),x&&p(!1)},e[4]=x,e[5]=p,e[6]=C):C=e[6];const N=C;let S;e[7]!==N?(S=()=>{N(),j(!0)},e[7]=N,e[8]=S):S=e[8];const A=S;let k;e[9]!==N||e[10]!==A||e[11]!==r||e[12]!==f||e[13]!==a?(k=f&&s.jsx(E.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(te,{className:"h-4 w-24"})}),children:s.jsx(_l,{onClose:N,onSelectAgent:r,selectedAgentId:a,onImportFromGithub:A})}),e[9]=N,e[10]=A,e[11]=r,e[12]=f,e[13]=a,e[14]=k):k=e[14];const z=k;let _;e[15]!==u||e[16]!==c||e[17]!==v||e[18]!==b||e[19]!==x||e[20]!==f||e[21]!==z||e[22]!==m||e[23]!==i||e[24]!==w?(_=x?s.jsxs(s.Fragment,{children:[i?s.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:i}):c?w(s.jsx(ve,{"aria-label":"Browse agents",className:F(v),onClick:()=>{oe("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:s.jsx($e,{className:"size-4"})})):s.jsx(K,{children:w(s.jsxs(J,{tooltip:b?void 0:"Browse agents",className:F(v),onClick:()=>{oe("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:[s.jsx($e,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(Ut,{open:f,onOpenChange:h,direction:"bottom",children:s.jsxs(Wt,{className:"max-h-[85dvh] p-0",children:[s.jsx(qt,{className:"sr-only",children:"Browse agents"}),z]})})]}):s.jsxs(Ge,{open:f,onOpenChange:L=>{L&&!f&&oe("agent_browser_opened",{surface:"desktop_popover"}),h(L)},children:[i?s.jsx(ze,{asChild:!0,children:i}):c?w(s.jsx(ze,{asChild:!0,children:s.jsx(ve,{"aria-label":"Browse agents",className:F(v),children:s.jsx($e,{className:"size-4"})})})):s.jsx(K,{children:w(s.jsx(ze,{asChild:!0,children:s.jsxs(J,{tooltip:b?void 0:"Browse agents",className:F(v),children:[s.jsx($e,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Ue,{className:"w-[380px] p-0 overflow-hidden",side:m,align:u,children:z})]}),e[15]=u,e[16]=c,e[17]=v,e[18]=b,e[19]=x,e[20]=f,e[21]=z,e[22]=m,e[23]=i,e[24]=w,e[25]=_):_=e[25];let I;e[26]!==g?(I=s.jsx(ai,{open:g,onOpenChange:j,mode:"agent"}),e[26]=g,e[27]=I):I=e[27];let M;return e[28]!==I||e[29]!==_?(M=s.jsxs(s.Fragment,{children:[_,I]}),e[28]=I,e[29]=_,e[30]=M):M=e[30],M}const zl="wco-no-drag inline-flex items-center gap-1.5 min-w-0 rounded-md px-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 $l(t){const e=$.c(19),{agentId:n,fallback:l,onOpenHome:i,onPick:r}=t,a=mt(n)??l??null,o=a?.title??"Super Agent",d=`Open ${o} home`,c=a?.icon??null;let m;e[0]!==c||e[1]!==o?(m=s.jsx(ye,{icon:c,name:o,size:"xs"}),e[0]=c,e[1]=o,e[2]=m):m=e[2];let u;e[3]!==i||e[4]!==d||e[5]!==m?(u=s.jsx("button",{type:"button",onClick:i,"aria-label":d,className:"wco-no-drag 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:m}),e[3]=i,e[4]=d,e[5]=m,e[6]=u):u=e[6];let f;e[7]!==o?(f=s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:o}),e[7]=o,e[8]=f):f=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[9]=h):h=e[9];let g;e[10]!==f?(g=s.jsxs("button",{type:"button",className:zl,children:[f,h]}),e[10]=f,e[11]=g):g=e[11];let j;e[12]!==n||e[13]!==r||e[14]!==g?(j=s.jsx(Il,{side:"bottom",align:"start",selectedAgentId:n,onSelectAgent:r,trigger:g}),e[12]=n,e[13]=r,e[14]=g,e[15]=j):j=e[15];let x;return e[16]!==u||e[17]!==j?(x=s.jsxs("div",{className:"flex items-center gap-1",children:[u,j]}),e[16]=u,e[17]=j,e[18]=x):x=e[18],x}function Et(){const t=$.c(43),{org:e}=se(),{state:n,isMobile:l}=pe(),i=xe();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const a=lt(r);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[1]=o):o=t[1];const d=rt(o),{threads:c}=ut(),{setTaskId:m,createNewTask:u}=ft(),f=hs().invitations.length>0,h=n==="collapsed"||l;let g;t[2]!==e.id?(g=Re(e.id),t[2]=e.id,t[3]=g):g=t[3];const j=g,x=j.id,p=a.taskId?d.virtualmcpid??x:x;let b;t[4]!==u||t[5]!==x||t[6]!==i||t[7]!==e.slug||t[8]!==m||t[9]!==c?(b=O=>{if(!O||O===x){i({to:"/$org",params:{org:e.slug}});return}const R=di(c,O);R?m(R.id,O):u(O)},t[4]=u,t[5]=x,t[6]=i,t[7]=e.slug,t[8]=m,t[9]=c,t[10]=b):b=t[10];const v=b,y=f?`${e.name} — switch organization (pending invitation)`:`${e.name} — switch organization`;let w;t[11]!==e?(w=s.jsx(pt,{org:e,size:"sm"}),t[11]=e,t[12]=w):w=t[12];let C;t[13]!==f||t[14]!==h?(C=f&&s.jsx("span",{className:F("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",h?"-top-1":"top-1/2 -translate-y-1/2")}),t[13]=f,t[14]=h,t[15]=C):C=t[15];let N;t[16]!==w||t[17]!==C?(N=s.jsxs("span",{className:"relative inline-flex",children:[w,C]}),t[16]=w,t[17]=C,t[18]=N):N=t[18];let S;t[19]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[19]=S):S=t[19];let A;t[20]!==y||t[21]!==N?(A=s.jsx(ce,{asChild:!0,children:s.jsxs("button",{type:"button","aria-label":y,className:"wco-no-drag flex items-center gap-1.5 shrink-0 rounded-md pl-3 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:[N,S]})}),t[20]=y,t[21]=N,t[22]=A):A=t[22];let k;t[23]!==e.slug||t[24]!==A?(k=s.jsx(gl,{orgParam:e.slug,trigger:A}),t[23]=e.slug,t[24]=A,t[25]=k):k=t[25];let z;t[26]!==e.name?(z=s.jsx(de,{side:"bottom",children:e.name}),t[26]=e.name,t[27]=z):z=t[27];let _;t[28]!==k||t[29]!==z?(_=s.jsx(St,{children:s.jsxs(me,{children:[k,z]})}),t[28]=k,t[29]=z,t[30]=_):_=t[30];let I;t[31]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),t[31]=I):I=t[31];const M=p===x?j:void 0;let L;t[32]!==p||t[33]!==v?(L=()=>v(p),t[32]=p,t[33]=v,t[34]=L):L=t[34];let P;t[35]!==p||t[36]!==v||t[37]!==M||t[38]!==L?(P=s.jsx(St,{children:s.jsx(E.Suspense,{fallback:I,children:s.jsx($l,{agentId:p,fallback:M,onOpenHome:L,onPick:v})})}),t[35]=p,t[36]=v,t[37]=M,t[38]=L,t[39]=P):P=t[39];let D;return t[40]!==_||t[41]!==P?(D=s.jsx(Un,{className:"wco-no-drag",children:s.jsxs(Wn,{className:"flex-nowrap gap-1.5 sm:gap-1.5",children:[_,P]})}),t[40]=_,t[41]=P,t[42]=D):D=t[42],D}const Tl="sidebar.open";function Ml(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Fs,{}),t[0]=e):e=t[0],e}function qo(){const t=$.c(27),e=ct(),n=mi(),[l,i]=He(Tl,!1),{width:r,wrapperRef:a,onStartResize:o,resetWidth:d}=xi();let c;t[0]!==e||t[1]!==n?(c=e?s.jsxs(Q.Header,{className:"grid-cols-1 px-1 pr-1",children:[s.jsxs("div",{className:"grid w-full grid-cols-[auto_auto_auto_1fr_auto_auto] items-center gap-2",children:[!n&&s.jsx(Jt,{}),!n&&s.jsx(Et,{}),!n&&s.jsx(nt,{}),s.jsx("div",{"aria-hidden":!0,className:"min-w-0"}),s.jsx(Q.TogglesSlot,{}),!n&&s.jsx(Q.TabsSlot,{className:"min-w-0 justify-self-end"})]}),!n&&s.jsx(Q.CenterSlot,{}),!n&&s.jsx(Q.RightSlot,{})]}):s.jsxs(Q.Header,{children:[s.jsxs(Q.LeftColumn,{children:[!n&&s.jsx(Et,{}),s.jsx(Q.TogglesSlot,{})]}),n?s.jsx("div",{"aria-hidden":!0}):s.jsx(Q.CenterSlot,{}),s.jsx(Q.RightColumn,{children:!n&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] flex justify-end items-center gap-0.5",children:s.jsx(Q.TabsSlot,{})}),s.jsx(Q.RightSlot,{})]})})]}),t[0]=e,t[1]=n,t[2]=c):c=t[2];const m=`${r}px`;let u;t[3]!==m?(u={"--sidebar-width":m,"--sidebar-width-icon":"3.5rem"},t[3]=m,t[4]=u):u=t[4];const f=u;let h;t[5]!==e||t[6]!==o||t[7]!==n||t[8]!==d?(h=!e&&!n&&s.jsxs(s.Fragment,{children:[s.jsx(al,{}),s.jsx(ui,{onPointerDown:o,onDoubleClick:d})]}),t[5]=e,t[6]=o,t[7]=n,t[8]=d,t[9]=h):h=t[9];let g;t[10]===Symbol.for("react.memo_cache_sentinel")?(g={background:"transparent",containerType:"inline-size"},t[10]=g):g=t[10];let j;t[11]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Rs,{className:"flex flex-col",style:g,children:s.jsx("div",{className:"flex flex-col h-full min-h-0",children:s.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s.jsx(E.Suspense,{fallback:s.jsx(Ml,{}),children:s.jsx(Ds,{})})})})}),t[11]=j):j=t[11];let x;t[12]!==f||t[13]!==h||t[14]!==a?(x=s.jsxs(Bs,{ref:a,className:"flex-1 bg-sidebar relative min-h-0",style:f,children:[h,j]}),t[12]=f,t[13]=h,t[14]=a,t[15]=x):x=t[15];let p;t[16]!==e||t[17]!==n?(p=e&&!n&&s.jsx($n,{renderSidebar:Ol}),t[16]=e,t[17]=n,t[18]=p):p=t[18];let b;t[19]!==c||t[20]!==x||t[21]!==p?(b=s.jsx(Gn,{children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[c,x,p]})}),t[19]=c,t[20]=x,t[21]=p,t[22]=b):b=t[22];let v;return t[23]!==i||t[24]!==l||t[25]!==b?(v=s.jsx(jn,{children:s.jsx(Q.Provider,{children:s.jsx(Hs,{open:l,onOpenChange:i,children:b})})}),t[23]=i,t[24]=l,t[25]=b,t[26]=v):v=t[26],v}function Ol(t){const{onClose:e}=t;return s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"w-full bg-sidebar flex flex-col overflow-y-auto group/sidebar","data-state":"expanded",children:s.jsx(cl,{onClose:e})})})}export{qo as default};
@@ -1 +1 @@
1
- import{c as s,l as a,j as d}from"./index-BI1D40Bb.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
1
+ import{c as s,l as a,j as d}from"./index-Dsd_iuEd.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
@@ -1 +1 @@
1
- import{c as k,j as h,r as C,l as L}from"./index-BI1D40Bb.js";import{n as Z}from"./XCircle-CVhc7f91.js";import{A as y}from"./agent-icon-RfWwE9MD.js";const M={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},R={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},T={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},W={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function G(E){const t=k.c(13),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g;if(e?.startsWith("icon://")||e?.includes("#agentcolor=")){const r=W[n];let l;return t[0]!==o||t[1]!==e||t[2]!==s||t[3]!==r?(l=h.jsx(y,{icon:e,name:s,size:r,className:o}),t[0]=o,t[1]=e,t[2]=s,t[3]=r,t[4]=l):l=t[4],l}const S=e??"no-icon";let i;return t[5]!==o||t[6]!==c||t[7]!==I||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==S?(i=h.jsx($,{icon:e,name:s,size:n,className:o,fallbackIcon:c,fit:I},S),t[5]=o,t[6]=c,t[7]=I,t[8]=e,t[9]=s,t[10]=n,t[11]=S,t[12]=i):i=t[12],i}function $(E){const t=k.c(25),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g,[S,i]=C.useState(!1),r=!!e&&S,l=M[n],p=R[n];let a;t[0]!==o||t[1]!==l||t[2]!==p?(a=L("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,p,o),t[0]=o,t[1]=l,t[2]=p,t[3]=a):a=t[3];const N=e||void 0,_=I==="contain"?"object-contain":"object-cover",A=!r&&"hidden";let m;t[4]!==_||t[5]!==A?(m=L("h-full w-full",_,A),t[4]=_,t[5]=A,t[6]=m):m=t[6];let v,j;t[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>i(!1),j=()=>i(!0),t[7]=v,t[8]=j):(v=t[7],j=t[8]);let d;t[9]!==s||t[10]!==N||t[11]!==m?(d=h.jsx("img",{src:N,alt:s,className:m,onError:v,onLoad:j}),t[9]=s,t[10]=N,t[11]=m,t[12]=d):d=t[12];const z=r&&"hidden";let f;t[13]!==z?(f=L("h-full w-full flex items-center justify-center bg-muted/20",z),t[13]=z,t[14]=f):f=t[14];let x;t[15]!==c||t[16]!==n?(x=c??h.jsx(Z,{size:T[n],className:"text-muted-foreground"}),t[15]=c,t[16]=n,t[17]=x):x=t[17];let u;t[18]!==f||t[19]!==x?(u=h.jsx("div",{className:f,children:x}),t[18]=f,t[19]=x,t[20]=u):u=t[20];let b;return t[21]!==d||t[22]!==u||t[23]!==a?(b=h.jsxs("div",{className:a,children:[d,u]}),t[21]=d,t[22]=u,t[23]=a,t[24]=b):b=t[24],b}export{G as I};
1
+ import{c as k,j as h,r as C,l as L}from"./index-Dsd_iuEd.js";import{n as Z}from"./XCircle-DWSiH6uW.js";import{A as y}from"./agent-icon-CNKD9od7.js";const M={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},R={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},T={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},W={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function G(E){const t=k.c(13),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g;if(e?.startsWith("icon://")||e?.includes("#agentcolor=")){const r=W[n];let l;return t[0]!==o||t[1]!==e||t[2]!==s||t[3]!==r?(l=h.jsx(y,{icon:e,name:s,size:r,className:o}),t[0]=o,t[1]=e,t[2]=s,t[3]=r,t[4]=l):l=t[4],l}const S=e??"no-icon";let i;return t[5]!==o||t[6]!==c||t[7]!==I||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==S?(i=h.jsx($,{icon:e,name:s,size:n,className:o,fallbackIcon:c,fit:I},S),t[5]=o,t[6]=c,t[7]=I,t[8]=e,t[9]=s,t[10]=n,t[11]=S,t[12]=i):i=t[12],i}function $(E){const t=k.c(25),{icon:e,name:s,size:w,className:o,fallbackIcon:c,fit:g}=E,n=w===void 0?"md":w,I=g===void 0?"cover":g,[S,i]=C.useState(!1),r=!!e&&S,l=M[n],p=R[n];let a;t[0]!==o||t[1]!==l||t[2]!==p?(a=L("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,p,o),t[0]=o,t[1]=l,t[2]=p,t[3]=a):a=t[3];const N=e||void 0,_=I==="contain"?"object-contain":"object-cover",A=!r&&"hidden";let m;t[4]!==_||t[5]!==A?(m=L("h-full w-full",_,A),t[4]=_,t[5]=A,t[6]=m):m=t[6];let v,j;t[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>i(!1),j=()=>i(!0),t[7]=v,t[8]=j):(v=t[7],j=t[8]);let d;t[9]!==s||t[10]!==N||t[11]!==m?(d=h.jsx("img",{src:N,alt:s,className:m,onError:v,onLoad:j}),t[9]=s,t[10]=N,t[11]=m,t[12]=d):d=t[12];const z=r&&"hidden";let f;t[13]!==z?(f=L("h-full w-full flex items-center justify-center bg-muted/20",z),t[13]=z,t[14]=f):f=t[14];let x;t[15]!==c||t[16]!==n?(x=c??h.jsx(Z,{size:T[n],className:"text-muted-foreground"}),t[15]=c,t[16]=n,t[17]=x):x=t[17];let u;t[18]!==f||t[19]!==x?(u=h.jsx("div",{className:f,children:x}),t[18]=f,t[19]=x,t[20]=u):u=t[20];let b;return t[21]!==d||t[22]!==u||t[23]!==a?(b=h.jsxs("div",{className:a,children:[d,u]}),t[21]=d,t[22]=u,t[23]=a,t[24]=b):b=t[24],b}export{G as I};
@@ -1,3 +1,3 @@
1
- import{H as M,r as N,$ as R,p as L,a as V,J as B,d as K,M as p,t as c,K as j,j as s,B as C}from"./index-BI1D40Bb.js";import{e as O,i as q,d as z,c as Q,a as k,D as H}from"./dialog-DVfr6U1Q.js";import{a as J,F as b,b as v,c as U,d as w,e as S}from"./form-Cr_F07qT.js";import{a as Y,c as G,d as W,S as X,b as Z}from"./select-DtepIC1g.js";import{T as _}from"./textarea-Dq7eH56b.js";import{u as ee}from"./use-org-auth-client-DXbKeKAB.js";import{u as se}from"./use-organization-roles-6jciUWXs.js";const te=M().email("Invalid email address");function ne(r){if(!r.trim())return[];const m=r.split(/[,;\n]/).map(a=>a.trim().toLowerCase()).filter(a=>a.length>0);return Array.from(new Set(m))}function de({trigger:r}){const[m,a]=N.useState(!1),{locator:g}=R(),E=ee(),x=L(),{data:F}=V.useSession(),f=F?.user?.email,{roles:P,isLoading:y}=se(),T=P.filter(t=>t.role!=="owner"),i=B({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),$=i.watch("emailsText"),A=i.watch("role"),l=ne($).filter(t=>{const e=te.safeParse(t).success,n=!f||t!==f.toLowerCase();return e&&n}),o=K({mutationFn:async({emails:t,role:e})=>{if(!e)throw new Error("Please select a role");const n=await Promise.allSettled(t.map(async d=>{const h=await E.organization.inviteMember({email:d,role:e});if(h.error)throw new Error(h.error.message);return h.data})),u=n.filter(d=>d.status==="rejected");if(u.length>0)throw new Error(`Failed to invite ${u.length} member${u.length>1?"s":""}`);return n},onSuccess:(t,{emails:e,role:n})=>{p("member_invited",{count:e.length,role:n}),x.invalidateQueries({queryKey:j.members(g)}),x.invalidateQueries({queryKey:j.invitations(g)}),c.success(e.length===1?"Member invited successfully!":`${e.length} members invited successfully!`),i.reset({emailsText:"",role:"user"}),a(!1)},onError:(t,{emails:e,role:n})=>{p("member_invite_failed",{count:e.length,role:n,error:t instanceof Error?t.message:String(t)}),c.error(t instanceof Error?t.message:"Failed to invite members")}}),D=t=>{if(l.length===0){c.error("Please enter at least one valid email address");return}if(!t.role){c.error("Please select a role");return}o.mutate({emails:l,role:t.role})},I=l.length>0&&!!A;return s.jsxs(O,{open:m,onOpenChange:a,children:[s.jsx(q,{asChild:!0,children:r}),s.jsxs(z,{className:"sm:max-w-lg",children:[s.jsx(Q,{children:s.jsx(k,{children:"Invite members"})}),s.jsx(J,{...i,children:s.jsxs("form",{onSubmit:i.handleSubmit(D),className:"space-y-4",children:[s.jsx(b,{control:i.control,name:"emailsText",render:({field:t})=>s.jsxs(v,{children:[s.jsx(U,{children:"Email addresses"}),s.jsx(w,{children:s.jsx(_,{...t,disabled:o.isPending,placeholder:`Enter email addresses separated by commas or new lines
1
+ import{H as M,r as N,$ as R,p as L,a as V,J as B,d as K,M as p,t as c,K as j,j as s,B as C}from"./index-Dsd_iuEd.js";import{e as O,i as q,d as z,c as Q,a as k,D as H}from"./dialog-DLuAdZWN.js";import{a as J,F as b,b as v,c as U,d as w,e as S}from"./form-B7RrBOMB.js";import{a as Y,c as G,d as W,S as X,b as Z}from"./select-BkgqDf7e.js";import{T as _}from"./textarea-Cq3eLWgU.js";import{u as ee}from"./use-org-auth-client-C-Z33Ztc.js";import{u as se}from"./use-organization-roles-CGYFQ6NZ.js";const te=M().email("Invalid email address");function ne(r){if(!r.trim())return[];const m=r.split(/[,;\n]/).map(a=>a.trim().toLowerCase()).filter(a=>a.length>0);return Array.from(new Set(m))}function de({trigger:r}){const[m,a]=N.useState(!1),{locator:g}=R(),E=ee(),x=L(),{data:F}=V.useSession(),f=F?.user?.email,{roles:P,isLoading:y}=se(),T=P.filter(t=>t.role!=="owner"),i=B({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),$=i.watch("emailsText"),A=i.watch("role"),l=ne($).filter(t=>{const e=te.safeParse(t).success,n=!f||t!==f.toLowerCase();return e&&n}),o=K({mutationFn:async({emails:t,role:e})=>{if(!e)throw new Error("Please select a role");const n=await Promise.allSettled(t.map(async d=>{const h=await E.organization.inviteMember({email:d,role:e});if(h.error)throw new Error(h.error.message);return h.data})),u=n.filter(d=>d.status==="rejected");if(u.length>0)throw new Error(`Failed to invite ${u.length} member${u.length>1?"s":""}`);return n},onSuccess:(t,{emails:e,role:n})=>{p("member_invited",{count:e.length,role:n}),x.invalidateQueries({queryKey:j.members(g)}),x.invalidateQueries({queryKey:j.invitations(g)}),c.success(e.length===1?"Member invited successfully!":`${e.length} members invited successfully!`),i.reset({emailsText:"",role:"user"}),a(!1)},onError:(t,{emails:e,role:n})=>{p("member_invite_failed",{count:e.length,role:n,error:t instanceof Error?t.message:String(t)}),c.error(t instanceof Error?t.message:"Failed to invite members")}}),D=t=>{if(l.length===0){c.error("Please enter at least one valid email address");return}if(!t.role){c.error("Please select a role");return}o.mutate({emails:l,role:t.role})},I=l.length>0&&!!A;return s.jsxs(O,{open:m,onOpenChange:a,children:[s.jsx(q,{asChild:!0,children:r}),s.jsxs(z,{className:"sm:max-w-lg",children:[s.jsx(Q,{children:s.jsx(k,{children:"Invite members"})}),s.jsx(J,{...i,children:s.jsxs("form",{onSubmit:i.handleSubmit(D),className:"space-y-4",children:[s.jsx(b,{control:i.control,name:"emailsText",render:({field:t})=>s.jsxs(v,{children:[s.jsx(U,{children:"Email addresses"}),s.jsx(w,{children:s.jsx(_,{...t,disabled:o.isPending,placeholder:`Enter email addresses separated by commas or new lines
2
2
  e.g. user1@example.com, user2@example.com
3
3
  or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(S,{})]})}),s.jsx(b,{control:i.control,name:"role",render:({field:t})=>s.jsxs(v,{children:[s.jsx(w,{children:s.jsxs(Y,{value:t.value,onValueChange:t.onChange,disabled:o.isPending||y,children:[s.jsx(G,{className:"w-full",children:s.jsx(W,{placeholder:"Select a role"})}),s.jsx(X,{children:T.map(e=>{const n=[];return e.isBuiltin||(e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),(e.connectionCount!==0||e.allowsAllConnections)&&(e.allowsAllTools?n.push("all tools"):e.toolCount&&e.toolCount>0&&n.push(`${e.toolCount} tool${e.toolCount!==1?"s":""}`))),s.jsx(Z,{value:e.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:e.label}),!e.isBuiltin&&n.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:n.join(", ")})]})},e.role)})})]})}),s.jsx(S,{})]})}),s.jsxs(H,{children:[s.jsx(C,{variant:"outline",onClick:()=>{i.reset({emailsText:"",role:"user"}),a(!1)},type:"button",disabled:o.isPending,children:"Cancel"}),s.jsx(C,{type:"submit",disabled:o.isPending||!I,children:o.isPending?"Inviting...":`Invite ${l.length||0} Member${l.length!==1?"s":""}`})]})]})})]})]})}export{de as I};
@@ -1 +1 @@
1
- import{c as n,l as r,j as i,bC as p}from"./index-BI1D40Bb.js";function c(o){const e=n.c(8);let t,s;e[0]!==o?({className:t,...s}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}export{c as L};
1
+ import{c as n,l as r,j as i,bC as p}from"./index-Dsd_iuEd.js";function c(o){const e=n.c(8);let t,s;e[0]!==o?({className:t,...s}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==a?(l=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=l):l=e[7],l}export{c as L};
@@ -1 +1 @@
1
- import{a,u as f,j as o,S as g,N as p}from"./index-BI1D40Bb.js";import{A as x}from"./auth-entry-Cwowy8mG.js";import{A as S}from"./auth-split-layout-CpAHZeyz.js";import"./input-CFV763iN.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function y(e){if(!e.client_id||e.response_type!=="code")return null;const t=new URLSearchParams;return e.client_id&&t.set("client_id",e.client_id),e.redirect_uri&&t.set("redirect_uri",e.redirect_uri),e.response_type&&t.set("response_type",e.response_type),e.state&&t.set("state",e.state),e.scope&&t.set("scope",e.scope),e.code_challenge&&t.set("code_challenge",e.code_challenge),e.code_challenge_method&&t.set("code_challenge_method",e.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function L(){const e=a.useSession(),t=f({from:"/login"}),{next:i="/",client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_}=t,n=i.startsWith("/")&&!i.startsWith("//")?i:"/",c=y({client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_});return e.data?c?(window.location.href=c,o.jsx(g,{})):o.jsx(p,{to:n}):o.jsx(S,{children:o.jsx(x,{callbackUrl:n,redirectUrl:c})})}export{L as default};
1
+ import{a,u as f,j as o,S as g,N as p}from"./index-Dsd_iuEd.js";import{A as x}from"./auth-entry-CY4VryVo.js";import{A as S}from"./auth-split-layout-DfErsUKb.js";import"./input-DVEzPKKj.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function y(e){if(!e.client_id||e.response_type!=="code")return null;const t=new URLSearchParams;return e.client_id&&t.set("client_id",e.client_id),e.redirect_uri&&t.set("redirect_uri",e.redirect_uri),e.response_type&&t.set("response_type",e.response_type),e.state&&t.set("state",e.state),e.scope&&t.set("scope",e.scope),e.code_challenge&&t.set("code_challenge",e.code_challenge),e.code_challenge_method&&t.set("code_challenge_method",e.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function L(){const e=a.useSession(),t=f({from:"/login"}),{next:i="/",client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_}=t,n=i.startsWith("/")&&!i.startsWith("//")?i:"/",c=y({client_id:r,redirect_uri:s,response_type:l,state:h,scope:u,code_challenge:d,code_challenge_method:_});return e.data?c?(window.location.href=c,o.jsx(g,{})):o.jsx(p,{to:n}):o.jsx(S,{children:o.jsx(x,{callbackUrl:n,redirectUrl:c})})}export{L as default};
@@ -1 +1 @@
1
- import{d as x,b as N,c as z,a as D}from"./auth-2QEQeQe9.js";function E(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}function H(){return window.location.origin}function C(){try{const t=window.location.hostname;return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}const M=new Map,R="mcp:oauth:callback:";class W{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${H()}/oauth/callback`,this._windowMode=e.windowMode??"popup";const n=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...n&&{scope:n}},M.set(E(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const o=window.screenX+(window.outerWidth-600)/2,s=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${o},top=${s},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){M.delete(E(this.serverUrl))}}async function G(t){const e=t.meshUrl??window.location.origin,n=t.orgSlug?`/api/${encodeURIComponent(t.orgSlug)}/mcp/${t.connectionId}`:`/mcp/${t.connectionId}`,r=new URL(n,e),o=new W({serverUrl:r.href,clientName:t.clientName,clientUri:t.clientUri,callbackUrl:t.callbackUrl,scope:t.scope,windowMode:t.windowMode}),s={fn:null};try{const i=new Promise((l,d)=>{const k=t.timeout||12e4;let b,p=!1;const L=o.state(),A=`${R}${L}`,h=()=>{window.removeEventListener("message",v),window.removeEventListener("storage",O),clearTimeout(b);try{localStorage.removeItem(A)}catch{}};s.fn=u=>{p||(p=!0,h(),d(u))};const U=async u=>{if(p)return;if(p=!0,!u.success){h(),d(new Error(u.error||"OAuth authentication failed"));return}const{code:m,state:$}=u;if(!m){h(),d(new Error("Missing authorization code"));return}if(o.getStoredState()!==$){h(),d(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const T=(await x(r))?.authorization_servers?.[0]||r,S=await N(T),g=o.clientInformation();if(!g){h(),d(new Error("Client information not found"));return}const P=o.codeVerifier(),V=await z(T,{metadata:S,clientInformation:g,authorizationCode:m,codeVerifier:P,redirectUri:o.redirectUrl,resource:new URL(r)});h(),l({tokens:V,clientId:g.client_id??null,clientSecret:"client_secret"in g?g.client_secret:null,tokenEndpoint:S?.token_endpoint??null,userinfoEndpoint:S?.userinfo_endpoint??null})}catch(I){h(),d(I)}},v=async u=>{!C()&&u.origin!==window.location.origin||u.data?.type==="mcp:oauth:callback"&&await U(u.data)},O=async u=>{if(!(u.key!==A||!u.newValue))try{const m=JSON.parse(u.newValue);await U(m)}catch{}};window.addEventListener("message",v),window.addEventListener("storage",O),b=setTimeout(()=>{p||(p=!0,h(),d(new Error("OAuth authentication timeout")))},k)});if(i.catch(()=>{}),await D(o,{serverUrl:r})==="REDIRECT"){const l=await i,d=l.tokens;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint,userinfoEndpoint:l.userinfoEndpoint,idToken:typeof d.id_token=="string"?d.id_token:null},error:null}}const a=o.tokens(),w=o.clientInformation(),f=a;return{token:a?.access_token||null,tokenInfo:a?{accessToken:a.access_token,refreshToken:a.refresh_token??null,expiresIn:a.expires_in??null,scope:a.scope??null,clientId:w?.client_id??null,clientSecret:w&&"client_secret"in w?w.client_secret:null,tokenEndpoint:null,userinfoEndpoint:null,idToken:f&&typeof f.id_token=="string"?f.id_token:null}:null,error:null}}catch(i){return s.fn&&s.fn(i instanceof Error?i:new Error(String(i))),{token:null,tokenInfo:null,error:i instanceof Error?i.message:String(i)}}finally{o.cleanup()}}function y(t,e){if(window.opener&&!window.opener.closed){const n=C()?"*":window.location.origin;return window.opener.postMessage(t,n),!0}if(e)try{const n=`${R}${e}`;return localStorage.setItem(n,JSON.stringify(t)),!0}catch{}return!1}async function X(){const t=new URLSearchParams(window.location.search),e=t.get("code");let n=t.get("state");const r=t.get("error"),o=t.get("error_description");let s=n;if(n)try{const c=atob(n),a=JSON.parse(c);a.clientState&&(s=a.clientState)}catch{}if(r){const c=o||r;return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}if(!e||!n){const c="Missing code or state parameter";return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}return n=s||n,y({type:"mcp:oauth:callback",success:!0,code:e,state:n},n)?{success:!0}:{success:!1,error:"Parent window not available"}}function _(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function j(t){try{const e=_(),n=e?new URL(t,e):new URL(t),r=n.pathname.match(/^\/api\/[^/]+\/mcp\/([^/]+)/);return r?r[1]??null:n.pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}function J(t){try{const e=_();return(e?new URL(t,e):new URL(t)).pathname.match(/^\/api\/([^/]+)\/mcp\//)?.[1]??null}catch{return null}}async function K(t,e,n){try{const r=`/api/${encodeURIComponent(e)}/connections/${t}/oauth-token/status`,o=n?new URL(r,n).href:r,s=_(),i=!n||new URL(n).origin===s,c=await fetch(o,{credentials:i?"include":"omit"});return c.ok?{hasToken:(await c.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function q({url:t,token:e,orgId:n,meshUrl:r}){try{const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json, text/event-stream");const s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),i=j(t),c=J(t),a=_(),w=r??(a?new URL(t,a).origin:new URL(t).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(i&&c?await K(i,c,w):{hasToken:!1}).hasToken};let f;try{const k=await s.json();f=k.error||k.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:f||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:f||`HTTP ${s.status}`}}catch(o){return console.error("[isConnectionAuthenticated] Error:",o),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:o.message}}}export{G as a,X as h,q as i};
1
+ import{d as x,b as N,c as z,a as D}from"./auth-stk4L42H.js";function E(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}function H(){return window.location.origin}function C(){try{const t=window.location.hostname;return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}const M=new Map,R="mcp:oauth:callback:";class W{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${H()}/oauth/callback`,this._windowMode=e.windowMode??"popup";const n=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...n&&{scope:n}},M.set(E(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const o=window.screenX+(window.outerWidth-600)/2,s=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${o},top=${s},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){M.delete(E(this.serverUrl))}}async function G(t){const e=t.meshUrl??window.location.origin,n=t.orgSlug?`/api/${encodeURIComponent(t.orgSlug)}/mcp/${t.connectionId}`:`/mcp/${t.connectionId}`,r=new URL(n,e),o=new W({serverUrl:r.href,clientName:t.clientName,clientUri:t.clientUri,callbackUrl:t.callbackUrl,scope:t.scope,windowMode:t.windowMode}),s={fn:null};try{const i=new Promise((l,d)=>{const k=t.timeout||12e4;let b,p=!1;const L=o.state(),A=`${R}${L}`,h=()=>{window.removeEventListener("message",v),window.removeEventListener("storage",O),clearTimeout(b);try{localStorage.removeItem(A)}catch{}};s.fn=u=>{p||(p=!0,h(),d(u))};const U=async u=>{if(p)return;if(p=!0,!u.success){h(),d(new Error(u.error||"OAuth authentication failed"));return}const{code:m,state:$}=u;if(!m){h(),d(new Error("Missing authorization code"));return}if(o.getStoredState()!==$){h(),d(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const T=(await x(r))?.authorization_servers?.[0]||r,S=await N(T),g=o.clientInformation();if(!g){h(),d(new Error("Client information not found"));return}const P=o.codeVerifier(),V=await z(T,{metadata:S,clientInformation:g,authorizationCode:m,codeVerifier:P,redirectUri:o.redirectUrl,resource:new URL(r)});h(),l({tokens:V,clientId:g.client_id??null,clientSecret:"client_secret"in g?g.client_secret:null,tokenEndpoint:S?.token_endpoint??null,userinfoEndpoint:S?.userinfo_endpoint??null})}catch(I){h(),d(I)}},v=async u=>{!C()&&u.origin!==window.location.origin||u.data?.type==="mcp:oauth:callback"&&await U(u.data)},O=async u=>{if(!(u.key!==A||!u.newValue))try{const m=JSON.parse(u.newValue);await U(m)}catch{}};window.addEventListener("message",v),window.addEventListener("storage",O),b=setTimeout(()=>{p||(p=!0,h(),d(new Error("OAuth authentication timeout")))},k)});if(i.catch(()=>{}),await D(o,{serverUrl:r})==="REDIRECT"){const l=await i,d=l.tokens;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint,userinfoEndpoint:l.userinfoEndpoint,idToken:typeof d.id_token=="string"?d.id_token:null},error:null}}const a=o.tokens(),w=o.clientInformation(),f=a;return{token:a?.access_token||null,tokenInfo:a?{accessToken:a.access_token,refreshToken:a.refresh_token??null,expiresIn:a.expires_in??null,scope:a.scope??null,clientId:w?.client_id??null,clientSecret:w&&"client_secret"in w?w.client_secret:null,tokenEndpoint:null,userinfoEndpoint:null,idToken:f&&typeof f.id_token=="string"?f.id_token:null}:null,error:null}}catch(i){return s.fn&&s.fn(i instanceof Error?i:new Error(String(i))),{token:null,tokenInfo:null,error:i instanceof Error?i.message:String(i)}}finally{o.cleanup()}}function y(t,e){if(window.opener&&!window.opener.closed){const n=C()?"*":window.location.origin;return window.opener.postMessage(t,n),!0}if(e)try{const n=`${R}${e}`;return localStorage.setItem(n,JSON.stringify(t)),!0}catch{}return!1}async function X(){const t=new URLSearchParams(window.location.search),e=t.get("code");let n=t.get("state");const r=t.get("error"),o=t.get("error_description");let s=n;if(n)try{const c=atob(n),a=JSON.parse(c);a.clientState&&(s=a.clientState)}catch{}if(r){const c=o||r;return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}if(!e||!n){const c="Missing code or state parameter";return y({type:"mcp:oauth:callback",success:!1,error:c},s),{success:!1,error:c}}return n=s||n,y({type:"mcp:oauth:callback",success:!0,code:e,state:n},n)?{success:!0}:{success:!1,error:"Parent window not available"}}function _(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function j(t){try{const e=_(),n=e?new URL(t,e):new URL(t),r=n.pathname.match(/^\/api\/[^/]+\/mcp\/([^/]+)/);return r?r[1]??null:n.pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}function J(t){try{const e=_();return(e?new URL(t,e):new URL(t)).pathname.match(/^\/api\/([^/]+)\/mcp\//)?.[1]??null}catch{return null}}async function K(t,e,n){try{const r=`/api/${encodeURIComponent(e)}/connections/${t}/oauth-token/status`,o=n?new URL(r,n).href:r,s=_(),i=!n||new URL(n).origin===s,c=await fetch(o,{credentials:i?"include":"omit"});return c.ok?{hasToken:(await c.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function q({url:t,token:e,orgId:n,meshUrl:r}){try{const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json, text/event-stream");const s=await fetch(t,{method:"POST",headers:o,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),i=j(t),c=J(t),a=_(),w=r??(a?new URL(t,a).origin:new URL(t).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(i&&c?await K(i,c,w):{hasToken:!1}).hasToken};let f;try{const k=await s.json();f=k.error||k.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:f||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:f||`HTTP ${s.status}`}}catch(o){return console.error("[isConnectionAuthenticated] Error:",o),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:o.message}}}export{G as a,X as h,q as i};