@decocms/mesh 2.63.0 → 2.64.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 (139) hide show
  1. package/dist/client/assets/{AlertCircle-ByS2S7QG.js → AlertCircle-B7sqll3Z.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-Pc2qwI_3.js → ArrowUp-D8YYlj5b.js} +1 -1
  3. package/dist/client/assets/{Calendar-MP2K9xOR.js → Calendar-Cn4v8JwE.js} +1 -1
  4. package/dist/client/assets/{Check-kOHUYBJY.js → Check-lN7sUZo8.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-J2iKAqyZ.js → ChevronDown-En_P43wp.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-Cua3_Oqd.js → ChevronRight-BB2YL4K4.js} +1 -1
  7. package/dist/client/assets/{Code01-DORFegNP.js → Code01-Dgx2dgXr.js} +1 -1
  8. package/dist/client/assets/{Copy01-U5Mrbyn4.js → Copy01-daHVbD8K.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-nhuBUuxR.js → DotsHorizontal-DT2O2EOj.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CDOXEsr8.js → DotsVertical-D1ZY49Um.js} +1 -1
  11. package/dist/client/assets/{Download01-jn6ziu2W.js → Download01-oP6u6TmF.js} +1 -1
  12. package/dist/client/assets/{Edit01-C_cfLeJc.js → Edit01-C_JM_ANM.js} +1 -1
  13. package/dist/client/assets/{File02-Gea-raGb.js → File02-DlRIy2xF.js} +1 -1
  14. package/dist/client/assets/{File06-DE5HPnG3.js → File06-2dtWfDa_.js} +1 -1
  15. package/dist/client/assets/{FilterLines-CeL96HHO.js → FilterLines-BCtAjuvO.js} +1 -1
  16. package/dist/client/assets/{Grid01-CkZU0tWV.js → Grid01-DHptyetH.js} +1 -1
  17. package/dist/client/assets/{Home02-BLvW9ZzY.js → Home02-CwpXJj-n.js} +1 -1
  18. package/dist/client/assets/{Image01-CIkj8y0a.js → Image01-CILGPgam.js} +1 -1
  19. package/dist/client/assets/{Inbox01-8S74uH1Z.js → Inbox01-BTvTBHN2.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-BfJTzk81.js → InfoCircle-COTflZ7n.js} +1 -1
  21. package/dist/client/assets/{Key01-BFw74njR.js → Key01-DFKkR5uc.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-BRD6ViRl.js → LinkExternal01-WHnCc-Ds.js} +1 -1
  23. package/dist/client/assets/{List-4IPwuAX9.js → List-Dl-Bi1Os.js} +1 -1
  24. package/dist/client/assets/{Loading01-CCSRv8tX.js → Loading01-D8raUT2q.js} +1 -1
  25. package/dist/client/assets/{Lock01-B367KJK-.js → Lock01-0pDC11sR.js} +1 -1
  26. package/dist/client/assets/{Pin01-dHyXwRhr.js → Pin01-C3nTzsY2.js} +1 -1
  27. package/dist/client/assets/{Play-DiP4pY8r.js → Play-B3d026b0.js} +1 -1
  28. package/dist/client/assets/{Plus-B5QrRvCn.js → Plus-BcqTpnxy.js} +1 -1
  29. package/dist/client/assets/{SearchMd-D2POsGFy.js → SearchMd-DVuLBPJW.js} +1 -1
  30. package/dist/client/assets/{Share07-CQptN91g.js → Share07-DW8M4mUv.js} +1 -1
  31. package/dist/client/assets/{Terminal-CsAynI3M.js → Terminal-BOgtpg9n.js} +1 -1
  32. package/dist/client/assets/{Tool01-DdjIy29J.js → Tool01-D95FDZLP.js} +1 -1
  33. package/dist/client/assets/{Trash01-BdLDRPDl.js → Trash01-CR6s5yrj.js} +1 -1
  34. package/dist/client/assets/{Upload01-BB9AN-C_.js → Upload01-CkSc1CyA.js} +1 -1
  35. package/dist/client/assets/{Users03-DPYHJvoT.js → Users03-CCWN1VQn.js} +1 -1
  36. package/dist/client/assets/{X-CVoqpcAx.js → X-BsLffR19.js} +1 -1
  37. package/dist/client/assets/{XClose-CqNB1Ju1.js → XClose-D9VL7Fhs.js} +1 -1
  38. package/dist/client/assets/{agent-detail-BA2oH52J.js → agent-detail-DEjCff0P.js} +1 -1
  39. package/dist/client/assets/{agents-CexpEqf3.js → agents-C0Oa7sFF.js} +1 -1
  40. package/dist/client/assets/{alert-dialog-9PxNij5-.js → alert-dialog-BYFUia7V.js} +1 -1
  41. package/dist/client/assets/{auth-catchall-UkCMdvlG.js → auth-catchall-B3lc_CZ9.js} +1 -1
  42. package/dist/client/assets/{avatar-Cr99ARr3.js → avatar-B6WhQiHI.js} +1 -1
  43. package/dist/client/assets/{badge-a9rJdKKG.js → badge-D19NcG12.js} +1 -1
  44. package/dist/client/assets/{binder-BHtkW0UD.js → binder-CwgOa4SG.js} +1 -1
  45. package/dist/client/assets/{breadcrumb-DBCyZqWb.js → breadcrumb-BuFIEIOz.js} +1 -1
  46. package/dist/client/assets/{button-BB_m2E67.js → button-BNRw8VbO.js} +1 -1
  47. package/dist/client/assets/{card-DQu0Qiy4.js → card-B2_21gZH.js} +1 -1
  48. package/dist/client/assets/{checkbox-BYeejX3s.js → checkbox-D0Zw7dGS.js} +1 -1
  49. package/dist/client/assets/{circle-alert-W5iOrtbw.js → circle-alert-DepalnIB.js} +1 -1
  50. package/dist/client/assets/{collapsible-Ce6mH95q.js → collapsible-Dg-5RnYq.js} +1 -1
  51. package/dist/client/assets/{collection-detail-Wj5M0Fmc.js → collection-detail-DFH_vpkO.js} +1 -1
  52. package/dist/client/assets/{collection-search-DozvRnxE.js → collection-search-D5gi0-bL.js} +1 -1
  53. package/dist/client/assets/{collection-tab-BRIJmTl-.js → collection-tab-DxItkIfa.js} +1 -1
  54. package/dist/client/assets/{collection-table-wrapper-CTuXfFv4.js → collection-table-wrapper-igJ5OqPc.js} +1 -1
  55. package/dist/client/assets/{connect-DKTGUww4.js → connect-CtxQyDSW.js} +1 -1
  56. package/dist/client/assets/{connection-card-Bp0BNZom.js → connection-card-GHfjxhQ1.js} +1 -1
  57. package/dist/client/assets/{connection-detail-DdEzYohs.js → connection-detail-sqbtlWZ0.js} +1 -1
  58. package/dist/client/assets/{connections-C2ef7EGE.js → connections-DeNXDjso.js} +1 -1
  59. package/dist/client/assets/{constants-nQTTOIWL.js → constants-Cpe-c81c.js} +1 -1
  60. package/dist/client/assets/constants-gYpJq1UH.js +1 -0
  61. package/dist/client/assets/{create-organization-dialog-CgJo2N7J.js → create-organization-dialog-7bdcAksX.js} +1 -1
  62. package/dist/client/assets/{dialog-BPGYkE6E.js → dialog-Csoqe4hG.js} +1 -1
  63. package/dist/client/assets/{dropdown-menu-w3xNt286.js → dropdown-menu-CsYNL9oo.js} +1 -1
  64. package/dist/client/assets/{dynamic-plugin-layout-DB7JIoTi.js → dynamic-plugin-layout-bKoth3Ne.js} +1 -1
  65. package/dist/client/assets/{empty-state-DI837doR.js → empty-state-Cn1CRUZO.js} +1 -1
  66. package/dist/client/assets/{empty-state-Cuxzpiqy.js → empty-state-CpRLw49r.js} +1 -1
  67. package/dist/client/assets/{env-vars-editor-dEtMntyA.js → env-vars-editor-0JsZHlg0.js} +1 -1
  68. package/dist/client/assets/{error-boundary-UVoBd-EX.js → error-boundary-DQ5uRgdY.js} +1 -1
  69. package/dist/client/assets/{extract-connection-data-BkwH9UE5.js → extract-connection-data-B6LHMHtn.js} +1 -1
  70. package/dist/client/assets/{file-browser-DBtEgqmA.js → file-browser-xiIO0qLw.js} +2 -2
  71. package/dist/client/assets/{form-CFGJ-U5C.js → form-DAoJifFq.js} +1 -1
  72. package/dist/client/assets/{grid-view-BNbopqbx.js → grid-view-Bj9WDB_-.js} +1 -1
  73. package/dist/client/assets/{home-DzPPiX6r.js → home-BgLX6VJQ.js} +1 -1
  74. package/dist/client/assets/{index-CRFYi63w.js → index-BhNLW4h1.js} +1 -1
  75. package/dist/client/assets/{index-Cw0Cq7G5.js → index-Bos_CuhY.js} +2 -2
  76. package/dist/client/assets/index-CU94_QoM.css +1 -0
  77. package/dist/client/assets/{index-Cr1-k0ke.js → index-CsOz92iP.js} +1 -1
  78. package/dist/client/assets/{index-CERcQBYB.js → index-DJLvIq1X.js} +1 -1
  79. package/dist/client/assets/{index-DrbTAGPY.js → index-GUdoiFzV.js} +1 -1
  80. package/dist/client/assets/{index-BxQtX61C.js → index-P_cUV9l9.js} +1 -1
  81. package/dist/client/assets/{index-DVqIQLTS.js → index-yjsBu7QA.js} +2 -2
  82. package/dist/client/assets/{infiniteQueryObserver-qdoAkrLg.js → infiniteQueryObserver-D_8FFQdU.js} +1 -1
  83. package/dist/client/assets/{input-D53urYud.js → input-C-GM7dsu.js} +1 -1
  84. package/dist/client/assets/{layout-CvATyvqE.js → layout-D8G7uVC8.js} +1 -1
  85. package/dist/client/assets/{localstorage-keys-Dt0DQ7_M.js → localstorage-keys-C_mtBNzA.js} +1 -1
  86. package/dist/client/assets/{login-C_lPzYbi.js → login-FPJg9vSY.js} +1 -1
  87. package/dist/client/assets/{mcp-oauth-ALBEJIVW.js → mcp-oauth-l77m3IWF.js} +1 -1
  88. package/dist/client/assets/{mcp-server-card-BSDiwyMq.js → mcp-server-card-D5sj_LDb.js} +1 -1
  89. package/dist/client/assets/{mcp-server-detail-hoJFp--l.js → mcp-server-detail-BFJxlaGZ.js} +2 -2
  90. package/dist/client/assets/{members-DhIxxmb-.js → members-D6XXyYMu.js} +1 -1
  91. package/dist/client/assets/{monaco-editor-Dv5Uv_CH.js → monaco-editor-p_EFt-aT.js} +1 -1
  92. package/dist/client/assets/{monitoring-CesgjcG6.js → monitoring-CFkcXam_.js} +1 -1
  93. package/dist/client/assets/{oauth-callback-D881LTdt.js → oauth-callback-DN_uk9hh.js} +1 -1
  94. package/dist/client/assets/{page-Bz36h7wn.js → page-BityQMBs.js} +1 -1
  95. package/dist/client/assets/{page-BINds3__.js → page-D2S0EYIA.js} +1 -1
  96. package/dist/client/assets/{pin-to-sidebar-button-VWxGEpa7.js → pin-to-sidebar-button-qPJJKT8U.js} +1 -1
  97. package/dist/client/assets/{plugin-empty-state-BKQ3hXbm.js → plugin-empty-state-CuuSx5zh.js} +1 -1
  98. package/dist/client/assets/{plugin-header-D2pQH9wJ.js → plugin-header-BpBy7iT0.js} +1 -1
  99. package/dist/client/assets/{plugins-BaoheFvZ.js → plugins-CEFWqcJY.js} +1 -1
  100. package/dist/client/assets/{popover-C9gpO_P1.js → popover-u_i609j_.js} +1 -1
  101. package/dist/client/assets/{registry-utils-COHLTguy.js → registry-utils-BNFgymSf.js} +1 -1
  102. package/dist/client/assets/{resizable-Dl3VUWr8.js → resizable-Bac7VXSC.js} +1 -1
  103. package/dist/client/assets/{resource-tabs-Ddi84XBD.js → resource-tabs-CE-63rPp.js} +1 -1
  104. package/dist/client/assets/{select-DsmrYLOe.js → select-B4SPtD5h.js} +1 -1
  105. package/dist/client/assets/{settings-Z2r51vE-.js → settings-CoEwEtT9.js} +1 -1
  106. package/dist/client/assets/shell-layout-BH2X3Yeb.js +12 -0
  107. package/dist/client/assets/{spinner-CaiollDD.js → spinner-Duo6KesX.js} +1 -1
  108. package/dist/client/assets/{store-invite-E7IkGyCx.js → store-invite-CyZGTGUz.js} +1 -1
  109. package/dist/client/assets/{switch-BRyOsD9X.js → switch-DBMrpKuB.js} +1 -1
  110. package/dist/client/assets/{table-By59ASmK.js → table-NP0FOAI5.js} +1 -1
  111. package/dist/client/assets/{textarea-BB8VII1W.js → textarea-ByvgxbRE.js} +1 -1
  112. package/dist/client/assets/{tools-list-DURWgp8a.js → tools-list-gkMtCYZf.js} +1 -1
  113. package/dist/client/assets/{typewriter-title-BTENJbqy.js → typewriter-title-CZvcEhZW.js} +1 -1
  114. package/dist/client/assets/{use-binding-BKAkfTQP.js → use-binding-CNR8kDE7.js} +1 -1
  115. package/dist/client/assets/{use-collections-CidxL5e8.js → use-collections-Hp9XPnUY.js} +1 -1
  116. package/dist/client/assets/{use-connection-nBbiimhv.js → use-connection-Dj100t8H.js} +1 -1
  117. package/dist/client/assets/{use-create-virtual-mcp-CPQ3EWAe.js → use-create-virtual-mcp-B01dvSQa.js} +1 -1
  118. package/dist/client/assets/{use-deco-chat-open-CxrySluI.js → use-deco-chat-open-C4y7eW_U.js} +1 -1
  119. package/dist/client/assets/{use-list-state-DDhTHJ9V.js → use-list-state-DsM4HMGd.js} +1 -1
  120. package/dist/client/assets/{use-mcp-prompts-0zuoUwAA.js → use-mcp-prompts-SKr2e7l0.js} +1 -1
  121. package/dist/client/assets/{use-members-CVCClaOw.js → use-members-C8R91dOK.js} +1 -1
  122. package/dist/client/assets/{use-mobile-D3kiHSC9.js → use-mobile-CS2zVR4m.js} +1 -1
  123. package/dist/client/assets/{use-organization-settings-Bnh92zjq.js → use-organization-settings-ClYOYczD.js} +1 -1
  124. package/dist/client/assets/{use-virtual-mcp-BzFn2znu.js → use-virtual-mcp-XGRCLjSr.js} +1 -1
  125. package/dist/client/assets/useInfiniteQuery-C34Ot4VI.js +1 -0
  126. package/dist/client/assets/{useMutation-DYyKBkRY.js → useMutation-VOj1VEf8.js} +1 -1
  127. package/dist/client/assets/useQuery-C5RIveiE.js +1 -0
  128. package/dist/client/assets/{view-mode-toggle-C2aKUr7i.js → view-mode-toggle-zGyN0eoT.js} +1 -1
  129. package/dist/client/assets/{workflow-DrGi1tqo.js → workflow-BRSWFGSV.js} +1 -1
  130. package/dist/client/index.html +2 -2
  131. package/dist/server/cli.js +82 -82
  132. package/dist/server/migrate.js +169 -169
  133. package/dist/server/server.js +62 -62
  134. package/package.json +1 -1
  135. package/dist/client/assets/constants-DuCds5dq.js +0 -1
  136. package/dist/client/assets/index-DTBzssSX.css +0 -1
  137. package/dist/client/assets/shell-layout-LyCgzjUJ.js +0 -12
  138. package/dist/client/assets/useInfiniteQuery-Cg3dUfja.js +0 -1
  139. package/dist/client/assets/useQuery-CC03be4X.js +0 -1
