@decocms/mesh 2.69.0 → 2.70.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 (133) hide show
  1. package/dist/client/assets/{AlertCircle-CrLCfZT0.js → AlertCircle-BezwDSfD.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-deTSI0E8.js → ArrowUp-dvehulHz.js} +1 -1
  3. package/dist/client/assets/{Calendar-BaFebt3t.js → Calendar-h8FQa5-L.js} +1 -1
  4. package/dist/client/assets/{Check-DTUUSvp-.js → Check-BYQw8z-Y.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-BoFrCz54.js → CheckCircle-CL4SXRoY.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-DeD12W57.js → ChevronDown-B01wwgGg.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-8Yl-zCCi.js → ChevronRight-BgsyooQy.js} +1 -1
  8. package/dist/client/assets/{Code01-C2qL6p3f.js → Code01-C-mqJnK8.js} +1 -1
  9. package/dist/client/assets/{Copy01-CqWuZ9K-.js → Copy01-DbtcxuOL.js} +1 -1
  10. package/dist/client/assets/{DotsHorizontal-4eEmoKn5.js → DotsHorizontal-DklTtUVu.js} +1 -1
  11. package/dist/client/assets/{DotsVertical-BYXFslta.js → DotsVertical-Cb3BjT8W.js} +1 -1
  12. package/dist/client/assets/{Download01-DDoxVok6.js → Download01-CGjFy_eW.js} +1 -1
  13. package/dist/client/assets/{Edit01-BD2PlTCM.js → Edit01-CvfI3EP-.js} +1 -1
  14. package/dist/client/assets/{File02-D_ZJmgQJ.js → File02-BlLo0zLH.js} +1 -1
  15. package/dist/client/assets/{File06-iSPwdYi1.js → File06-KP9uA_8Z.js} +1 -1
  16. package/dist/client/assets/{FilterLines-uGkpVOX8.js → FilterLines-UXqFmiMf.js} +1 -1
  17. package/dist/client/assets/{Globe02-BhcJ1ruM.js → Globe02-BsDDXBRS.js} +1 -1
  18. package/dist/client/assets/{Grid01-B9LzvODL.js → Grid01-BcwhAHU4.js} +1 -1
  19. package/dist/client/assets/{Home02-DCnIiCxj.js → Home02-BlyGQgkd.js} +1 -1
  20. package/dist/client/assets/{Image01-BYZhOfgB.js → Image01-BfaRMPFj.js} +1 -1
  21. package/dist/client/assets/{Inbox01-CUvjj3IH.js → Inbox01-CBfpFDWi.js} +1 -1
  22. package/dist/client/assets/{InfoCircle-DzQgROgs.js → InfoCircle-DxAtE-qm.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-D33uvRa3.js → LinkExternal01-BO8u8DWo.js} +1 -1
  24. package/dist/client/assets/{List-C1dM-VCr.js → List-JHCqXqb-.js} +1 -1
  25. package/dist/client/assets/{Loading01-3CQcIIbt.js → Loading01-D-xfXVAb.js} +1 -1
  26. package/dist/client/assets/{Lock01-aFdw7wqo.js → Lock01-DZjbvWbD.js} +1 -1
  27. package/dist/client/assets/{Pin01-ChRD6YtE.js → Pin01-ChK2Hntv.js} +1 -1
  28. package/dist/client/assets/{Play-B5QcYkt5.js → Play-z4l5W2L1.js} +1 -1
  29. package/dist/client/assets/{Plus-CP35U6Iv.js → Plus-Bzxd7t2s.js} +1 -1
  30. package/dist/client/assets/{SearchMd-DTs0TtNF.js → SearchMd-D3LhC38x.js} +1 -1
  31. package/dist/client/assets/{Share07-DGflfftp.js → Share07-ZXBsv_iS.js} +1 -1
  32. package/dist/client/assets/{Terminal-Djd_0g5K.js → Terminal-B67MbBEE.js} +1 -1
  33. package/dist/client/assets/{Tool01-A-03PfQ_.js → Tool01-Dazy9LgU.js} +1 -1
  34. package/dist/client/assets/{Trash01-Ck6jzVhZ.js → Trash01-CzXeR5aG.js} +1 -1
  35. package/dist/client/assets/{Upload01-CsBiVkrb.js → Upload01-C44UWapi.js} +1 -1
  36. package/dist/client/assets/{Users03-B-DO1n7F.js → Users03-DvKocm1e.js} +1 -1
  37. package/dist/client/assets/{X-BnxI_xD6.js → X-DA_xWnsV.js} +1 -1
  38. package/dist/client/assets/{XClose-DvgsYIZw.js → XClose-BnWgQmD9.js} +1 -1
  39. package/dist/client/assets/{agent-connections-preview-CYQwMlB4.js → agent-connections-preview-QkUvg0G5.js} +1 -1
  40. package/dist/client/assets/{agent-detail-tHoRcKR8.js → agent-detail-X5w-qX8R.js} +1 -1
  41. package/dist/client/assets/{agents-CNdtweuU.js → agents-CYcOxOrg.js} +1 -1
  42. package/dist/client/assets/{alert-dialog-DN6po1tq.js → alert-dialog-Cb25OanG.js} +1 -1
  43. package/dist/client/assets/{auth-catchall-Bt6aq6Tb.js → auth-catchall-A4BAP7E8.js} +1 -1
  44. package/dist/client/assets/{badge-DIFY1rsD.js → badge-Dq2_S74H.js} +1 -1
  45. package/dist/client/assets/{binder-Dg2rfYkp.js → binder-CacmcUyU.js} +1 -1
  46. package/dist/client/assets/{breadcrumb-CJBikxW8.js → breadcrumb-Cp0sD1P8.js} +1 -1
  47. package/dist/client/assets/{button-CKIyuXIq.js → button-CvZ7ap4z.js} +1 -1
  48. package/dist/client/assets/{card-MU9VbmJ4.js → card-B7JF-Bqk.js} +1 -1
  49. package/dist/client/assets/{checkbox-BomYVgbH.js → checkbox-CaN6ZzyM.js} +1 -1
  50. package/dist/client/assets/{circle-alert-BcHAU0vN.js → circle-alert-D9ps2Jky.js} +1 -1
  51. package/dist/client/assets/{collection-detail-CZFVa2Zq.js → collection-detail-CB8jXJcZ.js} +1 -1
  52. package/dist/client/assets/{collection-search-CECpIAiD.js → collection-search-Cm7834fO.js} +1 -1
  53. package/dist/client/assets/{collection-tab-D12suO7P.js → collection-tab-bEhbF2ie.js} +1 -1
  54. package/dist/client/assets/{collection-table-wrapper-CzqGMTIb.js → collection-table-wrapper-DmMQEj1Y.js} +1 -1
  55. package/dist/client/assets/{collection-tabs-Dd6S7hPE.js → collection-tabs-TzBHBqNn.js} +1 -1
  56. package/dist/client/assets/{command-BLAC1NoH.js → command-B9mkhjGp.js} +1 -1
  57. package/dist/client/assets/{connect-VopSOjzi.js → connect-DGnFAZLO.js} +1 -1
  58. package/dist/client/assets/{connection-card-C7cdqtZc.js → connection-card-C26CaSa2.js} +1 -1
  59. package/dist/client/assets/{connection-detail-Cm-idmqc.js → connection-detail-B4L1y9d7.js} +1 -1
  60. package/dist/client/assets/{connections-DqIiaOoJ.js → connections-Bl21qJrP.js} +1 -1
  61. package/dist/client/assets/constants-BpxXCXKI.js +1 -0
  62. package/dist/client/assets/{constants-DwkB1age.js → constants-DxgwQ0uV.js} +1 -1
  63. package/dist/client/assets/{create-organization-dialog-QVwT9MeU.js → create-organization-dialog-SdQDHLb3.js} +1 -1
  64. package/dist/client/assets/{dialog-CjI8rs-6.js → dialog-CRL62yun.js} +1 -1
  65. package/dist/client/assets/{dropdown-menu-CoO02CsY.js → dropdown-menu-CcLjoPOd.js} +1 -1
  66. package/dist/client/assets/{dynamic-plugin-layout-DxUJHFK2.js → dynamic-plugin-layout-B4w1ZWEV.js} +1 -1
  67. package/dist/client/assets/{empty-state-CQab9dR0.js → empty-state-CfCXoGkN.js} +1 -1
  68. package/dist/client/assets/{empty-state-VwVcPCE1.js → empty-state-DYOBL1E0.js} +1 -1
  69. package/dist/client/assets/{env-vars-editor-BMhfk7Zf.js → env-vars-editor-DDXgEbPo.js} +1 -1
  70. package/dist/client/assets/{error-boundary-C8CO11ML.js → error-boundary-4OVFwt4t.js} +1 -1
  71. package/dist/client/assets/{extract-connection-data-DwTMOpOf.js → extract-connection-data-CzS3lDB-.js} +1 -1
  72. package/dist/client/assets/{file-browser-BqPRsorK.js → file-browser-6UZuq7zX.js} +2 -2
  73. package/dist/client/assets/{form-CO4xV9gA.js → form-BMkAgBlF.js} +1 -1
  74. package/dist/client/assets/{grid-view-CDgwvRTT.js → grid-view-CWl7aywJ.js} +1 -1
  75. package/dist/client/assets/{home-Bgf631v9.js → home-BR3OUI2t.js} +1 -1
  76. package/dist/client/assets/{index-CvZXtRPz.js → index-7AgCq2Xy.js} +1 -1
  77. package/dist/client/assets/{index-CrNYs5dK.js → index-A5-jWh8j.js} +1 -1
  78. package/dist/client/assets/{index-BdSNJxPZ.js → index-BT-HZ5Ji.js} +1 -1
  79. package/dist/client/assets/{index-Bc7QzOnC.js → index-D-HDjXTE.js} +1 -1
  80. package/dist/client/assets/{index-CNwEt7K8.js → index-DSxpuyFV.js} +1 -1
  81. package/dist/client/assets/{index-CHQ9-Q-G.js → index-DZKwM-s7.js} +2 -2
  82. package/dist/client/assets/{index-810mvVLg.js → index-EPWxzjdy.js} +1 -1
  83. package/dist/client/assets/{index-aWpPBjkT.js → index-QlAcVvwl.js} +1 -1
  84. package/dist/client/assets/{infiniteQueryObserver-CKMx30vn.js → infiniteQueryObserver-DWcK8VlL.js} +1 -1
  85. package/dist/client/assets/{input-BrgRsDcE.js → input-CCH8wBeN.js} +1 -1
  86. package/dist/client/assets/{layout-D8nQ7DGi.js → layout-CFcrP_gh.js} +1 -1
  87. package/dist/client/assets/{localstorage-keys-BiLB-Ybm.js → localstorage-keys-Bp3EEwvJ.js} +1 -1
  88. package/dist/client/assets/{login-COXBU4ri.js → login-B3Lz3WJw.js} +1 -1
  89. package/dist/client/assets/{mcp-oauth-i2Um3a9A.js → mcp-oauth-BxlFzaKv.js} +1 -1
  90. package/dist/client/assets/{mcp-server-card-B_tcMycX.js → mcp-server-card-BiWf5qTJ.js} +1 -1
  91. package/dist/client/assets/{mcp-server-detail-CCPdSS0H.js → mcp-server-detail-BqixFRRZ.js} +2 -2
  92. package/dist/client/assets/{members-DNx_w5eC.js → members-B7rimL4F.js} +1 -1
  93. package/dist/client/assets/{monaco-editor-qYykGrlT.js → monaco-editor-CJjRKcIU.js} +1 -1
  94. package/dist/client/assets/{monitoring-BuIkRBxN.js → monitoring-DxrBnpZd.js} +1 -1
  95. package/dist/client/assets/{oauth-callback-B24XRb9Q.js → oauth-callback-DGhu6Chr.js} +1 -1
  96. package/dist/client/assets/{page-Buen7bnX.js → page-BWI6bPR7.js} +1 -1
  97. package/dist/client/assets/{page-NaxcVK27.js → page-DVqhwqZx.js} +1 -1
  98. package/dist/client/assets/{plugin-empty-state-CNA6ghy_.js → plugin-empty-state-CktLrMBj.js} +1 -1
  99. package/dist/client/assets/{plugin-header-ColWGLS5.js → plugin-header-DbkEoXax.js} +1 -1
  100. package/dist/client/assets/{plugins-Bwp1vQes.js → plugins-CzA8Hcki.js} +1 -1
  101. package/dist/client/assets/{popover-CjUGVjON.js → popover-DceEFrFl.js} +1 -1
  102. package/dist/client/assets/{registry-utils-TFnNkGPj.js → registry-utils-DUAoVdTh.js} +1 -1
  103. package/dist/client/assets/{resizable-DQA2LWqr.js → resizable-t6UNpqyU.js} +1 -1
  104. package/dist/client/assets/{select-JdRjOrBE.js → select-B_vbJmw6.js} +1 -1
  105. package/dist/client/assets/{settings-C5BA4Ik8.js → settings-CeQn4x-C.js} +1 -1
  106. package/dist/client/assets/{shell-layout-Dz2AUt47.js → shell-layout-DImE3kuq.js} +4 -4
  107. package/dist/client/assets/{spinner-CEhxpPPn.js → spinner-tIX7WyGo.js} +1 -1
  108. package/dist/client/assets/{store-invite-2RTGhZRS.js → store-invite-CuhcNTRz.js} +1 -1
  109. package/dist/client/assets/{switch-DKkhDe7l.js → switch-GBP-Rfzk.js} +1 -1
  110. package/dist/client/assets/{table-CBtv9zrT.js → table-DnQsZAfD.js} +1 -1
  111. package/dist/client/assets/{textarea-BBk7k5wE.js → textarea-Ct8RODCq.js} +1 -1
  112. package/dist/client/assets/{tools-list-DGAPFCDO.js → tools-list-DLKOGKDM.js} +1 -1
  113. package/dist/client/assets/{typewriter-title-XDUo1EGk.js → typewriter-title-CI2zaIEM.js} +1 -1
  114. package/dist/client/assets/{use-binding-HsWp1jWu.js → use-binding-B1CUjViK.js} +1 -1
  115. package/dist/client/assets/{use-connection-UwIAiUmR.js → use-connection-XCZq2oM3.js} +1 -1
  116. package/dist/client/assets/{use-create-virtual-mcp-CG-Wp4A9.js → use-create-virtual-mcp-CRDZ-XFI.js} +1 -1
  117. package/dist/client/assets/{use-deco-chat-open-Da_cfFLg.js → use-deco-chat-open-4Zv_iiyK.js} +1 -1
  118. package/dist/client/assets/{use-list-state-Dxbvm2sV.js → use-list-state-dpsvpBoc.js} +1 -1
  119. package/dist/client/assets/{use-mcp-prompts-DDPkiTOB.js → use-mcp-prompts-DNR-G5Qv.js} +1 -1
  120. package/dist/client/assets/{use-mcp-tools-BKgKiBFS.js → use-mcp-tools-DX0GOqaY.js} +1 -1
  121. package/dist/client/assets/{use-mobile-CtC8_4UP.js → use-mobile-Du5W-PVZ.js} +1 -1
  122. package/dist/client/assets/{use-organization-settings-TImCLEbo.js → use-organization-settings-BaiSl7Pi.js} +1 -1
  123. package/dist/client/assets/{use-virtual-mcp-BIZk_q3v.js → use-virtual-mcp-CDRC9fSF.js} +1 -1
  124. package/dist/client/assets/useInfiniteQuery-1H3bf64-.js +1 -0
  125. package/dist/client/assets/{useMutation-C8K1KoTI.js → useMutation-BvIaEUwy.js} +1 -1
  126. package/dist/client/assets/useQuery-CPf79nZ3.js +1 -0
  127. package/dist/client/assets/{view-mode-toggle-BiRjYen1.js → view-mode-toggle-DDn0emqa.js} +1 -1
  128. package/dist/client/assets/{workflow-TGPdc23k.js → workflow-AD6ASr2g.js} +1 -1
  129. package/dist/client/index.html +1 -1
  130. package/package.json +1 -1
  131. package/dist/client/assets/constants-DBJOqOcW.js +0 -1
  132. package/dist/client/assets/useInfiniteQuery-wjoMRbc3.js +0 -1
  133. package/dist/client/assets/useQuery-CImYAWdS.js +0 -1
