@decocms/mesh 2.12.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-Cso_Xxvk.js → AlertCircle-CtP28Oyz.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BrsZ2N_5.js → ArrowLeft-Bps-R0_t.js} +1 -1
- package/dist/client/assets/{Check-JFkjTCfG.js → Check-Bkw0Gz-n.js} +1 -1
- package/dist/client/assets/{ChevronDown-HtFMO0lw.js → ChevronDown-mvTJP4-S.js} +1 -1
- package/dist/client/assets/{Clock-CW5u1cfj.js → Clock-DiHiAbv6.js} +1 -1
- package/dist/client/assets/{Code01-CgNchnl3.js → Code01-CTUZx8UP.js} +1 -1
- package/dist/client/assets/{Copy01-Dadp_RDG.js → Copy01-BctGx-5E.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-B0A7sUYv.js → DotsHorizontal-MMZ1EZhB.js} +1 -1
- package/dist/client/assets/{DotsVertical-BHUUUCDx.js → DotsVertical-CzCtj25W.js} +1 -1
- package/dist/client/assets/{Edit01-CxRkZTQ1.js → Edit01-BD5iJRQz.js} +1 -1
- package/dist/client/assets/{File06-D0TXCuMx.js → File06-nV81V8TD.js} +1 -1
- package/dist/client/assets/{FilterLines-_uykt7r4.js → FilterLines-CBfbdjv3.js} +1 -1
- package/dist/client/assets/{FlipBackward-GGMv99yc.js → FlipBackward-CpWoOBPz.js} +1 -1
- package/dist/client/assets/{GitBranch01-BUTuezlq.js → GitBranch01-DWYSSAGj.js} +1 -1
- package/dist/client/assets/{Grid01-BbdtRdR8.js → Grid01-BEpepbVy.js} +1 -1
- package/dist/client/assets/{Inbox01-CgwXLK3n.js → Inbox01-DkMyh-FB.js} +1 -1
- package/dist/client/assets/{InfoCircle-D6qJG9Nl.js → InfoCircle-BXctEVkS.js} +1 -1
- package/dist/client/assets/{Key01-8ewaPBuD.js → Key01-ChIWeKNh.js} +1 -1
- package/dist/client/assets/{LinkExternal01-D0Wjfr3t.js → LinkExternal01-By7zx70s.js} +1 -1
- package/dist/client/assets/{Loading01-NW_f44Lz.js → Loading01-CdaWSExX.js} +1 -1
- package/dist/client/assets/{Lock01-BTPtPjN4.js → Lock01-txD_UwBx.js} +1 -1
- package/dist/client/assets/{Play-CIMfsFF1.js → Play-CjVz5-Yt.js} +1 -1
- package/dist/client/assets/{Plus-DaP4KLuJ.js → Plus-CovnOzP9.js} +1 -1
- package/dist/client/assets/{SearchMd-tOSOFUes.js → SearchMd-YxKkBPG0.js} +1 -1
- package/dist/client/assets/{Terminal-ANRX3jJ8.js → Terminal-DYwA22tz.js} +1 -1
- package/dist/client/assets/{Trash01-CjDzx3jP.js → Trash01-DopdNXEu.js} +1 -1
- package/dist/client/assets/{X-D3ljCSd1.js → X-DcqsnRSe.js} +1 -1
- package/dist/client/assets/{XClose-Ba3zyI0J.js → XClose-D0utLGU3.js} +1 -1
- package/dist/client/assets/{alert-dialog-_Gzpv9vf.js → alert-dialog-B2ogXLEp.js} +1 -1
- package/dist/client/assets/{auth-C9dSkS_x.js → auth-CNkA6dk2.js} +1 -1
- package/dist/client/assets/{auth-catchall-DRL5ZGJM.js → auth-catchall-BG5YjEP_.js} +1 -1
- package/dist/client/assets/{avatar-D1o5pnzU.js → avatar-KT16fAYd.js} +1 -1
- package/dist/client/assets/{badge-0b6sJe4S.js → badge-8BCP2QJ_.js} +1 -1
- package/dist/client/assets/{card-B3fsloDi.js → card-XgDm8_H9.js} +1 -1
- package/dist/client/assets/{checkbox-2xIaHvS4.js → checkbox-B9Ss6ffk.js} +1 -1
- package/dist/client/assets/{collection-detail-Bu5gtjud.js → collection-detail-BJvqsPlx.js} +1 -1
- package/dist/client/assets/{collection-display-button-BGIcja12.js → collection-display-button-DroTLKfu.js} +1 -1
- package/dist/client/assets/{collection-header-DhWbmVkk.js → collection-header-CUphFaJM.js} +1 -1
- package/dist/client/assets/{collection-page-B4ZjGX9V.js → collection-page-C8c74lBQ.js} +1 -1
- package/dist/client/assets/{collection-search-CYZk6T6Z.js → collection-search-DIEJ7x7R.js} +1 -1
- package/dist/client/assets/{collection-tab-IeT0mJ-2.js → collection-tab-BQr3sv8I.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-D2niE2Ci.js → collection-table-wrapper-x8zydyA0.js} +1 -1
- package/dist/client/assets/{connection-card-D0c_wvmz.js → connection-card-CTMXB5Zh.js} +1 -1
- package/dist/client/assets/{connection-detail-BmNPUV8x.js → connection-detail-BU82m59Z.js} +1 -1
- package/dist/client/assets/{connections-U2y3agtD.js → connections-B-zsqKwM.js} +1 -1
- package/dist/client/assets/constants-8DEiLmV-.js +1 -0
- package/dist/client/assets/{create-organization-dialog-D0WQQsLG.js → create-organization-dialog-CHS4cOdy.js} +1 -1
- package/dist/client/assets/{dialog-BXeLl5mO.js → dialog-D9LHhl79.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CnL8UM0z.js → dropdown-menu-DjFWyTtD.js} +1 -1
- package/dist/client/assets/{empty-state-BmkZOMzL.js → empty-state-DSGxvcRL.js} +1 -1
- package/dist/client/assets/{empty-state-DzS1Zp7m.js → empty-state-DgOO5bI1.js} +1 -1
- package/dist/client/assets/env-vars-editor-mM2KyO-W.js +1 -0
- package/dist/client/assets/{error-boundary-BQnJ9S9E.js → error-boundary-uBvOVTCE.js} +1 -1
- package/dist/client/assets/extract-connection-data-DMhfaAiL.js +1 -0
- package/dist/client/assets/{form-DrOt6d2d.js → form-orY-xngM.js} +1 -1
- package/dist/client/assets/{gateway-detail-CniDbJPb.js → gateway-detail-Bnl2H9_J.js} +1 -1
- package/dist/client/assets/{gateways-DmEpJOpx.js → gateways-RS5E135D.js} +1 -1
- package/dist/client/assets/{home-HrkEcREJ.js → home-HRdtfNlr.js} +1 -1
- package/dist/client/assets/index-9MwexYU6.css +1 -0
- package/dist/client/assets/{index-CBIrwxtj.js → index-BuPukvJG.js} +3 -3
- package/dist/client/assets/{index-DMNk-OUX.js → index-Bz1LU39D.js} +2 -2
- package/dist/client/assets/{index-XOpbMEap.js → index-Cw3bkeXO.js} +1 -1
- package/dist/client/assets/{index-GoXtajA4.js → index-K2EwRRk6.js} +2 -2
- package/dist/client/assets/{index-Bb8rHnPb.js → index-o28bnKR9.js} +1 -1
- package/dist/client/assets/{input-68J17rBp.js → input-CtiQUsvV.js} +1 -1
- package/dist/client/assets/{layout-Olb4shdE.js → layout-C8G6tSLB.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-Ccgc_fxj.js → lazy-highlighter-C5pGkBnk.js} +1 -1
- package/dist/client/assets/localstorage-keys-5oG1CfEQ.js +1 -0
- package/dist/client/assets/{login-UTKAAaeX.js → login-BvQHpiOu.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Db8WtQ8u.js → mcp-oauth-BzcB2WNx.js} +1 -1
- package/dist/client/assets/mcp-server-card-BawKO-ZK.js +1 -0
- package/dist/client/assets/mcp-server-detail-CxrhH1J8.js +1 -0
- package/dist/client/assets/{members-V-vtwMYY.js → members-C0iWKqGR.js} +1 -1
- package/dist/client/assets/{monaco-editor-B_MycISs.js → monaco-editor-BmVBfnK5.js} +1 -1
- package/dist/client/assets/{monitoring-CBmCnQ7i.js → monitoring-7ik3wQUY.js} +1 -1
- package/dist/client/assets/{oauth-callback-BYBqbF1w.js → oauth-callback-Coasa0XK.js} +1 -1
- package/dist/client/assets/page-DsAOPS13.js +1 -0
- package/dist/client/assets/{page-DrIZd1pO.js → page-yu9K5Vtj.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-B1xHHS9n.js → pin-to-sidebar-button-C-akIZzz.js} +1 -1
- package/dist/client/assets/{popover-DC9U4d6e.js → popover-QWczrvYc.js} +1 -1
- package/dist/client/assets/{project-context-provider-BJIP5a-U.js → project-context-provider-_aLYBfO9.js} +1 -1
- package/dist/client/assets/registry-utils-BIzwINzW.js +1 -0
- package/dist/client/assets/{resizable-CW5_SPIS.js → resizable-djk090hC.js} +1 -1
- package/dist/client/assets/{resource-tabs-BKSlcL1W.js → resource-tabs-GXDudjH9.js} +1 -1
- package/dist/client/assets/{select-B9KJyTZZ.js → select-Bxj6_TSM.js} +1 -1
- package/dist/client/assets/{settings-CYg4YPRI.js → settings-0nIjjKRi.js} +1 -1
- package/dist/client/assets/{shell-layout-KIN6fL5j.js → shell-layout-BFIjeoYr.js} +1 -1
- package/dist/client/assets/{spinner-B0sczm1j.js → spinner-C7HX4n17.js} +1 -1
- package/dist/client/assets/{switch-BuVvmF04.js → switch-zovYrKoi.js} +1 -1
- package/dist/client/assets/{textarea-BAUX8Qgd.js → textarea-D76YOeHc.js} +1 -1
- package/dist/client/assets/{thread-history-popover-Dv63nk6L.js → thread-history-popover-BKo2wskT.js} +1 -1
- package/dist/client/assets/{tool-set-selector-DMsE0yRo.js → tool-set-selector-Dfdgsx2h.js} +1 -1
- package/dist/client/assets/{tools-list-Dgf0oqyC.js → tools-list-C2S7XIkI.js} +1 -1
- package/dist/client/assets/{use-binding-Dj4lal1A.js → use-binding-UNVemCFv.js} +1 -1
- package/dist/client/assets/{use-connection-DoWszS3j.js → use-connection-BXdeHsm0.js} +1 -1
- package/dist/client/assets/{use-connection-resources-BywYCfzc.js → use-connection-resources-C8cAy7Nl.js} +1 -1
- package/dist/client/assets/{use-create-gateway-Ca5SEa8I.js → use-create-gateway-D8vNiD2K.js} +1 -1
- package/dist/client/assets/{use-gateway-CRpsitbG.js → use-gateway-BhC1hXIm.js} +1 -1
- package/dist/client/assets/{use-gateway-system-prompt-B4ia2QxW.js → use-gateway-system-prompt-uetw6YB3.js} +1 -1
- package/dist/client/assets/{use-list-state-CPUcOhR_.js → use-list-state-CAv4RNZg.js} +1 -1
- package/dist/client/assets/{use-mcp-L2lisTXg.js → use-mcp-kCjFuvFP.js} +1 -1
- package/dist/client/assets/{use-members-7eRdYOTr.js → use-members-9nvpFN_1.js} +1 -1
- package/dist/client/assets/{use-mobile--ytA5LT5.js → use-mobile-sd5ko6M_.js} +1 -1
- package/dist/client/assets/{use-organization-settings-D6rXW2c_.js → use-organization-settings-DBRSoBd0.js} +1 -1
- package/dist/client/assets/{use-tool-call-BBonHr6l.js → use-tool-call-BLplGau6.js} +1 -1
- package/dist/client/assets/{value-Bd2XBV_y.js → value-DxHsXzsm.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BpjQ6V4P.js → view-mode-toggle-CVcyaB_S.js} +1 -1
- package/dist/client/assets/{workflow-CjynHD6b.js → workflow-BUV3CQv_.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/constants-Cy709IUA.js +0 -1
- package/dist/client/assets/env-vars-editor-B_mIaT86.js +0 -1
- package/dist/client/assets/extract-connection-data-DPoJQhk8.js +0 -1
- package/dist/client/assets/index-ChrSnaFS.css +0 -1
- package/dist/client/assets/localstorage-keys-C62ZbWuB.js +0 -1
- package/dist/client/assets/mcp-server-detail-BvVQovUz.js +0 -1
- package/dist/client/assets/page-DYF0Qz3l.js +0 -1
- package/dist/client/assets/registry-utils-B7t_ZBUi.js +0 -1
- package/dist/client/assets/server-name-C3ttWdyD.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as ge,j as e,r as M,f as xe,b as je,a as fe,u as ye,y as ve,x as _e,v as oe,V as Ce,w as y,$ as ke}from"./index-DMNk-OUX.js";import{C as Ne}from"./collection-header-DhWbmVkk.js";import{C as Se}from"./collection-page-B4ZjGX9V.js";import{C as we}from"./collection-search-CYZk6T6Z.js";import{C as Te}from"./collection-table-wrapper-D2niE2Ci.js";import{C as De}from"./connection-card-D0c_wvmz.js";import{n as O,E as B,c as be,I as Pe}from"./empty-state-DzS1Zp7m.js";import{E as Ie}from"./error-boundary-BQnJ9S9E.js";import{a as Ve,u as $e}from"./use-connection-DoWszS3j.js";import{a as Ee}from"./use-binding-Dj4lal1A.js";import{u as Ae,s as Q}from"./use-list-state-CPUcOhR_.js";import{u as Fe}from"./project-context-provider-BJIP5a-U.js";import{f as He,a as Oe,b as Be,c as ze,d as Me,e as Re,A as Ue,g as Xe}from"./alert-dialog-_Gzpv9vf.js";import{B as Le}from"./badge-0b6sJe4S.js";import{I as k,B as _}from"./input-68J17rBp.js";import{d as We,c as Ke,a as Ge,D as qe,g as Ye,f as Qe}from"./dialog-BXeLl5mO.js";import{b as J,D as Z,a as ee,c as $}from"./dropdown-menu-CnL8UM0z.js";import{a as Je,F as h,b as g,c as x,d as j,f}from"./form-DrOt6d2d.js";import{i as te}from"./DotsVertical-BHUUUCDx.js";import{i as Ze,r as et,s as z,E as tt,e as re}from"./env-vars-editor-B_mIaT86.js";import{i as nt}from"./Loading01-NW_f44Lz.js";import{i as st}from"./Terminal-ANRX3jJ8.js";import{s as ne}from"./Trash01-CjDzx3jP.js";import{S as ot,a as rt,b as it,c as at,d as P}from"./select-B9KJyTZZ.js";import{T as ct}from"./textarea-BAUX8Qgd.js";import{g as lt}from"./generate-id-Dyweu44Y.js";import{a as dt}from"./use-tool-call-BBonHr6l.js";import{f as ut,e as mt}from"./registry-utils-B7t_ZBUi.js";import"./collection-display-button-BGIcja12.js";import"./Grid01-BbdtRdR8.js";import"./Check-JFkjTCfG.js";import"./view-mode-toggle-BpjQ6V4P.js";import"./SearchMd-tOSOFUes.js";import"./card-B3fsloDi.js";import"./auth-C9dSkS_x.js";import"./use-mobile--ytA5LT5.js";import"./X-D3ljCSd1.js";import"./Plus-DaP4KLuJ.js";import"./ChevronDown-HtFMO0lw.js";const pt=oe({key:y(),value:y()}),ht=oe({title:y().min(1,"Name is required"),description:y().nullable().optional(),ui_type:ke(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:y().optional(),connection_token:y().nullable().optional(),npx_package:y().optional(),stdio_command:y().optional(),stdio_args:y().optional(),stdio_cwd:y().optional(),env_vars:Ce(pt).optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function A(n){const o=n.trim();if(!o)return"";try{const i=new URL(o),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return o.replace(/\/+$/,"")}}function gt(n){const o=n.trim().split(/\s+/).filter(Boolean);if(o.length<2)return null;const i=o[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const m=o.slice(1).find(a=>!a.startsWith("-"));return m?{packageName:m}:null}function E(n){const{uiType:o}=n,i=A(n.connectionUrl??"");if((o==="HTTP"||o==="SSE"||o==="Websocket")&&i===A("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(n.npxPackage??"").trim();return o==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function se(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const o=A(n.connectionUrl??"");if(!o)return null;const i=n.registryItems.find(a=>(a.server?.remotes??[]).some(N=>A(N.url??"")===o));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",m=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:m}:null}function xt(n,o){const i={command:"npx",args:["-y",n]},d=re(o);return Object.keys(d).length>0&&(i.envVars=d),i}function jt(n,o,i,d){const m={command:n};o.trim()&&(m.args=o.trim().split(/\s+/)),i?.trim()&&(m.cwd=i.trim());const a=re(d);return Object.keys(a).length>0&&(m.envVars=a),m}function ft(n){return n.command==="npx"}function yt(n){return n.args?.find(o=>!o.startsWith("-"))??""}function vt(n){return{command:n.command,args:n.args?.join(" ")??"",cwd:n.cwd??""}}function _t(n,o){switch(o.type){case"edit":return{mode:"editing",connection:o.connection};case"delete":return{mode:"deleting",connection:o.connection};case"close":return{mode:"idle"}}}function Ct(){const{org:n}=Fe(),o=xe(),i=je({strict:!1}),{data:d}=fe.useSession(),{stdioEnabled:m}=ye(),a=Ae({namespace:n.slug,resource:"connections"}),I=Ve(),N=$e(a),[v,S]=M.useReducer(_t,{mode:"idle"}),R=Ee(N)[0],F=R?.id??"",U=ut(R?.tools),ie=be(F||void 0),{data:ae}=dt({toolCaller:ie,toolName:U,toolInputParams:{limit:200},scope:F,enabled:!!(F&&U),staleTime:3600*1e3}),X=mt(ae??[]),L=i.action==="create",ce=()=>{o({to:"/$org/mcps",params:{org:n.slug},search:{action:"create"}})},W=()=>{o({to:"/$org/mcps",params:{org:n.slug},search:{}})},r=ve({resolver:_e(ht),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),u=r.watch("ui_type"),K=r.watch("connection_url"),le=r.watch("npx_package"),D=E({uiType:u,connectionUrl:K??"",npxPackage:le??""})??se({uiType:u,connectionUrl:K??"",registryItems:X}),l=v.mode==="editing"?v.connection:null;M.useEffect(()=>{if(l){const t=Ze(l.connection_headers)?l.connection_headers:null;if(t&&l.connection_type==="STDIO"){const s=et(t.envVars);if(ft(t)){const c=yt(t);r.reset({title:l.title,description:l.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:s})}else{const c=vt(t);r.reset({title:l.title,description:l.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:c.command,stdio_args:c.args,stdio_cwd:c.cwd,env_vars:s})}}else r.reset({title:l.title,description:l.description,ui_type:l.connection_type,connection_url:l.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[l,r]);const de=async()=>{if(v.mode!=="deleting")return;const t=v.connection.id;S({type:"close"});try{await I.delete.mutateAsync(t)}catch{}},ue=async t=>{let s,c=null,w=null,C=null;if(t.ui_type==="NPX"?(s="STDIO",c="",C=xt(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(s="STDIO",c="",C=jt(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(s=t.ui_type,c=t.connection_url||"",w=t.connection_token||null),l){await I.update.mutateAsync({id:l.id,data:{title:t.title,description:t.description||null,connection_type:s,connection_url:c,...w&&{connection_token:w},...C&&{connection_headers:C}}}),S({type:"close"}),r.reset();return}const T=lt("conn");await I.create.mutateAsync({id:T,title:t.title,description:t.description||null,connection_type:s,connection_url:c,connection_token:w,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:d?.user?.id||"system",organization_id:n.id,icon:null,app_name:null,app_id:null,connection_headers:C,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),W(),r.reset(),o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:T}})},G=t=>{t||(L?W():S({type:"close"}),r.reset())},V=t=>{const s=t.trim();if(!s)return;const c=!!r.formState.dirtyFields.title,w=!!r.formState.dirtyFields.description,C=!!r.formState.dirtyFields.env_vars,T=p=>{if(p&&(!c&&!r.getValues("title").trim()&&p.title&&r.setValue("title",p.title,{shouldDirty:!1}),!w&&!(r.getValues("description")??"").trim()&&p.description&&r.setValue("description",p.description,{shouldDirty:!1}),!C&&p.envVarKeys?.length)){const q=r.getValues("env_vars")??[],he=new Set(q.map(b=>b.key)),Y=p.envVarKeys.filter(b=>!he.has(b));Y.length>0&&r.setValue("env_vars",[...q,...Y.map(b=>({key:b,value:""}))],{shouldDirty:!0})}},H=gt(s);if(H&&m){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",H.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),T(E({uiType:"NPX",npxPackage:H.packageName}));return}if(s.startsWith("http://")||s.startsWith("https://")){const p=u==="HTTP"||u==="SSE"||u==="Websocket"?u:"HTTP";r.setValue("ui_type",p,{shouldDirty:!0}),r.setValue("connection_url",s,{shouldDirty:!0}),T(E({uiType:p,connectionUrl:s})??se({uiType:p,connectionUrl:s,registryItems:X}));return}u==="NPX"&&T(E({uiType:"NPX",npxPackage:s}))},me=[{id:"icon",header:"",render:t=>e.jsx(Pe,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(O,{})}),cellClassName:"w-16 shrink-0",wrap:!0},{id:"title",header:"Name",render:t=>e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title}),cellClassName:"w-48 max-w-48 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:t.description||"—"}),cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-sm font-medium",children:t.connection_type}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"connection_url",header:"URL",render:t=>{const s=t.connection_url??"",c=s.length>40?`${s.slice(0,40)}...`:s;return e.jsx("span",{className:"text-sm text-muted-foreground",children:c})},cellClassName:"w-48 min-w-0 shrink-0"},{id:"status",header:"Status",render:t=>e.jsx(Le,{variant:t.status==="active"?"success":"outline",children:t.status}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:s=>s.stopPropagation(),children:[e.jsxs($,{onClick:s=>{s.stopPropagation(),o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Inspect"]}),e.jsxs($,{variant:"destructive",onClick:s=>{s.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],pe=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>o({to:"/$org/store",params:{org:n.slug}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(_,{onClick:ce,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(Se,{children:[e.jsx(We,{open:L||v.mode==="editing",onOpenChange:G,children:e.jsxs(Ke,{className:"sm:max-w-[525px]",children:[e.jsxs(Ge,{children:[e.jsx(qe,{children:l?"Edit Connection":"Create Connection"}),e.jsx(Ye,{children:l?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(Je,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(ue),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(h,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Type *"}),e.jsxs(ot,{value:t.value,onValueChange:t.onChange,children:[e.jsx(j,{children:e.jsx(rt,{children:e.jsx(it,{})})}),e.jsxs(at,{children:[e.jsx(P,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx(P,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"SSE"]})}),e.jsx(P,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"Websocket"]})}),m&&e.jsxs(e.Fragment,{children:[e.jsx(P,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx(P,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(st,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(f,{})]})}),u==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(h,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"NPM Package *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:s=>{const c=s.clipboardData.getData("text");c&&(s.preventDefault(),r.setValue("npx_package",c.trim(),{shouldDirty:!0}),V(c))},onBlur:s=>{V(s.target.value),t.onBlur()}})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The npm package to run with npx"}),e.jsx(f,{})]})})}),u==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(h,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Command *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Arguments"}),e.jsx(j,{children:e.jsx(k,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Working Directory"}),e.jsx(j,{children:e.jsx(k,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(f,{})]})})]}),(u==="NPX"||u==="STDIO")&&e.jsx(h,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Environment Variables"}),e.jsx(j,{children:e.jsx(tt,{value:t.value??[],onChange:t.onChange})}),e.jsx(f,{})]})}),u!=="NPX"&&u!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(h,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"URL *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:s=>{const c=s.clipboardData.getData("text");c&&(s.preventDefault(),r.setValue("connection_url",c.trim(),{shouldDirty:!0}),V(c))},onBlur:s=>{V(s.target.value),t.onBlur()}})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:D?.token?.label??"Token (optional)"}),e.jsx(j,{children:e.jsx(k,{type:"password",placeholder:D?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),D?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[D.token.helperText,D.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"title",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Name *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"My Connection",...t})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"description",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Description"}),e.jsx(j,{children:e.jsx(ct,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsxs(Qe,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>G(!1),children:"Cancel"}),e.jsx(_,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":l?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(He,{open:v.mode==="deleting",onOpenChange:t=>!t&&S({type:"close"}),children:e.jsxs(Oe,{children:[e.jsxs(Be,{children:[e.jsx(ze,{children:"Delete Connection?"}),e.jsxs(Me,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:v.mode==="deleting"&&v.connection.title}),"."]})]}),e.jsxs(Re,{children:[e.jsx(Ue,{children:"Cancel"}),e.jsx(Xe,{onClick:de,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(Ne,{title:"Connections",viewMode:a.viewMode,onViewModeChange:a.setViewMode,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"status",label:"Status"}],ctaButton:pe}),e.jsx(we,{value:a.search,onChange:a.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(a.setSearch(""),t.target.blur())}}),a.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:N.length===0?e.jsx(B,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(a.search,"No Connections found"),description:a.search?`No Connections match "${a.search}"`:"Create a connection to get started.",actions:!a.search&&e.jsx(_,{variant:"outline",onClick:()=>o({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:N.map(t=>e.jsx(De,{connection:t,fallbackIcon:e.jsx(O,{}),onClick:()=>o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),headerActions:e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:s=>s.stopPropagation(),children:[e.jsxs($,{onClick:s=>{s.stopPropagation(),o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Inspect"]}),e.jsxs($,{variant:"destructive",onClick:s=>{s.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]})},t.id))})}):e.jsx(Te,{columns:me,data:N,isLoading:!1,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,onRowClick:t=>o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),emptyState:a.search?e.jsx(B,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${a.search}"`}):e.jsx(B,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(_,{variant:"outline",onClick:()=>o({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})})})]})}function ln(){const n=ge.c(1);let o;return n[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(Ie,{children:e.jsx(M.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(nt,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ct,{})})}),n[0]=o):o=n[0],o}export{ln as default};
|
|
1
|
+
import{c as ge,j as e,r as M,f as xe,b as je,a as fe,u as ye,y as ve,x as _e,v as oe,V as Ce,w as y,$ as ke}from"./index-Bz1LU39D.js";import{C as Ne}from"./collection-header-CUphFaJM.js";import{C as Se}from"./collection-page-C8c74lBQ.js";import{C as we}from"./collection-search-DIEJ7x7R.js";import{C as Te}from"./collection-table-wrapper-x8zydyA0.js";import{C as De}from"./connection-card-CTMXB5Zh.js";import{n as O,E as B,c as be,I as Pe}from"./empty-state-DgOO5bI1.js";import{E as Ie}from"./error-boundary-uBvOVTCE.js";import{a as Ve,u as $e}from"./use-connection-BXdeHsm0.js";import{a as Ee}from"./use-binding-UNVemCFv.js";import{u as Ae,s as Q}from"./use-list-state-CAv4RNZg.js";import{u as Fe}from"./project-context-provider-_aLYBfO9.js";import{f as He,a as Oe,b as Be,c as ze,d as Me,e as Re,A as Ue,g as Xe}from"./alert-dialog-B2ogXLEp.js";import{B as Le}from"./badge-8BCP2QJ_.js";import{I as k,B as _}from"./input-CtiQUsvV.js";import{d as We,c as Ke,a as Ge,D as qe,g as Ye,f as Qe}from"./dialog-D9LHhl79.js";import{b as J,D as Z,a as ee,c as $}from"./dropdown-menu-DjFWyTtD.js";import{a as Je,F as h,b as g,c as x,d as j,f}from"./form-orY-xngM.js";import{i as te}from"./DotsVertical-CzCtj25W.js";import{f as Ze,e as et,s as z}from"./registry-utils-BIzwINzW.js";import{i as tt}from"./Loading01-CdaWSExX.js";import{i as nt}from"./Terminal-DYwA22tz.js";import{s as ne}from"./Trash01-DopdNXEu.js";import{S as st,a as ot,b as rt,c as it,d as P}from"./select-Bxj6_TSM.js";import{T as at}from"./textarea-D76YOeHc.js";import{g as ct}from"./generate-id-Dyweu44Y.js";import{a as lt}from"./use-tool-call-BLplGau6.js";import{i as dt,r as ut,E as mt,e as re}from"./env-vars-editor-mM2KyO-W.js";import"./collection-display-button-DroTLKfu.js";import"./Grid01-BEpepbVy.js";import"./Check-Bkw0Gz-n.js";import"./view-mode-toggle-CVcyaB_S.js";import"./SearchMd-YxKkBPG0.js";import"./card-XgDm8_H9.js";import"./auth-CNkA6dk2.js";import"./use-mobile-sd5ko6M_.js";import"./X-DcqsnRSe.js";import"./ChevronDown-mvTJP4-S.js";import"./Plus-CovnOzP9.js";const pt=oe({key:y(),value:y()}),ht=oe({title:y().min(1,"Name is required"),description:y().nullable().optional(),ui_type:ke(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:y().optional(),connection_token:y().nullable().optional(),npx_package:y().optional(),stdio_command:y().optional(),stdio_args:y().optional(),stdio_cwd:y().optional(),env_vars:Ce(pt).optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function A(n){const o=n.trim();if(!o)return"";try{const i=new URL(o),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return o.replace(/\/+$/,"")}}function gt(n){const o=n.trim().split(/\s+/).filter(Boolean);if(o.length<2)return null;const i=o[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const m=o.slice(1).find(a=>!a.startsWith("-"));return m?{packageName:m}:null}function E(n){const{uiType:o}=n,i=A(n.connectionUrl??"");if((o==="HTTP"||o==="SSE"||o==="Websocket")&&i===A("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(n.npxPackage??"").trim();return o==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function se(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const o=A(n.connectionUrl??"");if(!o)return null;const i=n.registryItems.find(a=>(a.server?.remotes??[]).some(N=>A(N.url??"")===o));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",m=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:m}:null}function xt(n,o){const i={command:"npx",args:["-y",n]},d=re(o);return Object.keys(d).length>0&&(i.envVars=d),i}function jt(n,o,i,d){const m={command:n};o.trim()&&(m.args=o.trim().split(/\s+/)),i?.trim()&&(m.cwd=i.trim());const a=re(d);return Object.keys(a).length>0&&(m.envVars=a),m}function ft(n){return n.command==="npx"}function yt(n){return n.args?.find(o=>!o.startsWith("-"))??""}function vt(n){return{command:n.command,args:n.args?.join(" ")??"",cwd:n.cwd??""}}function _t(n,o){switch(o.type){case"edit":return{mode:"editing",connection:o.connection};case"delete":return{mode:"deleting",connection:o.connection};case"close":return{mode:"idle"}}}function Ct(){const{org:n}=Fe(),o=xe(),i=je({strict:!1}),{data:d}=fe.useSession(),{stdioEnabled:m}=ye(),a=Ae({namespace:n.slug,resource:"connections"}),I=Ve(),N=$e(a),[v,S]=M.useReducer(_t,{mode:"idle"}),R=Ee(N)[0],F=R?.id??"",U=Ze(R?.tools),ie=be(F||void 0),{data:ae}=lt({toolCaller:ie,toolName:U,toolInputParams:{limit:200},scope:F,enabled:!!(F&&U),staleTime:3600*1e3}),X=et(ae??[]),L=i.action==="create",ce=()=>{o({to:"/$org/mcps",params:{org:n.slug},search:{action:"create"}})},W=()=>{o({to:"/$org/mcps",params:{org:n.slug},search:{}})},r=ve({resolver:_e(ht),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),u=r.watch("ui_type"),K=r.watch("connection_url"),le=r.watch("npx_package"),D=E({uiType:u,connectionUrl:K??"",npxPackage:le??""})??se({uiType:u,connectionUrl:K??"",registryItems:X}),l=v.mode==="editing"?v.connection:null;M.useEffect(()=>{if(l){const t=dt(l.connection_headers)?l.connection_headers:null;if(t&&l.connection_type==="STDIO"){const s=ut(t.envVars);if(ft(t)){const c=yt(t);r.reset({title:l.title,description:l.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:s})}else{const c=vt(t);r.reset({title:l.title,description:l.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:c.command,stdio_args:c.args,stdio_cwd:c.cwd,env_vars:s})}}else r.reset({title:l.title,description:l.description,ui_type:l.connection_type,connection_url:l.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[l,r]);const de=async()=>{if(v.mode!=="deleting")return;const t=v.connection.id;S({type:"close"});try{await I.delete.mutateAsync(t)}catch{}},ue=async t=>{let s,c=null,w=null,C=null;if(t.ui_type==="NPX"?(s="STDIO",c="",C=xt(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(s="STDIO",c="",C=jt(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(s=t.ui_type,c=t.connection_url||"",w=t.connection_token||null),l){await I.update.mutateAsync({id:l.id,data:{title:t.title,description:t.description||null,connection_type:s,connection_url:c,...w&&{connection_token:w},...C&&{connection_headers:C}}}),S({type:"close"}),r.reset();return}const T=ct("conn");await I.create.mutateAsync({id:T,title:t.title,description:t.description||null,connection_type:s,connection_url:c,connection_token:w,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:d?.user?.id||"system",organization_id:n.id,icon:null,app_name:null,app_id:null,connection_headers:C,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),W(),r.reset(),o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:T}})},G=t=>{t||(L?W():S({type:"close"}),r.reset())},V=t=>{const s=t.trim();if(!s)return;const c=!!r.formState.dirtyFields.title,w=!!r.formState.dirtyFields.description,C=!!r.formState.dirtyFields.env_vars,T=p=>{if(p&&(!c&&!r.getValues("title").trim()&&p.title&&r.setValue("title",p.title,{shouldDirty:!1}),!w&&!(r.getValues("description")??"").trim()&&p.description&&r.setValue("description",p.description,{shouldDirty:!1}),!C&&p.envVarKeys?.length)){const q=r.getValues("env_vars")??[],he=new Set(q.map(b=>b.key)),Y=p.envVarKeys.filter(b=>!he.has(b));Y.length>0&&r.setValue("env_vars",[...q,...Y.map(b=>({key:b,value:""}))],{shouldDirty:!0})}},H=gt(s);if(H&&m){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",H.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),T(E({uiType:"NPX",npxPackage:H.packageName}));return}if(s.startsWith("http://")||s.startsWith("https://")){const p=u==="HTTP"||u==="SSE"||u==="Websocket"?u:"HTTP";r.setValue("ui_type",p,{shouldDirty:!0}),r.setValue("connection_url",s,{shouldDirty:!0}),T(E({uiType:p,connectionUrl:s})??se({uiType:p,connectionUrl:s,registryItems:X}));return}u==="NPX"&&T(E({uiType:"NPX",npxPackage:s}))},me=[{id:"icon",header:"",render:t=>e.jsx(Pe,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(O,{})}),cellClassName:"w-16 shrink-0",wrap:!0},{id:"title",header:"Name",render:t=>e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title}),cellClassName:"w-48 max-w-48 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:t.description||"—"}),cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-sm font-medium",children:t.connection_type}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"connection_url",header:"URL",render:t=>{const s=t.connection_url??"",c=s.length>40?`${s.slice(0,40)}...`:s;return e.jsx("span",{className:"text-sm text-muted-foreground",children:c})},cellClassName:"w-48 min-w-0 shrink-0"},{id:"status",header:"Status",render:t=>e.jsx(Le,{variant:t.status==="active"?"success":"outline",children:t.status}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:s=>s.stopPropagation(),children:[e.jsxs($,{onClick:s=>{s.stopPropagation(),o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Inspect"]}),e.jsxs($,{variant:"destructive",onClick:s=>{s.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],pe=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>o({to:"/$org/store",params:{org:n.slug}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(_,{onClick:ce,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(Se,{children:[e.jsx(We,{open:L||v.mode==="editing",onOpenChange:G,children:e.jsxs(Ke,{className:"sm:max-w-[525px]",children:[e.jsxs(Ge,{children:[e.jsx(qe,{children:l?"Edit Connection":"Create Connection"}),e.jsx(Ye,{children:l?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(Je,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(ue),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(h,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Type *"}),e.jsxs(st,{value:t.value,onValueChange:t.onChange,children:[e.jsx(j,{children:e.jsx(ot,{children:e.jsx(rt,{})})}),e.jsxs(it,{children:[e.jsx(P,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx(P,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"SSE"]})}),e.jsx(P,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"Websocket"]})}),m&&e.jsxs(e.Fragment,{children:[e.jsx(P,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx(P,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(nt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(f,{})]})}),u==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(h,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"NPM Package *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:s=>{const c=s.clipboardData.getData("text");c&&(s.preventDefault(),r.setValue("npx_package",c.trim(),{shouldDirty:!0}),V(c))},onBlur:s=>{V(s.target.value),t.onBlur()}})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The npm package to run with npx"}),e.jsx(f,{})]})})}),u==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(h,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Command *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Arguments"}),e.jsx(j,{children:e.jsx(k,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Working Directory"}),e.jsx(j,{children:e.jsx(k,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(f,{})]})})]}),(u==="NPX"||u==="STDIO")&&e.jsx(h,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Environment Variables"}),e.jsx(j,{children:e.jsx(mt,{value:t.value??[],onChange:t.onChange})}),e.jsx(f,{})]})}),u!=="NPX"&&u!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(h,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"URL *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:s=>{const c=s.clipboardData.getData("text");c&&(s.preventDefault(),r.setValue("connection_url",c.trim(),{shouldDirty:!0}),V(c))},onBlur:s=>{V(s.target.value),t.onBlur()}})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:D?.token?.label??"Token (optional)"}),e.jsx(j,{children:e.jsx(k,{type:"password",placeholder:D?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),D?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[D.token.helperText,D.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"title",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Name *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"My Connection",...t})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"description",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Description"}),e.jsx(j,{children:e.jsx(at,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsxs(Qe,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>G(!1),children:"Cancel"}),e.jsx(_,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":l?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(He,{open:v.mode==="deleting",onOpenChange:t=>!t&&S({type:"close"}),children:e.jsxs(Oe,{children:[e.jsxs(Be,{children:[e.jsx(ze,{children:"Delete Connection?"}),e.jsxs(Me,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:v.mode==="deleting"&&v.connection.title}),"."]})]}),e.jsxs(Re,{children:[e.jsx(Ue,{children:"Cancel"}),e.jsx(Xe,{onClick:de,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(Ne,{title:"Connections",viewMode:a.viewMode,onViewModeChange:a.setViewMode,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"status",label:"Status"}],ctaButton:pe}),e.jsx(we,{value:a.search,onChange:a.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(a.setSearch(""),t.target.blur())}}),a.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:N.length===0?e.jsx(B,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(a.search,"No Connections found"),description:a.search?`No Connections match "${a.search}"`:"Create a connection to get started.",actions:!a.search&&e.jsx(_,{variant:"outline",onClick:()=>o({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:N.map(t=>e.jsx(De,{connection:t,fallbackIcon:e.jsx(O,{}),onClick:()=>o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),headerActions:e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:s=>s.stopPropagation(),children:[e.jsxs($,{onClick:s=>{s.stopPropagation(),o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Inspect"]}),e.jsxs($,{variant:"destructive",onClick:s=>{s.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]})},t.id))})}):e.jsx(Te,{columns:me,data:N,isLoading:!1,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,onRowClick:t=>o({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),emptyState:a.search?e.jsx(B,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${a.search}"`}):e.jsx(B,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(_,{variant:"outline",onClick:()=>o({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})})})]})}function ln(){const n=ge.c(1);let o;return n[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(Ie,{children:e.jsx(M.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(tt,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ct,{})})}),n[0]=o):o=n[0],o}export{ln as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as o}from"./use-binding-UNVemCFv.js";import{F as t}from"./index-Bz1LU39D.js";const s="mcp.mesh",m=t(o,{target:"draft-7"});export{m as B,s as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as A,w as D,c as v,x as O,y as E,j as r,a as N}from"./index-
|
|
1
|
+
import{v as A,w as D,c as v,x as O,y as E,j as r,a as N}from"./index-Bz1LU39D.js";import{A as I,a as M,b as L,c as R,d as T,e as $,f as B}from"./alert-dialog-B2ogXLEp.js";import{u as V,I as k,B as q}from"./input-CtiQUsvV.js";import{F as H,a as U,b as G,c as J,d as K,e as P,f as Q}from"./form-orY-xngM.js";import{S as W}from"./spinner-C7HX4n17.js";function _(a){return a.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const X=A({name:D().min(2,"Organization name is required")});function oe(a){const e=v.c(41),{open:o,onOpenChange:s}=a;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:O(X),defaultValues:{name:""}},e[0]=j):j=e[0];const t=E(j);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={mutationFn:Z,onSuccess:Y},e[1]=w):w=e[1];const i=V(w),z=i.error instanceof Error?i.error.message:i.error?"Failed to create organization.":null;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsxs(L,{children:[r.jsx(R,{children:"Create a new organization"}),r.jsx(T,{children:"Set up a new organization to collaborate with others."})]}),e[2]=F):F=e[2];let n;if(e[3]!==i||e[4]!==t){let p;e[6]!==i?(p=b=>i.mutateAsync(b),e[6]=i,e[7]=p):p=e[7],n=t.handleSubmit(p),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=p=>{const{field:b}=p;return r.jsxs(G,{children:[r.jsx(J,{children:"Organization Name"}),r.jsx(K,{children:r.jsx(k,{...b,placeholder:"Acme Inc.",disabled:t.formState.isSubmitting})}),r.jsx(P,{children:"The name of your company or organization"}),b.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",_(b.value)]})]}),r.jsx(Q,{})]})},e[8]=t.formState.isSubmitting,e[9]=l):l=e[9];let m;e[10]!==t.control||e[11]!==l?(m=r.jsx(H,{control:t.control,name:"name",render:l}),e[10]=t.control,e[11]=l,e[12]=m):m=e[12];let c;e[13]!==z?(c=z&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:z}),e[13]=z,e[14]=c):c=e[14];let f;e[15]!==i||e[16]!==t?(f=()=>{i.reset(),t.reset()},e[15]=i,e[16]=t,e[17]=f):f=e[17];let g;e[18]!==t.formState.isSubmitting||e[19]!==f?(g=r.jsx(I,{disabled:t.formState.isSubmitting,onClick:f,children:"Cancel"}),e[18]=t.formState.isSubmitting,e[19]=f,e[20]=g):g=e[20];const y=!t.formState.isValid||t.formState.isSubmitting;let u;e[21]!==t.formState.isSubmitting?(u=t.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(W,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=t.formState.isSubmitting,e[22]=u):u=e[22];let d;e[23]!==y||e[24]!==u?(d=r.jsx(q,{type:"submit",variant:"default",disabled:y,children:u}),e[23]=y,e[24]=u,e[25]=d):d=e[25];let S;e[26]!==d||e[27]!==g?(S=r.jsxs($,{children:[g,d]}),e[26]=d,e[27]=g,e[28]=S):S=e[28];let h;e[29]!==S||e[30]!==n||e[31]!==m||e[32]!==c?(h=r.jsxs("form",{className:"space-y-6",onSubmit:n,autoComplete:"off",children:[m,c,S]}),e[29]=S,e[30]=n,e[31]=m,e[32]=c,e[33]=h):h=e[33];let x;e[34]!==t||e[35]!==h?(x=r.jsxs(M,{children:[F,r.jsx(U,{...t,children:h})]}),e[34]=t,e[35]=h,e[36]=x):x=e[36];let C;return e[37]!==s||e[38]!==o||e[39]!==x?(C=r.jsx(B,{open:o,onOpenChange:s,children:x}),e[37]=s,e[38]=o,e[39]=x,e[40]=C):C=e[40],C}function Y(a){const{orgSlug:e}=a;window.location.href=`/${e}`}async function Z(a){const e=_(a.name);if(!e)throw new Error("Organization slug is invalid");const o=await N.organization.create({name:a.name,slug:e});if(o?.error)throw new Error(o.error.message||"Failed to create organization");const s=o?.data?.slug??e;if(!s)throw new Error("Failed to create organization");return{orgSlug:s}}export{oe as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as n,j as i,R as u,C as m,T as x,D as j,P as N,O as D,aY as b,g as p}from"./index-
|
|
1
|
+
import{c as n,j as i,R as u,C as m,T as x,D as j,P as N,O as D,aY as b,g as p}from"./index-Bz1LU39D.js";import{i as h}from"./X-DcqsnRSe.js";import{c}from"./input-CtiQUsvV.js";function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(u,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function w(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(b,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(N,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function T(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(p,{"data-slot":"dialog-close",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-background/60 backdrop-blur-[0.5px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(D,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2","focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(h,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(p,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function R(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let g;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(g=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(m,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=g):g=e[14],g}function O(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function P(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function E(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(j,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{B as D,O as a,T as b,R as c,k as d,w as e,P as f,E as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c,j as i,by as p,bz as f,bA as m,bB as g,bC as b,bD as x,bE as v,bF as w,bG as h}from"./index-
|
|
1
|
+
import{c,j as i,by as p,bz as f,bA as m,bB as g,bC as b,bD as x,bE as v,bF as w,bG as h}from"./index-Bz1LU39D.js";import{i as j}from"./Grid01-BEpepbVy.js";import{c as u}from"./input-CtiQUsvV.js";function S(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(p,{"data-slot":"dropdown-menu",...t}),e[2]=t,e[3]=o):o=e[3],o}function M(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(f,{"data-slot":"dropdown-menu-trigger",...t}),e[2]=t,e[3]=o):o=e[3],o}function $(s){const e=c.c(10);let t,o,a;e[0]!==s?({className:t,sideOffset:a,...o}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=a):(t=e[1],o=e[2],a=e[3]);const n=a===void 0?4:a;let r;e[4]!==t?(r=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border p-1 shadow-md",t),e[4]=t,e[5]=r):r=e[5];let d;return e[6]!==o||e[7]!==n||e[8]!==r?(d=i.jsx(m,{children:i.jsx(g,{"data-slot":"dropdown-menu-content",sideOffset:n,className:r,...o})}),e[6]=o,e[7]=n,e[8]=r,e[9]=d):d=e[9],d}function y(s){const e=c.c(12);let t,o,a,n;e[0]!==s?({className:t,inset:o,variant:n,...a}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=a,e[4]=n):(t=e[1],o=e[2],a=e[3],n=e[4]);const r=n===void 0?"default":n;let d;e[5]!==t?(d=u("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[5]=t,e[6]=d):d=e[6];let l;return e[7]!==o||e[8]!==a||e[9]!==d||e[10]!==r?(l=i.jsx(b,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:d,...a}),e[7]=o,e[8]=a,e[9]=d,e[10]=r,e[11]=l):l=e[11],l}function _(s){const e=c.c(8);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let a;e[3]!==t?(a=u("bg-border -mx-1 my-1 h-px",t),e[3]=t,e[4]=a):a=e[4];let n;return e[5]!==o||e[6]!==a?(n=i.jsx(h,{"data-slot":"dropdown-menu-separator",className:a,...o}),e[5]=o,e[6]=a,e[7]=n):n=e[7],n}function C(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(x,{"data-slot":"dropdown-menu-sub",...t}),e[2]=t,e[3]=o):o=e[3],o}function T(s){const e=c.c(13);let t,o,a,n;e[0]!==s?({className:o,inset:a,children:t,...n}=s,e[0]=s,e[1]=t,e[2]=o,e[3]=a,e[4]=n):(t=e[1],o=e[2],a=e[3],n=e[4]);let r;e[5]!==o?(r=u("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",o),e[5]=o,e[6]=r):r=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(j,{className:"ml-auto size-4"}),e[7]=d):d=e[7];let l;return e[8]!==t||e[9]!==a||e[10]!==n||e[11]!==r?(l=i.jsxs(v,{"data-slot":"dropdown-menu-sub-trigger","data-inset":a,className:r,...n,children:[t,d]}),e[8]=t,e[9]=a,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function E(s){const e=c.c(8);let t,o;e[0]!==s?({className:t,...o}=s,e[0]=s,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let a;e[3]!==t?(a=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),e[3]=t,e[4]=a):a=e[4];let n;return e[5]!==o||e[6]!==a?(n=i.jsx(w,{"data-slot":"dropdown-menu-sub-content",className:a,...o}),e[5]=o,e[6]=a,e[7]=n):n=e[7],n}export{M as D,$ as a,S as b,y as c,_ as d,C as e,T as f,E as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,j as t}from"./index-
|
|
1
|
+
import{c as p,j as t}from"./index-Bz1LU39D.js";import{B as j,c as b}from"./input-CtiQUsvV.js";function v(u){const e=p.c(18),{icon:a,title:m,description:x,buttonProps:n,buttonComponent:f}=u;let s;e[0]!==a?(s=t.jsx("div",{className:"flex items-center justify-center",children:t.jsx("div",{className:"p-6 rounded-full border border-muted",children:t.jsx("div",{className:"p-4 rounded-full border border-border",children:t.jsx("div",{className:"p-3.5 rounded-full border border-border",children:t.jsx("div",{className:"p-3 rounded-full border border-border",children:t.jsx("div",{className:"w-20 h-20 rounded-full bg-muted flex items-center justify-center p-4",children:a})})})})})}),e[0]=a,e[1]=s):s=e[1];let l;e[2]!==m?(l=t.jsx("h3",{className:"text-2xl font-semibold text-foreground text-center",children:m}),e[2]=m,e[3]=l):l=e[3];let r;e[4]!==x?(r=t.jsx("div",{className:"text-sm text-muted-foreground text-center flex flex-col gap-1",children:x}),e[4]=x,e[5]=r):r=e[5];let d;e[6]!==l||e[7]!==r?(d=t.jsxs("div",{className:"flex flex-col items-center gap-2 max-w-md",children:[l,r]}),e[6]=l,e[7]=r,e[8]=d):d=e[8];let i;e[9]!==f||e[10]!==n?(i=f??(n&&t.jsx(j,{variant:"outline",size:"default",className:b("gap-2",n?.className),...n})),e[9]=f,e[10]=n,e[11]=i):i=e[11];let c;e[12]!==i?(c=t.jsx("div",{className:"mt-6",children:i}),e[12]=i,e[13]=c):c=e[13];let o;return e[14]!==s||e[15]!==d||e[16]!==c?(o=t.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[s,d,c]}),e[14]=s,e[15]=d,e[16]=c,e[17]=o):o=e[17],o}export{v as E};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as k,c as C,j as N,K as L,p as z,s as U,t as O}from"./index-
|
|
1
|
+
import{r as k,c as C,j as N,K as L,p as z,s as U,t as O}from"./index-Bz1LU39D.js";import{c as I,u as b}from"./input-CtiQUsvV.js";import{u as F}from"./project-context-provider-_aLYBfO9.js";const A=({size:n=24,color:e="currentColor",...r})=>k.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},k.createElement("path",{d:"M20.5 7.278 12 12m0 0L3.5 7.278M12 12v9.5m9-5.441V7.942c0-.343 0-.514-.05-.667a1 1 0 0 0-.215-.364c-.109-.119-.258-.202-.558-.368l-7.4-4.111c-.284-.158-.425-.237-.575-.267a1 1 0 0 0-.403 0c-.15.03-.292.11-.576.267l-7.4 4.11c-.3.167-.45.25-.558.369a1 1 0 0 0-.215.364C3 7.428 3 7.599 3 7.942v8.117c0 .342 0 .514.05.666a1 1 0 0 0 .215.364c.109.119.258.202.558.368l7.4 4.111c.284.158.425.237.576.268.133.027.27.027.402 0 .15-.031.292-.11.576-.268l7.4-4.11c.3-.167.45-.25.558-.369a.999.999 0 0 0 .215-.364c.05-.152.05-.324.05-.666Z"}));A.displayName="Container";const D="UNKNOWN_CONNECTION_ID",W=async n=>{const r=(await n.text()).split(`
|
|
2
2
|
`).find(s=>s.startsWith("data: "));if(!r)throw new Error("No data received from the server");return JSON.parse(r.replace("data: ",""))};function te(n){if(n===D)return(async()=>{});const e=n?`/mcp/${n}`:"/mcp";return async(r,t)=>{const s=await fetch(e,{method:"POST",body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:r,arguments:t}}),headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},credentials:"include"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const i=s.headers.get("Content-Type")==="application/json"?await s.json():await W(s);if(i.result?.isError)throw new Error(i.result.content?.[0]?.text||"Tool call failed");return i.result?.structuredContent||i.result}}const Q={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"},B={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-8",md:"min-w-12",lg:"min-w-16"},J={"2xs":8,xs:12,sm:16,md:24,lg:32};function se(n){const e=C.c(7),{icon:r,name:t,size:s,className:i,fallbackIcon:a}=n,m=s===void 0?"md":s,p=r??"no-icon";let o;return e[0]!==i||e[1]!==a||e[2]!==r||e[3]!==t||e[4]!==m||e[5]!==p?(o=N.jsx(M,{icon:r,name:t,size:m,className:i,fallbackIcon:a},p),e[0]=i,e[1]=a,e[2]=r,e[3]=t,e[4]=m,e[5]=p,e[6]=o):o=e[6],o}function M(n){const e=C.c(24),{icon:r,name:t,size:s,className:i,fallbackIcon:a}=n,m=s===void 0?"md":s,[p,o]=k.useState(!1),u=!!r&&p,c=Q[m],d=B[m];let f;e[0]!==i||e[1]!==c||e[2]!==d?(f=I("rounded-lg border border-border shrink-0 overflow-hidden",c,d,i),e[0]=i,e[1]=c,e[2]=d,e[3]=f):f=e[3];const w=r||void 0,h=!u&&"hidden";let l;e[4]!==h?(l=I("h-full w-full object-cover",h),e[4]=h,e[5]=l):l=e[5];let g,_;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>o(!1),_=()=>o(!0),e[6]=g,e[7]=_):(g=e[6],_=e[7]);let x;e[8]!==t||e[9]!==w||e[10]!==l?(x=N.jsx("img",{src:w,alt:t,className:l,onError:g,onLoad:_}),e[8]=t,e[9]=w,e[10]=l,e[11]=x):x=e[11];const y=u&&"hidden";let E;e[12]!==y?(E=I("h-full w-full flex items-center justify-center bg-muted/20",y),e[12]=y,e[13]=E):E=e[13];let j;e[14]!==a||e[15]!==m?(j=a??N.jsx(A,{size:J[m],className:"text-muted-foreground"}),e[14]=a,e[15]=m,e[16]=j):j=e[16];let v;e[17]!==E||e[18]!==j?(v=N.jsx("div",{className:E,children:j}),e[17]=E,e[18]=j,e[19]=v):v=e[19];let S;return e[20]!==x||e[21]!==v||e[22]!==f?(S=N.jsxs("div",{className:f,children:[x,v]}),e[20]=x,e[21]=v,e[22]=f,e[23]=S):S=e[23],S}function P(n,e,r){const t=[];if(n?.trim()){const s=n.trim(),i=r.map(a=>({field:[String(a)],operator:"contains",value:s}));i.length===1&&i[0]?t.push(i[0]):i.length>1&&t.push({operator:"or",conditions:i})}if(e&&e.length>0)for(const s of e)t.push({field:[s.column],operator:"eq",value:s.value});if(t.length!==0)return t.length===1?t[0]:{operator:"and",conditions:t}}function R(n,e,r){const t=n??r,s=e??"asc";return[{field:[String(t)],direction:s}]}function ne(n,e,r,t){const s=C.c(14),{org:i}=F();let a;s[0]!==e?(a=e.toUpperCase(),s[0]=e,s[1]=a):a=s[1];const p=`COLLECTION_${a}_GET`;let o;s[2]!==e||s[3]!==r||s[4]!==i.slug||s[5]!==n?(o=L.collectionItem(i.slug,n,e,r??""),s[2]=e,s[3]=r,s[4]=i.slug,s[5]=n,s[6]=o):o=s[6];let u;s[7]!==p||s[8]!==r||s[9]!==t?(u=async()=>r?await t(p,{id:r}):{item:null},s[7]=p,s[8]=r,s[9]=t,s[10]=u):u=s[10];let c;s[11]!==o||s[12]!==u?(c={queryKey:o,queryFn:u,staleTime:6e4},s[11]=o,s[12]=u,s[13]=c):c=s[13];const{data:d}=z(c);return d.item}function re(n,e,r,t){const s=C.c(11),i=t===void 0?{}:t,{org:a}=F(),{searchTerm:m,filters:p,sortKey:o,sortDirection:u,searchFields:c,defaultSortKey:d,pageSize:f}=i,w=c===void 0?["title","description"]:c,h=d===void 0?"updated_at":d,l=f===void 0?100:f;let g;s[0]!==e?(g=e.toUpperCase(),s[0]=e,s[1]=g):g=s[1];const x=`COLLECTION_${g}_LIST`,y=P(m,p,w),E=R(o,u,h),j=JSON.stringify({where:y,orderBy:E,limit:l}),v=L.collectionList(a.slug,n,e,j);let S;s[2]!==x||s[3]!==E||s[4]!==l||s[5]!==r||s[6]!==y?(S=async()=>{const q={...y&&{where:y},...E&&{orderBy:E},limit:l,offset:0};return(await r(x,q))?.items??[]},s[2]=x,s[3]=E,s[4]=l,s[5]=r,s[6]=y,s[7]=S):S=s[7];let T;s[8]!==v||s[9]!==S?(T={queryKey:v,queryFn:S},s[8]=v,s[9]=S,s[10]=T):T=s[10];const{data:$}=z(T);return $}function ie(n,e,r){const t=C.c(39),{org:s}=F(),i=U();let a;t[0]!==e?(a=e.toUpperCase(),t[0]=e,t[1]=a):a=t[1];const m=a,p=`COLLECTION_${m}_CREATE`,o=`COLLECTION_${m}_UPDATE`,u=`COLLECTION_${m}_DELETE`;let c;t[2]!==p||t[3]!==r?(c=async S=>(await r(p,{data:S})).item,t[2]=p,t[3]=r,t[4]=c):c=t[4];let d;t[5]!==e||t[6]!==s||t[7]!==i||t[8]!==n?(d=()=>{i.invalidateQueries({queryKey:L.collection(s.slug,n,e)}),O.success("Item created successfully")},t[5]=e,t[6]=s,t[7]=i,t[8]=n,t[9]=d):d=t[9];let f;t[10]!==c||t[11]!==d?(f={mutationFn:c,onSuccess:d,onError:H},t[10]=c,t[11]=d,t[12]=f):f=t[12];const w=b(f);let h;t[13]!==r||t[14]!==o?(h=async S=>{const{id:T,data:$}=S;return(await r(o,{id:T,data:$})).item},t[13]=r,t[14]=o,t[15]=h):h=t[15];let l;t[16]!==e||t[17]!==s||t[18]!==i||t[19]!==n?(l=()=>{i.invalidateQueries({queryKey:L.collection(s.slug,n,e)}),O.success("Item updated successfully")},t[16]=e,t[17]=s,t[18]=i,t[19]=n,t[20]=l):l=t[20];let g;t[21]!==h||t[22]!==l?(g={mutationFn:h,onSuccess:l,onError:Z},t[21]=h,t[22]=l,t[23]=g):g=t[23];const _=b(g);let x;t[24]!==u||t[25]!==r?(x=async S=>(await r(u,{id:S})).item.id,t[24]=u,t[25]=r,t[26]=x):x=t[26];let y;t[27]!==e||t[28]!==s||t[29]!==i||t[30]!==n?(y=()=>{i.invalidateQueries({queryKey:L.collection(s.slug,n,e)}),O.success("Item deleted successfully")},t[27]=e,t[28]=s,t[29]=i,t[30]=n,t[31]=y):y=t[31];let E;t[32]!==x||t[33]!==y?(E={mutationFn:x,onSuccess:y,onError:K},t[32]=x,t[33]=y,t[34]=E):E=t[34];const j=b(E);let v;return t[35]!==w||t[36]!==j||t[37]!==_?(v={create:w,update:_,delete:j},t[35]=w,t[36]=j,t[37]=_,t[38]=v):v=t[38],v}function K(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to delete item: ${e}`)}function Z(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to update item: ${e}`)}function H(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to create item: ${e}`)}function G(){const n=C.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=N.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),n[0]=e):e=n[0],e}function oe(n){const e=C.c(24),{image:r,title:t,description:s,actions:i,className:a,descriptionClassName:m,actionsClassName:p}=n;let o;e[0]!==a?(o=I("flex flex-1 flex-col items-center justify-center gap-8 p-4",a),e[0]=a,e[1]=o):o=e[1];let u;e[2]!==r?(u=r!==null&&N.jsx("div",{className:"flex items-center justify-center",children:r??N.jsx(G,{})}),e[2]=r,e[3]=u):u=e[3];let c;e[4]!==t?(c=N.jsx("h3",{className:"text-lg font-medium text-foreground",children:t}),e[4]=t,e[5]=c):c=e[5];let d;e[6]!==m?(d=I("text-sm text-muted-foreground text-center max-w-[300px]",m),e[6]=m,e[7]=d):d=e[7];let f;e[8]!==s||e[9]!==d?(f=N.jsx("div",{className:d,children:s}),e[8]=s,e[9]=d,e[10]=f):f=e[10];let w;e[11]!==c||e[12]!==f?(w=N.jsxs("div",{className:"flex flex-col items-center gap-2",children:[c,f]}),e[11]=c,e[12]=f,e[13]=w):w=e[13];let h;e[14]!==i||e[15]!==p?(h=i&&N.jsx("div",{className:I("flex items-center gap-2",p),children:i}),e[14]=i,e[15]=p,e[16]=h):h=e[16];let l;e[17]!==w||e[18]!==h?(l=N.jsxs("div",{className:"flex flex-col items-center gap-4",children:[w,h]}),e[17]=w,e[18]=h,e[19]=l):l=e[19];let g;return e[20]!==o||e[21]!==u||e[22]!==l?(g=N.jsxs("div",{className:o,children:[u,l]}),e[20]=o,e[21]=u,e[22]=l,e[23]=g):g=e[23],g}export{oe as E,se as I,D as U,ie as a,re as b,te as c,A as n,ne as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as k,$ as D,V as y,w as t,U as m,X as T,H,c as O,j as c}from"./index-Bz1LU39D.js";import{I as N,B as z}from"./input-CtiQUsvV.js";import{s as R}from"./Plus-CovnOzP9.js";import{s as W}from"./Trash01-DopdNXEu.js";const U=k({authorizationEndpoint:t().url(),tokenEndpoint:t().url(),introspectionEndpoint:t().url().optional(),clientId:t(),clientSecret:t().optional(),scopes:y(t()),grantType:D(["authorization_code","client_credentials"])}),L=k({name:t(),description:t().optional(),inputSchema:m(t(),T()),outputSchema:m(t(),T()).optional()}),B=k({headers:m(t(),t()).optional()}),K=k({command:t().describe("Command to run (e.g., 'npx', 'node')"),args:y(t()).optional().describe("Command arguments"),cwd:t().optional().describe("Working directory"),envVars:m(t(),t()).optional().describe("Environment variables (encrypted in storage)")}),V=k({id:t().describe("Unique identifier for the connection"),title:t().describe("Human-readable name for the connection"),created_at:t().describe("When the connection was created"),updated_at:t().describe("When the connection was last updated"),created_by:t().describe("User ID who created the connection"),updated_by:t().optional().describe("User ID who last updated the connection"),organization_id:t().describe("Organization ID this connection belongs to"),description:t().nullable().describe("Description of the connection"),icon:t().nullable().describe("Icon URL for the connection"),app_name:t().nullable().describe("Associated app name"),app_id:t().nullable().describe("Associated app ID"),connection_type:D(["HTTP","SSE","Websocket","STDIO"]).describe("Type of connection"),connection_url:t().nullable().describe("URL for HTTP/SSE/WebSocket connections. Null for STDIO."),connection_token:t().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:H([K,B]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:U.nullable().describe("OAuth configuration"),configuration_state:m(t(),T()).nullable().describe("Configuration state (decrypted)"),configuration_scopes:y(t()).nullable().optional().describe("Configuration scopes"),metadata:m(t(),T()).nullable().describe("Additional metadata (includes repository info)"),tools:y(L).nullable().describe("Discovered tools from MCP"),bindings:y(t()).nullable().describe("Detected bindings"),status:D(["active","inactive","error"]).describe("Current status")});V.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0});V.partial();function G(s){return s!=null&&"command"in s}function $(s){const e=s.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(l=>e.includes(l))||["sk_","rk_","whsec_","pk_live","sk_live"].some(l=>e.startsWith(l))||["_key","_secret","_token","_password","_auth","_pat"].some(l=>e.endsWith(l)))}function J(s){const e=O.c(34),{value:n,onChange:o,keyPlaceholder:j,valuePlaceholder:l,className:I}=s,f=j===void 0?"VARIABLE_NAME":j,_=l===void 0?"value...":l;let w;e[0]!==o||e[1]!==n?(w=()=>{o([...n,{key:"",value:""}])},e[0]=o,e[1]=n,e[2]=w):w=e[2];const A=w;let x;e[3]!==o||e[4]!==n?(x=r=>{o(n.filter((u,i)=>i!==r))},e[3]=o,e[4]=n,e[5]=x):x=e[5];const b=x;let S;e[6]!==o||e[7]!==n?(S=(r,u)=>{const i=[...n],a=i[r];a&&(i[r]={key:u,value:a.value},o(i))},e[6]=o,e[7]=n,e[8]=S):S=e[8];const g=S;let C;e[9]!==o||e[10]!==n?(C=(r,u)=>{const i=[...n],a=i[r];a&&(i[r]={key:a.key,value:u},o(i))},e[9]=o,e[10]=n,e[11]=C):C=e[11];const v=C;let d;if(e[12]!==g||e[13]!==b||e[14]!==v||e[15]!==f||e[16]!==n||e[17]!==_){let r;e[19]!==g||e[20]!==b||e[21]!==v||e[22]!==f||e[23]!==_?(r=(u,i)=>c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(N,{placeholder:f,value:u.key,onChange:a=>g(i,a.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),c.jsx(N,{type:$(u.key)?"password":"text",placeholder:_,value:u.value,onChange:a=>v(i,a.target.value),className:"h-10 rounded-lg flex-1"}),c.jsx(z,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>b(i),children:c.jsx(W,{size:16})})]},i),e[19]=g,e[20]=b,e[21]=v,e[22]=f,e[23]=_,e[24]=r):r=e[24],d=n.map(r),e[12]=g,e[13]=b,e[14]=v,e[15]=f,e[16]=n,e[17]=_,e[18]=d}else d=e[18];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(R,{size:16,className:"mr-1"}),e[25]=E):E=e[25];let p;e[26]!==A?(p=c.jsxs(z,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:A,children:[E,"Add Environment Variable"]}),e[26]=A,e[27]=p):p=e[27];let h;e[28]!==d||e[29]!==p?(h=c.jsxs("div",{className:"flex flex-col gap-2",children:[d,p]}),e[28]=d,e[29]=p,e[30]=h):h=e[30];let P;return e[31]!==I||e[32]!==h?(P=c.jsx("div",{className:I,children:h}),e[31]=I,e[32]=h,e[33]=P):P=e[33],P}function Q(s){const e={};for(const{key:n,value:o}of s)n.trim()&&(e[n.trim()]=o);return e}function Y(s){return s?Object.entries(s).map(([e,n])=>({key:e,value:n})):[]}export{J as E,Q as e,G as i,Y as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e}from"./index-
|
|
1
|
+
import{r as o,j as e}from"./index-Bz1LU39D.js";import{B as n}from"./input-CtiQUsvV.js";const a=({size:t=24,color:r="currentColor",...s})=>o.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:r,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},o.createElement("path",{d:"M12 9v4m0 4h.01M10.615 3.892 2.39 18.098c-.456.788-.684 1.182-.65 1.506a1 1 0 0 0 .406.705c.263.191.718.191 1.629.191h16.45c.91 0 1.365 0 1.628-.191a1 1 0 0 0 .407-.705c.034-.324-.195-.718-.65-1.506L13.383 3.892c-.454-.785-.681-1.178-.978-1.31a1 1 0 0 0-.813 0c-.296.132-.523.525-.978 1.31Z"}));a.displayName="AlertTriangle";class l extends o.Component{state={hasError:!1,error:null};static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,s){console.error("Uncaught error:",r,s)}resetError=()=>{this.setState({hasError:!1,error:null})};render(){if(this.state.hasError){const{fallback:r}=this.props;return typeof r=="function"?r({error:this.state.error,resetError:this.resetError}):r!==void 0?r:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[e.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:e.jsx(a,{className:"h-6 w-6 text-destructive"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:this.state.error?.message||"An unexpected error occurred"})]}),e.jsx(n,{variant:"outline",onClick:this.resetError,children:"Try again"})]})}return this.props.children}}export{l as E,a as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as D}from"./constants-8DEiLmV-.js";import{g as R}from"./github-icon-Dp3wHhYE.js";import{g as A}from"./registry-utils-BIzwINzW.js";import{g as E}from"./generate-id-Dyweu44Y.js";function O(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function H(e){const r=e?.identifier||e?.name;return r?r.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):"Unknown"}function Y(e,r,d,i){const n=e.server,t=e._meta?.[D],f=new Date().toISOString(),b=t?.friendlyName||t?.friendly_name||e.title||n?.title||n?.name||"Unnamed MCP Server",v=n?.description||null,x=n?.icons?.[0]?.src||R(n?.repository)||null,o=t?.oauth_config,C=o&&typeof o.authorizationEndpoint=="string"&&typeof o.tokenEndpoint=="string"&&typeof o.clientId=="string"&&Array.isArray(o.scopes)&&(o.grantType==="authorization_code"||o.grantType==="client_credentials")?o:null,I=t?.configuration_state,T=t?.configuration_scopes,N=n?.repository?{url:n.repository.url,source:n.repository.source,subfolder:n.repository.subfolder}:null,u=n?.packages??[],m=n?.remotes??[],P=i?.packageIndex??0,S=i?.remoteIndex??0,y=u.length>0&&i?.packageIndex!==void 0,a=y?u[P]:null,s=y?null:m[S];let c,l,_=null;if(a){const h=a.identifier||a.name;c="STDIO",l="";const g={};if(a.environmentVariables)for(const k of a.environmentVariables)k.name&&(g[k.name]="");_={command:"npx",args:h?["-y",h]:[],...Object.keys(g).length>0&&{envVars:g}}}else s?(c=A(s.type)||"HTTP",l=s.url||""):(c="HTTP",l="");const w=m.length>1,M=u.length>1;let p="";a&&M?p=` (${H(a)})`:s&&w&&(p=` (${O(s)})`);const U=b+p;return{id:E("conn"),title:U,description:v,icon:x,app_name:t?.appName||n?.name||null,app_id:t?.id||e.id||null,connection_type:c,connection_url:l,connection_token:null,connection_headers:_,oauth_config:C,configuration_state:I??null,configuration_scopes:T??null,metadata:{source:"store",registry_item_id:e.id,verified:t?.verified??!1,scopeName:t?.scopeName??null,toolsCount:t?.tools?.length??0,publishedAt:t?.publishedAt??null,repository:N},created_at:f,updated_at:f,created_by:d,organization_id:r,tools:null,bindings:null,status:"inactive"}}export{Y as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,j as m,aM as $,bb as j,bc as C,r as f,i as v,bd as N,be as h}from"./index-
|
|
1
|
+
import{c as d,j as m,aM as $,bb as j,bc as C,r as f,i as v,bd as N,be as h}from"./index-Bz1LU39D.js";import{c as u}from"./input-CtiQUsvV.js";function S(t){const e=d.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let l;e[3]!==s?(l=u("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",s),e[3]=s,e[4]=l):l=e[4];let r;return e[5]!==o||e[6]!==l?(r=m.jsx($,{"data-slot":"label",className:l,...o}),e[5]=o,e[6]=l,e[7]=r):r=e[7],r}const y=j,g=f.createContext({}),D=t=>{const e=d.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let l;e[4]!==s?(l=m.jsx(C,{...s}),e[4]=s,e[5]=l):l=e[5];let r;return e[6]!==o||e[7]!==l?(r=m.jsx(g.Provider,{value:o,children:l}),e[6]=o,e[7]=l,e[8]=r):r=e[8],r},x=()=>{const t=d.c(13),e=f.useContext(g),s=f.useContext(I),{getFieldState:o}=N();let l;t[0]!==e.name?(l={name:e.name},t[0]=e.name,t[1]=l):l=t[1];const r=h(l);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const n=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,c=`${i}-form-item`,F=`${i}-form-item-description`,b=`${i}-form-item-message`;let p;return t[6]!==e.name||t[7]!==n||t[8]!==i||t[9]!==c||t[10]!==F||t[11]!==b?(p={id:i,name:e.name,formItemId:c,formDescriptionId:F,formMessageId:b,...n},t[6]=e.name,t[7]=n,t[8]=i,t[9]=c,t[10]=F,t[11]=b,t[12]=p):p=t[12],p},I=f.createContext({});function E(t){const e=d.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const l=f.useId();let r;e[3]!==l?(r={id:l},e[3]=l,e[4]=r):r=e[4];let a;e[5]!==s?(a=u("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let n;e[7]!==o||e[8]!==a?(n=m.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=n):n=e[9];let i;return e[10]!==r||e[11]!==n?(i=m.jsx(I.Provider,{value:r,children:n}),e[10]=r,e[11]=n,e[12]=i):i=e[12],i}function L(t){const e=d.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:l,formItemId:r}=x(),a=!!l;let n;e[3]!==s?(n=u("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==n?(i=m.jsx(S,{"data-slot":"form-label","data-error":a,className:n,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=n,e[9]=i):i=e[9],i}function P(t){const e=d.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:l,formDescriptionId:r,formMessageId:a}=x(),n=o?`${r} ${a}`:`${r}`,i=!!o;let c;return e[2]!==l||e[3]!==s||e[4]!==n||e[5]!==i?(c=m.jsx(v,{"data-slot":"form-control",id:l,"aria-describedby":n,"aria-invalid":i,...s}),e[2]=l,e[3]=s,e[4]=n,e[5]=i,e[6]=c):c=e[6],c}function R(t){const e=d.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:l}=x();let r;e[3]!==s?(r=u("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==l||e[6]!==o||e[7]!==r?(a=m.jsx("p",{"data-slot":"form-description",id:l,className:r,...o}),e[5]=l,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function k(t){const e=d.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:l,formMessageId:r}=x(),a=l?String(l?.message??""):o.children;if(!a)return null;let n;e[3]!==s?(n=u("text-destructive text-sm",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==n?(i=m.jsx("p",{"data-slot":"form-message",id:r,className:n,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=n,e[9]=i):i=e[9],i}export{D as F,S as L,y as a,E as b,L as c,P as d,R as e,k as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as S,$ as ye,v as re,V as U,w,c as R,j as t,f as Ve,d as tt,b as st,k as ot,ar as lt,x as nt,y as it,t as Ae}from"./index-DMNk-OUX.js";import{I as Ee,E as rt}from"./empty-state-DzS1Zp7m.js";import{E as Fe}from"./error-boundary-BQnJ9S9E.js";import{C as Ge}from"./checkbox-2xIaHvS4.js";import{c as H,B as F,I as Pe}from"./input-68J17rBp.js";import{i as at}from"./ArrowLeft-BrsZ2N_5.js";import{u as We}from"./use-connection-DoWszS3j.js";import{C as ct}from"./collection-search-CYZk6T6Z.js";import{s as dt}from"./Plus-DaP4KLuJ.js";import{i as mt}from"./X-D3ljCSd1.js";import{P as ut}from"./pin-to-sidebar-button-B1xHHS9n.js";import{T as ft}from"./tool-set-selector-DMsE0yRo.js";import{b as ht,a as xt,i as pt}from"./use-gateway-CRpsitbG.js";import{u as gt,a as bt}from"./use-connection-resources-BywYCfzc.js";import{u as jt}from"./use-gateway-system-prompt-B4ia2QxW.js";import{s as He}from"./slugify-CEUa2lfQ.js";import{B as qe}from"./badge-0b6sJe4S.js";import{a as yt,D as vt,c as St,d as Nt}from"./dialog-BXeLl5mO.js";import{F as be,a as wt,b as ve,d as Se,f as Ne,c as _t}from"./form-DrOt6d2d.js";import{I as Ct,R as kt,a as It}from"./index-Bb8rHnPb.js";import{R as Tt}from"./resource-tabs-BKSlcL1W.js";import{S as $t,a as Rt,b as zt,c as At,d as Ue}from"./select-B9KJyTZZ.js";import{S as Et}from"./switch-BuVvmF04.js";import{T as Pt}from"./textarea-BAUX8Qgd.js";import{a as Z,c as Y,b as J,T as Q}from"./project-context-provider-BJIP5a-U.js";import{i as Ze}from"./Check-JFkjTCfG.js";import{i as Mt}from"./Code01-CgNchnl3.js";import{a as Dt}from"./Copy01-Dadp_RDG.js";import{i as Ut}from"./FlipBackward-GGMv99yc.js";import{i as je}from"./InfoCircle-D6qJG9Nl.js";import{i as ze}from"./Loading01-NW_f44Lz.js";import{a as Lt,V as Ot,b as Bt}from"./layout-Olb4shdE.js";import"./SearchMd-tOSOFUes.js";import"./use-organization-settings-D6rXW2c_.js";import"./localstorage-keys-C62ZbWuB.js";import"./ChevronDown-HtFMO0lw.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.")}),Ft=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 Gt=S.memo(function(e){const s=R.c(20),{connection:l,isSelected:i,hasItemsEnabled:n,activeItemsCount:a,totalItemsCount:c,onSelect:m,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 p;s[5]!==l.title?(p=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]=p):p=s[6];let x;s[7]!==m||s[8]!==f||s[9]!==p?(x=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[f,p]}),s[7]=m,s[8]=f,s[9]=p,s[10]=x):x=s[10];let g;s[11]!==a||s[12]!==n||s[13]!==r||s[14]!==c?(g=c>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[a,"/",c]}),t.jsx(Ge,{checked:n,onCheckedChange:r,onClick:Ht})]}),s[11]=a,s[12]=n,s[13]=r,s[14]=c,s[15]=g):g=s[15];let y;return s[16]!==u||s[17]!==x||s[18]!==g?(y=t.jsxs("div",{className:u,children:[x,g]}),s[16]=u,s[17]=x,s[18]=g,s[19]=y):y=s[19],y}),Wt=S.memo(function(e){const s=R.c(18),{connectionId:l,item:i,isSelected:n,onToggle:a}=e,c=`item-${l}-${i.id}`,m=n?"text-foreground":"text-muted-foreground";let r;s[0]!==m?(r=H("text-sm font-medium",m),s[0]=m,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 p=`item-${l}-${i.id}`;let x;s[10]!==n||s[11]!==a||s[12]!==p?(x=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(Ge,{id:p,checked:n,onCheckedChange:a,onClick:qt})}),s[10]=n,s[11]=a,s[12]=p,s[13]=x):x=s[13];let g;return s[14]!==c||s[15]!==f||s[16]!==x?(g=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:c,children:[f,x]}),s[14]=c,s[15]=f,s[16]=x,s[17]=g):g=s[17],g});function et({itemSet:o,onItemSetChange:e,getItems:s,itemLabel:l,emptyItemsMessage:i,extraContent:n}){const[a,c]=S.useState(""),m=S.useDeferredValue(a),[r,d]=S.useState("all"),[u,f]=S.useState(!1),p=S.useRef(new Set(Object.keys(o))),x=We({searchTerm:m.trim()||void 0}),g=p.current,y=[...g.values()].map(h=>x.find(N=>N.id===h)).filter(h=>h!==void 0),j=x.filter(h=>!g.has(h.id)),v=[...y,...j],b=h=>{const N=o[h];return N!==void 0&&N.length>0},_=v.filter(h=>{if(r==="all")return!0;const N=b(h.id);return r==="selected"?N:r==="unselected"?!N:!0}),[I,k]=S.useState(v[0]?.id??null),C=I?v.find(h=>h.id===I)??null:null,P=C?s(C):[],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(V=>V.id===h);if(!N)return;const z=s(N);if(z.length===0)return;const $=o[h]??[],G=z.map(V=>V.id),W=$.length>0&&G.every(V=>$.includes(V)),q={...o};W?delete q[h]:(q[h]=G,k(h)),e(q)},A=h=>{k(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:c,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(Gt,{connection:h,isSelected:I===h.id,hasItemsEnabled:b(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:C?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(F,{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:C.icon,name:C.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:C.title}),C.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:C.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(Wt,{connectionId:C.id,item:h,isSelected:E(C.id,h.id),onToggle:()=>L(C.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 Ht(o){return o.stopPropagation()}function qt(o){return o.stopPropagation()}function Zt(o){const e=R.c(6),{promptSet:s,onPromptSetChange:l,connectionPrompts:i}=o;let n;e[0]!==i?(n=m=>(i.get(m.id)??[]).map(Yt),e[0]=i,e[1]=n):n=e[1];const a=n;let c;return e[2]!==a||e[3]!==l||e[4]!==s?(c=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]=c):c=e[5],c}function Yt(o){return{id:o.name,name:o.name,description:o.description}}function Jt(o){return o.includes("*")}function Qt(o){const e=R.c(27),{patterns:s,onAddPattern:l,onRemovePattern:i}=o,[n,a]=S.useState("");let c;e[0]!==n||e[1]!==l||e[2]!==s?(c=()=>{const f=n.trim();f&&!s.includes(f)&&(l(f),a(""))},e[0]=n,e[1]=l,e[2]=s,e[3]=c):c=e[3];const m=c;let r;e[4]!==m?(r=f=>{f.key==="Enter"&&(f.preventDefault(),m())},e[4]=m,e[5]=r):r=e[5];const d=r;let u;if(e[6]!==m||e[7]!==d||e[8]!==n||e[9]!==i||e[10]!==s){const f=s.filter(Jt);let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("code",{children:"*"}),e[12]=p):p=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 ",p," for single segment and ",t.jsx("code",{children:"**"})," for multiple segments."]}),e[13]=x):x=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=k=>a(k.target.value),e[14]=g):g=e[14];let y;e[15]!==d||e[16]!==n?(y=t.jsx(Pe,{value:n,onChange:g,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 b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(dt,{size:16}),e[20]=b):b=e[20];let _;e[21]!==m||e[22]!==v?(_=t.jsx(F,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:v,children:b}),e[21]=m,e[22]=v,e[23]=_):_=e[23];let I;e[24]!==_||e[25]!==y?(I=t.jsxs("div",{className:"flex gap-2",children:[y,_]}),e[24]=_,e[25]=y,e[26]=I):I=e[26],u=t.jsxs("div",{className:"border-b border-border p-4 space-y-3",children:[x,I,f.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(k=>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:k}),t.jsx("button",{type:"button",onClick:()=>i(k),className:"text-muted-foreground hover:text-foreground",children:t.jsx(mt,{size:12})})]},k))})]}),e[6]=m,e[7]=d,e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];return u}function Kt(o){const e=R.c(23),{resourceSet:s,onResourceSetChange:l,connectionResources:i}=o,[n]=S.useState(null);let a;e[0]!==i?(a=b=>(i.get(b.id)??[]).map(Xt),e[0]=i,e[1]=a):a=e[1];const c=a;let m;e[2]!==l||e[3]!==s?(m=(b,_)=>{const I=s[b]??[];I.includes(_)||l({...s,[b]:[...I,_]})},e[2]=l,e[3]=s,e[4]=m):m=e[4];const r=m;let d;e[5]!==l||e[6]!==s?(d=(b,_)=>{const k=(s[b]??[]).filter(C=>C!==_);if(k.length===0){const C={...s};delete C[b],l(C)}else l({...s,[b]:k})},e[5]=l,e[6]=s,e[7]=d):d=e[7];const u=d;let f;e[8]!==l?(f=b=>{l(b)},e[8]=l,e[9]=f):f=e[9];const p=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 g=x;let y;e[13]!==r||e[14]!==u||e[15]!==n||e[16]!==g?(y=n?t.jsx(Qt,{patterns:g,onAddPattern:b=>r(n,b),onRemovePattern:b=>u(n,b)}):null,e[13]=r,e[14]=u,e[15]=n,e[16]=g,e[17]=y):y=e[17];const j=y;let v;return e[18]!==j||e[19]!==c||e[20]!==p||e[21]!==s?(v=t.jsx("div",{className:"h-full",children:t.jsx(et,{itemSet:s,onItemSetChange:p,getItems:c,itemLabel:"resources",emptyItemsMessage:"This connection has no resources available",extraContent:j})}),e[18]=j,e[19]=c,e[20]=p,e[21]=s,e[22]=v):v=e[22],v}function Xt(o){return{id:o.uri,name:o.name||o.uri,description:o.description||o.uri}}function es(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(kt,{"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(It,{"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(Ct,{"data-slot":"radio-group-item",className:i,...l,children:n}),e[6]=l,e[7]=i,e[8]=a):a=e[8],a}function ts(o){const s=new TextEncoder().encode(o),l=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(l)}const ss=Ft.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 os(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]??[],c=l.get(n)??[],m=c.length>0&&c.every(r=>a.includes(r));return{connection_id:n,selected_tools:a.length===0||m?null:a,selected_resources:e[n]??null,selected_prompts:s[n]??null}})}function ls(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 c;e[2]!==l?(c=l?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx(Dt,{size:20}),e[2]=l,e[3]=c):c=e[3];const m=l?"Copied!":"Copy URL";let r;e[4]!==m?(r=t.jsx("span",{className:"text-xs font-medium",children:m}),e[4]=m,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==c||e[8]!==r?(d=t.jsxs(F,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,r]}),e[6]=a,e[7]=c,e[8]=r,e[9]=d):d=e[9],d}function ns(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=ts(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,c;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%)"}}),c=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let m;return e[5]!==n?(m=t.jsxs(F,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,c]}),e[5]=n,e[6]=m):m=e[6],m}function is(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"}},null,2),g=`claude mcp add "${f}" --config '${x.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(g),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 c=a;let m;e[3]!==i?(m=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]=m):m=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]!==c||e[8]!==m||e[9]!==d?(u=t.jsxs(F,{type:"button",variant:"outline",onClick:c,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,d]}),e[7]=c,e[8]=m,e[9]=d,e[10]=u):u=e[10],u}function rs(o){const e=R.c(40),{open:s,onOpenChange:l,gateway:i}=o,[n,a]=S.useState("code_execution");let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=$=>{($==="passthrough"||$==="smart_tool_selection"||$==="code_execution")&&a($)},e[0]=c):c=e[0];const m=c;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(yt,{children:t.jsx(vt,{children:"Share Agent"})}),e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=p):p=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 g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=g):g=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:[g,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 b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=b):b=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 I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=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:[b,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]=I):I=e[16];let k;e[17]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Mt,{className:"size-5 text-muted-foreground"})}),e[17]=k):k=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=C):C=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:[k,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[C,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:[p,t.jsxs(es,{value:n,onValueChange:m,className:"flex flex-col gap-4.5",children:[j,I,E]})]}),e[21]=n,e[22]=L):L=e[22];let B;e[23]!==r.href?(B=t.jsx(ls,{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(ns,{gatewayUrl:r.href,serverName:u}),M=t.jsx(is,{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(St,{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(Nt,{open:s,onOpenChange:l,children:N}),e[36]=l,e[37]=s,e[38]=N,e[39]=z):z=e[39],z}function as(o){const e=R.c(31),{form:s,icon:l,gatewayId:i}=o,[n,a]=jt(i);let c;e[0]!==s?(c=s.watch("title")||"Agent",e[0]=s,e[1]=c):c=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(pt,{}),e[2]=m):m=e[2];let r;e[3]!==l||e[4]!==c?(r=t.jsx(Ee,{icon:l,name:c,size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:m}),e[3]=l,e[4]=c,e[5]=r):r=e[5];let d;e[6]!==s.control?(d=t.jsx(be,{control:s.control,name:"status",render:us}),e[6]=s.control,e[7]=d):d=e[7];let u;e[8]!==r||e[9]!==d?(u=t.jsxs("div",{className:"flex items-start justify-between",children:[r,d]}),e[8]=r,e[9]=d,e[10]=u):u=e[10];let f;e[11]!==s.control?(f=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(be,{control:s.control,name:"title",render:ms}),t.jsx(be,{control:s.control,name:"description",render:ds})]}),e[11]=s.control,e[12]=f):f=e[12];let p;e[13]!==u||e[14]!==f?(p=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15];let x;e[16]!==s.control?(x=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:cs})}),e[16]=s.control,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=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[18]=g):g=e[18];let y;e[19]!==a?(y=_=>a(_.target.value),e[19]=a,e[20]=y):y=e[20];let j;e[21]!==n||e[22]!==y?(j=t.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[g,t.jsx(Pt,{value:n,onChange:y,placeholder:"Enter system prompt instructions...",className:"min-h-[240px] resize-none text-sm leading-relaxed"})]}),e[21]=n,e[22]=y,e[23]=j):j=e[23];let v;e[24]!==j||e[25]!==p||e[26]!==x?(v=t.jsxs("div",{className:"flex flex-col",children:[p,x,j]}),e[24]=j,e[25]=p,e[26]=x,e[27]=v):v=e[27];let b;return e[28]!==s||e[29]!==v?(b=t.jsx("div",{className:"flex flex-col h-full overflow-auto",children:t.jsx(wt,{...s,children:v})}),e[28]=s,e[29]=v,e[30]=b):b=e[30],b}function cs(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(_t,{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(F,{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($t,{value:e.value,onValueChange:e.onChange,children:[t.jsx(Se,{children:t.jsx(Rt,{className:"w-[180px]",children:t.jsx(zt,{})})}),t.jsxs(At,{children:[t.jsx(Ue,{value:"inclusion",children:"Include Selected"}),t.jsx(Ue,{value:"exclusion",children:"Exclude Selected"})]})]})]})]}),t.jsx(Ne,{})]})}function ds(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 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,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 us(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(Et,{checked:e.value==="active",onCheckedChange:s=>e.onChange(s?"active":"inactive")})})]}),t.jsx(Ne,{})]})}function fs(o){const e=R.c(81),{gateway:s,gatewayId:l,requestedTabId:i}=o,a=ot().location.href,c=lt();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={from:"/$org/gateways/$gatewayId"},e[0]=m):m=e[0];const r=Ve(m),d=xt();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const f=We(u);let p;e[2]!==f?(p=f.map(xs),e[2]=f,e[3]=p):p=e[3];const x=p,{promptsMap:g}=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(hs));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[b,_]=S.useState(v);let I;e[9]!==s?(I=()=>Oe(s),e[9]=s,e[10]=I):I=e[10];const[k,C]=S.useState(I);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=>{C(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 V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=nt(ss),e[16]=V):V=e[16];const we=s.tool_selection_mode??"inclusion";let ce;e[17]!==s.description||e[18]!==s.status||e[19]!==s.title||e[20]!==we?(ce={resolver:V,defaultValues:{title:s.title,description:s.description,status:s.status,tool_selection_mode:we}},e[17]=s.description,e[18]=s.status,e[19]=s.title,e[20]=we,e[21]=ce):ce=e[21];const O=it(ce),_e=O.formState.isDirty||B;let de;e[22]!==d.update||e[23]!==j||e[24]!==O||e[25]!==l||e[26]!==E||e[27]!==k||e[28]!==b?(de=async()=>{const T=O.getValues(),$e=os(b,k,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]=k,e[28]=b,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)),C(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]!==c.history?(K=()=>c.history.back(),e[37]=c.history,e[38]=K):K=e[38];let X;e[39]!==D||e[40]!==Ie?(X=t.jsx(Lt,{children:t.jsx(Tt,{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]!==_e||e[45]!==ae?(ee=_e&&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(F,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:ke,"aria-label":"Cancel",children:t.jsx(Ut,{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(F,{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]=_e,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(F,{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(Ot,{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]!==g||e[59]!==y||e[60]!==O||e[61]!==s.icon||e[62]!==l||e[63]!==E||e[64]!==k||e[65]!==b?(oe=D==="settings"?t.jsx(as,{form:O,icon:s.icon,gatewayId:l}):D==="tools"?t.jsx(ft,{toolSet:b,onToolSetChange:z}):D==="resources"?t.jsx(Kt,{resourceSet:k,onResourceSetChange:G,connectionResources:y}):D==="prompts"?t.jsx(Zt,{promptSet:E,onPromptSetChange:q,connectionPrompts:g}):null,e[57]=D,e[58]=g,e[59]=y,e[60]=O,e[61]=s.icon,e[62]=l,e[63]=E,e[64]=k,e[65]=b,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(Fe,{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(rs,{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(Bt,{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 hs(o){return o.name}function xs(o){return o.id}function ps(){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=Ve(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 m=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(F,{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]!==m?(d=t.jsx(fs,{gateway:r,gatewayId:i,requestedTabId:m}),o[6]=r,o[7]=i,o[8]=m,o[9]=d):d=o[9],d}function gs(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Fe,{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(ps,{})})}),o[0]=e):e=o[0],e}function to(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(gs,{}),o[0]=e):e=o[0],e}export{to as default};
|
|
1
|
+
import{r as S,$ as ye,v as re,V as U,w,c as R,j as t,f as Ve,d as tt,b as st,k as ot,ar as lt,x as nt,y as it,t as Ae}from"./index-Bz1LU39D.js";import{I as Ee,E as rt}from"./empty-state-DgOO5bI1.js";import{E as Fe}from"./error-boundary-uBvOVTCE.js";import{C as Ge}from"./checkbox-B9Ss6ffk.js";import{c as H,B as F,I as Pe}from"./input-CtiQUsvV.js";import{i as at}from"./ArrowLeft-Bps-R0_t.js";import{u as We}from"./use-connection-BXdeHsm0.js";import{C as ct}from"./collection-search-DIEJ7x7R.js";import{s as dt}from"./Plus-CovnOzP9.js";import{i as mt}from"./X-DcqsnRSe.js";import{P as ut}from"./pin-to-sidebar-button-C-akIZzz.js";import{T as ft}from"./tool-set-selector-Dfdgsx2h.js";import{b as ht,a as xt,i as pt}from"./use-gateway-BhC1hXIm.js";import{u as gt,a as bt}from"./use-connection-resources-C8cAy7Nl.js";import{u as jt}from"./use-gateway-system-prompt-uetw6YB3.js";import{s as He}from"./slugify-CEUa2lfQ.js";import{B as qe}from"./badge-8BCP2QJ_.js";import{a as yt,D as vt,c as St,d as Nt}from"./dialog-D9LHhl79.js";import{F as be,a as wt,b as ve,d as Se,f as Ne,c as _t}from"./form-orY-xngM.js";import{I as Ct,R as kt,a as It}from"./index-o28bnKR9.js";import{R as Tt}from"./resource-tabs-GXDudjH9.js";import{S as $t,a as Rt,b as zt,c as At,d as Ue}from"./select-Bxj6_TSM.js";import{S as Et}from"./switch-zovYrKoi.js";import{T as Pt}from"./textarea-D76YOeHc.js";import{a as Z,c as Y,b as J,T as Q}from"./project-context-provider-_aLYBfO9.js";import{i as Ze}from"./Check-Bkw0Gz-n.js";import{i as Mt}from"./Code01-CTUZx8UP.js";import{a as Dt}from"./Copy01-BctGx-5E.js";import{i as Ut}from"./FlipBackward-CpWoOBPz.js";import{i as je}from"./InfoCircle-BXctEVkS.js";import{i as ze}from"./Loading01-CdaWSExX.js";import{a as Lt,V as Ot,b as Bt}from"./layout-C8G6tSLB.js";import"./SearchMd-YxKkBPG0.js";import"./use-organization-settings-DBRSoBd0.js";import"./localstorage-keys-5oG1CfEQ.js";import"./ChevronDown-mvTJP4-S.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.")}),Ft=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 Gt=S.memo(function(e){const s=R.c(20),{connection:l,isSelected:i,hasItemsEnabled:n,activeItemsCount:a,totalItemsCount:c,onSelect:m,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 p;s[5]!==l.title?(p=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]=p):p=s[6];let x;s[7]!==m||s[8]!==f||s[9]!==p?(x=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[f,p]}),s[7]=m,s[8]=f,s[9]=p,s[10]=x):x=s[10];let g;s[11]!==a||s[12]!==n||s[13]!==r||s[14]!==c?(g=c>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[a,"/",c]}),t.jsx(Ge,{checked:n,onCheckedChange:r,onClick:Ht})]}),s[11]=a,s[12]=n,s[13]=r,s[14]=c,s[15]=g):g=s[15];let y;return s[16]!==u||s[17]!==x||s[18]!==g?(y=t.jsxs("div",{className:u,children:[x,g]}),s[16]=u,s[17]=x,s[18]=g,s[19]=y):y=s[19],y}),Wt=S.memo(function(e){const s=R.c(18),{connectionId:l,item:i,isSelected:n,onToggle:a}=e,c=`item-${l}-${i.id}`,m=n?"text-foreground":"text-muted-foreground";let r;s[0]!==m?(r=H("text-sm font-medium",m),s[0]=m,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 p=`item-${l}-${i.id}`;let x;s[10]!==n||s[11]!==a||s[12]!==p?(x=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(Ge,{id:p,checked:n,onCheckedChange:a,onClick:qt})}),s[10]=n,s[11]=a,s[12]=p,s[13]=x):x=s[13];let g;return s[14]!==c||s[15]!==f||s[16]!==x?(g=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:c,children:[f,x]}),s[14]=c,s[15]=f,s[16]=x,s[17]=g):g=s[17],g});function et({itemSet:o,onItemSetChange:e,getItems:s,itemLabel:l,emptyItemsMessage:i,extraContent:n}){const[a,c]=S.useState(""),m=S.useDeferredValue(a),[r,d]=S.useState("all"),[u,f]=S.useState(!1),p=S.useRef(new Set(Object.keys(o))),x=We({searchTerm:m.trim()||void 0}),g=p.current,y=[...g.values()].map(h=>x.find(N=>N.id===h)).filter(h=>h!==void 0),j=x.filter(h=>!g.has(h.id)),v=[...y,...j],b=h=>{const N=o[h];return N!==void 0&&N.length>0},_=v.filter(h=>{if(r==="all")return!0;const N=b(h.id);return r==="selected"?N:r==="unselected"?!N:!0}),[I,k]=S.useState(v[0]?.id??null),C=I?v.find(h=>h.id===I)??null:null,P=C?s(C):[],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(V=>V.id===h);if(!N)return;const z=s(N);if(z.length===0)return;const $=o[h]??[],G=z.map(V=>V.id),W=$.length>0&&G.every(V=>$.includes(V)),q={...o};W?delete q[h]:(q[h]=G,k(h)),e(q)},A=h=>{k(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:c,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(Gt,{connection:h,isSelected:I===h.id,hasItemsEnabled:b(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:C?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(F,{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:C.icon,name:C.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:C.title}),C.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:C.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(Wt,{connectionId:C.id,item:h,isSelected:E(C.id,h.id),onToggle:()=>L(C.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 Ht(o){return o.stopPropagation()}function qt(o){return o.stopPropagation()}function Zt(o){const e=R.c(6),{promptSet:s,onPromptSetChange:l,connectionPrompts:i}=o;let n;e[0]!==i?(n=m=>(i.get(m.id)??[]).map(Yt),e[0]=i,e[1]=n):n=e[1];const a=n;let c;return e[2]!==a||e[3]!==l||e[4]!==s?(c=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]=c):c=e[5],c}function Yt(o){return{id:o.name,name:o.name,description:o.description}}function Jt(o){return o.includes("*")}function Qt(o){const e=R.c(27),{patterns:s,onAddPattern:l,onRemovePattern:i}=o,[n,a]=S.useState("");let c;e[0]!==n||e[1]!==l||e[2]!==s?(c=()=>{const f=n.trim();f&&!s.includes(f)&&(l(f),a(""))},e[0]=n,e[1]=l,e[2]=s,e[3]=c):c=e[3];const m=c;let r;e[4]!==m?(r=f=>{f.key==="Enter"&&(f.preventDefault(),m())},e[4]=m,e[5]=r):r=e[5];const d=r;let u;if(e[6]!==m||e[7]!==d||e[8]!==n||e[9]!==i||e[10]!==s){const f=s.filter(Jt);let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("code",{children:"*"}),e[12]=p):p=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 ",p," for single segment and ",t.jsx("code",{children:"**"})," for multiple segments."]}),e[13]=x):x=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=k=>a(k.target.value),e[14]=g):g=e[14];let y;e[15]!==d||e[16]!==n?(y=t.jsx(Pe,{value:n,onChange:g,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 b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(dt,{size:16}),e[20]=b):b=e[20];let _;e[21]!==m||e[22]!==v?(_=t.jsx(F,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:v,children:b}),e[21]=m,e[22]=v,e[23]=_):_=e[23];let I;e[24]!==_||e[25]!==y?(I=t.jsxs("div",{className:"flex gap-2",children:[y,_]}),e[24]=_,e[25]=y,e[26]=I):I=e[26],u=t.jsxs("div",{className:"border-b border-border p-4 space-y-3",children:[x,I,f.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(k=>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:k}),t.jsx("button",{type:"button",onClick:()=>i(k),className:"text-muted-foreground hover:text-foreground",children:t.jsx(mt,{size:12})})]},k))})]}),e[6]=m,e[7]=d,e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];return u}function Kt(o){const e=R.c(23),{resourceSet:s,onResourceSetChange:l,connectionResources:i}=o,[n]=S.useState(null);let a;e[0]!==i?(a=b=>(i.get(b.id)??[]).map(Xt),e[0]=i,e[1]=a):a=e[1];const c=a;let m;e[2]!==l||e[3]!==s?(m=(b,_)=>{const I=s[b]??[];I.includes(_)||l({...s,[b]:[...I,_]})},e[2]=l,e[3]=s,e[4]=m):m=e[4];const r=m;let d;e[5]!==l||e[6]!==s?(d=(b,_)=>{const k=(s[b]??[]).filter(C=>C!==_);if(k.length===0){const C={...s};delete C[b],l(C)}else l({...s,[b]:k})},e[5]=l,e[6]=s,e[7]=d):d=e[7];const u=d;let f;e[8]!==l?(f=b=>{l(b)},e[8]=l,e[9]=f):f=e[9];const p=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 g=x;let y;e[13]!==r||e[14]!==u||e[15]!==n||e[16]!==g?(y=n?t.jsx(Qt,{patterns:g,onAddPattern:b=>r(n,b),onRemovePattern:b=>u(n,b)}):null,e[13]=r,e[14]=u,e[15]=n,e[16]=g,e[17]=y):y=e[17];const j=y;let v;return e[18]!==j||e[19]!==c||e[20]!==p||e[21]!==s?(v=t.jsx("div",{className:"h-full",children:t.jsx(et,{itemSet:s,onItemSetChange:p,getItems:c,itemLabel:"resources",emptyItemsMessage:"This connection has no resources available",extraContent:j})}),e[18]=j,e[19]=c,e[20]=p,e[21]=s,e[22]=v):v=e[22],v}function Xt(o){return{id:o.uri,name:o.name||o.uri,description:o.description||o.uri}}function es(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(kt,{"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(It,{"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(Ct,{"data-slot":"radio-group-item",className:i,...l,children:n}),e[6]=l,e[7]=i,e[8]=a):a=e[8],a}function ts(o){const s=new TextEncoder().encode(o),l=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(l)}const ss=Ft.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 os(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]??[],c=l.get(n)??[],m=c.length>0&&c.every(r=>a.includes(r));return{connection_id:n,selected_tools:a.length===0||m?null:a,selected_resources:e[n]??null,selected_prompts:s[n]??null}})}function ls(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 c;e[2]!==l?(c=l?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx(Dt,{size:20}),e[2]=l,e[3]=c):c=e[3];const m=l?"Copied!":"Copy URL";let r;e[4]!==m?(r=t.jsx("span",{className:"text-xs font-medium",children:m}),e[4]=m,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==c||e[8]!==r?(d=t.jsxs(F,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,r]}),e[6]=a,e[7]=c,e[8]=r,e[9]=d):d=e[9],d}function ns(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=ts(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,c;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%)"}}),c=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let m;return e[5]!==n?(m=t.jsxs(F,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,c]}),e[5]=n,e[6]=m):m=e[6],m}function is(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"}},null,2),g=`claude mcp add "${f}" --config '${x.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(g),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 c=a;let m;e[3]!==i?(m=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]=m):m=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]!==c||e[8]!==m||e[9]!==d?(u=t.jsxs(F,{type:"button",variant:"outline",onClick:c,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,d]}),e[7]=c,e[8]=m,e[9]=d,e[10]=u):u=e[10],u}function rs(o){const e=R.c(40),{open:s,onOpenChange:l,gateway:i}=o,[n,a]=S.useState("code_execution");let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=$=>{($==="passthrough"||$==="smart_tool_selection"||$==="code_execution")&&a($)},e[0]=c):c=e[0];const m=c;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(yt,{children:t.jsx(vt,{children:"Share Agent"})}),e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=p):p=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 g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=g):g=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:[g,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 b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=b):b=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 I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=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:[b,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]=I):I=e[16];let k;e[17]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Mt,{className:"size-5 text-muted-foreground"})}),e[17]=k):k=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=C):C=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:[k,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[C,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:[p,t.jsxs(es,{value:n,onValueChange:m,className:"flex flex-col gap-4.5",children:[j,I,E]})]}),e[21]=n,e[22]=L):L=e[22];let B;e[23]!==r.href?(B=t.jsx(ls,{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(ns,{gatewayUrl:r.href,serverName:u}),M=t.jsx(is,{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(St,{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(Nt,{open:s,onOpenChange:l,children:N}),e[36]=l,e[37]=s,e[38]=N,e[39]=z):z=e[39],z}function as(o){const e=R.c(31),{form:s,icon:l,gatewayId:i}=o,[n,a]=jt(i);let c;e[0]!==s?(c=s.watch("title")||"Agent",e[0]=s,e[1]=c):c=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(pt,{}),e[2]=m):m=e[2];let r;e[3]!==l||e[4]!==c?(r=t.jsx(Ee,{icon:l,name:c,size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:m}),e[3]=l,e[4]=c,e[5]=r):r=e[5];let d;e[6]!==s.control?(d=t.jsx(be,{control:s.control,name:"status",render:us}),e[6]=s.control,e[7]=d):d=e[7];let u;e[8]!==r||e[9]!==d?(u=t.jsxs("div",{className:"flex items-start justify-between",children:[r,d]}),e[8]=r,e[9]=d,e[10]=u):u=e[10];let f;e[11]!==s.control?(f=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(be,{control:s.control,name:"title",render:ms}),t.jsx(be,{control:s.control,name:"description",render:ds})]}),e[11]=s.control,e[12]=f):f=e[12];let p;e[13]!==u||e[14]!==f?(p=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15];let x;e[16]!==s.control?(x=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:cs})}),e[16]=s.control,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=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[18]=g):g=e[18];let y;e[19]!==a?(y=_=>a(_.target.value),e[19]=a,e[20]=y):y=e[20];let j;e[21]!==n||e[22]!==y?(j=t.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[g,t.jsx(Pt,{value:n,onChange:y,placeholder:"Enter system prompt instructions...",className:"min-h-[240px] resize-none text-sm leading-relaxed"})]}),e[21]=n,e[22]=y,e[23]=j):j=e[23];let v;e[24]!==j||e[25]!==p||e[26]!==x?(v=t.jsxs("div",{className:"flex flex-col",children:[p,x,j]}),e[24]=j,e[25]=p,e[26]=x,e[27]=v):v=e[27];let b;return e[28]!==s||e[29]!==v?(b=t.jsx("div",{className:"flex flex-col h-full overflow-auto",children:t.jsx(wt,{...s,children:v})}),e[28]=s,e[29]=v,e[30]=b):b=e[30],b}function cs(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(_t,{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(F,{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($t,{value:e.value,onValueChange:e.onChange,children:[t.jsx(Se,{children:t.jsx(Rt,{className:"w-[180px]",children:t.jsx(zt,{})})}),t.jsxs(At,{children:[t.jsx(Ue,{value:"inclusion",children:"Include Selected"}),t.jsx(Ue,{value:"exclusion",children:"Exclude Selected"})]})]})]})]}),t.jsx(Ne,{})]})}function ds(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 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,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 us(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(Et,{checked:e.value==="active",onCheckedChange:s=>e.onChange(s?"active":"inactive")})})]}),t.jsx(Ne,{})]})}function fs(o){const e=R.c(81),{gateway:s,gatewayId:l,requestedTabId:i}=o,a=ot().location.href,c=lt();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={from:"/$org/gateways/$gatewayId"},e[0]=m):m=e[0];const r=Ve(m),d=xt();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const f=We(u);let p;e[2]!==f?(p=f.map(xs),e[2]=f,e[3]=p):p=e[3];const x=p,{promptsMap:g}=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(hs));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[b,_]=S.useState(v);let I;e[9]!==s?(I=()=>Oe(s),e[9]=s,e[10]=I):I=e[10];const[k,C]=S.useState(I);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=>{C(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 V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=nt(ss),e[16]=V):V=e[16];const we=s.tool_selection_mode??"inclusion";let ce;e[17]!==s.description||e[18]!==s.status||e[19]!==s.title||e[20]!==we?(ce={resolver:V,defaultValues:{title:s.title,description:s.description,status:s.status,tool_selection_mode:we}},e[17]=s.description,e[18]=s.status,e[19]=s.title,e[20]=we,e[21]=ce):ce=e[21];const O=it(ce),_e=O.formState.isDirty||B;let de;e[22]!==d.update||e[23]!==j||e[24]!==O||e[25]!==l||e[26]!==E||e[27]!==k||e[28]!==b?(de=async()=>{const T=O.getValues(),$e=os(b,k,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]=k,e[28]=b,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)),C(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]!==c.history?(K=()=>c.history.back(),e[37]=c.history,e[38]=K):K=e[38];let X;e[39]!==D||e[40]!==Ie?(X=t.jsx(Lt,{children:t.jsx(Tt,{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]!==_e||e[45]!==ae?(ee=_e&&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(F,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:ke,"aria-label":"Cancel",children:t.jsx(Ut,{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(F,{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]=_e,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(F,{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(Ot,{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]!==g||e[59]!==y||e[60]!==O||e[61]!==s.icon||e[62]!==l||e[63]!==E||e[64]!==k||e[65]!==b?(oe=D==="settings"?t.jsx(as,{form:O,icon:s.icon,gatewayId:l}):D==="tools"?t.jsx(ft,{toolSet:b,onToolSetChange:z}):D==="resources"?t.jsx(Kt,{resourceSet:k,onResourceSetChange:G,connectionResources:y}):D==="prompts"?t.jsx(Zt,{promptSet:E,onPromptSetChange:q,connectionPrompts:g}):null,e[57]=D,e[58]=g,e[59]=y,e[60]=O,e[61]=s.icon,e[62]=l,e[63]=E,e[64]=k,e[65]=b,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(Fe,{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(rs,{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(Bt,{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 hs(o){return o.name}function xs(o){return o.id}function ps(){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=Ve(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 m=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(F,{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]!==m?(d=t.jsx(fs,{gateway:r,gatewayId:i,requestedTabId:m}),o[6]=r,o[7]=i,o[8]=m,o[9]=d):d=o[9],d}function gs(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Fe,{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(ps,{})})}),o[0]=e):e=o[0],e}function to(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(gs,{}),o[0]=e):e=o[0],e}export{to as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as ee,j as t,r as te,f as oe}from"./index-
|
|
1
|
+
import{c as ee,j as t,r as te,f as oe}from"./index-Bz1LU39D.js";import{C as re}from"./collection-header-CUphFaJM.js";import{C as ne}from"./collection-page-C8c74lBQ.js";import{C as ie}from"./collection-search-DIEJ7x7R.js";import{C as ae}from"./collection-table-wrapper-x8zydyA0.js";import{C as le}from"./connection-card-CTMXB5Zh.js";import{E as W,I as ce}from"./empty-state-DgOO5bI1.js";import{E as de}from"./error-boundary-uBvOVTCE.js";import{u as me,a as ue,i as x}from"./use-gateway-BhC1hXIm.js";import{u as ge,s as J}from"./use-list-state-CAv4RNZg.js";import{u as pe}from"./use-create-gateway-D8vNiD2K.js";import{u as he}from"./project-context-provider-_aLYBfO9.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-B2ogXLEp.js";import{B as se}from"./badge-8BCP2QJ_.js";import{B as q}from"./input-CtiQUsvV.js";import{b as Q,D as U,a as X,c as B}from"./dropdown-menu-DjFWyTtD.js";import{i as Y}from"./DotsVertical-CzCtj25W.js";import{i as Se}from"./Loading01-CdaWSExX.js";import{s as Z}from"./Trash01-DopdNXEu.js";import"./collection-display-button-DroTLKfu.js";import"./Grid01-BEpepbVy.js";import"./Check-Bkw0Gz-n.js";import"./view-mode-toggle-CVcyaB_S.js";import"./SearchMd-YxKkBPG0.js";import"./card-XgDm8_H9.js";import"./use-mobile-sd5ko6M_.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(),i=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=ge(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:G,isCreating:w}=pe(C),O=ue();let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y={mode:"idle"},e[3]=y):y=e[3];const[n,N]=te.useReducer(ve,y);let D;e[4]!==O||e[5]!==n.gateway||e[6]!==n.mode?(D=async()=>{if(n.mode!=="deleting")return;const o=n.gateway.id;N({type:"close"});try{await O.delete.mutateAsync(o)}catch{}},e[4]=O,e[5]=n.gateway,e[6]=n.mode,e[7]=D):D=e[7];const R=D;let S,v,b,k,I,_;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]"},I={id:"connections",header:"Connections",render:ze,cellClassName:"w-24 shrink-0"},_={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]=I,e[13]=_):(S=e[8],v=e[9],b=e[10],k=e[11],I=e[12],_=e[13]);let A;e[14]!==i||e[15]!==r.slug?(A=[S,v,b,k,I,_,{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:Ae,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:_e,children:[t.jsxs(B,{onClick:a=>{a.stopPropagation(),i({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Inspect"]}),t.jsxs(B,{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]=i,e[15]=r.slug,e[16]=A):A=e[16];const T=A,V=w?"Creating...":"Create Agent";let M;e[17]!==G||e[18]!==w||e[19]!==V?(M=t.jsx(q,{onClick:G,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:w,children:V}),e[17]=G,e[18]=w,e[19]=V,e[20]=M):M=e[20];const H=M,L=n.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=n.mode==="deleting"&&n.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 g;e[42]!==s?(g=o=>{o.key==="Escape"&&(s.setSearch(""),o.target.blur())},e[42]=s,e[43]=g):g=e[43];let p;e[44]!==s.search||e[45]!==s.setSearch||e[46]!==g?(p=t.jsx(ie,{value:s.search,onChange:s.setSearch,placeholder:"Search for an agent...",onKeyDown:g}),e[44]=s.search,e[45]=s.setSearch,e[46]=g,e[47]=p):p=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]!==i||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:()=>i({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:Ie,children:t.jsx(Y,{size:20})})}),t.jsxs(X,{align:"end",onClick:ke,children:[t.jsxs(B,{onClick:a=>{a.stopPropagation(),i({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:o.id}})},children:[t.jsx(J,{size:16}),"Inspect"]}),t.jsxs(B,{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=>i({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]=i,e[56]=r.slug,e[57]=h):h=e[57];let K;return e[58]!==m||e[59]!==u||e[60]!==p||e[61]!==h?(K=t.jsxs(ne,{children:[m,u,p,h]}),e[58]=m,e[59]=u,e[60]=p,e[61]=h,e[62]=K):K=e[62],K}function ke(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function _e(e){return e.stopPropagation()}function Ae(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 ct(){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{ct as default};
|