@decocms/mesh 2.20.3 → 2.20.5

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 (145) hide show
  1. package/dist/client/assets/{AlertCircle-CI2U-jkN.js → AlertCircle-BRYxEd9U.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-B3km7toT.js → ArrowLeft-BQ7IVK5l.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BF7mM4C2.js → ArrowUp-BHV7fQvC.js} +1 -1
  4. package/dist/client/assets/{Check-BQkm1TiP.js → Check-01TyG8gs.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-DP6jvip7.js → ChevronDown-Bk7OKoGa.js} +1 -1
  6. package/dist/client/assets/{Code01-qXTn9GK9.js → Code01-dW-GUA8c.js} +1 -1
  7. package/dist/client/assets/{Copy01-CEYn2daS.js → Copy01-Cci5IJlw.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-C2Nr-D-f.js → DotsHorizontal-B46rT1E7.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-BPP4U4GQ.js → DotsVertical-BqUSftJK.js} +1 -1
  10. package/dist/client/assets/{Download01-BkDXja2z.js → Download01-DtRalfBM.js} +1 -1
  11. package/dist/client/assets/{Edit01-Cq0mQDLh.js → Edit01-gvkP_dl-.js} +1 -1
  12. package/dist/client/assets/{File06-KMD38I-q.js → File06-ByA_vTun.js} +1 -1
  13. package/dist/client/assets/{FilterLines-Bojt6HPl.js → FilterLines-GHP-QaK4.js} +1 -1
  14. package/dist/client/assets/{FlipBackward-C-K9FamE.js → FlipBackward-BS3V82bC.js} +1 -1
  15. package/dist/client/assets/{GitBranch01-DGTCzEh5.js → GitBranch01-tvqRSCfh.js} +1 -1
  16. package/dist/client/assets/{Grid01-D4lXvveX.js → Grid01-DlRq7T-9.js} +1 -1
  17. package/dist/client/assets/{Home02-DPdZvu8L.js → Home02-B_0su9RA.js} +1 -1
  18. package/dist/client/assets/{Image01-C0R6SF_P.js → Image01-CHyuHHfR.js} +1 -1
  19. package/dist/client/assets/{Inbox01-BsOUYwQZ.js → Inbox01-BT2JYivP.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-BgIkbjJr.js → InfoCircle-CVbq8jCi.js} +1 -1
  21. package/dist/client/assets/{Key01-DTwk4FpG.js → Key01-CR3co8Y_.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-DmruqAb9.js → LinkExternal01-DKnd8nXA.js} +1 -1
  23. package/dist/client/assets/{List-BsSZz32j.js → List-BMChI4Jp.js} +1 -1
  24. package/dist/client/assets/{Loading01-Ae5ezbtD.js → Loading01-Ciunqme0.js} +1 -1
  25. package/dist/client/assets/{Lock01-BuQSktMF.js → Lock01-Z2BgitgI.js} +1 -1
  26. package/dist/client/assets/{Play-DKlNHVjf.js → Play-ftmsq5JK.js} +1 -1
  27. package/dist/client/assets/{Plus-CdG75X26.js → Plus-Dr1frakx.js} +1 -1
  28. package/dist/client/assets/{SearchMd-GFaonOaJ.js → SearchMd-BdgkqD1I.js} +1 -1
  29. package/dist/client/assets/{Terminal-C6mZx-5A.js → Terminal-C6MHBgjq.js} +1 -1
  30. package/dist/client/assets/{Trash01-BWIN9RL_.js → Trash01-O7XdHeVF.js} +1 -1
  31. package/dist/client/assets/{Upload01-CaBE4VYK.js → Upload01-oZYrY2i5.js} +1 -1
  32. package/dist/client/assets/{X-C18ho617.js → X-CBxJpjg0.js} +1 -1
  33. package/dist/client/assets/{XClose-CfwoKknl.js → XClose-CZV8y02_.js} +1 -1
  34. package/dist/client/assets/agent-detail-CZykGi9X.js +1 -0
  35. package/dist/client/assets/agents-C2xykK68.js +1 -0
  36. package/dist/client/assets/{alert-dialog-CCJCsKzK.js → alert-dialog-VCUJKSC8.js} +1 -1
  37. package/dist/client/assets/{auth-catchall-C33VWmDE.js → auth-catchall-eqWzQgEV.js} +1 -1
  38. package/dist/client/assets/{avatar-B7xnPXuk.js → avatar-BTpw67uu.js} +1 -1
  39. package/dist/client/assets/{badge-BVO6I0sW.js → badge-BBWbP67q.js} +1 -1
  40. package/dist/client/assets/{binder-By0LBK9Y.js → binder-C7ZGqrKK.js} +1 -1
  41. package/dist/client/assets/{button-CGmrzkpY.js → button-CSCVKnjE.js} +1 -1
  42. package/dist/client/assets/{card-DIjMh1NO.js → card-DIp7Pbbe.js} +1 -1
  43. package/dist/client/assets/{checkbox-DYViXeUc.js → checkbox-B4SYjdp8.js} +1 -1
  44. package/dist/client/assets/{collection-detail-DtlOJm8P.js → collection-detail-DjOL7Bjs.js} +4 -4
  45. package/dist/client/assets/{collection-display-button-CtkxsCB_.js → collection-display-button-DJ1AY12f.js} +1 -1
  46. package/dist/client/assets/{collection-header-B4qcjEt5.js → collection-header-BexgULaJ.js} +1 -1
  47. package/dist/client/assets/{collection-page-s-RR5fU6.js → collection-page-CFeLb91S.js} +1 -1
  48. package/dist/client/assets/{collection-search-BVb42O45.js → collection-search-BIaqbS2d.js} +1 -1
  49. package/dist/client/assets/{collection-tab-CvrhLJCU.js → collection-tab-B6gVlnp1.js} +1 -1
  50. package/dist/client/assets/{collection-table-wrapper-BohFZqii.js → collection-table-wrapper-D_9AP4Xy.js} +1 -1
  51. package/dist/client/assets/{connection-ChwHK0-S.js → connection-BOiZ4DhB.js} +1 -1
  52. package/dist/client/assets/{connection-card-DMMfNQUo.js → connection-card-B7L3EvSn.js} +1 -1
  53. package/dist/client/assets/connection-detail-C63xtruJ.js +1 -0
  54. package/dist/client/assets/{connections-CRhyn7eO.js → connections-bna1FNR4.js} +1 -1
  55. package/dist/client/assets/constants-CRHWvr6r.js +1 -0
  56. package/dist/client/assets/{create-organization-dialog-CtbMd6S_.js → create-organization-dialog-DrPDs6B5.js} +1 -1
  57. package/dist/client/assets/{dialog-DJJ2cvEE.js → dialog-BKcENWTv.js} +1 -1
  58. package/dist/client/assets/{dropdown-menu-CAeD2aIb.js → dropdown-menu-6yOcAo_W.js} +1 -1
  59. package/dist/client/assets/{dynamic-plugin-layout-BeSg8wRq.js → dynamic-plugin-layout-DgPbTvHX.js} +1 -1
  60. package/dist/client/assets/{empty-state-BkAB-hls.js → empty-state-CKHPbxeg.js} +1 -1
  61. package/dist/client/assets/{empty-state-wP9uukGJ.js → empty-state-CaPNxgdS.js} +1 -1
  62. package/dist/client/assets/{env-vars-editor-DuH6BBdA.js → env-vars-editor-DB9sQiDh.js} +1 -1
  63. package/dist/client/assets/{error-boundary-BUvK8Sry.js → error-boundary-CZ-hRbTW.js} +1 -1
  64. package/dist/client/assets/{extract-connection-data-BLs0SRok.js → extract-connection-data-xYehFtf9.js} +1 -1
  65. package/dist/client/assets/{file-browser-DuR45yyf.js → file-browser-BU2xrvlc.js} +2 -2
  66. package/dist/client/assets/{form-DiGzBnRK.js → form-D-QUdO0s.js} +1 -1
  67. package/dist/client/assets/{grid-view-Db741zGU.js → grid-view-D1lCA5Sx.js} +1 -1
  68. package/dist/client/assets/{home-BtJc_wcZ.js → home-B80k-FcM.js} +1 -1
  69. package/dist/client/assets/{index-Diww4UW3.js → index-BADGsnm_.js} +3 -3
  70. package/dist/client/assets/{index-DjRWdLI4.js → index-BEzz4Zqk.js} +9 -9
  71. package/dist/client/assets/{index-DUA-vRuy.js → index-CViGbTGN.js} +1 -1
  72. package/dist/client/assets/{index-D4QCsSzb.js → index-D4I3u5rj.js} +1 -1
  73. package/dist/client/assets/{index-CL_rL7XJ.js → index-DGVUoQ0k.js} +65 -65
  74. package/dist/client/assets/{infiniteQueryObserver-BmbQcWdI.js → infiniteQueryObserver-DoGEx2i9.js} +1 -1
  75. package/dist/client/assets/{input-CrURMEZe.js → input-BDWPxnpd.js} +1 -1
  76. package/dist/client/assets/{layout-kp8TTJc9.js → layout-DEupYEZG.js} +1 -1
  77. package/dist/client/assets/{lazy-highlighter-dN3WcL6s.js → lazy-highlighter-Bn9myoq9.js} +1 -1
  78. package/dist/client/assets/localstorage-keys-eASnOQ5z.js +1 -0
  79. package/dist/client/assets/{login-CnuJ6k4x.js → login-H-3KOz_a.js} +1 -1
  80. package/dist/client/assets/{mcp-oauth-CdcIczUJ.js → mcp-oauth-8-FuZodO.js} +1 -1
  81. package/dist/client/assets/{mcp-server-card-VZUBDTRj.js → mcp-server-card-jC-20C4W.js} +1 -1
  82. package/dist/client/assets/{mcp-server-detail-CIR0FKMd.js → mcp-server-detail-C4TwgL7p.js} +1 -1
  83. package/dist/client/assets/members-BF2WYhNd.js +3 -0
  84. package/dist/client/assets/{monaco-editor-CDRbE4GY.js → monaco-editor-BDsCepgw.js} +1 -1
  85. package/dist/client/assets/{monitoring-Cb41cf-X.js → monitoring-1Ei05IVG.js} +15 -15
  86. package/dist/client/assets/{oauth-callback-z6t0OToi.js → oauth-callback-UV6p5nJu.js} +1 -1
  87. package/dist/client/assets/page-BXvciBeM.js +21 -0
  88. package/dist/client/assets/{page-CcKdSzCp.js → page-IRt77uto.js} +1 -1
  89. package/dist/client/assets/{pin-to-sidebar-button-DIwkO0Tx.js → pin-to-sidebar-button-BfOZ995T.js} +1 -1
  90. package/dist/client/assets/{plugin-empty-state-B-glkOMH.js → plugin-empty-state-CvCBkNU_.js} +1 -1
  91. package/dist/client/assets/{plugin-header-BA0z5mBU.js → plugin-header-CT5ofHVa.js} +1 -1
  92. package/dist/client/assets/{plugins-Cq62fkYj.js → plugins-BM-POIbA.js} +1 -1
  93. package/dist/client/assets/{popover-Bx7diZ86.js → popover-Bol-owE5.js} +1 -1
  94. package/dist/client/assets/{project-context-provider-DulCVL2k.js → project-context-provider-BrEPJG0C.js} +1 -1
  95. package/dist/client/assets/{registry-utils-8Lvx2XTy.js → registry-utils-qr2hWyuD.js} +1 -1
  96. package/dist/client/assets/{resizable-Gk1RjNnW.js → resizable-5YkDxOnG.js} +1 -1
  97. package/dist/client/assets/{resource-tabs-ACbF96qo.js → resource-tabs-CoVc7CCV.js} +1 -1
  98. package/dist/client/assets/{select-C8LOz7vA.js → select-CncHydKl.js} +1 -1
  99. package/dist/client/assets/{settings-BXJ6BGel.js → settings-DR5TOYQT.js} +1 -1
  100. package/dist/client/assets/shell-layout-BUa4VNmw.js +3 -0
  101. package/dist/client/assets/{spinner-BF56RAKQ.js → spinner-CVaIYhex.js} +1 -1
  102. package/dist/client/assets/{switch-DJBd8Fzb.js → switch-DXIwD9IB.js} +1 -1
  103. package/dist/client/assets/{textarea-C_zgj3Sp.js → textarea-CjiaCeZv.js} +1 -1
  104. package/dist/client/assets/{tool-set-selector-B9rTBahU.js → tool-set-selector-NKABlXdy.js} +1 -1
  105. package/dist/client/assets/{tools-list-mr-l2d8l.js → tools-list-Dlo-5MDO.js} +1 -1
  106. package/dist/client/assets/{tooltip-Suu_Gpqh.js → tooltip-Dh7pKOjr.js} +1 -1
  107. package/dist/client/assets/{typewriter-title-DM-oRxie.js → typewriter-title-D71dWYOo.js} +1 -1
  108. package/dist/client/assets/use-binding-CMrf28mD.js +23 -0
  109. package/dist/client/assets/{use-collections-CXETocKO.js → use-collections-BYXeN_Z5.js} +1 -1
  110. package/dist/client/assets/{use-connection-CCXutWLD.js → use-connection-CfZ0Vu4z.js} +1 -1
  111. package/dist/client/assets/{use-connection-resources-D0st76bP.js → use-connection-resources-DpopeA_b.js} +1 -1
  112. package/dist/client/assets/use-create-virtual-mcp-DLEcqdBk.js +1 -0
  113. package/dist/client/assets/{use-list-state-AndcW8aD.js → use-list-state-D02T_aKE.js} +1 -1
  114. package/dist/client/assets/{use-mcp-D9llr83X.js → use-mcp-BLkJq7bN.js} +1 -1
  115. package/dist/client/assets/{use-members-CB2ebBfn.js → use-members-v6U7Oi6B.js} +1 -1
  116. package/dist/client/assets/{use-mobile-DssCtDl6.js → use-mobile-BDBdLYs3.js} +1 -1
  117. package/dist/client/assets/{use-organization-settings-CQXtXtZs.js → use-organization-settings-BznzPQgX.js} +1 -1
  118. package/dist/client/assets/{use-tool-call-BmvKn7jp.js → use-tool-call-C-s97CRj.js} +1 -1
  119. package/dist/client/assets/use-virtual-mcp-BLBflG-l.js +1 -0
  120. package/dist/client/assets/use-virtual-mcp-system-prompt-XZLo_ZYW.js +1 -0
  121. package/dist/client/assets/useInfiniteQuery-B1vlCJEQ.js +1 -0
  122. package/dist/client/assets/{useMutation-Dl1MMkEC.js → useMutation-DX2iB0kT.js} +1 -1
  123. package/dist/client/assets/useQuery-BloC42s4.js +1 -0
  124. package/dist/client/assets/{value-DaPOjTmC.js → value-Dzu-joN0.js} +1 -1
  125. package/dist/client/assets/{view-mode-toggle-BLClM-0g.js → view-mode-toggle-DSycgDld.js} +1 -1
  126. package/dist/client/assets/{workflow-CQ7PQ7Dg.js → workflow-DaenHlXi.js} +1 -1
  127. package/dist/client/index.html +1 -1
  128. package/dist/server/cli.js +156 -156
  129. package/dist/server/migrate.js +138 -138
  130. package/dist/server/server.js +152 -152
  131. package/package.json +1 -1
  132. package/dist/client/assets/connection-detail-D9bORT-_.js +0 -1
  133. package/dist/client/assets/constants-J0aH6mLs.js +0 -1
  134. package/dist/client/assets/gateway-detail-BCBmyW-G.js +0 -1
  135. package/dist/client/assets/gateways-BgSVXbfx.js +0 -1
  136. package/dist/client/assets/localstorage-keys-BVANkONM.js +0 -1
  137. package/dist/client/assets/members-bQTH1spX.js +0 -3
  138. package/dist/client/assets/page-SWPgLEpC.js +0 -21
  139. package/dist/client/assets/shell-layout-CFRw9Ru3.js +0 -3
  140. package/dist/client/assets/use-binding-D6wv_5fO.js +0 -23
  141. package/dist/client/assets/use-create-gateway-BlLsktgc.js +0 -1
  142. package/dist/client/assets/use-gateway-DD-xEZju.js +0 -1
  143. package/dist/client/assets/use-gateway-system-prompt-zGJSEzce.js +0 -1
  144. package/dist/client/assets/useInfiniteQuery-BttwTOfK.js +0 -1
  145. package/dist/client/assets/useQuery-Bvk0U2ed.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/mesh",
