@samanhappy/mcphub 1.0.15 → 1.0.17

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 (68) hide show
  1. package/dist/cli/commands/cache.js +39 -0
  2. package/dist/cli/commands/cache.js.map +1 -0
  3. package/dist/cli/commands/servers.js +14 -0
  4. package/dist/cli/commands/servers.js.map +1 -1
  5. package/dist/cli/help.js +11 -2
  6. package/dist/cli/help.js.map +1 -1
  7. package/dist/cli/main.js +1 -0
  8. package/dist/cli/main.js.map +1 -1
  9. package/dist/controllers/serverController.js +62 -1
  10. package/dist/controllers/serverController.js.map +1 -1
  11. package/dist/middlewares/auth.js +20 -7
  12. package/dist/middlewares/auth.js.map +1 -1
  13. package/dist/routes/index.js +3 -1
  14. package/dist/routes/index.js.map +1 -1
  15. package/dist/services/mcpService.js +152 -8
  16. package/dist/services/mcpService.js.map +1 -1
  17. package/dist/utils/cacheUtils.js +110 -0
  18. package/dist/utils/cacheUtils.js.map +1 -0
  19. package/frontend/dist/assets/{ActivityPage-etYV4wuP.js → ActivityPage-KqU4EjKb.js} +2 -2
  20. package/frontend/dist/assets/{ActivityPage-etYV4wuP.js.map → ActivityPage-KqU4EjKb.js.map} +1 -1
  21. package/frontend/dist/assets/{Dashboard-6c1FZ95O.js → Dashboard-CXc-ImS1.js} +2 -2
  22. package/frontend/dist/assets/{Dashboard-6c1FZ95O.js.map → Dashboard-CXc-ImS1.js.map} +1 -1
  23. package/frontend/dist/assets/{EndpointCopy-1Bo7-TVB.js → EndpointCopy-B0Jzcw_o.js} +2 -2
  24. package/frontend/dist/assets/{EndpointCopy-1Bo7-TVB.js.map → EndpointCopy-B0Jzcw_o.js.map} +1 -1
  25. package/frontend/dist/assets/{GroupsPage-DbPxUGAN.js → GroupsPage-CswSlOw8.js} +4 -4
  26. package/frontend/dist/assets/{GroupsPage-DbPxUGAN.js.map → GroupsPage-CswSlOw8.js.map} +1 -1
  27. package/frontend/dist/assets/{LoginPage-BBCopkpH.js → LoginPage-BhY00qA7.js} +2 -2
  28. package/frontend/dist/assets/{LoginPage-BBCopkpH.js.map → LoginPage-BhY00qA7.js.map} +1 -1
  29. package/frontend/dist/assets/{LogsPage-eK0o_Sui.js → LogsPage-Dg-lc3Pg.js} +2 -2
  30. package/frontend/dist/assets/{LogsPage-eK0o_Sui.js.map → LogsPage-Dg-lc3Pg.js.map} +1 -1
  31. package/frontend/dist/assets/{MarketPage-XV3qzV0f.js → MarketPage-Cx40FYHN.js} +2 -2
  32. package/frontend/dist/assets/{MarketPage-XV3qzV0f.js.map → MarketPage-Cx40FYHN.js.map} +1 -1
  33. package/frontend/dist/assets/{PromptsPage-D2U_R5Zz.js → PromptsPage-CGdbhjVN.js} +2 -2
  34. package/frontend/dist/assets/{PromptsPage-D2U_R5Zz.js.map → PromptsPage-CGdbhjVN.js.map} +1 -1
  35. package/frontend/dist/assets/{ResourcesPage-DmS0pfnQ.js → ResourcesPage-Cb85Tu7s.js} +2 -2
  36. package/frontend/dist/assets/{ResourcesPage-DmS0pfnQ.js.map → ResourcesPage-Cb85Tu7s.js.map} +1 -1
  37. package/frontend/dist/assets/ServersPage-EHYBPHCn.js +37 -0
  38. package/frontend/dist/assets/ServersPage-EHYBPHCn.js.map +1 -0
  39. package/frontend/dist/assets/SettingsPage-S3Sjrsdr.js +12 -0
  40. package/frontend/dist/assets/SettingsPage-S3Sjrsdr.js.map +1 -0
  41. package/frontend/dist/assets/{StatusDot-BpExJHg7.js → StatusDot-CpT1CIHe.js} +2 -2
  42. package/frontend/dist/assets/{StatusDot-BpExJHg7.js.map → StatusDot-CpT1CIHe.js.map} +1 -1
  43. package/frontend/dist/assets/{ToggleGroup-CQ-oQ3JZ.js → ToggleGroup-Dd_LLvuF.js} +2 -2
  44. package/frontend/dist/assets/{ToggleGroup-CQ-oQ3JZ.js.map → ToggleGroup-Dd_LLvuF.js.map} +1 -1
  45. package/frontend/dist/assets/{UsersPage-kQneeAIH.js → UsersPage-B1kkBEmr.js} +2 -2
  46. package/frontend/dist/assets/{UsersPage-kQneeAIH.js.map → UsersPage-B1kkBEmr.js.map} +1 -1
  47. package/frontend/dist/assets/{contextCost-DOvbCjT5.js → contextCost-BdSIYgf1.js} +2 -2
  48. package/frontend/dist/assets/{contextCost-DOvbCjT5.js.map → contextCost-BdSIYgf1.js.map} +1 -1
  49. package/frontend/dist/assets/{icons-vendor-BTEm6PQs.js → icons-vendor-Cumt8zWo.js} +62 -57
  50. package/frontend/dist/assets/icons-vendor-Cumt8zWo.js.map +1 -0
  51. package/frontend/dist/assets/index-Cm_FKd7K.js +3 -0
  52. package/frontend/dist/assets/index-Cm_FKd7K.js.map +1 -0
  53. package/frontend/dist/assets/{resourceService-Bwnx4cnT.js → resourceService-ajx0g9wO.js} +2 -2
  54. package/frontend/dist/assets/{resourceService-Bwnx4cnT.js.map → resourceService-ajx0g9wO.js.map} +1 -1
  55. package/frontend/dist/assets/useSettingsData-DPg3UYfr.js +2 -0
  56. package/frontend/dist/assets/{useSettingsData-Cx_54eVB.js.map → useSettingsData-DPg3UYfr.js.map} +1 -1
  57. package/frontend/dist/assets/{variableDetection-hIevXYOZ.js → variableDetection-C_2zoP1B.js} +2 -2
  58. package/frontend/dist/assets/{variableDetection-hIevXYOZ.js.map → variableDetection-C_2zoP1B.js.map} +1 -1
  59. package/frontend/dist/index.html +2 -2
  60. package/package.json +3 -2
  61. package/frontend/dist/assets/ServersPage-DMHR4iIL.js +0 -37
  62. package/frontend/dist/assets/ServersPage-DMHR4iIL.js.map +0 -1
  63. package/frontend/dist/assets/SettingsPage-C0D--beZ.js +0 -12
  64. package/frontend/dist/assets/SettingsPage-C0D--beZ.js.map +0 -1
  65. package/frontend/dist/assets/icons-vendor-BTEm6PQs.js.map +0 -1
  66. package/frontend/dist/assets/index-nEfQc0FI.js +0 -3
  67. package/frontend/dist/assets/index-nEfQc0FI.js.map +0 -1
  68. package/frontend/dist/assets/useSettingsData-Cx_54eVB.js +0 -2
