@sap-ux/fiori-mcp-server 0.6.38 → 0.6.39

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.
Binary file
@@ -0,0 +1,19 @@
1
+ <svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M434.816 791.6C443.096 772.918 464.954 764.485 483.636 772.765L486.43 774.004C502.701 781.216 521.264 781.208 537.529 773.984L748.185 680.425C738.263 669.901 735.049 654.052 741.287 640.006C749.581 621.331 771.445 612.916 790.12 621.21L810.358 630.198C855.249 650.135 855.249 713.845 810.358 733.782L567.566 841.614C532.195 857.323 491.83 857.339 456.447 841.657L453.652 840.419C434.97 832.139 426.537 810.282 434.816 791.6ZM213.642 733.782C169.102 714.001 168.754 651.128 212.598 630.673L213.642 630.198L233.88 621.21C252.555 612.916 274.419 621.331 282.713 640.006C288.951 654.053 285.736 669.901 275.813 680.425L284.156 684.129C302.831 692.424 311.246 714.287 302.952 732.963C294.658 751.638 272.794 760.054 254.118 751.76L213.642 733.782Z" fill="url(#paint0_radial_755_542)"/>
3
+ <path d="M213.642 563.782C169.102 544 168.754 481.128 212.598 460.673L213.642 460.198L233.88 451.21C252.556 442.916 274.419 451.331 282.713 470.006C288.952 484.053 285.736 499.901 275.813 510.425L486.428 603.965C502.709 611.196 521.29 611.196 537.571 603.966L618.289 568.116L620.397 567.157L620.397 420.131C620.397 399.697 636.963 383.131 657.398 383.131C677.832 383.131 694.398 399.697 694.398 420.131L694.397 534.314L748.186 510.425C738.263 499.901 735.049 484.052 741.287 470.006C749.582 451.331 771.445 442.916 790.12 451.21L810.359 460.198C855.249 480.135 855.249 543.845 810.359 563.782L688.927 617.714L688.708 617.812L672.361 624.818L648.599 635.625L567.608 671.595C532.204 687.32 491.797 687.319 456.392 671.595L407.33 649.806L407.33 763.168C407.33 783.602 390.765 800.168 370.33 800.168C349.896 800.168 333.33 783.602 333.33 763.168L333.329 616.939L213.642 563.782Z" fill="url(#paint1_radial_755_542)"/>
4
+ <path d="M214.32 394.083C169.521 374.187 169.171 310.949 213.269 290.375L214.32 289.897L456.392 182.385C491.797 166.661 532.204 166.661 567.608 182.385L809.651 289.884C854.816 309.943 854.799 374.048 809.623 394.083L766.898 413.032C748.218 421.316 726.359 412.888 718.075 394.208C709.791 375.528 718.218 353.669 736.898 345.385L744.606 341.966L537.572 250.015C521.291 242.784 502.709 242.784 486.428 250.015L279.339 341.99L486.541 434.016C502.75 441.215 521.25 441.215 537.46 434.016C556.135 425.721 577.998 434.137 586.292 452.813C594.586 471.488 586.171 493.351 567.496 501.646C532.163 517.338 491.838 517.338 456.505 501.646L214.32 394.083Z" fill="url(#paint2_radial_755_542)"/>
5
+ <defs>
6
+ <radialGradient id="paint0_radial_755_542" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(512 681.99) rotate(90) scale(164 323.818)">
7
+ <stop stop-color="#1348FF"/>
8
+ <stop offset="1" stop-color="#06238D"/>
9
+ </radialGradient>
10
+ <radialGradient id="paint1_radial_755_542" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(512 518.581) scale(552 360.409)">
11
+ <stop stop-color="#0195FF"/>
12
+ <stop offset="1" stop-color="#1147E9"/>
13
+ </radialGradient>
14
+ <radialGradient id="paint2_radial_755_542" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(512 341.99) rotate(90) scale(175 306)">
15
+ <stop stop-color="#1348FF"/>
16
+ <stop offset="1" stop-color="#06238D"/>
17
+ </radialGradient>
18
+ </defs>
19
+ </svg>
package/dist/icon.png ADDED
Binary file
package/dist/icon.svg ADDED
@@ -0,0 +1,19 @@
1
+ <svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M434.816 791.6C443.096 772.918 464.954 764.485 483.636 772.765L486.43 774.004C502.701 781.216 521.264 781.208 537.529 773.984L748.185 680.425C738.263 669.901 735.049 654.052 741.287 640.006C749.581 621.331 771.445 612.916 790.12 621.21L810.358 630.198C855.249 650.135 855.249 713.845 810.358 733.782L567.566 841.614C532.195 857.323 491.83 857.339 456.447 841.657L453.652 840.419C434.97 832.139 426.537 810.282 434.816 791.6ZM213.642 733.782C169.102 714.001 168.754 651.128 212.598 630.673L213.642 630.198L233.88 621.21C252.555 612.916 274.419 621.331 282.713 640.006C288.951 654.053 285.736 669.901 275.813 680.425L284.156 684.129C302.831 692.424 311.246 714.287 302.952 732.963C294.658 751.638 272.794 760.054 254.118 751.76L213.642 733.782Z" fill="url(#paint0_radial_755_542)"/>
3
+ <path d="M213.642 563.782C169.102 544 168.754 481.128 212.598 460.673L213.642 460.198L233.88 451.21C252.556 442.916 274.419 451.331 282.713 470.006C288.952 484.053 285.736 499.901 275.813 510.425L486.428 603.965C502.709 611.196 521.29 611.196 537.571 603.966L618.289 568.116L620.397 567.157L620.397 420.131C620.397 399.697 636.963 383.131 657.398 383.131C677.832 383.131 694.398 399.697 694.398 420.131L694.397 534.314L748.186 510.425C738.263 499.901 735.049 484.052 741.287 470.006C749.582 451.331 771.445 442.916 790.12 451.21L810.359 460.198C855.249 480.135 855.249 543.845 810.359 563.782L688.927 617.714L688.708 617.812L672.361 624.818L648.599 635.625L567.608 671.595C532.204 687.32 491.797 687.319 456.392 671.595L407.33 649.806L407.33 763.168C407.33 783.602 390.765 800.168 370.33 800.168C349.896 800.168 333.33 783.602 333.33 763.168L333.329 616.939L213.642 563.782Z" fill="url(#paint1_radial_755_542)"/>
4
+ <path d="M214.32 394.083C169.521 374.187 169.171 310.949 213.269 290.375L214.32 289.897L456.392 182.385C491.797 166.661 532.204 166.661 567.608 182.385L809.651 289.884C854.816 309.943 854.799 374.048 809.623 394.083L766.898 413.032C748.218 421.316 726.359 412.888 718.075 394.208C709.791 375.528 718.218 353.669 736.898 345.385L744.606 341.966L537.572 250.015C521.291 242.784 502.709 242.784 486.428 250.015L279.339 341.99L486.541 434.016C502.75 441.215 521.25 441.215 537.46 434.016C556.135 425.721 577.998 434.137 586.292 452.813C594.586 471.488 586.171 493.351 567.496 501.646C532.163 517.338 491.838 517.338 456.505 501.646L214.32 394.083Z" fill="url(#paint2_radial_755_542)"/>
5
+ <defs>
6
+ <radialGradient id="paint0_radial_755_542" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(512 681.99) rotate(90) scale(164 323.818)">
7
+ <stop stop-color="#1348FF"/>
8
+ <stop offset="1" stop-color="#06238D"/>
9
+ </radialGradient>
10
+ <radialGradient id="paint1_radial_755_542" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(512 518.581) scale(552 360.409)">
11
+ <stop stop-color="#0195FF"/>
12
+ <stop offset="1" stop-color="#1147E9"/>
13
+ </radialGradient>
14
+ <radialGradient id="paint2_radial_755_542" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(512 341.99) rotate(90) scale(175 306)">
15
+ <stop stop-color="#1348FF"/>
16
+ <stop offset="1" stop-color="#06238D"/>
17
+ </radialGradient>
18
+ </defs>
19
+ </svg>
package/dist/index.js CHANGED
@@ -1607,7 +1607,7 @@ ${n.message}`:d,T=[_,t,e].filter(Boolean).join(`
1607
1607
 
1608
1608
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let p=l[1];if(t===l[0]){o(l);continue}if(n.external){let h=n.external.registry.get(l[0])?.id;if(t!==l[0]&&h){o(l);continue}}if(this.metadataRegistry.get(l[0])?.id){o(l);continue}if(p.cycle){o(l);continue}if(p.count>1&&n.reused==="ref"){o(l);continue}}let s=(l,p)=>{let f=this.seen.get(l),h=f.def??f.schema,d={...h};if(f.ref===null)return;let m=f.ref;if(f.ref=null,m){s(m,p);let _=this.seen.get(m).schema;_.$ref&&(p.target==="draft-7"||p.target==="draft-4"||p.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(_)):(Object.assign(h,_),Object.assign(h,d))}f.isParent||this.override({zodSchema:l,jsonSchema:h,path:f.path??[]})};for(let l of[...this.seen.entries()].reverse())s(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?c.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,i.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let p=l[1];p.def&&p.defId&&(u[p.defId]=p.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function gS(e,t){if(e instanceof px){let n=new jL(t),i={};for(let s of e._idmap.entries()){let[c,u]=s;n.process(u)}let a={},o={registry:e,uri:t?.uri,defs:i};for(let s of e._idmap.entries()){let[c,u]=s;a[c]=n.emit(u,{...t,external:o})}if(Object.keys(i).length>0){let s=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:i}}return{schemas:a}}let r=new jL(t);return r.process(e),r.emit(e,t)}function nu(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return nu(n.element,r);if(n.type==="set")return nu(n.valueType,r);if(n.type==="lazy")return nu(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return nu(n.innerType,r);if(n.type==="intersection")return nu(n.left,r)||nu(n.right,r);if(n.type==="record"||n.type==="map")return nu(n.keyType,r)||nu(n.valueType,r);if(n.type==="pipe")return nu(n.in,r)||nu(n.out,r);if(n.type==="object"){for(let i in n.shape)if(nu(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(nu(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(nu(i,r))return!0;return!!(n.rest&&nu(n.rest,r))}return!1}var _4e={};function Cx(e){return!!e._zod}function z_(e,t){return Cx(e)?lS(e,t):e.safeParse(t)}function ZG(e){if(!e)return;let t;if(Cx(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function b4e(e){if(Cx(e)){let a=e._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var yS={};Fo(yS,{$brand:()=>rL,$input:()=>uG,$output:()=>cG,NEVER:()=>I3,TimePrecision:()=>dG,ZodAny:()=>D4e,ZodArray:()=>R4e,ZodBase64:()=>jce,ZodBase64URL:()=>qce,ZodBigInt:()=>YL,ZodBigIntFormat:()=>Hce,ZodBoolean:()=>zL,ZodCIDRv4:()=>Uce,ZodCIDRv6:()=>Vce,ZodCUID:()=>Ice,ZodCUID2:()=>Rce,ZodCatch:()=>X4e,ZodCodec:()=>Zce,ZodCustom:()=>fH,ZodCustomStringFormat:()=>GL,ZodDate:()=>uH,ZodDefault:()=>G4e,ZodDiscriminatedUnion:()=>L4e,ZodE164:()=>Bce,ZodEmail:()=>Pce,ZodEmoji:()=>Nce,ZodEnum:()=>qL,ZodError:()=>dce,ZodFile:()=>j4e,ZodFirstPartyTypeKind:()=>tue,ZodFunction:()=>aGe,ZodGUID:()=>iH,ZodIPv4:()=>kce,ZodIPv6:()=>Fce,ZodISODate:()=>tH,ZodISODateTime:()=>eH,ZodISODuration:()=>nH,ZodISOTime:()=>rH,ZodIntersection:()=>M4e,ZodIssueCode:()=>GTr,ZodJWT:()=>Gce,ZodKSUID:()=>$ce,ZodLazy:()=>rGe,ZodLiteral:()=>V4e,ZodMAC:()=>A4e,ZodMap:()=>F4e,ZodNaN:()=>Q4e,ZodNanoID:()=>wce,ZodNever:()=>w4e,ZodNonOptional:()=>Jce,ZodNull:()=>P4e,ZodNullable:()=>B4e,ZodNumber:()=>HL,ZodNumberFormat:()=>Px,ZodObject:()=>lH,ZodOptional:()=>Xce,ZodPipe:()=>Qce,ZodPrefault:()=>z4e,ZodPromise:()=>iGe,ZodReadonly:()=>Z4e,ZodRealError:()=>Hu,ZodRecord:()=>Kce,ZodSet:()=>U4e,ZodString:()=>BL,ZodStringFormat:()=>bi,ZodSuccess:()=>W4e,ZodSymbol:()=>C4e,ZodTemplateLiteral:()=>tGe,ZodTransform:()=>q4e,ZodTuple:()=>$4e,ZodType:()=>Nr,ZodULID:()=>Lce,ZodURL:()=>sH,ZodUUID:()=>py,ZodUndefined:()=>x4e,ZodUnion:()=>Yce,ZodUnknown:()=>N4e,ZodVoid:()=>I4e,ZodXID:()=>Mce,_ZodString:()=>xce,_default:()=>H4e,_function:()=>kTr,any:()=>cH,array:()=>qt,base64:()=>aTr,base64url:()=>oTr,bigint:()=>yTr,boolean:()=>ji,catch:()=>J4e,check:()=>FTr,cidrv4:()=>nTr,cidrv6:()=>iTr,clone:()=>Ds,codec:()=>LTr,coerce:()=>rue,config:()=>Oa,core:()=>sp,cuid:()=>WEr,cuid2:()=>XEr,custom:()=>eue,date:()=>STr,decode:()=>_ce,decodeAsync:()=>Tce,describe:()=>UTr,discriminatedUnion:()=>pH,e164:()=>sTr,email:()=>VEr,emoji:()=>YEr,encode:()=>vce,encodeAsync:()=>Ece,endsWith:()=>Ex,enum:()=>fi,file:()=>NTr,flattenError:()=>QC,float32:()=>dTr,float64:()=>hTr,formatError:()=>ZC,function:()=>kTr,getErrorMap:()=>zTr,globalRegistry:()=>sc,gt:()=>zh,gte:()=>cc,guid:()=>jEr,hash:()=>fTr,hex:()=>pTr,hostname:()=>lTr,httpUrl:()=>zEr,includes:()=>vx,instanceof:()=>jTr,int:()=>Cce,int32:()=>mTr,int64:()=>vTr,intersection:()=>WL,ipv4:()=>eTr,ipv6:()=>rTr,iso:()=>xx,json:()=>BTr,jwt:()=>cTr,keyof:()=>OTr,ksuid:()=>ZEr,lazy:()=>nGe,length:()=>hS,literal:()=>ht,locales:()=>lx,looseObject:()=>uc,lowercase:()=>gx,lt:()=>Hh,lte:()=>Gu,mac:()=>tTr,map:()=>xTr,maxLength:()=>dS,maxSize:()=>fS,meta:()=>VTr,mime:()=>Tx,minLength:()=>ly,minSize:()=>H_,multipleOf:()=>G_,nan:()=>RTr,nanoid:()=>KEr,nativeEnum:()=>DTr,negative:()=>qG,never:()=>zce,nonnegative:()=>GG,nonoptional:()=>K4e,nonpositive:()=>BG,normalize:()=>bx,null:()=>KL,nullable:()=>aH,nullish:()=>wTr,number:()=>Cn,object:()=>$e,optional:()=>Hn,overwrite:()=>Dd,parse:()=>hce,parseAsync:()=>mce,partialRecord:()=>CTr,pipe:()=>oH,positive:()=>jG,prefault:()=>Y4e,preprocess:()=>dH,prettifyError:()=>$3,promise:()=>$Tr,property:()=>HG,readonly:()=>eGe,record:()=>zn,refine:()=>oGe,regex:()=>mx,regexes:()=>Bu,registry:()=>_L,safeDecode:()=>Sce,safeDecodeAsync:()=>Ace,safeEncode:()=>bce,safeEncodeAsync:()=>Oce,safeParse:()=>gce,safeParseAsync:()=>yce,set:()=>PTr,setErrorMap:()=>HTr,size:()=>hx,slugify:()=>VL,startsWith:()=>_x,strictObject:()=>ATr,string:()=>te,stringFormat:()=>uTr,stringbool:()=>qTr,success:()=>ITr,superRefine:()=>sGe,symbol:()=>ETr,templateLiteral:()=>MTr,toJSONSchema:()=>gS,toLowerCase:()=>Ox,toUpperCase:()=>Ax,transform:()=>Wce,treeifyError:()=>M3,trim:()=>Sx,tuple:()=>k4e,uint32:()=>gTr,uint64:()=>_Tr,ulid:()=>JEr,undefined:()=>TTr,union:()=>hn,unknown:()=>Mn,uppercase:()=>yx,url:()=>Dce,util:()=>Ue,uuid:()=>qEr,uuidv4:()=>BEr,uuidv6:()=>GEr,uuidv7:()=>HEr,void:()=>bTr,xid:()=>QEr});var xx={};Fo(xx,{ZodISODate:()=>tH,ZodISODateTime:()=>eH,ZodISODuration:()=>nH,ZodISOTime:()=>rH,date:()=>lce,datetime:()=>uce,duration:()=>fce,time:()=>pce});var eH=ne("ZodISODateTime",(e,t)=>{l4.init(e,t),bi.init(e,t)});function uce(e){return hG(eH,e)}var tH=ne("ZodISODate",(e,t)=>{p4.init(e,t),bi.init(e,t)});function lce(e){return mG(tH,e)}var rH=ne("ZodISOTime",(e,t)=>{f4.init(e,t),bi.init(e,t)});function pce(e){return gG(rH,e)}var nH=ne("ZodISODuration",(e,t)=>{d4.init(e,t),bi.init(e,t)});function fce(e){return yG(nH,e)}var O4e=(e,t)=>{uL.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ZC(e,r)},flatten:{value:r=>QC(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,WC,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,WC,2)}},isEmpty:{get(){return e.issues.length===0}}})},dce=ne("ZodError",O4e),Hu=ne("ZodError",O4e,{Parent:Error});var hce=ex(Hu),mce=rx(Hu),gce=ix(Hu),yce=ax(Hu),vce=k3(Hu),_ce=F3(Hu),Ece=U3(Hu),Tce=V3(Hu),bce=j3(Hu),Sce=q3(Hu),Oce=B3(Hu),Ace=G3(Hu);var Nr=ne("ZodType",(e,t)=>(Jt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Ue.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>Ds(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>hce(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>gce(e,r,n),e.parseAsync=async(r,n)=>mce(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>yce(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>vce(e,r,n),e.decode=(r,n)=>_ce(e,r,n),e.encodeAsync=async(r,n)=>Ece(e,r,n),e.decodeAsync=async(r,n)=>Tce(e,r,n),e.safeEncode=(r,n)=>bce(e,r,n),e.safeDecode=(r,n)=>Sce(e,r,n),e.safeEncodeAsync=async(r,n)=>Oce(e,r,n),e.safeDecodeAsync=async(r,n)=>Ace(e,r,n),e.refine=(r,n)=>e.check(oGe(r,n)),e.superRefine=r=>e.check(sGe(r)),e.overwrite=r=>e.check(Dd(r)),e.optional=()=>Hn(e),e.nullable=()=>aH(e),e.nullish=()=>Hn(aH(e)),e.nonoptional=r=>K4e(e,r),e.array=()=>qt(e),e.or=r=>hn([e,r]),e.and=r=>WL(e,r),e.transform=r=>oH(e,Wce(r)),e.default=r=>H4e(e,r),e.prefault=r=>Y4e(e,r),e.catch=r=>J4e(e,r),e.pipe=r=>oH(e,r),e.readonly=()=>eGe(e),e.describe=r=>{let n=e.clone();return sc.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return sc.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return sc.get(e);let n=e.clone();return sc.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),xce=ne("_ZodString",(e,t)=>{B_.init(e,t),Nr.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(mx(...n)),e.includes=(...n)=>e.check(vx(...n)),e.startsWith=(...n)=>e.check(_x(...n)),e.endsWith=(...n)=>e.check(Ex(...n)),e.min=(...n)=>e.check(ly(...n)),e.max=(...n)=>e.check(dS(...n)),e.length=(...n)=>e.check(hS(...n)),e.nonempty=(...n)=>e.check(ly(1,...n)),e.lowercase=n=>e.check(gx(n)),e.uppercase=n=>e.check(yx(n)),e.trim=()=>e.check(Sx()),e.normalize=(...n)=>e.check(bx(...n)),e.toLowerCase=()=>e.check(Ox()),e.toUpperCase=()=>e.check(Ax()),e.slugify=()=>e.check(VL())}),BL=ne("ZodString",(e,t)=>{B_.init(e,t),xce.init(e,t),e.email=r=>e.check(EL(Pce,r)),e.url=r=>e.check(dx(sH,r)),e.jwt=r=>e.check(UL(Gce,r)),e.emoji=r=>e.check(AL(Nce,r)),e.guid=r=>e.check(fx(iH,r)),e.uuid=r=>e.check(TL(py,r)),e.uuidv4=r=>e.check(bL(py,r)),e.uuidv6=r=>e.check(SL(py,r)),e.uuidv7=r=>e.check(OL(py,r)),e.nanoid=r=>e.check(CL(wce,r)),e.guid=r=>e.check(fx(iH,r)),e.cuid=r=>e.check(xL(Ice,r)),e.cuid2=r=>e.check(PL(Rce,r)),e.ulid=r=>e.check(DL(Lce,r)),e.base64=r=>e.check($L(jce,r)),e.base64url=r=>e.check(kL(qce,r)),e.xid=r=>e.check(NL(Mce,r)),e.ksuid=r=>e.check(wL($ce,r)),e.ipv4=r=>e.check(IL(kce,r)),e.ipv6=r=>e.check(RL(Fce,r)),e.cidrv4=r=>e.check(LL(Uce,r)),e.cidrv6=r=>e.check(ML(Vce,r)),e.e164=r=>e.check(FL(Bce,r)),e.datetime=r=>e.check(uce(r)),e.date=r=>e.check(lce(r)),e.time=r=>e.check(pce(r)),e.duration=r=>e.check(fce(r))});function te(e){return lG(BL,e)}var bi=ne("ZodStringFormat",(e,t)=>{ri.init(e,t),xce.init(e,t)}),Pce=ne("ZodEmail",(e,t)=>{t4.init(e,t),bi.init(e,t)});function VEr(e){return EL(Pce,e)}var iH=ne("ZodGUID",(e,t)=>{Z3.init(e,t),bi.init(e,t)});function jEr(e){return fx(iH,e)}var py=ne("ZodUUID",(e,t)=>{e4.init(e,t),bi.init(e,t)});function qEr(e){return TL(py,e)}function BEr(e){return bL(py,e)}function GEr(e){return SL(py,e)}function HEr(e){return OL(py,e)}var sH=ne("ZodURL",(e,t)=>{r4.init(e,t),bi.init(e,t)});function Dce(e){return dx(sH,e)}function zEr(e){return dx(sH,{protocol:/^https?$/,hostname:Bu.domain,...Ue.normalizeParams(e)})}var Nce=ne("ZodEmoji",(e,t)=>{n4.init(e,t),bi.init(e,t)});function YEr(e){return AL(Nce,e)}var wce=ne("ZodNanoID",(e,t)=>{i4.init(e,t),bi.init(e,t)});function KEr(e){return CL(wce,e)}var Ice=ne("ZodCUID",(e,t)=>{a4.init(e,t),bi.init(e,t)});function WEr(e){return xL(Ice,e)}var Rce=ne("ZodCUID2",(e,t)=>{o4.init(e,t),bi.init(e,t)});function XEr(e){return PL(Rce,e)}var Lce=ne("ZodULID",(e,t)=>{s4.init(e,t),bi.init(e,t)});function JEr(e){return DL(Lce,e)}var Mce=ne("ZodXID",(e,t)=>{c4.init(e,t),bi.init(e,t)});function QEr(e){return NL(Mce,e)}var $ce=ne("ZodKSUID",(e,t)=>{u4.init(e,t),bi.init(e,t)});function ZEr(e){return wL($ce,e)}var kce=ne("ZodIPv4",(e,t)=>{h4.init(e,t),bi.init(e,t)});function eTr(e){return IL(kce,e)}var A4e=ne("ZodMAC",(e,t)=>{g4.init(e,t),bi.init(e,t)});function tTr(e){return fG(A4e,e)}var Fce=ne("ZodIPv6",(e,t)=>{m4.init(e,t),bi.init(e,t)});function rTr(e){return RL(Fce,e)}var Uce=ne("ZodCIDRv4",(e,t)=>{y4.init(e,t),bi.init(e,t)});function nTr(e){return LL(Uce,e)}var Vce=ne("ZodCIDRv6",(e,t)=>{v4.init(e,t),bi.init(e,t)});function iTr(e){return ML(Vce,e)}var jce=ne("ZodBase64",(e,t)=>{_4.init(e,t),bi.init(e,t)});function aTr(e){return $L(jce,e)}var qce=ne("ZodBase64URL",(e,t)=>{E4.init(e,t),bi.init(e,t)});function oTr(e){return kL(qce,e)}var Bce=ne("ZodE164",(e,t)=>{T4.init(e,t),bi.init(e,t)});function sTr(e){return FL(Bce,e)}var Gce=ne("ZodJWT",(e,t)=>{b4.init(e,t),bi.init(e,t)});function cTr(e){return UL(Gce,e)}var GL=ne("ZodCustomStringFormat",(e,t)=>{S4.init(e,t),bi.init(e,t)});function uTr(e,t,r={}){return mS(GL,e,t,r)}function lTr(e){return mS(GL,"hostname",Bu.hostname,e)}function pTr(e){return mS(GL,"hex",Bu.hex,e)}function fTr(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=Bu[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return mS(GL,n,i,t)}var HL=ne("ZodNumber",(e,t)=>{dL.init(e,t),Nr.init(e,t),e.gt=(n,i)=>e.check(zh(n,i)),e.gte=(n,i)=>e.check(cc(n,i)),e.min=(n,i)=>e.check(cc(n,i)),e.lt=(n,i)=>e.check(Hh(n,i)),e.lte=(n,i)=>e.check(Gu(n,i)),e.max=(n,i)=>e.check(Gu(n,i)),e.int=n=>e.check(Cce(n)),e.safe=n=>e.check(Cce(n)),e.positive=n=>e.check(zh(0,n)),e.nonnegative=n=>e.check(cc(0,n)),e.negative=n=>e.check(Hh(0,n)),e.nonpositive=n=>e.check(Gu(0,n)),e.multipleOf=(n,i)=>e.check(G_(n,i)),e.step=(n,i)=>e.check(G_(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Cn(e){return vG(HL,e)}var Px=ne("ZodNumberFormat",(e,t)=>{O4.init(e,t),HL.init(e,t)});function Cce(e){return EG(Px,e)}function dTr(e){return TG(Px,e)}function hTr(e){return bG(Px,e)}function mTr(e){return SG(Px,e)}function gTr(e){return OG(Px,e)}var zL=ne("ZodBoolean",(e,t)=>{cx.init(e,t),Nr.init(e,t)});function ji(e){return AG(zL,e)}var YL=ne("ZodBigInt",(e,t)=>{hL.init(e,t),Nr.init(e,t),e.gte=(n,i)=>e.check(cc(n,i)),e.min=(n,i)=>e.check(cc(n,i)),e.gt=(n,i)=>e.check(zh(n,i)),e.gte=(n,i)=>e.check(cc(n,i)),e.min=(n,i)=>e.check(cc(n,i)),e.lt=(n,i)=>e.check(Hh(n,i)),e.lte=(n,i)=>e.check(Gu(n,i)),e.max=(n,i)=>e.check(Gu(n,i)),e.positive=n=>e.check(zh(BigInt(0),n)),e.negative=n=>e.check(Hh(BigInt(0),n)),e.nonpositive=n=>e.check(Gu(BigInt(0),n)),e.nonnegative=n=>e.check(cc(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(G_(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function yTr(e){return xG(YL,e)}var Hce=ne("ZodBigIntFormat",(e,t)=>{A4.init(e,t),YL.init(e,t)});function vTr(e){return DG(Hce,e)}function _Tr(e){return NG(Hce,e)}var C4e=ne("ZodSymbol",(e,t)=>{C4.init(e,t),Nr.init(e,t)});function ETr(e){return wG(C4e,e)}var x4e=ne("ZodUndefined",(e,t)=>{x4.init(e,t),Nr.init(e,t)});function TTr(e){return IG(x4e,e)}var P4e=ne("ZodNull",(e,t)=>{P4.init(e,t),Nr.init(e,t)});function KL(e){return RG(P4e,e)}var D4e=ne("ZodAny",(e,t)=>{D4.init(e,t),Nr.init(e,t)});function cH(){return LG(D4e)}var N4e=ne("ZodUnknown",(e,t)=>{N4.init(e,t),Nr.init(e,t)});function Mn(){return MG(N4e)}var w4e=ne("ZodNever",(e,t)=>{w4.init(e,t),Nr.init(e,t)});function zce(e){return $G(w4e,e)}var I4e=ne("ZodVoid",(e,t)=>{I4.init(e,t),Nr.init(e,t)});function bTr(e){return kG(I4e,e)}var uH=ne("ZodDate",(e,t)=>{R4.init(e,t),Nr.init(e,t),e.min=(n,i)=>e.check(cc(n,i)),e.max=(n,i)=>e.check(Gu(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function STr(e){return FG(uH,e)}var R4e=ne("ZodArray",(e,t)=>{L4.init(e,t),Nr.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(ly(r,n)),e.nonempty=r=>e.check(ly(1,r)),e.max=(r,n)=>e.check(dS(r,n)),e.length=(r,n)=>e.check(hS(r,n)),e.unwrap=()=>e.element});function qt(e,t){return cce(R4e,e,t)}function OTr(e){let t=e._zod.def.shape;return fi(Object.keys(t))}var lH=ne("ZodObject",(e,t)=>{sce.init(e,t),Nr.init(e,t),Ue.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>fi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Mn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Mn()}),e.strict=()=>e.clone({...e._zod.def,catchall:zce()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Ue.extend(e,r),e.safeExtend=r=>Ue.safeExtend(e,r),e.merge=r=>Ue.merge(e,r),e.pick=r=>Ue.pick(e,r),e.omit=r=>Ue.omit(e,r),e.partial=(...r)=>Ue.partial(Xce,e,r[0]),e.required=(...r)=>Ue.required(Jce,e,r[0])});function $e(e,t){let r={type:"object",shape:e??{},...Ue.normalizeParams(t)};return new lH(r)}function ATr(e,t){return new lH({type:"object",shape:e,catchall:zce(),...Ue.normalizeParams(t)})}function uc(e,t){return new lH({type:"object",shape:e,catchall:Mn(),...Ue.normalizeParams(t)})}var Yce=ne("ZodUnion",(e,t)=>{mL.init(e,t),Nr.init(e,t),e.options=t.options});function hn(e,t){return new Yce({type:"union",options:e,...Ue.normalizeParams(t)})}var L4e=ne("ZodDiscriminatedUnion",(e,t)=>{Yce.init(e,t),M4.init(e,t)});function pH(e,t,r){return new L4e({type:"union",options:t,discriminator:e,...Ue.normalizeParams(r)})}var M4e=ne("ZodIntersection",(e,t)=>{$4.init(e,t),Nr.init(e,t)});function WL(e,t){return new M4e({type:"intersection",left:e,right:t})}var $4e=ne("ZodTuple",(e,t)=>{gL.init(e,t),Nr.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function k4e(e,t,r){let n=t instanceof Jt,i=n?r:t,a=n?t:null;return new $4e({type:"tuple",items:e,rest:a,...Ue.normalizeParams(i)})}var Kce=ne("ZodRecord",(e,t)=>{k4.init(e,t),Nr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function zn(e,t,r){return new Kce({type:"record",keyType:e,valueType:t,...Ue.normalizeParams(r)})}function CTr(e,t,r){let n=Ds(e);return n._zod.values=void 0,new Kce({type:"record",keyType:n,valueType:t,...Ue.normalizeParams(r)})}var F4e=ne("ZodMap",(e,t)=>{F4.init(e,t),Nr.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function xTr(e,t,r){return new F4e({type:"map",keyType:e,valueType:t,...Ue.normalizeParams(r)})}var U4e=ne("ZodSet",(e,t)=>{U4.init(e,t),Nr.init(e,t),e.min=(...r)=>e.check(H_(...r)),e.nonempty=r=>e.check(H_(1,r)),e.max=(...r)=>e.check(fS(...r)),e.size=(...r)=>e.check(hx(...r))});function PTr(e,t){return new U4e({type:"set",valueType:e,...Ue.normalizeParams(t)})}var qL=ne("ZodEnum",(e,t)=>{V4.init(e,t),Nr.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let a={};for(let o of n)if(r.has(o))a[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new qL({...t,checks:[],...Ue.normalizeParams(i),entries:a})},e.exclude=(n,i)=>{let a={...t.entries};for(let o of n)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new qL({...t,checks:[],...Ue.normalizeParams(i),entries:a})}});function fi(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new qL({type:"enum",entries:r,...Ue.normalizeParams(t)})}function DTr(e,t){return new qL({type:"enum",entries:e,...Ue.normalizeParams(t)})}var V4e=ne("ZodLiteral",(e,t)=>{j4.init(e,t),Nr.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ht(e,t){return new V4e({type:"literal",values:Array.isArray(e)?e:[e],...Ue.normalizeParams(t)})}var j4e=ne("ZodFile",(e,t)=>{q4.init(e,t),Nr.init(e,t),e.min=(r,n)=>e.check(H_(r,n)),e.max=(r,n)=>e.check(fS(r,n)),e.mime=(r,n)=>e.check(Tx(Array.isArray(r)?r:[r],n))});function NTr(e){return zG(j4e,e)}var q4e=ne("ZodTransform",(e,t)=>{B4.init(e,t),Nr.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new k_(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(Ue.issue(a,r.value,t));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(Ue.issue(o))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(a=>(r.value=a,r)):(r.value=i,r)}});function Wce(e){return new q4e({type:"transform",transform:e})}var Xce=ne("ZodOptional",(e,t)=>{G4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Hn(e){return new Xce({type:"optional",innerType:e})}var B4e=ne("ZodNullable",(e,t)=>{H4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function aH(e){return new B4e({type:"nullable",innerType:e})}function wTr(e){return Hn(aH(e))}var G4e=ne("ZodDefault",(e,t)=>{z4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function H4e(e,t){return new G4e({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ue.shallowClone(t)}})}var z4e=ne("ZodPrefault",(e,t)=>{Y4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Y4e(e,t){return new z4e({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ue.shallowClone(t)}})}var Jce=ne("ZodNonOptional",(e,t)=>{K4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function K4e(e,t){return new Jce({type:"nonoptional",innerType:e,...Ue.normalizeParams(t)})}var W4e=ne("ZodSuccess",(e,t)=>{W4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ITr(e){return new W4e({type:"success",innerType:e})}var X4e=ne("ZodCatch",(e,t)=>{X4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function J4e(e,t){return new X4e({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Q4e=ne("ZodNaN",(e,t)=>{J4.init(e,t),Nr.init(e,t)});function RTr(e){return VG(Q4e,e)}var Qce=ne("ZodPipe",(e,t)=>{Q4.init(e,t),Nr.init(e,t),e.in=t.in,e.out=t.out});function oH(e,t){return new Qce({type:"pipe",in:e,out:t})}var Zce=ne("ZodCodec",(e,t)=>{Qce.init(e,t),ux.init(e,t)});function LTr(e,t,r){return new Zce({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Z4e=ne("ZodReadonly",(e,t)=>{Z4.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eGe(e){return new Z4e({type:"readonly",innerType:e})}var tGe=ne("ZodTemplateLiteral",(e,t)=>{eG.init(e,t),Nr.init(e,t)});function MTr(e,t){return new tGe({type:"template_literal",parts:e,...Ue.normalizeParams(t)})}var rGe=ne("ZodLazy",(e,t)=>{nG.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.getter()});function nGe(e){return new rGe({type:"lazy",getter:e})}var iGe=ne("ZodPromise",(e,t)=>{rG.init(e,t),Nr.init(e,t),e.unwrap=()=>e._zod.def.innerType});function $Tr(e){return new iGe({type:"promise",innerType:e})}var aGe=ne("ZodFunction",(e,t)=>{tG.init(e,t),Nr.init(e,t)});function kTr(e){return new aGe({type:"function",input:Array.isArray(e?.input)?k4e(e?.input):e?.input??qt(Mn()),output:e?.output??Mn()})}var fH=ne("ZodCustom",(e,t)=>{iG.init(e,t),Nr.init(e,t)});function FTr(e){let t=new pi({check:"custom"});return t._zod.check=e,t}function eue(e,t){return YG(fH,e??(()=>!0),t)}function oGe(e,t={}){return KG(fH,e,t)}function sGe(e){return WG(e)}var UTr=XG,VTr=JG;function jTr(e,t={error:`Input not instance of ${e.name}`}){let r=new fH({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Ue.normalizeParams(t)});return r._zod.bag.Class=e,r}var qTr=(...e)=>QG({Codec:Zce,Boolean:zL,String:BL},...e);function BTr(e){let t=nGe(()=>hn([te(e),Cn(),ji(),KL(),qt(t),zn(te(),t)]));return t}function dH(e,t){return oH(Wce(e),t)}var GTr={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function HTr(e){Oa({customError:e})}function zTr(){return Oa().customError}var tue;tue||(tue={});var rue={};Fo(rue,{bigint:()=>XTr,boolean:()=>WTr,date:()=>JTr,number:()=>KTr,string:()=>YTr});function YTr(e){return pG(BL,e)}function KTr(e){return _G(HL,e)}function WTr(e){return CG(zL,e)}function XTr(e){return PG(YL,e)}function JTr(e){return UG(uH,e)}Oa(aG());var iue="2025-11-25";var cGe=[iue,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Y_="io.modelcontextprotocol/related-task",mH="2.0",Ns=eue(e=>e!==null&&(typeof e=="object"||typeof e=="function")),uGe=hn([te(),Cn().int()]),lGe=te(),MCi=uc({ttl:hn([Cn(),KL()]).optional(),pollInterval:Cn().optional()}),ZTr=$e({ttl:Cn().optional()}),ebr=$e({taskId:te()}),aue=uc({progressToken:uGe.optional(),[Y_]:ebr.optional()}),cp=$e({_meta:aue.optional()}),XL=cp.extend({task:ZTr.optional()}),pGe=e=>XL.safeParse(e).success,ws=$e({method:te(),params:cp.loose().optional()}),Qp=$e({_meta:aue.optional()}),Zp=$e({method:te(),params:Qp.loose().optional()}),Is=uc({_meta:aue.optional()}),gH=hn([te(),Cn().int()]),fGe=$e({jsonrpc:ht(mH),id:gH,...ws.shape}).strict(),oue=e=>fGe.safeParse(e).success,dGe=$e({jsonrpc:ht(mH),...Zp.shape}).strict(),hGe=e=>dGe.safeParse(e).success,sue=$e({jsonrpc:ht(mH),id:gH,result:Is}).strict(),JL=e=>sue.safeParse(e).success;var on;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(on||(on={}));var cue=$e({jsonrpc:ht(mH),id:gH.optional(),error:$e({code:Cn().int(),message:te(),data:Mn().optional()})}).strict();var mGe=e=>cue.safeParse(e).success;var gGe=hn([fGe,dGe,sue,cue]),$Ci=hn([sue,cue]),yH=Is.strict(),tbr=Qp.extend({requestId:gH.optional(),reason:te().optional()}),vH=Zp.extend({method:ht("notifications/cancelled"),params:tbr}),rbr=$e({src:te(),mimeType:te().optional(),sizes:qt(te()).optional(),theme:fi(["light","dark"]).optional()}),QL=$e({icons:qt(rbr).optional()}),Dx=$e({name:te(),title:te().optional()}),yGe=Dx.extend({...Dx.shape,...QL.shape,version:te(),websiteUrl:te().optional(),description:te().optional()}),nbr=WL($e({applyDefaults:ji().optional()}),zn(te(),Mn())),ibr=dH(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,WL($e({form:nbr.optional(),url:Ns.optional()}),zn(te(),Mn()).optional())),abr=uc({list:Ns.optional(),cancel:Ns.optional(),requests:uc({sampling:uc({createMessage:Ns.optional()}).optional(),elicitation:uc({create:Ns.optional()}).optional()}).optional()}),obr=uc({list:Ns.optional(),cancel:Ns.optional(),requests:uc({tools:uc({call:Ns.optional()}).optional()}).optional()}),sbr=$e({experimental:zn(te(),Ns).optional(),sampling:$e({context:Ns.optional(),tools:Ns.optional()}).optional(),elicitation:ibr.optional(),roots:$e({listChanged:ji().optional()}).optional(),tasks:abr.optional()}),cbr=cp.extend({protocolVersion:te(),capabilities:sbr,clientInfo:yGe}),ZL=ws.extend({method:ht("initialize"),params:cbr});var ubr=$e({experimental:zn(te(),Ns).optional(),logging:Ns.optional(),completions:Ns.optional(),prompts:$e({listChanged:ji().optional()}).optional(),resources:$e({subscribe:ji().optional(),listChanged:ji().optional()}).optional(),tools:$e({listChanged:ji().optional()}).optional(),tasks:obr.optional()}),lbr=Is.extend({protocolVersion:te(),capabilities:ubr,serverInfo:yGe,instructions:te().optional()}),uue=Zp.extend({method:ht("notifications/initialized"),params:Qp.optional()});var _H=ws.extend({method:ht("ping"),params:cp.optional()}),pbr=$e({progress:Cn(),total:Hn(Cn()),message:Hn(te())}),fbr=$e({...Qp.shape,...pbr.shape,progressToken:uGe}),EH=Zp.extend({method:ht("notifications/progress"),params:fbr}),dbr=cp.extend({cursor:lGe.optional()}),eM=ws.extend({params:dbr.optional()}),tM=Is.extend({nextCursor:lGe.optional()}),hbr=fi(["working","input_required","completed","failed","cancelled"]),rM=$e({taskId:te(),status:hbr,ttl:hn([Cn(),KL()]),createdAt:te(),lastUpdatedAt:te(),pollInterval:Hn(Cn()),statusMessage:Hn(te())}),Nx=Is.extend({task:rM}),mbr=Qp.merge(rM),nM=Zp.extend({method:ht("notifications/tasks/status"),params:mbr}),TH=ws.extend({method:ht("tasks/get"),params:cp.extend({taskId:te()})}),bH=Is.merge(rM),SH=ws.extend({method:ht("tasks/result"),params:cp.extend({taskId:te()})}),kCi=Is.loose(),OH=eM.extend({method:ht("tasks/list")}),AH=tM.extend({tasks:qt(rM)}),CH=ws.extend({method:ht("tasks/cancel"),params:cp.extend({taskId:te()})}),vGe=Is.merge(rM),_Ge=$e({uri:te(),mimeType:Hn(te()),_meta:zn(te(),Mn()).optional()}),EGe=_Ge.extend({text:te()}),lue=te().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),TGe=_Ge.extend({blob:lue}),iM=fi(["user","assistant"]),wx=$e({audience:qt(iM).optional(),priority:Cn().min(0).max(1).optional(),lastModified:xx.datetime({offset:!0}).optional()}),bGe=$e({...Dx.shape,...QL.shape,uri:te(),description:Hn(te()),mimeType:Hn(te()),annotations:wx.optional(),_meta:Hn(uc({}))}),gbr=$e({...Dx.shape,...QL.shape,uriTemplate:te(),description:Hn(te()),mimeType:Hn(te()),annotations:wx.optional(),_meta:Hn(uc({}))}),ybr=eM.extend({method:ht("resources/list")}),vbr=tM.extend({resources:qt(bGe)}),_br=eM.extend({method:ht("resources/templates/list")}),Ebr=tM.extend({resourceTemplates:qt(gbr)}),pue=cp.extend({uri:te()}),Tbr=pue,bbr=ws.extend({method:ht("resources/read"),params:Tbr}),Sbr=Is.extend({contents:qt(hn([EGe,TGe]))}),Obr=Zp.extend({method:ht("notifications/resources/list_changed"),params:Qp.optional()}),Abr=pue,Cbr=ws.extend({method:ht("resources/subscribe"),params:Abr}),xbr=pue,Pbr=ws.extend({method:ht("resources/unsubscribe"),params:xbr}),Dbr=Qp.extend({uri:te()}),Nbr=Zp.extend({method:ht("notifications/resources/updated"),params:Dbr}),wbr=$e({name:te(),description:Hn(te()),required:Hn(ji())}),Ibr=$e({...Dx.shape,...QL.shape,description:Hn(te()),arguments:Hn(qt(wbr)),_meta:Hn(uc({}))}),Rbr=eM.extend({method:ht("prompts/list")}),Lbr=tM.extend({prompts:qt(Ibr)}),Mbr=cp.extend({name:te(),arguments:zn(te(),te()).optional()}),$br=ws.extend({method:ht("prompts/get"),params:Mbr}),fue=$e({type:ht("text"),text:te(),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),due=$e({type:ht("image"),data:lue,mimeType:te(),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),hue=$e({type:ht("audio"),data:lue,mimeType:te(),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),kbr=$e({type:ht("tool_use"),name:te(),id:te(),input:zn(te(),Mn()),_meta:zn(te(),Mn()).optional()}),Fbr=$e({type:ht("resource"),resource:hn([EGe,TGe]),annotations:wx.optional(),_meta:zn(te(),Mn()).optional()}),Ubr=bGe.extend({type:ht("resource_link")}),mue=hn([fue,due,hue,Ubr,Fbr]),Vbr=$e({role:iM,content:mue}),jbr=Is.extend({description:te().optional(),messages:qt(Vbr)}),qbr=Zp.extend({method:ht("notifications/prompts/list_changed"),params:Qp.optional()}),Bbr=$e({title:te().optional(),readOnlyHint:ji().optional(),destructiveHint:ji().optional(),idempotentHint:ji().optional(),openWorldHint:ji().optional()}),Gbr=$e({taskSupport:fi(["required","optional","forbidden"]).optional()}),SGe=$e({...Dx.shape,...QL.shape,description:te().optional(),inputSchema:$e({type:ht("object"),properties:zn(te(),Ns).optional(),required:qt(te()).optional()}).catchall(Mn()),outputSchema:$e({type:ht("object"),properties:zn(te(),Ns).optional(),required:qt(te()).optional()}).catchall(Mn()).optional(),annotations:Bbr.optional(),execution:Gbr.optional(),_meta:zn(te(),Mn()).optional()}),gue=eM.extend({method:ht("tools/list")}),Hbr=tM.extend({tools:qt(SGe)}),xH=Is.extend({content:qt(mue).default([]),structuredContent:zn(te(),Mn()).optional(),isError:ji().optional()}),FCi=xH.or(Is.extend({toolResult:Mn()})),zbr=XL.extend({name:te(),arguments:zn(te(),Mn()).optional()}),aM=ws.extend({method:ht("tools/call"),params:zbr}),Ybr=Zp.extend({method:ht("notifications/tools/list_changed"),params:Qp.optional()}),UCi=$e({autoRefresh:ji().default(!0),debounceMs:Cn().int().nonnegative().default(300)}),oM=fi(["debug","info","notice","warning","error","critical","alert","emergency"]),Kbr=cp.extend({level:oM}),yue=ws.extend({method:ht("logging/setLevel"),params:Kbr}),Wbr=Qp.extend({level:oM,logger:te().optional(),data:Mn()}),Xbr=Zp.extend({method:ht("notifications/message"),params:Wbr}),Jbr=$e({name:te().optional()}),Qbr=$e({hints:qt(Jbr).optional(),costPriority:Cn().min(0).max(1).optional(),speedPriority:Cn().min(0).max(1).optional(),intelligencePriority:Cn().min(0).max(1).optional()}),Zbr=$e({mode:fi(["auto","required","none"]).optional()}),eSr=$e({type:ht("tool_result"),toolUseId:te().describe("The unique identifier for the corresponding tool call."),content:qt(mue).default([]),structuredContent:$e({}).loose().optional(),isError:ji().optional(),_meta:zn(te(),Mn()).optional()}),tSr=pH("type",[fue,due,hue]),hH=pH("type",[fue,due,hue,kbr,eSr]),rSr=$e({role:iM,content:hn([hH,qt(hH)]),_meta:zn(te(),Mn()).optional()}),nSr=XL.extend({messages:qt(rSr),modelPreferences:Qbr.optional(),systemPrompt:te().optional(),includeContext:fi(["none","thisServer","allServers"]).optional(),temperature:Cn().optional(),maxTokens:Cn().int(),stopSequences:qt(te()).optional(),metadata:Ns.optional(),tools:qt(SGe).optional(),toolChoice:Zbr.optional()}),iSr=ws.extend({method:ht("sampling/createMessage"),params:nSr}),vue=Is.extend({model:te(),stopReason:Hn(fi(["endTurn","stopSequence","maxTokens"]).or(te())),role:iM,content:tSr}),_ue=Is.extend({model:te(),stopReason:Hn(fi(["endTurn","stopSequence","maxTokens","toolUse"]).or(te())),role:iM,content:hn([hH,qt(hH)])}),aSr=$e({type:ht("boolean"),title:te().optional(),description:te().optional(),default:ji().optional()}),oSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),minLength:Cn().optional(),maxLength:Cn().optional(),format:fi(["email","uri","date","date-time"]).optional(),default:te().optional()}),sSr=$e({type:fi(["number","integer"]),title:te().optional(),description:te().optional(),minimum:Cn().optional(),maximum:Cn().optional(),default:Cn().optional()}),cSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),enum:qt(te()),default:te().optional()}),uSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),oneOf:qt($e({const:te(),title:te()})),default:te().optional()}),lSr=$e({type:ht("string"),title:te().optional(),description:te().optional(),enum:qt(te()),enumNames:qt(te()).optional(),default:te().optional()}),pSr=hn([cSr,uSr]),fSr=$e({type:ht("array"),title:te().optional(),description:te().optional(),minItems:Cn().optional(),maxItems:Cn().optional(),items:$e({type:ht("string"),enum:qt(te())}),default:qt(te()).optional()}),dSr=$e({type:ht("array"),title:te().optional(),description:te().optional(),minItems:Cn().optional(),maxItems:Cn().optional(),items:$e({anyOf:qt($e({const:te(),title:te()}))}),default:qt(te()).optional()}),hSr=hn([fSr,dSr]),mSr=hn([lSr,pSr,hSr]),gSr=hn([mSr,aSr,oSr,sSr]),ySr=XL.extend({mode:ht("form").optional(),message:te(),requestedSchema:$e({type:ht("object"),properties:zn(te(),gSr),required:qt(te()).optional()})}),vSr=XL.extend({mode:ht("url"),message:te(),elicitationId:te(),url:te().url()}),_Sr=hn([ySr,vSr]),ESr=ws.extend({method:ht("elicitation/create"),params:_Sr}),TSr=Qp.extend({elicitationId:te()}),bSr=Zp.extend({method:ht("notifications/elicitation/complete"),params:TSr}),PH=Is.extend({action:fi(["accept","decline","cancel"]),content:dH(e=>e===null?void 0:e,zn(te(),hn([te(),Cn(),ji(),qt(te())])).optional())}),SSr=$e({type:ht("ref/resource"),uri:te()});var OSr=$e({type:ht("ref/prompt"),name:te()}),ASr=cp.extend({ref:hn([OSr,SSr]),argument:$e({name:te(),value:te()}),context:$e({arguments:zn(te(),te()).optional()}).optional()}),CSr=ws.extend({method:ht("completion/complete"),params:ASr});var xSr=Is.extend({completion:uc({values:qt(te()).max(100),total:Hn(Cn().int()),hasMore:Hn(ji())})}),PSr=$e({uri:te().startsWith("file://"),name:te().optional(),_meta:zn(te(),Mn()).optional()}),DSr=ws.extend({method:ht("roots/list"),params:cp.optional()}),Eue=Is.extend({roots:qt(PSr)}),NSr=Zp.extend({method:ht("notifications/roots/list_changed"),params:Qp.optional()}),VCi=hn([_H,ZL,CSr,yue,$br,Rbr,ybr,_br,bbr,Cbr,Pbr,aM,gue,TH,SH,OH,CH]),jCi=hn([vH,EH,uue,NSr,nM]),qCi=hn([yH,vue,_ue,PH,Eue,bH,AH,Nx]),BCi=hn([_H,iSr,ESr,DSr,TH,SH,OH,CH]),GCi=hn([vH,EH,Xbr,Nbr,Obr,Ybr,qbr,nM,bSr]),HCi=hn([yH,lbr,xSr,jbr,Lbr,vbr,Ebr,Sbr,xH,Hbr,bH,AH,Nx]),Sr=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===on.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new nue(i.elicitations,r)}return new e(t,r,n)}},nue=class extends Sr{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(on.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function K_(e){return e==="completed"||e==="failed"||e==="cancelled"}var Axi=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Tue(e){let r=ZG(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=b4e(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function bue(e,t){let r=z_(e,t);if(!r.success)throw r.error;return r.data}var $Sr=6e4,DH=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(vH,r=>{this._oncancel(r)}),this.setNotificationHandler(EH,r=>{this._onprogress(r)}),this.setRequestHandler(_H,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(TH,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Sr(on.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(SH,async(r,n)=>{let i=async()=>{let a=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(a,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let p=c,f=new Sr(p.error.code,p.error.message,p.error.data);l(f)}else{let p=s.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let o=await this._taskStore.getTask(a,n.sessionId);if(!o)throw new Sr(on.InvalidParams,`Task not found: ${a}`);if(!K_(o.status))return await this._waitForTaskUpdate(a,n.signal),await i();if(K_(o.status)){let s=await this._taskStore.getTaskResult(a,n.sessionId);return this._clearTaskQueue(a),{...s,_meta:{...s._meta,[Y_]:{taskId:a}}}}return await i()};return await i()}),this.setRequestHandler(OH,async(r,n)=>{try{let{tasks:i,nextCursor:a}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:a,_meta:{}}}catch(i){throw new Sr(on.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(CH,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Sr(on.InvalidParams,`Task not found: ${r.params.taskId}`);if(K_(i.status))throw new Sr(on.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new Sr(on.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof Sr?i:new Sr(on.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,i,a=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),Sr.fromError(on.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=a=>{n?.(a),this._onerror(a)};let i=this._transport?.onmessage;this._transport.onmessage=(a,o)=>{i?.(a,o),JL(a)||mGe(a)?this._onresponse(a):oue(a)?this._onrequest(a,o):hGe(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=Sr.fromError(on.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,i=this._transport,a=t.params?._meta?.[Y_]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:on.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:l,timestamp:Date.now()},i?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):i?.send(l).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(t.id,o);let s=pGe(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,i?.sessionId):void 0,u={signal:o.signal,sessionId:i?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(o.signal.aborted)return;let p={relatedRequestId:t.id};a&&(p.relatedTask={taskId:a}),await this.notification(l,p)},sendRequest:async(l,p,f)=>{if(o.signal.aborted)throw new Sr(on.ConnectionClosed,"Request was cancelled");let h={...f,relatedRequestId:t.id};a&&!h.relatedTask&&(h.relatedTask={taskId:a});let d=h.relatedTask?.taskId??a;return d&&c&&await c.updateTaskStatus(d,"input_required"),await this.request(l,p,h)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:a,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(o.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:t.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:p,timestamp:Date.now()},i?.sessionId):await i?.send(p)},async l=>{if(o.signal.aborted)return;let p={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:on.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:p,timestamp:Date.now()},i?.sessionId):await i?.send(p)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(c);return}a(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),JL(t))n(t);else{let o=new Sr(t.error.code,t.error.message,t.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(JL(t)&&t.result&&typeof t.result=="object"){let o=t.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,r))}}if(a||this._progressHandlers.delete(r),JL(t))i(t);else{let o=Sr.fromError(t.error.code,t.error.message,t.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(t,r,n)}}catch(o){yield{type:"error",error:o instanceof Sr?o:new Sr(on.InternalError,String(o))}}return}let a;try{let o=await this.request(t,Nx,n);if(o.task)a=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new Sr(on.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:a},n);if(yield{type:"taskStatus",task:s},K_(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)}:s.status==="failed"?yield{type:"error",error:new Sr(on.InternalError,`Task ${a} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new Sr(on.InternalError,`Task ${a} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof Sr?o:new Sr(on.InternalError,String(o))}}}request(t,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let p=O=>{l(O)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(O){p(O);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,h={...t,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),h.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(h.params={...h.params,task:s}),c&&(h.params={...h.params,_meta:{...h.params?._meta||{},[Y_]:c}});let d=O=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(O)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let A=O instanceof Sr?O:new Sr(on.RequestTimeout,String(O));l(A)};this._responseHandlers.set(f,O=>{if(!n?.signal?.aborted){if(O instanceof Error)return l(O);try{let A=z_(r,O.result);A.success?u(A.data):l(A.error)}catch(A){l(A)}}}),n?.signal?.addEventListener("abort",()=>{d(n?.signal?.reason)});let m=n?.timeout??$Sr,_=()=>d(Sr.fromError(on.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(f,m,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let T=c?.taskId;if(T){let O=A=>{let C=this._responseHandlers.get(f);C?C(A):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,O),this._enqueueTaskMessage(T,{type:"request",message:h,timestamp:Date.now()}).catch(A=>{this._cleanupTimeout(f),l(A)})}else this._transport.send(h,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(f),l(O)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},bH,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},AH,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},vGe,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Y_]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Y_]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let o={...t,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Y_]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(t,r){let n=Tue(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=bue(t,i);return Promise.resolve(r(o,a))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Tue(t);this._notificationHandlers.set(n,i=>{let a=bue(t,i);return Promise.resolve(r(a))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,i)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let i of n)if(i.type==="request"&&oue(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new Sr(on.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,a)=>{if(r.aborted){a(new Sr(on.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),a(new Sr(on.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!t)throw new Error("No request provided");return await n.createTask(i,t.id,{method:t.method,params:t.params},r)},getTask:async i=>{let a=await n.getTask(i,r);if(!a)throw new Sr(on.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await n.storeTaskResult(i,a,o,r);let s=await n.getTask(i,r);if(s){let c=nM.parse({method:"notifications/tasks/status",params:s});await this.notification(c),K_(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,a,o)=>{let s=await n.getTask(i,r);if(!s)throw new Sr(on.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(K_(s.status))throw new Sr(on.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,a,o,r);let c=await n.getTask(i,r);if(c){let u=nM.parse({method:"notifications/tasks/status",params:c});await this.notification(u),K_(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function OGe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function AGe(e,t){let r={...e};for(let n in t){let i=n,a=t[i];if(a===void 0)continue;let o=r[i];OGe(o)&&OGe(a)?r[i]={...o,...a}:r[i]=a}return r}var u5e=Gt(cpe(),1),l5e=Gt(c5e(),1);function CPr(){let e=new u5e.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,l5e.default)(e),e}var fz=class{constructor(t){this._ajv=t??CPr()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var dz=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function p5e(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function f5e(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var hz=class extends DH{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(oM.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new fz,this.setRequestHandler(ZL,n=>this._oninitialize(n)),this.setNotificationHandler(uue,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(yue,async(n,i)=>{let a=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=n.params,s=oM.safeParse(o);return s.success&&this._loggingLevels.set(a,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new dz(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=AGe(this._capabilities,t)}setRequestHandler(t,r){let i=ZG(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let a;if(Cx(i)){let s=i;a=s._zod?.def?.value??s.value}else{let s=i;a=s._def?.value??s.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let s=async(c,u)=>{let l=z_(aM,c);if(!l.success){let d=l.error instanceof Error?l.error.message:String(l.error);throw new Sr(on.InvalidParams,`Invalid tools/call request: ${d}`)}let{params:p}=l.data,f=await Promise.resolve(r(c,u));if(p.task){let d=z_(Nx,f);if(!d.success){let m=d.error instanceof Error?d.error.message:String(d.error);throw new Sr(on.InvalidParams,`Invalid task creation result: ${m}`)}return d.data}let h=z_(xH,f);if(!h.success){let d=h.error instanceof Error?h.error.message:String(h.error);throw new Sr(on.InvalidParams,`Invalid tools/call result: ${d}`)}return h.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){f5e(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&p5e(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:cGe.includes(r)?r:iue,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},yH)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],a=i.some(u=>u.type==="tool_result"),o=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],c=s.some(u=>u.type==="tool_use");if(a){if(i.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},_ue,r):this.request({method:"sampling/createMessage",params:t},vue,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},PH,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},a=await this.request({method:"elicitation/create",params:i},PH,r);if(a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new Sr(on.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){throw o instanceof Sr?o:new Sr(on.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return a}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Eue,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var gpe=Gt(require("node:process"),1);var mz=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
1609
1609
  `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),xPr(r)}clear(){this._buffer=void 0}};function xPr(e){return gGe.parse(JSON.parse(e))}function d5e(e){return JSON.stringify(e)+`
1610
- `}var gz=class{constructor(t=gpe.default.stdin,r=gpe.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new mz,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=d5e(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var m5e="0.6.38";var PS={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:m5e,keywords:["SAP Fiori tools","SAP Fiori elements","SAP Fiori freestyle","MCP","AI"],repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/fiori-mcp-server"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-mcp-server"},license:"Apache-2.0",main:"dist/index.js",scripts:{"build-esbuild-base":"esbuild --bundle --platform=node --target=node20 --outdir=dist --external:vscode --external:@lancedb/lancedb --external:@xenova/transformers --external:@sap-ux/fiori-docs-embeddings --external:@sap-ux/store --main-fields=module,main src/index.ts","build-dev":"pnpm run build-esbuild-base --sourcemap=inline","build-compile":"tsc --noEmit","build-bundle":"pnpm run build-esbuild-base --minify",build:"npm-run-all build-compile build-bundle",watch:"tsc --watch",bundle:"npm-run-all build tgz:package tgz:rename","tgz:package":"pnpm pack","tgz:rename":"node -e \"const fs=require('fs'), p=require('./package.json'), d=new Date().toISOString().split('T')[0], oldName=p.name.startsWith('@') ? `${p.name.replace('@', '').replace('/', '-')}-${p.version}.tgz` : `${p.name}-${p.version}.tgz`; fs.renameSync(oldName, `${oldName.replace('.tgz','')}-${d}.tgz`)\"",clean:"rimraf --glob dist test/test-output *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"jest --ci --forceExit --detectOpenHandles --colors",inspector:"npx @modelcontextprotocol/inspector node dist/index.js","inspector-ts":"npx @modelcontextprotocol/inspector ts-node -T src/index.ts --log-level=debug",start:'npx -y supergateway --port 9881 --sessionTimeout 300000 --stdio "node ./dist/index.js"',"view:integration":"promptfoo view -y","test:integration:once":"promptfoo eval --config test/integration/scenarios/promptfooconfig.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:dev":"promptfoo eval --config test/integration/scenarios/test-dev.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:multiple":"npm run test:promptfoo -- --repeat 5"},files:["LICENSE","dist","!dist/**/*.map"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.27.2","@modelcontextprotocol/sdk":"1.26.0","@sap-ux/axios-extension":"workspace:*","@sap/ux-specification":"1.142.0","@sap-ux/project-access":"workspace:*","@sap-ux/fiori-annotation-api":"workspace:*","@sap-ux/annotation-converter":"0.10.19","@sap-ux/vocabularies-types":"0.14.5","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-docs-embeddings":"workspace:*","@sap-ux/i18n":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/odata-annotation-core-types":"workspace:*","@sap-ux/odata-entity-model":"workspace:*","@sap-ux/text-document-utils":"workspace:*","@types/diff":"5.0.9","@types/json-schema":"7.0.5","@types/mem-fs":"1.1.2","@types/mem-fs-editor":"7.0.1","@sap-ux/btp-utils":"workspace:*","@sap-ux/feature-toggle":"workspace:*","@sap-ux/nodejs-utils":"workspace:*","@sap-ux/telemetry":"workspace:*",i18next:"25.8.12","os-name":"4.0.1","ts-node":"10.9.2",zod:"4.1.13","@sap-ai-sdk/foundation-models":"2.3.0","@sap-ai-sdk/langchain":"2.8.0",promptfoo:"0.120.25","@langchain/mcp-adapters":"1.1.3","@langchain/core":"1.1.26"},dependencies:{"@sap-ux/fiori-docs-embeddings":"workspace:*","@sap-ux/store":"workspace:*","@xenova/transformers":"2.17.2","@lancedb/lancedb":"0.22.0","mem-fs":"2.1.0","mem-fs-editor":"9.4.0"},engines:{node:">=20.x"}};var v5e=$e({name:te().describe("Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."),appPath:te().describe("Absolute path to the Fiori application's root directory."),projectPath:te().describe("Absolute path to the root directory of the project containing this Fiori application. For EDMXBackend (standalone) projects, this is the same as `appPath`. For CAP projects, this points to the CAP project root, which may contain multiple Fiori applications."),projectType:fi(["EDMXBackend","CAPJava","CAPNodejs"]).describe("Type of project the application belongs to."),odataVersion:te().describe("OData protocol version used by the application's main service.")}),NS=hn([te(),qt(hn([te(),Cn()]))]),_5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),description:te()}),g5e=fi(["object","array","string","number","boolean","null","integer","any"]),y5e=$e({type:hn([g5e,qt(g5e)]).optional(),description:te().optional(),properties:cH().optional()}).catchall(cH()),E5e=y5e.extend({properties:zn(te(),hn([y5e,ji()])).optional()});var T5e=$e({searchPath:qt(te()).describe("Path to search for Fiori applications (defaults to current directory). If VSCode - list of VS Code workspace folder paths(`workspace.workspaceFolders`)")}),b5e=$e({appPath:te().describe("Path to the root folder of the Fiori application (where package.json and ui5.yaml reside) if one exists or to the current directory. Path should be an absolute path.")}),S5e=$e({appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path."),functionalityId:NS.describe("The ID of the functionality to get details for")}),O5e=$e({functionalityId:NS.describe("The ID of the functionality to execute"),parameters:zn(te(),Mn()).describe("Parameters for the functionality execution"),appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path.")}).describe('Input object for executing a functionality. Only three top-level properties are allowed: "functionalityId", "parameters", and "appPath". All other dynamic or functionality-specific inputs must be included inside the "parameters" object. Do not place any additional fields at the root level.'),awi=$e({query:te().min(2).describe("The search query for fiori elements, annotations, sapui5, fiori tools documentation")});var swi=te().describe("Search results as formatted text"),A5e=$e({applications:qt(v5e)}),C5e=$e({applicationPath:te(),functionalities:qt(_5e)}),x5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),name:te(),description:te(),technicalDescription:te().optional(),parameters:E5e,prerequisites:qt(te()).optional(),impact:te().optional(),examples:qt(te()).optional(),pageName:te().optional()}),P5e=$e({functionalityId:NS,status:te(),message:te(),parameters:Mn(),appPath:te(),changes:qt(te()),timestamp:te()});var s0e=Gt(require("node:fs/promises")),xf=Gt(require("node:path"));var mu=Gt(_E()),_yt=Gt(Wd()),Eyt=require("node:path");function Tpn(){let e=globalThis.LOG_LEVEL,t=process.env.LOG_LEVEL,r=process.argv.find(i=>i.startsWith("--log-level="))?.split("=")[1],n=e??t??r;if(n)switch(n.toUpperCase()){case"OFF":return;case"ERROR":return mu.LogLevel.Error;case"WARN":return mu.LogLevel.Warn;case"INFO":return mu.LogLevel.Info;case"DEBUG":return mu.LogLevel.Debug;case"VERBOSE":return mu.LogLevel.Verbose;case"SILLY":return mu.LogLevel.Silly;default:break}return mu.LogLevel.Error}var vyt=Tpn(),ft=new mu.ToolsLogger({logLevel:vyt??mu.LogLevel.Error,transports:vyt===void 0?[new mu.NullTransport]:[new mu.FileTransport({filename:(0,Eyt.join)(_yt.fioriToolsDirectory,"fiori-mcp-server.log"),maxsize:10*1024*1024,maxFiles:5})],logPrefix:"fiori-mcp"}),WF={info:(e,...t)=>{ft.info(`@sap/ux-specification: ${e}`);for(let r of t)ft.info(typeof r=="number"?r.toString():r)},warning:(e,...t)=>{ft.warn(`@sap/ux-specification: ${e}`);for(let r of t)ft.warn(typeof r=="number"?r.toString():r)},error:(e,...t)=>{ft.error(`@sap/ux-specification: ${e}`);for(let r of t)ft.error(typeof r=="number"?r.toString():r)},reset:()=>{}};async function Tyt(){try{let r;try{r=require("@sap-ux/fiori-docs-embeddings")}catch{try{r=await import("@sap-ux/fiori-docs-embeddings")}catch{r=null}}if(!r||typeof r.getDataPath!="function")throw new Error("Package not found or invalid");let n=r.getDataPath();return await s0e.default.access(n),ft.log("\u2713 Using @sap-ux/fiori-docs-embeddings package"),{dataPath:n,embeddingsPath:xf.default.join(n,"embeddings"),searchPath:xf.default.join(n,"search"),docsPath:xf.default.join(n,"docs"),isExternalPackage:!0,isAvailable:!0}}catch{ft.warn("Could not load @sap-ux/fiori-docs-embeddings package, trying local data...")}let e=xf.default.join(__dirname,"../../data");try{return await s0e.default.access(e),ft.log("\u2713 Using local data directory"),{dataPath:e,embeddingsPath:xf.default.join(e,"embeddings"),searchPath:xf.default.join(e,"search"),docsPath:xf.default.join(e,"docs"),isExternalPackage:!1,isAvailable:!0}}catch{ft.warn("Local data directory not available either")}let t=xf.default.join(__dirname,"../../data");return ft.warn("\u26A0\uFE0F No embeddings data available - running in limited mode"),{dataPath:t,embeddingsPath:xf.default.join(t,"embeddings"),searchPath:xf.default.join(t,"search"),docsPath:xf.default.join(t,"docs"),isExternalPackage:!1,isAvailable:!1}}var xc=Gt(Wd()),XF=require("node:path");async function gu(e){try{e=(0,XF.join)(e);try{let t=await(0,xc.createApplicationAccess)(e);return{root:t.project.root,appId:t.getAppId(),applicationAccess:t}}catch(t){ft.warn(`Application was not found by given path. Error: ${t}`);let r=await(0,xc.findProjectRoot)(e),n=await(0,xc.getProject)(r);if(n)return{root:n.root,appId:""}}}catch(t){ft.warn(`Project was not found by given path. Error: ${t}`);return}}var QK=e=>{let t;switch(e){case xc.DirName.View:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.View);break}case xc.DirName.Fragment:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Fragment);break}case xc.DirName.Controller:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Controller);break}default:t=e}return t},Cm=(e,t,r=new Set)=>{if(!e||typeof e!="object")return{};if(e.$ref?.startsWith("#/definitions/")){let i=e.$ref,a=i.replace("#/definitions/",""),o=t.definitions?.[a]??null;if(r.has(i))return{...o};if(r.add(i),o){let s={...e};return delete s.$ref,Cm({...o,...s},t,r)}}let n={...e};return n.properties&&(n.properties=Object.fromEntries(Object.entries(n.properties).map(([i,a])=>[i,Cm(a,t,r)]))),n.items&&(Array.isArray(n.items)?n.items=n.items.map(i=>Cm(i,t,r)):n.items=Cm(n.items,t,r)),n.allOf&&(n.allOf=n.allOf.map(i=>Cm(i,t,r))),n.anyOf&&(n.anyOf=n.anyOf.map(i=>Cm(i,t,r))),n.oneOf&&(n.oneOf=n.oneOf.map(i=>Cm(i,t,r))),typeof n.additionalProperties=="object"&&(n.additionalProperties=Cm(n.additionalProperties,t,r)),n},byt=(e,t)=>({type:"object",properties:{[e]:t}}),Na=e=>{let t=gS(e);return delete t.$schema,t},xm=(e,t)=>{try{return e.parse(t)}catch(r){throw r instanceof dce?new Error(`Missing required fields in parameters. ${JSON.stringify(r.issues,null,4)}`):new Error("Unknown error. Recheck input parameters.")}};var CPt=require("node:util"),xPt=require("node:child_process"),PPt=Gt(fxe());async function ZW(e="1.18.5"){let t="@sap/generator-fiori";if((await(0,PPt.findInstalledPackages)(t,{minVersion:e}))?.length<1)throw new Error(`Fiori generator not found. Please install the Fiori generator >=${e} with 'npm install -g ${t}' and retry this call`)}var e7=(0,CPt.promisify)(xPt.exec);var DPt=require("@lancedb/lancedb");var dxe=Gt(require("node:fs/promises")),hxe=Gt(require("node:path")),t7=class{connection=null;tables=[];tableIndex=null;metadata=null;dataPath;constructor(t){this.dataPath=t||""}async initialize(){try{ft.log("Loading vector database from pre-built embeddings...");let t=await Tyt();if(!t.isAvailable)throw new Error("No embeddings data available");this.dataPath=t.embeddingsPath,ft.log(`Using embeddings path: ${this.dataPath} (external: ${t.isExternalPackage})`);let r=hxe.default.join(this.dataPath,"metadata.json"),n=await dxe.default.readFile(r,"utf-8");this.metadata=JSON.parse(n),ft.log("\u2713 Embedding metadata loaded:"),ft.log(` Model: ${this?.metadata?.model}`),ft.log(` Dimensions: ${this?.metadata?.dimensions}`),ft.log(` Total vectors: ${this?.metadata?.totalVectors}`),ft.log(` Created: ${this?.metadata?.createdAt}`),this.connection=await(0,DPt.connect)(this.dataPath);let i=hxe.default.join(this.dataPath,"table_index.json");try{let a=await dxe.default.readFile(i,"utf-8");this.tableIndex=JSON.parse(a),this.tables=[];for(let o of this.tableIndex?.tables||[]){let s=await this.connection.openTable(o);this.tables.push(s)}ft.log(`\u2713 Loaded ${this.tables.length} split tables`)}catch{ft.log("No table index found, trying single table...");try{let a=await this.connection.openTable("documents");this.tables=[a],this.tableIndex={tables:["documents"],totalTables:1,maxVectorsPerTable:-1,totalVectors:this.metadata?.totalVectors||0}}catch(a){throw new Error(`No tables found: ${a}`)}}ft.log("\u2713 Vector database loaded and ready")}catch(t){throw new Error(`Failed to load vector database: ${t}`)}}async semanticSearch(t,r=10,n){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let i=[];for(let o of this.tables){let s=o.vectorSearch(t).limit(r*2);n&&(s=s.where(`category = "${n}"`));let c=await s.toArray();i.push(...c)}return i.sort((o,s)=>(o._distance||0)-(s._distance||0)),i.slice(0,r).map(o=>({document:{id:o.document_id,vector:o.vector,content:o.content,title:o.title,category:o.category,path:o.path,chunk_index:o.chunk_index,metadata:{tags:this.parseJsonField(o.tags_json)||[],headers:this.parseJsonField(o.headers_json)||[],lastModified:new Date(o.lastModified),wordCount:o.wordCount,excerpt:o.excerpt}},score:1-(o._distance||0),distance:o._distance||0}))}catch(i){throw ft.error(`Semantic search failed: ${i}`),new Error(`Semantic search failed: ${i}`)}}async findSimilarToText(t,r=5){return ft.warn("findSimilarToText requires embedding generation - not available in simplified mode"),[]}async findSimilarToDocument(t,r=5){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=null;for(let s of this.tables){let c=await s.search("").where(`document_id = "${t}" AND chunk_index = 0`).limit(1).toArray();if(c.length>0){n=c[0].vector;break}}if(!n)return[];let i=[];for(let s of this.tables){let c=await s.vectorSearch(n).where(`document_id != "${t}"`).limit(r*2).toArray();i.push(...c)}let a=new Map;for(let s of i){let c=s.document_id,u=1-(s._distance||0);(!a.has(c)||a.get(c).score<u)&&a.set(c,{...s,score:u,distance:s._distance||0})}return Array.from(a.values()).sort((s,c)=>c.score-s.score).slice(0,r).map(s=>({document:{id:s.document_id,vector:s.vector,content:s.content,title:s.title,category:s.category,path:s.path,chunk_index:s.chunk_index,metadata:{tags:this.parseJsonField(s.tags_json)||[],headers:this.parseJsonField(s.headers_json)||[],lastModified:new Date(s.lastModified),wordCount:s.wordCount,excerpt:s.excerpt}},score:s.score,distance:s.distance}))}catch(n){return ft.error(`Find similar documents failed: ${n}`),[]}}async getDocumentsByCategory(t,r){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=[];for(let a of this.tables){let o=a.search("").where(`category = "${t}" AND chunk_index = 0`);r&&(o=o.limit(Math.ceil(r/this.tables.length)+10));let s=await o.toArray();n.push(...s)}return(r?n.slice(0,r):n).map(a=>({document:{id:a.document_id,vector:a.vector,content:a.content,title:a.title,category:a.category,path:a.path,chunk_index:a.chunk_index,metadata:{tags:this.parseJsonField(a.tags_json)||[],headers:this.parseJsonField(a.headers_json)||[],lastModified:new Date(a.lastModified),wordCount:a.wordCount,excerpt:a.excerpt}},score:1,distance:0}))}catch(n){return ft.error(`Get documents by category failed: ${n}`),[]}}getMetadata(){return this.metadata}parseJsonField(t){try{return t?JSON.parse(t):[]}catch{return[]}}isInitialized(){return this.tables.length>0&&this.metadata!==null}async close(){this.connection&&(this.connection=null,this.tables=[],ft.log("Vector database connection closed"))}};var r7=class{pipeline=null;initialized=!1;async initialize(){if(!this.initialized)try{let{pipeline:t}=await import("@xenova/transformers");this.pipeline=await t("feature-extraction","Xenova/all-MiniLM-L6-v2",{quantized:!1}),this.initialized=!0}catch(t){throw new Error(`Failed to initialize text embedding service: ${t}. Make sure @xenova/transformers is available.`)}}async generateEmbedding(t){if(!this.initialized||!this.pipeline)throw new Error("Text embedding service not initialized. Call initialize() first.");try{let r=t.replace(/\n+/g," ").replace(/\s+/g," ").trim().substring(0,8192);if(!r)throw new Error("Empty text provided for embedding");let n=await this.pipeline(r,{pooling:"mean",normalize:!0});return Array.from(n.data)}catch(r){throw new Error(`Failed to generate embedding: ${r}`)}}isInitialized(){return this.initialized}};async function mxe(e,t=!1){let{query:r,maxResults:n}=e;try{let i=new t7,a=new r7;await i.initialize(),await a.initialize();let o=await a.generateEmbedding(r),s=await i.semanticSearch(o,n??10);if(t){let c="";for(let[u,l]of s.entries())c+=`Result ${u+1}:
1610
+ `}var gz=class{constructor(t=gpe.default.stdin,r=gpe.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new mz,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=d5e(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var m5e="0.6.39";var PS={name:"@sap-ux/fiori-mcp-server",description:"SAP Fiori - Model Context Protocol (MCP) server",version:m5e,keywords:["SAP Fiori tools","SAP Fiori elements","SAP Fiori freestyle","MCP","AI"],repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/fiori-mcp-server"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-mcp-server"},license:"Apache-2.0",main:"dist/index.js",scripts:{"build-esbuild-base":"esbuild --bundle --platform=node --target=node20 --outdir=dist --external:vscode --external:@lancedb/lancedb --external:@xenova/transformers --external:@sap-ux/fiori-docs-embeddings --external:@sap-ux/store --main-fields=module,main src/index.ts","build-dev":"pnpm run build-esbuild-base --sourcemap=inline","build-compile":"tsc --noEmit","build-bundle":"pnpm run build-esbuild-base --minify && pnpm run copy-icons","copy-icons":`node -e "const fs=require('node:fs');const path=require('node:path');['icon.png','icon.svg'].forEach(f=>fs.copyFileSync(path.join('assets',f),path.join('dist',f)))"`,build:"npm-run-all build-compile build-bundle",watch:"tsc --watch",bundle:"npm-run-all build tgz:package tgz:rename","tgz:package":"pnpm pack","tgz:rename":"node -e \"const fs=require('fs'), p=require('./package.json'), d=new Date().toISOString().split('T')[0], oldName=p.name.startsWith('@') ? `${p.name.replace('@', '').replace('/', '-')}-${p.version}.tgz` : `${p.name}-${p.version}.tgz`; fs.renameSync(oldName, `${oldName.replace('.tgz','')}-${d}.tgz`)\"",clean:"rimraf --glob dist test/test-output *.tsbuildinfo",format:"prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",lint:"eslint","lint:fix":"eslint --fix",test:"jest --ci --forceExit --detectOpenHandles --colors",inspector:"npx @modelcontextprotocol/inspector node dist/index.js","inspector-ts":"npx @modelcontextprotocol/inspector ts-node -T src/index.ts --log-level=debug",start:'npx -y supergateway --port 9881 --sessionTimeout 300000 --stdio "node ./dist/index.js"',"view:integration":"promptfoo view -y","test:integration:once":"promptfoo eval --config test/integration/scenarios/promptfooconfig.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:dev":"promptfoo eval --config test/integration/scenarios/test-dev.yaml --max-concurrency 1 --repeat 1 --output reports/integration.txt","test:integration:multiple":"npm run test:promptfoo -- --repeat 5"},files:["LICENSE","dist","!dist/**/*.map","assets/icon.svg","assets/icon.png"],bin:{"fiori-mcp":"./dist/index.js"},devDependencies:{"npm-run-all2":"8.0.4",esbuild:"0.27.2","@modelcontextprotocol/sdk":"1.26.0","@sap-ux/axios-extension":"workspace:*","@sap/ux-specification":"1.142.0","@sap-ux/project-access":"workspace:*","@sap-ux/fiori-annotation-api":"workspace:*","@sap-ux/annotation-converter":"0.10.19","@sap-ux/vocabularies-types":"0.14.5","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-docs-embeddings":"workspace:*","@sap-ux/i18n":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/odata-annotation-core-types":"workspace:*","@sap-ux/odata-entity-model":"workspace:*","@sap-ux/text-document-utils":"workspace:*","@types/diff":"5.0.9","@types/json-schema":"7.0.5","@types/mem-fs":"1.1.2","@types/mem-fs-editor":"7.0.1","@sap-ux/btp-utils":"workspace:*","@sap-ux/feature-toggle":"workspace:*","@sap-ux/nodejs-utils":"workspace:*","@sap-ux/telemetry":"workspace:*",i18next:"25.8.12","os-name":"4.0.1","ts-node":"10.9.2",zod:"4.1.13","@sap-ai-sdk/foundation-models":"2.3.0","@sap-ai-sdk/langchain":"2.8.0",promptfoo:"0.120.25","@langchain/mcp-adapters":"1.1.3","@langchain/core":"1.1.26"},dependencies:{"@sap-ux/fiori-docs-embeddings":"workspace:*","@sap-ux/store":"workspace:*","@xenova/transformers":"2.17.2","@lancedb/lancedb":"0.22.0","mem-fs":"2.1.0","mem-fs-editor":"9.4.0"},engines:{node:">=20.x"}};var v5e=$e({name:te().describe("Name of the Fiori application. Usually derived from the `sap.app/id` field in the application's manifest.json."),appPath:te().describe("Absolute path to the Fiori application's root directory."),projectPath:te().describe("Absolute path to the root directory of the project containing this Fiori application. For EDMXBackend (standalone) projects, this is the same as `appPath`. For CAP projects, this points to the CAP project root, which may contain multiple Fiori applications."),projectType:fi(["EDMXBackend","CAPJava","CAPNodejs"]).describe("Type of project the application belongs to."),odataVersion:te().describe("OData protocol version used by the application's main service.")}),NS=hn([te(),qt(hn([te(),Cn()]))]),_5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),description:te()}),g5e=fi(["object","array","string","number","boolean","null","integer","any"]),y5e=$e({type:hn([g5e,qt(g5e)]).optional(),description:te().optional(),properties:cH().optional()}).catchall(cH()),E5e=y5e.extend({properties:zn(te(),hn([y5e,ji()])).optional()});var T5e=$e({searchPath:qt(te()).describe("Path to search for Fiori applications (defaults to current directory). If VSCode - list of VS Code workspace folder paths(`workspace.workspaceFolders`)")}),b5e=$e({appPath:te().describe("Path to the root folder of the Fiori application (where package.json and ui5.yaml reside) if one exists or to the current directory. Path should be an absolute path.")}),S5e=$e({appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path."),functionalityId:NS.describe("The ID of the functionality to get details for")}),O5e=$e({functionalityId:NS.describe("The ID of the functionality to execute"),parameters:zn(te(),Mn()).describe("Parameters for the functionality execution"),appPath:te().describe("Path to the Fiori application if one exists or to the current directory. Path should be an absolute path.")}).describe('Input object for executing a functionality. Only three top-level properties are allowed: "functionalityId", "parameters", and "appPath". All other dynamic or functionality-specific inputs must be included inside the "parameters" object. Do not place any additional fields at the root level.'),awi=$e({query:te().min(2).describe("The search query for fiori elements, annotations, sapui5, fiori tools documentation")});var swi=te().describe("Search results as formatted text"),A5e=$e({applications:qt(v5e)}),C5e=$e({applicationPath:te(),functionalities:qt(_5e)}),x5e=$e({functionalityId:NS.describe("Identifier to pass as the `functionalityId` parameter when calling `get_functionality_details` or `execute_functionality`"),name:te(),description:te(),technicalDescription:te().optional(),parameters:E5e,prerequisites:qt(te()).optional(),impact:te().optional(),examples:qt(te()).optional(),pageName:te().optional()}),P5e=$e({functionalityId:NS,status:te(),message:te(),parameters:Mn(),appPath:te(),changes:qt(te()),timestamp:te()});var s0e=Gt(require("node:fs/promises")),xf=Gt(require("node:path"));var mu=Gt(_E()),_yt=Gt(Wd()),Eyt=require("node:path");function Tpn(){let e=globalThis.LOG_LEVEL,t=process.env.LOG_LEVEL,r=process.argv.find(i=>i.startsWith("--log-level="))?.split("=")[1],n=e??t??r;if(n)switch(n.toUpperCase()){case"OFF":return;case"ERROR":return mu.LogLevel.Error;case"WARN":return mu.LogLevel.Warn;case"INFO":return mu.LogLevel.Info;case"DEBUG":return mu.LogLevel.Debug;case"VERBOSE":return mu.LogLevel.Verbose;case"SILLY":return mu.LogLevel.Silly;default:break}return mu.LogLevel.Error}var vyt=Tpn(),ft=new mu.ToolsLogger({logLevel:vyt??mu.LogLevel.Error,transports:vyt===void 0?[new mu.NullTransport]:[new mu.FileTransport({filename:(0,Eyt.join)(_yt.fioriToolsDirectory,"fiori-mcp-server.log"),maxsize:10*1024*1024,maxFiles:5})],logPrefix:"fiori-mcp"}),WF={info:(e,...t)=>{ft.info(`@sap/ux-specification: ${e}`);for(let r of t)ft.info(typeof r=="number"?r.toString():r)},warning:(e,...t)=>{ft.warn(`@sap/ux-specification: ${e}`);for(let r of t)ft.warn(typeof r=="number"?r.toString():r)},error:(e,...t)=>{ft.error(`@sap/ux-specification: ${e}`);for(let r of t)ft.error(typeof r=="number"?r.toString():r)},reset:()=>{}};async function Tyt(){try{let r;try{r=require("@sap-ux/fiori-docs-embeddings")}catch{try{r=await import("@sap-ux/fiori-docs-embeddings")}catch{r=null}}if(!r||typeof r.getDataPath!="function")throw new Error("Package not found or invalid");let n=r.getDataPath();return await s0e.default.access(n),ft.log("\u2713 Using @sap-ux/fiori-docs-embeddings package"),{dataPath:n,embeddingsPath:xf.default.join(n,"embeddings"),searchPath:xf.default.join(n,"search"),docsPath:xf.default.join(n,"docs"),isExternalPackage:!0,isAvailable:!0}}catch{ft.warn("Could not load @sap-ux/fiori-docs-embeddings package, trying local data...")}let e=xf.default.join(__dirname,"../../data");try{return await s0e.default.access(e),ft.log("\u2713 Using local data directory"),{dataPath:e,embeddingsPath:xf.default.join(e,"embeddings"),searchPath:xf.default.join(e,"search"),docsPath:xf.default.join(e,"docs"),isExternalPackage:!1,isAvailable:!0}}catch{ft.warn("Local data directory not available either")}let t=xf.default.join(__dirname,"../../data");return ft.warn("\u26A0\uFE0F No embeddings data available - running in limited mode"),{dataPath:t,embeddingsPath:xf.default.join(t,"embeddings"),searchPath:xf.default.join(t,"search"),docsPath:xf.default.join(t,"docs"),isExternalPackage:!1,isAvailable:!1}}var xc=Gt(Wd()),XF=require("node:path");async function gu(e){try{e=(0,XF.join)(e);try{let t=await(0,xc.createApplicationAccess)(e);return{root:t.project.root,appId:t.getAppId(),applicationAccess:t}}catch(t){ft.warn(`Application was not found by given path. Error: ${t}`);let r=await(0,xc.findProjectRoot)(e),n=await(0,xc.getProject)(r);if(n)return{root:n.root,appId:""}}}catch(t){ft.warn(`Project was not found by given path. Error: ${t}`);return}}var QK=e=>{let t;switch(e){case xc.DirName.View:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.View);break}case xc.DirName.Fragment:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Fragment);break}case xc.DirName.Controller:{t=(0,XF.join)(xc.DirName.Ext,xc.DirName.Controller);break}default:t=e}return t},Cm=(e,t,r=new Set)=>{if(!e||typeof e!="object")return{};if(e.$ref?.startsWith("#/definitions/")){let i=e.$ref,a=i.replace("#/definitions/",""),o=t.definitions?.[a]??null;if(r.has(i))return{...o};if(r.add(i),o){let s={...e};return delete s.$ref,Cm({...o,...s},t,r)}}let n={...e};return n.properties&&(n.properties=Object.fromEntries(Object.entries(n.properties).map(([i,a])=>[i,Cm(a,t,r)]))),n.items&&(Array.isArray(n.items)?n.items=n.items.map(i=>Cm(i,t,r)):n.items=Cm(n.items,t,r)),n.allOf&&(n.allOf=n.allOf.map(i=>Cm(i,t,r))),n.anyOf&&(n.anyOf=n.anyOf.map(i=>Cm(i,t,r))),n.oneOf&&(n.oneOf=n.oneOf.map(i=>Cm(i,t,r))),typeof n.additionalProperties=="object"&&(n.additionalProperties=Cm(n.additionalProperties,t,r)),n},byt=(e,t)=>({type:"object",properties:{[e]:t}}),Na=e=>{let t=gS(e);return delete t.$schema,t},xm=(e,t)=>{try{return e.parse(t)}catch(r){throw r instanceof dce?new Error(`Missing required fields in parameters. ${JSON.stringify(r.issues,null,4)}`):new Error("Unknown error. Recheck input parameters.")}};var CPt=require("node:util"),xPt=require("node:child_process"),PPt=Gt(fxe());async function ZW(e="1.18.5"){let t="@sap/generator-fiori";if((await(0,PPt.findInstalledPackages)(t,{minVersion:e}))?.length<1)throw new Error(`Fiori generator not found. Please install the Fiori generator >=${e} with 'npm install -g ${t}' and retry this call`)}var e7=(0,CPt.promisify)(xPt.exec);var DPt=require("@lancedb/lancedb");var dxe=Gt(require("node:fs/promises")),hxe=Gt(require("node:path")),t7=class{connection=null;tables=[];tableIndex=null;metadata=null;dataPath;constructor(t){this.dataPath=t||""}async initialize(){try{ft.log("Loading vector database from pre-built embeddings...");let t=await Tyt();if(!t.isAvailable)throw new Error("No embeddings data available");this.dataPath=t.embeddingsPath,ft.log(`Using embeddings path: ${this.dataPath} (external: ${t.isExternalPackage})`);let r=hxe.default.join(this.dataPath,"metadata.json"),n=await dxe.default.readFile(r,"utf-8");this.metadata=JSON.parse(n),ft.log("\u2713 Embedding metadata loaded:"),ft.log(` Model: ${this?.metadata?.model}`),ft.log(` Dimensions: ${this?.metadata?.dimensions}`),ft.log(` Total vectors: ${this?.metadata?.totalVectors}`),ft.log(` Created: ${this?.metadata?.createdAt}`),this.connection=await(0,DPt.connect)(this.dataPath);let i=hxe.default.join(this.dataPath,"table_index.json");try{let a=await dxe.default.readFile(i,"utf-8");this.tableIndex=JSON.parse(a),this.tables=[];for(let o of this.tableIndex?.tables||[]){let s=await this.connection.openTable(o);this.tables.push(s)}ft.log(`\u2713 Loaded ${this.tables.length} split tables`)}catch{ft.log("No table index found, trying single table...");try{let a=await this.connection.openTable("documents");this.tables=[a],this.tableIndex={tables:["documents"],totalTables:1,maxVectorsPerTable:-1,totalVectors:this.metadata?.totalVectors||0}}catch(a){throw new Error(`No tables found: ${a}`)}}ft.log("\u2713 Vector database loaded and ready")}catch(t){throw new Error(`Failed to load vector database: ${t}`)}}async semanticSearch(t,r=10,n){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let i=[];for(let o of this.tables){let s=o.vectorSearch(t).limit(r*2);n&&(s=s.where(`category = "${n}"`));let c=await s.toArray();i.push(...c)}return i.sort((o,s)=>(o._distance||0)-(s._distance||0)),i.slice(0,r).map(o=>({document:{id:o.document_id,vector:o.vector,content:o.content,title:o.title,category:o.category,path:o.path,chunk_index:o.chunk_index,metadata:{tags:this.parseJsonField(o.tags_json)||[],headers:this.parseJsonField(o.headers_json)||[],lastModified:new Date(o.lastModified),wordCount:o.wordCount,excerpt:o.excerpt}},score:1-(o._distance||0),distance:o._distance||0}))}catch(i){throw ft.error(`Semantic search failed: ${i}`),new Error(`Semantic search failed: ${i}`)}}async findSimilarToText(t,r=5){return ft.warn("findSimilarToText requires embedding generation - not available in simplified mode"),[]}async findSimilarToDocument(t,r=5){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=null;for(let s of this.tables){let c=await s.search("").where(`document_id = "${t}" AND chunk_index = 0`).limit(1).toArray();if(c.length>0){n=c[0].vector;break}}if(!n)return[];let i=[];for(let s of this.tables){let c=await s.vectorSearch(n).where(`document_id != "${t}"`).limit(r*2).toArray();i.push(...c)}let a=new Map;for(let s of i){let c=s.document_id,u=1-(s._distance||0);(!a.has(c)||a.get(c).score<u)&&a.set(c,{...s,score:u,distance:s._distance||0})}return Array.from(a.values()).sort((s,c)=>c.score-s.score).slice(0,r).map(s=>({document:{id:s.document_id,vector:s.vector,content:s.content,title:s.title,category:s.category,path:s.path,chunk_index:s.chunk_index,metadata:{tags:this.parseJsonField(s.tags_json)||[],headers:this.parseJsonField(s.headers_json)||[],lastModified:new Date(s.lastModified),wordCount:s.wordCount,excerpt:s.excerpt}},score:s.score,distance:s.distance}))}catch(n){return ft.error(`Find similar documents failed: ${n}`),[]}}async getDocumentsByCategory(t,r){if(this.tables.length===0)throw new Error("Vector database not initialized");try{let n=[];for(let a of this.tables){let o=a.search("").where(`category = "${t}" AND chunk_index = 0`);r&&(o=o.limit(Math.ceil(r/this.tables.length)+10));let s=await o.toArray();n.push(...s)}return(r?n.slice(0,r):n).map(a=>({document:{id:a.document_id,vector:a.vector,content:a.content,title:a.title,category:a.category,path:a.path,chunk_index:a.chunk_index,metadata:{tags:this.parseJsonField(a.tags_json)||[],headers:this.parseJsonField(a.headers_json)||[],lastModified:new Date(a.lastModified),wordCount:a.wordCount,excerpt:a.excerpt}},score:1,distance:0}))}catch(n){return ft.error(`Get documents by category failed: ${n}`),[]}}getMetadata(){return this.metadata}parseJsonField(t){try{return t?JSON.parse(t):[]}catch{return[]}}isInitialized(){return this.tables.length>0&&this.metadata!==null}async close(){this.connection&&(this.connection=null,this.tables=[],ft.log("Vector database connection closed"))}};var r7=class{pipeline=null;initialized=!1;async initialize(){if(!this.initialized)try{let{pipeline:t}=await import("@xenova/transformers");this.pipeline=await t("feature-extraction","Xenova/all-MiniLM-L6-v2",{quantized:!1}),this.initialized=!0}catch(t){throw new Error(`Failed to initialize text embedding service: ${t}. Make sure @xenova/transformers is available.`)}}async generateEmbedding(t){if(!this.initialized||!this.pipeline)throw new Error("Text embedding service not initialized. Call initialize() first.");try{let r=t.replace(/\n+/g," ").replace(/\s+/g," ").trim().substring(0,8192);if(!r)throw new Error("Empty text provided for embedding");let n=await this.pipeline(r,{pooling:"mean",normalize:!0});return Array.from(n.data)}catch(r){throw new Error(`Failed to generate embedding: ${r}`)}}isInitialized(){return this.initialized}};async function mxe(e,t=!1){let{query:r,maxResults:n}=e;try{let i=new t7,a=new r7;await i.initialize(),await a.initialize();let o=await a.generateEmbedding(r),s=await i.semanticSearch(o,n??10);if(t){let c="";for(let[u,l]of s.entries())c+=`Result ${u+1}:
1611
1611
 
1612
1612
  `,c+=`${l.document.content}
1613
1613
  `,c+=`---
@@ -1659,7 +1659,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
1659
1659
  The output of this tool is required for the final step 'execute_functionality' (Step 3).`,annotations:{title:"Get Fiori Functionality Details",readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:Na(S5e),outputSchema:Na(x5e)},{name:"execute_functionality",description:`**(Step 3 of 3)**
1660
1660
  Executes a specific functionality to create a new or modify an existing SAP Fiori application with provided parameters.
1661
1661
  This is the **final step** of the workflow and performs the actual creation or modification.
1662
- You MUST provide the exact parameter information obtained from get_functionality_details (Step 2).`,annotations:{title:"Execute Fiori Functionality",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:Na(O5e),outputSchema:Na(P5e)}];var Fh=Gt(Vcr()),ylr=Gt(Bcr()),vlr=Gt(U1()),_lr=require("node:crypto"),Elr=Gt(tlr());var or=e=>typeof e=="string",kB=()=>{let e,t,r=new Promise((n,i)=>{e=n,t=i});return r.resolve=e,r.reject=t,r},rlr=e=>e==null?"":""+e,cSi=(e,t,r)=>{e.forEach(n=>{t[n]&&(r[n]=t[n])})},uSi=/###/g,nlr=e=>e&&e.indexOf("###")>-1?e.replace(uSi,"."):e,ilr=e=>!e||or(e),FB=(e,t,r)=>{let n=or(t)?t.split("."):t,i=0;for(;i<n.length-1;){if(ilr(e))return{};let a=nlr(n[i]);!e[a]&&r&&(e[a]=new r),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={},++i}return ilr(e)?{}:{obj:e,k:nlr(n[i])}},alr=(e,t,r)=>{let{obj:n,k:i}=FB(e,t,Object);if(n!==void 0||t.length===1){n[i]=r;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=FB(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=FB(e,o,Object),s?.obj&&typeof s.obj[`${s.k}.${a}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=r},lSi=(e,t,r,n)=>{let{obj:i,k:a}=FB(e,t,Object);i[a]=i[a]||[],i[a].push(r)},Cae=(e,t)=>{let{obj:r,k:n}=FB(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},pSi=(e,t,r)=>{let n=Cae(e,r);return n!==void 0?n:Cae(t,r)},flr=(e,t,r)=>{for(let n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?or(e[n])||e[n]instanceof String||or(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):flr(e[n],t[n],r):e[n]=t[n]);return e},TC=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),fSi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},dSi=e=>or(e)?e.replace(/[&<>"'\/]/g,t=>fSi[t]):e,oje=class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){let r=this.regExpMap.get(t);if(r!==void 0)return r;let n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}},hSi=[" ",",","?","!",";"],mSi=new oje(20),gSi=(e,t,r)=>{t=t||"",r=r||"";let n=hSi.filter(o=>t.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=mSi.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),a=!i.test(e);if(!a){let o=e.indexOf(r);o>0&&!i.test(e.substring(0,o))&&(a=!0)}return a},sje=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let n=t.split(r),i=e;for(let a=0;a<n.length;){if(!i||typeof i!="object")return;let o,s="";for(let c=a;c<n.length;++c)if(c!==a&&(s+=r),s+=n[c],o=i[s],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<n.length-1)continue;a+=c-a+1;break}i=o}return i},UB=e=>e?.replace("_","-"),ySi={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},cje=class e{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||ySi,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,n,i){return i&&!this.debug?null:(or(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Wg=new cje,xR=class{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i.apply(i,[t,...r])})}},xae=class extends xR{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){let r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,n,i={}){let a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,s;t.indexOf(".")>-1?s=t.split("."):(s=[t,r],n&&(Array.isArray(n)?s.push(...n):or(n)&&a?s.push(...n.split(a)):s.push(n)));let c=Cae(this.data,s);return!c&&!r&&!n&&t.indexOf(".")>-1&&(t=s[0],r=s[1],n=s.slice(2).join(".")),c||!o||!or(n)?c:sje(this.data?.[t]?.[r],n,a)}addResource(t,r,n,i,a={silent:!1}){let o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,s=[t,r];n&&(s=s.concat(o?n.split(o):n)),t.indexOf(".")>-1&&(s=t.split("."),i=r,r=s[1]),this.addNamespaces(r),alr(this.data,s,i),a.silent||this.emit("added",t,r,n,i)}addResources(t,r,n,i={silent:!1}){for(let a in n)(or(n[a])||Array.isArray(n[a]))&&this.addResource(t,r,a,n[a],{silent:!0});i.silent||this.emit("added",t,r,n)}addResourceBundle(t,r,n,i,a,o={silent:!1,skipCopy:!1}){let s=[t,r];t.indexOf(".")>-1&&(s=t.split("."),i=n,n=r,r=s[1]),this.addNamespaces(r);let c=Cae(this.data,s)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?flr(c,n,a):c={...c,...n},alr(this.data,s,c),o.silent||this.emit("added",t,r,n)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){let r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},dlr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(a=>{t=this.processors[a]?.process(t,r,n,i)??t}),t}},hlr=Symbol("i18next/PATH_KEY");function vSi(){let e=[],t=Object.create(null),r;return t.get=(n,i)=>(r?.revoke?.(),i===hlr?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function uje(e,t){let{[hlr]:r}=e(vSi());return r.join(t?.keySeparator??".")}var olr={},nje=e=>!or(e)&&typeof e!="boolean"&&typeof e!="number",Pae=class e extends xR{constructor(t,r={}){super(),cSi(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Wg.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){let n={...r};if(t==null)return!1;let i=this.resolve(t,n);if(i?.res===void 0)return!1;let a=nje(i.res);return!(n.returnObjects===!1&&a)}extractFromKey(t,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ns||this.options.defaultNS||[],o=n&&t.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!gSi(t,n,i);if(o&&!s){let c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:or(a)?[a]:a};let u=t.split(n);(n!==i||n===i&&this.options.ns.indexOf(u[0])>-1)&&(a=u.shift()),t=u.join(i)}return{key:t,namespaces:or(a)?[a]:a}}translate(t,r,n){let i=typeof r=="object"?{...r}:r;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),t==null)return"";typeof t=="function"&&(t=uje(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]);let a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),u=c[c.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let p=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p?.toLowerCase()==="cimode")return f?a?{res:`${u}${l}${s}`,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${l}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:s;let h=this.resolve(t,i),d=h?.res,m=h?.usedKey||s,_=h?.exactUsedKey||s,T=["[object Number]","[object Function]","[object RegExp]"],O=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,C=i.count!==void 0&&!or(i.count),P=e.hasDefaultValue(i),N=C?this.pluralResolver.getSuffix(p,i.count,i):"",F=i.ordinal&&C?this.pluralResolver.getSuffix(p,i.count,{ordinal:!1}):"",L=C&&!i.ordinal&&i.count===0,B=L&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${N}`]||i[`defaultValue${F}`]||i.defaultValue,J=d;A&&!d&&P&&(J=B);let j=nje(J),Q=Object.prototype.toString.apply(J);if(A&&J&&j&&T.indexOf(Q)<0&&!(or(O)&&Array.isArray(J))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let ie=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,J,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(h.res=ie,h.usedParams=this.getUsedParamsDetails(i),h):ie}if(o){let ie=Array.isArray(J),ee=ie?[]:{},Y=ie?_:m;for(let G in J)if(Object.prototype.hasOwnProperty.call(J,G)){let le=`${Y}${o}${G}`;P&&!d?ee[G]=this.translate(le,{...i,defaultValue:nje(B)?B[G]:void 0,joinArrays:!1,ns:c}):ee[G]=this.translate(le,{...i,joinArrays:!1,ns:c}),ee[G]===le&&(ee[G]=J[G])}d=ee}}else if(A&&or(O)&&Array.isArray(d))d=d.join(O),d&&(d=this.extendTranslation(d,t,i,n));else{let ie=!1,ee=!1;!this.isValidLookup(d)&&P&&(ie=!0,d=B),this.isValidLookup(d)||(ee=!0,d=s);let G=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ee?void 0:d,le=P&&B!==d&&this.options.updateMissing;if(ee||ie||le){if(this.logger.log(le?"updateKey":"missingKey",p,u,s,le?B:d),o){let ce=this.resolve(s,{...i,keySeparator:!1});ce&&ce.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 _e=[],Ie=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Ie&&Ie[0])for(let ce=0;ce<Ie.length;ce++)_e.push(Ie[ce]);else this.options.saveMissingTo==="all"?_e=this.languageUtils.toResolveHierarchy(i.lng||this.language):_e.push(i.lng||this.language);let De=(ce,We,gt)=>{let wt=P&&gt!==d?gt:G;this.options.missingKeyHandler?this.options.missingKeyHandler(ce,u,We,wt,le,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(ce,u,We,wt,le,i),this.emit("missingKey",ce,u,We,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?_e.forEach(ce=>{let We=this.pluralResolver.getSuffixes(ce,i);L&&i[`defaultValue${this.options.pluralSeparator}zero`]&&We.indexOf(`${this.options.pluralSeparator}zero`)<0&&We.push(`${this.options.pluralSeparator}zero`),We.forEach(gt=>{De([ce],s+gt,i[`defaultValue${gt}`]||B)})}):De(_e,s,B))}d=this.extendTranslation(d,t,i,h,n),ee&&d===s&&this.options.appendNamespaceToMissingKey&&(d=`${u}${l}${s}`),(ee||ie)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${l}${s}`:s,ie?d:void 0,i))}return a?(h.res=d,h.usedParams=this.getUsedParamsDetails(i),h):d}extendTranslation(t,r,n,i,a){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let c=or(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(c){let p=t.match(this.interpolator.nestingRegexp);u=p&&p.length}let l=n.replace&&!or(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),t=this.interpolator.interpolate(t,l,n.lng||this.language||i.usedLng,n),c){let p=t.match(this.interpolator.nestingRegexp),f=p&&p.length;u<f&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...p)=>a?.[0]===p[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${r[0]}`),null):this.translate(...p,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,s=or(o)?[o]:o;return t!=null&&s?.length&&n.applyPostProcessor!==!1&&(t=dlr.handle(s,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,r={}){let n,i,a,o,s;return or(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(c,r),l=u.key;i=l;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let f=r.count!==void 0&&!or(r.count),h=f&&!r.ordinal&&r.count===0,d=r.context!==void 0&&(or(r.context)||typeof r.context=="number")&&r.context!=="",m=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);p.forEach(_=>{this.isValidLookup(n)||(s=_,!olr[`${m[0]}-${_}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(olr[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" 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!!!")),m.forEach(T=>{if(this.isValidLookup(n))return;o=T;let O=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(O,l,T,_,r);else{let C;f&&(C=this.pluralResolver.getSuffix(T,r.count,r));let P=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&C.indexOf(N)===0&&O.push(l+C.replace(N,this.options.pluralSeparator)),O.push(l+C),h&&O.push(l+P)),d){let F=`${l}${this.options.contextSeparator||"_"}${r.context}`;O.push(F),f&&(r.ordinal&&C.indexOf(N)===0&&O.push(F+C.replace(N,this.options.pluralSeparator)),O.push(F+C),h&&O.push(F+P))}}let A;for(;A=O.pop();)this.isValidLookup(n)||(a=A,n=this.getResource(T,_,A,r))}))})}),{res:n,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,n,i):this.resourceStore.getResource(t,r,n,i)}getUsedParamsDetails(t={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!or(t.replace),i=n?t.replace:t;if(n&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let a of r)delete i[a]}return i}static hasDefaultValue(t){let r="defaultValue";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&r===n.substring(0,r.length)&&t[n]!==void 0)return!0;return!1}},Dae=class{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Wg.create("languageUtils")}getScriptPartFromCode(t){if(t=UB(t),!t||t.indexOf("-")<0)return null;let r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=UB(t),!t||t.indexOf("-")<0)return t;let r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(or(t)&&t.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let a=this.getLanguagePartFromCode(n);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(o=>{if(o===a)return o;if(!(o.indexOf("-")<0&&a.indexOf("-")<0)&&(o.indexOf("-")>0&&a.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===a||o.indexOf(a)===0&&a.length>1))return o})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),or(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let n=t[r];return n||(n=t[this.getScriptPartFromCode(r)]),n||(n=t[this.formatLanguageCode(r)]),n||(n=t[this.getLanguagePartFromCode(r)]),n||(n=t.default),n||[]}toResolveHierarchy(t,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),i=[],a=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return or(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):or(t)&&a(this.formatLanguageCode(t)),n.forEach(o=>{i.indexOf(o)<0&&a(this.formatLanguageCode(o))}),i}},slr={zero:0,one:1,two:2,few:3,many:4,other:5},clr={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},lje=class{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=Wg.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){let n=UB(t==="dev"?"en":t),i=r.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:n,type:i});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let o;try{o=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),clr;if(!t.match(/-|_/))return clr;let c=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(c,r)}return this.pluralRulesCache[a]=o,o}needsPlural(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,n={}){return this.getSuffixes(t,n).map(i=>`${r}${i}`)}getSuffixes(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,a)=>slr[i]-slr[a]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,r,n={}){let i=this.getRule(t,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,n))}},ulr=(e,t,r,n=".",i=!0)=>{let a=pSi(e,t,r);return!a&&i&&or(r)&&(a=sje(e,r,n),a===void 0&&(a=sje(t,r,n))),a},ije=e=>e.replace(/\$/g,"$$$$"),Nae=class{constructor(t={}){this.logger=Wg.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:a,prefixEscaped:o,suffix:s,suffixEscaped:c,formatSeparator:u,unescapeSuffix:l,unescapePrefix:p,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:d,nestingSuffixEscaped:m,nestingOptionsSeparator:_,maxReplaces:T,alwaysFormat:O}=t.interpolation;this.escape=r!==void 0?r:dSi,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?TC(a):o||"{{",this.suffix=s?TC(s):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=f?TC(f):h||TC("$t("),this.nestingSuffix=d?TC(d):m||TC(")"),this.nestingOptionsSeparator=_||",",this.maxReplaces=T||1e3,this.alwaysFormat=O!==void 0?O:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let t=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,n,i){let a,o,s,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){let T=ulr(r,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(T,void 0,n,{...i,...r,interpolationkey:h}):T}let d=h.split(this.formatSeparator),m=d.shift().trim(),_=d.join(this.formatSeparator).trim();return this.format(ulr(r,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),_,n,{...i,...r,interpolationkey:m})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>ije(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?ije(this.escape(h)):ije(h)}].forEach(h=>{for(s=0;a=h.regex.exec(t);){let d=a[1].trim();if(o=u(d),o===void 0)if(typeof l=="function"){let _=l(t,a,i);o=or(_)?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,d))o="";else if(p){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${d} for interpolating ${t}`),o="";else!or(o)&&!this.useRawValueToEscape&&(o=rlr(o));let m=h.safeValue(o);if(t=t.replace(a[0],m),p?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=a[0].length):h.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,r,n={}){let i,a,o,s=(c,u)=>{let l=this.nestingOptionsSeparator;if(c.indexOf(l)<0)return c;let p=c.split(new RegExp(`${TC(l)}[ ]*{`)),f=`{${p[1]}`;c=p[0],f=this.interpolate(f,o);let h=f.match(/'/g),d=f.match(/"/g);((h?.length??0)%2===0&&!d||(d?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${l}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(t);){let c=[];o={...n},o=o.replace&&!or(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(c=i[1].slice(u).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),a=r(s.call(this,i[1].trim(),o),o),a&&i[0]===t&&!or(a))return a;or(a)||(a=rlr(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),a=""),c.length&&(a=c.reduce((l,p)=>this.format(l,p,n.lng,{...n,interpolationkey:i[1].trim()}),a.trim())),t=t.replace(i[0],a),this.regexp.lastIndex=0}return t}},_Si=e=>{let t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){let n=e.split("(");t=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);t==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[s,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),l=s.trim();r[l]||(r[l]=u),u==="false"&&(r[l]=!1),u==="true"&&(r[l]=!0),isNaN(u)||(r[l]=parseInt(u,10))}})}return{formatName:t,formatOptions:r}},llr=e=>{let t={};return(r,n,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=n+JSON.stringify(a),s=t[o];return s||(s=e(UB(n),i),t[o]=s),s(r)}},ESi=e=>(t,r,n)=>e(UB(r),n)(t),pje=class{constructor(t={}){this.logger=Wg.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?llr:ESi;this.formats={number:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a});return s=>o.format(s)}),currency:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a,style:"currency"});return s=>o.format(s)}),datetime:n((i,a)=>{let o=new Intl.DateTimeFormat(i,{...a});return s=>o.format(s)}),relativetime:n((i,a)=>{let o=new Intl.RelativeTimeFormat(i,{...a});return s=>o.format(s,a.range||"day")}),list:n((i,a)=>{let o=new Intl.ListFormat(i,{...a});return s=>o.format(s)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=llr(r)}format(t,r,n,i={}){let a=r.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(s=>s.indexOf(")")>-1)){let s=a.findIndex(c=>c.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,s)].join(this.formatSeparator)}return a.reduce((s,c)=>{let{formatName:u,formatOptions:l}=_Si(c);if(this.formats[u]){let p=s;try{let f=i?.formatParams?.[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||n;p=this.formats[u](s,h,{...l,...i,...f})}catch(f){this.logger.warn(f)}return p}else this.logger.warn(`there was no format function for ${u}`);return s},t)}},TSi=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},fje=class extends xR{constructor(t,r,n,i={}){super(),this.backend=t,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Wg.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,i.backend,i)}queueLoad(t,r,n,i){let a={},o={},s={},c={};return t.forEach(u=>{let l=!0;r.forEach(p=>{let f=`${u}|${p}`;!n.reload&&this.store.hasResourceBundle(u,p)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,l=!1,o[f]===void 0&&(o[f]=!0),a[f]===void 0&&(a[f]=!0),c[p]===void 0&&(c[p]=!0)))}),l||(s[u]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(c)}}loaded(t,r,n){let i=t.split("|"),a=i[0],o=i[1];r&&this.emit("failedLoading",a,o,r),!r&&n&&this.store.addResourceBundle(a,o,n,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&n&&(this.state[t]=0);let s={};this.queue.forEach(c=>{lSi(c.loaded,[a],o),TSi(c,t),r&&c.errors.push(r),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{s[u]||(s[u]={});let l=c.loaded[u];l.length&&l.forEach(p=>{s[u][p]===void 0&&(s[u][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(c=>!c.done)}read(t,r,n,i=0,a=this.retryTimeout,o){if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:n,tried:i,wait:a,callback:o});return}this.readingCalls++;let s=(u,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,n,i+1,a*2,o)},a);return}o(u,l)},c=this.backend[n].bind(this.backend);if(c.length===2){try{let u=c(t,r);u&&typeof u.then=="function"?u.then(l=>s(null,l)).catch(s):s(null,u)}catch(u){s(u)}return}return c(t,r,s)}prepareLoading(t,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();or(t)&&(t=this.languageUtils.toResolveHierarchy(t)),or(r)&&(r=[r]);let a=this.queueLoad(t,r,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(o=>{this.loadOne(o)})}load(t,r,n){this.prepareLoading(t,r,{},n)}reload(t,r,n){this.prepareLoading(t,r,{reload:!0},n)}loadOne(t,r=""){let n=t.split("|"),i=n[0],a=n[1];this.read(i,a,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${r}loading namespace ${a} for language ${i} failed`,o),!o&&s&&this.logger.log(`${r}loaded namespace ${a} for language ${i}`,s),this.loaded(t,o,s)})}saveMissing(t,r,n,i,a,o={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" 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(!(n==null||n==="")){if(this.backend?.create){let c={...o,isUpdate:a},u=this.backend.create.bind(this.backend);if(u.length<6)try{let l;u.length===5?l=u(t,r,n,i,c):l=u(t,r,n,i),l&&typeof l.then=="function"?l.then(p=>s(null,p)).catch(s):s(null,l)}catch(l){s(l)}else u(t,r,n,i,s,c)}!t||!t[0]||this.store.addResource(t[0],r,n,i)}}},aje=()=>({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:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),or(e[1])&&(t.defaultValue=e[1]),or(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){let r=e[3]||e[2];Object.keys(r).forEach(n=>{t[n]=r[n]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),plr=e=>(or(e.ns)&&(e.ns=[e.ns]),or(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),or(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),Aae=()=>{},bSi=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})},mlr="__i18next_supportNoticeShown",SSi=()=>typeof globalThis<"u"&&!!globalThis[mlr],OSi=()=>{typeof globalThis<"u"&&(globalThis[mlr]=!0)},ASi=e=>!!(e?.modules?.backend?.name?.indexOf("Locize")>0||e?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||e?.options?.backend?.backends&&e.options.backend.backends.some(t=>t?.name?.indexOf("Locize")>0||t?.constructor?.name?.indexOf("Locize")>0)),dje=class e extends xR{constructor(t={},r){if(super(),this.options=plr(t),this.services={},this.logger=Wg,this.modules={external:[]},bSi(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(or(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));let n=aje();this.options={...n,...this.options,...plr(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!ASi(this)&&!SSi()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("\u{1F310} i18next is maintained with support from Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}"),OSi());let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Wg.init(i(this.modules.logger),this.options):Wg.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=pje;let l=new Dae(this.options);this.store=new xae(this.options.resources,this.options);let p=this.services;p.logger=Wg,p.resourceStore=this.store,p.languageUtils=l,p.pluralResolver=new lje(l,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.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"),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(p.formatter=i(u),p.formatter.init&&p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new Nae(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new fje(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new Pae(this.services,this.options),this.translator.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Aae),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...l)=>this.store[u](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...l)=>(this.store[u](...l),this)});let s=kB(),c=()=>{let u=(l,p)=>{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),s.resolve(p),r(l,p)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),s}loadResources(t,r=Aae){let n=r,i=or(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let a=[],o=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{u!=="cimode"&&a.indexOf(u)<0&&a.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload?.forEach?.(s=>o(s)),this.services.backendConnector.load(a,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(s)})}else n(null)}reloadResources(t,r,n){let i=kB();return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),n||(n=Aae),this.services.backendConnector.reload(t,r,a=>{i.resolve(),n(a)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&dlr.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;let n=kB();this.emit("languageChanging",t);let i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?this.isLanguageChangingTo===t&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(s,(...u)=>this.t(...u))},o=s=>{!t&&!s&&this.services.languageDetector&&(s=[]);let c=or(s)?s:s&&s[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(or(s)?[s]:s);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,l=>{a(l,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(t),n}getFixedT(t,r,n){let i=(a,o,...s)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([a,o].concat(s)):c={...o},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||n||i.keyPrefix);let u=this.options.keySeparator||".",l;return c.keyPrefix&&Array.isArray(a)?l=a.map(p=>(typeof p=="function"&&(p=uje(p,{...this.options,...o})),`${c.keyPrefix}${u}${p}`)):(typeof a=="function"&&(a=uje(a,{...this.options,...o})),l=c.keyPrefix?`${c.keyPrefix}${u}${a}`:a),this.t(l,c)};return or(t)?i.lng=t:i.lngs=t,i.ns=r,i.keyPrefix=n,i}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){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;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let o=(s,c)=>{let u=this.services.backendConnector.state[`${s}|${c}`];return u===-1||u===0||u===2};if(r.precheck){let s=r.precheck(this,o);if(s!==void 0)return s}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,t)&&(!i||o(a,t)))}loadNamespaces(t,r){let n=kB();return this.options.ns?(or(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(t,r){let n=kB();or(t)&&(t=[t]);let i=this.options.preload||[],a=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return a.length?(this.options.preload=i.concat(a),this.loadResources(o=>{n.resolve(),r&&r(o)}),n):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{let i=new Intl.Locale(t);if(i&&i.getTextInfo){let a=i.getTextInfo();if(a&&a.direction)return a.direction}}catch{}let r=["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"],n=this.services?.languageUtils||new Dae(aje());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){let n=new e(t,r);return n.createInstance=e.createInstance,n}cloneInstance(t={},r=Aae){let n=t.forkResourceStore;n&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),["store","services","language"].forEach(s=>{a[s]=this[s]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n){let s=Object.keys(this.store.data).reduce((c,u)=>(c[u]={...this.store.data[u]},c[u]=Object.keys(c[u]).reduce((l,p)=>(l[p]={...c[u][p]},l),c[u]),c),{});a.store=new xae(s,i),a.services.resourceStore=a.store}if(t.interpolation){let c={...aje().interpolation,...this.options.interpolation,...t.interpolation},u={...i,interpolation:c};a.services.interpolator=new Nae(u)}return a.translator=new Pae(a.services,i),a.translator.on("*",(s,...c)=>{a.emit(s,...c)}),a.init(i,r),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},Qc=dje.createInstance(),Lma=Qc.createInstance,Mma=Qc.dir,$ma=Qc.init,kma=Qc.loadResources,Fma=Qc.reloadResources,Uma=Qc.use,Vma=Qc.changeLanguage,jma=Qc.getFixedT,qma=Qc.t,Bma=Qc.exists,Gma=Qc.setDefaultNamespace,Hma=Qc.hasLoadedNamespace,zma=Qc.loadNamespaces,Yma=Qc.loadLanguages;var glr="@sap-ux/fiori-mcp-server",Tlr="unknown-tool",CSi="0a65e45d-6bf4-421d-b845-61e888c50e9e",S_=class{static _telemetryData;static _previousEventTimestamp;static _sessionId;static get telemetryData(){return this._telemetryData}static get sessionId(){return this._sessionId}static async initTelemetrySettings(t){this._sessionId=(0,_lr.randomUUID)(),ft.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:glr,version:m5e},watchTelemetrySettingStore:!1,internalFeature:(0,ylr.isInternalFeaturesSettingEnabled)(),resourceId:CSi,...t};try{await(0,Fh.initTelemetrySettings)(r)}catch(n){ft.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(t,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=Qc.t("telemetry.unknownOs");try{i=(0,Elr.default)()}catch{}this._telemetryData={Platform:(0,vlr.isAppStudio)()?"SBAS":"VSCode",OperatingSystem:i,SessionId:this.sessionId}}if(r){let i={...this._telemetryData,...t};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static prepareTelemetryEvent(t,r){this.markToolsEndTime();let n=r.markName?Fh.PerformanceMeasurementAPI.getMeasurementDuration(r.markName):void 0;return{eventName:t,properties:r,measurements:n?{RequestTime:n}:{}}}static markToolStartTime(){this.createTelemetryData({markName:Fh.PerformanceMeasurementAPI.startMark("MCP_LOADING_TIME")})}static markToolsEndTime(){this._telemetryData?.markName&&(Fh.PerformanceMeasurementAPI.endMark(this._telemetryData.markName),Fh.PerformanceMeasurementAPI.measure(this._telemetryData.markName))}static async sendTelemetry(t,r,n){let i=this.createTelemetryData(r)??r,a=this.prepareTelemetryEvent(t,i);await Fh.ClientFactory.getTelemetryClient().reportEvent(a,Fh.SampleRate.NoSampling,n?{appPath:n}:void 0)}static getTelemetryName(){return glr}};var wae=class{server;mcpClientName="unknown-client";mcpClientVersion="unknown-version";constructor(){this.server=new hz({name:"fiori-mcp",version:PS.version},{capabilities:{tools:{}}}),this.setupToolHandlers(),this.setupErrorHandling()}setupErrorHandling(){this.server.onerror=t=>ft.error(`[MCP Error] ${t}`),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}async setupTelemetry(){await S_.initTelemetrySettings()}setupToolHandlers(){this.server.setRequestHandler(ZL,async t=>{this.mcpClientName=t.params.clientInfo?.name||"unknown-client",this.mcpClientVersion=t.params.clientInfo?.version||"unknown-version",ft.info(`MCP Client connected: ${this.mcpClientName} v${this.mcpClientVersion}`);let r={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await S_.sendTelemetry(jVt,r),{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"fiori-mcp",version:PS.version}}}),this.server.setRequestHandler(gue,async()=>{let t={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await S_.sendTelemetry(qVt,t),{tools:P4t}}),this.server.setRequestHandler(aM,async t=>{let{name:r,arguments:n}=t.params;try{let i;S_.markToolStartTime();let a={tool:r,mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};if("functionalityId"in n){let{functionalityId:s}=n;Array.isArray(s)&&s.length>=1?a.functionalityId=`property-change:${s.at(-1)}`:a.functionalityId=s}switch(ft.debug(`Executing tool: ${r} with arguments: ${JSON.stringify(n)}`),r){case"search_docs":i=await mxe(n,!0);break;case"list_fiori_apps":i=await gxe(n);break;case"list_functionality":i=await _Le(n);break;case"get_functionality_details":i=await hj(n);break;case"execute_functionality":i=await bLe(n);break;default:throw await S_.sendTelemetry(Tlr,{},n?.appPath),new Error(`Unknown tool: ${r}. Try one of: list_fiori_apps, list_functionality, get_functionality_details, execute_functionality.`)}await S_.sendTelemetry(r,a,n?.appPath);let o=this.convertResultToCallToolResult(i);return ft.debug(`Tool ${r} executed successfully with result:`),ft.debug(o),o}catch(i){return ft.error(`Error executing tool ${r}: ${i}`),ft.debug(i),{content:[{type:"text",text:`Error: ${i instanceof Error?i.message:"Unknown error occurred"}`}]}}})}convertResultToCallToolResult(t){if(typeof t=="string"||t instanceof String)return{content:[{type:"text",text:t.toString()}]};let r={content:[{type:"text",text:JSON.stringify(t)}]};return Array.isArray(t)||(r.structuredContent=t),r}async run(){await this.setupTelemetry();let t=new gz;await this.server.connect(t),ft.info(`SAP Fiori - Model Context Protocol (MCP) server (@sap-ux/fiori-mcp-server@${PS.version}) running on stdio`)}};var xSi=new wae;xSi.run().catch(e=>ft.error(`Server error: ${e}`));
1662
+ You MUST provide the exact parameter information obtained from get_functionality_details (Step 2).`,annotations:{title:"Execute Fiori Functionality",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:Na(O5e),outputSchema:Na(P5e)}];var Fh=Gt(Vcr()),ylr=Gt(Bcr()),vlr=Gt(U1()),_lr=require("node:crypto"),Elr=Gt(tlr());var or=e=>typeof e=="string",kB=()=>{let e,t,r=new Promise((n,i)=>{e=n,t=i});return r.resolve=e,r.reject=t,r},rlr=e=>e==null?"":""+e,cSi=(e,t,r)=>{e.forEach(n=>{t[n]&&(r[n]=t[n])})},uSi=/###/g,nlr=e=>e&&e.indexOf("###")>-1?e.replace(uSi,"."):e,ilr=e=>!e||or(e),FB=(e,t,r)=>{let n=or(t)?t.split("."):t,i=0;for(;i<n.length-1;){if(ilr(e))return{};let a=nlr(n[i]);!e[a]&&r&&(e[a]=new r),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={},++i}return ilr(e)?{}:{obj:e,k:nlr(n[i])}},alr=(e,t,r)=>{let{obj:n,k:i}=FB(e,t,Object);if(n!==void 0||t.length===1){n[i]=r;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=FB(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=FB(e,o,Object),s?.obj&&typeof s.obj[`${s.k}.${a}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=r},lSi=(e,t,r,n)=>{let{obj:i,k:a}=FB(e,t,Object);i[a]=i[a]||[],i[a].push(r)},Cae=(e,t)=>{let{obj:r,k:n}=FB(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},pSi=(e,t,r)=>{let n=Cae(e,r);return n!==void 0?n:Cae(t,r)},flr=(e,t,r)=>{for(let n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?or(e[n])||e[n]instanceof String||or(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):flr(e[n],t[n],r):e[n]=t[n]);return e},TC=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),fSi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},dSi=e=>or(e)?e.replace(/[&<>"'\/]/g,t=>fSi[t]):e,oje=class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){let r=this.regExpMap.get(t);if(r!==void 0)return r;let n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}},hSi=[" ",",","?","!",";"],mSi=new oje(20),gSi=(e,t,r)=>{t=t||"",r=r||"";let n=hSi.filter(o=>t.indexOf(o)<0&&r.indexOf(o)<0);if(n.length===0)return!0;let i=mSi.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),a=!i.test(e);if(!a){let o=e.indexOf(r);o>0&&!i.test(e.substring(0,o))&&(a=!0)}return a},sje=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let n=t.split(r),i=e;for(let a=0;a<n.length;){if(!i||typeof i!="object")return;let o,s="";for(let c=a;c<n.length;++c)if(c!==a&&(s+=r),s+=n[c],o=i[s],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<n.length-1)continue;a+=c-a+1;break}i=o}return i},UB=e=>e?.replace("_","-"),ySi={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},cje=class e{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||ySi,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,n,i){return i&&!this.debug?null:(or(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Wg=new cje,xR=class{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let i=this.observers[n].get(r)||0;this.observers[n].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,a])=>{for(let o=0;o<a;o++)i.apply(i,[t,...r])})}},xae=class extends xR{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){let r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,n,i={}){let a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure,s;t.indexOf(".")>-1?s=t.split("."):(s=[t,r],n&&(Array.isArray(n)?s.push(...n):or(n)&&a?s.push(...n.split(a)):s.push(n)));let c=Cae(this.data,s);return!c&&!r&&!n&&t.indexOf(".")>-1&&(t=s[0],r=s[1],n=s.slice(2).join(".")),c||!o||!or(n)?c:sje(this.data?.[t]?.[r],n,a)}addResource(t,r,n,i,a={silent:!1}){let o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,s=[t,r];n&&(s=s.concat(o?n.split(o):n)),t.indexOf(".")>-1&&(s=t.split("."),i=r,r=s[1]),this.addNamespaces(r),alr(this.data,s,i),a.silent||this.emit("added",t,r,n,i)}addResources(t,r,n,i={silent:!1}){for(let a in n)(or(n[a])||Array.isArray(n[a]))&&this.addResource(t,r,a,n[a],{silent:!0});i.silent||this.emit("added",t,r,n)}addResourceBundle(t,r,n,i,a,o={silent:!1,skipCopy:!1}){let s=[t,r];t.indexOf(".")>-1&&(s=t.split("."),i=n,n=r,r=s[1]),this.addNamespaces(r);let c=Cae(this.data,s)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?flr(c,n,a):c={...c,...n},alr(this.data,s,c),o.silent||this.emit("added",t,r,n)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){let r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}},dlr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(a=>{t=this.processors[a]?.process(t,r,n,i)??t}),t}},hlr=Symbol("i18next/PATH_KEY");function vSi(){let e=[],t=Object.create(null),r;return t.get=(n,i)=>(r?.revoke?.(),i===hlr?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function uje(e,t){let{[hlr]:r}=e(vSi());return r.join(t?.keySeparator??".")}var olr={},nje=e=>!or(e)&&typeof e!="boolean"&&typeof e!="number",Pae=class e extends xR{constructor(t,r={}){super(),cSi(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Wg.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){let n={...r};if(t==null)return!1;let i=this.resolve(t,n);if(i?.res===void 0)return!1;let a=nje(i.res);return!(n.returnObjects===!1&&a)}extractFromKey(t,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ns||this.options.defaultNS||[],o=n&&t.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!gSi(t,n,i);if(o&&!s){let c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:or(a)?[a]:a};let u=t.split(n);(n!==i||n===i&&this.options.ns.indexOf(u[0])>-1)&&(a=u.shift()),t=u.join(i)}return{key:t,namespaces:or(a)?[a]:a}}translate(t,r,n){let i=typeof r=="object"?{...r}:r;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),t==null)return"";typeof t=="function"&&(t=uje(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]);let a=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),u=c[c.length-1],l=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");let p=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p?.toLowerCase()==="cimode")return f?a?{res:`${u}${l}${s}`,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${l}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:p,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:s;let h=this.resolve(t,i),d=h?.res,m=h?.usedKey||s,_=h?.exactUsedKey||s,T=["[object Number]","[object Function]","[object RegExp]"],O=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,C=i.count!==void 0&&!or(i.count),P=e.hasDefaultValue(i),N=C?this.pluralResolver.getSuffix(p,i.count,i):"",F=i.ordinal&&C?this.pluralResolver.getSuffix(p,i.count,{ordinal:!1}):"",L=C&&!i.ordinal&&i.count===0,B=L&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${N}`]||i[`defaultValue${F}`]||i.defaultValue,J=d;A&&!d&&P&&(J=B);let j=nje(J),Q=Object.prototype.toString.apply(J);if(A&&J&&j&&T.indexOf(Q)<0&&!(or(O)&&Array.isArray(J))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let ie=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,J,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(h.res=ie,h.usedParams=this.getUsedParamsDetails(i),h):ie}if(o){let ie=Array.isArray(J),ee=ie?[]:{},Y=ie?_:m;for(let G in J)if(Object.prototype.hasOwnProperty.call(J,G)){let le=`${Y}${o}${G}`;P&&!d?ee[G]=this.translate(le,{...i,defaultValue:nje(B)?B[G]:void 0,joinArrays:!1,ns:c}):ee[G]=this.translate(le,{...i,joinArrays:!1,ns:c}),ee[G]===le&&(ee[G]=J[G])}d=ee}}else if(A&&or(O)&&Array.isArray(d))d=d.join(O),d&&(d=this.extendTranslation(d,t,i,n));else{let ie=!1,ee=!1;!this.isValidLookup(d)&&P&&(ie=!0,d=B),this.isValidLookup(d)||(ee=!0,d=s);let G=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ee?void 0:d,le=P&&B!==d&&this.options.updateMissing;if(ee||ie||le){if(this.logger.log(le?"updateKey":"missingKey",p,u,s,le?B:d),o){let ce=this.resolve(s,{...i,keySeparator:!1});ce&&ce.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 _e=[],Ie=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Ie&&Ie[0])for(let ce=0;ce<Ie.length;ce++)_e.push(Ie[ce]);else this.options.saveMissingTo==="all"?_e=this.languageUtils.toResolveHierarchy(i.lng||this.language):_e.push(i.lng||this.language);let De=(ce,We,gt)=>{let wt=P&&gt!==d?gt:G;this.options.missingKeyHandler?this.options.missingKeyHandler(ce,u,We,wt,le,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(ce,u,We,wt,le,i),this.emit("missingKey",ce,u,We,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?_e.forEach(ce=>{let We=this.pluralResolver.getSuffixes(ce,i);L&&i[`defaultValue${this.options.pluralSeparator}zero`]&&We.indexOf(`${this.options.pluralSeparator}zero`)<0&&We.push(`${this.options.pluralSeparator}zero`),We.forEach(gt=>{De([ce],s+gt,i[`defaultValue${gt}`]||B)})}):De(_e,s,B))}d=this.extendTranslation(d,t,i,h,n),ee&&d===s&&this.options.appendNamespaceToMissingKey&&(d=`${u}${l}${s}`),(ee||ie)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${l}${s}`:s,ie?d:void 0,i))}return a?(h.res=d,h.usedParams=this.getUsedParamsDetails(i),h):d}extendTranslation(t,r,n,i,a){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let c=or(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(c){let p=t.match(this.interpolator.nestingRegexp);u=p&&p.length}let l=n.replace&&!or(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),t=this.interpolator.interpolate(t,l,n.lng||this.language||i.usedLng,n),c){let p=t.match(this.interpolator.nestingRegexp),f=p&&p.length;u<f&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...p)=>a?.[0]===p[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${r[0]}`),null):this.translate(...p,r),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,s=or(o)?[o]:o;return t!=null&&s?.length&&n.applyPostProcessor!==!1&&(t=dlr.handle(s,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,r={}){let n,i,a,o,s;return or(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(n))return;let u=this.extractFromKey(c,r),l=u.key;i=l;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let f=r.count!==void 0&&!or(r.count),h=f&&!r.ordinal&&r.count===0,d=r.context!==void 0&&(or(r.context)||typeof r.context=="number")&&r.context!=="",m=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);p.forEach(_=>{this.isValidLookup(n)||(s=_,!olr[`${m[0]}-${_}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(olr[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" 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!!!")),m.forEach(T=>{if(this.isValidLookup(n))return;o=T;let O=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(O,l,T,_,r);else{let C;f&&(C=this.pluralResolver.getSuffix(T,r.count,r));let P=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&C.indexOf(N)===0&&O.push(l+C.replace(N,this.options.pluralSeparator)),O.push(l+C),h&&O.push(l+P)),d){let F=`${l}${this.options.contextSeparator||"_"}${r.context}`;O.push(F),f&&(r.ordinal&&C.indexOf(N)===0&&O.push(F+C.replace(N,this.options.pluralSeparator)),O.push(F+C),h&&O.push(F+P))}}let A;for(;A=O.pop();)this.isValidLookup(n)||(a=A,n=this.getResource(T,_,A,r))}))})}),{res:n,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,n,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,n,i):this.resourceStore.getResource(t,r,n,i)}getUsedParamsDetails(t={}){let r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!or(t.replace),i=n?t.replace:t;if(n&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(let a of r)delete i[a]}return i}static hasDefaultValue(t){let r="defaultValue";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&r===n.substring(0,r.length)&&t[n]!==void 0)return!0;return!1}},Dae=class{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Wg.create("languageUtils")}getScriptPartFromCode(t){if(t=UB(t),!t||t.indexOf("-")<0)return null;let r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=UB(t),!t||t.indexOf("-")<0)return t;let r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(or(t)&&t.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(n=>{if(r)return;let i=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(n=>{if(r)return;let i=this.getScriptPartFromCode(n);if(this.isSupportedCode(i))return r=i;let a=this.getLanguagePartFromCode(n);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(o=>{if(o===a)return o;if(!(o.indexOf("-")<0&&a.indexOf("-")<0)&&(o.indexOf("-")>0&&a.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===a||o.indexOf(a)===0&&a.length>1))return o})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),or(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let n=t[r];return n||(n=t[this.getScriptPartFromCode(r)]),n||(n=t[this.formatLanguageCode(r)]),n||(n=t[this.getLanguagePartFromCode(r)]),n||(n=t.default),n||[]}toResolveHierarchy(t,r){let n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),i=[],a=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return or(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):or(t)&&a(this.formatLanguageCode(t)),n.forEach(o=>{i.indexOf(o)<0&&a(this.formatLanguageCode(o))}),i}},slr={zero:0,one:1,two:2,few:3,many:4,other:5},clr={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},lje=class{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=Wg.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){let n=UB(t==="dev"?"en":t),i=r.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:n,type:i});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let o;try{o=new Intl.PluralRules(n,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),clr;if(!t.match(/-|_/))return clr;let c=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(c,r)}return this.pluralRulesCache[a]=o,o}needsPlural(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,n={}){return this.getSuffixes(t,n).map(i=>`${r}${i}`)}getSuffixes(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((i,a)=>slr[i]-slr[a]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(t,r,n={}){let i=this.getRule(t,n);return i?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,n))}},ulr=(e,t,r,n=".",i=!0)=>{let a=pSi(e,t,r);return!a&&i&&or(r)&&(a=sje(e,r,n),a===void 0&&(a=sje(t,r,n))),a},ije=e=>e.replace(/\$/g,"$$$$"),Nae=class{constructor(t={}){this.logger=Wg.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});let{escape:r,escapeValue:n,useRawValueToEscape:i,prefix:a,prefixEscaped:o,suffix:s,suffixEscaped:c,formatSeparator:u,unescapeSuffix:l,unescapePrefix:p,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:d,nestingSuffixEscaped:m,nestingOptionsSeparator:_,maxReplaces:T,alwaysFormat:O}=t.interpolation;this.escape=r!==void 0?r:dSi,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?TC(a):o||"{{",this.suffix=s?TC(s):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=f?TC(f):h||TC("$t("),this.nestingSuffix=d?TC(d):m||TC(")"),this.nestingOptionsSeparator=_||",",this.maxReplaces=T||1e3,this.alwaysFormat=O!==void 0?O:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let t=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,n,i){let a,o,s,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){let T=ulr(r,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(T,void 0,n,{...i,...r,interpolationkey:h}):T}let d=h.split(this.formatSeparator),m=d.shift().trim(),_=d.join(this.formatSeparator).trim();return this.format(ulr(r,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),_,n,{...i,...r,interpolationkey:m})};this.resetRegExp();let l=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>ije(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?ije(this.escape(h)):ije(h)}].forEach(h=>{for(s=0;a=h.regex.exec(t);){let d=a[1].trim();if(o=u(d),o===void 0)if(typeof l=="function"){let _=l(t,a,i);o=or(_)?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,d))o="";else if(p){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${d} for interpolating ${t}`),o="";else!or(o)&&!this.useRawValueToEscape&&(o=rlr(o));let m=h.safeValue(o);if(t=t.replace(a[0],m),p?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=a[0].length):h.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,r,n={}){let i,a,o,s=(c,u)=>{let l=this.nestingOptionsSeparator;if(c.indexOf(l)<0)return c;let p=c.split(new RegExp(`${TC(l)}[ ]*{`)),f=`{${p[1]}`;c=p[0],f=this.interpolate(f,o);let h=f.match(/'/g),d=f.match(/"/g);((h?.length??0)%2===0&&!d||(d?.length??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${l}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(t);){let c=[];o={...n},o=o.replace&&!or(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(c=i[1].slice(u).split(this.formatSeparator).map(l=>l.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),a=r(s.call(this,i[1].trim(),o),o),a&&i[0]===t&&!or(a))return a;or(a)||(a=rlr(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),a=""),c.length&&(a=c.reduce((l,p)=>this.format(l,p,n.lng,{...n,interpolationkey:i[1].trim()}),a.trim())),t=t.replace(i[0],a),this.regexp.lastIndex=0}return t}},_Si=e=>{let t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){let n=e.split("(");t=n[0].toLowerCase().trim();let i=n[1].substring(0,n[1].length-1);t==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(o=>{if(o){let[s,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),l=s.trim();r[l]||(r[l]=u),u==="false"&&(r[l]=!1),u==="true"&&(r[l]=!0),isNaN(u)||(r[l]=parseInt(u,10))}})}return{formatName:t,formatOptions:r}},llr=e=>{let t={};return(r,n,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=n+JSON.stringify(a),s=t[o];return s||(s=e(UB(n),i),t[o]=s),s(r)}},ESi=e=>(t,r,n)=>e(UB(r),n)(t),pje=class{constructor(t={}){this.logger=Wg.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";let n=r.cacheInBuiltFormats?llr:ESi;this.formats={number:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a});return s=>o.format(s)}),currency:n((i,a)=>{let o=new Intl.NumberFormat(i,{...a,style:"currency"});return s=>o.format(s)}),datetime:n((i,a)=>{let o=new Intl.DateTimeFormat(i,{...a});return s=>o.format(s)}),relativetime:n((i,a)=>{let o=new Intl.RelativeTimeFormat(i,{...a});return s=>o.format(s,a.range||"day")}),list:n((i,a)=>{let o=new Intl.ListFormat(i,{...a});return s=>o.format(s)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=llr(r)}format(t,r,n,i={}){let a=r.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(s=>s.indexOf(")")>-1)){let s=a.findIndex(c=>c.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,s)].join(this.formatSeparator)}return a.reduce((s,c)=>{let{formatName:u,formatOptions:l}=_Si(c);if(this.formats[u]){let p=s;try{let f=i?.formatParams?.[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||n;p=this.formats[u](s,h,{...l,...i,...f})}catch(f){this.logger.warn(f)}return p}else this.logger.warn(`there was no format function for ${u}`);return s},t)}},TSi=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},fje=class extends xR{constructor(t,r,n,i={}){super(),this.backend=t,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=i,this.logger=Wg.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,i.backend,i)}queueLoad(t,r,n,i){let a={},o={},s={},c={};return t.forEach(u=>{let l=!0;r.forEach(p=>{let f=`${u}|${p}`;!n.reload&&this.store.hasResourceBundle(u,p)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,l=!1,o[f]===void 0&&(o[f]=!0),a[f]===void 0&&(a[f]=!0),c[p]===void 0&&(c[p]=!0)))}),l||(s[u]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(c)}}loaded(t,r,n){let i=t.split("|"),a=i[0],o=i[1];r&&this.emit("failedLoading",a,o,r),!r&&n&&this.store.addResourceBundle(a,o,n,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&n&&(this.state[t]=0);let s={};this.queue.forEach(c=>{lSi(c.loaded,[a],o),TSi(c,t),r&&c.errors.push(r),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{s[u]||(s[u]={});let l=c.loaded[u];l.length&&l.forEach(p=>{s[u][p]===void 0&&(s[u][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(c=>!c.done)}read(t,r,n,i=0,a=this.retryTimeout,o){if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:n,tried:i,wait:a,callback:o});return}this.readingCalls++;let s=(u,l)=>{if(this.readingCalls--,this.waitingReads.length>0){let p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&l&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,n,i+1,a*2,o)},a);return}o(u,l)},c=this.backend[n].bind(this.backend);if(c.length===2){try{let u=c(t,r);u&&typeof u.then=="function"?u.then(l=>s(null,l)).catch(s):s(null,u)}catch(u){s(u)}return}return c(t,r,s)}prepareLoading(t,r,n={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();or(t)&&(t=this.languageUtils.toResolveHierarchy(t)),or(r)&&(r=[r]);let a=this.queueLoad(t,r,n,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(o=>{this.loadOne(o)})}load(t,r,n){this.prepareLoading(t,r,{},n)}reload(t,r,n){this.prepareLoading(t,r,{reload:!0},n)}loadOne(t,r=""){let n=t.split("|"),i=n[0],a=n[1];this.read(i,a,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${r}loading namespace ${a} for language ${i} failed`,o),!o&&s&&this.logger.log(`${r}loaded namespace ${a} for language ${i}`,s),this.loaded(t,o,s)})}saveMissing(t,r,n,i,a,o={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" 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(!(n==null||n==="")){if(this.backend?.create){let c={...o,isUpdate:a},u=this.backend.create.bind(this.backend);if(u.length<6)try{let l;u.length===5?l=u(t,r,n,i,c):l=u(t,r,n,i),l&&typeof l.then=="function"?l.then(p=>s(null,p)).catch(s):s(null,l)}catch(l){s(l)}else u(t,r,n,i,s,c)}!t||!t[0]||this.store.addResource(t[0],r,n,i)}}},aje=()=>({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:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),or(e[1])&&(t.defaultValue=e[1]),or(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){let r=e[3]||e[2];Object.keys(r).forEach(n=>{t[n]=r[n]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),plr=e=>(or(e.ns)&&(e.ns=[e.ns]),or(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),or(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),Aae=()=>{},bSi=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})},mlr="__i18next_supportNoticeShown",SSi=()=>typeof globalThis<"u"&&!!globalThis[mlr],OSi=()=>{typeof globalThis<"u"&&(globalThis[mlr]=!0)},ASi=e=>!!(e?.modules?.backend?.name?.indexOf("Locize")>0||e?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||e?.options?.backend?.backends&&e.options.backend.backends.some(t=>t?.name?.indexOf("Locize")>0||t?.constructor?.name?.indexOf("Locize")>0)),dje=class e extends xR{constructor(t={},r){if(super(),this.options=plr(t),this.services={},this.logger=Wg,this.modules={external:[]},bSi(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(or(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));let n=aje();this.options={...n,...this.options,...plr(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!ASi(this)&&!SSi()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("\u{1F310} i18next is maintained with support from Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}"),OSi());let i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Wg.init(i(this.modules.logger),this.options):Wg.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=pje;let l=new Dae(this.options);this.store=new xae(this.options.resources,this.options);let p=this.services;p.logger=Wg,p.resourceStore=this.store,p.languageUtils=l,p.pluralResolver=new lje(l,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.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"),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(p.formatter=i(u),p.formatter.init&&p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new Nae(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new fje(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new Pae(this.services,this.options),this.translator.on("*",(h,...d)=>{this.emit(h,...d)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Aae),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...l)=>this.store[u](...l)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...l)=>(this.store[u](...l),this)});let s=kB(),c=()=>{let u=(l,p)=>{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),s.resolve(p),r(l,p)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),s}loadResources(t,r=Aae){let n=r,i=or(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let a=[],o=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{u!=="cimode"&&a.indexOf(u)<0&&a.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload?.forEach?.(s=>o(s)),this.services.backendConnector.load(a,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(s)})}else n(null)}reloadResources(t,r,n){let i=kB();return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),n||(n=Aae),this.services.backendConnector.reload(t,r,a=>{i.resolve(),n(a)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&dlr.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let r=0;r<this.languages.length;r++){let n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;let n=kB();this.emit("languageChanging",t);let i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?this.isLanguageChangingTo===t&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),r&&r(s,(...u)=>this.t(...u))},o=s=>{!t&&!s&&this.services.languageDetector&&(s=[]);let c=or(s)?s:s&&s[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(or(s)?[s]:s);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,l=>{a(l,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(t),n}getFixedT(t,r,n){let i=(a,o,...s)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([a,o].concat(s)):c={...o},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||n||i.keyPrefix);let u=this.options.keySeparator||".",l;return c.keyPrefix&&Array.isArray(a)?l=a.map(p=>(typeof p=="function"&&(p=uje(p,{...this.options,...o})),`${c.keyPrefix}${u}${p}`)):(typeof a=="function"&&(a=uje(a,{...this.options,...o})),l=c.keyPrefix?`${c.keyPrefix}${u}${a}`:a),this.t(l,c)};return or(t)?i.lng=t:i.lngs=t,i.ns=r,i.keyPrefix=n,i}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){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;let n=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let o=(s,c)=>{let u=this.services.backendConnector.state[`${s}|${c}`];return u===-1||u===0||u===2};if(r.precheck){let s=r.precheck(this,o);if(s!==void 0)return s}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,t)&&(!i||o(a,t)))}loadNamespaces(t,r){let n=kB();return this.options.ns?(or(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}loadLanguages(t,r){let n=kB();or(t)&&(t=[t]);let i=this.options.preload||[],a=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return a.length?(this.options.preload=i.concat(a),this.loadResources(o=>{n.resolve(),r&&r(o)}),n):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{let i=new Intl.Locale(t);if(i&&i.getTextInfo){let a=i.getTextInfo();if(a&&a.direction)return a.direction}}catch{}let r=["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"],n=this.services?.languageUtils||new Dae(aje());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){let n=new e(t,r);return n.createInstance=e.createInstance,n}cloneInstance(t={},r=Aae){let n=t.forkResourceStore;n&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),["store","services","language"].forEach(s=>{a[s]=this[s]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n){let s=Object.keys(this.store.data).reduce((c,u)=>(c[u]={...this.store.data[u]},c[u]=Object.keys(c[u]).reduce((l,p)=>(l[p]={...c[u][p]},l),c[u]),c),{});a.store=new xae(s,i),a.services.resourceStore=a.store}if(t.interpolation){let c={...aje().interpolation,...this.options.interpolation,...t.interpolation},u={...i,interpolation:c};a.services.interpolator=new Nae(u)}return a.translator=new Pae(a.services,i),a.translator.on("*",(s,...c)=>{a.emit(s,...c)}),a.init(i,r),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},Qc=dje.createInstance(),Lma=Qc.createInstance,Mma=Qc.dir,$ma=Qc.init,kma=Qc.loadResources,Fma=Qc.reloadResources,Uma=Qc.use,Vma=Qc.changeLanguage,jma=Qc.getFixedT,qma=Qc.t,Bma=Qc.exists,Gma=Qc.setDefaultNamespace,Hma=Qc.hasLoadedNamespace,zma=Qc.loadNamespaces,Yma=Qc.loadLanguages;var glr="@sap-ux/fiori-mcp-server",Tlr="unknown-tool",CSi="0a65e45d-6bf4-421d-b845-61e888c50e9e",S_=class{static _telemetryData;static _previousEventTimestamp;static _sessionId;static get telemetryData(){return this._telemetryData}static get sessionId(){return this._sessionId}static async initTelemetrySettings(t){this._sessionId=(0,_lr.randomUUID)(),ft.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:glr,version:m5e},watchTelemetrySettingStore:!1,internalFeature:(0,ylr.isInternalFeaturesSettingEnabled)(),resourceId:CSi,...t};try{await(0,Fh.initTelemetrySettings)(r)}catch(n){ft.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(t,r=!1){let n=new Date().getTime();if(this._previousEventTimestamp||(r=!1,this._previousEventTimestamp=n),!this._telemetryData){let i=Qc.t("telemetry.unknownOs");try{i=(0,Elr.default)()}catch{}this._telemetryData={Platform:(0,vlr.isAppStudio)()?"SBAS":"VSCode",OperatingSystem:i,SessionId:this.sessionId}}if(r){let i={...this._telemetryData,...t};if(Math.abs(this._previousEventTimestamp-n)<1e3&&JSON.stringify(i)===JSON.stringify(this._telemetryData))return}return this._previousEventTimestamp=n,this._telemetryData=Object.assign(this._telemetryData,t),this._telemetryData}static prepareTelemetryEvent(t,r){this.markToolsEndTime();let n=r.markName?Fh.PerformanceMeasurementAPI.getMeasurementDuration(r.markName):void 0;return{eventName:t,properties:r,measurements:n?{RequestTime:n}:{}}}static markToolStartTime(){this.createTelemetryData({markName:Fh.PerformanceMeasurementAPI.startMark("MCP_LOADING_TIME")})}static markToolsEndTime(){this._telemetryData?.markName&&(Fh.PerformanceMeasurementAPI.endMark(this._telemetryData.markName),Fh.PerformanceMeasurementAPI.measure(this._telemetryData.markName))}static async sendTelemetry(t,r,n){let i=this.createTelemetryData(r)??r,a=this.prepareTelemetryEvent(t,i);await Fh.ClientFactory.getTelemetryClient().reportEvent(a,Fh.SampleRate.NoSampling,n?{appPath:n}:void 0)}static getTelemetryName(){return glr}};var wae=class{server;mcpClientName="unknown-client";mcpClientVersion="unknown-version";constructor(){this.server=new hz({name:"fiori-mcp",version:PS.version,icons:[{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.svg",mimeType:"image/svg+xml"},{src:"https://raw.githubusercontent.com/SAP/open-ux-tools/main/packages/fiori-mcp-server/assets/icon.png",mimeType:"image/png"}],title:"SAP Fiori MCP Server"},{capabilities:{tools:{}}}),this.setupToolHandlers(),this.setupErrorHandling()}setupErrorHandling(){this.server.onerror=t=>ft.error(`[MCP Error] ${t}`),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}async setupTelemetry(){await S_.initTelemetrySettings()}setupToolHandlers(){this.server.setRequestHandler(ZL,async t=>{this.mcpClientName=t.params.clientInfo?.name||"unknown-client",this.mcpClientVersion=t.params.clientInfo?.version||"unknown-version",ft.info(`MCP Client connected: ${this.mcpClientName} v${this.mcpClientVersion}`);let r={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await S_.sendTelemetry(jVt,r),{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"fiori-mcp",version:PS.version}}}),this.server.setRequestHandler(gue,async()=>{let t={mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};return await S_.sendTelemetry(qVt,t),{tools:P4t}}),this.server.setRequestHandler(aM,async t=>{let{name:r,arguments:n}=t.params;try{let i;S_.markToolStartTime();let a={tool:r,mcpClientName:this.mcpClientName,mcpClientVersion:this.mcpClientVersion};if("functionalityId"in n){let{functionalityId:s}=n;Array.isArray(s)&&s.length>=1?a.functionalityId=`property-change:${s.at(-1)}`:a.functionalityId=s}switch(ft.debug(`Executing tool: ${r} with arguments: ${JSON.stringify(n)}`),r){case"search_docs":i=await mxe(n,!0);break;case"list_fiori_apps":i=await gxe(n);break;case"list_functionality":i=await _Le(n);break;case"get_functionality_details":i=await hj(n);break;case"execute_functionality":i=await bLe(n);break;default:throw await S_.sendTelemetry(Tlr,{},n?.appPath),new Error(`Unknown tool: ${r}. Try one of: list_fiori_apps, list_functionality, get_functionality_details, execute_functionality.`)}await S_.sendTelemetry(r,a,n?.appPath);let o=this.convertResultToCallToolResult(i);return ft.debug(`Tool ${r} executed successfully with result:`),ft.debug(o),o}catch(i){return ft.error(`Error executing tool ${r}: ${i}`),ft.debug(i),{content:[{type:"text",text:`Error: ${i instanceof Error?i.message:"Unknown error occurred"}`}]}}})}convertResultToCallToolResult(t){if(typeof t=="string"||t instanceof String)return{content:[{type:"text",text:t.toString()}]};let r={content:[{type:"text",text:JSON.stringify(t)}]};return Array.isArray(t)||(r.structuredContent=t),r}async run(){await this.setupTelemetry();let t=new gz;await this.server.connect(t),ft.info(`SAP Fiori - Model Context Protocol (MCP) server (@sap-ux/fiori-mcp-server@${PS.version}) running on stdio`)}};var xSi=new wae;xSi.run().catch(e=>ft.error(`Server error: ${e}`));
1663
1663
  /*! Bundled license information:
1664
1664
 
1665
1665
  safe-buffer/index.js:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-mcp-server",
3
3
  "description": "SAP Fiori - Model Context Protocol (MCP) server",
4
- "version": "0.6.38",
4
+ "version": "0.6.39",
5
5
  "keywords": [
6
6
  "SAP Fiori tools",
7
7
  "SAP Fiori elements",
@@ -22,7 +22,9 @@
22
22
  "files": [
23
23
  "LICENSE",
24
24
  "dist",
25
- "!dist/**/*.map"
25
+ "!dist/**/*.map",
26
+ "assets/icon.svg",
27
+ "assets/icon.png"
26
28
  ],
27
29
  "bin": {
28
30
  "fiori-mcp": "./dist/index.js"
@@ -49,18 +51,18 @@
49
51
  "@langchain/mcp-adapters": "1.1.3",
50
52
  "@langchain/core": "1.1.26",
51
53
  "@sap-ux/axios-extension": "1.25.19",
52
- "@sap-ux/project-access": "1.35.11",
53
54
  "@sap-ux/fiori-annotation-api": "0.9.26",
55
+ "@sap-ux/project-access": "1.35.11",
54
56
  "@sap-ux/fiori-docs-embeddings": "0.4.16",
55
57
  "@sap-ux/i18n": "0.3.9",
56
58
  "@sap-ux/logger": "0.8.1",
57
59
  "@sap-ux/odata-annotation-core-types": "0.5.6",
58
60
  "@sap-ux/odata-entity-model": "0.3.6",
59
61
  "@sap-ux/text-document-utils": "0.3.3",
60
- "@sap-ux/btp-utils": "1.1.9",
61
62
  "@sap-ux/feature-toggle": "0.3.7",
62
63
  "@sap-ux/nodejs-utils": "0.2.16",
63
- "@sap-ux/telemetry": "0.6.83"
64
+ "@sap-ux/telemetry": "0.6.83",
65
+ "@sap-ux/btp-utils": "1.1.9"
64
66
  },
65
67
  "dependencies": {
66
68
  "@xenova/transformers": "2.17.2",
@@ -77,7 +79,8 @@
77
79
  "build-esbuild-base": "esbuild --bundle --platform=node --target=node20 --outdir=dist --external:vscode --external:@lancedb/lancedb --external:@xenova/transformers --external:@sap-ux/fiori-docs-embeddings --external:@sap-ux/store --main-fields=module,main src/index.ts",
78
80
  "build-dev": "pnpm run build-esbuild-base --sourcemap=inline",
79
81
  "build-compile": "tsc --noEmit",
80
- "build-bundle": "pnpm run build-esbuild-base --minify",
82
+ "build-bundle": "pnpm run build-esbuild-base --minify && pnpm run copy-icons",
83
+ "copy-icons": "node -e \"const fs=require('node:fs');const path=require('node:path');['icon.png','icon.svg'].forEach(f=>fs.copyFileSync(path.join('assets',f),path.join('dist',f)))\"",
81
84
  "build": "npm-run-all build-compile build-bundle",
82
85
  "watch": "tsc --watch",
83
86
  "bundle": "npm-run-all build tgz:package tgz:rename",