3
- "version": "2.20.3",
3
+ "version": "2.20.5",
4
4
  "description": "MCP Mesh - Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{c as q,j as o,f as W,k as J,r as z,d as ce,b as ae,af as le}from"./index-Diww4UW3.js";import{E as F,I as Q}from"./empty-state-wP9uukGJ.js";import{E as X}from"./error-boundary-BUvK8Sry.js";import{b as G,a as me}from"./use-connection-CCXutWLD.js";import{a as de}from"./use-binding-D6wv_5fO.js";import{u as ue,S as pe}from"./index-DjRWdLI4.js";import{u as fe,a as he}from"./use-connection-resources-D0st76bP.js";import{B as xe}from"./button-CGmrzkpY.js";import{i as Y}from"./Loading01-Ae5ezbtD.js";import{R as ge}from"./resource-tabs-ACbF96qo.js";import{V as Z,a as be,b as je}from"./layout-kp8TTJc9.js";import{C as ye}from"./collection-tab-CvrhLJCU.js";import{C as ee}from"./collection-display-button-CtkxsCB_.js";import{C as te}from"./collection-search-BVb42O45.js";import{C as oe}from"./collection-table-wrapper-BohFZqii.js";import{P as se}from"./pin-to-sidebar-button-DIwkO0Tx.js";import{C as ne}from"./card-DIjMh1NO.js";import{R as Se,T as Ce}from"./tools-list-mr-l2d8l.js";import"./connection-ChwHK0-S.js";import"./project-context-provider-DulCVL2k.js";import"./use-collections-CXETocKO.js";import"./useMutation-Dl1MMkEC.js";import"./binder-By0LBK9Y.js";import"./mcp-oauth-CdcIczUJ.js";import"./env-vars-editor-DuH6BBdA.js";import"./input-CrURMEZe.js";import"./Plus-CdG75X26.js";import"./Trash01-BWIN9RL_.js";import"./use-tool-call-BmvKn7jp.js";import"./useQuery-Bvk0U2ed.js";import"./File06-KMD38I-q.js";import"./Key01-DTwk4FpG.js";import"./badge-BVO6I0sW.js";import"./form-DiGzBnRK.js";import"./select-C8LOz7vA.js";import"./tooltip-Suu_Gpqh.js";import"./Check-BQkm1TiP.js";import"./ChevronDown-DP6jvip7.js";import"./extract-connection-data-BLs0SRok.js";import"./constants-J0aH6mLs.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-8Lvx2XTy.js";import"./generate-id-Dyweu44Y.js";import"./Terminal-C6mZx-5A.js";import"./use-gateway-DD-xEZju.js";import"./Grid01-D4lXvveX.js";import"./index-DUA-vRuy.js";import"./index-D4QCsSzb.js";import"./index-CL_rL7XJ.js";import"./X-C18ho617.js";import"./popover-Bx7diZ86.js";import"./textarea-C_zgj3Sp.js";import"./AlertCircle-CI2U-jkN.js";import"./ArrowUp-BF7mM4C2.js";import"./Edit01-Cq0mQDLh.js";import"./use-gateway-system-prompt-zGJSEzce.js";import"./localstorage-keys-BVANkONM.js";import"./SearchMd-GFaonOaJ.js";import"./use-create-gateway-BlLsktgc.js";import"./Image01-C0R6SF_P.js";import"./spinner-BF56RAKQ.js";import"./Copy01-CEYn2daS.js";import"./monaco-editor-CDRbE4GY.js";import"./alert-dialog-CCJCsKzK.js";import"./well-known-mcp-DOEdYmKO.js";import"./ArrowLeft-B3km7toT.js";import"./dropdown-menu-CAeD2aIb.js";import"./DotsVertical-BPP4U4GQ.js";import"./use-list-state-AndcW8aD.js";import"./use-mobile-DssCtDl6.js";import"./empty-state-BkAB-hls.js";import"./Inbox01-BsOUYwQZ.js";import"./avatar-B7xnPXuk.js";import"./List-BsSZz32j.js";import"./view-mode-toggle-BLClM-0g.js";import"./use-organization-settings-CQXtXtZs.js";function ve(t){const e=q.c(42),{prompts:r,connectionId:n,org:s,connectionTitle:a,connectionIcon:f,onPromptClick:j,showToolbar:g,emptyMessage:N}=t,V=g===void 0?!0:g,L=N===void 0?"This connection doesn't have any prompts yet.":N,p=W(),y=J().location.href,[l,i]=z.useState(""),[w,m]=z.useState("table"),[h,R]=z.useState("name"),[u,_]=z.useState("asc");let b;e[0]!==u||e[1]!==h?(b=x=>{h===x?(_(Ie),u==="desc"&&R(void 0)):(R(x),_("asc"))},e[0]=u,e[1]=h,e[2]=b):b=e[2];const T=b;let P;e[3]!==n||e[4]!==p||e[5]!==j||e[6]!==s?(P=x=>{j?j(x):n&&s&&p({to:"/$org/mcps/$connectionId/$collectionName/$itemId",params:{org:s,connectionId:n,collectionName:"prompts",itemId:encodeURIComponent(x.name)}})},e[3]=n,e[4]=p,e[5]=j,e[6]=s,e[7]=P):P=e[7];const M=P;let O;if(e[8]!==r||e[9]!==l||e[10]!==u||e[11]!==h){const x=!r||r.length===0?[]:l.trim()?(()=>{const S=l.toLowerCase();return r.filter(B=>B.name.toLowerCase().includes(S)||B.description&&B.description.toLowerCase().includes(S))})():r;O=!h||!u?x:[...x].sort((S,B)=>{const re=S[h]||"",ie=B[h]||"",H=String(re).localeCompare(String(ie));return u==="asc"?H:-H}),e[8]=r,e[9]=l,e[10]=u,e[11]=h,e[12]=O}else O=e[12];const d=O;let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=[{id:"name",header:"Name",render:$e,sortable:!0},{id:"description",header:"Description",render:Te,cellClassName:"flex-1",sortable:!0}],e[13]=K):K=e[13];const A=K;let E;e[14]===Symbol.for("react.memo_cache_sentinel")?(E=A.filter(we).map(Ne),e[14]=E):E=e[14];const D=E;let $;e[15]!==f||e[16]!==a||e[17]!==T||e[18]!==V||e[19]!==u||e[20]!==h||e[21]!==y||e[22]!==w?($=V&&o.jsxs(Z,{children:[o.jsx(ee,{viewMode:w,onViewModeChange:m,sortKey:h,sortDirection:u,onSort:T,sortOptions:D}),o.jsx(se,{title:a?`${a}: Prompts`:"Prompts",url:y,icon:f??"description"})]}),e[15]=f,e[16]=a,e[17]=T,e[18]=V,e[19]=u,e[20]=h,e[21]=y,e[22]=w,e[23]=$):$=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=x=>{x.key==="Escape"&&(i(""),x.target.blur())},e[24]=I):I=e[24];let k;e[25]!==l?(k=o.jsx(te,{value:l,onChange:i,placeholder:"Search prompts...",onKeyDown:I}),e[25]=l,e[26]=k):k=e[26];let c;e[27]!==L||e[28]!==M||e[29]!==T||e[30]!==l||e[31]!==u||e[32]!==h||e[33]!==d||e[34]!==w?(c=w==="cards"?o.jsx("div",{className:"flex-1 overflow-auto p-5",children:d.length===0?o.jsx(F,{image:null,title:l?"No prompts found":"No prompts available",description:l?"Try adjusting your search terms":L}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:d.map(x=>o.jsx(ne,{className:"cursor-pointer transition-colors",onClick:()=>M(x),children:o.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[o.jsx(Q,{icon:null,name:x.name,size:"md",className:"shrink-0 shadow-sm"}),o.jsxs("div",{className:"flex flex-col gap-0",children:[o.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:x.name}),o.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:x.description||"No description"})]})]})},x.name))})}):o.jsx(oe,{columns:A,data:d,isLoading:!1,sortKey:h,sortDirection:u,onSort:T,onRowClick:x=>M(x),emptyState:o.jsx(F,{image:null,title:l?"No prompts found":"No prompts available",description:l?"Try adjusting your search terms":L})}),e[27]=L,e[28]=M,e[29]=T,e[30]=l,e[31]=u,e[32]=h,e[33]=d,e[34]=w,e[35]=c):c=e[35];let C;e[36]!==k||e[37]!==c?(C=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[k,c]}),e[36]=k,e[37]=c,e[38]=C):C=e[38];let v;return e[39]!==C||e[40]!==$?(v=o.jsxs(o.Fragment,{children:[$,C]}),e[39]=C,e[40]=$,e[41]=v):v=e[41],v}function Ne(t){return{id:t.id,label:typeof t.header=="string"?t.header:t.id}}function we(t){return t.sortable}function Te(t){return o.jsx("span",{className:"text-sm text-foreground",children:t.description||"—"})}function $e(t){return o.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:t.name})}function Ie(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function ke(t){const e=q.c(6),{prompts:r,connectionId:n,org:s}=t,a=G(n),f=a?.title,j=a?.icon;let g;return e[0]!==n||e[1]!==s||e[2]!==r||e[3]!==f||e[4]!==j?(g=o.jsx(ve,{prompts:r,connectionId:n,org:s,connectionTitle:f,connectionIcon:j}),e[0]=n,e[1]=s,e[2]=r,e[3]=f,e[4]=j,e[5]=g):g=e[5],g}function Re(t){const e=q.c(2),{repository:r}=t;let n;return e[0]!==r?(n=o.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:o.jsx(Se,{repository:r})}),e[0]=r,e[1]=n):n=e[1],n}function _e(t){const e=q.c(39),{resources:r,connectionTitle:n,connectionIcon:s,onResourceClick:a,showToolbar:f,emptyMessage:j}=t,g=f===void 0?!0:f,N=j===void 0?"This connection doesn't have any resources yet.":j,L=J().location.href,[p,U]=z.useState(""),[y,l]=z.useState("table"),[i,w]=z.useState("name"),[m,h]=z.useState("asc");let R;e[0]!==m||e[1]!==i?(R=c=>{i===c?(h(De),m==="desc"&&w(void 0)):(w(c),h("asc"))},e[0]=m,e[1]=i,e[2]=R):R=e[2];const u=R;let _;e[3]!==a?(_=c=>{a&&a(c)},e[3]=a,e[4]=_):_=e[4];const b=_;let T;if(e[5]!==r||e[6]!==p||e[7]!==m||e[8]!==i){const c=!r||r.length===0?[]:p.trim()?(()=>{const C=p.toLowerCase();return r.filter(v=>v.uri.toLowerCase().includes(C)||v.name&&v.name.toLowerCase().includes(C)||v.description&&v.description.toLowerCase().includes(C))})():r;T=!i||!m?c:[...c].sort((C,v)=>{const x=C[i]||"",S=v[i]||"",B=String(x).localeCompare(String(S));return m==="asc"?B:-B}),e[5]=r,e[6]=p,e[7]=m,e[8]=i,e[9]=T}else T=e[9];const P=T;let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=[{id:"name",header:"Name",render:Me,sortable:!0},{id:"uri",header:"URI",render:Ee,sortable:!0},{id:"description",header:"Description",render:Ae,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Le,sortable:!0}],e[10]=M):M=e[10];const O=M;let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=O.filter(Ve).map(Pe),e[11]=d):d=e[11];const K=d;let A;e[12]!==s||e[13]!==n||e[14]!==u||e[15]!==g||e[16]!==m||e[17]!==i||e[18]!==L||e[19]!==y?(A=g&&o.jsxs(Z,{children:[o.jsx(ee,{viewMode:y,onViewModeChange:l,sortKey:i,sortDirection:m,onSort:u,sortOptions:K}),o.jsx(se,{title:n?`${n}: Resources`:"Resources",url:L,icon:s??"folder"})]}),e[12]=s,e[13]=n,e[14]=u,e[15]=g,e[16]=m,e[17]=i,e[18]=L,e[19]=y,e[20]=A):A=e[20];let E;e[21]===Symbol.for("react.memo_cache_sentinel")?(E=c=>{c.key==="Escape"&&(U(""),c.target.blur())},e[21]=E):E=e[21];let D;e[22]!==p?(D=o.jsx(te,{value:p,onChange:U,placeholder:"Search resources...",onKeyDown:E}),e[22]=p,e[23]=D):D=e[23];let $;e[24]!==N||e[25]!==b||e[26]!==u||e[27]!==p||e[28]!==m||e[29]!==i||e[30]!==P||e[31]!==y?($=y==="cards"?o.jsx("div",{className:"flex-1 overflow-auto p-5",children:P.length===0?o.jsx(F,{image:null,title:p?"No resources found":"No resources available",description:p?"Try adjusting your search terms":N}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:P.map(c=>o.jsx(ne,{className:"cursor-pointer transition-colors",onClick:()=>b(c),children:o.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[o.jsx(Q,{icon:null,name:c.name||c.uri,size:"md",className:"shrink-0 shadow-sm"}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:c.name||c.uri}),o.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:c.uri}),c.description&&o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:c.description})]})]})},c.uri))})}):o.jsx(oe,{columns:O,data:P,isLoading:!1,sortKey:i,sortDirection:m,onSort:u,onRowClick:c=>b(c),emptyState:o.jsx(F,{image:null,title:p?"No resources found":"No resources available",description:p?"Try adjusting your search terms":N})}),e[24]=N,e[25]=b,e[26]=u,e[27]=p,e[28]=m,e[29]=i,e[30]=P,e[31]=y,e[32]=$):$=e[32];let I;e[33]!==D||e[34]!==$?(I=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[D,$]}),e[33]=D,e[34]=$,e[35]=I):I=e[35];let k;return e[36]!==I||e[37]!==A?(k=o.jsxs(o.Fragment,{children:[A,I]}),e[36]=I,e[37]=A,e[38]=k):k=e[38],k}function Pe(t){return{id:t.id,label:typeof t.header=="string"?t.header:t.id}}function Ve(t){return t.sortable}function Le(t){return o.jsx("span",{className:"text-sm text-muted-foreground",children:t.mimeType||"—"})}function Ae(t){return o.jsx("span",{className:"text-sm text-foreground",children:t.description||"—"})}function Ee(t){return o.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:t.uri})}function Me(t){return o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.name||t.uri})}function De(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Oe(t){const e=q.c(6),{resources:r,connectionId:n,org:s}=t,a=G(n),f=a?.title,j=a?.icon;let g;return e[0]!==n||e[1]!==s||e[2]!==r||e[3]!==f||e[4]!==j?(g=o.jsx(_e,{resources:r,connectionId:n,org:s,connectionTitle:f,connectionIcon:j}),e[0]=n,e[1]=s,e[2]=r,e[3]=f,e[4]=j,e[5]=g):g=e[5],g}function Be(t){const e=q.c(4),{tools:r,connectionId:n,org:s}=t;let a;return e[0]!==n||e[1]!==s||e[2]!==r?(a=o.jsx(Ce,{tools:r,connectionId:n,org:s}),e[0]=n,e[1]=s,e[2]=r,e[3]=a):a=e[3],a}function Ue(t){const e=q.c(62),{connection:r,connectionId:n,org:s,requestedTabId:a,collections:f,onUpdate:j,isUpdating:g,prompts:N,resources:V}=t,L=le();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={from:"/$org/mcps/$connectionId"},e[0]=p):p=e[0];const U=W(p);let y;e[1]!==n?(y={connectionId:n},e[1]=n,e[2]=y):y=e[2];const l=ue(y),i=l.isAuthenticated,w=r?.metadata?.repository,m=!!w?.url,h=r?.tools?.length??0,R=N.length,u=V.length;let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_={id:"settings",label:"Settings"},e[3]=_):_=e[3];let b;e[4]!==i||e[5]!==h?(b=i&&h>0?[{id:"tools",label:"Tools",count:h}]:[],e[4]=i,e[5]=h,e[6]=b):b=e[6];let T;e[7]!==i||e[8]!==R?(T=i&&R>0?[{id:"prompts",label:"Prompts",count:R}]:[],e[7]=i,e[8]=R,e[9]=T):T=e[9];let P;e[10]!==i||e[11]!==u?(P=i&&u>0?[{id:"resources",label:"Resources",count:u}]:[],e[10]=i,e[11]=u,e[12]=P):P=e[12];let M;if(e[13]!==f||e[14]!==m||e[15]!==i||e[16]!==b||e[17]!==T||e[18]!==P){let S;e[20]!==m?(S=m?[{id:"readme",label:"README"}]:[],e[20]=m,e[21]=S):S=e[21],M=[_,...b,...T,...P,...i?(f||[]).map(Ke):[],...S],e[13]=f,e[14]=m,e[15]=i,e[16]=b,e[17]=T,e[18]=P,e[19]=M}else M=e[19];const O=M,d=O.some(S=>S.id===a)?a:"settings";let K;e[22]!==U?(K=S=>{U({search:B=>({...B,tab:S}),replace:!0})},e[22]=U,e[23]=K):K=e[23];const A=K;let E;e[24]!==f?(E=f||[],e[24]=f,e[25]=E):E=e[25];let D;if(e[26]!==d||e[27]!==E){let S;e[29]!==d?(S=B=>B.name===d,e[29]=d,e[30]=S):S=e[30],D=E.find(S),e[26]=d,e[27]=E,e[28]=D}else D=e[28];const $=D;let I;e[31]!==L.history?(I=()=>L.history.back(),e[31]=L.history,e[32]=I):I=e[32];let k;e[33]!==d||e[34]!==A||e[35]!==O?(k=o.jsx(be,{children:o.jsx(ge,{tabs:O,activeTab:d,onTabChange:A})}),e[33]=d,e[34]=A,e[35]=O,e[36]=k):k=e[36];let c;e[37]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}),e[37]=c):c=e[37];let C;e[38]!==$||e[39]!==d||e[40]!==l.hasOAuthToken||e[41]!==l.isServerError||e[42]!==l.supportsOAuth||e[43]!==r||e[44]!==n||e[45]!==A||e[46]!==m||e[47]!==i||e[48]!==g||e[49]!==j||e[50]!==s||e[51]!==N||e[52]!==w||e[53]!==V?(C=o.jsx(z.Suspense,{fallback:c,children:d==="tools"?o.jsx(Be,{tools:r.tools??void 0,connectionId:n,org:s}):d==="prompts"?o.jsx(ke,{prompts:N,connectionId:n,org:s}):d==="resources"?o.jsx(Oe,{resources:V,connectionId:n,org:s}):d==="settings"?o.jsx(pe,{connection:r,onUpdate:j,isUpdating:g,isMCPAuthenticated:i,supportsOAuth:l.supportsOAuth,hasOAuthToken:l.hasOAuthToken,isServerError:l.isServerError,onViewReadme:m?()=>A("readme"):void 0}):d==="readme"&&m?o.jsx(Re,{repository:w}):$&&i?o.jsx(ye,{connectionId:n,org:s,activeCollection:$},d):o.jsx(F,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[38]=$,e[39]=d,e[40]=l.hasOAuthToken,e[41]=l.isServerError,e[42]=l.supportsOAuth,e[43]=r,e[44]=n,e[45]=A,e[46]=m,e[47]=i,e[48]=g,e[49]=j,e[50]=s,e[51]=N,e[52]=w,e[53]=V,e[54]=C):C=e[54];let v;e[55]!==d||e[56]!==C?(v=o.jsx("div",{className:"flex h-full w-full bg-background overflow-hidden",children:o.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-auto",children:o.jsx(X,{children:C},d)})}),e[55]=d,e[56]=C,e[57]=v):v=e[57];let x;return e[58]!==I||e[59]!==k||e[60]!==v?(x=o.jsxs(je,{onBack:I,children:[k,v]}),e[58]=I,e[59]=k,e[60]=v,e[61]=x):x=e[61],x}function Ke(t){return{id:t.name,label:t.displayName}}function ze(){const t=q.c(29);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/mcps/$connectionId"},t[0]=e):e=t[0];const r=W(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId"},t[1]=n):n=t[1];const{connectionId:s,org:a}=ce(n);let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f={from:"/shell/$org/mcps/$connectionId"},t[2]=f):f=t[2];const g=ae(f).tab||"settings",N=G(s),V=me(),L=de(N??void 0);let p;t[3]!==s?(p=[s],t[3]=s,t[4]=p):p=t[4];const{promptsMap:U}=fe(p);let y;t[5]!==s?(y=[s],t[5]=s,t[6]=y):y=t[6];const{resourcesMap:l}=he(y);let i;t[7]!==s||t[8]!==U?(i=U.get(s)??[],t[7]=s,t[8]=U,t[9]=i):i=t[9];const w=i;let m;t[10]!==s||t[11]!==l?(m=l.get(s)??[],t[10]=s,t[11]=l,t[12]=m):m=t[12];const h=m;let R;t[13]!==V.update||t[14]!==s?(R=async b=>{await V.update.mutateAsync({id:s,data:b})},t[13]=V.update,t[14]=s,t[15]=R):R=t[15];const u=R;if(!N){let b;return t[16]!==r||t[17]!==a?(b=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(F,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:o.jsx(xe,{variant:"outline",onClick:()=>r({to:"/$org/mcps",params:{org:a}}),children:"Back to connections"})})}),t[16]=r,t[17]=a,t[18]=b):b=t[18],b}let _;return t[19]!==V.update.isPending||t[20]!==L||t[21]!==N||t[22]!==s||t[23]!==u||t[24]!==a||t[25]!==w||t[26]!==g||t[27]!==h?(_=o.jsx(Ue,{org:a,connection:N,connectionId:s,requestedTabId:g,collections:L,onUpdate:u,isUpdating:V.update.isPending,prompts:w,resources:h}),t[19]=V.update.isPending,t[20]=L,t[21]=N,t[22]=s,t[23]=u,t[24]=a,t[25]=w,t[26]=g,t[27]=h,t[28]=_):_=t[28],_}function qe(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(X,{children:o.jsx(z.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:o.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(ze,{})})}),t[0]=e):e=t[0],e}function fo(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(qe,{}),t[0]=e):e=t[0],e}export{fo as default};
