@samanhappy/mcphub 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/clients/openapi.js +2 -1
  2. package/dist/clients/openapi.js.map +1 -1
  3. package/dist/controllers/authController.js +27 -1
  4. package/dist/controllers/authController.js.map +1 -1
  5. package/dist/controllers/configController.js +4 -1
  6. package/dist/controllers/configController.js.map +1 -1
  7. package/dist/controllers/groupController.js +21 -6
  8. package/dist/controllers/groupController.js.map +1 -1
  9. package/dist/controllers/metricsController.js +33 -0
  10. package/dist/controllers/metricsController.js.map +1 -0
  11. package/dist/controllers/oauthServerController.js +12 -14
  12. package/dist/controllers/oauthServerController.js.map +1 -1
  13. package/dist/controllers/serverController.js +117 -11
  14. package/dist/controllers/serverController.js.map +1 -1
  15. package/dist/dao/GroupDaoDbImpl.js +9 -0
  16. package/dist/dao/GroupDaoDbImpl.js.map +1 -1
  17. package/dist/dao/OAuthTokenDaoDbImpl.js +2 -0
  18. package/dist/dao/OAuthTokenDaoDbImpl.js.map +1 -1
  19. package/dist/dao/ServerDao.js.map +1 -1
  20. package/dist/dao/ServerDaoDbImpl.js.map +1 -1
  21. package/dist/db/entities/Group.js +8 -0
  22. package/dist/db/entities/Group.js.map +1 -1
  23. package/dist/db/entities/OAuthToken.js +4 -0
  24. package/dist/db/entities/OAuthToken.js.map +1 -1
  25. package/dist/db/entities/Server.js +4 -0
  26. package/dist/db/entities/Server.js.map +1 -1
  27. package/dist/middlewares/auth.js +7 -25
  28. package/dist/middlewares/auth.js.map +1 -1
  29. package/dist/middlewares/toolCallGuard.js +499 -0
  30. package/dist/middlewares/toolCallGuard.js.map +1 -0
  31. package/dist/middlewares/userContext.js +6 -34
  32. package/dist/middlewares/userContext.js.map +1 -1
  33. package/dist/models/OAuth.js +14 -93
  34. package/dist/models/OAuth.js.map +1 -1
  35. package/dist/routes/index.js +4 -1
  36. package/dist/routes/index.js.map +1 -1
  37. package/dist/services/betterAuthConfig.js +1 -0
  38. package/dist/services/betterAuthConfig.js.map +1 -1
  39. package/dist/services/contextCostService.js +3 -1
  40. package/dist/services/contextCostService.js.map +1 -1
  41. package/dist/services/groupService.js +1 -0
  42. package/dist/services/groupService.js.map +1 -1
  43. package/dist/services/mcpOAuthProvider.js +0 -2
  44. package/dist/services/mcpOAuthProvider.js.map +1 -1
  45. package/dist/services/mcpService.js +120 -45
  46. package/dist/services/mcpService.js.map +1 -1
  47. package/dist/services/metricsService.js +54 -0
  48. package/dist/services/metricsService.js.map +1 -0
  49. package/dist/services/oauthClientRegistration.js +1 -1
  50. package/dist/services/oauthClientRegistration.js.map +1 -1
  51. package/dist/services/oauthServerService.js +15 -1
  52. package/dist/services/oauthServerService.js.map +1 -1
  53. package/dist/services/openApiGeneratorService.js +3 -1
  54. package/dist/services/openApiGeneratorService.js.map +1 -1
  55. package/dist/services/personalOAuthService.js +70 -8
  56. package/dist/services/personalOAuthService.js.map +1 -1
  57. package/dist/services/registrationService.js +28 -0
  58. package/dist/services/registrationService.js.map +1 -0
  59. package/dist/services/smartRoutingService.js +7 -6
  60. package/dist/services/smartRoutingService.js.map +1 -1
  61. package/dist/services/templateService.js +3 -1
  62. package/dist/services/templateService.js.map +1 -1
  63. package/dist/services/toolResultCompressionService.js +26 -1
  64. package/dist/services/toolResultCompressionService.js.map +1 -1
  65. package/dist/services/userService.js +22 -4
  66. package/dist/services/userService.js.map +1 -1
  67. package/dist/utils/migration.js +4 -2
  68. package/dist/utils/migration.js.map +1 -1
  69. package/dist/utils/oauthBearer.js +4 -2
  70. package/dist/utils/oauthBearer.js.map +1 -1
  71. package/dist/utils/oauthRedirectUri.js +3 -11
  72. package/dist/utils/oauthRedirectUri.js.map +1 -1
  73. package/dist/utils/parameterConversion.js +9 -4
  74. package/dist/utils/parameterConversion.js.map +1 -1
  75. package/dist/utils/passthroughHeaders.js +17 -0
  76. package/dist/utils/passthroughHeaders.js.map +1 -0
  77. package/dist/utils/rateLimit.js +1 -1
  78. package/dist/utils/rateLimit.js.map +1 -1
  79. package/dist/utils/serialization.js +2 -5
  80. package/dist/utils/serialization.js.map +1 -1
  81. package/dist/utils/serverConfigValidation.js +2 -1
  82. package/dist/utils/serverConfigValidation.js.map +1 -1
  83. package/dist/utils/settingsSync.js +58 -5
  84. package/dist/utils/settingsSync.js.map +1 -1
  85. package/dist/utils/tokenTruncation.js +1 -1
  86. package/dist/utils/tokenTruncation.js.map +1 -1
  87. package/dist/utils/toolConfig.js +93 -0
  88. package/dist/utils/toolConfig.js.map +1 -0
  89. package/dist/utils/userSession.js +29 -0
  90. package/dist/utils/userSession.js.map +1 -0
  91. package/frontend/dist/assets/{ActivityPage-e2s2j32V.js → ActivityPage-CJdAfOUF.js} +2 -2
  92. package/frontend/dist/assets/{ActivityPage-e2s2j32V.js.map → ActivityPage-CJdAfOUF.js.map} +1 -1
  93. package/frontend/dist/assets/{CopyClientConfigDialog-B71Cl89b.js → CopyClientConfigDialog-DKktm8jj.js} +2 -2
  94. package/frontend/dist/assets/{CopyClientConfigDialog-B71Cl89b.js.map → CopyClientConfigDialog-DKktm8jj.js.map} +1 -1
  95. package/frontend/dist/assets/{CredentialsPage-BnA17pRJ.js → CredentialsPage-CPyZrp4Z.js} +2 -2
  96. package/frontend/dist/assets/{CredentialsPage-BnA17pRJ.js.map → CredentialsPage-CPyZrp4Z.js.map} +1 -1
  97. package/frontend/dist/assets/{Dashboard-gC_Z286J.js → Dashboard-DM_IiBIT.js} +2 -2
  98. package/frontend/dist/assets/{Dashboard-gC_Z286J.js.map → Dashboard-DM_IiBIT.js.map} +1 -1
  99. package/frontend/dist/assets/{EndpointCopy-BjD8ehcn.js → EndpointCopy-DHQjJesJ.js} +2 -2
  100. package/frontend/dist/assets/{EndpointCopy-BjD8ehcn.js.map → EndpointCopy-DHQjJesJ.js.map} +1 -1
  101. package/frontend/dist/assets/{GroupsPage-DiT_skCf.js → GroupsPage-VKHjil-L.js} +4 -4
  102. package/frontend/dist/assets/GroupsPage-VKHjil-L.js.map +1 -0
  103. package/frontend/dist/assets/LoginPage-CKrI0By4.js +2 -0
  104. package/frontend/dist/assets/LoginPage-CKrI0By4.js.map +1 -0
  105. package/frontend/dist/assets/{LogsPage-BzI3IAHO.js → LogsPage-Dh8gRpEH.js} +2 -2
  106. package/frontend/dist/assets/{LogsPage-BzI3IAHO.js.map → LogsPage-Dh8gRpEH.js.map} +1 -1
  107. package/frontend/dist/assets/{MarketPage-DVo32QTs.js → MarketPage-BN4qL8L9.js} +2 -2
  108. package/frontend/dist/assets/{MarketPage-DVo32QTs.js.map → MarketPage-BN4qL8L9.js.map} +1 -1
  109. package/frontend/dist/assets/{OAuthConsentPage-DUapnxQ9.js → OAuthConsentPage-Cyj-rrA4.js} +2 -2
  110. package/frontend/dist/assets/{OAuthConsentPage-DUapnxQ9.js.map → OAuthConsentPage-Cyj-rrA4.js.map} +1 -1
  111. package/frontend/dist/assets/{PromptsPage-BAqJay5m.js → PromptsPage-YWD04XeI.js} +2 -2
  112. package/frontend/dist/assets/{PromptsPage-BAqJay5m.js.map → PromptsPage-YWD04XeI.js.map} +1 -1
  113. package/frontend/dist/assets/{ResourcesPage-kIOm5X1A.js → ResourcesPage-CVRzHCf4.js} +2 -2
  114. package/frontend/dist/assets/{ResourcesPage-kIOm5X1A.js.map → ResourcesPage-CVRzHCf4.js.map} +1 -1
  115. package/frontend/dist/assets/ServersPage-DJBurfOe.js +39 -0
  116. package/frontend/dist/assets/ServersPage-DJBurfOe.js.map +1 -0
  117. package/frontend/dist/assets/{SettingsPage-DkMmUgCh.js → SettingsPage-3sK6NJRn.js} +6 -6
  118. package/frontend/dist/assets/SettingsPage-3sK6NJRn.js.map +1 -0
  119. package/frontend/dist/assets/{StatusDot-Bm_C7v3r.js → StatusDot-CLZidCyq.js} +2 -2
  120. package/frontend/dist/assets/{StatusDot-Bm_C7v3r.js.map → StatusDot-CLZidCyq.js.map} +1 -1
  121. package/frontend/dist/assets/{ToggleGroup-DcOtP3Gf.js → ToggleGroup-Dfh4jKpP.js} +2 -2
  122. package/frontend/dist/assets/{ToggleGroup-DcOtP3Gf.js.map → ToggleGroup-Dfh4jKpP.js.map} +1 -1
  123. package/frontend/dist/assets/{UsersPage-DpcbXD3K.js → UsersPage-DfFqSRVb.js} +2 -2
  124. package/frontend/dist/assets/{UsersPage-DpcbXD3K.js.map → UsersPage-DfFqSRVb.js.map} +1 -1
  125. package/frontend/dist/assets/{clipboard-CvokTzlX.js → clipboard-wUZFI68F.js} +2 -2
  126. package/frontend/dist/assets/{clipboard-CvokTzlX.js.map → clipboard-wUZFI68F.js.map} +1 -1
  127. package/frontend/dist/assets/framework-vendor-CQFm9vKd.js.map +1 -1
  128. package/frontend/dist/assets/index-BbogfcdA.js +3 -0
  129. package/frontend/dist/assets/index-BbogfcdA.js.map +1 -0
  130. package/frontend/dist/assets/{resourceService-CbZwkCgS.js → resourceService-D7yitP7i.js} +2 -2
  131. package/frontend/dist/assets/{resourceService-CbZwkCgS.js.map → resourceService-D7yitP7i.js.map} +1 -1
  132. package/frontend/dist/assets/{useCostData-DZ5NdhVp.js → useCostData-33G6s4EW.js} +2 -2
  133. package/frontend/dist/assets/{useCostData-DZ5NdhVp.js.map → useCostData-33G6s4EW.js.map} +1 -1
  134. package/frontend/dist/assets/{variableDetection-SMtrW-P5.js → variableDetection-BVSe56ia.js} +2 -2
  135. package/frontend/dist/assets/{variableDetection-SMtrW-P5.js.map → variableDetection-BVSe56ia.js.map} +1 -1
  136. package/frontend/dist/index.html +1 -1
  137. package/package.json +3 -2
  138. package/frontend/dist/assets/GroupsPage-DiT_skCf.js.map +0 -1
  139. package/frontend/dist/assets/LoginPage-DK3WmTV9.js +0 -2
  140. package/frontend/dist/assets/LoginPage-DK3WmTV9.js.map +0 -1
  141. package/frontend/dist/assets/ServersPage-CkUdGq0R.js +0 -39
  142. package/frontend/dist/assets/ServersPage-CkUdGq0R.js.map +0 -1
  143. package/frontend/dist/assets/SettingsPage-DkMmUgCh.js.map +0 -1
  144. package/frontend/dist/assets/index-DkQidC_d.js +0 -3
  145. package/frontend/dist/assets/index-DkQidC_d.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{h as c,k as t,i as n}from"./index-DkQidC_d.js";import"./framework-vendor-CQFm9vKd.js";import"./i18n-vendor-DVmjrzgW.js";import"./icons-vendor-CkcU1LMA.js";const d=async(r,o,s)=>{try{const e=await t(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/toggle`,{enabled:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error toggling resource",{serverName:r,resourceUri:o,enabled:s,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},g=async(r,o,s)=>{try{const e=await n(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{description:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error updating resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},m=async(r,o)=>{var s;try{const e=await c(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message,description:(s=e.data)==null?void 0:s.description}}catch(e){return console.error("Error resetting resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}};export{m as resetResourceDescription,d as toggleResource,g as updateResourceDescription};
2
- //# sourceMappingURL=resourceService-CbZwkCgS.js.map
1
+ import{h as c,k as t,i as n}from"./index-BbogfcdA.js";import"./framework-vendor-CQFm9vKd.js";import"./i18n-vendor-DVmjrzgW.js";import"./icons-vendor-CkcU1LMA.js";const d=async(r,o,s)=>{try{const e=await t(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/toggle`,{enabled:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error toggling resource",{serverName:r,resourceUri:o,enabled:s,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},g=async(r,o,s)=>{try{const e=await n(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{description:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error updating resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},m=async(r,o)=>{var s;try{const e=await c(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message,description:(s=e.data)==null?void 0:s.description}}catch(e){return console.error("Error resetting resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}};export{m as resetResourceDescription,d as toggleResource,g as updateResourceDescription};
2
+ //# sourceMappingURL=resourceService-D7yitP7i.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceService-CbZwkCgS.js","sources":["../../src/services/resourceService.ts"],"sourcesContent":["import { apiDelete, apiPost, apiPut } from '../utils/fetchInterceptor';\n\n/**\n * Toggle a resource's enabled state for a specific server\n */\nexport const toggleResource = async (\n serverName: string,\n resourceUri: string,\n enabled: boolean,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPost<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/toggle`,\n { enabled },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error toggling resource', { serverName, resourceUri, enabled, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\n/**\n * Update a resource's description for a specific server\n */\nexport const updateResourceDescription = async (\n serverName: string,\n resourceUri: string,\n description: string,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPut<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n { description },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error updating resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\nexport const resetResourceDescription = async (\n serverName: string,\n resourceUri: string,\n): Promise<{ success: boolean; error?: string; description?: string }> => {\n try {\n const response = await apiDelete<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n description: response.data?.description,\n };\n } catch (error) {\n console.error('Error resetting resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n"],"names":["toggleResource","serverName","resourceUri","enabled","response","apiPost","error","updateResourceDescription","description","apiPut","resetResourceDescription","apiDelete","_a"],"mappings":"kKAKO,MAAMA,EAAiB,MAC5BC,EACAC,EACAC,IACkD,CAClD,GAAI,CACF,MAAMC,EAAW,MAAMC,EACrB,YAAY,mBAAmBJ,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,UACvF,CAAE,QAAAC,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASC,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,0BAA2B,CAAE,WAAAL,EAAY,YAAAC,EAAa,QAAAC,EAAS,MAAAG,EAAO,EAC7E,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAKaC,EAA4B,MACvCN,EACAC,EACAM,IACkD,CAClD,GAAI,CACF,MAAMJ,EAAW,MAAMK,EACrB,YAAY,mBAAmBR,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CAAE,YAAAM,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASJ,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,sCAAuC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EAChF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAEaI,EAA2B,MACtCT,EACAC,IACwE,OACxE,GAAI,CACF,MAAME,EAAW,MAAMO,EACrB,YAAY,mBAAmBV,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASE,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,QAC/C,aAAaQ,EAAAR,EAAS,OAAT,YAAAQ,EAAe,WAAA,CAEhC,OAASN,EAAO,CACd,eAAQ,MAAM,uCAAwC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EACjF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF"}
1
+ {"version":3,"file":"resourceService-D7yitP7i.js","sources":["../../src/services/resourceService.ts"],"sourcesContent":["import { apiDelete, apiPost, apiPut } from '../utils/fetchInterceptor';\n\n/**\n * Toggle a resource's enabled state for a specific server\n */\nexport const toggleResource = async (\n serverName: string,\n resourceUri: string,\n enabled: boolean,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPost<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/toggle`,\n { enabled },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error toggling resource', { serverName, resourceUri, enabled, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\n/**\n * Update a resource's description for a specific server\n */\nexport const updateResourceDescription = async (\n serverName: string,\n resourceUri: string,\n description: string,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPut<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n { description },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error updating resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\nexport const resetResourceDescription = async (\n serverName: string,\n resourceUri: string,\n): Promise<{ success: boolean; error?: string; description?: string }> => {\n try {\n const response = await apiDelete<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n description: response.data?.description,\n };\n } catch (error) {\n console.error('Error resetting resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n"],"names":["toggleResource","serverName","resourceUri","enabled","response","apiPost","error","updateResourceDescription","description","apiPut","resetResourceDescription","apiDelete","_a"],"mappings":"kKAKO,MAAMA,EAAiB,MAC5BC,EACAC,EACAC,IACkD,CAClD,GAAI,CACF,MAAMC,EAAW,MAAMC,EACrB,YAAY,mBAAmBJ,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,UACvF,CAAE,QAAAC,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASC,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,0BAA2B,CAAE,WAAAL,EAAY,YAAAC,EAAa,QAAAC,EAAS,MAAAG,EAAO,EAC7E,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAKaC,EAA4B,MACvCN,EACAC,EACAM,IACkD,CAClD,GAAI,CACF,MAAMJ,EAAW,MAAMK,EACrB,YAAY,mBAAmBR,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CAAE,YAAAM,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASJ,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,sCAAuC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EAChF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAEaI,EAA2B,MACtCT,EACAC,IACwE,OACxE,GAAI,CACF,MAAME,EAAW,MAAMO,EACrB,YAAY,mBAAmBV,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASE,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,QAC/C,aAAaQ,EAAAR,EAAS,OAAT,YAAAQ,EAAe,WAAA,CAEhC,OAASN,EAAO,CACd,eAAQ,MAAM,uCAAwC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EACjF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF"}
@@ -1,2 +1,2 @@
1
- import{o as d,f as u}from"./index-DkQidC_d.js";import{r}from"./framework-vendor-CQFm9vKd.js";const y=e=>{const a=d(),{refreshIfNeeded:c}=a;return r.useEffect(()=>{e!=null&&e.refreshOnMount&&c()},[e==null?void 0:e.refreshOnMount,c]),a},i=()=>{const[e,a]=r.useState([]),[c,n]=r.useState([]),[l,f]=r.useState(!0),o=r.useCallback(async()=>{try{f(!0);const[t,s]=await Promise.all([u("/cost/servers"),u("/cost/groups")]);t!=null&&t.success&&Array.isArray(t.data)&&a(t.data),s!=null&&s.success&&Array.isArray(s.data)&&n(s.data)}catch(t){console.error("Error fetching context footprint:",t)}finally{f(!1)}},[]);return r.useEffect(()=>{o()},[o]),{serverCosts:e,groupCosts:c,loading:l,refetch:o}};export{i as a,y as u};
2
- //# sourceMappingURL=useCostData-DZ5NdhVp.js.map
1
+ import{o as d,f as u}from"./index-BbogfcdA.js";import{r}from"./framework-vendor-CQFm9vKd.js";const y=e=>{const a=d(),{refreshIfNeeded:c}=a;return r.useEffect(()=>{e!=null&&e.refreshOnMount&&c()},[e==null?void 0:e.refreshOnMount,c]),a},i=()=>{const[e,a]=r.useState([]),[c,n]=r.useState([]),[l,f]=r.useState(!0),o=r.useCallback(async()=>{try{f(!0);const[t,s]=await Promise.all([u("/cost/servers"),u("/cost/groups")]);t!=null&&t.success&&Array.isArray(t.data)&&a(t.data),s!=null&&s.success&&Array.isArray(s.data)&&n(s.data)}catch(t){console.error("Error fetching context footprint:",t)}finally{f(!1)}},[]);return r.useEffect(()=>{o()},[o]),{serverCosts:e,groupCosts:c,loading:l,refetch:o}};export{i as a,y as u};
2
+ //# sourceMappingURL=useCostData-33G6s4EW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCostData-DZ5NdhVp.js","sources":["../../src/hooks/useServerData.ts","../../src/hooks/useCostData.ts"],"sourcesContent":["// This hook now delegates to the ServerContext to avoid duplicate requests\n// All components will share the same server data and polling mechanism\nimport { useServerContext } from '@/contexts/ServerContext';\nimport { useEffect } from 'react';\n\nexport const useServerData = (options?: { refreshOnMount?: boolean }) => {\n const context = useServerContext();\n const { refreshIfNeeded } = context;\n\n // Optionally refresh on mount for pages that need fresh data\n useEffect(() => {\n if (options?.refreshOnMount) {\n refreshIfNeeded();\n }\n }, [options?.refreshOnMount, refreshIfNeeded]);\n\n return context;\n};\n\n","import { useCallback, useEffect, useState } from 'react';\nimport { apiGet } from '../utils/fetchInterceptor';\nimport type { ApiResponse, ServerCost, GroupCost } from '@/types';\n\nexport const useCostData = () => {\n const [serverCosts, setServerCosts] = useState<ServerCost[]>([]);\n const [groupCosts, setGroupCosts] = useState<GroupCost[]>([]);\n const [loading, setLoading] = useState(true);\n\n const fetchCosts = useCallback(async () => {\n try {\n setLoading(true);\n const [servers, groups] = await Promise.all([\n apiGet('/cost/servers') as Promise<ApiResponse<ServerCost[]>>,\n apiGet('/cost/groups') as Promise<ApiResponse<GroupCost[]>>,\n ]);\n if (servers?.success && Array.isArray(servers.data)) setServerCosts(servers.data);\n if (groups?.success && Array.isArray(groups.data)) setGroupCosts(groups.data);\n } catch (err) {\n console.error('Error fetching context footprint:', err);\n } finally {\n setLoading(false);\n }\n }, []);\n\n useEffect(() => {\n fetchCosts();\n }, [fetchCosts]);\n\n return { serverCosts, groupCosts, loading, refetch: fetchCosts };\n};\n"],"names":["useServerData","options","context","useServerContext","refreshIfNeeded","useEffect","useCostData","serverCosts","setServerCosts","useState","groupCosts","setGroupCosts","loading","setLoading","fetchCosts","useCallback","servers","groups","apiGet","err"],"mappings":"6FAKO,MAAMA,EAAiBC,GAA2C,CACvE,MAAMC,EAAUC,EAAA,EACV,CAAE,gBAAAC,GAAoBF,EAG5BG,OAAAA,EAAAA,UAAU,IAAM,CACVJ,GAAA,MAAAA,EAAS,gBACXG,EAAA,CAEJ,EAAG,CAACH,GAAA,YAAAA,EAAS,eAAgBG,CAAe,CAAC,EAEtCF,CACT,ECbaI,EAAc,IAAM,CAC/B,KAAM,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAuB,CAAA,CAAE,EACzD,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAsB,CAAA,CAAE,EACtD,CAACG,EAASC,CAAU,EAAIJ,EAAAA,SAAS,EAAI,EAErCK,EAAaC,EAAAA,YAAY,SAAY,CACzC,GAAI,CACFF,EAAW,EAAI,EACf,KAAM,CAACG,EAASC,CAAM,EAAI,MAAM,QAAQ,IAAI,CAC1CC,EAAO,eAAe,EACtBA,EAAO,cAAc,CAAA,CACtB,EACGF,GAAA,MAAAA,EAAS,SAAW,MAAM,QAAQA,EAAQ,IAAI,GAAGR,EAAeQ,EAAQ,IAAI,EAC5EC,GAAA,MAAAA,EAAQ,SAAW,MAAM,QAAQA,EAAO,IAAI,GAAGN,EAAcM,EAAO,IAAI,CAC9E,OAASE,EAAK,CACZ,QAAQ,MAAM,oCAAqCA,CAAG,CACxD,QAAA,CACEN,EAAW,EAAK,CAClB,CACF,EAAG,CAAA,CAAE,EAELR,OAAAA,EAAAA,UAAU,IAAM,CACdS,EAAA,CACF,EAAG,CAACA,CAAU,CAAC,EAER,CAAE,YAAAP,EAAa,WAAAG,EAAY,QAAAE,EAAS,QAASE,CAAA,CACtD"}
1
+ {"version":3,"file":"useCostData-33G6s4EW.js","sources":["../../src/hooks/useServerData.ts","../../src/hooks/useCostData.ts"],"sourcesContent":["// This hook now delegates to the ServerContext to avoid duplicate requests\n// All components will share the same server data and polling mechanism\nimport { useServerContext } from '@/contexts/ServerContext';\nimport { useEffect } from 'react';\n\nexport const useServerData = (options?: { refreshOnMount?: boolean }) => {\n const context = useServerContext();\n const { refreshIfNeeded } = context;\n\n // Optionally refresh on mount for pages that need fresh data\n useEffect(() => {\n if (options?.refreshOnMount) {\n refreshIfNeeded();\n }\n }, [options?.refreshOnMount, refreshIfNeeded]);\n\n return context;\n};\n\n","import { useCallback, useEffect, useState } from 'react';\nimport { apiGet } from '../utils/fetchInterceptor';\nimport type { ApiResponse, ServerCost, GroupCost } from '@/types';\n\nexport const useCostData = () => {\n const [serverCosts, setServerCosts] = useState<ServerCost[]>([]);\n const [groupCosts, setGroupCosts] = useState<GroupCost[]>([]);\n const [loading, setLoading] = useState(true);\n\n const fetchCosts = useCallback(async () => {\n try {\n setLoading(true);\n const [servers, groups] = await Promise.all([\n apiGet('/cost/servers') as Promise<ApiResponse<ServerCost[]>>,\n apiGet('/cost/groups') as Promise<ApiResponse<GroupCost[]>>,\n ]);\n if (servers?.success && Array.isArray(servers.data)) setServerCosts(servers.data);\n if (groups?.success && Array.isArray(groups.data)) setGroupCosts(groups.data);\n } catch (err) {\n console.error('Error fetching context footprint:', err);\n } finally {\n setLoading(false);\n }\n }, []);\n\n useEffect(() => {\n fetchCosts();\n }, [fetchCosts]);\n\n return { serverCosts, groupCosts, loading, refetch: fetchCosts };\n};\n"],"names":["useServerData","options","context","useServerContext","refreshIfNeeded","useEffect","useCostData","serverCosts","setServerCosts","useState","groupCosts","setGroupCosts","loading","setLoading","fetchCosts","useCallback","servers","groups","apiGet","err"],"mappings":"6FAKO,MAAMA,EAAiBC,GAA2C,CACvE,MAAMC,EAAUC,EAAA,EACV,CAAE,gBAAAC,GAAoBF,EAG5BG,OAAAA,EAAAA,UAAU,IAAM,CACVJ,GAAA,MAAAA,EAAS,gBACXG,EAAA,CAEJ,EAAG,CAACH,GAAA,YAAAA,EAAS,eAAgBG,CAAe,CAAC,EAEtCF,CACT,ECbaI,EAAc,IAAM,CAC/B,KAAM,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAuB,CAAA,CAAE,EACzD,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAsB,CAAA,CAAE,EACtD,CAACG,EAASC,CAAU,EAAIJ,EAAAA,SAAS,EAAI,EAErCK,EAAaC,EAAAA,YAAY,SAAY,CACzC,GAAI,CACFF,EAAW,EAAI,EACf,KAAM,CAACG,EAASC,CAAM,EAAI,MAAM,QAAQ,IAAI,CAC1CC,EAAO,eAAe,EACtBA,EAAO,cAAc,CAAA,CACtB,EACGF,GAAA,MAAAA,EAAS,SAAW,MAAM,QAAQA,EAAQ,IAAI,GAAGR,EAAeQ,EAAQ,IAAI,EAC5EC,GAAA,MAAAA,EAAQ,SAAW,MAAM,QAAQA,EAAO,IAAI,GAAGN,EAAcM,EAAO,IAAI,CAC9E,OAASE,EAAK,CACZ,QAAQ,MAAM,oCAAqCA,CAAG,CACxD,QAAA,CACEN,EAAW,EAAK,CAClB,CACF,EAAG,CAAA,CAAE,EAELR,OAAAA,EAAAA,UAAU,IAAM,CACdS,EAAA,CACF,EAAG,CAACA,CAAU,CAAC,EAER,CAAE,YAAAP,EAAa,WAAAG,EAAY,QAAAE,EAAS,QAASE,CAAA,CACtD"}
@@ -1,4 +1,4 @@
1
- import{r as y,j as e}from"./framework-vendor-CQFm9vKd.js";import{u as Dr,f as et,k as st}from"./index-DkQidC_d.js";import{f as rt,a as tt,O as nt}from"./contextCost-CilWqGWT.js";import{u as at}from"./i18n-vendor-DVmjrzgW.js";import{X as me}from"./icons-vendor-CkcU1LMA.js";const Ct=(a,i)=>i?i.isAdmin?!0:!!(a.owner&&a.owner===i.username):!1,ot=(a,i)=>{var r,d,h;return i===!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&&!((d=a.openapi)!=null&&d.url)&&!((h=a.openapi)!=null&&h.schema)?"server.localExecutionRequiresAdmin":null},Or=a=>{const i={};return a.forEach(({key:r,value:d})=>{const h=r.trim();h&&(i[h]=d)}),i},Mr=a=>a?a.split(",").map(i=>i.trim()).filter(i=>i.length>0):[],it=a=>Array.from(new Set((a||[]).map(i=>i.trim()).filter(i=>i.length>0))),lt=a=>{const i={};if(typeof(a==null?void 0:a.timeout)=="number"&&!Number.isNaN(a.timeout)&&(i.timeout=a.timeout),typeof(a==null?void 0:a.resetTimeoutOnProgress)=="boolean"&&(i.resetTimeoutOnProgress=a.resetTimeoutOnProgress),a!=null&&a.maxTotalTimeout&&(i.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");i.maxBufferSize=a.maxBufferSize}return i},ct=a=>{var k,S,C,p,f,l,c,K;if(!a)return{};const i={};a.identityMode&&(i.identityMode=a.identityMode),a.allowInsecureTokenEndpoint!==void 0&&(i.allowInsecureTokenEndpoint=a.allowInsecureTokenEndpoint);const r=(k=a.clientId)==null?void 0:k.trim(),d=(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(),g=(f=a.refreshToken)==null?void 0:f.trim(),n=(l=a.authorizationEndpoint)==null?void 0:l.trim(),u=(c=a.tokenEndpoint)==null?void 0:c.trim(),j=(K=a.resource)==null?void 0:K.trim();if(r&&(i.clientId=r),d&&(i.clientSecret=d),h){const E=h.split(/[\s,]+/).map(T=>T.trim()).filter(T=>T.length>0);E.length>0&&(i.scopes=E)}return x&&a.identityMode!=="personal"&&(i.accessToken=x),g&&a.identityMode!=="personal"&&(i.refreshToken=g),n&&(i.authorizationEndpoint=n),u&&(i.tokenEndpoint=u),j&&(i.resource=j),a.dynamicRegistration&&(i.dynamicRegistration=a.dynamicRegistration),a.revocationEndpoint&&(i.revocationEndpoint=a.revocationEndpoint),a.redirectUri&&(i.redirectUri=a.redirectUri),i.identityMode==="shared"&&Object.keys(i).length===1&&delete i.identityMode,i},pt=a=>{var n,u,j,k,S,C,p,f,l,c,K,E,T,R,P,O,z,W,U,H,N,M,q;const i={version:((n=a.openapi)==null?void 0:n.version)||"3.1.0",passthroughHeaders:Mr((u=a.openapi)==null?void 0:u.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(),d=(p=(C=a.openapi)==null?void 0:C.oauth2ClientId)==null?void 0:p.trim(),h=(l=(f=a.openapi)==null?void 0:f.oauth2ClientSecret)==null?void 0:l.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")i.url=((T=a.openapi)==null?void 0:T.url)||"";else if(((R=a.openapi)==null?void 0:R.inputMode)==="schema"&&((P=a.openapi)!=null&&P.schema))try{i.schema=JSON.parse(a.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}(O=a.openapi)!=null&&O.securityType&&a.openapi.securityType!=="none"&&(i.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},...h&&{clientSecret:h},...x&&{token:x}}},...a.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:a.openapi.openIdConnectUrl||"",token:a.openapi.openIdConnectToken||""}}});const g=(z=a.openapi)==null?void 0:z.specSecurityType;return g&&g!=="none"&&(i.specSecurity={type:g,...g==="apiKey"&&{apiKey:{name:((W=a.openapi)==null?void 0:W.specApiKeyName)||"",in:((U=a.openapi)==null?void 0:U.specApiKeyIn)||"header",value:((H=a.openapi)==null?void 0:H.specApiKeyValue)||""}},...g==="http"&&{http:{scheme:((N=a.openapi)==null?void 0:N.specHttpScheme)||"basic",credentials:((M=a.openapi)==null?void 0:M.specHttpCredentials)||""}},...g==="oauth2"&&{oauth2:{token:((q=a.openapi)==null?void 0:q.specOauth2Token)||""}}}),i},he=({formData:a,serverType:i,envVars:r,headerVars:d})=>{var j,k,S,C,p;const h=Or(r),x=Or(d),g=lt(a.options),n=((j=a.description)==null?void 0:j.trim())||"",u={type:i,description:n,options:g,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:i==="stdio"?f.target==="args"?"args":"env":"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(i==="openapi")u.headers=x,u.openapi=pt(a);else if(i==="sse"||i==="streamable-http"){const f=((C=a.keepAlive)==null?void 0:C.enabled)===!0;u.url=a.url.trim(),u.env=h,u.headers=x,u.passthroughHeaders=Mr(a.passthroughHeaders),u.oauth=ct(a.oauth),u.enableKeepAlive=f,u.keepAliveInterval=f?((p=a.keepAlive)==null?void 0:p.interval)||6e4:void 0}else u.command=a.command.trim(),u.args=a.args,u.env=h;return{name:a.name.trim(),config:u}},dt=(a=[],i=[])=>Array.from(new Set([...a,...i])).sort((r,d)=>r.localeCompare(d)),ut=(a,i)=>{const r=i.trim().toLowerCase();return r?a.filter(d=>d.toLowerCase().includes(r)):[...a]},mt=(a,i)=>Array.from(new Set([...a,...i])),ht=(a,i)=>{const r=new Set(i);return a.filter(d=>!r.has(d))};function Fr(a,i=!1){if(i)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 xt(a,i,r=!1){var h,x,g,n,u;if(!i.declared||!i.supported||!i.prefill||!Fr(a,r))return a;const d=i.prefill;return{...a,openapi:{...a.openapi,securityType:d.type,apiKeyName:((h=d.apiKey)==null?void 0:h.name)||"",apiKeyIn:((x=d.apiKey)==null?void 0:x.in)||"header",apiKeyValue:"",httpScheme:((g=d.http)==null?void 0:g.scheme)||"bearer",httpCredentials:"",oauth2TokenUrl:((n=d.oauth2)==null?void 0:n.tokenUrl)||"",oauth2ClientId:"",oauth2ClientSecret:"",oauth2Token:"",openIdConnectUrl:((u=d.openIdConnect)==null?void 0:u.url)||"",openIdConnectToken:""}}}function yt(a,i){var d,h,x;if(!i.prefill)return!1;const r=a.openapi;if((r==null?void 0:r.securityType)!==i.prefill.type)return!0;switch(r==null?void 0:r.securityType){case"apiKey":return r.apiKeyName!==((d=i.prefill.apiKey)==null?void 0:d.name)||r.apiKeyIn!==((h=i.prefill.apiKey)==null?void 0:h.in);case"http":return r.httpScheme!==((x=i.prefill.http)==null?void 0:x.scheme);default:return!1}}function gt(a){const i=a.openapi,r=i==null?void 0:i.securityType;if(!r||r==="none")return null;switch(r){case"apiKey":return`API key in ${(i==null?void 0:i.apiKeyIn)||"header"} '${(i==null?void 0:i.apiKeyName)||""}'`;case"http":return`HTTP ${(i==null?void 0:i.httpScheme)||"bearer"}`;case"oauth2":return"OAuth2";case"openIdConnect":return"OpenID Connect";default:return null}}function bt(a,i,r={}){return i!=null&&i.declared?!Fr(a,r.securityTouched)&&yt(a,i)?{kind:"warning",messageKey:"securityMismatchWarning",values:{summary:i.summary,configured:gt(a)||"none"}}:i.supported?{kind:"info",messageKey:"securityPrefillNotice",values:{summary:i.summary}}:{kind:"warning",messageKey:"securityUnsupportedNotice",values:{summary:i.summary,reason:i.unsupportedReason||""}}:r.includeNotDeclared?{kind:"info",messageKey:"securityNotDeclared",values:{}}:null}function Ur(a){var d,h,x,g;const i=((d=a.openapi)==null?void 0:d.inputMode)==="schema"?"schema":"url",r=((g=i==="schema"?(h=a.openapi)==null?void 0:h.schema:(x=a.openapi)==null?void 0:x.url)==null?void 0:g.trim())||"";return{mode:i,value:r,key:r?`${i}:${r}`:""}}function Rr(a){if(!a.value)return!1;if(a.mode==="schema")try{const i=JSON.parse(a.value);return i!==null&&typeof i=="object"&&!Array.isArray(i)}catch{return!1}try{const i=new URL(a.value);return i.protocol==="http:"||i.protocol==="https:"}catch{return!1}}function vt(a){return!a.isEdit&&a.serverType==="openapi"&&Rr(a.source)&&a.source.key!==a.analyzedSourceKey}const Pr=/^[A-Za-z0-9._-]+$/,xe=128,Hr=a=>{const i=a.trim();return i.length>0&&i.length<=xe&&Pr.test(i)&&!i.includes("..")},Tt=a=>a.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/\.{2,}/g,".").replace(/^-+|-+$/g,"").slice(0,xe)||"server",wt=({onSubmit:a,onCancel:i,initialData:r=null,modalTitle:d,formError:h=null,mode:x,shareCandidatesFrom:g=null})=>{var Ke,Ee,Oe,Ue,He,Me,Fe,Re,Pe,ze,Ve,Be,Le,We,qe,$e,_e,Xe,Je,Ge,Qe,Ze,Ye,De,es,ss,rs,ts,ns,as,os,is,ls,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,Fs,Rs,Ps,zs,Vs,Bs,Ls,Ws,qs,$s,_s,Xs,Js,Gs,Qs,Zs,Ys,Ds,er,sr,rr,tr,nr,ar,or,ir,lr,cr,pr,dr,ur,mr,hr,xr,yr,gr,br,vr,fr,jr,kr,Nr,Sr,Cr,Tr,wr,Ar,Ir,Kr,Er;const{t:n}=at(),{auth:u}=Dr(),j=!(r!=null&&r.name)||Hr(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.dynamicRegistration)&&{dynamicRegistration:s.dynamicRegistration},...(s==null?void 0:s.revocationEndpoint)&&{revocationEndpoint:s.revocationEndpoint},...(s==null?void 0:s.redirectUri)&&{redirectUri:s.redirectUri}}},[p,f]=y.useState(k()),[l,c]=y.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:((Re=(Fe=r==null?void 0:r.config)==null?void 0:Fe.options)==null?void 0:Re.resetTimeoutOnProgress)??!0,maxTotalTimeout:r&&r.config&&r.config.options&&r.config.options.maxTotalTimeout||void 0},oauth:C(r),keepAlive:{enabled:((Pe=r==null?void 0:r.config)==null?void 0:Pe.enableKeepAlive)===!0,interval:((ze=r==null?void 0:r.config)==null?void 0:ze.keepAliveInterval)||6e4},perSessionClient:((Ve=r==null?void 0:r.config)==null?void 0:Ve.perSessionClient)===!0,credentialTemplate:((Be=r==null?void 0:r.config)==null?void 0:Be.credentialTemplate)||[],proxy:(Le=r==null?void 0:r.config)==null?void 0:Le.proxy,startOnDemand:((We=r==null?void 0:r.config)==null?void 0:We.startOnDemand)===!0,idleTimeoutMs:((qe=r==null?void 0:r.config)==null?void 0:qe.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:((Xe=(_e=r.config.openapi.security)==null?void 0:_e.apiKey)==null?void 0:Xe.name)||"",apiKeyIn:((Ge=(Je=r.config.openapi.security)==null?void 0:Je.apiKey)==null?void 0:Ge.in)||"header",apiKeyValue:((Ze=(Qe=r.config.openapi.security)==null?void 0:Qe.apiKey)==null?void 0:Ze.value)||"",httpScheme:((De=(Ye=r.config.openapi.security)==null?void 0:Ye.http)==null?void 0:De.scheme)||"bearer",httpCredentials:((ss=(es=r.config.openapi.security)==null?void 0:es.http)==null?void 0:ss.credentials)||"",oauth2TokenUrl:((ts=(rs=r.config.openapi.security)==null?void 0:rs.oauth2)==null?void 0:ts.tokenUrl)||"",oauth2ClientId:((as=(ns=r.config.openapi.security)==null?void 0:ns.oauth2)==null?void 0:as.clientId)||"",oauth2ClientSecret:((is=(os=r.config.openapi.security)==null?void 0:os.oauth2)==null?void 0:is.clientSecret)||"",oauth2Token:((cs=(ls=r.config.openapi.security)==null?void 0:ls.oauth2)==null?void 0:cs.token)||"",openIdConnectUrl:((ds=(ps=r.config.openapi.security)==null?void 0:ps.openIdConnect)==null?void 0:ds.url)||"",openIdConnectToken:((ms=(us=r.config.openapi.security)==null?void 0:us.openIdConnect)==null?void 0:ms.token)||"",specSecurityType:["apiKey","http","oauth2"].includes((hs=r.config.openapi.specSecurity)==null?void 0:hs.type)?r.config.openapi.specSecurity.type:"none",specApiKeyName:((ys=(xs=r.config.openapi.specSecurity)==null?void 0:xs.apiKey)==null?void 0:ys.name)||"",specApiKeyIn:((bs=(gs=r.config.openapi.specSecurity)==null?void 0:gs.apiKey)==null?void 0:bs.in)||"header",specApiKeyValue:((fs=(vs=r.config.openapi.specSecurity)==null?void 0:vs.apiKey)==null?void 0:fs.value)||"",specHttpScheme:((ks=(js=r.config.openapi.specSecurity)==null?void 0:js.http)==null?void 0:ks.scheme)==="bearer"?"bearer":"basic",specHttpCredentials:((Ss=(Ns=r.config.openapi.specSecurity)==null?void 0:Ns.http)==null?void 0:Ss.credentials)||"",specOauth2Token:((Ts=(Cs=r.config.openapi.specSecurity)==null?void 0:Cs.oauth2)==null?void 0:Ts.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]=y.useState([]),[T,R]=y.useState(!1),[P,O]=y.useState(!1),[z,W]=y.useState(""),U=g||(r==null?void 0:r.name);y.useEffect(()=>{if(l.visibility!=="group"||!U)return;let t=!1;return R(!0),O(!1),et(`/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||R(!1)}),()=>{t=!0}},[l.visibility,U]);const H=dt(l.sharedWithUsers||[],K),N=ut(H,z),M=new Set(l.sharedWithUsers||[]),q=N.length>0&&N.every(t=>M.has(t)),zr=N.length===0||N.every(t=>!M.has(t)),Vr=t=>{c(s=>{const o=new Set(s.sharedWithUsers||[]);return o.has(t)?o.delete(t):o.add(t),{...s,sharedWithUsers:Array.from(o)}})},Br=()=>{c(t=>({...t,sharedWithUsers:mt(t.sharedWithUsers||[],N)}))},Lr=()=>{c(t=>({...t,sharedWithUsers:ht(t.sharedWithUsers||[],N)}))},[w,re]=y.useState(r&&r.config&&r.config.env?Object.entries(r.config.env).map(([t,s])=>({key:t,value:s})):[]),[A,te]=y.useState(r&&r.config&&r.config.headers?Object.entries(r.config.headers).map(([t,s])=>({key:t,value:s})):[]),[V,ye]=y.useState(null),[ne,B]=y.useState(!1),[Wr,ae]=y.useState(!1),oe=y.useRef(0),ge=y.useRef(null),be=y.useRef(!1),ie=y.useRef(!!r),$=y.useRef(l);$.current=l;const ve=y.useRef(w);ve.current=w;const fe=y.useRef(A);fe.current=A;const[_,X]=y.useState(null),[je,ke]=y.useState(!1),[le,qr]=y.useState(!1),[ce,$r]=y.useState(!1),[pe,_r]=y.useState(!1),[de,Xr]=y.useState(!1),[Ne,J]=y.useState(null),F=x?x==="edit":!!r,Jr=()=>{ie.current=!0,X(null)},G=t=>{const{name:s,value:o}=t.target;c({...l,[s]:o})},Q=t=>{f(t),c(s=>({...s,type:t}))},Z=(t,s,o)=>{const m=[...w];m[t][s]=o,re(m)},Se=()=>{re([...w,{key:"",value:""}])},Ce=t=>{const s=[...w];s.splice(t,1),re(s)},Y=(t,s,o)=>{const m=[...A];m[t][s]=o,te(m)},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}}))},Gr=async t=>{try{const s=await st("/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 m=++oe.current;B(!0),ae(!1);const b=await Gr(t);if(oe.current!==m)return;if(!b){ae(!0),B(!1);return}ge.current=s,ye(b);const v=$.current,L=ie.current,I=b.declaredSecurity,Yr=o.allowSecurityPrefill&&!L&&!F&&!be.current;o.consumeAutomaticAnalysis&&(be.current=!0);const ue=I!=null&&I.declared&&I.supported&&Yr?xt(v,I,L):v;ue!==v&&($.current=ue,c(ue)),X(bt(v,I,{includeNotDeclared:!0,securityTouched:L})),B(!1)},Qr=async()=>{ke(!0);try{const t=he({formData:l,serverType:p,envVars:w,headerVars:A});await Ae(t,Ur(l).key,{allowSecurityPrefill:!F&&!ie.current,consumeAutomaticAnalysis:!1})}catch{}finally{ke(!1)}},se=Ur(l),Ie=p==="openapi"&&Rr(se);y.useEffect(()=>{if(oe.current+=1,ye(null),ae(!1),B(!1),X(null),!vt({isEdit:F,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)}},[F,se.key,p]);const Zr=async t=>{var o;if(t.preventDefault(),J(null),(!(r!=null&&r.name)||l.name!==r.name)&&!Hr(l.name)){J(n("server.nameInvalid"));return}try{const m=he({formData:l,serverType:p,envVars:w,headerVars:A}),b=ot(m.config,(o=u.user)==null?void 0:o.isAdmin);if(b){J(n(b));return}a(m)}catch(m){J(`Error: ${m instanceof Error?m.message:String(m)}`)}};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:i,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:Zr,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:l.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.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:n("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:n("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:l.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")}),((ws=u.user)==null?void 0:ws.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:((As=u.user)==null?void 0:As.isAdmin)!==!0,"aria-describedby":(Is=u.user)!=null&&Is.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:((Ks=l.openapi)==null?void 0:Ks.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:((Es=l.openapi)==null?void 0:Es.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")})]})]})]}),((Os=l.openapi)==null?void 0:Os.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:((Us=l.openapi)==null?void 0:Us.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"&&((Hs=l.openapi)==null?void 0:Hs.inputMode)==="url"})]}),((Ms=l.openapi)==null?void 0:Ms.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=l.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:`{
1
+ import{r as y,j as e}from"./framework-vendor-CQFm9vKd.js";import{u as Dr,f as et,k as st}from"./index-BbogfcdA.js";import{f as rt,a as tt,O as nt}from"./contextCost-CilWqGWT.js";import{u as at}from"./i18n-vendor-DVmjrzgW.js";import{X as me}from"./icons-vendor-CkcU1LMA.js";const Ct=(a,i)=>i?i.isAdmin?!0:!!(a.owner&&a.owner===i.username):!1,ot=(a,i)=>{var r,d,h;return i===!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&&!((d=a.openapi)!=null&&d.url)&&!((h=a.openapi)!=null&&h.schema)?"server.localExecutionRequiresAdmin":null},Or=a=>{const i={};return a.forEach(({key:r,value:d})=>{const h=r.trim();h&&(i[h]=d)}),i},Mr=a=>a?a.split(",").map(i=>i.trim()).filter(i=>i.length>0):[],it=a=>Array.from(new Set((a||[]).map(i=>i.trim()).filter(i=>i.length>0))),lt=a=>{const i={};if(typeof(a==null?void 0:a.timeout)=="number"&&!Number.isNaN(a.timeout)&&(i.timeout=a.timeout),typeof(a==null?void 0:a.resetTimeoutOnProgress)=="boolean"&&(i.resetTimeoutOnProgress=a.resetTimeoutOnProgress),a!=null&&a.maxTotalTimeout&&(i.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");i.maxBufferSize=a.maxBufferSize}return i},ct=a=>{var k,S,C,p,f,l,c,K;if(!a)return{};const i={};a.identityMode&&(i.identityMode=a.identityMode),a.allowInsecureTokenEndpoint!==void 0&&(i.allowInsecureTokenEndpoint=a.allowInsecureTokenEndpoint);const r=(k=a.clientId)==null?void 0:k.trim(),d=(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(),g=(f=a.refreshToken)==null?void 0:f.trim(),n=(l=a.authorizationEndpoint)==null?void 0:l.trim(),u=(c=a.tokenEndpoint)==null?void 0:c.trim(),j=(K=a.resource)==null?void 0:K.trim();if(r&&(i.clientId=r),d&&(i.clientSecret=d),h){const E=h.split(/[\s,]+/).map(T=>T.trim()).filter(T=>T.length>0);E.length>0&&(i.scopes=E)}return x&&a.identityMode!=="personal"&&(i.accessToken=x),g&&a.identityMode!=="personal"&&(i.refreshToken=g),n&&(i.authorizationEndpoint=n),u&&(i.tokenEndpoint=u),j&&(i.resource=j),a.dynamicRegistration&&(i.dynamicRegistration=a.dynamicRegistration),a.revocationEndpoint&&(i.revocationEndpoint=a.revocationEndpoint),a.redirectUri&&(i.redirectUri=a.redirectUri),i.identityMode==="shared"&&Object.keys(i).length===1&&delete i.identityMode,i},pt=a=>{var n,u,j,k,S,C,p,f,l,c,K,E,T,R,P,O,z,W,U,H,N,M,q;const i={version:((n=a.openapi)==null?void 0:n.version)||"3.1.0",passthroughHeaders:Mr((u=a.openapi)==null?void 0:u.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(),d=(p=(C=a.openapi)==null?void 0:C.oauth2ClientId)==null?void 0:p.trim(),h=(l=(f=a.openapi)==null?void 0:f.oauth2ClientSecret)==null?void 0:l.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")i.url=((T=a.openapi)==null?void 0:T.url)||"";else if(((R=a.openapi)==null?void 0:R.inputMode)==="schema"&&((P=a.openapi)!=null&&P.schema))try{i.schema=JSON.parse(a.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}(O=a.openapi)!=null&&O.securityType&&a.openapi.securityType!=="none"&&(i.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},...h&&{clientSecret:h},...x&&{token:x}}},...a.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:a.openapi.openIdConnectUrl||"",token:a.openapi.openIdConnectToken||""}}});const g=(z=a.openapi)==null?void 0:z.specSecurityType;return g&&g!=="none"&&(i.specSecurity={type:g,...g==="apiKey"&&{apiKey:{name:((W=a.openapi)==null?void 0:W.specApiKeyName)||"",in:((U=a.openapi)==null?void 0:U.specApiKeyIn)||"header",value:((H=a.openapi)==null?void 0:H.specApiKeyValue)||""}},...g==="http"&&{http:{scheme:((N=a.openapi)==null?void 0:N.specHttpScheme)||"basic",credentials:((M=a.openapi)==null?void 0:M.specHttpCredentials)||""}},...g==="oauth2"&&{oauth2:{token:((q=a.openapi)==null?void 0:q.specOauth2Token)||""}}}),i},he=({formData:a,serverType:i,envVars:r,headerVars:d})=>{var j,k,S,C,p;const h=Or(r),x=Or(d),g=lt(a.options),n=((j=a.description)==null?void 0:j.trim())||"",u={type:i,description:n,options:g,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:i==="stdio"?f.target==="args"?"args":"env":"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(i==="openapi")u.headers=x,u.openapi=pt(a);else if(i==="sse"||i==="streamable-http"){const f=((C=a.keepAlive)==null?void 0:C.enabled)===!0;u.url=a.url.trim(),u.env=h,u.headers=x,u.passthroughHeaders=Mr(a.passthroughHeaders),u.oauth=ct(a.oauth),u.enableKeepAlive=f,u.keepAliveInterval=f?((p=a.keepAlive)==null?void 0:p.interval)||6e4:void 0}else u.command=a.command.trim(),u.args=a.args,u.env=h;return{name:a.name.trim(),config:u}},dt=(a=[],i=[])=>Array.from(new Set([...a,...i])).sort((r,d)=>r.localeCompare(d)),ut=(a,i)=>{const r=i.trim().toLowerCase();return r?a.filter(d=>d.toLowerCase().includes(r)):[...a]},mt=(a,i)=>Array.from(new Set([...a,...i])),ht=(a,i)=>{const r=new Set(i);return a.filter(d=>!r.has(d))};function Fr(a,i=!1){if(i)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 xt(a,i,r=!1){var h,x,g,n,u;if(!i.declared||!i.supported||!i.prefill||!Fr(a,r))return a;const d=i.prefill;return{...a,openapi:{...a.openapi,securityType:d.type,apiKeyName:((h=d.apiKey)==null?void 0:h.name)||"",apiKeyIn:((x=d.apiKey)==null?void 0:x.in)||"header",apiKeyValue:"",httpScheme:((g=d.http)==null?void 0:g.scheme)||"bearer",httpCredentials:"",oauth2TokenUrl:((n=d.oauth2)==null?void 0:n.tokenUrl)||"",oauth2ClientId:"",oauth2ClientSecret:"",oauth2Token:"",openIdConnectUrl:((u=d.openIdConnect)==null?void 0:u.url)||"",openIdConnectToken:""}}}function yt(a,i){var d,h,x;if(!i.prefill)return!1;const r=a.openapi;if((r==null?void 0:r.securityType)!==i.prefill.type)return!0;switch(r==null?void 0:r.securityType){case"apiKey":return r.apiKeyName!==((d=i.prefill.apiKey)==null?void 0:d.name)||r.apiKeyIn!==((h=i.prefill.apiKey)==null?void 0:h.in);case"http":return r.httpScheme!==((x=i.prefill.http)==null?void 0:x.scheme);default:return!1}}function gt(a){const i=a.openapi,r=i==null?void 0:i.securityType;if(!r||r==="none")return null;switch(r){case"apiKey":return`API key in ${(i==null?void 0:i.apiKeyIn)||"header"} '${(i==null?void 0:i.apiKeyName)||""}'`;case"http":return`HTTP ${(i==null?void 0:i.httpScheme)||"bearer"}`;case"oauth2":return"OAuth2";case"openIdConnect":return"OpenID Connect";default:return null}}function bt(a,i,r={}){return i!=null&&i.declared?!Fr(a,r.securityTouched)&&yt(a,i)?{kind:"warning",messageKey:"securityMismatchWarning",values:{summary:i.summary,configured:gt(a)||"none"}}:i.supported?{kind:"info",messageKey:"securityPrefillNotice",values:{summary:i.summary}}:{kind:"warning",messageKey:"securityUnsupportedNotice",values:{summary:i.summary,reason:i.unsupportedReason||""}}:r.includeNotDeclared?{kind:"info",messageKey:"securityNotDeclared",values:{}}:null}function Ur(a){var d,h,x,g;const i=((d=a.openapi)==null?void 0:d.inputMode)==="schema"?"schema":"url",r=((g=i==="schema"?(h=a.openapi)==null?void 0:h.schema:(x=a.openapi)==null?void 0:x.url)==null?void 0:g.trim())||"";return{mode:i,value:r,key:r?`${i}:${r}`:""}}function Rr(a){if(!a.value)return!1;if(a.mode==="schema")try{const i=JSON.parse(a.value);return i!==null&&typeof i=="object"&&!Array.isArray(i)}catch{return!1}try{const i=new URL(a.value);return i.protocol==="http:"||i.protocol==="https:"}catch{return!1}}function vt(a){return!a.isEdit&&a.serverType==="openapi"&&Rr(a.source)&&a.source.key!==a.analyzedSourceKey}const Pr=/^[A-Za-z0-9._-]+$/,xe=128,Hr=a=>{const i=a.trim();return i.length>0&&i.length<=xe&&Pr.test(i)&&!i.includes("..")},Tt=a=>a.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/\.{2,}/g,".").replace(/^-+|-+$/g,"").slice(0,xe)||"server",wt=({onSubmit:a,onCancel:i,initialData:r=null,modalTitle:d,formError:h=null,mode:x,shareCandidatesFrom:g=null})=>{var Ke,Ee,Oe,Ue,He,Me,Fe,Re,Pe,ze,Ve,Be,Le,We,qe,$e,_e,Xe,Je,Ge,Qe,Ze,Ye,De,es,ss,rs,ts,ns,as,os,is,ls,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,Fs,Rs,Ps,zs,Vs,Bs,Ls,Ws,qs,$s,_s,Xs,Js,Gs,Qs,Zs,Ys,Ds,er,sr,rr,tr,nr,ar,or,ir,lr,cr,pr,dr,ur,mr,hr,xr,yr,gr,br,vr,fr,jr,kr,Nr,Sr,Cr,Tr,wr,Ar,Ir,Kr,Er;const{t:n}=at(),{auth:u}=Dr(),j=!(r!=null&&r.name)||Hr(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.dynamicRegistration)&&{dynamicRegistration:s.dynamicRegistration},...(s==null?void 0:s.revocationEndpoint)&&{revocationEndpoint:s.revocationEndpoint},...(s==null?void 0:s.redirectUri)&&{redirectUri:s.redirectUri}}},[p,f]=y.useState(k()),[l,c]=y.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:((Re=(Fe=r==null?void 0:r.config)==null?void 0:Fe.options)==null?void 0:Re.resetTimeoutOnProgress)??!0,maxTotalTimeout:r&&r.config&&r.config.options&&r.config.options.maxTotalTimeout||void 0},oauth:C(r),keepAlive:{enabled:((Pe=r==null?void 0:r.config)==null?void 0:Pe.enableKeepAlive)===!0,interval:((ze=r==null?void 0:r.config)==null?void 0:ze.keepAliveInterval)||6e4},perSessionClient:((Ve=r==null?void 0:r.config)==null?void 0:Ve.perSessionClient)===!0,credentialTemplate:((Be=r==null?void 0:r.config)==null?void 0:Be.credentialTemplate)||[],proxy:(Le=r==null?void 0:r.config)==null?void 0:Le.proxy,startOnDemand:((We=r==null?void 0:r.config)==null?void 0:We.startOnDemand)===!0,idleTimeoutMs:((qe=r==null?void 0:r.config)==null?void 0:qe.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:((Xe=(_e=r.config.openapi.security)==null?void 0:_e.apiKey)==null?void 0:Xe.name)||"",apiKeyIn:((Ge=(Je=r.config.openapi.security)==null?void 0:Je.apiKey)==null?void 0:Ge.in)||"header",apiKeyValue:((Ze=(Qe=r.config.openapi.security)==null?void 0:Qe.apiKey)==null?void 0:Ze.value)||"",httpScheme:((De=(Ye=r.config.openapi.security)==null?void 0:Ye.http)==null?void 0:De.scheme)||"bearer",httpCredentials:((ss=(es=r.config.openapi.security)==null?void 0:es.http)==null?void 0:ss.credentials)||"",oauth2TokenUrl:((ts=(rs=r.config.openapi.security)==null?void 0:rs.oauth2)==null?void 0:ts.tokenUrl)||"",oauth2ClientId:((as=(ns=r.config.openapi.security)==null?void 0:ns.oauth2)==null?void 0:as.clientId)||"",oauth2ClientSecret:((is=(os=r.config.openapi.security)==null?void 0:os.oauth2)==null?void 0:is.clientSecret)||"",oauth2Token:((cs=(ls=r.config.openapi.security)==null?void 0:ls.oauth2)==null?void 0:cs.token)||"",openIdConnectUrl:((ds=(ps=r.config.openapi.security)==null?void 0:ps.openIdConnect)==null?void 0:ds.url)||"",openIdConnectToken:((ms=(us=r.config.openapi.security)==null?void 0:us.openIdConnect)==null?void 0:ms.token)||"",specSecurityType:["apiKey","http","oauth2"].includes((hs=r.config.openapi.specSecurity)==null?void 0:hs.type)?r.config.openapi.specSecurity.type:"none",specApiKeyName:((ys=(xs=r.config.openapi.specSecurity)==null?void 0:xs.apiKey)==null?void 0:ys.name)||"",specApiKeyIn:((bs=(gs=r.config.openapi.specSecurity)==null?void 0:gs.apiKey)==null?void 0:bs.in)||"header",specApiKeyValue:((fs=(vs=r.config.openapi.specSecurity)==null?void 0:vs.apiKey)==null?void 0:fs.value)||"",specHttpScheme:((ks=(js=r.config.openapi.specSecurity)==null?void 0:js.http)==null?void 0:ks.scheme)==="bearer"?"bearer":"basic",specHttpCredentials:((Ss=(Ns=r.config.openapi.specSecurity)==null?void 0:Ns.http)==null?void 0:Ss.credentials)||"",specOauth2Token:((Ts=(Cs=r.config.openapi.specSecurity)==null?void 0:Cs.oauth2)==null?void 0:Ts.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]=y.useState([]),[T,R]=y.useState(!1),[P,O]=y.useState(!1),[z,W]=y.useState(""),U=g||(r==null?void 0:r.name);y.useEffect(()=>{if(l.visibility!=="group"||!U)return;let t=!1;return R(!0),O(!1),et(`/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||R(!1)}),()=>{t=!0}},[l.visibility,U]);const H=dt(l.sharedWithUsers||[],K),N=ut(H,z),M=new Set(l.sharedWithUsers||[]),q=N.length>0&&N.every(t=>M.has(t)),zr=N.length===0||N.every(t=>!M.has(t)),Vr=t=>{c(s=>{const o=new Set(s.sharedWithUsers||[]);return o.has(t)?o.delete(t):o.add(t),{...s,sharedWithUsers:Array.from(o)}})},Br=()=>{c(t=>({...t,sharedWithUsers:mt(t.sharedWithUsers||[],N)}))},Lr=()=>{c(t=>({...t,sharedWithUsers:ht(t.sharedWithUsers||[],N)}))},[w,re]=y.useState(r&&r.config&&r.config.env?Object.entries(r.config.env).map(([t,s])=>({key:t,value:s})):[]),[A,te]=y.useState(r&&r.config&&r.config.headers?Object.entries(r.config.headers).map(([t,s])=>({key:t,value:s})):[]),[V,ye]=y.useState(null),[ne,B]=y.useState(!1),[Wr,ae]=y.useState(!1),oe=y.useRef(0),ge=y.useRef(null),be=y.useRef(!1),ie=y.useRef(!!r),$=y.useRef(l);$.current=l;const ve=y.useRef(w);ve.current=w;const fe=y.useRef(A);fe.current=A;const[_,X]=y.useState(null),[je,ke]=y.useState(!1),[le,qr]=y.useState(!1),[ce,$r]=y.useState(!1),[pe,_r]=y.useState(!1),[de,Xr]=y.useState(!1),[Ne,J]=y.useState(null),F=x?x==="edit":!!r,Jr=()=>{ie.current=!0,X(null)},G=t=>{const{name:s,value:o}=t.target;c({...l,[s]:o})},Q=t=>{f(t),c(s=>({...s,type:t}))},Z=(t,s,o)=>{const m=[...w];m[t][s]=o,re(m)},Se=()=>{re([...w,{key:"",value:""}])},Ce=t=>{const s=[...w];s.splice(t,1),re(s)},Y=(t,s,o)=>{const m=[...A];m[t][s]=o,te(m)},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}}))},Gr=async t=>{try{const s=await st("/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 m=++oe.current;B(!0),ae(!1);const b=await Gr(t);if(oe.current!==m)return;if(!b){ae(!0),B(!1);return}ge.current=s,ye(b);const v=$.current,L=ie.current,I=b.declaredSecurity,Yr=o.allowSecurityPrefill&&!L&&!F&&!be.current;o.consumeAutomaticAnalysis&&(be.current=!0);const ue=I!=null&&I.declared&&I.supported&&Yr?xt(v,I,L):v;ue!==v&&($.current=ue,c(ue)),X(bt(v,I,{includeNotDeclared:!0,securityTouched:L})),B(!1)},Qr=async()=>{ke(!0);try{const t=he({formData:l,serverType:p,envVars:w,headerVars:A});await Ae(t,Ur(l).key,{allowSecurityPrefill:!F&&!ie.current,consumeAutomaticAnalysis:!1})}catch{}finally{ke(!1)}},se=Ur(l),Ie=p==="openapi"&&Rr(se);y.useEffect(()=>{if(oe.current+=1,ye(null),ae(!1),B(!1),X(null),!vt({isEdit:F,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)}},[F,se.key,p]);const Zr=async t=>{var o;if(t.preventDefault(),J(null),(!(r!=null&&r.name)||l.name!==r.name)&&!Hr(l.name)){J(n("server.nameInvalid"));return}try{const m=he({formData:l,serverType:p,envVars:w,headerVars:A}),b=ot(m.config,(o=u.user)==null?void 0:o.isAdmin);if(b){J(n(b));return}a(m)}catch(m){J(`Error: ${m instanceof Error?m.message:String(m)}`)}};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:i,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:Zr,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:l.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.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:n("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:n("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:l.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")}),((ws=u.user)==null?void 0:ws.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:((As=u.user)==null?void 0:As.isAdmin)!==!0,"aria-describedby":(Is=u.user)!=null&&Is.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:((Ks=l.openapi)==null?void 0:Ks.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:((Es=l.openapi)==null?void 0:Es.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")})]})]})]}),((Os=l.openapi)==null?void 0:Os.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:((Us=l.openapi)==null?void 0:Us.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"&&((Hs=l.openapi)==null?void 0:Hs.inputMode)==="url"})]}),((Ms=l.openapi)==null?void 0:Ms.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=l.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
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "API",
@@ -13,4 +13,4 @@ import{r as y,j as e}from"./framework-vendor-CQFm9vKd.js";import{u as Dr,f as et
13
13
  ...
14
14
  }
15
15
  }`,required:p==="openapi"&&((Rs=l.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")})]}),!F&&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:tt(V.definitionsBytes),tokens:rt(V.estimatedTokens)})}),V.estimatedTokens>=nt&&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:Jr,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 Qr(),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=l.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)})]}),((zs=l.openapi)==null?void 0:zs.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:((Vs=l.openapi)==null?void 0:Vs.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:((Bs=l.openapi)==null?void 0:Bs.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:((Ls=l.openapi)==null?void 0:Ls.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=l.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:((qs=l.openapi)==null?void 0:qs.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=l.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:((_s=l.openapi)==null?void 0:_s.httpScheme)==="basic"?"user:password or base64":"bearer-token"}),((Xs=l.openapi)==null?void 0:Xs.httpScheme)==="basic"&&e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:n("server.openapi.httpCredentialsBasicHint")})]})]})]}),((Js=l.openapi)==null?void 0:Js.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:((Gs=l.openapi)==null?void 0:Gs.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:((Qs=l.openapi)==null?void 0:Qs.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"})]})]})]}),((Zs=l.openapi)==null?void 0:Zs.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:((Ys=l.openapi)==null?void 0:Ys.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:((Ds=l.openapi)==null?void 0:Ds.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:((er=l.openapi)==null?void 0:er.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:((sr=l.openapi)==null?void 0:sr.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:(((rr=l.openapi)==null?void 0:rr.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")}),(((tr=l.openapi)==null?void 0:tr.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:((nr=l.openapi)==null?void 0:nr.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")})]})]}),((ar=l.openapi)==null?void 0:ar.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:((or=l.openapi)==null?void 0:or.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=l.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:((lr=l.openapi)==null?void 0:lr.specHttpScheme)==="basic"?"user:password or base64":"bearer-token"})]})]}),((cr=l.openapi)==null?void 0:cr.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:((pr=l.openapi)==null?void 0:pr.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:((dr=l.openapi)==null?void 0:dr.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:((ur=l.openapi)==null?void 0:ur.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"})]})]}),((mr=l.openapi)==null?void 0:mr.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:((hr=l.openapi)==null?void 0:hr.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:((xr=l.openapi)==null?void 0:xr.cookieSession)||!1,onChange:t=>c(s=>{var o,m;return{...s,openapi:{...s.openapi,passthroughHeaders:((o=s.openapi)==null?void 0:o.passthroughHeaders)||"",url:((m=s.openapi)==null?void 0:m.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:l.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:l.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")}),(l.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 m=o.target.value;c(b=>{var v;return{...b,args:(v=b.args)==null?void 0:v.map((L,I)=>I===s?m: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 m;return{...o,args:(m=o.args)==null?void 0:m.filter((b,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:()=>Xr(!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}}"})}),(l.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 m;return c({...l,credentialTemplate:(m=l.credentialTemplate)==null?void 0:m.map((b,v)=>v===s?{...b,target:o.target.value}:b)})},children:[e.jsx("option",{value:"env",children:n("server.envVars")}),e.jsx("option",{value:"args",children:n("server.arguments")})]}):e.jsx("span",{className:"text-sm",children:n("server.headers")}),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 m;return c({...l,credentialTemplate:(m=l.credentialTemplate)==null?void 0:m.map((b,v)=>v===s?{...b,name:o.target.value}:b)})}}),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 m;return c({...l,credentialTemplate:(m=l.credentialTemplate)==null?void 0:m.map((b,v)=>v===s?{...b,label:o.target.value}:b)})}}),e.jsx("button",{type:"button","aria-label":n("credentials.removeSlot"),onClick:()=>{var o;return c({...l,credentialTemplate:(o=l.credentialTemplate)==null?void 0:o.filter((m,b)=>b!==s)})},children:e.jsx(me,{size:18})})]},s)),e.jsx("button",{type:"button",className:"text-sm text-blue-600",disabled:(((yr=l.credentialTemplate)==null?void 0:yr.length)||0)>=32,onClick:()=>c({...l,credentialTemplate:[...l.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:l.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.")}),l.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...")}),P&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:n("server.shareCandidatesError","Failed to load users.")}),!T&&!P&&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:z,onChange:t=>W(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:Br,disabled:q,className:"hub-btn text-sm",children:n("server.selectAllShareUsers","Select all")}),e.jsx("button",{type:"button",onClick:Lr,disabled:zr,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:()=>Vr(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:((gr=l.openapi)==null?void 0:gr.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:l.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:((br=l.oauth)==null?void 0:br.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")&&(((vr=u.user)==null?void 0:vr.isAdmin)||((fr=l.oauth)==null?void 0:fr.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:((jr=l.oauth)==null?void 0:jr.allowInsecureTokenEndpoint)===!0,disabled:!((kr=u.user)!=null&&kr.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:((Nr=l.oauth)==null?void 0:Nr.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:((Sr=l.oauth)==null?void 0:Sr.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:()=>qr(!le),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:le?"▼":"▶"})]}),le&&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:((Cr=l.options)==null?void 0:Cr.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:((Tr=l.options)==null?void 0:Tr.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:((wr=l.options)==null?void 0:wr.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:((Ar=l.options)==null?void 0:Ar.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:()=>_r(!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:((Ir=l.keepAlive)==null?void 0:Ir.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 and Auto Reconnect")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:n("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:n("server.keepAliveInterval","Check interval (ms)")}),e.jsx("input",{type:"number",id:"keepAliveInterval",value:((Kr=l.keepAlive)==null?void 0:Kr.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 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:l.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:l.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.")}),(l.startOnDemand||!!((Er=l.credentialTemplate)!=null&&Er.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:l.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:i,className:"hub-btn mr-2",children:n("server.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",children:n(F?"server.save":"server.add")})]})]})]})},At=a=>{const i=new Set,r=/\$\{([^}]+)\}/g,d=x=>{let g;for(;(g=r.exec(x))!==null;)i.add(g[1])},h=(x,g="")=>{typeof x=="string"?d(x):Array.isArray(x)?x.forEach((n,u)=>h(n,`${g}[${u}]`)):x&&typeof x=="object"&&Object.entries(x).forEach(([n,u])=>{h(u,g?`${g}.${n}`:n)})};return h(a),Array.from(i)};export{xe as S,wt as a,Ct as c,At as d,ot as g,Tt as s};
16
- //# sourceMappingURL=variableDetection-SMtrW-P5.js.map
16
+ //# sourceMappingURL=variableDetection-BVSe56ia.js.map