@@ -1,2 +1,2 @@
1
- import{f as c,e as t,h as n}from"./index-nEfQc0FI.js";import"./framework-vendor-DeqnZ0v6.js";import"./i18n-vendor-DP1IRITP.js";import"./icons-vendor-BTEm6PQs.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-Bwnx4cnT.js.map
1
+ import{f as c,e as t,h as n}from"./index-Cm_FKd7K.js";import"./framework-vendor-DeqnZ0v6.js";import"./i18n-vendor-DP1IRITP.js";import"./icons-vendor-Cumt8zWo.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-ajx0g9wO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceService-Bwnx4cnT.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-ajx0g9wO.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"}
@@ -0,0 +1,2 @@
1
+ import{p as t}from"./index-Cm_FKd7K.js";const e=()=>t();export{e as u};
2
+ //# sourceMappingURL=useSettingsData-DPg3UYfr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSettingsData-Cx_54eVB.js","sources":["../../src/hooks/useSettingsData.ts"],"sourcesContent":["import { useSettings } from '@/contexts/SettingsContext';\n\n/**\n * Hook that provides access to settings data via SettingsContext.\n * This hook is a thin wrapper around useSettings to maintain backward compatibility.\n * The actual data fetching happens once in SettingsProvider, avoiding duplicate API calls.\n */\nexport const useSettingsData = () => {\n return useSettings();\n};\n"],"names":["useSettingsData","useSettings"],"mappings":"wCAOO,MAAMA,EAAkB,IACtBC,EAAA"}
1
+ {"version":3,"file":"useSettingsData-DPg3UYfr.js","sources":["../../src/hooks/useSettingsData.ts"],"sourcesContent":["import { useSettings } from '@/contexts/SettingsContext';\n\n/**\n * Hook that provides access to settings data via SettingsContext.\n * This hook is a thin wrapper around useSettings to maintain backward compatibility.\n * The actual data fetching happens once in SettingsProvider, avoiding duplicate API calls.\n */\nexport const useSettingsData = () => {\n return useSettings();\n};\n"],"names":["useSettingsData","useSettings"],"mappings":"wCAOO,MAAMA,EAAkB,IACtBC,EAAA"}
@@ -1,4 +1,4 @@
1
- import{r as N,j as e}from"./framework-vendor-DeqnZ0v6.js";import{u as ss}from"./i18n-vendor-DP1IRITP.js";import{X as rs}from"./icons-vendor-BTEm6PQs.js";const _e=o=>{const i={};return o.forEach(({key:n,value:h})=>{const m=n.trim();m&&(i[m]=h)}),i},We=o=>o?o.split(",").map(i=>i.trim()).filter(i=>i.length>0):[],ts=o=>{const i={};return o!=null&&o.timeout&&o.timeout!==6e4&&(i.timeout=o.timeout),typeof(o==null?void 0:o.resetTimeoutOnProgress)=="boolean"&&(i.resetTimeoutOnProgress=o.resetTimeoutOnProgress),o!=null&&o.maxTotalTimeout&&(i.maxTotalTimeout=o.maxTotalTimeout),i},ns=o=>{var b,l,p,g,f,y,j,k;if(!o)return{};const i={},n=(b=o.clientId)==null?void 0:b.trim(),h=(l=o.clientSecret)==null?void 0:l.trim(),m=(p=o.scopes)==null?void 0:p.trim(),t=(g=o.accessToken)==null?void 0:g.trim(),u=(f=o.refreshToken)==null?void 0:f.trim(),x=(y=o.authorizationEndpoint)==null?void 0:y.trim(),d=(j=o.tokenEndpoint)==null?void 0:j.trim(),c=(k=o.resource)==null?void 0:k.trim();if(n&&(i.clientId=n),h&&(i.clientSecret=h),m){const C=m.split(/[\s,]+/).map(v=>v.trim()).filter(v=>v.length>0);C.length>0&&(i.scopes=C)}return t&&(i.accessToken=t),u&&(i.refreshToken=u),x&&(i.authorizationEndpoint=x),d&&(i.tokenEndpoint=d),c&&(i.resource=c),i},as=o=>{var u,x,d,c,b,l,p,g,f,y,j,k,C,v,w;const i={version:((u=o.openapi)==null?void 0:u.version)||"3.1.0",passthroughHeaders:We((x=o.openapi)==null?void 0:x.passthroughHeaders)},n=(c=(d=o.openapi)==null?void 0:d.oauth2TokenUrl)==null?void 0:c.trim(),h=(l=(b=o.openapi)==null?void 0:b.oauth2ClientId)==null?void 0:l.trim(),m=(g=(p=o.openapi)==null?void 0:p.oauth2ClientSecret)==null?void 0:g.trim(),t=(y=(f=o.openapi)==null?void 0:f.oauth2Token)==null?void 0:y.trim();if(((j=o.openapi)==null?void 0:j.inputMode)==="url")i.url=((k=o.openapi)==null?void 0:k.url)||"";else if(((C=o.openapi)==null?void 0:C.inputMode)==="schema"&&((v=o.openapi)!=null&&v.schema))try{i.schema=JSON.parse(o.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}return(w=o.openapi)!=null&&w.securityType&&o.openapi.securityType!=="none"&&(i.security={type:o.openapi.securityType,...o.openapi.securityType==="apiKey"&&{apiKey:{name:o.openapi.apiKeyName||"",in:o.openapi.apiKeyIn||"header",value:o.openapi.apiKeyValue||""}},...o.openapi.securityType==="http"&&{http:{scheme:o.openapi.httpScheme||"bearer",credentials:o.openapi.httpCredentials||""}},...o.openapi.securityType==="oauth2"&&{oauth2:{...n&&{tokenUrl:n},...h&&{clientId:h},...m&&{clientSecret:m},...t&&{token:t}}},...o.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:o.openapi.openIdConnectUrl||"",token:o.openapi.openIdConnectToken||""}}}),i},os=({formData:o,serverType:i,envVars:n,headerVars:h})=>{var c,b,l;const m=_e(n),t=_e(h),u=ts(o.options),x=((c=o.description)==null?void 0:c.trim())||"",d={type:i,description:x,options:u,visibility:o.visibility??"private"};return i==="openapi"?(d.headers=t,d.openapi=as(o)):i==="sse"||i==="streamable-http"?(d.url=o.url.trim(),d.env=m,d.headers=t,d.passthroughHeaders=We(o.passthroughHeaders),d.oauth=ns(o.oauth),d.enableKeepAlive=((b=o.keepAlive)==null?void 0:b.enabled)||!1,d.keepAliveInterval=(l=o.keepAlive)!=null&&l.enabled?o.keepAlive.interval||6e4:void 0):(d.command=o.command.trim(),d.args=o.args,d.env=m),{name:o.name.trim(),config:d}},cs=({onSubmit:o,onCancel:i,initialData:n=null,modalTitle:h,formError:m=null})=>{var z,$,R,B,X,J,G,L,Q,_,W,Y,Z,D,ee,se,re,te,ne,ae,oe,le,ie,pe,ce,de,me,ue,xe,he,ge,ye,be,ve,fe,je,ke,Ne,Ce,Te,we,Ie,Se,Ae,Ke,Ee,Oe,He,Fe,Ve,Me,Pe,Ue,qe,ze,$e,Re,Be,Xe,Je,Ge,Le,Qe;const{t}=ss(),u=()=>!n||!n.config?"stdio":n.config.type?n.config.type:n.config.url?"sse":"stdio",x=r=>!r||!r.config||!r.config.env?[]:Object.entries(r.config.env).map(([s,a])=>({key:s,value:a,description:""})),d=r=>{var a;const s=(a=r==null?void 0:r.config)==null?void 0:a.oauth;return{clientId:(s==null?void 0:s.clientId)||"",clientSecret:(s==null?void 0:s.clientSecret)||"",scopes:s!=null&&s.scopes?s.scopes.join(" "):"",accessToken:(s==null?void 0:s.accessToken)||"",refreshToken:(s==null?void 0:s.refreshToken)||"",authorizationEndpoint:(s==null?void 0:s.authorizationEndpoint)||"",tokenEndpoint:(s==null?void 0:s.tokenEndpoint)||"",resource:(s==null?void 0:s.resource)||""}},[c,b]=N.useState(u()),[l,p]=N.useState({name:n&&n.name||"",description:n&&n.config&&n.config.description||"",url:n&&n.config&&n.config.url||"",command:n&&n.config&&n.config.command||"",arguments:n&&n.config&&n.config.args?Array.isArray(n.config.args)?n.config.args.join(" "):String(n.config.args):"",args:n&&n.config&&n.config.args||[],type:u(),env:x(n),headers:[],passthroughHeaders:(($=(z=n==null?void 0:n.config)==null?void 0:z.passthroughHeaders)==null?void 0:$.join(", "))||"",visibility:((R=n==null?void 0:n.config)==null?void 0:R.visibility)??"private",options:{timeout:n&&n.config&&n.config.options&&n.config.options.timeout||6e4,resetTimeoutOnProgress:((X=(B=n==null?void 0:n.config)==null?void 0:B.options)==null?void 0:X.resetTimeoutOnProgress)??!0,maxTotalTimeout:n&&n.config&&n.config.options&&n.config.options.maxTotalTimeout||void 0},oauth:d(n),keepAlive:{enabled:((J=n==null?void 0:n.config)==null?void 0:J.enableKeepAlive)||!1,interval:((G=n==null?void 0:n.config)==null?void 0:G.keepAliveInterval)||6e4},openapi:n&&n.config&&n.config.openapi?{url:n.config.openapi.url||"",schema:n.config.openapi.schema?JSON.stringify(n.config.openapi.schema,null,2):"",inputMode:n.config.openapi.url?"url":n.config.openapi.schema?"schema":"url",version:n.config.openapi.version||"3.1.0",securityType:((L=n.config.openapi.security)==null?void 0:L.type)||"none",apiKeyName:((_=(Q=n.config.openapi.security)==null?void 0:Q.apiKey)==null?void 0:_.name)||"",apiKeyIn:((Y=(W=n.config.openapi.security)==null?void 0:W.apiKey)==null?void 0:Y.in)||"header",apiKeyValue:((D=(Z=n.config.openapi.security)==null?void 0:Z.apiKey)==null?void 0:D.value)||"",httpScheme:((se=(ee=n.config.openapi.security)==null?void 0:ee.http)==null?void 0:se.scheme)||"bearer",httpCredentials:((te=(re=n.config.openapi.security)==null?void 0:re.http)==null?void 0:te.credentials)||"",oauth2TokenUrl:((ae=(ne=n.config.openapi.security)==null?void 0:ne.oauth2)==null?void 0:ae.tokenUrl)||"",oauth2ClientId:((le=(oe=n.config.openapi.security)==null?void 0:oe.oauth2)==null?void 0:le.clientId)||"",oauth2ClientSecret:((pe=(ie=n.config.openapi.security)==null?void 0:ie.oauth2)==null?void 0:pe.clientSecret)||"",oauth2Token:((de=(ce=n.config.openapi.security)==null?void 0:ce.oauth2)==null?void 0:de.token)||"",openIdConnectUrl:((ue=(me=n.config.openapi.security)==null?void 0:me.openIdConnect)==null?void 0:ue.url)||"",openIdConnectToken:((he=(xe=n.config.openapi.security)==null?void 0:xe.openIdConnect)==null?void 0:he.token)||"",passthroughHeaders:n.config.openapi.passthroughHeaders?n.config.openapi.passthroughHeaders.join(", "):""}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",passthroughHeaders:""}}),[g,f]=N.useState(n&&n.config&&n.config.env?Object.entries(n.config.env).map(([r,s])=>({key:r,value:s})):[]),[y,j]=N.useState(n&&n.config&&n.config.headers?Object.entries(n.config.headers).map(([r,s])=>({key:r,value:s})):[]),[k,C]=N.useState(!1),[v,w]=N.useState(!1),[E,Ye]=N.useState(!1),[H,F]=N.useState(null),Ze=!!n,I=r=>{const{name:s,value:a}=r.target;p({...l,[s]:a})},De=r=>{const s=r.split(" ").filter(a=>a.trim()!=="");p({...l,arguments:r,args:s})},S=r=>{b(r),p(s=>({...s,type:r}))},A=(r,s,a)=>{const T=[...g];T[r][s]=a,f(T)},V=()=>{f([...g,{key:"",value:""}])},M=r=>{const s=[...g];s.splice(r,1),f(s)},K=(r,s,a)=>{const T=[...y];T[r][s]=a,j(T)},P=()=>{j([...y,{key:"",value:""}])},U=r=>{const s=[...y];s.splice(r,1),j(s)},q=(r,s)=>{p(a=>({...a,oauth:{...a.oauth||{},[r]:s}}))},O=(r,s)=>{p(a=>({...a,options:{...a.options,[r]:s}}))},es=async r=>{r.preventDefault(),F(null);try{const s=os({formData:l,serverType:c,envVars:g,headerVars:y});o(s)}catch(s){F(`Error: ${s instanceof Error?s.message:String(s)}`)}};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:h}),e.jsx("button",{onClick:i,className:"hub-icon-btn","aria-label":"Close",children:e.jsx(rs,{size:16})})]}),(H||m)&&e.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:m||H}),e.jsxs("form",{onSubmit:es,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)]",htmlFor:"name",children:t("server.name")}),e.jsx("input",{type:"text",name:"name",id:"name",value:l.name,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: time-mcp",required:!0})]}),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:"description",children:t("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:l.description||"",onChange:I,className:"w-full py-2 px-3 form-input",placeholder:t("server.descriptionPlaceholder")})]}),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:"visibility",children:t("server.visibility","Visibility")}),e.jsxs("select",{id:"visibility",name:"visibility",value:l.visibility||"private",onChange:r=>p(s=>({...s,visibility:r.target.value})),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"private",children:t("server.visibilityPrivate","Private — only the owner and admins")}),l.visibility==="group"&&e.jsx("option",{value:"group",disabled:!0,children:t("server.visibilityGroup","Group (reserved — not yet implemented)")}),e.jsx("option",{value:"public",children:t("server.visibilityPublic","Public — every authenticated user")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.visibilityDescription","Controls which non-admin users see this server in tools/list. Admins always see all servers regardless of this setting.")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.type")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",checked:c==="stdio",onChange:()=>S("stdio"),className:"mr-1"}),e.jsx("label",{htmlFor:"command",className:"text-[var(--hub-ink)]",children:t("server.typeStdio")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:c==="sse",onChange:()=>S("sse"),className:"mr-1"}),e.jsx("label",{htmlFor:"url",className:"text-[var(--hub-ink)]",children:t("server.typeSse")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:c==="streamable-http",onChange:()=>S("streamable-http"),className:"mr-1"}),e.jsx("label",{htmlFor:"streamable-http",className:"text-[var(--hub-ink)]",children:t("server.typeStreamableHttp")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:c==="openapi",onChange:()=>S("openapi"),className:"mr-1"}),e.jsx("label",{htmlFor:"openapi",className:"text-[var(--hub-ink)]",children:t("server.typeOpenapi")})]})]})]}),c==="openapi"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.inputMode")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((ge=l.openapi)==null?void 0:ge.inputMode)==="url",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"url"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-url",children:t("server.openapi.inputModeUrl")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((ye=l.openapi)==null?void 0:ye.inputMode)==="schema",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"schema"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-schema",children:t("server.openapi.inputModeSchema")})]})]})]}),((be=l.openapi)==null?void 0:be.inputMode)==="url"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-url",children:t("server.openapi.specUrl")}),e.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((ve=l.openapi)==null?void 0:ve.url)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,url:r.target.value}})),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:c==="openapi"&&((fe=l.openapi)==null?void 0:fe.inputMode)==="url"})]}),((je=l.openapi)==null?void 0:je.inputMode)==="schema"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-schema",children:t("server.openapi.schema")}),e.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((ke=l.openapi)==null?void 0:ke.schema)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,schema:r.target.value}})),className:"w-full py-2 px-3 form-input font-mono text-sm",placeholder:`{
1
+ import{r as N,j as e}from"./framework-vendor-DeqnZ0v6.js";import{u as ss}from"./i18n-vendor-DP1IRITP.js";import{X as rs}from"./icons-vendor-Cumt8zWo.js";const _e=o=>{const i={};return o.forEach(({key:n,value:h})=>{const m=n.trim();m&&(i[m]=h)}),i},We=o=>o?o.split(",").map(i=>i.trim()).filter(i=>i.length>0):[],ts=o=>{const i={};return o!=null&&o.timeout&&o.timeout!==6e4&&(i.timeout=o.timeout),typeof(o==null?void 0:o.resetTimeoutOnProgress)=="boolean"&&(i.resetTimeoutOnProgress=o.resetTimeoutOnProgress),o!=null&&o.maxTotalTimeout&&(i.maxTotalTimeout=o.maxTotalTimeout),i},ns=o=>{var b,l,p,g,f,y,j,k;if(!o)return{};const i={},n=(b=o.clientId)==null?void 0:b.trim(),h=(l=o.clientSecret)==null?void 0:l.trim(),m=(p=o.scopes)==null?void 0:p.trim(),t=(g=o.accessToken)==null?void 0:g.trim(),u=(f=o.refreshToken)==null?void 0:f.trim(),x=(y=o.authorizationEndpoint)==null?void 0:y.trim(),d=(j=o.tokenEndpoint)==null?void 0:j.trim(),c=(k=o.resource)==null?void 0:k.trim();if(n&&(i.clientId=n),h&&(i.clientSecret=h),m){const C=m.split(/[\s,]+/).map(v=>v.trim()).filter(v=>v.length>0);C.length>0&&(i.scopes=C)}return t&&(i.accessToken=t),u&&(i.refreshToken=u),x&&(i.authorizationEndpoint=x),d&&(i.tokenEndpoint=d),c&&(i.resource=c),i},as=o=>{var u,x,d,c,b,l,p,g,f,y,j,k,C,v,w;const i={version:((u=o.openapi)==null?void 0:u.version)||"3.1.0",passthroughHeaders:We((x=o.openapi)==null?void 0:x.passthroughHeaders)},n=(c=(d=o.openapi)==null?void 0:d.oauth2TokenUrl)==null?void 0:c.trim(),h=(l=(b=o.openapi)==null?void 0:b.oauth2ClientId)==null?void 0:l.trim(),m=(g=(p=o.openapi)==null?void 0:p.oauth2ClientSecret)==null?void 0:g.trim(),t=(y=(f=o.openapi)==null?void 0:f.oauth2Token)==null?void 0:y.trim();if(((j=o.openapi)==null?void 0:j.inputMode)==="url")i.url=((k=o.openapi)==null?void 0:k.url)||"";else if(((C=o.openapi)==null?void 0:C.inputMode)==="schema"&&((v=o.openapi)!=null&&v.schema))try{i.schema=JSON.parse(o.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}return(w=o.openapi)!=null&&w.securityType&&o.openapi.securityType!=="none"&&(i.security={type:o.openapi.securityType,...o.openapi.securityType==="apiKey"&&{apiKey:{name:o.openapi.apiKeyName||"",in:o.openapi.apiKeyIn||"header",value:o.openapi.apiKeyValue||""}},...o.openapi.securityType==="http"&&{http:{scheme:o.openapi.httpScheme||"bearer",credentials:o.openapi.httpCredentials||""}},...o.openapi.securityType==="oauth2"&&{oauth2:{...n&&{tokenUrl:n},...h&&{clientId:h},...m&&{clientSecret:m},...t&&{token:t}}},...o.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:o.openapi.openIdConnectUrl||"",token:o.openapi.openIdConnectToken||""}}}),i},os=({formData:o,serverType:i,envVars:n,headerVars:h})=>{var c,b,l;const m=_e(n),t=_e(h),u=ts(o.options),x=((c=o.description)==null?void 0:c.trim())||"",d={type:i,description:x,options:u,visibility:o.visibility??"private"};return i==="openapi"?(d.headers=t,d.openapi=as(o)):i==="sse"||i==="streamable-http"?(d.url=o.url.trim(),d.env=m,d.headers=t,d.passthroughHeaders=We(o.passthroughHeaders),d.oauth=ns(o.oauth),d.enableKeepAlive=((b=o.keepAlive)==null?void 0:b.enabled)||!1,d.keepAliveInterval=(l=o.keepAlive)!=null&&l.enabled?o.keepAlive.interval||6e4:void 0):(d.command=o.command.trim(),d.args=o.args,d.env=m),{name:o.name.trim(),config:d}},cs=({onSubmit:o,onCancel:i,initialData:n=null,modalTitle:h,formError:m=null})=>{var z,$,R,B,X,J,G,L,Q,_,W,Y,Z,D,ee,se,re,te,ne,ae,oe,le,ie,pe,ce,de,me,ue,xe,he,ge,ye,be,ve,fe,je,ke,Ne,Ce,Te,we,Ie,Se,Ae,Ke,Ee,Oe,He,Fe,Ve,Me,Pe,Ue,qe,ze,$e,Re,Be,Xe,Je,Ge,Le,Qe;const{t}=ss(),u=()=>!n||!n.config?"stdio":n.config.type?n.config.type:n.config.url?"sse":"stdio",x=r=>!r||!r.config||!r.config.env?[]:Object.entries(r.config.env).map(([s,a])=>({key:s,value:a,description:""})),d=r=>{var a;const s=(a=r==null?void 0:r.config)==null?void 0:a.oauth;return{clientId:(s==null?void 0:s.clientId)||"",clientSecret:(s==null?void 0:s.clientSecret)||"",scopes:s!=null&&s.scopes?s.scopes.join(" "):"",accessToken:(s==null?void 0:s.accessToken)||"",refreshToken:(s==null?void 0:s.refreshToken)||"",authorizationEndpoint:(s==null?void 0:s.authorizationEndpoint)||"",tokenEndpoint:(s==null?void 0:s.tokenEndpoint)||"",resource:(s==null?void 0:s.resource)||""}},[c,b]=N.useState(u()),[l,p]=N.useState({name:n&&n.name||"",description:n&&n.config&&n.config.description||"",url:n&&n.config&&n.config.url||"",command:n&&n.config&&n.config.command||"",arguments:n&&n.config&&n.config.args?Array.isArray(n.config.args)?n.config.args.join(" "):String(n.config.args):"",args:n&&n.config&&n.config.args||[],type:u(),env:x(n),headers:[],passthroughHeaders:(($=(z=n==null?void 0:n.config)==null?void 0:z.passthroughHeaders)==null?void 0:$.join(", "))||"",visibility:((R=n==null?void 0:n.config)==null?void 0:R.visibility)??"private",options:{timeout:n&&n.config&&n.config.options&&n.config.options.timeout||6e4,resetTimeoutOnProgress:((X=(B=n==null?void 0:n.config)==null?void 0:B.options)==null?void 0:X.resetTimeoutOnProgress)??!0,maxTotalTimeout:n&&n.config&&n.config.options&&n.config.options.maxTotalTimeout||void 0},oauth:d(n),keepAlive:{enabled:((J=n==null?void 0:n.config)==null?void 0:J.enableKeepAlive)||!1,interval:((G=n==null?void 0:n.config)==null?void 0:G.keepAliveInterval)||6e4},openapi:n&&n.config&&n.config.openapi?{url:n.config.openapi.url||"",schema:n.config.openapi.schema?JSON.stringify(n.config.openapi.schema,null,2):"",inputMode:n.config.openapi.url?"url":n.config.openapi.schema?"schema":"url",version:n.config.openapi.version||"3.1.0",securityType:((L=n.config.openapi.security)==null?void 0:L.type)||"none",apiKeyName:((_=(Q=n.config.openapi.security)==null?void 0:Q.apiKey)==null?void 0:_.name)||"",apiKeyIn:((Y=(W=n.config.openapi.security)==null?void 0:W.apiKey)==null?void 0:Y.in)||"header",apiKeyValue:((D=(Z=n.config.openapi.security)==null?void 0:Z.apiKey)==null?void 0:D.value)||"",httpScheme:((se=(ee=n.config.openapi.security)==null?void 0:ee.http)==null?void 0:se.scheme)||"bearer",httpCredentials:((te=(re=n.config.openapi.security)==null?void 0:re.http)==null?void 0:te.credentials)||"",oauth2TokenUrl:((ae=(ne=n.config.openapi.security)==null?void 0:ne.oauth2)==null?void 0:ae.tokenUrl)||"",oauth2ClientId:((le=(oe=n.config.openapi.security)==null?void 0:oe.oauth2)==null?void 0:le.clientId)||"",oauth2ClientSecret:((pe=(ie=n.config.openapi.security)==null?void 0:ie.oauth2)==null?void 0:pe.clientSecret)||"",oauth2Token:((de=(ce=n.config.openapi.security)==null?void 0:ce.oauth2)==null?void 0:de.token)||"",openIdConnectUrl:((ue=(me=n.config.openapi.security)==null?void 0:me.openIdConnect)==null?void 0:ue.url)||"",openIdConnectToken:((he=(xe=n.config.openapi.security)==null?void 0:xe.openIdConnect)==null?void 0:he.token)||"",passthroughHeaders:n.config.openapi.passthroughHeaders?n.config.openapi.passthroughHeaders.join(", "):""}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",passthroughHeaders:""}}),[g,f]=N.useState(n&&n.config&&n.config.env?Object.entries(n.config.env).map(([r,s])=>({key:r,value:s})):[]),[y,j]=N.useState(n&&n.config&&n.config.headers?Object.entries(n.config.headers).map(([r,s])=>({key:r,value:s})):[]),[k,C]=N.useState(!1),[v,w]=N.useState(!1),[E,Ye]=N.useState(!1),[H,F]=N.useState(null),Ze=!!n,I=r=>{const{name:s,value:a}=r.target;p({...l,[s]:a})},De=r=>{const s=r.split(" ").filter(a=>a.trim()!=="");p({...l,arguments:r,args:s})},S=r=>{b(r),p(s=>({...s,type:r}))},A=(r,s,a)=>{const T=[...g];T[r][s]=a,f(T)},V=()=>{f([...g,{key:"",value:""}])},M=r=>{const s=[...g];s.splice(r,1),f(s)},K=(r,s,a)=>{const T=[...y];T[r][s]=a,j(T)},P=()=>{j([...y,{key:"",value:""}])},U=r=>{const s=[...y];s.splice(r,1),j(s)},q=(r,s)=>{p(a=>({...a,oauth:{...a.oauth||{},[r]:s}}))},O=(r,s)=>{p(a=>({...a,options:{...a.options,[r]:s}}))},es=async r=>{r.preventDefault(),F(null);try{const s=os({formData:l,serverType:c,envVars:g,headerVars:y});o(s)}catch(s){F(`Error: ${s instanceof Error?s.message:String(s)}`)}};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:h}),e.jsx("button",{onClick:i,className:"hub-icon-btn","aria-label":"Close",children:e.jsx(rs,{size:16})})]}),(H||m)&&e.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:m||H}),e.jsxs("form",{onSubmit:es,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)]",htmlFor:"name",children:t("server.name")}),e.jsx("input",{type:"text",name:"name",id:"name",value:l.name,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: time-mcp",required:!0})]}),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:"description",children:t("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:l.description||"",onChange:I,className:"w-full py-2 px-3 form-input",placeholder:t("server.descriptionPlaceholder")})]}),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:"visibility",children:t("server.visibility","Visibility")}),e.jsxs("select",{id:"visibility",name:"visibility",value:l.visibility||"private",onChange:r=>p(s=>({...s,visibility:r.target.value})),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"private",children:t("server.visibilityPrivate","Private — only the owner and admins")}),l.visibility==="group"&&e.jsx("option",{value:"group",disabled:!0,children:t("server.visibilityGroup","Group (reserved — not yet implemented)")}),e.jsx("option",{value:"public",children:t("server.visibilityPublic","Public — every authenticated user")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.visibilityDescription","Controls which non-admin users see this server in tools/list. Admins always see all servers regardless of this setting.")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.type")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",checked:c==="stdio",onChange:()=>S("stdio"),className:"mr-1"}),e.jsx("label",{htmlFor:"command",className:"text-[var(--hub-ink)]",children:t("server.typeStdio")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:c==="sse",onChange:()=>S("sse"),className:"mr-1"}),e.jsx("label",{htmlFor:"url",className:"text-[var(--hub-ink)]",children:t("server.typeSse")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:c==="streamable-http",onChange:()=>S("streamable-http"),className:"mr-1"}),e.jsx("label",{htmlFor:"streamable-http",className:"text-[var(--hub-ink)]",children:t("server.typeStreamableHttp")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:c==="openapi",onChange:()=>S("openapi"),className:"mr-1"}),e.jsx("label",{htmlFor:"openapi",className:"text-[var(--hub-ink)]",children:t("server.typeOpenapi")})]})]})]}),c==="openapi"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.inputMode")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((ge=l.openapi)==null?void 0:ge.inputMode)==="url",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"url"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-url",children:t("server.openapi.inputModeUrl")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((ye=l.openapi)==null?void 0:ye.inputMode)==="schema",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"schema"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-schema",children:t("server.openapi.inputModeSchema")})]})]})]}),((be=l.openapi)==null?void 0:be.inputMode)==="url"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-url",children:t("server.openapi.specUrl")}),e.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((ve=l.openapi)==null?void 0:ve.url)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,url:r.target.value}})),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:c==="openapi"&&((fe=l.openapi)==null?void 0:fe.inputMode)==="url"})]}),((je=l.openapi)==null?void 0:je.inputMode)==="schema"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-schema",children:t("server.openapi.schema")}),e.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((ke=l.openapi)==null?void 0:ke.schema)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,schema:r.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 N,j as e}from"./framework-vendor-DeqnZ0v6.js";import{u as ss}from"./
13
13
  ...
14
14
  }
15
15
  }`,required:c==="openapi"&&((Ne=l.openapi)==null?void 0:Ne.inputMode)==="schema"}),e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.openapi.schemaHelp")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.security")}),e.jsxs("select",{value:((Ce=l.openapi)==null?void 0:Ce.securityType)||"none",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,securityType:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"none",children:t("server.openapi.securityNone")}),e.jsx("option",{value:"apiKey",children:t("server.openapi.securityApiKey")}),e.jsx("option",{value:"http",children:t("server.openapi.securityHttp")}),e.jsx("option",{value:"oauth2",children:t("server.openapi.securityOAuth2")}),e.jsx("option",{value:"openIdConnect",children:t("server.openapi.securityOpenIdConnect")})]})]}),((Te=l.openapi)==null?void 0:Te.securityType)==="apiKey"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-[var(--hub-ink-2)]",children:t("server.openapi.apiKeyConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((we=l.openapi)==null?void 0:we.apiKeyName)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,apiKeyName:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm form-input focus:outline-none",placeholder:"Authorization"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((Ie=l.openapi)==null?void 0:Ie.apiKeyIn)||"header",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,apiKeyIn:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"header",children:t("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:t("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:t("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((Se=l.openapi)==null?void 0:Se.apiKeyValue)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,apiKeyValue:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"your-api-key"})]})]})]}),((Ae=l.openapi)==null?void 0:Ae.securityType)==="http"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.httpAuthConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpScheme")}),e.jsxs("select",{value:((Ke=l.openapi)==null?void 0:Ke.httpScheme)||"bearer",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,httpScheme:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"basic",children:t("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:t("server.openapi.httpSchemeBearer")}),e.jsx("option",{value:"digest",children:t("server.openapi.httpSchemeDigest")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:((Ee=l.openapi)==null?void 0:Ee.httpCredentials)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,httpCredentials:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((Oe=l.openapi)==null?void 0:Oe.httpScheme)==="basic"?"base64-encoded-credentials":"bearer-token"})]})]})]}),((He=l.openapi)==null?void 0:He.securityType)==="oauth2"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.oauth2Config")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.tokenEndpoint")}),e.jsx("input",{type:"url",value:((Fe=l.openapi)==null?void 0:Fe.oauth2TokenUrl)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2TokenUrl:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/oauth/token"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Ve=l.openapi)==null?void 0:Ve.oauth2ClientId)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2ClientId:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-id"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((Me=l.openapi)==null?void 0:Me.oauth2ClientSecret)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2ClientSecret:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-secret"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((Pe=l.openapi)==null?void 0:Pe.oauth2Token)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2Token:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"access-token"})]})]})]}),((Ue=l.openapi)==null?void 0:Ue.securityType)==="openIdConnect"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.openIdConnectConfig")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectUrl")}),e.jsx("input",{type:"url",value:((qe=l.openapi)==null?void 0:qe.openIdConnectUrl)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,openIdConnectUrl:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/.well-known/openid_configuration"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectToken")}),e.jsx("input",{type:"password",value:((ze=l.openapi)==null?void 0:ze.openIdConnectToken)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,openIdConnectToken:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"id-token"})]})]})]}),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",children:t("server.openapi.passthroughHeaders")}),e.jsx("input",{type:"text",value:(($e=l.openapi)==null?void 0:$e.passthroughHeaders)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,passthroughHeaders:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-API-Key, X-Custom-Header"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.openapi.passthroughHeadersHelp")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:P,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] btn-primary",children:"+"})]}),y.map((r,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:r.key,onChange:a=>K(s,"key",a.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:r.value,onChange:a=>K(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>U(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))]})]}):c==="sse"||c==="streamable-http"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"url",children:t("server.url")}),e.jsx("input",{type:"url",name:"url",id:"url",value:l.url,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:c==="streamable-http"?"e.g.: http://localhost:3000/mcp":"e.g.: http://localhost:3000/sse",required:c==="sse"||c==="streamable-http"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:P,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] btn-primary",children:"+"})]}),y.map((r,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:r.key,onChange:a=>K(s,"key",a.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:r.value,onChange:a=>K(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>U(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.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",children:t("server.openapi.passthroughHeaders")}),e.jsx("input",{type:"text",value:l.passthroughHeaders||"",onChange:r=>p(s=>({...s,passthroughHeaders:r.target.value})),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-Custom-User-Id"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.openapi.passthroughHeadersHelp")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:V,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] btn-primary",children:"+"})]}),g.map((r,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:r.key,onChange:a=>A(s,"key",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:r.value,onChange:a=>A(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>M(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 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>w(!v),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.oauth.sectionTitle")}),e.jsx("span",{className:"text-gray-500 text-sm",children:v?"▼":"▶"})]}),v&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.oauth.sectionDescription")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Re=l.oauth)==null?void 0:Re.clientId)||"",onChange:r=>q("clientId",r.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client id",autoComplete:"off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((Be=l.oauth)==null?void 0:Be.clientSecret)||"",onChange:r=>q("clientSecret",r.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client secret",autoComplete:"off"})]})]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"command",children:t("server.command")}),e.jsx("input",{type:"text",name:"command",id:"command",value:l.command,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: npx",required:c==="stdio"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"arguments",children:t("server.arguments")}),e.jsx("input",{type:"text",name:"arguments",id:"arguments",value:l.arguments,onChange:r=>De(r.target.value),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: -y time-mcp",required:c==="stdio"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:V,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] btn-primary",children:"+"})]}),g.map((r,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:r.key,onChange:a=>A(s,"key",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:r.value,onChange:a=>A(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>M(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))]})]}),c!=="openapi"&&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 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>C(!k),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.requestOptions")}),e.jsx("span",{className:"text-gray-500 text-sm",children:k?"▼":"▶"})]}),k&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"timeout",children:t("server.timeout")}),e.jsx("input",{type:"number",id:"timeout",value:((Xe=l.options)==null?void 0:Xe.timeout)||6e4,onChange:r=>O("timeout",parseInt(r.target.value)||6e4),className:"w-full py-2 px-3 form-input",placeholder:"30000",min:"1000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.timeoutDescription")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxTotalTimeout",children:t("server.maxTotalTimeout")}),e.jsx("input",{type:"number",id:"maxTotalTimeout",value:((Je=l.options)==null?void 0:Je.maxTotalTimeout)||"",onChange:r=>O("maxTotalTimeout",r.target.value?parseInt(r.target.value):void 0),className:"w-full py-2 px-3 form-input",placeholder:"Optional",min:"1000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.maxTotalTimeoutDescription")})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"checkbox",checked:((Ge=l.options)==null?void 0:Ge.resetTimeoutOnProgress)??!0,onChange:r=>O("resetTimeoutOnProgress",r.target.checked),className:"mr-2"}),e.jsx("span",{className:"text-gray-600 text-sm",children:t("server.resetTimeoutOnProgress")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 ml-6",children:t("server.resetTimeoutOnProgressDescription")})]})]})]}),(c==="sse"||c==="streamable-http")&&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 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Ye(!E),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.keepAlive","Keep-Alive")}),e.jsx("span",{className:"text-gray-500 text-sm",children:E?"▼":"▶"})]}),E&&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:((Le=l.keepAlive)==null?void 0:Le.enabled)||!1,onChange:r=>p(s=>({...s,keepAlive:{...s.keepAlive,enabled:r.target.checked}})),className:"mr-2"}),e.jsx("label",{htmlFor:"enableKeepAlive",className:"text-gray-600 text-sm",children:t("server.enableKeepAlive","Enable Keep-Alive")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.keepAliveDescription","Send periodic ping requests to maintain the connection. Useful for long-running connections that may timeout.")}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"keepAliveInterval",children:t("server.keepAliveInterval","Interval (ms)")}),e.jsx("input",{type:"number",id:"keepAliveInterval",value:((Qe=l.keepAlive)==null?void 0:Qe.interval)||6e4,onChange:r=>p(s=>({...s,keepAlive:{...s.keepAlive,interval:parseInt(r.target.value)||6e4}})),className:"w-full py-2 px-3 form-input",placeholder:"60000",min:"5000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.keepAliveIntervalDescription","Time between keep-alive pings in milliseconds (default: 60000ms = 1 minute)")})]})]})]}),e.jsxs("div",{className:"flex justify-end mt-6",children:[e.jsx("button",{type:"button",onClick:i,className:"hub-btn mr-2",children:t("server.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",children:t(Ze?"server.save":"server.add")})]})]})]})},ds=o=>{const i=new Set,n=/\$\{([^}]+)\}/g,h=t=>{let u;for(;(u=n.exec(t))!==null;)i.add(u[1])},m=(t,u="")=>{typeof t=="string"?h(t):Array.isArray(t)?t.forEach((x,d)=>m(x,`${u}[${d}]`)):t&&typeof t=="object"&&Object.entries(t).forEach(([x,d])=>{m(d,u?`${u}.${x}`:x)})};return m(o),Array.from(i)};export{cs as S,ds as d};
16
- //# sourceMappingURL=variableDetection-hIevXYOZ.js.map
16
+ //# sourceMappingURL=variableDetection-C_2zoP1B.js.map