@@ -1,3 +1,3 @@
1
- import{r as D,c as le,j as s,p as Yt,u as Ce,g as ae,K as ce,o as Et,ad as at,s as ve,ba as Xt,bg as Jt,F as we,k as Dt,h as Wt,t as ne,E as es}from"./index-CHQ9-Q-G.js";import{C as ts,a as ss}from"./collection-table-wrapper-CzqGMTIb.js";import{C as Ke}from"./collection-search-CECpIAiD.js";import{P as Ne}from"./index-aWpPBjkT.js";import{B as ns,a as rs,b as is,e as os}from"./breadcrumb-CJBikxW8.js";import{I as zt,c as _e,b as Re,T as Pe,a as Me,E as ct}from"./empty-state-VwVcPCE1.js";import{C as De}from"./checkbox-BomYVgbH.js";import{c as X,B as ie}from"./button-CKIyuXIq.js";import{h as kt}from"./use-connection-UwIAiUmR.js";import{u as bt,C as dt,a as mt,b as yt,c as ls,d as as,e as cs,f as ds}from"./command-BLAC1NoH.js";import{u as it}from"./useQuery-CImYAWdS.js";import{u as Te}from"./useMutation-C8K1KoTI.js";import{f as ze,a as ke,b as Ue,c as Ve,d as Be,e as Ge,A as $e,g as Fe,h as Ae}from"./alert-dialog-DN6po1tq.js";import{B as Ee}from"./badge-DIFY1rsD.js";import{D as Ut,f as Vt,a as Bt,b as ms,c as us,e as fs}from"./dialog-CjI8rs-6.js";import{D as Ct,a as jt,b as Tt,c as tt,d as hs,e as gs,f as xs,g as ps}from"./dropdown-menu-CoO02CsY.js";import{i as bs}from"./DotsHorizontal-4eEmoKn5.js";import{i as st}from"./Loading01-3CQcIIbt.js";import{i as Cs}from"./Lock01-aFdw7wqo.js";import{s as nt}from"./Plus-CP35U6Iv.js";import{s as Gt}from"./Trash01-Ck6jzVhZ.js";import{i as St}from"./X-BnxI_xD6.js";import{I as js}from"./input-BrgRsDcE.js";import{S as Xe}from"./switch-DKkhDe7l.js";import{E as Ts}from"./error-boundary-C8CO11ML.js";import{a as vs,F as It,b as Ot,c as Ns,d as At,f as wt}from"./form-CO4xV9gA.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-JdRjOrBE.js";import{T as Es}from"./textarea-BBk7k5wE.js";import{a as qe,u as Qe}from"./constants-DwkB1age.js";import{C as Lt}from"./card-MU9VbmJ4.js";import{i as $t}from"./DotsVertical-BYXFslta.js";import{i as ys}from"./index-Bc7QzOnC.js";import{s as Ft}from"./XClose-DvgsYIZw.js";import{a as Ss,b as Is,P as Os}from"./popover-CjUGVjON.js";import{t as As}from"./ChevronDown-DeD12W57.js";import"./ArrowUp-deTSI0E8.js";import"./Check-DTUUSvp-.js";import"./Grid01-B9LzvODL.js";import"./List-C1dM-VCr.js";import"./view-mode-toggle-BiRjYen1.js";import"./table-CBtv9zrT.js";import"./SearchMd-DTs0TtNF.js";import"./ChevronRight-8Yl-zCCi.js";const Kt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));Kt.displayName="ArrowLeft";const vt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));vt.displayName="Shield01";const qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));qt.displayName="SwitchHorizontal01";const Qt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"COLLECTION_VIRTUAL_TOOLS_CREATE",description:"Create virtual tools on Virtual MCPs",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_LIST",description:"List virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_GET",description:"View virtual tool details",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_UPDATE",description:"Update virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_DELETE",description:"Delete virtual tools",category:"Virtual Tools",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"}],ws={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",COLLECTION_VIRTUAL_TOOLS_CREATE:"Create virtual tools",COLLECTION_VIRTUAL_TOOLS_LIST:"List virtual tools",COLLECTION_VIRTUAL_TOOLS_GET:"View virtual tool details",COLLECTION_VIRTUAL_TOOLS_UPDATE:"Update virtual tools",COLLECTION_VIRTUAL_TOOLS_DELETE:"Delete virtual tools",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags"};function Ls(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[]};for(const e of Qt)t[e.category]?.push(e);return t}function _s(){return Qt.map(t=>({value:t.name,label:ws[t.name],dangerous:t.dangerous}))}const Rs=D.memo(function(e){const n=le.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:c,totalToolsCount:i,onSelect:u,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let C;n[0]!==m?(C=X("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=C):C=n[1];let d;n[2]!==r.icon||n[3]!==r.title?(d=s.jsx(zt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=d):d=n[4];let v;n[5]!==r.title?(v=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=v):v=n[6];let g;n[7]!==u||n[8]!==d||n[9]!==v?(g=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:u,children:[d,v]}),n[7]=u,n[8]=d,n[9]=v,n[10]=g):g=n[10];let j;n[11]!==c||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(j=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[c,"/",i]}),s.jsx(De,{checked:o,onCheckedChange:x,onClick:Ds})]}),n[11]=c,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=j):j=n[16];let b;return n[17]!==C||n[18]!==g||n[19]!==j?(b=s.jsxs("div",{className:C,children:[g,j]}),n[17]=C,n[18]=g,n[19]=j,n[20]=b):b=n[20],b}),Ps=D.memo(function(e){const n=le.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:c}=e,i=`tool-${r}-${l.name}`,u=o?"text-foreground":"text-muted-foreground";let x;n[0]!==u?(x=X("text-sm font-medium",u),n[0]=u,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let C;n[5]!==l.description?(C=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=C):C=n[6];let d;n[7]!==m||n[8]!==C?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,C]}),n[7]=m,n[8]=C,n[9]=d):d=n[9];const v=`tool-${r}-${l.name}`;let g;n[10]!==o||n[11]!==c||n[12]!==v?(g=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(De,{id:v,checked:o,onCheckedChange:c,onClick:zs})}),n[10]=o,n[11]=c,n[12]=v,n[13]=g):g=n[13];let j;return n[14]!==i||n[15]!==d||n[16]!==g?(j=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[d,g]}),n[14]=i,n[15]=d,n[16]=g,n[17]=j):j=n[17],j});function Ms({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[c,i]=D.useState("all"),[u,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),C=kt({searchTerm:o.trim()||void 0}),d=n?C.filter(h=>h.connection_type!=="VIRTUAL"?!0:Yt(h.connection_url)!==n):C,v=m.current,g=[...v.values()].map(h=>d.find(S=>S.id===h)).filter(h=>h!==void 0),j=d.filter(h=>!v.has(h.id)),b=[...g,...j],I=h=>{const S=t[h];return S!==void 0&&S.length>0},T=b.filter(h=>{if(c==="all")return!0;const S=I(h.id);return c==="selected"?S:c==="unselected"?!S:!0}),[f,O]=D.useState(b[0]?.id??null),N=f?b.find(h=>h.id===f)??null:null,P=N?.tools??[],A=(h,S)=>t[h]?.includes(S)??!1,R=(h,S)=>{const E=t[h]??[],p=E.includes(S),_={...t};if(p){const k=E.filter(B=>B!==S);k.length===0?delete _[h]:_[h]=k}else _[h]=[...E,S];e(_)},L=h=>{const S=b.find(B=>B.id===h);if(!S?.tools)return;const E=t[h]??[],p=S.tools.map(B=>B.name),_=E.length>0&&p.every(B=>E.includes(B)),k={...t};_?delete k[h]:(k[h]=p,O(h)),e(k)},M=h=>{O(h),x(!0)},w=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:X("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[s.jsx(Ke,{value:r,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:T.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:T.map(h=>{const S=h.tools?.length??0,E=t[h.id]?.length??0;return s.jsx(Rs,{connection:h,isSelected:f===h.id,hasToolsEnabled:I(h.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>M(h.id),onToggle:()=>L(h.id)},h.id)})})})]}),s.jsx("div",{className:X("flex-1 flex-col",u?"flex":"hidden md:flex"),children:N?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:w,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Kt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(zt,{icon:N.icon,name:N.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:N.title}),N.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:N.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(h=>s.jsx(Ps,{connectionId:N.id,tool:h,isSelected:A(N.id,h.name),onToggle:()=>R(N.id,h.name)},h.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Ds(t){return t.stopPropagation()}function zs(t){return t.stopPropagation()}const _t=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function ks(t){return t.replace(/-/g," ")}function Us(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let c=!1;for(const[i,u]of Object.entries(t)){if(i==="self"){u.includes("*")?n=!0:e.push(...u);continue}if(i==="*"){if(l=!0,u.includes("*"))c=!0;else for(const x of u)o.add(x);continue}if(r.push(i),u.includes("*"))c=!0;else for(const x of u)o.add(x)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:c}}function Nt(){const{locator:t}=Ce(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ce.organizationRoles(t),queryFn:async()=>{try{const i=await ae.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),o=_t.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const u=i.role;if(!u||_t.some(j=>j.value===u))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:C,allowsAllConnections:d,toolNames:v,allowsAllTools:g}=Us(i.permission);o.push({id:i.id,role:u,label:ks(u),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:d?-1:C.length,allowsAllConnections:d,toolCount:g?-1:v.length,allowsAllTools:g})}const c=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:c,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Vs=Et({role:Et({id:ve().optional(),slug:ve().optional(),label:ve()}),allowAllStaticPermissions:Jt(),staticPermissions:at(ve()),toolSet:Xt(ve(),at(ve())),memberIds:at(ve())});function Ht(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Bs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ut=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Gs(t){if(!t)return"bg-neutral-400";let e=0;for(let r=0;r<t.length;r++){const l=t.charCodeAt(r);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ut.length;return ut[n]??ut[0]}function Je(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function $s(t){const e=le.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:c}=t,i=c===void 0?!1:c,[u,x]=D.useState(""),m=D.useDeferredValue(u);let C,d,v,g,j;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r){const T=Ls(),f=_s(),O=f.filter(w=>w.label.toLowerCase().includes(m.toLowerCase())),N=w=>{if(r.includes(w))o(r.filter(h=>h!==w));else{const h=[...r,w];h.length===f.length?(l(!0),o([])):o(h)}};v="flex flex-col h-full",e[12]!==u?(g=s.jsx("div",{className:"border-b border-border",children:s.jsx(Ke,{value:u,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=u,e[13]=g):g=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=X("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let R;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(R=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=R):R=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=L):L=e[21];let M;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(M=s.jsx("div",{onClick:Hs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=M):M=e[26],e[27]!==M||e[28]!==A||e[29]!==R?(j=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:A,onClick:R,children:[L,M]})}),e[27]=M,e[28]=A,e[29]=R,e[30]=j):j=e[30],C="flex-1 overflow-auto",d=Object.entries(T).map(w=>{const[h,S]=w,E=O.filter(p=>S.some(_=>_.name===p.value));return E.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:h}),s.jsx("div",{className:"space-y-1",children:E.map(p=>s.jsxs("div",{className:X("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const _=f.map(Qs);o(_.filter(k=>k!==p.value))}else N(p.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:p.label})}),s.jsx("div",{onClick:qs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Ks);o(_.filter(k=>k!==p.value))}else N(p.value)}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Fs);o(_.filter(k=>k!==p.value))}else N(p.value)}})})]},p.value))})]},h)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=C,e[8]=d,e[9]=v,e[10]=g,e[11]=j}else C=e[7],d=e[8],v=e[9],g=e[10],j=e[11];let b;e[31]!==C||e[32]!==d?(b=s.jsx("div",{className:C,children:d}),e[31]=C,e[32]=d,e[33]=b):b=e[33];let I;return e[34]!==v||e[35]!==g||e[36]!==j||e[37]!==b?(I=s.jsxs("div",{className:v,children:[g,j,b]}),e[34]=v,e[35]=g,e[36]=j,e[37]=b,e[38]=I):I=e[38],I}function Fs(t){return t.value}function Ks(t){return t.value}function qs(t){return t.stopPropagation()}function Qs(t){return t.value}function Hs(t){return t.stopPropagation()}function Zs(t){const e=le.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[c,i]=D.useState(""),u=D.useDeferredValue(c);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,C]=D.useState(x),{data:d}=bt();let v,g,j,b,I,T,f,O,N,P,A;if(e[1]!==d?.data?.members||e[2]!==u||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==c||e[8]!==l){const _=d?.data?.members??[];let k;e[20]!==u?(k=U=>{const a=u.toLowerCase();return U.user?.name?.toLowerCase().includes(a)||U.user?.email?.toLowerCase().includes(a)},e[20]=u,e[21]=k):k=e[21];const B=_.filter(k),q=Ys;let Q;e[22]!==l?(Q=U=>l.includes(U),e[22]=l,e[23]=Q):Q=e[23];const H=Q;let Z;e[24]!==m?(Z=U=>{m.includes(U)?C(m.filter(a=>a!==U)):C([...m,U])},e[24]=m,e[25]=Z):Z=e[25];const se=Z;let J;e[26]!==o||e[27]!==r||e[28]!==m?(J=()=>{o(m),C([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=J):J=e[29],j=J,g=ze,P=n,A=r,v=ke,O="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Ue,{className:"px-6 pt-6",children:[s.jsx(Ve,{children:"Add Members to Role"}),s.jsx(Be,{children:"Select members to add to this role."})]}),e[30]=N):N=e[30],T="flex flex-col h-80",e[31]!==c?(f=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=c,e[32]=f):f=e[32],b="flex-1 overflow-auto",I=B.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:c?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:B.map(U=>{const a=q(U),y=H(U.id),F=m.includes(U.id);return s.jsxs("label",{className:X("flex items-center gap-3 p-2 rounded-lg",!a||y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(De,{checked:F||y,onCheckedChange:()=>{a&&!y&&se(U.id)},disabled:!a||y}),s.jsx(Ae,{url:U.user?.image??void 0,fallback:Ht(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!a&&s.jsx(Ee,{variant:"secondary",className:"shrink-0",children:"Owner"}),y&&a&&s.jsx(Ee,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=d?.data?.members,e[2]=u,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=c,e[8]=l,e[9]=v,e[10]=g,e[11]=j,e[12]=b,e[13]=I,e[14]=T,e[15]=f,e[16]=O,e[17]=N,e[18]=P,e[19]=A}else v=e[9],g=e[10],j=e[11],b=e[12],I=e[13],T=e[14],f=e[15],O=e[16],N=e[17],P=e[18],A=e[19];let R;e[33]!==b||e[34]!==I?(R=s.jsx("div",{className:b,children:I}),e[33]=b,e[34]=I,e[35]=R):R=e[35];let L;e[36]!==R||e[37]!==T||e[38]!==f?(L=s.jsxs("div",{className:T,children:[f,R]}),e[36]=R,e[37]=T,e[38]=f,e[39]=L):L=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx($e,{children:"Cancel"}),e[40]=M):M=e[40];const w=m.length===0,h=m.length>0&&`(${m.length})`;let S;e[41]!==j||e[42]!==w||e[43]!==h?(S=s.jsxs(Ge,{className:"px-6 pb-6",children:[M,s.jsxs(Fe,{onClick:j,disabled:w,children:["Add ",h]})]}),e[41]=j,e[42]=w,e[43]=h,e[44]=S):S=e[44];let E;e[45]!==v||e[46]!==L||e[47]!==S||e[48]!==O||e[49]!==N?(E=s.jsxs(v,{className:O,children:[N,L,S]}),e[45]=v,e[46]=L,e[47]=S,e[48]=O,e[49]=N,e[50]=E):E=e[50];let p;return e[51]!==g||e[52]!==E||e[53]!==P||e[54]!==A?(p=s.jsx(g,{open:P,onOpenChange:A,children:E}),e[51]=g,e[52]=E,e[53]=P,e[54]=A,e[55]=p):p=e[55],p}function Ys(t){return t.role!=="owner"}function Xs(t){const e=le.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[c,i]=D.useState(""),u=D.useDeferredValue(c),[x,m]=D.useState(!1),{data:C}=bt();let d,v,g,j,b;if(e[0]!==C?.data?.members||e[1]!==u||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==c){const O=C?.data?.members??[];let N;e[11]!==n?(N=E=>n.includes(E.id),e[11]=n,e[12]=N):N=e[12];const P=O.filter(N);let A;e[13]!==u?(A=E=>{const p=u.toLowerCase();return E.user?.name?.toLowerCase().includes(p)||E.user?.email?.toLowerCase().includes(p)},e[13]=u,e[14]=A):A=e[14];const R=P.filter(A);let L;e[15]!==n||e[16]!==r?(L=E=>{r(n.filter(p=>p!==E))},e[15]=n,e[16]=r,e[17]=L):L=e[17];const M=L;let w;e[18]!==n||e[19]!==r?(w=E=>{r([...n,...E])},e[18]=n,e[19]=r,e[20]=w):w=e[20],d=w,j="flex flex-col h-full";let h;e[21]!==c?(h=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=c,e[22]=h):h=e[22];let S;e[23]!==o?(S=o?s.jsx("div",{className:"pr-4",children:s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(nt,{size:16}),"Add Member"]})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(nt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==h||e[26]!==S?(b=s.jsxs("div",{className:"flex items-center border-b border-border",children:[h,S]}),e[25]=h,e[26]=S,e[27]=b):b=e[27],v="flex-1 overflow-auto",g=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(E=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Ae,{url:E.user?.image??void 0,fallback:Ht(E.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(St,{size:16})})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(E.id),children:s.jsx(St,{size:16})})]},E.id))}),e[0]=C?.data?.members,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=c,e[6]=d,e[7]=v,e[8]=g,e[9]=j,e[10]=b}else d=e[6],v=e[7],g=e[8],j=e[9],b=e[10];let I;e[28]!==v||e[29]!==g?(I=s.jsx("div",{className:v,children:g}),e[28]=v,e[29]=g,e[30]=I):I=e[30];let T;e[31]!==x||e[32]!==d||e[33]!==n?(T=s.jsx(Zs,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:d}),e[31]=x,e[32]=d,e[33]=n,e[34]=T):T=e[34];let f;return e[35]!==j||e[36]!==b||e[37]!==I||e[38]!==T?(f=s.jsxs("div",{className:j,children:[b,I,T]}),e[35]=j,e[36]=b,e[37]=I,e[38]=T,e[39]=f):f=e[39],f}function Js(t){const e=le.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==t?(r=s.jsx(D.Suspense,{fallback:n,children:s.jsx(Xs,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const Ws={owner:[],admin:[],user:[]};function We(t,e){const n=t==="owner"||t==="admin",r=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:Ws[t],toolSet:{},memberIds:r.map(l=>l.id)}}function en({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:c}=Ce(),i=we(),u=kt()??[],{customRoles:x,refetch:m}=Nt(),{data:C}=it({queryKey:ce.members(c),queryFn:()=>ae.organization.listMembers()}),d=Dt({resolver:Wt(Vs),defaultValues:Je()}),v=d.formState.isValid,g=d.formState.isDirty,[j,b]=D.useState(null),[I,T]=D.useState(null),f=!d.watch("role.id")&&!d.watch("role.slug")&&!I,[O,N]=D.useState(null),[P,A]=D.useState(!1),[R,L]=D.useState(null),M=a=>{const y=a.permission||{},F=y.self||[],me=F.includes("*"),te=me?[]:F.filter(V=>V!=="*"),W={};for(const[V,G]of Object.entries(y))if(V!=="self")if(V==="*")for(const Y of u)G.includes("*")?W[Y.id]=Y.tools?.map(re=>re.name)??[]:W[Y.id]=G;else{const Y=u.find(re=>re.id===V);Y&&(G.includes("*")?W[V]=Y.tools?.map(re=>re.name)??[]:W[V]=G)}const de=(C?.data?.members??[]).filter(V=>V.role===a.role).map(V=>V.id);return{role:{id:a.id,slug:a.role,label:a.label},allowAllStaticPermissions:me,staticPermissions:te,toolSet:W,memberIds:de}},w=a=>{const y=M(a);d.reset(y),b(a.id??null),T(null)},h=()=>{d.reset(Je()),b(null),T(null),o("mcp")},S=a=>{g&&v?(L(()=>()=>w(a)),A(!0)):w(a)},E=async()=>{g&&v&&await Z(),h()},p=a=>{if(g&&v)L(()=>()=>{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}),A(!0);else{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}},_=a=>{if(!a&&d.formState.isDirty&&v){L(()=>()=>{r(!1),d.reset(Je()),T(null)}),A(!0);return}if(r(a),!a)d.reset(Je()),T(null),b(null);else{const y=x[0];if(y)w(y);else{const F=We("user",C?.data?.members??[]);d.reset(F),T("user"),b(null),o("org")}}},k=()=>{A(!1),R&&(R(),L(null))},B=a=>{const y={};a.allowAllStaticPermissions?y.self=["*"]:a.staticPermissions.length>0&&(y.self=a.staticPermissions);for(const[F,me]of Object.entries(a.toolSet))if(me.length>0){const W=u.find(ee=>ee.id===F)?.tools?.map(ee=>ee.name)??[];W.length>0&&W.every(ee=>me.includes(ee))?y[F]=["*"]:y[F]=me}return y},q=Te({mutationFn:async a=>{const y=B(a),F=a.role.slug||a.role.label.toLowerCase().replace(/\s+/g,"-");if(a.role.slug&&!a.role.id){const W=(C?.data?.members??[]).filter(V=>V.role===a.role.slug).map(V=>V.id),ee=a.memberIds.filter(V=>!W.includes(V)),de=W.filter(V=>!a.memberIds.includes(V));for(const V of ee){const G=await ae.organization.updateMemberRole({memberId:V,role:[a.role.slug]});if(G?.error)throw new Error(G.error.message)}for(const V of de){const G=await ae.organization.updateMemberRole({memberId:V,role:["user"]});if(G?.error)throw new Error(G.error.message)}return a}else if(a.role.id){const te=await ae.organization.updateRole({roleId:a.role.id,data:{permission:y}});if(te?.error)throw new Error(te.error.message);const ee=(C?.data?.members??[]).filter(G=>G.role===a.role.slug).map(G=>G.id),de=a.memberIds.filter(G=>!ee.includes(G)),V=ee.filter(G=>!a.memberIds.includes(G));for(const G of de){const Y=await ae.organization.updateMemberRole({memberId:G,role:[a.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const G of V){const Y=await ae.organization.updateMemberRole({memberId:G,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return a}else{const te=await ae.organization.createRole({role:F,permission:y});if(te?.error)throw new Error(te.error.message);for(const W of a.memberIds){const ee=await ae.organization.updateMemberRole({memberId:W,role:[F]});if(ee?.error)throw new Error(ee.error.message)}return{...a,role:{...a.role,id:te.data?.roleData?.id,slug:F}}}},onSuccess:(a,y)=>{i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)});const F=!y.role.id&&!y.role.slug,me=y.role.slug&&!y.role.id;ne.success(me?"Members updated successfully!":F?"Role created successfully!":"Role updated successfully!"),m(),d.reset(a),a.role.id&&b(a.role.id),e?.()},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to save role")}}),Q=Te({mutationFn:async a=>{const y=await ae.organization.deleteRole({roleId:a});if(y?.error)throw new Error(y.error.message);return y?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)}),ne.success("Role deleted successfully!"),m(),O?.id===j){const a=x.filter(y=>y.id!==O?.id);if(a[0])w(a[0]);else{const y=We("user",C?.data?.members??[]);d.reset(y),T("user"),b(null),o("org")}}},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to delete role")}}),H=q.isPending||Q.isPending,Z=async()=>{const a=d.getValues();if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}await q.mutateAsync(a)},se=d.handleSubmit(a=>{if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}q.mutate(a)}),J=a=>{a.id&&N({id:a.id,label:a.label})},U=()=>{O?.id&&Q.mutate(O.id),N(null)};return s.jsxs(Ut,{open:n,onOpenChange:_,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsx(Bt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[Bs.map(a=>{const y=I===a.role;return s.jsxs("div",{className:X("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>p(a.role),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",a.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsx(Cs,{size:14,className:"text-muted-foreground shrink-0"})]},a.role)}),x.map(a=>{const y=j===a.id;return s.jsxs("div",{className:X("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(a),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",Gs(a.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:X("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",y&&"opacity-100 pointer-events-auto"),onClick:F=>F.stopPropagation(),children:s.jsx(bs,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(tt,{className:"text-destructive",onClick:F=>{F.stopPropagation(),J(a)},children:[s.jsx(Gt,{size:16}),"Delete"]})})]})]},a.id)}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(js,{...d.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(Ee,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:E,disabled:H||g,className:"w-full h-10",children:[s.jsx(nt,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!I&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("org"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!I&&s.jsx(Ms,{toolSet:d.watch("toolSet"),onToolSetChange:a=>d.setValue("toolSet",a,{shouldDirty:!0})}),l==="org"&&s.jsx($s,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:a=>d.setValue("allowAllStaticPermissions",a,{shouldDirty:!0}),onPermissionsChange:a=>d.setValue("staticPermissions",a,{shouldDirty:!0}),readOnly:!!I}),l==="members"&&s.jsx(Js,{memberIds:d.watch("memberIds"),onMemberIdsChange:a=>d.setValue("memberIds",a,{shouldDirty:!0}),readOnly:I==="owner"})]}),(!I||I!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>_(!1),disabled:H,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:se,disabled:H||!v||!d.formState.isDirty,className:"h-10",children:q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),s.jsx(ze,{open:O!==null,onOpenChange:a=>!a&&N(null),children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Delete Role"}),s.jsxs(Be,{children:['Are you sure you want to delete the "',O?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Ge,{children:[s.jsx($e,{children:"Cancel"}),s.jsx(Fe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(ze,{open:P,onOpenChange:A,children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Discard Changes"}),s.jsx(Be,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Ge,{children:[s.jsx($e,{onClick:()=>L(null),children:"Keep Editing"}),s.jsx(Fe,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const tn=ve().email("Invalid email address");function sn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function nn({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=Ce(),l=we(),{data:o}=ae.useSession(),c=o?.user?.email,{roles:i,isLoading:u}=Nt(),x=i.filter(T=>T.role!=="owner"),m=Dt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),C=m.watch("emailsText"),d=m.watch("role"),g=sn(C).filter(T=>{const f=tn.safeParse(T).success,O=!c||T!==c.toLowerCase();return f&&O}),j=Te({mutationFn:async({emails:T,role:f})=>{if(!f)throw new Error("Please select a role");const O=await Promise.allSettled(T.map(async P=>{const A=await ae.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),N=O.filter(P=>P.status==="rejected");if(N.length>0)throw new Error(`Failed to invite ${N.length} member${N.length>1?"s":""}`);return O},onSuccess:(T,{emails:f})=>{l.invalidateQueries({queryKey:ce.members(r)}),l.invalidateQueries({queryKey:ce.invitations(r)}),ne.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:T=>{ne.error(T instanceof Error?T.message:"Failed to invite members")}}),b=T=>{if(g.length===0){ne.error("Please enter at least one valid email address");return}if(!T.role){ne.error("Please select a role");return}j.mutate({emails:g,role:T.role})},I=g.length>0&&!!d;return s.jsxs(Ut,{open:e,onOpenChange:n,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsxs(Bt,{className:"sm:max-w-lg",children:[s.jsx(ms,{children:s.jsx(us,{children:"Invite members"})}),s.jsx(vs,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(b),className:"space-y-4",children:[s.jsx(It,{control:m.control,name:"emailsText",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(Ns,{children:"Email addresses"}),s.jsx(At,{children:s.jsx(Es,{...T,disabled:j.isPending,placeholder:`Enter email addresses separated by commas or new lines
1
+ import{r as D,c as le,j as s,p as Yt,u as Ce,g as ae,K as ce,o as Et,ad as at,s as ve,ba as Xt,bg as Jt,F as we,k as Dt,h as Wt,t as ne,E as es}from"./index-DZKwM-s7.js";import{C as ts,a as ss}from"./collection-table-wrapper-DmMQEj1Y.js";import{C as Ke}from"./collection-search-Cm7834fO.js";import{P as Ne}from"./index-QlAcVvwl.js";import{B as ns,a as rs,b as is,e as os}from"./breadcrumb-Cp0sD1P8.js";import{I as zt,c as _e,b as Re,T as Pe,a as Me,E as ct}from"./empty-state-DYOBL1E0.js";import{C as De}from"./checkbox-CaN6ZzyM.js";import{c as X,B as ie}from"./button-CvZ7ap4z.js";import{h as kt}from"./use-connection-XCZq2oM3.js";import{u as bt,C as dt,a as mt,b as yt,c as ls,d as as,e as cs,f as ds}from"./command-B9mkhjGp.js";import{u as it}from"./useQuery-CPf79nZ3.js";import{u as Te}from"./useMutation-BvIaEUwy.js";import{f as ze,a as ke,b as Ue,c as Ve,d as Be,e as Ge,A as $e,g as Fe,h as Ae}from"./alert-dialog-Cb25OanG.js";import{B as Ee}from"./badge-Dq2_S74H.js";import{D as Ut,f as Vt,a as Bt,b as ms,c as us,e as fs}from"./dialog-CRL62yun.js";import{D as Ct,a as jt,b as Tt,c as tt,d as hs,e as gs,f as xs,g as ps}from"./dropdown-menu-CcLjoPOd.js";import{i as bs}from"./DotsHorizontal-DklTtUVu.js";import{i as st}from"./Loading01-D-xfXVAb.js";import{i as Cs}from"./Lock01-DZjbvWbD.js";import{s as nt}from"./Plus-Bzxd7t2s.js";import{s as Gt}from"./Trash01-CzXeR5aG.js";import{i as St}from"./X-DA_xWnsV.js";import{I as js}from"./input-CCH8wBeN.js";import{S as Xe}from"./switch-GBP-Rfzk.js";import{E as Ts}from"./error-boundary-4OVFwt4t.js";import{a as vs,F as It,b as Ot,c as Ns,d as At,f as wt}from"./form-BMkAgBlF.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-B_vbJmw6.js";import{T as Es}from"./textarea-Ct8RODCq.js";import{a as qe,u as Qe}from"./constants-DxgwQ0uV.js";import{C as Lt}from"./card-B7JF-Bqk.js";import{i as $t}from"./DotsVertical-Cb3BjT8W.js";import{i as ys}from"./index-D-HDjXTE.js";import{s as Ft}from"./XClose-BnWgQmD9.js";import{a as Ss,b as Is,P as Os}from"./popover-DceEFrFl.js";import{t as As}from"./ChevronDown-B01wwgGg.js";import"./ArrowUp-dvehulHz.js";import"./Check-BYQw8z-Y.js";import"./Grid01-BcwhAHU4.js";import"./List-JHCqXqb-.js";import"./view-mode-toggle-DDn0emqa.js";import"./table-DnQsZAfD.js";import"./SearchMd-D3LhC38x.js";import"./ChevronRight-BgsyooQy.js";const Kt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));Kt.displayName="ArrowLeft";const vt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));vt.displayName="Shield01";const qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));qt.displayName="SwitchHorizontal01";const Qt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"COLLECTION_VIRTUAL_TOOLS_CREATE",description:"Create virtual tools on Virtual MCPs",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_LIST",description:"List virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_GET",description:"View virtual tool details",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_UPDATE",description:"Update virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_DELETE",description:"Delete virtual tools",category:"Virtual Tools",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"}],ws={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",COLLECTION_VIRTUAL_TOOLS_CREATE:"Create virtual tools",COLLECTION_VIRTUAL_TOOLS_LIST:"List virtual tools",COLLECTION_VIRTUAL_TOOLS_GET:"View virtual tool details",COLLECTION_VIRTUAL_TOOLS_UPDATE:"Update virtual tools",COLLECTION_VIRTUAL_TOOLS_DELETE:"Delete virtual tools",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags"};function Ls(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[]};for(const e of Qt)t[e.category]?.push(e);return t}function _s(){return Qt.map(t=>({value:t.name,label:ws[t.name],dangerous:t.dangerous}))}const Rs=D.memo(function(e){const n=le.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:c,totalToolsCount:i,onSelect:u,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let C;n[0]!==m?(C=X("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=C):C=n[1];let d;n[2]!==r.icon||n[3]!==r.title?(d=s.jsx(zt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=d):d=n[4];let v;n[5]!==r.title?(v=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=v):v=n[6];let g;n[7]!==u||n[8]!==d||n[9]!==v?(g=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:u,children:[d,v]}),n[7]=u,n[8]=d,n[9]=v,n[10]=g):g=n[10];let j;n[11]!==c||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(j=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[c,"/",i]}),s.jsx(De,{checked:o,onCheckedChange:x,onClick:Ds})]}),n[11]=c,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=j):j=n[16];let b;return n[17]!==C||n[18]!==g||n[19]!==j?(b=s.jsxs("div",{className:C,children:[g,j]}),n[17]=C,n[18]=g,n[19]=j,n[20]=b):b=n[20],b}),Ps=D.memo(function(e){const n=le.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:c}=e,i=`tool-${r}-${l.name}`,u=o?"text-foreground":"text-muted-foreground";let x;n[0]!==u?(x=X("text-sm font-medium",u),n[0]=u,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let C;n[5]!==l.description?(C=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=C):C=n[6];let d;n[7]!==m||n[8]!==C?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,C]}),n[7]=m,n[8]=C,n[9]=d):d=n[9];const v=`tool-${r}-${l.name}`;let g;n[10]!==o||n[11]!==c||n[12]!==v?(g=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(De,{id:v,checked:o,onCheckedChange:c,onClick:zs})}),n[10]=o,n[11]=c,n[12]=v,n[13]=g):g=n[13];let j;return n[14]!==i||n[15]!==d||n[16]!==g?(j=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[d,g]}),n[14]=i,n[15]=d,n[16]=g,n[17]=j):j=n[17],j});function Ms({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[c,i]=D.useState("all"),[u,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),C=kt({searchTerm:o.trim()||void 0}),d=n?C.filter(h=>h.connection_type!=="VIRTUAL"?!0:Yt(h.connection_url)!==n):C,v=m.current,g=[...v.values()].map(h=>d.find(S=>S.id===h)).filter(h=>h!==void 0),j=d.filter(h=>!v.has(h.id)),b=[...g,...j],I=h=>{const S=t[h];return S!==void 0&&S.length>0},T=b.filter(h=>{if(c==="all")return!0;const S=I(h.id);return c==="selected"?S:c==="unselected"?!S:!0}),[f,O]=D.useState(b[0]?.id??null),N=f?b.find(h=>h.id===f)??null:null,P=N?.tools??[],A=(h,S)=>t[h]?.includes(S)??!1,R=(h,S)=>{const E=t[h]??[],p=E.includes(S),_={...t};if(p){const k=E.filter(B=>B!==S);k.length===0?delete _[h]:_[h]=k}else _[h]=[...E,S];e(_)},L=h=>{const S=b.find(B=>B.id===h);if(!S?.tools)return;const E=t[h]??[],p=S.tools.map(B=>B.name),_=E.length>0&&p.every(B=>E.includes(B)),k={...t};_?delete k[h]:(k[h]=p,O(h)),e(k)},M=h=>{O(h),x(!0)},w=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:X("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[s.jsx(Ke,{value:r,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:T.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:T.map(h=>{const S=h.tools?.length??0,E=t[h.id]?.length??0;return s.jsx(Rs,{connection:h,isSelected:f===h.id,hasToolsEnabled:I(h.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>M(h.id),onToggle:()=>L(h.id)},h.id)})})})]}),s.jsx("div",{className:X("flex-1 flex-col",u?"flex":"hidden md:flex"),children:N?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:w,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Kt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(zt,{icon:N.icon,name:N.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:N.title}),N.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:N.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(h=>s.jsx(Ps,{connectionId:N.id,tool:h,isSelected:A(N.id,h.name),onToggle:()=>R(N.id,h.name)},h.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Ds(t){return t.stopPropagation()}function zs(t){return t.stopPropagation()}const _t=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function ks(t){return t.replace(/-/g," ")}function Us(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let c=!1;for(const[i,u]of Object.entries(t)){if(i==="self"){u.includes("*")?n=!0:e.push(...u);continue}if(i==="*"){if(l=!0,u.includes("*"))c=!0;else for(const x of u)o.add(x);continue}if(r.push(i),u.includes("*"))c=!0;else for(const x of u)o.add(x)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:c}}function Nt(){const{locator:t}=Ce(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ce.organizationRoles(t),queryFn:async()=>{try{const i=await ae.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),o=_t.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const u=i.role;if(!u||_t.some(j=>j.value===u))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:C,allowsAllConnections:d,toolNames:v,allowsAllTools:g}=Us(i.permission);o.push({id:i.id,role:u,label:ks(u),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:d?-1:C.length,allowsAllConnections:d,toolCount:g?-1:v.length,allowsAllTools:g})}const c=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:c,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Vs=Et({role:Et({id:ve().optional(),slug:ve().optional(),label:ve()}),allowAllStaticPermissions:Jt(),staticPermissions:at(ve()),toolSet:Xt(ve(),at(ve())),memberIds:at(ve())});function Ht(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Bs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ut=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Gs(t){if(!t)return"bg-neutral-400";let e=0;for(let r=0;r<t.length;r++){const l=t.charCodeAt(r);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ut.length;return ut[n]??ut[0]}function Je(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function $s(t){const e=le.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:c}=t,i=c===void 0?!1:c,[u,x]=D.useState(""),m=D.useDeferredValue(u);let C,d,v,g,j;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r){const T=Ls(),f=_s(),O=f.filter(w=>w.label.toLowerCase().includes(m.toLowerCase())),N=w=>{if(r.includes(w))o(r.filter(h=>h!==w));else{const h=[...r,w];h.length===f.length?(l(!0),o([])):o(h)}};v="flex flex-col h-full",e[12]!==u?(g=s.jsx("div",{className:"border-b border-border",children:s.jsx(Ke,{value:u,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=u,e[13]=g):g=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=X("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let R;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(R=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=R):R=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=L):L=e[21];let M;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(M=s.jsx("div",{onClick:Hs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=M):M=e[26],e[27]!==M||e[28]!==A||e[29]!==R?(j=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:A,onClick:R,children:[L,M]})}),e[27]=M,e[28]=A,e[29]=R,e[30]=j):j=e[30],C="flex-1 overflow-auto",d=Object.entries(T).map(w=>{const[h,S]=w,E=O.filter(p=>S.some(_=>_.name===p.value));return E.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:h}),s.jsx("div",{className:"space-y-1",children:E.map(p=>s.jsxs("div",{className:X("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const _=f.map(Qs);o(_.filter(k=>k!==p.value))}else N(p.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:p.label})}),s.jsx("div",{onClick:qs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Ks);o(_.filter(k=>k!==p.value))}else N(p.value)}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Fs);o(_.filter(k=>k!==p.value))}else N(p.value)}})})]},p.value))})]},h)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=C,e[8]=d,e[9]=v,e[10]=g,e[11]=j}else C=e[7],d=e[8],v=e[9],g=e[10],j=e[11];let b;e[31]!==C||e[32]!==d?(b=s.jsx("div",{className:C,children:d}),e[31]=C,e[32]=d,e[33]=b):b=e[33];let I;return e[34]!==v||e[35]!==g||e[36]!==j||e[37]!==b?(I=s.jsxs("div",{className:v,children:[g,j,b]}),e[34]=v,e[35]=g,e[36]=j,e[37]=b,e[38]=I):I=e[38],I}function Fs(t){return t.value}function Ks(t){return t.value}function qs(t){return t.stopPropagation()}function Qs(t){return t.value}function Hs(t){return t.stopPropagation()}function Zs(t){const e=le.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[c,i]=D.useState(""),u=D.useDeferredValue(c);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,C]=D.useState(x),{data:d}=bt();let v,g,j,b,I,T,f,O,N,P,A;if(e[1]!==d?.data?.members||e[2]!==u||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==c||e[8]!==l){const _=d?.data?.members??[];let k;e[20]!==u?(k=U=>{const a=u.toLowerCase();return U.user?.name?.toLowerCase().includes(a)||U.user?.email?.toLowerCase().includes(a)},e[20]=u,e[21]=k):k=e[21];const B=_.filter(k),q=Ys;let Q;e[22]!==l?(Q=U=>l.includes(U),e[22]=l,e[23]=Q):Q=e[23];const H=Q;let Z;e[24]!==m?(Z=U=>{m.includes(U)?C(m.filter(a=>a!==U)):C([...m,U])},e[24]=m,e[25]=Z):Z=e[25];const se=Z;let J;e[26]!==o||e[27]!==r||e[28]!==m?(J=()=>{o(m),C([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=J):J=e[29],j=J,g=ze,P=n,A=r,v=ke,O="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Ue,{className:"px-6 pt-6",children:[s.jsx(Ve,{children:"Add Members to Role"}),s.jsx(Be,{children:"Select members to add to this role."})]}),e[30]=N):N=e[30],T="flex flex-col h-80",e[31]!==c?(f=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=c,e[32]=f):f=e[32],b="flex-1 overflow-auto",I=B.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:c?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:B.map(U=>{const a=q(U),y=H(U.id),F=m.includes(U.id);return s.jsxs("label",{className:X("flex items-center gap-3 p-2 rounded-lg",!a||y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(De,{checked:F||y,onCheckedChange:()=>{a&&!y&&se(U.id)},disabled:!a||y}),s.jsx(Ae,{url:U.user?.image??void 0,fallback:Ht(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!a&&s.jsx(Ee,{variant:"secondary",className:"shrink-0",children:"Owner"}),y&&a&&s.jsx(Ee,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=d?.data?.members,e[2]=u,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=c,e[8]=l,e[9]=v,e[10]=g,e[11]=j,e[12]=b,e[13]=I,e[14]=T,e[15]=f,e[16]=O,e[17]=N,e[18]=P,e[19]=A}else v=e[9],g=e[10],j=e[11],b=e[12],I=e[13],T=e[14],f=e[15],O=e[16],N=e[17],P=e[18],A=e[19];let R;e[33]!==b||e[34]!==I?(R=s.jsx("div",{className:b,children:I}),e[33]=b,e[34]=I,e[35]=R):R=e[35];let L;e[36]!==R||e[37]!==T||e[38]!==f?(L=s.jsxs("div",{className:T,children:[f,R]}),e[36]=R,e[37]=T,e[38]=f,e[39]=L):L=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx($e,{children:"Cancel"}),e[40]=M):M=e[40];const w=m.length===0,h=m.length>0&&`(${m.length})`;let S;e[41]!==j||e[42]!==w||e[43]!==h?(S=s.jsxs(Ge,{className:"px-6 pb-6",children:[M,s.jsxs(Fe,{onClick:j,disabled:w,children:["Add ",h]})]}),e[41]=j,e[42]=w,e[43]=h,e[44]=S):S=e[44];let E;e[45]!==v||e[46]!==L||e[47]!==S||e[48]!==O||e[49]!==N?(E=s.jsxs(v,{className:O,children:[N,L,S]}),e[45]=v,e[46]=L,e[47]=S,e[48]=O,e[49]=N,e[50]=E):E=e[50];let p;return e[51]!==g||e[52]!==E||e[53]!==P||e[54]!==A?(p=s.jsx(g,{open:P,onOpenChange:A,children:E}),e[51]=g,e[52]=E,e[53]=P,e[54]=A,e[55]=p):p=e[55],p}function Ys(t){return t.role!=="owner"}function Xs(t){const e=le.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[c,i]=D.useState(""),u=D.useDeferredValue(c),[x,m]=D.useState(!1),{data:C}=bt();let d,v,g,j,b;if(e[0]!==C?.data?.members||e[1]!==u||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==c){const O=C?.data?.members??[];let N;e[11]!==n?(N=E=>n.includes(E.id),e[11]=n,e[12]=N):N=e[12];const P=O.filter(N);let A;e[13]!==u?(A=E=>{const p=u.toLowerCase();return E.user?.name?.toLowerCase().includes(p)||E.user?.email?.toLowerCase().includes(p)},e[13]=u,e[14]=A):A=e[14];const R=P.filter(A);let L;e[15]!==n||e[16]!==r?(L=E=>{r(n.filter(p=>p!==E))},e[15]=n,e[16]=r,e[17]=L):L=e[17];const M=L;let w;e[18]!==n||e[19]!==r?(w=E=>{r([...n,...E])},e[18]=n,e[19]=r,e[20]=w):w=e[20],d=w,j="flex flex-col h-full";let h;e[21]!==c?(h=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=c,e[22]=h):h=e[22];let S;e[23]!==o?(S=o?s.jsx("div",{className:"pr-4",children:s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(nt,{size:16}),"Add Member"]})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(nt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==h||e[26]!==S?(b=s.jsxs("div",{className:"flex items-center border-b border-border",children:[h,S]}),e[25]=h,e[26]=S,e[27]=b):b=e[27],v="flex-1 overflow-auto",g=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(E=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Ae,{url:E.user?.image??void 0,fallback:Ht(E.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(St,{size:16})})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(E.id),children:s.jsx(St,{size:16})})]},E.id))}),e[0]=C?.data?.members,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=c,e[6]=d,e[7]=v,e[8]=g,e[9]=j,e[10]=b}else d=e[6],v=e[7],g=e[8],j=e[9],b=e[10];let I;e[28]!==v||e[29]!==g?(I=s.jsx("div",{className:v,children:g}),e[28]=v,e[29]=g,e[30]=I):I=e[30];let T;e[31]!==x||e[32]!==d||e[33]!==n?(T=s.jsx(Zs,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:d}),e[31]=x,e[32]=d,e[33]=n,e[34]=T):T=e[34];let f;return e[35]!==j||e[36]!==b||e[37]!==I||e[38]!==T?(f=s.jsxs("div",{className:j,children:[b,I,T]}),e[35]=j,e[36]=b,e[37]=I,e[38]=T,e[39]=f):f=e[39],f}function Js(t){const e=le.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==t?(r=s.jsx(D.Suspense,{fallback:n,children:s.jsx(Xs,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const Ws={owner:[],admin:[],user:[]};function We(t,e){const n=t==="owner"||t==="admin",r=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:Ws[t],toolSet:{},memberIds:r.map(l=>l.id)}}function en({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:c}=Ce(),i=we(),u=kt()??[],{customRoles:x,refetch:m}=Nt(),{data:C}=it({queryKey:ce.members(c),queryFn:()=>ae.organization.listMembers()}),d=Dt({resolver:Wt(Vs),defaultValues:Je()}),v=d.formState.isValid,g=d.formState.isDirty,[j,b]=D.useState(null),[I,T]=D.useState(null),f=!d.watch("role.id")&&!d.watch("role.slug")&&!I,[O,N]=D.useState(null),[P,A]=D.useState(!1),[R,L]=D.useState(null),M=a=>{const y=a.permission||{},F=y.self||[],me=F.includes("*"),te=me?[]:F.filter(V=>V!=="*"),W={};for(const[V,G]of Object.entries(y))if(V!=="self")if(V==="*")for(const Y of u)G.includes("*")?W[Y.id]=Y.tools?.map(re=>re.name)??[]:W[Y.id]=G;else{const Y=u.find(re=>re.id===V);Y&&(G.includes("*")?W[V]=Y.tools?.map(re=>re.name)??[]:W[V]=G)}const de=(C?.data?.members??[]).filter(V=>V.role===a.role).map(V=>V.id);return{role:{id:a.id,slug:a.role,label:a.label},allowAllStaticPermissions:me,staticPermissions:te,toolSet:W,memberIds:de}},w=a=>{const y=M(a);d.reset(y),b(a.id??null),T(null)},h=()=>{d.reset(Je()),b(null),T(null),o("mcp")},S=a=>{g&&v?(L(()=>()=>w(a)),A(!0)):w(a)},E=async()=>{g&&v&&await Z(),h()},p=a=>{if(g&&v)L(()=>()=>{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}),A(!0);else{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}},_=a=>{if(!a&&d.formState.isDirty&&v){L(()=>()=>{r(!1),d.reset(Je()),T(null)}),A(!0);return}if(r(a),!a)d.reset(Je()),T(null),b(null);else{const y=x[0];if(y)w(y);else{const F=We("user",C?.data?.members??[]);d.reset(F),T("user"),b(null),o("org")}}},k=()=>{A(!1),R&&(R(),L(null))},B=a=>{const y={};a.allowAllStaticPermissions?y.self=["*"]:a.staticPermissions.length>0&&(y.self=a.staticPermissions);for(const[F,me]of Object.entries(a.toolSet))if(me.length>0){const W=u.find(ee=>ee.id===F)?.tools?.map(ee=>ee.name)??[];W.length>0&&W.every(ee=>me.includes(ee))?y[F]=["*"]:y[F]=me}return y},q=Te({mutationFn:async a=>{const y=B(a),F=a.role.slug||a.role.label.toLowerCase().replace(/\s+/g,"-");if(a.role.slug&&!a.role.id){const W=(C?.data?.members??[]).filter(V=>V.role===a.role.slug).map(V=>V.id),ee=a.memberIds.filter(V=>!W.includes(V)),de=W.filter(V=>!a.memberIds.includes(V));for(const V of ee){const G=await ae.organization.updateMemberRole({memberId:V,role:[a.role.slug]});if(G?.error)throw new Error(G.error.message)}for(const V of de){const G=await ae.organization.updateMemberRole({memberId:V,role:["user"]});if(G?.error)throw new Error(G.error.message)}return a}else if(a.role.id){const te=await ae.organization.updateRole({roleId:a.role.id,data:{permission:y}});if(te?.error)throw new Error(te.error.message);const ee=(C?.data?.members??[]).filter(G=>G.role===a.role.slug).map(G=>G.id),de=a.memberIds.filter(G=>!ee.includes(G)),V=ee.filter(G=>!a.memberIds.includes(G));for(const G of de){const Y=await ae.organization.updateMemberRole({memberId:G,role:[a.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const G of V){const Y=await ae.organization.updateMemberRole({memberId:G,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return a}else{const te=await ae.organization.createRole({role:F,permission:y});if(te?.error)throw new Error(te.error.message);for(const W of a.memberIds){const ee=await ae.organization.updateMemberRole({memberId:W,role:[F]});if(ee?.error)throw new Error(ee.error.message)}return{...a,role:{...a.role,id:te.data?.roleData?.id,slug:F}}}},onSuccess:(a,y)=>{i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)});const F=!y.role.id&&!y.role.slug,me=y.role.slug&&!y.role.id;ne.success(me?"Members updated successfully!":F?"Role created successfully!":"Role updated successfully!"),m(),d.reset(a),a.role.id&&b(a.role.id),e?.()},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to save role")}}),Q=Te({mutationFn:async a=>{const y=await ae.organization.deleteRole({roleId:a});if(y?.error)throw new Error(y.error.message);return y?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)}),ne.success("Role deleted successfully!"),m(),O?.id===j){const a=x.filter(y=>y.id!==O?.id);if(a[0])w(a[0]);else{const y=We("user",C?.data?.members??[]);d.reset(y),T("user"),b(null),o("org")}}},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to delete role")}}),H=q.isPending||Q.isPending,Z=async()=>{const a=d.getValues();if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}await q.mutateAsync(a)},se=d.handleSubmit(a=>{if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}q.mutate(a)}),J=a=>{a.id&&N({id:a.id,label:a.label})},U=()=>{O?.id&&Q.mutate(O.id),N(null)};return s.jsxs(Ut,{open:n,onOpenChange:_,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsx(Bt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[Bs.map(a=>{const y=I===a.role;return s.jsxs("div",{className:X("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>p(a.role),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",a.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsx(Cs,{size:14,className:"text-muted-foreground shrink-0"})]},a.role)}),x.map(a=>{const y=j===a.id;return s.jsxs("div",{className:X("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(a),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",Gs(a.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:X("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",y&&"opacity-100 pointer-events-auto"),onClick:F=>F.stopPropagation(),children:s.jsx(bs,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(tt,{className:"text-destructive",onClick:F=>{F.stopPropagation(),J(a)},children:[s.jsx(Gt,{size:16}),"Delete"]})})]})]},a.id)}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(js,{...d.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(Ee,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:E,disabled:H||g,className:"w-full h-10",children:[s.jsx(nt,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!I&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("org"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!I&&s.jsx(Ms,{toolSet:d.watch("toolSet"),onToolSetChange:a=>d.setValue("toolSet",a,{shouldDirty:!0})}),l==="org"&&s.jsx($s,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:a=>d.setValue("allowAllStaticPermissions",a,{shouldDirty:!0}),onPermissionsChange:a=>d.setValue("staticPermissions",a,{shouldDirty:!0}),readOnly:!!I}),l==="members"&&s.jsx(Js,{memberIds:d.watch("memberIds"),onMemberIdsChange:a=>d.setValue("memberIds",a,{shouldDirty:!0}),readOnly:I==="owner"})]}),(!I||I!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>_(!1),disabled:H,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:se,disabled:H||!v||!d.formState.isDirty,className:"h-10",children:q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),s.jsx(ze,{open:O!==null,onOpenChange:a=>!a&&N(null),children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Delete Role"}),s.jsxs(Be,{children:['Are you sure you want to delete the "',O?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Ge,{children:[s.jsx($e,{children:"Cancel"}),s.jsx(Fe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(ze,{open:P,onOpenChange:A,children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Discard Changes"}),s.jsx(Be,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Ge,{children:[s.jsx($e,{onClick:()=>L(null),children:"Keep Editing"}),s.jsx(Fe,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const tn=ve().email("Invalid email address");function sn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function nn({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=Ce(),l=we(),{data:o}=ae.useSession(),c=o?.user?.email,{roles:i,isLoading:u}=Nt(),x=i.filter(T=>T.role!=="owner"),m=Dt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),C=m.watch("emailsText"),d=m.watch("role"),g=sn(C).filter(T=>{const f=tn.safeParse(T).success,O=!c||T!==c.toLowerCase();return f&&O}),j=Te({mutationFn:async({emails:T,role:f})=>{if(!f)throw new Error("Please select a role");const O=await Promise.allSettled(T.map(async P=>{const A=await ae.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),N=O.filter(P=>P.status==="rejected");if(N.length>0)throw new Error(`Failed to invite ${N.length} member${N.length>1?"s":""}`);return O},onSuccess:(T,{emails:f})=>{l.invalidateQueries({queryKey:ce.members(r)}),l.invalidateQueries({queryKey:ce.invitations(r)}),ne.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:T=>{ne.error(T instanceof Error?T.message:"Failed to invite members")}}),b=T=>{if(g.length===0){ne.error("Please enter at least one valid email address");return}if(!T.role){ne.error("Please select a role");return}j.mutate({emails:g,role:T.role})},I=g.length>0&&!!d;return s.jsxs(Ut,{open:e,onOpenChange:n,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsxs(Bt,{className:"sm:max-w-lg",children:[s.jsx(ms,{children:s.jsx(us,{children:"Invite members"})}),s.jsx(vs,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(b),className:"space-y-4",children:[s.jsx(It,{control:m.control,name:"emailsText",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(Ns,{children:"Email addresses"}),s.jsx(At,{children:s.jsx(Es,{...T,disabled:j.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(wt,{})]})}),s.jsx(It,{control:m.control,name:"role",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(At,{children:s.jsxs(ft,{value:T.value,onValueChange:T.onChange,disabled:j.isPending||u,children:[s.jsx(ht,{className:"w-full",children:s.jsx(gt,{placeholder:"Select a role"})}),s.jsx(xt,{children:x.map(f=>{const O=[];return f.isBuiltin||(f.allowsAllStaticPermissions?O.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&O.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?O.push("All connections"):f.connectionCount&&f.connectionCount>0&&O.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?O.push("all tools"):f.toolCount&&f.toolCount>0&&O.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),s.jsx(pt,{value:f.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:f.label}),!f.isBuiltin&&O.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:O.join(", ")})]})},f.role)})})]})}),s.jsx(wt,{})]})}),s.jsxs(fs,{children:[s.jsx(ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:j.isPending,children:"Cancel"}),s.jsx(ie,{type:"submit",disabled:j.isPending||!I,children:j.isPending?"Inviting...":`Invite ${g.length||0} Member${g.length!==1?"s":""}`})]})]})})]})]})}function rn(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ce.invitations(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"ORGANIZATION_GET",arguments:{}});return(u.structuredContent??u)?.invitations??[]},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c},t[6]=o,t[7]=c,t[8]=i):i=t[8],es(i)}function on(){const t=le.c(5),{locator:e}=Ce(),n=we();let r;t[0]!==e||t[1]!==n?(r={mutationFn:an,onSuccess:()=>{n.invalidateQueries({queryKey:ce.invitations(e)}),ne.success("Invitation cancelled")},onError:ln},t[0]=e,t[1]=n,t[2]=r):r=t[2];const l=Te(r);let o;return t[3]!==l?(o={cancel:l},t[3]=l,t[4]=o):o=t[4],o}function ln(t){ne.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function an(t){const e=await ae.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}function cn(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ce.tags(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"TAGS_LIST",arguments:{}});return(u.structuredContent??u).tags},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c,staleTime:3e4},t[6]=o,t[7]=c,t[8]=i):i=t[8],it(i)}function dn(){const t=le.c(10),e=we(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const m=await o.callTool({name:"TAGS_CREATE",arguments:{name:x}});return(m.structuredContent??m).tag},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=()=>{e.invalidateQueries({queryKey:ce.tags(r)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:mn},t[7]=c,t[8]=i,t[9]=u):u=t[9],Te(u)}function mn(t){ne.error(t instanceof Error?t.message:"Failed to create tag")}function un(t){const e=le.c(12),{org:n,locator:r}=Ce();let l;e[0]!==n.id?(l={connectionId:qe,orgId:n.id},e[0]=n.id,e[1]=l):l=e[1];const o=Qe(l);let c;e[2]!==r||e[3]!==t?(c=ce.memberTags(r,t),e[2]=r,e[3]=t,e[4]=c):c=e[4];let i;e[5]!==o||e[6]!==t?(i=async()=>{const m=await o.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(m.structuredContent??m).tags},e[5]=o,e[6]=t,e[7]=i):i=e[7];const u=!!t;let x;return e[8]!==c||e[9]!==i||e[10]!==u?(x={queryKey:c,queryFn:i,staleTime:3e4,enabled:u},e[8]=c,e[9]=i,e[10]=u,e[11]=x):x=e[11],it(x)}function fn(){const t=le.c(10),e=we(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const{memberId:m,tagIds:C}=x,d=await o.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:C}});return d.structuredContent??d},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=(x,m)=>{e.invalidateQueries({queryKey:ce.memberTags(r,m.memberId)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:hn},t[7]=c,t[8]=i,t[9]=u):u=t[9],Te(u)}function hn(t){ne.error(t instanceof Error?t.message:"Failed to update member tags")}function Zt(t){const e=le.c(44),{memberId:n,className:r,disabled:l,placeholder:o,maxDisplay:c}=t,i=l===void 0?!1:l,u=o===void 0?"Add tags...":o,x=c===void 0?2:c,[m,C]=D.useState(!1),[d,v]=D.useState(""),{data:g,isLoading:j}=cn(),b=g===void 0?[]:g,{data:I,isLoading:T}=un(n),f=I===void 0?[]:I,O=dn(),N=fn(),P=j||T,A=f.map(xn);let R;e[0]!==d?(R=K=>K.name.toLowerCase().includes(d.toLowerCase()),e[0]=d,e[1]=R):R=e[1];const L=b.filter(R);let M;e[2]!==d?(M=K=>K.name.toLowerCase()===d.toLowerCase(),e[2]=d,e[3]=M):M=e[3];const w=b.find(M),h=d.trim()&&!w,S=async K=>{const be=A.includes(K.id)?A.filter(ye=>ye!==K.id):[...A,K.id];await N.mutateAsync({memberId:n,tagIds:be})},E=async()=>{if(!d.trim())return;const K=await O.mutateAsync(d.trim());await N.mutateAsync({memberId:n,tagIds:[...A,K.id]}),v("")},p=async K=>{const ge=A.filter(be=>be!==K);await N.mutateAsync({memberId:n,tagIds:ge})},_=O.isPending||N.isPending,k=Is;let B;e[4]!==m?(B=()=>C(!m),e[4]=m,e[5]=B):B=e[5];let q;e[6]!==r?(q=X("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",r),e[6]=r,e[7]=q):q=e[7];const Q=i||P,H=P?s.jsx(st,{size:14,className:"animate-spin text-muted-foreground"}):f.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[f.slice(0,x).map(gn),f.length>x&&s.jsxs(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",f.length-x]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let Z;e[8]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(As,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=Z):Z=e[8];let se;e[9]!==Q||e[10]!==H||e[11]!==B||e[12]!==q?(se=s.jsx(Os,{asChild:!0,children:s.jsxs(ie,{variant:"ghost",size:"sm",onClick:B,className:q,disabled:Q,children:[H,Z]})}),e[9]=Q,e[10]=H,e[11]=B,e[12]=q,e[13]=se):se=e[13];const J=Ss,U="w-56 p-0",a="start";let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=()=>C(!1),e[14]=y):y=e[14];const F=cs,me=!1;let te;e[15]!==d?(te=s.jsx(ds,{placeholder:"Search or create...",value:d,onValueChange:v,className:"h-9"}),e[15]=d,e[16]=te):te=e[16];const W=as,ee=f.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(dt,{heading:"Selected",children:f.map(K=>s.jsx(mt,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]}),s.jsx("button",{onClick:ge=>{ge.stopPropagation(),p(K.id)},className:"opacity-50 hover:opacity-100",disabled:_,children:s.jsx(Ft,{size:14})})]})},K.id))}),s.jsx(yt,{})]}),de=dt,V="Available",G=L.length===0&&!h&&s.jsx(ls,{children:"No tags found."}),Y=L.filter(K=>!A.includes(K.id)).map(K=>s.jsx(mt,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]})},K.id));let re;e[17]!==de||e[18]!==G||e[19]!==Y?(re=s.jsxs(de,{heading:V,children:[G,Y]}),e[17]=de,e[18]=G,e[19]=Y,e[20]=re):re=e[20];let ue;e[21]!==E||e[22]!==_||e[23]!==d||e[24]!==h?(ue=h&&s.jsxs(s.Fragment,{children:[s.jsx(yt,{}),s.jsx(dt,{children:s.jsx(mt,{onSelect:E,className:"cursor-pointer",disabled:_,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[_?s.jsx(st,{size:14,className:"animate-spin"}):s.jsx(nt,{size:14}),s.jsxs("span",{children:['Create "',d.trim(),'"']})]})})})]}),e[21]=E,e[22]=_,e[23]=d,e[24]=h,e[25]=ue):ue=e[25];let pe;e[26]!==W||e[27]!==ee||e[28]!==re||e[29]!==ue?(pe=s.jsxs(W,{children:[ee,re,ue]}),e[26]=W,e[27]=ee,e[28]=re,e[29]=ue,e[30]=pe):pe=e[30];let fe;e[31]!==F||e[32]!==te||e[33]!==pe?(fe=s.jsxs(F,{shouldFilter:me,children:[te,pe]}),e[31]=F,e[32]=te,e[33]=pe,e[34]=fe):fe=e[34];let he;e[35]!==J||e[36]!==y||e[37]!==fe?(he=s.jsx(J,{className:U,align:a,onEscapeKeyDown:y,children:fe}),e[35]=J,e[36]=y,e[37]=fe,e[38]=he):he=e[38];let je;return e[39]!==k||e[40]!==m||e[41]!==se||e[42]!==he?(je=s.jsxs(k,{open:m,onOpenChange:C,children:[se,he]}),e[39]=k,e[40]=m,e[41]=se,e[42]=he,e[43]=je):je=e[43],je}function gn(t){return s.jsx(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function xn(t){return t.id}const Rt=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],pn={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function bn(t){const e=new Map;for(const[n,r]of Object.entries(pn))e.set(n,r);for(let n=0;n<t.length;n++){const r=t[n];r&&!e.has(r.role)&&e.set(r.role,Rt[n%Rt.length]??"bg-neutral-400")}return e}function Cn(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function et(t){const e=le.c(79),{role:n,memberId:r,isOwner:l,roleColorMap:o,selectableRoles:c,onRoleChange:i,size:u,className:x}=t,m=u===void 0?"xs":u;let C,d,v,g,j,b,I,T,f,O,N;if(e[0]!==x||e[1]!==l||e[2]!==r||e[3]!==i||e[4]!==n||e[5]!==o||e[6]!==c||e[7]!==m){N=Symbol.for("react.early_return_sentinel");e:{const E=o.get(n)??"bg-neutral-400";if(l){let p;e[19]!==r||e[20]!==i?(p=U=>i(r,U),e[19]=r,e[20]=i,e[21]=p):p=e[21];let _;e[22]!==n?(_=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=_):_=e[23];const k=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:X("size-2 rounded-full shrink-0",E)}),_]});let B;e[24]!==k?(B=s.jsx(gt,{children:k}),e[24]=k,e[25]=B):B=e[25];let q;e[26]!==x||e[27]!==m||e[28]!==B?(q=s.jsx(ht,{size:m,className:x,children:B}),e[26]=x,e[27]=m,e[28]=B,e[29]=q):q=e[29];let Q;if(e[30]!==o||e[31]!==c){let U;e[33]!==o?(U=a=>{const y=o.get(a.role)??"bg-neutral-400";return s.jsx(pt,{value:a.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:X("size-3 rounded-full",y)}),s.jsx("span",{className:"capitalize",children:a.label})]})},a.role)},e[33]=o,e[34]=U):U=e[34],Q=c.map(U),e[30]=o,e[31]=c,e[32]=Q}else Q=e[32];let H;e[35]!==Q?(H=s.jsx(xt,{children:Q}),e[35]=Q,e[36]=H):H=e[36];let Z;e[37]!==l||e[38]!==n||e[39]!==p||e[40]!==q||e[41]!==H?(Z=s.jsx(Pe,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ft,{value:n,onValueChange:p,disabled:l,children:[q,H]})})}),e[37]=l,e[38]=n,e[39]=p,e[40]=q,e[41]=H,e[42]=Z):Z=e[42];let se;e[43]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx(Me,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=se):se=e[43];let J;e[44]!==Z?(J=s.jsx(_e,{children:s.jsxs(Re,{children:[Z,se]})}),e[44]=Z,e[45]=J):J=e[45],N=J;break e}v=ft,T=n,e[46]!==r||e[47]!==i?(f=p=>i(r,p),e[46]=r,e[47]=i,e[48]=f):f=e[48],O=l,d=ht,b=m,I=x,C=gt,j="flex items-center gap-2 min-w-0",g=X("size-2 rounded-full shrink-0",E)}e[0]=x,e[1]=l,e[2]=r,e[3]=i,e[4]=n,e[5]=o,e[6]=c,e[7]=m,e[8]=C,e[9]=d,e[10]=v,e[11]=g,e[12]=j,e[13]=b,e[14]=I,e[15]=T,e[16]=f,e[17]=O,e[18]=N}else C=e[8],d=e[9],v=e[10],g=e[11],j=e[12],b=e[13],I=e[14],T=e[15],f=e[16],O=e[17],N=e[18];if(N!==Symbol.for("react.early_return_sentinel"))return N;let P;e[49]!==g?(P=s.jsx("div",{className:g}),e[49]=g,e[50]=P):P=e[50];let A;e[51]!==n?(A=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=A):A=e[52];let R;e[53]!==P||e[54]!==A||e[55]!==j?(R=s.jsxs("div",{className:j,children:[P,A]}),e[53]=P,e[54]=A,e[55]=j,e[56]=R):R=e[56];let L;e[57]!==C||e[58]!==R?(L=s.jsx(C,{children:R}),e[57]=C,e[58]=R,e[59]=L):L=e[59];let M;e[60]!==d||e[61]!==L||e[62]!==b||e[63]!==I?(M=s.jsx(d,{size:b,className:I,children:L}),e[60]=d,e[61]=L,e[62]=b,e[63]=I,e[64]=M):M=e[64];let w;if(e[65]!==o||e[66]!==c){let E;e[68]!==o?(E=p=>{const _=o.get(p.role)??"bg-neutral-400";return s.jsx(pt,{value:p.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:X("size-3 rounded-full",_)}),s.jsx("span",{className:"capitalize",children:p.label})]})},p.role)},e[68]=o,e[69]=E):E=e[69],w=c.map(E),e[65]=o,e[66]=c,e[67]=w}else w=e[67];let h;e[70]!==w?(h=s.jsx(xt,{children:w}),e[70]=w,e[71]=h):h=e[71];let S;return e[72]!==v||e[73]!==M||e[74]!==h||e[75]!==T||e[76]!==f||e[77]!==O?(S=s.jsxs(v,{value:T,onValueChange:f,disabled:O,children:[M,h]}),e[72]=v,e[73]=M,e[74]=h,e[75]=T,e[76]=f,e[77]=O,e[78]=S):S=e[78],S}function Pt(t){const e=le.c(51),{member:n,roles:r,onChangeRole:l,onRemove:o,isUpdating:c}=t,i=c===void 0?!1:c,u=n.role==="owner";let x,m,C,d,v,g,j,b,I;if(e[0]!==u||e[1]!==i||e[2]!==n.id||e[3]!==n.role||e[4]!==l||e[5]!==r){let M;e[15]!==n.role?(M=p=>p.role!==n.role&&p.role!=="owner",e[15]=n.role,e[16]=M):M=e[16];const w=r.filter(M);d=Ct;let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx($t,{size:20}),e[17]=h):h=e[17],e[18]!==u?(I=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:Tn,children:h})}),e[18]=u,e[19]=I):I=e[19],C=Tt,j="end",b=jn,m=hs;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(qt,{size:16}),e[20]=S):S=e[20],e[21]!==i?(g=s.jsxs(gs,{disabled:i,children:[S,"Change Role"]}),e[21]=i,e[22]=g):g=e[22],x=xs;let E;e[23]!==i||e[24]!==n.id||e[25]!==l?(E=p=>{const _=[];return p.isBuiltin||(p.allowsAllStaticPermissions?_.push("Full org access"):p.staticPermissionCount&&p.staticPermissionCount>0&&_.push(`${p.staticPermissionCount} org perm${p.staticPermissionCount!==1?"s":""}`),p.allowsAllConnections?_.push("All connections"):p.connectionCount&&p.connectionCount>0&&_.push(`${p.connectionCount} connection${p.connectionCount!==1?"s":""}`),(p.connectionCount!==0||p.allowsAllConnections)&&(p.allowsAllTools?_.push("all tools"):p.toolCount&&p.toolCount>0&&_.push(`${p.toolCount} tool${p.toolCount!==1?"s":""}`))),s.jsxs(tt,{onClick:k=>{k.stopPropagation(),l(n.id,p.role)},disabled:i,children:[p.isBuiltin?s.jsx(vt,{size:16}):s.jsx(ys,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:p.label}),!p.isBuiltin&&_.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:_.join(", ")})]})]},p.role)},e[23]=i,e[24]=n.id,e[25]=l,e[26]=E):E=e[26],v=w.map(E),e[0]=u,e[1]=i,e[2]=n.id,e[3]=n.role,e[4]=l,e[5]=r,e[6]=x,e[7]=m,e[8]=C,e[9]=d,e[10]=v,e[11]=g,e[12]=j,e[13]=b,e[14]=I}else x=e[6],m=e[7],C=e[8],d=e[9],v=e[10],g=e[11],j=e[12],b=e[13],I=e[14];let T;e[27]!==x||e[28]!==v?(T=s.jsx(x,{children:v}),e[27]=x,e[28]=v,e[29]=T):T=e[29];let f;e[30]!==m||e[31]!==g||e[32]!==T?(f=s.jsxs(m,{children:[g,T]}),e[30]=m,e[31]=g,e[32]=T,e[33]=f):f=e[33];let O;e[34]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(ps,{}),e[34]=O):O=e[34];let N;e[35]!==n.id||e[36]!==o?(N=M=>{M.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=N):N=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Gt,{size:16}),e[38]=P):P=e[38];let A;e[39]!==N?(A=s.jsxs(tt,{variant:"destructive",onClick:N,children:[P,"Remove Member"]}),e[39]=N,e[40]=A):A=e[40];let R;e[41]!==C||e[42]!==A||e[43]!==j||e[44]!==b||e[45]!==f?(R=s.jsxs(C,{align:j,onClick:b,children:[f,O,A]}),e[41]=C,e[42]=A,e[43]=j,e[44]=b,e[45]=f,e[46]=R):R=e[46];let L;return e[47]!==d||e[48]!==R||e[49]!==I?(L=s.jsxs(d,{children:[I,R]}),e[47]=d,e[48]=R,e[49]=I,e[50]=L):L=e[50],L}function jn(t){return t.stopPropagation()}function Tn(t){return t.stopPropagation()}function Mt(t){const e=le.c(8),{invitationId:n,onCancel:r,isCancelling:l}=t,o=l===void 0?!1:l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Nn,children:s.jsx($t,{size:20})})}),e[0]=c):c=e[0];let i;e[1]!==n||e[2]!==r?(i=m=>{m.stopPropagation(),r(n)},e[1]=n,e[2]=r,e[3]=i):i=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ft,{size:16}),e[4]=u):u=e[4];let x;return e[5]!==o||e[6]!==i?(x=s.jsxs(Ct,{children:[c,s.jsx(Tt,{align:"end",onClick:vn,children:s.jsxs(tt,{variant:"destructive",onClick:i,disabled:o,children:[u,"Cancel Invitation"]})})]}),e[5]=o,e[6]=i,e[7]=x):x=e[7],x}function vn(t){return t.stopPropagation()}function Nn(t){return t.stopPropagation()}function En(){const t=le.c(79),{data:e}=bt(),{data:n}=rn(),r=on(),l=we(),{locator:o}=Ce(),[c,i]=D.useState(null),[u,x]=D.useState(null),[m,C]=D.useState(""),[d,v]=D.useState("table"),[g,j]=D.useState("member"),[b,I]=D.useState("asc"),T=e?.data?.members;let f;t[0]!==g?(f=z=>{g===z?I(kn):(j(z),I("asc"))},t[0]=g,t[1]=f):f=t[1];const O=f;let N=T??[],P=n??[];if(m){const z=m.toLowerCase();N=N.filter($=>$.user?.name?.toLowerCase().includes(z)||$.user?.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z)),P=P.filter($=>$.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z))}if(g&&b){let z;t[2]!==b||t[3]!==g?(z=($,oe)=>{let xe,Le;e:switch(g){case"member":{xe=$.user?.name||"",Le=oe.user?.name||"";break e}case"role":{xe=$.role||"",Le=oe.role||"";break e}case"joined":{xe=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",Le=oe.createdAt?typeof oe.createdAt=="string"?oe.createdAt:oe.createdAt.toISOString():"";break e}default:return 0}return b==="asc"?xe.localeCompare(Le):Le.localeCompare(xe)},t[2]=b,t[3]=g,t[4]=z):z=t[4],N=[...N].sort(z)}const A=N;let R;t[5]!==o||t[6]!==l?(R={mutationFn:zn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.members(o)}),ne.success("Member has been removed from the organization"),i(null)},onError:Dn},t[5]=o,t[6]=l,t[7]=R):R=t[7];const L=Te(R);let M;t[8]!==o||t[9]!==l?(M={mutationFn:Mn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.members(o)}),ne.success("Member's role has been updated")},onError:Pn},t[8]=o,t[9]=l,t[10]=M):M=t[10];const w=Te(M);let h;t[11]!==o||t[12]!==l?(h={mutationFn:Rn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.invitations(o)}),ne.success("Invitation role has been updated")},onError:_n},t[11]=o,t[12]=l,t[13]=h):h=t[13];const S=Te(h),{roles:E,customRoles:p}=Nt();let _;t[14]!==p?(_=bn(p),t[14]=p,t[15]=_):_=t[15];const k=_;let B;t[16]!==E?(B=E.filter(Ln),t[16]=E,t[17]=B):B=t[17];const q=B;let Q;t[18]===Symbol.for("react.memo_cache_sentinel")?(Q={id:"member",header:"Member",render:wn,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=Q):Q=t[18];let H;t[19]!==k||t[20]!==q||t[21]!==S||t[22]!==w?(H={id:"role",header:"Role",render:z=>z.type==="member"?s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:z.data.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>w.mutate({memberId:$,role:oe}),className:"w-36"}):s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>S.mutate({invitationId:$,role:oe,email:z.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=k,t[20]=q,t[21]=S,t[22]=w,t[23]=H):H=t[23];let Z,se;t[24]===Symbol.for("react.memo_cache_sentinel")?(Z={id:"tags",header:"Tags",render:An,cellClassName:"w-40 shrink-0"},se={id:"joined",header:"Joined",render:On,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=Z,t[25]=se):(Z=t[24],se=t[25]);let J;t[26]!==r.cancel.isPending||t[27]!==E||t[28]!==w?(J={id:"actions",header:"",render:z=>z.type==="member"?s.jsx(Pt,{member:z.data,roles:E,onChangeRole:($,oe)=>w.mutate({memberId:$,role:oe}),onRemove:i,isUpdating:w.isPending}):s.jsx(Mt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=r.cancel.isPending,t[27]=E,t[28]=w,t[29]=J):J=t[29];let U;t[30]!==J||t[31]!==H?(U=[Q,H,Z,se,J],t[30]=J,t[31]=H,t[32]=U):U=t[32];const a=U;let y;t[33]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(en,{trigger:s.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(vt,{size:16}),"Manage Roles"]})}),t[33]=y):y=t[33];let F;t[34]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs("div",{className:"flex items-center gap-2",children:[y,s.jsx(nn,{trigger:s.jsx(ie,{size:"sm",children:"Invite Member"})})]}),t[34]=F):F=t[34];const me=F,te=[...A.map(In),...P.filter(Sn).map(yn)],W=Ne,ee=!!u;let de;t[35]===Symbol.for("react.memo_cache_sentinel")?(de=()=>x(null),t[35]=de):de=t[35];let V;t[36]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Cancel Invitation"}),s.jsx(Be,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[36]=V):V=t[36];let G;t[37]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx($e,{children:"Keep Invitation"}),t[37]=G):G=t[37];let Y;t[38]!==r.cancel||t[39]!==u?(Y=()=>{u&&(r.cancel.mutate(u),x(null))},t[38]=r.cancel,t[39]=u,t[40]=Y):Y=t[40];let re;t[41]!==r.cancel.isPending||t[42]!==Y?(re=s.jsxs(ke,{children:[V,s.jsxs(Ge,{children:[G,s.jsx(Fe,{onClick:Y,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[41]=r.cancel.isPending,t[42]=Y,t[43]=re):re=t[43];let ue;t[44]!==ee||t[45]!==re?(ue=s.jsx(ze,{open:ee,onOpenChange:de,children:re}),t[44]=ee,t[45]=re,t[46]=ue):ue=t[46];const pe=!!c;let fe;t[47]===Symbol.for("react.memo_cache_sentinel")?(fe=()=>i(null),t[47]=fe):fe=t[47];let he;t[48]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Remove Member"}),s.jsx(Be,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[48]=he):he=t[48];let je;t[49]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx($e,{children:"Cancel"}),t[49]=je):je=t[49];let K;t[50]!==c||t[51]!==L?(K=()=>c&&L.mutate(c),t[50]=c,t[51]=L,t[52]=K):K=t[52];let ge;t[53]!==L.isPending||t[54]!==K?(ge=s.jsxs(ke,{children:[he,s.jsxs(Ge,{children:[je,s.jsx(Fe,{onClick:K,disabled:L.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[53]=L.isPending,t[54]=K,t[55]=ge):ge=t[55];let be;t[56]!==pe||t[57]!==ge?(be=s.jsx(ze,{open:pe,onOpenChange:fe,children:ge}),t[56]=pe,t[57]=ge,t[58]=be):be=t[58];let ye;t[59]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(Ne.Header.Left,{children:s.jsx(ns,{children:s.jsx(rs,{children:s.jsx(is,{children:s.jsx(os,{children:"Members"})})})})}),t[59]=ye):ye=t[59];let He;t[60]===Symbol.for("react.memo_cache_sentinel")?(He=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[60]=He):He=t[60];let Se;t[61]!==O||t[62]!==b||t[63]!==g||t[64]!==d?(Se=s.jsxs(Ne.Header,{children:[ye,s.jsxs(Ne.Header.Right,{children:[s.jsx(ts,{viewMode:d,onViewModeChange:v,sortKey:g,sortDirection:b,onSort:O,sortOptions:He}),me]})]}),t[61]=O,t[62]=b,t[63]=g,t[64]=d,t[65]=Se):Se=t[65];let Ze;t[66]===Symbol.for("react.memo_cache_sentinel")?(Ze=z=>{z.key==="Escape"&&(C(""),z.target.blur())},t[66]=Ze):Ze=t[66];let Ie;t[67]!==m?(Ie=s.jsx(Ke,{value:m,onChange:C,placeholder:"Search members...",onKeyDown:Ze}),t[67]=m,t[68]=Ie):Ie=t[68];const ot=Ne,lt=d==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:te.length===0?s.jsx(ct,{title:"No members found",description:m?`No members match "${m}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(z=>{if(z.type==="invitation")return s.jsxs(Lt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Mt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{fallback:rt(z.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:z.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ee,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>S.mutate({invitationId:oe,role:xe,email:z.data.email}),className:"w-fit"})]})]})]},`inv-${z.data.id}`);const $=z.data;return s.jsxs(Lt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Pt,{member:$,roles:E,onChangeRole:(oe,xe)=>w.mutate({memberId:oe,role:xe}),onRemove:i,isUpdating:w.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{url:$.user?.image??void 0,fallback:rt($.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:$.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),s.jsx(et,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>w.mutate({memberId:oe,role:xe}),className:"w-fit"}),s.jsx(Zt,{memberId:$.id,maxDisplay:3})]})]})]},$.id)})})}):s.jsx(ss,{columns:a,data:te,isLoading:!1,sortKey:g,sortDirection:b,onSort:O,emptyState:m?s.jsx(ct,{title:"No members found",description:`No members match "${m}"`}):s.jsx(ct,{title:"No members found",description:"Invite members to get started."})});let Oe;t[69]!==ot.Content||t[70]!==lt?(Oe=s.jsx(ot.Content,{children:lt}),t[69]=ot.Content,t[70]=lt,t[71]=Oe):Oe=t[71];let Ye;return t[72]!==W||t[73]!==ue||t[74]!==be||t[75]!==Se||t[76]!==Ie||t[77]!==Oe?(Ye=s.jsxs(W,{children:[ue,be,Se,Ie,Oe]}),t[72]=W,t[73]=ue,t[74]=be,t[75]=Se,t[76]=Ie,t[77]=Oe,t[78]=Ye):Ye=t[78],Ye}function yn(t){return{type:"invitation",data:t}}function Sn(t){return t.status==="pending"}function In(t){return{type:"member",data:t}}function On(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?Cn(t.data.createdAt):"N/A"}):s.jsx(Ee,{variant:"outline",children:"Pending"})}function An(t){return t.type==="member"?s.jsx(Zt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function wn(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{url:t.data.user?.image??void 0,fallback:rt(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{fallback:rt(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Ln(t){return t.role!=="owner"}function _n(t){ne.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Rn(t){const{invitationId:e,role:n,email:r}=t,l=await ae.organization.cancelInvitation({invitationId:e});if(l?.error)throw new Error(l.error.message);const o=await ae.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function Pn(t){ne.error(t instanceof Error?t.message:"Failed to update role")}async function Mn(t){const{memberId:e,role:n}=t,r=await ae.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function Dn(t){ne.error(t instanceof Error?t.message:"Failed to remove member")}async function zn(t){const e=await ae.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function kn(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Or(){const t=le.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ne,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ts,{fallback:e,children:s.jsx(D.Suspense,{fallback:s.jsx(Ne,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(En,{})})}),t[1]=n):n=t[1],n}export{Or as default};
@@ -1,4 +1,4 @@
1
- import{r as a,bt as N,j as _,c as Me,bo as te}from"./index-CHQ9-Q-G.js";import{S as me}from"./spinner-CEhxpPPn.js";const Pe=({size:e=24,color:t="currentColor",...r})=>a.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},a.createElement("path",{d:"M12 6v6l4 2m6-2c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Pe.displayName="Clock";function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Re(e){if(Array.isArray(e))return e}function Se(e,t,r){return(t=Ve(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,u,l=[],c=!0,g=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(O){g=!0,o=O}finally{try{if(!c&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(g)throw o}}return l}}function Te(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as a,bt as N,j as _,c as Me,bo as te}from"./index-DZKwM-s7.js";import{S as me}from"./spinner-tIX7WyGo.js";const Pe=({size:e=24,color:t="currentColor",...r})=>a.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},a.createElement("path",{d:"M12 6v6l4 2m6-2c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Pe.displayName="Clock";function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Re(e){if(Array.isArray(e))return e}function Se(e,t,r){return(t=Ve(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,u,l=[],c=!0,g=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(O){g=!0,o=O}finally{try{if(!c&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(g)throw o}}return l}}function Te(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ce(Object(r),!0).forEach(function(n){Se(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _e(e,t){if(e==null)return{};var r,n,o=Ce(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Ce(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ie(e,t){return Re(e)||xe(e,t)||Ae(e,t)||Te()}function Le(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ve(e){var t=Le(e,"string");return typeof t=="symbol"?t:t+""}function Ae(e,t){if(e){if(typeof e=="string")return ue(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(e,t):void 0}}function $e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?le(Object(r),!0).forEach(function(n){$e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ne(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function k(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Q(e){return{}.toString.call(e).includes("Object")}function De(e){return!Object.keys(e).length}function W(e){return typeof e=="function"}function ze(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ke(e,t){return Q(t)||T("changeType"),Object.keys(t).some(function(r){return!ze(e,r)})&&T("changeField"),t}function Ke(e){W(e)||T("selectorType")}function We(e){W(e)||Q(e)||T("handlerType"),Q(e)&&Object.values(e).some(function(t){return!W(t)})&&T("handlersType")}function qe(e){e||T("initialIsRequired"),Q(e)||T("initialType"),De(e)&&T("initialContent")}function Fe(e,t){throw new Error(e[t]||e.default)}var Ue={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},T=k(Fe)(Ue),B={changes:ke,selector:Ke,handler:We,initial:qe};function Be(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};B.initial(e),B.handler(t);var r={current:e},n=k(Qe)(r,t),o=k(He)(r),i=k(B.changes)(e),u=k(Je)(r);function l(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(O){return O};return B.selector(g),g(r.current)}function c(g){Ne(n,o,i,u)(g)}return[l,c]}function Je(e,t){return W(t)?t(e.current):t}function He(e,t){return e.current=fe(fe({},e.current),t),t}function Qe(e,t,r){return W(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Ge={create:Be},Ye={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ze(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Xe(e){return{}.toString.call(e).includes("Object")}function et(e){return e||de("configIsRequired"),Xe(e)||de("configType"),e.urls?(tt(),{paths:{vs:e.urls.monacoBase}}):e}function tt(){console.warn(he.deprecation)}function rt(e,t){throw new Error(e[t]||e.default)}var he={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4
 
@@ -1,4 +1,4 @@
1
- import{r as g,c as me,v as Ca,u as nn,j as v,t as yr,bY as ri,b5 as tt,aJ as ke,bt as ce,bZ as DC,$ as RC,aR as LC,b_ as $C,b$ as qC,al as kn,aV as g1,ak as Cr,aq as y1,av as Uo,an as Sr,aY as zr,aW as FC,am as Hd,b7 as BC,b8 as b1,b6 as zC,q as WC,f as UC,K as KC}from"./index-CHQ9-Q-G.js";import{C as HC}from"./collection-search-CECpIAiD.js";import{P as Lt}from"./index-aWpPBjkT.js";import{B as YC,a as GC,b as VC,e as XC}from"./breadcrumb-CJBikxW8.js";import{b as Pi,T as Oi,a as Ci,I as ia,n as Gf,E as x1}from"./empty-state-VwVcPCE1.js";import{E as ji}from"./error-boundary-C8CO11ML.js";import{B as oa}from"./badge-DIFY1rsD.js";import{B as Ne,c as fe,b as Uv}from"./button-CKIyuXIq.js";import{t as Li}from"./ChevronDown-DeD12W57.js";import{i as w1}from"./ChevronRight-8Yl-zCCi.js";import{b as ja,P as Aa,a as Na}from"./popover-CjUGVjON.js";import{i as zs}from"./Check-DTUUSvp-.js";import{a as ni}from"./Copy01-CqWuZ9K-.js";import{n as Kv}from"./Download01-DDoxVok6.js";import{i as _1}from"./FilterLines-uGkpVOX8.js";import{i as ZC}from"./index-Bc7QzOnC.js";import{i as QC}from"./Play-B5QcYkt5.js";import{M as Hv,s as JC}from"./monaco-editor-qYykGrlT.js";import{c as Tt,b as Vf,d as ej,e as tj,a as rj,T as Zt}from"./table-CBtv9zrT.js";import{r as nj}from"./index-BdSNJxPZ.js";import{f as aj,c as ij,a as Yv,d as oj,C as sj,e as lj,u as uj}from"./command-BLAC1NoH.js";import{i as cj,u as fj}from"./Code01-C2qL6p3f.js";import{h as Yd}from"./use-connection-UwIAiUmR.js";import{a as S1,u as P1}from"./constants-DwkB1age.js";import{b as O1}from"./use-virtual-mcp-BIZk_q3v.js";import{c as dj}from"./Grid01-B9LzvODL.js";import{s as hj}from"./Plus-CP35U6Iv.js";import{s as vj}from"./Trash01-Ck6jzVhZ.js";import{I as aa}from"./input-BrgRsDcE.js";import{C as Gv}from"./checkbox-BomYVgbH.js";import{e as mj,S as Vv,a as Xv,b as Zv,c as Qv,d as ai}from"./select-JdRjOrBE.js";import{n as pj}from"./Calendar-BaFebt3t.js";import{T as gj}from"./textarea-BBk7k5wE.js";import{C as yj}from"./collection-tabs-Dd6S7hPE.js";import{u as bj}from"./use-mcp-tools-BKgKiBFS.js";import{t as xj}from"./Users03-B-DO1n7F.js";import"./Loading01-3CQcIIbt.js";import"./SearchMd-DTs0TtNF.js";import"./spinner-CEhxpPPn.js";import"./infiniteQueryObserver-CKMx30vn.js";import"./useMutation-C8K1KoTI.js";import"./useQuery-CImYAWdS.js";const C1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"m15 18-6-6 6-6"}));C1.displayName="ChevronLeft";const j1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M9.5 15V9m5 6V9m7.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));j1.displayName="PauseCircle";const A1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),g.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}));A1.displayName="PlayCircle";const N1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M4 7c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C5.602 4 6.068 4 7 4h10c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C20 5.602 20 6.068 20 7M9 20h6M12 4v16"}));N1.displayName="Type01";const Xf={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function Lr(e){return e.filter(t=>t.key.trim()).map(t=>{const r=encodeURIComponent(t.key.trim()),n=encodeURIComponent(t.value||"");return`${r}:${t.operator}:${n}`}).join(",")}function wj(e){return e?e.split(",").map(t=>{const[r,n,...a]=t.split(":");return{key:decodeURIComponent(r||""),operator:n||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function ii(e){return e.filter(t=>t.key.trim()).map(t=>{switch(t.operator){case"eq":return`${t.key}=${t.value}`;case"contains":return`${t.key}~${t.value}`;case"exists":return`${t.key}?`;case"in":return`${t.key}@${t.value}`}}).join(`
1
+ import{r as g,c as me,v as Ca,u as nn,j as v,t as yr,bY as ri,b5 as tt,aJ as ke,bt as ce,bZ as DC,$ as RC,aR as LC,b_ as $C,b$ as qC,al as kn,aV as g1,ak as Cr,aq as y1,av as Uo,an as Sr,aY as zr,aW as FC,am as Hd,b7 as BC,b8 as b1,b6 as zC,q as WC,f as UC,K as KC}from"./index-DZKwM-s7.js";import{C as HC}from"./collection-search-Cm7834fO.js";import{P as Lt}from"./index-QlAcVvwl.js";import{B as YC,a as GC,b as VC,e as XC}from"./breadcrumb-Cp0sD1P8.js";import{b as Pi,T as Oi,a as Ci,I as ia,n as Gf,E as x1}from"./empty-state-DYOBL1E0.js";import{E as ji}from"./error-boundary-4OVFwt4t.js";import{B as oa}from"./badge-Dq2_S74H.js";import{B as Ne,c as fe,b as Uv}from"./button-CvZ7ap4z.js";import{t as Li}from"./ChevronDown-B01wwgGg.js";import{i as w1}from"./ChevronRight-BgsyooQy.js";import{b as ja,P as Aa,a as Na}from"./popover-DceEFrFl.js";import{i as zs}from"./Check-BYQw8z-Y.js";import{a as ni}from"./Copy01-DbtcxuOL.js";import{n as Kv}from"./Download01-CGjFy_eW.js";import{i as _1}from"./FilterLines-UXqFmiMf.js";import{i as ZC}from"./index-D-HDjXTE.js";import{i as QC}from"./Play-z4l5W2L1.js";import{M as Hv,s as JC}from"./monaco-editor-CJjRKcIU.js";import{c as Tt,b as Vf,d as ej,e as tj,a as rj,T as Zt}from"./table-DnQsZAfD.js";import{r as nj}from"./index-BT-HZ5Ji.js";import{f as aj,c as ij,a as Yv,d as oj,C as sj,e as lj,u as uj}from"./command-B9mkhjGp.js";import{i as cj,u as fj}from"./Code01-C-mqJnK8.js";import{h as Yd}from"./use-connection-XCZq2oM3.js";import{a as S1,u as P1}from"./constants-DxgwQ0uV.js";import{b as O1}from"./use-virtual-mcp-CDRC9fSF.js";import{c as dj}from"./Grid01-BcwhAHU4.js";import{s as hj}from"./Plus-Bzxd7t2s.js";import{s as vj}from"./Trash01-CzXeR5aG.js";import{I as aa}from"./input-CCH8wBeN.js";import{C as Gv}from"./checkbox-CaN6ZzyM.js";import{e as mj,S as Vv,a as Xv,b as Zv,c as Qv,d as ai}from"./select-B_vbJmw6.js";import{n as pj}from"./Calendar-h8FQa5-L.js";import{T as gj}from"./textarea-Ct8RODCq.js";import{C as yj}from"./collection-tabs-TzBHBqNn.js";import{u as bj}from"./use-mcp-tools-DX0GOqaY.js";import{t as xj}from"./Users03-DvKocm1e.js";import"./Loading01-D-xfXVAb.js";import"./SearchMd-D3LhC38x.js";import"./spinner-tIX7WyGo.js";import"./infiniteQueryObserver-DWcK8VlL.js";import"./useMutation-BvIaEUwy.js";import"./useQuery-CPf79nZ3.js";const C1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"m15 18-6-6 6-6"}));C1.displayName="ChevronLeft";const j1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M9.5 15V9m5 6V9m7.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));j1.displayName="PauseCircle";const A1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),g.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}));A1.displayName="PlayCircle";const N1=({size:e=24,color:t="currentColor",...r})=>g.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},g.createElement("path",{d:"M4 7c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C5.602 4 6.068 4 7 4h10c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C20 5.602 20 6.068 20 7M9 20h6M12 4v16"}));N1.displayName="Type01";const Xf={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function Lr(e){return e.filter(t=>t.key.trim()).map(t=>{const r=encodeURIComponent(t.key.trim()),n=encodeURIComponent(t.value||"");return`${r}:${t.operator}:${n}`}).join(",")}function wj(e){return e?e.split(",").map(t=>{const[r,n,...a]=t.split(":");return{key:decodeURIComponent(r||""),operator:n||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function ii(e){return e.filter(t=>t.key.trim()).map(t=>{switch(t.operator){case"eq":return`${t.key}=${t.value}`;case"contains":return`${t.key}~${t.value}`;case"exists":return`${t.key}?`;case"in":return`${t.key}@${t.value}`}}).join(`
2
2
  `)}function Jv(e){return e.trim()?e.split(`
3
3
  `).map(t=>t.trim()).filter(t=>t.length>0).map(t=>{if(t.endsWith("?"))return{key:t.slice(0,-1),operator:"exists",value:""};if(t.includes("=")){const[r,...n]=t.split("=");return{key:r||"",operator:"eq",value:n.join("=")}}if(t.includes("~")){const[r,...n]=t.split("~");return{key:r||"",operator:"contains",value:n.join("~")}}if(t.includes("@")){const[r,...n]=t.split("@");return{key:r||"",operator:"in",value:n.join("@")}}return{key:t,operator:"exists",value:""}}):[]}function _j(e){const t={},r={},n=[],a={};for(const i of e)if(i.key.trim())switch(i.operator){case"eq":i.value&&(t[i.key]=i.value);break;case"contains":i.value&&(r[i.key]=`%${i.value}%`);break;case"exists":n.push(i.key);break;case"in":i.value&&(a[i.key]=i.value);break}return{properties:Object.keys(t).length>0?t:void 0,propertyPatterns:Object.keys(r).length>0?r:void 0,propertyKeys:n.length>0?n:void 0,propertyInValues:Object.keys(a).length>0?a:void 0}}function em(e){if(!e)return{content:"null",isTruncated:!1,originalSize:4};const t=JSON.stringify(e,null,2),r=t.length;return r<=Xf.maxJsonRenderSize?{content:t,isTruncated:!1,originalSize:r}:{content:t.slice(0,Xf.maxJsonRenderSize)+`
4
4
 
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-CHQ9-Q-G.js";import{i as n}from"./Loading01-3CQcIIbt.js";import{h as l}from"./mcp-oauth-i2Um3a9A.js";function h(){const[s,c]=i.useState(null),[r,a]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[r&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!r&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":r?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):r?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};
1
+ import{r as i,j as e}from"./index-DZKwM-s7.js";import{i as n}from"./Loading01-D-xfXVAb.js";import{h as l}from"./mcp-oauth-BxlFzaKv.js";function h(){const[s,c]=i.useState(null),[r,a]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[r&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!r&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":r?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):r?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};
@@ -1 +1 @@
1
- import{c as q,r as D,u as X,E as fe,K as le,br as ue,j as s,v as oe,g as xe,bs as ge,aH as pe}from"./index-CHQ9-Q-G.js";import{P as Q}from"./index-aWpPBjkT.js";import{B as he,a as je,b as ve,e as ye}from"./breadcrumb-CJBikxW8.js";import{i as ie}from"./FilterLines-uGkpVOX8.js";import{n as be}from"./Inbox01-CUvjj3IH.js";import{i as Z}from"./Loading01-3CQcIIbt.js";import{i as ae}from"./SearchMd-DTs0TtNF.js";import{u as Ne}from"./useInfiniteQuery-wjoMRbc3.js";import{a as Ce,f as Se,b as we}from"./registry-utils-TFnNkGPj.js";import{u as Te,h as Ie,b as Re}from"./constants-DwkB1age.js";import{f as Pe,g as ce,h as $e}from"./use-connection-UwIAiUmR.js";import{s as ke}from"./slugify-CEUa2lfQ.js";import{C as Le}from"./collection-search-CECpIAiD.js";import{M as re}from"./mcp-server-card-B_tcMycX.js";import{c as me,B as U}from"./button-CKIyuXIq.js";import{I as ze}from"./input-BrgRsDcE.js";import{b as Fe,P as Ke,a as Ae}from"./popover-CjUGVjON.js";import{i as Ee}from"./Check-DTUUSvp-.js";import{t as Be}from"./ChevronDown-DeD12W57.js";import{s as J}from"./XClose-DvgsYIZw.js";import{d as De,a as Me,b as Ve,c as Oe,S as We}from"./select-JdRjOrBE.js";import{s as He}from"./Plus-CP35U6Iv.js";import{E as _e}from"./empty-state-VwVcPCE1.js";import{u as qe}from"./use-binding-HsWp1jWu.js";import{L as Ge,u as Qe}from"./localstorage-keys-BiLB-Ybm.js";import"./ChevronRight-8Yl-zCCi.js";import"./infiniteQueryObserver-CKMx30vn.js";import"./useMutation-C8K1KoTI.js";import"./Globe02-BhcJ1ruM.js";import"./Lock01-aFdw7wqo.js";import"./Terminal-Djd_0g5K.js";import"./card-MU9VbmJ4.js";import"./github-icon-Dp3wHhYE.js";import"./binder-Dg2rfYkp.js";import"./useQuery-CImYAWdS.js";function Ue(t,e){const l=q.c(4),[n,c]=D.useState(t),r=D.useRef(null),a=D.useRef(!0);let i,m;return l[0]!==e||l[1]!==t?(i=()=>{if(a.current){a.current=!1;return}return r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{c(t)},e),()=>{r.current&&clearTimeout(r.current)}},m=[t,e],l[0]=e,l[1]=t,l[2]=i,l[3]=m):(i=l[2],m=l[3]),D.useEffect(i,m),n}function Ye(t){const e=q.c(14),l=D.useRef(null),n=`scroll-position:${t}`,c=D.useRef(null);let r;e[0]!==n?(r=()=>{l.current&&sessionStorage.setItem(n,String(l.current.scrollTop))},e[0]=n,e[1]=r):r=e[1];const a=r;let i;e[2]!==n?(i=()=>{if(c.current===n)return;const d=sessionStorage.getItem(n);if(d&&l.current){const j=Number.parseInt(d,10);l.current.scrollTop=j}c.current=n},e[2]=n,e[3]=i):i=e[3];const m=i;let y;e[4]!==m||e[5]!==n?(y=()=>{c.current!==n&&m()},e[4]=m,e[5]=n,e[6]=y):y=e[6];const p=y;let o;e[7]!==m||e[8]!==n?(o=d=>{l.current=d,d&&c.current!==n&&requestAnimationFrame(()=>{m()})},e[7]=m,e[8]=n,e[9]=o):o=e[9];const b=o;let u;return e[10]!==p||e[11]!==a||e[12]!==b?(u={scrollRef:b,saveScrollPosition:a,handleScroll:p},e[10]=p,e[11]=a,e[12]=b,e[13]=u):u=e[13],u}const Je=24;function Ze(t){const e=q.c(53),{registryId:l,listToolName:n,filtersToolName:c,search:r}=t,{org:a}=X();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[0]=i):i=e[0];const[m,y]=D.useState(i);let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[1]=p):p=e[1];const[o,b]=D.useState(p),u=l||null;let d;e[2]!==a.id||e[3]!==u?(d={connectionId:u,orgId:a.id},e[2]=a.id,e[3]=u,e[4]=d):d=e[4];const j=Te(d),I=!!c;let N;e[5]!==c||e[6]!==l?(N=le.toolCall(l,c||"no-filters","{}"),e[5]=c,e[6]=l,e[7]=N):N=e[7];let C;e[8]!==j||e[9]!==c?(C=async()=>{if(!c)return{tags:[],categories:[]};const B=await j.callTool({name:c,arguments:{}});return B.structuredContent??B},e[8]=j,e[9]=c,e[10]=C):C=e[10];let L;e[11]!==N||e[12]!==C?(L={queryKey:N,queryFn:C,staleTime:36e5},e[11]=N,e[12]=C,e[13]=L):L=e[13];const{data:$}=fe(L);let v,S,w;if(e[14]!==n||e[15]!==l||e[16]!==r||e[17]!==o||e[18]!==m){const B=r?.trim()?{operator:"or",conditions:[{field:["name"],operator:"contains",value:r},{field:["title"],operator:"contains",value:r},{field:["description"],operator:"contains",value:r}]}:void 0;v={limit:Je,...m.length>0&&{tags:m},...o.length>0&&{categories:o},...B&&{where:B}},w=Ne,S=le.toolCall(l,n,JSON.stringify(v)),e[14]=n,e[15]=l,e[16]=r,e[17]=o,e[18]=m,e[19]=v,e[20]=S,e[21]=w}else v=e[19],S=e[20],w=e[21];let T;e[22]!==j||e[23]!==v||e[24]!==n?(T=async B=>{const{pageParam:te}=B,de=te?{...v,cursor:te}:v,se=await j.callTool({name:n,arguments:de});return se.structuredContent??se},e[22]=j,e[23]=v,e[24]=n,e[25]=T):T=e[25];let z;e[26]!==T||e[27]!==S?(z={queryKey:S,queryFn:T,initialPageParam:void 0,getNextPageParam:Xe,staleTime:36e5,placeholderData:ue},e[26]=T,e[27]=S,e[28]=z):z=e[28];const{data:A,fetchNextPage:k,hasNextPage:f,isFetchingNextPage:x,isFetching:g,isLoading:R}=w(z);let P;e:{if(!A?.pages||A.pages.length===0){P=null;break e}const B=A.pages[0];if(typeof B=="object"&&B!==null&&"totalCount"in B&&typeof B.totalCount=="number"){P=B.totalCount;break e}P=null}const K=P,h=A?.pages;let F;e[29]!==h?(F=Ce(h),e[29]=h,e[30]=F):F=e[30];const E=F;let V;e[31]!==r||e[32]!==o.length||e[33]!==m.length?(V=m.length>0||o.length>0||!!r?.trim(),e[31]=r,e[32]=o.length,e[33]=m.length,e[34]=V):V=e[34];const O=V,H=g&&!x&&!R&&O;let _;e[35]!==k||e[36]!==f||e[37]!==x?(_=()=>{f&&!x&&k()},e[35]=k,e[36]=f,e[37]=x,e[38]=_):_=e[38];const M=_,W=f??!1,G=I?$?.tags:void 0,ee=I?$?.categories:void 0;let Y;return e[39]!==O||e[40]!==g||e[41]!==x||e[42]!==H||e[43]!==R||e[44]!==E||e[45]!==M||e[46]!==o||e[47]!==m||e[48]!==W||e[49]!==G||e[50]!==ee||e[51]!==K?(Y={items:E,totalCount:K,hasMore:W,isLoadingMore:x,isFiltering:H,isInitialLoading:R,isFetching:g,loadMore:M,availableTags:G,availableCategories:ee,selectedTags:m,selectedCategories:o,setSelectedTags:y,setSelectedCategories:b,hasActiveFilters:O},e[39]=O,e[40]=g,e[41]=x,e[42]=H,e[43]=R,e[44]=E,e[45]=M,e[46]=o,e[47]=m,e[48]=W,e[49]=G,e[50]=ee,e[51]=K,e[52]=Y):Y=e[52],Y}function Xe(t){if(typeof t=="object"&&t!==null){const e=t.nextCursor||t.cursor;if(e)return e}}function et(t,e){return[...t].sort((l,n)=>n.count-l.count).slice(0,e)}function ne(t){const e=q.c(52),{label:l,items:n,selectedItems:c,onToggle:r,onClear:a}=t,[i,m]=D.useState(""),[y,p]=D.useState(!1);let o,b,u,d,j,I,N,C,L,$,v;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==y||e[4]!==i||e[5]!==c){const k=[...i?n.filter(F=>F.value.toLowerCase().includes(i.toLowerCase())):n].sort(tt);u=c.length,b=Fe,L=y,$=p;let f;e[17]!==l?(f=s.jsx("span",{children:l}),e[17]=l,e[18]=f):f=e[18];let x;e[19]!==u?(x=u>0&&s.jsx("span",{className:"ml-1 rounded-full bg-primary text-primary-foreground px-1.5 py-0.5 text-[10px] font-medium",children:u}),e[19]=u,e[20]=x):x=e[20];let g;e[21]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Be,{size:14,className:"opacity-50"}),e[21]=g):g=e[21],e[22]!==x||e[23]!==f?(v=s.jsx(Ke,{asChild:!0,children:s.jsxs(U,{variant:"outline",size:"sm",className:"h-7 px-3 gap-1.5 text-xs font-normal flex-1",children:[f,x,g]})}),e[22]=x,e[23]=f,e[24]=v):v=e[24],o=Ae,I="w-64 p-0",N="start";let R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(ae,{size:16,className:"text-muted-foreground shrink-0"}),e[25]=R):R=e[25];let P;e[26]!==l?(P=l.toLowerCase(),e[26]=l,e[27]=P):P=e[27];const K=`Search ${P}...`;let h;e[28]===Symbol.for("react.memo_cache_sentinel")?(h=F=>m(F.target.value),e[28]=h):h=e[28],e[29]!==i||e[30]!==K?(C=s.jsx("div",{className:"shrink-0 w-full border-b border-border h-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-10 px-4 cursor-text",children:[R,s.jsx(ze,{type:"text",placeholder:K,value:i,onChange:h,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[29]=i,e[30]=K,e[31]=C):C=e[31],d="max-h-64 overflow-y-auto p-1 flex flex-col gap-1",j=k.length===0?s.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground text-center",children:"No results found"}):k.map(F=>{const E=c.includes(F.value);return s.jsxs("button",{onClick:()=>r(F.value),className:me("w-full flex items-center justify-between px-2 py-1.5 text-sm rounded cursor-pointer transition-colors",E?"bg-accent/50 text-foreground":"hover:bg-muted text-foreground"),children:[s.jsxs("span",{className:"truncate flex items-center gap-2",children:[E&&s.jsx(Ee,{size:16,className:"text-muted-foreground shrink-0"}),F.value]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-2 shrink-0",children:F.count})]},F.value)}),e[0]=n,e[1]=l,e[2]=r,e[3]=y,e[4]=i,e[5]=c,e[6]=o,e[7]=b,e[8]=u,e[9]=d,e[10]=j,e[11]=I,e[12]=N,e[13]=C,e[14]=L,e[15]=$,e[16]=v}else o=e[6],b=e[7],u=e[8],d=e[9],j=e[10],I=e[11],N=e[12],C=e[13],L=e[14],$=e[15],v=e[16];let S;e[32]!==d||e[33]!==j?(S=s.jsx("div",{className:d,children:j}),e[32]=d,e[33]=j,e[34]=S):S=e[34];let w;e[35]!==l||e[36]!==a||e[37]!==u?(w=u>0&&s.jsx("div",{className:"p-2 border-t border-border",children:s.jsxs(U,{variant:"ghost",size:"sm",onClick:a,className:"w-full text-xs text-muted-foreground hover:text-foreground",children:["Clear ",l.toLowerCase()]})}),e[35]=l,e[36]=a,e[37]=u,e[38]=w):w=e[38];let T;e[39]!==o||e[40]!==w||e[41]!==I||e[42]!==N||e[43]!==C||e[44]!==S?(T=s.jsxs(o,{className:I,align:N,children:[C,S,w]}),e[39]=o,e[40]=w,e[41]=I,e[42]=N,e[43]=C,e[44]=S,e[45]=T):T=e[45];let z;return e[46]!==b||e[47]!==T||e[48]!==L||e[49]!==$||e[50]!==v?(z=s.jsxs(b,{open:L,onOpenChange:$,children:[v,T]}),e[46]=b,e[47]=T,e[48]=L,e[49]=$,e[50]=v,e[51]=z):z=e[51],z}function tt(t,e){return e.count-t.count}function st(t){const e=q.c(67),{availableTags:l,availableCategories:n,selectedTags:c,selectedCategories:r,onTagChange:a,onCategoryChange:i}=t,m=l&&l.length>0||n&&n.length>0,y=c.length>0||r.length>0;if(!m)return null;let p;e[0]!==a||e[1]!==c?(p=f=>{c.includes(f)?a(c.filter(x=>x!==f)):a([...c,f])},e[0]=a,e[1]=c,e[2]=p):p=e[2];const o=p;let b;e[3]!==i||e[4]!==r?(b=f=>{r.includes(f)?i(r.filter(x=>x!==f)):i([...r,f])},e[3]=i,e[4]=r,e[5]=b):b=e[5];const u=b;let d;e[6]!==i||e[7]!==a?(d=()=>{a([]),i([])},e[6]=i,e[7]=a,e[8]=d):d=e[8];const j=d;let I,N,C,L,$,v,S;if(e[9]!==n||e[10]!==l||e[11]!==i||e[12]!==a||e[13]!==r||e[14]!==c||e[15]!==u||e[16]!==o){const f=n?et(n,6):[];I=r,N=c,S=new Set(f.map(lt)),$="flex items-center border-b border-border";let x;e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:s.jsx(ie,{size:16})}),e[24]=x):x=e[24];let g;e[25]!==n||e[26]!==i||e[27]!==r||e[28]!==u?(g=n&&n.length>0&&s.jsx(ne,{label:"Categories",items:n,selectedItems:r,onToggle:u,onClear:()=>i([])}),e[25]=n,e[26]=i,e[27]=r,e[28]=u,e[29]=g):g=e[29];let R;e[30]!==l||e[31]!==a||e[32]!==c||e[33]!==o?(R=l&&l.length>0&&s.jsx(ne,{label:"Tags",items:l,selectedItems:c,onToggle:o,onClear:()=>a([])}),e[30]=l,e[31]=a,e[32]=c,e[33]=o,e[34]=R):R=e[34],e[35]!==R||e[36]!==g?(v=s.jsxs("div",{className:"flex items-center gap-3 flex-wrap px-5 py-3 border-r border-border",children:[x,g,R]}),e[35]=R,e[36]=g,e[37]=v):v=e[37],C="flex items-center gap-3 flex-wrap px-5 py-3";let P;e[38]!==r||e[39]!==u?(P=K=>{const h=r.includes(K.value);return s.jsxs("div",{onClick:()=>u(K.value),className:me("inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer",h?"bg-primary text-primary-foreground hover:bg-primary/80":"bg-muted hover:bg-accent text-muted-foreground"),children:[s.jsx("span",{children:K.value}),h&&s.jsx("span",{onClick:F=>{F.stopPropagation(),u(K.value)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},K.value)},e[38]=r,e[39]=u,e[40]=P):P=e[40],L=f.map(P),e[9]=n,e[10]=l,e[11]=i,e[12]=a,e[13]=r,e[14]=c,e[15]=u,e[16]=o,e[17]=I,e[18]=N,e[19]=C,e[20]=L,e[21]=$,e[22]=v,e[23]=S}else I=e[17],N=e[18],C=e[19],L=e[20],$=e[21],v=e[22],S=e[23];let w;if(e[41]!==I||e[42]!==u||e[43]!==S){let f;e[45]!==S?(f=g=>!S.has(g),e[45]=S,e[46]=f):f=e[46];let x;e[47]!==u?(x=g=>s.jsxs("div",{onClick:()=>u(g),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[s.jsx("span",{children:g}),s.jsx("span",{onClick:R=>{R.stopPropagation(),u(g)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},`cat-${g}`),e[47]=u,e[48]=x):x=e[48],w=I.filter(f).map(x),e[41]=I,e[42]=u,e[43]=S,e[44]=w}else w=e[44];let T;if(e[49]!==N||e[50]!==o){let f;e[52]!==o?(f=x=>s.jsxs("div",{onClick:()=>o(x),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[s.jsx("span",{children:x}),s.jsx("span",{onClick:g=>{g.stopPropagation(),o(x)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},`tag-${x}`),e[52]=o,e[53]=f):f=e[53],T=N.map(f),e[49]=N,e[50]=o,e[51]=T}else T=e[51];let z;e[54]!==j||e[55]!==y?(z=y&&s.jsxs(U,{variant:"ghost",size:"sm",onClick:j,className:"h-7 text-xs text-muted-foreground hover:text-foreground gap-1 px-2",children:[s.jsx(J,{size:14}),"Clear all"]}),e[54]=j,e[55]=y,e[56]=z):z=e[56];let A;e[57]!==z||e[58]!==C||e[59]!==L||e[60]!==w||e[61]!==T?(A=s.jsxs("div",{className:C,children:[L,w,T,z]}),e[57]=z,e[58]=C,e[59]=L,e[60]=w,e[61]=T,e[62]=A):A=e[62];let k;return e[63]!==A||e[64]!==$||e[65]!==v?(k=s.jsxs("div",{className:$,children:[v,A]}),e[63]=A,e[64]=$,e[65]=v,e[66]=k):k=e[66],k}function lt(t){return t.value}function rt(t,e){if(!e)return t;const l=e.toLowerCase();return t.filter(n=>(n.name||n.title||"").toLowerCase().includes(l)||(n.description||n.server.description||"").toLowerCase().includes(l))}function nt(t){return t.verified===!0||t._meta?.["mcp.mesh"]?.verified===!0}function ot(t){const e=q.c(54),{registryId:l,listToolName:n,filtersToolName:c}=t,[r,a]=D.useState(""),i=Ue(r,300),m=oe(),{org:y}=X(),{scrollRef:p,saveScrollPosition:o,handleScroll:b}=Ye(`store-discovery:${l}`);let u;e[0]!==i||e[1]!==c||e[2]!==n||e[3]!==l?(u={registryId:l,listToolName:n,filtersToolName:c,search:i},e[0]=i,e[1]=c,e[2]=n,e[3]=l,e[4]=u):u=e[4];const{items:d,hasMore:j,isLoadingMore:I,isInitialLoading:N,isFetching:C,loadMore:L,availableTags:$,availableCategories:v,selectedTags:S,selectedCategories:w,setSelectedTags:T,setSelectedCategories:z,hasActiveFilters:A}=Ze(u);let k,f,x,g;e[5]!==i||e[6]!==C||e[7]!==N||e[8]!==d||e[9]!==r?(k=r?rt(d,r):d,f=(r!==i||C)&&!N&&!!r,g=k.filter(nt),x=k.filter(M=>!g.find(W=>W.id===M.id)),e[5]=i,e[6]=C,e[7]=N,e[8]=d,e[9]=r,e[10]=k,e[11]=f,e[12]=x,e[13]=g):(k=e[10],f=e[11],x=e[12],g=e[13]);const R=x;let P;e[14]!==m||e[15]!==y.slug||e[16]!==l||e[17]!==o?(P=M=>{o();const W=ke(M.name||M.title||M.server.title||""),G=M.server.name;m({to:"/$org/store/$appName",params:{org:y.slug,appName:W},search:{registryId:l,serverName:G}})},e[14]=m,e[15]=y.slug,e[16]=l,e[17]=o,e[18]=P):P=e[18];const K=P;let h;e[19]!==b||e[20]!==j||e[21]!==I||e[22]!==L?(h=M=>{if(b(),!j||I)return;const W=M.currentTarget;W.scrollHeight-W.scrollTop-W.clientHeight<200&&L()},e[19]=b,e[20]=j,e[21]=I,e[22]=L,e[23]=h):h=e[23];const F=h;let E;e[24]!==f||e[25]!==r?(E=s.jsx(Le,{value:r,onChange:a,placeholder:"Search for an MCP Server...",isSearching:f}),e[24]=f,e[25]=r,e[26]=E):E=e[26];let V;e[27]!==v||e[28]!==$||e[29]!==w||e[30]!==S||e[31]!==z||e[32]!==T?(V=s.jsx(st,{availableTags:$,availableCategories:v,selectedTags:S,selectedCategories:w,onTagChange:T,onCategoryChange:z}),e[27]=v,e[28]=$,e[29]=w,e[30]=S,e[31]=z,e[32]=T,e[33]=V):V=e[33];let O;e[34]!==R||e[35]!==k||e[36]!==K||e[37]!==A||e[38]!==j||e[39]!==N||e[40]!==I||e[41]!==f||e[42]!==d||e[43]!==r||e[44]!==g?(O=s.jsx("div",{className:"p-5",children:s.jsx("div",{children:N?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):d.length===0&&!A?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(be,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No items available"}),s.jsx("p",{className:"text-muted-foreground",children:"This store doesn't have any available items yet."})]}):d.length===0&&A&&!r?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(ie,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No matching items"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your filters to find more results."})]}):r&&k.length===0&&!f?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(ae,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No results found"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search terms."})]}):s.jsxs("div",{className:"flex flex-col gap-8",children:[f&&k.length===0&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Searching..."})]}),g.length>0&&s.jsx(re,{items:g,title:"Verified",onItemClick:K}),R.length>0&&s.jsx(re,{items:R,title:g.length>0?"All":"",onItemClick:K}),j&&I&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Z,{size:20,className:"animate-spin"}),s.jsx("span",{className:"text-sm",children:"Loading more items..."})]})})]})})}),e[34]=R,e[35]=k,e[36]=K,e[37]=A,e[38]=j,e[39]=N,e[40]=I,e[41]=f,e[42]=d,e[43]=r,e[44]=g,e[45]=O):O=e[45];let H;e[46]!==F||e[47]!==p||e[48]!==O?(H=s.jsx("div",{ref:p,className:"flex-1 overflow-y-auto",onScroll:F,children:O}),e[46]=F,e[47]=p,e[48]=O,e[49]=H):H=e[49];let _;return e[50]!==E||e[51]!==V||e[52]!==H?(_=s.jsxs("div",{className:"flex flex-col h-full",children:[E,V,H]}),e[50]=E,e[51]=V,e[52]=H,e[53]=_):_=e[53],_}function it(t){const e=q.c(8),{registryId:l}=t,n=Pe(l),c=n?.tools;let r;e[0]!==c?(r=Se(c),e[0]=c,e[1]=r):r=e[1];const a=r;if(!a)throw new Error("This registry does not support listing store items.");const i=n?.tools;let m;e[2]!==i?(m=we(i),e[2]=i,e[3]=m):m=e[3];const p=m||void 0;let o;return e[4]!==a||e[5]!==l||e[6]!==p?(o=s.jsx(ot,{registryId:l,listToolName:a,filtersToolName:p}),e[4]=a,e[5]=l,e[6]=p,e[7]=o):o=e[7],o}function at(t){const e=q.c(15),{registries:l,value:n,onValueChange:c,onAddWellKnown:r,wellKnownRegistries:a,placeholder:i}=t,m=i===void 0?"Select a registry...":i;let y;e[0]!==m?(y=s.jsx(Me,{size:"sm",className:"w-auto min-w-[160px]",children:s.jsx(Ve,{placeholder:m})}),e[0]=m,e[1]=y):y=e[1];let p;e[2]!==l?(p=l.map(ct),e[2]=l,e[3]=p):p=e[3];let o;e[4]!==r||e[5]!==a?(o=a.length>0&&s.jsxs("div",{className:"border-t border-border pt-1",children:[s.jsx("p",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Other known registries"}),a.map(d=>s.jsxs("button",{onClick:j=>{j.preventDefault(),j.stopPropagation(),r(d)},className:"relative flex w-full cursor-pointer items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[d.icon?s.jsx("img",{src:d.icon,alt:d.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:d.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"flex-1",children:d.title})]}),s.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center text-muted-foreground",children:s.jsx(He,{size:16})})]},d.id??d.title))]}),e[4]=r,e[5]=a,e[6]=o):o=e[6];let b;e[7]!==p||e[8]!==o?(b=s.jsxs(Oe,{children:[p,o]}),e[7]=p,e[8]=o,e[9]=b):b=e[9];let u;return e[10]!==c||e[11]!==y||e[12]!==b||e[13]!==n?(u=s.jsxs(We,{value:n,onValueChange:c,children:[y,b]}),e[10]=c,e[11]=y,e[12]=b,e[13]=n,e[14]=u):u=e[14],u}function ct(t){return s.jsx(De,{className:"cursor-pointer",value:t.id??t.name,children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?s.jsx("img",{src:t.icon,alt:t.name,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.name.slice(0,1).toUpperCase()}),s.jsx("span",{children:t.name})]})},t.id??t.name)}function mt({registries:t,onConnected:e}){const l=ce(),{org:{slug:n}}=X(),{data:c}=xe.useSession(),r=oe(),[a,i]=D.useState(!1),m=t[0],y=async()=>{if(!(!m||!c?.user?.id)){i(!0);try{const o=await l.create.mutateAsync(m);e?.(o.id)}finally{i(!1)}}},p=()=>{r({to:"/$org/mcps",params:{org:n},search:{action:"create"}})};return s.jsx(_e,{image:s.jsx("img",{src:"/store-empty-state.svg",alt:"No store connected",width:336,height:320,className:"max-w-full h-auto"}),title:"Connect to registry",description:"Connect to discover and use Connections from the community.",actions:s.jsxs(s.Fragment,{children:[s.jsxs(U,{variant:"outline",onClick:y,disabled:a||!m,children:[m?.icon&&s.jsx("img",{src:m.icon,alt:"",className:"size-4"}),a?"Installing...":"Install Registry"]}),s.jsx(U,{variant:"outline",onClick:p,children:"Custom Connection"})]})})}function Ut(){const t=q.c(42),{org:e}=X(),l=$e(),n=ce(),c=ge(),r=c.location.pathname.includes("/store/")&&c.location.pathname.split("/").length>3,a=qe(l);let i;t[0]!==a?(i=a.map(ut),t[0]=a,t[1]=i):i=t[1];const m=i;let y;t[2]!==e.slug?(y=Ge.selectedRegistry(e.slug),t[2]=e.slug,t[3]=y):y=t[3];const[p,o]=Qe(y,ft);let b;if(t[4]!==a||t[5]!==p){let h;t[7]!==p?(h=F=>F.id===p,t[7]=p,t[8]=h):h=t[8],b=a.find(h),t[4]=a,t[5]=p,t[6]=b}else b=t[6];const d=b?.id||a[0]?.id||"";let j;t[9]!==e.id?(j=Ie(e.id),t[9]=e.id,t[10]=j):j=t[10];let I;t[11]!==j?(I=[j],t[11]=j,t[12]=I):I=t[12];const N=I;let C;t[13]===Symbol.for("react.memo_cache_sentinel")?(C=[Re()],t[13]=C):C=t[13];const L=C;let $;t[14]!==n.create||t[15]!==o?($=async h=>{const F=await n.create.mutateAsync(h);o(F.id)},t[14]=n.create,t[15]=o,t[16]=$):$=t[16];const v=$;let S;t[17]!==a?(S=new Set(a.map(dt)),t[17]=a,t[18]=S):S=t[18];const w=S;let T;t[19]!==w||t[20]!==N?(T=N.filter(h=>h.id&&!w.has(h.id)),t[19]=w,t[20]=N,t[21]=T):T=t[21];const z=T;let A;t[22]!==w?(A=L.filter(h=>h.id&&!w.has(h.id)),t[22]=w,t[23]=A):A=t[23];const k=A;if(r){let h;return t[24]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(pe,{}),t[24]=h):h=t[24],h}let f;t[25]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Q.Header.Left,{children:s.jsx(he,{children:s.jsx(je,{children:s.jsx(ve,{children:s.jsx(ye,{children:"Store"})})})})}),t[25]=f):f=t[25];let x;t[26]!==v?(x=async h=>v(h),t[26]=v,t[27]=x):x=t[27];let g;t[28]!==z||t[29]!==d||t[30]!==m||t[31]!==o||t[32]!==x?(g=s.jsxs(Q.Header,{children:[f,s.jsx(Q.Header.Right,{children:s.jsx(at,{wellKnownRegistries:z,registries:m,value:d,onValueChange:o,onAddWellKnown:x,placeholder:"Select store..."})})]}),t[28]=z,t[29]=d,t[30]=m,t[31]=o,t[32]=x,t[33]=g):g=t[33];let R;t[34]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading store items..."})]}),t[34]=R):R=t[34];let P;t[35]!==k||t[36]!==d||t[37]!==o?(P=s.jsx(Q.Content,{children:s.jsx(D.Suspense,{fallback:R,children:d?s.jsx(it,{registryId:d}):s.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:s.jsx(mt,{registries:k,onConnected:h=>{o(h)}})})})}),t[35]=k,t[36]=d,t[37]=o,t[38]=P):P=t[38];let K;return t[39]!==g||t[40]!==P?(K=s.jsxs(Q,{children:[g,P]}),t[39]=g,t[40]=P,t[41]=K):K=t[41],K}function dt(t){return t.id}function ft(t){return t??""}function ut(t){return{id:t.id,name:t.title,icon:t.icon||void 0}}export{Ut as default};
1
+ import{c as q,r as D,u as X,E as fe,K as le,br as ue,j as s,v as oe,g as xe,bs as ge,aH as pe}from"./index-DZKwM-s7.js";import{P as Q}from"./index-QlAcVvwl.js";import{B as he,a as je,b as ve,e as ye}from"./breadcrumb-Cp0sD1P8.js";import{i as ie}from"./FilterLines-UXqFmiMf.js";import{n as be}from"./Inbox01-CBfpFDWi.js";import{i as Z}from"./Loading01-D-xfXVAb.js";import{i as ae}from"./SearchMd-D3LhC38x.js";import{u as Ne}from"./useInfiniteQuery-1H3bf64-.js";import{a as Ce,f as Se,b as we}from"./registry-utils-DUAoVdTh.js";import{u as Te,h as Ie,b as Re}from"./constants-DxgwQ0uV.js";import{f as Pe,g as ce,h as $e}from"./use-connection-XCZq2oM3.js";import{s as ke}from"./slugify-CEUa2lfQ.js";import{C as Le}from"./collection-search-Cm7834fO.js";import{M as re}from"./mcp-server-card-BiWf5qTJ.js";import{c as me,B as U}from"./button-CvZ7ap4z.js";import{I as ze}from"./input-CCH8wBeN.js";import{b as Fe,P as Ke,a as Ae}from"./popover-DceEFrFl.js";import{i as Ee}from"./Check-BYQw8z-Y.js";import{t as Be}from"./ChevronDown-B01wwgGg.js";import{s as J}from"./XClose-BnWgQmD9.js";import{d as De,a as Me,b as Ve,c as Oe,S as We}from"./select-B_vbJmw6.js";import{s as He}from"./Plus-Bzxd7t2s.js";import{E as _e}from"./empty-state-DYOBL1E0.js";import{u as qe}from"./use-binding-B1CUjViK.js";import{L as Ge,u as Qe}from"./localstorage-keys-Bp3EEwvJ.js";import"./ChevronRight-BgsyooQy.js";import"./infiniteQueryObserver-DWcK8VlL.js";import"./useMutation-BvIaEUwy.js";import"./Globe02-BsDDXBRS.js";import"./Lock01-DZjbvWbD.js";import"./Terminal-B67MbBEE.js";import"./card-B7JF-Bqk.js";import"./github-icon-Dp3wHhYE.js";import"./binder-CacmcUyU.js";import"./useQuery-CPf79nZ3.js";function Ue(t,e){const l=q.c(4),[n,c]=D.useState(t),r=D.useRef(null),a=D.useRef(!0);let i,m;return l[0]!==e||l[1]!==t?(i=()=>{if(a.current){a.current=!1;return}return r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{c(t)},e),()=>{r.current&&clearTimeout(r.current)}},m=[t,e],l[0]=e,l[1]=t,l[2]=i,l[3]=m):(i=l[2],m=l[3]),D.useEffect(i,m),n}function Ye(t){const e=q.c(14),l=D.useRef(null),n=`scroll-position:${t}`,c=D.useRef(null);let r;e[0]!==n?(r=()=>{l.current&&sessionStorage.setItem(n,String(l.current.scrollTop))},e[0]=n,e[1]=r):r=e[1];const a=r;let i;e[2]!==n?(i=()=>{if(c.current===n)return;const d=sessionStorage.getItem(n);if(d&&l.current){const j=Number.parseInt(d,10);l.current.scrollTop=j}c.current=n},e[2]=n,e[3]=i):i=e[3];const m=i;let y;e[4]!==m||e[5]!==n?(y=()=>{c.current!==n&&m()},e[4]=m,e[5]=n,e[6]=y):y=e[6];const p=y;let o;e[7]!==m||e[8]!==n?(o=d=>{l.current=d,d&&c.current!==n&&requestAnimationFrame(()=>{m()})},e[7]=m,e[8]=n,e[9]=o):o=e[9];const b=o;let u;return e[10]!==p||e[11]!==a||e[12]!==b?(u={scrollRef:b,saveScrollPosition:a,handleScroll:p},e[10]=p,e[11]=a,e[12]=b,e[13]=u):u=e[13],u}const Je=24;function Ze(t){const e=q.c(53),{registryId:l,listToolName:n,filtersToolName:c,search:r}=t,{org:a}=X();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[0]=i):i=e[0];const[m,y]=D.useState(i);let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[1]=p):p=e[1];const[o,b]=D.useState(p),u=l||null;let d;e[2]!==a.id||e[3]!==u?(d={connectionId:u,orgId:a.id},e[2]=a.id,e[3]=u,e[4]=d):d=e[4];const j=Te(d),I=!!c;let N;e[5]!==c||e[6]!==l?(N=le.toolCall(l,c||"no-filters","{}"),e[5]=c,e[6]=l,e[7]=N):N=e[7];let C;e[8]!==j||e[9]!==c?(C=async()=>{if(!c)return{tags:[],categories:[]};const B=await j.callTool({name:c,arguments:{}});return B.structuredContent??B},e[8]=j,e[9]=c,e[10]=C):C=e[10];let L;e[11]!==N||e[12]!==C?(L={queryKey:N,queryFn:C,staleTime:36e5},e[11]=N,e[12]=C,e[13]=L):L=e[13];const{data:$}=fe(L);let v,S,w;if(e[14]!==n||e[15]!==l||e[16]!==r||e[17]!==o||e[18]!==m){const B=r?.trim()?{operator:"or",conditions:[{field:["name"],operator:"contains",value:r},{field:["title"],operator:"contains",value:r},{field:["description"],operator:"contains",value:r}]}:void 0;v={limit:Je,...m.length>0&&{tags:m},...o.length>0&&{categories:o},...B&&{where:B}},w=Ne,S=le.toolCall(l,n,JSON.stringify(v)),e[14]=n,e[15]=l,e[16]=r,e[17]=o,e[18]=m,e[19]=v,e[20]=S,e[21]=w}else v=e[19],S=e[20],w=e[21];let T;e[22]!==j||e[23]!==v||e[24]!==n?(T=async B=>{const{pageParam:te}=B,de=te?{...v,cursor:te}:v,se=await j.callTool({name:n,arguments:de});return se.structuredContent??se},e[22]=j,e[23]=v,e[24]=n,e[25]=T):T=e[25];let z;e[26]!==T||e[27]!==S?(z={queryKey:S,queryFn:T,initialPageParam:void 0,getNextPageParam:Xe,staleTime:36e5,placeholderData:ue},e[26]=T,e[27]=S,e[28]=z):z=e[28];const{data:A,fetchNextPage:k,hasNextPage:f,isFetchingNextPage:x,isFetching:g,isLoading:R}=w(z);let P;e:{if(!A?.pages||A.pages.length===0){P=null;break e}const B=A.pages[0];if(typeof B=="object"&&B!==null&&"totalCount"in B&&typeof B.totalCount=="number"){P=B.totalCount;break e}P=null}const K=P,h=A?.pages;let F;e[29]!==h?(F=Ce(h),e[29]=h,e[30]=F):F=e[30];const E=F;let V;e[31]!==r||e[32]!==o.length||e[33]!==m.length?(V=m.length>0||o.length>0||!!r?.trim(),e[31]=r,e[32]=o.length,e[33]=m.length,e[34]=V):V=e[34];const O=V,H=g&&!x&&!R&&O;let _;e[35]!==k||e[36]!==f||e[37]!==x?(_=()=>{f&&!x&&k()},e[35]=k,e[36]=f,e[37]=x,e[38]=_):_=e[38];const M=_,W=f??!1,G=I?$?.tags:void 0,ee=I?$?.categories:void 0;let Y;return e[39]!==O||e[40]!==g||e[41]!==x||e[42]!==H||e[43]!==R||e[44]!==E||e[45]!==M||e[46]!==o||e[47]!==m||e[48]!==W||e[49]!==G||e[50]!==ee||e[51]!==K?(Y={items:E,totalCount:K,hasMore:W,isLoadingMore:x,isFiltering:H,isInitialLoading:R,isFetching:g,loadMore:M,availableTags:G,availableCategories:ee,selectedTags:m,selectedCategories:o,setSelectedTags:y,setSelectedCategories:b,hasActiveFilters:O},e[39]=O,e[40]=g,e[41]=x,e[42]=H,e[43]=R,e[44]=E,e[45]=M,e[46]=o,e[47]=m,e[48]=W,e[49]=G,e[50]=ee,e[51]=K,e[52]=Y):Y=e[52],Y}function Xe(t){if(typeof t=="object"&&t!==null){const e=t.nextCursor||t.cursor;if(e)return e}}function et(t,e){return[...t].sort((l,n)=>n.count-l.count).slice(0,e)}function ne(t){const e=q.c(52),{label:l,items:n,selectedItems:c,onToggle:r,onClear:a}=t,[i,m]=D.useState(""),[y,p]=D.useState(!1);let o,b,u,d,j,I,N,C,L,$,v;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==y||e[4]!==i||e[5]!==c){const k=[...i?n.filter(F=>F.value.toLowerCase().includes(i.toLowerCase())):n].sort(tt);u=c.length,b=Fe,L=y,$=p;let f;e[17]!==l?(f=s.jsx("span",{children:l}),e[17]=l,e[18]=f):f=e[18];let x;e[19]!==u?(x=u>0&&s.jsx("span",{className:"ml-1 rounded-full bg-primary text-primary-foreground px-1.5 py-0.5 text-[10px] font-medium",children:u}),e[19]=u,e[20]=x):x=e[20];let g;e[21]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Be,{size:14,className:"opacity-50"}),e[21]=g):g=e[21],e[22]!==x||e[23]!==f?(v=s.jsx(Ke,{asChild:!0,children:s.jsxs(U,{variant:"outline",size:"sm",className:"h-7 px-3 gap-1.5 text-xs font-normal flex-1",children:[f,x,g]})}),e[22]=x,e[23]=f,e[24]=v):v=e[24],o=Ae,I="w-64 p-0",N="start";let R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(ae,{size:16,className:"text-muted-foreground shrink-0"}),e[25]=R):R=e[25];let P;e[26]!==l?(P=l.toLowerCase(),e[26]=l,e[27]=P):P=e[27];const K=`Search ${P}...`;let h;e[28]===Symbol.for("react.memo_cache_sentinel")?(h=F=>m(F.target.value),e[28]=h):h=e[28],e[29]!==i||e[30]!==K?(C=s.jsx("div",{className:"shrink-0 w-full border-b border-border h-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-10 px-4 cursor-text",children:[R,s.jsx(ze,{type:"text",placeholder:K,value:i,onChange:h,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[29]=i,e[30]=K,e[31]=C):C=e[31],d="max-h-64 overflow-y-auto p-1 flex flex-col gap-1",j=k.length===0?s.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground text-center",children:"No results found"}):k.map(F=>{const E=c.includes(F.value);return s.jsxs("button",{onClick:()=>r(F.value),className:me("w-full flex items-center justify-between px-2 py-1.5 text-sm rounded cursor-pointer transition-colors",E?"bg-accent/50 text-foreground":"hover:bg-muted text-foreground"),children:[s.jsxs("span",{className:"truncate flex items-center gap-2",children:[E&&s.jsx(Ee,{size:16,className:"text-muted-foreground shrink-0"}),F.value]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-2 shrink-0",children:F.count})]},F.value)}),e[0]=n,e[1]=l,e[2]=r,e[3]=y,e[4]=i,e[5]=c,e[6]=o,e[7]=b,e[8]=u,e[9]=d,e[10]=j,e[11]=I,e[12]=N,e[13]=C,e[14]=L,e[15]=$,e[16]=v}else o=e[6],b=e[7],u=e[8],d=e[9],j=e[10],I=e[11],N=e[12],C=e[13],L=e[14],$=e[15],v=e[16];let S;e[32]!==d||e[33]!==j?(S=s.jsx("div",{className:d,children:j}),e[32]=d,e[33]=j,e[34]=S):S=e[34];let w;e[35]!==l||e[36]!==a||e[37]!==u?(w=u>0&&s.jsx("div",{className:"p-2 border-t border-border",children:s.jsxs(U,{variant:"ghost",size:"sm",onClick:a,className:"w-full text-xs text-muted-foreground hover:text-foreground",children:["Clear ",l.toLowerCase()]})}),e[35]=l,e[36]=a,e[37]=u,e[38]=w):w=e[38];let T;e[39]!==o||e[40]!==w||e[41]!==I||e[42]!==N||e[43]!==C||e[44]!==S?(T=s.jsxs(o,{className:I,align:N,children:[C,S,w]}),e[39]=o,e[40]=w,e[41]=I,e[42]=N,e[43]=C,e[44]=S,e[45]=T):T=e[45];let z;return e[46]!==b||e[47]!==T||e[48]!==L||e[49]!==$||e[50]!==v?(z=s.jsxs(b,{open:L,onOpenChange:$,children:[v,T]}),e[46]=b,e[47]=T,e[48]=L,e[49]=$,e[50]=v,e[51]=z):z=e[51],z}function tt(t,e){return e.count-t.count}function st(t){const e=q.c(67),{availableTags:l,availableCategories:n,selectedTags:c,selectedCategories:r,onTagChange:a,onCategoryChange:i}=t,m=l&&l.length>0||n&&n.length>0,y=c.length>0||r.length>0;if(!m)return null;let p;e[0]!==a||e[1]!==c?(p=f=>{c.includes(f)?a(c.filter(x=>x!==f)):a([...c,f])},e[0]=a,e[1]=c,e[2]=p):p=e[2];const o=p;let b;e[3]!==i||e[4]!==r?(b=f=>{r.includes(f)?i(r.filter(x=>x!==f)):i([...r,f])},e[3]=i,e[4]=r,e[5]=b):b=e[5];const u=b;let d;e[6]!==i||e[7]!==a?(d=()=>{a([]),i([])},e[6]=i,e[7]=a,e[8]=d):d=e[8];const j=d;let I,N,C,L,$,v,S;if(e[9]!==n||e[10]!==l||e[11]!==i||e[12]!==a||e[13]!==r||e[14]!==c||e[15]!==u||e[16]!==o){const f=n?et(n,6):[];I=r,N=c,S=new Set(f.map(lt)),$="flex items-center border-b border-border";let x;e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:s.jsx(ie,{size:16})}),e[24]=x):x=e[24];let g;e[25]!==n||e[26]!==i||e[27]!==r||e[28]!==u?(g=n&&n.length>0&&s.jsx(ne,{label:"Categories",items:n,selectedItems:r,onToggle:u,onClear:()=>i([])}),e[25]=n,e[26]=i,e[27]=r,e[28]=u,e[29]=g):g=e[29];let R;e[30]!==l||e[31]!==a||e[32]!==c||e[33]!==o?(R=l&&l.length>0&&s.jsx(ne,{label:"Tags",items:l,selectedItems:c,onToggle:o,onClear:()=>a([])}),e[30]=l,e[31]=a,e[32]=c,e[33]=o,e[34]=R):R=e[34],e[35]!==R||e[36]!==g?(v=s.jsxs("div",{className:"flex items-center gap-3 flex-wrap px-5 py-3 border-r border-border",children:[x,g,R]}),e[35]=R,e[36]=g,e[37]=v):v=e[37],C="flex items-center gap-3 flex-wrap px-5 py-3";let P;e[38]!==r||e[39]!==u?(P=K=>{const h=r.includes(K.value);return s.jsxs("div",{onClick:()=>u(K.value),className:me("inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer",h?"bg-primary text-primary-foreground hover:bg-primary/80":"bg-muted hover:bg-accent text-muted-foreground"),children:[s.jsx("span",{children:K.value}),h&&s.jsx("span",{onClick:F=>{F.stopPropagation(),u(K.value)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},K.value)},e[38]=r,e[39]=u,e[40]=P):P=e[40],L=f.map(P),e[9]=n,e[10]=l,e[11]=i,e[12]=a,e[13]=r,e[14]=c,e[15]=u,e[16]=o,e[17]=I,e[18]=N,e[19]=C,e[20]=L,e[21]=$,e[22]=v,e[23]=S}else I=e[17],N=e[18],C=e[19],L=e[20],$=e[21],v=e[22],S=e[23];let w;if(e[41]!==I||e[42]!==u||e[43]!==S){let f;e[45]!==S?(f=g=>!S.has(g),e[45]=S,e[46]=f):f=e[46];let x;e[47]!==u?(x=g=>s.jsxs("div",{onClick:()=>u(g),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[s.jsx("span",{children:g}),s.jsx("span",{onClick:R=>{R.stopPropagation(),u(g)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},`cat-${g}`),e[47]=u,e[48]=x):x=e[48],w=I.filter(f).map(x),e[41]=I,e[42]=u,e[43]=S,e[44]=w}else w=e[44];let T;if(e[49]!==N||e[50]!==o){let f;e[52]!==o?(f=x=>s.jsxs("div",{onClick:()=>o(x),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[s.jsx("span",{children:x}),s.jsx("span",{onClick:g=>{g.stopPropagation(),o(x)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},`tag-${x}`),e[52]=o,e[53]=f):f=e[53],T=N.map(f),e[49]=N,e[50]=o,e[51]=T}else T=e[51];let z;e[54]!==j||e[55]!==y?(z=y&&s.jsxs(U,{variant:"ghost",size:"sm",onClick:j,className:"h-7 text-xs text-muted-foreground hover:text-foreground gap-1 px-2",children:[s.jsx(J,{size:14}),"Clear all"]}),e[54]=j,e[55]=y,e[56]=z):z=e[56];let A;e[57]!==z||e[58]!==C||e[59]!==L||e[60]!==w||e[61]!==T?(A=s.jsxs("div",{className:C,children:[L,w,T,z]}),e[57]=z,e[58]=C,e[59]=L,e[60]=w,e[61]=T,e[62]=A):A=e[62];let k;return e[63]!==A||e[64]!==$||e[65]!==v?(k=s.jsxs("div",{className:$,children:[v,A]}),e[63]=A,e[64]=$,e[65]=v,e[66]=k):k=e[66],k}function lt(t){return t.value}function rt(t,e){if(!e)return t;const l=e.toLowerCase();return t.filter(n=>(n.name||n.title||"").toLowerCase().includes(l)||(n.description||n.server.description||"").toLowerCase().includes(l))}function nt(t){return t.verified===!0||t._meta?.["mcp.mesh"]?.verified===!0}function ot(t){const e=q.c(54),{registryId:l,listToolName:n,filtersToolName:c}=t,[r,a]=D.useState(""),i=Ue(r,300),m=oe(),{org:y}=X(),{scrollRef:p,saveScrollPosition:o,handleScroll:b}=Ye(`store-discovery:${l}`);let u;e[0]!==i||e[1]!==c||e[2]!==n||e[3]!==l?(u={registryId:l,listToolName:n,filtersToolName:c,search:i},e[0]=i,e[1]=c,e[2]=n,e[3]=l,e[4]=u):u=e[4];const{items:d,hasMore:j,isLoadingMore:I,isInitialLoading:N,isFetching:C,loadMore:L,availableTags:$,availableCategories:v,selectedTags:S,selectedCategories:w,setSelectedTags:T,setSelectedCategories:z,hasActiveFilters:A}=Ze(u);let k,f,x,g;e[5]!==i||e[6]!==C||e[7]!==N||e[8]!==d||e[9]!==r?(k=r?rt(d,r):d,f=(r!==i||C)&&!N&&!!r,g=k.filter(nt),x=k.filter(M=>!g.find(W=>W.id===M.id)),e[5]=i,e[6]=C,e[7]=N,e[8]=d,e[9]=r,e[10]=k,e[11]=f,e[12]=x,e[13]=g):(k=e[10],f=e[11],x=e[12],g=e[13]);const R=x;let P;e[14]!==m||e[15]!==y.slug||e[16]!==l||e[17]!==o?(P=M=>{o();const W=ke(M.name||M.title||M.server.title||""),G=M.server.name;m({to:"/$org/store/$appName",params:{org:y.slug,appName:W},search:{registryId:l,serverName:G}})},e[14]=m,e[15]=y.slug,e[16]=l,e[17]=o,e[18]=P):P=e[18];const K=P;let h;e[19]!==b||e[20]!==j||e[21]!==I||e[22]!==L?(h=M=>{if(b(),!j||I)return;const W=M.currentTarget;W.scrollHeight-W.scrollTop-W.clientHeight<200&&L()},e[19]=b,e[20]=j,e[21]=I,e[22]=L,e[23]=h):h=e[23];const F=h;let E;e[24]!==f||e[25]!==r?(E=s.jsx(Le,{value:r,onChange:a,placeholder:"Search for an MCP Server...",isSearching:f}),e[24]=f,e[25]=r,e[26]=E):E=e[26];let V;e[27]!==v||e[28]!==$||e[29]!==w||e[30]!==S||e[31]!==z||e[32]!==T?(V=s.jsx(st,{availableTags:$,availableCategories:v,selectedTags:S,selectedCategories:w,onTagChange:T,onCategoryChange:z}),e[27]=v,e[28]=$,e[29]=w,e[30]=S,e[31]=z,e[32]=T,e[33]=V):V=e[33];let O;e[34]!==R||e[35]!==k||e[36]!==K||e[37]!==A||e[38]!==j||e[39]!==N||e[40]!==I||e[41]!==f||e[42]!==d||e[43]!==r||e[44]!==g?(O=s.jsx("div",{className:"p-5",children:s.jsx("div",{children:N?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):d.length===0&&!A?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(be,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No items available"}),s.jsx("p",{className:"text-muted-foreground",children:"This store doesn't have any available items yet."})]}):d.length===0&&A&&!r?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(ie,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No matching items"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your filters to find more results."})]}):r&&k.length===0&&!f?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(ae,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No results found"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search terms."})]}):s.jsxs("div",{className:"flex flex-col gap-8",children:[f&&k.length===0&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Searching..."})]}),g.length>0&&s.jsx(re,{items:g,title:"Verified",onItemClick:K}),R.length>0&&s.jsx(re,{items:R,title:g.length>0?"All":"",onItemClick:K}),j&&I&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Z,{size:20,className:"animate-spin"}),s.jsx("span",{className:"text-sm",children:"Loading more items..."})]})})]})})}),e[34]=R,e[35]=k,e[36]=K,e[37]=A,e[38]=j,e[39]=N,e[40]=I,e[41]=f,e[42]=d,e[43]=r,e[44]=g,e[45]=O):O=e[45];let H;e[46]!==F||e[47]!==p||e[48]!==O?(H=s.jsx("div",{ref:p,className:"flex-1 overflow-y-auto",onScroll:F,children:O}),e[46]=F,e[47]=p,e[48]=O,e[49]=H):H=e[49];let _;return e[50]!==E||e[51]!==V||e[52]!==H?(_=s.jsxs("div",{className:"flex flex-col h-full",children:[E,V,H]}),e[50]=E,e[51]=V,e[52]=H,e[53]=_):_=e[53],_}function it(t){const e=q.c(8),{registryId:l}=t,n=Pe(l),c=n?.tools;let r;e[0]!==c?(r=Se(c),e[0]=c,e[1]=r):r=e[1];const a=r;if(!a)throw new Error("This registry does not support listing store items.");const i=n?.tools;let m;e[2]!==i?(m=we(i),e[2]=i,e[3]=m):m=e[3];const p=m||void 0;let o;return e[4]!==a||e[5]!==l||e[6]!==p?(o=s.jsx(ot,{registryId:l,listToolName:a,filtersToolName:p}),e[4]=a,e[5]=l,e[6]=p,e[7]=o):o=e[7],o}function at(t){const e=q.c(15),{registries:l,value:n,onValueChange:c,onAddWellKnown:r,wellKnownRegistries:a,placeholder:i}=t,m=i===void 0?"Select a registry...":i;let y;e[0]!==m?(y=s.jsx(Me,{size:"sm",className:"w-auto min-w-[160px]",children:s.jsx(Ve,{placeholder:m})}),e[0]=m,e[1]=y):y=e[1];let p;e[2]!==l?(p=l.map(ct),e[2]=l,e[3]=p):p=e[3];let o;e[4]!==r||e[5]!==a?(o=a.length>0&&s.jsxs("div",{className:"border-t border-border pt-1",children:[s.jsx("p",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Other known registries"}),a.map(d=>s.jsxs("button",{onClick:j=>{j.preventDefault(),j.stopPropagation(),r(d)},className:"relative flex w-full cursor-pointer items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[d.icon?s.jsx("img",{src:d.icon,alt:d.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:d.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"flex-1",children:d.title})]}),s.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center text-muted-foreground",children:s.jsx(He,{size:16})})]},d.id??d.title))]}),e[4]=r,e[5]=a,e[6]=o):o=e[6];let b;e[7]!==p||e[8]!==o?(b=s.jsxs(Oe,{children:[p,o]}),e[7]=p,e[8]=o,e[9]=b):b=e[9];let u;return e[10]!==c||e[11]!==y||e[12]!==b||e[13]!==n?(u=s.jsxs(We,{value:n,onValueChange:c,children:[y,b]}),e[10]=c,e[11]=y,e[12]=b,e[13]=n,e[14]=u):u=e[14],u}function ct(t){return s.jsx(De,{className:"cursor-pointer",value:t.id??t.name,children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?s.jsx("img",{src:t.icon,alt:t.name,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.name.slice(0,1).toUpperCase()}),s.jsx("span",{children:t.name})]})},t.id??t.name)}function mt({registries:t,onConnected:e}){const l=ce(),{org:{slug:n}}=X(),{data:c}=xe.useSession(),r=oe(),[a,i]=D.useState(!1),m=t[0],y=async()=>{if(!(!m||!c?.user?.id)){i(!0);try{const o=await l.create.mutateAsync(m);e?.(o.id)}finally{i(!1)}}},p=()=>{r({to:"/$org/mcps",params:{org:n},search:{action:"create"}})};return s.jsx(_e,{image:s.jsx("img",{src:"/store-empty-state.svg",alt:"No store connected",width:336,height:320,className:"max-w-full h-auto"}),title:"Connect to registry",description:"Connect to discover and use Connections from the community.",actions:s.jsxs(s.Fragment,{children:[s.jsxs(U,{variant:"outline",onClick:y,disabled:a||!m,children:[m?.icon&&s.jsx("img",{src:m.icon,alt:"",className:"size-4"}),a?"Installing...":"Install Registry"]}),s.jsx(U,{variant:"outline",onClick:p,children:"Custom Connection"})]})})}function Ut(){const t=q.c(42),{org:e}=X(),l=$e(),n=ce(),c=ge(),r=c.location.pathname.includes("/store/")&&c.location.pathname.split("/").length>3,a=qe(l);let i;t[0]!==a?(i=a.map(ut),t[0]=a,t[1]=i):i=t[1];const m=i;let y;t[2]!==e.slug?(y=Ge.selectedRegistry(e.slug),t[2]=e.slug,t[3]=y):y=t[3];const[p,o]=Qe(y,ft);let b;if(t[4]!==a||t[5]!==p){let h;t[7]!==p?(h=F=>F.id===p,t[7]=p,t[8]=h):h=t[8],b=a.find(h),t[4]=a,t[5]=p,t[6]=b}else b=t[6];const d=b?.id||a[0]?.id||"";let j;t[9]!==e.id?(j=Ie(e.id),t[9]=e.id,t[10]=j):j=t[10];let I;t[11]!==j?(I=[j],t[11]=j,t[12]=I):I=t[12];const N=I;let C;t[13]===Symbol.for("react.memo_cache_sentinel")?(C=[Re()],t[13]=C):C=t[13];const L=C;let $;t[14]!==n.create||t[15]!==o?($=async h=>{const F=await n.create.mutateAsync(h);o(F.id)},t[14]=n.create,t[15]=o,t[16]=$):$=t[16];const v=$;let S;t[17]!==a?(S=new Set(a.map(dt)),t[17]=a,t[18]=S):S=t[18];const w=S;let T;t[19]!==w||t[20]!==N?(T=N.filter(h=>h.id&&!w.has(h.id)),t[19]=w,t[20]=N,t[21]=T):T=t[21];const z=T;let A;t[22]!==w?(A=L.filter(h=>h.id&&!w.has(h.id)),t[22]=w,t[23]=A):A=t[23];const k=A;if(r){let h;return t[24]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(pe,{}),t[24]=h):h=t[24],h}let f;t[25]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Q.Header.Left,{children:s.jsx(he,{children:s.jsx(je,{children:s.jsx(ve,{children:s.jsx(ye,{children:"Store"})})})})}),t[25]=f):f=t[25];let x;t[26]!==v?(x=async h=>v(h),t[26]=v,t[27]=x):x=t[27];let g;t[28]!==z||t[29]!==d||t[30]!==m||t[31]!==o||t[32]!==x?(g=s.jsxs(Q.Header,{children:[f,s.jsx(Q.Header.Right,{children:s.jsx(at,{wellKnownRegistries:z,registries:m,value:d,onValueChange:o,onAddWellKnown:x,placeholder:"Select store..."})})]}),t[28]=z,t[29]=d,t[30]=m,t[31]=o,t[32]=x,t[33]=g):g=t[33];let R;t[34]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading store items..."})]}),t[34]=R):R=t[34];let P;t[35]!==k||t[36]!==d||t[37]!==o?(P=s.jsx(Q.Content,{children:s.jsx(D.Suspense,{fallback:R,children:d?s.jsx(it,{registryId:d}):s.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:s.jsx(mt,{registries:k,onConnected:h=>{o(h)}})})})}),t[35]=k,t[36]=d,t[37]=o,t[38]=P):P=t[38];let K;return t[39]!==g||t[40]!==P?(K=s.jsxs(Q,{children:[g,P]}),t[39]=g,t[40]=P,t[41]=K):K=t[41],K}function dt(t){return t.id}function ft(t){return t??""}function ut(t){return{id:t.id,name:t.title,icon:t.icon||void 0}}export{Ut as default};