@samanhappy/mcphub 1.1.14 → 1.1.15
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 +1 -1
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/dist/betterAuth.js +3 -3
- package/dist/betterAuth.js.map +1 -1
- package/dist/cli/commands/keys.js +22 -3
- package/dist/cli/commands/keys.js.map +1 -1
- package/dist/clients/mcpSdkClient.js +2667 -1448
- package/dist/clients/mcpSdkClient.js.map +4 -4
- package/dist/controllers/bearerKeyController.js +49 -3
- package/dist/controllers/bearerKeyController.js.map +1 -1
- package/dist/controllers/credentialBindingController.js +1 -1
- package/dist/controllers/credentialBindingController.js.map +1 -1
- package/dist/controllers/groupController.js +12 -5
- package/dist/controllers/groupController.js.map +1 -1
- package/dist/controllers/oauthRelayController.js +65 -0
- package/dist/controllers/oauthRelayController.js.map +1 -0
- package/dist/controllers/personalOAuthController.js +10 -1
- package/dist/controllers/personalOAuthController.js.map +1 -1
- package/dist/controllers/serverController.js +23 -14
- package/dist/controllers/serverController.js.map +1 -1
- package/dist/controllers/userController.js +11 -1
- package/dist/controllers/userController.js.map +1 -1
- package/dist/dao/BearerKeyDao.js +10 -5
- package/dist/dao/BearerKeyDao.js.map +1 -1
- package/dist/dao/BearerKeyDaoDbImpl.js +16 -5
- package/dist/dao/BearerKeyDaoDbImpl.js.map +1 -1
- package/dist/dao/GroupDaoDbImpl.js +11 -0
- package/dist/dao/GroupDaoDbImpl.js.map +1 -1
- package/dist/dao/ServerDao.js +5 -1
- package/dist/dao/ServerDao.js.map +1 -1
- package/dist/dao/ServerDaoDbImpl.js +3 -0
- package/dist/dao/ServerDaoDbImpl.js.map +1 -1
- package/dist/dao/UserDaoDbImpl.js +4 -0
- package/dist/dao/UserDaoDbImpl.js.map +1 -1
- package/dist/db/entities/BearerKey.js +8 -0
- package/dist/db/entities/BearerKey.js.map +1 -1
- package/dist/db/entities/Group.js +4 -0
- 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/User.js +4 -0
- package/dist/db/entities/User.js.map +1 -1
- package/dist/db/repositories/ServerRepository.js +1 -0
- package/dist/db/repositories/ServerRepository.js.map +1 -1
- package/dist/middlewares/auth.js +7 -1
- package/dist/middlewares/auth.js.map +1 -1
- package/dist/routes/index.js +2 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/services/authorizationService.js.map +1 -1
- package/dist/services/capabilitySnapshotService.js +2 -1
- package/dist/services/capabilitySnapshotService.js.map +1 -1
- package/dist/services/credentialBindingService.js +9 -1
- package/dist/services/credentialBindingService.js.map +1 -1
- package/dist/services/dataService.js +4 -2
- package/dist/services/dataService.js.map +1 -1
- package/dist/services/groupService.js +15 -7
- package/dist/services/groupService.js.map +1 -1
- package/dist/services/mcpEventBus.js +6 -0
- package/dist/services/mcpEventBus.js.map +1 -0
- package/dist/services/mcpService.js +26 -2
- package/dist/services/mcpService.js.map +1 -1
- package/dist/services/personalOAuthService.js +2 -0
- package/dist/services/personalOAuthService.js.map +1 -1
- package/dist/services/requestContextService.js +15 -0
- package/dist/services/requestContextService.js.map +1 -1
- package/dist/services/serverConfigEnvironment.js +2 -1
- package/dist/services/serverConfigEnvironment.js.map +1 -1
- package/dist/services/sseService.js +58 -6
- package/dist/services/sseService.js.map +1 -1
- package/dist/services/templateService.js +11 -5
- package/dist/services/templateService.js.map +1 -1
- package/dist/services/userService.js +5 -1
- package/dist/services/userService.js.map +1 -1
- package/dist/utils/groupAccess.js +6 -4
- package/dist/utils/groupAccess.js.map +1 -1
- package/dist/utils/groupKeyScope.js +11 -5
- package/dist/utils/groupKeyScope.js.map +1 -1
- package/dist/utils/migration.js +5 -0
- package/dist/utils/migration.js.map +1 -1
- package/dist/utils/oauthBearer.js +1 -0
- package/dist/utils/oauthBearer.js.map +1 -1
- package/dist/utils/oauthServerMetadata.js +21 -0
- package/dist/utils/oauthServerMetadata.js.map +1 -1
- package/dist/utils/serverConfigPersistence.js +16 -1
- package/dist/utils/serverConfigPersistence.js.map +1 -1
- package/dist/utils/serverConfigValidation.js +1 -0
- package/dist/utils/serverConfigValidation.js.map +1 -1
- package/dist/utils/settingsSync.js +3 -0
- package/dist/utils/settingsSync.js.map +1 -1
- package/frontend/dist/assets/{ActivityPage-C8Zj4FeE.js → ActivityPage-Bi-TjKez.js} +2 -2
- package/frontend/dist/assets/{ActivityPage-C8Zj4FeE.js.map → ActivityPage-Bi-TjKez.js.map} +1 -1
- package/frontend/dist/assets/{ConfirmDialog-BYdfb115.js → ConfirmDialog-BJpzQmMw.js} +2 -2
- package/frontend/dist/assets/{ConfirmDialog-BYdfb115.js.map → ConfirmDialog-BJpzQmMw.js.map} +1 -1
- package/frontend/dist/assets/CredentialsPage-C4Ucer3d.js +2 -0
- package/frontend/dist/assets/CredentialsPage-C4Ucer3d.js.map +1 -0
- package/frontend/dist/assets/{Dashboard-CCiZcGi4.js → Dashboard-C_2KkuoD.js} +2 -2
- package/frontend/dist/assets/{Dashboard-CCiZcGi4.js.map → Dashboard-C_2KkuoD.js.map} +1 -1
- package/frontend/dist/assets/{DeleteDialog-BaCsEkJA.js → DeleteDialog-BoMYLx3J.js} +2 -2
- package/frontend/dist/assets/{DeleteDialog-BaCsEkJA.js.map → DeleteDialog-BoMYLx3J.js.map} +1 -1
- package/frontend/dist/assets/{EndpointCopy-CmKx4RVL.js → EndpointCopy-DITVC2YQ.js} +2 -2
- package/frontend/dist/assets/{EndpointCopy-CmKx4RVL.js.map → EndpointCopy-DITVC2YQ.js.map} +1 -1
- package/frontend/dist/assets/GroupsPage-sE6YJyuK.js +33 -0
- package/frontend/dist/assets/GroupsPage-sE6YJyuK.js.map +1 -0
- package/frontend/dist/assets/{LoginPage-Hn1uu0vB.js → LoginPage-CFsd_nY-.js} +2 -2
- package/frontend/dist/assets/{LoginPage-Hn1uu0vB.js.map → LoginPage-CFsd_nY-.js.map} +1 -1
- package/frontend/dist/assets/{LogsPage-JMCtTjCv.js → LogsPage-BxZuGDuc.js} +2 -2
- package/frontend/dist/assets/{LogsPage-JMCtTjCv.js.map → LogsPage-BxZuGDuc.js.map} +1 -1
- package/frontend/dist/assets/MarketPage-CDBs4vMb.js +2 -0
- package/frontend/dist/assets/{MarketPage-Bvi1KESo.js.map → MarketPage-CDBs4vMb.js.map} +1 -1
- package/frontend/dist/assets/{OAuthConsentPage-DofQEZAU.js → OAuthConsentPage-BN_ucViM.js} +2 -2
- package/frontend/dist/assets/{OAuthConsentPage-DofQEZAU.js.map → OAuthConsentPage-BN_ucViM.js.map} +1 -1
- package/frontend/dist/assets/{Pagination-D99WHhBx.js → Pagination-S-7lzy59.js} +2 -2
- package/frontend/dist/assets/{Pagination-D99WHhBx.js.map → Pagination-S-7lzy59.js.map} +1 -1
- package/frontend/dist/assets/{PromptsPage-B-8vczAR.js → PromptsPage-Bl3ySXGK.js} +2 -2
- package/frontend/dist/assets/{PromptsPage-B-8vczAR.js.map → PromptsPage-Bl3ySXGK.js.map} +1 -1
- package/frontend/dist/assets/{ResourcesPage-DLAIatoG.js → ResourcesPage-BOzQkQ92.js} +2 -2
- package/frontend/dist/assets/{ResourcesPage-DLAIatoG.js.map → ResourcesPage-BOzQkQ92.js.map} +1 -1
- package/frontend/dist/assets/{ServersPage-wVLsTL_f.js → ServersPage-DHYwQ5AM.js} +5 -5
- package/frontend/dist/assets/{ServersPage-wVLsTL_f.js.map → ServersPage-DHYwQ5AM.js.map} +1 -1
- package/frontend/dist/assets/SettingsPage-CSJ35jlM.js +14 -0
- package/frontend/dist/assets/SettingsPage-CSJ35jlM.js.map +1 -0
- package/frontend/dist/assets/{StatusDot-00-sTQKv.js → StatusDot-NSjojGCy.js} +2 -2
- package/frontend/dist/assets/{StatusDot-00-sTQKv.js.map → StatusDot-NSjojGCy.js.map} +1 -1
- package/frontend/dist/assets/{ToggleGroup-CtWBng3r.js → ToggleGroup-BIZWpNzm.js} +2 -2
- package/frontend/dist/assets/{ToggleGroup-CtWBng3r.js.map → ToggleGroup-BIZWpNzm.js.map} +1 -1
- package/frontend/dist/assets/UserGroupSelection-CN0weGXJ.js +2 -0
- package/frontend/dist/assets/UserGroupSelection-CN0weGXJ.js.map +1 -0
- package/frontend/dist/assets/UsersPage-DC51v2b8.js +2 -0
- package/frontend/dist/assets/UsersPage-DC51v2b8.js.map +1 -0
- package/frontend/dist/assets/{clipboard-2RRFM-q8.js → clipboard-ik5YV95M.js} +2 -2
- package/frontend/dist/assets/{clipboard-2RRFM-q8.js.map → clipboard-ik5YV95M.js.map} +1 -1
- package/frontend/dist/assets/{costRevision-Ntl7VtWo.js → costRevision-Bxov9_vH.js} +2 -2
- package/frontend/dist/assets/{costRevision-Ntl7VtWo.js.map → costRevision-Bxov9_vH.js.map} +1 -1
- package/frontend/dist/assets/framework-vendor-D0S_ys6r.js +61 -0
- package/frontend/dist/assets/framework-vendor-D0S_ys6r.js.map +1 -0
- package/frontend/dist/assets/{i18n-vendor-DVmjrzgW.js → i18n-vendor-COTriSc6.js} +2 -2
- package/frontend/dist/assets/{i18n-vendor-DVmjrzgW.js.map → i18n-vendor-COTriSc6.js.map} +1 -1
- package/frontend/dist/assets/{icons-vendor-CyAS6fj0.js → icons-vendor-DZjjGrOu.js} +2 -2
- package/frontend/dist/assets/{icons-vendor-CyAS6fj0.js.map → icons-vendor-DZjjGrOu.js.map} +1 -1
- package/frontend/dist/assets/index-6AyPtx0A.js +3 -0
- package/frontend/dist/assets/index-6AyPtx0A.js.map +1 -0
- package/frontend/dist/assets/{resourceService-BB4UM6IQ.js → resourceService-DMzCAZ0B.js} +2 -2
- package/frontend/dist/assets/{resourceService-BB4UM6IQ.js.map → resourceService-DMzCAZ0B.js.map} +1 -1
- package/frontend/dist/assets/{useCostData-C3XnQyUj.js → useCostData-CcFSYViI.js} +2 -2
- package/frontend/dist/assets/{useCostData-C3XnQyUj.js.map → useCostData-CcFSYViI.js.map} +1 -1
- package/frontend/dist/assets/variableDetection-CbYSa1ka.js +80 -0
- package/frontend/dist/assets/variableDetection-CbYSa1ka.js.map +1 -0
- package/frontend/dist/index.html +4 -4
- package/package.json +2 -2
- package/frontend/dist/assets/CredentialsPage-BnzqPYjg.js +0 -2
- package/frontend/dist/assets/CredentialsPage-BnzqPYjg.js.map +0 -1
- package/frontend/dist/assets/GroupsPage-DHgQeVHy.js +0 -33
- package/frontend/dist/assets/GroupsPage-DHgQeVHy.js.map +0 -1
- package/frontend/dist/assets/MarketPage-Bvi1KESo.js +0 -2
- package/frontend/dist/assets/SettingsPage-DkfXDE5_.js +0 -14
- package/frontend/dist/assets/SettingsPage-DkfXDE5_.js.map +0 -1
- package/frontend/dist/assets/UsersPage-BtdFWcVD.js +0 -2
- package/frontend/dist/assets/UsersPage-BtdFWcVD.js.map +0 -1
- package/frontend/dist/assets/framework-vendor-CQFm9vKd.js +0 -61
- package/frontend/dist/assets/framework-vendor-CQFm9vKd.js.map +0 -1
- package/frontend/dist/assets/index-CkSmxNPW.js +0 -3
- package/frontend/dist/assets/index-CkSmxNPW.js.map +0 -1
- package/frontend/dist/assets/variableDetection-BUXwrSop.js +0 -18
- package/frontend/dist/assets/variableDetection-BUXwrSop.js.map +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{r as g,j as e}from"./framework-vendor-CQFm9vKd.js";import{a as et,h as st,l as rt}from"./index-CkSmxNPW.js";import{f as tt,a as nt,O as at}from"./contextCost-CilWqGWT.js";import{u as ot}from"./i18n-vendor-DVmjrzgW.js";import{X as me}from"./icons-vendor-CyAS6fj0.js";const Tt=(a,l)=>l?l.isAdmin?!0:!!(a.owner&&a.owner===l.username):!1,lt=(a,l)=>{var r,u,h;return l===!0?null:((r=a.oauth)==null?void 0:r.allowInsecureTokenEndpoint)===!0?"server.httpOAuthRequiresAdmin":a.type==="stdio"||a.command||Array.isArray(a.args)&&a.args.length>0||!a.url&&!((u=a.openapi)!=null&&u.url)&&!((h=a.openapi)!=null&&h.schema)?"server.localExecutionRequiresAdmin":null},Ur=a=>{const l={};return a.forEach(({key:r,value:u})=>{const h=r.trim();h&&(l[h]=u)}),l},zr=a=>a?a.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],it=a=>Array.from(new Set((a||[]).map(l=>l.trim()).filter(l=>l.length>0))),ct=a=>{const l={};if(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),(a==null?void 0:a.maxBufferSize)!==void 0){if(!Number.isSafeInteger(a.maxBufferSize)||a.maxBufferSize<=0)throw new Error("options.maxBufferSize must be a positive safe integer in bytes");l.maxBufferSize=a.maxBufferSize}return l},pt=a=>{var k,S,C,p,f,i,c,K;if(!a)return{};const l={};a.identityMode&&(l.identityMode=a.identityMode),a.allowInsecureTokenEndpoint!==void 0&&(l.allowInsecureTokenEndpoint=a.allowInsecureTokenEndpoint);const r=(k=a.clientId)==null?void 0:k.trim(),u=(S=a.clientSecret)==null?void 0:S.trim(),h=(C=a.scopes)==null?void 0:C.trim(),x=(p=a.accessToken)==null?void 0:p.trim(),b=(f=a.refreshToken)==null?void 0:f.trim(),n=(i=a.authorizationEndpoint)==null?void 0:i.trim(),m=(c=a.tokenEndpoint)==null?void 0:c.trim(),j=(K=a.resource)==null?void 0:K.trim();if(r&&(l.clientId=r),u&&(l.clientSecret=u),h){const E=h.split(/[\s,]+/).map(T=>T.trim()).filter(T=>T.length>0);E.length>0&&(l.scopes=E)}return x&&a.identityMode!=="personal"&&(l.accessToken=x),b&&a.identityMode!=="personal"&&(l.refreshToken=b),n&&(l.authorizationEndpoint=n),m&&(l.tokenEndpoint=m),j&&(l.resource=j),a.authorizationServerMetadata&&(l.authorizationServerMetadata=a.authorizationServerMetadata),a.dynamicRegistration&&(l.dynamicRegistration=a.dynamicRegistration),a.revocationEndpoint&&(l.revocationEndpoint=a.revocationEndpoint),a.redirectUri&&(l.redirectUri=a.redirectUri),l.identityMode==="shared"&&Object.keys(l).length===1&&delete l.identityMode,l},dt=a=>{var n,m,j,k,S,C,p,f,i,c,K,E,T,F,R,O,P,q,U,H,N,M,W;const l={version:((n=a.openapi)==null?void 0:n.version)||"3.1.0",passthroughHeaders:zr((m=a.openapi)==null?void 0:m.passthroughHeaders),cookieSession:((j=a.openapi)==null?void 0:j.cookieSession)===!0?!0:void 0},r=(S=(k=a.openapi)==null?void 0:k.oauth2TokenUrl)==null?void 0:S.trim(),u=(p=(C=a.openapi)==null?void 0:C.oauth2ClientId)==null?void 0:p.trim(),h=(i=(f=a.openapi)==null?void 0:f.oauth2ClientSecret)==null?void 0:i.trim(),x=(K=(c=a.openapi)==null?void 0:c.oauth2Token)==null?void 0:K.trim();if(((E=a.openapi)==null?void 0:E.inputMode)==="url")l.url=((T=a.openapi)==null?void 0:T.url)||"";else if(((F=a.openapi)==null?void 0:F.inputMode)==="schema"&&((R=a.openapi)!=null&&R.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},...u&&{clientId:u},...h&&{clientSecret:h},...x&&{token:x}}},...a.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:a.openapi.openIdConnectUrl||"",token:a.openapi.openIdConnectToken||""}}});const b=(P=a.openapi)==null?void 0:P.specSecurityType;return b&&b!=="none"&&(l.specSecurity={type:b,...b==="apiKey"&&{apiKey:{name:((q=a.openapi)==null?void 0:q.specApiKeyName)||"",in:((U=a.openapi)==null?void 0:U.specApiKeyIn)||"header",value:((H=a.openapi)==null?void 0:H.specApiKeyValue)||""}},...b==="http"&&{http:{scheme:((N=a.openapi)==null?void 0:N.specHttpScheme)||"basic",credentials:((M=a.openapi)==null?void 0:M.specHttpCredentials)||""}},...b==="oauth2"&&{oauth2:{token:((W=a.openapi)==null?void 0:W.specOauth2Token)||""}}}),l},he=({formData:a,serverType:l,envVars:r,headerVars:u})=>{var j,k,S,C,p;const h=Ur(r),x=Ur(u),b=ct(a.options),n=((j=a.description)==null?void 0:j.trim())||"",m={type:l,description:n,options:b,visibility:a.visibility??"private",sharedWithUsers:a.visibility==="group"?it(a.sharedWithUsers):void 0,credentialTemplate:(k=a.credentialTemplate)==null?void 0:k.map(f=>({...f,target:l==="stdio"?f.target==="args"?"args":"env":f.target==="url"?"url":"headers"})),perSessionClient:a.perSessionClient===!0?!0:void 0,startOnDemand:a.startOnDemand===!0?!0:void 0,idleTimeoutMs:a.startOnDemand===!0||(S=a.credentialTemplate)!=null&&S.length?a.idleTimeoutMs??3e5:void 0,proxy:a.proxy};if(l==="openapi")m.headers=x,m.openapi=dt(a);else if(l==="sse"||l==="streamable-http"){const f=((C=a.keepAlive)==null?void 0:C.enabled)===!0;m.protocolNegotiation=l==="streamable-http"?a.protocolNegotiation:void 0,m.url=a.url.trim(),m.env=h,m.headers=x,m.passthroughHeaders=zr(a.passthroughHeaders),m.oauth=pt(a.oauth),m.enableKeepAlive=f,m.keepAliveInterval=f?((p=a.keepAlive)==null?void 0:p.interval)||6e4:void 0}else m.command=a.command.trim(),m.args=a.args,m.env=h;return{name:a.name.trim(),config:m}},ut=(a=[],l=[])=>Array.from(new Set([...a,...l])).sort((r,u)=>r.localeCompare(u)),mt=(a,l)=>{const r=l.trim().toLowerCase();return r?a.filter(u=>u.toLowerCase().includes(r)):[...a]},ht=(a,l)=>Array.from(new Set([...a,...l])),xt=(a,l)=>{const r=new Set(l);return a.filter(u=>!r.has(u))};function Fr(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 yt(a,l,r=!1){var h,x,b,n,m;if(!l.declared||!l.supported||!l.prefill||!Fr(a,r))return a;const u=l.prefill;return{...a,openapi:{...a.openapi,securityType:u.type,apiKeyName:((h=u.apiKey)==null?void 0:h.name)||"",apiKeyIn:((x=u.apiKey)==null?void 0:x.in)||"header",apiKeyValue:"",httpScheme:((b=u.http)==null?void 0:b.scheme)||"bearer",httpCredentials:"",oauth2TokenUrl:((n=u.oauth2)==null?void 0:n.tokenUrl)||"",oauth2ClientId:"",oauth2ClientSecret:"",oauth2Token:"",openIdConnectUrl:((m=u.openIdConnect)==null?void 0:m.url)||"",openIdConnectToken:""}}}function gt(a,l){var u,h,x;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!==((u=l.prefill.apiKey)==null?void 0:u.name)||r.apiKeyIn!==((h=l.prefill.apiKey)==null?void 0:h.in);case"http":return r.httpScheme!==((x=l.prefill.http)==null?void 0:x.scheme);default:return!1}}function bt(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 vt(a,l,r={}){return l!=null&&l.declared?!Fr(a,r.securityTouched)&>(a,l)?{kind:"warning",messageKey:"securityMismatchWarning",values:{summary:l.summary,configured:bt(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 Hr(a){var u,h,x,b;const l=((u=a.openapi)==null?void 0:u.inputMode)==="schema"?"schema":"url",r=((b=l==="schema"?(h=a.openapi)==null?void 0:h.schema:(x=a.openapi)==null?void 0:x.url)==null?void 0:b.trim())||"";return{mode:l,value:r,key:r?`${l}:${r}`:""}}function Rr(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 ft(a){return!a.isEdit&&a.serverType==="openapi"&&Rr(a.source)&&a.source.key!==a.analyzedSourceKey}const Pr=/^[A-Za-z0-9._-]+$/,xe=128,Mr=a=>{const l=a.trim();return l.length>0&&l.length<=xe&&Pr.test(l)&&!l.includes("..")},wt=a=>a.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/\.{2,}/g,".").replace(/^-+|-+$/g,"").slice(0,xe)||"server",At=({onSubmit:a,onCancel:l,initialData:r=null,modalTitle:u,formError:h=null,mode:x,shareCandidatesFrom:b=null})=>{var Ke,Ee,Oe,Ue,He,Me,ze,Fe,Re,Pe,Ve,Be,Le,qe,We,$e,_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,Es,Os,Us,Hs,Ms,zs,Fs,Rs,Ps,Vs,Bs,Ls,qs,Ws,$s,_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,fr,jr,kr,Nr,Sr,Cr,Tr,wr,Ar,Ir,Kr,Er,Or;const{t:n}=ot(),{auth:m}=et(),j=!(r!=null&&r.name)||Mr(r.name),k=()=>!r||!r.config?"stdio":r.config.type?r.config.type:r.config.url?"sse":"stdio",S=t=>!t||!t.config||!t.config.env?[]:Object.entries(t.config.env).map(([s,o])=>({key:s,value:o,description:""})),C=t=>{var o;const s=(o=t==null?void 0:t.config)==null?void 0:o.oauth;return{identityMode:(s==null?void 0:s.identityMode)||"shared",clientId:(s==null?void 0:s.clientId)||"",...(s==null?void 0:s.allowInsecureTokenEndpoint)!==void 0&&{allowInsecureTokenEndpoint:s.allowInsecureTokenEndpoint},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)||"",...(s==null?void 0:s.authorizationServerMetadata)&&{authorizationServerMetadata:s.authorizationServerMetadata},...(s==null?void 0:s.dynamicRegistration)&&{dynamicRegistration:s.dynamicRegistration},...(s==null?void 0:s.revocationEndpoint)&&{revocationEndpoint:s.revocationEndpoint},...(s==null?void 0:s.redirectUri)&&{redirectUri:s.redirectUri}}},[p,f]=g.useState(k()),[i,c]=g.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:"",args:r&&r.config&&r.config.args||[],type:k(),env:S(r),headers:[],passthroughHeaders:((Ee=(Ke=r==null?void 0:r.config)==null?void 0:Ke.passthroughHeaders)==null?void 0:Ee.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:{maxBufferSize:(Me=(He=r==null?void 0:r.config)==null?void 0:He.options)==null?void 0:Me.maxBufferSize,timeout:r&&r.config&&r.config.options&&r.config.options.timeout||6e4,resetTimeoutOnProgress:((Fe=(ze=r==null?void 0:r.config)==null?void 0:ze.options)==null?void 0:Fe.resetTimeoutOnProgress)??!0,maxTotalTimeout:r&&r.config&&r.config.options&&r.config.options.maxTotalTimeout||void 0},oauth:C(r),keepAlive:{enabled:((Re=r==null?void 0:r.config)==null?void 0:Re.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,protocolNegotiation:(Be=r==null?void 0:r.config)==null?void 0:Be.protocolNegotiation,credentialTemplate:((Le=r==null?void 0:r.config)==null?void 0:Le.credentialTemplate)||[],proxy:(qe=r==null?void 0:r.config)==null?void 0:qe.proxy,startOnDemand:((We=r==null?void 0:r.config)==null?void 0:We.startOnDemand)===!0,idleTimeoutMs:(($e=r==null?void 0:r.config)==null?void 0:$e.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:((_e=r.config.openapi.security)==null?void 0:_e.type)||"none",apiKeyName:((Je=(Xe=r.config.openapi.security)==null?void 0:Xe.apiKey)==null?void 0:Je.name)||"",apiKeyIn:((Qe=(Ge=r.config.openapi.security)==null?void 0:Ge.apiKey)==null?void 0:Qe.in)||"header",apiKeyValue:((Ye=(Ze=r.config.openapi.security)==null?void 0:Ze.apiKey)==null?void 0:Ye.value)||"",httpScheme:((es=(De=r.config.openapi.security)==null?void 0:De.http)==null?void 0:es.scheme)||"bearer",httpCredentials:((rs=(ss=r.config.openapi.security)==null?void 0:ss.http)==null?void 0:rs.credentials)||"",oauth2TokenUrl:((ns=(ts=r.config.openapi.security)==null?void 0:ts.oauth2)==null?void 0:ns.tokenUrl)||"",oauth2ClientId:((os=(as=r.config.openapi.security)==null?void 0:as.oauth2)==null?void 0:os.clientId)||"",oauth2ClientSecret:((is=(ls=r.config.openapi.security)==null?void 0:ls.oauth2)==null?void 0:is.clientSecret)||"",oauth2Token:((ps=(cs=r.config.openapi.security)==null?void 0:cs.oauth2)==null?void 0:ps.token)||"",openIdConnectUrl:((us=(ds=r.config.openapi.security)==null?void 0:ds.openIdConnect)==null?void 0:us.url)||"",openIdConnectToken:((hs=(ms=r.config.openapi.security)==null?void 0:ms.openIdConnect)==null?void 0:hs.token)||"",specSecurityType:["apiKey","http","oauth2"].includes((xs=r.config.openapi.specSecurity)==null?void 0:xs.type)?r.config.openapi.specSecurity.type:"none",specApiKeyName:((gs=(ys=r.config.openapi.specSecurity)==null?void 0:ys.apiKey)==null?void 0:gs.name)||"",specApiKeyIn:((vs=(bs=r.config.openapi.specSecurity)==null?void 0:bs.apiKey)==null?void 0:vs.in)||"header",specApiKeyValue:((js=(fs=r.config.openapi.specSecurity)==null?void 0:fs.apiKey)==null?void 0:js.value)||"",specHttpScheme:((Ns=(ks=r.config.openapi.specSecurity)==null?void 0:ks.http)==null?void 0:Ns.scheme)==="bearer"?"bearer":"basic",specHttpCredentials:((Cs=(Ss=r.config.openapi.specSecurity)==null?void 0:Ss.http)==null?void 0:Cs.credentials)||"",specOauth2Token:((ws=(Ts=r.config.openapi.specSecurity)==null?void 0:Ts.oauth2)==null?void 0:ws.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}}),[K,E]=g.useState([]),[T,F]=g.useState(!1),[R,O]=g.useState(!1),[P,q]=g.useState(""),U=b||(r==null?void 0:r.name);g.useEffect(()=>{if(i.visibility!=="group"||!U)return;let t=!1;return F(!0),O(!1),st(`/servers/${encodeURIComponent(U)}/share-candidates`).then(s=>{t||(s.success&&Array.isArray(s.data)?E(s.data):O(!0))}).catch(()=>{t||O(!0)}).finally(()=>{t||F(!1)}),()=>{t=!0}},[i.visibility,U]);const H=ut(i.sharedWithUsers||[],K),N=mt(H,P),M=new Set(i.sharedWithUsers||[]),W=N.length>0&&N.every(t=>M.has(t)),Vr=N.length===0||N.every(t=>!M.has(t)),Br=t=>{c(s=>{const o=new Set(s.sharedWithUsers||[]);return o.has(t)?o.delete(t):o.add(t),{...s,sharedWithUsers:Array.from(o)}})},Lr=()=>{c(t=>({...t,sharedWithUsers:ht(t.sharedWithUsers||[],N)}))},qr=()=>{c(t=>({...t,sharedWithUsers:xt(t.sharedWithUsers||[],N)}))},[w,re]=g.useState(r&&r.config&&r.config.env?Object.entries(r.config.env).map(([t,s])=>({key:t,value:s})):[]),[A,te]=g.useState(r&&r.config&&r.config.headers?Object.entries(r.config.headers).map(([t,s])=>({key:t,value:s})):[]),[V,ye]=g.useState(null),[ne,B]=g.useState(!1),[Wr,ae]=g.useState(!1),oe=g.useRef(0),ge=g.useRef(null),be=g.useRef(!1),le=g.useRef(!!r),$=g.useRef(i);$.current=i;const ve=g.useRef(w);ve.current=w;const fe=g.useRef(A);fe.current=A;const[_,X]=g.useState(null),[je,ke]=g.useState(!1),[ie,$r]=g.useState(!1),[ce,_r]=g.useState(!1),[pe,Xr]=g.useState(!1),[de,Jr]=g.useState(!1),[Ne,J]=g.useState(null),z=x?x==="edit":!!r,Gr=()=>{le.current=!0,X(null)},G=t=>{const{name:s,value:o}=t.target;c({...i,[s]:o})},Q=t=>{f(t),c(s=>({...s,type:t}))},Z=(t,s,o)=>{const d=[...w];d[t][s]=o,re(d)},Se=()=>{re([...w,{key:"",value:""}])},Ce=t=>{const s=[...w];s.splice(t,1),re(s)},Y=(t,s,o)=>{const d=[...A];d[t][s]=o,te(d)},Te=()=>{te([...A,{key:"",value:""}])},we=t=>{const s=[...A];s.splice(t,1),te(s)},D=(t,s)=>{c(o=>({...o,oauth:{...o.oauth||{},[t]:s}}))},ee=(t,s)=>{c(o=>({...o,options:{...o.options,[t]:s}}))},Qr=async t=>{try{const s=await rt("/servers/openapi/tool-stats",{config:t.config},{signal:AbortSignal.timeout(6e4)});return s.success&&s.data?s.data:null}catch{return null}},Ae=async(t,s,o)=>{const d=++oe.current;B(!0),ae(!1);const y=await Qr(t);if(oe.current!==d)return;if(!y){ae(!0),B(!1);return}ge.current=s,ye(y);const v=$.current,L=le.current,I=y.declaredSecurity,Dr=o.allowSecurityPrefill&&!L&&!z&&!be.current;o.consumeAutomaticAnalysis&&(be.current=!0);const ue=I!=null&&I.declared&&I.supported&&Dr?yt(v,I,L):v;ue!==v&&($.current=ue,c(ue)),X(vt(v,I,{includeNotDeclared:!0,securityTouched:L})),B(!1)},Zr=async()=>{ke(!0);try{const t=he({formData:i,serverType:p,envVars:w,headerVars:A});await Ae(t,Hr(i).key,{allowSecurityPrefill:!z&&!le.current,consumeAutomaticAnalysis:!1})}catch{}finally{ke(!1)}},se=Hr(i),Ie=p==="openapi"&&Rr(se);g.useEffect(()=>{if(oe.current+=1,ye(null),ae(!1),B(!1),X(null),!ft({isEdit:z,serverType:p,source:se,analyzedSourceKey:ge.current}))return;B(!0);const t=window.setTimeout(()=>{const s=he({formData:$.current,serverType:p,envVars:ve.current,headerVars:fe.current});Ae(s,se.key,{allowSecurityPrefill:!0,consumeAutomaticAnalysis:!0})},600);return()=>{window.clearTimeout(t)}},[z,se.key,p]);const Yr=async t=>{var o;if(t.preventDefault(),J(null),(!(r!=null&&r.name)||i.name!==r.name)&&!Mr(i.name)){J(n("server.nameInvalid"));return}try{const d=he({formData:i,serverType:p,envVars:w,headerVars:A}),y=lt(d.config,(o=m.user)==null?void 0:o.isAdmin);if(y){J(n(y));return}a(d)}catch(d){J(`Error: ${d instanceof Error?d.message:String(d)}`)}};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:u}),e.jsx("button",{onClick:l,className:"hub-icon-btn","aria-label":"Close",children:e.jsx(me,{size:16})})]}),(Ne||h)&&e.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:h||Ne}),e.jsxs("form",{onSubmit:Yr,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:n("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:n("server.name")}),e.jsx("input",{type:"text",name:"name",id:"name",value:i.name,onChange:G,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: time-mcp",pattern:j?Pr.source:void 0,maxLength:j?xe:void 0,title:n("server.nameInvalid"),required:!0})]}),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:n("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:i.description||"",onChange:G,className:"w-full py-2 px-3 form-input",placeholder:n("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:n("server.sectionConnection","Connection")}),((As=m.user)==null?void 0:As.isAdmin)!==!0&&e.jsx("p",{id:"local-execution-permission",className:"text-sm text-amber-700 dark:text-amber-300 mb-3",children:n("server.localExecutionRequiresAdmin")}),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:n("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",disabled:((Is=m.user)==null?void 0:Is.isAdmin)!==!0,"aria-describedby":(Ks=m.user)!=null&&Ks.isAdmin?void 0:"local-execution-permission",checked:p==="stdio",onChange:()=>Q("stdio"),className:"mr-1"}),e.jsx("label",{htmlFor:"command",className:"text-[var(--hub-ink)]",children:n("server.typeStdio")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:p==="sse",onChange:()=>Q("sse"),className:"mr-1"}),e.jsx("label",{htmlFor:"url",className:"text-[var(--hub-ink)]",children:n("server.typeSse")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:p==="streamable-http",onChange:()=>Q("streamable-http"),className:"mr-1"}),e.jsx("label",{htmlFor:"streamable-http",className:"text-[var(--hub-ink)]",children:n("server.typeStreamableHttp")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:p==="openapi",onChange:()=>Q("openapi"),className:"mr-1"}),e.jsx("label",{htmlFor:"openapi",className:"text-[var(--hub-ink)]",children:n("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:n("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:((Es=i.openapi)==null?void 0:Es.inputMode)==="url",onChange:()=>c(t=>({...t,openapi:{...t.openapi,inputMode:"url"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-url",children:n("server.openapi.inputModeUrl")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((Os=i.openapi)==null?void 0:Os.inputMode)==="schema",onChange:()=>c(t=>({...t,openapi:{...t.openapi,inputMode:"schema"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-schema",children:n("server.openapi.inputModeSchema")})]})]})]}),((Us=i.openapi)==null?void 0:Us.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:n("server.openapi.specUrl")}),e.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((Hs=i.openapi)==null?void 0:Hs.url)||"",onChange:t=>c(s=>({...s,openapi:{...s.openapi,url:t.target.value}})),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:p==="openapi"&&((Ms=i.openapi)==null?void 0:Ms.inputMode)==="url"})]}),((zs=i.openapi)==null?void 0:zs.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:n("server.openapi.schema")}),e.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((Fs=i.openapi)==null?void 0:Fs.schema)||"",onChange:t=>c(s=>({...s,openapi:{...s.openapi,schema:t.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"&&((Rs=i.openapi)==null?void 0:Rs.inputMode)==="schema"}),e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:n("server.openapi.schemaHelp")})]}),!z&&Ie&&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:ne?e.jsx("p",{className:"text-blue-700 dark:text-blue-300",children:n("server.openapi.statsMeasuring")}):V?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100",children:n("server.openapi.statsSummary",{toolCount:V.toolCount,bytes:nt(V.definitionsBytes),tokens:tt(V.estimatedTokens)})}),V.estimatedTokens>=at&&e.jsx("p",{className:"mt-1 text-yellow-700 dark:text-yellow-300",children:n("server.openapi.statsWarning")})]}):Wr?e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:n("server.openapi.statsUnavailable")}):null}),e.jsxs("div",{className:"mb-4",onChange:Gr,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:n("server.openapi.security")}),e.jsx("button",{type:"button",onClick:()=>void Zr(),disabled:je||ne||!Ie,className:"hub-btn text-xs !h-7 !px-2",children:n(je||ne?"server.openapi.securityDetecting":"server.openapi.securityDetect")})]}),e.jsxs("select",{value:((Ps=i.openapi)==null?void 0:Ps.securityType)||"none",onChange:t=>c(s=>{var o;return X(null),{...s,openapi:{...s.openapi,securityType:t.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:n("server.openapi.securityNone")}),e.jsx("option",{value:"apiKey",children:n("server.openapi.securityApiKey")}),e.jsx("option",{value:"http",children:n("server.openapi.securityHttp")}),e.jsx("option",{value:"oauth2",children:n("server.openapi.securityOAuth2")}),e.jsx("option",{value:"openIdConnect",children:n("server.openapi.securityOpenIdConnect")})]}),_&&e.jsx("p",{className:`mt-2 text-xs ${_.kind==="warning"?"text-yellow-700 dark:text-yellow-300":"text-blue-700 dark:text-blue-300"}`,children:n(`server.openapi.${_.messageKey}`,_.values)})]}),((Vs=i.openapi)==null?void 0:Vs.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:n("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:n("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((Bs=i.openapi)==null?void 0:Bs.apiKeyName)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,apiKeyName:t.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:n("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((Ls=i.openapi)==null?void 0:Ls.apiKeyIn)||"header",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,apiKeyIn:t.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:n("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:n("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:n("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:n("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((qs=i.openapi)==null?void 0:qs.apiKeyValue)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,apiKeyValue:t.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"})]})]})]}),((Ws=i.openapi)==null?void 0:Ws.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:n("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:n("server.openapi.httpScheme")}),e.jsxs("select",{value:(($s=i.openapi)==null?void 0:$s.httpScheme)||"bearer",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,httpScheme:t.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:n("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:n("server.openapi.httpSchemeBearer")}),e.jsx("option",{value:"digest",children:n("server.openapi.httpSchemeDigest")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:n("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:((_s=i.openapi)==null?void 0:_s.httpCredentials)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,httpCredentials:t.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:((Xs=i.openapi)==null?void 0:Xs.httpScheme)==="basic"?"user:password or base64":"bearer-token"}),((Js=i.openapi)==null?void 0:Js.httpScheme)==="basic"&&e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:n("server.openapi.httpCredentialsBasicHint")})]})]})]}),((Gs=i.openapi)==null?void 0:Gs.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:n("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:n("server.openapi.openIdConnectUrl")}),e.jsx("input",{type:"url",value:((Qs=i.openapi)==null?void 0:Qs.openIdConnectUrl)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,openIdConnectUrl:t.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:n("server.openapi.openIdConnectToken")}),e.jsx("input",{type:"password",value:((Zs=i.openapi)==null?void 0:Zs.openIdConnectToken)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,openIdConnectToken:t.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"})]})]})]}),((Ys=i.openapi)==null?void 0:Ys.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:n("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:n("server.oauth.tokenEndpoint")}),e.jsx("input",{type:"url",value:((Ds=i.openapi)==null?void 0:Ds.oauth2TokenUrl)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2TokenUrl:t.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:n("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((er=i.openapi)==null?void 0:er.oauth2ClientId)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2ClientId:t.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:n("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((sr=i.openapi)==null?void 0:sr.oauth2ClientSecret)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2ClientSecret:t.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:n("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((rr=i.openapi)==null?void 0:rr.oauth2Token)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,oauth2Token:t.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:(((tr=i.openapi)==null?void 0:tr.specSecurityType)||"none")!=="none",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specSecurityType:t.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:n("server.openapi.specSecurityToggle")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:n("server.openapi.specSecurityHelp")}),(((nr=i.openapi)==null?void 0:nr.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:n("server.openapi.security")}),e.jsxs("select",{value:((ar=i.openapi)==null?void 0:ar.specSecurityType)||"http",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specSecurityType:t.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:n("server.openapi.securityHttp")}),e.jsx("option",{value:"apiKey",children:n("server.openapi.securityApiKey")}),e.jsx("option",{value:"oauth2",children:n("server.openapi.securityOAuth2")})]})]}),((or=i.openapi)==null?void 0:or.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:n("server.openapi.httpScheme")}),e.jsxs("select",{value:((lr=i.openapi)==null?void 0:lr.specHttpScheme)||"basic",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specHttpScheme:t.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:n("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:n("server.openapi.httpSchemeBearer")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:n("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:((ir=i.openapi)==null?void 0:ir.specHttpCredentials)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specHttpCredentials:t.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((cr=i.openapi)==null?void 0:cr.specHttpScheme)==="basic"?"user:password or base64":"bearer-token"})]})]}),((pr=i.openapi)==null?void 0:pr.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:n("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((dr=i.openapi)==null?void 0:dr.specApiKeyName)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specApiKeyName:t.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:n("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((ur=i.openapi)==null?void 0:ur.specApiKeyIn)||"header",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specApiKeyIn:t.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:n("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:n("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:n("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:n("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((mr=i.openapi)==null?void 0:mr.specApiKeyValue)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specApiKeyValue:t.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input"})]})]}),((hr=i.openapi)==null?void 0:hr.specSecurityType)==="oauth2"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:n("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((xr=i.openapi)==null?void 0:xr.specOauth2Token)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,url:((o=s.openapi)==null?void 0:o.url)||"",specOauth2Token:t.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:((yr=i.openapi)==null?void 0:yr.cookieSession)||!1,onChange:t=>c(s=>{var o,d;return{...s,openapi:{...s.openapi,passthroughHeaders:((o=s.openapi)==null?void 0:o.passthroughHeaders)||"",url:((d=s.openapi)==null?void 0:d.url)||"",cookieSession:t.target.checked}}}),className:"mr-2"}),e.jsx("label",{htmlFor:"openapiCookieSession",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:n("server.openapi.cookieSession","Cookie Session Handling")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:n("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:n("server.headers")}),e.jsx("button",{type:"button",onClick:Te,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),A.map((t,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:t.key,onChange:o=>Y(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:t.value,onChange:o=>Y(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>we(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:n("server.url")}),e.jsx("input",{type:"url",name:"url",id:"url",value:i.url,onChange:G,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:n("server.headers")}),e.jsx("button",{type:"button",onClick:Te,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),A.map((t,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:t.key,onChange:o=>Y(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:t.value,onChange:o=>Y(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>we(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:n("server.envVars")}),e.jsx("button",{type:"button",onClick:Se,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),w.map((t,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:t.key,onChange:o=>Z(s,"key",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:n("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:t.value,onChange:o=>Z(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:n("server.value")})]}),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(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:n("server.command")}),e.jsx("input",{type:"text",name:"command",id:"command",value:i.command,onChange:G,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: npx",required:p==="stdio"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:n("server.arguments")}),e.jsx("button",{type:"button",className:"text-sm text-blue-600 dark:text-blue-400",onClick:()=>c(t=>({...t,args:[...t.args||[],""]})),children:n("server.addArgument")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:n("server.argumentsHint")}),(i.args||[]).map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("input",{type:"text","aria-label":n("server.argumentLabel",{index:s+1}),value:t,onChange:o=>{const d=o.target.value;c(y=>{var v;return{...y,args:(v=y.args)==null?void 0:v.map((L,I)=>I===s?d:L)}})},className:"w-full py-2 px-3 form-input"}),e.jsx("button",{type:"button","aria-label":n("server.removeArgument",{index:s+1}),onClick:()=>c(o=>{var d;return{...o,args:(d=o.args)==null?void 0:d.filter((y,v)=>v!==s)}}),className:"text-gray-500 hover:text-red-600",children:e.jsx(me,{size:16})})]},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:n("server.envVars")}),e.jsx("button",{type:"button",onClick:Se,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),w.map((t,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:t.key,onChange:o=>Z(s,"key",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:n("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:t.value,onChange:o=>Z(s,"value",o.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:n("server.value")})]}),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 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:()=>Jr(!de),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--hub-ink)]",children:n("server.sectionAdvanced","Advanced Options")}),e.jsx("span",{className:"text-gray-500 text-sm",children:de?"▼":"▶"})]}),de&&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:n("credentials.slots")}),e.jsx("p",{className:"text-sm text-gray-500",children:n("credentials.slotsHint")}),p==="stdio"&&e.jsx("p",{className:"text-sm text-gray-500",children:n("credentials.argsHint",{placeholder:"{{args.API_KEY}}"})}),(p==="sse"||p==="streamable-http")&&e.jsx("p",{className:"text-sm text-gray-500",children:n("credentials.urlHint",{placeholder:"{{url.region}}"})}),(i.credentialTemplate||[]).map((t,s)=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p==="stdio"?e.jsxs("select",{"aria-label":n("credentials.target"),value:t.target==="args"?"args":"env",className:"py-2 px-3 form-input",onChange:o=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,target:o.target.value}:y)})},children:[e.jsx("option",{value:"env",children:n("server.envVars")}),e.jsx("option",{value:"args",children:n("server.arguments")})]}):e.jsxs("select",{"aria-label":n("credentials.target"),value:t.target==="url"?"url":"headers",className:"py-2 px-3 form-input",onChange:o=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,target:o.target.value,allowed:o.target.value==="url"?[]:void 0}:y)})},children:[e.jsx("option",{value:"headers",children:n("server.headers")}),(p==="sse"||p==="streamable-http")&&e.jsx("option",{value:"url",children:"URL"})]}),e.jsx("input",{required:!0,maxLength:128,"aria-label":n("credentials.fieldName"),placeholder:n("credentials.fieldName"),value:t.name,className:"min-w-0 flex-1 py-2 px-3 form-input",onChange:o=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,name:o.target.value}:y)})}}),e.jsx("input",{maxLength:200,"aria-label":n("credentials.label"),placeholder:n("credentials.label"),value:t.label||"",className:"min-w-0 flex-1 py-2 px-3 form-input",onChange:o=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,label:o.target.value}:y)})}}),t.target==="url"&&e.jsx("textarea",{required:!0,"aria-label":n("credentials.allowed"),placeholder:n("credentials.allowed"),value:(t.allowed||[]).join(`
|
|
16
|
-
`),className:"w-full py-2 px-3 form-input",onChange:o=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,allowed:o.target.value.split(`
|
|
17
|
-
`)}:y)})}}),e.jsx("button",{type:"button","aria-label":n("credentials.removeSlot"),onClick:()=>{var o;return c({...i,credentialTemplate:(o=i.credentialTemplate)==null?void 0:o.filter((d,y)=>y!==s)})},children:e.jsx(me,{size:18})})]},s)),e.jsx("button",{type:"button",className:"text-sm text-blue-600",disabled:(((gr=i.credentialTemplate)==null?void 0:gr.length)||0)>=32,onClick:()=>c({...i,credentialTemplate:[...i.credentialTemplate||[],{target:p==="stdio"?"env":"headers",name:""}]}),children:n("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:n("server.visibility","Visibility")}),e.jsxs("select",{id:"visibility",name:"visibility",value:i.visibility||"private",onChange:t=>c(s=>({...s,visibility:t.target.value})),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"private",children:n("server.visibilityPrivate","Private — only the owner and admins")}),e.jsx("option",{value:"group",children:n("server.visibilityGroup","Shared — selected users only")}),e.jsx("option",{value:"public",children:n("server.visibilityPublic","Public — every authenticated user")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:n("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:n("server.shareWithUsers","Share with users")}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 mb-3",children:n("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:n("server.shareCandidatesLoading","Loading users...")}),R&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:n("server.shareCandidatesError","Failed to load users.")}),!T&&!R&&H.length===0&&e.jsx("p",{className:"text-sm text-gray-500",children:n("server.noShareCandidates","No other users are available.")}),H.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:n("server.shareUserSearchLabel","Search users")}),e.jsx("input",{id:"share-user-search",type:"search",value:P,onChange:t=>q(t.target.value),placeholder:n("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:Lr,disabled:W,className:"hub-btn text-sm",children:n("server.selectAllShareUsers","Select all")}),e.jsx("button",{type:"button",onClick:qr,disabled:Vr,className:"hub-btn text-sm",children:n("server.deselectAllShareUsers","Deselect all")})]})]}),N.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:n("server.noMatchingShareUsers","No users match your search.")}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:N.map(t=>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:M.has(t),onChange:()=>Br(t)}),e.jsx("span",{children:t})]},t))})]})]}):e.jsx("p",{className:"text-sm text-gray-500",children:n("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:n("server.openapi.passthroughHeaders")}),p==="openapi"?e.jsx(e.Fragment,{children:e.jsx("input",{type:"text",value:((br=i.openapi)==null?void 0:br.passthroughHeaders)||"",onChange:t=>c(s=>{var o;return{...s,openapi:{...s.openapi,passthroughHeaders:t.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:t=>c(s=>({...s,passthroughHeaders:t.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:n("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:()=>_r(!ce),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:n("server.oauth.sectionTitle")}),e.jsx("span",{className:"text-gray-500 text-sm",children:ce?"▼":"▶"})]}),ce&&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:n("server.oauth.sectionDescription")}),(p==="sse"||p==="streamable-http")&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{htmlFor:"oauthIdentityMode",className:"block text-xs text-gray-600 mb-1",children:n("server.oauth.identityMode")}),e.jsxs("select",{id:"oauthIdentityMode",className:"w-full py-2 px-3 form-input",value:((vr=i.oauth)==null?void 0:vr.identityMode)||"shared",onChange:t=>D("identityMode",t.target.value),children:[e.jsx("option",{value:"shared",children:n("server.oauth.sharedIdentity")}),e.jsx("option",{value:"personal",children:n("server.oauth.personalIdentity")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:n("server.oauth.personalIdentityHelp")})]}),(p==="sse"||p==="streamable-http")&&(((fr=m.user)==null?void 0:fr.isAdmin)||((jr=i.oauth)==null?void 0:jr.allowInsecureTokenEndpoint))&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:((kr=i.oauth)==null?void 0:kr.allowInsecureTokenEndpoint)===!0,disabled:!((Nr=m.user)!=null&&Nr.isAdmin),onChange:t=>D("allowInsecureTokenEndpoint",t.target.checked)}),n("server.oauth.allowInsecureTokenEndpoint")]}),e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 mt-1",children:n("server.oauth.allowInsecureTokenEndpointHelp")})]}),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:n("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Sr=i.oauth)==null?void 0:Sr.clientId)||"",onChange:t=>D("clientId",t.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:n("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((Cr=i.oauth)==null?void 0:Cr.clientSecret)||"",onChange:t=>D("clientSecret",t.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:()=>$r(!ie),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:n("server.requestOptions")}),e.jsx("span",{className:"text-gray-500 text-sm",children:ie?"▼":"▶"})]}),ie&&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:[p==="stdio"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxBufferSize",children:n("server.maxBufferSize")}),e.jsx("input",{type:"number",id:"maxBufferSize",value:((Tr=i.options)==null?void 0:Tr.maxBufferSize)??"",onChange:t=>ee("maxBufferSize",t.target.value===""?void 0:Number(t.target.value)),className:"w-full py-2 px-3 form-input",placeholder:"10485760",min:"1",step:"1"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:n("server.maxBufferSizeDescription")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"timeout",children:n("server.timeout")}),e.jsx("input",{type:"number",id:"timeout",value:((wr=i.options)==null?void 0:wr.timeout)||6e4,onChange:t=>ee("timeout",parseInt(t.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:n("server.timeoutDescription")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxTotalTimeout",children:n("server.maxTotalTimeout")}),e.jsx("input",{type:"number",id:"maxTotalTimeout",value:((Ar=i.options)==null?void 0:Ar.maxTotalTimeout)||"",onChange:t=>ee("maxTotalTimeout",t.target.value?parseInt(t.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:n("server.maxTotalTimeoutDescription")})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"checkbox",checked:((Ir=i.options)==null?void 0:Ir.resetTimeoutOnProgress)??!0,onChange:t=>ee("resetTimeoutOnProgress",t.target.checked),className:"mr-2"}),e.jsx("span",{className:"text-gray-600 text-sm",children:n("server.resetTimeoutOnProgress")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 ml-6",children:n("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:()=>Xr(!pe),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:n("server.keepAlive","Connection Health")}),e.jsx("span",{className:"text-gray-500 text-sm",children:pe?"▼":"▶"})]}),pe&&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:((Kr=i.keepAlive)==null?void 0:Kr.enabled)||!1,onChange:t=>c(s=>({...s,keepAlive:{...s.keepAlive,enabled:t.target.checked}})),className:"mr-2"}),e.jsx("label",{htmlFor:"enableKeepAlive",className:"text-gray-600 text-sm",children:n("server.enableKeepAlive","Enable Health Checks")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:n("server.keepAliveDescription","Run periodic health checks. Disconnected remote servers always reconnect automatically with backoff.")}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"keepAliveInterval",children:n("server.keepAliveInterval","Check interval (ms)")}),e.jsx("input",{type:"number",id:"keepAliveInterval",value:((Er=i.keepAlive)==null?void 0:Er.interval)||6e4,onChange:t=>c(s=>({...s,keepAlive:{...s.keepAlive,interval:parseInt(t.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:n("server.keepAliveIntervalDescription","Time between health checks 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:t=>c(s=>({...s,perSessionClient:t.target.checked})),className:"mr-2"}),e.jsx("label",{htmlFor:"perSessionClient",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:n("server.perSessionClient","Per-Session Client Isolation")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:n("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:t=>c(s=>({...s,startOnDemand:t.target.checked})),className:"mr-2"}),e.jsx("label",{htmlFor:"startOnDemand",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:n("server.startOnDemand","Start On Demand")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:n("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||!!((Or=i.credentialTemplate)!=null&&Or.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:n("server.idleTimeoutMs","Idle shutdown timeout (ms)")}),e.jsx("input",{type:"number",id:"idleTimeoutMs",min:1e4,step:1e3,value:i.idleTimeoutMs??3e5,onChange:t=>c(s=>({...s,idleTimeoutMs:Number(t.target.value)})),className:"hub-input w-40 text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:n("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:n("server.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",children:n(z?"server.save":"server.add")})]})]})]})},It=a=>{const l=new Set,r=/\$\{([^}]+)\}/g,u=x=>{let b;for(;(b=r.exec(x))!==null;)l.add(b[1])},h=(x,b="")=>{typeof x=="string"?u(x):Array.isArray(x)?x.forEach((n,m)=>h(n,`${b}[${m}]`)):x&&typeof x=="object"&&Object.entries(x).forEach(([n,m])=>{h(m,b?`${b}.${n}`:n)})};return h(a),Array.from(l)};export{xe as S,At as a,Tt as c,It as d,lt as g,wt as s};
|
|
18
|
-
//# sourceMappingURL=variableDetection-BUXwrSop.js.map
|