@@ -1,3 +1,3 @@
1
- import{r as D,c as ae,j as t,p as $t,u as Ne,g as se,K as le,o as pt,n as tt,s as ue,b8 as Ft,be as Gt,a1 as Xe,k as Ot,h as Kt,v as te,x as Qt}from"./index-DVqIQLTS.js";import{C as qt,a as Ht}from"./collection-table-wrapper-CTuXfFv4.js";import{C as ke}from"./collection-search-DozvRnxE.js";import{P as fe}from"./index-BxQtX61C.js";import{B as Zt,a as Yt,b as Xt,c as Jt}from"./breadcrumb-DBCyZqWb.js";import{I as wt,b as Te,c as Se,T as ye,a as Ie,E as st}from"./empty-state-Cuxzpiqy.js";import{C as dt}from"./checkbox-BYeejX3s.js";import{c as K,B as ee}from"./button-BB_m2E67.js";import{b as At}from"./use-connection-nBbiimhv.js";import{u as mt}from"./use-members-CVCClaOw.js";import{u as Rt}from"./useQuery-CC03be4X.js";import{u as he}from"./useMutation-DYyKBkRY.js";import{A as ve}from"./avatar-Cr99ARr3.js";import{B as Oe}from"./badge-a9rJdKKG.js";import{f as we,a as Ae,b as Re,c as _e,d as Le,e as Pe,A as Me,g as De}from"./alert-dialog-9PxNij5-.js";import{D as _t,f as Lt,a as Pt,b as Wt,c as es,e as ts}from"./dialog-BPGYkE6E.js";import{D as ut,a as ft,b as ht,c as Ze,d as ss,e as ns,f as rs,g as is}from"./dropdown-menu-w3xNt286.js";import{i as os}from"./DotsHorizontal-nhuBUuxR.js";import{i as Mt}from"./Loading01-CCSRv8tX.js";import{i as ls}from"./Lock01-B367KJK-.js";import{s as rt}from"./Plus-B5QrRvCn.js";import{s as Dt}from"./Trash01-BdLDRPDl.js";import{i as bt}from"./X-CVoqpcAx.js";import{I as as}from"./input-D53urYud.js";import{S as Ke}from"./switch-BRyOsD9X.js";import{E as cs}from"./error-boundary-UVoBd-EX.js";import{a as ds,F as Ct,b as jt,c as ms,d as vt,f as Nt}from"./form-CFGJ-U5C.js";import{S as it,a as ot,b as lt,c as at,d as ct}from"./select-DsmrYLOe.js";import{T as us}from"./textarea-BB8VII1W.js";import{a as fs,u as hs}from"./constants-nQTTOIWL.js";import{C as Et}from"./card-DQu0Qiy4.js";import{i as kt}from"./DotsVertical-CDOXEsr8.js";import{i as gs}from"./Key01-BFw74njR.js";import{s as xs}from"./XClose-CqNB1Ju1.js";import"./ArrowUp-Pc2qwI_3.js";import"./Check-kOHUYBJY.js";import"./Grid01-CkZU0tWV.js";import"./List-4IPwuAX9.js";import"./view-mode-toggle-C2aKUr7i.js";import"./table-By59ASmK.js";import"./SearchMd-D2POsGFy.js";import"./ChevronRight-Cua3_Oqd.js";import"./use-collections-CidxL5e8.js";import"./ChevronDown-J2iKAqyZ.js";const zt=({size:s=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,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"}));zt.displayName="ArrowLeft";const gt=({size:s=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,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"}));gt.displayName="Shield01";const Ut=({size:s=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,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"}));Ut.displayName="SwitchHorizontal01";const Bt=[{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:"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"}],ps={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",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"};function bs(){const s={Organizations:[],Connections:[],"Virtual MCPs":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Bt)s[e.category]?.push(e);return s}function Cs(){return Bt.map(s=>({value:s.name,label:ps[s.name],dangerous:s.dangerous}))}const js=D.memo(function(e){const n=ae.c(21),{connection:r,isSelected:a,hasToolsEnabled:o,activeToolsCount:m,totalToolsCount:l,onSelect:x,onToggle:j}=e,h=a?"bg-accent/50":"hover:bg-muted/50";let v;n[0]!==h?(v=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),n[0]=h,n[1]=v):v=n[1];let c;n[2]!==r.icon||n[3]!==r.title?(c=t.jsx(wt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=c):c=n[4];let N;n[5]!==r.title?(N=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=N):N=n[6];let u;n[7]!==x||n[8]!==c||n[9]!==N?(u=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:x,children:[c,N]}),n[7]=x,n[8]=c,n[9]=N,n[10]=u):u=n[10];let b;n[11]!==m||n[12]!==r.tools||n[13]!==o||n[14]!==j||n[15]!==l?(b=r.tools&&r.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[m,"/",l]}),t.jsx(dt,{checked:o,onCheckedChange:j,onClick:Es})]}),n[11]=m,n[12]=r.tools,n[13]=o,n[14]=j,n[15]=l,n[16]=b):b=n[16];let p;return n[17]!==v||n[18]!==u||n[19]!==b?(p=t.jsxs("div",{className:v,children:[u,b]}),n[17]=v,n[18]=u,n[19]=b,n[20]=p):p=n[20],p}),vs=D.memo(function(e){const n=ae.c(18),{connectionId:r,tool:a,isSelected:o,onToggle:m}=e,l=`tool-${r}-${a.name}`,x=o?"text-foreground":"text-muted-foreground";let j;n[0]!==x?(j=K("text-sm font-medium",x),n[0]=x,n[1]=j):j=n[1];let h;n[2]!==j||n[3]!==a.name?(h=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:j,children:a.name})}),n[2]=j,n[3]=a.name,n[4]=h):h=n[4];let v;n[5]!==a.description?(v=a.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),n[5]=a.description,n[6]=v):v=n[6];let c;n[7]!==h||n[8]!==v?(c=t.jsxs("div",{className:"flex-1 min-w-0",children:[h,v]}),n[7]=h,n[8]=v,n[9]=c):c=n[9];const N=`tool-${r}-${a.name}`;let u;n[10]!==o||n[11]!==m||n[12]!==N?(u=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(dt,{id:N,checked:o,onCheckedChange:m,onClick:Ts})}),n[10]=o,n[11]=m,n[12]=N,n[13]=u):u=n[13];let b;return n[14]!==l||n[15]!==c||n[16]!==u?(b=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:l,children:[c,u]}),n[14]=l,n[15]=c,n[16]=u,n[17]=b):b=n[17],b});function Ns({toolSet:s,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,a]=D.useState(""),o=D.useDeferredValue(r),[m,l]=D.useState("all"),[x,j]=D.useState(!1),h=D.useRef(new Set(Object.keys(s))),v=At({searchTerm:o.trim()||void 0}),c=n?v.filter(d=>d.connection_type!=="VIRTUAL"?!0:$t(d.connection_url)!==n):v,N=h.current,u=[...N.values()].map(d=>c.find(S=>S.id===d)).filter(d=>d!==void 0),b=c.filter(d=>!N.has(d.id)),p=[...u,...b],y=d=>{const S=s[d];return S!==void 0&&S.length>0},C=p.filter(d=>{if(m==="all")return!0;const S=y(d.id);return m==="selected"?S:m==="unselected"?!S:!0}),[f,I]=D.useState(p[0]?.id??null),T=f?p.find(d=>d.id===f)??null:null,P=T?.tools??[],A=(d,S)=>s[d]?.includes(S)??!1,_=(d,S)=>{const E=s[d]??[],g=E.includes(S),L={...s};if(g){const z=E.filter(F=>F!==S);z.length===0?delete L[d]:L[d]=z}else L[d]=[...E,S];e(L)},R=d=>{const S=p.find(F=>F.id===d);if(!S?.tools)return;const E=s[d]??[],g=S.tools.map(F=>F.name),L=E.length>0&&g.every(F=>E.includes(F)),z={...s};L?delete z[d]:(z[d]=g,I(d)),e(z)},k=d=>{I(d),j(!0)},w=()=>{j(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",x&&"hidden md:flex"),children:[t.jsx(ke,{value:r,onChange:a,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>l("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>l("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>l("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:C.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:C.map(d=>{const S=d.tools?.length??0,E=s[d.id]?.length??0;return t.jsx(js,{connection:d,isSelected:f===d.id,hasToolsEnabled:y(d.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>k(d.id),onToggle:()=>R(d.id)},d.id)})})})]}),t.jsx("div",{className:K("flex-1 flex-col",x?"flex":"hidden md:flex"),children:T?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(ee,{variant:"ghost",size:"sm",onClick:w,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(zt,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(wt,{icon:T.icon,name:T.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:T.title}),T.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:P.map(d=>t.jsx(vs,{connectionId:T.id,tool:d,isSelected:A(T.id,d.name),onToggle:()=>_(T.id,d.name)},d.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Es(s){return s.stopPropagation()}function Ts(s){return s.stopPropagation()}const Tt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Ss(s){return s.replace(/-/g," ")}function ys(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let a=!1;const o=new Set;let m=!1;for(const[l,x]of Object.entries(s)){if(l==="self"){x.includes("*")?n=!0:e.push(...x);continue}if(l==="*"){if(a=!0,x.includes("*"))m=!0;else for(const j of x)o.add(j);continue}if(r.push(l),x.includes("*"))m=!0;else for(const j of x)o.add(j)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:a,toolNames:Array.from(o),allowsAllTools:m}}function xt(){const{locator:s}=Ne(),{data:e,isLoading:n,error:r,refetch:a}=Rt({queryKey:le.organizationRoles(s),queryFn:async()=>{try{const l=await se.organization.listRoles();return l?.error?(console.error("[useOrganizationRoles] API error:",l.error),[]):l?.data??[]}catch(l){return console.error("[useOrganizationRoles] Fetch error:",l),[]}},staleTime:3e4}),o=Tt.map(l=>({role:l.value,label:l.label,isBuiltin:l.isBuiltin}));if(e&&Array.isArray(e))for(const l of e){const x=l.role;if(!x||Tt.some(b=>b.value===x))continue;const{staticPermissions:j,allowsAllStaticPermissions:h,connectionIds:v,allowsAllConnections:c,toolNames:N,allowsAllTools:u}=ys(l.permission);o.push({id:l.id,role:x,label:Ss(x),isBuiltin:!1,permission:l.permission??void 0,staticPermissionCount:h?-1:j.length,allowsAllStaticPermissions:h,connectionCount:c?-1:v.length,allowsAllConnections:c,toolCount:u?-1:N.length,allowsAllTools:u})}const m=o.filter(l=>!l.isBuiltin);return{roles:o,customRoles:m,builtinRoles:o.filter(l=>l.isBuiltin),isLoading:n,error:r,refetch:a}}const Is=pt({role:pt({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:Gt(),staticPermissions:tt(ue()),toolSet:Ft(ue(),tt(ue())),memberIds:tt(ue())});function Vt(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Os=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],nt=["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 ws(s){if(!s)return"bg-neutral-400";let e=0;for(let r=0;r<s.length;r++){const a=s.charCodeAt(r);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%nt.length;return nt[n]??nt[0]}function Qe(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function As(s){const e=ae.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:a,onPermissionsChange:o,readOnly:m}=s,l=m===void 0?!1:m,[x,j]=D.useState(""),h=D.useDeferredValue(x);let v,c,N,u,b;if(e[0]!==n||e[1]!==h||e[2]!==a||e[3]!==o||e[4]!==l||e[5]!==x||e[6]!==r){const C=bs(),f=Cs(),I=f.filter(w=>w.label.toLowerCase().includes(h.toLowerCase())),T=w=>{if(r.includes(w))o(r.filter(d=>d!==w));else{const d=[...r,w];d.length===f.length?(a(!0),o([])):o(d)}};N="flex flex-col h-full",e[12]!==x?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(ke,{value:x,onChange:j,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=x,e[13]=u):u=e[13];const P=!l&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=K("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let _;e[16]!==n||e[17]!==a||e[18]!==o||e[19]!==l?(_=()=>{if(l)return;a(!n),o([])},e[16]=n,e[17]=a,e[18]=o,e[19]=l,e[20]=_):_=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=R):R=e[21];let k;e[22]!==n||e[23]!==a||e[24]!==o||e[25]!==l?(k=t.jsx("div",{onClick:Ms,children:l?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ke,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ke,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})}),e[22]=n,e[23]=a,e[24]=o,e[25]=l,e[26]=k):k=e[26],e[27]!==k||e[28]!==A||e[29]!==_?(b=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:A,onClick:_,children:[R,k]})}),e[27]=k,e[28]=A,e[29]=_,e[30]=b):b=e[30],v="flex-1 overflow-auto",c=Object.entries(C).map(w=>{const[d,S]=w,E=I.filter(g=>S.some(L=>L.name===g.value));return E.length===0?null:t.jsxs("div",{className:"mb-6 last:mb-0",children:[t.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:d}),t.jsx("div",{className:"space-y-1",children:E.map(g=>t.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3",!l&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!l)if(n){a(!1);const L=f.map(Ps);o(L.filter(z=>z!==g.value))}else T(g.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:g.label})}),t.jsx("div",{onClick:Ls,children:l?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ke,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(_s);o(L.filter(z=>z!==g.value))}else T(g.value)}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ke,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(Rs);o(L.filter(z=>z!==g.value))}else T(g.value)}})})]},g.value))})]},d)}),e[0]=n,e[1]=h,e[2]=a,e[3]=o,e[4]=l,e[5]=x,e[6]=r,e[7]=v,e[8]=c,e[9]=N,e[10]=u,e[11]=b}else v=e[7],c=e[8],N=e[9],u=e[10],b=e[11];let p;e[31]!==v||e[32]!==c?(p=t.jsx("div",{className:v,children:c}),e[31]=v,e[32]=c,e[33]=p):p=e[33];let y;return e[34]!==N||e[35]!==u||e[36]!==b||e[37]!==p?(y=t.jsxs("div",{className:N,children:[u,b,p]}),e[34]=N,e[35]=u,e[36]=b,e[37]=p,e[38]=y):y=e[38],y}function Rs(s){return s.value}function _s(s){return s.value}function Ls(s){return s.stopPropagation()}function Ps(s){return s.value}function Ms(s){return s.stopPropagation()}function Ds(s){const e=ae.c(56),{open:n,onOpenChange:r,selectedMemberIds:a,onAddMembers:o}=s,[m,l]=D.useState(""),x=D.useDeferredValue(m);let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0];const[h,v]=D.useState(j),{data:c}=mt();let N,u,b,p,y,C,f,I,T,P,A;if(e[1]!==c?.data?.members||e[2]!==x||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==h||e[7]!==m||e[8]!==a){const L=c?.data?.members??[];let z;e[20]!==x?(z=B=>{const i=x.toLowerCase();return B.user?.name?.toLowerCase().includes(i)||B.user?.email?.toLowerCase().includes(i)},e[20]=x,e[21]=z):z=e[21];const F=L.filter(z),Q=ks;let q;e[22]!==a?(q=B=>a.includes(B),e[22]=a,e[23]=q):q=e[23];const H=q;let X;e[24]!==h?(X=B=>{h.includes(B)?v(h.filter(i=>i!==B)):v([...h,B])},e[24]=h,e[25]=X):X=e[25];const re=X;let ne;e[26]!==o||e[27]!==r||e[28]!==h?(ne=()=>{o(h),v([]),r(!1)},e[26]=o,e[27]=r,e[28]=h,e[29]=ne):ne=e[29],b=ne,u=we,P=n,A=r,N=Ae,I="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(Re,{className:"px-6 pt-6",children:[t.jsx(_e,{children:"Add Members to Role"}),t.jsx(Le,{children:"Select members to add to this role."})]}),e[30]=T):T=e[30],C="flex flex-col h-80",e[31]!==m?(f=t.jsx(ke,{value:m,onChange:l,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=m,e[32]=f):f=e[32],p="flex-1 overflow-auto",y=F.length===0?t.jsx("div",{className:"flex items-center justify-center h-full px-6",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:m?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:F.map(B=>{const i=Q(B),O=H(B.id),G=h.includes(B.id);return t.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!i||O?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx(dt,{checked:G||O,onCheckedChange:()=>{i&&!O&&re(B.id)},disabled:!i||O}),t.jsx(ve,{url:B.user?.image??void 0,fallback:Vt(B.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:B.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:B.user?.email})]}),!i&&t.jsx(Oe,{variant:"secondary",className:"shrink-0",children:"Owner"}),O&&i&&t.jsx(Oe,{variant:"outline",className:"shrink-0",children:"Added"})]},B.id)})}),e[1]=c?.data?.members,e[2]=x,e[3]=o,e[4]=r,e[5]=n,e[6]=h,e[7]=m,e[8]=a,e[9]=N,e[10]=u,e[11]=b,e[12]=p,e[13]=y,e[14]=C,e[15]=f,e[16]=I,e[17]=T,e[18]=P,e[19]=A}else N=e[9],u=e[10],b=e[11],p=e[12],y=e[13],C=e[14],f=e[15],I=e[16],T=e[17],P=e[18],A=e[19];let _;e[33]!==p||e[34]!==y?(_=t.jsx("div",{className:p,children:y}),e[33]=p,e[34]=y,e[35]=_):_=e[35];let R;e[36]!==_||e[37]!==C||e[38]!==f?(R=t.jsxs("div",{className:C,children:[f,_]}),e[36]=_,e[37]=C,e[38]=f,e[39]=R):R=e[39];let k;e[40]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Me,{children:"Cancel"}),e[40]=k):k=e[40];const w=h.length===0,d=h.length>0&&`(${h.length})`;let S;e[41]!==b||e[42]!==w||e[43]!==d?(S=t.jsxs(Pe,{className:"px-6 pb-6",children:[k,t.jsxs(De,{onClick:b,disabled:w,children:["Add ",d]})]}),e[41]=b,e[42]=w,e[43]=d,e[44]=S):S=e[44];let E;e[45]!==N||e[46]!==R||e[47]!==S||e[48]!==I||e[49]!==T?(E=t.jsxs(N,{className:I,children:[T,R,S]}),e[45]=N,e[46]=R,e[47]=S,e[48]=I,e[49]=T,e[50]=E):E=e[50];let g;return e[51]!==u||e[52]!==E||e[53]!==P||e[54]!==A?(g=t.jsx(u,{open:P,onOpenChange:A,children:E}),e[51]=u,e[52]=E,e[53]=P,e[54]=A,e[55]=g):g=e[55],g}function ks(s){return s.role!=="owner"}function zs(s){const e=ae.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:a}=s,o=a===void 0?!1:a,[m,l]=D.useState(""),x=D.useDeferredValue(m),[j,h]=D.useState(!1),{data:v}=mt();let c,N,u,b,p;if(e[0]!==v?.data?.members||e[1]!==x||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==m){const I=v?.data?.members??[];let T;e[11]!==n?(T=E=>n.includes(E.id),e[11]=n,e[12]=T):T=e[12];const P=I.filter(T);let A;e[13]!==x?(A=E=>{const g=x.toLowerCase();return E.user?.name?.toLowerCase().includes(g)||E.user?.email?.toLowerCase().includes(g)},e[13]=x,e[14]=A):A=e[14];const _=P.filter(A);let R;e[15]!==n||e[16]!==r?(R=E=>{r(n.filter(g=>g!==E))},e[15]=n,e[16]=r,e[17]=R):R=e[17];const k=R;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],c=w,b="flex flex-col h-full";let d;e[21]!==m?(d=t.jsx(ke,{value:m,onChange:l,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=m,e[22]=d):d=e[22];let S;e[23]!==o?(S=o?t.jsx("div",{className:"pr-4",children:t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(rt,{size:16}),"Add Member"]})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):t.jsx("div",{className:"pr-4",children:t.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>h(!0),children:[t.jsx(rt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==d||e[26]!==S?(p=t.jsxs("div",{className:"flex items-center border-b border-border",children:[d,S]}),e[25]=d,e[26]=S,e[27]=p):p=e[27],N="flex-1 overflow-auto",u=P.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):_.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',m,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:_.map(E=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(ve,{url:E.user?.image??void 0,fallback:Vt(E.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(bt,{size:16})})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>k(E.id),children:t.jsx(bt,{size:16})})]},E.id))}),e[0]=v?.data?.members,e[1]=x,e[2]=n,e[3]=r,e[4]=o,e[5]=m,e[6]=c,e[7]=N,e[8]=u,e[9]=b,e[10]=p}else c=e[6],N=e[7],u=e[8],b=e[9],p=e[10];let y;e[28]!==N||e[29]!==u?(y=t.jsx("div",{className:N,children:u}),e[28]=N,e[29]=u,e[30]=y):y=e[30];let C;e[31]!==j||e[32]!==c||e[33]!==n?(C=t.jsx(Ds,{open:j,onOpenChange:h,selectedMemberIds:n,onAddMembers:c}),e[31]=j,e[32]=c,e[33]=n,e[34]=C):C=e[34];let f;return e[35]!==b||e[36]!==p||e[37]!==y||e[38]!==C?(f=t.jsxs("div",{className:b,children:[p,y,C]}),e[35]=b,e[36]=p,e[37]=y,e[38]=C,e[39]=f):f=e[39],f}function Us(s){const e=ae.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Mt,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==s?(r=t.jsx(D.Suspense,{fallback:n,children:t.jsx(zs,{...s})}),e[1]=s,e[2]=r):r=e[2],r}const Bs={owner:[],admin:[],user:[]};function qe(s,e){const n=s==="owner"||s==="admin",r=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:Bs[s],toolSet:{},memberIds:r.map(a=>a.id)}}function Vs({trigger:s,onSuccess:e}){const[n,r]=D.useState(!1),[a,o]=D.useState("mcp"),{locator:m}=Ne(),l=Xe(),x=At()??[],{customRoles:j,refetch:h}=xt(),{data:v}=Rt({queryKey:le.members(m),queryFn:()=>se.organization.listMembers()}),c=Ot({resolver:Kt(Is),defaultValues:Qe()}),N=c.formState.isValid,u=c.formState.isDirty,[b,p]=D.useState(null),[y,C]=D.useState(null),f=!c.watch("role.id")&&!c.watch("role.slug")&&!y,[I,T]=D.useState(null),[P,A]=D.useState(!1),[_,R]=D.useState(null),k=i=>{const O=i.permission||{},G=O.self||[],oe=G.includes("*"),ie=oe?[]:G.filter(U=>U!=="*"),J={};for(const[U,V]of Object.entries(O))if(U!=="self")if(U==="*")for(const Y of x)V.includes("*")?J[Y.id]=Y.tools?.map(ce=>ce.name)??[]:J[Y.id]=V;else{const Y=x.find(ce=>ce.id===U);Y&&(V.includes("*")?J[U]=Y.tools?.map(ce=>ce.name)??[]:J[U]=V)}const me=(v?.data?.members??[]).filter(U=>U.role===i.role).map(U=>U.id);return{role:{id:i.id,slug:i.role,label:i.label},allowAllStaticPermissions:oe,staticPermissions:ie,toolSet:J,memberIds:me}},w=i=>{const O=k(i);c.reset(O),p(i.id??null),C(null)},d=()=>{c.reset(Qe()),p(null),C(null),o("mcp")},S=i=>{u&&N?(R(()=>()=>w(i)),A(!0)):w(i)},E=async()=>{u&&N&&await X(),d()},g=i=>{if(u&&N)R(()=>()=>{const O=qe(i,v?.data?.members??[]);c.reset(O),C(i),p(null),o("org")}),A(!0);else{const O=qe(i,v?.data?.members??[]);c.reset(O),C(i),p(null),o("org")}},L=i=>{if(!i&&c.formState.isDirty&&N){R(()=>()=>{r(!1),c.reset(Qe()),C(null)}),A(!0);return}if(r(i),!i)c.reset(Qe()),C(null),p(null);else{const O=j[0];if(O)w(O);else{const G=qe("user",v?.data?.members??[]);c.reset(G),C("user"),p(null),o("org")}}},z=()=>{A(!1),_&&(_(),R(null))},F=i=>{const O={};i.allowAllStaticPermissions?O.self=["*"]:i.staticPermissions.length>0&&(O.self=i.staticPermissions);for(const[G,oe]of Object.entries(i.toolSet))if(oe.length>0){const J=x.find(Z=>Z.id===G)?.tools?.map(Z=>Z.name)??[];J.length>0&&J.every(Z=>oe.includes(Z))?O[G]=["*"]:O[G]=oe}return O},Q=he({mutationFn:async i=>{const O=F(i),G=i.role.slug||i.role.label.toLowerCase().replace(/\s+/g,"-");if(i.role.slug&&!i.role.id){const J=(v?.data?.members??[]).filter(U=>U.role===i.role.slug).map(U=>U.id),Z=i.memberIds.filter(U=>!J.includes(U)),me=J.filter(U=>!i.memberIds.includes(U));for(const U of Z){const V=await se.organization.updateMemberRole({memberId:U,role:[i.role.slug]});if(V?.error)throw new Error(V.error.message)}for(const U of me){const V=await se.organization.updateMemberRole({memberId:U,role:["user"]});if(V?.error)throw new Error(V.error.message)}return i}else if(i.role.id){const ie=await se.organization.updateRole({roleId:i.role.id,data:{permission:O}});if(ie?.error)throw new Error(ie.error.message);const Z=(v?.data?.members??[]).filter(V=>V.role===i.role.slug).map(V=>V.id),me=i.memberIds.filter(V=>!Z.includes(V)),U=Z.filter(V=>!i.memberIds.includes(V));for(const V of me){const Y=await se.organization.updateMemberRole({memberId:V,role:[i.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const V of U){const Y=await se.organization.updateMemberRole({memberId:V,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return i}else{const ie=await se.organization.createRole({role:G,permission:O});if(ie?.error)throw new Error(ie.error.message);for(const J of i.memberIds){const Z=await se.organization.updateMemberRole({memberId:J,role:[G]});if(Z?.error)throw new Error(Z.error.message)}return{...i,role:{...i.role,id:ie.data?.roleData?.id,slug:G}}}},onSuccess:(i,O)=>{l.invalidateQueries({queryKey:le.members(m)}),l.invalidateQueries({queryKey:le.organizationRoles(m)});const G=!O.role.id&&!O.role.slug,oe=O.role.slug&&!O.role.id;te.success(oe?"Members updated successfully!":G?"Role created successfully!":"Role updated successfully!"),h(),c.reset(i),i.role.id&&p(i.role.id),e?.()},onError:i=>{te.error(i instanceof Error?i.message:"Failed to save role")}}),q=he({mutationFn:async i=>{const O=await se.organization.deleteRole({roleId:i});if(O?.error)throw new Error(O.error.message);return O?.data},onSuccess:()=>{if(l.invalidateQueries({queryKey:le.members(m)}),l.invalidateQueries({queryKey:le.organizationRoles(m)}),te.success("Role deleted successfully!"),h(),I?.id===b){const i=j.filter(O=>O.id!==I?.id);if(i[0])w(i[0]);else{const O=qe("user",v?.data?.members??[]);c.reset(O),C("user"),p(null),o("org")}}},onError:i=>{te.error(i instanceof Error?i.message:"Failed to delete role")}}),H=Q.isPending||q.isPending,X=async()=>{const i=c.getValues();if(!i.role.label.trim()){te.error("Role name is required"),c.setFocus("role.label");return}await Q.mutateAsync(i)},re=c.handleSubmit(i=>{if(!i.role.label.trim()){te.error("Role name is required"),c.setFocus("role.label");return}Q.mutate(i)}),ne=i=>{i.id&&T({id:i.id,label:i.label})},B=()=>{I?.id&&q.mutate(I.id),T(null)};return t.jsxs(_t,{open:n,onOpenChange:L,children:[t.jsx(Lt,{asChild:!0,children:s}),t.jsx(Pt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[t.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:[t.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:t.jsxs("div",{className:"flex flex-col gap-1",children:[Os.map(i=>{const O=y===i.role;return t.jsxs("div",{className:K("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",O?"bg-accent":"hover:bg-muted/50"),onClick:()=>g(i.role),children:[t.jsx("div",{className:K("shrink-0 size-3 rounded-full",i.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsx(ls,{size:14,className:"text-muted-foreground shrink-0"})]},i.role)}),j.map(i=>{const O=b===i.id;return t.jsxs("div",{className:K("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",O?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(i),children:[t.jsx("div",{className:K("shrink-0 size-3 rounded-full",ws(i.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsxs(ut,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:K("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",O&&"opacity-100 pointer-events-auto"),onClick:G=>G.stopPropagation(),children:t.jsx(os,{size:14})})}),t.jsx(ht,{align:"end",children:t.jsxs(Ze,{className:"text-destructive",onClick:G=>{G.stopPropagation(),ne(i)},children:[t.jsx(Dt,{size:16}),"Delete"]})})]})]},i.id)}),f&&t.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[t.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),t.jsx(as,{...c.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}),t.jsx(Oe,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),t.jsx("div",{className:"px-3.5 pb-3.5",children:t.jsxs(ee,{variant:"outline",size:"default",onClick:E,disabled:H||u,className:"w-full h-10",children:[t.jsx(rt,{size:16}),"Create new role"]})})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!y&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:K("h-8 rounded-lg px-2 py-1",a==="mcp"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"MCP Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o("org"),className:K("h-8 rounded-lg px-2 py-1",a==="org"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Organization Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o("members"),className:K("h-8 rounded-lg px-2 py-1",a==="members"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Members"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[a==="mcp"&&!y&&t.jsx(Ns,{toolSet:c.watch("toolSet"),onToolSetChange:i=>c.setValue("toolSet",i,{shouldDirty:!0})}),a==="org"&&t.jsx(As,{allowAllStaticPermissions:c.watch("allowAllStaticPermissions"),staticPermissions:c.watch("staticPermissions"),onAllowAllChange:i=>c.setValue("allowAllStaticPermissions",i,{shouldDirty:!0}),onPermissionsChange:i=>c.setValue("staticPermissions",i,{shouldDirty:!0}),readOnly:!!y}),a==="members"&&t.jsx(Us,{memberIds:c.watch("memberIds"),onMemberIdsChange:i=>c.setValue("memberIds",i,{shouldDirty:!0}),readOnly:y==="owner"})]}),(!y||y!=="owner")&&t.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[t.jsx(ee,{variant:"outline",onClick:()=>L(!1),disabled:H,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:re,disabled:H||!N||!c.formState.isDirty,className:"h-10",children:Q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),t.jsx(we,{open:I!==null,onOpenChange:i=>!i&&T(null),children:t.jsxs(Ae,{children:[t.jsxs(Re,{children:[t.jsx(_e,{children:"Delete Role"}),t.jsxs(Le,{children:['Are you sure you want to delete the "',I?.label,'" role? This action cannot be undone.']})]}),t.jsxs(Pe,{children:[t.jsx(Me,{children:"Cancel"}),t.jsx(De,{onClick:B,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(we,{open:P,onOpenChange:A,children:t.jsxs(Ae,{children:[t.jsxs(Re,{children:[t.jsx(_e,{children:"Discard Changes"}),t.jsx(Le,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(Pe,{children:[t.jsx(Me,{onClick:()=>R(null),children:"Keep Editing"}),t.jsx(De,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const $s=ue().email("Invalid email address");function Fs(s){if(!s.trim())return[];const e=s.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function Gs({trigger:s}){const[e,n]=D.useState(!1),{locator:r}=Ne(),a=Xe(),{data:o}=se.useSession(),m=o?.user?.email,{roles:l,isLoading:x}=xt(),j=l.filter(C=>C.role!=="owner"),h=Ot({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),v=h.watch("emailsText"),c=h.watch("role"),u=Fs(v).filter(C=>{const f=$s.safeParse(C).success,I=!m||C!==m.toLowerCase();return f&&I}),b=he({mutationFn:async({emails:C,role:f})=>{if(!f)throw new Error("Please select a role");const I=await Promise.allSettled(C.map(async P=>{const A=await se.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),T=I.filter(P=>P.status==="rejected");if(T.length>0)throw new Error(`Failed to invite ${T.length} member${T.length>1?"s":""}`);return I},onSuccess:(C,{emails:f})=>{a.invalidateQueries({queryKey:le.members(r)}),a.invalidateQueries({queryKey:le.invitations(r)}),te.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),h.reset({emailsText:"",role:"user"}),n(!1)},onError:C=>{te.error(C instanceof Error?C.message:"Failed to invite members")}}),p=C=>{if(u.length===0){te.error("Please enter at least one valid email address");return}if(!C.role){te.error("Please select a role");return}b.mutate({emails:u,role:C.role})},y=u.length>0&&!!c;return t.jsxs(_t,{open:e,onOpenChange:n,children:[t.jsx(Lt,{asChild:!0,children:s}),t.jsxs(Pt,{className:"sm:max-w-lg",children:[t.jsx(Wt,{children:t.jsx(es,{children:"Invite members"})}),t.jsx(ds,{...h,children:t.jsxs("form",{onSubmit:h.handleSubmit(p),className:"space-y-4",children:[t.jsx(Ct,{control:h.control,name:"emailsText",render:({field:C})=>t.jsxs(jt,{children:[t.jsx(ms,{children:"Email addresses"}),t.jsx(vt,{children:t.jsx(us,{...C,disabled:b.isPending,placeholder:`Enter email addresses separated by commas or new lines
1
+ import{r as D,c as ae,j as t,p as $t,u as Ne,g as se,K as le,o as pt,n as tt,s as ue,b8 as Ft,be as Gt,a1 as Xe,k as Ot,h as Kt,v as te,x as Qt}from"./index-yjsBu7QA.js";import{C as qt,a as Ht}from"./collection-table-wrapper-igJ5OqPc.js";import{C as ke}from"./collection-search-D5gi0-bL.js";import{P as fe}from"./index-P_cUV9l9.js";import{B as Zt,a as Yt,b as Xt,c as Jt}from"./breadcrumb-BuFIEIOz.js";import{I as wt,b as Te,c as Se,T as ye,a as Ie,E as st}from"./empty-state-CpRLw49r.js";import{C as dt}from"./checkbox-D0Zw7dGS.js";import{c as K,B as ee}from"./button-BNRw8VbO.js";import{b as At}from"./use-connection-Dj100t8H.js";import{u as mt}from"./use-members-C8R91dOK.js";import{u as Rt}from"./useQuery-C5RIveiE.js";import{u as he}from"./useMutation-VOj1VEf8.js";import{A as ve}from"./avatar-B6WhQiHI.js";import{B as Oe}from"./badge-D19NcG12.js";import{f as we,a as Ae,b as Re,c as _e,d as Le,e as Pe,A as Me,g as De}from"./alert-dialog-BYFUia7V.js";import{D as _t,f as Lt,a as Pt,b as Wt,c as es,e as ts}from"./dialog-Csoqe4hG.js";import{D as ut,a as ft,b as ht,c as Ze,d as ss,e as ns,f as rs,g as is}from"./dropdown-menu-CsYNL9oo.js";import{i as os}from"./DotsHorizontal-DT2O2EOj.js";import{i as Mt}from"./Loading01-D8raUT2q.js";import{i as ls}from"./Lock01-0pDC11sR.js";import{s as rt}from"./Plus-BcqTpnxy.js";import{s as Dt}from"./Trash01-CR6s5yrj.js";import{i as bt}from"./X-BsLffR19.js";import{I as as}from"./input-C-GM7dsu.js";import{S as Ke}from"./switch-DBMrpKuB.js";import{E as cs}from"./error-boundary-DQ5uRgdY.js";import{a as ds,F as Ct,b as jt,c as ms,d as vt,f as Nt}from"./form-DAoJifFq.js";import{S as it,a as ot,b as lt,c as at,d as ct}from"./select-B4SPtD5h.js";import{T as us}from"./textarea-ByvgxbRE.js";import{a as fs,u as hs}from"./constants-Cpe-c81c.js";import{C as Et}from"./card-B2_21gZH.js";import{i as kt}from"./DotsVertical-D1ZY49Um.js";import{i as gs}from"./Key01-DFKkR5uc.js";import{s as xs}from"./XClose-D9VL7Fhs.js";import"./ArrowUp-D8YYlj5b.js";import"./Check-lN7sUZo8.js";import"./Grid01-DHptyetH.js";import"./List-Dl-Bi1Os.js";import"./view-mode-toggle-zGyN0eoT.js";import"./table-NP0FOAI5.js";import"./SearchMd-DVuLBPJW.js";import"./ChevronRight-BB2YL4K4.js";import"./use-collections-Hp9XPnUY.js";import"./ChevronDown-En_P43wp.js";const zt=({size:s=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,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"}));zt.displayName="ArrowLeft";const gt=({size:s=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,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"}));gt.displayName="Shield01";const Ut=({size:s=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,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"}));Ut.displayName="SwitchHorizontal01";const Bt=[{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:"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"}],ps={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",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"};function bs(){const s={Organizations:[],Connections:[],"Virtual MCPs":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Bt)s[e.category]?.push(e);return s}function Cs(){return Bt.map(s=>({value:s.name,label:ps[s.name],dangerous:s.dangerous}))}const js=D.memo(function(e){const n=ae.c(21),{connection:r,isSelected:a,hasToolsEnabled:o,activeToolsCount:m,totalToolsCount:l,onSelect:x,onToggle:j}=e,h=a?"bg-accent/50":"hover:bg-muted/50";let v;n[0]!==h?(v=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),n[0]=h,n[1]=v):v=n[1];let c;n[2]!==r.icon||n[3]!==r.title?(c=t.jsx(wt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=c):c=n[4];let N;n[5]!==r.title?(N=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=N):N=n[6];let u;n[7]!==x||n[8]!==c||n[9]!==N?(u=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:x,children:[c,N]}),n[7]=x,n[8]=c,n[9]=N,n[10]=u):u=n[10];let b;n[11]!==m||n[12]!==r.tools||n[13]!==o||n[14]!==j||n[15]!==l?(b=r.tools&&r.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[m,"/",l]}),t.jsx(dt,{checked:o,onCheckedChange:j,onClick:Es})]}),n[11]=m,n[12]=r.tools,n[13]=o,n[14]=j,n[15]=l,n[16]=b):b=n[16];let p;return n[17]!==v||n[18]!==u||n[19]!==b?(p=t.jsxs("div",{className:v,children:[u,b]}),n[17]=v,n[18]=u,n[19]=b,n[20]=p):p=n[20],p}),vs=D.memo(function(e){const n=ae.c(18),{connectionId:r,tool:a,isSelected:o,onToggle:m}=e,l=`tool-${r}-${a.name}`,x=o?"text-foreground":"text-muted-foreground";let j;n[0]!==x?(j=K("text-sm font-medium",x),n[0]=x,n[1]=j):j=n[1];let h;n[2]!==j||n[3]!==a.name?(h=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:j,children:a.name})}),n[2]=j,n[3]=a.name,n[4]=h):h=n[4];let v;n[5]!==a.description?(v=a.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),n[5]=a.description,n[6]=v):v=n[6];let c;n[7]!==h||n[8]!==v?(c=t.jsxs("div",{className:"flex-1 min-w-0",children:[h,v]}),n[7]=h,n[8]=v,n[9]=c):c=n[9];const N=`tool-${r}-${a.name}`;let u;n[10]!==o||n[11]!==m||n[12]!==N?(u=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(dt,{id:N,checked:o,onCheckedChange:m,onClick:Ts})}),n[10]=o,n[11]=m,n[12]=N,n[13]=u):u=n[13];let b;return n[14]!==l||n[15]!==c||n[16]!==u?(b=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:l,children:[c,u]}),n[14]=l,n[15]=c,n[16]=u,n[17]=b):b=n[17],b});function Ns({toolSet:s,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,a]=D.useState(""),o=D.useDeferredValue(r),[m,l]=D.useState("all"),[x,j]=D.useState(!1),h=D.useRef(new Set(Object.keys(s))),v=At({searchTerm:o.trim()||void 0}),c=n?v.filter(d=>d.connection_type!=="VIRTUAL"?!0:$t(d.connection_url)!==n):v,N=h.current,u=[...N.values()].map(d=>c.find(S=>S.id===d)).filter(d=>d!==void 0),b=c.filter(d=>!N.has(d.id)),p=[...u,...b],y=d=>{const S=s[d];return S!==void 0&&S.length>0},C=p.filter(d=>{if(m==="all")return!0;const S=y(d.id);return m==="selected"?S:m==="unselected"?!S:!0}),[f,I]=D.useState(p[0]?.id??null),T=f?p.find(d=>d.id===f)??null:null,P=T?.tools??[],A=(d,S)=>s[d]?.includes(S)??!1,_=(d,S)=>{const E=s[d]??[],g=E.includes(S),L={...s};if(g){const z=E.filter(F=>F!==S);z.length===0?delete L[d]:L[d]=z}else L[d]=[...E,S];e(L)},R=d=>{const S=p.find(F=>F.id===d);if(!S?.tools)return;const E=s[d]??[],g=S.tools.map(F=>F.name),L=E.length>0&&g.every(F=>E.includes(F)),z={...s};L?delete z[d]:(z[d]=g,I(d)),e(z)},k=d=>{I(d),j(!0)},w=()=>{j(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",x&&"hidden md:flex"),children:[t.jsx(ke,{value:r,onChange:a,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>l("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>l("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>l("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:C.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:C.map(d=>{const S=d.tools?.length??0,E=s[d.id]?.length??0;return t.jsx(js,{connection:d,isSelected:f===d.id,hasToolsEnabled:y(d.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>k(d.id),onToggle:()=>R(d.id)},d.id)})})})]}),t.jsx("div",{className:K("flex-1 flex-col",x?"flex":"hidden md:flex"),children:T?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(ee,{variant:"ghost",size:"sm",onClick:w,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(zt,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(wt,{icon:T.icon,name:T.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:T.title}),T.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:P.map(d=>t.jsx(vs,{connectionId:T.id,tool:d,isSelected:A(T.id,d.name),onToggle:()=>_(T.id,d.name)},d.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Es(s){return s.stopPropagation()}function Ts(s){return s.stopPropagation()}const Tt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Ss(s){return s.replace(/-/g," ")}function ys(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let a=!1;const o=new Set;let m=!1;for(const[l,x]of Object.entries(s)){if(l==="self"){x.includes("*")?n=!0:e.push(...x);continue}if(l==="*"){if(a=!0,x.includes("*"))m=!0;else for(const j of x)o.add(j);continue}if(r.push(l),x.includes("*"))m=!0;else for(const j of x)o.add(j)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:a,toolNames:Array.from(o),allowsAllTools:m}}function xt(){const{locator:s}=Ne(),{data:e,isLoading:n,error:r,refetch:a}=Rt({queryKey:le.organizationRoles(s),queryFn:async()=>{try{const l=await se.organization.listRoles();return l?.error?(console.error("[useOrganizationRoles] API error:",l.error),[]):l?.data??[]}catch(l){return console.error("[useOrganizationRoles] Fetch error:",l),[]}},staleTime:3e4}),o=Tt.map(l=>({role:l.value,label:l.label,isBuiltin:l.isBuiltin}));if(e&&Array.isArray(e))for(const l of e){const x=l.role;if(!x||Tt.some(b=>b.value===x))continue;const{staticPermissions:j,allowsAllStaticPermissions:h,connectionIds:v,allowsAllConnections:c,toolNames:N,allowsAllTools:u}=ys(l.permission);o.push({id:l.id,role:x,label:Ss(x),isBuiltin:!1,permission:l.permission??void 0,staticPermissionCount:h?-1:j.length,allowsAllStaticPermissions:h,connectionCount:c?-1:v.length,allowsAllConnections:c,toolCount:u?-1:N.length,allowsAllTools:u})}const m=o.filter(l=>!l.isBuiltin);return{roles:o,customRoles:m,builtinRoles:o.filter(l=>l.isBuiltin),isLoading:n,error:r,refetch:a}}const Is=pt({role:pt({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:Gt(),staticPermissions:tt(ue()),toolSet:Ft(ue(),tt(ue())),memberIds:tt(ue())});function Vt(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Os=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],nt=["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 ws(s){if(!s)return"bg-neutral-400";let e=0;for(let r=0;r<s.length;r++){const a=s.charCodeAt(r);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%nt.length;return nt[n]??nt[0]}function Qe(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function As(s){const e=ae.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:a,onPermissionsChange:o,readOnly:m}=s,l=m===void 0?!1:m,[x,j]=D.useState(""),h=D.useDeferredValue(x);let v,c,N,u,b;if(e[0]!==n||e[1]!==h||e[2]!==a||e[3]!==o||e[4]!==l||e[5]!==x||e[6]!==r){const C=bs(),f=Cs(),I=f.filter(w=>w.label.toLowerCase().includes(h.toLowerCase())),T=w=>{if(r.includes(w))o(r.filter(d=>d!==w));else{const d=[...r,w];d.length===f.length?(a(!0),o([])):o(d)}};N="flex flex-col h-full",e[12]!==x?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(ke,{value:x,onChange:j,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=x,e[13]=u):u=e[13];const P=!l&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=K("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let _;e[16]!==n||e[17]!==a||e[18]!==o||e[19]!==l?(_=()=>{if(l)return;a(!n),o([])},e[16]=n,e[17]=a,e[18]=o,e[19]=l,e[20]=_):_=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=R):R=e[21];let k;e[22]!==n||e[23]!==a||e[24]!==o||e[25]!==l?(k=t.jsx("div",{onClick:Ms,children:l?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ke,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ke,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})}),e[22]=n,e[23]=a,e[24]=o,e[25]=l,e[26]=k):k=e[26],e[27]!==k||e[28]!==A||e[29]!==_?(b=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:A,onClick:_,children:[R,k]})}),e[27]=k,e[28]=A,e[29]=_,e[30]=b):b=e[30],v="flex-1 overflow-auto",c=Object.entries(C).map(w=>{const[d,S]=w,E=I.filter(g=>S.some(L=>L.name===g.value));return E.length===0?null:t.jsxs("div",{className:"mb-6 last:mb-0",children:[t.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:d}),t.jsx("div",{className:"space-y-1",children:E.map(g=>t.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3",!l&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!l)if(n){a(!1);const L=f.map(Ps);o(L.filter(z=>z!==g.value))}else T(g.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:g.label})}),t.jsx("div",{onClick:Ls,children:l?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ke,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(_s);o(L.filter(z=>z!==g.value))}else T(g.value)}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ke,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(Rs);o(L.filter(z=>z!==g.value))}else T(g.value)}})})]},g.value))})]},d)}),e[0]=n,e[1]=h,e[2]=a,e[3]=o,e[4]=l,e[5]=x,e[6]=r,e[7]=v,e[8]=c,e[9]=N,e[10]=u,e[11]=b}else v=e[7],c=e[8],N=e[9],u=e[10],b=e[11];let p;e[31]!==v||e[32]!==c?(p=t.jsx("div",{className:v,children:c}),e[31]=v,e[32]=c,e[33]=p):p=e[33];let y;return e[34]!==N||e[35]!==u||e[36]!==b||e[37]!==p?(y=t.jsxs("div",{className:N,children:[u,b,p]}),e[34]=N,e[35]=u,e[36]=b,e[37]=p,e[38]=y):y=e[38],y}function Rs(s){return s.value}function _s(s){return s.value}function Ls(s){return s.stopPropagation()}function Ps(s){return s.value}function Ms(s){return s.stopPropagation()}function Ds(s){const e=ae.c(56),{open:n,onOpenChange:r,selectedMemberIds:a,onAddMembers:o}=s,[m,l]=D.useState(""),x=D.useDeferredValue(m);let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0];const[h,v]=D.useState(j),{data:c}=mt();let N,u,b,p,y,C,f,I,T,P,A;if(e[1]!==c?.data?.members||e[2]!==x||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==h||e[7]!==m||e[8]!==a){const L=c?.data?.members??[];let z;e[20]!==x?(z=B=>{const i=x.toLowerCase();return B.user?.name?.toLowerCase().includes(i)||B.user?.email?.toLowerCase().includes(i)},e[20]=x,e[21]=z):z=e[21];const F=L.filter(z),Q=ks;let q;e[22]!==a?(q=B=>a.includes(B),e[22]=a,e[23]=q):q=e[23];const H=q;let X;e[24]!==h?(X=B=>{h.includes(B)?v(h.filter(i=>i!==B)):v([...h,B])},e[24]=h,e[25]=X):X=e[25];const re=X;let ne;e[26]!==o||e[27]!==r||e[28]!==h?(ne=()=>{o(h),v([]),r(!1)},e[26]=o,e[27]=r,e[28]=h,e[29]=ne):ne=e[29],b=ne,u=we,P=n,A=r,N=Ae,I="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(Re,{className:"px-6 pt-6",children:[t.jsx(_e,{children:"Add Members to Role"}),t.jsx(Le,{children:"Select members to add to this role."})]}),e[30]=T):T=e[30],C="flex flex-col h-80",e[31]!==m?(f=t.jsx(ke,{value:m,onChange:l,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=m,e[32]=f):f=e[32],p="flex-1 overflow-auto",y=F.length===0?t.jsx("div",{className:"flex items-center justify-center h-full px-6",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:m?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:F.map(B=>{const i=Q(B),O=H(B.id),G=h.includes(B.id);return t.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!i||O?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx(dt,{checked:G||O,onCheckedChange:()=>{i&&!O&&re(B.id)},disabled:!i||O}),t.jsx(ve,{url:B.user?.image??void 0,fallback:Vt(B.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:B.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:B.user?.email})]}),!i&&t.jsx(Oe,{variant:"secondary",className:"shrink-0",children:"Owner"}),O&&i&&t.jsx(Oe,{variant:"outline",className:"shrink-0",children:"Added"})]},B.id)})}),e[1]=c?.data?.members,e[2]=x,e[3]=o,e[4]=r,e[5]=n,e[6]=h,e[7]=m,e[8]=a,e[9]=N,e[10]=u,e[11]=b,e[12]=p,e[13]=y,e[14]=C,e[15]=f,e[16]=I,e[17]=T,e[18]=P,e[19]=A}else N=e[9],u=e[10],b=e[11],p=e[12],y=e[13],C=e[14],f=e[15],I=e[16],T=e[17],P=e[18],A=e[19];let _;e[33]!==p||e[34]!==y?(_=t.jsx("div",{className:p,children:y}),e[33]=p,e[34]=y,e[35]=_):_=e[35];let R;e[36]!==_||e[37]!==C||e[38]!==f?(R=t.jsxs("div",{className:C,children:[f,_]}),e[36]=_,e[37]=C,e[38]=f,e[39]=R):R=e[39];let k;e[40]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Me,{children:"Cancel"}),e[40]=k):k=e[40];const w=h.length===0,d=h.length>0&&`(${h.length})`;let S;e[41]!==b||e[42]!==w||e[43]!==d?(S=t.jsxs(Pe,{className:"px-6 pb-6",children:[k,t.jsxs(De,{onClick:b,disabled:w,children:["Add ",d]})]}),e[41]=b,e[42]=w,e[43]=d,e[44]=S):S=e[44];let E;e[45]!==N||e[46]!==R||e[47]!==S||e[48]!==I||e[49]!==T?(E=t.jsxs(N,{className:I,children:[T,R,S]}),e[45]=N,e[46]=R,e[47]=S,e[48]=I,e[49]=T,e[50]=E):E=e[50];let g;return e[51]!==u||e[52]!==E||e[53]!==P||e[54]!==A?(g=t.jsx(u,{open:P,onOpenChange:A,children:E}),e[51]=u,e[52]=E,e[53]=P,e[54]=A,e[55]=g):g=e[55],g}function ks(s){return s.role!=="owner"}function zs(s){const e=ae.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:a}=s,o=a===void 0?!1:a,[m,l]=D.useState(""),x=D.useDeferredValue(m),[j,h]=D.useState(!1),{data:v}=mt();let c,N,u,b,p;if(e[0]!==v?.data?.members||e[1]!==x||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==m){const I=v?.data?.members??[];let T;e[11]!==n?(T=E=>n.includes(E.id),e[11]=n,e[12]=T):T=e[12];const P=I.filter(T);let A;e[13]!==x?(A=E=>{const g=x.toLowerCase();return E.user?.name?.toLowerCase().includes(g)||E.user?.email?.toLowerCase().includes(g)},e[13]=x,e[14]=A):A=e[14];const _=P.filter(A);let R;e[15]!==n||e[16]!==r?(R=E=>{r(n.filter(g=>g!==E))},e[15]=n,e[16]=r,e[17]=R):R=e[17];const k=R;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],c=w,b="flex flex-col h-full";let d;e[21]!==m?(d=t.jsx(ke,{value:m,onChange:l,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=m,e[22]=d):d=e[22];let S;e[23]!==o?(S=o?t.jsx("div",{className:"pr-4",children:t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(rt,{size:16}),"Add Member"]})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):t.jsx("div",{className:"pr-4",children:t.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>h(!0),children:[t.jsx(rt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==d||e[26]!==S?(p=t.jsxs("div",{className:"flex items-center border-b border-border",children:[d,S]}),e[25]=d,e[26]=S,e[27]=p):p=e[27],N="flex-1 overflow-auto",u=P.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):_.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',m,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:_.map(E=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(ve,{url:E.user?.image??void 0,fallback:Vt(E.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(bt,{size:16})})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>k(E.id),children:t.jsx(bt,{size:16})})]},E.id))}),e[0]=v?.data?.members,e[1]=x,e[2]=n,e[3]=r,e[4]=o,e[5]=m,e[6]=c,e[7]=N,e[8]=u,e[9]=b,e[10]=p}else c=e[6],N=e[7],u=e[8],b=e[9],p=e[10];let y;e[28]!==N||e[29]!==u?(y=t.jsx("div",{className:N,children:u}),e[28]=N,e[29]=u,e[30]=y):y=e[30];let C;e[31]!==j||e[32]!==c||e[33]!==n?(C=t.jsx(Ds,{open:j,onOpenChange:h,selectedMemberIds:n,onAddMembers:c}),e[31]=j,e[32]=c,e[33]=n,e[34]=C):C=e[34];let f;return e[35]!==b||e[36]!==p||e[37]!==y||e[38]!==C?(f=t.jsxs("div",{className:b,children:[p,y,C]}),e[35]=b,e[36]=p,e[37]=y,e[38]=C,e[39]=f):f=e[39],f}function Us(s){const e=ae.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Mt,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==s?(r=t.jsx(D.Suspense,{fallback:n,children:t.jsx(zs,{...s})}),e[1]=s,e[2]=r):r=e[2],r}const Bs={owner:[],admin:[],user:[]};function qe(s,e){const n=s==="owner"||s==="admin",r=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:Bs[s],toolSet:{},memberIds:r.map(a=>a.id)}}function Vs({trigger:s,onSuccess:e}){const[n,r]=D.useState(!1),[a,o]=D.useState("mcp"),{locator:m}=Ne(),l=Xe(),x=At()??[],{customRoles:j,refetch:h}=xt(),{data:v}=Rt({queryKey:le.members(m),queryFn:()=>se.organization.listMembers()}),c=Ot({resolver:Kt(Is),defaultValues:Qe()}),N=c.formState.isValid,u=c.formState.isDirty,[b,p]=D.useState(null),[y,C]=D.useState(null),f=!c.watch("role.id")&&!c.watch("role.slug")&&!y,[I,T]=D.useState(null),[P,A]=D.useState(!1),[_,R]=D.useState(null),k=i=>{const O=i.permission||{},G=O.self||[],oe=G.includes("*"),ie=oe?[]:G.filter(U=>U!=="*"),J={};for(const[U,V]of Object.entries(O))if(U!=="self")if(U==="*")for(const Y of x)V.includes("*")?J[Y.id]=Y.tools?.map(ce=>ce.name)??[]:J[Y.id]=V;else{const Y=x.find(ce=>ce.id===U);Y&&(V.includes("*")?J[U]=Y.tools?.map(ce=>ce.name)??[]:J[U]=V)}const me=(v?.data?.members??[]).filter(U=>U.role===i.role).map(U=>U.id);return{role:{id:i.id,slug:i.role,label:i.label},allowAllStaticPermissions:oe,staticPermissions:ie,toolSet:J,memberIds:me}},w=i=>{const O=k(i);c.reset(O),p(i.id??null),C(null)},d=()=>{c.reset(Qe()),p(null),C(null),o("mcp")},S=i=>{u&&N?(R(()=>()=>w(i)),A(!0)):w(i)},E=async()=>{u&&N&&await X(),d()},g=i=>{if(u&&N)R(()=>()=>{const O=qe(i,v?.data?.members??[]);c.reset(O),C(i),p(null),o("org")}),A(!0);else{const O=qe(i,v?.data?.members??[]);c.reset(O),C(i),p(null),o("org")}},L=i=>{if(!i&&c.formState.isDirty&&N){R(()=>()=>{r(!1),c.reset(Qe()),C(null)}),A(!0);return}if(r(i),!i)c.reset(Qe()),C(null),p(null);else{const O=j[0];if(O)w(O);else{const G=qe("user",v?.data?.members??[]);c.reset(G),C("user"),p(null),o("org")}}},z=()=>{A(!1),_&&(_(),R(null))},F=i=>{const O={};i.allowAllStaticPermissions?O.self=["*"]:i.staticPermissions.length>0&&(O.self=i.staticPermissions);for(const[G,oe]of Object.entries(i.toolSet))if(oe.length>0){const J=x.find(Z=>Z.id===G)?.tools?.map(Z=>Z.name)??[];J.length>0&&J.every(Z=>oe.includes(Z))?O[G]=["*"]:O[G]=oe}return O},Q=he({mutationFn:async i=>{const O=F(i),G=i.role.slug||i.role.label.toLowerCase().replace(/\s+/g,"-");if(i.role.slug&&!i.role.id){const J=(v?.data?.members??[]).filter(U=>U.role===i.role.slug).map(U=>U.id),Z=i.memberIds.filter(U=>!J.includes(U)),me=J.filter(U=>!i.memberIds.includes(U));for(const U of Z){const V=await se.organization.updateMemberRole({memberId:U,role:[i.role.slug]});if(V?.error)throw new Error(V.error.message)}for(const U of me){const V=await se.organization.updateMemberRole({memberId:U,role:["user"]});if(V?.error)throw new Error(V.error.message)}return i}else if(i.role.id){const ie=await se.organization.updateRole({roleId:i.role.id,data:{permission:O}});if(ie?.error)throw new Error(ie.error.message);const Z=(v?.data?.members??[]).filter(V=>V.role===i.role.slug).map(V=>V.id),me=i.memberIds.filter(V=>!Z.includes(V)),U=Z.filter(V=>!i.memberIds.includes(V));for(const V of me){const Y=await se.organization.updateMemberRole({memberId:V,role:[i.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const V of U){const Y=await se.organization.updateMemberRole({memberId:V,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return i}else{const ie=await se.organization.createRole({role:G,permission:O});if(ie?.error)throw new Error(ie.error.message);for(const J of i.memberIds){const Z=await se.organization.updateMemberRole({memberId:J,role:[G]});if(Z?.error)throw new Error(Z.error.message)}return{...i,role:{...i.role,id:ie.data?.roleData?.id,slug:G}}}},onSuccess:(i,O)=>{l.invalidateQueries({queryKey:le.members(m)}),l.invalidateQueries({queryKey:le.organizationRoles(m)});const G=!O.role.id&&!O.role.slug,oe=O.role.slug&&!O.role.id;te.success(oe?"Members updated successfully!":G?"Role created successfully!":"Role updated successfully!"),h(),c.reset(i),i.role.id&&p(i.role.id),e?.()},onError:i=>{te.error(i instanceof Error?i.message:"Failed to save role")}}),q=he({mutationFn:async i=>{const O=await se.organization.deleteRole({roleId:i});if(O?.error)throw new Error(O.error.message);return O?.data},onSuccess:()=>{if(l.invalidateQueries({queryKey:le.members(m)}),l.invalidateQueries({queryKey:le.organizationRoles(m)}),te.success("Role deleted successfully!"),h(),I?.id===b){const i=j.filter(O=>O.id!==I?.id);if(i[0])w(i[0]);else{const O=qe("user",v?.data?.members??[]);c.reset(O),C("user"),p(null),o("org")}}},onError:i=>{te.error(i instanceof Error?i.message:"Failed to delete role")}}),H=Q.isPending||q.isPending,X=async()=>{const i=c.getValues();if(!i.role.label.trim()){te.error("Role name is required"),c.setFocus("role.label");return}await Q.mutateAsync(i)},re=c.handleSubmit(i=>{if(!i.role.label.trim()){te.error("Role name is required"),c.setFocus("role.label");return}Q.mutate(i)}),ne=i=>{i.id&&T({id:i.id,label:i.label})},B=()=>{I?.id&&q.mutate(I.id),T(null)};return t.jsxs(_t,{open:n,onOpenChange:L,children:[t.jsx(Lt,{asChild:!0,children:s}),t.jsx(Pt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[t.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:[t.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:t.jsxs("div",{className:"flex flex-col gap-1",children:[Os.map(i=>{const O=y===i.role;return t.jsxs("div",{className:K("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",O?"bg-accent":"hover:bg-muted/50"),onClick:()=>g(i.role),children:[t.jsx("div",{className:K("shrink-0 size-3 rounded-full",i.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsx(ls,{size:14,className:"text-muted-foreground shrink-0"})]},i.role)}),j.map(i=>{const O=b===i.id;return t.jsxs("div",{className:K("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",O?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(i),children:[t.jsx("div",{className:K("shrink-0 size-3 rounded-full",ws(i.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsxs(ut,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:K("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",O&&"opacity-100 pointer-events-auto"),onClick:G=>G.stopPropagation(),children:t.jsx(os,{size:14})})}),t.jsx(ht,{align:"end",children:t.jsxs(Ze,{className:"text-destructive",onClick:G=>{G.stopPropagation(),ne(i)},children:[t.jsx(Dt,{size:16}),"Delete"]})})]})]},i.id)}),f&&t.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[t.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),t.jsx(as,{...c.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}),t.jsx(Oe,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),t.jsx("div",{className:"px-3.5 pb-3.5",children:t.jsxs(ee,{variant:"outline",size:"default",onClick:E,disabled:H||u,className:"w-full h-10",children:[t.jsx(rt,{size:16}),"Create new role"]})})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!y&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:K("h-8 rounded-lg px-2 py-1",a==="mcp"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"MCP Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o("org"),className:K("h-8 rounded-lg px-2 py-1",a==="org"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Organization Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o("members"),className:K("h-8 rounded-lg px-2 py-1",a==="members"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Members"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[a==="mcp"&&!y&&t.jsx(Ns,{toolSet:c.watch("toolSet"),onToolSetChange:i=>c.setValue("toolSet",i,{shouldDirty:!0})}),a==="org"&&t.jsx(As,{allowAllStaticPermissions:c.watch("allowAllStaticPermissions"),staticPermissions:c.watch("staticPermissions"),onAllowAllChange:i=>c.setValue("allowAllStaticPermissions",i,{shouldDirty:!0}),onPermissionsChange:i=>c.setValue("staticPermissions",i,{shouldDirty:!0}),readOnly:!!y}),a==="members"&&t.jsx(Us,{memberIds:c.watch("memberIds"),onMemberIdsChange:i=>c.setValue("memberIds",i,{shouldDirty:!0}),readOnly:y==="owner"})]}),(!y||y!=="owner")&&t.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[t.jsx(ee,{variant:"outline",onClick:()=>L(!1),disabled:H,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:re,disabled:H||!N||!c.formState.isDirty,className:"h-10",children:Q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),t.jsx(we,{open:I!==null,onOpenChange:i=>!i&&T(null),children:t.jsxs(Ae,{children:[t.jsxs(Re,{children:[t.jsx(_e,{children:"Delete Role"}),t.jsxs(Le,{children:['Are you sure you want to delete the "',I?.label,'" role? This action cannot be undone.']})]}),t.jsxs(Pe,{children:[t.jsx(Me,{children:"Cancel"}),t.jsx(De,{onClick:B,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(we,{open:P,onOpenChange:A,children:t.jsxs(Ae,{children:[t.jsxs(Re,{children:[t.jsx(_e,{children:"Discard Changes"}),t.jsx(Le,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(Pe,{children:[t.jsx(Me,{onClick:()=>R(null),children:"Keep Editing"}),t.jsx(De,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const $s=ue().email("Invalid email address");function Fs(s){if(!s.trim())return[];const e=s.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function Gs({trigger:s}){const[e,n]=D.useState(!1),{locator:r}=Ne(),a=Xe(),{data:o}=se.useSession(),m=o?.user?.email,{roles:l,isLoading:x}=xt(),j=l.filter(C=>C.role!=="owner"),h=Ot({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),v=h.watch("emailsText"),c=h.watch("role"),u=Fs(v).filter(C=>{const f=$s.safeParse(C).success,I=!m||C!==m.toLowerCase();return f&&I}),b=he({mutationFn:async({emails:C,role:f})=>{if(!f)throw new Error("Please select a role");const I=await Promise.allSettled(C.map(async P=>{const A=await se.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),T=I.filter(P=>P.status==="rejected");if(T.length>0)throw new Error(`Failed to invite ${T.length} member${T.length>1?"s":""}`);return I},onSuccess:(C,{emails:f})=>{a.invalidateQueries({queryKey:le.members(r)}),a.invalidateQueries({queryKey:le.invitations(r)}),te.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),h.reset({emailsText:"",role:"user"}),n(!1)},onError:C=>{te.error(C instanceof Error?C.message:"Failed to invite members")}}),p=C=>{if(u.length===0){te.error("Please enter at least one valid email address");return}if(!C.role){te.error("Please select a role");return}b.mutate({emails:u,role:C.role})},y=u.length>0&&!!c;return t.jsxs(_t,{open:e,onOpenChange:n,children:[t.jsx(Lt,{asChild:!0,children:s}),t.jsxs(Pt,{className:"sm:max-w-lg",children:[t.jsx(Wt,{children:t.jsx(es,{children:"Invite members"})}),t.jsx(ds,{...h,children:t.jsxs("form",{onSubmit:h.handleSubmit(p),className:"space-y-4",children:[t.jsx(Ct,{control:h.control,name:"emailsText",render:({field:C})=>t.jsxs(jt,{children:[t.jsx(ms,{children:"Email addresses"}),t.jsx(vt,{children:t.jsx(us,{...C,disabled:b.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"})}),t.jsx(Nt,{})]})}),t.jsx(Ct,{control:h.control,name:"role",render:({field:C})=>t.jsxs(jt,{children:[t.jsx(vt,{children:t.jsxs(it,{value:C.value,onValueChange:C.onChange,disabled:b.isPending||x,children:[t.jsx(ot,{className:"w-full",children:t.jsx(lt,{placeholder:"Select a role"})}),t.jsx(at,{children:j.map(f=>{const I=[];return f.isBuiltin||(f.allowsAllStaticPermissions?I.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&I.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?I.push("All connections"):f.connectionCount&&f.connectionCount>0&&I.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?I.push("all tools"):f.toolCount&&f.toolCount>0&&I.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),t.jsx(ct,{value:f.role,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:f.label}),!f.isBuiltin&&I.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:I.join(", ")})]})},f.role)})})]})}),t.jsx(Nt,{})]})}),t.jsxs(ts,{children:[t.jsx(ee,{variant:"outline",onClick:()=>{h.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:b.isPending,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:b.isPending||!y,children:b.isPending?"Inviting...":`Invite ${u.length||0} Member${u.length!==1?"s":""}`})]})]})})]})]})}function Ks(){const s=ae.c(9),{org:e,locator:n}=Ne();let r;s[0]!==e.id?(r={connectionId:fs,orgId:e.id},s[0]=e.id,s[1]=r):r=s[1];const a=hs(r);let o;s[2]!==n?(o=le.invitations(n),s[2]=n,s[3]=o):o=s[3];let m;s[4]!==a?(m=async()=>{const x=await a.callTool({name:"ORGANIZATION_GET",arguments:{}});return(x.structuredContent??x)?.invitations??[]},s[4]=a,s[5]=m):m=s[5];let l;return s[6]!==o||s[7]!==m?(l={queryKey:o,queryFn:m},s[6]=o,s[7]=m,s[8]=l):l=s[8],Qt(l)}function Qs(){const s=ae.c(5),{locator:e}=Ne(),n=Xe();let r;s[0]!==e||s[1]!==n?(r={mutationFn:Hs,onSuccess:()=>{n.invalidateQueries({queryKey:le.invitations(e)}),te.success("Invitation cancelled")},onError:qs},s[0]=e,s[1]=n,s[2]=r):r=s[2];const a=he(r);let o;return s[3]!==a?(o={cancel:a},s[3]=a,s[4]=o):o=s[4],o}function qs(s){te.error(s instanceof Error?s.message:"Failed to cancel invitation")}async function Hs(s){const e=await se.organization.cancelInvitation({invitationId:s});if(e?.error)throw new Error(e.error.message);return e.data}const St=["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"],Zs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ye(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ys(s){const e=new Map;for(const[n,r]of Object.entries(Zs))e.set(n,r);for(let n=0;n<s.length;n++){const r=s[n];r&&!e.has(r.role)&&e.set(r.role,St[n%St.length]??"bg-neutral-400")}return e}function Xs(s){return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function He(s){const e=ae.c(79),{role:n,memberId:r,isOwner:a,roleColorMap:o,selectableRoles:m,onRoleChange:l,size:x,className:j}=s,h=x===void 0?"xs":x;let v,c,N,u,b,p,y,C,f,I,T;if(e[0]!==j||e[1]!==a||e[2]!==r||e[3]!==l||e[4]!==n||e[5]!==o||e[6]!==m||e[7]!==h){T=Symbol.for("react.early_return_sentinel");e:{const E=o.get(n)??"bg-neutral-400";if(a){let g;e[19]!==r||e[20]!==l?(g=B=>l(r,B),e[19]=r,e[20]=l,e[21]=g):g=e[21];let L;e[22]!==n?(L=t.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=L):L=e[23];const z=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:K("size-2 rounded-full shrink-0",E)}),L]});let F;e[24]!==z?(F=t.jsx(lt,{children:z}),e[24]=z,e[25]=F):F=e[25];let Q;e[26]!==j||e[27]!==h||e[28]!==F?(Q=t.jsx(ot,{size:h,className:j,children:F}),e[26]=j,e[27]=h,e[28]=F,e[29]=Q):Q=e[29];let q;if(e[30]!==o||e[31]!==m){let B;e[33]!==o?(B=i=>{const O=o.get(i.role)??"bg-neutral-400";return t.jsx(ct,{value:i.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:K("size-3 rounded-full",O)}),t.jsx("span",{className:"capitalize",children:i.label})]})},i.role)},e[33]=o,e[34]=B):B=e[34],q=m.map(B),e[30]=o,e[31]=m,e[32]=q}else q=e[32];let H;e[35]!==q?(H=t.jsx(at,{children:q}),e[35]=q,e[36]=H):H=e[36];let X;e[37]!==a||e[38]!==n||e[39]!==g||e[40]!==Q||e[41]!==H?(X=t.jsx(ye,{asChild:!0,children:t.jsx("div",{className:"w-fit",children:t.jsxs(it,{value:n,onValueChange:g,disabled:a,children:[Q,H]})})}),e[37]=a,e[38]=n,e[39]=g,e[40]=Q,e[41]=H,e[42]=X):X=e[42];let re;e[43]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Ie,{children:t.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=re):re=e[43];let ne;e[44]!==X?(ne=t.jsx(Te,{children:t.jsxs(Se,{children:[X,re]})}),e[44]=X,e[45]=ne):ne=e[45],T=ne;break e}N=it,C=n,e[46]!==r||e[47]!==l?(f=g=>l(r,g),e[46]=r,e[47]=l,e[48]=f):f=e[48],I=a,c=ot,p=h,y=j,v=lt,b="flex items-center gap-2 min-w-0",u=K("size-2 rounded-full shrink-0",E)}e[0]=j,e[1]=a,e[2]=r,e[3]=l,e[4]=n,e[5]=o,e[6]=m,e[7]=h,e[8]=v,e[9]=c,e[10]=N,e[11]=u,e[12]=b,e[13]=p,e[14]=y,e[15]=C,e[16]=f,e[17]=I,e[18]=T}else v=e[8],c=e[9],N=e[10],u=e[11],b=e[12],p=e[13],y=e[14],C=e[15],f=e[16],I=e[17],T=e[18];if(T!==Symbol.for("react.early_return_sentinel"))return T;let P;e[49]!==u?(P=t.jsx("div",{className:u}),e[49]=u,e[50]=P):P=e[50];let A;e[51]!==n?(A=t.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=A):A=e[52];let _;e[53]!==P||e[54]!==A||e[55]!==b?(_=t.jsxs("div",{className:b,children:[P,A]}),e[53]=P,e[54]=A,e[55]=b,e[56]=_):_=e[56];let R;e[57]!==v||e[58]!==_?(R=t.jsx(v,{children:_}),e[57]=v,e[58]=_,e[59]=R):R=e[59];let k;e[60]!==c||e[61]!==R||e[62]!==p||e[63]!==y?(k=t.jsx(c,{size:p,className:y,children:R}),e[60]=c,e[61]=R,e[62]=p,e[63]=y,e[64]=k):k=e[64];let w;if(e[65]!==o||e[66]!==m){let E;e[68]!==o?(E=g=>{const L=o.get(g.role)??"bg-neutral-400";return t.jsx(ct,{value:g.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:K("size-3 rounded-full",L)}),t.jsx("span",{className:"capitalize",children:g.label})]})},g.role)},e[68]=o,e[69]=E):E=e[69],w=m.map(E),e[65]=o,e[66]=m,e[67]=w}else w=e[67];let d;e[70]!==w?(d=t.jsx(at,{children:w}),e[70]=w,e[71]=d):d=e[71];let S;return e[72]!==N||e[73]!==k||e[74]!==d||e[75]!==C||e[76]!==f||e[77]!==I?(S=t.jsxs(N,{value:C,onValueChange:f,disabled:I,children:[k,d]}),e[72]=N,e[73]=k,e[74]=d,e[75]=C,e[76]=f,e[77]=I,e[78]=S):S=e[78],S}function yt(s){const e=ae.c(51),{member:n,roles:r,onChangeRole:a,onRemove:o,isUpdating:m}=s,l=m===void 0?!1:m,x=n.role==="owner";let j,h,v,c,N,u,b,p,y;if(e[0]!==x||e[1]!==l||e[2]!==n.id||e[3]!==n.role||e[4]!==a||e[5]!==r){let k;e[15]!==n.role?(k=g=>g.role!==n.role&&g.role!=="owner",e[15]=n.role,e[16]=k):k=e[16];const w=r.filter(k);c=ut;let d;e[17]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(kt,{size:20}),e[17]=d):d=e[17],e[18]!==x?(y=t.jsx(ft,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:x,onClick:Ws,children:d})}),e[18]=x,e[19]=y):y=e[19],v=ht,b="end",p=Js,h=ss;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Ut,{size:16}),e[20]=S):S=e[20],e[21]!==l?(u=t.jsxs(ns,{disabled:l,children:[S,"Change Role"]}),e[21]=l,e[22]=u):u=e[22],j=rs;let E;e[23]!==l||e[24]!==n.id||e[25]!==a?(E=g=>{const L=[];return g.isBuiltin||(g.allowsAllStaticPermissions?L.push("Full org access"):g.staticPermissionCount&&g.staticPermissionCount>0&&L.push(`${g.staticPermissionCount} org perm${g.staticPermissionCount!==1?"s":""}`),g.allowsAllConnections?L.push("All connections"):g.connectionCount&&g.connectionCount>0&&L.push(`${g.connectionCount} connection${g.connectionCount!==1?"s":""}`),(g.connectionCount!==0||g.allowsAllConnections)&&(g.allowsAllTools?L.push("all tools"):g.toolCount&&g.toolCount>0&&L.push(`${g.toolCount} tool${g.toolCount!==1?"s":""}`))),t.jsxs(Ze,{onClick:z=>{z.stopPropagation(),a(n.id,g.role)},disabled:l,children:[g.isBuiltin?t.jsx(gt,{size:16}):t.jsx(gs,{size:16}),t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{children:g.label}),!g.isBuiltin&&L.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:L.join(", ")})]})]},g.role)},e[23]=l,e[24]=n.id,e[25]=a,e[26]=E):E=e[26],N=w.map(E),e[0]=x,e[1]=l,e[2]=n.id,e[3]=n.role,e[4]=a,e[5]=r,e[6]=j,e[7]=h,e[8]=v,e[9]=c,e[10]=N,e[11]=u,e[12]=b,e[13]=p,e[14]=y}else j=e[6],h=e[7],v=e[8],c=e[9],N=e[10],u=e[11],b=e[12],p=e[13],y=e[14];let C;e[27]!==j||e[28]!==N?(C=t.jsx(j,{children:N}),e[27]=j,e[28]=N,e[29]=C):C=e[29];let f;e[30]!==h||e[31]!==u||e[32]!==C?(f=t.jsxs(h,{children:[u,C]}),e[30]=h,e[31]=u,e[32]=C,e[33]=f):f=e[33];let I;e[34]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(is,{}),e[34]=I):I=e[34];let T;e[35]!==n.id||e[36]!==o?(T=k=>{k.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=T):T=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Dt,{size:16}),e[38]=P):P=e[38];let A;e[39]!==T?(A=t.jsxs(Ze,{variant:"destructive",onClick:T,children:[P,"Remove Member"]}),e[39]=T,e[40]=A):A=e[40];let _;e[41]!==v||e[42]!==A||e[43]!==b||e[44]!==p||e[45]!==f?(_=t.jsxs(v,{align:b,onClick:p,children:[f,I,A]}),e[41]=v,e[42]=A,e[43]=b,e[44]=p,e[45]=f,e[46]=_):_=e[46];let R;return e[47]!==c||e[48]!==_||e[49]!==y?(R=t.jsxs(c,{children:[y,_]}),e[47]=c,e[48]=_,e[49]=y,e[50]=R):R=e[50],R}function Js(s){return s.stopPropagation()}function Ws(s){return s.stopPropagation()}function It(s){const e=ae.c(8),{invitationId:n,onCancel:r,isCancelling:a}=s,o=a===void 0?!1:a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(ft,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:tn,children:t.jsx(kt,{size:20})})}),e[0]=m):m=e[0];let l;e[1]!==n||e[2]!==r?(l=h=>{h.stopPropagation(),r(n)},e[1]=n,e[2]=r,e[3]=l):l=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(xs,{size:16}),e[4]=x):x=e[4];let j;return e[5]!==o||e[6]!==l?(j=t.jsxs(ut,{children:[m,t.jsx(ht,{align:"end",onClick:en,children:t.jsxs(Ze,{variant:"destructive",onClick:l,disabled:o,children:[x,"Cancel Invitation"]})})]}),e[5]=o,e[6]=l,e[7]=j):j=e[7],j}function en(s){return s.stopPropagation()}function tn(s){return s.stopPropagation()}function sn(){const s=ae.c(78),{data:e}=mt(),{data:n}=Ks(),r=Qs(),a=Xe(),{locator:o}=Ne(),[m,l]=D.useState(null),[x,j]=D.useState(null),[h,v]=D.useState(""),[c,N]=D.useState("table"),[u,b]=D.useState("member"),[p,y]=D.useState("asc"),C=e?.data?.members;let f;s[0]!==u?(f=M=>{u===M?y(xn):(b(M),y("asc"))},s[0]=u,s[1]=f):f=s[1];const I=f;let T=C??[],P=n??[];if(h){const M=h.toLowerCase();T=T.filter($=>$.user?.name?.toLowerCase().includes(M)||$.user?.email?.toLowerCase().includes(M)||$.role?.toLowerCase().includes(M)),P=P.filter($=>$.email?.toLowerCase().includes(M)||$.role?.toLowerCase().includes(M))}if(u&&p){let M;s[2]!==p||s[3]!==u?(M=($,W)=>{let de,Ee;e:switch(u){case"member":{de=$.user?.name||"",Ee=W.user?.name||"";break e}case"role":{de=$.role||"",Ee=W.role||"";break e}case"joined":{de=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",Ee=W.createdAt?typeof W.createdAt=="string"?W.createdAt:W.createdAt.toISOString():"";break e}default:return 0}return p==="asc"?de.localeCompare(Ee):Ee.localeCompare(de)},s[2]=p,s[3]=u,s[4]=M):M=s[4],T=[...T].sort(M)}const A=T;let _;s[5]!==o||s[6]!==a?(_={mutationFn:gn,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(o)}),te.success("Member has been removed from the organization"),l(null)},onError:hn},s[5]=o,s[6]=a,s[7]=_):_=s[7];const R=he(_);let k;s[8]!==o||s[9]!==a?(k={mutationFn:fn,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(o)}),te.success("Member's role has been updated")},onError:un},s[8]=o,s[9]=a,s[10]=k):k=s[10];const w=he(k);let d;s[11]!==o||s[12]!==a?(d={mutationFn:mn,onSuccess:()=>{a.invalidateQueries({queryKey:le.invitations(o)}),te.success("Invitation role has been updated")},onError:dn},s[11]=o,s[12]=a,s[13]=d):d=s[13];const S=he(d),{roles:E,customRoles:g}=xt();let L;s[14]!==g?(L=Ys(g),s[14]=g,s[15]=L):L=s[15];const z=L;let F;s[16]!==E?(F=E.filter(cn),s[16]=E,s[17]=F):F=s[17];const Q=F;let q;s[18]===Symbol.for("react.memo_cache_sentinel")?(q={id:"member",header:"Member",render:an,cellClassName:"flex-1 min-w-0",sortable:!0},s[18]=q):q=s[18];let H;s[19]!==z||s[20]!==Q||s[21]!==S||s[22]!==w?(H={id:"role",header:"Role",render:M=>M.type==="member"?t.jsx(He,{role:M.data.role,memberId:M.data.id,isOwner:M.data.role==="owner",roleColorMap:z,selectableRoles:Q,onRoleChange:($,W)=>w.mutate({memberId:$,role:W}),className:"w-36"}):t.jsx(He,{role:M.data.role,memberId:M.data.id,isOwner:!1,roleColorMap:z,selectableRoles:Q,onRoleChange:($,W)=>S.mutate({invitationId:$,role:W,email:M.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},s[19]=z,s[20]=Q,s[21]=S,s[22]=w,s[23]=H):H=s[23];let X;s[24]===Symbol.for("react.memo_cache_sentinel")?(X={id:"joined",header:"Joined",render:ln,cellClassName:"w-48 shrink-0",sortable:!0},s[24]=X):X=s[24];let re;s[25]!==r.cancel.isPending||s[26]!==E||s[27]!==w?(re={id:"actions",header:"",render:M=>M.type==="member"?t.jsx(yt,{member:M.data,roles:E,onChangeRole:($,W)=>w.mutate({memberId:$,role:W}),onRemove:l,isUpdating:w.isPending}):t.jsx(It,{invitationId:M.data.id,onCancel:j,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},s[25]=r.cancel.isPending,s[26]=E,s[27]=w,s[28]=re):re=s[28];let ne;s[29]!==H||s[30]!==re?(ne=[q,H,X,re],s[29]=H,s[30]=re,s[31]=ne):ne=s[31];const B=ne;let i;s[32]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Vs,{trigger:t.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[t.jsx(gt,{size:16}),"Manage Roles"]})}),s[32]=i):i=s[32];let O;s[33]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs("div",{className:"flex items-center gap-2",children:[i,t.jsx(Gs,{trigger:t.jsx(ee,{size:"sm",children:"Invite Member"})})]}),s[33]=O):O=s[33];const G=O,oe=[...A.map(on),...P.filter(rn).map(nn)],ie=fe,J=!!x;let Z;s[34]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>j(null),s[34]=Z):Z=s[34];let me;s[35]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsxs(Re,{children:[t.jsx(_e,{children:"Cancel Invitation"}),t.jsx(Le,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),s[35]=me):me=s[35];let U;s[36]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(Me,{children:"Keep Invitation"}),s[36]=U):U=s[36];let V;s[37]!==r.cancel||s[38]!==x?(V=()=>{x&&(r.cancel.mutate(x),j(null))},s[37]=r.cancel,s[38]=x,s[39]=V):V=s[39];let Y;s[40]!==r.cancel.isPending||s[41]!==V?(Y=t.jsxs(Ae,{children:[me,t.jsxs(Pe,{children:[U,t.jsx(De,{onClick:V,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),s[40]=r.cancel.isPending,s[41]=V,s[42]=Y):Y=s[42];let ce;s[43]!==J||s[44]!==Y?(ce=t.jsx(we,{open:J,onOpenChange:Z,children:Y}),s[43]=J,s[44]=Y,s[45]=ce):ce=s[45];const Je=!!m;let ze;s[46]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>l(null),s[46]=ze):ze=s[46];let Ue;s[47]===Symbol.for("react.memo_cache_sentinel")?(Ue=t.jsxs(Re,{children:[t.jsx(_e,{children:"Remove Member"}),t.jsx(Le,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),s[47]=Ue):Ue=s[47];let Be;s[48]===Symbol.for("react.memo_cache_sentinel")?(Be=t.jsx(Me,{children:"Cancel"}),s[48]=Be):Be=s[48];let ge;s[49]!==m||s[50]!==R?(ge=()=>m&&R.mutate(m),s[49]=m,s[50]=R,s[51]=ge):ge=s[51];let xe;s[52]!==R.isPending||s[53]!==ge?(xe=t.jsxs(Ae,{children:[Ue,t.jsxs(Pe,{children:[Be,t.jsx(De,{onClick:ge,disabled:R.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),s[52]=R.isPending,s[53]=ge,s[54]=xe):xe=s[54];let pe;s[55]!==Je||s[56]!==xe?(pe=t.jsx(we,{open:Je,onOpenChange:ze,children:xe}),s[55]=Je,s[56]=xe,s[57]=pe):pe=s[57];let Ve;s[58]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsx(fe.Header.Left,{children:t.jsx(Zt,{children:t.jsx(Yt,{children:t.jsx(Xt,{children:t.jsx(Jt,{children:"Members"})})})})}),s[58]=Ve):Ve=s[58];let $e;s[59]===Symbol.for("react.memo_cache_sentinel")?($e=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],s[59]=$e):$e=s[59];let be;s[60]!==I||s[61]!==p||s[62]!==u||s[63]!==c?(be=t.jsxs(fe.Header,{children:[Ve,t.jsxs(fe.Header.Right,{children:[t.jsx(qt,{viewMode:c,onViewModeChange:N,sortKey:u,sortDirection:p,onSort:I,sortOptions:$e}),G]})]}),s[60]=I,s[61]=p,s[62]=u,s[63]=c,s[64]=be):be=s[64];let Fe;s[65]===Symbol.for("react.memo_cache_sentinel")?(Fe=M=>{M.key==="Escape"&&(v(""),M.target.blur())},s[65]=Fe):Fe=s[65];let Ce;s[66]!==h?(Ce=t.jsx(ke,{value:h,onChange:v,placeholder:"Search members...",onKeyDown:Fe}),s[66]=h,s[67]=Ce):Ce=s[67];const We=fe,et=c==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:oe.length===0?t.jsx(st,{title:"No members found",description:h?`No members match "${h}"`:"Invite members to get started."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:oe.map(M=>{if(M.type==="invitation")return t.jsxs(Et,{className:"transition-colors relative opacity-75",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(It,{invitationId:M.data.id,onCancel:j,isCancelling:r.cancel.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ve,{fallback:Ye(M.data.email),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:M.data.email}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(Oe,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),t.jsx(He,{role:M.data.role,memberId:M.data.id,isOwner:!1,roleColorMap:z,selectableRoles:Q,onRoleChange:(W,de)=>S.mutate({invitationId:W,role:de,email:M.data.email}),className:"w-fit"})]})]})]},`inv-${M.data.id}`);const $=M.data;return t.jsxs(Et,{className:"transition-colors relative",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(yt,{member:$,roles:E,onChangeRole:(W,de)=>w.mutate({memberId:W,role:de}),onRemove:l,isUpdating:w.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ve,{url:$.user?.image??void 0,fallback:Ye($.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:$.user?.name||"Unknown"}),t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),t.jsx(He,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:z,selectableRoles:Q,onRoleChange:(W,de)=>w.mutate({memberId:W,role:de}),className:"w-fit"})]})]})]},$.id)})})}):t.jsx(Ht,{columns:B,data:oe,isLoading:!1,sortKey:u,sortDirection:p,onSort:I,emptyState:h?t.jsx(st,{title:"No members found",description:`No members match "${h}"`}):t.jsx(st,{title:"No members found",description:"Invite members to get started."})});let je;s[68]!==We.Content||s[69]!==et?(je=t.jsx(We.Content,{children:et}),s[68]=We.Content,s[69]=et,s[70]=je):je=s[70];let Ge;return s[71]!==ie||s[72]!==ce||s[73]!==pe||s[74]!==be||s[75]!==Ce||s[76]!==je?(Ge=t.jsxs(ie,{children:[ce,pe,be,Ce,je]}),s[71]=ie,s[72]=ce,s[73]=pe,s[74]=be,s[75]=Ce,s[76]=je,s[77]=Ge):Ge=s[77],Ge}function nn(s){return{type:"invitation",data:s}}function rn(s){return s.status==="pending"}function on(s){return{type:"member",data:s}}function ln(s){return s.type==="member"?t.jsx("span",{className:"text-sm text-foreground",children:s.data.createdAt?Xs(s.data.createdAt):"N/A"}):t.jsx(Oe,{variant:"outline",children:"Pending"})}function an(s){return s.type==="member"?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ve,{url:s.data.user?.image??void 0,fallback:Ye(s.data.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.user?.name||"Unknown"}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:s.data.user?.email})]})]}):t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ve,{fallback:Ye(s.data.email),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.email}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function cn(s){return s.role!=="owner"}function dn(s){te.error(s instanceof Error?s.message:"Failed to update invitation role")}async function mn(s){const{invitationId:e,role:n,email:r}=s,a=await se.organization.cancelInvitation({invitationId:e});if(a?.error)throw new Error(a.error.message);const o=await se.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function un(s){te.error(s instanceof Error?s.message:"Failed to update role")}async function fn(s){const{memberId:e,role:n}=s,r=await se.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function hn(s){te.error(s instanceof Error?s.message:"Failed to remove member")}async function gn(s){const e=await se.organization.removeMember({memberIdOrEmail:s});if(e?.error)throw new Error(e.error.message)}function xn(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function lr(){const s=ae.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(fe,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),s[0]=e):e=s[0];let n;return s[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(cs,{fallback:e,children:t.jsx(D.Suspense,{fallback:t.jsx(fe,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Mt,{size:32,className:"animate-spin text-muted-foreground"})})}),children:t.jsx(sn,{})})}),s[1]=n):n=s[1],n}export{lr as default};
@@ -1,4 +1,4 @@
1
- import{r as a,bt as N,j as _,c as Me,bm as te}from"./index-DVqIQLTS.js";import{S as me}from"./spinner-CaiollDD.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,bs as N,j as _,c as Me,bm as te}from"./index-yjsBu7QA.js";import{S as me}from"./spinner-Duo6KesX.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 ee,l as ja,u as nn,j as v,v as yr,bY as ni,bp as tt,aP as ke,bt as de,bZ as RC,a2 as LC,aX as $C,b_ as qC,b$ as FC,al as kn,aZ as y1,ak as Cr,aq as b1,av as Ko,an as Sr,b3 as zr,b1 as BC,am as Yd,a$ as zC,b0 as x1,a_ as WC,y as UC,f as KC,K as HC}from"./index-DVqIQLTS.js";import{C as YC}from"./collection-search-DozvRnxE.js";import{P as Lt}from"./index-BxQtX61C.js";import{B as GC,a as VC,b as XC,c as ZC}from"./breadcrumb-DBCyZqWb.js";import{c as Oi,T as Ci,a as ji,I as oa,n as Vf,E as w1}from"./empty-state-Cuxzpiqy.js";import{E as Ai}from"./error-boundary-UVoBd-EX.js";import{B as sa}from"./badge-a9rJdKKG.js";import{B as Ne,c as J,b as Kv}from"./button-BB_m2E67.js";import{t as $i}from"./ChevronDown-J2iKAqyZ.js";import{i as _1}from"./ChevronRight-Cua3_Oqd.js";import{b as Aa,P as Na,a as Ma}from"./popover-C9gpO_P1.js";import{i as Ws}from"./Check-kOHUYBJY.js";import{a as ai}from"./Copy01-U5Mrbyn4.js";import{n as Hv}from"./Download01-jn6ziu2W.js";import{i as S1}from"./FilterLines-CeL96HHO.js";import{i as QC}from"./Key01-BFw74njR.js";import{i as JC}from"./Play-DiP4pY8r.js";import{M as Yv,s as ej}from"./monaco-editor-Dv5Uv_CH.js";import{c as Tt,b as Xf,d as tj,e as rj,a as nj,T as Zt}from"./table-By59ASmK.js";import{r as aj,_ as In}from"./index-CERcQBYB.js";import{u as ij}from"./use-members-CVCClaOw.js";import{i as oj,u as sj}from"./Code01-DORFegNP.js";import{b as Gd}from"./use-connection-nBbiimhv.js";import{a as P1,u as O1}from"./constants-nQTTOIWL.js";import{b as C1}from"./use-virtual-mcp-BzFn2znu.js";import{c as lj}from"./Grid01-CkZU0tWV.js";import{s as uj}from"./Plus-B5QrRvCn.js";import{s as cj}from"./Trash01-BdLDRPDl.js";import{I as ia}from"./input-D53urYud.js";import{C as Gv}from"./checkbox-BYeejX3s.js";import{i as fj}from"./SearchMd-D2POsGFy.js";import{e as dj,S as Vv,a as Xv,b as Zv,c as Qv,d as ii}from"./select-DsmrYLOe.js";import{n as hj}from"./Calendar-MP2K9xOR.js";import{T as vj}from"./textarea-BB8VII1W.js";import{R as mj}from"./resource-tabs-Ddi84XBD.js";import{c as pj}from"./use-collections-CidxL5e8.js";import{t as gj}from"./Users03-DPYHJvoT.js";import"./Loading01-CCSRv8tX.js";import"./spinner-CaiollDD.js";import"./infiniteQueryObserver-qdoAkrLg.js";import"./useMutation-DYyKBkRY.js";import"./useQuery-CC03be4X.js";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:"m15 18-6-6 6-6"}));j1.displayName="ChevronLeft";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:"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"}));A1.displayName="PauseCircle";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:"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"}));N1.displayName="PlayCircle";const M1=({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"}));M1.displayName="Type01";const Zf={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 yj(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 oi(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}?`}}).join(`
1
+ import{r as g,c as ee,l as ja,u as nn,j as v,v as yr,bX as ni,bp as tt,aP as ke,bs as de,bY as RC,a2 as LC,aX as $C,bZ as qC,b_ as FC,al as kn,aZ as y1,ak as Cr,aq as b1,av as Ko,an as Sr,b3 as zr,b1 as BC,am as Yd,a$ as zC,b0 as x1,a_ as WC,y as UC,f as KC,K as HC}from"./index-yjsBu7QA.js";import{C as YC}from"./collection-search-D5gi0-bL.js";import{P as Lt}from"./index-P_cUV9l9.js";import{B as GC,a as VC,b as XC,c as ZC}from"./breadcrumb-BuFIEIOz.js";import{c as Oi,T as Ci,a as ji,I as oa,n as Vf,E as w1}from"./empty-state-CpRLw49r.js";import{E as Ai}from"./error-boundary-DQ5uRgdY.js";import{B as sa}from"./badge-D19NcG12.js";import{B as Ne,c as J,b as Kv}from"./button-BNRw8VbO.js";import{t as $i}from"./ChevronDown-En_P43wp.js";import{i as _1}from"./ChevronRight-BB2YL4K4.js";import{b as Aa,P as Na,a as Ma}from"./popover-u_i609j_.js";import{i as Ws}from"./Check-lN7sUZo8.js";import{a as ai}from"./Copy01-daHVbD8K.js";import{n as Hv}from"./Download01-oP6u6TmF.js";import{i as S1}from"./FilterLines-BCtAjuvO.js";import{i as QC}from"./Key01-DFKkR5uc.js";import{i as JC}from"./Play-B3d026b0.js";import{M as Yv,s as ej}from"./monaco-editor-p_EFt-aT.js";import{c as Tt,b as Xf,d as tj,e as rj,a as nj,T as Zt}from"./table-NP0FOAI5.js";import{r as aj,_ as In}from"./index-DJLvIq1X.js";import{u as ij}from"./use-members-C8R91dOK.js";import{i as oj,u as sj}from"./Code01-Dgx2dgXr.js";import{b as Gd}from"./use-connection-Dj100t8H.js";import{a as P1,u as O1}from"./constants-Cpe-c81c.js";import{b as C1}from"./use-virtual-mcp-XGRCLjSr.js";import{c as lj}from"./Grid01-DHptyetH.js";import{s as uj}from"./Plus-BcqTpnxy.js";import{s as cj}from"./Trash01-CR6s5yrj.js";import{I as ia}from"./input-C-GM7dsu.js";import{C as Gv}from"./checkbox-D0Zw7dGS.js";import{i as fj}from"./SearchMd-DVuLBPJW.js";import{e as dj,S as Vv,a as Xv,b as Zv,c as Qv,d as ii}from"./select-B4SPtD5h.js";import{n as hj}from"./Calendar-Cn4v8JwE.js";import{T as vj}from"./textarea-ByvgxbRE.js";import{R as mj}from"./resource-tabs-CE-63rPp.js";import{c as pj}from"./use-collections-Hp9XPnUY.js";import{t as gj}from"./Users03-CCWN1VQn.js";import"./Loading01-D8raUT2q.js";import"./spinner-Duo6KesX.js";import"./infiniteQueryObserver-D_8FFQdU.js";import"./useMutation-VOj1VEf8.js";import"./useQuery-C5RIveiE.js";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:"m15 18-6-6 6-6"}));j1.displayName="ChevronLeft";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:"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"}));A1.displayName="PauseCircle";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:"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"}));N1.displayName="PlayCircle";const M1=({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"}));M1.displayName="Type01";const Zf={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 yj(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 oi(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}?`}}).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("~")}}return{key:t,operator:"exists",value:""}}):[]}function bj(e){const t={},r={},n=[];for(const a of e)if(a.key.trim())switch(a.operator){case"eq":a.value&&(t[a.key]=a.value);break;case"contains":a.value&&(r[a.key]=`%${a.value}%`);break;case"exists":n.push(a.key);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}}function em(e){if(!e)return{content:"null",isTruncated:!1,originalSize:4};const t=JSON.stringify(e,null,2),r=t.length;return r<=Zf.maxJsonRenderSize?{content:t,isTruncated:!1,originalSize:r}:{content:t.slice(0,Zf.maxJsonRenderSize)+`
4
4
 
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-DVqIQLTS.js";import{i as n}from"./Loading01-CCSRv8tX.js";import{h as l}from"./mcp-oauth-ALBEJIVW.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-yjsBu7QA.js";import{i as n}from"./Loading01-D8raUT2q.js";import{h as l}from"./mcp-oauth-l77m3IWF.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 H,r as D,u as X,x as ue,K as le,bs as fe,j as s,l as oe,g as xe,b6 as ge,aN as pe}from"./index-DVqIQLTS.js";import{P as Q}from"./index-BxQtX61C.js";import{B as he,a as je,b as ve,c as ye}from"./breadcrumb-DBCyZqWb.js";import{i as ie}from"./FilterLines-CeL96HHO.js";import{n as be}from"./Inbox01-8S74uH1Z.js";import{i as Z}from"./Loading01-CCSRv8tX.js";import{i as ae}from"./SearchMd-D2POsGFy.js";import{u as Ne}from"./useInfiniteQuery-Cg3dUfja.js";import{a as Ce,f as Se,b as we}from"./registry-utils-COHLTguy.js";import{u as Te,h as Ie,b as Re}from"./constants-nQTTOIWL.js";import{u as Pe,a as ce,b as $e}from"./use-connection-nBbiimhv.js";import{s as ke}from"./slugify-CEUa2lfQ.js";import{C as Le}from"./collection-search-DozvRnxE.js";import{M as re}from"./mcp-server-card-BSDiwyMq.js";import{c as me,B as U}from"./button-BB_m2E67.js";import{I as ze}from"./input-D53urYud.js";import{b as Fe,P as Ke,a as Ae}from"./popover-C9gpO_P1.js";import{i as Ee}from"./Check-kOHUYBJY.js";import{t as Be}from"./ChevronDown-J2iKAqyZ.js";import{s as J}from"./XClose-CqNB1Ju1.js";import{d as De,a as Me,b as Ve,c as Oe,S as We}from"./select-DsmrYLOe.js";import{s as _e}from"./Plus-B5QrRvCn.js";import{E as qe}from"./empty-state-Cuxzpiqy.js";import{u as He}from"./use-binding-BKAkfTQP.js";import{L as Ge,u as Qe}from"./localstorage-keys-Dt0DQ7_M.js";import"./ChevronRight-Cua3_Oqd.js";import"./infiniteQueryObserver-qdoAkrLg.js";import"./use-collections-CidxL5e8.js";import"./useMutation-DYyKBkRY.js";import"./useQuery-CC03be4X.js";import"./Lock01-B367KJK-.js";import"./Terminal-CsAynI3M.js";import"./card-DQu0Qiy4.js";import"./github-icon-Dp3wHhYE.js";import"./binder-BHtkW0UD.js";function Ue(t,e){const l=H.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=H.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 f;return e[10]!==p||e[11]!==a||e[12]!==b?(f={scrollRef:b,saveScrollPosition:a,handleScroll:p},e[10]=p,e[11]=a,e[12]=b,e[13]=f):f=e[13],f}const Je=24;function Ze(t){const e=H.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),f=l||null;let d;e[2]!==a.id||e[3]!==f?(d={connectionId:f,orgId:a.id},e[2]=a.id,e[3]=f,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:$}=ue(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:fe},e[26]=T,e[27]=S,e[28]=z):z=e[28];const{data:A,fetchNextPage:k,hasNextPage:u,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,_=g&&!x&&!R&&O;let q;e[35]!==k||e[36]!==u||e[37]!==x?(q=()=>{u&&!x&&k()},e[35]=k,e[36]=u,e[37]=x,e[38]=q):q=e[38];const M=q,W=u??!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]!==_||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:_,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]=_,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=H.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,f,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);f=c.length,b=Fe,L=y,$=p;let u;e[17]!==l?(u=s.jsx("span",{children:l}),e[17]=l,e[18]=u):u=e[18];let x;e[19]!==f?(x=f>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:f}),e[19]=f,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]!==u?(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:[u,x,g]})}),e[22]=x,e[23]=u,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]=f,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],f=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]!==f?(w=f>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]=f,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=H.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=u=>{c.includes(u)?a(c.filter(x=>x!==u)):a([...c,u])},e[0]=a,e[1]=c,e[2]=p):p=e[2];const o=p;let b;e[3]!==i||e[4]!==r?(b=u=>{r.includes(u)?i(r.filter(x=>x!==u)):i([...r,u])},e[3]=i,e[4]=r,e[5]=b):b=e[5];const f=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]!==f||e[16]!==o){const u=n?et(n,6):[];I=r,N=c,S=new Set(u.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]!==f?(g=n&&n.length>0&&s.jsx(ne,{label:"Categories",items:n,selectedItems:r,onToggle:f,onClear:()=>i([])}),e[25]=n,e[26]=i,e[27]=r,e[28]=f,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]!==f?(P=K=>{const h=r.includes(K.value);return s.jsxs("div",{onClick:()=>f(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(),f(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]=f,e[40]=P):P=e[40],L=u.map(P),e[9]=n,e[10]=l,e[11]=i,e[12]=a,e[13]=r,e[14]=c,e[15]=f,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]!==f||e[43]!==S){let u;e[45]!==S?(u=g=>!S.has(g),e[45]=S,e[46]=u):u=e[46];let x;e[47]!==f?(x=g=>s.jsxs("div",{onClick:()=>f(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(),f(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]=f,e[48]=x):x=e[48],w=I.filter(u).map(x),e[41]=I,e[42]=f,e[43]=S,e[44]=w}else w=e[44];let T;if(e[49]!==N||e[50]!==o){let u;e[52]!==o?(u=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]=u):u=e[53],T=N.map(u),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=H.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 f;e[0]!==i||e[1]!==c||e[2]!==n||e[3]!==l?(f={registryId:l,listToolName:n,filtersToolName:c,search:i},e[0]=i,e[1]=c,e[2]=n,e[3]=l,e[4]=f):f=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(f);let k,u,x,g;e[5]!==i||e[6]!==C||e[7]!==N||e[8]!==d||e[9]!==r?(k=r?rt(d,r):d,u=(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]=u,e[12]=x,e[13]=g):(k=e[10],u=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]!==u||e[25]!==r?(E=s.jsx(Le,{value:r,onChange:a,placeholder:"Search for an MCP Server...",isSearching:u}),e[24]=u,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]!==u||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&&!u?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:[u&&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]=u,e[42]=d,e[43]=r,e[44]=g,e[45]=O):O=e[45];let _;e[46]!==F||e[47]!==p||e[48]!==O?(_=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]=_):_=e[49];let q;return e[50]!==E||e[51]!==V||e[52]!==_?(q=s.jsxs("div",{className:"flex flex-col h-full",children:[E,V,_]}),e[50]=E,e[51]=V,e[52]=_,e[53]=q):q=e[53],q}function it(t){const e=H.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=H.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(_e,{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 f;return e[10]!==c||e[11]!==y||e[12]!==b||e[13]!==n?(f=s.jsxs(We,{value:n,onValueChange:c,children:[y,b]}),e[10]=c,e[11]=y,e[12]=b,e[13]=n,e[14]=f):f=e[14],f}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(qe,{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=H.c(42),{org:e}=X(),l=$e(),n=ce(),c=ge(),r=c.location.pathname.includes("/store/")&&c.location.pathname.split("/").length>3,a=He(l);let i;t[0]!==a?(i=a.map(ft),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,ut);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 u;t[25]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=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:[u,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 ut(t){return t??""}function ft(t){return{id:t.id,name:t.title,icon:t.icon||void 0}}export{Ut as default};
1
+ import{c as H,r as D,u as X,x as ue,K as le,br as fe,j as s,l as oe,g as xe,b6 as ge,aN as pe}from"./index-yjsBu7QA.js";import{P as Q}from"./index-P_cUV9l9.js";import{B as he,a as je,b as ve,c as ye}from"./breadcrumb-BuFIEIOz.js";import{i as ie}from"./FilterLines-BCtAjuvO.js";import{n as be}from"./Inbox01-BTvTBHN2.js";import{i as Z}from"./Loading01-D8raUT2q.js";import{i as ae}from"./SearchMd-DVuLBPJW.js";import{u as Ne}from"./useInfiniteQuery-C34Ot4VI.js";import{a as Ce,f as Se,b as we}from"./registry-utils-BNFgymSf.js";import{u as Te,h as Ie,b as Re}from"./constants-Cpe-c81c.js";import{u as Pe,a as ce,b as $e}from"./use-connection-Dj100t8H.js";import{s as ke}from"./slugify-CEUa2lfQ.js";import{C as Le}from"./collection-search-D5gi0-bL.js";import{M as re}from"./mcp-server-card-D5sj_LDb.js";import{c as me,B as U}from"./button-BNRw8VbO.js";import{I as ze}from"./input-C-GM7dsu.js";import{b as Fe,P as Ke,a as Ae}from"./popover-u_i609j_.js";import{i as Ee}from"./Check-lN7sUZo8.js";import{t as Be}from"./ChevronDown-En_P43wp.js";import{s as J}from"./XClose-D9VL7Fhs.js";import{d as De,a as Me,b as Ve,c as Oe,S as We}from"./select-B4SPtD5h.js";import{s as _e}from"./Plus-BcqTpnxy.js";import{E as qe}from"./empty-state-CpRLw49r.js";import{u as He}from"./use-binding-CNR8kDE7.js";import{L as Ge,u as Qe}from"./localstorage-keys-C_mtBNzA.js";import"./ChevronRight-BB2YL4K4.js";import"./infiniteQueryObserver-D_8FFQdU.js";import"./use-collections-Hp9XPnUY.js";import"./useMutation-VOj1VEf8.js";import"./useQuery-C5RIveiE.js";import"./Lock01-0pDC11sR.js";import"./Terminal-BOgtpg9n.js";import"./card-B2_21gZH.js";import"./github-icon-Dp3wHhYE.js";import"./binder-CwgOa4SG.js";function Ue(t,e){const l=H.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=H.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 f;return e[10]!==p||e[11]!==a||e[12]!==b?(f={scrollRef:b,saveScrollPosition:a,handleScroll:p},e[10]=p,e[11]=a,e[12]=b,e[13]=f):f=e[13],f}const Je=24;function Ze(t){const e=H.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),f=l||null;let d;e[2]!==a.id||e[3]!==f?(d={connectionId:f,orgId:a.id},e[2]=a.id,e[3]=f,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:$}=ue(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:fe},e[26]=T,e[27]=S,e[28]=z):z=e[28];const{data:A,fetchNextPage:k,hasNextPage:u,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,_=g&&!x&&!R&&O;let q;e[35]!==k||e[36]!==u||e[37]!==x?(q=()=>{u&&!x&&k()},e[35]=k,e[36]=u,e[37]=x,e[38]=q):q=e[38];const M=q,W=u??!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]!==_||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:_,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]=_,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=H.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,f,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);f=c.length,b=Fe,L=y,$=p;let u;e[17]!==l?(u=s.jsx("span",{children:l}),e[17]=l,e[18]=u):u=e[18];let x;e[19]!==f?(x=f>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:f}),e[19]=f,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]!==u?(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:[u,x,g]})}),e[22]=x,e[23]=u,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]=f,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],f=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]!==f?(w=f>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]=f,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=H.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=u=>{c.includes(u)?a(c.filter(x=>x!==u)):a([...c,u])},e[0]=a,e[1]=c,e[2]=p):p=e[2];const o=p;let b;e[3]!==i||e[4]!==r?(b=u=>{r.includes(u)?i(r.filter(x=>x!==u)):i([...r,u])},e[3]=i,e[4]=r,e[5]=b):b=e[5];const f=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]!==f||e[16]!==o){const u=n?et(n,6):[];I=r,N=c,S=new Set(u.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]!==f?(g=n&&n.length>0&&s.jsx(ne,{label:"Categories",items:n,selectedItems:r,onToggle:f,onClear:()=>i([])}),e[25]=n,e[26]=i,e[27]=r,e[28]=f,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]!==f?(P=K=>{const h=r.includes(K.value);return s.jsxs("div",{onClick:()=>f(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(),f(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]=f,e[40]=P):P=e[40],L=u.map(P),e[9]=n,e[10]=l,e[11]=i,e[12]=a,e[13]=r,e[14]=c,e[15]=f,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]!==f||e[43]!==S){let u;e[45]!==S?(u=g=>!S.has(g),e[45]=S,e[46]=u):u=e[46];let x;e[47]!==f?(x=g=>s.jsxs("div",{onClick:()=>f(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(),f(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]=f,e[48]=x):x=e[48],w=I.filter(u).map(x),e[41]=I,e[42]=f,e[43]=S,e[44]=w}else w=e[44];let T;if(e[49]!==N||e[50]!==o){let u;e[52]!==o?(u=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]=u):u=e[53],T=N.map(u),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=H.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 f;e[0]!==i||e[1]!==c||e[2]!==n||e[3]!==l?(f={registryId:l,listToolName:n,filtersToolName:c,search:i},e[0]=i,e[1]=c,e[2]=n,e[3]=l,e[4]=f):f=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(f);let k,u,x,g;e[5]!==i||e[6]!==C||e[7]!==N||e[8]!==d||e[9]!==r?(k=r?rt(d,r):d,u=(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]=u,e[12]=x,e[13]=g):(k=e[10],u=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]!==u||e[25]!==r?(E=s.jsx(Le,{value:r,onChange:a,placeholder:"Search for an MCP Server...",isSearching:u}),e[24]=u,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]!==u||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&&!u?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:[u&&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]=u,e[42]=d,e[43]=r,e[44]=g,e[45]=O):O=e[45];let _;e[46]!==F||e[47]!==p||e[48]!==O?(_=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]=_):_=e[49];let q;return e[50]!==E||e[51]!==V||e[52]!==_?(q=s.jsxs("div",{className:"flex flex-col h-full",children:[E,V,_]}),e[50]=E,e[51]=V,e[52]=_,e[53]=q):q=e[53],q}function it(t){const e=H.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=H.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(_e,{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 f;return e[10]!==c||e[11]!==y||e[12]!==b||e[13]!==n?(f=s.jsxs(We,{value:n,onValueChange:c,children:[y,b]}),e[10]=c,e[11]=y,e[12]=b,e[13]=n,e[14]=f):f=e[14],f}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(qe,{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=H.c(42),{org:e}=X(),l=$e(),n=ce(),c=ge(),r=c.location.pathname.includes("/store/")&&c.location.pathname.split("/").length>3,a=He(l);let i;t[0]!==a?(i=a.map(ft),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,ut);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 u;t[25]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=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:[u,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 ut(t){return t??""}function ft(t){return{id:t.id,name:t.title,icon:t.icon||void 0}}export{Ut as default};
@@ -1 +1 @@
1
- import{c as b,j as s,r as $,u as ie,g as re,v as Z}from"./index-DVqIQLTS.js";import{V as ne,C as g}from"./index-Cw0Cq7G5.js";import{T as oe,i as ae,a as ce,t as me}from"./typewriter-title-BTENJbqy.js";import{E as de}from"./error-boundary-UVoBd-EX.js";import{u as Y,S as X}from"./collapsible-Ce6mH95q.js";import{I as ee,T as G,a as K,c as J}from"./empty-state-Cuxzpiqy.js";import{P as fe,a as ue,b as he}from"./popover-C9gpO_P1.js";import{c as te,B as V}from"./button-BB_m2E67.js";import{i as xe,d as pe}from"./constants-nQTTOIWL.js";import{b as ge}from"./use-virtual-mcp-BzFn2znu.js";import{i as je}from"./ChevronRight-Cua3_Oqd.js";import{t as se}from"./Users03-DPYHJvoT.js";import{P as A}from"./index-BxQtX61C.js";import{c as be}from"./Pin01-dHyXwRhr.js";import{s as Ne}from"./Plus-B5QrRvCn.js";import{i as ye}from"./Share07-CQptN91g.js";import"./X-CVoqpcAx.js";import"./spinner-CaiollDD.js";import"./use-mcp-prompts-0zuoUwAA.js";import"./useQuery-CC03be4X.js";import"./dialog-BPGYkE6E.js";import"./form-CFGJ-U5C.js";import"./input-D53urYud.js";import"./AlertCircle-ByS2S7QG.js";import"./ArrowUp-Pc2qwI_3.js";import"./ChevronDown-J2iKAqyZ.js";import"./Edit01-C_cfLeJc.js";import"./Check-kOHUYBJY.js";import"./Copy01-U5Mrbyn4.js";import"./Terminal-CsAynI3M.js";import"./monaco-editor-Dv5Uv_CH.js";import"./localstorage-keys-Dt0DQ7_M.js";import"./useMutation-DYyKBkRY.js";import"./use-connection-nBbiimhv.js";import"./use-collections-CidxL5e8.js";import"./generate-id-Dyweu44Y.js";import"./SearchMd-D2POsGFy.js";import"./Trash01-BdLDRPDl.js";import"./badge-a9rJdKKG.js";import"./Code01-DORFegNP.js";import"./infiniteQueryObserver-qdoAkrLg.js";import"./use-create-virtual-mcp-CPQ3EWAe.js";import"./use-binding-BKAkfTQP.js";import"./binder-BHtkW0UD.js";import"./select-DsmrYLOe.js";import"./File06-DE5HPnG3.js";import"./Grid01-CkZU0tWV.js";import"./Image01-CIkj8y0a.js";function _e(e){const t=b.c(15),{agent:l}=e,{setVirtualMcpId:h}=Y();let i;t[0]!==l.id||t[1]!==h?(i=()=>{h(l.id)},t[0]=l.id,t[1]=h,t[2]=i):i=t[2];const r=i;let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=te("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[3]=a):a=t[3];const c=`Select agent ${l.title}`;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(se,{size:20}),t[4]=d):d=t[4];let n;t[5]!==l.icon||t[6]!==l.title?(n=s.jsx(ee,{icon:l.icon,name:l.title,fallbackIcon:d}),t[5]=l.icon,t[6]=l.title,t[7]=n):n=t[7];let o;t[8]!==l.title?(o=s.jsx("p",{className:"text-sm text-foreground text-center leading-tight line-clamp-2",children:l.title}),t[8]=l.title,t[9]=o):o=t[9];let m;return t[10]!==r||t[11]!==c||t[12]!==n||t[13]!==o?(m=s.jsxs("button",{type:"button",onClick:r,className:a,"aria-label":c,children:[n,o]}),t[10]=r,t[11]=c,t[12]=n,t[13]=o,t[14]=m):m=t[14],m}function Se(e){const t=b.c(14),{virtualMcps:l,selectedVirtualMcpId:h,onVirtualMcpChange:i}=e,[r,a]=$.useState(!1),c=$.useRef(null);let d,n;t[0]!==r?(d=()=>{r&&setTimeout(()=>{c.current?.focus()},0)},n=[r],t[0]=r,t[1]=d,t[2]=n):(d=t[1],n=t[2]),$.useEffect(d,n);let o;t[3]!==i?(o=Q=>{i(Q),a(!1)},t[3]=i,t[4]=o):o=t[4];const m=o;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=te("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[5]=f):f=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(fe,{asChild:!0,children:s.jsxs("button",{type:"button",className:f,"aria-label":"See all agents",children:[s.jsx("div",{className:"size-12 rounded-lg bg-accent flex items-center justify-center shrink-0",children:s.jsx(je,{size:24,className:"text-foreground"})}),s.jsx("p",{className:"text-sm text-foreground text-center leading-tight",children:"See all"})]})}),t[6]=u):u=t[6];let x;t[7]!==m||t[8]!==h||t[9]!==l?(x=s.jsx(ue,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:s.jsx(ne,{virtualMcps:l,selectedVirtualMcpId:h,onVirtualMcpChange:m,searchInputRef:c})}),t[7]=m,t[8]=h,t[9]=l,t[10]=x):x=t[10];let j;return t[11]!==r||t[12]!==x?(j=s.jsxs(he,{open:r,onOpenChange:a,children:[u,x]}),t[11]=r,t[12]=x,t[13]=j):j=t[13],j}function ve(){const e=b.c(20),t=ge(),{selectedVirtualMcp:l,setVirtualMcpId:h}=Y();let i,r,a,c,d,n;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const x=t.filter(ke).slice(0,6);if(x.length===0){d=null;break e}n=t.map(we),a="w-full max-w-[800px]",e[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-4",children:"Recently used agents"}),e[7]=c):c=e[7],i="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",r=x.map(Ce)}e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=c,e[5]=d,e[6]=n}else i=e[1],r=e[2],a=e[3],c=e[4],d=e[5],n=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;const o=l?.id??null;let m;e[8]!==h||e[9]!==o||e[10]!==n?(m=s.jsx(Se,{virtualMcps:n,selectedVirtualMcpId:o,onVirtualMcpChange:h}),e[8]=h,e[9]=o,e[10]=n,e[11]=m):m=e[11];let f;e[12]!==i||e[13]!==r||e[14]!==m?(f=s.jsxs("div",{className:i,children:[r,m]}),e[12]=i,e[13]=r,e[14]=m,e[15]=f):f=e[15];let u;return e[16]!==a||e[17]!==c||e[18]!==f?(u=s.jsxs("div",{className:a,children:[c,f]}),e[16]=a,e[17]=c,e[18]=f,e[19]=u):u=e[19],u}function Ce(e){return s.jsx(_e,{agent:e},e.id??"default")}function we(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon}}function ke(e){return e.id!==null&&!xe(e.id)}function ze(){const e=b.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(X,{className:"h-5 w-40 mb-4"}),e[0]=t):t=e[0];let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"w-full max-w-[800px]",children:[t,s.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",children:Array.from({length:7}).map(Te)})]}),e[1]=l):l=e[1],l}function Te(e,t){return s.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 self-stretch",children:[s.jsx(X,{className:"size-6 rounded-md shrink-0"}),s.jsx(X,{className:"h-4 w-full"})]},t)}function Me(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx($.Suspense,{fallback:s.jsx(ze,{}),children:s.jsx(ve,{})}),e[0]=t):t=e[0],t}function Ie(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function Pe(){const e=b.c(60),{org:t}=ie(),{data:l}=re.useSession(),{modelsConnections:h,isChatEmpty:i,activeThreadId:r,setActiveThreadId:a,threads:c,selectedVirtualMcp:d}=Y();let n;if(e[0]!==r||e[1]!==c){let p;e[3]!==r?(p=le=>le.id===r,e[3]=r,e[4]=p):p=e[4],n=c.find(p),e[0]=r,e[1]=c,e[2]=n}else n=e[2];const o=n,[m,f]=$.useState(!1);let u;e[5]!==l?.user?.name?(u=l?.user?.name?.split(" ")[0]||"there",e[5]=l?.user?.name,e[6]=u):u=e[6];const x=u;let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=Ie(),e[7]=j):j=e[7];const Q=j;let E;e[8]!==t.id?(E=pe(t.id),e[8]=t.id,e[9]=E):E=e[9];const H=d??E;if(h.length===0){let p;return e[10]!==t?(p=s.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:s.jsx(g.NoLlmBindingEmptyState,{org:t})}),e[10]=t,e[11]=p):p=e[11],p}let N;e[12]!==o||e[13]!==i?(N=s.jsx(A.Header.Left,{className:"gap-2",children:!i&&o?.title?s.jsx(oe,{text:o.title,className:"text-sm font-medium text-foreground"}):s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),e[12]=o,e[13]=i,e[14]=N):N=e[14];let y;e[15]!==a?(y=()=>a(crypto.randomUUID()),e[15]=a,e[16]=y):y=e[16];let R;e[17]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ne,{size:16}),e[17]=R):R=e[17];let _;e[18]!==i||e[19]!==y?(_=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:y,disabled:i,"aria-label":"New chat",children:R})}),e[18]=i,e[19]=y,e[20]=_):_=e[20];let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(K,{children:"New chat"}),e[21]=O):O=e[21];let S;e[22]!==_?(S=s.jsxs(J,{children:[_,O]}),e[22]=_,e[23]=S):S=e[23];let B;e[24]===Symbol.for("react.memo_cache_sentinel")?(B=()=>f(!0),e[24]=B):B=e[24];let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsxs(J,{children:[s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:B,"aria-label":"Chat history",children:s.jsx(ae,{size:16})})}),s.jsx(K,{children:"Chat history"})]}),e[25]=L):L=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(be,{size:16}),e[26]=D):D=e[26];let v;e[27]!==i?(v=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Ae,disabled:i,"aria-label":"Pin chat",children:D})}),e[27]=i,e[28]=v):v=e[28];let F;e[29]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(K,{children:"Pin chat"}),e[29]=F):F=e[29];let C;e[30]!==v?(C=s.jsxs(J,{children:[v,F]}),e[30]=v,e[31]=C):C=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(ye,{size:16}),e[32]=U):U=e[32];let w;e[33]!==i?(w=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:$e,disabled:i,"aria-label":"Share chat",children:U})}),e[33]=i,e[34]=w):w=e[34];let W;e[35]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(K,{children:"Share chat"}),e[35]=W):W=e[35];let k;e[36]!==w?(k=s.jsxs(J,{children:[w,W]}),e[36]=w,e[37]=k):k=e[37];let z;e[38]!==C||e[39]!==k||e[40]!==S?(z=s.jsxs(A.Header.Right,{className:"gap-1",children:[S,L,C,k]}),e[38]=C,e[39]=k,e[40]=S,e[41]=z):z=e[41];let T;e[42]!==z||e[43]!==N?(T=s.jsxs(A.Header,{className:"flex-none",children:[N,z]}),e[42]=z,e[43]=N,e[44]=T):T=e[44];let M;e[45]!==H||e[46]!==i||e[47]!==x?(M=i?s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 pb-32 pt-10",children:[s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full max-w-[600px]",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(ee,{icon:H.icon,name:H.title,size:"md",fallbackIcon:s.jsx(se,{size:20}),className:"size-12 rounded-xl border border-stone-200/60 shadow-sm aspect-square transition-opacity duration-200"})}),s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg font-medium text-foreground",children:[Q," ",x,","]}),s.jsx("p",{className:"text-base text-muted-foreground opacity-50 mb-0",children:"What are we building today?"})]}),s.jsx("div",{className:"w-full -mt-1",children:s.jsx(g.Input,{})}),s.jsx(g.IceBreakers,{className:"w-full"})]}),s.jsx("div",{className:"flex flex-col items-center w-full mt-4",children:s.jsx(Me,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(g.Main,{children:s.jsx(g.Messages,{minHeightOffset:230})}),s.jsx(g.Footer,{children:s.jsx(g.Input,{})})]}),e[45]=H,e[46]=i,e[47]=x,e[48]=M):M=e[48];let I;e[49]!==a?(I=p=>{a(p),f(!1)},e[49]=a,e[50]=I):I=e[50];let P;e[51]!==r||e[52]!==m||e[53]!==I||e[54]!==c?(P=s.jsx(ce,{open:m,onOpenChange:f,threads:c,activeThreadId:r,onThreadSelect:I}),e[51]=r,e[52]=m,e[53]=I,e[54]=c,e[55]=P):P=e[55];let q;return e[56]!==T||e[57]!==M||e[58]!==P?(q=s.jsxs(g,{className:"bg-background",children:[T,M,P]}),e[56]=T,e[57]=M,e[58]=P,e[59]=q):q=e[59],q}function $e(){Z.info("Share feature coming soon")}function Ae(){Z.info("Pin feature coming soon")}function Ve(e){const t=b.c(14),{error:l,onRetry:h}=e,i=l?.message?.includes("401")||l?.message?.toLowerCase().includes("unauthorized");let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs(A.Header,{className:"flex-none",children:[s.jsx(A.Header.Left,{className:"gap-2",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),s.jsx(A.Header.Right,{className:"gap-1"})]}),t[0]=r):r=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:s.jsx(me,{className:"h-6 w-6 text-destructive"})}),t[1]=a):a=t[1];const c=i?"Unable to load models":"Something went wrong";let d;t[2]!==c?(d=s.jsx("h3",{className:"text-lg font-medium",children:c}),t[2]=c,t[3]=d):d=t[3];const n=i?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":l?.message||"An unexpected error occurred";let o;t[4]!==n?(o=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),t[4]=n,t[5]=o):o=t[5];let m;t[6]!==d||t[7]!==o?(m=s.jsxs("div",{className:"space-y-2",children:[d,o]}),t[6]=d,t[7]=o,t[8]=m):m=t[8];let f;t[9]!==h?(f=s.jsx(V,{variant:"outline",onClick:h,children:"Try again"}),t[9]=h,t[10]=f):f=t[10];let u;return t[11]!==m||t[12]!==f?(u=s.jsxs(g,{className:"bg-background",children:[r,s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:s.jsxs("div",{className:"max-w-sm space-y-4",children:[a,m,f]})})]}),t[11]=m,t[12]=f,t[13]=u):u=t[13],u}function Pt(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(de,{fallback:Ee,children:s.jsx($.Suspense,{fallback:s.jsx(g.Skeleton,{className:"bg-background"}),children:s.jsx(Pe,{})})}),e[0]=t):t=e[0],t}function Ee(e){const{error:t,resetError:l}=e;return s.jsx(Ve,{error:t,onRetry:l})}export{Pt as default};
1
+ import{c as b,j as s,r as $,u as ie,g as re,v as Z}from"./index-yjsBu7QA.js";import{V as ne,C as g}from"./index-Bos_CuhY.js";import{T as oe,i as ae,a as ce,t as me}from"./typewriter-title-CZvcEhZW.js";import{E as de}from"./error-boundary-DQ5uRgdY.js";import{u as Y,S as X}from"./collapsible-Dg-5RnYq.js";import{I as ee,T as G,a as K,c as J}from"./empty-state-CpRLw49r.js";import{P as fe,a as ue,b as he}from"./popover-u_i609j_.js";import{c as te,B as V}from"./button-BNRw8VbO.js";import{i as xe,d as pe}from"./constants-Cpe-c81c.js";import{b as ge}from"./use-virtual-mcp-XGRCLjSr.js";import{i as je}from"./ChevronRight-BB2YL4K4.js";import{t as se}from"./Users03-CCWN1VQn.js";import{P as A}from"./index-P_cUV9l9.js";import{c as be}from"./Pin01-C3nTzsY2.js";import{s as Ne}from"./Plus-BcqTpnxy.js";import{i as ye}from"./Share07-DW8M4mUv.js";import"./X-BsLffR19.js";import"./spinner-Duo6KesX.js";import"./use-mcp-prompts-SKr2e7l0.js";import"./useQuery-C5RIveiE.js";import"./dialog-Csoqe4hG.js";import"./form-DAoJifFq.js";import"./input-C-GM7dsu.js";import"./AlertCircle-B7sqll3Z.js";import"./ArrowUp-D8YYlj5b.js";import"./ChevronDown-En_P43wp.js";import"./Edit01-C_JM_ANM.js";import"./Check-lN7sUZo8.js";import"./Copy01-daHVbD8K.js";import"./Terminal-BOgtpg9n.js";import"./monaco-editor-p_EFt-aT.js";import"./localstorage-keys-C_mtBNzA.js";import"./useMutation-VOj1VEf8.js";import"./use-connection-Dj100t8H.js";import"./use-collections-Hp9XPnUY.js";import"./generate-id-Dyweu44Y.js";import"./SearchMd-DVuLBPJW.js";import"./Trash01-CR6s5yrj.js";import"./badge-D19NcG12.js";import"./Code01-Dgx2dgXr.js";import"./infiniteQueryObserver-D_8FFQdU.js";import"./use-create-virtual-mcp-B01dvSQa.js";import"./use-binding-CNR8kDE7.js";import"./binder-CwgOa4SG.js";import"./select-B4SPtD5h.js";import"./File06-2dtWfDa_.js";import"./Grid01-DHptyetH.js";import"./Image01-CILGPgam.js";function _e(e){const t=b.c(15),{agent:l}=e,{setVirtualMcpId:h}=Y();let i;t[0]!==l.id||t[1]!==h?(i=()=>{h(l.id)},t[0]=l.id,t[1]=h,t[2]=i):i=t[2];const r=i;let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=te("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[3]=a):a=t[3];const c=`Select agent ${l.title}`;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(se,{size:20}),t[4]=d):d=t[4];let n;t[5]!==l.icon||t[6]!==l.title?(n=s.jsx(ee,{icon:l.icon,name:l.title,fallbackIcon:d}),t[5]=l.icon,t[6]=l.title,t[7]=n):n=t[7];let o;t[8]!==l.title?(o=s.jsx("p",{className:"text-sm text-foreground text-center leading-tight line-clamp-2",children:l.title}),t[8]=l.title,t[9]=o):o=t[9];let m;return t[10]!==r||t[11]!==c||t[12]!==n||t[13]!==o?(m=s.jsxs("button",{type:"button",onClick:r,className:a,"aria-label":c,children:[n,o]}),t[10]=r,t[11]=c,t[12]=n,t[13]=o,t[14]=m):m=t[14],m}function Se(e){const t=b.c(14),{virtualMcps:l,selectedVirtualMcpId:h,onVirtualMcpChange:i}=e,[r,a]=$.useState(!1),c=$.useRef(null);let d,n;t[0]!==r?(d=()=>{r&&setTimeout(()=>{c.current?.focus()},0)},n=[r],t[0]=r,t[1]=d,t[2]=n):(d=t[1],n=t[2]),$.useEffect(d,n);let o;t[3]!==i?(o=Q=>{i(Q),a(!1)},t[3]=i,t[4]=o):o=t[4];const m=o;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=te("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[5]=f):f=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(fe,{asChild:!0,children:s.jsxs("button",{type:"button",className:f,"aria-label":"See all agents",children:[s.jsx("div",{className:"size-12 rounded-lg bg-accent flex items-center justify-center shrink-0",children:s.jsx(je,{size:24,className:"text-foreground"})}),s.jsx("p",{className:"text-sm text-foreground text-center leading-tight",children:"See all"})]})}),t[6]=u):u=t[6];let x;t[7]!==m||t[8]!==h||t[9]!==l?(x=s.jsx(ue,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:s.jsx(ne,{virtualMcps:l,selectedVirtualMcpId:h,onVirtualMcpChange:m,searchInputRef:c})}),t[7]=m,t[8]=h,t[9]=l,t[10]=x):x=t[10];let j;return t[11]!==r||t[12]!==x?(j=s.jsxs(he,{open:r,onOpenChange:a,children:[u,x]}),t[11]=r,t[12]=x,t[13]=j):j=t[13],j}function ve(){const e=b.c(20),t=ge(),{selectedVirtualMcp:l,setVirtualMcpId:h}=Y();let i,r,a,c,d,n;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const x=t.filter(ke).slice(0,6);if(x.length===0){d=null;break e}n=t.map(we),a="w-full max-w-[800px]",e[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-4",children:"Recently used agents"}),e[7]=c):c=e[7],i="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",r=x.map(Ce)}e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=c,e[5]=d,e[6]=n}else i=e[1],r=e[2],a=e[3],c=e[4],d=e[5],n=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;const o=l?.id??null;let m;e[8]!==h||e[9]!==o||e[10]!==n?(m=s.jsx(Se,{virtualMcps:n,selectedVirtualMcpId:o,onVirtualMcpChange:h}),e[8]=h,e[9]=o,e[10]=n,e[11]=m):m=e[11];let f;e[12]!==i||e[13]!==r||e[14]!==m?(f=s.jsxs("div",{className:i,children:[r,m]}),e[12]=i,e[13]=r,e[14]=m,e[15]=f):f=e[15];let u;return e[16]!==a||e[17]!==c||e[18]!==f?(u=s.jsxs("div",{className:a,children:[c,f]}),e[16]=a,e[17]=c,e[18]=f,e[19]=u):u=e[19],u}function Ce(e){return s.jsx(_e,{agent:e},e.id??"default")}function we(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon}}function ke(e){return e.id!==null&&!xe(e.id)}function ze(){const e=b.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(X,{className:"h-5 w-40 mb-4"}),e[0]=t):t=e[0];let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"w-full max-w-[800px]",children:[t,s.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",children:Array.from({length:7}).map(Te)})]}),e[1]=l):l=e[1],l}function Te(e,t){return s.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 self-stretch",children:[s.jsx(X,{className:"size-6 rounded-md shrink-0"}),s.jsx(X,{className:"h-4 w-full"})]},t)}function Me(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx($.Suspense,{fallback:s.jsx(ze,{}),children:s.jsx(ve,{})}),e[0]=t):t=e[0],t}function Ie(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function Pe(){const e=b.c(60),{org:t}=ie(),{data:l}=re.useSession(),{modelsConnections:h,isChatEmpty:i,activeThreadId:r,setActiveThreadId:a,threads:c,selectedVirtualMcp:d}=Y();let n;if(e[0]!==r||e[1]!==c){let p;e[3]!==r?(p=le=>le.id===r,e[3]=r,e[4]=p):p=e[4],n=c.find(p),e[0]=r,e[1]=c,e[2]=n}else n=e[2];const o=n,[m,f]=$.useState(!1);let u;e[5]!==l?.user?.name?(u=l?.user?.name?.split(" ")[0]||"there",e[5]=l?.user?.name,e[6]=u):u=e[6];const x=u;let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=Ie(),e[7]=j):j=e[7];const Q=j;let E;e[8]!==t.id?(E=pe(t.id),e[8]=t.id,e[9]=E):E=e[9];const H=d??E;if(h.length===0){let p;return e[10]!==t?(p=s.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:s.jsx(g.NoLlmBindingEmptyState,{org:t})}),e[10]=t,e[11]=p):p=e[11],p}let N;e[12]!==o||e[13]!==i?(N=s.jsx(A.Header.Left,{className:"gap-2",children:!i&&o?.title?s.jsx(oe,{text:o.title,className:"text-sm font-medium text-foreground"}):s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),e[12]=o,e[13]=i,e[14]=N):N=e[14];let y;e[15]!==a?(y=()=>a(crypto.randomUUID()),e[15]=a,e[16]=y):y=e[16];let R;e[17]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ne,{size:16}),e[17]=R):R=e[17];let _;e[18]!==i||e[19]!==y?(_=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:y,disabled:i,"aria-label":"New chat",children:R})}),e[18]=i,e[19]=y,e[20]=_):_=e[20];let B;e[21]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(K,{children:"New chat"}),e[21]=B):B=e[21];let S;e[22]!==_?(S=s.jsxs(J,{children:[_,B]}),e[22]=_,e[23]=S):S=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=()=>f(!0),e[24]=L):L=e[24];let O;e[25]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsxs(J,{children:[s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:L,"aria-label":"Chat history",children:s.jsx(ae,{size:16})})}),s.jsx(K,{children:"Chat history"})]}),e[25]=O):O=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(be,{size:16}),e[26]=D):D=e[26];let v;e[27]!==i?(v=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Ae,disabled:i,"aria-label":"Pin chat",children:D})}),e[27]=i,e[28]=v):v=e[28];let F;e[29]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(K,{children:"Pin chat"}),e[29]=F):F=e[29];let C;e[30]!==v?(C=s.jsxs(J,{children:[v,F]}),e[30]=v,e[31]=C):C=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(ye,{size:16}),e[32]=U):U=e[32];let w;e[33]!==i?(w=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:$e,disabled:i,"aria-label":"Share chat",children:U})}),e[33]=i,e[34]=w):w=e[34];let W;e[35]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(K,{children:"Share chat"}),e[35]=W):W=e[35];let k;e[36]!==w?(k=s.jsxs(J,{children:[w,W]}),e[36]=w,e[37]=k):k=e[37];let z;e[38]!==C||e[39]!==k||e[40]!==S?(z=s.jsxs(A.Header.Right,{className:"gap-1",children:[S,O,C,k]}),e[38]=C,e[39]=k,e[40]=S,e[41]=z):z=e[41];let T;e[42]!==z||e[43]!==N?(T=s.jsxs(A.Header,{className:"flex-none",children:[N,z]}),e[42]=z,e[43]=N,e[44]=T):T=e[44];let M;e[45]!==H||e[46]!==i||e[47]!==x?(M=i?s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 pb-32 pt-10",children:[s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full max-w-[600px]",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(ee,{icon:H.icon,name:H.title,size:"md",fallbackIcon:s.jsx(se,{size:20}),className:"size-12 rounded-xl border border-stone-200/60 shadow-sm aspect-square transition-opacity duration-200"})}),s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg font-medium text-foreground",children:[Q," ",x,","]}),s.jsx("p",{className:"text-base text-muted-foreground opacity-50 mb-0",children:"What are we building today?"})]}),s.jsx("div",{className:"w-full -mt-1",children:s.jsx(g.Input,{})}),s.jsx(g.IceBreakers,{className:"w-full"})]}),s.jsx("div",{className:"flex flex-col items-center w-full mt-4",children:s.jsx(Me,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(g.Main,{children:s.jsx(g.Messages,{})}),s.jsx(g.Footer,{children:s.jsx(g.Input,{})})]}),e[45]=H,e[46]=i,e[47]=x,e[48]=M):M=e[48];let I;e[49]!==a?(I=p=>{a(p),f(!1)},e[49]=a,e[50]=I):I=e[50];let P;e[51]!==r||e[52]!==m||e[53]!==I||e[54]!==c?(P=s.jsx(ce,{open:m,onOpenChange:f,threads:c,activeThreadId:r,onThreadSelect:I}),e[51]=r,e[52]=m,e[53]=I,e[54]=c,e[55]=P):P=e[55];let q;return e[56]!==T||e[57]!==M||e[58]!==P?(q=s.jsxs(g,{className:"bg-background",children:[T,M,P]}),e[56]=T,e[57]=M,e[58]=P,e[59]=q):q=e[59],q}function $e(){Z.info("Share feature coming soon")}function Ae(){Z.info("Pin feature coming soon")}function Ve(e){const t=b.c(14),{error:l,onRetry:h}=e,i=l?.message?.includes("401")||l?.message?.toLowerCase().includes("unauthorized");let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs(A.Header,{className:"flex-none",children:[s.jsx(A.Header.Left,{className:"gap-2",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),s.jsx(A.Header.Right,{className:"gap-1"})]}),t[0]=r):r=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:s.jsx(me,{className:"h-6 w-6 text-destructive"})}),t[1]=a):a=t[1];const c=i?"Unable to load models":"Something went wrong";let d;t[2]!==c?(d=s.jsx("h3",{className:"text-lg font-medium",children:c}),t[2]=c,t[3]=d):d=t[3];const n=i?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":l?.message||"An unexpected error occurred";let o;t[4]!==n?(o=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),t[4]=n,t[5]=o):o=t[5];let m;t[6]!==d||t[7]!==o?(m=s.jsxs("div",{className:"space-y-2",children:[d,o]}),t[6]=d,t[7]=o,t[8]=m):m=t[8];let f;t[9]!==h?(f=s.jsx(V,{variant:"outline",onClick:h,children:"Try again"}),t[9]=h,t[10]=f):f=t[10];let u;return t[11]!==m||t[12]!==f?(u=s.jsxs(g,{className:"bg-background",children:[r,s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:s.jsxs("div",{className:"max-w-sm space-y-4",children:[a,m,f]})})]}),t[11]=m,t[12]=f,t[13]=u):u=t[13],u}function Pt(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(de,{fallback:Ee,children:s.jsx($.Suspense,{fallback:s.jsx(g.Skeleton,{className:"bg-background"}),children:s.jsx(Pe,{})})}),e[0]=t):t=e[0],t}function Ee(e){const{error:t,resetError:l}=e;return s.jsx(Ve,{error:t,onRetry:l})}export{Pt as default};
@@ -1 +1 @@
1
- import{c as T,u as z,j as n}from"./index-DVqIQLTS.js";import{B as y}from"./button-BB_m2E67.js";import{T as C,a as S,b as B,c as v}from"./empty-state-Cuxzpiqy.js";import{c as A}from"./Pin01-dHyXwRhr.js";import{u as E,a as I}from"./use-organization-settings-Bnh92zjq.js";function $(h){const e=T.c(19),{title:u,url:t,icon:p}=h,{org:_}=z(),s=E(_.id),f=I(_.id);let a;e[0]!==s?.sidebar_items||e[1]!==t?(a=s?.sidebar_items?.some(m=>m.url===t),e[0]=s?.sidebar_items,e[1]=t,e[2]=a):a=e[2];const r=!!a;let l;e[3]!==f.update||e[4]!==p||e[5]!==r||e[6]!==s?.sidebar_items||e[7]!==u||e[8]!==t?(l=async()=>{const m=s?.sidebar_items||[];let j;r?j=m.filter(P=>P.url!==t):j=[...m,{title:u,url:t,icon:p}],await f.update.mutateAsync({sidebar_items:j})},e[3]=f.update,e[4]=p,e[5]=r,e[6]=s?.sidebar_items,e[7]=u,e[8]=t,e[9]=l):l=e[9];const b=l,x=r?"secondary":"outline";let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(A,{size:16}),e[10]=c):c=e[10];let i;e[11]!==b||e[12]!==x?(i=n.jsx(C,{asChild:!0,children:n.jsx(y,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:c})}),e[11]=b,e[12]=x,e[13]=i):i=e[13];const g=r?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=n.jsx(S,{children:g}),e[14]=g,e[15]=o):o=e[15];let d;return e[16]!==i||e[17]!==o?(d=n.jsx(B,{children:n.jsxs(v,{children:[i,o]})}),e[16]=i,e[17]=o,e[18]=d):d=e[18],d}export{$ as P};
1
+ import{c as T,u as z,j as n}from"./index-yjsBu7QA.js";import{B as y}from"./button-BNRw8VbO.js";import{T as C,a as S,b as B,c as v}from"./empty-state-CpRLw49r.js";import{c as A}from"./Pin01-C3nTzsY2.js";import{u as E,a as I}from"./use-organization-settings-ClYOYczD.js";function $(h){const e=T.c(19),{title:u,url:t,icon:p}=h,{org:_}=z(),s=E(_.id),f=I(_.id);let a;e[0]!==s?.sidebar_items||e[1]!==t?(a=s?.sidebar_items?.some(m=>m.url===t),e[0]=s?.sidebar_items,e[1]=t,e[2]=a):a=e[2];const r=!!a;let l;e[3]!==f.update||e[4]!==p||e[5]!==r||e[6]!==s?.sidebar_items||e[7]!==u||e[8]!==t?(l=async()=>{const m=s?.sidebar_items||[];let j;r?j=m.filter(P=>P.url!==t):j=[...m,{title:u,url:t,icon:p}],await f.update.mutateAsync({sidebar_items:j})},e[3]=f.update,e[4]=p,e[5]=r,e[6]=s?.sidebar_items,e[7]=u,e[8]=t,e[9]=l):l=e[9];const b=l,x=r?"secondary":"outline";let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(A,{size:16}),e[10]=c):c=e[10];let i;e[11]!==b||e[12]!==x?(i=n.jsx(C,{asChild:!0,children:n.jsx(y,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:c})}),e[11]=b,e[12]=x,e[13]=i):i=e[13];const g=r?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=n.jsx(S,{children:g}),e[14]=g,e[15]=o):o=e[15];let d;return e[16]!==i||e[17]!==o?(d=n.jsx(B,{children:n.jsxs(v,{children:[i,o]})}),e[16]=i,e[17]=o,e[18]=d):d=e[18],d}export{$ as P};