@samanhappy/mcphub 0.12.14 → 0.12.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.fr.md +2 -0
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/controllers/authController.js +2 -2
- package/dist/controllers/authController.js.map +1 -1
- package/dist/controllers/bearerKeyController.js +1 -6
- package/dist/controllers/bearerKeyController.js.map +1 -1
- package/dist/controllers/configController.js +24 -4
- package/dist/controllers/configController.js.map +1 -1
- package/dist/controllers/oauthCallbackController.js +10 -5
- package/dist/controllers/oauthCallbackController.js.map +1 -1
- package/dist/controllers/oauthClientController.js +55 -3
- package/dist/controllers/oauthClientController.js.map +1 -1
- package/dist/controllers/serverController.js +119 -77
- package/dist/controllers/serverController.js.map +1 -1
- package/dist/controllers/userController.js +0 -6
- package/dist/controllers/userController.js.map +1 -1
- package/dist/middlewares/auth.js +23 -4
- package/dist/middlewares/auth.js.map +1 -1
- package/dist/middlewares/userContext.js +66 -47
- package/dist/middlewares/userContext.js.map +1 -1
- package/dist/routes/index.js +100 -97
- package/dist/routes/index.js.map +1 -1
- package/dist/server.js +17 -12
- package/dist/server.js.map +1 -1
- package/dist/services/groupService.js +20 -5
- package/dist/services/groupService.js.map +1 -1
- package/dist/services/sseService.js +14 -1
- package/dist/services/sseService.js.map +1 -1
- package/dist/services/userContextService.js +18 -25
- package/dist/services/userContextService.js.map +1 -1
- package/dist/utils/proxyTrust.js +20 -0
- package/dist/utils/proxyTrust.js.map +1 -0
- package/frontend/dist/assets/{index-BXnenfU5.js → index-CVDuCISB.js} +5 -5
- package/frontend/dist/assets/{index-BXnenfU5.js.map → index-CVDuCISB.js.map} +1 -1
- package/frontend/dist/assets/{resourceService-BWgF7k0a.js → resourceService-CUz722Nb.js} +2 -2
- package/frontend/dist/assets/{resourceService-BWgF7k0a.js.map → resourceService-CUz722Nb.js.map} +1 -1
- package/frontend/dist/index.html +1 -1
- package/package.json +2 -2
|
@@ -227,13 +227,13 @@ Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}
|
|
|
227
227
|
*
|
|
228
228
|
* This source code is licensed under the ISC license.
|
|
229
229
|
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const qw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ma=et("x",qw);function k0(a){var n,l,o="";if(typeof a=="string"||typeof a=="number")o+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(n=0;n<c;n++)a[n]&&(l=k0(a[n]))&&(o&&(o+=" "),o+=l)}else for(l in a)a[l]&&(o&&(o+=" "),o+=l);return o}function Gw(){for(var a,n,l=0,o="",c=arguments.length;l<c;l++)(a=arguments[l])&&(n=k0(a))&&(o&&(o+=" "),o+=n);return o}const zd="-",Kw=a=>{const n=$w(a),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=a;return{getClassGroupId:m=>{const g=m.split(zd);return g[0]===""&&g.length!==1&&g.shift(),C0(g,n)||Vw(m)},getConflictingClassGroupIds:(m,g)=>{const f=l[m]||[];return g&&o[m]?[...f,...o[m]]:f}}},C0=(a,n)=>{var m;if(a.length===0)return n.classGroupId;const l=a[0],o=n.nextPart.get(l),c=o?C0(a.slice(1),o):void 0;if(c)return c;if(n.validators.length===0)return;const u=a.join(zd);return(m=n.validators.find(({validator:g})=>g(u)))==null?void 0:m.classGroupId},ah=/^\[(.+)\]$/,Vw=a=>{if(ah.test(a)){const n=ah.exec(a)[1],l=n==null?void 0:n.substring(0,n.indexOf(":"));if(l)return"arbitrary.."+l}},$w=a=>{const{theme:n,classGroups:l}=a,o={nextPart:new Map,validators:[]};for(const c in l)md(l[c],o,c,n);return o},md=(a,n,l,o)=>{a.forEach(c=>{if(typeof c=="string"){const u=c===""?n:sh(n,c);u.classGroupId=l;return}if(typeof c=="function"){if(Yw(c)){md(c(o),n,l,o);return}n.validators.push({validator:c,classGroupId:l});return}Object.entries(c).forEach(([u,m])=>{md(m,sh(n,u),l,o)})})},sh=(a,n)=>{let l=a;return n.split(zd).forEach(o=>{l.nextPart.has(o)||l.nextPart.set(o,{nextPart:new Map,validators:[]}),l=l.nextPart.get(o)}),l},Yw=a=>a.isThemeGetter,Jw=a=>{if(a<1)return{get:()=>{},set:()=>{}};let n=0,l=new Map,o=new Map;const c=(u,m)=>{l.set(u,m),n++,n>a&&(n=0,o=l,l=new Map)};return{get(u){let m=l.get(u);if(m!==void 0)return m;if((m=o.get(u))!==void 0)return c(u,m),m},set(u,m){l.has(u)?l.set(u,m):c(u,m)}}},pd="!",gd=":",Qw=gd.length,Xw=a=>{const{prefix:n,experimentalParseClassName:l}=a;let o=c=>{const u=[];let m=0,g=0,f=0,h;for(let S=0;S<c.length;S++){let j=c[S];if(m===0&&g===0){if(j===gd){u.push(c.slice(f,S)),f=S+Qw;continue}if(j==="/"){h=S;continue}}j==="["?m++:j==="]"?m--:j==="("?g++:j===")"&&g--}const b=u.length===0?c:c.substring(f),y=Zw(b),w=y!==b,N=h&&h>f?h-f:void 0;return{modifiers:u,hasImportantModifier:w,baseClassName:y,maybePostfixModifierPosition:N}};if(n){const c=n+gd,u=o;o=m=>m.startsWith(c)?u(m.substring(c.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:m,maybePostfixModifierPosition:void 0}}if(l){const c=o;o=u=>l({className:u,parseClassName:c})}return o},Zw=a=>a.endsWith(pd)?a.substring(0,a.length-1):a.startsWith(pd)?a.substring(1):a,Ww=a=>{const n=Object.fromEntries(a.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const c=[];let u=[];return o.forEach(m=>{m[0]==="["||n[m]?(c.push(...u.sort(),m),u=[]):u.push(m)}),c.push(...u.sort()),c}},ej=a=>({cache:Jw(a.cacheSize),parseClassName:Xw(a),sortModifiers:Ww(a),...Kw(a)}),tj=/\s+/,rj=(a,n)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:u}=n,m=[],g=a.trim().split(tj);let f="";for(let h=g.length-1;h>=0;h-=1){const b=g[h],{isExternal:y,modifiers:w,hasImportantModifier:N,baseClassName:S,maybePostfixModifierPosition:j}=l(b);if(y){f=b+(f.length>0?" "+f:f);continue}let C=!!j,z=o(C?S.substring(0,j):S);if(!z){if(!C){f=b+(f.length>0?" "+f:f);continue}if(z=o(S),!z){f=b+(f.length>0?" "+f:f);continue}C=!1}const E=u(w).join(":"),T=N?E+pd:E,B=T+z;if(m.includes(B))continue;m.push(B);const D=c(z,C);for(let Y=0;Y<D.length;++Y){const R=D[Y];m.push(T+R)}f=b+(f.length>0?" "+f:f)}return f};function aj(){let a=0,n,l,o="";for(;a<arguments.length;)(n=arguments[a++])&&(l=A0(n))&&(o&&(o+=" "),o+=l);return o}const A0=a=>{if(typeof a=="string")return a;let n,l="";for(let o=0;o<a.length;o++)a[o]&&(n=A0(a[o]))&&(l&&(l+=" "),l+=n);return l};function sj(a,...n){let l,o,c,u=m;function m(f){const h=n.reduce((b,y)=>y(b),a());return l=ej(h),o=l.cache.get,c=l.cache.set,u=g,g(f)}function g(f){const h=o(f);if(h)return h;const b=rj(f,l);return c(f,b),b}return function(){return u(aj.apply(null,arguments))}}const Ut=a=>{const n=l=>l[a]||[];return n.isThemeGetter=!0,n},E0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,R0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nj=/^\d+\/\d+$/,lj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ij=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cj=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xn=a=>nj.test(a),Fe=a=>!!a&&!Number.isNaN(Number(a)),is=a=>!!a&&Number.isInteger(Number(a)),Xu=a=>a.endsWith("%")&&Fe(a.slice(0,-1)),Ea=a=>lj.test(a),dj=()=>!0,mj=a=>ij.test(a)&&!oj.test(a),T0=()=>!1,pj=a=>cj.test(a),gj=a=>uj.test(a),fj=a=>!Ae(a)&&!Ee(a),hj=a=>Tn(a,M0,T0),Ae=a=>E0.test(a),Rs=a=>Tn(a,P0,mj),Zu=a=>Tn(a,wj,Fe),nh=a=>Tn(a,O0,T0),xj=a=>Tn(a,z0,gj),Wi=a=>Tn(a,D0,pj),Ee=a=>R0.test(a),Cl=a=>On(a,P0),yj=a=>On(a,jj),lh=a=>On(a,O0),bj=a=>On(a,M0),vj=a=>On(a,z0),eo=a=>On(a,D0,!0),Tn=(a,n,l)=>{const o=E0.exec(a);return o?o[1]?n(o[1]):l(o[2]):!1},On=(a,n,l=!1)=>{const o=R0.exec(a);return o?o[1]?n(o[1]):l:!1},O0=a=>a==="position"||a==="percentage",z0=a=>a==="image"||a==="url",M0=a=>a==="length"||a==="size"||a==="bg-size",P0=a=>a==="length",wj=a=>a==="number",jj=a=>a==="family-name",D0=a=>a==="shadow",Sj=()=>{const a=Ut("color"),n=Ut("font"),l=Ut("text"),o=Ut("font-weight"),c=Ut("tracking"),u=Ut("leading"),m=Ut("breakpoint"),g=Ut("container"),f=Ut("spacing"),h=Ut("radius"),b=Ut("shadow"),y=Ut("inset-shadow"),w=Ut("text-shadow"),N=Ut("drop-shadow"),S=Ut("blur"),j=Ut("perspective"),C=Ut("aspect"),z=Ut("ease"),E=Ut("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...B(),Ee,Ae],Y=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],_=()=>[Ee,Ae,f],P=()=>[xn,"full","auto",..._()],V=()=>[is,"none","subgrid",Ee,Ae],K=()=>["auto",{span:["full",is,Ee,Ae]},is,Ee,Ae],G=()=>[is,"auto",Ee,Ae],I=()=>["auto","min","max","fr",Ee,Ae],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",..._()],H=()=>[xn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],J=()=>[a,Ee,Ae],me=()=>[...B(),lh,nh,{position:[Ee,Ae]}],le=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",bj,hj,{size:[Ee,Ae]}],U=()=>[Xu,Cl,Rs],M=()=>["","none","full",h,Ee,Ae],q=()=>["",Fe,Cl,Rs],de=()=>["solid","dashed","dotted","double"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Fe,Xu,lh,nh],he=()=>["","none",S,Ee,Ae],se=()=>["none",Fe,Ee,Ae],ye=()=>["none",Fe,Ee,Ae],ie=()=>[Fe,Ee,Ae],ae=()=>[xn,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ea],breakpoint:[Ea],color:[dj],container:[Ea],"drop-shadow":[Ea],ease:["in","out","in-out"],font:[fj],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ea],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ea],shadow:[Ea],spacing:["px",Fe],text:[Ea],"text-shadow":[Ea],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xn,Ae,Ee,C]}],container:["container"],columns:[{columns:[Fe,Ae,Ee,g]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[is,"auto",Ee,Ae]}],basis:[{basis:[xn,"full","auto",g,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,xn,"auto","initial","none",Ae]}],grow:[{grow:["",Fe,Ee,Ae]}],shrink:[{shrink:["",Fe,Ee,Ae]}],order:[{order:[is,"first","last","none",Ee,Ae]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[g,"screen",...H()]}],"min-w":[{"min-w":[g,"screen","none",...H()]}],"max-w":[{"max-w":[g,"screen","none","prose",{screen:[m]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",l,Cl,Rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Ee,Zu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xu,Ae]}],"font-family":[{font:[yj,Ae,n]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Ee,Ae]}],"line-clamp":[{"line-clamp":[Fe,"none",Ee,Zu]}],leading:[{leading:[u,..._()]}],"list-image":[{"list-image":["none",Ee,Ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,Ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Ee,Rs]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[Fe,"auto",Ee,Ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:me()}],"bg-repeat":[{bg:le()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},is,Ee,Ae],radial:["",Ee,Ae],conic:[is,Ee,Ae]},vj,xj]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Ee,Ae]}],"outline-w":[{outline:["",Fe,Cl,Rs]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",b,eo,Wi]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",y,eo,Wi]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[Fe,Rs]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",w,eo,Wi]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[Fe,Ee,Ae]}],"mix-blend":[{"mix-blend":[...ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[Ee,Ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":B()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:me()}],"mask-repeat":[{mask:le()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ee,Ae]}],filter:[{filter:["","none",Ee,Ae]}],blur:[{blur:he()}],brightness:[{brightness:[Fe,Ee,Ae]}],contrast:[{contrast:[Fe,Ee,Ae]}],"drop-shadow":[{"drop-shadow":["","none",N,eo,Wi]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",Fe,Ee,Ae]}],"hue-rotate":[{"hue-rotate":[Fe,Ee,Ae]}],invert:[{invert:["",Fe,Ee,Ae]}],saturate:[{saturate:[Fe,Ee,Ae]}],sepia:[{sepia:["",Fe,Ee,Ae]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,Ae]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Ee,Ae]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Ee,Ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Ee,Ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Ee,Ae]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Ee,Ae]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Ee,Ae]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Ee,Ae]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Ee,Ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,Ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Ee,Ae]}],ease:[{ease:["linear","initial",z,Ee,Ae]}],delay:[{delay:[Fe,Ee,Ae]}],animate:[{animate:["none",E,Ee,Ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ee,Ae]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Ee,Ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ee,Ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ee,Ae]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[Fe,Cl,Rs,Zu]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Nj=sj(Sj);function la(...a){return Nj(Gw(a))}const kj=({message:a,type:n="info",duration:l=3e3,onClose:o,visible:c})=>{const{t:u}=ve();x.useEffect(()=>{if(c){const b=setTimeout(()=>{o()},l);return()=>clearTimeout(b)}},[c,l,o]);const m={success:t.jsx(za,{className:"w-5 h-5 text-green-500"}),error:t.jsx(Ma,{className:"w-5 h-5 text-red-500"}),info:t.jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),warning:t.jsx("svg",{className:"w-5 h-5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})},g={success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",info:"bg-blue-50 border-blue-200",warning:"bg-yellow-50 border-yellow-200"},f={success:"text-green-800",error:"text-red-800",info:"text-blue-800",warning:"text-yellow-800"},h={success:"border-l-4 border-l-green-500",error:"border-l-4 border-l-red-600",info:"border-l-4 border-l-blue-500",warning:"border-l-4 border-l-yellow-500"};return t.jsx("div",{className:la("fixed top-4 right-4 z-50 max-w-sm p-4 rounded-md shadow-lg border",g[n],h[n],"transform transition-all duration-300 ease-in-out",c?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:m[n]}),t.jsx("div",{className:"ml-3",children:t.jsx("p",{className:la("text-sm font-medium",f[n]),children:a})}),t.jsx("div",{className:"ml-auto pl-3",children:t.jsx("div",{className:"-mx-1.5 -my-1.5",children:t.jsxs("button",{onClick:o,className:la("inline-flex rounded-md p-1.5",`hover:bg-${n}-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${n}-500`),children:[t.jsx("span",{className:"sr-only",children:u("common.dismiss")}),t.jsx(Ma,{className:"h-5 w-5"})]})})})]})})},L0=x.createContext(void 0),Pa=()=>{const a=x.useContext(L0);if(!a)throw new Error("useToast must be used within a ToastProvider");return a},Cj=({children:a})=>{const[n,l]=x.useState({message:"",type:"info",visible:!1,duration:3e3}),o=x.useCallback((u,m="info",g=3e3)=>{l({message:u,type:m,visible:!0,duration:g})},[]),c=x.useCallback(()=>{l(u=>({...u,visible:!1}))},[]);return t.jsxs(L0.Provider,{value:{showToast:o},children:[a,t.jsx(kj,{message:n.message,type:n.type,duration:n.duration,onClose:c,visible:n.visible})]})},U0=x.createContext(void 0),Aj=()=>{const a=x.useContext(U0);if(!a)throw new Error("useTheme must be used within a ThemeProvider");return a},Ej=({children:a})=>{const[n,l]=x.useState(()=>localStorage.getItem("theme")||"system"),[o,c]=x.useState("light"),u=m=>{l(m),localStorage.setItem("theme",m)};return x.useEffect(()=>{const m=()=>{const f=window.document.documentElement,h=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",b=n==="system"?h:n;c(b),b==="dark"?(console.log("Applying dark mode to HTML root element"),f.classList.add("dark"),document.body.style.backgroundColor="#111827"):(console.log("Removing dark mode from HTML root element"),f.classList.remove("dark"),document.body.style.backgroundColor="")},g=window.matchMedia("(prefers-color-scheme: dark)");return g.addEventListener("change",m),m(),()=>{g.removeEventListener("change",m)}},[n]),t.jsx(U0.Provider,{value:{theme:n,setTheme:u,resolvedTheme:o},children:a})},_0="mcphub_servers_per_page",mo=5,B0=new Set([5,10,20,50]),Rj=()=>{if(typeof window>"u")return mo;const a=window.localStorage.getItem(_0);if(!a)return mo;const n=Number(a);return B0.has(n)?n:mo},to={startup:{maxAttempts:60,pollingInterval:3e3},normal:{pollingInterval:1e4}},I0=x.createContext(void 0),Tj=({children:a})=>{const{t:n}=ve(),{auth:l}=ca(),[o,c]=x.useState([]),[u,m]=x.useState([]),[g,f]=x.useState(null),[h,b]=x.useState(0),[y,w]=x.useState(!0),[N,S]=x.useState(0),[j,C]=x.useState(null),[z,E]=x.useState(1),[T,B]=x.useState(Rj),D=x.useRef(null),Y=x.useRef(0),R=x.useRef(0),_=3e3,P=()=>{D.current&&(clearInterval(D.current),D.current=null)},V=x.useCallback(k=>{const U=(k==null?void 0:k.immediate)??!0;P();const M=async()=>{try{console.log("[ServerContext] Fetching servers from API...");const q=new URLSearchParams;q.append("page",z.toString()),q.append("limit",T.toString());const[de,ee]=await Promise.all([Be(`/servers?${q.toString()}`),Be("/servers")]);R.current=Date.now(),de&&de.success&&Array.isArray(de.data)?(c(de.data),de.pagination?C(de.pagination):C(null)):de&&Array.isArray(de)?(c(de),C(null)):(console.error("Invalid server data format",{paginatedData:de}),c([]),C(null)),ee&&ee.success&&Array.isArray(ee.data)?m(ee.data):ee&&Array.isArray(ee)?m(ee):m([]),f(null)}catch(q){console.error("Error fetching servers during normal polling",{err:q}),navigator.onLine?q instanceof TypeError&&(q.message.includes("NetworkError")||q.message.includes("Failed to fetch"))?f(n("errors.serverConnection")):f(n("errors.serverFetch")):f(n("errors.network"))}};U&&M(),D.current=setInterval(M,to.normal.pollingInterval)},[n,z,T]);x.useEffect(()=>{l.isAuthenticated?(console.log("[ServerContext] User authenticated, triggering refresh"),b(k=>k+1)):(console.log("[ServerContext] User not authenticated, clearing data and stopping polling"),P(),c([]),m([]),w(!1),f(null))},[l.isAuthenticated]),x.useEffect(()=>{if(!l.isAuthenticated){console.log("[ServerContext] User not authenticated, skipping polling setup");return}h>0&&(Y.current=0,S(0));const k=async()=>{try{console.log("[ServerContext] Initial fetch - attempt",Y.current+1);const U=new URLSearchParams;U.append("page",z.toString()),U.append("limit",T.toString());const[M,q]=await Promise.all([Be(`/servers?${U.toString()}`),Be("/servers")]);return R.current=Date.now(),M&&M.success&&Array.isArray(M.data)?(c(M.data),M.pagination?C(M.pagination):C(null)):M&&Array.isArray(M)?(c(M),C(null)):(console.error("Invalid server data format",{paginatedData:M}),c([]),C(null)),q&&q.success&&Array.isArray(q.data)?m(q.data):q&&Array.isArray(q)?m(q):m([]),w(!1),V({immediate:!1}),!0}catch(U){return Y.current+=1,console.error("Initial loading attempt failed",{attempt:Y.current,err:U}),S(Y.current),navigator.onLine?f(n("errors.initialStartup")):f(n("errors.network")),Y.current>=to.startup.maxAttempts&&(console.log("Maximum startup attempts reached, switching to normal polling"),w(!1),P(),V()),!1}};return y?(P(),k(),D.current=setInterval(k,to.startup.pollingInterval),console.log(`Started initial polling with interval: ${to.startup.pollingInterval}ms`)):V(),()=>{P()}},[h,n,y,V,z,T]),x.useEffect(()=>{if(!j)return;const k=Math.max(1,j.totalPages||1);z>k&&E(k)},[j,z]);const K=x.useCallback(()=>{P(),y&&(w(!0),Y.current=0,S(0)),b(k=>k+1)},[y]),G=x.useCallback(()=>{const U=Date.now()-R.current;console.log("[ServerContext] refreshIfNeeded called",{timeSinceLastFetch:U}),U>=_?(console.log("[ServerContext] Triggering refresh after minimum interval",{minRefreshInterval:_}),K()):console.log("[ServerContext] Skipping refresh because minimum interval not reached",{minRefreshInterval:_,timeSinceLastFetch:U})},[K]),I=x.useCallback(()=>{b(k=>k+1)},[]),L=x.useCallback(async k=>{try{const U=encodeURIComponent(k.name),M=await Be(`/servers/${U}`);return M&&M.success&&M.data?{name:M.data.name,status:M.data.status,tools:M.data.tools||[],config:M.data.config}:(console.error("Failed to get server config",{serverName:k.name,serverData:M}),f(n("server.invalidConfig",{serverName:k.name})),null)}catch(U){return console.error("Error fetching server config",{serverName:k.name,err:U}),f(U instanceof Error?U.message:String(U)),null}},[n]),Z=x.useCallback(async k=>{try{const U=encodeURIComponent(k),M=await Yr(`/servers/${U}`);return!M||!M.success?(f((M==null?void 0:M.message)||n("server.deleteError",{serverName:k})),!1):(b(q=>q+1),!0)}catch(U){return f(n("errors.general")+": "+(U instanceof Error?U.message:String(U))),!1}},[n]),A=x.useCallback(async(k,U)=>{try{const M=encodeURIComponent(k.name),q=await pt(`/servers/${M}/toggle`,{enabled:U});return!q||!q.success?(console.error("Failed to toggle server",{serverName:k.name,result:q}),f((q==null?void 0:q.message)||n("server.toggleError",{serverName:k.name})),!1):(b(de=>de+1),!0)}catch(M){return console.error("Error toggling server",{serverName:k.name,err:M}),f(M instanceof Error?M.message:String(M)),!1}},[n]),H=x.useCallback(async k=>{try{const U=encodeURIComponent(k.name),M=await pt(`/servers/${U}/reload`,{});return!M||!M.success?(console.error("Failed to reload server",{serverName:k.name,result:M}),f(n("server.reloadError",{serverName:k.name})),!1):(K(),!0)}catch(U){return console.error("Error reloading server",{serverName:k.name,err:U}),f(U instanceof Error?U.message:String(U)),!1}},[n,K]),J=x.useCallback(k=>{E(k)},[]),me=x.useCallback(k=>{const U=B0.has(k)?k:mo;typeof window<"u"&&window.localStorage.setItem(_0,String(U)),B(U),E(1)},[]),le={servers:o,allServers:u,error:g,setError:f,isLoading:y,fetchAttempts:N,pagination:j,currentPage:z,serversPerPage:T,setCurrentPage:J,setServersPerPage:me,triggerRefresh:K,refreshIfNeeded:G,handleServerAdd:I,handleServerEdit:L,handleServerRemove:Z,handleServerToggle:A,handleServerReload:H};return t.jsx(I0.Provider,{value:le,children:a})},F0=()=>{const a=x.useContext(I0);if(a===void 0)throw new Error("useServerContext must be used within a ServerProvider");return a},Wu=()=>({enabled:!0,accessTokenLifetime:3600,refreshTokenLifetime:1209600,authorizationCodeLifetime:300,requireClientSecret:!1,allowedScopes:["read","write"],requireState:!1,dynamicRegistration:{enabled:!0,allowedGrantTypes:["authorization_code","refresh_token"],requiresAuthentication:!1}}),H0=x.createContext(void 0),Oj=()=>{const a=x.useContext(H0);if(!a)throw new Error("useSettings must be used within a SettingsProvider");return a},zj=({children:a})=>{const{t:n}=ve(),{showToast:l}=Pa(),{auth:o}=ca(),[c,u]=x.useState({enableGlobalRoute:!0,enableGroupNameRoute:!0,enableBearerAuth:!0,bearerAuthKey:"",bearerAuthHeaderName:"Authorization",jsonBodyLimit:"1mb",skipAuth:!1}),[m,g]=x.useState({bearerAuthKey:"",bearerAuthHeaderName:"Authorization",jsonBodyLimit:"1mb"}),[f,h]=x.useState({pythonIndexUrl:"",npmRegistry:"",baseUrl:"http://localhost:3000"}),[b,y]=x.useState({enabled:!1,dbUrl:"",basePacingDelayMs:void 0,embeddingProvider:"openai",embeddingEncodingFormat:"auto",openaiApiBaseUrl:"",openaiApiKey:"",openaiApiEmbeddingModel:"",azureOpenaiEndpoint:"",azureOpenaiApiKey:"",azureOpenaiApiVersion:"",azureOpenaiEmbeddingDeployment:"",progressiveDisclosure:!1,embeddingMaxTokens:void 0}),[w,N]=x.useState({apiKey:"",referer:"https://www.mcphub.app",title:"MCPHub",baseUrl:"https://api.mcprouter.to/v1"}),[S,j]=x.useState(Wu()),[C,z]=x.useState("-"),[E,T]=x.useState(!1),[B,D]=x.useState([]),[Y,R]=x.useState(!1),[_,P]=x.useState(null),[V,K]=x.useState(0),G=x.useCallback(()=>{K(ie=>ie+1)},[]),I=x.useCallback(async()=>{var ie,ae,be,Ne,xe,ke,Se,Le,at,gt,Mt,Pt,Nr,ft,kr,tr,Qt,ht;R(!0),P(null);try{const Re=await Be("/settings");if(Re.success&&((ae=(ie=Re.data)==null?void 0:ie.systemConfig)!=null&&ae.routing)&&u({enableGlobalRoute:Re.data.systemConfig.routing.enableGlobalRoute??!0,enableGroupNameRoute:Re.data.systemConfig.routing.enableGroupNameRoute??!0,enableBearerAuth:Re.data.systemConfig.routing.enableBearerAuth??!0,bearerAuthKey:Re.data.systemConfig.routing.bearerAuthKey||"",bearerAuthHeaderName:Re.data.systemConfig.routing.bearerAuthHeaderName||"Authorization",jsonBodyLimit:Re.data.systemConfig.routing.jsonBodyLimit||"1mb",skipAuth:Re.data.systemConfig.routing.skipAuth??!1}),Re.success&&((Ne=(be=Re.data)==null?void 0:be.systemConfig)!=null&&Ne.install)&&h({pythonIndexUrl:Re.data.systemConfig.install.pythonIndexUrl||"",npmRegistry:Re.data.systemConfig.install.npmRegistry||"",baseUrl:Re.data.systemConfig.install.baseUrl||"http://localhost:3000"}),Re.success&&((ke=(xe=Re.data)==null?void 0:xe.systemConfig)!=null&&ke.smartRouting)&&y({enabled:Re.data.systemConfig.smartRouting.enabled??!1,dbUrl:Re.data.systemConfig.smartRouting.dbUrl||"",basePacingDelayMs:Re.data.systemConfig.smartRouting.basePacingDelayMs,embeddingProvider:Re.data.systemConfig.smartRouting.embeddingProvider==="azure_openai"?"azure_openai":"openai",embeddingEncodingFormat:Re.data.systemConfig.smartRouting.embeddingEncodingFormat==="base64"?"base64":Re.data.systemConfig.smartRouting.embeddingEncodingFormat==="float"?"float":"auto",openaiApiBaseUrl:Re.data.systemConfig.smartRouting.openaiApiBaseUrl||"",openaiApiKey:Re.data.systemConfig.smartRouting.openaiApiKey||"",openaiApiEmbeddingModel:Re.data.systemConfig.smartRouting.openaiApiEmbeddingModel||"",azureOpenaiEndpoint:Re.data.systemConfig.smartRouting.azureOpenaiEndpoint||"",azureOpenaiApiKey:Re.data.systemConfig.smartRouting.azureOpenaiApiKey||"",azureOpenaiApiVersion:Re.data.systemConfig.smartRouting.azureOpenaiApiVersion||"",azureOpenaiEmbeddingDeployment:Re.data.systemConfig.smartRouting.azureOpenaiEmbeddingDeployment||"",progressiveDisclosure:Re.data.systemConfig.smartRouting.progressiveDisclosure??!1,embeddingMaxTokens:Re.data.systemConfig.smartRouting.embeddingMaxTokens}),Re.success&&((Le=(Se=Re.data)==null?void 0:Se.systemConfig)!=null&&Le.mcpRouter)&&N({apiKey:Re.data.systemConfig.mcpRouter.apiKey||"",referer:Re.data.systemConfig.mcpRouter.referer||"https://www.mcphub.app",title:Re.data.systemConfig.mcpRouter.title||"MCPHub",baseUrl:Re.data.systemConfig.mcpRouter.baseUrl||"https://api.mcprouter.to/v1"}),Re.success)if((gt=(at=Re.data)==null?void 0:at.systemConfig)!=null&>.oauthServer){const Oe=Re.data.systemConfig.oauthServer,it=Wu(),qt=it.dynamicRegistration,Gt=Array.isArray(Oe.allowedScopes)?[...Oe.allowedScopes]:[...it.allowedScopes],ot=Array.isArray((Mt=Oe.dynamicRegistration)==null?void 0:Mt.allowedGrantTypes)?[...Oe.dynamicRegistration.allowedGrantTypes]:[...qt.allowedGrantTypes];j({enabled:Oe.enabled??it.enabled,accessTokenLifetime:Oe.accessTokenLifetime??it.accessTokenLifetime,refreshTokenLifetime:Oe.refreshTokenLifetime??it.refreshTokenLifetime,authorizationCodeLifetime:Oe.authorizationCodeLifetime??it.authorizationCodeLifetime,requireClientSecret:Oe.requireClientSecret??it.requireClientSecret,requireState:Oe.requireState??it.requireState,allowedScopes:Gt,dynamicRegistration:{enabled:((Pt=Oe.dynamicRegistration)==null?void 0:Pt.enabled)??qt.enabled,allowedGrantTypes:ot,requiresAuthentication:((Nr=Oe.dynamicRegistration)==null?void 0:Nr.requiresAuthentication)??qt.requiresAuthentication}})}else j(Wu());Re.success&&((kr=(ft=Re.data)==null?void 0:ft.systemConfig)==null?void 0:kr.nameSeparator)!==void 0&&z(Re.data.systemConfig.nameSeparator),Re.success&&((Qt=(tr=Re.data)==null?void 0:tr.systemConfig)==null?void 0:Qt.enableSessionRebuild)!==void 0&&T(Re.data.systemConfig.enableSessionRebuild),Re.success&&Array.isArray((ht=Re.data)==null?void 0:ht.bearerKeys)&&D(Re.data.bearerKeys)}catch(Re){console.error("Failed to fetch settings",{error:Re}),P(Re instanceof Error?Re.message:"Failed to fetch settings"),l(n("errors.failedToFetchSettings"))}finally{R(!1)}},[n,l]),L=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{routing:{[ie]:ae}});return be.success?(u({...c,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update routing config"),l(be.error||n("errors.failedToUpdateRoutingConfig")),!1)}catch(be){return console.error("Failed to update routing config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update routing config"),l(n("errors.failedToUpdateRoutingConfig")),!1}finally{R(!1)}},Z=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{install:{[ie]:ae}});return be.success?(h({...f,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update install config"),l(be.error||n("errors.failedToUpdateInstallConfig")),!1)}catch(be){return console.error("Failed to update install config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update install config"),l(n("errors.failedToUpdateInstallConfig")),!1}finally{R(!1)}},A=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{smartRouting:{[ie]:ae}});return be.success?(y({...b,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update smart routing config"),l(be.error||n("errors.failedToUpdateSmartRoutingConfig")),!1)}catch(be){return console.error("Failed to update smart routing config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update smart routing config"),l(n("errors.failedToUpdateSmartRoutingConfig")),!1}finally{R(!1)}},H=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{smartRouting:ie});return ae.success?(y({...b,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update smart routing config"),l(ae.error||n("errors.failedToUpdateSmartRoutingConfig")),!1)}catch(ae){return console.error("Failed to batch update smart routing config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update smart routing config"),l(n("errors.failedToUpdateSmartRoutingConfig")),!1}finally{R(!1)}},J=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{routing:ie});return ae.success?(u({...c,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update routing config"),l(ae.error||n("errors.failedToUpdateRoutingConfig")),!1)}catch(ae){return console.error("Failed to batch update routing config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update routing config"),l(n("errors.failedToUpdateRoutingConfig")),!1}finally{R(!1)}},me=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{mcpRouter:{[ie]:ae}});return be.success?(N({...w,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update MCP Router config"),l(be.error||n("errors.failedToUpdateMCPRouterConfig")),!1)}catch(be){return console.error("Failed to update MCP Router config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update MCP Router config"),l(n("errors.failedToUpdateMCPRouterConfig")),!1}finally{R(!1)}},le=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{mcpRouter:ie});return ae.success?(N({...w,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update MCP Router config"),l(ae.error||n("errors.failedToUpdateMCPRouterConfig")),!1)}catch(ae){return console.error("Failed to batch update MCP Router config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update MCP Router config"),l(n("errors.failedToUpdateMCPRouterConfig")),!1}finally{R(!1)}},k=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{oauthServer:{[ie]:ae}});return be.success?(j({...S,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update OAuth server config"),l(be.error||n("errors.failedToUpdateOAuthServerConfig")),!1)}catch(be){return console.error("Failed to update OAuth server config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update OAuth server config"),l(n("errors.failedToUpdateOAuthServerConfig")),!1}finally{R(!1)}},U=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{oauthServer:ie});return ae.success?(j({...S,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update OAuth server config"),l(ae.error||n("errors.failedToUpdateOAuthServerConfig")),!1)}catch(ae){return console.error("Failed to batch update OAuth server config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update OAuth server config"),l(n("errors.failedToUpdateOAuthServerConfig")),!1}finally{R(!1)}},M=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{nameSeparator:ie});return ae.success?(z(ie),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update name separator"),l(ae.error||n("errors.failedToUpdateNameSeparator")),!1)}catch(ae){return console.error("Failed to update name separator",{value:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update name separator"),l(n("errors.failedToUpdateNameSeparator")),!1}finally{R(!1)}},q=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{enableSessionRebuild:ie});return ae.success?(T(ie),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update session rebuild setting"),l(ae.error||n("errors.failedToUpdateSessionRebuild")),!1)}catch(ae){return console.error("Failed to update session rebuild setting",{value:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update session rebuild setting"),l(n("errors.failedToUpdateSessionRebuild")),!1}finally{R(!1)}},de=async ie=>{R(!0),P(null);try{return await Be(`/mcp-settings/export?serverName=${ie||""}`)}catch(ae){console.error("Failed to export MCP settings",{serverName:ie,error:ae});const be=ae instanceof Error?ae.message:"Failed to export MCP settings";P(be),l(be)}finally{R(!1)}},ee=async()=>{try{const ie=await Be("/auth/keys");ie.success&&Array.isArray(ie.data)&&D(ie.data)}catch(ie){console.error("Failed to refresh bearer keys",{error:ie}),l(n("errors.failedToFetchSettings"))}},X=async ie=>{try{const ae=await pt("/auth/keys",ie);return ae.success&&ae.data?(await ee(),l(n("settings.systemConfigUpdated")),ae.data):(l(ae.message||n("errors.failedToUpdateRoutingConfig")),null)}catch(ae){return console.error("Failed to create bearer key",{error:ae}),l(n("errors.failedToUpdateRoutingConfig")),null}},he=async(ie,ae)=>{try{const be=await At(`/auth/keys/${ie}`,ae);return be.success&&be.data?(await ee(),l(n("settings.systemConfigUpdated")),be.data):(l(be.message||n("errors.failedToUpdateRoutingConfig")),null)}catch(be){return console.error("Failed to update bearer key",{id:ie,error:be}),l(n("errors.failedToUpdateRoutingConfig")),null}},se=async ie=>{try{const ae=await Yr(`/auth/keys/${ie}`);return ae.success?(await ee(),l(n("settings.systemConfigUpdated")),!0):(l(ae.message||n("errors.failedToUpdateRoutingConfig")),!1)}catch(ae){return console.error("Failed to delete bearer key",{id:ie,error:ae}),l(n("errors.failedToUpdateRoutingConfig")),!1}};x.useEffect(()=>{I()},[I,V]),x.useEffect(()=>{o.isAuthenticated&&(console.log("[SettingsContext] User authenticated, triggering settings refresh"),G())},[o.isAuthenticated,G]),x.useEffect(()=>{c&&g({bearerAuthKey:c.bearerAuthKey,bearerAuthHeaderName:c.bearerAuthHeaderName,jsonBodyLimit:c.jsonBodyLimit})},[c]);const ye={routingConfig:c,tempRoutingConfig:m,setTempRoutingConfig:g,installConfig:f,smartRoutingConfig:b,mcpRouterConfig:w,oauthServerConfig:S,nameSeparator:C,enableSessionRebuild:E,bearerKeys:B,loading:Y,error:_,setError:P,triggerRefresh:G,fetchSettings:I,updateRoutingConfig:L,updateInstallConfig:Z,updateSmartRoutingConfig:A,updateSmartRoutingConfigBatch:H,updateRoutingConfigBatch:J,updateMCPRouterConfig:me,updateMCPRouterConfigBatch:le,updateOAuthServerConfig:k,updateOAuthServerConfigBatch:U,updateNameSeparator:M,updateSessionRebuild:q,exportMCPSettings:de,refreshBearerKeys:ee,createBearerKey:X,updateBearerKey:he,deleteBearerKey:se};return t.jsx(H0.Provider,{value:ye,children:a})},q0=()=>{const{t:a}=ve(),{theme:n,setTheme:l}=Aj(),o=()=>{l(n==="light"?"dark":"light")};return t.jsx("button",{onClick:o,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 focus:outline-none",title:a(n==="light"?"theme.dark":"theme.light"),"aria-label":a(n==="light"?"theme.dark":"theme.light"),children:n==="light"?t.jsx(Cw,{className:"h-5 w-5"}):t.jsx(Uw,{className:"h-5 w-5"})})},Mj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:2,...a,children:[t.jsx("title",{children:n("common.language")}),t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2 12h20"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})]})},G0=()=>{const{i18n:a}=ve(),[n,l]=x.useState(!1),[o,c]=x.useState(a.language),u=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"fr",label:"Français"},{code:"tr",label:"Türkçe"}];x.useEffect(()=>{c(a.language)},[a.language]),x.useEffect(()=>{const f=h=>{h.target.closest(".language-dropdown")||l(!1)};return n&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[n]);const m=f=>{localStorage.setItem("i18nextLng",f),l(!1),window.location.reload()},g=()=>{l(!n)};return t.jsxs("div",{className:"relative language-dropdown",children:[t.jsx("button",{onClick:g,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 focus:outline-none","aria-label":"Language Switcher",children:t.jsx(Mj,{className:"h-5 w-5"})}),n&&t.jsx("div",{className:"absolute right-0 mt-2 w-24 bg-white dark:bg-gray-800 rounded-md shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:t.jsx("div",{children:u.map(f=>t.jsx("button",{onClick:()=>m(f.code),className:`flex items-center w-full px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${o.startsWith(f.code)?"bg-blue-50 text-blue-700":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-100"}`,children:f.label},f.code))})})]})},Pj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("common.github")}),t.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})},Dj=async()=>{try{const a=await Be("/logs");if(!a.success)throw new Error(a.error||"Failed to fetch logs");return a.data}catch(a){throw console.error("Error fetching logs",{error:a}),a}},Lj=async()=>{try{const a=await Yr("/logs");if(!a.success)throw new Error(a.error||"Failed to clear logs")}catch(a){throw console.error("Error clearing logs",{error:a}),a}};class Uj{constructor(){ea(this,"eventSource",null);ea(this,"subscribers",new Set);ea(this,"reconnectTimer",null);ea(this,"openAttempts",0)}subscribe(n){return this.subscribers.add(n),this.subscribers.size===1&&(this.openAttempts=0,this.openEventSource()),()=>{this.subscribers.delete(n),this.subscribers.size===0&&this.close()}}openEventSource(){this.closeEventSource();const n=Rn();if(!n){console.warn("[LogStreamManager] No token available, scheduling reconnect..."),this.scheduleReconnect();return}try{const l=Cd(`/logs/stream?token=${n}`);let o=l;try{const c=new URL(l);c.search="",o=c.toString()}catch{o=l.split("?")[0]||l}console.log("[LogStreamManager] Opening EventSource:",o),this.eventSource=new EventSource(l),this.eventSource.onmessage=c=>{this.subscribers.forEach(u=>u(c))},this.eventSource.onerror=()=>{console.warn("[LogStreamManager] EventSource error, attempting reconnect..."),this.closeEventSource(),this.subscribers.size>0&&this.scheduleReconnect()},this.openAttempts=0,console.log("[LogStreamManager] EventSource opened successfully")}catch(l){console.error("[LogStreamManager] Failed to open EventSource:",l),this.closeEventSource(),this.subscribers.size>0&&this.scheduleReconnect()}}closeEventSource(){this.eventSource&&(this.eventSource.close(),this.eventSource=null)}scheduleReconnect(){if(this.reconnectTimer!==null)return;const n=Math.min(1e3*Math.pow(2,this.openAttempts),8e3);this.openAttempts++,console.log(`[LogStreamManager] Scheduling reconnect in ${n}ms (attempt ${this.openAttempts})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.subscribers.size>0&&this.openEventSource()},n)}close(){this.closeEventSource(),this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}const Md=new Uj,_j=()=>{const[a,n]=x.useState([]),[l,o]=x.useState(!0),[c,u]=x.useState(null);return x.useEffect(()=>{let g=!0;(async()=>{try{const y=await Dj();g&&(n(y),o(!1))}catch(y){g&&(u(y instanceof Error?y:new Error("Failed to fetch logs")),o(!1))}})();const h=y=>{if(g)try{const w=JSON.parse(y.data);if(w.type==="initial")return;w.type==="log"&&n(N=>[...N,w.log])}catch(w){console.error("Error parsing SSE message",{err:w})}},b=Md.subscribe(h);return()=>{g=!1,b()}},[]),{logs:a,loading:l,error:c,clearLogs:async()=>{try{await Lj(),n([])}catch(g){u(g instanceof Error?g:new Error("Failed to clear logs"))}}}},Bj=5e3,K0=x.createContext(void 0),Ij=a=>!!a&&typeof a.serverName=="string"&&typeof a.current=="number"&&typeof a.total=="number"&&a.total>0&&a.current>=0&&a.current<=a.total&&["started","in_progress","completed","error"].includes(String(a.status)),Fj=({children:a})=>{const[n,l]=x.useState([]),o=x.useRef(new Map);x.useEffect(()=>{const u=y=>{const w=o.current.get(y);w&&(clearTimeout(w),o.current.delete(y))},m=()=>{o.current.forEach(y=>clearTimeout(y)),o.current.clear()},g=y=>{l(w=>{const N=w.findIndex(j=>j.serverName===y.serverName);if(N===-1)return[...w,y];const S=[...w];return S[N]=y,S})},f=y=>{l(w=>w.filter(N=>N.serverName!==y))},h=y=>{try{const w=JSON.parse(y.data);if((w==null?void 0:w.type)!=="embedding-sync-progress"||!Ij(w.progress))return;if(u(w.progress.serverName),w.progress.status==="error"){f(w.progress.serverName);return}const N={serverName:w.progress.serverName,current:w.progress.current,total:w.progress.total,status:w.progress.status};if(g(N),w.progress.status==="completed"){const S=setTimeout(()=>{f(w.progress.serverName),o.current.delete(w.progress.serverName)},Bj);o.current.set(w.progress.serverName,S)}}catch{}},b=Md.subscribe(h);return()=>{m(),b()}},[]);const c=x.useMemo(()=>({activeSyncs:n}),[n]);return t.jsx(K0.Provider,{value:c,children:a})},Hj=()=>{const a=x.useContext(K0);if(!a)throw new Error("useEmbeddingSync must be used within an EmbeddingSyncProvider");return a},qj=({onToggleSidebar:a})=>{const{t:n}=ve(),{activeSyncs:l}=Hj();return t.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm z-10",children:t.jsxs("div",{className:"flex items-center gap-4 px-3 py-3",children:[t.jsxs("div",{className:"flex items-center shrink-0",children:[t.jsx("button",{onClick:a,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none","aria-label":n("app.toggleSidebar"),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),t.jsx("h1",{className:"ml-4 text-xl font-bold text-gray-900 dark:text-white",children:n("app.title")})]}),t.jsx("div",{className:"flex flex-1 justify-center px-2 min-w-0",children:l.length>0&&t.jsx("div",{className:"flex max-w-full flex-wrap justify-center gap-2",children:l.map(o=>t.jsxs("div",{className:"flex min-w-0 w-56 max-w-full flex-col rounded-md bg-blue-50 px-3 py-2 text-xs text-blue-900 dark:bg-gray-700 dark:text-blue-100",title:n("app.embeddingSyncProgressAriaLabel",{serverName:o.serverName,current:o.current,total:o.total}),children:[t.jsx("span",{className:"truncate font-medium",children:n("app.embeddingSyncProgress",{serverName:o.serverName})}),t.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[t.jsx("progress",{className:"h-2 flex-1",value:o.current,max:o.total,"aria-label":n("app.embeddingSyncProgressAriaLabel",{serverName:o.serverName,current:o.current,total:o.total})}),t.jsxs("span",{className:"shrink-0 tabular-nums",children:[o.current,"/",o.total]})]})]},o.serverName))})}),t.jsxs("div",{className:"flex items-center space-x-1 shrink-0",children:[t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 mr-2",children:"v0.12.14"}),t.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800","aria-label":"GitHub Repository",children:t.jsx(Pj,{className:"h-5 w-5"})}),t.jsx("a",{href:"https://docs.mcphub.app",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800","aria-label":"Documentation",children:t.jsx(y0,{className:"h-5 w-5"})}),t.jsx(q0,{}),t.jsx(G0,{})]})]})})},os=({permissions:a,fallback:n=null,children:l})=>V0(a)?t.jsx(t.Fragment,{children:l}):t.jsx(t.Fragment,{children:n}),V0=a=>{const{auth:n}=ca();if(!n.isAuthenticated||!n.user)return!1;const l=n.user.permissions||[];return a==="x"&&!l.includes("x")?!1:l.includes("*")||n.user.isAdmin?!0:(Array.isArray(a)?a:[a]).some(c=>l.includes(c))},Gj="https://registry.npmjs.org",Kj="@samanhappy/mcphub",$0=async()=>{try{const a=await fetch(`${Gj}/${Kj}/latest`);if(!a.ok)throw new Error(`Failed to fetch latest version: ${a.status}`);return(await a.json()).version||null}catch(a){return console.error("Error checking for latest version:",a),null}},Y0=(a,n)=>{if(a==="dev")return-1;const l=a.split(".").map(Number),o=n.split(".").map(Number);for(let c=0;c<3;c++){const u=l[c]||0,m=o[c]||0;if(u>m)return-1;if(u<m)return 1}return 0},Vj=({isOpen:a,onClose:n,version:l})=>{const{t:o}=ve(),[c,u]=x.useState(!1),[m,g]=x.useState(""),[f,h]=x.useState(!1),b=async()=>{h(!0);try{const y=await $0();y&&(g(y),u(Y0(l,y)>0))}catch(y){console.error("Failed to check for updates:",y)}finally{h(!1)}};return x.useEffect(()=>{a&&b()},[a,l]),a?t.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-30 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6 relative",children:[t.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":o("common.close"),children:t.jsx(Ma,{className:"h-5 w-5"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:o("about.title")}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:[o("about.currentVersion"),":"]}),t.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:l})]}),c&&m&&t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900 p-3 rounded",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"ml-3 flex-1 text-sm text-blue-700 dark:text-blue-300",children:[t.jsx("p",{children:o("about.newVersionAvailable",{version:m})}),t.jsx("p",{className:"mt-1",children:t.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",children:o("about.viewOnGitHub")})})]})]})}),t.jsxs("button",{onClick:b,disabled:f,className:`mt-4 inline-flex items-center px-4 py-2 border border-gray-200 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium btn-secondary
|
|
231
|
-
${f?"text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600"} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`,children:[t.jsx(Tw,{className:`h-4 w-4 mr-2 ${f?"animate-spin":""}`}),o(f?"about.checking":"about.checkForUpdates")]})]})]})})}):null},$j=({open:a,onOpenChange:n})=>{const{i18n:l,t:o}=ve();return a?t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6 relative",children:[t.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":o("common.close"),children:t.jsx(Ma,{className:"h-5 w-5"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:o("sponsor.title")}),t.jsx("div",{className:"flex flex-col items-center justify-center py-4",children:l.language==="zh"?t.jsx("img",{src:"./assets/reward.png",alt:o("sponsor.rewardAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}):t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"mb-4 text-gray-700 dark:text-gray-300",children:o("sponsor.supportMessage")}),t.jsx("a",{href:"https://ko-fi.com/samanhappy",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center bg-[#13C3FF] text-white px-4 py-2 rounded-md hover:bg-[#00A5E5] transition-colors",children:o("sponsor.supportButton")})]})})]})})}):null},Yj=({open:a,onOpenChange:n})=>{const{t:l}=ve();return a?t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6 relative",children:[t.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":l("common.close"),children:t.jsx(Ma,{className:"h-5 w-5"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:l("wechat.title")}),t.jsxs("div",{className:"flex flex-col items-center justify-center py-4",children:[t.jsx("img",{src:"./assets/wexin.png",alt:l("wechat.qrCodeAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}),t.jsx("p",{className:"mt-4 text-center text-gray-700 dark:text-gray-300",children:l("wechat.scanMessage")})]})]})})}):null},Jj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("common.wechat")}),t.jsx("path",{d:"M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"})]})},Qj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("common.discord")}),t.jsx("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]})},Xj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("sponsor.label")}),t.jsx("path",{d:"M17.625 1.499c-2.32 0-4.354 1.203-5.625 3.03-1.271-1.827-3.305-3.03-5.625-3.03C3.129 1.499 0 4.253 0 8.249c0 4.275 3.068 7.847 5.828 10.227a33.14 33.14 0 0 0 5.616 3.876l.028.017.008.003-.001.003c.163.085.342.126.521.125.179.001.358-.041.521-.125l-.001-.003.008-.003.028-.017a33.14 33.14 0 0 0 5.616-3.876C20.932 16.096 24 12.524 24 8.249c0-3.996-3.129-6.75-6.375-6.75zm-.919 15.275a30.766 30.766 0 0 1-4.703 3.316l-.004-.002-.004.002a30.955 30.955 0 0 1-4.703-3.316c-2.677-2.307-5.047-5.298-5.047-8.523 0-2.754 2.121-4.5 4.125-4.5 2.06 0 3.914 1.479 4.544 3.684.143.495.596.797 1.086.796.49.001.943-.302 1.085-.796.63-2.205 2.484-3.684 4.544-3.684 2.004 0 4.125 1.746 4.125 4.5 0 3.225-2.37 6.216-5.048 8.523z"})]})},Zj=({collapsed:a,version:n})=>{var R;const{t:l,i18n:o}=ve(),c=oa(),{auth:u,logout:m}=ca(),[g,f]=x.useState(!1),[h,b]=x.useState(!1),[y,w]=x.useState(!1),[N,S]=x.useState(!1),[j,C]=x.useState(!1),z=x.useRef(null);x.useEffect(()=>{(async()=>{try{const P=await $0();P&&b(Y0(n,P)>0)}catch(P){console.error("Error checking for new version:",P)}})()},[n]),x.useEffect(()=>{const _=P=>{z.current&&!z.current.contains(P.target)&&f(!1)};return document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[]);const E=()=>{c("/settings"),f(!1)},T=()=>{m(),c("/login")},B=()=>{w(!0),f(!1)},D=()=>{S(!0),f(!1)},Y=()=>{C(!0),f(!1)};return t.jsxs("div",{ref:z,className:"relative",children:[t.jsxs("button",{onClick:()=>f(!g),className:`flex ${a?"justify-center":"items-center"} w-full p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors rounded-md ${g?"bg-gray-100 dark:bg-gray-700":""}`,children:[t.jsxs("div",{className:"flex-shrink-0 relative",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700",children:t.jsx(N0,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})}),h&&t.jsx("span",{className:"absolute -top-1 -right-1 block w-2 h-2 bg-red-500 rounded-full"})]}),!a&&t.jsx("div",{className:"ml-3 flex flex-col items-start",children:t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:((R=u.user)==null?void 0:R.username)||l("auth.user")})})]}),g&&t.jsxs("div",{className:"absolute top-0 transform -translate-y-full left-0 w-full min-w-max bg-white border border-gray-200 dark:border-gray-700 dark:bg-gray-800 z-50",children:[t.jsxs("button",{onClick:D,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Xj,{className:"h-4 w-4 mr-2"}),l("sponsor.label")]}),o.language==="zh"?t.jsxs("button",{onClick:Y,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Jj,{className:"h-4 w-4 mr-2"}),l("wechat.label")]}):t.jsxs("a",{href:"https://discord.gg/qMKNsn5Q",target:"_blank",rel:"noopener noreferrer",className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Qj,{className:"h-4 w-4 mr-2"}),l("discord.label")]}),t.jsxs("button",{onClick:E,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Pw,{className:"h-4 w-4 mr-2"}),l("nav.settings")]}),t.jsxs("button",{onClick:B,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 relative",children:[t.jsx(yw,{className:"h-4 w-4 mr-2"}),l("about.title"),h&&t.jsx("span",{className:"absolute top-2 right-4 block w-2 h-2 bg-red-500 rounded-full"})]}),t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600"}),t.jsxs("button",{onClick:T,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Sw,{className:"h-4 w-4 mr-2"}),l("app.logout")]})]}),t.jsx(Vj,{isOpen:y,onClose:()=>w(!1),version:n}),t.jsx($j,{open:N,onOpenChange:S}),t.jsx(Yj,{open:j,onOpenChange:C})]})},Wj=async()=>{var a;try{const n=await Be("/activities/available");return((a=n==null?void 0:n.data)==null?void 0:a.available)||!1}catch(n){return console.error("Error checking activity availability:",n),!1}},eS=(a,n,l)=>{const o=new URLSearchParams;return o.append("page",a.toString()),o.append("limit",n.toString()),l!=null&&l.server&&o.append("server",l.server),l!=null&&l.tool&&o.append("tool",l.tool),l!=null&&l.status&&o.append("status",l.status),l!=null&&l.group&&o.append("group",l.group),l!=null&&l.keyId&&o.append("keyId",l.keyId),l!=null&&l.keyName&&o.append("keyName",l.keyName),l!=null&&l.startDate&&o.append("startDate",l.startDate),l!=null&&l.endDate&&o.append("endDate",l.endDate),o.toString()},tS=async(a,n,l)=>{const o=eS(a,n,l);return await Be(`/activities?${o}`)},rS=async a=>await Be(`/activities/${a}`),aS=async a=>{const n=new URLSearchParams;a!=null&&a.server&&n.append("server",a.server),a!=null&&a.tool&&n.append("tool",a.tool),a!=null&&a.status&&n.append("status",a.status),a!=null&&a.group&&n.append("group",a.group),a!=null&&a.keyId&&n.append("keyId",a.keyId),a!=null&&a.keyName&&n.append("keyName",a.keyName),a!=null&&a.startDate&&n.append("startDate",a.startDate),a!=null&&a.endDate&&n.append("endDate",a.endDate);const l=n.toString();return await Be(`/activities/stats${l?`?${l}`:""}`)},sS=async()=>await Be("/activities/filters"),nS=async(a=30)=>await Yr(`/activities/cleanup?daysOld=${a}`),lS=({collapsed:a})=>{var g,f;const{t:n}=ve(),{auth:l}=ca(),[o,c]=x.useState(!1),u="0.12.14";x.useEffect(()=>{Wj().then(c).catch(()=>c(!1))},[]);const m=[{path:"/",label:n("nav.dashboard"),icon:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[t.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),t.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]})},{path:"/servers",label:n("nav.servers"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm14 1a1 1 0 11-2 0 1 1 0 012 0zM2 13a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2v-2zm14 1a1 1 0 11-2 0 1 1 0 012 0z",clipRule:"evenodd"})})},{path:"/groups",label:n("nav.groups"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{d:"M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"})})},{path:"/prompts",label:n("nav.prompts"),icon:t.jsx(Nn,{className:"h-4 w-4"})},{path:"/resources",label:n("nav.resources"),icon:t.jsx(Sn,{className:"h-5 w-5"})},{path:"/market",label:n("nav.market"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{d:"M3 1a1 1 0 000 2h1.22l.305 1.222a.997.997 0 00.01.042l1.358 5.43-.893.892C3.74 11.846 4.632 14 6.414 14H15a1 1 0 000-2H6.414l1-1H14a1 1 0 00.894-.553l3-6A1 1 0 0017 3H6.28l-.31-1.243A1 1 0 005 1H3zM16 16.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})})},...(g=l.user)!=null&&g.isAdmin&&V0("x")?[{path:"/users",label:n("nav.users"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{d:"M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"})})}]:[],...o&&((f=l.user)!=null&&f.isAdmin)?[{path:"/activity",label:n("nav.activity"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}]:[],{path:"/logs",label:n("nav.logs"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z",clipRule:"evenodd"})})}];return t.jsxs("aside",{className:`bg-white dark:bg-gray-800 shadow-sm transition-all duration-300 ease-in-out flex flex-col h-full relative ${a?"w-16":"w-64"}`,children:[t.jsx("div",{className:"overflow-y-auto flex-grow",children:t.jsx("nav",{className:"p-3 space-y-1",children:m.map(h=>t.jsxs(s0,{to:h.path,className:({isActive:b})=>`flex items-center px-2.5 py-2 rounded-lg transition-colors duration-200
|
|
230
|
+
*/const qw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ma=et("x",qw);function k0(a){var n,l,o="";if(typeof a=="string"||typeof a=="number")o+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(n=0;n<c;n++)a[n]&&(l=k0(a[n]))&&(o&&(o+=" "),o+=l)}else for(l in a)a[l]&&(o&&(o+=" "),o+=l);return o}function Gw(){for(var a,n,l=0,o="",c=arguments.length;l<c;l++)(a=arguments[l])&&(n=k0(a))&&(o&&(o+=" "),o+=n);return o}const zd="-",Kw=a=>{const n=$w(a),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=a;return{getClassGroupId:m=>{const g=m.split(zd);return g[0]===""&&g.length!==1&&g.shift(),C0(g,n)||Vw(m)},getConflictingClassGroupIds:(m,g)=>{const f=l[m]||[];return g&&o[m]?[...f,...o[m]]:f}}},C0=(a,n)=>{var m;if(a.length===0)return n.classGroupId;const l=a[0],o=n.nextPart.get(l),c=o?C0(a.slice(1),o):void 0;if(c)return c;if(n.validators.length===0)return;const u=a.join(zd);return(m=n.validators.find(({validator:g})=>g(u)))==null?void 0:m.classGroupId},ah=/^\[(.+)\]$/,Vw=a=>{if(ah.test(a)){const n=ah.exec(a)[1],l=n==null?void 0:n.substring(0,n.indexOf(":"));if(l)return"arbitrary.."+l}},$w=a=>{const{theme:n,classGroups:l}=a,o={nextPart:new Map,validators:[]};for(const c in l)md(l[c],o,c,n);return o},md=(a,n,l,o)=>{a.forEach(c=>{if(typeof c=="string"){const u=c===""?n:sh(n,c);u.classGroupId=l;return}if(typeof c=="function"){if(Yw(c)){md(c(o),n,l,o);return}n.validators.push({validator:c,classGroupId:l});return}Object.entries(c).forEach(([u,m])=>{md(m,sh(n,u),l,o)})})},sh=(a,n)=>{let l=a;return n.split(zd).forEach(o=>{l.nextPart.has(o)||l.nextPart.set(o,{nextPart:new Map,validators:[]}),l=l.nextPart.get(o)}),l},Yw=a=>a.isThemeGetter,Jw=a=>{if(a<1)return{get:()=>{},set:()=>{}};let n=0,l=new Map,o=new Map;const c=(u,m)=>{l.set(u,m),n++,n>a&&(n=0,o=l,l=new Map)};return{get(u){let m=l.get(u);if(m!==void 0)return m;if((m=o.get(u))!==void 0)return c(u,m),m},set(u,m){l.has(u)?l.set(u,m):c(u,m)}}},pd="!",gd=":",Qw=gd.length,Xw=a=>{const{prefix:n,experimentalParseClassName:l}=a;let o=c=>{const u=[];let m=0,g=0,f=0,h;for(let S=0;S<c.length;S++){let j=c[S];if(m===0&&g===0){if(j===gd){u.push(c.slice(f,S)),f=S+Qw;continue}if(j==="/"){h=S;continue}}j==="["?m++:j==="]"?m--:j==="("?g++:j===")"&&g--}const b=u.length===0?c:c.substring(f),y=Zw(b),w=y!==b,N=h&&h>f?h-f:void 0;return{modifiers:u,hasImportantModifier:w,baseClassName:y,maybePostfixModifierPosition:N}};if(n){const c=n+gd,u=o;o=m=>m.startsWith(c)?u(m.substring(c.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:m,maybePostfixModifierPosition:void 0}}if(l){const c=o;o=u=>l({className:u,parseClassName:c})}return o},Zw=a=>a.endsWith(pd)?a.substring(0,a.length-1):a.startsWith(pd)?a.substring(1):a,Ww=a=>{const n=Object.fromEntries(a.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const c=[];let u=[];return o.forEach(m=>{m[0]==="["||n[m]?(c.push(...u.sort(),m),u=[]):u.push(m)}),c.push(...u.sort()),c}},ej=a=>({cache:Jw(a.cacheSize),parseClassName:Xw(a),sortModifiers:Ww(a),...Kw(a)}),tj=/\s+/,rj=(a,n)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:u}=n,m=[],g=a.trim().split(tj);let f="";for(let h=g.length-1;h>=0;h-=1){const b=g[h],{isExternal:y,modifiers:w,hasImportantModifier:N,baseClassName:S,maybePostfixModifierPosition:j}=l(b);if(y){f=b+(f.length>0?" "+f:f);continue}let C=!!j,z=o(C?S.substring(0,j):S);if(!z){if(!C){f=b+(f.length>0?" "+f:f);continue}if(z=o(S),!z){f=b+(f.length>0?" "+f:f);continue}C=!1}const E=u(w).join(":"),T=N?E+pd:E,B=T+z;if(m.includes(B))continue;m.push(B);const D=c(z,C);for(let Y=0;Y<D.length;++Y){const R=D[Y];m.push(T+R)}f=b+(f.length>0?" "+f:f)}return f};function aj(){let a=0,n,l,o="";for(;a<arguments.length;)(n=arguments[a++])&&(l=A0(n))&&(o&&(o+=" "),o+=l);return o}const A0=a=>{if(typeof a=="string")return a;let n,l="";for(let o=0;o<a.length;o++)a[o]&&(n=A0(a[o]))&&(l&&(l+=" "),l+=n);return l};function sj(a,...n){let l,o,c,u=m;function m(f){const h=n.reduce((b,y)=>y(b),a());return l=ej(h),o=l.cache.get,c=l.cache.set,u=g,g(f)}function g(f){const h=o(f);if(h)return h;const b=rj(f,l);return c(f,b),b}return function(){return u(aj.apply(null,arguments))}}const Ut=a=>{const n=l=>l[a]||[];return n.isThemeGetter=!0,n},E0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,R0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nj=/^\d+\/\d+$/,lj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ij=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cj=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xn=a=>nj.test(a),Fe=a=>!!a&&!Number.isNaN(Number(a)),is=a=>!!a&&Number.isInteger(Number(a)),Xu=a=>a.endsWith("%")&&Fe(a.slice(0,-1)),Ea=a=>lj.test(a),dj=()=>!0,mj=a=>ij.test(a)&&!oj.test(a),T0=()=>!1,pj=a=>cj.test(a),gj=a=>uj.test(a),fj=a=>!Ae(a)&&!Ee(a),hj=a=>Tn(a,M0,T0),Ae=a=>E0.test(a),Rs=a=>Tn(a,P0,mj),Zu=a=>Tn(a,wj,Fe),nh=a=>Tn(a,O0,T0),xj=a=>Tn(a,z0,gj),Wi=a=>Tn(a,D0,pj),Ee=a=>R0.test(a),Cl=a=>On(a,P0),yj=a=>On(a,jj),lh=a=>On(a,O0),bj=a=>On(a,M0),vj=a=>On(a,z0),eo=a=>On(a,D0,!0),Tn=(a,n,l)=>{const o=E0.exec(a);return o?o[1]?n(o[1]):l(o[2]):!1},On=(a,n,l=!1)=>{const o=R0.exec(a);return o?o[1]?n(o[1]):l:!1},O0=a=>a==="position"||a==="percentage",z0=a=>a==="image"||a==="url",M0=a=>a==="length"||a==="size"||a==="bg-size",P0=a=>a==="length",wj=a=>a==="number",jj=a=>a==="family-name",D0=a=>a==="shadow",Sj=()=>{const a=Ut("color"),n=Ut("font"),l=Ut("text"),o=Ut("font-weight"),c=Ut("tracking"),u=Ut("leading"),m=Ut("breakpoint"),g=Ut("container"),f=Ut("spacing"),h=Ut("radius"),b=Ut("shadow"),y=Ut("inset-shadow"),w=Ut("text-shadow"),N=Ut("drop-shadow"),S=Ut("blur"),j=Ut("perspective"),C=Ut("aspect"),z=Ut("ease"),E=Ut("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...B(),Ee,Ae],Y=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],_=()=>[Ee,Ae,f],P=()=>[xn,"full","auto",..._()],V=()=>[is,"none","subgrid",Ee,Ae],K=()=>["auto",{span:["full",is,Ee,Ae]},is,Ee,Ae],G=()=>[is,"auto",Ee,Ae],I=()=>["auto","min","max","fr",Ee,Ae],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",..._()],H=()=>[xn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],J=()=>[a,Ee,Ae],me=()=>[...B(),lh,nh,{position:[Ee,Ae]}],le=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",bj,hj,{size:[Ee,Ae]}],U=()=>[Xu,Cl,Rs],M=()=>["","none","full",h,Ee,Ae],q=()=>["",Fe,Cl,Rs],de=()=>["solid","dashed","dotted","double"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Fe,Xu,lh,nh],he=()=>["","none",S,Ee,Ae],se=()=>["none",Fe,Ee,Ae],ye=()=>["none",Fe,Ee,Ae],ie=()=>[Fe,Ee,Ae],ae=()=>[xn,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ea],breakpoint:[Ea],color:[dj],container:[Ea],"drop-shadow":[Ea],ease:["in","out","in-out"],font:[fj],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ea],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ea],shadow:[Ea],spacing:["px",Fe],text:[Ea],"text-shadow":[Ea],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xn,Ae,Ee,C]}],container:["container"],columns:[{columns:[Fe,Ae,Ee,g]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[is,"auto",Ee,Ae]}],basis:[{basis:[xn,"full","auto",g,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,xn,"auto","initial","none",Ae]}],grow:[{grow:["",Fe,Ee,Ae]}],shrink:[{shrink:["",Fe,Ee,Ae]}],order:[{order:[is,"first","last","none",Ee,Ae]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[g,"screen",...H()]}],"min-w":[{"min-w":[g,"screen","none",...H()]}],"max-w":[{"max-w":[g,"screen","none","prose",{screen:[m]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",l,Cl,Rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Ee,Zu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xu,Ae]}],"font-family":[{font:[yj,Ae,n]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Ee,Ae]}],"line-clamp":[{"line-clamp":[Fe,"none",Ee,Zu]}],leading:[{leading:[u,..._()]}],"list-image":[{"list-image":["none",Ee,Ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,Ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Ee,Rs]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[Fe,"auto",Ee,Ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:me()}],"bg-repeat":[{bg:le()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},is,Ee,Ae],radial:["",Ee,Ae],conic:[is,Ee,Ae]},vj,xj]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Ee,Ae]}],"outline-w":[{outline:["",Fe,Cl,Rs]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",b,eo,Wi]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",y,eo,Wi]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[Fe,Rs]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",w,eo,Wi]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[Fe,Ee,Ae]}],"mix-blend":[{"mix-blend":[...ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[Ee,Ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":B()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:me()}],"mask-repeat":[{mask:le()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ee,Ae]}],filter:[{filter:["","none",Ee,Ae]}],blur:[{blur:he()}],brightness:[{brightness:[Fe,Ee,Ae]}],contrast:[{contrast:[Fe,Ee,Ae]}],"drop-shadow":[{"drop-shadow":["","none",N,eo,Wi]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",Fe,Ee,Ae]}],"hue-rotate":[{"hue-rotate":[Fe,Ee,Ae]}],invert:[{invert:["",Fe,Ee,Ae]}],saturate:[{saturate:[Fe,Ee,Ae]}],sepia:[{sepia:["",Fe,Ee,Ae]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,Ae]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Ee,Ae]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Ee,Ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Ee,Ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Ee,Ae]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Ee,Ae]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Ee,Ae]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Ee,Ae]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Ee,Ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,Ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Ee,Ae]}],ease:[{ease:["linear","initial",z,Ee,Ae]}],delay:[{delay:[Fe,Ee,Ae]}],animate:[{animate:["none",E,Ee,Ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ee,Ae]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Ee,Ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ee,Ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ee,Ae]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[Fe,Cl,Rs,Zu]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Nj=sj(Sj);function la(...a){return Nj(Gw(a))}const kj=({message:a,type:n="info",duration:l=3e3,onClose:o,visible:c})=>{const{t:u}=ve();x.useEffect(()=>{if(c){const b=setTimeout(()=>{o()},l);return()=>clearTimeout(b)}},[c,l,o]);const m={success:t.jsx(za,{className:"w-5 h-5 text-green-500"}),error:t.jsx(Ma,{className:"w-5 h-5 text-red-500"}),info:t.jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),warning:t.jsx("svg",{className:"w-5 h-5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})},g={success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",info:"bg-blue-50 border-blue-200",warning:"bg-yellow-50 border-yellow-200"},f={success:"text-green-800",error:"text-red-800",info:"text-blue-800",warning:"text-yellow-800"},h={success:"border-l-4 border-l-green-500",error:"border-l-4 border-l-red-600",info:"border-l-4 border-l-blue-500",warning:"border-l-4 border-l-yellow-500"};return t.jsx("div",{className:la("fixed top-4 right-4 z-50 max-w-sm p-4 rounded-md shadow-lg border",g[n],h[n],"transform transition-all duration-300 ease-in-out",c?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:m[n]}),t.jsx("div",{className:"ml-3",children:t.jsx("p",{className:la("text-sm font-medium",f[n]),children:a})}),t.jsx("div",{className:"ml-auto pl-3",children:t.jsx("div",{className:"-mx-1.5 -my-1.5",children:t.jsxs("button",{onClick:o,className:la("inline-flex rounded-md p-1.5",`hover:bg-${n}-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${n}-500`),children:[t.jsx("span",{className:"sr-only",children:u("common.dismiss")}),t.jsx(Ma,{className:"h-5 w-5"})]})})})]})})},L0=x.createContext(void 0),Pa=()=>{const a=x.useContext(L0);if(!a)throw new Error("useToast must be used within a ToastProvider");return a},Cj=({children:a})=>{const[n,l]=x.useState({message:"",type:"info",visible:!1,duration:3e3}),o=x.useCallback((u,m="info",g=3e3)=>{l({message:u,type:m,visible:!0,duration:g})},[]),c=x.useCallback(()=>{l(u=>({...u,visible:!1}))},[]);return t.jsxs(L0.Provider,{value:{showToast:o},children:[a,t.jsx(kj,{message:n.message,type:n.type,duration:n.duration,onClose:c,visible:n.visible})]})},U0=x.createContext(void 0),Aj=()=>{const a=x.useContext(U0);if(!a)throw new Error("useTheme must be used within a ThemeProvider");return a},Ej=({children:a})=>{const[n,l]=x.useState(()=>localStorage.getItem("theme")||"system"),[o,c]=x.useState("light"),u=m=>{l(m),localStorage.setItem("theme",m)};return x.useEffect(()=>{const m=()=>{const f=window.document.documentElement,h=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",b=n==="system"?h:n;c(b),b==="dark"?(console.log("Applying dark mode to HTML root element"),f.classList.add("dark"),document.body.style.backgroundColor="#111827"):(console.log("Removing dark mode from HTML root element"),f.classList.remove("dark"),document.body.style.backgroundColor="")},g=window.matchMedia("(prefers-color-scheme: dark)");return g.addEventListener("change",m),m(),()=>{g.removeEventListener("change",m)}},[n]),t.jsx(U0.Provider,{value:{theme:n,setTheme:u,resolvedTheme:o},children:a})},_0="mcphub_servers_per_page",mo=5,B0=new Set([5,10,20,50]),Rj=()=>{if(typeof window>"u")return mo;const a=window.localStorage.getItem(_0);if(!a)return mo;const n=Number(a);return B0.has(n)?n:mo},to={startup:{maxAttempts:60,pollingInterval:3e3},normal:{pollingInterval:1e4}},I0=x.createContext(void 0),Tj=({children:a})=>{const{t:n}=ve(),{auth:l}=ca(),[o,c]=x.useState([]),[u,m]=x.useState([]),[g,f]=x.useState(null),[h,b]=x.useState(0),[y,w]=x.useState(!0),[N,S]=x.useState(0),[j,C]=x.useState(null),[z,E]=x.useState(1),[T,B]=x.useState(Rj),D=x.useRef(null),Y=x.useRef(0),R=x.useRef(0),_=3e3,P=()=>{D.current&&(clearInterval(D.current),D.current=null)},V=x.useCallback(k=>{const U=(k==null?void 0:k.immediate)??!0;P();const M=async()=>{try{console.log("[ServerContext] Fetching servers from API...");const q=new URLSearchParams;q.append("page",z.toString()),q.append("limit",T.toString());const[de,ee]=await Promise.all([Be(`/servers?${q.toString()}`),Be("/servers")]);R.current=Date.now(),de&&de.success&&Array.isArray(de.data)?(c(de.data),de.pagination?C(de.pagination):C(null)):de&&Array.isArray(de)?(c(de),C(null)):(console.error("Invalid server data format",{paginatedData:de}),c([]),C(null)),ee&&ee.success&&Array.isArray(ee.data)?m(ee.data):ee&&Array.isArray(ee)?m(ee):m([]),f(null)}catch(q){console.error("Error fetching servers during normal polling",{err:q}),navigator.onLine?q instanceof TypeError&&(q.message.includes("NetworkError")||q.message.includes("Failed to fetch"))?f(n("errors.serverConnection")):f(n("errors.serverFetch")):f(n("errors.network"))}};U&&M(),D.current=setInterval(M,to.normal.pollingInterval)},[n,z,T]);x.useEffect(()=>{l.isAuthenticated?(console.log("[ServerContext] User authenticated, triggering refresh"),b(k=>k+1)):(console.log("[ServerContext] User not authenticated, clearing data and stopping polling"),P(),c([]),m([]),w(!1),f(null))},[l.isAuthenticated]),x.useEffect(()=>{if(!l.isAuthenticated){console.log("[ServerContext] User not authenticated, skipping polling setup");return}h>0&&(Y.current=0,S(0));const k=async()=>{try{console.log("[ServerContext] Initial fetch - attempt",Y.current+1);const U=new URLSearchParams;U.append("page",z.toString()),U.append("limit",T.toString());const[M,q]=await Promise.all([Be(`/servers?${U.toString()}`),Be("/servers")]);return R.current=Date.now(),M&&M.success&&Array.isArray(M.data)?(c(M.data),M.pagination?C(M.pagination):C(null)):M&&Array.isArray(M)?(c(M),C(null)):(console.error("Invalid server data format",{paginatedData:M}),c([]),C(null)),q&&q.success&&Array.isArray(q.data)?m(q.data):q&&Array.isArray(q)?m(q):m([]),w(!1),V({immediate:!1}),!0}catch(U){return Y.current+=1,console.error("Initial loading attempt failed",{attempt:Y.current,err:U}),S(Y.current),navigator.onLine?f(n("errors.initialStartup")):f(n("errors.network")),Y.current>=to.startup.maxAttempts&&(console.log("Maximum startup attempts reached, switching to normal polling"),w(!1),P(),V()),!1}};return y?(P(),k(),D.current=setInterval(k,to.startup.pollingInterval),console.log(`Started initial polling with interval: ${to.startup.pollingInterval}ms`)):V(),()=>{P()}},[h,n,y,V,z,T]),x.useEffect(()=>{if(!j)return;const k=Math.max(1,j.totalPages||1);z>k&&E(k)},[j,z]);const K=x.useCallback(()=>{P(),y&&(w(!0),Y.current=0,S(0)),b(k=>k+1)},[y]),G=x.useCallback(()=>{const U=Date.now()-R.current;console.log("[ServerContext] refreshIfNeeded called",{timeSinceLastFetch:U}),U>=_?(console.log("[ServerContext] Triggering refresh after minimum interval",{minRefreshInterval:_}),K()):console.log("[ServerContext] Skipping refresh because minimum interval not reached",{minRefreshInterval:_,timeSinceLastFetch:U})},[K]),I=x.useCallback(()=>{b(k=>k+1)},[]),L=x.useCallback(async k=>{try{const U=encodeURIComponent(k.name),M=await Be(`/servers/${U}`);return M&&M.success&&M.data?{name:M.data.name,status:M.data.status,tools:M.data.tools||[],config:M.data.config}:(console.error("Failed to get server config",{serverName:k.name,serverData:M}),f(n("server.invalidConfig",{serverName:k.name})),null)}catch(U){return console.error("Error fetching server config",{serverName:k.name,err:U}),f(U instanceof Error?U.message:String(U)),null}},[n]),Z=x.useCallback(async k=>{try{const U=encodeURIComponent(k),M=await Yr(`/servers/${U}`);return!M||!M.success?(f((M==null?void 0:M.message)||n("server.deleteError",{serverName:k})),!1):(b(q=>q+1),!0)}catch(U){return f(n("errors.general")+": "+(U instanceof Error?U.message:String(U))),!1}},[n]),A=x.useCallback(async(k,U)=>{try{const M=encodeURIComponent(k.name),q=await pt(`/servers/${M}/toggle`,{enabled:U});return!q||!q.success?(console.error("Failed to toggle server",{serverName:k.name,result:q}),f((q==null?void 0:q.message)||n("server.toggleError",{serverName:k.name})),!1):(b(de=>de+1),!0)}catch(M){return console.error("Error toggling server",{serverName:k.name,err:M}),f(M instanceof Error?M.message:String(M)),!1}},[n]),H=x.useCallback(async k=>{try{const U=encodeURIComponent(k.name),M=await pt(`/servers/${U}/reload`,{});return!M||!M.success?(console.error("Failed to reload server",{serverName:k.name,result:M}),f(n("server.reloadError",{serverName:k.name})),!1):(K(),!0)}catch(U){return console.error("Error reloading server",{serverName:k.name,err:U}),f(U instanceof Error?U.message:String(U)),!1}},[n,K]),J=x.useCallback(k=>{E(k)},[]),me=x.useCallback(k=>{const U=B0.has(k)?k:mo;typeof window<"u"&&window.localStorage.setItem(_0,String(U)),B(U),E(1)},[]),le={servers:o,allServers:u,error:g,setError:f,isLoading:y,fetchAttempts:N,pagination:j,currentPage:z,serversPerPage:T,setCurrentPage:J,setServersPerPage:me,triggerRefresh:K,refreshIfNeeded:G,handleServerAdd:I,handleServerEdit:L,handleServerRemove:Z,handleServerToggle:A,handleServerReload:H};return t.jsx(I0.Provider,{value:le,children:a})},F0=()=>{const a=x.useContext(I0);if(a===void 0)throw new Error("useServerContext must be used within a ServerProvider");return a},Wu=()=>({enabled:!0,accessTokenLifetime:3600,refreshTokenLifetime:1209600,authorizationCodeLifetime:300,requireClientSecret:!1,allowedScopes:["read","write"],requireState:!1,dynamicRegistration:{enabled:!0,allowedGrantTypes:["authorization_code","refresh_token"],requiresAuthentication:!1}}),H0=x.createContext(void 0),Oj=()=>{const a=x.useContext(H0);if(!a)throw new Error("useSettings must be used within a SettingsProvider");return a},zj=({children:a})=>{const{t:n}=ve(),{showToast:l}=Pa(),{auth:o}=ca(),[c,u]=x.useState({enableGlobalRoute:!0,enableGroupNameRoute:!0,enableBearerAuth:!0,bearerAuthKey:"",bearerAuthHeaderName:"Authorization",jsonBodyLimit:"1mb",skipAuth:!1}),[m,g]=x.useState({bearerAuthKey:"",bearerAuthHeaderName:"Authorization",jsonBodyLimit:"1mb"}),[f,h]=x.useState({pythonIndexUrl:"",npmRegistry:"",baseUrl:"http://localhost:3000"}),[b,y]=x.useState({enabled:!1,dbUrl:"",basePacingDelayMs:void 0,embeddingProvider:"openai",embeddingEncodingFormat:"auto",openaiApiBaseUrl:"",openaiApiKey:"",openaiApiEmbeddingModel:"",azureOpenaiEndpoint:"",azureOpenaiApiKey:"",azureOpenaiApiVersion:"",azureOpenaiEmbeddingDeployment:"",progressiveDisclosure:!1,embeddingMaxTokens:void 0}),[w,N]=x.useState({apiKey:"",referer:"https://www.mcphub.app",title:"MCPHub",baseUrl:"https://api.mcprouter.to/v1"}),[S,j]=x.useState(Wu()),[C,z]=x.useState("-"),[E,T]=x.useState(!1),[B,D]=x.useState([]),[Y,R]=x.useState(!1),[_,P]=x.useState(null),[V,K]=x.useState(0),G=x.useCallback(()=>{K(ie=>ie+1)},[]),I=x.useCallback(async()=>{var ie,ae,be,Ne,xe,ke,Se,Le,at,gt,Mt,Pt,Nr,ft,kr,tr,Qt,ht;R(!0),P(null);try{const Re=await Be("/settings");if(Re.success&&((ae=(ie=Re.data)==null?void 0:ie.systemConfig)!=null&&ae.routing)&&u({enableGlobalRoute:Re.data.systemConfig.routing.enableGlobalRoute??!0,enableGroupNameRoute:Re.data.systemConfig.routing.enableGroupNameRoute??!0,enableBearerAuth:Re.data.systemConfig.routing.enableBearerAuth??!0,bearerAuthKey:Re.data.systemConfig.routing.bearerAuthKey||"",bearerAuthHeaderName:Re.data.systemConfig.routing.bearerAuthHeaderName||"Authorization",jsonBodyLimit:Re.data.systemConfig.routing.jsonBodyLimit||"1mb",skipAuth:Re.data.systemConfig.routing.skipAuth??!1}),Re.success&&((Ne=(be=Re.data)==null?void 0:be.systemConfig)!=null&&Ne.install)&&h({pythonIndexUrl:Re.data.systemConfig.install.pythonIndexUrl||"",npmRegistry:Re.data.systemConfig.install.npmRegistry||"",baseUrl:Re.data.systemConfig.install.baseUrl||"http://localhost:3000"}),Re.success&&((ke=(xe=Re.data)==null?void 0:xe.systemConfig)!=null&&ke.smartRouting)&&y({enabled:Re.data.systemConfig.smartRouting.enabled??!1,dbUrl:Re.data.systemConfig.smartRouting.dbUrl||"",basePacingDelayMs:Re.data.systemConfig.smartRouting.basePacingDelayMs,embeddingProvider:Re.data.systemConfig.smartRouting.embeddingProvider==="azure_openai"?"azure_openai":"openai",embeddingEncodingFormat:Re.data.systemConfig.smartRouting.embeddingEncodingFormat==="base64"?"base64":Re.data.systemConfig.smartRouting.embeddingEncodingFormat==="float"?"float":"auto",openaiApiBaseUrl:Re.data.systemConfig.smartRouting.openaiApiBaseUrl||"",openaiApiKey:Re.data.systemConfig.smartRouting.openaiApiKey||"",openaiApiEmbeddingModel:Re.data.systemConfig.smartRouting.openaiApiEmbeddingModel||"",azureOpenaiEndpoint:Re.data.systemConfig.smartRouting.azureOpenaiEndpoint||"",azureOpenaiApiKey:Re.data.systemConfig.smartRouting.azureOpenaiApiKey||"",azureOpenaiApiVersion:Re.data.systemConfig.smartRouting.azureOpenaiApiVersion||"",azureOpenaiEmbeddingDeployment:Re.data.systemConfig.smartRouting.azureOpenaiEmbeddingDeployment||"",progressiveDisclosure:Re.data.systemConfig.smartRouting.progressiveDisclosure??!1,embeddingMaxTokens:Re.data.systemConfig.smartRouting.embeddingMaxTokens}),Re.success&&((Le=(Se=Re.data)==null?void 0:Se.systemConfig)!=null&&Le.mcpRouter)&&N({apiKey:Re.data.systemConfig.mcpRouter.apiKey||"",referer:Re.data.systemConfig.mcpRouter.referer||"https://www.mcphub.app",title:Re.data.systemConfig.mcpRouter.title||"MCPHub",baseUrl:Re.data.systemConfig.mcpRouter.baseUrl||"https://api.mcprouter.to/v1"}),Re.success)if((gt=(at=Re.data)==null?void 0:at.systemConfig)!=null&>.oauthServer){const Oe=Re.data.systemConfig.oauthServer,it=Wu(),qt=it.dynamicRegistration,Gt=Array.isArray(Oe.allowedScopes)?[...Oe.allowedScopes]:[...it.allowedScopes],ot=Array.isArray((Mt=Oe.dynamicRegistration)==null?void 0:Mt.allowedGrantTypes)?[...Oe.dynamicRegistration.allowedGrantTypes]:[...qt.allowedGrantTypes];j({enabled:Oe.enabled??it.enabled,accessTokenLifetime:Oe.accessTokenLifetime??it.accessTokenLifetime,refreshTokenLifetime:Oe.refreshTokenLifetime??it.refreshTokenLifetime,authorizationCodeLifetime:Oe.authorizationCodeLifetime??it.authorizationCodeLifetime,requireClientSecret:Oe.requireClientSecret??it.requireClientSecret,requireState:Oe.requireState??it.requireState,allowedScopes:Gt,dynamicRegistration:{enabled:((Pt=Oe.dynamicRegistration)==null?void 0:Pt.enabled)??qt.enabled,allowedGrantTypes:ot,requiresAuthentication:((Nr=Oe.dynamicRegistration)==null?void 0:Nr.requiresAuthentication)??qt.requiresAuthentication}})}else j(Wu());Re.success&&((kr=(ft=Re.data)==null?void 0:ft.systemConfig)==null?void 0:kr.nameSeparator)!==void 0&&z(Re.data.systemConfig.nameSeparator),Re.success&&((Qt=(tr=Re.data)==null?void 0:tr.systemConfig)==null?void 0:Qt.enableSessionRebuild)!==void 0&&T(Re.data.systemConfig.enableSessionRebuild),Re.success&&Array.isArray((ht=Re.data)==null?void 0:ht.bearerKeys)&&D(Re.data.bearerKeys)}catch(Re){console.error("Failed to fetch settings",{error:Re}),P(Re instanceof Error?Re.message:"Failed to fetch settings"),l(n("errors.failedToFetchSettings"))}finally{R(!1)}},[n,l]),L=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{routing:{[ie]:ae}});return be.success?(u({...c,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update routing config"),l(be.error||n("errors.failedToUpdateRoutingConfig")),!1)}catch(be){return console.error("Failed to update routing config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update routing config"),l(n("errors.failedToUpdateRoutingConfig")),!1}finally{R(!1)}},Z=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{install:{[ie]:ae}});return be.success?(h({...f,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update install config"),l(be.error||n("errors.failedToUpdateInstallConfig")),!1)}catch(be){return console.error("Failed to update install config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update install config"),l(n("errors.failedToUpdateInstallConfig")),!1}finally{R(!1)}},A=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{smartRouting:{[ie]:ae}});return be.success?(y({...b,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update smart routing config"),l(be.error||n("errors.failedToUpdateSmartRoutingConfig")),!1)}catch(be){return console.error("Failed to update smart routing config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update smart routing config"),l(n("errors.failedToUpdateSmartRoutingConfig")),!1}finally{R(!1)}},H=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{smartRouting:ie});return ae.success?(y({...b,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update smart routing config"),l(ae.error||n("errors.failedToUpdateSmartRoutingConfig")),!1)}catch(ae){return console.error("Failed to batch update smart routing config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update smart routing config"),l(n("errors.failedToUpdateSmartRoutingConfig")),!1}finally{R(!1)}},J=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{routing:ie});return ae.success?(u({...c,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update routing config"),l(ae.error||n("errors.failedToUpdateRoutingConfig")),!1)}catch(ae){return console.error("Failed to batch update routing config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update routing config"),l(n("errors.failedToUpdateRoutingConfig")),!1}finally{R(!1)}},me=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{mcpRouter:{[ie]:ae}});return be.success?(N({...w,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update MCP Router config"),l(be.error||n("errors.failedToUpdateMCPRouterConfig")),!1)}catch(be){return console.error("Failed to update MCP Router config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update MCP Router config"),l(n("errors.failedToUpdateMCPRouterConfig")),!1}finally{R(!1)}},le=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{mcpRouter:ie});return ae.success?(N({...w,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update MCP Router config"),l(ae.error||n("errors.failedToUpdateMCPRouterConfig")),!1)}catch(ae){return console.error("Failed to batch update MCP Router config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update MCP Router config"),l(n("errors.failedToUpdateMCPRouterConfig")),!1}finally{R(!1)}},k=async(ie,ae)=>{R(!0),P(null);try{const be=await At("/system-config",{oauthServer:{[ie]:ae}});return be.success?(j({...S,[ie]:ae}),l(n("settings.systemConfigUpdated")),!0):(P(be.error||"Failed to update OAuth server config"),l(be.error||n("errors.failedToUpdateOAuthServerConfig")),!1)}catch(be){return console.error("Failed to update OAuth server config",{key:ie,value:ae,error:be}),P(be instanceof Error?be.message:"Failed to update OAuth server config"),l(n("errors.failedToUpdateOAuthServerConfig")),!1}finally{R(!1)}},U=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{oauthServer:ie});return ae.success?(j({...S,...ie}),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update OAuth server config"),l(ae.error||n("errors.failedToUpdateOAuthServerConfig")),!1)}catch(ae){return console.error("Failed to batch update OAuth server config",{updates:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update OAuth server config"),l(n("errors.failedToUpdateOAuthServerConfig")),!1}finally{R(!1)}},M=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{nameSeparator:ie});return ae.success?(z(ie),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update name separator"),l(ae.error||n("errors.failedToUpdateNameSeparator")),!1)}catch(ae){return console.error("Failed to update name separator",{value:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update name separator"),l(n("errors.failedToUpdateNameSeparator")),!1}finally{R(!1)}},q=async ie=>{R(!0),P(null);try{const ae=await At("/system-config",{enableSessionRebuild:ie});return ae.success?(T(ie),l(n("settings.systemConfigUpdated")),!0):(P(ae.error||"Failed to update session rebuild setting"),l(ae.error||n("errors.failedToUpdateSessionRebuild")),!1)}catch(ae){return console.error("Failed to update session rebuild setting",{value:ie,error:ae}),P(ae instanceof Error?ae.message:"Failed to update session rebuild setting"),l(n("errors.failedToUpdateSessionRebuild")),!1}finally{R(!1)}},de=async ie=>{R(!0),P(null);try{return await Be(`/mcp-settings/export?serverName=${ie||""}`)}catch(ae){console.error("Failed to export MCP settings",{serverName:ie,error:ae});const be=ae instanceof Error?ae.message:"Failed to export MCP settings";P(be),l(be)}finally{R(!1)}},ee=async()=>{try{const ie=await Be("/auth/keys");ie.success&&Array.isArray(ie.data)&&D(ie.data)}catch(ie){console.error("Failed to refresh bearer keys",{error:ie}),l(n("errors.failedToFetchSettings"))}},X=async ie=>{try{const ae=await pt("/auth/keys",ie);return ae.success&&ae.data?(await ee(),l(n("settings.systemConfigUpdated")),ae.data):(l(ae.message||n("errors.failedToUpdateRoutingConfig")),null)}catch(ae){return console.error("Failed to create bearer key",{error:ae}),l(n("errors.failedToUpdateRoutingConfig")),null}},he=async(ie,ae)=>{try{const be=await At(`/auth/keys/${ie}`,ae);return be.success&&be.data?(await ee(),l(n("settings.systemConfigUpdated")),be.data):(l(be.message||n("errors.failedToUpdateRoutingConfig")),null)}catch(be){return console.error("Failed to update bearer key",{id:ie,error:be}),l(n("errors.failedToUpdateRoutingConfig")),null}},se=async ie=>{try{const ae=await Yr(`/auth/keys/${ie}`);return ae.success?(await ee(),l(n("settings.systemConfigUpdated")),!0):(l(ae.message||n("errors.failedToUpdateRoutingConfig")),!1)}catch(ae){return console.error("Failed to delete bearer key",{id:ie,error:ae}),l(n("errors.failedToUpdateRoutingConfig")),!1}};x.useEffect(()=>{I()},[I,V]),x.useEffect(()=>{o.isAuthenticated&&(console.log("[SettingsContext] User authenticated, triggering settings refresh"),G())},[o.isAuthenticated,G]),x.useEffect(()=>{c&&g({bearerAuthKey:c.bearerAuthKey,bearerAuthHeaderName:c.bearerAuthHeaderName,jsonBodyLimit:c.jsonBodyLimit})},[c]);const ye={routingConfig:c,tempRoutingConfig:m,setTempRoutingConfig:g,installConfig:f,smartRoutingConfig:b,mcpRouterConfig:w,oauthServerConfig:S,nameSeparator:C,enableSessionRebuild:E,bearerKeys:B,loading:Y,error:_,setError:P,triggerRefresh:G,fetchSettings:I,updateRoutingConfig:L,updateInstallConfig:Z,updateSmartRoutingConfig:A,updateSmartRoutingConfigBatch:H,updateRoutingConfigBatch:J,updateMCPRouterConfig:me,updateMCPRouterConfigBatch:le,updateOAuthServerConfig:k,updateOAuthServerConfigBatch:U,updateNameSeparator:M,updateSessionRebuild:q,exportMCPSettings:de,refreshBearerKeys:ee,createBearerKey:X,updateBearerKey:he,deleteBearerKey:se};return t.jsx(H0.Provider,{value:ye,children:a})},q0=()=>{const{t:a}=ve(),{theme:n,setTheme:l}=Aj(),o=()=>{l(n==="light"?"dark":"light")};return t.jsx("button",{onClick:o,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 focus:outline-none",title:a(n==="light"?"theme.dark":"theme.light"),"aria-label":a(n==="light"?"theme.dark":"theme.light"),children:n==="light"?t.jsx(Cw,{className:"h-5 w-5"}):t.jsx(Uw,{className:"h-5 w-5"})})},Mj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:2,...a,children:[t.jsx("title",{children:n("common.language")}),t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2 12h20"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})]})},G0=()=>{const{i18n:a}=ve(),[n,l]=x.useState(!1),[o,c]=x.useState(a.language),u=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"fr",label:"Français"},{code:"tr",label:"Türkçe"}];x.useEffect(()=>{c(a.language)},[a.language]),x.useEffect(()=>{const f=h=>{h.target.closest(".language-dropdown")||l(!1)};return n&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[n]);const m=f=>{localStorage.setItem("i18nextLng",f),l(!1),window.location.reload()},g=()=>{l(!n)};return t.jsxs("div",{className:"relative language-dropdown",children:[t.jsx("button",{onClick:g,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 focus:outline-none","aria-label":"Language Switcher",children:t.jsx(Mj,{className:"h-5 w-5"})}),n&&t.jsx("div",{className:"absolute right-0 mt-2 w-24 bg-white dark:bg-gray-800 rounded-md shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:t.jsx("div",{children:u.map(f=>t.jsx("button",{onClick:()=>m(f.code),className:`flex items-center w-full px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${o.startsWith(f.code)?"bg-blue-50 text-blue-700":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-100"}`,children:f.label},f.code))})})]})},Pj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("common.github")}),t.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})},Dj=async()=>{try{const a=await Be("/logs");if(!a.success)throw new Error(a.error||"Failed to fetch logs");return a.data}catch(a){throw console.error("Error fetching logs",{error:a}),a}},Lj=async()=>{try{const a=await Yr("/logs");if(!a.success)throw new Error(a.error||"Failed to clear logs")}catch(a){throw console.error("Error clearing logs",{error:a}),a}};class Uj{constructor(){ea(this,"eventSource",null);ea(this,"subscribers",new Set);ea(this,"reconnectTimer",null);ea(this,"openAttempts",0)}subscribe(n){return this.subscribers.add(n),this.subscribers.size===1&&(this.openAttempts=0,this.openEventSource()),()=>{this.subscribers.delete(n),this.subscribers.size===0&&this.close()}}openEventSource(){this.closeEventSource();const n=Rn();if(!n){console.warn("[LogStreamManager] No token available, scheduling reconnect..."),this.scheduleReconnect();return}try{const l=Cd(`/logs/stream?token=${n}`);let o=l;try{const c=new URL(l);c.search="",o=c.toString()}catch{o=l.split("?")[0]||l}console.log("[LogStreamManager] Opening EventSource:",o),this.eventSource=new EventSource(l),this.eventSource.onmessage=c=>{this.subscribers.forEach(u=>u(c))},this.eventSource.onerror=()=>{console.warn("[LogStreamManager] EventSource error, attempting reconnect..."),this.closeEventSource(),this.subscribers.size>0&&this.scheduleReconnect()},this.openAttempts=0,console.log("[LogStreamManager] EventSource opened successfully")}catch(l){console.error("[LogStreamManager] Failed to open EventSource:",l),this.closeEventSource(),this.subscribers.size>0&&this.scheduleReconnect()}}closeEventSource(){this.eventSource&&(this.eventSource.close(),this.eventSource=null)}scheduleReconnect(){if(this.reconnectTimer!==null)return;const n=Math.min(1e3*Math.pow(2,this.openAttempts),8e3);this.openAttempts++,console.log(`[LogStreamManager] Scheduling reconnect in ${n}ms (attempt ${this.openAttempts})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.subscribers.size>0&&this.openEventSource()},n)}close(){this.closeEventSource(),this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}const Md=new Uj,_j=()=>{const[a,n]=x.useState([]),[l,o]=x.useState(!0),[c,u]=x.useState(null);return x.useEffect(()=>{let g=!0;(async()=>{try{const y=await Dj();g&&(n(y),o(!1))}catch(y){g&&(u(y instanceof Error?y:new Error("Failed to fetch logs")),o(!1))}})();const h=y=>{if(g)try{const w=JSON.parse(y.data);if(w.type==="initial")return;w.type==="log"&&n(N=>[...N,w.log])}catch(w){console.error("Error parsing SSE message",{err:w})}},b=Md.subscribe(h);return()=>{g=!1,b()}},[]),{logs:a,loading:l,error:c,clearLogs:async()=>{try{await Lj(),n([])}catch(g){u(g instanceof Error?g:new Error("Failed to clear logs"))}}}},Bj=5e3,K0=x.createContext(void 0),Ij=a=>!!a&&typeof a.serverName=="string"&&typeof a.current=="number"&&typeof a.total=="number"&&a.total>0&&a.current>=0&&a.current<=a.total&&["started","in_progress","completed","error"].includes(String(a.status)),Fj=({children:a})=>{const[n,l]=x.useState([]),o=x.useRef(new Map);x.useEffect(()=>{const u=y=>{const w=o.current.get(y);w&&(clearTimeout(w),o.current.delete(y))},m=()=>{o.current.forEach(y=>clearTimeout(y)),o.current.clear()},g=y=>{l(w=>{const N=w.findIndex(j=>j.serverName===y.serverName);if(N===-1)return[...w,y];const S=[...w];return S[N]=y,S})},f=y=>{l(w=>w.filter(N=>N.serverName!==y))},h=y=>{try{const w=JSON.parse(y.data);if((w==null?void 0:w.type)!=="embedding-sync-progress"||!Ij(w.progress))return;if(u(w.progress.serverName),w.progress.status==="error"){f(w.progress.serverName);return}const N={serverName:w.progress.serverName,current:w.progress.current,total:w.progress.total,status:w.progress.status};if(g(N),w.progress.status==="completed"){const S=setTimeout(()=>{f(w.progress.serverName),o.current.delete(w.progress.serverName)},Bj);o.current.set(w.progress.serverName,S)}}catch{}},b=Md.subscribe(h);return()=>{m(),b()}},[]);const c=x.useMemo(()=>({activeSyncs:n}),[n]);return t.jsx(K0.Provider,{value:c,children:a})},Hj=()=>{const a=x.useContext(K0);if(!a)throw new Error("useEmbeddingSync must be used within an EmbeddingSyncProvider");return a},qj=({onToggleSidebar:a})=>{const{t:n}=ve(),{activeSyncs:l}=Hj();return t.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm z-10",children:t.jsxs("div",{className:"flex items-center gap-4 px-3 py-3",children:[t.jsxs("div",{className:"flex items-center shrink-0",children:[t.jsx("button",{onClick:a,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none","aria-label":n("app.toggleSidebar"),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),t.jsx("h1",{className:"ml-4 text-xl font-bold text-gray-900 dark:text-white",children:n("app.title")})]}),t.jsx("div",{className:"flex flex-1 justify-center px-2 min-w-0",children:l.length>0&&t.jsx("div",{className:"flex max-w-full flex-wrap justify-center gap-2",children:l.map(o=>t.jsxs("div",{className:"flex min-w-0 w-56 max-w-full flex-col rounded-md bg-blue-50 px-3 py-2 text-xs text-blue-900 dark:bg-gray-700 dark:text-blue-100",title:n("app.embeddingSyncProgressAriaLabel",{serverName:o.serverName,current:o.current,total:o.total}),children:[t.jsx("span",{className:"truncate font-medium",children:n("app.embeddingSyncProgress",{serverName:o.serverName})}),t.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[t.jsx("progress",{className:"h-2 flex-1",value:o.current,max:o.total,"aria-label":n("app.embeddingSyncProgressAriaLabel",{serverName:o.serverName,current:o.current,total:o.total})}),t.jsxs("span",{className:"shrink-0 tabular-nums",children:[o.current,"/",o.total]})]})]},o.serverName))})}),t.jsxs("div",{className:"flex items-center space-x-1 shrink-0",children:[t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 mr-2",children:"v0.12.16"}),t.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800","aria-label":"GitHub Repository",children:t.jsx(Pj,{className:"h-5 w-5"})}),t.jsx("a",{href:"https://docs.mcphub.app",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800","aria-label":"Documentation",children:t.jsx(y0,{className:"h-5 w-5"})}),t.jsx(q0,{}),t.jsx(G0,{})]})]})})},os=({permissions:a,fallback:n=null,children:l})=>V0(a)?t.jsx(t.Fragment,{children:l}):t.jsx(t.Fragment,{children:n}),V0=a=>{const{auth:n}=ca();if(!n.isAuthenticated||!n.user)return!1;const l=n.user.permissions||[];return a==="x"&&!l.includes("x")?!1:l.includes("*")||n.user.isAdmin?!0:(Array.isArray(a)?a:[a]).some(c=>l.includes(c))},Gj="https://registry.npmjs.org",Kj="@samanhappy/mcphub",$0=async()=>{try{const a=await fetch(`${Gj}/${Kj}/latest`);if(!a.ok)throw new Error(`Failed to fetch latest version: ${a.status}`);return(await a.json()).version||null}catch(a){return console.error("Error checking for latest version:",a),null}},Y0=(a,n)=>{if(a==="dev")return-1;const l=a.split(".").map(Number),o=n.split(".").map(Number);for(let c=0;c<3;c++){const u=l[c]||0,m=o[c]||0;if(u>m)return-1;if(u<m)return 1}return 0},Vj=({isOpen:a,onClose:n,version:l})=>{const{t:o}=ve(),[c,u]=x.useState(!1),[m,g]=x.useState(""),[f,h]=x.useState(!1),b=async()=>{h(!0);try{const y=await $0();y&&(g(y),u(Y0(l,y)>0))}catch(y){console.error("Failed to check for updates:",y)}finally{h(!1)}};return x.useEffect(()=>{a&&b()},[a,l]),a?t.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-30 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6 relative",children:[t.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":o("common.close"),children:t.jsx(Ma,{className:"h-5 w-5"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:o("about.title")}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:[o("about.currentVersion"),":"]}),t.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:l})]}),c&&m&&t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900 p-3 rounded",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"ml-3 flex-1 text-sm text-blue-700 dark:text-blue-300",children:[t.jsx("p",{children:o("about.newVersionAvailable",{version:m})}),t.jsx("p",{className:"mt-1",children:t.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",children:o("about.viewOnGitHub")})})]})]})}),t.jsxs("button",{onClick:b,disabled:f,className:`mt-4 inline-flex items-center px-4 py-2 border border-gray-200 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium btn-secondary
|
|
231
|
+
${f?"text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600"} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`,children:[t.jsx(Tw,{className:`h-4 w-4 mr-2 ${f?"animate-spin":""}`}),o(f?"about.checking":"about.checkForUpdates")]})]})]})})}):null},$j=({open:a,onOpenChange:n})=>{const{i18n:l,t:o}=ve();return a?t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6 relative",children:[t.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":o("common.close"),children:t.jsx(Ma,{className:"h-5 w-5"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:o("sponsor.title")}),t.jsx("div",{className:"flex flex-col items-center justify-center py-4",children:l.language==="zh"?t.jsx("img",{src:"./assets/reward.png",alt:o("sponsor.rewardAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}):t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"mb-4 text-gray-700 dark:text-gray-300",children:o("sponsor.supportMessage")}),t.jsx("a",{href:"https://ko-fi.com/samanhappy",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center bg-[#13C3FF] text-white px-4 py-2 rounded-md hover:bg-[#00A5E5] transition-colors",children:o("sponsor.supportButton")})]})})]})})}):null},Yj=({open:a,onOpenChange:n})=>{const{t:l}=ve();return a?t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6 relative",children:[t.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":l("common.close"),children:t.jsx(Ma,{className:"h-5 w-5"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:l("wechat.title")}),t.jsxs("div",{className:"flex flex-col items-center justify-center py-4",children:[t.jsx("img",{src:"./assets/wexin.png",alt:l("wechat.qrCodeAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}),t.jsx("p",{className:"mt-4 text-center text-gray-700 dark:text-gray-300",children:l("wechat.scanMessage")})]})]})})}):null},Jj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("common.wechat")}),t.jsx("path",{d:"M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"})]})},Qj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("common.discord")}),t.jsx("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]})},Xj=a=>{const{t:n}=ve();return t.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...a,children:[t.jsx("title",{children:n("sponsor.label")}),t.jsx("path",{d:"M17.625 1.499c-2.32 0-4.354 1.203-5.625 3.03-1.271-1.827-3.305-3.03-5.625-3.03C3.129 1.499 0 4.253 0 8.249c0 4.275 3.068 7.847 5.828 10.227a33.14 33.14 0 0 0 5.616 3.876l.028.017.008.003-.001.003c.163.085.342.126.521.125.179.001.358-.041.521-.125l-.001-.003.008-.003.028-.017a33.14 33.14 0 0 0 5.616-3.876C20.932 16.096 24 12.524 24 8.249c0-3.996-3.129-6.75-6.375-6.75zm-.919 15.275a30.766 30.766 0 0 1-4.703 3.316l-.004-.002-.004.002a30.955 30.955 0 0 1-4.703-3.316c-2.677-2.307-5.047-5.298-5.047-8.523 0-2.754 2.121-4.5 4.125-4.5 2.06 0 3.914 1.479 4.544 3.684.143.495.596.797 1.086.796.49.001.943-.302 1.085-.796.63-2.205 2.484-3.684 4.544-3.684 2.004 0 4.125 1.746 4.125 4.5 0 3.225-2.37 6.216-5.048 8.523z"})]})},Zj=({collapsed:a,version:n})=>{var R;const{t:l,i18n:o}=ve(),c=oa(),{auth:u,logout:m}=ca(),[g,f]=x.useState(!1),[h,b]=x.useState(!1),[y,w]=x.useState(!1),[N,S]=x.useState(!1),[j,C]=x.useState(!1),z=x.useRef(null);x.useEffect(()=>{(async()=>{try{const P=await $0();P&&b(Y0(n,P)>0)}catch(P){console.error("Error checking for new version:",P)}})()},[n]),x.useEffect(()=>{const _=P=>{z.current&&!z.current.contains(P.target)&&f(!1)};return document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[]);const E=()=>{c("/settings"),f(!1)},T=()=>{m(),c("/login")},B=()=>{w(!0),f(!1)},D=()=>{S(!0),f(!1)},Y=()=>{C(!0),f(!1)};return t.jsxs("div",{ref:z,className:"relative",children:[t.jsxs("button",{onClick:()=>f(!g),className:`flex ${a?"justify-center":"items-center"} w-full p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors rounded-md ${g?"bg-gray-100 dark:bg-gray-700":""}`,children:[t.jsxs("div",{className:"flex-shrink-0 relative",children:[t.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700",children:t.jsx(N0,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})}),h&&t.jsx("span",{className:"absolute -top-1 -right-1 block w-2 h-2 bg-red-500 rounded-full"})]}),!a&&t.jsx("div",{className:"ml-3 flex flex-col items-start",children:t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:((R=u.user)==null?void 0:R.username)||l("auth.user")})})]}),g&&t.jsxs("div",{className:"absolute top-0 transform -translate-y-full left-0 w-full min-w-max bg-white border border-gray-200 dark:border-gray-700 dark:bg-gray-800 z-50",children:[t.jsxs("button",{onClick:D,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Xj,{className:"h-4 w-4 mr-2"}),l("sponsor.label")]}),o.language==="zh"?t.jsxs("button",{onClick:Y,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Jj,{className:"h-4 w-4 mr-2"}),l("wechat.label")]}):t.jsxs("a",{href:"https://discord.gg/qMKNsn5Q",target:"_blank",rel:"noopener noreferrer",className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Qj,{className:"h-4 w-4 mr-2"}),l("discord.label")]}),t.jsxs("button",{onClick:E,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Pw,{className:"h-4 w-4 mr-2"}),l("nav.settings")]}),t.jsxs("button",{onClick:B,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 relative",children:[t.jsx(yw,{className:"h-4 w-4 mr-2"}),l("about.title"),h&&t.jsx("span",{className:"absolute top-2 right-4 block w-2 h-2 bg-red-500 rounded-full"})]}),t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600"}),t.jsxs("button",{onClick:T,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx(Sw,{className:"h-4 w-4 mr-2"}),l("app.logout")]})]}),t.jsx(Vj,{isOpen:y,onClose:()=>w(!1),version:n}),t.jsx($j,{open:N,onOpenChange:S}),t.jsx(Yj,{open:j,onOpenChange:C})]})},Wj=async()=>{var a;try{const n=await Be("/activities/available");return((a=n==null?void 0:n.data)==null?void 0:a.available)||!1}catch(n){return console.error("Error checking activity availability:",n),!1}},eS=(a,n,l)=>{const o=new URLSearchParams;return o.append("page",a.toString()),o.append("limit",n.toString()),l!=null&&l.server&&o.append("server",l.server),l!=null&&l.tool&&o.append("tool",l.tool),l!=null&&l.status&&o.append("status",l.status),l!=null&&l.group&&o.append("group",l.group),l!=null&&l.keyId&&o.append("keyId",l.keyId),l!=null&&l.keyName&&o.append("keyName",l.keyName),l!=null&&l.startDate&&o.append("startDate",l.startDate),l!=null&&l.endDate&&o.append("endDate",l.endDate),o.toString()},tS=async(a,n,l)=>{const o=eS(a,n,l);return await Be(`/activities?${o}`)},rS=async a=>await Be(`/activities/${a}`),aS=async a=>{const n=new URLSearchParams;a!=null&&a.server&&n.append("server",a.server),a!=null&&a.tool&&n.append("tool",a.tool),a!=null&&a.status&&n.append("status",a.status),a!=null&&a.group&&n.append("group",a.group),a!=null&&a.keyId&&n.append("keyId",a.keyId),a!=null&&a.keyName&&n.append("keyName",a.keyName),a!=null&&a.startDate&&n.append("startDate",a.startDate),a!=null&&a.endDate&&n.append("endDate",a.endDate);const l=n.toString();return await Be(`/activities/stats${l?`?${l}`:""}`)},sS=async()=>await Be("/activities/filters"),nS=async(a=30)=>await Yr(`/activities/cleanup?daysOld=${a}`),lS=({collapsed:a})=>{var g,f;const{t:n}=ve(),{auth:l}=ca(),[o,c]=x.useState(!1),u="0.12.16";x.useEffect(()=>{Wj().then(c).catch(()=>c(!1))},[]);const m=[{path:"/",label:n("nav.dashboard"),icon:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[t.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),t.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]})},{path:"/servers",label:n("nav.servers"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm14 1a1 1 0 11-2 0 1 1 0 012 0zM2 13a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2v-2zm14 1a1 1 0 11-2 0 1 1 0 012 0z",clipRule:"evenodd"})})},{path:"/groups",label:n("nav.groups"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{d:"M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"})})},{path:"/prompts",label:n("nav.prompts"),icon:t.jsx(Nn,{className:"h-4 w-4"})},{path:"/resources",label:n("nav.resources"),icon:t.jsx(Sn,{className:"h-5 w-5"})},{path:"/market",label:n("nav.market"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{d:"M3 1a1 1 0 000 2h1.22l.305 1.222a.997.997 0 00.01.042l1.358 5.43-.893.892C3.74 11.846 4.632 14 6.414 14H15a1 1 0 000-2H6.414l1-1H14a1 1 0 00.894-.553l3-6A1 1 0 0017 3H6.28l-.31-1.243A1 1 0 005 1H3zM16 16.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})})},...(g=l.user)!=null&&g.isAdmin&&V0("x")?[{path:"/users",label:n("nav.users"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{d:"M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"})})}]:[],...o&&((f=l.user)!=null&&f.isAdmin)?[{path:"/activity",label:n("nav.activity"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}]:[],{path:"/logs",label:n("nav.logs"),icon:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z",clipRule:"evenodd"})})}];return t.jsxs("aside",{className:`bg-white dark:bg-gray-800 shadow-sm transition-all duration-300 ease-in-out flex flex-col h-full relative ${a?"w-16":"w-64"}`,children:[t.jsx("div",{className:"overflow-y-auto flex-grow",children:t.jsx("nav",{className:"p-3 space-y-1",children:m.map(h=>t.jsxs(s0,{to:h.path,className:({isActive:b})=>`flex items-center px-2.5 py-2 rounded-lg transition-colors duration-200
|
|
232
232
|
${b?"bg-blue-50 text-blue-700 dark:bg-gray-600 dark:text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,end:h.path==="/",children:[t.jsx("span",{className:"flex-shrink-0",children:h.icon}),!a&&t.jsx("span",{className:"ml-3",children:h.label})]},h.path))})}),t.jsx("div",{className:"p-3 bg-white dark:bg-gray-800",children:t.jsx(Zj,{collapsed:a,version:u})})]})},iS=({children:a})=>t.jsx("main",{className:"flex-1 overflow-auto p-6 bg-gray-100 dark:bg-gray-900",children:t.jsx("div",{className:"container mx-auto",children:a})}),oS=()=>{const[a,n]=Ra.useState(!1),l=()=>{n(!a)};return t.jsx(Fj,{children:t.jsxs("div",{className:"flex flex-col h-screen bg-gray-100 dark:bg-gray-900",children:[t.jsx(qj,{onToggleSidebar:l}),t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[t.jsx(lS,{collapsed:a}),t.jsx(iS,{children:t.jsx(Wh,{})})]})]})})},cS=({redirectPath:a="/login"})=>{const{t:n}=ve(),{auth:l}=ca();return l.loading?t.jsx("div",{className:"flex items-center justify-center h-screen",children:n("app.loading")}):l.isAuthenticated?t.jsx(Wh,{}):t.jsx(go,{to:a,replace:!0})},uS=({isOpen:a,onClose:n})=>{const{t:l}=ve(),o=oa();if(!a)return null;const c=()=>{n(),o("/settings"),setTimeout(()=>{const g=document.querySelector('[data-section="password"]');if(g){g.scrollIntoView({behavior:"smooth",block:"start"});const f=g.querySelector('[role="button"]');f&&!g.querySelector(".mt-4")&&f.click()}},100)},u=g=>{g.target===g.currentTarget&&n()},m=g=>{g.key==="Escape"&&n()};return t.jsx("div",{className:"fixed inset-0 bg-black/50 z-[100] flex items-center justify-center p-4",onClick:u,onKeyDown:m,tabIndex:-1,children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full transform transition-all duration-200 ease-out",role:"dialog","aria-modal":"true","aria-labelledby":"password-warning-title","aria-describedby":"password-warning-message",children:t.jsxs("div",{className:"p-6",children:[t.jsxs("div",{className:"flex items-start space-x-3",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"w-6 h-6 text-yellow-600 dark:text-yellow-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h3",{id:"password-warning-title",className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:l("auth.defaultPasswordWarning")}),t.jsx("p",{id:"password-warning-message",className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:l("auth.defaultPasswordMessage")})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[t.jsx("button",{onClick:n,className:"px-4 py-2 text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-white hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 rounded-md transition-colors duration-150 btn-secondary",children:l("common.cancel")}),t.jsx("button",{onClick:c,className:"px-4 py-2 bg-yellow-600 hover:bg-yellow-700 text-white rounded-md transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500 btn-warning",autoFocus:!0,children:l("auth.goToSettings")})]})]})})})},dS=a=>{if(!a)return null;try{const n=typeof window<"u"?window.location.origin:"http://localhost",l=new URL(a,n);return l.origin!==n?null:`${l.pathname}${l.search}${l.hash}`||"/"}catch{return a.startsWith("/")&&!a.startsWith("//")?a:null}},mS=()=>{const{t:a}=ve(),[n,l]=x.useState(""),[o,c]=x.useState(""),[u,m]=x.useState(null),[g,f]=x.useState(!1),[h,b]=x.useState(null),[y,w]=x.useState(null),[N,S]=x.useState(void 0),[j,C]=x.useState({google:!1,github:!1}),[z,E]=x.useState(!1),{login:T,auth:B}=ca(),D=ia(),Y=oa(),R=x.useMemo(()=>{const L=new URLSearchParams(D.search);return dS(L.get("returnUrl"))},[D.search]),_=x.useCallback(L=>{if(!L)return!1;const Z=L.toLowerCase();return Z.includes("failed to fetch")||Z.includes("networkerror")||Z.includes("network error")||Z.includes("connection refused")||Z.includes("unable to connect")||Z.includes("fetch error")||Z.includes("econnrefused")||Z.includes("http 500")||Z.includes("internal server error")||Z.includes("proxy error")},[]),P=x.useCallback(()=>{if(!R)return"/";if(!R.startsWith("/oauth/authorize"))return R;const L=Rn();if(!L)return R;try{const Z=window.location.origin,A=new URL(R,Z);return A.searchParams.set("token",L),`${A.pathname}${A.search}${A.hash}`}catch{const Z=R.includes("?")?"&":"?";return`${R}${Z}token=${encodeURIComponent(L)}`}},[R]),V=x.useCallback(()=>{R?window.location.assign(P()):Y("/")},[P,Y,R]);x.useEffect(()=>{!B.loading&&B.isAuthenticated&&V()},[B.isAuthenticated,B.loading,V]),x.useEffect(()=>{(async()=>{var H,J,me,le;const A=(await m0()).betterAuth;if(!(A!=null&&A.enabled)){C({google:!1,github:!1});return}S(A.basePath),C({google:((J=(H=A.providers)==null?void 0:H.google)==null?void 0:J.enabled)===!0,github:((le=(me=A.providers)==null?void 0:me.github)==null?void 0:le.enabled)===!0})})()},[]);const K=async L=>{L.preventDefault(),m(null),w(null),f(!0);try{if(!n||!o){m(a("auth.emptyFields")),f(!1);return}const Z=await T(n,o);if(Z.success)Z.isUsingDefaultPassword?E(!0):V();else{const A=Z.message;_(A)?m(a("auth.serverUnavailable")):m(a("auth.loginFailed"))}}catch(Z){const A=Z instanceof Error?Z.message:void 0;_(A)?m(a("auth.serverUnavailable")):m(a("auth.loginError"))}finally{f(!1)}},G=async L=>{w(null),b(L);try{await d0(N).signIn.social({provider:L,callbackURL:R||"/",errorCallbackURL:`${Pl()}/login`})}catch(Z){console.error("Social login error:",Z),w(a("auth.socialLoginFailed")),b(null)}},I=()=>{E(!1),V()};return t.jsxs("div",{className:"relative min-h-screen w-full overflow-hidden bg-gray-50 dark:bg-gray-950",children:[t.jsxs("div",{className:"absolute top-4 right-4 z-20 flex items-center gap-2",children:[t.jsx("a",{href:"https://docs.mcphub.app",target:"_blank",rel:"noopener noreferrer",className:"rounded-md p-2 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200","aria-label":"Documentation",children:t.jsx(y0,{className:"h-5 w-5"})}),t.jsx(q0,{}),t.jsx(G0,{})]}),t.jsx("div",{className:"pointer-events-none absolute inset-0 -z-10 opacity-60 dark:opacity-70",style:{backgroundImage:"radial-gradient(60rem 60rem at 20% -10%, rgba(99,102,241,0.25), transparent), radial-gradient(50rem 50rem at 120% 10%, rgba(168,85,247,0.15), transparent)"}}),t.jsx("div",{className:"pointer-events-none absolute inset-0 -z-10",children:t.jsxs("svg",{className:"h-full w-full opacity-[0.08] dark:opacity-[0.12]",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("defs",{children:t.jsx("pattern",{id:"grid",width:"32",height:"32",patternUnits:"userSpaceOnUse",children:t.jsx("path",{d:"M 32 0 L 0 0 0 32",fill:"none",stroke:"currentColor",strokeWidth:"0.5"})})}),t.jsx("rect",{width:"100%",height:"100%",fill:"url(#grid)",className:"text-gray-400 dark:text-gray-300"})]})}),t.jsx("div",{className:"relative mx-auto flex min-h-screen w-full max-w-md items-center justify-center px-6 py-16",children:t.jsxs("div",{className:"w-full space-y-16",children:[t.jsx("div",{className:"flex justify-center w-full",children:t.jsx("h1",{className:"text-5xl sm:text-5xl font-extrabold leading-tight tracking-tight text-gray-900 dark:text-white whitespace-nowrap",children:t.jsx("span",{className:"bg-gradient-to-r from-indigo-400 via-cyan-400 to-emerald-400 bg-clip-text text-transparent",children:a("auth.slogan")})})}),t.jsxs("div",{className:"login-card relative w-full rounded-2xl border border-white/10 bg-white/60 p-8 shadow-xl backdrop-blur-md transition dark:border-white/10 dark:bg-gray-900/60",children:[t.jsx("div",{className:"absolute -top-24 right-12 h-40 w-40 -translate-y-6 rounded-full bg-indigo-500/30 blur-3xl"}),t.jsx("div",{className:"absolute -bottom-24 -left-12 h-40 w-40 translate-y-6 rounded-full bg-cyan-500/20 blur-3xl"}),t.jsxs("form",{className:"mt-4 space-y-4",onSubmit:K,children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"sr-only",children:a("auth.username")}),t.jsx("input",{id:"username",name:"username",type:"text",autoComplete:"username",required:!0,className:"login-input appearance-none relative block w-full rounded-md border border-gray-300/60 bg-white/70 px-3 py-3 text-gray-900 shadow-sm outline-none ring-0 transition-all placeholder:text-gray-500 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500 dark:border-gray-700/60 dark:bg-gray-800/70 dark:text-white dark:placeholder:text-gray-400",placeholder:a("auth.username"),value:n,onChange:L=>l(L.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"sr-only",children:a("auth.password")}),t.jsx("input",{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,className:"login-input appearance-none relative block w-full rounded-md border border-gray-300/60 bg-white/70 px-3 py-3 text-gray-900 shadow-sm outline-none ring-0 transition-all placeholder:text-gray-500 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500 dark:border-gray-700/60 dark:bg-gray-800/70 dark:text-white dark:placeholder:text-gray-400",placeholder:a("auth.password"),value:o,onChange:L=>c(L.target.value)})]})]}),u&&t.jsx("div",{className:"error-box rounded border border-red-500/20 bg-red-500/10 p-2 text-center text-sm text-red-600 dark:text-red-400",children:u}),t.jsx("div",{children:t.jsx("button",{type:"submit",disabled:g,className:"login-button btn-primary group relative flex w-full items-center justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white transition-all hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-70",children:a(g?"auth.loggingIn":"auth.login")})})]}),(j.google||j.github)&&t.jsxs("div",{className:"mt-6 space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"h-px flex-1 bg-gray-200/80 dark:bg-gray-700/80"}),t.jsx("span",{className:"text-xs uppercase tracking-widest text-gray-500 dark:text-gray-400",children:a("auth.orContinue")}),t.jsx("div",{className:"h-px flex-1 bg-gray-200/80 dark:bg-gray-700/80"})]}),y&&t.jsx("div",{className:"error-box rounded border border-red-500/20 bg-red-500/10 p-2 text-center text-sm text-red-600 dark:text-red-400",children:y}),t.jsxs("div",{className:"space-y-3",children:[j.google&&t.jsx("button",{type:"button",onClick:()=>G("google"),disabled:h!==null,className:"flex w-full items-center justify-center gap-2 rounded-md border border-gray-200 bg-white/80 px-4 py-2 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 dark:hover:bg-gray-700 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:bg-gray-900/70 dark:text-gray-200",children:a(h==="google"?"auth.loggingIn":"auth.loginWithGoogle")}),j.github&&t.jsx("button",{type:"button",onClick:()=>G("github"),disabled:h!==null,className:"flex w-full items-center justify-center gap-2 rounded-md border border-gray-200 bg-gray-900 px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700",children:a(h==="github"?"auth.loggingIn":"auth.loginWithGithub")})]})]})]})]})}),t.jsx(uS,{isOpen:z,onClose:I})]})},Dl=a=>{const n=F0(),{refreshIfNeeded:l}=n;return x.useEffect(()=>{a!=null&&a.refreshOnMount&&l()},[a==null?void 0:a.refreshOnMount,l]),n},pS=()=>{const{t:a}=ve(),{allServers:n,error:l,setError:o,isLoading:c}=Dl({refreshOnMount:!0}),[u,m]=Ra.useState(!1),g=Ra.useRef(!1);Ra.useEffect(()=>{if(c){g.current=!0;return}if(g.current){m(!0);return}(n.length>0||l)&&m(!0)},[c,n.length,l]);const f=!u,h={total:n.length,online:n.filter(y=>y.status==="connected").length,disabled:n.filter(y=>y.enabled===!1).length,offline:n.filter(y=>y.status==="disconnected"&&y.enabled!==!1).length,connecting:n.filter(y=>y.status==="connecting").length,oauthRequired:n.filter(y=>y.status==="oauth_required").length},b={connected:"status.online",disconnected:"status.offline",connecting:"status.connecting",oauth_required:"status.oauthRequired"};return t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-8",children:a("pages.dashboard.title")}),l&&t.jsx("div",{className:"mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded shadow-sm error-box",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-status-red text-lg font-medium",children:a("app.error")}),t.jsx("p",{className:"text-gray-600 mt-1",children:l})]}),t.jsx("button",{onClick:()=>o(null),className:"ml-4 text-gray-500 hover:text-gray-700 transition-colors duration-200","aria-label":a("app.closeButton"),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 011.414 0L10 8.586l4.293-4.293a1 1 111.414 1.414L11.414 10l4.293 4.293a1 1 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 01-1.414-1.414L8.586 10 4.293 5.707a1 1 010-1.414z",clipRule:"evenodd"})})})]})}),f&&t.jsxs("div",{className:"space-y-8","aria-busy":"true","aria-live":"polite",children:[t.jsx("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-5",children:Array.from({length:5}).map((y,w)=>t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 dashboard-card",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"h-14 w-14 rounded-full bg-gray-200 animate-pulse"}),t.jsxs("div",{className:"ml-4 flex-1 space-y-3",children:[t.jsx("div",{className:"h-4 w-32 rounded bg-gray-200 animate-pulse"}),t.jsx("div",{className:"h-8 w-20 rounded bg-gray-200 animate-pulse"})]})]})},`stats-skeleton-${w}`))}),t.jsxs("div",{children:[t.jsx("div",{className:"h-6 w-40 rounded bg-gray-200 animate-pulse mb-4"}),t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden table-container",children:t.jsx("div",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:Array.from({length:5}).map((y,w)=>t.jsx("div",{className:"px-6 py-4",children:t.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[t.jsx("div",{className:"h-4 w-28 rounded bg-gray-200 animate-pulse"}),t.jsx("div",{className:"h-4 w-24 rounded bg-gray-200 animate-pulse"}),t.jsx("div",{className:"h-4 w-12 rounded bg-gray-200 animate-pulse"}),t.jsx("div",{className:"h-4 w-12 rounded bg-gray-200 animate-pulse"}),t.jsx("div",{className:"h-4 w-12 rounded bg-gray-200 animate-pulse"}),t.jsx("div",{className:"h-4 w-10 rounded bg-gray-200 animate-pulse"})]})},`row-skeleton-${w}`))})})]})]}),!f&&t.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-5",children:[t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 dashboard-card",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-3 rounded-full bg-blue-100 text-blue-800 icon-container status-icon-blue",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"})})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-700",children:a("pages.dashboard.totalServers")}),t.jsx("p",{className:"text-3xl font-bold text-gray-900",children:h.total})]})]})}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 dashboard-card",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-3 rounded-full bg-green-100 text-green-800 icon-container status-icon-green",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-700",children:a("pages.dashboard.onlineServers")}),t.jsx("p",{className:"text-3xl font-bold text-gray-900",children:h.online})]})]})}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 dashboard-card",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-3 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-700 icon-container",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 9v6m4-6v6m7-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-700",children:a("pages.dashboard.disabledServers")}),t.jsx("p",{className:"text-3xl font-bold text-gray-900",children:h.disabled})]})]})}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 dashboard-card",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-3 rounded-full bg-red-100 text-red-800 icon-container status-icon-red",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-700",children:a("pages.dashboard.offlineServers")}),t.jsx("p",{className:"text-3xl font-bold text-gray-900",children:h.offline})]})]})}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-6 dashboard-card",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"p-3 rounded-full bg-yellow-100 text-yellow-800 icon-container status-icon-yellow",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-700",children:a("pages.dashboard.connectingServers")}),t.jsx("p",{className:"text-3xl font-bold text-gray-900",children:h.connecting})]})]})})]}),n.length>0&&!f&&t.jsxs("div",{className:"mt-8",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:a("pages.dashboard.recentServers")}),t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden table-container",children:t.jsxs("table",{className:"min-w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("server.name")}),t.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("server.status")}),t.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("server.tools")}),t.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("server.prompts")}),t.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("nav.resources")}),t.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("server.enabled")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.slice(0,5).map((y,w)=>{var N,S,j;return t.jsxs("tr",{children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:y.name}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.jsxs("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${y.status==="connected"?"status-badge-online":y.status==="disconnected"?"status-badge-offline":y.status==="oauth_required"?"status-badge-oauth-required":"status-badge-connecting"}`,children:[y.status==="oauth_required"&&"🔐 ",a(b[y.status]||y.status)]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:((N=y.tools)==null?void 0:N.length)||0}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:((S=y.prompts)==null?void 0:S.length)||0}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:((j=y.resources)==null?void 0:j.length)||0}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:y.enabled!==!1?t.jsx("span",{className:"text-green-600",children:"✓"}):t.jsx("span",{className:"text-gray-500","aria-label":a("pages.dashboard.disabledServers"),children:"⏸"})})]},w)})})]})})]})]})},gS="modulepreload",fS=function(a,n){return new URL(a,n).href},ih={},ro=function(n,l,o){let c=Promise.resolve();if(l&&l.length>0){let m=function(b){return Promise.all(b.map(y=>Promise.resolve(y).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};const g=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));c=m(l.map(b=>{if(b=fS(b,o),b in ih)return;ih[b]=!0;const y=b.endsWith(".css"),w=y?'[rel="stylesheet"]':"";if(!!o)for(let j=g.length-1;j>=0;j--){const C=g[j];if(C.href===b&&(!y||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${w}`))return;const S=document.createElement("link");if(S.rel=y?"stylesheet":gS,y||(S.as="script"),S.crossOrigin="",S.href=b,h&&S.setAttribute("nonce",h),document.head.appendChild(S),y)return new Promise((j,C)=>{S.addEventListener("load",j),S.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${b}`)))})}))}function u(m){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=m,window.dispatchEvent(g),!g.defaultPrevented)throw m}return c.then(m=>{for(const g of m||[])g.status==="rejected"&&u(g.reason);return n().catch(u)})},hS={default:"bg-blue-500 text-white hover:bg-blue-600",secondary:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600",outline:"bg-transparent border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",destructive:"bg-red-500 text-white hover:bg-red-600"};function ao({children:a,variant:n="default",className:l,onClick:o}){return t.jsx("span",{className:la("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors",hS[n],o?"cursor-pointer":"",l),onClick:o,children:a})}const xS=({status:a,onAuthClick:n})=>{const{t:l}=ve(),o={connecting:"status-badge-connecting",connected:"status-badge-online",disconnected:"status-badge-offline",oauth_required:"status-badge-oauth-required"},c={connected:"status.online",disconnected:"status.offline",connecting:"status.connecting",oauth_required:"status.oauthRequired"},u=a==="oauth_required";return t.jsxs("span",{className:`px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${o[a]} ${u&&n?"cursor-pointer hover:opacity-80":""}`,onClick:u&&n?m=>n(m):void 0,title:u?l("status.clickToAuthorize"):void 0,children:[u&&"🔐 ",l(c[a]||a)]})},J0=async(a,n)=>{try{const l=n?`/tools/${encodeURIComponent(n)}/${encodeURIComponent(a.toolName)}`:"/tools/call",o=await pt(l,a.arguments,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return o.success===!1?{success:!1,error:o.message||"Tool call failed"}:{success:!0,content:(o==null?void 0:o.content)||[]}}catch(l){return console.error("Error calling tool",{toolName:a.toolName,server:n,error:l}),{success:!1,error:l instanceof Error?l.message:"Unknown error occurred"}}},yS=async(a,n,l)=>{try{const o=await pt(`/servers/${encodeURIComponent(a)}/tools/${encodeURIComponent(n)}/toggle`,{enabled:l},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:o.success,error:o.success?void 0:o.message}}catch(o){return console.error("Error toggling tool",{serverName:a,toolName:n,enabled:l,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},Q0=async(a,n,l)=>{try{const o=await At(`/servers/${encodeURIComponent(a)}/tools/${encodeURIComponent(n)}/description`,{description:l},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:o.success,error:o.success?void 0:o.message}}catch(o){return console.error("Error updating tool description",{serverName:a,toolName:n,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},X0=async(a,n)=>{var l;try{const o=await Yr(`/servers/${encodeURIComponent(a)}/tools/${encodeURIComponent(n)}/description`,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:o.success,error:o.success?void 0:o.message,description:(l=o.data)==null?void 0:l.description}}catch(o){return console.error("Error resetting tool description",{serverName:a,toolName:n,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},bS=Object.freeze(Object.defineProperty({__proto__:null,callTool:J0,resetToolDescription:X0,toggleTool:yS,updateToolDescription:Q0},Symbol.toStringTag,{value:"Module"})),Os=()=>Oj(),Jt=({checked:a,onCheckedChange:n,disabled:l=!1})=>t.jsx("button",{type:"button",role:"switch","aria-checked":a,disabled:l,className:la("relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",a?"bg-blue-200":"bg-gray-100",l?"opacity-50 cursor-not-allowed":"cursor-pointer"),onClick:()=>!l&&n(!a),children:t.jsx("span",{className:la("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",a?"translate-x-6":"translate-x-1")})}),Z0=({schema:a,onSubmit:n,onCancel:l,loading:o=!1,storageKey:c,title:u})=>{const{t:m}=ve(),[g,f]=x.useState({}),[h,b]=x.useState({}),[y,w]=x.useState(!1),[N,S]=x.useState(""),[j,C]=x.useState(""),z=x.useMemo(()=>(G=>{const I=L=>{if(typeof L=="object"&&L!==null){const Z=L;return{type:Z.type||"string",description:Z.description,enum:Z.enum,default:Z.default,properties:Z.properties?Object.fromEntries(Object.entries(Z.properties).map(([A,H])=>[A,I(H)])):void 0,required:Z.required,items:Z.items?I(Z.items):void 0}}return{type:"string"}};return{type:G.type,properties:G.properties?Object.fromEntries(Object.entries(G.properties).map(([L,Z])=>[L,I(Z)])):void 0,required:G.required}})(a),[a]);x.useEffect(()=>{const K=(I,L="")=>{const Z={};return I.type==="object"&&I.properties&&Object.entries(I.properties).forEach(([A,H])=>{const J=L?`${L}.${A}`:A;H.default!==void 0?Z[A]=H.default:H.type==="string"?Z[A]="":H.type==="number"||H.type==="integer"?Z[A]=0:H.type==="boolean"?Z[A]=!1:H.type==="array"?Z[A]=[]:H.type==="object"&&(H.properties?Z[A]=K(H,J):Z[A]={})}),Z};let G=K(z);if(c)try{const I=localStorage.getItem(c);if(I){const L=JSON.parse(I);G={...G,...L}}}catch(I){console.warn("Failed to load saved form data:",I)}f(G)},[z,c]),x.useEffect(()=>{y&&Object.keys(g).length>0&&(S(JSON.stringify(g,null,2)),C(""))},[y,g]);const E=K=>{S(K),C("");try{const G=JSON.parse(K);if(f(G),c)try{localStorage.setItem(c,JSON.stringify(G))}catch(I){console.warn("Failed to save form data to localStorage:",I)}}catch{C(m("tool.invalidJsonFormat"))}},T=()=>{S(JSON.stringify(g,null,2)),C(""),w(!0)},B=()=>{if(N.trim())try{const K=JSON.parse(N);f(K),C(""),w(!1)}catch{C(m("tool.fixJsonBeforeSwitching"));return}else w(!1)},D=(K,G)=>{f(I=>{const L={...I},Z=K.split(".");let A=L;for(let H=0;H<Z.length-1;H++)A[Z[H]]||(A[Z[H]]={}),A=A[Z[H]];if(A[Z[Z.length-1]]=G,c)try{localStorage.setItem(c,JSON.stringify(L))}catch(H){console.warn("Failed to save form data to localStorage:",H)}return L}),h[K]&&b(I=>{const L={...I};return delete L[K],L})},Y=()=>{const K={},G=(I,L,Z="")=>{I.type==="object"&&I.properties&&Object.entries(I.properties).forEach(([A,H])=>{var le;const J=Z?`${Z}.${A}`:A,me=L==null?void 0:L[A];if((le=I.required)!=null&&le.includes(A)&&(me==null||me===""||Array.isArray(me)&&me.length===0)){K[J]=`${A} is required`;return}me!=null&&me!==""&&(H.type==="string"&&typeof me!="string"?K[J]=`${A} must be a string`:H.type==="number"&&typeof me!="number"?K[J]=`${A} must be a number`:H.type==="integer"&&(!Number.isInteger(me)||typeof me!="number")?K[J]=`${A} must be an integer`:H.type==="boolean"&&typeof me!="boolean"?K[J]=`${A} must be a boolean`:H.type==="array"&&Array.isArray(me)?H.items&&me.forEach((k,U)=>{var M;((M=H.items)==null?void 0:M.type)==="object"&&H.items.properties&&G(H.items,k,`${J}.${U}`)}):H.type==="object"&&typeof me=="object"&&G(H,me,J))})};return G(z,g),b(K),Object.keys(K).length===0},R=K=>{K.preventDefault(),Y()&&n(g)},_=(K,G)=>G.split(".").reduce((I,L)=>I==null?void 0:I[L],K),P=(K,G,I,L)=>{const Z=I==null?void 0:I[K];return G.type==="string"?G.enum?t.jsxs("select",{value:Z||"",onChange:A=>L(A.target.value),className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[t.jsx("option",{value:"",children:m("tool.selectOption")}),G.enum.map((A,H)=>t.jsx("option",{value:A,children:A},H))]}):t.jsx("input",{type:"text",value:Z||"",onChange:A=>L(A.target.value),className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500 form-input",placeholder:G.description||m("tool.enterKey",{key:K})}):G.type==="number"||G.type==="integer"?t.jsx("input",{type:"number",step:G.type==="integer"?"1":"any",value:Z??"",onChange:A=>{const H=A.target.value===""?"":G.type==="integer"?parseInt(A.target.value):parseFloat(A.target.value);L(H)},className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500 form-input"}):G.type==="boolean"?t.jsx("input",{type:"checkbox",checked:Z||!1,onChange:A=>L(A.target.checked),className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}):t.jsx("input",{type:"text",value:Z||"",onChange:A=>L(A.target.value),className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500 form-input",placeholder:G.description||m("tool.enterKey",{key:K})})},V=(K,G,I="")=>{var H,J,me,le,k,U,M,q,de,ee,X,he,se,ye;const L=I?`${I}.${K}`:K,Z=_(g,L),A=h[L];if(G.type==="array"){const ie=_(g,L)||[];return t.jsxs("div",{className:"mb-6",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[K,(I?(J=(H=_(z,I))==null?void 0:H.required)==null?void 0:J.includes(K):(me=z.required)==null?void 0:me.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:G.description}),t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-3 bg-gray-50 dark:bg-gray-800",children:[ie.map((ae,be)=>{var Ne,xe,ke;return t.jsxs("div",{className:"mb-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-600",children:m("tool.item",{index:be+1})}),t.jsx("button",{type:"button",onClick:()=>{const Se=[...ie];Se.splice(be,1),D(L,Se)},className:"text-status-red hover:text-red-700 text-sm",children:m("common.remove")})]}),((Ne=G.items)==null?void 0:Ne.type)==="string"&&G.items.enum?t.jsxs("select",{value:ae||"",onChange:Se=>{const Le=[...ie];Le[be]=Se.target.value,D(L,Le)},className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"",children:m("tool.selectOption")}),G.items.enum.map((Se,Le)=>t.jsx("option",{value:Se,children:Se},Le))]}):((xe=G.items)==null?void 0:xe.type)==="object"&&G.items.properties?t.jsx("div",{className:"space-y-3",children:Object.entries(G.items.properties).map(([Se,Le])=>{var at,gt;return t.jsxs("div",{children:[t.jsxs("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[Se,((gt=(at=G.items)==null?void 0:at.required)==null?void 0:gt.includes(Se))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),P(Se,Le,ae,Mt=>{const Pt=[...ie];Pt[be]={...Pt[be],[Se]:Mt},D(L,Pt)})]},Se)})}):t.jsx("input",{type:"text",value:ae||"",onChange:Se=>{const Le=[...ie];Le[be]=Se.target.value,D(L,Le)},className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",placeholder:m("tool.enterValue",{type:((ke=G.items)==null?void 0:ke.type)||"value"})})]},be)}),t.jsx("button",{type:"button",onClick:()=>{var be;const ae=((be=G.items)==null?void 0:be.type)==="object"?{}:"";D(L,[...ie,ae])},className:"w-full mt-2 px-3 py-2 text-sm text-blue-600 border border-blue-300 rounded-md hover:bg-blue-50",children:m("tool.addItem",{key:K})})]}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L)}return G.type==="object"?G.properties?t.jsxs("div",{className:"mb-6",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[K,(I?(k=(le=_(z,I))==null?void 0:le.required)==null?void 0:k.includes(K):(U=z.required)==null?void 0:U.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:G.description}),t.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4 bg-gray-50 dark:bg-gray-800",children:Object.entries(G.properties).map(([ie,ae])=>V(ie,ae,L))}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L):t.jsxs("div",{className:"mb-4",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[K,(I?(q=(M=_(z,I))==null?void 0:M.required)==null?void 0:q.includes(K):(de=z.required)==null?void 0:de.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"}),t.jsx("span",{className:"text-xs text-gray-500 ml-1",children:"(JSON object)"})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:G.description}),t.jsx("textarea",{value:typeof Z=="object"?JSON.stringify(Z,null,2):Z||"{}",onChange:ie=>{try{const ae=JSON.parse(ie.target.value);D(L,ae)}catch{D(L,ie.target.value)}},placeholder:`{
|
|
233
233
|
"key": "value"
|
|
234
234
|
}`,className:`w-full border rounded-md px-3 py-2 font-mono text-sm ${A?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`,rows:4}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L):G.type==="string"?G.enum?t.jsxs("div",{className:"mb-4",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[K,(I?!1:(ee=z.required)==null?void 0:ee.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:G.description}),t.jsxs("select",{value:Z||"",onChange:ie=>D(L,ie.target.value),className:`w-full border rounded-md px-3 py-2 ${A?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[t.jsx("option",{value:"",children:m("tool.selectOption")}),G.enum.map((ie,ae)=>t.jsx("option",{value:ie,children:ie},ae))]}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L):t.jsxs("div",{className:"mb-4",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[K,(I?!1:(X=z.required)==null?void 0:X.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:G.description}),t.jsx("input",{type:"text",value:Z||"",onChange:ie=>D(L,ie.target.value),className:`w-full border rounded-md px-3 py-2 ${A?"border-red":"border-gray-200"} focus:outline-none form-input`}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L):G.type==="number"||G.type==="integer"?t.jsxs("div",{className:"mb-4",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[K,(I?!1:(he=z.required)==null?void 0:he.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:G.description}),t.jsx("input",{type:"number",step:G.type==="integer"?"1":"any",value:Z??"",onChange:ie=>{const ae=ie.target.value===""?"":G.type==="integer"?parseInt(ie.target.value):parseFloat(ie.target.value);D(L,ae)},className:`w-full border rounded-md px-3 py-2 form-input ${A?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L):G.type==="boolean"?t.jsxs("div",{className:"mb-4",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",checked:Z||!1,onChange:ie=>D(L,ie.target.checked),className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),t.jsxs("label",{className:"ml-2 block text-sm text-gray-700",children:[K,(I?!1:(se=z.required)==null?void 0:se.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"})]})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:G.description}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L):t.jsxs("div",{className:"mb-4",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[K,(I?!1:(ye=z.required)==null?void 0:ye.includes(K))&&t.jsx("span",{className:"text-status-red ml-1",children:"*"}),t.jsxs("span",{className:"text-xs text-gray-500 ml-1",children:["(",G.type,")"]})]}),G.description&&t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:G.description}),t.jsx("input",{type:"text",value:Z||"",onChange:ie=>D(L,ie.target.value),placeholder:m("tool.enterValue",{type:G.type}),className:`w-full border rounded-md px-3 py-2 ${A?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 form-input`}),A&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:A})]},L)};return z.properties?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex justify-between items-center pb-3",children:[t.jsx("h6",{className:"text-md font-medium text-gray-900",children:u}),t.jsxs("div",{className:"flex space-x-2",children:[t.jsx("button",{type:"button",onClick:B,className:`px-3 py-1 text-sm rounded-md transition-colors ${y?"text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary":"bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary"}`,children:m("tool.formMode")}),t.jsx("button",{type:"button",onClick:T,className:`px-3 py-1 text-sm rounded-md transition-colors ${y?"px-4 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary":"text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary"}`,children:m("tool.jsonMode")})]})]}),y?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:m("tool.jsonConfiguration")}),t.jsx("textarea",{value:N,onChange:K=>E(K.target.value),placeholder:`{
|
|
235
235
|
"key": "value"
|
|
236
|
-
}`,className:`w-full h-64 border rounded-md px-3 py-2 font-mono text-sm resize-y form-input ${j?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`}),j&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:j})]}),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-1 text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary",children:m("tool.cancel")}),t.jsx("button",{onClick:()=>{try{const K=JSON.parse(N);n(K)}catch{C(m("tool.invalidJsonFormat"))}},disabled:o||!!j,className:"px-4 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary",children:m(o?"tool.running":"tool.runTool")})]})]}):t.jsxs("form",{onSubmit:R,className:"space-y-4",children:[Object.entries(z.properties||{}).map(([K,G])=>V(K,G)),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-1 text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary",children:m("tool.cancel")}),t.jsx("button",{type:"submit",disabled:o,className:"px-4 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary",children:m(o?"tool.running":"tool.runTool")})]})]})]}):t.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("p",{className:"text-sm text-gray-600",children:m("tool.noParameters")}),t.jsxs("div",{className:"flex justify-end space-x-2 mt-4",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-sm text-gray-600 bg-gray-100 dark:bg-gray-800 rounded-md hover:bg-gray-200",children:m("tool.cancel")}),t.jsx("button",{onClick:()=>n({}),disabled:o,className:"px-4 py-2 text-sm text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50",children:m(o?"tool.running":"tool.runTool")})]})]})},vS=({result:a,onClose:n})=>{const{t:l}=ve(),o=a.content,c=b=>b?b.startsWith("image/")?b:`image/${b}`:"image/png",u=b=>{if(!b)return[];if(Array.isArray(b))return b.flatMap(N=>u(N));if(typeof b!="object")return[];const y=[];b.type==="image"&&b.data&&y.push({data:String(b.data),mimeType:c(b.mimeType||b.mime_type)});const w=b.image_base64||b.imageBase64||b.image_data||b.imageData||b.base64;return w&&y.push({data:String(w),mimeType:c(b.image_mimeType||b.image_mime_type||b.mimeType||b.mime_type)}),b.image&&typeof b.image=="object"&&y.push(...u(b.image)),Array.isArray(b.images)&&y.push(...u(b.images)),Array.isArray(b.content)&&y.push(...u(b.content)),y},m=b=>{const y=[];try{const S=JSON.parse(b);if(y.push(...u(S)),y.length>0)return y}catch{}const w=/data:image\/(png|jpe?g|gif|webp);base64,([A-Za-z0-9+/=]+)/g;let N;for(;(N=w.exec(b))!==null;){const S=`image/${N[1]==="jpg"?"jpeg":N[1]}`;y.push({data:N[2],mimeType:S})}return y},g=b=>{try{const y=JSON.parse(b),w=N=>{if(Array.isArray(N))return N.map(w);if(N&&typeof N=="object"){const S={};for(const[j,C]of Object.entries(N))typeof C=="string"&&j.toLowerCase().includes("base64")?S[j]="[base64 omitted]":S[j]=w(C);return S}return N};return JSON.stringify(w(y),null,2)}catch{return b.replace(/data:image\/(png|jpe?g|gif|webp);base64,[A-Za-z0-9+/=]+/g,"[image data omitted]")}},f=b=>Array.isArray(b)?b.map((y,w)=>t.jsx("div",{className:"mb-3 last:mb-0",children:h(y)},w)):h(b),h=b=>{if(typeof b=="string"){const y=m(b),w=g(b);return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[y.length>0&&t.jsx("div",{className:"mb-3 space-y-3",children:y.map((N,S)=>t.jsx("img",{src:`data:${N.mimeType||"image/png"};base64,${N.data}`,alt:l("tool.toolResult"),className:"max-w-full h-auto rounded-md"},S))}),t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:w})]})}if(typeof b=="object"&&b!==null){if(b.type==="text"&&b.text){const y=m(b.text),w=g(b.text);return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[y.length>0&&t.jsx("div",{className:"mb-3 space-y-3",children:y.map((N,S)=>t.jsx("img",{src:`data:${N.mimeType||"image/png"};base64,${N.data}`,alt:l("tool.toolResult"),className:"max-w-full h-auto rounded-md"},S))}),t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:w})]})}if(b.type==="image"&&b.data)return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("img",{src:`data:${b.mimeType||"image/png"};base64,${b.data}`,alt:l("tool.toolResult"),className:"max-w-full h-auto rounded-md"})});try{const y=typeof b=="string"?JSON.parse(b):b;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[t.jsx("div",{className:"text-xs text-gray-500 mb-2",children:l("tool.jsonResponse")}),t.jsx("pre",{className:"text-sm text-gray-800 overflow-auto",children:JSON.stringify(y,null,2)})]})}catch{return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(b)})})}}return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(b)})})};return t.jsxs("div",{className:"border border-gray-300 rounded-lg bg-white dark:bg-gray-800 shadow-sm",children:[t.jsx("div",{className:"border-b border-gray-300 px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-t-lg",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[a.success?t.jsx(v0,{size:20,className:"text-status-green"}):t.jsx(w0,{size:20,className:"text-status-red"}),t.jsx("div",{children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900",children:[l("tool.execution")," ",a.success?l("tool.successful"):l("tool.failed")]})})]}),t.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 text-sm",children:"✕"})]})}),t.jsx("div",{className:"p-4",children:a.success?t.jsx("div",{children:a.content&&a.content.length>0?t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 mb-3",children:l("tool.result")}),f(a.content)]}):t.jsx("div",{className:"text-sm text-gray-500 italic",children:l("tool.noContent")})}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[t.jsx(Rd,{size:16,className:"text-red-500"}),t.jsx("span",{className:"text-sm font-medium text-red-700",children:l("tool.error")})]}),o&&o.length>0?t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 mb-3",children:l("tool.errorDetails")}),f(o)]}):t.jsx("div",{className:"bg-red-50 border border-red-300 rounded-md p-3",children:t.jsx("pre",{className:"text-sm text-red-800 whitespace-pre-wrap",children:a.error||a.message||l("tool.unknownError")})})]})})]})},kn=({title:a,onClick:n,disabled:l=!1,loading:o=!1})=>t.jsx("button",{type:"button",className:"ml-2 p-1 text-amber-600 hover:text-amber-700 cursor-pointer transition-colors disabled:opacity-60 disabled:cursor-not-allowed",onClick:n,disabled:l,title:a,"aria-label":a,children:t.jsx(zw,{size:14,className:o?"animate-spin":""})});function wS(a){return a==null?!0:typeof a=="string"?a.trim()==="":Array.isArray(a)?a.length===0:typeof a=="object"?Object.keys(a).length===0:!1}const jS=({tool:a,server:n,onToggle:l,onDescriptionUpdate:o})=>{const{t:c}=ve(),{showToast:u}=Pa(),{nameSeparator:m}=Os(),[g,f]=x.useState(!1),[h,b]=x.useState(!1),[y,w]=x.useState(!1),[N,S]=x.useState(null),[j,C]=x.useState(!1),[z,E]=x.useState(!1),[T,B]=x.useState(a.description||""),D=x.useRef(null),Y=x.useRef(null),[R,_]=x.useState(0),[P,V]=x.useState(!1);x.useEffect(()=>{j&&D.current&&(D.current.focus(),R>0&&(D.current.style.width=`${R+20}px`))},[j,R]),x.useEffect(()=>{!j&&Y.current&&_(Y.current.offsetWidth)},[j,T]),x.useEffect(()=>{B(a.description||"")},[a.description]);const K=x.useCallback(()=>`mcphub_tool_form_${n?`${n}_`:""}${a.name}`,[a.name,n]),G=x.useCallback(()=>{localStorage.removeItem(K())},[K]),I=M=>{l&&l(a.name,M)},L=()=>{C(!0)},Z=async()=>{try{const M=await Q0(n,a.name,T);M.success?(C(!1),o&&o(a.name,T)):(B(a.description||""),console.error("Failed to update tool description:",M.error))}catch(M){console.error("Error updating tool description:",M),B(a.description||""),C(!1)}},A=M=>{B(M.target.value)},H=async()=>{E(!0);try{const M=await X0(n,a.name);if(M.success){const q=M.description||"";B(q),C(!1),o==null||o(a.name,q,{restored:!0})}else u(M.error||c("tool.restoreDefaultFailed"),"error")}catch(M){console.error("Error resetting tool description:",M),u(c("tool.restoreDefaultFailed"),"error")}finally{E(!1)}},J=M=>{M.key==="Enter"?Z():M.key==="Escape"&&(B(a.description||""),C(!1))},me=async M=>{M.stopPropagation();try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(a.name),V(!0),u(c("common.copySuccess"),"success"),setTimeout(()=>V(!1),2e3);else{const q=document.createElement("textarea");q.value=a.name,q.style.position="fixed",q.style.left="-9999px",document.body.appendChild(q),q.focus(),q.select();try{document.execCommand("copy"),V(!0),u(c("common.copySuccess"),"success"),setTimeout(()=>V(!1),2e3)}catch(de){u(c("common.copyFailed"),"error"),console.error("Copy to clipboard failed:",de)}document.body.removeChild(q)}}catch(q){u(c("common.copyFailed"),"error"),console.error("Copy to clipboard failed:",q)}},le=async M=>{w(!0);try{M=Object.fromEntries(Object.entries(M).filter(([de,ee])=>!wS(ee)));const q=await J0({toolName:a.name,arguments:M},n);S(q)}catch(q){S({success:!1,error:q instanceof Error?q.message:"Unknown error occurred"})}finally{w(!1)}},k=()=>{b(!1),G(),S(null)},U=()=>{S(null)};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow rounded-lg mb-4",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer p-2",onClick:M=>{M.stopPropagation(),f(!g)},children:[t.jsx("div",{className:"flex-1",children:t.jsxs("h3",{className:"text-lg font-medium text-gray-900 inline-flex items-center",children:[a.name.replace(n+m,""),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:me,title:c("common.copy"),children:P?t.jsx(za,{size:16,className:"text-green-500"}):t.jsx(jn,{size:16})}),t.jsx("span",{className:"ml-2 text-sm font-normal text-gray-600 inline-flex items-center",children:j?t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:D,type:"text",className:"px-2 py-1 border border-blue-300 rounded bg-white dark:bg-gray-800 text-sm focus:outline-none form-input",value:T,onChange:A,onKeyDown:J,onClick:M=>M.stopPropagation(),style:{minWidth:"100px",width:R>0?`${R+20}px`:"auto"}}),t.jsx("button",{className:"ml-2 p-1 text-green-600 hover:text-green-800 cursor-pointer transition-colors",onClick:M=>{M.stopPropagation(),Z()},disabled:z,children:t.jsx(za,{size:16})}),t.jsx(kn,{title:c("tool.restoreDefault"),onClick:M=>{M.stopPropagation(),H()},disabled:z,loading:z})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:Y,children:T||c("tool.noDescription")}),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:M=>{M.stopPropagation(),L()},children:t.jsx(ds,{size:14})}),t.jsx(kn,{title:c("tool.restoreDefault"),onClick:M=>{M.stopPropagation(),H()},disabled:z,loading:z})]})})]})}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"flex items-center space-x-2",onClick:M=>M.stopPropagation(),children:t.jsx(Jt,{checked:a.enabled??!0,onCheckedChange:I,disabled:y})}),t.jsxs("button",{onClick:M=>{M.stopPropagation(),f(!0),b(!0)},className:"flex items-center space-x-1 px-3 py-1 text-sm text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors btn-primary",disabled:y||!a.enabled,children:[y?t.jsx(j0,{size:14,className:"animate-spin"}):t.jsx(S0,{size:14}),t.jsx("span",{children:c(y?"tool.running":"tool.run")})]}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:g?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),g&&t.jsxs("div",{className:"mt-4 space-y-4",children:[!h&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded p-3 border border-gray-300",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:c("tool.inputSchema")}),t.jsx("pre",{className:"text-xs text-gray-600 overflow-auto",children:JSON.stringify(a.inputSchema,null,2)})]}),h&&t.jsxs("div",{className:"border border-gray-300 rounded-lg p-4",children:[t.jsx(Z0,{schema:a.inputSchema||{type:"object"},onSubmit:le,onCancel:k,loading:y,storageKey:K(),title:c("tool.runToolWithName",{name:a.name.replace(n+m,"")})}),N&&t.jsx("div",{className:"mt-4",children:t.jsx(vS,{result:N,onClose:U})})]})]})]})},SS=async(a,n)=>{try{const l=n?`/prompts/call/${n}`:"/prompts/call",o=await pt(l,{promptName:a.promptName,arguments:a.arguments});return o.success?{success:!0,data:o.data}:{success:!1,error:o.message||"Prompt call failed"}}catch(l){return console.error("Error calling prompt",{promptName:a.promptName,server:n,error:l}),{success:!1,error:l instanceof Error?l.message:"Unknown error occurred"}}},W0=async(a,n)=>{try{const l=await pt(`/mcp/${encodeURIComponent(n||"")}/prompts/${encodeURIComponent(a.promptName)}`,{name:a.promptName,arguments:a.arguments});if(!l.success)throw new Error(`Failed to get prompt: ${l.message||"Unknown error"}`);return{success:!0,data:l.data}}catch(l){return console.error("Error getting prompt",{promptName:a.promptName,server:n,error:l}),{success:!1,error:l instanceof Error?l.message:"Unknown error occurred"}}},NS=async(a,n,l)=>{try{const o=await pt(`/servers/${encodeURIComponent(a)}/prompts/${encodeURIComponent(n)}/toggle`,{enabled:l});return{success:o.success,error:o.success?void 0:o.message}}catch(o){return console.error("Error toggling prompt",{serverName:a,promptName:n,enabled:l,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},ex=async(a,n,l)=>{try{const o=await At(`/servers/${encodeURIComponent(a)}/prompts/${encodeURIComponent(n)}/description`,{description:l},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:o.success,error:o.success?void 0:o.message}}catch(o){return console.error("Error updating prompt description",{serverName:a,promptName:n,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},tx=async(a,n)=>{var l;try{const o=await Yr(`/servers/${encodeURIComponent(a)}/prompts/${encodeURIComponent(n)}/description`,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:o.success,error:o.success?void 0:o.message,description:(l=o.data)==null?void 0:l.description}}catch(o){return console.error("Error resetting prompt description",{serverName:a,promptName:n,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},kS=Object.freeze(Object.defineProperty({__proto__:null,callPrompt:SS,getPrompt:W0,resetPromptDescription:tx,togglePrompt:NS,updatePromptDescription:ex},Symbol.toStringTag,{value:"Module"})),oh=({result:a,onClose:n})=>{const{t:l}=ve(),o=c=>{if(typeof c=="string")return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:c})});if(typeof c=="object"&&c!==null){if(c.description||c.messages)return t.jsxs("div",{className:"space-y-4",children:[c.description&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:l("prompt.description")}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("p",{className:"text-sm text-gray-800",children:c.description})})]}),c.messages&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:l("prompt.messages")}),t.jsx("div",{className:"space-y-3",children:c.messages.map((u,m)=>t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[t.jsx("div",{className:"flex items-center mb-2",children:t.jsxs("span",{className:"inline-block w-16 text-xs font-medium text-gray-500",children:[u.role,":"]})}),typeof u.content=="string"?t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:u.content}):typeof u.content=="object"&&u.content.type==="text"?t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:u.content.text}):t.jsx("pre",{className:"text-sm text-gray-800 overflow-auto",children:JSON.stringify(u.content,null,2)})]},m))})]})]});try{const u=typeof c=="string"?JSON.parse(c):c;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[t.jsx("div",{className:"text-xs text-gray-500 mb-2",children:l("prompt.jsonResponse")}),t.jsx("pre",{className:"text-sm text-gray-800 overflow-auto",children:JSON.stringify(u,null,2)})]})}catch{return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(c)})})}}return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(c)})})};return t.jsxs("div",{className:"border border-gray-300 rounded-lg bg-white dark:bg-gray-800 shadow-sm",children:[t.jsx("div",{className:"border-b border-gray-300 px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-t-lg",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[a.success?t.jsx(v0,{size:20,className:"text-status-green"}):t.jsx(w0,{size:20,className:"text-status-red"}),t.jsx("div",{children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900",children:[l("prompt.execution")," ",a.success?l("prompt.successful"):l("prompt.failed")]})})]}),t.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 text-sm",children:"✕"})]})}),t.jsx("div",{className:"p-4",children:a.success?t.jsx("div",{children:a.data?t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 mb-3",children:l("prompt.result")}),o(a.data)]}):t.jsx("div",{className:"text-sm text-gray-500 italic",children:l("prompt.noContent")})}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[t.jsx(Rd,{size:16,className:"text-red-500"}),t.jsx("span",{className:"text-sm font-medium text-red-700",children:l("prompt.error")})]}),t.jsx("div",{className:"bg-red-50 border border-red-300 rounded-md p-3",children:t.jsx("pre",{className:"text-sm text-red-800 whitespace-pre-wrap",children:a.error||a.message||l("prompt.unknownError")})})]})})]})},CS=({prompt:a,server:n,onToggle:l,onDescriptionUpdate:o})=>{const{t:c}=ve(),{showToast:u}=Pa(),{nameSeparator:m}=Os(),[g,f]=x.useState(!1),[h,b]=x.useState(!1),[y,w]=x.useState(!1),[N,S]=x.useState(null),[j,C]=x.useState(!1),[z,E]=x.useState(!1),[T,B]=x.useState(a.description||""),D=x.useRef(null),Y=x.useRef(null),[R,_]=x.useState(0);x.useEffect(()=>{j&&D.current&&(D.current.focus(),R>0&&(D.current.style.width=`${R+20}px`))},[j,R]),x.useEffect(()=>{!j&&Y.current&&_(Y.current.offsetWidth)},[j,T]),x.useEffect(()=>{B(a.description||"")},[a.description]);const P=x.useCallback(()=>`mcphub_prompt_form_${n?`${n}_`:""}${a.name}`,[a.name,n]),V=x.useCallback(()=>{localStorage.removeItem(P())},[P]),K=k=>{l&&l(a.name,k)},G=()=>{C(!0)},I=async()=>{C(!1);try{const k=await ex(n,a.name,T);k.success?o&&o(a.name,T):(u(k.error||c("prompt.descriptionUpdateFailed"),"error"),B(a.description||""))}catch(k){console.error("Error updating prompt description:",k),u(c("prompt.descriptionUpdateFailed"),"error"),B(a.description||"")}},L=async()=>{E(!0);try{const k=await tx(n,a.name);if(k.success){const U=k.description||"";B(U),C(!1),o==null||o(a.name,U,{restored:!0})}else u(k.error||c("prompt.restoreDefaultFailed"),"error")}catch(k){console.error("Error resetting prompt description:",k),u(c("prompt.restoreDefaultFailed"),"error")}finally{E(!1)}},Z=k=>{B(k.target.value)},A=k=>{k.key==="Enter"?I():k.key==="Escape"&&(B(a.description||""),C(!1))},H=async k=>{w(!0);try{const U=await W0({promptName:a.name,arguments:k},n);console.log("GetPrompt result:",U),S({success:U.success,data:U.data,error:U.error})}catch(U){S({success:!1,error:U instanceof Error?U.message:"Unknown error occurred"})}finally{w(!1)}},J=()=>{b(!1),V(),S(null)},me=()=>{S(null)},le=()=>{if(!a.arguments||a.arguments.length===0)return{type:"object",properties:{},required:[]};const k={},U=[];return a.arguments.forEach(M=>{k[M.name]={type:"string",description:M.description||""},M.required&&U.push(M.name)}),{type:"object",properties:k,required:U}};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow rounded-lg mb-4",children:[t.jsxs("div",{className:"flex justify-between items-center p-2 cursor-pointer",onClick:()=>f(!g),children:[t.jsx("div",{className:"flex-1",children:t.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:[a.name.replace(n+m,""),a.title&&t.jsx("span",{className:"ml-2 text-sm font-normal text-gray-600",children:a.title}),t.jsx("span",{className:"ml-2 text-sm font-normal text-gray-500 inline-flex items-center",children:j?t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:D,type:"text",className:"px-2 py-1 border border-blue-300 rounded bg-white dark:bg-gray-800 text-sm focus:outline-none form-input",value:T,onChange:Z,onKeyDown:A,onClick:k=>k.stopPropagation(),style:{minWidth:"100px",width:R>0?`${R+20}px`:"auto"}}),t.jsx("button",{className:"ml-2 p-1 text-green-600 hover:text-green-800 cursor-pointer transition-colors",onClick:k=>{k.stopPropagation(),I()},disabled:z,children:t.jsx(za,{size:16})}),t.jsx(kn,{title:c("prompt.restoreDefault"),onClick:k=>{k.stopPropagation(),L()},disabled:z,loading:z})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:Y,children:T||c("tool.noDescription")}),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:k=>{k.stopPropagation(),G()},children:t.jsx(ds,{size:14})}),t.jsx(kn,{title:c("prompt.restoreDefault"),onClick:k=>{k.stopPropagation(),L()},disabled:z,loading:z})]})})]})}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"flex items-center space-x-2",onClick:k=>k.stopPropagation(),children:a.enabled!==void 0&&t.jsx(Jt,{checked:a.enabled,onCheckedChange:K,disabled:y})}),t.jsxs("button",{onClick:k=>{k.stopPropagation(),f(!0),b(!0)},className:"flex items-center space-x-1 px-3 py-1 text-sm text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors btn-primary",disabled:y||!a.enabled,children:[y?t.jsx(j0,{size:14,className:"animate-spin"}):t.jsx(S0,{size:14}),t.jsx("span",{children:c(y?"tool.running":"tool.run")})]}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:g?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),g&&t.jsxs("div",{className:"mt-4 space-y-4",children:[h&&t.jsxs("div",{className:"border border-gray-300 rounded-lg p-4",children:[t.jsx(Z0,{schema:le(),onSubmit:H,onCancel:J,loading:y,storageKey:P(),title:c("prompt.runPromptWithName",{name:a.name.replace(n+m,"")})}),N&&t.jsx("div",{className:"mt-4",children:t.jsx(oh,{result:N,onClose:me})})]}),!h&&a.arguments&&a.arguments.length>0&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded p-3 border border-gray-300",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:c("tool.parameters")}),t.jsx("div",{className:"space-y-2",children:a.arguments.map((k,U)=>t.jsxs("div",{className:"flex items-start",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("span",{className:"font-medium text-gray-700",children:k.name}),k.required&&t.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),k.description&&t.jsx("p",{className:"text-sm text-gray-600 mt-1",children:k.description})]}),t.jsx("div",{className:"text-xs text-gray-500 ml-2",children:k.title||""})]},U))})]}),!h&&N&&t.jsx("div",{className:"mt-4",children:t.jsx(oh,{result:N,onClose:me})})]})]})},AS=({resource:a,onToggle:n,onDescriptionUpdate:l})=>{const{t:o}=ve(),[c,u]=x.useState(!1),[m,g]=x.useState(!1),[f,h]=x.useState(!1),[b,y]=x.useState(a.description||""),w=x.useRef(null),N=x.useRef(null),[S,j]=x.useState(0);x.useEffect(()=>{m&&w.current&&(w.current.focus(),S>0&&(w.current.style.width=`${S+20}px`))},[m,S]),x.useEffect(()=>{!m&&N.current&&j(N.current.offsetWidth)},[m,b]),x.useEffect(()=>{y(a.description||"")},[a.description]);const C=B=>{n&&n(a.uri,B)},z=async()=>{g(!1),l&&await l(a.uri,b)},E=async()=>{h(!0);try{await(l==null?void 0:l(a.uri,"",{restored:!0})),g(!1)}finally{h(!1)}},T=B=>{B.key==="Enter"?z():B.key==="Escape"&&(y(a.description||""),g(!1))};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow rounded-lg mb-4",children:[t.jsxs("div",{className:"flex justify-between items-center p-2 cursor-pointer",onClick:()=>u(!c),children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 truncate",children:a.name||a.uri}),t.jsx("div",{className:"text-sm text-gray-500 truncate",children:a.uri}),t.jsx("span",{className:"text-sm font-normal text-gray-500 inline-flex items-center mt-1",children:m?t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:w,type:"text",className:"px-2 py-1 border border-blue-300 rounded bg-white dark:bg-gray-800 text-sm focus:outline-none form-input",value:b,onChange:B=>y(B.target.value),onKeyDown:T,onClick:B=>B.stopPropagation(),style:{minWidth:"100px",width:S>0?`${S+20}px`:"auto"}}),t.jsx("button",{className:"ml-2 p-1 text-green-600 hover:text-green-800 cursor-pointer transition-colors",onClick:B=>{B.stopPropagation(),z()},disabled:f,children:t.jsx(za,{size:16})}),t.jsx(kn,{title:o("builtinResources.restoreDefault"),onClick:B=>{B.stopPropagation(),E()},disabled:f,loading:f})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:N,children:b||o("tool.noDescription")}),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:B=>{B.stopPropagation(),g(!0)},children:t.jsx(ds,{size:14})}),t.jsx(kn,{title:o("builtinResources.restoreDefault"),onClick:B=>{B.stopPropagation(),E()},disabled:f,loading:f})]})})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"flex items-center space-x-2",onClick:B=>B.stopPropagation(),children:t.jsx(Jt,{checked:a.enabled!==!1,onCheckedChange:C})}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:c?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),c&&t.jsx("div",{className:"mt-2 px-3 pb-3 text-sm text-gray-600 border-t border-gray-100 dark:border-gray-800",children:t.jsxs("div",{className:"pt-2",children:[t.jsxs("span",{className:"font-medium",children:[o("builtinResources.mimeType"),":"]})," ",a.mimeType||"text/plain"]})})]})},Pd=({isOpen:a,onClose:n,onConfirm:l,serverName:o,isGroup:c=!1,isUser:u=!1})=>{const{t:m}=ve();return a?t.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-30 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-3",children:m(u?"users.confirmDelete":c?"groups.confirmDelete":"server.confirmDelete")}),t.jsx("p",{className:"text-gray-500 mb-6",children:u?m("users.deleteWarning",{username:o}):c?m("groups.deleteWarning",{name:o}):m("server.deleteWarning",{name:o})}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:n,className:"px-4 py-2 text-gray-600 hover:text-gray-800 btn-secondary",children:m("common.cancel")}),t.jsx("button",{onClick:l,className:"px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600 btn-danger",children:m("common.delete")})]})]})})}):null},ES=({server:a,onRemove:n,onEdit:l,onToggle:o,onRefresh:c,onReload:u})=>{var X,he,se,ye,ie,ae,be,Ne;const{t:m}=ve(),{showToast:g}=Pa(),[f,h]=x.useState(null),[b,y]=x.useState(!1),[w,N]=x.useState(!1),[S,j]=x.useState(!1),[C,z]=x.useState(!1),[E,T]=x.useState(!1),B=x.useRef(null);x.useEffect(()=>{const xe=ke=>{B.current&&!B.current.contains(ke.target)&&z(!1)};return document.addEventListener("mousedown",xe),()=>{document.removeEventListener("mousedown",xe)}},[]);const{exportMCPSettings:D}=Os(),Y=((X=a.tools)==null?void 0:X.length)||0,R=((he=a.tools)==null?void 0:he.filter(xe=>xe.enabled!==!1).length)||0,_=((se=a.prompts)==null?void 0:se.length)||0,P=((ye=a.prompts)==null?void 0:ye.filter(xe=>xe.enabled!==!1).length)||0,V=((ie=a.resources)==null?void 0:ie.length)||0,K=((ae=a.resources)==null?void 0:ae.filter(xe=>xe.enabled!==!1).length)||0,G=xe=>{xe.stopPropagation(),y(!0)},I=xe=>{xe.stopPropagation(),l(a)},L=async xe=>{if(xe.stopPropagation(),!(w||!o)){N(!0);try{await o(a,a.enabled===!1)}finally{N(!1)}}},Z=async xe=>{if(xe.stopPropagation(),!(S||!u)){j(!0);try{await u(a)?g(m("server.reloadSuccess")||"Server reloaded successfully","success"):g(m("server.reloadError",{serverName:a.name})||"Failed to reload server","error")}finally{j(!1)}}},A=xe=>{xe.stopPropagation(),z(!C)},H=xe=>{if(xe.stopPropagation(),!!a.error)if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(a.error).then(()=>{T(!0),g(m("common.copySuccess")||"Copied to clipboard","success"),setTimeout(()=>T(!1),2e3)});else{const ke=document.createElement("textarea");ke.value=a.error,ke.style.position="fixed",ke.style.left="-9999px",document.body.appendChild(ke),ke.focus(),ke.select();try{document.execCommand("copy"),T(!0),g(m("common.copySuccess")||"Copied to clipboard","success"),setTimeout(()=>T(!1),2e3)}catch(Se){g(m("common.copyFailed")||"Copy failed","error"),console.error("Copy to clipboard failed:",Se)}document.body.removeChild(ke)}},J=async xe=>{xe.stopPropagation();try{const ke=await D(a.name);if(!ke||!ke.success||!ke.data){g((ke==null?void 0:ke.message)||m("common.copyFailed")||"Copy failed","error");return}const Se=JSON.stringify(ke.data,null,2);if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(Se),g(m("common.copySuccess")||"Copied to clipboard","success");else{const Le=document.createElement("textarea");Le.value=Se,Le.style.position="fixed",Le.style.left="-9999px",document.body.appendChild(Le),Le.focus(),Le.select();try{document.execCommand("copy"),g(m("common.copySuccess")||"Copied to clipboard","success")}catch(at){g(m("common.copyFailed")||"Copy failed","error"),console.error("Copy to clipboard failed:",at)}document.body.removeChild(Le)}}catch(ke){console.error("Error copying server configuration:",ke),g(m("common.copyFailed")||"Copy failed","error")}},me=()=>{n(a.name),y(!1)},le=async(xe,ke)=>{try{const{toggleTool:Se}=await ro(async()=>{const{toggleTool:at}=await Promise.resolve().then(()=>bS);return{toggleTool:at}},[],import.meta.url),Le=await Se(a.name,xe,ke);Le.success?(g(m(ke?"tool.enableSuccess":"tool.disableSuccess",{name:xe}),"success"),c&&c()):g(Le.error||m("tool.toggleFailed"),"error")}catch(Se){console.error("Error toggling tool:",Se),g(m("tool.toggleFailed"),"error")}},k=async(xe,ke)=>{try{const{togglePrompt:Se}=await ro(async()=>{const{togglePrompt:at}=await Promise.resolve().then(()=>kS);return{togglePrompt:at}},void 0,import.meta.url),Le=await Se(a.name,xe,ke);Le.success?(g(m(ke?"tool.enableSuccess":"tool.disableSuccess",{name:xe}),"success"),c&&c()):g(Le.error||m("tool.toggleFailed"),"error")}catch(Se){console.error("Error toggling prompt:",Se),g(m("tool.toggleFailed"),"error")}},U=(xe,ke,Se)=>{g(Se!=null&&Se.restored?m("tool.restoreDefaultSuccess"):m("tool.descriptionUpdateSuccess"),"success"),c&&c()},M=(xe,ke,Se)=>{g(Se!=null&&Se.restored?m("prompt.restoreDefaultSuccess"):m("prompt.descriptionUpdateSuccess"),"success"),c&&c()},q=xe=>{var ke;if(xe.stopPropagation(),(ke=a.oauth)!=null&&ke.authorizationUrl){const at=window.screen.width/2-300,gt=window.screen.height/2-700/2;window.open(a.oauth.authorizationUrl,"OAuth Authorization",`width=600,height=700,left=${at},top=${gt}`),g(m("status.oauthWindowOpened"),"info")}},de=async(xe,ke)=>{try{const{toggleResource:Se}=await ro(async()=>{const{toggleResource:at}=await import("./resourceService-BWgF7k0a.js");return{toggleResource:at}},[],import.meta.url),Le=await Se(a.name,xe,ke);Le.success?(g(m(ke?"tool.enableSuccess":"tool.disableSuccess",{name:xe}),"success"),c&&c()):g(Le.error||m("tool.toggleFailed"),"error")}catch(Se){console.error("Error toggling resource:",Se),g(m("tool.toggleFailed"),"error")}},ee=async(xe,ke,Se)=>{try{const{updateResourceDescription:Le,resetResourceDescription:at}=await ro(async()=>{const{updateResourceDescription:Mt,resetResourceDescription:Pt}=await import("./resourceService-BWgF7k0a.js");return{updateResourceDescription:Mt,resetResourceDescription:Pt}},[],import.meta.url),gt=Se!=null&&Se.restored?await at(a.name,xe):await Le(a.name,xe,ke);gt.success?(g(Se!=null&&Se.restored?m("builtinResources.restoreDefaultSuccess"):m("builtinResources.descriptionUpdateSuccess"),"success"),c&&c()):g(gt.error||(Se!=null&&Se.restored?m("builtinResources.restoreDefaultFailed"):m("builtinResources.descriptionUpdateFailed")),"error")}catch(Le){console.error("Error updating resource description:",Le),g(Se!=null&&Se.restored?m("builtinResources.restoreDefaultFailed"):m("builtinResources.descriptionUpdateFailed"),"error")}};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 page-card transition-all duration-200",children:[t.jsxs("div",{className:"flex justify-between items-center p-4",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("h2",{className:`text-xl font-semibold ${a.enabled===!1?"text-gray-600":"text-gray-900"}`,children:a.name}),((be=a.config)==null?void 0:be.description)&&t.jsxs("span",{className:"text-sm text-gray-500",children:["(",a.config.description,")"]}),t.jsx(xS,{status:a.status,onAuthClick:q}),((Ne=a.config)==null?void 0:Ne.type)&&t.jsx("div",{className:"flex items-center px-2 py-1 bg-gray-100 dark:bg-gray-800 text-gray-700 rounded-full text-xs",children:t.jsxs("span",{children:[a.config.type==="stdio"&&m("server.typeStdio"),a.config.type==="sse"&&m("server.typeSse"),a.config.type==="streamable-http"&&m("server.typeStreamableHttp"),a.config.type==="openapi"&&m("server.typeOpenapi")]})}),t.jsxs("div",{className:`flex items-center px-2 py-1 rounded-full text-sm cursor-pointer transition-colors ${f==="tools"?"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-300":"bg-blue-50 text-blue-700 hover:bg-blue-100 dark:bg-gray-800 dark:text-blue-400 dark:hover:bg-gray-700"}`,onClick:xe=>{xe.stopPropagation(),h(ke=>ke==="tools"?null:"tools")},children:[t.jsx(Od,{className:"w-4 h-4 mr-1"}),t.jsxs("span",{children:[Y===0?"0":`${R}/${Y}`," ",m("server.tools")]})]}),t.jsxs("div",{className:`flex items-center px-2 py-1 rounded-full text-sm cursor-pointer transition-colors ${f==="prompts"?"bg-purple-100 text-purple-800 dark:bg-purple-900/50 dark:text-purple-300":"bg-purple-50 text-purple-700 hover:bg-purple-100 dark:bg-gray-800 dark:text-purple-400 dark:hover:bg-gray-700"}`,onClick:xe=>{xe.stopPropagation(),h(ke=>ke==="prompts"?null:"prompts")},children:[t.jsx(Nn,{className:"w-4 h-4 mr-1"}),t.jsxs("span",{children:[_===0?"0":`${P}/${_}`," ",m("server.prompts")]})]}),t.jsxs("div",{className:`flex items-center px-2 py-1 rounded-full text-sm cursor-pointer transition-colors ${f==="resources"?"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-300":"bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:bg-gray-800 dark:text-emerald-400 dark:hover:bg-gray-700"}`,onClick:xe=>{xe.stopPropagation(),h(ke=>ke==="resources"?null:"resources")},children:[t.jsx(Sn,{className:"w-4 h-4 mr-1"}),t.jsxs("span",{children:[V===0?"0":`${K}/${V}`," ",m("nav.resources")]})]}),a.error&&t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"cursor-pointer",onClick:A,"aria-label":m("server.viewErrorDetails"),children:t.jsx(Rd,{className:"text-red-500 hover:text-red-600",size:18})}),C&&t.jsxs("div",{ref:B,className:"absolute z-10 mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-lg p-0 w-120",style:{left:"-231px",top:"24px",maxHeight:"300px",overflowY:"auto",width:"480px",transform:"translateX(50%)"},onClick:xe=>xe.stopPropagation(),children:[t.jsxs("div",{className:"flex justify-between items-center sticky top-0 bg-white dark:bg-gray-800 py-2 px-4 border-b border-gray-200 dark:border-gray-700 z-20 shadow-sm",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("h4",{className:"text-sm font-medium text-red-600",children:m("server.errorDetails")}),t.jsx("button",{onClick:H,className:"p-1 text-gray-400 hover:text-gray-600 transition-colors btn-secondary",title:m("common.copy"),children:E?t.jsx(za,{size:14,className:"text-green-500"}):t.jsx(jn,{size:14})})]}),t.jsx("button",{onClick:xe=>{xe.stopPropagation(),z(!1)},className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),t.jsx("div",{className:"p-4 pt-2",children:t.jsx("pre",{className:"text-sm text-gray-700 break-words whitespace-pre-wrap",children:a.error})})]})]})]}),t.jsxs("div",{className:"flex space-x-2",children:[t.jsx("button",{onClick:J,className:"px-3 py-1 btn-secondary",children:m("server.copy")}),t.jsx("button",{onClick:I,className:"px-3 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary",children:m("server.edit")}),t.jsx("div",{className:"flex items-center",children:t.jsx("button",{onClick:L,className:`px-3 py-1 text-sm rounded transition-colors ${w?"bg-gray-200 text-gray-500":a.enabled!==!1?"bg-green-100 text-green-800 hover:bg-green-200 btn-secondary":"bg-blue-100 text-blue-800 hover:bg-blue-200 btn-primary"}`,disabled:w||S,children:w?m("common.processing"):a.enabled!==!1?m("server.disable"):m("server.enable")})}),u&&t.jsx("button",{onClick:Z,className:"px-3 py-1 bg-purple-100 text-purple-800 rounded hover:bg-purple-200 text-sm btn-secondary disabled:opacity-70 disabled:cursor-not-allowed",disabled:S||w||a.enabled===!1,children:m(S?"common.processing":"server.reload")}),t.jsx("button",{onClick:G,className:"px-3 py-1 bg-red-100 text-red-800 rounded hover:bg-red-200 text-sm btn-danger",children:m("server.delete")}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600 btn-secondary",children:f?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),f==="tools"&&a.tools&&t.jsxs("div",{className:"px-4",children:[t.jsx("h6",{className:`font-medium ${a.enabled===!1?"text-gray-600":"text-gray-900"} mb-2`,children:m("server.tools")}),t.jsx("div",{className:"space-y-4",children:a.tools.map((xe,ke)=>t.jsx(jS,{server:a.name,tool:xe,onToggle:le,onDescriptionUpdate:U},ke))})]}),f==="prompts"&&a.prompts&&t.jsxs("div",{className:"px-4 pb-2",children:[t.jsx("h6",{className:`font-medium ${a.enabled===!1?"text-gray-600":"text-gray-900"}`,children:m("server.prompts")}),t.jsx("div",{className:"space-y-4",children:a.prompts.map((xe,ke)=>t.jsx(CS,{server:a.name,prompt:xe,onToggle:k,onDescriptionUpdate:M},ke))})]}),f==="resources"&&a.resources&&t.jsxs("div",{className:"px-4 pb-2",children:[t.jsx("h6",{className:`font-medium ${a.enabled===!1?"text-gray-600":"text-gray-900"}`,children:m("nav.resources")}),a.resources.length===0?t.jsx("div",{className:"text-sm text-gray-500 py-2",children:m("builtinResources.noResources")}):t.jsx("div",{className:"space-y-4",children:a.resources.map((xe,ke)=>t.jsx(AS,{resource:xe,onToggle:de,onDescriptionUpdate:ee},`${xe.uri}-${ke}`))})]})]}),t.jsx(Pd,{isOpen:b,onClose:()=>y(!1),onConfirm:me,serverName:a.name})]})},ch=a=>{const n={};return a.forEach(({key:l,value:o})=>{const c=l.trim();c&&(n[c]=o)}),n},rx=a=>a?a.split(",").map(n=>n.trim()).filter(n=>n.length>0):[],RS=a=>{const n={};return a!=null&&a.timeout&&a.timeout!==6e4&&(n.timeout=a.timeout),typeof(a==null?void 0:a.resetTimeoutOnProgress)=="boolean"&&(n.resetTimeoutOnProgress=a.resetTimeoutOnProgress),a!=null&&a.maxTotalTimeout&&(n.maxTotalTimeout=a.maxTotalTimeout),n},TS=a=>{var b,y,w,N,S,j,C,z;if(!a)return{};const n={},l=(b=a.clientId)==null?void 0:b.trim(),o=(y=a.clientSecret)==null?void 0:y.trim(),c=(w=a.scopes)==null?void 0:w.trim(),u=(N=a.accessToken)==null?void 0:N.trim(),m=(S=a.refreshToken)==null?void 0:S.trim(),g=(j=a.authorizationEndpoint)==null?void 0:j.trim(),f=(C=a.tokenEndpoint)==null?void 0:C.trim(),h=(z=a.resource)==null?void 0:z.trim();if(l&&(n.clientId=l),o&&(n.clientSecret=o),c){const E=c.split(/[\s,]+/).map(T=>T.trim()).filter(T=>T.length>0);E.length>0&&(n.scopes=E)}return u&&(n.accessToken=u),m&&(n.refreshToken=m),g&&(n.authorizationEndpoint=g),f&&(n.tokenEndpoint=f),h&&(n.resource=h),n},OS=a=>{var l,o,c,u,m,g,f;const n={version:((l=a.openapi)==null?void 0:l.version)||"3.1.0",passthroughHeaders:rx((o=a.openapi)==null?void 0:o.passthroughHeaders)};if(((c=a.openapi)==null?void 0:c.inputMode)==="url")n.url=((u=a.openapi)==null?void 0:u.url)||"";else if(((m=a.openapi)==null?void 0:m.inputMode)==="schema"&&((g=a.openapi)!=null&&g.schema))try{n.schema=JSON.parse(a.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}return(f=a.openapi)!=null&&f.securityType&&a.openapi.securityType!=="none"&&(n.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:{token:a.openapi.oauth2Token||""}},...a.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:a.openapi.openIdConnectUrl||"",token:a.openapi.openIdConnectToken||""}}}),n},zS=({formData:a,serverType:n,envVars:l,headerVars:o})=>{var h,b,y;const c=ch(l),u=ch(o),m=RS(a.options),g=((h=a.description)==null?void 0:h.trim())||"",f={type:n,description:g,options:m};return n==="openapi"?(f.headers=u,f.openapi=OS(a)):n==="sse"||n==="streamable-http"?(f.url=a.url.trim(),f.env=c,f.headers=u,f.passthroughHeaders=rx(a.passthroughHeaders),f.oauth=TS(a.oauth),f.enableKeepAlive=((b=a.keepAlive)==null?void 0:b.enabled)||!1,f.keepAliveInterval=(y=a.keepAlive)!=null&&y.enabled?a.keepAlive.interval||6e4:void 0):(f.command=a.command.trim(),f.args=a.args,f.env=c),{name:a.name.trim(),config:f}},Ll=({onSubmit:a,onCancel:n,initialData:l=null,modalTitle:o,formError:c=null})=>{var U,M,q,de,ee,X,he,se,ye,ie,ae,be,Ne,xe,ke,Se,Le,at,gt,Mt,Pt,Nr,ft,kr,tr,Qt,ht,Re,Oe,it,qt,Gt,ot,_t,bt,Jr,Da,La,pr,sr,Ir,nr,Fr,Q,we,He,jt,Je,We,gr,rr,Cr,Hr;const{t:u}=ve(),m=()=>!l||!l.config?"stdio":l.config.type?l.config.type:l.config.url?"sse":"stdio",g=fe=>!fe||!fe.config||!fe.config.env?[]:Object.entries(fe.config.env).map(([ce,je])=>({key:ce,value:je,description:""})),f=fe=>{var je;const ce=(je=fe==null?void 0:fe.config)==null?void 0:je.oauth;return{clientId:(ce==null?void 0:ce.clientId)||"",clientSecret:(ce==null?void 0:ce.clientSecret)||"",scopes:ce!=null&&ce.scopes?ce.scopes.join(" "):"",accessToken:(ce==null?void 0:ce.accessToken)||"",refreshToken:(ce==null?void 0:ce.refreshToken)||"",authorizationEndpoint:(ce==null?void 0:ce.authorizationEndpoint)||"",tokenEndpoint:(ce==null?void 0:ce.tokenEndpoint)||"",resource:(ce==null?void 0:ce.resource)||""}},[h,b]=x.useState(m()),[y,w]=x.useState({name:l&&l.name||"",description:l&&l.config&&l.config.description||"",url:l&&l.config&&l.config.url||"",command:l&&l.config&&l.config.command||"",arguments:l&&l.config&&l.config.args?Array.isArray(l.config.args)?l.config.args.join(" "):String(l.config.args):"",args:l&&l.config&&l.config.args||[],type:m(),env:g(l),headers:[],passthroughHeaders:((M=(U=l==null?void 0:l.config)==null?void 0:U.passthroughHeaders)==null?void 0:M.join(", "))||"",options:{timeout:l&&l.config&&l.config.options&&l.config.options.timeout||6e4,resetTimeoutOnProgress:((de=(q=l==null?void 0:l.config)==null?void 0:q.options)==null?void 0:de.resetTimeoutOnProgress)??!0,maxTotalTimeout:l&&l.config&&l.config.options&&l.config.options.maxTotalTimeout||void 0},oauth:f(l),keepAlive:{enabled:((ee=l==null?void 0:l.config)==null?void 0:ee.enableKeepAlive)||!1,interval:((X=l==null?void 0:l.config)==null?void 0:X.keepAliveInterval)||6e4},openapi:l&&l.config&&l.config.openapi?{url:l.config.openapi.url||"",schema:l.config.openapi.schema?JSON.stringify(l.config.openapi.schema,null,2):"",inputMode:l.config.openapi.url?"url":l.config.openapi.schema?"schema":"url",version:l.config.openapi.version||"3.1.0",securityType:((he=l.config.openapi.security)==null?void 0:he.type)||"none",apiKeyName:((ye=(se=l.config.openapi.security)==null?void 0:se.apiKey)==null?void 0:ye.name)||"",apiKeyIn:((ae=(ie=l.config.openapi.security)==null?void 0:ie.apiKey)==null?void 0:ae.in)||"header",apiKeyValue:((Ne=(be=l.config.openapi.security)==null?void 0:be.apiKey)==null?void 0:Ne.value)||"",httpScheme:((ke=(xe=l.config.openapi.security)==null?void 0:xe.http)==null?void 0:ke.scheme)||"bearer",httpCredentials:((Le=(Se=l.config.openapi.security)==null?void 0:Se.http)==null?void 0:Le.credentials)||"",oauth2Token:((gt=(at=l.config.openapi.security)==null?void 0:at.oauth2)==null?void 0:gt.token)||"",openIdConnectUrl:((Pt=(Mt=l.config.openapi.security)==null?void 0:Mt.openIdConnect)==null?void 0:Pt.url)||"",openIdConnectToken:((ft=(Nr=l.config.openapi.security)==null?void 0:Nr.openIdConnect)==null?void 0:ft.token)||"",passthroughHeaders:l.config.openapi.passthroughHeaders?l.config.openapi.passthroughHeaders.join(", "):""}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",passthroughHeaders:""}}),[N,S]=x.useState(l&&l.config&&l.config.env?Object.entries(l.config.env).map(([fe,ce])=>({key:fe,value:ce})):[]),[j,C]=x.useState(l&&l.config&&l.config.headers?Object.entries(l.config.headers).map(([fe,ce])=>({key:fe,value:ce})):[]),[z,E]=x.useState(!1),[T,B]=x.useState(!1),[D,Y]=x.useState(!1),[R,_]=x.useState(null),P=!!l,V=fe=>{const{name:ce,value:je}=fe.target;w({...y,[ce]:je})},K=fe=>{const ce=fe.split(" ").filter(je=>je.trim()!=="");w({...y,arguments:fe,args:ce})},G=fe=>{b(fe),w(ce=>({...ce,type:fe}))},I=(fe,ce,je)=>{const Xt=[...N];Xt[fe][ce]=je,S(Xt)},L=()=>{S([...N,{key:"",value:""}])},Z=fe=>{const ce=[...N];ce.splice(fe,1),S(ce)},A=(fe,ce,je)=>{const Xt=[...j];Xt[fe][ce]=je,C(Xt)},H=()=>{C([...j,{key:"",value:""}])},J=fe=>{const ce=[...j];ce.splice(fe,1),C(ce)},me=(fe,ce)=>{w(je=>({...je,oauth:{...je.oauth||{},[fe]:ce}}))},le=(fe,ce)=>{w(je=>({...je,options:{...je.options,[fe]:ce}}))},k=async fe=>{fe.preventDefault(),_(null);try{const ce=zS({formData:y,serverType:h,envVars:N,headerVars:j});a(ce)}catch(ce){_(`Error: ${ce instanceof Error?ce.message:String(ce)}`)}};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 w-full max-w-3xl max-h-screen overflow-y-auto",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),t.jsx("button",{onClick:n,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),(R||c)&&t.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:c||R}),t.jsxs("form",{onSubmit:k,children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:u("server.name")}),t.jsx("input",{type:"text",name:"name",id:"name",value:y.name,onChange:V,className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"e.g.: time-mcp",required:!0})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"description",children:u("server.description")}),t.jsx("input",{type:"text",name:"description",id:"description",value:y.description||"",onChange:V,className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:u("server.descriptionPlaceholder")})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:u("server.type")}),t.jsxs("div",{className:"flex space-x-4",children:[t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",checked:h==="stdio",onChange:()=>G("stdio"),className:"mr-1"}),t.jsx("label",{htmlFor:"command",children:u("server.typeStdio")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:h==="sse",onChange:()=>G("sse"),className:"mr-1"}),t.jsx("label",{htmlFor:"url",children:u("server.typeSse")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:h==="streamable-http",onChange:()=>G("streamable-http"),className:"mr-1"}),t.jsx("label",{htmlFor:"streamable-http",children:u("server.typeStreamableHttp")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:h==="openapi",onChange:()=>G("openapi"),className:"mr-1"}),t.jsx("label",{htmlFor:"openapi",children:u("server.typeOpenapi")})]})]})]}),h==="openapi"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:u("server.openapi.inputMode")}),t.jsxs("div",{className:"flex space-x-4",children:[t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((kr=y.openapi)==null?void 0:kr.inputMode)==="url",onChange:()=>w(fe=>({...fe,openapi:{...fe.openapi,inputMode:"url"}})),className:"mr-1"}),t.jsx("label",{htmlFor:"input-mode-url",children:u("server.openapi.inputModeUrl")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((tr=y.openapi)==null?void 0:tr.inputMode)==="schema",onChange:()=>w(fe=>({...fe,openapi:{...fe.openapi,inputMode:"schema"}})),className:"mr-1"}),t.jsx("label",{htmlFor:"input-mode-schema",children:u("server.openapi.inputModeSchema")})]})]})]}),((Qt=y.openapi)==null?void 0:Qt.inputMode)==="url"&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"openapi-url",children:u("server.openapi.specUrl")}),t.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((ht=y.openapi)==null?void 0:ht.url)||"",onChange:fe=>w(ce=>({...ce,openapi:{...ce.openapi,url:fe.target.value}})),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:h==="openapi"&&((Re=y.openapi)==null?void 0:Re.inputMode)==="url"})]}),((Oe=y.openapi)==null?void 0:Oe.inputMode)==="schema"&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"openapi-schema",children:u("server.openapi.schema")}),t.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((it=y.openapi)==null?void 0:it.schema)||"",onChange:fe=>w(ce=>({...ce,openapi:{...ce.openapi,schema:fe.target.value}})),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline font-mono text-sm",placeholder:`{
|
|
236
|
+
}`,className:`w-full h-64 border rounded-md px-3 py-2 font-mono text-sm resize-y form-input ${j?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`}),j&&t.jsx("p",{className:"text-status-red text-xs mt-1",children:j})]}),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-1 text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary",children:m("tool.cancel")}),t.jsx("button",{onClick:()=>{try{const K=JSON.parse(N);n(K)}catch{C(m("tool.invalidJsonFormat"))}},disabled:o||!!j,className:"px-4 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary",children:m(o?"tool.running":"tool.runTool")})]})]}):t.jsxs("form",{onSubmit:R,className:"space-y-4",children:[Object.entries(z.properties||{}).map(([K,G])=>V(K,G)),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-1 text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary",children:m("tool.cancel")}),t.jsx("button",{type:"submit",disabled:o,className:"px-4 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary",children:m(o?"tool.running":"tool.runTool")})]})]})]}):t.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("p",{className:"text-sm text-gray-600",children:m("tool.noParameters")}),t.jsxs("div",{className:"flex justify-end space-x-2 mt-4",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-sm text-gray-600 bg-gray-100 dark:bg-gray-800 rounded-md hover:bg-gray-200",children:m("tool.cancel")}),t.jsx("button",{onClick:()=>n({}),disabled:o,className:"px-4 py-2 text-sm text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50",children:m(o?"tool.running":"tool.runTool")})]})]})},vS=({result:a,onClose:n})=>{const{t:l}=ve(),o=a.content,c=b=>b?b.startsWith("image/")?b:`image/${b}`:"image/png",u=b=>{if(!b)return[];if(Array.isArray(b))return b.flatMap(N=>u(N));if(typeof b!="object")return[];const y=[];b.type==="image"&&b.data&&y.push({data:String(b.data),mimeType:c(b.mimeType||b.mime_type)});const w=b.image_base64||b.imageBase64||b.image_data||b.imageData||b.base64;return w&&y.push({data:String(w),mimeType:c(b.image_mimeType||b.image_mime_type||b.mimeType||b.mime_type)}),b.image&&typeof b.image=="object"&&y.push(...u(b.image)),Array.isArray(b.images)&&y.push(...u(b.images)),Array.isArray(b.content)&&y.push(...u(b.content)),y},m=b=>{const y=[];try{const S=JSON.parse(b);if(y.push(...u(S)),y.length>0)return y}catch{}const w=/data:image\/(png|jpe?g|gif|webp);base64,([A-Za-z0-9+/=]+)/g;let N;for(;(N=w.exec(b))!==null;){const S=`image/${N[1]==="jpg"?"jpeg":N[1]}`;y.push({data:N[2],mimeType:S})}return y},g=b=>{try{const y=JSON.parse(b),w=N=>{if(Array.isArray(N))return N.map(w);if(N&&typeof N=="object"){const S={};for(const[j,C]of Object.entries(N))typeof C=="string"&&j.toLowerCase().includes("base64")?S[j]="[base64 omitted]":S[j]=w(C);return S}return N};return JSON.stringify(w(y),null,2)}catch{return b.replace(/data:image\/(png|jpe?g|gif|webp);base64,[A-Za-z0-9+/=]+/g,"[image data omitted]")}},f=b=>Array.isArray(b)?b.map((y,w)=>t.jsx("div",{className:"mb-3 last:mb-0",children:h(y)},w)):h(b),h=b=>{if(typeof b=="string"){const y=m(b),w=g(b);return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[y.length>0&&t.jsx("div",{className:"mb-3 space-y-3",children:y.map((N,S)=>t.jsx("img",{src:`data:${N.mimeType||"image/png"};base64,${N.data}`,alt:l("tool.toolResult"),className:"max-w-full h-auto rounded-md"},S))}),t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:w})]})}if(typeof b=="object"&&b!==null){if(b.type==="text"&&b.text){const y=m(b.text),w=g(b.text);return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[y.length>0&&t.jsx("div",{className:"mb-3 space-y-3",children:y.map((N,S)=>t.jsx("img",{src:`data:${N.mimeType||"image/png"};base64,${N.data}`,alt:l("tool.toolResult"),className:"max-w-full h-auto rounded-md"},S))}),t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:w})]})}if(b.type==="image"&&b.data)return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("img",{src:`data:${b.mimeType||"image/png"};base64,${b.data}`,alt:l("tool.toolResult"),className:"max-w-full h-auto rounded-md"})});try{const y=typeof b=="string"?JSON.parse(b):b;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[t.jsx("div",{className:"text-xs text-gray-500 mb-2",children:l("tool.jsonResponse")}),t.jsx("pre",{className:"text-sm text-gray-800 overflow-auto",children:JSON.stringify(y,null,2)})]})}catch{return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(b)})})}}return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(b)})})};return t.jsxs("div",{className:"border border-gray-300 rounded-lg bg-white dark:bg-gray-800 shadow-sm",children:[t.jsx("div",{className:"border-b border-gray-300 px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-t-lg",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[a.success?t.jsx(v0,{size:20,className:"text-status-green"}):t.jsx(w0,{size:20,className:"text-status-red"}),t.jsx("div",{children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900",children:[l("tool.execution")," ",a.success?l("tool.successful"):l("tool.failed")]})})]}),t.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 text-sm",children:"✕"})]})}),t.jsx("div",{className:"p-4",children:a.success?t.jsx("div",{children:a.content&&a.content.length>0?t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 mb-3",children:l("tool.result")}),f(a.content)]}):t.jsx("div",{className:"text-sm text-gray-500 italic",children:l("tool.noContent")})}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[t.jsx(Rd,{size:16,className:"text-red-500"}),t.jsx("span",{className:"text-sm font-medium text-red-700",children:l("tool.error")})]}),o&&o.length>0?t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 mb-3",children:l("tool.errorDetails")}),f(o)]}):t.jsx("div",{className:"bg-red-50 border border-red-300 rounded-md p-3",children:t.jsx("pre",{className:"text-sm text-red-800 whitespace-pre-wrap",children:a.error||a.message||l("tool.unknownError")})})]})})]})},kn=({title:a,onClick:n,disabled:l=!1,loading:o=!1})=>t.jsx("button",{type:"button",className:"ml-2 p-1 text-amber-600 hover:text-amber-700 cursor-pointer transition-colors disabled:opacity-60 disabled:cursor-not-allowed",onClick:n,disabled:l,title:a,"aria-label":a,children:t.jsx(zw,{size:14,className:o?"animate-spin":""})});function wS(a){return a==null?!0:typeof a=="string"?a.trim()==="":Array.isArray(a)?a.length===0:typeof a=="object"?Object.keys(a).length===0:!1}const jS=({tool:a,server:n,onToggle:l,onDescriptionUpdate:o})=>{const{t:c}=ve(),{showToast:u}=Pa(),{nameSeparator:m}=Os(),[g,f]=x.useState(!1),[h,b]=x.useState(!1),[y,w]=x.useState(!1),[N,S]=x.useState(null),[j,C]=x.useState(!1),[z,E]=x.useState(!1),[T,B]=x.useState(a.description||""),D=x.useRef(null),Y=x.useRef(null),[R,_]=x.useState(0),[P,V]=x.useState(!1);x.useEffect(()=>{j&&D.current&&(D.current.focus(),R>0&&(D.current.style.width=`${R+20}px`))},[j,R]),x.useEffect(()=>{!j&&Y.current&&_(Y.current.offsetWidth)},[j,T]),x.useEffect(()=>{B(a.description||"")},[a.description]);const K=x.useCallback(()=>`mcphub_tool_form_${n?`${n}_`:""}${a.name}`,[a.name,n]),G=x.useCallback(()=>{localStorage.removeItem(K())},[K]),I=M=>{l&&l(a.name,M)},L=()=>{C(!0)},Z=async()=>{try{const M=await Q0(n,a.name,T);M.success?(C(!1),o&&o(a.name,T)):(B(a.description||""),console.error("Failed to update tool description:",M.error))}catch(M){console.error("Error updating tool description:",M),B(a.description||""),C(!1)}},A=M=>{B(M.target.value)},H=async()=>{E(!0);try{const M=await X0(n,a.name);if(M.success){const q=M.description||"";B(q),C(!1),o==null||o(a.name,q,{restored:!0})}else u(M.error||c("tool.restoreDefaultFailed"),"error")}catch(M){console.error("Error resetting tool description:",M),u(c("tool.restoreDefaultFailed"),"error")}finally{E(!1)}},J=M=>{M.key==="Enter"?Z():M.key==="Escape"&&(B(a.description||""),C(!1))},me=async M=>{M.stopPropagation();try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(a.name),V(!0),u(c("common.copySuccess"),"success"),setTimeout(()=>V(!1),2e3);else{const q=document.createElement("textarea");q.value=a.name,q.style.position="fixed",q.style.left="-9999px",document.body.appendChild(q),q.focus(),q.select();try{document.execCommand("copy"),V(!0),u(c("common.copySuccess"),"success"),setTimeout(()=>V(!1),2e3)}catch(de){u(c("common.copyFailed"),"error"),console.error("Copy to clipboard failed:",de)}document.body.removeChild(q)}}catch(q){u(c("common.copyFailed"),"error"),console.error("Copy to clipboard failed:",q)}},le=async M=>{w(!0);try{M=Object.fromEntries(Object.entries(M).filter(([de,ee])=>!wS(ee)));const q=await J0({toolName:a.name,arguments:M},n);S(q)}catch(q){S({success:!1,error:q instanceof Error?q.message:"Unknown error occurred"})}finally{w(!1)}},k=()=>{b(!1),G(),S(null)},U=()=>{S(null)};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow rounded-lg mb-4",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer p-2",onClick:M=>{M.stopPropagation(),f(!g)},children:[t.jsx("div",{className:"flex-1",children:t.jsxs("h3",{className:"text-lg font-medium text-gray-900 inline-flex items-center",children:[a.name.replace(n+m,""),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:me,title:c("common.copy"),children:P?t.jsx(za,{size:16,className:"text-green-500"}):t.jsx(jn,{size:16})}),t.jsx("span",{className:"ml-2 text-sm font-normal text-gray-600 inline-flex items-center",children:j?t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:D,type:"text",className:"px-2 py-1 border border-blue-300 rounded bg-white dark:bg-gray-800 text-sm focus:outline-none form-input",value:T,onChange:A,onKeyDown:J,onClick:M=>M.stopPropagation(),style:{minWidth:"100px",width:R>0?`${R+20}px`:"auto"}}),t.jsx("button",{className:"ml-2 p-1 text-green-600 hover:text-green-800 cursor-pointer transition-colors",onClick:M=>{M.stopPropagation(),Z()},disabled:z,children:t.jsx(za,{size:16})}),t.jsx(kn,{title:c("tool.restoreDefault"),onClick:M=>{M.stopPropagation(),H()},disabled:z,loading:z})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:Y,children:T||c("tool.noDescription")}),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:M=>{M.stopPropagation(),L()},children:t.jsx(ds,{size:14})}),t.jsx(kn,{title:c("tool.restoreDefault"),onClick:M=>{M.stopPropagation(),H()},disabled:z,loading:z})]})})]})}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"flex items-center space-x-2",onClick:M=>M.stopPropagation(),children:t.jsx(Jt,{checked:a.enabled??!0,onCheckedChange:I,disabled:y})}),t.jsxs("button",{onClick:M=>{M.stopPropagation(),f(!0),b(!0)},className:"flex items-center space-x-1 px-3 py-1 text-sm text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors btn-primary",disabled:y||!a.enabled,children:[y?t.jsx(j0,{size:14,className:"animate-spin"}):t.jsx(S0,{size:14}),t.jsx("span",{children:c(y?"tool.running":"tool.run")})]}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:g?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),g&&t.jsxs("div",{className:"mt-4 space-y-4",children:[!h&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded p-3 border border-gray-300",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:c("tool.inputSchema")}),t.jsx("pre",{className:"text-xs text-gray-600 overflow-auto",children:JSON.stringify(a.inputSchema,null,2)})]}),h&&t.jsxs("div",{className:"border border-gray-300 rounded-lg p-4",children:[t.jsx(Z0,{schema:a.inputSchema||{type:"object"},onSubmit:le,onCancel:k,loading:y,storageKey:K(),title:c("tool.runToolWithName",{name:a.name.replace(n+m,"")})}),N&&t.jsx("div",{className:"mt-4",children:t.jsx(vS,{result:N,onClose:U})})]})]})]})},SS=async(a,n)=>{try{const l=n?`/prompts/call/${n}`:"/prompts/call",o=await pt(l,{promptName:a.promptName,arguments:a.arguments});return o.success?{success:!0,data:o.data}:{success:!1,error:o.message||"Prompt call failed"}}catch(l){return console.error("Error calling prompt",{promptName:a.promptName,server:n,error:l}),{success:!1,error:l instanceof Error?l.message:"Unknown error occurred"}}},W0=async(a,n)=>{try{const l=await pt(`/mcp/${encodeURIComponent(n||"")}/prompts/${encodeURIComponent(a.promptName)}`,{name:a.promptName,arguments:a.arguments});if(!l.success)throw new Error(`Failed to get prompt: ${l.message||"Unknown error"}`);return{success:!0,data:l.data}}catch(l){return console.error("Error getting prompt",{promptName:a.promptName,server:n,error:l}),{success:!1,error:l instanceof Error?l.message:"Unknown error occurred"}}},NS=async(a,n,l)=>{try{const o=await pt(`/servers/${encodeURIComponent(a)}/prompts/${encodeURIComponent(n)}/toggle`,{enabled:l});return{success:o.success,error:o.success?void 0:o.message}}catch(o){return console.error("Error toggling prompt",{serverName:a,promptName:n,enabled:l,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},ex=async(a,n,l)=>{try{const o=await At(`/servers/${encodeURIComponent(a)}/prompts/${encodeURIComponent(n)}/description`,{description:l},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:o.success,error:o.success?void 0:o.message}}catch(o){return console.error("Error updating prompt description",{serverName:a,promptName:n,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},tx=async(a,n)=>{var l;try{const o=await Yr(`/servers/${encodeURIComponent(a)}/prompts/${encodeURIComponent(n)}/description`,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:o.success,error:o.success?void 0:o.message,description:(l=o.data)==null?void 0:l.description}}catch(o){return console.error("Error resetting prompt description",{serverName:a,promptName:n,error:o}),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},kS=Object.freeze(Object.defineProperty({__proto__:null,callPrompt:SS,getPrompt:W0,resetPromptDescription:tx,togglePrompt:NS,updatePromptDescription:ex},Symbol.toStringTag,{value:"Module"})),oh=({result:a,onClose:n})=>{const{t:l}=ve(),o=c=>{if(typeof c=="string")return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:c})});if(typeof c=="object"&&c!==null){if(c.description||c.messages)return t.jsxs("div",{className:"space-y-4",children:[c.description&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:l("prompt.description")}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("p",{className:"text-sm text-gray-800",children:c.description})})]}),c.messages&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:l("prompt.messages")}),t.jsx("div",{className:"space-y-3",children:c.messages.map((u,m)=>t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[t.jsx("div",{className:"flex items-center mb-2",children:t.jsxs("span",{className:"inline-block w-16 text-xs font-medium text-gray-500",children:[u.role,":"]})}),typeof u.content=="string"?t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:u.content}):typeof u.content=="object"&&u.content.type==="text"?t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:u.content.text}):t.jsx("pre",{className:"text-sm text-gray-800 overflow-auto",children:JSON.stringify(u.content,null,2)})]},m))})]})]});try{const u=typeof c=="string"?JSON.parse(c):c;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:[t.jsx("div",{className:"text-xs text-gray-500 mb-2",children:l("prompt.jsonResponse")}),t.jsx("pre",{className:"text-sm text-gray-800 overflow-auto",children:JSON.stringify(u,null,2)})]})}catch{return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(c)})})}}return t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-3",children:t.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-800 font-mono",children:String(c)})})};return t.jsxs("div",{className:"border border-gray-300 rounded-lg bg-white dark:bg-gray-800 shadow-sm",children:[t.jsx("div",{className:"border-b border-gray-300 px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-t-lg",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[a.success?t.jsx(v0,{size:20,className:"text-status-green"}):t.jsx(w0,{size:20,className:"text-status-red"}),t.jsx("div",{children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900",children:[l("prompt.execution")," ",a.success?l("prompt.successful"):l("prompt.failed")]})})]}),t.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 text-sm",children:"✕"})]})}),t.jsx("div",{className:"p-4",children:a.success?t.jsx("div",{children:a.data?t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 mb-3",children:l("prompt.result")}),o(a.data)]}):t.jsx("div",{className:"text-sm text-gray-500 italic",children:l("prompt.noContent")})}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-3",children:[t.jsx(Rd,{size:16,className:"text-red-500"}),t.jsx("span",{className:"text-sm font-medium text-red-700",children:l("prompt.error")})]}),t.jsx("div",{className:"bg-red-50 border border-red-300 rounded-md p-3",children:t.jsx("pre",{className:"text-sm text-red-800 whitespace-pre-wrap",children:a.error||a.message||l("prompt.unknownError")})})]})})]})},CS=({prompt:a,server:n,onToggle:l,onDescriptionUpdate:o})=>{const{t:c}=ve(),{showToast:u}=Pa(),{nameSeparator:m}=Os(),[g,f]=x.useState(!1),[h,b]=x.useState(!1),[y,w]=x.useState(!1),[N,S]=x.useState(null),[j,C]=x.useState(!1),[z,E]=x.useState(!1),[T,B]=x.useState(a.description||""),D=x.useRef(null),Y=x.useRef(null),[R,_]=x.useState(0);x.useEffect(()=>{j&&D.current&&(D.current.focus(),R>0&&(D.current.style.width=`${R+20}px`))},[j,R]),x.useEffect(()=>{!j&&Y.current&&_(Y.current.offsetWidth)},[j,T]),x.useEffect(()=>{B(a.description||"")},[a.description]);const P=x.useCallback(()=>`mcphub_prompt_form_${n?`${n}_`:""}${a.name}`,[a.name,n]),V=x.useCallback(()=>{localStorage.removeItem(P())},[P]),K=k=>{l&&l(a.name,k)},G=()=>{C(!0)},I=async()=>{C(!1);try{const k=await ex(n,a.name,T);k.success?o&&o(a.name,T):(u(k.error||c("prompt.descriptionUpdateFailed"),"error"),B(a.description||""))}catch(k){console.error("Error updating prompt description:",k),u(c("prompt.descriptionUpdateFailed"),"error"),B(a.description||"")}},L=async()=>{E(!0);try{const k=await tx(n,a.name);if(k.success){const U=k.description||"";B(U),C(!1),o==null||o(a.name,U,{restored:!0})}else u(k.error||c("prompt.restoreDefaultFailed"),"error")}catch(k){console.error("Error resetting prompt description:",k),u(c("prompt.restoreDefaultFailed"),"error")}finally{E(!1)}},Z=k=>{B(k.target.value)},A=k=>{k.key==="Enter"?I():k.key==="Escape"&&(B(a.description||""),C(!1))},H=async k=>{w(!0);try{const U=await W0({promptName:a.name,arguments:k},n);console.log("GetPrompt result:",U),S({success:U.success,data:U.data,error:U.error})}catch(U){S({success:!1,error:U instanceof Error?U.message:"Unknown error occurred"})}finally{w(!1)}},J=()=>{b(!1),V(),S(null)},me=()=>{S(null)},le=()=>{if(!a.arguments||a.arguments.length===0)return{type:"object",properties:{},required:[]};const k={},U=[];return a.arguments.forEach(M=>{k[M.name]={type:"string",description:M.description||""},M.required&&U.push(M.name)}),{type:"object",properties:k,required:U}};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow rounded-lg mb-4",children:[t.jsxs("div",{className:"flex justify-between items-center p-2 cursor-pointer",onClick:()=>f(!g),children:[t.jsx("div",{className:"flex-1",children:t.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:[a.name.replace(n+m,""),a.title&&t.jsx("span",{className:"ml-2 text-sm font-normal text-gray-600",children:a.title}),t.jsx("span",{className:"ml-2 text-sm font-normal text-gray-500 inline-flex items-center",children:j?t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:D,type:"text",className:"px-2 py-1 border border-blue-300 rounded bg-white dark:bg-gray-800 text-sm focus:outline-none form-input",value:T,onChange:Z,onKeyDown:A,onClick:k=>k.stopPropagation(),style:{minWidth:"100px",width:R>0?`${R+20}px`:"auto"}}),t.jsx("button",{className:"ml-2 p-1 text-green-600 hover:text-green-800 cursor-pointer transition-colors",onClick:k=>{k.stopPropagation(),I()},disabled:z,children:t.jsx(za,{size:16})}),t.jsx(kn,{title:c("prompt.restoreDefault"),onClick:k=>{k.stopPropagation(),L()},disabled:z,loading:z})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:Y,children:T||c("tool.noDescription")}),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:k=>{k.stopPropagation(),G()},children:t.jsx(ds,{size:14})}),t.jsx(kn,{title:c("prompt.restoreDefault"),onClick:k=>{k.stopPropagation(),L()},disabled:z,loading:z})]})})]})}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"flex items-center space-x-2",onClick:k=>k.stopPropagation(),children:a.enabled!==void 0&&t.jsx(Jt,{checked:a.enabled,onCheckedChange:K,disabled:y})}),t.jsxs("button",{onClick:k=>{k.stopPropagation(),f(!0),b(!0)},className:"flex items-center space-x-1 px-3 py-1 text-sm text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors btn-primary",disabled:y||!a.enabled,children:[y?t.jsx(j0,{size:14,className:"animate-spin"}):t.jsx(S0,{size:14}),t.jsx("span",{children:c(y?"tool.running":"tool.run")})]}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:g?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),g&&t.jsxs("div",{className:"mt-4 space-y-4",children:[h&&t.jsxs("div",{className:"border border-gray-300 rounded-lg p-4",children:[t.jsx(Z0,{schema:le(),onSubmit:H,onCancel:J,loading:y,storageKey:P(),title:c("prompt.runPromptWithName",{name:a.name.replace(n+m,"")})}),N&&t.jsx("div",{className:"mt-4",children:t.jsx(oh,{result:N,onClose:me})})]}),!h&&a.arguments&&a.arguments.length>0&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded p-3 border border-gray-300",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:c("tool.parameters")}),t.jsx("div",{className:"space-y-2",children:a.arguments.map((k,U)=>t.jsxs("div",{className:"flex items-start",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("span",{className:"font-medium text-gray-700",children:k.name}),k.required&&t.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),k.description&&t.jsx("p",{className:"text-sm text-gray-600 mt-1",children:k.description})]}),t.jsx("div",{className:"text-xs text-gray-500 ml-2",children:k.title||""})]},U))})]}),!h&&N&&t.jsx("div",{className:"mt-4",children:t.jsx(oh,{result:N,onClose:me})})]})]})},AS=({resource:a,onToggle:n,onDescriptionUpdate:l})=>{const{t:o}=ve(),[c,u]=x.useState(!1),[m,g]=x.useState(!1),[f,h]=x.useState(!1),[b,y]=x.useState(a.description||""),w=x.useRef(null),N=x.useRef(null),[S,j]=x.useState(0);x.useEffect(()=>{m&&w.current&&(w.current.focus(),S>0&&(w.current.style.width=`${S+20}px`))},[m,S]),x.useEffect(()=>{!m&&N.current&&j(N.current.offsetWidth)},[m,b]),x.useEffect(()=>{y(a.description||"")},[a.description]);const C=B=>{n&&n(a.uri,B)},z=async()=>{g(!1),l&&await l(a.uri,b)},E=async()=>{h(!0);try{await(l==null?void 0:l(a.uri,"",{restored:!0})),g(!1)}finally{h(!1)}},T=B=>{B.key==="Enter"?z():B.key==="Escape"&&(y(a.description||""),g(!1))};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow rounded-lg mb-4",children:[t.jsxs("div",{className:"flex justify-between items-center p-2 cursor-pointer",onClick:()=>u(!c),children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 truncate",children:a.name||a.uri}),t.jsx("div",{className:"text-sm text-gray-500 truncate",children:a.uri}),t.jsx("span",{className:"text-sm font-normal text-gray-500 inline-flex items-center mt-1",children:m?t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:w,type:"text",className:"px-2 py-1 border border-blue-300 rounded bg-white dark:bg-gray-800 text-sm focus:outline-none form-input",value:b,onChange:B=>y(B.target.value),onKeyDown:T,onClick:B=>B.stopPropagation(),style:{minWidth:"100px",width:S>0?`${S+20}px`:"auto"}}),t.jsx("button",{className:"ml-2 p-1 text-green-600 hover:text-green-800 cursor-pointer transition-colors",onClick:B=>{B.stopPropagation(),z()},disabled:f,children:t.jsx(za,{size:16})}),t.jsx(kn,{title:o("builtinResources.restoreDefault"),onClick:B=>{B.stopPropagation(),E()},disabled:f,loading:f})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:N,children:b||o("tool.noDescription")}),t.jsx("button",{className:"ml-2 p-1 text-gray-500 hover:text-blue-600 cursor-pointer transition-colors",onClick:B=>{B.stopPropagation(),g(!0)},children:t.jsx(ds,{size:14})}),t.jsx(kn,{title:o("builtinResources.restoreDefault"),onClick:B=>{B.stopPropagation(),E()},disabled:f,loading:f})]})})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"flex items-center space-x-2",onClick:B=>B.stopPropagation(),children:t.jsx(Jt,{checked:a.enabled!==!1,onCheckedChange:C})}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:c?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),c&&t.jsx("div",{className:"mt-2 px-3 pb-3 text-sm text-gray-600 border-t border-gray-100 dark:border-gray-800",children:t.jsxs("div",{className:"pt-2",children:[t.jsxs("span",{className:"font-medium",children:[o("builtinResources.mimeType"),":"]})," ",a.mimeType||"text/plain"]})})]})},Pd=({isOpen:a,onClose:n,onConfirm:l,serverName:o,isGroup:c=!1,isUser:u=!1})=>{const{t:m}=ve();return a?t.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-30 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:t.jsxs("div",{className:"p-6",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-3",children:m(u?"users.confirmDelete":c?"groups.confirmDelete":"server.confirmDelete")}),t.jsx("p",{className:"text-gray-500 mb-6",children:u?m("users.deleteWarning",{username:o}):c?m("groups.deleteWarning",{name:o}):m("server.deleteWarning",{name:o})}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:n,className:"px-4 py-2 text-gray-600 hover:text-gray-800 btn-secondary",children:m("common.cancel")}),t.jsx("button",{onClick:l,className:"px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600 btn-danger",children:m("common.delete")})]})]})})}):null},ES=({server:a,onRemove:n,onEdit:l,onToggle:o,onRefresh:c,onReload:u})=>{var X,he,se,ye,ie,ae,be,Ne;const{t:m}=ve(),{showToast:g}=Pa(),[f,h]=x.useState(null),[b,y]=x.useState(!1),[w,N]=x.useState(!1),[S,j]=x.useState(!1),[C,z]=x.useState(!1),[E,T]=x.useState(!1),B=x.useRef(null);x.useEffect(()=>{const xe=ke=>{B.current&&!B.current.contains(ke.target)&&z(!1)};return document.addEventListener("mousedown",xe),()=>{document.removeEventListener("mousedown",xe)}},[]);const{exportMCPSettings:D}=Os(),Y=((X=a.tools)==null?void 0:X.length)||0,R=((he=a.tools)==null?void 0:he.filter(xe=>xe.enabled!==!1).length)||0,_=((se=a.prompts)==null?void 0:se.length)||0,P=((ye=a.prompts)==null?void 0:ye.filter(xe=>xe.enabled!==!1).length)||0,V=((ie=a.resources)==null?void 0:ie.length)||0,K=((ae=a.resources)==null?void 0:ae.filter(xe=>xe.enabled!==!1).length)||0,G=xe=>{xe.stopPropagation(),y(!0)},I=xe=>{xe.stopPropagation(),l(a)},L=async xe=>{if(xe.stopPropagation(),!(w||!o)){N(!0);try{await o(a,a.enabled===!1)}finally{N(!1)}}},Z=async xe=>{if(xe.stopPropagation(),!(S||!u)){j(!0);try{await u(a)?g(m("server.reloadSuccess")||"Server reloaded successfully","success"):g(m("server.reloadError",{serverName:a.name})||"Failed to reload server","error")}finally{j(!1)}}},A=xe=>{xe.stopPropagation(),z(!C)},H=xe=>{if(xe.stopPropagation(),!!a.error)if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(a.error).then(()=>{T(!0),g(m("common.copySuccess")||"Copied to clipboard","success"),setTimeout(()=>T(!1),2e3)});else{const ke=document.createElement("textarea");ke.value=a.error,ke.style.position="fixed",ke.style.left="-9999px",document.body.appendChild(ke),ke.focus(),ke.select();try{document.execCommand("copy"),T(!0),g(m("common.copySuccess")||"Copied to clipboard","success"),setTimeout(()=>T(!1),2e3)}catch(Se){g(m("common.copyFailed")||"Copy failed","error"),console.error("Copy to clipboard failed:",Se)}document.body.removeChild(ke)}},J=async xe=>{xe.stopPropagation();try{const ke=await D(a.name);if(!ke||!ke.success||!ke.data){g((ke==null?void 0:ke.message)||m("common.copyFailed")||"Copy failed","error");return}const Se=JSON.stringify(ke.data,null,2);if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(Se),g(m("common.copySuccess")||"Copied to clipboard","success");else{const Le=document.createElement("textarea");Le.value=Se,Le.style.position="fixed",Le.style.left="-9999px",document.body.appendChild(Le),Le.focus(),Le.select();try{document.execCommand("copy"),g(m("common.copySuccess")||"Copied to clipboard","success")}catch(at){g(m("common.copyFailed")||"Copy failed","error"),console.error("Copy to clipboard failed:",at)}document.body.removeChild(Le)}}catch(ke){console.error("Error copying server configuration:",ke),g(m("common.copyFailed")||"Copy failed","error")}},me=()=>{n(a.name),y(!1)},le=async(xe,ke)=>{try{const{toggleTool:Se}=await ro(async()=>{const{toggleTool:at}=await Promise.resolve().then(()=>bS);return{toggleTool:at}},[],import.meta.url),Le=await Se(a.name,xe,ke);Le.success?(g(m(ke?"tool.enableSuccess":"tool.disableSuccess",{name:xe}),"success"),c&&c()):g(Le.error||m("tool.toggleFailed"),"error")}catch(Se){console.error("Error toggling tool:",Se),g(m("tool.toggleFailed"),"error")}},k=async(xe,ke)=>{try{const{togglePrompt:Se}=await ro(async()=>{const{togglePrompt:at}=await Promise.resolve().then(()=>kS);return{togglePrompt:at}},void 0,import.meta.url),Le=await Se(a.name,xe,ke);Le.success?(g(m(ke?"tool.enableSuccess":"tool.disableSuccess",{name:xe}),"success"),c&&c()):g(Le.error||m("tool.toggleFailed"),"error")}catch(Se){console.error("Error toggling prompt:",Se),g(m("tool.toggleFailed"),"error")}},U=(xe,ke,Se)=>{g(Se!=null&&Se.restored?m("tool.restoreDefaultSuccess"):m("tool.descriptionUpdateSuccess"),"success"),c&&c()},M=(xe,ke,Se)=>{g(Se!=null&&Se.restored?m("prompt.restoreDefaultSuccess"):m("prompt.descriptionUpdateSuccess"),"success"),c&&c()},q=xe=>{var ke;if(xe.stopPropagation(),(ke=a.oauth)!=null&&ke.authorizationUrl){const at=window.screen.width/2-300,gt=window.screen.height/2-700/2;window.open(a.oauth.authorizationUrl,"OAuth Authorization",`width=600,height=700,left=${at},top=${gt}`),g(m("status.oauthWindowOpened"),"info")}},de=async(xe,ke)=>{try{const{toggleResource:Se}=await ro(async()=>{const{toggleResource:at}=await import("./resourceService-CUz722Nb.js");return{toggleResource:at}},[],import.meta.url),Le=await Se(a.name,xe,ke);Le.success?(g(m(ke?"tool.enableSuccess":"tool.disableSuccess",{name:xe}),"success"),c&&c()):g(Le.error||m("tool.toggleFailed"),"error")}catch(Se){console.error("Error toggling resource:",Se),g(m("tool.toggleFailed"),"error")}},ee=async(xe,ke,Se)=>{try{const{updateResourceDescription:Le,resetResourceDescription:at}=await ro(async()=>{const{updateResourceDescription:Mt,resetResourceDescription:Pt}=await import("./resourceService-CUz722Nb.js");return{updateResourceDescription:Mt,resetResourceDescription:Pt}},[],import.meta.url),gt=Se!=null&&Se.restored?await at(a.name,xe):await Le(a.name,xe,ke);gt.success?(g(Se!=null&&Se.restored?m("builtinResources.restoreDefaultSuccess"):m("builtinResources.descriptionUpdateSuccess"),"success"),c&&c()):g(gt.error||(Se!=null&&Se.restored?m("builtinResources.restoreDefaultFailed"):m("builtinResources.descriptionUpdateFailed")),"error")}catch(Le){console.error("Error updating resource description:",Le),g(Se!=null&&Se.restored?m("builtinResources.restoreDefaultFailed"):m("builtinResources.descriptionUpdateFailed"),"error")}};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 page-card transition-all duration-200",children:[t.jsxs("div",{className:"flex justify-between items-center p-4",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("h2",{className:`text-xl font-semibold ${a.enabled===!1?"text-gray-600":"text-gray-900"}`,children:a.name}),((be=a.config)==null?void 0:be.description)&&t.jsxs("span",{className:"text-sm text-gray-500",children:["(",a.config.description,")"]}),t.jsx(xS,{status:a.status,onAuthClick:q}),((Ne=a.config)==null?void 0:Ne.type)&&t.jsx("div",{className:"flex items-center px-2 py-1 bg-gray-100 dark:bg-gray-800 text-gray-700 rounded-full text-xs",children:t.jsxs("span",{children:[a.config.type==="stdio"&&m("server.typeStdio"),a.config.type==="sse"&&m("server.typeSse"),a.config.type==="streamable-http"&&m("server.typeStreamableHttp"),a.config.type==="openapi"&&m("server.typeOpenapi")]})}),t.jsxs("div",{className:`flex items-center px-2 py-1 rounded-full text-sm cursor-pointer transition-colors ${f==="tools"?"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-300":"bg-blue-50 text-blue-700 hover:bg-blue-100 dark:bg-gray-800 dark:text-blue-400 dark:hover:bg-gray-700"}`,onClick:xe=>{xe.stopPropagation(),h(ke=>ke==="tools"?null:"tools")},children:[t.jsx(Od,{className:"w-4 h-4 mr-1"}),t.jsxs("span",{children:[Y===0?"0":`${R}/${Y}`," ",m("server.tools")]})]}),t.jsxs("div",{className:`flex items-center px-2 py-1 rounded-full text-sm cursor-pointer transition-colors ${f==="prompts"?"bg-purple-100 text-purple-800 dark:bg-purple-900/50 dark:text-purple-300":"bg-purple-50 text-purple-700 hover:bg-purple-100 dark:bg-gray-800 dark:text-purple-400 dark:hover:bg-gray-700"}`,onClick:xe=>{xe.stopPropagation(),h(ke=>ke==="prompts"?null:"prompts")},children:[t.jsx(Nn,{className:"w-4 h-4 mr-1"}),t.jsxs("span",{children:[_===0?"0":`${P}/${_}`," ",m("server.prompts")]})]}),t.jsxs("div",{className:`flex items-center px-2 py-1 rounded-full text-sm cursor-pointer transition-colors ${f==="resources"?"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-300":"bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:bg-gray-800 dark:text-emerald-400 dark:hover:bg-gray-700"}`,onClick:xe=>{xe.stopPropagation(),h(ke=>ke==="resources"?null:"resources")},children:[t.jsx(Sn,{className:"w-4 h-4 mr-1"}),t.jsxs("span",{children:[V===0?"0":`${K}/${V}`," ",m("nav.resources")]})]}),a.error&&t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"cursor-pointer",onClick:A,"aria-label":m("server.viewErrorDetails"),children:t.jsx(Rd,{className:"text-red-500 hover:text-red-600",size:18})}),C&&t.jsxs("div",{ref:B,className:"absolute z-10 mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-lg p-0 w-120",style:{left:"-231px",top:"24px",maxHeight:"300px",overflowY:"auto",width:"480px",transform:"translateX(50%)"},onClick:xe=>xe.stopPropagation(),children:[t.jsxs("div",{className:"flex justify-between items-center sticky top-0 bg-white dark:bg-gray-800 py-2 px-4 border-b border-gray-200 dark:border-gray-700 z-20 shadow-sm",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("h4",{className:"text-sm font-medium text-red-600",children:m("server.errorDetails")}),t.jsx("button",{onClick:H,className:"p-1 text-gray-400 hover:text-gray-600 transition-colors btn-secondary",title:m("common.copy"),children:E?t.jsx(za,{size:14,className:"text-green-500"}):t.jsx(jn,{size:14})})]}),t.jsx("button",{onClick:xe=>{xe.stopPropagation(),z(!1)},className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),t.jsx("div",{className:"p-4 pt-2",children:t.jsx("pre",{className:"text-sm text-gray-700 break-words whitespace-pre-wrap",children:a.error})})]})]})]}),t.jsxs("div",{className:"flex space-x-2",children:[t.jsx("button",{onClick:J,className:"px-3 py-1 btn-secondary",children:m("server.copy")}),t.jsx("button",{onClick:I,className:"px-3 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary",children:m("server.edit")}),t.jsx("div",{className:"flex items-center",children:t.jsx("button",{onClick:L,className:`px-3 py-1 text-sm rounded transition-colors ${w?"bg-gray-200 text-gray-500":a.enabled!==!1?"bg-green-100 text-green-800 hover:bg-green-200 btn-secondary":"bg-blue-100 text-blue-800 hover:bg-blue-200 btn-primary"}`,disabled:w||S,children:w?m("common.processing"):a.enabled!==!1?m("server.disable"):m("server.enable")})}),u&&t.jsx("button",{onClick:Z,className:"px-3 py-1 bg-purple-100 text-purple-800 rounded hover:bg-purple-200 text-sm btn-secondary disabled:opacity-70 disabled:cursor-not-allowed",disabled:S||w||a.enabled===!1,children:m(S?"common.processing":"server.reload")}),t.jsx("button",{onClick:G,className:"px-3 py-1 bg-red-100 text-red-800 rounded hover:bg-red-200 text-sm btn-danger",children:m("server.delete")}),t.jsx("button",{className:"text-gray-400 hover:text-gray-600 btn-secondary",children:f?t.jsx(us,{size:18}):t.jsx(jo,{size:18})})]})]}),f==="tools"&&a.tools&&t.jsxs("div",{className:"px-4",children:[t.jsx("h6",{className:`font-medium ${a.enabled===!1?"text-gray-600":"text-gray-900"} mb-2`,children:m("server.tools")}),t.jsx("div",{className:"space-y-4",children:a.tools.map((xe,ke)=>t.jsx(jS,{server:a.name,tool:xe,onToggle:le,onDescriptionUpdate:U},ke))})]}),f==="prompts"&&a.prompts&&t.jsxs("div",{className:"px-4 pb-2",children:[t.jsx("h6",{className:`font-medium ${a.enabled===!1?"text-gray-600":"text-gray-900"}`,children:m("server.prompts")}),t.jsx("div",{className:"space-y-4",children:a.prompts.map((xe,ke)=>t.jsx(CS,{server:a.name,prompt:xe,onToggle:k,onDescriptionUpdate:M},ke))})]}),f==="resources"&&a.resources&&t.jsxs("div",{className:"px-4 pb-2",children:[t.jsx("h6",{className:`font-medium ${a.enabled===!1?"text-gray-600":"text-gray-900"}`,children:m("nav.resources")}),a.resources.length===0?t.jsx("div",{className:"text-sm text-gray-500 py-2",children:m("builtinResources.noResources")}):t.jsx("div",{className:"space-y-4",children:a.resources.map((xe,ke)=>t.jsx(AS,{resource:xe,onToggle:de,onDescriptionUpdate:ee},`${xe.uri}-${ke}`))})]})]}),t.jsx(Pd,{isOpen:b,onClose:()=>y(!1),onConfirm:me,serverName:a.name})]})},ch=a=>{const n={};return a.forEach(({key:l,value:o})=>{const c=l.trim();c&&(n[c]=o)}),n},rx=a=>a?a.split(",").map(n=>n.trim()).filter(n=>n.length>0):[],RS=a=>{const n={};return a!=null&&a.timeout&&a.timeout!==6e4&&(n.timeout=a.timeout),typeof(a==null?void 0:a.resetTimeoutOnProgress)=="boolean"&&(n.resetTimeoutOnProgress=a.resetTimeoutOnProgress),a!=null&&a.maxTotalTimeout&&(n.maxTotalTimeout=a.maxTotalTimeout),n},TS=a=>{var b,y,w,N,S,j,C,z;if(!a)return{};const n={},l=(b=a.clientId)==null?void 0:b.trim(),o=(y=a.clientSecret)==null?void 0:y.trim(),c=(w=a.scopes)==null?void 0:w.trim(),u=(N=a.accessToken)==null?void 0:N.trim(),m=(S=a.refreshToken)==null?void 0:S.trim(),g=(j=a.authorizationEndpoint)==null?void 0:j.trim(),f=(C=a.tokenEndpoint)==null?void 0:C.trim(),h=(z=a.resource)==null?void 0:z.trim();if(l&&(n.clientId=l),o&&(n.clientSecret=o),c){const E=c.split(/[\s,]+/).map(T=>T.trim()).filter(T=>T.length>0);E.length>0&&(n.scopes=E)}return u&&(n.accessToken=u),m&&(n.refreshToken=m),g&&(n.authorizationEndpoint=g),f&&(n.tokenEndpoint=f),h&&(n.resource=h),n},OS=a=>{var l,o,c,u,m,g,f;const n={version:((l=a.openapi)==null?void 0:l.version)||"3.1.0",passthroughHeaders:rx((o=a.openapi)==null?void 0:o.passthroughHeaders)};if(((c=a.openapi)==null?void 0:c.inputMode)==="url")n.url=((u=a.openapi)==null?void 0:u.url)||"";else if(((m=a.openapi)==null?void 0:m.inputMode)==="schema"&&((g=a.openapi)!=null&&g.schema))try{n.schema=JSON.parse(a.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}return(f=a.openapi)!=null&&f.securityType&&a.openapi.securityType!=="none"&&(n.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:{token:a.openapi.oauth2Token||""}},...a.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:a.openapi.openIdConnectUrl||"",token:a.openapi.openIdConnectToken||""}}}),n},zS=({formData:a,serverType:n,envVars:l,headerVars:o})=>{var h,b,y;const c=ch(l),u=ch(o),m=RS(a.options),g=((h=a.description)==null?void 0:h.trim())||"",f={type:n,description:g,options:m};return n==="openapi"?(f.headers=u,f.openapi=OS(a)):n==="sse"||n==="streamable-http"?(f.url=a.url.trim(),f.env=c,f.headers=u,f.passthroughHeaders=rx(a.passthroughHeaders),f.oauth=TS(a.oauth),f.enableKeepAlive=((b=a.keepAlive)==null?void 0:b.enabled)||!1,f.keepAliveInterval=(y=a.keepAlive)!=null&&y.enabled?a.keepAlive.interval||6e4:void 0):(f.command=a.command.trim(),f.args=a.args,f.env=c),{name:a.name.trim(),config:f}},Ll=({onSubmit:a,onCancel:n,initialData:l=null,modalTitle:o,formError:c=null})=>{var U,M,q,de,ee,X,he,se,ye,ie,ae,be,Ne,xe,ke,Se,Le,at,gt,Mt,Pt,Nr,ft,kr,tr,Qt,ht,Re,Oe,it,qt,Gt,ot,_t,bt,Jr,Da,La,pr,sr,Ir,nr,Fr,Q,we,He,jt,Je,We,gr,rr,Cr,Hr;const{t:u}=ve(),m=()=>!l||!l.config?"stdio":l.config.type?l.config.type:l.config.url?"sse":"stdio",g=fe=>!fe||!fe.config||!fe.config.env?[]:Object.entries(fe.config.env).map(([ce,je])=>({key:ce,value:je,description:""})),f=fe=>{var je;const ce=(je=fe==null?void 0:fe.config)==null?void 0:je.oauth;return{clientId:(ce==null?void 0:ce.clientId)||"",clientSecret:(ce==null?void 0:ce.clientSecret)||"",scopes:ce!=null&&ce.scopes?ce.scopes.join(" "):"",accessToken:(ce==null?void 0:ce.accessToken)||"",refreshToken:(ce==null?void 0:ce.refreshToken)||"",authorizationEndpoint:(ce==null?void 0:ce.authorizationEndpoint)||"",tokenEndpoint:(ce==null?void 0:ce.tokenEndpoint)||"",resource:(ce==null?void 0:ce.resource)||""}},[h,b]=x.useState(m()),[y,w]=x.useState({name:l&&l.name||"",description:l&&l.config&&l.config.description||"",url:l&&l.config&&l.config.url||"",command:l&&l.config&&l.config.command||"",arguments:l&&l.config&&l.config.args?Array.isArray(l.config.args)?l.config.args.join(" "):String(l.config.args):"",args:l&&l.config&&l.config.args||[],type:m(),env:g(l),headers:[],passthroughHeaders:((M=(U=l==null?void 0:l.config)==null?void 0:U.passthroughHeaders)==null?void 0:M.join(", "))||"",options:{timeout:l&&l.config&&l.config.options&&l.config.options.timeout||6e4,resetTimeoutOnProgress:((de=(q=l==null?void 0:l.config)==null?void 0:q.options)==null?void 0:de.resetTimeoutOnProgress)??!0,maxTotalTimeout:l&&l.config&&l.config.options&&l.config.options.maxTotalTimeout||void 0},oauth:f(l),keepAlive:{enabled:((ee=l==null?void 0:l.config)==null?void 0:ee.enableKeepAlive)||!1,interval:((X=l==null?void 0:l.config)==null?void 0:X.keepAliveInterval)||6e4},openapi:l&&l.config&&l.config.openapi?{url:l.config.openapi.url||"",schema:l.config.openapi.schema?JSON.stringify(l.config.openapi.schema,null,2):"",inputMode:l.config.openapi.url?"url":l.config.openapi.schema?"schema":"url",version:l.config.openapi.version||"3.1.0",securityType:((he=l.config.openapi.security)==null?void 0:he.type)||"none",apiKeyName:((ye=(se=l.config.openapi.security)==null?void 0:se.apiKey)==null?void 0:ye.name)||"",apiKeyIn:((ae=(ie=l.config.openapi.security)==null?void 0:ie.apiKey)==null?void 0:ae.in)||"header",apiKeyValue:((Ne=(be=l.config.openapi.security)==null?void 0:be.apiKey)==null?void 0:Ne.value)||"",httpScheme:((ke=(xe=l.config.openapi.security)==null?void 0:xe.http)==null?void 0:ke.scheme)||"bearer",httpCredentials:((Le=(Se=l.config.openapi.security)==null?void 0:Se.http)==null?void 0:Le.credentials)||"",oauth2Token:((gt=(at=l.config.openapi.security)==null?void 0:at.oauth2)==null?void 0:gt.token)||"",openIdConnectUrl:((Pt=(Mt=l.config.openapi.security)==null?void 0:Mt.openIdConnect)==null?void 0:Pt.url)||"",openIdConnectToken:((ft=(Nr=l.config.openapi.security)==null?void 0:Nr.openIdConnect)==null?void 0:ft.token)||"",passthroughHeaders:l.config.openapi.passthroughHeaders?l.config.openapi.passthroughHeaders.join(", "):""}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",passthroughHeaders:""}}),[N,S]=x.useState(l&&l.config&&l.config.env?Object.entries(l.config.env).map(([fe,ce])=>({key:fe,value:ce})):[]),[j,C]=x.useState(l&&l.config&&l.config.headers?Object.entries(l.config.headers).map(([fe,ce])=>({key:fe,value:ce})):[]),[z,E]=x.useState(!1),[T,B]=x.useState(!1),[D,Y]=x.useState(!1),[R,_]=x.useState(null),P=!!l,V=fe=>{const{name:ce,value:je}=fe.target;w({...y,[ce]:je})},K=fe=>{const ce=fe.split(" ").filter(je=>je.trim()!=="");w({...y,arguments:fe,args:ce})},G=fe=>{b(fe),w(ce=>({...ce,type:fe}))},I=(fe,ce,je)=>{const Xt=[...N];Xt[fe][ce]=je,S(Xt)},L=()=>{S([...N,{key:"",value:""}])},Z=fe=>{const ce=[...N];ce.splice(fe,1),S(ce)},A=(fe,ce,je)=>{const Xt=[...j];Xt[fe][ce]=je,C(Xt)},H=()=>{C([...j,{key:"",value:""}])},J=fe=>{const ce=[...j];ce.splice(fe,1),C(ce)},me=(fe,ce)=>{w(je=>({...je,oauth:{...je.oauth||{},[fe]:ce}}))},le=(fe,ce)=>{w(je=>({...je,options:{...je.options,[fe]:ce}}))},k=async fe=>{fe.preventDefault(),_(null);try{const ce=zS({formData:y,serverType:h,envVars:N,headerVars:j});a(ce)}catch(ce){_(`Error: ${ce instanceof Error?ce.message:String(ce)}`)}};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 w-full max-w-3xl max-h-screen overflow-y-auto",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),t.jsx("button",{onClick:n,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),(R||c)&&t.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:c||R}),t.jsxs("form",{onSubmit:k,children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:u("server.name")}),t.jsx("input",{type:"text",name:"name",id:"name",value:y.name,onChange:V,className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"e.g.: time-mcp",required:!0})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"description",children:u("server.description")}),t.jsx("input",{type:"text",name:"description",id:"description",value:y.description||"",onChange:V,className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:u("server.descriptionPlaceholder")})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:u("server.type")}),t.jsxs("div",{className:"flex space-x-4",children:[t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",checked:h==="stdio",onChange:()=>G("stdio"),className:"mr-1"}),t.jsx("label",{htmlFor:"command",children:u("server.typeStdio")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:h==="sse",onChange:()=>G("sse"),className:"mr-1"}),t.jsx("label",{htmlFor:"url",children:u("server.typeSse")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:h==="streamable-http",onChange:()=>G("streamable-http"),className:"mr-1"}),t.jsx("label",{htmlFor:"streamable-http",children:u("server.typeStreamableHttp")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:h==="openapi",onChange:()=>G("openapi"),className:"mr-1"}),t.jsx("label",{htmlFor:"openapi",children:u("server.typeOpenapi")})]})]})]}),h==="openapi"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:u("server.openapi.inputMode")}),t.jsxs("div",{className:"flex space-x-4",children:[t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((kr=y.openapi)==null?void 0:kr.inputMode)==="url",onChange:()=>w(fe=>({...fe,openapi:{...fe.openapi,inputMode:"url"}})),className:"mr-1"}),t.jsx("label",{htmlFor:"input-mode-url",children:u("server.openapi.inputModeUrl")})]}),t.jsxs("div",{children:[t.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((tr=y.openapi)==null?void 0:tr.inputMode)==="schema",onChange:()=>w(fe=>({...fe,openapi:{...fe.openapi,inputMode:"schema"}})),className:"mr-1"}),t.jsx("label",{htmlFor:"input-mode-schema",children:u("server.openapi.inputModeSchema")})]})]})]}),((Qt=y.openapi)==null?void 0:Qt.inputMode)==="url"&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"openapi-url",children:u("server.openapi.specUrl")}),t.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((ht=y.openapi)==null?void 0:ht.url)||"",onChange:fe=>w(ce=>({...ce,openapi:{...ce.openapi,url:fe.target.value}})),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:h==="openapi"&&((Re=y.openapi)==null?void 0:Re.inputMode)==="url"})]}),((Oe=y.openapi)==null?void 0:Oe.inputMode)==="schema"&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"openapi-schema",children:u("server.openapi.schema")}),t.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((it=y.openapi)==null?void 0:it.schema)||"",onChange:fe=>w(ce=>({...ce,openapi:{...ce.openapi,schema:fe.target.value}})),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline font-mono text-sm",placeholder:`{
|
|
237
237
|
"openapi": "3.1.0",
|
|
238
238
|
"info": {
|
|
239
239
|
"title": "API",
|
|
@@ -319,5 +319,5 @@ Supports:
|
|
|
319
319
|
transition-colors duration-150
|
|
320
320
|
${E?"bg-blue-50 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"hover:bg-gray-100 dark:hover:bg-gray-700"}
|
|
321
321
|
`,children:[t.jsx("span",{className:"text-sm",children:z.label}),E&&t.jsx(za,{className:"h-4 w-4 text-blue-600"})]},z.value)}):t.jsx("div",{className:"px-3 py-2 text-sm text-gray-500 text-center",children:f?"No results found":"No options available"})})]})]})};function QS(a=32){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",l=new Uint8Array(a);return crypto.getRandomValues(l),Array.from(l).map(o=>n.charAt(o%n.length)).join("")}const cs={SETTINGS_SMART_ROUTING:"settings:smart_routing",SETTINGS_ROUTE_CONFIG:"settings:route_config",SETTINGS_INSTALL_CONFIG:"settings:install_config",SETTINGS_SYSTEM_CONFIG:"settings:system_config",SETTINGS_OAUTH_SERVER:"settings:oauth_server",SETTINGS_EXPORT_CONFIG:"settings:export_config"},XS=({keyData:a,loading:n,availableServers:l,availableGroups:o,onSave:c,onDelete:u})=>{const{t:m}=ve(),{showToast:g}=Pa(),[f,h]=x.useState(!1),[b,y]=x.useState(a.name),[w,N]=x.useState(a.token),[S,j]=x.useState(a.enabled),[C,z]=x.useState(a.accessType||"all"),[E,T]=x.useState(a.allowedGroups||[]),[B,D]=x.useState(a.allowedServers||[]),[Y,R]=x.useState(!1),[_,P]=x.useState(!1);x.useEffect(()=>{f||(y(a.name),N(a.token),j(a.enabled),z(a.accessType||"all"),T(a.allowedGroups||[]),D(a.allowedServers||[]))},[a,f]);const V=async()=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(a.token),g(m("common.copySuccess")||"Copied to clipboard","success");else{const A=document.createElement("textarea");A.value=a.token,A.style.position="fixed",A.style.left="-9999px",document.body.appendChild(A),A.focus(),A.select();try{document.execCommand("copy"),g(m("common.copySuccess")||"Copied to clipboard","success")}catch{g(m("common.copyFailed")||"Copy failed","error")}document.body.removeChild(A)}}catch(A){console.error("Failed to copy",A),g(m("common.copyFailed")||"Copy failed","error")}},K=async()=>{if(C==="groups"&&E.length===0){g(m("settings.selectAtLeastOneGroup")||"Please select at least one group","error");return}if(C==="servers"&&B.length===0){g(m("settings.selectAtLeastOneServer")||"Please select at least one server","error");return}if(C==="custom"&&E.length===0&&B.length===0){g(m("settings.selectAtLeastOneGroupOrServer")||"Please select at least one group or server","error");return}R(!0);try{await c(a.id,{name:b,token:w,enabled:S,accessType:C,allowedGroups:E.join(", "),allowedServers:B.join(", ")}),h(!1)}finally{R(!1)}},G=async()=>{if(window.confirm(m("settings.deleteBearerKeyConfirm")||"Delete this key?")){P(!0);try{await u(a.id)}finally{P(!1)}}},I=C==="groups",L=C==="custom",Z=A=>{if(A.accessType==="all")return m("settings.bearerKeyAccessAll")||"All Resources";if(A.accessType==="groups")return`${m("settings.bearerKeyAccessGroups")||"Groups"}: ${A.allowedGroups}`;if(A.accessType==="servers")return`${m("settings.bearerKeyAccessServers")||"Servers"}: ${A.allowedServers}`;if(A.accessType==="custom"){const H=[];return A.allowedGroups&&A.allowedGroups.length>0&&H.push(`${m("settings.bearerKeyAccessGroups")||"Groups"}: ${A.allowedGroups}`),A.allowedServers&&A.allowedServers.length>0&&H.push(`${m("settings.bearerKeyAccessServers")||"Servers"}: ${A.allowedServers}`),`${m("settings.bearerKeyAccessCustom")||"Custom"}: ${H.join("; ")}`}return""};return f?t.jsx("tr",{children:t.jsx("td",{colSpan:5,className:"p-0 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 p-5",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 mb-4",children:[t.jsxs("div",{className:"md:col-span-3",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:m("settings.bearerKeyName")||"Name"}),t.jsx("input",{type:"text",className:"block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input transition-shadow duration-200",value:b,onChange:A=>y(A.target.value),disabled:n})]}),t.jsxs("div",{className:"md:col-span-9",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:m("settings.bearerKeyToken")||"Token"}),t.jsx("input",{type:"text",className:"block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input transition-shadow duration-200",value:w,onChange:A=>N(A.target.value),disabled:n})]})]}),t.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[t.jsxs("div",{className:"w-40",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:m("settings.bearerKeyEnabled")||"Status"}),t.jsxs("div",{className:"flex items-center h-[38px] px-3 bg-white dark:bg-gray-800 border border-gray-300 rounded-md",children:[t.jsx("span",{className:`text-sm mr-3 ${S?"text-green-600 font-medium":"text-gray-500"}`,children:S?"Active":"Inactive"}),t.jsx(Jt,{disabled:n,checked:S,onCheckedChange:A=>j(A)})]})]}),t.jsxs("div",{className:"w-48",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:m("settings.bearerKeyAccessType")||"Access scope"}),t.jsxs("select",{className:"block w-full py-2 px-3 border border-gray-300 bg-white dark:bg-gray-800 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-select transition-shadow duration-200",value:C,onChange:A=>z(A.target.value),disabled:n,children:[t.jsx("option",{value:"all",children:m("settings.bearerKeyAccessAll")||"All Resources"}),t.jsx("option",{value:"groups",children:m("settings.bearerKeyAccessGroups")||"Specific Groups"}),t.jsx("option",{value:"servers",children:m("settings.bearerKeyAccessServers")||"Specific Servers"}),t.jsx("option",{value:"custom",children:m("settings.bearerKeyAccessCustom")||"Custom (Groups & Servers)"})]})]}),!L&&t.jsxs("div",{className:"flex-1 min-w-[200px]",children:[t.jsx("label",{className:`block text-sm font-medium mb-1 ${C==="all"?"text-gray-400":"text-gray-700"}`,children:I?m("settings.bearerKeyAllowedGroups")||"Allowed groups":m("settings.bearerKeyAllowedServers")||"Allowed servers"}),t.jsx(wn,{options:I?o:l,selected:I?E:B,onChange:I?T:D,placeholder:I?m("settings.selectGroups")||"Select groups...":m("settings.selectServers")||"Select servers...",disabled:n||C==="all"})]}),L&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex-1 min-w-[200px]",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:m("settings.bearerKeyAllowedGroups")||"Allowed groups"}),t.jsx(wn,{options:o,selected:E,onChange:T,placeholder:m("settings.selectGroups")||"Select groups...",disabled:n})]}),t.jsxs("div",{className:"flex-1 min-w-[200px]",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:m("settings.bearerKeyAllowedServers")||"Allowed servers"}),t.jsx(wn,{options:l,selected:B,onChange:D,placeholder:m("settings.selectServers")||"Select servers...",disabled:n})]})]}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:()=>h(!1),className:"px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 text-gray-700 rounded-md text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 h-[38px]",children:m("common.cancel")||"Cancel"}),t.jsx("button",{type:"button",onClick:K,disabled:n||Y,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary h-[38px]",children:Y?m("common.saving")||"Saving...":m("common.save")||"Save"})]})]})]})})}):t.jsxs("tr",{className:"hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:a.name}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 font-mono",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:a.token.length>12?`${a.token.substring(0,8)}...${a.token.substring(a.token.length-4)}`:a.token}),t.jsx("button",{onClick:V,className:"text-gray-400 hover:text-gray-600 transition-colors",title:m("common.copy")||"Copy",children:t.jsx(jn,{className:"h-3.5 w-3.5"})})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.jsx("span",{className:`px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${a.enabled?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:a.enabled?m("common.active")||"Active":m("common.inactive")||"Inactive"})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:Z(a)}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:[t.jsx("button",{onClick:()=>h(!0),className:"text-blue-600 hover:text-blue-900 mr-4 inline-flex items-center",title:m("common.edit")||"Edit",children:t.jsx(ds,{className:"h-4 w-4"})}),t.jsx("button",{onClick:G,disabled:_,className:"text-red-600 hover:text-red-900 inline-flex items-center",title:m("common.delete")||"Delete",children:t.jsx(Bw,{className:"h-4 w-4"})})]})]})};function ZS(a){const n=a.toLowerCase(),l=[["text-embedding-3-small",8191],["text-embedding-3-large",8191],["text-embedding-ada-002",8191],["gemini-embedding-001",2048],["bge-m3",8192]];for(const[o,c]of l)if(n.includes(o))return c;return n.includes("bge"),512}function mh(a,n){const l=a.trim(),o=l?parseInt(l,10):NaN,c=l&&!isNaN(o)?o:null;return c!==(n??null)?c:void 0}function ph(a,n){const l=a.trim(),o=l?parseInt(l,10):NaN,c=l&&!isNaN(o)&&o>=0?o:null;return c!==(n??null)?c:void 0}const WS=()=>{const{t:a}=ve(),n=oa(),{showToast:l}=Pa(),{allServers:o}=F0(),{groups:c}=No(),[u,m]=x.useState({pythonIndexUrl:"",npmRegistry:"",baseUrl:"http://localhost:3000"}),[g,f]=x.useState({dbUrl:"",basePacingDelayMs:"",embeddingProvider:"openai",embeddingEncodingFormat:"auto",openaiApiBaseUrl:"",openaiApiKey:"",openaiApiEmbeddingModel:"",azureOpenaiEndpoint:"",azureOpenaiApiKey:"",azureOpenaiApiVersion:"2024-02-15-preview",azureOpenaiEmbeddingDeployment:"",azureOpenaiEmbeddingModel:"",embeddingMaxTokens:""}),[h,b]=x.useState({apiKey:"",referer:"https://www.mcphub.app",title:"MCPHub",baseUrl:"https://api.mcprouter.to/v1"}),[y,w]=x.useState({accessTokenLifetime:"3600",refreshTokenLifetime:"1209600",authorizationCodeLifetime:"300",allowedScopes:"read, write",dynamicRegistrationAllowedGrantTypes:"authorization_code, refresh_token"}),[N,S]=x.useState("-"),[j,C]=x.useState(!1),{routingConfig:z,tempRoutingConfig:E,setTempRoutingConfig:T,installConfig:B,smartRoutingConfig:D,mcpRouterConfig:Y,oauthServerConfig:R,nameSeparator:_,enableSessionRebuild:P,loading:V,bearerKeys:K,updateRoutingConfig:G,updateInstallConfig:I,updateSmartRoutingConfig:L,updateSmartRoutingConfigBatch:Z,updateMCPRouterConfig:A,updateOAuthServerConfig:H,updateNameSeparator:J,updateSessionRebuild:me,exportMCPSettings:le,createBearerKey:k,updateBearerKey:U,deleteBearerKey:M,refreshBearerKeys:q}=Os();x.useEffect(()=>{B&&m(B)},[B]),x.useEffect(()=>{D&&f({dbUrl:D.dbUrl||"",basePacingDelayMs:D.basePacingDelayMs!=null?String(D.basePacingDelayMs):"",embeddingProvider:D.embeddingProvider==="azure_openai"?"azure_openai":"openai",embeddingEncodingFormat:D.embeddingEncodingFormat==="base64"?"base64":D.embeddingEncodingFormat==="float"?"float":"auto",openaiApiBaseUrl:D.openaiApiBaseUrl||"",openaiApiKey:D.openaiApiKey||"",openaiApiEmbeddingModel:D.openaiApiEmbeddingModel||"",azureOpenaiEndpoint:D.azureOpenaiEndpoint||"",azureOpenaiApiKey:D.azureOpenaiApiKey||"",azureOpenaiApiVersion:D.azureOpenaiApiVersion||"2024-02-15-preview",azureOpenaiEmbeddingDeployment:D.azureOpenaiEmbeddingDeployment||"",azureOpenaiEmbeddingModel:D.azureOpenaiEmbeddingModel||"",embeddingMaxTokens:D.embeddingMaxTokens!=null?String(D.embeddingMaxTokens):""})},[D]),x.useEffect(()=>{Y&&b({apiKey:Y.apiKey||"",referer:Y.referer||"https://www.mcphub.app",title:Y.title||"MCPHub",baseUrl:Y.baseUrl||"https://api.mcprouter.to/v1"})},[Y]),x.useEffect(()=>{var Q,we;R&&w({accessTokenLifetime:R.accessTokenLifetime!==void 0?String(R.accessTokenLifetime):"",refreshTokenLifetime:R.refreshTokenLifetime!==void 0?String(R.refreshTokenLifetime):"",authorizationCodeLifetime:R.authorizationCodeLifetime!==void 0?String(R.authorizationCodeLifetime):"",allowedScopes:R.allowedScopes&&R.allowedScopes.length>0?R.allowedScopes.join(", "):"",dynamicRegistrationAllowedGrantTypes:(we=(Q=R.dynamicRegistration)==null?void 0:Q.allowedGrantTypes)!=null&&we.length?R.dynamicRegistration.allowedGrantTypes.join(", "):""})},[R]),x.useEffect(()=>{S(_)},[_]),x.useEffect(()=>{q()},[]);const[de,ee]=x.useState({routingConfig:!1,installConfig:!1,smartRoutingConfig:!1,oauthServerConfig:!1,mcpRouterConfig:!1,nameSeparator:!1,password:!1,exportConfig:!1,bearerKeys:!1}),X=Q=>{ee(we=>({...we,[Q]:!we[Q]}))},he=async(Q,we)=>{await G(Q,we)},se=(Q,we)=>{T(He=>({...He,[Q]:we}))},ye=(Q,we)=>{m({...u,[Q]:we})},ie=async Q=>{await I(Q,u[Q])},ae=(Q,we)=>{f({...g,[Q]:we})},be=(Q,we)=>{b({...h,[Q]:we})},Ne=async Q=>{await A(Q,h[Q])},xe=(Q,we)=>{w(He=>({...He,[Q]:we}))},ke=(Q,we)=>{w(He=>({...He,[Q]:we}))},Se=async Q=>{const we=y[Q];if(!we||we.trim()===""){l(a("settings.invalidNumberInput")||"Please enter a valid number","error");return}const He=Number(we);if(Number.isNaN(He)||He<0){l(a("settings.invalidNumberInput")||"Please enter a valid number","error");return}await H(Q,He)},Le=async()=>{const Q=y.allowedScopes.split(",").map(we=>we.trim()).filter(we=>we.length>0);await H("allowedScopes",Q)},at=async()=>{const Q=y.dynamicRegistrationAllowedGrantTypes.split(",").map(we=>we.trim()).filter(we=>we.length>0);await H("dynamicRegistration",{...R.dynamicRegistration,allowedGrantTypes:Q})},gt=async(Q,we)=>{await H(Q,we)},Mt=async Q=>{await H("dynamicRegistration",{...R.dynamicRegistration,...Q})},Pt=async()=>{await J(N)},Nr=async Q=>{if(Q){const we=g.dbUrl||D.dbUrl,He=[];if(we||He.push(a("settings.dbUrl")||"Database URL"),g.embeddingProvider==="azure_openai"){const gr=g.azureOpenaiEndpoint||D.azureOpenaiEndpoint,rr=g.azureOpenaiApiKey||D.azureOpenaiApiKey,Cr=g.azureOpenaiApiVersion||D.azureOpenaiApiVersion,Hr=g.azureOpenaiEmbeddingDeployment||D.azureOpenaiEmbeddingDeployment;(!gr||!rr||!Cr||!Hr)&&He.push(a("settings.azureOpenaiEndpoint")||"Azure OpenAI Endpoint",a("settings.azureOpenaiApiKey")||"Azure OpenAI API Key",a("settings.azureOpenaiApiVersion")||"Azure OpenAI API Version",a("settings.azureOpenaiEmbeddingDeployment")||"Azure Embedding Deployment")}else{const gr=(typeof g.openaiApiKey=="string"?g.openaiApiKey:D.openaiApiKey||"").trim(),rr=(typeof g.openaiApiBaseUrl=="string"?g.openaiApiBaseUrl:D.openaiApiBaseUrl||"").trim(),Cr=(typeof g.openaiApiEmbeddingModel=="string"?g.openaiApiEmbeddingModel:D.openaiApiEmbeddingModel||"").trim();gr||He.push(a("settings.openaiApiKey")||"OpenAI API Key"),rr||He.push(a("settings.openaiApiBaseUrl")||"OpenAI API Base URL"),Cr||He.push(a("settings.openaiApiEmbeddingModel")||"OpenAI Embedding Model")}if(He.length>0){l(a("settings.smartRoutingValidationError",{fields:He.join(", ")}));return}const jt={enabled:Q};g.dbUrl!==D.dbUrl&&(jt.dbUrl=g.dbUrl);const Je=ph(g.basePacingDelayMs,D.basePacingDelayMs);Je!==void 0&&(jt.basePacingDelayMs=Je),g.embeddingProvider!==D.embeddingProvider&&(jt.embeddingProvider=g.embeddingProvider),g.embeddingEncodingFormat!==D.embeddingEncodingFormat&&(jt.embeddingEncodingFormat=g.embeddingEncodingFormat),g.openaiApiBaseUrl!==D.openaiApiBaseUrl&&(jt.openaiApiBaseUrl=g.openaiApiBaseUrl),g.openaiApiKey!==D.openaiApiKey&&(jt.openaiApiKey=g.openaiApiKey),g.openaiApiEmbeddingModel!==D.openaiApiEmbeddingModel&&(jt.openaiApiEmbeddingModel=g.openaiApiEmbeddingModel),g.azureOpenaiEndpoint!==D.azureOpenaiEndpoint&&(jt.azureOpenaiEndpoint=g.azureOpenaiEndpoint),g.azureOpenaiApiKey!==D.azureOpenaiApiKey&&(jt.azureOpenaiApiKey=g.azureOpenaiApiKey),g.azureOpenaiApiVersion!==D.azureOpenaiApiVersion&&(jt.azureOpenaiApiVersion=g.azureOpenaiApiVersion),g.azureOpenaiEmbeddingDeployment!==D.azureOpenaiEmbeddingDeployment&&(jt.azureOpenaiEmbeddingDeployment=g.azureOpenaiEmbeddingDeployment),g.azureOpenaiEmbeddingModel!==D.azureOpenaiEmbeddingModel&&(jt.azureOpenaiEmbeddingModel=g.azureOpenaiEmbeddingModel);const We=mh(g.embeddingMaxTokens,D.embeddingMaxTokens);We!==void 0&&(jt.embeddingMaxTokens=We),await Z(jt)}else await L("enabled",Q)},ft=async()=>{const Q={};g.dbUrl!==D.dbUrl&&(Q.dbUrl=g.dbUrl);const we=ph(g.basePacingDelayMs,D.basePacingDelayMs);we!==void 0&&(Q.basePacingDelayMs=we),g.embeddingProvider!==D.embeddingProvider&&(Q.embeddingProvider=g.embeddingProvider),g.embeddingEncodingFormat!==D.embeddingEncodingFormat&&(Q.embeddingEncodingFormat=g.embeddingEncodingFormat),g.openaiApiBaseUrl!==D.openaiApiBaseUrl&&(Q.openaiApiBaseUrl=g.openaiApiBaseUrl),g.openaiApiKey!==D.openaiApiKey&&(Q.openaiApiKey=g.openaiApiKey),g.openaiApiEmbeddingModel!==D.openaiApiEmbeddingModel&&(Q.openaiApiEmbeddingModel=g.openaiApiEmbeddingModel),g.azureOpenaiEndpoint!==D.azureOpenaiEndpoint&&(Q.azureOpenaiEndpoint=g.azureOpenaiEndpoint),g.azureOpenaiApiKey!==D.azureOpenaiApiKey&&(Q.azureOpenaiApiKey=g.azureOpenaiApiKey),g.azureOpenaiApiVersion!==D.azureOpenaiApiVersion&&(Q.azureOpenaiApiVersion=g.azureOpenaiApiVersion),g.azureOpenaiEmbeddingDeployment!==D.azureOpenaiEmbeddingDeployment&&(Q.azureOpenaiEmbeddingDeployment=g.azureOpenaiEmbeddingDeployment),g.azureOpenaiEmbeddingModel!==D.azureOpenaiEmbeddingModel&&(Q.azureOpenaiEmbeddingModel=g.azureOpenaiEmbeddingModel);const He=mh(g.embeddingMaxTokens,D.embeddingMaxTokens);He!==void 0&&(Q.embeddingMaxTokens=He),Object.keys(Q).length>0?await Z(Q):l(a("settings.noChanges")||"No changes to save","info")},kr=()=>{setTimeout(()=>{n("/")},2e3)},[tr,Qt]=x.useState(!1),[ht,Re]=x.useState(""),[Oe,it]=x.useState({name:"",token:"",enabled:!0,accessType:"all",allowedGroups:"",allowedServers:""}),[qt,Gt]=x.useState([]),[ot,_t]=x.useState([]),bt=o.map(Q=>({value:Q.name,label:Q.name})),Jr=c.map(Q=>({value:Q.name,label:Q.name}));x.useEffect(()=>{Oe.accessType!=="groups"&&Oe.accessType!=="custom"&&Gt([]),Oe.accessType!=="servers"&&Oe.accessType!=="custom"&&_t([])},[Oe.accessType]);const Da=async()=>{try{const Q=await le();console.log("Fetched MCP settings:",Q);const we=JSON.stringify(Q.data,null,2);Re(we)}catch(Q){console.error("Error fetching MCP settings:",Q),l(a("settings.exportError")||"Failed to fetch settings","error")}};x.useEffect(()=>{de.exportConfig&&!ht&&Da()},[de.exportConfig]);const La=async()=>{if(ht)try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(ht),Qt(!0),l(a("common.copySuccess")||"Copied to clipboard","success"),setTimeout(()=>Qt(!1),2e3);else{const Q=document.createElement("textarea");Q.value=ht,Q.style.position="fixed",Q.style.left="-9999px",document.body.appendChild(Q),Q.focus(),Q.select();try{document.execCommand("copy"),Qt(!0),l(a("common.copySuccess")||"Copied to clipboard","success"),setTimeout(()=>Qt(!1),2e3)}catch(we){l(a("common.copyFailed")||"Copy failed","error"),console.error("Copy to clipboard failed:",we)}document.body.removeChild(Q)}}catch(Q){console.error("Error copying configuration:",Q),l(a("common.copyFailed")||"Copy failed","error")}},pr=()=>{if(!ht)return;const Q=new Blob([ht],{type:"application/json"}),we=URL.createObjectURL(Q),He=document.createElement("a");He.href=we,He.download="mcp_settings.json",document.body.appendChild(He),He.click(),document.body.removeChild(He),URL.revokeObjectURL(we),l(a("settings.exportSuccess")||"Settings exported successfully","success")},sr=Q=>{const we=Q.split(",").map(He=>He.trim()).filter(He=>He.length>0);return we.length>0?we:void 0},Ir=async()=>{if(!Oe.name||!Oe.token){l(a("settings.bearerKeyRequired")||"Name and token are required","error");return}if(Oe.accessType==="groups"&&qt.length===0){l(a("settings.selectAtLeastOneGroup")||"Please select at least one group","error");return}if(Oe.accessType==="servers"&&ot.length===0){l(a("settings.selectAtLeastOneServer")||"Please select at least one server","error");return}if(Oe.accessType==="custom"&&qt.length===0&&ot.length===0){l(a("settings.selectAtLeastOneGroupOrServer")||"Please select at least one group or server","error");return}await k({name:Oe.name,token:Oe.token,enabled:Oe.enabled,accessType:Oe.accessType,allowedGroups:(Oe.accessType==="groups"||Oe.accessType==="custom")&&qt.length>0?qt:void 0,allowedServers:(Oe.accessType==="servers"||Oe.accessType==="custom")&&ot.length>0?ot:void 0}),it({name:"",token:"",enabled:!0,accessType:"all",allowedGroups:"",allowedServers:""}),Gt([]),_t([]),await q()},nr=async(Q,we)=>{await U(Q,{name:we.name,token:we.token,enabled:we.enabled,accessType:we.accessType,allowedGroups:sr(we.allowedGroups),allowedServers:sr(we.allowedServers)}),await q()},Fr=async Q=>{await M(Q),await q()};return t.jsxs("div",{className:"container mx-auto",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-8",children:a("pages.settings.title")}),t.jsx(os,{permissions:cs.SETTINGS_ROUTE_CONFIG,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 page-card dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("bearerKeys"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("settings.bearerKeysSectionTitle")||"Bearer authentication keys"}),t.jsx("span",{className:"text-gray-500 transition-transform duration-200",children:de.bearerKeys?"▼":"►"})]}),de.bearerKeys&&t.jsxs("div",{className:"space-y-4 pb-4 px-6",children:[t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.enableBearerAuth")||"Enable Bearer Authentication"}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.enableBearerAuthDescription")||"Require bearer token authentication for MCP requests"})]}),t.jsx(Jt,{disabled:V,checked:z.enableBearerAuth,onCheckedChange:Q=>he("enableBearerAuth",Q)})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.bearerAuthHeaderName")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.bearerAuthHeaderNameDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:E.bearerAuthHeaderName,onChange:Q=>se("bearerAuthHeaderName",Q.target.value),placeholder:a("settings.bearerAuthHeaderNamePlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>he("bearerAuthHeaderName",E.bearerAuthHeaderName),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("p",{className:"text-sm text-gray-600",children:a("settings.bearerKeysSectionDescription")||"Manage multiple bearer authentication keys with different access scopes."}),!j&&t.jsxs("button",{type:"button",onClick:()=>C(!0),className:"flex items-center text-blue-600 hover:text-blue-800 font-medium transition-colors duration-200",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-1",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),a("settings.addBearerKey")||"Add bearer key"]})]}),K.length===0?t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.noBearerKeys")||"No bearer keys configured yet."}):t.jsx("div",{className:"mt-2 overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700 border border-gray-200 dark:border-gray-700 rounded-lg",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:t.jsxs("tr",{children:[t.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("settings.bearerKeyName")||"Name"}),t.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("settings.bearerKeyToken")||"Token"}),t.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("settings.bearerKeyEnabled")||"Status"}),t.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("settings.bearerKeyAccessType")||"Access Scope"}),t.jsx("th",{scope:"col",className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("common.actions")||"Actions"})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:K.map(Q=>t.jsx(XS,{keyData:Q,loading:V,availableServers:bt,availableGroups:Jr,onSave:nr,onDelete:Fr},Q.id))})]})}),j&&t.jsx("div",{className:"mt-6 border-t border-gray-200 dark:border-gray-700 pt-6",children:t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-5 border border-gray-200 dark:border-gray-700",children:[t.jsxs("h3",{className:"font-medium text-gray-900 mb-4 flex items-center gap-2",children:[t.jsx("span",{className:"bg-blue-100 text-blue-600 p-1 rounded",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}),a("settings.addBearerKey")||"Add bearer key"]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 mb-4",children:[t.jsxs("div",{className:"md:col-span-3",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a("settings.bearerKeyName")||"Name"}),t.jsx("input",{type:"text",className:"block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input transition-shadow duration-200",placeholder:"e.g. My API Key",value:Oe.name,onChange:Q=>it(we=>({...we,name:Q.target.value})),disabled:V})]}),t.jsxs("div",{className:"md:col-span-9",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a("settings.bearerKeyToken")||"Token"}),t.jsxs("div",{className:"flex rounded-md shadow-sm",children:[t.jsx("input",{type:"text",className:"flex-1 block w-full py-2 px-3 border border-gray-300 rounded-l-md rounded-r-none border-r-0 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input transition-shadow duration-200",placeholder:"sk-...",value:Oe.token,onChange:Q=>it(we=>({...we,token:Q.target.value})),disabled:V}),t.jsx("button",{type:"button",onClick:()=>it(Q=>({...Q,token:QS()})),disabled:V,className:"relative -ml-[5px] inline-flex items-center px-4 py-2 border border-gray-300 bg-gray-100 dark:bg-gray-800 text-gray-700 text-sm font-medium rounded-r-md rounded-l-none hover:bg-gray-200 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 transition-colors duration-200 z-10",children:a("settings.generate")||"Generate"})]})]})]}),t.jsxs("div",{className:"flex flex-wrap items-end gap-4 mb-2",children:[t.jsxs("div",{className:"w-40",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a("settings.bearerKeyEnabled")||"Status"}),t.jsxs("div",{className:"flex items-center h-[38px] px-3 bg-white dark:bg-gray-800 border border-gray-300 rounded-md",children:[t.jsx("span",{className:`text-sm mr-3 ${Oe.enabled?"text-green-600 font-medium":"text-gray-500"}`,children:Oe.enabled?"Active":"Inactive"}),t.jsx(Jt,{disabled:V,checked:Oe.enabled,onCheckedChange:Q=>it(we=>({...we,enabled:Q}))})]})]}),t.jsxs("div",{className:"w-48",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a("settings.bearerKeyAccessType")||"Access scope"}),t.jsxs("select",{className:"block w-full py-2 px-3 border border-gray-300 bg-white dark:bg-gray-800 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-select transition-shadow duration-200",value:Oe.accessType,onChange:Q=>it(we=>({...we,accessType:Q.target.value})),disabled:V,children:[t.jsx("option",{value:"all",children:a("settings.bearerKeyAccessAll")||"All Resources"}),t.jsx("option",{value:"groups",children:a("settings.bearerKeyAccessGroups")||"Specific Groups"}),t.jsx("option",{value:"servers",children:a("settings.bearerKeyAccessServers")||"Specific Servers"}),t.jsx("option",{value:"custom",children:a("settings.bearerKeyAccessCustom")||"Custom (Groups & Servers)"})]})]}),Oe.accessType!=="custom"&&t.jsxs("div",{className:"flex-1 min-w-[200px]",children:[t.jsx("label",{className:`block text-sm font-medium mb-1 ${Oe.accessType==="all"?"text-gray-400":"text-gray-700"}`,children:Oe.accessType==="groups"?a("settings.bearerKeyAllowedGroups")||"Allowed groups":a("settings.bearerKeyAllowedServers")||"Allowed servers"}),t.jsx(wn,{options:Oe.accessType==="groups"?Jr:bt,selected:Oe.accessType==="groups"?qt:ot,onChange:Oe.accessType==="groups"?Gt:_t,placeholder:Oe.accessType==="groups"?a("settings.selectGroups")||"Select groups...":a("settings.selectServers")||"Select servers...",disabled:V||Oe.accessType==="all"})]}),Oe.accessType==="custom"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex-1 min-w-[200px]",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a("settings.bearerKeyAllowedGroups")||"Allowed groups"}),t.jsx(wn,{options:Jr,selected:qt,onChange:Gt,placeholder:a("settings.selectGroups")||"Select groups...",disabled:V})]}),t.jsxs("div",{className:"flex-1 min-w-[200px]",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a("settings.bearerKeyAllowedServers")||"Allowed servers"}),t.jsx(wn,{options:bt,selected:ot,onChange:_t,placeholder:a("settings.selectServers")||"Select servers...",disabled:V})]})]}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:()=>C(!1),className:"px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 text-gray-700 rounded-md text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 h-[38px]",children:a("common.cancel")||"Cancel"}),t.jsx("button",{type:"button",onClick:Ir,disabled:V,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary h-[38px]",children:a("settings.addBearerKeyButton")||"Create Key"})]})]})]})})]})]})}),t.jsx(os,{permissions:cs.SETTINGS_SMART_ROUTING,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 page-card dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("smartRoutingConfig"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("pages.settings.smartRouting")}),t.jsx("span",{className:"text-gray-500 transition-transform duration-200",children:de.smartRoutingConfig?"▼":"►"})]}),de.smartRoutingConfig&&t.jsxs("div",{className:"space-y-4 pb-4 px-6",children:[t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.enableSmartRouting")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.enableSmartRoutingDescription")})]}),t.jsx(Jt,{disabled:V,checked:D.enabled,onCheckedChange:Q=>Nr(Q)})]}),t.jsx("div",{className:"p-3 bg-blue-300 border border-blue-200 rounded-md",children:t.jsx("p",{className:"text-sm text-blue-800",children:a("settings.smartRoutingRequiredFields")})}),D.dbUrl!=="${DB_URL}"&&t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.dbUrl")]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"text",value:g.dbUrl,onChange:Q=>ae("dbUrl",Q.target.value),placeholder:a("settings.dbUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300 form-input",disabled:V})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.embeddingProvider")||"Embedding Provider"})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsxs("select",{className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 bg-white dark:bg-gray-800 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-select",value:g.embeddingProvider,onChange:Q=>ae("embeddingProvider",Q.target.value),disabled:V,children:[t.jsx("option",{value:"openai",children:"OpenAI (or compatible)"}),t.jsx("option",{value:"azure_openai",children:"Azure OpenAI"})]})})]}),g.embeddingProvider==="openai"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.openaiApiKey")]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"password",value:g.openaiApiKey,onChange:Q=>ae("openaiApiKey",Q.target.value),placeholder:a("settings.openaiApiKeyPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300",disabled:V})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.openaiApiBaseUrl")]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"text",value:g.openaiApiBaseUrl,onChange:Q=>ae("openaiApiBaseUrl",Q.target.value),placeholder:a("settings.openaiApiBaseUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V,required:!0})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.openaiApiEmbeddingModel")]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"text",value:g.openaiApiEmbeddingModel,onChange:Q=>ae("openaiApiEmbeddingModel",Q.target.value),placeholder:a("settings.openaiApiEmbeddingModelPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V,required:!0})})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.azureOpenaiEndpoint")||"Azure OpenAI Endpoint"]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"text",value:g.azureOpenaiEndpoint,onChange:Q=>ae("azureOpenaiEndpoint",Q.target.value),placeholder:a("settings.azureOpenaiEndpointPlaceholder")||"https://YOUR_RESOURCE_NAME.openai.azure.com",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.azureOpenaiApiKey")||"Azure OpenAI API Key"]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"password",value:g.azureOpenaiApiKey,onChange:Q=>ae("azureOpenaiApiKey",Q.target.value),placeholder:a("settings.azureOpenaiApiKeyPlaceholder")||"***",className:"flex-1 mt-1 block w-full py-2 px-3 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300",disabled:V})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.azureOpenaiApiVersion")||"Azure OpenAI API Version"]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"text",value:g.azureOpenaiApiVersion,onChange:Q=>ae("azureOpenaiApiVersion",Q.target.value),placeholder:a("settings.azureOpenaiApiVersionPlaceholder")||"2024-02-15-preview",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx("div",{className:"mb-2",children:t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.azureOpenaiEmbeddingDeployment")||"Azure Embedding Deployment"]})}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"text",value:g.azureOpenaiEmbeddingDeployment,onChange:Q=>ae("azureOpenaiEmbeddingDeployment",Q.target.value),placeholder:a("settings.azureOpenaiEmbeddingDeploymentPlaceholder")||"your-embedding-deployment-name",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsxs("h3",{className:"font-medium text-gray-700",children:[t.jsx("span",{className:"text-red-500 px-1",children:"*"}),a("settings.azureOpenaiEmbeddingModel")||"Azure Embedding Model Name"]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:a("settings.azureOpenaiEmbeddingModelDescription")||"The actual OpenAI model name deployed in Azure (e.g. text-embedding-3-small). Used for accurate token counting."})]}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"text",value:g.azureOpenaiEmbeddingModel,onChange:Q=>ae("azureOpenaiEmbeddingModel",Q.target.value),placeholder:a("settings.azureOpenaiEmbeddingModelPlaceholder")||"text-embedding-3-small",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V,required:!0})})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.basePacingDelayMs")}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:a("settings.basePacingDelayMsDescription")})]}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"number",min:"0",step:"1000",value:g.basePacingDelayMs,onChange:Q=>ae("basePacingDelayMs",Q.target.value),placeholder:a("settings.basePacingDelayMsPlaceholder")||"Empty = default 0 ms",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V})}),t.jsx("p",{className:"text-xs text-gray-500 mt-2",children:(()=>{const Q=g.basePacingDelayMs.trim();return Q?a(Q==="0"?"settings.basePacingDelayMsZero":"settings.basePacingDelayMsOverride"):a("settings.basePacingDelayMsAuto",{value:0})})()})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.embeddingEncodingFormat")}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:a("settings.embeddingEncodingFormatDescription")})]}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsxs("select",{value:g.embeddingEncodingFormat,onChange:Q=>ae("embeddingEncodingFormat",Q.target.value),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-select",disabled:V,children:[t.jsx("option",{value:"auto",children:a("settings.embeddingEncodingFormatAuto")||"Auto"}),t.jsx("option",{value:"base64",children:"Base64"}),t.jsx("option",{value:"float",children:"Float"})]})})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.embeddingMaxTokens")}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:a("settings.embeddingMaxTokensDescription")})]}),t.jsx("div",{className:"flex items-center gap-3",children:t.jsx("input",{type:"number",min:"1",value:g.embeddingMaxTokens,onChange:Q=>ae("embeddingMaxTokens",Q.target.value),placeholder:a("settings.embeddingMaxTokensPlaceholder")||"Empty = auto by model",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V})}),t.jsx("p",{className:"text-xs text-gray-500 mt-2",children:(()=>{const Q=(g.embeddingProvider==="azure_openai"?g.azureOpenaiEmbeddingModel||D.azureOpenaiEmbeddingModel:g.openaiApiEmbeddingModel||D.openaiApiEmbeddingModel)||"text-embedding-3-small";return g.embeddingMaxTokens.trim()?a("settings.embeddingMaxTokensOverride"):a("settings.embeddingMaxTokensAuto",{limit:ZS(Q),model:Q})})()})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.progressiveDisclosure")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.progressiveDisclosureDescription")})]}),t.jsx(Jt,{disabled:V||!D.enabled,checked:D.progressiveDisclosure,onCheckedChange:Q=>L("progressiveDisclosure",Q)})]}),t.jsx("div",{className:"flex justify-end pt-2",children:t.jsx("button",{onClick:ft,disabled:V,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})})]})]})}),t.jsx(os,{permissions:cs.SETTINGS_OAUTH_SERVER,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("oauthServerConfig"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("pages.settings.oauthServer")}),t.jsx("span",{className:"text-gray-500",children:de.oauthServerConfig?"▼":"►"})]}),de.oauthServerConfig&&t.jsxs("div",{className:"space-y-4 pb-4 px-6",children:[t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.enableOauthServer")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.enableOauthServerDescription")})]}),t.jsx(Jt,{disabled:V,checked:R.enabled,onCheckedChange:Q=>gt("enabled",Q)})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.requireClientSecret")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.requireClientSecretDescription")})]}),t.jsx(Jt,{disabled:V||!R.enabled,checked:R.requireClientSecret,onCheckedChange:Q=>gt("requireClientSecret",Q)})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.requireState")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.requireStateDescription")})]}),t.jsx(Jt,{disabled:V||!R.enabled,checked:R.requireState,onCheckedChange:Q=>gt("requireState",Q)})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.accessTokenLifetime")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.accessTokenLifetimeDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"number",value:y.accessTokenLifetime,onChange:Q=>xe("accessTokenLifetime",Q.target.value),placeholder:a("settings.accessTokenLifetimePlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>Se("accessTokenLifetime"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.refreshTokenLifetime")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.refreshTokenLifetimeDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"number",value:y.refreshTokenLifetime,onChange:Q=>xe("refreshTokenLifetime",Q.target.value),placeholder:a("settings.refreshTokenLifetimePlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>Se("refreshTokenLifetime"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.authorizationCodeLifetime")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.authorizationCodeLifetimeDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"number",value:y.authorizationCodeLifetime,onChange:Q=>xe("authorizationCodeLifetime",Q.target.value),placeholder:a("settings.authorizationCodeLifetimePlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>Se("authorizationCodeLifetime"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.allowedScopes")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.allowedScopesDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:y.allowedScopes,onChange:Q=>ke("allowedScopes",Q.target.value),placeholder:a("settings.allowedScopesPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:Le,disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md space-y-4",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.enableDynamicRegistration")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.dynamicRegistrationDescription")})]}),t.jsx(Jt,{disabled:V||!R.enabled,checked:R.dynamicRegistration.enabled,onCheckedChange:Q=>Mt({enabled:Q})})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.dynamicRegistrationAllowedGrantTypes")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.dynamicRegistrationAllowedGrantTypesDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:y.dynamicRegistrationAllowedGrantTypes,onChange:Q=>ke("dynamicRegistrationAllowedGrantTypes",Q.target.value),placeholder:a("settings.dynamicRegistrationAllowedGrantTypesPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V||!R.enabled||!R.dynamicRegistration.enabled}),t.jsx("button",{onClick:at,disabled:V||!R.enabled||!R.dynamicRegistration.enabled,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.dynamicRegistrationAuth")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.dynamicRegistrationAuthDescription")})]}),t.jsx(Jt,{disabled:V||!R.enabled||!R.dynamicRegistration.enabled,checked:R.dynamicRegistration.requiresAuthentication,onCheckedChange:Q=>Mt({requiresAuthentication:Q})})]})]})]})]})}),t.jsx(os,{permissions:cs.SETTINGS_INSTALL_CONFIG,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 page-card dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("mcpRouterConfig"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("settings.mcpRouterConfig")}),t.jsx("span",{className:"text-gray-500 transition-transform duration-200",children:de.mcpRouterConfig?"▼":"►"})]}),de.mcpRouterConfig&&t.jsxs("div",{className:"space-y-4 pb-4 px-6",children:[t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.mcpRouterApiKey")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.mcpRouterApiKeyDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"password",value:h.apiKey,onChange:Q=>be("apiKey",Q.target.value),placeholder:a("settings.mcpRouterApiKeyPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300 form-input",disabled:V}),t.jsx("button",{onClick:()=>Ne("apiKey"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.mcpRouterBaseUrl")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.mcpRouterBaseUrlDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:h.baseUrl,onChange:Q=>be("baseUrl",Q.target.value),placeholder:a("settings.mcpRouterBaseUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>Ne("baseUrl"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]})]})]})}),t.jsx(os,{permissions:cs.SETTINGS_SYSTEM_CONFIG,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("nameSeparator"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("settings.systemSettings")}),t.jsx("span",{className:"text-gray-500",children:de.nameSeparator?"▼":"►"})]}),de.nameSeparator&&t.jsxs("div",{className:"space-y-4 pb-4 px-6",children:[t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.nameSeparatorLabel")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.nameSeparatorDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:N,onChange:Q=>S(Q.target.value),placeholder:"-",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V,maxLength:5}),t.jsx("button",{onClick:Pt,disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.enableSessionRebuild")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.enableSessionRebuildDescription")})]}),t.jsx(Jt,{disabled:V,checked:P,onCheckedChange:Q=>me(Q)})]})]})]})}),t.jsx(os,{permissions:cs.SETTINGS_ROUTE_CONFIG,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("routingConfig"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("pages.settings.routeConfig")}),t.jsx("span",{className:"text-gray-500",children:de.routingConfig?"▼":"►"})]}),de.routingConfig&&t.jsxs("div",{className:"space-y-4 pb-4 px-6",children:[t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.enableGlobalRoute")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.enableGlobalRouteDescription")})]}),t.jsx(Jt,{disabled:V,checked:z.enableGlobalRoute,onCheckedChange:Q=>he("enableGlobalRoute",Q)})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.enableGroupNameRoute")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.enableGroupNameRouteDescription")})]}),t.jsx(Jt,{disabled:V,checked:z.enableGroupNameRoute,onCheckedChange:Q=>he("enableGroupNameRoute",Q)})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.skipAuth")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.skipAuthDescription")})]}),t.jsx(Jt,{disabled:V,checked:z.skipAuth,onCheckedChange:Q=>he("skipAuth",Q)})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.jsonBodyLimit")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.jsonBodyLimitDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:E.jsonBodyLimit,onChange:Q=>se("jsonBodyLimit",Q.target.value),placeholder:a("settings.jsonBodyLimitPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>he("jsonBodyLimit",E.jsonBodyLimit),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]})]})]})}),t.jsx(os,{permissions:cs.SETTINGS_INSTALL_CONFIG,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("installConfig"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("settings.installConfig")}),t.jsx("span",{className:"text-gray-500",children:de.installConfig?"▼":"►"})]}),de.installConfig&&t.jsxs("div",{className:"space-y-4 pb-4 px-6",children:[t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.baseUrl")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.baseUrlDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:u.baseUrl,onChange:Q=>ye("baseUrl",Q.target.value),placeholder:a("settings.baseUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>ie("baseUrl"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.pythonIndexUrl")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.pythonIndexUrlDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:u.pythonIndexUrl,onChange:Q=>ye("pythonIndexUrl",Q.target.value),placeholder:a("settings.pythonIndexUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>ie("pythonIndexUrl"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]}),t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.npmRegistry")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.npmRegistryDescription")})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:u.npmRegistry,onChange:Q=>ye("npmRegistry",Q.target.value),placeholder:a("settings.npmRegistryPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:V}),t.jsx("button",{onClick:()=>ie("npmRegistry"),disabled:V,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:a("common.save")})]})]})]})]})}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 dashboard-card","data-section":"password",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("password"),role:"button",children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("auth.changePassword")}),t.jsx("span",{className:"text-gray-500",children:de.password?"▼":"►"})]}),de.password&&t.jsx("div",{className:"max-w-lg pb-4 px-6",children:t.jsx(JS,{onSuccess:kr})})]}),t.jsx(os,{permissions:cs.SETTINGS_EXPORT_CONFIG,children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg mb-6 dashboard-card",children:[t.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600 py-4 px-6",onClick:()=>X("exportConfig"),children:[t.jsx("h2",{className:"font-semibold text-gray-800",children:a("settings.exportMcpSettings")}),t.jsx("span",{className:"text-gray-500",children:de.exportConfig?"▼":"►"})]}),de.exportConfig&&t.jsx("div",{className:"space-y-4 pb-4 px-6",children:t.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("h3",{className:"font-medium text-gray-700",children:a("settings.mcpSettingsJson")}),t.jsx("p",{className:"text-sm text-gray-500",children:a("settings.mcpSettingsJsonDescription")})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("button",{onClick:La,disabled:!ht,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:[tr?t.jsx(za,{size:16}):t.jsx(jn,{size:16}),a(tr?"common.copied":"settings.copyToClipboard")]}),t.jsxs("button",{onClick:pr,disabled:!ht,className:"flex items-center gap-2 px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:[t.jsx(pw,{size:16}),a("settings.downloadJson")]})]}),ht&&t.jsx("div",{className:"mt-3",children:t.jsx("pre",{className:"bg-gray-900 text-gray-100 p-4 rounded-md overflow-x-auto text-xs max-h-96",children:ht})})]})]})})]})})]})},eN=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState([]),[u,m]=x.useState([]),[g,f]=x.useState([]),[h,b]=x.useState(""),[y,w]=x.useState(""),[N,S]=x.useState(""),[j,C]=x.useState(!0),[z,E]=x.useState(null),[T,B]=x.useState(null),[D,Y]=x.useState([]),[R,_]=x.useState(1),[P,V]=x.useState(9),[K,G]=x.useState(1),I=x.useCallback(async()=>{try{C(!0);const ee=await Be("/market/servers");ee&&ee.success&&Array.isArray(ee.data)?(c(ee.data),L(ee.data,R)):(console.error("Invalid market servers data format",{data:ee}),E(a("market.fetchError")))}catch(ee){console.error("Error fetching market servers",{err:ee}),E(ee instanceof Error?ee.message:String(ee))}finally{C(!1)}},[a]),L=x.useCallback((ee,X,he=P)=>{const se=ee.length,ye=Math.ceil(se/he);G(ye);const ie=Math.max(1,Math.min(X,ye));ie!==X&&_(ie);const ae=(ie-1)*he,be=ee.slice(ae,ae+he);l(be)},[P]),Z=x.useCallback(ee=>{_(ee),L(o,ee,P)},[o,L,P]),A=x.useCallback(async()=>{try{const ee=await Be("/market/categories");ee&&ee.success&&Array.isArray(ee.data)?m(ee.data):console.error("Invalid categories data format",{data:ee})}catch(ee){console.error("Error fetching categories",{err:ee})}},[]),H=x.useCallback(async()=>{try{const ee=await Be("/market/tags");ee&&ee.success&&Array.isArray(ee.data)?f(ee.data):console.error("Invalid tags data format",{data:ee})}catch(ee){console.error("Error fetching tags",{err:ee})}},[]),J=x.useCallback(async ee=>{try{C(!0);const X=await Be(`/market/servers/${ee}`);return X&&X.success&&X.data?(B(X.data),X.data):(console.error("Invalid market server data format",{name:ee,data:X}),E(a("market.serverNotFound")),null)}catch(X){return console.error("Error fetching market server",{name:ee,err:X}),E(X instanceof Error?X.message:String(X)),null}finally{C(!1)}},[a]),me=x.useCallback(async ee=>{try{if(C(!0),S(ee),!ee.trim()){I();return}const X=await Be(`/market/servers/search?query=${encodeURIComponent(ee)}`);X&&X.success&&Array.isArray(X.data)?(c(X.data),_(1),L(X.data,1)):(console.error("Invalid market search results format",{query:ee,data:X}),E(a("market.searchError")))}catch(X){console.error("Error searching market servers",{query:ee,err:X}),E(X instanceof Error?X.message:String(X))}finally{C(!1)}},[a,o,L,I]),le=x.useCallback(async ee=>{try{if(C(!0),b(ee),w(""),!ee){I();return}const X=await Be(`/market/categories/${encodeURIComponent(ee)}`);X&&X.success&&Array.isArray(X.data)?(c(X.data),_(1),L(X.data,1)):(console.error("Invalid market category filter results format",{category:ee,data:X}),E(a("market.filterError")))}catch(X){console.error("Error filtering market servers by category",{category:ee,err:X}),E(X instanceof Error?X.message:String(X))}finally{C(!1)}},[a,I,L]),k=x.useCallback(async ee=>{try{if(C(!0),w(ee),b(""),!ee){I();return}const X=await Be(`/market/tags/${encodeURIComponent(ee)}`);X&&X.success&&Array.isArray(X.data)?(c(X.data),_(1),L(X.data,1)):(console.error("Invalid market tag filter results format",{tag:ee,data:X}),E(a("market.tagFilterError")))}catch(X){console.error("Error filtering market servers by tag",{tag:ee,err:X}),E(X instanceof Error?X.message:String(X))}finally{C(!1)}},[a,I,L]),U=x.useCallback(async()=>{try{const ee=await Be("/servers");if(ee&&ee.success&&Array.isArray(ee.data)){const X=ee.data.map(he=>he.name);Y(X)}}catch(ee){console.error("Error fetching installed servers",{err:ee})}},[]),M=x.useCallback(ee=>D.includes(ee),[D]),q=x.useCallback(async(ee,X)=>{var he,se;try{const ye=(he=ee.installations)!=null&&he.npm?"npm":Object.keys(ee.installations||{}).length>0?Object.keys(ee.installations)[0]:null;if(!ye||!((se=ee.installations)!=null&&se[ye]))return E(a("market.noInstallationMethod")),!1;const ie=ee.installations[ye],ae={name:ee.name,config:X.type==="stdio"?{command:X.command||ie.command||"",args:X.args||ie.args||[],env:{...ie.env,...X.env}}:X},be=await pt("/servers",ae);if(!be.success)throw new Error(be.message||"Failed to install server");return await U(),!0}catch(ye){return console.error("Error installing market server",{serverName:ee.name,err:ye}),E(ye instanceof Error?ye.message:String(ye)),!1}},[a,U]),de=x.useCallback(ee=>{V(ee),_(1),L(o,1,ee)},[o,L]);return x.useEffect(()=>{I(),A(),H(),U()},[I,A,H,U]),{servers:n,allServers:o,categories:u,tags:g,selectedCategory:h,selectedTag:y,searchQuery:N,loading:j,error:z,setError:E,currentServer:T,fetchMarketServers:I,fetchServerByName:J,searchServers:me,filterByCategory:le,filterByTag:k,installServer:q,currentPage:R,totalPages:K,serversPerPage:P,changePage:Z,changeServersPerPage:de,isServerInstalled:M}},tN=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState([]),[u,m]=x.useState([]),[g,f]=x.useState([]),[h,b]=x.useState(""),[y,w]=x.useState(""),[N,S]=x.useState(""),[j,C]=x.useState(!0),[z,E]=x.useState(null),[T,B]=x.useState(null),[D,Y]=x.useState(1),[R,_]=x.useState(9),[P,V]=x.useState(1),K=x.useCallback(async()=>{try{C(!0);const M=await Be("/cloud/servers");M&&M.success&&Array.isArray(M.data)?(c(M.data),G(M.data,D)):(console.error("Invalid cloud market servers data format",{data:M}),E(a("cloud.fetchError")))}catch(M){console.error("Error fetching cloud market servers",{err:M});const q=M instanceof Error?M.message:String(M);q==="MCPROUTER_API_KEY_NOT_CONFIGURED"||q.toLowerCase().includes("mcprouter api key not configured"),E(q)}finally{C(!1)}},[a]),G=x.useCallback((M,q,de=R)=>{const ee=M.length,X=Math.ceil(ee/de);V(X);const he=Math.max(1,Math.min(q,X));he!==q&&Y(he);const se=(he-1)*de,ye=M.slice(se,se+de);l(ye)},[R]),I=x.useCallback(M=>{Y(M),G(o,M,R)},[o,G,R]),L=x.useCallback(async()=>{try{const M=await Be("/cloud/categories");M&&M.success&&Array.isArray(M.data)?m(M.data):console.error("Invalid cloud market categories data format",{data:M})}catch(M){console.error("Error fetching cloud market categories",{err:M})}},[]),Z=x.useCallback(async()=>{try{const M=await Be("/cloud/tags");M&&M.success&&Array.isArray(M.data)?f(M.data):console.error("Invalid cloud market tags data format",{data:M})}catch(M){console.error("Error fetching cloud market tags",{err:M})}},[]),A=x.useCallback(async M=>{try{C(!0);const q=await Be(`/cloud/servers/${M}`);return q&&q.success&&q.data?(B(q.data),q.data):(console.error("Invalid cloud server data format",{name:M,data:q}),E(a("cloud.serverNotFound")),null)}catch(q){console.error("Error fetching cloud server",{name:M,err:q});const de=q instanceof Error?q.message:String(q);return de==="MCPROUTER_API_KEY_NOT_CONFIGURED"||de.toLowerCase().includes("mcprouter api key not configured"),E(de),null}finally{C(!1)}},[a]),H=x.useCallback(async M=>{try{if(C(!0),S(M),!M.trim()){K();return}const q=await Be(`/cloud/servers/search?query=${encodeURIComponent(M)}`);q&&q.success&&Array.isArray(q.data)?(c(q.data),Y(1),G(q.data,1)):(console.error("Invalid cloud search results format",{query:M,data:q}),E(a("cloud.searchError")))}catch(q){console.error("Error searching cloud servers",{query:M,err:q}),E(q instanceof Error?q.message:String(q))}finally{C(!1)}},[a,o,G,K]),J=x.useCallback(async M=>{try{if(C(!0),b(M),w(""),!M){K();return}const q=await Be(`/cloud/categories/${encodeURIComponent(M)}`);q&&q.success&&Array.isArray(q.data)?(c(q.data),Y(1),G(q.data,1)):(console.error("Invalid cloud category filter results format",{category:M,data:q}),E(a("cloud.filterError")))}catch(q){console.error("Error filtering cloud servers by category",{category:M,err:q}),E(q instanceof Error?q.message:String(q))}finally{C(!1)}},[a,K,G]),me=x.useCallback(async M=>{try{if(C(!0),w(M),b(""),!M){K();return}const q=await Be(`/cloud/tags/${encodeURIComponent(M)}`);q&&q.success&&Array.isArray(q.data)?(c(q.data),Y(1),G(q.data,1)):(console.error("Invalid cloud tag filter results format",{tag:M,data:q}),E(a("cloud.tagFilterError")))}catch(q){console.error("Error filtering cloud servers by tag",{tag:M,err:q}),E(q instanceof Error?q.message:String(q))}finally{C(!1)}},[a,K,G]),le=x.useCallback(async M=>{try{const q=await Be(`/cloud/servers/${M}/tools`);if(!q.success)throw console.error("Failed to fetch cloud server tools",{serverName:M,data:q}),new Error(q.message||"Failed to fetch cloud server tools");return q&&q.success&&Array.isArray(q.data)?q.data:(console.error("Invalid cloud server tools data format",{serverName:M,data:q}),[])}catch(q){console.error("Error fetching tools for cloud server",{serverName:M,err:q});const de=q instanceof Error?q.message:String(q);if(de==="MCPROUTER_API_KEY_NOT_CONFIGURED"||de.toLowerCase().includes("mcprouter api key not configured"))throw q;return[]}},[]),k=x.useCallback(async(M,q,de)=>{try{const ee=await pt(`/cloud/servers/${encodeURIComponent(M)}/tools/${encodeURIComponent(q)}/call`,{arguments:de});if(ee&&ee.success)return ee.data;throw new Error(ee.message||"Failed to call tool")}catch(ee){throw console.error("Error calling tool on cloud server",{serverName:M,toolName:q,err:ee}),ee}},[]),U=x.useCallback(M=>{_(M),Y(1),G(o,1,M)},[o,G]);return x.useEffect(()=>{K(),L(),Z()},[K,L,Z]),{servers:n,allServers:o,categories:u,tags:g,selectedCategory:h,selectedTag:y,searchQuery:N,loading:j,error:z,setError:E,currentServer:T,fetchCloudServers:K,fetchServerByName:A,searchServers:H,filterByCategory:J,filterByTag:me,fetchServerTools:le,callServerTool:k,currentPage:D,totalPages:P,serversPerPage:R,changePage:I,changeServersPerPage:U}},rN=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState([]),[u,m]=x.useState(!0),[g,f]=x.useState(null),[h,b]=x.useState(""),[y,w]=x.useState(1),[N,S]=x.useState(9),[j,C]=x.useState(null),[z,E]=x.useState(!1),[T,B]=x.useState([]),[D]=x.useState(1),Y=x.useCallback(async(A,H)=>{try{m(!0),f(null);const J=new URLSearchParams;J.append("limit",N.toString()),A&&J.append("cursor",A);const me=H!==void 0?H:h;me.trim()&&J.append("search",me.trim());const le=await Be(`/registry/servers?${J.toString()}`);if(le&&le.success&&le.data){const k=le.data;if(k.servers&&Array.isArray(k.servers)){l(k.servers);const U=k.metadata.count===N&&!!k.metadata.nextCursor;E(U),C(k.metadata.nextCursor||null),c(A?M=>[...M,...k.servers]:k.servers)}else console.error("Invalid registry servers data format",{data:k}),f(a("registry.fetchError"))}else f(a("registry.fetchError"))}catch(J){console.error("Error fetching registry servers",{cursor:A,search:H,err:J});const me=J instanceof Error?J.message:String(J);f(me)}finally{m(!1)}},[a,N]),R=x.useCallback(async()=>{if(!z||!j)return;const A=T[T.length-1]||"";B(H=>[...H,A]),w(H=>H+1),await Y(j,h)},[z,j,T,h,Y]),_=x.useCallback(async()=>{if(y<=1)return;const A=[...T];A.pop();const H=A[A.length-1];B(A),w(J=>J-1),await Y(H||void 0,h)},[y,T,h,Y]),P=x.useCallback(async A=>{A!==y&&(A>y&&z?await R():A<y&&y>1&&await _())},[y,z,R,_]),V=x.useCallback(async A=>{S(A),w(1),B([]),c([]),await Y(void 0,h)},[h,Y]),K=x.useCallback(async A=>{try{m(!0),f(null);const H=encodeURIComponent(A),J=await Be(`/registry/servers/versions?serverName=${H}`);if(J&&J.success&&J.data){const me=J.data;return me.servers&&Array.isArray(me.servers)&&me.servers.length>0?me.servers[0]:(console.error("Invalid registry server data format",{serverName:A,data:me}),f(a("registry.serverNotFound")),null)}else return f(a("registry.serverNotFound")),null}catch(H){console.error("Error fetching registry server",{serverName:A,err:H});const J=H instanceof Error?H.message:String(H);return f(J),null}finally{m(!1)}},[a]),G=x.useCallback(async A=>{try{f(null);const H=encodeURIComponent(A),J=await Be(`/registry/servers/versions?serverName=${H}`);if(J&&J.success&&J.data){const me=J.data;return me.servers&&Array.isArray(me.servers)?me.servers:(console.error("Invalid registry server versions data format",{serverName:A,data:me}),[])}else return[]}catch(H){console.error("Error fetching versions for registry server",{serverName:A,err:H});const J=H instanceof Error?H.message:String(H);return f(J),[]}},[]),I=x.useCallback(async(A,H)=>{try{f(null);const J=encodeURIComponent(A),me=encodeURIComponent(H),le=await Be(`/registry/servers/version?serverName=${J}&version=${me}`);if(le&&le.success&&le.data){const k=le.data;return k&&k.server?k:(console.error("Invalid registry server version data format",{serverName:A,version:H,data:k}),null)}else return null}catch(J){console.error("Error fetching specific registry server version",{serverName:A,version:H,err:J});const me=J instanceof Error?J.message:String(J);return f(me),null}},[]),L=x.useCallback(async A=>{console.log("Searching registry servers",{query:A}),b(A),w(1),B([]),c([]),await Y(void 0,A)},[Y]),Z=x.useCallback(async()=>{b(""),w(1),B([]),c([]),await Y(void 0,"")},[Y]);return x.useEffect(()=>{Y(void 0,h)},[]),{servers:n,allServers:o,loading:u,error:g,setError:f,searchQuery:h,searchServers:L,clearSearch:Z,fetchServerByName:K,fetchServerVersions:G,fetchServerVersion:I,currentPage:y,totalPages:D,hasNextPage:z,hasPreviousPage:y>1,changePage:P,goToNextPage:R,goToPreviousPage:_,serversPerPage:N,changeServersPerPage:V}},aN=({server:a,onClick:n})=>{var f,h,b,y;const{t:l}=ve(),o=w=>w.split(" ").map(N=>N.charAt(0)).join("").toUpperCase().slice(0,2),c=()=>{if(!a.tags||a.tags.length===0)return{tagsToShow:[],hasMore:!1,moreCount:0};const w=28,N=T=>T.length+3;let S=0,j=0;const C=[...a.tags].sort((T,B)=>T.length-B.length);for(j=0;j<C.length;j++){const T=N(C[j]);if(S+T>w)break;if(S+=T,j===C.length-1)return{tagsToShow:C,hasMore:!1,moreCount:0}}j===0&&C.length>0&&(j=1);const z=C.length-j,E=3+String(z).length+l("market.moreTags").length;return S+E<=w||j<1?{tagsToShow:C.slice(0,j),hasMore:!0,moreCount:z}:{tagsToShow:C.slice(0,Math.max(1,j-1)),hasMore:!0,moreCount:z+1}},{tagsToShow:u,hasMore:m,moreCount:g}=c();return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-lg hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 cursor-pointer group relative overflow-hidden h-full flex flex-col",onClick:()=>n(a),children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/0 to-purple-50/0 group-hover:from-blue-50/30 group-hover:to-purple-50/30 dark:group-hover:from-blue-900/30 dark:group-hover:to-purple-900/30 transition-all duration-300 pointer-events-none"}),t.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[t.jsxs("div",{className:"flex items-start justify-between mb-2",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-600 transition-colors duration-200 mb-1 line-clamp-1 mr-2",children:a.display_name}),t.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[t.jsx("div",{className:"w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white text-xs font-semibold",children:o(((f=a.author)==null?void 0:f.name)||l("market.unknown"))}),t.jsx("div",{children:t.jsx("p",{className:"text-xs font-medium text-gray-700",children:((h=a.author)==null?void 0:h.name)||l("market.unknown")})})]})]}),t.jsx("div",{className:"flex flex-col items-end space-y-2",children:a.is_official&&t.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:l("market.official")})})]}),t.jsx("div",{className:"mb-2 flex-1",children:t.jsx("p",{className:"text-gray-600 text-sm leading-relaxed line-clamp-2 min-h-[36px]",children:a.description})}),t.jsx("div",{className:"mb-2",children:t.jsx("div",{className:"flex flex-wrap gap-1 min-h-[24px]",children:((b=a.categories)==null?void 0:b.length)>0?a.categories.map((w,N)=>t.jsx("span",{className:"bg-gray-100 dark:bg-gray-800 text-gray-800 text-xs px-2 py-1 rounded whitespace-nowrap",children:w},N)):t.jsx("span",{className:"text-xs text-gray-400 py-1",children:"-"})})}),t.jsx("div",{className:"mb-2",children:t.jsx("div",{className:"relative min-h-[24px] overflow-x-auto",children:((y=a.tags)==null?void 0:y.length)>0?t.jsxs("div",{className:"flex gap-1 items-center whitespace-nowrap",children:[u.map((w,N)=>t.jsxs("span",{className:"bg-green-50 text-green-700 text-xs px-2 py-1 rounded flex-shrink-0",children:["#",w]},N)),m&&t.jsxs("span",{className:"bg-gray-100 dark:bg-gray-800 text-gray-600 text-xs px-1.5 py-1 rounded flex-shrink-0",children:["+",g," ",l("market.moreTags")]})]}):t.jsx("span",{className:"text-xs text-gray-400 py-1",children:"-"})})})]})]})},sN=({server:a,onBack:n,onInstall:l,installing:o=!1,isInstalled:c=!1})=>{var P,V,K;const{t:u}=ve(),[m,g]=x.useState(!1),[f,h]=x.useState(null),[b,y]=x.useState(!1),[w,N]=x.useState(null),[S,j]=x.useState([]),C=()=>c?{className:"bg-green-600 cursor-default px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:u("market.installed")}:o?{className:"bg-gray-400 cursor-not-allowed px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:u("market.installing")}:{className:"bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded text-sm font-medium text-white btn-primary",disabled:!1,text:u("market.install")},z=()=>{g(!m),h(null),y(!1),N(null)},E=async()=>{w&&(await T(w),y(!1),N(null))},T=async G=>{try{h(null),l(a,G.config),g(!1)}catch(I){console.error("Error installing server:",I),h(u("errors.serverInstall"))}},B=()=>{c||z()},D=()=>{if(!a.installations)return;if(a.installations.npm)return a.installations.npm;if(a.installations.uvx)return a.installations.uvx;if(a.installations.default)return a.installations.default;const G=Object.keys(a.installations);if(G.length>0)return a.installations[G[0]]},Y=async G=>{try{const I=ax(G);I.length>0?(j(I),N(G),y(!0)):await T(G)}catch(I){console.error("Error processing server installation:",I),h(u("errors.serverInstall"))}},R=C(),_=D();return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[t.jsx("div",{className:"mb-4",children:t.jsxs("button",{onClick:n,className:"text-gray-600 hover:text-gray-900 flex items-center",children:[t.jsx("svg",{className:"h-5 w-5 mr-1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),u("market.backToList")]})}),t.jsxs("div",{className:"flex justify-between items-start mb-4",children:[t.jsx("div",{children:t.jsxs("h2",{className:"text-2xl font-bold text-gray-900 flex items-center flex-wrap",children:[a.display_name,t.jsxs("span",{className:"text-sm font-normal text-gray-500 ml-2",children:["(",a.name,")"]}),t.jsxs("span",{className:"text-sm font-normal text-gray-600 ml-4",children:[u("market.author"),": ",((P=a.author)==null?void 0:P.name)||u("market.unknown")," •"," ",u("market.license"),": ",a.license," •",t.jsx("a",{href:a.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline ml-1",children:u("market.repository")})]})]})}),t.jsxs("div",{className:"flex items-center",children:[a.is_official&&t.jsx("span",{className:"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300 text-sm font-normal px-4 py-2 rounded mr-2 flex items-center label-primary",children:u("market.official")}),t.jsx("button",{onClick:B,disabled:R.disabled,className:R.className,children:R.text})]})]}),t.jsx("p",{className:"text-gray-700 mb-6",children:a.description}),t.jsxs("div",{className:"mb-6",children:[t.jsxs("h3",{className:"text-lg font-semibold mb-3",children:[u("market.categories")," & ",u("market.tags")]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[(V=a.categories)==null?void 0:V.map((G,I)=>t.jsx("span",{className:"bg-gray-100 dark:bg-gray-800 text-gray-800 px-3 py-1 rounded",children:G},`cat-${I}`)),a.tags&&a.tags.map((G,I)=>t.jsxs("span",{className:"bg-gray-100 dark:bg-gray-800 text-green-700 px-2 py-1 rounded text-sm",children:["#",G]},`tag-${I}`))]})]}),a.arguments&&Object.keys(a.arguments).length>0&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"text-lg font-semibold mb-3",children:u("market.arguments")}),t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:u("market.argumentName")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:u("market.description")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:u("market.required")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:u("market.example")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:Object.entries(a.arguments).map(([G,I],L)=>t.jsxs("tr",{children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:G}),t.jsx("td",{className:"px-6 py-4 text-sm text-gray-500",children:I.description}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:I.required?t.jsx("span",{className:"text-green-600",children:"✓"}):t.jsx("span",{className:"text-gray-600",children:"✗"})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:I.example})})]},L))})]})})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"text-lg font-semibold mb-3",children:u("market.tools")}),t.jsx("div",{className:"space-y-4",children:(K=a.tools)==null?void 0:K.map((G,I)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded p-4",children:[t.jsxs("h4",{className:"font-medium mb-2",children:[G.name,t.jsx("button",{type:"button",onClick:()=>{const L=document.getElementById(`schema-${I}`);L&&L.classList.toggle("hidden")},className:"text-sm text-blue-500 font-normal hover:underline focus:outline-none ml-2",children:u("market.viewSchema")})]}),t.jsx("p",{className:"text-gray-600 mb-2",children:G.description}),t.jsx("div",{className:"mt-2",children:t.jsx("pre",{id:`schema-${I}`,className:"hidden bg-gray-50 dark:bg-gray-800 p-3 rounded text-sm overflow-auto mt-2",children:JSON.stringify(G.inputSchema,null,2)})})]},I))})]}),a.examples&&a.examples.length>0&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"text-lg font-semibold mb-3",children:u("market.examples")}),t.jsx("div",{className:"space-y-4",children:a.examples.map((G,I)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded p-4",children:[t.jsx("h4",{className:"font-medium mb-2",children:G.title}),t.jsx("p",{className:"text-gray-600 mb-2",children:G.description}),t.jsx("pre",{className:"bg-gray-50 dark:bg-gray-800 p-3 rounded text-sm overflow-auto",children:G.prompt})]},I))})]}),t.jsx("div",{className:"mt-6 flex justify-end",children:t.jsx("button",{onClick:B,disabled:R.disabled,className:R.className,children:R.text})}),m&&t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx(Ll,{onSubmit:Y,onCancel:z,modalTitle:u("market.installServer",{name:a.display_name}),formError:f,initialData:{name:a.name,status:"disconnected",config:_?{command:_.command||"",args:_.args||[],env:_.env||{}}:void 0}})}),b&&t.jsx("div",{className:"fixed inset-0 bg-black/50 z-[60] flex items-center justify-center p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:u("server.confirmVariables")}),t.jsx("p",{className:"text-gray-600 mb-4",children:u("server.variablesDetected")}),t.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded p-3 mb-4",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-yellow-400",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"ml-3",children:[t.jsxs("h4",{className:"text-sm font-medium text-yellow-800",children:[u("server.detectedVariables"),":"]}),t.jsx("ul",{className:"mt-1 text-sm text-yellow-700",children:S.map((G,I)=>t.jsxs("li",{className:"font-mono",children:["$",`{${G}}`]},I))})]})]})}),t.jsx("p",{className:"text-gray-600 text-sm mb-6",children:u("market.confirmVariablesMessage")}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>{y(!1),N(null)},className:"px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 btn-secondary",children:u("common.cancel")}),t.jsx("button",{onClick:E,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 btn-primary",children:u("market.confirmAndInstall")})]})]})})]})},nN=({server:a,onClick:n})=>{const{t:l}=ve(),o=()=>{n(a)},c=()=>{if(a.description&&a.description.length<=150)return a.description;if(a.content){const g=a.content.split(`
|
|
322
|
-
`).filter(f=>f.trim());for(const f of g)if(f.length>50&&f.length<=150)return f}return a.description?a.description.slice(0,150)+"...":l("cloud.noDescription")},u=g=>{try{const f=new Date(g),h=f.getFullYear(),b=(f.getMonth()+1).toString().padStart(2,"0"),y=f.getDate().toString().padStart(2,"0");return`${h}/${b}/${y}`}catch{return""}},m=g=>g.split(" ").map(f=>f.charAt(0)).join("").toUpperCase().slice(0,2);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-lg hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 cursor-pointer group relative overflow-hidden h-full flex flex-col",onClick:o,children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/0 to-purple-50/0 group-hover:from-blue-50/30 group-hover:to-purple-50/30 dark:group-hover:from-blue-900/30 dark:group-hover:to-purple-900/30 transition-all duration-300 pointer-events-none"}),t.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-600 transition-colors duration-200 mb-2 line-clamp-2",children:a.title||a.name}),t.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[t.jsx("div",{className:"w-7 h-7 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white text-xs font-semibold",children:m(a.author_name)}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-700",children:a.author_name}),a.updated_at&&t.jsxs("p",{className:"text-xs text-gray-500",children:[l("cloud.updated")," ",u(a.updated_at)]})]})]})]}),t.jsx("div",{className:"flex flex-col items-end space-y-2",children:t.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:"MCP Server"})})]}),t.jsx("div",{className:"mb-3 flex-1",children:t.jsx("p",{className:"text-gray-600 text-sm leading-relaxed line-clamp-2",children:c()})}),a.tools&&a.tools.length>0&&t.jsx("div",{className:"mb-3",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),t.jsxs("span",{className:"text-sm text-gray-600 font-medium",children:[a.tools.length," ",a.tools.length===1?l("cloud.tool"):l("cloud.tools")]})]})}),t.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-100 dark:border-gray-700 mt-auto",children:[t.jsxs("div",{className:"flex items-center space-x-2 text-xs text-gray-500",children:[t.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"})}),t.jsx("span",{children:u(a.created_at)})]}),t.jsxs("div",{className:"flex items-center text-blue-600 text-sm font-medium group-hover:text-blue-700 transition-colors",children:[t.jsx("span",{children:l("cloud.viewDetails")}),t.jsx("svg",{className:"w-4 h-4 ml-1 transform group-hover:translate-x-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]})]})},fd=()=>{const{t:a}=ve(),n=oa(),l=()=>{n("/settings")},o=()=>{window.open("https://mcprouter.co","_blank","noopener,noreferrer")};return t.jsx("div",{className:"bg-amber-50 border border-amber-200 dark:bg-amber-900/20 dark:border-amber-900/50 rounded-lg p-6 mb-6",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-amber-400 dark:text-amber-500",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsx("h3",{className:"text-sm font-medium text-amber-800 dark:text-amber-400",children:a("cloud.apiKeyNotConfigured")}),t.jsx("div",{className:"mt-2 text-sm text-amber-700 dark:text-amber-300",children:t.jsx("p",{children:a("cloud.apiKeyNotConfiguredDescription")})}),t.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[t.jsxs("button",{onClick:o,className:"inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200",children:[t.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),a("cloud.getApiKey")]}),t.jsxs("button",{onClick:l,className:"inline-flex items-center px-3 py-2 text-sm font-medium text-amber-800 dark:text-amber-400 bg-amber-100 border border-amber-300 dark:bg-amber-900/40 dark:border-amber-700 dark:text-amber-300 rounded-md hover:bg-amber-200 dark:hover:bg-amber-900/60 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-amber-500 dark:focus:ring-amber-400 transition-colors duration-200",children:[t.jsxs("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),a("cloud.configureInSettings")]})]})]})]})})},lN=({serverName:a,onBack:n,onCallTool:l,fetchServerTools:o,onInstall:c,installing:u=!1,isInstalled:m=!1})=>{const{t:g}=ve(),{mcpRouterConfig:f}=Os(),[h,b]=x.useState(null),[y,w]=x.useState(!0),[N,S]=x.useState(null),[j,C]=x.useState([]),[z,E]=x.useState(!1),[T,B]=x.useState(!1),[D,Y]=x.useState(null),[R,_]=x.useState({}),[P,V]=x.useState({}),[K,G]=x.useState({}),[I,L]=x.useState(!1),[Z,A]=x.useState(null),H=X=>(console.error("Checking for MCPRouter API key error:",X),X==="MCPROUTER_API_KEY_NOT_CONFIGURED"||X.toLowerCase().includes("mcprouter api key not configured")),J=()=>m?{className:"bg-green-600 cursor-default px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:g("market.installed")}:u?{className:"bg-gray-400 cursor-not-allowed px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:g("market.installing")}:{className:"bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded text-sm font-medium text-white transition-colors",disabled:!1,text:g("market.install")},me=()=>{!m&&c&&(L(!0),A(null))},le=()=>{L(!1),A(null)},k=async X=>{try{if(!h||!c)return;A(null),c(h,X.config),L(!1)}catch(he){console.error("Error installing server:",he),A(g("errors.serverInstall"))}};x.useEffect(()=>{(async()=>{try{w(!0),S(null);const he=await Be(`/cloud/servers/${a}`);he&&he.success&&he.data?(b(he.data),C(he.data.tools||[])):S(g("cloud.serverNotFound"))}catch(he){console.error("Failed to load server details:",he),S(he instanceof Error?he.message:String(he))}finally{w(!1)}})()},[a,g]),x.useEffect(()=>{(async()=>{if(h&&(!h.tools||h.tools.length===0)&&o){E(!0),B(!1);try{const he=await o(h.name);C(he)}catch(he){console.error("Failed to load tools:",he);const se=he instanceof Error?he.message:String(he);H(se)&&B(!0)}finally{E(!1)}}})()},[h==null?void 0:h.name,h==null?void 0:h.tools,o]);const U=X=>{try{const he=new Date(X),se=he.getFullYear(),ye=String(he.getMonth()+1).padStart(2,"0"),ie=String(he.getDate()).padStart(2,"0"),ae=String(he.getHours()).padStart(2,"0"),be=String(he.getMinutes()).padStart(2,"0"),Ne=String(he.getSeconds()).padStart(2,"0");return`${se}-${ye}-${ie} ${ae}:${be}:${Ne}`}catch{return X}},M=(X,he,se)=>{V(ye=>({...ye,[X]:{...ye[X],[he]:se}}))},q=async X=>{if(!(!l||!h)){Y(X);try{const he=P[X]||{},se=await l(h.server_key,X,he);_(ye=>({...ye,[X]:se}))}catch(he){console.error("Tool call failed:",he);const se=he instanceof Error?he.message:String(he);_(ye=>({...ye,[X]:{error:se}}))}finally{Y(null)}}},de=X=>{G(he=>({...he,[X]:!he[X]}))},ee=(X,he,se)=>{var ae;const ye=((ae=P[X.name])==null?void 0:ae[he])||"",ie=be=>{let Ne=be.target.value;se.type==="number"||se.type==="integer"?Ne=Ne===""?void 0:Number(Ne):se.type==="boolean"&&(Ne=be.target.value==="true"),M(X.name,he,Ne)};return se.type==="boolean"?t.jsxs("select",{value:ye===!0?"true":ye===!1?"false":"",onChange:ie,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",children:[t.jsx("option",{value:""}),t.jsx("option",{value:"true",children:g("common.true")}),t.jsx("option",{value:"false",children:g("common.false")})]}):se.type==="number"||se.type==="integer"?t.jsx("input",{type:"number",step:se.type==="integer"?"1":"any",value:ye||"",onChange:ie,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input"}):t.jsx("input",{type:"text",value:ye||"",onChange:ie,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input"})};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[t.jsx("div",{className:"mb-6",children:t.jsxs("button",{onClick:n,className:"inline-flex items-center text-gray-600 hover:text-gray-900 transition-colors group",children:[t.jsx("svg",{className:"h-5 w-5 mr-2 transform group-hover:-translate-x-1 transition-transform",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),g("cloud.backToList")]})}),y?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-12",children:t.jsxs("div",{className:"flex flex-col items-center",children:[t.jsxs("svg",{className:"animate-spin h-12 w-12 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600 text-lg",children:g("app.loading")})]})}):N&&!H(N)?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:t.jsx("div",{className:"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("svg",{className:"h-5 w-5 text-red-400 dark:text-red-500 mr-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),t.jsx("p",{className:"text-red-700 dark:text-red-400",children:N})]})})}):h?t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"bg-gradient-to-r from-gray-100 to-gray-200 dark:from-gray-800 dark:to-gray-700 px-6 py-4",children:t.jsxs("div",{className:"flex justify-between items-end",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-800 mb-2",children:h.title||h.name}),t.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-gray-600",children:[t.jsx("span",{className:"text-sm bg-white/60 dark:bg-gray-800/60 text-gray-700 px-3 py-1 rounded-full",children:h.name}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("svg",{className:"h-4 w-4 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"})}),g("cloud.by")," ",h.author_name]})]})]}),t.jsxs("div",{className:"text-right flex flex-col items-end gap-3",children:[t.jsxs("div",{className:"text-xs text-gray-500",children:[g("cloud.updated"),": ",U(h.updated_at)]}),c&&!H(N||"")&&!T&&t.jsx("button",{onClick:me,disabled:J().disabled,className:J().className,children:J().text})]})]})})}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[t.jsx("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),g("cloud.description")]}),t.jsx("p",{className:"text-gray-700 leading-relaxed",children:h.description})]}),h.content&&t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[t.jsx("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),g("cloud.details")]}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 overflow-auto",children:t.jsx("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:h.content})})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[t.jsxs("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),g("cloud.tools"),j.length>0&&t.jsx("span",{className:"ml-2 bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300 text-sm font-medium px-2.5 py-0.5 rounded-full",children:j.length})]}),T&&t.jsx(fd,{}),z?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsxs("svg",{className:"animate-spin h-8 w-8 text-blue-500 mr-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("span",{className:"text-gray-600",children:g("cloud.loadingTools")})]}):j.length===0&&!T?t.jsxs("div",{className:"text-center py-12",children:[t.jsx("svg",{className:"h-12 w-12 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),t.jsx("p",{className:"text-gray-600",children:g("cloud.noTools")})]}):j.length>0?t.jsx("div",{className:"space-y-4",children:j.map((X,he)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-6 hover:border-gray-300 transition-colors",children:[t.jsxs("div",{className:"flex justify-between items-start mb-4",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("h3",{className:"text-lg font-medium text-gray-900 mb-2 flex items-center",children:[t.jsx("span",{className:"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300 text-xs font-medium px-2 py-1 rounded mr-3",children:"TOOL"}),X.name]}),t.jsx("p",{className:"text-gray-600 leading-relaxed whitespace-pre-wrap",children:X.description})]}),l&&t.jsx("button",{onClick:()=>q(X.name),disabled:D===X.name,className:"ml-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center min-w-[100px] justify-center",children:D===X.name?t.jsxs(t.Fragment,{children:[t.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),g("cloud.calling")]}):t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.828 14.828a4 4 0 01-5.656 0M9 10h6m2 8l4-4H7l4 4z"})}),g("cloud.callTool")]})})]}),X.inputSchema&&X.inputSchema.properties&&Object.keys(X.inputSchema.properties).length>0&&t.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700 pt-4",children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700",children:g("cloud.parameters")}),t.jsxs("button",{onClick:()=>de(X.name),className:"text-sm text-blue-600 hover:text-blue-800 focus:outline-none flex items-center gap-1 transition-colors",children:[g("cloud.viewSchema"),t.jsx("svg",{className:`h-3 w-3 transition-transform duration-200 ${K[X.name]?"rotate-90":"rotate-0"}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})]})]}),K[X.name]&&t.jsx("div",{className:"mb-4",children:t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-3 overflow-auto",children:t.jsx("pre",{className:"text-sm text-gray-800",children:JSON.stringify(X.inputSchema,null,2)})})}),t.jsx("div",{className:"space-y-4",children:Object.entries(X.inputSchema.properties).map(([se,ye])=>{var ie;return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:[se,((ie=X.inputSchema.required)==null?void 0:ie.includes(se))&&t.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),ye.description&&t.jsx("p",{className:"text-xs text-gray-500",children:ye.description}),ee(X,se,ye)]},se)})})]}),R[X.name]&&t.jsx("div",{className:"border-t border-gray-100 dark:border-gray-700 pt-4 mt-4",children:R[X.name].error?t.jsx(t.Fragment,{children:H(R[X.name].error)?t.jsx(fd,{}):t.jsxs(t.Fragment,{children:[t.jsxs("h4",{className:"text-sm font-medium text-red-600 mb-3 flex items-center",children:[t.jsx("svg",{className:"h-4 w-4 text-red-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),g("cloud.error")]}),t.jsx("div",{className:"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50 rounded-lg p-4",children:t.jsx("pre",{className:"text-sm text-red-800 dark:text-red-300 whitespace-pre-wrap overflow-auto",children:R[X.name].error})})]})}):t.jsxs(t.Fragment,{children:[t.jsxs("h4",{className:"text-sm font-medium text-gray-700 mb-3 flex items-center",children:[t.jsx("svg",{className:"h-4 w-4 text-green-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),g("cloud.result")]}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsx("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap overflow-auto",children:JSON.stringify(R[X.name],null,2)})})]})})]},he))}):null]})]}):t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-12",children:t.jsxs("div",{className:"text-center",children:[t.jsx("svg",{className:"h-12 w-12 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),t.jsx("p",{className:"text-gray-600 text-lg",children:g("cloud.serverNotFound")})]})}),I&&h&&t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx(Ll,{onSubmit:k,onCancel:le,modalTitle:g("cloud.installServer",{name:h.title||h.name}),formError:Z,initialData:{name:h.name,status:"disconnected",config:{type:"streamable-http",url:h.server_url,headers:{Authorization:`Bearer ${f.apiKey||"<MCPROUTER_API_KEY>"}`,"HTTP-Referer":f.referer||"<YOUR_APP_URL>","X-Title":f.title||"<YOUR_APP_NAME>"}}}})})]})},iN=({serverEntry:a,onClick:n})=>{var z,E;const{t:l}=ve(),{server:o,_meta:c}=a,u=()=>{n(a)},m=()=>o.description&&o.description.length<=150?o.description:o.description?o.description.slice(0,150)+"...":l("registry.noDescription"),g=T=>{if(!T)return"";try{const B=new Date(T),D=B.getFullYear(),Y=(B.getMonth()+1).toString().padStart(2,"0"),R=B.getDate().toString().padStart(2,"0");return`${D}/${Y}/${R}`}catch{return""}},h=o.icons&&o.icons.length>0?o.icons.find(B=>!B.theme||B.theme==="light")||o.icons[0]:null,b=c==null?void 0:c["io.modelcontextprotocol.registry/official"],y=b==null?void 0:b.isLatest,w=b==null?void 0:b.publishedAt,N=b==null?void 0:b.updatedAt,S=((z=o.packages)==null?void 0:z.length)||0,j=((E=o.remotes)==null?void 0:E.length)||0,C=S+j;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-lg hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 cursor-pointer group relative overflow-hidden h-full flex flex-col",onClick:u,children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/0 to-purple-50/0 group-hover:from-blue-50/30 group-hover:to-purple-50/30 dark:group-hover:from-blue-900/30 dark:group-hover:to-purple-900/30 transition-all duration-300 pointer-events-none"}),t.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[t.jsx("div",{className:"flex items-start justify-between mb-3",children:t.jsxs("div",{className:"flex items-start space-x-3 flex-1",children:[h?t.jsx("img",{src:h.src,alt:o.title,className:"w-12 h-12 rounded-lg object-cover flex-shrink-0",onError:T=>{T.currentTarget.style.display="none"}}):t.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-lg flex items-center justify-center text-white text-xl font-semibold flex-shrink-0",children:"M"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-600 transition-colors duration-200 mb-1 line-clamp-2",children:o.name}),t.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[y&&t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800",children:l("registry.latest")}),t.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:["v",o.version]})]})]})]})}),t.jsx("div",{className:"mb-3 flex-1",children:t.jsx("p",{className:"text-gray-600 text-sm leading-relaxed line-clamp-3",children:m()})}),C>0&&t.jsx("div",{className:"mb-3",children:t.jsxs("div",{className:"flex items-center space-x-4",children:[S>0&&t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})}),t.jsxs("span",{className:"text-sm text-gray-600",children:[S," ",l(S===1?"registry.package":"registry.packages")]})]}),j>0&&t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),t.jsxs("span",{className:"text-sm text-gray-600",children:[j," ",l(j===1?"registry.remote":"registry.remotes")]})]})]})}),t.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-100 dark:border-gray-700 mt-auto",children:[t.jsx("div",{className:"flex items-center space-x-2 text-xs text-gray-500",children:(w||N)&&t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"})}),t.jsx("span",{children:g(N||w)})]})}),t.jsxs("div",{className:"flex items-center text-blue-600 text-sm font-medium group-hover:text-blue-700 transition-colors",children:[t.jsx("span",{children:l("registry.viewDetails")}),t.jsx("svg",{className:"w-4 h-4 ml-1 transform group-hover:translate-x-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]})]})},oN=({serverEntry:a,onBack:n,onInstall:l,installing:o=!1,isInstalled:c=!1,fetchVersions:u})=>{const{t:m}=ve(),{server:g,_meta:f}=a,[h,b]=x.useState(g.version),[y,w]=x.useState([]),[N,S]=x.useState(!1),[j,C]=x.useState(!1),[z,E]=x.useState(null),[T,B]=x.useState(null),[D,Y]=x.useState(null),[R,_]=x.useState({packages:!0,remotes:!0,repository:!0}),P=f==null?void 0:f["io.modelcontextprotocol.registry/official"];x.useEffect(()=>{(async()=>{if(u){S(!0);try{const k=await u(g.name);w(k)}catch(k){console.error("Failed to load versions:",k)}finally{S(!1)}}})()},[g.name,u]);const K=g.icons&&g.icons.length>0?g.icons.find(k=>!k.theme||k.theme==="light")||g.icons[0]:null,G=le=>{if(!le)return"";try{return new Date(le).toLocaleDateString()}catch{return""}},I=le=>{_(k=>({...k,[le]:!k[le]}))},L=(le,k)=>{E(le),B(k),Y(null),C(!0)},Z=()=>{C(!1),Y(null)},A=async le=>{try{if(!l||!T||!z)return;Y(null);const k=le.config;l(g,k),C(!1)}catch(k){console.error("Error installing server:",k),Y(m("errors.serverInstall"))}},H=()=>{if(!T||!z)return null;if(console.log("Building initial form data for:",T),z==="package"&&"identifier"in T){const le=T,k={};le.environmentVariables&&le.environmentVariables.forEach(M=>{k[M.name]=M.default||""});const U=cN(le.registryType);return{name:g.name,status:"disconnected",config:{type:"stdio",command:U,args:uN(U,le),env:Object.keys(k).length>0?k:void 0}}}else if(z==="remote"&&"url"in T){const le=T,k={};le.headers&&le.headers.forEach(M=>{k[M.name]=M.default||M.value||""});const U=le.type==="sse"?"sse":"streamable-http";return{name:g.name,status:"disconnected",config:{type:U,url:le.url,headers:Object.keys(k).length>0?k:void 0}}}return null},J=(le,k)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-3 hover:border-blue-400 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-medium text-gray-900",children:le.identifier}),le.version&&t.jsxs("p",{className:"text-sm text-gray-500",children:["Version: ",le.version]}),le.runtimeHint&&t.jsx("p",{className:"text-sm text-gray-600 mt-1",children:le.runtimeHint})]}),t.jsx("button",{onClick:()=>L("package",le),disabled:c||o,className:`px-4 py-2 rounded text-sm font-medium transition-colors ${c?"bg-green-600 text-white cursor-default":o?"bg-gray-400 text-white cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-700"}`,children:m(c?"registry.installed":o?"registry.installing":"registry.install")})]}),le.registryType&&t.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[t.jsx("span",{className:"font-medium",children:"Registry:"})," ",le.registryType]}),le.transport&&t.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[t.jsx("span",{className:"font-medium",children:"Transport:"})," ",le.transport.type,le.transport.url&&t.jsxs("span",{className:"ml-2 text-gray-500",children:["(",le.transport.url,")"]})]}),le.environmentVariables&&le.environmentVariables.length>0&&t.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[t.jsxs("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:[m("registry.environmentVariables"),":"]}),t.jsx("div",{className:"space-y-2",children:le.environmentVariables.map((U,M)=>t.jsxs("div",{className:"text-sm",children:[t.jsxs("div",{className:"flex items-start",children:[t.jsx("span",{className:"font-mono text-gray-900 font-medium",children:U.name}),U.isRequired&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800",children:m("common.required")}),U.isSecret&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:m("common.secret")})]}),U.description&&t.jsx("p",{className:"text-gray-600 mt-1",children:U.description}),U.default&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.default"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.default})]})]},M))})]}),le.packageArguments&&le.packageArguments.length>0&&t.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[t.jsxs("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:[m("registry.packageArguments"),":"]}),t.jsx("div",{className:"space-y-2",children:le.packageArguments.map((U,M)=>t.jsxs("div",{className:"text-sm",children:[t.jsxs("div",{className:"flex items-start",children:[t.jsx("span",{className:"font-mono text-gray-900 font-medium",children:U.name}),U.isRequired&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800",children:m("common.required")}),U.isSecret&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:m("common.secret")}),U.isRepeated&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-300",children:m("common.repeated")})]}),U.description&&t.jsx("p",{className:"text-gray-600 mt-1",children:U.description}),U.type&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.type"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.type})]}),U.default&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.default"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.default})]}),U.value&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.value"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.value})]}),U.valueHint&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.valueHint"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.valueHint})]}),U.choices&&U.choices.length>0&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.choices"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.choices.join(", ")})]})]},M))})]})]},k),me=(le,k)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-3 hover:border-blue-400 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-medium text-gray-900",children:le.type}),t.jsx("p",{className:"text-sm text-gray-600 mt-1 break-all",children:le.url})]}),t.jsx("button",{onClick:()=>L("remote",le),disabled:c||o,className:`px-4 py-2 rounded text-sm font-medium transition-colors ${c?"bg-green-600 text-white cursor-default":o?"bg-gray-400 text-white cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-700"}`,children:m(c?"registry.installed":o?"registry.installing":"registry.install")})]}),le.headers&&le.headers.length>0&&t.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[t.jsxs("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:[m("registry.headers"),":"]}),t.jsx("div",{className:"space-y-2",children:le.headers.map((U,M)=>t.jsxs("div",{className:"text-sm",children:[t.jsxs("div",{className:"flex items-start",children:[t.jsx("span",{className:"font-mono text-gray-900 font-medium",children:U.name}),U.isRequired&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800",children:m("common.required")}),U.isSecret&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:m("common.secret")})]}),U.description&&t.jsx("p",{className:"text-gray-600 mt-1",children:U.description}),U.value&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.value"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.value})]}),U.default&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.default"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.default})]})]},M))})]})]},k);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6",children:[t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:n,className:"flex items-center text-blue-600 hover:text-blue-800 mb-4 transition-colors",children:[t.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),m("registry.backToList")]}),t.jsxs("div",{className:"flex items-start space-x-4",children:[K?t.jsx("img",{src:K.src,alt:g.title,className:"w-20 h-20 rounded-lg object-cover flex-shrink-0",onError:le=>{le.currentTarget.style.display="none"}}):t.jsx("div",{className:"w-20 h-20 bg-gradient-to-br from-blue-500 to-purple-600 rounded-lg flex items-center justify-center text-white text-3xl font-semibold flex-shrink-0",children:"M"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:g.name}),t.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[(P==null?void 0:P.isLatest)&&t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-800",children:m("registry.latest")}),t.jsxs("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:["v",g.version]}),(P==null?void 0:P.status)&&t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-gray-100 dark:bg-gray-800 text-gray-800",children:P.status}),t.jsxs("span",{className:"flex flex-wrap items-center gap-4 text-sm text-gray-600",children:[(P==null?void 0:P.publishedAt)&&t.jsxs("div",{children:[t.jsxs("span",{className:"font-medium",children:[m("registry.published"),":"]})," ",G(P.publishedAt)]}),(P==null?void 0:P.updatedAt)&&t.jsxs("div",{children:[t.jsxs("span",{className:"font-medium",children:[m("registry.updated"),":"]})," ",G(P.updatedAt)]})]})]})]})]})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-3",children:m("registry.description")}),t.jsx("p",{className:"text-gray-700 leading-relaxed whitespace-pre-wrap",children:g.description})]}),g.websiteUrl&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-3",children:m("registry.website")}),t.jsx("a",{href:g.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 hover:underline",children:g.websiteUrl})]}),g.packages&&g.packages.length>0&&t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:()=>I("packages"),className:"flex items-center justify-between w-full text-xl font-semibold text-gray-900 mb-3 hover:text-blue-600 transition-colors",children:[t.jsxs("span",{children:[m("registry.packages")," (",g.packages.length,")"]}),t.jsx("svg",{className:`w-5 h-5 transform transition-transform ${R.packages?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),R.packages&&t.jsx("div",{className:"space-y-3",children:g.packages.map(J)})]}),g.remotes&&g.remotes.length>0&&t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:()=>I("remotes"),className:"flex items-center justify-between w-full text-xl font-semibold text-gray-900 mb-3 hover:text-blue-600 transition-colors",children:[t.jsxs("span",{children:[m("registry.remotes")," (",g.remotes.length,")"]}),t.jsx("svg",{className:`w-5 h-5 transform transition-transform ${R.remotes?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),R.remotes&&t.jsx("div",{className:"space-y-3",children:g.remotes.map(me)})]}),g.repository&&t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:()=>I("repository"),className:"flex items-center justify-between w-full text-xl font-semibold text-gray-900 mb-3 hover:text-blue-600 transition-colors",children:[t.jsx("span",{children:m("registry.repository")}),t.jsx("svg",{className:`w-5 h-5 transform transition-transform ${R.repository?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),R.repository&&t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[g.repository.url&&t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"font-medium text-gray-700",children:"URL:"})," ",t.jsx("a",{href:g.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 hover:underline break-all",children:g.repository.url})]}),g.repository.source&&t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"font-medium text-gray-700",children:"Source:"})," ",g.repository.source]}),g.repository.subfolder&&t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"font-medium text-gray-700",children:"Subfolder:"})," ",g.repository.subfolder]}),g.repository.id&&t.jsxs("div",{children:[t.jsx("span",{className:"font-medium text-gray-700",children:"ID:"})," ",g.repository.id]})]})]}),j&&T&&z&&t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx(Ll,{onSubmit:A,onCancel:Z,modalTitle:m("registry.installServer",{name:g.title||g.name}),formError:D,initialData:H()})})]})};function cN(a){switch(a.toLowerCase()){case"pypi":case"python":return"uvx";case"npm":case"node":return"npx";case"oci":case"docker":return"docker";default:return""}}function uN(a,n){const l=[n.identifier+(n.version?`@${n.version}`:"")],o=[];switch(n.packageArguments&&n.packageArguments.length>0&&n.packageArguments.forEach(c=>{if(c.isRequired||c.default||c.value){const u=`--${c.name}`,m=c.value||c.default||`\${${c.name.toUpperCase()}}`;o.push(u,m)}}),a.toLowerCase()){case"uvx":return[...l,...o];case"npx":return[...l,...o];case"docker":{const c=[];return n.environmentVariables&&n.environmentVariables.forEach(u=>{c.push("-e",`${u.name}`)}),["run","-i","--rm",...c,...l,...o]}default:return[...l,...o]}}const dN=({currentPage:a,hasNextPage:n,hasPreviousPage:l,onNextPage:o,onPreviousPage:c})=>t.jsxs("div",{className:"flex items-center justify-center space-x-2 my-6",children:[t.jsxs("button",{onClick:c,disabled:!l,className:`px-4 py-2 rounded transition-all duration-200 ${l?"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 inline-block mr-1",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Prev"]}),t.jsxs("span",{className:"px-4 py-2 bg-blue-500 text-white rounded btn-primary",children:["Page ",a]}),t.jsxs("button",{onClick:o,disabled:!n,className:`px-4 py-2 rounded transition-all duration-200 ${n?"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,children:["Next",t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 inline-block ml-1",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})]})]}),gh=()=>{const{t:a}=ve(),n=oa(),{serverName:l}=Jh(),{showToast:o}=Pa(),[c,u]=l1(),m=c.get("tab")||"cloud",{servers:g,allServers:f,categories:h,loading:b,error:y,setError:w,searchServers:N,filterByCategory:S,filterByTag:j,selectedCategory:C,selectedTag:z,installServer:E,fetchServerByName:T,isServerInstalled:B,currentPage:D,totalPages:Y,changePage:R,serversPerPage:_,changeServersPerPage:P}=eN(),{servers:V,allServers:K,loading:G,error:I,setError:L,fetchServerTools:Z,callServerTool:A,currentPage:H,totalPages:J,changePage:me,serversPerPage:le,changeServersPerPage:k}=tN(),{servers:U,allServers:M,loading:q,error:de,setError:ee,searchServers:X,clearSearch:he,fetchServerByName:se,fetchServerVersions:ye,currentPage:ie,totalPages:ae,hasNextPage:be,hasPreviousPage:Ne,changePage:xe,goToNextPage:ke,goToPreviousPage:Se,serversPerPage:Le,changeServersPerPage:at}=rN(),[gt,Mt]=x.useState(null),[Pt,Nr]=x.useState(null),[ft,kr]=x.useState(null),[tr,Qt]=x.useState(""),[ht,Re]=x.useState(""),[Oe,it]=x.useState(!1),[qt,Gt]=x.useState(new Set),[ot,_t]=x.useState(new Set);x.useEffect(()=>{(async()=>{if(l)if(m==="cloud"){const $e=V.find(mt=>mt.name===l);$e?Nr($e):n("/market?tab=cloud")}else if(m==="registry"){console.log("Loading registry server details for:",l);const $e=await se(l);$e?kr($e):n("/market?tab=registry")}else{const $e=await T(l);$e?Mt($e):n("/market?tab=local")}else Mt(null),Nr(null),kr(null)})()},[l,m,V,T,se,n]);const bt=Pe=>{const $e=new URLSearchParams(c);$e.set("tab",Pe),u($e),l&&n("/market?"+$e.toString())},Jr=Pe=>{Pe.preventDefault(),m==="local"?N(tr):m==="registry"&&X(ht)},Da=Pe=>{m==="local"&&S(Pe)},La=()=>{m==="local"?(Qt(""),S(""),j("")):m==="registry"&&(Re(""),he())},pr=Pe=>{var $e;if(m==="cloud")n(`/market/${Pe.name}?tab=cloud`);else if(m==="registry"){const mt=Pe;console.log("Registry server clicked:",mt);const ct=($e=mt.server)==null?void 0:$e.name;if(console.log("Server name extracted:",ct),ct){const Dt=`/market/${encodeURIComponent(ct)}?tab=registry`;console.log("Navigating to:",Dt),n(Dt)}else console.error("Server name is undefined in registry server:",mt)}else n(`/market/${Pe.name}?tab=local`)},sr=()=>{n(`/market?tab=${m}`)},Ir=async(Pe,$e)=>{try{it(!0),await E(Pe,$e)&&o(a("market.installSuccess",{serverName:Pe.display_name}),"success")}finally{it(!1)}},nr=async(Pe,$e)=>{try{it(!0);const mt={name:Pe.name,config:$e},ct=await pt("/servers",mt);if(!ct.success){const Dt=(ct==null?void 0:ct.message)||a("server.addError");o(Dt,"error");return}Gt(Dt=>new Set(Dt).add(Pe.name)),o(a("cloud.installSuccess",{name:Pe.title||Pe.name}),"success")}catch(mt){console.error("Error installing cloud server:",mt);const ct=mt instanceof Error?mt.message:String(mt);o(a("cloud.installError",{error:ct}),"error")}finally{it(!1)}},Fr=async(Pe,$e)=>{try{it(!0);const mt={name:Pe.name,config:$e},ct=await pt("/servers",mt);if(!ct.success){const Dt=(ct==null?void 0:ct.message)||a("server.addError");o(Dt,"error");return}_t(Dt=>new Set(Dt).add(Pe.name)),o(a("registry.installSuccess",{name:Pe.title||Pe.name}),"success")}catch(mt){console.error("Error installing registry server:",mt);const ct=mt instanceof Error?mt.message:String(mt);o(a("registry.installError",{error:ct}),"error")}finally{it(!1)}},Q=async(Pe,$e,mt)=>{try{const ct=await A(Pe,$e,mt);return o(a("cloud.toolCallSuccess",{toolName:$e}),"success"),ct}catch(ct){const Dt=ct instanceof Error?ct.message:String(ct);throw we(Dt)||o(a("cloud.toolCallError",{toolName:$e,error:Dt}),"error"),ct}},we=Pe=>Pe==="MCPROUTER_API_KEY_NOT_CONFIGURED"||Pe.toLowerCase().includes("mcprouter api key not configured"),He=Pe=>{m==="local"?R(Pe):m==="registry"?xe(Pe):me(Pe),window.scrollTo({top:0,behavior:"smooth"})},jt=Pe=>{const $e=parseInt(Pe.target.value,10);m==="local"?P($e):m==="registry"?at($e):k($e)};if(gt)return t.jsx(sN,{server:gt,onBack:sr,onInstall:Ir,installing:Oe,isInstalled:B(gt.name)});if(Pt)return t.jsx(lN,{serverName:Pt.name,onBack:sr,onCallTool:Q,fetchServerTools:Z,onInstall:nr,installing:Oe,isInstalled:qt.has(Pt.name)});if(ft)return t.jsx(oN,{serverEntry:ft,onBack:sr,onInstall:Fr,installing:Oe,isInstalled:ot.has(ft.server.name),fetchVersions:ye});const Je=m==="local",We=m==="registry",gr=Je?g:We?U:V,rr=Je?f:We?M:K,Cr=Je?h:[],Hr=Je?b:We?q:G,fe=Je?y:We?de:I,ce=Je?w:We?ee:L,je=Je?C:"",Xt=Je?z:"",dt=Je?D:We?ie:H,Zt=Je?Y:We?ae:J,lr=Je?_:We?Le:le;return t.jsxs("div",{children:[t.jsx("div",{className:"mb-6",children:t.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:t.jsxs("nav",{className:"-mb-px flex space-x-3",children:[t.jsxs("button",{onClick:()=>bt("cloud"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${!Je&&!We?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[a("cloud.title"),t.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",t.jsx("a",{href:"https://mcprouter.co",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"MCPRouter"}),")"]})]}),t.jsxs("button",{onClick:()=>bt("local"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${Je?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[a("market.title"),t.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",t.jsx("a",{href:"https://mcpm.sh",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"MCPM"}),")"]})]}),t.jsxs("button",{onClick:()=>bt("registry"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${We?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[a("registry.title"),t.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",t.jsx("a",{href:"https://registry.modelcontextprotocol.io",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:a("registry.official")}),")"]})]})]})})}),fe&&t.jsx(t.Fragment,{children:!Je&&we(fe)?t.jsx(fd,{}):t.jsx("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 dark:text-red-400 p-4 mb-6 error-box rounded-lg",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{children:fe}),t.jsx("button",{onClick:()=>ce(null),className:"text-red-700 dark:text-red-400 hover:text-red-900 transition-colors duration-200",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 011.414 0L10 8.586l4.293-4.293a1 1 01.414 1.414L11.414 10l4.293 4.293a1 1 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 01-1.414-1.414L8.586 10 4.293 5.707a1 1 010-1.414z",clipRule:"evenodd"})})})]})})}),(Je||We)&&t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 mb-6 page-card",children:t.jsxs("form",{onSubmit:Jr,className:"flex space-x-4 mb-0",children:[t.jsx("div",{className:"flex-grow",children:t.jsx("input",{type:"text",value:We?ht:tr,onChange:Pe=>{We?Re(Pe.target.value):Qt(Pe.target.value)},placeholder:a(We?"registry.searchPlaceholder":"market.searchPlaceholder"),className:"shadow appearance-none border border-gray-200 dark:border-gray-700 rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input"})}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200",children:a(We?"registry.search":"market.search")}),(Je&&(tr||je||Xt)||We&&ht)&&t.jsx("button",{type:"button",onClick:La,className:"border border-gray-300 text-gray-700 font-medium py-2 px-4 rounded hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 btn-secondary transition-all duration-200",children:a(We?"registry.clearFilters":"market.clearFilters")})]})}),t.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[Je&&t.jsx("div",{className:"md:w-48 flex-shrink-0",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-4 mb-6 sticky top-4 page-card",children:Cr.length>0?t.jsxs("div",{className:"mb-6",children:[t.jsxs("div",{className:"flex justify-between items-center mb-3",children:[t.jsx("h3",{className:"font-medium text-gray-900",children:a("market.categories")}),je&&t.jsx("span",{className:"text-xs text-blue-600 cursor-pointer hover:underline transition-colors duration-200",onClick:()=>S(""),children:a("market.clearCategoryFilter")})]}),t.jsx("div",{className:"flex flex-col gap-2",children:Cr.map(Pe=>t.jsx("button",{onClick:()=>Da(Pe),className:`px-3 py-2 rounded text-sm text-left transition-all duration-200 ${je===Pe?"bg-blue-100 text-blue-800 font-medium btn-primary":"bg-gray-100 text-gray-800 hover:bg-gray-200 btn-secondary"}`,children:Pe},Pe))})]}):Hr?t.jsxs("div",{className:"mb-6",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"font-medium text-gray-900",children:a("market.categories")})}),t.jsxs("div",{className:"flex flex-col gap-2 items-center py-4 loading-container",children:[t.jsxs("svg",{className:"animate-spin h-6 w-6 text-blue-500 mb-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-sm text-gray-600",children:a("app.loading")})]})]}):t.jsxs("div",{className:"mb-6",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"font-medium text-gray-900",children:a("market.categories")})}),t.jsx("p",{className:"text-sm text-gray-600 py-2",children:a("market.noCategories")})]})})}),t.jsx("div",{className:"flex-grow",children:Hr?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600",children:a("app.loading")})]})}):gr.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6",children:t.jsx("p",{className:"text-gray-600",children:a(Je?"market.noServers":We?"registry.noServers":"cloud.noServers")})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:gr.map((Pe,$e)=>Je?t.jsx(aN,{server:Pe,onClick:pr},$e):We?t.jsx(iN,{serverEntry:Pe,onClick:pr},$e):t.jsx(nN,{server:Pe,onClick:pr},$e))}),t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:"flex-[2] text-sm text-gray-500",children:Je?a("market.showing",{from:(dt-1)*lr+1,to:Math.min(dt*lr,rr.length),total:rr.length}):We?a("registry.showing",{from:(dt-1)*lr+1,to:(dt-1)*lr+gr.length,total:rr.length+(be?"+":"")}):a("cloud.showing",{from:(dt-1)*lr+1,to:Math.min(dt*lr,rr.length),total:rr.length})}),t.jsx("div",{className:"flex-[4] flex justify-center",children:We?t.jsx(dN,{currentPage:dt,hasNextPage:be,hasPreviousPage:Ne,onNextPage:ke,onPreviousPage:Se}):t.jsx(Ld,{currentPage:dt,totalPages:Zt,onPageChange:He})}),t.jsxs("div",{className:"flex-[2] flex items-center justify-end space-x-2",children:[t.jsxs("label",{htmlFor:"perPage",className:"text-sm text-gray-600",children:[a(Je?"market.perPage":We?"registry.perPage":"cloud.perPage"),":"]}),t.jsxs("select",{id:"perPage",value:lr,onChange:jt,className:"border rounded p-1 text-sm btn-secondary outline-none",children:[t.jsx("option",{value:"6",children:"6"}),t.jsx("option",{value:"9",children:"9"}),t.jsx("option",{value:"12",children:"12"}),t.jsx("option",{value:"24",children:"24"})]})]})]})]})})]})]})};function fh(a,n){if(typeof a=="function")return a(n);a!=null&&(a.current=n)}function mN(...a){return n=>{let l=!1;const o=a.map(c=>{const u=fh(c,n);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c<o.length;c++){const u=o[c];typeof u=="function"?u():fh(a[c],null)}}}}function pN(a){const n=fN(a),l=x.forwardRef((o,c)=>{const{children:u,...m}=o,g=x.Children.toArray(u),f=g.find(xN);if(f){const h=f.props.children,b=g.map(y=>y===f?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:y);return t.jsx(n,{...m,ref:c,children:x.isValidElement(h)?x.cloneElement(h,void 0,b):null})}return t.jsx(n,{...m,ref:c,children:u})});return l.displayName=`${a}.Slot`,l}var gN=pN("Slot");function fN(a){const n=x.forwardRef((l,o)=>{const{children:c,...u}=l;if(x.isValidElement(c)){const m=bN(c),g=yN(u,c.props);return c.type!==x.Fragment&&(g.ref=o?mN(o,m):m),x.cloneElement(c,g)}return x.Children.count(c)>1?x.Children.only(null):null});return n.displayName=`${a}.SlotClone`,n}var hN=Symbol("radix.slottable");function xN(a){return x.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===hN}function yN(a,n){const l={...n};for(const o in n){const c=a[o],u=n[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...g)=>{const f=u(...g);return c(...g),f}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...a,...l}}function bN(a){var o,c;let n=(o=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:o.get,l=n&&"isReactWarning"in n&&n.isReactWarning;return l?a.ref:(n=(c=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:c.get,l=n&&"isReactWarning"in n&&n.isReactWarning,l?a.props.ref:a.props.ref||a.ref)}const vN={default:"bg-blue-500 text-white hover:bg-blue-600 focus:ring-blue-500",outline:"border border-gray-300 dark:border-gray-700 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300",link:"bg-transparent underline-offset-4 hover:underline text-blue-500 hover:text-blue-600",destructive:"bg-red-500 text-white hover:bg-red-600 focus:ring-red-500"},wN={default:"h-10 py-2 px-4",sm:"h-8 px-3 text-sm",lg:"h-12 px-6",icon:"h-10 w-10 p-0 text-center"};function jN({variant:a="default",size:n="default",className:l,disabled:o,loading:c=!1,asChild:u=!1,children:m,onClick:g,...f}){const[h,b]=x.useState(!1),y=c||h,w=async S=>{if(g)try{const j=g(S);j&&typeof j.then=="function"&&(b(!0),await j)}finally{b(!1)}},N=u?gN:"button";return t.jsx(N,{className:la("rounded-md inline-flex items-center justify-center font-medium transition-all duration-200 active:scale-95 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none relative",vN[a],wN[n],l),disabled:o||y,onClick:w,...f,children:u?m:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:la("flex items-center justify-center",y&&"invisible"),children:m}),y&&t.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]})})}const SN=({logs:a,isLoading:n=!1,error:l=null,onClear:o})=>{const{t:c}=ve(),u=x.useRef(null),[m,g]=x.useState(!0),[f,h]=x.useState(""),[b,y]=x.useState(["info","error","warn","debug"]),[w,N]=x.useState(["main","child"]);x.useEffect(()=>{m&&u.current&&(u.current.scrollTop=u.current.scrollHeight)},[a,m]);const S=a.filter(E=>{const T=f?E.message.toLowerCase().includes(f.toLowerCase()):!0,B=b.includes(E.type),D=w.includes(E.source);return T&&B&&D}),j=E=>new Date(E).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),C=E=>{switch(E){case"error":return"bg-red-400/80 text-white";case"warn":return"bg-yellow-400/80 text-gray-900";case"debug":return"bg-purple-400/80 text-white";case"info":return"bg-blue-400/80 text-white";default:return"bg-blue-400/80 text-white"}},z=E=>{switch(E){case"main":return"bg-green-400/80 text-white";case"child":return"bg-orange-400/80 text-white";default:return"bg-gray-400/80 text-white"}};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"bg-card p-3 rounded-t-md flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:"font-semibold text-sm",children:[c("logs.filters"),":"]}),t.jsx("input",{type:"text",placeholder:c("logs.search"),className:"shadow appearance-none border border-gray-200 dark:border-gray-700 rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",value:f,onChange:E=>h(E.target.value)}),t.jsx("div",{className:"flex gap-1 items-center",children:["debug","info","error","warn"].map(E=>t.jsx(ao,{variant:b.includes(E)?"default":"outline",className:`cursor-pointer ${b.includes(E)?C(E):""}`,onClick:()=>{b.includes(E)?y(T=>T.filter(B=>B!==E)):y(T=>[...T,E])},children:E},E))}),t.jsx("div",{className:"flex gap-1 items-center ml-2",children:["main","child"].map(E=>t.jsx(ao,{variant:w.includes(E)?"default":"outline",className:`cursor-pointer ${w.includes(E)?z(E):""}`,onClick:()=>{w.includes(E)?N(T=>T.filter(B=>B!==E)):N(T=>[...T,E])},children:c(E==="main"?"logs.mainProcess":"logs.childProcess")},E))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[t.jsx("input",{type:"checkbox",checked:m,onChange:()=>g(!m),className:"form-checkbox h-4 w-4"}),c("logs.autoScroll")]}),t.jsx(jN,{variant:"outline",size:"sm",onClick:o,className:"btn-secondary",disabled:n||a.length===0,children:c("logs.clearLogs")})]})]}),t.jsx("div",{ref:u,className:"flex-grow p-2 overflow-auto bg-card rounded-b-md font-mono text-sm",style:{maxHeight:"calc(100vh - 300px)"},children:n?t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx("span",{children:c("logs.loading")})}):l?t.jsx("div",{className:"text-red-500 p-2",children:l.message}):S.length===0?t.jsx("div",{className:"text-center text-muted-foreground p-8",children:f||b.length<4||w.length<2?c("logs.noMatch"):c("logs.noLogs")}):S.map((E,T)=>t.jsxs("div",{className:`py-1 ${E.type==="error"?"text-red-500":E.type==="warn"?"text-yellow-500":""}`,children:[t.jsxs("span",{className:"text-gray-400",children:["[",j(E.timestamp),"]"]}),t.jsx(ao,{className:`ml-2 mr-1 ${C(E.type)}`,children:E.type}),t.jsxs(ao,{variant:"default",className:`mr-2 ${z(E.source)}`,children:[E.source==="main"?c("logs.main"):c("logs.child"),E.processId?` (${E.processId})`:""]}),t.jsx("span",{className:"whitespace-pre-wrap",children:E.message})]},`${E.timestamp}-${T}`))})]})},NN=()=>{const{t:a}=ve(),{logs:n,loading:l,error:o,clearLogs:c}=_j();return t.jsxs("div",{className:"container mx-auto p-4",children:[t.jsx("div",{className:"flex justify-between items-center mb-4",children:t.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:a("pages.logs.title")})}),t.jsx("div",{className:"bg-card rounded-md shadow-sm border border-gray-200 dark:border-gray-700 page-card",children:t.jsx(SN,{logs:n,isLoading:l,error:o,onClear:c})})]})},nx=["success","error"],kN=a=>nx.includes(a),CN=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState(null),[u,m]=x.useState(null),[g,f]=x.useState(null),[h,b]=x.useState(1),[y,w]=x.useState(10),[N,S]=x.useState(!0),[j,C]=x.useState(null),[z,E]=x.useState(null),[T,B]=x.useState(!1),[D,Y]=x.useState({}),[R,_]=x.useState(""),[P,V]=x.useState(""),[K,G]=x.useState(""),[I,L]=x.useState(""),[Z,A]=x.useState(""),H=x.useCallback(async()=>{S(!0),C(null);try{const se={...D},[ye,ie,ae]=await Promise.all([tS(h,y,se),aS(se),sS()]);ye!=null&&ye.success&&Array.isArray(ye.data)&&(l(ye.data),ye.pagination&&f(ye.pagination)),ie!=null&&ie.success&&ie.data&&c(ie.data),ae!=null&&ae.success&&ae.data&&m(ae.data)}catch(se){console.error("Error fetching activity data:",se),C(a("activity.fetchError"))}finally{S(!1)}},[h,y,D,a]);x.useEffect(()=>{H()},[H]),x.useEffect(()=>{if(!g)return;const se=Math.max(1,g.totalPages||1);h>se&&b(se)},[g,h]);const J=async se=>{try{const ye=await rS(se.id);ye!=null&&ye.success&&ye.data&&(E(ye.data),B(!0))}catch(ye){console.error("Error fetching activity details:",ye)}},me=async()=>{var se;if(window.confirm(a("activity.confirmCleanup")))try{const ye=await nS(30);ye!=null&&ye.success&&(alert(a("activity.cleanupSuccess",{count:((se=ye.data)==null?void 0:se.deletedCount)||0})),H())}catch(ye){console.error("Error cleaning up activities:",ye),alert(a("activity.cleanupError"))}},le=()=>{const se={};R&&(se.server=R),P&&(se.tool=P),K&&kN(K)&&(se.status=K),I&&(se.group=I),Z&&(se.keyName=Z),Y(se),b(1)},k=()=>{_(""),V(""),G(""),L(""),A(""),Y({}),b(1)},U=se=>se<1e3?`${se}ms`:se<6e4?`${(se/1e3).toFixed(2)}s`:`${(se/6e4).toFixed(2)}m`,M=se=>new Date(se).toLocaleString(),q=se=>{if(!se)return null;try{return JSON.parse(se)}catch{return se}},de=()=>o?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm px-4 py-3 mb-4",children:t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.totalCalls")}),t.jsx("div",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o.totalCalls})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.successCount")}),t.jsx("div",{className:"text-lg font-semibold text-green-600",children:o.successCount})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.errorCount")}),t.jsx("div",{className:"text-lg font-semibold text-red-600",children:o.errorCount})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.avgDuration")}),t.jsx("div",{className:"text-lg font-semibold text-blue-600",children:U(o.avgDuration)})]})]})}):null,ee=()=>t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm px-4 py-3 mb-4",children:t.jsxs("div",{className:"flex flex-wrap gap-3 items-end",children:[t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-server",children:a("activity.server")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-server",type:"text",value:R,onChange:se=>_(se.target.value),placeholder:a("activity.searchServer"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"server-options"}),R&&t.jsx("button",{onClick:()=>_(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.servers)&&t.jsx("datalist",{id:"server-options",children:u.servers.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-tool",children:a("activity.tool")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-tool",type:"text",value:P,onChange:se=>V(se.target.value),placeholder:a("activity.searchTool"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"tool-options"}),P&&t.jsx("button",{onClick:()=>V(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.tools)&&t.jsx("datalist",{id:"tool-options",children:u.tools.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-status",children:a("activity.status")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-status",type:"text",value:K,onChange:se=>G(se.target.value.toLowerCase()),placeholder:a("activity.searchStatus"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"activity-status-options"}),K&&t.jsx("button",{onClick:()=>G(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),t.jsx("datalist",{id:"activity-status-options",children:nx.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-group",children:a("activity.group")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-group",type:"text",value:I,onChange:se=>L(se.target.value),placeholder:a("activity.searchGroup"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"group-options"}),I&&t.jsx("button",{onClick:()=>L(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.groups)&&t.jsx("datalist",{id:"group-options",children:u.groups.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-keyname",children:a("activity.keyName")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-keyname",type:"text",value:Z,onChange:se=>A(se.target.value),placeholder:a("activity.searchKeyName"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"keyname-options"}),Z&&t.jsx("button",{onClick:()=>A(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.keyNames)&&t.jsx("datalist",{id:"keyname-options",children:u.keyNames.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[t.jsxs("button",{onClick:le,className:"h-10 px-3 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200 whitespace-nowrap",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})}),a("common.search")]}),t.jsxs("button",{onClick:k,className:"h-10 px-3 bg-gray-100 text-gray-800 rounded hover:bg-gray-200 flex items-center btn-secondary transition-all duration-200 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600 whitespace-nowrap",children:[t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[t.jsx("circle",{cx:"12",cy:"12",r:"9"}),t.jsx("path",{strokeLinecap:"round",d:"M9 9l6 6M15 9l-6 6"})]}),a("common.clear")]})]})]})}),X=()=>n.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-8 text-center text-gray-500 dark:text-gray-400",children:a("activity.noData")}):t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.timestamp")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.server")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.tool")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.duration")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.status")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.group")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.key")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("common.actions")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.map(se=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200 whitespace-nowrap",children:M(se.timestamp)}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200",children:t.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-xs",children:se.server})}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200",children:t.jsx("span",{className:"font-mono bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded text-xs",children:se.tool})}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200 whitespace-nowrap",children:U(se.duration)}),t.jsx("td",{className:"px-4 py-3 text-sm whitespace-nowrap",children:t.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${se.status==="success"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:se.status==="success"?a("activity.statusSuccess"):a("activity.statusError")})}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400",children:se.group||"-"}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400",children:se.keyName||"-"}),t.jsx("td",{className:"px-4 py-3 text-sm",children:t.jsx("button",{onClick:()=>J(se),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:a("common.view")})})]},se.id))})]})})}),he=()=>{if(!T||!z)return null;const se=q(z.input),ye=q(z.output);return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl w-full mx-4 max-h-[90vh] overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:a("activity.details")}),t.jsx("button",{onClick:()=>B(!1),className:"text-gray-400 hover:text-gray-500 dark:hover:text-gray-300",children:t.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-120px)]",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.timestamp")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:M(z.timestamp)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.duration")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:U(z.duration)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.server")}),t.jsx("p",{className:"text-gray-900 dark:text-white font-mono",children:z.server})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.tool")}),t.jsx("p",{className:"text-gray-900 dark:text-white font-mono",children:z.tool})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.status")}),t.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${z.status==="success"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:z.status==="success"?a("activity.statusSuccess"):a("activity.statusError")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.group")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:z.group||"-"})]}),z.keyName&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.key")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:z.keyName})]})]}),z.errorMessage&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-red-500 mb-1",children:a("activity.errorMessage")}),t.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 rounded p-3 text-sm text-red-800 dark:text-red-200",children:z.errorMessage})]}),se&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:a("activity.input")}),t.jsx("pre",{className:"bg-gray-100 dark:bg-gray-700 rounded p-3 text-sm overflow-x-auto max-h-64",children:typeof se=="string"?se:JSON.stringify(se,null,2)})]}),ye&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:a("activity.output")}),t.jsx("pre",{className:"bg-gray-100 dark:bg-gray-700 rounded p-3 text-sm overflow-x-auto max-h-64",children:typeof ye=="string"?ye:JSON.stringify(ye,null,2)})]})]})]})})};return t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between items-center mb-6",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a("activity.title")}),t.jsx("div",{className:"flex space-x-4",children:t.jsxs("button",{onClick:me,className:"px-4 py-2 bg-red-100 text-red-800 rounded hover:bg-red-200 flex items-center transition-all duration-200",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),a("activity.cleanup")]})})]}),j&&t.jsx("div",{className:"mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded shadow-sm",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-red-700",children:j}),t.jsx("button",{onClick:()=>C(null),className:"ml-4 text-gray-500 hover:text-gray-700",children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[t.jsx("circle",{cx:"12",cy:"12",r:"9"}),t.jsx("path",{strokeLinecap:"round",d:"M9 9l6 6M15 9l-6 6"})]})})]})}),N&&n.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:a("app.loading")})]})}):t.jsxs(t.Fragment,{children:[de(),ee(),X(),t.jsxs("div",{className:"flex items-center mt-6",children:[t.jsx("div",{className:"flex-[2] text-sm text-gray-500 dark:text-gray-400",children:g&&a("common.showing",{start:(g.page-1)*g.limit+1,end:Math.min(g.page*g.limit,g.total),total:g.total})}),t.jsx("div",{className:"flex-[4] flex justify-center",children:g&&g.totalPages>1&&t.jsx(Ld,{currentPage:h,totalPages:g.totalPages,onPageChange:b,disabled:N})}),t.jsxs("div",{className:"flex-[2] flex items-center justify-end space-x-2",children:[t.jsxs("label",{htmlFor:"perPage",className:"text-sm text-gray-500 dark:text-gray-400",children:[a("common.itemsPerPage"),":"]}),t.jsxs("select",{id:"perPage",value:y,onChange:se=>{w(Number(se.target.value)),b(1)},disabled:N,className:"border border-gray-300 dark:border-gray-600 rounded p-1 text-sm dark:bg-gray-700 dark:text-white outline-none disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx("option",{value:10,children:"10"}),t.jsx("option",{value:20,children:"20"}),t.jsx("option",{value:50,children:"50"}),t.jsx("option",{value:100,children:"100"})]})]})]})]}),he()]})},AN=async()=>{const a=await Be("/prompts");if(!a.success)throw new Error(a.message||"Failed to fetch built-in prompts");return a.data||[]},EN=async a=>{const n=await pt("/prompts",a);if(!n.success)throw new Error(n.message||"Failed to create built-in prompt");return n.data},RN=async(a,n)=>{const l=await At(`/prompts/${a}`,n);if(!l.success)throw new Error(l.message||"Failed to update built-in prompt");return l.data},TN=async a=>{const n=await Yr(`/prompts/${a}`);if(!n.success)throw new Error(n.message||"Failed to delete built-in prompt")},ON=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState(!0),[u,m]=x.useState(null),[g,f]=x.useState(0),h=x.useCallback(async()=>{try{c(!0);const S=await AN();l(S),m(null)}catch(S){console.error("Error fetching built-in prompts:",S),m(S instanceof Error?S.message:a("builtinPrompts.fetchError")),l([])}finally{c(!1)}},[a]),b=x.useCallback(()=>{f(S=>S+1)},[]),y=async S=>{try{const j=await EN(S);return b(),{success:!0,data:j}}catch(j){const C=j instanceof Error?j.message:a("builtinPrompts.createError");return m(C),{success:!1,message:C}}},w=async(S,j)=>{try{const C=await RN(S,j);return b(),{success:!0,data:C}}catch(C){const z=C instanceof Error?C.message:a("builtinPrompts.updateError");return m(z),{success:!1,message:z}}},N=async S=>{try{return await TN(S),b(),{success:!0}}catch(j){const C=j instanceof Error?j.message:a("builtinPrompts.deleteError");return m(C),{success:!1,message:C}}};return x.useEffect(()=>{h()},[h,g]),{prompts:n,loading:o,error:u,setError:m,triggerRefresh:b,addPrompt:y,editPrompt:w,removePrompt:N}},hh=({prompt:a,onSave:n,onCancel:l})=>{const{t:o}=ve(),[c,u]=x.useState(null),[m,g]=x.useState(!1),[f,h]=x.useState((a==null?void 0:a.name)||""),[b,y]=x.useState((a==null?void 0:a.title)||""),[w,N]=x.useState((a==null?void 0:a.description)||""),[S,j]=x.useState((a==null?void 0:a.template)||""),[C,z]=x.useState((a==null?void 0:a.enabled)!==!1),[E,T]=x.useState((a==null?void 0:a.arguments)||[]),B=()=>{T([...E,{name:"",description:"",required:!1}])},D=_=>{T(E.filter((P,V)=>V!==_))},Y=(_,P,V)=>{T(E.map((K,G)=>G===_?{...K,[P]:V}:K))},R=async _=>{if(_.preventDefault(),u(null),!f.trim()){u(o("builtinPrompts.nameRequired"));return}if(!S.trim()){u(o("builtinPrompts.templateRequired"));return}g(!0);try{const P=await n({name:f.trim(),title:b.trim()||void 0,description:w.trim()||void 0,template:S,arguments:E.length>0?E.filter(V=>V.name.trim()):void 0,enabled:C});P.success||u(P.message||o("builtinPrompts.saveError"))}catch(P){u(P instanceof Error?P.message:o("builtinPrompts.saveError"))}finally{g(!1)}};return t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-xl shadow-2xl max-w-3xl w-full mx-4 border border-gray-100 dark:border-gray-700 max-h-[90vh] overflow-y-auto",children:t.jsxs("form",{onSubmit:R,children:[t.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-6",children:o(a?"builtinPrompts.edit":"builtinPrompts.addNew")}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 rounded-md",children:t.jsx("p",{className:"text-sm font-medium",children:c})}),t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinPrompts.name")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("input",{type:"text",value:f,onChange:_=>h(_.target.value),placeholder:o("builtinPrompts.namePlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",required:!0,disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinPrompts.title")}),t.jsx("input",{type:"text",value:b,onChange:_=>y(_.target.value),placeholder:o("builtinPrompts.titlePlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinPrompts.description")}),t.jsx("input",{type:"text",value:w,onChange:_=>N(_.target.value),placeholder:o("builtinPrompts.descriptionPlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinPrompts.template")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("textarea",{value:S,onChange:_=>j(_.target.value),placeholder:o("builtinPrompts.templatePlaceholder"),rows:6,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-mono text-sm transition-all duration-200",required:!0,disabled:m}),t.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:o("builtinPrompts.templateHint")})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:o("builtinPrompts.arguments")}),t.jsxs("button",{type:"button",onClick:B,className:"text-blue-600 hover:text-blue-800 text-sm flex items-center",disabled:m,children:[t.jsx(Td,{size:14,className:"mr-1"}),o("builtinPrompts.addArgument")]})]}),E.map((_,P)=>t.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[t.jsx("input",{type:"text",value:_.name,onChange:V=>Y(P,"name",V.target.value),placeholder:o("builtinPrompts.argName"),className:"flex-1 px-3 py-1.5 border border-gray-300 dark:border-gray-600 rounded-lg text-sm bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:m}),t.jsx("input",{type:"text",value:_.description||"",onChange:V=>Y(P,"description",V.target.value),placeholder:o("builtinPrompts.argDescription"),className:"flex-1 px-3 py-1.5 border border-gray-300 dark:border-gray-600 rounded-lg text-sm bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:m}),t.jsxs("label",{className:"flex items-center text-sm text-gray-600 dark:text-gray-400 whitespace-nowrap",children:[t.jsx("input",{type:"checkbox",checked:_.required||!1,onChange:V=>Y(P,"required",V.target.checked),className:"mr-1",disabled:m}),o("builtinPrompts.argRequired")]}),t.jsx("button",{type:"button",onClick:()=>D(P),className:"text-red-500 hover:text-red-700 p-1",disabled:m,children:t.jsx(Ma,{size:16})})]},P))]}),t.jsxs("div",{className:"flex items-center pt-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:C,onChange:_=>z(_.target.checked),className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500",disabled:m}),t.jsx("label",{htmlFor:"enabled",className:"ml-2 block text-sm text-gray-700 dark:text-gray-300",children:o("builtinPrompts.enabled")})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 btn-secondary",disabled:m,children:o("common.cancel")}),t.jsx("button",{type:"submit",disabled:m,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 btn-primary transition-all duration-200 shadow-sm disabled:opacity-50",children:o(m?"common.saving":"common.save")})]})]})})})},zN=()=>{var Y;const{t:a}=ve(),{auth:n}=ca(),{prompts:l,loading:o,error:c,setError:u,addPrompt:m,editPrompt:g,removePrompt:f}=ON(),[h,b]=x.useState(!1),[y,w]=x.useState(null),[N,S]=x.useState(null),[j,C]=x.useState(new Set),z=(Y=n.user)==null?void 0:Y.isAdmin,E=R=>{C(_=>{const P=new Set(_);return P.has(R)?P.delete(R):P.add(R),P})},T=async R=>{const _=await m(R);return _.success&&b(!1),_},B=async R=>{if(!y)return{success:!1,message:"No prompt selected"};const _=await g(y.id,R);return _.success&&w(null),_},D=async()=>{N&&(await f(N.id),S(null))};return t.jsxs("div",{className:"container mx-auto",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:a("pages.prompts.title")}),z&&t.jsxs("button",{onClick:()=>b(!0),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 flex items-center btn-primary transition-all duration-200 shadow-sm",children:[t.jsx(Td,{size:16,className:"mr-2"}),a("builtinPrompts.add")]})]}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 error-box rounded-lg shadow-sm",children:t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("p",{children:c}),t.jsx("button",{onClick:()=>u(null),className:"text-red-500 hover:text-red-700",children:t.jsx(Ma,{size:20})})]})}),o?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 loading-container flex justify-center items-center h-64",children:t.jsxs("div",{className:"flex flex-col items-center justify-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("app.loading")})]})}):l.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 empty-state dashboard-card",children:t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:t.jsx(Nn,{className:"h-8 w-8 text-gray-400"})}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-lg font-medium",children:a("builtinPrompts.noPrompts")}),z&&t.jsx("button",{onClick:()=>b(!0),className:"mt-4 text-blue-600 hover:text-blue-800 font-medium",children:a("builtinPrompts.addFirst")})]})}):t.jsx("div",{className:"space-y-3",children:l.map(R=>{const _=j.has(R.id);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden dashboard-card",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 cursor-pointer hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700",onClick:()=>E(R.id),children:[t.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[t.jsx(Nn,{size:18,className:`mr-3 flex-shrink-0 ${R.enabled!==!1?"text-blue-500":"text-gray-400"}`}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:R.title||R.name}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:R.name}),t.jsx("span",{className:`px-2 py-0.5 text-xs rounded-full ${R.enabled!==!1?"bg-green-100 text-green-800 border border-green-200":"bg-gray-100 text-gray-600 border border-gray-200"}`,children:R.enabled!==!1?a("builtinPrompts.active"):a("builtinPrompts.inactive")})]}),R.description&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:R.description})]})]}),t.jsxs("div",{className:"flex items-center ml-4 gap-2",children:[z&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:P=>{P.stopPropagation(),w(R)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/40 transition-colors",title:a("builtinPrompts.edit"),children:t.jsx(ds,{size:18})}),t.jsx("button",{onClick:P=>{P.stopPropagation(),S(R)},className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-1 rounded hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors",title:a("builtinPrompts.delete"),children:t.jsx(So,{size:18})})]}),_?t.jsx(b0,{size:18,className:"text-gray-400"}):t.jsx(us,{size:18,className:"text-gray-400"})]})]}),_&&t.jsxs("div",{className:"px-6 pb-4 border-t border-gray-100 dark:border-gray-700",children:[t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase mb-1",children:a("builtinPrompts.template")}),t.jsx("pre",{className:"text-sm text-gray-800 dark:text-gray-200 bg-gray-50 dark:bg-gray-900 rounded p-3 overflow-x-auto whitespace-pre-wrap font-mono",children:R.template})]}),R.arguments&&R.arguments.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase mb-1",children:a("builtinPrompts.arguments")}),t.jsx("div",{className:"space-y-1",children:R.arguments.map((P,V)=>t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("code",{className:"px-1.5 py-0.5 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded text-xs font-mono",children:"{{"+P.name+"}}"}),P.required&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"}),P.description&&t.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-xs",children:["— ",P.description]})]},V))})]})]})]},R.id)})}),h&&t.jsx(hh,{onSave:T,onCancel:()=>b(!1)}),y&&t.jsx(hh,{prompt:y,onSave:B,onCancel:()=>w(null)}),t.jsx(Dd,{isOpen:!!N,onClose:()=>S(null),onConfirm:D,title:a("builtinPrompts.confirmDelete"),message:a("builtinPrompts.deleteWarning",{name:(N==null?void 0:N.name)||""}),variant:"danger"})]})},MN=async()=>{const a=await Be("/resources");if(!a.success)throw new Error(a.message||"Failed to fetch built-in resources");return a.data||[]},PN=async a=>{const n=await pt("/resources",a);if(!n.success)throw new Error(n.message||"Failed to create built-in resource");return n.data},DN=async(a,n)=>{const l=await At(`/resources/${a}`,n);if(!l.success)throw new Error(l.message||"Failed to update built-in resource");return l.data},LN=async a=>{const n=await Yr(`/resources/${a}`);if(!n.success)throw new Error(n.message||"Failed to delete built-in resource")},UN=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState(!0),[u,m]=x.useState(null),[g,f]=x.useState(0),h=x.useCallback(async()=>{try{c(!0);const S=await MN();l(S),m(null)}catch(S){console.error("Error fetching built-in resources:",S),m(S instanceof Error?S.message:a("builtinResources.fetchError")),l([])}finally{c(!1)}},[a]),b=x.useCallback(()=>{f(S=>S+1)},[]),y=async S=>{try{const j=await PN(S);return b(),{success:!0,data:j}}catch(j){const C=j instanceof Error?j.message:a("builtinResources.createError");return m(C),{success:!1,message:C}}},w=async(S,j)=>{try{const C=await DN(S,j);return b(),{success:!0,data:C}}catch(C){const z=C instanceof Error?C.message:a("builtinResources.updateError");return m(z),{success:!1,message:z}}},N=async S=>{try{return await LN(S),b(),{success:!0}}catch(j){const C=j instanceof Error?j.message:a("builtinResources.deleteError");return m(C),{success:!1,message:C}}};return x.useEffect(()=>{h()},[h,g]),{resources:n,loading:o,error:u,setError:m,triggerRefresh:b,addResource:y,editResource:w,removeResource:N}},xh=({resource:a,onSave:n,onCancel:l})=>{const{t:o}=ve(),[c,u]=x.useState(null),[m,g]=x.useState(!1),[f,h]=x.useState((a==null?void 0:a.uri)||""),[b,y]=x.useState((a==null?void 0:a.name)||""),[w,N]=x.useState((a==null?void 0:a.description)||""),[S,j]=x.useState((a==null?void 0:a.mimeType)||"text/plain"),[C,z]=x.useState((a==null?void 0:a.content)||""),[E,T]=x.useState((a==null?void 0:a.enabled)!==!1),B=async D=>{if(D.preventDefault(),u(null),!f.trim()){u(o("builtinResources.uriRequired"));return}if(!C.trim()){u(o("builtinResources.contentRequired"));return}g(!0);try{const Y=await n({uri:f.trim(),name:b.trim()||void 0,description:w.trim()||void 0,mimeType:S.trim()||"text/plain",content:C,enabled:E});Y.success||u(Y.message||o("builtinResources.saveError"))}catch(Y){u(Y instanceof Error?Y.message:o("builtinResources.saveError"))}finally{g(!1)}};return t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-xl shadow-2xl max-w-3xl w-full mx-4 border border-gray-100 dark:border-gray-700 max-h-[90vh] overflow-y-auto",children:t.jsxs("form",{onSubmit:B,children:[t.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-6",children:o(a?"builtinResources.edit":"builtinResources.addNew")}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 rounded-md",children:t.jsx("p",{className:"text-sm font-medium",children:c})}),t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinResources.uri")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("input",{type:"text",value:f,onChange:D=>h(D.target.value),placeholder:o("builtinResources.uriPlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-mono text-sm transition-all duration-200",required:!0,disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinResources.name")}),t.jsx("input",{type:"text",value:b,onChange:D=>y(D.target.value),placeholder:o("builtinResources.namePlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinResources.description")}),t.jsx("input",{type:"text",value:w,onChange:D=>N(D.target.value),placeholder:o("builtinResources.descriptionPlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinResources.mimeType")}),t.jsx("input",{type:"text",value:S,onChange:D=>j(D.target.value),placeholder:"text/plain",className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinResources.content")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("textarea",{value:C,onChange:D=>z(D.target.value),placeholder:o("builtinResources.contentPlaceholder"),rows:8,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-mono text-sm transition-all duration-200",required:!0,disabled:m})]}),t.jsxs("div",{className:"flex items-center pt-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:E,onChange:D=>T(D.target.checked),className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500",disabled:m}),t.jsx("label",{htmlFor:"enabled",className:"ml-2 block text-sm text-gray-700 dark:text-gray-300",children:o("builtinResources.enabled")})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 btn-secondary",disabled:m,children:o("common.cancel")}),t.jsx("button",{type:"submit",disabled:m,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 btn-primary transition-all duration-200 shadow-sm disabled:opacity-50",children:o(m?"common.saving":"common.save")})]})]})})})},_N=()=>{var Y;const{t:a}=ve(),{auth:n}=ca(),{resources:l,loading:o,error:c,setError:u,addResource:m,editResource:g,removeResource:f}=UN(),[h,b]=x.useState(!1),[y,w]=x.useState(null),[N,S]=x.useState(null),[j,C]=x.useState(new Set),z=(Y=n.user)==null?void 0:Y.isAdmin,E=R=>{C(_=>{const P=new Set(_);return P.has(R)?P.delete(R):P.add(R),P})},T=async R=>{const _=await m(R);return _.success&&b(!1),_},B=async R=>{if(!y)return{success:!1,message:"No resource selected"};const _=await g(y.id,R);return _.success&&w(null),_},D=async()=>{N&&(await f(N.id),S(null))};return t.jsxs("div",{className:"container mx-auto",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:a("pages.resources.title")}),z&&t.jsxs("button",{onClick:()=>b(!0),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 flex items-center btn-primary transition-all duration-200 shadow-sm",children:[t.jsx(Td,{size:16,className:"mr-2"}),a("builtinResources.add")]})]}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 error-box rounded-lg shadow-sm",children:t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("p",{children:c}),t.jsx("button",{onClick:()=>u(null),className:"text-red-500 hover:text-red-700",children:t.jsx(Ma,{size:20})})]})}),o?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 loading-container flex justify-center items-center h-64",children:t.jsxs("div",{className:"flex flex-col items-center justify-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("app.loading")})]})}):l.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 empty-state dashboard-card",children:t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:t.jsx(Sn,{className:"h-8 w-8 text-gray-400"})}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-lg font-medium",children:a("builtinResources.noResources")}),z&&t.jsx("button",{onClick:()=>b(!0),className:"mt-4 text-blue-600 hover:text-blue-800 font-medium",children:a("builtinResources.addFirst")})]})}):t.jsx("div",{className:"space-y-3",children:l.map(R=>{const _=j.has(R.id);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden dashboard-card",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 cursor-pointer hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700",onClick:()=>E(R.id),children:[t.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[t.jsx(Sn,{size:18,className:`mr-3 flex-shrink-0 ${R.enabled!==!1?"text-green-500":"text-gray-400"}`}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:R.name||R.uri}),R.name&&t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:R.uri}),t.jsx("span",{className:`px-2 py-0.5 text-xs rounded-full flex-shrink-0 ${R.enabled!==!1?"bg-green-100 text-green-800 border border-green-200":"bg-gray-100 text-gray-600 border border-gray-200"}`,children:R.enabled!==!1?a("builtinResources.active"):a("builtinResources.inactive")}),R.mimeType&&t.jsx("span",{className:"px-2 py-0.5 text-xs bg-blue-50 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300 rounded-full border border-blue-200 dark:border-blue-800 flex-shrink-0",children:R.mimeType})]}),R.description&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:R.description})]})]}),t.jsxs("div",{className:"flex items-center ml-4 gap-2",children:[z&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:P=>{P.stopPropagation(),w(R)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/40 transition-colors",title:a("builtinResources.edit"),children:t.jsx(ds,{size:18})}),t.jsx("button",{onClick:P=>{P.stopPropagation(),S(R)},className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-1 rounded hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors",title:a("builtinResources.delete"),children:t.jsx(So,{size:18})})]}),_?t.jsx(b0,{size:18,className:"text-gray-400"}):t.jsx(us,{size:18,className:"text-gray-400"})]})]}),_&&t.jsx("div",{className:"px-6 pb-4 border-t border-gray-100 dark:border-gray-700",children:t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase mb-1",children:a("builtinResources.content")}),t.jsx("pre",{className:"text-sm text-gray-800 dark:text-gray-200 bg-gray-50 dark:bg-gray-900 rounded p-3 overflow-x-auto whitespace-pre-wrap font-mono max-h-64 overflow-y-auto",children:R.content})]})})]},R.id)})}),h&&t.jsx(xh,{onSave:T,onCancel:()=>b(!1)}),y&&t.jsx(xh,{resource:y,onSave:B,onCancel:()=>w(null)}),t.jsx(Dd,{isOpen:!!N,onClose:()=>S(null),onConfirm:D,title:a("builtinResources.confirmDelete"),message:a("builtinResources.deleteWarning",{name:(N==null?void 0:N.name)||(N==null?void 0:N.uri)||""}),variant:"danger"})]})},yh="[EMBED_SYNC_ERROR]",BN=8e3,bh=3e4,IN=()=>{const{showToast:a}=Pa(),n=x.useRef(new Map);return x.useEffect(()=>{const l=g=>{const f=Date.now();n.current.forEach((b,y)=>{f-b>=bh&&n.current.delete(y)});const h=n.current.get(g);return h&&f-h<bh?!0:(n.current.set(g,f),!1)},o=g=>{const f=g.match(/server\s+"([^"]+)"/i);return(f==null?void 0:f[1])||null},c=(g,f)=>{l(g)||a(f,"error",BN)},u=g=>{const f=g.replace(yh,"").trim(),h=o(f);if(f.includes("Full embeddings resync failed")){c("embedding-resync-failed","Embedding resynchronization failed. Check smart routing logs and provider limits.");return}if(h){c(`embedding-sync-error:${h}`,`Embedding synchronization failed for server "${h}". Check logs for details.`);return}c(`embedding-sync-error:${f}`,f||"Embedding synchronization failed. Check smart routing logs and provider rate limits.")},m=g=>{var f,h,b;try{const y=JSON.parse(g.data);if((y==null?void 0:y.type)==="embedding-sync-progress"){const N=typeof((f=y.progress)==null?void 0:f.serverName)=="string"?y.progress.serverName:"";(typeof((h=y.progress)==null?void 0:h.status)=="string"?y.progress.status:"")==="error"&&N&&c(`embedding-sync-error:${N}`,`Embedding synchronization failed for server "${N}". Check logs for details.`);return}if((y==null?void 0:y.type)!=="log")return;const w=String(((b=y==null?void 0:y.log)==null?void 0:b.message)||"");if(!w.includes(yh))return;u(w)}catch{}};return Md.subscribe(m)},[a]),null},FN=()=>{const{serverName:a}=Jh();return t.jsx(go,{to:`/market/${a}?tab=cloud`,replace:!0})};function vh(){const a=Pl();return t.jsx(Ej,{children:t.jsx(D2,{children:t.jsx(Tj,{children:t.jsx(Cj,{children:t.jsx(zj,{children:t.jsxs(r1,{basename:a,children:[t.jsx(IN,{}),t.jsxs(Ov,{children:[t.jsx(Ft,{path:"/login",element:t.jsx(mS,{})}),t.jsx(Ft,{element:t.jsx(cS,{}),children:t.jsxs(Ft,{element:t.jsx(oS,{}),children:[t.jsx(Ft,{path:"/",element:t.jsx(pS,{})}),t.jsx(Ft,{path:"/servers",element:t.jsx(US,{})}),t.jsx(Ft,{path:"/groups",element:t.jsx(KS,{})}),t.jsx(Ft,{path:"/prompts",element:t.jsx(zN,{})}),t.jsx(Ft,{path:"/resources",element:t.jsx(_N,{})}),t.jsx(Ft,{path:"/users",element:t.jsx(YS,{})}),t.jsx(Ft,{path:"/market",element:t.jsx(gh,{})}),t.jsx(Ft,{path:"/market/:serverName",element:t.jsx(gh,{})}),t.jsx(Ft,{path:"/cloud",element:t.jsx(go,{to:"/market?tab=cloud",replace:!0})}),t.jsx(Ft,{path:"/cloud/:serverName",element:t.jsx(FN,{})}),t.jsx(Ft,{path:"/logs",element:t.jsx(NN,{})}),t.jsx(Ft,{path:"/activity",element:t.jsx(CN,{})}),t.jsx(Ft,{path:"/settings",element:t.jsx(WS,{})})]})}),t.jsx(Ft,{path:"*",element:t.jsx(go,{to:"/"})})]})]})})})})})})}const De=a=>typeof a=="string",Al=()=>{let a,n;const l=new Promise((o,c)=>{a=o,n=c});return l.resolve=a,l.reject=n,l},wh=a=>a==null?"":""+a,HN=(a,n,l)=>{a.forEach(o=>{n[o]&&(l[o]=n[o])})},qN=/###/g,jh=a=>a&&a.indexOf("###")>-1?a.replace(qN,"."):a,Sh=a=>!a||De(a),El=(a,n,l)=>{const o=De(n)?n.split("."):n;let c=0;for(;c<o.length-1;){if(Sh(a))return{};const u=jh(o[c]);!a[u]&&l&&(a[u]=new l),Object.prototype.hasOwnProperty.call(a,u)?a=a[u]:a={},++c}return Sh(a)?{}:{obj:a,k:jh(o[c])}},Nh=(a,n,l)=>{const{obj:o,k:c}=El(a,n,Object);if(o!==void 0||n.length===1){o[c]=l;return}let u=n[n.length-1],m=n.slice(0,n.length-1),g=El(a,m,Object);for(;g.obj===void 0&&m.length;)u=`${m[m.length-1]}.${u}`,m=m.slice(0,m.length-1),g=El(a,m,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${u}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${u}`]=l},GN=(a,n,l,o)=>{const{obj:c,k:u}=El(a,n,Object);c[u]=c[u]||[],c[u].push(l)},ho=(a,n)=>{const{obj:l,k:o}=El(a,n);if(l&&Object.prototype.hasOwnProperty.call(l,o))return l[o]},KN=(a,n,l)=>{const o=ho(a,l);return o!==void 0?o:ho(n,l)},lx=(a,n,l)=>{for(const o in n)o!=="__proto__"&&o!=="constructor"&&(o in a?De(a[o])||a[o]instanceof String||De(n[o])||n[o]instanceof String?l&&(a[o]=n[o]):lx(a[o],n[o],l):a[o]=n[o]);return a},yn=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var VN={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const $N=a=>De(a)?a.replace(/[&<>"'\/]/g,n=>VN[n]):a;class YN{constructor(n){this.capacity=n,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(n){const l=this.regExpMap.get(n);if(l!==void 0)return l;const o=new RegExp(n);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(n,o),this.regExpQueue.push(n),o}}const JN=[" ",",","?","!",";"],QN=new YN(20),XN=(a,n,l)=>{n=n||"",l=l||"";const o=JN.filter(m=>n.indexOf(m)<0&&l.indexOf(m)<0);if(o.length===0)return!0;const c=QN.getRegExp(`(${o.map(m=>m==="?"?"\\?":m).join("|")})`);let u=!c.test(a);if(!u){const m=a.indexOf(l);m>0&&!c.test(a.substring(0,m))&&(u=!0)}return u},hd=(a,n,l=".")=>{if(!a)return;if(a[n])return Object.prototype.hasOwnProperty.call(a,n)?a[n]:void 0;const o=n.split(l);let c=a;for(let u=0;u<o.length;){if(!c||typeof c!="object")return;let m,g="";for(let f=u;f<o.length;++f)if(f!==u&&(g+=l),g+=o[f],m=c[g],m!==void 0){if(["string","number","boolean"].indexOf(typeof m)>-1&&f<o.length-1)continue;u+=f-u+1;break}c=m}return c},Tl=a=>a==null?void 0:a.replace("_","-"),ZN={type:"logger",log(a){this.output("log",a)},warn(a){this.output("warn",a)},error(a){this.output("error",a)},output(a,n){var l,o;(o=(l=console==null?void 0:console[a])==null?void 0:l.apply)==null||o.call(l,console,n)}};class xo{constructor(n,l={}){this.init(n,l)}init(n,l={}){this.prefix=l.prefix||"i18next:",this.logger=n||ZN,this.options=l,this.debug=l.debug}log(...n){return this.forward(n,"log","",!0)}warn(...n){return this.forward(n,"warn","",!0)}error(...n){return this.forward(n,"error","")}deprecate(...n){return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(n,l,o,c){return c&&!this.debug?null:(De(n[0])&&(n[0]=`${o}${this.prefix} ${n[0]}`),this.logger[l](n))}create(n){return new xo(this.logger,{prefix:`${this.prefix}:${n}:`,...this.options})}clone(n){return n=n||this.options,n.prefix=n.prefix||this.prefix,new xo(this.logger,n)}}var na=new xo;class ko{constructor(){this.observers={}}on(n,l){return n.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(l)||0;this.observers[o].set(l,c+1)}),this}off(n,l){if(this.observers[n]){if(!l){delete this.observers[n];return}this.observers[n].delete(l)}}emit(n,...l){this.observers[n]&&Array.from(this.observers[n].entries()).forEach(([c,u])=>{for(let m=0;m<u;m++)c(...l)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,u])=>{for(let m=0;m<u;m++)c.apply(c,[n,...l])})}}class kh extends ko{constructor(n,l={ns:["translation"],defaultNS:"translation"}){super(),this.data=n||{},this.options=l,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(n){this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}removeNamespaces(n){const l=this.options.ns.indexOf(n);l>-1&&this.options.ns.splice(l,1)}getResource(n,l,o,c={}){var h,b;const u=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,m=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;n.indexOf(".")>-1?g=n.split("."):(g=[n,l],o&&(Array.isArray(o)?g.push(...o):De(o)&&u?g.push(...o.split(u)):g.push(o)));const f=ho(this.data,g);return!f&&!l&&!o&&n.indexOf(".")>-1&&(n=g[0],l=g[1],o=g.slice(2).join(".")),f||!m||!De(o)?f:hd((b=(h=this.data)==null?void 0:h[n])==null?void 0:b[l],o,u)}addResource(n,l,o,c,u={silent:!1}){const m=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator;let g=[n,l];o&&(g=g.concat(m?o.split(m):o)),n.indexOf(".")>-1&&(g=n.split("."),c=l,l=g[1]),this.addNamespaces(l),Nh(this.data,g,c),u.silent||this.emit("added",n,l,o,c)}addResources(n,l,o,c={silent:!1}){for(const u in o)(De(o[u])||Array.isArray(o[u]))&&this.addResource(n,l,u,o[u],{silent:!0});c.silent||this.emit("added",n,l,o)}addResourceBundle(n,l,o,c,u,m={silent:!1,skipCopy:!1}){let g=[n,l];n.indexOf(".")>-1&&(g=n.split("."),c=o,o=l,l=g[1]),this.addNamespaces(l);let f=ho(this.data,g)||{};m.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?lx(f,o,u):f={...f,...o},Nh(this.data,g,f),m.silent||this.emit("added",n,l,o)}removeResourceBundle(n,l){this.hasResourceBundle(n,l)&&delete this.data[n][l],this.removeNamespaces(l),this.emit("removed",n,l)}hasResourceBundle(n,l){return this.getResource(n,l)!==void 0}getResourceBundle(n,l){return l||(l=this.options.defaultNS),this.getResource(n,l)}getDataByLanguage(n){return this.data[n]}hasLanguageSomeTranslations(n){const l=this.getDataByLanguage(n);return!!(l&&Object.keys(l)||[]).find(c=>l[c]&&Object.keys(l[c]).length>0)}toJSON(){return this.data}}var ix={processors:{},addPostProcessor(a){this.processors[a.name]=a},handle(a,n,l,o,c){return a.forEach(u=>{var m;n=((m=this.processors[u])==null?void 0:m.process(n,l,o,c))??n}),n}};const ox=Symbol("i18next/PATH_KEY");function WN(){const a=[],n=Object.create(null);let l;return n.get=(o,c)=>{var u;return(u=l==null?void 0:l.revoke)==null||u.call(l),c===ox?a:(a.push(c),l=Proxy.revocable(o,n),l.proxy)},Proxy.revocable(Object.create(null),n).proxy}function xd(a,n){const{[ox]:l}=a(WN());return l.join((n==null?void 0:n.keySeparator)??".")}const Ch={},ed=a=>!De(a)&&typeof a!="boolean"&&typeof a!="number";class yo extends ko{constructor(n,l={}){super(),HN(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n,this),this.options=l,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=na.create("translator")}changeLanguage(n){n&&(this.language=n)}exists(n,l={interpolation:{}}){const o={...l};if(n==null)return!1;const c=this.resolve(n,o);if((c==null?void 0:c.res)===void 0)return!1;const u=ed(c.res);return!(o.returnObjects===!1&&u)}extractFromKey(n,l){let o=l.nsSeparator!==void 0?l.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator;let u=l.ns||this.options.defaultNS||[];const m=o&&n.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!l.keySeparator&&!this.options.userDefinedNsSeparator&&!l.nsSeparator&&!XN(n,o,c);if(m&&!g){const f=n.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:n,namespaces:De(u)?[u]:u};const h=n.split(o);(o!==c||o===c&&this.options.ns.indexOf(h[0])>-1)&&(u=h.shift()),n=h.join(c)}return{key:n,namespaces:De(u)?[u]:u}}translate(n,l,o){let c=typeof l=="object"?{...l}:l;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),n==null)return"";typeof n=="function"&&(n=xd(n,{...this.options,...c})),Array.isArray(n)||(n=[String(n)]);const u=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,m=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:f}=this.extractFromKey(n[n.length-1],c),h=f[f.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const y=c.lng||this.language,w=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((y==null?void 0:y.toLowerCase())==="cimode")return w?u?{res:`${h}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:y,usedNS:h,usedParams:this.getUsedParamsDetails(c)}:`${h}${b}${g}`:u?{res:g,usedKey:g,exactUsedKey:g,usedLng:y,usedNS:h,usedParams:this.getUsedParamsDetails(c)}:g;const N=this.resolve(n,c);let S=N==null?void 0:N.res;const j=(N==null?void 0:N.usedKey)||g,C=(N==null?void 0:N.exactUsedKey)||g,z=["[object Number]","[object Function]","[object RegExp]"],E=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,T=!this.i18nFormat||this.i18nFormat.handleAsObject,B=c.count!==void 0&&!De(c.count),D=yo.hasDefaultValue(c),Y=B?this.pluralResolver.getSuffix(y,c.count,c):"",R=c.ordinal&&B?this.pluralResolver.getSuffix(y,c.count,{ordinal:!1}):"",_=B&&!c.ordinal&&c.count===0,P=_&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${Y}`]||c[`defaultValue${R}`]||c.defaultValue;let V=S;T&&!S&&D&&(V=P);const K=ed(V),G=Object.prototype.toString.apply(V);if(T&&V&&K&&z.indexOf(G)<0&&!(De(E)&&Array.isArray(V))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const I=this.options.returnedObjectHandler?this.options.returnedObjectHandler(j,V,{...c,ns:f}):`key '${g} (${this.language})' returned an object instead of string.`;return u?(N.res=I,N.usedParams=this.getUsedParamsDetails(c),N):I}if(m){const I=Array.isArray(V),L=I?[]:{},Z=I?C:j;for(const A in V)if(Object.prototype.hasOwnProperty.call(V,A)){const H=`${Z}${m}${A}`;D&&!S?L[A]=this.translate(H,{...c,defaultValue:ed(P)?P[A]:void 0,joinArrays:!1,ns:f}):L[A]=this.translate(H,{...c,joinArrays:!1,ns:f}),L[A]===H&&(L[A]=V[A])}S=L}}else if(T&&De(E)&&Array.isArray(S))S=S.join(E),S&&(S=this.extendTranslation(S,n,c,o));else{let I=!1,L=!1;!this.isValidLookup(S)&&D&&(I=!0,S=P),this.isValidLookup(S)||(L=!0,S=g);const A=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&L?void 0:S,H=D&&P!==S&&this.options.updateMissing;if(L||I||H){if(this.logger.log(H?"updateKey":"missingKey",y,h,g,H?P:S),m){const k=this.resolve(g,{...c,keySeparator:!1});k&&k.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let J=[];const me=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&me&&me[0])for(let k=0;k<me.length;k++)J.push(me[k]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(c.lng||this.language):J.push(c.lng||this.language);const le=(k,U,M)=>{var de;const q=D&&M!==S?M:A;this.options.missingKeyHandler?this.options.missingKeyHandler(k,h,U,q,H,c):(de=this.backendConnector)!=null&&de.saveMissing&&this.backendConnector.saveMissing(k,h,U,q,H,c),this.emit("missingKey",k,h,U,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&B?J.forEach(k=>{const U=this.pluralResolver.getSuffixes(k,c);_&&c[`defaultValue${this.options.pluralSeparator}zero`]&&U.indexOf(`${this.options.pluralSeparator}zero`)<0&&U.push(`${this.options.pluralSeparator}zero`),U.forEach(M=>{le([k],g+M,c[`defaultValue${M}`]||P)})}):le(J,g,P))}S=this.extendTranslation(S,n,c,N,o),L&&S===g&&this.options.appendNamespaceToMissingKey&&(S=`${h}${b}${g}`),(L||I)&&this.options.parseMissingKeyHandler&&(S=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${h}${b}${g}`:g,I?S:void 0,c))}return u?(N.res=S,N.usedParams=this.getUsedParamsDetails(c),N):S}extendTranslation(n,l,o,c,u){var f,h;if((f=this.i18nFormat)!=null&&f.parse)n=this.i18nFormat.parse(n,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=De(n)&&(((h=o==null?void 0:o.interpolation)==null?void 0:h.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let y;if(b){const N=n.match(this.interpolator.nestingRegexp);y=N&&N.length}let w=o.replace&&!De(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(w={...this.options.interpolation.defaultVariables,...w}),n=this.interpolator.interpolate(n,w,o.lng||this.language||c.usedLng,o),b){const N=n.match(this.interpolator.nestingRegexp),S=N&&N.length;y<S&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(n=this.interpolator.nest(n,(...N)=>(u==null?void 0:u[0])===N[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${N[0]} in key: ${l[0]}`),null):this.translate(...N,l),o)),o.interpolation&&this.interpolator.reset()}const m=o.postProcess||this.options.postProcess,g=De(m)?[m]:m;return n!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(n=ix.handle(g,n,l,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),n}resolve(n,l={}){let o,c,u,m,g;return De(n)&&(n=[n]),n.forEach(f=>{if(this.isValidLookup(o))return;const h=this.extractFromKey(f,l),b=h.key;c=b;let y=h.namespaces;this.options.fallbackNS&&(y=y.concat(this.options.fallbackNS));const w=l.count!==void 0&&!De(l.count),N=w&&!l.ordinal&&l.count===0,S=l.context!==void 0&&(De(l.context)||typeof l.context=="number")&&l.context!=="",j=l.lngs?l.lngs:this.languageUtils.toResolveHierarchy(l.lng||this.language,l.fallbackLng);y.forEach(C=>{var z,E;this.isValidLookup(o)||(g=C,!Ch[`${j[0]}-${C}`]&&((z=this.utils)!=null&&z.hasLoadedNamespace)&&!((E=this.utils)!=null&&E.hasLoadedNamespace(g))&&(Ch[`${j[0]}-${C}`]=!0,this.logger.warn(`key "${c}" for languages "${j.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),j.forEach(T=>{var Y;if(this.isValidLookup(o))return;m=T;const B=[b];if((Y=this.i18nFormat)!=null&&Y.addLookupKeys)this.i18nFormat.addLookupKeys(B,b,T,C,l);else{let R;w&&(R=this.pluralResolver.getSuffix(T,l.count,l));const _=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(w&&(l.ordinal&&R.indexOf(P)===0&&B.push(b+R.replace(P,this.options.pluralSeparator)),B.push(b+R),N&&B.push(b+_)),S){const V=`${b}${this.options.contextSeparator||"_"}${l.context}`;B.push(V),w&&(l.ordinal&&R.indexOf(P)===0&&B.push(V+R.replace(P,this.options.pluralSeparator)),B.push(V+R),N&&B.push(V+_))}}let D;for(;D=B.pop();)this.isValidLookup(o)||(u=D,o=this.getResource(T,C,D,l))}))})}),{res:o,usedKey:c,exactUsedKey:u,usedLng:m,usedNS:g}}isValidLookup(n){return n!==void 0&&!(!this.options.returnNull&&n===null)&&!(!this.options.returnEmptyString&&n==="")}getResource(n,l,o,c={}){var u;return(u=this.i18nFormat)!=null&&u.getResource?this.i18nFormat.getResource(n,l,o,c):this.resourceStore.getResource(n,l,o,c)}getUsedParamsDetails(n={}){const l=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=n.replace&&!De(n.replace);let c=o?n.replace:n;if(o&&typeof n.count<"u"&&(c.count=n.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const u of l)delete c[u]}return c}static hasDefaultValue(n){const l="defaultValue";for(const o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&l===o.substring(0,l.length)&&n[o]!==void 0)return!0;return!1}}class Ah{constructor(n){this.options=n,this.supportedLngs=this.options.supportedLngs||!1,this.logger=na.create("languageUtils")}getScriptPartFromCode(n){if(n=Tl(n),!n||n.indexOf("-")<0)return null;const l=n.split("-");return l.length===2||(l.pop(),l[l.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(l.join("-"))}getLanguagePartFromCode(n){if(n=Tl(n),!n||n.indexOf("-")<0)return n;const l=n.split("-");return this.formatLanguageCode(l[0])}formatLanguageCode(n){if(De(n)&&n.indexOf("-")>-1){let l;try{l=Intl.getCanonicalLocales(n)[0]}catch{}return l&&this.options.lowerCaseLng&&(l=l.toLowerCase()),l||(this.options.lowerCaseLng?n.toLowerCase():n)}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}isSupportedCode(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}getBestMatchFromCodes(n){if(!n)return null;let l;return n.forEach(o=>{if(l)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(l=c)}),!l&&this.options.supportedLngs&&n.forEach(o=>{if(l)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return l=c;const u=this.getLanguagePartFromCode(o);if(this.isSupportedCode(u))return l=u;l=this.options.supportedLngs.find(m=>{if(m===u)return m;if(!(m.indexOf("-")<0&&u.indexOf("-")<0)&&(m.indexOf("-")>0&&u.indexOf("-")<0&&m.substring(0,m.indexOf("-"))===u||m.indexOf(u)===0&&u.length>1))return m})}),l||(l=this.getFallbackCodes(this.options.fallbackLng)[0]),l}getFallbackCodes(n,l){if(!n)return[];if(typeof n=="function"&&(n=n(l)),De(n)&&(n=[n]),Array.isArray(n))return n;if(!l)return n.default||[];let o=n[l];return o||(o=n[this.getScriptPartFromCode(l)]),o||(o=n[this.formatLanguageCode(l)]),o||(o=n[this.getLanguagePartFromCode(l)]),o||(o=n.default),o||[]}toResolveHierarchy(n,l){const o=this.getFallbackCodes((l===!1?[]:l)||this.options.fallbackLng||[],n),c=[],u=m=>{m&&(this.isSupportedCode(m)?c.push(m):this.logger.warn(`rejecting language code not found in supportedLngs: ${m}`))};return De(n)&&(n.indexOf("-")>-1||n.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):De(n)&&u(this.formatLanguageCode(n)),o.forEach(m=>{c.indexOf(m)<0&&u(this.formatLanguageCode(m))}),c}}const Eh={zero:0,one:1,two:2,few:3,many:4,other:5},Rh={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class ek{constructor(n,l={}){this.languageUtils=n,this.options=l,this.logger=na.create("pluralResolver"),this.pluralRulesCache={}}addRule(n,l){this.rules[n]=l}clearCache(){this.pluralRulesCache={}}getRule(n,l={}){const o=Tl(n==="dev"?"en":n),c=l.ordinal?"ordinal":"cardinal",u=JSON.stringify({cleanedCode:o,type:c});if(u in this.pluralRulesCache)return this.pluralRulesCache[u];let m;try{m=new Intl.PluralRules(o,{type:c})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Rh;if(!n.match(/-|_/))return Rh;const f=this.languageUtils.getLanguagePartFromCode(n);m=this.getRule(f,l)}return this.pluralRulesCache[u]=m,m}needsPlural(n,l={}){let o=this.getRule(n,l);return o||(o=this.getRule("dev",l)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(n,l,o={}){return this.getSuffixes(n,o).map(c=>`${l}${c}`)}getSuffixes(n,l={}){let o=this.getRule(n,l);return o||(o=this.getRule("dev",l)),o?o.resolvedOptions().pluralCategories.sort((c,u)=>Eh[c]-Eh[u]).map(c=>`${this.options.prepend}${l.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(n,l,o={}){const c=this.getRule(n,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(l)}`:(this.logger.warn(`no plural rule found for: ${n}`),this.getSuffix("dev",l,o))}}const Th=(a,n,l,o=".",c=!0)=>{let u=KN(a,n,l);return!u&&c&&De(l)&&(u=hd(a,l,o),u===void 0&&(u=hd(n,l,o))),u},td=a=>a.replace(/\$/g,"$$$$");class tk{constructor(n={}){var l;this.logger=na.create("interpolator"),this.options=n,this.format=((l=n==null?void 0:n.interpolation)==null?void 0:l.format)||(o=>o),this.init(n)}init(n={}){n.interpolation||(n.interpolation={escapeValue:!0});const{escape:l,escapeValue:o,useRawValueToEscape:c,prefix:u,prefixEscaped:m,suffix:g,suffixEscaped:f,formatSeparator:h,unescapeSuffix:b,unescapePrefix:y,nestingPrefix:w,nestingPrefixEscaped:N,nestingSuffix:S,nestingSuffixEscaped:j,nestingOptionsSeparator:C,maxReplaces:z,alwaysFormat:E}=n.interpolation;this.escape=l!==void 0?l:$N,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=u?yn(u):m||"{{",this.suffix=g?yn(g):f||"}}",this.formatSeparator=h||",",this.unescapePrefix=b?"":y||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=w?yn(w):N||yn("$t("),this.nestingSuffix=S?yn(S):j||yn(")"),this.nestingOptionsSeparator=C||",",this.maxReplaces=z||1e3,this.alwaysFormat=E!==void 0?E:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const n=(l,o)=>(l==null?void 0:l.source)===o?(l.lastIndex=0,l):new RegExp(o,"g");this.regexp=n(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=n(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=n(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(n,l,o,c){var N;let u,m,g;const f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},h=S=>{if(S.indexOf(this.formatSeparator)<0){const E=Th(l,f,S,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,o,{...c,...l,interpolationkey:S}):E}const j=S.split(this.formatSeparator),C=j.shift().trim(),z=j.join(this.formatSeparator).trim();return this.format(Th(l,f,C,this.options.keySeparator,this.options.ignoreJSONStructure),z,o,{...c,...l,interpolationkey:C})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,y=((N=c==null?void 0:c.interpolation)==null?void 0:N.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:S=>td(S)},{regex:this.regexp,safeValue:S=>this.escapeValue?td(this.escape(S)):td(S)}].forEach(S=>{for(g=0;u=S.regex.exec(n);){const j=u[1].trim();if(m=h(j),m===void 0)if(typeof b=="function"){const z=b(n,u,c);m=De(z)?z:""}else if(c&&Object.prototype.hasOwnProperty.call(c,j))m="";else if(y){m=u[0];continue}else this.logger.warn(`missed to pass in variable ${j} for interpolating ${n}`),m="";else!De(m)&&!this.useRawValueToEscape&&(m=wh(m));const C=S.safeValue(m);if(n=n.replace(u[0],C),y?(S.regex.lastIndex+=m.length,S.regex.lastIndex-=u[0].length):S.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),n}nest(n,l,o={}){let c,u,m;const g=(f,h)=>{const b=this.nestingOptionsSeparator;if(f.indexOf(b)<0)return f;const y=f.split(new RegExp(`${b}[ ]*{`));let w=`{${y[1]}`;f=y[0],w=this.interpolate(w,m);const N=w.match(/'/g),S=w.match(/"/g);(((N==null?void 0:N.length)??0)%2===0&&!S||S.length%2!==0)&&(w=w.replace(/'/g,'"'));try{m=JSON.parse(w),h&&(m={...h,...m})}catch(j){return this.logger.warn(`failed parsing options string in nesting for key ${f}`,j),`${f}${b}${w}`}return m.defaultValue&&m.defaultValue.indexOf(this.prefix)>-1&&delete m.defaultValue,f};for(;c=this.nestingRegexp.exec(n);){let f=[];m={...o},m=m.replace&&!De(m.replace)?m.replace:m,m.applyPostProcessor=!1,delete m.defaultValue;const h=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(h!==-1&&(f=c[1].slice(h).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,h)),u=l(g.call(this,c[1].trim(),m),m),u&&c[0]===n&&!De(u))return u;De(u)||(u=wh(u)),u||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${n}`),u=""),f.length&&(u=f.reduce((b,y)=>this.format(b,y,o.lng,{...o,interpolationkey:c[1].trim()}),u.trim())),n=n.replace(c[0],u),this.regexp.lastIndex=0}return n}}const rk=a=>{let n=a.toLowerCase().trim();const l={};if(a.indexOf("(")>-1){const o=a.split("(");n=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);n==="currency"&&c.indexOf(":")<0?l.currency||(l.currency=c.trim()):n==="relativetime"&&c.indexOf(":")<0?l.range||(l.range=c.trim()):c.split(";").forEach(m=>{if(m){const[g,...f]=m.split(":"),h=f.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();l[b]||(l[b]=h),h==="false"&&(l[b]=!1),h==="true"&&(l[b]=!0),isNaN(h)||(l[b]=parseInt(h,10))}})}return{formatName:n,formatOptions:l}},Oh=a=>{const n={};return(l,o,c)=>{let u=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(u={...u,[c.interpolationkey]:void 0});const m=o+JSON.stringify(u);let g=n[m];return g||(g=a(Tl(o),c),n[m]=g),g(l)}},ak=a=>(n,l,o)=>a(Tl(l),o)(n);class sk{constructor(n={}){this.logger=na.create("formatter"),this.options=n,this.init(n)}init(n,l={interpolation:{}}){this.formatSeparator=l.interpolation.formatSeparator||",";const o=l.cacheInBuiltFormats?Oh:ak;this.formats={number:o((c,u)=>{const m=new Intl.NumberFormat(c,{...u});return g=>m.format(g)}),currency:o((c,u)=>{const m=new Intl.NumberFormat(c,{...u,style:"currency"});return g=>m.format(g)}),datetime:o((c,u)=>{const m=new Intl.DateTimeFormat(c,{...u});return g=>m.format(g)}),relativetime:o((c,u)=>{const m=new Intl.RelativeTimeFormat(c,{...u});return g=>m.format(g,u.range||"day")}),list:o((c,u)=>{const m=new Intl.ListFormat(c,{...u});return g=>m.format(g)})}}add(n,l){this.formats[n.toLowerCase().trim()]=l}addCached(n,l){this.formats[n.toLowerCase().trim()]=Oh(l)}format(n,l,o,c={}){const u=l.split(this.formatSeparator);if(u.length>1&&u[0].indexOf("(")>1&&u[0].indexOf(")")<0&&u.find(g=>g.indexOf(")")>-1)){const g=u.findIndex(f=>f.indexOf(")")>-1);u[0]=[u[0],...u.splice(1,g)].join(this.formatSeparator)}return u.reduce((g,f)=>{var y;const{formatName:h,formatOptions:b}=rk(f);if(this.formats[h]){let w=g;try{const N=((y=c==null?void 0:c.formatParams)==null?void 0:y[c.interpolationkey])||{},S=N.locale||N.lng||c.locale||c.lng||o;w=this.formats[h](g,S,{...b,...c,...N})}catch(N){this.logger.warn(N)}return w}else this.logger.warn(`there was no format function for ${h}`);return g},n)}}const nk=(a,n)=>{a.pending[n]!==void 0&&(delete a.pending[n],a.pendingCount--)};class lk extends ko{constructor(n,l,o,c={}){var u,m;super(),this.backend=n,this.store=l,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=na.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(m=(u=this.backend)==null?void 0:u.init)==null||m.call(u,o,c.backend,c)}queueLoad(n,l,o,c){const u={},m={},g={},f={};return n.forEach(h=>{let b=!0;l.forEach(y=>{const w=`${h}|${y}`;!o.reload&&this.store.hasResourceBundle(h,y)?this.state[w]=2:this.state[w]<0||(this.state[w]===1?m[w]===void 0&&(m[w]=!0):(this.state[w]=1,b=!1,m[w]===void 0&&(m[w]=!0),u[w]===void 0&&(u[w]=!0),f[y]===void 0&&(f[y]=!0)))}),b||(g[h]=!0)}),(Object.keys(u).length||Object.keys(m).length)&&this.queue.push({pending:m,pendingCount:Object.keys(m).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(u),pending:Object.keys(m),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(f)}}loaded(n,l,o){const c=n.split("|"),u=c[0],m=c[1];l&&this.emit("failedLoading",u,m,l),!l&&o&&this.store.addResourceBundle(u,m,o,void 0,void 0,{skipCopy:!0}),this.state[n]=l?-1:2,l&&o&&(this.state[n]=0);const g={};this.queue.forEach(f=>{GN(f.loaded,[u],m),nk(f,n),l&&f.errors.push(l),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(h=>{g[h]||(g[h]={});const b=f.loaded[h];b.length&&b.forEach(y=>{g[h][y]===void 0&&(g[h][y]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(f=>!f.done)}read(n,l,o,c=0,u=this.retryTimeout,m){if(!n.length)return m(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:n,ns:l,fcName:o,tried:c,wait:u,callback:m});return}this.readingCalls++;const g=(h,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const y=this.waitingReads.shift();this.read(y.lng,y.ns,y.fcName,y.tried,y.wait,y.callback)}if(h&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,n,l,o,c+1,u*2,m)},u);return}m(h,b)},f=this.backend[o].bind(this.backend);if(f.length===2){try{const h=f(n,l);h&&typeof h.then=="function"?h.then(b=>g(null,b)).catch(g):g(null,h)}catch(h){g(h)}return}return f(n,l,g)}prepareLoading(n,l,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();De(n)&&(n=this.languageUtils.toResolveHierarchy(n)),De(l)&&(l=[l]);const u=this.queueLoad(n,l,o,c);if(!u.toLoad.length)return u.pending.length||c(),null;u.toLoad.forEach(m=>{this.loadOne(m)})}load(n,l,o){this.prepareLoading(n,l,{},o)}reload(n,l,o){this.prepareLoading(n,l,{reload:!0},o)}loadOne(n,l=""){const o=n.split("|"),c=o[0],u=o[1];this.read(c,u,"read",void 0,void 0,(m,g)=>{m&&this.logger.warn(`${l}loading namespace ${u} for language ${c} failed`,m),!m&&g&&this.logger.log(`${l}loaded namespace ${u} for language ${c}`,g),this.loaded(n,m,g)})}saveMissing(n,l,o,c,u,m={},g=()=>{}){var f,h,b,y,w;if((h=(f=this.services)==null?void 0:f.utils)!=null&&h.hasLoadedNamespace&&!((y=(b=this.services)==null?void 0:b.utils)!=null&&y.hasLoadedNamespace(l))){this.logger.warn(`did not save key "${o}" as the namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if((w=this.backend)!=null&&w.create){const N={...m,isUpdate:u},S=this.backend.create.bind(this.backend);if(S.length<6)try{let j;S.length===5?j=S(n,l,o,c,N):j=S(n,l,o,c),j&&typeof j.then=="function"?j.then(C=>g(null,C)).catch(g):g(null,j)}catch(j){g(j)}else S(n,l,o,c,g,N)}!n||!n[0]||this.store.addResource(n[0],l,o,c)}}}const zh=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:a=>{let n={};if(typeof a[1]=="object"&&(n=a[1]),De(a[1])&&(n.defaultValue=a[1]),De(a[2])&&(n.tDescription=a[2]),typeof a[2]=="object"||typeof a[3]=="object"){const l=a[3]||a[2];Object.keys(l).forEach(o=>{n[o]=l[o]})}return n},interpolation:{escapeValue:!0,format:a=>a,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Mh=a=>{var n,l;return De(a.ns)&&(a.ns=[a.ns]),De(a.fallbackLng)&&(a.fallbackLng=[a.fallbackLng]),De(a.fallbackNS)&&(a.fallbackNS=[a.fallbackNS]),((l=(n=a.supportedLngs)==null?void 0:n.indexOf)==null?void 0:l.call(n,"cimode"))<0&&(a.supportedLngs=a.supportedLngs.concat(["cimode"])),typeof a.initImmediate=="boolean"&&(a.initAsync=a.initImmediate),a},so=()=>{},ik=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(l=>{typeof a[l]=="function"&&(a[l]=a[l].bind(a))})};class Ol extends ko{constructor(n={},l){if(super(),this.options=Mh(n),this.services={},this.logger=na,this.modules={external:[]},ik(this),l&&!this.isInitialized&&!n.isClone){if(!this.options.initAsync)return this.init(n,l),this;setTimeout(()=>{this.init(n,l)},0)}}init(n={},l){this.isInitializing=!0,typeof n=="function"&&(l=n,n={}),n.defaultNS==null&&n.ns&&(De(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=zh();this.options={...o,...this.options,...Mh(n)},this.options.interpolation={...o.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const c=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?na.init(c(this.modules.logger),this.options):na.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=sk;const b=new Ah(this.options);this.store=new kh(this.options.resources,this.options);const y=this.services;y.logger=na,y.resourceStore=this.store,y.languageUtils=b,y.pluralResolver=new ek(b,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),h&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(y.formatter=c(h),y.formatter.init&&y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new tk(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new lk(c(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",(N,...S)=>{this.emit(N,...S)}),this.modules.languageDetector&&(y.languageDetector=c(this.modules.languageDetector),y.languageDetector.init&&y.languageDetector.init(y,this.options.detection,this.options)),this.modules.i18nFormat&&(y.i18nFormat=c(this.modules.i18nFormat),y.i18nFormat.init&&y.i18nFormat.init(this)),this.translator=new yo(this.services,this.options),this.translator.on("*",(N,...S)=>{this.emit(N,...S)}),this.modules.external.forEach(N=>{N.init&&N.init(this)})}if(this.format=this.options.interpolation.format,l||(l=so),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(h=>{this[h]=(...b)=>this.store[h](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=(...b)=>(this.store[h](...b),this)});const g=Al(),f=()=>{const h=(b,y)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(y),l(b,y)};if(this.languages&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?f():setTimeout(f,0),g}loadResources(n,l=so){var u,m;let o=l;const c=De(n)?n:this.language;if(typeof n=="function"&&(o=n),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],f=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(y=>{y!=="cimode"&&g.indexOf(y)<0&&g.push(y)})};c?f(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>f(b)),(m=(u=this.options.preload)==null?void 0:u.forEach)==null||m.call(u,h=>f(h)),this.services.backendConnector.load(g,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(h)})}else o(null)}reloadResources(n,l,o){const c=Al();return typeof n=="function"&&(o=n,n=void 0),typeof l=="function"&&(o=l,l=void 0),n||(n=this.languages),l||(l=this.options.ns),o||(o=so),this.services.backendConnector.reload(n,l,u=>{c.resolve(),o(u)}),c}use(n){if(!n)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!n.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return n.type==="backend"&&(this.modules.backend=n),(n.type==="logger"||n.log&&n.warn&&n.error)&&(this.modules.logger=n),n.type==="languageDetector"&&(this.modules.languageDetector=n),n.type==="i18nFormat"&&(this.modules.i18nFormat=n),n.type==="postProcessor"&&ix.addPostProcessor(n),n.type==="formatter"&&(this.modules.formatter=n),n.type==="3rdParty"&&this.modules.external.push(n),this}setResolvedLanguage(n){if(!(!n||!this.languages)&&!(["cimode","dev"].indexOf(n)>-1)){for(let l=0;l<this.languages.length;l++){const o=this.languages[l];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(n)<0&&this.store.hasLanguageSomeTranslations(n)&&(this.resolvedLanguage=n,this.languages.unshift(n))}}changeLanguage(n,l){this.isLanguageChangingTo=n;const o=Al();this.emit("languageChanging",n);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},u=(g,f)=>{f?this.isLanguageChangingTo===n&&(c(f),this.translator.changeLanguage(f),this.isLanguageChangingTo=void 0,this.emit("languageChanged",f),this.logger.log("languageChanged",f)):this.isLanguageChangingTo=void 0,o.resolve((...h)=>this.t(...h)),l&&l(g,(...h)=>this.t(...h))},m=g=>{var b,y;!n&&!g&&this.services.languageDetector&&(g=[]);const f=De(g)?g:g&&g[0],h=this.store.hasLanguageSomeTranslations(f)?f:this.services.languageUtils.getBestMatchFromCodes(De(g)?[g]:g);h&&(this.language||c(h),this.translator.language||this.translator.changeLanguage(h),(y=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||y.call(b,h)),this.loadResources(h,w=>{u(w,h)})};return!n&&this.services.languageDetector&&!this.services.languageDetector.async?m(this.services.languageDetector.detect()):!n&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(m):this.services.languageDetector.detect(m):m(n),o}getFixedT(n,l,o){const c=(u,m,...g)=>{let f;typeof m!="object"?f=this.options.overloadTranslationOptionHandler([u,m].concat(g)):f={...m},f.lng=f.lng||c.lng,f.lngs=f.lngs||c.lngs,f.ns=f.ns||c.ns,f.keyPrefix!==""&&(f.keyPrefix=f.keyPrefix||o||c.keyPrefix);const h=this.options.keySeparator||".";let b;return f.keyPrefix&&Array.isArray(u)?b=u.map(y=>(typeof y=="function"&&(y=xd(y,{...this.options,...m})),`${f.keyPrefix}${h}${y}`)):(typeof u=="function"&&(u=xd(u,{...this.options,...m})),b=f.keyPrefix?`${f.keyPrefix}${h}${u}`:u),this.t(b,f)};return De(n)?c.lng=n:c.lngs=n,c.ns=l,c.keyPrefix=o,c}t(...n){var l;return(l=this.translator)==null?void 0:l.translate(...n)}exists(...n){var l;return(l=this.translator)==null?void 0:l.exists(...n)}setDefaultNamespace(n){this.options.defaultNS=n}hasLoadedNamespace(n,l={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=l.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const m=(g,f)=>{const h=this.services.backendConnector.state[`${g}|${f}`];return h===-1||h===0||h===2};if(l.precheck){const g=l.precheck(this,m);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,n)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||m(o,n)&&(!c||m(u,n)))}loadNamespaces(n,l){const o=Al();return this.options.ns?(De(n)&&(n=[n]),n.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),l&&l(c)}),o):(l&&l(),Promise.resolve())}loadLanguages(n,l){const o=Al();De(n)&&(n=[n]);const c=this.options.preload||[],u=n.filter(m=>c.indexOf(m)<0&&this.services.languageUtils.isSupportedCode(m));return u.length?(this.options.preload=c.concat(u),this.loadResources(m=>{o.resolve(),l&&l(m)}),o):(l&&l(),Promise.resolve())}dir(n){var c,u;if(n||(n=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!n)return"rtl";try{const m=new Intl.Locale(n);if(m&&m.getTextInfo){const g=m.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const l=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=((u=this.services)==null?void 0:u.languageUtils)||new Ah(zh());return n.toLowerCase().indexOf("-latn")>1?"ltr":l.indexOf(o.getLanguagePartFromCode(n))>-1||n.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(n={},l){return new Ol(n,l)}cloneInstance(n={},l=so){const o=n.forkResourceStore;o&&delete n.forkResourceStore;const c={...this.options,...n,isClone:!0},u=new Ol(c);if((n.debug!==void 0||n.prefix!==void 0)&&(u.logger=u.logger.clone(n)),["store","services","language"].forEach(g=>{u[g]=this[g]}),u.services={...this.services},u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},o){const g=Object.keys(this.store.data).reduce((f,h)=>(f[h]={...this.store.data[h]},f[h]=Object.keys(f[h]).reduce((b,y)=>(b[y]={...f[h][y]},b),f[h]),f),{});u.store=new kh(g,c),u.services.resourceStore=u.store}return u.translator=new yo(u.services,c),u.translator.on("*",(g,...f)=>{u.emit(g,...f)}),u.init(c,l),u.translator.options=c,u.translator.backendConnector.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const er=Ol.createInstance();er.createInstance=Ol.createInstance;er.createInstance;er.dir;er.init;er.loadResources;er.reloadResources;er.use;er.changeLanguage;er.getFixedT;er.t;er.exists;er.setDefaultNamespace;er.hasLoadedNamespace;er.loadNamespaces;er.loadLanguages;const{slice:ok,forEach:ck}=[];function uk(a){return ck.call(ok.call(arguments,1),n=>{if(n)for(const l in n)a[l]===void 0&&(a[l]=n[l])}),a}function dk(a){return typeof a!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(l=>l.test(a))}const Ph=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,mk=function(a,n){const o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},c=encodeURIComponent(n);let u=`${a}=${c}`;if(o.maxAge>0){const m=o.maxAge-0;if(Number.isNaN(m))throw new Error("maxAge should be a Number");u+=`; Max-Age=${Math.floor(m)}`}if(o.domain){if(!Ph.test(o.domain))throw new TypeError("option domain is invalid");u+=`; Domain=${o.domain}`}if(o.path){if(!Ph.test(o.path))throw new TypeError("option path is invalid");u+=`; Path=${o.path}`}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");u+=`; Expires=${o.expires.toUTCString()}`}if(o.httpOnly&&(u+="; HttpOnly"),o.secure&&(u+="; Secure"),o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"strict":u+="; SameSite=Strict";break;case"none":u+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o.partitioned&&(u+="; Partitioned"),u},Dh={create(a,n,l,o){let c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};l&&(c.expires=new Date,c.expires.setTime(c.expires.getTime()+l*60*1e3)),o&&(c.domain=o),document.cookie=mk(a,n,c)},read(a){const n=`${a}=`,l=document.cookie.split(";");for(let o=0;o<l.length;o++){let c=l[o];for(;c.charAt(0)===" ";)c=c.substring(1,c.length);if(c.indexOf(n)===0)return c.substring(n.length,c.length)}return null},remove(a,n){this.create(a,"",-1,n)}};var pk={name:"cookie",lookup(a){let{lookupCookie:n}=a;if(n&&typeof document<"u")return Dh.read(n)||void 0},cacheUserLanguage(a,n){let{lookupCookie:l,cookieMinutes:o,cookieDomain:c,cookieOptions:u}=n;l&&typeof document<"u"&&Dh.create(l,a,o,c,u)}},gk={name:"querystring",lookup(a){var o;let{lookupQuerystring:n}=a,l;if(typeof window<"u"){let{search:c}=window.location;!window.location.search&&((o=window.location.hash)==null?void 0:o.indexOf("?"))>-1&&(c=window.location.hash.substring(window.location.hash.indexOf("?")));const m=c.substring(1).split("&");for(let g=0;g<m.length;g++){const f=m[g].indexOf("=");f>0&&m[g].substring(0,f)===n&&(l=m[g].substring(f+1))}}return l}},fk={name:"hash",lookup(a){var c;let{lookupHash:n,lookupFromHashIndex:l}=a,o;if(typeof window<"u"){const{hash:u}=window.location;if(u&&u.length>2){const m=u.substring(1);if(n){const g=m.split("&");for(let f=0;f<g.length;f++){const h=g[f].indexOf("=");h>0&&g[f].substring(0,h)===n&&(o=g[f].substring(h+1))}}if(o)return o;if(!o&&l>-1){const g=u.match(/\/([a-zA-Z-]*)/g);return Array.isArray(g)?(c=g[typeof l=="number"?l:0])==null?void 0:c.replace("/",""):void 0}}}return o}};let bn=null;const Lh=()=>{if(bn!==null)return bn;try{if(bn=typeof window<"u"&&window.localStorage!==null,!bn)return!1;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{bn=!1}return bn};var hk={name:"localStorage",lookup(a){let{lookupLocalStorage:n}=a;if(n&&Lh())return window.localStorage.getItem(n)||void 0},cacheUserLanguage(a,n){let{lookupLocalStorage:l}=n;l&&Lh()&&window.localStorage.setItem(l,a)}};let vn=null;const Uh=()=>{if(vn!==null)return vn;try{if(vn=typeof window<"u"&&window.sessionStorage!==null,!vn)return!1;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{vn=!1}return vn};var xk={name:"sessionStorage",lookup(a){let{lookupSessionStorage:n}=a;if(n&&Uh())return window.sessionStorage.getItem(n)||void 0},cacheUserLanguage(a,n){let{lookupSessionStorage:l}=n;l&&Uh()&&window.sessionStorage.setItem(l,a)}},yk={name:"navigator",lookup(a){const n=[];if(typeof navigator<"u"){const{languages:l,userLanguage:o,language:c}=navigator;if(l)for(let u=0;u<l.length;u++)n.push(l[u]);o&&n.push(o),c&&n.push(c)}return n.length>0?n:void 0}},bk={name:"htmlTag",lookup(a){let{htmlTag:n}=a,l;const o=n||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(l=o.getAttribute("lang")),l}},vk={name:"path",lookup(a){var c;let{lookupFromPathIndex:n}=a;if(typeof window>"u")return;const l=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(l)?(c=l[typeof n=="number"?n:0])==null?void 0:c.replace("/",""):void 0}},wk={name:"subdomain",lookup(a){var c,u;let{lookupFromSubdomainIndex:n}=a;const l=typeof n=="number"?n+1:1,o=typeof window<"u"&&((u=(c=window.location)==null?void 0:c.hostname)==null?void 0:u.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(o)return o[l]}};let cx=!1;try{document.cookie,cx=!0}catch{}const ux=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];cx||ux.splice(1,1);const jk=()=>({order:ux,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a});class dx{constructor(n){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(n,l)}init(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=uk(l,this.options||{},jk()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=c=>c.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(pk),this.addDetector(gk),this.addDetector(hk),this.addDetector(xk),this.addDetector(yk),this.addDetector(bk),this.addDetector(vk),this.addDetector(wk),this.addDetector(fk)}addDetector(n){return this.detectors[n.name]=n,this}detect(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,l=[];return n.forEach(o=>{if(this.detectors[o]){let c=this.detectors[o].lookup(this.options);c&&typeof c=="string"&&(c=[c]),c&&(l=l.concat(c))}}),l=l.filter(o=>o!=null&&!dk(o)).map(o=>this.options.convertDetectedLanguage(o)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?l:l.length>0?l[0]:null}cacheUserLanguage(n){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;l&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||l.forEach(o=>{this.detectors[o]&&this.detectors[o].cacheUserLanguage(n,this.options)}))}}dx.type="languageDetector";const Sk={title:"MCPHub Dashboard",error:"Error",closeButton:"Close",noServers:"No MCP servers available",loading:"Loading...",logout:"Logout",profile:"Profile",changePassword:"Change Password",toggleSidebar:"Toggle Sidebar",welcomeUser:"Welcome, {{username}}",name:"MCPHub",embeddingSyncProgress:"Embeddings for {{serverName}}",embeddingSyncProgressAriaLabel:"Creating embeddings for {{serverName}}: {{current}} of {{total}} completed"},Nk={title:"About",versionInfo:"MCPHub Version: {{version}}",newVersion:"New version available!",currentVersion:"Current version",newVersionAvailable:"New version {{version}} is available",viewOnGitHub:"View on GitHub",checkForUpdates:"Check for Updates",checking:"Checking for updates..."},kk={viewProfile:"View profile",userCenter:"User Center"},Ck={label:"Sponsor",title:"Support the Project",rewardAlt:"Reward QR Code",supportMessage:"Support the development of MCPHub by buying me a coffee!",supportButton:"Support on Ko-fi"},Ak={label:"WeChat",title:"Connect via WeChat",qrCodeAlt:"WeChat QR Code",scanMessage:"Scan this QR code to connect with us on WeChat"},Ek={label:"Discord",title:"Join our Discord server",community:"Join our growing community on Discord for support, discussions, and updates!"},Rk={title:"Theme",light:"Light",dark:"Dark",system:"System"},Tk={login:"Login",loginTitle:"Login to MCPHub",slogan:"The Unified Hub for MCP Servers",subtitle:"Centralized management platform for Model Context Protocol servers. Organize, monitor, and scale multiple MCP servers with flexible routing strategies.",username:"Username",password:"Password",loggingIn:"Logging in...",orContinue:"Or continue with",loginWithGoogle:"Continue with Google",loginWithGithub:"Continue with GitHub",socialLoginFailed:"Social login failed. Please try again.",emptyFields:"Username and password cannot be empty",loginFailed:"Login failed, please check your username and password",loginError:"An error occurred during login",serverUnavailable:"Unable to connect to the server. Please check your network connection or try again later",currentPassword:"Current Password",newPassword:"New Password",confirmPassword:"Confirm Password",passwordsNotMatch:"New password and confirmation do not match",changePasswordSuccess:"Password changed successfully",changePasswordError:"Failed to change password",changePassword:"Change Password",passwordChanged:"Password changed successfully",passwordChangeError:"Failed to change password",defaultPasswordWarning:"Default Password Security Warning",defaultPasswordMessage:"You are using the default password (admin123), which poses a security risk. Please change your password immediately to protect your account.",goToSettings:"Go to Settings",passwordStrengthError:"Password does not meet security requirements",passwordMinLength:"Password must be at least 8 characters long",passwordRequireLetter:"Password must contain at least one letter",passwordRequireNumber:"Password must contain at least one number",passwordRequireSpecial:"Password must contain at least one special character",passwordStrengthHint:"Password must be at least 8 characters and contain letters, numbers, and special characters"},Ok={addServer:"Add Server",add:"Add",edit:"Edit",copy:"Copy",delete:"Delete",confirmDelete:"Are you sure you want to delete this server?",deleteWarning:"Deleting server '{{name}}' will remove it and all its data. This action cannot be undone.",status:"Status",tools:"Tools",prompts:"Prompts",name:"Server Name",description:"Server Note",descriptionPlaceholder:"Optional note to describe this server",url:"Server URL",apiKey:"API Key",save:"Save",cancel:"Cancel",invalidConfig:"Could not find configuration data for {{serverName}}",addError:"Failed to add server",editError:"Failed to edit server {{serverName}}",deleteError:"Failed to delete server {{serverName}}",updateError:"Failed to update server",editTitle:"Edit Server: {{serverName}}",type:"Server Type",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"Streamable HTTP",typeOpenapi:"OpenAPI",command:"Command",arguments:"Arguments",envVars:"Environment Variables",headers:"HTTP Headers",key:"key",value:"value",enabled:"Enabled",enable:"Enable",disable:"Disable",reload:"Reload",reloadSuccess:"Server reloaded successfully",reloadError:"Failed to reload server {{serverName}}",requestOptions:"Connection Configuration",timeout:"Request Timeout",timeoutDescription:"Timeout for requests to the MCP server (ms)",maxTotalTimeout:"Maximum Total Timeout",maxTotalTimeoutDescription:"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",resetTimeoutOnProgress:"Reset Timeout on Progress",resetTimeoutOnProgressDescription:"Reset timeout on progress notifications (enabled by default)",keepAlive:"Keep-Alive Configuration",enableKeepAlive:"Enable Keep-Alive",keepAliveDescription:"Send periodic ping requests to maintain the connection. Useful for long-running connections that may timeout.",keepAliveInterval:"Interval (ms)",keepAliveIntervalDescription:"Time between keep-alive pings in milliseconds (default: 60000ms = 1 minute)",remove:"Remove",toggleError:"Failed to toggle server {{serverName}}",alreadyExists:"Server {{serverName}} already exists",invalidData:"Invalid server data provided",notFound:"Server {{serverName}} not found",namePlaceholder:"Enter server name",urlPlaceholder:"Enter server URL",commandPlaceholder:"Enter command",argumentsPlaceholder:"Enter arguments",errorDetails:"Error Details",viewErrorDetails:"View error details",copyConfig:"Copy Configuration",confirmVariables:"Confirm Variable Configuration",variablesDetected:"Variables detected in configuration. Please confirm these variables are properly configured:",detectedVariables:"Detected Variables",confirmVariablesMessage:"Please ensure these variables are properly defined in your runtime environment. Continue adding server?",confirmAndAdd:"Confirm and Add",openapi:{inputMode:"Input Mode",inputModeUrl:"Specification URL",inputModeSchema:"JSON Schema",specUrl:"OpenAPI Specification URL",schema:"OpenAPI JSON Schema",schemaHelp:"Paste your complete OpenAPI JSON schema here",security:"Security Type",securityNone:"None",securityApiKey:"API Key",securityHttp:"HTTP Authentication",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API Key Configuration",apiKeyName:"Header/Parameter Name",apiKeyIn:"Location",apiKeyValue:"API Key Value",httpAuthConfig:"HTTP Authentication Configuration",httpScheme:"Authentication Scheme",httpCredentials:"Credentials",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 Configuration",oauth2Token:"Access Token",openIdConnectConfig:"OpenID Connect Configuration",openIdConnectUrl:"Discovery URL",openIdConnectToken:"ID Token",apiKeyInHeader:"Header",apiKeyInQuery:"Query",apiKeyInCookie:"Cookie",passthroughHeaders:"Passthrough Headers",passthroughHeadersHelp:"Comma-separated list of header names to pass through from incoming MCP requests to upstream server requests (e.g., Authorization, X-API-Key)"},oauth:{sectionTitle:"OAuth Configuration",sectionDescription:"Configure client credentials for OAuth-protected servers (optional).",clientId:"Client ID",clientSecret:"Client Secret",authorizationEndpoint:"Authorization Endpoint",tokenEndpoint:"Token Endpoint",scopes:"Scopes",scopesPlaceholder:"scope1 scope2",resource:"Resource / Audience",accessToken:"Access Token",refreshToken:"Refresh Token"}},zk={online:"Online",offline:"Offline",connecting:"Connecting",oauthRequired:"OAuth Required",clickToAuthorize:"Click to authorize with OAuth",oauthWindowOpened:"OAuth authorization window opened. Please complete the authorization."},Mk={general:"Something went wrong",network:"Network connection error. Please check your internet connection",serverConnection:"Unable to connect to the server. Please check if the server is running",serverAdd:"Failed to add server. Please check the server status",serverUpdate:"Failed to edit server {{serverName}}. Please check the server status",serverFetch:"Failed to retrieve server data. Please try again later",initialStartup:"The server might be starting up. Please wait a moment as this process can take some time on first launch...",serverInstall:"Failed to install server",failedToFetchSettings:"Failed to fetch settings",failedToUpdateRouteConfig:"Failed to update route configuration",failedToUpdateSmartRoutingConfig:"Failed to update smart routing configuration"},Pk={processing:"Processing...",save:"Save",cancel:"Cancel",back:"Back",refresh:"Refresh",search:"Search",clear:"Clear",view:"View",create:"Create",creating:"Creating...",update:"Update",updating:"Updating...",submitting:"Submitting...",delete:"Delete",remove:"Remove",copy:"Copy",copyId:"Copy ID",copyUrl:"Copy URL",copyJson:"Copy JSON",copySuccess:"Copied to clipboard",copyFailed:"Copy failed",copied:"Copied",close:"Close",confirm:"Confirm",language:"Language",true:"True",false:"False",dismiss:"Dismiss",github:"GitHub",wechat:"WeChat",discord:"Discord",required:"Required",itemsPerPage:"Items per page",showing:"Showing {{start}}-{{end}} of {{total}}",previous:"Previous",next:"Next",secret:"Secret",default:"Default",value:"Value",type:"Type",repeated:"Repeated",valueHint:"Value Hint",choices:"Choices",actions:"Actions",saving:"Saving...",active:"Active",inactive:"Inactive"},Dk={rowsPerPage:"Rows per page",showing:"Showing {{from}}-{{to}} of {{total}}"},Lk={dashboard:"Dashboard",servers:"Servers",groups:"Groups",prompts:"Prompts",resources:"Resources",users:"Users",settings:"Settings",changePassword:"Change Password",market:"Market",cloud:"Cloud Market",logs:"Logs",activity:"Activity"},Uk={dashboard:{title:"Dashboard",totalServers:"Total",onlineServers:"Online",disabledServers:"Disabled",offlineServers:"Offline",connectingServers:"Connecting",recentServers:"Recent Servers"},servers:{title:"Server Management"},groups:{title:"Group Management"},prompts:{title:"Built-in Prompts"},resources:{title:"Built-in Resources"},users:{title:"User Management"},settings:{title:"Settings",language:"Language",account:"Account Settings",password:"Change Password",appearance:"Appearance",routeConfig:"Security",installConfig:"Installation",smartRouting:"Smart Routing",oauthServer:"OAuth Server"},market:{title:"Market Hub - Local and Cloud Markets"},logs:{title:"System Logs"}},_k={filters:"Filters",search:"Search logs...",autoScroll:"Auto-scroll",clearLogs:"Clear logs",loading:"Loading logs...",noLogs:"No logs available.",noMatch:"No logs match the current filters.",mainProcess:"Main Process",childProcess:"Child Process",main:"Main",child:"Child"},Bk={add:"Add",addNew:"Add New Group",edit:"Edit Group",delete:"Delete",confirmDelete:"Are you sure you want to delete this group?",deleteWarning:"Deleting group '{{name}}' will remove it and all its server associations. This action cannot be undone.",name:"Group Name",namePlaceholder:"Enter group name",nameRequired:"Group name is required",description:"Description",descriptionPlaceholder:"Enter group description (optional)",createError:"Failed to create group",updateError:"Failed to update group",deleteError:"Failed to delete group",serverAddError:"Failed to add server to group",serverRemoveError:"Failed to remove server from group",addServer:"Add Server to Group",selectServer:"Select a server to add",servers:"Servers in Group",remove:"Remove",noGroups:"No groups available. Create a new group to get started.",noServers:"No servers in this group.",noServerOptions:"No servers available",serverCount:"{{count}} Servers",toolSelection:"Tool Selection",promptSelection:"Prompt Selection",resourceSelection:"Resource Selection",toolsSelected:"Selected",promptsSelected:"Selected",resourcesSelected:"Selected",allTools:"All",allPrompts:"All prompts",allResources:"All resources",selectedTools:"Selected tools",selectedPrompts:"Selected prompts",selectedResources:"Selected resources",selectAll:"Select All",selectNone:"Select None",configureTools:"Configure Tools",configureCapabilities:"Configure Tools, Prompts, and Resources",previewPrompts:"[prompts: {{items}}]",previewResources:"[resources: {{items}}]",previewAllTools:"(all tools)",previewAllPrompts:"(all prompts)",previewAllResources:"(all resources)"},Ik={title:"Local Installation",official:"Official",by:"By",unknown:"Unknown",tools:"tools",search:"Search",searchPlaceholder:"Search for servers by name, category, or tags",clearFilters:"Clear",clearCategoryFilter:"",clearTagFilter:"",categories:"Categories",tags:"Tags",showTags:"Show tags",hideTags:"Hide tags",moreTags:"",noServers:"No servers found matching your search",backToList:"Back to list",install:"Install",installing:"Installing...",installed:"Installed",installServer:"Install Server: {{name}}",installSuccess:"Server {{serverName}} installed successfully",author:"Author",license:"License",repository:"Repository",examples:"Examples",arguments:"Arguments",argumentName:"Name",description:"Description",required:"Required",example:"Example",viewSchema:"View schema",fetchError:"Error fetching market servers",serverNotFound:"Server not found",searchError:"Error searching servers",filterError:"Error filtering servers by category",tagFilterError:"Error filtering servers by tag",noInstallationMethod:"No installation method available for this server",showing:"Showing {{from}}-{{to}} of {{total}} servers",perPage:"Per page",confirmVariablesMessage:"Please ensure these variables are properly defined in your runtime environment. Continue installing server?",confirmAndInstall:"Confirm and Install"},Fk={authorizeTitle:"Authorize Application",authorizeSubtitle:"Allow this application to access your MCPHub account.",buttons:{approve:"Allow access",deny:"Deny",approveSubtitle:"Recommended if you trust this application.",denySubtitle:"You can always grant access later."}},Hk={title:"Cloud Support",subtitle:"Powered by MCPRouter",by:"By",server:"Server",config:"Config",created:"Created",updated:"Updated",available:"Available",description:"Description",details:"Details",tools:"Tools",tool:"tool",toolsAvailable:"{{count}} tool available||{{count}} tools available",loadingTools:"Loading tools...",noTools:"No tools available for this server",noDescription:"No description available",viewDetails:"View Details",parameters:"Parameters",result:"Result",error:"Error",callTool:"Call",calling:"Calling...",toolCallSuccess:"Tool {{toolName}} executed successfully",toolCallError:"Failed to call tool {{toolName}}: {{error}}",viewSchema:"View Schema",backToList:"Back to Cloud Market",search:"Search",searchPlaceholder:"Search cloud servers by name, title, or author",clearFilters:"Clear Filters",clearCategoryFilter:"Clear",clearTagFilter:"Clear",categories:"Categories",tags:"Tags",noCategories:"No categories found",noTags:"No tags found",noServers:"No cloud servers found",fetchError:"Error fetching cloud servers",serverNotFound:"Cloud server not found",searchError:"Error searching cloud servers",filterError:"Error filtering cloud servers by category",tagFilterError:"Error filtering cloud servers by tag",showing:"Showing {{from}}-{{to}} of {{total}} cloud servers",perPage:"Per page",apiKeyNotConfigured:"MCPRouter API key not configured",apiKeyNotConfiguredDescription:"To use cloud servers, you need to configure your MCPRouter API key.",getApiKey:"Get API Key",configureInSettings:"Configure in Settings",installServer:"Install {{name}}",installSuccess:"Server {{name}} installed successfully",installError:"Failed to install server: {{error}}"},qk={title:"Registry",official:"Official",latest:"Latest",description:"Description",website:"Website",repository:"Repository",packages:"Packages",package:"package",remotes:"Remotes",remote:"remote",published:"Published",updated:"Updated",install:"Install",installing:"Installing...",installed:"Installed",installServer:"Install {{name}}",installSuccess:"Server {{name}} installed successfully",installError:"Failed to install server: {{error}}",noDescription:"No description available",viewDetails:"View Details",backToList:"Back to Registry",search:"Search",searchPlaceholder:"Search registry servers by name",clearFilters:"Clear",noServers:"No registry servers found",fetchError:"Error fetching registry servers",serverNotFound:"Registry server not found",showing:"Showing {{from}}-{{to}} of {{total}} registry servers",perPage:"Per page",environmentVariables:"Environment Variables",packageArguments:"Package Arguments",runtimeArguments:"Runtime Arguments",headers:"Headers"},Gk={run:"Run",running:"Running...",runTool:"Run Tool",cancel:"Cancel",noDescription:"No description available",inputSchema:"Input Schema:",runToolWithName:"Run Tool: {{name}}",execution:"Tool Execution",successful:"Successful",failed:"Failed",result:"Result:",error:"Error",errorDetails:"Error Details:",noContent:"Tool executed successfully but returned no content.",unknownError:"Unknown error occurred",jsonResponse:"JSON Response:",toolResult:"Tool result",noParameters:"This tool does not require any parameters.",selectOption:"Select an option",enterValue:"Enter {{type}} value",enabled:"Enabled",enableSuccess:"Tool {{name}} enabled successfully",disableSuccess:"Tool {{name}} disabled successfully",toggleFailed:"Failed to toggle tool status",descriptionUpdateSuccess:"Tool description updated successfully",descriptionUpdateFailed:"Failed to update tool description",restoreDefault:"Restore default",restoreDefaultSuccess:"Tool description restored to default",restoreDefaultFailed:"Failed to restore the default tool description",parameters:"Tool Parameters",formMode:"Form Mode",jsonMode:"JSON Mode",jsonConfiguration:"JSON Configuration",invalidJsonFormat:"Invalid JSON format",fixJsonBeforeSwitching:"Please fix JSON format before switching to form mode",item:"Item {{index}}",addItem:"Add {{key}} item",enterKey:"Enter {{key}}"},Kk={run:"Get",running:"Getting...",result:"Prompt Result",error:"Prompt Error",execution:"Prompt Execution",successful:"Successful",failed:"Failed",errorDetails:"Error Details:",noContent:"Prompt executed successfully but returned no content.",unknownError:"Unknown error occurred",jsonResponse:"JSON Response:",description:"Description",messages:"Messages",noDescription:"No description available",runPromptWithName:"Get Prompt: {{name}}",descriptionUpdateSuccess:"Prompt description updated successfully",descriptionUpdateFailed:"Failed to update prompt description",restoreDefault:"Restore default",restoreDefaultSuccess:"Prompt description restored to default",restoreDefaultFailed:"Failed to restore the default prompt description"},Vk={enableGlobalRoute:"Enable Global Route",enableGlobalRouteDescription:"Allow connections to /sse endpoint without specifying a group ID",enableGroupNameRoute:"Enable Group Name Route",enableGroupNameRouteDescription:"Allow connections to /sse endpoint using group names instead of just group IDs",enableBearerAuth:"Enable Bearer Authentication",enableBearerAuthDescription:"Require bearer token authentication for MCP endpoints (default on)",bearerAuthKey:"Bearer Authentication Key",bearerAuthKeyDescription:"The authentication key that will be required in the Bearer token",bearerAuthKeyPlaceholder:"Enter bearer authentication key",bearerAuthHeaderName:"Bearer Auth Header Name",bearerAuthHeaderNameDescription:"Header name used to receive MCP bearer credentials. Change this when upstream passthrough headers also use Authorization.",bearerAuthHeaderNamePlaceholder:"e.g. Authorization or X-MCP-Authorization",bearerKeysSectionTitle:"Keys",bearerKeysSectionDescription:"Manage multiple keys with different access scopes.",noBearerKeys:"No keys configured yet.",bearerKeyName:"Name",bearerKeyToken:"Token",bearerKeyEnabled:"Enabled",bearerKeyAccessType:"Access scope",bearerKeyAccessAll:"All",bearerKeyAccessGroups:"Groups",bearerKeyAccessServers:"Servers",bearerKeyAccessCustom:"Custom",bearerKeyAllowedGroups:"Allowed groups",bearerKeyAllowedServers:"Allowed servers",addBearerKey:"Add key",addBearerKeyButton:"Create",bearerKeyRequired:"Name and token are required",deleteBearerKeyConfirm:"Are you sure you want to delete this key?",generate:"Generate",selectGroups:"Select Groups",selectServers:"Select Servers",selectAtLeastOneGroup:"Please select at least one group",selectAtLeastOneServer:"Please select at least one server",skipAuth:"Skip Authentication",skipAuthDescription:"Allow dashboard access without login (does not affect MCP endpoint auth)",jsonBodyLimit:"JSON Body Size Limit",jsonBodyLimitDescription:"Express JSON request size limit. This affects large OpenAPI schema uploads as well.",jsonBodyLimitPlaceholder:"e.g. 1mb, 5mb, 1024kb",pythonIndexUrl:"Python Package Repository URL",pythonIndexUrlDescription:"Set UV_DEFAULT_INDEX environment variable for Python package installation",pythonIndexUrlPlaceholder:"e.g. https://pypi.org/simple",npmRegistry:"NPM Registry URL",npmRegistryDescription:"Set npm_config_registry environment variable for NPM package installation",npmRegistryPlaceholder:"e.g. https://registry.npmjs.org/",baseUrl:"Base URL",baseUrlDescription:"Base URL for MCP requests and OAuth callbacks",baseUrlPlaceholder:"e.g. http://localhost:3000",installConfig:"Installation",systemConfigUpdated:"System configuration updated successfully",enableSmartRouting:"Enable Smart Routing",enableSmartRoutingDescription:"Enable smart routing feature to search the most suitable tool based on input (using $smart group name)",dbUrl:"PostgreSQL URL (requires pgvector support)",dbUrlPlaceholder:"e.g. postgresql://user:password@localhost:5432/dbname",embeddingProvider:"Embedding Provider",openaiApiBaseUrl:"OpenAI-compatible Base URL",openaiApiBaseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKey:"LLM Provider API Key",openaiApiKeyPlaceholder:"Enter LLM provider API key",openaiApiEmbeddingModel:"Embedding Model Name",openaiApiEmbeddingModelPlaceholder:"text-embedding-3-small",basePacingDelayMs:"Base Pacing Delay (ms)",basePacingDelayMsDescription:"Baseline delay between embedding API requests. Defaults to 0 — the system manages rate limits automatically: it respects Retry-After headers, falls back to a 63-second cooldown, and increases the pacing delay after any 403/429 response. Set a non-zero value only if your provider enforces a fixed minimum interval between requests.",basePacingDelayMsPlaceholder:"Empty = default 0 ms",basePacingDelayMsAuto:"Default ({{value}} ms): rate limiting is managed automatically.",basePacingDelayMsZero:"0 ms (default): rate limiting is managed automatically via adaptive throttling and retry logic.",basePacingDelayMsOverride:"Custom value: overrides the default baseline pacing delay.",embeddingEncodingFormat:"Embedding Encoding Format",embeddingEncodingFormatDescription:"Encoding format for embedding vectors. Auto will detect based on provider support.",embeddingEncodingFormatAuto:"Auto (Recommended)",azureOpenaiEndpoint:"Azure OpenAI Endpoint",azureOpenaiEndpointPlaceholder:"https://YOUR_RESOURCE_NAME.openai.azure.com",azureOpenaiApiKey:"Azure OpenAI API Key",azureOpenaiApiKeyPlaceholder:"Enter Azure OpenAI API key",azureOpenaiApiVersion:"Azure OpenAI API Version",azureOpenaiApiVersionPlaceholder:"2024-02-15-preview",azureOpenaiEmbeddingDeployment:"Azure OpenAI Embedding Deployment",azureOpenaiEmbeddingDeploymentPlaceholder:"text-embedding-3-small",azureOpenaiEmbeddingModel:"Azure Embedding Model Name",azureOpenaiEmbeddingModelDescription:"The actual OpenAI model name deployed in Azure (e.g. text-embedding-3-small). Used for accurate token counting before sending text to the API.",azureOpenaiEmbeddingModelPlaceholder:"text-embedding-3-small",progressiveDisclosure:"Progressive Disclosure",progressiveDisclosureDescription:"When enabled, search_tools returns only tool names and descriptions. Use describe_tool to get full parameter schema, reducing token usage.",embeddingMaxTokens:"Max Embedding Tokens",embeddingMaxTokensDescription:"Maximum tokens for text truncation before generating embeddings. Leave empty to use the model default automatically. A custom value always overrides the model default. Manually setting this value is especially useful when using local LLM providers to prevent truncation errors.",embeddingMaxTokensPlaceholder:"Empty = auto by model",embeddingMaxTokensAuto:"Auto: {{limit}} tokens (model default for {{model}})",embeddingMaxTokensOverride:"This value overrides the model default.",smartRoutingConfigUpdated:"Smart routing configuration updated successfully",smartRoutingRequiredFields:"Database URL is required to enable smart routing. An LLM Provider API Key is required for cloud-based providers (local LLMs usually don't require an API key, enter any value to pass the form validation)",smartRoutingValidationError:"Please fill in the required fields before enabling Smart Routing: {{fields}}",mcpRouterConfig:"Cloud Market",mcpRouterApiKey:"MCPRouter API Key",mcpRouterApiKeyDescription:"API key for accessing MCPRouter cloud market services",mcpRouterApiKeyPlaceholder:"Enter MCPRouter API key",mcpRouterReferer:"Referer",mcpRouterRefererDescription:"Referer header for MCPRouter API requests",mcpRouterRefererPlaceholder:"https://www.mcphub.app",mcpRouterTitle:"Title",mcpRouterTitleDescription:"Title header for MCPRouter API requests",mcpRouterTitlePlaceholder:"MCPHub",mcpRouterBaseUrl:"Base URL",mcpRouterBaseUrlDescription:"Base URL for MCPRouter API",mcpRouterBaseUrlPlaceholder:"https://api.mcprouter.to/v1",systemSettings:"System Settings",nameSeparatorLabel:"Name Separator",nameSeparatorDescription:"Character used to separate server name and tool/prompt name (default: -)",enableSessionRebuild:"Enable Server Session Rebuild",enableSessionRebuildDescription:"When enabled, applies the improved server session rebuild code for better session management experience",restartRequired:"Configuration saved. It is recommended to restart the application to ensure all services load the new settings correctly.",exportMcpSettings:"Export Settings",mcpSettingsJson:"MCP Settings JSON",mcpSettingsJsonDescription:"View, copy, or download your current mcp_settings.json configuration for backup or migration to other tools",copyToClipboard:"Copy to Clipboard",downloadJson:"Download JSON",exportSuccess:"Settings exported successfully",exportError:"Failed to fetch settings",enableOauthServer:"Enable OAuth Server",enableOauthServerDescription:"Allow MCPHub to issue OAuth tokens for external clients",requireClientSecret:"Require Client Secret",requireClientSecretDescription:"When enabled, confidential clients must present a client secret (disable for PKCE-only clients)",requireState:"Require State Parameter",requireStateDescription:"Reject authorization requests that omit the OAuth state parameter",accessTokenLifetime:"Access Token Lifetime (seconds)",accessTokenLifetimeDescription:"How long issued access tokens remain valid",accessTokenLifetimePlaceholder:"e.g. 3600",refreshTokenLifetime:"Refresh Token Lifetime (seconds)",refreshTokenLifetimeDescription:"How long refresh tokens remain valid",refreshTokenLifetimePlaceholder:"e.g. 1209600",authorizationCodeLifetime:"Authorization Code Lifetime (seconds)",authorizationCodeLifetimeDescription:"How long authorization codes remain valid before they can be exchanged",authorizationCodeLifetimePlaceholder:"e.g. 300",allowedScopes:"Allowed Scopes",allowedScopesDescription:"Comma-separated list of scopes users can approve during authorization",allowedScopesPlaceholder:"e.g. read, write",enableDynamicRegistration:"Enable Dynamic Client Registration",dynamicRegistrationDescription:"Allow RFC 7591 compliant clients to self-register using the public endpoint",dynamicRegistrationAllowedGrantTypes:"Allowed Grant Types",dynamicRegistrationAllowedGrantTypesDescription:"Comma-separated list of grants permitted for dynamically registered clients",dynamicRegistrationAllowedGrantTypesPlaceholder:"e.g. authorization_code, refresh_token",dynamicRegistrationAuth:"Require Authentication",dynamicRegistrationAuthDescription:"Protect the registration endpoint so only authenticated requests can register clients",invalidNumberInput:"Please enter a valid non-negative number"},$k={upload:"Upload",uploadTitle:"Upload MCPB Bundle",dropFileHere:"Drop your .mcpb file here",orClickToSelect:"or click to select from your computer",invalidFileType:"Please select a valid .mcpb file",noFileSelected:"Please select a .mcpb file to upload",uploading:"Uploading...",uploadFailed:"Failed to upload MCPB file",installServer:"Install MCP Server from MCPB",extensionInfo:"Extension Information",name:"Name",version:"Version",description:"Description",author:"Author",tools:"Tools",serverName:"Server Name",serverNamePlaceholder:"Enter a name for this server",install:"Install",installing:"Installing...",installFailed:"Failed to install server from MCPB",serverExistsTitle:"Server Already Exists",serverExistsConfirm:"Server '{{serverName}}' already exists. Do you want to override it with the new version?",override:"Override"},Yk={button:"Import",title:"Import Servers from JSON",inputLabel:"Server Configuration JSON",inputHelp:"Paste your server configuration JSON. Supports STDIO, SSE, and HTTP (streamable-http) server types.",preview:"Preview",previewTitle:"Preview Servers to Import",import:"Import",importing:"Importing...",invalidFormat:"Invalid JSON format. The JSON must contain an 'mcpServers' object.",parseError:"Failed to parse JSON. Please check the format and try again.",addFailed:"Failed to add server",importFailed:"Failed to import servers",partialSuccess:"Imported {{count}} of {{total}} servers successfully. Some servers failed:"},Jk={button:"Import",title:"Import Groups from JSON",inputLabel:"Group Configuration JSON",inputHelp:"Paste your group configuration JSON. Each group can contain a list of servers.",preview:"Preview",previewTitle:"Preview Groups to Import",import:"Import",importing:"Importing...",invalidFormat:"Invalid JSON format. The JSON must contain a 'groups' array.",missingName:"Each group must have a 'name' field.",parseError:"Failed to parse JSON. Please check the format and try again.",addFailed:"Failed to add group",importFailed:"Failed to import groups",partialSuccess:"Imported {{count}} of {{total}} groups successfully. Some groups failed:"},Qk={add:"Add User",addNew:"Add New User",edit:"Edit User",delete:"Delete User",create:"Create User",update:"Update User",username:"Username",password:"Password",newPassword:"New Password",confirmPassword:"Confirm Password",changePassword:"Change Password",adminRole:"Administrator",admin:"Admin",user:"User",role:"Role",actions:"Actions",addFirst:"Add your first user",permissions:"Permissions",adminPermissions:"Full system access",userPermissions:"Limited access",currentUser:"You",noUsers:"No users found",adminRequired:"Administrator access required to manage users",usernameRequired:"Username is required",passwordRequired:"Password is required",passwordTooShort:"Password must be at least 6 characters long",passwordMismatch:"Passwords do not match",usernamePlaceholder:"Enter username",passwordPlaceholder:"Enter password",newPasswordPlaceholder:"Leave empty to keep current password",confirmPasswordPlaceholder:"Confirm new password",createError:"Failed to create user",updateError:"Failed to update user",deleteError:"Failed to delete user",statsError:"Failed to fetch user statistics",deleteConfirmation:"Are you sure you want to delete user '{{username}}'? This action cannot be undone.",confirmDelete:"Delete User",deleteWarning:"Are you sure you want to delete user '{{username}}'? This action cannot be undone."},Xk={errors:{readonly:"Readonly for demo environment",invalid_credentials:"Invalid username or password",serverNameRequired:"Server name is required",serverConfigRequired:"Server configuration is required",serverConfigInvalid:"Server configuration must include either a URL, OpenAPI specification URL or schema, or command with arguments",serverTypeInvalid:"Server type must be one of: stdio, sse, streamable-http, openapi",urlRequiredForType:"URL is required for {{type}} server type",openapiSpecRequired:"OpenAPI specification URL or schema is required for openapi server type",headersInvalidFormat:"Headers must be an object",headersNotSupportedForStdio:"Headers are not supported for stdio server type",serverNotFound:"Server not found",failedToRemoveServer:"Server not found or failed to remove",internalServerError:"Internal server error",failedToGetServers:"Failed to get servers information",failedToReloadServer:"Failed to reload server",failedToGetServerSettings:"Failed to get server settings",failedToGetServerConfig:"Failed to get server configuration",failedToSaveSettings:"Failed to save settings",toolNameRequired:"Server name and tool name are required",descriptionMustBeString:"Description must be a string",groupIdRequired:"Group ID is required",groupNameRequired:"Group name is required",groupNotFound:"Group not found",groupIdAndServerNameRequired:"Group ID and server name are required",groupOrServerNotFound:"Group or server not found",toolsMustBeAllOrArray:'Tools must be "all" or an array of strings',serverNameAndToolNameRequired:"Server name and tool name are required",usernameRequired:"Username is required",userNotFound:"User not found",failedToGetUsers:"Failed to get users information",failedToGetUserInfo:"Failed to get user information",failedToGetUserStats:"Failed to get user statistics",marketServerNameRequired:"Server name is required",marketServerNotFound:"Market server not found",failedToGetMarketServers:"Failed to get market servers information",failedToGetMarketServer:"Failed to get market server information",failedToGetMarketCategories:"Failed to get market categories",failedToGetMarketTags:"Failed to get market tags",failedToSearchMarketServers:"Failed to search market servers",failedToFilterMarketServers:"Failed to filter market servers",failedToProcessMcpbFile:"Failed to process MCPB file"},success:{serverCreated:"Server created successfully",serverUpdated:"Server updated successfully",serverRemoved:"Server removed successfully",serverToggled:"Server status toggled successfully",toolToggled:"Tool {{name}} {{action}} successfully",toolDescriptionUpdated:"Tool {{name}} description updated successfully",systemConfigUpdated:"System configuration updated successfully",groupCreated:"Group created successfully",groupUpdated:"Group updated successfully",groupDeleted:"Group deleted successfully",serverAddedToGroup:"Server added to group successfully",serverRemovedFromGroup:"Server removed from group successfully",serverToolsUpdated:"Server tools updated successfully"}},Zk={authorizationFailed:"Authorization Failed",authorizationFailedError:"Error",authorizationFailedDetails:"Details",invalidRequest:"Invalid Request",missingStateParameter:"Missing required OAuth state parameter.",missingCodeParameter:"Missing required authorization code parameter.",serverNotFound:"Server Not Found",serverNotFoundMessage:"Could not find server associated with this authorization request.",sessionExpiredMessage:"The authorization session may have expired. Please try authorizing again.",authorizationSuccessful:"Authorization Successful",server:"Server",status:"Status",connected:"Connected",successMessage:"The server has been successfully authorized and connected.",autoCloseMessage:"This window will close automatically in 3 seconds...",closeNow:"Close Now",connectionError:"Connection Error",connectionErrorMessage:"Authorization was successful, but failed to connect to the server.",reconnectMessage:"Please try reconnecting from the dashboard.",configurationError:"Configuration Error",configurationErrorMessage:"Server transport does not support OAuth finishAuth(). Please ensure the server is configured with streamable-http transport.",internalError:"Internal Error",internalErrorMessage:"An unexpected error occurred while processing the OAuth callback.",closeWindow:"Close Window"},Wk={add:"Add Prompt",addNew:"Add New Prompt",edit:"Edit Prompt",delete:"Delete",noPrompts:"No built-in prompts configured",addFirst:"Add your first prompt",name:"Name",namePlaceholder:"e.g. code-review",title:"Title",titlePlaceholder:"e.g. Code Review Prompt",description:"Description",descriptionPlaceholder:"Brief description of the prompt",template:"Template",templatePlaceholder:"Enter template text with {{parameter}} placeholders...",templateHint:"Use {{paramName}} for template parameters",arguments:"Arguments",addArgument:"Add Argument",argName:"Name",argDescription:"Description",argRequired:"Required",enabled:"Enabled",active:"Active",inactive:"Inactive",nameRequired:"Name is required",templateRequired:"Template is required",fetchError:"Failed to load built-in prompts",createError:"Failed to create prompt",updateError:"Failed to update prompt",deleteError:"Failed to delete prompt",saveError:"Failed to save prompt",confirmDelete:"Delete Prompt",deleteWarning:'Are you sure you want to delete the prompt "{{name}}"? This action cannot be undone.'},e4={add:"Add Resource",addNew:"Add New Resource",edit:"Edit Resource",delete:"Delete",noResources:"No built-in resources configured",addFirst:"Add your first resource",uri:"URI",uriPlaceholder:"e.g. resource://docs/guide",name:"Name",namePlaceholder:"e.g. User Guide",description:"Description",descriptionPlaceholder:"Brief description of the resource",mimeType:"MIME Type",content:"Content",contentPlaceholder:"Enter the resource content...",enabled:"Enabled",active:"Active",inactive:"Inactive",descriptionUpdateSuccess:"Resource description updated successfully",descriptionUpdateFailed:"Failed to update resource description",restoreDefault:"Restore default",restoreDefaultSuccess:"Resource description restored to default",restoreDefaultFailed:"Failed to restore the default resource description",uriRequired:"URI is required",contentRequired:"Content is required",fetchError:"Failed to load built-in resources",createError:"Failed to create resource",updateError:"Failed to update resource",deleteError:"Failed to delete resource",saveError:"Failed to save resource",confirmDelete:"Delete Resource",deleteWarning:'Are you sure you want to delete the resource "{{name}}"? This action cannot be undone.'},t4={title:"Activity",totalCalls:"Total Calls",successCount:"Successful",errorCount:"Failed",avgDuration:"Avg Duration",timestamp:"Timestamp",server:"Server",tool:"Tool",duration:"Duration",status:"Status",group:"Group",key:"API Key",input:"Input",output:"Output",details:"Activity Details",errorMessage:"Error Message",searchServer:"Server...",searchTool:"Tool...",searchStatus:"Status...",searchGroup:"Group...",searchKeyName:"API key...",keyName:"API Key Name",allStatus:"All Status",statusSuccess:"Success",statusError:"Error",noData:"No activity data available",fetchError:"Failed to load activity data",cleanup:"Cleanup",confirmCleanup:"Are you sure you want to delete activities older than 30 days?",cleanupSuccess:"Deleted {{count}} old activities",cleanupError:"Failed to cleanup old activities",notAvailable:"Activity tracking is only available in database mode"},r4={exportButton:"Export Template",importButton:"Import Template",exportTitle:"Export Configuration Template",importTitle:"Import Configuration Template",name:"Template Name",nameRequired:"Template name is required",namePlaceholder:"e.g., Frontend Dev Tools",description:"Description",descriptionPlaceholder:"e.g., Standard MCP servers for frontend development",selectGroups:"Select Groups",selectGroupsHelp:"Leave empty to export all groups",selectAll:"Select All",deselectAll:"Deselect All",includeDisabled:"Include disabled servers",exportNote:"Secrets (API keys, tokens, passwords) will be replaced with ${PLACEHOLDER} references. Recipients must supply their own credentials.",export:"Export",exporting:"Exporting...",exportFailed:"Failed to export template",import:"Import",importing:"Importing...",importFailed:"Failed to import template",invalidFormat:"Invalid template format. Must contain version, name, servers, and groups fields.",parseError:"Failed to parse JSON. Please check the format and try again.",uploadFile:"Upload Template File",or:"or",pasteJson:"Paste Template JSON",pastePlaceholder:"Paste your .mcphub-template.json content here...",version:"Version",createdAt:"Created",servers:"Servers",groups:"Groups",serversInGroup:"server(s)",envVarsNeeded:"Required Environment Variables — set these before using the imported servers:",importResult:"Servers: {{serversCreated}} created, {{serversSkipped}} skipped. Groups: {{groupsCreated}} created, {{groupsSkipped}} skipped."},a4={app:Sk,about:Nk,profile:kk,sponsor:Ck,wechat:Ak,discord:Ek,theme:Rk,auth:Tk,server:Ok,status:zk,errors:Mk,common:Pk,pagination:Dk,nav:Lk,pages:Uk,logs:_k,groups:Bk,market:Ik,oauthServer:Fk,cloud:Hk,registry:qk,tool:Gk,prompt:Kk,settings:Vk,mcpb:$k,jsonImport:Yk,groupImport:Jk,users:Qk,api:Xk,oauthCallback:Zk,builtinPrompts:Wk,builtinResources:e4,activity:t4,template:r4},s4={title:"MCPHub 控制面板",error:"错误",closeButton:"关闭",noServers:"没有可用的 MCP 服务器",loading:"加载中...",logout:"退出登录",profile:"个人资料",changePassword:"修改密码",toggleSidebar:"切换侧边栏",welcomeUser:"欢迎, {{username}}",name:"MCPHub",embeddingSyncProgress:"正在为 {{serverName}} 创建嵌入",embeddingSyncProgressAriaLabel:"正在为 {{serverName}} 创建嵌入:已完成 {{current}}/{{total}}"},n4={title:"关于",versionInfo:"MCPHub 版本: {{version}}",newVersion:"有新版本可用!",currentVersion:"当前版本",newVersionAvailable:"新版本 {{version}} 已发布",viewOnGitHub:"在 GitHub 上查看",checkForUpdates:"检查更新",checking:"检查更新中..."},l4={viewProfile:"查看个人中心",userCenter:"个人中心"},i4={label:"赞助",title:"支持项目",rewardAlt:"赞赏码",supportMessage:"通过捐赠支持 MCPHub 的开发!",supportButton:"在 Ko-fi 上支持"},o4={label:"微信",title:"微信联系",qrCodeAlt:"微信二维码",scanMessage:"扫描二维码添加微信"},c4={label:"Discord",title:"加入我们的 Discord 服务器",community:"加入我们不断壮大的 Discord 社区,获取支持、参与讨论并了解最新动态!"},u4={title:"主题",light:"浅色",dark:"深色",system:"系统"},d4={login:"登录",loginTitle:"登录 MCPHub",slogan:"统一的 MCP 服务器管理平台",subtitle:"模型上下文协议服务器的集中管理平台,通过灵活的路由策略组织、监控和扩展多个 MCP 服务器。",username:"用户名",password:"密码",loggingIn:"登录中...",orContinue:"或使用以下方式继续",loginWithGoogle:"使用 Google 登录",loginWithGithub:"使用 GitHub 登录",socialLoginFailed:"社交登录失败,请重试。",emptyFields:"用户名和密码不能为空",loginFailed:"登录失败,请检查用户名和密码",loginError:"登录过程中出现错误",serverUnavailable:"无法连接到服务器,请检查网络连接或稍后再试",currentPassword:"当前密码",newPassword:"新密码",confirmPassword:"确认密码",passwordsNotMatch:"新密码与确认密码不一致",changePasswordSuccess:"密码修改成功",changePasswordError:"修改密码失败",changePassword:"修改密码",passwordChanged:"密码修改成功",passwordChangeError:"修改密码失败",defaultPasswordWarning:"默认密码安全警告",defaultPasswordMessage:"您正在使用默认密码(admin123),这存在安全风险。为了保护您的账户安全,请立即修改密码。",goToSettings:"前往修改",passwordStrengthError:"密码不符合安全要求",passwordMinLength:"密码长度至少为 8 个字符",passwordRequireLetter:"密码必须包含至少一个字母",passwordRequireNumber:"密码必须包含至少一个数字",passwordRequireSpecial:"密码必须包含至少一个特殊字符",passwordStrengthHint:"密码必须至少 8 个字符,且包含字母、数字和特殊字符"},m4={addServer:"添加服务器",add:"添加",edit:"编辑",copy:"复制",delete:"删除",confirmDelete:"您确定要删除此服务器吗?",deleteWarning:"删除服务器 '{{name}}' 将会移除该服务器及其所有数据。此操作无法撤销。",status:"状态",tools:"工具",prompts:"提示词",name:"服务器名称",description:"服务器注释",descriptionPlaceholder:"可选:记录这个服务器的用途说明",url:"服务器 URL",apiKey:"API 密钥",save:"保存",cancel:"取消",addError:"添加服务器失败",editError:"编辑服务器 {{serverName}} 失败",invalidConfig:"无法找到 {{serverName}} 的配置数据",deleteError:"删除服务器 {{serverName}} 失败",updateError:"更新服务器失败",editTitle:"编辑服务器: {{serverName}}",type:"服务器类型",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"流式 HTTP",typeOpenapi:"OpenAPI",command:"命令",arguments:"参数",envVars:"环境变量",headers:"HTTP 请求头",key:"键",value:"值",enabled:"已启用",enable:"启用",disable:"禁用",reload:"重载",reloadSuccess:"服务器重载成功",reloadError:"重载服务器 {{serverName}} 失败",requestOptions:"连接配置",timeout:"请求超时",timeoutDescription:"请求超时时间(毫秒)",maxTotalTimeout:"最大总超时",maxTotalTimeoutDescription:"无论是否有进度通知的最大总超时时间(毫秒)",resetTimeoutOnProgress:"收到进度通知时重置超时",resetTimeoutOnProgressDescription:"适用于发送周期性进度更新的长时间运行操作(默认开启)",keepAlive:"保活配置",enableKeepAlive:"启用保活",keepAliveDescription:"定期发送 ping 请求以维持连接。适用于可能超时的长期连接。",keepAliveInterval:"间隔时间(毫秒)",keepAliveIntervalDescription:"保活 ping 的时间间隔(默认:60000毫秒 = 1分钟)",remove:"移除",toggleError:"切换服务器 {{serverName}} 状态失败",alreadyExists:"服务器 {{serverName}} 已经存在",invalidData:"提供的服务器数据无效",notFound:"找不到服务器 {{serverName}}",namePlaceholder:"请输入服务器名称",urlPlaceholder:"请输入服务器URL",commandPlaceholder:"请输入命令",argumentsPlaceholder:"请输入参数",errorDetails:"错误详情",viewErrorDetails:"查看错误详情",copyConfig:"复制配置",confirmVariables:"确认变量配置",variablesDetected:"检测到配置中包含变量,请确认这些变量是否已正确配置:",detectedVariables:"检测到的变量",confirmVariablesMessage:"请确保这些变量在运行环境中已正确定义。是否继续添加服务器?",confirmAndAdd:"确认并添加",openapi:{inputMode:"输入模式",inputModeUrl:"规范 URL",inputModeSchema:"JSON 模式",specUrl:"OpenAPI 规范 URL",schema:"OpenAPI JSON 模式",schemaHelp:"请在此处粘贴完整的 OpenAPI JSON 模式",security:"安全类型",securityNone:"无",securityApiKey:"API 密钥",securityHttp:"HTTP 认证",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API 密钥配置",apiKeyName:"请求头/参数名称",apiKeyIn:"位置",apiKeyValue:"API 密钥值",httpAuthConfig:"HTTP 认证配置",httpScheme:"认证方案",httpCredentials:"凭据",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 配置",oauth2Token:"访问令牌",openIdConnectConfig:"OpenID Connect 配置",openIdConnectUrl:"发现 URL",openIdConnectToken:"ID 令牌",apiKeyInHeader:"请求头",apiKeyInQuery:"查询",apiKeyInCookie:"Cookie",passthroughHeaders:"透传请求头",passthroughHeadersHelp:"要从传入的 MCP 请求透传到上游服务器请求的请求头名称列表,用逗号分隔(如:Authorization, X-API-Key)"},oauth:{sectionTitle:"OAuth 配置",sectionDescription:"为需要 OAuth 的服务器配置客户端凭据(可选)。",clientId:"客户端 ID",clientSecret:"客户端密钥",authorizationEndpoint:"授权端点",tokenEndpoint:"令牌端点",scopes:"权限范围(Scopes)",scopesPlaceholder:"scope1 scope2",resource:"资源 / 受众",accessToken:"访问令牌",refreshToken:"刷新令牌"}},p4={online:"在线",offline:"离线",connecting:"连接中",oauthRequired:"需要OAuth授权",clickToAuthorize:"点击进行OAuth授权",oauthWindowOpened:"OAuth授权窗口已打开,请完成授权。"},g4={general:"发生错误",network:"网络连接错误,请检查您的互联网连接",serverConnection:"无法连接到服务器,请检查服务器是否正在运行",serverAdd:"添加服务器失败,请检查服务器状态",serverUpdate:"编辑服务器 {{serverName}} 失败,请检查服务器状态",serverFetch:"获取服务器数据失败,请稍后重试",failedToReloadServer:"重载服务器失败",initialStartup:"服务器可能正在启动中。首次启动可能需要一些时间,请耐心等候...",serverInstall:"安装服务器失败",failedToFetchSettings:"获取设置失败",failedToUpdateSystemConfig:"更新系统配置失败",failedToUpdateRouteConfig:"更新路由配置失败",failedToUpdateSmartRoutingConfig:"更新智能路由配置失败"},f4={processing:"处理中...",save:"保存",cancel:"取消",back:"返回",refresh:"刷新",search:"搜索",clear:"清除",view:"查看",create:"创建",creating:"创建中...",update:"更新",updating:"更新中...",submitting:"提交中...",delete:"删除",remove:"移除",copy:"复制",copyId:"复制ID",copyUrl:"复制URL",copyJson:"复制JSON",copySuccess:"已复制到剪贴板",copyFailed:"复制失败",copied:"已复制",close:"关闭",confirm:"确认",language:"语言",true:"是",false:"否",dismiss:"忽略",github:"GitHub",wechat:"微信",itemsPerPage:"每页显示",showing:"显示第 {{start}}-{{end}} 条,共 {{total}} 条",previous:"上一页",next:"下一页",discord:"Discord",required:"必填",secret:"敏感",default:"默认值",value:"值",type:"类型",repeated:"可重复",valueHint:"值提示",choices:"可选值",actions:"操作",saving:"保存中...",active:"已激活",inactive:"未激活"},h4={rowsPerPage:"每页行数",showing:"显示第 {{from}}-{{to}} 条,共 {{total}} 条"},x4={dashboard:"仪表盘",servers:"服务器",settings:"设置",changePassword:"修改密码",groups:"分组",prompts:"提示词",resources:"资源",users:"用户",market:"市场",cloud:"云端市场",logs:"日志",activity:"活动"},y4={dashboard:{title:"仪表盘",totalServers:"总数",onlineServers:"在线",disabledServers:"禁用",offlineServers:"离线",connectingServers:"连接中",recentServers:"最近的服务器"},servers:{title:"服务器管理"},settings:{title:"设置",language:"语言",account:"账户设置",password:"修改密码",appearance:"外观",routeConfig:"安全配置",installConfig:"安装",smartRouting:"智能路由",oauthServer:"OAuth"},groups:{title:"分组管理"},prompts:{title:"内置提示词"},resources:{title:"内置资源"},users:{title:"用户管理"},market:{title:"市场中心 - 本地市场和云端市场"},logs:{title:"系统日志"}},b4={filters:"筛选",search:"搜索日志...",autoScroll:"自动滚动",clearLogs:"清除日志",loading:"加载日志中...",noLogs:"暂无日志。",noMatch:"没有匹配当前筛选条件的日志。",mainProcess:"主进程",childProcess:"子进程",main:"主",child:"子"},v4={add:"添加",addNew:"添加新分组",edit:"编辑分组",delete:"删除",confirmDelete:"您确定要删除此分组吗?",deleteWarning:"删除分组 '{{name}}' 将会移除该分组及其所有服务器关联。此操作无法撤销。",name:"分组名称",namePlaceholder:"请输入分组名称",nameRequired:"分组名称不能为空",description:"描述",descriptionPlaceholder:"请输入分组描述(可选)",createError:"创建分组失败",updateError:"更新分组失败",deleteError:"删除分组失败",serverAddError:"向分组添加服务器失败",serverRemoveError:"从分组移除服务器失败",addServer:"添加服务器到分组",selectServer:"选择要添加的服务器",servers:"分组中的服务器",remove:"移除",noGroups:"暂无可用分组。创建一个新分组以开始使用。",noServers:"此分组中没有服务器。",noServerOptions:"没有可用的服务器",serverCount:"{{count}} 台服务器",toolSelection:"工具选择",promptSelection:"提示词选择",resourceSelection:"资源选择",toolsSelected:"选择",promptsSelected:"选择",resourcesSelected:"选择",allTools:"全部",allPrompts:"全部提示词",allResources:"全部资源",selectedTools:"选中的工具",selectedPrompts:"选中的提示词",selectedResources:"选中的资源",selectAll:"全选",selectNone:"全不选",configureTools:"配置工具",configureCapabilities:"配置工具、提示词和资源",previewPrompts:"[提示词: {{items}}]",previewResources:"[资源: {{items}}]",previewAllTools:"(全部工具)",previewAllPrompts:"(全部提示词)",previewAllResources:"(全部资源)"},w4={title:"本地安装",official:"官方",by:"作者",unknown:"未知",tools:"工具",search:"搜索",searchPlaceholder:"搜索服务器名称、分类或标签",clearFilters:"清除",clearCategoryFilter:"",clearTagFilter:"",categories:"分类",tags:"标签",showTags:"显示标签",hideTags:"隐藏标签",moreTags:"",noServers:"未找到匹配的服务器",backToList:"返回列表",install:"安装",installing:"安装中...",installed:"已安装",installServer:"安装服务器: {{name}}",installSuccess:"服务器 {{serverName}} 安装成功",author:"作者",license:"许可证",repository:"代码仓库",examples:"示例",arguments:"参数",argumentName:"名称",description:"描述",required:"必填",example:"示例",viewSchema:"查看结构",fetchError:"获取本地市场服务器数据失败",serverNotFound:"未找到服务器",searchError:"搜索服务器失败",filterError:"按分类筛选服务器失败",tagFilterError:"按标签筛选服务器失败",noInstallationMethod:"该服务器没有可用的安装方法",showing:"显示 {{from}}-{{to}}/{{total}} 个服务器",perPage:"每页显示",confirmVariablesMessage:"请确保这些变量在运行环境中已正确定义。是否继续安装服务器?",confirmAndInstall:"确认并安装"},j4={authorizeTitle:"授权应用",authorizeSubtitle:"允许此应用访问您的 MCPHub 账号。",buttons:{approve:"允许访问",deny:"拒绝",approveSubtitle:"如果您信任此应用,建议选择允许。",denySubtitle:"您可以在之后随时再次授权。"}},S4={title:"云端支持",subtitle:"由 MCPRouter 提供支持",by:"作者",server:"服务器",config:"配置",created:"创建时间",updated:"更新时间",available:"可用",description:"描述",details:"详细信息",tools:"工具",tool:"个工具",toolsAvailable:"{{count}} 个工具可用",loadingTools:"加载工具中...",noTools:"该服务器没有可用工具",noDescription:"无描述信息",viewDetails:"查看详情",parameters:"参数",result:"结果",error:"错误",callTool:"调用",calling:"调用中...",toolCallSuccess:"工具 {{toolName}} 执行成功",toolCallError:"调用工具 {{toolName}} 失败:{{error}}",viewSchema:"查看结构",backToList:"返回云端市场",search:"搜索",searchPlaceholder:"搜索云端服务器名称、标题或作者",clearFilters:"清除筛选",clearCategoryFilter:"清除",clearTagFilter:"清除",categories:"分类",tags:"标签",noCategories:"未找到分类",noTags:"未找到标签",noServers:"未找到云端服务器",fetchError:"获取云端服务器失败",serverNotFound:"未找到云端服务器",searchError:"搜索云端服务器失败",filterError:"按分类筛选云端服务器失败",tagFilterError:"按标签筛选云端服务器失败",showing:"显示 {{from}}-{{to}}/{{total}} 个云端服务器",perPage:"每页显示",apiKeyNotConfigured:"MCPRouter API 密钥未配置",apiKeyNotConfiguredDescription:"要使用云端服务器,您需要配置 MCPRouter API 密钥。",getApiKey:"获取 API 密钥",configureInSettings:"在设置中配置",installServer:"安装 {{name}}",installSuccess:"服务器 {{name}} 安装成功",installError:"安装服务器失败:{{error}}"},N4={title:"注册中心",official:"官方",latest:"最新版本",description:"描述",website:"网站",repository:"代码仓库",packages:"安装包",package:"安装包",remotes:"远程服务",remote:"远程服务",published:"发布时间",updated:"更新时间",install:"安装",installing:"安装中...",installed:"已安装",installServer:"安装 {{name}}",installSuccess:"服务器 {{name}} 安装成功",installError:"安装服务器失败:{{error}}",noDescription:"无描述信息",viewDetails:"查看详情",backToList:"返回注册中心",search:"搜索",searchPlaceholder:"按名称搜索注册中心服务器",clearFilters:"清除",noServers:"未找到注册中心服务器",fetchError:"获取注册中心服务器失败",serverNotFound:"未找到注册中心服务器",showing:"显示 {{from}}-{{to}}/{{total}} 个注册中心服务器",perPage:"每页显示",environmentVariables:"环境变量",packageArguments:"安装包参数",runtimeArguments:"运行时参数",headers:"请求头"},k4={run:"运行",running:"运行中...",runTool:"运行",cancel:"取消",noDescription:"无描述信息",inputSchema:"输入模式:",runToolWithName:"运行工具:{{name}}",execution:"工具执行",successful:"成功",failed:"失败",result:"结果:",error:"错误",errorDetails:"错误详情:",noContent:"工具执行成功但未返回内容。",unknownError:"发生未知错误",jsonResponse:"JSON 响应:",toolResult:"工具结果",noParameters:"此工具不需要任何参数。",selectOption:"选择一个选项",enterValue:"输入{{type}}值",enabled:"已启用",enableSuccess:"工具 {{name}} 启用成功",disableSuccess:"工具 {{name}} 禁用成功",toggleFailed:"切换工具状态失败",descriptionUpdateSuccess:"工具描述更新成功",descriptionUpdateFailed:"更新工具描述失败",restoreDefault:"恢复默认值",restoreDefaultSuccess:"工具描述已恢复为默认值",restoreDefaultFailed:"恢复默认工具描述失败",parameters:"工具参数",formMode:"表单模式",jsonMode:"JSON 模式",jsonConfiguration:"JSON 配置",invalidJsonFormat:"无效的 JSON 格式",fixJsonBeforeSwitching:"请修复 JSON 格式后再切换到表单模式",item:"项目 {{index}}",addItem:"添加 {{key}} 项目",enterKey:"输入 {{key}}"},C4={run:"获取",running:"获取中...",result:"提示词结果",error:"提示词错误",execution:"提示词执行",successful:"成功",failed:"失败",errorDetails:"错误详情:",noContent:"提示词执行成功但未返回内容。",unknownError:"发生未知错误",jsonResponse:"JSON 响应:",description:"描述",messages:"消息",noDescription:"无描述信息",runPromptWithName:"获取提示词: {{name}}",descriptionUpdateSuccess:"提示词描述更新成功",descriptionUpdateFailed:"更新提示词描述失败",restoreDefault:"恢复默认值",restoreDefaultSuccess:"提示词描述已恢复为默认值",restoreDefaultFailed:"恢复默认提示词描述失败"},A4={enableGlobalRoute:"启用全局路由",enableGlobalRouteDescription:"允许不指定组 ID 就连接到 /sse 端点",enableGroupNameRoute:"启用组名路由",enableGroupNameRouteDescription:"允许使用组名而不仅仅是组 ID 连接到 /sse 端点",enableBearerAuth:"启用 Bearer 认证",enableBearerAuthDescription:"对 MCP 端点启用 Bearer 令牌认证(默认开启)",bearerAuthKey:"Bearer 认证密钥",bearerAuthKeyDescription:"Bearer 令牌中需要携带的认证密钥",bearerAuthKeyPlaceholder:"请输入 Bearer 认证密钥",bearerAuthHeaderName:"Bearer 认证请求头名称",bearerAuthHeaderNameDescription:"用于接收 MCP Bearer 凭证的请求头名称。当上游透传头也使用 Authorization 时,可改成其它名称以避免冲突。",bearerAuthHeaderNamePlaceholder:"例如:Authorization 或 X-MCP-Authorization",bearerKeysSectionTitle:"密钥",bearerKeysSectionDescription:"管理多条密钥,并为不同密钥配置不同的访问范围。",noBearerKeys:"当前还没有配置任何密钥。",bearerKeyName:"名称",bearerKeyToken:"密钥值",bearerKeyEnabled:"启用",bearerKeyAccessType:"访问范围",bearerKeyAccessAll:"全部",bearerKeyAccessGroups:"指定分组",bearerKeyAccessServers:"指定服务器",bearerKeyAccessCustom:"自定义",bearerKeyAllowedGroups:"允许访问的分组",bearerKeyAllowedServers:"允许访问的服务器",addBearerKey:"新增密钥",addBearerKeyButton:"创建",bearerKeyRequired:"名称和密钥值为必填项",deleteBearerKeyConfirm:"确定要删除这条密钥吗?",generate:"生成",selectGroups:"选择分组",selectServers:"选择服务器",selectAtLeastOneGroup:"请至少选择一个分组",selectAtLeastOneServer:"请至少选择一个服务器",skipAuth:"免登录开关",skipAuthDescription:"允许仪表盘免登录(不影响 MCP 端点认证)",jsonBodyLimit:"JSON 请求体大小限制",jsonBodyLimitDescription:"Express JSON 请求体大小限制,大型 OpenAPI schema 上传也会受此配置影响。",jsonBodyLimitPlaceholder:"例如:1mb、5mb、1024kb",pythonIndexUrl:"Python 包仓库地址",pythonIndexUrlDescription:"设置 UV_DEFAULT_INDEX 环境变量,用于 Python 包安装",pythonIndexUrlPlaceholder:"例如: https://pypi.org/simple",npmRegistry:"NPM 仓库地址",npmRegistryDescription:"设置 npm_config_registry 环境变量,用于 NPM 包安装",npmRegistryPlaceholder:"例如: https://registry.npmjs.org/",baseUrl:"基础地址",baseUrlDescription:"用于 MCP 请求与 OAuth 回调的基础地址",baseUrlPlaceholder:"例如: http://localhost:3000",installConfig:"安装配置",systemConfigUpdated:"系统配置更新成功",enableSmartRouting:"启用智能路由",enableSmartRoutingDescription:"开启智能路由功能,根据输入自动搜索最合适的工具(使用 $smart 分组)",dbUrl:"PostgreSQL 连接地址(必须支持 pgvector)",dbUrlPlaceholder:"例如: postgresql://user:password@localhost:5432/dbname",embeddingProvider:"嵌入提供方",openaiApiBaseUrl:"OpenAI 兼容基础地址",openaiApiBaseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKey:"LLM 提供商 API 密钥",openaiApiKeyDescription:"用于访问嵌入服务的 API 密钥",openaiApiKeyPlaceholder:"请输入 LLM 提供商 API 密钥",openaiApiEmbeddingModel:"嵌入模型名称",openaiApiEmbeddingModelPlaceholder:"text-embedding-3-small",basePacingDelayMs:"基础节流延迟(毫秒)",basePacingDelayMsDescription:"向嵌入服务提供方发送请求之间的基础等待时间。默认为 0 — 系统自动管理限流:优先遵守 Retry-After 响应头,若无该头则等待 63 秒,并在每次 403/429 后自动提高节流延迟。仅当提供方要求固定最小请求间隔时才需设置非零值。",basePacingDelayMsPlaceholder:"留空 = 默认 0 毫秒",basePacingDelayMsAuto:"默认({{value}} 毫秒):限流由系统自动管理。",basePacingDelayMsZero:"0 毫秒(默认):限流通过自适应节流和重试逻辑自动管理。",basePacingDelayMsOverride:"自定义值:覆盖默认的基础节流延迟。",embeddingEncodingFormat:"嵌入编码格式",embeddingEncodingFormatDescription:"嵌入向量的编码格式。自动模式会根据服务商支持情况自动选择。",embeddingEncodingFormatAuto:"自动(推荐)",azureOpenaiEndpoint:"Azure OpenAI 终端地址",azureOpenaiEndpointPlaceholder:"https://YOUR_RESOURCE_NAME.openai.azure.com",azureOpenaiApiKey:"Azure OpenAI API 密钥",azureOpenaiApiKeyPlaceholder:"请输入 Azure OpenAI API 密钥",azureOpenaiApiVersion:"Azure OpenAI API 版本",azureOpenaiApiVersionPlaceholder:"2024-02-15-preview",azureOpenaiEmbeddingDeployment:"Azure OpenAI 嵌入部署",azureOpenaiEmbeddingDeploymentPlaceholder:"text-embedding-3-small",azureOpenaiEmbeddingModel:"Azure 嵌入模型名称",azureOpenaiEmbeddingModelDescription:"在 Azure 中部署的实际 OpenAI 模型名称(例如 text-embedding-3-small),用于在发送请求前准确进行 Token 计数。",azureOpenaiEmbeddingModelPlaceholder:"text-embedding-3-small",progressiveDisclosure:"渐进式披露",progressiveDisclosureDescription:"开启后,search_tools 只返回工具名称和描述,通过 describe_tool 获取完整参数定义,可减少 Token 消耗",embeddingMaxTokens:"最大嵌入 Token 数",embeddingMaxTokensDescription:"生成嵌入前截断文本的最大 Token 数。留空将自动使用模型默认值。设置自定义值将始终覆盖模型默认值。当使用本地 LLM 提供商时,手动设置此值特别有用,可防止截断错误。",embeddingMaxTokensPlaceholder:"留空 = 自动(按模型)",embeddingMaxTokensAuto:"自动:{{limit}} tokens({{model}} 的模型默认值)",embeddingMaxTokensOverride:"此值将覆盖模型默认值。",smartRoutingConfigUpdated:"智能路由配置更新成功",smartRoutingRequiredFields:"启用智能路由需要填写数据库连接地址。LLM 提供商 API 密钥仅在使用云端提供商时才需要(本地 LLM 通常不需要 API 密钥,可输入任意值通过表单验证)",smartRoutingValidationError:"启用智能路由前请先填写必要字段:{{fields}}",mcpRouterConfig:"云端市场",mcpRouterApiKey:"MCPRouter API 密钥",mcpRouterApiKeyDescription:"用于访问 MCPRouter 云端市场服务的 API 密钥",mcpRouterApiKeyPlaceholder:"请输入 MCPRouter API 密钥",mcpRouterReferer:"引用地址",mcpRouterRefererDescription:"MCPRouter API 请求的引用地址头",mcpRouterRefererPlaceholder:"https://www.mcphub.app",mcpRouterTitle:"标题",mcpRouterTitleDescription:"MCPRouter API 请求的标题头",mcpRouterTitlePlaceholder:"MCPHub",mcpRouterBaseUrl:"基础地址",mcpRouterBaseUrlDescription:"MCPRouter API 的基础地址",mcpRouterBaseUrlPlaceholder:"https://api.mcprouter.to/v1",systemSettings:"系统设置",nameSeparatorLabel:"名称分隔符",nameSeparatorDescription:"用于分隔服务器名称和工具/提示名称(默认:-)",enableSessionRebuild:"启用服务端会话重建",enableSessionRebuildDescription:"开启后会应用服务端会话重建的改进代码,提供更好的会话管理体验",restartRequired:"配置已保存。为确保所有服务正确加载新设置,建议重启应用。",exportMcpSettings:"导出配置",mcpSettingsJson:"MCP 配置 JSON",mcpSettingsJsonDescription:"查看、复制或下载当前的 mcp_settings.json 配置,可用于备份或迁移到其他工具",copyToClipboard:"复制到剪贴板",downloadJson:"下载 JSON",exportSuccess:"配置导出成功",exportError:"获取配置失败",enableOauthServer:"启用 OAuth 服务器",enableOauthServerDescription:"允许 MCPHub 作为 OAuth 2.0 授权服务器向外部客户端签发令牌",requireClientSecret:"需要客户端密钥",requireClientSecretDescription:"开启后,保密客户端必须携带 client secret(如需仅使用 PKCE 的公共客户端可关闭)",requireState:"要求 state 参数",requireStateDescription:"拒绝未携带 state 参数的授权请求",accessTokenLifetime:"访问令牌有效期(秒)",accessTokenLifetimeDescription:"控制访问令牌可使用的时长",accessTokenLifetimePlaceholder:"例如:3600",refreshTokenLifetime:"刷新令牌有效期(秒)",refreshTokenLifetimeDescription:"控制刷新令牌的过期时间",refreshTokenLifetimePlaceholder:"例如:1209600",authorizationCodeLifetime:"授权码有效期(秒)",authorizationCodeLifetimeDescription:"授权码在被兑换前可保持有效的时间",authorizationCodeLifetimePlaceholder:"例如:300",allowedScopes:"允许的作用域",allowedScopesDescription:"使用逗号分隔的作用域列表,在授权时展示给用户",allowedScopesPlaceholder:"例如:read, write",enableDynamicRegistration:"启用动态客户端注册",dynamicRegistrationDescription:"允许遵循 RFC 7591 的客户端通过公共端点自行注册",dynamicRegistrationAllowedGrantTypes:"允许的授权类型",dynamicRegistrationAllowedGrantTypesDescription:"使用逗号分隔动态注册客户端可以使用的授权类型",dynamicRegistrationAllowedGrantTypesPlaceholder:"例如:authorization_code, refresh_token",dynamicRegistrationAuth:"注册需要认证",dynamicRegistrationAuthDescription:"开启后,注册端点需要认证请求才能创建客户端",invalidNumberInput:"请输入合法的非负数字"},E4={upload:"上传",uploadTitle:"上传 MCPB 文件",dropFileHere:"将 .mcpb 文件拖拽到此处",orClickToSelect:"或点击从计算机选择",invalidFileType:"请选择有效的 .mcpb 文件",noFileSelected:"请选择要上传的 .mcpb 文件",uploading:"上传中...",uploadFailed:"上传 MCPB 文件失败",installServer:"从 MCPB 安装 MCP 服务器",extensionInfo:"扩展信息",name:"名称",version:"版本",description:"描述",author:"作者",tools:"工具",serverName:"服务器名称",serverNamePlaceholder:"为此服务器输入名称",install:"安装",installing:"安装中...",installFailed:"从 MCPB 安装服务器失败",serverExistsTitle:"服务器已存在",serverExistsConfirm:"服务器 '{{serverName}}' 已存在。是否要用新版本覆盖它?",override:"覆盖"},R4={button:"导入",title:"从 JSON 导入服务器",inputLabel:"服务器配置 JSON",inputHelp:"粘贴您的服务器配置 JSON。支持 STDIO、SSE 和 HTTP (streamable-http) 服务器类型。",preview:"预览",previewTitle:"预览要导入的服务器",import:"导入",importing:"导入中...",invalidFormat:"无效的 JSON 格式。JSON 必须包含 'mcpServers' 对象。",parseError:"解析 JSON 失败。请检查格式后重试。",addFailed:"添加服务器失败",importFailed:"导入服务器失败",partialSuccess:"成功导入 {{count}} / {{total}} 个服务器。部分服务器失败:"},T4={button:"导入",title:"从 JSON 导入分组",inputLabel:"分组配置 JSON",inputHelp:"粘贴您的分组配置 JSON。每个分组可以包含一个服务器列表。",preview:"预览",previewTitle:"预览要导入的分组",import:"导入",importing:"导入中...",invalidFormat:"无效的 JSON 格式。JSON 必须包含 'groups' 数组。",missingName:"每个分组必须有 'name' 字段。",parseError:"解析 JSON 失败。请检查格式后重试。",addFailed:"添加分组失败",importFailed:"导入分组失败",partialSuccess:"成功导入 {{count}} / {{total}} 个分组。部分分组失败:"},O4={add:"添加",addNew:"添加新用户",edit:"编辑用户",delete:"删除用户",create:"创建",update:"更新",username:"用户名",password:"密码",newPassword:"新密码",confirmPassword:"确认密码",changePassword:"修改密码",adminRole:"管理员",admin:"管理员",user:"用户",role:"角色",actions:"操作",addFirst:"添加第一个用户",permissions:"权限",adminPermissions:"完全系统访问权限",userPermissions:"受限访问权限",currentUser:"当前用户",noUsers:"没有找到用户",adminRequired:"需要管理员权限才能管理用户",usernameRequired:"用户名是必需的",passwordRequired:"密码是必需的",passwordTooShort:"密码至少需要6个字符",passwordMismatch:"密码不匹配",usernamePlaceholder:"输入用户名",passwordPlaceholder:"输入密码",newPasswordPlaceholder:"留空保持当前密码",confirmPasswordPlaceholder:"确认新密码",createError:"创建用户失败",updateError:"更新用户失败",deleteError:"删除用户失败",statsError:"获取用户统计失败",deleteConfirmation:"您确定要删除用户 '{{username}}' 吗?此操作无法撤消。",confirmDelete:"删除用户",deleteWarning:"您确定要删除用户 '{{username}}' 吗?此操作无法撤消。"},z4={errors:{readonly:"演示环境无法修改数据",invalid_credentials:"用户名或密码错误",serverNameRequired:"服务器名称是必需的",serverConfigRequired:"服务器配置是必需的",serverConfigInvalid:"服务器配置必须包含 URL、OpenAPI 规范 URL 或模式,或者带参数的命令",serverTypeInvalid:"服务器类型必须是以下之一:stdio、sse、streamable-http、openapi",urlRequiredForType:"{{type}} 服务器类型需要 URL",openapiSpecRequired:"openapi 服务器类型需要 OpenAPI 规范 URL 或模式",headersInvalidFormat:"请求头必须是对象格式",headersNotSupportedForStdio:"stdio 服务器类型不支持请求头",serverNotFound:"找不到服务器",failedToRemoveServer:"找不到服务器或删除失败",internalServerError:"服务器内部错误",failedToGetServers:"获取服务器信息失败",failedToGetServerSettings:"获取服务器设置失败",failedToGetServerConfig:"获取服务器配置失败",failedToSaveSettings:"保存设置失败",toolNameRequired:"服务器名称和工具名称是必需的",descriptionMustBeString:"描述必须是字符串",groupIdRequired:"分组 ID 是必需的",groupNameRequired:"分组名称是必需的",groupNotFound:"找不到分组",groupIdAndServerNameRequired:"分组 ID 和服务器名称是必需的",groupOrServerNotFound:"找不到分组或服务器",toolsMustBeAllOrArray:'工具必须是 "all" 或字符串数组',serverNameAndToolNameRequired:"服务器名称和工具名称是必需的",usernameRequired:"用户名是必需的",userNotFound:"找不到用户",failedToGetUsers:"获取用户信息失败",failedToGetUserInfo:"获取用户信息失败",failedToGetUserStats:"获取用户统计信息失败",marketServerNameRequired:"服务器名称是必需的",marketServerNotFound:"找不到市场服务器",failedToGetMarketServers:"获取市场服务器信息失败",failedToGetMarketServer:"获取市场服务器信息失败",failedToGetMarketCategories:"获取市场类别失败",failedToGetMarketTags:"获取市场标签失败",failedToSearchMarketServers:"搜索市场服务器失败",failedToFilterMarketServers:"过滤市场服务器失败",failedToProcessMcpbFile:"处理 MCPB 文件失败"},success:{serverCreated:"服务器创建成功",serverUpdated:"服务器更新成功",serverRemoved:"服务器删除成功",serverToggled:"服务器状态切换成功",toolToggled:"工具 {{name}} {{action}} 成功",toolDescriptionUpdated:"工具 {{name}} 描述更新成功",systemConfigUpdated:"系统配置更新成功",groupCreated:"分组创建成功",groupUpdated:"分组更新成功",groupDeleted:"分组删除成功",serverAddedToGroup:"服务器添加到分组成功",serverRemovedFromGroup:"服务器从分组移除成功",serverToolsUpdated:"服务器工具更新成功"}},M4={authorizationFailed:"授权失败",authorizationFailedError:"错误",authorizationFailedDetails:"详情",invalidRequest:"无效请求",missingStateParameter:"缺少必需的 OAuth 状态参数。",missingCodeParameter:"缺少必需的授权码参数。",serverNotFound:"服务器未找到",serverNotFoundMessage:"无法找到与此授权请求关联的服务器。",sessionExpiredMessage:"授权会话可能已过期。请重新进行授权。",authorizationSuccessful:"授权成功",server:"服务器",status:"状态",connected:"已连接",successMessage:"服务器已成功授权并连接。",autoCloseMessage:"此窗口将在 3 秒后自动关闭...",closeNow:"立即关闭",connectionError:"连接错误",connectionErrorMessage:"授权成功,但连接服务器失败。",reconnectMessage:"请尝试从控制面板重新连接。",configurationError:"配置错误",configurationErrorMessage:"服务器传输不支持 OAuth finishAuth()。请确保服务器配置为 streamable-http 传输。",internalError:"内部错误",internalErrorMessage:"处理 OAuth 回调时发生意外错误。",closeWindow:"关闭窗口"},P4={add:"添加提示词",addNew:"添加新提示词",edit:"编辑提示词",delete:"删除",noPrompts:"暂无内置提示词",addFirst:"添加第一个提示词",name:"名称",namePlaceholder:"例如 code-review",title:"标题",titlePlaceholder:"例如 代码审查提示词",description:"描述",descriptionPlaceholder:"提示词的简要描述",template:"模板",templatePlaceholder:"输入包含 {{parameter}} 占位符的模板文本...",templateHint:"使用 {{paramName}} 作为模板参数",arguments:"参数",addArgument:"添加参数",argName:"名称",argDescription:"描述",argRequired:"必填",enabled:"启用",active:"已启用",inactive:"已禁用",nameRequired:"名称为必填项",templateRequired:"模板为必填项",fetchError:"加载内置提示词失败",createError:"创建提示词失败",updateError:"更新提示词失败",deleteError:"删除提示词失败",saveError:"保存提示词失败",confirmDelete:"删除提示词",deleteWarning:'确定要删除提示词 "{{name}}" 吗?此操作无法撤销。'},D4={add:"添加资源",addNew:"添加新资源",edit:"编辑资源",delete:"删除",noResources:"暂无内置资源",addFirst:"添加第一个资源",uri:"URI",uriPlaceholder:"例如 resource://docs/guide",name:"名称",namePlaceholder:"例如 用户指南",description:"描述",descriptionPlaceholder:"资源的简要描述",mimeType:"MIME 类型",content:"内容",contentPlaceholder:"输入资源内容...",enabled:"启用",active:"已启用",inactive:"已禁用",descriptionUpdateSuccess:"资源描述更新成功",descriptionUpdateFailed:"更新资源描述失败",restoreDefault:"恢复默认值",restoreDefaultSuccess:"资源描述已恢复为默认值",restoreDefaultFailed:"恢复默认资源描述失败",uriRequired:"URI 为必填项",contentRequired:"内容为必填项",fetchError:"加载内置资源失败",createError:"创建资源失败",updateError:"更新资源失败",deleteError:"删除资源失败",saveError:"保存资源失败",confirmDelete:"删除资源",deleteWarning:'确定要删除资源 "{{name}}" 吗?此操作无法撤销。'},L4={title:"活动",totalCalls:"总调用次数",successCount:"成功次数",errorCount:"失败次数",avgDuration:"平均耗时",timestamp:"时间",server:"服务器",tool:"工具",duration:"耗时",status:"状态",group:"分组",key:"API密钥",input:"输入",output:"输出",details:"活动详情",errorMessage:"错误信息",searchServer:"服务器...",searchTool:"工具...",searchStatus:"状态...",searchGroup:"分组...",searchKeyName:"API密钥...",keyName:"API密钥名称",allStatus:"全部状态",statusSuccess:"成功",statusError:"失败",noData:"暂无活动数据",fetchError:"加载活动数据失败",cleanup:"清理",confirmCleanup:"确定要删除30天前的活动记录吗?",cleanupSuccess:"已删除 {{count}} 条旧记录",cleanupError:"清理旧记录失败",notAvailable:"活动跟踪功能仅在数据库模式下可用"},U4={exportButton:"导出模板",importButton:"导入模板",exportTitle:"导出配置模板",importTitle:"导入配置模板",name:"模板名称",nameRequired:"模板名称不能为空",namePlaceholder:"例如:前端开发工具",description:"描述",descriptionPlaceholder:"例如:前端开发标准 MCP 服务器集合",selectGroups:"选择分组",selectGroupsHelp:"留空则导出全部分组",selectAll:"全选",deselectAll:"取消全选",includeDisabled:"包含已禁用的服务器",exportNote:"密钥(API Key、Token、密码等)将被替换为 ${PLACEHOLDER} 占位符。接收者需要提供自己的凭据。",export:"导出",exporting:"导出中...",exportFailed:"导出模板失败",import:"导入",importing:"导入中...",importFailed:"导入模板失败",invalidFormat:"模板格式无效。必须包含 version、name、servers 和 groups 字段。",parseError:"JSON 解析失败,请检查格式后重试。",uploadFile:"上传模板文件",or:"或",pasteJson:"粘贴模板 JSON",pastePlaceholder:"在此粘贴 .mcphub-template.json 内容...",version:"版本",createdAt:"创建时间",servers:"服务器",groups:"分组",serversInGroup:"个服务器",envVarsNeeded:"所需环境变量 — 请在使用导入的服务器前设置这些变量:",importResult:"服务器:创建 {{serversCreated}} 个,跳过 {{serversSkipped}} 个。分组:创建 {{groupsCreated}} 个,跳过 {{groupsSkipped}} 个。"},_4={app:s4,about:n4,profile:l4,sponsor:i4,wechat:o4,discord:c4,theme:u4,auth:d4,server:m4,status:p4,errors:g4,common:f4,pagination:h4,nav:x4,pages:y4,logs:b4,groups:v4,market:w4,oauthServer:j4,cloud:S4,registry:N4,tool:k4,prompt:C4,settings:A4,mcpb:E4,jsonImport:R4,groupImport:T4,users:O4,api:z4,oauthCallback:M4,builtinPrompts:P4,builtinResources:D4,activity:L4,template:U4},B4={title:"Tableau de bord MCPHub",error:"Erreur",closeButton:"Fermer",noServers:"Aucun serveur MCP disponible",loading:"Chargement...",logout:"Déconnexion",profile:"Profil",changePassword:"Changer le mot de passe",toggleSidebar:"Basculer la barre latérale",welcomeUser:"Bienvenue, {{username}}",name:"MCPHub",embeddingSyncProgress:"Embeddings pour {{serverName}}",embeddingSyncProgressAriaLabel:"Création des embeddings pour {{serverName}} : {{current}} sur {{total}} terminés"},I4={title:"À propos",versionInfo:"Version MCPHub : {{version}}",newVersion:"Nouvelle version disponible !",currentVersion:"Version actuelle",newVersionAvailable:"La nouvelle version {{version}} est disponible",viewOnGitHub:"Voir sur GitHub",checkForUpdates:"Vérifier les mises à jour",checking:"Vérification des mises à jour..."},F4={viewProfile:"Voir le profil",userCenter:"Centre utilisateur"},H4={label:"Sponsor",title:"Soutenir le projet",rewardAlt:"QR Code de récompense",supportMessage:"Soutenez le développement de MCPHub en m'offrant un café !",supportButton:"Soutenir sur Ko-fi"},q4={label:"WeChat",title:"Se connecter via WeChat",qrCodeAlt:"QR Code WeChat",scanMessage:"Scannez ce QR code pour nous contacter sur WeChat"},G4={label:"Discord",title:"Rejoignez notre serveur Discord",community:"Rejoignez notre communauté grandissante sur Discord pour du support, des discussions et des mises à jour !"},K4={title:"Thème",light:"Clair",dark:"Sombre",system:"Système"},V4={login:"Connexion",loginTitle:"Se connecter à MCPHub",slogan:"Le Hub unifié pour les serveurs MCP",subtitle:"Plateforme de gestion centralisée pour les serveurs Model Context Protocol. Organisez, surveillez et mettez à l'échelle plusieurs serveurs MCP avec des stratégies de routage flexibles.",username:"Nom d'utilisateur",password:"Mot de passe",loggingIn:"Connexion en cours...",orContinue:"Ou continuer avec",loginWithGoogle:"Continuer avec Google",loginWithGithub:"Continuer avec GitHub",socialLoginFailed:"La connexion sociale a échoué. Veuillez réessayer.",emptyFields:"Le nom d'utilisateur et le mot de passe ne peuvent pas être vides",loginFailed:"Échec de la connexion, veuillez vérifier votre nom d'utilisateur et votre mot de passe",loginError:"Une erreur est survenue lors de la connexion",serverUnavailable:"Impossible de se connecter au serveur. Veuillez vérifier votre connexion réseau ou réessayer plus tard",currentPassword:"Mot de passe actuel",newPassword:"Nouveau mot de passe",confirmPassword:"Confirmer le mot de passe",passwordsNotMatch:"Le nouveau mot de passe et la confirmation ne correspondent pas",changePasswordSuccess:"Mot de passe changé avec succès",changePasswordError:"Échec du changement de mot de passe",changePassword:"Changer le mot de passe",passwordChanged:"Mot de passe changé avec succès",passwordChangeError:"Échec du changement de mot de passe",defaultPasswordWarning:"Avertissement de sécurité du mot de passe par défaut",defaultPasswordMessage:"Vous utilisez le mot de passe par défaut (admin123), ce qui présente un risque de sécurité. Veuillez changer votre mot de passe immédiatement pour protéger votre compte.",goToSettings:"Aller aux paramètres",passwordStrengthError:"Le mot de passe ne répond pas aux exigences de sécurité",passwordMinLength:"Le mot de passe doit contenir au moins 8 caractères",passwordRequireLetter:"Le mot de passe doit contenir au moins une lettre",passwordRequireNumber:"Le mot de passe doit contenir au moins un chiffre",passwordRequireSpecial:"Le mot de passe doit contenir au moins un caractère spécial",passwordStrengthHint:"Le mot de passe doit contenir au moins 8 caractères et inclure des lettres, des chiffres et des caractères spéciaux"},$4={addServer:"Ajouter un serveur",add:"Ajouter",edit:"Modifier",copy:"Copier",delete:"Supprimer",confirmDelete:"Êtes-vous sûr de vouloir supprimer ce serveur ?",deleteWarning:"La suppression du serveur '{{name}}' le supprimera ainsi que toutes ses données. Cette action est irréversible.",status:"Statut",tools:"Outils",prompts:"Invites",name:"Nom du serveur",description:"Note du serveur",descriptionPlaceholder:"Optionnel : décrivez l'utilité de ce serveur",url:"URL du serveur",apiKey:"Clé API",save:"Enregistrer",cancel:"Annuler",invalidConfig:"Impossible de trouver les données de configuration pour {{serverName}}",addError:"Échec de l'ajout du serveur",editError:"Échec de la modification du serveur {{serverName}}",deleteError:"Échec de la suppression du serveur {{serverName}}",updateError:"Échec de la mise à jour du serveur",editTitle:"Modifier le serveur : {{serverName}}",type:"Type de serveur",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"HTTP diffusable",typeOpenapi:"OpenAPI",command:"Commande",arguments:"Arguments",envVars:"Variables d'environnement",headers:"En-têtes HTTP",key:"clé",value:"valeur",enabled:"Activé",enable:"Activer",disable:"Désactiver",reload:"Recharger",reloadSuccess:"Serveur rechargé avec succès",reloadError:"Échec du rechargement du serveur {{serverName}}",requestOptions:"Configuration de la connexion",timeout:"Délai d'attente de la requête",timeoutDescription:"Délai d'attente pour les requêtes vers le serveur MCP (ms)",maxTotalTimeout:"Délai d'attente total maximum",maxTotalTimeoutDescription:"Délai d'attente total maximum pour les requêtes envoyées au serveur MCP (ms) (à utiliser avec les notifications de progression)",resetTimeoutOnProgress:"Réinitialiser le délai d'attente en cas de progression",resetTimeoutOnProgressDescription:"Réinitialiser le délai d'attente lors des notifications de progression (activé par défaut)",keepAlive:"Configuration du maintien de connexion",enableKeepAlive:"Activer le maintien de connexion",keepAliveDescription:"Envoyer des requêtes ping périodiques pour maintenir la connexion. Utile pour les connexions de longue durée qui peuvent expirer.",keepAliveInterval:"Intervalle (ms)",keepAliveIntervalDescription:"Temps entre les pings de maintien de connexion en millisecondes (par défaut : 60000ms = 1 minute)",remove:"Retirer",toggleError:"Échec du basculement du serveur {{serverName}}",alreadyExists:"Le serveur {{serverName}} existe déjà",invalidData:"Données de serveur invalides fournies",notFound:"Serveur {{serverName}} non trouvé",namePlaceholder:"Entrez le nom du serveur",urlPlaceholder:"Entrez l'URL du serveur",commandPlaceholder:"Entrez la commande",argumentsPlaceholder:"Entrez les arguments",errorDetails:"Détails de l'erreur",viewErrorDetails:"Voir les détails de l'erreur",copyConfig:"Copier la configuration",confirmVariables:"Confirmer la configuration des variables",variablesDetected:"Variables détectées dans la configuration. Veuillez confirmer que ces variables sont correctement configurées :",detectedVariables:"Variables détectées",confirmVariablesMessage:"Veuillez vous assurer que ces variables sont correctement définies dans votre environnement d'exécution. Continuer l'ajout du serveur ?",confirmAndAdd:"Confirmer et ajouter",openapi:{inputMode:"Mode de saisie",inputModeUrl:"URL de la spécification",inputModeSchema:"Schéma JSON",specUrl:"URL de la spécification OpenAPI",schema:"Schéma JSON OpenAPI",schemaHelp:"Collez votre schéma JSON OpenAPI complet ici",security:"Type de sécurité",securityNone:"Aucun",securityApiKey:"Clé API",securityHttp:"Authentification HTTP",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"Configuration de la clé API",apiKeyName:"Nom de l'en-tête/paramètre",apiKeyIn:"Emplacement",apiKeyValue:"Valeur de la clé API",httpAuthConfig:"Configuration de l'authentification HTTP",httpScheme:"Schéma d'authentification",httpCredentials:"Identifiants",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"Configuration OAuth 2.0",oauth2Token:"Jeton d'accès",openIdConnectConfig:"Configuration OpenID Connect",openIdConnectUrl:"URL de découverte",openIdConnectToken:"Jeton d'identification",apiKeyInHeader:"En-tête",apiKeyInQuery:"Requête",apiKeyInCookie:"Cookie",passthroughHeaders:"En-têtes de transmission",passthroughHeadersHelp:"Liste séparée par des virgules des noms d’en-têtes à transmettre des requêtes MCP entrantes vers les requêtes du serveur en amont (par ex. : Authorization, X-API-Key)"},oauth:{sectionTitle:"Configuration OAuth",sectionDescription:"Configurez les identifiants client pour les serveurs protégés par OAuth (optionnel).",clientId:"Identifiant client",clientSecret:"Secret client",authorizationEndpoint:"Point de terminaison d'autorisation",tokenEndpoint:"Point de terminaison de jeton",scopes:"Scopes",scopesPlaceholder:"scope1 scope2",resource:"Ressource / Audience",accessToken:"Jeton d'accès",refreshToken:"Jeton d'actualisation"}},Y4={online:"En ligne",offline:"Hors ligne",connecting:"Connexion en cours",oauthRequired:"OAuth requis",clickToAuthorize:"Cliquez pour autoriser avec OAuth",oauthWindowOpened:"Fenêtre d'autorisation OAuth ouverte. Veuillez compléter l'autorisation."},J4={general:"Une erreur est survenue",network:"Erreur de connexion réseau. Veuillez vérifier votre connexion Internet",serverConnection:"Impossible de se connecter au serveur. Veuillez vérifier si le serveur est en cours d'exécution",serverAdd:"Échec de l'ajout du serveur. Veuillez vérifier l'état du serveur",serverUpdate:"Échec de la modification du serveur {{serverName}}. Veuillez vérifier l'état du serveur",serverFetch:"Échec de la récupération des données du serveur. Veuillez réessayer plus tard",failedToReloadServer:"Échec du rechargement du serveur",initialStartup:"Le serveur est peut-être en cours de démarrage. Veuillez patienter un instant car ce processus peut prendre du temps au premier lancement...",serverInstall:"Échec de l'installation du serveur",failedToFetchSettings:"Échec de la récupération des paramètres",failedToUpdateRouteConfig:"Échec de la mise à jour de la configuration de routage",failedToUpdateSmartRoutingConfig:"Échec de la mise à jour de la configuration du routage intelligent"},Q4={processing:"En cours de traitement...",save:"Enregistrer",cancel:"Annuler",back:"Retour",refresh:"Actualiser",search:"Rechercher",clear:"Effacer",view:"Voir",create:"Créer",creating:"Création en cours...",update:"Mettre à jour",updating:"Mise à jour en cours...",submitting:"Envoi en cours...",delete:"Supprimer",remove:"Retirer",copy:"Copier",copyId:"Copier l'ID",copyUrl:"Copier l'URL",copyJson:"Copier le JSON",copySuccess:"Copié dans le presse-papiers",copyFailed:"Échec de la copie",copied:"Copié",close:"Fermer",confirm:"Confirmer",language:"Langue",true:"Vrai",false:"Faux",dismiss:"Rejeter",github:"GitHub",wechat:"WeChat",discord:"Discord",itemsPerPage:"Éléments par page",showing:"Affichage de {{start}}-{{end}} sur {{total}}",previous:"Précédent",next:"Suivant",required:"Requis",secret:"Secret",default:"Défaut",value:"Valeur",type:"Type",repeated:"Répété",valueHint:"Indice de valeur",choices:"Choix",actions:"Actions",saving:"Enregistrement...",active:"Actif",inactive:"Inactif"},X4={rowsPerPage:"Lignes par page",showing:"Affichage de {{from}}-{{to}} sur {{total}}"},Z4={dashboard:"Tableau de bord",servers:"Serveurs",groups:"Groupes",prompts:"Prompts",resources:"Ressources",users:"Utilisateurs",settings:"Paramètres",changePassword:"Changer le mot de passe",market:"Marché",cloud:"Marché Cloud",logs:"Journaux",activity:"Activité"},W4={dashboard:{title:"Tableau de bord",totalServers:"Total",onlineServers:"En ligne",disabledServers:"Désactivés",offlineServers:"Hors ligne",connectingServers:"En connexion",recentServers:"Serveurs récents"},servers:{title:"Gestion des serveurs"},groups:{title:"Gestion des groupes"},prompts:{title:"Prompts intégrés"},resources:{title:"Ressources intégrées"},users:{title:"Gestion des utilisateurs"},settings:{title:"Paramètres",language:"Langue",account:"Paramètres du compte",password:"Changer le mot de passe",appearance:"Apparence",routeConfig:"Sécurité",installConfig:"Installation",smartRouting:"Routage intelligent",oauthServer:"Serveur OAuth"},market:{title:"Marché Hub - Marchés locaux et Cloud"},logs:{title:"Journaux système"}},eC={filters:"Filtres",search:"Rechercher dans les journaux...",autoScroll:"Défilement automatique",clearLogs:"Effacer les journaux",loading:"Chargement des journaux...",noLogs:"Aucun journal disponible.",noMatch:"Aucun journal ne correspond aux filtres actuels.",mainProcess:"Processus principal",childProcess:"Processus enfant",main:"Principal",child:"Enfant"},tC={add:"Ajouter",addNew:"Ajouter un nouveau groupe",edit:"Modifier le groupe",delete:"Supprimer",confirmDelete:"Êtes-vous sûr de vouloir supprimer ce groupe ?",deleteWarning:"La suppression du groupe '{{name}}' le supprimera ainsi que toutes ses associations de serveurs. Cette action est irréversible.",name:"Nom du groupe",namePlaceholder:"Entrez le nom du groupe",nameRequired:"Le nom du groupe est requis",description:"Description",descriptionPlaceholder:"Entrez la description du groupe (facultatif)",createError:"Échec de la création du groupe",updateError:"Échec de la mise à jour du groupe",deleteError:"Échec de la suppression du groupe",serverAddError:"Échec de l'ajout du serveur au groupe",serverRemoveError:"Échec de la suppression du serveur du groupe",addServer:"Ajouter un serveur au groupe",selectServer:"Sélectionnez un serveur à ajouter",servers:"Serveurs dans le groupe",remove:"Retirer",noGroups:"Aucun groupe disponible. Créez un nouveau groupe pour commencer.",noServers:"Aucun serveur dans ce groupe.",noServerOptions:"Aucun serveur disponible",serverCount:"{{count}} serveurs",toolSelection:"Sélection d'outils",promptSelection:"Sélection des prompts",resourceSelection:"Sélection des ressources",toolsSelected:"Sélectionné",promptsSelected:"Sélectionné",resourcesSelected:"Sélectionné",allTools:"Tous",allPrompts:"Tous les prompts",allResources:"Toutes les ressources",selectedTools:"Outils sélectionnés",selectedPrompts:"Prompts sélectionnés",selectedResources:"Ressources sélectionnées",selectAll:"Tout sélectionner",selectNone:"Ne rien sélectionner",configureTools:"Configurer les outils",configureCapabilities:"Configurer les outils, prompts et ressources",previewPrompts:"[prompts : {{items}}]",previewResources:"[ressources : {{items}}]",previewAllTools:"(tous les outils)",previewAllPrompts:"(tous les prompts)",previewAllResources:"(toutes les ressources)"},rC={title:"Installation locale",official:"Officiel",by:"Par",unknown:"Inconnu",tools:"outils",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs par nom, catégorie ou tags",clearFilters:"Effacer",clearCategoryFilter:"",clearTagFilter:"",categories:"Catégories",tags:"Tags",showTags:"Afficher les tags",hideTags:"Masquer les tags",moreTags:"",noServers:"Aucun serveur trouvé correspondant à votre recherche",backToList:"Retour à la liste",install:"Installer",installing:"Installation en cours...",installed:"Installé",installServer:"Installer le serveur : {{name}}",installSuccess:"Serveur {{serverName}} installé avec succès",author:"Auteur",license:"Licence",repository:"Dépôt",examples:"Exemples",arguments:"Arguments",argumentName:"Nom",description:"Description",required:"Requis",example:"Exemple",viewSchema:"Voir le schéma",fetchError:"Erreur lors de la récupération des serveurs du marché",serverNotFound:"Serveur non trouvé",searchError:"Erreur lors de la recherche de serveurs",filterError:"Erreur lors du filtrage des serveurs par catégorie",tagFilterError:"Erreur lors du filtrage des serveurs par tag",noInstallationMethod:"Aucune méthode d'installation disponible pour ce serveur",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs",perPage:"Par page",confirmVariablesMessage:"Veuillez vous assurer que ces variables sont correctement définies dans votre environnement d'exécution. Continuer l'installation du serveur ?",confirmAndInstall:"Confirmer et installer"},aC={authorizeTitle:"Autoriser l'application",authorizeSubtitle:"Autorisez cette application à accéder à votre compte MCPHub.",buttons:{approve:"Autoriser l'accès",deny:"Refuser",approveSubtitle:"Recommandé si vous faites confiance à cette application.",denySubtitle:"Vous pourrez toujours accorder l'accès plus tard."}},sC={title:"Support Cloud",subtitle:"Propulsé par MCPRouter",by:"Par",server:"Serveur",config:"Config",created:"Créé",updated:"Mis à jour",available:"Disponible",description:"Description",details:"Détails",tools:"Outils",tool:"outil",toolsAvailable:"{{count}} outil disponible||{{count}} outils disponibles",loadingTools:"Chargement des outils...",noTools:"Aucun outil disponible pour ce serveur",noDescription:"Aucune description disponible",viewDetails:"Voir les détails",parameters:"Paramètres",result:"Résultat",error:"Erreur",callTool:"Appeler",calling:"Appel en cours...",toolCallSuccess:"L'outil {{toolName}} a été exécuté avec succès",toolCallError:"Échec de l'appel de l'outil {{toolName}} : {{error}}",viewSchema:"Voir le schéma",backToList:"Retour au marché Cloud",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs cloud par nom, titre ou auteur",clearFilters:"Effacer les filtres",clearCategoryFilter:"Effacer",clearTagFilter:"Effacer",categories:"Catégories",tags:"Tags",noCategories:"Aucune catégorie trouvée",noTags:"Aucun tag trouvé",noServers:"Aucun serveur cloud trouvé",fetchError:"Erreur lors de la récupération des serveurs cloud",serverNotFound:"Serveur cloud non trouvé",searchError:"Erreur lors de la recherche de serveurs cloud",filterError:"Erreur lors du filtrage des serveurs cloud par catégorie",tagFilterError:"Erreur lors du filtrage des serveurs cloud par tag",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs cloud",perPage:"Par page",apiKeyNotConfigured:"Clé API MCPRouter non configurée",apiKeyNotConfiguredDescription:"Pour utiliser les serveurs cloud, vous devez configurer votre clé API MCPRouter.",getApiKey:"Obtenir une clé API",configureInSettings:"Configurer dans les paramètres",installServer:"Installer {{name}}",installSuccess:"Serveur {{name}} installé avec succès",installError:"Échec de l'installation du serveur : {{error}}"},nC={title:"Registre",official:"Officiel",latest:"Dernière version",description:"Description",website:"Site web",repository:"Dépôt",packages:"Paquets",package:"paquet",remotes:"Services distants",remote:"service distant",published:"Publié",updated:"Mis à jour",install:"Installer",installing:"Installation...",installed:"Installé",installServer:"Installer {{name}}",installSuccess:"Serveur {{name}} installé avec succès",installError:"Échec de l'installation du serveur : {{error}}",noDescription:"Aucune description disponible",viewDetails:"Voir les détails",backToList:"Retour au registre",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs par nom",clearFilters:"Effacer",noServers:"Aucun serveur trouvé dans le registre",fetchError:"Erreur lors de la récupération des serveurs du registre",serverNotFound:"Serveur du registre non trouvé",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs du registre",perPage:"Par page",environmentVariables:"Variables d'environnement",packageArguments:"Arguments du paquet",runtimeArguments:"Arguments d'exécution",headers:"En-têtes"},lC={run:"Exécuter",running:"Exécution en cours...",runTool:"Exécuter l'outil",cancel:"Annuler",noDescription:"Aucune description disponible",inputSchema:"Schéma d'entrée :",runToolWithName:"Exécuter l'outil : {{name}}",execution:"Exécution de l'outil",successful:"Réussi",failed:"Échoué",result:"Résultat :",error:"Erreur",errorDetails:"Détails de l'erreur :",noContent:"L'outil a été exécuté avec succès mais n'a renvoyé aucun contenu.",unknownError:"Une erreur inconnue est survenue",jsonResponse:"Réponse JSON :",toolResult:"Résultat de l'outil",noParameters:"Cet outil ne nécessite aucun paramètre.",selectOption:"Sélectionnez une option",enterValue:"Entrez la valeur {{type}}",enabled:"Activé",enableSuccess:"Outil {{name}} activé avec succès",disableSuccess:"Outil {{name}} désactivé avec succès",toggleFailed:"Échec du basculement de l'état de l'outil",descriptionUpdateSuccess:"Description de l'outil mise à jour avec succès",descriptionUpdateFailed:"Échec de la mise à jour de la description de l'outil",restoreDefault:"Restaurer par défaut",restoreDefaultSuccess:"La description de l'outil a été restaurée à sa valeur par défaut",restoreDefaultFailed:"Échec de la restauration de la description par défaut de l'outil",parameters:"Paramètres de l'outil",formMode:"Mode formulaire",jsonMode:"Mode JSON",jsonConfiguration:"Configuration JSON",invalidJsonFormat:"Format JSON invalide",fixJsonBeforeSwitching:"Veuillez corriger le format JSON avant de passer en mode formulaire",item:"Élément {{index}}",addItem:"Ajouter un élément {{key}}",enterKey:"Entrez {{key}}"},iC={run:"Obtenir",running:"Obtention en cours...",result:"Résultat de l'invite",error:"Erreur de l'invite",execution:"Exécution de l'invite",successful:"Réussi",failed:"Échoué",errorDetails:"Détails de l'erreur :",noContent:"L'invite a été exécutée avec succès mais n'a renvoyé aucun contenu.",unknownError:"Une erreur inconnue est survenue",jsonResponse:"Réponse JSON :",description:"Description",messages:"Messages",noDescription:"Aucune description disponible",runPromptWithName:"Obtenir l'invite : {{name}}",descriptionUpdateSuccess:"Description de l'invite mise à jour avec succès",descriptionUpdateFailed:"Échec de la mise à jour de la description de l'invite",restoreDefault:"Restaurer par défaut",restoreDefaultSuccess:"La description de l'invite a été restaurée à sa valeur par défaut",restoreDefaultFailed:"Échec de la restauration de la description par défaut de l'invite"},oC=JSON.parse(`{"enableGlobalRoute":"Activer la route globale","enableGlobalRouteDescription":"Autoriser les connexions au point de terminaison /sse sans spécifier d'ID de groupe","enableGroupNameRoute":"Activer la route par nom de groupe","enableGroupNameRouteDescription":"Autoriser les connexions au point de terminaison /sse en utilisant les noms de groupe au lieu des ID de groupe","enableBearerAuth":"Activer l'authentification Bearer","enableBearerAuthDescription":"Exiger une authentification par jeton Bearer pour les points de terminaison MCP (activé par défaut)","bearerAuthKey":"Clé d'authentification Bearer","bearerAuthKeyDescription":"La clé d'authentification qui sera requise dans le jeton Bearer","bearerAuthKeyPlaceholder":"Entrez la clé d'authentification Bearer","bearerAuthHeaderName":"Nom de l'en-tête Bearer","bearerAuthHeaderNameDescription":"Nom de l'en-tête utilisé pour recevoir les identifiants Bearer MCP. Modifiez-le si les en-têtes transmis en amont utilisent aussi Authorization.","bearerAuthHeaderNamePlaceholder":"ex. Authorization ou X-MCP-Authorization","bearerKeysSectionTitle":"Clés","bearerKeysSectionDescription":"Gérez plusieurs clés avec différentes portées d’accès.","noBearerKeys":"Aucune clé configurée pour le moment.","bearerKeyName":"Nom","bearerKeyToken":"Jeton","bearerKeyEnabled":"Activée","bearerKeyAccessType":"Portée d’accès","bearerKeyAccessAll":"Toutes","bearerKeyAccessGroups":"Groupes","bearerKeyAccessServers":"Serveurs","bearerKeyAccessCustom":"Personnalisée","bearerKeyAllowedGroups":"Groupes autorisés","bearerKeyAllowedServers":"Serveurs autorisés","addBearerKey":"Ajouter une clé","addBearerKeyButton":"Créer","bearerKeyRequired":"Le nom et le jeton sont obligatoires","deleteBearerKeyConfirm":"Voulez-vous vraiment supprimer cette clé ?","generate":"Générer","selectGroups":"Sélectionner des groupes","selectServers":"Sélectionner des serveurs","selectAtLeastOneGroup":"Veuillez sélectionner au moins un groupe","selectAtLeastOneServer":"Veuillez sélectionner au moins un serveur","skipAuth":"Ignorer l'authentification","skipAuthDescription":"Autoriser l'accès au tableau de bord sans connexion (n'affecte pas l'auth MCP)","jsonBodyLimit":"Limite de taille du corps JSON","jsonBodyLimitDescription":"Limite de taille des requêtes JSON Express. Les gros téléchargements de schémas OpenAPI utilisent aussi ce paramètre.","jsonBodyLimitPlaceholder":"ex. 1mb, 5mb, 1024kb","pythonIndexUrl":"URL du dépôt de paquets Python","pythonIndexUrlDescription":"Définir la variable d'environnement UV_DEFAULT_INDEX pour l'installation de paquets Python","pythonIndexUrlPlaceholder":"ex. https://pypi.org/simple","npmRegistry":"URL du registre NPM","npmRegistryDescription":"Définir la variable d'environnement npm_config_registry pour l'installation de paquets NPM","npmRegistryPlaceholder":"ex. https://registry.npmjs.org/","baseUrl":"URL de base","baseUrlDescription":"URL de base pour les requêtes MCP et les callbacks OAuth","baseUrlPlaceholder":"ex. http://localhost:3000","installConfig":"Installation","systemConfigUpdated":"Configuration système mise à jour avec succès","enableSmartRouting":"Activer le routage intelligent","enableSmartRoutingDescription":"Activer la fonctionnalité de routage intelligent pour rechercher l'outil le plus approprié en fonction de l'entrée (en utilisant le nom de groupe $smart)","dbUrl":"URL PostgreSQL (nécessite le support de pgvector)","dbUrlPlaceholder":"ex. postgresql://user:password@localhost:5432/dbname","embeddingProvider":"Fournisseur d'embeddings","openaiApiBaseUrl":"URL de base compatible OpenAI","openaiApiBaseUrlPlaceholder":"https://api.openai.com/v1","openaiApiKey":"Clé API du fournisseur LLM","openaiApiKeyPlaceholder":"Entrez la clé API du fournisseur LLM","openaiApiEmbeddingModel":"Nom du modèle d'intégration","openaiApiEmbeddingModelPlaceholder":"text-embedding-3-small","basePacingDelayMs":"Délai de pacing de base (ms)","basePacingDelayMsDescription":"Délai de base entre les requêtes d'embeddings envoyées au fournisseur. Par défaut 0 — le système gère les limites de débit automatiquement : il respecte les en-têtes Retry-After, applique un délai de 63 secondes en l'absence d'en-tête, et augmente le pacing après chaque réponse 403/429. Définissez une valeur non nulle uniquement si votre fournisseur impose un intervalle minimum fixe.","basePacingDelayMsPlaceholder":"Vide = valeur par défaut 0 ms","basePacingDelayMsAuto":"Par défaut ({{value}} ms) : la gestion des limites de débit est automatique.","basePacingDelayMsZero":"0 ms (par défaut) : la gestion des limites de débit est automatique via throttling adaptatif et logique de retry.","basePacingDelayMsOverride":"Valeur personnalisée : remplace le délai de pacing de base par défaut.","embeddingEncodingFormat":"Format d'encodage des embeddings","embeddingEncodingFormatDescription":"Format d'encodage pour les vecteurs d'embedding. Auto détectera en fonction du support du fournisseur.","embeddingEncodingFormatAuto":"Auto (Recommandé)","azureOpenaiEndpoint":"Point de terminaison Azure OpenAI","azureOpenaiEndpointPlaceholder":"https://VOTRE_NOM_DE_RESSOURCE.openai.azure.com","azureOpenaiApiKey":"Clé API Azure OpenAI","azureOpenaiApiKeyPlaceholder":"Entrez la clé API Azure OpenAI","azureOpenaiApiVersion":"Version de l'API Azure OpenAI","azureOpenaiApiVersionPlaceholder":"2024-02-15-preview","azureOpenaiEmbeddingDeployment":"Déploiement d'embeddings Azure OpenAI","azureOpenaiEmbeddingDeploymentPlaceholder":"text-embedding-3-small","azureOpenaiEmbeddingModel":"Nom du modèle d'embedding Azure","azureOpenaiEmbeddingModelDescription":"Le nom réel du modèle OpenAI déployé dans Azure (ex. text-embedding-3-small). Utilisé pour le comptage précis des tokens avant l'envoi à l'API.","azureOpenaiEmbeddingModelPlaceholder":"text-embedding-3-small","smartRoutingConfigUpdated":"Configuration du routage intelligent mise à jour avec succès","progressiveDisclosure":"Divulgation progressive","progressiveDisclosureDescription":"Lorsqu'elle est activée, search_tools renvoie uniquement les noms et descriptions des outils. Utilisez describe_tool pour obtenir le schéma complet des paramètres, réduisant ainsi l'utilisation des tokens.","embeddingMaxTokens":"Tokens max pour les embeddings","embeddingMaxTokensDescription":"Nombre maximum de tokens pour la troncature du texte avant la génération des embeddings. Laissez vide pour utiliser automatiquement la valeur par défaut du modèle. Une valeur personnalisée remplace toujours la valeur par défaut du modèle. La configuration manuelle de cette valeur est particulièrement utile lors de l'utilisation de fournisseurs LLM locaux pour éviter les erreurs de troncature.","embeddingMaxTokensPlaceholder":"Vide = automatique selon le modèle","embeddingMaxTokensAuto":"Auto : {{limit}} tokens (valeur par défaut du modèle {{model}})","embeddingMaxTokensOverride":"Cette valeur remplace la valeur par défaut du modèle.","smartRoutingRequiredFields":"L'URL de la base de données est requise pour activer le routage intelligent. Une clé API du fournisseur LLM est requise pour les fournisseurs cloud (les LLM locaux ne nécessitent généralement pas de clé API, entrez n'importe quelle valeur pour passer la validation du formulaire)","smartRoutingValidationError":"Veuillez remplir les champs obligatoires avant d'activer le routage intelligent : {{fields}}","mcpRouterConfig":"Marché Cloud","mcpRouterApiKey":"Clé API MCPRouter","mcpRouterApiKeyDescription":"Clé API pour accéder aux services du marché cloud MCPRouter","mcpRouterApiKeyPlaceholder":"Entrez la clé API MCPRouter","mcpRouterReferer":"Référent","mcpRouterRefererDescription":"En-tête Referer pour les requêtes API MCPRouter","mcpRouterRefererPlaceholder":"https://www.mcphub.app","mcpRouterTitle":"Titre","mcpRouterTitleDescription":"En-tête Title pour les requêtes API MCPRouter","mcpRouterTitlePlaceholder":"MCPHub","mcpRouterBaseUrl":"URL de base","mcpRouterBaseUrlDescription":"URL de base pour l'API MCPRouter","mcpRouterBaseUrlPlaceholder":"https://api.mcprouter.to/v1","systemSettings":"Paramètres système","nameSeparatorLabel":"Séparateur de noms","nameSeparatorDescription":"Caractère utilisé pour séparer le nom du serveur et le nom de l'outil/prompt (par défaut : -)","enableSessionRebuild":"Activer la reconstruction de session serveur","enableSessionRebuildDescription":"Lorsqu'il est activé, applique le code de reconstruction de session serveur amélioré pour une meilleure expérience de gestion de session","restartRequired":"Configuration enregistrée. Il est recommandé de redémarrer l'application pour s'assurer que tous les services chargent correctement les nouveaux paramètres.","exportMcpSettings":"Exporter les paramètres","mcpSettingsJson":"JSON des paramètres MCP","mcpSettingsJsonDescription":"Afficher, copier ou télécharger votre configuration mcp_settings.json actuelle pour la sauvegarde ou la migration vers d'autres outils","copyToClipboard":"Copier dans le presse-papiers","downloadJson":"Télécharger JSON","exportSuccess":"Paramètres exportés avec succès","exportError":"Échec de la récupération des paramètres","enableOauthServer":"Activer le serveur OAuth","enableOauthServerDescription":"Permet à MCPHub d'émettre des jetons OAuth pour les clients externes","requireClientSecret":"Exiger un secret client","requireClientSecretDescription":"Lorsque activé, les clients confidentiels doivent présenter un client secret (désactivez-le pour les clients PKCE publics)","requireState":"Exiger le paramètre state","requireStateDescription":"Refuser les demandes d'autorisation qui n'incluent pas le paramètre state","accessTokenLifetime":"Durée de vie du jeton d'accès (secondes)","accessTokenLifetimeDescription":"Durée pendant laquelle les jetons d'accès émis restent valides","accessTokenLifetimePlaceholder":"ex. 3600","refreshTokenLifetime":"Durée de vie du jeton d'actualisation (secondes)","refreshTokenLifetimeDescription":"Durée pendant laquelle les jetons d'actualisation restent valides","refreshTokenLifetimePlaceholder":"ex. 1209600","authorizationCodeLifetime":"Durée de vie du code d'autorisation (secondes)","authorizationCodeLifetimeDescription":"Temps pendant lequel les codes d'autorisation peuvent être échangés","authorizationCodeLifetimePlaceholder":"ex. 300","allowedScopes":"Scopes autorisés","allowedScopesDescription":"Liste séparée par des virgules des scopes que les utilisateurs peuvent approuver","allowedScopesPlaceholder":"ex. read, write","enableDynamicRegistration":"Activer l'enregistrement dynamique","dynamicRegistrationDescription":"Autoriser les clients conformes RFC 7591 à s'enregistrer via l'endpoint public","dynamicRegistrationAllowedGrantTypes":"Types de flux autorisés","dynamicRegistrationAllowedGrantTypesDescription":"Liste séparée par des virgules des types de flux disponibles pour les clients enregistrés dynamiquement","dynamicRegistrationAllowedGrantTypesPlaceholder":"ex. authorization_code, refresh_token","dynamicRegistrationAuth":"Exiger une authentification","dynamicRegistrationAuthDescription":"Protège l'endpoint d'enregistrement afin que seules les requêtes authentifiées puissent créer des clients","invalidNumberInput":"Veuillez saisir un nombre valide supérieur ou égal à zéro"}`),cC={upload:"Télécharger",uploadTitle:"Télécharger le bundle MCPB",dropFileHere:"Déposez votre fichier .mcpb ici",orClickToSelect:"ou cliquez pour sélectionner depuis votre ordinateur",invalidFileType:"Veuillez sélectionner un fichier .mcpb valide",noFileSelected:"Veuillez sélectionner un fichier .mcpb à télécharger",uploading:"Téléchargement en cours...",uploadFailed:"Échec du téléchargement du fichier MCPB",installServer:"Installer le serveur MCP depuis MCPB",extensionInfo:"Informations sur l'extension",name:"Nom",version:"Version",description:"Description",author:"Auteur",tools:"Outils",serverName:"Nom du serveur",serverNamePlaceholder:"Entrez un nom pour ce serveur",install:"Installer",installing:"Installation en cours...",installFailed:"Échec de l'installation du serveur depuis MCPB",serverExistsTitle:"Le serveur existe déjà",serverExistsConfirm:"Le serveur '{{serverName}}' existe déjà. Voulez-vous le remplacer par la nouvelle version ?",override:"Remplacer"},uC={button:"Importer",title:"Importer des serveurs depuis JSON",inputLabel:"Configuration JSON du serveur",inputHelp:"Collez votre configuration JSON de serveur. Prend en charge les types de serveurs STDIO, SSE et HTTP (streamable-http).",preview:"Aperçu",previewTitle:"Aperçu des serveurs à importer",import:"Importer",importing:"Importation en cours...",invalidFormat:"Format JSON invalide. Le JSON doit contenir un objet 'mcpServers'.",parseError:"Échec de l'analyse du JSON. Veuillez vérifier le format et réessayer.",addFailed:"Échec de l'ajout du serveur",importFailed:"Échec de l'importation des serveurs",partialSuccess:"{{count}} serveur(s) sur {{total}} importé(s) avec succès. Certains serveurs ont échoué :"},dC={button:"Importer",title:"Importer des groupes depuis JSON",inputLabel:"Configuration JSON des groupes",inputHelp:"Collez votre configuration JSON de groupes. Chaque groupe peut contenir une liste de serveurs.",preview:"Aperçu",previewTitle:"Aperçu des groupes à importer",import:"Importer",importing:"Importation en cours...",invalidFormat:"Format JSON invalide. Le JSON doit contenir un tableau 'groups'.",missingName:"Chaque groupe doit avoir un champ 'name'.",parseError:"Échec de l'analyse du JSON. Veuillez vérifier le format et réessayer.",addFailed:"Échec de l'ajout du groupe",importFailed:"Échec de l'importation des groupes",partialSuccess:"{{count}} groupe(s) sur {{total}} importé(s) avec succès. Certains groupes ont échoué :"},mC={add:"Ajouter un utilisateur",addNew:"Ajouter un nouvel utilisateur",edit:"Modifier l'utilisateur",delete:"Supprimer l'utilisateur",create:"Créer un utilisateur",update:"Mettre à jour l'utilisateur",username:"Nom d'utilisateur",password:"Mot de passe",newPassword:"Nouveau mot de passe",confirmPassword:"Confirmer le mot de passe",changePassword:"Changer le mot de passe",adminRole:"Administrateur",admin:"Admin",user:"Utilisateur",role:"Rôle",actions:"Actions",addFirst:"Ajoutez votre premier utilisateur",permissions:"Permissions",adminPermissions:"Accès complet au système",userPermissions:"Accès limité",currentUser:"Vous",noUsers:"Aucun utilisateur trouvé",adminRequired:"Un accès administrateur est requis pour gérer les utilisateurs",usernameRequired:"Le nom d'utilisateur est requis",passwordRequired:"Le mot de passe est requis",passwordTooShort:"Le mot de passe doit comporter au moins 6 caractères",passwordMismatch:"Les mots de passe ne correspondent pas",usernamePlaceholder:"Entrez le nom d'utilisateur",passwordPlaceholder:"Entrez le mot de passe",newPasswordPlaceholder:"Laissez vide pour conserver le mot de passe actuel",confirmPasswordPlaceholder:"Confirmez le nouveau mot de passe",createError:"Échec de la création de l'utilisateur",updateError:"Échec de la mise à jour de l'utilisateur",deleteError:"Échec de la suppression de l'utilisateur",statsError:"Échec de la récupération des statistiques utilisateur",deleteConfirmation:"Êtes-vous sûr de vouloir supprimer l'utilisateur '{{username}}' ? Cette action est irréversible.",confirmDelete:"Supprimer l'utilisateur",deleteWarning:"Êtes-vous sûr de vouloir supprimer l'utilisateur '{{username}}' ? Cette action est irréversible."},pC={errors:{readonly:"Lecture seule pour l'environnement de démonstration",invalid_credentials:"Nom d'utilisateur ou mot de passe invalide",serverNameRequired:"Le nom du serveur est requis",serverConfigRequired:"La configuration du serveur est requise",serverConfigInvalid:"La configuration du serveur doit inclure une URL, une URL de spécification OpenAPI ou un schéma, ou une commande avec des arguments",serverTypeInvalid:"Le type de serveur doit être l'un des suivants : stdio, sse, streamable-http, openapi",urlRequiredForType:"L'URL est requise pour le type de serveur {{type}}",openapiSpecRequired:"L'URL de la spécification OpenAPI ou le schéma est requis pour le type de serveur openapi",headersInvalidFormat:"Les en-têtes doivent être un objet",headersNotSupportedForStdio:"Les en-têtes ne sont pas pris en charge pour le type de serveur stdio",serverNotFound:"Serveur non trouvé",failedToRemoveServer:"Serveur non trouvé ou échec de la suppression",internalServerError:"Erreur interne du serveur",failedToGetServers:"Échec de la récupération des informations sur les serveurs",failedToGetServerSettings:"Échec de la récupération des paramètres du serveur",failedToGetServerConfig:"Échec de la récupération de la configuration du serveur",failedToSaveSettings:"Échec de l'enregistrement des paramètres",toolNameRequired:"Le nom du serveur et le nom de l'outil sont requis",descriptionMustBeString:"La description doit être une chaîne de caractères",groupIdRequired:"L'ID de groupe est requis",groupNameRequired:"Le nom du groupe est requis",groupNotFound:"Groupe non trouvé",groupIdAndServerNameRequired:"L'ID de groupe和le nom du serveur sont requis",groupOrServerNotFound:"Groupe ou serveur non trouvé",toolsMustBeAllOrArray:'Les outils doivent être "all" ou un tableau de chaînes de caractères',serverNameAndToolNameRequired:"Le nom du serveur et le nom de l'outil sont requis",usernameRequired:"Le nom d'utilisateur est requis",userNotFound:"Utilisateur non trouvé",failedToGetUsers:"Échec de la récupération des informations sur les utilisateurs",failedToGetUserInfo:"Échec de la récupération des informations sur l'utilisateur",failedToGetUserStats:"Échec de la récupération des statistiques de l'utilisateur",marketServerNameRequired:"Le nom du serveur du marché est requis",marketServerNotFound:"Serveur du marché non trouvé",failedToGetMarketServers:"Échec de la récupération des informations sur les serveurs du marché",failedToGetMarketServer:"Échec de la récupération des informations sur le serveur du marché",failedToGetMarketCategories:"Échec de la récupération des catégories du marché",failedToGetMarketTags:"Échec de la récupération des tags du marché",failedToSearchMarketServers:"Échec de la recherche des serveurs du marché",failedToFilterMarketServers:"Échec du filtrage des serveurs du marché",failedToProcessMcpbFile:"Échec du traitement du fichier MCPB"},success:{serverCreated:"Serveur créé avec succès",serverUpdated:"Serveur mis à jour avec succès",serverRemoved:"Serveur supprimé avec succès",serverToggled:"État du serveur basculé avec succès",toolToggled:"Outil {{name}} {{action}} avec succès",toolDescriptionUpdated:"Description de l'outil {{name}} mise à jour avec succès",systemConfigUpdated:"Configuration système mise à jour avec succès",groupCreated:"Groupe créé avec succès",groupUpdated:"Groupe mis à jour avec succès",groupDeleted:"Groupe supprimé avec succès",serverAddedToGroup:"Serveur ajouté au groupe avec succès",serverRemovedFromGroup:"Serveur supprimé du groupe avec succès",serverToolsUpdated:"Outils du serveur mis à jour avec succès"}},gC={authorizationFailed:"Échec de l'autorisation",authorizationFailedError:"Erreur",authorizationFailedDetails:"Détails",invalidRequest:"Requête invalide",missingStateParameter:"Paramètre d'état OAuth requis manquant.",missingCodeParameter:"Paramètre de code d'autorisation requis manquant.",serverNotFound:"Serveur introuvable",serverNotFoundMessage:"Impossible de trouver le serveur associé à cette demande d'autorisation.",sessionExpiredMessage:"La session d'autorisation a peut-être expiré. Veuillez réessayer l'autorisation.",authorizationSuccessful:"Autorisation réussie",server:"Serveur",status:"État",connected:"Connecté",successMessage:"Le serveur a été autorisé et connecté avec succès.",autoCloseMessage:"Cette fenêtre se fermera automatiquement dans 3 secondes...",closeNow:"Fermer maintenant",connectionError:"Erreur de connexion",connectionErrorMessage:"L'autorisation a réussi, mais la connexion au serveur a échoué.",reconnectMessage:"Veuillez essayer de vous reconnecter à partir du tableau de bord.",configurationError:"Erreur de configuration",configurationErrorMessage:"Le transport du serveur ne prend pas en charge OAuth finishAuth(). Veuillez vous assurer que le serveur est configuré avec le transport streamable-http.",internalError:"Erreur interne",internalErrorMessage:"Une erreur inattendue s'est produite lors du traitement du callback OAuth.",closeWindow:"Fermer la fenêtre"},fC={add:"Ajouter un prompt",addNew:"Ajouter un nouveau prompt",edit:"Modifier le prompt",delete:"Supprimer",noPrompts:"Aucun prompt intégré configuré",addFirst:"Ajoutez votre premier prompt",name:"Nom",namePlaceholder:"ex. code-review",title:"Titre",titlePlaceholder:"ex. Prompt de revue de code",description:"Description",descriptionPlaceholder:"Brève description du prompt",template:"Modèle",templatePlaceholder:"Entrez le texte du modèle avec des marqueurs {{paramètre}}...",templateHint:"Utilisez {{paramName}} pour les paramètres du modèle",arguments:"Arguments",addArgument:"Ajouter un argument",argName:"Nom",argDescription:"Description",argRequired:"Requis",enabled:"Activé",active:"Actif",inactive:"Inactif",nameRequired:"Le nom est requis",templateRequired:"Le modèle est requis",fetchError:"Échec du chargement des prompts intégrés",createError:"Échec de la création du prompt",updateError:"Échec de la mise à jour du prompt",deleteError:"Échec de la suppression du prompt",saveError:"Échec de l'enregistrement du prompt",confirmDelete:"Supprimer le prompt",deleteWarning:'Êtes-vous sûr de vouloir supprimer le prompt "{{name}}" ? Cette action est irréversible.'},hC={add:"Ajouter une ressource",addNew:"Ajouter une nouvelle ressource",edit:"Modifier la ressource",delete:"Supprimer",noResources:"Aucune ressource intégrée configurée",addFirst:"Ajoutez votre première ressource",uri:"URI",uriPlaceholder:"ex. resource://docs/guide",name:"Nom",namePlaceholder:"ex. Guide utilisateur",description:"Description",descriptionPlaceholder:"Brève description de la ressource",mimeType:"Type MIME",content:"Contenu",contentPlaceholder:"Entrez le contenu de la ressource...",enabled:"Activé",active:"Actif",inactive:"Inactif",descriptionUpdateSuccess:"Description de la ressource mise à jour avec succès",descriptionUpdateFailed:"Échec de la mise à jour de la description de la ressource",restoreDefault:"Restaurer par défaut",restoreDefaultSuccess:"La description de la ressource a été restaurée à sa valeur par défaut",restoreDefaultFailed:"Échec de la restauration de la description par défaut de la ressource",uriRequired:"L'URI est requis",contentRequired:"Le contenu est requis",fetchError:"Échec du chargement des ressources intégrées",createError:"Échec de la création de la ressource",updateError:"Échec de la mise à jour de la ressource",deleteError:"Échec de la suppression de la ressource",saveError:"Échec de l'enregistrement de la ressource",confirmDelete:"Supprimer la ressource",deleteWarning:'Êtes-vous sûr de vouloir supprimer la ressource "{{name}}" ? Cette action est irréversible.'},xC={title:"Activité",totalCalls:"Total des appels",successCount:"Réussites",errorCount:"Échecs",avgDuration:"Durée moyenne",timestamp:"Horodatage",server:"Serveur",tool:"Outil",duration:"Durée",status:"Statut",group:"Groupe",key:"Clé API",input:"Entrée",output:"Sortie",details:"Détails de l’activité",errorMessage:"Message d’erreur",searchServer:"Serveur...",searchTool:"Outil...",searchStatus:"Statut...",searchGroup:"Groupe...",searchKeyName:"Clé API...",keyName:"Nom de la clé API",allStatus:"Tous les statuts",statusSuccess:"Succès",statusError:"Erreur",noData:"Aucune activité disponible",fetchError:"Impossible de charger les données d’activité",cleanup:"Nettoyer",confirmCleanup:"Voulez-vous vraiment supprimer les activités de plus de 30 jours ?",cleanupSuccess:"{{count}} anciennes activités supprimées",cleanupError:"Échec du nettoyage des anciennes activités",notAvailable:"Le suivi des activités est disponible uniquement en mode base de données"},yC={exportButton:"Exporter le modèle",importButton:"Importer le modèle",exportTitle:"Exporter le modèle de configuration",importTitle:"Importer le modèle de configuration",name:"Nom du modèle",nameRequired:"Le nom du modèle est requis",namePlaceholder:"Ex. : Outils de développement frontend",description:"Description",descriptionPlaceholder:"Ex. : Serveurs MCP standards pour le développement frontend",selectGroups:"Sélectionner les groupes",selectGroupsHelp:"Laisser vide pour exporter tous les groupes",selectAll:"Tout sélectionner",deselectAll:"Tout désélectionner",includeDisabled:"Inclure les serveurs désactivés",exportNote:"Les secrets (clés API, tokens, mots de passe) seront remplacés par des références ${PLACEHOLDER}. Les destinataires devront fournir leurs propres identifiants.",export:"Exporter",exporting:"Exportation...",exportFailed:"Échec de l'exportation du modèle",import:"Importer",importing:"Importation...",importFailed:"Échec de l'importation du modèle",invalidFormat:"Format de modèle invalide. Doit contenir les champs version, name, servers et groups.",parseError:"Échec de l'analyse JSON. Veuillez vérifier le format et réessayer.",uploadFile:"Télécharger le fichier modèle",or:"ou",pasteJson:"Coller le JSON du modèle",pastePlaceholder:"Collez le contenu de votre fichier .mcphub-template.json ici...",version:"Version",createdAt:"Créé le",servers:"Serveurs",groups:"Groupes",serversInGroup:"serveur(s)",envVarsNeeded:"Variables d'environnement requises — définissez-les avant d'utiliser les serveurs importés :",importResult:"Serveurs : {{serversCreated}} créés, {{serversSkipped}} ignorés. Groupes : {{groupsCreated}} créés, {{groupsSkipped}} ignorés."},bC={app:B4,about:I4,profile:F4,sponsor:H4,wechat:q4,discord:G4,theme:K4,auth:V4,server:$4,status:Y4,errors:J4,common:Q4,pagination:X4,nav:Z4,pages:W4,logs:eC,groups:tC,market:rC,oauthServer:aC,cloud:sC,registry:nC,tool:lC,prompt:iC,settings:oC,mcpb:cC,jsonImport:uC,groupImport:dC,users:mC,api:pC,oauthCallback:gC,builtinPrompts:fC,builtinResources:hC,activity:xC,template:yC},vC={title:"MCPHub Kontrol Paneli",error:"Hata",closeButton:"Kapat",noServers:"Kullanılabilir MCP sunucusu yok",loading:"Yükleniyor...",logout:"Çıkış Yap",profile:"Profil",changePassword:"Şifre Değiştir",toggleSidebar:"Kenar Çubuğunu Aç/Kapat",welcomeUser:"Hoş geldin, {{username}}",name:"MCPHub",embeddingSyncProgress:"{{serverName}} için gömme oluşturuluyor",embeddingSyncProgressAriaLabel:"{{serverName}} için gömme oluşturuluyor: {{total}} adımdan {{current}} tamamlandı"},wC={title:"Hakkında",versionInfo:"MCPHub Sürümü: {{version}}",newVersion:"Yeni sürüm mevcut!",currentVersion:"Mevcut sürüm",newVersionAvailable:"Yeni sürüm {{version}} mevcut",viewOnGitHub:"GitHub'da Görüntüle",checkForUpdates:"Güncellemeleri Kontrol Et",checking:"Güncellemeler kontrol ediliyor..."},jC={viewProfile:"Profili görüntüle",userCenter:"Kullanıcı Merkezi"},SC={label:"Sponsor",title:"Projeyi Destekle",rewardAlt:"Ödül QR Kodu",supportMessage:"Bana bir kahve ısmarlayarak MCPHub'ın geliştirilmesini destekleyin!",supportButton:"Ko-fi'de Destek Ol"},NC={label:"WeChat",title:"WeChat ile Bağlan",qrCodeAlt:"WeChat QR Kodu",scanMessage:"WeChat'te bizimle bağlantı kurmak için bu QR kodunu tarayın"},kC={label:"Discord",title:"Discord sunucumuza katılın",community:"Destek, tartışmalar ve güncellemeler için büyüyen Discord topluluğumuza katılın!"},CC={title:"Tema",light:"Açık",dark:"Koyu",system:"Sistem"},AC={login:"Giriş Yap",loginTitle:"MCPHub'a Giriş Yap",slogan:"Birleşik MCP sunucu yönetim platformu",subtitle:"Model Context Protocol sunucuları için merkezi yönetim platformu. Esnek yönlendirme stratejileri ile birden fazla MCP sunucusunu organize edin, izleyin ve ölçeklendirin.",username:"Kullanıcı Adı",password:"Şifre",loggingIn:"Giriş yapılıyor...",orContinue:"Veya şununla devam et",loginWithGoogle:"Google ile devam et",loginWithGithub:"GitHub ile devam et",socialLoginFailed:"Sosyal giriş başarısız oldu. Lütfen tekrar deneyin.",emptyFields:"Kullanıcı adı ve şifre boş olamaz",loginFailed:"Giriş başarısız, lütfen kullanıcı adınızı ve şifrenizi kontrol edin",loginError:"Giriş sırasında bir hata oluştu",serverUnavailable:"Sunucuya bağlanılamıyor. Lütfen ağ bağlantınızı kontrol edin veya daha sonra tekrar deneyin",currentPassword:"Mevcut Şifre",newPassword:"Yeni Şifre",confirmPassword:"Şifreyi Onayla",passwordsNotMatch:"Yeni şifre ve onay eşleşmiyor",changePasswordSuccess:"Şifre başarıyla değiştirildi",changePasswordError:"Şifre değişikliği başarısız oldu",changePassword:"Şifre Değiştir",passwordChanged:"Şifre başarıyla değiştirildi",passwordChangeError:"Şifre değişikliği başarısız oldu",defaultPasswordWarning:"Varsayılan Şifre Güvenlik Uyarısı",defaultPasswordMessage:"Varsayılan şifreyi (admin123) kullanıyorsunuz, bu bir güvenlik riski oluşturur. Hesabınızı korumak için lütfen şifrenizi hemen değiştirin.",goToSettings:"Ayarlara Git",passwordStrengthError:"Şifre güvenlik gereksinimlerini karşılamıyor",passwordMinLength:"Şifre en az 8 karakter uzunluğunda olmalıdır",passwordRequireLetter:"Şifre en az bir harf içermelidir",passwordRequireNumber:"Şifre en az bir rakam içermelidir",passwordRequireSpecial:"Şifre en az bir özel karakter içermelidir",passwordStrengthHint:"Şifre en az 8 karakter olmalı ve harf, rakam ve özel karakter içermelidir"},EC={addServer:"Sunucu Ekle",add:"Ekle",edit:"Düzenle",copy:"Kopyala",delete:"Sil",confirmDelete:"Bu sunucuyu silmek istediğinizden emin misiniz?",deleteWarning:"'{{name}}' sunucusunu silmek, onu ve tüm verilerini kaldıracaktır. Bu işlem geri alınamaz.",status:"Durum",tools:"Araçlar",prompts:"İstekler",name:"Sunucu Adı",description:"Sunucu Notu",descriptionPlaceholder:"İsteğe bağlı: Bu sunucunun ne işe yaradığını yazın",url:"Sunucu URL'si",apiKey:"API Anahtarı",save:"Kaydet",cancel:"İptal",invalidConfig:"{{serverName}} için yapılandırma verisi bulunamadı",addError:"Sunucu eklenemedi",editError:"{{serverName}} sunucusu düzenlenemedi",deleteError:"{{serverName}} sunucusu silinemedi",updateError:"Sunucu güncellenemedi",editTitle:"Sunucuyu Düzenle: {{serverName}}",type:"Sunucu Türü",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"Akış Yapılabilir HTTP",typeOpenapi:"OpenAPI",command:"Komut",arguments:"Argümanlar",envVars:"Ortam Değişkenleri",headers:"HTTP Başlıkları",key:"anahtar",value:"değer",enabled:"Etkin",enable:"Etkinleştir",disable:"Devre Dışı Bırak",reload:"Yeniden Yükle",reloadSuccess:"Sunucu başarıyla yeniden yüklendi",reloadError:"Sunucu {{serverName}} yeniden yüklenemedi",requestOptions:"Bağlantı Yapılandırması",timeout:"İstek Zaman Aşımı",timeoutDescription:"MCP sunucusuna yapılan istekler için zaman aşımı (ms)",maxTotalTimeout:"Maksimum Toplam Zaman Aşımı",maxTotalTimeoutDescription:"MCP sunucusuna gönderilen istekler için maksimum toplam zaman aşımı (ms) (İlerleme bildirimleriyle kullanın)",resetTimeoutOnProgress:"İlerlemede Zaman Aşımını Sıfırla",resetTimeoutOnProgressDescription:"İlerleme bildirimlerinde zaman aşımını sıfırla (varsayılan olarak etkin)",keepAlive:"Bağlantı Canlı Tutma Yapılandırması",enableKeepAlive:"Bağlantı Canlı Tutmayı Etkinleştir",keepAliveDescription:"Bağlantıyı korumak için periyodik ping istekleri gönderin. Zaman aşımına uğrayabilecek uzun süreli bağlantılar için yararlıdır.",keepAliveInterval:"Aralık (ms)",keepAliveIntervalDescription:"Canlı tutma pingleri arasındaki süre milisaniye cinsinden (varsayılan: 60000ms = 1 dakika)",remove:"Kaldır",toggleError:"{{serverName}} sunucusu açılamadı/kapatılamadı",alreadyExists:"{{serverName}} sunucusu zaten mevcut",invalidData:"Geçersiz sunucu verisi sağlandı",notFound:"{{serverName}} sunucusu bulunamadı",namePlaceholder:"Sunucu adını girin",urlPlaceholder:"Sunucu URL'sini girin",commandPlaceholder:"Komutu girin",argumentsPlaceholder:"Argümanları girin",errorDetails:"Hata Detayları",viewErrorDetails:"Hata detaylarını görüntüle",copyConfig:"Yapılandırmayı Kopyala",confirmVariables:"Değişken Yapılandırmasını Onayla",variablesDetected:"Yapılandırmada değişkenler algılandı. Lütfen bu değişkenlerin düzgün yapılandırıldığını onaylayın:",detectedVariables:"Algılanan Değişkenler",confirmVariablesMessage:"Lütfen bu değişkenlerin çalışma ortamınızda düzgün tanımlandığından emin olun. Sunucu eklemeye devam edilsin mi?",confirmAndAdd:"Onayla ve Ekle",openapi:{inputMode:"Giriş Modu",inputModeUrl:"Şartname URL'si",inputModeSchema:"JSON Şeması",specUrl:"OpenAPI Şartname URL'si",schema:"OpenAPI JSON Şeması",schemaHelp:"Eksiksiz OpenAPI JSON şemanızı buraya yapıştırın",security:"Güvenlik Türü",securityNone:"Yok",securityApiKey:"API Anahtarı",securityHttp:"HTTP Kimlik Doğrulaması",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API Anahtarı Yapılandırması",apiKeyName:"Başlık/Parametre Adı",apiKeyIn:"Konum",apiKeyValue:"API Anahtarı Değeri",httpAuthConfig:"HTTP Kimlik Doğrulama Yapılandırması",httpScheme:"Kimlik Doğrulama Şeması",httpCredentials:"Kimlik Bilgileri",httpSchemeBasic:"Basit",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 Yapılandırması",oauth2Token:"Erişim Anahtarı",openIdConnectConfig:"OpenID Connect Yapılandırması",openIdConnectUrl:"URL'yi Keşfet",openIdConnectToken:"ID Token",apiKeyInHeader:"Başlık",apiKeyInQuery:"Sorgu",apiKeyInCookie:"Çerez",passthroughHeaders:"Geçiş Başlıkları",passthroughHeadersHelp:"Gelen MCP isteklerinden yukarı akış sunucu isteklerine geçirilecek başlık adlarının virgülle ayrılmış listesi (örn. Authorization, X-API-Key)"},oauth:{sectionTitle:"OAuth Yapılandırması",sectionDescription:"OAuth korumalı sunucular için istemci kimlik bilgilerini yapılandırın (isteğe bağlı).",clientId:"İstemci ID",clientSecret:"İstemci Gizli Anahtarı",authorizationEndpoint:"Yetkilendirme Uç Noktası",tokenEndpoint:"Token Uç Noktası",scopes:"Kapsamlar",scopesPlaceholder:"scope1 scope2",resource:"Kaynak / Hedef Kitle",accessToken:"Erişim Tokeni",refreshToken:"Yenileme Tokeni"}},RC={online:"Çevrimiçi",offline:"Çevrimdışı",connecting:"Bağlanıyor",oauthRequired:"OAuth Gerekli",clickToAuthorize:"OAuth ile yetkilendirmek için tıklayın",oauthWindowOpened:"OAuth yetkilendirme penceresi açıldı. Lütfen yetkilendirmeyi tamamlayın."},TC={general:"Bir şeyler yanlış gitti",network:"Ağ bağlantı hatası. Lütfen internet bağlantınızı kontrol edin",serverConnection:"Sunucuya bağlanılamıyor. Lütfen sunucunun çalışıp çalışmadığını kontrol edin",serverAdd:"Sunucu eklenemedi. Lütfen sunucu durumunu kontrol edin",serverUpdate:"{{serverName}} sunucusu düzenlenemedi. Lütfen sunucu durumunu kontrol edin",serverFetch:"Sunucu verileri alınamadı. Lütfen daha sonra tekrar deneyin",failedToReloadServer:"Sunucu yeniden yüklenemedi",initialStartup:"Sunucu başlatılıyor olabilir. İlk başlatmada bu işlem biraz zaman alabileceğinden lütfen bekleyin...",serverInstall:"Sunucu yüklenemedi",failedToFetchSettings:"Ayarlar getirilemedi",failedToUpdateRouteConfig:"Route yapılandırması güncellenemedi",failedToUpdateSmartRoutingConfig:"Akıllı yönlendirme yapılandırması güncellenemedi"},OC={processing:"İşleniyor...",save:"Kaydet",cancel:"İptal",back:"Geri",refresh:"Yenile",search:"Ara",clear:"Temizle",view:"Görüntüle",create:"Oluştur",creating:"Oluşturuluyor...",update:"Güncelle",updating:"Güncelleniyor...",submitting:"Gönderiliyor...",delete:"Sil",remove:"Kaldır",copy:"Kopyala",copyId:"ID'yi Kopyala",copyUrl:"URL'yi Kopyala",copyJson:"JSON'u Kopyala",copySuccess:"Panoya kopyalandı",copyFailed:"Kopyalama başarısız",copied:"Kopyalandı",close:"Kapat",confirm:"Onayla",language:"Dil",true:"Doğru",false:"Yanlış",dismiss:"Anımsatma",github:"GitHub",wechat:"WeChat",discord:"Discord",itemsPerPage:"Sayfa başına öğe",showing:"{{total}} öğeden {{start}}-{{end}} gösteriliyor",previous:"Önceki",next:"Sonraki",required:"Gerekli",secret:"Gizli",default:"Varsayılan",value:"Değer",type:"Tür",repeated:"Tekrarlanan",valueHint:"Değer İpucu",choices:"Seçenekler",actions:"Eylemler",saving:"Kaydediliyor...",active:"Aktif",inactive:"Pasif"},zC={rowsPerPage:"Sayfa başına satır",showing:"Toplam {{total}} öğeden {{from}}-{{to}} gösteriliyor"},MC={dashboard:"Kontrol Paneli",servers:"Sunucular",groups:"Gruplar",prompts:"Promptlar",resources:"Kaynaklar",users:"Kullanıcılar",settings:"Ayarlar",changePassword:"Şifre Değiştir",market:"Market",cloud:"Bulut Market",logs:"Günlükler",activity:"Etkinlik"},PC={dashboard:{title:"Kontrol Paneli",totalServers:"Toplam",onlineServers:"Çevrimiçi",disabledServers:"Devre Dışı",offlineServers:"Çevrimdışı",connectingServers:"Bağlanıyor",recentServers:"Son Sunucular"},servers:{title:"Sunucu Yönetimi"},groups:{title:"Grup Yönetimi"},prompts:{title:"Yerleşik Promptlar"},resources:{title:"Yerleşik Kaynaklar"},users:{title:"Kullanıcı Yönetimi"},settings:{title:"Ayarlar",language:"Dil",account:"Hesap Ayarları",password:"Şifre Değiştir",appearance:"Görünüm",routeConfig:"Güvenlik",installConfig:"Kurulum",smartRouting:"Akıllı Yönlendirme",oauthServer:"OAuth Sunucusu"},market:{title:"Market Yönetimi - Yerel ve Bulut Marketler"},logs:{title:"Sistem Günlükleri"}},DC={filters:"Filtreler",search:"Günlüklerde ara...",autoScroll:"Otomatik kaydır",clearLogs:"Günlükleri temizle",loading:"Günlükler yükleniyor...",noLogs:"Kullanılabilir günlük yok.",noMatch:"Mevcut filtrelerle eşleşen günlük yok.",mainProcess:"Ana İşlem",childProcess:"Alt İşlem",main:"Ana",child:"Alt"},LC={add:"Ekle",addNew:"Yeni Grup Ekle",edit:"Grubu Düzenle",delete:"Sil",confirmDelete:"Bu grubu silmek istediğinizden emin misiniz?",deleteWarning:"'{{name}}' grubunu silmek, onu ve tüm sunucu ilişkilerini kaldıracaktır. Bu işlem geri alınamaz.",name:"Grup Adı",namePlaceholder:"Grup adını girin",nameRequired:"Grup adı gereklidir",description:"Açıklama",descriptionPlaceholder:"Grup açıklamasını girin (isteğe bağlı)",createError:"Grup oluşturulamadı",updateError:"Grup güncellenemedi",deleteError:"Grup silinemedi",serverAddError:"Sunucu gruba eklenemedi",serverRemoveError:"Sunucu gruptan kaldırılamadı",addServer:"Gruba Sunucu Ekle",selectServer:"Eklenecek bir sunucu seçin",servers:"Gruptaki Sunucular",remove:"Kaldır",noGroups:"Kullanılabilir grup yok. Başlamak için yeni bir grup oluşturun.",noServers:"Bu grupta sunucu yok.",noServerOptions:"Kullanılabilir sunucu yok",serverCount:"{{count}} Sunucu",toolSelection:"Araç Seçimi",promptSelection:"İstem Seçimi",resourceSelection:"Kaynak Seçimi",toolsSelected:"Seçildi",promptsSelected:"Seçildi",resourcesSelected:"Seçildi",allTools:"Tümü",allPrompts:"Tüm istemler",allResources:"Tüm kaynaklar",selectedTools:"Seçili araçlar",selectedPrompts:"Seçili istemler",selectedResources:"Seçili kaynaklar",selectAll:"Tümünü Seç",selectNone:"Hiçbirini Seçme",configureTools:"Araçları Yapılandır",configureCapabilities:"Araçları, istemleri ve kaynakları yapılandır",previewPrompts:"[istemler: {{items}}]",previewResources:"[kaynaklar: {{items}}]",previewAllTools:"(tüm araçlar)",previewAllPrompts:"(tüm istemler)",previewAllResources:"(tüm kaynaklar)"},UC={title:"Yerel Kurulum",official:"Resmi",by:"Geliştirici",unknown:"Bilinmeyen",tools:"araçlar",search:"Ara",searchPlaceholder:"Sunucuları isme, kategoriye veya etiketlere göre ara",clearFilters:"Temizle",clearCategoryFilter:"",clearTagFilter:"",categories:"Kategoriler",tags:"Etiketler",showTags:"Etiketleri göster",hideTags:"Etiketleri gizle",moreTags:"",noServers:"Aramanızla eşleşen sunucu bulunamadı",backToList:"Listeye dön",install:"Yükle",installing:"Yükleniyor...",installed:"Yüklendi",installServer:"Sunucu Yükle: {{name}}",installSuccess:"{{serverName}} sunucusu başarıyla yüklendi",author:"Yazar",license:"Lisans",repository:"Depo",examples:"Örnekler",arguments:"Argümanlar",argumentName:"Ad",description:"Açıklama",required:"Gerekli",example:"Örnek",viewSchema:"Şemayı görüntüle",fetchError:"Market sunucuları getirilirken hata",serverNotFound:"Sunucu bulunamadı",searchError:"Sunucular aranırken hata",filterError:"Sunucular kategoriye göre filtrelenirken hata",tagFilterError:"Sunucular etikete göre filtrelenirken hata",noInstallationMethod:"Bu sunucu için kullanılabilir kurulum yöntemi yok",showing:"{{total}} sunucudan {{from}}-{{to}} arası gösteriliyor",perPage:"Sayfa başına",confirmVariablesMessage:"Lütfen bu değişkenlerin çalışma ortamınızda düzgün tanımlandığından emin olun. Sunucu yüklemeye devam edilsin mi?",confirmAndInstall:"Onayla ve Yükle"},_C={authorizeTitle:"Uygulamayı Yetkilendir",authorizeSubtitle:"Bu uygulamanın MCPHub hesabınıza erişmesine izin verin.",buttons:{approve:"Erişime izin ver",deny:"Reddet",approveSubtitle:"Bu uygulamaya güveniyorsanız izin vermeniz önerilir.",denySubtitle:"İstediğiniz zaman daha sonra erişim verebilirsiniz."}},BC={title:"Bulut Desteği",subtitle:"MCPRouter tarafından desteklenmektedir",by:"Geliştirici",server:"Sunucu",config:"Yapılandırma",created:"Oluşturuldu",updated:"Güncellendi",available:"Kullanılabilir",description:"Açıklama",details:"Detaylar",tools:"Araçlar",tool:"araç",toolsAvailable:"{{count}} araç mevcut",loadingTools:"Araçlar yükleniyor...",noTools:"Bu sunucu için kullanılabilir araç yok",noDescription:"Kullanılabilir açıklama yok",viewDetails:"Detayları Görüntüle",parameters:"Parametreler",result:"Sonuç",error:"Hata",callTool:"Çalıştır",calling:"Çalıştırılıyor...",toolCallSuccess:"{{toolName}} aracı başarıyla çalıştırıldı",toolCallError:"{{toolName}} aracı çalıştırılamadı: {{error}}",viewSchema:"Şemayı Görüntüle",backToList:"Bulut Market'e Dön",search:"Ara",searchPlaceholder:"Bulut sunucularını isme, başlığa veya geliştiriciye göre ara",clearFilters:"Filtreleri Temizle",clearCategoryFilter:"Temizle",clearTagFilter:"Temizle",categories:"Kategoriler",tags:"Etiketler",noCategories:"Kategori bulunamadı",noTags:"Etiket bulunamadı",noServers:"Bulut sunucusu bulunamadı",fetchError:"Bulut sunucuları getirilirken hata",serverNotFound:"Bulut sunucusu bulunamadı",searchError:"Bulut sunucuları aranırken hata",filterError:"Bulut sunucuları kategoriye göre filtrelenirken hata",tagFilterError:"Bulut sunucuları etikete göre filtrelenirken hata",showing:"{{total}} bulut sunucusundan {{from}}-{{to}} arası gösteriliyor",perPage:"Sayfa başına",apiKeyNotConfigured:"MCPRouter API anahtarı yapılandırılmamış",apiKeyNotConfiguredDescription:"Bulut sunucularını kullanmak için MCPRouter API anahtarınızı yapılandırmanız gerekir.",getApiKey:"API Anahtarı Al",configureInSettings:"Ayarlarda Yapılandır",installServer:"{{name}} Yükle",installSuccess:"{{name}} sunucusu başarıyla yüklendi",installError:"Sunucu yüklenemedi: {{error}}"},IC={title:"Kayıt",official:"Resmi",latest:"En Son",description:"Açıklama",website:"Web Sitesi",repository:"Depo",packages:"Paketler",package:"paket",remotes:"Uzak Sunucular",remote:"uzak sunucu",published:"Yayınlandı",updated:"Güncellendi",install:"Yükle",installing:"Yükleniyor...",installed:"Yüklendi",installServer:"{{name}} Yükle",installSuccess:"{{name}} sunucusu başarıyla yüklendi",installError:"Sunucu yüklenemedi: {{error}}",noDescription:"Kullanılabilir açıklama yok",viewDetails:"Detayları Görüntüle",backToList:"Kayda Dön",search:"Ara",searchPlaceholder:"Kayıt sunucularını isme göre ara",clearFilters:"Temizle",noServers:"Kayıt sunucusu bulunamadı",fetchError:"Kayıt sunucuları getirilirken hata",serverNotFound:"Kayıt sunucusu bulunamadı",showing:"{{total}} kayıt sunucusundan {{from}}-{{to}} arası gösteriliyor",perPage:"Sayfa başına",environmentVariables:"Ortam Değişkenleri",packageArguments:"Paket Argümanları",runtimeArguments:"Çalışma Zamanı Argümanları",headers:"Başlıklar"},FC={run:"Çalıştır",running:"Çalıştırılıyor...",runTool:"Aracı Çalıştır",cancel:"İptal",noDescription:"Kullanılabilir açıklama yok",inputSchema:"Giriş Şeması:",runToolWithName:"Aracı Çalıştır: {{name}}",execution:"Araç Çalıştırma",successful:"Başarılı",failed:"Başarısız",result:"Sonuç:",error:"Hata",errorDetails:"Hata Detayları:",noContent:"Araç başarıyla çalıştırıldı ancak içerik döndürmedi.",unknownError:"Bilinmeyen hata oluştu",jsonResponse:"JSON Yanıtı:",toolResult:"Araç sonucu",noParameters:"Bu araç herhangi bir parametre gerektirmez.",selectOption:"Bir seçenek seçin",enterValue:"{{type}} değeri girin",enabled:"Etkin",enableSuccess:"{{name}} aracı başarıyla etkinleştirildi",disableSuccess:"{{name}} aracı başarıyla devre dışı bırakıldı",toggleFailed:"Araç durumu değiştirilemedi",descriptionUpdateSuccess:"Araç açıklaması başarıyla güncellendi",descriptionUpdateFailed:"Araç açıklaması güncellenemedi",restoreDefault:"Varsayılana dön",restoreDefaultSuccess:"Araç açıklaması varsayılan değere döndürüldü",restoreDefaultFailed:"Varsayılan araç açıklamasına dönülemedi",parameters:"Araç Parametreleri",formMode:"Form Modu",jsonMode:"JSON Modu",jsonConfiguration:"JSON Yapılandırması",invalidJsonFormat:"Geçersiz JSON formatı",fixJsonBeforeSwitching:"Form moduna geçmeden önce lütfen JSON formatını düzeltin",item:"Öğe {{index}}",addItem:"{{key}} öğesi ekle",enterKey:"{{key}} girin"},HC={run:"Getir",running:"Getiriliyor...",result:"İstek Sonucu",error:"İstek Hatası",execution:"İstek Çalıştırma",successful:"Başarılı",failed:"Başarısız",errorDetails:"Hata Detayları:",noContent:"İstek başarıyla çalıştırıldı ancak içerik döndürmedi.",unknownError:"Bilinmeyen hata oluştu",jsonResponse:"JSON Yanıtı:",description:"Açıklama",messages:"Mesajlar",noDescription:"Kullanılabilir açıklama yok",runPromptWithName:"İsteği Getir: {{name}}",descriptionUpdateSuccess:"İstek açıklaması başarıyla güncellendi",descriptionUpdateFailed:"İstek açıklaması güncellenemedi",restoreDefault:"Varsayılana dön",restoreDefaultSuccess:"İstek açıklaması varsayılan değere döndürüldü",restoreDefaultFailed:"Varsayılan istek açıklamasına dönülemedi"},qC=JSON.parse(`{"enableGlobalRoute":"Global Yönlendirmeyi Etkinleştir","enableGlobalRouteDescription":"Grup ID'si belirtmeden /sse uç noktasına bağlantıya izin ver","enableGroupNameRoute":"Grup Adı Yönlendirmeyi Etkinleştir","enableGroupNameRouteDescription":"Sadece grup ID'leri yerine grup adları kullanarak /sse uç noktasına bağlantıya izin ver","enableBearerAuth":"Bearer Kimlik Doğrulamasını Etkinleştir","enableBearerAuthDescription":"MCP uç noktaları için bearer token kimlik doğrulaması gerektirir (varsayılan açık)","bearerAuthKey":"Bearer Kimlik Doğrulama Anahtarı","bearerAuthKeyDescription":"Bearer token'da gerekli olacak kimlik doğrulama anahtarı","bearerAuthKeyPlaceholder":"Bearer kimlik doğrulama anahtarını girin","bearerAuthHeaderName":"Bearer Kimlik Doğrulama Başlığı","bearerAuthHeaderNameDescription":"MCP bearer kimlik bilgilerinin alınacağı başlık adı. Yukarı akış passthrough başlıkları da Authorization kullanıyorsa bunu değiştirin.","bearerAuthHeaderNamePlaceholder":"örn. Authorization veya X-MCP-Authorization","bearerKeysSectionTitle":"Anahtarlar","bearerKeysSectionDescription":"Farklı erişim kapsamlarına sahip birden fazla anahtarı yönetin.","noBearerKeys":"Henüz yapılandırılmış herhangi bir anahtar yok.","bearerKeyName":"Ad","bearerKeyToken":"Token","bearerKeyEnabled":"Etkin","bearerKeyAccessType":"Erişim kapsamı","bearerKeyAccessAll":"Tümü","bearerKeyAccessGroups":"Gruplar","bearerKeyAccessServers":"Sunucular","bearerKeyAccessCustom":"Özel","bearerKeyAllowedGroups":"İzin verilen gruplar","bearerKeyAllowedServers":"İzin verilen sunucular","addBearerKey":"Anahtar ekle","addBearerKeyButton":"Oluştur","bearerKeyRequired":"Ad ve token zorunludur","deleteBearerKeyConfirm":"Bu anahtarı silmek istediğinizden emin misiniz?","generate":"Oluştur","selectGroups":"Grupları Seç","selectServers":"Sunucuları Seç","selectAtLeastOneGroup":"Lütfen en az bir grup seçin","selectAtLeastOneServer":"Lütfen en az bir sunucu seçin","skipAuth":"Kimlik Doğrulamayı Atla","skipAuthDescription":"Kontrol paneline giriş olmadan erişime izin ver (MCP kimlik doğrulamasını etkilemez)","jsonBodyLimit":"JSON Gövde Boyutu Sınırı","jsonBodyLimitDescription":"Express JSON istek boyutu sınırı. Büyük OpenAPI şema yüklemeleri de bu ayardan etkilenir.","jsonBodyLimitPlaceholder":"örn. 1mb, 5mb, 1024kb","pythonIndexUrl":"Python Paket Deposu URL'si","pythonIndexUrlDescription":"Python paket kurulumu için UV_DEFAULT_INDEX ortam değişkenini ayarla","pythonIndexUrlPlaceholder":"örn. https://pypi.org/simple","npmRegistry":"NPM Kayıt URL'si","npmRegistryDescription":"NPM paket kurulumu için npm_config_registry ortam değişkenini ayarla","npmRegistryPlaceholder":"örn. https://registry.npmjs.org/","baseUrl":"Temel URL","baseUrlDescription":"MCP istekleri ve OAuth geri çağrıları için temel URL","baseUrlPlaceholder":"örn. http://localhost:3000","installConfig":"Kurulum","systemConfigUpdated":"Sistem yapılandırması başarıyla güncellendi","enableSmartRouting":"Akıllı Yönlendirmeyi Etkinleştir","enableSmartRoutingDescription":"Girdiye göre en uygun aracı aramak için akıllı yönlendirme özelliğini etkinleştir ($smart grup adını kullanarak)","dbUrl":"PostgreSQL URL'si (pgvector desteği gerektirir)","dbUrlPlaceholder":"örn. postgresql://kullanıcı:şifre@localhost:5432/veritabanıadı","embeddingProvider":"Embedding Sağlayıcısı","openaiApiBaseUrl":"OpenAI uyumlu Temel URL","openaiApiBaseUrlPlaceholder":"https://api.openai.com/v1","openaiApiKey":"LLM Sağlayıcı API Anahtarı","openaiApiKeyPlaceholder":"LLM sağlayıcı API anahtarını girin","openaiApiEmbeddingModel":"Entegrasyon Modeli Adı","openaiApiEmbeddingModelPlaceholder":"text-embedding-3-small","basePacingDelayMs":"Temel pacing gecikmesi (ms)","basePacingDelayMsDescription":"Sağlayıcıya gönderilen embedding istekleri arasındaki temel bekleme süresi. Varsayılan 0 — sistem hız sınırlarını otomatik olarak yönetir: Retry-After başlıklarına uyar, başlık yoksa 63 saniyelik bekleme uygular ve her 403/429 yanıtından sonra pacing gecikmesini artırır. Yalnızca sağlayıcınız sabit bir minimum aralık gerektiriyorsa sıfırdan farklı bir değer ayarlayın.","basePacingDelayMsPlaceholder":"Boş = varsayılan 0 ms","basePacingDelayMsAuto":"Varsayılan ({{value}} ms): hız sınırı yönetimi otomatiktir.","basePacingDelayMsZero":"0 ms (varsayılan): hız sınırı yönetimi, uyarlanabilir pacing ve retry mantığı aracılığıyla otomatik olarak yapılır.","basePacingDelayMsOverride":"Özel değer: varsayılan temel pacing gecikmesini geçersiz kılar.","embeddingEncodingFormat":"Embedding Kodlama Formatı","embeddingEncodingFormatDescription":"Embedding vektörleri için kodlama formatı. Otomatik, sağlayıcı desteğine göre algılar.","embeddingEncodingFormatAuto":"Otomatik (Önerilen)","azureOpenaiEndpoint":"Azure OpenAI Uç Noktası","azureOpenaiEndpointPlaceholder":"https://KAYNAK_ADINIZ.openai.azure.com","azureOpenaiApiKey":"Azure OpenAI API Anahtarı","azureOpenaiApiKeyPlaceholder":"Azure OpenAI API anahtarını girin","azureOpenaiApiVersion":"Azure OpenAI API Sürümü","azureOpenaiApiVersionPlaceholder":"2024-02-15-preview","azureOpenaiEmbeddingDeployment":"Azure OpenAI Embedding Dağıtımı","azureOpenaiEmbeddingDeploymentPlaceholder":"text-embedding-3-small","azureOpenaiEmbeddingModel":"Azure Embedding Model Adı","azureOpenaiEmbeddingModelDescription":"Azure'da dağıtılan gerçek OpenAI model adı (örn. text-embedding-3-small). API'ye göndermeden önce doğru token sayımı için kullanılır.","azureOpenaiEmbeddingModelPlaceholder":"text-embedding-3-small","smartRoutingConfigUpdated":"Akıllı yönlendirme yapılandırması başarıyla güncellendi","progressiveDisclosure":"Aşamalı Açıklama","progressiveDisclosureDescription":"Etkinleştirildiğinde, search_tools yalnızca araç adlarını ve açıklamalarını döndürür. Tam parametre şemasını almak için describe_tool kullanın; bu da token kullanımını azaltır.","embeddingMaxTokens":"Maks. Embedding Token Sayısı","embeddingMaxTokensDescription":"Embedding oluşturmadan önce metin kesme için maksimum token sayısı. Model varsayılanını otomatik olarak kullanmak için boş bırakın. Özel bir değer her zaman model varsayılanını geçersiz kılar. Yerel LLM sağlayıcıları kullanırken bu değeri manuel olarak ayarlamak, kesme hatalarını önlemek için özellikle yararlıdır.","embeddingMaxTokensPlaceholder":"Boş = modele göre otomatik","embeddingMaxTokensAuto":"Otomatik: {{limit}} token ({{model}} model varsayılanı)","embeddingMaxTokensOverride":"Bu değer model varsayılanını geçersiz kılar.","smartRoutingRequiredFields":"Akıllı yönlendirmeyi etkinleştirmek için Veritabanı URL'si gereklidir. LLM Sağlayıcı API Anahtarı yalnızca bulut tabanlı sağlayıcılar için gereklidir (yerel LLM'ler genellikle API anahtarı gerektirmez, form doğrulamasını geçmek için herhangi bir değer girin)","smartRoutingValidationError":"Akıllı Yönlendirmeyi etkinleştirmeden önce lütfen gerekli alanları doldurun: {{fields}}","mcpRouterConfig":"Bulut Market","mcpRouterApiKey":"MCPRouter API Anahtarı","mcpRouterApiKeyDescription":"MCPRouter bulut market hizmetlerine erişim için API anahtarı","mcpRouterApiKeyPlaceholder":"MCPRouter API anahtarını girin","mcpRouterReferer":"Yönlendiren","mcpRouterRefererDescription":"MCPRouter API istekleri için Referer başlığı","mcpRouterRefererPlaceholder":"https://www.mcphub.app","mcpRouterTitle":"Başlık","mcpRouterTitleDescription":"MCPRouter API istekleri için Başlık başlığı","mcpRouterTitlePlaceholder":"MCPHub","mcpRouterBaseUrl":"Temel URL","mcpRouterBaseUrlDescription":"MCPRouter API için temel URL","mcpRouterBaseUrlPlaceholder":"https://api.mcprouter.to/v1","systemSettings":"Sistem Ayarları","nameSeparatorLabel":"İsim Ayırıcı","nameSeparatorDescription":"Sunucu adı ile araç/istek adını ayırmak için kullanılan karakter (varsayılan: -)","enableSessionRebuild":"Sunucu Oturum Yeniden Oluşturmayı Etkinleştir","enableSessionRebuildDescription":"Etkinleştirildiğinde, daha iyi oturum yönetimi deneyimi için geliştirilmiş sunucu oturum yeniden oluşturma kodunu uygular","restartRequired":"Yapılandırma kaydedildi. Tüm hizmetlerin yeni ayarları doğru şekilde yüklemesini sağlamak için uygulamayı yeniden başlatmanız önerilir.","exportMcpSettings":"Ayarları Dışa Aktar","mcpSettingsJson":"MCP Ayarları JSON","mcpSettingsJsonDescription":"Yedekleme veya diğer araçlara taşıma için mevcut mcp_settings.json yapılandırmanızı görüntüleyin, kopyalayın veya indirin","copyToClipboard":"Panoya Kopyala","downloadJson":"JSON Olarak İndir","exportSuccess":"Ayarlar başarıyla dışa aktarıldı","exportError":"Ayarlar getirilemedi","enableOauthServer":"OAuth Sunucusunu Etkinleştir","enableOauthServerDescription":"MCPHub'ın harici istemciler için OAuth jetonları vermesine izin ver","requireClientSecret":"İstemci Sırrı Zorunlu","requireClientSecretDescription":"Etkin olduğunda gizli istemciler client secret sunmalıdır (yalnızca PKCE kullanan istemciler için kapatabilirsiniz)","requireState":"State parametresi zorunlu","requireStateDescription":"State parametresi olmayan yetkilendirme isteklerini reddeder","accessTokenLifetime":"Erişim jetonu süresi (saniye)","accessTokenLifetimeDescription":"Verilen erişim jetonlarının geçerli kalacağı süre","accessTokenLifetimePlaceholder":"örn. 3600","refreshTokenLifetime":"Yenileme jetonu süresi (saniye)","refreshTokenLifetimeDescription":"Yenileme jetonlarının geçerli kalacağı süre","refreshTokenLifetimePlaceholder":"örn. 1209600","authorizationCodeLifetime":"Yetkilendirme kodu süresi (saniye)","authorizationCodeLifetimeDescription":"Yetkilendirme kodlarının takas edilebileceği süre","authorizationCodeLifetimePlaceholder":"örn. 300","allowedScopes":"İzin verilen kapsamlar","allowedScopesDescription":"Kullanıcıların onaylayabileceği kapsamların virgülle ayrılmış listesi","allowedScopesPlaceholder":"örn. read, write","enableDynamicRegistration":"Dinamik istemci kaydını etkinleştir","dynamicRegistrationDescription":"RFC 7591 uyumlu istemcilerin herkese açık uç nokta üzerinden kayıt olmasına izin ver","dynamicRegistrationAllowedGrantTypes":"İzin verilen grant türleri","dynamicRegistrationAllowedGrantTypesDescription":"Dinamik olarak kaydedilen istemciler için kullanılabilecek grant türlerinin virgülle ayrılmış listesi","dynamicRegistrationAllowedGrantTypesPlaceholder":"örn. authorization_code, refresh_token","dynamicRegistrationAuth":"Kayıt için kimlik doğrulaması iste","dynamicRegistrationAuthDescription":"Kayıt uç noktasını korur, yalnızca kimliği doğrulanmış istekler yeni istemci oluşturabilir","invalidNumberInput":"Lütfen sıfırdan küçük olmayan geçerli bir sayı girin"}`),GC={upload:"Yükle",uploadTitle:"MCPB Paketi Yükle",dropFileHere:".mcpb dosyanızı buraya bırakın",orClickToSelect:"veya bilgisayarınızdan seçmek için tıklayın",invalidFileType:"Lütfen geçerli bir .mcpb dosyası seçin",noFileSelected:"Lütfen yüklemek için bir .mcpb dosyası seçin",uploading:"Yükleniyor...",uploadFailed:"MCPB dosyası yüklenemedi",installServer:"MCPB'den MCP Sunucusu Yükle",extensionInfo:"Uzantı Bilgisi",name:"Ad",version:"Sürüm",description:"Açıklama",author:"Geliştirici",tools:"Araçlar",serverName:"Sunucu Adı",serverNamePlaceholder:"Bu sunucu için bir ad girin",install:"Yükle",installing:"Yükleniyor...",installFailed:"MCPB'den sunucu yüklenemedi",serverExistsTitle:"Sunucu Zaten Mevcut",serverExistsConfirm:"'{{serverName}}' sunucusu zaten mevcut. Yeni sürümle geçersiz kılmak istiyor musunuz?",override:"Geçersiz Kıl"},KC={button:"İçe Aktar",title:"JSON'dan Sunucuları İçe Aktar",inputLabel:"Sunucu Yapılandırma JSON",inputHelp:"Sunucu yapılandırma JSON'unuzu yapıştırın. STDIO, SSE ve HTTP (streamable-http) sunucu türlerini destekler.",preview:"Önizle",previewTitle:"İçe Aktarılacak Sunucuları Önizle",import:"İçe Aktar",importing:"İçe aktarılıyor...",invalidFormat:"Geçersiz JSON formatı. JSON bir 'mcpServers' nesnesi içermelidir.",parseError:"JSON ayrıştırılamadı. Lütfen formatı kontrol edip tekrar deneyin.",addFailed:"Sunucu eklenemedi",importFailed:"Sunucular içe aktarılamadı",partialSuccess:"{{total}} sunucudan {{count}} tanesi başarıyla içe aktarıldı. Bazı sunucular başarısız oldu:"},VC={button:"İçe Aktar",title:"JSON'dan Grupları İçe Aktar",inputLabel:"Grup Yapılandırma JSON",inputHelp:"Grup yapılandırma JSON'unuzu yapıştırın. Her grup bir sunucu listesi içerebilir.",preview:"Önizle",previewTitle:"İçe Aktarılacak Grupları Önizle",import:"İçe Aktar",importing:"İçe aktarılıyor...",invalidFormat:"Geçersiz JSON formatı. JSON bir 'groups' dizisi içermelidir.",missingName:"Her grubun bir 'name' alanı olmalıdır.",parseError:"JSON ayrıştırılamadı. Lütfen formatı kontrol edip tekrar deneyin.",addFailed:"Grup eklenemedi",importFailed:"Gruplar içe aktarılamadı",partialSuccess:"{{total}} gruptan {{count}} tanesi başarıyla içe aktarıldı. Bazı gruplar başarısız oldu:"},$C={add:"Kullanıcı Ekle",addNew:"Yeni Kullanıcı Ekle",edit:"Kullanıcıyı Düzenle",delete:"Kullanıcıyı Sil",create:"Kullanıcı Oluştur",update:"Kullanıcıyı Güncelle",username:"Kullanıcı Adı",password:"Şifre",newPassword:"Yeni Şifre",confirmPassword:"Şifreyi Onayla",changePassword:"Şifre Değiştir",adminRole:"Yönetici",admin:"Yönetici",user:"Kullanıcı",role:"Rol",actions:"Eylemler",addFirst:"İlk kullanıcınızı ekleyin",permissions:"İzinler",adminPermissions:"Tam sistem erişimi",userPermissions:"Sınırlı erişim",currentUser:"Siz",noUsers:"Kullanıcı bulunamadı",adminRequired:"Kullanıcıları yönetmek için yönetici erişimi gereklidir",usernameRequired:"Kullanıcı adı gereklidir",passwordRequired:"Şifre gereklidir",passwordTooShort:"Şifre en az 6 karakter uzunluğunda olmalıdır",passwordMismatch:"Şifreler eşleşmiyor",usernamePlaceholder:"Kullanıcı adını girin",passwordPlaceholder:"Şifreyi girin",newPasswordPlaceholder:"Mevcut şifreyi korumak için boş bırakın",confirmPasswordPlaceholder:"Yeni şifreyi onaylayın",createError:"Kullanıcı oluşturulamadı",updateError:"Kullanıcı güncellenemedi",deleteError:"Kullanıcı silinemedi",statsError:"Kullanıcı istatistikleri getirilemedi",deleteConfirmation:"'{{username}}' kullanıcısını silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.",confirmDelete:"Kullanıcıyı Sil",deleteWarning:"'{{username}}' kullanıcısını silmek istediğinizden emin misiniz? Bu işlem geri alınamaz."},YC={errors:{readonly:"Demo ortamı için salt okunur",invalid_credentials:"Geçersiz kullanıcı adı veya şifre",serverNameRequired:"Sunucu adı gereklidir",serverConfigRequired:"Sunucu yapılandırması gereklidir",serverConfigInvalid:"Sunucu yapılandırması bir URL, OpenAPI şartname URL'si veya şema, ya da argümanlı komut içermelidir",serverTypeInvalid:"Sunucu türü şunlardan biri olmalıdır: stdio, sse, streamable-http, openapi",urlRequiredForType:"{{type}} sunucu türü için URL gereklidir",openapiSpecRequired:"OpenAPI sunucu türü için OpenAPI şartname URL'si veya şema gereklidir",headersInvalidFormat:"Başlıklar bir nesne olmalıdır",headersNotSupportedForStdio:"Başlıklar stdio sunucu türü için desteklenmez",serverNotFound:"Sunucu bulunamadı",failedToRemoveServer:"Sunucu bulunamadı veya kaldırılamadı",internalServerError:"Dahili sunucu hatası",failedToGetServers:"Sunucu bilgileri alınamadı",failedToGetServerSettings:"Sunucu ayarları alınamadı",failedToGetServerConfig:"Sunucu yapılandırması alınamadı",failedToSaveSettings:"Ayarlar kaydedilemedi",toolNameRequired:"Sunucu adı ve araç adı gereklidir",descriptionMustBeString:"Açıklama bir string olmalıdır",groupIdRequired:"Grup ID gereklidir",groupNameRequired:"Grup adı gereklidir",groupNotFound:"Grup bulunamadı",groupIdAndServerNameRequired:"Grup ID ve sunucu adı gereklidir",groupOrServerNotFound:"Grup veya sunucu bulunamadı",toolsMustBeAllOrArray:'Araçlar "all" veya bir string dizisi olmalıdır',serverNameAndToolNameRequired:"Sunucu adı ve araç adı gereklidir",usernameRequired:"Kullanıcı adı gereklidir",userNotFound:"Kullanıcı bulunamadı",failedToGetUsers:"Kullanıcı bilgileri alınamadı",failedToGetUserInfo:"Kullanıcı bilgisi alınamadı",failedToGetUserStats:"Kullanıcı istatistikleri alınamadı",marketServerNameRequired:"Sunucu adı gereklidir",marketServerNotFound:"Market sunucusu bulunamadı",failedToGetMarketServers:"Market sunucuları bilgisi alınamadı",failedToGetMarketServer:"Market sunucusu bilgisi alınamadı",failedToGetMarketCategories:"Market kategorileri alınamadı",failedToGetMarketTags:"Market etiketleri alınamadı",failedToSearchMarketServers:"Market sunucuları aranamadı",failedToFilterMarketServers:"Market sunucuları filtrelenemedi",failedToProcessMcpbFile:"MCPB dosyası işlenemedi"},success:{serverCreated:"Sunucu başarıyla oluşturuldu",serverUpdated:"Sunucu başarıyla güncellendi",serverRemoved:"Sunucu başarıyla kaldırıldı",serverToggled:"Sunucu durumu başarıyla değiştirildi",toolToggled:"{{name}} aracı başarıyla {{action}}",toolDescriptionUpdated:"{{name}} aracının açıklaması başarıyla güncellendi",systemConfigUpdated:"Sistem yapılandırması başarıyla güncellendi",groupCreated:"Grup başarıyla oluşturuldu",groupUpdated:"Grup başarıyla güncellendi",groupDeleted:"Grup başarıyla silindi",serverAddedToGroup:"Sunucu başarıyla gruba eklendi",serverRemovedFromGroup:"Sunucu başarıyla gruptan kaldırıldı",serverToolsUpdated:"Sunucu araçları başarıyla güncellendi"}},JC={authorizationFailed:"Yetkilendirme Başarısız",authorizationFailedError:"Hata",authorizationFailedDetails:"Detaylar",invalidRequest:"Geçersiz İstek",missingStateParameter:"Gerekli OAuth durum parametresi eksik.",missingCodeParameter:"Gerekli yetkilendirme kodu parametresi eksik.",serverNotFound:"Sunucu Bulunamadı",serverNotFoundMessage:"Bu yetkilendirme isteğiyle ilişkili sunucu bulunamadı.",sessionExpiredMessage:"Yetkilendirme oturumunun süresi dolmuş olabilir. Lütfen tekrar yetkilendirmeyi deneyin.",authorizationSuccessful:"Yetkilendirme Başarılı",server:"Sunucu",status:"Durum",connected:"Bağlandı",successMessage:"Sunucu başarıyla yetkilendirildi ve bağlandı.",autoCloseMessage:"Bu pencere 3 saniye içinde otomatik olarak kapanacak...",closeNow:"Şimdi Kapat",connectionError:"Bağlantı Hatası",connectionErrorMessage:"Yetkilendirme başarılı oldu, ancak sunucuya bağlanılamadı.",reconnectMessage:"Lütfen kontrol panelinden yeniden bağlanmayı deneyin.",configurationError:"Yapılandırma Hatası",configurationErrorMessage:"Sunucu aktarımı OAuth finishAuth() desteklemiyor. Lütfen sunucunun streamable-http aktarımıyla yapılandırıldığından emin olun.",internalError:"İçsel Hata",internalErrorMessage:"OAuth geri araması işlenirken beklenmeyen bir hata oluştu.",closeWindow:"Pencereyi Kapat"},QC={add:"Prompt Ekle",addNew:"Yeni Prompt Ekle",edit:"Promptu Düzenle",delete:"Sil",noPrompts:"Yerleşik prompt yapılandırılmamış",addFirst:"İlk promptunuzu ekleyin",name:"Ad",namePlaceholder:"örn. code-review",title:"Başlık",titlePlaceholder:"örn. Kod İnceleme Promptu",description:"Açıklama",descriptionPlaceholder:"Promptun kısa açıklaması",template:"Şablon",templatePlaceholder:"{{parametre}} yer tutucularıyla şablon metni girin...",templateHint:"Şablon parametreleri için {{paramName}} kullanın",arguments:"Argümanlar",addArgument:"Argüman Ekle",argName:"Ad",argDescription:"Açıklama",argRequired:"Zorunlu",enabled:"Etkin",active:"Aktif",inactive:"İnaktif",nameRequired:"Ad zorunludur",templateRequired:"Şablon zorunludur",fetchError:"Yerleşik promptlar yüklenemedi",createError:"Prompt oluşturulamadı",updateError:"Prompt güncellenemedi",deleteError:"Prompt silinemedi",saveError:"Prompt kaydedilemedi",confirmDelete:"Promptu Sil",deleteWarning:'"{{name}}" promptunu silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.'},XC={add:"Kaynak Ekle",addNew:"Yeni Kaynak Ekle",edit:"Kaynağı Düzenle",delete:"Sil",noResources:"Yerleşik kaynak yapılandırılmamış",addFirst:"İlk kaynağınızı ekleyin",uri:"URI",uriPlaceholder:"örn. resource://docs/guide",name:"Ad",namePlaceholder:"örn. Kullanıcı Kılavuzu",description:"Açıklama",descriptionPlaceholder:"Kaynağın kısa açıklaması",mimeType:"MIME Türü",content:"İçerik",contentPlaceholder:"Kaynak içeriğini girin...",enabled:"Etkin",active:"Aktif",inactive:"İnaktif",descriptionUpdateSuccess:"Kaynak açıklaması başarıyla güncellendi",descriptionUpdateFailed:"Kaynak açıklaması güncellenemedi",restoreDefault:"Varsayılana dön",restoreDefaultSuccess:"Kaynak açıklaması varsayılan değere döndürüldü",restoreDefaultFailed:"Varsayılan kaynak açıklamasına dönülemedi",uriRequired:"URI zorunludur",contentRequired:"İçerik zorunludur",fetchError:"Yerleşik kaynaklar yüklenemedi",createError:"Kaynak oluşturulamadı",updateError:"Kaynak güncellenemedi",deleteError:"Kaynak silinemedi",saveError:"Kaynak kaydedilemedi",confirmDelete:"Kaynağı Sil",deleteWarning:'"{{name}}" kaynağını silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.'},ZC={title:"Etkinlik",totalCalls:"Toplam çağrı",successCount:"Başarılı",errorCount:"Başarısız",avgDuration:"Ort. süre",timestamp:"Zaman damgası",server:"Sunucu",tool:"Araç",duration:"Süre",status:"Durum",group:"Grup",key:"API Anahtarı",input:"Girdi",output:"Çıktı",details:"Etkinlik detayları",errorMessage:"Hata mesajı",searchServer:"Sunucu...",searchTool:"Araç...",searchStatus:"Durum...",searchGroup:"Grup...",searchKeyName:"API anahtarı...",keyName:"API Anahtarı Adı",allStatus:"Tüm durumlar",statusSuccess:"Başarılı",statusError:"Hata",noData:"Kullanılabilir etkinlik verisi yok",fetchError:"Etkinlik verileri yüklenemedi",cleanup:"Temizle",confirmCleanup:"30 günden eski etkinlikleri silmek istediğinizden emin misiniz?",cleanupSuccess:"{{count}} eski etkinlik silindi",cleanupError:"Eski etkinlikler temizlenemedi",notAvailable:"Etkinlik takibi yalnızca veritabanı modunda kullanılabilir"},WC={exportButton:"Şablon Dışa Aktar",importButton:"Şablon İçe Aktar",exportTitle:"Yapılandırma Şablonunu Dışa Aktar",importTitle:"Yapılandırma Şablonunu İçe Aktar",name:"Şablon Adı",nameRequired:"Şablon adı gereklidir",namePlaceholder:"Ör: Frontend Geliştirme Araçları",description:"Açıklama",descriptionPlaceholder:"Ör: Frontend geliştirme için standart MCP sunucuları",selectGroups:"Grupları Seç",selectGroupsHelp:"Tüm grupları dışa aktarmak için boş bırakın",selectAll:"Tümünü Seç",deselectAll:"Tümünü Kaldır",includeDisabled:"Devre dışı sunucuları dahil et",exportNote:"Gizli bilgiler (API anahtarları, tokenlar, parolalar) ${PLACEHOLDER} referanslarıyla değiştirilecektir. Alıcıların kendi kimlik bilgilerini sağlaması gerekir.",export:"Dışa Aktar",exporting:"Dışa aktarılıyor...",exportFailed:"Şablon dışa aktarılamadı",import:"İçe Aktar",importing:"İçe aktarılıyor...",importFailed:"Şablon içe aktarılamadı",invalidFormat:"Geçersiz şablon formatı. version, name, servers ve groups alanlarını içermelidir.",parseError:"JSON ayrıştırılamadı. Lütfen formatı kontrol edip tekrar deneyin.",uploadFile:"Şablon Dosyası Yükle",or:"veya",pasteJson:"Şablon JSON Yapıştır",pastePlaceholder:".mcphub-template.json içeriğinizi buraya yapıştırın...",version:"Sürüm",createdAt:"Oluşturulma",servers:"Sunucular",groups:"Gruplar",serversInGroup:"sunucu",envVarsNeeded:"Gerekli Ortam Değişkenleri — içe aktarılan sunucuları kullanmadan önce bunları ayarlayın:",importResult:"Sunucular: {{serversCreated}} oluşturuldu, {{serversSkipped}} atlandı. Gruplar: {{groupsCreated}} oluşturuldu, {{groupsSkipped}} atlandı."},e3={app:vC,about:wC,profile:jC,sponsor:SC,wechat:NC,discord:kC,theme:CC,auth:AC,server:EC,status:RC,errors:TC,common:OC,pagination:zC,nav:MC,pages:PC,logs:DC,groups:LC,market:UC,oauthServer:_C,cloud:BC,registry:IC,tool:FC,prompt:HC,settings:qC,mcpb:GC,jsonImport:KC,groupImport:VC,users:$C,api:YC,oauthCallback:JC,builtinPrompts:QC,builtinResources:XC,activity:ZC,template:WC};er.use(dx).use($2).init({resources:{en:{translation:a4},zh:{translation:_4},fr:{translation:bC},tr:{translation:e3}},fallbackLng:"en",debug:!1,defaultNS:"translation",interpolation:{escapeValue:!1},detection:{order:["localStorage","cookie","htmlTag","navigator"],caches:["localStorage","cookie"]}});const t3=()=>{x1()};t3();async function r3(){try{console.log("Loading runtime configuration...");const a=await g1();console.log("Runtime configuration loaded:",a),window.__MCPHUB_CONFIG__=a,_f.createRoot(document.getElementById("root")).render(t.jsx(Ra.StrictMode,{children:t.jsx(vh,{})}))}catch(a){console.error("Failed to initialize app:",a),console.log("Starting app with default configuration..."),window.__MCPHUB_CONFIG__={basePath:"",version:"dev",name:"mcphub"},_f.createRoot(document.getElementById("root")).render(t.jsx(Ra.StrictMode,{children:t.jsx(vh,{})}))}}r3();export{Yr as a,pt as b,At as c};
|
|
323
|
-
//# sourceMappingURL=index-
|
|
322
|
+
`).filter(f=>f.trim());for(const f of g)if(f.length>50&&f.length<=150)return f}return a.description?a.description.slice(0,150)+"...":l("cloud.noDescription")},u=g=>{try{const f=new Date(g),h=f.getFullYear(),b=(f.getMonth()+1).toString().padStart(2,"0"),y=f.getDate().toString().padStart(2,"0");return`${h}/${b}/${y}`}catch{return""}},m=g=>g.split(" ").map(f=>f.charAt(0)).join("").toUpperCase().slice(0,2);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-lg hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 cursor-pointer group relative overflow-hidden h-full flex flex-col",onClick:o,children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/0 to-purple-50/0 group-hover:from-blue-50/30 group-hover:to-purple-50/30 dark:group-hover:from-blue-900/30 dark:group-hover:to-purple-900/30 transition-all duration-300 pointer-events-none"}),t.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-600 transition-colors duration-200 mb-2 line-clamp-2",children:a.title||a.name}),t.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[t.jsx("div",{className:"w-7 h-7 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white text-xs font-semibold",children:m(a.author_name)}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-700",children:a.author_name}),a.updated_at&&t.jsxs("p",{className:"text-xs text-gray-500",children:[l("cloud.updated")," ",u(a.updated_at)]})]})]})]}),t.jsx("div",{className:"flex flex-col items-end space-y-2",children:t.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:"MCP Server"})})]}),t.jsx("div",{className:"mb-3 flex-1",children:t.jsx("p",{className:"text-gray-600 text-sm leading-relaxed line-clamp-2",children:c()})}),a.tools&&a.tools.length>0&&t.jsx("div",{className:"mb-3",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),t.jsxs("span",{className:"text-sm text-gray-600 font-medium",children:[a.tools.length," ",a.tools.length===1?l("cloud.tool"):l("cloud.tools")]})]})}),t.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-100 dark:border-gray-700 mt-auto",children:[t.jsxs("div",{className:"flex items-center space-x-2 text-xs text-gray-500",children:[t.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"})}),t.jsx("span",{children:u(a.created_at)})]}),t.jsxs("div",{className:"flex items-center text-blue-600 text-sm font-medium group-hover:text-blue-700 transition-colors",children:[t.jsx("span",{children:l("cloud.viewDetails")}),t.jsx("svg",{className:"w-4 h-4 ml-1 transform group-hover:translate-x-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]})]})},fd=()=>{const{t:a}=ve(),n=oa(),l=()=>{n("/settings")},o=()=>{window.open("https://mcprouter.co","_blank","noopener,noreferrer")};return t.jsx("div",{className:"bg-amber-50 border border-amber-200 dark:bg-amber-900/20 dark:border-amber-900/50 rounded-lg p-6 mb-6",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-amber-400 dark:text-amber-500",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsx("h3",{className:"text-sm font-medium text-amber-800 dark:text-amber-400",children:a("cloud.apiKeyNotConfigured")}),t.jsx("div",{className:"mt-2 text-sm text-amber-700 dark:text-amber-300",children:t.jsx("p",{children:a("cloud.apiKeyNotConfiguredDescription")})}),t.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[t.jsxs("button",{onClick:o,className:"inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200",children:[t.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),a("cloud.getApiKey")]}),t.jsxs("button",{onClick:l,className:"inline-flex items-center px-3 py-2 text-sm font-medium text-amber-800 dark:text-amber-400 bg-amber-100 border border-amber-300 dark:bg-amber-900/40 dark:border-amber-700 dark:text-amber-300 rounded-md hover:bg-amber-200 dark:hover:bg-amber-900/60 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-amber-500 dark:focus:ring-amber-400 transition-colors duration-200",children:[t.jsxs("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),a("cloud.configureInSettings")]})]})]})]})})},lN=({serverName:a,onBack:n,onCallTool:l,fetchServerTools:o,onInstall:c,installing:u=!1,isInstalled:m=!1})=>{const{t:g}=ve(),{mcpRouterConfig:f}=Os(),[h,b]=x.useState(null),[y,w]=x.useState(!0),[N,S]=x.useState(null),[j,C]=x.useState([]),[z,E]=x.useState(!1),[T,B]=x.useState(!1),[D,Y]=x.useState(null),[R,_]=x.useState({}),[P,V]=x.useState({}),[K,G]=x.useState({}),[I,L]=x.useState(!1),[Z,A]=x.useState(null),H=X=>(console.error("Checking for MCPRouter API key error:",X),X==="MCPROUTER_API_KEY_NOT_CONFIGURED"||X.toLowerCase().includes("mcprouter api key not configured")),J=()=>m?{className:"bg-green-600 cursor-default px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:g("market.installed")}:u?{className:"bg-gray-400 cursor-not-allowed px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:g("market.installing")}:{className:"bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded text-sm font-medium text-white transition-colors",disabled:!1,text:g("market.install")},me=()=>{!m&&c&&(L(!0),A(null))},le=()=>{L(!1),A(null)},k=async X=>{try{if(!h||!c)return;A(null),c(h,X.config),L(!1)}catch(he){console.error("Error installing server:",he),A(g("errors.serverInstall"))}};x.useEffect(()=>{(async()=>{try{w(!0),S(null);const he=await Be(`/cloud/servers/${a}`);he&&he.success&&he.data?(b(he.data),C(he.data.tools||[])):S(g("cloud.serverNotFound"))}catch(he){console.error("Failed to load server details:",he),S(he instanceof Error?he.message:String(he))}finally{w(!1)}})()},[a,g]),x.useEffect(()=>{(async()=>{if(h&&(!h.tools||h.tools.length===0)&&o){E(!0),B(!1);try{const he=await o(h.name);C(he)}catch(he){console.error("Failed to load tools:",he);const se=he instanceof Error?he.message:String(he);H(se)&&B(!0)}finally{E(!1)}}})()},[h==null?void 0:h.name,h==null?void 0:h.tools,o]);const U=X=>{try{const he=new Date(X),se=he.getFullYear(),ye=String(he.getMonth()+1).padStart(2,"0"),ie=String(he.getDate()).padStart(2,"0"),ae=String(he.getHours()).padStart(2,"0"),be=String(he.getMinutes()).padStart(2,"0"),Ne=String(he.getSeconds()).padStart(2,"0");return`${se}-${ye}-${ie} ${ae}:${be}:${Ne}`}catch{return X}},M=(X,he,se)=>{V(ye=>({...ye,[X]:{...ye[X],[he]:se}}))},q=async X=>{if(!(!l||!h)){Y(X);try{const he=P[X]||{},se=await l(h.server_key,X,he);_(ye=>({...ye,[X]:se}))}catch(he){console.error("Tool call failed:",he);const se=he instanceof Error?he.message:String(he);_(ye=>({...ye,[X]:{error:se}}))}finally{Y(null)}}},de=X=>{G(he=>({...he,[X]:!he[X]}))},ee=(X,he,se)=>{var ae;const ye=((ae=P[X.name])==null?void 0:ae[he])||"",ie=be=>{let Ne=be.target.value;se.type==="number"||se.type==="integer"?Ne=Ne===""?void 0:Number(Ne):se.type==="boolean"&&(Ne=be.target.value==="true"),M(X.name,he,Ne)};return se.type==="boolean"?t.jsxs("select",{value:ye===!0?"true":ye===!1?"false":"",onChange:ie,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",children:[t.jsx("option",{value:""}),t.jsx("option",{value:"true",children:g("common.true")}),t.jsx("option",{value:"false",children:g("common.false")})]}):se.type==="number"||se.type==="integer"?t.jsx("input",{type:"number",step:se.type==="integer"?"1":"any",value:ye||"",onChange:ie,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input"}):t.jsx("input",{type:"text",value:ye||"",onChange:ie,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input"})};return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[t.jsx("div",{className:"mb-6",children:t.jsxs("button",{onClick:n,className:"inline-flex items-center text-gray-600 hover:text-gray-900 transition-colors group",children:[t.jsx("svg",{className:"h-5 w-5 mr-2 transform group-hover:-translate-x-1 transition-transform",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),g("cloud.backToList")]})}),y?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-12",children:t.jsxs("div",{className:"flex flex-col items-center",children:[t.jsxs("svg",{className:"animate-spin h-12 w-12 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600 text-lg",children:g("app.loading")})]})}):N&&!H(N)?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:t.jsx("div",{className:"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("svg",{className:"h-5 w-5 text-red-400 dark:text-red-500 mr-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),t.jsx("p",{className:"text-red-700 dark:text-red-400",children:N})]})})}):h?t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"bg-gradient-to-r from-gray-100 to-gray-200 dark:from-gray-800 dark:to-gray-700 px-6 py-4",children:t.jsxs("div",{className:"flex justify-between items-end",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-800 mb-2",children:h.title||h.name}),t.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-gray-600",children:[t.jsx("span",{className:"text-sm bg-white/60 dark:bg-gray-800/60 text-gray-700 px-3 py-1 rounded-full",children:h.name}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("svg",{className:"h-4 w-4 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"})}),g("cloud.by")," ",h.author_name]})]})]}),t.jsxs("div",{className:"text-right flex flex-col items-end gap-3",children:[t.jsxs("div",{className:"text-xs text-gray-500",children:[g("cloud.updated"),": ",U(h.updated_at)]}),c&&!H(N||"")&&!T&&t.jsx("button",{onClick:me,disabled:J().disabled,className:J().className,children:J().text})]})]})})}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[t.jsx("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),g("cloud.description")]}),t.jsx("p",{className:"text-gray-700 leading-relaxed",children:h.description})]}),h.content&&t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[t.jsx("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),g("cloud.details")]}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 overflow-auto",children:t.jsx("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:h.content})})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[t.jsxs("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),g("cloud.tools"),j.length>0&&t.jsx("span",{className:"ml-2 bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300 text-sm font-medium px-2.5 py-0.5 rounded-full",children:j.length})]}),T&&t.jsx(fd,{}),z?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsxs("svg",{className:"animate-spin h-8 w-8 text-blue-500 mr-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("span",{className:"text-gray-600",children:g("cloud.loadingTools")})]}):j.length===0&&!T?t.jsxs("div",{className:"text-center py-12",children:[t.jsx("svg",{className:"h-12 w-12 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),t.jsx("p",{className:"text-gray-600",children:g("cloud.noTools")})]}):j.length>0?t.jsx("div",{className:"space-y-4",children:j.map((X,he)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-6 hover:border-gray-300 transition-colors",children:[t.jsxs("div",{className:"flex justify-between items-start mb-4",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("h3",{className:"text-lg font-medium text-gray-900 mb-2 flex items-center",children:[t.jsx("span",{className:"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300 text-xs font-medium px-2 py-1 rounded mr-3",children:"TOOL"}),X.name]}),t.jsx("p",{className:"text-gray-600 leading-relaxed whitespace-pre-wrap",children:X.description})]}),l&&t.jsx("button",{onClick:()=>q(X.name),disabled:D===X.name,className:"ml-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center min-w-[100px] justify-center",children:D===X.name?t.jsxs(t.Fragment,{children:[t.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),g("cloud.calling")]}):t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.828 14.828a4 4 0 01-5.656 0M9 10h6m2 8l4-4H7l4 4z"})}),g("cloud.callTool")]})})]}),X.inputSchema&&X.inputSchema.properties&&Object.keys(X.inputSchema.properties).length>0&&t.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700 pt-4",children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700",children:g("cloud.parameters")}),t.jsxs("button",{onClick:()=>de(X.name),className:"text-sm text-blue-600 hover:text-blue-800 focus:outline-none flex items-center gap-1 transition-colors",children:[g("cloud.viewSchema"),t.jsx("svg",{className:`h-3 w-3 transition-transform duration-200 ${K[X.name]?"rotate-90":"rotate-0"}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})]})]}),K[X.name]&&t.jsx("div",{className:"mb-4",children:t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-3 overflow-auto",children:t.jsx("pre",{className:"text-sm text-gray-800",children:JSON.stringify(X.inputSchema,null,2)})})}),t.jsx("div",{className:"space-y-4",children:Object.entries(X.inputSchema.properties).map(([se,ye])=>{var ie;return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:[se,((ie=X.inputSchema.required)==null?void 0:ie.includes(se))&&t.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),ye.description&&t.jsx("p",{className:"text-xs text-gray-500",children:ye.description}),ee(X,se,ye)]},se)})})]}),R[X.name]&&t.jsx("div",{className:"border-t border-gray-100 dark:border-gray-700 pt-4 mt-4",children:R[X.name].error?t.jsx(t.Fragment,{children:H(R[X.name].error)?t.jsx(fd,{}):t.jsxs(t.Fragment,{children:[t.jsxs("h4",{className:"text-sm font-medium text-red-600 mb-3 flex items-center",children:[t.jsx("svg",{className:"h-4 w-4 text-red-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),g("cloud.error")]}),t.jsx("div",{className:"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50 rounded-lg p-4",children:t.jsx("pre",{className:"text-sm text-red-800 dark:text-red-300 whitespace-pre-wrap overflow-auto",children:R[X.name].error})})]})}):t.jsxs(t.Fragment,{children:[t.jsxs("h4",{className:"text-sm font-medium text-gray-700 mb-3 flex items-center",children:[t.jsx("svg",{className:"h-4 w-4 text-green-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),g("cloud.result")]}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsx("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap overflow-auto",children:JSON.stringify(R[X.name],null,2)})})]})})]},he))}):null]})]}):t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-12",children:t.jsxs("div",{className:"text-center",children:[t.jsx("svg",{className:"h-12 w-12 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),t.jsx("p",{className:"text-gray-600 text-lg",children:g("cloud.serverNotFound")})]})}),I&&h&&t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx(Ll,{onSubmit:k,onCancel:le,modalTitle:g("cloud.installServer",{name:h.title||h.name}),formError:Z,initialData:{name:h.name,status:"disconnected",config:{type:"streamable-http",url:h.server_url,headers:{Authorization:`Bearer ${f.apiKey||"<MCPROUTER_API_KEY>"}`,"HTTP-Referer":f.referer||"<YOUR_APP_URL>","X-Title":f.title||"<YOUR_APP_NAME>"}}}})})]})},iN=({serverEntry:a,onClick:n})=>{var z,E;const{t:l}=ve(),{server:o,_meta:c}=a,u=()=>{n(a)},m=()=>o.description&&o.description.length<=150?o.description:o.description?o.description.slice(0,150)+"...":l("registry.noDescription"),g=T=>{if(!T)return"";try{const B=new Date(T),D=B.getFullYear(),Y=(B.getMonth()+1).toString().padStart(2,"0"),R=B.getDate().toString().padStart(2,"0");return`${D}/${Y}/${R}`}catch{return""}},h=o.icons&&o.icons.length>0?o.icons.find(B=>!B.theme||B.theme==="light")||o.icons[0]:null,b=c==null?void 0:c["io.modelcontextprotocol.registry/official"],y=b==null?void 0:b.isLatest,w=b==null?void 0:b.publishedAt,N=b==null?void 0:b.updatedAt,S=((z=o.packages)==null?void 0:z.length)||0,j=((E=o.remotes)==null?void 0:E.length)||0,C=S+j;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-lg hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 cursor-pointer group relative overflow-hidden h-full flex flex-col",onClick:u,children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/0 to-purple-50/0 group-hover:from-blue-50/30 group-hover:to-purple-50/30 dark:group-hover:from-blue-900/30 dark:group-hover:to-purple-900/30 transition-all duration-300 pointer-events-none"}),t.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[t.jsx("div",{className:"flex items-start justify-between mb-3",children:t.jsxs("div",{className:"flex items-start space-x-3 flex-1",children:[h?t.jsx("img",{src:h.src,alt:o.title,className:"w-12 h-12 rounded-lg object-cover flex-shrink-0",onError:T=>{T.currentTarget.style.display="none"}}):t.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-lg flex items-center justify-center text-white text-xl font-semibold flex-shrink-0",children:"M"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-600 transition-colors duration-200 mb-1 line-clamp-2",children:o.name}),t.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[y&&t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800",children:l("registry.latest")}),t.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:["v",o.version]})]})]})]})}),t.jsx("div",{className:"mb-3 flex-1",children:t.jsx("p",{className:"text-gray-600 text-sm leading-relaxed line-clamp-3",children:m()})}),C>0&&t.jsx("div",{className:"mb-3",children:t.jsxs("div",{className:"flex items-center space-x-4",children:[S>0&&t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})}),t.jsxs("span",{className:"text-sm text-gray-600",children:[S," ",l(S===1?"registry.package":"registry.packages")]})]}),j>0&&t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),t.jsxs("span",{className:"text-sm text-gray-600",children:[j," ",l(j===1?"registry.remote":"registry.remotes")]})]})]})}),t.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-100 dark:border-gray-700 mt-auto",children:[t.jsx("div",{className:"flex items-center space-x-2 text-xs text-gray-500",children:(w||N)&&t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"})}),t.jsx("span",{children:g(N||w)})]})}),t.jsxs("div",{className:"flex items-center text-blue-600 text-sm font-medium group-hover:text-blue-700 transition-colors",children:[t.jsx("span",{children:l("registry.viewDetails")}),t.jsx("svg",{className:"w-4 h-4 ml-1 transform group-hover:translate-x-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]})]})},oN=({serverEntry:a,onBack:n,onInstall:l,installing:o=!1,isInstalled:c=!1,fetchVersions:u})=>{const{t:m}=ve(),{server:g,_meta:f}=a,[h,b]=x.useState(g.version),[y,w]=x.useState([]),[N,S]=x.useState(!1),[j,C]=x.useState(!1),[z,E]=x.useState(null),[T,B]=x.useState(null),[D,Y]=x.useState(null),[R,_]=x.useState({packages:!0,remotes:!0,repository:!0}),P=f==null?void 0:f["io.modelcontextprotocol.registry/official"];x.useEffect(()=>{(async()=>{if(u){S(!0);try{const k=await u(g.name);w(k)}catch(k){console.error("Failed to load versions:",k)}finally{S(!1)}}})()},[g.name,u]);const K=g.icons&&g.icons.length>0?g.icons.find(k=>!k.theme||k.theme==="light")||g.icons[0]:null,G=le=>{if(!le)return"";try{return new Date(le).toLocaleDateString()}catch{return""}},I=le=>{_(k=>({...k,[le]:!k[le]}))},L=(le,k)=>{E(le),B(k),Y(null),C(!0)},Z=()=>{C(!1),Y(null)},A=async le=>{try{if(!l||!T||!z)return;Y(null);const k=le.config;l(g,k),C(!1)}catch(k){console.error("Error installing server:",k),Y(m("errors.serverInstall"))}},H=()=>{if(!T||!z)return null;if(console.log("Building initial form data for:",T),z==="package"&&"identifier"in T){const le=T,k={};le.environmentVariables&&le.environmentVariables.forEach(M=>{k[M.name]=M.default||""});const U=cN(le.registryType);return{name:g.name,status:"disconnected",config:{type:"stdio",command:U,args:uN(U,le),env:Object.keys(k).length>0?k:void 0}}}else if(z==="remote"&&"url"in T){const le=T,k={};le.headers&&le.headers.forEach(M=>{k[M.name]=M.default||M.value||""});const U=le.type==="sse"?"sse":"streamable-http";return{name:g.name,status:"disconnected",config:{type:U,url:le.url,headers:Object.keys(k).length>0?k:void 0}}}return null},J=(le,k)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-3 hover:border-blue-400 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-medium text-gray-900",children:le.identifier}),le.version&&t.jsxs("p",{className:"text-sm text-gray-500",children:["Version: ",le.version]}),le.runtimeHint&&t.jsx("p",{className:"text-sm text-gray-600 mt-1",children:le.runtimeHint})]}),t.jsx("button",{onClick:()=>L("package",le),disabled:c||o,className:`px-4 py-2 rounded text-sm font-medium transition-colors ${c?"bg-green-600 text-white cursor-default":o?"bg-gray-400 text-white cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-700"}`,children:m(c?"registry.installed":o?"registry.installing":"registry.install")})]}),le.registryType&&t.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[t.jsx("span",{className:"font-medium",children:"Registry:"})," ",le.registryType]}),le.transport&&t.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[t.jsx("span",{className:"font-medium",children:"Transport:"})," ",le.transport.type,le.transport.url&&t.jsxs("span",{className:"ml-2 text-gray-500",children:["(",le.transport.url,")"]})]}),le.environmentVariables&&le.environmentVariables.length>0&&t.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[t.jsxs("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:[m("registry.environmentVariables"),":"]}),t.jsx("div",{className:"space-y-2",children:le.environmentVariables.map((U,M)=>t.jsxs("div",{className:"text-sm",children:[t.jsxs("div",{className:"flex items-start",children:[t.jsx("span",{className:"font-mono text-gray-900 font-medium",children:U.name}),U.isRequired&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800",children:m("common.required")}),U.isSecret&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:m("common.secret")})]}),U.description&&t.jsx("p",{className:"text-gray-600 mt-1",children:U.description}),U.default&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.default"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.default})]})]},M))})]}),le.packageArguments&&le.packageArguments.length>0&&t.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[t.jsxs("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:[m("registry.packageArguments"),":"]}),t.jsx("div",{className:"space-y-2",children:le.packageArguments.map((U,M)=>t.jsxs("div",{className:"text-sm",children:[t.jsxs("div",{className:"flex items-start",children:[t.jsx("span",{className:"font-mono text-gray-900 font-medium",children:U.name}),U.isRequired&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800",children:m("common.required")}),U.isSecret&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:m("common.secret")}),U.isRepeated&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-300",children:m("common.repeated")})]}),U.description&&t.jsx("p",{className:"text-gray-600 mt-1",children:U.description}),U.type&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.type"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.type})]}),U.default&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.default"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.default})]}),U.value&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.value"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.value})]}),U.valueHint&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.valueHint"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.valueHint})]}),U.choices&&U.choices.length>0&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.choices"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.choices.join(", ")})]})]},M))})]})]},k),me=(le,k)=>t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-3 hover:border-blue-400 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-medium text-gray-900",children:le.type}),t.jsx("p",{className:"text-sm text-gray-600 mt-1 break-all",children:le.url})]}),t.jsx("button",{onClick:()=>L("remote",le),disabled:c||o,className:`px-4 py-2 rounded text-sm font-medium transition-colors ${c?"bg-green-600 text-white cursor-default":o?"bg-gray-400 text-white cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-700"}`,children:m(c?"registry.installed":o?"registry.installing":"registry.install")})]}),le.headers&&le.headers.length>0&&t.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[t.jsxs("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:[m("registry.headers"),":"]}),t.jsx("div",{className:"space-y-2",children:le.headers.map((U,M)=>t.jsxs("div",{className:"text-sm",children:[t.jsxs("div",{className:"flex items-start",children:[t.jsx("span",{className:"font-mono text-gray-900 font-medium",children:U.name}),U.isRequired&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800",children:m("common.required")}),U.isSecret&&t.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:m("common.secret")})]}),U.description&&t.jsx("p",{className:"text-gray-600 mt-1",children:U.description}),U.value&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.value"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.value})]}),U.default&&t.jsxs("p",{className:"text-gray-500 mt-1",children:[t.jsxs("span",{className:"font-medium",children:[m("common.default"),":"]})," ",t.jsx("span",{className:"font-mono",children:U.default})]})]},M))})]})]},k);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6",children:[t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:n,className:"flex items-center text-blue-600 hover:text-blue-800 mb-4 transition-colors",children:[t.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),m("registry.backToList")]}),t.jsxs("div",{className:"flex items-start space-x-4",children:[K?t.jsx("img",{src:K.src,alt:g.title,className:"w-20 h-20 rounded-lg object-cover flex-shrink-0",onError:le=>{le.currentTarget.style.display="none"}}):t.jsx("div",{className:"w-20 h-20 bg-gradient-to-br from-blue-500 to-purple-600 rounded-lg flex items-center justify-center text-white text-3xl font-semibold flex-shrink-0",children:"M"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:g.name}),t.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[(P==null?void 0:P.isLatest)&&t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-800",children:m("registry.latest")}),t.jsxs("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:["v",g.version]}),(P==null?void 0:P.status)&&t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-gray-100 dark:bg-gray-800 text-gray-800",children:P.status}),t.jsxs("span",{className:"flex flex-wrap items-center gap-4 text-sm text-gray-600",children:[(P==null?void 0:P.publishedAt)&&t.jsxs("div",{children:[t.jsxs("span",{className:"font-medium",children:[m("registry.published"),":"]})," ",G(P.publishedAt)]}),(P==null?void 0:P.updatedAt)&&t.jsxs("div",{children:[t.jsxs("span",{className:"font-medium",children:[m("registry.updated"),":"]})," ",G(P.updatedAt)]})]})]})]})]})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-3",children:m("registry.description")}),t.jsx("p",{className:"text-gray-700 leading-relaxed whitespace-pre-wrap",children:g.description})]}),g.websiteUrl&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-3",children:m("registry.website")}),t.jsx("a",{href:g.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 hover:underline",children:g.websiteUrl})]}),g.packages&&g.packages.length>0&&t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:()=>I("packages"),className:"flex items-center justify-between w-full text-xl font-semibold text-gray-900 mb-3 hover:text-blue-600 transition-colors",children:[t.jsxs("span",{children:[m("registry.packages")," (",g.packages.length,")"]}),t.jsx("svg",{className:`w-5 h-5 transform transition-transform ${R.packages?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),R.packages&&t.jsx("div",{className:"space-y-3",children:g.packages.map(J)})]}),g.remotes&&g.remotes.length>0&&t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:()=>I("remotes"),className:"flex items-center justify-between w-full text-xl font-semibold text-gray-900 mb-3 hover:text-blue-600 transition-colors",children:[t.jsxs("span",{children:[m("registry.remotes")," (",g.remotes.length,")"]}),t.jsx("svg",{className:`w-5 h-5 transform transition-transform ${R.remotes?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),R.remotes&&t.jsx("div",{className:"space-y-3",children:g.remotes.map(me)})]}),g.repository&&t.jsxs("div",{className:"mb-6",children:[t.jsxs("button",{onClick:()=>I("repository"),className:"flex items-center justify-between w-full text-xl font-semibold text-gray-900 mb-3 hover:text-blue-600 transition-colors",children:[t.jsx("span",{children:m("registry.repository")}),t.jsx("svg",{className:`w-5 h-5 transform transition-transform ${R.repository?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),R.repository&&t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[g.repository.url&&t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"font-medium text-gray-700",children:"URL:"})," ",t.jsx("a",{href:g.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 hover:underline break-all",children:g.repository.url})]}),g.repository.source&&t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"font-medium text-gray-700",children:"Source:"})," ",g.repository.source]}),g.repository.subfolder&&t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"font-medium text-gray-700",children:"Subfolder:"})," ",g.repository.subfolder]}),g.repository.id&&t.jsxs("div",{children:[t.jsx("span",{className:"font-medium text-gray-700",children:"ID:"})," ",g.repository.id]})]})]}),j&&T&&z&&t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx(Ll,{onSubmit:A,onCancel:Z,modalTitle:m("registry.installServer",{name:g.title||g.name}),formError:D,initialData:H()})})]})};function cN(a){switch(a.toLowerCase()){case"pypi":case"python":return"uvx";case"npm":case"node":return"npx";case"oci":case"docker":return"docker";default:return""}}function uN(a,n){const l=[n.identifier+(n.version?`@${n.version}`:"")],o=[];switch(n.packageArguments&&n.packageArguments.length>0&&n.packageArguments.forEach(c=>{if(c.isRequired||c.default||c.value){const u=`--${c.name}`,m=c.value||c.default||`\${${c.name.toUpperCase()}}`;o.push(u,m)}}),a.toLowerCase()){case"uvx":return[...l,...o];case"npx":return[...l,...o];case"docker":{const c=[];return n.environmentVariables&&n.environmentVariables.forEach(u=>{c.push("-e",`${u.name}`)}),["run","-i","--rm",...c,...l,...o]}default:return[...l,...o]}}const dN=({currentPage:a,hasNextPage:n,hasPreviousPage:l,onNextPage:o,onPreviousPage:c})=>t.jsxs("div",{className:"flex items-center justify-center space-x-2 my-6",children:[t.jsxs("button",{onClick:c,disabled:!l,className:`px-4 py-2 rounded transition-all duration-200 ${l?"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 inline-block mr-1",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Prev"]}),t.jsxs("span",{className:"px-4 py-2 bg-blue-500 text-white rounded btn-primary",children:["Page ",a]}),t.jsxs("button",{onClick:o,disabled:!n,className:`px-4 py-2 rounded transition-all duration-200 ${n?"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary":"bg-gray-100 text-gray-400 cursor-not-allowed"}`,children:["Next",t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 inline-block ml-1",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})]})]}),gh=()=>{const{t:a}=ve(),n=oa(),{serverName:l}=Jh(),{showToast:o}=Pa(),[c,u]=l1(),m=c.get("tab")||"cloud",{servers:g,allServers:f,categories:h,loading:b,error:y,setError:w,searchServers:N,filterByCategory:S,filterByTag:j,selectedCategory:C,selectedTag:z,installServer:E,fetchServerByName:T,isServerInstalled:B,currentPage:D,totalPages:Y,changePage:R,serversPerPage:_,changeServersPerPage:P}=eN(),{servers:V,allServers:K,loading:G,error:I,setError:L,fetchServerTools:Z,callServerTool:A,currentPage:H,totalPages:J,changePage:me,serversPerPage:le,changeServersPerPage:k}=tN(),{servers:U,allServers:M,loading:q,error:de,setError:ee,searchServers:X,clearSearch:he,fetchServerByName:se,fetchServerVersions:ye,currentPage:ie,totalPages:ae,hasNextPage:be,hasPreviousPage:Ne,changePage:xe,goToNextPage:ke,goToPreviousPage:Se,serversPerPage:Le,changeServersPerPage:at}=rN(),[gt,Mt]=x.useState(null),[Pt,Nr]=x.useState(null),[ft,kr]=x.useState(null),[tr,Qt]=x.useState(""),[ht,Re]=x.useState(""),[Oe,it]=x.useState(!1),[qt,Gt]=x.useState(new Set),[ot,_t]=x.useState(new Set);x.useEffect(()=>{(async()=>{if(l)if(m==="cloud"){const $e=V.find(mt=>mt.name===l);$e?Nr($e):n("/market?tab=cloud")}else if(m==="registry"){console.log("Loading registry server details for:",l);const $e=await se(l);$e?kr($e):n("/market?tab=registry")}else{const $e=await T(l);$e?Mt($e):n("/market?tab=local")}else Mt(null),Nr(null),kr(null)})()},[l,m,V,T,se,n]);const bt=Pe=>{const $e=new URLSearchParams(c);$e.set("tab",Pe),u($e),l&&n("/market?"+$e.toString())},Jr=Pe=>{Pe.preventDefault(),m==="local"?N(tr):m==="registry"&&X(ht)},Da=Pe=>{m==="local"&&S(Pe)},La=()=>{m==="local"?(Qt(""),S(""),j("")):m==="registry"&&(Re(""),he())},pr=Pe=>{var $e;if(m==="cloud")n(`/market/${Pe.name}?tab=cloud`);else if(m==="registry"){const mt=Pe;console.log("Registry server clicked:",mt);const ct=($e=mt.server)==null?void 0:$e.name;if(console.log("Server name extracted:",ct),ct){const Dt=`/market/${encodeURIComponent(ct)}?tab=registry`;console.log("Navigating to:",Dt),n(Dt)}else console.error("Server name is undefined in registry server:",mt)}else n(`/market/${Pe.name}?tab=local`)},sr=()=>{n(`/market?tab=${m}`)},Ir=async(Pe,$e)=>{try{it(!0),await E(Pe,$e)&&o(a("market.installSuccess",{serverName:Pe.display_name}),"success")}finally{it(!1)}},nr=async(Pe,$e)=>{try{it(!0);const mt={name:Pe.name,config:$e},ct=await pt("/servers",mt);if(!ct.success){const Dt=(ct==null?void 0:ct.message)||a("server.addError");o(Dt,"error");return}Gt(Dt=>new Set(Dt).add(Pe.name)),o(a("cloud.installSuccess",{name:Pe.title||Pe.name}),"success")}catch(mt){console.error("Error installing cloud server:",mt);const ct=mt instanceof Error?mt.message:String(mt);o(a("cloud.installError",{error:ct}),"error")}finally{it(!1)}},Fr=async(Pe,$e)=>{try{it(!0);const mt={name:Pe.name,config:$e},ct=await pt("/servers",mt);if(!ct.success){const Dt=(ct==null?void 0:ct.message)||a("server.addError");o(Dt,"error");return}_t(Dt=>new Set(Dt).add(Pe.name)),o(a("registry.installSuccess",{name:Pe.title||Pe.name}),"success")}catch(mt){console.error("Error installing registry server:",mt);const ct=mt instanceof Error?mt.message:String(mt);o(a("registry.installError",{error:ct}),"error")}finally{it(!1)}},Q=async(Pe,$e,mt)=>{try{const ct=await A(Pe,$e,mt);return o(a("cloud.toolCallSuccess",{toolName:$e}),"success"),ct}catch(ct){const Dt=ct instanceof Error?ct.message:String(ct);throw we(Dt)||o(a("cloud.toolCallError",{toolName:$e,error:Dt}),"error"),ct}},we=Pe=>Pe==="MCPROUTER_API_KEY_NOT_CONFIGURED"||Pe.toLowerCase().includes("mcprouter api key not configured"),He=Pe=>{m==="local"?R(Pe):m==="registry"?xe(Pe):me(Pe),window.scrollTo({top:0,behavior:"smooth"})},jt=Pe=>{const $e=parseInt(Pe.target.value,10);m==="local"?P($e):m==="registry"?at($e):k($e)};if(gt)return t.jsx(sN,{server:gt,onBack:sr,onInstall:Ir,installing:Oe,isInstalled:B(gt.name)});if(Pt)return t.jsx(lN,{serverName:Pt.name,onBack:sr,onCallTool:Q,fetchServerTools:Z,onInstall:nr,installing:Oe,isInstalled:qt.has(Pt.name)});if(ft)return t.jsx(oN,{serverEntry:ft,onBack:sr,onInstall:Fr,installing:Oe,isInstalled:ot.has(ft.server.name),fetchVersions:ye});const Je=m==="local",We=m==="registry",gr=Je?g:We?U:V,rr=Je?f:We?M:K,Cr=Je?h:[],Hr=Je?b:We?q:G,fe=Je?y:We?de:I,ce=Je?w:We?ee:L,je=Je?C:"",Xt=Je?z:"",dt=Je?D:We?ie:H,Zt=Je?Y:We?ae:J,lr=Je?_:We?Le:le;return t.jsxs("div",{children:[t.jsx("div",{className:"mb-6",children:t.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:t.jsxs("nav",{className:"-mb-px flex space-x-3",children:[t.jsxs("button",{onClick:()=>bt("cloud"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${!Je&&!We?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[a("cloud.title"),t.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",t.jsx("a",{href:"https://mcprouter.co",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"MCPRouter"}),")"]})]}),t.jsxs("button",{onClick:()=>bt("local"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${Je?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[a("market.title"),t.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",t.jsx("a",{href:"https://mcpm.sh",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"MCPM"}),")"]})]}),t.jsxs("button",{onClick:()=>bt("registry"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${We?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[a("registry.title"),t.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",t.jsx("a",{href:"https://registry.modelcontextprotocol.io",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:a("registry.official")}),")"]})]})]})})}),fe&&t.jsx(t.Fragment,{children:!Je&&we(fe)?t.jsx(fd,{}):t.jsx("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 dark:text-red-400 p-4 mb-6 error-box rounded-lg",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{children:fe}),t.jsx("button",{onClick:()=>ce(null),className:"text-red-700 dark:text-red-400 hover:text-red-900 transition-colors duration-200",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 011.414 0L10 8.586l4.293-4.293a1 1 01.414 1.414L11.414 10l4.293 4.293a1 1 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 01-1.414-1.414L8.586 10 4.293 5.707a1 1 010-1.414z",clipRule:"evenodd"})})})]})})}),(Je||We)&&t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 mb-6 page-card",children:t.jsxs("form",{onSubmit:Jr,className:"flex space-x-4 mb-0",children:[t.jsx("div",{className:"flex-grow",children:t.jsx("input",{type:"text",value:We?ht:tr,onChange:Pe=>{We?Re(Pe.target.value):Qt(Pe.target.value)},placeholder:a(We?"registry.searchPlaceholder":"market.searchPlaceholder"),className:"shadow appearance-none border border-gray-200 dark:border-gray-700 rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input"})}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200",children:a(We?"registry.search":"market.search")}),(Je&&(tr||je||Xt)||We&&ht)&&t.jsx("button",{type:"button",onClick:La,className:"border border-gray-300 text-gray-700 font-medium py-2 px-4 rounded hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 btn-secondary transition-all duration-200",children:a(We?"registry.clearFilters":"market.clearFilters")})]})}),t.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[Je&&t.jsx("div",{className:"md:w-48 flex-shrink-0",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-4 mb-6 sticky top-4 page-card",children:Cr.length>0?t.jsxs("div",{className:"mb-6",children:[t.jsxs("div",{className:"flex justify-between items-center mb-3",children:[t.jsx("h3",{className:"font-medium text-gray-900",children:a("market.categories")}),je&&t.jsx("span",{className:"text-xs text-blue-600 cursor-pointer hover:underline transition-colors duration-200",onClick:()=>S(""),children:a("market.clearCategoryFilter")})]}),t.jsx("div",{className:"flex flex-col gap-2",children:Cr.map(Pe=>t.jsx("button",{onClick:()=>Da(Pe),className:`px-3 py-2 rounded text-sm text-left transition-all duration-200 ${je===Pe?"bg-blue-100 text-blue-800 font-medium btn-primary":"bg-gray-100 text-gray-800 hover:bg-gray-200 btn-secondary"}`,children:Pe},Pe))})]}):Hr?t.jsxs("div",{className:"mb-6",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"font-medium text-gray-900",children:a("market.categories")})}),t.jsxs("div",{className:"flex flex-col gap-2 items-center py-4 loading-container",children:[t.jsxs("svg",{className:"animate-spin h-6 w-6 text-blue-500 mb-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-sm text-gray-600",children:a("app.loading")})]})]}):t.jsxs("div",{className:"mb-6",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"font-medium text-gray-900",children:a("market.categories")})}),t.jsx("p",{className:"text-sm text-gray-600 py-2",children:a("market.noCategories")})]})})}),t.jsx("div",{className:"flex-grow",children:Hr?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600",children:a("app.loading")})]})}):gr.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6",children:t.jsx("p",{className:"text-gray-600",children:a(Je?"market.noServers":We?"registry.noServers":"cloud.noServers")})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:gr.map((Pe,$e)=>Je?t.jsx(aN,{server:Pe,onClick:pr},$e):We?t.jsx(iN,{serverEntry:Pe,onClick:pr},$e):t.jsx(nN,{server:Pe,onClick:pr},$e))}),t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:"flex-[2] text-sm text-gray-500",children:Je?a("market.showing",{from:(dt-1)*lr+1,to:Math.min(dt*lr,rr.length),total:rr.length}):We?a("registry.showing",{from:(dt-1)*lr+1,to:(dt-1)*lr+gr.length,total:rr.length+(be?"+":"")}):a("cloud.showing",{from:(dt-1)*lr+1,to:Math.min(dt*lr,rr.length),total:rr.length})}),t.jsx("div",{className:"flex-[4] flex justify-center",children:We?t.jsx(dN,{currentPage:dt,hasNextPage:be,hasPreviousPage:Ne,onNextPage:ke,onPreviousPage:Se}):t.jsx(Ld,{currentPage:dt,totalPages:Zt,onPageChange:He})}),t.jsxs("div",{className:"flex-[2] flex items-center justify-end space-x-2",children:[t.jsxs("label",{htmlFor:"perPage",className:"text-sm text-gray-600",children:[a(Je?"market.perPage":We?"registry.perPage":"cloud.perPage"),":"]}),t.jsxs("select",{id:"perPage",value:lr,onChange:jt,className:"border rounded p-1 text-sm btn-secondary outline-none",children:[t.jsx("option",{value:"6",children:"6"}),t.jsx("option",{value:"9",children:"9"}),t.jsx("option",{value:"12",children:"12"}),t.jsx("option",{value:"24",children:"24"})]})]})]})]})})]})]})};function fh(a,n){if(typeof a=="function")return a(n);a!=null&&(a.current=n)}function mN(...a){return n=>{let l=!1;const o=a.map(c=>{const u=fh(c,n);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c<o.length;c++){const u=o[c];typeof u=="function"?u():fh(a[c],null)}}}}function pN(a){const n=fN(a),l=x.forwardRef((o,c)=>{const{children:u,...m}=o,g=x.Children.toArray(u),f=g.find(xN);if(f){const h=f.props.children,b=g.map(y=>y===f?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:y);return t.jsx(n,{...m,ref:c,children:x.isValidElement(h)?x.cloneElement(h,void 0,b):null})}return t.jsx(n,{...m,ref:c,children:u})});return l.displayName=`${a}.Slot`,l}var gN=pN("Slot");function fN(a){const n=x.forwardRef((l,o)=>{const{children:c,...u}=l;if(x.isValidElement(c)){const m=bN(c),g=yN(u,c.props);return c.type!==x.Fragment&&(g.ref=o?mN(o,m):m),x.cloneElement(c,g)}return x.Children.count(c)>1?x.Children.only(null):null});return n.displayName=`${a}.SlotClone`,n}var hN=Symbol("radix.slottable");function xN(a){return x.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===hN}function yN(a,n){const l={...n};for(const o in n){const c=a[o],u=n[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...g)=>{const f=u(...g);return c(...g),f}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...a,...l}}function bN(a){var o,c;let n=(o=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:o.get,l=n&&"isReactWarning"in n&&n.isReactWarning;return l?a.ref:(n=(c=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:c.get,l=n&&"isReactWarning"in n&&n.isReactWarning,l?a.props.ref:a.props.ref||a.ref)}const vN={default:"bg-blue-500 text-white hover:bg-blue-600 focus:ring-blue-500",outline:"border border-gray-300 dark:border-gray-700 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300",link:"bg-transparent underline-offset-4 hover:underline text-blue-500 hover:text-blue-600",destructive:"bg-red-500 text-white hover:bg-red-600 focus:ring-red-500"},wN={default:"h-10 py-2 px-4",sm:"h-8 px-3 text-sm",lg:"h-12 px-6",icon:"h-10 w-10 p-0 text-center"};function jN({variant:a="default",size:n="default",className:l,disabled:o,loading:c=!1,asChild:u=!1,children:m,onClick:g,...f}){const[h,b]=x.useState(!1),y=c||h,w=async S=>{if(g)try{const j=g(S);j&&typeof j.then=="function"&&(b(!0),await j)}finally{b(!1)}},N=u?gN:"button";return t.jsx(N,{className:la("rounded-md inline-flex items-center justify-center font-medium transition-all duration-200 active:scale-95 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none relative",vN[a],wN[n],l),disabled:o||y,onClick:w,...f,children:u?m:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:la("flex items-center justify-center",y&&"invisible"),children:m}),y&&t.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]})})}const SN=({logs:a,isLoading:n=!1,error:l=null,onClear:o})=>{const{t:c}=ve(),u=x.useRef(null),[m,g]=x.useState(!0),[f,h]=x.useState(""),[b,y]=x.useState(["info","error","warn","debug"]),[w,N]=x.useState(["main","child"]);x.useEffect(()=>{m&&u.current&&(u.current.scrollTop=u.current.scrollHeight)},[a,m]);const S=a.filter(E=>{const T=f?E.message.toLowerCase().includes(f.toLowerCase()):!0,B=b.includes(E.type),D=w.includes(E.source);return T&&B&&D}),j=E=>new Date(E).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),C=E=>{switch(E){case"error":return"bg-red-400/80 text-white";case"warn":return"bg-yellow-400/80 text-gray-900";case"debug":return"bg-purple-400/80 text-white";case"info":return"bg-blue-400/80 text-white";default:return"bg-blue-400/80 text-white"}},z=E=>{switch(E){case"main":return"bg-green-400/80 text-white";case"child":return"bg-orange-400/80 text-white";default:return"bg-gray-400/80 text-white"}};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"bg-card p-3 rounded-t-md flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:"font-semibold text-sm",children:[c("logs.filters"),":"]}),t.jsx("input",{type:"text",placeholder:c("logs.search"),className:"shadow appearance-none border border-gray-200 dark:border-gray-700 rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",value:f,onChange:E=>h(E.target.value)}),t.jsx("div",{className:"flex gap-1 items-center",children:["debug","info","error","warn"].map(E=>t.jsx(ao,{variant:b.includes(E)?"default":"outline",className:`cursor-pointer ${b.includes(E)?C(E):""}`,onClick:()=>{b.includes(E)?y(T=>T.filter(B=>B!==E)):y(T=>[...T,E])},children:E},E))}),t.jsx("div",{className:"flex gap-1 items-center ml-2",children:["main","child"].map(E=>t.jsx(ao,{variant:w.includes(E)?"default":"outline",className:`cursor-pointer ${w.includes(E)?z(E):""}`,onClick:()=>{w.includes(E)?N(T=>T.filter(B=>B!==E)):N(T=>[...T,E])},children:c(E==="main"?"logs.mainProcess":"logs.childProcess")},E))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[t.jsx("input",{type:"checkbox",checked:m,onChange:()=>g(!m),className:"form-checkbox h-4 w-4"}),c("logs.autoScroll")]}),t.jsx(jN,{variant:"outline",size:"sm",onClick:o,className:"btn-secondary",disabled:n||a.length===0,children:c("logs.clearLogs")})]})]}),t.jsx("div",{ref:u,className:"flex-grow p-2 overflow-auto bg-card rounded-b-md font-mono text-sm",style:{maxHeight:"calc(100vh - 300px)"},children:n?t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx("span",{children:c("logs.loading")})}):l?t.jsx("div",{className:"text-red-500 p-2",children:l.message}):S.length===0?t.jsx("div",{className:"text-center text-muted-foreground p-8",children:f||b.length<4||w.length<2?c("logs.noMatch"):c("logs.noLogs")}):S.map((E,T)=>t.jsxs("div",{className:`py-1 ${E.type==="error"?"text-red-500":E.type==="warn"?"text-yellow-500":""}`,children:[t.jsxs("span",{className:"text-gray-400",children:["[",j(E.timestamp),"]"]}),t.jsx(ao,{className:`ml-2 mr-1 ${C(E.type)}`,children:E.type}),t.jsxs(ao,{variant:"default",className:`mr-2 ${z(E.source)}`,children:[E.source==="main"?c("logs.main"):c("logs.child"),E.processId?` (${E.processId})`:""]}),t.jsx("span",{className:"whitespace-pre-wrap",children:E.message})]},`${E.timestamp}-${T}`))})]})},NN=()=>{const{t:a}=ve(),{logs:n,loading:l,error:o,clearLogs:c}=_j();return t.jsxs("div",{className:"container mx-auto p-4",children:[t.jsx("div",{className:"flex justify-between items-center mb-4",children:t.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:a("pages.logs.title")})}),t.jsx("div",{className:"bg-card rounded-md shadow-sm border border-gray-200 dark:border-gray-700 page-card",children:t.jsx(SN,{logs:n,isLoading:l,error:o,onClear:c})})]})},nx=["success","error"],kN=a=>nx.includes(a),CN=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState(null),[u,m]=x.useState(null),[g,f]=x.useState(null),[h,b]=x.useState(1),[y,w]=x.useState(10),[N,S]=x.useState(!0),[j,C]=x.useState(null),[z,E]=x.useState(null),[T,B]=x.useState(!1),[D,Y]=x.useState({}),[R,_]=x.useState(""),[P,V]=x.useState(""),[K,G]=x.useState(""),[I,L]=x.useState(""),[Z,A]=x.useState(""),H=x.useCallback(async()=>{S(!0),C(null);try{const se={...D},[ye,ie,ae]=await Promise.all([tS(h,y,se),aS(se),sS()]);ye!=null&&ye.success&&Array.isArray(ye.data)&&(l(ye.data),ye.pagination&&f(ye.pagination)),ie!=null&&ie.success&&ie.data&&c(ie.data),ae!=null&&ae.success&&ae.data&&m(ae.data)}catch(se){console.error("Error fetching activity data:",se),C(a("activity.fetchError"))}finally{S(!1)}},[h,y,D,a]);x.useEffect(()=>{H()},[H]),x.useEffect(()=>{if(!g)return;const se=Math.max(1,g.totalPages||1);h>se&&b(se)},[g,h]);const J=async se=>{try{const ye=await rS(se.id);ye!=null&&ye.success&&ye.data&&(E(ye.data),B(!0))}catch(ye){console.error("Error fetching activity details:",ye)}},me=async()=>{var se;if(window.confirm(a("activity.confirmCleanup")))try{const ye=await nS(30);ye!=null&&ye.success&&(alert(a("activity.cleanupSuccess",{count:((se=ye.data)==null?void 0:se.deletedCount)||0})),H())}catch(ye){console.error("Error cleaning up activities:",ye),alert(a("activity.cleanupError"))}},le=()=>{const se={};R&&(se.server=R),P&&(se.tool=P),K&&kN(K)&&(se.status=K),I&&(se.group=I),Z&&(se.keyName=Z),Y(se),b(1)},k=()=>{_(""),V(""),G(""),L(""),A(""),Y({}),b(1)},U=se=>se<1e3?`${se}ms`:se<6e4?`${(se/1e3).toFixed(2)}s`:`${(se/6e4).toFixed(2)}m`,M=se=>new Date(se).toLocaleString(),q=se=>{if(!se)return null;try{return JSON.parse(se)}catch{return se}},de=()=>o?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm px-4 py-3 mb-4",children:t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.totalCalls")}),t.jsx("div",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o.totalCalls})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.successCount")}),t.jsx("div",{className:"text-lg font-semibold text-green-600",children:o.successCount})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.errorCount")}),t.jsx("div",{className:"text-lg font-semibold text-red-600",children:o.errorCount})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap",children:a("activity.avgDuration")}),t.jsx("div",{className:"text-lg font-semibold text-blue-600",children:U(o.avgDuration)})]})]})}):null,ee=()=>t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm px-4 py-3 mb-4",children:t.jsxs("div",{className:"flex flex-wrap gap-3 items-end",children:[t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-server",children:a("activity.server")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-server",type:"text",value:R,onChange:se=>_(se.target.value),placeholder:a("activity.searchServer"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"server-options"}),R&&t.jsx("button",{onClick:()=>_(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.servers)&&t.jsx("datalist",{id:"server-options",children:u.servers.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-tool",children:a("activity.tool")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-tool",type:"text",value:P,onChange:se=>V(se.target.value),placeholder:a("activity.searchTool"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"tool-options"}),P&&t.jsx("button",{onClick:()=>V(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.tools)&&t.jsx("datalist",{id:"tool-options",children:u.tools.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-status",children:a("activity.status")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-status",type:"text",value:K,onChange:se=>G(se.target.value.toLowerCase()),placeholder:a("activity.searchStatus"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"activity-status-options"}),K&&t.jsx("button",{onClick:()=>G(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),t.jsx("datalist",{id:"activity-status-options",children:nx.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-group",children:a("activity.group")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-group",type:"text",value:I,onChange:se=>L(se.target.value),placeholder:a("activity.searchGroup"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"group-options"}),I&&t.jsx("button",{onClick:()=>L(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.groups)&&t.jsx("datalist",{id:"group-options",children:u.groups.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-1 min-w-[140px]",children:[t.jsx("label",{className:"sr-only",htmlFor:"activity-keyname",children:a("activity.keyName")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:"activity-keyname",type:"text",value:Z,onChange:se=>A(se.target.value),placeholder:a("activity.searchKeyName"),className:"w-full h-10 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white pr-9",list:"keyname-options"}),Z&&t.jsx("button",{onClick:()=>A(""),className:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":a("common.clear"),type:"button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),(u==null?void 0:u.keyNames)&&t.jsx("datalist",{id:"keyname-options",children:u.keyNames.map(se=>t.jsx("option",{value:se},se))})]}),t.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[t.jsxs("button",{onClick:le,className:"h-10 px-3 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200 whitespace-nowrap",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})}),a("common.search")]}),t.jsxs("button",{onClick:k,className:"h-10 px-3 bg-gray-100 text-gray-800 rounded hover:bg-gray-200 flex items-center btn-secondary transition-all duration-200 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600 whitespace-nowrap",children:[t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[t.jsx("circle",{cx:"12",cy:"12",r:"9"}),t.jsx("path",{strokeLinecap:"round",d:"M9 9l6 6M15 9l-6 6"})]}),a("common.clear")]})]})]})}),X=()=>n.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow p-8 text-center text-gray-500 dark:text-gray-400",children:a("activity.noData")}):t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.timestamp")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.server")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.tool")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.duration")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.status")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.group")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("activity.key")}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:a("common.actions")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.map(se=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200 whitespace-nowrap",children:M(se.timestamp)}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200",children:t.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-xs",children:se.server})}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200",children:t.jsx("span",{className:"font-mono bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded text-xs",children:se.tool})}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-200 whitespace-nowrap",children:U(se.duration)}),t.jsx("td",{className:"px-4 py-3 text-sm whitespace-nowrap",children:t.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${se.status==="success"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:se.status==="success"?a("activity.statusSuccess"):a("activity.statusError")})}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400",children:se.group||"-"}),t.jsx("td",{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400",children:se.keyName||"-"}),t.jsx("td",{className:"px-4 py-3 text-sm",children:t.jsx("button",{onClick:()=>J(se),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:a("common.view")})})]},se.id))})]})})}),he=()=>{if(!T||!z)return null;const se=q(z.input),ye=q(z.output);return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl w-full mx-4 max-h-[90vh] overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:a("activity.details")}),t.jsx("button",{onClick:()=>B(!1),className:"text-gray-400 hover:text-gray-500 dark:hover:text-gray-300",children:t.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-120px)]",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.timestamp")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:M(z.timestamp)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.duration")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:U(z.duration)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.server")}),t.jsx("p",{className:"text-gray-900 dark:text-white font-mono",children:z.server})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.tool")}),t.jsx("p",{className:"text-gray-900 dark:text-white font-mono",children:z.tool})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.status")}),t.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${z.status==="success"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:z.status==="success"?a("activity.statusSuccess"):a("activity.statusError")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.group")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:z.group||"-"})]}),z.keyName&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:a("activity.key")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:z.keyName})]})]}),z.errorMessage&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-red-500 mb-1",children:a("activity.errorMessage")}),t.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 rounded p-3 text-sm text-red-800 dark:text-red-200",children:z.errorMessage})]}),se&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:a("activity.input")}),t.jsx("pre",{className:"bg-gray-100 dark:bg-gray-700 rounded p-3 text-sm overflow-x-auto max-h-64",children:typeof se=="string"?se:JSON.stringify(se,null,2)})]}),ye&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:a("activity.output")}),t.jsx("pre",{className:"bg-gray-100 dark:bg-gray-700 rounded p-3 text-sm overflow-x-auto max-h-64",children:typeof ye=="string"?ye:JSON.stringify(ye,null,2)})]})]})]})})};return t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between items-center mb-6",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a("activity.title")}),t.jsx("div",{className:"flex space-x-4",children:t.jsxs("button",{onClick:me,className:"px-4 py-2 bg-red-100 text-red-800 rounded hover:bg-red-200 flex items-center transition-all duration-200",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),a("activity.cleanup")]})})]}),j&&t.jsx("div",{className:"mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded shadow-sm",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-red-700",children:j}),t.jsx("button",{onClick:()=>C(null),className:"ml-4 text-gray-500 hover:text-gray-700",children:t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[t.jsx("circle",{cx:"12",cy:"12",r:"9"}),t.jsx("path",{strokeLinecap:"round",d:"M9 9l6 6M15 9l-6 6"})]})})]})}),N&&n.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 flex items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:a("app.loading")})]})}):t.jsxs(t.Fragment,{children:[de(),ee(),X(),t.jsxs("div",{className:"flex items-center mt-6",children:[t.jsx("div",{className:"flex-[2] text-sm text-gray-500 dark:text-gray-400",children:g&&a("common.showing",{start:(g.page-1)*g.limit+1,end:Math.min(g.page*g.limit,g.total),total:g.total})}),t.jsx("div",{className:"flex-[4] flex justify-center",children:g&&g.totalPages>1&&t.jsx(Ld,{currentPage:h,totalPages:g.totalPages,onPageChange:b,disabled:N})}),t.jsxs("div",{className:"flex-[2] flex items-center justify-end space-x-2",children:[t.jsxs("label",{htmlFor:"perPage",className:"text-sm text-gray-500 dark:text-gray-400",children:[a("common.itemsPerPage"),":"]}),t.jsxs("select",{id:"perPage",value:y,onChange:se=>{w(Number(se.target.value)),b(1)},disabled:N,className:"border border-gray-300 dark:border-gray-600 rounded p-1 text-sm dark:bg-gray-700 dark:text-white outline-none disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx("option",{value:10,children:"10"}),t.jsx("option",{value:20,children:"20"}),t.jsx("option",{value:50,children:"50"}),t.jsx("option",{value:100,children:"100"})]})]})]})]}),he()]})},AN=async()=>{const a=await Be("/prompts");if(!a.success)throw new Error(a.message||"Failed to fetch built-in prompts");return a.data||[]},EN=async a=>{const n=await pt("/prompts",a);if(!n.success)throw new Error(n.message||"Failed to create built-in prompt");return n.data},RN=async(a,n)=>{const l=await At(`/prompts/${a}`,n);if(!l.success)throw new Error(l.message||"Failed to update built-in prompt");return l.data},TN=async a=>{const n=await Yr(`/prompts/${a}`);if(!n.success)throw new Error(n.message||"Failed to delete built-in prompt")},ON=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState(!0),[u,m]=x.useState(null),[g,f]=x.useState(0),h=x.useCallback(async()=>{try{c(!0);const S=await AN();l(S),m(null)}catch(S){console.error("Error fetching built-in prompts:",S),m(S instanceof Error?S.message:a("builtinPrompts.fetchError")),l([])}finally{c(!1)}},[a]),b=x.useCallback(()=>{f(S=>S+1)},[]),y=async S=>{try{const j=await EN(S);return b(),{success:!0,data:j}}catch(j){const C=j instanceof Error?j.message:a("builtinPrompts.createError");return m(C),{success:!1,message:C}}},w=async(S,j)=>{try{const C=await RN(S,j);return b(),{success:!0,data:C}}catch(C){const z=C instanceof Error?C.message:a("builtinPrompts.updateError");return m(z),{success:!1,message:z}}},N=async S=>{try{return await TN(S),b(),{success:!0}}catch(j){const C=j instanceof Error?j.message:a("builtinPrompts.deleteError");return m(C),{success:!1,message:C}}};return x.useEffect(()=>{h()},[h,g]),{prompts:n,loading:o,error:u,setError:m,triggerRefresh:b,addPrompt:y,editPrompt:w,removePrompt:N}},hh=({prompt:a,onSave:n,onCancel:l})=>{const{t:o}=ve(),[c,u]=x.useState(null),[m,g]=x.useState(!1),[f,h]=x.useState((a==null?void 0:a.name)||""),[b,y]=x.useState((a==null?void 0:a.title)||""),[w,N]=x.useState((a==null?void 0:a.description)||""),[S,j]=x.useState((a==null?void 0:a.template)||""),[C,z]=x.useState((a==null?void 0:a.enabled)!==!1),[E,T]=x.useState((a==null?void 0:a.arguments)||[]),B=()=>{T([...E,{name:"",description:"",required:!1}])},D=_=>{T(E.filter((P,V)=>V!==_))},Y=(_,P,V)=>{T(E.map((K,G)=>G===_?{...K,[P]:V}:K))},R=async _=>{if(_.preventDefault(),u(null),!f.trim()){u(o("builtinPrompts.nameRequired"));return}if(!S.trim()){u(o("builtinPrompts.templateRequired"));return}g(!0);try{const P=await n({name:f.trim(),title:b.trim()||void 0,description:w.trim()||void 0,template:S,arguments:E.length>0?E.filter(V=>V.name.trim()):void 0,enabled:C});P.success||u(P.message||o("builtinPrompts.saveError"))}catch(P){u(P instanceof Error?P.message:o("builtinPrompts.saveError"))}finally{g(!1)}};return t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-xl shadow-2xl max-w-3xl w-full mx-4 border border-gray-100 dark:border-gray-700 max-h-[90vh] overflow-y-auto",children:t.jsxs("form",{onSubmit:R,children:[t.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-6",children:o(a?"builtinPrompts.edit":"builtinPrompts.addNew")}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 rounded-md",children:t.jsx("p",{className:"text-sm font-medium",children:c})}),t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinPrompts.name")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("input",{type:"text",value:f,onChange:_=>h(_.target.value),placeholder:o("builtinPrompts.namePlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",required:!0,disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinPrompts.title")}),t.jsx("input",{type:"text",value:b,onChange:_=>y(_.target.value),placeholder:o("builtinPrompts.titlePlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinPrompts.description")}),t.jsx("input",{type:"text",value:w,onChange:_=>N(_.target.value),placeholder:o("builtinPrompts.descriptionPlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinPrompts.template")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("textarea",{value:S,onChange:_=>j(_.target.value),placeholder:o("builtinPrompts.templatePlaceholder"),rows:6,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-mono text-sm transition-all duration-200",required:!0,disabled:m}),t.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:o("builtinPrompts.templateHint")})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:o("builtinPrompts.arguments")}),t.jsxs("button",{type:"button",onClick:B,className:"text-blue-600 hover:text-blue-800 text-sm flex items-center",disabled:m,children:[t.jsx(Td,{size:14,className:"mr-1"}),o("builtinPrompts.addArgument")]})]}),E.map((_,P)=>t.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[t.jsx("input",{type:"text",value:_.name,onChange:V=>Y(P,"name",V.target.value),placeholder:o("builtinPrompts.argName"),className:"flex-1 px-3 py-1.5 border border-gray-300 dark:border-gray-600 rounded-lg text-sm bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:m}),t.jsx("input",{type:"text",value:_.description||"",onChange:V=>Y(P,"description",V.target.value),placeholder:o("builtinPrompts.argDescription"),className:"flex-1 px-3 py-1.5 border border-gray-300 dark:border-gray-600 rounded-lg text-sm bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:m}),t.jsxs("label",{className:"flex items-center text-sm text-gray-600 dark:text-gray-400 whitespace-nowrap",children:[t.jsx("input",{type:"checkbox",checked:_.required||!1,onChange:V=>Y(P,"required",V.target.checked),className:"mr-1",disabled:m}),o("builtinPrompts.argRequired")]}),t.jsx("button",{type:"button",onClick:()=>D(P),className:"text-red-500 hover:text-red-700 p-1",disabled:m,children:t.jsx(Ma,{size:16})})]},P))]}),t.jsxs("div",{className:"flex items-center pt-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:C,onChange:_=>z(_.target.checked),className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500",disabled:m}),t.jsx("label",{htmlFor:"enabled",className:"ml-2 block text-sm text-gray-700 dark:text-gray-300",children:o("builtinPrompts.enabled")})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 btn-secondary",disabled:m,children:o("common.cancel")}),t.jsx("button",{type:"submit",disabled:m,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 btn-primary transition-all duration-200 shadow-sm disabled:opacity-50",children:o(m?"common.saving":"common.save")})]})]})})})},zN=()=>{var Y;const{t:a}=ve(),{auth:n}=ca(),{prompts:l,loading:o,error:c,setError:u,addPrompt:m,editPrompt:g,removePrompt:f}=ON(),[h,b]=x.useState(!1),[y,w]=x.useState(null),[N,S]=x.useState(null),[j,C]=x.useState(new Set),z=(Y=n.user)==null?void 0:Y.isAdmin,E=R=>{C(_=>{const P=new Set(_);return P.has(R)?P.delete(R):P.add(R),P})},T=async R=>{const _=await m(R);return _.success&&b(!1),_},B=async R=>{if(!y)return{success:!1,message:"No prompt selected"};const _=await g(y.id,R);return _.success&&w(null),_},D=async()=>{N&&(await f(N.id),S(null))};return t.jsxs("div",{className:"container mx-auto",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:a("pages.prompts.title")}),z&&t.jsxs("button",{onClick:()=>b(!0),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 flex items-center btn-primary transition-all duration-200 shadow-sm",children:[t.jsx(Td,{size:16,className:"mr-2"}),a("builtinPrompts.add")]})]}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 error-box rounded-lg shadow-sm",children:t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("p",{children:c}),t.jsx("button",{onClick:()=>u(null),className:"text-red-500 hover:text-red-700",children:t.jsx(Ma,{size:20})})]})}),o?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 loading-container flex justify-center items-center h-64",children:t.jsxs("div",{className:"flex flex-col items-center justify-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("app.loading")})]})}):l.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 empty-state dashboard-card",children:t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:t.jsx(Nn,{className:"h-8 w-8 text-gray-400"})}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-lg font-medium",children:a("builtinPrompts.noPrompts")}),z&&t.jsx("button",{onClick:()=>b(!0),className:"mt-4 text-blue-600 hover:text-blue-800 font-medium",children:a("builtinPrompts.addFirst")})]})}):t.jsx("div",{className:"space-y-3",children:l.map(R=>{const _=j.has(R.id);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden dashboard-card",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 cursor-pointer hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700",onClick:()=>E(R.id),children:[t.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[t.jsx(Nn,{size:18,className:`mr-3 flex-shrink-0 ${R.enabled!==!1?"text-blue-500":"text-gray-400"}`}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:R.title||R.name}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:R.name}),t.jsx("span",{className:`px-2 py-0.5 text-xs rounded-full ${R.enabled!==!1?"bg-green-100 text-green-800 border border-green-200":"bg-gray-100 text-gray-600 border border-gray-200"}`,children:R.enabled!==!1?a("builtinPrompts.active"):a("builtinPrompts.inactive")})]}),R.description&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:R.description})]})]}),t.jsxs("div",{className:"flex items-center ml-4 gap-2",children:[z&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:P=>{P.stopPropagation(),w(R)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/40 transition-colors",title:a("builtinPrompts.edit"),children:t.jsx(ds,{size:18})}),t.jsx("button",{onClick:P=>{P.stopPropagation(),S(R)},className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-1 rounded hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors",title:a("builtinPrompts.delete"),children:t.jsx(So,{size:18})})]}),_?t.jsx(b0,{size:18,className:"text-gray-400"}):t.jsx(us,{size:18,className:"text-gray-400"})]})]}),_&&t.jsxs("div",{className:"px-6 pb-4 border-t border-gray-100 dark:border-gray-700",children:[t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase mb-1",children:a("builtinPrompts.template")}),t.jsx("pre",{className:"text-sm text-gray-800 dark:text-gray-200 bg-gray-50 dark:bg-gray-900 rounded p-3 overflow-x-auto whitespace-pre-wrap font-mono",children:R.template})]}),R.arguments&&R.arguments.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase mb-1",children:a("builtinPrompts.arguments")}),t.jsx("div",{className:"space-y-1",children:R.arguments.map((P,V)=>t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("code",{className:"px-1.5 py-0.5 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded text-xs font-mono",children:"{{"+P.name+"}}"}),P.required&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"}),P.description&&t.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-xs",children:["— ",P.description]})]},V))})]})]})]},R.id)})}),h&&t.jsx(hh,{onSave:T,onCancel:()=>b(!1)}),y&&t.jsx(hh,{prompt:y,onSave:B,onCancel:()=>w(null)}),t.jsx(Dd,{isOpen:!!N,onClose:()=>S(null),onConfirm:D,title:a("builtinPrompts.confirmDelete"),message:a("builtinPrompts.deleteWarning",{name:(N==null?void 0:N.name)||""}),variant:"danger"})]})},MN=async()=>{const a=await Be("/resources");if(!a.success)throw new Error(a.message||"Failed to fetch built-in resources");return a.data||[]},PN=async a=>{const n=await pt("/resources",a);if(!n.success)throw new Error(n.message||"Failed to create built-in resource");return n.data},DN=async(a,n)=>{const l=await At(`/resources/${a}`,n);if(!l.success)throw new Error(l.message||"Failed to update built-in resource");return l.data},LN=async a=>{const n=await Yr(`/resources/${a}`);if(!n.success)throw new Error(n.message||"Failed to delete built-in resource")},UN=()=>{const{t:a}=ve(),[n,l]=x.useState([]),[o,c]=x.useState(!0),[u,m]=x.useState(null),[g,f]=x.useState(0),h=x.useCallback(async()=>{try{c(!0);const S=await MN();l(S),m(null)}catch(S){console.error("Error fetching built-in resources:",S),m(S instanceof Error?S.message:a("builtinResources.fetchError")),l([])}finally{c(!1)}},[a]),b=x.useCallback(()=>{f(S=>S+1)},[]),y=async S=>{try{const j=await PN(S);return b(),{success:!0,data:j}}catch(j){const C=j instanceof Error?j.message:a("builtinResources.createError");return m(C),{success:!1,message:C}}},w=async(S,j)=>{try{const C=await DN(S,j);return b(),{success:!0,data:C}}catch(C){const z=C instanceof Error?C.message:a("builtinResources.updateError");return m(z),{success:!1,message:z}}},N=async S=>{try{return await LN(S),b(),{success:!0}}catch(j){const C=j instanceof Error?j.message:a("builtinResources.deleteError");return m(C),{success:!1,message:C}}};return x.useEffect(()=>{h()},[h,g]),{resources:n,loading:o,error:u,setError:m,triggerRefresh:b,addResource:y,editResource:w,removeResource:N}},xh=({resource:a,onSave:n,onCancel:l})=>{const{t:o}=ve(),[c,u]=x.useState(null),[m,g]=x.useState(!1),[f,h]=x.useState((a==null?void 0:a.uri)||""),[b,y]=x.useState((a==null?void 0:a.name)||""),[w,N]=x.useState((a==null?void 0:a.description)||""),[S,j]=x.useState((a==null?void 0:a.mimeType)||"text/plain"),[C,z]=x.useState((a==null?void 0:a.content)||""),[E,T]=x.useState((a==null?void 0:a.enabled)!==!1),B=async D=>{if(D.preventDefault(),u(null),!f.trim()){u(o("builtinResources.uriRequired"));return}if(!C.trim()){u(o("builtinResources.contentRequired"));return}g(!0);try{const Y=await n({uri:f.trim(),name:b.trim()||void 0,description:w.trim()||void 0,mimeType:S.trim()||"text/plain",content:C,enabled:E});Y.success||u(Y.message||o("builtinResources.saveError"))}catch(Y){u(Y instanceof Error?Y.message:o("builtinResources.saveError"))}finally{g(!1)}};return t.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-xl shadow-2xl max-w-3xl w-full mx-4 border border-gray-100 dark:border-gray-700 max-h-[90vh] overflow-y-auto",children:t.jsxs("form",{onSubmit:B,children:[t.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-6",children:o(a?"builtinResources.edit":"builtinResources.addNew")}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 rounded-md",children:t.jsx("p",{className:"text-sm font-medium",children:c})}),t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinResources.uri")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("input",{type:"text",value:f,onChange:D=>h(D.target.value),placeholder:o("builtinResources.uriPlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-mono text-sm transition-all duration-200",required:!0,disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinResources.name")}),t.jsx("input",{type:"text",value:b,onChange:D=>y(D.target.value),placeholder:o("builtinResources.namePlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinResources.description")}),t.jsx("input",{type:"text",value:w,onChange:D=>N(D.target.value),placeholder:o("builtinResources.descriptionPlaceholder"),className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:o("builtinResources.mimeType")}),t.jsx("input",{type:"text",value:S,onChange:D=>j(D.target.value),placeholder:"text/plain",className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200",disabled:m})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[o("builtinResources.content")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("textarea",{value:C,onChange:D=>z(D.target.value),placeholder:o("builtinResources.contentPlaceholder"),rows:8,className:"w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-mono text-sm transition-all duration-200",required:!0,disabled:m})]}),t.jsxs("div",{className:"flex items-center pt-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:E,onChange:D=>T(D.target.checked),className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500",disabled:m}),t.jsx("label",{htmlFor:"enabled",className:"ml-2 block text-sm text-gray-700 dark:text-gray-300",children:o("builtinResources.enabled")})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[t.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 btn-secondary",disabled:m,children:o("common.cancel")}),t.jsx("button",{type:"submit",disabled:m,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 btn-primary transition-all duration-200 shadow-sm disabled:opacity-50",children:o(m?"common.saving":"common.save")})]})]})})})},_N=()=>{var Y;const{t:a}=ve(),{auth:n}=ca(),{resources:l,loading:o,error:c,setError:u,addResource:m,editResource:g,removeResource:f}=UN(),[h,b]=x.useState(!1),[y,w]=x.useState(null),[N,S]=x.useState(null),[j,C]=x.useState(new Set),z=(Y=n.user)==null?void 0:Y.isAdmin,E=R=>{C(_=>{const P=new Set(_);return P.has(R)?P.delete(R):P.add(R),P})},T=async R=>{const _=await m(R);return _.success&&b(!1),_},B=async R=>{if(!y)return{success:!1,message:"No resource selected"};const _=await g(y.id,R);return _.success&&w(null),_},D=async()=>{N&&(await f(N.id),S(null))};return t.jsxs("div",{className:"container mx-auto",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:a("pages.resources.title")}),z&&t.jsxs("button",{onClick:()=>b(!0),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 flex items-center btn-primary transition-all duration-200 shadow-sm",children:[t.jsx(Td,{size:16,className:"mr-2"}),a("builtinResources.add")]})]}),c&&t.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 text-red-700 p-4 mb-6 error-box rounded-lg shadow-sm",children:t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("p",{children:c}),t.jsx("button",{onClick:()=>u(null),className:"text-red-500 hover:text-red-700",children:t.jsx(Ma,{size:20})})]})}),o?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 loading-container flex justify-center items-center h-64",children:t.jsxs("div",{className:"flex flex-col items-center justify-center",children:[t.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("app.loading")})]})}):l.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg p-6 empty-state dashboard-card",children:t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:t.jsx(Sn,{className:"h-8 w-8 text-gray-400"})}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-lg font-medium",children:a("builtinResources.noResources")}),z&&t.jsx("button",{onClick:()=>b(!0),className:"mt-4 text-blue-600 hover:text-blue-800 font-medium",children:a("builtinResources.addFirst")})]})}):t.jsx("div",{className:"space-y-3",children:l.map(R=>{const _=j.has(R.id);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden dashboard-card",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 cursor-pointer hover:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700",onClick:()=>E(R.id),children:[t.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[t.jsx(Sn,{size:18,className:`mr-3 flex-shrink-0 ${R.enabled!==!1?"text-green-500":"text-gray-400"}`}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:R.name||R.uri}),R.name&&t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:R.uri}),t.jsx("span",{className:`px-2 py-0.5 text-xs rounded-full flex-shrink-0 ${R.enabled!==!1?"bg-green-100 text-green-800 border border-green-200":"bg-gray-100 text-gray-600 border border-gray-200"}`,children:R.enabled!==!1?a("builtinResources.active"):a("builtinResources.inactive")}),R.mimeType&&t.jsx("span",{className:"px-2 py-0.5 text-xs bg-blue-50 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300 rounded-full border border-blue-200 dark:border-blue-800 flex-shrink-0",children:R.mimeType})]}),R.description&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:R.description})]})]}),t.jsxs("div",{className:"flex items-center ml-4 gap-2",children:[z&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:P=>{P.stopPropagation(),w(R)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/40 transition-colors",title:a("builtinResources.edit"),children:t.jsx(ds,{size:18})}),t.jsx("button",{onClick:P=>{P.stopPropagation(),S(R)},className:"text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300 p-1 rounded hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors",title:a("builtinResources.delete"),children:t.jsx(So,{size:18})})]}),_?t.jsx(b0,{size:18,className:"text-gray-400"}):t.jsx(us,{size:18,className:"text-gray-400"})]})]}),_&&t.jsx("div",{className:"px-6 pb-4 border-t border-gray-100 dark:border-gray-700",children:t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase mb-1",children:a("builtinResources.content")}),t.jsx("pre",{className:"text-sm text-gray-800 dark:text-gray-200 bg-gray-50 dark:bg-gray-900 rounded p-3 overflow-x-auto whitespace-pre-wrap font-mono max-h-64 overflow-y-auto",children:R.content})]})})]},R.id)})}),h&&t.jsx(xh,{onSave:T,onCancel:()=>b(!1)}),y&&t.jsx(xh,{resource:y,onSave:B,onCancel:()=>w(null)}),t.jsx(Dd,{isOpen:!!N,onClose:()=>S(null),onConfirm:D,title:a("builtinResources.confirmDelete"),message:a("builtinResources.deleteWarning",{name:(N==null?void 0:N.name)||(N==null?void 0:N.uri)||""}),variant:"danger"})]})},yh="[EMBED_SYNC_ERROR]",BN=8e3,bh=3e4,IN=()=>{const{showToast:a}=Pa(),n=x.useRef(new Map);return x.useEffect(()=>{const l=g=>{const f=Date.now();n.current.forEach((b,y)=>{f-b>=bh&&n.current.delete(y)});const h=n.current.get(g);return h&&f-h<bh?!0:(n.current.set(g,f),!1)},o=g=>{const f=g.match(/server\s+"([^"]+)"/i);return(f==null?void 0:f[1])||null},c=(g,f)=>{l(g)||a(f,"error",BN)},u=g=>{const f=g.replace(yh,"").trim(),h=o(f);if(f.includes("Full embeddings resync failed")){c("embedding-resync-failed","Embedding resynchronization failed. Check smart routing logs and provider limits.");return}if(h){c(`embedding-sync-error:${h}`,`Embedding synchronization failed for server "${h}". Check logs for details.`);return}c(`embedding-sync-error:${f}`,f||"Embedding synchronization failed. Check smart routing logs and provider rate limits.")},m=g=>{var f,h,b;try{const y=JSON.parse(g.data);if((y==null?void 0:y.type)==="embedding-sync-progress"){const N=typeof((f=y.progress)==null?void 0:f.serverName)=="string"?y.progress.serverName:"";(typeof((h=y.progress)==null?void 0:h.status)=="string"?y.progress.status:"")==="error"&&N&&c(`embedding-sync-error:${N}`,`Embedding synchronization failed for server "${N}". Check logs for details.`);return}if((y==null?void 0:y.type)!=="log")return;const w=String(((b=y==null?void 0:y.log)==null?void 0:b.message)||"");if(!w.includes(yh))return;u(w)}catch{}};return Md.subscribe(m)},[a]),null},FN=()=>{const{serverName:a}=Jh();return t.jsx(go,{to:`/market/${a}?tab=cloud`,replace:!0})};function vh(){const a=Pl();return t.jsx(Ej,{children:t.jsx(D2,{children:t.jsx(Tj,{children:t.jsx(Cj,{children:t.jsx(zj,{children:t.jsxs(r1,{basename:a,children:[t.jsx(IN,{}),t.jsxs(Ov,{children:[t.jsx(Ft,{path:"/login",element:t.jsx(mS,{})}),t.jsx(Ft,{element:t.jsx(cS,{}),children:t.jsxs(Ft,{element:t.jsx(oS,{}),children:[t.jsx(Ft,{path:"/",element:t.jsx(pS,{})}),t.jsx(Ft,{path:"/servers",element:t.jsx(US,{})}),t.jsx(Ft,{path:"/groups",element:t.jsx(KS,{})}),t.jsx(Ft,{path:"/prompts",element:t.jsx(zN,{})}),t.jsx(Ft,{path:"/resources",element:t.jsx(_N,{})}),t.jsx(Ft,{path:"/users",element:t.jsx(YS,{})}),t.jsx(Ft,{path:"/market",element:t.jsx(gh,{})}),t.jsx(Ft,{path:"/market/:serverName",element:t.jsx(gh,{})}),t.jsx(Ft,{path:"/cloud",element:t.jsx(go,{to:"/market?tab=cloud",replace:!0})}),t.jsx(Ft,{path:"/cloud/:serverName",element:t.jsx(FN,{})}),t.jsx(Ft,{path:"/logs",element:t.jsx(NN,{})}),t.jsx(Ft,{path:"/activity",element:t.jsx(CN,{})}),t.jsx(Ft,{path:"/settings",element:t.jsx(WS,{})})]})}),t.jsx(Ft,{path:"*",element:t.jsx(go,{to:"/"})})]})]})})})})})})}const De=a=>typeof a=="string",Al=()=>{let a,n;const l=new Promise((o,c)=>{a=o,n=c});return l.resolve=a,l.reject=n,l},wh=a=>a==null?"":""+a,HN=(a,n,l)=>{a.forEach(o=>{n[o]&&(l[o]=n[o])})},qN=/###/g,jh=a=>a&&a.indexOf("###")>-1?a.replace(qN,"."):a,Sh=a=>!a||De(a),El=(a,n,l)=>{const o=De(n)?n.split("."):n;let c=0;for(;c<o.length-1;){if(Sh(a))return{};const u=jh(o[c]);!a[u]&&l&&(a[u]=new l),Object.prototype.hasOwnProperty.call(a,u)?a=a[u]:a={},++c}return Sh(a)?{}:{obj:a,k:jh(o[c])}},Nh=(a,n,l)=>{const{obj:o,k:c}=El(a,n,Object);if(o!==void 0||n.length===1){o[c]=l;return}let u=n[n.length-1],m=n.slice(0,n.length-1),g=El(a,m,Object);for(;g.obj===void 0&&m.length;)u=`${m[m.length-1]}.${u}`,m=m.slice(0,m.length-1),g=El(a,m,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${u}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${u}`]=l},GN=(a,n,l,o)=>{const{obj:c,k:u}=El(a,n,Object);c[u]=c[u]||[],c[u].push(l)},ho=(a,n)=>{const{obj:l,k:o}=El(a,n);if(l&&Object.prototype.hasOwnProperty.call(l,o))return l[o]},KN=(a,n,l)=>{const o=ho(a,l);return o!==void 0?o:ho(n,l)},lx=(a,n,l)=>{for(const o in n)o!=="__proto__"&&o!=="constructor"&&(o in a?De(a[o])||a[o]instanceof String||De(n[o])||n[o]instanceof String?l&&(a[o]=n[o]):lx(a[o],n[o],l):a[o]=n[o]);return a},yn=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var VN={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const $N=a=>De(a)?a.replace(/[&<>"'\/]/g,n=>VN[n]):a;class YN{constructor(n){this.capacity=n,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(n){const l=this.regExpMap.get(n);if(l!==void 0)return l;const o=new RegExp(n);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(n,o),this.regExpQueue.push(n),o}}const JN=[" ",",","?","!",";"],QN=new YN(20),XN=(a,n,l)=>{n=n||"",l=l||"";const o=JN.filter(m=>n.indexOf(m)<0&&l.indexOf(m)<0);if(o.length===0)return!0;const c=QN.getRegExp(`(${o.map(m=>m==="?"?"\\?":m).join("|")})`);let u=!c.test(a);if(!u){const m=a.indexOf(l);m>0&&!c.test(a.substring(0,m))&&(u=!0)}return u},hd=(a,n,l=".")=>{if(!a)return;if(a[n])return Object.prototype.hasOwnProperty.call(a,n)?a[n]:void 0;const o=n.split(l);let c=a;for(let u=0;u<o.length;){if(!c||typeof c!="object")return;let m,g="";for(let f=u;f<o.length;++f)if(f!==u&&(g+=l),g+=o[f],m=c[g],m!==void 0){if(["string","number","boolean"].indexOf(typeof m)>-1&&f<o.length-1)continue;u+=f-u+1;break}c=m}return c},Tl=a=>a==null?void 0:a.replace("_","-"),ZN={type:"logger",log(a){this.output("log",a)},warn(a){this.output("warn",a)},error(a){this.output("error",a)},output(a,n){var l,o;(o=(l=console==null?void 0:console[a])==null?void 0:l.apply)==null||o.call(l,console,n)}};class xo{constructor(n,l={}){this.init(n,l)}init(n,l={}){this.prefix=l.prefix||"i18next:",this.logger=n||ZN,this.options=l,this.debug=l.debug}log(...n){return this.forward(n,"log","",!0)}warn(...n){return this.forward(n,"warn","",!0)}error(...n){return this.forward(n,"error","")}deprecate(...n){return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(n,l,o,c){return c&&!this.debug?null:(De(n[0])&&(n[0]=`${o}${this.prefix} ${n[0]}`),this.logger[l](n))}create(n){return new xo(this.logger,{prefix:`${this.prefix}:${n}:`,...this.options})}clone(n){return n=n||this.options,n.prefix=n.prefix||this.prefix,new xo(this.logger,n)}}var na=new xo;class ko{constructor(){this.observers={}}on(n,l){return n.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(l)||0;this.observers[o].set(l,c+1)}),this}off(n,l){if(this.observers[n]){if(!l){delete this.observers[n];return}this.observers[n].delete(l)}}emit(n,...l){this.observers[n]&&Array.from(this.observers[n].entries()).forEach(([c,u])=>{for(let m=0;m<u;m++)c(...l)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,u])=>{for(let m=0;m<u;m++)c.apply(c,[n,...l])})}}class kh extends ko{constructor(n,l={ns:["translation"],defaultNS:"translation"}){super(),this.data=n||{},this.options=l,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(n){this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}removeNamespaces(n){const l=this.options.ns.indexOf(n);l>-1&&this.options.ns.splice(l,1)}getResource(n,l,o,c={}){var h,b;const u=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,m=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;n.indexOf(".")>-1?g=n.split("."):(g=[n,l],o&&(Array.isArray(o)?g.push(...o):De(o)&&u?g.push(...o.split(u)):g.push(o)));const f=ho(this.data,g);return!f&&!l&&!o&&n.indexOf(".")>-1&&(n=g[0],l=g[1],o=g.slice(2).join(".")),f||!m||!De(o)?f:hd((b=(h=this.data)==null?void 0:h[n])==null?void 0:b[l],o,u)}addResource(n,l,o,c,u={silent:!1}){const m=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator;let g=[n,l];o&&(g=g.concat(m?o.split(m):o)),n.indexOf(".")>-1&&(g=n.split("."),c=l,l=g[1]),this.addNamespaces(l),Nh(this.data,g,c),u.silent||this.emit("added",n,l,o,c)}addResources(n,l,o,c={silent:!1}){for(const u in o)(De(o[u])||Array.isArray(o[u]))&&this.addResource(n,l,u,o[u],{silent:!0});c.silent||this.emit("added",n,l,o)}addResourceBundle(n,l,o,c,u,m={silent:!1,skipCopy:!1}){let g=[n,l];n.indexOf(".")>-1&&(g=n.split("."),c=o,o=l,l=g[1]),this.addNamespaces(l);let f=ho(this.data,g)||{};m.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?lx(f,o,u):f={...f,...o},Nh(this.data,g,f),m.silent||this.emit("added",n,l,o)}removeResourceBundle(n,l){this.hasResourceBundle(n,l)&&delete this.data[n][l],this.removeNamespaces(l),this.emit("removed",n,l)}hasResourceBundle(n,l){return this.getResource(n,l)!==void 0}getResourceBundle(n,l){return l||(l=this.options.defaultNS),this.getResource(n,l)}getDataByLanguage(n){return this.data[n]}hasLanguageSomeTranslations(n){const l=this.getDataByLanguage(n);return!!(l&&Object.keys(l)||[]).find(c=>l[c]&&Object.keys(l[c]).length>0)}toJSON(){return this.data}}var ix={processors:{},addPostProcessor(a){this.processors[a.name]=a},handle(a,n,l,o,c){return a.forEach(u=>{var m;n=((m=this.processors[u])==null?void 0:m.process(n,l,o,c))??n}),n}};const ox=Symbol("i18next/PATH_KEY");function WN(){const a=[],n=Object.create(null);let l;return n.get=(o,c)=>{var u;return(u=l==null?void 0:l.revoke)==null||u.call(l),c===ox?a:(a.push(c),l=Proxy.revocable(o,n),l.proxy)},Proxy.revocable(Object.create(null),n).proxy}function xd(a,n){const{[ox]:l}=a(WN());return l.join((n==null?void 0:n.keySeparator)??".")}const Ch={},ed=a=>!De(a)&&typeof a!="boolean"&&typeof a!="number";class yo extends ko{constructor(n,l={}){super(),HN(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n,this),this.options=l,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=na.create("translator")}changeLanguage(n){n&&(this.language=n)}exists(n,l={interpolation:{}}){const o={...l};if(n==null)return!1;const c=this.resolve(n,o);if((c==null?void 0:c.res)===void 0)return!1;const u=ed(c.res);return!(o.returnObjects===!1&&u)}extractFromKey(n,l){let o=l.nsSeparator!==void 0?l.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator;let u=l.ns||this.options.defaultNS||[];const m=o&&n.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!l.keySeparator&&!this.options.userDefinedNsSeparator&&!l.nsSeparator&&!XN(n,o,c);if(m&&!g){const f=n.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:n,namespaces:De(u)?[u]:u};const h=n.split(o);(o!==c||o===c&&this.options.ns.indexOf(h[0])>-1)&&(u=h.shift()),n=h.join(c)}return{key:n,namespaces:De(u)?[u]:u}}translate(n,l,o){let c=typeof l=="object"?{...l}:l;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),n==null)return"";typeof n=="function"&&(n=xd(n,{...this.options,...c})),Array.isArray(n)||(n=[String(n)]);const u=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,m=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:f}=this.extractFromKey(n[n.length-1],c),h=f[f.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const y=c.lng||this.language,w=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((y==null?void 0:y.toLowerCase())==="cimode")return w?u?{res:`${h}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:y,usedNS:h,usedParams:this.getUsedParamsDetails(c)}:`${h}${b}${g}`:u?{res:g,usedKey:g,exactUsedKey:g,usedLng:y,usedNS:h,usedParams:this.getUsedParamsDetails(c)}:g;const N=this.resolve(n,c);let S=N==null?void 0:N.res;const j=(N==null?void 0:N.usedKey)||g,C=(N==null?void 0:N.exactUsedKey)||g,z=["[object Number]","[object Function]","[object RegExp]"],E=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,T=!this.i18nFormat||this.i18nFormat.handleAsObject,B=c.count!==void 0&&!De(c.count),D=yo.hasDefaultValue(c),Y=B?this.pluralResolver.getSuffix(y,c.count,c):"",R=c.ordinal&&B?this.pluralResolver.getSuffix(y,c.count,{ordinal:!1}):"",_=B&&!c.ordinal&&c.count===0,P=_&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${Y}`]||c[`defaultValue${R}`]||c.defaultValue;let V=S;T&&!S&&D&&(V=P);const K=ed(V),G=Object.prototype.toString.apply(V);if(T&&V&&K&&z.indexOf(G)<0&&!(De(E)&&Array.isArray(V))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const I=this.options.returnedObjectHandler?this.options.returnedObjectHandler(j,V,{...c,ns:f}):`key '${g} (${this.language})' returned an object instead of string.`;return u?(N.res=I,N.usedParams=this.getUsedParamsDetails(c),N):I}if(m){const I=Array.isArray(V),L=I?[]:{},Z=I?C:j;for(const A in V)if(Object.prototype.hasOwnProperty.call(V,A)){const H=`${Z}${m}${A}`;D&&!S?L[A]=this.translate(H,{...c,defaultValue:ed(P)?P[A]:void 0,joinArrays:!1,ns:f}):L[A]=this.translate(H,{...c,joinArrays:!1,ns:f}),L[A]===H&&(L[A]=V[A])}S=L}}else if(T&&De(E)&&Array.isArray(S))S=S.join(E),S&&(S=this.extendTranslation(S,n,c,o));else{let I=!1,L=!1;!this.isValidLookup(S)&&D&&(I=!0,S=P),this.isValidLookup(S)||(L=!0,S=g);const A=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&L?void 0:S,H=D&&P!==S&&this.options.updateMissing;if(L||I||H){if(this.logger.log(H?"updateKey":"missingKey",y,h,g,H?P:S),m){const k=this.resolve(g,{...c,keySeparator:!1});k&&k.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let J=[];const me=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&me&&me[0])for(let k=0;k<me.length;k++)J.push(me[k]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(c.lng||this.language):J.push(c.lng||this.language);const le=(k,U,M)=>{var de;const q=D&&M!==S?M:A;this.options.missingKeyHandler?this.options.missingKeyHandler(k,h,U,q,H,c):(de=this.backendConnector)!=null&&de.saveMissing&&this.backendConnector.saveMissing(k,h,U,q,H,c),this.emit("missingKey",k,h,U,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&B?J.forEach(k=>{const U=this.pluralResolver.getSuffixes(k,c);_&&c[`defaultValue${this.options.pluralSeparator}zero`]&&U.indexOf(`${this.options.pluralSeparator}zero`)<0&&U.push(`${this.options.pluralSeparator}zero`),U.forEach(M=>{le([k],g+M,c[`defaultValue${M}`]||P)})}):le(J,g,P))}S=this.extendTranslation(S,n,c,N,o),L&&S===g&&this.options.appendNamespaceToMissingKey&&(S=`${h}${b}${g}`),(L||I)&&this.options.parseMissingKeyHandler&&(S=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${h}${b}${g}`:g,I?S:void 0,c))}return u?(N.res=S,N.usedParams=this.getUsedParamsDetails(c),N):S}extendTranslation(n,l,o,c,u){var f,h;if((f=this.i18nFormat)!=null&&f.parse)n=this.i18nFormat.parse(n,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=De(n)&&(((h=o==null?void 0:o.interpolation)==null?void 0:h.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let y;if(b){const N=n.match(this.interpolator.nestingRegexp);y=N&&N.length}let w=o.replace&&!De(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(w={...this.options.interpolation.defaultVariables,...w}),n=this.interpolator.interpolate(n,w,o.lng||this.language||c.usedLng,o),b){const N=n.match(this.interpolator.nestingRegexp),S=N&&N.length;y<S&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(n=this.interpolator.nest(n,(...N)=>(u==null?void 0:u[0])===N[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${N[0]} in key: ${l[0]}`),null):this.translate(...N,l),o)),o.interpolation&&this.interpolator.reset()}const m=o.postProcess||this.options.postProcess,g=De(m)?[m]:m;return n!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(n=ix.handle(g,n,l,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),n}resolve(n,l={}){let o,c,u,m,g;return De(n)&&(n=[n]),n.forEach(f=>{if(this.isValidLookup(o))return;const h=this.extractFromKey(f,l),b=h.key;c=b;let y=h.namespaces;this.options.fallbackNS&&(y=y.concat(this.options.fallbackNS));const w=l.count!==void 0&&!De(l.count),N=w&&!l.ordinal&&l.count===0,S=l.context!==void 0&&(De(l.context)||typeof l.context=="number")&&l.context!=="",j=l.lngs?l.lngs:this.languageUtils.toResolveHierarchy(l.lng||this.language,l.fallbackLng);y.forEach(C=>{var z,E;this.isValidLookup(o)||(g=C,!Ch[`${j[0]}-${C}`]&&((z=this.utils)!=null&&z.hasLoadedNamespace)&&!((E=this.utils)!=null&&E.hasLoadedNamespace(g))&&(Ch[`${j[0]}-${C}`]=!0,this.logger.warn(`key "${c}" for languages "${j.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),j.forEach(T=>{var Y;if(this.isValidLookup(o))return;m=T;const B=[b];if((Y=this.i18nFormat)!=null&&Y.addLookupKeys)this.i18nFormat.addLookupKeys(B,b,T,C,l);else{let R;w&&(R=this.pluralResolver.getSuffix(T,l.count,l));const _=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(w&&(l.ordinal&&R.indexOf(P)===0&&B.push(b+R.replace(P,this.options.pluralSeparator)),B.push(b+R),N&&B.push(b+_)),S){const V=`${b}${this.options.contextSeparator||"_"}${l.context}`;B.push(V),w&&(l.ordinal&&R.indexOf(P)===0&&B.push(V+R.replace(P,this.options.pluralSeparator)),B.push(V+R),N&&B.push(V+_))}}let D;for(;D=B.pop();)this.isValidLookup(o)||(u=D,o=this.getResource(T,C,D,l))}))})}),{res:o,usedKey:c,exactUsedKey:u,usedLng:m,usedNS:g}}isValidLookup(n){return n!==void 0&&!(!this.options.returnNull&&n===null)&&!(!this.options.returnEmptyString&&n==="")}getResource(n,l,o,c={}){var u;return(u=this.i18nFormat)!=null&&u.getResource?this.i18nFormat.getResource(n,l,o,c):this.resourceStore.getResource(n,l,o,c)}getUsedParamsDetails(n={}){const l=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=n.replace&&!De(n.replace);let c=o?n.replace:n;if(o&&typeof n.count<"u"&&(c.count=n.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const u of l)delete c[u]}return c}static hasDefaultValue(n){const l="defaultValue";for(const o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&l===o.substring(0,l.length)&&n[o]!==void 0)return!0;return!1}}class Ah{constructor(n){this.options=n,this.supportedLngs=this.options.supportedLngs||!1,this.logger=na.create("languageUtils")}getScriptPartFromCode(n){if(n=Tl(n),!n||n.indexOf("-")<0)return null;const l=n.split("-");return l.length===2||(l.pop(),l[l.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(l.join("-"))}getLanguagePartFromCode(n){if(n=Tl(n),!n||n.indexOf("-")<0)return n;const l=n.split("-");return this.formatLanguageCode(l[0])}formatLanguageCode(n){if(De(n)&&n.indexOf("-")>-1){let l;try{l=Intl.getCanonicalLocales(n)[0]}catch{}return l&&this.options.lowerCaseLng&&(l=l.toLowerCase()),l||(this.options.lowerCaseLng?n.toLowerCase():n)}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}isSupportedCode(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}getBestMatchFromCodes(n){if(!n)return null;let l;return n.forEach(o=>{if(l)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(l=c)}),!l&&this.options.supportedLngs&&n.forEach(o=>{if(l)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return l=c;const u=this.getLanguagePartFromCode(o);if(this.isSupportedCode(u))return l=u;l=this.options.supportedLngs.find(m=>{if(m===u)return m;if(!(m.indexOf("-")<0&&u.indexOf("-")<0)&&(m.indexOf("-")>0&&u.indexOf("-")<0&&m.substring(0,m.indexOf("-"))===u||m.indexOf(u)===0&&u.length>1))return m})}),l||(l=this.getFallbackCodes(this.options.fallbackLng)[0]),l}getFallbackCodes(n,l){if(!n)return[];if(typeof n=="function"&&(n=n(l)),De(n)&&(n=[n]),Array.isArray(n))return n;if(!l)return n.default||[];let o=n[l];return o||(o=n[this.getScriptPartFromCode(l)]),o||(o=n[this.formatLanguageCode(l)]),o||(o=n[this.getLanguagePartFromCode(l)]),o||(o=n.default),o||[]}toResolveHierarchy(n,l){const o=this.getFallbackCodes((l===!1?[]:l)||this.options.fallbackLng||[],n),c=[],u=m=>{m&&(this.isSupportedCode(m)?c.push(m):this.logger.warn(`rejecting language code not found in supportedLngs: ${m}`))};return De(n)&&(n.indexOf("-")>-1||n.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):De(n)&&u(this.formatLanguageCode(n)),o.forEach(m=>{c.indexOf(m)<0&&u(this.formatLanguageCode(m))}),c}}const Eh={zero:0,one:1,two:2,few:3,many:4,other:5},Rh={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class ek{constructor(n,l={}){this.languageUtils=n,this.options=l,this.logger=na.create("pluralResolver"),this.pluralRulesCache={}}addRule(n,l){this.rules[n]=l}clearCache(){this.pluralRulesCache={}}getRule(n,l={}){const o=Tl(n==="dev"?"en":n),c=l.ordinal?"ordinal":"cardinal",u=JSON.stringify({cleanedCode:o,type:c});if(u in this.pluralRulesCache)return this.pluralRulesCache[u];let m;try{m=new Intl.PluralRules(o,{type:c})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Rh;if(!n.match(/-|_/))return Rh;const f=this.languageUtils.getLanguagePartFromCode(n);m=this.getRule(f,l)}return this.pluralRulesCache[u]=m,m}needsPlural(n,l={}){let o=this.getRule(n,l);return o||(o=this.getRule("dev",l)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(n,l,o={}){return this.getSuffixes(n,o).map(c=>`${l}${c}`)}getSuffixes(n,l={}){let o=this.getRule(n,l);return o||(o=this.getRule("dev",l)),o?o.resolvedOptions().pluralCategories.sort((c,u)=>Eh[c]-Eh[u]).map(c=>`${this.options.prepend}${l.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(n,l,o={}){const c=this.getRule(n,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(l)}`:(this.logger.warn(`no plural rule found for: ${n}`),this.getSuffix("dev",l,o))}}const Th=(a,n,l,o=".",c=!0)=>{let u=KN(a,n,l);return!u&&c&&De(l)&&(u=hd(a,l,o),u===void 0&&(u=hd(n,l,o))),u},td=a=>a.replace(/\$/g,"$$$$");class tk{constructor(n={}){var l;this.logger=na.create("interpolator"),this.options=n,this.format=((l=n==null?void 0:n.interpolation)==null?void 0:l.format)||(o=>o),this.init(n)}init(n={}){n.interpolation||(n.interpolation={escapeValue:!0});const{escape:l,escapeValue:o,useRawValueToEscape:c,prefix:u,prefixEscaped:m,suffix:g,suffixEscaped:f,formatSeparator:h,unescapeSuffix:b,unescapePrefix:y,nestingPrefix:w,nestingPrefixEscaped:N,nestingSuffix:S,nestingSuffixEscaped:j,nestingOptionsSeparator:C,maxReplaces:z,alwaysFormat:E}=n.interpolation;this.escape=l!==void 0?l:$N,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=u?yn(u):m||"{{",this.suffix=g?yn(g):f||"}}",this.formatSeparator=h||",",this.unescapePrefix=b?"":y||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=w?yn(w):N||yn("$t("),this.nestingSuffix=S?yn(S):j||yn(")"),this.nestingOptionsSeparator=C||",",this.maxReplaces=z||1e3,this.alwaysFormat=E!==void 0?E:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const n=(l,o)=>(l==null?void 0:l.source)===o?(l.lastIndex=0,l):new RegExp(o,"g");this.regexp=n(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=n(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=n(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(n,l,o,c){var N;let u,m,g;const f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},h=S=>{if(S.indexOf(this.formatSeparator)<0){const E=Th(l,f,S,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,o,{...c,...l,interpolationkey:S}):E}const j=S.split(this.formatSeparator),C=j.shift().trim(),z=j.join(this.formatSeparator).trim();return this.format(Th(l,f,C,this.options.keySeparator,this.options.ignoreJSONStructure),z,o,{...c,...l,interpolationkey:C})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,y=((N=c==null?void 0:c.interpolation)==null?void 0:N.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:S=>td(S)},{regex:this.regexp,safeValue:S=>this.escapeValue?td(this.escape(S)):td(S)}].forEach(S=>{for(g=0;u=S.regex.exec(n);){const j=u[1].trim();if(m=h(j),m===void 0)if(typeof b=="function"){const z=b(n,u,c);m=De(z)?z:""}else if(c&&Object.prototype.hasOwnProperty.call(c,j))m="";else if(y){m=u[0];continue}else this.logger.warn(`missed to pass in variable ${j} for interpolating ${n}`),m="";else!De(m)&&!this.useRawValueToEscape&&(m=wh(m));const C=S.safeValue(m);if(n=n.replace(u[0],C),y?(S.regex.lastIndex+=m.length,S.regex.lastIndex-=u[0].length):S.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),n}nest(n,l,o={}){let c,u,m;const g=(f,h)=>{const b=this.nestingOptionsSeparator;if(f.indexOf(b)<0)return f;const y=f.split(new RegExp(`${b}[ ]*{`));let w=`{${y[1]}`;f=y[0],w=this.interpolate(w,m);const N=w.match(/'/g),S=w.match(/"/g);(((N==null?void 0:N.length)??0)%2===0&&!S||S.length%2!==0)&&(w=w.replace(/'/g,'"'));try{m=JSON.parse(w),h&&(m={...h,...m})}catch(j){return this.logger.warn(`failed parsing options string in nesting for key ${f}`,j),`${f}${b}${w}`}return m.defaultValue&&m.defaultValue.indexOf(this.prefix)>-1&&delete m.defaultValue,f};for(;c=this.nestingRegexp.exec(n);){let f=[];m={...o},m=m.replace&&!De(m.replace)?m.replace:m,m.applyPostProcessor=!1,delete m.defaultValue;const h=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(h!==-1&&(f=c[1].slice(h).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,h)),u=l(g.call(this,c[1].trim(),m),m),u&&c[0]===n&&!De(u))return u;De(u)||(u=wh(u)),u||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${n}`),u=""),f.length&&(u=f.reduce((b,y)=>this.format(b,y,o.lng,{...o,interpolationkey:c[1].trim()}),u.trim())),n=n.replace(c[0],u),this.regexp.lastIndex=0}return n}}const rk=a=>{let n=a.toLowerCase().trim();const l={};if(a.indexOf("(")>-1){const o=a.split("(");n=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);n==="currency"&&c.indexOf(":")<0?l.currency||(l.currency=c.trim()):n==="relativetime"&&c.indexOf(":")<0?l.range||(l.range=c.trim()):c.split(";").forEach(m=>{if(m){const[g,...f]=m.split(":"),h=f.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();l[b]||(l[b]=h),h==="false"&&(l[b]=!1),h==="true"&&(l[b]=!0),isNaN(h)||(l[b]=parseInt(h,10))}})}return{formatName:n,formatOptions:l}},Oh=a=>{const n={};return(l,o,c)=>{let u=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(u={...u,[c.interpolationkey]:void 0});const m=o+JSON.stringify(u);let g=n[m];return g||(g=a(Tl(o),c),n[m]=g),g(l)}},ak=a=>(n,l,o)=>a(Tl(l),o)(n);class sk{constructor(n={}){this.logger=na.create("formatter"),this.options=n,this.init(n)}init(n,l={interpolation:{}}){this.formatSeparator=l.interpolation.formatSeparator||",";const o=l.cacheInBuiltFormats?Oh:ak;this.formats={number:o((c,u)=>{const m=new Intl.NumberFormat(c,{...u});return g=>m.format(g)}),currency:o((c,u)=>{const m=new Intl.NumberFormat(c,{...u,style:"currency"});return g=>m.format(g)}),datetime:o((c,u)=>{const m=new Intl.DateTimeFormat(c,{...u});return g=>m.format(g)}),relativetime:o((c,u)=>{const m=new Intl.RelativeTimeFormat(c,{...u});return g=>m.format(g,u.range||"day")}),list:o((c,u)=>{const m=new Intl.ListFormat(c,{...u});return g=>m.format(g)})}}add(n,l){this.formats[n.toLowerCase().trim()]=l}addCached(n,l){this.formats[n.toLowerCase().trim()]=Oh(l)}format(n,l,o,c={}){const u=l.split(this.formatSeparator);if(u.length>1&&u[0].indexOf("(")>1&&u[0].indexOf(")")<0&&u.find(g=>g.indexOf(")")>-1)){const g=u.findIndex(f=>f.indexOf(")")>-1);u[0]=[u[0],...u.splice(1,g)].join(this.formatSeparator)}return u.reduce((g,f)=>{var y;const{formatName:h,formatOptions:b}=rk(f);if(this.formats[h]){let w=g;try{const N=((y=c==null?void 0:c.formatParams)==null?void 0:y[c.interpolationkey])||{},S=N.locale||N.lng||c.locale||c.lng||o;w=this.formats[h](g,S,{...b,...c,...N})}catch(N){this.logger.warn(N)}return w}else this.logger.warn(`there was no format function for ${h}`);return g},n)}}const nk=(a,n)=>{a.pending[n]!==void 0&&(delete a.pending[n],a.pendingCount--)};class lk extends ko{constructor(n,l,o,c={}){var u,m;super(),this.backend=n,this.store=l,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=na.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(m=(u=this.backend)==null?void 0:u.init)==null||m.call(u,o,c.backend,c)}queueLoad(n,l,o,c){const u={},m={},g={},f={};return n.forEach(h=>{let b=!0;l.forEach(y=>{const w=`${h}|${y}`;!o.reload&&this.store.hasResourceBundle(h,y)?this.state[w]=2:this.state[w]<0||(this.state[w]===1?m[w]===void 0&&(m[w]=!0):(this.state[w]=1,b=!1,m[w]===void 0&&(m[w]=!0),u[w]===void 0&&(u[w]=!0),f[y]===void 0&&(f[y]=!0)))}),b||(g[h]=!0)}),(Object.keys(u).length||Object.keys(m).length)&&this.queue.push({pending:m,pendingCount:Object.keys(m).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(u),pending:Object.keys(m),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(f)}}loaded(n,l,o){const c=n.split("|"),u=c[0],m=c[1];l&&this.emit("failedLoading",u,m,l),!l&&o&&this.store.addResourceBundle(u,m,o,void 0,void 0,{skipCopy:!0}),this.state[n]=l?-1:2,l&&o&&(this.state[n]=0);const g={};this.queue.forEach(f=>{GN(f.loaded,[u],m),nk(f,n),l&&f.errors.push(l),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(h=>{g[h]||(g[h]={});const b=f.loaded[h];b.length&&b.forEach(y=>{g[h][y]===void 0&&(g[h][y]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(f=>!f.done)}read(n,l,o,c=0,u=this.retryTimeout,m){if(!n.length)return m(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:n,ns:l,fcName:o,tried:c,wait:u,callback:m});return}this.readingCalls++;const g=(h,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const y=this.waitingReads.shift();this.read(y.lng,y.ns,y.fcName,y.tried,y.wait,y.callback)}if(h&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,n,l,o,c+1,u*2,m)},u);return}m(h,b)},f=this.backend[o].bind(this.backend);if(f.length===2){try{const h=f(n,l);h&&typeof h.then=="function"?h.then(b=>g(null,b)).catch(g):g(null,h)}catch(h){g(h)}return}return f(n,l,g)}prepareLoading(n,l,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();De(n)&&(n=this.languageUtils.toResolveHierarchy(n)),De(l)&&(l=[l]);const u=this.queueLoad(n,l,o,c);if(!u.toLoad.length)return u.pending.length||c(),null;u.toLoad.forEach(m=>{this.loadOne(m)})}load(n,l,o){this.prepareLoading(n,l,{},o)}reload(n,l,o){this.prepareLoading(n,l,{reload:!0},o)}loadOne(n,l=""){const o=n.split("|"),c=o[0],u=o[1];this.read(c,u,"read",void 0,void 0,(m,g)=>{m&&this.logger.warn(`${l}loading namespace ${u} for language ${c} failed`,m),!m&&g&&this.logger.log(`${l}loaded namespace ${u} for language ${c}`,g),this.loaded(n,m,g)})}saveMissing(n,l,o,c,u,m={},g=()=>{}){var f,h,b,y,w;if((h=(f=this.services)==null?void 0:f.utils)!=null&&h.hasLoadedNamespace&&!((y=(b=this.services)==null?void 0:b.utils)!=null&&y.hasLoadedNamespace(l))){this.logger.warn(`did not save key "${o}" as the namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if((w=this.backend)!=null&&w.create){const N={...m,isUpdate:u},S=this.backend.create.bind(this.backend);if(S.length<6)try{let j;S.length===5?j=S(n,l,o,c,N):j=S(n,l,o,c),j&&typeof j.then=="function"?j.then(C=>g(null,C)).catch(g):g(null,j)}catch(j){g(j)}else S(n,l,o,c,g,N)}!n||!n[0]||this.store.addResource(n[0],l,o,c)}}}const zh=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:a=>{let n={};if(typeof a[1]=="object"&&(n=a[1]),De(a[1])&&(n.defaultValue=a[1]),De(a[2])&&(n.tDescription=a[2]),typeof a[2]=="object"||typeof a[3]=="object"){const l=a[3]||a[2];Object.keys(l).forEach(o=>{n[o]=l[o]})}return n},interpolation:{escapeValue:!0,format:a=>a,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Mh=a=>{var n,l;return De(a.ns)&&(a.ns=[a.ns]),De(a.fallbackLng)&&(a.fallbackLng=[a.fallbackLng]),De(a.fallbackNS)&&(a.fallbackNS=[a.fallbackNS]),((l=(n=a.supportedLngs)==null?void 0:n.indexOf)==null?void 0:l.call(n,"cimode"))<0&&(a.supportedLngs=a.supportedLngs.concat(["cimode"])),typeof a.initImmediate=="boolean"&&(a.initAsync=a.initImmediate),a},so=()=>{},ik=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(l=>{typeof a[l]=="function"&&(a[l]=a[l].bind(a))})};class Ol extends ko{constructor(n={},l){if(super(),this.options=Mh(n),this.services={},this.logger=na,this.modules={external:[]},ik(this),l&&!this.isInitialized&&!n.isClone){if(!this.options.initAsync)return this.init(n,l),this;setTimeout(()=>{this.init(n,l)},0)}}init(n={},l){this.isInitializing=!0,typeof n=="function"&&(l=n,n={}),n.defaultNS==null&&n.ns&&(De(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=zh();this.options={...o,...this.options,...Mh(n)},this.options.interpolation={...o.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const c=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?na.init(c(this.modules.logger),this.options):na.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=sk;const b=new Ah(this.options);this.store=new kh(this.options.resources,this.options);const y=this.services;y.logger=na,y.resourceStore=this.store,y.languageUtils=b,y.pluralResolver=new ek(b,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),h&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(y.formatter=c(h),y.formatter.init&&y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new tk(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new lk(c(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",(N,...S)=>{this.emit(N,...S)}),this.modules.languageDetector&&(y.languageDetector=c(this.modules.languageDetector),y.languageDetector.init&&y.languageDetector.init(y,this.options.detection,this.options)),this.modules.i18nFormat&&(y.i18nFormat=c(this.modules.i18nFormat),y.i18nFormat.init&&y.i18nFormat.init(this)),this.translator=new yo(this.services,this.options),this.translator.on("*",(N,...S)=>{this.emit(N,...S)}),this.modules.external.forEach(N=>{N.init&&N.init(this)})}if(this.format=this.options.interpolation.format,l||(l=so),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(h=>{this[h]=(...b)=>this.store[h](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=(...b)=>(this.store[h](...b),this)});const g=Al(),f=()=>{const h=(b,y)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(y),l(b,y)};if(this.languages&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?f():setTimeout(f,0),g}loadResources(n,l=so){var u,m;let o=l;const c=De(n)?n:this.language;if(typeof n=="function"&&(o=n),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],f=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(y=>{y!=="cimode"&&g.indexOf(y)<0&&g.push(y)})};c?f(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>f(b)),(m=(u=this.options.preload)==null?void 0:u.forEach)==null||m.call(u,h=>f(h)),this.services.backendConnector.load(g,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(h)})}else o(null)}reloadResources(n,l,o){const c=Al();return typeof n=="function"&&(o=n,n=void 0),typeof l=="function"&&(o=l,l=void 0),n||(n=this.languages),l||(l=this.options.ns),o||(o=so),this.services.backendConnector.reload(n,l,u=>{c.resolve(),o(u)}),c}use(n){if(!n)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!n.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return n.type==="backend"&&(this.modules.backend=n),(n.type==="logger"||n.log&&n.warn&&n.error)&&(this.modules.logger=n),n.type==="languageDetector"&&(this.modules.languageDetector=n),n.type==="i18nFormat"&&(this.modules.i18nFormat=n),n.type==="postProcessor"&&ix.addPostProcessor(n),n.type==="formatter"&&(this.modules.formatter=n),n.type==="3rdParty"&&this.modules.external.push(n),this}setResolvedLanguage(n){if(!(!n||!this.languages)&&!(["cimode","dev"].indexOf(n)>-1)){for(let l=0;l<this.languages.length;l++){const o=this.languages[l];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(n)<0&&this.store.hasLanguageSomeTranslations(n)&&(this.resolvedLanguage=n,this.languages.unshift(n))}}changeLanguage(n,l){this.isLanguageChangingTo=n;const o=Al();this.emit("languageChanging",n);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},u=(g,f)=>{f?this.isLanguageChangingTo===n&&(c(f),this.translator.changeLanguage(f),this.isLanguageChangingTo=void 0,this.emit("languageChanged",f),this.logger.log("languageChanged",f)):this.isLanguageChangingTo=void 0,o.resolve((...h)=>this.t(...h)),l&&l(g,(...h)=>this.t(...h))},m=g=>{var b,y;!n&&!g&&this.services.languageDetector&&(g=[]);const f=De(g)?g:g&&g[0],h=this.store.hasLanguageSomeTranslations(f)?f:this.services.languageUtils.getBestMatchFromCodes(De(g)?[g]:g);h&&(this.language||c(h),this.translator.language||this.translator.changeLanguage(h),(y=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||y.call(b,h)),this.loadResources(h,w=>{u(w,h)})};return!n&&this.services.languageDetector&&!this.services.languageDetector.async?m(this.services.languageDetector.detect()):!n&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(m):this.services.languageDetector.detect(m):m(n),o}getFixedT(n,l,o){const c=(u,m,...g)=>{let f;typeof m!="object"?f=this.options.overloadTranslationOptionHandler([u,m].concat(g)):f={...m},f.lng=f.lng||c.lng,f.lngs=f.lngs||c.lngs,f.ns=f.ns||c.ns,f.keyPrefix!==""&&(f.keyPrefix=f.keyPrefix||o||c.keyPrefix);const h=this.options.keySeparator||".";let b;return f.keyPrefix&&Array.isArray(u)?b=u.map(y=>(typeof y=="function"&&(y=xd(y,{...this.options,...m})),`${f.keyPrefix}${h}${y}`)):(typeof u=="function"&&(u=xd(u,{...this.options,...m})),b=f.keyPrefix?`${f.keyPrefix}${h}${u}`:u),this.t(b,f)};return De(n)?c.lng=n:c.lngs=n,c.ns=l,c.keyPrefix=o,c}t(...n){var l;return(l=this.translator)==null?void 0:l.translate(...n)}exists(...n){var l;return(l=this.translator)==null?void 0:l.exists(...n)}setDefaultNamespace(n){this.options.defaultNS=n}hasLoadedNamespace(n,l={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=l.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const m=(g,f)=>{const h=this.services.backendConnector.state[`${g}|${f}`];return h===-1||h===0||h===2};if(l.precheck){const g=l.precheck(this,m);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,n)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||m(o,n)&&(!c||m(u,n)))}loadNamespaces(n,l){const o=Al();return this.options.ns?(De(n)&&(n=[n]),n.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),l&&l(c)}),o):(l&&l(),Promise.resolve())}loadLanguages(n,l){const o=Al();De(n)&&(n=[n]);const c=this.options.preload||[],u=n.filter(m=>c.indexOf(m)<0&&this.services.languageUtils.isSupportedCode(m));return u.length?(this.options.preload=c.concat(u),this.loadResources(m=>{o.resolve(),l&&l(m)}),o):(l&&l(),Promise.resolve())}dir(n){var c,u;if(n||(n=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!n)return"rtl";try{const m=new Intl.Locale(n);if(m&&m.getTextInfo){const g=m.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const l=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=((u=this.services)==null?void 0:u.languageUtils)||new Ah(zh());return n.toLowerCase().indexOf("-latn")>1?"ltr":l.indexOf(o.getLanguagePartFromCode(n))>-1||n.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(n={},l){return new Ol(n,l)}cloneInstance(n={},l=so){const o=n.forkResourceStore;o&&delete n.forkResourceStore;const c={...this.options,...n,isClone:!0},u=new Ol(c);if((n.debug!==void 0||n.prefix!==void 0)&&(u.logger=u.logger.clone(n)),["store","services","language"].forEach(g=>{u[g]=this[g]}),u.services={...this.services},u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},o){const g=Object.keys(this.store.data).reduce((f,h)=>(f[h]={...this.store.data[h]},f[h]=Object.keys(f[h]).reduce((b,y)=>(b[y]={...f[h][y]},b),f[h]),f),{});u.store=new kh(g,c),u.services.resourceStore=u.store}return u.translator=new yo(u.services,c),u.translator.on("*",(g,...f)=>{u.emit(g,...f)}),u.init(c,l),u.translator.options=c,u.translator.backendConnector.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const er=Ol.createInstance();er.createInstance=Ol.createInstance;er.createInstance;er.dir;er.init;er.loadResources;er.reloadResources;er.use;er.changeLanguage;er.getFixedT;er.t;er.exists;er.setDefaultNamespace;er.hasLoadedNamespace;er.loadNamespaces;er.loadLanguages;const{slice:ok,forEach:ck}=[];function uk(a){return ck.call(ok.call(arguments,1),n=>{if(n)for(const l in n)a[l]===void 0&&(a[l]=n[l])}),a}function dk(a){return typeof a!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(l=>l.test(a))}const Ph=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,mk=function(a,n){const o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},c=encodeURIComponent(n);let u=`${a}=${c}`;if(o.maxAge>0){const m=o.maxAge-0;if(Number.isNaN(m))throw new Error("maxAge should be a Number");u+=`; Max-Age=${Math.floor(m)}`}if(o.domain){if(!Ph.test(o.domain))throw new TypeError("option domain is invalid");u+=`; Domain=${o.domain}`}if(o.path){if(!Ph.test(o.path))throw new TypeError("option path is invalid");u+=`; Path=${o.path}`}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");u+=`; Expires=${o.expires.toUTCString()}`}if(o.httpOnly&&(u+="; HttpOnly"),o.secure&&(u+="; Secure"),o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"strict":u+="; SameSite=Strict";break;case"none":u+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o.partitioned&&(u+="; Partitioned"),u},Dh={create(a,n,l,o){let c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};l&&(c.expires=new Date,c.expires.setTime(c.expires.getTime()+l*60*1e3)),o&&(c.domain=o),document.cookie=mk(a,n,c)},read(a){const n=`${a}=`,l=document.cookie.split(";");for(let o=0;o<l.length;o++){let c=l[o];for(;c.charAt(0)===" ";)c=c.substring(1,c.length);if(c.indexOf(n)===0)return c.substring(n.length,c.length)}return null},remove(a,n){this.create(a,"",-1,n)}};var pk={name:"cookie",lookup(a){let{lookupCookie:n}=a;if(n&&typeof document<"u")return Dh.read(n)||void 0},cacheUserLanguage(a,n){let{lookupCookie:l,cookieMinutes:o,cookieDomain:c,cookieOptions:u}=n;l&&typeof document<"u"&&Dh.create(l,a,o,c,u)}},gk={name:"querystring",lookup(a){var o;let{lookupQuerystring:n}=a,l;if(typeof window<"u"){let{search:c}=window.location;!window.location.search&&((o=window.location.hash)==null?void 0:o.indexOf("?"))>-1&&(c=window.location.hash.substring(window.location.hash.indexOf("?")));const m=c.substring(1).split("&");for(let g=0;g<m.length;g++){const f=m[g].indexOf("=");f>0&&m[g].substring(0,f)===n&&(l=m[g].substring(f+1))}}return l}},fk={name:"hash",lookup(a){var c;let{lookupHash:n,lookupFromHashIndex:l}=a,o;if(typeof window<"u"){const{hash:u}=window.location;if(u&&u.length>2){const m=u.substring(1);if(n){const g=m.split("&");for(let f=0;f<g.length;f++){const h=g[f].indexOf("=");h>0&&g[f].substring(0,h)===n&&(o=g[f].substring(h+1))}}if(o)return o;if(!o&&l>-1){const g=u.match(/\/([a-zA-Z-]*)/g);return Array.isArray(g)?(c=g[typeof l=="number"?l:0])==null?void 0:c.replace("/",""):void 0}}}return o}};let bn=null;const Lh=()=>{if(bn!==null)return bn;try{if(bn=typeof window<"u"&&window.localStorage!==null,!bn)return!1;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{bn=!1}return bn};var hk={name:"localStorage",lookup(a){let{lookupLocalStorage:n}=a;if(n&&Lh())return window.localStorage.getItem(n)||void 0},cacheUserLanguage(a,n){let{lookupLocalStorage:l}=n;l&&Lh()&&window.localStorage.setItem(l,a)}};let vn=null;const Uh=()=>{if(vn!==null)return vn;try{if(vn=typeof window<"u"&&window.sessionStorage!==null,!vn)return!1;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{vn=!1}return vn};var xk={name:"sessionStorage",lookup(a){let{lookupSessionStorage:n}=a;if(n&&Uh())return window.sessionStorage.getItem(n)||void 0},cacheUserLanguage(a,n){let{lookupSessionStorage:l}=n;l&&Uh()&&window.sessionStorage.setItem(l,a)}},yk={name:"navigator",lookup(a){const n=[];if(typeof navigator<"u"){const{languages:l,userLanguage:o,language:c}=navigator;if(l)for(let u=0;u<l.length;u++)n.push(l[u]);o&&n.push(o),c&&n.push(c)}return n.length>0?n:void 0}},bk={name:"htmlTag",lookup(a){let{htmlTag:n}=a,l;const o=n||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(l=o.getAttribute("lang")),l}},vk={name:"path",lookup(a){var c;let{lookupFromPathIndex:n}=a;if(typeof window>"u")return;const l=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(l)?(c=l[typeof n=="number"?n:0])==null?void 0:c.replace("/",""):void 0}},wk={name:"subdomain",lookup(a){var c,u;let{lookupFromSubdomainIndex:n}=a;const l=typeof n=="number"?n+1:1,o=typeof window<"u"&&((u=(c=window.location)==null?void 0:c.hostname)==null?void 0:u.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(o)return o[l]}};let cx=!1;try{document.cookie,cx=!0}catch{}const ux=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];cx||ux.splice(1,1);const jk=()=>({order:ux,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a});class dx{constructor(n){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(n,l)}init(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=uk(l,this.options||{},jk()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=c=>c.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(pk),this.addDetector(gk),this.addDetector(hk),this.addDetector(xk),this.addDetector(yk),this.addDetector(bk),this.addDetector(vk),this.addDetector(wk),this.addDetector(fk)}addDetector(n){return this.detectors[n.name]=n,this}detect(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,l=[];return n.forEach(o=>{if(this.detectors[o]){let c=this.detectors[o].lookup(this.options);c&&typeof c=="string"&&(c=[c]),c&&(l=l.concat(c))}}),l=l.filter(o=>o!=null&&!dk(o)).map(o=>this.options.convertDetectedLanguage(o)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?l:l.length>0?l[0]:null}cacheUserLanguage(n){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;l&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||l.forEach(o=>{this.detectors[o]&&this.detectors[o].cacheUserLanguage(n,this.options)}))}}dx.type="languageDetector";const Sk={title:"MCPHub Dashboard",error:"Error",closeButton:"Close",noServers:"No MCP servers available",loading:"Loading...",logout:"Logout",profile:"Profile",changePassword:"Change Password",toggleSidebar:"Toggle Sidebar",welcomeUser:"Welcome, {{username}}",name:"MCPHub",embeddingSyncProgress:"Embeddings for {{serverName}}",embeddingSyncProgressAriaLabel:"Creating embeddings for {{serverName}}: {{current}} of {{total}} completed"},Nk={title:"About",versionInfo:"MCPHub Version: {{version}}",newVersion:"New version available!",currentVersion:"Current version",newVersionAvailable:"New version {{version}} is available",viewOnGitHub:"View on GitHub",checkForUpdates:"Check for Updates",checking:"Checking for updates..."},kk={viewProfile:"View profile",userCenter:"User Center"},Ck={label:"Sponsor",title:"Support the Project",rewardAlt:"Reward QR Code",supportMessage:"Support the development of MCPHub by buying me a coffee!",supportButton:"Support on Ko-fi"},Ak={label:"WeChat",title:"Connect via WeChat",qrCodeAlt:"WeChat QR Code",scanMessage:"Scan this QR code to connect with us on WeChat"},Ek={label:"Discord",title:"Join our Discord server",community:"Join our growing community on Discord for support, discussions, and updates!"},Rk={title:"Theme",light:"Light",dark:"Dark",system:"System"},Tk={login:"Login",loginTitle:"Login to MCPHub",slogan:"The Unified Hub for MCP Servers",subtitle:"Centralized management platform for Model Context Protocol servers. Organize, monitor, and scale multiple MCP servers with flexible routing strategies.",username:"Username",password:"Password",loggingIn:"Logging in...",orContinue:"Or continue with",loginWithGoogle:"Continue with Google",loginWithGithub:"Continue with GitHub",socialLoginFailed:"Social login failed. Please try again.",emptyFields:"Username and password cannot be empty",loginFailed:"Login failed, please check your username and password",loginError:"An error occurred during login",serverUnavailable:"Unable to connect to the server. Please check your network connection or try again later",currentPassword:"Current Password",newPassword:"New Password",confirmPassword:"Confirm Password",passwordsNotMatch:"New password and confirmation do not match",changePasswordSuccess:"Password changed successfully",changePasswordError:"Failed to change password",changePassword:"Change Password",passwordChanged:"Password changed successfully",passwordChangeError:"Failed to change password",defaultPasswordWarning:"Default Password Security Warning",defaultPasswordMessage:"You are using the default password (admin123), which poses a security risk. Please change your password immediately to protect your account.",goToSettings:"Go to Settings",passwordStrengthError:"Password does not meet security requirements",passwordMinLength:"Password must be at least 8 characters long",passwordRequireLetter:"Password must contain at least one letter",passwordRequireNumber:"Password must contain at least one number",passwordRequireSpecial:"Password must contain at least one special character",passwordStrengthHint:"Password must be at least 8 characters and contain letters, numbers, and special characters"},Ok={addServer:"Add Server",add:"Add",edit:"Edit",copy:"Copy",delete:"Delete",confirmDelete:"Are you sure you want to delete this server?",deleteWarning:"Deleting server '{{name}}' will remove it and all its data. This action cannot be undone.",status:"Status",tools:"Tools",prompts:"Prompts",name:"Server Name",description:"Server Note",descriptionPlaceholder:"Optional note to describe this server",url:"Server URL",apiKey:"API Key",save:"Save",cancel:"Cancel",invalidConfig:"Could not find configuration data for {{serverName}}",addError:"Failed to add server",editError:"Failed to edit server {{serverName}}",deleteError:"Failed to delete server {{serverName}}",updateError:"Failed to update server",editTitle:"Edit Server: {{serverName}}",type:"Server Type",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"Streamable HTTP",typeOpenapi:"OpenAPI",command:"Command",arguments:"Arguments",envVars:"Environment Variables",headers:"HTTP Headers",key:"key",value:"value",enabled:"Enabled",enable:"Enable",disable:"Disable",reload:"Reload",reloadSuccess:"Server reloaded successfully",reloadError:"Failed to reload server {{serverName}}",requestOptions:"Connection Configuration",timeout:"Request Timeout",timeoutDescription:"Timeout for requests to the MCP server (ms)",maxTotalTimeout:"Maximum Total Timeout",maxTotalTimeoutDescription:"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",resetTimeoutOnProgress:"Reset Timeout on Progress",resetTimeoutOnProgressDescription:"Reset timeout on progress notifications (enabled by default)",keepAlive:"Keep-Alive Configuration",enableKeepAlive:"Enable Keep-Alive",keepAliveDescription:"Send periodic ping requests to maintain the connection. Useful for long-running connections that may timeout.",keepAliveInterval:"Interval (ms)",keepAliveIntervalDescription:"Time between keep-alive pings in milliseconds (default: 60000ms = 1 minute)",remove:"Remove",toggleError:"Failed to toggle server {{serverName}}",alreadyExists:"Server {{serverName}} already exists",invalidData:"Invalid server data provided",notFound:"Server {{serverName}} not found",namePlaceholder:"Enter server name",urlPlaceholder:"Enter server URL",commandPlaceholder:"Enter command",argumentsPlaceholder:"Enter arguments",errorDetails:"Error Details",viewErrorDetails:"View error details",copyConfig:"Copy Configuration",confirmVariables:"Confirm Variable Configuration",variablesDetected:"Variables detected in configuration. Please confirm these variables are properly configured:",detectedVariables:"Detected Variables",confirmVariablesMessage:"Please ensure these variables are properly defined in your runtime environment. Continue adding server?",confirmAndAdd:"Confirm and Add",openapi:{inputMode:"Input Mode",inputModeUrl:"Specification URL",inputModeSchema:"JSON Schema",specUrl:"OpenAPI Specification URL",schema:"OpenAPI JSON Schema",schemaHelp:"Paste your complete OpenAPI JSON schema here",security:"Security Type",securityNone:"None",securityApiKey:"API Key",securityHttp:"HTTP Authentication",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API Key Configuration",apiKeyName:"Header/Parameter Name",apiKeyIn:"Location",apiKeyValue:"API Key Value",httpAuthConfig:"HTTP Authentication Configuration",httpScheme:"Authentication Scheme",httpCredentials:"Credentials",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 Configuration",oauth2Token:"Access Token",openIdConnectConfig:"OpenID Connect Configuration",openIdConnectUrl:"Discovery URL",openIdConnectToken:"ID Token",apiKeyInHeader:"Header",apiKeyInQuery:"Query",apiKeyInCookie:"Cookie",passthroughHeaders:"Passthrough Headers",passthroughHeadersHelp:"Comma-separated list of header names to pass through from incoming MCP requests to upstream server requests (e.g., Authorization, X-API-Key)"},oauth:{sectionTitle:"OAuth Configuration",sectionDescription:"Configure client credentials for OAuth-protected servers (optional).",clientId:"Client ID",clientSecret:"Client Secret",authorizationEndpoint:"Authorization Endpoint",tokenEndpoint:"Token Endpoint",scopes:"Scopes",scopesPlaceholder:"scope1 scope2",resource:"Resource / Audience",accessToken:"Access Token",refreshToken:"Refresh Token"}},zk={online:"Online",offline:"Offline",connecting:"Connecting",oauthRequired:"OAuth Required",clickToAuthorize:"Click to authorize with OAuth",oauthWindowOpened:"OAuth authorization window opened. Please complete the authorization."},Mk={general:"Something went wrong",network:"Network connection error. Please check your internet connection",serverConnection:"Unable to connect to the server. Please check if the server is running",serverAdd:"Failed to add server. Please check the server status",serverUpdate:"Failed to edit server {{serverName}}. Please check the server status",serverFetch:"Failed to retrieve server data. Please try again later",initialStartup:"The server might be starting up. Please wait a moment as this process can take some time on first launch...",serverInstall:"Failed to install server",failedToFetchSettings:"Failed to fetch settings",failedToUpdateRouteConfig:"Failed to update route configuration",failedToUpdateSmartRoutingConfig:"Failed to update smart routing configuration"},Pk={processing:"Processing...",save:"Save",cancel:"Cancel",back:"Back",refresh:"Refresh",search:"Search",clear:"Clear",view:"View",create:"Create",creating:"Creating...",update:"Update",updating:"Updating...",submitting:"Submitting...",delete:"Delete",remove:"Remove",copy:"Copy",copyId:"Copy ID",copyUrl:"Copy URL",copyJson:"Copy JSON",copySuccess:"Copied to clipboard",copyFailed:"Copy failed",copied:"Copied",close:"Close",confirm:"Confirm",language:"Language",true:"True",false:"False",dismiss:"Dismiss",github:"GitHub",wechat:"WeChat",discord:"Discord",required:"Required",itemsPerPage:"Items per page",showing:"Showing {{start}}-{{end}} of {{total}}",previous:"Previous",next:"Next",secret:"Secret",default:"Default",value:"Value",type:"Type",repeated:"Repeated",valueHint:"Value Hint",choices:"Choices",actions:"Actions",saving:"Saving...",active:"Active",inactive:"Inactive"},Dk={rowsPerPage:"Rows per page",showing:"Showing {{from}}-{{to}} of {{total}}"},Lk={dashboard:"Dashboard",servers:"Servers",groups:"Groups",prompts:"Prompts",resources:"Resources",users:"Users",settings:"Settings",changePassword:"Change Password",market:"Market",cloud:"Cloud Market",logs:"Logs",activity:"Activity"},Uk={dashboard:{title:"Dashboard",totalServers:"Total",onlineServers:"Online",disabledServers:"Disabled",offlineServers:"Offline",connectingServers:"Connecting",recentServers:"Recent Servers"},servers:{title:"Server Management"},groups:{title:"Group Management"},prompts:{title:"Built-in Prompts"},resources:{title:"Built-in Resources"},users:{title:"User Management"},settings:{title:"Settings",language:"Language",account:"Account Settings",password:"Change Password",appearance:"Appearance",routeConfig:"Security",installConfig:"Installation",smartRouting:"Smart Routing",oauthServer:"OAuth Server"},market:{title:"Market Hub - Local and Cloud Markets"},logs:{title:"System Logs"}},_k={filters:"Filters",search:"Search logs...",autoScroll:"Auto-scroll",clearLogs:"Clear logs",loading:"Loading logs...",noLogs:"No logs available.",noMatch:"No logs match the current filters.",mainProcess:"Main Process",childProcess:"Child Process",main:"Main",child:"Child"},Bk={add:"Add",addNew:"Add New Group",edit:"Edit Group",delete:"Delete",confirmDelete:"Are you sure you want to delete this group?",deleteWarning:"Deleting group '{{name}}' will remove it and all its server associations. This action cannot be undone.",name:"Group Name",namePlaceholder:"Enter group name",nameRequired:"Group name is required",description:"Description",descriptionPlaceholder:"Enter group description (optional)",createError:"Failed to create group",updateError:"Failed to update group",deleteError:"Failed to delete group",serverAddError:"Failed to add server to group",serverRemoveError:"Failed to remove server from group",addServer:"Add Server to Group",selectServer:"Select a server to add",servers:"Servers in Group",remove:"Remove",noGroups:"No groups available. Create a new group to get started.",noServers:"No servers in this group.",noServerOptions:"No servers available",serverCount:"{{count}} Servers",toolSelection:"Tool Selection",promptSelection:"Prompt Selection",resourceSelection:"Resource Selection",toolsSelected:"Selected",promptsSelected:"Selected",resourcesSelected:"Selected",allTools:"All",allPrompts:"All prompts",allResources:"All resources",selectedTools:"Selected tools",selectedPrompts:"Selected prompts",selectedResources:"Selected resources",selectAll:"Select All",selectNone:"Select None",configureTools:"Configure Tools",configureCapabilities:"Configure Tools, Prompts, and Resources",previewPrompts:"[prompts: {{items}}]",previewResources:"[resources: {{items}}]",previewAllTools:"(all tools)",previewAllPrompts:"(all prompts)",previewAllResources:"(all resources)"},Ik={title:"Local Installation",official:"Official",by:"By",unknown:"Unknown",tools:"tools",search:"Search",searchPlaceholder:"Search for servers by name, category, or tags",clearFilters:"Clear",clearCategoryFilter:"",clearTagFilter:"",categories:"Categories",tags:"Tags",showTags:"Show tags",hideTags:"Hide tags",moreTags:"",noServers:"No servers found matching your search",backToList:"Back to list",install:"Install",installing:"Installing...",installed:"Installed",installServer:"Install Server: {{name}}",installSuccess:"Server {{serverName}} installed successfully",author:"Author",license:"License",repository:"Repository",examples:"Examples",arguments:"Arguments",argumentName:"Name",description:"Description",required:"Required",example:"Example",viewSchema:"View schema",fetchError:"Error fetching market servers",serverNotFound:"Server not found",searchError:"Error searching servers",filterError:"Error filtering servers by category",tagFilterError:"Error filtering servers by tag",noInstallationMethod:"No installation method available for this server",showing:"Showing {{from}}-{{to}} of {{total}} servers",perPage:"Per page",confirmVariablesMessage:"Please ensure these variables are properly defined in your runtime environment. Continue installing server?",confirmAndInstall:"Confirm and Install"},Fk={authorizeTitle:"Authorize Application",authorizeSubtitle:"Allow this application to access your MCPHub account.",buttons:{approve:"Allow access",deny:"Deny",approveSubtitle:"Recommended if you trust this application.",denySubtitle:"You can always grant access later."}},Hk={title:"Cloud Support",subtitle:"Powered by MCPRouter",by:"By",server:"Server",config:"Config",created:"Created",updated:"Updated",available:"Available",description:"Description",details:"Details",tools:"Tools",tool:"tool",toolsAvailable:"{{count}} tool available||{{count}} tools available",loadingTools:"Loading tools...",noTools:"No tools available for this server",noDescription:"No description available",viewDetails:"View Details",parameters:"Parameters",result:"Result",error:"Error",callTool:"Call",calling:"Calling...",toolCallSuccess:"Tool {{toolName}} executed successfully",toolCallError:"Failed to call tool {{toolName}}: {{error}}",viewSchema:"View Schema",backToList:"Back to Cloud Market",search:"Search",searchPlaceholder:"Search cloud servers by name, title, or author",clearFilters:"Clear Filters",clearCategoryFilter:"Clear",clearTagFilter:"Clear",categories:"Categories",tags:"Tags",noCategories:"No categories found",noTags:"No tags found",noServers:"No cloud servers found",fetchError:"Error fetching cloud servers",serverNotFound:"Cloud server not found",searchError:"Error searching cloud servers",filterError:"Error filtering cloud servers by category",tagFilterError:"Error filtering cloud servers by tag",showing:"Showing {{from}}-{{to}} of {{total}} cloud servers",perPage:"Per page",apiKeyNotConfigured:"MCPRouter API key not configured",apiKeyNotConfiguredDescription:"To use cloud servers, you need to configure your MCPRouter API key.",getApiKey:"Get API Key",configureInSettings:"Configure in Settings",installServer:"Install {{name}}",installSuccess:"Server {{name}} installed successfully",installError:"Failed to install server: {{error}}"},qk={title:"Registry",official:"Official",latest:"Latest",description:"Description",website:"Website",repository:"Repository",packages:"Packages",package:"package",remotes:"Remotes",remote:"remote",published:"Published",updated:"Updated",install:"Install",installing:"Installing...",installed:"Installed",installServer:"Install {{name}}",installSuccess:"Server {{name}} installed successfully",installError:"Failed to install server: {{error}}",noDescription:"No description available",viewDetails:"View Details",backToList:"Back to Registry",search:"Search",searchPlaceholder:"Search registry servers by name",clearFilters:"Clear",noServers:"No registry servers found",fetchError:"Error fetching registry servers",serverNotFound:"Registry server not found",showing:"Showing {{from}}-{{to}} of {{total}} registry servers",perPage:"Per page",environmentVariables:"Environment Variables",packageArguments:"Package Arguments",runtimeArguments:"Runtime Arguments",headers:"Headers"},Gk={run:"Run",running:"Running...",runTool:"Run Tool",cancel:"Cancel",noDescription:"No description available",inputSchema:"Input Schema:",runToolWithName:"Run Tool: {{name}}",execution:"Tool Execution",successful:"Successful",failed:"Failed",result:"Result:",error:"Error",errorDetails:"Error Details:",noContent:"Tool executed successfully but returned no content.",unknownError:"Unknown error occurred",jsonResponse:"JSON Response:",toolResult:"Tool result",noParameters:"This tool does not require any parameters.",selectOption:"Select an option",enterValue:"Enter {{type}} value",enabled:"Enabled",enableSuccess:"Tool {{name}} enabled successfully",disableSuccess:"Tool {{name}} disabled successfully",toggleFailed:"Failed to toggle tool status",descriptionUpdateSuccess:"Tool description updated successfully",descriptionUpdateFailed:"Failed to update tool description",restoreDefault:"Restore default",restoreDefaultSuccess:"Tool description restored to default",restoreDefaultFailed:"Failed to restore the default tool description",parameters:"Tool Parameters",formMode:"Form Mode",jsonMode:"JSON Mode",jsonConfiguration:"JSON Configuration",invalidJsonFormat:"Invalid JSON format",fixJsonBeforeSwitching:"Please fix JSON format before switching to form mode",item:"Item {{index}}",addItem:"Add {{key}} item",enterKey:"Enter {{key}}"},Kk={run:"Get",running:"Getting...",result:"Prompt Result",error:"Prompt Error",execution:"Prompt Execution",successful:"Successful",failed:"Failed",errorDetails:"Error Details:",noContent:"Prompt executed successfully but returned no content.",unknownError:"Unknown error occurred",jsonResponse:"JSON Response:",description:"Description",messages:"Messages",noDescription:"No description available",runPromptWithName:"Get Prompt: {{name}}",descriptionUpdateSuccess:"Prompt description updated successfully",descriptionUpdateFailed:"Failed to update prompt description",restoreDefault:"Restore default",restoreDefaultSuccess:"Prompt description restored to default",restoreDefaultFailed:"Failed to restore the default prompt description"},Vk={enableGlobalRoute:"Enable Global Route",enableGlobalRouteDescription:"Allow connections to /sse endpoint without specifying a group ID",enableGroupNameRoute:"Enable Group Name Route",enableGroupNameRouteDescription:"Allow connections to /sse endpoint using group names instead of just group IDs",enableBearerAuth:"Enable Bearer Authentication",enableBearerAuthDescription:"Require bearer token authentication for MCP endpoints (default on)",bearerAuthKey:"Bearer Authentication Key",bearerAuthKeyDescription:"The authentication key that will be required in the Bearer token",bearerAuthKeyPlaceholder:"Enter bearer authentication key",bearerAuthHeaderName:"Bearer Auth Header Name",bearerAuthHeaderNameDescription:"Header name used to receive MCP bearer credentials. Change this when upstream passthrough headers also use Authorization.",bearerAuthHeaderNamePlaceholder:"e.g. Authorization or X-MCP-Authorization",bearerKeysSectionTitle:"Keys",bearerKeysSectionDescription:"Manage multiple keys with different access scopes.",noBearerKeys:"No keys configured yet.",bearerKeyName:"Name",bearerKeyToken:"Token",bearerKeyEnabled:"Enabled",bearerKeyAccessType:"Access scope",bearerKeyAccessAll:"All",bearerKeyAccessGroups:"Groups",bearerKeyAccessServers:"Servers",bearerKeyAccessCustom:"Custom",bearerKeyAllowedGroups:"Allowed groups",bearerKeyAllowedServers:"Allowed servers",addBearerKey:"Add key",addBearerKeyButton:"Create",bearerKeyRequired:"Name and token are required",deleteBearerKeyConfirm:"Are you sure you want to delete this key?",generate:"Generate",selectGroups:"Select Groups",selectServers:"Select Servers",selectAtLeastOneGroup:"Please select at least one group",selectAtLeastOneServer:"Please select at least one server",skipAuth:"Skip Authentication",skipAuthDescription:"Allow dashboard access without login; unauthenticated users get guest admin access (does not affect MCP endpoint auth)",jsonBodyLimit:"JSON Body Size Limit",jsonBodyLimitDescription:"Express JSON request size limit. This affects large OpenAPI schema uploads as well.",jsonBodyLimitPlaceholder:"e.g. 1mb, 5mb, 1024kb",pythonIndexUrl:"Python Package Repository URL",pythonIndexUrlDescription:"Set UV_DEFAULT_INDEX environment variable for Python package installation",pythonIndexUrlPlaceholder:"e.g. https://pypi.org/simple",npmRegistry:"NPM Registry URL",npmRegistryDescription:"Set npm_config_registry environment variable for NPM package installation",npmRegistryPlaceholder:"e.g. https://registry.npmjs.org/",baseUrl:"Base URL",baseUrlDescription:"Base URL for MCP requests and OAuth callbacks",baseUrlPlaceholder:"e.g. http://localhost:3000",installConfig:"Installation",systemConfigUpdated:"System configuration updated successfully",enableSmartRouting:"Enable Smart Routing",enableSmartRoutingDescription:"Enable smart routing feature to search the most suitable tool based on input (using $smart group name)",dbUrl:"PostgreSQL URL (requires pgvector support)",dbUrlPlaceholder:"e.g. postgresql://user:password@localhost:5432/dbname",embeddingProvider:"Embedding Provider",openaiApiBaseUrl:"OpenAI-compatible Base URL",openaiApiBaseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKey:"LLM Provider API Key",openaiApiKeyPlaceholder:"Enter LLM provider API key",openaiApiEmbeddingModel:"Embedding Model Name",openaiApiEmbeddingModelPlaceholder:"text-embedding-3-small",basePacingDelayMs:"Base Pacing Delay (ms)",basePacingDelayMsDescription:"Baseline delay between embedding API requests. Defaults to 0 — the system manages rate limits automatically: it respects Retry-After headers, falls back to a 63-second cooldown, and increases the pacing delay after any 403/429 response. Set a non-zero value only if your provider enforces a fixed minimum interval between requests.",basePacingDelayMsPlaceholder:"Empty = default 0 ms",basePacingDelayMsAuto:"Default ({{value}} ms): rate limiting is managed automatically.",basePacingDelayMsZero:"0 ms (default): rate limiting is managed automatically via adaptive throttling and retry logic.",basePacingDelayMsOverride:"Custom value: overrides the default baseline pacing delay.",embeddingEncodingFormat:"Embedding Encoding Format",embeddingEncodingFormatDescription:"Encoding format for embedding vectors. Auto will detect based on provider support.",embeddingEncodingFormatAuto:"Auto (Recommended)",azureOpenaiEndpoint:"Azure OpenAI Endpoint",azureOpenaiEndpointPlaceholder:"https://YOUR_RESOURCE_NAME.openai.azure.com",azureOpenaiApiKey:"Azure OpenAI API Key",azureOpenaiApiKeyPlaceholder:"Enter Azure OpenAI API key",azureOpenaiApiVersion:"Azure OpenAI API Version",azureOpenaiApiVersionPlaceholder:"2024-02-15-preview",azureOpenaiEmbeddingDeployment:"Azure OpenAI Embedding Deployment",azureOpenaiEmbeddingDeploymentPlaceholder:"text-embedding-3-small",azureOpenaiEmbeddingModel:"Azure Embedding Model Name",azureOpenaiEmbeddingModelDescription:"The actual OpenAI model name deployed in Azure (e.g. text-embedding-3-small). Used for accurate token counting before sending text to the API.",azureOpenaiEmbeddingModelPlaceholder:"text-embedding-3-small",progressiveDisclosure:"Progressive Disclosure",progressiveDisclosureDescription:"When enabled, search_tools returns only tool names and descriptions. Use describe_tool to get full parameter schema, reducing token usage.",embeddingMaxTokens:"Max Embedding Tokens",embeddingMaxTokensDescription:"Maximum tokens for text truncation before generating embeddings. Leave empty to use the model default automatically. A custom value always overrides the model default. Manually setting this value is especially useful when using local LLM providers to prevent truncation errors.",embeddingMaxTokensPlaceholder:"Empty = auto by model",embeddingMaxTokensAuto:"Auto: {{limit}} tokens (model default for {{model}})",embeddingMaxTokensOverride:"This value overrides the model default.",smartRoutingConfigUpdated:"Smart routing configuration updated successfully",smartRoutingRequiredFields:"Database URL is required to enable smart routing. An LLM Provider API Key is required for cloud-based providers (local LLMs usually don't require an API key, enter any value to pass the form validation)",smartRoutingValidationError:"Please fill in the required fields before enabling Smart Routing: {{fields}}",mcpRouterConfig:"Cloud Market",mcpRouterApiKey:"MCPRouter API Key",mcpRouterApiKeyDescription:"API key for accessing MCPRouter cloud market services",mcpRouterApiKeyPlaceholder:"Enter MCPRouter API key",mcpRouterReferer:"Referer",mcpRouterRefererDescription:"Referer header for MCPRouter API requests",mcpRouterRefererPlaceholder:"https://www.mcphub.app",mcpRouterTitle:"Title",mcpRouterTitleDescription:"Title header for MCPRouter API requests",mcpRouterTitlePlaceholder:"MCPHub",mcpRouterBaseUrl:"Base URL",mcpRouterBaseUrlDescription:"Base URL for MCPRouter API",mcpRouterBaseUrlPlaceholder:"https://api.mcprouter.to/v1",systemSettings:"System Settings",nameSeparatorLabel:"Name Separator",nameSeparatorDescription:"Character used to separate server name and tool/prompt name (default: -)",enableSessionRebuild:"Enable Server Session Rebuild",enableSessionRebuildDescription:"When enabled, applies the improved server session rebuild code for better session management experience",restartRequired:"Configuration saved. It is recommended to restart the application to ensure all services load the new settings correctly.",exportMcpSettings:"Export Settings",mcpSettingsJson:"MCP Settings JSON",mcpSettingsJsonDescription:"View, copy, or download your current mcp_settings.json configuration for backup or migration to other tools",copyToClipboard:"Copy to Clipboard",downloadJson:"Download JSON",exportSuccess:"Settings exported successfully",exportError:"Failed to fetch settings",enableOauthServer:"Enable OAuth Server",enableOauthServerDescription:"Allow MCPHub to issue OAuth tokens for external clients",requireClientSecret:"Require Client Secret",requireClientSecretDescription:"When enabled, confidential clients must present a client secret (disable for PKCE-only clients)",requireState:"Require State Parameter",requireStateDescription:"Reject authorization requests that omit the OAuth state parameter",accessTokenLifetime:"Access Token Lifetime (seconds)",accessTokenLifetimeDescription:"How long issued access tokens remain valid",accessTokenLifetimePlaceholder:"e.g. 3600",refreshTokenLifetime:"Refresh Token Lifetime (seconds)",refreshTokenLifetimeDescription:"How long refresh tokens remain valid",refreshTokenLifetimePlaceholder:"e.g. 1209600",authorizationCodeLifetime:"Authorization Code Lifetime (seconds)",authorizationCodeLifetimeDescription:"How long authorization codes remain valid before they can be exchanged",authorizationCodeLifetimePlaceholder:"e.g. 300",allowedScopes:"Allowed Scopes",allowedScopesDescription:"Comma-separated list of scopes users can approve during authorization",allowedScopesPlaceholder:"e.g. read, write",enableDynamicRegistration:"Enable Dynamic Client Registration",dynamicRegistrationDescription:"Allow RFC 7591 compliant clients to self-register using the public endpoint",dynamicRegistrationAllowedGrantTypes:"Allowed Grant Types",dynamicRegistrationAllowedGrantTypesDescription:"Comma-separated list of grants permitted for dynamically registered clients",dynamicRegistrationAllowedGrantTypesPlaceholder:"e.g. authorization_code, refresh_token",dynamicRegistrationAuth:"Require Authentication",dynamicRegistrationAuthDescription:"Protect the registration endpoint so only authenticated requests can register clients",invalidNumberInput:"Please enter a valid non-negative number"},$k={upload:"Upload",uploadTitle:"Upload MCPB Bundle",dropFileHere:"Drop your .mcpb file here",orClickToSelect:"or click to select from your computer",invalidFileType:"Please select a valid .mcpb file",noFileSelected:"Please select a .mcpb file to upload",uploading:"Uploading...",uploadFailed:"Failed to upload MCPB file",installServer:"Install MCP Server from MCPB",extensionInfo:"Extension Information",name:"Name",version:"Version",description:"Description",author:"Author",tools:"Tools",serverName:"Server Name",serverNamePlaceholder:"Enter a name for this server",install:"Install",installing:"Installing...",installFailed:"Failed to install server from MCPB",serverExistsTitle:"Server Already Exists",serverExistsConfirm:"Server '{{serverName}}' already exists. Do you want to override it with the new version?",override:"Override"},Yk={button:"Import",title:"Import Servers from JSON",inputLabel:"Server Configuration JSON",inputHelp:"Paste your server configuration JSON. Supports STDIO, SSE, and HTTP (streamable-http) server types.",preview:"Preview",previewTitle:"Preview Servers to Import",import:"Import",importing:"Importing...",invalidFormat:"Invalid JSON format. The JSON must contain an 'mcpServers' object.",parseError:"Failed to parse JSON. Please check the format and try again.",addFailed:"Failed to add server",importFailed:"Failed to import servers",partialSuccess:"Imported {{count}} of {{total}} servers successfully. Some servers failed:"},Jk={button:"Import",title:"Import Groups from JSON",inputLabel:"Group Configuration JSON",inputHelp:"Paste your group configuration JSON. Each group can contain a list of servers.",preview:"Preview",previewTitle:"Preview Groups to Import",import:"Import",importing:"Importing...",invalidFormat:"Invalid JSON format. The JSON must contain a 'groups' array.",missingName:"Each group must have a 'name' field.",parseError:"Failed to parse JSON. Please check the format and try again.",addFailed:"Failed to add group",importFailed:"Failed to import groups",partialSuccess:"Imported {{count}} of {{total}} groups successfully. Some groups failed:"},Qk={add:"Add User",addNew:"Add New User",edit:"Edit User",delete:"Delete User",create:"Create User",update:"Update User",username:"Username",password:"Password",newPassword:"New Password",confirmPassword:"Confirm Password",changePassword:"Change Password",adminRole:"Administrator",admin:"Admin",user:"User",role:"Role",actions:"Actions",addFirst:"Add your first user",permissions:"Permissions",adminPermissions:"Full system access",userPermissions:"Limited access",currentUser:"You",noUsers:"No users found",adminRequired:"Administrator access required to manage users",usernameRequired:"Username is required",passwordRequired:"Password is required",passwordTooShort:"Password must be at least 6 characters long",passwordMismatch:"Passwords do not match",usernamePlaceholder:"Enter username",passwordPlaceholder:"Enter password",newPasswordPlaceholder:"Leave empty to keep current password",confirmPasswordPlaceholder:"Confirm new password",createError:"Failed to create user",updateError:"Failed to update user",deleteError:"Failed to delete user",statsError:"Failed to fetch user statistics",deleteConfirmation:"Are you sure you want to delete user '{{username}}'? This action cannot be undone.",confirmDelete:"Delete User",deleteWarning:"Are you sure you want to delete user '{{username}}'? This action cannot be undone."},Xk={errors:{readonly:"Readonly for demo environment",invalid_credentials:"Invalid username or password",serverNameRequired:"Server name is required",serverConfigRequired:"Server configuration is required",serverConfigInvalid:"Server configuration must include either a URL, OpenAPI specification URL or schema, or command with arguments",serverTypeInvalid:"Server type must be one of: stdio, sse, streamable-http, openapi",urlRequiredForType:"URL is required for {{type}} server type",openapiSpecRequired:"OpenAPI specification URL or schema is required for openapi server type",headersInvalidFormat:"Headers must be an object",headersNotSupportedForStdio:"Headers are not supported for stdio server type",serverNotFound:"Server not found",failedToRemoveServer:"Server not found or failed to remove",internalServerError:"Internal server error",failedToGetServers:"Failed to get servers information",failedToReloadServer:"Failed to reload server",failedToGetServerSettings:"Failed to get server settings",failedToGetServerConfig:"Failed to get server configuration",failedToSaveSettings:"Failed to save settings",toolNameRequired:"Server name and tool name are required",descriptionMustBeString:"Description must be a string",groupIdRequired:"Group ID is required",groupNameRequired:"Group name is required",groupNotFound:"Group not found",groupIdAndServerNameRequired:"Group ID and server name are required",groupOrServerNotFound:"Group or server not found",toolsMustBeAllOrArray:'Tools must be "all" or an array of strings',serverNameAndToolNameRequired:"Server name and tool name are required",usernameRequired:"Username is required",userNotFound:"User not found",failedToGetUsers:"Failed to get users information",failedToGetUserInfo:"Failed to get user information",failedToGetUserStats:"Failed to get user statistics",marketServerNameRequired:"Server name is required",marketServerNotFound:"Market server not found",failedToGetMarketServers:"Failed to get market servers information",failedToGetMarketServer:"Failed to get market server information",failedToGetMarketCategories:"Failed to get market categories",failedToGetMarketTags:"Failed to get market tags",failedToSearchMarketServers:"Failed to search market servers",failedToFilterMarketServers:"Failed to filter market servers",failedToProcessMcpbFile:"Failed to process MCPB file"},success:{serverCreated:"Server created successfully",serverUpdated:"Server updated successfully",serverRemoved:"Server removed successfully",serverToggled:"Server status toggled successfully",toolToggled:"Tool {{name}} {{action}} successfully",toolDescriptionUpdated:"Tool {{name}} description updated successfully",systemConfigUpdated:"System configuration updated successfully",groupCreated:"Group created successfully",groupUpdated:"Group updated successfully",groupDeleted:"Group deleted successfully",serverAddedToGroup:"Server added to group successfully",serverRemovedFromGroup:"Server removed from group successfully",serverToolsUpdated:"Server tools updated successfully"}},Zk={authorizationFailed:"Authorization Failed",authorizationFailedError:"Error",authorizationFailedDetails:"Details",invalidRequest:"Invalid Request",missingStateParameter:"Missing required OAuth state parameter.",missingCodeParameter:"Missing required authorization code parameter.",serverNotFound:"Server Not Found",serverNotFoundMessage:"Could not find server associated with this authorization request.",sessionExpiredMessage:"The authorization session may have expired. Please try authorizing again.",authorizationSuccessful:"Authorization Successful",server:"Server",status:"Status",connected:"Connected",successMessage:"The server has been successfully authorized and connected.",autoCloseMessage:"This window will close automatically in 3 seconds...",closeNow:"Close Now",connectionError:"Connection Error",connectionErrorMessage:"Authorization was successful, but failed to connect to the server.",reconnectMessage:"Please try reconnecting from the dashboard.",configurationError:"Configuration Error",configurationErrorMessage:"Server transport does not support OAuth finishAuth(). Please ensure the server is configured with streamable-http transport.",internalError:"Internal Error",internalErrorMessage:"An unexpected error occurred while processing the OAuth callback.",closeWindow:"Close Window"},Wk={add:"Add Prompt",addNew:"Add New Prompt",edit:"Edit Prompt",delete:"Delete",noPrompts:"No built-in prompts configured",addFirst:"Add your first prompt",name:"Name",namePlaceholder:"e.g. code-review",title:"Title",titlePlaceholder:"e.g. Code Review Prompt",description:"Description",descriptionPlaceholder:"Brief description of the prompt",template:"Template",templatePlaceholder:"Enter template text with {{parameter}} placeholders...",templateHint:"Use {{paramName}} for template parameters",arguments:"Arguments",addArgument:"Add Argument",argName:"Name",argDescription:"Description",argRequired:"Required",enabled:"Enabled",active:"Active",inactive:"Inactive",nameRequired:"Name is required",templateRequired:"Template is required",fetchError:"Failed to load built-in prompts",createError:"Failed to create prompt",updateError:"Failed to update prompt",deleteError:"Failed to delete prompt",saveError:"Failed to save prompt",confirmDelete:"Delete Prompt",deleteWarning:'Are you sure you want to delete the prompt "{{name}}"? This action cannot be undone.'},e4={add:"Add Resource",addNew:"Add New Resource",edit:"Edit Resource",delete:"Delete",noResources:"No built-in resources configured",addFirst:"Add your first resource",uri:"URI",uriPlaceholder:"e.g. resource://docs/guide",name:"Name",namePlaceholder:"e.g. User Guide",description:"Description",descriptionPlaceholder:"Brief description of the resource",mimeType:"MIME Type",content:"Content",contentPlaceholder:"Enter the resource content...",enabled:"Enabled",active:"Active",inactive:"Inactive",descriptionUpdateSuccess:"Resource description updated successfully",descriptionUpdateFailed:"Failed to update resource description",restoreDefault:"Restore default",restoreDefaultSuccess:"Resource description restored to default",restoreDefaultFailed:"Failed to restore the default resource description",uriRequired:"URI is required",contentRequired:"Content is required",fetchError:"Failed to load built-in resources",createError:"Failed to create resource",updateError:"Failed to update resource",deleteError:"Failed to delete resource",saveError:"Failed to save resource",confirmDelete:"Delete Resource",deleteWarning:'Are you sure you want to delete the resource "{{name}}"? This action cannot be undone.'},t4={title:"Activity",totalCalls:"Total Calls",successCount:"Successful",errorCount:"Failed",avgDuration:"Avg Duration",timestamp:"Timestamp",server:"Server",tool:"Tool",duration:"Duration",status:"Status",group:"Group",key:"API Key",input:"Input",output:"Output",details:"Activity Details",errorMessage:"Error Message",searchServer:"Server...",searchTool:"Tool...",searchStatus:"Status...",searchGroup:"Group...",searchKeyName:"API key...",keyName:"API Key Name",allStatus:"All Status",statusSuccess:"Success",statusError:"Error",noData:"No activity data available",fetchError:"Failed to load activity data",cleanup:"Cleanup",confirmCleanup:"Are you sure you want to delete activities older than 30 days?",cleanupSuccess:"Deleted {{count}} old activities",cleanupError:"Failed to cleanup old activities",notAvailable:"Activity tracking is only available in database mode"},r4={exportButton:"Export Template",importButton:"Import Template",exportTitle:"Export Configuration Template",importTitle:"Import Configuration Template",name:"Template Name",nameRequired:"Template name is required",namePlaceholder:"e.g., Frontend Dev Tools",description:"Description",descriptionPlaceholder:"e.g., Standard MCP servers for frontend development",selectGroups:"Select Groups",selectGroupsHelp:"Leave empty to export all groups",selectAll:"Select All",deselectAll:"Deselect All",includeDisabled:"Include disabled servers",exportNote:"Secrets (API keys, tokens, passwords) will be replaced with ${PLACEHOLDER} references. Recipients must supply their own credentials.",export:"Export",exporting:"Exporting...",exportFailed:"Failed to export template",import:"Import",importing:"Importing...",importFailed:"Failed to import template",invalidFormat:"Invalid template format. Must contain version, name, servers, and groups fields.",parseError:"Failed to parse JSON. Please check the format and try again.",uploadFile:"Upload Template File",or:"or",pasteJson:"Paste Template JSON",pastePlaceholder:"Paste your .mcphub-template.json content here...",version:"Version",createdAt:"Created",servers:"Servers",groups:"Groups",serversInGroup:"server(s)",envVarsNeeded:"Required Environment Variables — set these before using the imported servers:",importResult:"Servers: {{serversCreated}} created, {{serversSkipped}} skipped. Groups: {{groupsCreated}} created, {{groupsSkipped}} skipped."},a4={app:Sk,about:Nk,profile:kk,sponsor:Ck,wechat:Ak,discord:Ek,theme:Rk,auth:Tk,server:Ok,status:zk,errors:Mk,common:Pk,pagination:Dk,nav:Lk,pages:Uk,logs:_k,groups:Bk,market:Ik,oauthServer:Fk,cloud:Hk,registry:qk,tool:Gk,prompt:Kk,settings:Vk,mcpb:$k,jsonImport:Yk,groupImport:Jk,users:Qk,api:Xk,oauthCallback:Zk,builtinPrompts:Wk,builtinResources:e4,activity:t4,template:r4},s4={title:"MCPHub 控制面板",error:"错误",closeButton:"关闭",noServers:"没有可用的 MCP 服务器",loading:"加载中...",logout:"退出登录",profile:"个人资料",changePassword:"修改密码",toggleSidebar:"切换侧边栏",welcomeUser:"欢迎, {{username}}",name:"MCPHub",embeddingSyncProgress:"正在为 {{serverName}} 创建嵌入",embeddingSyncProgressAriaLabel:"正在为 {{serverName}} 创建嵌入:已完成 {{current}}/{{total}}"},n4={title:"关于",versionInfo:"MCPHub 版本: {{version}}",newVersion:"有新版本可用!",currentVersion:"当前版本",newVersionAvailable:"新版本 {{version}} 已发布",viewOnGitHub:"在 GitHub 上查看",checkForUpdates:"检查更新",checking:"检查更新中..."},l4={viewProfile:"查看个人中心",userCenter:"个人中心"},i4={label:"赞助",title:"支持项目",rewardAlt:"赞赏码",supportMessage:"通过捐赠支持 MCPHub 的开发!",supportButton:"在 Ko-fi 上支持"},o4={label:"微信",title:"微信联系",qrCodeAlt:"微信二维码",scanMessage:"扫描二维码添加微信"},c4={label:"Discord",title:"加入我们的 Discord 服务器",community:"加入我们不断壮大的 Discord 社区,获取支持、参与讨论并了解最新动态!"},u4={title:"主题",light:"浅色",dark:"深色",system:"系统"},d4={login:"登录",loginTitle:"登录 MCPHub",slogan:"统一的 MCP 服务器管理平台",subtitle:"模型上下文协议服务器的集中管理平台,通过灵活的路由策略组织、监控和扩展多个 MCP 服务器。",username:"用户名",password:"密码",loggingIn:"登录中...",orContinue:"或使用以下方式继续",loginWithGoogle:"使用 Google 登录",loginWithGithub:"使用 GitHub 登录",socialLoginFailed:"社交登录失败,请重试。",emptyFields:"用户名和密码不能为空",loginFailed:"登录失败,请检查用户名和密码",loginError:"登录过程中出现错误",serverUnavailable:"无法连接到服务器,请检查网络连接或稍后再试",currentPassword:"当前密码",newPassword:"新密码",confirmPassword:"确认密码",passwordsNotMatch:"新密码与确认密码不一致",changePasswordSuccess:"密码修改成功",changePasswordError:"修改密码失败",changePassword:"修改密码",passwordChanged:"密码修改成功",passwordChangeError:"修改密码失败",defaultPasswordWarning:"默认密码安全警告",defaultPasswordMessage:"您正在使用默认密码(admin123),这存在安全风险。为了保护您的账户安全,请立即修改密码。",goToSettings:"前往修改",passwordStrengthError:"密码不符合安全要求",passwordMinLength:"密码长度至少为 8 个字符",passwordRequireLetter:"密码必须包含至少一个字母",passwordRequireNumber:"密码必须包含至少一个数字",passwordRequireSpecial:"密码必须包含至少一个特殊字符",passwordStrengthHint:"密码必须至少 8 个字符,且包含字母、数字和特殊字符"},m4={addServer:"添加服务器",add:"添加",edit:"编辑",copy:"复制",delete:"删除",confirmDelete:"您确定要删除此服务器吗?",deleteWarning:"删除服务器 '{{name}}' 将会移除该服务器及其所有数据。此操作无法撤销。",status:"状态",tools:"工具",prompts:"提示词",name:"服务器名称",description:"服务器注释",descriptionPlaceholder:"可选:记录这个服务器的用途说明",url:"服务器 URL",apiKey:"API 密钥",save:"保存",cancel:"取消",addError:"添加服务器失败",editError:"编辑服务器 {{serverName}} 失败",invalidConfig:"无法找到 {{serverName}} 的配置数据",deleteError:"删除服务器 {{serverName}} 失败",updateError:"更新服务器失败",editTitle:"编辑服务器: {{serverName}}",type:"服务器类型",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"流式 HTTP",typeOpenapi:"OpenAPI",command:"命令",arguments:"参数",envVars:"环境变量",headers:"HTTP 请求头",key:"键",value:"值",enabled:"已启用",enable:"启用",disable:"禁用",reload:"重载",reloadSuccess:"服务器重载成功",reloadError:"重载服务器 {{serverName}} 失败",requestOptions:"连接配置",timeout:"请求超时",timeoutDescription:"请求超时时间(毫秒)",maxTotalTimeout:"最大总超时",maxTotalTimeoutDescription:"无论是否有进度通知的最大总超时时间(毫秒)",resetTimeoutOnProgress:"收到进度通知时重置超时",resetTimeoutOnProgressDescription:"适用于发送周期性进度更新的长时间运行操作(默认开启)",keepAlive:"保活配置",enableKeepAlive:"启用保活",keepAliveDescription:"定期发送 ping 请求以维持连接。适用于可能超时的长期连接。",keepAliveInterval:"间隔时间(毫秒)",keepAliveIntervalDescription:"保活 ping 的时间间隔(默认:60000毫秒 = 1分钟)",remove:"移除",toggleError:"切换服务器 {{serverName}} 状态失败",alreadyExists:"服务器 {{serverName}} 已经存在",invalidData:"提供的服务器数据无效",notFound:"找不到服务器 {{serverName}}",namePlaceholder:"请输入服务器名称",urlPlaceholder:"请输入服务器URL",commandPlaceholder:"请输入命令",argumentsPlaceholder:"请输入参数",errorDetails:"错误详情",viewErrorDetails:"查看错误详情",copyConfig:"复制配置",confirmVariables:"确认变量配置",variablesDetected:"检测到配置中包含变量,请确认这些变量是否已正确配置:",detectedVariables:"检测到的变量",confirmVariablesMessage:"请确保这些变量在运行环境中已正确定义。是否继续添加服务器?",confirmAndAdd:"确认并添加",openapi:{inputMode:"输入模式",inputModeUrl:"规范 URL",inputModeSchema:"JSON 模式",specUrl:"OpenAPI 规范 URL",schema:"OpenAPI JSON 模式",schemaHelp:"请在此处粘贴完整的 OpenAPI JSON 模式",security:"安全类型",securityNone:"无",securityApiKey:"API 密钥",securityHttp:"HTTP 认证",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API 密钥配置",apiKeyName:"请求头/参数名称",apiKeyIn:"位置",apiKeyValue:"API 密钥值",httpAuthConfig:"HTTP 认证配置",httpScheme:"认证方案",httpCredentials:"凭据",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 配置",oauth2Token:"访问令牌",openIdConnectConfig:"OpenID Connect 配置",openIdConnectUrl:"发现 URL",openIdConnectToken:"ID 令牌",apiKeyInHeader:"请求头",apiKeyInQuery:"查询",apiKeyInCookie:"Cookie",passthroughHeaders:"透传请求头",passthroughHeadersHelp:"要从传入的 MCP 请求透传到上游服务器请求的请求头名称列表,用逗号分隔(如:Authorization, X-API-Key)"},oauth:{sectionTitle:"OAuth 配置",sectionDescription:"为需要 OAuth 的服务器配置客户端凭据(可选)。",clientId:"客户端 ID",clientSecret:"客户端密钥",authorizationEndpoint:"授权端点",tokenEndpoint:"令牌端点",scopes:"权限范围(Scopes)",scopesPlaceholder:"scope1 scope2",resource:"资源 / 受众",accessToken:"访问令牌",refreshToken:"刷新令牌"}},p4={online:"在线",offline:"离线",connecting:"连接中",oauthRequired:"需要OAuth授权",clickToAuthorize:"点击进行OAuth授权",oauthWindowOpened:"OAuth授权窗口已打开,请完成授权。"},g4={general:"发生错误",network:"网络连接错误,请检查您的互联网连接",serverConnection:"无法连接到服务器,请检查服务器是否正在运行",serverAdd:"添加服务器失败,请检查服务器状态",serverUpdate:"编辑服务器 {{serverName}} 失败,请检查服务器状态",serverFetch:"获取服务器数据失败,请稍后重试",failedToReloadServer:"重载服务器失败",initialStartup:"服务器可能正在启动中。首次启动可能需要一些时间,请耐心等候...",serverInstall:"安装服务器失败",failedToFetchSettings:"获取设置失败",failedToUpdateSystemConfig:"更新系统配置失败",failedToUpdateRouteConfig:"更新路由配置失败",failedToUpdateSmartRoutingConfig:"更新智能路由配置失败"},f4={processing:"处理中...",save:"保存",cancel:"取消",back:"返回",refresh:"刷新",search:"搜索",clear:"清除",view:"查看",create:"创建",creating:"创建中...",update:"更新",updating:"更新中...",submitting:"提交中...",delete:"删除",remove:"移除",copy:"复制",copyId:"复制ID",copyUrl:"复制URL",copyJson:"复制JSON",copySuccess:"已复制到剪贴板",copyFailed:"复制失败",copied:"已复制",close:"关闭",confirm:"确认",language:"语言",true:"是",false:"否",dismiss:"忽略",github:"GitHub",wechat:"微信",itemsPerPage:"每页显示",showing:"显示第 {{start}}-{{end}} 条,共 {{total}} 条",previous:"上一页",next:"下一页",discord:"Discord",required:"必填",secret:"敏感",default:"默认值",value:"值",type:"类型",repeated:"可重复",valueHint:"值提示",choices:"可选值",actions:"操作",saving:"保存中...",active:"已激活",inactive:"未激活"},h4={rowsPerPage:"每页行数",showing:"显示第 {{from}}-{{to}} 条,共 {{total}} 条"},x4={dashboard:"仪表盘",servers:"服务器",settings:"设置",changePassword:"修改密码",groups:"分组",prompts:"提示词",resources:"资源",users:"用户",market:"市场",cloud:"云端市场",logs:"日志",activity:"活动"},y4={dashboard:{title:"仪表盘",totalServers:"总数",onlineServers:"在线",disabledServers:"禁用",offlineServers:"离线",connectingServers:"连接中",recentServers:"最近的服务器"},servers:{title:"服务器管理"},settings:{title:"设置",language:"语言",account:"账户设置",password:"修改密码",appearance:"外观",routeConfig:"安全配置",installConfig:"安装",smartRouting:"智能路由",oauthServer:"OAuth"},groups:{title:"分组管理"},prompts:{title:"内置提示词"},resources:{title:"内置资源"},users:{title:"用户管理"},market:{title:"市场中心 - 本地市场和云端市场"},logs:{title:"系统日志"}},b4={filters:"筛选",search:"搜索日志...",autoScroll:"自动滚动",clearLogs:"清除日志",loading:"加载日志中...",noLogs:"暂无日志。",noMatch:"没有匹配当前筛选条件的日志。",mainProcess:"主进程",childProcess:"子进程",main:"主",child:"子"},v4={add:"添加",addNew:"添加新分组",edit:"编辑分组",delete:"删除",confirmDelete:"您确定要删除此分组吗?",deleteWarning:"删除分组 '{{name}}' 将会移除该分组及其所有服务器关联。此操作无法撤销。",name:"分组名称",namePlaceholder:"请输入分组名称",nameRequired:"分组名称不能为空",description:"描述",descriptionPlaceholder:"请输入分组描述(可选)",createError:"创建分组失败",updateError:"更新分组失败",deleteError:"删除分组失败",serverAddError:"向分组添加服务器失败",serverRemoveError:"从分组移除服务器失败",addServer:"添加服务器到分组",selectServer:"选择要添加的服务器",servers:"分组中的服务器",remove:"移除",noGroups:"暂无可用分组。创建一个新分组以开始使用。",noServers:"此分组中没有服务器。",noServerOptions:"没有可用的服务器",serverCount:"{{count}} 台服务器",toolSelection:"工具选择",promptSelection:"提示词选择",resourceSelection:"资源选择",toolsSelected:"选择",promptsSelected:"选择",resourcesSelected:"选择",allTools:"全部",allPrompts:"全部提示词",allResources:"全部资源",selectedTools:"选中的工具",selectedPrompts:"选中的提示词",selectedResources:"选中的资源",selectAll:"全选",selectNone:"全不选",configureTools:"配置工具",configureCapabilities:"配置工具、提示词和资源",previewPrompts:"[提示词: {{items}}]",previewResources:"[资源: {{items}}]",previewAllTools:"(全部工具)",previewAllPrompts:"(全部提示词)",previewAllResources:"(全部资源)"},w4={title:"本地安装",official:"官方",by:"作者",unknown:"未知",tools:"工具",search:"搜索",searchPlaceholder:"搜索服务器名称、分类或标签",clearFilters:"清除",clearCategoryFilter:"",clearTagFilter:"",categories:"分类",tags:"标签",showTags:"显示标签",hideTags:"隐藏标签",moreTags:"",noServers:"未找到匹配的服务器",backToList:"返回列表",install:"安装",installing:"安装中...",installed:"已安装",installServer:"安装服务器: {{name}}",installSuccess:"服务器 {{serverName}} 安装成功",author:"作者",license:"许可证",repository:"代码仓库",examples:"示例",arguments:"参数",argumentName:"名称",description:"描述",required:"必填",example:"示例",viewSchema:"查看结构",fetchError:"获取本地市场服务器数据失败",serverNotFound:"未找到服务器",searchError:"搜索服务器失败",filterError:"按分类筛选服务器失败",tagFilterError:"按标签筛选服务器失败",noInstallationMethod:"该服务器没有可用的安装方法",showing:"显示 {{from}}-{{to}}/{{total}} 个服务器",perPage:"每页显示",confirmVariablesMessage:"请确保这些变量在运行环境中已正确定义。是否继续安装服务器?",confirmAndInstall:"确认并安装"},j4={authorizeTitle:"授权应用",authorizeSubtitle:"允许此应用访问您的 MCPHub 账号。",buttons:{approve:"允许访问",deny:"拒绝",approveSubtitle:"如果您信任此应用,建议选择允许。",denySubtitle:"您可以在之后随时再次授权。"}},S4={title:"云端支持",subtitle:"由 MCPRouter 提供支持",by:"作者",server:"服务器",config:"配置",created:"创建时间",updated:"更新时间",available:"可用",description:"描述",details:"详细信息",tools:"工具",tool:"个工具",toolsAvailable:"{{count}} 个工具可用",loadingTools:"加载工具中...",noTools:"该服务器没有可用工具",noDescription:"无描述信息",viewDetails:"查看详情",parameters:"参数",result:"结果",error:"错误",callTool:"调用",calling:"调用中...",toolCallSuccess:"工具 {{toolName}} 执行成功",toolCallError:"调用工具 {{toolName}} 失败:{{error}}",viewSchema:"查看结构",backToList:"返回云端市场",search:"搜索",searchPlaceholder:"搜索云端服务器名称、标题或作者",clearFilters:"清除筛选",clearCategoryFilter:"清除",clearTagFilter:"清除",categories:"分类",tags:"标签",noCategories:"未找到分类",noTags:"未找到标签",noServers:"未找到云端服务器",fetchError:"获取云端服务器失败",serverNotFound:"未找到云端服务器",searchError:"搜索云端服务器失败",filterError:"按分类筛选云端服务器失败",tagFilterError:"按标签筛选云端服务器失败",showing:"显示 {{from}}-{{to}}/{{total}} 个云端服务器",perPage:"每页显示",apiKeyNotConfigured:"MCPRouter API 密钥未配置",apiKeyNotConfiguredDescription:"要使用云端服务器,您需要配置 MCPRouter API 密钥。",getApiKey:"获取 API 密钥",configureInSettings:"在设置中配置",installServer:"安装 {{name}}",installSuccess:"服务器 {{name}} 安装成功",installError:"安装服务器失败:{{error}}"},N4={title:"注册中心",official:"官方",latest:"最新版本",description:"描述",website:"网站",repository:"代码仓库",packages:"安装包",package:"安装包",remotes:"远程服务",remote:"远程服务",published:"发布时间",updated:"更新时间",install:"安装",installing:"安装中...",installed:"已安装",installServer:"安装 {{name}}",installSuccess:"服务器 {{name}} 安装成功",installError:"安装服务器失败:{{error}}",noDescription:"无描述信息",viewDetails:"查看详情",backToList:"返回注册中心",search:"搜索",searchPlaceholder:"按名称搜索注册中心服务器",clearFilters:"清除",noServers:"未找到注册中心服务器",fetchError:"获取注册中心服务器失败",serverNotFound:"未找到注册中心服务器",showing:"显示 {{from}}-{{to}}/{{total}} 个注册中心服务器",perPage:"每页显示",environmentVariables:"环境变量",packageArguments:"安装包参数",runtimeArguments:"运行时参数",headers:"请求头"},k4={run:"运行",running:"运行中...",runTool:"运行",cancel:"取消",noDescription:"无描述信息",inputSchema:"输入模式:",runToolWithName:"运行工具:{{name}}",execution:"工具执行",successful:"成功",failed:"失败",result:"结果:",error:"错误",errorDetails:"错误详情:",noContent:"工具执行成功但未返回内容。",unknownError:"发生未知错误",jsonResponse:"JSON 响应:",toolResult:"工具结果",noParameters:"此工具不需要任何参数。",selectOption:"选择一个选项",enterValue:"输入{{type}}值",enabled:"已启用",enableSuccess:"工具 {{name}} 启用成功",disableSuccess:"工具 {{name}} 禁用成功",toggleFailed:"切换工具状态失败",descriptionUpdateSuccess:"工具描述更新成功",descriptionUpdateFailed:"更新工具描述失败",restoreDefault:"恢复默认值",restoreDefaultSuccess:"工具描述已恢复为默认值",restoreDefaultFailed:"恢复默认工具描述失败",parameters:"工具参数",formMode:"表单模式",jsonMode:"JSON 模式",jsonConfiguration:"JSON 配置",invalidJsonFormat:"无效的 JSON 格式",fixJsonBeforeSwitching:"请修复 JSON 格式后再切换到表单模式",item:"项目 {{index}}",addItem:"添加 {{key}} 项目",enterKey:"输入 {{key}}"},C4={run:"获取",running:"获取中...",result:"提示词结果",error:"提示词错误",execution:"提示词执行",successful:"成功",failed:"失败",errorDetails:"错误详情:",noContent:"提示词执行成功但未返回内容。",unknownError:"发生未知错误",jsonResponse:"JSON 响应:",description:"描述",messages:"消息",noDescription:"无描述信息",runPromptWithName:"获取提示词: {{name}}",descriptionUpdateSuccess:"提示词描述更新成功",descriptionUpdateFailed:"更新提示词描述失败",restoreDefault:"恢复默认值",restoreDefaultSuccess:"提示词描述已恢复为默认值",restoreDefaultFailed:"恢复默认提示词描述失败"},A4={enableGlobalRoute:"启用全局路由",enableGlobalRouteDescription:"允许不指定组 ID 就连接到 /sse 端点",enableGroupNameRoute:"启用组名路由",enableGroupNameRouteDescription:"允许使用组名而不仅仅是组 ID 连接到 /sse 端点",enableBearerAuth:"启用 Bearer 认证",enableBearerAuthDescription:"对 MCP 端点启用 Bearer 令牌认证(默认开启)",bearerAuthKey:"Bearer 认证密钥",bearerAuthKeyDescription:"Bearer 令牌中需要携带的认证密钥",bearerAuthKeyPlaceholder:"请输入 Bearer 认证密钥",bearerAuthHeaderName:"Bearer 认证请求头名称",bearerAuthHeaderNameDescription:"用于接收 MCP Bearer 凭证的请求头名称。当上游透传头也使用 Authorization 时,可改成其它名称以避免冲突。",bearerAuthHeaderNamePlaceholder:"例如:Authorization 或 X-MCP-Authorization",bearerKeysSectionTitle:"密钥",bearerKeysSectionDescription:"管理多条密钥,并为不同密钥配置不同的访问范围。",noBearerKeys:"当前还没有配置任何密钥。",bearerKeyName:"名称",bearerKeyToken:"密钥值",bearerKeyEnabled:"启用",bearerKeyAccessType:"访问范围",bearerKeyAccessAll:"全部",bearerKeyAccessGroups:"指定分组",bearerKeyAccessServers:"指定服务器",bearerKeyAccessCustom:"自定义",bearerKeyAllowedGroups:"允许访问的分组",bearerKeyAllowedServers:"允许访问的服务器",addBearerKey:"新增密钥",addBearerKeyButton:"创建",bearerKeyRequired:"名称和密钥值为必填项",deleteBearerKeyConfirm:"确定要删除这条密钥吗?",generate:"生成",selectGroups:"选择分组",selectServers:"选择服务器",selectAtLeastOneGroup:"请至少选择一个分组",selectAtLeastOneServer:"请至少选择一个服务器",skipAuth:"免登录开关",skipAuthDescription:"允许仪表盘免登录;未认证用户将获得 guest 管理员访问权限(不影响 MCP 端点认证)",jsonBodyLimit:"JSON 请求体大小限制",jsonBodyLimitDescription:"Express JSON 请求体大小限制,大型 OpenAPI schema 上传也会受此配置影响。",jsonBodyLimitPlaceholder:"例如:1mb、5mb、1024kb",pythonIndexUrl:"Python 包仓库地址",pythonIndexUrlDescription:"设置 UV_DEFAULT_INDEX 环境变量,用于 Python 包安装",pythonIndexUrlPlaceholder:"例如: https://pypi.org/simple",npmRegistry:"NPM 仓库地址",npmRegistryDescription:"设置 npm_config_registry 环境变量,用于 NPM 包安装",npmRegistryPlaceholder:"例如: https://registry.npmjs.org/",baseUrl:"基础地址",baseUrlDescription:"用于 MCP 请求与 OAuth 回调的基础地址",baseUrlPlaceholder:"例如: http://localhost:3000",installConfig:"安装配置",systemConfigUpdated:"系统配置更新成功",enableSmartRouting:"启用智能路由",enableSmartRoutingDescription:"开启智能路由功能,根据输入自动搜索最合适的工具(使用 $smart 分组)",dbUrl:"PostgreSQL 连接地址(必须支持 pgvector)",dbUrlPlaceholder:"例如: postgresql://user:password@localhost:5432/dbname",embeddingProvider:"嵌入提供方",openaiApiBaseUrl:"OpenAI 兼容基础地址",openaiApiBaseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKey:"LLM 提供商 API 密钥",openaiApiKeyDescription:"用于访问嵌入服务的 API 密钥",openaiApiKeyPlaceholder:"请输入 LLM 提供商 API 密钥",openaiApiEmbeddingModel:"嵌入模型名称",openaiApiEmbeddingModelPlaceholder:"text-embedding-3-small",basePacingDelayMs:"基础节流延迟(毫秒)",basePacingDelayMsDescription:"向嵌入服务提供方发送请求之间的基础等待时间。默认为 0 — 系统自动管理限流:优先遵守 Retry-After 响应头,若无该头则等待 63 秒,并在每次 403/429 后自动提高节流延迟。仅当提供方要求固定最小请求间隔时才需设置非零值。",basePacingDelayMsPlaceholder:"留空 = 默认 0 毫秒",basePacingDelayMsAuto:"默认({{value}} 毫秒):限流由系统自动管理。",basePacingDelayMsZero:"0 毫秒(默认):限流通过自适应节流和重试逻辑自动管理。",basePacingDelayMsOverride:"自定义值:覆盖默认的基础节流延迟。",embeddingEncodingFormat:"嵌入编码格式",embeddingEncodingFormatDescription:"嵌入向量的编码格式。自动模式会根据服务商支持情况自动选择。",embeddingEncodingFormatAuto:"自动(推荐)",azureOpenaiEndpoint:"Azure OpenAI 终端地址",azureOpenaiEndpointPlaceholder:"https://YOUR_RESOURCE_NAME.openai.azure.com",azureOpenaiApiKey:"Azure OpenAI API 密钥",azureOpenaiApiKeyPlaceholder:"请输入 Azure OpenAI API 密钥",azureOpenaiApiVersion:"Azure OpenAI API 版本",azureOpenaiApiVersionPlaceholder:"2024-02-15-preview",azureOpenaiEmbeddingDeployment:"Azure OpenAI 嵌入部署",azureOpenaiEmbeddingDeploymentPlaceholder:"text-embedding-3-small",azureOpenaiEmbeddingModel:"Azure 嵌入模型名称",azureOpenaiEmbeddingModelDescription:"在 Azure 中部署的实际 OpenAI 模型名称(例如 text-embedding-3-small),用于在发送请求前准确进行 Token 计数。",azureOpenaiEmbeddingModelPlaceholder:"text-embedding-3-small",progressiveDisclosure:"渐进式披露",progressiveDisclosureDescription:"开启后,search_tools 只返回工具名称和描述,通过 describe_tool 获取完整参数定义,可减少 Token 消耗",embeddingMaxTokens:"最大嵌入 Token 数",embeddingMaxTokensDescription:"生成嵌入前截断文本的最大 Token 数。留空将自动使用模型默认值。设置自定义值将始终覆盖模型默认值。当使用本地 LLM 提供商时,手动设置此值特别有用,可防止截断错误。",embeddingMaxTokensPlaceholder:"留空 = 自动(按模型)",embeddingMaxTokensAuto:"自动:{{limit}} tokens({{model}} 的模型默认值)",embeddingMaxTokensOverride:"此值将覆盖模型默认值。",smartRoutingConfigUpdated:"智能路由配置更新成功",smartRoutingRequiredFields:"启用智能路由需要填写数据库连接地址。LLM 提供商 API 密钥仅在使用云端提供商时才需要(本地 LLM 通常不需要 API 密钥,可输入任意值通过表单验证)",smartRoutingValidationError:"启用智能路由前请先填写必要字段:{{fields}}",mcpRouterConfig:"云端市场",mcpRouterApiKey:"MCPRouter API 密钥",mcpRouterApiKeyDescription:"用于访问 MCPRouter 云端市场服务的 API 密钥",mcpRouterApiKeyPlaceholder:"请输入 MCPRouter API 密钥",mcpRouterReferer:"引用地址",mcpRouterRefererDescription:"MCPRouter API 请求的引用地址头",mcpRouterRefererPlaceholder:"https://www.mcphub.app",mcpRouterTitle:"标题",mcpRouterTitleDescription:"MCPRouter API 请求的标题头",mcpRouterTitlePlaceholder:"MCPHub",mcpRouterBaseUrl:"基础地址",mcpRouterBaseUrlDescription:"MCPRouter API 的基础地址",mcpRouterBaseUrlPlaceholder:"https://api.mcprouter.to/v1",systemSettings:"系统设置",nameSeparatorLabel:"名称分隔符",nameSeparatorDescription:"用于分隔服务器名称和工具/提示名称(默认:-)",enableSessionRebuild:"启用服务端会话重建",enableSessionRebuildDescription:"开启后会应用服务端会话重建的改进代码,提供更好的会话管理体验",restartRequired:"配置已保存。为确保所有服务正确加载新设置,建议重启应用。",exportMcpSettings:"导出配置",mcpSettingsJson:"MCP 配置 JSON",mcpSettingsJsonDescription:"查看、复制或下载当前的 mcp_settings.json 配置,可用于备份或迁移到其他工具",copyToClipboard:"复制到剪贴板",downloadJson:"下载 JSON",exportSuccess:"配置导出成功",exportError:"获取配置失败",enableOauthServer:"启用 OAuth 服务器",enableOauthServerDescription:"允许 MCPHub 作为 OAuth 2.0 授权服务器向外部客户端签发令牌",requireClientSecret:"需要客户端密钥",requireClientSecretDescription:"开启后,保密客户端必须携带 client secret(如需仅使用 PKCE 的公共客户端可关闭)",requireState:"要求 state 参数",requireStateDescription:"拒绝未携带 state 参数的授权请求",accessTokenLifetime:"访问令牌有效期(秒)",accessTokenLifetimeDescription:"控制访问令牌可使用的时长",accessTokenLifetimePlaceholder:"例如:3600",refreshTokenLifetime:"刷新令牌有效期(秒)",refreshTokenLifetimeDescription:"控制刷新令牌的过期时间",refreshTokenLifetimePlaceholder:"例如:1209600",authorizationCodeLifetime:"授权码有效期(秒)",authorizationCodeLifetimeDescription:"授权码在被兑换前可保持有效的时间",authorizationCodeLifetimePlaceholder:"例如:300",allowedScopes:"允许的作用域",allowedScopesDescription:"使用逗号分隔的作用域列表,在授权时展示给用户",allowedScopesPlaceholder:"例如:read, write",enableDynamicRegistration:"启用动态客户端注册",dynamicRegistrationDescription:"允许遵循 RFC 7591 的客户端通过公共端点自行注册",dynamicRegistrationAllowedGrantTypes:"允许的授权类型",dynamicRegistrationAllowedGrantTypesDescription:"使用逗号分隔动态注册客户端可以使用的授权类型",dynamicRegistrationAllowedGrantTypesPlaceholder:"例如:authorization_code, refresh_token",dynamicRegistrationAuth:"注册需要认证",dynamicRegistrationAuthDescription:"开启后,注册端点需要认证请求才能创建客户端",invalidNumberInput:"请输入合法的非负数字"},E4={upload:"上传",uploadTitle:"上传 MCPB 文件",dropFileHere:"将 .mcpb 文件拖拽到此处",orClickToSelect:"或点击从计算机选择",invalidFileType:"请选择有效的 .mcpb 文件",noFileSelected:"请选择要上传的 .mcpb 文件",uploading:"上传中...",uploadFailed:"上传 MCPB 文件失败",installServer:"从 MCPB 安装 MCP 服务器",extensionInfo:"扩展信息",name:"名称",version:"版本",description:"描述",author:"作者",tools:"工具",serverName:"服务器名称",serverNamePlaceholder:"为此服务器输入名称",install:"安装",installing:"安装中...",installFailed:"从 MCPB 安装服务器失败",serverExistsTitle:"服务器已存在",serverExistsConfirm:"服务器 '{{serverName}}' 已存在。是否要用新版本覆盖它?",override:"覆盖"},R4={button:"导入",title:"从 JSON 导入服务器",inputLabel:"服务器配置 JSON",inputHelp:"粘贴您的服务器配置 JSON。支持 STDIO、SSE 和 HTTP (streamable-http) 服务器类型。",preview:"预览",previewTitle:"预览要导入的服务器",import:"导入",importing:"导入中...",invalidFormat:"无效的 JSON 格式。JSON 必须包含 'mcpServers' 对象。",parseError:"解析 JSON 失败。请检查格式后重试。",addFailed:"添加服务器失败",importFailed:"导入服务器失败",partialSuccess:"成功导入 {{count}} / {{total}} 个服务器。部分服务器失败:"},T4={button:"导入",title:"从 JSON 导入分组",inputLabel:"分组配置 JSON",inputHelp:"粘贴您的分组配置 JSON。每个分组可以包含一个服务器列表。",preview:"预览",previewTitle:"预览要导入的分组",import:"导入",importing:"导入中...",invalidFormat:"无效的 JSON 格式。JSON 必须包含 'groups' 数组。",missingName:"每个分组必须有 'name' 字段。",parseError:"解析 JSON 失败。请检查格式后重试。",addFailed:"添加分组失败",importFailed:"导入分组失败",partialSuccess:"成功导入 {{count}} / {{total}} 个分组。部分分组失败:"},O4={add:"添加",addNew:"添加新用户",edit:"编辑用户",delete:"删除用户",create:"创建",update:"更新",username:"用户名",password:"密码",newPassword:"新密码",confirmPassword:"确认密码",changePassword:"修改密码",adminRole:"管理员",admin:"管理员",user:"用户",role:"角色",actions:"操作",addFirst:"添加第一个用户",permissions:"权限",adminPermissions:"完全系统访问权限",userPermissions:"受限访问权限",currentUser:"当前用户",noUsers:"没有找到用户",adminRequired:"需要管理员权限才能管理用户",usernameRequired:"用户名是必需的",passwordRequired:"密码是必需的",passwordTooShort:"密码至少需要6个字符",passwordMismatch:"密码不匹配",usernamePlaceholder:"输入用户名",passwordPlaceholder:"输入密码",newPasswordPlaceholder:"留空保持当前密码",confirmPasswordPlaceholder:"确认新密码",createError:"创建用户失败",updateError:"更新用户失败",deleteError:"删除用户失败",statsError:"获取用户统计失败",deleteConfirmation:"您确定要删除用户 '{{username}}' 吗?此操作无法撤消。",confirmDelete:"删除用户",deleteWarning:"您确定要删除用户 '{{username}}' 吗?此操作无法撤消。"},z4={errors:{readonly:"演示环境无法修改数据",invalid_credentials:"用户名或密码错误",serverNameRequired:"服务器名称是必需的",serverConfigRequired:"服务器配置是必需的",serverConfigInvalid:"服务器配置必须包含 URL、OpenAPI 规范 URL 或模式,或者带参数的命令",serverTypeInvalid:"服务器类型必须是以下之一:stdio、sse、streamable-http、openapi",urlRequiredForType:"{{type}} 服务器类型需要 URL",openapiSpecRequired:"openapi 服务器类型需要 OpenAPI 规范 URL 或模式",headersInvalidFormat:"请求头必须是对象格式",headersNotSupportedForStdio:"stdio 服务器类型不支持请求头",serverNotFound:"找不到服务器",failedToRemoveServer:"找不到服务器或删除失败",internalServerError:"服务器内部错误",failedToGetServers:"获取服务器信息失败",failedToGetServerSettings:"获取服务器设置失败",failedToGetServerConfig:"获取服务器配置失败",failedToSaveSettings:"保存设置失败",toolNameRequired:"服务器名称和工具名称是必需的",descriptionMustBeString:"描述必须是字符串",groupIdRequired:"分组 ID 是必需的",groupNameRequired:"分组名称是必需的",groupNotFound:"找不到分组",groupIdAndServerNameRequired:"分组 ID 和服务器名称是必需的",groupOrServerNotFound:"找不到分组或服务器",toolsMustBeAllOrArray:'工具必须是 "all" 或字符串数组',serverNameAndToolNameRequired:"服务器名称和工具名称是必需的",usernameRequired:"用户名是必需的",userNotFound:"找不到用户",failedToGetUsers:"获取用户信息失败",failedToGetUserInfo:"获取用户信息失败",failedToGetUserStats:"获取用户统计信息失败",marketServerNameRequired:"服务器名称是必需的",marketServerNotFound:"找不到市场服务器",failedToGetMarketServers:"获取市场服务器信息失败",failedToGetMarketServer:"获取市场服务器信息失败",failedToGetMarketCategories:"获取市场类别失败",failedToGetMarketTags:"获取市场标签失败",failedToSearchMarketServers:"搜索市场服务器失败",failedToFilterMarketServers:"过滤市场服务器失败",failedToProcessMcpbFile:"处理 MCPB 文件失败"},success:{serverCreated:"服务器创建成功",serverUpdated:"服务器更新成功",serverRemoved:"服务器删除成功",serverToggled:"服务器状态切换成功",toolToggled:"工具 {{name}} {{action}} 成功",toolDescriptionUpdated:"工具 {{name}} 描述更新成功",systemConfigUpdated:"系统配置更新成功",groupCreated:"分组创建成功",groupUpdated:"分组更新成功",groupDeleted:"分组删除成功",serverAddedToGroup:"服务器添加到分组成功",serverRemovedFromGroup:"服务器从分组移除成功",serverToolsUpdated:"服务器工具更新成功"}},M4={authorizationFailed:"授权失败",authorizationFailedError:"错误",authorizationFailedDetails:"详情",invalidRequest:"无效请求",missingStateParameter:"缺少必需的 OAuth 状态参数。",missingCodeParameter:"缺少必需的授权码参数。",serverNotFound:"服务器未找到",serverNotFoundMessage:"无法找到与此授权请求关联的服务器。",sessionExpiredMessage:"授权会话可能已过期。请重新进行授权。",authorizationSuccessful:"授权成功",server:"服务器",status:"状态",connected:"已连接",successMessage:"服务器已成功授权并连接。",autoCloseMessage:"此窗口将在 3 秒后自动关闭...",closeNow:"立即关闭",connectionError:"连接错误",connectionErrorMessage:"授权成功,但连接服务器失败。",reconnectMessage:"请尝试从控制面板重新连接。",configurationError:"配置错误",configurationErrorMessage:"服务器传输不支持 OAuth finishAuth()。请确保服务器配置为 streamable-http 传输。",internalError:"内部错误",internalErrorMessage:"处理 OAuth 回调时发生意外错误。",closeWindow:"关闭窗口"},P4={add:"添加提示词",addNew:"添加新提示词",edit:"编辑提示词",delete:"删除",noPrompts:"暂无内置提示词",addFirst:"添加第一个提示词",name:"名称",namePlaceholder:"例如 code-review",title:"标题",titlePlaceholder:"例如 代码审查提示词",description:"描述",descriptionPlaceholder:"提示词的简要描述",template:"模板",templatePlaceholder:"输入包含 {{parameter}} 占位符的模板文本...",templateHint:"使用 {{paramName}} 作为模板参数",arguments:"参数",addArgument:"添加参数",argName:"名称",argDescription:"描述",argRequired:"必填",enabled:"启用",active:"已启用",inactive:"已禁用",nameRequired:"名称为必填项",templateRequired:"模板为必填项",fetchError:"加载内置提示词失败",createError:"创建提示词失败",updateError:"更新提示词失败",deleteError:"删除提示词失败",saveError:"保存提示词失败",confirmDelete:"删除提示词",deleteWarning:'确定要删除提示词 "{{name}}" 吗?此操作无法撤销。'},D4={add:"添加资源",addNew:"添加新资源",edit:"编辑资源",delete:"删除",noResources:"暂无内置资源",addFirst:"添加第一个资源",uri:"URI",uriPlaceholder:"例如 resource://docs/guide",name:"名称",namePlaceholder:"例如 用户指南",description:"描述",descriptionPlaceholder:"资源的简要描述",mimeType:"MIME 类型",content:"内容",contentPlaceholder:"输入资源内容...",enabled:"启用",active:"已启用",inactive:"已禁用",descriptionUpdateSuccess:"资源描述更新成功",descriptionUpdateFailed:"更新资源描述失败",restoreDefault:"恢复默认值",restoreDefaultSuccess:"资源描述已恢复为默认值",restoreDefaultFailed:"恢复默认资源描述失败",uriRequired:"URI 为必填项",contentRequired:"内容为必填项",fetchError:"加载内置资源失败",createError:"创建资源失败",updateError:"更新资源失败",deleteError:"删除资源失败",saveError:"保存资源失败",confirmDelete:"删除资源",deleteWarning:'确定要删除资源 "{{name}}" 吗?此操作无法撤销。'},L4={title:"活动",totalCalls:"总调用次数",successCount:"成功次数",errorCount:"失败次数",avgDuration:"平均耗时",timestamp:"时间",server:"服务器",tool:"工具",duration:"耗时",status:"状态",group:"分组",key:"API密钥",input:"输入",output:"输出",details:"活动详情",errorMessage:"错误信息",searchServer:"服务器...",searchTool:"工具...",searchStatus:"状态...",searchGroup:"分组...",searchKeyName:"API密钥...",keyName:"API密钥名称",allStatus:"全部状态",statusSuccess:"成功",statusError:"失败",noData:"暂无活动数据",fetchError:"加载活动数据失败",cleanup:"清理",confirmCleanup:"确定要删除30天前的活动记录吗?",cleanupSuccess:"已删除 {{count}} 条旧记录",cleanupError:"清理旧记录失败",notAvailable:"活动跟踪功能仅在数据库模式下可用"},U4={exportButton:"导出模板",importButton:"导入模板",exportTitle:"导出配置模板",importTitle:"导入配置模板",name:"模板名称",nameRequired:"模板名称不能为空",namePlaceholder:"例如:前端开发工具",description:"描述",descriptionPlaceholder:"例如:前端开发标准 MCP 服务器集合",selectGroups:"选择分组",selectGroupsHelp:"留空则导出全部分组",selectAll:"全选",deselectAll:"取消全选",includeDisabled:"包含已禁用的服务器",exportNote:"密钥(API Key、Token、密码等)将被替换为 ${PLACEHOLDER} 占位符。接收者需要提供自己的凭据。",export:"导出",exporting:"导出中...",exportFailed:"导出模板失败",import:"导入",importing:"导入中...",importFailed:"导入模板失败",invalidFormat:"模板格式无效。必须包含 version、name、servers 和 groups 字段。",parseError:"JSON 解析失败,请检查格式后重试。",uploadFile:"上传模板文件",or:"或",pasteJson:"粘贴模板 JSON",pastePlaceholder:"在此粘贴 .mcphub-template.json 内容...",version:"版本",createdAt:"创建时间",servers:"服务器",groups:"分组",serversInGroup:"个服务器",envVarsNeeded:"所需环境变量 — 请在使用导入的服务器前设置这些变量:",importResult:"服务器:创建 {{serversCreated}} 个,跳过 {{serversSkipped}} 个。分组:创建 {{groupsCreated}} 个,跳过 {{groupsSkipped}} 个。"},_4={app:s4,about:n4,profile:l4,sponsor:i4,wechat:o4,discord:c4,theme:u4,auth:d4,server:m4,status:p4,errors:g4,common:f4,pagination:h4,nav:x4,pages:y4,logs:b4,groups:v4,market:w4,oauthServer:j4,cloud:S4,registry:N4,tool:k4,prompt:C4,settings:A4,mcpb:E4,jsonImport:R4,groupImport:T4,users:O4,api:z4,oauthCallback:M4,builtinPrompts:P4,builtinResources:D4,activity:L4,template:U4},B4={title:"Tableau de bord MCPHub",error:"Erreur",closeButton:"Fermer",noServers:"Aucun serveur MCP disponible",loading:"Chargement...",logout:"Déconnexion",profile:"Profil",changePassword:"Changer le mot de passe",toggleSidebar:"Basculer la barre latérale",welcomeUser:"Bienvenue, {{username}}",name:"MCPHub",embeddingSyncProgress:"Embeddings pour {{serverName}}",embeddingSyncProgressAriaLabel:"Création des embeddings pour {{serverName}} : {{current}} sur {{total}} terminés"},I4={title:"À propos",versionInfo:"Version MCPHub : {{version}}",newVersion:"Nouvelle version disponible !",currentVersion:"Version actuelle",newVersionAvailable:"La nouvelle version {{version}} est disponible",viewOnGitHub:"Voir sur GitHub",checkForUpdates:"Vérifier les mises à jour",checking:"Vérification des mises à jour..."},F4={viewProfile:"Voir le profil",userCenter:"Centre utilisateur"},H4={label:"Sponsor",title:"Soutenir le projet",rewardAlt:"QR Code de récompense",supportMessage:"Soutenez le développement de MCPHub en m'offrant un café !",supportButton:"Soutenir sur Ko-fi"},q4={label:"WeChat",title:"Se connecter via WeChat",qrCodeAlt:"QR Code WeChat",scanMessage:"Scannez ce QR code pour nous contacter sur WeChat"},G4={label:"Discord",title:"Rejoignez notre serveur Discord",community:"Rejoignez notre communauté grandissante sur Discord pour du support, des discussions et des mises à jour !"},K4={title:"Thème",light:"Clair",dark:"Sombre",system:"Système"},V4={login:"Connexion",loginTitle:"Se connecter à MCPHub",slogan:"Le Hub unifié pour les serveurs MCP",subtitle:"Plateforme de gestion centralisée pour les serveurs Model Context Protocol. Organisez, surveillez et mettez à l'échelle plusieurs serveurs MCP avec des stratégies de routage flexibles.",username:"Nom d'utilisateur",password:"Mot de passe",loggingIn:"Connexion en cours...",orContinue:"Ou continuer avec",loginWithGoogle:"Continuer avec Google",loginWithGithub:"Continuer avec GitHub",socialLoginFailed:"La connexion sociale a échoué. Veuillez réessayer.",emptyFields:"Le nom d'utilisateur et le mot de passe ne peuvent pas être vides",loginFailed:"Échec de la connexion, veuillez vérifier votre nom d'utilisateur et votre mot de passe",loginError:"Une erreur est survenue lors de la connexion",serverUnavailable:"Impossible de se connecter au serveur. Veuillez vérifier votre connexion réseau ou réessayer plus tard",currentPassword:"Mot de passe actuel",newPassword:"Nouveau mot de passe",confirmPassword:"Confirmer le mot de passe",passwordsNotMatch:"Le nouveau mot de passe et la confirmation ne correspondent pas",changePasswordSuccess:"Mot de passe changé avec succès",changePasswordError:"Échec du changement de mot de passe",changePassword:"Changer le mot de passe",passwordChanged:"Mot de passe changé avec succès",passwordChangeError:"Échec du changement de mot de passe",defaultPasswordWarning:"Avertissement de sécurité du mot de passe par défaut",defaultPasswordMessage:"Vous utilisez le mot de passe par défaut (admin123), ce qui présente un risque de sécurité. Veuillez changer votre mot de passe immédiatement pour protéger votre compte.",goToSettings:"Aller aux paramètres",passwordStrengthError:"Le mot de passe ne répond pas aux exigences de sécurité",passwordMinLength:"Le mot de passe doit contenir au moins 8 caractères",passwordRequireLetter:"Le mot de passe doit contenir au moins une lettre",passwordRequireNumber:"Le mot de passe doit contenir au moins un chiffre",passwordRequireSpecial:"Le mot de passe doit contenir au moins un caractère spécial",passwordStrengthHint:"Le mot de passe doit contenir au moins 8 caractères et inclure des lettres, des chiffres et des caractères spéciaux"},$4={addServer:"Ajouter un serveur",add:"Ajouter",edit:"Modifier",copy:"Copier",delete:"Supprimer",confirmDelete:"Êtes-vous sûr de vouloir supprimer ce serveur ?",deleteWarning:"La suppression du serveur '{{name}}' le supprimera ainsi que toutes ses données. Cette action est irréversible.",status:"Statut",tools:"Outils",prompts:"Invites",name:"Nom du serveur",description:"Note du serveur",descriptionPlaceholder:"Optionnel : décrivez l'utilité de ce serveur",url:"URL du serveur",apiKey:"Clé API",save:"Enregistrer",cancel:"Annuler",invalidConfig:"Impossible de trouver les données de configuration pour {{serverName}}",addError:"Échec de l'ajout du serveur",editError:"Échec de la modification du serveur {{serverName}}",deleteError:"Échec de la suppression du serveur {{serverName}}",updateError:"Échec de la mise à jour du serveur",editTitle:"Modifier le serveur : {{serverName}}",type:"Type de serveur",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"HTTP diffusable",typeOpenapi:"OpenAPI",command:"Commande",arguments:"Arguments",envVars:"Variables d'environnement",headers:"En-têtes HTTP",key:"clé",value:"valeur",enabled:"Activé",enable:"Activer",disable:"Désactiver",reload:"Recharger",reloadSuccess:"Serveur rechargé avec succès",reloadError:"Échec du rechargement du serveur {{serverName}}",requestOptions:"Configuration de la connexion",timeout:"Délai d'attente de la requête",timeoutDescription:"Délai d'attente pour les requêtes vers le serveur MCP (ms)",maxTotalTimeout:"Délai d'attente total maximum",maxTotalTimeoutDescription:"Délai d'attente total maximum pour les requêtes envoyées au serveur MCP (ms) (à utiliser avec les notifications de progression)",resetTimeoutOnProgress:"Réinitialiser le délai d'attente en cas de progression",resetTimeoutOnProgressDescription:"Réinitialiser le délai d'attente lors des notifications de progression (activé par défaut)",keepAlive:"Configuration du maintien de connexion",enableKeepAlive:"Activer le maintien de connexion",keepAliveDescription:"Envoyer des requêtes ping périodiques pour maintenir la connexion. Utile pour les connexions de longue durée qui peuvent expirer.",keepAliveInterval:"Intervalle (ms)",keepAliveIntervalDescription:"Temps entre les pings de maintien de connexion en millisecondes (par défaut : 60000ms = 1 minute)",remove:"Retirer",toggleError:"Échec du basculement du serveur {{serverName}}",alreadyExists:"Le serveur {{serverName}} existe déjà",invalidData:"Données de serveur invalides fournies",notFound:"Serveur {{serverName}} non trouvé",namePlaceholder:"Entrez le nom du serveur",urlPlaceholder:"Entrez l'URL du serveur",commandPlaceholder:"Entrez la commande",argumentsPlaceholder:"Entrez les arguments",errorDetails:"Détails de l'erreur",viewErrorDetails:"Voir les détails de l'erreur",copyConfig:"Copier la configuration",confirmVariables:"Confirmer la configuration des variables",variablesDetected:"Variables détectées dans la configuration. Veuillez confirmer que ces variables sont correctement configurées :",detectedVariables:"Variables détectées",confirmVariablesMessage:"Veuillez vous assurer que ces variables sont correctement définies dans votre environnement d'exécution. Continuer l'ajout du serveur ?",confirmAndAdd:"Confirmer et ajouter",openapi:{inputMode:"Mode de saisie",inputModeUrl:"URL de la spécification",inputModeSchema:"Schéma JSON",specUrl:"URL de la spécification OpenAPI",schema:"Schéma JSON OpenAPI",schemaHelp:"Collez votre schéma JSON OpenAPI complet ici",security:"Type de sécurité",securityNone:"Aucun",securityApiKey:"Clé API",securityHttp:"Authentification HTTP",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"Configuration de la clé API",apiKeyName:"Nom de l'en-tête/paramètre",apiKeyIn:"Emplacement",apiKeyValue:"Valeur de la clé API",httpAuthConfig:"Configuration de l'authentification HTTP",httpScheme:"Schéma d'authentification",httpCredentials:"Identifiants",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"Configuration OAuth 2.0",oauth2Token:"Jeton d'accès",openIdConnectConfig:"Configuration OpenID Connect",openIdConnectUrl:"URL de découverte",openIdConnectToken:"Jeton d'identification",apiKeyInHeader:"En-tête",apiKeyInQuery:"Requête",apiKeyInCookie:"Cookie",passthroughHeaders:"En-têtes de transmission",passthroughHeadersHelp:"Liste séparée par des virgules des noms d’en-têtes à transmettre des requêtes MCP entrantes vers les requêtes du serveur en amont (par ex. : Authorization, X-API-Key)"},oauth:{sectionTitle:"Configuration OAuth",sectionDescription:"Configurez les identifiants client pour les serveurs protégés par OAuth (optionnel).",clientId:"Identifiant client",clientSecret:"Secret client",authorizationEndpoint:"Point de terminaison d'autorisation",tokenEndpoint:"Point de terminaison de jeton",scopes:"Scopes",scopesPlaceholder:"scope1 scope2",resource:"Ressource / Audience",accessToken:"Jeton d'accès",refreshToken:"Jeton d'actualisation"}},Y4={online:"En ligne",offline:"Hors ligne",connecting:"Connexion en cours",oauthRequired:"OAuth requis",clickToAuthorize:"Cliquez pour autoriser avec OAuth",oauthWindowOpened:"Fenêtre d'autorisation OAuth ouverte. Veuillez compléter l'autorisation."},J4={general:"Une erreur est survenue",network:"Erreur de connexion réseau. Veuillez vérifier votre connexion Internet",serverConnection:"Impossible de se connecter au serveur. Veuillez vérifier si le serveur est en cours d'exécution",serverAdd:"Échec de l'ajout du serveur. Veuillez vérifier l'état du serveur",serverUpdate:"Échec de la modification du serveur {{serverName}}. Veuillez vérifier l'état du serveur",serverFetch:"Échec de la récupération des données du serveur. Veuillez réessayer plus tard",failedToReloadServer:"Échec du rechargement du serveur",initialStartup:"Le serveur est peut-être en cours de démarrage. Veuillez patienter un instant car ce processus peut prendre du temps au premier lancement...",serverInstall:"Échec de l'installation du serveur",failedToFetchSettings:"Échec de la récupération des paramètres",failedToUpdateRouteConfig:"Échec de la mise à jour de la configuration de routage",failedToUpdateSmartRoutingConfig:"Échec de la mise à jour de la configuration du routage intelligent"},Q4={processing:"En cours de traitement...",save:"Enregistrer",cancel:"Annuler",back:"Retour",refresh:"Actualiser",search:"Rechercher",clear:"Effacer",view:"Voir",create:"Créer",creating:"Création en cours...",update:"Mettre à jour",updating:"Mise à jour en cours...",submitting:"Envoi en cours...",delete:"Supprimer",remove:"Retirer",copy:"Copier",copyId:"Copier l'ID",copyUrl:"Copier l'URL",copyJson:"Copier le JSON",copySuccess:"Copié dans le presse-papiers",copyFailed:"Échec de la copie",copied:"Copié",close:"Fermer",confirm:"Confirmer",language:"Langue",true:"Vrai",false:"Faux",dismiss:"Rejeter",github:"GitHub",wechat:"WeChat",discord:"Discord",itemsPerPage:"Éléments par page",showing:"Affichage de {{start}}-{{end}} sur {{total}}",previous:"Précédent",next:"Suivant",required:"Requis",secret:"Secret",default:"Défaut",value:"Valeur",type:"Type",repeated:"Répété",valueHint:"Indice de valeur",choices:"Choix",actions:"Actions",saving:"Enregistrement...",active:"Actif",inactive:"Inactif"},X4={rowsPerPage:"Lignes par page",showing:"Affichage de {{from}}-{{to}} sur {{total}}"},Z4={dashboard:"Tableau de bord",servers:"Serveurs",groups:"Groupes",prompts:"Prompts",resources:"Ressources",users:"Utilisateurs",settings:"Paramètres",changePassword:"Changer le mot de passe",market:"Marché",cloud:"Marché Cloud",logs:"Journaux",activity:"Activité"},W4={dashboard:{title:"Tableau de bord",totalServers:"Total",onlineServers:"En ligne",disabledServers:"Désactivés",offlineServers:"Hors ligne",connectingServers:"En connexion",recentServers:"Serveurs récents"},servers:{title:"Gestion des serveurs"},groups:{title:"Gestion des groupes"},prompts:{title:"Prompts intégrés"},resources:{title:"Ressources intégrées"},users:{title:"Gestion des utilisateurs"},settings:{title:"Paramètres",language:"Langue",account:"Paramètres du compte",password:"Changer le mot de passe",appearance:"Apparence",routeConfig:"Sécurité",installConfig:"Installation",smartRouting:"Routage intelligent",oauthServer:"Serveur OAuth"},market:{title:"Marché Hub - Marchés locaux et Cloud"},logs:{title:"Journaux système"}},eC={filters:"Filtres",search:"Rechercher dans les journaux...",autoScroll:"Défilement automatique",clearLogs:"Effacer les journaux",loading:"Chargement des journaux...",noLogs:"Aucun journal disponible.",noMatch:"Aucun journal ne correspond aux filtres actuels.",mainProcess:"Processus principal",childProcess:"Processus enfant",main:"Principal",child:"Enfant"},tC={add:"Ajouter",addNew:"Ajouter un nouveau groupe",edit:"Modifier le groupe",delete:"Supprimer",confirmDelete:"Êtes-vous sûr de vouloir supprimer ce groupe ?",deleteWarning:"La suppression du groupe '{{name}}' le supprimera ainsi que toutes ses associations de serveurs. Cette action est irréversible.",name:"Nom du groupe",namePlaceholder:"Entrez le nom du groupe",nameRequired:"Le nom du groupe est requis",description:"Description",descriptionPlaceholder:"Entrez la description du groupe (facultatif)",createError:"Échec de la création du groupe",updateError:"Échec de la mise à jour du groupe",deleteError:"Échec de la suppression du groupe",serverAddError:"Échec de l'ajout du serveur au groupe",serverRemoveError:"Échec de la suppression du serveur du groupe",addServer:"Ajouter un serveur au groupe",selectServer:"Sélectionnez un serveur à ajouter",servers:"Serveurs dans le groupe",remove:"Retirer",noGroups:"Aucun groupe disponible. Créez un nouveau groupe pour commencer.",noServers:"Aucun serveur dans ce groupe.",noServerOptions:"Aucun serveur disponible",serverCount:"{{count}} serveurs",toolSelection:"Sélection d'outils",promptSelection:"Sélection des prompts",resourceSelection:"Sélection des ressources",toolsSelected:"Sélectionné",promptsSelected:"Sélectionné",resourcesSelected:"Sélectionné",allTools:"Tous",allPrompts:"Tous les prompts",allResources:"Toutes les ressources",selectedTools:"Outils sélectionnés",selectedPrompts:"Prompts sélectionnés",selectedResources:"Ressources sélectionnées",selectAll:"Tout sélectionner",selectNone:"Ne rien sélectionner",configureTools:"Configurer les outils",configureCapabilities:"Configurer les outils, prompts et ressources",previewPrompts:"[prompts : {{items}}]",previewResources:"[ressources : {{items}}]",previewAllTools:"(tous les outils)",previewAllPrompts:"(tous les prompts)",previewAllResources:"(toutes les ressources)"},rC={title:"Installation locale",official:"Officiel",by:"Par",unknown:"Inconnu",tools:"outils",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs par nom, catégorie ou tags",clearFilters:"Effacer",clearCategoryFilter:"",clearTagFilter:"",categories:"Catégories",tags:"Tags",showTags:"Afficher les tags",hideTags:"Masquer les tags",moreTags:"",noServers:"Aucun serveur trouvé correspondant à votre recherche",backToList:"Retour à la liste",install:"Installer",installing:"Installation en cours...",installed:"Installé",installServer:"Installer le serveur : {{name}}",installSuccess:"Serveur {{serverName}} installé avec succès",author:"Auteur",license:"Licence",repository:"Dépôt",examples:"Exemples",arguments:"Arguments",argumentName:"Nom",description:"Description",required:"Requis",example:"Exemple",viewSchema:"Voir le schéma",fetchError:"Erreur lors de la récupération des serveurs du marché",serverNotFound:"Serveur non trouvé",searchError:"Erreur lors de la recherche de serveurs",filterError:"Erreur lors du filtrage des serveurs par catégorie",tagFilterError:"Erreur lors du filtrage des serveurs par tag",noInstallationMethod:"Aucune méthode d'installation disponible pour ce serveur",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs",perPage:"Par page",confirmVariablesMessage:"Veuillez vous assurer que ces variables sont correctement définies dans votre environnement d'exécution. Continuer l'installation du serveur ?",confirmAndInstall:"Confirmer et installer"},aC={authorizeTitle:"Autoriser l'application",authorizeSubtitle:"Autorisez cette application à accéder à votre compte MCPHub.",buttons:{approve:"Autoriser l'accès",deny:"Refuser",approveSubtitle:"Recommandé si vous faites confiance à cette application.",denySubtitle:"Vous pourrez toujours accorder l'accès plus tard."}},sC={title:"Support Cloud",subtitle:"Propulsé par MCPRouter",by:"Par",server:"Serveur",config:"Config",created:"Créé",updated:"Mis à jour",available:"Disponible",description:"Description",details:"Détails",tools:"Outils",tool:"outil",toolsAvailable:"{{count}} outil disponible||{{count}} outils disponibles",loadingTools:"Chargement des outils...",noTools:"Aucun outil disponible pour ce serveur",noDescription:"Aucune description disponible",viewDetails:"Voir les détails",parameters:"Paramètres",result:"Résultat",error:"Erreur",callTool:"Appeler",calling:"Appel en cours...",toolCallSuccess:"L'outil {{toolName}} a été exécuté avec succès",toolCallError:"Échec de l'appel de l'outil {{toolName}} : {{error}}",viewSchema:"Voir le schéma",backToList:"Retour au marché Cloud",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs cloud par nom, titre ou auteur",clearFilters:"Effacer les filtres",clearCategoryFilter:"Effacer",clearTagFilter:"Effacer",categories:"Catégories",tags:"Tags",noCategories:"Aucune catégorie trouvée",noTags:"Aucun tag trouvé",noServers:"Aucun serveur cloud trouvé",fetchError:"Erreur lors de la récupération des serveurs cloud",serverNotFound:"Serveur cloud non trouvé",searchError:"Erreur lors de la recherche de serveurs cloud",filterError:"Erreur lors du filtrage des serveurs cloud par catégorie",tagFilterError:"Erreur lors du filtrage des serveurs cloud par tag",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs cloud",perPage:"Par page",apiKeyNotConfigured:"Clé API MCPRouter non configurée",apiKeyNotConfiguredDescription:"Pour utiliser les serveurs cloud, vous devez configurer votre clé API MCPRouter.",getApiKey:"Obtenir une clé API",configureInSettings:"Configurer dans les paramètres",installServer:"Installer {{name}}",installSuccess:"Serveur {{name}} installé avec succès",installError:"Échec de l'installation du serveur : {{error}}"},nC={title:"Registre",official:"Officiel",latest:"Dernière version",description:"Description",website:"Site web",repository:"Dépôt",packages:"Paquets",package:"paquet",remotes:"Services distants",remote:"service distant",published:"Publié",updated:"Mis à jour",install:"Installer",installing:"Installation...",installed:"Installé",installServer:"Installer {{name}}",installSuccess:"Serveur {{name}} installé avec succès",installError:"Échec de l'installation du serveur : {{error}}",noDescription:"Aucune description disponible",viewDetails:"Voir les détails",backToList:"Retour au registre",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs par nom",clearFilters:"Effacer",noServers:"Aucun serveur trouvé dans le registre",fetchError:"Erreur lors de la récupération des serveurs du registre",serverNotFound:"Serveur du registre non trouvé",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs du registre",perPage:"Par page",environmentVariables:"Variables d'environnement",packageArguments:"Arguments du paquet",runtimeArguments:"Arguments d'exécution",headers:"En-têtes"},lC={run:"Exécuter",running:"Exécution en cours...",runTool:"Exécuter l'outil",cancel:"Annuler",noDescription:"Aucune description disponible",inputSchema:"Schéma d'entrée :",runToolWithName:"Exécuter l'outil : {{name}}",execution:"Exécution de l'outil",successful:"Réussi",failed:"Échoué",result:"Résultat :",error:"Erreur",errorDetails:"Détails de l'erreur :",noContent:"L'outil a été exécuté avec succès mais n'a renvoyé aucun contenu.",unknownError:"Une erreur inconnue est survenue",jsonResponse:"Réponse JSON :",toolResult:"Résultat de l'outil",noParameters:"Cet outil ne nécessite aucun paramètre.",selectOption:"Sélectionnez une option",enterValue:"Entrez la valeur {{type}}",enabled:"Activé",enableSuccess:"Outil {{name}} activé avec succès",disableSuccess:"Outil {{name}} désactivé avec succès",toggleFailed:"Échec du basculement de l'état de l'outil",descriptionUpdateSuccess:"Description de l'outil mise à jour avec succès",descriptionUpdateFailed:"Échec de la mise à jour de la description de l'outil",restoreDefault:"Restaurer par défaut",restoreDefaultSuccess:"La description de l'outil a été restaurée à sa valeur par défaut",restoreDefaultFailed:"Échec de la restauration de la description par défaut de l'outil",parameters:"Paramètres de l'outil",formMode:"Mode formulaire",jsonMode:"Mode JSON",jsonConfiguration:"Configuration JSON",invalidJsonFormat:"Format JSON invalide",fixJsonBeforeSwitching:"Veuillez corriger le format JSON avant de passer en mode formulaire",item:"Élément {{index}}",addItem:"Ajouter un élément {{key}}",enterKey:"Entrez {{key}}"},iC={run:"Obtenir",running:"Obtention en cours...",result:"Résultat de l'invite",error:"Erreur de l'invite",execution:"Exécution de l'invite",successful:"Réussi",failed:"Échoué",errorDetails:"Détails de l'erreur :",noContent:"L'invite a été exécutée avec succès mais n'a renvoyé aucun contenu.",unknownError:"Une erreur inconnue est survenue",jsonResponse:"Réponse JSON :",description:"Description",messages:"Messages",noDescription:"Aucune description disponible",runPromptWithName:"Obtenir l'invite : {{name}}",descriptionUpdateSuccess:"Description de l'invite mise à jour avec succès",descriptionUpdateFailed:"Échec de la mise à jour de la description de l'invite",restoreDefault:"Restaurer par défaut",restoreDefaultSuccess:"La description de l'invite a été restaurée à sa valeur par défaut",restoreDefaultFailed:"Échec de la restauration de la description par défaut de l'invite"},oC=JSON.parse(`{"enableGlobalRoute":"Activer la route globale","enableGlobalRouteDescription":"Autoriser les connexions au point de terminaison /sse sans spécifier d'ID de groupe","enableGroupNameRoute":"Activer la route par nom de groupe","enableGroupNameRouteDescription":"Autoriser les connexions au point de terminaison /sse en utilisant les noms de groupe au lieu des ID de groupe","enableBearerAuth":"Activer l'authentification Bearer","enableBearerAuthDescription":"Exiger une authentification par jeton Bearer pour les points de terminaison MCP (activé par défaut)","bearerAuthKey":"Clé d'authentification Bearer","bearerAuthKeyDescription":"La clé d'authentification qui sera requise dans le jeton Bearer","bearerAuthKeyPlaceholder":"Entrez la clé d'authentification Bearer","bearerAuthHeaderName":"Nom de l'en-tête Bearer","bearerAuthHeaderNameDescription":"Nom de l'en-tête utilisé pour recevoir les identifiants Bearer MCP. Modifiez-le si les en-têtes transmis en amont utilisent aussi Authorization.","bearerAuthHeaderNamePlaceholder":"ex. Authorization ou X-MCP-Authorization","bearerKeysSectionTitle":"Clés","bearerKeysSectionDescription":"Gérez plusieurs clés avec différentes portées d’accès.","noBearerKeys":"Aucune clé configurée pour le moment.","bearerKeyName":"Nom","bearerKeyToken":"Jeton","bearerKeyEnabled":"Activée","bearerKeyAccessType":"Portée d’accès","bearerKeyAccessAll":"Toutes","bearerKeyAccessGroups":"Groupes","bearerKeyAccessServers":"Serveurs","bearerKeyAccessCustom":"Personnalisée","bearerKeyAllowedGroups":"Groupes autorisés","bearerKeyAllowedServers":"Serveurs autorisés","addBearerKey":"Ajouter une clé","addBearerKeyButton":"Créer","bearerKeyRequired":"Le nom et le jeton sont obligatoires","deleteBearerKeyConfirm":"Voulez-vous vraiment supprimer cette clé ?","generate":"Générer","selectGroups":"Sélectionner des groupes","selectServers":"Sélectionner des serveurs","selectAtLeastOneGroup":"Veuillez sélectionner au moins un groupe","selectAtLeastOneServer":"Veuillez sélectionner au moins un serveur","skipAuth":"Ignorer l'authentification","skipAuthDescription":"Autoriser l'accès au tableau de bord sans connexion ; les utilisateurs non authentifiés obtiennent un accès administrateur guest (n'affecte pas l'auth MCP)","jsonBodyLimit":"Limite de taille du corps JSON","jsonBodyLimitDescription":"Limite de taille des requêtes JSON Express. Les gros téléchargements de schémas OpenAPI utilisent aussi ce paramètre.","jsonBodyLimitPlaceholder":"ex. 1mb, 5mb, 1024kb","pythonIndexUrl":"URL du dépôt de paquets Python","pythonIndexUrlDescription":"Définir la variable d'environnement UV_DEFAULT_INDEX pour l'installation de paquets Python","pythonIndexUrlPlaceholder":"ex. https://pypi.org/simple","npmRegistry":"URL du registre NPM","npmRegistryDescription":"Définir la variable d'environnement npm_config_registry pour l'installation de paquets NPM","npmRegistryPlaceholder":"ex. https://registry.npmjs.org/","baseUrl":"URL de base","baseUrlDescription":"URL de base pour les requêtes MCP et les callbacks OAuth","baseUrlPlaceholder":"ex. http://localhost:3000","installConfig":"Installation","systemConfigUpdated":"Configuration système mise à jour avec succès","enableSmartRouting":"Activer le routage intelligent","enableSmartRoutingDescription":"Activer la fonctionnalité de routage intelligent pour rechercher l'outil le plus approprié en fonction de l'entrée (en utilisant le nom de groupe $smart)","dbUrl":"URL PostgreSQL (nécessite le support de pgvector)","dbUrlPlaceholder":"ex. postgresql://user:password@localhost:5432/dbname","embeddingProvider":"Fournisseur d'embeddings","openaiApiBaseUrl":"URL de base compatible OpenAI","openaiApiBaseUrlPlaceholder":"https://api.openai.com/v1","openaiApiKey":"Clé API du fournisseur LLM","openaiApiKeyPlaceholder":"Entrez la clé API du fournisseur LLM","openaiApiEmbeddingModel":"Nom du modèle d'intégration","openaiApiEmbeddingModelPlaceholder":"text-embedding-3-small","basePacingDelayMs":"Délai de pacing de base (ms)","basePacingDelayMsDescription":"Délai de base entre les requêtes d'embeddings envoyées au fournisseur. Par défaut 0 — le système gère les limites de débit automatiquement : il respecte les en-têtes Retry-After, applique un délai de 63 secondes en l'absence d'en-tête, et augmente le pacing après chaque réponse 403/429. Définissez une valeur non nulle uniquement si votre fournisseur impose un intervalle minimum fixe.","basePacingDelayMsPlaceholder":"Vide = valeur par défaut 0 ms","basePacingDelayMsAuto":"Par défaut ({{value}} ms) : la gestion des limites de débit est automatique.","basePacingDelayMsZero":"0 ms (par défaut) : la gestion des limites de débit est automatique via throttling adaptatif et logique de retry.","basePacingDelayMsOverride":"Valeur personnalisée : remplace le délai de pacing de base par défaut.","embeddingEncodingFormat":"Format d'encodage des embeddings","embeddingEncodingFormatDescription":"Format d'encodage pour les vecteurs d'embedding. Auto détectera en fonction du support du fournisseur.","embeddingEncodingFormatAuto":"Auto (Recommandé)","azureOpenaiEndpoint":"Point de terminaison Azure OpenAI","azureOpenaiEndpointPlaceholder":"https://VOTRE_NOM_DE_RESSOURCE.openai.azure.com","azureOpenaiApiKey":"Clé API Azure OpenAI","azureOpenaiApiKeyPlaceholder":"Entrez la clé API Azure OpenAI","azureOpenaiApiVersion":"Version de l'API Azure OpenAI","azureOpenaiApiVersionPlaceholder":"2024-02-15-preview","azureOpenaiEmbeddingDeployment":"Déploiement d'embeddings Azure OpenAI","azureOpenaiEmbeddingDeploymentPlaceholder":"text-embedding-3-small","azureOpenaiEmbeddingModel":"Nom du modèle d'embedding Azure","azureOpenaiEmbeddingModelDescription":"Le nom réel du modèle OpenAI déployé dans Azure (ex. text-embedding-3-small). Utilisé pour le comptage précis des tokens avant l'envoi à l'API.","azureOpenaiEmbeddingModelPlaceholder":"text-embedding-3-small","smartRoutingConfigUpdated":"Configuration du routage intelligent mise à jour avec succès","progressiveDisclosure":"Divulgation progressive","progressiveDisclosureDescription":"Lorsqu'elle est activée, search_tools renvoie uniquement les noms et descriptions des outils. Utilisez describe_tool pour obtenir le schéma complet des paramètres, réduisant ainsi l'utilisation des tokens.","embeddingMaxTokens":"Tokens max pour les embeddings","embeddingMaxTokensDescription":"Nombre maximum de tokens pour la troncature du texte avant la génération des embeddings. Laissez vide pour utiliser automatiquement la valeur par défaut du modèle. Une valeur personnalisée remplace toujours la valeur par défaut du modèle. La configuration manuelle de cette valeur est particulièrement utile lors de l'utilisation de fournisseurs LLM locaux pour éviter les erreurs de troncature.","embeddingMaxTokensPlaceholder":"Vide = automatique selon le modèle","embeddingMaxTokensAuto":"Auto : {{limit}} tokens (valeur par défaut du modèle {{model}})","embeddingMaxTokensOverride":"Cette valeur remplace la valeur par défaut du modèle.","smartRoutingRequiredFields":"L'URL de la base de données est requise pour activer le routage intelligent. Une clé API du fournisseur LLM est requise pour les fournisseurs cloud (les LLM locaux ne nécessitent généralement pas de clé API, entrez n'importe quelle valeur pour passer la validation du formulaire)","smartRoutingValidationError":"Veuillez remplir les champs obligatoires avant d'activer le routage intelligent : {{fields}}","mcpRouterConfig":"Marché Cloud","mcpRouterApiKey":"Clé API MCPRouter","mcpRouterApiKeyDescription":"Clé API pour accéder aux services du marché cloud MCPRouter","mcpRouterApiKeyPlaceholder":"Entrez la clé API MCPRouter","mcpRouterReferer":"Référent","mcpRouterRefererDescription":"En-tête Referer pour les requêtes API MCPRouter","mcpRouterRefererPlaceholder":"https://www.mcphub.app","mcpRouterTitle":"Titre","mcpRouterTitleDescription":"En-tête Title pour les requêtes API MCPRouter","mcpRouterTitlePlaceholder":"MCPHub","mcpRouterBaseUrl":"URL de base","mcpRouterBaseUrlDescription":"URL de base pour l'API MCPRouter","mcpRouterBaseUrlPlaceholder":"https://api.mcprouter.to/v1","systemSettings":"Paramètres système","nameSeparatorLabel":"Séparateur de noms","nameSeparatorDescription":"Caractère utilisé pour séparer le nom du serveur et le nom de l'outil/prompt (par défaut : -)","enableSessionRebuild":"Activer la reconstruction de session serveur","enableSessionRebuildDescription":"Lorsqu'il est activé, applique le code de reconstruction de session serveur amélioré pour une meilleure expérience de gestion de session","restartRequired":"Configuration enregistrée. Il est recommandé de redémarrer l'application pour s'assurer que tous les services chargent correctement les nouveaux paramètres.","exportMcpSettings":"Exporter les paramètres","mcpSettingsJson":"JSON des paramètres MCP","mcpSettingsJsonDescription":"Afficher, copier ou télécharger votre configuration mcp_settings.json actuelle pour la sauvegarde ou la migration vers d'autres outils","copyToClipboard":"Copier dans le presse-papiers","downloadJson":"Télécharger JSON","exportSuccess":"Paramètres exportés avec succès","exportError":"Échec de la récupération des paramètres","enableOauthServer":"Activer le serveur OAuth","enableOauthServerDescription":"Permet à MCPHub d'émettre des jetons OAuth pour les clients externes","requireClientSecret":"Exiger un secret client","requireClientSecretDescription":"Lorsque activé, les clients confidentiels doivent présenter un client secret (désactivez-le pour les clients PKCE publics)","requireState":"Exiger le paramètre state","requireStateDescription":"Refuser les demandes d'autorisation qui n'incluent pas le paramètre state","accessTokenLifetime":"Durée de vie du jeton d'accès (secondes)","accessTokenLifetimeDescription":"Durée pendant laquelle les jetons d'accès émis restent valides","accessTokenLifetimePlaceholder":"ex. 3600","refreshTokenLifetime":"Durée de vie du jeton d'actualisation (secondes)","refreshTokenLifetimeDescription":"Durée pendant laquelle les jetons d'actualisation restent valides","refreshTokenLifetimePlaceholder":"ex. 1209600","authorizationCodeLifetime":"Durée de vie du code d'autorisation (secondes)","authorizationCodeLifetimeDescription":"Temps pendant lequel les codes d'autorisation peuvent être échangés","authorizationCodeLifetimePlaceholder":"ex. 300","allowedScopes":"Scopes autorisés","allowedScopesDescription":"Liste séparée par des virgules des scopes que les utilisateurs peuvent approuver","allowedScopesPlaceholder":"ex. read, write","enableDynamicRegistration":"Activer l'enregistrement dynamique","dynamicRegistrationDescription":"Autoriser les clients conformes RFC 7591 à s'enregistrer via l'endpoint public","dynamicRegistrationAllowedGrantTypes":"Types de flux autorisés","dynamicRegistrationAllowedGrantTypesDescription":"Liste séparée par des virgules des types de flux disponibles pour les clients enregistrés dynamiquement","dynamicRegistrationAllowedGrantTypesPlaceholder":"ex. authorization_code, refresh_token","dynamicRegistrationAuth":"Exiger une authentification","dynamicRegistrationAuthDescription":"Protège l'endpoint d'enregistrement afin que seules les requêtes authentifiées puissent créer des clients","invalidNumberInput":"Veuillez saisir un nombre valide supérieur ou égal à zéro"}`),cC={upload:"Télécharger",uploadTitle:"Télécharger le bundle MCPB",dropFileHere:"Déposez votre fichier .mcpb ici",orClickToSelect:"ou cliquez pour sélectionner depuis votre ordinateur",invalidFileType:"Veuillez sélectionner un fichier .mcpb valide",noFileSelected:"Veuillez sélectionner un fichier .mcpb à télécharger",uploading:"Téléchargement en cours...",uploadFailed:"Échec du téléchargement du fichier MCPB",installServer:"Installer le serveur MCP depuis MCPB",extensionInfo:"Informations sur l'extension",name:"Nom",version:"Version",description:"Description",author:"Auteur",tools:"Outils",serverName:"Nom du serveur",serverNamePlaceholder:"Entrez un nom pour ce serveur",install:"Installer",installing:"Installation en cours...",installFailed:"Échec de l'installation du serveur depuis MCPB",serverExistsTitle:"Le serveur existe déjà",serverExistsConfirm:"Le serveur '{{serverName}}' existe déjà. Voulez-vous le remplacer par la nouvelle version ?",override:"Remplacer"},uC={button:"Importer",title:"Importer des serveurs depuis JSON",inputLabel:"Configuration JSON du serveur",inputHelp:"Collez votre configuration JSON de serveur. Prend en charge les types de serveurs STDIO, SSE et HTTP (streamable-http).",preview:"Aperçu",previewTitle:"Aperçu des serveurs à importer",import:"Importer",importing:"Importation en cours...",invalidFormat:"Format JSON invalide. Le JSON doit contenir un objet 'mcpServers'.",parseError:"Échec de l'analyse du JSON. Veuillez vérifier le format et réessayer.",addFailed:"Échec de l'ajout du serveur",importFailed:"Échec de l'importation des serveurs",partialSuccess:"{{count}} serveur(s) sur {{total}} importé(s) avec succès. Certains serveurs ont échoué :"},dC={button:"Importer",title:"Importer des groupes depuis JSON",inputLabel:"Configuration JSON des groupes",inputHelp:"Collez votre configuration JSON de groupes. Chaque groupe peut contenir une liste de serveurs.",preview:"Aperçu",previewTitle:"Aperçu des groupes à importer",import:"Importer",importing:"Importation en cours...",invalidFormat:"Format JSON invalide. Le JSON doit contenir un tableau 'groups'.",missingName:"Chaque groupe doit avoir un champ 'name'.",parseError:"Échec de l'analyse du JSON. Veuillez vérifier le format et réessayer.",addFailed:"Échec de l'ajout du groupe",importFailed:"Échec de l'importation des groupes",partialSuccess:"{{count}} groupe(s) sur {{total}} importé(s) avec succès. Certains groupes ont échoué :"},mC={add:"Ajouter un utilisateur",addNew:"Ajouter un nouvel utilisateur",edit:"Modifier l'utilisateur",delete:"Supprimer l'utilisateur",create:"Créer un utilisateur",update:"Mettre à jour l'utilisateur",username:"Nom d'utilisateur",password:"Mot de passe",newPassword:"Nouveau mot de passe",confirmPassword:"Confirmer le mot de passe",changePassword:"Changer le mot de passe",adminRole:"Administrateur",admin:"Admin",user:"Utilisateur",role:"Rôle",actions:"Actions",addFirst:"Ajoutez votre premier utilisateur",permissions:"Permissions",adminPermissions:"Accès complet au système",userPermissions:"Accès limité",currentUser:"Vous",noUsers:"Aucun utilisateur trouvé",adminRequired:"Un accès administrateur est requis pour gérer les utilisateurs",usernameRequired:"Le nom d'utilisateur est requis",passwordRequired:"Le mot de passe est requis",passwordTooShort:"Le mot de passe doit comporter au moins 6 caractères",passwordMismatch:"Les mots de passe ne correspondent pas",usernamePlaceholder:"Entrez le nom d'utilisateur",passwordPlaceholder:"Entrez le mot de passe",newPasswordPlaceholder:"Laissez vide pour conserver le mot de passe actuel",confirmPasswordPlaceholder:"Confirmez le nouveau mot de passe",createError:"Échec de la création de l'utilisateur",updateError:"Échec de la mise à jour de l'utilisateur",deleteError:"Échec de la suppression de l'utilisateur",statsError:"Échec de la récupération des statistiques utilisateur",deleteConfirmation:"Êtes-vous sûr de vouloir supprimer l'utilisateur '{{username}}' ? Cette action est irréversible.",confirmDelete:"Supprimer l'utilisateur",deleteWarning:"Êtes-vous sûr de vouloir supprimer l'utilisateur '{{username}}' ? Cette action est irréversible."},pC={errors:{readonly:"Lecture seule pour l'environnement de démonstration",invalid_credentials:"Nom d'utilisateur ou mot de passe invalide",serverNameRequired:"Le nom du serveur est requis",serverConfigRequired:"La configuration du serveur est requise",serverConfigInvalid:"La configuration du serveur doit inclure une URL, une URL de spécification OpenAPI ou un schéma, ou une commande avec des arguments",serverTypeInvalid:"Le type de serveur doit être l'un des suivants : stdio, sse, streamable-http, openapi",urlRequiredForType:"L'URL est requise pour le type de serveur {{type}}",openapiSpecRequired:"L'URL de la spécification OpenAPI ou le schéma est requis pour le type de serveur openapi",headersInvalidFormat:"Les en-têtes doivent être un objet",headersNotSupportedForStdio:"Les en-têtes ne sont pas pris en charge pour le type de serveur stdio",serverNotFound:"Serveur non trouvé",failedToRemoveServer:"Serveur non trouvé ou échec de la suppression",internalServerError:"Erreur interne du serveur",failedToGetServers:"Échec de la récupération des informations sur les serveurs",failedToGetServerSettings:"Échec de la récupération des paramètres du serveur",failedToGetServerConfig:"Échec de la récupération de la configuration du serveur",failedToSaveSettings:"Échec de l'enregistrement des paramètres",toolNameRequired:"Le nom du serveur et le nom de l'outil sont requis",descriptionMustBeString:"La description doit être une chaîne de caractères",groupIdRequired:"L'ID de groupe est requis",groupNameRequired:"Le nom du groupe est requis",groupNotFound:"Groupe non trouvé",groupIdAndServerNameRequired:"L'ID de groupe和le nom du serveur sont requis",groupOrServerNotFound:"Groupe ou serveur non trouvé",toolsMustBeAllOrArray:'Les outils doivent être "all" ou un tableau de chaînes de caractères',serverNameAndToolNameRequired:"Le nom du serveur et le nom de l'outil sont requis",usernameRequired:"Le nom d'utilisateur est requis",userNotFound:"Utilisateur non trouvé",failedToGetUsers:"Échec de la récupération des informations sur les utilisateurs",failedToGetUserInfo:"Échec de la récupération des informations sur l'utilisateur",failedToGetUserStats:"Échec de la récupération des statistiques de l'utilisateur",marketServerNameRequired:"Le nom du serveur du marché est requis",marketServerNotFound:"Serveur du marché non trouvé",failedToGetMarketServers:"Échec de la récupération des informations sur les serveurs du marché",failedToGetMarketServer:"Échec de la récupération des informations sur le serveur du marché",failedToGetMarketCategories:"Échec de la récupération des catégories du marché",failedToGetMarketTags:"Échec de la récupération des tags du marché",failedToSearchMarketServers:"Échec de la recherche des serveurs du marché",failedToFilterMarketServers:"Échec du filtrage des serveurs du marché",failedToProcessMcpbFile:"Échec du traitement du fichier MCPB"},success:{serverCreated:"Serveur créé avec succès",serverUpdated:"Serveur mis à jour avec succès",serverRemoved:"Serveur supprimé avec succès",serverToggled:"État du serveur basculé avec succès",toolToggled:"Outil {{name}} {{action}} avec succès",toolDescriptionUpdated:"Description de l'outil {{name}} mise à jour avec succès",systemConfigUpdated:"Configuration système mise à jour avec succès",groupCreated:"Groupe créé avec succès",groupUpdated:"Groupe mis à jour avec succès",groupDeleted:"Groupe supprimé avec succès",serverAddedToGroup:"Serveur ajouté au groupe avec succès",serverRemovedFromGroup:"Serveur supprimé du groupe avec succès",serverToolsUpdated:"Outils du serveur mis à jour avec succès"}},gC={authorizationFailed:"Échec de l'autorisation",authorizationFailedError:"Erreur",authorizationFailedDetails:"Détails",invalidRequest:"Requête invalide",missingStateParameter:"Paramètre d'état OAuth requis manquant.",missingCodeParameter:"Paramètre de code d'autorisation requis manquant.",serverNotFound:"Serveur introuvable",serverNotFoundMessage:"Impossible de trouver le serveur associé à cette demande d'autorisation.",sessionExpiredMessage:"La session d'autorisation a peut-être expiré. Veuillez réessayer l'autorisation.",authorizationSuccessful:"Autorisation réussie",server:"Serveur",status:"État",connected:"Connecté",successMessage:"Le serveur a été autorisé et connecté avec succès.",autoCloseMessage:"Cette fenêtre se fermera automatiquement dans 3 secondes...",closeNow:"Fermer maintenant",connectionError:"Erreur de connexion",connectionErrorMessage:"L'autorisation a réussi, mais la connexion au serveur a échoué.",reconnectMessage:"Veuillez essayer de vous reconnecter à partir du tableau de bord.",configurationError:"Erreur de configuration",configurationErrorMessage:"Le transport du serveur ne prend pas en charge OAuth finishAuth(). Veuillez vous assurer que le serveur est configuré avec le transport streamable-http.",internalError:"Erreur interne",internalErrorMessage:"Une erreur inattendue s'est produite lors du traitement du callback OAuth.",closeWindow:"Fermer la fenêtre"},fC={add:"Ajouter un prompt",addNew:"Ajouter un nouveau prompt",edit:"Modifier le prompt",delete:"Supprimer",noPrompts:"Aucun prompt intégré configuré",addFirst:"Ajoutez votre premier prompt",name:"Nom",namePlaceholder:"ex. code-review",title:"Titre",titlePlaceholder:"ex. Prompt de revue de code",description:"Description",descriptionPlaceholder:"Brève description du prompt",template:"Modèle",templatePlaceholder:"Entrez le texte du modèle avec des marqueurs {{paramètre}}...",templateHint:"Utilisez {{paramName}} pour les paramètres du modèle",arguments:"Arguments",addArgument:"Ajouter un argument",argName:"Nom",argDescription:"Description",argRequired:"Requis",enabled:"Activé",active:"Actif",inactive:"Inactif",nameRequired:"Le nom est requis",templateRequired:"Le modèle est requis",fetchError:"Échec du chargement des prompts intégrés",createError:"Échec de la création du prompt",updateError:"Échec de la mise à jour du prompt",deleteError:"Échec de la suppression du prompt",saveError:"Échec de l'enregistrement du prompt",confirmDelete:"Supprimer le prompt",deleteWarning:'Êtes-vous sûr de vouloir supprimer le prompt "{{name}}" ? Cette action est irréversible.'},hC={add:"Ajouter une ressource",addNew:"Ajouter une nouvelle ressource",edit:"Modifier la ressource",delete:"Supprimer",noResources:"Aucune ressource intégrée configurée",addFirst:"Ajoutez votre première ressource",uri:"URI",uriPlaceholder:"ex. resource://docs/guide",name:"Nom",namePlaceholder:"ex. Guide utilisateur",description:"Description",descriptionPlaceholder:"Brève description de la ressource",mimeType:"Type MIME",content:"Contenu",contentPlaceholder:"Entrez le contenu de la ressource...",enabled:"Activé",active:"Actif",inactive:"Inactif",descriptionUpdateSuccess:"Description de la ressource mise à jour avec succès",descriptionUpdateFailed:"Échec de la mise à jour de la description de la ressource",restoreDefault:"Restaurer par défaut",restoreDefaultSuccess:"La description de la ressource a été restaurée à sa valeur par défaut",restoreDefaultFailed:"Échec de la restauration de la description par défaut de la ressource",uriRequired:"L'URI est requis",contentRequired:"Le contenu est requis",fetchError:"Échec du chargement des ressources intégrées",createError:"Échec de la création de la ressource",updateError:"Échec de la mise à jour de la ressource",deleteError:"Échec de la suppression de la ressource",saveError:"Échec de l'enregistrement de la ressource",confirmDelete:"Supprimer la ressource",deleteWarning:'Êtes-vous sûr de vouloir supprimer la ressource "{{name}}" ? Cette action est irréversible.'},xC={title:"Activité",totalCalls:"Total des appels",successCount:"Réussites",errorCount:"Échecs",avgDuration:"Durée moyenne",timestamp:"Horodatage",server:"Serveur",tool:"Outil",duration:"Durée",status:"Statut",group:"Groupe",key:"Clé API",input:"Entrée",output:"Sortie",details:"Détails de l’activité",errorMessage:"Message d’erreur",searchServer:"Serveur...",searchTool:"Outil...",searchStatus:"Statut...",searchGroup:"Groupe...",searchKeyName:"Clé API...",keyName:"Nom de la clé API",allStatus:"Tous les statuts",statusSuccess:"Succès",statusError:"Erreur",noData:"Aucune activité disponible",fetchError:"Impossible de charger les données d’activité",cleanup:"Nettoyer",confirmCleanup:"Voulez-vous vraiment supprimer les activités de plus de 30 jours ?",cleanupSuccess:"{{count}} anciennes activités supprimées",cleanupError:"Échec du nettoyage des anciennes activités",notAvailable:"Le suivi des activités est disponible uniquement en mode base de données"},yC={exportButton:"Exporter le modèle",importButton:"Importer le modèle",exportTitle:"Exporter le modèle de configuration",importTitle:"Importer le modèle de configuration",name:"Nom du modèle",nameRequired:"Le nom du modèle est requis",namePlaceholder:"Ex. : Outils de développement frontend",description:"Description",descriptionPlaceholder:"Ex. : Serveurs MCP standards pour le développement frontend",selectGroups:"Sélectionner les groupes",selectGroupsHelp:"Laisser vide pour exporter tous les groupes",selectAll:"Tout sélectionner",deselectAll:"Tout désélectionner",includeDisabled:"Inclure les serveurs désactivés",exportNote:"Les secrets (clés API, tokens, mots de passe) seront remplacés par des références ${PLACEHOLDER}. Les destinataires devront fournir leurs propres identifiants.",export:"Exporter",exporting:"Exportation...",exportFailed:"Échec de l'exportation du modèle",import:"Importer",importing:"Importation...",importFailed:"Échec de l'importation du modèle",invalidFormat:"Format de modèle invalide. Doit contenir les champs version, name, servers et groups.",parseError:"Échec de l'analyse JSON. Veuillez vérifier le format et réessayer.",uploadFile:"Télécharger le fichier modèle",or:"ou",pasteJson:"Coller le JSON du modèle",pastePlaceholder:"Collez le contenu de votre fichier .mcphub-template.json ici...",version:"Version",createdAt:"Créé le",servers:"Serveurs",groups:"Groupes",serversInGroup:"serveur(s)",envVarsNeeded:"Variables d'environnement requises — définissez-les avant d'utiliser les serveurs importés :",importResult:"Serveurs : {{serversCreated}} créés, {{serversSkipped}} ignorés. Groupes : {{groupsCreated}} créés, {{groupsSkipped}} ignorés."},bC={app:B4,about:I4,profile:F4,sponsor:H4,wechat:q4,discord:G4,theme:K4,auth:V4,server:$4,status:Y4,errors:J4,common:Q4,pagination:X4,nav:Z4,pages:W4,logs:eC,groups:tC,market:rC,oauthServer:aC,cloud:sC,registry:nC,tool:lC,prompt:iC,settings:oC,mcpb:cC,jsonImport:uC,groupImport:dC,users:mC,api:pC,oauthCallback:gC,builtinPrompts:fC,builtinResources:hC,activity:xC,template:yC},vC={title:"MCPHub Kontrol Paneli",error:"Hata",closeButton:"Kapat",noServers:"Kullanılabilir MCP sunucusu yok",loading:"Yükleniyor...",logout:"Çıkış Yap",profile:"Profil",changePassword:"Şifre Değiştir",toggleSidebar:"Kenar Çubuğunu Aç/Kapat",welcomeUser:"Hoş geldin, {{username}}",name:"MCPHub",embeddingSyncProgress:"{{serverName}} için gömme oluşturuluyor",embeddingSyncProgressAriaLabel:"{{serverName}} için gömme oluşturuluyor: {{total}} adımdan {{current}} tamamlandı"},wC={title:"Hakkında",versionInfo:"MCPHub Sürümü: {{version}}",newVersion:"Yeni sürüm mevcut!",currentVersion:"Mevcut sürüm",newVersionAvailable:"Yeni sürüm {{version}} mevcut",viewOnGitHub:"GitHub'da Görüntüle",checkForUpdates:"Güncellemeleri Kontrol Et",checking:"Güncellemeler kontrol ediliyor..."},jC={viewProfile:"Profili görüntüle",userCenter:"Kullanıcı Merkezi"},SC={label:"Sponsor",title:"Projeyi Destekle",rewardAlt:"Ödül QR Kodu",supportMessage:"Bana bir kahve ısmarlayarak MCPHub'ın geliştirilmesini destekleyin!",supportButton:"Ko-fi'de Destek Ol"},NC={label:"WeChat",title:"WeChat ile Bağlan",qrCodeAlt:"WeChat QR Kodu",scanMessage:"WeChat'te bizimle bağlantı kurmak için bu QR kodunu tarayın"},kC={label:"Discord",title:"Discord sunucumuza katılın",community:"Destek, tartışmalar ve güncellemeler için büyüyen Discord topluluğumuza katılın!"},CC={title:"Tema",light:"Açık",dark:"Koyu",system:"Sistem"},AC={login:"Giriş Yap",loginTitle:"MCPHub'a Giriş Yap",slogan:"Birleşik MCP sunucu yönetim platformu",subtitle:"Model Context Protocol sunucuları için merkezi yönetim platformu. Esnek yönlendirme stratejileri ile birden fazla MCP sunucusunu organize edin, izleyin ve ölçeklendirin.",username:"Kullanıcı Adı",password:"Şifre",loggingIn:"Giriş yapılıyor...",orContinue:"Veya şununla devam et",loginWithGoogle:"Google ile devam et",loginWithGithub:"GitHub ile devam et",socialLoginFailed:"Sosyal giriş başarısız oldu. Lütfen tekrar deneyin.",emptyFields:"Kullanıcı adı ve şifre boş olamaz",loginFailed:"Giriş başarısız, lütfen kullanıcı adınızı ve şifrenizi kontrol edin",loginError:"Giriş sırasında bir hata oluştu",serverUnavailable:"Sunucuya bağlanılamıyor. Lütfen ağ bağlantınızı kontrol edin veya daha sonra tekrar deneyin",currentPassword:"Mevcut Şifre",newPassword:"Yeni Şifre",confirmPassword:"Şifreyi Onayla",passwordsNotMatch:"Yeni şifre ve onay eşleşmiyor",changePasswordSuccess:"Şifre başarıyla değiştirildi",changePasswordError:"Şifre değişikliği başarısız oldu",changePassword:"Şifre Değiştir",passwordChanged:"Şifre başarıyla değiştirildi",passwordChangeError:"Şifre değişikliği başarısız oldu",defaultPasswordWarning:"Varsayılan Şifre Güvenlik Uyarısı",defaultPasswordMessage:"Varsayılan şifreyi (admin123) kullanıyorsunuz, bu bir güvenlik riski oluşturur. Hesabınızı korumak için lütfen şifrenizi hemen değiştirin.",goToSettings:"Ayarlara Git",passwordStrengthError:"Şifre güvenlik gereksinimlerini karşılamıyor",passwordMinLength:"Şifre en az 8 karakter uzunluğunda olmalıdır",passwordRequireLetter:"Şifre en az bir harf içermelidir",passwordRequireNumber:"Şifre en az bir rakam içermelidir",passwordRequireSpecial:"Şifre en az bir özel karakter içermelidir",passwordStrengthHint:"Şifre en az 8 karakter olmalı ve harf, rakam ve özel karakter içermelidir"},EC={addServer:"Sunucu Ekle",add:"Ekle",edit:"Düzenle",copy:"Kopyala",delete:"Sil",confirmDelete:"Bu sunucuyu silmek istediğinizden emin misiniz?",deleteWarning:"'{{name}}' sunucusunu silmek, onu ve tüm verilerini kaldıracaktır. Bu işlem geri alınamaz.",status:"Durum",tools:"Araçlar",prompts:"İstekler",name:"Sunucu Adı",description:"Sunucu Notu",descriptionPlaceholder:"İsteğe bağlı: Bu sunucunun ne işe yaradığını yazın",url:"Sunucu URL'si",apiKey:"API Anahtarı",save:"Kaydet",cancel:"İptal",invalidConfig:"{{serverName}} için yapılandırma verisi bulunamadı",addError:"Sunucu eklenemedi",editError:"{{serverName}} sunucusu düzenlenemedi",deleteError:"{{serverName}} sunucusu silinemedi",updateError:"Sunucu güncellenemedi",editTitle:"Sunucuyu Düzenle: {{serverName}}",type:"Sunucu Türü",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"Akış Yapılabilir HTTP",typeOpenapi:"OpenAPI",command:"Komut",arguments:"Argümanlar",envVars:"Ortam Değişkenleri",headers:"HTTP Başlıkları",key:"anahtar",value:"değer",enabled:"Etkin",enable:"Etkinleştir",disable:"Devre Dışı Bırak",reload:"Yeniden Yükle",reloadSuccess:"Sunucu başarıyla yeniden yüklendi",reloadError:"Sunucu {{serverName}} yeniden yüklenemedi",requestOptions:"Bağlantı Yapılandırması",timeout:"İstek Zaman Aşımı",timeoutDescription:"MCP sunucusuna yapılan istekler için zaman aşımı (ms)",maxTotalTimeout:"Maksimum Toplam Zaman Aşımı",maxTotalTimeoutDescription:"MCP sunucusuna gönderilen istekler için maksimum toplam zaman aşımı (ms) (İlerleme bildirimleriyle kullanın)",resetTimeoutOnProgress:"İlerlemede Zaman Aşımını Sıfırla",resetTimeoutOnProgressDescription:"İlerleme bildirimlerinde zaman aşımını sıfırla (varsayılan olarak etkin)",keepAlive:"Bağlantı Canlı Tutma Yapılandırması",enableKeepAlive:"Bağlantı Canlı Tutmayı Etkinleştir",keepAliveDescription:"Bağlantıyı korumak için periyodik ping istekleri gönderin. Zaman aşımına uğrayabilecek uzun süreli bağlantılar için yararlıdır.",keepAliveInterval:"Aralık (ms)",keepAliveIntervalDescription:"Canlı tutma pingleri arasındaki süre milisaniye cinsinden (varsayılan: 60000ms = 1 dakika)",remove:"Kaldır",toggleError:"{{serverName}} sunucusu açılamadı/kapatılamadı",alreadyExists:"{{serverName}} sunucusu zaten mevcut",invalidData:"Geçersiz sunucu verisi sağlandı",notFound:"{{serverName}} sunucusu bulunamadı",namePlaceholder:"Sunucu adını girin",urlPlaceholder:"Sunucu URL'sini girin",commandPlaceholder:"Komutu girin",argumentsPlaceholder:"Argümanları girin",errorDetails:"Hata Detayları",viewErrorDetails:"Hata detaylarını görüntüle",copyConfig:"Yapılandırmayı Kopyala",confirmVariables:"Değişken Yapılandırmasını Onayla",variablesDetected:"Yapılandırmada değişkenler algılandı. Lütfen bu değişkenlerin düzgün yapılandırıldığını onaylayın:",detectedVariables:"Algılanan Değişkenler",confirmVariablesMessage:"Lütfen bu değişkenlerin çalışma ortamınızda düzgün tanımlandığından emin olun. Sunucu eklemeye devam edilsin mi?",confirmAndAdd:"Onayla ve Ekle",openapi:{inputMode:"Giriş Modu",inputModeUrl:"Şartname URL'si",inputModeSchema:"JSON Şeması",specUrl:"OpenAPI Şartname URL'si",schema:"OpenAPI JSON Şeması",schemaHelp:"Eksiksiz OpenAPI JSON şemanızı buraya yapıştırın",security:"Güvenlik Türü",securityNone:"Yok",securityApiKey:"API Anahtarı",securityHttp:"HTTP Kimlik Doğrulaması",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API Anahtarı Yapılandırması",apiKeyName:"Başlık/Parametre Adı",apiKeyIn:"Konum",apiKeyValue:"API Anahtarı Değeri",httpAuthConfig:"HTTP Kimlik Doğrulama Yapılandırması",httpScheme:"Kimlik Doğrulama Şeması",httpCredentials:"Kimlik Bilgileri",httpSchemeBasic:"Basit",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 Yapılandırması",oauth2Token:"Erişim Anahtarı",openIdConnectConfig:"OpenID Connect Yapılandırması",openIdConnectUrl:"URL'yi Keşfet",openIdConnectToken:"ID Token",apiKeyInHeader:"Başlık",apiKeyInQuery:"Sorgu",apiKeyInCookie:"Çerez",passthroughHeaders:"Geçiş Başlıkları",passthroughHeadersHelp:"Gelen MCP isteklerinden yukarı akış sunucu isteklerine geçirilecek başlık adlarının virgülle ayrılmış listesi (örn. Authorization, X-API-Key)"},oauth:{sectionTitle:"OAuth Yapılandırması",sectionDescription:"OAuth korumalı sunucular için istemci kimlik bilgilerini yapılandırın (isteğe bağlı).",clientId:"İstemci ID",clientSecret:"İstemci Gizli Anahtarı",authorizationEndpoint:"Yetkilendirme Uç Noktası",tokenEndpoint:"Token Uç Noktası",scopes:"Kapsamlar",scopesPlaceholder:"scope1 scope2",resource:"Kaynak / Hedef Kitle",accessToken:"Erişim Tokeni",refreshToken:"Yenileme Tokeni"}},RC={online:"Çevrimiçi",offline:"Çevrimdışı",connecting:"Bağlanıyor",oauthRequired:"OAuth Gerekli",clickToAuthorize:"OAuth ile yetkilendirmek için tıklayın",oauthWindowOpened:"OAuth yetkilendirme penceresi açıldı. Lütfen yetkilendirmeyi tamamlayın."},TC={general:"Bir şeyler yanlış gitti",network:"Ağ bağlantı hatası. Lütfen internet bağlantınızı kontrol edin",serverConnection:"Sunucuya bağlanılamıyor. Lütfen sunucunun çalışıp çalışmadığını kontrol edin",serverAdd:"Sunucu eklenemedi. Lütfen sunucu durumunu kontrol edin",serverUpdate:"{{serverName}} sunucusu düzenlenemedi. Lütfen sunucu durumunu kontrol edin",serverFetch:"Sunucu verileri alınamadı. Lütfen daha sonra tekrar deneyin",failedToReloadServer:"Sunucu yeniden yüklenemedi",initialStartup:"Sunucu başlatılıyor olabilir. İlk başlatmada bu işlem biraz zaman alabileceğinden lütfen bekleyin...",serverInstall:"Sunucu yüklenemedi",failedToFetchSettings:"Ayarlar getirilemedi",failedToUpdateRouteConfig:"Route yapılandırması güncellenemedi",failedToUpdateSmartRoutingConfig:"Akıllı yönlendirme yapılandırması güncellenemedi"},OC={processing:"İşleniyor...",save:"Kaydet",cancel:"İptal",back:"Geri",refresh:"Yenile",search:"Ara",clear:"Temizle",view:"Görüntüle",create:"Oluştur",creating:"Oluşturuluyor...",update:"Güncelle",updating:"Güncelleniyor...",submitting:"Gönderiliyor...",delete:"Sil",remove:"Kaldır",copy:"Kopyala",copyId:"ID'yi Kopyala",copyUrl:"URL'yi Kopyala",copyJson:"JSON'u Kopyala",copySuccess:"Panoya kopyalandı",copyFailed:"Kopyalama başarısız",copied:"Kopyalandı",close:"Kapat",confirm:"Onayla",language:"Dil",true:"Doğru",false:"Yanlış",dismiss:"Anımsatma",github:"GitHub",wechat:"WeChat",discord:"Discord",itemsPerPage:"Sayfa başına öğe",showing:"{{total}} öğeden {{start}}-{{end}} gösteriliyor",previous:"Önceki",next:"Sonraki",required:"Gerekli",secret:"Gizli",default:"Varsayılan",value:"Değer",type:"Tür",repeated:"Tekrarlanan",valueHint:"Değer İpucu",choices:"Seçenekler",actions:"Eylemler",saving:"Kaydediliyor...",active:"Aktif",inactive:"Pasif"},zC={rowsPerPage:"Sayfa başına satır",showing:"Toplam {{total}} öğeden {{from}}-{{to}} gösteriliyor"},MC={dashboard:"Kontrol Paneli",servers:"Sunucular",groups:"Gruplar",prompts:"Promptlar",resources:"Kaynaklar",users:"Kullanıcılar",settings:"Ayarlar",changePassword:"Şifre Değiştir",market:"Market",cloud:"Bulut Market",logs:"Günlükler",activity:"Etkinlik"},PC={dashboard:{title:"Kontrol Paneli",totalServers:"Toplam",onlineServers:"Çevrimiçi",disabledServers:"Devre Dışı",offlineServers:"Çevrimdışı",connectingServers:"Bağlanıyor",recentServers:"Son Sunucular"},servers:{title:"Sunucu Yönetimi"},groups:{title:"Grup Yönetimi"},prompts:{title:"Yerleşik Promptlar"},resources:{title:"Yerleşik Kaynaklar"},users:{title:"Kullanıcı Yönetimi"},settings:{title:"Ayarlar",language:"Dil",account:"Hesap Ayarları",password:"Şifre Değiştir",appearance:"Görünüm",routeConfig:"Güvenlik",installConfig:"Kurulum",smartRouting:"Akıllı Yönlendirme",oauthServer:"OAuth Sunucusu"},market:{title:"Market Yönetimi - Yerel ve Bulut Marketler"},logs:{title:"Sistem Günlükleri"}},DC={filters:"Filtreler",search:"Günlüklerde ara...",autoScroll:"Otomatik kaydır",clearLogs:"Günlükleri temizle",loading:"Günlükler yükleniyor...",noLogs:"Kullanılabilir günlük yok.",noMatch:"Mevcut filtrelerle eşleşen günlük yok.",mainProcess:"Ana İşlem",childProcess:"Alt İşlem",main:"Ana",child:"Alt"},LC={add:"Ekle",addNew:"Yeni Grup Ekle",edit:"Grubu Düzenle",delete:"Sil",confirmDelete:"Bu grubu silmek istediğinizden emin misiniz?",deleteWarning:"'{{name}}' grubunu silmek, onu ve tüm sunucu ilişkilerini kaldıracaktır. Bu işlem geri alınamaz.",name:"Grup Adı",namePlaceholder:"Grup adını girin",nameRequired:"Grup adı gereklidir",description:"Açıklama",descriptionPlaceholder:"Grup açıklamasını girin (isteğe bağlı)",createError:"Grup oluşturulamadı",updateError:"Grup güncellenemedi",deleteError:"Grup silinemedi",serverAddError:"Sunucu gruba eklenemedi",serverRemoveError:"Sunucu gruptan kaldırılamadı",addServer:"Gruba Sunucu Ekle",selectServer:"Eklenecek bir sunucu seçin",servers:"Gruptaki Sunucular",remove:"Kaldır",noGroups:"Kullanılabilir grup yok. Başlamak için yeni bir grup oluşturun.",noServers:"Bu grupta sunucu yok.",noServerOptions:"Kullanılabilir sunucu yok",serverCount:"{{count}} Sunucu",toolSelection:"Araç Seçimi",promptSelection:"İstem Seçimi",resourceSelection:"Kaynak Seçimi",toolsSelected:"Seçildi",promptsSelected:"Seçildi",resourcesSelected:"Seçildi",allTools:"Tümü",allPrompts:"Tüm istemler",allResources:"Tüm kaynaklar",selectedTools:"Seçili araçlar",selectedPrompts:"Seçili istemler",selectedResources:"Seçili kaynaklar",selectAll:"Tümünü Seç",selectNone:"Hiçbirini Seçme",configureTools:"Araçları Yapılandır",configureCapabilities:"Araçları, istemleri ve kaynakları yapılandır",previewPrompts:"[istemler: {{items}}]",previewResources:"[kaynaklar: {{items}}]",previewAllTools:"(tüm araçlar)",previewAllPrompts:"(tüm istemler)",previewAllResources:"(tüm kaynaklar)"},UC={title:"Yerel Kurulum",official:"Resmi",by:"Geliştirici",unknown:"Bilinmeyen",tools:"araçlar",search:"Ara",searchPlaceholder:"Sunucuları isme, kategoriye veya etiketlere göre ara",clearFilters:"Temizle",clearCategoryFilter:"",clearTagFilter:"",categories:"Kategoriler",tags:"Etiketler",showTags:"Etiketleri göster",hideTags:"Etiketleri gizle",moreTags:"",noServers:"Aramanızla eşleşen sunucu bulunamadı",backToList:"Listeye dön",install:"Yükle",installing:"Yükleniyor...",installed:"Yüklendi",installServer:"Sunucu Yükle: {{name}}",installSuccess:"{{serverName}} sunucusu başarıyla yüklendi",author:"Yazar",license:"Lisans",repository:"Depo",examples:"Örnekler",arguments:"Argümanlar",argumentName:"Ad",description:"Açıklama",required:"Gerekli",example:"Örnek",viewSchema:"Şemayı görüntüle",fetchError:"Market sunucuları getirilirken hata",serverNotFound:"Sunucu bulunamadı",searchError:"Sunucular aranırken hata",filterError:"Sunucular kategoriye göre filtrelenirken hata",tagFilterError:"Sunucular etikete göre filtrelenirken hata",noInstallationMethod:"Bu sunucu için kullanılabilir kurulum yöntemi yok",showing:"{{total}} sunucudan {{from}}-{{to}} arası gösteriliyor",perPage:"Sayfa başına",confirmVariablesMessage:"Lütfen bu değişkenlerin çalışma ortamınızda düzgün tanımlandığından emin olun. Sunucu yüklemeye devam edilsin mi?",confirmAndInstall:"Onayla ve Yükle"},_C={authorizeTitle:"Uygulamayı Yetkilendir",authorizeSubtitle:"Bu uygulamanın MCPHub hesabınıza erişmesine izin verin.",buttons:{approve:"Erişime izin ver",deny:"Reddet",approveSubtitle:"Bu uygulamaya güveniyorsanız izin vermeniz önerilir.",denySubtitle:"İstediğiniz zaman daha sonra erişim verebilirsiniz."}},BC={title:"Bulut Desteği",subtitle:"MCPRouter tarafından desteklenmektedir",by:"Geliştirici",server:"Sunucu",config:"Yapılandırma",created:"Oluşturuldu",updated:"Güncellendi",available:"Kullanılabilir",description:"Açıklama",details:"Detaylar",tools:"Araçlar",tool:"araç",toolsAvailable:"{{count}} araç mevcut",loadingTools:"Araçlar yükleniyor...",noTools:"Bu sunucu için kullanılabilir araç yok",noDescription:"Kullanılabilir açıklama yok",viewDetails:"Detayları Görüntüle",parameters:"Parametreler",result:"Sonuç",error:"Hata",callTool:"Çalıştır",calling:"Çalıştırılıyor...",toolCallSuccess:"{{toolName}} aracı başarıyla çalıştırıldı",toolCallError:"{{toolName}} aracı çalıştırılamadı: {{error}}",viewSchema:"Şemayı Görüntüle",backToList:"Bulut Market'e Dön",search:"Ara",searchPlaceholder:"Bulut sunucularını isme, başlığa veya geliştiriciye göre ara",clearFilters:"Filtreleri Temizle",clearCategoryFilter:"Temizle",clearTagFilter:"Temizle",categories:"Kategoriler",tags:"Etiketler",noCategories:"Kategori bulunamadı",noTags:"Etiket bulunamadı",noServers:"Bulut sunucusu bulunamadı",fetchError:"Bulut sunucuları getirilirken hata",serverNotFound:"Bulut sunucusu bulunamadı",searchError:"Bulut sunucuları aranırken hata",filterError:"Bulut sunucuları kategoriye göre filtrelenirken hata",tagFilterError:"Bulut sunucuları etikete göre filtrelenirken hata",showing:"{{total}} bulut sunucusundan {{from}}-{{to}} arası gösteriliyor",perPage:"Sayfa başına",apiKeyNotConfigured:"MCPRouter API anahtarı yapılandırılmamış",apiKeyNotConfiguredDescription:"Bulut sunucularını kullanmak için MCPRouter API anahtarınızı yapılandırmanız gerekir.",getApiKey:"API Anahtarı Al",configureInSettings:"Ayarlarda Yapılandır",installServer:"{{name}} Yükle",installSuccess:"{{name}} sunucusu başarıyla yüklendi",installError:"Sunucu yüklenemedi: {{error}}"},IC={title:"Kayıt",official:"Resmi",latest:"En Son",description:"Açıklama",website:"Web Sitesi",repository:"Depo",packages:"Paketler",package:"paket",remotes:"Uzak Sunucular",remote:"uzak sunucu",published:"Yayınlandı",updated:"Güncellendi",install:"Yükle",installing:"Yükleniyor...",installed:"Yüklendi",installServer:"{{name}} Yükle",installSuccess:"{{name}} sunucusu başarıyla yüklendi",installError:"Sunucu yüklenemedi: {{error}}",noDescription:"Kullanılabilir açıklama yok",viewDetails:"Detayları Görüntüle",backToList:"Kayda Dön",search:"Ara",searchPlaceholder:"Kayıt sunucularını isme göre ara",clearFilters:"Temizle",noServers:"Kayıt sunucusu bulunamadı",fetchError:"Kayıt sunucuları getirilirken hata",serverNotFound:"Kayıt sunucusu bulunamadı",showing:"{{total}} kayıt sunucusundan {{from}}-{{to}} arası gösteriliyor",perPage:"Sayfa başına",environmentVariables:"Ortam Değişkenleri",packageArguments:"Paket Argümanları",runtimeArguments:"Çalışma Zamanı Argümanları",headers:"Başlıklar"},FC={run:"Çalıştır",running:"Çalıştırılıyor...",runTool:"Aracı Çalıştır",cancel:"İptal",noDescription:"Kullanılabilir açıklama yok",inputSchema:"Giriş Şeması:",runToolWithName:"Aracı Çalıştır: {{name}}",execution:"Araç Çalıştırma",successful:"Başarılı",failed:"Başarısız",result:"Sonuç:",error:"Hata",errorDetails:"Hata Detayları:",noContent:"Araç başarıyla çalıştırıldı ancak içerik döndürmedi.",unknownError:"Bilinmeyen hata oluştu",jsonResponse:"JSON Yanıtı:",toolResult:"Araç sonucu",noParameters:"Bu araç herhangi bir parametre gerektirmez.",selectOption:"Bir seçenek seçin",enterValue:"{{type}} değeri girin",enabled:"Etkin",enableSuccess:"{{name}} aracı başarıyla etkinleştirildi",disableSuccess:"{{name}} aracı başarıyla devre dışı bırakıldı",toggleFailed:"Araç durumu değiştirilemedi",descriptionUpdateSuccess:"Araç açıklaması başarıyla güncellendi",descriptionUpdateFailed:"Araç açıklaması güncellenemedi",restoreDefault:"Varsayılana dön",restoreDefaultSuccess:"Araç açıklaması varsayılan değere döndürüldü",restoreDefaultFailed:"Varsayılan araç açıklamasına dönülemedi",parameters:"Araç Parametreleri",formMode:"Form Modu",jsonMode:"JSON Modu",jsonConfiguration:"JSON Yapılandırması",invalidJsonFormat:"Geçersiz JSON formatı",fixJsonBeforeSwitching:"Form moduna geçmeden önce lütfen JSON formatını düzeltin",item:"Öğe {{index}}",addItem:"{{key}} öğesi ekle",enterKey:"{{key}} girin"},HC={run:"Getir",running:"Getiriliyor...",result:"İstek Sonucu",error:"İstek Hatası",execution:"İstek Çalıştırma",successful:"Başarılı",failed:"Başarısız",errorDetails:"Hata Detayları:",noContent:"İstek başarıyla çalıştırıldı ancak içerik döndürmedi.",unknownError:"Bilinmeyen hata oluştu",jsonResponse:"JSON Yanıtı:",description:"Açıklama",messages:"Mesajlar",noDescription:"Kullanılabilir açıklama yok",runPromptWithName:"İsteği Getir: {{name}}",descriptionUpdateSuccess:"İstek açıklaması başarıyla güncellendi",descriptionUpdateFailed:"İstek açıklaması güncellenemedi",restoreDefault:"Varsayılana dön",restoreDefaultSuccess:"İstek açıklaması varsayılan değere döndürüldü",restoreDefaultFailed:"Varsayılan istek açıklamasına dönülemedi"},qC=JSON.parse(`{"enableGlobalRoute":"Global Yönlendirmeyi Etkinleştir","enableGlobalRouteDescription":"Grup ID'si belirtmeden /sse uç noktasına bağlantıya izin ver","enableGroupNameRoute":"Grup Adı Yönlendirmeyi Etkinleştir","enableGroupNameRouteDescription":"Sadece grup ID'leri yerine grup adları kullanarak /sse uç noktasına bağlantıya izin ver","enableBearerAuth":"Bearer Kimlik Doğrulamasını Etkinleştir","enableBearerAuthDescription":"MCP uç noktaları için bearer token kimlik doğrulaması gerektirir (varsayılan açık)","bearerAuthKey":"Bearer Kimlik Doğrulama Anahtarı","bearerAuthKeyDescription":"Bearer token'da gerekli olacak kimlik doğrulama anahtarı","bearerAuthKeyPlaceholder":"Bearer kimlik doğrulama anahtarını girin","bearerAuthHeaderName":"Bearer Kimlik Doğrulama Başlığı","bearerAuthHeaderNameDescription":"MCP bearer kimlik bilgilerinin alınacağı başlık adı. Yukarı akış passthrough başlıkları da Authorization kullanıyorsa bunu değiştirin.","bearerAuthHeaderNamePlaceholder":"örn. Authorization veya X-MCP-Authorization","bearerKeysSectionTitle":"Anahtarlar","bearerKeysSectionDescription":"Farklı erişim kapsamlarına sahip birden fazla anahtarı yönetin.","noBearerKeys":"Henüz yapılandırılmış herhangi bir anahtar yok.","bearerKeyName":"Ad","bearerKeyToken":"Token","bearerKeyEnabled":"Etkin","bearerKeyAccessType":"Erişim kapsamı","bearerKeyAccessAll":"Tümü","bearerKeyAccessGroups":"Gruplar","bearerKeyAccessServers":"Sunucular","bearerKeyAccessCustom":"Özel","bearerKeyAllowedGroups":"İzin verilen gruplar","bearerKeyAllowedServers":"İzin verilen sunucular","addBearerKey":"Anahtar ekle","addBearerKeyButton":"Oluştur","bearerKeyRequired":"Ad ve token zorunludur","deleteBearerKeyConfirm":"Bu anahtarı silmek istediğinizden emin misiniz?","generate":"Oluştur","selectGroups":"Grupları Seç","selectServers":"Sunucuları Seç","selectAtLeastOneGroup":"Lütfen en az bir grup seçin","selectAtLeastOneServer":"Lütfen en az bir sunucu seçin","skipAuth":"Kimlik Doğrulamayı Atla","skipAuthDescription":"Kontrol paneline giriş olmadan erişime izin ver; kimliği doğrulanmamış kullanıcılar guest yönetici erişimi alır (MCP kimlik doğrulamasını etkilemez)","jsonBodyLimit":"JSON Gövde Boyutu Sınırı","jsonBodyLimitDescription":"Express JSON istek boyutu sınırı. Büyük OpenAPI şema yüklemeleri de bu ayardan etkilenir.","jsonBodyLimitPlaceholder":"örn. 1mb, 5mb, 1024kb","pythonIndexUrl":"Python Paket Deposu URL'si","pythonIndexUrlDescription":"Python paket kurulumu için UV_DEFAULT_INDEX ortam değişkenini ayarla","pythonIndexUrlPlaceholder":"örn. https://pypi.org/simple","npmRegistry":"NPM Kayıt URL'si","npmRegistryDescription":"NPM paket kurulumu için npm_config_registry ortam değişkenini ayarla","npmRegistryPlaceholder":"örn. https://registry.npmjs.org/","baseUrl":"Temel URL","baseUrlDescription":"MCP istekleri ve OAuth geri çağrıları için temel URL","baseUrlPlaceholder":"örn. http://localhost:3000","installConfig":"Kurulum","systemConfigUpdated":"Sistem yapılandırması başarıyla güncellendi","enableSmartRouting":"Akıllı Yönlendirmeyi Etkinleştir","enableSmartRoutingDescription":"Girdiye göre en uygun aracı aramak için akıllı yönlendirme özelliğini etkinleştir ($smart grup adını kullanarak)","dbUrl":"PostgreSQL URL'si (pgvector desteği gerektirir)","dbUrlPlaceholder":"örn. postgresql://kullanıcı:şifre@localhost:5432/veritabanıadı","embeddingProvider":"Embedding Sağlayıcısı","openaiApiBaseUrl":"OpenAI uyumlu Temel URL","openaiApiBaseUrlPlaceholder":"https://api.openai.com/v1","openaiApiKey":"LLM Sağlayıcı API Anahtarı","openaiApiKeyPlaceholder":"LLM sağlayıcı API anahtarını girin","openaiApiEmbeddingModel":"Entegrasyon Modeli Adı","openaiApiEmbeddingModelPlaceholder":"text-embedding-3-small","basePacingDelayMs":"Temel pacing gecikmesi (ms)","basePacingDelayMsDescription":"Sağlayıcıya gönderilen embedding istekleri arasındaki temel bekleme süresi. Varsayılan 0 — sistem hız sınırlarını otomatik olarak yönetir: Retry-After başlıklarına uyar, başlık yoksa 63 saniyelik bekleme uygular ve her 403/429 yanıtından sonra pacing gecikmesini artırır. Yalnızca sağlayıcınız sabit bir minimum aralık gerektiriyorsa sıfırdan farklı bir değer ayarlayın.","basePacingDelayMsPlaceholder":"Boş = varsayılan 0 ms","basePacingDelayMsAuto":"Varsayılan ({{value}} ms): hız sınırı yönetimi otomatiktir.","basePacingDelayMsZero":"0 ms (varsayılan): hız sınırı yönetimi, uyarlanabilir pacing ve retry mantığı aracılığıyla otomatik olarak yapılır.","basePacingDelayMsOverride":"Özel değer: varsayılan temel pacing gecikmesini geçersiz kılar.","embeddingEncodingFormat":"Embedding Kodlama Formatı","embeddingEncodingFormatDescription":"Embedding vektörleri için kodlama formatı. Otomatik, sağlayıcı desteğine göre algılar.","embeddingEncodingFormatAuto":"Otomatik (Önerilen)","azureOpenaiEndpoint":"Azure OpenAI Uç Noktası","azureOpenaiEndpointPlaceholder":"https://KAYNAK_ADINIZ.openai.azure.com","azureOpenaiApiKey":"Azure OpenAI API Anahtarı","azureOpenaiApiKeyPlaceholder":"Azure OpenAI API anahtarını girin","azureOpenaiApiVersion":"Azure OpenAI API Sürümü","azureOpenaiApiVersionPlaceholder":"2024-02-15-preview","azureOpenaiEmbeddingDeployment":"Azure OpenAI Embedding Dağıtımı","azureOpenaiEmbeddingDeploymentPlaceholder":"text-embedding-3-small","azureOpenaiEmbeddingModel":"Azure Embedding Model Adı","azureOpenaiEmbeddingModelDescription":"Azure'da dağıtılan gerçek OpenAI model adı (örn. text-embedding-3-small). API'ye göndermeden önce doğru token sayımı için kullanılır.","azureOpenaiEmbeddingModelPlaceholder":"text-embedding-3-small","smartRoutingConfigUpdated":"Akıllı yönlendirme yapılandırması başarıyla güncellendi","progressiveDisclosure":"Aşamalı Açıklama","progressiveDisclosureDescription":"Etkinleştirildiğinde, search_tools yalnızca araç adlarını ve açıklamalarını döndürür. Tam parametre şemasını almak için describe_tool kullanın; bu da token kullanımını azaltır.","embeddingMaxTokens":"Maks. Embedding Token Sayısı","embeddingMaxTokensDescription":"Embedding oluşturmadan önce metin kesme için maksimum token sayısı. Model varsayılanını otomatik olarak kullanmak için boş bırakın. Özel bir değer her zaman model varsayılanını geçersiz kılar. Yerel LLM sağlayıcıları kullanırken bu değeri manuel olarak ayarlamak, kesme hatalarını önlemek için özellikle yararlıdır.","embeddingMaxTokensPlaceholder":"Boş = modele göre otomatik","embeddingMaxTokensAuto":"Otomatik: {{limit}} token ({{model}} model varsayılanı)","embeddingMaxTokensOverride":"Bu değer model varsayılanını geçersiz kılar.","smartRoutingRequiredFields":"Akıllı yönlendirmeyi etkinleştirmek için Veritabanı URL'si gereklidir. LLM Sağlayıcı API Anahtarı yalnızca bulut tabanlı sağlayıcılar için gereklidir (yerel LLM'ler genellikle API anahtarı gerektirmez, form doğrulamasını geçmek için herhangi bir değer girin)","smartRoutingValidationError":"Akıllı Yönlendirmeyi etkinleştirmeden önce lütfen gerekli alanları doldurun: {{fields}}","mcpRouterConfig":"Bulut Market","mcpRouterApiKey":"MCPRouter API Anahtarı","mcpRouterApiKeyDescription":"MCPRouter bulut market hizmetlerine erişim için API anahtarı","mcpRouterApiKeyPlaceholder":"MCPRouter API anahtarını girin","mcpRouterReferer":"Yönlendiren","mcpRouterRefererDescription":"MCPRouter API istekleri için Referer başlığı","mcpRouterRefererPlaceholder":"https://www.mcphub.app","mcpRouterTitle":"Başlık","mcpRouterTitleDescription":"MCPRouter API istekleri için Başlık başlığı","mcpRouterTitlePlaceholder":"MCPHub","mcpRouterBaseUrl":"Temel URL","mcpRouterBaseUrlDescription":"MCPRouter API için temel URL","mcpRouterBaseUrlPlaceholder":"https://api.mcprouter.to/v1","systemSettings":"Sistem Ayarları","nameSeparatorLabel":"İsim Ayırıcı","nameSeparatorDescription":"Sunucu adı ile araç/istek adını ayırmak için kullanılan karakter (varsayılan: -)","enableSessionRebuild":"Sunucu Oturum Yeniden Oluşturmayı Etkinleştir","enableSessionRebuildDescription":"Etkinleştirildiğinde, daha iyi oturum yönetimi deneyimi için geliştirilmiş sunucu oturum yeniden oluşturma kodunu uygular","restartRequired":"Yapılandırma kaydedildi. Tüm hizmetlerin yeni ayarları doğru şekilde yüklemesini sağlamak için uygulamayı yeniden başlatmanız önerilir.","exportMcpSettings":"Ayarları Dışa Aktar","mcpSettingsJson":"MCP Ayarları JSON","mcpSettingsJsonDescription":"Yedekleme veya diğer araçlara taşıma için mevcut mcp_settings.json yapılandırmanızı görüntüleyin, kopyalayın veya indirin","copyToClipboard":"Panoya Kopyala","downloadJson":"JSON Olarak İndir","exportSuccess":"Ayarlar başarıyla dışa aktarıldı","exportError":"Ayarlar getirilemedi","enableOauthServer":"OAuth Sunucusunu Etkinleştir","enableOauthServerDescription":"MCPHub'ın harici istemciler için OAuth jetonları vermesine izin ver","requireClientSecret":"İstemci Sırrı Zorunlu","requireClientSecretDescription":"Etkin olduğunda gizli istemciler client secret sunmalıdır (yalnızca PKCE kullanan istemciler için kapatabilirsiniz)","requireState":"State parametresi zorunlu","requireStateDescription":"State parametresi olmayan yetkilendirme isteklerini reddeder","accessTokenLifetime":"Erişim jetonu süresi (saniye)","accessTokenLifetimeDescription":"Verilen erişim jetonlarının geçerli kalacağı süre","accessTokenLifetimePlaceholder":"örn. 3600","refreshTokenLifetime":"Yenileme jetonu süresi (saniye)","refreshTokenLifetimeDescription":"Yenileme jetonlarının geçerli kalacağı süre","refreshTokenLifetimePlaceholder":"örn. 1209600","authorizationCodeLifetime":"Yetkilendirme kodu süresi (saniye)","authorizationCodeLifetimeDescription":"Yetkilendirme kodlarının takas edilebileceği süre","authorizationCodeLifetimePlaceholder":"örn. 300","allowedScopes":"İzin verilen kapsamlar","allowedScopesDescription":"Kullanıcıların onaylayabileceği kapsamların virgülle ayrılmış listesi","allowedScopesPlaceholder":"örn. read, write","enableDynamicRegistration":"Dinamik istemci kaydını etkinleştir","dynamicRegistrationDescription":"RFC 7591 uyumlu istemcilerin herkese açık uç nokta üzerinden kayıt olmasına izin ver","dynamicRegistrationAllowedGrantTypes":"İzin verilen grant türleri","dynamicRegistrationAllowedGrantTypesDescription":"Dinamik olarak kaydedilen istemciler için kullanılabilecek grant türlerinin virgülle ayrılmış listesi","dynamicRegistrationAllowedGrantTypesPlaceholder":"örn. authorization_code, refresh_token","dynamicRegistrationAuth":"Kayıt için kimlik doğrulaması iste","dynamicRegistrationAuthDescription":"Kayıt uç noktasını korur, yalnızca kimliği doğrulanmış istekler yeni istemci oluşturabilir","invalidNumberInput":"Lütfen sıfırdan küçük olmayan geçerli bir sayı girin"}`),GC={upload:"Yükle",uploadTitle:"MCPB Paketi Yükle",dropFileHere:".mcpb dosyanızı buraya bırakın",orClickToSelect:"veya bilgisayarınızdan seçmek için tıklayın",invalidFileType:"Lütfen geçerli bir .mcpb dosyası seçin",noFileSelected:"Lütfen yüklemek için bir .mcpb dosyası seçin",uploading:"Yükleniyor...",uploadFailed:"MCPB dosyası yüklenemedi",installServer:"MCPB'den MCP Sunucusu Yükle",extensionInfo:"Uzantı Bilgisi",name:"Ad",version:"Sürüm",description:"Açıklama",author:"Geliştirici",tools:"Araçlar",serverName:"Sunucu Adı",serverNamePlaceholder:"Bu sunucu için bir ad girin",install:"Yükle",installing:"Yükleniyor...",installFailed:"MCPB'den sunucu yüklenemedi",serverExistsTitle:"Sunucu Zaten Mevcut",serverExistsConfirm:"'{{serverName}}' sunucusu zaten mevcut. Yeni sürümle geçersiz kılmak istiyor musunuz?",override:"Geçersiz Kıl"},KC={button:"İçe Aktar",title:"JSON'dan Sunucuları İçe Aktar",inputLabel:"Sunucu Yapılandırma JSON",inputHelp:"Sunucu yapılandırma JSON'unuzu yapıştırın. STDIO, SSE ve HTTP (streamable-http) sunucu türlerini destekler.",preview:"Önizle",previewTitle:"İçe Aktarılacak Sunucuları Önizle",import:"İçe Aktar",importing:"İçe aktarılıyor...",invalidFormat:"Geçersiz JSON formatı. JSON bir 'mcpServers' nesnesi içermelidir.",parseError:"JSON ayrıştırılamadı. Lütfen formatı kontrol edip tekrar deneyin.",addFailed:"Sunucu eklenemedi",importFailed:"Sunucular içe aktarılamadı",partialSuccess:"{{total}} sunucudan {{count}} tanesi başarıyla içe aktarıldı. Bazı sunucular başarısız oldu:"},VC={button:"İçe Aktar",title:"JSON'dan Grupları İçe Aktar",inputLabel:"Grup Yapılandırma JSON",inputHelp:"Grup yapılandırma JSON'unuzu yapıştırın. Her grup bir sunucu listesi içerebilir.",preview:"Önizle",previewTitle:"İçe Aktarılacak Grupları Önizle",import:"İçe Aktar",importing:"İçe aktarılıyor...",invalidFormat:"Geçersiz JSON formatı. JSON bir 'groups' dizisi içermelidir.",missingName:"Her grubun bir 'name' alanı olmalıdır.",parseError:"JSON ayrıştırılamadı. Lütfen formatı kontrol edip tekrar deneyin.",addFailed:"Grup eklenemedi",importFailed:"Gruplar içe aktarılamadı",partialSuccess:"{{total}} gruptan {{count}} tanesi başarıyla içe aktarıldı. Bazı gruplar başarısız oldu:"},$C={add:"Kullanıcı Ekle",addNew:"Yeni Kullanıcı Ekle",edit:"Kullanıcıyı Düzenle",delete:"Kullanıcıyı Sil",create:"Kullanıcı Oluştur",update:"Kullanıcıyı Güncelle",username:"Kullanıcı Adı",password:"Şifre",newPassword:"Yeni Şifre",confirmPassword:"Şifreyi Onayla",changePassword:"Şifre Değiştir",adminRole:"Yönetici",admin:"Yönetici",user:"Kullanıcı",role:"Rol",actions:"Eylemler",addFirst:"İlk kullanıcınızı ekleyin",permissions:"İzinler",adminPermissions:"Tam sistem erişimi",userPermissions:"Sınırlı erişim",currentUser:"Siz",noUsers:"Kullanıcı bulunamadı",adminRequired:"Kullanıcıları yönetmek için yönetici erişimi gereklidir",usernameRequired:"Kullanıcı adı gereklidir",passwordRequired:"Şifre gereklidir",passwordTooShort:"Şifre en az 6 karakter uzunluğunda olmalıdır",passwordMismatch:"Şifreler eşleşmiyor",usernamePlaceholder:"Kullanıcı adını girin",passwordPlaceholder:"Şifreyi girin",newPasswordPlaceholder:"Mevcut şifreyi korumak için boş bırakın",confirmPasswordPlaceholder:"Yeni şifreyi onaylayın",createError:"Kullanıcı oluşturulamadı",updateError:"Kullanıcı güncellenemedi",deleteError:"Kullanıcı silinemedi",statsError:"Kullanıcı istatistikleri getirilemedi",deleteConfirmation:"'{{username}}' kullanıcısını silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.",confirmDelete:"Kullanıcıyı Sil",deleteWarning:"'{{username}}' kullanıcısını silmek istediğinizden emin misiniz? Bu işlem geri alınamaz."},YC={errors:{readonly:"Demo ortamı için salt okunur",invalid_credentials:"Geçersiz kullanıcı adı veya şifre",serverNameRequired:"Sunucu adı gereklidir",serverConfigRequired:"Sunucu yapılandırması gereklidir",serverConfigInvalid:"Sunucu yapılandırması bir URL, OpenAPI şartname URL'si veya şema, ya da argümanlı komut içermelidir",serverTypeInvalid:"Sunucu türü şunlardan biri olmalıdır: stdio, sse, streamable-http, openapi",urlRequiredForType:"{{type}} sunucu türü için URL gereklidir",openapiSpecRequired:"OpenAPI sunucu türü için OpenAPI şartname URL'si veya şema gereklidir",headersInvalidFormat:"Başlıklar bir nesne olmalıdır",headersNotSupportedForStdio:"Başlıklar stdio sunucu türü için desteklenmez",serverNotFound:"Sunucu bulunamadı",failedToRemoveServer:"Sunucu bulunamadı veya kaldırılamadı",internalServerError:"Dahili sunucu hatası",failedToGetServers:"Sunucu bilgileri alınamadı",failedToGetServerSettings:"Sunucu ayarları alınamadı",failedToGetServerConfig:"Sunucu yapılandırması alınamadı",failedToSaveSettings:"Ayarlar kaydedilemedi",toolNameRequired:"Sunucu adı ve araç adı gereklidir",descriptionMustBeString:"Açıklama bir string olmalıdır",groupIdRequired:"Grup ID gereklidir",groupNameRequired:"Grup adı gereklidir",groupNotFound:"Grup bulunamadı",groupIdAndServerNameRequired:"Grup ID ve sunucu adı gereklidir",groupOrServerNotFound:"Grup veya sunucu bulunamadı",toolsMustBeAllOrArray:'Araçlar "all" veya bir string dizisi olmalıdır',serverNameAndToolNameRequired:"Sunucu adı ve araç adı gereklidir",usernameRequired:"Kullanıcı adı gereklidir",userNotFound:"Kullanıcı bulunamadı",failedToGetUsers:"Kullanıcı bilgileri alınamadı",failedToGetUserInfo:"Kullanıcı bilgisi alınamadı",failedToGetUserStats:"Kullanıcı istatistikleri alınamadı",marketServerNameRequired:"Sunucu adı gereklidir",marketServerNotFound:"Market sunucusu bulunamadı",failedToGetMarketServers:"Market sunucuları bilgisi alınamadı",failedToGetMarketServer:"Market sunucusu bilgisi alınamadı",failedToGetMarketCategories:"Market kategorileri alınamadı",failedToGetMarketTags:"Market etiketleri alınamadı",failedToSearchMarketServers:"Market sunucuları aranamadı",failedToFilterMarketServers:"Market sunucuları filtrelenemedi",failedToProcessMcpbFile:"MCPB dosyası işlenemedi"},success:{serverCreated:"Sunucu başarıyla oluşturuldu",serverUpdated:"Sunucu başarıyla güncellendi",serverRemoved:"Sunucu başarıyla kaldırıldı",serverToggled:"Sunucu durumu başarıyla değiştirildi",toolToggled:"{{name}} aracı başarıyla {{action}}",toolDescriptionUpdated:"{{name}} aracının açıklaması başarıyla güncellendi",systemConfigUpdated:"Sistem yapılandırması başarıyla güncellendi",groupCreated:"Grup başarıyla oluşturuldu",groupUpdated:"Grup başarıyla güncellendi",groupDeleted:"Grup başarıyla silindi",serverAddedToGroup:"Sunucu başarıyla gruba eklendi",serverRemovedFromGroup:"Sunucu başarıyla gruptan kaldırıldı",serverToolsUpdated:"Sunucu araçları başarıyla güncellendi"}},JC={authorizationFailed:"Yetkilendirme Başarısız",authorizationFailedError:"Hata",authorizationFailedDetails:"Detaylar",invalidRequest:"Geçersiz İstek",missingStateParameter:"Gerekli OAuth durum parametresi eksik.",missingCodeParameter:"Gerekli yetkilendirme kodu parametresi eksik.",serverNotFound:"Sunucu Bulunamadı",serverNotFoundMessage:"Bu yetkilendirme isteğiyle ilişkili sunucu bulunamadı.",sessionExpiredMessage:"Yetkilendirme oturumunun süresi dolmuş olabilir. Lütfen tekrar yetkilendirmeyi deneyin.",authorizationSuccessful:"Yetkilendirme Başarılı",server:"Sunucu",status:"Durum",connected:"Bağlandı",successMessage:"Sunucu başarıyla yetkilendirildi ve bağlandı.",autoCloseMessage:"Bu pencere 3 saniye içinde otomatik olarak kapanacak...",closeNow:"Şimdi Kapat",connectionError:"Bağlantı Hatası",connectionErrorMessage:"Yetkilendirme başarılı oldu, ancak sunucuya bağlanılamadı.",reconnectMessage:"Lütfen kontrol panelinden yeniden bağlanmayı deneyin.",configurationError:"Yapılandırma Hatası",configurationErrorMessage:"Sunucu aktarımı OAuth finishAuth() desteklemiyor. Lütfen sunucunun streamable-http aktarımıyla yapılandırıldığından emin olun.",internalError:"İçsel Hata",internalErrorMessage:"OAuth geri araması işlenirken beklenmeyen bir hata oluştu.",closeWindow:"Pencereyi Kapat"},QC={add:"Prompt Ekle",addNew:"Yeni Prompt Ekle",edit:"Promptu Düzenle",delete:"Sil",noPrompts:"Yerleşik prompt yapılandırılmamış",addFirst:"İlk promptunuzu ekleyin",name:"Ad",namePlaceholder:"örn. code-review",title:"Başlık",titlePlaceholder:"örn. Kod İnceleme Promptu",description:"Açıklama",descriptionPlaceholder:"Promptun kısa açıklaması",template:"Şablon",templatePlaceholder:"{{parametre}} yer tutucularıyla şablon metni girin...",templateHint:"Şablon parametreleri için {{paramName}} kullanın",arguments:"Argümanlar",addArgument:"Argüman Ekle",argName:"Ad",argDescription:"Açıklama",argRequired:"Zorunlu",enabled:"Etkin",active:"Aktif",inactive:"İnaktif",nameRequired:"Ad zorunludur",templateRequired:"Şablon zorunludur",fetchError:"Yerleşik promptlar yüklenemedi",createError:"Prompt oluşturulamadı",updateError:"Prompt güncellenemedi",deleteError:"Prompt silinemedi",saveError:"Prompt kaydedilemedi",confirmDelete:"Promptu Sil",deleteWarning:'"{{name}}" promptunu silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.'},XC={add:"Kaynak Ekle",addNew:"Yeni Kaynak Ekle",edit:"Kaynağı Düzenle",delete:"Sil",noResources:"Yerleşik kaynak yapılandırılmamış",addFirst:"İlk kaynağınızı ekleyin",uri:"URI",uriPlaceholder:"örn. resource://docs/guide",name:"Ad",namePlaceholder:"örn. Kullanıcı Kılavuzu",description:"Açıklama",descriptionPlaceholder:"Kaynağın kısa açıklaması",mimeType:"MIME Türü",content:"İçerik",contentPlaceholder:"Kaynak içeriğini girin...",enabled:"Etkin",active:"Aktif",inactive:"İnaktif",descriptionUpdateSuccess:"Kaynak açıklaması başarıyla güncellendi",descriptionUpdateFailed:"Kaynak açıklaması güncellenemedi",restoreDefault:"Varsayılana dön",restoreDefaultSuccess:"Kaynak açıklaması varsayılan değere döndürüldü",restoreDefaultFailed:"Varsayılan kaynak açıklamasına dönülemedi",uriRequired:"URI zorunludur",contentRequired:"İçerik zorunludur",fetchError:"Yerleşik kaynaklar yüklenemedi",createError:"Kaynak oluşturulamadı",updateError:"Kaynak güncellenemedi",deleteError:"Kaynak silinemedi",saveError:"Kaynak kaydedilemedi",confirmDelete:"Kaynağı Sil",deleteWarning:'"{{name}}" kaynağını silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.'},ZC={title:"Etkinlik",totalCalls:"Toplam çağrı",successCount:"Başarılı",errorCount:"Başarısız",avgDuration:"Ort. süre",timestamp:"Zaman damgası",server:"Sunucu",tool:"Araç",duration:"Süre",status:"Durum",group:"Grup",key:"API Anahtarı",input:"Girdi",output:"Çıktı",details:"Etkinlik detayları",errorMessage:"Hata mesajı",searchServer:"Sunucu...",searchTool:"Araç...",searchStatus:"Durum...",searchGroup:"Grup...",searchKeyName:"API anahtarı...",keyName:"API Anahtarı Adı",allStatus:"Tüm durumlar",statusSuccess:"Başarılı",statusError:"Hata",noData:"Kullanılabilir etkinlik verisi yok",fetchError:"Etkinlik verileri yüklenemedi",cleanup:"Temizle",confirmCleanup:"30 günden eski etkinlikleri silmek istediğinizden emin misiniz?",cleanupSuccess:"{{count}} eski etkinlik silindi",cleanupError:"Eski etkinlikler temizlenemedi",notAvailable:"Etkinlik takibi yalnızca veritabanı modunda kullanılabilir"},WC={exportButton:"Şablon Dışa Aktar",importButton:"Şablon İçe Aktar",exportTitle:"Yapılandırma Şablonunu Dışa Aktar",importTitle:"Yapılandırma Şablonunu İçe Aktar",name:"Şablon Adı",nameRequired:"Şablon adı gereklidir",namePlaceholder:"Ör: Frontend Geliştirme Araçları",description:"Açıklama",descriptionPlaceholder:"Ör: Frontend geliştirme için standart MCP sunucuları",selectGroups:"Grupları Seç",selectGroupsHelp:"Tüm grupları dışa aktarmak için boş bırakın",selectAll:"Tümünü Seç",deselectAll:"Tümünü Kaldır",includeDisabled:"Devre dışı sunucuları dahil et",exportNote:"Gizli bilgiler (API anahtarları, tokenlar, parolalar) ${PLACEHOLDER} referanslarıyla değiştirilecektir. Alıcıların kendi kimlik bilgilerini sağlaması gerekir.",export:"Dışa Aktar",exporting:"Dışa aktarılıyor...",exportFailed:"Şablon dışa aktarılamadı",import:"İçe Aktar",importing:"İçe aktarılıyor...",importFailed:"Şablon içe aktarılamadı",invalidFormat:"Geçersiz şablon formatı. version, name, servers ve groups alanlarını içermelidir.",parseError:"JSON ayrıştırılamadı. Lütfen formatı kontrol edip tekrar deneyin.",uploadFile:"Şablon Dosyası Yükle",or:"veya",pasteJson:"Şablon JSON Yapıştır",pastePlaceholder:".mcphub-template.json içeriğinizi buraya yapıştırın...",version:"Sürüm",createdAt:"Oluşturulma",servers:"Sunucular",groups:"Gruplar",serversInGroup:"sunucu",envVarsNeeded:"Gerekli Ortam Değişkenleri — içe aktarılan sunucuları kullanmadan önce bunları ayarlayın:",importResult:"Sunucular: {{serversCreated}} oluşturuldu, {{serversSkipped}} atlandı. Gruplar: {{groupsCreated}} oluşturuldu, {{groupsSkipped}} atlandı."},e3={app:vC,about:wC,profile:jC,sponsor:SC,wechat:NC,discord:kC,theme:CC,auth:AC,server:EC,status:RC,errors:TC,common:OC,pagination:zC,nav:MC,pages:PC,logs:DC,groups:LC,market:UC,oauthServer:_C,cloud:BC,registry:IC,tool:FC,prompt:HC,settings:qC,mcpb:GC,jsonImport:KC,groupImport:VC,users:$C,api:YC,oauthCallback:JC,builtinPrompts:QC,builtinResources:XC,activity:ZC,template:WC};er.use(dx).use($2).init({resources:{en:{translation:a4},zh:{translation:_4},fr:{translation:bC},tr:{translation:e3}},fallbackLng:"en",debug:!1,defaultNS:"translation",interpolation:{escapeValue:!1},detection:{order:["localStorage","cookie","htmlTag","navigator"],caches:["localStorage","cookie"]}});const t3=()=>{x1()};t3();async function r3(){try{console.log("Loading runtime configuration...");const a=await g1();console.log("Runtime configuration loaded:",a),window.__MCPHUB_CONFIG__=a,_f.createRoot(document.getElementById("root")).render(t.jsx(Ra.StrictMode,{children:t.jsx(vh,{})}))}catch(a){console.error("Failed to initialize app:",a),console.log("Starting app with default configuration..."),window.__MCPHUB_CONFIG__={basePath:"",version:"dev",name:"mcphub"},_f.createRoot(document.getElementById("root")).render(t.jsx(Ra.StrictMode,{children:t.jsx(vh,{})}))}}r3();export{Yr as a,pt as b,At as c};
|
|
323
|
+
//# sourceMappingURL=index-CVDuCISB.js.map
|