@mwillbanks/ast-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CONTRIBUTING.md +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +109 -0
  4. package/dist/ast-mcp-hook.js +7 -0
  5. package/dist/ast-mcp-hook.js.map +11 -0
  6. package/dist/ast-mcp-install.js +22 -0
  7. package/dist/ast-mcp-install.js.map +12 -0
  8. package/dist/ast-mcp.js +115 -0
  9. package/dist/ast-mcp.js.map +89 -0
  10. package/dprint.json +37 -0
  11. package/logo.svg +1 -0
  12. package/package.json +89 -0
  13. package/src/ast-bro/capability.ts +21 -0
  14. package/src/ast-bro/client.ts +47 -0
  15. package/src/ast-bro/result.ts +42 -0
  16. package/src/ast-bro/rewrite-capability.ts +9 -0
  17. package/src/ast-bro/tools.json +603 -0
  18. package/src/hook.ts +79 -0
  19. package/src/http-entry.ts +3 -0
  20. package/src/http.ts +138 -0
  21. package/src/index.ts +8 -0
  22. package/src/installer.ts +501 -0
  23. package/src/lifecycle.ts +10 -0
  24. package/src/managed-hook.ts +4 -0
  25. package/src/patch/aider.ts +224 -0
  26. package/src/patch/engine.ts +446 -0
  27. package/src/patch/languages.ts +36 -0
  28. package/src/runtime/atomic.ts +26 -0
  29. package/src/runtime/attributes.ts +70 -0
  30. package/src/runtime/file-delete.ts +96 -0
  31. package/src/runtime/file-read.ts +178 -0
  32. package/src/runtime/format.ts +56 -0
  33. package/src/runtime/hash.ts +11 -0
  34. package/src/runtime/locks.ts +87 -0
  35. package/src/runtime/paths.ts +73 -0
  36. package/src/runtime/process-input.ts +25 -0
  37. package/src/runtime/signals.ts +47 -0
  38. package/src/server.ts +13 -0
  39. package/src/stdio.ts +154 -0
  40. package/src/tools/ast-bro.ts +172 -0
  41. package/src/tools/files.ts +173 -0
  42. package/src/tools/index.ts +11 -0
  43. package/src/tools/lifecycle.ts +124 -0
  44. package/templates/AGENTS.md +56 -0
  45. package/templates/skills/ast-mcp/SKILL.md +96 -0
  46. package/templates/skills/ast-mcp/agents/openai.yaml +4 -0
  47. package/templates/skills/ast-mcp/evals/batch.evals.json +274 -0
  48. package/templates/skills/ast-mcp/evals/evals.json +1209 -0
  49. package/templates/skills/ast-mcp/evals/file-hash.evals.json +50 -0
  50. package/templates/skills/ast-mcp/evals/measure.ts +18 -0
  51. package/templates/skills/ast-mcp/evals/results.md +17 -0
  52. package/templates/skills/ast-mcp/evals/score.ts +417 -0
  53. package/templates/skills/ast-mcp/evals/semantic.ts +332 -0
  54. package/templates/skills/ast-mcp/evals/trigger-queries.json +22 -0
  55. package/templates/skills/ast-mcp/evals/validate.ts +99 -0
  56. package/templates/skills/ast-mcp/references/installation.md +40 -0
  57. package/templates/skills/ast-mcp/references/managed-hook.ts +3 -0
  58. package/templates/skills/ast-mcp/references/patch-state-machine.md +39 -0
  59. package/templates/skills/ast-mcp/references/tool-catalog.md +46 -0
  60. package/templates/skills/ast-mcp/scripts/check-install.ts +269 -0
  61. package/templates/skills/ast-mcp/scripts/managed-hook.ts +22 -0
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var a$=Object.create;var{getPrototypeOf:s$,defineProperty:fX,getOwnPropertyNames:t$}=Object;var e$=Object.prototype.hasOwnProperty;function WU(W){return this[W]}var QU,XU,YU=(W,Q,X)=>{var Y=W!=null&&typeof W==="object";if(Y){var G=Q?QU??=new WeakMap:XU??=new WeakMap,B=G.get(W);if(B)return B}X=W!=null?a$(s$(W)):{};let F=Q||!W||!W.__esModule?fX(X,"default",{value:W,enumerable:!0}):X;for(let L of t$(W))if(!e$.call(F,L))fX(F,L,{get:WU.bind(W,L),enumerable:!0});if(Y)G.set(W,F);return F};var p1=(W,Q)=>()=>(Q||W((Q={exports:{}}).exports,Q),Q.exports);var GU=(W)=>W;function BU(W,Q){this[W]=GU.bind(null,Q)}var xX=(W,Q)=>{for(var X in Q)fX(W,X,{get:Q[X],enumerable:!0,configurable:!0,set:BU.bind(Q,X)})};var H0=(W,Q)=>()=>(W&&(Q=W(W=0)),Q);var N5=import.meta.require;function BB(W,Q=process){let X=!1,Y=new Map;for(let G of FU){let B=()=>{if(X){Q.exit(1);return}X=!0,Promise.resolve().then(()=>W(G)).then(()=>Q.exit(0),(F)=>{let L=F instanceof Error?F.message:String(F);Q.stderr.write(`ast-mcp shutdown failed after ${G}: ${L}
4
+ `),Q.exit(1)})};Y.set(G,B),Q.on(G,B)}return()=>{for(let[G,B]of Y)Q.off(G,B)}}var FU;var FB=H0(()=>{FU=["SIGTERM","SIGINT","SIGHUP"]});var LU,GQ,JU,zU,KU,ZU,Q0=(W,Q)=>()=>(Q||W((Q={exports:{}}).exports,Q),Q.exports),LB=(W,Q)=>{let X={};for(var Y in W)GQ(X,Y,{get:W[Y],enumerable:!0});if(Q)GQ(X,Symbol.toStringTag,{value:"Module"});return X},HU=(W,Q,X,Y)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(var G=zU(Q),B=0,F=G.length,L;B<F;B++)if(L=G[B],!ZU.call(W,L)&&L!==X)GQ(W,L,{get:((J)=>Q[J]).bind(null,L),enumerable:!(Y=JU(Q,L))||Y.enumerable})}return W},BQ=(W,Q,X)=>(X=W!=null?LU(KU(W)):{},HU(Q||!W||!W.__esModule?GQ(X,"default",{value:W,enumerable:!0}):X,W));var hX=H0(()=>{LU=Object.create,GQ=Object.defineProperty,JU=Object.getOwnPropertyDescriptor,zU=Object.getOwnPropertyNames,KU=Object.getPrototypeOf,ZU=Object.prototype.hasOwnProperty});function i(W,Q,X){function Y(L,J){if(!L._zod)Object.defineProperty(L,"_zod",{value:{def:J,constr:F,traits:new Set},enumerable:!1});if(L._zod.traits.has(W))return;L._zod.traits.add(W),Q(L,J);let z=F.prototype,K=Object.keys(z);for(let H=0;H<K.length;H++){let D=K[H];if(!(D in L))L[D]=z[D].bind(L)}}let G=X?.Parent??Object;class B extends G{}Object.defineProperty(B,"name",{value:W});function F(L){var J;let z=X?.Parent?new B:this;Y(z,L),(J=z._zod).deferred??(J.deferred=[]);for(let K of z._zod.deferred)K();return z}return Object.defineProperty(F,"init",{value:Y}),Object.defineProperty(F,Symbol.hasInstance,{value:(L)=>{if(X?.Parent&&L instanceof X.Parent)return!0;return L?._zod?.traits?.has(W)}}),Object.defineProperty(F,"name",{value:W}),F}function q1(W){if(W)Object.assign(k4,W);return k4}var JB,uX,$U,V5,o9,k4;var G4=H0(()=>{uX=Object.freeze({status:"aborted"});$U=Symbol("zod_brand");V5=class V5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};o9=class o9 extends Error{constructor(W){super(`Encountered unidirectional transform during encode: ${W}`);this.name="ZodEncodeError"}};(JB=globalThis).__zod_globalConfig??(JB.__zod_globalConfig={});k4=globalThis.__zod_globalConfig});var y0={};xX(y0,{unwrapMessage:()=>a9,uint8ArrayToHex:()=>xU,uint8ArrayToBase64url:()=>gU,uint8ArrayToBase64:()=>AB,stringifyPrimitive:()=>zQ,slugify:()=>cX,shallowClone:()=>KB,safeExtend:()=>qU,required:()=>vU,randomString:()=>EU,propertyKeyTypes:()=>dX,promiseAllObject:()=>OU,primitiveTypes:()=>ZB,prefixIssues:()=>b6,pick:()=>PU,partial:()=>kU,parsedType:()=>oX,optionalKeys:()=>iX,omit:()=>bU,objectClone:()=>DU,numKeys:()=>IU,nullish:()=>t9,normalizeParams:()=>A0,mergeDefs:()=>w5,merge:()=>CU,jsonStringifyReplacer:()=>v4,joinValues:()=>FQ,issue:()=>_4,isPlainObject:()=>v5,isObject:()=>B4,hexToUint8Array:()=>fU,getSizableOrigin:()=>$B,getParsedType:()=>TU,getLengthableOrigin:()=>WW,getEnumValues:()=>s9,getElementAtPath:()=>jU,floatSafeRemainder:()=>mX,finalizeIssue:()=>t1,extend:()=>SU,explicitlyAborted:()=>rX,escapeRegex:()=>D5,esc:()=>LQ,defineLazy:()=>_0,createTransparentProxy:()=>RU,cloneDef:()=>MU,clone:()=>s1,cleanRegex:()=>e9,cleanEnum:()=>yU,captureStackTrace:()=>JQ,cached:()=>y4,base64urlToUint8Array:()=>_U,base64ToUint8Array:()=>UB,assignProp:()=>k5,assertNotEqual:()=>AU,assertNever:()=>VU,assertIs:()=>NU,assertEqual:()=>UU,assert:()=>wU,allowsEval:()=>pX,aborted:()=>y5,NUMBER_FORMAT_RANGES:()=>nX,Class:()=>NB,BIGINT_FORMAT_RANGES:()=>HB});function UU(W){return W}function AU(W){return W}function NU(W){}function VU(W){throw Error("Unexpected value in exhaustive check")}function wU(W){}function s9(W){let Q=Object.values(W).filter((Y)=>typeof Y==="number");return Object.entries(W).filter(([Y,G])=>Q.indexOf(+Y)===-1).map(([Y,G])=>G)}function FQ(W,Q="|"){return W.map((X)=>zQ(X)).join(Q)}function v4(W,Q){if(typeof Q==="bigint")return Q.toString();return Q}function y4(W){return{get value(){{let X=W();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function t9(W){return W===null||W===void 0}function e9(W){let Q=W.startsWith("^")?1:0,X=W.endsWith("$")?W.length-1:W.length;return W.slice(Q,X)}function mX(W,Q){let X=W/Q,Y=Math.round(X),G=Number.EPSILON*Math.max(Math.abs(X),1);if(Math.abs(X-Y)<G)return 0;return X-Y}function _0(W,Q,X){let Y=void 0;Object.defineProperty(W,Q,{get(){if(Y===zB)return;if(Y===void 0)Y=zB,Y=X();return Y},set(G){Object.defineProperty(W,Q,{value:G})},configurable:!0})}function DU(W){return Object.create(Object.getPrototypeOf(W),Object.getOwnPropertyDescriptors(W))}function k5(W,Q,X){Object.defineProperty(W,Q,{value:X,writable:!0,enumerable:!0,configurable:!0})}function w5(...W){let Q={};for(let X of W){let Y=Object.getOwnPropertyDescriptors(X);Object.assign(Q,Y)}return Object.defineProperties({},Q)}function MU(W){return w5(W._zod.def)}function jU(W,Q){if(!Q)return W;return Q.reduce((X,Y)=>X?.[Y],W)}function OU(W){let Q=Object.keys(W),X=Q.map((Y)=>W[Y]);return Promise.all(X).then((Y)=>{let G={};for(let B=0;B<Q.length;B++)G[Q[B]]=Y[B];return G})}function EU(W=10){let X="";for(let Y=0;Y<W;Y++)X+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return X}function LQ(W){return JSON.stringify(W)}function cX(W){return W.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function B4(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function v5(W){if(B4(W)===!1)return!1;let Q=W.constructor;if(Q===void 0)return!0;if(typeof Q!=="function")return!0;let X=Q.prototype;if(B4(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}function KB(W){if(v5(W))return{...W};if(Array.isArray(W))return[...W];if(W instanceof Map)return new Map(W);if(W instanceof Set)return new Set(W);return W}function IU(W){let Q=0;for(let X in W)if(Object.prototype.hasOwnProperty.call(W,X))Q++;return Q}function D5(W){return W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function s1(W,Q,X){let Y=new W._zod.constr(Q??W._zod.def);if(!Q||X?.parent)Y._zod.parent=W;return Y}function A0(W){let Q=W;if(!Q)return{};if(typeof Q==="string")return{error:()=>Q};if(Q?.message!==void 0){if(Q?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Q.error=Q.message}if(delete Q.message,typeof Q.error==="string")return{...Q,error:()=>Q.error};return Q}function RU(W){let Q;return new Proxy({},{get(X,Y,G){return Q??(Q=W()),Reflect.get(Q,Y,G)},set(X,Y,G,B){return Q??(Q=W()),Reflect.set(Q,Y,G,B)},has(X,Y){return Q??(Q=W()),Reflect.has(Q,Y)},deleteProperty(X,Y){return Q??(Q=W()),Reflect.deleteProperty(Q,Y)},ownKeys(X){return Q??(Q=W()),Reflect.ownKeys(Q)},getOwnPropertyDescriptor(X,Y){return Q??(Q=W()),Reflect.getOwnPropertyDescriptor(Q,Y)},defineProperty(X,Y,G){return Q??(Q=W()),Reflect.defineProperty(Q,Y,G)}})}function zQ(W){if(typeof W==="bigint")return W.toString()+"n";if(typeof W==="string")return`"${W}"`;return`${W}`}function iX(W){return Object.keys(W).filter((Q)=>{return W[Q]._zod.optin==="optional"&&W[Q]._zod.optout==="optional"})}function PU(W,Q){let X=W._zod.def,Y=X.checks;if(Y&&Y.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let B=w5(W._zod.def,{get shape(){let F={};for(let L in Q){if(!(L in X.shape))throw Error(`Unrecognized key: "${L}"`);if(!Q[L])continue;F[L]=X.shape[L]}return k5(this,"shape",F),F},checks:[]});return s1(W,B)}function bU(W,Q){let X=W._zod.def,Y=X.checks;if(Y&&Y.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let B=w5(W._zod.def,{get shape(){let F={...W._zod.def.shape};for(let L in Q){if(!(L in X.shape))throw Error(`Unrecognized key: "${L}"`);if(!Q[L])continue;delete F[L]}return k5(this,"shape",F),F},checks:[]});return s1(W,B)}function SU(W,Q){if(!v5(Q))throw Error("Invalid input to extend: expected a plain object");let X=W._zod.def.checks;if(X&&X.length>0){let B=W._zod.def.shape;for(let F in Q)if(Object.getOwnPropertyDescriptor(B,F)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=w5(W._zod.def,{get shape(){let B={...W._zod.def.shape,...Q};return k5(this,"shape",B),B}});return s1(W,G)}function qU(W,Q){if(!v5(Q))throw Error("Invalid input to safeExtend: expected a plain object");let X=w5(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...Q};return k5(this,"shape",Y),Y}});return s1(W,X)}function CU(W,Q){if(W._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let X=w5(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...Q._zod.def.shape};return k5(this,"shape",Y),Y},get catchall(){return Q._zod.def.catchall},checks:Q._zod.def.checks??[]});return s1(W,X)}function kU(W,Q,X){let G=Q._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let F=w5(Q._zod.def,{get shape(){let L=Q._zod.def.shape,J={...L};if(X)for(let z in X){if(!(z in L))throw Error(`Unrecognized key: "${z}"`);if(!X[z])continue;J[z]=W?new W({type:"optional",innerType:L[z]}):L[z]}else for(let z in L)J[z]=W?new W({type:"optional",innerType:L[z]}):L[z];return k5(this,"shape",J),J},checks:[]});return s1(Q,F)}function vU(W,Q,X){let Y=w5(Q._zod.def,{get shape(){let G=Q._zod.def.shape,B={...G};if(X)for(let F in X){if(!(F in B))throw Error(`Unrecognized key: "${F}"`);if(!X[F])continue;B[F]=new W({type:"nonoptional",innerType:G[F]})}else for(let F in G)B[F]=new W({type:"nonoptional",innerType:G[F]});return k5(this,"shape",B),B}});return s1(Q,Y)}function y5(W,Q=0){if(W.aborted===!0)return!0;for(let X=Q;X<W.issues.length;X++)if(W.issues[X]?.continue!==!0)return!0;return!1}function rX(W,Q=0){if(W.aborted===!0)return!0;for(let X=Q;X<W.issues.length;X++)if(W.issues[X]?.continue===!1)return!0;return!1}function b6(W,Q){return Q.map((X)=>{var Y;return(Y=X).path??(Y.path=[]),X.path.unshift(W),X})}function a9(W){return typeof W==="string"?W:W?.message}function t1(W,Q,X){let Y=W.message?W.message:a9(W.inst?._zod.def?.error?.(W))??a9(Q?.error?.(W))??a9(X.customError?.(W))??a9(X.localeError?.(W))??"Invalid input",{inst:G,continue:B,input:F,...L}=W;if(L.path??(L.path=[]),L.message=Y,Q?.reportInput)L.input=F;return L}function $B(W){if(W instanceof Set)return"set";if(W instanceof Map)return"map";if(W instanceof File)return"file";return"unknown"}function WW(W){if(Array.isArray(W))return"array";if(typeof W==="string")return"string";return"unknown"}function oX(W){let Q=typeof W;switch(Q){case"number":return Number.isNaN(W)?"nan":"number";case"object":{if(W===null)return"null";if(Array.isArray(W))return"array";let X=W;if(X&&Object.getPrototypeOf(X)!==Object.prototype&&"constructor"in X&&X.constructor)return X.constructor.name}}return Q}function _4(...W){let[Q,X,Y]=W;if(typeof Q==="string")return{message:Q,code:"custom",input:X,inst:Y};return{...Q}}function yU(W){return Object.entries(W).filter(([Q,X])=>{return Number.isNaN(Number.parseInt(Q,10))}).map((Q)=>Q[1])}function UB(W){let Q=atob(W),X=new Uint8Array(Q.length);for(let Y=0;Y<Q.length;Y++)X[Y]=Q.charCodeAt(Y);return X}function AB(W){let Q="";for(let X=0;X<W.length;X++)Q+=String.fromCharCode(W[X]);return btoa(Q)}function _U(W){let Q=W.replace(/-/g,"+").replace(/_/g,"/"),X="=".repeat((4-Q.length%4)%4);return UB(Q+X)}function gU(W){return AB(W).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function fU(W){let Q=W.replace(/^0x/,"");if(Q.length%2!==0)throw Error("Invalid hex string length");let X=new Uint8Array(Q.length/2);for(let Y=0;Y<Q.length;Y+=2)X[Y/2]=Number.parseInt(Q.slice(Y,Y+2),16);return X}function xU(W){return Array.from(W).map((Q)=>Q.toString(16).padStart(2,"0")).join("")}class NB{constructor(...W){}}var zB,JQ,pX,TU=(W)=>{let Q=typeof W;switch(Q){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(W)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(W))return"array";if(W===null)return"null";if(W.then&&typeof W.then==="function"&&W.catch&&typeof W.catch==="function")return"promise";if(typeof Map<"u"&&W instanceof Map)return"map";if(typeof Set<"u"&&W instanceof Set)return"set";if(typeof Date<"u"&&W instanceof Date)return"date";if(typeof File<"u"&&W instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${Q}`)}},dX,ZB,nX,HB;var S6=H0(()=>{G4();zB=Symbol("evaluating");JQ="captureStackTrace"in Error?Error.captureStackTrace:(...W)=>{};pX=y4(()=>{if(k4.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(W){return!1}});dX=new Set(["string","number","symbol"]),ZB=new Set(["string","number","bigint","boolean","symbol","undefined"]);nX={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},HB={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function sX(W,Q=(X)=>X.message){let X={},Y=[];for(let G of W.issues)if(G.path.length>0)X[G.path[0]]=X[G.path[0]]||[],X[G.path[0]].push(Q(G));else Y.push(Q(G));return{formErrors:Y,fieldErrors:X}}function tX(W,Q=(X)=>X.message){let X={_errors:[]},Y=(G,B=[])=>{for(let F of G.issues)if(F.code==="invalid_union"&&F.errors.length)F.errors.map((L)=>Y({issues:L},[...B,...F.path]));else if(F.code==="invalid_key")Y({issues:F.issues},[...B,...F.path]);else if(F.code==="invalid_element")Y({issues:F.issues},[...B,...F.path]);else{let L=[...B,...F.path];if(L.length===0)X._errors.push(Q(F));else{let J=X,z=0;while(z<L.length){let K=L[z];if(z!==L.length-1)J[K]=J[K]||{_errors:[]};else J[K]=J[K]||{_errors:[]},J[K]._errors.push(Q(F));J=J[K],z++}}}};return Y(W),X}var VB=(W,Q)=>{W.name="$ZodError",Object.defineProperty(W,"_zod",{value:W._zod,enumerable:!1}),Object.defineProperty(W,"issues",{value:Q,enumerable:!1}),W.message=JSON.stringify(Q,v4,2),Object.defineProperty(W,"toString",{value:()=>W.message,enumerable:!1})},KQ,aX;var eX=H0(()=>{G4();S6();KQ=i("$ZodError",VB),aX=i("$ZodError",VB,{Parent:Error})});var ZQ=(W)=>(Q,X,Y,G)=>{let B=Y?{...Y,async:!1}:{async:!1},F=Q._zod.run({value:X,issues:[]},B);if(F instanceof Promise)throw new V5;if(F.issues.length){let L=new(G?.Err??W)(F.issues.map((J)=>t1(J,B,q1())));throw JQ(L,G?.callee),L}return F.value},HQ=(W)=>async(Q,X,Y,G)=>{let B=Y?{...Y,async:!0}:{async:!0},F=Q._zod.run({value:X,issues:[]},B);if(F instanceof Promise)F=await F;if(F.issues.length){let L=new(G?.Err??W)(F.issues.map((J)=>t1(J,B,q1())));throw JQ(L,G?.callee),L}return F.value},QW=(W)=>(Q,X,Y)=>{let G=Y?{...Y,async:!1}:{async:!1},B=Q._zod.run({value:X,issues:[]},G);if(B instanceof Promise)throw new V5;return B.issues.length?{success:!1,error:new(W??KQ)(B.issues.map((F)=>t1(F,G,q1())))}:{success:!0,data:B.value}},wB,XW=(W)=>async(Q,X,Y)=>{let G=Y?{...Y,async:!0}:{async:!0},B=Q._zod.run({value:X,issues:[]},G);if(B instanceof Promise)B=await B;return B.issues.length?{success:!1,error:new W(B.issues.map((F)=>t1(F,G,q1())))}:{success:!0,data:B.value}},DB,MB=(W)=>(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return ZQ(W)(Q,X,G)},jB=(W)=>(Q,X,Y)=>{return ZQ(W)(Q,X,Y)},OB=(W)=>async(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return HQ(W)(Q,X,G)},EB=(W)=>async(Q,X,Y)=>{return HQ(W)(Q,X,Y)},IB=(W)=>(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return QW(W)(Q,X,G)},TB=(W)=>(Q,X,Y)=>{return QW(W)(Q,X,Y)},RB=(W)=>async(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return XW(W)(Q,X,G)},PB=(W)=>async(Q,X,Y)=>{return XW(W)(Q,X,Y)};var WY=H0(()=>{G4();eX();S6();wB=QW(aX),DB=XW(aX)});function fB(){return new RegExp(uU,"u")}function nB(W){return typeof W.precision==="number"?W.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":W.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${W.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function rB(W){return new RegExp(`^${nB(W)}$`)}function oB(W){let Q=nB({precision:W.precision}),X=["Z"];if(W.local)X.push("");if(W.offset)X.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Y=`${Q}(?:${X.join("|")})`;return new RegExp(`^${dB}T(?:${Y})$`)}var bB,SB,qB,CB,kB,vB,yB,_B,QY=(W)=>{if(!W)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${W}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},gB,uU="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xB,hB,uB,lB,mB,XY,cB,pB,dB="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",iB,aB=(W)=>{let Q=W?`[\\s\\S]{${W?.minimum??0},${W?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Q}$`)},sB,tB,$Q,eB,WF,QF,XF;var UQ=H0(()=>{bB=/^[cC][0-9a-z]{6,}$/,SB=/^[0-9a-z]+$/,qB=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,CB=/^[0-9a-vA-V]{20}$/,kB=/^[A-Za-z0-9]{27}$/,vB=/^[a-zA-Z0-9_-]{21}$/,yB=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_B=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gB=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;xB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hB=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,uB=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,lB=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mB=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,XY=/^[A-Za-z0-9_-]*$/,cB=/^https?$/,pB=/^\+[1-9]\d{6,14}$/,iB=new RegExp(`^${dB}$`);sB=/^-?\d+n?$/,tB=/^-?\d+$/,$Q=/^-?\d+(?:\.\d+)?$/,eB=/^(?:true|false)$/i,WF=/^null$/i,QF=/^[^A-Z]*$/,XF=/^[^a-z]*$/});var A1,YF,YY,GY,GF,BF,FF,LF,JF,GW,zF,KF,ZF,HF,$F,UF,AF;var AQ=H0(()=>{G4();UQ();S6();A1=i("$ZodCheck",(W,Q)=>{var X;W._zod??(W._zod={}),W._zod.def=Q,(X=W._zod).onattach??(X.onattach=[])}),YF={number:"number",bigint:"bigint",object:"date"},YY=i("$ZodCheckLessThan",(W,Q)=>{A1.init(W,Q);let X=YF[typeof Q.value];W._zod.onattach.push((Y)=>{let G=Y._zod.bag,B=(Q.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Q.value<B)if(Q.inclusive)G.maximum=Q.value;else G.exclusiveMaximum=Q.value}),W._zod.check=(Y)=>{if(Q.inclusive?Y.value<=Q.value:Y.value<Q.value)return;Y.issues.push({origin:X,code:"too_big",maximum:typeof Q.value==="object"?Q.value.getTime():Q.value,input:Y.value,inclusive:Q.inclusive,inst:W,continue:!Q.abort})}}),GY=i("$ZodCheckGreaterThan",(W,Q)=>{A1.init(W,Q);let X=YF[typeof Q.value];W._zod.onattach.push((Y)=>{let G=Y._zod.bag,B=(Q.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Q.value>B)if(Q.inclusive)G.minimum=Q.value;else G.exclusiveMinimum=Q.value}),W._zod.check=(Y)=>{if(Q.inclusive?Y.value>=Q.value:Y.value>Q.value)return;Y.issues.push({origin:X,code:"too_small",minimum:typeof Q.value==="object"?Q.value.getTime():Q.value,input:Y.value,inclusive:Q.inclusive,inst:W,continue:!Q.abort})}}),GF=i("$ZodCheckMultipleOf",(W,Q)=>{A1.init(W,Q),W._zod.onattach.push((X)=>{var Y;(Y=X._zod.bag).multipleOf??(Y.multipleOf=Q.value)}),W._zod.check=(X)=>{if(typeof X.value!==typeof Q.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof X.value==="bigint"?X.value%Q.value===BigInt(0):mX(X.value,Q.value)===0)return;X.issues.push({origin:typeof X.value,code:"not_multiple_of",divisor:Q.value,input:X.value,inst:W,continue:!Q.abort})}}),BF=i("$ZodCheckNumberFormat",(W,Q)=>{A1.init(W,Q),Q.format=Q.format||"float64";let X=Q.format?.includes("int"),Y=X?"int":"number",[G,B]=nX[Q.format];W._zod.onattach.push((F)=>{let L=F._zod.bag;if(L.format=Q.format,L.minimum=G,L.maximum=B,X)L.pattern=tB}),W._zod.check=(F)=>{let L=F.value;if(X){if(!Number.isInteger(L)){F.issues.push({expected:Y,format:Q.format,code:"invalid_type",continue:!1,input:L,inst:W});return}if(!Number.isSafeInteger(L)){if(L>0)F.issues.push({input:L,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!Q.abort});else F.issues.push({input:L,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!Q.abort});return}}if(L<G)F.issues.push({origin:"number",input:L,code:"too_small",minimum:G,inclusive:!0,inst:W,continue:!Q.abort});if(L>B)F.issues.push({origin:"number",input:L,code:"too_big",maximum:B,inclusive:!0,inst:W,continue:!Q.abort})}}),FF=i("$ZodCheckMaxLength",(W,Q)=>{var X;A1.init(W,Q),(X=W._zod.def).when??(X.when=(Y)=>{let G=Y.value;return!t9(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Q.maximum<G)Y._zod.bag.maximum=Q.maximum}),W._zod.check=(Y)=>{let G=Y.value;if(G.length<=Q.maximum)return;let F=WW(G);Y.issues.push({origin:F,code:"too_big",maximum:Q.maximum,inclusive:!0,input:G,inst:W,continue:!Q.abort})}}),LF=i("$ZodCheckMinLength",(W,Q)=>{var X;A1.init(W,Q),(X=W._zod.def).when??(X.when=(Y)=>{let G=Y.value;return!t9(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Q.minimum>G)Y._zod.bag.minimum=Q.minimum}),W._zod.check=(Y)=>{let G=Y.value;if(G.length>=Q.minimum)return;let F=WW(G);Y.issues.push({origin:F,code:"too_small",minimum:Q.minimum,inclusive:!0,input:G,inst:W,continue:!Q.abort})}}),JF=i("$ZodCheckLengthEquals",(W,Q)=>{var X;A1.init(W,Q),(X=W._zod.def).when??(X.when=(Y)=>{let G=Y.value;return!t9(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.minimum=Q.length,G.maximum=Q.length,G.length=Q.length}),W._zod.check=(Y)=>{let G=Y.value,B=G.length;if(B===Q.length)return;let F=WW(G),L=B>Q.length;Y.issues.push({origin:F,...L?{code:"too_big",maximum:Q.length}:{code:"too_small",minimum:Q.length},inclusive:!0,exact:!0,input:Y.value,inst:W,continue:!Q.abort})}}),GW=i("$ZodCheckStringFormat",(W,Q)=>{var X,Y;if(A1.init(W,Q),W._zod.onattach.push((G)=>{let B=G._zod.bag;if(B.format=Q.format,Q.pattern)B.patterns??(B.patterns=new Set),B.patterns.add(Q.pattern)}),Q.pattern)(X=W._zod).check??(X.check=(G)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:Q.format,input:G.value,...Q.pattern?{pattern:Q.pattern.toString()}:{},inst:W,continue:!Q.abort})});else(Y=W._zod).check??(Y.check=()=>{})}),zF=i("$ZodCheckRegex",(W,Q)=>{GW.init(W,Q),W._zod.check=(X)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:"regex",input:X.value,pattern:Q.pattern.toString(),inst:W,continue:!Q.abort})}}),KF=i("$ZodCheckLowerCase",(W,Q)=>{Q.pattern??(Q.pattern=QF),GW.init(W,Q)}),ZF=i("$ZodCheckUpperCase",(W,Q)=>{Q.pattern??(Q.pattern=XF),GW.init(W,Q)}),HF=i("$ZodCheckIncludes",(W,Q)=>{A1.init(W,Q);let X=D5(Q.includes),Y=new RegExp(typeof Q.position==="number"?`^.{${Q.position}}${X}`:X);Q.pattern=Y,W._zod.onattach.push((G)=>{let B=G._zod.bag;B.patterns??(B.patterns=new Set),B.patterns.add(Y)}),W._zod.check=(G)=>{if(G.value.includes(Q.includes,Q.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Q.includes,input:G.value,inst:W,continue:!Q.abort})}}),$F=i("$ZodCheckStartsWith",(W,Q)=>{A1.init(W,Q);let X=new RegExp(`^${D5(Q.prefix)}.*`);Q.pattern??(Q.pattern=X),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),W._zod.check=(Y)=>{if(Y.value.startsWith(Q.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Q.prefix,input:Y.value,inst:W,continue:!Q.abort})}}),UF=i("$ZodCheckEndsWith",(W,Q)=>{A1.init(W,Q);let X=new RegExp(`.*${D5(Q.suffix)}$`);Q.pattern??(Q.pattern=X),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),W._zod.check=(Y)=>{if(Y.value.endsWith(Q.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Q.suffix,input:Y.value,inst:W,continue:!Q.abort})}}),AF=i("$ZodCheckOverwrite",(W,Q)=>{A1.init(W,Q),W._zod.check=(X)=>{X.value=Q.tx(X.value)}})});class FY{constructor(W=[]){if(this.content=[],this.indent=0,this)this.args=W}indented(W){this.indent+=1,W(this),this.indent-=1}write(W){if(typeof W==="function"){W(this,{execution:"sync"}),W(this,{execution:"async"});return}let X=W.split(`
5
+ `).filter((B)=>B),Y=Math.min(...X.map((B)=>B.length-B.trimStart().length)),G=X.map((B)=>B.slice(Y)).map((B)=>" ".repeat(this.indent*2)+B);for(let B of G)this.content.push(B)}compile(){let W=Function,Q=this?.args,Y=[...(this?.content??[""]).map((G)=>` ${G}`)];return new W(...Q,Y.join(`
6
+ `))}}var VF;var LY=H0(()=>{VF={major:4,minor:4,patch:3}});function rF(W){if(W==="")return!0;if(/\s/.test(W))return!1;if(W.length%4!==0)return!1;try{return atob(W),!0}catch{return!1}}function lU(W){if(!XY.test(W))return!1;let Q=W.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),X=Q.padEnd(Math.ceil(Q.length/4)*4,"=");return rF(X)}function mU(W,Q=null){try{let X=W.split(".");if(X.length!==3)return!1;let[Y]=X;if(!Y)return!1;let G=JSON.parse(atob(Y));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&(!("alg"in G)||G.alg!==Q))return!1;return!0}catch{return!1}}function wF(W,Q,X){if(W.issues.length)Q.issues.push(...b6(X,W.issues));Q.value[X]=W.value}function VQ(W,Q,X,Y,G,B){let F=X in Y;if(W.issues.length){if(G&&B&&!F)return;Q.issues.push(...b6(X,W.issues))}if(!F&&!G){if(!W.issues.length)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[X]});return}if(W.value===void 0){if(F)Q.value[X]=void 0}else Q.value[X]=W.value}function JL(W){let Q=Object.keys(W.shape);for(let Y of Q)if(!W.shape?.[Y]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Y}": expected a Zod schema`);let X=iX(W.shape);return{...W,keys:Q,keySet:new Set(Q),numKeys:Q.length,optionalKeys:new Set(X)}}function zL(W,Q,X,Y,G,B){let F=[],L=G.keySet,J=G.catchall._zod,z=J.def.type,K=J.optin==="optional",H=J.optout==="optional";for(let D in Q){if(D==="__proto__")continue;if(L.has(D))continue;if(z==="never"){F.push(D);continue}let I=J.run({value:Q[D],issues:[]},Y);if(I instanceof Promise)W.push(I.then((A)=>VQ(A,X,D,Q,K,H)));else VQ(I,X,D,Q,K,H)}if(F.length)X.issues.push({code:"unrecognized_keys",keys:F,input:Q,inst:B});if(!W.length)return X;return Promise.all(W).then(()=>{return X})}function DF(W,Q,X,Y){for(let B of W)if(B.issues.length===0)return Q.value=B.value,Q;let G=W.filter((B)=>!y5(B));if(G.length===1)return Q.value=G[0].value,G[0];return Q.issues.push({code:"invalid_union",input:Q.value,inst:X,errors:W.map((B)=>B.issues.map((F)=>t1(F,Y,q1())))}),Q}function JY(W,Q){if(W===Q)return{valid:!0,data:W};if(W instanceof Date&&Q instanceof Date&&+W===+Q)return{valid:!0,data:W};if(v5(W)&&v5(Q)){let X=Object.keys(Q),Y=Object.keys(W).filter((B)=>X.indexOf(B)!==-1),G={...W,...Q};for(let B of Y){let F=JY(W[B],Q[B]);if(!F.valid)return{valid:!1,mergeErrorPath:[B,...F.mergeErrorPath]};G[B]=F.data}return{valid:!0,data:G}}if(Array.isArray(W)&&Array.isArray(Q)){if(W.length!==Q.length)return{valid:!1,mergeErrorPath:[]};let X=[];for(let Y=0;Y<W.length;Y++){let G=W[Y],B=Q[Y],F=JY(G,B);if(!F.valid)return{valid:!1,mergeErrorPath:[Y,...F.mergeErrorPath]};X.push(F.data)}return{valid:!0,data:X}}return{valid:!1,mergeErrorPath:[]}}function MF(W,Q,X){let Y=new Map,G;for(let L of Q.issues)if(L.code==="unrecognized_keys"){G??(G=L);for(let J of L.keys){if(!Y.has(J))Y.set(J,{});Y.get(J).l=!0}}else W.issues.push(L);for(let L of X.issues)if(L.code==="unrecognized_keys")for(let J of L.keys){if(!Y.has(J))Y.set(J,{});Y.get(J).r=!0}else W.issues.push(L);let B=[...Y].filter(([,L])=>L.l&&L.r).map(([L])=>L);if(B.length&&G)W.issues.push({...G,keys:B});if(y5(W))return W;let F=JY(Q.value,X.value);if(!F.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(F.mergeErrorPath)}`);return W.value=F.data,W}function jF(W,Q){for(let X=W.length-1;X>=0;X--)if(W[X]._zod[Q]!=="optional")return X+1;return 0}function OF(W,Q,X){if(W.issues.length)Q.issues.push(...b6(X,W.issues));Q.value[X]=W.value}function EF(W,Q,X,Y,G){for(let B=0;B<X.length;B++){let F=W[B],L=B<Y.length;if(F.issues.length){if(!L&&B>=G){Q.value.length=B;break}Q.issues.push(...b6(B,F.issues))}Q.value[B]=F.value}for(let B=Q.value.length-1;B>=Y.length;B--)if(X[B]._zod.optout==="optional"&&Q.value[B]===void 0)Q.value.length=B;else break;return Q}function IF(W,Q){if(Q===void 0&&(W.issues.length||W.fallback))return{issues:[],value:void 0};return W}function TF(W,Q){if(W.value===void 0)W.value=Q.defaultValue;return W}function RF(W,Q){if(!W.issues.length&&W.value===void 0)W.issues.push({code:"invalid_type",expected:"nonoptional",input:W.value,inst:Q});return W}function NQ(W,Q,X){if(W.issues.length)return W.aborted=!0,W;return Q._zod.run({value:W.value,issues:W.issues,fallback:W.fallback},X)}function PF(W){return W.value=Object.freeze(W.value),W}function bF(W,Q,X,Y){if(!W){let G={code:"custom",input:X,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)G.params=Y._zod.def.params;Q.issues.push(_4(G))}}var u0,wQ,a0,SF,qF,CF,kF,vF,yF,_F,gF,fF,xF,hF,uF,lF,mF,cF,pF,dF,iF,nF,oF,aF,sF,tF,zY,eF,WL,QL,XL,YL,GL,BL,FL,LL,cU,KL,KY,ZL,HL,$L,UL,AL,NL,VL,ZY,wL,DL,ML,jL,OL,EL,HY,IL,TL,RL,PL;var bL=H0(()=>{AQ();G4();WY();UQ();S6();LY();S6();u0=i("$ZodType",(W,Q)=>{var X;W??(W={}),W._zod.def=Q,W._zod.bag=W._zod.bag||{},W._zod.version=VF;let Y=[...W._zod.def.checks??[]];if(W._zod.traits.has("$ZodCheck"))Y.unshift(W);for(let G of Y)for(let B of G._zod.onattach)B(W);if(Y.length===0)(X=W._zod).deferred??(X.deferred=[]),W._zod.deferred?.push(()=>{W._zod.run=W._zod.parse});else{let G=(F,L,J)=>{let z=y5(F),K;for(let H of L){if(H._zod.def.when){if(rX(F))continue;if(!H._zod.def.when(F))continue}else if(z)continue;let D=F.issues.length,I=H._zod.check(F);if(I instanceof Promise&&J?.async===!1)throw new V5;if(K||I instanceof Promise)K=(K??Promise.resolve()).then(async()=>{if(await I,F.issues.length===D)return;if(!z)z=y5(F,D)});else{if(F.issues.length===D)continue;if(!z)z=y5(F,D)}}if(K)return K.then(()=>{return F});return F},B=(F,L,J)=>{if(y5(F))return F.aborted=!0,F;let z=G(L,Y,J);if(z instanceof Promise){if(J.async===!1)throw new V5;return z.then((K)=>W._zod.parse(K,J))}return W._zod.parse(z,J)};W._zod.run=(F,L)=>{if(L.skipChecks)return W._zod.parse(F,L);if(L.direction==="backward"){let z=W._zod.parse({value:F.value,issues:[]},{...L,skipChecks:!0});if(z instanceof Promise)return z.then((K)=>{return B(K,F,L)});return B(z,F,L)}let J=W._zod.parse(F,L);if(J instanceof Promise){if(L.async===!1)throw new V5;return J.then((z)=>G(z,Y,L))}return G(J,Y,L)}}_0(W,"~standard",()=>({validate:(G)=>{try{let B=wB(W,G);return B.success?{value:B.data}:{issues:B.error?.issues}}catch(B){return DB(W,G).then((F)=>F.success?{value:F.data}:{issues:F.error?.issues})}},vendor:"zod",version:1}))}),wQ=i("$ZodString",(W,Q)=>{u0.init(W,Q),W._zod.pattern=[...W?._zod.bag?.patterns??[]].pop()??aB(W._zod.bag),W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=String(X.value)}catch(G){}if(typeof X.value==="string")return X;return X.issues.push({expected:"string",code:"invalid_type",input:X.value,inst:W}),X}}),a0=i("$ZodStringFormat",(W,Q)=>{GW.init(W,Q),wQ.init(W,Q)}),SF=i("$ZodGUID",(W,Q)=>{Q.pattern??(Q.pattern=_B),a0.init(W,Q)}),qF=i("$ZodUUID",(W,Q)=>{if(Q.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[Q.version];if(Y===void 0)throw Error(`Invalid UUID version: "${Q.version}"`);Q.pattern??(Q.pattern=QY(Y))}else Q.pattern??(Q.pattern=QY());a0.init(W,Q)}),CF=i("$ZodEmail",(W,Q)=>{Q.pattern??(Q.pattern=gB),a0.init(W,Q)}),kF=i("$ZodURL",(W,Q)=>{a0.init(W,Q),W._zod.check=(X)=>{try{let Y=X.value.trim();if(!Q.normalize&&Q.protocol?.source===cB.source){if(!/^https?:\/\//i.test(Y)){X.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:X.value,inst:W,continue:!Q.abort});return}}let G=new URL(Y);if(Q.hostname){if(Q.hostname.lastIndex=0,!Q.hostname.test(G.hostname))X.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Q.hostname.source,input:X.value,inst:W,continue:!Q.abort})}if(Q.protocol){if(Q.protocol.lastIndex=0,!Q.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))X.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:Q.protocol.source,input:X.value,inst:W,continue:!Q.abort})}if(Q.normalize)X.value=G.href;else X.value=Y;return}catch(Y){X.issues.push({code:"invalid_format",format:"url",input:X.value,inst:W,continue:!Q.abort})}}}),vF=i("$ZodEmoji",(W,Q)=>{Q.pattern??(Q.pattern=fB()),a0.init(W,Q)}),yF=i("$ZodNanoID",(W,Q)=>{Q.pattern??(Q.pattern=vB),a0.init(W,Q)}),_F=i("$ZodCUID",(W,Q)=>{Q.pattern??(Q.pattern=bB),a0.init(W,Q)}),gF=i("$ZodCUID2",(W,Q)=>{Q.pattern??(Q.pattern=SB),a0.init(W,Q)}),fF=i("$ZodULID",(W,Q)=>{Q.pattern??(Q.pattern=qB),a0.init(W,Q)}),xF=i("$ZodXID",(W,Q)=>{Q.pattern??(Q.pattern=CB),a0.init(W,Q)}),hF=i("$ZodKSUID",(W,Q)=>{Q.pattern??(Q.pattern=kB),a0.init(W,Q)}),uF=i("$ZodISODateTime",(W,Q)=>{Q.pattern??(Q.pattern=oB(Q)),a0.init(W,Q)}),lF=i("$ZodISODate",(W,Q)=>{Q.pattern??(Q.pattern=iB),a0.init(W,Q)}),mF=i("$ZodISOTime",(W,Q)=>{Q.pattern??(Q.pattern=rB(Q)),a0.init(W,Q)}),cF=i("$ZodISODuration",(W,Q)=>{Q.pattern??(Q.pattern=yB),a0.init(W,Q)}),pF=i("$ZodIPv4",(W,Q)=>{Q.pattern??(Q.pattern=xB),a0.init(W,Q),W._zod.bag.format="ipv4"}),dF=i("$ZodIPv6",(W,Q)=>{Q.pattern??(Q.pattern=hB),a0.init(W,Q),W._zod.bag.format="ipv6",W._zod.check=(X)=>{try{new URL(`http://[${X.value}]`)}catch{X.issues.push({code:"invalid_format",format:"ipv6",input:X.value,inst:W,continue:!Q.abort})}}}),iF=i("$ZodCIDRv4",(W,Q)=>{Q.pattern??(Q.pattern=uB),a0.init(W,Q)}),nF=i("$ZodCIDRv6",(W,Q)=>{Q.pattern??(Q.pattern=lB),a0.init(W,Q),W._zod.check=(X)=>{let Y=X.value.split("/");try{if(Y.length!==2)throw Error();let[G,B]=Y;if(!B)throw Error();let F=Number(B);if(`${F}`!==B)throw Error();if(F<0||F>128)throw Error();new URL(`http://[${G}]`)}catch{X.issues.push({code:"invalid_format",format:"cidrv6",input:X.value,inst:W,continue:!Q.abort})}}});oF=i("$ZodBase64",(W,Q)=>{Q.pattern??(Q.pattern=mB),a0.init(W,Q),W._zod.bag.contentEncoding="base64",W._zod.check=(X)=>{if(rF(X.value))return;X.issues.push({code:"invalid_format",format:"base64",input:X.value,inst:W,continue:!Q.abort})}});aF=i("$ZodBase64URL",(W,Q)=>{Q.pattern??(Q.pattern=XY),a0.init(W,Q),W._zod.bag.contentEncoding="base64url",W._zod.check=(X)=>{if(lU(X.value))return;X.issues.push({code:"invalid_format",format:"base64url",input:X.value,inst:W,continue:!Q.abort})}}),sF=i("$ZodE164",(W,Q)=>{Q.pattern??(Q.pattern=pB),a0.init(W,Q)});tF=i("$ZodJWT",(W,Q)=>{a0.init(W,Q),W._zod.check=(X)=>{if(mU(X.value,Q.alg))return;X.issues.push({code:"invalid_format",format:"jwt",input:X.value,inst:W,continue:!Q.abort})}}),zY=i("$ZodNumber",(W,Q)=>{u0.init(W,Q),W._zod.pattern=W._zod.bag.pattern??$Q,W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=Number(X.value)}catch(F){}let G=X.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return X;let B=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return X.issues.push({expected:"number",code:"invalid_type",input:G,inst:W,...B?{received:B}:{}}),X}}),eF=i("$ZodNumberFormat",(W,Q)=>{BF.init(W,Q),zY.init(W,Q)}),WL=i("$ZodBoolean",(W,Q)=>{u0.init(W,Q),W._zod.pattern=eB,W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=Boolean(X.value)}catch(B){}let G=X.value;if(typeof G==="boolean")return X;return X.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:W}),X}}),QL=i("$ZodBigInt",(W,Q)=>{u0.init(W,Q),W._zod.pattern=sB,W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=BigInt(X.value)}catch(G){}if(typeof X.value==="bigint")return X;return X.issues.push({expected:"bigint",code:"invalid_type",input:X.value,inst:W}),X}}),XL=i("$ZodNull",(W,Q)=>{u0.init(W,Q),W._zod.pattern=WF,W._zod.values=new Set([null]),W._zod.parse=(X,Y)=>{let G=X.value;if(G===null)return X;return X.issues.push({expected:"null",code:"invalid_type",input:G,inst:W}),X}}),YL=i("$ZodAny",(W,Q)=>{u0.init(W,Q),W._zod.parse=(X)=>X}),GL=i("$ZodUnknown",(W,Q)=>{u0.init(W,Q),W._zod.parse=(X)=>X}),BL=i("$ZodNever",(W,Q)=>{u0.init(W,Q),W._zod.parse=(X,Y)=>{return X.issues.push({expected:"never",code:"invalid_type",input:X.value,inst:W}),X}}),FL=i("$ZodDate",(W,Q)=>{u0.init(W,Q),W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=new Date(X.value)}catch(L){}let G=X.value,B=G instanceof Date;if(B&&!Number.isNaN(G.getTime()))return X;return X.issues.push({expected:"date",code:"invalid_type",input:G,...B?{received:"Invalid Date"}:{},inst:W}),X}});LL=i("$ZodArray",(W,Q)=>{u0.init(W,Q),W._zod.parse=(X,Y)=>{let G=X.value;if(!Array.isArray(G))return X.issues.push({expected:"array",code:"invalid_type",input:G,inst:W}),X;X.value=Array(G.length);let B=[];for(let F=0;F<G.length;F++){let L=G[F],J=Q.element._zod.run({value:L,issues:[]},Y);if(J instanceof Promise)B.push(J.then((z)=>wF(z,X,F)));else wF(J,X,F)}if(B.length)return Promise.all(B).then(()=>X);return X}});cU=i("$ZodObject",(W,Q)=>{if(u0.init(W,Q),!Object.getOwnPropertyDescriptor(Q,"shape")?.get){let L=Q.shape;Object.defineProperty(Q,"shape",{get:()=>{let J={...L};return Object.defineProperty(Q,"shape",{value:J}),J}})}let Y=y4(()=>JL(Q));_0(W._zod,"propValues",()=>{let L=Q.shape,J={};for(let z in L){let K=L[z]._zod;if(K.values){J[z]??(J[z]=new Set);for(let H of K.values)J[z].add(H)}}return J});let G=B4,B=Q.catchall,F;W._zod.parse=(L,J)=>{F??(F=Y.value);let z=L.value;if(!G(z))return L.issues.push({expected:"object",code:"invalid_type",input:z,inst:W}),L;L.value={};let K=[],H=F.shape;for(let D of F.keys){let I=H[D],A=I._zod.optin==="optional",M=I._zod.optout==="optional",N=I._zod.run({value:z[D],issues:[]},J);if(N instanceof Promise)K.push(N.then((Z)=>VQ(Z,L,D,z,A,M)));else VQ(N,L,D,z,A,M)}if(!B)return K.length?Promise.all(K).then(()=>L):L;return zL(K,z,L,J,Y.value,W)}}),KL=i("$ZodObjectJIT",(W,Q)=>{cU.init(W,Q);let X=W._zod.parse,Y=y4(()=>JL(Q)),G=(D)=>{let I=new FY(["shape","payload","ctx"]),A=Y.value,M=(U)=>{let j=LQ(U);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};I.write("const input = payload.value;");let N=Object.create(null),Z=0;for(let U of A.keys)N[U]=`key_${Z++}`;I.write("const newResult = {};");for(let U of A.keys){let j=N[U],T=LQ(U),O=D[U],w=O?._zod?.optin==="optional",R=O?._zod?.optout==="optional";if(I.write(`const ${j} = ${M(U)};`),w&&R)I.write(`
7
+ if (${j}.issues.length) {
8
+ if (${T} in input) {
9
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
10
+ ...iss,
11
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
12
+ })));
13
+ }
14
+ }
15
+
16
+ if (${j}.value === undefined) {
17
+ if (${T} in input) {
18
+ newResult[${T}] = undefined;
19
+ }
20
+ } else {
21
+ newResult[${T}] = ${j}.value;
22
+ }
23
+
24
+ `);else if(!w)I.write(`
25
+ const ${j}_present = ${T} in input;
26
+ if (${j}.issues.length) {
27
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
28
+ ...iss,
29
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
30
+ })));
31
+ }
32
+ if (!${j}_present && !${j}.issues.length) {
33
+ payload.issues.push({
34
+ code: "invalid_type",
35
+ expected: "nonoptional",
36
+ input: undefined,
37
+ path: [${T}]
38
+ });
39
+ }
40
+
41
+ if (${j}_present) {
42
+ if (${j}.value === undefined) {
43
+ newResult[${T}] = undefined;
44
+ } else {
45
+ newResult[${T}] = ${j}.value;
46
+ }
47
+ }
48
+
49
+ `);else I.write(`
50
+ if (${j}.issues.length) {
51
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
52
+ ...iss,
53
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
54
+ })));
55
+ }
56
+
57
+ if (${j}.value === undefined) {
58
+ if (${T} in input) {
59
+ newResult[${T}] = undefined;
60
+ }
61
+ } else {
62
+ newResult[${T}] = ${j}.value;
63
+ }
64
+
65
+ `)}I.write("payload.value = newResult;"),I.write("return payload;");let V=I.compile();return(U,j)=>V(D,U,j)},B,F=B4,L=!k4.jitless,z=L&&pX.value,K=Q.catchall,H;W._zod.parse=(D,I)=>{H??(H=Y.value);let A=D.value;if(!F(A))return D.issues.push({expected:"object",code:"invalid_type",input:A,inst:W}),D;if(L&&z&&I?.async===!1&&I.jitless!==!0){if(!B)B=G(Q.shape);if(D=B(D,I),!K)return D;return zL([],A,D,I,H,W)}return X(D,I)}});KY=i("$ZodUnion",(W,Q)=>{u0.init(W,Q),_0(W._zod,"optin",()=>Q.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),_0(W._zod,"optout",()=>Q.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),_0(W._zod,"values",()=>{if(Q.options.every((Y)=>Y._zod.values))return new Set(Q.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),_0(W._zod,"pattern",()=>{if(Q.options.every((Y)=>Y._zod.pattern)){let Y=Q.options.map((G)=>G._zod.pattern);return new RegExp(`^(${Y.map((G)=>e9(G.source)).join("|")})$`)}return});let X=Q.options.length===1?Q.options[0]._zod.run:null;W._zod.parse=(Y,G)=>{if(X)return X(Y,G);let B=!1,F=[];for(let L of Q.options){let J=L._zod.run({value:Y.value,issues:[]},G);if(J instanceof Promise)F.push(J),B=!0;else{if(J.issues.length===0)return J;F.push(J)}}if(!B)return DF(F,Y,W,G);return Promise.all(F).then((L)=>{return DF(L,Y,W,G)})}}),ZL=i("$ZodDiscriminatedUnion",(W,Q)=>{Q.inclusive=!1,KY.init(W,Q);let X=W._zod.parse;_0(W._zod,"propValues",()=>{let G={};for(let B of Q.options){let F=B._zod.propValues;if(!F||Object.keys(F).length===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(B)}"`);for(let[L,J]of Object.entries(F)){if(!G[L])G[L]=new Set;for(let z of J)G[L].add(z)}}return G});let Y=y4(()=>{let G=Q.options,B=new Map;for(let F of G){let L=F._zod.propValues?.[Q.discriminator];if(!L||L.size===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(F)}"`);for(let J of L){if(B.has(J))throw Error(`Duplicate discriminator value "${String(J)}"`);B.set(J,F)}}return B});W._zod.parse=(G,B)=>{let F=G.value;if(!B4(F))return G.issues.push({code:"invalid_type",expected:"object",input:F,inst:W}),G;let L=Y.value.get(F?.[Q.discriminator]);if(L)return L._zod.run(G,B);if(Q.unionFallback||B.direction==="backward")return X(G,B);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Q.discriminator,options:Array.from(Y.value.keys()),input:F,path:[Q.discriminator],inst:W}),G}}),HL=i("$ZodIntersection",(W,Q)=>{u0.init(W,Q),W._zod.parse=(X,Y)=>{let G=X.value,B=Q.left._zod.run({value:G,issues:[]},Y),F=Q.right._zod.run({value:G,issues:[]},Y);if(B instanceof Promise||F instanceof Promise)return Promise.all([B,F]).then(([J,z])=>{return MF(X,J,z)});return MF(X,B,F)}});$L=i("$ZodTuple",(W,Q)=>{u0.init(W,Q);let X=Q.items;W._zod.parse=(Y,G)=>{let B=Y.value;if(!Array.isArray(B))return Y.issues.push({input:B,inst:W,expected:"tuple",code:"invalid_type"}),Y;Y.value=[];let F=[],L=jF(X,"optin"),J=jF(X,"optout");if(!Q.rest){if(B.length<L)return Y.issues.push({code:"too_small",minimum:L,inclusive:!0,input:B,inst:W,origin:"array"}),Y;if(B.length>X.length)Y.issues.push({code:"too_big",maximum:X.length,inclusive:!0,input:B,inst:W,origin:"array"})}let z=Array(X.length);for(let K=0;K<X.length;K++){let H=X[K]._zod.run({value:B[K],issues:[]},G);if(H instanceof Promise)F.push(H.then((D)=>{z[K]=D}));else z[K]=H}if(Q.rest){let K=X.length-1,H=B.slice(X.length);for(let D of H){K++;let I=Q.rest._zod.run({value:D,issues:[]},G);if(I instanceof Promise)F.push(I.then((A)=>OF(A,Y,K)));else OF(I,Y,K)}}if(F.length)return Promise.all(F).then(()=>EF(z,Y,X,B,J));return EF(z,Y,X,B,J)}});UL=i("$ZodRecord",(W,Q)=>{u0.init(W,Q),W._zod.parse=(X,Y)=>{let G=X.value;if(!v5(G))return X.issues.push({expected:"record",code:"invalid_type",input:G,inst:W}),X;let B=[],F=Q.keyType._zod.values;if(F){X.value={};let L=new Set;for(let z of F)if(typeof z==="string"||typeof z==="number"||typeof z==="symbol"){L.add(typeof z==="number"?z.toString():z);let K=Q.keyType._zod.run({value:z,issues:[]},Y);if(K instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(K.issues.length){X.issues.push({code:"invalid_key",origin:"record",issues:K.issues.map((I)=>t1(I,Y,q1())),input:z,path:[z],inst:W});continue}let H=K.value,D=Q.valueType._zod.run({value:G[z],issues:[]},Y);if(D instanceof Promise)B.push(D.then((I)=>{if(I.issues.length)X.issues.push(...b6(z,I.issues));X.value[H]=I.value}));else{if(D.issues.length)X.issues.push(...b6(z,D.issues));X.value[H]=D.value}}let J;for(let z in G)if(!L.has(z))J=J??[],J.push(z);if(J&&J.length>0)X.issues.push({code:"unrecognized_keys",input:G,inst:W,keys:J})}else{X.value={};for(let L of Reflect.ownKeys(G)){if(L==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(G,L))continue;let J=Q.keyType._zod.run({value:L,issues:[]},Y);if(J instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof L==="string"&&$Q.test(L)&&J.issues.length){let H=Q.keyType._zod.run({value:Number(L),issues:[]},Y);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length===0)J=H}if(J.issues.length){if(Q.mode==="loose")X.value[L]=G[L];else X.issues.push({code:"invalid_key",origin:"record",issues:J.issues.map((H)=>t1(H,Y,q1())),input:L,path:[L],inst:W});continue}let K=Q.valueType._zod.run({value:G[L],issues:[]},Y);if(K instanceof Promise)B.push(K.then((H)=>{if(H.issues.length)X.issues.push(...b6(L,H.issues));X.value[J.value]=H.value}));else{if(K.issues.length)X.issues.push(...b6(L,K.issues));X.value[J.value]=K.value}}}if(B.length)return Promise.all(B).then(()=>X);return X}}),AL=i("$ZodEnum",(W,Q)=>{u0.init(W,Q);let X=s9(Q.entries),Y=new Set(X);W._zod.values=Y,W._zod.pattern=new RegExp(`^(${X.filter((G)=>dX.has(typeof G)).map((G)=>typeof G==="string"?D5(G):G.toString()).join("|")})$`),W._zod.parse=(G,B)=>{let F=G.value;if(Y.has(F))return G;return G.issues.push({code:"invalid_value",values:X,input:F,inst:W}),G}}),NL=i("$ZodLiteral",(W,Q)=>{if(u0.init(W,Q),Q.values.length===0)throw Error("Cannot create literal schema with no valid values");let X=new Set(Q.values);W._zod.values=X,W._zod.pattern=new RegExp(`^(${Q.values.map((Y)=>typeof Y==="string"?D5(Y):Y?D5(Y.toString()):String(Y)).join("|")})$`),W._zod.parse=(Y,G)=>{let B=Y.value;if(X.has(B))return Y;return Y.issues.push({code:"invalid_value",values:Q.values,input:B,inst:W}),Y}}),VL=i("$ZodTransform",(W,Q)=>{u0.init(W,Q),W._zod.optin="optional",W._zod.parse=(X,Y)=>{if(Y.direction==="backward")throw new o9(W.constructor.name);let G=Q.transform(X.value,X);if(Y.async)return(G instanceof Promise?G:Promise.resolve(G)).then((F)=>{return X.value=F,X.fallback=!0,X});if(G instanceof Promise)throw new V5;return X.value=G,X.fallback=!0,X}});ZY=i("$ZodOptional",(W,Q)=>{u0.init(W,Q),W._zod.optin="optional",W._zod.optout="optional",_0(W._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,void 0]):void 0}),_0(W._zod,"pattern",()=>{let X=Q.innerType._zod.pattern;return X?new RegExp(`^(${e9(X.source)})?$`):void 0}),W._zod.parse=(X,Y)=>{if(Q.innerType._zod.optin==="optional"){let G=X.value,B=Q.innerType._zod.run(X,Y);if(B instanceof Promise)return B.then((F)=>IF(F,G));return IF(B,G)}if(X.value===void 0)return X;return Q.innerType._zod.run(X,Y)}}),wL=i("$ZodExactOptional",(W,Q)=>{ZY.init(W,Q),_0(W._zod,"values",()=>Q.innerType._zod.values),_0(W._zod,"pattern",()=>Q.innerType._zod.pattern),W._zod.parse=(X,Y)=>{return Q.innerType._zod.run(X,Y)}}),DL=i("$ZodNullable",(W,Q)=>{u0.init(W,Q),_0(W._zod,"optin",()=>Q.innerType._zod.optin),_0(W._zod,"optout",()=>Q.innerType._zod.optout),_0(W._zod,"pattern",()=>{let X=Q.innerType._zod.pattern;return X?new RegExp(`^(${e9(X.source)}|null)$`):void 0}),_0(W._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,null]):void 0}),W._zod.parse=(X,Y)=>{if(X.value===null)return X;return Q.innerType._zod.run(X,Y)}}),ML=i("$ZodDefault",(W,Q)=>{u0.init(W,Q),W._zod.optin="optional",_0(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);if(X.value===void 0)return X.value=Q.defaultValue,X;let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>TF(B,Q));return TF(G,Q)}});jL=i("$ZodPrefault",(W,Q)=>{u0.init(W,Q),W._zod.optin="optional",_0(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);if(X.value===void 0)X.value=Q.defaultValue;return Q.innerType._zod.run(X,Y)}}),OL=i("$ZodNonOptional",(W,Q)=>{u0.init(W,Q),_0(W._zod,"values",()=>{let X=Q.innerType._zod.values;return X?new Set([...X].filter((Y)=>Y!==void 0)):void 0}),W._zod.parse=(X,Y)=>{let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>RF(B,W));return RF(G,W)}});EL=i("$ZodCatch",(W,Q)=>{u0.init(W,Q),W._zod.optin="optional",_0(W._zod,"optout",()=>Q.innerType._zod.optout),_0(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>{if(X.value=B.value,B.issues.length)X.value=Q.catchValue({...X,error:{issues:B.issues.map((F)=>t1(F,Y,q1()))},input:X.value}),X.issues=[],X.fallback=!0;return X});if(X.value=G.value,G.issues.length)X.value=Q.catchValue({...X,error:{issues:G.issues.map((B)=>t1(B,Y,q1()))},input:X.value}),X.issues=[],X.fallback=!0;return X}}),HY=i("$ZodPipe",(W,Q)=>{u0.init(W,Q),_0(W._zod,"values",()=>Q.in._zod.values),_0(W._zod,"optin",()=>Q.in._zod.optin),_0(W._zod,"optout",()=>Q.out._zod.optout),_0(W._zod,"propValues",()=>Q.in._zod.propValues),W._zod.parse=(X,Y)=>{if(Y.direction==="backward"){let B=Q.out._zod.run(X,Y);if(B instanceof Promise)return B.then((F)=>NQ(F,Q.in,Y));return NQ(B,Q.in,Y)}let G=Q.in._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>NQ(B,Q.out,Y));return NQ(G,Q.out,Y)}});IL=i("$ZodPreprocess",(W,Q)=>{HY.init(W,Q)}),TL=i("$ZodReadonly",(W,Q)=>{u0.init(W,Q),_0(W._zod,"propValues",()=>Q.innerType._zod.propValues),_0(W._zod,"values",()=>Q.innerType._zod.values),_0(W._zod,"optin",()=>Q.innerType?._zod?.optin),_0(W._zod,"optout",()=>Q.innerType?._zod?.optout),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then(PF);return PF(G)}});RL=i("$ZodLazy",(W,Q)=>{u0.init(W,Q),_0(W._zod,"innerType",()=>{let X=Q;if(!X._cachedInner)X._cachedInner=Q.getter();return X._cachedInner}),_0(W._zod,"pattern",()=>W._zod.innerType?._zod?.pattern),_0(W._zod,"propValues",()=>W._zod.innerType?._zod?.propValues),_0(W._zod,"optin",()=>W._zod.innerType?._zod?.optin??void 0),_0(W._zod,"optout",()=>W._zod.innerType?._zod?.optout??void 0),W._zod.parse=(X,Y)=>{return W._zod.innerType._zod.run(X,Y)}}),PL=i("$ZodCustom",(W,Q)=>{A1.init(W,Q),u0.init(W,Q),W._zod.parse=(X,Y)=>{return X},W._zod.check=(X)=>{let Y=X.value,G=Q.fn(Y);if(G instanceof Promise)return G.then((B)=>bF(B,X,Y,W));bF(G,X,Y,W);return}})});function $Y(){return{localeError:pU()}}var pU=()=>{let W={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function Q(G){return W[G]??null}let X={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},Y={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let B=Y[G.expected]??G.expected,F=oX(G.input),L=Y[F]??F;return`Invalid input: expected ${B}, received ${L}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${zQ(G.values[0])}`;return`Invalid option: expected one of ${FQ(G.values,"|")}`;case"too_big":{let B=G.inclusive?"<=":"<",F=Q(G.origin);if(F)return`Too big: expected ${G.origin??"value"} to have ${B}${G.maximum.toString()} ${F.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${B}${G.maximum.toString()}`}case"too_small":{let B=G.inclusive?">=":">",F=Q(G.origin);if(F)return`Too small: expected ${G.origin} to have ${B}${G.minimum.toString()} ${F.unit}`;return`Too small: expected ${G.origin} to be ${B}${G.minimum.toString()}`}case"invalid_format":{let B=G;if(B.format==="starts_with")return`Invalid string: must start with "${B.prefix}"`;if(B.format==="ends_with")return`Invalid string: must end with "${B.suffix}"`;if(B.format==="includes")return`Invalid string: must include "${B.includes}"`;if(B.format==="regex")return`Invalid string: must match pattern ${B.pattern}`;return`Invalid ${X[B.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${FQ(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":if(G.options&&Array.isArray(G.options)&&G.options.length>0)return`Invalid discriminator value. Expected ${G.options.map((F)=>`'${F}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};var SL=H0(()=>{S6()});var UY=()=>{};class kL{constructor(){this._map=new WeakMap,this._idmap=new Map}add(W,...Q){let X=Q[0];if(this._map.set(W,X),X&&typeof X==="object"&&"id"in X)this._idmap.set(X.id,W);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(W){let Q=this._map.get(W);if(Q&&typeof Q==="object"&&"id"in Q)this._idmap.delete(Q.id);return this._map.delete(W),this}get(W){let Q=W._zod.parent;if(Q){let X={...this.get(Q)??{}};delete X.id;let Y={...X,...this._map.get(W)};return Object.keys(Y).length?Y:void 0}return this._map.get(W)}has(W){return this._map.has(W)}}function vL(){return new kL}var CL,dU,iU,_5;var AY=H0(()=>{dU=Symbol("ZodOutput"),iU=Symbol("ZodInput");(CL=globalThis).__zod_globalRegistry??(CL.__zod_globalRegistry=vL());_5=globalThis.__zod_globalRegistry});function yL(W,Q){return new W({type:"string",...A0(Q)})}function _L(W,Q){return new W({type:"string",coerce:!0,...A0(Q)})}function NY(W,Q){return new W({type:"string",format:"email",check:"string_format",abort:!1,...A0(Q)})}function VY(W,Q){return new W({type:"string",format:"guid",check:"string_format",abort:!1,...A0(Q)})}function gL(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,...A0(Q)})}function fL(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A0(Q)})}function xL(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A0(Q)})}function hL(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A0(Q)})}function wY(W,Q){return new W({type:"string",format:"url",check:"string_format",abort:!1,...A0(Q)})}function uL(W,Q){return new W({type:"string",format:"emoji",check:"string_format",abort:!1,...A0(Q)})}function lL(W,Q){return new W({type:"string",format:"nanoid",check:"string_format",abort:!1,...A0(Q)})}function mL(W,Q){return new W({type:"string",format:"cuid",check:"string_format",abort:!1,...A0(Q)})}function cL(W,Q){return new W({type:"string",format:"cuid2",check:"string_format",abort:!1,...A0(Q)})}function pL(W,Q){return new W({type:"string",format:"ulid",check:"string_format",abort:!1,...A0(Q)})}function dL(W,Q){return new W({type:"string",format:"xid",check:"string_format",abort:!1,...A0(Q)})}function iL(W,Q){return new W({type:"string",format:"ksuid",check:"string_format",abort:!1,...A0(Q)})}function nL(W,Q){return new W({type:"string",format:"ipv4",check:"string_format",abort:!1,...A0(Q)})}function rL(W,Q){return new W({type:"string",format:"ipv6",check:"string_format",abort:!1,...A0(Q)})}function oL(W,Q){return new W({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A0(Q)})}function aL(W,Q){return new W({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A0(Q)})}function sL(W,Q){return new W({type:"string",format:"base64",check:"string_format",abort:!1,...A0(Q)})}function tL(W,Q){return new W({type:"string",format:"base64url",check:"string_format",abort:!1,...A0(Q)})}function eL(W,Q){return new W({type:"string",format:"e164",check:"string_format",abort:!1,...A0(Q)})}function WJ(W,Q){return new W({type:"string",format:"jwt",check:"string_format",abort:!1,...A0(Q)})}function QJ(W,Q){return new W({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A0(Q)})}function XJ(W,Q){return new W({type:"string",format:"date",check:"string_format",...A0(Q)})}function YJ(W,Q){return new W({type:"string",format:"time",check:"string_format",precision:null,...A0(Q)})}function GJ(W,Q){return new W({type:"string",format:"duration",check:"string_format",...A0(Q)})}function BJ(W,Q){return new W({type:"number",checks:[],...A0(Q)})}function FJ(W,Q){return new W({type:"number",coerce:!0,checks:[],...A0(Q)})}function LJ(W,Q){return new W({type:"number",check:"number_format",abort:!1,format:"safeint",...A0(Q)})}function JJ(W,Q){return new W({type:"boolean",...A0(Q)})}function zJ(W,Q){return new W({type:"boolean",coerce:!0,...A0(Q)})}function KJ(W,Q){return new W({type:"bigint",coerce:!0,...A0(Q)})}function ZJ(W,Q){return new W({type:"null",...A0(Q)})}function HJ(W){return new W({type:"any"})}function $J(W){return new W({type:"unknown"})}function UJ(W,Q){return new W({type:"never",...A0(Q)})}function AJ(W,Q){return new W({type:"date",coerce:!0,...A0(Q)})}function g4(W,Q){return new YY({check:"less_than",...A0(Q),value:W,inclusive:!1})}function M5(W,Q){return new YY({check:"less_than",...A0(Q),value:W,inclusive:!0})}function f4(W,Q){return new GY({check:"greater_than",...A0(Q),value:W,inclusive:!1})}function q6(W,Q){return new GY({check:"greater_than",...A0(Q),value:W,inclusive:!0})}function BW(W,Q){return new GF({check:"multiple_of",...A0(Q),value:W})}function DQ(W,Q){return new FF({check:"max_length",...A0(Q),maximum:W})}function x4(W,Q){return new LF({check:"min_length",...A0(Q),minimum:W})}function MQ(W,Q){return new JF({check:"length_equals",...A0(Q),length:W})}function DY(W,Q){return new zF({check:"string_format",format:"regex",...A0(Q),pattern:W})}function MY(W){return new KF({check:"string_format",format:"lowercase",...A0(W)})}function jY(W){return new ZF({check:"string_format",format:"uppercase",...A0(W)})}function OY(W,Q){return new HF({check:"string_format",format:"includes",...A0(Q),includes:W})}function EY(W,Q){return new $F({check:"string_format",format:"starts_with",...A0(Q),prefix:W})}function IY(W,Q){return new UF({check:"string_format",format:"ends_with",...A0(Q),suffix:W})}function g5(W){return new AF({check:"overwrite",tx:W})}function TY(W){return g5((Q)=>Q.normalize(W))}function RY(){return g5((W)=>W.trim())}function PY(){return g5((W)=>W.toLowerCase())}function bY(){return g5((W)=>W.toUpperCase())}function SY(){return g5((W)=>cX(W))}function NJ(W,Q,X){return new W({type:"array",element:Q,...A0(X)})}function VJ(W,Q,X){return new W({type:"custom",check:"custom",fn:Q,...A0(X)})}function wJ(W,Q){let X=nU((Y)=>{return Y.addIssue=(G)=>{if(typeof G==="string")Y.issues.push(_4(G,Y.value,X._zod.def));else{let B=G;if(B.fatal)B.continue=!1;B.code??(B.code="custom"),B.input??(B.input=Y.value),B.inst??(B.inst=X),B.continue??(B.continue=!X._zod.def.abort),Y.issues.push(_4(B))}},W(Y.value,Y)},Q);return X}function nU(W,Q){let X=new A1({check:"custom",...A0(Q)});return X._zod.check=W,X}var DJ=H0(()=>{AQ();S6()});function LW(W){let Q=W?.target??"draft-2020-12";if(Q==="draft-4")Q="draft-04";if(Q==="draft-7")Q="draft-07";return{processors:W.processors??{},metadataRegistry:W?.metadata??_5,target:Q,unrepresentable:W?.unrepresentable??"throw",override:W?.override??(()=>{}),io:W?.io??"output",counter:0,seen:new Map,cycles:W?.cycles??"ref",reused:W?.reused??"inline",external:W?.external??void 0}}function n0(W,Q,X={path:[],schemaPath:[]}){var Y;let G=W._zod.def,B=Q.seen.get(W);if(B){if(B.count++,X.schemaPath.includes(W))B.cycle=X.path;return B.schema}let F={schema:{},count:1,cycle:void 0,path:X.path};Q.seen.set(W,F);let L=W._zod.toJSONSchema?.();if(L)F.schema=L;else{let K={...X,schemaPath:[...X.schemaPath,W],path:X.path};if(W._zod.processJSONSchema)W._zod.processJSONSchema(Q,F.schema,K);else{let D=F.schema,I=Q.processors[G.type];if(!I)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);I(W,Q,D,K)}let H=W._zod.parent;if(H){if(!F.ref)F.ref=H;n0(H,Q,K),Q.seen.get(H).isParent=!0}}let J=Q.metadataRegistry.get(W);if(J)Object.assign(F.schema,J);if(Q.io==="input"&&P1(W))delete F.schema.examples,delete F.schema.default;if(Q.io==="input"&&"_prefault"in F.schema)(Y=F.schema).default??(Y.default=F.schema._prefault);return delete F.schema._prefault,Q.seen.get(W).schema}function JW(W,Q){let X=W.seen.get(Q);if(!X)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=new Map;for(let F of W.seen.entries()){let L=W.metadataRegistry.get(F[0])?.id;if(L){let J=Y.get(L);if(J&&J!==F[0])throw Error(`Duplicate schema id "${L}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);Y.set(L,F[0])}}let G=(F)=>{let L=W.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let H=W.external.registry.get(F[0])?.id,D=W.external.uri??((A)=>A);if(H)return{ref:D(H)};let I=F[1].defId??F[1].schema.id??`schema${W.counter++}`;return F[1].defId=I,{defId:I,ref:`${D("__shared")}#/${L}/${I}`}}if(F[1]===X)return{ref:"#"};let z=`${"#"}/${L}/`,K=F[1].schema.id??`__schema${W.counter++}`;return{defId:K,ref:z+K}},B=(F)=>{if(F[1].schema.$ref)return;let L=F[1],{ref:J,defId:z}=G(F);if(L.def={...L.schema},z)L.defId=z;let K=L.schema;for(let H in K)delete K[H];K.$ref=J};if(W.cycles==="throw")for(let F of W.seen.entries()){let L=F[1];if(L.cycle)throw Error(`Cycle detected: #/${L.cycle?.join("/")}/<root>
66
+
67
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let F of W.seen.entries()){let L=F[1];if(Q===F[0]){B(F);continue}if(W.external){let z=W.external.registry.get(F[0])?.id;if(Q!==F[0]&&z){B(F);continue}}if(W.metadataRegistry.get(F[0])?.id){B(F);continue}if(L.cycle){B(F);continue}if(L.count>1){if(W.reused==="ref"){B(F);continue}}}}function zW(W,Q){let X=W.seen.get(Q);if(!X)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(L)=>{let J=W.seen.get(L);if(J.ref===null)return;let z=J.def??J.schema,K={...z},H=J.ref;if(J.ref=null,H){Y(H);let I=W.seen.get(H),A=I.schema;if(A.$ref&&(W.target==="draft-07"||W.target==="draft-04"||W.target==="openapi-3.0"))z.allOf=z.allOf??[],z.allOf.push(A);else Object.assign(z,A);if(Object.assign(z,K),L._zod.parent===H)for(let N in z){if(N==="$ref"||N==="allOf")continue;if(!(N in K))delete z[N]}if(A.$ref&&I.def)for(let N in z){if(N==="$ref"||N==="allOf")continue;if(N in I.def&&JSON.stringify(z[N])===JSON.stringify(I.def[N]))delete z[N]}}let D=L._zod.parent;if(D&&D!==H){Y(D);let I=W.seen.get(D);if(I?.schema.$ref){if(z.$ref=I.schema.$ref,I.def)for(let A in z){if(A==="$ref"||A==="allOf")continue;if(A in I.def&&JSON.stringify(z[A])===JSON.stringify(I.def[A]))delete z[A]}}}W.override({zodSchema:L,jsonSchema:z,path:J.path??[]})};for(let L of[...W.seen.entries()].reverse())Y(L[0]);let G={};if(W.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(W.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(W.target==="openapi-3.0");if(W.external?.uri){let L=W.external.registry.get(Q)?.id;if(!L)throw Error("Schema is missing an `id` property");G.$id=W.external.uri(L)}Object.assign(G,X.def??X.schema);let B=W.metadataRegistry.get(Q)?.id;if(B!==void 0&&G.id===B)delete G.id;let F=W.external?.defs??{};for(let L of W.seen.entries()){let J=L[1];if(J.def&&J.defId){if(J.def.id===J.defId)delete J.def.id;F[J.defId]=J.def}}if(W.external);else if(Object.keys(F).length>0)if(W.target==="draft-2020-12")G.$defs=F;else G.definitions=F;try{let L=JSON.parse(JSON.stringify(G));return Object.defineProperty(L,"~standard",{value:{...Q["~standard"],jsonSchema:{input:FW(Q,"input",W.processors),output:FW(Q,"output",W.processors)}},enumerable:!1,writable:!1}),L}catch(L){throw Error("Error converting schema to JSON.")}}function P1(W,Q){let X=Q??{seen:new Set};if(X.seen.has(W))return!1;X.seen.add(W);let Y=W._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return P1(Y.element,X);if(Y.type==="set")return P1(Y.valueType,X);if(Y.type==="lazy")return P1(Y.getter(),X);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return P1(Y.innerType,X);if(Y.type==="intersection")return P1(Y.left,X)||P1(Y.right,X);if(Y.type==="record"||Y.type==="map")return P1(Y.keyType,X)||P1(Y.valueType,X);if(Y.type==="pipe"){if(W._zod.traits.has("$ZodCodec"))return!0;return P1(Y.in,X)||P1(Y.out,X)}if(Y.type==="object"){for(let G in Y.shape)if(P1(Y.shape[G],X))return!0;return!1}if(Y.type==="union"){for(let G of Y.options)if(P1(G,X))return!0;return!1}if(Y.type==="tuple"){for(let G of Y.items)if(P1(G,X))return!0;if(Y.rest&&P1(Y.rest,X))return!0;return!1}return!1}var MJ=(W,Q={})=>(X)=>{let Y=LW({...X,processors:Q});return n0(W,Y),JW(Y,W),zW(Y,W)},FW=(W,Q,X={})=>(Y)=>{let{libraryOptions:G,target:B}=Y??{},F=LW({...G??{},target:B,io:Q,processors:X});return n0(W,F),JW(F,W),zW(F,W)};var jQ=H0(()=>{AY()});function F4(W,Q){if("_idmap"in W){let Y=W,G=LW({...Q,processors:jJ}),B={};for(let J of Y._idmap.entries()){let[z,K]=J;n0(K,G)}let F={},L={registry:Y,uri:Q?.uri,defs:B};G.external=L;for(let J of Y._idmap.entries()){let[z,K]=J;JW(G,K),F[z]=zW(G,K)}if(Object.keys(B).length>0){let J=G.target==="draft-2020-12"?"$defs":"definitions";F.__shared={[J]:B}}return{schemas:F}}let X=LW({...Q,processors:jJ});return n0(W,X),JW(X,W),zW(X,W)}var rU,qY=(W,Q,X,Y)=>{let G=X;G.type="string";let{minimum:B,maximum:F,format:L,patterns:J,contentEncoding:z}=W._zod.bag;if(typeof B==="number")G.minLength=B;if(typeof F==="number")G.maxLength=F;if(L){if(G.format=rU[L]??L,G.format==="")delete G.format;if(L==="time")delete G.format}if(z)G.contentEncoding=z;if(J&&J.size>0){let K=[...J];if(K.length===1)G.pattern=K[0].source;else if(K.length>1)G.allOf=[...K.map((H)=>({...Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},CY=(W,Q,X,Y)=>{let G=X,{minimum:B,maximum:F,format:L,multipleOf:J,exclusiveMaximum:z,exclusiveMinimum:K}=W._zod.bag;if(typeof L==="string"&&L.includes("int"))G.type="integer";else G.type="number";let H=typeof K==="number"&&K>=(B??Number.NEGATIVE_INFINITY),D=typeof z==="number"&&z<=(F??Number.POSITIVE_INFINITY),I=Q.target==="draft-04"||Q.target==="openapi-3.0";if(H)if(I)G.minimum=K,G.exclusiveMinimum=!0;else G.exclusiveMinimum=K;else if(typeof B==="number")G.minimum=B;if(D)if(I)G.maximum=z,G.exclusiveMaximum=!0;else G.exclusiveMaximum=z;else if(typeof F==="number")G.maximum=F;if(typeof J==="number")G.multipleOf=J},kY=(W,Q,X,Y)=>{X.type="boolean"},vY=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},OJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},yY=(W,Q,X,Y)=>{if(Q.target==="openapi-3.0")X.type="string",X.nullable=!0,X.enum=[null];else X.type="null"},EJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},IJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},_Y=(W,Q,X,Y)=>{X.not={}},gY=(W,Q,X,Y)=>{},fY=(W,Q,X,Y)=>{},xY=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},hY=(W,Q,X,Y)=>{let G=W._zod.def,B=s9(G.entries);if(B.every((F)=>typeof F==="number"))X.type="number";if(B.every((F)=>typeof F==="string"))X.type="string";X.enum=B},uY=(W,Q,X,Y)=>{let G=W._zod.def,B=[];for(let F of G.values)if(F===void 0){if(Q.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof F==="bigint")if(Q.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else B.push(Number(F));else B.push(F);if(B.length===0);else if(B.length===1){let F=B[0];if(X.type=F===null?"null":typeof F,Q.target==="draft-04"||Q.target==="openapi-3.0")X.enum=[F];else X.const=F}else{if(B.every((F)=>typeof F==="number"))X.type="number";if(B.every((F)=>typeof F==="string"))X.type="string";if(B.every((F)=>typeof F==="boolean"))X.type="boolean";if(B.every((F)=>F===null))X.type="null";X.enum=B}},TJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},RJ=(W,Q,X,Y)=>{let G=X,B=W._zod.pattern;if(!B)throw Error("Pattern not found in template literal");G.type="string",G.pattern=B.source},PJ=(W,Q,X,Y)=>{let G=X,B={type:"string",format:"binary",contentEncoding:"binary"},{minimum:F,maximum:L,mime:J}=W._zod.bag;if(F!==void 0)B.minLength=F;if(L!==void 0)B.maxLength=L;if(J)if(J.length===1)B.contentMediaType=J[0],Object.assign(G,B);else Object.assign(G,B),G.anyOf=J.map((z)=>({contentMediaType:z}));else Object.assign(G,B)},bJ=(W,Q,X,Y)=>{X.type="boolean"},lY=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},SJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},mY=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},qJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},CJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},cY=(W,Q,X,Y)=>{let G=X,B=W._zod.def,{minimum:F,maximum:L}=W._zod.bag;if(typeof F==="number")G.minItems=F;if(typeof L==="number")G.maxItems=L;G.type="array",G.items=n0(B.element,Q,{...Y,path:[...Y.path,"items"]})},pY=(W,Q,X,Y)=>{let G=X,B=W._zod.def;G.type="object",G.properties={};let F=B.shape;for(let z in F)G.properties[z]=n0(F[z],Q,{...Y,path:[...Y.path,"properties",z]});let L=new Set(Object.keys(F)),J=new Set([...L].filter((z)=>{let K=B.shape[z]._zod;if(Q.io==="input")return K.optin===void 0;else return K.optout===void 0}));if(J.size>0)G.required=Array.from(J);if(B.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!B.catchall){if(Q.io==="output")G.additionalProperties=!1}else if(B.catchall)G.additionalProperties=n0(B.catchall,Q,{...Y,path:[...Y.path,"additionalProperties"]})},dY=(W,Q,X,Y)=>{let G=W._zod.def,B=G.inclusive===!1,F=G.options.map((L,J)=>n0(L,Q,{...Y,path:[...Y.path,B?"oneOf":"anyOf",J]}));if(B)X.oneOf=F;else X.anyOf=F},iY=(W,Q,X,Y)=>{let G=W._zod.def,B=n0(G.left,Q,{...Y,path:[...Y.path,"allOf",0]}),F=n0(G.right,Q,{...Y,path:[...Y.path,"allOf",1]}),L=(z)=>("allOf"in z)&&Object.keys(z).length===1,J=[...L(B)?B.allOf:[B],...L(F)?F.allOf:[F]];X.allOf=J},nY=(W,Q,X,Y)=>{let G=X,B=W._zod.def;G.type="array";let F=Q.target==="draft-2020-12"?"prefixItems":"items",L=Q.target==="draft-2020-12"?"items":Q.target==="openapi-3.0"?"items":"additionalItems",J=B.items.map((D,I)=>n0(D,Q,{...Y,path:[...Y.path,F,I]})),z=B.rest?n0(B.rest,Q,{...Y,path:[...Y.path,L,...Q.target==="openapi-3.0"?[B.items.length]:[]]}):null;if(Q.target==="draft-2020-12"){if(G.prefixItems=J,z)G.items=z}else if(Q.target==="openapi-3.0"){if(G.items={anyOf:J},z)G.items.anyOf.push(z);if(G.minItems=J.length,!z)G.maxItems=J.length}else if(G.items=J,z)G.additionalItems=z;let{minimum:K,maximum:H}=W._zod.bag;if(typeof K==="number")G.minItems=K;if(typeof H==="number")G.maxItems=H},rY=(W,Q,X,Y)=>{let G=X,B=W._zod.def;G.type="object";let F=B.keyType,J=F._zod.bag?.patterns;if(B.mode==="loose"&&J&&J.size>0){let K=n0(B.valueType,Q,{...Y,path:[...Y.path,"patternProperties","*"]});G.patternProperties={};for(let H of J)G.patternProperties[H.source]=K}else{if(Q.target==="draft-07"||Q.target==="draft-2020-12")G.propertyNames=n0(B.keyType,Q,{...Y,path:[...Y.path,"propertyNames"]});G.additionalProperties=n0(B.valueType,Q,{...Y,path:[...Y.path,"additionalProperties"]})}let z=F._zod.values;if(z){let K=[...z].filter((H)=>typeof H==="string"||typeof H==="number");if(K.length>0)G.required=K}},oY=(W,Q,X,Y)=>{let G=W._zod.def,B=n0(G.innerType,Q,Y),F=Q.seen.get(W);if(Q.target==="openapi-3.0")F.ref=G.innerType,X.nullable=!0;else X.anyOf=[B,{type:"null"}]},aY=(W,Q,X,Y)=>{let G=W._zod.def;n0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType},sY=(W,Q,X,Y)=>{let G=W._zod.def;n0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType,X.default=JSON.parse(JSON.stringify(G.defaultValue))},tY=(W,Q,X,Y)=>{let G=W._zod.def;n0(G.innerType,Q,Y);let B=Q.seen.get(W);if(B.ref=G.innerType,Q.io==="input")X._prefault=JSON.parse(JSON.stringify(G.defaultValue))},eY=(W,Q,X,Y)=>{let G=W._zod.def;n0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType;let F;try{F=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}X.default=F},WG=(W,Q,X,Y)=>{let G=W._zod.def,B=G.in._zod.traits.has("$ZodTransform"),F=Q.io==="input"?B?G.out:G.in:G.out;n0(F,Q,Y);let L=Q.seen.get(W);L.ref=F},QG=(W,Q,X,Y)=>{let G=W._zod.def;n0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType,X.readOnly=!0},kJ=(W,Q,X,Y)=>{let G=W._zod.def;n0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType},OQ=(W,Q,X,Y)=>{let G=W._zod.def;n0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType},XG=(W,Q,X,Y)=>{let G=W._zod.innerType;n0(G,Q,Y);let B=Q.seen.get(W);B.ref=G},jJ;var YG=H0(()=>{jQ();S6();rU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jJ={string:qY,number:CY,boolean:kY,bigint:vY,symbol:OJ,null:yY,undefined:EJ,void:IJ,never:_Y,any:gY,unknown:fY,date:xY,enum:hY,literal:uY,nan:TJ,template_literal:RJ,file:PJ,success:bJ,custom:lY,function:SJ,transform:mY,map:qJ,set:CJ,array:cY,object:pY,union:dY,intersection:iY,tuple:nY,record:rY,nullable:oY,nonoptional:aY,default:sY,prefault:tY,catch:eY,pipe:WG,readonly:QG,promise:kJ,optional:OQ,lazy:XG}});var vJ=()=>{};var e1=H0(()=>{S6();UQ();UY();vJ();G4();WY();eX();bL();AQ();LY();AY();DJ();jQ()});var GG=H0(()=>{e1()});var b1={};xX(b1,{time:()=>LG,duration:()=>JG,datetime:()=>BG,date:()=>FG,ZodISOTime:()=>gJ,ZodISODuration:()=>fJ,ZodISODateTime:()=>yJ,ZodISODate:()=>_J});function BG(W){return QJ(yJ,W)}function FG(W){return XJ(_J,W)}function LG(W){return YJ(gJ,W)}function JG(W){return GJ(fJ,W)}var yJ,_J,gJ,fJ;var zG=H0(()=>{e1();EQ();yJ=i("ZodISODateTime",(W,Q)=>{uF.init(W,Q),s0.init(W,Q)});_J=i("ZodISODate",(W,Q)=>{lF.init(W,Q),s0.init(W,Q)});gJ=i("ZodISOTime",(W,Q)=>{mF.init(W,Q),s0.init(W,Q)});fJ=i("ZodISODuration",(W,Q)=>{cF.init(W,Q),s0.init(W,Q)})});var QA=(W,Q)=>{KQ.init(W,Q),W.name="ZodError",Object.defineProperties(W,{format:{value:(X)=>tX(W,X)},flatten:{value:(X)=>sX(W,X)},addIssue:{value:(X)=>{W.issues.push(X),W.message=JSON.stringify(W.issues,v4,2)}},addIssues:{value:(X)=>{W.issues.push(...X),W.message=JSON.stringify(W.issues,v4,2)}},isEmpty:{get(){return W.issues.length===0}}})},d1;var KG=H0(()=>{e1();e1();S6();d1=i("ZodError",QA,{Parent:Error})});var hJ,uJ,u4,lJ,mJ,cJ,pJ,dJ,iJ,nJ,rJ,oJ;var ZG=H0(()=>{e1();KG();hJ=ZQ(d1),uJ=HQ(d1),u4=QW(d1),lJ=XW(d1),mJ=MB(d1),cJ=jB(d1),pJ=OB(d1),dJ=EB(d1),iJ=IB(d1),nJ=TB(d1),rJ=RB(d1),oJ=PB(d1)});function KW(W,Q,X){let Y=Object.getPrototypeOf(W),G=aJ.get(Y);if(!G)G=new Set,aJ.set(Y,G);if(G.has(Q))return;G.add(Q);for(let B in X){let F=X[B];Object.defineProperty(Y,B,{configurable:!0,enumerable:!1,get(){let L=F.bind(this);return Object.defineProperty(this,B,{configurable:!0,writable:!0,enumerable:!0,value:L}),L},set(L){Object.defineProperty(this,B,{configurable:!0,writable:!0,enumerable:!0,value:L})}})}}function $(W){return yL($G,W)}function TQ(W){return NY(Yz,W)}function l4(W){return wY(Gz,W)}function m(W){return BJ(RQ,W)}function tJ(W){return LJ(wA,W)}function o(W){return JJ(UG,W)}function C6(W){return ZJ(DA,W)}function Fz(){return HJ(MA)}function X0(){return $J(jA)}function EA(W){return UJ(OA,W)}function f(W,Q){return NJ(IA,W,Q)}function q(W,Q){let X={type:"object",shape:W??{},...y0.normalizeParams(Q)};return new Jz(X)}function B0(W,Q){return new Jz({type:"object",shape:W,catchall:X0(),...y0.normalizeParams(Q)})}function a(W,Q){return new zz({type:"union",options:W,...y0.normalizeParams(Q)})}function j5(W,Q,X){return new TA({type:"union",options:Q,discriminator:W,...y0.normalizeParams(X)})}function C1(W,Q){return new RA({type:"intersection",left:W,right:Q})}function Kz(W,Q,X){let Y=Q instanceof u0,G=Y?X:Q;return new PA({type:"tuple",items:W,rest:Y?Q:null,...y0.normalizeParams(G)})}function n(W,Q,X){if(!Q||!Q._zod)return new eJ({type:"record",keyType:$(),valueType:W,...y0.normalizeParams(Q)});return new eJ({type:"record",keyType:W,valueType:Q,...y0.normalizeParams(X)})}function J0(W,Q){let X=Array.isArray(W)?Object.fromEntries(W.map((Y)=>[Y,Y])):W;return new HG({type:"enum",entries:X,...y0.normalizeParams(Q)})}function g(W,Q){return new bA({type:"literal",values:Array.isArray(W)?W:[W],...y0.normalizeParams(Q)})}function Zz(W){return new SA({type:"transform",transform:W})}function W0(W){return new Hz({type:"optional",innerType:W})}function CA(W){return new qA({type:"optional",innerType:W})}function Wz(W){return new kA({type:"nullable",innerType:W})}function yA(W,Q){return new vA({type:"default",innerType:W,get defaultValue(){return typeof Q==="function"?Q():y0.shallowClone(Q)}})}function gA(W,Q){return new _A({type:"prefault",innerType:W,get defaultValue(){return typeof Q==="function"?Q():y0.shallowClone(Q)}})}function fA(W,Q){return new $z({type:"nonoptional",innerType:W,...y0.normalizeParams(Q)})}function hA(W,Q){return new xA({type:"catch",innerType:W,catchValue:typeof Q==="function"?Q:()=>Q})}function Qz(W,Q){return new Uz({type:"pipe",in:W,out:Q})}function mA(W){return new lA({type:"readonly",innerType:W})}function f5(W){return new cA({type:"lazy",getter:W})}function dA(W,Q={}){return VJ(pA,W,Q)}function iA(W,Q){return wJ(W,Q)}function k6(W,Q){return new uA({type:"pipe",in:Zz(W),out:Q})}var aJ,p0,Xz,$G,s0,Yz,sJ,IQ,Gz,YA,GA,BA,FA,LA,JA,zA,KA,ZA,HA,$A,UA,AA,NA,VA,RQ,wA,UG,Bz,DA,MA,jA,OA,Lz,IA,Jz,zz,TA,RA,PA,eJ,HG,bA,SA,Hz,qA,kA,vA,_A,$z,xA,Uz,uA,lA,cA,pA;var EQ=H0(()=>{e1();e1();YG();jQ();GG();zG();ZG();aJ=new WeakMap;p0=i("ZodType",(W,Q)=>{return u0.init(W,Q),Object.assign(W["~standard"],{jsonSchema:{input:FW(W,"input"),output:FW(W,"output")}}),W.toJSONSchema=MJ(W,{}),W.def=Q,W.type=Q.type,Object.defineProperty(W,"_def",{value:Q}),W.parse=(X,Y)=>hJ(W,X,Y,{callee:W.parse}),W.safeParse=(X,Y)=>u4(W,X,Y),W.parseAsync=async(X,Y)=>uJ(W,X,Y,{callee:W.parseAsync}),W.safeParseAsync=async(X,Y)=>lJ(W,X,Y),W.spa=W.safeParseAsync,W.encode=(X,Y)=>mJ(W,X,Y),W.decode=(X,Y)=>cJ(W,X,Y),W.encodeAsync=async(X,Y)=>pJ(W,X,Y),W.decodeAsync=async(X,Y)=>dJ(W,X,Y),W.safeEncode=(X,Y)=>iJ(W,X,Y),W.safeDecode=(X,Y)=>nJ(W,X,Y),W.safeEncodeAsync=async(X,Y)=>rJ(W,X,Y),W.safeDecodeAsync=async(X,Y)=>oJ(W,X,Y),KW(W,"ZodType",{check(...X){let Y=this.def;return this.clone(y0.mergeDefs(Y,{checks:[...Y.checks??[],...X.map((G)=>typeof G==="function"?{_zod:{check:G,def:{check:"custom"},onattach:[]}}:G)]}),{parent:!0})},with(...X){return this.check(...X)},clone(X,Y){return s1(this,X,Y)},brand(){return this},register(X,Y){return X.add(this,Y),this},refine(X,Y){return this.check(dA(X,Y))},superRefine(X,Y){return this.check(iA(X,Y))},overwrite(X){return this.check(g5(X))},optional(){return W0(this)},exactOptional(){return CA(this)},nullable(){return Wz(this)},nullish(){return W0(Wz(this))},nonoptional(X){return fA(this,X)},array(){return f(this)},or(X){return a([this,X])},and(X){return C1(this,X)},transform(X){return Qz(this,Zz(X))},default(X){return yA(this,X)},prefault(X){return gA(this,X)},catch(X){return hA(this,X)},pipe(X){return Qz(this,X)},readonly(){return mA(this)},describe(X){let Y=this.clone();return _5.add(Y,{description:X}),Y},meta(...X){if(X.length===0)return _5.get(this);let Y=this.clone();return _5.add(Y,X[0]),Y},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(X){return X(this)}}),Object.defineProperty(W,"description",{get(){return _5.get(W)?.description},configurable:!0}),W}),Xz=i("_ZodString",(W,Q)=>{wQ.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>qY(W,Y,G,B);let X=W._zod.bag;W.format=X.format??null,W.minLength=X.minimum??null,W.maxLength=X.maximum??null,KW(W,"_ZodString",{regex(...Y){return this.check(DY(...Y))},includes(...Y){return this.check(OY(...Y))},startsWith(...Y){return this.check(EY(...Y))},endsWith(...Y){return this.check(IY(...Y))},min(...Y){return this.check(x4(...Y))},max(...Y){return this.check(DQ(...Y))},length(...Y){return this.check(MQ(...Y))},nonempty(...Y){return this.check(x4(1,...Y))},lowercase(Y){return this.check(MY(Y))},uppercase(Y){return this.check(jY(Y))},trim(){return this.check(RY())},normalize(...Y){return this.check(TY(...Y))},toLowerCase(){return this.check(PY())},toUpperCase(){return this.check(bY())},slugify(){return this.check(SY())}})}),$G=i("ZodString",(W,Q)=>{wQ.init(W,Q),Xz.init(W,Q),W.email=(X)=>W.check(NY(Yz,X)),W.url=(X)=>W.check(wY(Gz,X)),W.jwt=(X)=>W.check(WJ(VA,X)),W.emoji=(X)=>W.check(uL(YA,X)),W.guid=(X)=>W.check(VY(sJ,X)),W.uuid=(X)=>W.check(gL(IQ,X)),W.uuidv4=(X)=>W.check(fL(IQ,X)),W.uuidv6=(X)=>W.check(xL(IQ,X)),W.uuidv7=(X)=>W.check(hL(IQ,X)),W.nanoid=(X)=>W.check(lL(GA,X)),W.guid=(X)=>W.check(VY(sJ,X)),W.cuid=(X)=>W.check(mL(BA,X)),W.cuid2=(X)=>W.check(cL(FA,X)),W.ulid=(X)=>W.check(pL(LA,X)),W.base64=(X)=>W.check(sL(UA,X)),W.base64url=(X)=>W.check(tL(AA,X)),W.xid=(X)=>W.check(dL(JA,X)),W.ksuid=(X)=>W.check(iL(zA,X)),W.ipv4=(X)=>W.check(nL(KA,X)),W.ipv6=(X)=>W.check(rL(ZA,X)),W.cidrv4=(X)=>W.check(oL(HA,X)),W.cidrv6=(X)=>W.check(aL($A,X)),W.e164=(X)=>W.check(eL(NA,X)),W.datetime=(X)=>W.check(BG(X)),W.date=(X)=>W.check(FG(X)),W.time=(X)=>W.check(LG(X)),W.duration=(X)=>W.check(JG(X))});s0=i("ZodStringFormat",(W,Q)=>{a0.init(W,Q),Xz.init(W,Q)}),Yz=i("ZodEmail",(W,Q)=>{CF.init(W,Q),s0.init(W,Q)});sJ=i("ZodGUID",(W,Q)=>{SF.init(W,Q),s0.init(W,Q)}),IQ=i("ZodUUID",(W,Q)=>{qF.init(W,Q),s0.init(W,Q)}),Gz=i("ZodURL",(W,Q)=>{kF.init(W,Q),s0.init(W,Q)});YA=i("ZodEmoji",(W,Q)=>{vF.init(W,Q),s0.init(W,Q)}),GA=i("ZodNanoID",(W,Q)=>{yF.init(W,Q),s0.init(W,Q)}),BA=i("ZodCUID",(W,Q)=>{_F.init(W,Q),s0.init(W,Q)}),FA=i("ZodCUID2",(W,Q)=>{gF.init(W,Q),s0.init(W,Q)}),LA=i("ZodULID",(W,Q)=>{fF.init(W,Q),s0.init(W,Q)}),JA=i("ZodXID",(W,Q)=>{xF.init(W,Q),s0.init(W,Q)}),zA=i("ZodKSUID",(W,Q)=>{hF.init(W,Q),s0.init(W,Q)}),KA=i("ZodIPv4",(W,Q)=>{pF.init(W,Q),s0.init(W,Q)}),ZA=i("ZodIPv6",(W,Q)=>{dF.init(W,Q),s0.init(W,Q)}),HA=i("ZodCIDRv4",(W,Q)=>{iF.init(W,Q),s0.init(W,Q)}),$A=i("ZodCIDRv6",(W,Q)=>{nF.init(W,Q),s0.init(W,Q)}),UA=i("ZodBase64",(W,Q)=>{oF.init(W,Q),s0.init(W,Q)}),AA=i("ZodBase64URL",(W,Q)=>{aF.init(W,Q),s0.init(W,Q)}),NA=i("ZodE164",(W,Q)=>{sF.init(W,Q),s0.init(W,Q)}),VA=i("ZodJWT",(W,Q)=>{tF.init(W,Q),s0.init(W,Q)}),RQ=i("ZodNumber",(W,Q)=>{zY.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>CY(W,Y,G,B),KW(W,"ZodNumber",{gt(Y,G){return this.check(f4(Y,G))},gte(Y,G){return this.check(q6(Y,G))},min(Y,G){return this.check(q6(Y,G))},lt(Y,G){return this.check(g4(Y,G))},lte(Y,G){return this.check(M5(Y,G))},max(Y,G){return this.check(M5(Y,G))},int(Y){return this.check(tJ(Y))},safe(Y){return this.check(tJ(Y))},positive(Y){return this.check(f4(0,Y))},nonnegative(Y){return this.check(q6(0,Y))},negative(Y){return this.check(g4(0,Y))},nonpositive(Y){return this.check(M5(0,Y))},multipleOf(Y,G){return this.check(BW(Y,G))},step(Y,G){return this.check(BW(Y,G))},finite(){return this}});let X=W._zod.bag;W.minValue=Math.max(X.minimum??Number.NEGATIVE_INFINITY,X.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,W.maxValue=Math.min(X.maximum??Number.POSITIVE_INFINITY,X.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,W.isInt=(X.format??"").includes("int")||Number.isSafeInteger(X.multipleOf??0.5),W.isFinite=!0,W.format=X.format??null});wA=i("ZodNumberFormat",(W,Q)=>{eF.init(W,Q),RQ.init(W,Q)});UG=i("ZodBoolean",(W,Q)=>{WL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>kY(W,X,Y,G)});Bz=i("ZodBigInt",(W,Q)=>{QL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>vY(W,Y,G,B),W.gte=(Y,G)=>W.check(q6(Y,G)),W.min=(Y,G)=>W.check(q6(Y,G)),W.gt=(Y,G)=>W.check(f4(Y,G)),W.gte=(Y,G)=>W.check(q6(Y,G)),W.min=(Y,G)=>W.check(q6(Y,G)),W.lt=(Y,G)=>W.check(g4(Y,G)),W.lte=(Y,G)=>W.check(M5(Y,G)),W.max=(Y,G)=>W.check(M5(Y,G)),W.positive=(Y)=>W.check(f4(BigInt(0),Y)),W.negative=(Y)=>W.check(g4(BigInt(0),Y)),W.nonpositive=(Y)=>W.check(M5(BigInt(0),Y)),W.nonnegative=(Y)=>W.check(q6(BigInt(0),Y)),W.multipleOf=(Y,G)=>W.check(BW(Y,G));let X=W._zod.bag;W.minValue=X.minimum??null,W.maxValue=X.maximum??null,W.format=X.format??null}),DA=i("ZodNull",(W,Q)=>{XL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>yY(W,X,Y,G)});MA=i("ZodAny",(W,Q)=>{YL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>gY(W,X,Y,G)});jA=i("ZodUnknown",(W,Q)=>{GL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>fY(W,X,Y,G)});OA=i("ZodNever",(W,Q)=>{BL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>_Y(W,X,Y,G)});Lz=i("ZodDate",(W,Q)=>{FL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>xY(W,Y,G,B),W.min=(Y,G)=>W.check(q6(Y,G)),W.max=(Y,G)=>W.check(M5(Y,G));let X=W._zod.bag;W.minDate=X.minimum?new Date(X.minimum):null,W.maxDate=X.maximum?new Date(X.maximum):null}),IA=i("ZodArray",(W,Q)=>{LL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>cY(W,X,Y,G),W.element=Q.element,KW(W,"ZodArray",{min(X,Y){return this.check(x4(X,Y))},nonempty(X){return this.check(x4(1,X))},max(X,Y){return this.check(DQ(X,Y))},length(X,Y){return this.check(MQ(X,Y))},unwrap(){return this.element}})});Jz=i("ZodObject",(W,Q)=>{KL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>pY(W,X,Y,G),y0.defineLazy(W,"shape",()=>{return Q.shape}),KW(W,"ZodObject",{keyof(){return J0(Object.keys(this._zod.def.shape))},catchall(X){return this.clone({...this._zod.def,catchall:X})},passthrough(){return this.clone({...this._zod.def,catchall:X0()})},loose(){return this.clone({...this._zod.def,catchall:X0()})},strict(){return this.clone({...this._zod.def,catchall:EA()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(X){return y0.extend(this,X)},safeExtend(X){return y0.safeExtend(this,X)},merge(X){return y0.merge(this,X)},pick(X){return y0.pick(this,X)},omit(X){return y0.omit(this,X)},partial(...X){return y0.partial(Hz,this,X[0])},required(...X){return y0.required($z,this,X[0])}})});zz=i("ZodUnion",(W,Q)=>{KY.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>dY(W,X,Y,G),W.options=Q.options});TA=i("ZodDiscriminatedUnion",(W,Q)=>{zz.init(W,Q),ZL.init(W,Q)});RA=i("ZodIntersection",(W,Q)=>{HL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>iY(W,X,Y,G)});PA=i("ZodTuple",(W,Q)=>{$L.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>nY(W,X,Y,G),W.rest=(X)=>W.clone({...W._zod.def,rest:X})});eJ=i("ZodRecord",(W,Q)=>{UL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>rY(W,X,Y,G),W.keyType=Q.keyType,W.valueType=Q.valueType});HG=i("ZodEnum",(W,Q)=>{AL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>hY(W,Y,G,B),W.enum=Q.entries,W.options=Object.values(Q.entries);let X=new Set(Object.keys(Q.entries));W.extract=(Y,G)=>{let B={};for(let F of Y)if(X.has(F))B[F]=Q.entries[F];else throw Error(`Key ${F} not found in enum`);return new HG({...Q,checks:[],...y0.normalizeParams(G),entries:B})},W.exclude=(Y,G)=>{let B={...Q.entries};for(let F of Y)if(X.has(F))delete B[F];else throw Error(`Key ${F} not found in enum`);return new HG({...Q,checks:[],...y0.normalizeParams(G),entries:B})}});bA=i("ZodLiteral",(W,Q)=>{NL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>uY(W,X,Y,G),W.values=new Set(Q.values),Object.defineProperty(W,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});SA=i("ZodTransform",(W,Q)=>{VL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>mY(W,X,Y,G),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")throw new o9(W.constructor.name);X.addIssue=(B)=>{if(typeof B==="string")X.issues.push(y0.issue(B,X.value,Q));else{let F=B;if(F.fatal)F.continue=!1;F.code??(F.code="custom"),F.input??(F.input=X.value),F.inst??(F.inst=W),X.issues.push(y0.issue(F))}};let G=Q.transform(X.value,X);if(G instanceof Promise)return G.then((B)=>{return X.value=B,X.fallback=!0,X});return X.value=G,X.fallback=!0,X}});Hz=i("ZodOptional",(W,Q)=>{ZY.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>OQ(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});qA=i("ZodExactOptional",(W,Q)=>{wL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>OQ(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});kA=i("ZodNullable",(W,Q)=>{DL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>oY(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});vA=i("ZodDefault",(W,Q)=>{ML.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>sY(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType,W.removeDefault=W.unwrap});_A=i("ZodPrefault",(W,Q)=>{jL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>tY(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});$z=i("ZodNonOptional",(W,Q)=>{OL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>aY(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});xA=i("ZodCatch",(W,Q)=>{EL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>eY(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType,W.removeCatch=W.unwrap});Uz=i("ZodPipe",(W,Q)=>{HY.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>WG(W,X,Y,G),W.in=Q.in,W.out=Q.out});uA=i("ZodPreprocess",(W,Q)=>{Uz.init(W,Q),IL.init(W,Q)}),lA=i("ZodReadonly",(W,Q)=>{TL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>QG(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});cA=i("ZodLazy",(W,Q)=>{RL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>XG(W,X,Y,G),W.unwrap=()=>W._zod.def.getter()});pA=i("ZodCustom",(W,Q)=>{PL.init(W,Q),p0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>lY(W,X,Y,G)})});var Nz,Az;var Vz=H0(()=>{Nz={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(W){})(Az||(Az={}))});var PQ={};xX(PQ,{string:()=>nA,number:()=>rA,date:()=>sA,boolean:()=>oA,bigint:()=>aA});function nA(W){return _L($G,W)}function rA(W){return FJ(RQ,W)}function oA(W){return zJ(UG,W)}function aA(W){return KJ(Bz,W)}function sA(W){return AJ(Lz,W)}var wz=H0(()=>{e1();EQ()});var Dz=H0(()=>{e1();e1();SL();e1();YG();UY();zG();wz();EQ();GG();KG();ZG();Vz();q1($Y())});var Mz=H0(()=>{Dz()});var m4=H0(()=>{Mz()});var E5="2025-11-25",L4,c4="io.modelcontextprotocol/related-task",i1="io.modelcontextprotocol/protocolVersion",y6="io.modelcontextprotocol/clientInfo",N1="io.modelcontextprotocol/serverInfo",S1="io.modelcontextprotocol/clientCapabilities",x5="io.modelcontextprotocol/subscriptionId",n1="io.modelcontextprotocol/logLevel",I5="2.0",l6,t0,HW,J4,z4,p4,d4,K4,Y1,T5,e0,J1,z1,Z4,W1,m6,h5,u5,R5,P5,b5,$W,H4,i4,$4,n4,c6,v6,l5,tA,eA,r4,o4,a4,s4,t4,U4,e4,W8,Q8,S5,A4,X8,Y8,N4,G8,p6,d6,V4,w4,NG,D4,i6,_6,M4,B8,F8,L8,J8,z8,m5,K8,Z8,H8,$8,U8,A8,N8,V8,j4,w8,D8,M8,j8,O8,E8,I8,T8,R8,P8,b8,S8,q8,C8,c5,p5,d5,k8,v8,y8,i5,_8,g8,f8,x8,h8,O4,u8,l8,E4,UW,m8,c8,p8,I4,n6,d8,i8,n8,r8,o8,a8,s8,t8,e8,O5,W9,Q9,X9,Y9,G9,n5,r6,o6,r5,o5,a5,B9,s5,t5,F9,L9,e5,a6,J9,z9,K9,Z9,H9,$9,U9,A9,N9,V9,w9,D9,M9,j9,O9,AW,E9,s6,NW,I9,VW,wW,DW,MW,jW,OW,EW,IW,TW,RW,PW,bW,SW,qW,CW,L1,T9,T4,R9,P9,b9,S9,q9,AG,C9,k9,v9,kW,vW;var jz=H0(()=>{m4();L4=[E5,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],l6=f5(()=>a([$(),m(),o(),C6(),n($(),l6),f(l6)])),t0=n($(),l6),HW=f(l6),J4=a([$(),m().int()]),z4=$(),p4=q({ttl:m().optional()}),d4=q({taskId:$()}),K4=B0({progressToken:J4.optional(),[c4]:d4.optional()}),Y1=q({_meta:K4.optional()}),T5=Y1.extend({task:p4.optional()}),e0=q({method:$(),params:Y1.loose().optional()}),J1=q({_meta:K4.optional()}),z1=q({method:$(),params:J1.loose().optional()}),Z4=B0({get[N1](){return l5.optional().catch(void 0)}}),W1=B0({_meta:Z4.optional()}),m6=a([$(),m().int()]),h5=q({jsonrpc:g(I5),id:m6,...e0.shape}).strict(),u5=q({jsonrpc:g(I5),...z1.shape}).strict(),R5=q({jsonrpc:g(I5),id:m6,result:W1}).strict(),P5=q({jsonrpc:g(I5),id:m6.optional(),error:q({code:m().int(),message:$(),data:X0().optional()})}).strict(),b5=a([h5,u5,R5,P5]),$W=a([R5,P5]),H4=W1.strict(),i4=J1.extend({requestId:m6.optional(),reason:$().optional()}),$4=z1.extend({method:g("notifications/cancelled"),params:i4}),n4=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),c6=q({icons:f(n4).optional()}),v6=q({name:$(),title:$().optional()}),l5=v6.extend({...v6.shape,...c6.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),tA=C1(q({applyDefaults:o().optional()}),t0),eA=k6((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)&&Object.keys(W).length===0)return{form:{}};return W},C1(q({form:tA.optional(),url:t0.optional()}),t0.optional())),r4=B0({list:t0.optional(),cancel:t0.optional(),requests:B0({sampling:B0({createMessage:t0.optional()}).optional(),elicitation:B0({create:t0.optional()}).optional()}).optional()}),o4=B0({list:t0.optional(),cancel:t0.optional(),requests:B0({tools:B0({call:t0.optional()}).optional()}).optional()}),a4=q({experimental:n($(),t0).optional(),sampling:q({context:t0.optional(),tools:t0.optional()}).optional(),elicitation:eA.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:r4.optional(),extensions:n($(),t0).optional()}),s4=Y1.extend({protocolVersion:$(),capabilities:a4,clientInfo:l5}),t4=e0.extend({method:g("initialize"),params:s4}),U4=q({experimental:n($(),t0).optional(),logging:t0.optional(),completions:t0.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:o4.optional(),extensions:n($(),t0).optional()}),e4=W1.extend({protocolVersion:$(),capabilities:U4,serverInfo:l5,instructions:$().optional()}),W8=z1.extend({method:g("notifications/initialized"),params:J1.optional()}),Q8=e0.extend({method:g("server/discover"),params:Y1.optional()}),S5=W1.extend({supportedVersions:f($()),capabilities:U4,instructions:$().optional()}),A4=e0.extend({method:g("ping"),params:Y1.optional()}),X8=q({progress:m(),total:W0(m()),message:W0($())}),Y8=q({...J1.shape,...X8.shape,progressToken:J4}),N4=z1.extend({method:g("notifications/progress"),params:Y8}),G8=Y1.extend({cursor:z4.optional()}),p6=e0.extend({params:G8.optional()}),d6=W1.extend({nextCursor:z4.optional()}),V4=q({uri:$(),mimeType:W0($()),_meta:n($(),X0()).optional()}),w4=V4.extend({text:$()}),NG=$().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),D4=V4.extend({blob:NG}),i6=J0(["user","assistant"]),_6=q({audience:f(i6).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),M4=q({...v6.shape,...c6.shape,uri:$(),description:W0($()),mimeType:W0($()),size:W0(m()),annotations:_6.optional(),_meta:W0(B0({}))}),B8=q({...v6.shape,...c6.shape,uriTemplate:$(),description:W0($()),mimeType:W0($()),annotations:_6.optional(),_meta:W0(B0({}))}),F8=p6.extend({method:g("resources/list")}),L8=d6.extend({resources:f(M4)}),J8=p6.extend({method:g("resources/templates/list")}),z8=d6.extend({resourceTemplates:f(B8)}),m5=Y1.extend({uri:$()}),K8=m5,Z8=e0.extend({method:g("resources/read"),params:K8}),H8=W1.extend({contents:f(a([w4,D4]))}),$8=z1.extend({method:g("notifications/resources/list_changed"),params:J1.optional()}),U8=m5,A8=e0.extend({method:g("resources/subscribe"),params:U8}),N8=m5,V8=e0.extend({method:g("resources/unsubscribe"),params:N8}),j4=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f($()).optional()}),w8=Y1.extend({notifications:j4}),D8=e0.extend({method:g("subscriptions/listen"),params:w8}),M8=J1.extend({notifications:j4}),j8=z1.extend({method:g("notifications/subscriptions/acknowledged"),params:M8}),O8=Z4.extend({[x5]:m6}),E8=W1.extend({_meta:O8}),I8=J1.extend({uri:$()}),T8=z1.extend({method:g("notifications/resources/updated"),params:I8}),R8=q({name:$(),description:W0($()),required:W0(o())}),P8=q({...v6.shape,...c6.shape,description:W0($()),arguments:W0(f(R8)),_meta:W0(B0({}))}),b8=p6.extend({method:g("prompts/list")}),S8=d6.extend({prompts:f(P8)}),q8=Y1.extend({name:$(),arguments:n($(),$()).optional()}),C8=e0.extend({method:g("prompts/get"),params:q8}),c5=q({type:g("text"),text:$(),annotations:_6.optional(),_meta:n($(),X0()).optional()}),p5=q({type:g("image"),data:NG,mimeType:$(),annotations:_6.optional(),_meta:n($(),X0()).optional()}),d5=q({type:g("audio"),data:NG,mimeType:$(),annotations:_6.optional(),_meta:n($(),X0()).optional()}),k8=q({type:g("tool_use"),name:$(),id:$(),input:n($(),X0()),_meta:n($(),X0()).optional()}),v8=q({type:g("resource"),resource:a([w4,D4]),annotations:_6.optional(),_meta:n($(),X0()).optional()}),y8=M4.extend({type:g("resource_link")}),i5=a([c5,p5,d5,y8,v8]),_8=q({role:i6,content:i5}),g8=W1.extend({description:$().optional(),messages:f(_8)}),f8=z1.extend({method:g("notifications/prompts/list_changed"),params:J1.optional()}),x8=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),h8=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),O4=q({...v6.shape,...c6.shape,description:$().optional(),inputSchema:q({type:g("object"),properties:n($(),l6).optional(),required:f($()).optional()}).catchall(X0()),outputSchema:B0({$schema:$().optional()}).optional(),annotations:x8.optional(),execution:h8.optional(),_meta:n($(),X0()).optional()}),u8=p6.extend({method:g("tools/list")}),l8=d6.extend({tools:f(O4)}),E4=W1.extend({content:f(i5).default([]),structuredContent:X0().optional(),isError:o().optional()}),UW=E4.or(W1.extend({toolResult:X0()})),m8=T5.extend({name:$(),arguments:n($(),X0()).optional()}),c8=e0.extend({method:g("tools/call"),params:m8}),p8=z1.extend({method:g("notifications/tools/list_changed"),params:J1.optional()}),I4=q({autoRefresh:o().default(!0),debounceMs:m().int().nonnegative().default(300)}),n6=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),d8=Y1.extend({level:n6}),i8=e0.extend({method:g("logging/setLevel"),params:d8}),n8=J1.extend({level:n6,logger:$().optional(),data:X0()}),r8=z1.extend({method:g("notifications/message"),params:n8}),o8=q({name:$().optional()}),a8=q({hints:f(o8).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),s8=q({mode:J0(["auto","required","none"]).optional()}),t8=q({type:g("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:f(i5),structuredContent:X0().optional(),isError:o().optional(),_meta:n($(),X0()).optional()}),e8=j5("type",[c5,p5,d5]),O5=j5("type",[c5,p5,d5,k8,t8]),W9=q({role:i6,content:a([O5,f(O5)]),_meta:n($(),X0()).optional()}),Q9=T5.extend({messages:f(W9),modelPreferences:a8.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:t0.optional(),tools:f(O4).optional(),toolChoice:s8.optional()}),X9=e0.extend({method:g("sampling/createMessage"),params:Q9}),Y9=W1.extend({model:$(),stopReason:W0(J0(["endTurn","stopSequence","maxTokens"]).or($())),role:i6,content:e8}),G9=W1.extend({model:$(),stopReason:W0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:i6,content:a([O5,f(O5)])}),n5=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),r6=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),o6=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),r5=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),o5=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),a5=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),B9=a([r5,o5]),s5=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),t5=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),F9=a([s5,t5]),L9=a([a5,B9,F9]),e5=a([L9,n5,r6,o6]),a6=T5.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),e5),required:f($()).optional()}).catchall(X0())}),J9=T5.extend({mode:g("url"),message:$(),elicitationId:$(),url:$().url()}),z9=a([a6,J9]),K9=e0.extend({method:g("elicitation/create"),params:z9}),Z9=J1.extend({elicitationId:$()}),H9=z1.extend({method:g("notifications/elicitation/complete"),params:Z9}),$9=W1.extend({action:J0(["accept","decline","cancel"]),content:k6((W)=>W===null?void 0:W,n($(),a([$(),m(),o(),f($())])).optional())}),U9=q({type:g("ref/resource"),uri:$()}),A9=q({type:g("ref/prompt"),name:$()}),N9=Y1.extend({ref:a([A9,U9]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()}),V9=e0.extend({method:g("completion/complete"),params:N9}),w9=W1.extend({completion:B0({values:f($()).max(100),total:W0(m().int()),hasMore:W0(o())})}),D9=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),X0()).optional()}),M9=e0.extend({method:g("roots/list"),params:Y1.optional()}),j9=W1.extend({roots:f(D9)}),O9=z1.extend({method:g("notifications/roots/list_changed"),params:J1.optional()}),AW=B0({ttl:m().optional(),pollInterval:m().optional()}),E9=J0(["working","input_required","completed","failed","cancelled"]),s6=q({taskId:$(),status:E9,ttl:a([m(),C6()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:W0(m()),statusMessage:W0($())}),NW=W1.extend({task:s6}),I9=J1.merge(s6),VW=z1.extend({method:g("notifications/tasks/status"),params:I9}),wW=e0.extend({method:g("tasks/get"),params:Y1.extend({taskId:$()})}),DW=W1.merge(s6),MW=e0.extend({method:g("tasks/result"),params:Y1.extend({taskId:$()})}),jW=W1.loose(),OW=p6.extend({method:g("tasks/list")}),EW=d6.extend({tasks:f(s6)}),IW=e0.extend({method:g("tasks/cancel"),params:Y1.extend({taskId:$()})}),TW=W1.merge(s6),RW=a([A4,t4,Q8,V9,i8,C8,b8,F8,J8,Z8,A8,V8,D8,c8,u8]),PW=a([$4,N4,W8,O9]),bW=a([H4,Y9,G9,$9,j9]),SW=a([A4,X9,K9,M9]),qW=a([$4,N4,r8,T8,$8,p8,f8,j8,H9]),CW=a([H4,e4,S5,w9,g8,S8,L8,z8,H8,E4,l8,E8]),L1=l4().superRefine((W,Q)=>{if(!URL.canParse(W))return Q.addIssue({code:Nz.custom,message:"URL must be parseable",fatal:!0}),uX}).refine((W)=>{let Q=new URL(W);return Q.protocol!=="javascript:"&&Q.protocol!=="data:"&&Q.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),T9=B0({resource:$().url(),authorization_servers:f(L1).optional(),jwks_uri:$().url().optional(),scopes_supported:f($()).optional(),bearer_methods_supported:f($()).optional(),resource_signing_alg_values_supported:f($()).optional(),resource_name:$().optional(),resource_documentation:$().optional(),resource_policy_uri:$().url().optional(),resource_tos_uri:$().url().optional(),tls_client_certificate_bound_access_tokens:o().optional(),authorization_details_types_supported:f($()).optional(),dpop_signing_alg_values_supported:f($()).optional(),dpop_bound_access_tokens_required:o().optional()}),T4=B0({issuer:$(),authorization_endpoint:L1,token_endpoint:L1,registration_endpoint:L1.optional(),scopes_supported:f($()).optional(),response_types_supported:f($()),response_modes_supported:f($()).optional(),grant_types_supported:f($()).optional(),token_endpoint_auth_methods_supported:f($()).optional(),token_endpoint_auth_signing_alg_values_supported:f($()).optional(),service_documentation:L1.optional(),revocation_endpoint:L1.optional(),revocation_endpoint_auth_methods_supported:f($()).optional(),revocation_endpoint_auth_signing_alg_values_supported:f($()).optional(),introspection_endpoint:$().optional(),introspection_endpoint_auth_methods_supported:f($()).optional(),introspection_endpoint_auth_signing_alg_values_supported:f($()).optional(),code_challenge_methods_supported:f($()).optional(),client_id_metadata_document_supported:o().optional(),authorization_response_iss_parameter_supported:o().optional().catch(void 0)}),R9=B0({issuer:$(),authorization_endpoint:L1,token_endpoint:L1,userinfo_endpoint:L1.optional(),jwks_uri:L1,registration_endpoint:L1.optional(),scopes_supported:f($()).optional(),response_types_supported:f($()),response_modes_supported:f($()).optional(),grant_types_supported:f($()).optional(),acr_values_supported:f($()).optional(),subject_types_supported:f($()),id_token_signing_alg_values_supported:f($()),id_token_encryption_alg_values_supported:f($()).optional(),id_token_encryption_enc_values_supported:f($()).optional(),userinfo_signing_alg_values_supported:f($()).optional(),userinfo_encryption_alg_values_supported:f($()).optional(),userinfo_encryption_enc_values_supported:f($()).optional(),request_object_signing_alg_values_supported:f($()).optional(),request_object_encryption_alg_values_supported:f($()).optional(),request_object_encryption_enc_values_supported:f($()).optional(),token_endpoint_auth_methods_supported:f($()).optional(),token_endpoint_auth_signing_alg_values_supported:f($()).optional(),display_values_supported:f($()).optional(),claim_types_supported:f($()).optional(),claims_supported:f($()).optional(),service_documentation:$().optional(),claims_locales_supported:f($()).optional(),ui_locales_supported:f($()).optional(),claims_parameter_supported:o().optional(),request_parameter_supported:o().optional(),request_uri_parameter_supported:o().optional(),require_request_uri_registration:o().optional(),op_policy_uri:L1.optional(),op_tos_uri:L1.optional(),client_id_metadata_document_supported:o().optional(),authorization_response_iss_parameter_supported:o().optional().catch(void 0)}),P9=q({...R9.shape,...T4.pick({code_challenge_methods_supported:!0}).shape}),b9=q({access_token:$(),id_token:$().optional(),token_type:$(),expires_in:PQ.number().optional(),scope:$().optional(),refresh_token:$().optional()}).strip(),S9=q({issued_token_type:g("urn:ietf:params:oauth:token-type:id-jag"),access_token:$(),token_type:$().optional(),expires_in:m().optional(),scope:$().optional()}).strip(),q9=q({error:$(),error_description:$().optional(),error_uri:$().optional()}),AG=L1.optional().or(g("").transform(()=>{return})),C9=q({redirect_uris:f(L1),token_endpoint_auth_method:$().optional(),grant_types:f($()).optional(),response_types:f($()).optional(),application_type:$().optional(),client_name:$().optional(),client_uri:L1.optional(),logo_uri:AG,scope:$().optional(),contacts:f($()).optional(),tos_uri:AG,policy_uri:$().optional(),jwks_uri:L1.optional(),jwks:Fz().optional(),software_id:$().optional(),software_version:$().optional(),software_statement:$().optional()}).strip(),k9=q({client_id:$(),client_secret:$().optional(),client_id_issued_at:m().optional(),client_secret_expires_at:m().optional()}).strip(),v9=C9.merge(k9),kW=q({error:$(),error_description:$().optional()}).strip(),vW=q({token:$(),token_type_hint:$().optional()}).strip()});var VG=H0(()=>{jz()});function RG(W,Q){let X=new Set,Y=Q;while(typeof Y==="function"){let G=Y.mcpBrand;if(Object.prototype.hasOwnProperty.call(Y,"mcpBrand")&&typeof G==="string")X.add(G);Y=Object.getPrototypeOf(Y)}if(X.size===0)return;Object.defineProperty(W,jG,{value:X,enumerable:!1,configurable:!0})}function _9(W,Q){try{if(typeof Q==="object"&&Q!==null&&Object.prototype.hasOwnProperty.call(W,"mcpBrand")&&typeof W.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(Q,jG)){let X=Q[jG];if(X&&typeof X.has==="function"&&X.has(W.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(W,Q)}function Oz(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function XN(W,Q,X){return W==="elicitation"&&Q==="form"&&X.form===void 0&&X.url===void 0}function vz(W){switch(W.method){case"elicitation/create":if(W.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let Q=W.params;if(Q!==void 0&&(Q.tools!==void 0||Q.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function cQ(W,Q){let X={};for(let[Y,G]of Object.entries(W)){if(G===void 0)continue;let B=Q===void 0?void 0:Q[Y];if(B===void 0){X[Y]=G;continue}if(Oz(G)&&Oz(B)){let F={};for(let[L,J]of Object.entries(G))if(J!==void 0&&B[L]===void 0&&!XN(Y,L,B))F[L]=J;if(Object.keys(F).length>0)X[Y]=F}}return Object.keys(X).length>0?X:void 0}function hW(W){return W>=YN}function yz(W){return W.filter((Q)=>!hW(Q))}function PG(W){return W.filter((Q)=>hW(Q))}function _z(W){let Q=W.structuredContent;if(Q===void 0)return W;if(!(typeof Q!=="object"||Q===null||Array.isArray(Q)))return W;if(W.content?.some((X)=>X.type==="text")??!1)return W;return{...W,content:[...W.content??[],{type:"text",text:JSON.stringify(Q)}]}}function bG(W){if(W===null||typeof W!=="object"||Array.isArray(W)||W.content!==void 0||gz.some((Q)=>(Q in W)))return W;return{...W,content:[]}}function GN(){let W=f5(()=>a([$(),m(),o(),C6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=q({ttl:m().optional()}),B=q({taskId:$()}),F=B0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":B.optional()}),L=q({_meta:F.optional()}),J=L.extend({task:G.optional()}),z=q({method:$(),params:L.loose().optional()}),K=q({_meta:F.optional()}),H=q({method:$(),params:K.loose().optional()}),D=B0({_meta:F.optional()}),I=a([$(),m().int()]),A=D.strict(),M=K.extend({requestId:I.optional(),reason:$().optional()}),N=H.extend({method:g("notifications/cancelled"),params:M}),Z=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),V=q({icons:f(Z).optional()}),U=q({name:$(),title:$().optional()}),j=U.extend({...U.shape,...V.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),T=C1(q({applyDefaults:o().optional()}),Q),O=k6((x0)=>{if(x0&&typeof x0==="object"&&!Array.isArray(x0)&&Object.keys(x0).length===0)return{form:{}};return x0},C1(q({form:T.optional(),url:Q.optional()}),Q.optional())),w=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({sampling:B0({createMessage:Q.optional()}).optional(),elicitation:B0({create:Q.optional()}).optional()}).optional()}),R=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({tools:B0({call:Q.optional()}).optional()}).optional()}),k=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:O.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:w.optional(),extensions:n($(),Q).optional()}),l=L.extend({protocolVersion:$(),capabilities:k,clientInfo:j}),_=z.extend({method:g("initialize"),params:l}),h=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:R.optional(),extensions:n($(),Q).optional()}),d=D.extend({protocolVersion:$(),capabilities:h,serverInfo:j,instructions:$().optional()}),p=H.extend({method:g("notifications/initialized"),params:K.optional()}),z0=z.extend({method:g("ping"),params:L.optional()}),M0=q({progress:m(),total:W0(m()),message:W0($())}),V0=q({...K.shape,...M0.shape,progressToken:X}),P0=H.extend({method:g("notifications/progress"),params:V0}),Z0=L.extend({cursor:Y.optional()}),S=z.extend({params:Z0.optional()}),v=D.extend({nextCursor:Y.optional()}),u=q({uri:$(),mimeType:W0($()),_meta:n($(),X0()).optional()}),E=u.extend({text:$()}),b=$().refine((x0)=>{try{return atob(x0),!0}catch{return!1}},{message:"Invalid Base64 string"}),C=u.extend({blob:b}),c=J0(["user","assistant"]),r=q({audience:f(c).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),L0=q({...U.shape,...V.shape,uri:$(),description:W0($()),mimeType:W0($()),size:W0(m()),annotations:r.optional(),_meta:W0(B0({}))}),e=q({...U.shape,...V.shape,uriTemplate:$(),description:W0($()),mimeType:W0($()),annotations:r.optional(),_meta:W0(B0({}))}),w0=S.extend({method:g("resources/list")}),h0=v.extend({resources:f(L0)}),P=S.extend({method:g("resources/templates/list")}),y=v.extend({resourceTemplates:f(e)}),x=L.extend({uri:$()}),s=x,t=z.extend({method:g("resources/read"),params:s}),F0=D.extend({contents:f(a([E,C]))}),T0=H.extend({method:g("notifications/resources/list_changed"),params:K.optional()}),q0=x,g0=z.extend({method:g("resources/subscribe"),params:q0}),b0=x,j0=z.extend({method:g("resources/unsubscribe"),params:b0}),r0=K.extend({uri:$()}),C0=H.extend({method:g("notifications/resources/updated"),params:r0}),G1=q({name:$(),description:W0($()),required:W0(o())}),Q1=q({...U.shape,...V.shape,description:W0($()),arguments:W0(f(G1)),_meta:W0(B0({}))}),B1=S.extend({method:g("prompts/list")}),K1=v.extend({prompts:f(Q1)}),Z1=L.extend({name:$(),arguments:n($(),$()).optional()}),V1=z.extend({method:g("prompts/get"),params:Z1}),w1=q({type:g("text"),text:$(),annotations:r.optional(),_meta:n($(),X0()).optional()}),D1=q({type:g("image"),data:b,mimeType:$(),annotations:r.optional(),_meta:n($(),X0()).optional()}),M1=q({type:g("audio"),data:b,mimeType:$(),annotations:r.optional(),_meta:n($(),X0()).optional()}),Q6=q({type:g("tool_use"),name:$(),id:$(),input:n($(),X0()),_meta:n($(),X0()).optional()}),H1=q({type:g("resource"),resource:a([E,C]),annotations:r.optional(),_meta:n($(),X0()).optional()}),X6=L0.extend({type:g("resource_link")}),o0=a([w1,D1,M1,X6,H1]),v1=q({role:c,content:o0}),y1=D.extend({description:$().optional(),messages:f(v1)}),j1=H.extend({method:g("notifications/prompts/list_changed"),params:K.optional()}),Y6=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),_1=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),O1=q({...U.shape,...V.shape,description:$().optional(),inputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(X0()),outputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(X0()).optional(),annotations:Y6.optional(),execution:_1.optional(),_meta:n($(),X0()).optional()}),g1=S.extend({method:g("tools/list")}),f1=v.extend({tools:f(O1)}),x1=D.extend({content:f(o0),structuredContent:n($(),X0()).optional(),isError:o().optional()}),f0=J.extend({name:$(),arguments:n($(),X0()).optional()}),G6=z.extend({method:g("tools/call"),params:f0}),e6=H.extend({method:g("notifications/tools/list_changed"),params:K.optional()}),h1=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),B6=L.extend({level:h1}),F6=z.extend({method:g("logging/setLevel"),params:B6}),L6=K.extend({level:h1,logger:$().optional(),data:X0()}),J6=H.extend({method:g("notifications/message"),params:L6}),z6=q({name:$().optional()}),K6=q({hints:f(z6).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),Z6=q({mode:J0(["auto","required","none"]).optional()}),W5=q({type:g("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:f(o0),structuredContent:q({}).loose().optional(),isError:o().optional(),_meta:n($(),X0()).optional()}),H6=j5("type",[w1,D1,M1]),$1=j5("type",[w1,D1,M1,Q6,W5]),$6=q({role:c,content:a([$1,f($1)]),_meta:n($(),X0()).optional()}),U6=J.extend({messages:f($6),modelPreferences:K6.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(O1).optional(),toolChoice:Z6.optional()}),A6=z.extend({method:g("sampling/createMessage"),params:U6}),N6=D.extend({model:$(),stopReason:W0(J0(["endTurn","stopSequence","maxTokens"]).or($())),role:c,content:H6}),V6=D.extend({model:$(),stopReason:W0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:c,content:a([$1,f($1)])}),w6=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),D6=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),M6=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),j6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),O6=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),E6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),I6=a([j6,O6]),E1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),I1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),Q5=a([E1,I1]),X5=a([E6,I6,Q5]),d0=a([X5,w6,D6,M6]),i0=J.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),d0),required:f($()).optional()}).catchall(X0())}),T6=J.extend({mode:g("url"),message:$(),elicitationId:$(),url:$().url()}),X1=a([i0,T6]),Y5=z.extend({method:g("elicitation/create"),params:X1}),G5=K.extend({elicitationId:$()}),B5=H.extend({method:g("notifications/elicitation/complete"),params:G5}),F5=D.extend({action:J0(["accept","decline","cancel"]),content:k6((x0)=>x0===null?void 0:x0,n($(),a([$(),m(),o(),f($())])).optional())}),L5=q({type:g("ref/resource"),uri:$()}),J5=q({type:g("ref/prompt"),name:$()}),z5=L.extend({ref:a([J5,L5]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()}),R6=z.extend({method:g("completion/complete"),params:z5}),K5=D.extend({completion:B0({values:f($()).max(100),total:W0(m().int()),hasMore:W0(o())})}),Z5=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),X0()).optional()}),u1=z.extend({method:g("roots/list"),params:L.optional()}),P6=D.extend({roots:f(Z5)}),H5=H.extend({method:g("notifications/roots/list_changed"),params:K.optional()}),$5=B0({ttl:m().optional(),pollInterval:m().optional()}),U5=J0(["working","input_required","completed","failed","cancelled"]),U1=q({taskId:$(),status:U5,ttl:a([m(),C6()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:W0(m()),statusMessage:W0($())}),m0=D.extend({task:U1}),A5=K.merge(U1),T1=H.extend({method:g("notifications/tasks/status"),params:A5}),l1=z.extend({method:g("tasks/get"),params:L.extend({taskId:$()})}),m1=D.merge(U1),c1=z.extend({method:g("tasks/result"),params:L.extend({taskId:$()})}),Y4=D.loose(),c0=S.extend({method:g("tasks/list")}),R0=v.extend({tasks:f(U1)}),R1=z.extend({method:g("tasks/cancel"),params:L.extend({taskId:$()})});return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,TaskMetadataSchema:G,RelatedTaskMetadataSchema:B,RequestMetaSchema:F,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:J,RequestSchema:z,NotificationsParamsSchema:K,NotificationSchema:H,ResultSchema:D,RequestIdSchema:I,EmptyResultSchema:A,CancelledNotificationParamsSchema:M,CancelledNotificationSchema:N,IconSchema:Z,IconsSchema:V,BaseMetadataSchema:U,ImplementationSchema:j,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:l,InitializeRequestSchema:_,ServerCapabilitiesSchema:h,InitializeResultSchema:d,InitializedNotificationSchema:p,PingRequestSchema:z0,ProgressSchema:M0,ProgressNotificationParamsSchema:V0,ProgressNotificationSchema:P0,PaginatedRequestParamsSchema:Z0,PaginatedRequestSchema:S,PaginatedResultSchema:v,ResourceContentsSchema:u,TextResourceContentsSchema:E,BlobResourceContentsSchema:C,RoleSchema:c,AnnotationsSchema:r,ResourceSchema:L0,ResourceTemplateSchema:e,ListResourcesRequestSchema:w0,ListResourcesResultSchema:h0,ListResourceTemplatesRequestSchema:P,ListResourceTemplatesResultSchema:y,ResourceRequestParamsSchema:x,ReadResourceRequestParamsSchema:s,ReadResourceRequestSchema:t,ReadResourceResultSchema:F0,ResourceListChangedNotificationSchema:T0,SubscribeRequestParamsSchema:q0,SubscribeRequestSchema:g0,UnsubscribeRequestParamsSchema:b0,UnsubscribeRequestSchema:j0,ResourceUpdatedNotificationParamsSchema:r0,ResourceUpdatedNotificationSchema:C0,PromptArgumentSchema:G1,PromptSchema:Q1,ListPromptsRequestSchema:B1,ListPromptsResultSchema:K1,GetPromptRequestParamsSchema:Z1,GetPromptRequestSchema:V1,TextContentSchema:w1,ImageContentSchema:D1,AudioContentSchema:M1,ToolUseContentSchema:Q6,EmbeddedResourceSchema:H1,ResourceLinkSchema:X6,ContentBlockSchema:o0,PromptMessageSchema:v1,GetPromptResultSchema:y1,PromptListChangedNotificationSchema:j1,ToolAnnotationsSchema:Y6,ToolExecutionSchema:_1,ToolSchema:O1,ListToolsRequestSchema:g1,ListToolsResultSchema:f1,CallToolResultSchema:x1,CallToolRequestParamsSchema:f0,CallToolRequestSchema:G6,ToolListChangedNotificationSchema:e6,LoggingLevelSchema:h1,SetLevelRequestParamsSchema:B6,SetLevelRequestSchema:F6,LoggingMessageNotificationParamsSchema:L6,LoggingMessageNotificationSchema:J6,ModelHintSchema:z6,ModelPreferencesSchema:K6,ToolChoiceSchema:Z6,ToolResultContentSchema:W5,SamplingContentSchema:H6,SamplingMessageContentBlockSchema:$1,SamplingMessageSchema:$6,CreateMessageRequestParamsSchema:U6,CreateMessageRequestSchema:A6,CreateMessageResultSchema:N6,CreateMessageResultWithToolsSchema:V6,BooleanSchemaSchema:w6,StringSchemaSchema:D6,NumberSchemaSchema:M6,UntitledSingleSelectEnumSchemaSchema:j6,TitledSingleSelectEnumSchemaSchema:O6,LegacyTitledEnumSchemaSchema:E6,SingleSelectEnumSchemaSchema:I6,UntitledMultiSelectEnumSchemaSchema:E1,TitledMultiSelectEnumSchemaSchema:I1,MultiSelectEnumSchemaSchema:Q5,EnumSchemaSchema:X5,PrimitiveSchemaDefinitionSchema:d0,ElicitRequestFormParamsSchema:i0,ElicitRequestURLParamsSchema:T6,ElicitRequestParamsSchema:X1,ElicitRequestSchema:Y5,ElicitationCompleteNotificationParamsSchema:G5,ElicitationCompleteNotificationSchema:B5,ElicitResultSchema:F5,ResourceTemplateReferenceSchema:L5,PromptReferenceSchema:J5,CompleteRequestParamsSchema:z5,CompleteRequestSchema:R6,CompleteResultSchema:K5,RootSchema:Z5,ListRootsRequestSchema:u1,ListRootsResultSchema:P6,RootsListChangedNotificationSchema:H5,TaskCreationParamsSchema:$5,TaskStatusSchema:U5,TaskSchema:U1,CreateTaskResultSchema:m0,TaskStatusNotificationParamsSchema:A5,TaskStatusNotificationSchema:T1,GetTaskRequestSchema:l1,GetTaskResultSchema:m1,GetTaskPayloadRequestSchema:c1,GetTaskPayloadResultSchema:Y4,ListTasksRequestSchema:c0,ListTasksResultSchema:R0,CancelTaskRequestSchema:R1,CancelTaskResultSchema:D.merge(U1),ClientRequestSchema:a([z0,_,R6,F6,V1,B1,w0,P,t,g0,j0,G6,g1,l1,c1,c0,R1]),ClientNotificationSchema:a([N,P0,p,H5,T1]),ClientResultSchema:a([A,N6,V6,F5,P6,m1,R0,m0]),ServerRequestSchema:a([z0,A6,Y5,u1,l1,c1,c0,R1]),ServerNotificationSchema:a([N,P0,J6,C0,T0,e6,j1,T1,B5]),ServerResultSchema:a([A,d,K5,y1,K1,h0,y,F0,x1,f1,m1,R0,m0]),CallToolResultWireSchema:X0().superRefine((x0,gX)=>{if(typeof x0!=="object"||x0===null||Array.isArray(x0)||x0.content!==void 0)return;for(let r9 of gz)if(r9 in x0){gX.addIssue({code:"custom",message:`content is required when the body carries '${r9}' \u2014 another result family cannot default into an empty tools/call success`});return}}).transform(bG).pipe(x1)}}function fz(){return BN??=GN()}function xz(W){return W.type!=="object"}function JN(W){let Q=typeof W.$schema==="string"?W.$schema:void 0;if(W.$id!==void 0)return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:W},required:["result"]};let X=(Y,G)=>{if(Array.isArray(Y))return Y.map((F)=>X(F,!1));if(Y===null||typeof Y!=="object")return Y;if(!G&&Y.$id!==void 0)return Y;let B={};for(let[F,L]of Object.entries(Y))if(G)B[F]=X(L,!1);else if((F==="$ref"||F==="$dynamicRef")&&typeof L==="string")B[F]=L==="#"?"#/properties/result":L.startsWith("#/")?`#/properties/result${L.slice(1)}`:L;else if(FN.has(F))B[F]=L;else if(LN.has(F))B[F]=X(L,!0);else B[F]=X(L,!1);return B};return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:X(W,!1)},required:["result"]}}function SG(){if(fQ)return fQ;let W=fz();return fQ={requestSchemas:{ping:W.PingRequestSchema,initialize:W.InitializeRequestSchema,"completion/complete":W.CompleteRequestSchema,"logging/setLevel":W.SetLevelRequestSchema,"prompts/get":W.GetPromptRequestSchema,"prompts/list":W.ListPromptsRequestSchema,"resources/list":W.ListResourcesRequestSchema,"resources/templates/list":W.ListResourceTemplatesRequestSchema,"resources/read":W.ReadResourceRequestSchema,"resources/subscribe":W.SubscribeRequestSchema,"resources/unsubscribe":W.UnsubscribeRequestSchema,"tools/call":W.CallToolRequestSchema,"tools/list":W.ListToolsRequestSchema,"tasks/get":W.GetTaskRequestSchema,"tasks/result":W.GetTaskPayloadRequestSchema,"tasks/list":W.ListTasksRequestSchema,"tasks/cancel":W.CancelTaskRequestSchema,"sampling/createMessage":W.CreateMessageRequestSchema,"elicitation/create":W.ElicitRequestSchema,"roots/list":W.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":W.CancelledNotificationSchema,"notifications/progress":W.ProgressNotificationSchema,"notifications/initialized":W.InitializedNotificationSchema,"notifications/roots/list_changed":W.RootsListChangedNotificationSchema,"notifications/tasks/status":W.TaskStatusNotificationSchema,"notifications/message":W.LoggingMessageNotificationSchema,"notifications/resources/updated":W.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":W.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":W.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":W.PromptListChangedNotificationSchema,"notifications/elicitation/complete":W.ElicitationCompleteNotificationSchema},resultSchemas:{ping:W.EmptyResultSchema,initialize:W.InitializeResultSchema,"completion/complete":W.CompleteResultSchema,"logging/setLevel":W.EmptyResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"resources/subscribe":W.EmptyResultSchema,"resources/unsubscribe":W.EmptyResultSchema,"tools/call":W.CallToolResultWireSchema,"tools/list":W.ListToolsResultSchema,"sampling/createMessage":W.CreateMessageResultWithToolsSchema,"elicitation/create":W.ElicitResultSchema,"roots/list":W.ListRootsResultSchema}},fQ}function lz(W){return Object.prototype.hasOwnProperty.call(hz,W)}function mz(W){return Object.prototype.hasOwnProperty.call(uz,W)}function KN(W){return Object.prototype.hasOwnProperty.call(zN,W)}function ZN(W){return KN(W)?SG().resultSchemas[W]:void 0}function HN(W){return lz(W)?SG().requestSchemas[W]:void 0}function $N(W){return mz(W)?SG().notificationSchemas[W]:void 0}function OG(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function xQ(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function Iz(W){return OG(W)&&OG(W.outputSchema)&&xz(W.outputSchema)}function Tz(W){return W}function UN(){let W=f5(()=>a([$(),m(),o(),C6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=a([$(),m().int()]),B=J0(["user","assistant"]),F=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),L=$().refine((R0)=>{try{return atob(R0),!0}catch{return!1}},{message:"Invalid Base64 string"}),J=q({ttl:m().optional()}),z=q({taskId:$()}),K=B0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":z.optional()}),H=q({_meta:K.optional()}),D=H.extend({task:J.optional()}),I=q({_meta:K.optional()}),A=q({method:$(),params:I.loose().optional()}),M=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),N=q({icons:f(M).optional()}),Z=q({name:$(),title:$().optional()}),V=Z.extend({...Z.shape,...N.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),U=C1(q({applyDefaults:o().optional()}),Q),j=k6((R0)=>{if(R0&&typeof R0==="object"&&!Array.isArray(R0)&&Object.keys(R0).length===0)return{form:{}};return R0},C1(q({form:U.optional(),url:Q.optional()}),Q.optional())),T=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({sampling:B0({createMessage:Q.optional()}).optional(),elicitation:B0({create:Q.optional()}).optional()}).optional()}),O=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({tools:B0({call:Q.optional()}).optional()}).optional()}),w=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:j.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:T.optional(),extensions:n($(),Q).optional()}),R=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:O.optional(),extensions:n($(),Q).optional()}),k=q({progress:m(),total:W0(m()),message:W0($())}),l=q({...I.shape,...k.shape,progressToken:X}),_=A.extend({method:g("notifications/progress"),params:l}),h=I.extend({level:F,logger:$().optional(),data:X0()}),d=A.extend({method:g("notifications/message"),params:h}),p=q({uri:$(),mimeType:W0($()),_meta:n($(),X0()).optional()}),z0=p.extend({text:$()}),M0=p.extend({blob:L}),V0=q({audience:f(B).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),P0=q({...Z.shape,...N.shape,uri:$(),description:W0($()),mimeType:W0($()),size:W0(m()),annotations:V0.optional(),_meta:W0(B0({}))}),Z0=q({...Z.shape,...N.shape,uriTemplate:$(),description:W0($()),mimeType:W0($()),annotations:V0.optional(),_meta:W0(B0({}))}),S=A.extend({method:g("notifications/resources/list_changed"),params:I.optional()}),v=I.extend({uri:$()}),u=A.extend({method:g("notifications/resources/updated"),params:v}),E=q({name:$(),description:W0($()),required:W0(o())}),b=q({...Z.shape,...N.shape,description:W0($()),arguments:W0(f(E)),_meta:W0(B0({}))}),C=A.extend({method:g("notifications/prompts/list_changed"),params:I.optional()}),c=q({type:g("text"),text:$(),annotations:V0.optional(),_meta:n($(),X0()).optional()}),r=q({type:g("image"),data:L,mimeType:$(),annotations:V0.optional(),_meta:n($(),X0()).optional()}),L0=q({type:g("audio"),data:L,mimeType:$(),annotations:V0.optional(),_meta:n($(),X0()).optional()}),e=q({type:g("tool_use"),name:$(),id:$(),input:n($(),X0()),_meta:n($(),X0()).optional()}),w0=q({type:g("resource"),resource:a([z0,M0]),annotations:V0.optional(),_meta:n($(),X0()).optional()}),h0=P0.extend({type:g("resource_link")}),P=a([c,r,L0,h0,w0]),y=q({role:B,content:P}),x=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),s=A.extend({method:g("notifications/tools/list_changed"),params:I.optional()}),t=q({name:$().optional()}),F0=q({hints:f(t).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),T0=q({mode:J0(["auto","required","none"]).optional()}),q0=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),g0=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),b0=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),j0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),r0=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),C0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),G1=a([j0,r0]),Q1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),B1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),K1=a([Q1,B1]),Z1=a([C0,G1,K1]),V1=a([Z1,q0,g0,b0]),w1=D.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),V1),required:f($()).optional()}).catchall(X0())}),D1=q({type:g("ref/resource"),uri:$()}),M1=q({type:g("ref/prompt"),name:$()}),Q6=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),X0()).optional()}),H1=w.shape,X6=q({experimental:H1.experimental,sampling:H1.sampling,elicitation:H1.elicitation,roots:H1.roots,extensions:H1.extensions}),o0=R.shape,v1=q({experimental:o0.experimental,logging:o0.logging,completions:o0.completions,prompts:o0.prompts,resources:o0.resources,tools:o0.tools,extensions:o0.extensions}),y1=B0({progressToken:X.optional(),[i1]:$(),[y6]:V.optional(),[S1]:X6,[n1]:F.optional()}),j1=q({...Z.shape,...N.shape,description:$().optional(),inputSchema:B0({$schema:$().optional(),type:g("object")}),outputSchema:B0({$schema:$().optional()}).optional(),annotations:x.optional(),_meta:n($(),X0()).optional()}),Y6=q({type:g("tool_result"),toolUseId:$(),content:f(P),structuredContent:X0().optional(),isError:o().optional(),_meta:n($(),X0()).optional()}),_1=a([c,r,L0,e,Y6]),O1=q({role:B,content:a([_1,f(_1)]),_meta:n($(),X0()).optional()}),g1=$(),f1=B0({[N1]:V.optional().catch(void 0)}),x1=f1.optional();function f0(R0){return B0({_meta:x1,resultType:g1.default("complete"),...R0})}let G6=f0({}),e6=f0({nextCursor:Y.optional()}),h1=f0({content:f(P),structuredContent:X0().optional(),isError:o().optional()}),B6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(j1),nextCursor:Y.optional()}),F6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(b),nextCursor:Y.optional()}),L6=f0({description:$().optional(),messages:f(y)}),J6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(P0),nextCursor:Y.optional()}),z6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(Z0),nextCursor:Y.optional()}),K6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([z0,M0]))}),Z6=f0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),W5=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"])}),H6=f0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:v1,instructions:$().optional()}),$1=q({messages:f(O1),modelPreferences:F0.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(j1).optional(),toolChoice:T0.optional()}),$6=q({method:g("sampling/createMessage"),params:$1}),U6=q({method:g("roots/list"),params:q({_meta:n($(),X0()).optional()}).optional()}),A6=q({...O1.shape,model:$(),stopReason:$().optional()}),N6=q({roots:f(Q6)}),V6=q({action:J0(["accept","decline","cancel"]),content:n($(),a([$(),m(),o(),f($())])).optional()}),w6=q({mode:g("url"),message:$(),url:$().url()}),D6=a([w1,w6]),M6=q({method:g("elicitation/create"),params:D6}),j6=a([$6,U6,M6]),O6=a([A6,N6,V6]),E6=n($(),j6),I6=n($(),O6),E1=f0({inputRequests:E6.optional(),requestState:$().optional()}),I1={inputResponses:I6.optional(),requestState:$().optional()},Q5=q({_meta:y1,...I1}),X5=B0({progressToken:X.optional()});function d0(R0,R1){return q({method:g(R0),params:q({_meta:y1,...R1})})}function i0(R0,R1){return q({method:g(R0),params:q({_meta:X5.optional(),...R1}).optional()})}let T6={name:$(),arguments:n($(),X0()).optional(),...I1},X1={cursor:Y.optional()},Y5=d0("tools/call",T6),G5=d0("tools/list",X1),B5=d0("prompts/list",X1),F5=d0("prompts/get",{name:$(),arguments:n($(),$()).optional(),...I1}),L5=d0("resources/list",X1),J5=d0("resources/templates/list",X1),z5=d0("resources/read",{uri:$(),...I1}),R6={ref:a([M1,D1]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()},K5=d0("completion/complete",R6),Z5=d0("server/discover",{}),u1=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f($()).optional()}),P6={notifications:u1},H5=d0("subscriptions/listen",P6),$5=f1.extend({"io.modelcontextprotocol/subscriptionId":G}),U5=B0({_meta:$5,resultType:g1.default("complete")}),U1={"tools/call":i0("tools/call",T6),"tools/list":i0("tools/list",X1),"prompts/get":i0("prompts/get",{name:$(),arguments:n($(),$()).optional()}),"prompts/list":i0("prompts/list",X1),"resources/list":i0("resources/list",X1),"resources/templates/list":i0("resources/templates/list",X1),"resources/read":i0("resources/read",{uri:$()}),"completion/complete":i0("completion/complete",R6),"server/discover":i0("server/discover",{}),"subscriptions/listen":i0("subscriptions/listen",P6)};function m0(R0){return B0({_meta:x1,...R0})}let A5={"tools/call":m0({content:f(P),structuredContent:X0().optional(),isError:o().optional()}),"tools/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(j1),nextCursor:Y.optional()}),"prompts/get":m0({description:$().optional(),messages:f(y)}),"prompts/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(b),nextCursor:Y.optional()}),"resources/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(P0),nextCursor:Y.optional()}),"resources/templates/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(Z0),nextCursor:Y.optional()}),"resources/read":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([z0,M0]))}),"completion/complete":m0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),"server/discover":m0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:v1,instructions:$().optional()}),"subscriptions/listen":m0({})},T1=B0({"io.modelcontextprotocol/subscriptionId":G.optional()}),l1=q({method:g("notifications/subscriptions/acknowledged"),params:q({_meta:T1.optional(),notifications:u1})}),m1=q({_meta:T1.optional(),requestId:G,reason:$().optional()}),c1=q({method:g("notifications/cancelled"),params:m1}),Y4={"notifications/cancelled":c1,"notifications/progress":_,"notifications/message":d,"notifications/resources/updated":u,"notifications/resources/list_changed":S,"notifications/tools/list_changed":s,"notifications/prompts/list_changed":C,"notifications/subscriptions/acknowledged":l1},c0=(R0)=>q({jsonrpc:g("2.0"),id:a([$(),m().int()]),result:R0}).strict();return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,RequestIdSchema:G,RoleSchema:B,LoggingLevelSchema:F,TaskMetadataSchema:J,RelatedTaskMetadataSchema:z,RequestMetaSchema:K,BaseRequestParamsSchema:H,TaskAugmentedRequestParamsSchema:D,NotificationsParamsSchema:I,NotificationSchema:A,IconSchema:M,IconsSchema:N,BaseMetadataSchema:Z,ImplementationSchema:V,ClientTasksCapabilitySchema:T,ServerTasksCapabilitySchema:O,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:R,ProgressSchema:k,ProgressNotificationParamsSchema:l,ProgressNotificationSchema:_,LoggingMessageNotificationParamsSchema:h,LoggingMessageNotificationSchema:d,ResourceContentsSchema:p,TextResourceContentsSchema:z0,BlobResourceContentsSchema:M0,AnnotationsSchema:V0,ResourceSchema:P0,ResourceTemplateSchema:Z0,ResourceListChangedNotificationSchema:S,ResourceUpdatedNotificationParamsSchema:v,ResourceUpdatedNotificationSchema:u,PromptArgumentSchema:E,PromptSchema:b,PromptListChangedNotificationSchema:C,TextContentSchema:c,ImageContentSchema:r,AudioContentSchema:L0,ToolUseContentSchema:e,EmbeddedResourceSchema:w0,ResourceLinkSchema:h0,ContentBlockSchema:P,PromptMessageSchema:y,ToolAnnotationsSchema:x,ToolListChangedNotificationSchema:s,ModelHintSchema:t,ModelPreferencesSchema:F0,ToolChoiceSchema:T0,BooleanSchemaSchema:q0,StringSchemaSchema:g0,NumberSchemaSchema:b0,UntitledSingleSelectEnumSchemaSchema:j0,TitledSingleSelectEnumSchemaSchema:r0,LegacyTitledEnumSchemaSchema:C0,SingleSelectEnumSchemaSchema:G1,UntitledMultiSelectEnumSchemaSchema:Q1,TitledMultiSelectEnumSchemaSchema:B1,MultiSelectEnumSchemaSchema:K1,EnumSchemaSchema:Z1,PrimitiveSchemaDefinitionSchema:V1,ElicitRequestFormParamsSchema:w1,ResourceTemplateReferenceSchema:D1,PromptReferenceSchema:M1,RootSchema:Q6,ClientCapabilities2026Schema:X6,ServerCapabilities2026Schema:v1,RequestMetaEnvelopeSchema:y1,ToolSchema:j1,ToolResultContentSchema:Y6,SamplingMessageContentBlockSchema:_1,SamplingMessageSchema:O1,ResultTypeSchema:g1,ResultMetaSchema:f1,ResultSchema:G6,PaginatedResultSchema:e6,CallToolResultSchema:h1,ListToolsResultSchema:B6,ListPromptsResultSchema:F6,GetPromptResultSchema:L6,ListResourcesResultSchema:J6,ListResourceTemplatesResultSchema:z6,ReadResourceResultSchema:K6,CompleteResultSchema:Z6,CacheableResultSchema:W5,DiscoverResultSchema:H6,CreateMessageRequestParamsSchema:$1,CreateMessageRequestSchema:$6,ListRootsRequestSchema:U6,CreateMessageResultSchema:A6,ListRootsResultSchema:N6,ElicitResultSchema:V6,ElicitRequestURLParamsSchema:w6,ElicitRequestParamsSchema:D6,ElicitRequestSchema:M6,InputRequestSchema:j6,InputResponseSchema:O6,InputRequestsSchema:E6,InputResponsesSchema:I6,InputRequiredResultSchema:E1,InputResponseRequestParamsSchema:Q5,CallToolRequestSchema:Y5,ListToolsRequestSchema:G5,ListPromptsRequestSchema:B5,GetPromptRequestSchema:F5,ListResourcesRequestSchema:L5,ListResourceTemplatesRequestSchema:J5,ReadResourceRequestSchema:z5,CompleteRequestSchema:K5,DiscoverRequestSchema:Z5,SubscriptionFilterSchema:u1,SubscriptionsListenRequestSchema:H5,SubscriptionsListenResultMetaSchema:$5,SubscriptionsListenResultSchema:U5,dispatchRequestSchemas:U1,dispatchResultSchemas:A5,NotificationMetaSchema:T1,SubscriptionsAcknowledgedNotificationSchema:l1,CancelledNotificationParamsSchema:m1,CancelledNotificationSchema:c1,notificationSchemas2026:Y4,JSONRPCResultResponseSchema:c0(G6),CallToolResultResponseSchema:c0(a([h1,E1])),ListToolsResultResponseSchema:c0(B6),ListPromptsResultResponseSchema:c0(F6),GetPromptResultResponseSchema:c0(a([L6,E1])),ListResourcesResultResponseSchema:c0(J6),ListResourceTemplatesResultResponseSchema:c0(z6),ReadResourceResultResponseSchema:c0(a([K6,E1])),CompleteResultResponseSchema:c0(Z6),DiscoverResultResponseSchema:c0(H6)}}function P4(){return AN??=UN()}function VN(W){return NN.includes(W)}function pQ(W,Q){if(Q===void 0)return W;let X=W[y9];if(X===void 0)return{...W,[y9]:Q};let Y={},G=X.ttlMs??Q.ttlMs;if(G!==void 0)Y.ttlMs=G;let B=X.cacheScope??Q.cacheScope;if(B!==void 0)Y.cacheScope=B;return{...W,[y9]:Y}}function wN(W){return W[y9]}function CG(W){return typeof W==="number"&&Number.isSafeInteger(W)&&W>=0}function kG(W){return W==="public"||W==="private"}function vG(W,Q){if(W.ttlMs!==void 0&&!CG(W.ttlMs))throw RangeError(`Invalid cache hint for ${Q}: ttlMs must be a non-negative safe integer (got ${String(W.ttlMs)})`);if(W.cacheScope!==void 0&&!kG(W.cacheScope))throw RangeError(`Invalid cache hint for ${Q}: cacheScope must be 'public' or 'private' (got ${String(W.cacheScope)})`)}function ON(W,Q){let X=Q.resultType;if(X===void 0)return{...Q,resultType:"complete"};if(X==="complete")return Q;if(jN.includes(W))return Q;throw new N0(K0.InternalError,`Handler for ${W} returned resultType '${String(X)}', but results of ${W} only support 'complete' on protocol revision 2026-07-28`)}function EN(W,Q){let X=wN(Q);if(Q.resultType!=="complete"||!VN(W))return X===void 0?Q:bN(Q);let Y=Q,G=CG(Y.ttlMs)?Y.ttlMs:RN(X),B=kG(Y.cacheScope)?Y.cacheScope:PN(X),F={...Y,ttlMs:G,cacheScope:B};return delete F[y9],F}function IN(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function TN(W,Q){if(Q===void 0)return W;let X=W._meta;if(X===void 0)return{...W,_meta:{[N1]:Q}};if(!IN(X))return W;if(X[N1]!==void 0)return W;return{...W,_meta:{...X,[N1]:Q}}}function RN(W){return W!==void 0&&CG(W.ttlMs)?W.ttlMs:DN}function PN(W){return W!==void 0&&kG(W.cacheScope)?W.cacheScope:MN}function bN(W){let Q={...W};return delete Q[y9],Q}function dz(){if(hQ)return hQ;let W=P4();return hQ={request:{"elicitation/create":q({method:g("elicitation/create"),params:W.ElicitRequestParamsSchema}),"sampling/createMessage":q({method:g("sampling/createMessage"),params:W.CreateMessageRequestParamsSchema}),"roots/list":q({method:g("roots/list"),params:B0({}).optional()})},response:{"elicitation/create":W.ElicitResultSchema,"sampling/createMessage":W.CreateMessageResultSchema,"roots/list":W.ListRootsResultSchema}},hQ}function iz(W){return SN.includes(W)}function wG(W){return iz(W)?dz().request[W]:void 0}function qN(W){return iz(W)?dz().response[W]:void 0}function rz(W){return Object.prototype.hasOwnProperty.call(yG,W)}function oz(W){return Object.prototype.hasOwnProperty.call(nz,W)}function CN(W){return Object.prototype.hasOwnProperty.call(yG,W)}function kN(W){return rz(W)?P4().dispatchRequestSchemas[W]:void 0}function vN(W){return CN(W)?P4().dispatchResultSchemas[W]:void 0}function yN(W){return oz(W)?P4().notificationSchemas2026[W]:void 0}function gW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function yW(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function fN(W,Q){let X=Q,Y=!1,G=()=>{if(!Y)X={...X},Y=!0;return X},B=Q.tools;if(W==="tools/list"&&Array.isArray(B)&&B.some((L)=>gW(L)&&("execution"in L)))G().tools=B.map((L)=>{if(!gW(L)||!("execution"in L))return L;let J={...L};return delete J.execution,J});let F=Q.capabilities;if(gW(F)&&"tasks"in F){let L={...F};delete L.tasks,G().capabilities=L}return X}function xN(){if(uQ)return uQ;let W=P4();return uQ={"tools/call":W.CallToolResultSchema,"tools/list":W.ListToolsResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"completion/complete":W.CompleteResultSchema,"server/discover":W.DiscoverResultSchema},uQ}function g9(W){return W!==void 0&&hW(W)?_G:qG}function Rz(W){if(W.revision!==void 0)return g9(W.revision).era;return W.era==="modern"?_G.era:qG.era}function DG(W){return az.some((Q)=>Q.hasRequestMethod(W))}function MG(W){return az.some((Q)=>Q.hasNotificationMethod(W))}function fG(W){if(W.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${W.params.ref.type}`)}function xG(W){if(W.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${W.params.ref.type}`)}function hG(W){let Q=[],X=new Map,Y=(B,F,L)=>{if(B===null||typeof B!=="object")return;let J=B;if(Pz in J){if(!L||F.length===0)return`${lQ(F)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let K=J[Pz];if(typeof K!=="string"||K.length===0)return`${lQ(F)}: x-mcp-header MUST be a non-empty string`;if(!uN.test(K))return`${lQ(F)}: x-mcp-header '${K}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let H=typeof J.type==="string"?J.type:void 0;if(H===void 0||!lN.has(H))return`${lQ(F)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${H??"<none>"}`;let D=K.toLowerCase(),I=X.get(D);if(I!==void 0)return`x-mcp-header '${K}' is not case-insensitively unique (also declared as '${I}')`;X.set(D,K),Q.push({path:F,headerName:K,type:H})}let z=J.properties;if(z!==null&&typeof z==="object")for(let[K,H]of Object.entries(z)){let D=Y(H,[...F,K],L);if(D!==void 0)return D}for(let K of mN){let H=J[K];if(H===void 0)continue;let D=Array.isArray(H)?H:H!==null&&typeof H==="object"&&cN.has(K)?Object.values(H):[H];for(let I of D){let A=Y(I,[...F,`<${K}>`],!1);if(A!==void 0)return A}}},G=Y(W,[],!0);return G===void 0?{valid:!0,declarations:Q}:{valid:!1,reason:G}}function lQ(W){return W.length===0?"<root>":W.join(".")}function nQ(W,Q){return u4(W,Q)}function _W(W){return new Set(W.flatMap((Q)=>Object.keys(Q.shape)))}function f9(W){if(W==null)return!1;let Q=typeof W;if(Q!=="object"&&Q!=="function")return!1;if(!("~standard"in W))return!1;return typeof W["~standard"]?.validate==="function"}function W4(W,Q="input"){let X=W["~standard"],Y;if(X.jsonSchema)Y=X.jsonSchema[Q]({target:IG});else if(X.vendor==="zod"){if(!("_zod"in W))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!bz)bz=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");Y=F4(W,{target:IG,io:Q})}else throw Error(`Schema library "${X.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(Q==="output"){if(Y.type!==void 0)return Y;return WK(Y)?{type:"object",...Y}:Y}if(Y.type!==void 0&&Y.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(Y.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...Y}}function WK(W){if("properties"in W||"patternProperties"in W||"additionalProperties"in W||"required"in W)return!0;for(let Q of["oneOf","anyOf","allOf"]){let X=W[Q];if(Array.isArray(X)&&X.length>0)return X.every((Y)=>Y!==null&&typeof Y==="object"&&(Y.type==="object"||WK(Y)))}return!1}function dN(W){if(!W.path?.length)return W.message;return`${W.path.map((Q)=>String(typeof Q==="object"?Q.key:Q)).join(".")}: ${W.message}`}async function R4(W,Q){let X=await W["~standard"].validate(Q);if(X.issues&&X.issues.length>0)return{success:!1,error:X.issues.map((Y)=>dN(Y)).join(", ")};return{success:!0,data:X.value}}function iN(W){let Q=F4(W,{target:IG,io:"input"});return typeof Q.pattern==="string"?Q.pattern:void 0}function rN(W){let Q=nN.exec(W),X=[void 0,-1,0];if(Q)X.push(Number(Q[1]));return[!1,!0].flatMap((Y)=>[!1,!0].flatMap((G)=>X.map((B)=>b1.datetime({local:Y,offset:G,precision:B}))))}function oN(W,Q){let X;switch(W){case"email":X=[TQ()];break;case"uri":X=[l4()];break;case"date":X=[b1.date()];break;case"date-time":X=rN(Q);break}return new Set(X.map((Y)=>iN(Y)).filter((Y)=>Y!==void 0))}function aN(W,Q,X){if(X!=="zod")return!0;return oN(W,Q).has(Q)}function QK(W){let Q=W4(W,"input"),X=Q.properties||{},Y=Q.required||[];return Object.entries(X).map(([G,B])=>({name:G,description:B?.description,required:Y.includes(G)}))}function xW(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function sN(W){try{return W4(W,"input")}catch(Q){let X=Q instanceof Error?Q.message:String(Q);throw new N0(K0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${X}`)}}function uG(W){return tN.has(W)||W.startsWith("x-")}function QV(W,Q,X,Y){if(!xW(W))return W;let G=typeof W.type==="string"&&Object.hasOwn(Sz,W.type)?Sz[W.type]:void 0;if(G===void 0)return W;let B={};for(let[F,L]of Object.entries(W))if(G.has(F)||uG(F))B[F]=L;else if(F==="pattern"&&W.type==="string"&&typeof W.format==="string"){if(!WV.has(W.format))B[F]=L;else if(typeof L!=="string"||!aN(W.format,L,X))Y.push(`${Q}.${F}`)}else Y.push(`${Q}.${F}`);return B}function XV(W,Q){let X={},Y=[];for(let[G,B]of Object.entries(W))if(G==="properties"&&xW(B))X[G]=Object.fromEntries(Object.entries(B).map(([F,L])=>[F,QV(L,`properties.${F}`,Q,Y)]));else if(eN.has(G))X[G]=B;else if(!uG(G))Y.push(G);if(Y.length>0)throw new N0(K0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${Y.join(", ")}`);return X}function YV(W,Q){if(!xW(W.properties))return Q;let X=Object.entries(W.properties).filter(([,Y])=>!nQ(e5,Y).success).map(([Y])=>`properties.${Y}`);return X.length>0?X.join(", "):Q}function TG(W,Q,X=""){if(Array.isArray(W)&&Array.isArray(Q))return W.flatMap((Y,G)=>TG(Y,Q[G],`${X}[${G}]`));if(!xW(W)||!xW(Q))return[];return Object.entries(W).flatMap(([Y,G])=>{let B=X?`${X}.${Y}`:Y;if(!Object.prototype.hasOwnProperty.call(Q,Y))return uG(Y)?[]:[B];return TG(G,Q[Y],B)})}function GV(W){if(!f9(W.requestedSchema))return{...W,mode:"form",requestedSchema:W.requestedSchema};let Q=W.requestedSchema["~standard"].vendor,X=XV(sN(W.requestedSchema),Q),Y=nQ(a6.shape.requestedSchema,X);if(!Y.success)throw new N0(K0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${YV(X,Y.error.message)}`);let G=TG(X,Y.data);if(G.length>0)throw new N0(K0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${G.join(", ")}`);let B=(Y.data.required??[]).filter((F)=>!Object.prototype.hasOwnProperty.call(Y.data.properties,F));if(B.length>0)throw new N0(K0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${B.join(", ")}`);return{...W,mode:"form",requestedSchema:Y.data}}function BV(W){let Q=W.inputRequests!==void 0&&Object.keys(W.inputRequests).length>0,X=typeof W.requestState==="string";if(!Q&&!X)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...W.inputRequests!==void 0&&{inputRequests:W.inputRequests},...W.requestState!==void 0&&{requestState:W.requestState}}}function YK(W,Q){return`Multi-round-trip request '${W}' still required input after ${Q} rounds (inputRequired.maxRounds)`}function GK(W,Q){return new Promise((X,Y)=>{if(Q?.aborted){Y(Q.reason instanceof O0?Q.reason:new O0(S0.RequestTimeout,String(Q.reason)));return}let G=setTimeout(()=>{Q?.removeEventListener("abort",B),X()},W),B=()=>{clearTimeout(G),Y(Q?.reason instanceof O0?Q.reason:new O0(S0.RequestTimeout,String(Q?.reason)))};Q?.addEventListener("abort",B,{once:!0})})}function BK(W){let Q=new AbortController,X=()=>Q.abort(W?.reason);if(W?.addEventListener("abort",X,{once:!0}),W?.aborted)Q.abort(W.reason);return{signal:Q.signal,abort:(Y)=>Q.abort(Y),dispose:()=>W?.removeEventListener("abort",X)}}function JK(W,Q){let X=W.slice(0,-6);FK[X]=Q,LK[X]=(Y)=>Q.safeParse(Y).success}function ZV(W){switch(W){case"initialize":case"notifications/initialized":return g9(void 0);case"server/discover":return g9(gG);default:return}}function qz(W,Q){let X=W.params;if(!fW(X))return{message:W,lifted:{}};let Y=X._meta,G=fW(Y)?HV.filter((J)=>(J in Y)):[],B=Q==="request"?$V.filter((J)=>(J in X)):[];if(G.length===0&&B.length===0)return{message:W,lifted:{}};let F={},L={...X};if(G.length>0&&fW(Y)){let J={},z={...Y};for(let K of G)J[K]=Y[K],delete z[K];if(F.envelope=J,Object.keys(z).length>0)L._meta=z;else delete L._meta}for(let J of B){if(J==="inputResponses")F.inputResponses=L[J];if(J==="requestState")F.requestState=L[J];delete L[J]}return{message:{...W,params:L},lifted:F}}function Cz(W,Q){let X=W.validateResult(Q,void 0);if(!X.ok&&X.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(Y){let G=W.validateResult(Q,Y);if(G.ok)return{value:G.value};return{issues:[{message:G.reason==="invalid"?G.message:`not-in-era: ${Q}`}]}}}}}function uW(W){return()=>W}function lG(W,Q){return{...W,mcpReq:{...W.mcpReq,requestState:uW(Q)}}}function fW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function cG(W,Q){let X={...W};for(let Y in Q){let G=Y,B=Q[G];if(B===void 0)continue;let F=X[G];X[G]=fW(F)&&fW(B)?{...F,...B}:B}return X}function kz(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function NV(W){let Q={},X=[];if(!kz(W))return{accepted:Q,droppedKeys:X};for(let[Y,G]of Object.entries(W)){if(!kz(G)||"method"in G||"result"in G){X.push(Y);continue}Q[Y]=G}return{accepted:Q,droppedKeys:X}}function VV(W){return{resultType:"input_required",inputRequests:W.inputRequests,...W.requestState!==void 0&&{requestState:W.requestState}}}function pG(W){return b5.parse(JSON.parse(W))}function dG(W){return JSON.stringify(W)+`
68
+ `}function MV(W){let Q=[];if(W.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(W.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${W.length})`]};if(W.includes(" "))Q.push("Tool name contains spaces, which may cause parsing issues");if(W.includes(","))Q.push("Tool name contains commas, which may cause parsing issues");if(W.startsWith("-")||W.endsWith("-"))Q.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(W.startsWith(".")||W.endsWith("."))Q.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!DV.test(W)){let X=[...W].filter((Y)=>!/[A-Za-z0-9._-]/.test(Y)).filter((Y,G,B)=>B.indexOf(Y)===G);return Q.push(`Tool name contains invalid characters: ${X.map((Y)=>`"${Y}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Q}}return{isValid:!0,warnings:Q}}function jV(W,Q){if(Q.length>0){console.warn(`Tool name validation warning for "${W}":`);for(let X of Q)console.warn(` - ${X}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function iG(W){let Q=MV(W);return jV(W,Q.warnings),Q.isValid}function OV(W){return typeof W==="object"&&W!==null&&"_zod"in W}function EV(W){return typeof W==="object"&&W!==null&&!("_zod"in W)&&"_def"in W&&typeof W._def?.typeName==="string"}function IV(W){if(typeof W!=="object"||W===null)return!1;if(f9(W))return!1;let Q=Object.getPrototypeOf(W);if(Q!==Object.prototype&&Q!==null)return!1;return Object.values(W).every((X)=>OV(X))}function rQ(W){if(W===void 0)return;if(IV(W))return q(W);if(typeof W==="object"&&W!==null&&!f9(W)&&Object.values(W).some((Q)=>EV(Q)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!f9(W))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return W}var jG,WN,S0,O0,QN,YN="2026-07-28",gz,BN,FN,LN,hz,uz,zN,fQ,zT,KT,Ez,qG,AN,NN,y9,K0,N0,dQ,cz,pz,iQ,DN=0,MN="private",jN,SN,hQ,yG,nz,ZT,HT,_N,gN,_G,uQ,gG="2026-07-28",az,hN,sz=(W)=>h5.safeParse(W).success,tz=(W)=>u5.safeParse(W).success,EG=(W)=>R5.safeParse(W).success,ez=(W)=>P5.safeParse(W).success,q5=(W)=>typeof W==="object"&&W!==null&&!Array.isArray(W)&&W.resultType==="input_required",Pz="x-mcp-header",uN,lN,mN,cN,mQ=-32020,$T,pN,bz=!1,IG="draft-2020-12",nN,tN,eN,Sz,WV,FV,XK=250,LV,JV,FK,LK,zV,KV,zK=60000,HV,$V,UV,AV,mG,wV,UT,DV;var nG=H0(()=>{hX();VG();m4();jG=Symbol.for("mcp.sdk.errorBrands");WN=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Q){return _9(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return _9(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.errorUri=Y,this.name="OAuthError",RG(this,new.target)}toResponseObject(){let Q={error:this.code,error_description:this.message};if(this.errorUri)Q.error_uri=this.errorUri;return Q}static fromResponse(Q){return new W(Q.error,Q.error_description??Q.error,Q.error_uri)}},S0=function(W){return W.NotConnected="NOT_CONNECTED",W.AlreadyConnected="ALREADY_CONNECTED",W.NotInitialized="NOT_INITIALIZED",W.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",W.RequestTimeout="REQUEST_TIMEOUT",W.ConnectionClosed="CONNECTION_CLOSED",W.SendFailed="SEND_FAILED",W.InvalidResult="INVALID_RESULT",W.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",W.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",W.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",W.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",W.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",W.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",W.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",W.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",W.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",W.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",W.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",W}({}),O0=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](W){return _9(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return _9(this,W)}constructor(W,Q,X){super(Q);this.code=W,this.data=X,this.name="SdkError",RG(this,new.target)}},QN=class extends O0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(W,Q,X){super(W,Q,X);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};gz=["task","inputRequests","requestState"];FN=new Set(["const","enum","default","examples"]),LN=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas"]);hz={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},uz={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},zN={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};zT=Object.keys(hz),KT=Object.keys(uz);Ez={ok:!1,reason:"not-in-era"};qG={era:"2025-11-25",hasRequestMethod:lz,hasNotificationMethod:mz,validateRequest:(W,Q)=>xQ(HN(W),Q),validateResult:(W,Q)=>xQ(ZN(W),Q),validateNotification:(W,Q)=>xQ($N(W),Q),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ez,validateInputResponse:()=>Ez,samplingResultVariant:(W,Q)=>{let X=fz();return xQ(W?X.CreateMessageResultWithToolsSchema:X.CreateMessageResultSchema,Q)},outboundEnvelope:(W)=>{return},validateEnvelopeMeta:(W)=>[],projectCallToolResult(W,Q){let X=_z(W),Y=X.structuredContent;if(Y===void 0)return X;let G=typeof Y!=="object"||Y===null||Array.isArray(Y),B=Q!==void 0&&xz(Q);if(!G&&!B)return X;return{...X,structuredContent:{result:Y}}},decodeResult(W,Q){if(OG(Q)&&"resultType"in Q){let X={...Q};return delete X.resultType,{kind:"complete",result:Tz(X)}}return{kind:"complete",result:Tz(Q)}},encodeResult(W,Q){if(W!=="tools/list")return Q;let X=Q.tools;if(!Array.isArray(X)||!X.some((Y)=>Iz(Y)))return Q;return{...Q,tools:X.map((Y)=>Iz(Y)?{...Y,outputSchema:JN(Y.outputSchema)}:Y)}},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope:(W)=>{return}};NN=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];y9=Symbol("modelcontextprotocol.resultCacheHintFallback");K0=function(W){return W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.ResourceNotFound=-32002]="ResourceNotFound",W[W.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",W[W.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired",W}({}),N0=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](Q){return _9(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return _9(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.data=Y,this.name="ProtocolError",RG(this,new.target)}static fromError(Q,X,Y){if(Q===K0.UrlElicitationRequired&&Y){let G=Y;if(G.elicitations)return new cz(G.elicitations,X)}if(Q===K0.UnsupportedProtocolVersion&&Y){let G=Y;if(Array.isArray(G.supported)&&typeof G.requested==="string")return new pz({supported:G.supported,requested:G.requested},X)}if(Q===K0.InvalidParams||Q===K0.ResourceNotFound){let G=Y;if(typeof G?.uri==="string"&&(Q===K0.ResourceNotFound||Object.keys(G).length===1))return new dQ(G.uri,X)}if(Q===K0.MissingRequiredClientCapability&&Y){let G=Y;if(G.requiredCapabilities!==null&&typeof G.requiredCapabilities==="object"&&!Array.isArray(G.requiredCapabilities))return new iQ({requiredCapabilities:G.requiredCapabilities},X)}return new W(Q,X,Y)}},dQ=class extends N0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(W,Q=`Resource not found: ${W}`){super(K0.InvalidParams,Q,{uri:W})}get uri(){return this.data.uri}},cz=class extends N0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(W,Q=`URL elicitation${W.length>1?"s":""} required`){super(K0.UrlElicitationRequired,Q,{elicitations:W})}get elicitations(){return this.data?.elicitations??[]}},pz=class extends N0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(W,Q=`Unsupported protocol version: ${W.requested}`){super(K0.UnsupportedProtocolVersion,Q,W)}get supported(){return this.data.supported}get requested(){return this.data.requested}},iQ=class extends N0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(W,Q=`Missing required client capabilities: ${Object.keys(W.requiredCapabilities).join(", ")}`){super(K0.MissingRequiredClientCapability,Q,W)}get requiredCapabilities(){return this.data.requiredCapabilities}},jN=["tools/call","prompts/get","resources/read"];SN=["elicitation/create","sampling/createMessage","roots/list"];yG={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},nz={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};ZT=Object.keys(yG),HT=Object.keys(nz);_N={ok:!1,reason:"not-in-era"},gN=[i1,S1];_G={era:"2026-07-28",hasRequestMethod:rz,hasNotificationMethod:oz,hasInputRequestMethod:(W)=>wG(W)!==void 0,validateRequest:(W,Q)=>yW(kN(W),Q),validateResult:(W,Q)=>yW(vN(W),Q),validateNotification:(W,Q)=>yW(yN(W),Q),validateInputRequest:(W,Q)=>yW(wG(W),Q),validateInputResponse:(W,Q)=>yW(qN(W),Q),samplingResultVariant:()=>_N,outboundEnvelope(W){return{[i1]:W.protocolVersion,[y6]:W.clientInfo,[S1]:W.clientCapabilities,...W.logLevel!==void 0&&{[n1]:W.logLevel}}},validateEnvelopeMeta(W){let Q=[];for(let Y of gN)if(!(Y in W))Q.push({key:Y,problem:"missing"});let X=P4().RequestMetaEnvelopeSchema.safeParse(W);if(!X.success)for(let Y of X.error.issues){let G=Y.path.map(String),B=G.length>0?G.join("."):"_meta";if(G.length===1&&Q.some((F)=>F.key===B&&F.problem==="missing"))continue;Q.push({key:B,problem:Y.message})}return Q},projectCallToolResult:(W)=>_z(W),inputRequestSchema:wG,decodeResult(W,Q){if(!gW(Q))return{kind:"invalid",error:new O0(S0.InvalidResult,`Invalid result for ${W}: not an object`,{method:W})};let X=Q.resultType;if(X===void 0)return{kind:"invalid",error:new O0(S0.InvalidResult,`Invalid result for ${W}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:W,violation:"missing-resultType"})};if(typeof X!=="string")return{kind:"invalid",error:new O0(S0.InvalidResult,`Invalid result for ${W}: non-string resultType`,{method:W,resultType:X})};if(X==="input_required"){let F=Q.inputRequests,L=gW(F)?F:{},J=Q.requestState;if(Object.keys(L).length===0&&typeof J!=="string")return{kind:"invalid",error:new O0(S0.InvalidResult,`Invalid result for ${W}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:W,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:L,...typeof J==="string"&&{requestState:J}}}if(X!=="complete")return{kind:"invalid",error:new O0(S0.UnsupportedResultType,`Unsupported result type '${X}' for ${W}`,{resultType:X,method:W})};let Y=xN(),G=Object.hasOwn(Y,W)?Y[W]:void 0;if(G!==void 0){let F=G.safeParse(Q);if(!F.success)return{kind:"invalid",error:new O0(S0.InvalidResult,`Invalid result for ${W}: ${F.error}`,{method:W})}}let B={...Q};return delete B.resultType,{kind:"complete",result:B}},encodeResult(W,Q,X){return TN(EN(W,ON(W,fN(W,Q))),X)},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope(W){if(W.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let Q=P4().RequestMetaEnvelopeSchema.safeParse(W.envelope);if(!Q.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${Q.error.issues.map((X)=>X.message).join("; ")}`}};az=[qG,_G],hN=LB({AnnotationsSchema:()=>_6,AudioContentSchema:()=>d5,BaseMetadataSchema:()=>v6,BaseRequestParamsSchema:()=>Y1,BlobResourceContentsSchema:()=>D4,BooleanSchemaSchema:()=>n5,CallToolRequestParamsSchema:()=>m8,CallToolRequestSchema:()=>c8,CallToolResultSchema:()=>E4,CancelTaskRequestSchema:()=>IW,CancelTaskResultSchema:()=>TW,CancelledNotificationParamsSchema:()=>i4,CancelledNotificationSchema:()=>$4,ClientCapabilitiesSchema:()=>a4,ClientNotificationSchema:()=>PW,ClientRequestSchema:()=>RW,ClientResultSchema:()=>bW,ClientTasksCapabilitySchema:()=>r4,CompatibilityCallToolResultSchema:()=>UW,CompleteRequestParamsSchema:()=>N9,CompleteRequestSchema:()=>V9,CompleteResultSchema:()=>w9,ContentBlockSchema:()=>i5,CreateMessageRequestParamsSchema:()=>Q9,CreateMessageRequestSchema:()=>X9,CreateMessageResultSchema:()=>Y9,CreateMessageResultWithToolsSchema:()=>G9,CreateTaskResultSchema:()=>NW,CursorSchema:()=>z4,DiscoverRequestSchema:()=>Q8,DiscoverResultSchema:()=>S5,ElicitRequestFormParamsSchema:()=>a6,ElicitRequestParamsSchema:()=>z9,ElicitRequestSchema:()=>K9,ElicitRequestURLParamsSchema:()=>J9,ElicitResultSchema:()=>$9,ElicitationCompleteNotificationParamsSchema:()=>Z9,ElicitationCompleteNotificationSchema:()=>H9,EmbeddedResourceSchema:()=>v8,EmptyResultSchema:()=>H4,EnumSchemaSchema:()=>L9,GetPromptRequestParamsSchema:()=>q8,GetPromptRequestSchema:()=>C8,GetPromptResultSchema:()=>g8,GetTaskPayloadRequestSchema:()=>MW,GetTaskPayloadResultSchema:()=>jW,GetTaskRequestSchema:()=>wW,GetTaskResultSchema:()=>DW,IconSchema:()=>n4,IconsSchema:()=>c6,ImageContentSchema:()=>p5,ImplementationSchema:()=>l5,InitializeRequestParamsSchema:()=>s4,InitializeRequestSchema:()=>t4,InitializeResultSchema:()=>e4,InitializedNotificationSchema:()=>W8,JSONArraySchema:()=>HW,JSONObjectSchema:()=>t0,JSONRPCErrorResponseSchema:()=>P5,JSONRPCMessageSchema:()=>b5,JSONRPCNotificationSchema:()=>u5,JSONRPCRequestSchema:()=>h5,JSONRPCResponseSchema:()=>$W,JSONRPCResultResponseSchema:()=>R5,JSONValueSchema:()=>l6,LegacyTitledEnumSchemaSchema:()=>a5,ListChangedOptionsBaseSchema:()=>I4,ListPromptsRequestSchema:()=>b8,ListPromptsResultSchema:()=>S8,ListResourceTemplatesRequestSchema:()=>J8,ListResourceTemplatesResultSchema:()=>z8,ListResourcesRequestSchema:()=>F8,ListResourcesResultSchema:()=>L8,ListRootsRequestSchema:()=>M9,ListRootsResultSchema:()=>j9,ListTasksRequestSchema:()=>OW,ListTasksResultSchema:()=>EW,ListToolsRequestSchema:()=>u8,ListToolsResultSchema:()=>l8,LoggingLevelSchema:()=>n6,LoggingMessageNotificationParamsSchema:()=>n8,LoggingMessageNotificationSchema:()=>r8,ModelHintSchema:()=>o8,ModelPreferencesSchema:()=>a8,MultiSelectEnumSchemaSchema:()=>F9,NotificationSchema:()=>z1,NotificationsParamsSchema:()=>J1,NumberSchemaSchema:()=>o6,PaginatedRequestParamsSchema:()=>G8,PaginatedRequestSchema:()=>p6,PaginatedResultSchema:()=>d6,PingRequestSchema:()=>A4,PrimitiveSchemaDefinitionSchema:()=>e5,ProgressNotificationParamsSchema:()=>Y8,ProgressNotificationSchema:()=>N4,ProgressSchema:()=>X8,ProgressTokenSchema:()=>J4,PromptArgumentSchema:()=>R8,PromptListChangedNotificationSchema:()=>f8,PromptMessageSchema:()=>_8,PromptReferenceSchema:()=>A9,PromptSchema:()=>P8,ReadResourceRequestParamsSchema:()=>K8,ReadResourceRequestSchema:()=>Z8,ReadResourceResultSchema:()=>H8,RelatedTaskMetadataSchema:()=>d4,RequestIdSchema:()=>m6,RequestMetaSchema:()=>K4,RequestSchema:()=>e0,ResourceContentsSchema:()=>V4,ResourceLinkSchema:()=>y8,ResourceListChangedNotificationSchema:()=>$8,ResourceRequestParamsSchema:()=>m5,ResourceSchema:()=>M4,ResourceTemplateReferenceSchema:()=>U9,ResourceTemplateSchema:()=>B8,ResourceUpdatedNotificationParamsSchema:()=>I8,ResourceUpdatedNotificationSchema:()=>T8,ResultMetaObjectSchema:()=>Z4,ResultSchema:()=>W1,RoleSchema:()=>i6,RootSchema:()=>D9,RootsListChangedNotificationSchema:()=>O9,SamplingContentSchema:()=>e8,SamplingMessageContentBlockSchema:()=>O5,SamplingMessageSchema:()=>W9,ServerCapabilitiesSchema:()=>U4,ServerNotificationSchema:()=>qW,ServerRequestSchema:()=>SW,ServerResultSchema:()=>CW,ServerTasksCapabilitySchema:()=>o4,SetLevelRequestParamsSchema:()=>d8,SetLevelRequestSchema:()=>i8,SingleSelectEnumSchemaSchema:()=>B9,StringSchemaSchema:()=>r6,SubscribeRequestParamsSchema:()=>U8,SubscribeRequestSchema:()=>A8,SubscriptionFilterSchema:()=>j4,SubscriptionsAcknowledgedNotificationParamsSchema:()=>M8,SubscriptionsAcknowledgedNotificationSchema:()=>j8,SubscriptionsListenRequestParamsSchema:()=>w8,SubscriptionsListenRequestSchema:()=>D8,SubscriptionsListenResultMetaSchema:()=>O8,SubscriptionsListenResultSchema:()=>E8,TaskAugmentedRequestParamsSchema:()=>T5,TaskCreationParamsSchema:()=>AW,TaskMetadataSchema:()=>p4,TaskSchema:()=>s6,TaskStatusNotificationParamsSchema:()=>I9,TaskStatusNotificationSchema:()=>VW,TaskStatusSchema:()=>E9,TextContentSchema:()=>c5,TextResourceContentsSchema:()=>w4,TitledMultiSelectEnumSchemaSchema:()=>t5,TitledSingleSelectEnumSchemaSchema:()=>o5,ToolAnnotationsSchema:()=>x8,ToolChoiceSchema:()=>s8,ToolExecutionSchema:()=>h8,ToolListChangedNotificationSchema:()=>p8,ToolResultContentSchema:()=>t8,ToolSchema:()=>O4,ToolUseContentSchema:()=>k8,UnsubscribeRequestParamsSchema:()=>N8,UnsubscribeRequestSchema:()=>V8,UntitledMultiSelectEnumSchemaSchema:()=>s5,UntitledSingleSelectEnumSchemaSchema:()=>r5});uN=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,lN=new Set(["string","integer","boolean","number"]);mN=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],cN=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);$T=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[K0.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[mQ,K0.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[K0.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[K0.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[K0.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[mQ],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[K0.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[mQ],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],pN={[K0.ParseError]:400,[K0.InvalidRequest]:400,[K0.MethodNotFound]:404,[K0.UnsupportedProtocolVersion]:400,[K0.MissingRequiredClientCapability]:400,[mQ]:400};nN=/\\\.\\d\{(\d+)\}/;tN=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);eN=new Set(["$schema",...Object.keys(a6.shape.requestedSchema.shape)]),Sz={string:_W([r6,r5,o5,a5]),number:_W([o6]),integer:_W([o6]),boolean:_W([n5]),array:_W([s5,t5])},WV=new Set(r6.shape.format.unwrap().options);FV=Object.assign(BV,{elicit(W){try{return{method:"elicitation/create",params:GV(W)}}catch(Q){throw Q instanceof N0?TypeError(Q.message,{cause:Q}):Q}},elicitUrl(W){return{method:"elicitation/create",params:{...W,mode:"url"}}},createMessage(W){return{method:"sampling/createMessage",params:W}},listRoots(){return{method:"roots/list"}}});LV=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],JV={IdJagTokenExchangeResponseSchema:S9,OAuthClientInformationFullSchema:v9,OAuthClientInformationSchema:k9,OAuthClientMetadataSchema:C9,OAuthClientRegistrationErrorSchema:kW,OAuthErrorResponseSchema:q9,OAuthMetadataSchema:T4,OAuthProtectedResourceMetadataSchema:T9,OAuthTokenRevocationRequestSchema:vW,OAuthTokensSchema:b9,OpenIdProviderDiscoveryMetadataSchema:P9,OpenIdProviderMetadataSchema:R9},FK={},LK={};for(let W of LV)JK(W,hN[W]);for(let[W,Q]of Object.entries(JV))JK(W,Q);zV=Object.freeze(FK),KV=Object.freeze(LK);HV=[i1,y6,S1,n1],$V=["inputResponses","requestState"];UV=uW(void 0);mG=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{AV=(W,Q)=>{W._negotiatedProtocolVersion=Q}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(W){this._options=W,this._supportedProtocolVersions=W?.supportedProtocolVersions??L4,this.setNotificationHandler("notifications/cancelled",(Q)=>{this._oncancel(Q)}),this.setNotificationHandler("notifications/progress",(Q)=>{this._onprogress(Q)}),this.setRequestHandler("ping",(Q)=>({}))}_shouldDropInbound(W){}_outboundMetaEnvelope(){}_envelopeOutbound(W){let Q=this._outboundMetaEnvelope();if(Q===void 0)return W;let X=W.params??{};return{...W,params:{...X,_meta:{...Q,...X._meta}}}}_resolveNonCompleteResult(W,Q){return Promise.reject(new O0(S0.UnsupportedResultType,`Unsupported result type '${W.kind}' for ${Q.request.method}`,{resultType:W.kind,method:Q.request.method}))}_getRequestHandler(W){return this._requestHandlers.get(W)}async _oncancel(W){if(!W.params.requestId)return;this._requestHandlerAbortControllers.get(W.params.requestId)?.abort(W.params.reason)}_setupTimeout(W,Q,X,Y,G=!1){this._timeoutInfo.set(W,{timeoutId:setTimeout(Y,Q),startTime:Date.now(),timeout:Q,maxTotalTimeout:X,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout(W){let Q=this._timeoutInfo.get(W);if(!Q)return!1;let X=Date.now()-Q.startTime;if(Q.maxTotalTimeout&&X>=Q.maxTotalTimeout)throw this._timeoutInfo.delete(W),new O0(S0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Q.maxTotalTimeout,totalElapsed:X});return clearTimeout(Q.timeoutId),Q.timeoutId=setTimeout(Q.onTimeout,Q.timeout),!0}_cleanupTimeout(W){let Q=this._timeoutInfo.get(W);if(Q)clearTimeout(Q.timeoutId),this._timeoutInfo.delete(W)}async connect(W){this._transport=W;let Q=this.transport?.onclose;this._transport.onclose=()=>{try{Q?.()}finally{this._onclose()}};let X=this.transport?.onerror;this._transport.onerror=(G)=>{X?.(G),this._onerror(G)};let Y=this._transport?.onmessage;this._transport.onmessage=(G,B)=>{if(Y?.(G,B),EG(G)||ez(G))this._onresponse(G);else if(sz(G))this._onrequest(G,B);else if(tz(G))this._onnotification(G,B);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},W.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();let Q=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let X=new O0(S0.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let Y of W.values())Y(X);for(let Y of Q.values())Y.abort(X)}}_onerror(W){this.onerror?.(W)}_onnotification(W,Q){let{message:X}=qz(W,"notification"),Y=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop")return;if(Q?.classification!==void 0){let F=Rz(Q.classification);if(F!==Y.era){this._onerror(Error(`Era mismatch on inbound notification '${X.method}': classified as ${F} but this instance serves ${Y.era}`));return}}if(MG(X.method)&&!Y.hasNotificationMethod(X.method))return;let G=this._notificationHandlers.get(X.method),B=this.fallbackNotificationHandler;if(G===void 0&&B===void 0)return;Promise.resolve().then(()=>G===void 0?B(X):G(X,Y)).catch((F)=>this._onerror(Error(`Uncaught error in notification handler: ${F}`)))}_onrequest(W,Q){let{message:X,lifted:Y}=qz(W,"request"),G=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop"){this._onerror(Error(`Dropped inbound request '${W.method}': not servable on this connection's protocol era`));return}let B=this._transport,F=(M,N,Z)=>{let V={jsonrpc:"2.0",id:X.id,error:{code:M,message:N,...Z!==void 0&&{data:Z}}};B?.send(V).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)))};if(Q?.classification!==void 0){let M=Rz(Q.classification);if(M!==G.era){this._onerror(Error(`Era mismatch on inbound request '${X.method}': classified as ${M} but this instance serves ${G.era}`));let N=Q.classification.revision??M;F(K0.UnsupportedProtocolVersion,`Unsupported protocol version: ${N}`,{supported:this._supportedProtocolVersions,requested:N});return}}if(DG(X.method)&&!G.hasRequestMethod(X.method)){F(K0.MethodNotFound,"Method not found");return}let L=this._requestHandlers.get(X.method)??this.fallbackRequestHandler;if(L===void 0){F(K0.MethodNotFound,"Method not found");return}let J=G.checkInboundEnvelope(Y);if(J!==void 0){F(K0.InvalidParams,J);return}let z=(M,N)=>this._notificationViaCodec(this._resolveOutboundCodec(M.method),M,{...N,relatedRequestId:X.id}),K=(M,N,Z)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(M.method),M,N,{...Z,relatedRequestId:X.id}),H=new AbortController;this._requestHandlerAbortControllers.set(X.id,H);let D=Y.inputResponses===void 0?void 0:NV(Y.inputResponses),I={sessionId:B?.sessionId,mcpReq:{id:X.id,method:X.method,_meta:X.params?._meta,...Y.envelope!==void 0&&{envelope:Y.envelope},...D!==void 0&&{inputResponses:D.accepted},...D!==void 0&&D.droppedKeys.length>0&&{droppedInputResponseKeys:D.droppedKeys},requestState:Y.requestState===void 0?UV:uW(Y.requestState),signal:H.signal,send:(M,N,Z)=>{let V=this._resolveOutboundCodec(M.method);if(this._assertOutboundRequestInEra(V,M.method),f9(N))return K(M,N,Z);let U=Cz(V,M.method);if(U===void 0)throw TypeError(`'${M.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return K(M,U,N)},notify:z},http:Q?.authInfo?{authInfo:Q.authInfo}:void 0},A=this.buildContext(I,Q);Promise.resolve().then(()=>L(X,A)).then(async(M)=>{if(H.signal.aborted)return;let N;try{N=G.encodeResult(X.method,M,this._outboundServerInfo())}catch(V){this._onerror(Error(`Failed to encode result for ${X.method}: ${V}`)),F(K0.InternalError,"Internal error");return}let Z={result:N,jsonrpc:"2.0",id:X.id};await B?.send(Z)},async(M)=>{if(H.signal.aborted)return;let N=Number.isSafeInteger(M.code)?M.code:K0.InternalError,Z={jsonrpc:"2.0",id:X.id,error:{code:G.encodeErrorCode(N),message:M.message??"Internal error",...M.data!==void 0&&{data:M.data}}};await B?.send(Z)}).catch((M)=>this._onerror(Error(`Failed to send response: ${M}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(X.id)===H)this._requestHandlerAbortControllers.delete(X.id)})}_onprogress(W){let{progressToken:Q,...X}=W.params,Y=Number(Q),G=this._progressHandlers.get(Y);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(W)}`));return}let B=this._responseHandlers.get(Y),F=this._timeoutInfo.get(Y);if(F&&B&&F.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(L){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),B(L);return}G(X)}_onresponse(W){let Q=Number(W.id),X=this._responseHandlers.get(Q);if(X===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(W)}`));return}if(this._responseHandlers.delete(Q),this._cleanupTimeout(Q),this._progressHandlers.delete(Q),EG(W))X(W);else X(N0.fromError(W.error.code,W.error.message,W.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(W,Q,X){let Y=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(Y,W.method),f9(Q))return this._requestWithSchemaViaCodec(Y,W,Q,X);let G=Cz(Y,W.method);if(G===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(Y,W,G,Q)}_negotiatedWireCodec(){return g9(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(W){if(this._negotiatedProtocolVersion===void 0){let Q=ZV(W);if(Q)return Q}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(W,Q){if(DG(Q)&&!W.hasRequestMethod(Q))throw new O0(S0.MethodNotSupportedByProtocolVersion,`Method '${Q}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q,era:W.era})}_requestWithSchema(W,Q,X){let Y=this._resolveOutboundCodec(W.method);return this._assertOutboundRequestInEra(Y,W.method),this._requestWithSchemaViaCodec(Y,W,Q,X)}_requestWithSchemaViaCodec(W,Q,X,Y){let{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L}=Y??{},J=Date.now(),z,K;return new Promise((H,D)=>{let I=(O)=>{D(O)};if(!this._transport){I(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(Q.method)}catch(O){I(O);return}if(Y?.signal?.aborted){let O=Y.signal.reason;throw O instanceof O0?O:new O0(S0.RequestTimeout,String(O))}let A=W.era===gG&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,M=this._requestMessageId++;K=M;let N={...Q,jsonrpc:"2.0",id:M};if(Y?.onprogress)this._progressHandlers.set(M,Y.onprogress),N.params={...Q.params,_meta:{...Q.params?._meta,progressToken:M}};let Z=this._envelopeOutbound(N),V=!1,U=(O)=>{if(V)return;if(this._progressHandlers.delete(M),A===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(O)}}),{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));else A.abort();D(O instanceof O0?O:new O0(S0.RequestTimeout,String(O)))};this._responseHandlers.set(M,(O)=>{if(Y?.signal?.aborted)return;if(V=!0,O instanceof Error)return D(O);let w;try{w=W.decodeResult(Q.method,O.result)}catch(k){return D(k instanceof Error?k:Error(String(k)))}if(w.kind==="invalid")return D(w.error);if(w.kind==="input_required"){if(Y?.allowInputRequired===!0)return H(VV(w));let k={codec:W,request:Q,resultSchema:X,options:Y,flowStartedAt:J,retry:(l,_)=>this._requestWithSchemaViaCodec(W,l===void 0?{method:Q.method}:{method:Q.method,params:l},X,_)};return H(this._resolveNonCompleteResult(w,k))}let R=w.result;R4(X,R).then((k)=>{if(k.success)H(k.data);else D(new O0(S0.InvalidResult,`Invalid result for ${Q.method}: ${k.error}`))},D)}),z=()=>U(Y?.signal?.reason),Y?.signal?.addEventListener("abort",z,{once:!0});let j=Y?.timeout??zK,T=()=>U(new O0(S0.RequestTimeout,"Request timed out",{timeout:j}));this._setupTimeout(M,j,Y?.maxTotalTimeout,T,Y?.resetTimeoutOnProgress??!1),this._transport.send(Z,{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L,requestSignal:A?.signal}).catch((O)=>{this._progressHandlers.delete(M),D(O)})}).finally(()=>{if(z)Y?.signal?.removeEventListener("abort",z);if(K!==void 0)this._responseHandlers.delete(K),this._cleanupTimeout(K)})}async notification(W,Q){return this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,Q)}async _notificationViaCodec(W,Q,X){if(!this._transport)throw new O0(S0.NotConnected,"Not connected");if(MG(Q.method)&&!W.hasNotificationMethod(Q.method))throw new O0(S0.MethodNotSupportedByProtocolVersion,`Notification '${Q.method}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q.method,era:W.era});this.assertNotificationCapability(Q.method);let Y=this._envelopeOutbound({jsonrpc:"2.0",...Q});if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;this._transport?.send(Y,X).catch((G)=>this._onerror(G))});return}await this._transport.send(Y,X)}setRequestHandler(W,Q,X){this.assertRequestHandlerCapability(W);let Y;if(typeof Q==="function"){if(!DG(W))throw TypeError(`'${W}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);Y=(G,B)=>{let F=this._negotiatedWireCodec(),L=F.validateRequest(W,G);if(!L.ok&&L.reason==="not-in-era")L=F.validateInputRequest(W,G);if(!L.ok){if(L.reason==="not-in-era")throw new N0(K0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(L.message)}return Promise.resolve(Q(L.value,B))}}else if(X)Y=async(G,B)=>{let F=await R4(Q.params,{...G.params});if(!F.success)throw new N0(K0.InvalidParams,`Invalid params for ${W}: ${F.error}`);return X(F.data,B)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(W,this._wrapHandler(W,Y))}_wrapHandler(W,Q){return Q}_outboundServerInfo(){}removeRequestHandler(W){this._requestHandlers.delete(W)}assertCanSetRequestHandler(W){if(this._requestHandlers.has(W))throw Error(`A request handler for ${W} already exists, which would be overridden`)}setNotificationHandler(W,Q,X){if(typeof Q==="function"){if(!MG(W))throw TypeError(`'${W}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(W,(Y,G)=>{let B=G.validateNotification(W,Y);if(!B.ok){if(B.reason==="not-in-era")throw new N0(K0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(B.message)}return Promise.resolve(Q(B.value))});return}if(!X)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(W,async(Y)=>{let G=await R4(Q.params,{...Y.params});if(!G.success)throw new N0(K0.InvalidParams,`Invalid params for notification ${W}: ${G.error}`);await X(G.data,Y)})}removeNotificationHandler(W){this._notificationHandlers.delete(W)}};/*!
69
+ * content-type
70
+ * Copyright(c) 2015 Douglas Christopher Wilson
71
+ * MIT Licensed
72
+ */wV=Q0((W)=>{var Q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,X=/\\([\u000b\u0020-\u00ff])/g,Y=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;W.parse=G;function G(L){if(!L)throw TypeError("argument string is required");var J=typeof L==="object"?B(L):L;if(typeof J!=="string")throw TypeError("argument string is required to be a string");var z=J.indexOf(";"),K=z!==-1?J.slice(0,z).trim():J.trim();if(!Y.test(K))throw TypeError("invalid media type");var H=new F(K.toLowerCase());if(z!==-1){var D,I,A;Q.lastIndex=z;while(I=Q.exec(J)){if(I.index!==z)throw TypeError("invalid parameter format");if(z+=I[0].length,D=I[1].toLowerCase(),A=I[2],A.charCodeAt(0)===34){if(A=A.slice(1,-1),A.indexOf("\\")!==-1)A=A.replace(X,"$1")}H.parameters[D]=A}if(z!==J.length)throw TypeError("invalid parameter format")}return H}function B(L){var J;if(typeof L.getHeader==="function")J=L.getHeader("content-type");else if(typeof L.headers==="object")J=L.headers&&L.headers["content-type"];if(typeof J!=="string")throw TypeError("content-type header is missing from object");return J}function F(L){this.parameters=Object.create(null),this.type=L}}),UT=BQ(wV(),1);DV=/^[A-Za-z0-9._-]{1,128}$/});function fw(){let W=new vw.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return gw(W),W}var oQ,KK,E0,k0,g6,sQ,TV,ZK,HK,aQ,RV,f6,PV,bV,$K,SV,tQ,lW,eQ,mW,WX,qV,UK,CV,kV,vV,AK,yV,rG,NK,_V,gV,fV,xV,hV,uV,lV,mV,oG,cV,pV,dV,VK,wK,DK,iV,nV,rV,aG,oV,MK,aV,sV,tV,eV,Ww,Qw,Xw,Yw,jK,Gw,OK,EK,Bw,Fw,IK,Lw,TK,RK,PK,Jw,zw,Kw,Zw,Hw,$w,Uw,Aw,Nw,Vw,ww,Dw,Mw,jw,Ow,Ew,Iw,Tw,Rw,Pw,bw,Sw,qw,Cw,kw,vw,yw,_w,gw,QX=class{_ajv;_userAjv;constructor(W){this._userAjv=W!==void 0,this._ajv=W}get ajv(){return this._ajv??=fw()}getValidator(W){if(!this._userAjv&&"$schema"in W&&typeof W.$schema==="string"&&!_w.has(W.$schema.replace(/#$/,""))){let Y=W.$schema.slice(0,200);throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${Y}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let Q=this.ajv,X="$id"in W&&typeof W.$id==="string"?Q.getSchema(W.$id)??Q.compile(W):Q.compile(W);return(Y)=>{return X(Y)?{valid:!0,data:Y,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Q.errorsText(X.errors)}}}},IT;var bK=H0(()=>{hX();oQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var Q=class{};W._CodeOrName=Q,W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var X=class extends Q{constructor(Z){super();if(!W.IDENTIFIER.test(Z))throw Error("CodeGen: name must be a valid identifier");this.str=Z}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};W.Name=X;var Y=class extends Q{constructor(Z){super();this._items=typeof Z==="string"?[Z]:Z}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let Z=this._items[0];return Z===""||Z==='""'}get str(){var Z;return(Z=this._str)!==null&&Z!==void 0?Z:this._str=this._items.reduce((V,U)=>`${V}${U}`,"")}get names(){var Z;return(Z=this._names)!==null&&Z!==void 0?Z:this._names=this._items.reduce((V,U)=>{if(U instanceof X)V[U.str]=(V[U.str]||0)+1;return V},{})}};W._Code=Y,W.nil=new Y("");function G(Z,...V){let U=[Z[0]],j=0;while(j<V.length)L(U,V[j]),U.push(Z[++j]);return new Y(U)}W._=G;let B=new Y("+");function F(Z,...V){let U=[I(Z[0])],j=0;while(j<V.length)U.push(B),L(U,V[j]),U.push(B,I(Z[++j]));return J(U),new Y(U)}W.str=F;function L(Z,V){if(V instanceof Y)Z.push(...V._items);else if(V instanceof X)Z.push(V);else Z.push(H(V))}W.addCodeArg=L;function J(Z){let V=1;while(V<Z.length-1){if(Z[V]===B){let U=z(Z[V-1],Z[V+1]);if(U!==void 0){Z.splice(V-1,3,U);continue}Z[V++]="+"}V++}}function z(Z,V){if(V==='""')return Z;if(Z==='""')return V;if(typeof Z=="string"){if(V instanceof X||Z[Z.length-1]!=='"')return;if(typeof V!="string")return`${Z.slice(0,-1)}${V}"`;if(V[0]==='"')return Z.slice(0,-1)+V.slice(1);return}if(typeof V=="string"&&V[0]==='"'&&!(Z instanceof X))return`"${Z}${V.slice(1)}`}function K(Z,V){return V.emptyStr()?Z:Z.emptyStr()?V:F`${Z}${V}`}W.strConcat=K;function H(Z){return typeof Z=="number"||typeof Z=="boolean"||Z===null?Z:I(Array.isArray(Z)?Z.join(","):Z)}function D(Z){return new Y(I(Z))}W.stringify=D;function I(Z){return JSON.stringify(Z).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=I;function A(Z){return typeof Z=="string"&&W.IDENTIFIER.test(Z)?new Y(`.${Z}`):G`[${Z}]`}W.getProperty=A;function M(Z){if(typeof Z=="string"&&W.IDENTIFIER.test(Z))return new Y(`${Z}`);throw Error(`CodeGen: invalid export name: ${Z}, use explicit $id name mapping`)}W.getEsmExportName=M;function N(Z){return new Y(Z.toString())}W.regexpCode=N}),KK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.ValueScope=W.ValueScopeName=W.Scope=W.varKinds=W.UsedValueState=void 0;let Q=oQ();var X=class extends Error{constructor(J){super(`CodeGen: "code" for ${J} not defined`);this.value=J.value}},Y;(function(J){J[J.Started=0]="Started",J[J.Completed=1]="Completed"})(Y||(W.UsedValueState=Y={})),W.varKinds={const:new Q.Name("const"),let:new Q.Name("let"),var:new Q.Name("var")};var G=class{constructor({prefixes:J,parent:z}={}){this._names={},this._prefixes=J,this._parent=z}toName(J){return J instanceof Q.Name?J:this.name(J)}name(J){return new Q.Name(this._newName(J))}_newName(J){let z=this._names[J]||this._nameGroup(J);return`${J}${z.index++}`}_nameGroup(J){var z,K;if(((K=(z=this._parent)===null||z===void 0?void 0:z._prefixes)===null||K===void 0?void 0:K.has(J))||this._prefixes&&!this._prefixes.has(J))throw Error(`CodeGen: prefix "${J}" is not allowed in this scope`);return this._names[J]={prefix:J,index:0}}};W.Scope=G;var B=class extends Q.Name{constructor(J,z){super(z);this.prefix=J}setValue(J,{property:z,itemIndex:K}){this.value=J,this.scopePath=Q._`.${new Q.Name(z)}[${K}]`}};W.ValueScopeName=B;let F=Q._`\n`;var L=class extends G{constructor(J){super(J);this._values={},this._scope=J.scope,this.opts={...J,_n:J.lines?F:Q.nil}}get(){return this._scope}name(J){return new B(J,this._newName(J))}value(J,z){var K;if(z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let H=this.toName(J),{prefix:D}=H,I=(K=z.key)!==null&&K!==void 0?K:z.ref,A=this._values[D];if(A){let Z=A.get(I);if(Z)return Z}else A=this._values[D]=new Map;A.set(I,H);let M=this._scope[D]||(this._scope[D]=[]),N=M.length;return M[N]=z.ref,H.setValue(z,{property:D,itemIndex:N}),H}getValue(J,z){let K=this._values[J];if(!K)return;return K.get(z)}scopeRefs(J,z=this._values){return this._reduceValues(z,(K)=>{if(K.scopePath===void 0)throw Error(`CodeGen: name "${K}" has no value`);return Q._`${J}${K.scopePath}`})}scopeCode(J=this._values,z,K){return this._reduceValues(J,(H)=>{if(H.value===void 0)throw Error(`CodeGen: name "${H}" has no value`);return H.value.code},z,K)}_reduceValues(J,z,K={},H){let D=Q.nil;for(let I in J){let A=J[I];if(!A)continue;let M=K[I]=K[I]||new Map;A.forEach((N)=>{if(M.has(N))return;M.set(N,Y.Started);let Z=z(N);if(Z){let V=this.opts.es5?W.varKinds.var:W.varKinds.const;D=Q._`${D}${V} ${N} = ${Z};${this.opts._n}`}else if(Z=H===null||H===void 0?void 0:H(N))D=Q._`${D}${Z}${this.opts._n}`;else throw new X(N);M.set(N,Y.Completed)})}return D}};W.ValueScope=L}),E0=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.or=W.and=W.not=W.CodeGen=W.operators=W.varKinds=W.ValueScopeName=W.ValueScope=W.Scope=W.Name=W.regexpCode=W.stringify=W.getProperty=W.nil=W.strConcat=W.str=W._=void 0;let Q=oQ(),X=KK();var Y=oQ();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Y._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Y.str}}),Object.defineProperty(W,"strConcat",{enumerable:!0,get:function(){return Y.strConcat}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Y.nil}}),Object.defineProperty(W,"getProperty",{enumerable:!0,get:function(){return Y.getProperty}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Y.stringify}}),Object.defineProperty(W,"regexpCode",{enumerable:!0,get:function(){return Y.regexpCode}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Y.Name}});var G=KK();Object.defineProperty(W,"Scope",{enumerable:!0,get:function(){return G.Scope}}),Object.defineProperty(W,"ValueScope",{enumerable:!0,get:function(){return G.ValueScope}}),Object.defineProperty(W,"ValueScopeName",{enumerable:!0,get:function(){return G.ValueScopeName}}),Object.defineProperty(W,"varKinds",{enumerable:!0,get:function(){return G.varKinds}}),W.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var B=class{optimizeNodes(){return this}optimizeNames(E,b){return this}},F=class extends B{constructor(E,b,C){super();this.varKind=E,this.name=b,this.rhs=C}render({es5:E,_n:b}){let C=E?X.varKinds.var:this.varKind,c=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${c};`+b}optimizeNames(E,b){if(!E[this.name.str])return;if(this.rhs)this.rhs=p(this.rhs,E,b);return this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},L=class extends B{constructor(E,b,C){super();this.lhs=E,this.rhs=b,this.sideEffects=C}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,b){if(this.lhs instanceof Q.Name&&!E[this.lhs.str]&&!this.sideEffects)return;return this.rhs=p(this.rhs,E,b),this}get names(){return d(this.lhs instanceof Q.Name?{}:{...this.lhs.names},this.rhs)}},J=class extends L{constructor(E,b,C,c){super(E,C,c);this.op=b}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}},z=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}},K=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}},H=class extends B{constructor(E){super();this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}},D=class extends B{constructor(E){super();this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,b){return this.code=p(this.code,E,b),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},I=class extends B{constructor(E=[]){super();this.nodes=E}render(E){return this.nodes.reduce((b,C)=>b+C.render(E),"")}optimizeNodes(){let{nodes:E}=this,b=E.length;while(b--){let C=E[b].optimizeNodes();if(Array.isArray(C))E.splice(b,1,...C);else if(C)E[b]=C;else E.splice(b,1)}return E.length>0?this:void 0}optimizeNames(E,b){let{nodes:C}=this,c=C.length;while(c--){let r=C[c];if(r.optimizeNames(E,b))continue;z0(E,r.names),C.splice(c,1)}return C.length>0?this:void 0}get names(){return this.nodes.reduce((E,b)=>h(E,b.names),{})}},A=class extends I{render(E){return"{"+E._n+super.render(E)+"}"+E._n}},M=class extends I{},N=class extends A{};N.kind="else";var Z=class E extends A{constructor(b,C){super(C);this.condition=b}render(b){let C=`if(${this.condition})`+super.render(b);if(this.else)C+="else "+this.else.render(b);return C}optimizeNodes(){super.optimizeNodes();let b=this.condition;if(b===!0)return this.nodes;let C=this.else;if(C){let c=C.optimizeNodes();C=this.else=Array.isArray(c)?new N(c):c}if(C){if(b===!1)return C instanceof E?C:C.nodes;if(this.nodes.length)return this;return new E(M0(b),C instanceof E?[C]:C.nodes)}if(b===!1||!this.nodes.length)return;return this}optimizeNames(b,C){var c;if(this.else=(c=this.else)===null||c===void 0?void 0:c.optimizeNames(b,C),!(super.optimizeNames(b,C)||this.else))return;return this.condition=p(this.condition,b,C),this}get names(){let b=super.names;if(d(b,this.condition),this.else)h(b,this.else.names);return b}};Z.kind="if";var V=class extends A{};V.kind="for";var U=class extends V{constructor(E){super();this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,b){if(!super.optimizeNames(E,b))return;return this.iteration=p(this.iteration,E,b),this}get names(){return h(super.names,this.iteration.names)}},j=class extends V{constructor(E,b,C,c){super();this.varKind=E,this.name=b,this.from=C,this.to=c}render(E){let b=E.es5?X.varKinds.var:this.varKind,{name:C,from:c,to:r}=this;return`for(${b} ${C}=${c}; ${C}<${r}; ${C}++)`+super.render(E)}get names(){return d(d(super.names,this.from),this.to)}},T=class extends V{constructor(E,b,C,c){super();this.loop=E,this.varKind=b,this.name=C,this.iterable=c}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,b){if(!super.optimizeNames(E,b))return;return this.iterable=p(this.iterable,E,b),this}get names(){return h(super.names,this.iterable.names)}},O=class extends A{constructor(E,b,C){super();this.name=E,this.args=b,this.async=C}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}};O.kind="func";var w=class extends I{render(E){return"return "+super.render(E)}};w.kind="return";var R=class extends A{render(E){let b="try"+super.render(E);if(this.catch)b+=this.catch.render(E);if(this.finally)b+=this.finally.render(E);return b}optimizeNodes(){var E,b;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(b=this.finally)===null||b===void 0||b.optimizeNodes(),this}optimizeNames(E,b){var C,c;return super.optimizeNames(E,b),(C=this.catch)===null||C===void 0||C.optimizeNames(E,b),(c=this.finally)===null||c===void 0||c.optimizeNames(E,b),this}get names(){let E=super.names;if(this.catch)h(E,this.catch.names);if(this.finally)h(E,this.finally.names);return E}},k=class extends A{constructor(E){super();this.error=E}render(E){return`catch(${this.error})`+super.render(E)}};k.kind="catch";var l=class extends A{render(E){return"finally"+super.render(E)}};l.kind="finally";var _=class{constructor(E,b={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...b,_n:b.lines?`
73
+ `:""},this._extScope=E,this._scope=new X.Scope({parent:E}),this._nodes=[new M]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,b){let C=this._extScope.value(E,b);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(E,b){return this._extScope.getValue(E,b)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,b,C,c){let r=this._scope.toName(b);if(C!==void 0&&c)this._constants[r.str]=C;return this._leafNode(new F(E,r,C)),r}const(E,b,C){return this._def(X.varKinds.const,E,b,C)}let(E,b,C){return this._def(X.varKinds.let,E,b,C)}var(E,b,C){return this._def(X.varKinds.var,E,b,C)}assign(E,b,C){return this._leafNode(new L(E,b,C))}add(E,b){return this._leafNode(new J(E,W.operators.ADD,b))}code(E){if(typeof E=="function")E();else if(E!==Q.nil)this._leafNode(new D(E));return this}object(...E){let b=["{"];for(let[C,c]of E){if(b.length>1)b.push(",");if(b.push(C),C!==c||this.opts.es5)b.push(":"),(0,Q.addCodeArg)(b,c)}return b.push("}"),new Q._Code(b)}if(E,b,C){if(this._blockNode(new Z(E)),b&&C)this.code(b).else().code(C).endIf();else if(b)this.code(b).endIf();else if(C)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new Z(E))}else(){return this._elseNode(new N)}endIf(){return this._endBlockNode(Z,N)}_for(E,b){if(this._blockNode(E),b)this.code(b).endFor();return this}for(E,b){return this._for(new U(E),b)}forRange(E,b,C,c,r=this.opts.es5?X.varKinds.var:X.varKinds.let){let L0=this._scope.toName(E);return this._for(new j(r,L0,b,C),()=>c(L0))}forOf(E,b,C,c=X.varKinds.const){let r=this._scope.toName(E);if(this.opts.es5){let L0=b instanceof Q.Name?b:this.var("_arr",b);return this.forRange("_i",0,Q._`${L0}.length`,(e)=>{this.var(r,Q._`${L0}[${e}]`),C(r)})}return this._for(new T("of",c,r,b),()=>C(r))}forIn(E,b,C,c=this.opts.es5?X.varKinds.var:X.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,Q._`Object.keys(${b})`,C);let r=this._scope.toName(E);return this._for(new T("in",c,r,b),()=>C(r))}endFor(){return this._endBlockNode(V)}label(E){return this._leafNode(new z(E))}break(E){return this._leafNode(new K(E))}return(E){let b=new w;if(this._blockNode(b),this.code(E),b.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(E,b,C){if(!b&&!C)throw Error('CodeGen: "try" without "catch" and "finally"');let c=new R;if(this._blockNode(c),this.code(E),b){let r=this.name("e");this._currNode=c.catch=new k(r),b(r)}if(C)this._currNode=c.finally=new l,this.code(C);return this._endBlockNode(k,l)}throw(E){return this._leafNode(new H(E))}block(E,b){if(this._blockStarts.push(this._nodes.length),E)this.code(E).endBlock(b);return this}endBlock(E){let b=this._blockStarts.pop();if(b===void 0)throw Error("CodeGen: not in self-balancing block");let C=this._nodes.length-b;if(C<0||E!==void 0&&C!==E)throw Error(`CodeGen: wrong number of nodes: ${C} vs ${E} expected`);return this._nodes.length=b,this}func(E,b=Q.nil,C,c){if(this._blockNode(new O(E,b,C)),c)this.code(c).endFunc();return this}endFunc(){return this._endBlockNode(O)}optimize(E=1){while(E-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,b){let C=this._currNode;if(C instanceof E||b&&C instanceof b)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${b?`${E.kind}/${b.kind}`:E.kind}"`)}_elseNode(E){let b=this._currNode;if(!(b instanceof Z))throw Error('CodeGen: "else" without "if"');return this._currNode=b.else=E,this}get _root(){return this._nodes[0]}get _currNode(){let E=this._nodes;return E[E.length-1]}set _currNode(E){let b=this._nodes;b[b.length-1]=E}};W.CodeGen=_;function h(E,b){for(let C in b)E[C]=(E[C]||0)+(b[C]||0);return E}function d(E,b){return b instanceof Q._CodeOrName?h(E,b.names):E}function p(E,b,C){if(E instanceof Q.Name)return c(E);if(!r(E))return E;return new Q._Code(E._items.reduce((L0,e)=>{if(e instanceof Q.Name)e=c(e);if(e instanceof Q._Code)L0.push(...e._items);else L0.push(e);return L0},[]));function c(L0){let e=C[L0.str];if(e===void 0||b[L0.str]!==1)return L0;return delete b[L0.str],e}function r(L0){return L0 instanceof Q._Code&&L0._items.some((e)=>e instanceof Q.Name&&b[e.str]===1&&C[e.str]!==void 0)}}function z0(E,b){for(let C in b)E[C]=(E[C]||0)-(b[C]||0)}function M0(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:Q._`!${u(E)}`}W.not=M0;let V0=v(W.operators.AND);function P0(...E){return E.reduce(V0)}W.and=P0;let Z0=v(W.operators.OR);function S(...E){return E.reduce(Z0)}W.or=S;function v(E){return(b,C)=>b===Q.nil?C:C===Q.nil?b:Q._`${u(b)} ${E} ${u(C)}`}function u(E){return E instanceof Q.Name?E:Q._`(${E})`}}),k0=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;let Q=E0(),X=oQ();function Y(O){let w={};for(let R of O)w[R]=!0;return w}W.toHash=Y;function G(O,w){if(typeof w=="boolean")return w;if(Object.keys(w).length===0)return!0;return B(O,w),!F(w,O.self.RULES.all)}W.alwaysValidSchema=G;function B(O,w=O.schema){let{opts:R,self:k}=O;if(!R.strictSchema)return;if(typeof w==="boolean")return;let l=k.RULES.keywords;for(let _ in w)if(!l[_])T(O,`unknown keyword: "${_}"`)}W.checkUnknownRules=B;function F(O,w){if(typeof O=="boolean")return!O;for(let R in O)if(w[R])return!0;return!1}W.schemaHasRules=F;function L(O,w){if(typeof O=="boolean")return!O;for(let R in O)if(R!=="$ref"&&w.all[R])return!0;return!1}W.schemaHasRulesButRef=L;function J({topSchemaRef:O,schemaPath:w},R,k,l){if(!l){if(typeof R=="number"||typeof R=="boolean")return R;if(typeof R=="string")return Q._`${R}`}return Q._`${O}${w}${(0,Q.getProperty)(k)}`}W.schemaRefOrVal=J;function z(O){return D(decodeURIComponent(O))}W.unescapeFragment=z;function K(O){return encodeURIComponent(H(O))}W.escapeFragment=K;function H(O){if(typeof O=="number")return`${O}`;return O.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=H;function D(O){return O.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=D;function I(O,w){if(Array.isArray(O))for(let R of O)w(R);else w(O)}W.eachItem=I;function A({mergeNames:O,mergeToName:w,mergeValues:R,resultToName:k}){return(l,_,h,d)=>{let p=h===void 0?_:h instanceof Q.Name?(_ instanceof Q.Name?O(l,_,h):w(l,_,h),h):_ instanceof Q.Name?(w(l,h,_),_):R(_,h);return d===Q.Name&&!(p instanceof Q.Name)?k(l,p):p}}W.mergeEvaluated={props:A({mergeNames:(O,w,R)=>O.if(Q._`${R} !== true && ${w} !== undefined`,()=>{O.if(Q._`${w} === true`,()=>O.assign(R,!0),()=>O.assign(R,Q._`${R} || {}`).code(Q._`Object.assign(${R}, ${w})`))}),mergeToName:(O,w,R)=>O.if(Q._`${R} !== true`,()=>{if(w===!0)O.assign(R,!0);else O.assign(R,Q._`${R} || {}`),N(O,R,w)}),mergeValues:(O,w)=>O===!0?!0:{...O,...w},resultToName:M}),items:A({mergeNames:(O,w,R)=>O.if(Q._`${R} !== true && ${w} !== undefined`,()=>O.assign(R,Q._`${w} === true ? true : ${R} > ${w} ? ${R} : ${w}`)),mergeToName:(O,w,R)=>O.if(Q._`${R} !== true`,()=>O.assign(R,w===!0?!0:Q._`${R} > ${w} ? ${R} : ${w}`)),mergeValues:(O,w)=>O===!0?!0:Math.max(O,w),resultToName:(O,w)=>O.var("items",w)})};function M(O,w){if(w===!0)return O.var("props",!0);let R=O.var("props",Q._`{}`);if(w!==void 0)N(O,R,w);return R}W.evaluatedPropsToName=M;function N(O,w,R){Object.keys(R).forEach((k)=>O.assign(Q._`${w}${(0,Q.getProperty)(k)}`,!0))}W.setEvaluated=N;let Z={};function V(O,w){return O.scopeValue("func",{ref:w,code:Z[w.code]||(Z[w.code]=new X._Code(w.code))})}W.useFunc=V;var U;(function(O){O[O.Num=0]="Num",O[O.Str=1]="Str"})(U||(W.Type=U={}));function j(O,w,R){if(O instanceof Q.Name){let k=w===U.Num;return R?k?Q._`"[" + ${O} + "]"`:Q._`"['" + ${O} + "']"`:k?Q._`"/" + ${O}`:Q._`"/" + ${O}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return R?(0,Q.getProperty)(O).toString():"/"+H(O)}W.getErrorPath=j;function T(O,w,R=O.opts.strictSchema){if(!R)return;if(w=`strict mode: ${w}`,R===!0)throw Error(w);O.self.logger.warn(w)}W.checkStrictMode=T}),g6=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X={data:new Q.Name("data"),valCxt:new Q.Name("valCxt"),instancePath:new Q.Name("instancePath"),parentData:new Q.Name("parentData"),parentDataProperty:new Q.Name("parentDataProperty"),rootData:new Q.Name("rootData"),dynamicAnchors:new Q.Name("dynamicAnchors"),vErrors:new Q.Name("vErrors"),errors:new Q.Name("errors"),this:new Q.Name("this"),self:new Q.Name("self"),scope:new Q.Name("scope"),json:new Q.Name("json"),jsonPos:new Q.Name("jsonPos"),jsonLen:new Q.Name("jsonLen"),jsonPart:new Q.Name("jsonPart")};W.default=X}),sQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendErrors=W.resetErrorsCount=W.reportExtraError=W.reportError=W.keyword$DataError=W.keywordError=void 0;let Q=E0(),X=k0(),Y=g6();W.keywordError={message:({keyword:N})=>Q.str`must pass "${N}" keyword validation`},W.keyword$DataError={message:({keyword:N,schemaType:Z})=>Z?Q.str`"${N}" keyword must be ${Z} ($data)`:Q.str`"${N}" keyword is invalid ($data)`};function G(N,Z=W.keywordError,V,U){let{it:j}=N,{gen:T,compositeRule:O,allErrors:w}=j,R=H(N,Z,V);if(U!==null&&U!==void 0?U:O||w)J(T,R);else z(j,Q._`[${R}]`)}W.reportError=G;function B(N,Z=W.keywordError,V){let{it:U}=N,{gen:j,compositeRule:T,allErrors:O}=U;if(J(j,H(N,Z,V)),!(T||O))z(U,Y.default.vErrors)}W.reportExtraError=B;function F(N,Z){N.assign(Y.default.errors,Z),N.if(Q._`${Y.default.vErrors} !== null`,()=>N.if(Z,()=>N.assign(Q._`${Y.default.vErrors}.length`,Z),()=>N.assign(Y.default.vErrors,null)))}W.resetErrorsCount=F;function L({gen:N,keyword:Z,schemaValue:V,data:U,errsCount:j,it:T}){if(j===void 0)throw Error("ajv implementation error");let O=N.name("err");N.forRange("i",j,Y.default.errors,(w)=>{if(N.const(O,Q._`${Y.default.vErrors}[${w}]`),N.if(Q._`${O}.instancePath === undefined`,()=>N.assign(Q._`${O}.instancePath`,(0,Q.strConcat)(Y.default.instancePath,T.errorPath))),N.assign(Q._`${O}.schemaPath`,Q.str`${T.errSchemaPath}/${Z}`),T.opts.verbose)N.assign(Q._`${O}.schema`,V),N.assign(Q._`${O}.data`,U)})}W.extendErrors=L;function J(N,Z){let V=N.const("err",Z);N.if(Q._`${Y.default.vErrors} === null`,()=>N.assign(Y.default.vErrors,Q._`[${V}]`),Q._`${Y.default.vErrors}.push(${V})`),N.code(Q._`${Y.default.errors}++`)}function z(N,Z){let{gen:V,validateName:U,schemaEnv:j}=N;if(j.$async)V.throw(Q._`new ${N.ValidationError}(${Z})`);else V.assign(Q._`${U}.errors`,Z),V.return(!1)}let K={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function H(N,Z,V){let{createErrors:U}=N.it;if(U===!1)return Q._`{}`;return D(N,Z,V)}function D(N,Z,V={}){let{gen:U,it:j}=N,T=[I(j,V),A(N,V)];return M(N,Z,T),U.object(...T)}function I({errorPath:N},{instancePath:Z}){let V=Z?Q.str`${N}${(0,X.getErrorPath)(Z,X.Type.Str)}`:N;return[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,V)]}function A({keyword:N,it:{errSchemaPath:Z}},{schemaPath:V,parentSchema:U}){let j=U?Z:Q.str`${Z}/${N}`;if(V)j=Q.str`${j}${(0,X.getErrorPath)(V,X.Type.Str)}`;return[K.schemaPath,j]}function M(N,{params:Z,message:V},U){let{keyword:j,data:T,schemaValue:O,it:w}=N,{opts:R,propertyName:k,topSchemaRef:l,schemaPath:_}=w;if(U.push([K.keyword,j],[K.params,typeof Z=="function"?Z(N):Z||Q._`{}`]),R.messages)U.push([K.message,typeof V=="function"?V(N):V]);if(R.verbose)U.push([K.schema,O],[K.parentSchema,Q._`${l}${_}`],[Y.default.data,T]);if(k)U.push([K.propertyName,k])}}),TV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.boolOrEmptySchema=W.topBoolOrEmptySchema=void 0;let Q=sQ(),X=E0(),Y=g6(),G={message:"boolean schema is false"};function B(J){let{gen:z,schema:K,validateName:H}=J;if(K===!1)L(J,!1);else if(typeof K=="object"&&K.$async===!0)z.return(Y.default.data);else z.assign(X._`${H}.errors`,null),z.return(!0)}W.topBoolOrEmptySchema=B;function F(J,z){let{gen:K,schema:H}=J;if(H===!1)K.var(z,!1),L(J);else K.var(z,!0)}W.boolOrEmptySchema=F;function L(J,z){let{gen:K,data:H}=J,D={gen:K,keyword:"false schema",data:H,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:J};(0,Q.reportError)(D,G,void 0,z)}}),ZK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getRules=W.isJSONType=void 0;let Q=new Set(["string","number","integer","boolean","null","object","array"]);function X(G){return typeof G=="string"&&Q.has(G)}W.isJSONType=X;function Y(){let G={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...G,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},G.number,G.string,G.array,G.object],post:{rules:[]},all:{},keywords:{}}}W.getRules=Y}),HK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.shouldUseRule=W.shouldUseGroup=W.schemaHasRulesForType=void 0;function Q({schema:G,self:B},F){let L=B.RULES.types[F];return L&&L!==!0&&X(G,L)}W.schemaHasRulesForType=Q;function X(G,B){return B.rules.some((F)=>Y(G,F))}W.shouldUseGroup=X;function Y(G,B){var F;return G[B.keyword]!==void 0||((F=B.definition.implements)===null||F===void 0?void 0:F.some((L)=>G[L]!==void 0))}W.shouldUseRule=Y}),aQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.reportTypeError=W.checkDataTypes=W.checkDataType=W.coerceAndCheckDataType=W.getJSONTypes=W.getSchemaTypes=W.DataType=void 0;let Q=ZK(),X=HK(),Y=sQ(),G=E0(),B=k0();var F;(function(U){U[U.Correct=0]="Correct",U[U.Wrong=1]="Wrong"})(F||(W.DataType=F={}));function L(U){let j=J(U.type);if(j.includes("null")){if(U.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!j.length&&U.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(U.nullable===!0)j.push("null")}return j}W.getSchemaTypes=L;function J(U){let j=Array.isArray(U)?U:U?[U]:[];if(j.every(Q.isJSONType))return j;throw Error("type must be JSONType or JSONType[]: "+j.join(","))}W.getJSONTypes=J;function z(U,j){let{gen:T,data:O,opts:w}=U,R=H(j,w.coerceTypes),k=j.length>0&&!(R.length===0&&j.length===1&&(0,X.schemaHasRulesForType)(U,j[0]));if(k){let l=M(j,O,w.strictNumbers,F.Wrong);T.if(l,()=>{if(R.length)D(U,j,R);else Z(U)})}return k}W.coerceAndCheckDataType=z;let K=new Set(["string","number","integer","boolean","null"]);function H(U,j){return j?U.filter((T)=>K.has(T)||j==="array"&&T==="array"):[]}function D(U,j,T){let{gen:O,data:w,opts:R}=U,k=O.let("dataType",G._`typeof ${w}`),l=O.let("coerced",G._`undefined`);if(R.coerceTypes==="array")O.if(G._`${k} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>O.assign(w,G._`${w}[0]`).assign(k,G._`typeof ${w}`).if(M(j,w,R.strictNumbers),()=>O.assign(l,w)));O.if(G._`${l} !== undefined`);for(let h of T)if(K.has(h)||h==="array"&&R.coerceTypes==="array")_(h);O.else(),Z(U),O.endIf(),O.if(G._`${l} !== undefined`,()=>{O.assign(w,l),I(U,l)});function _(h){switch(h){case"string":O.elseIf(G._`${k} == "number" || ${k} == "boolean"`).assign(l,G._`"" + ${w}`).elseIf(G._`${w} === null`).assign(l,G._`""`);return;case"number":O.elseIf(G._`${k} == "boolean" || ${w} === null
74
+ || (${k} == "string" && ${w} && ${w} == +${w})`).assign(l,G._`+${w}`);return;case"integer":O.elseIf(G._`${k} === "boolean" || ${w} === null
75
+ || (${k} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(l,G._`+${w}`);return;case"boolean":O.elseIf(G._`${w} === "false" || ${w} === 0 || ${w} === null`).assign(l,!1).elseIf(G._`${w} === "true" || ${w} === 1`).assign(l,!0);return;case"null":O.elseIf(G._`${w} === "" || ${w} === 0 || ${w} === false`),O.assign(l,null);return;case"array":O.elseIf(G._`${k} === "string" || ${k} === "number"
76
+ || ${k} === "boolean" || ${w} === null`).assign(l,G._`[${w}]`)}}}function I({gen:U,parentData:j,parentDataProperty:T},O){U.if(G._`${j} !== undefined`,()=>U.assign(G._`${j}[${T}]`,O))}function A(U,j,T,O=F.Correct){let w=O===F.Correct?G.operators.EQ:G.operators.NEQ,R;switch(U){case"null":return G._`${j} ${w} null`;case"array":R=G._`Array.isArray(${j})`;break;case"object":R=G._`${j} && typeof ${j} == "object" && !Array.isArray(${j})`;break;case"integer":R=k(G._`!(${j} % 1) && !isNaN(${j})`);break;case"number":R=k();break;default:return G._`typeof ${j} ${w} ${U}`}return O===F.Correct?R:(0,G.not)(R);function k(l=G.nil){return(0,G.and)(G._`typeof ${j} == "number"`,l,T?G._`isFinite(${j})`:G.nil)}}W.checkDataType=A;function M(U,j,T,O){if(U.length===1)return A(U[0],j,T,O);let w,R=(0,B.toHash)(U);if(R.array&&R.object){let k=G._`typeof ${j} != "object"`;w=R.null?k:G._`!${j} || ${k}`,delete R.null,delete R.array,delete R.object}else w=G.nil;if(R.number)delete R.integer;for(let k in R)w=(0,G.and)(w,A(k,j,T,O));return w}W.checkDataTypes=M;let N={message:({schema:U})=>`must be ${U}`,params:({schema:U,schemaValue:j})=>typeof U=="string"?G._`{type: ${U}}`:G._`{type: ${j}}`};function Z(U){let j=V(U);(0,Y.reportError)(j,N)}W.reportTypeError=Z;function V(U){let{gen:j,data:T,schema:O}=U,w=(0,B.schemaRefOrVal)(U,O,"type");return{gen:j,keyword:"type",data:T,schema:O.type,schemaCode:w,schemaValue:w,parentSchema:O,params:{},it:U}}}),RV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.assignDefaults=void 0;let Q=E0(),X=k0();function Y(B,F){let{properties:L,items:J}=B.schema;if(F==="object"&&L)for(let z in L)G(B,z,L[z].default);else if(F==="array"&&Array.isArray(J))J.forEach((z,K)=>G(B,K,z.default))}W.assignDefaults=Y;function G(B,F,L){let{gen:J,compositeRule:z,data:K,opts:H}=B;if(L===void 0)return;let D=Q._`${K}${(0,Q.getProperty)(F)}`;if(z){(0,X.checkStrictMode)(B,`default is ignored for: ${D}`);return}let I=Q._`${D} === undefined`;if(H.useDefaults==="empty")I=Q._`${I} || ${D} === null || ${D} === ""`;J.if(I,Q._`${D} = ${(0,Q.stringify)(L)}`)}}),f6=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateUnion=W.validateArray=W.usePattern=W.callValidateCode=W.schemaProperties=W.allSchemaProperties=W.noPropertyInData=W.propertyInData=W.isOwnProperty=W.hasPropFunc=W.reportMissingProp=W.checkMissingProp=W.checkReportMissingProp=void 0;let Q=E0(),X=k0(),Y=g6(),G=k0();function B(U,j){let{gen:T,data:O,it:w}=U;T.if(H(T,O,j,w.opts.ownProperties),()=>{U.setParams({missingProperty:Q._`${j}`},!0),U.error()})}W.checkReportMissingProp=B;function F({gen:U,data:j,it:{opts:T}},O,w){return(0,Q.or)(...O.map((R)=>(0,Q.and)(H(U,j,R,T.ownProperties),Q._`${w} = ${R}`)))}W.checkMissingProp=F;function L(U,j){U.setParams({missingProperty:j},!0),U.error()}W.reportMissingProp=L;function J(U){return U.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Q._`Object.prototype.hasOwnProperty`})}W.hasPropFunc=J;function z(U,j,T){return Q._`${J(U)}.call(${j}, ${T})`}W.isOwnProperty=z;function K(U,j,T,O){let w=Q._`${j}${(0,Q.getProperty)(T)} !== undefined`;return O?Q._`${w} && ${z(U,j,T)}`:w}W.propertyInData=K;function H(U,j,T,O){let w=Q._`${j}${(0,Q.getProperty)(T)} === undefined`;return O?(0,Q.or)(w,(0,Q.not)(z(U,j,T))):w}W.noPropertyInData=H;function D(U){return U?Object.keys(U).filter((j)=>j!=="__proto__"):[]}W.allSchemaProperties=D;function I(U,j){return D(j).filter((T)=>!(0,X.alwaysValidSchema)(U,j[T]))}W.schemaProperties=I;function A({schemaCode:U,data:j,it:{gen:T,topSchemaRef:O,schemaPath:w,errorPath:R},it:k},l,_,h){let d=h?Q._`${U}, ${j}, ${O}${w}`:j,p=[[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,R)],[Y.default.parentData,k.parentData],[Y.default.parentDataProperty,k.parentDataProperty],[Y.default.rootData,Y.default.rootData]];if(k.opts.dynamicRef)p.push([Y.default.dynamicAnchors,Y.default.dynamicAnchors]);let z0=Q._`${d}, ${T.object(...p)}`;return _!==Q.nil?Q._`${l}.call(${_}, ${z0})`:Q._`${l}(${z0})`}W.callValidateCode=A;let M=Q._`new RegExp`;function N({gen:U,it:{opts:j}},T){let O=j.unicodeRegExp?"u":"",{regExp:w}=j.code,R=w(T,O);return U.scopeValue("pattern",{key:R.toString(),ref:R,code:Q._`${w.code==="new RegExp"?M:(0,G.useFunc)(U,w)}(${T}, ${O})`})}W.usePattern=N;function Z(U){let{gen:j,data:T,keyword:O,it:w}=U,R=j.name("valid");if(w.allErrors){let l=j.let("valid",!0);return k(()=>j.assign(l,!1)),l}return j.var(R,!0),k(()=>j.break()),R;function k(l){let _=j.const("len",Q._`${T}.length`);j.forRange("i",0,_,(h)=>{U.subschema({keyword:O,dataProp:h,dataPropType:X.Type.Num},R),j.if((0,Q.not)(R),l)})}}W.validateArray=Z;function V(U){let{gen:j,schema:T,keyword:O,it:w}=U;if(!Array.isArray(T))throw Error("ajv implementation error");if(T.some((l)=>(0,X.alwaysValidSchema)(w,l))&&!w.opts.unevaluated)return;let R=j.let("valid",!1),k=j.name("_valid");j.block(()=>T.forEach((l,_)=>{let h=U.subschema({keyword:O,schemaProp:_,compositeRule:!0},k);if(j.assign(R,Q._`${R} || ${k}`),!U.mergeValidEvaluated(h,k))j.if((0,Q.not)(R))})),U.result(R,()=>U.reset(),()=>U.error(!0))}W.validateUnion=V}),PV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateKeywordUsage=W.validSchemaType=W.funcKeywordCode=W.macroKeywordCode=void 0;let Q=E0(),X=g6(),Y=f6(),G=sQ();function B(I,A){let{gen:M,keyword:N,schema:Z,parentSchema:V,it:U}=I,j=A.macro.call(U.self,Z,V,U),T=K(M,N,j);if(U.opts.validateSchema!==!1)U.self.validateSchema(j,!0);let O=M.name("valid");I.subschema({schema:j,schemaPath:Q.nil,errSchemaPath:`${U.errSchemaPath}/${N}`,topSchemaRef:T,compositeRule:!0},O),I.pass(O,()=>I.error(!0))}W.macroKeywordCode=B;function F(I,A){var M;let{gen:N,keyword:Z,schema:V,parentSchema:U,$data:j,it:T}=I;z(T,A);let O=K(N,Z,!j&&A.compile?A.compile.call(T.self,V,U,T):A.validate),w=N.let("valid");I.block$data(w,R),I.ok((M=A.valid)!==null&&M!==void 0?M:w);function R(){if(A.errors===!1){if(_(),A.modifying)L(I);h(()=>I.error())}else{let d=A.async?k():l();if(A.modifying)L(I);h(()=>J(I,d))}}function k(){let d=N.let("ruleErrs",null);return N.try(()=>_(Q._`await `),(p)=>N.assign(w,!1).if(Q._`${p} instanceof ${T.ValidationError}`,()=>N.assign(d,Q._`${p}.errors`),()=>N.throw(p))),d}function l(){let d=Q._`${O}.errors`;return N.assign(d,null),_(Q.nil),d}function _(d=A.async?Q._`await `:Q.nil){let p=T.opts.passContext?X.default.this:X.default.self,z0=!(("compile"in A)&&!j||A.schema===!1);N.assign(w,Q._`${d}${(0,Y.callValidateCode)(I,O,p,z0)}`,A.modifying)}function h(d){var p;N.if((0,Q.not)((p=A.valid)!==null&&p!==void 0?p:w),d)}}W.funcKeywordCode=F;function L(I){let{gen:A,data:M,it:N}=I;A.if(N.parentData,()=>A.assign(M,Q._`${N.parentData}[${N.parentDataProperty}]`))}function J(I,A){let{gen:M}=I;M.if(Q._`Array.isArray(${A})`,()=>{M.assign(X.default.vErrors,Q._`${X.default.vErrors} === null ? ${A} : ${X.default.vErrors}.concat(${A})`).assign(X.default.errors,Q._`${X.default.vErrors}.length`),(0,G.extendErrors)(I)},()=>I.error())}function z({schemaEnv:I},A){if(A.async&&!I.$async)throw Error("async keyword in sync schema")}function K(I,A,M){if(M===void 0)throw Error(`keyword "${A}" failed to compile`);return I.scopeValue("keyword",typeof M=="function"?{ref:M}:{ref:M,code:(0,Q.stringify)(M)})}function H(I,A,M=!1){return!A.length||A.some((N)=>N==="array"?Array.isArray(I):N==="object"?I&&typeof I=="object"&&!Array.isArray(I):typeof I==N||M&&typeof I>"u")}W.validSchemaType=H;function D({schema:I,opts:A,self:M,errSchemaPath:N},Z,V){if(Array.isArray(Z.keyword)?!Z.keyword.includes(V):Z.keyword!==V)throw Error("ajv implementation error");let U=Z.dependencies;if(U===null||U===void 0?void 0:U.some((j)=>!Object.prototype.hasOwnProperty.call(I,j)))throw Error(`parent schema must have dependencies of ${V}: ${U.join(",")}`);if(Z.validateSchema){if(!Z.validateSchema(I[V])){let j=`keyword "${V}" value is invalid at path "${N}": `+M.errorsText(Z.validateSchema.errors);if(A.validateSchema==="log")M.logger.error(j);else throw Error(j)}}}W.validateKeywordUsage=D}),bV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendSubschemaMode=W.extendSubschemaData=W.getSubschema=void 0;let Q=E0(),X=k0();function Y(F,{keyword:L,schemaProp:J,schema:z,schemaPath:K,errSchemaPath:H,topSchemaRef:D}){if(L!==void 0&&z!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(L!==void 0){let I=F.schema[L];return J===void 0?{schema:I,schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}`,errSchemaPath:`${F.errSchemaPath}/${L}`}:{schema:I[J],schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}${(0,Q.getProperty)(J)}`,errSchemaPath:`${F.errSchemaPath}/${L}/${(0,X.escapeFragment)(J)}`}}if(z!==void 0){if(K===void 0||H===void 0||D===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:z,schemaPath:K,topSchemaRef:D,errSchemaPath:H}}throw Error('either "keyword" or "schema" must be passed')}W.getSubschema=Y;function G(F,L,{dataProp:J,dataPropType:z,data:K,dataTypes:H,propertyName:D}){if(K!==void 0&&J!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:I}=L;if(J!==void 0){let{errorPath:M,dataPathArr:N,opts:Z}=L;A(I.let("data",Q._`${L.data}${(0,Q.getProperty)(J)}`,!0)),F.errorPath=Q.str`${M}${(0,X.getErrorPath)(J,z,Z.jsPropertySyntax)}`,F.parentDataProperty=Q._`${J}`,F.dataPathArr=[...N,F.parentDataProperty]}if(K!==void 0){if(A(K instanceof Q.Name?K:I.let("data",K,!0)),D!==void 0)F.propertyName=D}if(H)F.dataTypes=H;function A(M){F.data=M,F.dataLevel=L.dataLevel+1,F.dataTypes=[],L.definedProperties=new Set,F.parentData=L.data,F.dataNames=[...L.dataNames,M]}}W.extendSubschemaData=G;function B(F,{jtdDiscriminator:L,jtdMetadata:J,compositeRule:z,createErrors:K,allErrors:H}){if(z!==void 0)F.compositeRule=z;if(K!==void 0)F.createErrors=K;if(H!==void 0)F.allErrors=H;F.jtdDiscriminator=L,F.jtdMetadata=J}W.extendSubschemaMode=B}),$K=Q0((W,Q)=>{Q.exports=function X(Y,G){if(Y===G)return!0;if(Y&&G&&typeof Y=="object"&&typeof G=="object"){if(Y.constructor!==G.constructor)return!1;var B,F,L;if(Array.isArray(Y)){if(B=Y.length,B!=G.length)return!1;for(F=B;F--!==0;)if(!X(Y[F],G[F]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===G.source&&Y.flags===G.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===G.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===G.toString();if(L=Object.keys(Y),B=L.length,B!==Object.keys(G).length)return!1;for(F=B;F--!==0;)if(!Object.prototype.hasOwnProperty.call(G,L[F]))return!1;for(F=B;F--!==0;){var J=L[F];if(!X(Y[J],G[J]))return!1}return!0}return Y!==Y&&G!==G}}),SV=Q0((W,Q)=>{var X=Q.exports=function(B,F,L){if(typeof F=="function")L=F,F={};L=F.cb||L;var J=typeof L=="function"?L:L.pre||function(){},z=L.post||function(){};Y(F,J,z,B,"",B)};X.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},X.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},X.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},X.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Y(B,F,L,J,z,K,H,D,I,A){if(J&&typeof J=="object"&&!Array.isArray(J)){F(J,z,K,H,D,I,A);for(var M in J){var N=J[M];if(Array.isArray(N)){if(M in X.arrayKeywords)for(var Z=0;Z<N.length;Z++)Y(B,F,L,N[Z],z+"/"+M+"/"+Z,K,z,M,J,Z)}else if(M in X.propsKeywords){if(N&&typeof N=="object")for(var V in N)Y(B,F,L,N[V],z+"/"+M+"/"+G(V),K,z,M,J,V)}else if(M in X.keywords||B.allKeys&&!(M in X.skipKeywords))Y(B,F,L,N,z+"/"+M,K,z,M,J)}L(J,z,K,H,D,I,A)}}function G(B){return B.replace(/~/g,"~0").replace(/\//g,"~1")}}),tQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getSchemaRefs=W.resolveUrl=W.normalizeId=W._getFullPath=W.getFullPath=W.inlineRef=void 0;let Q=k0(),X=$K(),Y=SV(),G=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function B(N,Z=!0){if(typeof N=="boolean")return!0;if(Z===!0)return!L(N);if(!Z)return!1;return J(N)<=Z}W.inlineRef=B;let F=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function L(N){for(let Z in N){if(F.has(Z))return!0;let V=N[Z];if(Array.isArray(V)&&V.some(L))return!0;if(typeof V=="object"&&L(V))return!0}return!1}function J(N){let Z=0;for(let V in N){if(V==="$ref")return 1/0;if(Z++,G.has(V))continue;if(typeof N[V]=="object")(0,Q.eachItem)(N[V],(U)=>Z+=J(U));if(Z===1/0)return 1/0}return Z}function z(N,Z="",V){if(V!==!1)Z=D(Z);return K(N,N.parse(Z))}W.getFullPath=z;function K(N,Z){return N.serialize(Z).split("#")[0]+"#"}W._getFullPath=K;let H=/#\/?$/;function D(N){return N?N.replace(H,""):""}W.normalizeId=D;function I(N,Z,V){return V=D(V),N.resolve(Z,V)}W.resolveUrl=I;let A=/^[a-z_][-a-z0-9._]*$/i;function M(N,Z){if(typeof N=="boolean")return{};let{schemaId:V,uriResolver:U}=this.opts,j=D(N[V]||Z),T={"":j},O=z(U,j,!1),w={},R=new Set;return Y(N,{allKeys:!0},(_,h,d,p)=>{if(p===void 0)return;let z0=O+h,M0=T[p];if(typeof _[V]=="string")M0=V0.call(this,_[V]);P0.call(this,_.$anchor),P0.call(this,_.$dynamicAnchor),T[h]=M0;function V0(Z0){let S=this.opts.uriResolver.resolve;if(Z0=D(M0?S(M0,Z0):Z0),R.has(Z0))throw l(Z0);R.add(Z0);let v=this.refs[Z0];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")k(_,v.schema,Z0);else if(Z0!==D(z0))if(Z0[0]==="#")k(_,w[Z0],Z0),w[Z0]=_;else this.refs[Z0]=z0;return Z0}function P0(Z0){if(typeof Z0=="string"){if(!A.test(Z0))throw Error(`invalid anchor "${Z0}"`);V0.call(this,`#${Z0}`)}}}),w;function k(_,h,d){if(h!==void 0&&!X(_,h))throw l(d)}function l(_){return Error(`reference "${_}" resolves to more than one schema`)}}W.getSchemaRefs=M}),lW=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getData=W.KeywordCxt=W.validateFunctionCode=void 0;let Q=TV(),X=aQ(),Y=HK(),G=aQ(),B=RV(),F=PV(),L=bV(),J=E0(),z=g6(),K=tQ(),H=k0(),D=sQ();function I(P){if(O(P)){if(R(P),T(P)){Z(P);return}}A(P,()=>(0,Q.topBoolOrEmptySchema)(P))}W.validateFunctionCode=I;function A({gen:P,validateName:y,schema:x,schemaEnv:s,opts:t},F0){if(t.code.es5)P.func(y,J._`${z.default.data}, ${z.default.valCxt}`,s.$async,()=>{P.code(J._`"use strict"; ${U(x,t)}`),N(P,t),P.code(F0)});else P.func(y,J._`${z.default.data}, ${M(t)}`,s.$async,()=>P.code(U(x,t)).code(F0))}function M(P){return J._`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${P.dynamicRef?J._`, ${z.default.dynamicAnchors}={}`:J.nil}}={}`}function N(P,y){P.if(z.default.valCxt,()=>{if(P.var(z.default.instancePath,J._`${z.default.valCxt}.${z.default.instancePath}`),P.var(z.default.parentData,J._`${z.default.valCxt}.${z.default.parentData}`),P.var(z.default.parentDataProperty,J._`${z.default.valCxt}.${z.default.parentDataProperty}`),P.var(z.default.rootData,J._`${z.default.valCxt}.${z.default.rootData}`),y.dynamicRef)P.var(z.default.dynamicAnchors,J._`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{if(P.var(z.default.instancePath,J._`""`),P.var(z.default.parentData,J._`undefined`),P.var(z.default.parentDataProperty,J._`undefined`),P.var(z.default.rootData,z.default.data),y.dynamicRef)P.var(z.default.dynamicAnchors,J._`{}`)})}function Z(P){let{schema:y,opts:x,gen:s}=P;A(P,()=>{if(x.$comment&&y.$comment)p(P);if(_(P),s.let(z.default.vErrors,null),s.let(z.default.errors,0),x.unevaluated)V(P);k(P),z0(P)})}function V(P){let{gen:y,validateName:x}=P;P.evaluated=y.const("evaluated",J._`${x}.evaluated`),y.if(J._`${P.evaluated}.dynamicProps`,()=>y.assign(J._`${P.evaluated}.props`,J._`undefined`)),y.if(J._`${P.evaluated}.dynamicItems`,()=>y.assign(J._`${P.evaluated}.items`,J._`undefined`))}function U(P,y){let x=typeof P=="object"&&P[y.schemaId];return x&&(y.code.source||y.code.process)?J._`/*# sourceURL=${x} */`:J.nil}function j(P,y){if(O(P)){if(R(P),T(P)){w(P,y);return}}(0,Q.boolOrEmptySchema)(P,y)}function T({schema:P,self:y}){if(typeof P=="boolean")return!P;for(let x in P)if(y.RULES.all[x])return!0;return!1}function O(P){return typeof P.schema!="boolean"}function w(P,y){let{schema:x,gen:s,opts:t}=P;if(t.$comment&&x.$comment)p(P);h(P),d(P);let F0=s.const("_errs",z.default.errors);k(P,F0),s.var(y,J._`${F0} === ${z.default.errors}`)}function R(P){(0,H.checkUnknownRules)(P),l(P)}function k(P,y){if(P.opts.jtd)return V0(P,[],!1,y);let x=(0,X.getSchemaTypes)(P.schema);V0(P,x,!(0,X.coerceAndCheckDataType)(P,x),y)}function l(P){let{schema:y,errSchemaPath:x,opts:s,self:t}=P;if(y.$ref&&s.ignoreKeywordsWithRef&&(0,H.schemaHasRulesButRef)(y,t.RULES))t.logger.warn(`$ref: keywords ignored in schema at path "${x}"`)}function _(P){let{schema:y,opts:x}=P;if(y.default!==void 0&&x.useDefaults&&x.strictSchema)(0,H.checkStrictMode)(P,"default is ignored in the schema root")}function h(P){let y=P.schema[P.opts.schemaId];if(y)P.baseId=(0,K.resolveUrl)(P.opts.uriResolver,P.baseId,y)}function d(P){if(P.schema.$async&&!P.schemaEnv.$async)throw Error("async schema in sync schema")}function p({gen:P,schemaEnv:y,schema:x,errSchemaPath:s,opts:t}){let F0=x.$comment;if(t.$comment===!0)P.code(J._`${z.default.self}.logger.log(${F0})`);else if(typeof t.$comment=="function"){let T0=J.str`${s}/$comment`,q0=P.scopeValue("root",{ref:y.root});P.code(J._`${z.default.self}.opts.$comment(${F0}, ${T0}, ${q0}.schema)`)}}function z0(P){let{gen:y,schemaEnv:x,validateName:s,ValidationError:t,opts:F0}=P;if(x.$async)y.if(J._`${z.default.errors} === 0`,()=>y.return(z.default.data),()=>y.throw(J._`new ${t}(${z.default.vErrors})`));else{if(y.assign(J._`${s}.errors`,z.default.vErrors),F0.unevaluated)M0(P);y.return(J._`${z.default.errors} === 0`)}}function M0({gen:P,evaluated:y,props:x,items:s}){if(x instanceof J.Name)P.assign(J._`${y}.props`,x);if(s instanceof J.Name)P.assign(J._`${y}.items`,s)}function V0(P,y,x,s){let{gen:t,schema:F0,data:T0,allErrors:q0,opts:g0,self:b0}=P,{RULES:j0}=b0;if(F0.$ref&&(g0.ignoreKeywordsWithRef||!(0,H.schemaHasRulesButRef)(F0,j0))){t.block(()=>L0(P,"$ref",j0.all.$ref.definition));return}if(!g0.jtd)Z0(P,y);t.block(()=>{for(let C0 of j0.rules)r0(C0);r0(j0.post)});function r0(C0){if(!(0,Y.shouldUseGroup)(F0,C0))return;if(C0.type){if(t.if((0,G.checkDataType)(C0.type,T0,g0.strictNumbers)),P0(P,C0),y.length===1&&y[0]===C0.type&&x)t.else(),(0,G.reportTypeError)(P);t.endIf()}else P0(P,C0);if(!q0)t.if(J._`${z.default.errors} === ${s||0}`)}}function P0(P,y){let{gen:x,schema:s,opts:{useDefaults:t}}=P;if(t)(0,B.assignDefaults)(P,y.type);x.block(()=>{for(let F0 of y.rules)if((0,Y.shouldUseRule)(s,F0))L0(P,F0.keyword,F0.definition,y.type)})}function Z0(P,y){if(P.schemaEnv.meta||!P.opts.strictTypes)return;if(S(P,y),!P.opts.allowUnionTypes)v(P,y);u(P,P.dataTypes)}function S(P,y){if(!y.length)return;if(!P.dataTypes.length){P.dataTypes=y;return}y.forEach((x)=>{if(!b(P.dataTypes,x))c(P,`type "${x}" not allowed by context "${P.dataTypes.join(",")}"`)}),C(P,y)}function v(P,y){if(y.length>1&&!(y.length===2&&y.includes("null")))c(P,"use allowUnionTypes to allow union type keyword")}function u(P,y){let x=P.self.RULES.all;for(let s in x){let t=x[s];if(typeof t=="object"&&(0,Y.shouldUseRule)(P.schema,t)){let{type:F0}=t.definition;if(F0.length&&!F0.some((T0)=>E(y,T0)))c(P,`missing type "${F0.join(",")}" for keyword "${s}"`)}}}function E(P,y){return P.includes(y)||y==="number"&&P.includes("integer")}function b(P,y){return P.includes(y)||y==="integer"&&P.includes("number")}function C(P,y){let x=[];for(let s of P.dataTypes)if(b(y,s))x.push(s);else if(y.includes("integer")&&s==="number")x.push("integer");P.dataTypes=x}function c(P,y){let x=P.schemaEnv.baseId+P.errSchemaPath;y+=` at "${x}" (strictTypes)`,(0,H.checkStrictMode)(P,y,P.opts.strictTypes)}var r=class{constructor(P,y,x){if((0,F.validateKeywordUsage)(P,y,x),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=x,this.data=P.data,this.schema=P.schema[x],this.$data=y.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,H.schemaRefOrVal)(P,this.schema,x,this.$data),this.schemaType=y.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=y,this.$data)this.schemaCode=P.gen.const("vSchema",h0(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,F.validSchemaType)(this.schema,y.schemaType,y.allowUndefined))throw Error(`${x} value must be ${JSON.stringify(y.schemaType)}`);if("code"in y?y.trackErrors:y.errors!==!1)this.errsCount=P.gen.const("_errs",z.default.errors)}result(P,y,x){this.failResult((0,J.not)(P),y,x)}failResult(P,y,x){if(this.gen.if(P),x)x();else this.error();if(y){if(this.gen.else(),y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(P,y){this.failResult((0,J.not)(P),void 0,y)}fail(P){if(P===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(P),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);let{schemaCode:y}=this;this.fail(J._`${y} !== undefined && (${(0,J.or)(this.invalid$data(),P)})`)}error(P,y,x){if(y){this.setParams(y),this._error(P,x),this.setParams({});return}this._error(P,x)}_error(P,y){(P?D.reportExtraError:D.reportError)(this,this.def.error,y)}$dataError(){(0,D.reportError)(this,this.def.$dataError||D.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,D.resetErrorsCount)(this.gen,this.errsCount)}ok(P){if(!this.allErrors)this.gen.if(P)}setParams(P,y){if(y)Object.assign(this.params,P);else this.params=P}block$data(P,y,x=J.nil){this.gen.block(()=>{this.check$data(P,x),y()})}check$data(P=J.nil,y=J.nil){if(!this.$data)return;let{gen:x,schemaCode:s,schemaType:t,def:F0}=this;if(x.if((0,J.or)(J._`${s} === undefined`,y)),P!==J.nil)x.assign(P,!0);if(t.length||F0.validateSchema){if(x.elseIf(this.invalid$data()),this.$dataError(),P!==J.nil)x.assign(P,!1)}x.else()}invalid$data(){let{gen:P,schemaCode:y,schemaType:x,def:s,it:t}=this;return(0,J.or)(F0(),T0());function F0(){if(x.length){if(!(y instanceof J.Name))throw Error("ajv implementation error");let q0=Array.isArray(x)?x:[x];return J._`${(0,G.checkDataTypes)(q0,y,t.opts.strictNumbers,G.DataType.Wrong)}`}return J.nil}function T0(){if(s.validateSchema){let q0=P.scopeValue("validate$data",{ref:s.validateSchema});return J._`!${q0}(${y})`}return J.nil}}subschema(P,y){let x=(0,L.getSubschema)(this.it,P);(0,L.extendSubschemaData)(x,this.it,P),(0,L.extendSubschemaMode)(x,P);let s={...this.it,...x,items:void 0,props:void 0};return j(s,y),s}mergeEvaluated(P,y){let{it:x,gen:s}=this;if(!x.opts.unevaluated)return;if(x.props!==!0&&P.props!==void 0)x.props=H.mergeEvaluated.props(s,P.props,x.props,y);if(x.items!==!0&&P.items!==void 0)x.items=H.mergeEvaluated.items(s,P.items,x.items,y)}mergeValidEvaluated(P,y){let{it:x,gen:s}=this;if(x.opts.unevaluated&&(x.props!==!0||x.items!==!0))return s.if(y,()=>this.mergeEvaluated(P,J.Name)),!0}};W.KeywordCxt=r;function L0(P,y,x,s){let t=new r(P,x,y);if("code"in x)x.code(t,s);else if(t.$data&&x.validate)(0,F.funcKeywordCode)(t,x);else if("macro"in x)(0,F.macroKeywordCode)(t,x);else if(x.compile||x.validate)(0,F.funcKeywordCode)(t,x)}let e=/^\/(?:[^~]|~0|~1)*$/,w0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function h0(P,{dataLevel:y,dataNames:x,dataPathArr:s}){let t,F0;if(P==="")return z.default.rootData;if(P[0]==="/"){if(!e.test(P))throw Error(`Invalid JSON-pointer: ${P}`);t=P,F0=z.default.rootData}else{let b0=w0.exec(P);if(!b0)throw Error(`Invalid JSON-pointer: ${P}`);let j0=+b0[1];if(t=b0[2],t==="#"){if(j0>=y)throw Error(g0("property/index",j0));return s[y-j0]}if(j0>y)throw Error(g0("data",j0));if(F0=x[y-j0],!t)return F0}let T0=F0,q0=t.split("/");for(let b0 of q0)if(b0)F0=J._`${F0}${(0,J.getProperty)((0,H.unescapeJsonPointer)(b0))}`,T0=J._`${T0} && ${F0}`;return T0;function g0(b0,j0){return`Cannot access ${b0} ${j0} levels up, current level is ${y}`}}W.getData=h0}),eQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});var Q=class extends Error{constructor(X){super("validation failed");this.errors=X,this.ajv=this.validation=!0}};W.default=Q}),mW=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=tQ();var X=class extends Error{constructor(Y,G,B,F){super(F||`can't resolve reference ${B} from id ${G}`);this.missingRef=(0,Q.resolveUrl)(Y,G,B),this.missingSchema=(0,Q.normalizeId)((0,Q.getFullPath)(Y,this.missingRef))}};W.default=X}),WX=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.resolveSchema=W.getCompilingSchema=W.resolveRef=W.compileSchema=W.SchemaEnv=void 0;let Q=E0(),X=eQ(),Y=g6(),G=tQ(),B=k0(),F=lW();var L=class{constructor(Z){var V;this.refs={},this.dynamicAnchors={};let U;if(typeof Z.schema=="object")U=Z.schema;this.schema=Z.schema,this.schemaId=Z.schemaId,this.root=Z.root||this,this.baseId=(V=Z.baseId)!==null&&V!==void 0?V:(0,G.normalizeId)(U===null||U===void 0?void 0:U[Z.schemaId||"$id"]),this.schemaPath=Z.schemaPath,this.localRefs=Z.localRefs,this.meta=Z.meta,this.$async=U===null||U===void 0?void 0:U.$async,this.refs={}}};W.SchemaEnv=L;function J(Z){let V=H.call(this,Z);if(V)return V;let U=(0,G.getFullPath)(this.opts.uriResolver,Z.root.baseId),{es5:j,lines:T}=this.opts.code,{ownProperties:O}=this.opts,w=new Q.CodeGen(this.scope,{es5:j,lines:T,ownProperties:O}),R;if(Z.$async)R=w.scopeValue("Error",{ref:X.default,code:Q._`require("ajv/dist/runtime/validation_error").default`});let k=w.scopeName("validate");Z.validateName=k;let l={gen:w,allErrors:this.opts.allErrors,data:Y.default.data,parentData:Y.default.parentData,parentDataProperty:Y.default.parentDataProperty,dataNames:[Y.default.data],dataPathArr:[Q.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:w.scopeValue("schema",this.opts.code.source===!0?{ref:Z.schema,code:(0,Q.stringify)(Z.schema)}:{ref:Z.schema}),validateName:k,ValidationError:R,schema:Z.schema,schemaEnv:Z,rootId:U,baseId:Z.baseId||U,schemaPath:Q.nil,errSchemaPath:Z.schemaPath||(this.opts.jtd?"":"#"),errorPath:Q._`""`,opts:this.opts,self:this},_;try{this._compilations.add(Z),(0,F.validateFunctionCode)(l),w.optimize(this.opts.code.optimize);let h=w.toString();if(_=`${w.scopeRefs(Y.default.scope)}return ${h}`,this.opts.code.process)_=this.opts.code.process(_,Z);let d=Function(`${Y.default.self}`,`${Y.default.scope}`,_)(this,this.scope.get());if(this.scope.value(k,{ref:d}),d.errors=null,d.schema=Z.schema,d.schemaEnv=Z,Z.$async)d.$async=!0;if(this.opts.code.source===!0)d.source={validateName:k,validateCode:h,scopeValues:w._values};if(this.opts.unevaluated){let{props:p,items:z0}=l;if(d.evaluated={props:p instanceof Q.Name?void 0:p,items:z0 instanceof Q.Name?void 0:z0,dynamicProps:p instanceof Q.Name,dynamicItems:z0 instanceof Q.Name},d.source)d.source.evaluated=(0,Q.stringify)(d.evaluated)}return Z.validate=d,Z}catch(h){if(delete Z.validate,delete Z.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw h}finally{this._compilations.delete(Z)}}W.compileSchema=J;function z(Z,V,U){var j;U=(0,G.resolveUrl)(this.opts.uriResolver,V,U);let T=Z.refs[U];if(T)return T;let O=I.call(this,Z,U);if(O===void 0){let w=(j=Z.localRefs)===null||j===void 0?void 0:j[U],{schemaId:R}=this.opts;if(w)O=new L({schema:w,schemaId:R,root:Z,baseId:V})}if(O===void 0)return;return Z.refs[U]=K.call(this,O)}W.resolveRef=z;function K(Z){if((0,G.inlineRef)(Z.schema,this.opts.inlineRefs))return Z.schema;return Z.validate?Z:J.call(this,Z)}function H(Z){for(let V of this._compilations)if(D(V,Z))return V}W.getCompilingSchema=H;function D(Z,V){return Z.schema===V.schema&&Z.root===V.root&&Z.baseId===V.baseId}function I(Z,V){let U;while(typeof(U=this.refs[V])=="string")V=U;return U||this.schemas[V]||A.call(this,Z,V)}function A(Z,V){let U=this.opts.uriResolver.parse(V),j=(0,G._getFullPath)(this.opts.uriResolver,U),T=(0,G.getFullPath)(this.opts.uriResolver,Z.baseId,void 0);if(Object.keys(Z.schema).length>0&&j===T)return N.call(this,U,Z);let O=(0,G.normalizeId)(j),w=this.refs[O]||this.schemas[O];if(typeof w=="string"){let R=A.call(this,Z,w);if(typeof(R===null||R===void 0?void 0:R.schema)!=="object")return;return N.call(this,U,R)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)J.call(this,w);if(O===(0,G.normalizeId)(V)){let{schema:R}=w,{schemaId:k}=this.opts,l=R[k];if(l)T=(0,G.resolveUrl)(this.opts.uriResolver,T,l);return new L({schema:R,schemaId:k,root:Z,baseId:T})}return N.call(this,U,w)}W.resolveSchema=A;let M=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function N(Z,{baseId:V,schema:U,root:j}){var T;if(((T=Z.fragment)===null||T===void 0?void 0:T[0])!=="/")return;for(let R of Z.fragment.slice(1).split("/")){if(typeof U==="boolean")return;let k=U[(0,B.unescapeFragment)(R)];if(k===void 0)return;U=k;let l=typeof U==="object"&&U[this.opts.schemaId];if(!M.has(R)&&l)V=(0,G.resolveUrl)(this.opts.uriResolver,V,l)}let O;if(typeof U!="boolean"&&U.$ref&&!(0,B.schemaHasRulesButRef)(U,this.RULES)){let R=(0,G.resolveUrl)(this.opts.uriResolver,V,U.$ref);O=A.call(this,j,R)}let{schemaId:w}=this.opts;if(O=O||new L({schema:U,schemaId:w,root:j,baseId:V}),O.schema!==O.root.schema)return O}}),qV=Q0((W,Q)=>{Q.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),UK=Q0((W,Q)=>{let X=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Y=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function G(A){let M="",N=0,Z=0;for(Z=0;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),N===48)continue;if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z];break}for(Z+=1;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z]}return M}let B=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function F(A){return A.length=0,!0}function L(A,M,N){if(A.length){let Z=G(A);if(Z!=="")M.push(Z);else return N.error=!0,!1;A.length=0}return!0}function J(A){let M=0,N={error:!1,address:"",zone:""},Z=[],V=[],U=!1,j=!1,T=L;for(let O=0;O<A.length;O++){let w=A[O];if(w==="["||w==="]")continue;if(w===":"){if(U===!0)j=!0;if(!T(V,Z,N))break;if(++M>7){N.error=!0;break}if(O>0&&A[O-1]===":")U=!0;Z.push(":");continue}else if(w==="%"){if(!T(V,Z,N))break;T=F}else{V.push(w);continue}}if(V.length)if(T===F)N.zone=V.join("");else if(j)Z.push(V.join(""));else Z.push(G(V));return N.address=Z.join(""),N}function z(A){if(K(A,":")<2)return{host:A,isIPV6:!1};let M=J(A);if(!M.error){let{address:N,address:Z}=M;if(M.zone)N+="%"+M.zone,Z+="%25"+M.zone;return{host:N,isIPV6:!0,escapedHost:Z}}else return{host:A,isIPV6:!1}}function K(A,M){let N=0;for(let Z=0;Z<A.length;Z++)if(A[Z]===M)N++;return N}function H(A){let M=A,N=[],Z=-1,V=0;while(V=M.length){if(V===1)if(M===".")break;else if(M==="/"){N.push("/");break}else{N.push(M);break}else if(V===2){if(M[0]==="."){if(M[1]===".")break;else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."||M[1]==="/"){N.push("/");break}}}else if(V===3){if(M==="/.."){if(N.length!==0)N.pop();N.push("/");break}}if(M[0]==="."){if(M[1]==="."){if(M[2]==="/"){M=M.slice(3);continue}}else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."){if(M[2]==="/"){M=M.slice(2);continue}else if(M[2]==="."){if(M[3]==="/"){if(M=M.slice(3),N.length!==0)N.pop();continue}}}}if((Z=M.indexOf("/",1))===-1){N.push(M);break}else N.push(M.slice(0,Z)),M=M.slice(Z)}return N.join("")}function D(A,M){let N=M!==!0?escape:unescape;if(A.scheme!==void 0)A.scheme=N(A.scheme);if(A.userinfo!==void 0)A.userinfo=N(A.userinfo);if(A.host!==void 0)A.host=N(A.host);if(A.path!==void 0)A.path=N(A.path);if(A.query!==void 0)A.query=N(A.query);if(A.fragment!==void 0)A.fragment=N(A.fragment);return A}function I(A){let M=[];if(A.userinfo!==void 0)M.push(A.userinfo),M.push("@");if(A.host!==void 0){let N=unescape(A.host);if(!Y(N)){let Z=z(N);if(Z.isIPV6===!0)N=`[${Z.escapedHost}]`;else N=A.host}M.push(N)}if(typeof A.port==="number"||typeof A.port==="string")M.push(":"),M.push(String(A.port));return M.length?M.join(""):void 0}Q.exports={nonSimpleDomain:B,recomposeAuthority:I,normalizeComponentEncoding:D,removeDotSegments:H,isIPv4:Y,isUUID:X,normalizeIPv6:z,stringArrayToHexStripped:G}}),CV=Q0((W,Q)=>{let{isUUID:X}=UK(),Y=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,G=["http","https","ws","wss","urn","urn:uuid"];function B(w){return G.indexOf(w)!==-1}function F(w){if(w.secure===!0)return!0;else if(w.secure===!1)return!1;else if(w.scheme)return w.scheme.length===3&&(w.scheme[0]==="w"||w.scheme[0]==="W")&&(w.scheme[1]==="s"||w.scheme[1]==="S")&&(w.scheme[2]==="s"||w.scheme[2]==="S");else return!1}function L(w){if(!w.host)w.error=w.error||"HTTP URIs must have a host.";return w}function J(w){let R=String(w.scheme).toLowerCase()==="https";if(w.port===(R?443:80)||w.port==="")w.port=void 0;if(!w.path)w.path="/";return w}function z(w){return w.secure=F(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w}function K(w){if(w.port===(F(w)?443:80)||w.port==="")w.port=void 0;if(typeof w.secure==="boolean")w.scheme=w.secure?"wss":"ws",w.secure=void 0;if(w.resourceName){let[R,k]=w.resourceName.split("?");w.path=R&&R!=="/"?R:void 0,w.query=k,w.resourceName=void 0}return w.fragment=void 0,w}function H(w,R){if(!w.path)return w.error="URN can not be parsed",w;let k=w.path.match(Y);if(k){let l=R.scheme||w.scheme||"urn";w.nid=k[1].toLowerCase(),w.nss=k[2];let _=O(`${l}:${R.nid||w.nid}`);if(w.path=void 0,_)w=_.parse(w,R)}else w.error=w.error||"URN can not be parsed.";return w}function D(w,R){if(w.nid===void 0)throw Error("URN without nid cannot be serialized");let k=R.scheme||w.scheme||"urn",l=w.nid.toLowerCase(),_=O(`${k}:${R.nid||l}`);if(_)w=_.serialize(w,R);let h=w,d=w.nss;return h.path=`${l||R.nid}:${d}`,R.skipEscape=!0,h}function I(w,R){let k=w;if(k.uuid=k.nss,k.nss=void 0,!R.tolerant&&(!k.uuid||!X(k.uuid)))k.error=k.error||"UUID is not valid.";return k}function A(w){let R=w;return R.nss=(w.uuid||"").toLowerCase(),R}let M={scheme:"http",domainHost:!0,parse:L,serialize:J},N={scheme:"https",domainHost:M.domainHost,parse:L,serialize:J},Z={scheme:"ws",domainHost:!0,parse:z,serialize:K},V={scheme:"wss",domainHost:Z.domainHost,parse:Z.parse,serialize:Z.serialize},T={http:M,https:N,ws:Z,wss:V,urn:{scheme:"urn",parse:H,serialize:D,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:I,serialize:A,skipNormalize:!0}};Object.setPrototypeOf(T,null);function O(w){return w&&(T[w]||T[w.toLowerCase()])||void 0}Q.exports={wsIsSecure:F,SCHEMES:T,isValidSchemeName:B,getSchemeHandler:O}}),kV=Q0((W,Q)=>{let{normalizeIPv6:X,removeDotSegments:Y,recomposeAuthority:G,normalizeComponentEncoding:B,isIPv4:F,nonSimpleDomain:L}=UK(),{SCHEMES:J,getSchemeHandler:z}=CV();function K(V,U){if(typeof V==="string")V=A(N(V,U),U);else if(typeof V==="object")V=N(A(V,U),U);return V}function H(V,U,j){let T=j?Object.assign({scheme:"null"},j):{scheme:"null"},O=D(N(V,T),N(U,T),T,!0);return T.skipEscape=!0,A(O,T)}function D(V,U,j,T){let O={};if(!T)V=N(A(V,j),j),U=N(A(U,j),j);if(j=j||{},!j.tolerant&&U.scheme)O.scheme=U.scheme,O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(U.userinfo!==void 0||U.host!==void 0||U.port!==void 0)O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(!U.path)if(O.path=V.path,U.query!==void 0)O.query=U.query;else O.query=V.query;else{if(U.path[0]==="/")O.path=Y(U.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)O.path="/"+U.path;else if(!V.path)O.path=U.path;else O.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+U.path;O.path=Y(O.path)}O.query=U.query}O.userinfo=V.userinfo,O.host=V.host,O.port=V.port}O.scheme=V.scheme}return O.fragment=U.fragment,O}function I(V,U,j){if(typeof V==="string")V=unescape(V),V=A(B(N(V,j),!0),{...j,skipEscape:!0});else if(typeof V==="object")V=A(B(V,!0),{...j,skipEscape:!0});if(typeof U==="string")U=unescape(U),U=A(B(N(U,j),!0),{...j,skipEscape:!0});else if(typeof U==="object")U=A(B(U,!0),{...j,skipEscape:!0});return V.toLowerCase()===U.toLowerCase()}function A(V,U){let j={host:V.host,scheme:V.scheme,userinfo:V.userinfo,port:V.port,path:V.path,query:V.query,nid:V.nid,nss:V.nss,uuid:V.uuid,fragment:V.fragment,reference:V.reference,resourceName:V.resourceName,secure:V.secure,error:""},T=Object.assign({},U),O=[],w=z(T.scheme||j.scheme);if(w&&w.serialize)w.serialize(j,T);if(j.path!==void 0)if(!T.skipEscape){if(j.path=escape(j.path),j.scheme!==void 0)j.path=j.path.split("%3A").join(":")}else j.path=unescape(j.path);if(T.reference!=="suffix"&&j.scheme)O.push(j.scheme,":");let R=G(j);if(R!==void 0){if(T.reference!=="suffix")O.push("//");if(O.push(R),j.path&&j.path[0]!=="/")O.push("/")}if(j.path!==void 0){let k=j.path;if(!T.absolutePath&&(!w||!w.absolutePath))k=Y(k);if(R===void 0&&k[0]==="/"&&k[1]==="/")k="/%2F"+k.slice(2);O.push(k)}if(j.query!==void 0)O.push("?",j.query);if(j.fragment!==void 0)O.push("#",j.fragment);return O.join("")}let M=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function N(V,U){let j=Object.assign({},U),T={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},O=!1;if(j.reference==="suffix")if(j.scheme)V=j.scheme+":"+V;else V="//"+V;let w=V.match(M);if(w){if(T.scheme=w[1],T.userinfo=w[3],T.host=w[4],T.port=parseInt(w[5],10),T.path=w[6]||"",T.query=w[7],T.fragment=w[8],isNaN(T.port))T.port=w[5];if(T.host)if(F(T.host)===!1){let k=X(T.host);T.host=k.host.toLowerCase(),O=k.isIPV6}else O=!0;if(T.scheme===void 0&&T.userinfo===void 0&&T.host===void 0&&T.port===void 0&&T.query===void 0&&!T.path)T.reference="same-document";else if(T.scheme===void 0)T.reference="relative";else if(T.fragment===void 0)T.reference="absolute";else T.reference="uri";if(j.reference&&j.reference!=="suffix"&&j.reference!==T.reference)T.error=T.error||"URI is not a "+j.reference+" reference.";let R=z(j.scheme||T.scheme);if(!j.unicodeSupport&&(!R||!R.unicodeSupport)){if(T.host&&(j.domainHost||R&&R.domainHost)&&O===!1&&L(T.host))try{T.host=URL.domainToASCII(T.host.toLowerCase())}catch(k){T.error=T.error||"Host's domain name can not be converted to ASCII: "+k}}if(!R||R&&!R.skipNormalize){if(V.indexOf("%")!==-1){if(T.scheme!==void 0)T.scheme=unescape(T.scheme);if(T.host!==void 0)T.host=unescape(T.host)}if(T.path)T.path=escape(unescape(T.path));if(T.fragment)T.fragment=encodeURI(decodeURIComponent(T.fragment))}if(R&&R.parse)R.parse(T,j)}else T.error=T.error||"URI can not be parsed.";return T}let Z={SCHEMES:J,normalize:K,resolve:H,resolveComponent:D,equal:I,serialize:A,parse:N};Q.exports=Z,Q.exports.default=Z,Q.exports.fastUri=Z}),vV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=kV();Q.code='require("ajv/dist/runtime/uri").default',W.default=Q}),AK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=void 0;var Q=lW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return Q.KeywordCxt}});var X=E0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return X._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return X.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return X.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return X.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return X.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return X.CodeGen}});let Y=eQ(),G=mW(),B=ZK(),F=WX(),L=E0(),J=tQ(),z=aQ(),K=k0(),H=qV(),D=vV(),I=(S,v)=>new RegExp(S,v);I.code="new RegExp";let A=["removeAdditional","useDefaults","coerceTypes"],M=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),N={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},Z={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},V=200;function U(S){var v,u,E,b,C,c,r,L0,e,w0,h0,P,y,x,s,t,F0,T0,q0,g0,b0,j0,r0,C0,G1;let Q1=S.strict,B1=(v=S.code)===null||v===void 0?void 0:v.optimize,K1=B1===!0||B1===void 0?1:B1||0,Z1=(E=(u=S.code)===null||u===void 0?void 0:u.regExp)!==null&&E!==void 0?E:I,V1=(b=S.uriResolver)!==null&&b!==void 0?b:D.default;return{strictSchema:(c=(C=S.strictSchema)!==null&&C!==void 0?C:Q1)!==null&&c!==void 0?c:!0,strictNumbers:(L0=(r=S.strictNumbers)!==null&&r!==void 0?r:Q1)!==null&&L0!==void 0?L0:!0,strictTypes:(w0=(e=S.strictTypes)!==null&&e!==void 0?e:Q1)!==null&&w0!==void 0?w0:"log",strictTuples:(P=(h0=S.strictTuples)!==null&&h0!==void 0?h0:Q1)!==null&&P!==void 0?P:"log",strictRequired:(x=(y=S.strictRequired)!==null&&y!==void 0?y:Q1)!==null&&x!==void 0?x:!1,code:S.code?{...S.code,optimize:K1,regExp:Z1}:{optimize:K1,regExp:Z1},loopRequired:(s=S.loopRequired)!==null&&s!==void 0?s:V,loopEnum:(t=S.loopEnum)!==null&&t!==void 0?t:V,meta:(F0=S.meta)!==null&&F0!==void 0?F0:!0,messages:(T0=S.messages)!==null&&T0!==void 0?T0:!0,inlineRefs:(q0=S.inlineRefs)!==null&&q0!==void 0?q0:!0,schemaId:(g0=S.schemaId)!==null&&g0!==void 0?g0:"$id",addUsedSchema:(b0=S.addUsedSchema)!==null&&b0!==void 0?b0:!0,validateSchema:(j0=S.validateSchema)!==null&&j0!==void 0?j0:!0,validateFormats:(r0=S.validateFormats)!==null&&r0!==void 0?r0:!0,unicodeRegExp:(C0=S.unicodeRegExp)!==null&&C0!==void 0?C0:!0,int32range:(G1=S.int32range)!==null&&G1!==void 0?G1:!0,uriResolver:V1}}var j=class{constructor(S={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,S=this.opts={...S,...U(S)};let{es5:v,lines:u}=this.opts.code;this.scope=new L.ValueScope({scope:{},prefixes:M,es5:v,lines:u}),this.logger=h(S.logger);let E=S.validateFormats;if(S.validateFormats=!1,this.RULES=(0,B.getRules)(),T.call(this,N,S,"NOT SUPPORTED"),T.call(this,Z,S,"DEPRECATED","warn"),this._metaOpts=l.call(this),S.formats)R.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),S.keywords)k.call(this,S.keywords);if(typeof S.meta=="object")this.addMetaSchema(S.meta);w.call(this),S.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:S,meta:v,schemaId:u}=this.opts,E=H;if(u==="id")E={...H},E.id=E.$id,delete E.$id;if(v&&S)this.addMetaSchema(E,E[u],!1)}defaultMeta(){let{meta:S,schemaId:v}=this.opts;return this.opts.defaultMeta=typeof S=="object"?S[v]||S:void 0}validate(S,v){let u;if(typeof S=="string"){if(u=this.getSchema(S),!u)throw Error(`no schema with key or ref "${S}"`)}else u=this.compile(S);let E=u(v);if(!("$async"in u))this.errors=u.errors;return E}compile(S,v){let u=this._addSchema(S,v);return u.validate||this._compileSchemaEnv(u)}compileAsync(S,v){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:u}=this.opts;return E.call(this,S,v);async function E(e,w0){await b.call(this,e.$schema);let h0=this._addSchema(e,w0);return h0.validate||C.call(this,h0)}async function b(e){if(e&&!this.getSchema(e))await E.call(this,{$ref:e},!0)}async function C(e){try{return this._compileSchemaEnv(e)}catch(w0){if(!(w0 instanceof G.default))throw w0;return c.call(this,w0),await r.call(this,w0.missingSchema),C.call(this,e)}}function c({missingSchema:e,missingRef:w0}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${w0} cannot be resolved`)}async function r(e){let w0=await L0.call(this,e);if(!this.refs[e])await b.call(this,w0.$schema);if(!this.refs[e])this.addSchema(w0,e,v)}async function L0(e){let w0=this._loading[e];if(w0)return w0;try{return await(this._loading[e]=u(e))}finally{delete this._loading[e]}}}addSchema(S,v,u,E=this.opts.validateSchema){if(Array.isArray(S)){for(let C of S)this.addSchema(C,void 0,u,E);return this}let b;if(typeof S==="object"){let{schemaId:C}=this.opts;if(b=S[C],b!==void 0&&typeof b!="string")throw Error(`schema ${C} must be string`)}return v=(0,J.normalizeId)(v||b),this._checkUnique(v),this.schemas[v]=this._addSchema(S,u,v,E,!0),this}addMetaSchema(S,v,u=this.opts.validateSchema){return this.addSchema(S,v,!0,u),this}validateSchema(S,v){if(typeof S=="boolean")return!0;let u;if(u=S.$schema,u!==void 0&&typeof u!="string")throw Error("$schema must be a string");if(u=u||this.opts.defaultMeta||this.defaultMeta(),!u)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let E=this.validate(u,S);if(!E&&v){let b="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(b);else throw Error(b)}return E}getSchema(S){let v;while(typeof(v=O.call(this,S))=="string")S=v;if(v===void 0){let{schemaId:u}=this.opts,E=new F.SchemaEnv({schema:{},schemaId:u});if(v=F.resolveSchema.call(this,E,S),!v)return;this.refs[S]=v}return v.validate||this._compileSchemaEnv(v)}removeSchema(S){if(S instanceof RegExp)return this._removeAllSchemas(this.schemas,S),this._removeAllSchemas(this.refs,S),this;switch(typeof S){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let v=O.call(this,S);if(typeof v=="object")this._cache.delete(v.schema);return delete this.schemas[S],delete this.refs[S],this}case"object":{let v=S;this._cache.delete(v);let u=S[this.opts.schemaId];if(u)u=(0,J.normalizeId)(u),delete this.schemas[u],delete this.refs[u];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(S){for(let v of S)this.addKeyword(v);return this}addKeyword(S,v){let u;if(typeof S=="string"){if(u=S,typeof v=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),v.keyword=u}else if(typeof S=="object"&&v===void 0){if(v=S,u=v.keyword,Array.isArray(u)&&!u.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(p.call(this,u,v),!v)return(0,K.eachItem)(u,(b)=>z0.call(this,b)),this;V0.call(this,v);let E={...v,type:(0,z.getJSONTypes)(v.type),schemaType:(0,z.getJSONTypes)(v.schemaType)};return(0,K.eachItem)(u,E.type.length===0?(b)=>z0.call(this,b,E):(b)=>E.type.forEach((C)=>z0.call(this,b,E,C))),this}getKeyword(S){let v=this.RULES.all[S];return typeof v=="object"?v.definition:!!v}removeKeyword(S){let{RULES:v}=this;delete v.keywords[S],delete v.all[S];for(let u of v.rules){let E=u.rules.findIndex((b)=>b.keyword===S);if(E>=0)u.rules.splice(E,1)}return this}addFormat(S,v){if(typeof v=="string")v=new RegExp(v);return this.formats[S]=v,this}errorsText(S=this.errors,{separator:v=", ",dataVar:u="data"}={}){if(!S||S.length===0)return"No errors";return S.map((E)=>`${u}${E.instancePath} ${E.message}`).reduce((E,b)=>E+v+b)}$dataMetaSchema(S,v){let u=this.RULES.all;S=JSON.parse(JSON.stringify(S));for(let E of v){let b=E.split("/").slice(1),C=S;for(let c of b)C=C[c];for(let c in u){let r=u[c];if(typeof r!="object")continue;let{$data:L0}=r.definition,e=C[c];if(L0&&e)C[c]=Z0(e)}}return S}_removeAllSchemas(S,v){for(let u in S){let E=S[u];if(!v||v.test(u)){if(typeof E=="string")delete S[u];else if(E&&!E.meta)this._cache.delete(E.schema),delete S[u]}}}_addSchema(S,v,u,E=this.opts.validateSchema,b=this.opts.addUsedSchema){let C,{schemaId:c}=this.opts;if(typeof S=="object")C=S[c];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof S!="boolean")throw Error("schema must be object or boolean");let r=this._cache.get(S);if(r!==void 0)return r;u=(0,J.normalizeId)(C||u);let L0=J.getSchemaRefs.call(this,S,u);if(r=new F.SchemaEnv({schema:S,schemaId:c,meta:v,baseId:u,localRefs:L0}),this._cache.set(r.schema,r),b&&!u.startsWith("#")){if(u)this._checkUnique(u);this.refs[u]=r}if(E)this.validateSchema(S,!0);return r}_checkUnique(S){if(this.schemas[S]||this.refs[S])throw Error(`schema with key or id "${S}" already exists`)}_compileSchemaEnv(S){if(S.meta)this._compileMetaSchema(S);else F.compileSchema.call(this,S);if(!S.validate)throw Error("ajv implementation error");return S.validate}_compileMetaSchema(S){let v=this.opts;this.opts=this._metaOpts;try{F.compileSchema.call(this,S)}finally{this.opts=v}}};j.ValidationError=Y.default,j.MissingRefError=G.default,W.default=j;function T(S,v,u,E="error"){for(let b in S){let C=b;if(C in v)this.logger[E](`${u}: option ${b}. ${S[C]}`)}}function O(S){return S=(0,J.normalizeId)(S),this.schemas[S]||this.refs[S]}function w(){let S=this.opts.schemas;if(!S)return;if(Array.isArray(S))this.addSchema(S);else for(let v in S)this.addSchema(S[v],v)}function R(){for(let S in this.opts.formats){let v=this.opts.formats[S];if(v)this.addFormat(S,v)}}function k(S){if(Array.isArray(S)){this.addVocabulary(S);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let v in S){let u=S[v];if(!u.keyword)u.keyword=v;this.addKeyword(u)}}function l(){let S={...this.opts};for(let v of A)delete S[v];return S}let _={log(){},warn(){},error(){}};function h(S){if(S===!1)return _;if(S===void 0)return console;if(S.log&&S.warn&&S.error)return S;throw Error("logger must implement log, warn and error methods")}let d=/^[a-z_$][a-z0-9_$:-]*$/i;function p(S,v){let{RULES:u}=this;if((0,K.eachItem)(S,(E)=>{if(u.keywords[E])throw Error(`Keyword ${E} is already defined`);if(!d.test(E))throw Error(`Keyword ${E} has invalid name`)}),!v)return;if(v.$data&&!(("code"in v)||("validate"in v)))throw Error('$data keyword must have "code" or "validate" function')}function z0(S,v,u){var E;let b=v===null||v===void 0?void 0:v.post;if(u&&b)throw Error('keyword with "post" flag cannot have "type"');let{RULES:C}=this,c=b?C.post:C.rules.find(({type:L0})=>L0===u);if(!c)c={type:u,rules:[]},C.rules.push(c);if(C.keywords[S]=!0,!v)return;let r={keyword:S,definition:{...v,type:(0,z.getJSONTypes)(v.type),schemaType:(0,z.getJSONTypes)(v.schemaType)}};if(v.before)M0.call(this,c,r,v.before);else c.rules.push(r);C.all[S]=r,(E=v.implements)===null||E===void 0||E.forEach((L0)=>this.addKeyword(L0))}function M0(S,v,u){let E=S.rules.findIndex((b)=>b.keyword===u);if(E>=0)S.rules.splice(E,0,v);else S.rules.push(v),this.logger.warn(`rule ${u} is not defined`)}function V0(S){let{metaSchema:v}=S;if(v===void 0)return;if(S.$data&&this.opts.$data)v=Z0(v);S.validateSchema=this.compile(v,!0)}let P0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Z0(S){return{anyOf:[S,P0]}}}),yV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};W.default=Q}),rG=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.callRef=W.getValidate=void 0;let Q=mW(),X=f6(),Y=E0(),G=g6(),B=WX(),F=k0(),L={keyword:"$ref",schemaType:"string",code(K){let{gen:H,schema:D,it:I}=K,{baseId:A,schemaEnv:M,validateName:N,opts:Z,self:V}=I,{root:U}=M;if((D==="#"||D==="#/")&&A===U.baseId)return T();let j=B.resolveRef.call(V,U,A,D);if(j===void 0)throw new Q.default(I.opts.uriResolver,A,D);if(j instanceof B.SchemaEnv)return O(j);return w(j);function T(){if(M===U)return z(K,N,M,M.$async);let R=H.scopeValue("root",{ref:U});return z(K,Y._`${R}.validate`,U,U.$async)}function O(R){z(K,J(K,R),R,R.$async)}function w(R){let k=H.scopeValue("schema",Z.code.source===!0?{ref:R,code:(0,Y.stringify)(R)}:{ref:R}),l=H.name("valid"),_=K.subschema({schema:R,dataTypes:[],schemaPath:Y.nil,topSchemaRef:k,errSchemaPath:D},l);K.mergeEvaluated(_),K.ok(l)}}};function J(K,H){let{gen:D}=K;return H.validate?D.scopeValue("validate",{ref:H.validate}):Y._`${D.scopeValue("wrapper",{ref:H})}.validate`}W.getValidate=J;function z(K,H,D,I){let{gen:A,it:M}=K,{allErrors:N,schemaEnv:Z,opts:V}=M,U=V.passContext?G.default.this:Y.nil;if(I)j();else T();function j(){if(!Z.$async)throw Error("async schema referenced by sync schema");let R=A.let("valid");A.try(()=>{if(A.code(Y._`await ${(0,X.callValidateCode)(K,H,U)}`),w(H),!N)A.assign(R,!0)},(k)=>{if(A.if(Y._`!(${k} instanceof ${M.ValidationError})`,()=>A.throw(k)),O(k),!N)A.assign(R,!1)}),K.ok(R)}function T(){K.result((0,X.callValidateCode)(K,H,U),()=>w(H),()=>O(H))}function O(R){let k=Y._`${R}.errors`;A.assign(G.default.vErrors,Y._`${G.default.vErrors} === null ? ${k} : ${G.default.vErrors}.concat(${k})`),A.assign(G.default.errors,Y._`${G.default.vErrors}.length`)}function w(R){var k;if(!M.opts.unevaluated)return;let l=(k=D===null||D===void 0?void 0:D.validate)===null||k===void 0?void 0:k.evaluated;if(M.props!==!0)if(l&&!l.dynamicProps){if(l.props!==void 0)M.props=F.mergeEvaluated.props(A,l.props,M.props)}else{let _=A.var("props",Y._`${R}.evaluated.props`);M.props=F.mergeEvaluated.props(A,_,M.props,Y.Name)}if(M.items!==!0)if(l&&!l.dynamicItems){if(l.items!==void 0)M.items=F.mergeEvaluated.items(A,l.items,M.items)}else{let _=A.var("items",Y._`${R}.evaluated.items`);M.items=F.mergeEvaluated.items(A,_,M.items,Y.Name)}}}W.callRef=z,W.default=L}),NK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=yV(),X=rG(),Y=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Q.default,X.default];W.default=Y}),_V=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=Q.operators,Y={maximum:{okStr:"<=",ok:X.LTE,fail:X.GT},minimum:{okStr:">=",ok:X.GTE,fail:X.LT},exclusiveMaximum:{okStr:"<",ok:X.LT,fail:X.GTE},exclusiveMinimum:{okStr:">",ok:X.GT,fail:X.LTE}},G={keyword:Object.keys(Y),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:B,schemaCode:F})=>Q.str`must be ${Y[B].okStr} ${F}`,params:({keyword:B,schemaCode:F})=>Q._`{comparison: ${Y[B].okStr}, limit: ${F}}`},code(B){let{keyword:F,data:L,schemaCode:J}=B;B.fail$data(Q._`${L} ${Y[F].fail} ${J} || isNaN(${L})`)}};W.default=G}),gV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must be multiple of ${Y}`,params:({schemaCode:Y})=>Q._`{multipleOf: ${Y}}`},code(Y){let{gen:G,data:B,schemaCode:F,it:L}=Y,J=L.opts.multipleOfPrecision,z=G.let("res"),K=J?Q._`Math.abs(Math.round(${z}) - ${z}) > 1e-${J}`:Q._`${z} !== parseInt(${z})`;Y.fail$data(Q._`(${F} === 0 || (${z} = ${B}/${F}, ${K}))`)}};W.default=X}),fV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});function Q(X){let Y=X.length,G=0,B=0,F;while(B<Y)if(G++,F=X.charCodeAt(B++),F>=55296&&F<=56319&&B<Y){if(F=X.charCodeAt(B),(F&64512)===56320)B++}return G}W.default=Q,Q.code='require("ajv/dist/runtime/ucs2length").default'}),xV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y=fV(),G={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:B,schemaCode:F}){let L=B==="maxLength"?"more":"fewer";return Q.str`must NOT have ${L} than ${F} characters`},params:({schemaCode:B})=>Q._`{limit: ${B}}`},code(B){let{keyword:F,data:L,schemaCode:J,it:z}=B,K=F==="maxLength"?Q.operators.GT:Q.operators.LT,H=z.opts.unicode===!1?Q._`${L}.length`:Q._`${(0,X.useFunc)(B.gen,Y.default)}(${L})`;B.fail$data(Q._`${H} ${K} ${J}`)}};W.default=G}),hV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=f6(),X=k0(),Y=E0(),G={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:B})=>Y.str`must match pattern "${B}"`,params:({schemaCode:B})=>Y._`{pattern: ${B}}`},code(B){let{gen:F,data:L,$data:J,schema:z,schemaCode:K,it:H}=B,D=H.opts.unicodeRegExp?"u":"";if(J){let{regExp:I}=H.opts.code,A=I.code==="new RegExp"?Y._`new RegExp`:(0,X.useFunc)(F,I),M=F.let("valid");F.try(()=>F.assign(M,Y._`${A}(${K}, ${D}).test(${L})`),()=>F.assign(M,!1)),B.fail$data(Y._`!${M}`)}else{let I=(0,Q.usePattern)(B,z);B.fail$data(Y._`!${I}.test(${L})`)}}};W.default=G}),uV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxProperties"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} properties`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxProperties"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`Object.keys(${B}).length ${L} ${F}`)}};W.default=X}),lV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=f6(),X=E0(),Y=k0(),G={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:B}})=>X.str`must have required property '${B}'`,params:({params:{missingProperty:B}})=>X._`{missingProperty: ${B}}`},code(B){let{gen:F,schema:L,schemaCode:J,data:z,$data:K,it:H}=B,{opts:D}=H;if(!K&&L.length===0)return;let I=L.length>=D.loopRequired;if(H.allErrors)A();else M();if(D.strictRequired){let V=B.parentSchema.properties,{definedProperties:U}=B.it;for(let j of L)if((V===null||V===void 0?void 0:V[j])===void 0&&!U.has(j)){let T=`required property "${j}" is not defined at "${H.schemaEnv.baseId+H.errSchemaPath}" (strictRequired)`;(0,Y.checkStrictMode)(H,T,H.opts.strictRequired)}}function A(){if(I||K)B.block$data(X.nil,N);else for(let V of L)(0,Q.checkReportMissingProp)(B,V)}function M(){let V=F.let("missing");if(I||K){let U=F.let("valid",!0);B.block$data(U,()=>Z(V,U)),B.ok(U)}else F.if((0,Q.checkMissingProp)(B,L,V)),(0,Q.reportMissingProp)(B,V),F.else()}function N(){F.forOf("prop",J,(V)=>{B.setParams({missingProperty:V}),F.if((0,Q.noPropertyInData)(F,z,V,D.ownProperties),()=>B.error())})}function Z(V,U){B.setParams({missingProperty:V}),F.forOf(V,J,()=>{F.assign(U,(0,Q.propertyInData)(F,z,V,D.ownProperties)),F.if((0,X.not)(U),()=>{B.error(),F.break()})},X.nil)}}};W.default=G}),mV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxItems"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} items`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxItems"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`${B}.length ${L} ${F}`)}};W.default=X}),oG=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=$K();Q.code='require("ajv/dist/runtime/equal").default',W.default=Q}),cV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=aQ(),X=E0(),Y=k0(),G=oG(),B={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:F,j:L}})=>X.str`must NOT have duplicate items (items ## ${L} and ${F} are identical)`,params:({params:{i:F,j:L}})=>X._`{i: ${F}, j: ${L}}`},code(F){let{gen:L,data:J,$data:z,schema:K,parentSchema:H,schemaCode:D,it:I}=F;if(!z&&!K)return;let A=L.let("valid"),M=H.items?(0,Q.getSchemaTypes)(H.items):[];F.block$data(A,N,X._`${D} === false`),F.ok(A);function N(){let j=L.let("i",X._`${J}.length`),T=L.let("j");F.setParams({i:j,j:T}),L.assign(A,!0),L.if(X._`${j} > 1`,()=>(Z()?V:U)(j,T))}function Z(){return M.length>0&&!M.some((j)=>j==="object"||j==="array")}function V(j,T){let O=L.name("item"),w=(0,Q.checkDataTypes)(M,O,I.opts.strictNumbers,Q.DataType.Wrong),R=L.const("indices",X._`{}`);L.for(X._`;${j}--;`,()=>{if(L.let(O,X._`${J}[${j}]`),L.if(w,X._`continue`),M.length>1)L.if(X._`typeof ${O} == "string"`,X._`${O} += "_"`);L.if(X._`typeof ${R}[${O}] == "number"`,()=>{L.assign(T,X._`${R}[${O}]`),F.error(),L.assign(A,!1).break()}).code(X._`${R}[${O}] = ${j}`)})}function U(j,T){let O=(0,Y.useFunc)(L,G.default),w=L.name("outer");L.label(w).for(X._`;${j}--;`,()=>L.for(X._`${T} = ${j}; ${T}--;`,()=>L.if(X._`${O}(${J}[${j}], ${J}[${T}])`,()=>{F.error(),L.assign(A,!1).break(w)})))}}};W.default=B}),pV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y=oG(),G={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:B})=>Q._`{allowedValue: ${B}}`},code(B){let{gen:F,data:L,$data:J,schemaCode:z,schema:K}=B;if(J||K&&typeof K=="object")B.fail$data(Q._`!${(0,X.useFunc)(F,Y.default)}(${L}, ${z})`);else B.fail(Q._`${K} !== ${L}`)}};W.default=G}),dV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y=oG(),G={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:B})=>Q._`{allowedValues: ${B}}`},code(B){let{gen:F,data:L,$data:J,schema:z,schemaCode:K,it:H}=B;if(!J&&z.length===0)throw Error("enum must have non-empty array");let D=z.length>=H.opts.loopEnum,I,A=()=>I!==null&&I!==void 0?I:I=(0,X.useFunc)(F,Y.default),M;if(D||J)M=F.let("valid"),B.block$data(M,N);else{if(!Array.isArray(z))throw Error("ajv implementation error");let V=F.const("vSchema",K);M=(0,Q.or)(...z.map((U,j)=>Z(V,j)))}B.pass(M);function N(){F.assign(M,!1),F.forOf("v",K,(V)=>F.if(Q._`${A()}(${L}, ${V})`,()=>F.assign(M,!0).break()))}function Z(V,U){let j=z[U];return typeof j==="object"&&j!==null?Q._`${A()}(${L}, ${V}[${U}])`:Q._`${L} === ${j}`}}};W.default=G}),VK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=_V(),X=gV(),Y=xV(),G=hV(),B=uV(),F=lV(),L=mV(),J=cV(),z=pV(),K=dV(),H=[Q.default,X.default,Y.default,G.default,B.default,F.default,L.default,J.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},z.default,K.default];W.default=H}),wK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateAdditionalItems=void 0;let Q=E0(),X=k0(),Y={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:B}})=>Q.str`must NOT have more than ${B} items`,params:({params:{len:B}})=>Q._`{limit: ${B}}`},code(B){let{parentSchema:F,it:L}=B,{items:J}=F;if(!Array.isArray(J)){(0,X.checkStrictMode)(L,'"additionalItems" is ignored when "items" is not an array of schemas');return}G(B,J)}};function G(B,F){let{gen:L,schema:J,data:z,keyword:K,it:H}=B;H.items=!0;let D=L.const("len",Q._`${z}.length`);if(J===!1)B.setParams({len:F.length}),B.pass(Q._`${D} <= ${F.length}`);else if(typeof J=="object"&&!(0,X.alwaysValidSchema)(H,J)){let A=L.var("valid",Q._`${D} <= ${F.length}`);L.if((0,Q.not)(A),()=>I(A)),B.ok(A)}function I(A){L.forRange("i",F.length,D,(M)=>{if(B.subschema({keyword:K,dataProp:M,dataPropType:X.Type.Num},A),!H.allErrors)L.if((0,Q.not)(A),()=>L.break())})}}W.validateAdditionalItems=G,W.default=Y}),DK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateTuple=void 0;let Q=E0(),X=k0(),Y=f6(),G={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(F){let{schema:L,it:J}=F;if(Array.isArray(L))return B(F,"additionalItems",L);if(J.items=!0,(0,X.alwaysValidSchema)(J,L))return;F.ok((0,Y.validateArray)(F))}};function B(F,L,J=F.schema){let{gen:z,parentSchema:K,data:H,keyword:D,it:I}=F;if(N(K),I.opts.unevaluated&&J.length&&I.items!==!0)I.items=X.mergeEvaluated.items(z,J.length,I.items);let A=z.name("valid"),M=z.const("len",Q._`${H}.length`);J.forEach((Z,V)=>{if((0,X.alwaysValidSchema)(I,Z))return;z.if(Q._`${M} > ${V}`,()=>F.subschema({keyword:D,schemaProp:V,dataProp:V},A)),F.ok(A)});function N(Z){let{opts:V,errSchemaPath:U}=I,j=J.length,T=j===Z.minItems&&(j===Z.maxItems||Z[L]===!1);if(V.strictTuples&&!T){let O=`"${D}" is ${j}-tuple, but minItems or maxItems/${L} are not specified or different at path "${U}"`;(0,X.checkStrictMode)(I,O,V.strictTuples)}}}W.validateTuple=B,W.default=G}),iV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=DK(),X={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Y)=>(0,Q.validateTuple)(Y,"items")};W.default=X}),nV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y=f6(),G=wK(),B={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:F}})=>Q.str`must NOT have more than ${F} items`,params:({params:{len:F}})=>Q._`{limit: ${F}}`},code(F){let{schema:L,parentSchema:J,it:z}=F,{prefixItems:K}=J;if(z.items=!0,(0,X.alwaysValidSchema)(z,L))return;if(K)(0,G.validateAdditionalItems)(F,K);else F.ok((0,Y.validateArray)(F))}};W.default=B}),rV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:G,max:B}})=>B===void 0?Q.str`must contain at least ${G} valid item(s)`:Q.str`must contain at least ${G} and no more than ${B} valid item(s)`,params:({params:{min:G,max:B}})=>B===void 0?Q._`{minContains: ${G}}`:Q._`{minContains: ${G}, maxContains: ${B}}`},code(G){let{gen:B,schema:F,parentSchema:L,data:J,it:z}=G,K,H,{minContains:D,maxContains:I}=L;if(z.opts.next)K=D===void 0?1:D,H=I;else K=1;let A=B.const("len",Q._`${J}.length`);if(G.setParams({min:K,max:H}),H===void 0&&K===0){(0,X.checkStrictMode)(z,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&K>H){(0,X.checkStrictMode)(z,'"minContains" > "maxContains" is always invalid'),G.fail();return}if((0,X.alwaysValidSchema)(z,F)){let U=Q._`${A} >= ${K}`;if(H!==void 0)U=Q._`${U} && ${A} <= ${H}`;G.pass(U);return}z.items=!0;let M=B.name("valid");if(H===void 0&&K===1)Z(M,()=>B.if(M,()=>B.break()));else if(K===0){if(B.let(M,!0),H!==void 0)B.if(Q._`${J}.length > 0`,N)}else B.let(M,!1),N();G.result(M,()=>G.reset());function N(){let U=B.name("_valid"),j=B.let("count",0);Z(U,()=>B.if(U,()=>V(j)))}function Z(U,j){B.forRange("i",0,A,(T)=>{G.subschema({keyword:"contains",dataProp:T,dataPropType:X.Type.Num,compositeRule:!0},U),j()})}function V(U){if(B.code(Q._`${U}++`),H===void 0)B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0).break());else if(B.if(Q._`${U} > ${H}`,()=>B.assign(M,!1).break()),K===1)B.assign(M,!0);else B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0))}}};W.default=Y}),aG=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateSchemaDeps=W.validatePropertyDeps=W.error=void 0;let Q=E0(),X=k0(),Y=f6();W.error={message:({params:{property:J,depsCount:z,deps:K}})=>{let H=z===1?"property":"properties";return Q.str`must have ${H} ${K} when property ${J} is present`},params:({params:{property:J,depsCount:z,deps:K,missingProperty:H}})=>Q._`{property: ${J},
77
+ missingProperty: ${H},
78
+ depsCount: ${z},
79
+ deps: ${K}}`};let G={keyword:"dependencies",type:"object",schemaType:"object",error:W.error,code(J){let[z,K]=B(J);F(J,z),L(J,K)}};function B({schema:J}){let z={},K={};for(let H in J){if(H==="__proto__")continue;let D=Array.isArray(J[H])?z:K;D[H]=J[H]}return[z,K]}function F(J,z=J.schema){let{gen:K,data:H,it:D}=J;if(Object.keys(z).length===0)return;let I=K.let("missing");for(let A in z){let M=z[A];if(M.length===0)continue;let N=(0,Y.propertyInData)(K,H,A,D.opts.ownProperties);if(J.setParams({property:A,depsCount:M.length,deps:M.join(", ")}),D.allErrors)K.if(N,()=>{for(let Z of M)(0,Y.checkReportMissingProp)(J,Z)});else K.if(Q._`${N} && (${(0,Y.checkMissingProp)(J,M,I)})`),(0,Y.reportMissingProp)(J,I),K.else()}}W.validatePropertyDeps=F;function L(J,z=J.schema){let{gen:K,data:H,keyword:D,it:I}=J,A=K.name("valid");for(let M in z){if((0,X.alwaysValidSchema)(I,z[M]))continue;K.if((0,Y.propertyInData)(K,H,M,I.opts.ownProperties),()=>{let N=J.subschema({keyword:D,schemaProp:M},A);J.mergeValidEvaluated(N,A)},()=>K.var(A,!0)),J.ok(A)}}W.validateSchemaDeps=L,W.default=G}),oV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:G})=>Q._`{propertyName: ${G.propertyName}}`},code(G){let{gen:B,schema:F,data:L,it:J}=G;if((0,X.alwaysValidSchema)(J,F))return;let z=B.name("valid");B.forIn("key",L,(K)=>{G.setParams({propertyName:K}),G.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},z),B.if((0,Q.not)(z),()=>{if(G.error(!0),!J.allErrors)B.break()})}),G.ok(z)}};W.default=Y}),MK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=f6(),X=E0(),Y=g6(),G=k0(),B={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:F})=>X._`{additionalProperty: ${F.additionalProperty}}`},code(F){let{gen:L,schema:J,parentSchema:z,data:K,errsCount:H,it:D}=F;if(!H)throw Error("ajv implementation error");let{allErrors:I,opts:A}=D;if(D.props=!0,A.removeAdditional!=="all"&&(0,G.alwaysValidSchema)(D,J))return;let M=(0,Q.allSchemaProperties)(z.properties),N=(0,Q.allSchemaProperties)(z.patternProperties);Z(),F.ok(X._`${H} === ${Y.default.errors}`);function Z(){L.forIn("key",K,(O)=>{if(!M.length&&!N.length)j(O);else L.if(V(O),()=>j(O))})}function V(O){let w;if(M.length>8){let R=(0,G.schemaRefOrVal)(D,z.properties,"properties");w=(0,Q.isOwnProperty)(L,R,O)}else if(M.length)w=(0,X.or)(...M.map((R)=>X._`${O} === ${R}`));else w=X.nil;if(N.length)w=(0,X.or)(w,...N.map((R)=>X._`${(0,Q.usePattern)(F,R)}.test(${O})`));return(0,X.not)(w)}function U(O){L.code(X._`delete ${K}[${O}]`)}function j(O){if(A.removeAdditional==="all"||A.removeAdditional&&J===!1){U(O);return}if(J===!1){if(F.setParams({additionalProperty:O}),F.error(),!I)L.break();return}if(typeof J=="object"&&!(0,G.alwaysValidSchema)(D,J)){let w=L.name("valid");if(A.removeAdditional==="failing")T(O,w,!1),L.if((0,X.not)(w),()=>{F.reset(),U(O)});else if(T(O,w),!I)L.if((0,X.not)(w),()=>L.break())}}function T(O,w,R){let k={keyword:"additionalProperties",dataProp:O,dataPropType:G.Type.Str};if(R===!1)Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1});F.subschema(k,w)}}};W.default=B}),aV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=lW(),X=f6(),Y=k0(),G=MK(),B={keyword:"properties",type:"object",schemaType:"object",code(F){let{gen:L,schema:J,parentSchema:z,data:K,it:H}=F;if(H.opts.removeAdditional==="all"&&z.additionalProperties===void 0)G.default.code(new Q.KeywordCxt(H,G.default,"additionalProperties"));let D=(0,X.allSchemaProperties)(J);for(let Z of D)H.definedProperties.add(Z);if(H.opts.unevaluated&&D.length&&H.props!==!0)H.props=Y.mergeEvaluated.props(L,(0,Y.toHash)(D),H.props);let I=D.filter((Z)=>!(0,Y.alwaysValidSchema)(H,J[Z]));if(I.length===0)return;let A=L.name("valid");for(let Z of I){if(M(Z))N(Z);else{if(L.if((0,X.propertyInData)(L,K,Z,H.opts.ownProperties)),N(Z),!H.allErrors)L.else().var(A,!0);L.endIf()}F.it.definedProperties.add(Z),F.ok(A)}function M(Z){return H.opts.useDefaults&&!H.compositeRule&&J[Z].default!==void 0}function N(Z){F.subschema({keyword:"properties",schemaProp:Z,dataProp:Z},A)}}};W.default=B}),sV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=f6(),X=E0(),Y=k0(),G=k0(),B={keyword:"patternProperties",type:"object",schemaType:"object",code(F){let{gen:L,schema:J,data:z,parentSchema:K,it:H}=F,{opts:D}=H,I=(0,Q.allSchemaProperties)(J),A=I.filter((T)=>(0,Y.alwaysValidSchema)(H,J[T]));if(I.length===0||A.length===I.length&&(!H.opts.unevaluated||H.props===!0))return;let M=D.strictSchema&&!D.allowMatchingProperties&&K.properties,N=L.name("valid");if(H.props!==!0&&!(H.props instanceof X.Name))H.props=(0,G.evaluatedPropsToName)(L,H.props);let{props:Z}=H;V();function V(){for(let T of I){if(M)U(T);if(H.allErrors)j(T);else L.var(N,!0),j(T),L.if(N)}}function U(T){for(let O in M)if(new RegExp(T).test(O))(0,Y.checkStrictMode)(H,`property ${O} matches pattern ${T} (use allowMatchingProperties)`)}function j(T){L.forIn("key",z,(O)=>{L.if(X._`${(0,Q.usePattern)(F,T)}.test(${O})`,()=>{let w=A.includes(T);if(!w)F.subschema({keyword:"patternProperties",schemaProp:T,dataProp:O,dataPropType:G.Type.Str},N);if(H.opts.unevaluated&&Z!==!0)L.assign(X._`${Z}[${O}]`,!0);else if(!w&&!H.allErrors)L.if((0,X.not)(N),()=>L.break())})})}}};W.default=B}),tV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=k0(),X={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Y){let{gen:G,schema:B,it:F}=Y;if((0,Q.alwaysValidSchema)(F,B)){Y.fail();return}let L=G.name("valid");Y.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},L),Y.failResult(L,()=>Y.reset(),()=>Y.error())},error:{message:"must NOT be valid"}};W.default=X}),eV=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:f6().validateUnion,error:{message:"must match a schema in anyOf"}};W.default=Q}),Ww=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:G})=>Q._`{passingSchemas: ${G.passing}}`},code(G){let{gen:B,schema:F,parentSchema:L,it:J}=G;if(!Array.isArray(F))throw Error("ajv implementation error");if(J.opts.discriminator&&L.discriminator)return;let z=F,K=B.let("valid",!1),H=B.let("passing",null),D=B.name("_valid");G.setParams({passing:H}),B.block(I),G.result(K,()=>G.reset(),()=>G.error(!0));function I(){z.forEach((A,M)=>{let N;if((0,X.alwaysValidSchema)(J,A))B.var(D,!0);else N=G.subschema({keyword:"oneOf",schemaProp:M,compositeRule:!0},D);if(M>0)B.if(Q._`${D} && ${K}`).assign(K,!1).assign(H,Q._`[${H}, ${M}]`).else();B.if(D,()=>{if(B.assign(K,!0),B.assign(H,M),N)G.mergeEvaluated(N,Q.Name)})})}}};W.default=Y}),Qw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=k0(),X={keyword:"allOf",schemaType:"array",code(Y){let{gen:G,schema:B,it:F}=Y;if(!Array.isArray(B))throw Error("ajv implementation error");let L=G.name("valid");B.forEach((J,z)=>{if((0,Q.alwaysValidSchema)(F,J))return;let K=Y.subschema({keyword:"allOf",schemaProp:z},L);Y.ok(L),Y.mergeEvaluated(K)})}};W.default=X}),Xw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:B})=>Q.str`must match "${B.ifClause}" schema`,params:({params:B})=>Q._`{failingKeyword: ${B.ifClause}}`},code(B){let{gen:F,parentSchema:L,it:J}=B;if(L.then===void 0&&L.else===void 0)(0,X.checkStrictMode)(J,'"if" without "then" and "else" is ignored');let z=G(J,"then"),K=G(J,"else");if(!z&&!K)return;let H=F.let("valid",!0),D=F.name("_valid");if(I(),B.reset(),z&&K){let M=F.let("ifClause");B.setParams({ifClause:M}),F.if(D,A("then",M),A("else",M))}else if(z)F.if(D,A("then"));else F.if((0,Q.not)(D),A("else"));B.pass(H,()=>B.error(!0));function I(){let M=B.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},D);B.mergeEvaluated(M)}function A(M,N){return()=>{let Z=B.subschema({keyword:M},D);if(F.assign(H,D),B.mergeValidEvaluated(Z,H),N)F.assign(N,Q._`${M}`);else B.setParams({ifClause:M})}}}};function G(B,F){let L=B.schema[F];return L!==void 0&&!(0,X.alwaysValidSchema)(B,L)}W.default=Y}),Yw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=k0(),X={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Y,parentSchema:G,it:B}){if(G.if===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "if" is ignored`)}};W.default=X}),jK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=wK(),X=iV(),Y=DK(),G=nV(),B=rV(),F=aG(),L=oV(),J=MK(),z=aV(),K=sV(),H=tV(),D=eV(),I=Ww(),A=Qw(),M=Xw(),N=Yw();function Z(V=!1){let U=[H.default,D.default,I.default,A.default,M.default,N.default,L.default,J.default,F.default,z.default,K.default];if(V)U.push(X.default,G.default);else U.push(Q.default,Y.default);return U.push(B.default),U}W.default=Z}),Gw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must match format "${Y}"`,params:({schemaCode:Y})=>Q._`{format: ${Y}}`},code(Y,G){let{gen:B,data:F,$data:L,schema:J,schemaCode:z,it:K}=Y,{opts:H,errSchemaPath:D,schemaEnv:I,self:A}=K;if(!H.validateFormats)return;if(L)M();else N();function M(){let Z=B.scopeValue("formats",{ref:A.formats,code:H.code.formats}),V=B.const("fDef",Q._`${Z}[${z}]`),U=B.let("fType"),j=B.let("format");B.if(Q._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>B.assign(U,Q._`${V}.type || "string"`).assign(j,Q._`${V}.validate`),()=>B.assign(U,Q._`"string"`).assign(j,V)),Y.fail$data((0,Q.or)(T(),O()));function T(){if(H.strictSchema===!1)return Q.nil;return Q._`${z} && !${j}`}function O(){let w=I.$async?Q._`(${V}.async ? await ${j}(${F}) : ${j}(${F}))`:Q._`${j}(${F})`,R=Q._`(typeof ${j} == "function" ? ${w} : ${j}.test(${F}))`;return Q._`${j} && ${j} !== true && ${U} === ${G} && !${R}`}}function N(){let Z=A.formats[J];if(!Z){T();return}if(Z===!0)return;let[V,U,j]=O(Z);if(V===G)Y.pass(w());function T(){if(H.strictSchema===!1){A.logger.warn(R());return}throw Error(R());function R(){return`unknown format "${J}" ignored in schema at path "${D}"`}}function O(R){let k=R instanceof RegExp?(0,Q.regexpCode)(R):H.code.formats?Q._`${H.code.formats}${(0,Q.getProperty)(J)}`:void 0,l=B.scopeValue("formats",{key:J,ref:R,code:k});if(typeof R=="object"&&!(R instanceof RegExp))return[R.type||"string",R.validate,Q._`${l}.validate`];return["string",R,l]}function w(){if(typeof Z=="object"&&!(Z instanceof RegExp)&&Z.async){if(!I.$async)throw Error("async format in sync schema");return Q._`await ${j}(${F})`}return typeof U=="function"?Q._`${j}(${F})`:Q._`${j}.test(${F})`}}}};W.default=X}),OK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=[Gw().default];W.default=Q}),EK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.contentVocabulary=W.metadataVocabulary=void 0,W.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],W.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),Bw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=NK(),X=VK(),Y=jK(),G=OK(),B=EK(),F=[Q.default,X.default,(0,Y.default)(),G.default,B.metadataVocabulary,B.contentVocabulary];W.default=F}),Fw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.DiscrError=void 0;var Q;(function(X){X.Tag="tag",X.Mapping="mapping"})(Q||(W.DiscrError=Q={}))}),IK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=Fw(),Y=WX(),G=mW(),B=k0(),F={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:L,tagName:J}})=>L===X.DiscrError.Tag?`tag "${J}" must be string`:`value of tag "${J}" must be in oneOf`,params:({params:{discrError:L,tag:J,tagName:z}})=>Q._`{error: ${L}, tag: ${z}, tagValue: ${J}}`},code(L){let{gen:J,data:z,schema:K,parentSchema:H,it:D}=L,{oneOf:I}=H;if(!D.opts.discriminator)throw Error("discriminator: requires discriminator option");let A=K.propertyName;if(typeof A!="string")throw Error("discriminator: requires propertyName");if(K.mapping)throw Error("discriminator: mapping is not supported");if(!I)throw Error("discriminator: requires oneOf keyword");let M=J.let("valid",!1),N=J.const("tag",Q._`${z}${(0,Q.getProperty)(A)}`);J.if(Q._`typeof ${N} == "string"`,()=>Z(),()=>L.error(!1,{discrError:X.DiscrError.Tag,tag:N,tagName:A})),L.ok(M);function Z(){let j=U();J.if(!1);for(let T in j)J.elseIf(Q._`${N} === ${T}`),J.assign(M,V(j[T]));J.else(),L.error(!1,{discrError:X.DiscrError.Mapping,tag:N,tagName:A}),J.endIf()}function V(j){let T=J.name("valid"),O=L.subschema({keyword:"oneOf",schemaProp:j},T);return L.mergeEvaluated(O,Q.Name),T}function U(){var j;let T={},O=R(H),w=!0;for(let _=0;_<I.length;_++){let h=I[_];if((h===null||h===void 0?void 0:h.$ref)&&!(0,B.schemaHasRulesButRef)(h,D.self.RULES)){let p=h.$ref;if(h=Y.resolveRef.call(D.self,D.schemaEnv.root,D.baseId,p),h instanceof Y.SchemaEnv)h=h.schema;if(h===void 0)throw new G.default(D.opts.uriResolver,D.baseId,p)}let d=(j=h===null||h===void 0?void 0:h.properties)===null||j===void 0?void 0:j[A];if(typeof d!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);w=w&&(O||R(h)),k(d,_)}if(!w)throw Error(`discriminator: "${A}" must be required`);return T;function R({required:_}){return Array.isArray(_)&&_.includes(A)}function k(_,h){if(_.const)l(_.const,h);else if(_.enum)for(let d of _.enum)l(d,h);else throw Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function l(_,h){if(typeof _!="string"||_ in T)throw Error(`discriminator: "${A}" values must be unique strings`);T[_]=h}}}};W.default=F}),Lw=Q0((W,Q)=>{Q.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),TK=Q0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv=void 0;let X=AK(),Y=Bw(),G=IK(),B=Lw(),F=["/properties"],L="http://json-schema.org/draft-07/schema";var J=class extends X.default{_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(B,F):B;this.addMetaSchema(I,L,!1),this.refs["http://json-schema.org/schema"]=L}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(L)?L:void 0)}};W.Ajv=J,Q.exports=W=J,Q.exports.Ajv=J,Object.defineProperty(W,"__esModule",{value:!0}),W.default=J;var z=lW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return z.KeywordCxt}});var K=E0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return K._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return K.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return K.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return K.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return K.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return K.CodeGen}});var H=eQ();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return H.default}});var D=mW();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return D.default}})}),RK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicAnchor=void 0;let Q=E0(),X=g6(),Y=WX(),G=rG(),B={keyword:"$dynamicAnchor",schemaType:"string",code:(J)=>F(J,J.schema)};function F(J,z){let{gen:K,it:H}=J;H.schemaEnv.root.dynamicAnchors[z]=!0;let D=Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(z)}`,I=H.errSchemaPath==="#"?H.validateName:L(J);K.if(Q._`!${D}`,()=>K.assign(D,I))}W.dynamicAnchor=F;function L(J){let{schemaEnv:z,schema:K,self:H}=J.it,{root:D,baseId:I,localRefs:A,meta:M}=z.root,{schemaId:N}=H.opts,Z=new Y.SchemaEnv({schema:K,schemaId:N,root:D,baseId:I,localRefs:A,meta:M});return Y.compileSchema.call(H,Z),(0,G.getValidate)(J,Z)}W.default=B}),PK=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicRef=void 0;let Q=E0(),X=g6(),Y=rG(),G={keyword:"$dynamicRef",schemaType:"string",code:(F)=>B(F,F.schema)};function B(F,L){let{gen:J,keyword:z,it:K}=F;if(L[0]!=="#")throw Error(`"${z}" only supports hash fragment reference`);let H=L.slice(1);if(K.allErrors)D();else{let A=J.let("valid",!1);D(A),F.ok(A)}function D(A){if(K.schemaEnv.root.dynamicAnchors[H]){let M=J.let("_v",Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(H)}`);J.if(M,I(M,A),I(K.validateName,A))}else I(K.validateName,A)()}function I(A,M){return M?()=>J.block(()=>{(0,Y.callRef)(F,A),J.let(M,!0)}):()=>(0,Y.callRef)(F,A)}}W.dynamicRef=B,W.default=G}),Jw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=RK(),X=k0(),Y={keyword:"$recursiveAnchor",schemaType:"boolean",code(G){if(G.schema)(0,Q.dynamicAnchor)(G,"");else(0,X.checkStrictMode)(G.it,"$recursiveAnchor: false is ignored")}};W.default=Y}),zw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=PK(),X={keyword:"$recursiveRef",schemaType:"string",code:(Y)=>(0,Q.dynamicRef)(Y,Y.schema)};W.default=X}),Kw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=RK(),X=PK(),Y=Jw(),G=zw(),B=[Q.default,X.default,Y.default,G.default];W.default=B}),Zw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=aG(),X={keyword:"dependentRequired",type:"object",schemaType:"object",error:Q.error,code:(Y)=>(0,Q.validatePropertyDeps)(Y)};W.default=X}),Hw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=aG(),X={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(Y)=>(0,Q.validateSchemaDeps)(Y)};W.default=X}),$w=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=k0(),X={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:Y,parentSchema:G,it:B}){if(G.contains===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "contains" is ignored`)}};W.default=X}),Uw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=Zw(),X=Hw(),Y=$w(),G=[Q.default,X.default,Y.default];W.default=G}),Aw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y=g6(),G={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:B})=>Q._`{unevaluatedProperty: ${B.unevaluatedProperty}}`},code(B){let{gen:F,schema:L,data:J,errsCount:z,it:K}=B;if(!z)throw Error("ajv implementation error");let{allErrors:H,props:D}=K;if(D instanceof Q.Name)F.if(Q._`${D} !== true`,()=>F.forIn("key",J,(N)=>F.if(A(D,N),()=>I(N))));else if(D!==!0)F.forIn("key",J,(N)=>D===void 0?I(N):F.if(M(D,N),()=>I(N)));K.props=!0,B.ok(Q._`${z} === ${Y.default.errors}`);function I(N){if(L===!1){if(B.setParams({unevaluatedProperty:N}),B.error(),!H)F.break();return}if(!(0,X.alwaysValidSchema)(K,L)){let Z=F.name("valid");if(B.subschema({keyword:"unevaluatedProperties",dataProp:N,dataPropType:X.Type.Str},Z),!H)F.if((0,Q.not)(Z),()=>F.break())}}function A(N,Z){return Q._`!${N} || !${N}[${Z}]`}function M(N,Z){let V=[];for(let U in N)if(N[U]===!0)V.push(Q._`${Z} !== ${U}`);return(0,Q.and)(...V)}}};W.default=G}),Nw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=E0(),X=k0(),Y={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:G}})=>Q.str`must NOT have more than ${G} items`,params:({params:{len:G}})=>Q._`{limit: ${G}}`},code(G){let{gen:B,schema:F,data:L,it:J}=G,z=J.items||0;if(z===!0)return;let K=B.const("len",Q._`${L}.length`);if(F===!1)G.setParams({len:z}),G.fail(Q._`${K} > ${z}`);else if(typeof F=="object"&&!(0,X.alwaysValidSchema)(J,F)){let D=B.var("valid",Q._`${K} <= ${z}`);B.if((0,Q.not)(D),()=>H(D,z)),G.ok(D)}J.items=!0;function H(D,I){B.forRange("i",I,K,(A)=>{if(G.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:X.Type.Num},D),!J.allErrors)B.if((0,Q.not)(D),()=>B.break())})}}};W.default=Y}),Vw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=Aw(),X=Nw(),Y=[Q.default,X.default];W.default=Y}),ww=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=NK(),X=VK(),Y=jK(),G=Kw(),B=Uw(),F=Vw(),L=OK(),J=EK(),z=[G.default,Q.default,X.default,(0,Y.default)(!0),L.default,J.metadataVocabulary,J.contentVocabulary,B.default,F.default];W.default=z}),Dw=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),Mw=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),jw=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),Ow=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),Ew=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),Iw=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),Tw=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),Rw=Q0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),Pw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=Dw(),X=Mw(),Y=jw(),G=Ow(),B=Ew(),F=Iw(),L=Tw(),J=Rw(),z=["/properties"];function K(H){return[Q,X,Y,G,B,D(this,F),L,D(this,J)].forEach((I)=>this.addMetaSchema(I,void 0,!1)),this;function D(I,A){return H?I.$dataMetaSchema(A,z):A}}W.default=K}),bw=Q0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv2020=void 0;let X=AK(),Y=ww(),G=IK(),B=Pw(),F="https://json-schema.org/draft/2020-12/schema";var L=class extends X.default{constructor(D={}){super({...D,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((D)=>this.addVocabulary(D)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:D,meta:I}=this.opts;if(!I)return;B.default.call(this,D),this.refs["http://json-schema.org/schema"]=F}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(F)?F:void 0)}};W.Ajv2020=L,Q.exports=W=L,Q.exports.Ajv2020=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L;var J=lW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return J.KeywordCxt}});var z=E0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return z._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return z.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return z.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return z.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return z.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return z.CodeGen}});var K=eQ();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return K.default}});var H=mW();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return H.default}})}),Sw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatNames=W.fastFormats=W.fullFormats=void 0;function Q(_,h){return{validate:_,compare:h}}W.fullFormats={date:Q(B,F),time:Q(J(!0),z),"date-time":Q(D(!0),I),"iso-time":Q(J(),K),"iso-date-time":Q(D(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Z,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:l,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:U,int32:{type:"number",validate:O},int64:{type:"number",validate:w},float:{type:"number",validate:R},double:{type:"number",validate:R},password:!0,binary:!0},W.fastFormats={...W.fullFormats,date:Q(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,F),time:Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,z),"date-time":Q(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,I),"iso-time":Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,K),"iso-date-time":Q(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,A),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},W.formatNames=Object.keys(W.fullFormats);function X(_){return _%4===0&&(_%100!==0||_%400===0)}let Y=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,G=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B(_){let h=Y.exec(_);if(!h)return!1;let d=+h[1],p=+h[2],z0=+h[3];return p>=1&&p<=12&&z0>=1&&z0<=(p===2&&X(d)?29:G[p])}function F(_,h){if(!(_&&h))return;if(_>h)return 1;if(_<h)return-1;return 0}let L=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function J(_){return function(d){let p=L.exec(d);if(!p)return!1;let z0=+p[1],M0=+p[2],V0=+p[3],P0=p[4],Z0=p[5]==="-"?-1:1,S=+(p[6]||0),v=+(p[7]||0);if(S>23||v>59||_&&!P0)return!1;if(z0<=23&&M0<=59&&V0<60)return!0;let u=M0-v*Z0,E=z0-S*Z0-(u<0?1:0);return(E===23||E===-1)&&(u===59||u===-1)&&V0<61}}function z(_,h){if(!(_&&h))return;let d=new Date("2020-01-01T"+_).valueOf(),p=new Date("2020-01-01T"+h).valueOf();if(!(d&&p))return;return d-p}function K(_,h){if(!(_&&h))return;let d=L.exec(_),p=L.exec(h);if(!(d&&p))return;if(_=d[1]+d[2]+d[3],h=p[1]+p[2]+p[3],_>h)return 1;if(_<h)return-1;return 0}let H=/t|\s/i;function D(_){let h=J(_);return function(p){let z0=p.split(H);return z0.length===2&&B(z0[0])&&h(z0[1])}}function I(_,h){if(!(_&&h))return;let d=new Date(_).valueOf(),p=new Date(h).valueOf();if(!(d&&p))return;return d-p}function A(_,h){if(!(_&&h))return;let[d,p]=_.split(H),[z0,M0]=h.split(H),V0=F(d,z0);if(V0===void 0)return;return V0||z(p,M0)}let M=/\/|:/,N=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Z(_){return M.test(_)&&N.test(_)}let V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function U(_){return V.lastIndex=0,V.test(_)}let j=-2147483648,T=2147483647;function O(_){return Number.isInteger(_)&&_<=T&&_>=j}function w(_){return Number.isInteger(_)}function R(){return!0}let k=/[^\\]\\Z/;function l(_){if(k.test(_))return!1;try{return new RegExp(_),!0}catch(h){return!1}}}),qw=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatLimitDefinition=void 0;let Q=TK(),X=E0(),Y=X.operators,G={formatMaximum:{okStr:"<=",ok:Y.LTE,fail:Y.GT},formatMinimum:{okStr:">=",ok:Y.GTE,fail:Y.LT},formatExclusiveMaximum:{okStr:"<",ok:Y.LT,fail:Y.GTE},formatExclusiveMinimum:{okStr:">",ok:Y.GT,fail:Y.LTE}},B={message:({keyword:L,schemaCode:J})=>X.str`should be ${G[L].okStr} ${J}`,params:({keyword:L,schemaCode:J})=>X._`{comparison: ${G[L].okStr}, limit: ${J}}`};W.formatLimitDefinition={keyword:Object.keys(G),type:"string",schemaType:"string",$data:!0,error:B,code(L){let{gen:J,data:z,schemaCode:K,keyword:H,it:D}=L,{opts:I,self:A}=D;if(!I.validateFormats)return;let M=new Q.KeywordCxt(D,A.RULES.all.format.definition,"format");if(M.$data)N();else Z();function N(){let U=J.scopeValue("formats",{ref:A.formats,code:I.code.formats}),j=J.const("fmt",X._`${U}[${M.schemaCode}]`);L.fail$data((0,X.or)(X._`typeof ${j} != "object"`,X._`${j} instanceof RegExp`,X._`typeof ${j}.compare != "function"`,V(j)))}function Z(){let U=M.schema,j=A.formats[U];if(!j||j===!0)return;if(typeof j!="object"||j instanceof RegExp||typeof j.compare!="function")throw Error(`"${H}": format "${U}" does not define "compare" function`);let T=J.scopeValue("formats",{key:U,ref:j,code:I.code.formats?X._`${I.code.formats}${(0,X.getProperty)(U)}`:void 0});L.fail$data(V(T))}function V(U){return X._`${U}.compare(${z}, ${K}) ${G[H].fail} 0`}},dependencies:["format"]};let F=(L)=>{return L.addKeyword(W.formatLimitDefinition),L};W.default=F}),Cw=Q0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=Sw(),Y=qw(),G=E0(),B=new G.Name("fullFormats"),F=new G.Name("fastFormats"),L=(z,K={keywords:!0})=>{if(Array.isArray(K))return J(z,K,X.fullFormats,B),z;let[H,D]=K.mode==="fast"?[X.fastFormats,F]:[X.fullFormats,B];if(J(z,K.formats||X.formatNames,H,D),K.keywords)(0,Y.default)(z);return z};L.get=(z,K="full")=>{let H=(K==="fast"?X.fastFormats:X.fullFormats)[z];if(!H)throw Error(`Unknown format "${z}"`);return H};function J(z,K,H,D){var I,A;(I=(A=z.opts.code).formats)!==null&&I!==void 0||(A.formats=G._`require("ajv-formats/dist/formats").${D}`);for(let M of K)z.addFormat(M,H[M])}Q.exports=W=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L}),kw=TK(),vw=bw(),yw=BQ(Cw(),1),_w=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),gw=yw.default;IT=kw.Ajv});var sG=H0(()=>{bK()});function eG(W){return!!W&&typeof W==="object"&&gK in W}function hw(W){return W[gK]?.complete}function mw(W){if(W?.maxRounds!==void 0&&(!Number.isInteger(W.maxRounds)||W.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${W.maxRounds})`);if(W?.roundTimeoutMs!==void 0&&(!Number.isFinite(W.roundTimeoutMs)||W.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${W.roundTimeoutMs})`);return{maxRounds:W?.maxRounds??uw,roundTimeoutMs:W?.roundTimeoutMs??lw,legacyShim:W?.legacyShim??!0}}function fK(W,Q,X){if(X===null||typeof X!=="object"||typeof X.method!=="string")throw new N0(K0.InternalError,`Handler for ${W} returned an invalid input request '${Q}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let Y=X,G=vz(Y);if(G===void 0)throw new N0(K0.InternalError,`Handler for ${W} returned an input request '${Q}' of kind '${Y.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:Y,required:G}}function cw(){let W=globalThis.crypto;if(W?.randomUUID!==void 0)return W.randomUUID();let Q=new Uint8Array(16);W.getRandomValues(Q),Q[6]=Q[6]&15|64,Q[8]=Q[8]&63|128;let X=[...Q].map((Y)=>Y.toString(16).padStart(2,"0")).join("");return`${X.slice(0,8)}-${X.slice(8,12)}-${X.slice(12,16)}-${X.slice(16,20)}-${X.slice(20)}`}function tG(W,Q){if(W==="tools/call")return{content:[{type:"text",text:Q}],isError:!0};throw new N0(K0.InternalError,Q)}function ow(W){return{...W}}function SK(W,Q){if(W){let Y=Q;return async(G,B)=>Y(G,B)}let X=Q;return async(Y,G)=>X(G)}function CK(W){if(W===void 0)return;try{return W4(W,"output")}catch{return}}function kK(W,Q,X){if(Q){let Y=X;return async(G,B)=>{let F=await R4(Q,G);if(!F.success)throw new N0(K0.InvalidParams,`Invalid arguments for prompt ${W}: ${F.error}`);return Y(F.data,B)}}else{let Y=X;return async(G,B)=>{return Y(B)}}}function vK(W){return{completion:{values:W.map(String).slice(0,100),total:W.length,hasMore:W.length>100}}}function yK(W){let Q=W;if(Q.shape&&typeof Q.shape==="object")return Q.shape}function aw(W){return W?.type==="optional"}function _K(W){if(!aw(W))return W;return W.def?.innerType??W}var gK,uw=8,lw=600000,pw=class{constructor(W){this._host=W}async fulfill(W,Q,X,Y,G){let{maxRounds:B,roundTimeoutMs:F}=this._host,L=Y.mcpReq.signal,J=G,z=0;while(!0){if(z+=1,z>B)return tG(W,YK(W,B));let K=J.inputRequests,H=K!=null&&Object.keys(K).length>0,D=typeof J.requestState==="string"?J.requestState:void 0;if(!H&&D===void 0)throw new N0(K0.InternalError,`Handler for ${W} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let I;if(H){let N=this._host.resolvedClientCapabilities(Y),Z=[];for(let[U,j]of Object.entries(K)){let{embedded:T,required:O}=fK(W,U,j);if(T.method!=="roots/list"&&T.params===void 0)throw new N0(K0.InternalError,`Handler for ${W} returned an input request '${U}' of kind '${T.method}' without params`);if(cQ(O,N)!==void 0)return tG(W,`Cannot request input '${U}' (${T.method}): the client on this 2025-era connection did not declare the required capability${N===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);Z.push([U,T])}let V=BK(L);try{let U={relatedRequestId:Y.mcpReq.id,timeout:F,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:V.signal},j=await Promise.all(Z.map(async([T,O])=>{try{return[T,await this._dispatchLeg(O,U)]}catch(w){throw V.abort(w),w}}));I=Object.fromEntries(j)}catch(U){if(L.aborted)throw U;return tG(W,`Fulfilling input required by '${W}' failed: ${U instanceof Error?U.message:String(U)}`)}finally{V.dispose()}}else await GK(XK,L);let A={...Y,mcpReq:{...Y.mcpReq,inputResponses:I,droppedInputResponseKeys:void 0,requestState:uW(D)}};if(D!==void 0){let N=await this._host.verifyRequestState(D,A,W);if(N!==void 0)A=lG(A,N)}let M=await Q(X,A);if(!q5(M))return M;J=M}}async _dispatchLeg(W,Q){switch(W.method){case"elicitation/create":{let X=W.params;if(X.mode==="url"&&X.elicitationId===void 0)X={...X,elicitationId:cw()};return await this._host.sendElicitation(X,Q)}case"sampling/createMessage":return await this._host.sendSampling(W.params,Q);case"roots/list":return await this._host.listRoots(W.params,Q)}}},dw,iw,nw,rw,xK,W7=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(W){let Q=this._registeredTools[W];if(Q===void 0||!Q.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,W))return this._toolInputSchemaJson[W];if(Q.inputSchema===void 0)return qK;try{let X=W4(Q.inputSchema,"input");return this._toolInputSchemaJson[W]=X,X}catch{return}}constructor(W,Q){if(this.server=new xK(W,Q),Q?.capabilities?.tools)this.setToolRequestHandlers();if(Q?.capabilities?.resources)this.setResourceRequestHandlers();if(Q?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(W){return await this.server.connect(W)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,W])=>W.enabled).map(([W,Q])=>{let X={name:W,title:Q.title,description:Q.description,inputSchema:Q.inputSchema?W4(Q.inputSchema,"input"):qK,annotations:Q.annotations,icons:Q.icons,execution:Q.execution,_meta:Q._meta};if(Q.outputSchema)X.outputSchema=W4(Q.outputSchema,"output");return X})})),this.server.setRequestHandler("tools/call",async(W,Q)=>{let X=this._registeredTools[W.params.name];if(!X)throw new N0(K0.InvalidParams,`Tool ${W.params.name} not found`);if(!X.enabled)throw new N0(K0.InvalidParams,`Tool ${W.params.name} disabled`);try{let Y=await this.validateToolInput(X,W.params.arguments,W.params.name),G=await this.executeToolHandler(X,Y,Q);if(await this.validateToolOutput(X,G,W.params.name),q5(G))return G;return this.server.projectCallToolResult(G,X.outputSchemaJson)}catch(Y){if(Y instanceof N0&&Y.code===K0.UrlElicitationRequired)throw Y;return this.createToolError(Y instanceof Error?Y.message:String(Y))}}),this._toolHandlersInitialized=!0}createToolError(W){return{content:[{type:"text",text:W}],isError:!0}}async validateToolInput(W,Q,X){if(!W.inputSchema)return;let Y=await R4(W.inputSchema,Q??{});if(!Y.success)throw new N0(K0.InvalidParams,`Input validation error: Invalid arguments for tool ${X}: ${Y.error}`);return Y.data}async validateToolOutput(W,Q,X){if(!W.outputSchema)return;if(q5(Q))return;if(Q.isError)return;if(Q.structuredContent===void 0)throw new N0(K0.InvalidParams,`Output validation error: Tool ${X} has an output schema but no structured content was provided`);let Y=await R4(W.outputSchema,Q.structuredContent);if(!Y.success)throw new N0(K0.InvalidParams,`Output validation error: Invalid structured content for tool ${X}: ${Y.error}`)}async executeToolHandler(W,Q,X){return W.executor(Q,X)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(W)=>{switch(W.params.ref.type){case"ref/prompt":return fG(W),this.handlePromptCompletion(W,W.params.ref);case"ref/resource":return xG(W),this.handleResourceCompletion(W,W.params.ref);default:throw new N0(K0.InvalidParams,`Invalid completion reference: ${W.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(W,Q){let X=this._registeredPrompts[Q.name];if(!X)throw new N0(K0.InvalidParams,`Prompt ${Q.name} not found`);if(!X.enabled)throw new N0(K0.InvalidParams,`Prompt ${Q.name} disabled`);if(!X.argsSchema)return cW;let Y=_K(yK(X.argsSchema)?.[W.params.argument.name]);if(!eG(Y))return cW;let G=hw(Y);if(!G)return cW;return vK(await G(W.params.argument.value,W.params.context))}async handleResourceCompletion(W,Q){let X=Object.values(this._registeredResourceTemplates).find((G)=>G.resourceTemplate.uriTemplate.toString()===Q.uri);if(!X){if(this._registeredResources[Q.uri])return cW;throw new N0(K0.InvalidParams,`Resource template ${W.params.ref.uri} not found`)}let Y=X.resourceTemplate.completeCallback(W.params.argument.name);if(!Y)return cW;return vK(await Y(W.params.argument.value,W.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(W,Q)=>{let X=Object.entries(this._registeredResources).filter(([G,B])=>B.enabled).map(([G,B])=>({uri:G,name:B.name,...B.metadata})),Y=[];for(let G of Object.values(this._registeredResourceTemplates)){if(!G.resourceTemplate.listCallback)continue;let B=await G.resourceTemplate.listCallback(Q);for(let F of B.resources)Y.push({...G.metadata,...F})}return{resources:[...X,...Y]}}),this.server.setRequestHandler("resources/templates/list",async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([W,Q])=>({name:W,uriTemplate:Q.resourceTemplate.uriTemplate.toString(),...Q.metadata}))}}),this.server.setRequestHandler("resources/read",async(W,Q)=>{let X;try{X=new URL(W.params.uri)}catch{throw new N0(K0.InvalidParams,`Resource URI ${W.params.uri} is invalid`,{uri:W.params.uri,reason:"invalid_uri"})}let Y=this._registeredResources[X.toString()];if(Y){if(!Y.enabled)throw new N0(K0.InvalidParams,`Resource ${X} disabled`);return pQ(await Y.readCallback(X,Q),Y.cacheHint)}for(let G of Object.values(this._registeredResourceTemplates)){let B=G.resourceTemplate.uriTemplate.match(X.toString());if(B)return pQ(await G.readCallback(X,B,Q),G.cacheHint)}throw new dQ(W.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,W])=>W.enabled).map(([W,Q])=>{return{name:W,title:Q.title,description:Q.description,arguments:Q.argsSchema?QK(Q.argsSchema):void 0,icons:Q.icons,_meta:Q._meta}})})),this.server.setRequestHandler("prompts/get",async(W,Q)=>{let X=this._registeredPrompts[W.params.name];if(!X)throw new N0(K0.InvalidParams,`Prompt ${W.params.name} not found`);if(!X.enabled)throw new N0(K0.InvalidParams,`Prompt ${W.params.name} disabled`);return X.handler(W.params.arguments,Q)}),this._promptHandlersInitialized=!0}registerResource(W,Q,X,Y){let G=X.cacheHint,B=X;if(G!==void 0){vG(G,`resource ${W}`);let F={...X};delete F.cacheHint,B=F}if(typeof Q==="string"){if(this._registeredResources[Q])throw Error(`Resource ${Q} is already registered`);let F=this._createRegisteredResource(W,X.title,Q,B,Y);if(G!==void 0)F.cacheHint=G;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),F}else{if(this._registeredResourceTemplates[W])throw Error(`Resource template ${W} is already registered`);let F=this._createRegisteredResourceTemplate(W,X.title,Q,B,Y);if(G!==void 0)F.cacheHint=G;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),F}}_createRegisteredResource(W,Q,X,Y,G){let B={name:W,title:Q,metadata:Y,readCallback:G,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({uri:null}),update:(F)=>{if(F.uri!==void 0&&F.uri!==X){if(delete this._registeredResources[X],F.uri)this._registeredResources[F.uri]=B}if(F.name!==void 0)B.name=F.name;if(F.title!==void 0)B.title=F.title;if(F.metadata!==void 0)B.metadata=F.metadata;if(F.callback!==void 0)B.readCallback=F.callback;if(F.enabled!==void 0)B.enabled=F.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=B,B}_createRegisteredResourceTemplate(W,Q,X,Y,G){let B={resourceTemplate:X,title:Q,metadata:Y,readCallback:G,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(L)=>{if(L.name!==void 0&&L.name!==W){if(delete this._registeredResourceTemplates[W],L.name)this._registeredResourceTemplates[L.name]=B}if(L.title!==void 0)B.title=L.title;if(L.template!==void 0)B.resourceTemplate=L.template;if(L.metadata!==void 0)B.metadata=L.metadata;if(L.callback!==void 0)B.readCallback=L.callback;if(L.enabled!==void 0)B.enabled=L.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[W]=B;let F=X.uriTemplate.variableNames;if(Array.isArray(F)&&F.some((L)=>!!X.completeCallback(L)))this.setCompletionRequestHandler();return B}_createRegisteredPrompt(W,Q,X,Y,G,B,F){let L=Y,J=G,z={title:Q,description:X,argsSchema:Y,icons:B,_meta:F,handler:kK(W,Y,G),enabled:!0,disable:()=>z.update({enabled:!1}),enable:()=>z.update({enabled:!0}),remove:()=>z.update({name:null}),update:(K)=>{if(K.name!==void 0&&K.name!==W){if(delete this._registeredPrompts[W],K.name)this._registeredPrompts[K.name]=z}if(K.title!==void 0)z.title=K.title;if(K.description!==void 0)z.description=K.description;if(K.icons!==void 0)z.icons=K.icons;if(K._meta!==void 0)z._meta=K._meta;let H=!1;if(K.argsSchema!==void 0)z.argsSchema=K.argsSchema,L=K.argsSchema,H=!0;if(K.callback!==void 0)J=K.callback,H=!0;if(H)z.handler=kK(W,L,J);if(K.enabled!==void 0)z.enabled=K.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[W]=z,Y){let K=yK(Y);if(K){if(Object.values(K).some((H)=>{return eG(_K(H))}))this.setCompletionRequestHandler()}}return z}_createRegisteredTool(W,Q,X,Y,G,B,F,L,J,z){if(iG(W),Y!==void 0)try{let D=W4(Y,"input");this._toolInputSchemaJson[W]=D;let I=hG(D);if(!I.valid)console.warn(`[mcp-sdk] tool '${W}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${I.reason}`)}catch{}let K=z,H={title:Q,description:X,inputSchema:Y,outputSchema:G,outputSchemaJson:CK(G),annotations:B,icons:F,execution:L,_meta:J,handler:z,executor:SK(Y,z),enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(D)=>{if(D.name!==void 0&&D.name!==W){if(typeof D.name==="string")iG(D.name);if(delete this._registeredTools[W],delete this._toolInputSchemaJson[W],D.name)delete this._toolInputSchemaJson[D.name],this._registeredTools[D.name]=H,W=D.name}if(D.title!==void 0)H.title=D.title;if(D.description!==void 0)H.description=D.description;let I=!1;if(D.paramsSchema!==void 0)H.inputSchema=D.paramsSchema,delete this._toolInputSchemaJson[W],I=!0;if(D.callback!==void 0)H.handler=D.callback,K=D.callback,I=!0;if(I)H.executor=SK(H.inputSchema,K);if(D.outputSchema!==void 0)H.outputSchema=D.outputSchema,H.outputSchemaJson=CK(D.outputSchema);if(D.annotations!==void 0)H.annotations=D.annotations;if(D.icons!==void 0)H.icons=D.icons;if(D._meta!==void 0)H._meta=D._meta;if(D.enabled!==void 0)H.enabled=D.enabled;this.sendToolListChanged()}};return this._registeredTools[W]=H,this.setToolRequestHandlers(),this.sendToolListChanged(),H}registerTool(W,Q,X){if(this._registeredTools[W])throw Error(`Tool ${W} is already registered`);let{title:Y,description:G,inputSchema:B,outputSchema:F,annotations:L,icons:J,_meta:z}=Q;return this._createRegisteredTool(W,Y,G,rQ(B),rQ(F),L,J,void 0,z,X)}registerPrompt(W,Q,X){if(this._registeredPrompts[W])throw Error(`Prompt ${W} is already registered`);let{title:Y,description:G,argsSchema:B,icons:F,_meta:L}=Q,J=this._createRegisteredPrompt(W,Y,G,rQ(B),X,F,L);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),J}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(W,Q){return this.server.sendLoggingMessage(W,Q)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}},qK,cW;var hK=H0(()=>{nG();sG();gK=Symbol.for("mcp.completable");dw=new Set(["tools/call","prompts/get","resources/read"]),xK=class extends mG{_clientCapabilities;_clientVersion;static{iw=(W,Q)=>{if(Q.clientCapabilities!==void 0)W._clientCapabilities=Q.clientCapabilities;if(Q.clientInfo!==void 0)W._clientVersion=Q.clientInfo},nw=(W,Q)=>{let X=Q.filter((Y)=>!W._supportedProtocolVersions.includes(Y));if(X.length>0)W._supportedProtocolVersions=[...W._supportedProtocolVersions,...X];W.setRequestHandler("server/discover",()=>W._ondiscover())},rw=(W)=>W._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new pw({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(W)=>this._inputRequestCapabilityView(W),verifyRequestState:(W,Q,X)=>this._verifyRequestState(W,Q,X),sendElicitation:(W,Q)=>this._sendElicitationLeg(W,Q,{validateAcceptedContent:!1}),sendSampling:(W,Q)=>this.createMessage(W,Q),listRoots:(W,Q)=>this.listRoots(W,Q)})}oninitialized;constructor(W,Q){super(Q);if(this._serverInfo=W,this._capabilities=Q?.capabilities?{...Q.capabilities}:{},this._instructions=Q?.instructions,this._jsonSchemaValidator=Q?.jsonSchemaValidator??new QX,this._requestStateVerify=Q?.requestState?.verify,this._inputRequiredServing=mw(Q?.inputRequired),Q?.cacheHints!==void 0){for(let[X,Y]of Object.entries(Q.cacheHints))if(Y!==void 0)vG(Y,`cacheHints['${X}']`);this._cacheHints=Q.cacheHints}if(this.setRequestHandler("initialize",(X)=>this._oninitialize(X)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),PG(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(W,Q)=>{let X=Q.sessionId||Q.http?.req?.headers.get("mcp-session-id")||void 0,{level:Y}=W.params,G=nQ(n6,Y);if(G.success)this._loggingLevels.set(X,G.data);return{}})}buildContext(W,Q){let X=W.http||Q?.request||Q?.closeSSEStream||Q?.closeStandaloneSSEStream;return{...W,mcpReq:{...W.mcpReq,log:(Y,G,B)=>{if(!this._capabilities.logging)return Promise.resolve();let F;if(this._servedModernEra()){if(F=W.mcpReq.envelope?.[n1],F===void 0)return Promise.resolve()}else F=this._loggingLevels.get(W.sessionId)??this._loggingLevels.get(void 0);if(F!==void 0&&this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get(F))return Promise.resolve();return W.mcpReq.notify({method:"notifications/message",params:{level:Y,data:G,logger:B}})},elicitInput:(Y,G)=>this.elicitInput(Y,G),requestSampling:(Y,G)=>this.createMessage(Y,G)},http:X?{...W.http,req:Q?.request,closeSSE:Q?.closeSSEStream,closeStandaloneSSE:Q?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(n6.options.map((W,Q)=>[W,Q]));isMessageIgnored=(W,Q)=>{let X=this._loggingLevels.get(Q);return X?this.LOG_LEVEL_SEVERITY.get(W)<this.LOG_LEVEL_SEVERITY.get(X):!1};registerCapabilities(W){if(this.transport)throw new O0(S0.AlreadyConnected,"Cannot register capabilities after connecting to transport");let Q=!!this._capabilities.logging;if(this._capabilities=cG(this._capabilities,W),!Q&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(W,Q){if(W!=="tools/call"){let X=this._cacheHints?.[W],Y=dw.has(W);if(X===void 0&&!Y)return async(G,B)=>{let F=await Q(G,B);if(q5(F))throw new N0(K0.InternalError,`Handler for ${W} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return F};return async(G,B)=>{let F=Y?await this._invokeInputRequiredCapableHandler(W,Q,G,B):await Q(G,B);if(q5(F)){if(!Y)throw new N0(K0.InternalError,`Handler for ${W} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return F}return X===void 0?F:pQ(F,X)}}return async(X,Y)=>{let G=g9(this._negotiatedProtocolVersion),B=G.validateRequest("tools/call",X);if(!B.ok)throw new N0(B.reason==="not-in-era"?K0.InternalError:K0.InvalidParams,B.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${B.message}`);let F=await this._invokeInputRequiredCapableHandler("tools/call",Q,X,Y);if(q5(F))return F;let L=bG(F),J=G.validateResult("tools/call",L);if(!J.ok)throw new N0(J.reason==="not-in-era"?K0.InternalError:K0.InvalidParams,J.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${J.message}`);return J.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&hW(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(W,Q,X,Y){let G=this._servedModernEra(),B=Y.mcpReq.requestState();if(B!==void 0&&typeof B!=="string")throw new N0(K0.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let F=Y;if(typeof B==="string"){let H=await this._verifyRequestState(B,Y,W);if(H!==void 0)F=lG(Y,H)}let L;try{L=await Q(X,F)}catch(H){if(H instanceof N0&&H.code===K0.UrlElicitationRequired){if(!G)throw H;throw new N0(K0.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { \u2026: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw H}if(!q5(L))return L;if(!G){if(!this._inputRequiredServing.legacyShim)throw new N0(K0.InternalError,`Handler for ${W} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??E5}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(W,Q,X,F,L)}let J=L.inputRequests,z=J!=null&&Object.keys(J).length>0,K=typeof L.requestState==="string";if(!z&&!K)throw new N0(K0.InternalError,`Handler for ${W} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(z){let H=this._inputRequestCapabilityView(Y);for(let[D,I]of Object.entries(J)){let{embedded:A,required:M}=fK(W,D,I),N=cQ(M,H);if(N!==void 0)throw new iQ({requiredCapabilities:N},`Cannot request input '${D}' (${A.method}): the request's client capabilities do not declare the required capability`)}}return L}async _verifyRequestState(W,Q,X){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(W,Q)}catch(Y){throw this.onerror?.(Error(`requestState verification rejected ${X}: ${Y instanceof Error?Y.message:String(Y)}`)),new N0(K0.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(W){return this._servedModernEra()?W.mcpReq.envelope?.[S1]:this._clientCapabilities}_assertPushApiInServedEra(W){if(this._servedModernEra())throw new O0(S0.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${W}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead \u2014 the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:W,era:"2026-07-28"})}assertCapabilityForMethod(W){switch(W){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new O0(S0.CapabilityNotSupported,`Client does not support sampling (required for ${W})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new O0(S0.CapabilityNotSupported,`Client does not support elicitation (required for ${W})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new O0(S0.CapabilityNotSupported,`Client does not support listing roots (required for ${W})`);break;case"ping":break}}assertNotificationCapability(W){switch(W){case"notifications/message":if(!this._capabilities.logging)throw new O0(S0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new O0(S0.CapabilityNotSupported,`Server does not support notifying about resources (required for ${W})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new O0(S0.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${W})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new O0(S0.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${W})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new O0(S0.CapabilityNotSupported,`Client does not support URL elicitation (required for ${W})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(W){switch(W){case"completion/complete":if(!this._capabilities.completions)throw new O0(S0.CapabilityNotSupported,`Server does not support completions (required for ${W})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new O0(S0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new O0(S0.CapabilityNotSupported,`Server does not support prompts (required for ${W})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new O0(S0.CapabilityNotSupported,`Server does not support resources (required for ${W})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new O0(S0.CapabilityNotSupported,`Server does not support tools (required for ${W})`);break;case"ping":case"initialize":break}}async _oninitialize(W){let Q=W.params.protocolVersion;this._clientCapabilities=W.params.capabilities,this._clientVersion=W.params.clientInfo;let X=yz(this._supportedProtocolVersions),Y=X.includes(Q)?Q:X[0]??E5;return this._negotiatedProtocolVersion=Y,this.transport?.setProtocolVersion?.(Y),{protocolVersion:Y,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:PG(this._supportedProtocolVersions),capabilities:ow(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(W,Q){return this._wireCodec().projectCallToolResult(W,Q)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(W,Q){if(this._assertPushApiInServedEra("sampling/createMessage"),(W.tools||W.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new O0(S0.CapabilityNotSupported,"Client does not support sampling tools capability.");if(W.messages.length>0){let B=W.messages.at(-1),F=Array.isArray(B.content)?B.content:[B.content],L=F.some((H)=>H.type==="tool_result"),J=W.messages.length>1?W.messages.at(-2):void 0,z=J?Array.isArray(J.content)?J.content:[J.content]:[],K=z.some((H)=>H.type==="tool_use");if(L){if(F.some((H)=>H.type!=="tool_result"))throw new N0(K0.InvalidParams,"The last message must contain only tool_result content if any is present");if(!K)throw new N0(K0.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(K){let H=new Set(z.filter((I)=>I.type==="tool_use").map((I)=>I.id)),D=new Set(F.filter((I)=>I.type==="tool_result").map((I)=>I.toolUseId));if(H.size!==D.size||![...H].every((I)=>D.has(I)))throw new N0(K0.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let X=Boolean(W.tools||W.toolChoice),Y=await this.request({method:"sampling/createMessage",params:W},Q),G=this._wireCodec().samplingResultVariant(X,Y);if(!G.ok)throw new O0(S0.InvalidResult,`Invalid sampling/createMessage result: ${G.reason==="invalid"?G.message:G.reason}`);return G.value}async elicitInput(W,Q){switch(this._assertPushApiInServedEra("elicitation/create"),W.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new O0(S0.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new O0(S0.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(W,Q)}async _sendElicitationLeg(W,Q,X){let Y=W.mode??"form",G=X?.validateAcceptedContent??!0;switch(Y){case"url":{let B=W;return this.request({method:"elicitation/create",params:B},Q)}case"form":{let B=W.mode==="form"?W:{...W,mode:"form"},F=await this.request({method:"elicitation/create",params:B},Q);if(G&&F.action==="accept"&&F.content&&B.requestedSchema)try{let L=this._jsonSchemaValidator.getValidator(B.requestedSchema)(F.content);if(!L.valid)throw new N0(K0.InvalidParams,`Elicitation response content does not match requested schema: ${L.errorMessage}`)}catch(L){if(L instanceof N0)throw L;throw new N0(K0.InternalError,`Error validating elicitation response: ${L instanceof Error?L.message:String(L)}`)}return F}}}createElicitationCompletionNotifier(W,Q){if(!this._clientCapabilities?.elicitation?.url)throw new O0(S0.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:W}},Q)}async listRoots(W,Q){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:W},Q)}async sendLoggingMessage(W,Q){if(this._capabilities.logging&&!this.isMessageIgnored(W.level,Q))return this.notification({method:"notifications/message",params:W})}async sendResourceUpdated(W){return this.notification({method:"notifications/resources/updated",params:W})}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"})}};qK={type:"object",properties:{}};cW={completion:{values:[],hasMore:!1}}});var Q7=H0(()=>{hK();nG();sG()});var sw,XX,tw,ew,W3,Q3,Y0=(W,Q)=>()=>(Q||W((Q={exports:{}}).exports,Q),Q.exports),uK=(W,Q)=>{let X={};for(var Y in W)XX(X,Y,{get:W[Y],enumerable:!0});if(Q)XX(X,Symbol.toStringTag,{value:"Module"});return X},X3=(W,Q,X,Y)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(var G=ew(Q),B=0,F=G.length,L;B<F;B++)if(L=G[B],!Q3.call(W,L)&&L!==X)XX(W,L,{get:((J)=>Q[J]).bind(null,L),enumerable:!(Y=tw(Q,L))||Y.enumerable})}return W},YX=(W,Q,X)=>(X=W!=null?sw(W3(W)):{},X3(Q||!W||!W.__esModule?XX(X,"default",{value:W,enumerable:!0}):X,W));var X7=H0(()=>{sw=Object.create,XX=Object.defineProperty,tw=Object.getOwnPropertyDescriptor,ew=Object.getOwnPropertyNames,W3=Object.getPrototypeOf,Q3=Object.prototype.hasOwnProperty});function S4(W,Q){let X=new Set,Y=Q;while(typeof Y==="function"){let G=Y.mcpBrand;if(Object.prototype.hasOwnProperty.call(Y,"mcpBrand")&&typeof G==="string")X.add(G);Y=Object.getPrototypeOf(Y)}if(X.size===0)return;Object.defineProperty(W,L7,{value:X,enumerable:!1,configurable:!0})}function r1(W,Q){try{if(typeof Q==="object"&&Q!==null&&Object.prototype.hasOwnProperty.call(W,"mcpBrand")&&typeof W.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(Q,L7)){let X=Q[L7];if(X&&typeof X.has==="function"&&X.has(W.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(W,Q)}function Q4(W){return W>=tK}function $7(W){return W.filter((Q)=>!Q4(Q))}function aW(W){return W.filter((Q)=>Q4(Q))}function eK(W){let Q=W.structuredContent;if(Q===void 0)return W;if(!(typeof Q!=="object"||Q===null||Array.isArray(Q)))return W;if(W.content?.some((X)=>X.type==="text")??!1)return W;return{...W,content:[...W.content??[],{type:"text",text:JSON.stringify(Q)}]}}function G3(W){if(W===null||typeof W!=="object"||Array.isArray(W)||W.content!==void 0||WZ.some((Q)=>(Q in W)))return W;return{...W,content:[]}}function B3(){let W=f5(()=>a([$(),m(),o(),C6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=q({ttl:m().optional()}),B=q({taskId:$()}),F=B0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":B.optional()}),L=q({_meta:F.optional()}),J=L.extend({task:G.optional()}),z=q({method:$(),params:L.loose().optional()}),K=q({_meta:F.optional()}),H=q({method:$(),params:K.loose().optional()}),D=B0({_meta:F.optional()}),I=a([$(),m().int()]),A=D.strict(),M=K.extend({requestId:I.optional(),reason:$().optional()}),N=H.extend({method:g("notifications/cancelled"),params:M}),Z=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),V=q({icons:f(Z).optional()}),U=q({name:$(),title:$().optional()}),j=U.extend({...U.shape,...V.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),T=C1(q({applyDefaults:o().optional()}),Q),O=k6((x0)=>{if(x0&&typeof x0==="object"&&!Array.isArray(x0)&&Object.keys(x0).length===0)return{form:{}};return x0},C1(q({form:T.optional(),url:Q.optional()}),Q.optional())),w=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({sampling:B0({createMessage:Q.optional()}).optional(),elicitation:B0({create:Q.optional()}).optional()}).optional()}),R=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({tools:B0({call:Q.optional()}).optional()}).optional()}),k=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:O.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:w.optional(),extensions:n($(),Q).optional()}),l=L.extend({protocolVersion:$(),capabilities:k,clientInfo:j}),_=z.extend({method:g("initialize"),params:l}),h=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:R.optional(),extensions:n($(),Q).optional()}),d=D.extend({protocolVersion:$(),capabilities:h,serverInfo:j,instructions:$().optional()}),p=H.extend({method:g("notifications/initialized"),params:K.optional()}),z0=z.extend({method:g("ping"),params:L.optional()}),M0=q({progress:m(),total:W0(m()),message:W0($())}),V0=q({...K.shape,...M0.shape,progressToken:X}),P0=H.extend({method:g("notifications/progress"),params:V0}),Z0=L.extend({cursor:Y.optional()}),S=z.extend({params:Z0.optional()}),v=D.extend({nextCursor:Y.optional()}),u=q({uri:$(),mimeType:W0($()),_meta:n($(),X0()).optional()}),E=u.extend({text:$()}),b=$().refine((x0)=>{try{return atob(x0),!0}catch{return!1}},{message:"Invalid Base64 string"}),C=u.extend({blob:b}),c=J0(["user","assistant"]),r=q({audience:f(c).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),L0=q({...U.shape,...V.shape,uri:$(),description:W0($()),mimeType:W0($()),size:W0(m()),annotations:r.optional(),_meta:W0(B0({}))}),e=q({...U.shape,...V.shape,uriTemplate:$(),description:W0($()),mimeType:W0($()),annotations:r.optional(),_meta:W0(B0({}))}),w0=S.extend({method:g("resources/list")}),h0=v.extend({resources:f(L0)}),P=S.extend({method:g("resources/templates/list")}),y=v.extend({resourceTemplates:f(e)}),x=L.extend({uri:$()}),s=x,t=z.extend({method:g("resources/read"),params:s}),F0=D.extend({contents:f(a([E,C]))}),T0=H.extend({method:g("notifications/resources/list_changed"),params:K.optional()}),q0=x,g0=z.extend({method:g("resources/subscribe"),params:q0}),b0=x,j0=z.extend({method:g("resources/unsubscribe"),params:b0}),r0=K.extend({uri:$()}),C0=H.extend({method:g("notifications/resources/updated"),params:r0}),G1=q({name:$(),description:W0($()),required:W0(o())}),Q1=q({...U.shape,...V.shape,description:W0($()),arguments:W0(f(G1)),_meta:W0(B0({}))}),B1=S.extend({method:g("prompts/list")}),K1=v.extend({prompts:f(Q1)}),Z1=L.extend({name:$(),arguments:n($(),$()).optional()}),V1=z.extend({method:g("prompts/get"),params:Z1}),w1=q({type:g("text"),text:$(),annotations:r.optional(),_meta:n($(),X0()).optional()}),D1=q({type:g("image"),data:b,mimeType:$(),annotations:r.optional(),_meta:n($(),X0()).optional()}),M1=q({type:g("audio"),data:b,mimeType:$(),annotations:r.optional(),_meta:n($(),X0()).optional()}),Q6=q({type:g("tool_use"),name:$(),id:$(),input:n($(),X0()),_meta:n($(),X0()).optional()}),H1=q({type:g("resource"),resource:a([E,C]),annotations:r.optional(),_meta:n($(),X0()).optional()}),X6=L0.extend({type:g("resource_link")}),o0=a([w1,D1,M1,X6,H1]),v1=q({role:c,content:o0}),y1=D.extend({description:$().optional(),messages:f(v1)}),j1=H.extend({method:g("notifications/prompts/list_changed"),params:K.optional()}),Y6=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),_1=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),O1=q({...U.shape,...V.shape,description:$().optional(),inputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(X0()),outputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(X0()).optional(),annotations:Y6.optional(),execution:_1.optional(),_meta:n($(),X0()).optional()}),g1=S.extend({method:g("tools/list")}),f1=v.extend({tools:f(O1)}),x1=D.extend({content:f(o0),structuredContent:n($(),X0()).optional(),isError:o().optional()}),f0=J.extend({name:$(),arguments:n($(),X0()).optional()}),G6=z.extend({method:g("tools/call"),params:f0}),e6=H.extend({method:g("notifications/tools/list_changed"),params:K.optional()}),h1=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),B6=L.extend({level:h1}),F6=z.extend({method:g("logging/setLevel"),params:B6}),L6=K.extend({level:h1,logger:$().optional(),data:X0()}),J6=H.extend({method:g("notifications/message"),params:L6}),z6=q({name:$().optional()}),K6=q({hints:f(z6).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),Z6=q({mode:J0(["auto","required","none"]).optional()}),W5=q({type:g("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:f(o0),structuredContent:q({}).loose().optional(),isError:o().optional(),_meta:n($(),X0()).optional()}),H6=j5("type",[w1,D1,M1]),$1=j5("type",[w1,D1,M1,Q6,W5]),$6=q({role:c,content:a([$1,f($1)]),_meta:n($(),X0()).optional()}),U6=J.extend({messages:f($6),modelPreferences:K6.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(O1).optional(),toolChoice:Z6.optional()}),A6=z.extend({method:g("sampling/createMessage"),params:U6}),N6=D.extend({model:$(),stopReason:W0(J0(["endTurn","stopSequence","maxTokens"]).or($())),role:c,content:H6}),V6=D.extend({model:$(),stopReason:W0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:c,content:a([$1,f($1)])}),w6=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),D6=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),M6=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),j6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),O6=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),E6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),I6=a([j6,O6]),E1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),I1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),Q5=a([E1,I1]),X5=a([E6,I6,Q5]),d0=a([X5,w6,D6,M6]),i0=J.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),d0),required:f($()).optional()}).catchall(X0())}),T6=J.extend({mode:g("url"),message:$(),elicitationId:$(),url:$().url()}),X1=a([i0,T6]),Y5=z.extend({method:g("elicitation/create"),params:X1}),G5=K.extend({elicitationId:$()}),B5=H.extend({method:g("notifications/elicitation/complete"),params:G5}),F5=D.extend({action:J0(["accept","decline","cancel"]),content:k6((x0)=>x0===null?void 0:x0,n($(),a([$(),m(),o(),f($())])).optional())}),L5=q({type:g("ref/resource"),uri:$()}),J5=q({type:g("ref/prompt"),name:$()}),z5=L.extend({ref:a([J5,L5]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()}),R6=z.extend({method:g("completion/complete"),params:z5}),K5=D.extend({completion:B0({values:f($()).max(100),total:W0(m().int()),hasMore:W0(o())})}),Z5=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),X0()).optional()}),u1=z.extend({method:g("roots/list"),params:L.optional()}),P6=D.extend({roots:f(Z5)}),H5=H.extend({method:g("notifications/roots/list_changed"),params:K.optional()}),$5=B0({ttl:m().optional(),pollInterval:m().optional()}),U5=J0(["working","input_required","completed","failed","cancelled"]),U1=q({taskId:$(),status:U5,ttl:a([m(),C6()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:W0(m()),statusMessage:W0($())}),m0=D.extend({task:U1}),A5=K.merge(U1),T1=H.extend({method:g("notifications/tasks/status"),params:A5}),l1=z.extend({method:g("tasks/get"),params:L.extend({taskId:$()})}),m1=D.merge(U1),c1=z.extend({method:g("tasks/result"),params:L.extend({taskId:$()})}),Y4=D.loose(),c0=S.extend({method:g("tasks/list")}),R0=v.extend({tasks:f(U1)}),R1=z.extend({method:g("tasks/cancel"),params:L.extend({taskId:$()})});return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,TaskMetadataSchema:G,RelatedTaskMetadataSchema:B,RequestMetaSchema:F,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:J,RequestSchema:z,NotificationsParamsSchema:K,NotificationSchema:H,ResultSchema:D,RequestIdSchema:I,EmptyResultSchema:A,CancelledNotificationParamsSchema:M,CancelledNotificationSchema:N,IconSchema:Z,IconsSchema:V,BaseMetadataSchema:U,ImplementationSchema:j,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:l,InitializeRequestSchema:_,ServerCapabilitiesSchema:h,InitializeResultSchema:d,InitializedNotificationSchema:p,PingRequestSchema:z0,ProgressSchema:M0,ProgressNotificationParamsSchema:V0,ProgressNotificationSchema:P0,PaginatedRequestParamsSchema:Z0,PaginatedRequestSchema:S,PaginatedResultSchema:v,ResourceContentsSchema:u,TextResourceContentsSchema:E,BlobResourceContentsSchema:C,RoleSchema:c,AnnotationsSchema:r,ResourceSchema:L0,ResourceTemplateSchema:e,ListResourcesRequestSchema:w0,ListResourcesResultSchema:h0,ListResourceTemplatesRequestSchema:P,ListResourceTemplatesResultSchema:y,ResourceRequestParamsSchema:x,ReadResourceRequestParamsSchema:s,ReadResourceRequestSchema:t,ReadResourceResultSchema:F0,ResourceListChangedNotificationSchema:T0,SubscribeRequestParamsSchema:q0,SubscribeRequestSchema:g0,UnsubscribeRequestParamsSchema:b0,UnsubscribeRequestSchema:j0,ResourceUpdatedNotificationParamsSchema:r0,ResourceUpdatedNotificationSchema:C0,PromptArgumentSchema:G1,PromptSchema:Q1,ListPromptsRequestSchema:B1,ListPromptsResultSchema:K1,GetPromptRequestParamsSchema:Z1,GetPromptRequestSchema:V1,TextContentSchema:w1,ImageContentSchema:D1,AudioContentSchema:M1,ToolUseContentSchema:Q6,EmbeddedResourceSchema:H1,ResourceLinkSchema:X6,ContentBlockSchema:o0,PromptMessageSchema:v1,GetPromptResultSchema:y1,PromptListChangedNotificationSchema:j1,ToolAnnotationsSchema:Y6,ToolExecutionSchema:_1,ToolSchema:O1,ListToolsRequestSchema:g1,ListToolsResultSchema:f1,CallToolResultSchema:x1,CallToolRequestParamsSchema:f0,CallToolRequestSchema:G6,ToolListChangedNotificationSchema:e6,LoggingLevelSchema:h1,SetLevelRequestParamsSchema:B6,SetLevelRequestSchema:F6,LoggingMessageNotificationParamsSchema:L6,LoggingMessageNotificationSchema:J6,ModelHintSchema:z6,ModelPreferencesSchema:K6,ToolChoiceSchema:Z6,ToolResultContentSchema:W5,SamplingContentSchema:H6,SamplingMessageContentBlockSchema:$1,SamplingMessageSchema:$6,CreateMessageRequestParamsSchema:U6,CreateMessageRequestSchema:A6,CreateMessageResultSchema:N6,CreateMessageResultWithToolsSchema:V6,BooleanSchemaSchema:w6,StringSchemaSchema:D6,NumberSchemaSchema:M6,UntitledSingleSelectEnumSchemaSchema:j6,TitledSingleSelectEnumSchemaSchema:O6,LegacyTitledEnumSchemaSchema:E6,SingleSelectEnumSchemaSchema:I6,UntitledMultiSelectEnumSchemaSchema:E1,TitledMultiSelectEnumSchemaSchema:I1,MultiSelectEnumSchemaSchema:Q5,EnumSchemaSchema:X5,PrimitiveSchemaDefinitionSchema:d0,ElicitRequestFormParamsSchema:i0,ElicitRequestURLParamsSchema:T6,ElicitRequestParamsSchema:X1,ElicitRequestSchema:Y5,ElicitationCompleteNotificationParamsSchema:G5,ElicitationCompleteNotificationSchema:B5,ElicitResultSchema:F5,ResourceTemplateReferenceSchema:L5,PromptReferenceSchema:J5,CompleteRequestParamsSchema:z5,CompleteRequestSchema:R6,CompleteResultSchema:K5,RootSchema:Z5,ListRootsRequestSchema:u1,ListRootsResultSchema:P6,RootsListChangedNotificationSchema:H5,TaskCreationParamsSchema:$5,TaskStatusSchema:U5,TaskSchema:U1,CreateTaskResultSchema:m0,TaskStatusNotificationParamsSchema:A5,TaskStatusNotificationSchema:T1,GetTaskRequestSchema:l1,GetTaskResultSchema:m1,GetTaskPayloadRequestSchema:c1,GetTaskPayloadResultSchema:Y4,ListTasksRequestSchema:c0,ListTasksResultSchema:R0,CancelTaskRequestSchema:R1,CancelTaskResultSchema:D.merge(U1),ClientRequestSchema:a([z0,_,R6,F6,V1,B1,w0,P,t,g0,j0,G6,g1,l1,c1,c0,R1]),ClientNotificationSchema:a([N,P0,p,H5,T1]),ClientResultSchema:a([A,N6,V6,F5,P6,m1,R0,m0]),ServerRequestSchema:a([z0,A6,Y5,u1,l1,c1,c0,R1]),ServerNotificationSchema:a([N,P0,J6,C0,T0,e6,j1,T1,B5]),ServerResultSchema:a([A,d,K5,y1,K1,h0,y,F0,x1,f1,m1,R0,m0]),CallToolResultWireSchema:X0().superRefine((x0,gX)=>{if(typeof x0!=="object"||x0===null||Array.isArray(x0)||x0.content!==void 0)return;for(let r9 of WZ)if(r9 in x0){gX.addIssue({code:"custom",message:`content is required when the body carries '${r9}' \u2014 another result family cannot default into an empty tools/call success`});return}}).transform(G3).pipe(x1)}}function QZ(){return F3??=B3()}function XZ(W){return W.type!=="object"}function z3(W){let Q=typeof W.$schema==="string"?W.$schema:void 0;if(W.$id!==void 0)return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:W},required:["result"]};let X=(Y,G)=>{if(Array.isArray(Y))return Y.map((F)=>X(F,!1));if(Y===null||typeof Y!=="object")return Y;if(!G&&Y.$id!==void 0)return Y;let B={};for(let[F,L]of Object.entries(Y))if(G)B[F]=X(L,!1);else if((F==="$ref"||F==="$dynamicRef")&&typeof L==="string")B[F]=L==="#"?"#/properties/result":L.startsWith("#/")?`#/properties/result${L.slice(1)}`:L;else if(L3.has(F))B[F]=L;else if(J3.has(F))B[F]=X(L,!0);else B[F]=X(L,!1);return B};return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:X(W,!1)},required:["result"]}}function U7(){if(GX)return GX;let W=QZ();return GX={requestSchemas:{ping:W.PingRequestSchema,initialize:W.InitializeRequestSchema,"completion/complete":W.CompleteRequestSchema,"logging/setLevel":W.SetLevelRequestSchema,"prompts/get":W.GetPromptRequestSchema,"prompts/list":W.ListPromptsRequestSchema,"resources/list":W.ListResourcesRequestSchema,"resources/templates/list":W.ListResourceTemplatesRequestSchema,"resources/read":W.ReadResourceRequestSchema,"resources/subscribe":W.SubscribeRequestSchema,"resources/unsubscribe":W.UnsubscribeRequestSchema,"tools/call":W.CallToolRequestSchema,"tools/list":W.ListToolsRequestSchema,"tasks/get":W.GetTaskRequestSchema,"tasks/result":W.GetTaskPayloadRequestSchema,"tasks/list":W.ListTasksRequestSchema,"tasks/cancel":W.CancelTaskRequestSchema,"sampling/createMessage":W.CreateMessageRequestSchema,"elicitation/create":W.ElicitRequestSchema,"roots/list":W.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":W.CancelledNotificationSchema,"notifications/progress":W.ProgressNotificationSchema,"notifications/initialized":W.InitializedNotificationSchema,"notifications/roots/list_changed":W.RootsListChangedNotificationSchema,"notifications/tasks/status":W.TaskStatusNotificationSchema,"notifications/message":W.LoggingMessageNotificationSchema,"notifications/resources/updated":W.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":W.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":W.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":W.PromptListChangedNotificationSchema,"notifications/elicitation/complete":W.ElicitationCompleteNotificationSchema},resultSchemas:{ping:W.EmptyResultSchema,initialize:W.InitializeResultSchema,"completion/complete":W.CompleteResultSchema,"logging/setLevel":W.EmptyResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"resources/subscribe":W.EmptyResultSchema,"resources/unsubscribe":W.EmptyResultSchema,"tools/call":W.CallToolResultWireSchema,"tools/list":W.ListToolsResultSchema,"sampling/createMessage":W.CreateMessageResultWithToolsSchema,"elicitation/create":W.ElicitResultSchema,"roots/list":W.ListRootsResultSchema}},GX}function BZ(W){return Object.prototype.hasOwnProperty.call(YZ,W)}function FZ(W){return Object.prototype.hasOwnProperty.call(GZ,W)}function Z3(W){return Object.prototype.hasOwnProperty.call(K3,W)}function H3(W){return Z3(W)?U7().resultSchemas[W]:void 0}function $3(W){return BZ(W)?U7().requestSchemas[W]:void 0}function U3(W){return FZ(W)?U7().notificationSchemas[W]:void 0}function J7(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function BX(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function mK(W){return J7(W)&&J7(W.outputSchema)&&XZ(W.outputSchema)}function cK(W){return W}function A3(){let W=f5(()=>a([$(),m(),o(),C6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=a([$(),m().int()]),B=J0(["user","assistant"]),F=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),L=$().refine((R0)=>{try{return atob(R0),!0}catch{return!1}},{message:"Invalid Base64 string"}),J=q({ttl:m().optional()}),z=q({taskId:$()}),K=B0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":z.optional()}),H=q({_meta:K.optional()}),D=H.extend({task:J.optional()}),I=q({_meta:K.optional()}),A=q({method:$(),params:I.loose().optional()}),M=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),N=q({icons:f(M).optional()}),Z=q({name:$(),title:$().optional()}),V=Z.extend({...Z.shape,...N.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),U=C1(q({applyDefaults:o().optional()}),Q),j=k6((R0)=>{if(R0&&typeof R0==="object"&&!Array.isArray(R0)&&Object.keys(R0).length===0)return{form:{}};return R0},C1(q({form:U.optional(),url:Q.optional()}),Q.optional())),T=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({sampling:B0({createMessage:Q.optional()}).optional(),elicitation:B0({create:Q.optional()}).optional()}).optional()}),O=B0({list:Q.optional(),cancel:Q.optional(),requests:B0({tools:B0({call:Q.optional()}).optional()}).optional()}),w=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:j.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:T.optional(),extensions:n($(),Q).optional()}),R=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:O.optional(),extensions:n($(),Q).optional()}),k=q({progress:m(),total:W0(m()),message:W0($())}),l=q({...I.shape,...k.shape,progressToken:X}),_=A.extend({method:g("notifications/progress"),params:l}),h=I.extend({level:F,logger:$().optional(),data:X0()}),d=A.extend({method:g("notifications/message"),params:h}),p=q({uri:$(),mimeType:W0($()),_meta:n($(),X0()).optional()}),z0=p.extend({text:$()}),M0=p.extend({blob:L}),V0=q({audience:f(B).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),P0=q({...Z.shape,...N.shape,uri:$(),description:W0($()),mimeType:W0($()),size:W0(m()),annotations:V0.optional(),_meta:W0(B0({}))}),Z0=q({...Z.shape,...N.shape,uriTemplate:$(),description:W0($()),mimeType:W0($()),annotations:V0.optional(),_meta:W0(B0({}))}),S=A.extend({method:g("notifications/resources/list_changed"),params:I.optional()}),v=I.extend({uri:$()}),u=A.extend({method:g("notifications/resources/updated"),params:v}),E=q({name:$(),description:W0($()),required:W0(o())}),b=q({...Z.shape,...N.shape,description:W0($()),arguments:W0(f(E)),_meta:W0(B0({}))}),C=A.extend({method:g("notifications/prompts/list_changed"),params:I.optional()}),c=q({type:g("text"),text:$(),annotations:V0.optional(),_meta:n($(),X0()).optional()}),r=q({type:g("image"),data:L,mimeType:$(),annotations:V0.optional(),_meta:n($(),X0()).optional()}),L0=q({type:g("audio"),data:L,mimeType:$(),annotations:V0.optional(),_meta:n($(),X0()).optional()}),e=q({type:g("tool_use"),name:$(),id:$(),input:n($(),X0()),_meta:n($(),X0()).optional()}),w0=q({type:g("resource"),resource:a([z0,M0]),annotations:V0.optional(),_meta:n($(),X0()).optional()}),h0=P0.extend({type:g("resource_link")}),P=a([c,r,L0,h0,w0]),y=q({role:B,content:P}),x=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),s=A.extend({method:g("notifications/tools/list_changed"),params:I.optional()}),t=q({name:$().optional()}),F0=q({hints:f(t).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),T0=q({mode:J0(["auto","required","none"]).optional()}),q0=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),g0=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),b0=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),j0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),r0=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),C0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),G1=a([j0,r0]),Q1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),B1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),K1=a([Q1,B1]),Z1=a([C0,G1,K1]),V1=a([Z1,q0,g0,b0]),w1=D.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),V1),required:f($()).optional()}).catchall(X0())}),D1=q({type:g("ref/resource"),uri:$()}),M1=q({type:g("ref/prompt"),name:$()}),Q6=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),X0()).optional()}),H1=w.shape,X6=q({experimental:H1.experimental,sampling:H1.sampling,elicitation:H1.elicitation,roots:H1.roots,extensions:H1.extensions}),o0=R.shape,v1=q({experimental:o0.experimental,logging:o0.logging,completions:o0.completions,prompts:o0.prompts,resources:o0.resources,tools:o0.tools,extensions:o0.extensions}),y1=B0({progressToken:X.optional(),[i1]:$(),[y6]:V.optional(),[S1]:X6,[n1]:F.optional()}),j1=q({...Z.shape,...N.shape,description:$().optional(),inputSchema:B0({$schema:$().optional(),type:g("object")}),outputSchema:B0({$schema:$().optional()}).optional(),annotations:x.optional(),_meta:n($(),X0()).optional()}),Y6=q({type:g("tool_result"),toolUseId:$(),content:f(P),structuredContent:X0().optional(),isError:o().optional(),_meta:n($(),X0()).optional()}),_1=a([c,r,L0,e,Y6]),O1=q({role:B,content:a([_1,f(_1)]),_meta:n($(),X0()).optional()}),g1=$(),f1=B0({[N1]:V.optional().catch(void 0)}),x1=f1.optional();function f0(R0){return B0({_meta:x1,resultType:g1.default("complete"),...R0})}let G6=f0({}),e6=f0({nextCursor:Y.optional()}),h1=f0({content:f(P),structuredContent:X0().optional(),isError:o().optional()}),B6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(j1),nextCursor:Y.optional()}),F6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(b),nextCursor:Y.optional()}),L6=f0({description:$().optional(),messages:f(y)}),J6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(P0),nextCursor:Y.optional()}),z6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(Z0),nextCursor:Y.optional()}),K6=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([z0,M0]))}),Z6=f0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),W5=f0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"])}),H6=f0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:v1,instructions:$().optional()}),$1=q({messages:f(O1),modelPreferences:F0.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(j1).optional(),toolChoice:T0.optional()}),$6=q({method:g("sampling/createMessage"),params:$1}),U6=q({method:g("roots/list"),params:q({_meta:n($(),X0()).optional()}).optional()}),A6=q({...O1.shape,model:$(),stopReason:$().optional()}),N6=q({roots:f(Q6)}),V6=q({action:J0(["accept","decline","cancel"]),content:n($(),a([$(),m(),o(),f($())])).optional()}),w6=q({mode:g("url"),message:$(),url:$().url()}),D6=a([w1,w6]),M6=q({method:g("elicitation/create"),params:D6}),j6=a([$6,U6,M6]),O6=a([A6,N6,V6]),E6=n($(),j6),I6=n($(),O6),E1=f0({inputRequests:E6.optional(),requestState:$().optional()}),I1={inputResponses:I6.optional(),requestState:$().optional()},Q5=q({_meta:y1,...I1}),X5=B0({progressToken:X.optional()});function d0(R0,R1){return q({method:g(R0),params:q({_meta:y1,...R1})})}function i0(R0,R1){return q({method:g(R0),params:q({_meta:X5.optional(),...R1}).optional()})}let T6={name:$(),arguments:n($(),X0()).optional(),...I1},X1={cursor:Y.optional()},Y5=d0("tools/call",T6),G5=d0("tools/list",X1),B5=d0("prompts/list",X1),F5=d0("prompts/get",{name:$(),arguments:n($(),$()).optional(),...I1}),L5=d0("resources/list",X1),J5=d0("resources/templates/list",X1),z5=d0("resources/read",{uri:$(),...I1}),R6={ref:a([M1,D1]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()},K5=d0("completion/complete",R6),Z5=d0("server/discover",{}),u1=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f($()).optional()}),P6={notifications:u1},H5=d0("subscriptions/listen",P6),$5=f1.extend({"io.modelcontextprotocol/subscriptionId":G}),U5=B0({_meta:$5,resultType:g1.default("complete")}),U1={"tools/call":i0("tools/call",T6),"tools/list":i0("tools/list",X1),"prompts/get":i0("prompts/get",{name:$(),arguments:n($(),$()).optional()}),"prompts/list":i0("prompts/list",X1),"resources/list":i0("resources/list",X1),"resources/templates/list":i0("resources/templates/list",X1),"resources/read":i0("resources/read",{uri:$()}),"completion/complete":i0("completion/complete",R6),"server/discover":i0("server/discover",{}),"subscriptions/listen":i0("subscriptions/listen",P6)};function m0(R0){return B0({_meta:x1,...R0})}let A5={"tools/call":m0({content:f(P),structuredContent:X0().optional(),isError:o().optional()}),"tools/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(j1),nextCursor:Y.optional()}),"prompts/get":m0({description:$().optional(),messages:f(y)}),"prompts/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(b),nextCursor:Y.optional()}),"resources/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(P0),nextCursor:Y.optional()}),"resources/templates/list":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(Z0),nextCursor:Y.optional()}),"resources/read":m0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([z0,M0]))}),"completion/complete":m0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),"server/discover":m0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:v1,instructions:$().optional()}),"subscriptions/listen":m0({})},T1=B0({"io.modelcontextprotocol/subscriptionId":G.optional()}),l1=q({method:g("notifications/subscriptions/acknowledged"),params:q({_meta:T1.optional(),notifications:u1})}),m1=q({_meta:T1.optional(),requestId:G,reason:$().optional()}),c1=q({method:g("notifications/cancelled"),params:m1}),Y4={"notifications/cancelled":c1,"notifications/progress":_,"notifications/message":d,"notifications/resources/updated":u,"notifications/resources/list_changed":S,"notifications/tools/list_changed":s,"notifications/prompts/list_changed":C,"notifications/subscriptions/acknowledged":l1},c0=(R0)=>q({jsonrpc:g("2.0"),id:a([$(),m().int()]),result:R0}).strict();return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,RequestIdSchema:G,RoleSchema:B,LoggingLevelSchema:F,TaskMetadataSchema:J,RelatedTaskMetadataSchema:z,RequestMetaSchema:K,BaseRequestParamsSchema:H,TaskAugmentedRequestParamsSchema:D,NotificationsParamsSchema:I,NotificationSchema:A,IconSchema:M,IconsSchema:N,BaseMetadataSchema:Z,ImplementationSchema:V,ClientTasksCapabilitySchema:T,ServerTasksCapabilitySchema:O,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:R,ProgressSchema:k,ProgressNotificationParamsSchema:l,ProgressNotificationSchema:_,LoggingMessageNotificationParamsSchema:h,LoggingMessageNotificationSchema:d,ResourceContentsSchema:p,TextResourceContentsSchema:z0,BlobResourceContentsSchema:M0,AnnotationsSchema:V0,ResourceSchema:P0,ResourceTemplateSchema:Z0,ResourceListChangedNotificationSchema:S,ResourceUpdatedNotificationParamsSchema:v,ResourceUpdatedNotificationSchema:u,PromptArgumentSchema:E,PromptSchema:b,PromptListChangedNotificationSchema:C,TextContentSchema:c,ImageContentSchema:r,AudioContentSchema:L0,ToolUseContentSchema:e,EmbeddedResourceSchema:w0,ResourceLinkSchema:h0,ContentBlockSchema:P,PromptMessageSchema:y,ToolAnnotationsSchema:x,ToolListChangedNotificationSchema:s,ModelHintSchema:t,ModelPreferencesSchema:F0,ToolChoiceSchema:T0,BooleanSchemaSchema:q0,StringSchemaSchema:g0,NumberSchemaSchema:b0,UntitledSingleSelectEnumSchemaSchema:j0,TitledSingleSelectEnumSchemaSchema:r0,LegacyTitledEnumSchemaSchema:C0,SingleSelectEnumSchemaSchema:G1,UntitledMultiSelectEnumSchemaSchema:Q1,TitledMultiSelectEnumSchemaSchema:B1,MultiSelectEnumSchemaSchema:K1,EnumSchemaSchema:Z1,PrimitiveSchemaDefinitionSchema:V1,ElicitRequestFormParamsSchema:w1,ResourceTemplateReferenceSchema:D1,PromptReferenceSchema:M1,RootSchema:Q6,ClientCapabilities2026Schema:X6,ServerCapabilities2026Schema:v1,RequestMetaEnvelopeSchema:y1,ToolSchema:j1,ToolResultContentSchema:Y6,SamplingMessageContentBlockSchema:_1,SamplingMessageSchema:O1,ResultTypeSchema:g1,ResultMetaSchema:f1,ResultSchema:G6,PaginatedResultSchema:e6,CallToolResultSchema:h1,ListToolsResultSchema:B6,ListPromptsResultSchema:F6,GetPromptResultSchema:L6,ListResourcesResultSchema:J6,ListResourceTemplatesResultSchema:z6,ReadResourceResultSchema:K6,CompleteResultSchema:Z6,CacheableResultSchema:W5,DiscoverResultSchema:H6,CreateMessageRequestParamsSchema:$1,CreateMessageRequestSchema:$6,ListRootsRequestSchema:U6,CreateMessageResultSchema:A6,ListRootsResultSchema:N6,ElicitResultSchema:V6,ElicitRequestURLParamsSchema:w6,ElicitRequestParamsSchema:D6,ElicitRequestSchema:M6,InputRequestSchema:j6,InputResponseSchema:O6,InputRequestsSchema:E6,InputResponsesSchema:I6,InputRequiredResultSchema:E1,InputResponseRequestParamsSchema:Q5,CallToolRequestSchema:Y5,ListToolsRequestSchema:G5,ListPromptsRequestSchema:B5,GetPromptRequestSchema:F5,ListResourcesRequestSchema:L5,ListResourceTemplatesRequestSchema:J5,ReadResourceRequestSchema:z5,CompleteRequestSchema:K5,DiscoverRequestSchema:Z5,SubscriptionFilterSchema:u1,SubscriptionsListenRequestSchema:H5,SubscriptionsListenResultMetaSchema:$5,SubscriptionsListenResultSchema:U5,dispatchRequestSchemas:U1,dispatchResultSchemas:A5,NotificationMetaSchema:T1,SubscriptionsAcknowledgedNotificationSchema:l1,CancelledNotificationParamsSchema:m1,CancelledNotificationSchema:c1,notificationSchemas2026:Y4,JSONRPCResultResponseSchema:c0(G6),CallToolResultResponseSchema:c0(a([h1,E1])),ListToolsResultResponseSchema:c0(B6),ListPromptsResultResponseSchema:c0(F6),GetPromptResultResponseSchema:c0(a([L6,E1])),ListResourcesResultResponseSchema:c0(J6),ListResourceTemplatesResultResponseSchema:c0(z6),ReadResourceResultResponseSchema:c0(a([K6,E1])),CompleteResultResponseSchema:c0(Z6),DiscoverResultResponseSchema:c0(H6)}}function b4(){return N3??=A3()}function w3(W){return V3.includes(W)}function D3(W){return W[N7]}function LZ(W){return typeof W==="number"&&Number.isSafeInteger(W)&&W>=0}function JZ(W){return W==="public"||W==="private"}function E3(W,Q){let X=Q.resultType;if(X===void 0)return{...Q,resultType:"complete"};if(X==="complete")return Q;if(O3.includes(W))return Q;throw new l0(D0.InternalError,`Handler for ${W} returned resultType '${String(X)}', but results of ${W} only support 'complete' on protocol revision 2026-07-28`)}function I3(W,Q){let X=D3(Q);if(Q.resultType!=="complete"||!w3(W))return X===void 0?Q:S3(Q);let Y=Q,G=LZ(Y.ttlMs)?Y.ttlMs:P3(X),B=JZ(Y.cacheScope)?Y.cacheScope:b3(X),F={...Y,ttlMs:G,cacheScope:B};return delete F[N7],F}function T3(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function R3(W,Q){if(Q===void 0)return W;let X=W._meta;if(X===void 0)return{...W,_meta:{[N1]:Q}};if(!T3(X))return W;if(X[N1]!==void 0)return W;return{...W,_meta:{...X,[N1]:Q}}}function P3(W){return W!==void 0&&LZ(W.ttlMs)?W.ttlMs:M3}function b3(W){return W!==void 0&&JZ(W.cacheScope)?W.cacheScope:j3}function S3(W){let Q={...W};return delete Q[N7],Q}function HZ(){if(FX)return FX;let W=b4();return FX={request:{"elicitation/create":q({method:g("elicitation/create"),params:W.ElicitRequestParamsSchema}),"sampling/createMessage":q({method:g("sampling/createMessage"),params:W.CreateMessageRequestParamsSchema}),"roots/list":q({method:g("roots/list"),params:B0({}).optional()})},response:{"elicitation/create":W.ElicitResultSchema,"sampling/createMessage":W.CreateMessageResultSchema,"roots/list":W.ListRootsResultSchema}},FX}function $Z(W){return q3.includes(W)}function Y7(W){return $Z(W)?HZ().request[W]:void 0}function C3(W){return $Z(W)?HZ().response[W]:void 0}function AZ(W){return Object.prototype.hasOwnProperty.call(V7,W)}function NZ(W){return Object.prototype.hasOwnProperty.call(UZ,W)}function k3(W){return Object.prototype.hasOwnProperty.call(V7,W)}function v3(W){return AZ(W)?b4().dispatchRequestSchemas[W]:void 0}function y3(W){return k3(W)?b4().dispatchResultSchemas[W]:void 0}function _3(W){return NZ(W)?b4().notificationSchemas2026[W]:void 0}function iW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function pW(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function x3(W,Q){let X=Q,Y=!1,G=()=>{if(!Y)X={...X},Y=!0;return X},B=Q.tools;if(W==="tools/list"&&Array.isArray(B)&&B.some((L)=>iW(L)&&("execution"in L)))G().tools=B.map((L)=>{if(!iW(L)||!("execution"in L))return L;let J={...L};return delete J.execution,J});let F=Q.capabilities;if(iW(F)&&"tasks"in F){let L={...F};delete L.tasks,G().capabilities=L}return X}function h3(){if(LX)return LX;let W=b4();return LX={"tools/call":W.CallToolResultSchema,"tools/list":W.ListToolsResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"completion/complete":W.CompleteResultSchema,"server/discover":W.DiscoverResultSchema},LX}function C5(W){return W!==void 0&&Q4(W)?w7:A7}function pK(W){if(W.revision!==void 0)return C5(W.revision).era;return W.era==="modern"?w7.era:A7.era}function G7(W){return VZ.some((Q)=>Q.hasRequestMethod(W))}function B7(W){return VZ.some((Q)=>Q.hasNotificationMethod(W))}function M7(W){let Q=[],X=new Map,Y=(B,F,L)=>{if(B===null||typeof B!=="object")return;let J=B;if(dK in J){if(!L||F.length===0)return`${JX(F)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let K=J[dK];if(typeof K!=="string"||K.length===0)return`${JX(F)}: x-mcp-header MUST be a non-empty string`;if(!m3.test(K))return`${JX(F)}: x-mcp-header '${K}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let H=typeof J.type==="string"?J.type:void 0;if(H===void 0||!c3.has(H))return`${JX(F)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${H??"<none>"}`;let D=K.toLowerCase(),I=X.get(D);if(I!==void 0)return`x-mcp-header '${K}' is not case-insensitively unique (also declared as '${I}')`;X.set(D,K),Q.push({path:F,headerName:K,type:H})}let z=J.properties;if(z!==null&&typeof z==="object")for(let[K,H]of Object.entries(z)){let D=Y(H,[...F,K],L);if(D!==void 0)return D}for(let K of p3){let H=J[K];if(H===void 0)continue;let D=Array.isArray(H)?H:H!==null&&typeof H==="object"&&d3.has(K)?Object.values(H):[H];for(let I of D){let A=Y(I,[...F,`<${K}>`],!1);if(A!==void 0)return A}}},G=Y(W,[],!0);return G===void 0?{valid:!0,declarations:Q}:{valid:!1,reason:G}}function JX(W){return W.length===0?"<root>":W.join(".")}function i3(W){if(typeof W==="string")return W;if(typeof W==="boolean")return W?"true":"false";if(typeof W==="number"){if(!Number.isFinite(W))return;if(Number.isInteger(W)&&!Number.isSafeInteger(W))return;return String(W)}}function n3(W){if(W.length===0)return!0;if(W.startsWith(MZ)&&W.endsWith(jZ))return!0;if(W!==W.trim())return!0;for(let Q=0;Q<W.length;Q++){let X=W.codePointAt(Q);if(X===9||X>=32&&X<=126)continue;return!0}return!1}function r3(W){let Q=new TextEncoder().encode(W),X="";for(let Y of Q)X+=String.fromCodePoint(Y);return btoa(X)}function OZ(W){return n3(W)?`${MZ}${r3(W)}${jZ}`:W}function o3(W,Q){let X=W;for(let Y of Q){if(X===null||typeof X!=="object")return;X=X[Y]}return X}function EZ(W,Q){let X={};for(let Y of W){let G=o3(Q,Y.path);if(G===void 0||G===null)continue;let B=i3(G);if(B===void 0)continue;X[`${l3}${Y.headerName}`]=OZ(B)}return X}function $X(W,Q){return u4(W,Q)}function dW(W){return new Set(W.flatMap((Q)=>Object.keys(Q.shape)))}function z7(W){if(W==null)return!1;let Q=typeof W;if(Q!=="object"&&Q!=="function")return!1;if(!("~standard"in W))return!1;return typeof W["~standard"]?.validate==="function"}function a3(W,Q="input"){let X=W["~standard"],Y;if(X.jsonSchema)Y=X.jsonSchema[Q]({target:K7});else if(X.vendor==="zod"){if(!("_zod"in W))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!iK)iK=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");Y=F4(W,{target:K7,io:Q})}else throw Error(`Schema library "${X.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(Q==="output"){if(Y.type!==void 0)return Y;return IZ(Y)?{type:"object",...Y}:Y}if(Y.type!==void 0&&Y.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(Y.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...Y}}function IZ(W){if("properties"in W||"patternProperties"in W||"additionalProperties"in W||"required"in W)return!0;for(let Q of["oneOf","anyOf","allOf"]){let X=W[Q];if(Array.isArray(X)&&X.length>0)return X.every((Y)=>Y!==null&&typeof Y==="object"&&(Y.type==="object"||IZ(Y)))}return!1}function s3(W){if(!W.path?.length)return W.message;return`${W.path.map((Q)=>String(typeof Q==="object"?Q.key:Q)).join(".")}: ${W.message}`}async function F7(W,Q){let X=await W["~standard"].validate(Q);if(X.issues&&X.issues.length>0)return{success:!1,error:X.issues.map((Y)=>s3(Y)).join(", ")};return{success:!0,data:X.value}}function t3(W){let Q=F4(W,{target:K7,io:"input"});return typeof Q.pattern==="string"?Q.pattern:void 0}function WD(W){let Q=e3.exec(W),X=[void 0,-1,0];if(Q)X.push(Number(Q[1]));return[!1,!0].flatMap((Y)=>[!1,!0].flatMap((G)=>X.map((B)=>b1.datetime({local:Y,offset:G,precision:B}))))}function QD(W,Q){let X;switch(W){case"email":X=[TQ()];break;case"uri":X=[l4()];break;case"date":X=[b1.date()];break;case"date-time":X=WD(Q);break}return new Set(X.map((Y)=>t3(Y)).filter((Y)=>Y!==void 0))}function XD(W,Q,X){if(X!=="zod")return!0;return QD(W,Q).has(Q)}function oW(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function YD(W){try{return a3(W,"input")}catch(Q){let X=Q instanceof Error?Q.message:String(Q);throw new l0(D0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${X}`)}}function j7(W){return GD.has(W)||W.startsWith("x-")}function LD(W,Q,X,Y){if(!oW(W))return W;let G=typeof W.type==="string"&&Object.hasOwn(nK,W.type)?nK[W.type]:void 0;if(G===void 0)return W;let B={};for(let[F,L]of Object.entries(W))if(G.has(F)||j7(F))B[F]=L;else if(F==="pattern"&&W.type==="string"&&typeof W.format==="string"){if(!FD.has(W.format))B[F]=L;else if(typeof L!=="string"||!XD(W.format,L,X))Y.push(`${Q}.${F}`)}else Y.push(`${Q}.${F}`);return B}function JD(W,Q){let X={},Y=[];for(let[G,B]of Object.entries(W))if(G==="properties"&&oW(B))X[G]=Object.fromEntries(Object.entries(B).map(([F,L])=>[F,LD(L,`properties.${F}`,Q,Y)]));else if(BD.has(G))X[G]=B;else if(!j7(G))Y.push(G);if(Y.length>0)throw new l0(D0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${Y.join(", ")}`);return X}function zD(W,Q){if(!oW(W.properties))return Q;let X=Object.entries(W.properties).filter(([,Y])=>!$X(e5,Y).success).map(([Y])=>`properties.${Y}`);return X.length>0?X.join(", "):Q}function Z7(W,Q,X=""){if(Array.isArray(W)&&Array.isArray(Q))return W.flatMap((Y,G)=>Z7(Y,Q[G],`${X}[${G}]`));if(!oW(W)||!oW(Q))return[];return Object.entries(W).flatMap(([Y,G])=>{let B=X?`${X}.${Y}`:Y;if(!Object.prototype.hasOwnProperty.call(Q,Y))return j7(Y)?[]:[B];return Z7(G,Q[Y],B)})}function KD(W){if(!z7(W.requestedSchema))return{...W,mode:"form",requestedSchema:W.requestedSchema};let Q=W.requestedSchema["~standard"].vendor,X=JD(YD(W.requestedSchema),Q),Y=$X(a6.shape.requestedSchema,X);if(!Y.success)throw new l0(D0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${zD(X,Y.error.message)}`);let G=Z7(X,Y.data);if(G.length>0)throw new l0(D0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${G.join(", ")}`);let B=(Y.data.required??[]).filter((F)=>!Object.prototype.hasOwnProperty.call(Y.data.properties,F));if(B.length>0)throw new l0(D0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${B.join(", ")}`);return{...W,mode:"form",requestedSchema:Y.data}}function ZD(W){let Q=W.inputRequests!==void 0&&Object.keys(W.inputRequests).length>0,X=typeof W.requestState==="string";if(!Q&&!X)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...W.inputRequests!==void 0&&{inputRequests:W.inputRequests},...W.requestState!==void 0&&{requestState:W.requestState}}}function TZ(W){return{autoFulfill:W?.autoFulfill??HD,maxRounds:W?.maxRounds??$D}}function AD(W,Q,X){let Y=Q!==void 0&&Object.keys(Q).length>0;if(!Y&&X===void 0)return W;return{...W,...Y&&{inputResponses:Q},...X!==void 0&&{requestState:X}}}function ND(W,Q){return`Multi-round-trip request '${W}' still required input after ${Q} rounds (inputRequired.maxRounds)`}function VD(W,Q){return new Promise((X,Y)=>{if(Q?.aborted){Y(Q.reason instanceof $0?Q.reason:new $0(U0.RequestTimeout,String(Q.reason)));return}let G=setTimeout(()=>{Q?.removeEventListener("abort",B),X()},W),B=()=>{clearTimeout(G),Y(Q?.reason instanceof $0?Q.reason:new $0(U0.RequestTimeout,String(Q?.reason)))};Q?.addEventListener("abort",B,{once:!0})})}function wD(W){let Q=new AbortController,X=()=>Q.abort(W?.reason);if(W?.addEventListener("abort",X,{once:!0}),W?.aborted)Q.abort(W.reason);return{signal:Q.signal,abort:(Y)=>Q.abort(Y),dispose:()=>W?.removeEventListener("abort",X)}}async function DD(W){let{config:Q,method:X,originalParams:Y,requestOptions:G,hooks:B,signal:F}=W,L=W.flowStartedAt??Date.now(),J=W.firstPayload,z=0;while(!0){if(z+=1,z>Q.maxRounds)throw new $0(U0.InputRequiredRoundsExceeded,ND(X,Q.maxRounds),{rounds:Q.maxRounds,lastResult:{inputRequests:J.inputRequests,...J.requestState!==void 0&&{requestState:J.requestState}}});G.onprogress?.({progress:z,message:`Fulfilling input required by '${X}' (round ${z})`});let K=Object.entries(J.inputRequests??{}),H;if(K.length>0){let A=wD(F);try{let M=await Promise.all(K.map(async([N,Z])=>{try{return[N,await B.dispatchInputRequest(N,Z,A.signal)]}catch(V){throw A.abort(V),V}}));H=Object.fromEntries(M)}finally{A.dispose()}}else await VD(UD,F);let D={...G.timeout!==void 0&&{timeout:G.timeout}};if(G.maxTotalTimeout!==void 0){let A=Date.now()-L,M=G.maxTotalTimeout-A;if(M<=0)throw new $0(U0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:G.maxTotalTimeout,totalElapsed:A});D.maxTotalTimeout=M}let I=await B.retry(AD(Y,H,J.requestState),D);if(DZ(I)){J={inputRequests:I.inputRequests??{},...I.requestState!==void 0&&{requestState:I.requestState}};continue}return I}}function bZ(W,Q){let X=W.slice(0,-6);RZ[X]=Q,PZ[X]=(Y)=>Q.safeParse(Y).success}function ED(W){switch(W){case"initialize":case"notifications/initialized":return C5(void 0);case"server/discover":return C5(ZX);default:return}}function rK(W,Q){let X=W.params;if(!nW(X))return{message:W,lifted:{}};let Y=X._meta,G=nW(Y)?ID.filter((J)=>(J in Y)):[],B=Q==="request"?TD.filter((J)=>(J in X)):[];if(G.length===0&&B.length===0)return{message:W,lifted:{}};let F={},L={...X};if(G.length>0&&nW(Y)){let J={},z={...Y};for(let K of G)J[K]=Y[K],delete z[K];if(F.envelope=J,Object.keys(z).length>0)L._meta=z;else delete L._meta}for(let J of B){if(J==="inputResponses")F.inputResponses=L[J];if(J==="requestState")F.requestState=L[J];delete L[J]}return{message:{...W,params:L},lifted:F}}function oK(W,Q){let X=W.validateResult(Q,void 0);if(!X.ok&&X.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(Y){let G=W.validateResult(Q,Y);if(G.ok)return{value:G.value};return{issues:[{message:G.reason==="invalid"?G.message:`not-in-era: ${Q}`}]}}}}}function O7(W){return()=>W}function nW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function CZ(W,Q){let X={...W};for(let Y in Q){let G=Y,B=Q[G];if(B===void 0)continue;let F=X[G];X[G]=nW(F)&&nW(B)?{...F,...B}:B}return X}function zX(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function bD(W){let Q={},X=[];if(!zX(W))return{accepted:Q,droppedKeys:X};for(let[Y,G]of Object.entries(W)){if(!zX(G)||"method"in G||"result"in G){X.push(Y);continue}Q[Y]=G}return{accepted:Q,droppedKeys:X}}function aK(W){throw new $0(U0.SendFailed,`ctx.mcpReq.${W} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function SD(W,Q,X,Y,G){return{sessionId:G,mcpReq:{id:W,method:Q,_meta:X?._meta,requestState:O7(void 0),signal:Y,send:()=>aK("send"),notify:()=>aK("notify")}}}async function qD(W,Q,X,Y,G){if(!zX(Y)||typeof Y.method!=="string")throw new $0(U0.InvalidResult,`Invalid input request '${X}': each inputRequests entry must be an embedded request object with a method`,{key:X});let B=Y.method;if(!Q.hasInputRequestMethod(B))throw new $0(U0.InvalidResult,`Invalid input request '${X}': '${B}' is not an embedded request the ${Q.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:X,method:B});let F=W.getRequestHandler(B);if(F===void 0)throw new $0(U0.CapabilityNotSupported,`Cannot fulfil input request '${X}': no handler is registered for '${B}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:X,method:B});let L=zX(Y.params)?Y.params:void 0;return await F({jsonrpc:"2.0",id:X,method:B,...L!==void 0&&{params:L}},W.buildContext(SD(X,B,L,G,W.sessionId)))}function CD(W,Q){return{...W?.signal!==void 0&&{signal:W.signal},...W?.onprogress!==void 0&&{onprogress:W.onprogress},...W?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:W.resetTimeoutOnProgress},...W?.headers!==void 0&&{headers:W.headers},...Q.timeout!==void 0&&{timeout:Q.timeout},...Q.maxTotalTimeout!==void 0&&{maxTotalTimeout:Q.maxTotalTimeout},allowInputRequired:!0}}function kZ(W,Q,X,Y){let{codec:G,request:B,options:F,flowStartedAt:L}=Y,J={inputRequests:X.inputRequests,...X.requestState!==void 0&&{requestState:X.requestState}},z={dispatchInputRequest:(K,H,D)=>qD(W,G,K,H,D),retry:(K,H)=>Y.retry(K,CD(F,H))};return DD({config:Q,method:B.method,originalParams:B.params,firstPayload:J,flowStartedAt:L,signal:F?.signal,requestOptions:{...F?.timeout!==void 0&&{timeout:F.timeout},...F?.maxTotalTimeout!==void 0&&{maxTotalTimeout:F.maxTotalTimeout},...F?.onprogress!==void 0&&{onprogress:F.onprogress}},hooks:z})}function kD(W){return{resultType:"input_required",inputRequests:W.inputRequests,...W.requestState!==void 0&&{requestState:W.requestState}}}function yZ(W){return b5.parse(JSON.parse(W))}function I7(W){return JSON.stringify(W)+`
80
+ `}var L7,Y3,U0,$0,sK,tK="2026-07-28",H7,WZ,F3,L3,J3,YZ,GZ,K3,GX,zP,KP,lK,A7,N3,V3,N7,D0,l0,zZ,KZ,KX,ZZ,M3=0,j3="private",O3,q3,FX,V7,UZ,ZP,HP,g3,f3,w7,LX,ZX="2026-07-28",VZ,u3,D7=(W)=>h5.safeParse(W).success,wZ=(W)=>u5.safeParse(W).success,rW=(W)=>R5.safeParse(W).success,HX=(W)=>P5.safeParse(W).success,DZ=(W)=>typeof W==="object"&&W!==null&&!Array.isArray(W)&&W.resultType==="input_required",l3="Mcp-Param-",dK="x-mcp-header",m3,c3,p3,d3,MZ="=?base64?",jZ="?=",x9=-32020,$P,UP,iK=!1,K7="draft-2020-12",e3,GD,BD,nK,FD,AP,HD=!0,$D=10,UD=250,MD,jD,RZ,PZ,OD,SZ,UX=60000,ID,TD,RD,PD,qZ,vD,NP,vZ=10485760,E7=class{_buffer;_maxBufferSize;constructor(W){this._maxBufferSize=W?.maxBufferSize??vZ}append(W){if((this._buffer?.length??0)+W.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,W]):W}readMessage(){while(this._buffer){let W=this._buffer.indexOf(`
81
+ `);if(W===-1)return null;let Q=this._buffer.toString("utf8",0,W).replace(/\r$/,"");this._buffer=this._buffer.subarray(W+1);try{return yZ(Q)}catch(X){if(X instanceof SyntaxError)continue;throw X}}return null}clear(){this._buffer=void 0}};var T7=H0(()=>{X7();VG();m4();L7=Symbol.for("mcp.sdk.errorBrands");Y3=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Q){return r1(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r1(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.errorUri=Y,this.name="OAuthError",S4(this,new.target)}toResponseObject(){let Q={error:this.code,error_description:this.message};if(this.errorUri)Q.error_uri=this.errorUri;return Q}static fromResponse(Q){return new W(Q.error,Q.error_description??Q.error,Q.error_uri)}},U0=function(W){return W.NotConnected="NOT_CONNECTED",W.AlreadyConnected="ALREADY_CONNECTED",W.NotInitialized="NOT_INITIALIZED",W.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",W.RequestTimeout="REQUEST_TIMEOUT",W.ConnectionClosed="CONNECTION_CLOSED",W.SendFailed="SEND_FAILED",W.InvalidResult="INVALID_RESULT",W.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",W.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",W.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",W.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",W.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",W.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",W.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",W.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",W.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",W.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",W.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",W}({}),$0=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](W){return r1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r1(this,W)}constructor(W,Q,X){super(Q);this.code=W,this.data=X,this.name="SdkError",S4(this,new.target)}},sK=class extends $0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(W,Q,X){super(W,Q,X);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}},H7=[tK];WZ=["task","inputRequests","requestState"];L3=new Set(["const","enum","default","examples"]),J3=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas"]);YZ={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},GZ={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},K3={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};zP=Object.keys(YZ),KP=Object.keys(GZ);lK={ok:!1,reason:"not-in-era"};A7={era:"2025-11-25",hasRequestMethod:BZ,hasNotificationMethod:FZ,validateRequest:(W,Q)=>BX($3(W),Q),validateResult:(W,Q)=>BX(H3(W),Q),validateNotification:(W,Q)=>BX(U3(W),Q),hasInputRequestMethod:()=>!1,validateInputRequest:()=>lK,validateInputResponse:()=>lK,samplingResultVariant:(W,Q)=>{let X=QZ();return BX(W?X.CreateMessageResultWithToolsSchema:X.CreateMessageResultSchema,Q)},outboundEnvelope:(W)=>{return},validateEnvelopeMeta:(W)=>[],projectCallToolResult(W,Q){let X=eK(W),Y=X.structuredContent;if(Y===void 0)return X;let G=typeof Y!=="object"||Y===null||Array.isArray(Y),B=Q!==void 0&&XZ(Q);if(!G&&!B)return X;return{...X,structuredContent:{result:Y}}},decodeResult(W,Q){if(J7(Q)&&"resultType"in Q){let X={...Q};return delete X.resultType,{kind:"complete",result:cK(X)}}return{kind:"complete",result:cK(Q)}},encodeResult(W,Q){if(W!=="tools/list")return Q;let X=Q.tools;if(!Array.isArray(X)||!X.some((Y)=>mK(Y)))return Q;return{...Q,tools:X.map((Y)=>mK(Y)?{...Y,outputSchema:z3(Y.outputSchema)}:Y)}},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope:(W)=>{return}};V3=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];N7=Symbol("modelcontextprotocol.resultCacheHintFallback");D0=function(W){return W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.ResourceNotFound=-32002]="ResourceNotFound",W[W.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",W[W.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired",W}({}),l0=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](Q){return r1(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r1(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.data=Y,this.name="ProtocolError",S4(this,new.target)}static fromError(Q,X,Y){if(Q===D0.UrlElicitationRequired&&Y){let G=Y;if(G.elicitations)return new KZ(G.elicitations,X)}if(Q===D0.UnsupportedProtocolVersion&&Y){let G=Y;if(Array.isArray(G.supported)&&typeof G.requested==="string")return new KX({supported:G.supported,requested:G.requested},X)}if(Q===D0.InvalidParams||Q===D0.ResourceNotFound){let G=Y;if(typeof G?.uri==="string"&&(Q===D0.ResourceNotFound||Object.keys(G).length===1))return new zZ(G.uri,X)}if(Q===D0.MissingRequiredClientCapability&&Y){let G=Y;if(G.requiredCapabilities!==null&&typeof G.requiredCapabilities==="object"&&!Array.isArray(G.requiredCapabilities))return new ZZ({requiredCapabilities:G.requiredCapabilities},X)}return new W(Q,X,Y)}},zZ=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(W,Q=`Resource not found: ${W}`){super(D0.InvalidParams,Q,{uri:W})}get uri(){return this.data.uri}},KZ=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(W,Q=`URL elicitation${W.length>1?"s":""} required`){super(D0.UrlElicitationRequired,Q,{elicitations:W})}get elicitations(){return this.data?.elicitations??[]}},KX=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(W,Q=`Unsupported protocol version: ${W.requested}`){super(D0.UnsupportedProtocolVersion,Q,W)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ZZ=class extends l0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(W,Q=`Missing required client capabilities: ${Object.keys(W.requiredCapabilities).join(", ")}`){super(D0.MissingRequiredClientCapability,Q,W)}get requiredCapabilities(){return this.data.requiredCapabilities}},O3=["tools/call","prompts/get","resources/read"];q3=["elicitation/create","sampling/createMessage","roots/list"];V7={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},UZ={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};ZP=Object.keys(V7),HP=Object.keys(UZ);g3={ok:!1,reason:"not-in-era"},f3=[i1,S1];w7={era:"2026-07-28",hasRequestMethod:AZ,hasNotificationMethod:NZ,hasInputRequestMethod:(W)=>Y7(W)!==void 0,validateRequest:(W,Q)=>pW(v3(W),Q),validateResult:(W,Q)=>pW(y3(W),Q),validateNotification:(W,Q)=>pW(_3(W),Q),validateInputRequest:(W,Q)=>pW(Y7(W),Q),validateInputResponse:(W,Q)=>pW(C3(W),Q),samplingResultVariant:()=>g3,outboundEnvelope(W){return{[i1]:W.protocolVersion,[y6]:W.clientInfo,[S1]:W.clientCapabilities,...W.logLevel!==void 0&&{[n1]:W.logLevel}}},validateEnvelopeMeta(W){let Q=[];for(let Y of f3)if(!(Y in W))Q.push({key:Y,problem:"missing"});let X=b4().RequestMetaEnvelopeSchema.safeParse(W);if(!X.success)for(let Y of X.error.issues){let G=Y.path.map(String),B=G.length>0?G.join("."):"_meta";if(G.length===1&&Q.some((F)=>F.key===B&&F.problem==="missing"))continue;Q.push({key:B,problem:Y.message})}return Q},projectCallToolResult:(W)=>eK(W),inputRequestSchema:Y7,decodeResult(W,Q){if(!iW(Q))return{kind:"invalid",error:new $0(U0.InvalidResult,`Invalid result for ${W}: not an object`,{method:W})};let X=Q.resultType;if(X===void 0)return{kind:"invalid",error:new $0(U0.InvalidResult,`Invalid result for ${W}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:W,violation:"missing-resultType"})};if(typeof X!=="string")return{kind:"invalid",error:new $0(U0.InvalidResult,`Invalid result for ${W}: non-string resultType`,{method:W,resultType:X})};if(X==="input_required"){let F=Q.inputRequests,L=iW(F)?F:{},J=Q.requestState;if(Object.keys(L).length===0&&typeof J!=="string")return{kind:"invalid",error:new $0(U0.InvalidResult,`Invalid result for ${W}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:W,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:L,...typeof J==="string"&&{requestState:J}}}if(X!=="complete")return{kind:"invalid",error:new $0(U0.UnsupportedResultType,`Unsupported result type '${X}' for ${W}`,{resultType:X,method:W})};let Y=h3(),G=Object.hasOwn(Y,W)?Y[W]:void 0;if(G!==void 0){let F=G.safeParse(Q);if(!F.success)return{kind:"invalid",error:new $0(U0.InvalidResult,`Invalid result for ${W}: ${F.error}`,{method:W})}}let B={...Q};return delete B.resultType,{kind:"complete",result:B}},encodeResult(W,Q,X){return R3(I3(W,E3(W,x3(W,Q))),X)},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope(W){if(W.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let Q=b4().RequestMetaEnvelopeSchema.safeParse(W.envelope);if(!Q.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${Q.error.issues.map((X)=>X.message).join("; ")}`}};VZ=[A7,w7],u3=uK({AnnotationsSchema:()=>_6,AudioContentSchema:()=>d5,BaseMetadataSchema:()=>v6,BaseRequestParamsSchema:()=>Y1,BlobResourceContentsSchema:()=>D4,BooleanSchemaSchema:()=>n5,CallToolRequestParamsSchema:()=>m8,CallToolRequestSchema:()=>c8,CallToolResultSchema:()=>E4,CancelTaskRequestSchema:()=>IW,CancelTaskResultSchema:()=>TW,CancelledNotificationParamsSchema:()=>i4,CancelledNotificationSchema:()=>$4,ClientCapabilitiesSchema:()=>a4,ClientNotificationSchema:()=>PW,ClientRequestSchema:()=>RW,ClientResultSchema:()=>bW,ClientTasksCapabilitySchema:()=>r4,CompatibilityCallToolResultSchema:()=>UW,CompleteRequestParamsSchema:()=>N9,CompleteRequestSchema:()=>V9,CompleteResultSchema:()=>w9,ContentBlockSchema:()=>i5,CreateMessageRequestParamsSchema:()=>Q9,CreateMessageRequestSchema:()=>X9,CreateMessageResultSchema:()=>Y9,CreateMessageResultWithToolsSchema:()=>G9,CreateTaskResultSchema:()=>NW,CursorSchema:()=>z4,DiscoverRequestSchema:()=>Q8,DiscoverResultSchema:()=>S5,ElicitRequestFormParamsSchema:()=>a6,ElicitRequestParamsSchema:()=>z9,ElicitRequestSchema:()=>K9,ElicitRequestURLParamsSchema:()=>J9,ElicitResultSchema:()=>$9,ElicitationCompleteNotificationParamsSchema:()=>Z9,ElicitationCompleteNotificationSchema:()=>H9,EmbeddedResourceSchema:()=>v8,EmptyResultSchema:()=>H4,EnumSchemaSchema:()=>L9,GetPromptRequestParamsSchema:()=>q8,GetPromptRequestSchema:()=>C8,GetPromptResultSchema:()=>g8,GetTaskPayloadRequestSchema:()=>MW,GetTaskPayloadResultSchema:()=>jW,GetTaskRequestSchema:()=>wW,GetTaskResultSchema:()=>DW,IconSchema:()=>n4,IconsSchema:()=>c6,ImageContentSchema:()=>p5,ImplementationSchema:()=>l5,InitializeRequestParamsSchema:()=>s4,InitializeRequestSchema:()=>t4,InitializeResultSchema:()=>e4,InitializedNotificationSchema:()=>W8,JSONArraySchema:()=>HW,JSONObjectSchema:()=>t0,JSONRPCErrorResponseSchema:()=>P5,JSONRPCMessageSchema:()=>b5,JSONRPCNotificationSchema:()=>u5,JSONRPCRequestSchema:()=>h5,JSONRPCResponseSchema:()=>$W,JSONRPCResultResponseSchema:()=>R5,JSONValueSchema:()=>l6,LegacyTitledEnumSchemaSchema:()=>a5,ListChangedOptionsBaseSchema:()=>I4,ListPromptsRequestSchema:()=>b8,ListPromptsResultSchema:()=>S8,ListResourceTemplatesRequestSchema:()=>J8,ListResourceTemplatesResultSchema:()=>z8,ListResourcesRequestSchema:()=>F8,ListResourcesResultSchema:()=>L8,ListRootsRequestSchema:()=>M9,ListRootsResultSchema:()=>j9,ListTasksRequestSchema:()=>OW,ListTasksResultSchema:()=>EW,ListToolsRequestSchema:()=>u8,ListToolsResultSchema:()=>l8,LoggingLevelSchema:()=>n6,LoggingMessageNotificationParamsSchema:()=>n8,LoggingMessageNotificationSchema:()=>r8,ModelHintSchema:()=>o8,ModelPreferencesSchema:()=>a8,MultiSelectEnumSchemaSchema:()=>F9,NotificationSchema:()=>z1,NotificationsParamsSchema:()=>J1,NumberSchemaSchema:()=>o6,PaginatedRequestParamsSchema:()=>G8,PaginatedRequestSchema:()=>p6,PaginatedResultSchema:()=>d6,PingRequestSchema:()=>A4,PrimitiveSchemaDefinitionSchema:()=>e5,ProgressNotificationParamsSchema:()=>Y8,ProgressNotificationSchema:()=>N4,ProgressSchema:()=>X8,ProgressTokenSchema:()=>J4,PromptArgumentSchema:()=>R8,PromptListChangedNotificationSchema:()=>f8,PromptMessageSchema:()=>_8,PromptReferenceSchema:()=>A9,PromptSchema:()=>P8,ReadResourceRequestParamsSchema:()=>K8,ReadResourceRequestSchema:()=>Z8,ReadResourceResultSchema:()=>H8,RelatedTaskMetadataSchema:()=>d4,RequestIdSchema:()=>m6,RequestMetaSchema:()=>K4,RequestSchema:()=>e0,ResourceContentsSchema:()=>V4,ResourceLinkSchema:()=>y8,ResourceListChangedNotificationSchema:()=>$8,ResourceRequestParamsSchema:()=>m5,ResourceSchema:()=>M4,ResourceTemplateReferenceSchema:()=>U9,ResourceTemplateSchema:()=>B8,ResourceUpdatedNotificationParamsSchema:()=>I8,ResourceUpdatedNotificationSchema:()=>T8,ResultMetaObjectSchema:()=>Z4,ResultSchema:()=>W1,RoleSchema:()=>i6,RootSchema:()=>D9,RootsListChangedNotificationSchema:()=>O9,SamplingContentSchema:()=>e8,SamplingMessageContentBlockSchema:()=>O5,SamplingMessageSchema:()=>W9,ServerCapabilitiesSchema:()=>U4,ServerNotificationSchema:()=>qW,ServerRequestSchema:()=>SW,ServerResultSchema:()=>CW,ServerTasksCapabilitySchema:()=>o4,SetLevelRequestParamsSchema:()=>d8,SetLevelRequestSchema:()=>i8,SingleSelectEnumSchemaSchema:()=>B9,StringSchemaSchema:()=>r6,SubscribeRequestParamsSchema:()=>U8,SubscribeRequestSchema:()=>A8,SubscriptionFilterSchema:()=>j4,SubscriptionsAcknowledgedNotificationParamsSchema:()=>M8,SubscriptionsAcknowledgedNotificationSchema:()=>j8,SubscriptionsListenRequestParamsSchema:()=>w8,SubscriptionsListenRequestSchema:()=>D8,SubscriptionsListenResultMetaSchema:()=>O8,SubscriptionsListenResultSchema:()=>E8,TaskAugmentedRequestParamsSchema:()=>T5,TaskCreationParamsSchema:()=>AW,TaskMetadataSchema:()=>p4,TaskSchema:()=>s6,TaskStatusNotificationParamsSchema:()=>I9,TaskStatusNotificationSchema:()=>VW,TaskStatusSchema:()=>E9,TextContentSchema:()=>c5,TextResourceContentsSchema:()=>w4,TitledMultiSelectEnumSchemaSchema:()=>t5,TitledSingleSelectEnumSchemaSchema:()=>o5,ToolAnnotationsSchema:()=>x8,ToolChoiceSchema:()=>s8,ToolExecutionSchema:()=>h8,ToolListChangedNotificationSchema:()=>p8,ToolResultContentSchema:()=>t8,ToolSchema:()=>O4,ToolUseContentSchema:()=>k8,UnsubscribeRequestParamsSchema:()=>N8,UnsubscribeRequestSchema:()=>V8,UntitledMultiSelectEnumSchemaSchema:()=>s5,UntitledSingleSelectEnumSchemaSchema:()=>r5}),m3=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,c3=new Set(["string","integer","boolean","number"]);p3=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],d3=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);$P=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[D0.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[x9,D0.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[D0.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[D0.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[D0.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[x9],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[D0.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[x9],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],UP={[D0.ParseError]:400,[D0.InvalidRequest]:400,[D0.MethodNotFound]:404,[D0.UnsupportedProtocolVersion]:400,[D0.MissingRequiredClientCapability]:400,[x9]:400};e3=/\\\.\\d\{(\d+)\}/;GD=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);BD=new Set(["$schema",...Object.keys(a6.shape.requestedSchema.shape)]),nK={string:dW([r6,r5,o5,a5]),number:dW([o6]),integer:dW([o6]),boolean:dW([n5]),array:dW([s5,t5])},FD=new Set(r6.shape.format.unwrap().options);AP=Object.assign(ZD,{elicit(W){try{return{method:"elicitation/create",params:KD(W)}}catch(Q){throw Q instanceof l0?TypeError(Q.message,{cause:Q}):Q}},elicitUrl(W){return{method:"elicitation/create",params:{...W,mode:"url"}}},createMessage(W){return{method:"sampling/createMessage",params:W}},listRoots(){return{method:"roots/list"}}});MD=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],jD={IdJagTokenExchangeResponseSchema:S9,OAuthClientInformationFullSchema:v9,OAuthClientInformationSchema:k9,OAuthClientMetadataSchema:C9,OAuthClientRegistrationErrorSchema:kW,OAuthErrorResponseSchema:q9,OAuthMetadataSchema:T4,OAuthProtectedResourceMetadataSchema:T9,OAuthTokenRevocationRequestSchema:vW,OAuthTokensSchema:b9,OpenIdProviderDiscoveryMetadataSchema:P9,OpenIdProviderMetadataSchema:R9},RZ={},PZ={};for(let W of MD)bZ(W,u3[W]);for(let[W,Q]of Object.entries(jD))bZ(W,Q);OD=Object.freeze(RZ),SZ=Object.freeze(PZ);ID=[i1,y6,S1,n1],TD=["inputResponses","requestState"];RD=O7(void 0),qZ=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{PD=(W,Q)=>{W._negotiatedProtocolVersion=Q}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(W){this._options=W,this._supportedProtocolVersions=W?.supportedProtocolVersions??L4,this.setNotificationHandler("notifications/cancelled",(Q)=>{this._oncancel(Q)}),this.setNotificationHandler("notifications/progress",(Q)=>{this._onprogress(Q)}),this.setRequestHandler("ping",(Q)=>({}))}_shouldDropInbound(W){}_outboundMetaEnvelope(){}_envelopeOutbound(W){let Q=this._outboundMetaEnvelope();if(Q===void 0)return W;let X=W.params??{};return{...W,params:{...X,_meta:{...Q,...X._meta}}}}_resolveNonCompleteResult(W,Q){return Promise.reject(new $0(U0.UnsupportedResultType,`Unsupported result type '${W.kind}' for ${Q.request.method}`,{resultType:W.kind,method:Q.request.method}))}_getRequestHandler(W){return this._requestHandlers.get(W)}async _oncancel(W){if(!W.params.requestId)return;this._requestHandlerAbortControllers.get(W.params.requestId)?.abort(W.params.reason)}_setupTimeout(W,Q,X,Y,G=!1){this._timeoutInfo.set(W,{timeoutId:setTimeout(Y,Q),startTime:Date.now(),timeout:Q,maxTotalTimeout:X,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout(W){let Q=this._timeoutInfo.get(W);if(!Q)return!1;let X=Date.now()-Q.startTime;if(Q.maxTotalTimeout&&X>=Q.maxTotalTimeout)throw this._timeoutInfo.delete(W),new $0(U0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Q.maxTotalTimeout,totalElapsed:X});return clearTimeout(Q.timeoutId),Q.timeoutId=setTimeout(Q.onTimeout,Q.timeout),!0}_cleanupTimeout(W){let Q=this._timeoutInfo.get(W);if(Q)clearTimeout(Q.timeoutId),this._timeoutInfo.delete(W)}async connect(W){this._transport=W;let Q=this.transport?.onclose;this._transport.onclose=()=>{try{Q?.()}finally{this._onclose()}};let X=this.transport?.onerror;this._transport.onerror=(G)=>{X?.(G),this._onerror(G)};let Y=this._transport?.onmessage;this._transport.onmessage=(G,B)=>{if(Y?.(G,B),rW(G)||HX(G))this._onresponse(G);else if(D7(G))this._onrequest(G,B);else if(wZ(G))this._onnotification(G,B);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},W.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();let Q=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let X=new $0(U0.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let Y of W.values())Y(X);for(let Y of Q.values())Y.abort(X)}}_onerror(W){this.onerror?.(W)}_onnotification(W,Q){let{message:X}=rK(W,"notification"),Y=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop")return;if(Q?.classification!==void 0){let F=pK(Q.classification);if(F!==Y.era){this._onerror(Error(`Era mismatch on inbound notification '${X.method}': classified as ${F} but this instance serves ${Y.era}`));return}}if(B7(X.method)&&!Y.hasNotificationMethod(X.method))return;let G=this._notificationHandlers.get(X.method),B=this.fallbackNotificationHandler;if(G===void 0&&B===void 0)return;Promise.resolve().then(()=>G===void 0?B(X):G(X,Y)).catch((F)=>this._onerror(Error(`Uncaught error in notification handler: ${F}`)))}_onrequest(W,Q){let{message:X,lifted:Y}=rK(W,"request"),G=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop"){this._onerror(Error(`Dropped inbound request '${W.method}': not servable on this connection's protocol era`));return}let B=this._transport,F=(M,N,Z)=>{let V={jsonrpc:"2.0",id:X.id,error:{code:M,message:N,...Z!==void 0&&{data:Z}}};B?.send(V).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)))};if(Q?.classification!==void 0){let M=pK(Q.classification);if(M!==G.era){this._onerror(Error(`Era mismatch on inbound request '${X.method}': classified as ${M} but this instance serves ${G.era}`));let N=Q.classification.revision??M;F(D0.UnsupportedProtocolVersion,`Unsupported protocol version: ${N}`,{supported:this._supportedProtocolVersions,requested:N});return}}if(G7(X.method)&&!G.hasRequestMethod(X.method)){F(D0.MethodNotFound,"Method not found");return}let L=this._requestHandlers.get(X.method)??this.fallbackRequestHandler;if(L===void 0){F(D0.MethodNotFound,"Method not found");return}let J=G.checkInboundEnvelope(Y);if(J!==void 0){F(D0.InvalidParams,J);return}let z=(M,N)=>this._notificationViaCodec(this._resolveOutboundCodec(M.method),M,{...N,relatedRequestId:X.id}),K=(M,N,Z)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(M.method),M,N,{...Z,relatedRequestId:X.id}),H=new AbortController;this._requestHandlerAbortControllers.set(X.id,H);let D=Y.inputResponses===void 0?void 0:bD(Y.inputResponses),I={sessionId:B?.sessionId,mcpReq:{id:X.id,method:X.method,_meta:X.params?._meta,...Y.envelope!==void 0&&{envelope:Y.envelope},...D!==void 0&&{inputResponses:D.accepted},...D!==void 0&&D.droppedKeys.length>0&&{droppedInputResponseKeys:D.droppedKeys},requestState:Y.requestState===void 0?RD:O7(Y.requestState),signal:H.signal,send:(M,N,Z)=>{let V=this._resolveOutboundCodec(M.method);if(this._assertOutboundRequestInEra(V,M.method),z7(N))return K(M,N,Z);let U=oK(V,M.method);if(U===void 0)throw TypeError(`'${M.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return K(M,U,N)},notify:z},http:Q?.authInfo?{authInfo:Q.authInfo}:void 0},A=this.buildContext(I,Q);Promise.resolve().then(()=>L(X,A)).then(async(M)=>{if(H.signal.aborted)return;let N;try{N=G.encodeResult(X.method,M,this._outboundServerInfo())}catch(V){this._onerror(Error(`Failed to encode result for ${X.method}: ${V}`)),F(D0.InternalError,"Internal error");return}let Z={result:N,jsonrpc:"2.0",id:X.id};await B?.send(Z)},async(M)=>{if(H.signal.aborted)return;let N=Number.isSafeInteger(M.code)?M.code:D0.InternalError,Z={jsonrpc:"2.0",id:X.id,error:{code:G.encodeErrorCode(N),message:M.message??"Internal error",...M.data!==void 0&&{data:M.data}}};await B?.send(Z)}).catch((M)=>this._onerror(Error(`Failed to send response: ${M}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(X.id)===H)this._requestHandlerAbortControllers.delete(X.id)})}_onprogress(W){let{progressToken:Q,...X}=W.params,Y=Number(Q),G=this._progressHandlers.get(Y);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(W)}`));return}let B=this._responseHandlers.get(Y),F=this._timeoutInfo.get(Y);if(F&&B&&F.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(L){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),B(L);return}G(X)}_onresponse(W){let Q=Number(W.id),X=this._responseHandlers.get(Q);if(X===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(W)}`));return}if(this._responseHandlers.delete(Q),this._cleanupTimeout(Q),this._progressHandlers.delete(Q),rW(W))X(W);else X(l0.fromError(W.error.code,W.error.message,W.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(W,Q,X){let Y=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(Y,W.method),z7(Q))return this._requestWithSchemaViaCodec(Y,W,Q,X);let G=oK(Y,W.method);if(G===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(Y,W,G,Q)}_negotiatedWireCodec(){return C5(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(W){if(this._negotiatedProtocolVersion===void 0){let Q=ED(W);if(Q)return Q}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(W,Q){if(G7(Q)&&!W.hasRequestMethod(Q))throw new $0(U0.MethodNotSupportedByProtocolVersion,`Method '${Q}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q,era:W.era})}_requestWithSchema(W,Q,X){let Y=this._resolveOutboundCodec(W.method);return this._assertOutboundRequestInEra(Y,W.method),this._requestWithSchemaViaCodec(Y,W,Q,X)}_requestWithSchemaViaCodec(W,Q,X,Y){let{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L}=Y??{},J=Date.now(),z,K;return new Promise((H,D)=>{let I=(O)=>{D(O)};if(!this._transport){I(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(Q.method)}catch(O){I(O);return}if(Y?.signal?.aborted){let O=Y.signal.reason;throw O instanceof $0?O:new $0(U0.RequestTimeout,String(O))}let A=W.era===ZX&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,M=this._requestMessageId++;K=M;let N={...Q,jsonrpc:"2.0",id:M};if(Y?.onprogress)this._progressHandlers.set(M,Y.onprogress),N.params={...Q.params,_meta:{...Q.params?._meta,progressToken:M}};let Z=this._envelopeOutbound(N),V=!1,U=(O)=>{if(V)return;if(this._progressHandlers.delete(M),A===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(O)}}),{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));else A.abort();D(O instanceof $0?O:new $0(U0.RequestTimeout,String(O)))};this._responseHandlers.set(M,(O)=>{if(Y?.signal?.aborted)return;if(V=!0,O instanceof Error)return D(O);let w;try{w=W.decodeResult(Q.method,O.result)}catch(k){return D(k instanceof Error?k:Error(String(k)))}if(w.kind==="invalid")return D(w.error);if(w.kind==="input_required"){if(Y?.allowInputRequired===!0)return H(kD(w));let k={codec:W,request:Q,resultSchema:X,options:Y,flowStartedAt:J,retry:(l,_)=>this._requestWithSchemaViaCodec(W,l===void 0?{method:Q.method}:{method:Q.method,params:l},X,_)};return H(this._resolveNonCompleteResult(w,k))}let R=w.result;F7(X,R).then((k)=>{if(k.success)H(k.data);else D(new $0(U0.InvalidResult,`Invalid result for ${Q.method}: ${k.error}`))},D)}),z=()=>U(Y?.signal?.reason),Y?.signal?.addEventListener("abort",z,{once:!0});let j=Y?.timeout??UX,T=()=>U(new $0(U0.RequestTimeout,"Request timed out",{timeout:j}));this._setupTimeout(M,j,Y?.maxTotalTimeout,T,Y?.resetTimeoutOnProgress??!1),this._transport.send(Z,{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L,requestSignal:A?.signal}).catch((O)=>{this._progressHandlers.delete(M),D(O)})}).finally(()=>{if(z)Y?.signal?.removeEventListener("abort",z);if(K!==void 0)this._responseHandlers.delete(K),this._cleanupTimeout(K)})}async notification(W,Q){return this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,Q)}async _notificationViaCodec(W,Q,X){if(!this._transport)throw new $0(U0.NotConnected,"Not connected");if(B7(Q.method)&&!W.hasNotificationMethod(Q.method))throw new $0(U0.MethodNotSupportedByProtocolVersion,`Notification '${Q.method}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q.method,era:W.era});this.assertNotificationCapability(Q.method);let Y=this._envelopeOutbound({jsonrpc:"2.0",...Q});if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;this._transport?.send(Y,X).catch((G)=>this._onerror(G))});return}await this._transport.send(Y,X)}setRequestHandler(W,Q,X){this.assertRequestHandlerCapability(W);let Y;if(typeof Q==="function"){if(!G7(W))throw TypeError(`'${W}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);Y=(G,B)=>{let F=this._negotiatedWireCodec(),L=F.validateRequest(W,G);if(!L.ok&&L.reason==="not-in-era")L=F.validateInputRequest(W,G);if(!L.ok){if(L.reason==="not-in-era")throw new l0(D0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(L.message)}return Promise.resolve(Q(L.value,B))}}else if(X)Y=async(G,B)=>{let F=await F7(Q.params,{...G.params});if(!F.success)throw new l0(D0.InvalidParams,`Invalid params for ${W}: ${F.error}`);return X(F.data,B)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(W,this._wrapHandler(W,Y))}_wrapHandler(W,Q){return Q}_outboundServerInfo(){}removeRequestHandler(W){this._requestHandlers.delete(W)}assertCanSetRequestHandler(W){if(this._requestHandlers.has(W))throw Error(`A request handler for ${W} already exists, which would be overridden`)}setNotificationHandler(W,Q,X){if(typeof Q==="function"){if(!B7(W))throw TypeError(`'${W}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(W,(Y,G)=>{let B=G.validateNotification(W,Y);if(!B.ok){if(B.reason==="not-in-era")throw new l0(D0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(B.message)}return Promise.resolve(Q(B.value))});return}if(!X)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(W,async(Y)=>{let G=await F7(Q.params,{...Y.params});if(!G.success)throw new l0(D0.InvalidParams,`Invalid params for notification ${W}: ${G.error}`);await X(G.data,Y)})}removeNotificationHandler(W){this._notificationHandlers.delete(W)}};/*!
82
+ * content-type
83
+ * Copyright(c) 2015 Douglas Christopher Wilson
84
+ * MIT Licensed
85
+ */vD=Y0((W)=>{var Q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,X=/\\([\u000b\u0020-\u00ff])/g,Y=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;W.parse=G;function G(L){if(!L)throw TypeError("argument string is required");var J=typeof L==="object"?B(L):L;if(typeof J!=="string")throw TypeError("argument string is required to be a string");var z=J.indexOf(";"),K=z!==-1?J.slice(0,z).trim():J.trim();if(!Y.test(K))throw TypeError("invalid media type");var H=new F(K.toLowerCase());if(z!==-1){var D,I,A;Q.lastIndex=z;while(I=Q.exec(J)){if(I.index!==z)throw TypeError("invalid parameter format");if(z+=I[0].length,D=I[1].toLowerCase(),A=I[2],A.charCodeAt(0)===34){if(A=A.slice(1,-1),A.indexOf("\\")!==-1)A=A.replace(X,"$1")}H.parameters[D]=A}if(z!==J.length)throw TypeError("invalid parameter format")}return H}function B(L){var J;if(typeof L.getHeader==="function")J=L.getHeader("content-type");else if(typeof L.headers==="object")J=L.headers&&L.headers["content-type"];if(typeof J!=="string")throw TypeError("content-type header is missing from object");return J}function F(L){this.parameters=Object.create(null),this.type=L}}),NP=YX(vD(),1)});function iM(){let W=new mM.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return dM(W),W}var AX,_Z,I0,v0,x6,VX,yD,gZ,fZ,NX,_D,h6,gD,fD,xZ,xD,wX,sW,DX,tW,MX,hD,hZ,uD,lD,mD,uZ,cD,R7,lZ,pD,dD,iD,nD,rD,oD,aD,sD,P7,tD,eD,WM,mZ,cZ,pZ,QM,XM,YM,b7,GM,dZ,BM,FM,LM,JM,zM,KM,ZM,HM,iZ,$M,nZ,rZ,UM,AM,oZ,NM,aZ,sZ,tZ,VM,wM,DM,MM,jM,OM,EM,IM,TM,RM,PM,bM,SM,qM,CM,kM,vM,yM,_M,gM,fM,xM,hM,uM,lM,mM,cM,pM,dM,S7=class{_ajv;_userAjv;constructor(W){this._userAjv=W!==void 0,this._ajv=W}get ajv(){return this._ajv??=iM()}getValidator(W){if(!this._userAjv&&"$schema"in W&&typeof W.$schema==="string"&&!pM.has(W.$schema.replace(/#$/,""))){let Y=W.$schema.slice(0,200);throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${Y}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let Q=this.ajv,X="$id"in W&&typeof W.$id==="string"?Q.getSchema(W.$id)??Q.compile(W):Q.compile(W);return(Y)=>{return X(Y)?{valid:!0,data:Y,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Q.errorsText(X.errors)}}}},PP;var eZ=H0(()=>{X7();AX=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var Q=class{};W._CodeOrName=Q,W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var X=class extends Q{constructor(Z){super();if(!W.IDENTIFIER.test(Z))throw Error("CodeGen: name must be a valid identifier");this.str=Z}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};W.Name=X;var Y=class extends Q{constructor(Z){super();this._items=typeof Z==="string"?[Z]:Z}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let Z=this._items[0];return Z===""||Z==='""'}get str(){var Z;return(Z=this._str)!==null&&Z!==void 0?Z:this._str=this._items.reduce((V,U)=>`${V}${U}`,"")}get names(){var Z;return(Z=this._names)!==null&&Z!==void 0?Z:this._names=this._items.reduce((V,U)=>{if(U instanceof X)V[U.str]=(V[U.str]||0)+1;return V},{})}};W._Code=Y,W.nil=new Y("");function G(Z,...V){let U=[Z[0]],j=0;while(j<V.length)L(U,V[j]),U.push(Z[++j]);return new Y(U)}W._=G;let B=new Y("+");function F(Z,...V){let U=[I(Z[0])],j=0;while(j<V.length)U.push(B),L(U,V[j]),U.push(B,I(Z[++j]));return J(U),new Y(U)}W.str=F;function L(Z,V){if(V instanceof Y)Z.push(...V._items);else if(V instanceof X)Z.push(V);else Z.push(H(V))}W.addCodeArg=L;function J(Z){let V=1;while(V<Z.length-1){if(Z[V]===B){let U=z(Z[V-1],Z[V+1]);if(U!==void 0){Z.splice(V-1,3,U);continue}Z[V++]="+"}V++}}function z(Z,V){if(V==='""')return Z;if(Z==='""')return V;if(typeof Z=="string"){if(V instanceof X||Z[Z.length-1]!=='"')return;if(typeof V!="string")return`${Z.slice(0,-1)}${V}"`;if(V[0]==='"')return Z.slice(0,-1)+V.slice(1);return}if(typeof V=="string"&&V[0]==='"'&&!(Z instanceof X))return`"${Z}${V.slice(1)}`}function K(Z,V){return V.emptyStr()?Z:Z.emptyStr()?V:F`${Z}${V}`}W.strConcat=K;function H(Z){return typeof Z=="number"||typeof Z=="boolean"||Z===null?Z:I(Array.isArray(Z)?Z.join(","):Z)}function D(Z){return new Y(I(Z))}W.stringify=D;function I(Z){return JSON.stringify(Z).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=I;function A(Z){return typeof Z=="string"&&W.IDENTIFIER.test(Z)?new Y(`.${Z}`):G`[${Z}]`}W.getProperty=A;function M(Z){if(typeof Z=="string"&&W.IDENTIFIER.test(Z))return new Y(`${Z}`);throw Error(`CodeGen: invalid export name: ${Z}, use explicit $id name mapping`)}W.getEsmExportName=M;function N(Z){return new Y(Z.toString())}W.regexpCode=N}),_Z=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.ValueScope=W.ValueScopeName=W.Scope=W.varKinds=W.UsedValueState=void 0;let Q=AX();var X=class extends Error{constructor(J){super(`CodeGen: "code" for ${J} not defined`);this.value=J.value}},Y;(function(J){J[J.Started=0]="Started",J[J.Completed=1]="Completed"})(Y||(W.UsedValueState=Y={})),W.varKinds={const:new Q.Name("const"),let:new Q.Name("let"),var:new Q.Name("var")};var G=class{constructor({prefixes:J,parent:z}={}){this._names={},this._prefixes=J,this._parent=z}toName(J){return J instanceof Q.Name?J:this.name(J)}name(J){return new Q.Name(this._newName(J))}_newName(J){let z=this._names[J]||this._nameGroup(J);return`${J}${z.index++}`}_nameGroup(J){var z,K;if(((K=(z=this._parent)===null||z===void 0?void 0:z._prefixes)===null||K===void 0?void 0:K.has(J))||this._prefixes&&!this._prefixes.has(J))throw Error(`CodeGen: prefix "${J}" is not allowed in this scope`);return this._names[J]={prefix:J,index:0}}};W.Scope=G;var B=class extends Q.Name{constructor(J,z){super(z);this.prefix=J}setValue(J,{property:z,itemIndex:K}){this.value=J,this.scopePath=Q._`.${new Q.Name(z)}[${K}]`}};W.ValueScopeName=B;let F=Q._`\n`;var L=class extends G{constructor(J){super(J);this._values={},this._scope=J.scope,this.opts={...J,_n:J.lines?F:Q.nil}}get(){return this._scope}name(J){return new B(J,this._newName(J))}value(J,z){var K;if(z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let H=this.toName(J),{prefix:D}=H,I=(K=z.key)!==null&&K!==void 0?K:z.ref,A=this._values[D];if(A){let Z=A.get(I);if(Z)return Z}else A=this._values[D]=new Map;A.set(I,H);let M=this._scope[D]||(this._scope[D]=[]),N=M.length;return M[N]=z.ref,H.setValue(z,{property:D,itemIndex:N}),H}getValue(J,z){let K=this._values[J];if(!K)return;return K.get(z)}scopeRefs(J,z=this._values){return this._reduceValues(z,(K)=>{if(K.scopePath===void 0)throw Error(`CodeGen: name "${K}" has no value`);return Q._`${J}${K.scopePath}`})}scopeCode(J=this._values,z,K){return this._reduceValues(J,(H)=>{if(H.value===void 0)throw Error(`CodeGen: name "${H}" has no value`);return H.value.code},z,K)}_reduceValues(J,z,K={},H){let D=Q.nil;for(let I in J){let A=J[I];if(!A)continue;let M=K[I]=K[I]||new Map;A.forEach((N)=>{if(M.has(N))return;M.set(N,Y.Started);let Z=z(N);if(Z){let V=this.opts.es5?W.varKinds.var:W.varKinds.const;D=Q._`${D}${V} ${N} = ${Z};${this.opts._n}`}else if(Z=H===null||H===void 0?void 0:H(N))D=Q._`${D}${Z}${this.opts._n}`;else throw new X(N);M.set(N,Y.Completed)})}return D}};W.ValueScope=L}),I0=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.or=W.and=W.not=W.CodeGen=W.operators=W.varKinds=W.ValueScopeName=W.ValueScope=W.Scope=W.Name=W.regexpCode=W.stringify=W.getProperty=W.nil=W.strConcat=W.str=W._=void 0;let Q=AX(),X=_Z();var Y=AX();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Y._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Y.str}}),Object.defineProperty(W,"strConcat",{enumerable:!0,get:function(){return Y.strConcat}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Y.nil}}),Object.defineProperty(W,"getProperty",{enumerable:!0,get:function(){return Y.getProperty}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Y.stringify}}),Object.defineProperty(W,"regexpCode",{enumerable:!0,get:function(){return Y.regexpCode}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Y.Name}});var G=_Z();Object.defineProperty(W,"Scope",{enumerable:!0,get:function(){return G.Scope}}),Object.defineProperty(W,"ValueScope",{enumerable:!0,get:function(){return G.ValueScope}}),Object.defineProperty(W,"ValueScopeName",{enumerable:!0,get:function(){return G.ValueScopeName}}),Object.defineProperty(W,"varKinds",{enumerable:!0,get:function(){return G.varKinds}}),W.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var B=class{optimizeNodes(){return this}optimizeNames(E,b){return this}},F=class extends B{constructor(E,b,C){super();this.varKind=E,this.name=b,this.rhs=C}render({es5:E,_n:b}){let C=E?X.varKinds.var:this.varKind,c=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${c};`+b}optimizeNames(E,b){if(!E[this.name.str])return;if(this.rhs)this.rhs=p(this.rhs,E,b);return this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},L=class extends B{constructor(E,b,C){super();this.lhs=E,this.rhs=b,this.sideEffects=C}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,b){if(this.lhs instanceof Q.Name&&!E[this.lhs.str]&&!this.sideEffects)return;return this.rhs=p(this.rhs,E,b),this}get names(){return d(this.lhs instanceof Q.Name?{}:{...this.lhs.names},this.rhs)}},J=class extends L{constructor(E,b,C,c){super(E,C,c);this.op=b}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}},z=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}},K=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}},H=class extends B{constructor(E){super();this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}},D=class extends B{constructor(E){super();this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,b){return this.code=p(this.code,E,b),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},I=class extends B{constructor(E=[]){super();this.nodes=E}render(E){return this.nodes.reduce((b,C)=>b+C.render(E),"")}optimizeNodes(){let{nodes:E}=this,b=E.length;while(b--){let C=E[b].optimizeNodes();if(Array.isArray(C))E.splice(b,1,...C);else if(C)E[b]=C;else E.splice(b,1)}return E.length>0?this:void 0}optimizeNames(E,b){let{nodes:C}=this,c=C.length;while(c--){let r=C[c];if(r.optimizeNames(E,b))continue;z0(E,r.names),C.splice(c,1)}return C.length>0?this:void 0}get names(){return this.nodes.reduce((E,b)=>h(E,b.names),{})}},A=class extends I{render(E){return"{"+E._n+super.render(E)+"}"+E._n}},M=class extends I{},N=class extends A{};N.kind="else";var Z=class E extends A{constructor(b,C){super(C);this.condition=b}render(b){let C=`if(${this.condition})`+super.render(b);if(this.else)C+="else "+this.else.render(b);return C}optimizeNodes(){super.optimizeNodes();let b=this.condition;if(b===!0)return this.nodes;let C=this.else;if(C){let c=C.optimizeNodes();C=this.else=Array.isArray(c)?new N(c):c}if(C){if(b===!1)return C instanceof E?C:C.nodes;if(this.nodes.length)return this;return new E(M0(b),C instanceof E?[C]:C.nodes)}if(b===!1||!this.nodes.length)return;return this}optimizeNames(b,C){var c;if(this.else=(c=this.else)===null||c===void 0?void 0:c.optimizeNames(b,C),!(super.optimizeNames(b,C)||this.else))return;return this.condition=p(this.condition,b,C),this}get names(){let b=super.names;if(d(b,this.condition),this.else)h(b,this.else.names);return b}};Z.kind="if";var V=class extends A{};V.kind="for";var U=class extends V{constructor(E){super();this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,b){if(!super.optimizeNames(E,b))return;return this.iteration=p(this.iteration,E,b),this}get names(){return h(super.names,this.iteration.names)}},j=class extends V{constructor(E,b,C,c){super();this.varKind=E,this.name=b,this.from=C,this.to=c}render(E){let b=E.es5?X.varKinds.var:this.varKind,{name:C,from:c,to:r}=this;return`for(${b} ${C}=${c}; ${C}<${r}; ${C}++)`+super.render(E)}get names(){return d(d(super.names,this.from),this.to)}},T=class extends V{constructor(E,b,C,c){super();this.loop=E,this.varKind=b,this.name=C,this.iterable=c}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,b){if(!super.optimizeNames(E,b))return;return this.iterable=p(this.iterable,E,b),this}get names(){return h(super.names,this.iterable.names)}},O=class extends A{constructor(E,b,C){super();this.name=E,this.args=b,this.async=C}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}};O.kind="func";var w=class extends I{render(E){return"return "+super.render(E)}};w.kind="return";var R=class extends A{render(E){let b="try"+super.render(E);if(this.catch)b+=this.catch.render(E);if(this.finally)b+=this.finally.render(E);return b}optimizeNodes(){var E,b;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(b=this.finally)===null||b===void 0||b.optimizeNodes(),this}optimizeNames(E,b){var C,c;return super.optimizeNames(E,b),(C=this.catch)===null||C===void 0||C.optimizeNames(E,b),(c=this.finally)===null||c===void 0||c.optimizeNames(E,b),this}get names(){let E=super.names;if(this.catch)h(E,this.catch.names);if(this.finally)h(E,this.finally.names);return E}},k=class extends A{constructor(E){super();this.error=E}render(E){return`catch(${this.error})`+super.render(E)}};k.kind="catch";var l=class extends A{render(E){return"finally"+super.render(E)}};l.kind="finally";var _=class{constructor(E,b={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...b,_n:b.lines?`
86
+ `:""},this._extScope=E,this._scope=new X.Scope({parent:E}),this._nodes=[new M]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,b){let C=this._extScope.value(E,b);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(E,b){return this._extScope.getValue(E,b)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,b,C,c){let r=this._scope.toName(b);if(C!==void 0&&c)this._constants[r.str]=C;return this._leafNode(new F(E,r,C)),r}const(E,b,C){return this._def(X.varKinds.const,E,b,C)}let(E,b,C){return this._def(X.varKinds.let,E,b,C)}var(E,b,C){return this._def(X.varKinds.var,E,b,C)}assign(E,b,C){return this._leafNode(new L(E,b,C))}add(E,b){return this._leafNode(new J(E,W.operators.ADD,b))}code(E){if(typeof E=="function")E();else if(E!==Q.nil)this._leafNode(new D(E));return this}object(...E){let b=["{"];for(let[C,c]of E){if(b.length>1)b.push(",");if(b.push(C),C!==c||this.opts.es5)b.push(":"),(0,Q.addCodeArg)(b,c)}return b.push("}"),new Q._Code(b)}if(E,b,C){if(this._blockNode(new Z(E)),b&&C)this.code(b).else().code(C).endIf();else if(b)this.code(b).endIf();else if(C)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new Z(E))}else(){return this._elseNode(new N)}endIf(){return this._endBlockNode(Z,N)}_for(E,b){if(this._blockNode(E),b)this.code(b).endFor();return this}for(E,b){return this._for(new U(E),b)}forRange(E,b,C,c,r=this.opts.es5?X.varKinds.var:X.varKinds.let){let L0=this._scope.toName(E);return this._for(new j(r,L0,b,C),()=>c(L0))}forOf(E,b,C,c=X.varKinds.const){let r=this._scope.toName(E);if(this.opts.es5){let L0=b instanceof Q.Name?b:this.var("_arr",b);return this.forRange("_i",0,Q._`${L0}.length`,(e)=>{this.var(r,Q._`${L0}[${e}]`),C(r)})}return this._for(new T("of",c,r,b),()=>C(r))}forIn(E,b,C,c=this.opts.es5?X.varKinds.var:X.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,Q._`Object.keys(${b})`,C);let r=this._scope.toName(E);return this._for(new T("in",c,r,b),()=>C(r))}endFor(){return this._endBlockNode(V)}label(E){return this._leafNode(new z(E))}break(E){return this._leafNode(new K(E))}return(E){let b=new w;if(this._blockNode(b),this.code(E),b.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(E,b,C){if(!b&&!C)throw Error('CodeGen: "try" without "catch" and "finally"');let c=new R;if(this._blockNode(c),this.code(E),b){let r=this.name("e");this._currNode=c.catch=new k(r),b(r)}if(C)this._currNode=c.finally=new l,this.code(C);return this._endBlockNode(k,l)}throw(E){return this._leafNode(new H(E))}block(E,b){if(this._blockStarts.push(this._nodes.length),E)this.code(E).endBlock(b);return this}endBlock(E){let b=this._blockStarts.pop();if(b===void 0)throw Error("CodeGen: not in self-balancing block");let C=this._nodes.length-b;if(C<0||E!==void 0&&C!==E)throw Error(`CodeGen: wrong number of nodes: ${C} vs ${E} expected`);return this._nodes.length=b,this}func(E,b=Q.nil,C,c){if(this._blockNode(new O(E,b,C)),c)this.code(c).endFunc();return this}endFunc(){return this._endBlockNode(O)}optimize(E=1){while(E-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,b){let C=this._currNode;if(C instanceof E||b&&C instanceof b)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${b?`${E.kind}/${b.kind}`:E.kind}"`)}_elseNode(E){let b=this._currNode;if(!(b instanceof Z))throw Error('CodeGen: "else" without "if"');return this._currNode=b.else=E,this}get _root(){return this._nodes[0]}get _currNode(){let E=this._nodes;return E[E.length-1]}set _currNode(E){let b=this._nodes;b[b.length-1]=E}};W.CodeGen=_;function h(E,b){for(let C in b)E[C]=(E[C]||0)+(b[C]||0);return E}function d(E,b){return b instanceof Q._CodeOrName?h(E,b.names):E}function p(E,b,C){if(E instanceof Q.Name)return c(E);if(!r(E))return E;return new Q._Code(E._items.reduce((L0,e)=>{if(e instanceof Q.Name)e=c(e);if(e instanceof Q._Code)L0.push(...e._items);else L0.push(e);return L0},[]));function c(L0){let e=C[L0.str];if(e===void 0||b[L0.str]!==1)return L0;return delete b[L0.str],e}function r(L0){return L0 instanceof Q._Code&&L0._items.some((e)=>e instanceof Q.Name&&b[e.str]===1&&C[e.str]!==void 0)}}function z0(E,b){for(let C in b)E[C]=(E[C]||0)-(b[C]||0)}function M0(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:Q._`!${u(E)}`}W.not=M0;let V0=v(W.operators.AND);function P0(...E){return E.reduce(V0)}W.and=P0;let Z0=v(W.operators.OR);function S(...E){return E.reduce(Z0)}W.or=S;function v(E){return(b,C)=>b===Q.nil?C:C===Q.nil?b:Q._`${u(b)} ${E} ${u(C)}`}function u(E){return E instanceof Q.Name?E:Q._`(${E})`}}),v0=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;let Q=I0(),X=AX();function Y(O){let w={};for(let R of O)w[R]=!0;return w}W.toHash=Y;function G(O,w){if(typeof w=="boolean")return w;if(Object.keys(w).length===0)return!0;return B(O,w),!F(w,O.self.RULES.all)}W.alwaysValidSchema=G;function B(O,w=O.schema){let{opts:R,self:k}=O;if(!R.strictSchema)return;if(typeof w==="boolean")return;let l=k.RULES.keywords;for(let _ in w)if(!l[_])T(O,`unknown keyword: "${_}"`)}W.checkUnknownRules=B;function F(O,w){if(typeof O=="boolean")return!O;for(let R in O)if(w[R])return!0;return!1}W.schemaHasRules=F;function L(O,w){if(typeof O=="boolean")return!O;for(let R in O)if(R!=="$ref"&&w.all[R])return!0;return!1}W.schemaHasRulesButRef=L;function J({topSchemaRef:O,schemaPath:w},R,k,l){if(!l){if(typeof R=="number"||typeof R=="boolean")return R;if(typeof R=="string")return Q._`${R}`}return Q._`${O}${w}${(0,Q.getProperty)(k)}`}W.schemaRefOrVal=J;function z(O){return D(decodeURIComponent(O))}W.unescapeFragment=z;function K(O){return encodeURIComponent(H(O))}W.escapeFragment=K;function H(O){if(typeof O=="number")return`${O}`;return O.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=H;function D(O){return O.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=D;function I(O,w){if(Array.isArray(O))for(let R of O)w(R);else w(O)}W.eachItem=I;function A({mergeNames:O,mergeToName:w,mergeValues:R,resultToName:k}){return(l,_,h,d)=>{let p=h===void 0?_:h instanceof Q.Name?(_ instanceof Q.Name?O(l,_,h):w(l,_,h),h):_ instanceof Q.Name?(w(l,h,_),_):R(_,h);return d===Q.Name&&!(p instanceof Q.Name)?k(l,p):p}}W.mergeEvaluated={props:A({mergeNames:(O,w,R)=>O.if(Q._`${R} !== true && ${w} !== undefined`,()=>{O.if(Q._`${w} === true`,()=>O.assign(R,!0),()=>O.assign(R,Q._`${R} || {}`).code(Q._`Object.assign(${R}, ${w})`))}),mergeToName:(O,w,R)=>O.if(Q._`${R} !== true`,()=>{if(w===!0)O.assign(R,!0);else O.assign(R,Q._`${R} || {}`),N(O,R,w)}),mergeValues:(O,w)=>O===!0?!0:{...O,...w},resultToName:M}),items:A({mergeNames:(O,w,R)=>O.if(Q._`${R} !== true && ${w} !== undefined`,()=>O.assign(R,Q._`${w} === true ? true : ${R} > ${w} ? ${R} : ${w}`)),mergeToName:(O,w,R)=>O.if(Q._`${R} !== true`,()=>O.assign(R,w===!0?!0:Q._`${R} > ${w} ? ${R} : ${w}`)),mergeValues:(O,w)=>O===!0?!0:Math.max(O,w),resultToName:(O,w)=>O.var("items",w)})};function M(O,w){if(w===!0)return O.var("props",!0);let R=O.var("props",Q._`{}`);if(w!==void 0)N(O,R,w);return R}W.evaluatedPropsToName=M;function N(O,w,R){Object.keys(R).forEach((k)=>O.assign(Q._`${w}${(0,Q.getProperty)(k)}`,!0))}W.setEvaluated=N;let Z={};function V(O,w){return O.scopeValue("func",{ref:w,code:Z[w.code]||(Z[w.code]=new X._Code(w.code))})}W.useFunc=V;var U;(function(O){O[O.Num=0]="Num",O[O.Str=1]="Str"})(U||(W.Type=U={}));function j(O,w,R){if(O instanceof Q.Name){let k=w===U.Num;return R?k?Q._`"[" + ${O} + "]"`:Q._`"['" + ${O} + "']"`:k?Q._`"/" + ${O}`:Q._`"/" + ${O}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return R?(0,Q.getProperty)(O).toString():"/"+H(O)}W.getErrorPath=j;function T(O,w,R=O.opts.strictSchema){if(!R)return;if(w=`strict mode: ${w}`,R===!0)throw Error(w);O.self.logger.warn(w)}W.checkStrictMode=T}),x6=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={data:new Q.Name("data"),valCxt:new Q.Name("valCxt"),instancePath:new Q.Name("instancePath"),parentData:new Q.Name("parentData"),parentDataProperty:new Q.Name("parentDataProperty"),rootData:new Q.Name("rootData"),dynamicAnchors:new Q.Name("dynamicAnchors"),vErrors:new Q.Name("vErrors"),errors:new Q.Name("errors"),this:new Q.Name("this"),self:new Q.Name("self"),scope:new Q.Name("scope"),json:new Q.Name("json"),jsonPos:new Q.Name("jsonPos"),jsonLen:new Q.Name("jsonLen"),jsonPart:new Q.Name("jsonPart")};W.default=X}),VX=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendErrors=W.resetErrorsCount=W.reportExtraError=W.reportError=W.keyword$DataError=W.keywordError=void 0;let Q=I0(),X=v0(),Y=x6();W.keywordError={message:({keyword:N})=>Q.str`must pass "${N}" keyword validation`},W.keyword$DataError={message:({keyword:N,schemaType:Z})=>Z?Q.str`"${N}" keyword must be ${Z} ($data)`:Q.str`"${N}" keyword is invalid ($data)`};function G(N,Z=W.keywordError,V,U){let{it:j}=N,{gen:T,compositeRule:O,allErrors:w}=j,R=H(N,Z,V);if(U!==null&&U!==void 0?U:O||w)J(T,R);else z(j,Q._`[${R}]`)}W.reportError=G;function B(N,Z=W.keywordError,V){let{it:U}=N,{gen:j,compositeRule:T,allErrors:O}=U;if(J(j,H(N,Z,V)),!(T||O))z(U,Y.default.vErrors)}W.reportExtraError=B;function F(N,Z){N.assign(Y.default.errors,Z),N.if(Q._`${Y.default.vErrors} !== null`,()=>N.if(Z,()=>N.assign(Q._`${Y.default.vErrors}.length`,Z),()=>N.assign(Y.default.vErrors,null)))}W.resetErrorsCount=F;function L({gen:N,keyword:Z,schemaValue:V,data:U,errsCount:j,it:T}){if(j===void 0)throw Error("ajv implementation error");let O=N.name("err");N.forRange("i",j,Y.default.errors,(w)=>{if(N.const(O,Q._`${Y.default.vErrors}[${w}]`),N.if(Q._`${O}.instancePath === undefined`,()=>N.assign(Q._`${O}.instancePath`,(0,Q.strConcat)(Y.default.instancePath,T.errorPath))),N.assign(Q._`${O}.schemaPath`,Q.str`${T.errSchemaPath}/${Z}`),T.opts.verbose)N.assign(Q._`${O}.schema`,V),N.assign(Q._`${O}.data`,U)})}W.extendErrors=L;function J(N,Z){let V=N.const("err",Z);N.if(Q._`${Y.default.vErrors} === null`,()=>N.assign(Y.default.vErrors,Q._`[${V}]`),Q._`${Y.default.vErrors}.push(${V})`),N.code(Q._`${Y.default.errors}++`)}function z(N,Z){let{gen:V,validateName:U,schemaEnv:j}=N;if(j.$async)V.throw(Q._`new ${N.ValidationError}(${Z})`);else V.assign(Q._`${U}.errors`,Z),V.return(!1)}let K={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function H(N,Z,V){let{createErrors:U}=N.it;if(U===!1)return Q._`{}`;return D(N,Z,V)}function D(N,Z,V={}){let{gen:U,it:j}=N,T=[I(j,V),A(N,V)];return M(N,Z,T),U.object(...T)}function I({errorPath:N},{instancePath:Z}){let V=Z?Q.str`${N}${(0,X.getErrorPath)(Z,X.Type.Str)}`:N;return[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,V)]}function A({keyword:N,it:{errSchemaPath:Z}},{schemaPath:V,parentSchema:U}){let j=U?Z:Q.str`${Z}/${N}`;if(V)j=Q.str`${j}${(0,X.getErrorPath)(V,X.Type.Str)}`;return[K.schemaPath,j]}function M(N,{params:Z,message:V},U){let{keyword:j,data:T,schemaValue:O,it:w}=N,{opts:R,propertyName:k,topSchemaRef:l,schemaPath:_}=w;if(U.push([K.keyword,j],[K.params,typeof Z=="function"?Z(N):Z||Q._`{}`]),R.messages)U.push([K.message,typeof V=="function"?V(N):V]);if(R.verbose)U.push([K.schema,O],[K.parentSchema,Q._`${l}${_}`],[Y.default.data,T]);if(k)U.push([K.propertyName,k])}}),yD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.boolOrEmptySchema=W.topBoolOrEmptySchema=void 0;let Q=VX(),X=I0(),Y=x6(),G={message:"boolean schema is false"};function B(J){let{gen:z,schema:K,validateName:H}=J;if(K===!1)L(J,!1);else if(typeof K=="object"&&K.$async===!0)z.return(Y.default.data);else z.assign(X._`${H}.errors`,null),z.return(!0)}W.topBoolOrEmptySchema=B;function F(J,z){let{gen:K,schema:H}=J;if(H===!1)K.var(z,!1),L(J);else K.var(z,!0)}W.boolOrEmptySchema=F;function L(J,z){let{gen:K,data:H}=J,D={gen:K,keyword:"false schema",data:H,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:J};(0,Q.reportError)(D,G,void 0,z)}}),gZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getRules=W.isJSONType=void 0;let Q=new Set(["string","number","integer","boolean","null","object","array"]);function X(G){return typeof G=="string"&&Q.has(G)}W.isJSONType=X;function Y(){let G={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...G,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},G.number,G.string,G.array,G.object],post:{rules:[]},all:{},keywords:{}}}W.getRules=Y}),fZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.shouldUseRule=W.shouldUseGroup=W.schemaHasRulesForType=void 0;function Q({schema:G,self:B},F){let L=B.RULES.types[F];return L&&L!==!0&&X(G,L)}W.schemaHasRulesForType=Q;function X(G,B){return B.rules.some((F)=>Y(G,F))}W.shouldUseGroup=X;function Y(G,B){var F;return G[B.keyword]!==void 0||((F=B.definition.implements)===null||F===void 0?void 0:F.some((L)=>G[L]!==void 0))}W.shouldUseRule=Y}),NX=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.reportTypeError=W.checkDataTypes=W.checkDataType=W.coerceAndCheckDataType=W.getJSONTypes=W.getSchemaTypes=W.DataType=void 0;let Q=gZ(),X=fZ(),Y=VX(),G=I0(),B=v0();var F;(function(U){U[U.Correct=0]="Correct",U[U.Wrong=1]="Wrong"})(F||(W.DataType=F={}));function L(U){let j=J(U.type);if(j.includes("null")){if(U.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!j.length&&U.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(U.nullable===!0)j.push("null")}return j}W.getSchemaTypes=L;function J(U){let j=Array.isArray(U)?U:U?[U]:[];if(j.every(Q.isJSONType))return j;throw Error("type must be JSONType or JSONType[]: "+j.join(","))}W.getJSONTypes=J;function z(U,j){let{gen:T,data:O,opts:w}=U,R=H(j,w.coerceTypes),k=j.length>0&&!(R.length===0&&j.length===1&&(0,X.schemaHasRulesForType)(U,j[0]));if(k){let l=M(j,O,w.strictNumbers,F.Wrong);T.if(l,()=>{if(R.length)D(U,j,R);else Z(U)})}return k}W.coerceAndCheckDataType=z;let K=new Set(["string","number","integer","boolean","null"]);function H(U,j){return j?U.filter((T)=>K.has(T)||j==="array"&&T==="array"):[]}function D(U,j,T){let{gen:O,data:w,opts:R}=U,k=O.let("dataType",G._`typeof ${w}`),l=O.let("coerced",G._`undefined`);if(R.coerceTypes==="array")O.if(G._`${k} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>O.assign(w,G._`${w}[0]`).assign(k,G._`typeof ${w}`).if(M(j,w,R.strictNumbers),()=>O.assign(l,w)));O.if(G._`${l} !== undefined`);for(let h of T)if(K.has(h)||h==="array"&&R.coerceTypes==="array")_(h);O.else(),Z(U),O.endIf(),O.if(G._`${l} !== undefined`,()=>{O.assign(w,l),I(U,l)});function _(h){switch(h){case"string":O.elseIf(G._`${k} == "number" || ${k} == "boolean"`).assign(l,G._`"" + ${w}`).elseIf(G._`${w} === null`).assign(l,G._`""`);return;case"number":O.elseIf(G._`${k} == "boolean" || ${w} === null
87
+ || (${k} == "string" && ${w} && ${w} == +${w})`).assign(l,G._`+${w}`);return;case"integer":O.elseIf(G._`${k} === "boolean" || ${w} === null
88
+ || (${k} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(l,G._`+${w}`);return;case"boolean":O.elseIf(G._`${w} === "false" || ${w} === 0 || ${w} === null`).assign(l,!1).elseIf(G._`${w} === "true" || ${w} === 1`).assign(l,!0);return;case"null":O.elseIf(G._`${w} === "" || ${w} === 0 || ${w} === false`),O.assign(l,null);return;case"array":O.elseIf(G._`${k} === "string" || ${k} === "number"
89
+ || ${k} === "boolean" || ${w} === null`).assign(l,G._`[${w}]`)}}}function I({gen:U,parentData:j,parentDataProperty:T},O){U.if(G._`${j} !== undefined`,()=>U.assign(G._`${j}[${T}]`,O))}function A(U,j,T,O=F.Correct){let w=O===F.Correct?G.operators.EQ:G.operators.NEQ,R;switch(U){case"null":return G._`${j} ${w} null`;case"array":R=G._`Array.isArray(${j})`;break;case"object":R=G._`${j} && typeof ${j} == "object" && !Array.isArray(${j})`;break;case"integer":R=k(G._`!(${j} % 1) && !isNaN(${j})`);break;case"number":R=k();break;default:return G._`typeof ${j} ${w} ${U}`}return O===F.Correct?R:(0,G.not)(R);function k(l=G.nil){return(0,G.and)(G._`typeof ${j} == "number"`,l,T?G._`isFinite(${j})`:G.nil)}}W.checkDataType=A;function M(U,j,T,O){if(U.length===1)return A(U[0],j,T,O);let w,R=(0,B.toHash)(U);if(R.array&&R.object){let k=G._`typeof ${j} != "object"`;w=R.null?k:G._`!${j} || ${k}`,delete R.null,delete R.array,delete R.object}else w=G.nil;if(R.number)delete R.integer;for(let k in R)w=(0,G.and)(w,A(k,j,T,O));return w}W.checkDataTypes=M;let N={message:({schema:U})=>`must be ${U}`,params:({schema:U,schemaValue:j})=>typeof U=="string"?G._`{type: ${U}}`:G._`{type: ${j}}`};function Z(U){let j=V(U);(0,Y.reportError)(j,N)}W.reportTypeError=Z;function V(U){let{gen:j,data:T,schema:O}=U,w=(0,B.schemaRefOrVal)(U,O,"type");return{gen:j,keyword:"type",data:T,schema:O.type,schemaCode:w,schemaValue:w,parentSchema:O,params:{},it:U}}}),_D=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.assignDefaults=void 0;let Q=I0(),X=v0();function Y(B,F){let{properties:L,items:J}=B.schema;if(F==="object"&&L)for(let z in L)G(B,z,L[z].default);else if(F==="array"&&Array.isArray(J))J.forEach((z,K)=>G(B,K,z.default))}W.assignDefaults=Y;function G(B,F,L){let{gen:J,compositeRule:z,data:K,opts:H}=B;if(L===void 0)return;let D=Q._`${K}${(0,Q.getProperty)(F)}`;if(z){(0,X.checkStrictMode)(B,`default is ignored for: ${D}`);return}let I=Q._`${D} === undefined`;if(H.useDefaults==="empty")I=Q._`${I} || ${D} === null || ${D} === ""`;J.if(I,Q._`${D} = ${(0,Q.stringify)(L)}`)}}),h6=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateUnion=W.validateArray=W.usePattern=W.callValidateCode=W.schemaProperties=W.allSchemaProperties=W.noPropertyInData=W.propertyInData=W.isOwnProperty=W.hasPropFunc=W.reportMissingProp=W.checkMissingProp=W.checkReportMissingProp=void 0;let Q=I0(),X=v0(),Y=x6(),G=v0();function B(U,j){let{gen:T,data:O,it:w}=U;T.if(H(T,O,j,w.opts.ownProperties),()=>{U.setParams({missingProperty:Q._`${j}`},!0),U.error()})}W.checkReportMissingProp=B;function F({gen:U,data:j,it:{opts:T}},O,w){return(0,Q.or)(...O.map((R)=>(0,Q.and)(H(U,j,R,T.ownProperties),Q._`${w} = ${R}`)))}W.checkMissingProp=F;function L(U,j){U.setParams({missingProperty:j},!0),U.error()}W.reportMissingProp=L;function J(U){return U.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Q._`Object.prototype.hasOwnProperty`})}W.hasPropFunc=J;function z(U,j,T){return Q._`${J(U)}.call(${j}, ${T})`}W.isOwnProperty=z;function K(U,j,T,O){let w=Q._`${j}${(0,Q.getProperty)(T)} !== undefined`;return O?Q._`${w} && ${z(U,j,T)}`:w}W.propertyInData=K;function H(U,j,T,O){let w=Q._`${j}${(0,Q.getProperty)(T)} === undefined`;return O?(0,Q.or)(w,(0,Q.not)(z(U,j,T))):w}W.noPropertyInData=H;function D(U){return U?Object.keys(U).filter((j)=>j!=="__proto__"):[]}W.allSchemaProperties=D;function I(U,j){return D(j).filter((T)=>!(0,X.alwaysValidSchema)(U,j[T]))}W.schemaProperties=I;function A({schemaCode:U,data:j,it:{gen:T,topSchemaRef:O,schemaPath:w,errorPath:R},it:k},l,_,h){let d=h?Q._`${U}, ${j}, ${O}${w}`:j,p=[[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,R)],[Y.default.parentData,k.parentData],[Y.default.parentDataProperty,k.parentDataProperty],[Y.default.rootData,Y.default.rootData]];if(k.opts.dynamicRef)p.push([Y.default.dynamicAnchors,Y.default.dynamicAnchors]);let z0=Q._`${d}, ${T.object(...p)}`;return _!==Q.nil?Q._`${l}.call(${_}, ${z0})`:Q._`${l}(${z0})`}W.callValidateCode=A;let M=Q._`new RegExp`;function N({gen:U,it:{opts:j}},T){let O=j.unicodeRegExp?"u":"",{regExp:w}=j.code,R=w(T,O);return U.scopeValue("pattern",{key:R.toString(),ref:R,code:Q._`${w.code==="new RegExp"?M:(0,G.useFunc)(U,w)}(${T}, ${O})`})}W.usePattern=N;function Z(U){let{gen:j,data:T,keyword:O,it:w}=U,R=j.name("valid");if(w.allErrors){let l=j.let("valid",!0);return k(()=>j.assign(l,!1)),l}return j.var(R,!0),k(()=>j.break()),R;function k(l){let _=j.const("len",Q._`${T}.length`);j.forRange("i",0,_,(h)=>{U.subschema({keyword:O,dataProp:h,dataPropType:X.Type.Num},R),j.if((0,Q.not)(R),l)})}}W.validateArray=Z;function V(U){let{gen:j,schema:T,keyword:O,it:w}=U;if(!Array.isArray(T))throw Error("ajv implementation error");if(T.some((l)=>(0,X.alwaysValidSchema)(w,l))&&!w.opts.unevaluated)return;let R=j.let("valid",!1),k=j.name("_valid");j.block(()=>T.forEach((l,_)=>{let h=U.subschema({keyword:O,schemaProp:_,compositeRule:!0},k);if(j.assign(R,Q._`${R} || ${k}`),!U.mergeValidEvaluated(h,k))j.if((0,Q.not)(R))})),U.result(R,()=>U.reset(),()=>U.error(!0))}W.validateUnion=V}),gD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateKeywordUsage=W.validSchemaType=W.funcKeywordCode=W.macroKeywordCode=void 0;let Q=I0(),X=x6(),Y=h6(),G=VX();function B(I,A){let{gen:M,keyword:N,schema:Z,parentSchema:V,it:U}=I,j=A.macro.call(U.self,Z,V,U),T=K(M,N,j);if(U.opts.validateSchema!==!1)U.self.validateSchema(j,!0);let O=M.name("valid");I.subschema({schema:j,schemaPath:Q.nil,errSchemaPath:`${U.errSchemaPath}/${N}`,topSchemaRef:T,compositeRule:!0},O),I.pass(O,()=>I.error(!0))}W.macroKeywordCode=B;function F(I,A){var M;let{gen:N,keyword:Z,schema:V,parentSchema:U,$data:j,it:T}=I;z(T,A);let O=K(N,Z,!j&&A.compile?A.compile.call(T.self,V,U,T):A.validate),w=N.let("valid");I.block$data(w,R),I.ok((M=A.valid)!==null&&M!==void 0?M:w);function R(){if(A.errors===!1){if(_(),A.modifying)L(I);h(()=>I.error())}else{let d=A.async?k():l();if(A.modifying)L(I);h(()=>J(I,d))}}function k(){let d=N.let("ruleErrs",null);return N.try(()=>_(Q._`await `),(p)=>N.assign(w,!1).if(Q._`${p} instanceof ${T.ValidationError}`,()=>N.assign(d,Q._`${p}.errors`),()=>N.throw(p))),d}function l(){let d=Q._`${O}.errors`;return N.assign(d,null),_(Q.nil),d}function _(d=A.async?Q._`await `:Q.nil){let p=T.opts.passContext?X.default.this:X.default.self,z0=!(("compile"in A)&&!j||A.schema===!1);N.assign(w,Q._`${d}${(0,Y.callValidateCode)(I,O,p,z0)}`,A.modifying)}function h(d){var p;N.if((0,Q.not)((p=A.valid)!==null&&p!==void 0?p:w),d)}}W.funcKeywordCode=F;function L(I){let{gen:A,data:M,it:N}=I;A.if(N.parentData,()=>A.assign(M,Q._`${N.parentData}[${N.parentDataProperty}]`))}function J(I,A){let{gen:M}=I;M.if(Q._`Array.isArray(${A})`,()=>{M.assign(X.default.vErrors,Q._`${X.default.vErrors} === null ? ${A} : ${X.default.vErrors}.concat(${A})`).assign(X.default.errors,Q._`${X.default.vErrors}.length`),(0,G.extendErrors)(I)},()=>I.error())}function z({schemaEnv:I},A){if(A.async&&!I.$async)throw Error("async keyword in sync schema")}function K(I,A,M){if(M===void 0)throw Error(`keyword "${A}" failed to compile`);return I.scopeValue("keyword",typeof M=="function"?{ref:M}:{ref:M,code:(0,Q.stringify)(M)})}function H(I,A,M=!1){return!A.length||A.some((N)=>N==="array"?Array.isArray(I):N==="object"?I&&typeof I=="object"&&!Array.isArray(I):typeof I==N||M&&typeof I>"u")}W.validSchemaType=H;function D({schema:I,opts:A,self:M,errSchemaPath:N},Z,V){if(Array.isArray(Z.keyword)?!Z.keyword.includes(V):Z.keyword!==V)throw Error("ajv implementation error");let U=Z.dependencies;if(U===null||U===void 0?void 0:U.some((j)=>!Object.prototype.hasOwnProperty.call(I,j)))throw Error(`parent schema must have dependencies of ${V}: ${U.join(",")}`);if(Z.validateSchema){if(!Z.validateSchema(I[V])){let j=`keyword "${V}" value is invalid at path "${N}": `+M.errorsText(Z.validateSchema.errors);if(A.validateSchema==="log")M.logger.error(j);else throw Error(j)}}}W.validateKeywordUsage=D}),fD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendSubschemaMode=W.extendSubschemaData=W.getSubschema=void 0;let Q=I0(),X=v0();function Y(F,{keyword:L,schemaProp:J,schema:z,schemaPath:K,errSchemaPath:H,topSchemaRef:D}){if(L!==void 0&&z!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(L!==void 0){let I=F.schema[L];return J===void 0?{schema:I,schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}`,errSchemaPath:`${F.errSchemaPath}/${L}`}:{schema:I[J],schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}${(0,Q.getProperty)(J)}`,errSchemaPath:`${F.errSchemaPath}/${L}/${(0,X.escapeFragment)(J)}`}}if(z!==void 0){if(K===void 0||H===void 0||D===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:z,schemaPath:K,topSchemaRef:D,errSchemaPath:H}}throw Error('either "keyword" or "schema" must be passed')}W.getSubschema=Y;function G(F,L,{dataProp:J,dataPropType:z,data:K,dataTypes:H,propertyName:D}){if(K!==void 0&&J!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:I}=L;if(J!==void 0){let{errorPath:M,dataPathArr:N,opts:Z}=L;A(I.let("data",Q._`${L.data}${(0,Q.getProperty)(J)}`,!0)),F.errorPath=Q.str`${M}${(0,X.getErrorPath)(J,z,Z.jsPropertySyntax)}`,F.parentDataProperty=Q._`${J}`,F.dataPathArr=[...N,F.parentDataProperty]}if(K!==void 0){if(A(K instanceof Q.Name?K:I.let("data",K,!0)),D!==void 0)F.propertyName=D}if(H)F.dataTypes=H;function A(M){F.data=M,F.dataLevel=L.dataLevel+1,F.dataTypes=[],L.definedProperties=new Set,F.parentData=L.data,F.dataNames=[...L.dataNames,M]}}W.extendSubschemaData=G;function B(F,{jtdDiscriminator:L,jtdMetadata:J,compositeRule:z,createErrors:K,allErrors:H}){if(z!==void 0)F.compositeRule=z;if(K!==void 0)F.createErrors=K;if(H!==void 0)F.allErrors=H;F.jtdDiscriminator=L,F.jtdMetadata=J}W.extendSubschemaMode=B}),xZ=Y0((W,Q)=>{Q.exports=function X(Y,G){if(Y===G)return!0;if(Y&&G&&typeof Y=="object"&&typeof G=="object"){if(Y.constructor!==G.constructor)return!1;var B,F,L;if(Array.isArray(Y)){if(B=Y.length,B!=G.length)return!1;for(F=B;F--!==0;)if(!X(Y[F],G[F]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===G.source&&Y.flags===G.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===G.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===G.toString();if(L=Object.keys(Y),B=L.length,B!==Object.keys(G).length)return!1;for(F=B;F--!==0;)if(!Object.prototype.hasOwnProperty.call(G,L[F]))return!1;for(F=B;F--!==0;){var J=L[F];if(!X(Y[J],G[J]))return!1}return!0}return Y!==Y&&G!==G}}),xD=Y0((W,Q)=>{var X=Q.exports=function(B,F,L){if(typeof F=="function")L=F,F={};L=F.cb||L;var J=typeof L=="function"?L:L.pre||function(){},z=L.post||function(){};Y(F,J,z,B,"",B)};X.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},X.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},X.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},X.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Y(B,F,L,J,z,K,H,D,I,A){if(J&&typeof J=="object"&&!Array.isArray(J)){F(J,z,K,H,D,I,A);for(var M in J){var N=J[M];if(Array.isArray(N)){if(M in X.arrayKeywords)for(var Z=0;Z<N.length;Z++)Y(B,F,L,N[Z],z+"/"+M+"/"+Z,K,z,M,J,Z)}else if(M in X.propsKeywords){if(N&&typeof N=="object")for(var V in N)Y(B,F,L,N[V],z+"/"+M+"/"+G(V),K,z,M,J,V)}else if(M in X.keywords||B.allKeys&&!(M in X.skipKeywords))Y(B,F,L,N,z+"/"+M,K,z,M,J)}L(J,z,K,H,D,I,A)}}function G(B){return B.replace(/~/g,"~0").replace(/\//g,"~1")}}),wX=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getSchemaRefs=W.resolveUrl=W.normalizeId=W._getFullPath=W.getFullPath=W.inlineRef=void 0;let Q=v0(),X=xZ(),Y=xD(),G=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function B(N,Z=!0){if(typeof N=="boolean")return!0;if(Z===!0)return!L(N);if(!Z)return!1;return J(N)<=Z}W.inlineRef=B;let F=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function L(N){for(let Z in N){if(F.has(Z))return!0;let V=N[Z];if(Array.isArray(V)&&V.some(L))return!0;if(typeof V=="object"&&L(V))return!0}return!1}function J(N){let Z=0;for(let V in N){if(V==="$ref")return 1/0;if(Z++,G.has(V))continue;if(typeof N[V]=="object")(0,Q.eachItem)(N[V],(U)=>Z+=J(U));if(Z===1/0)return 1/0}return Z}function z(N,Z="",V){if(V!==!1)Z=D(Z);return K(N,N.parse(Z))}W.getFullPath=z;function K(N,Z){return N.serialize(Z).split("#")[0]+"#"}W._getFullPath=K;let H=/#\/?$/;function D(N){return N?N.replace(H,""):""}W.normalizeId=D;function I(N,Z,V){return V=D(V),N.resolve(Z,V)}W.resolveUrl=I;let A=/^[a-z_][-a-z0-9._]*$/i;function M(N,Z){if(typeof N=="boolean")return{};let{schemaId:V,uriResolver:U}=this.opts,j=D(N[V]||Z),T={"":j},O=z(U,j,!1),w={},R=new Set;return Y(N,{allKeys:!0},(_,h,d,p)=>{if(p===void 0)return;let z0=O+h,M0=T[p];if(typeof _[V]=="string")M0=V0.call(this,_[V]);P0.call(this,_.$anchor),P0.call(this,_.$dynamicAnchor),T[h]=M0;function V0(Z0){let S=this.opts.uriResolver.resolve;if(Z0=D(M0?S(M0,Z0):Z0),R.has(Z0))throw l(Z0);R.add(Z0);let v=this.refs[Z0];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")k(_,v.schema,Z0);else if(Z0!==D(z0))if(Z0[0]==="#")k(_,w[Z0],Z0),w[Z0]=_;else this.refs[Z0]=z0;return Z0}function P0(Z0){if(typeof Z0=="string"){if(!A.test(Z0))throw Error(`invalid anchor "${Z0}"`);V0.call(this,`#${Z0}`)}}}),w;function k(_,h,d){if(h!==void 0&&!X(_,h))throw l(d)}function l(_){return Error(`reference "${_}" resolves to more than one schema`)}}W.getSchemaRefs=M}),sW=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getData=W.KeywordCxt=W.validateFunctionCode=void 0;let Q=yD(),X=NX(),Y=fZ(),G=NX(),B=_D(),F=gD(),L=fD(),J=I0(),z=x6(),K=wX(),H=v0(),D=VX();function I(P){if(O(P)){if(R(P),T(P)){Z(P);return}}A(P,()=>(0,Q.topBoolOrEmptySchema)(P))}W.validateFunctionCode=I;function A({gen:P,validateName:y,schema:x,schemaEnv:s,opts:t},F0){if(t.code.es5)P.func(y,J._`${z.default.data}, ${z.default.valCxt}`,s.$async,()=>{P.code(J._`"use strict"; ${U(x,t)}`),N(P,t),P.code(F0)});else P.func(y,J._`${z.default.data}, ${M(t)}`,s.$async,()=>P.code(U(x,t)).code(F0))}function M(P){return J._`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${P.dynamicRef?J._`, ${z.default.dynamicAnchors}={}`:J.nil}}={}`}function N(P,y){P.if(z.default.valCxt,()=>{if(P.var(z.default.instancePath,J._`${z.default.valCxt}.${z.default.instancePath}`),P.var(z.default.parentData,J._`${z.default.valCxt}.${z.default.parentData}`),P.var(z.default.parentDataProperty,J._`${z.default.valCxt}.${z.default.parentDataProperty}`),P.var(z.default.rootData,J._`${z.default.valCxt}.${z.default.rootData}`),y.dynamicRef)P.var(z.default.dynamicAnchors,J._`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{if(P.var(z.default.instancePath,J._`""`),P.var(z.default.parentData,J._`undefined`),P.var(z.default.parentDataProperty,J._`undefined`),P.var(z.default.rootData,z.default.data),y.dynamicRef)P.var(z.default.dynamicAnchors,J._`{}`)})}function Z(P){let{schema:y,opts:x,gen:s}=P;A(P,()=>{if(x.$comment&&y.$comment)p(P);if(_(P),s.let(z.default.vErrors,null),s.let(z.default.errors,0),x.unevaluated)V(P);k(P),z0(P)})}function V(P){let{gen:y,validateName:x}=P;P.evaluated=y.const("evaluated",J._`${x}.evaluated`),y.if(J._`${P.evaluated}.dynamicProps`,()=>y.assign(J._`${P.evaluated}.props`,J._`undefined`)),y.if(J._`${P.evaluated}.dynamicItems`,()=>y.assign(J._`${P.evaluated}.items`,J._`undefined`))}function U(P,y){let x=typeof P=="object"&&P[y.schemaId];return x&&(y.code.source||y.code.process)?J._`/*# sourceURL=${x} */`:J.nil}function j(P,y){if(O(P)){if(R(P),T(P)){w(P,y);return}}(0,Q.boolOrEmptySchema)(P,y)}function T({schema:P,self:y}){if(typeof P=="boolean")return!P;for(let x in P)if(y.RULES.all[x])return!0;return!1}function O(P){return typeof P.schema!="boolean"}function w(P,y){let{schema:x,gen:s,opts:t}=P;if(t.$comment&&x.$comment)p(P);h(P),d(P);let F0=s.const("_errs",z.default.errors);k(P,F0),s.var(y,J._`${F0} === ${z.default.errors}`)}function R(P){(0,H.checkUnknownRules)(P),l(P)}function k(P,y){if(P.opts.jtd)return V0(P,[],!1,y);let x=(0,X.getSchemaTypes)(P.schema);V0(P,x,!(0,X.coerceAndCheckDataType)(P,x),y)}function l(P){let{schema:y,errSchemaPath:x,opts:s,self:t}=P;if(y.$ref&&s.ignoreKeywordsWithRef&&(0,H.schemaHasRulesButRef)(y,t.RULES))t.logger.warn(`$ref: keywords ignored in schema at path "${x}"`)}function _(P){let{schema:y,opts:x}=P;if(y.default!==void 0&&x.useDefaults&&x.strictSchema)(0,H.checkStrictMode)(P,"default is ignored in the schema root")}function h(P){let y=P.schema[P.opts.schemaId];if(y)P.baseId=(0,K.resolveUrl)(P.opts.uriResolver,P.baseId,y)}function d(P){if(P.schema.$async&&!P.schemaEnv.$async)throw Error("async schema in sync schema")}function p({gen:P,schemaEnv:y,schema:x,errSchemaPath:s,opts:t}){let F0=x.$comment;if(t.$comment===!0)P.code(J._`${z.default.self}.logger.log(${F0})`);else if(typeof t.$comment=="function"){let T0=J.str`${s}/$comment`,q0=P.scopeValue("root",{ref:y.root});P.code(J._`${z.default.self}.opts.$comment(${F0}, ${T0}, ${q0}.schema)`)}}function z0(P){let{gen:y,schemaEnv:x,validateName:s,ValidationError:t,opts:F0}=P;if(x.$async)y.if(J._`${z.default.errors} === 0`,()=>y.return(z.default.data),()=>y.throw(J._`new ${t}(${z.default.vErrors})`));else{if(y.assign(J._`${s}.errors`,z.default.vErrors),F0.unevaluated)M0(P);y.return(J._`${z.default.errors} === 0`)}}function M0({gen:P,evaluated:y,props:x,items:s}){if(x instanceof J.Name)P.assign(J._`${y}.props`,x);if(s instanceof J.Name)P.assign(J._`${y}.items`,s)}function V0(P,y,x,s){let{gen:t,schema:F0,data:T0,allErrors:q0,opts:g0,self:b0}=P,{RULES:j0}=b0;if(F0.$ref&&(g0.ignoreKeywordsWithRef||!(0,H.schemaHasRulesButRef)(F0,j0))){t.block(()=>L0(P,"$ref",j0.all.$ref.definition));return}if(!g0.jtd)Z0(P,y);t.block(()=>{for(let C0 of j0.rules)r0(C0);r0(j0.post)});function r0(C0){if(!(0,Y.shouldUseGroup)(F0,C0))return;if(C0.type){if(t.if((0,G.checkDataType)(C0.type,T0,g0.strictNumbers)),P0(P,C0),y.length===1&&y[0]===C0.type&&x)t.else(),(0,G.reportTypeError)(P);t.endIf()}else P0(P,C0);if(!q0)t.if(J._`${z.default.errors} === ${s||0}`)}}function P0(P,y){let{gen:x,schema:s,opts:{useDefaults:t}}=P;if(t)(0,B.assignDefaults)(P,y.type);x.block(()=>{for(let F0 of y.rules)if((0,Y.shouldUseRule)(s,F0))L0(P,F0.keyword,F0.definition,y.type)})}function Z0(P,y){if(P.schemaEnv.meta||!P.opts.strictTypes)return;if(S(P,y),!P.opts.allowUnionTypes)v(P,y);u(P,P.dataTypes)}function S(P,y){if(!y.length)return;if(!P.dataTypes.length){P.dataTypes=y;return}y.forEach((x)=>{if(!b(P.dataTypes,x))c(P,`type "${x}" not allowed by context "${P.dataTypes.join(",")}"`)}),C(P,y)}function v(P,y){if(y.length>1&&!(y.length===2&&y.includes("null")))c(P,"use allowUnionTypes to allow union type keyword")}function u(P,y){let x=P.self.RULES.all;for(let s in x){let t=x[s];if(typeof t=="object"&&(0,Y.shouldUseRule)(P.schema,t)){let{type:F0}=t.definition;if(F0.length&&!F0.some((T0)=>E(y,T0)))c(P,`missing type "${F0.join(",")}" for keyword "${s}"`)}}}function E(P,y){return P.includes(y)||y==="number"&&P.includes("integer")}function b(P,y){return P.includes(y)||y==="integer"&&P.includes("number")}function C(P,y){let x=[];for(let s of P.dataTypes)if(b(y,s))x.push(s);else if(y.includes("integer")&&s==="number")x.push("integer");P.dataTypes=x}function c(P,y){let x=P.schemaEnv.baseId+P.errSchemaPath;y+=` at "${x}" (strictTypes)`,(0,H.checkStrictMode)(P,y,P.opts.strictTypes)}var r=class{constructor(P,y,x){if((0,F.validateKeywordUsage)(P,y,x),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=x,this.data=P.data,this.schema=P.schema[x],this.$data=y.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,H.schemaRefOrVal)(P,this.schema,x,this.$data),this.schemaType=y.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=y,this.$data)this.schemaCode=P.gen.const("vSchema",h0(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,F.validSchemaType)(this.schema,y.schemaType,y.allowUndefined))throw Error(`${x} value must be ${JSON.stringify(y.schemaType)}`);if("code"in y?y.trackErrors:y.errors!==!1)this.errsCount=P.gen.const("_errs",z.default.errors)}result(P,y,x){this.failResult((0,J.not)(P),y,x)}failResult(P,y,x){if(this.gen.if(P),x)x();else this.error();if(y){if(this.gen.else(),y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(P,y){this.failResult((0,J.not)(P),void 0,y)}fail(P){if(P===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(P),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);let{schemaCode:y}=this;this.fail(J._`${y} !== undefined && (${(0,J.or)(this.invalid$data(),P)})`)}error(P,y,x){if(y){this.setParams(y),this._error(P,x),this.setParams({});return}this._error(P,x)}_error(P,y){(P?D.reportExtraError:D.reportError)(this,this.def.error,y)}$dataError(){(0,D.reportError)(this,this.def.$dataError||D.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,D.resetErrorsCount)(this.gen,this.errsCount)}ok(P){if(!this.allErrors)this.gen.if(P)}setParams(P,y){if(y)Object.assign(this.params,P);else this.params=P}block$data(P,y,x=J.nil){this.gen.block(()=>{this.check$data(P,x),y()})}check$data(P=J.nil,y=J.nil){if(!this.$data)return;let{gen:x,schemaCode:s,schemaType:t,def:F0}=this;if(x.if((0,J.or)(J._`${s} === undefined`,y)),P!==J.nil)x.assign(P,!0);if(t.length||F0.validateSchema){if(x.elseIf(this.invalid$data()),this.$dataError(),P!==J.nil)x.assign(P,!1)}x.else()}invalid$data(){let{gen:P,schemaCode:y,schemaType:x,def:s,it:t}=this;return(0,J.or)(F0(),T0());function F0(){if(x.length){if(!(y instanceof J.Name))throw Error("ajv implementation error");let q0=Array.isArray(x)?x:[x];return J._`${(0,G.checkDataTypes)(q0,y,t.opts.strictNumbers,G.DataType.Wrong)}`}return J.nil}function T0(){if(s.validateSchema){let q0=P.scopeValue("validate$data",{ref:s.validateSchema});return J._`!${q0}(${y})`}return J.nil}}subschema(P,y){let x=(0,L.getSubschema)(this.it,P);(0,L.extendSubschemaData)(x,this.it,P),(0,L.extendSubschemaMode)(x,P);let s={...this.it,...x,items:void 0,props:void 0};return j(s,y),s}mergeEvaluated(P,y){let{it:x,gen:s}=this;if(!x.opts.unevaluated)return;if(x.props!==!0&&P.props!==void 0)x.props=H.mergeEvaluated.props(s,P.props,x.props,y);if(x.items!==!0&&P.items!==void 0)x.items=H.mergeEvaluated.items(s,P.items,x.items,y)}mergeValidEvaluated(P,y){let{it:x,gen:s}=this;if(x.opts.unevaluated&&(x.props!==!0||x.items!==!0))return s.if(y,()=>this.mergeEvaluated(P,J.Name)),!0}};W.KeywordCxt=r;function L0(P,y,x,s){let t=new r(P,x,y);if("code"in x)x.code(t,s);else if(t.$data&&x.validate)(0,F.funcKeywordCode)(t,x);else if("macro"in x)(0,F.macroKeywordCode)(t,x);else if(x.compile||x.validate)(0,F.funcKeywordCode)(t,x)}let e=/^\/(?:[^~]|~0|~1)*$/,w0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function h0(P,{dataLevel:y,dataNames:x,dataPathArr:s}){let t,F0;if(P==="")return z.default.rootData;if(P[0]==="/"){if(!e.test(P))throw Error(`Invalid JSON-pointer: ${P}`);t=P,F0=z.default.rootData}else{let b0=w0.exec(P);if(!b0)throw Error(`Invalid JSON-pointer: ${P}`);let j0=+b0[1];if(t=b0[2],t==="#"){if(j0>=y)throw Error(g0("property/index",j0));return s[y-j0]}if(j0>y)throw Error(g0("data",j0));if(F0=x[y-j0],!t)return F0}let T0=F0,q0=t.split("/");for(let b0 of q0)if(b0)F0=J._`${F0}${(0,J.getProperty)((0,H.unescapeJsonPointer)(b0))}`,T0=J._`${T0} && ${F0}`;return T0;function g0(b0,j0){return`Cannot access ${b0} ${j0} levels up, current level is ${y}`}}W.getData=h0}),DX=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});var Q=class extends Error{constructor(X){super("validation failed");this.errors=X,this.ajv=this.validation=!0}};W.default=Q}),tW=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=wX();var X=class extends Error{constructor(Y,G,B,F){super(F||`can't resolve reference ${B} from id ${G}`);this.missingRef=(0,Q.resolveUrl)(Y,G,B),this.missingSchema=(0,Q.normalizeId)((0,Q.getFullPath)(Y,this.missingRef))}};W.default=X}),MX=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.resolveSchema=W.getCompilingSchema=W.resolveRef=W.compileSchema=W.SchemaEnv=void 0;let Q=I0(),X=DX(),Y=x6(),G=wX(),B=v0(),F=sW();var L=class{constructor(Z){var V;this.refs={},this.dynamicAnchors={};let U;if(typeof Z.schema=="object")U=Z.schema;this.schema=Z.schema,this.schemaId=Z.schemaId,this.root=Z.root||this,this.baseId=(V=Z.baseId)!==null&&V!==void 0?V:(0,G.normalizeId)(U===null||U===void 0?void 0:U[Z.schemaId||"$id"]),this.schemaPath=Z.schemaPath,this.localRefs=Z.localRefs,this.meta=Z.meta,this.$async=U===null||U===void 0?void 0:U.$async,this.refs={}}};W.SchemaEnv=L;function J(Z){let V=H.call(this,Z);if(V)return V;let U=(0,G.getFullPath)(this.opts.uriResolver,Z.root.baseId),{es5:j,lines:T}=this.opts.code,{ownProperties:O}=this.opts,w=new Q.CodeGen(this.scope,{es5:j,lines:T,ownProperties:O}),R;if(Z.$async)R=w.scopeValue("Error",{ref:X.default,code:Q._`require("ajv/dist/runtime/validation_error").default`});let k=w.scopeName("validate");Z.validateName=k;let l={gen:w,allErrors:this.opts.allErrors,data:Y.default.data,parentData:Y.default.parentData,parentDataProperty:Y.default.parentDataProperty,dataNames:[Y.default.data],dataPathArr:[Q.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:w.scopeValue("schema",this.opts.code.source===!0?{ref:Z.schema,code:(0,Q.stringify)(Z.schema)}:{ref:Z.schema}),validateName:k,ValidationError:R,schema:Z.schema,schemaEnv:Z,rootId:U,baseId:Z.baseId||U,schemaPath:Q.nil,errSchemaPath:Z.schemaPath||(this.opts.jtd?"":"#"),errorPath:Q._`""`,opts:this.opts,self:this},_;try{this._compilations.add(Z),(0,F.validateFunctionCode)(l),w.optimize(this.opts.code.optimize);let h=w.toString();if(_=`${w.scopeRefs(Y.default.scope)}return ${h}`,this.opts.code.process)_=this.opts.code.process(_,Z);let d=Function(`${Y.default.self}`,`${Y.default.scope}`,_)(this,this.scope.get());if(this.scope.value(k,{ref:d}),d.errors=null,d.schema=Z.schema,d.schemaEnv=Z,Z.$async)d.$async=!0;if(this.opts.code.source===!0)d.source={validateName:k,validateCode:h,scopeValues:w._values};if(this.opts.unevaluated){let{props:p,items:z0}=l;if(d.evaluated={props:p instanceof Q.Name?void 0:p,items:z0 instanceof Q.Name?void 0:z0,dynamicProps:p instanceof Q.Name,dynamicItems:z0 instanceof Q.Name},d.source)d.source.evaluated=(0,Q.stringify)(d.evaluated)}return Z.validate=d,Z}catch(h){if(delete Z.validate,delete Z.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw h}finally{this._compilations.delete(Z)}}W.compileSchema=J;function z(Z,V,U){var j;U=(0,G.resolveUrl)(this.opts.uriResolver,V,U);let T=Z.refs[U];if(T)return T;let O=I.call(this,Z,U);if(O===void 0){let w=(j=Z.localRefs)===null||j===void 0?void 0:j[U],{schemaId:R}=this.opts;if(w)O=new L({schema:w,schemaId:R,root:Z,baseId:V})}if(O===void 0)return;return Z.refs[U]=K.call(this,O)}W.resolveRef=z;function K(Z){if((0,G.inlineRef)(Z.schema,this.opts.inlineRefs))return Z.schema;return Z.validate?Z:J.call(this,Z)}function H(Z){for(let V of this._compilations)if(D(V,Z))return V}W.getCompilingSchema=H;function D(Z,V){return Z.schema===V.schema&&Z.root===V.root&&Z.baseId===V.baseId}function I(Z,V){let U;while(typeof(U=this.refs[V])=="string")V=U;return U||this.schemas[V]||A.call(this,Z,V)}function A(Z,V){let U=this.opts.uriResolver.parse(V),j=(0,G._getFullPath)(this.opts.uriResolver,U),T=(0,G.getFullPath)(this.opts.uriResolver,Z.baseId,void 0);if(Object.keys(Z.schema).length>0&&j===T)return N.call(this,U,Z);let O=(0,G.normalizeId)(j),w=this.refs[O]||this.schemas[O];if(typeof w=="string"){let R=A.call(this,Z,w);if(typeof(R===null||R===void 0?void 0:R.schema)!=="object")return;return N.call(this,U,R)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)J.call(this,w);if(O===(0,G.normalizeId)(V)){let{schema:R}=w,{schemaId:k}=this.opts,l=R[k];if(l)T=(0,G.resolveUrl)(this.opts.uriResolver,T,l);return new L({schema:R,schemaId:k,root:Z,baseId:T})}return N.call(this,U,w)}W.resolveSchema=A;let M=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function N(Z,{baseId:V,schema:U,root:j}){var T;if(((T=Z.fragment)===null||T===void 0?void 0:T[0])!=="/")return;for(let R of Z.fragment.slice(1).split("/")){if(typeof U==="boolean")return;let k=U[(0,B.unescapeFragment)(R)];if(k===void 0)return;U=k;let l=typeof U==="object"&&U[this.opts.schemaId];if(!M.has(R)&&l)V=(0,G.resolveUrl)(this.opts.uriResolver,V,l)}let O;if(typeof U!="boolean"&&U.$ref&&!(0,B.schemaHasRulesButRef)(U,this.RULES)){let R=(0,G.resolveUrl)(this.opts.uriResolver,V,U.$ref);O=A.call(this,j,R)}let{schemaId:w}=this.opts;if(O=O||new L({schema:U,schemaId:w,root:j,baseId:V}),O.schema!==O.root.schema)return O}}),hD=Y0((W,Q)=>{Q.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),hZ=Y0((W,Q)=>{let X=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Y=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function G(A){let M="",N=0,Z=0;for(Z=0;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),N===48)continue;if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z];break}for(Z+=1;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z]}return M}let B=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function F(A){return A.length=0,!0}function L(A,M,N){if(A.length){let Z=G(A);if(Z!=="")M.push(Z);else return N.error=!0,!1;A.length=0}return!0}function J(A){let M=0,N={error:!1,address:"",zone:""},Z=[],V=[],U=!1,j=!1,T=L;for(let O=0;O<A.length;O++){let w=A[O];if(w==="["||w==="]")continue;if(w===":"){if(U===!0)j=!0;if(!T(V,Z,N))break;if(++M>7){N.error=!0;break}if(O>0&&A[O-1]===":")U=!0;Z.push(":");continue}else if(w==="%"){if(!T(V,Z,N))break;T=F}else{V.push(w);continue}}if(V.length)if(T===F)N.zone=V.join("");else if(j)Z.push(V.join(""));else Z.push(G(V));return N.address=Z.join(""),N}function z(A){if(K(A,":")<2)return{host:A,isIPV6:!1};let M=J(A);if(!M.error){let{address:N,address:Z}=M;if(M.zone)N+="%"+M.zone,Z+="%25"+M.zone;return{host:N,isIPV6:!0,escapedHost:Z}}else return{host:A,isIPV6:!1}}function K(A,M){let N=0;for(let Z=0;Z<A.length;Z++)if(A[Z]===M)N++;return N}function H(A){let M=A,N=[],Z=-1,V=0;while(V=M.length){if(V===1)if(M===".")break;else if(M==="/"){N.push("/");break}else{N.push(M);break}else if(V===2){if(M[0]==="."){if(M[1]===".")break;else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."||M[1]==="/"){N.push("/");break}}}else if(V===3){if(M==="/.."){if(N.length!==0)N.pop();N.push("/");break}}if(M[0]==="."){if(M[1]==="."){if(M[2]==="/"){M=M.slice(3);continue}}else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."){if(M[2]==="/"){M=M.slice(2);continue}else if(M[2]==="."){if(M[3]==="/"){if(M=M.slice(3),N.length!==0)N.pop();continue}}}}if((Z=M.indexOf("/",1))===-1){N.push(M);break}else N.push(M.slice(0,Z)),M=M.slice(Z)}return N.join("")}function D(A,M){let N=M!==!0?escape:unescape;if(A.scheme!==void 0)A.scheme=N(A.scheme);if(A.userinfo!==void 0)A.userinfo=N(A.userinfo);if(A.host!==void 0)A.host=N(A.host);if(A.path!==void 0)A.path=N(A.path);if(A.query!==void 0)A.query=N(A.query);if(A.fragment!==void 0)A.fragment=N(A.fragment);return A}function I(A){let M=[];if(A.userinfo!==void 0)M.push(A.userinfo),M.push("@");if(A.host!==void 0){let N=unescape(A.host);if(!Y(N)){let Z=z(N);if(Z.isIPV6===!0)N=`[${Z.escapedHost}]`;else N=A.host}M.push(N)}if(typeof A.port==="number"||typeof A.port==="string")M.push(":"),M.push(String(A.port));return M.length?M.join(""):void 0}Q.exports={nonSimpleDomain:B,recomposeAuthority:I,normalizeComponentEncoding:D,removeDotSegments:H,isIPv4:Y,isUUID:X,normalizeIPv6:z,stringArrayToHexStripped:G}}),uD=Y0((W,Q)=>{let{isUUID:X}=hZ(),Y=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,G=["http","https","ws","wss","urn","urn:uuid"];function B(w){return G.indexOf(w)!==-1}function F(w){if(w.secure===!0)return!0;else if(w.secure===!1)return!1;else if(w.scheme)return w.scheme.length===3&&(w.scheme[0]==="w"||w.scheme[0]==="W")&&(w.scheme[1]==="s"||w.scheme[1]==="S")&&(w.scheme[2]==="s"||w.scheme[2]==="S");else return!1}function L(w){if(!w.host)w.error=w.error||"HTTP URIs must have a host.";return w}function J(w){let R=String(w.scheme).toLowerCase()==="https";if(w.port===(R?443:80)||w.port==="")w.port=void 0;if(!w.path)w.path="/";return w}function z(w){return w.secure=F(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w}function K(w){if(w.port===(F(w)?443:80)||w.port==="")w.port=void 0;if(typeof w.secure==="boolean")w.scheme=w.secure?"wss":"ws",w.secure=void 0;if(w.resourceName){let[R,k]=w.resourceName.split("?");w.path=R&&R!=="/"?R:void 0,w.query=k,w.resourceName=void 0}return w.fragment=void 0,w}function H(w,R){if(!w.path)return w.error="URN can not be parsed",w;let k=w.path.match(Y);if(k){let l=R.scheme||w.scheme||"urn";w.nid=k[1].toLowerCase(),w.nss=k[2];let _=O(`${l}:${R.nid||w.nid}`);if(w.path=void 0,_)w=_.parse(w,R)}else w.error=w.error||"URN can not be parsed.";return w}function D(w,R){if(w.nid===void 0)throw Error("URN without nid cannot be serialized");let k=R.scheme||w.scheme||"urn",l=w.nid.toLowerCase(),_=O(`${k}:${R.nid||l}`);if(_)w=_.serialize(w,R);let h=w,d=w.nss;return h.path=`${l||R.nid}:${d}`,R.skipEscape=!0,h}function I(w,R){let k=w;if(k.uuid=k.nss,k.nss=void 0,!R.tolerant&&(!k.uuid||!X(k.uuid)))k.error=k.error||"UUID is not valid.";return k}function A(w){let R=w;return R.nss=(w.uuid||"").toLowerCase(),R}let M={scheme:"http",domainHost:!0,parse:L,serialize:J},N={scheme:"https",domainHost:M.domainHost,parse:L,serialize:J},Z={scheme:"ws",domainHost:!0,parse:z,serialize:K},V={scheme:"wss",domainHost:Z.domainHost,parse:Z.parse,serialize:Z.serialize},T={http:M,https:N,ws:Z,wss:V,urn:{scheme:"urn",parse:H,serialize:D,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:I,serialize:A,skipNormalize:!0}};Object.setPrototypeOf(T,null);function O(w){return w&&(T[w]||T[w.toLowerCase()])||void 0}Q.exports={wsIsSecure:F,SCHEMES:T,isValidSchemeName:B,getSchemeHandler:O}}),lD=Y0((W,Q)=>{let{normalizeIPv6:X,removeDotSegments:Y,recomposeAuthority:G,normalizeComponentEncoding:B,isIPv4:F,nonSimpleDomain:L}=hZ(),{SCHEMES:J,getSchemeHandler:z}=uD();function K(V,U){if(typeof V==="string")V=A(N(V,U),U);else if(typeof V==="object")V=N(A(V,U),U);return V}function H(V,U,j){let T=j?Object.assign({scheme:"null"},j):{scheme:"null"},O=D(N(V,T),N(U,T),T,!0);return T.skipEscape=!0,A(O,T)}function D(V,U,j,T){let O={};if(!T)V=N(A(V,j),j),U=N(A(U,j),j);if(j=j||{},!j.tolerant&&U.scheme)O.scheme=U.scheme,O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(U.userinfo!==void 0||U.host!==void 0||U.port!==void 0)O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(!U.path)if(O.path=V.path,U.query!==void 0)O.query=U.query;else O.query=V.query;else{if(U.path[0]==="/")O.path=Y(U.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)O.path="/"+U.path;else if(!V.path)O.path=U.path;else O.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+U.path;O.path=Y(O.path)}O.query=U.query}O.userinfo=V.userinfo,O.host=V.host,O.port=V.port}O.scheme=V.scheme}return O.fragment=U.fragment,O}function I(V,U,j){if(typeof V==="string")V=unescape(V),V=A(B(N(V,j),!0),{...j,skipEscape:!0});else if(typeof V==="object")V=A(B(V,!0),{...j,skipEscape:!0});if(typeof U==="string")U=unescape(U),U=A(B(N(U,j),!0),{...j,skipEscape:!0});else if(typeof U==="object")U=A(B(U,!0),{...j,skipEscape:!0});return V.toLowerCase()===U.toLowerCase()}function A(V,U){let j={host:V.host,scheme:V.scheme,userinfo:V.userinfo,port:V.port,path:V.path,query:V.query,nid:V.nid,nss:V.nss,uuid:V.uuid,fragment:V.fragment,reference:V.reference,resourceName:V.resourceName,secure:V.secure,error:""},T=Object.assign({},U),O=[],w=z(T.scheme||j.scheme);if(w&&w.serialize)w.serialize(j,T);if(j.path!==void 0)if(!T.skipEscape){if(j.path=escape(j.path),j.scheme!==void 0)j.path=j.path.split("%3A").join(":")}else j.path=unescape(j.path);if(T.reference!=="suffix"&&j.scheme)O.push(j.scheme,":");let R=G(j);if(R!==void 0){if(T.reference!=="suffix")O.push("//");if(O.push(R),j.path&&j.path[0]!=="/")O.push("/")}if(j.path!==void 0){let k=j.path;if(!T.absolutePath&&(!w||!w.absolutePath))k=Y(k);if(R===void 0&&k[0]==="/"&&k[1]==="/")k="/%2F"+k.slice(2);O.push(k)}if(j.query!==void 0)O.push("?",j.query);if(j.fragment!==void 0)O.push("#",j.fragment);return O.join("")}let M=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function N(V,U){let j=Object.assign({},U),T={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},O=!1;if(j.reference==="suffix")if(j.scheme)V=j.scheme+":"+V;else V="//"+V;let w=V.match(M);if(w){if(T.scheme=w[1],T.userinfo=w[3],T.host=w[4],T.port=parseInt(w[5],10),T.path=w[6]||"",T.query=w[7],T.fragment=w[8],isNaN(T.port))T.port=w[5];if(T.host)if(F(T.host)===!1){let k=X(T.host);T.host=k.host.toLowerCase(),O=k.isIPV6}else O=!0;if(T.scheme===void 0&&T.userinfo===void 0&&T.host===void 0&&T.port===void 0&&T.query===void 0&&!T.path)T.reference="same-document";else if(T.scheme===void 0)T.reference="relative";else if(T.fragment===void 0)T.reference="absolute";else T.reference="uri";if(j.reference&&j.reference!=="suffix"&&j.reference!==T.reference)T.error=T.error||"URI is not a "+j.reference+" reference.";let R=z(j.scheme||T.scheme);if(!j.unicodeSupport&&(!R||!R.unicodeSupport)){if(T.host&&(j.domainHost||R&&R.domainHost)&&O===!1&&L(T.host))try{T.host=URL.domainToASCII(T.host.toLowerCase())}catch(k){T.error=T.error||"Host's domain name can not be converted to ASCII: "+k}}if(!R||R&&!R.skipNormalize){if(V.indexOf("%")!==-1){if(T.scheme!==void 0)T.scheme=unescape(T.scheme);if(T.host!==void 0)T.host=unescape(T.host)}if(T.path)T.path=escape(unescape(T.path));if(T.fragment)T.fragment=encodeURI(decodeURIComponent(T.fragment))}if(R&&R.parse)R.parse(T,j)}else T.error=T.error||"URI can not be parsed.";return T}let Z={SCHEMES:J,normalize:K,resolve:H,resolveComponent:D,equal:I,serialize:A,parse:N};Q.exports=Z,Q.exports.default=Z,Q.exports.fastUri=Z}),mD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=lD();Q.code='require("ajv/dist/runtime/uri").default',W.default=Q}),uZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=void 0;var Q=sW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return Q.KeywordCxt}});var X=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return X._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return X.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return X.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return X.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return X.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return X.CodeGen}});let Y=DX(),G=tW(),B=gZ(),F=MX(),L=I0(),J=wX(),z=NX(),K=v0(),H=hD(),D=mD(),I=(S,v)=>new RegExp(S,v);I.code="new RegExp";let A=["removeAdditional","useDefaults","coerceTypes"],M=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),N={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},Z={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},V=200;function U(S){var v,u,E,b,C,c,r,L0,e,w0,h0,P,y,x,s,t,F0,T0,q0,g0,b0,j0,r0,C0,G1;let Q1=S.strict,B1=(v=S.code)===null||v===void 0?void 0:v.optimize,K1=B1===!0||B1===void 0?1:B1||0,Z1=(E=(u=S.code)===null||u===void 0?void 0:u.regExp)!==null&&E!==void 0?E:I,V1=(b=S.uriResolver)!==null&&b!==void 0?b:D.default;return{strictSchema:(c=(C=S.strictSchema)!==null&&C!==void 0?C:Q1)!==null&&c!==void 0?c:!0,strictNumbers:(L0=(r=S.strictNumbers)!==null&&r!==void 0?r:Q1)!==null&&L0!==void 0?L0:!0,strictTypes:(w0=(e=S.strictTypes)!==null&&e!==void 0?e:Q1)!==null&&w0!==void 0?w0:"log",strictTuples:(P=(h0=S.strictTuples)!==null&&h0!==void 0?h0:Q1)!==null&&P!==void 0?P:"log",strictRequired:(x=(y=S.strictRequired)!==null&&y!==void 0?y:Q1)!==null&&x!==void 0?x:!1,code:S.code?{...S.code,optimize:K1,regExp:Z1}:{optimize:K1,regExp:Z1},loopRequired:(s=S.loopRequired)!==null&&s!==void 0?s:V,loopEnum:(t=S.loopEnum)!==null&&t!==void 0?t:V,meta:(F0=S.meta)!==null&&F0!==void 0?F0:!0,messages:(T0=S.messages)!==null&&T0!==void 0?T0:!0,inlineRefs:(q0=S.inlineRefs)!==null&&q0!==void 0?q0:!0,schemaId:(g0=S.schemaId)!==null&&g0!==void 0?g0:"$id",addUsedSchema:(b0=S.addUsedSchema)!==null&&b0!==void 0?b0:!0,validateSchema:(j0=S.validateSchema)!==null&&j0!==void 0?j0:!0,validateFormats:(r0=S.validateFormats)!==null&&r0!==void 0?r0:!0,unicodeRegExp:(C0=S.unicodeRegExp)!==null&&C0!==void 0?C0:!0,int32range:(G1=S.int32range)!==null&&G1!==void 0?G1:!0,uriResolver:V1}}var j=class{constructor(S={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,S=this.opts={...S,...U(S)};let{es5:v,lines:u}=this.opts.code;this.scope=new L.ValueScope({scope:{},prefixes:M,es5:v,lines:u}),this.logger=h(S.logger);let E=S.validateFormats;if(S.validateFormats=!1,this.RULES=(0,B.getRules)(),T.call(this,N,S,"NOT SUPPORTED"),T.call(this,Z,S,"DEPRECATED","warn"),this._metaOpts=l.call(this),S.formats)R.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),S.keywords)k.call(this,S.keywords);if(typeof S.meta=="object")this.addMetaSchema(S.meta);w.call(this),S.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:S,meta:v,schemaId:u}=this.opts,E=H;if(u==="id")E={...H},E.id=E.$id,delete E.$id;if(v&&S)this.addMetaSchema(E,E[u],!1)}defaultMeta(){let{meta:S,schemaId:v}=this.opts;return this.opts.defaultMeta=typeof S=="object"?S[v]||S:void 0}validate(S,v){let u;if(typeof S=="string"){if(u=this.getSchema(S),!u)throw Error(`no schema with key or ref "${S}"`)}else u=this.compile(S);let E=u(v);if(!("$async"in u))this.errors=u.errors;return E}compile(S,v){let u=this._addSchema(S,v);return u.validate||this._compileSchemaEnv(u)}compileAsync(S,v){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:u}=this.opts;return E.call(this,S,v);async function E(e,w0){await b.call(this,e.$schema);let h0=this._addSchema(e,w0);return h0.validate||C.call(this,h0)}async function b(e){if(e&&!this.getSchema(e))await E.call(this,{$ref:e},!0)}async function C(e){try{return this._compileSchemaEnv(e)}catch(w0){if(!(w0 instanceof G.default))throw w0;return c.call(this,w0),await r.call(this,w0.missingSchema),C.call(this,e)}}function c({missingSchema:e,missingRef:w0}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${w0} cannot be resolved`)}async function r(e){let w0=await L0.call(this,e);if(!this.refs[e])await b.call(this,w0.$schema);if(!this.refs[e])this.addSchema(w0,e,v)}async function L0(e){let w0=this._loading[e];if(w0)return w0;try{return await(this._loading[e]=u(e))}finally{delete this._loading[e]}}}addSchema(S,v,u,E=this.opts.validateSchema){if(Array.isArray(S)){for(let C of S)this.addSchema(C,void 0,u,E);return this}let b;if(typeof S==="object"){let{schemaId:C}=this.opts;if(b=S[C],b!==void 0&&typeof b!="string")throw Error(`schema ${C} must be string`)}return v=(0,J.normalizeId)(v||b),this._checkUnique(v),this.schemas[v]=this._addSchema(S,u,v,E,!0),this}addMetaSchema(S,v,u=this.opts.validateSchema){return this.addSchema(S,v,!0,u),this}validateSchema(S,v){if(typeof S=="boolean")return!0;let u;if(u=S.$schema,u!==void 0&&typeof u!="string")throw Error("$schema must be a string");if(u=u||this.opts.defaultMeta||this.defaultMeta(),!u)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let E=this.validate(u,S);if(!E&&v){let b="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(b);else throw Error(b)}return E}getSchema(S){let v;while(typeof(v=O.call(this,S))=="string")S=v;if(v===void 0){let{schemaId:u}=this.opts,E=new F.SchemaEnv({schema:{},schemaId:u});if(v=F.resolveSchema.call(this,E,S),!v)return;this.refs[S]=v}return v.validate||this._compileSchemaEnv(v)}removeSchema(S){if(S instanceof RegExp)return this._removeAllSchemas(this.schemas,S),this._removeAllSchemas(this.refs,S),this;switch(typeof S){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let v=O.call(this,S);if(typeof v=="object")this._cache.delete(v.schema);return delete this.schemas[S],delete this.refs[S],this}case"object":{let v=S;this._cache.delete(v);let u=S[this.opts.schemaId];if(u)u=(0,J.normalizeId)(u),delete this.schemas[u],delete this.refs[u];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(S){for(let v of S)this.addKeyword(v);return this}addKeyword(S,v){let u;if(typeof S=="string"){if(u=S,typeof v=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),v.keyword=u}else if(typeof S=="object"&&v===void 0){if(v=S,u=v.keyword,Array.isArray(u)&&!u.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(p.call(this,u,v),!v)return(0,K.eachItem)(u,(b)=>z0.call(this,b)),this;V0.call(this,v);let E={...v,type:(0,z.getJSONTypes)(v.type),schemaType:(0,z.getJSONTypes)(v.schemaType)};return(0,K.eachItem)(u,E.type.length===0?(b)=>z0.call(this,b,E):(b)=>E.type.forEach((C)=>z0.call(this,b,E,C))),this}getKeyword(S){let v=this.RULES.all[S];return typeof v=="object"?v.definition:!!v}removeKeyword(S){let{RULES:v}=this;delete v.keywords[S],delete v.all[S];for(let u of v.rules){let E=u.rules.findIndex((b)=>b.keyword===S);if(E>=0)u.rules.splice(E,1)}return this}addFormat(S,v){if(typeof v=="string")v=new RegExp(v);return this.formats[S]=v,this}errorsText(S=this.errors,{separator:v=", ",dataVar:u="data"}={}){if(!S||S.length===0)return"No errors";return S.map((E)=>`${u}${E.instancePath} ${E.message}`).reduce((E,b)=>E+v+b)}$dataMetaSchema(S,v){let u=this.RULES.all;S=JSON.parse(JSON.stringify(S));for(let E of v){let b=E.split("/").slice(1),C=S;for(let c of b)C=C[c];for(let c in u){let r=u[c];if(typeof r!="object")continue;let{$data:L0}=r.definition,e=C[c];if(L0&&e)C[c]=Z0(e)}}return S}_removeAllSchemas(S,v){for(let u in S){let E=S[u];if(!v||v.test(u)){if(typeof E=="string")delete S[u];else if(E&&!E.meta)this._cache.delete(E.schema),delete S[u]}}}_addSchema(S,v,u,E=this.opts.validateSchema,b=this.opts.addUsedSchema){let C,{schemaId:c}=this.opts;if(typeof S=="object")C=S[c];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof S!="boolean")throw Error("schema must be object or boolean");let r=this._cache.get(S);if(r!==void 0)return r;u=(0,J.normalizeId)(C||u);let L0=J.getSchemaRefs.call(this,S,u);if(r=new F.SchemaEnv({schema:S,schemaId:c,meta:v,baseId:u,localRefs:L0}),this._cache.set(r.schema,r),b&&!u.startsWith("#")){if(u)this._checkUnique(u);this.refs[u]=r}if(E)this.validateSchema(S,!0);return r}_checkUnique(S){if(this.schemas[S]||this.refs[S])throw Error(`schema with key or id "${S}" already exists`)}_compileSchemaEnv(S){if(S.meta)this._compileMetaSchema(S);else F.compileSchema.call(this,S);if(!S.validate)throw Error("ajv implementation error");return S.validate}_compileMetaSchema(S){let v=this.opts;this.opts=this._metaOpts;try{F.compileSchema.call(this,S)}finally{this.opts=v}}};j.ValidationError=Y.default,j.MissingRefError=G.default,W.default=j;function T(S,v,u,E="error"){for(let b in S){let C=b;if(C in v)this.logger[E](`${u}: option ${b}. ${S[C]}`)}}function O(S){return S=(0,J.normalizeId)(S),this.schemas[S]||this.refs[S]}function w(){let S=this.opts.schemas;if(!S)return;if(Array.isArray(S))this.addSchema(S);else for(let v in S)this.addSchema(S[v],v)}function R(){for(let S in this.opts.formats){let v=this.opts.formats[S];if(v)this.addFormat(S,v)}}function k(S){if(Array.isArray(S)){this.addVocabulary(S);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let v in S){let u=S[v];if(!u.keyword)u.keyword=v;this.addKeyword(u)}}function l(){let S={...this.opts};for(let v of A)delete S[v];return S}let _={log(){},warn(){},error(){}};function h(S){if(S===!1)return _;if(S===void 0)return console;if(S.log&&S.warn&&S.error)return S;throw Error("logger must implement log, warn and error methods")}let d=/^[a-z_$][a-z0-9_$:-]*$/i;function p(S,v){let{RULES:u}=this;if((0,K.eachItem)(S,(E)=>{if(u.keywords[E])throw Error(`Keyword ${E} is already defined`);if(!d.test(E))throw Error(`Keyword ${E} has invalid name`)}),!v)return;if(v.$data&&!(("code"in v)||("validate"in v)))throw Error('$data keyword must have "code" or "validate" function')}function z0(S,v,u){var E;let b=v===null||v===void 0?void 0:v.post;if(u&&b)throw Error('keyword with "post" flag cannot have "type"');let{RULES:C}=this,c=b?C.post:C.rules.find(({type:L0})=>L0===u);if(!c)c={type:u,rules:[]},C.rules.push(c);if(C.keywords[S]=!0,!v)return;let r={keyword:S,definition:{...v,type:(0,z.getJSONTypes)(v.type),schemaType:(0,z.getJSONTypes)(v.schemaType)}};if(v.before)M0.call(this,c,r,v.before);else c.rules.push(r);C.all[S]=r,(E=v.implements)===null||E===void 0||E.forEach((L0)=>this.addKeyword(L0))}function M0(S,v,u){let E=S.rules.findIndex((b)=>b.keyword===u);if(E>=0)S.rules.splice(E,0,v);else S.rules.push(v),this.logger.warn(`rule ${u} is not defined`)}function V0(S){let{metaSchema:v}=S;if(v===void 0)return;if(S.$data&&this.opts.$data)v=Z0(v);S.validateSchema=this.compile(v,!0)}let P0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Z0(S){return{anyOf:[S,P0]}}}),cD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};W.default=Q}),R7=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.callRef=W.getValidate=void 0;let Q=tW(),X=h6(),Y=I0(),G=x6(),B=MX(),F=v0(),L={keyword:"$ref",schemaType:"string",code(K){let{gen:H,schema:D,it:I}=K,{baseId:A,schemaEnv:M,validateName:N,opts:Z,self:V}=I,{root:U}=M;if((D==="#"||D==="#/")&&A===U.baseId)return T();let j=B.resolveRef.call(V,U,A,D);if(j===void 0)throw new Q.default(I.opts.uriResolver,A,D);if(j instanceof B.SchemaEnv)return O(j);return w(j);function T(){if(M===U)return z(K,N,M,M.$async);let R=H.scopeValue("root",{ref:U});return z(K,Y._`${R}.validate`,U,U.$async)}function O(R){z(K,J(K,R),R,R.$async)}function w(R){let k=H.scopeValue("schema",Z.code.source===!0?{ref:R,code:(0,Y.stringify)(R)}:{ref:R}),l=H.name("valid"),_=K.subschema({schema:R,dataTypes:[],schemaPath:Y.nil,topSchemaRef:k,errSchemaPath:D},l);K.mergeEvaluated(_),K.ok(l)}}};function J(K,H){let{gen:D}=K;return H.validate?D.scopeValue("validate",{ref:H.validate}):Y._`${D.scopeValue("wrapper",{ref:H})}.validate`}W.getValidate=J;function z(K,H,D,I){let{gen:A,it:M}=K,{allErrors:N,schemaEnv:Z,opts:V}=M,U=V.passContext?G.default.this:Y.nil;if(I)j();else T();function j(){if(!Z.$async)throw Error("async schema referenced by sync schema");let R=A.let("valid");A.try(()=>{if(A.code(Y._`await ${(0,X.callValidateCode)(K,H,U)}`),w(H),!N)A.assign(R,!0)},(k)=>{if(A.if(Y._`!(${k} instanceof ${M.ValidationError})`,()=>A.throw(k)),O(k),!N)A.assign(R,!1)}),K.ok(R)}function T(){K.result((0,X.callValidateCode)(K,H,U),()=>w(H),()=>O(H))}function O(R){let k=Y._`${R}.errors`;A.assign(G.default.vErrors,Y._`${G.default.vErrors} === null ? ${k} : ${G.default.vErrors}.concat(${k})`),A.assign(G.default.errors,Y._`${G.default.vErrors}.length`)}function w(R){var k;if(!M.opts.unevaluated)return;let l=(k=D===null||D===void 0?void 0:D.validate)===null||k===void 0?void 0:k.evaluated;if(M.props!==!0)if(l&&!l.dynamicProps){if(l.props!==void 0)M.props=F.mergeEvaluated.props(A,l.props,M.props)}else{let _=A.var("props",Y._`${R}.evaluated.props`);M.props=F.mergeEvaluated.props(A,_,M.props,Y.Name)}if(M.items!==!0)if(l&&!l.dynamicItems){if(l.items!==void 0)M.items=F.mergeEvaluated.items(A,l.items,M.items)}else{let _=A.var("items",Y._`${R}.evaluated.items`);M.items=F.mergeEvaluated.items(A,_,M.items,Y.Name)}}}W.callRef=z,W.default=L}),lZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=cD(),X=R7(),Y=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Q.default,X.default];W.default=Y}),pD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=Q.operators,Y={maximum:{okStr:"<=",ok:X.LTE,fail:X.GT},minimum:{okStr:">=",ok:X.GTE,fail:X.LT},exclusiveMaximum:{okStr:"<",ok:X.LT,fail:X.GTE},exclusiveMinimum:{okStr:">",ok:X.GT,fail:X.LTE}},G={keyword:Object.keys(Y),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:B,schemaCode:F})=>Q.str`must be ${Y[B].okStr} ${F}`,params:({keyword:B,schemaCode:F})=>Q._`{comparison: ${Y[B].okStr}, limit: ${F}}`},code(B){let{keyword:F,data:L,schemaCode:J}=B;B.fail$data(Q._`${L} ${Y[F].fail} ${J} || isNaN(${L})`)}};W.default=G}),dD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must be multiple of ${Y}`,params:({schemaCode:Y})=>Q._`{multipleOf: ${Y}}`},code(Y){let{gen:G,data:B,schemaCode:F,it:L}=Y,J=L.opts.multipleOfPrecision,z=G.let("res"),K=J?Q._`Math.abs(Math.round(${z}) - ${z}) > 1e-${J}`:Q._`${z} !== parseInt(${z})`;Y.fail$data(Q._`(${F} === 0 || (${z} = ${B}/${F}, ${K}))`)}};W.default=X}),iD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});function Q(X){let Y=X.length,G=0,B=0,F;while(B<Y)if(G++,F=X.charCodeAt(B++),F>=55296&&F<=56319&&B<Y){if(F=X.charCodeAt(B),(F&64512)===56320)B++}return G}W.default=Q,Q.code='require("ajv/dist/runtime/ucs2length").default'}),nD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=iD(),G={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:B,schemaCode:F}){let L=B==="maxLength"?"more":"fewer";return Q.str`must NOT have ${L} than ${F} characters`},params:({schemaCode:B})=>Q._`{limit: ${B}}`},code(B){let{keyword:F,data:L,schemaCode:J,it:z}=B,K=F==="maxLength"?Q.operators.GT:Q.operators.LT,H=z.opts.unicode===!1?Q._`${L}.length`:Q._`${(0,X.useFunc)(B.gen,Y.default)}(${L})`;B.fail$data(Q._`${H} ${K} ${J}`)}};W.default=G}),rD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=h6(),X=v0(),Y=I0(),G={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:B})=>Y.str`must match pattern "${B}"`,params:({schemaCode:B})=>Y._`{pattern: ${B}}`},code(B){let{gen:F,data:L,$data:J,schema:z,schemaCode:K,it:H}=B,D=H.opts.unicodeRegExp?"u":"";if(J){let{regExp:I}=H.opts.code,A=I.code==="new RegExp"?Y._`new RegExp`:(0,X.useFunc)(F,I),M=F.let("valid");F.try(()=>F.assign(M,Y._`${A}(${K}, ${D}).test(${L})`),()=>F.assign(M,!1)),B.fail$data(Y._`!${M}`)}else{let I=(0,Q.usePattern)(B,z);B.fail$data(Y._`!${I}.test(${L})`)}}};W.default=G}),oD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxProperties"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} properties`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxProperties"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`Object.keys(${B}).length ${L} ${F}`)}};W.default=X}),aD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=h6(),X=I0(),Y=v0(),G={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:B}})=>X.str`must have required property '${B}'`,params:({params:{missingProperty:B}})=>X._`{missingProperty: ${B}}`},code(B){let{gen:F,schema:L,schemaCode:J,data:z,$data:K,it:H}=B,{opts:D}=H;if(!K&&L.length===0)return;let I=L.length>=D.loopRequired;if(H.allErrors)A();else M();if(D.strictRequired){let V=B.parentSchema.properties,{definedProperties:U}=B.it;for(let j of L)if((V===null||V===void 0?void 0:V[j])===void 0&&!U.has(j)){let T=`required property "${j}" is not defined at "${H.schemaEnv.baseId+H.errSchemaPath}" (strictRequired)`;(0,Y.checkStrictMode)(H,T,H.opts.strictRequired)}}function A(){if(I||K)B.block$data(X.nil,N);else for(let V of L)(0,Q.checkReportMissingProp)(B,V)}function M(){let V=F.let("missing");if(I||K){let U=F.let("valid",!0);B.block$data(U,()=>Z(V,U)),B.ok(U)}else F.if((0,Q.checkMissingProp)(B,L,V)),(0,Q.reportMissingProp)(B,V),F.else()}function N(){F.forOf("prop",J,(V)=>{B.setParams({missingProperty:V}),F.if((0,Q.noPropertyInData)(F,z,V,D.ownProperties),()=>B.error())})}function Z(V,U){B.setParams({missingProperty:V}),F.forOf(V,J,()=>{F.assign(U,(0,Q.propertyInData)(F,z,V,D.ownProperties)),F.if((0,X.not)(U),()=>{B.error(),F.break()})},X.nil)}}};W.default=G}),sD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxItems"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} items`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxItems"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`${B}.length ${L} ${F}`)}};W.default=X}),P7=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=xZ();Q.code='require("ajv/dist/runtime/equal").default',W.default=Q}),tD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=NX(),X=I0(),Y=v0(),G=P7(),B={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:F,j:L}})=>X.str`must NOT have duplicate items (items ## ${L} and ${F} are identical)`,params:({params:{i:F,j:L}})=>X._`{i: ${F}, j: ${L}}`},code(F){let{gen:L,data:J,$data:z,schema:K,parentSchema:H,schemaCode:D,it:I}=F;if(!z&&!K)return;let A=L.let("valid"),M=H.items?(0,Q.getSchemaTypes)(H.items):[];F.block$data(A,N,X._`${D} === false`),F.ok(A);function N(){let j=L.let("i",X._`${J}.length`),T=L.let("j");F.setParams({i:j,j:T}),L.assign(A,!0),L.if(X._`${j} > 1`,()=>(Z()?V:U)(j,T))}function Z(){return M.length>0&&!M.some((j)=>j==="object"||j==="array")}function V(j,T){let O=L.name("item"),w=(0,Q.checkDataTypes)(M,O,I.opts.strictNumbers,Q.DataType.Wrong),R=L.const("indices",X._`{}`);L.for(X._`;${j}--;`,()=>{if(L.let(O,X._`${J}[${j}]`),L.if(w,X._`continue`),M.length>1)L.if(X._`typeof ${O} == "string"`,X._`${O} += "_"`);L.if(X._`typeof ${R}[${O}] == "number"`,()=>{L.assign(T,X._`${R}[${O}]`),F.error(),L.assign(A,!1).break()}).code(X._`${R}[${O}] = ${j}`)})}function U(j,T){let O=(0,Y.useFunc)(L,G.default),w=L.name("outer");L.label(w).for(X._`;${j}--;`,()=>L.for(X._`${T} = ${j}; ${T}--;`,()=>L.if(X._`${O}(${J}[${j}], ${J}[${T}])`,()=>{F.error(),L.assign(A,!1).break(w)})))}}};W.default=B}),eD=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=P7(),G={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:B})=>Q._`{allowedValue: ${B}}`},code(B){let{gen:F,data:L,$data:J,schemaCode:z,schema:K}=B;if(J||K&&typeof K=="object")B.fail$data(Q._`!${(0,X.useFunc)(F,Y.default)}(${L}, ${z})`);else B.fail(Q._`${K} !== ${L}`)}};W.default=G}),WM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=P7(),G={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:B})=>Q._`{allowedValues: ${B}}`},code(B){let{gen:F,data:L,$data:J,schema:z,schemaCode:K,it:H}=B;if(!J&&z.length===0)throw Error("enum must have non-empty array");let D=z.length>=H.opts.loopEnum,I,A=()=>I!==null&&I!==void 0?I:I=(0,X.useFunc)(F,Y.default),M;if(D||J)M=F.let("valid"),B.block$data(M,N);else{if(!Array.isArray(z))throw Error("ajv implementation error");let V=F.const("vSchema",K);M=(0,Q.or)(...z.map((U,j)=>Z(V,j)))}B.pass(M);function N(){F.assign(M,!1),F.forOf("v",K,(V)=>F.if(Q._`${A()}(${L}, ${V})`,()=>F.assign(M,!0).break()))}function Z(V,U){let j=z[U];return typeof j==="object"&&j!==null?Q._`${A()}(${L}, ${V}[${U}])`:Q._`${L} === ${j}`}}};W.default=G}),mZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=pD(),X=dD(),Y=nD(),G=rD(),B=oD(),F=aD(),L=sD(),J=tD(),z=eD(),K=WM(),H=[Q.default,X.default,Y.default,G.default,B.default,F.default,L.default,J.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},z.default,K.default];W.default=H}),cZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateAdditionalItems=void 0;let Q=I0(),X=v0(),Y={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:B}})=>Q.str`must NOT have more than ${B} items`,params:({params:{len:B}})=>Q._`{limit: ${B}}`},code(B){let{parentSchema:F,it:L}=B,{items:J}=F;if(!Array.isArray(J)){(0,X.checkStrictMode)(L,'"additionalItems" is ignored when "items" is not an array of schemas');return}G(B,J)}};function G(B,F){let{gen:L,schema:J,data:z,keyword:K,it:H}=B;H.items=!0;let D=L.const("len",Q._`${z}.length`);if(J===!1)B.setParams({len:F.length}),B.pass(Q._`${D} <= ${F.length}`);else if(typeof J=="object"&&!(0,X.alwaysValidSchema)(H,J)){let A=L.var("valid",Q._`${D} <= ${F.length}`);L.if((0,Q.not)(A),()=>I(A)),B.ok(A)}function I(A){L.forRange("i",F.length,D,(M)=>{if(B.subschema({keyword:K,dataProp:M,dataPropType:X.Type.Num},A),!H.allErrors)L.if((0,Q.not)(A),()=>L.break())})}}W.validateAdditionalItems=G,W.default=Y}),pZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateTuple=void 0;let Q=I0(),X=v0(),Y=h6(),G={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(F){let{schema:L,it:J}=F;if(Array.isArray(L))return B(F,"additionalItems",L);if(J.items=!0,(0,X.alwaysValidSchema)(J,L))return;F.ok((0,Y.validateArray)(F))}};function B(F,L,J=F.schema){let{gen:z,parentSchema:K,data:H,keyword:D,it:I}=F;if(N(K),I.opts.unevaluated&&J.length&&I.items!==!0)I.items=X.mergeEvaluated.items(z,J.length,I.items);let A=z.name("valid"),M=z.const("len",Q._`${H}.length`);J.forEach((Z,V)=>{if((0,X.alwaysValidSchema)(I,Z))return;z.if(Q._`${M} > ${V}`,()=>F.subschema({keyword:D,schemaProp:V,dataProp:V},A)),F.ok(A)});function N(Z){let{opts:V,errSchemaPath:U}=I,j=J.length,T=j===Z.minItems&&(j===Z.maxItems||Z[L]===!1);if(V.strictTuples&&!T){let O=`"${D}" is ${j}-tuple, but minItems or maxItems/${L} are not specified or different at path "${U}"`;(0,X.checkStrictMode)(I,O,V.strictTuples)}}}W.validateTuple=B,W.default=G}),QM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=pZ(),X={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Y)=>(0,Q.validateTuple)(Y,"items")};W.default=X}),XM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=h6(),G=cZ(),B={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:F}})=>Q.str`must NOT have more than ${F} items`,params:({params:{len:F}})=>Q._`{limit: ${F}}`},code(F){let{schema:L,parentSchema:J,it:z}=F,{prefixItems:K}=J;if(z.items=!0,(0,X.alwaysValidSchema)(z,L))return;if(K)(0,G.validateAdditionalItems)(F,K);else F.ok((0,Y.validateArray)(F))}};W.default=B}),YM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:G,max:B}})=>B===void 0?Q.str`must contain at least ${G} valid item(s)`:Q.str`must contain at least ${G} and no more than ${B} valid item(s)`,params:({params:{min:G,max:B}})=>B===void 0?Q._`{minContains: ${G}}`:Q._`{minContains: ${G}, maxContains: ${B}}`},code(G){let{gen:B,schema:F,parentSchema:L,data:J,it:z}=G,K,H,{minContains:D,maxContains:I}=L;if(z.opts.next)K=D===void 0?1:D,H=I;else K=1;let A=B.const("len",Q._`${J}.length`);if(G.setParams({min:K,max:H}),H===void 0&&K===0){(0,X.checkStrictMode)(z,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&K>H){(0,X.checkStrictMode)(z,'"minContains" > "maxContains" is always invalid'),G.fail();return}if((0,X.alwaysValidSchema)(z,F)){let U=Q._`${A} >= ${K}`;if(H!==void 0)U=Q._`${U} && ${A} <= ${H}`;G.pass(U);return}z.items=!0;let M=B.name("valid");if(H===void 0&&K===1)Z(M,()=>B.if(M,()=>B.break()));else if(K===0){if(B.let(M,!0),H!==void 0)B.if(Q._`${J}.length > 0`,N)}else B.let(M,!1),N();G.result(M,()=>G.reset());function N(){let U=B.name("_valid"),j=B.let("count",0);Z(U,()=>B.if(U,()=>V(j)))}function Z(U,j){B.forRange("i",0,A,(T)=>{G.subschema({keyword:"contains",dataProp:T,dataPropType:X.Type.Num,compositeRule:!0},U),j()})}function V(U){if(B.code(Q._`${U}++`),H===void 0)B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0).break());else if(B.if(Q._`${U} > ${H}`,()=>B.assign(M,!1).break()),K===1)B.assign(M,!0);else B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0))}}};W.default=Y}),b7=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateSchemaDeps=W.validatePropertyDeps=W.error=void 0;let Q=I0(),X=v0(),Y=h6();W.error={message:({params:{property:J,depsCount:z,deps:K}})=>{let H=z===1?"property":"properties";return Q.str`must have ${H} ${K} when property ${J} is present`},params:({params:{property:J,depsCount:z,deps:K,missingProperty:H}})=>Q._`{property: ${J},
90
+ missingProperty: ${H},
91
+ depsCount: ${z},
92
+ deps: ${K}}`};let G={keyword:"dependencies",type:"object",schemaType:"object",error:W.error,code(J){let[z,K]=B(J);F(J,z),L(J,K)}};function B({schema:J}){let z={},K={};for(let H in J){if(H==="__proto__")continue;let D=Array.isArray(J[H])?z:K;D[H]=J[H]}return[z,K]}function F(J,z=J.schema){let{gen:K,data:H,it:D}=J;if(Object.keys(z).length===0)return;let I=K.let("missing");for(let A in z){let M=z[A];if(M.length===0)continue;let N=(0,Y.propertyInData)(K,H,A,D.opts.ownProperties);if(J.setParams({property:A,depsCount:M.length,deps:M.join(", ")}),D.allErrors)K.if(N,()=>{for(let Z of M)(0,Y.checkReportMissingProp)(J,Z)});else K.if(Q._`${N} && (${(0,Y.checkMissingProp)(J,M,I)})`),(0,Y.reportMissingProp)(J,I),K.else()}}W.validatePropertyDeps=F;function L(J,z=J.schema){let{gen:K,data:H,keyword:D,it:I}=J,A=K.name("valid");for(let M in z){if((0,X.alwaysValidSchema)(I,z[M]))continue;K.if((0,Y.propertyInData)(K,H,M,I.opts.ownProperties),()=>{let N=J.subschema({keyword:D,schemaProp:M},A);J.mergeValidEvaluated(N,A)},()=>K.var(A,!0)),J.ok(A)}}W.validateSchemaDeps=L,W.default=G}),GM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:G})=>Q._`{propertyName: ${G.propertyName}}`},code(G){let{gen:B,schema:F,data:L,it:J}=G;if((0,X.alwaysValidSchema)(J,F))return;let z=B.name("valid");B.forIn("key",L,(K)=>{G.setParams({propertyName:K}),G.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},z),B.if((0,Q.not)(z),()=>{if(G.error(!0),!J.allErrors)B.break()})}),G.ok(z)}};W.default=Y}),dZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=h6(),X=I0(),Y=x6(),G=v0(),B={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:F})=>X._`{additionalProperty: ${F.additionalProperty}}`},code(F){let{gen:L,schema:J,parentSchema:z,data:K,errsCount:H,it:D}=F;if(!H)throw Error("ajv implementation error");let{allErrors:I,opts:A}=D;if(D.props=!0,A.removeAdditional!=="all"&&(0,G.alwaysValidSchema)(D,J))return;let M=(0,Q.allSchemaProperties)(z.properties),N=(0,Q.allSchemaProperties)(z.patternProperties);Z(),F.ok(X._`${H} === ${Y.default.errors}`);function Z(){L.forIn("key",K,(O)=>{if(!M.length&&!N.length)j(O);else L.if(V(O),()=>j(O))})}function V(O){let w;if(M.length>8){let R=(0,G.schemaRefOrVal)(D,z.properties,"properties");w=(0,Q.isOwnProperty)(L,R,O)}else if(M.length)w=(0,X.or)(...M.map((R)=>X._`${O} === ${R}`));else w=X.nil;if(N.length)w=(0,X.or)(w,...N.map((R)=>X._`${(0,Q.usePattern)(F,R)}.test(${O})`));return(0,X.not)(w)}function U(O){L.code(X._`delete ${K}[${O}]`)}function j(O){if(A.removeAdditional==="all"||A.removeAdditional&&J===!1){U(O);return}if(J===!1){if(F.setParams({additionalProperty:O}),F.error(),!I)L.break();return}if(typeof J=="object"&&!(0,G.alwaysValidSchema)(D,J)){let w=L.name("valid");if(A.removeAdditional==="failing")T(O,w,!1),L.if((0,X.not)(w),()=>{F.reset(),U(O)});else if(T(O,w),!I)L.if((0,X.not)(w),()=>L.break())}}function T(O,w,R){let k={keyword:"additionalProperties",dataProp:O,dataPropType:G.Type.Str};if(R===!1)Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1});F.subschema(k,w)}}};W.default=B}),BM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=sW(),X=h6(),Y=v0(),G=dZ(),B={keyword:"properties",type:"object",schemaType:"object",code(F){let{gen:L,schema:J,parentSchema:z,data:K,it:H}=F;if(H.opts.removeAdditional==="all"&&z.additionalProperties===void 0)G.default.code(new Q.KeywordCxt(H,G.default,"additionalProperties"));let D=(0,X.allSchemaProperties)(J);for(let Z of D)H.definedProperties.add(Z);if(H.opts.unevaluated&&D.length&&H.props!==!0)H.props=Y.mergeEvaluated.props(L,(0,Y.toHash)(D),H.props);let I=D.filter((Z)=>!(0,Y.alwaysValidSchema)(H,J[Z]));if(I.length===0)return;let A=L.name("valid");for(let Z of I){if(M(Z))N(Z);else{if(L.if((0,X.propertyInData)(L,K,Z,H.opts.ownProperties)),N(Z),!H.allErrors)L.else().var(A,!0);L.endIf()}F.it.definedProperties.add(Z),F.ok(A)}function M(Z){return H.opts.useDefaults&&!H.compositeRule&&J[Z].default!==void 0}function N(Z){F.subschema({keyword:"properties",schemaProp:Z,dataProp:Z},A)}}};W.default=B}),FM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=h6(),X=I0(),Y=v0(),G=v0(),B={keyword:"patternProperties",type:"object",schemaType:"object",code(F){let{gen:L,schema:J,data:z,parentSchema:K,it:H}=F,{opts:D}=H,I=(0,Q.allSchemaProperties)(J),A=I.filter((T)=>(0,Y.alwaysValidSchema)(H,J[T]));if(I.length===0||A.length===I.length&&(!H.opts.unevaluated||H.props===!0))return;let M=D.strictSchema&&!D.allowMatchingProperties&&K.properties,N=L.name("valid");if(H.props!==!0&&!(H.props instanceof X.Name))H.props=(0,G.evaluatedPropsToName)(L,H.props);let{props:Z}=H;V();function V(){for(let T of I){if(M)U(T);if(H.allErrors)j(T);else L.var(N,!0),j(T),L.if(N)}}function U(T){for(let O in M)if(new RegExp(T).test(O))(0,Y.checkStrictMode)(H,`property ${O} matches pattern ${T} (use allowMatchingProperties)`)}function j(T){L.forIn("key",z,(O)=>{L.if(X._`${(0,Q.usePattern)(F,T)}.test(${O})`,()=>{let w=A.includes(T);if(!w)F.subschema({keyword:"patternProperties",schemaProp:T,dataProp:O,dataPropType:G.Type.Str},N);if(H.opts.unevaluated&&Z!==!0)L.assign(X._`${Z}[${O}]`,!0);else if(!w&&!H.allErrors)L.if((0,X.not)(N),()=>L.break())})})}}};W.default=B}),LM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Y){let{gen:G,schema:B,it:F}=Y;if((0,Q.alwaysValidSchema)(F,B)){Y.fail();return}let L=G.name("valid");Y.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},L),Y.failResult(L,()=>Y.reset(),()=>Y.error())},error:{message:"must NOT be valid"}};W.default=X}),JM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:h6().validateUnion,error:{message:"must match a schema in anyOf"}};W.default=Q}),zM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:G})=>Q._`{passingSchemas: ${G.passing}}`},code(G){let{gen:B,schema:F,parentSchema:L,it:J}=G;if(!Array.isArray(F))throw Error("ajv implementation error");if(J.opts.discriminator&&L.discriminator)return;let z=F,K=B.let("valid",!1),H=B.let("passing",null),D=B.name("_valid");G.setParams({passing:H}),B.block(I),G.result(K,()=>G.reset(),()=>G.error(!0));function I(){z.forEach((A,M)=>{let N;if((0,X.alwaysValidSchema)(J,A))B.var(D,!0);else N=G.subschema({keyword:"oneOf",schemaProp:M,compositeRule:!0},D);if(M>0)B.if(Q._`${D} && ${K}`).assign(K,!1).assign(H,Q._`[${H}, ${M}]`).else();B.if(D,()=>{if(B.assign(K,!0),B.assign(H,M),N)G.mergeEvaluated(N,Q.Name)})})}}};W.default=Y}),KM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:"allOf",schemaType:"array",code(Y){let{gen:G,schema:B,it:F}=Y;if(!Array.isArray(B))throw Error("ajv implementation error");let L=G.name("valid");B.forEach((J,z)=>{if((0,Q.alwaysValidSchema)(F,J))return;let K=Y.subschema({keyword:"allOf",schemaProp:z},L);Y.ok(L),Y.mergeEvaluated(K)})}};W.default=X}),ZM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:B})=>Q.str`must match "${B.ifClause}" schema`,params:({params:B})=>Q._`{failingKeyword: ${B.ifClause}}`},code(B){let{gen:F,parentSchema:L,it:J}=B;if(L.then===void 0&&L.else===void 0)(0,X.checkStrictMode)(J,'"if" without "then" and "else" is ignored');let z=G(J,"then"),K=G(J,"else");if(!z&&!K)return;let H=F.let("valid",!0),D=F.name("_valid");if(I(),B.reset(),z&&K){let M=F.let("ifClause");B.setParams({ifClause:M}),F.if(D,A("then",M),A("else",M))}else if(z)F.if(D,A("then"));else F.if((0,Q.not)(D),A("else"));B.pass(H,()=>B.error(!0));function I(){let M=B.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},D);B.mergeEvaluated(M)}function A(M,N){return()=>{let Z=B.subschema({keyword:M},D);if(F.assign(H,D),B.mergeValidEvaluated(Z,H),N)F.assign(N,Q._`${M}`);else B.setParams({ifClause:M})}}}};function G(B,F){let L=B.schema[F];return L!==void 0&&!(0,X.alwaysValidSchema)(B,L)}W.default=Y}),HM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Y,parentSchema:G,it:B}){if(G.if===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "if" is ignored`)}};W.default=X}),iZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=cZ(),X=QM(),Y=pZ(),G=XM(),B=YM(),F=b7(),L=GM(),J=dZ(),z=BM(),K=FM(),H=LM(),D=JM(),I=zM(),A=KM(),M=ZM(),N=HM();function Z(V=!1){let U=[H.default,D.default,I.default,A.default,M.default,N.default,L.default,J.default,F.default,z.default,K.default];if(V)U.push(X.default,G.default);else U.push(Q.default,Y.default);return U.push(B.default),U}W.default=Z}),$M=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must match format "${Y}"`,params:({schemaCode:Y})=>Q._`{format: ${Y}}`},code(Y,G){let{gen:B,data:F,$data:L,schema:J,schemaCode:z,it:K}=Y,{opts:H,errSchemaPath:D,schemaEnv:I,self:A}=K;if(!H.validateFormats)return;if(L)M();else N();function M(){let Z=B.scopeValue("formats",{ref:A.formats,code:H.code.formats}),V=B.const("fDef",Q._`${Z}[${z}]`),U=B.let("fType"),j=B.let("format");B.if(Q._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>B.assign(U,Q._`${V}.type || "string"`).assign(j,Q._`${V}.validate`),()=>B.assign(U,Q._`"string"`).assign(j,V)),Y.fail$data((0,Q.or)(T(),O()));function T(){if(H.strictSchema===!1)return Q.nil;return Q._`${z} && !${j}`}function O(){let w=I.$async?Q._`(${V}.async ? await ${j}(${F}) : ${j}(${F}))`:Q._`${j}(${F})`,R=Q._`(typeof ${j} == "function" ? ${w} : ${j}.test(${F}))`;return Q._`${j} && ${j} !== true && ${U} === ${G} && !${R}`}}function N(){let Z=A.formats[J];if(!Z){T();return}if(Z===!0)return;let[V,U,j]=O(Z);if(V===G)Y.pass(w());function T(){if(H.strictSchema===!1){A.logger.warn(R());return}throw Error(R());function R(){return`unknown format "${J}" ignored in schema at path "${D}"`}}function O(R){let k=R instanceof RegExp?(0,Q.regexpCode)(R):H.code.formats?Q._`${H.code.formats}${(0,Q.getProperty)(J)}`:void 0,l=B.scopeValue("formats",{key:J,ref:R,code:k});if(typeof R=="object"&&!(R instanceof RegExp))return[R.type||"string",R.validate,Q._`${l}.validate`];return["string",R,l]}function w(){if(typeof Z=="object"&&!(Z instanceof RegExp)&&Z.async){if(!I.$async)throw Error("async format in sync schema");return Q._`await ${j}(${F})`}return typeof U=="function"?Q._`${j}(${F})`:Q._`${j}.test(${F})`}}}};W.default=X}),nZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=[$M().default];W.default=Q}),rZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.contentVocabulary=W.metadataVocabulary=void 0,W.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],W.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),UM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=lZ(),X=mZ(),Y=iZ(),G=nZ(),B=rZ(),F=[Q.default,X.default,(0,Y.default)(),G.default,B.metadataVocabulary,B.contentVocabulary];W.default=F}),AM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.DiscrError=void 0;var Q;(function(X){X.Tag="tag",X.Mapping="mapping"})(Q||(W.DiscrError=Q={}))}),oZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=AM(),Y=MX(),G=tW(),B=v0(),F={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:L,tagName:J}})=>L===X.DiscrError.Tag?`tag "${J}" must be string`:`value of tag "${J}" must be in oneOf`,params:({params:{discrError:L,tag:J,tagName:z}})=>Q._`{error: ${L}, tag: ${z}, tagValue: ${J}}`},code(L){let{gen:J,data:z,schema:K,parentSchema:H,it:D}=L,{oneOf:I}=H;if(!D.opts.discriminator)throw Error("discriminator: requires discriminator option");let A=K.propertyName;if(typeof A!="string")throw Error("discriminator: requires propertyName");if(K.mapping)throw Error("discriminator: mapping is not supported");if(!I)throw Error("discriminator: requires oneOf keyword");let M=J.let("valid",!1),N=J.const("tag",Q._`${z}${(0,Q.getProperty)(A)}`);J.if(Q._`typeof ${N} == "string"`,()=>Z(),()=>L.error(!1,{discrError:X.DiscrError.Tag,tag:N,tagName:A})),L.ok(M);function Z(){let j=U();J.if(!1);for(let T in j)J.elseIf(Q._`${N} === ${T}`),J.assign(M,V(j[T]));J.else(),L.error(!1,{discrError:X.DiscrError.Mapping,tag:N,tagName:A}),J.endIf()}function V(j){let T=J.name("valid"),O=L.subschema({keyword:"oneOf",schemaProp:j},T);return L.mergeEvaluated(O,Q.Name),T}function U(){var j;let T={},O=R(H),w=!0;for(let _=0;_<I.length;_++){let h=I[_];if((h===null||h===void 0?void 0:h.$ref)&&!(0,B.schemaHasRulesButRef)(h,D.self.RULES)){let p=h.$ref;if(h=Y.resolveRef.call(D.self,D.schemaEnv.root,D.baseId,p),h instanceof Y.SchemaEnv)h=h.schema;if(h===void 0)throw new G.default(D.opts.uriResolver,D.baseId,p)}let d=(j=h===null||h===void 0?void 0:h.properties)===null||j===void 0?void 0:j[A];if(typeof d!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);w=w&&(O||R(h)),k(d,_)}if(!w)throw Error(`discriminator: "${A}" must be required`);return T;function R({required:_}){return Array.isArray(_)&&_.includes(A)}function k(_,h){if(_.const)l(_.const,h);else if(_.enum)for(let d of _.enum)l(d,h);else throw Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function l(_,h){if(typeof _!="string"||_ in T)throw Error(`discriminator: "${A}" values must be unique strings`);T[_]=h}}}};W.default=F}),NM=Y0((W,Q)=>{Q.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),aZ=Y0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv=void 0;let X=uZ(),Y=UM(),G=oZ(),B=NM(),F=["/properties"],L="http://json-schema.org/draft-07/schema";var J=class extends X.default{_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(B,F):B;this.addMetaSchema(I,L,!1),this.refs["http://json-schema.org/schema"]=L}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(L)?L:void 0)}};W.Ajv=J,Q.exports=W=J,Q.exports.Ajv=J,Object.defineProperty(W,"__esModule",{value:!0}),W.default=J;var z=sW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return z.KeywordCxt}});var K=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return K._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return K.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return K.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return K.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return K.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return K.CodeGen}});var H=DX();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return H.default}});var D=tW();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return D.default}})}),sZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicAnchor=void 0;let Q=I0(),X=x6(),Y=MX(),G=R7(),B={keyword:"$dynamicAnchor",schemaType:"string",code:(J)=>F(J,J.schema)};function F(J,z){let{gen:K,it:H}=J;H.schemaEnv.root.dynamicAnchors[z]=!0;let D=Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(z)}`,I=H.errSchemaPath==="#"?H.validateName:L(J);K.if(Q._`!${D}`,()=>K.assign(D,I))}W.dynamicAnchor=F;function L(J){let{schemaEnv:z,schema:K,self:H}=J.it,{root:D,baseId:I,localRefs:A,meta:M}=z.root,{schemaId:N}=H.opts,Z=new Y.SchemaEnv({schema:K,schemaId:N,root:D,baseId:I,localRefs:A,meta:M});return Y.compileSchema.call(H,Z),(0,G.getValidate)(J,Z)}W.default=B}),tZ=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicRef=void 0;let Q=I0(),X=x6(),Y=R7(),G={keyword:"$dynamicRef",schemaType:"string",code:(F)=>B(F,F.schema)};function B(F,L){let{gen:J,keyword:z,it:K}=F;if(L[0]!=="#")throw Error(`"${z}" only supports hash fragment reference`);let H=L.slice(1);if(K.allErrors)D();else{let A=J.let("valid",!1);D(A),F.ok(A)}function D(A){if(K.schemaEnv.root.dynamicAnchors[H]){let M=J.let("_v",Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(H)}`);J.if(M,I(M,A),I(K.validateName,A))}else I(K.validateName,A)()}function I(A,M){return M?()=>J.block(()=>{(0,Y.callRef)(F,A),J.let(M,!0)}):()=>(0,Y.callRef)(F,A)}}W.dynamicRef=B,W.default=G}),VM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=sZ(),X=v0(),Y={keyword:"$recursiveAnchor",schemaType:"boolean",code(G){if(G.schema)(0,Q.dynamicAnchor)(G,"");else(0,X.checkStrictMode)(G.it,"$recursiveAnchor: false is ignored")}};W.default=Y}),wM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=tZ(),X={keyword:"$recursiveRef",schemaType:"string",code:(Y)=>(0,Q.dynamicRef)(Y,Y.schema)};W.default=X}),DM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=sZ(),X=tZ(),Y=VM(),G=wM(),B=[Q.default,X.default,Y.default,G.default];W.default=B}),MM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=b7(),X={keyword:"dependentRequired",type:"object",schemaType:"object",error:Q.error,code:(Y)=>(0,Q.validatePropertyDeps)(Y)};W.default=X}),jM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=b7(),X={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(Y)=>(0,Q.validateSchemaDeps)(Y)};W.default=X}),OM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:Y,parentSchema:G,it:B}){if(G.contains===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "contains" is ignored`)}};W.default=X}),EM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=MM(),X=jM(),Y=OM(),G=[Q.default,X.default,Y.default];W.default=G}),IM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=x6(),G={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:B})=>Q._`{unevaluatedProperty: ${B.unevaluatedProperty}}`},code(B){let{gen:F,schema:L,data:J,errsCount:z,it:K}=B;if(!z)throw Error("ajv implementation error");let{allErrors:H,props:D}=K;if(D instanceof Q.Name)F.if(Q._`${D} !== true`,()=>F.forIn("key",J,(N)=>F.if(A(D,N),()=>I(N))));else if(D!==!0)F.forIn("key",J,(N)=>D===void 0?I(N):F.if(M(D,N),()=>I(N)));K.props=!0,B.ok(Q._`${z} === ${Y.default.errors}`);function I(N){if(L===!1){if(B.setParams({unevaluatedProperty:N}),B.error(),!H)F.break();return}if(!(0,X.alwaysValidSchema)(K,L)){let Z=F.name("valid");if(B.subschema({keyword:"unevaluatedProperties",dataProp:N,dataPropType:X.Type.Str},Z),!H)F.if((0,Q.not)(Z),()=>F.break())}}function A(N,Z){return Q._`!${N} || !${N}[${Z}]`}function M(N,Z){let V=[];for(let U in N)if(N[U]===!0)V.push(Q._`${Z} !== ${U}`);return(0,Q.and)(...V)}}};W.default=G}),TM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:G}})=>Q.str`must NOT have more than ${G} items`,params:({params:{len:G}})=>Q._`{limit: ${G}}`},code(G){let{gen:B,schema:F,data:L,it:J}=G,z=J.items||0;if(z===!0)return;let K=B.const("len",Q._`${L}.length`);if(F===!1)G.setParams({len:z}),G.fail(Q._`${K} > ${z}`);else if(typeof F=="object"&&!(0,X.alwaysValidSchema)(J,F)){let D=B.var("valid",Q._`${K} <= ${z}`);B.if((0,Q.not)(D),()=>H(D,z)),G.ok(D)}J.items=!0;function H(D,I){B.forRange("i",I,K,(A)=>{if(G.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:X.Type.Num},D),!J.allErrors)B.if((0,Q.not)(D),()=>B.break())})}}};W.default=Y}),RM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=IM(),X=TM(),Y=[Q.default,X.default];W.default=Y}),PM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=lZ(),X=mZ(),Y=iZ(),G=DM(),B=EM(),F=RM(),L=nZ(),J=rZ(),z=[G.default,Q.default,X.default,(0,Y.default)(!0),L.default,J.metadataVocabulary,J.contentVocabulary,B.default,F.default];W.default=z}),bM=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),SM=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),qM=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),CM=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),kM=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),vM=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),yM=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),_M=Y0((W,Q)=>{Q.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),gM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=bM(),X=SM(),Y=qM(),G=CM(),B=kM(),F=vM(),L=yM(),J=_M(),z=["/properties"];function K(H){return[Q,X,Y,G,B,D(this,F),L,D(this,J)].forEach((I)=>this.addMetaSchema(I,void 0,!1)),this;function D(I,A){return H?I.$dataMetaSchema(A,z):A}}W.default=K}),fM=Y0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv2020=void 0;let X=uZ(),Y=PM(),G=oZ(),B=gM(),F="https://json-schema.org/draft/2020-12/schema";var L=class extends X.default{constructor(D={}){super({...D,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((D)=>this.addVocabulary(D)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:D,meta:I}=this.opts;if(!I)return;B.default.call(this,D),this.refs["http://json-schema.org/schema"]=F}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(F)?F:void 0)}};W.Ajv2020=L,Q.exports=W=L,Q.exports.Ajv2020=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L;var J=sW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return J.KeywordCxt}});var z=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return z._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return z.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return z.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return z.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return z.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return z.CodeGen}});var K=DX();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return K.default}});var H=tW();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return H.default}})}),xM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatNames=W.fastFormats=W.fullFormats=void 0;function Q(_,h){return{validate:_,compare:h}}W.fullFormats={date:Q(B,F),time:Q(J(!0),z),"date-time":Q(D(!0),I),"iso-time":Q(J(),K),"iso-date-time":Q(D(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Z,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:l,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:U,int32:{type:"number",validate:O},int64:{type:"number",validate:w},float:{type:"number",validate:R},double:{type:"number",validate:R},password:!0,binary:!0},W.fastFormats={...W.fullFormats,date:Q(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,F),time:Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,z),"date-time":Q(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,I),"iso-time":Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,K),"iso-date-time":Q(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,A),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},W.formatNames=Object.keys(W.fullFormats);function X(_){return _%4===0&&(_%100!==0||_%400===0)}let Y=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,G=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B(_){let h=Y.exec(_);if(!h)return!1;let d=+h[1],p=+h[2],z0=+h[3];return p>=1&&p<=12&&z0>=1&&z0<=(p===2&&X(d)?29:G[p])}function F(_,h){if(!(_&&h))return;if(_>h)return 1;if(_<h)return-1;return 0}let L=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function J(_){return function(d){let p=L.exec(d);if(!p)return!1;let z0=+p[1],M0=+p[2],V0=+p[3],P0=p[4],Z0=p[5]==="-"?-1:1,S=+(p[6]||0),v=+(p[7]||0);if(S>23||v>59||_&&!P0)return!1;if(z0<=23&&M0<=59&&V0<60)return!0;let u=M0-v*Z0,E=z0-S*Z0-(u<0?1:0);return(E===23||E===-1)&&(u===59||u===-1)&&V0<61}}function z(_,h){if(!(_&&h))return;let d=new Date("2020-01-01T"+_).valueOf(),p=new Date("2020-01-01T"+h).valueOf();if(!(d&&p))return;return d-p}function K(_,h){if(!(_&&h))return;let d=L.exec(_),p=L.exec(h);if(!(d&&p))return;if(_=d[1]+d[2]+d[3],h=p[1]+p[2]+p[3],_>h)return 1;if(_<h)return-1;return 0}let H=/t|\s/i;function D(_){let h=J(_);return function(p){let z0=p.split(H);return z0.length===2&&B(z0[0])&&h(z0[1])}}function I(_,h){if(!(_&&h))return;let d=new Date(_).valueOf(),p=new Date(h).valueOf();if(!(d&&p))return;return d-p}function A(_,h){if(!(_&&h))return;let[d,p]=_.split(H),[z0,M0]=h.split(H),V0=F(d,z0);if(V0===void 0)return;return V0||z(p,M0)}let M=/\/|:/,N=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Z(_){return M.test(_)&&N.test(_)}let V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function U(_){return V.lastIndex=0,V.test(_)}let j=-2147483648,T=2147483647;function O(_){return Number.isInteger(_)&&_<=T&&_>=j}function w(_){return Number.isInteger(_)}function R(){return!0}let k=/[^\\]\\Z/;function l(_){if(k.test(_))return!1;try{return new RegExp(_),!0}catch(h){return!1}}}),hM=Y0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatLimitDefinition=void 0;let Q=aZ(),X=I0(),Y=X.operators,G={formatMaximum:{okStr:"<=",ok:Y.LTE,fail:Y.GT},formatMinimum:{okStr:">=",ok:Y.GTE,fail:Y.LT},formatExclusiveMaximum:{okStr:"<",ok:Y.LT,fail:Y.GTE},formatExclusiveMinimum:{okStr:">",ok:Y.GT,fail:Y.LTE}},B={message:({keyword:L,schemaCode:J})=>X.str`should be ${G[L].okStr} ${J}`,params:({keyword:L,schemaCode:J})=>X._`{comparison: ${G[L].okStr}, limit: ${J}}`};W.formatLimitDefinition={keyword:Object.keys(G),type:"string",schemaType:"string",$data:!0,error:B,code(L){let{gen:J,data:z,schemaCode:K,keyword:H,it:D}=L,{opts:I,self:A}=D;if(!I.validateFormats)return;let M=new Q.KeywordCxt(D,A.RULES.all.format.definition,"format");if(M.$data)N();else Z();function N(){let U=J.scopeValue("formats",{ref:A.formats,code:I.code.formats}),j=J.const("fmt",X._`${U}[${M.schemaCode}]`);L.fail$data((0,X.or)(X._`typeof ${j} != "object"`,X._`${j} instanceof RegExp`,X._`typeof ${j}.compare != "function"`,V(j)))}function Z(){let U=M.schema,j=A.formats[U];if(!j||j===!0)return;if(typeof j!="object"||j instanceof RegExp||typeof j.compare!="function")throw Error(`"${H}": format "${U}" does not define "compare" function`);let T=J.scopeValue("formats",{key:U,ref:j,code:I.code.formats?X._`${I.code.formats}${(0,X.getProperty)(U)}`:void 0});L.fail$data(V(T))}function V(U){return X._`${U}.compare(${z}, ${K}) ${G[H].fail} 0`}},dependencies:["format"]};let F=(L)=>{return L.addKeyword(W.formatLimitDefinition),L};W.default=F}),uM=Y0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=xM(),Y=hM(),G=I0(),B=new G.Name("fullFormats"),F=new G.Name("fastFormats"),L=(z,K={keywords:!0})=>{if(Array.isArray(K))return J(z,K,X.fullFormats,B),z;let[H,D]=K.mode==="fast"?[X.fastFormats,F]:[X.fullFormats,B];if(J(z,K.formats||X.formatNames,H,D),K.keywords)(0,Y.default)(z);return z};L.get=(z,K="full")=>{let H=(K==="fast"?X.fastFormats:X.fullFormats)[z];if(!H)throw Error(`Unknown format "${z}"`);return H};function J(z,K,H,D){var I,A;(I=(A=z.opts.code).formats)!==null&&I!==void 0||(A.formats=G._`require("ajv-formats/dist/formats").${D}`);for(let M of K)z.addFormat(M,H[M])}Q.exports=W=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L}),lM=aZ(),mM=fM(),cM=YX(uM(),1),pM=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),dM=cM.default;PP=lM.Ajv});var WH=H0(()=>{eZ()});var nM;var QH=H0(()=>{nM=globalThis.crypto?.webcrypto??globalThis.crypto??import("crypto").then((W)=>W.webcrypto)});function q7(W){return`${W.method}\x00${JSON.stringify([W.partition??"",W.params??""])}`}function C7(W,Q){return Q===void 0?W:`${W}\x00${Q}`}function tM(W){let Q;try{Q=JSON.stringify(W)}catch(X){throw TypeError(`cache value is not JSON-serializable: ${X instanceof Error?X.message:String(X)}`)}if(typeof Q!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return Q}function Qj(W,Q){switch(W.kind){case"result":return Xj(W.result,Q);case"rpc-error":return zH(W,Q);case"http-error":return Yj(W,Q);case"network-error":return XH(W.error,Q);case"auth-required":return{kind:"error",error:W.error};case"closed":if(Q.transportKind==="stdio")return{kind:"legacy"};return XH(Error("Connection closed during the version negotiation probe"),Q);case"timeout":if(Q.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new $0(U0.RequestTimeout,`Version negotiation probe timed out after ${W.timeoutMs}ms`,{timeout:W.timeoutMs})}}}function Xj(W,Q){let X=C5(ZX).validateResult("server/discover",W);if(!X.ok)return{kind:"legacy"};let Y=X.value.supportedVersions,G=Q.clientModernVersions.find((B)=>Y.includes(B));if(G!==void 0)return{kind:"modern",version:G,discover:X.value};if(Q.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new KX({supported:[...Y],requested:Q.requestedVersion})}}function zH(W,Q){let{code:X,message:Y,data:G}=W;if(X===eM){let B=Fj(G);if(B===void 0)return{kind:"legacy"};let F=new KX({supported:B,requested:Lj(G)??Q.requestedVersion},Y),L=aW(B),J=Q.clientModernVersions.find((z)=>L.includes(z));if(J!==void 0)return{kind:"corrective",version:J,error:F};if(L.length>0)return{kind:"error",error:F};return Q.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:F}}if(Wj.has(X))return{kind:"legacy"};return{kind:"legacy"}}function Yj(W,Q){let X=Jj(W.body);if(X!==void 0)return zH(X,Q);return{kind:"legacy"}}function XH(W,Q){if(Q.environment==="browser"&&Gj(W))return{kind:"legacy"};return{kind:"error",error:new $0(U0.EraNegotiationFailed,`Version negotiation probe failed: ${Bj(W)}`,{cause:W})}}function Gj(W){return W instanceof TypeError||W instanceof Error&&W.name==="TypeError"}function Bj(W){return W instanceof Error?W.message:String(W)}function Fj(W){if(typeof W!=="object"||W===null)return;let Q=W.supported;if(!Array.isArray(Q)||Q.length===0||!Q.every((X)=>typeof X==="string"))return;return Q}function Lj(W){if(typeof W!=="object"||W===null)return;let Q=W.requested;return typeof Q==="string"?Q:void 0}function Jj(W){if(W===void 0||W==="")return;let Q;try{Q=JSON.parse(W)}catch{return}if(typeof Q!=="object"||Q===null)return;let X=Q.error;if(typeof X!=="object"||X===null)return;let{code:Y,message:G,data:B}=X;if(typeof Y!=="number")return;return{code:Y,message:typeof G==="string"?G:"",data:B}}function Kj(W,Q){let X=W?.mode??zj;if(X==="legacy")return{kind:"legacy"};let Y=W?.probe??{};if(typeof X==="object"){if(!Q4(X.pin))throw TypeError(`versionNegotiation: { pin: '${X.pin}' } is not a modern protocol revision \u2014 pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:X.pin,probe:Y}}let G=Q?aW(Q):[];return{kind:"auto",modernVersions:G.length>0?G:[...H7],fallbackAvailable:Q?$7(Q).length>0:!0,probe:Y}}function YH(){let W=globalThis;return W.window!==void 0&&W.document!==void 0?"browser":"node"}function GH(W){return"stderr"in W&&"pid"in W?"stdio":"http"}function BH(W){let Q=k7.get(W);k7.delete(W),Q?.()}function Hj(W,Q,X,Y){return{jsonrpc:"2.0",id:W,method:"server/discover",params:{_meta:C5(Q).outboundEnvelope({protocolVersion:Q,clientInfo:X,clientCapabilities:Y})}}}function $j(W,Q){switch(W.kind){case"response":return W.error===void 0?{kind:"result",result:W.result}:{kind:"rpc-error",...W.error};case"send-error":{let X=W.error;if(X instanceof sK){let Y=X.data?.text;return{kind:"http-error",status:X.data.status,body:typeof Y==="string"?Y:void 0}}if(X instanceof rM||X instanceof Error&&X.name==="UnauthorizedError")return{kind:"auth-required",error:X};return{kind:"network-error",error:X}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:Q}}}async function KH(W,Q){let X=W.probe.timeoutMs??Q.defaultTimeoutMs,Y=Math.max(0,W.probe.maxRetries??0),G=W.kind==="pin"?[W.version]:W.modernVersions,B=W.kind==="auto"&&W.fallbackAvailable,F=await Zj.open(Q.transport),L=async()=>{let z=G[0],K=!1,H=Y;for(;;){let D=await F.exchange((M)=>Hj(M,z,Q.clientInfo,Q.capabilities),X);if(D.kind==="timeout"&&H>0){H--;continue}let I=$j(D,X),A=Qj(I,{clientModernVersions:G,requestedVersion:z,fallbackAvailable:B,environment:Q.environment,transportKind:Q.transportKind});switch(A.kind){case"modern":return{era:"modern",version:A.version,discover:A.discover};case"corrective":if(K)throw A.error;K=!0,z=A.version;continue;case"legacy":{let M=I.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(W.kind==="pin")throw new $0(U0.EraNegotiationFailed,M===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${W.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${M} before the server offered pinned protocol version ${W.version} (no fallback in pin mode)`);if(!W.fallbackAvailable)throw new $0(U0.EraNegotiationFailed,M===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${M} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(M!==void 0&&Q.disposableProbe!==!0)throw new $0(U0.EraNegotiationFailed,`Version negotiation failed: ${M} (this transport probed in place \u2014 the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw A.error}}},J;try{J=await L()}catch(z){throw F.detach(),z}return F.release(),J}function Uj(W){let Q=Object.getPrototypeOf(W);if(Q===null||!Object.prototype.hasOwnProperty.call(Q,"_dispose"))return;let X=W._serverParams;return typeof X==="object"&&X!==null&&typeof X.command==="string"?X:void 0}async function Aj(W,Q,X,Y){let B=new Q.constructor({...X,stderr:"ignore"}),F=Q.close,L=!1,J,z=new Promise((H,D)=>{J=()=>D(FH())});Q.close=async function(){return L=!0,J?.(),F.call(Q)};let K;try{let H=KH(W,{...Y,transport:B,transportKind:"stdio",disposableProbe:!0});H.catch(()=>{}),K=await Promise.race([H,z])}finally{await Nj(B),Q.close=F}if(L)throw FH();return K}function FH(){return new $0(U0.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function Nj(W){try{let Q=W._dispose;await(typeof Q==="function"?Q.call(W):W.close())}catch{}}function LH(W){let Q=W._meta?.[N1];return SZ.Implementation(Q)?Q:void 0}function OX(W,Q){if(!W||Q===null||typeof Q!=="object")return;if(W.type==="object"&&W.properties&&typeof W.properties==="object"){let X=Q,Y=W.properties;for(let G of Object.keys(Y)){let B=Y[G];if(X[G]===void 0&&Object.prototype.hasOwnProperty.call(B,"default"))X[G]=B.default;if(X[G]!==void 0)OX(B,X[G])}}if(Array.isArray(W.anyOf)){for(let X of W.anyOf)if(typeof X!=="boolean")OX(X,Q)}if(Array.isArray(W.oneOf)){for(let X of W.oneOf)if(typeof X!=="boolean")OX(X,Q)}}function Vj(W){if(!W)return{supportsFormMode:!1,supportsUrlMode:!1};let Q=W.form!==void 0,X=W.url!==void 0;return{supportsFormMode:Q||!Q&&!X,supportsUrlMode:X}}function wj(W){if(typeof W==="object"&&W!==null){if(W.kind==="legacy"&&!("supportedVersions"in W)&&!("discover"in W))return W;if(W.kind==="modern"&&S5.safeParse(W.discover).success)return W}throw new $0(U0.EraNegotiationFailed,"connect({ prior }): unrecognized prior \u2014 expected { kind: 'modern', discover } or { kind: 'legacy' }")}var eW,lb,mb,cb,pb,db,rM,jX,oM=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(W){this._maxEntries=W?.maxEntries??512}get size(){return this._entries.size}get(W){return this._entries.get(q7(W))}set(W,Q){let X=q7(W),Y=jX.has(W.method),G=!this._entries.has(X);if(!Y&&G&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let F of this._entries.keys())if(!jX.has(F.slice(0,F.indexOf("\x00")))){this._entries.delete(F),this._cappedSize--;break}}let B=++this._stamp;if(this._entries.set(X,{...Q,stamp:B}),G&&!Y)this._cappedSize++;return B}delete(W){if(this._entries.delete(q7(W))&&!jX.has(W.method))this._cappedSize--}evict(W){let Q=`${W}\x00`,X=jX.has(W);for(let Y of this._entries.keys())if(Y.startsWith(Q)){if(this._entries.delete(Y),!X)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}},aM=86400000,sM=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(W,Q,X=()=>{},Y="",G=Date.now){this._store=W,this._isUserSupplied=Q,this._reportError=X,this._cachePartition=Y,this._now=G}now(){return this._now()}setServerIdentity(W){this._serverIdentity=W}_partitionFor(W){return JSON.stringify([this._serverIdentity,W==="public"?"":this._cachePartition])}async _probe(W,Q){let X={method:W,params:Q??""},Y=this._partitionFor("private"),G=await this._store.get({...X,partition:Y});if(G!==void 0)return G;let B=this._partitionFor("public");if(B===Y)return;let F=await this._store.get({...X,partition:B});return F?.scope==="public"?F:void 0}async evict(W){this._evictionGeneration.set(W,(this._evictionGeneration.get(W)??0)+1),await this._deleteBoth(W,"")}async _deleteBoth(W,Q){let X=this._partitionFor("private"),Y=this._partitionFor("public");try{await this._store.delete({method:W,params:Q,partition:X})}catch(G){this._reportError(G)}if(Y!==X)try{await this._store.delete({method:W,params:Q,partition:Y})}catch(G){this._reportError(G)}}async evictKey(W,Q){let X=C7(W,Q),Y=this._evictionGeneration.get(X);if(Y!==void 0)this._evictionGeneration.set(X,Y+1);await this._deleteBoth(W,Q)}captureGeneration(W,Q){let X=C7(W,Q),Y=this._evictionGeneration.get(X)??0;return this._evictionGeneration.set(X,Y),Y}async write(W,Q,X,Y){if((this._evictionGeneration.get(C7(W,Y?.params))??0)!==X)return;let G=Y?.params??"",B=this._partitionFor("private"),F=this._partitionFor("public"),L=(Y?.scope??"private")==="public"?F:B;try{await this._store.set({method:W,params:G,partition:L},{value:tM(Q),expiresAt:Y?.expiresAt,scope:Y?.scope})}catch(J){this._reportError(J)}if(F!==B)try{await this._store.delete({method:W,params:G,partition:L===B?F:B})}catch(J){this._reportError(J)}}async read(W,Q){let X=await this._probe(W,Q);if(X?.expiresAt===void 0||!(X.expiresAt>this.now()))return;try{let Y=JSON.parse(X.value);if(typeof Y!=="object"||Y===null||Array.isArray(Y))throw TypeError("cached document is not an object");return{value:Y}}catch(Y){this._reportError(Y),await this._deleteBoth(W,Q??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(W){let Q=await this._probe("tools/list");if(Q===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==Q.stamp){let X=this._decodeListTools(Q),Y=new Map;if(X!==void 0)for(let G of X.tools)Y.set(G.name,G);this._toolIndex={stamp:Q.stamp,byName:Y}}return this._toolIndex.byName.get(W)}async outputValidator(W,Q){let X=await this._probe("tools/list");if(X===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==X.stamp){let Y=this._decodeListTools(X)??{tools:[]},G=new Map;for(let B of Y.tools){let F=Q(B);if(F!==void 0)G.set(B.name,F)}this._toolOutputValidatorIndex={stamp:X.stamp,byName:G}}return this._toolOutputValidatorIndex.byName.get(W)}_decodeListTools(W){try{let Q=JSON.parse(W.value);if(!Array.isArray(Q?.tools)||!Q.tools.every((X)=>X!==null&&typeof X==="object"))throw TypeError("cached tools/list document has a malformed tools array");return Q}catch(Q){this._reportError(Q);return}}},eM=-32022,Wj,zj="legacy",Zj=class W{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(Q){this._transport=Q,this._savedOnMessage=Q.onmessage,this._savedOnError=Q.onerror,this._savedOnClose=Q.onclose}static async open(Q){let X=new W(Q);Q.onmessage=(Y)=>{let G=X._pending;if(G!==void 0&&(rW(Y)||HX(Y))&&Y.id===G.id){if(X._pending=void 0,rW(Y))G.resolve({kind:"response",result:Y.result});else G.resolve({kind:"response",error:Y.error});return}},Q.onerror=(Y)=>{X._savedOnError?.(Y)},Q.onclose=()=>{let Y=X._pending;if(Y!==void 0)X._pending=void 0,Y.resolve({kind:"closed"});X._closeDelivered=!0,X._savedOnClose?.()};try{await Q.start()}catch(Y){throw X.detach(),Y}return X}async exchange(Q,X){let Y=`server-discover-probe-${++this._probeCounter}`;return new Promise((G)=>{let B=!1,F=(J)=>{if(B)return;if(B=!0,clearTimeout(L),this._pending?.id===Y)this._pending=void 0;G(J)},L=setTimeout(()=>F({kind:"timeout"}),X);this._pending={id:Y,resolve:F},this._transport.send(Q(Y)).catch((J)=>F({kind:"send-error",error:J}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let Q=this._savedOnClose,X=this._transport,Y=!1,G=()=>{if(!Y){Y=!0;return}Q()};X.onclose=G,k7.set(X,()=>{if(X.onclose===G)X.onclose=Q})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let Q=this._transport,X=Q.start,Y=!0;Q.start=async function(){if(Y){Y=!1,Q.start=X;return}return X.call(Q)}}},k7,JH,Dj=64,ZH,ib;var HH=H0(()=>{T7();WH();QH();eW=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](W){return r1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r1(this,W)}constructor(W){super(W);this.name=new.target.name,S4(this,new.target)}},lb=class extends eW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(W,Q,X){super(`Issuer mismatch in ${W==="metadata"?"authorization server metadata (RFC 8414 \xA73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(Q)}, received ${JSON.stringify(X)}`);this.kind=W,this.expected=Q,this.received=X}},mb=class extends eW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(W){super(`Dynamic Client Registration rejected (HTTP ${W.status}): ${W.body}`);this.status=W.status,this.body=W.body,this.submittedMetadata=W.submittedMetadata}},cb=class extends eW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(W){super(`Refusing to send credentials to non-https token endpoint '${W}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=W}},pb=class extends eW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(W,Q){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(W)}, callback resolved ${JSON.stringify(Q)}); refusing to send authorization_code/code_verifier to a different token endpoint`);this.recordedIssuer=W,this.currentIssuer=Q}},db=class extends eW{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(W){super(`Insufficient scope${W.requiredScope?`: required "${W.requiredScope}"`:""}`);this.requiredScope=W.requiredScope,this.resourceMetadataUrl=W.resourceMetadataUrl,this.errorDescription=W.errorDescription}},rM=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](W){return r1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r1(this,W)}constructor(W){super(W??"Unauthorized");this.name="UnauthorizedError",S4(this,new.target)}},jX=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);Wj=new Set([-32001,-32020,-32021]);k7=new WeakMap;JH={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},ZH=class extends qZ{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let W=new $0(U0.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let Q of this._listenState.values())Q.settle({cause:"remote",error:W})}this._listenState.clear();for(let W of this._listChangedDebounceTimers.values())clearTimeout(W);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(W,Q){super(Q);if(this._clientInfo=W,this._capabilities=Q?.capabilities?{...Q.capabilities}:{},this._jsonSchemaValidator=Q?.jsonSchemaValidator??new S7,this._enforceStrictCapabilities=Q?.enforceStrictCapabilities??!1,this._versionNegotiation=Q?.versionNegotiation,this._supportedProtocolVersionsOption=Q?.supportedProtocolVersions,this._inputRequiredDriverConfig=TZ(Q?.inputRequired),this._cache=new sM(Q?.responseCacheStore??new oM,Q?.responseCacheStore!==void 0,(X)=>this._reportStoreError(X),Q?.cachePartition??""),this._defaultCacheTtlMs=Q?.defaultCacheTtlMs??0,this._listMaxPages=Q?.listMaxPages??Dj,Q?.listChanged)this._listChangedConfig=Q.listChanged}buildContext(W,Q){return W}_shouldDropInbound(W){if(this._negotiatedProtocolVersion!==void 0&&Q4(this._negotiatedProtocolVersion)&&D7(W))return"drop"}_outboundMetaEnvelope(){let W=this._negotiatedProtocolVersion;if(W===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:W,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(W,Q){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new $0(U0.UnsupportedResultType,`Unsupported result type 'input_required' for ${Q.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance \u2014 pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:Q.request.method}));return kZ({getRequestHandler:(X)=>this._getRequestHandler(X),buildContext:(X)=>this.buildContext(X,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,W,Q)}_setupListChangedHandlers(W){if(W.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",W.tools,async()=>{return(await this.listTools(void 0,{cacheMode:"refresh"})).tools});if(W.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",W.prompts,async()=>{return(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts});if(W.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",W.resources,async()=>{return(await this.listResources(void 0,{cacheMode:"refresh"})).resources})}registerCapabilities(W){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=CZ(this._capabilities,W)}setVersionNegotiation(W){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=W}_wrapHandler(W,Q){if(W==="elicitation/create")return async(X,Y)=>{let G=C5(this._negotiatedProtocolVersion),B=G.validateRequest("elicitation/create",X);if(!B.ok&&B.reason==="not-in-era")B=G.validateInputRequest("elicitation/create",X);if(!B.ok)throw new l0(B.reason==="not-in-era"?D0.InternalError:D0.InvalidParams,B.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${B.message}`);let{params:F}=B.value;F.mode=F.mode??"form";let{supportsFormMode:L,supportsUrlMode:J}=Vj(this._capabilities.elicitation);if(F.mode==="form"&&!L)throw new l0(D0.InvalidParams,"Client does not support form-mode elicitation requests");if(F.mode==="url"&&!J)throw new l0(D0.InvalidParams,"Client does not support URL-mode elicitation requests");let z=await Q(X,Y),K=G.validateResult("elicitation/create",z);if(!K.ok&&K.reason==="not-in-era")K=G.validateInputResponse("elicitation/create",z);if(!K.ok)throw new l0(K.reason==="not-in-era"?D0.InternalError:D0.InvalidParams,K.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${K.message}`);let H=K.value,D=F.mode==="form"?F.requestedSchema:void 0;if(F.mode==="form"&&H.action==="accept"&&H.content&&D&&this._capabilities.elicitation?.form?.applyDefaults)try{OX(D,H.content)}catch{}return H};if(W==="sampling/createMessage")return async(X,Y)=>{let G=C5(this._negotiatedProtocolVersion),B=G.validateRequest("sampling/createMessage",X);if(!B.ok&&B.reason==="not-in-era")B=G.validateInputRequest("sampling/createMessage",X);if(!B.ok)throw new l0(B.reason==="not-in-era"?D0.InternalError:D0.InvalidParams,B.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${B.message}`);let{params:F}=B.value,L=await Q(X,Y),J=Boolean(F.tools||F.toolChoice),z=G.samplingResultVariant(J,L);if(!z.ok&&z.reason==="not-in-era")z=G.validateInputResponse("sampling/createMessage",L);if(!z.ok)throw new l0(z.reason==="not-in-era"?D0.InternalError:D0.InvalidParams,z.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${z.message}`);return z.value};return Q}assertCapability(W,Q){if(!this._serverCapabilities?.[W])throw new $0(U0.CapabilityNotSupported,`Server does not support ${W} (required for ${Q})`)}async connect(W,Q){if(Q?.prior!=null)return this._connectFromPrior(W,wj(Q.prior),Q);let X=Kj(this._versionNegotiation,this._supportedProtocolVersionsOption);if(X.kind!=="legacy")return this._connectNegotiated(W,X,Q);return this._connectPlainLegacy(W,Q)}async _connectPlainLegacy(W,Q){if(await super.connect(W),W.sessionId!==void 0){let X=this._negotiatedProtocolVersion;if(X!==void 0)W.setProtocolVersion?.(X);return}this._resetConnectionState(),await this._legacyHandshake(W,Q)}async _legacyHandshake(W,Q){let X=$7(this._supportedProtocolVersions);try{let Y=X[0];if(Y===void 0)throw new $0(U0.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let G=await this.request({method:"initialize",params:{protocolVersion:Y,capabilities:this._capabilities,clientInfo:this._clientInfo}},Q);if(G===void 0)throw Error(`Server sent invalid initialize result: ${G}`);if(!X.includes(G.protocolVersion))throw Error(`Server's protocol version is not supported: ${G.protocolVersion}`);if(this._serverCapabilities=G.capabilities,this._serverVersion=G.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(W)),W.setProtocolVersion)W.setProtocolVersion(G.protocolVersion);if(this._instructions=G.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=G.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(Y){throw this.close(),Y}}async _connectNegotiated(W,Q,X){if(W.sessionId!==void 0){await super.connect(W);let G=this._negotiatedProtocolVersion;if(G!==void 0&&W.setProtocolVersion)W.setProtocolVersion(G);return}this._resetConnectionState();let Y;try{let G=GH(W),B={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:YH(),defaultTimeoutMs:X?.timeout??UX},F=G==="stdio"?Uj(W):void 0;Y=F===void 0?await KH(Q,{...B,transport:W,transportKind:G}):await Aj(Q,W,F,B)}catch(G){throw await W.close().catch(()=>{}),BH(W),G}if(BH(W),await super.connect(W),Y.era==="legacy"){await this._legacyHandshake(W,X);return}if(this._serverCapabilities=Y.discover.capabilities,this._serverVersion=LH(Y.discover),this._cache.setServerIdentity(this._deriveServerIdentity(W)),this._instructions=Y.discover.instructions,this._discoverResult=Y.discover,this._negotiatedProtocolVersion=Y.version,W.setProtocolVersion)W.setProtocolVersion(Y.version);if(this._listChangedConfig){let G=this._listChangedConfig,B=this._serverCapabilities,F={...G.tools&&B?.tools?.listChanged&&{tools:G.tools},...G.prompts&&B?.prompts?.listChanged&&{prompts:G.prompts},...G.resources&&B?.resources?.listChanged&&{resources:G.resources}},L=!0;try{this._setupListChangedHandlers(F)}catch(z){L=!1,this.onerror?.(z instanceof Error?z:Error(String(z)))}let J=L?{...F.tools&&{toolsListChanged:!0},...F.prompts&&{promptsListChanged:!0},...F.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(J).length>0){let z=new AbortController,K=()=>z.abort(X?.signal?.reason);if(X?.signal?.aborted)K();X?.signal?.addEventListener("abort",K);try{this._autoOpenedSubscription=await this.listen(J,{timeout:X?.timeout,signal:z.signal})}catch(H){if(X?.signal?.aborted)throw await this.close().catch(()=>{}),H;this.onerror?.(H instanceof Error?H:Error(String(H)))}finally{X?.signal?.removeEventListener("abort",K)}}}}async _connectFromPrior(W,Q,X){if(Q.kind==="legacy")return this._connectPlainLegacy(W,X);let Y=Q.discover;this._resetConnectionState();let G=this._supportedProtocolVersionsOption,B=(G&&aW(G).length>0?aW(G):H7).find((F)=>Y.supportedVersions.includes(F));if(B===void 0)throw new $0(U0.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(W),this._discoverResult=Y,this._serverCapabilities=Y.capabilities,this._serverVersion=LH(Y),this._cache.setServerIdentity(this._deriveServerIdentity(W)),this._instructions=Y.instructions,this._negotiatedProtocolVersion=B,W.setProtocolVersion?.(B),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(F){this.onerror?.(F instanceof Error?F:Error(String(F)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(W){let Q=this._serverVersion;if(Q!==void 0)return`${Q.name}@${Q.version}`;return W.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let W=this._negotiatedProtocolVersion;if(W===void 0)return;return Q4(W)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(W){switch(W){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new $0(U0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new $0(U0.CapabilityNotSupported,`Server does not support prompts (required for ${W})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new $0(U0.CapabilityNotSupported,`Server does not support resources (required for ${W})`);if(W==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new $0(U0.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${W})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new $0(U0.CapabilityNotSupported,`Server does not support tools (required for ${W})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new $0(U0.CapabilityNotSupported,`Server does not support completions (required for ${W})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(W){switch(W){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new $0(U0.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${W})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(W){switch(W){case"sampling/createMessage":if(!this._capabilities.sampling)throw new $0(U0.CapabilityNotSupported,`Client does not support sampling capability (required for ${W})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new $0(U0.CapabilityNotSupported,`Client does not support elicitation capability (required for ${W})`);break;case"roots/list":if(!this._capabilities.roots)throw new $0(U0.CapabilityNotSupported,`Client does not support roots capability (required for ${W})`);break;case"ping":break}}async ping(W){return this.request({method:"ping"},W)}async discover(W){let Q=await this._requestWithSchema({method:"server/discover"},S5,W);return this._discoverResult=Q,Q}async complete(W,Q){return this.request({method:"completion/complete",params:W},Q)}async setLoggingLevel(W,Q){return this.request({method:"logging/setLevel",params:{level:W}},Q)}async getPrompt(W,Q){return this.request({method:"prompts/get",params:W},Q)}async listPrompts(W,Q){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(W?.cursor!==void 0)return this.request({method:"prompts/list",params:W},Q);let X=await this._serveFromCache("prompts/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("prompts/list",W,Q,(Y,G)=>Y.prompts.push(...G.prompts))}async listResources(W,Q){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(W?.cursor!==void 0)return this.request({method:"resources/list",params:W},Q);let X=await this._serveFromCache("resources/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("resources/list",W,Q,(Y,G)=>Y.resources.push(...G.resources))}async listResourceTemplates(W,Q){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(W?.cursor!==void 0)return this.request({method:"resources/templates/list",params:W},Q);let X=await this._serveFromCache("resources/templates/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("resources/templates/list",W,Q,(Y,G)=>Y.resourceTemplates.push(...G.resourceTemplates))}async _listAllPages(W,Q,X,Y,G){let B=X?.cacheMode==="bypass",F=this._cache.captureGeneration(W),L=await this.request({method:W,...Q&&{params:{...Q}}},X),J=L.nextCursor,z=new Set,K=1;while(J!==void 0&&!z.has(J)){if(this._listMaxPages!==0&&K>=this._listMaxPages)throw new $0(U0.ListPaginationExceeded,`${W}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:W,listMaxPages:this._listMaxPages});z.add(J);let H=await this.request({method:W,params:{...Q,cursor:J}},X);Y(L,H),J=H.nextCursor,K++}if(delete L.nextCursor,G?.(L),B)return L;return await this._cache.write(W,L,F,this._freshness(L)),L}_freshness(W,Q){let X=W,Y=typeof X.ttlMs==="number"?X.ttlMs:this._defaultCacheTtlMs,G=X.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,Y),aM),scope:G,params:Q}}async _serveFromCache(W,Q,X){if(X?.cacheMode==="bypass"||X?.cacheMode==="refresh")return;let Y=await this._cache.read(W,Q).catch((G)=>void this._reportStoreError(G));if(Y!==void 0){if(X?.signal?.aborted){let G=X.signal.reason;throw G instanceof $0?G:new $0(U0.RequestTimeout,String(G))}return Y.value}}_reportStoreError(W){this.onerror?.(W instanceof Error?W:Error(String(W)))}_compileOutputValidator(W){if(!W.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(W.outputSchema)}}catch(Q){return{ok:!1,compileError:Q}}}async _resolveXMcpHeaderScan(W,Q){let X=Q??await this._cache.toolDefinition(W);return X===void 0?void 0:M7(X.inputSchema)}async readResource(W,Q){let X=await this._serveFromCache("resources/read",W.uri,Q);if(X!==void 0)return X;let Y=this._cache.captureGeneration("resources/read",W.uri),G=await this.request({method:"resources/read",params:W},Q);if(Q?.cacheMode!=="bypass"){let B=this._freshness(G,W.uri);if(B.expiresAt>this._cache.now())await this._cache.write("resources/read",G,Y,B);else if(Q?.cacheMode==="refresh")await this._cache.evictKey("resources/read",W.uri)}return G}async subscribeResource(W,Q){return this.request({method:"resources/subscribe",params:W},Q)}async unsubscribeResource(W,Q){return this.request({method:"resources/unsubscribe",params:W},Q)}async listen(W,Q){if(this.transport===void 0)throw new $0(U0.NotConnected,"Not connected");let X=this._negotiatedProtocolVersion;if(X===void 0||!Q4(X))throw new $0(U0.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${X??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:X});if(Q?.signal?.aborted){let V=Q.signal.reason;throw V instanceof $0?V:new $0(U0.RequestTimeout,String(V))}let Y=new AbortController,G=`listen:${this._nextListenId++}`,B="opening",F,L,J,z,K=new Promise((V,U)=>{J=V,z=U}),H,D=new Promise((V)=>{H=V}),I=(V)=>{if(B==="closed")return;let U=B==="opening";if(F!==void 0)clearTimeout(F),F=void 0;if("ack"in V){B="open",J(V.ack);return}if(B="closed",L!==void 0)Q?.signal?.removeEventListener("abort",L);if(this._listenState.delete(G),Y.abort(),H(V.cause),U)z(V.error??new $0(U0.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},A=async()=>{Y.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:G}}).catch(()=>{})},M=async()=>{if(B==="closed")return;I({cause:"local"}),await A()};this._listenState.set(G,{settle:I});let N=Q?.timeout??UX;if(F=setTimeout(()=>{I({cause:"remote",error:new $0(U0.RequestTimeout,"subscriptions/listen ack timed out",{timeout:N})}),A().catch(()=>{})},N),Q?.signal){let V=Q.signal;L=()=>{if(B==="closed")return;let U=V.reason;I({cause:"local",error:U instanceof Error?U:Error(String(U??"Aborted"))}),A().catch(()=>{})},V.addEventListener("abort",L,{once:!0})}let Z={jsonrpc:"2.0",id:G,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:W}};try{await this.transport.send(Z,{requestSignal:Y.signal,onRequestStreamEnd:()=>I({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(V){I({cause:"remote",error:V instanceof Error?V:Error(String(V))})}return{honoredFilter:await K,close:M,closed:D}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(W,Q){let X=Object.hasOwn(JH,W.method)?JH[W.method]:void 0;if(W.method==="notifications/resources/updated"){let Y=W.params?.uri;if(typeof Y==="string")this._cache.evictKey("resources/read",Y)}else if(X!==void 0)for(let Y of X)this._cache.evict(Y);if(W.method==="notifications/subscriptions/acknowledged"){let Y=W.params?._meta?.[x5],G=typeof Y==="string"?this._listenState.get(Y):void 0;if(G!==void 0){let B=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",W);G.settle({ack:B.ok?B.value.params.notifications:{}});return}}if(W.method==="notifications/cancelled"){let Y=W.params?.requestId,G=typeof Y==="string"?this._listenState.get(Y):void 0;if(G!==void 0){G.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(W,Q)}_onresponse(W){let Q=W.id,X=typeof Q==="string"?this._listenState.get(Q):void 0;if(X!==void 0){if(HX(W))X.settle({cause:"remote",error:l0.fromError(W.error.code,W.error.message,W.error.data)});else X.settle({cause:"graceful",error:new $0(U0.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(W)}_onclose(){if(this._listenState.size>0){let W=new $0(U0.ConnectionClosed,"Connection closed");for(let Q of this._listenState.values())Q.settle({cause:"remote",error:W});this._listenState.clear()}super._onclose()}async callTool(W,Q){let X=this.getProtocolEra()==="modern"&&YH()!=="browser",Y=async()=>{if(!X)return Q;let J;try{J=await this._resolveXMcpHeaderScan(W.name,Q?.toolDefinition)}catch(K){this._reportStoreError(K)}if(!J?.valid||J.declarations.length===0)return Q;let z=EZ(J.declarations,W.arguments);return Object.keys(z).length===0?Q:{...Q,headers:{...Q?.headers,...z}}},G=Q?.toolDefinition===void 0?await this._cache.outputValidator(W.name,(J)=>this._compileOutputValidator(J)).catch((J)=>void this._reportStoreError(J)):this._compileOutputValidator(Q.toolDefinition),B=()=>{if(G===void 0||G.ok)return;let J=G.compileError,z=(J instanceof Error?J.message:String(J)).slice(0,200);throw new l0(D0.InvalidParams,`Tool '${W.name}' has an invalid outputSchema: ${z}`)};B();let F;try{F=await this.request({method:"tools/call",params:W},await Y())}catch(J){let z=J instanceof l0&&J.code===x9;if(!X||!z||Q?.toolDefinition!==void 0)throw J;let K={signal:Q?.signal,timeout:Q?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,K).catch((H)=>this._reportStoreError(H)),G=await this._cache.outputValidator(W.name,(H)=>this._compileOutputValidator(H)).catch((H)=>void this._reportStoreError(H)),B(),F=await this.request({method:"tools/call",params:W},await Y())}let L=G!==void 0&&G.ok?G.validator:void 0;if(L){if(F.structuredContent===void 0&&!F.isError)throw new l0(D0.InvalidRequest,`Tool ${W.name} has an output schema but did not return structured content`);if(F.structuredContent!==void 0&&!F.isError)try{let J=L(F.structuredContent);if(!J.valid)throw new l0(D0.InvalidParams,`Structured content does not match the tool's output schema: ${J.errorMessage}`)}catch(J){if(J instanceof l0)throw J;throw new l0(D0.InvalidParams,`Failed to validate structured content: ${J instanceof Error?J.message:String(J)}`)}}return F}async listTools(W,Q){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(W?.cursor!==void 0){let Y=await this.request({method:"tools/list",params:W},Q);return this._excludeInvalidXMcpHeaderTools(Y),Y}let X=await this._serveFromCache("tools/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("tools/list",W,Q,(Y,G)=>Y.tools.push(...G.tools),(Y)=>this._excludeInvalidXMcpHeaderTools(Y))}_excludeInvalidXMcpHeaderTools(W){if(this.getProtocolEra()!=="modern"||!this.transport||GH(this.transport)==="stdio")return;let Q=W.tools.filter((X)=>{let Y=M7(X.inputSchema);if(!Y.valid)return console.warn(`[mcp-sdk] excluding tool '${X.name}' from tools/list: invalid x-mcp-header declaration \u2014 ${Y.reason}`),!1;return!0});if(Q.length!==W.tools.length)W.tools=Q}_setupListChangedHandler(W,Q,X,Y){let G=$X(I4,X);if(!G.success)throw Error(`Invalid ${W} listChanged options: ${G.error.message}`);if(typeof X.onChanged!=="function")throw TypeError(`Invalid ${W} listChanged options: onChanged must be a function`);let{autoRefresh:B,debounceMs:F}=G.data,{onChanged:L}=X,J=async()=>{if(!B){L(null,null);return}try{L(null,await Y())}catch(K){L(K instanceof Error?K:Error(String(K)),null)}},z=()=>{if(F){let K=this._listChangedDebounceTimers.get(W);if(K)clearTimeout(K);let H=setTimeout(J,F);this._listChangedDebounceTimers.set(W,H)}else J()};this.setNotificationHandler(Q,z)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}},ib=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](W){return r1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return r1(this,W)}constructor(W,Q,X){super(`SSE error: ${Q}`);this.code=W,this.event=X,S4(this,new.target)}}});var VH=p1((BS,NH)=>{NH.exports=AH;AH.sync=jj;var $H=N5("fs");function Mj(W,Q){var X=Q.pathExt!==void 0?Q.pathExt:process.env.PATHEXT;if(!X)return!0;if(X=X.split(";"),X.indexOf("")!==-1)return!0;for(var Y=0;Y<X.length;Y++){var G=X[Y].toLowerCase();if(G&&W.substr(-G.length).toLowerCase()===G)return!0}return!1}function UH(W,Q,X){if(!W.isSymbolicLink()&&!W.isFile())return!1;return Mj(Q,X)}function AH(W,Q,X){$H.stat(W,function(Y,G){X(Y,Y?!1:UH(G,W,Q))})}function jj(W,Q){return UH($H.statSync(W),W,Q)}});var OH=p1((FS,jH)=>{jH.exports=DH;DH.sync=Oj;var wH=N5("fs");function DH(W,Q,X){wH.stat(W,function(Y,G){X(Y,Y?!1:MH(G,Q))})}function Oj(W,Q){return MH(wH.statSync(W),Q)}function MH(W,Q){return W.isFile()&&Ej(W,Q)}function Ej(W,Q){var{mode:X,uid:Y,gid:G}=W,B=Q.uid!==void 0?Q.uid:process.getuid&&process.getuid(),F=Q.gid!==void 0?Q.gid:process.getgid&&process.getgid(),L=parseInt("100",8),J=parseInt("010",8),z=parseInt("001",8),K=L|J,H=X&z||X&J&&G===F||X&L&&Y===B||X&K&&B===0;return H}});var IH=p1((JS,EH)=>{var LS=N5("fs"),EX;if(process.platform==="win32"||global.TESTING_WINDOWS)EX=VH();else EX=OH();EH.exports=v7;v7.sync=Ij;function v7(W,Q,X){if(typeof Q==="function")X=Q,Q={};if(!X){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(Y,G){v7(W,Q||{},function(B,F){if(B)G(B);else Y(F)})})}EX(W,Q||{},function(Y,G){if(Y){if(Y.code==="EACCES"||Q&&Q.ignoreErrors)Y=null,G=!1}X(Y,G)})}function Ij(W,Q){try{return EX.sync(W,Q||{})}catch(X){if(Q&&Q.ignoreErrors||X.code==="EACCES")return!1;else throw X}}});var CH=p1((zS,qH)=>{var h9=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",TH=N5("path"),Tj=h9?";":":",RH=IH(),PH=(W)=>Object.assign(Error(`not found: ${W}`),{code:"ENOENT"}),bH=(W,Q)=>{let X=Q.colon||Tj,Y=W.match(/\//)||h9&&W.match(/\\/)?[""]:[...h9?[process.cwd()]:[],...(Q.path||process.env.PATH||"").split(X)],G=h9?Q.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",B=h9?G.split(X):[""];if(h9){if(W.indexOf(".")!==-1&&B[0]!=="")B.unshift("")}return{pathEnv:Y,pathExt:B,pathExtExe:G}},SH=(W,Q,X)=>{if(typeof Q==="function")X=Q,Q={};if(!Q)Q={};let{pathEnv:Y,pathExt:G,pathExtExe:B}=bH(W,Q),F=[],L=(z)=>new Promise((K,H)=>{if(z===Y.length)return Q.all&&F.length?K(F):H(PH(W));let D=Y[z],I=/^".*"$/.test(D)?D.slice(1,-1):D,A=TH.join(I,W),M=!I&&/^\.[\\\/]/.test(W)?W.slice(0,2)+A:A;K(J(M,z,0))}),J=(z,K,H)=>new Promise((D,I)=>{if(H===G.length)return D(L(K+1));let A=G[H];RH(z+A,{pathExt:B},(M,N)=>{if(!M&&N)if(Q.all)F.push(z+A);else return D(z+A);return D(J(z,K,H+1))})});return X?L(0).then((z)=>X(null,z),X):L(0)},Rj=(W,Q)=>{Q=Q||{};let{pathEnv:X,pathExt:Y,pathExtExe:G}=bH(W,Q),B=[];for(let F=0;F<X.length;F++){let L=X[F],J=/^".*"$/.test(L)?L.slice(1,-1):L,z=TH.join(J,W),K=!J&&/^\.[\\\/]/.test(W)?W.slice(0,2)+z:z;for(let H=0;H<Y.length;H++){let D=K+Y[H];try{if(RH.sync(D,{pathExt:G}))if(Q.all)B.push(D);else return D}catch(I){}}}if(Q.all&&B.length)return B;if(Q.nothrow)return null;throw PH(W)};qH.exports=SH;SH.sync=Rj});var vH=p1((KS,y7)=>{var kH=(W={})=>{let Q=W.env||process.env;if((W.platform||process.platform)!=="win32")return"PATH";return Object.keys(Q).reverse().find((Y)=>Y.toUpperCase()==="PATH")||"Path"};y7.exports=kH;y7.exports.default=kH});var fH=p1((ZS,gH)=>{var yH=N5("path"),Pj=CH(),bj=vH();function _H(W,Q){let X=W.options.env||process.env,Y=process.cwd(),G=W.options.cwd!=null,B=G&&process.chdir!==void 0&&!process.chdir.disabled;if(B)try{process.chdir(W.options.cwd)}catch(L){}let F;try{F=Pj.sync(W.command,{path:X[bj({env:X})],pathExt:Q?yH.delimiter:void 0})}catch(L){}finally{if(B)process.chdir(Y)}if(F)F=yH.resolve(G?W.options.cwd:"",F);return F}function Sj(W){return _H(W)||_H(W,!0)}gH.exports=Sj});var xH=p1((kj,g7)=>{var _7=/([()\][%!^"`<>&|;, *?])/g;function qj(W){return W=W.replace(_7,"^$1"),W}function Cj(W,Q){if(W=`${W}`,W=W.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),W=W.replace(/(?=(\\+?)?)\1$/,"$1$1"),W=`"${W}"`,W=W.replace(_7,"^$1"),Q)W=W.replace(_7,"^$1");return W}kj.command=qj;kj.argument=Cj});var uH=p1((HS,hH)=>{hH.exports=/^#!(.*)/});var mH=p1(($S,lH)=>{var _j=uH();lH.exports=(W="")=>{let Q=W.match(_j);if(!Q)return null;let[X,Y]=Q[0].replace(/#! ?/,"").split(" "),G=X.split("/").pop();if(G==="env")return Y;return Y?`${G} ${Y}`:G}});var pH=p1((US,cH)=>{var f7=N5("fs"),gj=mH();function fj(W){let X=Buffer.alloc(150),Y;try{Y=f7.openSync(W,"r"),f7.readSync(Y,X,0,150,0),f7.closeSync(Y)}catch(G){}return gj(X.toString())}cH.exports=fj});var rH=p1((AS,nH)=>{var xj=N5("path"),dH=fH(),iH=xH(),hj=pH(),uj=process.platform==="win32",lj=/\.(?:com|exe)$/i,mj=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cj(W){W.file=dH(W);let Q=W.file&&hj(W.file);if(Q)return W.args.unshift(W.file),W.command=Q,dH(W);return W.file}function pj(W){if(!uj)return W;let Q=cj(W),X=!lj.test(Q);if(W.options.forceShell||X){let Y=mj.test(Q);W.command=xj.normalize(W.command),W.command=iH.command(W.command),W.args=W.args.map((B)=>iH.argument(B,Y));let G=[W.command].concat(W.args).join(" ");W.args=["/d","/s","/c",`"${G}"`],W.command=process.env.comspec||"cmd.exe",W.options.windowsVerbatimArguments=!0}return W}function dj(W,Q,X){if(Q&&!Array.isArray(Q))X=Q,Q=null;Q=Q?Q.slice(0):[],X=Object.assign({},X);let Y={command:W,args:Q,options:X,file:void 0,original:{command:W,args:Q}};return X.shell?Y:pj(Y)}nH.exports=dj});var sH=p1((NS,aH)=>{var x7=process.platform==="win32";function h7(W,Q){return Object.assign(Error(`${Q} ${W.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${Q} ${W.command}`,path:W.command,spawnargs:W.args})}function ij(W,Q){if(!x7)return;let X=W.emit;W.emit=function(Y,G){if(Y==="exit"){let B=oH(G,Q);if(B)return X.call(W,"error",B)}return X.apply(W,arguments)}}function oH(W,Q){if(x7&&W===1&&!Q.file)return h7(Q.original,"spawn");return null}function nj(W,Q){if(x7&&W===1&&!Q.file)return h7(Q.original,"spawnSync");return null}aH.exports={hookChildProcess:ij,verifyENOENT:oH,verifyENOENTSync:nj,notFoundError:h7}});var W$=p1((VS,u9)=>{var tH=N5("child_process"),u7=rH(),l7=sH();function eH(W,Q,X){let Y=u7(W,Q,X),G=tH.spawn(Y.command,Y.args,Y.options);return l7.hookChildProcess(G,Y),G}function rj(W,Q,X){let Y=u7(W,Q,X),G=tH.spawnSync(Y.command,Y.args,Y.options);return G.error=G.error||l7.verifyENOENTSync(G.status,Y),G}u9.exports=eH;u9.exports.spawn=eH;u9.exports.sync=rj;u9.exports._parse=u7;u9.exports._enoent=l7});import m7 from"process";import{PassThrough as oj}from"stream";function sj(){let W={};for(let Q of aj){let X=m7.env[Q];if(X===void 0)continue;if(X.startsWith("()"))continue;W[Q]=X}return W}var Q$,aj,X$=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(W){if(this._serverParams=W,this._readBuffer=new E7({maxBufferSize:W.maxBufferSize}),W.stderr==="pipe"||W.stderr==="overlapped")this._stderrStream=new oj}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((W,Q)=>{if(this._process=Q$.default(this._serverParams.command,this._serverParams.args??[],{env:{...sj(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:m7.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",(X)=>{Q(X),this.onerror?.(X)}),this._process.on("spawn",()=>{W()}),this._process.on("close",(X)=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",(X)=>{this.onerror?.(X)}),this._process.stdout?.on("data",(X)=>{try{this._readBuffer.append(X),this.processReadBuffer()}catch(Y){this.onerror?.(Y),this.close().catch(()=>{})}}),this._process.stdout?.on("error",(X)=>{this.onerror?.(X)}),this._stderrStream&&this._process.stderr)this._process.stderr.pipe(this._stderrStream)})}get stderr(){if(this._stderrStream)return this._stderrStream;return this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;this.onmessage?.(W)}catch(W){this.onerror?.(W)}}async _dispose(){let W=this._process;if(this._process=void 0,W&&W.exitCode===null&&W.signalCode===null){let Q=new Promise((X)=>W.once("exit",()=>X()));try{W.stdin?.end()}catch{}try{W.kill("SIGTERM")}catch{}if(await Promise.race([Q,new Promise((X)=>setTimeout(X,1000).unref())]),W.exitCode===null&&W.signalCode===null)try{W.kill("SIGKILL")}catch{}await Q}try{W?.stdout?.destroy()}catch{}try{W?.stdin?.destroy()}catch{}try{W?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let W=this._process;this._process=void 0;let Q=new Promise((X)=>{W.once("close",()=>{X()})});try{W.stdin?.end()}catch{}if(await Promise.race([Q,new Promise((X)=>setTimeout(X,2000).unref())]),W.exitCode===null){try{W.kill("SIGTERM")}catch{}await Promise.race([Q,new Promise((X)=>setTimeout(X,2000).unref())])}if(W.exitCode===null)try{W.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(W){return new Promise((Q)=>{if(!this._process?.stdin)throw new $0(U0.NotConnected,"Not connected");let X=I7(W);if(this._process.stdin.write(X))Q();else this._process.stdin.once("drain",Q)})}};var Y$=H0(()=>{T7();Q$=YU(W$(),1),aj=m7.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"]});import tj from"path";async function o1(W,Q,X){let Y=new ZH({name:"ast-mcp",version:"1.0.0"}),G=new X$({args:["mcp"],command:ej,cwd:X,stderr:"pipe"});try{return await Y.connect(G),await Y.callTool({arguments:Q,name:W})}finally{try{await Y.close()}catch{}}}var ej,G$;var WQ=H0(()=>{HH();Y$();ej=tj.resolve(import.meta.dir,"../../node_modules/.bin/ast-bro"),G$=["map","digest","show","implements","surface","deps","reverse_deps","cycles","graph","search","find_related","index","callers","callees","trace","impact","context","run","squeeze"]});function W6(W){let Q=W.content.filter((X)=>X.type==="text"&&typeof X.text==="string").map((X)=>X.text).join(`
93
+ `);if(W.isError)throw Error(Q||"ast-bro MCP call failed");if(!Q)throw Error("ast-bro MCP returned no JSON text");try{return JSON.parse(Q)}catch(X){throw Error(`Invalid ast-bro MCP JSON: ${Q}`,{cause:X})}}function c7(W){let Q=W6(W);return[...new Set((Q.matches??[]).map((X)=>X.file).filter((X)=>typeof X==="string"))]}function B$(W){let Q=W6(W);return[...new Set((Q.files??[]).filter((X)=>X.status==="rewritten").map((X)=>X.file).filter((X)=>typeof X==="string"))]}var L$;var F$=H0(()=>{L$={callees:{description:"What does this symbol call? \u2014 AST-accurate forward call traversal. Suffix-matches the target like `callers`. Unresolved/external callees shown by default (tagged cyan/red). Returns text by default; set `json: true` for `ast-bro.callees.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 1).",minimum:1,type:"integer"},hide_external:{description:"Drop unresolved/external callees. Default: false (shown with [unresolved]/[external] tags).",type:"boolean"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},target:{description:"Symbol name to look up.",type:"string"}},required:["target"],type:"object"}},callers:{description:"Find callers of a symbol \u2014 AST-accurate, no grep noise. Suffix-matches the target like `show`/`implements`: `TakeDamage`, or `Type.method` when ambiguous. Ambiguous matches shown by default (tagged red). Returns text by default; set `json: true` for `ast-bro.callers.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 1).",minimum:1,type:"integer"},hide_ambiguous:{description:"Drop callers with multiple candidates. Default: false (shown with Ambiguous tag).",type:"boolean"},json:{type:"boolean"},limit:{description:"Cap result count (default 200).",minimum:1,type:"integer"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},target:{description:"Symbol name to look up.",type:"string"}},required:["target"],type:"object"}},context:{description:"Token-budgeted context for a symbol \u2014 target body + direct callees (bodies) + callers/transitive (signatures), greedily packed into a caller-supplied token budget. Replaces chains of 4\u20135 `show`/`callers`/`callees` calls with ONE context-aware payload. Budget degrades gracefully from full bodies to signatures only. Returns text by default; set `json: true` for `ast-bro.context.v1`.",inputSchema:{properties:{budget:{description:"Token budget (default 8000). ~4 bytes per token rough.",minimum:100,type:"integer"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},target:{description:"Symbol to build context for (same form as callers).",type:"string"}},required:["target"],type:"object"}},cycles:{description:"Find import cycles via Tarjan SCC. Returns the list of strongly-connected components with `len > 1` (or singletons with self-edges). Returns text by default; set `json: true` for `ast-bro.cycles.v1`. Exits non-zero when cycles exist (useful for CI gates).",inputSchema:{properties:{json:{type:"boolean"},min_size:{description:"Drop SCCs smaller than this (default 2).",minimum:1,type:"integer"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"}},type:"object"}},deps:{description:"Forward import-graph traversal: what does this file import (transitively)? Builds a per-repo dep graph at `.ast-bro/deps/graph.bin` on first call, then reuses it. Returns text by default; set `json: true` for `ast-bro.deps.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 3).",minimum:1,type:"integer"},file:{description:"Path to the file whose imports to follow.",type:"string"},hide_external:{description:"Drop unresolved imports. Default: false (shown with [external] tag).",type:"boolean"},json:{type:"boolean"},rebuild:{description:"Drop the cached graph and rebuild.",type:"boolean"}},required:["file"],type:"object"}},digest:{description:"One-page module map for an unfamiliar directory: every file's types and public methods. Returns text by default; set `json: true` for `ast-bro.map.v1`.",inputSchema:{properties:{include_fields:{type:"boolean"},include_private:{type:"boolean"},json:{type:"boolean"},max_members:{description:"Cap members per type (default 50).",type:"integer"},paths:{description:"Files or directories to digest.",items:{type:"string"},minItems:1,type:"array"}},required:["paths"],type:"object"}},find_related:{description:"Find chunks semantically similar to a given file:line. Useful for navigating to related code. Returns text by default; set `json: true` for `ast-bro.related.v1`.",inputSchema:{properties:{json:{type:"boolean"},line:{description:"1-indexed line within `path`.",minimum:1,type:"integer"},path:{description:"Repo-relative path of the source chunk.",type:"string"},root:{description:'Repo root containing the index (default ".").',type:"string"},top_k:{description:"Max results (default 10).",minimum:1,type:"integer"}},required:["path","line"],type:"object"}},graph:{description:"Emit the file-level dependency graph. Unresolved external imports shown by default (tagged `[external]`). Returns text by default; set `json: true` for `ast-bro.graph.v1`.",inputSchema:{properties:{hide_external:{description:"Drop unresolved imports. Default: false (shown with [external] tag).",type:"boolean"},json:{description:"Return JSON (schema `ast-bro.graph.v1`) instead of text.",type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"}},type:"object"}},impact:{description:"Cross-file impact analysis: callers + callees + file reverse-deps + test detection in one call. Answers 'what would break if I change X?' and 'how wide is the blast radius?' in one shot. Four modes: `deps` (what it calls/imports), `dependents` (who calls/imports it), `tests` (affected tests only), `all` (default). Returns text by default; set `json: true` for `ast-bro.impact.v1`.",inputSchema:{properties:{depth:{description:"Transitive depth (default 2).",minimum:1,type:"integer"},exclude_tests:{description:"Exclude test files from output.",type:"boolean"},hide_ambiguous:{description:"Drop ambiguous call-edge matches. Default: false (shown with Ambiguous tag).",type:"boolean"},json:{type:"boolean"},limit:{description:"Result cap per section (default 200).",minimum:1,type:"integer"},mode:{description:"Section: 'deps', 'dependents', 'tests', or 'all' (default).",enum:["deps","dependents","tests","all"],type:"string"},path:{description:'Repo root (default ".").',type:"string"},target:{description:"Symbol to analyse (e.g. 'handleRequest', 'Player.TakeDamage', 'src/Player.cs:TakeDamage').",type:"string"},tests:{description:"Show only test files.",type:"boolean"}},required:["target"],type:"object"}},implements:{description:"Find subclasses / implementations of a type using AST matching. Transitive by default \u2014 set `direct: true` for level-1 only. Returns text by default; set `json: true` for `ast-bro.implements.v1`.",inputSchema:{properties:{direct:{description:"Direct subtypes only (skip transitive).",type:"boolean"},json:{type:"boolean"},paths:{description:"Files or directories to search.",items:{type:"string"},minItems:1,type:"array"},target:{description:"Type name to look up.",type:"string"}},required:["target","paths"],type:"object"}},index:{description:"Build, refresh, or inspect the per-repo search index. With `stats: true` returns index stats. With `rebuild: true` drops the cache and rebuilds. Otherwise just opens (and incrementally refreshes if files changed). Returns text by default; set `json: true` for `ast-bro.index-stats.v1`.",inputSchema:{properties:{json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{description:"Drop existing cache and rebuild.",type:"boolean"},stats:{description:"Print index stats and return.",type:"boolean"}},type:"object"}},map:{description:"AST-based structural map of source files \u2014 signatures with line ranges, no method bodies. Returns text by default (5\u201310\xD7 smaller than reading the file). Set `json: true` for the machine-readable schema `ast-bro.map.v1`.",inputSchema:{properties:{glob:{description:"Glob filter applied during directory walk.",type:"string"},json:{description:"Return JSON (schema `ast-bro.map.v1`) instead of text.",type:"boolean"},no_attrs:{description:"Hide attributes / decorators.",type:"boolean"},no_docs:{description:"Hide doc comments.",type:"boolean"},no_fields:{description:"Hide field declarations.",type:"boolean"},no_lines:{description:"Hide line-range suffixes.",type:"boolean"},no_private:{description:"Hide private declarations.",type:"boolean"},paths:{description:"Files or directories to map.",items:{type:"string"},minItems:1,type:"array"}},required:["paths"],type:"object"}},reverse_deps:{description:"Reverse import-graph: who imports this file (transitively)? Useful for refactor blast-radius assessment. Returns text by default; set `json: true` for `ast-bro.reverse-deps.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 3).",minimum:1,type:"integer"},file:{description:"Path to the file whose importers to find.",type:"string"},json:{type:"boolean"},limit:{description:"Cap result count (default 200).",minimum:1,type:"integer"},rebuild:{type:"boolean"}},required:["file"],type:"object"}},run:{description:"AST-aware pattern search and rewrite. Use metavariables like $FUNC, $ARG, $$$BODY for structural matching. Search-only without rewrite; transform code with rewrite and write. WARNING: `write: true` mutates files on disk \u2014 a broad pattern can touch many files at once (capped at 50 per call). Always preview with the default dry-run first and confirm the diff before re-running with `write: true`. Returns text by default; set `json: true` for `ast-bro.run.v1`.",inputSchema:{properties:{glob:{description:"Glob pattern to filter files, e.g. '**/*.rs'.",type:"string"},json:{description:"Return results as JSON instead of text.",type:"boolean"},lang:{description:"Language (auto-detected from file paths if omitted).",type:"string"},paths:{description:"Files or directories to search.",items:{type:"string"},minItems:1,type:"array"},pattern:{description:"AST pattern with metavariables (e.g. '$FUNC($$$)').",type:"string"},rewrite:{description:"Replacement template (e.g. 'bar($A)'). Omit for search-only.",type:"string"},write:{description:"Write changes to disk. Default: false (dry-run). DANGEROUS: mutates files; preview the dry-run diff first and confirm before flipping to true.",type:"boolean"}},required:["pattern"],type:"object"}},search:{description:"Hybrid BM25 + dense semantic search over the repo. First call builds a per-repo index at `.ast-bro/index/` (one-time, ~seconds for typical repos). Returns text by default; set `json: true` for `ast-bro.search.v1`.",inputSchema:{properties:{alpha:{description:"Override semantic-vs-BM25 weight (0.0=pure BM25, 1.0=pure semantic). Default auto-detects from query type.",type:"number"},json:{description:"Return JSON (schema `ast-bro.search.v1`) instead of text.",type:"boolean"},languages:{description:'Restrict to chunks of these languages (e.g. ["rust", "python"]).',items:{type:"string"},type:"array"},path:{description:'Repo root to search in (default ".").',type:"string"},query:{description:"Search query (free-form text or symbol name).",type:"string"},top_k:{description:"Max results to return (default 10).",minimum:1,type:"integer"}},required:["query"],type:"object"}},show:{description:"Extract source of one or more symbols from a single file. Suffix matching: `TakeDamage`, or `Player.TakeDamage` when ambiguous. For markdown the symbol is a heading. Returns text by default; set `json: true` for `ast-bro.show.v1`.",inputSchema:{properties:{json:{type:"boolean"},path:{description:"File to search.",type:"string"},symbols:{description:"One or more symbol names to extract.",items:{type:"string"},minItems:1,type:"array"}},required:["path","symbols"],type:"object"}},squeeze:{description:"Compress repetitive log/text with a reversible legend (logs, not code).",inputSchema:{properties:{end:{description:"1-indexed inclusive end line of the slice.",minimum:1,type:"integer"},json:{description:"Return JSON (schema `ast-bro.squeeze.v1`) instead of text.",type:"boolean"},path:{description:"Path to the log/text file to read.",type:"string"},raw:{description:"Skip compression and emit the raw text.",type:"boolean"},start:{description:"1-indexed inclusive start line of the slice.",minimum:1,type:"integer"}},required:["path"],type:"object"}},surface:{description:"True public API surface \u2014 resolves `pub use` re-exports (Rust) and `__all__` (Python) to compute exactly what a downstream user sees, not just every `pub`/non-underscore item per file. Falls back to visibility-filtered output for Java/C#/Go/Kotlin (no real re-export concept). Returns text by default; set `json: true` for `ast-bro.surface.v1`.",inputSchema:{properties:{include_chain:{description:"Append the via-chain on each entry (text mode only).",type:"boolean"},include_private:{description:"Include private items \u2014 only meaningful for the fallback resolver.",type:"boolean"},json:{type:"boolean"},lang:{description:"Force a resolver: `rust`, `python`, or `fallback`.",type:"string"},max_depth:{description:"Recursion guard for re-export chains (default 16).",type:"integer"},path:{description:'Crate root file, package init, or directory to auto-detect (default ".").',type:"string"},tree:{description:"Render as a hierarchical tree grouped by module.",type:"boolean"}},type:"object"}},trace:{description:"Trace the static call path between two symbols \u2014 \"how does <from> reach <to>?\". Shortest-path BFS over the call graph with each hop's source body inlined, so a flow question (e.g. request\u2192handler, update\u2192render) is answered in ONE call instead of chaining `callers`/`callees`. If no static path exists the chain broke at dynamic dispatch \u2014 the response inlines both endpoints plus the target file's sibling callables. Targets are suffix-matched like `callers`. Returns text by default; set `json: true` for `ast-bro.trace.v1`.",inputSchema:{properties:{depth:{description:"Max path length in hops (default 12).",minimum:1,type:"integer"},from:{description:"Source symbol \u2014 where the path starts.",type:"string"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},to:{description:"Destination symbol \u2014 where the path should reach.",type:"string"}},required:["from","to"],type:"object"}}}});import{randomUUID as QO}from"crypto";import{chmod as XO,rename as YO,unlink as GO,writeFile as BO}from"fs/promises";import IX from"path";async function J$(W,Q,X){let Y=IX.extname(W),G=IX.join(IX.dirname(W),`${IX.basename(W,Y)}.ast-mcp-restore-${QO()}${Y}`);try{await BO(G,Q,{encoding:"utf8",flag:"wx",mode:X}),await XO(G,X),await YO(G,W)}finally{await GO(G).catch(()=>{return})}}var z$=()=>{};import{execFile as FO}from"child_process";function K$(W,Q,X){return new Promise((Y,G)=>{FO(W,Q,{encoding:"utf8",maxBuffer:16777216,timeout:30000},(F,L,J)=>{if(F)G(Error(`${W} failed: ${(J||L||F.message).trim()}`,{cause:F}));else Y({stderr:J,stdout:L})}).stdin?.end(X)})}var Z$=()=>{};import{randomUUID as LO}from"crypto";import{chmod as JO,lstat as zO,readFile as H$,rename as KO,unlink as ZO,writeFile as HO}from"fs/promises";import X4 from"path";async function QQ(W,Q){return(await K$($O,["fmt","--config",UO,"--stdin",X4.basename(W)],Q)).stdout}async function U$(W){await QQ(W,await H$(W,"utf8"))}async function A$(W){let Q=await zO(W),X=await QQ(W,await H$(W,"utf8")),Y=X4.extname(W),G=X4.join(X4.dirname(W),`${X4.basename(W,Y)}.ast-mcp-format-${LO()}${Y}`);try{await HO(G,X,{encoding:"utf8",flag:"wx",mode:Q.mode}),await JO(G,Q.mode),await KO(G,W)}finally{await ZO(G).catch(()=>{return})}}var $$,$O,UO;var p7=H0(()=>{Z$();$$=X4.resolve(import.meta.dir,"../.."),$O=X4.join($$,"node_modules/.bin/dprint"),UO=process.env.AST_MCP_DPRINT_CONFIG??X4.join($$,"dprint.json")});import{createHash as N$}from"crypto";import{createReadStream as AO}from"fs";function k1(W){return N$("sha256").update(W).digest("hex")}async function d7(W){let Q=N$("sha256");for await(let X of AO(W))Q.update(X);return Q.digest("hex")}var l9=()=>{};import{lstat as NO,open as VO,rm as wO}from"fs/promises";import TX from"path";async function DO(W){let Q=TX.dirname(W),X=Q;while(!0)try{if(!(await NO(X)).isDirectory())throw Error(`Lock parent is not a directory: ${X}`);break}catch(G){if(G.code!=="ENOENT")throw G;let B=TX.dirname(X);if(B===X)throw G;X=B}let Y=X===Q?`.${TX.basename(W)}.ast-mcp.lock`:`.${k1(W).slice(0,24)}.ast-mcp.lock`;return TX.join(X,Y)}async function MO(W){let Q=await DO(W);while(!0)try{return await(await VO(Q,"wx")).close(),()=>wO(Q,{force:!0})}catch(X){if(X.code!=="EEXIST")throw X;await new Promise((Y)=>setTimeout(Y,10))}}async function jO(W,Q){let X=RX.get(W)??Promise.resolve(),Y,G=new Promise((F)=>{Y=F}),B=X.then(()=>G);RX.set(W,B),await X;try{return await Q()}finally{if(Y(),RX.get(W)===B)RX.delete(W)}}async function PX(W,Q){return jO(W,async()=>{let X=await MO(W);try{return await Q()}finally{await X()}})}async function m9(W,Q){let X=[...new Set(W)].sort(),Y=async(G)=>G===X.length?Q():PX(X[G],()=>Y(G+1));return Y(0)}var RX;var XQ=H0(()=>{l9();RX=new Map});import{lstat as OO,realpath as i7}from"fs/promises";import u6 from"path";function EO(){return(process.env.AST_MCP_ROOTS?.split(u6.delimiter).filter(Boolean)??[process.cwd()]).map((W)=>u6.resolve(W))}function n7(W,Q){let X=u6.relative(W,Q);return X===""||!X.startsWith("..")&&!u6.isAbsolute(X)}async function r7(){let W=await i7(process.cwd()).catch(()=>process.cwd()),Q=await Promise.all(EO().map(async(X)=>i7(X).catch(()=>X)));if(process.env.AST_MCP_ALLOW_EXTERNAL_ROOTS!=="1"&&Q.some((X)=>!n7(W,X)))throw Error("AST_MCP_ROOTS contains a root outside the server working directory; set AST_MCP_ALLOW_EXTERNAL_ROOTS=1 to opt in");return Q}async function V$(){return(await r7())[0]}async function w$(W){let Q=(await r7()).find((X)=>n7(X,W));if(!Q)throw Error(`Path is outside AST_MCP_ROOTS: ${W}`);return Q}async function a1(W){let Q=await r7(),X=u6.isAbsolute(W)?W:u6.resolve(Q[0],W),Y=u6.dirname(X),G=[];while(!0)try{Y=await i7(Y);break}catch(F){if(F.code!=="ENOENT")throw F;let L=u6.dirname(Y);if(L===Y)throw F;G.unshift(u6.basename(Y)),Y=L}let B=u6.join(Y,...G,u6.basename(X));if(!Q.some((F)=>n7(F,B)))throw Error(`Path is outside AST_MCP_ROOTS: ${W}`);if((await OO(B).catch(()=>{return}))?.isSymbolicLink())throw Error(`Symbolic-link targets are not writable: ${W}`);return B}var c9=()=>{};import{lstat as IO,readFile as TO}from"fs/promises";import D$ from"path";function RO(W){return{"~standard":{jsonSchema:{input:()=>W,output:()=>({type:"object"})},validate(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)?{value:Q}:{issues:[{message:"Expected an object"}]}},vendor:"ast-mcp",version:1}}}async function p9(W,Q){return a1(D$.isAbsolute(Q)?Q:D$.resolve(W,Q))}async function bO(W,Q){for(let X of PO){let Y=W[X];if(typeof Y==="string")await p9(Q,Y)}if(!Array.isArray(W.paths))return;for(let X of W.paths)if(typeof X==="string")await p9(Q,X)}async function SO(W,Q){let X=Array.isArray(W.paths)?W.paths.filter((L)=>typeof L==="string"):[];for(let L of X.length?X:[Q])await p9(Q,L);if(W.write!==!0||typeof W.rewrite!=="string")return o1("run",W,Q);let Y={json:!0,paths:W.paths,pattern:W.pattern};for(let L of["glob","lang"])if(W[L]!==void 0)Y[L]=W[L];let G=await o1("run",Y,Q);if(W6(G).capped)throw Error("ast-bro run preview was capped; narrow paths or pattern before writing");let F=await Promise.all(c7(G).map((L)=>p9(Q,L)));return m9(F,async()=>{let L=await o1("run",Y,Q);if(W6(L).capped)throw Error("ast-bro run preview was capped; narrow paths or pattern before writing");let z=await Promise.all(c7(L).map((I)=>p9(Q,I)));if(F.length!==z.length||F.some((I,A)=>I!==z[A]))throw Error("ast-bro run targets changed while waiting for the write lock; preview again");let K=new Map;for(let I of z)await U$(I),K.set(I,{content:await TO(I,"utf8"),mode:(await IO(I)).mode});let H=await o1("run",{...W,json:!0},Q),D=await Promise.all(B$(H).map((I)=>p9(Q,I)));try{for(let I of D)await A$(I)}catch(I){for(let A of D){let M=K.get(A);if(M)await J$(A,M.content,M.mode)}throw I}return H})}function o7(W){for(let Q of G$){let X=L$[Q];W.registerTool(Q,{description:Q==="run"?"AST structural search and rewrite. Use for bounded inspection and previews; direct write is a lower-level escape hatch for exceptional cases. Normal agent edits belong in keyed file_patch, which supports ordered AST rules and Aider blocks.":X.description,inputSchema:RO(X.inputSchema),title:`ast-bro ${Q}`},async(Y)=>{try{let G=await V$();return await bO(Y,G),Q==="run"?await SO(Y,G):await o1(Q,Y,G)}catch(G){return{content:[{text:G instanceof Error?G.message:String(G),type:"text"}],isError:!0}}})}}var PO;var M$=H0(()=>{WQ();F$();z$();p7();XQ();c9();PO=["file","path","root"]});import qO from"path";async function d9(W,Q){if(!Q)return!1;let X=await o1("map",{json:!0,paths:[W]},qO.dirname(W));return(W6(X).files??[]).find((B)=>B.path===W)?.error_count===0}var bX=H0(()=>{WQ()});async function a7(W,Q){if(Q==="markdown")return!1;return d9(W,Q)}var j$=H0(()=>{bX()});import{chmod as O$,chown as E$,lstat as CO}from"fs/promises";function kO(W){if(!W)return;if(W.chmod!==void 0&&(!Number.isInteger(W.chmod)||W.chmod<0||W.chmod>511))throw Error("chmod must be an integer between 0 and 0o777");if(W.chown&&(!Number.isInteger(W.chown.uid)||W.chown.uid<0||!Number.isInteger(W.chown.gid)||W.chown.gid<0))throw Error("chown uid and gid must be non-negative integers");let Q=process.getuid?.(),X=process.getgid?.();if(W.chown&&(Q===void 0||X===void 0||W.chown.uid!==Q||W.chown.gid!==X))throw Error("chown may only preserve the server process owner");return W}async function qX(W,Q){let X=kO(Q),Y=await SX(W);if(!X)return Y;try{if(X.chown)await E$(W,X.chown.uid,X.chown.gid);if(X.chmod!==void 0)await O$(W,X.chmod)}catch(G){throw await E$(W,Y.chown.uid,Y.chown.gid).catch(()=>{return}),await O$(W,Y.chmod).catch(()=>{return}),G}return SX(W)}async function SX(W){let Q=await CO(W);return{chmod:Q.mode&511,chown:{gid:Q.gid,uid:Q.uid}}}var s7=()=>{};import vO from"path";function q4(W){return yO[vO.extname(W).toLowerCase()]}var yO;var CX=H0(()=>{yO={".cc":"cpp",".cjs":"javascript",".cpp":"cpp",".cs":"csharp",".cxx":"cpp",".ddl":"sql",".dml":"sql",".go":"go",".hh":"cpp",".hpp":"cpp",".java":"java",".js":"javascript",".jsx":"javascript",".kt":"kotlin",".kts":"kotlin",".markdown":"markdown",".md":"markdown",".mdown":"markdown",".mdx":"markdown",".mjs":"javascript",".php":"php",".py":"python",".pyi":"python",".rb":"ruby",".rs":"rust",".scala":"scala",".sql":"sql",".ts":"typescript",".tsx":"tsx"}});import{createReadStream as _O}from"fs";import{stat as I$}from"fs/promises";async function T$(W,Q){let X=Array(W.length),Y=0;return await Promise.all(Array.from({length:Math.min(4,W.length)},async()=>{while(Y<W.length){let G=Y;Y+=1,X[G]=await Q(W[G])}})),X}function fO(W){let[Q,X]=W.lines??gO,Y=W.maxBytes??i9;if(!Number.isInteger(Q)||Q<0)throw Error("file_read line start must be a non-negative integer");if(!Number.isInteger(X)||X<=Q)throw Error("file_read line end must be greater than line start");if(X-Q>kX)throw Error(`file_read line ranges are capped at ${kX} lines`);if(!Number.isInteger(Y)||Y<1||Y>i9)throw Error(`file_read maxBytes must be between 1 and ${i9}`);return{lines:[Q,X],maxBytes:Y}}async function xO(W,Q,X,Y){let[G,B]=X,F=[],L=0,J=0,z=!1,K=!1,H=_O(W);try{W:for await(let A of H){let M=Buffer.isBuffer(A)?A:Buffer.from(A),N=0;while(N<M.length){let Z=M.indexOf(10,N),V=Z<0?M.length:Z+1;if(J>=G&&J<B){let U=Y-L,j=V-N;if(j>U){if(U>0)F.push(M.subarray(N,N+U)),L+=U;K=!0,z=!0;break W}if(j>0)F.push(M.subarray(N,V)),L+=j}if(N=V,Z>=0){if(J+=1,J>=B){z=N<M.length;break W}}else break}}}finally{H.destroy()}let D=Buffer.concat(F,L),I=0;for(let A of D)if(A===10)I+=1;if(D.length>0&&D.at(-1)!==10)I+=1;return{content:D.toString("utf8"),hasMore:K||z||H.bytesRead<Q,lines:{requested:X,returned:[G,G+I]},truncated:K}}async function hO(W){let Q=await a1(W),X=await I$(Q);if(!X.isFile())throw Error(`Not a regular file: ${W}`);return{filePath:Q,sha256:await d7(Q),size:X.size}}async function R$(W){if(W.length<1||W.length>F1)throw Error(`file_hash requires between 1 and ${F1} paths`);return T$(W,hO)}async function uO(W){let Q=await a1(W.filePath),X=q4(Q);if(await d9(Q,X))throw Error("REJECTED: AST-capable files must use map, show, search, context, or run; use file_hash when only SHA-256 is required");let Y=await I$(Q);if(!Y.isFile())throw Error(`Not a regular file: ${W.filePath}`);let{lines:G,maxBytes:B}=fO(W),[F,L]=await Promise.all([xO(Q,Y.size,G,B),d7(Q)]);return{...F,filePath:Q,sha256:L,size:Y.size}}async function P$(W){if(W.length<1||W.length>F1)throw Error(`file_read requires between 1 and ${F1} files`);return T$(W,uO)}var gO,F1=50,i9=1048576,kX=1000;var vX=H0(()=>{bX();CX();l9();c9();gO=[0,100]});class n9{start1;start2;diffs=[];length1=0;length2=0;constructor(W,Q){this.start1=W,this.start2=Q}clone(){let W=new n9(this.start1,this.start2);return W.diffs=this.diffs.map((Q)=>[...Q]),W.length1=this.length1,W.length2=this.length2,W}toString(){let W=b$(this.start1,this.length1),Q=b$(this.start2,this.length2),X=[`@@ -${W} +${Q} @@
94
+ `];for(let Y of this.diffs){let G=lO[Y[0]];X.push(G+encodeURI(Y[1])+`
95
+ `)}return X.join("").replace(/%20/g," ")}}class t7{Diff_Timeout=1;Diff_EditCost=4;Match_Threshold=0.5;Match_Distance=1000;Patch_DeleteThreshold=0.5;Patch_Margin=4;Match_MaxBits=32;whitespaceRegex=/\s/;linebreakRegex=/\r\n/;blanklineEndRegex=/\n\r?\n$/;blanklineStartRegex=/^\r?\n\r?\n/;diff_main(W,Q,X,Y){if(typeof Y>"u")if(this.Diff_Timeout<=0)Y=Number.MAX_VALUE;else Y=new Date().getTime()+this.Diff_Timeout*1000;let G=Y;if(W==null||Q==null)throw Error("Null input. (diff_main)");if(W===Q){if(W)return[[G0.Equal,W]];return[]}if(typeof X>"u")X=!0;let B=X,F=this.diff_commonPrefix(W,Q),L=W.substring(0,F);W=W.substring(F),Q=Q.substring(F),F=this.diff_commonSuffix(W,Q);let J=W.substring(W.length-F);W=W.substring(0,W.length-F),Q=Q.substring(0,Q.length-F);let z=this.diff_compute_(W,Q,B,G);if(L)z.unshift([G0.Equal,L]);if(J)z.push([G0.Equal,J]);return this.diff_cleanupMerge(z),z}diff_cleanupSemantic(W){let Q=!1,X=[],Y=0,G=null,B=0,F=0,L=0,J=0,z=0;while(B<W.length){if(W[B][0]===G0.Equal)X[Y++]=B,F=J,L=z,J=0,z=0,G=W[B][1];else{if(W[B][0]===G0.Insert)J+=W[B][1].length;else z+=W[B][1].length;if(G&&G.length<=Math.max(F,L)&&G.length<=Math.max(J,z))W.splice(X[Y-1],0,[G0.Delete,G]),W[X[Y-1]+1][0]=G0.Insert,Y--,Y--,B=Y>0?X[Y-1]:-1,F=0,L=0,J=0,z=0,G=null,Q=!0}B++}if(Q)this.diff_cleanupMerge(W);this.diff_cleanupSemanticLossless(W),B=1;while(B<W.length){if(W[B-1][0]===G0.Delete&&W[B][0]===G0.Insert){let K=W[B-1][1],H=W[B][1],D=this.diff_commonOverlap_(K,H),I=this.diff_commonOverlap_(H,K);if(D>=I){if(D>=K.length/2||D>=H.length/2)W.splice(B,0,[G0.Equal,H.substring(0,D)]),W[B-1][1]=K.substring(0,K.length-D),W[B+1][1]=H.substring(D),B++}else if(I>=K.length/2||I>=H.length/2)W.splice(B,0,[G0.Equal,K.substring(0,I)]),W[B-1][0]=G0.Insert,W[B-1][1]=H.substring(0,H.length-I),W[B+1][0]=G0.Delete,W[B+1][1]=K.substring(I),B++;B++}B++}}diff_cleanupEfficiency(W){let Q=!1,X=[],Y=0,G=null,B=0,F=!1,L=!1,J=!1,z=!1;while(B<W.length){if(W[B][0]===G0.Equal){if(W[B][1].length<this.Diff_EditCost&&(J||z))X[Y++]=B,F=J,L=z,G=W[B][1];else Y=0,G=null;J=z=!1}else{if(W[B][0]===G0.Delete)z=!0;else J=!0;if(G&&(F&&L&&J&&z||G.length<this.Diff_EditCost/2&&(F?1:0)+(L?1:0)+(J?1:0)+(z?1:0)===3)){if(W.splice(X[Y-1],0,[G0.Delete,G]),W[X[Y-1]+1][0]=G0.Insert,Y--,G=null,F&&L)J=z=!0,Y=0;else Y--,B=Y>0?X[Y-1]:-1,J=z=!1;Q=!0}}B++}if(Q)this.diff_cleanupMerge(W)}diff_prettyHtml(W){let Q=[],X=/&/g,Y=/</g,G=/>/g,B=/\n/g;for(let F=0;F<W.length;F++){let L=W[F][0],z=W[F][1].replace(X,"&amp;").replace(Y,"&lt;").replace(G,"&gt;").replace(B,"&para;<br>");switch(L){case G0.Insert:Q[F]='<ins style="background:#e6ffe6;">'+z+"</ins>";break;case G0.Delete:Q[F]='<del style="background:#ffe6e6;">'+z+"</del>";break;case G0.Equal:Q[F]="<span>"+z+"</span>";break}}return Q.join("")}diff_levenshtein(W){let Q=0,X=0,Y=0;for(let G of W){let B=G[0],F=G[1];switch(B){case G0.Insert:X+=F.length;break;case G0.Delete:Y+=F.length;break;case G0.Equal:Q+=Math.max(X,Y),X=0,Y=0;break}}return Q+=Math.max(X,Y),Q}patch_make(W,Q,X){let Y,G;if(typeof W==="string"&&typeof Q==="string"&&typeof X>"u"){if(Y=W,G=this.diff_main(Y,Q,!0),G.length>2)this.diff_cleanupSemantic(G),this.diff_cleanupEfficiency(G)}else if(W&&typeof W==="object"&&typeof Q>"u"&&typeof X>"u")G=W,Y=this.diff_text1(G);else if(typeof W==="string"&&Q&&typeof Q==="object"&&typeof X>"u")Y=W,G=Q;else if(typeof W==="string"&&typeof Q==="string"&&X&&typeof X==="object")Y=W,G=X;else throw Error("Unknown call format to patch_make.");if(G.length===0)return[];let B=[],F=new n9(0,0),L=0,J=0,z=0,K=Y,H=Y;for(let D=0;D<G.length;D++){let I=G[D][0],A=G[D][1];if(!L&&I!==G0.Equal)F.start1=J,F.start2=z;switch(I){case G0.Insert:F.diffs[L++]=G[D],F.length2+=A.length,H=H.substring(0,z)+A+H.substring(z);break;case G0.Delete:F.length1+=A.length,F.diffs[L++]=G[D],H=H.substring(0,z)+H.substring(z+A.length);break;case G0.Equal:if(A.length<=2*this.Patch_Margin&&L&&G.length!==D+1)F.diffs[L++]=G[D],F.length1+=A.length,F.length2+=A.length;else if(A.length>=2*this.Patch_Margin){if(L)this.patch_addContext_(F,K),B.push(F),F=new n9(0,0),L=0,K=H,J=z}break}if(I!==G0.Insert)J+=A.length;if(I!==G0.Delete)z+=A.length}if(L)this.patch_addContext_(F,K),B.push(F);return B}patch_apply(W,Q){if(W.length===0)return[Q,[]];W=this.patch_deepCopy(W);let X=this.patch_addPadding(W);Q=X+Q+X,this.patch_splitMax(W);let Y=0,G=[];for(let B=0;B<W.length;B++){let F=W[B].start2+Y,L=this.diff_text1(W[B].diffs),J,z=-1;if(L.length>this.Match_MaxBits){if(J=this.match_main(Q,L.substring(0,this.Match_MaxBits),F),J!==-1){if(z=this.match_main(Q,L.substring(L.length-this.Match_MaxBits),F+L.length-this.Match_MaxBits),z===-1||J>=z)J=-1}}else J=this.match_main(Q,L,F);if(J===-1)G[B]=!1,Y-=W[B].length2-W[B].length1;else{G[B]=!0,Y=J-F;let K;if(z===-1)K=Q.substring(J,J+L.length);else K=Q.substring(J,z+this.Match_MaxBits);if(L===K)Q=Q.substring(0,J)+this.diff_text2(W[B].diffs)+Q.substring(J+L.length);else{let H=this.diff_main(L,K,!1);if(L.length>this.Match_MaxBits&&this.diff_levenshtein(H)/L.length>this.Patch_DeleteThreshold)G[B]=!1;else{this.diff_cleanupSemanticLossless(H);let D=0,I;for(let A of W[B].diffs){if(A[0]!==G0.Equal){if(I=this.diff_xIndex(H,D),A[0]===G0.Insert)Q=Q.substring(0,J+I)+A[1]+Q.substring(J+I);else if(A[0]===G0.Delete)Q=Q.substring(0,J+I)+Q.substring(J+this.diff_xIndex(H,D+A[1].length))}if(A[0]!==G0.Delete)D+=A[1].length}}}}}return Q=Q.substring(X.length,Q.length-X.length),[Q,G]}patch_toText(W){let Q=[];for(let X=0;X<W.length;X++)Q[X]=W[X];return Q.join("")}patch_fromText(W){let Q=[];if(!W)return Q;let X=W.split(`
96
+ `),Y=0,G=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;while(Y<X.length){let B=X[Y].match(G);if(!B)throw Error("Invalid patch string: "+X[Y]);let F=new n9(parseInt(B[1],10),parseInt(B[3],10));if(Q.push(F),B[2]==="")F.start1--,F.length1=1;else if(B[2]==="0")F.length1=0;else F.start1--,F.length1=parseInt(B[2],10);if(B[4]==="")F.start2--,F.length2=1;else if(B[4]==="0")F.length2=0;else F.start2--,F.length2=parseInt(B[4],10);Y++;while(Y<X.length){let L=X[Y].charAt(0),J;try{J=decodeURI(X[Y].substring(1))}catch(z){throw Error("Illegal escape in patch_fromText: "+J,{cause:z})}if(L==="-")F.diffs.push([G0.Delete,J]);else if(L==="+")F.diffs.push([G0.Insert,J]);else if(L===" ")F.diffs.push([G0.Equal,J]);else if(L==="@")break;else if(L==="");else throw Error('Invalid patch mode "'+L+'" in: '+J);Y++}}return Q}diff_commonPrefix(W,Q){if(!W||!Q||W.charAt(0)!==Q.charAt(0))return 0;let X=0,Y=Math.min(W.length,Q.length),G=Y,B=0;while(X<G){if(W.substring(B,G)===Q.substring(B,G))X=G,B=X;else Y=G;G=Math.floor((Y-X)/2+X)}return G}diff_commonSuffix(W,Q){if(!W||!Q||W.charAt(W.length-1)!==Q.charAt(Q.length-1))return 0;let X=0,Y=Math.min(W.length,Q.length),G=Y,B=0;while(X<G){if(W.substring(W.length-G,W.length-B)===Q.substring(Q.length-G,Q.length-B))X=G,B=X;else Y=G;G=Math.floor((Y-X)/2+X)}return G}diff_cleanupMerge(W){W.push([G0.Equal,""]);let Q=0,X=0,Y=0,G="",B="",F;while(Q<W.length)switch(W[Q][0]){case G0.Insert:Y++,B+=W[Q][1],Q++;break;case G0.Delete:X++,G+=W[Q][1],Q++;break;case G0.Equal:if(X+Y>1){if(X!==0&&Y!==0){if(F=this.diff_commonPrefix(B,G),F!==0){if(Q-X-Y>0&&W[Q-X-Y-1][0]===G0.Equal)W[Q-X-Y-1][1]+=B.substring(0,F);else W.splice(0,0,[G0.Equal,B.substring(0,F)]),Q++;B=B.substring(F),G=G.substring(F)}if(F=this.diff_commonSuffix(B,G),F!==0)W[Q][1]=B.substring(B.length-F)+W[Q][1],B=B.substring(0,B.length-F),G=G.substring(0,G.length-F)}if(X===0)W.splice(Q-Y,X+Y,[G0.Insert,B]);else if(Y===0)W.splice(Q-X,X+Y,[G0.Delete,G]);else W.splice(Q-X-Y,X+Y,[G0.Delete,G],[G0.Insert,B]);Q=Q-X-Y+(X?1:0)+(Y?1:0)+1}else if(Q!==0&&W[Q-1][0]===G0.Equal)W[Q-1][1]+=W[Q][1],W.splice(Q,1);else Q++;Y=0,X=0,G="",B="";break}if(W[W.length-1][1]==="")W.pop();let L=!1;Q=1;while(Q<W.length-1){if(W[Q-1][0]===G0.Equal&&W[Q+1][0]===G0.Equal){if(W[Q][1].substring(W[Q][1].length-W[Q-1][1].length)===W[Q-1][1])W[Q][1]=W[Q-1][1]+W[Q][1].substring(0,W[Q][1].length-W[Q-1][1].length),W[Q+1][1]=W[Q-1][1]+W[Q+1][1],W.splice(Q-1,1),L=!0;else if(W[Q][1].substring(0,W[Q+1][1].length)===W[Q+1][1])W[Q-1][1]+=W[Q+1][1],W[Q][1]=W[Q][1].substring(W[Q+1][1].length)+W[Q+1][1],W.splice(Q+1,1),L=!0}Q++}if(L)this.diff_cleanupMerge(W)}diff_text1(W){let Q=[];for(let X=0;X<W.length;X++)if(W[X][0]!==G0.Insert)Q[X]=W[X][1];return Q.join("")}diff_text2(W){let Q=[];for(let X=0;X<W.length;X++)if(W[X][0]!==G0.Delete)Q[X]=W[X][1];return Q.join("")}diff_lineMode(W,Q){let X=this.diff_linesToChars_(W,Q),Y=this.diff_main(X.chars1,X.chars2,!1);return this.diff_charsToLines_(Y,X.lineArray),Y}diff_compute_(W,Q,X,Y){let G;if(!W)return[[G0.Insert,Q]];if(!Q)return[[G0.Delete,W]];let B=W.length>Q.length?W:Q,F=W.length>Q.length?Q:W,L=B.indexOf(F);if(L!==-1){if(G=[[G0.Insert,B.substring(0,L)],[G0.Equal,F],[G0.Insert,B.substring(L+F.length)]],W.length>Q.length)G[0][0]=G[2][0]=G0.Delete;return G}if(F.length===1)return[[G0.Delete,W],[G0.Insert,Q]];let J=this.diff_halfMatch_(W,Q);if(J){let z=J[0],K=J[1],H=J[2],D=J[3],I=J[4],A=this.diff_main(z,H,X,Y),M=this.diff_main(K,D,X,Y);return A.concat([[G0.Equal,I]],M)}if(X&&W.length>100&&Q.length>100)return this.diff_lineMode_(W,Q,Y);return this.diff_bisect_(W,Q,Y)}diff_lineMode_(W,Q,X){let Y=this.diff_linesToChars_(W,Q);W=Y.chars1,Q=Y.chars2;let G=Y.lineArray,B=this.diff_main(W,Q,!1,X);this.diff_charsToLines_(B,G),this.diff_cleanupSemantic(B),B.push([G0.Equal,""]);let F=0,L=0,J=0,z="",K="";while(F<B.length){switch(B[F][0]){case G0.Insert:J++,K+=B[F][1];break;case G0.Delete:L++,z+=B[F][1];break;case G0.Equal:if(L>=1&&J>=1){B.splice(F-L-J,L+J),F=F-L-J;let H=this.diff_main(z,K,!1,X);for(let D=H.length-1;D>=0;D--)B.splice(F,0,H[D]);F=F+H.length}J=0,L=0,z="",K="";break}F++}return B.pop(),B}diff_bisect_(W,Q,X){let Y=W.length,G=Q.length,B=Math.ceil((Y+G)/2),F=B,L=2*B,J=Array(L),z=Array(L);for(let N=0;N<L;N++)J[N]=-1,z[N]=-1;J[F+1]=0,z[F+1]=0;let K=Y-G,H=K%2!==0,D=0,I=0,A=0,M=0;for(let N=0;N<B;N++){if(new Date().getTime()>X)break;for(let Z=-N+D;Z<=N-I;Z+=2){let V=F+Z,U;if(Z===-N||Z!==N&&J[V-1]<J[V+1])U=J[V+1];else U=J[V-1]+1;let j=U-Z;while(U<Y&&j<G&&W.charAt(U)===Q.charAt(j))U++,j++;if(J[V]=U,U>Y)I+=2;else if(j>G)D+=2;else if(H){let T=F+K-Z;if(T>=0&&T<L&&z[T]!==-1){let O=Y-z[T];if(U>=O)return this.diff_bisectSplit_(W,Q,U,j,X)}}}for(let Z=-N+A;Z<=N-M;Z+=2){let V=F+Z,U;if(Z===-N||Z!==N&&z[V-1]<z[V+1])U=z[V+1];else U=z[V-1]+1;let j=U-Z;while(U<Y&&j<G&&W.charAt(Y-U-1)===Q.charAt(G-j-1))U++,j++;if(z[V]=U,U>Y)M+=2;else if(j>G)A+=2;else if(!H){let T=F+K-Z;if(T>=0&&T<L&&J[T]!==-1){let O=J[T],w=F+O-T;if(U=Y-U,O>=U)return this.diff_bisectSplit_(W,Q,O,w,X)}}}}return[[G0.Delete,W],[G0.Insert,Q]]}diff_bisectSplit_(W,Q,X,Y,G){let B=W.substring(0,X),F=Q.substring(0,Y),L=W.substring(X),J=Q.substring(Y),z=this.diff_main(B,F,!1,G),K=this.diff_main(L,J,!1,G);return z.concat(K)}diff_linesToChars_(W,Q){let X=[],Y={};X[0]="";let G=this.diff_linesToCharsMunge_(W,X,Y),B=this.diff_linesToCharsMunge_(Q,X,Y);return{chars1:G,chars2:B,lineArray:X}}diff_linesToCharsMunge_(W,Q,X){let Y="",G=0,B=-1,F=Q.length;while(B<W.length-1){if(B=W.indexOf(`
97
+ `,G),B===-1)B=W.length-1;let L=W.substring(G,B+1);if(G=B+1,Object.hasOwn(X,L)||X[L]!==void 0)Y+=String.fromCharCode(X[L]);else Y+=String.fromCharCode(F),X[L]=F,Q[F++]=L}return Y}diff_charsToLines_(W,Q){for(let X of W){let Y=X[1],G=[];for(let B=0;B<Y.length;B++)G[B]=Q[Y.charCodeAt(B)];X[1]=G.join("")}}diff_commonOverlap_(W,Q){let X=W.length,Y=Q.length;if(X===0||Y===0)return 0;if(X>Y)W=W.substring(X-Y);else if(X<Y)Q=Q.substring(0,X);let G=Math.min(X,Y);if(W===Q)return G;let B=0,F=1;for(;;){let L=W.substring(G-F),J=Q.indexOf(L);if(J===-1)return B;if(F+=J,J===0||W.substring(G-F)===Q.substring(0,F))B=F,F++}}diff_halfMatch_(W,Q){if(this.Diff_Timeout<=0)return null;let X=W.length>Q.length?W:Q,Y=W.length>Q.length?Q:W;if(X.length<4||Y.length*2<X.length)return null;let G=this.diff_halfMatchI_(X,Y,Math.ceil(X.length/4),this),B=this.diff_halfMatchI_(X,Y,Math.ceil(X.length/2),this),F;if(G===null&&B===null)return null;else if(G!==null&&B!==null)F=G[4].length>B[4].length?G:B;else if(G!==null)F=G;else if(B!==null)F=B;if(F===void 0)throw Error("hm expected to be defined but was undefined");let L,J,z,K;if(W.length>Q.length)L=F[0],J=F[1],z=F[2],K=F[3];else z=F[0],K=F[1],L=F[2],J=F[3];let H=F[4];return[L,J,z,K,H]}diff_halfMatchI_(W,Q,X,Y){let G=W.substring(X,X+Math.floor(W.length/4)),B=-1,F="",L="",J="",z="",K="";while((B=Q.indexOf(G,B+1))!==-1){let H=Y.diff_commonPrefix(W.substring(X),Q.substring(B)),D=Y.diff_commonSuffix(W.substring(0,X),Q.substring(0,B));if(F.length<D+H)F=Q.substring(B-D,B)+Q.substring(B,B+H),L=W.substring(0,X-D),J=W.substring(X+H),z=Q.substring(0,B-D),K=Q.substring(B+H)}if(F.length*2>=W.length)return[L,J,z,K,F];return null}diff_cleanupSemanticLossless(W){let Q=(Y,G)=>{if(!Y||!G)return 6;let B=/[^a-zA-Z0-9]/,F=Y.charAt(Y.length-1),L=G.charAt(0),J=F.match(B),z=L.match(B),K=J&&F.match(this.whitespaceRegex),H=z&&L.match(this.whitespaceRegex),D=K&&F.match(this.linebreakRegex),I=H&&L.match(this.linebreakRegex),A=D&&Y.match(this.blanklineEndRegex),M=I&&G.match(this.blanklineStartRegex);if(A||M)return 5;else if(D||I)return 4;else if(J&&!K&&H)return 3;else if(K||H)return 2;else if(J||z)return 1;return 0},X=1;while(X<W.length-1){if(W[X-1][0]===G0.Equal&&W[X+1][0]===G0.Equal){let Y=W[X-1][1],G=W[X][1],B=W[X+1][1],F=this.diff_commonSuffix(Y,G);if(F){let H=G.substring(G.length-F);Y=Y.substring(0,Y.length-F),G=H+G.substring(0,G.length-F),B=H+B}let L=Y,J=G,z=B,K=Q(Y,G)+Q(G,B);while(G.charAt(0)===B.charAt(0)){Y+=G.charAt(0),G=G.substring(1)+B.charAt(0),B=B.substring(1);let H=Q(Y,G)+Q(G,B);if(H>=K)K=H,L=Y,J=G,z=B}if(W[X-1][1]!==L){if(L)W[X-1][1]=L;else W.splice(X-1,1),X--;if(W[X][1]=J,z)W[X+1][1]=z;else W.splice(X+1,1),X--}}X++}}diff_xIndex(W,Q){let X=0,Y=0,G=0,B=0,F;for(F=0;F<W.length;F++){if(W[F][0]!==G0.Insert)X+=W[F][1].length;if(W[F][0]!==G0.Delete)Y+=W[F][1].length;if(X>Q)break;G=X,B=Y}if(W.length!==F&&W[F][0]===G0.Delete)return B;return B+(Q-G)}diff_toDelta(W){let Q=[];for(let X=0;X<W.length;X++)switch(W[X][0]){case G0.Insert:Q[X]="+"+encodeURI(W[X][1]);break;case G0.Delete:Q[X]="-"+W[X][1].length;break;case G0.Equal:Q[X]="="+W[X][1].length;break}return Q.join("\t").replace(/%20/g," ")}diff_fromDelta(W,Q){let X=[],Y=0,G=0,B=Q.split(/\t/g);for(let F of B){let L=F.substring(1);switch(F.charAt(0)){case"+":{try{X[Y++]=[G0.Insert,decodeURI(L)]}catch(J){throw Error("Illegal escape in diff_fromDelta: "+L,{cause:J})}break}case"-":case"=":{let J=parseInt(L,10);if(isNaN(J)||J<0)throw Error("Invalid number in diff_fromDelta: "+L);let z=W.substring(G,G+=J);if(F.charAt(0)==="=")X[Y++]=[G0.Equal,z];else X[Y++]=[G0.Delete,z];break}default:if(F)throw Error(`Invalid diff operation in diff_fromDelta: ${F}`)}}if(G!==W.length)throw Error("Delta length ("+G+") does not equal source text length ("+W.length+").");return X}match_main(W,Q,X){if(W==null||Q==null||X==null)throw Error("Null input. (match_main)");if(X=Math.max(0,Math.min(X,W.length)),W===Q)return 0;else if(!W.length)return-1;else if(W.substring(X,X+Q.length)===Q)return X;else return this.match_bitap_(W,Q,X)}match_bitap_(W,Q,X){if(Q.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");let Y=this.match_alphabet_(Q),G=(D,I)=>{let A=D/Q.length,M=Math.abs(X-I);if(!this.Match_Distance)return M?1:A;return A+M/this.Match_Distance},B=this.Match_Threshold,F=W.indexOf(Q,X);if(F!==-1){if(B=Math.min(G(0,F),B),F=W.lastIndexOf(Q,X+Q.length),F!==-1)B=Math.min(G(0,F),B)}let L=1<<Q.length-1;F=-1;let J,z,K=Q.length+W.length,H;for(let D=0;D<Q.length;D++){J=0,z=K;while(J<z){if(G(D,X+z)<=B)J=z;else K=z;z=Math.floor((K-J)/2+J)}K=z;let I=Math.max(1,X-z+1),A=Math.min(X+z,W.length)+Q.length,M=Array(A+2);M[A+1]=(1<<D)-1;for(let N=A;N>=I;N--){let Z=Y[W.charAt(N-1)];if(D===0)M[N]=(M[N+1]<<1|1)&Z;else{if(H===void 0)throw Error("last_rd should have been set by the previous loop but is undefined");M[N]=(M[N+1]<<1|1)&Z|((H[N+1]|H[N])<<1|1)|H[N+1]}if(M[N]&L){let V=G(D,N-1);if(V<=B)if(B=V,F=N-1,F>X)I=Math.max(1,2*X-F);else break}}if(G(D+1,X)>B)break;H=M}return F}match_alphabet_(W){let Q={};for(let X=0;X<W.length;X++)Q[W.charAt(X)]=0;for(let X=0;X<W.length;X++)Q[W.charAt(X)]|=1<<W.length-X-1;return Q}patch_addContext_(W,Q){if(Q.length===0)return;let X=Q.substring(W.start2,W.start2+W.length1),Y=0;while(Q.indexOf(X)!==Q.lastIndexOf(X)&&X.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin)Y+=this.Patch_Margin,X=Q.substring(W.start2-Y,W.start2+W.length1+Y);Y+=this.Patch_Margin;let G=Q.substring(W.start2-Y,W.start2);if(G)W.diffs.unshift([G0.Equal,G]);let B=Q.substring(W.start2+W.length1,W.start2+W.length1+Y);if(B)W.diffs.push([G0.Equal,B]);W.start1-=G.length,W.start2-=G.length,W.length1+=G.length+B.length,W.length2+=G.length+B.length}patch_deepCopy(W){return W.map((Q)=>Q.clone())}patch_addPadding(W){let Q=this.Patch_Margin,X="";for(let B=1;B<=Q;B++)X+=String.fromCharCode(B);for(let B of W)B.start1+=Q,B.start2+=Q;let Y=W[0],G=Y.diffs;if(G.length===0||G[0][0]!==G0.Equal)G.unshift([G0.Equal,X]),Y.start1-=Q,Y.start2-=Q,Y.length1+=Q,Y.length2+=Q;else if(Q>G[0][1].length){let B=Q-G[0][1].length;G[0][1]=X.substring(G[0][1].length)+G[0][1],Y.start1-=B,Y.start2-=B,Y.length1+=B,Y.length2+=B}if(Y=W[W.length-1],G=Y.diffs,G.length===0||G[G.length-1][0]!==G0.Equal)G.push([G0.Equal,X]),Y.length1+=Q,Y.length2+=Q;else if(Q>G[G.length-1][1].length){let B=Q-G[G.length-1][1].length;G[G.length-1][1]+=X.substring(0,B),Y.length1+=B,Y.length2+=B}return X}patch_splitMax(W){let Q=this.Match_MaxBits;for(let X=0;X<W.length;X++){if(W[X].length1<=Q)continue;let Y=W[X];W.splice(X--,1);let{start1:G,start2:B}=Y,F="";while(Y.diffs.length!==0){let L=new n9(G-F.length,B-F.length),J=!0;if(F!=="")L.length1=L.length2=F.length,L.diffs.push([G0.Equal,F]);while(Y.diffs.length!==0&&L.length1<Q-this.Patch_Margin){let K=Y.diffs[0][0],H=Y.diffs[0][1];if(K===G0.Insert)L.length2+=H.length,B+=H.length,L.diffs.push(Y.diffs.shift()),J=!1;else if(K===G0.Delete&&L.diffs.length===1&&L.diffs[0][0]===G0.Equal&&H.length>2*Q)L.length1+=H.length,G+=H.length,J=!1,L.diffs.push([K,H]),Y.diffs.shift();else{if(H=H.substring(0,Q-L.length1-this.Patch_Margin),L.length1+=H.length,G+=H.length,K===G0.Equal)L.length2+=H.length,B+=H.length;else J=!1;if(L.diffs.push([K,H]),H===Y.diffs[0][1])Y.diffs.shift();else Y.diffs[0][1]=Y.diffs[0][1].substring(H.length)}}F=this.diff_text2(L.diffs),F=F.substring(F.length-this.Patch_Margin);let z=this.diff_text1(Y.diffs).substring(0,this.Patch_Margin);if(z!=="")if(L.length1+=z.length,L.length2+=z.length,L.diffs.length!==0&&L.diffs[L.diffs.length-1][0]===G0.Equal)L.diffs[L.diffs.length-1][1]+=z;else L.diffs.push([G0.Equal,z]);if(!J)W.splice(++X,0,L)}}}}var G0,lO,b$=(W,Q)=>{if(Q===0)return W+",0";else if(Q===1)return`${W+1}`;return`${W+1},${Q}`};var S$=H0(()=>{(function(W){W[W.Delete=-1]="Delete",W[W.Equal=0]="Equal",W[W.Insert=1]="Insert"})(G0||(G0={}));lO={[G0.Insert]:"+",[G0.Delete]:"-",[G0.Equal]:" "}});function mO(W,Q,X,Y){let G=W.slice(0,Q).join(`
98
+ `),B=W.slice(Q+X).join(`
99
+ `);return G+(G?`
100
+ `:"")+Y+(B?`
101
+ `:"")+B}function q$(W,Q,X){let Y=W.replace(/\r\n/g,`
102
+ `),G=Q.replace(/\r\n/g,`
103
+ `),B=X.replace(/\r\n/g,`
104
+ `);if(!G.trim()&&B.trim())return{content:Y+(Y.endsWith(`
105
+ `)?"":`
106
+ `)+B,method:"append"};if(!G)throw Error("Aider SEARCH block must not be empty when replacement is empty");let F=Y.split(G).length-1;if(F===1)return{content:Y.replace(G,()=>B),method:"exact"};if(F>1)throw Error("Aider exact match is ambiguous");let L=(V)=>{let U=V.match(/^[ \t]*/)?.[0]??"";return U.replace(/\t/g," ")+V.slice(U.length).replace(/[ \t]+/g," ").trimEnd()},J=Y.split(`
107
+ `),z=G.split(`
108
+ `),K=[];for(let V=0;V<=J.length-z.length;V+=1)if(z.every((U,j)=>L(J[V+j])===L(U)))K.push(V);if(K.length===1)return{content:mO(J,K[0],z.length,B),method:"whitespace"};if(K.length>1)throw Error("Aider whitespace match is ambiguous");let H=z.find((V)=>V.trim());if(H){let V=H.match(/^[ \t]*/)?.[0]??"",U=[];for(let j of J){if(j.trim()!==H.trim())continue;let T=j.match(/^[ \t]*/)?.[0]??"";if(T===V)continue;let O=z.map((R)=>R.startsWith(V)?T+R.slice(V.length):R).join(`
109
+ `),w=Y.indexOf(O);if(w>=0&&Y.indexOf(O,w+1)<0)U.push({index:w,length:O.length})}if(U.length===1){let j=U[0];return{content:Y.slice(0,j.index)+B+Y.slice(j.index+j.length),method:"relative-indentation"}}if(U.length>1)throw Error("Aider indentation match is ambiguous")}let D=new t7;D.Match_Distance=Math.max(1000,Y.length),D.Match_Threshold=0.5;let I=G.slice(0,D.Match_MaxBits),A=[];for(let V=Y.indexOf(I);V>=0;V=Y.indexOf(I,V+1))A.push(V);if(!A.length){let U=D.match_main(Y,I,0);if(U>=0)A.push(U)}let M=Math.min(64,Math.max(4,Math.ceil(G.length*0.2))),N=[];for(let V of A){let U=Math.max(1,G.length-M),j=Math.min(Y.length-V,G.length+M),T;for(let O=U;O<=j;O+=1){let w=Y.slice(V,V+O),k=D.diff_levenshtein(D.diff_main(G,w))/Math.max(G.length,O);if(!T||k<T.ratio||k===T.ratio&&Math.abs(O-G.length)<Math.abs(T.length-G.length))T={index:V,length:O,ratio:k}}if(T)N.push(T)}N.sort((V,U)=>V.ratio-U.ratio);let Z=N[0];if(!Z||Z.ratio>0.5)throw Error("Aider cascade match failed: SEARCH block was not found with sufficient confidence");if(N[1]&&Math.abs(N[1].ratio-Z.ratio)<Number.EPSILON)throw Error("Aider diff-match-patch match is ambiguous");return{content:Y.slice(0,Z.index)+B+Y.slice(Z.index+Z.length),method:"diff-match-patch"}}var C$=H0(()=>{S$()});import{randomUUID as cO}from"crypto";import{chmod as pO,lstat as e7,mkdir as dO,readFile as C4,rename as iO,unlink as nO,writeFile as WB}from"fs/promises";import t6 from"path";function k$(W){let Q=t6.extname(W);return t6.join(t6.dirname(W),`${t6.basename(W,Q)}.ast-mcp-${cO()}${Q}`)}async function v$(W){try{await nO(W)}catch{}}async function rO(W){let Q=t6.dirname(W),X=await dO(Q,{recursive:!0});if(await a1(W)!==W)throw Error("Parent creation changed the resolved write path");if(!X)return[];let G=[X],B=X;for(let F of t6.relative(X,Q).split(t6.sep)){if(!F)continue;B=t6.join(B,F),G.push(B)}return G}async function yX(W,Q,X,Y,G){let B=k$(W),F=[];try{let L=await QQ(W,Q);try{await WB(B,L,{encoding:"utf8",flag:"wx",mode:X})}catch(J){if(J.code!=="ENOENT")throw J;F=await rO(W),await WB(B,L,{encoding:"utf8",flag:"wx",mode:X})}if(X!==void 0)await pO(B,X);if(await qX(B,G),Y){let J=await C4(W,"utf8"),z=k1(J);if(z!==Y)throw Error(`Stale file context: expected ${Y}, found ${z}`)}return await iO(B,W),F}finally{await v$(B)}}function oO(W,Q,X){if(Q===X)return"";let Y=Q.split(`
110
+ `),G=X.split(`
111
+ `),B=0;while(B<Y.length&&B<G.length&&Y[B]===G[B])B+=1;let F=Y.length,L=G.length;while(F>B&&L>B&&Y[F-1]===G[L-1])F-=1,L-=1;let J=[`--- ${W}`,`+++ ${W}`,`@@ -${B+1},${F-B} +${B+1},${L-B} @@`,...Y.slice(B,F).map((z)=>`-${z}`),...G.slice(B,L).map((z)=>`+${z}`)];return J.length>200?[...J.slice(0,199),"... diff truncated"].join(`
112
+ `):J.join(`
113
+ `)}async function aO(W,Q){let X=await a1(W);return PX(X,async()=>{let Y=await C4(X,"utf8"),G=k1(Y);if(G!==Q.expectedSha256)throw Error("Stale file context: expected "+Q.expectedSha256+", found "+G);let B=Q.astRules??[],F=Q.aiderBlocks??[],L=q4(X),J=await a7(X,L),z=async(I,A)=>{let M=await QQ(X,I);return{changed:M!==Y,diff:oO(X,Y,M),filePath:X,matches:A.matches,matchMethods:A.matchMethods,operations:A.operations,preview:!0,sha256:k1(M),strategy:A.strategy}};if(Q.patchStrategy==="ast"){if(!J||!L)throw Error("REJECTED: non-structurally-rewritable files require patchStrategy 'aider_block' with aiderBlocks");if(B.length===0||F.length>0)throw Error("REJECTED: patchStrategy 'ast' requires astRules and no aiderBlocks");let I=k$(X),A=await e7(X);try{await WB(I,Y,{encoding:"utf8",flag:"wx",mode:A.mode});let M=0;for(let V of B){let U=W6(await o1("run",{json:!0,lang:L,paths:[I],pattern:V.pattern},t6.dirname(X)));if(U.error_count)throw Error(`ast-bro preview failed with ${U.error_count} errors`);let j=Array.isArray(U.matches)?U.matches.length:0,T=V.expectedMatches??1;if(j!==T)throw Error(`AST rule matched ${j} nodes; expected ${T}`);if(T!==1)throw Error("ast-bro run rewrites only the first match per file; narrow the AST rule to exactly one node");let O=W6(await o1("run",{json:!0,lang:L,paths:[I],pattern:V.pattern,rewrite:V.fix,write:!0},t6.dirname(X)));if(O.error_count||O.rewrite_count!==1||O.files?.[0]?.status!=="rewritten")throw Error("ast-bro run did not rewrite exactly one file");M+=j}let N=await C4(I,"utf8");if(Q.preview)return z(N,{matches:M,operations:B.length,strategy:"ast"});await yX(X,N,A.mode,G,Q.chattr);let Z=await C4(X,"utf8");return{engine:"ast-bro.run",filePath:X,matches:M,operations:B.length,preview:!1,sha256:k1(Z),strategy:"ast"}}finally{await v$(I)}}if(J)throw Error("REJECTED: structurally rewritable files require patchStrategy 'ast' with astRules");if(F.length===0||B.length>0)throw Error("REJECTED: patchStrategy 'aider_block' requires aiderBlocks and no astRules");let K=Y,H=[];for(let I of F){let A=q$(K,I.search,I.replace);K=A.content,H.push(A.method)}if(Q.preview)return z(K,{matchMethods:H,operations:F.length,strategy:"aider_block"});await yX(X,K,(await e7(X)).mode,G,Q.chattr);let D=await C4(X,"utf8");return{filePath:X,matchMethods:H,operations:F.length,preview:!1,sha256:k1(D),strategy:"aider_block"}})}async function y$(W){let Q=Object.entries(W);if(Q.length<1||Q.length>F1)throw Error(`file_patch requires between 1 and ${F1} files`);let X={};for(let[Y,G]of Q)X[Y]=await aO(Y,G);return{files:X}}async function sO(W){let Q=await a1(W.filePath);return PX(Q,async()=>{let X=await C4(Q,"utf8").catch(()=>{return}),Y;if(X!==void 0){if(!W.expectedSha256)throw Error("Overwriting an existing file requires expectedSha256");let B=k1(X);if(B!==W.expectedSha256)throw Error("Stale file context: expected "+W.expectedSha256+", found "+B);let F=q4(Q);if(await a7(Q,F))throw Error("REJECTED: structurally rewritable existing files require file_patch with patchStrategy 'ast'");Y=await yX(Q,W.content,(await e7(Q)).mode,B,W.chattr)}else Y=await yX(Q,W.content,void 0,void 0,W.chattr);let G=await C4(Q,"utf8");return{chattr:await SX(Q),created:X===void 0,createdDirectories:Y,filePath:Q,sha256:k1(G)}})}async function _$(W){let Q=Object.entries(W);if(Q.length<1||Q.length>F1)throw Error(`file_write requires between 1 and ${F1} files`);let X={};for(let[Y,G]of Q)X[Y]=await sO({chattr:G.chattr,content:G.content,expectedSha256:G.expectedSha256,filePath:Y});return{files:X}}var g$=H0(()=>{WQ();j$();s7();vX();p7();l9();XQ();c9();C$();CX()});function QB(W){let Q=Kz([m().int().nonnegative(),m().int().positive()]).describe("Zero-based, end-exclusive [start, end] line range"),X=q({filePath:$(),lines:Q.optional(),maxBytes:m().int().positive().max(i9).optional()}),Y=q({replace:$(),search:$()}),G=q({expectedMatches:m().int().positive().optional(),fix:$(),pattern:$().min(1)}),B=q({chmod:m().int().min(0).max(511).optional(),chown:q({gid:m().int().nonnegative(),uid:m().int().nonnegative()}).optional()}),F=q({chattr:B.optional(),content:$(),expectedSha256:$().length(64).optional()}),L=(J,z)=>n($().min(1),J).refine((K)=>Object.keys(K).length>0&&Object.keys(K).length<=F1,z);W.registerTool("file_read",{description:`Batches bounded line slices from non-AST files only. AST-capable files are rejected and must use map/show/search/context/run. Each slice defaults to lines [0, 100], is capped at ${kX} lines and ${i9} bytes, and includes a streaming whole-file SHA-256.`,inputSchema:q({files:f(X).min(1).max(F1)}),title:"Read Bounded Non-AST File Slices"},async({files:J})=>{try{return{content:[{text:JSON.stringify({files:await P$(J)}),type:"text"}]}}catch(z){return _X(z)}}),W.registerTool("file_hash",{description:`Batches streaming whole-file SHA-256 calculations without loading file contents into memory. Use this for fresh patch hashes, including AST-capable files. Accepts up to ${F1} paths.`,inputSchema:q({filePaths:f($()).min(1).max(F1)}),title:"Hash Files Without Reading Content"},async({filePaths:J})=>{try{return{content:[{text:JSON.stringify({files:await R$(J)}),type:"text"}]}}catch(z){return _X(z)}}),W.registerTool("file_write",{description:"Creates or replaces multiple files in one keyed batch. Each key is a file path and each value contains content plus an optional fresh expectedSha256 for existing non-structurally-rewritable files.",inputSchema:L(F,"file_write requires between 1 and 50 files"),title:"Write Files Safely"},async(J)=>{try{return{content:[{text:JSON.stringify(await _$(J)),type:"text"}]}}catch(z){return _X(z)}}),W.registerTool("file_patch",{description:"Patches multiple files in one keyed batch. Each key is a file path and each value contains one expectedSha256, a patchStrategy, ordered aiderBlocks or astRules, and optional preview mode. Preview runs the complete guarded operation and returns a bounded diff without committing.",inputSchema:L(q({aiderBlocks:f(Y).max(F1).optional(),astRules:f(G).max(F1).optional(),chattr:B.optional(),expectedSha256:$().length(64),patchStrategy:J0(["ast","aider_block"]),preview:o().optional()}),"file_patch requires between 1 and 50 files"),title:"Patch Files Through the Enforced State Machine"},async(J)=>{try{return{content:[{text:JSON.stringify(await y$(J)),type:"text"}]}}catch(z){return _X(z)}})}var _X=(W)=>({content:[{text:W instanceof Error?W.message:String(W),type:"text"}],isError:!0});var f$=H0(()=>{m4();g$();vX()});import{lstat as tO,readdir as eO,rm as WE,rmdir as QE}from"fs/promises";import YQ from"path";async function XE(W,Q){let X=q4(W);if(!await d9(W,X))return[];return(W6(await o1("reverse_deps",{file:YQ.relative(Q,W),json:!0},Q)).importers??[]).map((G)=>G.file).filter((G)=>typeof G==="string")}async function YE(W,Q){let X=[],Y=YQ.dirname(W);while(!0){let G=YQ.relative(Q,Y);if(Y===Q||G.startsWith("..")||YQ.isAbsolute(G))break;if((await eO(Y)).length!==0)break;await QE(Y),X.push(Y),Y=YQ.dirname(Y)}return X}async function x$(W){let Q=await Promise.all(Object.entries(W).map(async([G,B])=>{let F=await a1(G);if(!(await tO(F)).isFile())throw Error(`file_delete accepts files only: ${G}`);let J=await w$(F),z=await XE(F,J);if(z.length>0&&!B.forceReferences)throw Error(`file_delete rejected ${G}: referenced by ${z.join(", ")}; set forceReferences to override`);return{filePath:F,importers:z,request:B,root:J}})),X=await m9(Q.map(({filePath:G})=>G),async()=>{let G={};for(let{filePath:B,request:F}of Q){let L=await Bun.file(B).text(),J=k1(L);if(J!==F.expectedSha256)throw Error(`Stale file context: expected ${F.expectedSha256}, found ${J}`)}for(let{filePath:B,importers:F,request:L}of Q)await WE(B),G[B]={deleted:!0,forcedReferences:F.length>0&&L.forceReferences===!0};return G}),Y=new Set;for(let{filePath:G,root:B}of Q)for(let F of await YE(G,B))Y.add(F);return{files:X,removedDirectories:[...Y].sort()}}var h$=H0(()=>{bX();WQ();CX();l9();XQ();c9()});function XB(W){W.registerTool("file_chattr",{description:"Applies the shared chattr contract to multiple root-bounded files under deterministic locks.",inputSchema:n($().min(1),q({chattr:GE,expectedSha256:$().length(64).optional()})).refine((Q)=>Object.keys(Q).length>0&&Object.keys(Q).length<=F1,"file_chattr requires between 1 and 50 files"),title:"Change File Attributes Safely"},async(Q)=>{try{let X=await Promise.all(Object.entries(Q).map(async([G,B])=>({filePath:await a1(G),request:B}))),Y={};return await m9(X.map(({filePath:G})=>G),async()=>{for(let{filePath:G,request:B}of X){if(B.expectedSha256){let F=k1(await Bun.file(G).text());if(F!==B.expectedSha256)throw Error(`Stale file context: expected ${B.expectedSha256}, found ${F}`)}Y[G]={chattr:await qX(G,B.chattr)}}}),{content:[{text:JSON.stringify({files:Y}),type:"text"}]}}catch(X){return u$(X)}}),W.registerTool("file_delete",{description:"Deletes hash-guarded files in one reference-preflighted batch and removes empty ancestor directories within configured roots.",inputSchema:n($().min(1),q({expectedSha256:$().length(64),forceReferences:o().optional()})).refine((Q)=>Object.keys(Q).length>0&&Object.keys(Q).length<=F1,"file_delete requires between 1 and 50 files"),title:"Delete Files Safely"},async(Q)=>{try{return{content:[{text:JSON.stringify(await x$(Q)),type:"text"}]}}catch(X){return u$(X)}})}var GE,u$=(W)=>({content:[{text:W instanceof Error?W.message:String(W),type:"text"}],isError:!0});var l$=H0(()=>{m4();s7();h$();vX();l9();XQ();c9();GE=q({chmod:m().int().min(0).max(511).optional(),chown:q({gid:m().int().nonnegative(),uid:m().int().nonnegative()}).optional()})});function YB(W){QB(W),XB(W),o7(W)}var m$=H0(()=>{M$();f$();l$()});function c$(){let W=new W7({name:"ast-mcp",version:"1.0.0"});return YB(W),W}var p$=H0(()=>{Q7();m$()});function d$(){let W=c$();return BB(W.close.bind(W)),W}var i$=H0(()=>{FB();p$()});class GB{stdin;stdout;buffer=Buffer.alloc(0);started=!1;closed=!1;constructor(W=process.stdin,Q=process.stdout){this.stdin=W;this.stdout=Q}onclose;onerror;onmessage;onData=(W)=>{try{let Q=Buffer.isBuffer(W)?W:Buffer.from(W);if(this.buffer.length+Q.length>n$)throw this.buffer=Buffer.alloc(0),Error(`Stdio input exceeded maximum size of ${n$} bytes`);this.buffer=Buffer.concat([this.buffer,Q]),this.processReadBuffer()}catch(Q){this.onerror?.(Q instanceof Error?Q:Error(String(Q))),this.close()}};onError=(W)=>{this.onerror?.(W)};async start(){if(this.started)throw Error("Stdio transport already started");this.started=!0,this.stdin.on("data",this.onData),this.stdin.on("error",this.onError),this.stdout.on("error",this.onError)}reportInvalidRequest(W){this.onerror?.(W),this.send({error:{code:-32600,message:"Invalid Request"},id:null,jsonrpc:"2.0"}).catch((Q)=>{this.onerror?.(Q instanceof Error?Q:Error(String(Q)))})}processReadBuffer(){while(!0){let W=this.buffer.indexOf(10);if(W===-1)return;let Q=this.buffer.subarray(0,W).toString("utf8").replace(/\r$/,"");this.buffer=this.buffer.subarray(W+1);try{let X=JSON.parse(Q);if(Array.isArray(X)&&X.length===0){this.reportInvalidRequest(Error("JSON-RPC batches must not be empty"));continue}let Y=(Array.isArray(X)?X:[X]).flatMap((G)=>{try{return[pG(JSON.stringify(G))]}catch(B){return this.reportInvalidRequest(B instanceof Error?B:Error(String(B))),[]}});for(let G of Y)this.onmessage?.(G)}catch(X){this.reportInvalidRequest(X instanceof Error?X:Error(String(X)))}}}async close(){if(this.closed)return;if(this.closed=!0,this.stdin.off("data",this.onData),this.stdin.off("error",this.onError),this.stdout.off("error",this.onError),this.stdin.listenerCount("data")===0)this.stdin.pause();this.buffer=Buffer.alloc(0),this.onclose?.()}send(W){if(this.closed)return Promise.reject(Error("Stdio transport is closed"));return new Promise((Q,X)=>{let Y=!1,G=(F)=>{if(Y)return;Y=!0,this.stdout.off("error",G),this.stdout.off("drain",B),X(F)},B=()=>{if(Y)return;Y=!0,this.stdout.off("error",G),this.stdout.off("drain",B),Q()};if(this.stdout.once("error",G),this.stdout.write(dG(W))){if(Y)return;Y=!0,this.stdout.off("error",G),Q()}else this.stdout.once("drain",B)})}}var n$=10485760;var r$=H0(()=>{Q7()});var LE={};var BE,FE;var o$=H0(async()=>{i$();r$();BE=d$(),FE=new GB;await BE.connect(FE)});await o$().then(() => LE);
114
+
115
+ //# debugId=7733F07BFB54C04564756E2164756E21