@samanhappy/mcphub 1.0.35 → 1.0.37
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/README.fr.md +48 -17
- package/README.md +50 -39
- package/README.zh.md +50 -37
- package/dist/clients/openapi.js +32 -1
- package/dist/clients/openapi.js.map +1 -1
- package/dist/controllers/credentialBindingController.js +56 -0
- package/dist/controllers/credentialBindingController.js.map +1 -0
- package/dist/controllers/groupController.js +63 -14
- package/dist/controllers/groupController.js.map +1 -1
- package/dist/controllers/serverController.js +26 -4
- package/dist/controllers/serverController.js.map +1 -1
- package/dist/controllers/userController.js +3 -0
- package/dist/controllers/userController.js.map +1 -1
- package/dist/dao/CredentialBindingDao.js +48 -0
- package/dist/dao/CredentialBindingDao.js.map +1 -0
- package/dist/dao/CredentialBindingDaoDbImpl.js +20 -0
- package/dist/dao/CredentialBindingDaoDbImpl.js.map +1 -0
- package/dist/dao/DaoFactory.js +7 -0
- package/dist/dao/DaoFactory.js.map +1 -1
- package/dist/dao/DatabaseDaoFactory.js +4 -0
- package/dist/dao/DatabaseDaoFactory.js.map +1 -1
- package/dist/dao/GroupDaoDbImpl.js +18 -0
- package/dist/dao/GroupDaoDbImpl.js.map +1 -1
- package/dist/dao/ServerDaoDbImpl.js +3 -0
- package/dist/dao/ServerDaoDbImpl.js.map +1 -1
- package/dist/db/connection.js +3 -2
- package/dist/db/connection.js.map +1 -1
- package/dist/db/entities/CredentialBinding.js +33 -0
- package/dist/db/entities/CredentialBinding.js.map +1 -0
- package/dist/db/entities/Group.js +9 -1
- package/dist/db/entities/Group.js.map +1 -1
- package/dist/db/entities/Server.js +4 -0
- package/dist/db/entities/Server.js.map +1 -1
- package/dist/db/entities/index.js +3 -1
- package/dist/db/entities/index.js.map +1 -1
- package/dist/db/groupSchema.js +29 -0
- package/dist/db/groupSchema.js.map +1 -0
- package/dist/middlewares/auth.js +2 -0
- package/dist/middlewares/auth.js.map +1 -1
- package/dist/middlewares/i18n.js +2 -1
- package/dist/middlewares/i18n.js.map +1 -1
- package/dist/routes/index.js +19 -4
- package/dist/routes/index.js.map +1 -1
- package/dist/services/activityLoggingService.js +21 -8
- package/dist/services/activityLoggingService.js.map +1 -1
- package/dist/services/credentialBindingService.js +193 -0
- package/dist/services/credentialBindingService.js.map +1 -0
- package/dist/services/groupService.js +57 -23
- package/dist/services/groupService.js.map +1 -1
- package/dist/services/logService.js +11 -2
- package/dist/services/logService.js.map +1 -1
- package/dist/services/mcpService.js +478 -77
- package/dist/services/mcpService.js.map +1 -1
- package/dist/services/oauthClientRegistration.js +22 -7
- package/dist/services/oauthClientRegistration.js.map +1 -1
- package/dist/services/oauthSettingsStore.js +3 -0
- package/dist/services/oauthSettingsStore.js.map +1 -1
- package/dist/services/principalRuntimeService.js +109 -0
- package/dist/services/principalRuntimeService.js.map +1 -0
- package/dist/services/serverConfigPresenter.js +3 -0
- package/dist/services/serverConfigPresenter.js.map +1 -1
- package/dist/services/sseService.js +65 -16
- package/dist/services/sseService.js.map +1 -1
- package/dist/utils/credentialTemplate.js +38 -0
- package/dist/utils/credentialTemplate.js.map +1 -0
- package/dist/utils/groupAccess.js +17 -0
- package/dist/utils/groupAccess.js.map +1 -0
- package/dist/utils/migration.js +11 -0
- package/dist/utils/migration.js.map +1 -1
- package/dist/utils/rateLimit.js +85 -18
- package/dist/utils/rateLimit.js.map +1 -1
- package/dist/utils/serverConfigPersistence.js +2 -0
- package/dist/utils/serverConfigPersistence.js.map +1 -1
- package/frontend/dist/assets/{ActivityPage-B4OBJUBq.js → ActivityPage-Bx5-Jrxq.js} +2 -2
- package/frontend/dist/assets/{ActivityPage-B4OBJUBq.js.map → ActivityPage-Bx5-Jrxq.js.map} +1 -1
- package/frontend/dist/assets/{ConfirmDialog-3APts2Y9.js → ConfirmDialog-uWBwm8J1.js} +2 -2
- package/frontend/dist/assets/{ConfirmDialog-3APts2Y9.js.map → ConfirmDialog-uWBwm8J1.js.map} +1 -1
- package/frontend/dist/assets/CredentialsPage-BGbk_kBx.js +2 -0
- package/frontend/dist/assets/CredentialsPage-BGbk_kBx.js.map +1 -0
- package/frontend/dist/assets/{Dashboard-czP-DGHn.js → Dashboard-gHeXLPEn.js} +2 -2
- package/frontend/dist/assets/{Dashboard-czP-DGHn.js.map → Dashboard-gHeXLPEn.js.map} +1 -1
- package/frontend/dist/assets/{DeleteDialog-D9ycSRvn.js → DeleteDialog-BYhrMGZo.js} +2 -2
- package/frontend/dist/assets/{DeleteDialog-D9ycSRvn.js.map → DeleteDialog-BYhrMGZo.js.map} +1 -1
- package/frontend/dist/assets/{EndpointCopy-CDwtdCHE.js → EndpointCopy-BRwX7Dpv.js} +2 -2
- package/frontend/dist/assets/{EndpointCopy-CDwtdCHE.js.map → EndpointCopy-BRwX7Dpv.js.map} +1 -1
- package/frontend/dist/assets/GroupsPage-grCAx55k.js +33 -0
- package/frontend/dist/assets/GroupsPage-grCAx55k.js.map +1 -0
- package/frontend/dist/assets/{LoginPage-BBzViqLx.js → LoginPage-C7-m2jmB.js} +2 -2
- package/frontend/dist/assets/{LoginPage-BBzViqLx.js.map → LoginPage-C7-m2jmB.js.map} +1 -1
- package/frontend/dist/assets/{LogsPage-CqbaqFiQ.js → LogsPage-B00XTokA.js} +2 -2
- package/frontend/dist/assets/{LogsPage-CqbaqFiQ.js.map → LogsPage-B00XTokA.js.map} +1 -1
- package/frontend/dist/assets/{MarketPage-DinCKwrj.js → MarketPage-CVJMdSDD.js} +2 -2
- package/frontend/dist/assets/{MarketPage-DinCKwrj.js.map → MarketPage-CVJMdSDD.js.map} +1 -1
- package/frontend/dist/assets/{OAuthConsentPage-BuPcJ2zS.js → OAuthConsentPage-znW3HtpR.js} +2 -2
- package/frontend/dist/assets/{OAuthConsentPage-BuPcJ2zS.js.map → OAuthConsentPage-znW3HtpR.js.map} +1 -1
- package/frontend/dist/assets/{Pagination-Dwko3g48.js → Pagination-CLUvn47x.js} +2 -2
- package/frontend/dist/assets/{Pagination-Dwko3g48.js.map → Pagination-CLUvn47x.js.map} +1 -1
- package/frontend/dist/assets/{PromptsPage-CJ-wYRAL.js → PromptsPage-DGcNS3fO.js} +2 -2
- package/frontend/dist/assets/{PromptsPage-CJ-wYRAL.js.map → PromptsPage-DGcNS3fO.js.map} +1 -1
- package/frontend/dist/assets/{ResourcesPage-DRV8gnZV.js → ResourcesPage-CfyZoadu.js} +2 -2
- package/frontend/dist/assets/{ResourcesPage-DRV8gnZV.js.map → ResourcesPage-CfyZoadu.js.map} +1 -1
- package/frontend/dist/assets/ServersPage-BlC0RdIu.js +39 -0
- package/frontend/dist/assets/ServersPage-BlC0RdIu.js.map +1 -0
- package/frontend/dist/assets/{SettingsPage-Czv4OhtK.js → SettingsPage-CiVNDyr_.js} +2 -2
- package/frontend/dist/assets/{SettingsPage-Czv4OhtK.js.map → SettingsPage-CiVNDyr_.js.map} +1 -1
- package/frontend/dist/assets/{StatusDot-CwpmIlJi.js → StatusDot-DYO56shE.js} +2 -2
- package/frontend/dist/assets/{StatusDot-CwpmIlJi.js.map → StatusDot-DYO56shE.js.map} +1 -1
- package/frontend/dist/assets/{ToggleGroup-1qFTkDqh.js → ToggleGroup-r8yGt_Fq.js} +2 -2
- package/frontend/dist/assets/{ToggleGroup-1qFTkDqh.js.map → ToggleGroup-r8yGt_Fq.js.map} +1 -1
- package/frontend/dist/assets/{UsersPage-CAMXgywh.js → UsersPage-B3muXE90.js} +2 -2
- package/frontend/dist/assets/{UsersPage-CAMXgywh.js.map → UsersPage-B3muXE90.js.map} +1 -1
- package/frontend/dist/assets/{framework-vendor-BHAQX05P.js → framework-vendor-_YL27Pfc.js} +2 -2
- package/frontend/dist/assets/{framework-vendor-BHAQX05P.js.map → framework-vendor-_YL27Pfc.js.map} +1 -1
- package/frontend/dist/assets/{i18n-vendor-CMcB7XUR.js → i18n-vendor-BMaj5qV8.js} +2 -2
- package/frontend/dist/assets/{i18n-vendor-CMcB7XUR.js.map → i18n-vendor-BMaj5qV8.js.map} +1 -1
- package/frontend/dist/assets/{icons-vendor-HZHHWeTa.js → icons-vendor-VW-UwEhw.js} +3 -3
- package/frontend/dist/assets/{icons-vendor-HZHHWeTa.js.map → icons-vendor-VW-UwEhw.js.map} +1 -1
- package/frontend/dist/assets/index-B-aT0HW5.js +3 -0
- package/frontend/dist/assets/index-B-aT0HW5.js.map +1 -0
- package/frontend/dist/assets/{index-DtrCVU1h.css → index-B3OqAhGz.css} +1 -1
- package/frontend/dist/assets/{resourceService-BTVgor9F.js → resourceService-CSXOSi7M.js} +2 -2
- package/frontend/dist/assets/{resourceService-BTVgor9F.js.map → resourceService-CSXOSi7M.js.map} +1 -1
- package/frontend/dist/assets/{useCostData-CDVGUx_e.js → useCostData-BOxUFQAH.js} +2 -2
- package/frontend/dist/assets/{useCostData-CDVGUx_e.js.map → useCostData-BOxUFQAH.js.map} +1 -1
- package/frontend/dist/assets/useSettingsData-DmpLlRI6.js +2 -0
- package/frontend/dist/assets/{useSettingsData-92nglN_X.js.map → useSettingsData-DmpLlRI6.js.map} +1 -1
- package/frontend/dist/assets/variableDetection-cmwwuSWB.js +16 -0
- package/frontend/dist/assets/variableDetection-cmwwuSWB.js.map +1 -0
- package/frontend/dist/index.html +5 -5
- package/package.json +4 -5
- package/frontend/dist/assets/GroupsPage-BgUHjkGb.js +0 -33
- package/frontend/dist/assets/GroupsPage-BgUHjkGb.js.map +0 -1
- package/frontend/dist/assets/ServersPage-CbtcAcVH.js +0 -39
- package/frontend/dist/assets/ServersPage-CbtcAcVH.js.map +0 -1
- package/frontend/dist/assets/index-Cb6IBpZR.js +0 -3
- package/frontend/dist/assets/index-Cb6IBpZR.js.map +0 -1
- package/frontend/dist/assets/useSettingsData-92nglN_X.js +0 -2
- package/frontend/dist/assets/variableDetection-BlOwsGsz.js +0 -16
- package/frontend/dist/assets/variableDetection-BlOwsGsz.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{r as x,j as e}from"./framework-vendor-_YL27Pfc.js";import{e as Rr,i as zr}from"./index-B-aT0HW5.js";import{f as Lr,a as Wr,O as $r}from"./contextCost-CilWqGWT.js";import{u as qr}from"./i18n-vendor-BMaj5qV8.js";import{X as fr}from"./icons-vendor-VW-UwEhw.js";const jr=a=>{const l={};return a.forEach(({key:r,value:d})=>{const m=r.trim();m&&(l[m]=d)}),l},Sr=a=>a?a.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],Br=a=>Array.from(new Set((a||[]).map(l=>l.trim()).filter(l=>l.length>0))),_r=a=>{const l={};return typeof(a==null?void 0:a.timeout)=="number"&&!Number.isNaN(a.timeout)&&(l.timeout=a.timeout),typeof(a==null?void 0:a.resetTimeoutOnProgress)=="boolean"&&(l.resetTimeoutOnProgress=a.resetTimeoutOnProgress),a!=null&&a.maxTotalTimeout&&(l.maxTotalTimeout=a.maxTotalTimeout),l},Xr=a=>{var p,k,i,c,b,K,T,w;if(!a)return{};const l={},r=(p=a.clientId)==null?void 0:p.trim(),d=(k=a.clientSecret)==null?void 0:k.trim(),m=(i=a.scopes)==null?void 0:i.trim(),t=(c=a.accessToken)==null?void 0:c.trim(),h=(b=a.refreshToken)==null?void 0:b.trim(),y=(K=a.authorizationEndpoint)==null?void 0:K.trim(),u=(T=a.tokenEndpoint)==null?void 0:T.trim(),j=(w=a.resource)==null?void 0:w.trim();if(r&&(l.clientId=r),d&&(l.clientSecret=d),m){const A=m.split(/[\s,]+/).map(N=>N.trim()).filter(N=>N.length>0);A.length>0&&(l.scopes=A)}return t&&(l.accessToken=t),h&&(l.refreshToken=h),y&&(l.authorizationEndpoint=y),u&&(l.tokenEndpoint=u),j&&(l.resource=j),l},Jr=a=>{var y,u,j,p,k,i,c,b,K,T,w,A,N,F,M,O,v,U,R,z,L,W,$;const l={version:((y=a.openapi)==null?void 0:y.version)||"3.1.0",passthroughHeaders:Sr((u=a.openapi)==null?void 0:u.passthroughHeaders),cookieSession:((j=a.openapi)==null?void 0:j.cookieSession)===!0?!0:void 0},r=(k=(p=a.openapi)==null?void 0:p.oauth2TokenUrl)==null?void 0:k.trim(),d=(c=(i=a.openapi)==null?void 0:i.oauth2ClientId)==null?void 0:c.trim(),m=(K=(b=a.openapi)==null?void 0:b.oauth2ClientSecret)==null?void 0:K.trim(),t=(w=(T=a.openapi)==null?void 0:T.oauth2Token)==null?void 0:w.trim();if(((A=a.openapi)==null?void 0:A.inputMode)==="url")l.url=((N=a.openapi)==null?void 0:N.url)||"";else if(((F=a.openapi)==null?void 0:F.inputMode)==="schema"&&((M=a.openapi)!=null&&M.schema))try{l.schema=JSON.parse(a.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}(O=a.openapi)!=null&&O.securityType&&a.openapi.securityType!=="none"&&(l.security={type:a.openapi.securityType,...a.openapi.securityType==="apiKey"&&{apiKey:{name:a.openapi.apiKeyName||"",in:a.openapi.apiKeyIn||"header",value:a.openapi.apiKeyValue||""}},...a.openapi.securityType==="http"&&{http:{scheme:a.openapi.httpScheme||"bearer",credentials:a.openapi.httpCredentials||""}},...a.openapi.securityType==="oauth2"&&{oauth2:{...r&&{tokenUrl:r},...d&&{clientId:d},...m&&{clientSecret:m},...t&&{token:t}}},...a.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:a.openapi.openIdConnectUrl||"",token:a.openapi.openIdConnectToken||""}}});const h=(v=a.openapi)==null?void 0:v.specSecurityType;return h&&h!=="none"&&(l.specSecurity={type:h,...h==="apiKey"&&{apiKey:{name:((U=a.openapi)==null?void 0:U.specApiKeyName)||"",in:((R=a.openapi)==null?void 0:R.specApiKeyIn)||"header",value:((z=a.openapi)==null?void 0:z.specApiKeyValue)||""}},...h==="http"&&{http:{scheme:((L=a.openapi)==null?void 0:L.specHttpScheme)||"basic",credentials:((W=a.openapi)==null?void 0:W.specHttpCredentials)||""}},...h==="oauth2"&&{oauth2:{token:(($=a.openapi)==null?void 0:$.specOauth2Token)||""}}}),l},ue=({formData:a,serverType:l,envVars:r,headerVars:d})=>{var j,p,k,i,c;const m=jr(r),t=jr(d),h=_r(a.options),y=((j=a.description)==null?void 0:j.trim())||"",u={type:l,description:y,options:h,visibility:a.visibility??"private",sharedWithUsers:a.visibility==="group"?Br(a.sharedWithUsers):void 0,credentialTemplate:(p=a.credentialTemplate)==null?void 0:p.map(b=>({...b,target:l==="stdio"?"env":"headers"})),perSessionClient:a.perSessionClient===!0?!0:void 0,startOnDemand:a.startOnDemand===!0?!0:void 0,idleTimeoutMs:a.startOnDemand===!0||(k=a.credentialTemplate)!=null&&k.length?a.idleTimeoutMs??3e5:void 0,proxy:a.proxy};if(l==="openapi")u.headers=t,u.openapi=Jr(a);else if(l==="sse"||l==="streamable-http"){const b=((i=a.keepAlive)==null?void 0:i.enabled)===!0;u.url=a.url.trim(),u.env=m,u.headers=t,u.passthroughHeaders=Sr(a.passthroughHeaders),u.oauth=Xr(a.oauth),u.enableKeepAlive=b,u.keepAliveInterval=b?((c=a.keepAlive)==null?void 0:c.interval)||6e4:void 0}else u.command=a.command.trim(),u.args=a.args,u.env=m;return{name:a.name.trim(),config:u}},Gr=(a=[],l=[])=>Array.from(new Set([...a,...l])).sort((r,d)=>r.localeCompare(d)),Qr=(a,l)=>{const r=l.trim().toLowerCase();return r?a.filter(d=>d.toLowerCase().includes(r)):[...a]},Zr=(a,l)=>Array.from(new Set([...a,...l])),Yr=(a,l)=>{const r=new Set(l);return a.filter(d=>!r.has(d))};function Cr(a,l=!1){if(l)return!1;const r=a.openapi;return r&&r.securityType&&r.securityType!=="none"?!1:!(r!=null&&r.apiKeyValue)&&!(r!=null&&r.httpCredentials)&&!(r!=null&&r.oauth2TokenUrl)&&!(r!=null&&r.oauth2ClientId)&&!(r!=null&&r.oauth2ClientSecret)&&!(r!=null&&r.oauth2Token)&&!(r!=null&&r.openIdConnectUrl)&&!(r!=null&&r.openIdConnectToken)}function Dr(a,l,r=!1){var m,t,h,y,u;if(!l.declared||!l.supported||!l.prefill||!Cr(a,r))return a;const d=l.prefill;return{...a,openapi:{...a.openapi,securityType:d.type,apiKeyName:((m=d.apiKey)==null?void 0:m.name)||"",apiKeyIn:((t=d.apiKey)==null?void 0:t.in)||"header",apiKeyValue:"",httpScheme:((h=d.http)==null?void 0:h.scheme)||"bearer",httpCredentials:"",oauth2TokenUrl:((y=d.oauth2)==null?void 0:y.tokenUrl)||"",oauth2ClientId:"",oauth2ClientSecret:"",oauth2Token:"",openIdConnectUrl:((u=d.openIdConnect)==null?void 0:u.url)||"",openIdConnectToken:""}}}function et(a,l){var d,m,t;if(!l.prefill)return!1;const r=a.openapi;if((r==null?void 0:r.securityType)!==l.prefill.type)return!0;switch(r==null?void 0:r.securityType){case"apiKey":return r.apiKeyName!==((d=l.prefill.apiKey)==null?void 0:d.name)||r.apiKeyIn!==((m=l.prefill.apiKey)==null?void 0:m.in);case"http":return r.httpScheme!==((t=l.prefill.http)==null?void 0:t.scheme);default:return!1}}function st(a){const l=a.openapi,r=l==null?void 0:l.securityType;if(!r||r==="none")return null;switch(r){case"apiKey":return`API key in ${(l==null?void 0:l.apiKeyIn)||"header"} '${(l==null?void 0:l.apiKeyName)||""}'`;case"http":return`HTTP ${(l==null?void 0:l.httpScheme)||"bearer"}`;case"oauth2":return"OAuth2";case"openIdConnect":return"OpenID Connect";default:return null}}function rt(a,l,r={}){return l!=null&&l.declared?!Cr(a,r.securityTouched)&&et(a,l)?{kind:"warning",messageKey:"securityMismatchWarning",values:{summary:l.summary,configured:st(a)||"none"}}:l.supported?{kind:"info",messageKey:"securityPrefillNotice",values:{summary:l.summary}}:{kind:"warning",messageKey:"securityUnsupportedNotice",values:{summary:l.summary,reason:l.unsupportedReason||""}}:r.includeNotDeclared?{kind:"info",messageKey:"securityNotDeclared",values:{}}:null}function kr(a){var d,m,t,h;const l=((d=a.openapi)==null?void 0:d.inputMode)==="schema"?"schema":"url",r=((h=l==="schema"?(m=a.openapi)==null?void 0:m.schema:(t=a.openapi)==null?void 0:t.url)==null?void 0:h.trim())||"";return{mode:l,value:r,key:r?`${l}:${r}`:""}}function Tr(a){if(!a.value)return!1;if(a.mode==="schema")try{const l=JSON.parse(a.value);return l!==null&&typeof l=="object"&&!Array.isArray(l)}catch{return!1}try{const l=new URL(a.value);return l.protocol==="http:"||l.protocol==="https:"}catch{return!1}}function tt(a){return!a.isEdit&&a.serverType==="openapi"&&Tr(a.source)&&a.source.key!==a.analyzedSourceKey}const wr=/^[A-Za-z0-9._-]+$/,me=128,Nr=a=>{const l=a.trim();return l.length>0&&l.length<=me&&wr.test(l)&&!l.includes("..")},ct=a=>a.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/\.{2,}/g,".").replace(/^-+|-+$/g,"").slice(0,me)||"server",pt=({onSubmit:a,onCancel:l,initialData:r=null,modalTitle:d,formError:m=null})=>{var Ie,Ke,Oe,Ue,Ee,He,Fe,Pe,Ve,Me,Re,ze,Le,We,$e,qe,Be,_e,Xe,Je,Ge,Qe,Ze,Ye,De,es,ss,rs,ts,ns,as,os,ls,is,cs,ps,ds,us,ms,hs,xs,ys,gs,bs,vs,fs,js,ks,Ns,Ss,Cs,Ts,ws,As,Is,Ks,Os,Us,Es,Hs,Fs,Ps,Vs,Ms,Rs,zs,Ls,Ws,$s,qs,Bs,_s,Xs,Js,Gs,Qs,Zs,Ys,Ds,er,sr,rr,tr,nr,ar,or,lr,ir,cr,pr,dr,ur,mr,hr,xr,yr,gr,br,vr;const{t}=qr(),h=!(r!=null&&r.name)||Nr(r.name),y=()=>!r||!r.config?"stdio":r.config.type?r.config.type:r.config.url?"sse":"stdio",u=n=>!n||!n.config||!n.config.env?[]:Object.entries(n.config.env).map(([s,o])=>({key:s,value:o,description:""})),j=n=>{var o;const s=(o=n==null?void 0:n.config)==null?void 0:o.oauth;return{clientId:(s==null?void 0:s.clientId)||"",clientSecret:(s==null?void 0:s.clientSecret)||"",scopes:s!=null&&s.scopes?s.scopes.join(" "):"",accessToken:(s==null?void 0:s.accessToken)||"",refreshToken:(s==null?void 0:s.refreshToken)||"",authorizationEndpoint:(s==null?void 0:s.authorizationEndpoint)||"",tokenEndpoint:(s==null?void 0:s.tokenEndpoint)||"",resource:(s==null?void 0:s.resource)||""}},[p,k]=x.useState(y()),[i,c]=x.useState({name:r&&r.name||"",description:r&&r.config&&r.config.description||"",url:r&&r.config&&r.config.url||"",command:r&&r.config&&r.config.command||"",arguments:r&&r.config&&r.config.args?Array.isArray(r.config.args)?r.config.args.join(" "):String(r.config.args):"",args:r&&r.config&&r.config.args||[],type:y(),env:u(r),headers:[],passthroughHeaders:((Ke=(Ie=r==null?void 0:r.config)==null?void 0:Ie.passthroughHeaders)==null?void 0:Ke.join(", "))||"",visibility:((Oe=r==null?void 0:r.config)==null?void 0:Oe.visibility)??"private",sharedWithUsers:((Ue=r==null?void 0:r.config)==null?void 0:Ue.sharedWithUsers)||[],options:{timeout:r&&r.config&&r.config.options&&r.config.options.timeout||6e4,resetTimeoutOnProgress:((He=(Ee=r==null?void 0:r.config)==null?void 0:Ee.options)==null?void 0:He.resetTimeoutOnProgress)??!0,maxTotalTimeout:r&&r.config&&r.config.options&&r.config.options.maxTotalTimeout||void 0},oauth:j(r),keepAlive:{enabled:((Fe=r==null?void 0:r.config)==null?void 0:Fe.enableKeepAlive)===!0,interval:((Pe=r==null?void 0:r.config)==null?void 0:Pe.keepAliveInterval)||6e4},perSessionClient:((Ve=r==null?void 0:r.config)==null?void 0:Ve.perSessionClient)===!0,credentialTemplate:((Me=r==null?void 0:r.config)==null?void 0:Me.credentialTemplate)||[],proxy:(Re=r==null?void 0:r.config)==null?void 0:Re.proxy,startOnDemand:((ze=r==null?void 0:r.config)==null?void 0:ze.startOnDemand)===!0,idleTimeoutMs:((Le=r==null?void 0:r.config)==null?void 0:Le.idleTimeoutMs)??3e5,openapi:r&&r.config&&r.config.openapi?{url:r.config.openapi.url||"",schema:r.config.openapi.schema?JSON.stringify(r.config.openapi.schema,null,2):"",inputMode:r.config.openapi.url?"url":r.config.openapi.schema?"schema":"url",version:r.config.openapi.version||"3.1.0",securityType:((We=r.config.openapi.security)==null?void 0:We.type)||"none",apiKeyName:((qe=($e=r.config.openapi.security)==null?void 0:$e.apiKey)==null?void 0:qe.name)||"",apiKeyIn:((_e=(Be=r.config.openapi.security)==null?void 0:Be.apiKey)==null?void 0:_e.in)||"header",apiKeyValue:((Je=(Xe=r.config.openapi.security)==null?void 0:Xe.apiKey)==null?void 0:Je.value)||"",httpScheme:((Qe=(Ge=r.config.openapi.security)==null?void 0:Ge.http)==null?void 0:Qe.scheme)||"bearer",httpCredentials:((Ye=(Ze=r.config.openapi.security)==null?void 0:Ze.http)==null?void 0:Ye.credentials)||"",oauth2TokenUrl:((es=(De=r.config.openapi.security)==null?void 0:De.oauth2)==null?void 0:es.tokenUrl)||"",oauth2ClientId:((rs=(ss=r.config.openapi.security)==null?void 0:ss.oauth2)==null?void 0:rs.clientId)||"",oauth2ClientSecret:((ns=(ts=r.config.openapi.security)==null?void 0:ts.oauth2)==null?void 0:ns.clientSecret)||"",oauth2Token:((os=(as=r.config.openapi.security)==null?void 0:as.oauth2)==null?void 0:os.token)||"",openIdConnectUrl:((is=(ls=r.config.openapi.security)==null?void 0:ls.openIdConnect)==null?void 0:is.url)||"",openIdConnectToken:((ps=(cs=r.config.openapi.security)==null?void 0:cs.openIdConnect)==null?void 0:ps.token)||"",specSecurityType:["apiKey","http","oauth2"].includes((ds=r.config.openapi.specSecurity)==null?void 0:ds.type)?r.config.openapi.specSecurity.type:"none",specApiKeyName:((ms=(us=r.config.openapi.specSecurity)==null?void 0:us.apiKey)==null?void 0:ms.name)||"",specApiKeyIn:((xs=(hs=r.config.openapi.specSecurity)==null?void 0:hs.apiKey)==null?void 0:xs.in)||"header",specApiKeyValue:((gs=(ys=r.config.openapi.specSecurity)==null?void 0:ys.apiKey)==null?void 0:gs.value)||"",specHttpScheme:((vs=(bs=r.config.openapi.specSecurity)==null?void 0:bs.http)==null?void 0:vs.scheme)==="bearer"?"bearer":"basic",specHttpCredentials:((js=(fs=r.config.openapi.specSecurity)==null?void 0:fs.http)==null?void 0:js.credentials)||"",specOauth2Token:((Ns=(ks=r.config.openapi.specSecurity)==null?void 0:ks.oauth2)==null?void 0:Ns.token)||"",passthroughHeaders:r.config.openapi.passthroughHeaders?r.config.openapi.passthroughHeaders.join(", "):"",cookieSession:r.config.openapi.cookieSession===!0}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",specSecurityType:"none",passthroughHeaders:"",cookieSession:!1}}),[b,K]=x.useState([]),[T,w]=x.useState(!1),[A,N]=x.useState(!1),[F,M]=x.useState("");x.useEffect(()=>{if(i.visibility!=="group"||!(r!=null&&r.name))return;let n=!1;return w(!0),N(!1),Rr(`/servers/${encodeURIComponent(r.name)}/share-candidates`).then(s=>{n||(s.success&&Array.isArray(s.data)?K(s.data):N(!0))}).catch(()=>{n||N(!0)}).finally(()=>{n||w(!1)}),()=>{n=!0}},[i.visibility,r==null?void 0:r.name]);const O=Gr(i.sharedWithUsers||[],b),v=Qr(O,F),U=new Set(i.sharedWithUsers||[]),R=v.length>0&&v.every(n=>U.has(n)),z=v.length===0||v.every(n=>!U.has(n)),L=n=>{c(s=>{const o=new Set(s.sharedWithUsers||[]);return o.has(n)?o.delete(n):o.add(n),{...s,sharedWithUsers:Array.from(o)}})},W=()=>{c(n=>({...n,sharedWithUsers:Zr(n.sharedWithUsers||[],v)}))},$=()=>{c(n=>({...n,sharedWithUsers:Yr(n.sharedWithUsers||[],v)}))},[S,Y]=x.useState(r&&r.config&&r.config.env?Object.entries(r.config.env).map(([n,s])=>({key:n,value:s})):[]),[C,D]=x.useState(r&&r.config&&r.config.headers?Object.entries(r.config.headers).map(([n,s])=>({key:n,value:s})):[]),[P,he]=x.useState(null),[ee,V]=x.useState(!1),[Ar,se]=x.useState(!1),re=x.useRef(0),xe=x.useRef(null),ye=x.useRef(!1),te=x.useRef(!!r),q=x.useRef(i);q.current=i;const ge=x.useRef(S);ge.current=S;const be=x.useRef(C);be.current=C;const[B,_]=x.useState(null),[ve,fe]=x.useState(!1),[ne,Ir]=x.useState(!1),[ae,Kr]=x.useState(!1),[oe,Or]=x.useState(!1),[le,Ur]=x.useState(!1),[je,ie]=x.useState(null),E=!!r,Er=()=>{te.current=!0,_(null)},X=n=>{const{name:s,value:o}=n.target;c({...i,[s]:o})},Hr=n=>{const s=n.split(" ").filter(o=>o.trim()!=="");c({...i,arguments:n,args:s})},J=n=>{k(n),c(s=>({...s,type:n}))},G=(n,s,o)=>{const g=[...S];g[n][s]=o,Y(g)},ke=()=>{Y([...S,{key:"",value:""}])},Ne=n=>{const s=[...S];s.splice(n,1),Y(s)},Q=(n,s,o)=>{const g=[...C];g[n][s]=o,D(g)},Se=()=>{D([...C,{key:"",value:""}])},Ce=n=>{const s=[...C];s.splice(n,1),D(s)},Te=(n,s)=>{c(o=>({...o,oauth:{...o.oauth||{},[n]:s}}))},ce=(n,s)=>{c(o=>({...o,options:{...o.options,[n]:s}}))},Fr=async n=>{try{const s=await zr("/servers/openapi/tool-stats",{config:n.config},{signal:AbortSignal.timeout(6e4)});return s.success&&s.data?s.data:null}catch{return null}},we=async(n,s,o)=>{const g=++re.current;V(!0),se(!1);const f=await Fr(n);if(re.current!==g)return;if(!f){se(!0),V(!1);return}xe.current=s,he(f);const I=q.current,pe=te.current,H=f.declaredSecurity,Mr=o.allowSecurityPrefill&&!pe&&!E&&!ye.current;o.consumeAutomaticAnalysis&&(ye.current=!0);const de=H!=null&&H.declared&&H.supported&&Mr?Dr(I,H,pe):I;de!==I&&(q.current=de,c(de)),_(rt(I,H,{includeNotDeclared:!0,securityTouched:pe})),V(!1)},Pr=async()=>{fe(!0);try{const n=ue({formData:i,serverType:p,envVars:S,headerVars:C});await we(n,kr(i).key,{allowSecurityPrefill:!E&&!te.current,consumeAutomaticAnalysis:!1})}catch{}finally{fe(!1)}},Z=kr(i),Ae=p==="openapi"&&Tr(Z);x.useEffect(()=>{if(re.current+=1,he(null),se(!1),V(!1),_(null),!tt({isEdit:E,serverType:p,source:Z,analyzedSourceKey:xe.current}))return;V(!0);const n=window.setTimeout(()=>{const s=ue({formData:q.current,serverType:p,envVars:ge.current,headerVars:be.current});we(s,Z.key,{allowSecurityPrefill:!0,consumeAutomaticAnalysis:!0})},600);return()=>{window.clearTimeout(n)}},[E,Z.key,p]);const Vr=async n=>{if(n.preventDefault(),ie(null),(!(r!=null&&r.name)||i.name!==r.name)&&!Nr(i.name)){ie(t("server.nameInvalid"));return}try{const o=ue({formData:i,serverType:p,envVars:S,headerVars:C});a(o)}catch(o){ie(`Error: ${o instanceof Error?o.message:String(o)}`)}};return e.jsxs("div",{className:"hub-card p-6 w-full max-w-3xl max-h-screen overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--hub-ink)]",children:d}),e.jsx("button",{onClick:l,className:"hub-icon-btn","aria-label":"Close",children:e.jsx(fr,{size:16})})]}),(je||m)&&e.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:m||je}),e.jsxs("form",{onSubmit:Vr,children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--hub-ink)] mb-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:t("server.sectionBasicInfo","Basic Info")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"name",children:t("server.name")}),e.jsx("input",{type:"text",name:"name",id:"name",value:i.name,onChange:X,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: time-mcp",pattern:h?wr.source:void 0,maxLength:h?me:void 0,title:t("server.nameInvalid"),required:!0}),e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.nameInvalid")})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"description",children:t("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:i.description||"",onChange:X,className:"w-full py-2 px-3 form-input",placeholder:t("server.descriptionPlaceholder")})]})]})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--hub-ink)] mb-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:t("server.sectionConnection","Connection")}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.type")}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-2",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",checked:p==="stdio",onChange:()=>J("stdio"),className:"mr-1"}),e.jsx("label",{htmlFor:"command",className:"text-[var(--hub-ink)]",children:t("server.typeStdio")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:p==="sse",onChange:()=>J("sse"),className:"mr-1"}),e.jsx("label",{htmlFor:"url",className:"text-[var(--hub-ink)]",children:t("server.typeSse")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:p==="streamable-http",onChange:()=>J("streamable-http"),className:"mr-1"}),e.jsx("label",{htmlFor:"streamable-http",className:"text-[var(--hub-ink)]",children:t("server.typeStreamableHttp")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:p==="openapi",onChange:()=>J("openapi"),className:"mr-1"}),e.jsx("label",{htmlFor:"openapi",className:"text-[var(--hub-ink)]",children:t("server.typeOpenapi")})]})]})]}),e.jsx("div",{className:"pl-4 border-l-2 border-gray-200 dark:border-gray-700 ml-2",children:p==="openapi"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.inputMode")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((Ss=i.openapi)==null?void 0:Ss.inputMode)==="url",onChange:()=>c(n=>({...n,openapi:{...n.openapi,inputMode:"url"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-url",children:t("server.openapi.inputModeUrl")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((Cs=i.openapi)==null?void 0:Cs.inputMode)==="schema",onChange:()=>c(n=>({...n,openapi:{...n.openapi,inputMode:"schema"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-schema",children:t("server.openapi.inputModeSchema")})]})]})]}),((Ts=i.openapi)==null?void 0:Ts.inputMode)==="url"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-url",children:t("server.openapi.specUrl")}),e.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((ws=i.openapi)==null?void 0:ws.url)||"",onChange:n=>c(s=>({...s,openapi:{...s.openapi,url:n.target.value}})),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:p==="openapi"&&((As=i.openapi)==null?void 0:As.inputMode)==="url"})]}),((Is=i.openapi)==null?void 0:Is.inputMode)==="schema"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-schema",children:t("server.openapi.schema")}),e.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((Ks=i.openapi)==null?void 0:Ks.schema)||"",onChange:n=>c(s=>({...s,openapi:{...s.openapi,schema:n.target.value}})),className:"w-full py-2 px-3 form-input font-mono text-sm",placeholder:`{
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "API",
|
|
5
|
+
"version": "1.0.0"
|
|
6
|
+
},
|
|
7
|
+
"servers": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://api.example.com"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"paths": {
|
|
13
|
+
...
|
|
14
|
+
}
|
|
15
|
+
}`,required:p==="openapi"&&((Os=i.openapi)==null?void 0:Os.inputMode)==="schema"}),e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.openapi.schemaHelp")})]}),!E&&Ae&&e.jsx("div",{className:"mb-4 rounded border border-blue-200 bg-blue-50 p-3 text-sm dark:border-blue-900 dark:bg-blue-950/30","aria-live":"polite",children:ee?e.jsx("p",{className:"text-blue-700 dark:text-blue-300",children:t("server.openapi.statsMeasuring")}):P?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100",children:t("server.openapi.statsSummary",{toolCount:P.toolCount,bytes:Wr(P.definitionsBytes),tokens:Lr(P.estimatedTokens)})}),P.estimatedTokens>=$r&&e.jsx("p",{className:"mt-1 text-yellow-700 dark:text-yellow-300",children:t("server.openapi.statsWarning")})]}):Ar?e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:t("server.openapi.statsUnavailable")}):null}),e.jsxs("div",{className:"mb-4",onChange:Er,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--hub-ink-2)]",children:t("server.openapi.security")}),e.jsx("button",{type:"button",onClick:()=>void Pr(),disabled:ve||ee||!Ae,className:"hub-btn text-xs !h-7 !px-2",children:t(ve||ee?"server.openapi.securityDetecting":"server.openapi.securityDetect")})]}),e.jsxs("select",{value:((Us=i.openapi)==null?void 0:Us.securityType)||"none",onChange:n=>c(s=>{var o;return _(null),{...s,openapi:{...s.openapi,securityType:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"none",children:t("server.openapi.securityNone")}),e.jsx("option",{value:"apiKey",children:t("server.openapi.securityApiKey")}),e.jsx("option",{value:"http",children:t("server.openapi.securityHttp")}),e.jsx("option",{value:"oauth2",children:t("server.openapi.securityOAuth2")}),e.jsx("option",{value:"openIdConnect",children:t("server.openapi.securityOpenIdConnect")})]}),B&&e.jsx("p",{className:`mt-2 text-xs ${B.kind==="warning"?"text-yellow-700 dark:text-yellow-300":"text-blue-700 dark:text-blue-300"}`,children:t(`server.openapi.${B.messageKey}`,B.values)})]}),((Es=i.openapi)==null?void 0:Es.securityType)==="apiKey"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-[var(--hub-ink-2)]",children:t("server.openapi.apiKeyConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((Hs=i.openapi)==null?void 0:Hs.apiKeyName)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,apiKeyName:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm form-input focus:outline-none",placeholder:"Authorization"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((Fs=i.openapi)==null?void 0:Fs.apiKeyIn)||"header",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,apiKeyIn:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"header",children:t("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:t("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:t("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((Ps=i.openapi)==null?void 0:Ps.apiKeyValue)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,apiKeyValue:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"your-api-key"})]})]})]}),((Vs=i.openapi)==null?void 0:Vs.securityType)==="http"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.httpAuthConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpScheme")}),e.jsxs("select",{value:((Ms=i.openapi)==null?void 0:Ms.httpScheme)||"bearer",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,httpScheme:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"basic",children:t("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:t("server.openapi.httpSchemeBearer")}),e.jsx("option",{value:"digest",children:t("server.openapi.httpSchemeDigest")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:((Rs=i.openapi)==null?void 0:Rs.httpCredentials)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,httpCredentials:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((zs=i.openapi)==null?void 0:zs.httpScheme)==="basic"?"user:password or base64":"bearer-token"}),((Ls=i.openapi)==null?void 0:Ls.httpScheme)==="basic"&&e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.openapi.httpCredentialsBasicHint")})]})]})]}),((Ws=i.openapi)==null?void 0:Ws.securityType)==="openIdConnect"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.openIdConnectConfig")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectUrl")}),e.jsx("input",{type:"url",value:(($s=i.openapi)==null?void 0:$s.openIdConnectUrl)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,openIdConnectUrl:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/.well-known/openid_configuration"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectToken")}),e.jsx("input",{type:"password",value:((qs=i.openapi)==null?void 0:qs.openIdConnectToken)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,openIdConnectToken:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"id-token"})]})]})]}),((Bs=i.openapi)==null?void 0:Bs.securityType)==="oauth2"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.oauth2Config")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.tokenEndpoint")}),e.jsx("input",{type:"url",value:((_s=i.openapi)==null?void 0:_s.oauth2TokenUrl)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2TokenUrl:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/oauth/token"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Xs=i.openapi)==null?void 0:Xs.oauth2ClientId)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2ClientId:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-id"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((Js=i.openapi)==null?void 0:Js.oauth2ClientSecret)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2ClientSecret:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-secret"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((Gs=i.openapi)==null?void 0:Gs.oauth2Token)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2Token:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"access-token"})]})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"openapiSpecSecurity",checked:(((Qs=i.openapi)==null?void 0:Qs.specSecurityType)||"none")!=="none",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specSecurityType:n.target.checked?"http":"none"}}}),className:"mr-2"}),e.jsx("label",{htmlFor:"openapiSpecSecurity",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.openapi.specSecurityToggle")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.openapi.specSecurityHelp")}),(((Zs=i.openapi)==null?void 0:Zs.specSecurityType)||"none")!=="none"&&e.jsxs("div",{className:"mt-2 ml-6 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.security")}),e.jsxs("select",{value:((Ys=i.openapi)==null?void 0:Ys.specSecurityType)||"http",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specSecurityType:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"http",children:t("server.openapi.securityHttp")}),e.jsx("option",{value:"apiKey",children:t("server.openapi.securityApiKey")}),e.jsx("option",{value:"oauth2",children:t("server.openapi.securityOAuth2")})]})]}),((Ds=i.openapi)==null?void 0:Ds.specSecurityType)==="http"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpScheme")}),e.jsxs("select",{value:((er=i.openapi)==null?void 0:er.specHttpScheme)||"basic",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specHttpScheme:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"basic",children:t("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:t("server.openapi.httpSchemeBearer")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:((sr=i.openapi)==null?void 0:sr.specHttpCredentials)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specHttpCredentials:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((rr=i.openapi)==null?void 0:rr.specHttpScheme)==="basic"?"user:password or base64":"bearer-token"})]})]}),((tr=i.openapi)==null?void 0:tr.specSecurityType)==="apiKey"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((nr=i.openapi)==null?void 0:nr.specApiKeyName)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specApiKeyName:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"X-API-Key"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((ar=i.openapi)==null?void 0:ar.specApiKeyIn)||"header",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specApiKeyIn:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"header",children:t("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:t("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:t("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((or=i.openapi)==null?void 0:or.specApiKeyValue)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specApiKeyValue:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input"})]})]}),((lr=i.openapi)==null?void 0:lr.specSecurityType)==="oauth2"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((ir=i.openapi)==null?void 0:ir.specOauth2Token)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specOauth2Token:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"access-token"})]})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"openapiCookieSession",checked:((cr=i.openapi)==null?void 0:cr.cookieSession)||!1,onChange:n=>c(s=>{var o,g;return{...s,openapi:{...s.openapi,passthroughHeaders:((o=s.openapi)==null?void 0:o.passthroughHeaders)||"",url:((g=s.openapi)==null?void 0:g.url)||"",cookieSession:n.target.checked}}}),className:"mr-2"}),e.jsx("label",{htmlFor:"openapiCookieSession",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.openapi.cookieSession","Cookie Session Handling")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.openapi.cookieSessionHelp","Capture Set-Cookie from upstream login responses and replay them on later calls within the same downstream session. Isolated per MCP session; not persisted.")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:Se,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),C.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:o=>Q(s,"key",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Authorization"}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:o=>Q(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>Ce(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]}):p==="sse"||p==="streamable-http"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"url",children:t("server.url")}),e.jsx("input",{type:"url",name:"url",id:"url",value:i.url,onChange:X,className:"w-full py-2 px-3 form-input",placeholder:p==="streamable-http"?"e.g.: http://localhost:3000/mcp":"e.g.: http://localhost:3000/sse",required:p==="sse"||p==="streamable-http"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:Se,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),C.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:o=>Q(s,"key",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Authorization"}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:o=>Q(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>Ce(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:ke,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),S.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:o=>G(s,"key",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:o=>G(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>Ne(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"command",children:t("server.command")}),e.jsx("input",{type:"text",name:"command",id:"command",value:i.command,onChange:X,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: npx",required:p==="stdio"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"arguments",children:t("server.arguments")}),e.jsx("input",{type:"text",name:"arguments",id:"arguments",value:i.arguments,onChange:n=>Hr(n.target.value),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: -y time-mcp"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:ke,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),S.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:o=>G(s,"key",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:o=>G(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>Ne(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Ur(!le),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--hub-ink)]",children:t("server.sectionAdvanced","Advanced Options")}),e.jsx("span",{className:"text-gray-500 text-sm",children:le?"▼":"▶"})]}),le&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-white dark:bg-gray-900 border-t-0 space-y-4",children:[e.jsxs("fieldset",{className:"space-y-3 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("legend",{className:"px-1 font-medium",children:t("credentials.slots")}),e.jsx("p",{className:"text-sm text-gray-500",children:t("credentials.slotsHint")}),(i.credentialTemplate||[]).map((n,s)=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:t(p==="stdio"?"server.envVars":"server.headers")}),e.jsx("input",{required:!0,maxLength:128,"aria-label":t("credentials.fieldName"),placeholder:t("credentials.fieldName"),value:n.name,className:"min-w-0 flex-1 py-2 px-3 form-input",onChange:o=>{var g;return c({...i,credentialTemplate:(g=i.credentialTemplate)==null?void 0:g.map((f,I)=>I===s?{...f,name:o.target.value}:f)})}}),e.jsx("input",{maxLength:200,"aria-label":t("credentials.label"),placeholder:t("credentials.label"),value:n.label||"",className:"min-w-0 flex-1 py-2 px-3 form-input",onChange:o=>{var g;return c({...i,credentialTemplate:(g=i.credentialTemplate)==null?void 0:g.map((f,I)=>I===s?{...f,label:o.target.value}:f)})}}),e.jsx("button",{type:"button","aria-label":t("credentials.removeSlot"),onClick:()=>{var o;return c({...i,credentialTemplate:(o=i.credentialTemplate)==null?void 0:o.filter((g,f)=>f!==s)})},children:e.jsx(fr,{size:18})})]},s)),e.jsx("button",{type:"button",className:"text-sm text-blue-600",disabled:(((pr=i.credentialTemplate)==null?void 0:pr.length)||0)>=32,onClick:()=>c({...i,credentialTemplate:[...i.credentialTemplate||[],{target:p==="stdio"?"env":"headers",name:""}]}),children:t("credentials.addSlot")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"visibility",children:t("server.visibility","Visibility")}),e.jsxs("select",{id:"visibility",name:"visibility",value:i.visibility||"private",onChange:n=>c(s=>({...s,visibility:n.target.value})),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"private",children:t("server.visibilityPrivate","Private — only the owner and admins")}),e.jsx("option",{value:"group",children:t("server.visibilityGroup","Shared — selected users only")}),e.jsx("option",{value:"public",children:t("server.visibilityPublic","Public — every authenticated user")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.visibilityDescription","Controls which non-admin users can discover and call this server. Admins always have access.")}),i.visibility==="group"&&e.jsxs("div",{className:"mt-4 rounded border border-gray-200 dark:border-gray-700 p-3",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--hub-ink-2)]",children:t("server.shareWithUsers","Share with users")}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 mb-3",children:t("server.shareWithUsersDescription","Selected users can discover and call this server, but cannot manage its configuration.")}),r!=null&&r.name?e.jsxs(e.Fragment,{children:[T&&e.jsx("p",{className:"text-sm text-gray-500",children:t("server.shareCandidatesLoading","Loading users...")}),A&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:t("server.shareCandidatesError","Failed to load users.")}),!T&&!A&&O.length===0&&e.jsx("p",{className:"text-sm text-gray-500",children:t("server.noShareCandidates","No other users are available.")}),O.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 space-y-2",children:[e.jsx("label",{htmlFor:"share-user-search",className:"block text-xs font-medium text-[var(--hub-ink-2)]",children:t("server.shareUserSearchLabel","Search users")}),e.jsx("input",{id:"share-user-search",type:"search",value:F,onChange:n=>M(n.target.value),placeholder:t("server.shareUserSearchPlaceholder","Search usernames..."),className:"w-full py-2 px-3 form-input text-sm"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:W,disabled:R,className:"hub-btn text-sm",children:t("server.selectAllShareUsers","Select all")}),e.jsx("button",{type:"button",onClick:$,disabled:z,className:"hub-btn text-sm",children:t("server.deselectAllShareUsers","Deselect all")})]})]}),v.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:t("server.noMatchingShareUsers","No users match your search.")}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:v.map(n=>e.jsxs("label",{className:"flex items-center gap-2 rounded border border-gray-200 dark:border-gray-700 px-3 py-2 text-sm text-[var(--hub-ink-2)]",children:[e.jsx("input",{type:"checkbox",checked:U.has(n),onChange:()=>L(n)}),e.jsx("span",{children:n})]},n))})]})]}):e.jsx("p",{className:"text-sm text-gray-500",children:t("server.shareAfterCreate","Save the server before selecting users.")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.passthroughHeaders")}),p==="openapi"?e.jsx(e.Fragment,{children:e.jsx("input",{type:"text",value:((dr=i.openapi)==null?void 0:dr.passthroughHeaders)||"",onChange:n=>c(s=>{var o;return{...s,openapi:{...s.openapi,passthroughHeaders:n.target.value,url:((o=s.openapi)==null?void 0:o.url)||""}}}),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-API-Key, X-Custom-Header"})}):e.jsx("input",{type:"text",value:i.passthroughHeaders||"",onChange:n=>c(s=>({...s,passthroughHeaders:n.target.value})),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-Custom-User-Id"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.openapi.passthroughHeadersHelp")})]}),p!=="openapi"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Kr(!ae),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.oauth.sectionTitle")}),e.jsx("span",{className:"text-gray-500 text-sm",children:ae?"▼":"▶"})]}),ae&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.oauth.sectionDescription")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((ur=i.oauth)==null?void 0:ur.clientId)||"",onChange:n=>Te("clientId",n.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client id",autoComplete:"off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((mr=i.oauth)==null?void 0:mr.clientSecret)||"",onChange:n=>Te("clientSecret",n.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client secret",autoComplete:"off"})]})]})]})]}),p!=="openapi"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Ir(!ne),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.requestOptions")}),e.jsx("span",{className:"text-gray-500 text-sm",children:ne?"▼":"▶"})]}),ne&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"timeout",children:t("server.timeout")}),e.jsx("input",{type:"number",id:"timeout",value:((hr=i.options)==null?void 0:hr.timeout)||6e4,onChange:n=>ce("timeout",parseInt(n.target.value)||6e4),className:"w-full py-2 px-3 form-input",placeholder:"30000",min:"1000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.timeoutDescription")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxTotalTimeout",children:t("server.maxTotalTimeout")}),e.jsx("input",{type:"number",id:"maxTotalTimeout",value:((xr=i.options)==null?void 0:xr.maxTotalTimeout)||"",onChange:n=>ce("maxTotalTimeout",n.target.value?parseInt(n.target.value):void 0),className:"w-full py-2 px-3 form-input",placeholder:"Optional",min:"1000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.maxTotalTimeoutDescription")})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"checkbox",checked:((yr=i.options)==null?void 0:yr.resetTimeoutOnProgress)??!0,onChange:n=>ce("resetTimeoutOnProgress",n.target.checked),className:"mr-2"}),e.jsx("span",{className:"text-gray-600 text-sm",children:t("server.resetTimeoutOnProgress")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 ml-6",children:t("server.resetTimeoutOnProgressDescription")})]})]})]}),(p==="sse"||p==="streamable-http")&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Or(!oe),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.keepAlive","Connection Health")}),e.jsx("span",{className:"text-gray-500 text-sm",children:oe?"▼":"▶"})]}),oe&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsxs("div",{className:"flex items-center mb-3",children:[e.jsx("input",{type:"checkbox",id:"enableKeepAlive",checked:((gr=i.keepAlive)==null?void 0:gr.enabled)||!1,onChange:n=>c(s=>({...s,keepAlive:{...s.keepAlive,enabled:n.target.checked}})),className:"mr-2"}),e.jsx("label",{htmlFor:"enableKeepAlive",className:"text-gray-600 text-sm",children:t("server.enableKeepAlive","Enable Health Checks and Auto Reconnect")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.keepAliveDescription","Run periodic health checks and automatically reconnect this remote server when it becomes disconnected.")}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"keepAliveInterval",children:t("server.keepAliveInterval","Check interval (ms)")}),e.jsx("input",{type:"number",id:"keepAliveInterval",value:((br=i.keepAlive)==null?void 0:br.interval)||6e4,onChange:n=>c(s=>({...s,keepAlive:{...s.keepAlive,interval:parseInt(n.target.value)||6e4}})),className:"w-full py-2 px-3 form-input",placeholder:"60000",min:"5000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.keepAliveIntervalDescription","Time between health checks and automatic reconnect attempts in milliseconds (default: 60000ms = 1 minute)")})]})]})]}),p!=="openapi"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"perSessionClient",checked:i.perSessionClient||!1,onChange:n=>c(s=>({...s,perSessionClient:n.target.checked})),className:"mr-2"}),e.jsx("label",{htmlFor:"perSessionClient",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.perSessionClient","Per-Session Client Isolation")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.perSessionClientDescription","Create a dedicated upstream connection per session instead of sharing one across all sessions. Enable for stateful servers like Playwright. Increases upstream connections with concurrent sessions.")})]}),p==="stdio"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"startOnDemand",checked:i.startOnDemand||!1,onChange:n=>c(s=>({...s,startOnDemand:n.target.checked})),className:"mr-2"}),e.jsx("label",{htmlFor:"startOnDemand",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.startOnDemand","Start On Demand")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.startOnDemandDescription","Skip startup connect and spawn this server only when a tool call arrives. The process is shut down automatically after the idle timeout, then restarted on the next call. Reduces persistent memory usage for rarely-used servers.")}),(i.startOnDemand||!!((vr=i.credentialTemplate)!=null&&vr.length))&&e.jsxs("div",{className:"ml-6 mt-2",children:[e.jsx("label",{htmlFor:"idleTimeoutMs",className:"block text-xs text-gray-600 dark:text-gray-400 mb-1",children:t("server.idleTimeoutMs","Idle shutdown timeout (ms)")}),e.jsx("input",{type:"number",id:"idleTimeoutMs",min:1e4,step:1e3,value:i.idleTimeoutMs??3e5,onChange:n=>c(s=>({...s,idleTimeoutMs:Number(n.target.value)})),className:"hub-input w-40 text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.idleTimeoutMsDescription","Shut down the process after this many milliseconds with no tool calls. Default: 300000 (5 minutes).")})]})]})]})]}),e.jsxs("div",{className:"flex justify-end mt-6",children:[e.jsx("button",{type:"button",onClick:l,className:"hub-btn mr-2",children:t("server.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",children:t(E?"server.save":"server.add")})]})]})]})},dt=a=>{const l=new Set,r=/\$\{([^}]+)\}/g,d=t=>{let h;for(;(h=r.exec(t))!==null;)l.add(h[1])},m=(t,h="")=>{typeof t=="string"?d(t):Array.isArray(t)?t.forEach((y,u)=>m(y,`${h}[${u}]`)):t&&typeof t=="object"&&Object.entries(t).forEach(([y,u])=>{m(u,h?`${h}.${y}`:y)})};return m(a),Array.from(l)};export{pt as S,dt as d,ct as s};
|
|
16
|
+
//# sourceMappingURL=variableDetection-cmwwuSWB.js.map
|