@@ -1 +0,0 @@
1
- import{aJ as a,bo as o}from"./index-Diww4UW3.js";const e="mcp.mesh",s=a(o,{target:"draft-7"});export{s as B,e as M};
@@ -1 +0,0 @@
1
- import{r as S,_ as ye,y as re,I as U,z as w,c as R,j as t,f as Fe,d as tt,b as st,k as ot,af as lt,B as nt,E as it,t as Ae}from"./index-Diww4UW3.js";import{I as Ee,E as rt}from"./empty-state-wP9uukGJ.js";import{E as Ve}from"./error-boundary-BUvK8Sry.js";import{C as Ge}from"./checkbox-DYViXeUc.js";import{c as H,B as V}from"./button-CGmrzkpY.js";import{i as at}from"./ArrowLeft-B3km7toT.js";import{u as We}from"./use-connection-CCXutWLD.js";import{C as ct}from"./collection-search-BVb42O45.js";import{I as Pe}from"./input-CrURMEZe.js";import{s as dt}from"./Plus-CdG75X26.js";import{i as mt}from"./X-C18ho617.js";import{P as ut}from"./pin-to-sidebar-button-DIwkO0Tx.js";import{T as ft}from"./tool-set-selector-B9rTBahU.js";import{b as ht,a as xt,i as pt}from"./use-gateway-DD-xEZju.js";import{u as gt,a as bt}from"./use-connection-resources-D0st76bP.js";import{u as jt,a as yt}from"./use-gateway-system-prompt-zGJSEzce.js";import{s as He}from"./slugify-CEUa2lfQ.js";import{B as qe}from"./badge-BVO6I0sW.js";import{a as vt,D as St,c as Nt,d as _t}from"./dialog-DJJ2cvEE.js";import{F as be,a as wt,b as ve,d as Se,f as Ne,c as Ct}from"./form-DiGzBnRK.js";import{I as kt,R as It,a as Tt}from"./index-DUA-vRuy.js";import{R as $t}from"./resource-tabs-ACbF96qo.js";import{S as Rt,a as zt,b as At,c as Et,d as Ue}from"./select-C8LOz7vA.js";import{S as Pt}from"./switch-DJBd8Fzb.js";import{T as Mt}from"./textarea-C_zgj3Sp.js";import{a as Z,c as Y,b as J,T as Q}from"./tooltip-Suu_Gpqh.js";import{i as Ze}from"./Check-BQkm1TiP.js";import{i as Dt}from"./Code01-qXTn9GK9.js";import{a as Ut}from"./Copy01-CEYn2daS.js";import{i as Lt}from"./FlipBackward-C-K9FamE.js";import{i as je}from"./InfoCircle-BgIkbjJr.js";import{i as ze}from"./Loading01-Ae5ezbtD.js";import{a as Ot,V as Bt,b as Ft}from"./layout-kp8TTJc9.js";import"./connection-ChwHK0-S.js";import"./project-context-provider-DulCVL2k.js";import"./use-collections-CXETocKO.js";import"./useMutation-Dl1MMkEC.js";import"./SearchMd-GFaonOaJ.js";import"./use-organization-settings-CQXtXtZs.js";import"./localstorage-keys-BVANkONM.js";import"./useQuery-Bvk0U2ed.js";import"./ChevronDown-DP6jvip7.js";const Ye=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Ye.displayName="ArrowsRight";const Je=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.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"}));Je.displayName="Circle";const Qe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));Qe.displayName="Lightbulb02";const Ke=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M7 3v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C7.76 8 8.04 8 8.6 8h6.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C17 7.24 17 6.96 17 6.4V4m0 17v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Ke.displayName="Save01";const Xe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m8.59 13.51 6.83 3.98m-.01-10.98-6.82 3.98M21 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm12 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}));Xe.displayName="Share07";const Me=ye(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),Vt=re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:U(w()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:U(w()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),Gt=re({id:w().describe("Unique identifier for the gateway"),title:w().describe("Human-readable name for the gateway"),description:w().nullable().describe("Description of the gateway"),icon:w().nullable().optional().describe("Icon URL for the gateway"),created_at:w().describe("When the gateway was created"),updated_at:w().describe("When the gateway was last updated"),created_by:w().describe("User ID who created the gateway"),updated_by:w().optional().describe("User ID who last updated the gateway"),organization_id:w().describe("Organization ID this gateway belongs to"),tool_selection_mode:Me.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:ye(["active","inactive"]).describe("Current status"),connections:U(Vt).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")});re({title:w().min(1).max(255).describe("Name for the gateway"),description:w().nullable().optional().describe("Optional description"),tool_selection_mode:Me.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:w().nullable().optional().describe("Optional icon URL"),status:ye(["active","inactive"]).optional().default("active").describe("Initial status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")});re({title:w().min(1).max(255).optional().describe("New name"),description:w().nullable().optional().describe("New description (null to clear)"),tool_selection_mode:Me.optional().describe("New tool selection mode"),icon:w().nullable().optional().describe("New icon URL (null to clear)"),status:ye(["active","inactive"]).optional().describe("New status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")});const Wt=S.memo(function(e){const s=R.c(20),{connection:l,isSelected:i,hasItemsEnabled:n,activeItemsCount:a,totalItemsCount:m,onSelect:c,onToggle:r}=e,d=i?"bg-accent/50":"hover:bg-muted/50";let u;s[0]!==d?(u=H("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",d),s[0]=d,s[1]=u):u=s[1];let f;s[2]!==l.icon||s[3]!==l.title?(f=t.jsx(Ee,{icon:l.icon,name:l.title,size:"xs"}),s[2]=l.icon,s[3]=l.title,s[4]=f):f=s[4];let b;s[5]!==l.title?(b=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),s[5]=l.title,s[6]=b):b=s[6];let x;s[7]!==c||s[8]!==f||s[9]!==b?(x=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:c,children:[f,b]}),s[7]=c,s[8]=f,s[9]=b,s[10]=x):x=s[10];let p;s[11]!==a||s[12]!==n||s[13]!==r||s[14]!==m?(p=m>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[a,"/",m]}),t.jsx(Ge,{checked:n,onCheckedChange:r,onClick:qt})]}),s[11]=a,s[12]=n,s[13]=r,s[14]=m,s[15]=p):p=s[15];let y;return s[16]!==u||s[17]!==x||s[18]!==p?(y=t.jsxs("div",{className:u,children:[x,p]}),s[16]=u,s[17]=x,s[18]=p,s[19]=y):y=s[19],y}),Ht=S.memo(function(e){const s=R.c(18),{connectionId:l,item:i,isSelected:n,onToggle:a}=e,m=`item-${l}-${i.id}`,c=n?"text-foreground":"text-muted-foreground";let r;s[0]!==c?(r=H("text-sm font-medium",c),s[0]=c,s[1]=r):r=s[1];let d;s[2]!==i.name||s[3]!==r?(d=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:r,children:i.name})}),s[2]=i.name,s[3]=r,s[4]=d):d=s[4];let u;s[5]!==i.description?(u=i.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:i.description}),s[5]=i.description,s[6]=u):u=s[6];let f;s[7]!==d||s[8]!==u?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),s[7]=d,s[8]=u,s[9]=f):f=s[9];const b=`item-${l}-${i.id}`;let x;s[10]!==n||s[11]!==a||s[12]!==b?(x=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(Ge,{id:b,checked:n,onCheckedChange:a,onClick:Zt})}),s[10]=n,s[11]=a,s[12]=b,s[13]=x):x=s[13];let p;return s[14]!==m||s[15]!==f||s[16]!==x?(p=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:m,children:[f,x]}),s[14]=m,s[15]=f,s[16]=x,s[17]=p):p=s[17],p});function et({itemSet:o,onItemSetChange:e,getItems:s,itemLabel:l,emptyItemsMessage:i,extraContent:n}){const[a,m]=S.useState(""),c=S.useDeferredValue(a),[r,d]=S.useState("all"),[u,f]=S.useState(!1),b=S.useRef(new Set(Object.keys(o))),x=We({searchTerm:c.trim()||void 0}),p=b.current,y=[...p.values()].map(h=>x.find(N=>N.id===h)).filter(h=>h!==void 0),j=x.filter(h=>!p.has(h.id)),v=[...y,...j],g=h=>{const N=o[h];return N!==void 0&&N.length>0},_=v.filter(h=>{if(r==="all")return!0;const N=g(h.id);return r==="selected"?N:r==="unselected"?!N:!0}),[C,I]=S.useState(v[0]?.id??null),k=C?v.find(h=>h.id===C)??null:null,P=k?s(k):[],E=(h,N)=>o[h]?.includes(N)??!1,L=(h,N)=>{const z=o[h]??[],$=z.includes(N),G={...o};if($){const W=z.filter(q=>q!==N);W.length===0?delete G[h]:G[h]=W}else G[h]=[...z,N];e(G)},B=h=>{const N=v.find(F=>F.id===h);if(!N)return;const z=s(N);if(z.length===0)return;const $=o[h]??[],G=z.map(F=>F.id),W=$.length>0&&G.every(F=>$.includes(F)),q={...o};W?delete q[h]:(q[h]=G,I(h)),e(q)},A=h=>{I(h),f(!0)},M=()=>{f(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:H("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[t.jsx(ct,{value:a,onChange:m,placeholder:"Search Connections..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>d("all"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>d("selected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>d("unselected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:_.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:a?"No connections found":r==="selected"?"No servers selected":r==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:_.map(h=>{const z=s(h).length,$=o[h.id]?.length??0;return t.jsx(Wt,{connection:h,isSelected:C===h.id,hasItemsEnabled:g(h.id),activeItemsCount:$,totalItemsCount:z,onSelect:()=>A(h.id),onToggle:()=>B(h.id)},h.id)})})})]}),t.jsx("div",{className:H("flex-1 flex-col",u?"flex":"hidden md:flex"),children:k?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(V,{variant:"ghost",size:"sm",onClick:M,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(at,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(Ee,{icon:k.icon,name:k.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:k.title}),k.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:k.description})]})]})]}),n,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:i||`This connection has no ${l} available`}):t.jsx("div",{className:"space-y-2",children:P.map(h=>t.jsx(Ht,{connectionId:k.id,item:h,isSelected:E(k.id,h.id),onToggle:()=>L(k.id,h.id)},h.id))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Select a connection to view its ",l]})})})]})}function qt(o){return o.stopPropagation()}function Zt(o){return o.stopPropagation()}function Yt(o){const e=R.c(6),{promptSet:s,onPromptSetChange:l,connectionPrompts:i}=o;let n;e[0]!==i?(n=c=>(i.get(c.id)??[]).map(Jt),e[0]=i,e[1]=n):n=e[1];const a=n;let m;return e[2]!==a||e[3]!==l||e[4]!==s?(m=t.jsx(et,{itemSet:s,onItemSetChange:l,getItems:a,itemLabel:"prompts",emptyItemsMessage:"This connection has no prompts available"}),e[2]=a,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}function Jt(o){return{id:o.name,name:o.name,description:o.description}}function Qt(o){return o.includes("*")}function Kt(o){const e=R.c(27),{patterns:s,onAddPattern:l,onRemovePattern:i}=o,[n,a]=S.useState("");let m;e[0]!==n||e[1]!==l||e[2]!==s?(m=()=>{const f=n.trim();f&&!s.includes(f)&&(l(f),a(""))},e[0]=n,e[1]=l,e[2]=s,e[3]=m):m=e[3];const c=m;let r;e[4]!==c?(r=f=>{f.key==="Enter"&&(f.preventDefault(),c())},e[4]=c,e[5]=r):r=e[5];const d=r;let u;if(e[6]!==c||e[7]!==d||e[8]!==n||e[9]!==i||e[10]!==s){const f=s.filter(Qt);let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("code",{children:"*"}),e[12]=b):b=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("div",{className:"text-xs text-muted-foreground",children:["Add URI patterns to match multiple resources. Use ",b," for single segment and ",t.jsx("code",{children:"**"})," for multiple segments."]}),e[13]=x):x=e[13];let p;e[14]===Symbol.for("react.memo_cache_sentinel")?(p=I=>a(I.target.value),e[14]=p):p=e[14];let y;e[15]!==d||e[16]!==n?(y=t.jsx(Pe,{value:n,onChange:p,onKeyDown:d,placeholder:"e.g., file:///**/*.ts or db://users/*",className:"flex-1 text-sm"}),e[15]=d,e[16]=n,e[17]=y):y=e[17];let j;e[18]!==n?(j=n.trim(),e[18]=n,e[19]=j):j=e[19];const v=!j;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(dt,{size:16}),e[20]=g):g=e[20];let _;e[21]!==c||e[22]!==v?(_=t.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:v,children:g}),e[21]=c,e[22]=v,e[23]=_):_=e[23];let C;e[24]!==_||e[25]!==y?(C=t.jsxs("div",{className:"flex gap-2",children:[y,_]}),e[24]=_,e[25]=y,e[26]=C):C=e[26],u=t.jsxs("div",{className:"border-b border-border p-4 space-y-3",children:[x,C,f.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(I=>t.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-muted rounded-md text-xs",children:[t.jsx("code",{className:"text-foreground",children:I}),t.jsx("button",{type:"button",onClick:()=>i(I),className:"text-muted-foreground hover:text-foreground",children:t.jsx(mt,{size:12})})]},I))})]}),e[6]=c,e[7]=d,e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];return u}function Xt(o){const e=R.c(23),{resourceSet:s,onResourceSetChange:l,connectionResources:i}=o,[n]=S.useState(null);let a;e[0]!==i?(a=g=>(i.get(g.id)??[]).map(es),e[0]=i,e[1]=a):a=e[1];const m=a;let c;e[2]!==l||e[3]!==s?(c=(g,_)=>{const C=s[g]??[];C.includes(_)||l({...s,[g]:[...C,_]})},e[2]=l,e[3]=s,e[4]=c):c=e[4];const r=c;let d;e[5]!==l||e[6]!==s?(d=(g,_)=>{const I=(s[g]??[]).filter(k=>k!==_);if(I.length===0){const k={...s};delete k[g],l(k)}else l({...s,[g]:I})},e[5]=l,e[6]=s,e[7]=d):d=e[7];const u=d;let f;e[8]!==l?(f=g=>{l(g)},e[8]=l,e[9]=f):f=e[9];const b=f;let x;e[10]!==s||e[11]!==n?(x=n?s[n]??[]:[],e[10]=s,e[11]=n,e[12]=x):x=e[12];const p=x;let y;e[13]!==r||e[14]!==u||e[15]!==n||e[16]!==p?(y=n?t.jsx(Kt,{patterns:p,onAddPattern:g=>r(n,g),onRemovePattern:g=>u(n,g)}):null,e[13]=r,e[14]=u,e[15]=n,e[16]=p,e[17]=y):y=e[17];const j=y;let v;return e[18]!==j||e[19]!==m||e[20]!==b||e[21]!==s?(v=t.jsx("div",{className:"h-full",children:t.jsx(et,{itemSet:s,onItemSetChange:b,getItems:m,itemLabel:"resources",emptyItemsMessage:"This connection has no resources available",extraContent:j})}),e[18]=j,e[19]=m,e[20]=b,e[21]=s,e[22]=v):v=e[22],v}function es(o){return{id:o.uri,name:o.name||o.uri,description:o.description||o.uri}}function ts(o){const e=R.c(8);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("grid gap-3",s),e[3]=s,e[4]=i):i=e[4];let n;return e[5]!==l||e[6]!==i?(n=t.jsx(It,{"data-slot":"radio-group",className:i,...l}),e[5]=l,e[6]=i,e[7]=n):n=e[7],n}function Re(o){const e=R.c(9);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=i):i=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(Tt,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(Je,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=n):n=e[5];let a;return e[6]!==l||e[7]!==i?(a=t.jsx(kt,{"data-slot":"radio-group-item",className:i,...l,children:n}),e[6]=l,e[7]=i,e[8]=a):a=e[8],a}function ss(o){const s=new TextEncoder().encode(o),l=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(l)}const os=Gt.pick({title:!0,description:!0,status:!0,tool_selection_mode:!0}).extend({title:w().min(1,"Name is required").max(255)});function Le(o,e){const s={};for(const l of o.connections)if(l.selected_tools===null){const i=e.get(l.connection_id)??[];i.length>0&&(s[l.connection_id]=i)}else l.selected_tools.length>0&&(s[l.connection_id]=l.selected_tools);return s}function Oe(o){const e={};for(const s of o.connections)s.selected_resources!==null&&s.selected_resources!==void 0&&s.selected_resources.length>0&&(e[s.connection_id]=s.selected_resources);return e}function Be(o){const e={};for(const s of o.connections)s.selected_prompts!==null&&s.selected_prompts!==void 0&&s.selected_prompts.length>0&&(e[s.connection_id]=s.selected_prompts);return e}function ls(o,e,s,l){const i=new Set([...Object.keys(o),...Object.keys(e),...Object.keys(s)]);return Array.from(i).map(n=>{const a=o[n]??[],m=l.get(n)??[],c=m.length>0&&m.every(r=>a.includes(r));return{connection_id:n,selected_tools:a.length===0||c?null:a,selected_resources:e[n]??null,selected_prompts:s[n]??null}})}function ns(o){const e=R.c(10),{gatewayUrl:s}=o,[l,i]=S.useState(!1);let n;e[0]!==s?(n=async()=>{await navigator.clipboard.writeText(s),i(!0),Ae.success("Agent URL copied to clipboard"),setTimeout(()=>i(!1),2e3)},e[0]=s,e[1]=n):n=e[1];const a=n;let m;e[2]!==l?(m=l?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx(Ut,{size:20}),e[2]=l,e[3]=m):m=e[3];const c=l?"Copied!":"Copy URL";let r;e[4]!==c?(r=t.jsx("span",{className:"text-xs font-medium",children:c}),e[4]=c,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==m||e[8]!==r?(d=t.jsxs(V,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,r]}),e[6]=a,e[7]=m,e[8]=r,e[9]=d):d=e[9],d}function is(o){const e=R.c(7),{gatewayUrl:s,serverName:l}=o;let i;e[0]!==s||e[1]!==l?(i=()=>{const r=He(l),u=ss(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),f=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(r)}&config=${encodeURIComponent(u)}`;window.open(f,"_blank"),Ae.success("Opening Cursor...")},e[0]=s,e[1]=l,e[2]=i):i=e[2];const n=i;let a,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),m=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=a,e[4]=m):(a=e[3],m=e[4]);let c;return e[5]!==n?(c=t.jsxs(V,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,m]}),e[5]=n,e[6]=c):c=e[6],c}function rs(o){const e=R.c(11),{gatewayUrl:s,serverName:l}=o,[i,n]=S.useState(!1);let a;e[0]!==s||e[1]!==l?(a=async()=>{const f=He(l),x=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}}),p=`claude mcp add-json ${f} '${x.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(p),n(!0),Ae.success("Claude Code command copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=s,e[1]=l,e[2]=a):a=e[2];const m=a;let c;e[3]!==i?(c=i?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=i,e[4]=c):c=e[4];const r=i?"Copied!":"Install on Claude";let d;e[5]!==r?(d=t.jsx("span",{className:"text-xs font-medium",children:r}),e[5]=r,e[6]=d):d=e[6];let u;return e[7]!==m||e[8]!==c||e[9]!==d?(u=t.jsxs(V,{type:"button",variant:"outline",onClick:m,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[7]=m,e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function as(o){const e=R.c(40),{open:s,onOpenChange:l,gateway:i}=o,[n,a]=S.useState("code_execution");let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=$=>{($==="passthrough"||$==="smart_tool_selection"||$==="code_execution")&&a($)},e[0]=m):m=e[0];const c=m;let r;e[1]!==i.id||e[2]!==n?(r=new URL(`/mcp/gateway/${i.id}`,window.location.origin),r.searchParams.set("mode",n),e[1]=i.id,e[2]=n,e[3]=r):r=e[3];let d;e[4]!==i.id||e[5]!==i.title?(d=i.title||`agent-${i.id.slice(0,8)}`,e[4]=i.id,e[5]=i.title,e[6]=d):d=e[6];const u=d;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(vt,{children:t.jsx(St,{children:"Share Agent"})}),e[7]=f):f=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Ye,{className:"size-5 text-muted-foreground"})}),e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=p):p=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[11]=y):y=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[x,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[p,t.jsx(Z,{children:t.jsxs(Y,{children:[y,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Re,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Qe,{className:"size-5 text-muted-foreground"})}),e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=g):g=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[15]=_):_=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[v,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[g,t.jsx(Z,{children:t.jsxs(Y,{children:[_,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Re,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=C):C=e[16];let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Dt,{className:"size-5 text-muted-foreground"})}),e[17]=I):I=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=k):k=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[19]=P):P=e[19];let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[I,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[k,t.jsx(Z,{children:t.jsxs(Y,{children:[P,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Re,{id:"mode-code",value:"code_execution"}),t.jsx(qe,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=E):E=e[20];let L;e[21]!==n?(L=t.jsxs("div",{className:"flex flex-col gap-3",children:[b,t.jsxs(ts,{value:n,onValueChange:c,className:"flex flex-col gap-4.5",children:[j,C,E]})]}),e[21]=n,e[22]=L):L=e[22];let B;e[23]!==r.href?(B=t.jsx(ns,{gatewayUrl:r.href}),e[23]=r.href,e[24]=B):B=e[24];let A,M;e[25]!==r.href||e[26]!==u?(A=t.jsx(is,{gatewayUrl:r.href,serverName:u}),M=t.jsx(rs,{gatewayUrl:r.href,serverName:u}),e[25]=r.href,e[26]=u,e[27]=A,e[28]=M):(A=e[27],M=e[28]);let h;e[29]!==B||e[30]!==A||e[31]!==M?(h=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[B,A,M]})}),e[29]=B,e[30]=A,e[31]=M,e[32]=h):h=e[32];let N;e[33]!==L||e[34]!==h?(N=t.jsxs(Nt,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[f,t.jsxs("div",{className:"flex flex-col gap-6",children:[L,h]})]}),e[33]=L,e[34]=h,e[35]=N):N=e[35];let z;return e[36]!==l||e[37]!==s||e[38]!==N?(z=t.jsx(_t,{open:s,onOpenChange:l,children:N}),e[36]=l,e[37]=s,e[38]=N,e[39]=z):z=e[39],z}function cs(o){const e=R.c(32),{form:s,icon:l,gatewayId:i}=o,[n]=jt(),[a,m]=yt(i);let c;e[0]!==s?(c=s.watch("title")||"Agent",e[0]=s,e[1]=c):c=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(pt,{}),e[2]=r):r=e[2];let d;e[3]!==l||e[4]!==c?(d=t.jsx(Ee,{icon:l,name:c,size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:r}),e[3]=l,e[4]=c,e[5]=d):d=e[5];let u;e[6]!==s.control?(u=t.jsx(be,{control:s.control,name:"status",render:fs}),e[6]=s.control,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=t.jsxs("div",{className:"flex items-start justify-between",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let b;e[11]!==s.control?(b=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(be,{control:s.control,name:"title",render:us}),t.jsx(be,{control:s.control,name:"description",render:ms})]}),e[11]=s.control,e[12]=b):b=e[12];let x;e[13]!==f||e[14]!==b?(x=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[f,b]}),e[13]=f,e[14]=b,e[15]=x):x=e[15];let p;e[16]!==n||e[17]!==s.control?(p=n&&t.jsx("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:t.jsx(be,{control:s.control,name:"tool_selection_mode",render:ds})}),e[16]=n,e[17]=s.control,e[18]=p):p=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-foreground mb-1",children:"System Prompt"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored locally for now"})]}),e[19]=y):y=e[19];let j;e[20]!==m?(j=C=>m(C.target.value),e[20]=m,e[21]=j):j=e[21];let v;e[22]!==a||e[23]!==j?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[y,t.jsx(Mt,{value:a,onChange:j,placeholder:"Enter system prompt instructions...",className:"min-h-[240px] resize-none text-sm leading-relaxed"})]}),e[22]=a,e[23]=j,e[24]=v):v=e[24];let g;e[25]!==v||e[26]!==x||e[27]!==p?(g=t.jsxs("div",{className:"flex flex-col",children:[x,p,v]}),e[25]=v,e[26]=x,e[27]=p,e[28]=g):g=e[28];let _;return e[29]!==s||e[30]!==g?(_=t.jsx("div",{className:"flex flex-col h-full overflow-auto",children:t.jsx(wt,{...s,children:g})}),e[29]=s,e[30]=g,e[31]=_):_=e[31],_}function ds(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(Ct,{className:"mb-0",children:"Selection Mode"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Z,{children:t.jsxs(Y,{children:[t.jsx(J,{asChild:!0,children:t.jsx(V,{type:"button",variant:"ghost",size:"icon",className:"size-7","aria-label":"Selection mode help",children:t.jsx(je,{size:14,className:"text-muted-foreground"})})}),t.jsx(Q,{side:"left",className:"max-w-sm",children:t.jsxs("div",{className:"text-xs space-y-1",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Include:"})," Only selected items are exposed."]}),t.jsxs("div",{children:[t.jsx("strong",{children:"Exclude:"})," All items except selected ones are exposed."]})]})})]})}),t.jsxs(Rt,{value:e.value,onValueChange:e.onChange,children:[t.jsx(Se,{children:t.jsx(zt,{className:"w-[180px]",children:t.jsx(At,{})})}),t.jsxs(Et,{children:[t.jsx(Ue,{value:"inclusion",children:"Include Selected"}),t.jsx(Ue,{value:"exclusion",children:"Exclude Selected"})]})]})]})]}),t.jsx(Ne,{})]})}function ms(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,value:e.value||"",className:"h-auto text-base text-muted-foreground leading-6 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Ne,{})]})}function us(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,className:"h-auto text-lg! font-medium leading-7 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Agent Name"})}),t.jsx(Ne,{})]})}function fs(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qe,{variant:e.value==="active"?"success":"outline",children:e.value==="active"?"Active":"Inactive"}),t.jsx(Se,{children:t.jsx(Pt,{checked:e.value==="active",onCheckedChange:s=>e.onChange(s?"active":"inactive")})})]}),t.jsx(Ne,{})]})}function hs(o){const e=R.c(81),{gateway:s,gatewayId:l,requestedTabId:i}=o,a=ot().location.href,m=lt();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={from:"/$org/gateways/$gatewayId"},e[0]=c):c=e[0];const r=Fe(c),d=xt();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const f=We(u);let b;e[2]!==f?(b=f.map(ps),e[2]=f,e[3]=b):b=e[3];const x=b,{promptsMap:p}=gt(x),{resourcesMap:y}=bt(x);let j;if(e[4]!==f){j=new Map;for(const T of f)T.tools&&T.tools.length>0&&j.set(T.id,T.tools.map(xs));e[4]=f,e[5]=j}else j=e[5];let v;e[6]!==j||e[7]!==s?(v=()=>Le(s,j),e[6]=j,e[7]=s,e[8]=v):v=e[8];const[g,_]=S.useState(v);let C;e[9]!==s?(C=()=>Oe(s),e[9]=s,e[10]=C):C=e[10];const[I,k]=S.useState(C);let P;e[11]!==s?(P=()=>Be(s),e[11]=s,e[12]=P):P=e[12];const[E,L]=S.useState(P),[B,A]=S.useState(!1),[M,h]=S.useState(!1);let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=T=>{_(T),A(!0)},e[13]=N):N=e[13];const z=N;let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=T=>{k(T),A(!0)},e[14]=$):$=e[14];const G=$;let W;e[15]===Symbol.for("react.memo_cache_sentinel")?(W=T=>{L(T),A(!0)},e[15]=W):W=e[15];const q=W;let F;e[16]===Symbol.for("react.memo_cache_sentinel")?(F=nt(os),e[16]=F):F=e[16];const _e=s.tool_selection_mode??"inclusion";let ce;e[17]!==s.description||e[18]!==s.status||e[19]!==s.title||e[20]!==_e?(ce={resolver:F,defaultValues:{title:s.title,description:s.description,status:s.status,tool_selection_mode:_e}},e[17]=s.description,e[18]=s.status,e[19]=s.title,e[20]=_e,e[21]=ce):ce=e[21];const O=it(ce),we=O.formState.isDirty||B;let de;e[22]!==d.update||e[23]!==j||e[24]!==O||e[25]!==l||e[26]!==E||e[27]!==I||e[28]!==g?(de=async()=>{const T=O.getValues(),$e=ls(g,I,E,j);await d.update.mutateAsync({id:l,data:{title:T.title,description:T.description,status:T.status,tool_selection_mode:T.tool_selection_mode,connections:$e}}),O.reset(T),A(!1)},e[22]=d.update,e[23]=j,e[24]=O,e[25]=l,e[26]=E,e[27]=I,e[28]=g,e[29]=de):de=e[29];const Ce=de;let me;e[30]!==j||e[31]!==O||e[32]!==s?(me=()=>{O.reset({title:s.title,description:s.description,status:s.status,tool_selection_mode:s.tool_selection_mode??"inclusion"}),_(Le(s,j)),k(Oe(s)),L(Be(s)),A(!1)},e[30]=j,e[31]=O,e[32]=s,e[33]=me):me=e[33];const ke=me;let ue;e[34]===Symbol.for("react.memo_cache_sentinel")?(ue=[{id:"settings",label:"Settings"},{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[34]=ue):ue=e[34];const De=ue,D=De.some(T=>T.id===i)?i:"settings";let fe;e[35]!==r?(fe=T=>{r({search:$e=>({...$e,tab:T}),replace:!0})},e[35]=r,e[36]=fe):fe=e[36];const Ie=fe,ae=d.update.isPending;let K;e[37]!==m.history?(K=()=>m.history.back(),e[37]=m.history,e[38]=K):K=e[38];let X;e[39]!==D||e[40]!==Ie?(X=t.jsx(Ot,{children:t.jsx($t,{tabs:De,activeTab:D,onTabChange:Ie})}),e[39]=D,e[40]=Ie,e[41]=X):X=e[41];let ee;e[42]!==ke||e[43]!==Ce||e[44]!==we||e[45]!==ae?(ee=we&&t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:ke,"aria-label":"Cancel",children:t.jsx(Lt,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Cancel"})]})}),t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:Ce,"aria-label":"Save",children:ae?t.jsx(ze,{size:14,className:"animate-spin"}):t.jsx(Ke,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Save"})]})})]}),e[42]=ke,e[43]=Ce,e[44]=we,e[45]=ae,e[46]=ee):ee=e[46];let he;e[47]===Symbol.for("react.memo_cache_sentinel")?(he=()=>h(!0),e[47]=he):he=e[47];let xe;e[48]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:he,"aria-label":"Share",children:t.jsx(Xe,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Share"})]})}),e[48]=xe):xe=e[48];const Te=s.icon??"cpu_chip";let te;e[49]!==s.title||e[50]!==Te||e[51]!==a?(te=t.jsx(ut,{title:s.title,url:a,icon:Te}),e[49]=s.title,e[50]=Te,e[51]=a,e[52]=te):te=e[52];let se;e[53]!==ee||e[54]!==te?(se=t.jsxs(Bt,{children:[ee,xe,te]}),e[53]=ee,e[54]=te,e[55]=se):se=e[55];let pe;e[56]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),e[56]=pe):pe=e[56];let oe;e[57]!==D||e[58]!==p||e[59]!==y||e[60]!==O||e[61]!==s.icon||e[62]!==l||e[63]!==E||e[64]!==I||e[65]!==g?(oe=D==="settings"?t.jsx(cs,{form:O,icon:s.icon,gatewayId:l}):D==="tools"?t.jsx(ft,{toolSet:g,onToolSetChange:z}):D==="resources"?t.jsx(Xt,{resourceSet:I,onResourceSetChange:G,connectionResources:y}):D==="prompts"?t.jsx(Yt,{promptSet:E,onPromptSetChange:q,connectionPrompts:p}):null,e[57]=D,e[58]=p,e[59]=y,e[60]=O,e[61]=s.icon,e[62]=l,e[63]=E,e[64]=I,e[65]=g,e[66]=oe):oe=e[66];let le;e[67]!==oe?(le=t.jsx(S.Suspense,{fallback:pe,children:oe}),e[67]=oe,e[68]=le):le=e[68];let ne;e[69]!==D||e[70]!==le?(ne=t.jsx("div",{className:"flex h-full w-full bg-background overflow-hidden",children:t.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(Ve,{children:le},D)})})}),e[69]=D,e[70]=le,e[71]=ne):ne=e[71];let ie;e[72]!==s||e[73]!==M?(ie=t.jsx(as,{open:M,onOpenChange:h,gateway:s}),e[72]=s,e[73]=M,e[74]=ie):ie=e[74];let ge;return e[75]!==K||e[76]!==X||e[77]!==se||e[78]!==ne||e[79]!==ie?(ge=t.jsxs(Ft,{onBack:K,children:[X,se,ne,ie]}),e[75]=K,e[76]=X,e[77]=se,e[78]=ne,e[79]=ie,e[80]=ge):ge=e[80],ge}function xs(o){return o.name}function ps(o){return o.id}function gs(){const o=R.c(10);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/gateways/$gatewayId"},o[0]=e):e=o[0];const s=Fe(e);let l;o[1]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org/gateways/$gatewayId"},o[1]=l):l=o[1];const{gatewayId:i,org:n}=tt(l);let a;o[2]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/gateways/$gatewayId"},o[2]=a):a=o[2];const c=st(a).tab||"settings",r=ht(i);if(!r){let u;return o[3]!==s||o[4]!==n?(u=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(rt,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>s({to:"/$org/gateways",params:{org:n}}),children:"Back to agents"})})}),o[3]=s,o[4]=n,o[5]=u):u=o[5],u}let d;return o[6]!==r||o[7]!==i||o[8]!==c?(d=t.jsx(hs,{gateway:r,gatewayId:i,requestedTabId:c}),o[6]=r,o[7]=i,o[8]=c,o[9]=d):d=o[9],d}function bs(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ve,{children:t.jsx(S.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(gs,{})})}),o[0]=e):e=o[0],e}function ao(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(bs,{}),o[0]=e):e=o[0],e}export{ao as default};
@@ -1 +0,0 @@
1
- import{c as ee,j as t,r as te,f as oe}from"./index-Diww4UW3.js";import{C as re}from"./collection-header-B4qcjEt5.js";import{C as ie}from"./collection-page-s-RR5fU6.js";import{C as ne}from"./collection-search-BVb42O45.js";import{C as ae}from"./collection-table-wrapper-BohFZqii.js";import{C as le}from"./connection-card-DMMfNQUo.js";import{E as W,I as ce}from"./empty-state-wP9uukGJ.js";import{E as de}from"./error-boundary-BUvK8Sry.js";import{u as me,a as ue,i as x}from"./use-gateway-DD-xEZju.js";import{u as pe,s as J}from"./use-list-state-AndcW8aD.js";import{u as ge}from"./use-create-gateway-BlLsktgc.js";import{u as he}from"./project-context-provider-DulCVL2k.js";import{c as fe,b as xe,d as je,A as Ce,e as we,g as ye,a as Ne,f as De}from"./alert-dialog-CCJCsKzK.js";import{B as se}from"./badge-BVO6I0sW.js";import{B as q}from"./button-CGmrzkpY.js";import{b as Q,D as U,a as X,c as O}from"./dropdown-menu-CAeD2aIb.js";import{i as Y}from"./DotsVertical-BPP4U4GQ.js";import{i as Se}from"./Loading01-Ae5ezbtD.js";import{s as Z}from"./Trash01-BWIN9RL_.js";import"./collection-display-button-CtkxsCB_.js";import"./ArrowUp-BF7mM4C2.js";import"./Check-BQkm1TiP.js";import"./Grid01-D4lXvveX.js";import"./List-BsSZz32j.js";import"./tooltip-Suu_Gpqh.js";import"./view-mode-toggle-BLClM-0g.js";import"./SearchMd-GFaonOaJ.js";import"./input-CrURMEZe.js";import"./card-DIjMh1NO.js";import"./connection-ChwHK0-S.js";import"./use-collections-CXETocKO.js";import"./useMutation-Dl1MMkEC.js";import"./use-mobile-DssCtDl6.js";function ve(e,r){switch(r.type){case"delete":return{mode:"deleting",gateway:r.gateway};case"close":return{mode:"idle"}}}function be(){const e=ee.c(63),{org:r}=he(),n=oe();let j;e[0]!==r.slug?(j={namespace:r.slug,resource:"gateways"},e[0]=r.slug,e[1]=j):j=e[1];const s=pe(j),f=me(s);let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},e[2]=C):C=e[2];const{createGateway:B,isCreating:w}=ge(C),G=ue();let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y={mode:"idle"},e[3]=y):y=e[3];const[i,N]=te.useReducer(ve,y);let D;e[4]!==G||e[5]!==i.gateway||e[6]!==i.mode?(D=async()=>{if(i.mode!=="deleting")return;const o=i.gateway.id;N({type:"close"});try{await G.delete.mutateAsync(o)}catch{}},e[4]=G,e[5]=i.gateway,e[6]=i.mode,e[7]=D):D=e[7];const R=D;let S,v,b,k,_,A;e[8]===Symbol.for("react.memo_cache_sentinel")?(S={id:"icon",header:"",render:Ke,cellClassName:"w-16 shrink-0",wrap:!0},v={id:"title",header:"Name",render:Pe,cellClassName:"w-48 min-w-0 shrink-0",sortable:!0},b={id:"description",header:"Description",render:Ee,cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},k={id:"mode",header:"Mode",accessor:$e,cellClassName:"w-[100px]"},_={id:"connections",header:"Connections",render:ze,cellClassName:"w-24 shrink-0"},A={id:"status",header:"Status",render:Me,cellClassName:"w-24 shrink-0",sortable:!0},e[8]=S,e[9]=v,e[10]=b,e[11]=k,e[12]=_,e[13]=A):(S=e[8],v=e[9],b=e[10],k=e[11],_=e[12],A=e[13]);let I;e[14]!==n||e[15]!==r.slug?(I=[S,v,b,k,_,A,{id:"actions",header:"",render:o=>t.jsxs(Q,{children:[t.jsx(U,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ie,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:Ae,children:[t.jsxs(O,{onClick:a=>{a.stopPropagation(),n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Open"]}),t.jsxs(O,{variant:"destructive",onClick:a=>{a.stopPropagation(),N({type:"delete",gateway:o})},children:[t.jsx(Z,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],e[14]=n,e[15]=r.slug,e[16]=I):I=e[16];const T=I,V=w?"Creating...":"Create Agent";let M;e[17]!==B||e[18]!==w||e[19]!==V?(M=t.jsx(q,{onClick:B,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:w,children:V}),e[17]=B,e[18]=w,e[19]=V,e[20]=M):M=e[20];const H=M,L=i.mode==="deleting";let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=o=>!o&&N({type:"close"}),e[21]=z):z=e[21];let $;e[22]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(fe,{children:"Delete Agent?"}),e[22]=$):$=e[22];const F=i.mode==="deleting"&&i.gateway.title;let l;e[23]!==F?(l=t.jsxs(xe,{children:[$,t.jsxs(je,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:F}),"."]})]}),e[23]=F,e[24]=l):l=e[24];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(Ce,{children:"Cancel"}),e[25]=E):E=e[25];let c;e[26]!==R?(c=t.jsxs(we,{children:[E,t.jsx(ye,{onClick:R,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[26]=R,e[27]=c):c=e[27];let d;e[28]!==l||e[29]!==c?(d=t.jsxs(Ne,{children:[l,c]}),e[28]=l,e[29]=c,e[30]=d):d=e[30];let m;e[31]!==L||e[32]!==d?(m=t.jsx(De,{open:L,onOpenChange:z,children:d}),e[31]=L,e[32]=d,e[33]=m):m=e[33];let P;e[34]===Symbol.for("react.memo_cache_sentinel")?(P=[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"status",label:"Status"}],e[34]=P):P=e[34];let u;e[35]!==H||e[36]!==s.handleSort||e[37]!==s.setViewMode||e[38]!==s.sortDirection||e[39]!==s.sortKey||e[40]!==s.viewMode?(u=t.jsx(re,{title:"Agents",viewMode:s.viewMode,onViewModeChange:s.setViewMode,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,sortOptions:P,ctaButton:H}),e[35]=H,e[36]=s.handleSort,e[37]=s.setViewMode,e[38]=s.sortDirection,e[39]=s.sortKey,e[40]=s.viewMode,e[41]=u):u=e[41];let p;e[42]!==s?(p=o=>{o.key==="Escape"&&(s.setSearch(""),o.target.blur())},e[42]=s,e[43]=p):p=e[43];let g;e[44]!==s.search||e[45]!==s.setSearch||e[46]!==p?(g=t.jsx(ne,{value:s.search,onChange:s.setSearch,placeholder:"Search for an agent...",onKeyDown:p}),e[44]=s.search,e[45]=s.setSearch,e[46]=p,e[47]=g):g=e[47];let h;e[48]!==T||e[49]!==f||e[50]!==s.handleSort||e[51]!==s.search||e[52]!==s.sortDirection||e[53]!==s.sortKey||e[54]!==s.viewMode||e[55]!==n||e[56]!==r.slug?(h=s.viewMode==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:f.length===0?t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:s.search?"No agents found":"No agents yet",description:s.search?`No agents match "${s.search}"`:"Create an agent to aggregate tools from multiple Connections."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:f.map(o=>t.jsx(le,{connection:{id:o.id,title:o.title,description:o.description,icon:o.icon,status:o.status},fallbackIcon:t.jsx(x,{}),onClick:()=>n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}}),footer:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{children:[o.connections.length," connection",o.connections.length!==1?"s":""]}),t.jsx("span",{children:"•"}),t.jsx("span",{children:o.tool_selection_mode==="exclusion"?"Exclude":"Include"})]}),headerActions:t.jsxs(Q,{children:[t.jsx(U,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:_e,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:ke,children:[t.jsxs(O,{onClick:a=>{a.stopPropagation(),n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Open"]}),t.jsxs(O,{variant:"destructive",onClick:a=>{a.stopPropagation(),N({type:"delete",gateway:o})},children:[t.jsx(Z,{size:16}),"Delete"]})]})]})},o.id))})}):t.jsx(ae,{columns:T,data:f,isLoading:!1,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,onRowClick:o=>n({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}}),emptyState:s.search?t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:"No agents found",description:`No agents match "${s.search}"`}):t.jsx(W,{image:t.jsx(x,{size:36,className:"text-muted-foreground"}),title:"No agents yet",description:"Create an agent to aggregate tools from multiple Connections."})}),e[48]=T,e[49]=f,e[50]=s.handleSort,e[51]=s.search,e[52]=s.sortDirection,e[53]=s.sortKey,e[54]=s.viewMode,e[55]=n,e[56]=r.slug,e[57]=h):h=e[57];let K;return e[58]!==m||e[59]!==u||e[60]!==g||e[61]!==h?(K=t.jsxs(ie,{children:[m,u,g,h]}),e[58]=m,e[59]=u,e[60]=g,e[61]=h,e[62]=K):K=e[62],K}function ke(e){return e.stopPropagation()}function _e(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function Me(e){return t.jsx(se,{variant:e.status==="active"?"default":"outline",children:e.status})}function ze(e){return t.jsx("span",{className:"text-sm text-muted-foreground",children:e.connections.length})}function $e(e){return t.jsx(se,{variant:"outline",className:"text-xs",children:e.tool_selection_mode==="exclusion"?"Exclude":"Include"})}function Ee(e){return t.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:e.description||"—"})}function Pe(e){return t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title})}function Ke(e){return t.jsx(ce,{icon:e.icon,name:e.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(x,{size:16})})}function ft(){const e=ee.c(1);let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(de,{children:t.jsx(te.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Se,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(be,{})})}),e[0]=r):r=e[0],r}export{ft as default};
@@ -1 +0,0 @@
1
- import{c as O,x as w}from"./index-Diww4UW3.js";import{u as x}from"./useQuery-Bvk0U2ed.js";import{u as I}from"./useMutation-Dl1MMkEC.js";function L(e){try{return JSON.parse(e)}catch{return}}function $(e,s){const t=localStorage.getItem(e),o=t?L(t):void 0,n=typeof s=="function"?s(o):o??s;if(o===void 0||n!==o)try{const a=JSON.stringify(n);localStorage.setItem(e,a)}catch{}return n}function q(e,s){const t=O.c(25),o=w();let n;t[0]!==e?(n=["localStorage",e],t[0]=e,t[1]=n):n=t[1];const a=n;let r,i;t[2]!==s||t[3]!==e?(r=()=>$(e,s),i=()=>$(e,s),t[2]=s,t[3]=e,t[4]=r,t[5]=i):(r=t[4],i=t[5]);let h;t[6]!==a||t[7]!==r||t[8]!==i?(h={queryKey:a,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},t[6]=a,t[7]=r,t[8]=i,t[9]=h):h=t[9];const{data:v}=x(h);let l;t[10]!==e?(l=async c=>{const y=JSON.stringify(c);return localStorage.setItem(e,y),c},t[10]=e,t[11]=l):l=t[11];let m;t[12]!==o||t[13]!==a?(m=c=>{o.setQueryData(a,c)},t[12]=o,t[13]=a,t[14]=m):m=t[14];let u;t[15]!==l||t[16]!==m?(u={mutationFn:l,onSuccess:m},t[15]=l,t[16]=m,t[17]=u):u=t[17];const f=I(u);let d;t[18]!==f||t[19]!==o||t[20]!==a?(d=c=>{const y=o.getQueryData(a),C=typeof c=="function"?c(y):c;f.mutate(C)},t[18]=f,t[19]=o,t[20]=a,t[21]=d):d=t[21];const p=d,S=v;let g;return t[22]!==p||t[23]!==S?(g=[S,p],t[22]=p,t[23]=S,t[24]=g):g=t[24],g}const A={decoChatOpen:()=>"mesh:decochat:open",threadManagerState:e=>`mesh:thread-manager-state:${e}`,chatSelectedModel:e=>`mesh:chat:selectedModel:${e}`,assistantChatActiveThread:(e,s)=>`mesh:assistant-chat:active-thread:${e}:${s}`,gatewayChatActiveThread:(e,s)=>`mesh:gateway-chat:active-thread:${e}:${s}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:e=>`mesh:store:selected-registry:${e}`,orgHomeQuickstart:e=>`mesh:org-home:quickstart:${e}`,gatewaySystemPrompts:e=>`mesh:gateway:system-prompts:${e}`,storeShowStdio:()=>"mesh:store:show-stdio",developerMode:()=>"mesh:user:developer-mode",pluginConnection:(e,s)=>`mesh:plugin:connection:${e}:${s}`};export{A as L,q as u};
@@ -1,3 +0,0 @@
1
- import{r as G,K as le,a as J,y as fs,I as He,J as Ms,L as zs,z as ue,x as qe,E as ys,B as ks,t as X,j as t,c as de,v as Ds}from"./index-Diww4UW3.js";import{C as Bs}from"./collection-header-B4qcjEt5.js";import{C as es}from"./collection-page-s-RR5fU6.js";import{C as Ze}from"./collection-search-BVb42O45.js";import{C as Us}from"./collection-table-wrapper-BohFZqii.js";import{T as Gs}from"./tool-set-selector-B9rTBahU.js";import{u as Vs}from"./use-connection-CCXutWLD.js";import{u as ls}from"./use-members-CB2ebBfn.js";import{W as $s}from"./well-known-mcp-DOEdYmKO.js";import{u as je}from"./project-context-provider-DulCVL2k.js";import{u as Ss}from"./useQuery-Bvk0U2ed.js";import{A as Ce}from"./avatar-B7xnPXuk.js";import{B as ve}from"./badge-BVO6I0sW.js";import{c as re,B as ee}from"./button-CGmrzkpY.js";import{C as Fs}from"./checkbox-DYViXeUc.js";import{f as Ee,a as ye,b as Se,c as Ie,d as Te,e as we,A as Oe,g as Ae}from"./alert-dialog-CCJCsKzK.js";import{d as Is,e as Ts,c as ws,a as Ks,D as Qs,f as qs}from"./dialog-DJJ2cvEE.js";import{b as as,D as cs,a as ds,c as Ke,e as Zs,f as Ys,g as Ws,d as Hs}from"./dropdown-menu-CAeD2aIb.js";import{i as Xs}from"./DotsHorizontal-C2Nr-D-f.js";import{i as Os}from"./Loading01-Ae5ezbtD.js";import{i as Js}from"./Lock01-BuQSktMF.js";import{s as ss}from"./Plus-CdG75X26.js";import{s as As}from"./Trash01-BWIN9RL_.js";import{i as hs}from"./X-C18ho617.js";import{I as et}from"./input-CrURMEZe.js";import{S as Ge}from"./switch-DJBd8Fzb.js";import{a as Re,c as _e,b as Pe,T as Le}from"./tooltip-Suu_Gpqh.js";import{u as fe}from"./useMutation-Dl1MMkEC.js";import{E as Xe}from"./empty-state-wP9uukGJ.js";import{E as st}from"./error-boundary-BUvK8Sry.js";import{a as tt,F as gs,b as ps,c as nt,d as xs,f as bs}from"./form-DiGzBnRK.js";import{S as ts,a as ns,b as rs,c as is,d as os}from"./select-C8LOz7vA.js";import{T as rt}from"./textarea-C_zgj3Sp.js";import{c as it}from"./connection-ChwHK0-S.js";import{C as Cs}from"./card-DIjMh1NO.js";import{i as Rs}from"./DotsVertical-BPP4U4GQ.js";import{i as ot}from"./Key01-DTwk4FpG.js";import{s as lt}from"./XClose-CfwoKknl.js";import"./collection-display-button-CtkxsCB_.js";import"./ArrowUp-BF7mM4C2.js";import"./Check-BQkm1TiP.js";import"./Grid01-D4lXvveX.js";import"./List-BsSZz32j.js";import"./view-mode-toggle-BLClM-0g.js";import"./SearchMd-GFaonOaJ.js";import"./ArrowLeft-B3km7toT.js";import"./use-collections-CXETocKO.js";import"./ChevronDown-DP6jvip7.js";const ms=({size:s=24,color:e="currentColor",...n})=>G.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},G.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"}));ms.displayName="Shield01";const _s=({size:s=24,color:e="currentColor",...n})=>G.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},G.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));_s.displayName="SwitchHorizontal01";const Ps=[{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_GATEWAY_CREATE",description:"Create gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_LIST",description:"List gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_GET",description:"View gateway details",category:"Gateways"},{name:"COLLECTION_GATEWAY_UPDATE",description:"Update gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_DELETE",description:"Delete gateways",category:"Gateways",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}],at={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_GATEWAY_CREATE:"Create gateways",COLLECTION_GATEWAY_LIST:"List gateways",COLLECTION_GATEWAY_GET:"View gateway details",COLLECTION_GATEWAY_UPDATE:"Update gateways",COLLECTION_GATEWAY_DELETE:"Delete gateways",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"};function ct(){const s={Organizations:[],Connections:[],Gateways:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Ps)s[e.category]?.push(e);return s}function dt(){return Ps.map(s=>({value:s.name,label:at[s.name],dangerous:s.dangerous}))}const js=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function mt(s){return s.replace(/-/g," ")}function ut(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const o=[];let a=!1;const i=new Set;let h=!1;for(const[l,p]of Object.entries(s)){if(l===$s.SELF){p.includes("*")?n=!0:e.push(...p);continue}if(l==="*"){if(a=!0,p.includes("*"))h=!0;else for(const E of p)i.add(E);continue}if(o.push(l),p.includes("*"))h=!0;else for(const E of p)i.add(E)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:o,allowsAllConnections:a,toolNames:Array.from(i),allowsAllTools:h}}function us(){const{locator:s}=je(),{data:e,isLoading:n,error:o,refetch:a}=Ss({queryKey:le.organizationRoles(s),queryFn:async()=>{try{const l=await J.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}),i=js.map(l=>({role:l.value,label:l.label,isBuiltin:l.isBuiltin}));if(e&&Array.isArray(e))for(const l of e){const p=l.role;if(!p||js.some(C=>C.value===p))continue;const{staticPermissions:E,allowsAllStaticPermissions:f,connectionIds:w,allowsAllConnections:d,toolNames:S,allowsAllTools:u}=ut(l.permission);i.push({id:l.id,role:p,label:mt(p),isBuiltin:!1,permission:l.permission??void 0,staticPermissionCount:f?-1:E.length,allowsAllStaticPermissions:f,connectionCount:d?-1:w.length,allowsAllConnections:d,toolCount:u?-1:S.length,allowsAllTools:u})}const h=i.filter(l=>!l.isBuiltin);return{roles:i,customRoles:h,builtinRoles:i.filter(l=>l.isBuiltin),isLoading:n,error:o,refetch:a}}const ft=fs({role:fs({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:zs(),staticPermissions:He(ue()),toolSet:Ms(ue(),He(ue())),memberIds:He(ue())});function Ls(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const ht=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Je=["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 gt(s){if(!s)return"bg-neutral-400";let e=0;for(let o=0;o<s.length;o++){const a=s.charCodeAt(o);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%Je.length;return Je[n]??Je[0]}function Ve(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function pt(s){const e=de.c(39),{allowAllStaticPermissions:n,staticPermissions:o,onAllowAllChange:a,onPermissionsChange:i,readOnly:h}=s,l=h===void 0?!1:h,[p,E]=G.useState(""),f=G.useDeferredValue(p);let w,d,S,u,C;if(e[0]!==n||e[1]!==f||e[2]!==a||e[3]!==i||e[4]!==l||e[5]!==p||e[6]!==o){const g=ct(),c=dt(),N=c.filter(y=>y.label.toLowerCase().includes(f.toLowerCase())),I=y=>{if(o.includes(y))i(o.filter(_=>_!==y));else{const _=[...o,y];_.length===c.length?(a(!0),i([])):i(_)}};S="flex flex-col h-full",e[12]!==p?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(Ze,{value:p,onChange:E,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=p,e[13]=u):u=e[13];const P=!l&&"hover:bg-muted/50 cursor-pointer";let T;e[14]!==P?(T=re("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=T):T=e[15];let A;e[16]!==n||e[17]!==a||e[18]!==i||e[19]!==l?(A=()=>{if(l)return;a(!n),i([])},e[16]=n,e[17]=a,e[18]=i,e[19]=l,e[20]=A):A=e[20];let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=O):O=e[21];let L;e[22]!==n||e[23]!==a||e[24]!==i||e[25]!==l?(L=t.jsx("div",{onClick:Nt,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ge,{checked:n,disabled:l,onCheckedChange:y=>{l||(a(y),i([]))}})})}),t.jsx(Le,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ge,{checked:n,disabled:l,onCheckedChange:y=>{l||(a(y),i([]))}})}),e[22]=n,e[23]=a,e[24]=i,e[25]=l,e[26]=L):L=e[26],e[27]!==L||e[28]!==T||e[29]!==A?(C=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:T,onClick:A,children:[O,L]})}),e[27]=L,e[28]=T,e[29]=A,e[30]=C):C=e[30],w="flex-1 overflow-auto",d=Object.entries(g).map(y=>{const[_,z]=y,v=N.filter(m=>z.some(M=>M.name===m.value));return v.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:_}),t.jsx("div",{className:"space-y-1",children:v.map(m=>t.jsxs("div",{className:re("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 M=c.map(jt);i(M.filter(V=>V!==m.value))}else I(m.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:m.label})}),t.jsx("div",{onClick:Ct,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ge,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(bt);i(M.filter(V=>V!==m.value))}else I(m.value)}})})}),t.jsx(Le,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ge,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(xt);i(M.filter(V=>V!==m.value))}else I(m.value)}})})]},m.value))})]},_)}),e[0]=n,e[1]=f,e[2]=a,e[3]=i,e[4]=l,e[5]=p,e[6]=o,e[7]=w,e[8]=d,e[9]=S,e[10]=u,e[11]=C}else w=e[7],d=e[8],S=e[9],u=e[10],C=e[11];let x;e[31]!==w||e[32]!==d?(x=t.jsx("div",{className:w,children:d}),e[31]=w,e[32]=d,e[33]=x):x=e[33];let j;return e[34]!==S||e[35]!==u||e[36]!==C||e[37]!==x?(j=t.jsxs("div",{className:S,children:[u,C,x]}),e[34]=S,e[35]=u,e[36]=C,e[37]=x,e[38]=j):j=e[38],j}function xt(s){return s.value}function bt(s){return s.value}function Ct(s){return s.stopPropagation()}function jt(s){return s.value}function Nt(s){return s.stopPropagation()}function vt(s){const e=de.c(56),{open:n,onOpenChange:o,selectedMemberIds:a,onAddMembers:i}=s,[h,l]=G.useState(""),p=G.useDeferredValue(h);let E;e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0];const[f,w]=G.useState(E),{data:d}=ls();let S,u,C,x,j,g,c,N,I,P,T;if(e[1]!==d?.data?.members||e[2]!==p||e[3]!==i||e[4]!==o||e[5]!==n||e[6]!==f||e[7]!==h||e[8]!==a){const M=d?.data?.members??[];let V;e[20]!==p?(V=D=>{const r=p.toLowerCase();return D.user?.name?.toLowerCase().includes(r)||D.user?.email?.toLowerCase().includes(r)},e[20]=p,e[21]=V):V=e[21];const se=M.filter(V),F=Et;let K;e[22]!==a?(K=D=>a.includes(D),e[22]=a,e[23]=K):K=e[23];const Q=K;let Y;e[24]!==f?(Y=D=>{f.includes(D)?w(f.filter(r=>r!==D)):w([...f,D])},e[24]=f,e[25]=Y):Y=e[25];const ne=Y;let te;e[26]!==i||e[27]!==o||e[28]!==f?(te=()=>{i(f),w([]),o(!1)},e[26]=i,e[27]=o,e[28]=f,e[29]=te):te=e[29],C=te,u=Ee,P=n,T=o,S=ye,N="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsxs(Se,{className:"px-6 pt-6",children:[t.jsx(Ie,{children:"Add Members to Role"}),t.jsx(Te,{children:"Select members to add to this role."})]}),e[30]=I):I=e[30],g="flex flex-col h-80",e[31]!==h?(c=t.jsx(Ze,{value:h,onChange:l,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=h,e[32]=c):c=e[32],x="flex-1 overflow-auto",j=se.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:h?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:se.map(D=>{const r=F(D),b=Q(D.id),$=f.includes(D.id);return t.jsxs("label",{className:re("flex items-center gap-3 p-2 rounded-lg",!r||b?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx(Fs,{checked:$||b,onCheckedChange:()=>{r&&!b&&ne(D.id)},disabled:!r||b}),t.jsx(Ce,{url:D.user?.image??void 0,fallback:Ls(D.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:D.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.user?.email})]}),!r&&t.jsx(ve,{variant:"secondary",className:"shrink-0",children:"Owner"}),b&&r&&t.jsx(ve,{variant:"outline",className:"shrink-0",children:"Added"})]},D.id)})}),e[1]=d?.data?.members,e[2]=p,e[3]=i,e[4]=o,e[5]=n,e[6]=f,e[7]=h,e[8]=a,e[9]=S,e[10]=u,e[11]=C,e[12]=x,e[13]=j,e[14]=g,e[15]=c,e[16]=N,e[17]=I,e[18]=P,e[19]=T}else S=e[9],u=e[10],C=e[11],x=e[12],j=e[13],g=e[14],c=e[15],N=e[16],I=e[17],P=e[18],T=e[19];let A;e[33]!==x||e[34]!==j?(A=t.jsx("div",{className:x,children:j}),e[33]=x,e[34]=j,e[35]=A):A=e[35];let O;e[36]!==A||e[37]!==g||e[38]!==c?(O=t.jsxs("div",{className:g,children:[c,A]}),e[36]=A,e[37]=g,e[38]=c,e[39]=O):O=e[39];let L;e[40]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(Oe,{children:"Cancel"}),e[40]=L):L=e[40];const y=f.length===0,_=f.length>0&&`(${f.length})`;let z;e[41]!==C||e[42]!==y||e[43]!==_?(z=t.jsxs(we,{className:"px-6 pb-6",children:[L,t.jsxs(Ae,{onClick:C,disabled:y,children:["Add ",_]})]}),e[41]=C,e[42]=y,e[43]=_,e[44]=z):z=e[44];let v;e[45]!==S||e[46]!==O||e[47]!==z||e[48]!==N||e[49]!==I?(v=t.jsxs(S,{className:N,children:[I,O,z]}),e[45]=S,e[46]=O,e[47]=z,e[48]=N,e[49]=I,e[50]=v):v=e[50];let m;return e[51]!==u||e[52]!==v||e[53]!==P||e[54]!==T?(m=t.jsx(u,{open:P,onOpenChange:T,children:v}),e[51]=u,e[52]=v,e[53]=P,e[54]=T,e[55]=m):m=e[55],m}function Et(s){return s.role!=="owner"}function yt(s){const e=de.c(40),{memberIds:n,onMemberIdsChange:o,readOnly:a}=s,i=a===void 0?!1:a,[h,l]=G.useState(""),p=G.useDeferredValue(h),[E,f]=G.useState(!1),{data:w}=ls();let d,S,u,C,x;if(e[0]!==w?.data?.members||e[1]!==p||e[2]!==n||e[3]!==o||e[4]!==i||e[5]!==h){const N=w?.data?.members??[];let I;e[11]!==n?(I=v=>n.includes(v.id),e[11]=n,e[12]=I):I=e[12];const P=N.filter(I);let T;e[13]!==p?(T=v=>{const m=p.toLowerCase();return v.user?.name?.toLowerCase().includes(m)||v.user?.email?.toLowerCase().includes(m)},e[13]=p,e[14]=T):T=e[14];const A=P.filter(T);let O;e[15]!==n||e[16]!==o?(O=v=>{o(n.filter(m=>m!==v))},e[15]=n,e[16]=o,e[17]=O):O=e[17];const L=O;let y;e[18]!==n||e[19]!==o?(y=v=>{o([...n,...v])},e[18]=n,e[19]=o,e[20]=y):y=e[20],d=y,C="flex flex-col h-full";let _;e[21]!==h?(_=t.jsx(Ze,{value:h,onChange:l,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=h,e[22]=_):_=e[22];let z;e[23]!==i?(z=i?t.jsx("div",{className:"pr-4",children:t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(ss,{size:16}),"Add Member"]})})}),t.jsx(Le,{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:()=>f(!0),children:[t.jsx(ss,{size:16}),"Add Member"]})}),e[23]=i,e[24]=z):z=e[24],e[25]!==_||e[26]!==z?(x=t.jsxs("div",{className:"flex items-center border-b border-border",children:[_,z]}),e[25]=_,e[26]=z,e[27]=x):x=e[27],S="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."})]})}):A.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 "',h,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:A.map(v=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(Ce,{url:v.user?.image??void 0,fallback:Ls(v.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:v.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:v.user?.email})]}),i?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(hs,{size:16})})})}),t.jsx(Le,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>L(v.id),children:t.jsx(hs,{size:16})})]},v.id))}),e[0]=w?.data?.members,e[1]=p,e[2]=n,e[3]=o,e[4]=i,e[5]=h,e[6]=d,e[7]=S,e[8]=u,e[9]=C,e[10]=x}else d=e[6],S=e[7],u=e[8],C=e[9],x=e[10];let j;e[28]!==S||e[29]!==u?(j=t.jsx("div",{className:S,children:u}),e[28]=S,e[29]=u,e[30]=j):j=e[30];let g;e[31]!==E||e[32]!==d||e[33]!==n?(g=t.jsx(vt,{open:E,onOpenChange:f,selectedMemberIds:n,onAddMembers:d}),e[31]=E,e[32]=d,e[33]=n,e[34]=g):g=e[34];let c;return e[35]!==C||e[36]!==x||e[37]!==j||e[38]!==g?(c=t.jsxs("div",{className:C,children:[x,j,g]}),e[35]=C,e[36]=x,e[37]=j,e[38]=g,e[39]=c):c=e[39],c}function St(s){const e=de.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(Os,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let o;return e[1]!==s?(o=t.jsx(G.Suspense,{fallback:n,children:t.jsx(yt,{...s})}),e[1]=s,e[2]=o):o=e[2],o}const It={owner:[],admin:[],user:[]};function $e(s,e){const n=s==="owner"||s==="admin",o=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:It[s],toolSet:{},memberIds:o.map(a=>a.id)}}function Tt({trigger:s,onSuccess:e}){const[n,o]=G.useState(!1),[a,i]=G.useState("mcp"),{locator:h}=je(),l=qe(),p=Vs()??[],{customRoles:E,refetch:f}=us(),{data:w}=Ss({queryKey:le.members(h),queryFn:()=>J.organization.listMembers()}),d=ys({resolver:ks(ft),defaultValues:Ve()}),S=d.formState.isValid,u=d.formState.isDirty,[C,x]=G.useState(null),[j,g]=G.useState(null),c=!d.watch("role.id")&&!d.watch("role.slug")&&!j,[N,I]=G.useState(null),[P,T]=G.useState(!1),[A,O]=G.useState(null),L=r=>{const b=r.permission||{},$=b.self||[],oe=$.includes("*"),ie=oe?[]:$.filter(k=>k!=="*"),W={};for(const[k,B]of Object.entries(b))if(k!=="self")if(k==="*")for(const Z of p)B.includes("*")?W[Z.id]=Z.tools?.map(ae=>ae.name)??[]:W[Z.id]=B;else{const Z=p.find(ae=>ae.id===k);Z&&(B.includes("*")?W[k]=Z.tools?.map(ae=>ae.name)??[]:W[k]=B)}const me=(w?.data?.members??[]).filter(k=>k.role===r.role).map(k=>k.id);return{role:{id:r.id,slug:r.role,label:r.label},allowAllStaticPermissions:oe,staticPermissions:ie,toolSet:W,memberIds:me}},y=r=>{const b=L(r);d.reset(b),x(r.id??null),g(null)},_=()=>{d.reset(Ve()),x(null),g(null),i("mcp")},z=r=>{u&&S?(O(()=>()=>y(r)),T(!0)):y(r)},v=async()=>{u&&S&&await Y(),_()},m=r=>{if(u&&S)O(()=>()=>{const b=$e(r,w?.data?.members??[]);d.reset(b),g(r),x(null),i("org")}),T(!0);else{const b=$e(r,w?.data?.members??[]);d.reset(b),g(r),x(null),i("org")}},M=r=>{if(!r&&d.formState.isDirty&&S){O(()=>()=>{o(!1),d.reset(Ve()),g(null)}),T(!0);return}if(o(r),!r)d.reset(Ve()),g(null),x(null);else{const b=E[0];if(b)y(b);else{const $=$e("user",w?.data?.members??[]);d.reset($),g("user"),x(null),i("org")}}},V=()=>{T(!1),A&&(A(),O(null))},se=r=>{const b={};r.allowAllStaticPermissions?b.self=["*"]:r.staticPermissions.length>0&&(b.self=r.staticPermissions);for(const[$,oe]of Object.entries(r.toolSet))if(oe.length>0){const W=p.find(q=>q.id===$)?.tools?.map(q=>q.name)??[];W.length>0&&W.every(q=>oe.includes(q))?b[$]=["*"]:b[$]=oe}return b},F=fe({mutationFn:async r=>{const b=se(r),$=r.role.slug||r.role.label.toLowerCase().replace(/\s+/g,"-");if(r.role.slug&&!r.role.id){const W=(w?.data?.members??[]).filter(k=>k.role===r.role.slug).map(k=>k.id),q=r.memberIds.filter(k=>!W.includes(k)),me=W.filter(k=>!r.memberIds.includes(k));for(const k of q){const B=await J.organization.updateMemberRole({memberId:k,role:[r.role.slug]});if(B?.error)throw new Error(B.error.message)}for(const k of me){const B=await J.organization.updateMemberRole({memberId:k,role:["user"]});if(B?.error)throw new Error(B.error.message)}return r}else if(r.role.id){const ie=await J.organization.updateRole({roleId:r.role.id,data:{permission:b}});if(ie?.error)throw new Error(ie.error.message);const q=(w?.data?.members??[]).filter(B=>B.role===r.role.slug).map(B=>B.id),me=r.memberIds.filter(B=>!q.includes(B)),k=q.filter(B=>!r.memberIds.includes(B));for(const B of me){const Z=await J.organization.updateMemberRole({memberId:B,role:[r.role.slug]});if(Z?.error)throw new Error(Z.error.message)}for(const B of k){const Z=await J.organization.updateMemberRole({memberId:B,role:["user"]});if(Z?.error)throw new Error(Z.error.message)}return r}else{const ie=await J.organization.createRole({role:$,permission:b});if(ie?.error)throw new Error(ie.error.message);for(const W of r.memberIds){const q=await J.organization.updateMemberRole({memberId:W,role:[$]});if(q?.error)throw new Error(q.error.message)}return{...r,role:{...r.role,id:ie.data?.roleData?.id,slug:$}}}},onSuccess:(r,b)=>{l.invalidateQueries({queryKey:le.members(h)}),l.invalidateQueries({queryKey:le.organizationRoles(h)});const $=!b.role.id&&!b.role.slug,oe=b.role.slug&&!b.role.id;X.success(oe?"Members updated successfully!":$?"Role created successfully!":"Role updated successfully!"),f(),d.reset(r),r.role.id&&x(r.role.id),e?.()},onError:r=>{X.error(r instanceof Error?r.message:"Failed to save role")}}),K=fe({mutationFn:async r=>{const b=await J.organization.deleteRole({roleId:r});if(b?.error)throw new Error(b.error.message);return b?.data},onSuccess:()=>{if(l.invalidateQueries({queryKey:le.members(h)}),l.invalidateQueries({queryKey:le.organizationRoles(h)}),X.success("Role deleted successfully!"),f(),N?.id===C){const r=E.filter(b=>b.id!==N?.id);if(r[0])y(r[0]);else{const b=$e("user",w?.data?.members??[]);d.reset(b),g("user"),x(null),i("org")}}},onError:r=>{X.error(r instanceof Error?r.message:"Failed to delete role")}}),Q=F.isPending||K.isPending,Y=async()=>{const r=d.getValues();if(!r.role.label.trim()){X.error("Role name is required"),d.setFocus("role.label");return}await F.mutateAsync(r)},ne=d.handleSubmit(r=>{if(!r.role.label.trim()){X.error("Role name is required"),d.setFocus("role.label");return}F.mutate(r)}),te=r=>{r.id&&I({id:r.id,label:r.label})},D=()=>{N?.id&&K.mutate(N.id),I(null)};return t.jsxs(Is,{open:n,onOpenChange:M,children:[t.jsx(Ts,{asChild:!0,children:s}),t.jsx(ws,{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:[ht.map(r=>{const b=j===r.role;return t.jsxs("div",{className:re("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>m(r.role),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",r.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsx(Js,{size:14,className:"text-muted-foreground shrink-0"})]},r.role)}),E.map(r=>{const b=C===r.id;return t.jsxs("div",{className:re("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>z(r),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",gt(r.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsxs(as,{children:[t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:re("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",b&&"opacity-100 pointer-events-auto"),onClick:$=>$.stopPropagation(),children:t.jsx(Xs,{size:14})})}),t.jsx(ds,{align:"end",children:t.jsxs(Ke,{className:"text-destructive",onClick:$=>{$.stopPropagation(),te(r)},children:[t.jsx(As,{size:16}),"Delete"]})})]})]},r.id)}),c&&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(et,{...d.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),t.jsx(ve,{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:v,disabled:Q||u,className:"w-full h-10",children:[t.jsx(ss,{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:[!j&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("mcp"),className:re("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:()=>i("org"),className:re("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:()=>i("members"),className:re("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"&&!j&&t.jsx(Gs,{toolSet:d.watch("toolSet"),onToolSetChange:r=>d.setValue("toolSet",r,{shouldDirty:!0})}),a==="org"&&t.jsx(pt,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:r=>d.setValue("allowAllStaticPermissions",r,{shouldDirty:!0}),onPermissionsChange:r=>d.setValue("staticPermissions",r,{shouldDirty:!0}),readOnly:!!j}),a==="members"&&t.jsx(St,{memberIds:d.watch("memberIds"),onMemberIdsChange:r=>d.setValue("memberIds",r,{shouldDirty:!0}),readOnly:j==="owner"})]}),(!j||j!=="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:()=>M(!1),disabled:Q,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:ne,disabled:Q||!S||!d.formState.isDirty,className:"h-10",children:F.isPending?"Saving...":c?"Create Role":"Save Changes"})]})]})]})}),t.jsx(Ee,{open:N!==null,onOpenChange:r=>!r&&I(null),children:t.jsxs(ye,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Delete Role"}),t.jsxs(Te,{children:['Are you sure you want to delete the "',N?.label,'" role? This action cannot be undone.']})]}),t.jsxs(we,{children:[t.jsx(Oe,{children:"Cancel"}),t.jsx(Ae,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Ee,{open:P,onOpenChange:T,children:t.jsxs(ye,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Discard Changes"}),t.jsx(Te,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(we,{children:[t.jsx(Oe,{onClick:()=>O(null),children:"Keep Editing"}),t.jsx(Ae,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const wt=ue().email("Invalid email address");function Ot(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 At({trigger:s}){const[e,n]=G.useState(!1),{locator:o}=je(),a=qe(),{data:i}=J.useSession(),h=i?.user?.email,{roles:l,isLoading:p}=us(),E=l.filter(g=>g.role!=="owner"),f=ys({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),w=f.watch("emailsText"),d=f.watch("role"),u=Ot(w).filter(g=>{const c=wt.safeParse(g).success,N=!h||g!==h.toLowerCase();return c&&N}),C=fe({mutationFn:async({emails:g,role:c})=>{if(!c)throw new Error("Please select a role");const N=await Promise.allSettled(g.map(async P=>{const T=await J.organization.inviteMember({email:P,role:c});if(T.error)throw new Error(T.error.message);return T.data})),I=N.filter(P=>P.status==="rejected");if(I.length>0)throw new Error(`Failed to invite ${I.length} member${I.length>1?"s":""}`);return N},onSuccess:(g,{emails:c})=>{a.invalidateQueries({queryKey:le.members(o)}),a.invalidateQueries({queryKey:le.invitations(o)}),X.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),f.reset({emailsText:"",role:"user"}),n(!1)},onError:g=>{X.error(g instanceof Error?g.message:"Failed to invite members")}}),x=g=>{if(u.length===0){X.error("Please enter at least one valid email address");return}if(!g.role){X.error("Please select a role");return}C.mutate({emails:u,role:g.role})},j=u.length>0&&!!d;return t.jsxs(Is,{open:e,onOpenChange:n,children:[t.jsx(Ts,{asChild:!0,children:s}),t.jsxs(ws,{className:"sm:max-w-lg",children:[t.jsx(Ks,{children:t.jsx(Qs,{children:"Invite members"})}),t.jsx(tt,{...f,children:t.jsxs("form",{onSubmit:f.handleSubmit(x),className:"space-y-4",children:[t.jsx(gs,{control:f.control,name:"emailsText",render:({field:g})=>t.jsxs(ps,{children:[t.jsx(nt,{children:"Email addresses"}),t.jsx(xs,{children:t.jsx(rt,{...g,disabled:C.isPending,placeholder:`Enter email addresses separated by commas or new lines
2
- e.g. user1@example.com, user2@example.com
3
- or one per line`,className:"min-h-[120px] resize-none"})}),t.jsx(bs,{})]})}),t.jsx(gs,{control:f.control,name:"role",render:({field:g})=>t.jsxs(ps,{children:[t.jsx(xs,{children:t.jsxs(ts,{value:g.value,onValueChange:g.onChange,disabled:C.isPending||p,children:[t.jsx(ns,{className:"w-full",children:t.jsx(rs,{placeholder:"Select a role"})}),t.jsx(is,{children:E.map(c=>{const N=[];return c.isBuiltin||(c.allowsAllStaticPermissions?N.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&N.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?N.push("All connections"):c.connectionCount&&c.connectionCount>0&&N.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?N.push("all tools"):c.toolCount&&c.toolCount>0&&N.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),t.jsx(os,{value:c.role,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:c.label}),!c.isBuiltin&&N.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:N.join(", ")})]})},c.role)})})]})}),t.jsx(bs,{})]})}),t.jsxs(qs,{children:[t.jsx(ee,{variant:"outline",onClick:()=>{f.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:C.isPending,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:C.isPending||!j,children:C.isPending?"Inviting...":`Invite ${u.length||0} Member${u.length!==1?"s":""}`})]})]})})]})]})}function Rt(){const s=de.c(6),{locator:e}=je();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n=it(),s[0]=n):n=s[0];const o=n;let a;s[1]!==e?(a=le.invitations(e),s[1]=e,s[2]=a):a=s[2];let i;s[3]===Symbol.for("react.memo_cache_sentinel")?(i=async()=>(await o("ORGANIZATION_GET",{}))?.invitations??[],s[3]=i):i=s[3];let h;return s[4]!==a?(h={queryKey:a,queryFn:i},s[4]=a,s[5]=h):h=s[5],Ds(h)}function _t(){const s=de.c(5),{locator:e}=je(),n=qe();let o;s[0]!==e||s[1]!==n?(o={mutationFn:Lt,onSuccess:()=>{n.invalidateQueries({queryKey:le.invitations(e)}),X.success("Invitation cancelled")},onError:Pt},s[0]=e,s[1]=n,s[2]=o):o=s[2];const a=fe(o);let i;return s[3]!==a?(i={cancel:a},s[3]=a,s[4]=i):i=s[4],i}function Pt(s){X.error(s instanceof Error?s.message:"Failed to cancel invitation")}async function Lt(s){const e=await J.organization.cancelInvitation({invitationId:s});if(e?.error)throw new Error(e.error.message);return e.data}const Ns=["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"],Mt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Qe(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function zt(s){const e=new Map;for(const[n,o]of Object.entries(Mt))e.set(n,o);for(let n=0;n<s.length;n++){const o=s[n];o&&!e.has(o.role)&&e.set(o.role,Ns[n%Ns.length]??"bg-neutral-400")}return e}function kt(s){return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Fe(s){const e=de.c(79),{role:n,memberId:o,isOwner:a,roleColorMap:i,selectableRoles:h,onRoleChange:l,size:p,className:E}=s,f=p===void 0?"xs":p;let w,d,S,u,C,x,j,g,c,N,I;if(e[0]!==E||e[1]!==a||e[2]!==o||e[3]!==l||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f){I=Symbol.for("react.early_return_sentinel");e:{const v=i.get(n)??"bg-neutral-400";if(a){let m;e[19]!==o||e[20]!==l?(m=D=>l(o,D),e[19]=o,e[20]=l,e[21]=m):m=e[21];let M;e[22]!==n?(M=t.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=M):M=e[23];const V=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:re("size-2 rounded-full shrink-0",v)}),M]});let se;e[24]!==V?(se=t.jsx(rs,{children:V}),e[24]=V,e[25]=se):se=e[25];let F;e[26]!==E||e[27]!==f||e[28]!==se?(F=t.jsx(ns,{size:f,className:E,children:se}),e[26]=E,e[27]=f,e[28]=se,e[29]=F):F=e[29];let K;if(e[30]!==i||e[31]!==h){let D;e[33]!==i?(D=r=>{const b=i.get(r.role)??"bg-neutral-400";return t.jsx(os,{value:r.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:re("size-3 rounded-full",b)}),t.jsx("span",{className:"capitalize",children:r.label})]})},r.role)},e[33]=i,e[34]=D):D=e[34],K=h.map(D),e[30]=i,e[31]=h,e[32]=K}else K=e[32];let Q;e[35]!==K?(Q=t.jsx(is,{children:K}),e[35]=K,e[36]=Q):Q=e[36];let Y;e[37]!==a||e[38]!==n||e[39]!==m||e[40]!==F||e[41]!==Q?(Y=t.jsx(Pe,{asChild:!0,children:t.jsx("div",{className:"w-fit",children:t.jsxs(ts,{value:n,onValueChange:m,disabled:a,children:[F,Q]})})}),e[37]=a,e[38]=n,e[39]=m,e[40]=F,e[41]=Q,e[42]=Y):Y=e[42];let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Le,{children:t.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=ne):ne=e[43];let te;e[44]!==Y?(te=t.jsx(Re,{children:t.jsxs(_e,{children:[Y,ne]})}),e[44]=Y,e[45]=te):te=e[45],I=te;break e}S=ts,g=n,e[46]!==o||e[47]!==l?(c=m=>l(o,m),e[46]=o,e[47]=l,e[48]=c):c=e[48],N=a,d=ns,x=f,j=E,w=rs,C="flex items-center gap-2 min-w-0",u=re("size-2 rounded-full shrink-0",v)}e[0]=E,e[1]=a,e[2]=o,e[3]=l,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=w,e[9]=d,e[10]=S,e[11]=u,e[12]=C,e[13]=x,e[14]=j,e[15]=g,e[16]=c,e[17]=N,e[18]=I}else w=e[8],d=e[9],S=e[10],u=e[11],C=e[12],x=e[13],j=e[14],g=e[15],c=e[16],N=e[17],I=e[18];if(I!==Symbol.for("react.early_return_sentinel"))return I;let P;e[49]!==u?(P=t.jsx("div",{className:u}),e[49]=u,e[50]=P):P=e[50];let T;e[51]!==n?(T=t.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=T):T=e[52];let A;e[53]!==P||e[54]!==T||e[55]!==C?(A=t.jsxs("div",{className:C,children:[P,T]}),e[53]=P,e[54]=T,e[55]=C,e[56]=A):A=e[56];let O;e[57]!==w||e[58]!==A?(O=t.jsx(w,{children:A}),e[57]=w,e[58]=A,e[59]=O):O=e[59];let L;e[60]!==d||e[61]!==O||e[62]!==x||e[63]!==j?(L=t.jsx(d,{size:x,className:j,children:O}),e[60]=d,e[61]=O,e[62]=x,e[63]=j,e[64]=L):L=e[64];let y;if(e[65]!==i||e[66]!==h){let v;e[68]!==i?(v=m=>{const M=i.get(m.role)??"bg-neutral-400";return t.jsx(os,{value:m.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:re("size-3 rounded-full",M)}),t.jsx("span",{className:"capitalize",children:m.label})]})},m.role)},e[68]=i,e[69]=v):v=e[69],y=h.map(v),e[65]=i,e[66]=h,e[67]=y}else y=e[67];let _;e[70]!==y?(_=t.jsx(is,{children:y}),e[70]=y,e[71]=_):_=e[71];let z;return e[72]!==S||e[73]!==L||e[74]!==_||e[75]!==g||e[76]!==c||e[77]!==N?(z=t.jsxs(S,{value:g,onValueChange:c,disabled:N,children:[L,_]}),e[72]=S,e[73]=L,e[74]=_,e[75]=g,e[76]=c,e[77]=N,e[78]=z):z=e[78],z}function vs(s){const e=de.c(51),{member:n,roles:o,onChangeRole:a,onRemove:i,isUpdating:h}=s,l=h===void 0?!1:h,p=n.role==="owner";let E,f,w,d,S,u,C,x,j;if(e[0]!==p||e[1]!==l||e[2]!==n.id||e[3]!==n.role||e[4]!==a||e[5]!==o){let L;e[15]!==n.role?(L=m=>m.role!==n.role&&m.role!=="owner",e[15]=n.role,e[16]=L):L=e[16];const y=o.filter(L);d=as;let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(Rs,{size:20}),e[17]=_):_=e[17],e[18]!==p?(j=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:p,onClick:Bt,children:_})}),e[18]=p,e[19]=j):j=e[19],w=ds,C="end",x=Dt,f=Zs;let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(_s,{size:16}),e[20]=z):z=e[20],e[21]!==l?(u=t.jsxs(Ys,{disabled:l,children:[z,"Change Role"]}),e[21]=l,e[22]=u):u=e[22],E=Ws;let v;e[23]!==l||e[24]!==n.id||e[25]!==a?(v=m=>{const M=[];return m.isBuiltin||(m.allowsAllStaticPermissions?M.push("Full org access"):m.staticPermissionCount&&m.staticPermissionCount>0&&M.push(`${m.staticPermissionCount} org perm${m.staticPermissionCount!==1?"s":""}`),m.allowsAllConnections?M.push("All connections"):m.connectionCount&&m.connectionCount>0&&M.push(`${m.connectionCount} connection${m.connectionCount!==1?"s":""}`),(m.connectionCount!==0||m.allowsAllConnections)&&(m.allowsAllTools?M.push("all tools"):m.toolCount&&m.toolCount>0&&M.push(`${m.toolCount} tool${m.toolCount!==1?"s":""}`))),t.jsxs(Ke,{onClick:V=>{V.stopPropagation(),a(n.id,m.role)},disabled:l,children:[m.isBuiltin?t.jsx(ms,{size:16}):t.jsx(ot,{size:16}),t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{children:m.label}),!m.isBuiltin&&M.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:M.join(", ")})]})]},m.role)},e[23]=l,e[24]=n.id,e[25]=a,e[26]=v):v=e[26],S=y.map(v),e[0]=p,e[1]=l,e[2]=n.id,e[3]=n.role,e[4]=a,e[5]=o,e[6]=E,e[7]=f,e[8]=w,e[9]=d,e[10]=S,e[11]=u,e[12]=C,e[13]=x,e[14]=j}else E=e[6],f=e[7],w=e[8],d=e[9],S=e[10],u=e[11],C=e[12],x=e[13],j=e[14];let g;e[27]!==E||e[28]!==S?(g=t.jsx(E,{children:S}),e[27]=E,e[28]=S,e[29]=g):g=e[29];let c;e[30]!==f||e[31]!==u||e[32]!==g?(c=t.jsxs(f,{children:[u,g]}),e[30]=f,e[31]=u,e[32]=g,e[33]=c):c=e[33];let N;e[34]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Hs,{}),e[34]=N):N=e[34];let I;e[35]!==n.id||e[36]!==i?(I=L=>{L.stopPropagation(),i(n.id)},e[35]=n.id,e[36]=i,e[37]=I):I=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(As,{size:16}),e[38]=P):P=e[38];let T;e[39]!==I?(T=t.jsxs(Ke,{variant:"destructive",onClick:I,children:[P,"Remove Member"]}),e[39]=I,e[40]=T):T=e[40];let A;e[41]!==w||e[42]!==T||e[43]!==C||e[44]!==x||e[45]!==c?(A=t.jsxs(w,{align:C,onClick:x,children:[c,N,T]}),e[41]=w,e[42]=T,e[43]=C,e[44]=x,e[45]=c,e[46]=A):A=e[46];let O;return e[47]!==d||e[48]!==A||e[49]!==j?(O=t.jsxs(d,{children:[j,A]}),e[47]=d,e[48]=A,e[49]=j,e[50]=O):O=e[50],O}function Dt(s){return s.stopPropagation()}function Bt(s){return s.stopPropagation()}function Es(s){const e=de.c(8),{invitationId:n,onCancel:o,isCancelling:a}=s,i=a===void 0?!1:a;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Gt,children:t.jsx(Rs,{size:20})})}),e[0]=h):h=e[0];let l;e[1]!==n||e[2]!==o?(l=f=>{f.stopPropagation(),o(n)},e[1]=n,e[2]=o,e[3]=l):l=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(lt,{size:16}),e[4]=p):p=e[4];let E;return e[5]!==i||e[6]!==l?(E=t.jsxs(as,{children:[h,t.jsx(ds,{align:"end",onClick:Ut,children:t.jsxs(Ke,{variant:"destructive",onClick:l,disabled:i,children:[p,"Cancel Invitation"]})})]}),e[5]=i,e[6]=l,e[7]=E):E=e[7],E}function Ut(s){return s.stopPropagation()}function Gt(s){return s.stopPropagation()}function Vt(){const s=de.c(74),{data:e}=ls(),{data:n}=Rt(),o=_t(),a=qe(),{locator:i}=je(),[h,l]=G.useState(null),[p,E]=G.useState(null),[f,w]=G.useState(""),[d,S]=G.useState("table"),[u,C]=G.useState("member"),[x,j]=G.useState("asc"),g=e?.data?.members;let c;s[0]!==u?(c=R=>{u===R?j(sn):(C(R),j("asc"))},s[0]=u,s[1]=c):c=s[1];const N=c;let I=g??[],P=n??[];if(f){const R=f.toLowerCase();I=I.filter(U=>U.user?.name?.toLowerCase().includes(R)||U.user?.email?.toLowerCase().includes(R)||U.role?.toLowerCase().includes(R)),P=P.filter(U=>U.email?.toLowerCase().includes(R)||U.role?.toLowerCase().includes(R))}if(u&&x){let R;s[2]!==x||s[3]!==u?(R=(U,H)=>{let ce,Ne;e:switch(u){case"member":{ce=U.user?.name||"",Ne=H.user?.name||"";break e}case"role":{ce=U.role||"",Ne=H.role||"";break e}case"joined":{ce=U.createdAt?typeof U.createdAt=="string"?U.createdAt:U.createdAt.toISOString():"",Ne=H.createdAt?typeof H.createdAt=="string"?H.createdAt:H.createdAt.toISOString():"";break e}default:return 0}return x==="asc"?ce.localeCompare(Ne):Ne.localeCompare(ce)},s[2]=x,s[3]=u,s[4]=R):R=s[4],I=[...I].sort(R)}const T=I;let A;s[5]!==i||s[6]!==a?(A={mutationFn:en,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(i)}),X.success("Member has been removed from the organization"),l(null)},onError:Jt},s[5]=i,s[6]=a,s[7]=A):A=s[7];const O=fe(A);let L;s[8]!==i||s[9]!==a?(L={mutationFn:Xt,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(i)}),X.success("Member's role has been updated")},onError:Ht},s[8]=i,s[9]=a,s[10]=L):L=s[10];const y=fe(L);let _;s[11]!==i||s[12]!==a?(_={mutationFn:Wt,onSuccess:()=>{a.invalidateQueries({queryKey:le.invitations(i)}),X.success("Invitation role has been updated")},onError:Yt},s[11]=i,s[12]=a,s[13]=_):_=s[13];const z=fe(_),{roles:v,customRoles:m}=us();let M;s[14]!==m?(M=zt(m),s[14]=m,s[15]=M):M=s[15];const V=M;let se;s[16]!==v?(se=v.filter(Zt),s[16]=v,s[17]=se):se=s[17];const F=se;let K;s[18]===Symbol.for("react.memo_cache_sentinel")?(K={id:"member",header:"Member",render:qt,cellClassName:"flex-1 min-w-0",sortable:!0},s[18]=K):K=s[18];let Q;s[19]!==V||s[20]!==F||s[21]!==z||s[22]!==y?(Q={id:"role",header:"Role",render:R=>R.type==="member"?t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:R.data.role==="owner",roleColorMap:V,selectableRoles:F,onRoleChange:(U,H)=>y.mutate({memberId:U,role:H}),className:"w-36"}):t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:!1,roleColorMap:V,selectableRoles:F,onRoleChange:(U,H)=>z.mutate({invitationId:U,role:H,email:R.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},s[19]=V,s[20]=F,s[21]=z,s[22]=y,s[23]=Q):Q=s[23];let Y;s[24]===Symbol.for("react.memo_cache_sentinel")?(Y={id:"joined",header:"Joined",render:Qt,cellClassName:"w-48 shrink-0",sortable:!0},s[24]=Y):Y=s[24];let ne;s[25]!==o.cancel.isPending||s[26]!==v||s[27]!==y?(ne={id:"actions",header:"",render:R=>R.type==="member"?t.jsx(vs,{member:R.data,roles:v,onChangeRole:(U,H)=>y.mutate({memberId:U,role:H}),onRemove:l,isUpdating:y.isPending}):t.jsx(Es,{invitationId:R.data.id,onCancel:E,isCancelling:o.cancel.isPending}),cellClassName:"w-12 shrink-0"},s[25]=o.cancel.isPending,s[26]=v,s[27]=y,s[28]=ne):ne=s[28];let te;s[29]!==Q||s[30]!==ne?(te=[K,Q,Y,ne],s[29]=Q,s[30]=ne,s[31]=te):te=s[31];const D=te;let r;s[32]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Tt,{trigger:t.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[t.jsx(ms,{size:16}),"Manage Roles"]})}),s[32]=r):r=s[32];let b;s[33]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs("div",{className:"flex items-center gap-2",children:[r,t.jsx(At,{trigger:t.jsx(ee,{size:"sm",children:"Invite Member"})})]}),s[33]=b):b=s[33];const $=b,oe=[...T.map(Kt),...P.filter(Ft).map($t)],ie=es,W=!!p;let q;s[34]===Symbol.for("react.memo_cache_sentinel")?(q=()=>E(null),s[34]=q):q=s[34];let me;s[35]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsxs(Se,{children:[t.jsx(Ie,{children:"Cancel Invitation"}),t.jsx(Te,{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 k;s[36]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Oe,{children:"Keep Invitation"}),s[36]=k):k=s[36];let B;s[37]!==o.cancel||s[38]!==p?(B=()=>{p&&(o.cancel.mutate(p),E(null))},s[37]=o.cancel,s[38]=p,s[39]=B):B=s[39];let Z;s[40]!==o.cancel.isPending||s[41]!==B?(Z=t.jsxs(ye,{children:[me,t.jsxs(we,{children:[k,t.jsx(Ae,{onClick:B,disabled:o.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),s[40]=o.cancel.isPending,s[41]=B,s[42]=Z):Z=s[42];let ae;s[43]!==W||s[44]!==Z?(ae=t.jsx(Ee,{open:W,onOpenChange:q,children:Z}),s[43]=W,s[44]=Z,s[45]=ae):ae=s[45];const Ye=!!h;let Me;s[46]===Symbol.for("react.memo_cache_sentinel")?(Me=()=>l(null),s[46]=Me):Me=s[46];let ze;s[47]===Symbol.for("react.memo_cache_sentinel")?(ze=t.jsxs(Se,{children:[t.jsx(Ie,{children:"Remove Member"}),t.jsx(Te,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),s[47]=ze):ze=s[47];let ke;s[48]===Symbol.for("react.memo_cache_sentinel")?(ke=t.jsx(Oe,{children:"Cancel"}),s[48]=ke):ke=s[48];let he;s[49]!==h||s[50]!==O?(he=()=>h&&O.mutate(h),s[49]=h,s[50]=O,s[51]=he):he=s[51];let ge;s[52]!==O.isPending||s[53]!==he?(ge=t.jsxs(ye,{children:[ze,t.jsxs(we,{children:[ke,t.jsx(Ae,{onClick:he,disabled:O.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),s[52]=O.isPending,s[53]=he,s[54]=ge):ge=s[54];let pe;s[55]!==Ye||s[56]!==ge?(pe=t.jsx(Ee,{open:Ye,onOpenChange:Me,children:ge}),s[55]=Ye,s[56]=ge,s[57]=pe):pe=s[57];let De;s[58]===Symbol.for("react.memo_cache_sentinel")?(De=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],s[58]=De):De=s[58];let xe;s[59]!==N||s[60]!==x||s[61]!==u||s[62]!==d?(xe=t.jsx(Bs,{title:"Members",viewMode:d,onViewModeChange:S,sortKey:u,sortDirection:x,onSort:N,sortOptions:De,ctaButton:$}),s[59]=N,s[60]=x,s[61]=u,s[62]=d,s[63]=xe):xe=s[63];let Be;s[64]===Symbol.for("react.memo_cache_sentinel")?(Be=R=>{R.key==="Escape"&&(w(""),R.target.blur())},s[64]=Be):Be=s[64];let be;s[65]!==f?(be=t.jsx(Ze,{value:f,onChange:w,placeholder:"Search members...",onKeyDown:Be}),s[65]=f,s[66]=be):be=s[66];const We=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:oe.length===0?t.jsx(Xe,{title:"No members found",description:f?`No members match "${f}"`:"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(R=>{if(R.type==="invitation")return t.jsxs(Cs,{className:"transition-colors relative opacity-75",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(Es,{invitationId:R.data.id,onCancel:E,isCancelling:o.cancel.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ce,{fallback:Qe(R.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:R.data.email}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(ve,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:!1,roleColorMap:V,selectableRoles:F,onRoleChange:(H,ce)=>z.mutate({invitationId:H,role:ce,email:R.data.email}),className:"w-fit"})]})]})]},`inv-${R.data.id}`);const U=R.data;return t.jsxs(Cs,{className:"transition-colors relative",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(vs,{member:U,roles:v,onChangeRole:(H,ce)=>y.mutate({memberId:H,role:ce}),onRemove:l,isUpdating:y.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ce,{url:U.user?.image??void 0,fallback:Qe(U.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:U.user?.name||"Unknown"}),t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:U.user?.email}),t.jsx(Fe,{role:U.role,memberId:U.id,isOwner:U.role==="owner",roleColorMap:V,selectableRoles:F,onRoleChange:(H,ce)=>y.mutate({memberId:H,role:ce}),className:"w-fit"})]})]})]},U.id)})})}):t.jsx(Us,{columns:D,data:oe,isLoading:!1,sortKey:u,sortDirection:x,onSort:N,emptyState:f?t.jsx(Xe,{title:"No members found",description:`No members match "${f}"`}):t.jsx(Xe,{title:"No members found",description:"Invite members to get started."})});let Ue;return s[67]!==ie||s[68]!==ae||s[69]!==pe||s[70]!==xe||s[71]!==be||s[72]!==We?(Ue=t.jsxs(ie,{children:[ae,pe,xe,be,We]}),s[67]=ie,s[68]=ae,s[69]=pe,s[70]=xe,s[71]=be,s[72]=We,s[73]=Ue):Ue=s[73],Ue}function $t(s){return{type:"invitation",data:s}}function Ft(s){return s.status==="pending"}function Kt(s){return{type:"member",data:s}}function Qt(s){return s.type==="member"?t.jsx("span",{className:"text-sm text-foreground",children:s.data.createdAt?kt(s.data.createdAt):"N/A"}):t.jsx(ve,{variant:"outline",children:"Pending"})}function qt(s){return s.type==="member"?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ce,{url:s.data.user?.image??void 0,fallback:Qe(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(Ce,{fallback:Qe(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 Zt(s){return s.role!=="owner"}function Yt(s){X.error(s instanceof Error?s.message:"Failed to update invitation role")}async function Wt(s){const{invitationId:e,role:n,email:o}=s,a=await J.organization.cancelInvitation({invitationId:e});if(a?.error)throw new Error(a.error.message);const i=await J.organization.inviteMember({email:o,role:n});if(i?.error)throw new Error(i.error.message)}function Ht(s){X.error(s instanceof Error?s.message:"Failed to update role")}async function Xt(s){const{memberId:e,role:n}=s,o=await J.organization.updateMemberRole({memberId:e,role:[n]});if(o?.error)throw new Error(o.error.message)}function Jt(s){X.error(s instanceof Error?s.message:"Failed to remove member")}async function en(s){const e=await J.organization.removeMember({memberIdOrEmail:s});if(e?.error)throw new Error(e.error.message)}function sn(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Hn(){const s=de.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(es,{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(st,{fallback:e,children:t.jsx(G.Suspense,{fallback:t.jsx(es,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Os,{size:32,className:"animate-spin text-muted-foreground"})})}),children:t.jsx(Vt,{})})}),s[1]=n):n=s[1],n}export{Hn as default};